diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarLogCoshSecond.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarLogCoshSecond.lean new file mode 100644 index 0000000000000000000000000000000000000000..035bec50998f1d50fb45e57473b6efb775bb39d8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarLogCoshSecond.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarSecondDerivative + +namespace OAI + +/-! Bounded first and second spatial derivatives for the scalar Ising +backward recursion, including degenerate covariance increments. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma field_hasDerivAt_tanh (z : ℝ) : + HasDerivAt Real.tanh (1 / (Real.cosh z) ^ 2) z := by + have h := (Real.hasDerivAt_sinh z).div (Real.hasDerivAt_cosh z) (Real.cosh_pos z).ne' + have hrel := Real.cosh_sq_sub_sinh_sq z + convert h using 1 + · funext x + exact Real.tanh_eq_sinh_div_cosh x + · rw [← pow_two, ← pow_two, hrel] + +lemma field_tanh_second_bound (z : ℝ) : |1 / (Real.cosh z) ^ 2| ≤ 1 := by + rw [abs_of_nonneg (by positivity : 0 ≤ 1 / (Real.cosh z) ^ 2)] + apply (div_le_one (sq_pos_of_pos (Real.cosh_pos z))).mpr + nlinarith [Real.one_le_cosh z] + +theorem fieldScalarLogCoshSecond_regular (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : + Measurable (fieldScalarSecond L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2)) ∧ + ∀ z, |fieldScalarSecond L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) z| ≤ fieldScalarSecondCap L 1 1 := by + have ht : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + apply fieldScalarSecond_regular L hL measurable_logCosh logCosh_linearGrowth + ht + (by fun_prop) zero_le_one field_abs_tanh_le_one field_tanh_second_bound + +theorem hasDerivAt_fieldScalarLogCoshMean (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + HasDerivAt (fieldScalarMean L (fun x => Real.log (Real.cosh x)) Real.tanh) + (fieldScalarSecond L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) z) z := by + have ht : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + apply hasDerivAt_fieldScalarMean L hL measurable_logCosh logCosh_linearGrowth ht + (by fun_prop) zero_le_one field_abs_tanh_le_one field_tanh_second_bound + · intro x + simpa only [Real.tanh_eq_sinh_div_cosh] using + (Real.hasDerivAt_cosh x).log (Real.cosh_pos x).ne' + · exact field_hasDerivAt_tanh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1cc734ebaf11f40c2f5662bb89143613ff854f4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOrder.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarChain + +namespace OAI + +/-! Radial order of the actual scalar backward values and physical spin +means, with covariance increments fixed. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldScalarValue_even (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (he : Function.Even F) : + Function.Even (fieldScalarValue L F) := by + induction L with + | nil => exact he + | cons av L ih => + have ht (bv) (hb : bv ∈ L) := hL bv (List.mem_cons_of_mem av hb) + have hr := fieldScalarValue_regular L ht hF hG + exact gaussianOperator_even av.1 av.2 hr.1 (ih ht) + +lemma fieldScalarValue_difference_monotone (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F G : ℝ → ℝ} + (hF : Measurable F) (hG : Measurable G) + (hFg : HasLinearGrowth F) (hGg : HasLinearGrowth G) + (hFe : Function.Even F) (hGe : Function.Even G) + (hFG : MonotoneOn (fun z => G z - F z) (Ici 0)) : + MonotoneOn (fun z => fieldScalarValue L G z - fieldScalarValue L F z) (Ici 0) := by + induction L with + | nil => exact hFG + | cons av L ih => + have ht (bv) (hb : bv ∈ L) := hL bv (List.mem_cons_of_mem av hb) + have hFr := fieldScalarValue_regular L ht hF hFg + have hGr := fieldScalarValue_regular L ht hG hGg + exact gaussianOperator_difference_monotone av.2 (hL av List.mem_cons_self).le + _ _ hFr.1 hGr.1 (fieldScalarValue_even L ht hF hFg hFe) + (fieldScalarValue_even L ht hG hGg hGe) hFr.2 hGr.2 (ih ht) + +lemma fieldScalarMean_shape (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hFe : Function.Even F) + (ha : Measurable a) (hao : Function.Odd a) + (ham : MonotoneOn a (Ici 0)) (hap : ∀ z ∈ Ici (0 : ℝ), 0 ≤ a z) + {K : ℝ} (haB : ∀ z, |a z| ≤ K) : + Function.Odd (fieldScalarMean L F a) ∧ + MonotoneOn (fieldScalarMean L F a) (Ici 0) ∧ + ∀ z ∈ Ici (0 : ℝ), 0 ≤ fieldScalarMean L F a z := by + induction L with + | nil => exact ⟨hao, ham, hap⟩ + | cons av L ih => + have ht (bv) (hb : bv ∈ L) := hL bv (List.mem_cons_of_mem av hb) + have hr := fieldScalarValue_regular L ht hF hG + have hm := fieldScalarMean_regular L ht hF hG ha haB + have hs := ih ht + have he := fieldScalarValue_even L ht hF hG hFe + refine ⟨fieldSpinTransition_odd av.1 av.2 hr.1 he hm.1 hs.1, ?_, ?_⟩ + · exact fieldSpinTransition_monotone (hL av List.mem_cons_self).le av.2 + hr.1 he hr.2 hm.1 hs.1 hs.2.1 hs.2.2 hm.2 + · intro z hz + exact fieldSpinTransition_nonneg av.1 av.2 hr.1 he hr.2 hm.1 hs.1 hs.2.2 hm.2 hz + +lemma fieldScalarMean_order (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F G a b : ℝ → ℝ} + (hF : Measurable F) (hG : Measurable G) + (hFg : HasLinearGrowth F) (hGg : HasLinearGrowth G) + (hFe : Function.Even F) (hGe : Function.Even G) + (hFG : MonotoneOn (fun z => G z - F z) (Ici 0)) + (ha : Measurable a) (hb : Measurable b) + (hao : Function.Odd a) (hbo : Function.Odd b) + (ham : MonotoneOn a (Ici 0)) (hbm : MonotoneOn b (Ici 0)) + (hap : ∀ z ∈ Ici (0 : ℝ), 0 ≤ a z) (hbp : ∀ z ∈ Ici (0 : ℝ), 0 ≤ b z) + {K : ℝ} (haB : ∀ z, |a z| ≤ K) (hbB : ∀ z, |b z| ≤ K) + (hab : ∀ z ∈ Ici (0 : ℝ), a z ≤ b z) : + ∀ z ∈ Ici (0 : ℝ), fieldScalarMean L F a z ≤ fieldScalarMean L G b z := by + induction L with + | nil => exact hab + | cons av L ih => + have ht (bv) (hc : bv ∈ L) := hL bv (List.mem_cons_of_mem av hc) + have hFr := fieldScalarValue_regular L ht hF hFg + have hGr := fieldScalarValue_regular L ht hG hGg + have hmr := fieldScalarMean_regular L ht hF hFg ha haB + have hnr := fieldScalarMean_regular L ht hG hGg hb hbB + have hms := fieldScalarMean_shape L ht hF hFg hFe ha hao ham hap haB + have hns := fieldScalarMean_shape L ht hG hGg hGe hb hbo hbm hbp hbB + intro z hz + by_cases hv : av.2 = 0 + · simpa only [fieldScalarMean, hv, fieldSpinTransition_zero_variance] using ih ht z hz + · exact field_gaussian_spin_transition_order av.2 hv (hL av List.mem_cons_self).le + _ _ _ _ hFr.1 hGr.1 (fieldScalarValue_even L ht hF hFg hFe) + (fieldScalarValue_even L ht hG hGg hGe) hFr.2 hGr.2 + (fieldScalarValue_difference_monotone L ht hF hG hFg hGg hFe hGe hFG) + hmr.1 hnr.1 hms.1 hns.1 hms.2.1 hms.2.2 (ih ht) hmr.2 hnr.2 hz le_rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOverlap.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..34adfe1c3f72fb49005a625571fc7b8fa36da85c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOverlap.lean @@ -0,0 +1,114 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarChain + +namespace OAI + +/-! The scalar field's actual level overlaps. Their ordering is the +conditional Jensen inequality, and zero increments give exact ties. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldScalarSquares_monotone (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (haB : ∀ u, |a u| ≤ 1) (z : ℝ) : + Monotone (fun i => fieldScalarSquares L F a i z) := by + induction L generalizing z with + | nil => + intro i j _ + exact le_rfl + | cons av L ih => + have htail (bv) (hb : bv ∈ L) := hL bv (List.mem_cons_of_mem av hb) + have hval := fieldScalarValue_regular L htail hF hG + have hmean := fieldScalarMean_regular L htail hF hG ha haB + have hreg := fieldScalarSquares_regular L htail hF hG ha haB + apply Fin.monotone_iff_le_succ.mpr + intro i + refine Fin.cases ?_ (fun j => ?_) i + · change (fieldSpinTransition av.1 av.2 (fieldScalarValue L F) (fieldScalarMean L F a) z) ^ 2 ≤ + fieldSpinTransition av.1 av.2 (fieldScalarValue L F) (fieldScalarSquares L F a 0) z + have he : fieldScalarSquares L F a 0 = fun u => (fieldScalarMean L F a u) ^ 2 := by + funext u + exact fieldScalarSquares_zero L F a u + rw [he] + exact fieldSpinTransition_square_le av.1 av.2 hval.1 hval.2 hmean.1 hmean.2 z + · change fieldSpinTransition av.1 av.2 (fieldScalarValue L F) + (fieldScalarSquares L F a j.castSucc) z ≤ + fieldSpinTransition av.1 av.2 (fieldScalarValue L F) + (fieldScalarSquares L F a j.succ) z + apply fieldSpinTransition_mono_test av.1 av.2 (fieldScalarValue L F) + (hreg j.castSucc).1 (hreg j.succ).1 + (fun u => by rw [abs_of_nonneg ((hreg j.castSucc).2 u).1]; exact ((hreg j.castSucc).2 u).2) + (fun u => by rw [abs_of_nonneg ((hreg j.succ).2 u).1]; exact ((hreg j.succ).2 u).2) + intro u + exact ih htail u (by change j.val ≤ j.val + 1; omega) + +lemma fieldScalarSquares_tied_increment (L : List (ℝ × ℝ≥0)) + (F a : ℝ → ℝ) (i : Fin L.length) (hi : (L.get i).2 = 0) : + fieldScalarSquares L F a i.castSucc = fieldScalarSquares L F a i.succ := by + induction L with + | nil => exact Fin.elim0 i + | cons av L ih => + revert hi + refine Fin.cases ?_ (fun j => ?_) i + · intro hi + have hav : av.2 = 0 := by simpa only [List.get_cons_zero] using hi + funext z + simp only [Fin.castSucc_zero, fieldScalarSquares, Fin.cons_zero, Fin.cons_succ, fieldScalarMean, + hav, fieldSpinTransition_zero_variance, fieldScalarSquares_zero] + · intro hi + have hj : (L.get j).2 = 0 := by + change (L.get j).2 = 0 at hi + exact hi + funext z + change fieldSpinTransition av.1 av.2 (fieldScalarValue L F) + (fieldScalarSquares L F a j.castSucc) z = + fieldSpinTransition av.1 av.2 (fieldScalarValue L F) + (fieldScalarSquares L F a j.succ) z + rw [ih j hj] + +/-- Root Gaussian averaging produces the level second moments `B_i`. -/ +def fieldScalarOverlaps (L : List (ℝ × ℝ≥0)) (root : ℝ≥0) + (F a : ℝ → ℝ) (i : Fin (L.length + 1)) : ℝ := + ∫ z, fieldScalarSquares L F a i z ∂gaussianReal 0 root + +lemma fieldScalarOverlaps_mem_unit (L : List (ℝ × ℝ≥0)) (root : ℝ≥0) + (hL : ∀ av ∈ L, 0 < av.1) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (haB : ∀ u, |a u| ≤ 1) (i : Fin (L.length + 1)) : + fieldScalarOverlaps L root F a i ∈ Icc (0 : ℝ) 1 := by + have hr := fieldScalarSquares_regular L hL hF hG ha haB i + have hi : Integrable (fieldScalarSquares L F a i) (gaussianReal 0 root) := + Integrable.of_bound hr.1.aestronglyMeasurable 1 + (Filter.Eventually.of_forall (fun z => by rw [Real.norm_eq_abs, abs_of_nonneg (hr.2 z).1]; exact (hr.2 z).2)) + refine ⟨integral_nonneg (fun z => (hr.2 z).1), ?_⟩ + have h := integral_mono hi (integrable_const (1 : ℝ)) (fun z => (hr.2 z).2) + simpa only [fieldScalarOverlaps, integral_const, measureReal_def, measure_univ, ENNReal.toReal_one, + one_smul] using h + +lemma fieldScalarOverlaps_monotone (L : List (ℝ × ℝ≥0)) (root : ℝ≥0) + (hL : ∀ av ∈ L, 0 < av.1) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (haB : ∀ u, |a u| ≤ 1) : + Monotone (fieldScalarOverlaps L root F a) := by + have hi (i : Fin (L.length + 1)) : Integrable (fieldScalarSquares L F a i) (gaussianReal 0 root) := by + have hr := fieldScalarSquares_regular L hL hF hG ha haB i + exact Integrable.of_bound hr.1.aestronglyMeasurable 1 + (Filter.Eventually.of_forall (fun z => by rw [Real.norm_eq_abs, abs_of_nonneg (hr.2 z).1]; exact (hr.2 z).2)) + intro i j hij + exact integral_mono (hi i) (hi j) (fun z => fieldScalarSquares_monotone L hL hF hG ha haB z hij) + +lemma fieldScalarOverlaps_tied_increment (L : List (ℝ × ℝ≥0)) (root : ℝ≥0) + (F a : ℝ → ℝ) (i : Fin L.length) (hi : (L.get i).2 = 0) : + fieldScalarOverlaps L root F a i.castSucc = fieldScalarOverlaps L root F a i.succ := by + unfold fieldScalarOverlaps + rw [fieldScalarSquares_tied_increment L F a i hi] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSampling.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..748217a8ae811d02f783a3454173ec34d91e921a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSampling.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinSampling +import OAI.Probability.InvariantIsing.Fields.FieldMagnetization + +namespace OAI + +/-! Common-prefix sampling of two scalar Ising spins. After the split +the two tails are independent; before the split they use the same actual +tilted Gaussian transition. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldPairSpinKernel : (L : List (ℝ × ℝ≥0)) → + (∀ av ∈ L, 0 < av.1) → Fin (L.length + 1) → Kernel ℝ (Bool × Bool) + | [], _, _ => scalarSpinKernel ×ₖ scalarSpinKernel + | av :: L, hL, i => + let ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + Fin.cases (fieldTailSpinKernel (av :: L) hL ×ₖ fieldTailSpinKernel (av :: L) hL) + (fun j => fieldPairSpinKernel L ht j ∘ₖ + fieldTransitionKernel av.1 av.2 (fieldScalarValue L (fun z => Real.log (Real.cosh z))) + hreg.1) i + +instance fieldPairSpinKernel_markov (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) : + IsMarkovKernel (fieldPairSpinKernel L hL i) := by + induction L with + | nil => change IsMarkovKernel (scalarSpinKernel ×ₖ scalarSpinKernel); infer_instance + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · change IsMarkovKernel (fieldTailSpinKernel (av :: L) hL ×ₖ + fieldTailSpinKernel (av :: L) hL) + infer_instance + · have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let _ := ih ht j + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +theorem fieldPairSpinKernel_mean (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) (z : ℝ) : + (∫ σ, spinValue σ.1 * spinValue σ.2 ∂fieldPairSpinKernel L hL i z) = + fieldScalarSquares L (fun u => Real.log (Real.cosh u)) Real.tanh i z := by + induction L generalizing z with + | nil => + simp only [fieldPairSpinKernel, Kernel.prod_apply, integral_prod_mul, + scalarSpinKernel_mean, fieldScalarSquares, pow_two] + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · change (∫ σ, spinValue σ.1 * spinValue σ.2 + ∂(fieldTailSpinKernel (av :: L) hL ×ₖ fieldTailSpinKernel (av :: L) hL) z) = _ + rw [Kernel.prod_apply, integral_prod_mul, fieldTailSpinKernel_mean] + rw [fieldScalarSquares_zero, pow_two] + · have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + change (∫ σ, spinValue σ.1 * spinValue σ.2 + ∂(fieldPairSpinKernel L ht j ∘ₖ + fieldTransitionKernel av.1 av.2 (fieldScalarValue L (fun u => Real.log (Real.cosh u))) + hreg.1) z) = _ + rw [Kernel.integral_comp (Integrable.of_finite)] + simp_rw [ih ht] + exact fieldTransitionKernel_integral av.1 av.2 _ hreg.1 hreg.2 _ z + +/-- The field's root is shared by the two replicas. -/ +def fieldLevelSpinPair (h : FieldStep) (i : Fin (h.depth + 1)) : Measure (Bool × Bool) := + fieldPairSpinKernel (scalarFieldIncrements h) (scalarFieldIncrements_positive h) + (Fin.cast (by rw [scalarFieldIncrements_length]) i) ∘ₘ + gaussianReal 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + +instance fieldLevelSpinPair_probability (h : FieldStep) (i : Fin (h.depth + 1)) : + IsProbabilityMeasure (fieldLevelSpinPair h i) := by + unfold fieldLevelSpinPair + infer_instance + +theorem fieldLevelSpinPair_mean (h : FieldStep) (i : Fin (h.depth + 1)) : + (∫ σ, spinValue σ.1 * spinValue σ.2 ∂fieldLevelSpinPair h i) = + fieldMagnetizationLevel h i := by + unfold fieldLevelSpinPair + rw [Measure.comp_eq_comp_const_apply, Kernel.integral_comp (Integrable.of_finite)] + simp only [Kernel.const_apply, fieldPairSpinKernel_mean] + rfl + +/-- The common-level spin test in the evaluated cavity law. -/ +theorem fieldLevelSpinPair_test (h : FieldStep) (q : OverlapPath) (Φ : ℝ → ℝ) : + (∫ s, ∫ σ, Φ (q s) * (spinValue σ.1 * spinValue σ.2) + ∂fieldLevelSpinPair h (fieldLevelIndex h s) ∂pathMeasure) = + ∫ s, Φ (q s) * fieldMagnetizationPath h s ∂pathMeasure := by + apply integral_congr_ae + filter_upwards [] with s + rw [integral_const_mul, fieldLevelSpinPair_mean] + rfl + +/-- Sampling the spin pair leaves every common-level observable unchanged. -/ +theorem fieldLevelSpinPair_level_test (h : FieldStep) (q : OverlapPath) (Φ : ℝ → ℝ) : + (∫ s, ∫ _σ, Φ (q s) ∂fieldLevelSpinPair h (fieldLevelIndex h s) ∂pathMeasure) = + ∫ s, Φ (q s) ∂pathMeasure := by + simp only [integral_const, probReal_univ, one_smul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarScaling.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b0b27393cd80eba916fb6196f7a97a329df5536 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarScaling.lean @@ -0,0 +1,152 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarOverlap +import OAI.Probability.InvariantIsing.Fields.FieldCovarianceScaling + +namespace OAI + +/-! Change of position units for the actual finite conditional spin +chain. The spin observable acquires no multiplicative derivative factor. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldScaleIncrements (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) : List (ℝ × ℝ≥0) := + L.map (fun av => (av.1, c ^ 2 * av.2)) + +lemma fieldScaleIncrements_length (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) : + (fieldScaleIncrements c L).length = L.length := by + simp only [fieldScaleIncrements, List.length_map] + +private lemma scalar_value_measurable (L : List (ℝ × ℝ≥0)) + {F : ℝ → ℝ} (hF : Measurable F) : Measurable (fieldScalarValue L F) := by + induction L with + | nil => exact hF + | cons av L ih => + change Measurable (gaussianOperator av.1 av.2 (fieldScalarValue L F)) + rw [gaussianOperator_eq_transform] + exact measurable_gaussianTransform ih _ _ + +private lemma scalar_mean_measurable (L : List (ℝ × ℝ≥0)) + {F a : ℝ → ℝ} (hF : Measurable F) (ha : Measurable a) : + Measurable (fieldScalarMean L F a) := by + induction L with + | nil => exact ha + | cons av L ih => + exact measurable_fieldSpinTransition av.1 av.2 (scalar_value_measurable L hF) ih + +private lemma scalar_squares_measurable (L : List (ℝ × ℝ≥0)) + {F a : ℝ → ℝ} (hF : Measurable F) (ha : Measurable a) : + ∀ i, Measurable (fieldScalarSquares L F a i) := by + induction L with + | nil => intro i; exact ha.pow_const 2 + | cons av L ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact (scalar_mean_measurable (av :: L) hF ha).pow_const 2 + · exact measurable_fieldSpinTransition av.1 av.2 (scalar_value_measurable L hF) (ih j) + +lemma fieldSpinTransition_scale_position (ζ : ℝ) (v c : ℝ≥0) + {F a : ℝ → ℝ} (hF : Measurable F) (ha : Measurable a) (z : ℝ) : + fieldSpinTransition ζ v (fun u => F (c * u)) (fun u => a (c * u)) z = + fieldSpinTransition ζ (c ^ 2 * v) F a (c * z) := by + have hFc : Measurable (fun u => F ((c : ℝ) * u)) := hF.comp (measurable_id.const_mul _) + have hac : Measurable (fun u => a ((c : ℝ) * u)) := ha.comp (measurable_id.const_mul _) + rw [fieldSpinTransition_eq_standard ζ v hFc hac, + fieldSpinTransition_eq_standard ζ (c ^ 2 * v) hF ha, + gaussianTiltAverage_eq_div, gaussianTiltAverage_eq_div] + have hs : Real.sqrt ((c ^ 2 * v : ℝ≥0) : ℝ) = c * Real.sqrt (v : ℝ) := by + rw [NNReal.coe_mul, NNReal.coe_pow, Real.sqrt_mul (sq_nonneg _), + Real.sqrt_sq c.coe_nonneg] + have he (u : ℝ) : (c : ℝ) * (z + Real.sqrt (v : ℝ) * u) = + c * z + (c * Real.sqrt (v : ℝ)) * u := by ring + simp only [hs, he] + +lemma fieldScalarValue_scale_position (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) + (F : ℝ → ℝ) (z : ℝ) : + fieldScalarValue L (fun u => F (c * u)) z = + fieldScalarValue (fieldScaleIncrements c L) F (c * z) := by + induction L generalizing z with + | nil => rfl + | cons av L ih => + have he : fieldScalarValue L (fun u => F (c * u)) = + fun u => fieldScalarValue (fieldScaleIncrements c L) F (c * u) := funext ih + change gaussianOperator av.1 av.2 (fieldScalarValue L (fun u => F (c * u))) z = + gaussianOperator av.1 (c ^ 2 * av.2 : ℝ≥0) (fieldScalarValue (fieldScaleIncrements c L) F) (c * z) + rw [he] + simpa only [NNReal.coe_mul, NNReal.coe_pow] using + gaussianOperator_scale_position av.1 av.2 c c.coe_nonneg _ z + +lemma fieldScalarMean_scale_position (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) + {F a : ℝ → ℝ} (hF : Measurable F) (ha : Measurable a) (z : ℝ) : + fieldScalarMean L (fun u => F (c * u)) (fun u => a (c * u)) z = + fieldScalarMean (fieldScaleIncrements c L) F a (c * z) := by + induction L generalizing z with + | nil => rfl + | cons av L ih => + have hv : fieldScalarValue L (fun u => F (c * u)) = + fun u => fieldScalarValue (fieldScaleIncrements c L) F (c * u) := + funext (fieldScalarValue_scale_position c L F) + have hm : fieldScalarMean L (fun u => F (c * u)) (fun u => a (c * u)) = + fun u => fieldScalarMean (fieldScaleIncrements c L) F a (c * u) := funext ih + change fieldSpinTransition av.1 av.2 (fieldScalarValue L (fun u => F (c * u))) + (fieldScalarMean L (fun u => F (c * u)) (fun u => a (c * u))) z = + fieldSpinTransition av.1 (c ^ 2 * av.2) (fieldScalarValue (fieldScaleIncrements c L) F) + (fieldScalarMean (fieldScaleIncrements c L) F a) (c * z) + rw [hv, hm] + exact fieldSpinTransition_scale_position av.1 av.2 c + (scalar_value_measurable _ hF) (scalar_mean_measurable _ hF ha) z + +lemma fieldScalarSquares_scale_position (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) + {F a : ℝ → ℝ} (hF : Measurable F) (ha : Measurable a) + (i : Fin (L.length + 1)) (z : ℝ) : + fieldScalarSquares L (fun u => F (c * u)) (fun u => a (c * u)) i z = + fieldScalarSquares (fieldScaleIncrements c L) F a + (Fin.cast (by rw [fieldScaleIncrements_length]) i) (c * z) := by + induction L generalizing z with + | nil => rfl + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · simpa only [Fin.cast_zero, fieldScalarSquares_zero] using + congrArg (fun x : ℝ => x ^ 2) (fieldScalarMean_scale_position c (av :: L) hF ha z) + · have hv : fieldScalarValue L (fun u => F (c * u)) = + fun u => fieldScalarValue (fieldScaleIncrements c L) F (c * u) := + funext (fieldScalarValue_scale_position c L F) + have hq : fieldScalarSquares L (fun u => F (c * u)) (fun u => a (c * u)) j = + fun u => fieldScalarSquares (fieldScaleIncrements c L) F a + (Fin.cast (by simp only [fieldScaleIncrements_length, List.length_cons]) j) (c * u) := funext (ih j) + change fieldSpinTransition av.1 av.2 (fieldScalarValue L (fun u => F (c * u))) + (fieldScalarSquares L (fun u => F (c * u)) (fun u => a (c * u)) j) z = + fieldSpinTransition av.1 (c ^ 2 * av.2) (fieldScalarValue (fieldScaleIncrements c L) F) + (fieldScalarSquares (fieldScaleIncrements c L) F a + (Fin.cast (by simp only [fieldScaleIncrements_length, List.length_cons]) j)) (c * z) + rw [hv, hq] + exact fieldSpinTransition_scale_position av.1 av.2 c + (scalar_value_measurable _ hF) (scalar_squares_measurable _ hF ha _) z + +lemma fieldScalarOverlaps_scale_position (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) + (root : ℝ≥0) {F a : ℝ → ℝ} (hF : Measurable F) (ha : Measurable a) + (i : Fin (L.length + 1)) : + fieldScalarOverlaps L root (fun u => F (c * u)) (fun u => a (c * u)) i = + fieldScalarOverlaps (fieldScaleIncrements c L) (c ^ 2 * root) F a + (Fin.cast (by rw [fieldScaleIncrements_length]) i) := by + have hs : NNReal.mk ((c : ℝ) ^ 2) (sq_nonneg _) = c ^ 2 := by + apply Subtype.ext + rfl + have hm : (gaussianReal 0 root).map (fun u : ℝ => (c : ℝ) * u) = + gaussianReal 0 (c ^ 2 * root) := by + simpa only [mul_zero, hs] using + gaussianReal_map_const_mul (μ := 0) (v := root) (c : ℝ) + unfold fieldScalarOverlaps + simp_rw [fieldScalarSquares_scale_position c L hF ha i] + rw [← hm] + have hc : Measurable (fun u : ℝ => (c : ℝ) * u) := measurable_const.mul measurable_id + exact (integral_map hc.aemeasurable + (scalar_squares_measurable _ hF ha _).aestronglyMeasurable).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSecondDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSecondDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..34ed3abb8638956fe25610e7a367ae228bfada89 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSecondDerivative.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinSecondDerivative +import OAI.Probability.InvariantIsing.Fields.FieldScalarDerivative + +namespace OAI + +/-! Bounded second derivatives through the actual finite scalar recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldScalarSecond : List (ℝ × ℝ≥0) → (ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ) → ℝ → ℝ + | [], _, _, b => b + | av :: L, F, a, b => fun z => + fieldSpinTransition av.1 av.2 (fieldScalarValue L F) (fieldScalarSecond L F a b) z + + av.1 * (fieldSpinTransition av.1 av.2 (fieldScalarValue L F) + (fun u => (fieldScalarMean L F a u) ^ 2) z - + (fieldScalarMean (av :: L) F a z) ^ 2) + +def fieldScalarSecondCap (L : List (ℝ × ℝ≥0)) (K C : ℝ) : ℝ := + L.foldr (fun av c => c + 2 * |av.1| * K ^ 2) C + +theorem fieldScalarSecond_regular (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a b : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (ha : Measurable a) (hb : Measurable b) + {K C : ℝ} (hK : 0 ≤ K) (haB : ∀ z, |a z| ≤ K) (hbB : ∀ z, |b z| ≤ C) : + Measurable (fieldScalarSecond L F a b) ∧ + ∀ z, |fieldScalarSecond L F a b z| ≤ fieldScalarSecondCap L K C := by + induction L with + | nil => exact ⟨hb, hbB⟩ + | cons av L ih => + have htail (bv) (h : bv ∈ L) := hL bv (List.mem_cons_of_mem av h) + obtain ⟨hm, hB⟩ := ih htail + have hval := fieldScalarValue_regular L htail hF hG + have hmean := fieldScalarMean_regular L htail hF hG ha haB + have hnew := fieldScalarMean_regular (av :: L) hL hF hG ha haB + refine ⟨?_, ?_⟩ + · exact (measurable_fieldSpinTransition av.1 av.2 hval.1 hm).add + (((measurable_fieldSpinTransition av.1 av.2 hval.1 (hmean.1.pow_const 2)).sub + (hnew.1.pow_const 2)).const_mul av.1) + · intro z + have h := fieldSpinTransition_derivative_bound av.1 av.2 hval.1 hval.2 + hK hK hmean.2 hmean.2 hB z + simpa only [fieldScalarSecond, fieldScalarSecondCap, List.foldr_cons, + fieldScalarMean, pow_two, mul_assoc] using h + +theorem hasDerivAt_fieldScalarMean (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a b : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (ha : Measurable a) (hb : Measurable b) + {K C : ℝ} (hK : 0 ≤ K) (haB : ∀ z, |a z| ≤ K) (hbB : ∀ z, |b z| ≤ C) + (hd : ∀ z, HasDerivAt F (a z) z) (hdd : ∀ z, HasDerivAt a (b z) z) (z : ℝ) : + HasDerivAt (fieldScalarMean L F a) (fieldScalarSecond L F a b z) z := by + induction L generalizing z with + | nil => exact hdd z + | cons av L ih => + have htail (bv) (h : bv ∈ L) := hL bv (List.mem_cons_of_mem av h) + have hval := fieldScalarValue_regular L htail hF hG + have hmean := fieldScalarMean_regular L htail hF hG ha haB + have hsecond := fieldScalarSecond_regular L htail hF hG ha hb hK haB hbB + have h := hasDerivAt_fieldSpinTransition av.1 av.2 hval.1 hval.2 hmean.1 hmean.1 + hsecond.1 hK hK hmean.2 hmean.2 hsecond.2 + (hasDerivAt_fieldScalarValue L htail hF hG ha hK haB hd) (ih htail) z + simpa only [fieldScalarMean, fieldScalarSecond, pow_two] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSquareOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSquareOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..7bfd0dc757ee6b1608df7a8ffa1e39c1d47836f8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSquareOrder.lean @@ -0,0 +1,111 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarOrder +import OAI.Probability.InvariantIsing.Fields.FieldScalarOverlap +import OAI.Probability.InvariantIsing.Fields.FieldEvenTransition + +namespace OAI + +/-! Ordered even second-moment tests propagated through the actual +finite tilted position chain. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldScalarSquares_shape (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hFe : Function.Even F) + (ha : Measurable a) (hao : Function.Odd a) + (ham : MonotoneOn a (Ici 0)) (hap : ∀ z ∈ Ici (0 : ℝ), 0 ≤ a z) + (haB : ∀ z, |a z| ≤ 1) : + ∀ i, Function.Even (fieldScalarSquares L F a i) ∧ + MonotoneOn (fieldScalarSquares L F a i) (Ici 0) := by + have hsq (f : ℝ → ℝ) (ho : Function.Odd f) + (hm : MonotoneOn f (Ici 0)) (hp : ∀ z ∈ Ici (0 : ℝ), 0 ≤ f z) : + Function.Even (fun z => (f z) ^ 2) ∧ MonotoneOn (fun z => (f z) ^ 2) (Ici 0) := by + refine ⟨fun z => by dsimp only; rw [ho z, neg_sq], ?_⟩ + intro x hx y hy hxy + exact pow_le_pow_left₀ (hp x hx) (hm hx hy hxy) 2 + induction L with + | nil => intro i; exact hsq a hao ham hap + | cons av L ih => + have ht (bv) (hb : bv ∈ L) := hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht hF hG + have he := fieldScalarValue_even L ht hF hG hFe + have hs := fieldScalarMean_shape (av :: L) hL hF hG hFe ha hao ham hap haB + have hr := fieldScalarSquares_regular L ht hF hG ha haB + intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact hsq _ hs.1 hs.2.1 hs.2.2 + · have hj := ih ht j + have hb (z : ℝ) : |fieldScalarSquares L F a j z| ≤ 1 := by + rw [abs_of_nonneg ((hr j).2 z).1] + exact ((hr j).2 z).2 + exact ⟨fieldSpinTransition_even av.1 av.2 hv.1 he (hr j).1 hj.1, + fieldSpinTransition_even_monotone av.1 av.2 hv.1 he hv.2 + (hr j).1 hj.1 hj.2 hb⟩ + +lemma fieldScalarSquares_order (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F G a b : ℝ → ℝ} + (hF : Measurable F) (hG : Measurable G) + (hFg : HasLinearGrowth F) (hGg : HasLinearGrowth G) + (hFe : Function.Even F) (hGe : Function.Even G) + (hFG : MonotoneOn (fun z => G z - F z) (Ici 0)) + (ha : Measurable a) (hb : Measurable b) + (hao : Function.Odd a) (hbo : Function.Odd b) + (ham : MonotoneOn a (Ici 0)) (hbm : MonotoneOn b (Ici 0)) + (hap : ∀ z ∈ Ici (0 : ℝ), 0 ≤ a z) (hbp : ∀ z ∈ Ici (0 : ℝ), 0 ≤ b z) + (haB : ∀ z, |a z| ≤ 1) (hbB : ∀ z, |b z| ≤ 1) + (hab : ∀ z ∈ Ici (0 : ℝ), a z ≤ b z) : + ∀ i z, fieldScalarSquares L F a i z ≤ fieldScalarSquares L G b i z := by + induction L with + | nil => + intro i z + have heF : (a z) ^ 2 = (a |z|) ^ 2 := by + rcases le_total 0 z with hz | hz + · rw [abs_of_nonneg hz] + · rw [abs_of_nonpos hz, hao z, neg_sq] + have heG : (b z) ^ 2 = (b |z|) ^ 2 := by + rcases le_total 0 z with hz | hz + · rw [abs_of_nonneg hz] + · rw [abs_of_nonpos hz, hbo z, neg_sq] + change (a z) ^ 2 ≤ (b z) ^ 2 + rw [heF, heG] + exact pow_le_pow_left₀ (hap _ (abs_nonneg z)) (hab _ (abs_nonneg z)) 2 + | cons av L ih => + have ht (bv) (hc : bv ∈ L) := hL bv (List.mem_cons_of_mem av hc) + have hFr := fieldScalarValue_regular L ht hF hFg + have hGr := fieldScalarValue_regular L ht hG hGg + have hFs := fieldScalarSquares_shape (av :: L) hL hF hFg hFe ha hao ham hap haB + have hGs := fieldScalarSquares_shape (av :: L) hL hG hGg hGe hb hbo hbm hbp hbB + have hms := fieldScalarMean_shape (av :: L) hL hF hFg hFe ha hao ham hap haB + have hmorder := fieldScalarMean_order (av :: L) hL hF hG hFg hGg hFe hGe hFG + ha hb hao hbo ham hbm hap hbp haB hbB hab + have hFreg := fieldScalarSquares_regular L ht hF hFg ha haB + have hGreg := fieldScalarSquares_regular L ht hG hGg hb hbB + intro i z + refine Fin.cases ?_ (fun j => ?_) i + · rw [← field_even_abs (hFs 0).1 z, ← field_even_abs (hGs 0).1 z] + simp only [fieldScalarSquares_zero] + exact pow_le_pow_left₀ (hms.2.2 _ (abs_nonneg z)) (hmorder _ (abs_nonneg z)) 2 + · have hshape := fieldScalarSquares_shape L ht hF hFg hFe ha hao ham hap haB j + have hgshape := fieldScalarSquares_shape L ht hG hGg hGe hb hbo hbm hbp hbB j + have hFb (u : ℝ) : |fieldScalarSquares L F a j u| ≤ 1 := by + rw [abs_of_nonneg ((hFreg j).2 u).1] + exact ((hFreg j).2 u).2 + have hGb (u : ℝ) : |fieldScalarSquares L G b j u| ≤ 1 := by + rw [abs_of_nonneg ((hGreg j).2 u).1] + exact ((hGreg j).2 u).2 + exact fieldSpinTransition_even_order av.2 (hL av List.mem_cons_self).le + hFr.1 hGr.1 (fieldScalarValue_even L ht hF hFg hFe) + (fieldScalarValue_even L ht hG hGg hGe) hFr.2 hGr.2 + (fieldScalarValue_difference_monotone L ht hF hG hFg hGg hFe hGe hFG) + (hFreg j).1 (hGreg j).1 hshape.1 hgshape.1 hshape.2 hFb hGb + (fun u _ => ih ht j u) z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondBounds.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc998caa39f53f6c75b261f047b45375425c0b98 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondBounds.lean @@ -0,0 +1,103 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSecondFamily + +namespace OAI + +/-! Local bounds for the explicit first and second derivatives of the +affine Gaussian mark in the finite scalar recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +def shiftedMixed (a v u : ℝ) (p : ℝ × ℝ) : ℝ := + F.TX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + + F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u) + +def shiftedSecond (a v u : ℝ) (p : ℝ × ℝ) : ℝ := + F.TT (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + + 2 * F.TX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u) + + F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u) ^ 2 + + F.X (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeCurvature a v p.1 * u) + +lemma shiftedTangent_bound (a v u : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + {R : ℝ} (hR : 0 ≤ R) (hc : |fieldAmplitudeSlope a v p.1| ≤ R) : + |F.shiftedTangent a v u p| ≤ (F.KT + F.KX * R) * (1 + |u|) := by + have hT0 : 0 ≤ F.KT := (abs_nonneg _).trans (F.bT (p.1, 0) hp) + have hX0 := F.kx_nonneg + unfold shiftedTangent + calc + _ ≤ |F.T _| + |F.X _ * (fieldAmplitudeSlope a v p.1 * u)| := abs_add_le _ _ + _ ≤ F.KT + F.KX * (R * |u|) := by + rw [abs_mul, abs_mul] + gcongr + · exact F.bT _ hp + · exact F.bX _ + _ ≤ (F.KT + F.KX * R) * (1 + |u|) := by + nlinarith [mul_nonneg hT0 (abs_nonneg u), mul_nonneg hX0 hR] + +lemma shiftedMixed_bound (a v u : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + {R : ℝ} (hR : 0 ≤ R) (hc : |fieldAmplitudeSlope a v p.1| ≤ R) : + |F.shiftedMixed a v u p| ≤ (F.KTX + F.KXX * R) * (1 + |u|) := by + have hT0 : 0 ≤ F.KTX := (abs_nonneg _).trans (F.bTX (p.1, 0) hp) + have hX0 : 0 ≤ F.KXX := (abs_nonneg _).trans (F.bXX (0, 0)) + unfold shiftedMixed + calc + _ ≤ |F.TX _| + |F.XX _ * (fieldAmplitudeSlope a v p.1 * u)| := abs_add_le _ _ + _ ≤ F.KTX + F.KXX * (R * |u|) := by + rw [abs_mul, abs_mul] + gcongr + · exact F.bTX _ hp + · exact F.bXX _ + _ ≤ (F.KTX + F.KXX * R) * (1 + |u|) := by + nlinarith [mul_nonneg hT0 (abs_nonneg u), mul_nonneg hX0 hR] + +lemma shiftedSecond_bound (a v u : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + {R D : ℝ} (hR : 0 ≤ R) (hD : 0 ≤ D) + (hc : |fieldAmplitudeSlope a v p.1| ≤ R) + (hd : |fieldAmplitudeCurvature a v p.1| ≤ D) : + |F.shiftedSecond a v u p| ≤ + (F.KTT + 2 * F.KTX * R + F.KXX * R ^ 2 + F.KX * D) * (1 + |u|) ^ 2 := by + have hTT0 : 0 ≤ F.KTT := (abs_nonneg _).trans (F.bTT (p.1, 0) hp) + have hTX0 : 0 ≤ F.KTX := (abs_nonneg _).trans (F.bTX (p.1, 0) hp) + have hXX0 : 0 ≤ F.KXX := (abs_nonneg _).trans (F.bXX (0, 0)) + have hX0 := F.kx_nonneg + have h1 : 1 ≤ (1 + |u|) ^ 2 := by nlinarith [abs_nonneg u] + have hu : |u| ≤ (1 + |u|) ^ 2 := by nlinarith [sq_nonneg |u|, abs_nonneg u] + have hu2 : |u| ^ 2 ≤ (1 + |u|) ^ 2 := by nlinarith [abs_nonneg u] + let w : ℝ × ℝ := (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + have hTT := F.bTT w hp + have hTX := F.bTX w hp + have hXX := F.bXX w + have hX := F.bX w + unfold shiftedSecond + calc + _ ≤ |F.TT w| + |2 * F.TX w * (fieldAmplitudeSlope a v p.1 * u)| + + |F.XX w * (fieldAmplitudeSlope a v p.1 * u) ^ 2| + + |F.X w * (fieldAmplitudeCurvature a v p.1 * u)| := by + refine (abs_add_le _ _).trans (add_le_add ?_ le_rfl) + exact (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl) + _ ≤ F.KTT + 2 * F.KTX * (R * |u|) + F.KXX * (R * |u|) ^ 2 + + F.KX * (D * |u|) := by + simp only [abs_mul, abs_pow, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] + gcongr + _ = F.KTT * 1 + (2 * F.KTX * R) * |u| + + (F.KXX * R ^ 2) * |u| ^ 2 + (F.KX * D) * |u| := by ring + _ ≤ F.KTT * (1 + |u|) ^ 2 + (2 * F.KTX * R) * (1 + |u|) ^ 2 + + (F.KXX * R ^ 2) * (1 + |u|) ^ 2 + (F.KX * D) * (1 + |u|) ^ 2 := by + gcongr + _ = _ := by ring + +end FieldSecondFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondCovariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e9a17ed7238caff38b0578cbee59747df811447 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondCovariance.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Fields.FieldAffineAverageDerivative + +namespace OAI + +/-! The two-coordinate covariance algebra for second derivatives of +the scalar Gaussian recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma field_pair_covariance (ν : Measure ℝ) (ζ : ℝ) + (α A B L M : ℝ → ℝ) + (hA : Integrable A ν) (hB : Integrable B ν) + (hL : Integrable L ν) (hM : Integrable M ν) + (hαL : Integrable (fun u => α u * L u) ν) + (hαM : Integrable (fun u => α u * M u) ν) : + (∫ u, pairLinear (A u) (B u) + (ζ * α u) • pairLinear (L u) (M u) ∂ν) - + (∫ u, α u ∂ν) • (∫ u, ζ • pairLinear (L u) (M u) ∂ν) = + pairLinear + ((∫ u, A u ∂ν) + ζ * ((∫ u, α u * L u ∂ν) - (∫ u, α u ∂ν) * (∫ u, L u ∂ν))) + ((∫ u, B u ∂ν) + ζ * ((∫ u, α u * M u ∂ν) - (∫ u, α u ∂ν) * (∫ u, M u ∂ν))) := by + have he : (fun u => pairLinear (A u) (B u) + (ζ * α u) • pairLinear (L u) (M u)) = + fun u => pairLinear (A u + ζ * (α u * L u)) (B u + ζ * (α u * M u)) := by + funext u + apply ContinuousLinearMap.ext + intro v + simp only [add_apply, smul_apply, pairLinear_apply, smul_eq_mul] + ring + have hiA : Integrable (fun u => A u + ζ * (α u * L u)) ν := hA.add (hαL.const_mul ζ) + have hiB : Integrable (fun u => B u + ζ * (α u * M u)) ν := hB.add (hαM.const_mul ζ) + have heA : (∫ u, A u + ζ * (α u * L u) ∂ν) = + (∫ u, A u ∂ν) + ζ * ∫ u, α u * L u ∂ν := by + rw [integral_add hA (hαL.const_mul ζ), integral_const_mul] + have heB : (∫ u, B u + ζ * (α u * M u) ∂ν) = + (∫ u, B u ∂ν) + ζ * ∫ u, α u * M u ∂ν := by + rw [integral_add hB (hαM.const_mul ζ), integral_const_mul] + rw [he, integral_pairLinear ν hiA hiB, heA, heB, integral_smul, + integral_pairLinear ν hL hM] + apply ContinuousLinearMap.ext + intro v + simp only [sub_apply, smul_apply, pairLinear_apply, smul_eq_mul] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondFamily.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..00210fe6dc9de5952b6d1a3e2fb4c271194d90f5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondFamily.lean @@ -0,0 +1,136 @@ +import OAI.Probability.InvariantIsing.Fields.FieldAffineRecursion +import OAI.Probability.InvariantIsing.Fields.FieldTiltedFamilyDerivative + +namespace OAI + +/-! Second-derivative data for the actual two-coordinate scalar recursion. +The first coordinate is a finite covariance variation; the second is the +scalar field. All bounds are local in the covariance coordinate. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +structure FieldSecondFamily (I : Set ℝ) extends FieldSmoothFamily I where + TX : ℝ × ℝ → ℝ + TT : ℝ × ℝ → ℝ + KTX : ℝ + KTT : ℝ + mTX : Measurable TX + mTT : Measurable TT + bTX : ∀ p, p.1 ∈ I → |TX p| ≤ KTX + bTT : ∀ p, p.1 ∈ I → |TT p| ≤ KTT + derivativeX : ∀ p, p.1 ∈ I → HasFDerivAt X (pairLinear (TX p) (XX p)) p + derivativeT : ∀ p, p.1 ∈ I → HasFDerivAt T (pairLinear (TT p) (TX p)) p + +/-- The actual log-cosh terminal has zero covariance derivatives. -/ +def fieldLogCoshSecondFamily (I : Set ℝ) : FieldSecondFamily I where + toFieldSmoothFamily := fieldLogCoshFamily I + TX := fun _ => 0 + TT := fun _ => 0 + KTX := 0 + KTT := 0 + mTX := measurable_const + mTT := measurable_const + bTX := fun _ _ => by simp + bTT := fun _ _ => by simp + derivativeX := fun p _ => by + have h := (field_hasDerivAt_tanh p.2).hasFDerivAt.comp p hasFDerivAt_snd + convert h using 1 + · rfl + · apply ContinuousLinearMap.ext + intro q + simp [pairLinear, mul_comm, fieldLogCoshFamily] + derivativeT := fun p _ => by + convert hasFDerivAt_const (0 : ℝ) p using 1 + · rfl + · apply ContinuousLinearMap.ext + intro q + simp [pairLinear] + +/-- First derivative of the square-root amplitude. -/ +def fieldAmplitudeSlope (a v t : ℝ) : ℝ := v / (2 * Real.sqrt (a + v * t)) + +/-- Its second derivative, written in the chain-rule product form. -/ +def fieldAmplitudeCurvature (a v t : ℝ) : ℝ := + -(v / 2) * (Real.sqrt (a + v * t) ^ 2)⁻¹ * fieldAmplitudeSlope a v t + +lemma fieldAmplitudeSlope_hasDerivAt (a v t : ℝ) (hv : 0 < a + v * t) : + HasDerivAt (fieldAmplitudeSlope a v) (fieldAmplitudeCurvature a v t) t := by + have hs : HasDerivAt (fun q => Real.sqrt (a + v * q)) (fieldAmplitudeSlope a v t) t := by + have hinner : HasDerivAt (fun q : ℝ => a + v * q) v t := by + convert ((hasDerivAt_id t).const_mul v).const_add a using 1 <;> simp + convert (Real.hasDerivAt_sqrt hv.ne').comp t hinner using 1 + · rfl + · dsimp only [fieldAmplitudeSlope] + ring + have hi := ((hasDerivAt_inv (Real.sqrt_pos.mpr hv).ne').comp t hs).const_mul (v / 2) + convert hi using 1 + · funext q + dsimp only [fieldAmplitudeSlope, Function.comp_def] + ring + · dsimp only [fieldAmplitudeCurvature] + ring + +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +/-- The affine-noise image of the physical spin mean. -/ +def shiftedMean (a v u : ℝ) (p : ℝ × ℝ) : ℝ := + F.X (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + +/-- The raw covariance tangent of the affine-noise image of the value. -/ +def shiftedTangent (a v u : ℝ) (p : ℝ × ℝ) : ℝ := + F.T (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + + F.X (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * (fieldAmplitudeSlope a v p.1 * u) + +lemma shiftedMean_hasFDerivAt (a v u : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + (hv : 0 < a + v * p.1) : + HasFDerivAt (F.shiftedMean a v u) + (pairLinear + (F.TX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + + F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u)) + (F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u))) p := by + exact affine_gaussian_shift_hasFDerivAt F.derivativeX a v u hp hv + +lemma shiftedTangent_hasFDerivAt (a v u : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + (hv : 0 < a + v * p.1) : + HasFDerivAt (F.shiftedTangent a v u) + (pairLinear + (F.TT (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + + 2 * F.TX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u) + + F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u) ^ 2 + + F.X (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeCurvature a v p.1 * u)) + (F.TX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) + + F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u) * + (fieldAmplitudeSlope a v p.1 * u))) p := by + have hT := affine_gaussian_shift_hasFDerivAt F.derivativeT a v u hp hv + have hX := F.shiftedMean_hasFDerivAt a v u hp hv + have hc : HasFDerivAt (fun q : ℝ × ℝ => fieldAmplitudeSlope a v q.1 * u) + (pairLinear (fieldAmplitudeCurvature a v p.1 * u) 0) p := by + have h := ((fieldAmplitudeSlope_hasDerivAt a v p.1 hv).mul_const u).hasFDerivAt.comp p + hasFDerivAt_fst + convert h using 1 + · rfl + · apply ContinuousLinearMap.ext + intro q + simp [pairLinear, mul_comm] + convert hT.add (hX.mul hc) using 1 + · rfl + · apply ContinuousLinearMap.ext + intro q + simp [pairLinear, shiftedMean, fieldAmplitudeSlope] + ring + +end FieldSecondFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanBounds.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..020acd3ea693758ec22df225c9b9629045c93217 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanBounds.lean @@ -0,0 +1,131 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSecondMeasurable + +namespace OAI + +/-! Uniform second-derivative bounds on a positive-variance interval. +The constants depend on the interval bounds but not on the spatial bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +private lemma affine_linear_integral_bound {I : Set ℝ} (F : FieldSmoothFamily I) + (a v ζ : ℝ) (p : ℝ × ℝ) {V : ℝ} (hV : a + v * p.1 ≤ V) + {A : ℝ → ℝ} (hA : Measurable A) {C : ℝ} (hC : 0 ≤ C) + (hB : ∀ u, |A u| ≤ C * (1 + |u|)) : + |∫ u, A u ∂F.affineLaw a v ζ p| ≤ C * F.affineMomentCap ζ V := by + apply F.affineLaw_integral_bound a v ζ p hV hA hC + intro u + exact (hB u).trans (mul_le_mul_of_nonneg_left (field_mark_one_add_le_sq u) hC) + +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +def mixedMeanCap (R ζ V : ℝ) : ℝ := + (F.KTX + F.KXX * R + 2 * |ζ| * F.KX * (F.KT + F.KX * R)) * + F.toFieldSmoothFamily.affineMomentCap ζ V + +def secondMeanCap (R D ζ V : ℝ) : ℝ := + (F.KTT + 2 * F.KTX * R + F.KXX * R ^ 2 + F.KX * D) * + F.toFieldSmoothFamily.affineMomentCap ζ V + + |ζ| * ((F.KT + F.KX * R) ^ 2 * F.toFieldSmoothFamily.affineMomentCap ζ V + + ((F.KT + F.KX * R) * F.toFieldSmoothFamily.affineMomentCap ζ V) ^ 2) + +lemma mixedMean_bound (a v ζ : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + {R V : ℝ} (hR : 0 ≤ R) (hc : |fieldAmplitudeSlope a v p.1| ≤ R) + (hV : a + v * p.1 ≤ V) : |F.mixedMean a v ζ p| ≤ F.mixedMeanCap R ζ V := by + let A := F.KT + F.KX * R + let B := F.KTX + F.KXX * R + let M := F.toFieldSmoothFamily.affineMomentCap ζ V + let ν := F.toFieldSmoothFamily.affineLaw a v ζ p + have hX := F.kx_nonneg + have hXX : 0 ≤ F.KXX := (abs_nonneg _).trans (F.bXX (0, 0)) + have hT : 0 ≤ F.KT := (abs_nonneg _).trans (F.bT (p.1, 0) hp) + have hTX : 0 ≤ F.KTX := (abs_nonneg _).trans (F.bTX (p.1, 0) hp) + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hB : 0 ≤ B := by dsimp only [B]; positivity + have hiA : |∫ u, F.shiftedTangent a v u p ∂ν| ≤ A * M := + affine_linear_integral_bound F.toFieldSmoothFamily a v ζ p hV + (F.measurable_shiftedTangent a v p) hA (fun u => F.shiftedTangent_bound a v u hp hR hc) + have hiB : |∫ u, F.shiftedMixed a v u p ∂ν| ≤ B * M := + affine_linear_integral_bound F.toFieldSmoothFamily a v ζ p hV + (F.measurable_shiftedMixed a v p) hB (fun u => F.shiftedMixed_bound a v u hp hR hc) + have hiXA : |∫ u, F.shiftedMean a v u p * F.shiftedTangent a v u p ∂ν| ≤ F.KX * A * M := by + apply affine_linear_integral_bound F.toFieldSmoothFamily a v ζ p hV + ((F.measurable_shiftedMean a v p).mul (F.measurable_shiftedTangent a v p)) (mul_nonneg hX hA) + intro u + change |F.shiftedMean a v u p * F.shiftedTangent a v u p| ≤ _ + rw [abs_mul] + calc + _ ≤ F.KX * (A * (1 + |u|)) := mul_le_mul (F.bX _) + (F.shiftedTangent_bound a v u hp hR hc) (abs_nonneg _) hX + _ = _ := by ring + have hiMean := F.bound_mean a v ζ p + unfold mixedMean + calc + _ ≤ |∫ u, F.shiftedMixed a v u p ∂ν| + + |ζ * ((∫ u, F.shiftedMean a v u p * F.shiftedTangent a v u p ∂ν) - + F.mean a v ζ p * ∫ u, F.shiftedTangent a v u p ∂ν)| := abs_add_le _ _ + _ ≤ B * M + |ζ| * ((F.KX * A * M) + F.KX * (A * M)) := by + apply add_le_add hiB + rw [abs_mul] + apply mul_le_mul_of_nonneg_left _ (abs_nonneg ζ) + refine (abs_sub _ _).trans (add_le_add hiXA ?_) + rw [abs_mul] + exact mul_le_mul hiMean hiA (abs_nonneg _) hX + _ = F.mixedMeanCap R ζ V := by + dsimp only [mixedMeanCap, A, B, M] + ring + +lemma secondMean_bound (a v ζ : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) + {R D V : ℝ} (hR : 0 ≤ R) (hD : 0 ≤ D) + (hc : |fieldAmplitudeSlope a v p.1| ≤ R) + (hd : |fieldAmplitudeCurvature a v p.1| ≤ D) (hV : a + v * p.1 ≤ V) : + |F.secondMean a v ζ p| ≤ F.secondMeanCap R D ζ V := by + let A := F.KT + F.KX * R + let C := F.KTT + 2 * F.KTX * R + F.KXX * R ^ 2 + F.KX * D + let M := F.toFieldSmoothFamily.affineMomentCap ζ V + let ν := F.toFieldSmoothFamily.affineLaw a v ζ p + have hX := F.kx_nonneg + have hXX : 0 ≤ F.KXX := (abs_nonneg _).trans (F.bXX (0, 0)) + have hT : 0 ≤ F.KT := (abs_nonneg _).trans (F.bT (p.1, 0) hp) + have hTX : 0 ≤ F.KTX := (abs_nonneg _).trans (F.bTX (p.1, 0) hp) + have hTT : 0 ≤ F.KTT := (abs_nonneg _).trans (F.bTT (p.1, 0) hp) + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hC : 0 ≤ C := by dsimp only [C]; positivity + have hiA : |∫ u, F.shiftedTangent a v u p ∂ν| ≤ A * M := + affine_linear_integral_bound F.toFieldSmoothFamily a v ζ p hV + (F.measurable_shiftedTangent a v p) hA (fun u => F.shiftedTangent_bound a v u hp hR hc) + have hiC : |∫ u, F.shiftedSecond a v u p ∂ν| ≤ C * M := + F.toFieldSmoothFamily.affineLaw_integral_bound a v ζ p hV + (F.measurable_shiftedSecond a v p) hC (fun u => F.shiftedSecond_bound a v u hp hR hD hc hd) + have hiAA : |∫ u, (F.shiftedTangent a v u p) ^ 2 ∂ν| ≤ A ^ 2 * M := by + apply F.toFieldSmoothFamily.affineLaw_integral_bound a v ζ p hV + ((F.measurable_shiftedTangent a v p).pow_const 2) (sq_nonneg A) + intro u + rw [abs_pow] + have h := pow_le_pow_left₀ (abs_nonneg _) (F.shiftedTangent_bound a v u hp hR hc) 2 + nlinarith + have hsquare : |(∫ u, F.shiftedTangent a v u p ∂ν) ^ 2| ≤ (A * M) ^ 2 := by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) hiA 2 + unfold secondMean + calc + _ ≤ |∫ u, F.shiftedSecond a v u p ∂ν| + + |ζ * ((∫ u, (F.shiftedTangent a v u p) ^ 2 ∂ν) - + (∫ u, F.shiftedTangent a v u p ∂ν) ^ 2)| := abs_add_le _ _ + _ ≤ C * M + |ζ| * (A ^ 2 * M + (A * M) ^ 2) := by + apply add_le_add hiC + rw [abs_mul] + exact mul_le_mul_of_nonneg_left ((abs_sub _ _).trans (add_le_add hiAA hsquare)) (abs_nonneg ζ) + _ = F.secondMeanCap R D ζ V := by + dsimp only [secondMeanCap, A, C, M] + +end FieldSecondFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a21889a1b3de7462e1716e2d36f6e912a8e520e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanDerivative.lean @@ -0,0 +1,123 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSecondCovariance +import OAI.Probability.InvariantIsing.Fields.FieldAffineMoments + +namespace OAI + +/-! The actual mixed derivative of one scalar Gaussian recursion step. +The formula uses the affine-noise tangent, so it needs no third spatial +derivative of the incoming scalar payoff. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +def mixedMean (a v ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (∫ u, F.shiftedMixed a v u p ∂F.toFieldSmoothFamily.affineLaw a v ζ p) + ζ * + ((∫ u, F.shiftedMean a v u p * F.shiftedTangent a v u p + ∂F.toFieldSmoothFamily.affineLaw a v ζ p) - + F.toFieldSmoothFamily.mean a v ζ p * + (∫ u, F.shiftedTangent a v u p ∂F.toFieldSmoothFamily.affineLaw a v ζ p)) + +lemma measurable_shiftedMean (a v : ℝ) (p : ℝ × ℝ) : + Measurable (fun u => F.shiftedMean a v u p) := F.mX.comp (by fun_prop) + +lemma measurable_shiftedTangent (a v : ℝ) (p : ℝ × ℝ) : + Measurable (fun u => F.shiftedTangent a v u p) := + (F.mT.comp (by fun_prop)).add ((F.mX.comp (by fun_prop)).mul (by fun_prop)) + +lemma measurable_shiftedMixed (a v : ℝ) (p : ℝ × ℝ) : + Measurable (fun u => F.shiftedMixed a v u p) := + (F.mTX.comp (by fun_prop)).add ((F.mXX.comp (by fun_prop)).mul (by fun_prop)) + +lemma mean_hasFDerivAt (hI : IsOpen I) (a v ζ : ℝ) {m V : ℝ} (hm : 0 < m) + (hlo : ∀ t ∈ I, m ≤ a + v * t) (hhi : ∀ t ∈ I, a + v * t ≤ V) + {p : ℝ × ℝ} (hp : p.1 ∈ I) : + HasFDerivAt (F.toFieldSmoothFamily.mean a v ζ) + (pairLinear (F.mixedMean a v ζ p) (F.toFieldSmoothFamily.curvature a v ζ p)) p := by + let R := |v| / (2 * Real.sqrt m) + let B := F.KTX + F.KXX * R + let A := F.KT + F.KX * R + let α : (ℝ × ℝ) → ℝ → ℝ := fun q u => F.shiftedMean a v u q + let Dα : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ := fun q u => + pairLinear (F.shiftedMixed a v u q) (F.XX (q.1, q.2 + Real.sqrt (a + v * q.1) * u)) + let ν := F.toFieldSmoothFamily.affineLaw a v ζ p + have hR : 0 ≤ R := by dsimp only [R]; positivity + have hX := F.kx_nonneg + have hXX : 0 ≤ F.KXX := (abs_nonneg _).trans (F.bXX (0, 0)) + have hTX : 0 ≤ F.KTX := (abs_nonneg _).trans (F.bTX (p.1, 0) hp) + have hT : 0 ≤ F.KT := (abs_nonneg _).trans (F.bT (p.1, 0) hp) + have hB : 0 ≤ B := by dsimp only [B]; positivity + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hc (q : ℝ × ℝ) (hq : q.1 ∈ I) : |fieldAmplitudeSlope a v q.1| ≤ R := + abs_div_two_sqrt_le hm (hlo q.1 hq) v + have hd := F.toFieldSmoothFamily.affine_average_hasFDerivAt hI α Dα a v ζ hm hlo hhi + hX (show 0 ≤ B + F.KXX by positivity) + (fun q => F.measurable_shiftedMean a v q) + (fun q => (measurable_pairLinear (F.measurable_shiftedMixed a v q) + (F.mXX.comp (by fun_prop))).aestronglyMeasurable) + (fun q _ u => (F.bX _).trans (le_mul_of_one_le_right hX (by linarith [abs_nonneg u]))) + (fun q hq u => by + refine (norm_pairLinear_le _ _).trans ?_ + calc + _ ≤ B * (1 + |u|) + F.KXX := add_le_add (F.shiftedMixed_bound a v u hq hR (hc q hq)) (F.bXX _) + _ ≤ (B + F.KXX) * (1 + |u|) ^ 2 := by + have hq1 : 1 ≤ (1 + |u|) ^ 2 := by nlinarith [abs_nonneg u] + have hq2 := field_mark_one_add_le_sq u + nlinarith [mul_le_mul_of_nonneg_left hq1 hXX, + mul_le_mul_of_nonneg_left hq2 hB]) + (fun q hq u => F.shiftedMean_hasFDerivAt a v u hq (hm.trans_le (hlo q.1 hq))) hp + have hiX : Integrable (fun u => F.shiftedMean a v u p) ν := + F.toFieldSmoothFamily.affineLaw_bounded_integrable a v ζ p + (F.measurable_shiftedMean a v p) F.KX (fun u => F.bX _) + have hiXX : Integrable (fun u => F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u)) ν := + F.toFieldSmoothFamily.affineLaw_bounded_integrable a v ζ p + (F.mXX.comp (by fun_prop)) F.KXX (fun u => F.bXX _) + have hiA : Integrable (fun u => F.shiftedTangent a v u p) ν := + F.toFieldSmoothFamily.affineLaw_linear_integrable a v ζ p + (F.measurable_shiftedTangent a v p) hA (fun u => F.shiftedTangent_bound a v u hp hR (hc p hp)) + have hiB : Integrable (fun u => F.shiftedMixed a v u p) ν := + F.toFieldSmoothFamily.affineLaw_linear_integrable a v ζ p + (F.measurable_shiftedMixed a v p) hB (fun u => F.shiftedMixed_bound a v u hp hR (hc p hp)) + have hiXA : Integrable (fun u => F.shiftedMean a v u p * F.shiftedTangent a v u p) ν := by + apply F.toFieldSmoothFamily.affineLaw_linear_integrable a v ζ p + ((F.measurable_shiftedMean a v p).mul (F.measurable_shiftedTangent a v p)) + (mul_nonneg hX hA) + intro u + change |F.shiftedMean a v u p * F.shiftedTangent a v u p| ≤ (F.KX * A) * (1 + |u|) + rw [abs_mul] + calc + _ ≤ F.KX * (A * (1 + |u|)) := mul_le_mul (F.bX _) + (F.shiftedTangent_bound a v u hp hR (hc p hp)) (abs_nonneg _) hX + _ = _ := by ring + have hiXXprod : Integrable (fun u => F.shiftedMean a v u p * F.shiftedMean a v u p) ν := by + apply F.toFieldSmoothFamily.affineLaw_bounded_integrable a v ζ p + ((F.measurable_shiftedMean a v p).mul (F.measurable_shiftedMean a v p)) (F.KX ^ 2) + intro u + change |F.shiftedMean a v u p * F.shiftedMean a v u p| ≤ F.KX ^ 2 + rw [abs_mul] + simpa only [pow_two, shiftedMean] using mul_self_le_mul_self (abs_nonneg _) + (F.bX (p.1, p.2 + Real.sqrt (a + v * p.1) * u)) + change HasFDerivAt (F.toFieldSmoothFamily.mean a v ζ) + ((∫ u, Dα p u + (ζ * α p u) • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν) - + (∫ u, α p u ∂ν) • (∫ u, ζ • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν)) p at hd + have he := field_pair_covariance ν ζ (α p) (fun u => F.shiftedMixed a v u p) + (fun u => F.XX (p.1, p.2 + Real.sqrt (a + v * p.1) * u)) + (fun u => F.shiftedTangent a v u p) (fun u => F.shiftedMean a v u p) + hiB hiXX hiA hiX hiXA hiXXprod + change ((∫ u, Dα p u + (ζ * α p u) • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν) - + (∫ u, α p u ∂ν) • (∫ u, ζ • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν)) = _ at he + rw [he] at hd + simpa only [mixedMean, FieldSmoothFamily.curvature, FieldSmoothFamily.mean, + gaussianTiltAverage, FieldSmoothFamily.affineLaw, FieldSmoothFamily.affineShift, + α, Dα, ν, shiftedMean, pow_two] using hd + +end FieldSecondFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeasurable.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeasurable.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8aca9cdc54955b3f271a8a7bc6ccf01be336fee --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeasurable.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSecondTangentDerivative + +namespace OAI + +/-! Measurability of the explicit second derivatives of the scalar +Gaussian recursion, including their affine Gaussian weights. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +lemma FieldSmoothFamily.measurable_affine_average {I : Set ℝ} (F : FieldSmoothFamily I) + (a v ζ : ℝ) {A : (ℝ × ℝ) → ℝ → ℝ} + (hA : Measurable (fun p : (ℝ × ℝ) × ℝ => A p.1 p.2)) : + Measurable (fun p => ∫ u, A p u ∂F.affineLaw a v ζ p) := by + have hU : Measurable (fun p : (ℝ × ℝ) × ℝ => F.affineShift a v p.1 p.2) := + F.mU.comp (by fun_prop) + simp only [FieldSmoothFamily.affineLaw, integral_tilted_eq_div] + exact ((hU.const_mul ζ).exp.mul hA).stronglyMeasurable.integral_prod_right'.measurable.div + ((hU.const_mul ζ).exp.stronglyMeasurable.integral_prod_right'.measurable) + +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +lemma joint_measurable_shiftedMean (a v : ℝ) : + Measurable (fun p : (ℝ × ℝ) × ℝ => F.shiftedMean a v p.2 p.1) := + F.mX.comp (by fun_prop) + +lemma joint_measurable_shiftedTangent (a v : ℝ) : + Measurable (fun p : (ℝ × ℝ) × ℝ => F.shiftedTangent a v p.2 p.1) := by + exact (F.mT.comp (by fun_prop)).add ((F.mX.comp (by fun_prop)).mul (by + dsimp only [fieldAmplitudeSlope] + fun_prop)) + +lemma joint_measurable_shiftedMixed (a v : ℝ) : + Measurable (fun p : (ℝ × ℝ) × ℝ => F.shiftedMixed a v p.2 p.1) := by + exact (F.mTX.comp (by fun_prop)).add ((F.mXX.comp (by fun_prop)).mul (by + dsimp only [fieldAmplitudeSlope] + fun_prop)) + +lemma joint_measurable_shiftedSecond (a v : ℝ) : + Measurable (fun p : (ℝ × ℝ) × ℝ => F.shiftedSecond a v p.2 p.1) := by + exact (((F.mTT.comp (by fun_prop)).add + (((F.mTX.comp (by fun_prop)).const_mul 2).mul (by + dsimp only [fieldAmplitudeSlope]; fun_prop))).add + ((F.mXX.comp (by fun_prop)).mul (by + dsimp only [fieldAmplitudeSlope]; fun_prop))).add + ((F.mX.comp (by fun_prop)).mul (by + dsimp only [fieldAmplitudeCurvature, fieldAmplitudeSlope]; fun_prop)) + +lemma measurable_mixedMean (a v ζ : ℝ) : Measurable (F.mixedMean a v ζ) := by + exact (F.toFieldSmoothFamily.measurable_affine_average a v ζ + (F.joint_measurable_shiftedMixed a v)).add + (((F.toFieldSmoothFamily.measurable_affine_average a v ζ + ((F.joint_measurable_shiftedMean a v).mul (F.joint_measurable_shiftedTangent a v))).sub + ((F.measurable_mean a v ζ).mul (F.toFieldSmoothFamily.measurable_affine_average a v ζ + (F.joint_measurable_shiftedTangent a v)))).const_mul ζ) + +lemma measurable_secondMean (a v ζ : ℝ) : Measurable (F.secondMean a v ζ) := by + exact (F.toFieldSmoothFamily.measurable_affine_average a v ζ + (F.joint_measurable_shiftedSecond a v)).add + (((F.toFieldSmoothFamily.measurable_affine_average a v ζ + ((F.joint_measurable_shiftedTangent a v).pow_const 2)).sub + ((F.toFieldSmoothFamily.measurable_affine_average a v ζ + (F.joint_measurable_shiftedTangent a v)).pow_const 2)).const_mul ζ) + +end FieldSecondFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondRecursion.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac7bb6f78baa92911aad1cf3040b5666df3daf2d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondRecursion.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSecondMeanBounds + +namespace OAI + +/-! Closure of the actual finite scalar recursion under two derivatives +on every interval with positive, bounded affine variances. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +def secondTransform (hI : IsOpen I) (a v ζ : ℝ) {m V : ℝ} (hm : 0 < m) + (hlo : ∀ t ∈ I, m ≤ a + v * t) (hhi : ∀ t ∈ I, a + v * t ≤ V) : + FieldSecondFamily I := + let R := |v| / (2 * Real.sqrt m) + let D := (|v| / 2) * m⁻¹ * R + { toFieldSmoothFamily := F.toFieldSmoothFamily.transform hI a v ζ + (fun t ht => hm.trans_le (hlo t ht)) + TX := F.mixedMean a v ζ + TT := F.secondMean a v ζ + KTX := F.mixedMeanCap R ζ V + KTT := F.secondMeanCap R D ζ V + mTX := F.measurable_mixedMean a v ζ + mTT := F.measurable_secondMean a v ζ + bTX := fun p hp => F.mixedMean_bound a v ζ hp (by dsimp only [R]; positivity) + (abs_div_two_sqrt_le hm (hlo p.1 hp) v) (hhi p.1 hp) + bTT := fun p hp => F.secondMean_bound a v ζ hp (by dsimp only [R]; positivity) + (by dsimp only [D]; positivity) (abs_div_two_sqrt_le hm (hlo p.1 hp) v) + (fieldAmplitudeCurvature_abs_le a v p.1 hm (hlo p.1 hp)) (hhi p.1 hp) + derivativeX := fun p hp => F.mean_hasFDerivAt hI a v ζ hm hlo hhi hp + derivativeT := fun p hp => F.tangent_hasFDerivAt hI a v ζ hm hlo hhi hp } + +end FieldSecondFamily + +def fieldAffineSecondFamily (I : Set ℝ) (hI : IsOpen I) (m V : ℝ) (hm : 0 < m) : + (L : List FieldAffineStep) → + (∀ av ∈ L, ∀ t ∈ I, m ≤ av.base + av.slope * t ∧ av.base + av.slope * t ≤ V) → + FieldSecondFamily I + | [], _ => fieldLogCoshSecondFamily I + | av :: L, hL => + (fieldAffineSecondFamily I hI m V hm L + (fun bv hb => hL bv (List.mem_cons_of_mem av hb))).secondTransform + hI av.base av.slope av.exponent hm + (fun t ht => (hL av List.mem_cons_self t ht).1) + (fun t ht => (hL av List.mem_cons_self t ht).2) + +theorem fieldAffineSecondFamily_value (I : Set ℝ) (hI : IsOpen I) (m V : ℝ) (hm : 0 < m) + (L : List FieldAffineStep) + (hL : ∀ av ∈ L, ∀ t ∈ I, m ≤ av.base + av.slope * t ∧ av.base + av.slope * t ≤ V) : + (fieldAffineSecondFamily I hI m V hm L hL).U = fieldAffineValue L := by + induction L with + | nil => rfl + | cons av L ih => + funext p + simp only [fieldAffineSecondFamily, FieldSecondFamily.secondTransform, + FieldSmoothFamily.transform, FieldSmoothFamily.value, fieldAffineValue] + rw [ih] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondTangentDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondTangentDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..f530fbc3b4d1bfeb60546f615c87be6d56d1bc7f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSecondTangentDerivative.lean @@ -0,0 +1,139 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSecondMeanDerivative +import OAI.Probability.InvariantIsing.Fields.FieldRawTangent + +namespace OAI + +/-! The second covariance derivative of the actual scalar Gaussian +value, obtained by differentiating its raw affine-noise tangent. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing +namespace FieldSecondFamily + +variable {I : Set ℝ} (F : FieldSecondFamily I) + +def secondMean (a v ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (∫ u, F.shiftedSecond a v u p ∂F.toFieldSmoothFamily.affineLaw a v ζ p) + ζ * + ((∫ u, (F.shiftedTangent a v u p) ^ 2 ∂F.toFieldSmoothFamily.affineLaw a v ζ p) - + (∫ u, F.shiftedTangent a v u p ∂F.toFieldSmoothFamily.affineLaw a v ζ p) ^ 2) + +lemma measurable_shiftedSecond (a v : ℝ) (p : ℝ × ℝ) : + Measurable (fun u => F.shiftedSecond a v u p) := by + exact (((F.mTT.comp (by fun_prop)).add + (((F.mTX.comp (by fun_prop)).const_mul 2).mul (by fun_prop))).add + ((F.mXX.comp (by fun_prop)).mul (by fun_prop))).add + ((F.mX.comp (by fun_prop)).mul (by fun_prop)) + +lemma tangent_hasFDerivAt (hI : IsOpen I) (a v ζ : ℝ) {m V : ℝ} (hm : 0 < m) + (hlo : ∀ t ∈ I, m ≤ a + v * t) (hhi : ∀ t ∈ I, a + v * t ≤ V) + {p : ℝ × ℝ} (hp : p.1 ∈ I) : + HasFDerivAt (F.toFieldSmoothFamily.tangent a v ζ) + (pairLinear (F.secondMean a v ζ p) (F.mixedMean a v ζ p)) p := by + let R := |v| / (2 * Real.sqrt m) + let D := (|v| / 2) * m⁻¹ * R + let A := F.KT + F.KX * R + let B := F.KTX + F.KXX * R + let C := F.KTT + 2 * F.KTX * R + F.KXX * R ^ 2 + F.KX * D + let α : (ℝ × ℝ) → ℝ → ℝ := fun q u => F.shiftedTangent a v u q + let Dα : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ := fun q u => + pairLinear (F.shiftedSecond a v u q) (F.shiftedMixed a v u q) + let ν := F.toFieldSmoothFamily.affineLaw a v ζ p + have hR : 0 ≤ R := by dsimp only [R]; positivity + have hD : 0 ≤ D := by dsimp only [D]; positivity + have hX := F.kx_nonneg + have hXX : 0 ≤ F.KXX := (abs_nonneg _).trans (F.bXX (0, 0)) + have hTX : 0 ≤ F.KTX := (abs_nonneg _).trans (F.bTX (p.1, 0) hp) + have hTT : 0 ≤ F.KTT := (abs_nonneg _).trans (F.bTT (p.1, 0) hp) + have hT : 0 ≤ F.KT := (abs_nonneg _).trans (F.bT (p.1, 0) hp) + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hB : 0 ≤ B := by dsimp only [B]; positivity + have hC : 0 ≤ C := by dsimp only [C]; positivity + have hc (q : ℝ × ℝ) (hq : q.1 ∈ I) : |fieldAmplitudeSlope a v q.1| ≤ R := + abs_div_two_sqrt_le hm (hlo q.1 hq) v + have hd2 (q : ℝ × ℝ) (hq : q.1 ∈ I) : |fieldAmplitudeCurvature a v q.1| ≤ D := + fieldAmplitudeCurvature_abs_le a v q.1 hm (hlo q.1 hq) + have hd := F.toFieldSmoothFamily.affine_average_hasFDerivAt hI α Dα a v ζ hm hlo hhi + hA (show 0 ≤ C + B by positivity) + (fun q => F.measurable_shiftedTangent a v q) + (fun q => (measurable_pairLinear (F.measurable_shiftedSecond a v q) + (F.measurable_shiftedMixed a v q)).aestronglyMeasurable) + (fun q hq u => F.shiftedTangent_bound a v u hq hR (hc q hq)) + (fun q hq u => by + refine (norm_pairLinear_le _ _).trans ?_ + calc + _ ≤ C * (1 + |u|) ^ 2 + B * (1 + |u|) := add_le_add + (F.shiftedSecond_bound a v u hq hR hD (hc q hq) (hd2 q hq)) + (F.shiftedMixed_bound a v u hq hR (hc q hq)) + _ ≤ (C + B) * (1 + |u|) ^ 2 := by + have hh := mul_le_mul_of_nonneg_left (field_mark_one_add_le_sq u) hB + nlinarith) + (fun q hq u => F.shiftedTangent_hasFDerivAt a v u hq (hm.trans_le (hlo q.1 hq))) hp + have hq := (F.toFieldSmoothFamily.affineLaw_quadratic_moment a v ζ p).1 + have hiX : Integrable (fun u => F.shiftedMean a v u p) ν := + F.toFieldSmoothFamily.affineLaw_bounded_integrable a v ζ p + (F.measurable_shiftedMean a v p) F.KX (fun u => F.bX _) + have hiA : Integrable (fun u => F.shiftedTangent a v u p) ν := + F.toFieldSmoothFamily.affineLaw_linear_integrable a v ζ p + (F.measurable_shiftedTangent a v p) hA (fun u => F.shiftedTangent_bound a v u hp hR (hc p hp)) + have hiB : Integrable (fun u => F.shiftedMixed a v u p) ν := + F.toFieldSmoothFamily.affineLaw_linear_integrable a v ζ p + (F.measurable_shiftedMixed a v p) hB (fun u => F.shiftedMixed_bound a v u hp hR (hc p hp)) + have hiC : Integrable (fun u => F.shiftedSecond a v u p) ν := + field_integrable_of_quadratic_bound ν hq (F.measurable_shiftedSecond a v p) C + (fun u => F.shiftedSecond_bound a v u hp hR hD (hc p hp) (hd2 p hp)) + have hiAA : Integrable (fun u => F.shiftedTangent a v u p * F.shiftedTangent a v u p) ν := by + apply field_integrable_of_quadratic_bound ν hq + ((F.measurable_shiftedTangent a v p).mul (F.measurable_shiftedTangent a v p)) (A ^ 2) + intro u + change |F.shiftedTangent a v u p * F.shiftedTangent a v u p| ≤ A ^ 2 * (1 + |u|) ^ 2 + rw [abs_mul] + have hh := mul_self_le_mul_self (abs_nonneg _) (F.shiftedTangent_bound a v u hp hR (hc p hp)) + nlinarith + have hiAX : Integrable (fun u => F.shiftedTangent a v u p * F.shiftedMean a v u p) ν := by + apply F.toFieldSmoothFamily.affineLaw_linear_integrable a v ζ p + ((F.measurable_shiftedTangent a v p).mul (F.measurable_shiftedMean a v p)) + (mul_nonneg hA hX) + intro u + change |F.shiftedTangent a v u p * F.shiftedMean a v u p| ≤ (A * F.KX) * (1 + |u|) + rw [abs_mul] + calc + _ ≤ (A * (1 + |u|)) * F.KX := mul_le_mul + (F.shiftedTangent_bound a v u hp hR (hc p hp)) (F.bX _) (abs_nonneg _) (by positivity) + _ = _ := by ring + change HasFDerivAt (fun q => ∫ u, F.shiftedTangent a v u q + ∂F.toFieldSmoothFamily.affineLaw a v ζ q) + ((∫ u, Dα p u + (ζ * α p u) • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν) - + (∫ u, α p u ∂ν) • (∫ u, ζ • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν)) p at hd + have he := field_pair_covariance ν ζ (α p) (fun u => F.shiftedSecond a v u p) + (fun u => F.shiftedMixed a v u p) (fun u => F.shiftedTangent a v u p) + (fun u => F.shiftedMean a v u p) hiC hiB hiA hiX hiAA hiAX + change ((∫ u, Dα p u + (ζ * α p u) • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν) - + (∫ u, α p u ∂ν) • (∫ u, ζ • F.toFieldSmoothFamily.affineDifferential a v p u ∂ν)) = _ at he + rw [he] at hd + have hcov : (∫ u, F.shiftedTangent a v u p * F.shiftedMean a v u p ∂ν) = + ∫ u, F.shiftedMean a v u p * F.shiftedTangent a v u p ∂ν := by + apply integral_congr_ae + exact ae_of_all _ fun u => mul_comm _ _ + have hf : F.toFieldSmoothFamily.tangent a v ζ =ᶠ[𝓝 p] + (fun q => ∫ u, F.shiftedTangent a v u q ∂F.toFieldSmoothFamily.affineLaw a v ζ q) := by + filter_upwards [(hI.preimage continuous_fst).mem_nhds hp] with q hqI + exact (F.rawTangent_eq a v ζ hqI (hm.trans_le (hlo q.1 hqI))).symm + have hout := hd.congr_of_eventuallyEq hf + rw [hcov] at hout + convert hout using 1 + apply ContinuousLinearMap.ext + intro w + simp only [secondMean, mixedMean, FieldSmoothFamily.mean, gaussianTiltAverage, + FieldSmoothFamily.affineLaw, FieldSmoothFamily.affineShift, α, ν, + shiftedMean, pairLinear_apply, pow_two] + ring + +end FieldSecondFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldShiftMoments.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldShiftMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..65f83d38e4d3d76f20cbc567790f4c6683502196 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldShiftMoments.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSmoothFamily +import OAI.Probability.InvariantIsing.Fields.FieldGaussianTiltMoments + +namespace OAI + +/-! Uniform polynomial moments for the actual shifted Gaussian weights +of the finite scalar field. The bound is independent of the spatial bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +lemma FieldSmoothFamily.spatial_abs_sub_le {I : Set ℝ} (F : FieldSmoothFamily I) + (t x y : ℝ) : |F.U (t, x) - F.U (t, y)| ≤ F.KX * |x - y| := by + simpa only [Real.norm_eq_abs] using + Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun z (_ : z ∈ (univ : Set ℝ)) => (F.spatial t z).hasDerivWithinAt) + (fun z _ => by simpa only [Real.norm_eq_abs] using F.bX (t, z)) + convex_univ (mem_univ y) (mem_univ x) + +lemma FieldSmoothFamily.shifted_second_moment {I : Set ℝ} (F : FieldSmoothFamily I) + (t z r ζ R : ℝ) (hr : |r| ≤ R) : + Integrable (fun u : ℝ => (1 + |u|) ^ 2) + ((gaussianReal 0 1).tilted (fun u => ζ * F.U (t, z + r * u))) ∧ + (∫ u : ℝ, (1 + |u|) ^ 2 + ∂(gaussianReal 0 1).tilted (fun u => ζ * F.U (t, z + r * u))) ≤ + fieldGaussianMomentCap (|ζ| * F.KX * R) := by + let H : ℝ → ℝ := fun u => ζ * F.U (t, z + r * u) + let U : ℝ → ℝ := fun u => H u - ζ * F.U (t, z) + have hmH : Measurable H := (F.mU.comp (by fun_prop)).const_mul ζ + have hmU : Measurable U := hmH.sub_const _ + have hb : ∀ u, |U u| ≤ (|ζ| * F.KX * R) * |u| := by + intro u + have hsp := F.spatial_abs_sub_le t (z + r * u) z + have hdiff : z + r * u - z = r * u := by ring + rw [hdiff, abs_mul] at hsp + calc + |U u| = |ζ| * |F.U (t, z + r * u) - F.U (t, z)| := by + dsimp only [U, H] + rw [← mul_sub, abs_mul] + _ ≤ |ζ| * (F.KX * (|r| * |u|)) := mul_le_mul_of_nonneg_left hsp (abs_nonneg ζ) + _ ≤ |ζ| * (F.KX * (R * |u|)) := + mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right hr (abs_nonneg u)) F.kx_nonneg) (abs_nonneg ζ) + _ = _ := by ring + have hExp : Integrable (fun u => Real.exp (H u)) (gaussianReal 0 1) := + integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments 0 1) + (F.mU.comp (by fun_prop)) ((F.growth t).add_left z |>.scale_argument r) ζ + have hprob : IsProbabilityMeasure ((gaussianReal 0 1).tilted H) := + isProbabilityMeasure_tilted hExp + have he : (gaussianReal 0 1).tilted U = (gaussianReal 0 1).tilted H := by + have hh := tilted_tilted hExp (fun _ => -(ζ * F.U (t, z))) + simpa only [tilted_const, Pi.add_def, sub_eq_add_neg, U] using hh.symm + have h := field_centered_tilt_second_moment hmU hb + rwa [he] at h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSimpleApproximation.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSimpleApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ac2d4d4d6382a3c59d26c88693474977edc37a3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSimpleApproximation.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Fields.SimpleFieldComparison + +namespace OAI + +/-! Canonical finite field approximations in first absolute moment. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +def fieldSimpleApproximation (n : ℕ) : SimpleFunc ℝ ℝ := + SimpleFunc.approxOn id measurable_id (range (id : ℝ → ℝ) ∪ {0}) 0 (by simp) n + +lemma fieldSimpleApproximation_tendsto (μ : Measure ℝ) + (hi : Integrable (fun x : ℝ => x) μ) : + Tendsto (fun n => ∫ x, |fieldSimpleApproximation n x-x| ∂μ) atTop (𝓝 0) := by + simpa only [fieldSimpleApproximation,Real.norm_eq_abs,id_eq] using + tendsto_integral_norm_approxOn_sub measurable_id hi + +lemma simpleFieldValue_cauchy {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (s : ℕ → SimpleFunc Ω ℝ) + (f : Ω → ℝ) (hf : Integrable f P) + (hs : Tendsto (fun n => ∫ x, |s n x-f x| ∂P) atTop (𝓝 0)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) : + CauchySeq (fun n => simpleFieldValue P (s n) (measureR (ν : Measure ℝ) b)) := by + apply Metric.cauchySeq_iff.mpr + intro ε hε + obtain ⟨N,hN⟩ := eventually_atTop.mp (hs.eventually (Iio_mem_nhds (half_pos hε))) + refine ⟨N,fun m hm n hn => ?_⟩ + have hm' := hN m hm + have hn' := hN n hn + have ht : (∫ x, |s m x-s n x| ∂P) ≤ (∫ x, |s m x-f x| ∂P)+(∫ x, |s n x-f x| ∂P) := by + have he := integral_add ((simpleField_integrable P (s m)).sub hf).abs + ((simpleField_integrable P (s n)).sub hf).abs + dsimp only [Pi.add_apply,Pi.sub_apply] at he + rw [← he] + apply integral_mono ((simpleField_integrable P (s m)).sub (simpleField_integrable P (s n))).abs + (((simpleField_integrable P (s m)).sub hf).abs.add ((simpleField_integrable P (s n)).sub hf).abs) + intro x + change |s m x-s n x| ≤ |s m x-f x|+|s n x-f x| + simpa only [abs_sub_comm (f x) (s n x)] using abs_sub_le (s m x) (f x) (s n x) + rw [Real.dist_eq] + exact (simpleFieldValue_abs_sub_le ν a b hcompact hbound ha hb P (s m) (s n)).trans_lt + (ht.trans_lt (by linarith)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSmoothFamily.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSmoothFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..691408100cb59755417289a10670a5cf2fb30fc9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSmoothFamily.lean @@ -0,0 +1,170 @@ +import OAI.Probability.InvariantIsing.Fields.FieldRealVariance + +namespace OAI + +/-! The scalar field family carrying exactly the derivatives needed for +finite covariance-coordinate differentiation. No bound on the value is +required: bounded spatial derivative supplies its Gaussian moments. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +structure FieldSmoothFamily (I : Set ℝ) where + U : ℝ × ℝ → ℝ + X : ℝ × ℝ → ℝ + XX : ℝ × ℝ → ℝ + T : ℝ × ℝ → ℝ + KX : ℝ + KXX : ℝ + KT : ℝ + mU : Measurable U + mX : Measurable X + mXX : Measurable XX + mT : Measurable T + bX : ∀ p, |X p| ≤ KX + bXX : ∀ p, |XX p| ≤ KXX + bT : ∀ p, p.1 ∈ I → |T p| ≤ KT + derivative : ∀ p, p.1 ∈ I → HasFDerivAt U (pairLinear (T p) (X p)) p + spatial : ∀ t y, HasDerivAt (fun z => U (t, z)) (X (t, y)) y + second : ∀ t y, HasDerivAt (fun z => X (t, z)) (XX (t, y)) y + +namespace FieldSmoothFamily + +variable {I : Set ℝ} (F : FieldSmoothFamily I) + +lemma kx_nonneg : 0 ≤ F.KX := (abs_nonneg _).trans (F.bX (0, 0)) + +lemma growth (t : ℝ) : HasLinearGrowth (fun y => F.U (t, y)) := + field_spatial_linearGrowth F.kx_nonneg (fun y => F.bX (t, y)) (F.spatial t) + +def value (a v ζ : ℝ) (p : ℝ × ℝ) : ℝ := + gaussianTransform (a + v * p.1) ζ (fun y => F.U (p.1, y)) p.2 + +def mean (a v ζ : ℝ) (p : ℝ × ℝ) : ℝ := + gaussianTiltAverage (a + v * p.1) ζ (fun y => F.U (p.1, y)) + (fun y => F.X (p.1, y)) p.2 + +def curvature (a v ζ : ℝ) (p : ℝ × ℝ) : ℝ := + gaussianTiltAverage (a + v * p.1) ζ (fun y => F.U (p.1, y)) + (fun y => F.XX (p.1, y)) p.2 + ζ * + (gaussianTiltAverage (a + v * p.1) ζ (fun y => F.U (p.1, y)) + (fun y => (F.X (p.1, y)) ^ 2) p.2 - (F.mean a v ζ p) ^ 2) + +def tangent (a v ζ : ℝ) (p : ℝ × ℝ) : ℝ := + gaussianTiltAverage (a + v * p.1) ζ (fun y => F.U (p.1, y)) + (fun y => F.T (p.1, y)) p.2 + v / 2 * + gaussianTiltAverage (a + v * p.1) ζ (fun y => F.U (p.1, y)) + (fun y => F.XX (p.1, y) + ζ * (F.X (p.1, y)) ^ 2) p.2 + +lemma measurable_value (a v ζ : ℝ) : Measurable (F.value a v ζ) := + measurable_gaussianTransform_param (F.mU.comp (by fun_prop)) (by fun_prop) (by fun_prop) ζ + +lemma measurable_mean (a v ζ : ℝ) : Measurable (F.mean a v ζ) := + measurable_gaussianTiltAverage_param (F.mU.comp (by fun_prop)) + (F.mX.comp (by fun_prop)) (by fun_prop) (by fun_prop) ζ + +lemma measurable_curvature (a v ζ : ℝ) : Measurable (F.curvature a v ζ) := by + exact (measurable_gaussianTiltAverage_param (F.mU.comp (by fun_prop)) + (F.mXX.comp (by fun_prop)) (by fun_prop) (by fun_prop) ζ).add + (((measurable_gaussianTiltAverage_param (F.mU.comp (by fun_prop)) + ((F.mX.pow_const 2).comp (by fun_prop)) (by fun_prop) (by fun_prop) ζ).sub + ((F.measurable_mean a v ζ).pow_const 2)).const_mul ζ) + +lemma measurable_tangent (a v ζ : ℝ) : Measurable (F.tangent a v ζ) := by + exact (measurable_gaussianTiltAverage_param (F.mU.comp (by fun_prop)) + (F.mT.comp (by fun_prop)) (by fun_prop) (by fun_prop) ζ).add + ((measurable_gaussianTiltAverage_param (F.mU.comp (by fun_prop)) + ((F.mXX.add ((F.mX.pow_const 2).const_mul ζ)).comp (by fun_prop)) + (by fun_prop) (by fun_prop) ζ).const_mul (v / 2)) + +lemma bound_mean (a v ζ : ℝ) (p : ℝ × ℝ) : |F.mean a v ζ p| ≤ F.KX := + field_gaussianTiltAverage_bound _ _ (F.mU.comp (by fun_prop)) (F.growth p.1) + (F.mX.comp (by fun_prop)) (fun y => F.bX (p.1, y)) p.2 + +lemma bound_curvature (a v ζ : ℝ) (p : ℝ × ℝ) : + |F.curvature a v ζ p| ≤ F.KXX + 2 * |ζ| * F.KX ^ 2 := by + have hXX := field_gaussianTiltAverage_bound (a + v * p.1) ζ + (F.mU.comp (by fun_prop)) (F.growth p.1) (F.mXX.comp (by fun_prop)) + (fun y => F.bXX (p.1, y)) p.2 + have hsq : ∀ y, |(F.X (p.1, y)) ^ 2| ≤ F.KX ^ 2 := fun y => by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (F.bX (p.1, y)) 2 + have hsqavg := field_gaussianTiltAverage_bound (a + v * p.1) ζ + (F.mU.comp (by fun_prop)) (F.growth p.1) ((F.mX.pow_const 2).comp (by fun_prop)) hsq p.2 + have hmean : |(F.mean a v ζ p) ^ 2| ≤ F.KX ^ 2 := by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (F.bound_mean a v ζ p) 2 + unfold curvature + refine (abs_add_le _ _).trans (add_le_add hXX ?_) + rw [abs_mul] + calc + _ ≤ |ζ| * (|gaussianTiltAverage (a + v * p.1) ζ (fun y => F.U (p.1, y)) + (fun y => (F.X (p.1, y)) ^ 2) p.2| + |(F.mean a v ζ p) ^ 2|) := + mul_le_mul_of_nonneg_left (abs_sub _ _) (abs_nonneg ζ) + _ ≤ |ζ| * (F.KX ^ 2 + F.KX ^ 2) := + mul_le_mul_of_nonneg_left (add_le_add hsqavg hmean) (abs_nonneg ζ) + _ = _ := by ring + +lemma bound_tangent (a v ζ : ℝ) {p : ℝ × ℝ} (hp : p.1 ∈ I) : + |F.tangent a v ζ p| ≤ F.KT + |v| / 2 * (F.KXX + |ζ| * F.KX ^ 2) := by + have hT := field_gaussianTiltAverage_bound (a + v * p.1) ζ + (F.mU.comp (by fun_prop)) (F.growth p.1) (F.mT.comp (by fun_prop)) + (fun y => F.bT (p.1, y) hp) p.2 + have hgen : ∀ y, |F.XX (p.1, y) + ζ * (F.X (p.1, y)) ^ 2| ≤ + F.KXX + |ζ| * F.KX ^ 2 := + bounded_generator (fun y => F.bX (p.1, y)) (fun y => F.bXX (p.1, y)) ζ + have hQ := field_gaussianTiltAverage_bound (a + v * p.1) ζ + (F.mU.comp (by fun_prop)) (F.growth p.1) + ((F.mXX.add ((F.mX.pow_const 2).const_mul ζ)).comp (by fun_prop)) hgen p.2 + unfold tangent + refine (abs_add_le _ _).trans (add_le_add hT ?_) + rw [abs_mul, abs_div, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + exact mul_le_mul_of_nonneg_left hQ (by positivity) + +lemma spatial_value (a v ζ t y : ℝ) : + HasDerivAt (fun z => F.value a v ζ (t, z)) (F.mean a v ζ (t, y)) y := by + exact field_gaussianTransform_hasDerivAt (a + v * t) ζ + (F.mU.comp (by fun_prop)) (F.growth t) (F.mX.comp (by fun_prop)) + F.kx_nonneg (fun z => F.bX (t, z)) (F.spatial t) y + +lemma spatial_mean (a v ζ t y : ℝ) : + HasDerivAt (fun z => F.mean a v ζ (t, z)) (F.curvature a v ζ (t, y)) y := by + have h := field_gaussianTiltAverage_hasDerivAt (a + v * t) ζ + (F := fun u => F.U (t, u)) (D := fun u => F.X (t, u)) + (a := fun u => F.X (t, u)) (b := fun u => F.XX (t, u)) + (F.mU.comp (by fun_prop)) (F.growth t) (F.mX.comp (by fun_prop)) + (F.mX.comp (by fun_prop)) (F.mXX.comp (by fun_prop)) F.kx_nonneg F.kx_nonneg + (fun z => F.bX (t, z)) (fun z => F.bX (t, z)) (fun z => F.bXX (t, z)) + (F.spatial t) (F.second t) y + simpa only [mean, curvature, pow_two, Function.comp_apply] using h + +def transform (hI : IsOpen I) (a v ζ : ℝ) (hv : ∀ t ∈ I, 0 < a + v * t) : + FieldSmoothFamily I where + U := F.value a v ζ + X := F.mean a v ζ + XX := F.curvature a v ζ + T := F.tangent a v ζ + KX := F.KX + KXX := F.KXX + 2 * |ζ| * F.KX ^ 2 + KT := F.KT + |v| / 2 * (F.KXX + |ζ| * F.KX ^ 2) + mU := F.measurable_value a v ζ + mX := F.measurable_mean a v ζ + mXX := F.measurable_curvature a v ζ + mT := F.measurable_tangent a v ζ + bX := F.bound_mean a v ζ + bXX := F.bound_curvature a v ζ + bT := fun _ hp => F.bound_tangent a v ζ hp + derivative := fun p hp => field_gaussianFamily_local_hasFDerivAt hI F.mU F.mT F.mX F.mXX + F.bT F.bX F.bXX F.derivative F.spatial F.second a v ζ hp (hv p.1 hp) + spatial := F.spatial_value a v ζ + second := F.spatial_mean a v ζ + +end FieldSmoothFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpatialParameterOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpatialParameterOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5b483fda02935978709733c8b02570ecf478a62 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpatialParameterOrder.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Fields.FieldAdjacentDerivative +import OAI.Probability.InvariantIsing.Fields.FieldScalarSquareOrder +import OAI.Probability.InvariantIsing.Fields.FieldParameterOrder + +namespace OAI + +/-! The spatial consequence of the backward covariance derivative. +Radial antitonicity of that derivative gives ordering of the physical +conditional means, and hence ordering of all earlier squared means. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +theorem field_spatial_derivative_order {F : ℝ → ℝ} {f g : ℝ} + (hF : HasDerivAt F f g) {H : ℝ → ℝ} {h : ℝ} + (hH : HasDerivAt H h g) (hg : 0 ≤ g) + (hmono : MonotoneOn (fun y => F y - H y) (Ici 0)) : h ≤ f := by + have hd : HasDerivAt (fun y => F y - H y) (f - h) g := hF.sub hH + have hn := hmono.derivWithin_nonneg (x := g) + rw [hd.hasDerivWithinAt.derivWithin (uniqueDiffOn_Ici 0 g hg)] at hn + exact sub_nonneg.mp hn + +namespace FieldSmoothFamily + +theorem physical_mean_antitone_parameter {I : Set ℝ} (F : FieldSmoothFamily I) + (hI : Convex ℝ I) (hD : ∀ t ∈ I, AntitoneOn (fun z => F.T (t, z)) (Ici 0)) + {t s : ℝ} (ht : t ∈ I) (hs : s ∈ I) (hts : t ≤ s) : + ∀ z ∈ Ici (0 : ℝ), F.X (s, z) ≤ F.X (t, z) := by + have hp := field_parameter_difference_order hI + (fun q hq z => F.parameter_derivative q z hq) hD ht hs hts + intro z hz + exact field_spatial_derivative_order (F.spatial t z) (F.spatial s z) hz hp + +theorem earlier_squares_antitone_parameter {I : Set ℝ} (F : FieldSmoothFamily I) + (hI : Convex ℝ I) (hD : ∀ t ∈ I, AntitoneOn (fun z => F.T (t, z)) (Ici 0)) + (hUe : ∀ t ∈ I, Function.Even (fun z => F.U (t, z))) + (hXo : ∀ t ∈ I, Function.Odd (fun z => F.X (t, z))) + (hXm : ∀ t ∈ I, MonotoneOn (fun z => F.X (t, z)) (Ici 0)) + (hXp : ∀ t ∈ I, ∀ z ∈ Ici (0 : ℝ), 0 ≤ F.X (t, z)) + (hXb : ∀ p, |F.X p| ≤ 1) + (L : List (ℝ × ℝ≥0)) (hL : ∀ av ∈ L, 0 < av.1) + {t s : ℝ} (ht : t ∈ I) (hs : s ∈ I) (hts : t ≤ s) : + ∀ i z, fieldScalarSquares L (fun y => F.U (s, y)) (fun y => F.X (s, y)) i z ≤ + fieldScalarSquares L (fun y => F.U (t, y)) (fun y => F.X (t, y)) i z := by + have hp := field_parameter_difference_order hI + (fun q hq z => F.parameter_derivative q z hq) hD ht hs hts + exact fieldScalarSquares_order L hL + (F := fun y => F.U (s, y)) (G := fun y => F.U (t, y)) + (a := fun y => F.X (s, y)) (b := fun y => F.X (t, y)) + (F.mU.comp (by fun_prop)) (F.mU.comp (by fun_prop)) (F.growth s) (F.growth t) + (hUe s hs) (hUe t ht) hp + (F.mX.comp (by fun_prop)) (F.mX.comp (by fun_prop)) + (hXo s hs) (hXo t ht) (hXm s hs) (hXm t ht) (hXp s hs) (hXp t ht) + (fun z => hXb (s, z)) (fun z => hXb (t, z)) + (F.physical_mean_antitone_parameter hI hD ht hs hts) + +end FieldSmoothFamily +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..9004a6b90efaea7a7402875e3c43ad1e4d9c5871 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinDerivative.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinTransition +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorBackwardDerivative + +namespace OAI + +/-! Spatial differentiation of the scalar Gaussian operator. The payoff +may grow linearly; only its derivative is bounded. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma fieldSpinTransition_eq_shifted (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (ha : Measurable a) (z : ℝ) : + fieldSpinTransition ζ v F a z = + ∫ u, a (z + u) ∂(gaussianReal 0 v).tilted (fun u => ζ * F (z + u)) := by + rw [fieldSpinTransition, integral_tilted_eq_div, integral_tilted_eq_div] + have hm : Measurable (fun u => Real.exp (ζ * F u) * a u) := + (hF.const_mul ζ).exp.mul ha + rw [field_gaussian_integral_shift v z hm, + field_gaussian_integral_shift v z (hF.const_mul ζ).exp] + +lemma gaussianOperator_eq_logMean_shift {ζ : ℝ} (hζ : ζ ≠ 0) + (v : ℝ≥0) {F : ℝ → ℝ} (hF : Measurable F) (z : ℝ) : + gaussianOperator ζ v F z = + logMean ζ (gaussianReal 0 v) (fun u => F (z + u)) := by + rw [gaussianOperator_eq_gaussian_exp_integral hζ v hF, + field_gaussian_integral_shift v z (hF.const_mul ζ).exp, logMean] + ring + +lemma hasDerivAt_gaussianOperator (ζ : ℝ) (v : ℝ≥0) {F D : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hD : Measurable D) + {K : ℝ} (hK : 0 ≤ K) (hbound : ∀ u, |D u| ≤ K) + (hd : ∀ u, HasDerivAt F (D u) u) (z : ℝ) : + HasDerivAt (gaussianOperator ζ v F) (fieldSpinTransition ζ v F D z) z := by + have hshift (s u : ℝ) : + HasDerivAt (fun q => F (q + u)) (D (s + u)) s := by + convert (hd (s + u)).comp s ((hasDerivAt_id s).add_const u) using 1 <;> + first | rfl | simp only [mul_one] + have hm (s : ℝ) : Measurable (fun u => F (s + u)) := + hF.comp (measurable_const.add measurable_id) + have hDm (s : ℝ) : Measurable (fun u => D (s + u)) := + hD.comp (measurable_const.add measurable_id) + by_cases hζ : ζ = 0 + · subst ζ + have hi := field_gaussian_linear_integrable v 0 (hm z) (hG.add_left z) + obtain ⟨_, hI⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le + (Ioo_mem_nhds (by linarith : z - 1 < z) (by linarith : z < z + 1)) + (Eventually.of_forall fun s => (hm s).aestronglyMeasurable) hi + (hDm z).aestronglyMeasurable + (ae_of_all _ fun u s _ => by simpa only [Real.norm_eq_abs] using hbound (s + u)) + (integrable_const K) (ae_of_all _ fun u s _ => hshift s u) + have he : gaussianOperator 0 v F = fun s => ∫ u, F (s + u) ∂gaussianReal 0 v := by + funext s + rw [gaussianOperator_eq_gaussian_integral v hF, + field_gaussian_integral_shift v s hF] + rw [he, fieldSpinTransition_eq_shifted 0 v hF hD] + simpa only [zero_mul, tilted_const] using hI + · have hi := integrable_exp_of_linearGrowth (gaussianReal 0 v) + (gaussianReal_exponentialNormMoments 0 v) (hm z) (hG.add_left z) ζ + have h := hasDerivAt_logMean_of_bounded_derivative (gaussianReal 0 v) + (fun s u => F (s + u)) (fun s u => D (s + u)) hm hDm hK + (fun s u => hbound (s + u)) hshift hζ z hi + have he : gaussianOperator ζ v F = + fun s => logMean ζ (gaussianReal 0 v) (fun u => F (s + u)) := by + funext s + exact gaussianOperator_eq_logMean_shift hζ v hF s + rw [he, fieldSpinTransition_eq_shifted ζ v hF hD] + exact h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1535805df362ff6a56685811cac2363dabd1c81 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinEvaluation.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Fields.FieldEnergyCoordinates +import OAI.Probability.InvariantIsing.Fields.FieldSpinPairConditioning + +namespace OAI + +/-! The actual finite vector-spin common-depth test under the published +marking input. Both the spin conditioning and exponential integrability +are derived for this model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def fieldVectorSpinPairMean (N : ℕ) (h : FieldStep) (z : Fin N → ℝ) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : ℝ := + ∫ p, referenceReplicaMean + ((uniformSpinPrior N : Measure (Spin N)).prod (labeledLeafLaw h.depth p.1)) + (fun s : Spin N × LabeledLeaf h.depth => + fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) + ∂fieldVectorCoordinateLaw N h + +theorem field_vector_spin_pair_reduce (N : ℕ) (hN : 0 < N) (h : FieldStep) + (z : Fin N → ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + fieldVectorSpinPairMean N h z q Φ j = + fieldVectorTiltedPairMean N h z (fieldEndpointCoordinateTest N h q Φ j) := by + unfold fieldVectorSpinPairMean fieldVectorTiltedPairMean + apply integral_congr_ae + filter_upwards [field_vector_spin_exp_integrable N hN h z] with p hp + exact field_leaf_spin_pair_conditioning (labeledLeafLaw h.depth p.1) + (fieldVectorEndpoint N h p z) hp (fun d => Φ (q (fieldDepthLevel h d))) + (fun d => hΦ _) j + +/-- The finite-cascade identity `cav:spin-test`, for the scalar field +representation, conditional only on the published endpoint marking law. -/ +theorem field_vector_spin_pair_evaluation (hpub : PanchenkoTalagrandFieldPairInput) + (N : ℕ) (hN : 0 < N) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + (∫ z, fieldVectorSpinPairMean N h z q Φ j + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) = + ∫ s, Φ (q (fieldLevelIndex h s)) * fieldMagnetizationPath h s ∂pathMeasure := by + simp_rw [field_vector_spin_pair_reduce N hN h _ q Φ j hΦ] + exact field_published_rooted_coordinate_test hpub N hN h q Φ j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinFolding.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinFolding.lean new file mode 100644 index 0000000000000000000000000000000000000000..7463912e7535db1954eb2e53720def8f80ca2fcb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinFolding.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Fields.FieldGaussianTransformLaw + +namespace OAI + +/-! Exact odd-observable law for an even Gaussian tilt. This is the +conditional-spin kernel in the radial field comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma field_abs_tanh_le_one (x : ℝ) : |Real.tanh x| ≤ 1 := by + rw [Real.tanh_eq, abs_div, abs_of_pos (add_pos (Real.exp_pos _) (Real.exp_pos _))] + apply (div_le_one (add_pos (Real.exp_pos _) (Real.exp_pos _))).mpr + exact abs_sub_le_iff.mpr ⟨by linarith [Real.exp_pos (-x)], by linarith [Real.exp_pos x]⟩ + +lemma field_gaussian_odd_folded_integral (v : ℝ≥0) (hv : v ≠ 0) (z ζ : ℝ) + (F a : ℝ → ℝ) (hF : Function.Even F) (ha : Function.Odd a) + (hi : Integrable (fun u => Real.exp (ζ * F u) * a u) (gaussianReal z v)) : + (∫ u, Real.exp (ζ * F u) * a u ∂gaussianReal z v) = + (2 * (Real.sqrt (2 * Real.pi * v))⁻¹ * Real.exp (-z ^ 2 / (2 * v))) * + ∫ u in Ici (0 : ℝ), (a u * Real.tanh ((z / v) * u)) * fieldFoldedWeight v ζ F z u := by + let C := 2 * (Real.sqrt (2 * Real.pi * v))⁻¹ * Real.exp (-z ^ 2 / (2 * (v : ℝ))) + let g := fun u => gaussianPDFReal z v u * (Real.exp (ζ * F u) * a u) + have hg : Integrable g volume := field_gaussian_density_integrable v hv z _ hi + rw [integral_gaussianReal_eq_integral_smul hv] + change (∫ u, g u) = _ + rw [field_integral_fold g hg, ← integral_const_mul] + apply setIntegral_congr_fun measurableSet_Ici + intro u _hu + dsimp only [g] + rw [hF u, ha u] + have he := field_gaussian_pair_sign v hv z u + have hp := field_gaussian_pair_sum v hv z u + calc + _ = (gaussianPDFReal z v u - gaussianPDFReal z v (-u)) * + (Real.exp (ζ * F u) * a u) := by ring + _ = _ := by rw [he, hp]; dsimp only [C, fieldFoldedWeight]; ring + +/-- The physical odd conditional spin observable equals the folded +observable multiplied by the exact conditional sign. -/ +theorem field_gaussian_tilt_odd_integral_eq_folded (v : ℝ≥0) (hv : v ≠ 0) (z ζ : ℝ) + (F a : ℝ → ℝ) (hF : Function.Even F) (ha : Function.Odd a) + (hi : Integrable (fun u => Real.exp (ζ * F u) * a u) (gaussianReal z v)) + (hweight : Integrable (fun u => Real.exp (ζ * F u)) (gaussianReal z v)) : + (∫ u, a u ∂(gaussianReal z v).tilted (fun u => ζ * F u)) = + (∫ u in Ici (0 : ℝ), (a u * Real.tanh ((z / v) * u)) * fieldFoldedWeight v ζ F z u) / + (∫ u in Ici (0 : ℝ), fieldFoldedWeight v ζ F z u) := by + rw [integral_tilted_eq_div] + have hn := field_gaussian_odd_folded_integral v hv z ζ F a hF ha hi + have hd := field_gaussian_folded_integral v hv z ζ F (fun _ => 1) hF + (by simpa only [mul_one] using hweight) + simp only [mul_one, one_mul] at hd + rw [hn, hd, mul_div_mul_left _ _ (field_folded_constant_pos v hv z).ne'] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinKernelOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinKernelOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8cbab86cb6e2be18a59134a03211802618afc81 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinKernelOrder.lean @@ -0,0 +1,110 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinFolding + +namespace OAI + +/-! Monotonicity of the physical conditional-spin transition. This keeps +the spin observable, rather than the derivative in rescaled coordinates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma field_spin_test_measurable {a : ℝ → ℝ} (ha : Measurable a) (v z : ℝ) : + Measurable (fun u => a u * Real.tanh ((z / v) * u)) := by + simp only [Real.tanh_eq] + fun_prop + +lemma field_spin_test_bound {a : ℝ → ℝ} {B : ℝ} (ha : ∀ u, |a u| ≤ B) (v z u : ℝ) : + |a u * Real.tanh ((z / v) * u)| ≤ B := by + rw [abs_mul] + exact (mul_le_mul_of_nonneg_left (field_abs_tanh_le_one _) (abs_nonneg _)).trans + (by simpa only [mul_one] using ha u) + +lemma field_spin_test_monotone {a : ℝ → ℝ} (ha : MonotoneOn a (Ici 0)) + (hapos : ∀ u ∈ Ici (0 : ℝ), 0 ≤ a u) {v z : ℝ} (hv : 0 < v) (hz : 0 ≤ z) : + MonotoneOn (fun u => a u * Real.tanh ((z / v) * u)) (Ici 0) := by + intro x hx y hy hxy + exact mul_le_mul (ha hx hy hxy) + (field_tanh_monotone (mul_le_mul_of_nonneg_left hxy (div_nonneg hz hv.le))) + (field_tanh_nonneg (mul_nonneg (div_nonneg hz hv.le) hx)) (hapos y hy) + +private lemma field_spin_exp_integrable (v : ℝ≥0) (z ζ : ℝ) + (F a : ℝ → ℝ) (hF : Measurable F) (hgrowth : HasLinearGrowth F) + (ha : Measurable a) {B : ℝ} (hbound : ∀ u, |a u| ≤ B) : + Integrable (fun u => Real.exp (ζ * F u) * a u) (gaussianReal z v) := by + have hi := (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) + hF hgrowth ζ).bdd_mul ha.aestronglyMeasurable + (Filter.Eventually.of_forall (fun u => by simpa only [Real.norm_eq_abs] using hbound u)) + simpa only [mul_comm] using hi + +lemma field_gaussian_tilt_odd_eq_abs (v : ℝ≥0) (hv : v ≠ 0) (z ζ : ℝ) + (F a : ℝ → ℝ) (hF : Measurable F) (hFeven : Function.Even F) + (hgrowth : HasLinearGrowth F) (ha : Measurable a) (haodd : Function.Odd a) + {B : ℝ} (hbound : ∀ u, |a u| ≤ B) : + (∫ u, a u ∂(gaussianReal z v).tilted (fun u => ζ * F u)) = + ∫ u, a |u| * Real.tanh ((z / v) * |u|) + ∂(gaussianReal z v).tilted (fun u => ζ * F u) := by + let f := fun u => a u * Real.tanh ((z / (v : ℝ)) * u) + have hf : Measurable f := field_spin_test_measurable ha v z + have hb : ∀ u, |f u| ≤ B := field_spin_test_bound hbound v z + have hw := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) + hF hgrowth ζ + rw [field_gaussian_tilt_odd_integral_eq_folded v hv z ζ F a hFeven haodd + (field_spin_exp_integrable v z ζ F a hF hgrowth ha hbound) hw] + rw [integral_tilted_eq_div] + exact (field_gaussian_folded_ratio v hv z ζ F f hFeven + (field_spin_exp_integrable v z ζ F (fun u => f |u|) hF hgrowth + (hf.comp measurable_abs) (fun u => hb |u|)) hw).symm + +/-- Parent, payoff and physical spin-observable comparisons in one actual +Gaussian transition. This is the backward induction step in fld:radial. -/ +theorem field_gaussian_spin_transition_order (v : ℝ≥0) (hv : v ≠ 0) {ζ : ℝ} (hζ : 0 ≤ ζ) + (F G a b : ℝ → ℝ) (hF : Measurable F) (hG : Measurable G) + (hFeven : Function.Even F) (hGeven : Function.Even G) + (hFgrowth : HasLinearGrowth F) (hGgrowth : HasLinearGrowth G) + (hFG : MonotoneOn (fun u => G u - F u) (Ici 0)) + (ha : Measurable a) (hb : Measurable b) (haodd : Function.Odd a) (hbodd : Function.Odd b) + (hamono : MonotoneOn a (Ici 0)) (hapos : ∀ u ∈ Ici (0 : ℝ), 0 ≤ a u) + (hab : ∀ u ∈ Ici (0 : ℝ), a u ≤ b u) + {B : ℝ} (haB : ∀ u, |a u| ≤ B) (hbB : ∀ u, |b u| ≤ B) + {z₀ z₁ : ℝ} (hz₀ : 0 ≤ z₀) (hzz : z₀ ≤ z₁) : + (∫ u, a u ∂(gaussianReal z₀ v).tilted (fun u => ζ * F u)) ≤ + ∫ u, b u ∂(gaussianReal z₁ v).tilted (fun u => ζ * G u) := by + let f := fun u => a u * Real.tanh ((z₀ / (v : ℝ)) * u) + let g := fun u => b u * Real.tanh ((z₁ / (v : ℝ)) * u) + have hf : Measurable f := field_spin_test_measurable ha v z₀ + have hg : Measurable g := field_spin_test_measurable hb v z₁ + have hfB : ∀ u, |f u| ≤ B := field_spin_test_bound haB v z₀ + have hgB : ∀ u, |g u| ≤ B := field_spin_test_bound hbB v z₁ + have hvp : (0 : ℝ) < v := by exact_mod_cast (pos_iff_ne_zero.mpr hv) + have hfmono : MonotoneOn f (Ici 0) := field_spin_test_monotone hamono hapos hvp hz₀ + have hp := field_gaussian_tilt_abs_parent_order v hv ζ F f hF hFeven hFgrowth + hf hfmono hfB hz₀ hzz + have hq := field_gaussian_tilt_abs_payoff_order v hv hζ F G f hF hG hFeven hGeven + hFgrowth hGgrowth hFG hf hfmono hfB z₁ + have htest : ∀ u, f |u| ≤ g |u| := by + intro u + have hu : |u| ∈ Ici (0 : ℝ) := abs_nonneg u + exact mul_le_mul (hab |u| hu) + (field_tanh_monotone (mul_le_mul_of_nonneg_right + ((div_le_div_iff_of_pos_right hvp).mpr hzz) (abs_nonneg u))) + (field_tanh_nonneg (mul_nonneg (div_nonneg hz₀ hvp.le) (abs_nonneg u))) + ((hapos |u| hu).trans (hab |u| hu)) + have hfg : (∫ u, f |u| ∂(gaussianReal z₁ v).tilted (fun u => ζ * G u)) ≤ + ∫ u, g |u| ∂(gaussianReal z₁ v).tilted (fun u => ζ * G u) := by + apply integral_mono + (Integrable.of_bound (hf.comp measurable_abs).aestronglyMeasurable B + (Filter.Eventually.of_forall (fun u => by simpa only [Function.comp_apply, Real.norm_eq_abs] using hfB |u|))) + (Integrable.of_bound (hg.comp measurable_abs).aestronglyMeasurable B + (Filter.Eventually.of_forall (fun u => by simpa only [Function.comp_apply, Real.norm_eq_abs] using hgB |u|))) htest + have he₀ := field_gaussian_tilt_odd_eq_abs v hv z₀ ζ F a hF hFeven hFgrowth ha haodd haB + have he₁ := field_gaussian_tilt_odd_eq_abs v hv z₁ ζ G b hG hGeven hGgrowth hb hbodd hbB + exact he₀.trans_le ((hp.trans hq).trans (hfg.trans_eq he₁.symm)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLinear.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0f71b671b52d7524ca9f516d52f9ea4ef14e9b0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLinear.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinSecondDerivative + +namespace OAI + +/-! Linear identities for the actual tilted scalar transition. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma fieldSpinTransition_const_mul (ζ : ℝ) (v : ℝ≥0) (F a : ℝ → ℝ) + (c z : ℝ) : + fieldSpinTransition ζ v F (fun u => c * a u) z = c * fieldSpinTransition ζ v F a z := by + exact integral_const_mul c _ + +lemma fieldSpinTransition_add (ζ : ℝ) (v : ℝ≥0) {F a b : ℝ → ℝ} + (hF : Measurable F) (hg : HasLinearGrowth F) (ha : Measurable a) (hb : Measurable b) + {A B : ℝ} (haB : ∀ u, |a u| ≤ A) (hbB : ∀ u, |b u| ≤ B) (z : ℝ) : + fieldSpinTransition ζ v F (fun u => a u + b u) z = + fieldSpinTransition ζ v F a z + fieldSpinTransition ζ v F b z := by + have he := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hg ζ + have : IsProbabilityMeasure ((gaussianReal z v).tilted (fun u => ζ * F u)) := + MeasureTheory.isProbabilityMeasure_tilted he + exact integral_add + (Integrable.of_bound ha.aestronglyMeasurable A + (Filter.Eventually.of_forall fun u => by simpa only [Real.norm_eq_abs] using haB u)) + (Integrable.of_bound hb.aestronglyMeasurable B + (Filter.Eventually.of_forall fun u => by simpa only [Real.norm_eq_abs] using hbB u)) + +lemma fieldSpinTransition_const (ζ : ℝ) (v : ℝ≥0) {F : ℝ → ℝ} + (hF : Measurable F) (hg : HasLinearGrowth F) (c z : ℝ) : + fieldSpinTransition ζ v F (fun _ => c) z = c := by + have he := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hg ζ + have : IsProbabilityMeasure ((gaussianReal z v).tilted (fun u => ζ * F u)) := + MeasureTheory.isProbabilityMeasure_tilted he + simp only [fieldSpinTransition, integral_const, measureReal_def, measure_univ, + ENNReal.toReal_one, one_smul] + +lemma fieldSpinTransition_generator_difference (ζ η : ℝ) (v : ℝ≥0) + {F D DD : ℝ → ℝ} (hF : Measurable F) (hg : HasLinearGrowth F) + (hD : Measurable D) (hDD : Measurable DD) + {K C : ℝ} (hDb : ∀ u, |D u| ≤ K) (hDDb : ∀ u, |DD u| ≤ C) (z : ℝ) : + -(fieldSpinTransition ζ v F (fun u => DD u + η * (D u) ^ 2) z) / 2 + + fieldSpinTransition ζ v F (fun u => DD u + ζ * (D u) ^ 2) z / 2 = + (ζ - η) / 2 * fieldSpinTransition ζ v F (fun u => (D u) ^ 2) z := by + have hs : ∀ u, |(D u) ^ 2| ≤ K ^ 2 := fun u => by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (hDb u) 2 + have hm (r : ℝ) : Measurable (fun u => r * (D u) ^ 2) := (hD.pow_const 2).const_mul r + have hb (r : ℝ) : ∀ u, |r * (D u) ^ 2| ≤ |r| * K ^ 2 := fun u => by + rw [abs_mul] + exact mul_le_mul_of_nonneg_left (hs u) (abs_nonneg r) + rw [fieldSpinTransition_add ζ v hF hg hDD (hm η) hDDb (hb η), + fieldSpinTransition_add ζ v hF hg hDD (hm ζ) hDDb (hb ζ), + fieldSpinTransition_const_mul, fieldSpinTransition_const_mul] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLipschitz.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cd6905f275a6bbc9277881a473d3061728a2ae2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLipschitz.lean @@ -0,0 +1,35 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCurvatureBound + +namespace OAI + +/-! The actual conditional spin mean is spatially one-Lipschitz, +uniformly in the number and variances of the finite field levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldScalarLogCoshMean_dist_le (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hζ : ∀ av ∈ L, av.1 ≤ 1) (x y : ℝ) : + |fieldScalarMean L (fun z => Real.log (Real.cosh z)) Real.tanh x - + fieldScalarMean L (fun z => Real.log (Real.cosh z)) Real.tanh y| ≤ |x - y| := by + have hd z := hasDerivAt_fieldScalarLogCoshMean L hL z + have hb (z : ℝ) : + ‖fieldScalarSecond L (fun z => Real.log (Real.cosh z)) Real.tanh + (fun z => 1 / (Real.cosh z) ^ 2) z‖ ≤ 1 := by + rw [Real.norm_eq_abs, abs_of_pos (fieldScalarLogCoshSecond_pos L hL z)] + exact (fieldScalarLogCoshSecond_le_spin_variance L hL hζ z).trans + (sub_le_self _ (sq_nonneg _)) + have hh := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (s := (univ : Set ℝ)) (C := 1) + (fun z _ => (hd z).hasDerivWithinAt) (fun z _ => hb z) + convex_univ (mem_univ y) (mem_univ x) + simpa only [Real.norm_eq_abs, one_mul] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinMeasurability.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6e9bf2c1498b7e00e3248f7b1f04fc36b0c7abc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinMeasurability.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinEvaluation + +namespace OAI + +/-! Measurability of the actual scalar-field spin test before averaging +the Gaussian root and the labeled forest. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +instance fieldVectorCoordinateLaw_isProbabilityMeasure (N : ℕ) (h : FieldStep) : + IsProbabilityMeasure (fieldVectorCoordinateLaw N h) := by + unfold fieldVectorCoordinateLaw + infer_instance + +def fieldSpinPairIntegrand (N : ℕ) (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : ℝ := + referenceReplicaMean + ((uniformSpinPrior N : Measure (Spin N)).prod (labeledLeafLaw h.depth p.1)) + (fun s : Spin N × LabeledLeaf h.depth => + fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) + +lemma measurable_fieldSpinPairIntegrand (N : ℕ) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + fieldSpinPairIntegrand N h p.1 p.2 q Φ j) := by + let D : (Fin 2 → Spin N × LabeledLeaf h.depth) → ℝ := fun σ => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j)) + have hm := measurable_cascadeCoordinateReplicaMean h.depth + (uniformSpinPrior N : Measure (Spin N)) (measurable_fieldEnergy_map N) D + have hc : Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + (p.1, fieldEnergyCoordinates N h p.2)) := + measurable_fst.prodMk ((measurable_fieldEnergyCoordinates N h).comp measurable_snd) + have he (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : + cascadeCoordinateEnergy h.depth (fieldEnergy z) (fieldEnergyCoordinates N h p) = + fun s => fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1 := + funext (fieldEnergyCoordinates_energy N h p z) + have hh := hm.comp hc + simp only [Function.comp_def] at hh + simp_rw [he] at hh + simpa only [labeledSpinReference, fieldEnergyCoordinates, + fieldSpinPairIntegrand, D] using hh + +lemma fieldSpinPairIntegrand_abs_le (N : ℕ) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : + |fieldSpinPairIntegrand N h z p q Φ j| ≤ C := by + have hC : 0 ≤ C := (abs_nonneg (Φ 0)).trans (hΦ 0) + apply referenceReplicaMean_abs_le _ _ _ (measurable_of_countable _) hC + intro σ + simpa only [abs_mul, abs_spinValue, mul_one, one_mul] using + hΦ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) + +lemma measurable_fieldVectorSpinPairMean (N : ℕ) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + Measurable (fun z => fieldVectorSpinPairMean N h z q Φ j) := + (measurable_fieldSpinPairIntegrand N h q Φ j).stronglyMeasurable.integral_prod_right'.measurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinPairConditioning.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinPairConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9050cc0982e95bc7b4d5fa535670b2f8e1172f7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinPairConditioning.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Fields.FieldPublishedEvaluation +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorPairConditioning + +namespace OAI + +/-! Physical spins conditional on the two scalar-field endpoints. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma field_two_gibbs_coordinate_mean {N : ℕ} (z : Fin 2 → Fin N → ℝ) (j : Fin N) : + (∫ σ : Fin 2 → Spin N, spinValue (σ 0 j) * spinValue (σ 1 j) + ∂Measure.pi (fun i => gibbsProbability (uniformSpinPrior N : Measure (Spin N)) + (fieldEnergy (z i)))) = Real.tanh (z 0 j) * Real.tanh (z 1 j) := by + let μ := fun i : Fin 2 => gibbsProbability (uniformSpinPrior N : Measure (Spin N)) + (fieldEnergy (z i)) + have hm : Measurable (fun p : Spin N × Spin N => spinValue (p.1 j) * spinValue (p.2 j)) := + measurable_of_finite _ + have hp := (measurePreserving_piFinTwo μ).hasLaw.integral_comp hm.aestronglyMeasurable + simp only [Function.comp_apply, MeasurableEquiv.piFinTwo_apply] at hp + change (∫ σ : Fin 2 → Spin N, spinValue (σ 0 j) * spinValue (σ 1 j) ∂Measure.pi μ) = _ + rw [hp, integral_prod_mul (fun σ : Spin N => spinValue (σ j)) + (fun σ : Spin N => spinValue (σ j))] + exact congrArg₂ (fun a b : ℝ => a * b) + (fieldSpinGibbs_coordinate_mean (z 0) j) (fieldSpinGibbs_coordinate_mean (z 1) j) + +theorem field_leaf_spin_pair_conditioning {N n : ℕ} + (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (Y : LabeledLeaf n → Fin N → ℝ) + (he : Integrable (fun p : Spin N × LabeledLeaf n => Real.exp (fieldEnergy (Y p.2) p.1)) + ((uniformSpinPrior N : Measure (Spin N)).prod ν)) + (ψ : ℕ → ℝ) {C : ℝ} (hψ : ∀ d, |ψ d| ≤ C) (j : Fin N) : + referenceReplicaMean ((uniformSpinPrior N : Measure (Spin N)).prod ν) + (fun p => fieldEnergy (Y p.2) p.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf n => + ψ (labeledCommonDepth n (σ 0).2 (σ 1).2) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) = + referenceReplicaMean ν (fun α => ∑ i, Real.log (Real.cosh (Y α i))) + (fun α : Fin 2 → LabeledLeaf n => ψ (labeledCommonDepth n (α 0) (α 1)) * + (Real.tanh (Y (α 0) j) * Real.tanh (Y (α 1) j))) := by + let H := fun p : Spin N × LabeledLeaf n => fieldEnergy (Y p.2) p.1 + have ht : spinLeafTerminal H = (fun α => ∑ i, Real.log (Real.cosh (Y α i))) := by + funext α + change finiteLogIntegral (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy (Y α)) = _ + rw [finiteLogIntegral_uniformSpinPrior, logPartition_fieldEnergy] + have hb : ∃ C : ℝ, ∀ σ : Fin 2 → Spin N × LabeledLeaf n, + |ψ (labeledCommonDepth n (σ 0).2 (σ 1).2) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))| ≤ C := by + refine ⟨C, fun σ => ?_⟩ + simpa only [abs_mul, abs_spinValue, one_mul, mul_one] using + hψ (labeledCommonDepth n (σ 0).2 (σ 1).2) + rw [spinLeafPair_conditioning ν H he _ hb, ht] + congr 1 + funext α + change (∫ σ : Fin 2 → Spin N, + ψ (labeledCommonDepth n (α 0) (α 1)) * (spinValue (σ 0 j) * spinValue (σ 1 j)) + ∂Measure.pi (fun i => gibbsProbability (uniformSpinPrior N : Measure (Spin N)) + (fieldEnergy (Y (α i))))) = _ + rw [integral_const_mul, field_two_gibbs_coordinate_mean] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProduct.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b375e6735765d176c9cfbf099418fe7724fa724 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProduct.lean @@ -0,0 +1,72 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinSampling +import OAI.Probability.InvariantIsing.Fields.SpinFactorization + +namespace OAI + +/-! The finite Ising spin law with a scalar field at each site factors +into the actual one-site Gibbs kernels, including its two-spin tests. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators ENNReal + +namespace InvariantIsing + +lemma uniformSpinPrior_eq_product (N : ℕ) : + (uniformSpinPrior N : Measure (Spin N)) = + Measure.pi (fun _ : Fin N => (PMF.uniformOfFintype Bool).toMeasure) := by + apply Measure.ext_of_singleton + intro σ + rw [Measure.pi_singleton] + simp only [uniformSpinPrior, PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _), + PMF.uniformOfFintype_apply, Fintype.card_bool, Finset.prod_const, Finset.card_univ, + Fintype.card_fin] + simp [Spin, ENNReal.inv_pow] + +theorem fieldSpinGibbs_eq_product {N : ℕ} (z : Fin N → ℝ) : + gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z) = + Measure.pi (fun i => scalarSpinKernel (z i)) := by + let π : Measure Bool := (PMF.uniformOfFintype Bool).toMeasure + have hz (i : Fin N) : 0 < ∫ σ, Real.exp (z i * spinValue σ) ∂π := + integral_exp_pos Integrable.of_finite + have hZ : referencePartition (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z) = + ∏ i, ∫ σ, Real.exp (z i * spinValue σ) ∂π := by + rw [referencePartition, uniformSpinPrior_eq_product] + simp only [fieldEnergy, Real.exp_sum] + exact integral_fintype_prod_eq_prod (fun i σ => Real.exp (z i * spinValue σ)) + rw [gibbsProbability_eq_tilted _ _ Integrable.of_finite] + apply Measure.ext_of_singleton + intro σ + rw [tilted_singleton, hZ, uniformSpinPrior_eq_product, Measure.pi_singleton, + Measure.pi_singleton] + have hi (i : Fin N) : scalarSpinKernel (z i) = π.tilted (fun σ => z i * spinValue σ) := + gibbsProbability_eq_tilted π _ Integrable.of_finite + simp_rw [hi, tilted_singleton] + simp only [referencePartition] + rw [Finset.prod_mul_distrib, + ← ENNReal.ofReal_prod_of_nonneg + (fun i _ => div_nonneg (Real.exp_pos _).le (hz i).le), + Finset.prod_div_distrib, fieldEnergy, Real.exp_sum] + +theorem fieldSpinGibbs_coordinate_mean {N : ℕ} (z : Fin N → ℝ) (j : Fin N) : + (∫ σ, spinValue (σ j) + ∂gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z)) = + Real.tanh (z j) := by + rw [fieldSpinGibbs_eq_product, integral_comp_eval] + · exact scalarSpinKernel_mean (z j) + · exact (measurable_of_finite spinValue).aestronglyMeasurable + +theorem fieldSpinGibbs_pair_mean {N : ℕ} (z₁ z₂ : Fin N → ℝ) (j : Fin N) : + (∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) + ∂(gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z₁)).prod + (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z₂))) = + Real.tanh (z₁ j) * Real.tanh (z₂ j) := by + rw [integral_prod_mul (fun σ : Spin N => spinValue (σ j)) + (fun σ : Spin N => spinValue (σ j)), + fieldSpinGibbs_coordinate_mean, fieldSpinGibbs_coordinate_mean] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProductLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProductLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..61703276a56854b44981a51281e35e88ff73e164 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProductLaw.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Core.ProductKernelSampling + +namespace OAI + +/-! Exact product law of the canonical terminal spins after all Gaussian +transitions. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +theorem fieldVectorTailSpinKernel_product (N : ℕ) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : Fin N → ℝ) : + fieldVectorTailSpinKernel N L hL z = Measure.pi (fun i => fieldTailSpinKernel L hL (z i)) := by + induction L generalizing z with + | nil => exact fieldSpinGibbs_eq_product z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + change (fieldVectorTailSpinKernel N L ht ∘ₖ + fieldVectorTransitionKernel N av.1 av.2 _ hreg.1) z = _ + rw [Kernel.comp_apply] + change fieldVectorTailSpinKernel N L ht ∘ₘ + Measure.pi (fun i => fieldTransitionKernel av.1 av.2 _ hreg.1 (z i)) = _ + rw [product_kernel_comp_general (fieldTailSpinKernel L ht) + (fieldVectorTailSpinKernel N L ht) (ih ht)] + rfl + +lemma paired_product_reorder {X : Type*} [MeasurableSpace X] (N : ℕ) + (ν : Fin N → Measure X) [∀ i, IsProbabilityMeasure (ν i)] : + ((Measure.pi ν).prod (Measure.pi ν)).map + (MeasurableEquiv.arrowProdEquivProdArrow X X (Fin N)).symm = + Measure.pi (fun i => (ν i).prod (ν i)) := + (measurePreserving_arrowProdEquivProdArrow X X (Fin N) ν ν).symm.map_eq + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProjectionEnergy.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProjectionEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..594ca9e64ad930adcbd98d5d914bca616a3eb9fc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProjectionEnergy.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Core.FiniteWeightedCauchy +import OAI.Probability.InvariantIsing.Fields.SpinHammingEnergy + +namespace OAI + +/-! Energy lost by projection in a possibly unbounded external field. +The Euclidean estimate is suited to averaging under Gaussian path laws. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma fieldEnergy_projection_sq {N : ℕ} (z : Fin N → ℝ) (σ τ : Spin N) : + (fieldEnergy z σ - fieldEnergy z τ) ^ 2 ≤ + 4 * (∑ i, z i ^ 2) * (hammingDist σ τ : ℝ) := by + have he : fieldEnergy z σ - fieldEnergy z τ = + ∑ i, z i * (spinValue (σ i) - spinValue (τ i)) := by + simp only [fieldEnergy, mul_sub, Finset.sum_sub_distrib] + have hd : (∑ i, (spinValue (σ i) - spinValue (τ i)) ^ 2) = + 4 * (hammingDist σ τ : ℝ) := by + have h := spinVector_sub_norm_sq σ τ + rw [EuclideanSpace.real_norm_sq_eq] at h + exact h + rw [he] + have hc := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ z + (fun i => spinValue (σ i) - spinValue (τ i)) + rw [hd] at hc + nlinarith + +theorem fieldEnergy_projection_mean_le {N : ℕ} (z : Fin N → ℝ) + (f : Spin N → Spin N) (p : Spin N → ℝ) + (hp : ∀ σ, 0 ≤ p σ) (hpSum : ∑ σ, p σ = 1) : + |∑ σ, p σ * (fieldEnergy z σ - fieldEnergy z (f σ))| ≤ + 2 * Real.sqrt ((∑ i, z i ^ 2) * + (∑ σ, p σ * (hammingDist σ (f σ) : ℝ))) := by + have hz : 0 ≤ ∑ i, z i ^ 2 := Finset.sum_nonneg (fun i _ => sq_nonneg _) + have hd : 0 ≤ ∑ σ, p σ * (hammingDist σ (f σ) : ℝ) := + Finset.sum_nonneg (fun σ _ => mul_nonneg (hp σ) (Nat.cast_nonneg _)) + have he : (∑ σ, p σ * (fieldEnergy z σ - fieldEnergy z (f σ)) ^ 2) ≤ + 4 * (∑ i, z i ^ 2) * (∑ σ, p σ * (hammingDist σ (f σ) : ℝ)) := by + calc + _ ≤ ∑ σ, p σ * (4 * (∑ i, z i ^ 2) * (hammingDist σ (f σ) : ℝ)) := + Finset.sum_le_sum (fun σ _ => mul_le_mul_of_nonneg_left + (fieldEnergy_projection_sq z σ (f σ)) (hp σ)) + _ = _ := by + conv_rhs => rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intros + ring + apply (sq_le_sq₀ (abs_nonneg _) (by positivity)).mp + rw [sq_abs, mul_pow, Real.sq_sqrt (mul_nonneg hz hd)] + norm_num + exact (finite_weighted_sum_sq_le p + (fun σ => fieldEnergy z σ - fieldEnergy z (f σ)) hp hpSum).trans (by nlinarith [he]) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSampling.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..33a1b38fd31f2f6013d33d01fda219f7cfe4d91a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSampling.lean @@ -0,0 +1,123 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarOverlap +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorLabeled +import Mathlib.Probability.Kernel.Composition.IntegralCompProd + +namespace OAI + +/-! Actual spin sampling and Gaussian transitions for the scalar Ising +recursion. The transition kernels remain probabilities at zero variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +def scalarSpinKernel : Kernel ℝ Bool := + ⟨fun z => gibbsProbability (PMF.uniformOfFintype Bool).toMeasure + (fun σ => z * spinValue σ), + measurable_gibbsProbability + (ν := fun _ : ℝ => (PMF.uniformOfFintype Bool).toMeasure) + (H := fun p : ℝ × Bool => p.1 * spinValue p.2) measurable_const + (measurable_fst.mul ((measurable_of_finite spinValue).comp measurable_snd))⟩ + +instance scalarSpinKernel_markov : IsMarkovKernel scalarSpinKernel := by + constructor + intro z + change IsProbabilityMeasure (gibbsProbability (PMF.uniformOfFintype Bool).toMeasure + (fun σ => z * spinValue σ)) + infer_instance + +private lemma integral_uniformBool (f : Bool → ℝ) : + (∫ σ, f σ ∂(PMF.uniformOfFintype Bool).toMeasure) = + (2 : ℝ)⁻¹ * (f false + f true) := by + rw [integral_fintype (Integrable.of_finite)] + simp only [measureReal_def, + PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _), + PMF.uniformOfFintype_apply, Fintype.card_bool, ENNReal.toReal_inv, + smul_eq_mul, Fintype.sum_bool] + norm_num + ring + +theorem scalarSpinKernel_mean (z : ℝ) : + (∫ σ, spinValue σ ∂scalarSpinKernel z) = Real.tanh z := by + change (∫ σ, spinValue σ ∂gibbsProbability + (PMF.uniformOfFintype Bool).toMeasure (fun σ => z * spinValue σ)) = _ + rw [gibbsProbability_eq_tilted _ _ Integrable.of_finite, + integral_tilted_eq_div, integral_uniformBool, integral_uniformBool] + simp only [spinValue, Bool.false_eq_true, ite_false, ite_true, mul_neg_one, mul_one] + rw [Real.tanh_eq_sinh_div_cosh, Real.sinh_eq, Real.cosh_eq] + ring + +def fieldTransitionKernel (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) : + Kernel ℝ ℝ := by + have hν : Measurable (fun z : ℝ => gaussianReal z v) := + measurable_gaussianReal.comp (measurable_id.prodMk measurable_const) + have hW : Measurable (fun p : ℝ × ℝ => ENNReal.ofReal (Real.exp (ζ * F p.2))) := + (((hF.comp measurable_snd).const_mul ζ).exp.ennreal_ofReal) + have hm := measurable_normalizeMass.comp + (measurable_random_withDensity (ν := fun z : ℝ => gaussianReal z v) hν hW) + exact ⟨fun z => normalizeMass ((gaussianReal z v).withDensity + (fun u => ENNReal.ofReal (Real.exp (ζ * F u)))), + hm⟩ + +instance fieldTransitionKernel_markov (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) : + IsMarkovKernel (fieldTransitionKernel ζ v F hF) := + ⟨fun _ => normalizeMass_probability _⟩ + +lemma fieldTransitionKernel_eq_tilted (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : ℝ) : + fieldTransitionKernel ζ v F hF z = (gaussianReal z v).tilted (fun u => ζ * F u) := by + exact normalizeMass_exp _ _ (hF.const_mul ζ) + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG ζ) + +lemma fieldTransitionKernel_integral (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (a : ℝ → ℝ) (z : ℝ) : + (∫ u, a u ∂fieldTransitionKernel ζ v F hF z) = fieldSpinTransition ζ v F a z := by + rw [fieldTransitionKernel_eq_tilted ζ v F hF hG z] + rfl + +/-- Spin law at the end of the actual successive tilted Gaussian +transitions, starting from the given scalar field. -/ +def fieldTailSpinKernel : (L : List (ℝ × ℝ≥0)) → + (∀ av ∈ L, 0 < av.1) → Kernel ℝ Bool + | [], _ => scalarSpinKernel + | av :: L, hL => + let ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + fieldTailSpinKernel L ht ∘ₖ + fieldTransitionKernel av.1 av.2 (fieldScalarValue L (fun z => Real.log (Real.cosh z))) hreg.1 + +instance fieldTailSpinKernel_markov (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : IsMarkovKernel (fieldTailSpinKernel L hL) := by + induction L with + | nil => exact scalarSpinKernel_markov + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let _ := ih ht + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +theorem fieldTailSpinKernel_mean (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + (∫ σ, spinValue σ ∂fieldTailSpinKernel L hL z) = + fieldScalarMean L (fun u => Real.log (Real.cosh u)) Real.tanh z := by + induction L generalizing z with + | nil => exact scalarSpinKernel_mean z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + change (∫ σ, spinValue σ ∂(fieldTailSpinKernel L ht ∘ₖ + fieldTransitionKernel av.1 av.2 (fieldScalarValue L (fun u => Real.log (Real.cosh u))) + hreg.1) z) = _ + rw [Kernel.integral_comp (Integrable.of_finite)] + simp_rw [ih ht] + exact fieldTransitionKernel_integral av.1 av.2 _ hreg.1 hreg.2 _ z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSecondDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSecondDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..961a19c2db6bf3b010774be39a571f70ee33fe1d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSecondDerivative.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Fields.FieldTiltAverageDerivative + +namespace OAI + +/-! The derivative of the actual scalar spin transition, with a +linearly growing potential. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +theorem hasDerivAt_fieldSpinTransition (ζ : ℝ) (v : ℝ≥0) + {F D a b : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hD : Measurable D) (ha : Measurable a) (hb : Measurable b) + {C M L : ℝ} (hC : 0 ≤ C) (hM : 0 ≤ M) + (hDb : ∀ u, |D u| ≤ C) (hab : ∀ u, |a u| ≤ M) (hbb : ∀ u, |b u| ≤ L) + (hd : ∀ u, HasDerivAt F (D u) u) (had : ∀ u, HasDerivAt a (b u) u) + (z : ℝ) : + HasDerivAt (fieldSpinTransition ζ v F a) + (fieldSpinTransition ζ v F b z + ζ * + (fieldSpinTransition ζ v F (fun u => a u * D u) z - + fieldSpinTransition ζ v F a z * fieldSpinTransition ζ v F D z)) z := by + have hi := integrable_exp_of_linearGrowth (gaussianReal 0 v) + (gaussianReal_exponentialNormMoments 0 v) + (hF.comp (measurable_const.add measurable_id)) (hG.add_left z) ζ + have hd' (s u : ℝ) : HasDerivAt (fun q => F (q + u)) (D (s + u)) s := by + convert (hd (s + u)).comp s ((hasDerivAt_id s).add_const u) using 1 <;> + first | rfl | simp only [mul_one] + have ha' (s u : ℝ) : HasDerivAt (fun q => a (q + u)) (b (s + u)) s := by + convert (had (s + u)).comp s ((hasDerivAt_id s).add_const u) using 1 <;> + first | rfl | simp only [mul_one] + have h := hasDerivAt_tiltAverage_of_bounded_derivatives (gaussianReal 0 v) + (fun s u => F (s + u)) (fun s u => a (s + u)) + (fun s u => D (s + u)) (fun s u => b (s + u)) + (fun s => hF.comp (measurable_const.add measurable_id)) + (fun s => ha.comp (measurable_const.add measurable_id)) + (fun s => hD.comp (measurable_const.add measurable_id)) + (fun s => hb.comp (measurable_const.add measurable_id)) + hC hM (fun s u => hDb (s + u)) (fun s u => hab (s + u)) + (fun s u => hbb (s + u)) hd' ha' ζ z hi + have he : fieldSpinTransition ζ v F a = + fun s => ∫ u, a (s + u) ∂(gaussianReal 0 v).tilted (fun u => ζ * F (s + u)) := by + funext s + exact fieldSpinTransition_eq_shifted ζ v hF ha s + have hADm : Measurable (fun u => a u * D u) := ha.mul hD + rw [he, fieldSpinTransition_eq_shifted ζ v hF hb, + fieldSpinTransition_eq_shifted ζ v hF hADm, + fieldSpinTransition_eq_shifted ζ v hF hD] + exact h + +lemma fieldSpinTransition_derivative_bound (ζ : ℝ) (v : ℝ≥0) + {F D a b : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + {C M L : ℝ} (_hC : 0 ≤ C) (hM : 0 ≤ M) + (hDb : ∀ u, |D u| ≤ C) (hab : ∀ u, |a u| ≤ M) (hbb : ∀ u, |b u| ≤ L) + (z : ℝ) : + |fieldSpinTransition ζ v F b z + ζ * + (fieldSpinTransition ζ v F (fun u => a u * D u) z - + fieldSpinTransition ζ v F a z * fieldSpinTransition ζ v F D z)| ≤ + L + 2 * |ζ| * M * C := by + have hAD : ∀ u, |a u * D u| ≤ M * C := fun u => by + rw [abs_mul] + exact mul_le_mul (hab u) (hDb u) (abs_nonneg _) hM + have hb' := fieldSpinTransition_bound ζ v hF hG hbb z + have ha' := fieldSpinTransition_bound ζ v hF hG hab z + have hd' := fieldSpinTransition_bound ζ v hF hG hDb z + have had' := fieldSpinTransition_bound ζ v hF hG hAD z + refine (abs_add_le _ _).trans (add_le_add hb' ?_) + rw [abs_mul] + calc + _ ≤ |ζ| * (|fieldSpinTransition ζ v F (fun u => a u * D u) z| + + |fieldSpinTransition ζ v F a z * fieldSpinTransition ζ v F D z|) := + mul_le_mul_of_nonneg_left (abs_sub _ _) (abs_nonneg ζ) + _ ≤ |ζ| * (M * C + M * C) := by + apply mul_le_mul_of_nonneg_left _ (abs_nonneg ζ) + apply add_le_add had' + rw [abs_mul] + exact mul_le_mul ha' hd' (abs_nonneg _) hM + _ = _ := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinTransition.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinTransition.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7369d1796f78a8ebfc0540a4b6da0a9e6b59e5c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinTransition.lean @@ -0,0 +1,159 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinKernelOrder +import Mathlib.Probability.Moments.Variance + +namespace OAI + +/-! The scalar physical-spin transition and its bounded martingale +properties, including degenerate covariance increments. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +def fieldSpinTransition (ζ : ℝ) (v : ℝ≥0) (F a : ℝ → ℝ) (z : ℝ) : ℝ := + ∫ u, a u ∂(gaussianReal z v).tilted (fun u => ζ * F u) + +lemma fieldSpinTransition_zero_variance (ζ : ℝ) (F a : ℝ → ℝ) (z : ℝ) : + fieldSpinTransition ζ 0 F a z = a z := by + rw [fieldSpinTransition, integral_tilted_eq_div, gaussianReal_zero_var] + simp only [integral_dirac] + exact mul_div_cancel_left₀ (a z) (Real.exp_ne_zero _) + +lemma fieldSpinTransition_eq_standard (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (ha : Measurable a) (z : ℝ) : + fieldSpinTransition ζ v F a z = gaussianTiltAverage v ζ F a z := by + rw [fieldSpinTransition, integral_tilted_eq_div, gaussianTiltAverage_eq_div] + have hnum : Measurable (fun u => Real.exp (ζ * F u) * a u) := (hF.const_mul ζ).exp.mul ha + have hden : Measurable (fun u => Real.exp (ζ * F u)) := (hF.const_mul ζ).exp + rw [field_gaussian_integral_shift v z hnum, field_gaussian_integral_shift v z hden] + have hnums : Measurable (fun u => Real.exp (ζ * F (z + u)) * a (z + u)) := + hnum.comp (measurable_const.add measurable_id) + have hdens : Measurable (fun u => Real.exp (ζ * F (z + u))) := + hden.comp (measurable_const.add measurable_id) + rw [integral_gaussianReal_zero_eq_standard v + (F := fun u => Real.exp (ζ * F (z + u)) * a (z + u)) hnums, + integral_gaussianReal_zero_eq_standard v + (F := fun u => Real.exp (ζ * F (z + u))) hdens] + +lemma measurable_fieldSpinTransition (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (ha : Measurable a) : + Measurable (fieldSpinTransition ζ v F a) := by + have hnum : Measurable (fun p : ℝ × ℝ => + Real.exp (ζ * F (p.1 + Real.sqrt (v : ℝ) * p.2)) * + a (p.1 + Real.sqrt (v : ℝ) * p.2)) := by fun_prop + have hden : Measurable (fun p : ℝ × ℝ => + Real.exp (ζ * F (p.1 + Real.sqrt (v : ℝ) * p.2))) := by fun_prop + have he : fieldSpinTransition ζ v F a = fun z => + (∫ u, Real.exp (ζ * F (z + Real.sqrt (v : ℝ) * u)) * + a (z + Real.sqrt (v : ℝ) * u) ∂gaussianReal 0 1) / + (∫ u, Real.exp (ζ * F (z + Real.sqrt (v : ℝ) * u)) ∂gaussianReal 0 1) := by + funext z + rw [fieldSpinTransition_eq_standard ζ v hF ha z, gaussianTiltAverage_eq_div] + rw [he] + exact hnum.stronglyMeasurable.integral_prod_right'.measurable.div + hden.stronglyMeasurable.integral_prod_right'.measurable + +lemma fieldSpinTransition_bound (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (hgrowth : HasLinearGrowth F) + {B : ℝ} (haB : ∀ u, |a u| ≤ B) (z : ℝ) : + |fieldSpinTransition ζ v F a z| ≤ B := by + have hw := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hgrowth ζ + have : IsProbabilityMeasure ((gaussianReal z v).tilted (fun u => ζ * F u)) := + MeasureTheory.isProbabilityMeasure_tilted hw + have hb := norm_integral_le_of_norm_le_const (f := a) (C := B) + (μ := (gaussianReal z v).tilted (fun u => ζ * F u)) + (Filter.Eventually.of_forall (fun u => by simpa only [Real.norm_eq_abs] using haB u)) + simpa only [fieldSpinTransition, Real.norm_eq_abs, measureReal_def, measure_univ, + ENNReal.toReal_one, mul_one] using hb + +lemma fieldSpinTransition_square_le (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (hgrowth : HasLinearGrowth F) (ha : Measurable a) + {B : ℝ} (haB : ∀ u, |a u| ≤ B) (z : ℝ) : + (fieldSpinTransition ζ v F a z) ^ 2 ≤ + fieldSpinTransition ζ v F (fun u => (a u) ^ 2) z := by + have hw := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hgrowth ζ + have : IsProbabilityMeasure ((gaussianReal z v).tilted (fun u => ζ * F u)) := + MeasureTheory.isProbabilityMeasure_tilted hw + have hm : MemLp a 2 ((gaussianReal z v).tilted (fun u => ζ * F u)) := + MemLp.of_bound ha.aestronglyMeasurable B + (Filter.Eventually.of_forall (fun u => by simpa only [Real.norm_eq_abs] using haB u)) + have hv := variance_nonneg a ((gaussianReal z v).tilted (fun u => ζ * F u)) + rw [variance_eq_sub hm] at hv + change 0 ≤ fieldSpinTransition ζ v F (fun u => (a u) ^ 2) z - + (fieldSpinTransition ζ v F a z) ^ 2 at hv + linarith + +lemma fieldSpinTransition_odd (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (hEven : Function.Even F) + (ha : Measurable a) (hOdd : Function.Odd a) : + Function.Odd (fieldSpinTransition ζ v F a) := by + intro z + rw [fieldSpinTransition, fieldSpinTransition, integral_tilted_eq_div, integral_tilted_eq_div] + have hnum : Measurable (fun u => Real.exp (ζ * F u) * a u) := (hF.const_mul ζ).exp.mul ha + have hn : (∫ u, Real.exp (ζ * F u) * a u ∂gaussianReal (-z) v) = + -(∫ u, Real.exp (ζ * F u) * a u ∂gaussianReal z v) := by + rw [← gaussianReal_map_neg (μ := z) (v := v), + integral_map measurable_neg.aemeasurable hnum.aestronglyMeasurable] + calc + _ = ∫ u, -(Real.exp (ζ * F u) * a u) ∂gaussianReal z v := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun u => by + change Real.exp (ζ * F (-u)) * a (-u) = -(Real.exp (ζ * F u) * a u) + rw [hEven u, hOdd u] + ring) + _ = _ := integral_neg _ + have hd := field_gaussian_integral_reflect v z (hF.const_mul ζ).exp + (fun u => by rw [hEven u]) + rw [hn, hd, neg_div] + +lemma fieldSpinTransition_nonneg (ζ : ℝ) (v : ℝ≥0) + {F a : ℝ → ℝ} (hF : Measurable F) (hEven : Function.Even F) + (hgrowth : HasLinearGrowth F) (ha : Measurable a) (hOdd : Function.Odd a) + (hapos : ∀ u ∈ Ici (0 : ℝ), 0 ≤ a u) + {B : ℝ} (haB : ∀ u, |a u| ≤ B) {z : ℝ} (hz : 0 ≤ z) : + 0 ≤ fieldSpinTransition ζ v F a z := by + by_cases hv : v = 0 + · subst v + rw [fieldSpinTransition_zero_variance] + exact hapos z hz + have he := field_gaussian_tilt_odd_eq_abs v hv z ζ F a hF hEven hgrowth ha hOdd haB + rw [fieldSpinTransition, he] + apply integral_nonneg + intro u + exact mul_nonneg (hapos |u| (abs_nonneg u)) + (field_tanh_nonneg (mul_nonneg (div_nonneg hz v.coe_nonneg) (abs_nonneg u))) + +lemma fieldSpinTransition_monotone {ζ : ℝ} (hζ : 0 ≤ ζ) (v : ℝ≥0) + {F a : ℝ → ℝ} (hF : Measurable F) (hEven : Function.Even F) + (hgrowth : HasLinearGrowth F) (ha : Measurable a) (hOdd : Function.Odd a) + (hamono : MonotoneOn a (Ici 0)) (hapos : ∀ u ∈ Ici (0 : ℝ), 0 ≤ a u) + {B : ℝ} (haB : ∀ u, |a u| ≤ B) : + MonotoneOn (fieldSpinTransition ζ v F a) (Ici 0) := by + by_cases hv : v = 0 + · subst v + intro x hx y hy hxy + rw [fieldSpinTransition_zero_variance, fieldSpinTransition_zero_variance] + exact hamono hx hy hxy + intro x hx y _hy hxy + exact field_gaussian_spin_transition_order v hv hζ F F a a hF hF hEven hEven hgrowth hgrowth + (by intro u _ w _ _; simp only [sub_self, le_refl]) + ha ha hOdd hOdd hamono hapos (fun _ _ => le_rfl) haB haB hx hxy + +lemma fieldSpinTransition_mono_test (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) + {a b : ℝ → ℝ} (ha : Measurable a) (hb : Measurable b) {A B : ℝ} + (haB : ∀ u, |a u| ≤ A) (hbB : ∀ u, |b u| ≤ B) + (hab : ∀ u, a u ≤ b u) (z : ℝ) : + fieldSpinTransition ζ v F a z ≤ fieldSpinTransition ζ v F b z := by + exact integral_mono + (Integrable.of_bound ha.aestronglyMeasurable A + (Filter.Eventually.of_forall (fun u => by simpa only [Real.norm_eq_abs] using haB u))) + (Integrable.of_bound hb.aestronglyMeasurable B + (Filter.Eventually.of_forall (fun u => by simpa only [Real.norm_eq_abs] using hbB u))) hab + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8d05c8eae215bbfa624bf3cec06c63b4531d497 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSpinVariance.lean @@ -0,0 +1,119 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinLipschitz +import OAI.Probability.InvariantIsing.Fields.FieldGaussianTiltMoments + +namespace OAI + +/-! A quantitative conditional-variance bound for a Lipschitz spin +mean. The constant depends only on an upper bound for the Gaussian +variance, rather than on the depth of the scalar recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldGaussianMomentCap_nonneg {C : ℝ} (hC : 0 ≤ C) : 0 ≤ fieldGaussianMomentCap C := by + have hb := (field_centered_tilt_second_moment (U := fun _ => 0) measurable_const + (C := C) (fun u => by simpa using mul_nonneg hC (abs_nonneg u))).2 + exact (integral_nonneg (fun u => sq_nonneg (1 + |u|))).trans hb + +lemma field_centered_spin_variance {U M : ℝ → ℝ} + (hU : Measurable U) (hM : Measurable M) + (hMb : ∀ z, |M z| ≤ 1) (hML : ∀ x y, |M x - M y| ≤ |x - y|) + {C : ℝ} (hUb : ∀ u, |U u| ≤ C * |u|) (x : ℝ) (v : ℝ≥0) : + variance (fun u => M (x + Real.sqrt (v : ℝ) * u)) ((gaussianReal 0 1).tilted U) ≤ + (v : ℝ) * fieldGaussianMomentCap C := by + let μ := (gaussianReal 0 1).tilted U + have he : Integrable (fun u => Real.exp (U u)) (gaussianReal 0 1) := by + apply (gaussianReal_exponentialNormMoments 0 1 C).mono' hU.exp.aestronglyMeasurable + exact ae_of_all _ fun u => by + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), Real.norm_eq_abs] + exact Real.exp_le_exp.mpr ((le_abs_self _).trans (hUb u)) + let : IsProbabilityMeasure μ := isProbabilityMeasure_tilted he + let X := fun u => M (x + Real.sqrt (v : ℝ) * u) + have hmX : Measurable X := hM.comp (by fun_prop) + have hmD : AEStronglyMeasurable (fun u => X u - M x) μ := + (hmX.sub_const _).aestronglyMeasurable + have hLp : MemLp (fun u => X u - M x) 2 μ := + MemLp.of_bound hmD 2 (ae_of_all _ fun u => by + rw [Real.norm_eq_abs] + exact (abs_sub _ _).trans (by dsimp only [X]; linarith [hMb (x + Real.sqrt (v : ℝ) * u), hMb x])) + obtain ⟨hi, hb⟩ := field_centered_tilt_second_moment hU hUb + have hp (u : ℝ) : (X u - M x)^2 ≤ (v : ℝ) * (1 + |u|)^2 := by + have hl : |X u - M x| ≤ Real.sqrt (v : ℝ) * |u| := by + simpa only [X, add_sub_cancel_left, abs_mul, abs_of_nonneg (Real.sqrt_nonneg _)] using + hML (x + Real.sqrt (v : ℝ) * u) x + have hs := pow_le_pow_left₀ (abs_nonneg _) hl 2 + rw [sq_abs, mul_pow, Real.sq_sqrt v.coe_nonneg] at hs + exact hs.trans (mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (abs_nonneg u) (by linarith : |u| ≤ 1 + |u|) 2) v.coe_nonneg) + calc + variance X μ = variance (fun u => X u - M x) μ := + (variance_sub_const hmX.aestronglyMeasurable (M x)).symm + _ ≤ ∫ u, (X u - M x)^2 ∂μ := variance_le_expectation_sq hmD + _ ≤ ∫ u, (v : ℝ) * (1 + |u|)^2 ∂μ := integral_mono hLp.integrable_sq (hi.const_mul _) hp + _ = (v : ℝ) * ∫ u, (1 + |u|)^2 ∂μ := integral_const_mul _ _ + _ ≤ (v : ℝ) * fieldGaussianMomentCap C := mul_le_mul_of_nonneg_left hb v.coe_nonneg + +lemma fieldSpinTransition_centered_standard (ζ : ℝ) (v : ℝ≥0) {F M : ℝ → ℝ} + (hF : Measurable F) (hM : Measurable M) (x : ℝ) : + fieldSpinTransition ζ v F M x = + ∫ u, M (x + Real.sqrt (v : ℝ) * u) + ∂(gaussianReal 0 1).tilted (fun u => ζ * (F (x + Real.sqrt (v : ℝ) * u) - F x)) := by + rw [fieldSpinTransition_eq_standard ζ v hF hM, gaussianTiltAverage_eq_div, + integral_tilted_eq_div] + simp_rw [mul_sub, Real.exp_sub, div_mul_eq_mul_div] + rw [integral_div, integral_div, div_div_div_cancel_right₀ (Real.exp_ne_zero _)] + +lemma fieldSpinTransition_variance_bound (ζ : ℝ) (v : ℝ≥0) {F M : ℝ → ℝ} + (hF : Measurable F) (hM : Measurable M) + (hMb : ∀ z, |M z| ≤ 1) (hML : ∀ x y, |M x - M y| ≤ |x - y|) + (x : ℝ) {C : ℝ} + (hUb : ∀ u, |ζ * (F (x + Real.sqrt (v : ℝ) * u) - F x)| ≤ C * |u|) : + fieldSpinTransition ζ v F (fun z => (M z)^2) x - + (fieldSpinTransition ζ v F M x)^2 ≤ (v : ℝ) * fieldGaussianMomentCap C := by + let U := fun u => ζ * (F (x + Real.sqrt (v : ℝ) * u) - F x) + have hU : Measurable U := by dsimp only [U]; fun_prop + have he : Integrable (fun u => Real.exp (U u)) (gaussianReal 0 1) := by + apply (gaussianReal_exponentialNormMoments 0 1 C).mono' hU.exp.aestronglyMeasurable + exact ae_of_all _ fun u => by + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), Real.norm_eq_abs] + exact Real.exp_le_exp.mpr ((le_abs_self _).trans (hUb u)) + let μ := (gaussianReal 0 1).tilted U + let : IsProbabilityMeasure μ := isProbabilityMeasure_tilted he + have hm : Measurable (fun u => M (x + Real.sqrt (v : ℝ) * u)) := hM.comp (by fun_prop) + have hLp : MemLp (fun u => M (x + Real.sqrt (v : ℝ) * u)) 2 μ := + MemLp.of_bound hm.aestronglyMeasurable 1 (ae_of_all _ fun u => by + simpa only [Real.norm_eq_abs] using hMb (x + Real.sqrt (v : ℝ) * u)) + rw [fieldSpinTransition_centered_standard ζ v hF (hM.pow_const 2), + fieldSpinTransition_centered_standard ζ v hF hM] + change (∫ u, (M (x + Real.sqrt (v : ℝ) * u))^2 ∂μ) - + (∫ u, M (x + Real.sqrt (v : ℝ) * u) ∂μ)^2 ≤ _ + have heq := variance_eq_sub hLp + simp only [Pi.pow_apply] at heq + rw [← heq] + exact field_centered_spin_variance hU hM hMb hML hUb x v + +lemma fieldSpinTransition_variance_le (ζ : ℝ) (hζ : ζ ∈ Icc 0 1) (v : ℝ≥0) + {V : ℝ} (hv : (v : ℝ) ≤ V) {F M : ℝ → ℝ} + (hF : Measurable F) (hFL : ∀ x y, |F x - F y| ≤ |x - y|) + (hM : Measurable M) (hMb : ∀ z, |M z| ≤ 1) + (hML : ∀ x y, |M x - M y| ≤ |x - y|) (x : ℝ) : + fieldSpinTransition ζ v F (fun z => (M z)^2) x - + (fieldSpinTransition ζ v F M x)^2 ≤ (v : ℝ) * fieldGaussianMomentCap (Real.sqrt V) := by + apply fieldSpinTransition_variance_bound ζ v hF hM hMb hML x + intro u + rw [abs_mul, abs_of_nonneg hζ.1] + have hf : |F (x + Real.sqrt (v : ℝ) * u) - F x| ≤ Real.sqrt V * |u| := by + have hh := hFL (x + Real.sqrt (v : ℝ) * u) x + simp only [add_sub_cancel_left, abs_mul, abs_of_nonneg (Real.sqrt_nonneg _)] at hh + exact hh.trans (mul_le_mul_of_nonneg_right (Real.sqrt_le_sqrt hv) (abs_nonneg u)) + exact (mul_le_mul_of_nonneg_left hf hζ.1).trans + (mul_le_of_le_one_left (mul_nonneg (Real.sqrt_nonneg _) (abs_nonneg _)) hζ.2) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldSquarePrefix.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldSquarePrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3f007c321098b8a89d4a5dc748b7e9265e1b1fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldSquarePrefix.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarComposition + +namespace OAI + +/-! Composition of an earlier conditional spin square with an unchanged +later scalar recursion. This keeps the ordinary Gaussian root separate. -/ + +noncomputable section +open IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldPrefixIndex (P S : List (ℝ × ℝ≥0)) (i : Fin (P.length + 1)) : + Fin ((P ++ S).length + 1) := + ⟨i.val, by simp only [List.length_append]; omega⟩ + +lemma fieldScalarSquares_append_prefix (P S : List (ℝ × ℝ≥0)) (F a : ℝ → ℝ) + (i : Fin (P.length + 1)) : + fieldScalarSquares (P ++ S) F a (fieldPrefixIndex P S i) = + fieldScalarSquares P (fieldScalarValue S F) (fieldScalarMean S F a) i := by + induction P with + | nil => + have hi : i = 0 := by + apply Fin.ext + change i.val = 0 + have hi := i.isLt + simp only [List.length_nil, zero_add] at hi + omega + subst i + have he : fieldPrefixIndex [] S 0 = 0 := by apply Fin.ext; rfl + rw [he] + funext z + simp only [List.nil_append, fieldScalarSquares_zero, fieldScalarSquares] + | cons av P ih => + refine Fin.cases ?_ (fun j => ?_) i + · have he : fieldPrefixIndex (av :: P) S 0 = 0 := by apply Fin.ext; rfl + rw [he] + funext z + rw [fieldScalarSquares_zero, fieldScalarSquares_zero, fieldScalarMean_append] + · have he : fieldPrefixIndex (av :: P) S j.succ = (fieldPrefixIndex P S j).succ := by + apply Fin.ext + rfl + rw [he] + change fieldSpinTransition av.1 av.2 (fieldScalarValue (P ++ S) F) + (fieldScalarSquares (P ++ S) F a (fieldPrefixIndex P S j)) = _ + rw [fieldScalarValue_append, ih] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTail.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..4219c80143955811c8de8d9a629d687f08f49760 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTail.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.FieldLipschitzTransport + +namespace OAI + +/-! The excess of the absolute field above a cutoff is a one-Lipschitz tail test. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +def fieldTail (M x : ℝ) : ℝ := max (|x|-M) 0 + +lemma fieldTail_lipschitz (M : ℝ) : LipschitzWith 1 (fieldTail M) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simp only [Real.dist_eq,NNReal.coe_one,one_mul,fieldTail] + have hh := abs_max_sub_max_le_max (|x|-M) 0 (|y|-M) 0 + simp only [sub_sub_sub_cancel_right,sub_self,abs_zero] at hh + rw [max_eq_left (abs_nonneg (|x|-|y|))] at hh + exact hh.trans (abs_abs_sub_abs_le_abs_sub x y) + +lemma fieldTail_nonneg (M x : ℝ) : 0 ≤ fieldTail M x := le_max_right _ _ + +lemma fieldTail_le_abs {M : ℝ} (hM : 0 ≤ M) (x : ℝ) : fieldTail M x ≤ |x| := + max_le (by linarith) (abs_nonneg _) + +lemma fieldTail_integral_tendsto (μ : Measure ℝ) + (hμ : Integrable (fun x : ℝ => x) μ) : + Tendsto (fun n : ℕ => ∫ x, fieldTail n x ∂μ) atTop (𝓝 0) := by + have ht : Tendsto (fun n : ℕ => ∫ x, fieldTail n x ∂μ) atTop (𝓝 (∫ _x : ℝ, (0 : ℝ) ∂μ)) := by + apply tendsto_integral_of_dominated_convergence (fun x : ℝ => |x|) + · intro n + exact (fieldTail_lipschitz n).continuous.measurable.aestronglyMeasurable + · exact hμ.abs + · intro n + exact ae_of_all _ fun x => by + rw [Real.norm_eq_abs,abs_of_nonneg (fieldTail_nonneg _ _)] + exact fieldTail_le_abs (Nat.cast_nonneg n) x + · apply ae_of_all + intro x + have he : ∀ᶠ n : ℕ in atTop, |x| ≤ (n : ℝ) := + tendsto_natCast_atTop_atTop.eventually (eventually_ge_atTop |x|) + apply tendsto_const_nhds.congr' + filter_upwards [he] with n hn + exact (max_eq_right (sub_nonpos.mpr hn)).symm + simpa only [integral_zero] using ht + +lemma fieldTail_integral_tendsto_of_wasserstein + (μ : ProbabilityMeasure ℝ) (μs : ℕ → ProbabilityMeasure ℝ) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) + (hμs : ∀ n, Integrable (fun x : ℝ => x) (μs n : Measure ℝ)) + (hw : Tendsto (fun n => fieldWassersteinOne (μs n) μ) atTop (𝓝 0)) (M : ℝ) : + Tendsto (fun n => ∫ x, fieldTail M x ∂(μs n : Measure ℝ)) atTop + (𝓝 (∫ x, fieldTail M x ∂(μ : Measure ℝ))) := + integral_tendsto_of_fieldWasserstein μ μs hμ hμs hw (fieldTail_lipschitz M) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTailMgf.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTailMgf.lean new file mode 100644 index 0000000000000000000000000000000000000000..d32e8c887637123566d047864e046b3d10227496 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTailMgf.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Core.KernelExponentialBound +import OAI.Probability.InvariantIsing.Fields.FieldIncrementMgf + +namespace OAI + +/-! Canonical endpoint exponential moments depend only on the sum of +increment variances. Arbitrarily small positive exponents and arbitrarily +many levels are allowed. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldTailVariance (L : List (ℝ × ℝ≥0)) : ℝ := + (L.map (fun av => (av.2 : ℝ))).sum + +lemma fieldTransitionKernel_integrable_exp (v : ℝ≥0) (z b t : ℝ) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) : + Integrable (fun y => Real.exp (t * y)) (fieldTransitionKernel b v F hF z) := by + rw [fieldTransitionKernel_eq_tilted b v F hF hG] + apply integrable_exp_of_linearGrowth _ + (exponentialNormMoments_tilted (gaussianReal z v) + (gaussianReal_exponentialNormMoments z v) F hF hG b) measurable_id + refine ⟨0, 1, le_rfl, zero_le_one, ?_⟩ + intro x + simp [Real.norm_eq_abs] + +theorem fieldTailEndpointKernel_mgf (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hB : ∀ av ∈ L, av.1 ≤ 1) (t z : ℝ) : + Integrable (fun y => Real.exp (t * y)) (fieldTailEndpointKernel L hL z) ∧ + (∫ y, Real.exp (t * y) ∂fieldTailEndpointKernel L hL z) ≤ + Real.exp (t * z + (t ^ 2 / 2 + |t|) * fieldTailVariance L) := by + induction L generalizing z with + | nil => + constructor + · change Integrable (fun y => Real.exp (t * y)) (Measure.dirac z) + exact integrable_dirac (by simp) + · simp [fieldTailEndpointKernel, Kernel.id_apply, fieldTailVariance] + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hBt := fun bv hb => hB bv (List.mem_cons_of_mem av hb) + have hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hκ (x : ℝ) := And.intro + (fieldTransitionKernel_integrable_exp av.2 x av.1 t _ hreg.1 hreg.2) + (fieldScalarTransition_mgf L ht av.2 x av.1 t + (hL av (List.mem_cons_self)).le (hB av (List.mem_cons_self))) + have he := kernel_exp_bound_comp + (fieldTransitionKernel av.1 av.2 (fieldScalarValue L (fun y => Real.log (Real.cosh y))) hreg.1) + (fieldTailEndpointKernel L ht) t ((t ^ 2 / 2 + |t|) * av.2) + ((t ^ 2 / 2 + |t|) * fieldTailVariance L) hκ (ih ht hBt) z + refine ⟨he.1, he.2.trans_eq ?_⟩ + congr 1 + simp only [fieldTailVariance, List.map_cons, List.sum_cons] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTangentOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTangentOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fdd41e3cf26b5723f8f3065a7688f363a2fdb88 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTangentOrder.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Fields.FieldConstantPrefix +import OAI.Probability.InvariantIsing.Fields.FieldEvenTransition + +namespace OAI + +/-! Evenness and radial antitonicity of a backward covariance derivative +are preserved by each unchanged earlier Gaussian transition. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma field_gaussianTiltAverage_even (s ζ : ℝ) {F A : ℝ → ℝ} + (hF : Measurable F) (hFe : Function.Even F) + (hA : Measurable A) (hAe : Function.Even A) : + Function.Even (gaussianTiltAverage s ζ F A) := by + rw [field_gaussianTiltAverage_eq_transition s ζ hF hA] + exact fieldSpinTransition_even ζ (Real.toNNReal s) hF hFe hA hAe + +lemma field_gaussianTiltAverage_even_monotone (s ζ : ℝ) {F A : ℝ → ℝ} + (hF : Measurable F) (hFe : Function.Even F) (hFg : HasLinearGrowth F) + (hA : Measurable A) (hAe : Function.Even A) (hAm : MonotoneOn A (Ici 0)) + {K : ℝ} (hAb : ∀ y, |A y| ≤ K) : + MonotoneOn (gaussianTiltAverage s ζ F A) (Ici 0) := by + rw [field_gaussianTiltAverage_eq_transition s ζ hF hA] + exact fieldSpinTransition_even_monotone ζ (Real.toNNReal s) hF hFe hFg hA hAe hAm hAb + +lemma field_gaussianTiltAverage_even_antitone (s ζ : ℝ) {F A : ℝ → ℝ} + (hF : Measurable F) (hFe : Function.Even F) (hFg : HasLinearGrowth F) + (hA : Measurable A) (hAe : Function.Even A) (hAm : AntitoneOn A (Ici 0)) + {K : ℝ} (hAb : ∀ y, |A y| ≤ K) : + AntitoneOn (gaussianTiltAverage s ζ F A) (Ici 0) := by + have hm : Measurable (fun y => -A y) := hA.neg + have he : Function.Even (fun y => -A y) := fun y => by + dsimp only + rw [hAe y] + have hb : ∀ y, |-A y| ≤ K := fun y => by simpa only [abs_neg] using hAb y + have hn : MonotoneOn (fun y => -A y) (Ici 0) := + fun _ hx _ hy hxy => neg_le_neg (hAm hx hy hxy) + have h := field_gaussianTiltAverage_even_monotone s ζ hF hFe hFg hm he hn hb + have hneg (z : ℝ) : gaussianTiltAverage s ζ F (fun y => -A y) z = + -gaussianTiltAverage s ζ F A z := by + simpa only [neg_one_mul] using field_gaussianTiltAverage_const_mul s ζ hF hA (-1) z + intro x hx y hy hxy + have hh := h hx hy hxy + rw [hneg, hneg] at hh + exact neg_le_neg_iff.mp hh + +lemma field_negative_square_average_shape (s ζ k : ℝ) (hk : 0 ≤ k) + {F X : ℝ → ℝ} (hF : Measurable F) (hFe : Function.Even F) + (hFg : HasLinearGrowth F) (hX : Measurable X) (hXo : Function.Odd X) + (hXm : MonotoneOn X (Ici 0)) (hXp : ∀ y ∈ Ici (0 : ℝ), 0 ≤ X y) + {K : ℝ} (hXb : ∀ y, |X y| ≤ K) : + Function.Even (fun z => -k * gaussianTiltAverage s ζ F (fun y => (X y) ^ 2) z) ∧ + AntitoneOn (fun z => -k * gaussianTiltAverage s ζ F (fun y => (X y) ^ 2) z) (Ici 0) := by + have he : Function.Even (fun y => (X y) ^ 2) := by + intro y + dsimp only + rw [hXo y, neg_sq] + have hm : MonotoneOn (fun y => (X y) ^ 2) (Ici 0) := by + intro x hx y hy hxy + exact pow_le_pow_left₀ (hXp x hx) (hXm hx hy hxy) 2 + have hb : ∀ y, |(X y) ^ 2| ≤ K ^ 2 := fun y => by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (hXb y) 2 + have hJ := field_gaussianTiltAverage_even s ζ hF hFe (hX.pow_const 2) he + have hJm := field_gaussianTiltAverage_even_monotone s ζ hF hFe hFg + (hX.pow_const 2) he hm hb + refine ⟨fun z => by dsimp only; rw [hJ z], ?_⟩ + intro x hx y hy hxy + exact mul_le_mul_of_nonpos_left (hJm hx hy hxy) (neg_nonpos.mpr hk) + +namespace FieldSmoothFamily + +theorem zero_slope_tangent_shape {I : Set ℝ} (F : FieldSmoothFamily I) + (a ζ t : ℝ) (ht : t ∈ I) + (hUe : Function.Even (fun z => F.U (t, z))) + (hTe : Function.Even (fun z => F.T (t, z))) + (hTa : AntitoneOn (fun z => F.T (t, z)) (Ici 0)) : + Function.Even (fun z => F.tangent a 0 ζ (t, z)) ∧ + AntitoneOn (fun z => F.tangent a 0 ζ (t, z)) (Ici 0) := by + have hU : Measurable (fun z => F.U (t, z)) := F.mU.comp (by fun_prop) + have hT : Measurable (fun z => F.T (t, z)) := F.mT.comp (by fun_prop) + simp only [tangent, zero_mul, zero_div, add_zero] + exact ⟨field_gaussianTiltAverage_even a ζ hU hUe hT hTe, + field_gaussianTiltAverage_even_antitone a ζ hU hUe (F.growth t) hT hTe hTa + (fun z => F.bT (t, z) ht)⟩ + +end FieldSmoothFamily + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalGenerator.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalGenerator.lean new file mode 100644 index 0000000000000000000000000000000000000000..1da93384cdcf4a83bb71652f796c8f68bdaeeb27 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalGenerator.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinLinear +import OAI.Probability.InvariantIsing.Fields.FieldScalarLogCoshSecond + +namespace OAI + +/-! The terminal Ising identity gives the constant term at the last +covariance level of the backward derivative. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma field_tanh_generator_one (z : ℝ) : + 1 / (Real.cosh z) ^ 2 + (Real.tanh z) ^ 2 = 1 := by + rw [Real.tanh_eq_sinh_div_cosh] + have h := Real.cosh_sq_sub_sinh_sq z + field_simp [(Real.cosh_pos z).ne'] + nlinarith + +lemma field_tanh_generator (ζ z : ℝ) : + 1 / (Real.cosh z) ^ 2 + ζ * (Real.tanh z) ^ 2 = + 1 + (ζ - 1) * (Real.tanh z) ^ 2 := by + have h := field_tanh_generator_one z + nlinarith + +lemma fieldSpinTransition_terminal_generator (ζ : ℝ) (v : ℝ≥0) (z : ℝ) : + fieldSpinTransition ζ v (fun x => Real.log (Real.cosh x)) + (fun x => 1 / (Real.cosh x) ^ 2 + ζ * (Real.tanh x) ^ 2) z = + 1 + (ζ - 1) * fieldSpinTransition ζ v (fun x => Real.log (Real.cosh x)) + (fun x => (Real.tanh x) ^ 2) z := by + have ht : Measurable (fun x : ℝ => (Real.tanh x) ^ 2) := by + simp only [Real.tanh_eq] + fun_prop + have hB : ∀ x : ℝ, |(ζ - 1) * (Real.tanh x) ^ 2| ≤ |ζ - 1| := by + intro x + rw [abs_mul, abs_pow] + have hsq : |Real.tanh x| ^ 2 ≤ 1 := by + simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (field_abs_tanh_le_one x) 2 + exact (mul_le_mul_of_nonneg_left hsq (abs_nonneg _)).trans_eq (mul_one _) + have he : (fun x => 1 / (Real.cosh x) ^ 2 + ζ * (Real.tanh x) ^ 2) = + (fun x => (1 : ℝ) + (ζ - 1) * (Real.tanh x) ^ 2) := by + funext x + exact field_tanh_generator ζ x + have hm : Measurable (fun x : ℝ => (ζ - 1) * (Real.tanh x) ^ 2) := + ht.const_mul (ζ - 1) + rw [he, fieldSpinTransition_add (A := 1) ζ v measurable_logCosh logCosh_linearGrowth + measurable_const hm (fun _ => by norm_num) hB, + fieldSpinTransition_const ζ v measurable_logCosh logCosh_linearGrowth, + fieldSpinTransition_const_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOne.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOne.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7076a739935aadabb89dc2a04d7ca8c2be89b29 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOne.lean @@ -0,0 +1,116 @@ +import OAI.Probability.InvariantIsing.Fields.FieldGaussianTerminal + +namespace OAI + +/-! Appending an exponent-one terminal increment changes the scalar +value by its Gaussian constant and preserves every earlier spin moment. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +private lemma squares_cons_succ (av : ℝ × ℝ≥0) (L : List (ℝ × ℝ≥0)) + (F a : ℝ → ℝ) (i : Fin (L.length + 1)) : + fieldScalarSquares (av :: L) F a i.succ = + fieldSpinTransition av.1 av.2 (fieldScalarValue L F) (fieldScalarSquares L F a i) := rfl + +lemma fieldScalarValue_const_add (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (c : ℝ) : + fieldScalarValue L (fun z => c + F z) = fun z => c + fieldScalarValue L F z := by + induction L with + | nil => rfl + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht hF hG + change gaussianOperator av.1 av.2 (fieldScalarValue L (fun z => c + F z)) = _ + rw [ih ht] + funext z + exact gaussianOperator_const_add hv.1 hv.2 c av.1 av.2 z + +lemma fieldScalarMean_const_add (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (c : ℝ) : + fieldScalarMean L (fun z => c + F z) a = fieldScalarMean L F a := by + induction L with + | nil => rfl + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + change fieldSpinTransition av.1 av.2 (fieldScalarValue L (fun z => c + F z)) + (fieldScalarMean L (fun z => c + F z) a) = _ + rw [fieldScalarValue_const_add L ht hF hG c, ih ht] + funext z + exact fieldSpinTransition_const_add av.1 av.2 (fieldScalarValue L F) _ c z + +lemma fieldScalarValue_terminal_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (v : ℝ≥0) : + fieldScalarValue (L ++ [(1, v)]) (fun z => Real.log (Real.cosh z)) = + fun z => v / 2 + fieldScalarValue L (fun z => Real.log (Real.cosh z)) z := by + have he : fieldScalarValue (L ++ [(1, v)]) (fun z => Real.log (Real.cosh z)) = + fieldScalarValue L (fun z => v / 2 + Real.log (Real.cosh z)) := by + simp only [fieldScalarValue, List.foldr_append, List.foldr_cons, List.foldr_nil] + congr 1 + funext z + exact gaussianOperator_one_logCosh v z + rw [he] + exact fieldScalarValue_const_add L hL measurable_logCosh logCosh_linearGrowth _ + +lemma fieldScalarMean_terminal_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (v : ℝ≥0) : + fieldScalarMean (L ++ [(1, v)]) (fun z => Real.log (Real.cosh z)) Real.tanh = + fieldScalarMean L (fun z => Real.log (Real.cosh z)) Real.tanh := by + induction L with + | nil => + funext z + exact fieldSpinTransition_one_tanh v z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + simp only [List.cons_append, fieldScalarMean] + rw [fieldScalarValue_terminal_one L ht v, ih ht] + funext z + exact fieldSpinTransition_const_add av.1 av.2 _ _ (v / 2) z + +lemma fieldScalarSquares_terminal_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (v : ℝ≥0) (i : ℕ) (hi : i ≤ L.length) : + fieldScalarSquares (L ++ [(1, v)]) (fun z => Real.log (Real.cosh z)) Real.tanh + ⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩ = + fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh + ⟨i, by omega⟩ := by + induction L generalizing i with + | nil => + have hi0 : i = 0 := by simpa using hi + subst i + funext z + change (fieldSpinTransition 1 v (fun z => Real.log (Real.cosh z)) Real.tanh z) ^ 2 = + (Real.tanh z) ^ 2 + rw [fieldSpinTransition_one_tanh] + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + cases i with + | zero => + funext z + change (fieldScalarMean ((av :: L) ++ [(1, v)]) (fun z => Real.log (Real.cosh z)) + Real.tanh z) ^ 2 = (fieldScalarMean (av :: L) (fun z => Real.log (Real.cosh z)) + Real.tanh z) ^ 2 + rw [fieldScalarMean_terminal_one (av :: L) hL v] + | succ i => + have hiL : i ≤ L.length := Nat.le_of_succ_le_succ hi + simp only [List.cons_append] + have hleft : (⟨i + 1, by simp only [List.length_cons, List.length_append]; omega⟩ : + Fin ((av :: (L ++ [(1, v)])).length + 1)) = + (⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩ : + Fin ((L ++ [(1, v)]).length + 1)).succ := rfl + have hright : (⟨i + 1, by simp only [List.length_cons]; omega⟩ : Fin ((av :: L).length + 1)) = + (⟨i, by omega⟩ : Fin (L.length + 1)).succ := rfl + rw [hleft, hright, squares_cons_succ, squares_cons_succ] + rw [fieldScalarValue_terminal_one L ht v, ih ht i hiL] + funext z + exact fieldSpinTransition_const_add av.1 av.2 _ _ (v / 2) z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..d61e74b8cb430310f372c3fb62e483ce80c0bc2e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOrder.lean @@ -0,0 +1,128 @@ +import OAI.Probability.InvariantIsing.Fields.FieldAdjacentOrder +import OAI.Probability.InvariantIsing.Fields.FieldTerminalGenerator + +namespace OAI + +/-! The final covariance coordinate has the same mixed monotonicity; +its backward derivative has the additional constant one half. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +def fieldTerminalFamily (a ζ : ℝ) : FieldSmoothFamily (Ioi (-a)) := + (fieldLogCoshFamily (Ioi (-a))).transform isOpen_Ioi a 1 ζ (fun t ht => by + have h : -a < t := ht + linarith) + +lemma fieldTerminalFamily_value_eq_operator (a ζ t : ℝ) : + (fun z => (fieldTerminalFamily a ζ).U (t, z)) = + gaussianOperator ζ (Real.toNNReal (a + t)) (fun y => Real.log (Real.cosh y)) := by + funext z + change gaussianTransform (a + 1 * t) ζ (fun y => Real.log (Real.cosh y)) z = _ + rw [one_mul, field_gaussianTransform_eq_operator] + +lemma fieldTerminalFamily_mean_eq_transition (a ζ t : ℝ) : + (fun z => (fieldTerminalFamily a ζ).X (t, z)) = + fieldSpinTransition ζ (Real.toNNReal (a + t)) + (fun y => Real.log (Real.cosh y)) Real.tanh := by + have hm : Measurable (fun y : ℝ => Real.tanh y) := by + simp only [Real.tanh_eq] + fun_prop + funext z + change gaussianTiltAverage (a + 1 * t) ζ (fun y => Real.log (Real.cosh y)) Real.tanh z = _ + rw [one_mul, field_gaussianTiltAverage_eq_transition _ _ measurable_logCosh hm] + +theorem fieldTerminalFamily_tangent (a ζ t z : ℝ) : + (fieldTerminalFamily a ζ).T (t, z) = (1 : ℝ) / 2 - (1 - ζ) / 2 * + gaussianTiltAverage (a + t) ζ (fun y => Real.log (Real.cosh y)) + (fun y => (Real.tanh y) ^ 2) z := by + have hm : Measurable (fun y : ℝ => 1 / (Real.cosh y) ^ 2 + ζ * (Real.tanh y) ^ 2) := by + simp only [Real.tanh_eq] + fun_prop + have hx : Measurable (fun y : ℝ => (Real.tanh y) ^ 2) := by + simp only [Real.tanh_eq] + fun_prop + have hgen := fieldSpinTransition_terminal_generator ζ (Real.toNNReal (a + t)) z + rw [← field_gaussianTiltAverage_eq_transition (a + t) ζ measurable_logCosh hm, + ← field_gaussianTiltAverage_eq_transition (a + t) ζ measurable_logCosh hx] at hgen + change gaussianTiltAverage (a + 1 * t) ζ (fun y => Real.log (Real.cosh y)) (fun _ => 0) z + + (1 : ℝ) / 2 * gaussianTiltAverage (a + 1 * t) ζ + (fun y => Real.log (Real.cosh y)) + (fun y => 1 / (Real.cosh y) ^ 2 + ζ * (Real.tanh y) ^ 2) z = _ + rw [one_mul, field_gaussianTiltAverage_const _ _ measurable_logCosh logCosh_linearGrowth, + hgen] + ring + +theorem fieldTerminalFamily_tangent_antitone (a ζ : ℝ) (hζ : ζ ≤ 1) (t : ℝ) : + AntitoneOn (fun z => (fieldTerminalFamily a ζ).T (t, z)) (Ici 0) := by + have he : Function.Even (fun y : ℝ => Real.log (Real.cosh y)) := by + intro y + simp only [Real.cosh_neg] + have hm : Measurable (fun y : ℝ => Real.tanh y) := by + simp only [Real.tanh_eq] + fun_prop + have h := field_negative_square_average_shape (a + t) ζ ((1 - ζ) / 2) (by linarith) + measurable_logCosh he logCosh_linearGrowth hm Real.tanh_neg + (field_tanh_monotone.monotoneOn _) (fun _ hy => field_tanh_nonneg hy) + field_abs_tanh_le_one + intro x hx y hy hxy + dsimp only + rw [fieldTerminalFamily_tangent, fieldTerminalFamily_tangent] + have hh := h.2 hx hy hxy + dsimp only at hh + linarith + +theorem fieldTerminalFamily_shape (a ζ : ℝ) (hζ : 0 ≤ ζ) (t : ℝ) : + Function.Even (fun z => (fieldTerminalFamily a ζ).U (t, z)) ∧ + Function.Odd (fun z => (fieldTerminalFamily a ζ).X (t, z)) ∧ + MonotoneOn (fun z => (fieldTerminalFamily a ζ).X (t, z)) (Ici 0) ∧ + (∀ z ∈ Ici (0 : ℝ), 0 ≤ (fieldTerminalFamily a ζ).X (t, z)) ∧ + (∀ z, |(fieldTerminalFamily a ζ).X (t, z)| ≤ 1) := by + have he : Function.Even (fun y : ℝ => Real.log (Real.cosh y)) := by + intro y + simp only [Real.cosh_neg] + have hm : Measurable (fun y : ℝ => Real.tanh y) := by + simp only [Real.tanh_eq] + fun_prop + have hval := fieldTerminalFamily_value_eq_operator a ζ t + have hmean := fieldTerminalFamily_mean_eq_transition a ζ t + have hmeanPoint (z : ℝ) := congrFun hmean z + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rw [hval] + exact gaussianOperator_even ζ _ measurable_logCosh he + · rw [hmean] + exact fieldSpinTransition_odd ζ _ measurable_logCosh he hm Real.tanh_neg + · rw [hmean] + exact fieldSpinTransition_monotone hζ _ measurable_logCosh he logCosh_linearGrowth + hm Real.tanh_neg (field_tanh_monotone.monotoneOn _) + (fun _ hz => field_tanh_nonneg hz) field_abs_tanh_le_one + · intro z hz + rw [hmeanPoint] + exact fieldSpinTransition_nonneg ζ _ measurable_logCosh he logCosh_linearGrowth + hm Real.tanh_neg (fun _ hy => field_tanh_nonneg hy) field_abs_tanh_le_one hz + · intro z + rw [hmeanPoint] + exact fieldSpinTransition_bound ζ _ measurable_logCosh logCosh_linearGrowth + field_abs_tanh_le_one z + +theorem fieldTerminal_earlier_squares_antitone (a ζ : ℝ) (hζ0 : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (P : List (ℝ × ℝ≥0)) (hP : ∀ av ∈ P, 0 < av.1) + {t s : ℝ} (ht : t ∈ Ioi (-a)) (hs : s ∈ Ioi (-a)) (hts : t ≤ s) : + let G := fieldTerminalFamily a ζ + ∀ i z, fieldScalarSquares P (fun y => G.U (s, y)) (fun y => G.X (s, y)) i z ≤ + fieldScalarSquares P (fun y => G.U (t, y)) (fun y => G.X (t, y)) i z := by + have hshape (q : ℝ) := fieldTerminalFamily_shape a ζ hζ0 q + exact (fieldTerminalFamily a ζ).earlier_squares_antitone_parameter (convex_Ioi (-a)) + (fun q _ => fieldTerminalFamily_tangent_antitone a ζ hζ1 q) + (fun q _ => (hshape q).1) (fun q _ => (hshape q).2.1) + (fun q _ => (hshape q).2.2.1) (fun q _ => (hshape q).2.2.2.1) + (fun p => (hshape p.1).2.2.2.2 p.2) P hP ht hs hts + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltAverageDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltAverageDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..3dcdda24ff4384a8c26b4bef43b119a0b7e7f520 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltAverageDerivative.lean @@ -0,0 +1,130 @@ +import OAI.Probability.InvariantIsing.Fields.FieldTiltDerivative + +namespace OAI + +/-! Differentiation of the scalar tilted spin average. The potential +needs an exponential moment at the base point, rather than a global bound. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma parameter_exp_bound (U DU : ℝ → ℝ → ℝ) {C : ℝ} + (hC : 0 ≤ C) (hDU : ∀ s u, |DU s u| ≤ C) + (hd : ∀ s u, HasDerivAt (fun q => U q u) (DU s u) s) + (ζ x s u : ℝ) (hs : s ∈ Ioo (x - 1) (x + 1)) : + Real.exp (ζ * U s u) ≤ Real.exp (|ζ| * C) * Real.exp (ζ * U x u) := by + have hdiff : |U s u - U x u| ≤ C * |s - x| := by + simpa only [Real.norm_eq_abs] using + Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun q (_ : q ∈ (univ : Set ℝ)) => (hd q u).hasDerivWithinAt) + (fun q _ => by simpa only [Real.norm_eq_abs] using hDU q u) + convex_univ (mem_univ x) (mem_univ s) + have hdist : |s - x| ≤ 1 := abs_le.mpr ⟨by linarith [hs.1], by linarith [hs.2]⟩ + have h1 := hdiff.trans (mul_le_of_le_one_right hC hdist) + have h2 : ζ * (U s u - U x u) ≤ |ζ| * C := + (le_abs_self _).trans (by + rw [abs_mul] + exact mul_le_mul_of_nonneg_left h1 (abs_nonneg ζ)) + rw [← Real.exp_add] + exact Real.exp_le_exp.mpr (by nlinarith) + +theorem hasDerivAt_tiltAverage_of_bounded_derivatives + (μ : Measure ℝ) [IsProbabilityMeasure μ] + (U A DU DA : ℝ → ℝ → ℝ) + (hU : ∀ s, Measurable (U s)) (hA : ∀ s, Measurable (A s)) + (hDU : ∀ s, Measurable (DU s)) (hDA : ∀ s, Measurable (DA s)) + {C M L : ℝ} (hC : 0 ≤ C) (hM : 0 ≤ M) + (hbDU : ∀ s u, |DU s u| ≤ C) (hbA : ∀ s u, |A s u| ≤ M) + (hbDA : ∀ s u, |DA s u| ≤ L) + (dU : ∀ s u, HasDerivAt (fun q => U q u) (DU s u) s) + (dA : ∀ s u, HasDerivAt (fun q => A q u) (DA s u) s) + (ζ x : ℝ) (hi : Integrable (fun u => Real.exp (ζ * U x u)) μ) : + HasDerivAt (fun s => ∫ u, A s u ∂μ.tilted (fun u => ζ * U s u)) + ((∫ u, DA x u ∂μ.tilted (fun u => ζ * U x u)) + + ζ * ((∫ u, A x u * DU x u ∂μ.tilted (fun u => ζ * U x u)) - + (∫ u, A x u ∂μ.tilted (fun u => ζ * U x u)) * + (∫ u, DU x u ∂μ.tilted (fun u => ζ * U x u)))) x := by + have hS : Ioo (x - 1) (x + 1) ∈ 𝓝 x := + Ioo_mem_nhds (by linarith) (by linarith) + have hE (s u : ℝ) (hs : s ∈ Ioo (x - 1) (x + 1)) := + parameter_exp_bound U DU hC hbDU dU ζ x s u hs + have hAD (s u : ℝ) : |A s u * DU s u| ≤ M * C := by + rw [abs_mul] + exact mul_le_mul (hbA s u) (hbDU s u) (abs_nonneg _) hM + have hprod {G : ℝ → ℝ} (hm : Measurable G) {K : ℝ} (hb : ∀ u, |G u| ≤ K) : + Integrable (fun u => Real.exp (ζ * U x u) * G u) μ := + hi.mul_bdd hm.aestronglyMeasurable + (ae_of_all _ fun u => by simpa only [Real.norm_eq_abs] using hb u) + have hiA := hprod (hA x) (hbA x) + have hiDA := hprod (hDA x) (hbDA x) + have hiAD := hprod ((hA x).mul (hDU x)) (hAD x) + change Integrable (fun u => Real.exp (ζ * U x u) * (A x u * DU x u)) μ at hiAD + have hdDen (s u : ℝ) := ((dU s u).const_mul ζ).exp + have hdNum (s u : ℝ) : + HasDerivAt (fun q => Real.exp (ζ * U q u) * A q u) + (Real.exp (ζ * U s u) * DA s u + + ζ * (Real.exp (ζ * U s u) * (A s u * DU s u))) s := by + convert (hdDen s u).mul (dA s u) using 1 + ring + obtain ⟨_, hden⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le hS + (Eventually.of_forall fun s => ((hU s).const_mul ζ).exp.aestronglyMeasurable) hi + (((hU x).const_mul ζ).exp.mul ((hDU x).const_mul ζ)).aestronglyMeasurable + (ae_of_all _ fun u s hs => by + change |Real.exp (ζ * U s u) * (ζ * DU s u)| ≤ _ + rw [abs_mul, abs_of_pos (Real.exp_pos _), abs_mul] + calc + _ ≤ (Real.exp (|ζ| * C) * Real.exp (ζ * U x u)) * (|ζ| * C) := + mul_le_mul (hE s u hs) (mul_le_mul_of_nonneg_left (hbDU s u) (abs_nonneg ζ)) + (mul_nonneg (abs_nonneg _) (abs_nonneg _)) (by positivity) + _ = (Real.exp (|ζ| * C) * (|ζ| * C)) * Real.exp (ζ * U x u) := by ring) + (hi.const_mul (Real.exp (|ζ| * C) * (|ζ| * C))) + (ae_of_all _ fun u s _ => hdDen s u) + obtain ⟨_, hnum⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le hS + (Eventually.of_forall fun s => (((hU s).const_mul ζ).exp.mul (hA s)).aestronglyMeasurable) + hiA ((((hU x).const_mul ζ).exp.mul (hDA x)).add + ((((hU x).const_mul ζ).exp.mul ((hA x).mul (hDU x))).const_mul ζ)).aestronglyMeasurable + (ae_of_all _ fun u s hs => by + change |Real.exp (ζ * U s u) * DA s u + + ζ * (Real.exp (ζ * U s u) * (A s u * DU s u))| ≤ _ + refine (abs_add_le _ _).trans ?_ + rw [abs_mul, abs_of_pos (Real.exp_pos _), abs_mul, abs_mul, + abs_of_pos (Real.exp_pos _)] + calc + _ ≤ (Real.exp (|ζ| * C) * Real.exp (ζ * U x u)) * L + + |ζ| * ((Real.exp (|ζ| * C) * Real.exp (ζ * U x u)) * (M * C)) := + add_le_add (mul_le_mul (hE s u hs) (hbDA s u) (abs_nonneg _) (by positivity)) + (mul_le_mul_of_nonneg_left + (mul_le_mul (hE s u hs) (hAD s u) (abs_nonneg _) (by positivity)) (abs_nonneg ζ)) + _ = (Real.exp (|ζ| * C) * (L + |ζ| * (M * C))) * + Real.exp (ζ * U x u) := by ring) + (hi.const_mul (Real.exp (|ζ| * C) * (L + |ζ| * (M * C)))) + (ae_of_all _ fun u s _ => hdNum s u) + have hp := IsingPerceptron.integral_exp_pos μ (U x) hi + simp only [Pi.mul_apply] at hnum + have hde : (∫ u, Real.exp (ζ * U x u) * (ζ * DU x u) ∂μ) = + ζ * ∫ u, Real.exp (ζ * U x u) * DU x u ∂μ := by + rw [← integral_const_mul] + congr 1 + funext u + ring + have hne : (∫ u, Real.exp (ζ * U x u) * DA x u + + ζ * (Real.exp (ζ * U x u) * (A x u * DU x u)) ∂μ) = + (∫ u, Real.exp (ζ * U x u) * DA x u ∂μ) + + ζ * ∫ u, Real.exp (ζ * U x u) * (A x u * DU x u) ∂μ := by + rw [integral_add hiDA (hiAD.const_mul ζ), integral_const_mul] + convert hnum.div hden hp.ne' using 1 + · funext s + exact integral_tilted_eq_div _ _ _ + · simp only [integral_tilted_eq_div] + rw [hde, hne] + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..95dea06fed5019a7d60ec0d0e847414011533936 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltDerivative.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinDerivative + +namespace OAI + +/-! A local integrable envelope permits covariance derivatives of a +Gaussian logarithmic mean without a bounded-payoff assumption. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma hasDerivAt_logMean_of_integrable_envelope + {A : Type*} [MeasurableSpace A] (μ : Measure A) [IsProbabilityMeasure μ] + (F D : ℝ → A → ℝ) (hF : ∀ s, Measurable (F s)) + {ζ t : ℝ} (hζ : ζ ≠ 0) {S : Set ℝ} (hS : S ∈ 𝓝 t) + (hD : Measurable (D t)) + (hi : Integrable (fun u => Real.exp (ζ * F t u)) μ) + (hd : ∀ s ∈ S, ∀ u, HasDerivAt (fun q => F q u) (D s u) s) + (M : A → ℝ) (hM : Integrable M μ) + (hbound : ∀ᵐ u ∂μ, ∀ s ∈ S, ‖Real.exp (ζ * F s u) * (ζ * D s u)‖ ≤ M u) : + HasDerivAt (fun s => logMean ζ μ (F s)) + (∫ u, D t u ∂μ.tilted (fun u => ζ * F t u)) t := by + obtain ⟨_, hI⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le hS + (Eventually.of_forall fun s => ((hF s).const_mul ζ).exp.aestronglyMeasurable) hi + (((hF t).const_mul ζ).exp.mul (hD.const_mul ζ)).aestronglyMeasurable + hbound hM (ae_of_all _ fun u s hs => ((hd s hs u).const_mul ζ).exp) + have hpos := IsingPerceptron.integral_exp_pos μ (F t) hi + convert (hI.log hpos.ne').div_const ζ using 1 + · rfl + · rw [integral_tilted_eq_div] + have he : (∫ u, Real.exp (ζ * F t u) * (ζ * D t u) ∂μ) = + ζ * ∫ u, Real.exp (ζ * F t u) * D t u ∂μ := by + rw [← integral_const_mul] + congr 1 + funext u + ring + rw [he] + field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedFamilyDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedFamilyDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..100d8216f4967b460b6a7808e5c310337496beef --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedFamilyDerivative.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Fields.FieldGaussianFamilyEnvelope +import OAI.Probability.InvariantIsing.Fields.FieldGaussianTiltMoments + +namespace OAI + +/-! Differentiating a normalized scalar Gaussian average with a varying +observable. The local envelopes allow the affine-noise quadratic terms +needed in the second derivative of the finite Ising recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing + +/-- Derivative of the unnormalized Gaussian weight. -/ +def fieldWeightDifferential (U : (ℝ × ℝ) → ℝ → ℝ) + (DU : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ) (ζ : ℝ) + (p : ℝ × ℝ) (u : ℝ) : (ℝ × ℝ) →L[ℝ] ℝ := + Real.exp (ζ * U p u) • (ζ • DU p u) + +/-- Derivative of the weighted observable. -/ +def fieldObservableDifferential (U A : (ℝ × ℝ) → ℝ → ℝ) + (DU DA : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ) (ζ : ℝ) + (p : ℝ × ℝ) (u : ℝ) : (ℝ × ℝ) →L[ℝ] ℝ := + Real.exp (ζ * U p u) • (DA p u + (ζ * A p u) • DU p u) + +lemma field_tiltedFamily_hasFDerivAt + (μ : Measure ℝ) [IsProbabilityMeasure μ] + (U A : (ℝ × ℝ) → ℝ → ℝ) + (DU DA : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ) + {p : ℝ × ℝ} {S : Set (ℝ × ℝ)} (hS : S ∈ 𝓝 p) (ζ : ℝ) + (hU : ∀ q, Measurable (U q)) (hA : ∀ q, Measurable (A q)) + (hDU : AEStronglyMeasurable (DU p) μ) (hDA : AEStronglyMeasurable (DA p) μ) + (hE : Integrable (fun u => Real.exp (ζ * U p u)) μ) + (hEA : Integrable (fun u => Real.exp (ζ * U p u) * A p u) μ) + (MD MN : ℝ → ℝ) (hMD : Integrable MD μ) (hMN : Integrable MN μ) + (hDen : ∀ q ∈ S, ∀ u, ‖fieldWeightDifferential U DU ζ q u‖ ≤ MD u) + (hNum : ∀ q ∈ S, ∀ u, ‖fieldObservableDifferential U A DU DA ζ q u‖ ≤ MN u) + (dU : ∀ q ∈ S, ∀ u, HasFDerivAt (fun r => U r u) (DU q u) q) + (dA : ∀ q ∈ S, ∀ u, HasFDerivAt (fun r => A r u) (DA q u) q) : + let Z := ∫ u, Real.exp (ζ * U p u) ∂μ + let N := ∫ u, Real.exp (ζ * U p u) * A p u ∂μ + HasFDerivAt (fun q => ∫ u, A q u ∂μ.tilted (fun u => ζ * U q u)) + (Z⁻¹ • (∫ u, fieldObservableDifferential U A DU DA ζ p u ∂μ) - + (N * (Z ^ 2)⁻¹) • (∫ u, fieldWeightDifferential U DU ζ p u ∂μ)) p := by + let Z := ∫ u, Real.exp (ζ * U p u) ∂μ + let N := ∫ u, Real.exp (ζ * U p u) * A p u ∂μ + let DZ := ∫ u, fieldWeightDifferential U DU ζ p u ∂μ + let DN := ∫ u, fieldObservableDifferential U A DU DA ζ p u ∂μ + have hZD : HasFDerivAt (fun q => ∫ u, Real.exp (ζ * U q u) ∂μ) DZ p := by + apply hasFDerivAt_integral_of_dominated_of_fderiv_le hS + (Eventually.of_forall fun q => ((hU q).const_mul ζ).exp.aestronglyMeasurable) + hE (((hU p).const_mul ζ).exp.aestronglyMeasurable.smul (hDU.const_smul ζ)) + (ae_of_all _ fun u q hq => hDen q hq u) hMD + exact ae_of_all _ fun u q hq => ((dU q hq u).const_mul ζ).exp + have hND : HasFDerivAt (fun q => ∫ u, Real.exp (ζ * U q u) * A q u ∂μ) DN p := by + have hDM : AEStronglyMeasurable (fieldObservableDifferential U A DU DA ζ p) μ := + ((hU p).const_mul ζ).exp.aestronglyMeasurable.smul + (hDA.add (((hA p).const_mul ζ).aestronglyMeasurable.smul hDU)) + apply hasFDerivAt_integral_of_dominated_of_fderiv_le hS + (Eventually.of_forall fun q => (((hU q).const_mul ζ).exp.mul (hA q)).aestronglyMeasurable) + hEA hDM (ae_of_all _ fun u q hq => hNum q hq u) hMN + refine ae_of_all _ fun u q hq => ?_ + convert (((dU q hq u).const_mul ζ).exp).mul (dA q hq u) using 1 + apply ContinuousLinearMap.ext + intro v + simp only [fieldObservableDifferential, smul_apply, + add_apply, smul_eq_mul] + ring + have hZ : Z ≠ 0 := (integral_exp_pos μ (U p) hE).ne' + have hInv : HasFDerivAt (fun q => (∫ u, Real.exp (ζ * U q u) ∂μ)⁻¹) + (-(Z ^ 2)⁻¹ • DZ) p := by + convert (hasDerivAt_inv hZ).hasFDerivAt.comp p hZD using 1 + · rfl + · apply ContinuousLinearMap.ext + intro v + simp only [smul_apply, ContinuousLinearMap.comp_apply, + smul_eq_mul] + change -(Z ^ 2)⁻¹ * DZ v = DZ v * -(Z ^ 2)⁻¹ + ring + have hquot := hND.mul hInv + have he : (fun q => ∫ u, A q u ∂μ.tilted (fun u => ζ * U q u)) = + fun q => (∫ u, Real.exp (ζ * U q u) * A q u ∂μ) * + (∫ u, Real.exp (ζ * U q u) ∂μ)⁻¹ := by + funext q + rw [integral_tilted_eq_div, div_eq_mul_inv] + rw [he] + convert hquot using 1 + apply ContinuousLinearMap.ext + intro v + simp only [sub_apply, smul_apply, + add_apply, smul_eq_mul] + change Z⁻¹ * DN v - N * (Z ^ 2)⁻¹ * DZ v = + N * (-(Z ^ 2)⁻¹ * DZ v) + Z⁻¹ * DN v + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedPairDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedPairDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..103eb598f1acc8ff04a2ab0a6441608a04a563ec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedPairDerivative.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Fields.FieldTiltedFamilyDerivative + +namespace OAI + +/-! Covariance form of the derivative of an actual normalized average. +This is the two-coordinate formula used by the finite scalar recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma field_tilted_integral_normalize {E : Type*} [NormedAddCommGroup E] + [NormedSpace ℝ E] [CompleteSpace E] (μ : Measure ℝ) (U : ℝ → ℝ) + (B : ℝ → E) (ζ : ℝ) : + (∫ u, B u ∂μ.tilted (fun u => ζ * U u)) = + (∫ u, Real.exp (ζ * U u) ∂μ)⁻¹ • + (∫ u, Real.exp (ζ * U u) • B u ∂μ) := by + rw [integral_tilted, ← integral_smul] + congr 1 + funext u + rw [smul_smul] + congr 1 + ring + +lemma field_tiltedFamily_covariance_hasFDerivAt + (μ : Measure ℝ) [IsProbabilityMeasure μ] + (U A : (ℝ × ℝ) → ℝ → ℝ) + (DU DA : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ) + {p : ℝ × ℝ} {S : Set (ℝ × ℝ)} (hS : S ∈ 𝓝 p) (ζ : ℝ) + (hU : ∀ q, Measurable (U q)) (hA : ∀ q, Measurable (A q)) + (hDU : AEStronglyMeasurable (DU p) μ) (hDA : AEStronglyMeasurable (DA p) μ) + (hE : Integrable (fun u => Real.exp (ζ * U p u)) μ) + (hEA : Integrable (fun u => Real.exp (ζ * U p u) * A p u) μ) + (MD MN : ℝ → ℝ) (hMD : Integrable MD μ) (hMN : Integrable MN μ) + (hDen : ∀ q ∈ S, ∀ u, ‖fieldWeightDifferential U DU ζ q u‖ ≤ MD u) + (hNum : ∀ q ∈ S, ∀ u, ‖fieldObservableDifferential U A DU DA ζ q u‖ ≤ MN u) + (dU : ∀ q ∈ S, ∀ u, HasFDerivAt (fun r => U r u) (DU q u) q) + (dA : ∀ q ∈ S, ∀ u, HasFDerivAt (fun r => A r u) (DA q u) q) : + HasFDerivAt (fun q => ∫ u, A q u ∂μ.tilted (fun u => ζ * U q u)) + ((∫ u, DA p u + (ζ * A p u) • DU p u + ∂μ.tilted (fun u => ζ * U p u)) - + (∫ u, A p u ∂μ.tilted (fun u => ζ * U p u)) • + (∫ u, ζ • DU p u ∂μ.tilted (fun u => ζ * U p u))) p := by + have h := field_tiltedFamily_hasFDerivAt μ U A DU DA hS ζ hU hA hDU hDA + hE hEA MD MN hMD hMN hDen hNum dU dA + convert h using 1 + rw [field_tilted_integral_normalize, field_tilted_integral_normalize, + field_tilted_integral_normalize] + simp only [smul_eq_mul, fieldObservableDifferential, fieldWeightDifferential, + pow_two, smul_smul] + congr 1 + apply ContinuousLinearMap.ext + intro v + simp only [smul_apply, smul_eq_mul] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingContinuity.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..9eacf234796d42ea4e02a9adc3dd0ed192f72555 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingContinuity.lean @@ -0,0 +1,139 @@ +import OAI.Probability.InvariantIsing.Fields.FieldVaryingRecursion + +namespace OAI + +/-! Joint continuity of the actual finite scalar recursion and its +physical-spin second moments, including zero variance increments. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped NNReal + +namespace InvariantIsing + +lemma field_continuous_tanh : Continuous Real.tanh := by + change Continuous (fun z : ℝ => Real.tanh z) + simp only [Real.tanh_eq] + exact (Real.continuous_exp.sub (Real.continuous_exp.comp continuous_neg)).div + (Real.continuous_exp.add (Real.continuous_exp.comp continuous_neg)) + (fun z => (add_pos (Real.exp_pos z) (Real.exp_pos (-z))).ne') + +theorem continuous_fieldVaryingValue {E : Type*} [TopologicalSpace E] + [FirstCountableTopology E] (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (hc : ∀ av ∈ L, Continuous av.2) + {V : ℝ} (hV : 0 ≤ V) (hv : ∀ av ∈ L, ∀ t, (av.2 t : ℝ) ≤ V) : + Continuous (fun p : E × ℝ => fieldVaryingValue L p.1 p.2) := by + induction L with + | nil => + change Continuous (fun p : E × ℝ => Real.log (Real.cosh p.2)) + exact (Real.continuous_cosh.comp continuous_snd).log (fun p => (Real.cosh_pos p.2).ne') + | cons av L ih => + have hLt : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hct := fun bv hb => hc bv (List.mem_cons_of_mem av hb) + have hvt := fun bv hb t => hv bv (List.mem_cons_of_mem av hb) t + have hval := ih hLt hct hvt + obtain ⟨hcap, hb⟩ := fieldVaryingValue_bound L hLt hV hvt + change Continuous (fun p : E × ℝ => gaussianOperator av.1 (av.2 p.1) + (fieldVaryingValue L p.1) p.2) + simp_rw [gaussianOperator_eq_transform] + exact continuous_field_gaussian_transform (E := E × ℝ) + (U := fun p y => fieldVaryingValue L p.1 y) + (hval.comp (continuous_fst.fst.prodMk continuous_snd)) + ((NNReal.continuous_coe.comp (hc av List.mem_cons_self)).comp continuous_fst) continuous_snd + hcap zero_le_one (fun p y => by simpa only [one_mul] using hb p.1 y) av.1 + +theorem continuous_fieldVaryingMean {E : Type*} [TopologicalSpace E] + [FirstCountableTopology E] (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (hc : ∀ av ∈ L, Continuous av.2) + {V : ℝ} (hV : 0 ≤ V) (hv : ∀ av ∈ L, ∀ t, (av.2 t : ℝ) ≤ V) : + Continuous (fun p : E × ℝ => fieldVaryingMean L p.1 p.2) := by + induction L with + | nil => + change Continuous (fun p : E × ℝ => Real.tanh p.2) + exact field_continuous_tanh.comp continuous_snd + | cons av L ih => + have hLt : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hct := fun bv hb => hc bv (List.mem_cons_of_mem av hb) + have hvt := fun bv hb t => hv bv (List.mem_cons_of_mem av hb) t + have hval := continuous_fieldVaryingValue L hLt hct hV hvt + have hmean := ih hLt hct hvt + obtain ⟨hcap, hb⟩ := fieldVaryingValue_bound L hLt hV hvt + have hcont := continuous_field_gaussian_tilt_average (E := E × ℝ) + (U := fun p y => fieldVaryingValue L p.1 y) + (A := fun p y => fieldVaryingMean L p.1 y) + (hval.comp (continuous_fst.fst.prodMk continuous_snd)) + (hmean.comp (continuous_fst.fst.prodMk continuous_snd)) + ((NNReal.continuous_coe.comp (hc av List.mem_cons_self)).comp continuous_fst) continuous_snd + hcap zero_le_one zero_le_one (fun p y => by simpa only [one_mul] using hb p.1 y) + (fun p y => (fieldVaryingMean_regular L hLt p.1).2 y) av.1 + convert hcont using 1 + funext p + exact fieldSpinTransition_eq_standard av.1 (av.2 p.1) + (fieldVaryingValue_regular L hLt p.1).1 (fieldVaryingMean_regular L hLt p.1).1 p.2 + +theorem continuous_fieldVaryingSquares {E : Type*} [TopologicalSpace E] + [FirstCountableTopology E] (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (hc : ∀ av ∈ L, Continuous av.2) + {V : ℝ} (hV : 0 ≤ V) (hv : ∀ av ∈ L, ∀ t, (av.2 t : ℝ) ≤ V) + (i : Fin (L.length + 1)) : + Continuous (fun p : E × ℝ => fieldVaryingSquares L p.1 i p.2) := by + induction L with + | nil => + change Continuous (fun p : E × ℝ => (Real.tanh p.2) ^ 2) + exact (field_continuous_tanh.comp continuous_snd).pow 2 + | cons av L ih => + have hLt : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hct := fun bv hb => hc bv (List.mem_cons_of_mem av hb) + have hvt := fun bv hb t => hv bv (List.mem_cons_of_mem av hb) t + refine Fin.cases ?_ (fun j => ?_) i + · exact (continuous_fieldVaryingMean (av :: L) hL hc hV hv).pow 2 + · have hval := continuous_fieldVaryingValue L hLt hct hV hvt + have hsq := ih hLt hct hvt j + obtain ⟨hcap, hb⟩ := fieldVaryingValue_bound L hLt hV hvt + have hcont := continuous_field_gaussian_tilt_average (E := E × ℝ) + (U := fun p y => fieldVaryingValue L p.1 y) + (A := fun p y => fieldVaryingSquares L p.1 j y) + (hval.comp (continuous_fst.fst.prodMk continuous_snd)) + (hsq.comp (continuous_fst.fst.prodMk continuous_snd)) + ((NNReal.continuous_coe.comp (hc av List.mem_cons_self)).comp continuous_fst) continuous_snd + hcap zero_le_one zero_le_one (fun p y => by simpa only [one_mul] using hb p.1 y) + (fun p y => by + have hr := (fieldVaryingSquares_regular L hLt p.1 j).2 y + rw [abs_of_nonneg hr.1] + exact hr.2) av.1 + convert hcont using 1 + funext p + exact fieldSpinTransition_eq_standard av.1 (av.2 p.1) + (fieldVaryingValue_regular L hLt p.1).1 + (fieldVaryingSquares_regular L hLt p.1 j).1 p.2 + +theorem continuous_fieldVaryingOverlaps {E : Type*} [TopologicalSpace E] + [FirstCountableTopology E] (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (hc : ∀ av ∈ L, Continuous av.2) + {V : ℝ} (hV : 0 ≤ V) (hv : ∀ av ∈ L, ∀ t, (av.2 t : ℝ) ≤ V) + (root : E → ℝ≥0) (hr : Continuous root) (i : Fin (L.length + 1)) : + Continuous (fun t => ∫ u, fieldVaryingSquares L t i + (Real.sqrt (root t : ℝ) * u) ∂gaussianReal 0 1) := by + have hsq := continuous_fieldVaryingSquares L hL hc hV hv i + have hshift : Continuous (fun p : E × ℝ => fieldVaryingSquares L p.1 i + (Real.sqrt (root p.1 : ℝ) * p.2)) := + hsq.comp (continuous_fst.prodMk + (((Real.continuous_sqrt.comp (NNReal.continuous_coe.comp hr)).comp continuous_fst).mul continuous_snd)) + apply continuous_iff_continuousAt.mpr + intro t + apply tendsto_integral_filter_of_dominated_convergence (fun _ : ℝ => (1 : ℝ)) + · exact Eventually.of_forall (fun s => + (hshift.comp (continuous_const.prodMk continuous_id)).measurable.aestronglyMeasurable) + · exact Eventually.of_forall (fun s => ae_of_all _ (fun u => by + have h := (fieldVaryingSquares_regular L hL s i).2 (Real.sqrt (root s : ℝ) * u) + rw [Real.norm_eq_abs, abs_of_nonneg h.1] + exact h.2)) + · exact integrable_const _ + · exact ae_of_all _ (fun u => + (hshift.comp (continuous_id.prodMk continuous_const)).continuousAt) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingRecursion.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..d205a291eddb9a7195e04a37428a936f3c3659fa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingRecursion.lean @@ -0,0 +1,158 @@ +import OAI.Probability.InvariantIsing.Fields.FieldGaussianContinuity +import OAI.Probability.InvariantIsing.Fields.FieldCapEstimate +import OAI.Probability.InvariantIsing.Fields.FieldScalarChain + +namespace OAI + +/-! Fixed finite cascade exponents with varying nonnegative scalar +variances. These are the actual log-cosh recursion and spin observables. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldVaryingValue {E : Type*} (L : List (ℝ × (E → ℝ≥0))) (t : E) : ℝ → ℝ := + L.foldr (fun av F => gaussianOperator av.1 (av.2 t) F) (fun z => Real.log (Real.cosh z)) + +def fieldVaryingMean {E : Type*} : List (ℝ × (E → ℝ≥0)) → E → ℝ → ℝ + | [], _ => Real.tanh + | av :: L, t => fieldSpinTransition av.1 (av.2 t) (fieldVaryingValue L t) + (fieldVaryingMean L t) + +def fieldVaryingSquares {E : Type*} : (L : List (ℝ × (E → ℝ≥0))) → E → + Fin (L.length + 1) → ℝ → ℝ + | [], _ => fun _ z => (Real.tanh z) ^ 2 + | av :: L, t => Fin.cons (fun z => (fieldVaryingMean (av :: L) t z) ^ 2) + (fun i => fieldSpinTransition av.1 (av.2 t) (fieldVaryingValue L t) + (fieldVaryingSquares L t i)) + +lemma fieldVaryingValue_eq_scalar {E : Type*} (L : List (ℝ × (E → ℝ≥0))) (t : E) : + fieldVaryingValue L t = fieldScalarValue (L.map (fun av => (av.1, av.2 t))) + (fun z => Real.log (Real.cosh z)) := by + simp only [fieldVaryingValue, fieldScalarValue, List.foldr_map] + +lemma fieldVaryingMean_eq_scalar {E : Type*} (L : List (ℝ × (E → ℝ≥0))) (t : E) : + fieldVaryingMean L t = fieldScalarMean (L.map (fun av => (av.1, av.2 t))) + (fun z => Real.log (Real.cosh z)) Real.tanh := by + induction L with + | nil => rfl + | cons av L ih => + simp only [fieldVaryingMean, List.map_cons, fieldScalarMean, + fieldVaryingValue_eq_scalar, ih] + +lemma fieldVaryingSquares_eq_scalar {E : Type*} (L : List (ℝ × (E → ℝ≥0))) + (t : E) (i : Fin (L.length + 1)) : + fieldVaryingSquares L t i = fieldScalarSquares (L.map (fun av => (av.1, av.2 t))) + (fun z => Real.log (Real.cosh z)) Real.tanh (Fin.cast (by simp) i) := by + induction L with + | nil => rfl + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · simp only [fieldVaryingSquares, Fin.cons_zero, Fin.cast_zero] + funext z + rw [fieldScalarSquares_zero, fieldVaryingMean_eq_scalar] + · change fieldSpinTransition av.1 (av.2 t) (fieldVaryingValue L t) + (fieldVaryingSquares L t j) = + fieldSpinTransition av.1 (av.2 t) + (fieldScalarValue (L.map (fun bv => (bv.1, bv.2 t))) + (fun z => Real.log (Real.cosh z))) + (fieldScalarSquares (L.map (fun bv => (bv.1, bv.2 t))) + (fun z => Real.log (Real.cosh z)) Real.tanh (Fin.cast (by simp) j)) + rw [fieldVaryingValue_eq_scalar, ih] + +lemma fieldVaryingValue_regular {E : Type*} (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (t : E) : + Measurable (fieldVaryingValue L t) ∧ HasLinearGrowth (fieldVaryingValue L t) := by + rw [fieldVaryingValue_eq_scalar] + apply fieldScalarValue_regular _ _ measurable_logCosh logCosh_linearGrowth + intro av hav + obtain ⟨bv, hbv, rfl⟩ := List.mem_map.mp hav + exact hL bv hbv + +lemma fieldVaryingMean_regular {E : Type*} (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (t : E) : + Measurable (fieldVaryingMean L t) ∧ ∀ z, |fieldVaryingMean L t z| ≤ 1 := by + rw [fieldVaryingMean_eq_scalar] + apply fieldScalarMean_regular (a := Real.tanh) _ _ measurable_logCosh logCosh_linearGrowth + (by change Measurable (fun z : ℝ => Real.tanh z); simp only [Real.tanh_eq]; fun_prop) + field_abs_tanh_le_one + intro av hav + obtain ⟨bv, hbv, rfl⟩ := List.mem_map.mp hav + exact hL bv hbv + +lemma fieldVaryingSquares_regular {E : Type*} (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (t : E) (i : Fin (L.length + 1)) : + Measurable (fieldVaryingSquares L t i) ∧ + ∀ z, fieldVaryingSquares L t i z ∈ Set.Icc (0 : ℝ) 1 := by + rw [fieldVaryingSquares_eq_scalar] + apply fieldScalarSquares_regular (a := Real.tanh) _ _ measurable_logCosh logCosh_linearGrowth + (by change Measurable (fun z : ℝ => Real.tanh z); simp only [Real.tanh_eq]; fun_prop) + field_abs_tanh_le_one + intro av hav + obtain ⟨bv, hbv, rfl⟩ := List.mem_map.mp hav + exact hL bv hbv + +lemma fieldVaryingValue_nonneg {E : Type*} (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) (t : E) (z : ℝ) : + 0 ≤ fieldVaryingValue L t z := by + induction L generalizing z with + | nil => exact Real.log_nonneg (Real.one_le_cosh z) + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hr := fieldVaryingValue_regular L ht t + have hg : HasLinearGrowth (fun _ : ℝ => (0 : ℝ)) := by + refine ⟨0, 0, le_rfl, le_rfl, ?_⟩ + simp + have hm := gaussianOperator_mono measurable_const hr.1 hg hr.2 + (fun y => ih ht y) (hL av List.mem_cons_self).le (av.2 t) z + simpa only [fieldVaryingValue, List.foldr_cons, gaussianOperator, ite_self, + mul_zero, Real.exp_zero, integral_const, measureReal_def, measure_univ, + ENNReal.toReal_one, one_smul, Real.log_one, mul_zero] using hm + +def fieldVaryingCap {E : Type*} (L : List (ℝ × (E → ℝ≥0))) (V : ℝ) : ℝ := + (L.map (fun av => av.1 * V / 2 + Real.log 2 / av.1)).sum + +lemma fieldVaryingValue_bound {E : Type*} (L : List (ℝ × (E → ℝ≥0))) + (hL : ∀ av ∈ L, 0 < av.1) {V : ℝ} (hV : 0 ≤ V) + (hv : ∀ av ∈ L, ∀ t, (av.2 t : ℝ) ≤ V) : + 0 ≤ fieldVaryingCap L V ∧ + ∀ t z, |fieldVaryingValue L t z| ≤ fieldVaryingCap L V + |z| := by + induction L with + | nil => + refine ⟨le_rfl, fun t z => ?_⟩ + simpa only [fieldVaryingValue, fieldVaryingCap, List.map_nil, List.sum_nil, + List.foldr_nil, zero_add] using abs_log_cosh_le z + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hvt := fun bv hb t => hv bv (List.mem_cons_of_mem av hb) t + obtain ⟨hc, hb⟩ := ih ht hvt + have ha := hL av List.mem_cons_self + have hav := hv av List.mem_cons_self + have hcap : 0 ≤ fieldVaryingCap (av :: L) V := by + change 0 ≤ (av.1 * V / 2 + Real.log 2 / av.1) + fieldVaryingCap L V + positivity + refine ⟨hcap, fun t z => ?_⟩ + have hr := fieldVaryingValue_regular L ht t + have hg := linearGrowth_const_add abs_linearGrowth (fieldVaryingCap L V) + have hm := gaussianOperator_mono (G := fun y : ℝ => fieldVaryingCap L V + |y|) + hr.1 (by fun_prop) + hr.2 hg (fun y => (le_abs_self _).trans (hb t y)) ha.le (av.2 t) z + rw [gaussianOperator_const_add (F := fun y : ℝ => |y|) + (by fun_prop) abs_linearGrowth] at hm + have habs : gaussianOperator av.1 (av.2 t) (fun y : ℝ => |y|) z ≤ + |z| + av.1 * (av.2 t : ℝ) / 2 + Real.log 2 / av.1 := by + rw [gaussianOperator_eq_transform] + exact gaussianTransform_abs_bound (av.2 t).coe_nonneg ha z + rw [abs_of_nonneg (fieldVaryingValue_nonneg (av :: L) hL t z)] + change gaussianOperator av.1 (av.2 t) (fieldVaryingValue L t) z ≤ _ + have hvar := mul_le_mul_of_nonneg_left (hav t) ha.le + change _ ≤ (av.1 * V / 2 + Real.log 2 / av.1) + fieldVaryingCap L V + |z| + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldVectorPairSampling.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldVectorPairSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d2fc9ff360ab0e0928b1889828a5c5231babb0a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldVectorPairSampling.lean @@ -0,0 +1,139 @@ +import OAI.Probability.InvariantIsing.Fields.FieldVectorSampling +import OAI.Probability.InvariantIsing.Fields.FieldScalarSampling +import OAI.Probability.InvariantIsing.Fields.FieldCommonDepthLaw + +namespace OAI + +/-! Evaluation of the common-prefix vector Ising spin pair law, with the +actual cascade depth distribution and its independent root Gaussian. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldVectorPairSpinKernel (N : ℕ) : (L : List (ℝ × ℝ≥0)) → + (∀ av ∈ L, 0 < av.1) → Fin (L.length + 1) → Kernel (Fin N → ℝ) (Spin N × Spin N) + | [], _, _ => fieldVectorSpinKernel N ×ₖ fieldVectorSpinKernel N + | av :: L, hL, i => + let ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + Fin.cases (fieldVectorTailSpinKernel N (av :: L) hL ×ₖ + fieldVectorTailSpinKernel N (av :: L) hL) + (fun j => fieldVectorPairSpinKernel N L ht j ∘ₖ + fieldVectorTransitionKernel N av.1 av.2 + (fieldScalarValue L (fun z => Real.log (Real.cosh z))) hreg.1) i + +instance fieldVectorPairSpinKernel_markov (N : ℕ) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) : + IsMarkovKernel (fieldVectorPairSpinKernel N L hL i) := by + induction L with + | nil => change IsMarkovKernel (fieldVectorSpinKernel N ×ₖ fieldVectorSpinKernel N); infer_instance + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · change IsMarkovKernel (fieldVectorTailSpinKernel N (av :: L) hL ×ₖ + fieldVectorTailSpinKernel N (av :: L) hL) + infer_instance + · have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let _ := ih ht j + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +theorem fieldVectorPairSpinKernel_coordinate_mean (N : ℕ) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) (z : Fin N → ℝ) (j : Fin N) : + (∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) ∂fieldVectorPairSpinKernel N L hL i z) = + fieldScalarSquares L (fun u => Real.log (Real.cosh u)) Real.tanh i (z j) := by + induction L generalizing z with + | nil => + change (∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) + ∂(fieldVectorSpinKernel N ×ₖ fieldVectorSpinKernel N) z) = _ + rw [Kernel.prod_apply, integral_prod_mul (fun σ : Spin N => spinValue (σ j)) + (fun σ : Spin N => spinValue (σ j))] + change (∫ σ, spinValue (σ j) ∂gibbsProbability + (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z)) * + (∫ σ, spinValue (σ j) ∂gibbsProbability + (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z)) = _ + rw [fieldSpinGibbs_coordinate_mean] + simp [fieldScalarSquares, pow_two] + | cons av L ih => + refine Fin.cases ?_ (fun k => ?_) i + · change (∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) + ∂(fieldVectorTailSpinKernel N (av :: L) hL ×ₖ + fieldVectorTailSpinKernel N (av :: L) hL) z) = _ + rw [Kernel.prod_apply, integral_prod_mul (fun σ : Spin N => spinValue (σ j)) + (fun σ : Spin N => spinValue (σ j)), + fieldVectorTailSpinKernel_coordinate_mean, + fieldScalarSquares_zero, pow_two] + · have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hsq := fieldScalarSquares_regular L ht measurable_logCosh logCosh_linearGrowth + (by change Measurable (fun x : ℝ => Real.tanh x); simp only [Real.tanh_eq]; fun_prop) + field_abs_tanh_le_one k + change (∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) + ∂(fieldVectorPairSpinKernel N L ht k ∘ₖ + fieldVectorTransitionKernel N av.1 av.2 + (fieldScalarValue L (fun u => Real.log (Real.cosh u))) hreg.1) z) = _ + rw [Kernel.integral_comp (Integrable.of_finite)] + simp_rw [ih ht] + exact fieldVectorTransitionKernel_coordinate av.1 av.2 _ hreg.1 hreg.2 _ hsq.1 z j + +def fieldVectorLevelSpinPair (N : ℕ) (h : FieldStep) (i : Fin (h.depth + 1)) : + Measure (Spin N × Spin N) := + fieldVectorPairSpinKernel N (scalarFieldIncrements h) (scalarFieldIncrements_positive h) + (Fin.cast (by rw [scalarFieldIncrements_length]) i) ∘ₘ + (vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ)) + +instance fieldVectorLevelSpinPair_probability (N : ℕ) (h : FieldStep) (i : Fin (h.depth + 1)) : + IsProbabilityMeasure (fieldVectorLevelSpinPair N h i) := by + unfold fieldVectorLevelSpinPair + infer_instance + +theorem fieldVectorLevelSpinPair_coordinate_mean (N : ℕ) (h : FieldStep) + (i : Fin (h.depth + 1)) (j : Fin N) : + (∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) ∂fieldVectorLevelSpinPair N h i) = + fieldMagnetizationLevel h i := by + unfold fieldVectorLevelSpinPair + rw [Measure.comp_eq_comp_const_apply, Kernel.integral_comp (Integrable.of_finite)] + simp only [Kernel.const_apply, fieldVectorPairSpinKernel_coordinate_mean] + let i' : Fin ((scalarFieldIncrements h).length + 1) := + Fin.cast (by rw [scalarFieldIncrements_length]) i + have hs := fieldScalarSquares_regular (scalarFieldIncrements h) + (scalarFieldIncrements_positive h) measurable_logCosh logCosh_linearGrowth + (by change Measurable (fun x : ℝ => Real.tanh x); simp only [Real.tanh_eq]; fun_prop) + field_abs_tanh_le_one i' + change (∫ z : Fin N → ℝ, + fieldScalarSquares (scalarFieldIncrements h) (fun u => Real.log (Real.cosh u)) Real.tanh i' + (z j) ∂Measure.pi (fun _ => gaussianReal 0 (NNReal.mk (h.height 0) (h.nonneg 0)))) = _ + rw [integral_comp_eval hs.1.aestronglyMeasurable] + rfl + +theorem fieldVectorLevelSpinPair_cascade_test (N : ℕ) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + (∫ α, ∫ σ, Φ (q (fieldCommonLevel h α)) * (spinValue (σ.1 j) * spinValue (σ.2 j)) + ∂fieldVectorLevelSpinPair N h (fieldCommonLevel h α) + ∂cascadeReplicaLaw h.depth (chainExponent h.cut)) = + ∫ s, Φ (q (fieldLevelIndex h s)) * fieldMagnetizationPath h s ∂pathMeasure := by + simp_rw [integral_const_mul, fieldVectorLevelSpinPair_coordinate_mean] + rw [fieldCommonLevel_integral h (fun i => Φ (q i) * fieldMagnetizationLevel h i)] + rfl + +theorem fieldVectorLevelSpinPair_centered_test (N : ℕ) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + (∫ α, ∫ σ, Φ (q (fieldCommonLevel h α)) * + (spinValue (σ.1 j) * spinValue (σ.2 j) - q (fieldCommonLevel h α)) + ∂fieldVectorLevelSpinPair N h (fieldCommonLevel h α) + ∂cascadeReplicaLaw h.depth (chainExponent h.cut)) = + ∫ s, Φ (q (fieldLevelIndex h s)) * + (fieldMagnetizationPath h s - q (fieldLevelIndex h s)) ∂pathMeasure := by + simp_rw [integral_const_mul, + integral_sub Integrable.of_finite (integrable_const _), + fieldVectorLevelSpinPair_coordinate_mean, integral_const, probReal_univ, one_smul] + rw [fieldCommonLevel_integral h (fun i => Φ (q i) * (fieldMagnetizationLevel h i - q i))] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldVectorSampling.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldVectorSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..c512192652151059ceb85c0d23bd4faede25f7d5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldVectorSampling.lean @@ -0,0 +1,121 @@ +import OAI.Probability.InvariantIsing.Fields.FieldGaussianProduct +import OAI.Probability.InvariantIsing.Fields.FieldSpinProduct + +namespace OAI + +/-! Actual vector spin sampling for independent scalar cavity fields. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators NNReal + +namespace InvariantIsing + +private lemma measurable_field_product {N : ℕ} (κ : Kernel ℝ ℝ) [IsMarkovKernel κ] : + Measurable (fun z : Fin N → ℝ => Measure.pi (fun i => κ (z i))) := by + apply Measure.measurable_of_measurable_coe + intro s hs + refine MeasurableSpace.induction_on_inter + (C := fun s _ => Measurable (fun z : Fin N → ℝ => (Measure.pi (fun i => κ (z i))) s)) + _root_.generateFrom_pi.symm isPiSystem_pi ?_ ?_ ?_ ?_ s hs + · simp only [measure_empty] + exact measurable_const + · rintro s ⟨t, ht, rfl⟩ + simp only [Measure.pi_pi] + exact Finset.measurable_prod _ fun i _ => + (κ.measurable_coe (ht i (mem_univ _))).comp (measurable_pi_apply i) + · intro s hs ih + have he (z : Fin N → ℝ) : (Measure.pi (fun i => κ (z i))) sᶜ = + 1 - (Measure.pi (fun i => κ (z i))) s := by + rw [measure_compl hs (measure_ne_top _ _), measure_univ] + simp_rw [he] + exact measurable_const.sub ih + · intro s hd hs ih + have he (z : Fin N → ℝ) : (Measure.pi (fun i => κ (z i))) (⋃ n, s n) = + ∑' n, (Measure.pi (fun i => κ (z i))) (s n) := measure_iUnion hd hs + simp_rw [he] + exact Measurable.tsum ih + +def fieldVectorTransitionKernel (N : ℕ) (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) : Kernel (Fin N → ℝ) (Fin N → ℝ) := + ⟨fun z => Measure.pi (fun i => fieldTransitionKernel ζ v F hF (z i)), + measurable_field_product _⟩ + +instance fieldVectorTransitionKernel_markov (N : ℕ) (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) : + IsMarkovKernel (fieldVectorTransitionKernel N ζ v F hF) := + ⟨fun _ => inferInstanceAs (IsProbabilityMeasure (Measure.pi _))⟩ + +lemma fieldVectorTransitionKernel_eq_tilted {N : ℕ} (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + fieldVectorTransitionKernel N ζ v F hF z = + (Measure.pi (fun i => gaussianReal (z i) v)).tilted (fun y => ζ * ∑ i, F (y i)) := + (fieldGaussian_product_tilt ζ v F hF hG z).symm + +lemma fieldVectorTransitionKernel_coordinate {N : ℕ} (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (a : ℝ → ℝ) (ha : Measurable a) (z : Fin N → ℝ) (j : Fin N) : + (∫ y, a (y j) ∂fieldVectorTransitionKernel N ζ v F hF z) = + fieldSpinTransition ζ v F a (z j) := by + change (∫ y, a (y j) ∂Measure.pi (fun i => fieldTransitionKernel ζ v F hF (z i))) = _ + rw [integral_comp_eval ha.aestronglyMeasurable] + exact fieldTransitionKernel_integral ζ v F hF hG a (z j) + +def fieldVectorSpinKernel (N : ℕ) : Kernel (Fin N → ℝ) (Spin N) := + ⟨fun z => gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fieldEnergy z), + measurable_gibbsProbability (ν := fun _ : Fin N → ℝ => + (uniformSpinPrior N : Measure (Spin N))) + (H := fun p : (Fin N → ℝ) × Spin N => fieldEnergy p.1 p.2) + measurable_const (by unfold fieldEnergy; fun_prop)⟩ + +instance fieldVectorSpinKernel_markov (N : ℕ) : IsMarkovKernel (fieldVectorSpinKernel N) := by + constructor + intro z + change IsProbabilityMeasure (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) + (fieldEnergy z)) + infer_instance + +def fieldVectorTailSpinKernel (N : ℕ) : (L : List (ℝ × ℝ≥0)) → + (∀ av ∈ L, 0 < av.1) → Kernel (Fin N → ℝ) (Spin N) + | [], _ => fieldVectorSpinKernel N + | av :: L, hL => + let ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + fieldVectorTailSpinKernel N L ht ∘ₖ + fieldVectorTransitionKernel N av.1 av.2 + (fieldScalarValue L (fun z => Real.log (Real.cosh z))) hreg.1 + +instance fieldVectorTailSpinKernel_markov (N : ℕ) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : IsMarkovKernel (fieldVectorTailSpinKernel N L hL) := by + induction L with + | nil => exact fieldVectorSpinKernel_markov N + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let _ := ih ht + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +theorem fieldVectorTailSpinKernel_coordinate_mean (N : ℕ) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : Fin N → ℝ) (j : Fin N) : + (∫ σ, spinValue (σ j) ∂fieldVectorTailSpinKernel N L hL z) = + fieldScalarMean L (fun u => Real.log (Real.cosh u)) Real.tanh (z j) := by + induction L generalizing z with + | nil => exact fieldSpinGibbs_coordinate_mean z j + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hreg := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hmean := fieldScalarMean_regular L ht measurable_logCosh logCosh_linearGrowth + (by change Measurable (fun x : ℝ => Real.tanh x); simp only [Real.tanh_eq]; fun_prop) + field_abs_tanh_le_one + change (∫ σ, spinValue (σ j) ∂(fieldVectorTailSpinKernel N L ht ∘ₖ + fieldVectorTransitionKernel N av.1 av.2 + (fieldScalarValue L (fun u => Real.log (Real.cosh u))) hreg.1) z) = _ + rw [Kernel.integral_comp (Integrable.of_finite)] + simp_rw [ih ht] + exact fieldVectorTransitionKernel_coordinate av.1 av.2 _ hreg.1 hreg.2 _ hmean.1 z j + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldWasserstein.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldWasserstein.lean new file mode 100644 index 0000000000000000000000000000000000000000..e277a83b2adf4f6cc0d8560e666fd8ee94c25ad5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldWasserstein.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldExtension +import Mathlib.MeasureTheory.Measure.Prod + +namespace OAI + +/-! First-moment transport is the infimum of the costs of joint laws. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal +namespace InvariantIsing + +structure FieldLawCoupling (μ ν : ProbabilityMeasure ℝ) where + law : ProbabilityMeasure (ℝ × ℝ) + fst : (law : Measure (ℝ × ℝ)).map Prod.fst=(μ : Measure ℝ) + snd : (law : Measure (ℝ × ℝ)).map Prod.snd=(ν : Measure ℝ) + +namespace FieldLawCoupling + +variable {μ ν : ProbabilityMeasure ℝ} + +def cost (p : FieldLawCoupling μ ν) : ℝ≥0∞ := + ∫⁻ xy, ENNReal.ofReal |xy.1-xy.2| ∂(p.law : Measure (ℝ × ℝ)) + +lemma integrable_fst (p : FieldLawCoupling μ ν) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) : + Integrable (fun xy : ℝ × ℝ => xy.1) (p.law : Measure (ℝ × ℝ)) := by + rw [← p.fst] at hμ + exact (integrable_map_measure (by fun_prop) measurable_fst.aemeasurable).mp hμ + +lemma integrable_snd (p : FieldLawCoupling μ ν) + (hν : Integrable (fun x : ℝ => x) (ν : Measure ℝ)) : + Integrable (fun xy : ℝ × ℝ => xy.2) (p.law : Measure (ℝ × ℝ)) := by + rw [← p.snd] at hν + exact (integrable_map_measure (by fun_prop) measurable_snd.aemeasurable).mp hν + +lemma cost_eq_ofReal (p : FieldLawCoupling μ ν) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) + (hν : Integrable (fun x : ℝ => x) (ν : Measure ℝ)) : + p.cost=ENNReal.ofReal (∫ xy, |xy.1-xy.2| ∂(p.law : Measure (ℝ × ℝ))) := by + symm + exact ofReal_integral_eq_lintegral_ofReal + ((p.integrable_fst hμ).sub (p.integrable_snd hν)).abs (ae_of_all _ (fun _ => abs_nonneg _)) + +end FieldLawCoupling + +def fieldWassersteinOne (μ ν : ProbabilityMeasure ℝ) : ℝ≥0∞ := + ⨅ p : FieldLawCoupling μ ν, p.cost + +lemma exists_fieldLawCoupling_cost_lt {μ ν : ProbabilityMeasure ℝ} {ε : ℝ≥0∞} + (h : fieldWassersteinOne μ ν < ε) : + ∃ p : FieldLawCoupling μ ν, p.cost < ε := + (iInf_lt_iff).mp h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/FieldZeroIncrement.lean b/lean/OAI/Probability/InvariantIsing/Fields/FieldZeroIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..4515f52245d8e4aaa4735005f153fca02e75c2a1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/FieldZeroIncrement.lean @@ -0,0 +1,96 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarComposition + +namespace OAI + +/-! Inserting a zero covariance increment preserves the scalar Ising +value and spin mean. Its adjacent overlap levels are the same. -/ + +noncomputable section +open IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma fieldScalarValue_insert_zero (P S : List (ℝ × ℝ≥0)) (a : ℝ) (F : ℝ → ℝ) : + fieldScalarValue (P ++ (a, 0) :: S) F = fieldScalarValue (P ++ S) F := by + rw [fieldScalarValue_append, fieldScalarValue_append] + change fieldScalarValue P (gaussianOperator a 0 (fieldScalarValue S F)) = _ + rw [gaussianOperator_zero_variance] + +lemma fieldScalarMean_insert_zero (P S : List (ℝ × ℝ≥0)) (a : ℝ) (F b : ℝ → ℝ) : + fieldScalarMean (P ++ (a, 0) :: S) F b = fieldScalarMean (P ++ S) F b := by + rw [fieldScalarMean_append, fieldScalarMean_append] + change fieldScalarMean P (gaussianOperator a 0 (fieldScalarValue S F)) + (fieldSpinTransition a 0 (fieldScalarValue S F) (fieldScalarMean S F b)) = _ + rw [gaussianOperator_zero_variance] + have hs : fieldSpinTransition a 0 (fieldScalarValue S F) (fieldScalarMean S F b) = + fieldScalarMean S F b := funext (fieldSpinTransition_zero_variance _ _ _) + rw [hs] + +/-- The natural-index form of a scalar square. All indices used by the +finite field are at most the length; the terminal extension avoids casts +in zero-increment insertion. -/ +def fieldScalarSquareAt : List (ℝ × ℝ≥0) → (ℝ → ℝ) → (ℝ → ℝ) → ℕ → ℝ → ℝ + | [], _, b, _ => fun z => (b z) ^ 2 + | av :: L, F, b, 0 => fun z => (fieldScalarMean (av :: L) F b z) ^ 2 + | av :: L, F, b, i + 1 => + fieldSpinTransition av.1 av.2 (fieldScalarValue L F) (fieldScalarSquareAt L F b i) + +lemma fieldScalarSquareAt_eq (L : List (ℝ × ℝ≥0)) (F b : ℝ → ℝ) + (i : Fin (L.length + 1)) : + fieldScalarSquareAt L F b i.val = fieldScalarSquares L F b i := by + induction L with + | nil => rfl + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · rfl + · change fieldSpinTransition av.1 av.2 (fieldScalarValue L F) + (fieldScalarSquareAt L F b j.val) = _ + rw [ih] + rfl + +lemma fieldScalarSquareAt_insert_zero (P S : List (ℝ × ℝ≥0)) + (a : ℝ) (F b : ℝ → ℝ) (i : ℕ) : + fieldScalarSquareAt (P ++ (a, 0) :: S) F b i = + fieldScalarSquareAt (P ++ S) F b (if i ≤ P.length then i else i - 1) := by + induction P generalizing i with + | nil => + cases i with + | zero => + simp only [List.nil_append, List.length_nil, le_refl, ite_true, + fieldScalarSquareAt, fieldScalarMean] + have hs : fieldSpinTransition a 0 (fieldScalarValue S F) (fieldScalarMean S F b) = + fieldScalarMean S F b := funext (fieldSpinTransition_zero_variance _ _ _) + rw [hs] + cases S <;> rfl + | succ i => + simp only [List.nil_append, List.length_nil, + Nat.add_sub_cancel, fieldScalarSquareAt] + exact funext (fieldSpinTransition_zero_variance _ _ _) + | cons av P ih => + cases i with + | zero => + simp only [Nat.zero_le, ite_true, List.cons_append, fieldScalarSquareAt] + have he := fieldScalarMean_insert_zero (av :: P) S a F b + simpa only [List.cons_append] using congrArg (fun f : ℝ → ℝ => fun z => f z ^ 2) he + | succ i => + have hv := fieldScalarValue_insert_zero P S a F + simp only [List.cons_append, List.length_cons, Nat.succ_le_succ_iff] + by_cases hi : i ≤ P.length + · simp only [hi, ite_true, fieldScalarSquareAt] + rw [hv, ih, ite_eq_left hi] + · have hp : 0 < i := by omega + simp only [hi, ite_false, fieldScalarSquareAt] + have he : i + 1 - 1 = (i - 1) + 1 := by omega + rw [he] + change fieldSpinTransition av.1 av.2 (fieldScalarValue (P ++ (a, 0) :: S) F) + (fieldScalarSquareAt (P ++ (a, 0) :: S) F b i) = + fieldSpinTransition av.1 av.2 (fieldScalarValue (P ++ S) F) + (fieldScalarSquareAt (P ++ S) F b (i - 1)) + rw [hv, ih, ite_eq_right hi] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/LabeledAncestrySampling.lean b/lean/OAI/Probability/InvariantIsing/Fields/LabeledAncestrySampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b70b383852f9b075cce6a8289d95175a08ba927 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/LabeledAncestrySampling.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Fields.LabeledScaledAncestry + +namespace OAI + +/-! Almost-sure ancestry preservation on the labeled sampling space. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped ENNReal +namespace InvariantIsing +variable {A S : Type} [MeasurableSpace A] [MeasurableSpace S] + +lemma labeled_ancestry_preserved_ae (n : ℕ) (b : ℕ → ℝ) + (ν : Measure (MarkForest A n)) [IsProbabilityMeasure ν] + (c : ℕ → S × A → ℝ) (u : ℕ → S × A → S) + (hc : ∀ i, Measurable (c i)) (hu : ∀ i, Measurable (u i)) + (hcne : ∀ i p, c i p ≠ 0) (s : S) : + ∀ᵐ p ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod ν, + ∀ v w : LabeledLeaf n, labeledLeafWeight n p.1 v ≠ 0 → labeledLeafWeight n p.1 w ≠ 0 → + noiseLeafCommonDepth n + (noiseLeafKeep n c u s (labeledNoiseLeaf A n p v)) + (noiseLeafKeep n c u s (labeledNoiseLeaf A n p w)) = labeledCommonDepth n v w := by + rw [ae_all_iff] + intro v + rw [ae_all_iff] + intro w + have hm (a : LabeledLeaf n) : Measurable (fun p : LabeledTree n × MarkForest A n => + noiseLeafKeep n c u s (labeledNoiseLeaf A n p a)) := + (measurable_noiseLeafKeep n hc hu).comp + (measurable_const.prodMk (measurable_labeledNoiseLeaf A n a)) + have he : MeasurableSet {p : LabeledTree n × MarkForest A n | + noiseLeafCommonDepth n (noiseLeafKeep n c u s (labeledNoiseLeaf A n p v)) + (noiseLeafKeep n c u s (labeledNoiseLeaf A n p w)) = labeledCommonDepth n v w} := + measurableSet_eq_fun ((measurable_noiseLeafCommonDepth n).comp ((hm v).prodMk (hm w))) measurable_const + have hs : MeasurableSet {p : LabeledTree n × MarkForest A n | + labeledLeafWeight n p.1 v ≠ 0 → labeledLeafWeight n p.1 w ≠ 0 → + noiseLeafCommonDepth n (noiseLeafKeep n c u s (labeledNoiseLeaf A n p v)) + (noiseLeafKeep n c u s (labeledNoiseLeaf A n p w)) = labeledCommonDepth n v w} := + (measurableSet_eq_fun ((measurable_labeledLeafWeight n v).comp measurable_fst) measurable_const).compl.imp + ((measurableSet_eq_fun ((measurable_labeledLeafWeight n w).comp measurable_fst) measurable_const).compl.imp he) + apply (Measure.ae_prod_iff_ae_ae hs).mpr + apply (Measure.ae_ae_comm hs).mpr + exact ae_of_all _ fun z => (labeledCascade_scaled_simple_ae n b c u hcne s z).mono + (fun ω hω hv hw => noiseLeafCommonDepth_keep_labeled n c u s ω z hω v w hv hw) + +lemma labeledLeafLaw_positive_weight (n : ℕ) (ω : LabeledTree n) + (hω : 0 < rawTreeTotal n (labeledTreeForget n ω) ∧ rawTreeTotal n (labeledTreeForget n ω) < ∞) : + ∀ᵐ v ∂labeledLeafLaw n ω, labeledLeafWeight n ω v ≠ 0 := by + rw [labeledLeafLaw, normalizeMass, ite_eq_left (by simpa only [labeledLeafMass_univ] using hω)] + apply Measure.ae_smul_measure + rw [ae_iff] + have hz : {v : LabeledLeaf n | ¬labeledLeafWeight n ω v ≠ 0} = + {v : LabeledLeaf n | labeledLeafWeight n ω v = 0} := by ext v; simp + rw [hz,labeledLeafMass,withDensity_apply _ (Set.to_countable _).measurableSet] + apply setLIntegral_eq_zero (Set.to_countable _).measurableSet + intro v hv + exact hv + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/LabeledReplicaAncestry.lean b/lean/OAI/Probability/InvariantIsing/Fields/LabeledReplicaAncestry.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cd009687be928b8ec7a0214a1ce4f6aa0cf8e68 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/LabeledReplicaAncestry.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Fields.LabeledAncestrySampling + +namespace OAI + +/-! Ancestry preservation under any absolutely continuous labeled Gibbs sampling. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +lemma gibbsProbability_absolutelyContinuous {X : Type} [MeasurableSpace X] + (ν : Measure X) (H : X → ℝ) : gibbsProbability ν H ≪ ν := by + unfold gibbsProbability + split_ifs + · exact Measure.AbsolutelyContinuous.rfl + · exact tilted_absolutelyContinuous _ _ + +lemma labeledCascade_total_ae (n : ℕ) (b : ℕ → ℝ) (hb : CascadeExponents n b) : + ∀ᵐ ω ∂(labeledCascadeLaw n b : Measure (LabeledTree n)), + 0 < rawTreeTotal n (labeledTreeForget n ω) ∧ rawTreeTotal n (labeledTreeForget n ω) < ⊤ := by + have h : MeasurePreserving (labeledTreeForget n) (labeledCascadeLaw n b : Measure (LabeledTree n)) + (rawCascadeLaw n b : Measure (RawTree n)) := + ⟨measurable_labeledTreeForget n,labeledCascadeLaw_forget n b⟩ + exact h.quasiMeasurePreserving.tendsto_ae.eventually (rawCascade_total_moments n b hb).1 + +theorem labeled_sampled_ancestry_ae {A S : Type} [MeasurableSpace A] [MeasurableSpace S] + (n : ℕ) (b : ℕ → ℝ) (hb : CascadeExponents n b) + (M : Measure (MarkForest A n)) [IsProbabilityMeasure M] + (c : ℕ → S × A → ℝ) (u : ℕ → S × A → S) + (hc : ∀ i, Measurable (c i)) (hu : ∀ i, Measurable (u i)) + (hcne : ∀ i p, c i p ≠ 0) (s : S) + (ν : LabeledTree n × MarkForest A n → Measure (LabeledLeaf n)) + (hν : Measurable ν) [∀ p, IsProbabilityMeasure (ν p)] + (habs : ∀ p, ν p ≪ labeledLeafLaw n p.1) : + ∀ᵐ q ∂(((labeledCascadeLaw n b : Measure (LabeledTree n)).prod M) ⊗ₘ + probabilityReplicaKernel ν hν), + noiseLeafCommonDepth n + (noiseLeafKeep n c u s (labeledNoiseLeaf A n q.1 (q.2 0))) + (noiseLeafKeep n c u s (labeledNoiseLeaf A n q.1 (q.2 1))) = + labeledCommonDepth n (q.2 0) (q.2 1) := by + have hm : Measurable (fun p : (LabeledTree n × MarkForest A n) × LabeledLeaf n => + noiseLeafKeep n c u s (labeledNoiseLeaf A n p.1 p.2)) := by + apply measurable_from_prod_countable_left + intro v + exact (measurable_noiseLeafKeep n hc hu).comp + (measurable_const.prodMk (measurable_labeledNoiseLeaf A n v)) + have hp (i : ℕ) : Measurable (fun q : (LabeledTree n × MarkForest A n) × (ℕ → LabeledLeaf n) => + (q.1,q.2 i)) := measurable_fst.prodMk ((measurable_pi_apply i).comp measurable_snd) + have hdepth : Measurable (fun p : LabeledLeaf n × LabeledLeaf n => + labeledCommonDepth n p.1 p.2) := measurable_of_countable _ + apply Measure.ae_compProd_of_ae_ae + (measurableSet_eq_fun ((measurable_noiseLeafCommonDepth n).comp + ((hm.comp (hp 0)).prodMk (hm.comp (hp 1)))) + (hdepth.comp (((measurable_pi_apply 0).comp measurable_snd).prodMk + ((measurable_pi_apply 1).comp measurable_snd)))) + have htotal := (measurePreserving_fst (μ := (labeledCascadeLaw n b : Measure (LabeledTree n))) + (ν := M)).quasiMeasurePreserving.tendsto_ae.eventually (labeledCascade_total_ae n b hb) + filter_upwards [labeled_ancestry_preserved_ae n b M c u hc hu hcne s,htotal] with p hpath htotal + have hpos := (habs p).ae_le (labeledLeafLaw_positive_weight n p.1 htotal) + have h0 := (measurePreserving_eval_infinitePi (fun _ : ℕ => ν p) 0).quasiMeasurePreserving.tendsto_ae.eventually hpos + have h1 := (measurePreserving_eval_infinitePi (fun _ : ℕ => ν p) 1).quasiMeasurePreserving.tendsto_ae.eventually hpos + filter_upwards [h0,h1] with σ hσ0 hσ1 + exact hpath (σ 0) (σ 1) hσ0 hσ1 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/LabeledScaledAncestry.lean b/lean/OAI/Probability/InvariantIsing/Fields/LabeledScaledAncestry.lean new file mode 100644 index 0000000000000000000000000000000000000000..29d59737987316d7ceba366bf737a799060c9000 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/LabeledScaledAncestry.lean @@ -0,0 +1,92 @@ +import OAI.Probability.InvariantIsing.Fields.PoissonLabeledWeights +import OAI.Probability.InvariantIsing.Fields.NoiseLeafAncestry + +namespace OAI + +/-! Positive ancestor-dependent reweighting preserves the sampled branch labels. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped ENNReal +namespace InvariantIsing +variable {A S : Type} [MeasurableSpace A] + +def ScaledLabelSimple : (n : ℕ) → (ℕ → S × A → ℝ) → (ℕ → S × A → S) → + S → LabeledTree n → MarkForest A n → Prop + | 0, _, _, _, _, _ => True + | n+1, c, u, s, ω, z => + (∀ a b : ChildLabel, a.2 < (ω.1 a.1).1 → b.2 < (ω.1 b.1).1 → + c 0 (s,(z a.1 a.2).1) * (ω.1 a.1).2 a.2 = + c 0 (s,(z b.1 b.2).1) * (ω.1 b.1).2 b.2 → a = b) ∧ + ∀ a : ChildLabel, ScaledLabelSimple n (fun j => c (j+1)) (fun j => u (j+1)) + (u 0 (s,(z a.1 a.2).1)) (ω.2 a.1 a.2) (z a.1 a.2).2 + +lemma labeledCascade_scaled_simple_ae (n : ℕ) (b : ℕ → ℝ) + (c : ℕ → S × A → ℝ) (u : ℕ → S × A → S) + (hc : ∀ i p, c i p ≠ 0) (s : S) (z : MarkForest A n) : + ∀ᵐ ω ∂(labeledCascadeLaw n b : Measure (LabeledTree n)), ScaledLabelSimple n c u s ω z := by + induction n generalizing b c u s with + | zero => exact ae_of_all _ (fun _ => trivial) + | succ n ih => + let bs := fun i => b (i+1) + let Q : Measure (ℕ → ℕ → LabeledTree n) := Measure.infinitePi fun _ : ℕ => + Measure.infinitePi fun _ : ℕ => (labeledCascadeLaw n bs : Measure (LabeledTree n)) + have hchildren : ∀ᵐ ω ∂Q, ∀ a : ChildLabel, + ScaledLabelSimple n (fun j => c (j+1)) (fun j => u (j+1)) + (u 0 (s,(z a.1 a.2).1)) (ω a.1 a.2) (z a.1 a.2).2 := by + rw [ae_all_iff] + intro a + have hp := (measurePreserving_eval_infinitePi + (fun _ : ℕ => (labeledCascadeLaw n bs : Measure (LabeledTree n))) a.2).comp + (measurePreserving_eval_infinitePi + (fun _ : ℕ => Measure.infinitePi fun _ : ℕ => + (labeledCascadeLaw n bs : Measure (LabeledTree n))) a.1) + exact hp.quasiMeasurePreserving.tendsto_ae.eventually + (ih bs _ _ (fun i p => hc (i+1) p) _ (z a.1 a.2).2) + have hroot := labeledPoisson_scaled_distinct (intensityComponents (powerIntensity (b 0))) + (fun a : ChildLabel => c 0 (s,(z a.1 a.2).1)) (fun a => hc 0 _) + have hfst := (measurePreserving_fst + (μ := labeledPoissonLaw (intensityComponents (powerIntensity (b 0)))) (ν := Q)).quasiMeasurePreserving.tendsto_ae.eventually hroot + have hsnd := (measurePreserving_snd + (μ := labeledPoissonLaw (intensityComponents (powerIntensity (b 0)))) (ν := Q)).quasiMeasurePreserving.tendsto_ae.eventually hchildren + filter_upwards [hfst,hsnd] with ω hω hω' + exact ⟨hω,hω'⟩ + +lemma labeledLeafWeight_active {n : ℕ} (ω : LabeledTree (n+1)) + (v : LabeledLeaf (n+1)) (hv : labeledLeafWeight (n+1) ω v ≠ 0) : + v.1.2 < (ω.1 v.1.1).1 := by + by_contra h + exact hv (by simp [labeledLeafWeight,childLabelWeight,h]) + +lemma noiseLeafCommonDepth_keep_labeled (n : ℕ) (c : ℕ → S × A → ℝ) + (u : ℕ → S × A → S) (s : S) (ω : LabeledTree n) (z : MarkForest A n) + (hω : ScaledLabelSimple n c u s ω z) + (v w : LabeledLeaf n) (hv : labeledLeafWeight n ω v ≠ 0) + (hw : labeledLeafWeight n ω w ≠ 0) : + noiseLeafCommonDepth n + (noiseLeafKeep n c u s (labeledNoiseLeaf A n (ω,z) v)) + (noiseLeafKeep n c u s (labeledNoiseLeaf A n (ω,z) w)) = labeledCommonDepth n v w := by + induction n generalizing c u s with + | zero => rfl + | succ n ih => + rcases v with ⟨a,v⟩ + rcases w with ⟨a',w⟩ + have hva := labeledLeafWeight_active ω (a,v) hv + have hwa := labeledLeafWeight_active ω (a',w) hw + have hvt : labeledLeafWeight n (ω.2 a.1 a.2) v ≠ 0 := (mul_ne_zero_iff.mp hv).2 + have hwt : labeledLeafWeight n (ω.2 a'.1 a'.2) w ≠ 0 := (mul_ne_zero_iff.mp hw).2 + by_cases he : a = a' + · subst a' + simp only [noiseLeafKeep,labeledNoiseLeaf,noiseLeafCommonDepth,labeledCommonDepth,ite_true] + rw [ih _ _ _ _ _ (hω.2 a) v w hvt hwt, Nat.add_comm] + · have hne : c 0 (s,(z a.1 a.2).1) * (ω.1 a.1).2 a.2 ≠ + c 0 (s,(z a'.1 a'.2).1) * (ω.1 a'.1).2 a'.2 := + fun hh => he (hω.1 a a' hva hwa hh) + simp only [noiseLeafKeep,labeledNoiseLeaf,noiseLeafCommonDepth,labeledCommonDepth, + ite_eq_right he] + exact ite_eq_right hne + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/MarkEndpointIntegral.lean b/lean/OAI/Probability/InvariantIsing/Fields/MarkEndpointIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce942a85219d3d248f2579c530cf98cf7e6d8dd0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/MarkEndpointIntegral.lean @@ -0,0 +1,120 @@ +import OAI.Probability.InvariantIsing.Fields.MarkEndpointKernel + +namespace OAI + +/-! Bounded endpoint observables of independent and shared ancestor paths. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing +variable {N : ℕ} + +def markPairEndpoint (n : ℕ) (z₁ z₂ : Fin N → ℝ) + (w : Fin n → (Fin N → ℝ) × (Fin N → ℝ)) := + (z₁ + ∑ i, (w i).1, z₂ + ∑ i, (w i).2) + +lemma measurable_markPairEndpoint (n : ℕ) (z₁ z₂ : Fin N → ℝ) : + Measurable (markPairEndpoint n z₁ z₂) := by + exact (measurable_const.add (Finset.measurable_sum _ fun i _ => + (measurable_pi_apply i).fst)).prodMk + (measurable_const.add (Finset.measurable_sum _ fun i _ => (measurable_pi_apply i).snd)) + +lemma markPairEndpoint_cons (n : ℕ) (z₁ z₂ a₁ a₂ : Fin N → ℝ) + (w : Fin n → (Fin N → ℝ) × (Fin N → ℝ)) : + markPairEndpoint (n+1) z₁ z₂ (Fin.cons (a₁,a₂) w) = + markPairEndpoint n (z₁+a₁) (z₂+a₂) w := by + simp only [markPairEndpoint,Fin.sum_univ_succ,Fin.cons_zero,Fin.cons_succ,add_assoc] + +lemma integral_markStateKernel (κ : Kernel (Fin N → ℝ) (Fin N → ℝ)) + [IsMarkovKernel κ] (z : Fin N → ℝ) (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) : + (∫ y, F y ∂markStateKernel κ z) = ∫ a, F (z+a) ∂κ z := by + rw [markStateKernel_apply] + exact integral_map (show AEMeasurable (fun a : Fin N → ℝ => z+a) (κ z) from + (measurable_const.add measurable_id).aemeasurable) hF.aestronglyMeasurable + +lemma integral_markStateParallel (κ : Kernel (Fin N → ℝ) (Fin N → ℝ)) + [IsMarkovKernel κ] (z₁ z₂ : Fin N → ℝ) + (F : (Fin N → ℝ) × (Fin N → ℝ) → ℝ) (hF : Measurable F) + {C : ℝ} (hB : ∀ y, |F y| ≤ C) : + (∫ y, F y ∂(markStateKernel κ ∥ₖ markStateKernel κ) (z₁,z₂)) = + ∫ a₁, ∫ a₂, F (z₁+a₁,z₂+a₂) ∂κ z₂ ∂κ z₁ := by + have h₁ : MeasurePreserving (fun a : Fin N → ℝ => z₁+a) (κ z₁) (markStateKernel κ z₁) := + ⟨measurable_const.add measurable_id,(markStateKernel_apply κ z₁).symm⟩ + have h₂ : MeasurePreserving (fun a : Fin N → ℝ => z₂+a) (κ z₂) (markStateKernel κ z₂) := + ⟨measurable_const.add measurable_id,(markStateKernel_apply κ z₂).symm⟩ + rw [Kernel.parallelComp_apply] + rw [← (h₁.prod h₂).hasLaw.integral_comp hF.aestronglyMeasurable] + apply integral_prod + exact Integrable.of_bound (hF.comp ((measurable_const.add measurable_fst).prodMk + (measurable_const.add measurable_snd))).aestronglyMeasurable C + (ae_of_all _ fun p => by + simpa only [Real.norm_eq_abs,Function.comp_apply] using + hB (Prod.map (fun a => z₁+a) (fun a => z₂+a) p)) + +theorem markPairPathMean_independent_endpoint (n : ℕ) + (κ : ℕ → Kernel (Fin N → ℝ) (Fin N → ℝ)) [∀ i, IsMarkovKernel (κ i)] + (z₁ z₂ : Fin N → ℝ) (F : (Fin N → ℝ) × (Fin N → ℝ) → ℝ) + (hF : Measurable F) {C : ℝ} (hB : ∀ y, |F y| ≤ C) : + markPairPathMean n κ 0 z₁ z₂ (fun w => F (markPairEndpoint n z₁ z₂ w)) = + ∫ y, F y ∂(markTailEndpointKernel n κ ∥ₖ markTailEndpointKernel n κ) (z₁,z₂) := by + induction n generalizing κ z₁ z₂ with + | zero => simp [markPairPathMean,markPairEndpoint,markTailEndpointKernel,Kernel.id_apply] + | succ n ih => + let η := markTailEndpointKernel n (fun i => κ (i+1)) + have hI : Integrable F (((η ∥ₖ η) ∘ₖ + (markStateKernel (κ 0) ∥ₖ markStateKernel (κ 0))) (z₁,z₂)) := + Integrable.of_bound hF.aestronglyMeasurable C + (ae_of_all _ fun p => by simpa only [Real.norm_eq_abs] using hB p) + have hH : Measurable (fun p => ∫ y, F y ∂(η ∥ₖ η) p) := + hF.stronglyMeasurable.integral_kernel.measurable + have hHB : ∀ p, |∫ y, F y ∂(η ∥ₖ η) p| ≤ C := by + intro p + simpa only [Real.norm_eq_abs,Measure.real,measure_univ,ENNReal.toReal_one,mul_one] using + (norm_integral_le_of_norm_le_const (f := F) (C := C) (μ := (η ∥ₖ η) p) + (ae_of_all _ fun y => by simpa only [Real.norm_eq_abs] using hB y)) + rw [markTailEndpointKernel,← Kernel.parallelComp_comp_parallelComp, + Kernel.integral_comp hI,integral_markStateParallel (κ 0) z₁ z₂ _ hH hHB] + simp only [markPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro a₁ + apply integral_congr_ae + apply ae_of_all + intro a₂ + simp only [markPairEndpoint_cons] + exact ih (fun i => κ (i+1)) (z₁+a₁) (z₂+a₂) + +theorem markPairPathMean_shared_endpoint (n : ℕ) + (κ : ℕ → Kernel (Fin N → ℝ) (Fin N → ℝ)) [∀ i, IsMarkovKernel (κ i)] + (d : Fin (n+1)) (z : Fin N → ℝ) (F : (Fin N → ℝ) × (Fin N → ℝ) → ℝ) + (hF : Measurable F) {C : ℝ} (hB : ∀ y, |F y| ≤ C) : + markPairPathMean n κ d.val z z (fun w => F (markPairEndpoint n z z w)) = + ∫ y, F y ∂markPairEndpointKernel n κ d z := by + induction n generalizing κ z with + | zero => simp [markPairPathMean,markPairEndpoint,markPairEndpointKernel, + Kernel.prod_apply,Kernel.id_apply,Measure.dirac_prod_dirac] + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) d + · simpa only [Fin.val_zero,markPairEndpointKernel,Fin.cases_zero,Kernel.prod_apply, + Kernel.parallelComp_apply] using + markPairPathMean_independent_endpoint (n+1) κ z z F hF hB + · let η := markPairEndpointKernel n (fun i => κ (i+1)) j + have hI : Integrable F ((η ∘ₖ markStateKernel (κ 0)) z) := + Integrable.of_bound hF.aestronglyMeasurable C + (ae_of_all _ fun p => by simpa only [Real.norm_eq_abs] using hB p) + have hH : Measurable (fun p => ∫ y, F y ∂η p) := + hF.stronglyMeasurable.integral_kernel.measurable + simp only [markPairEndpointKernel,Fin.cases_succ,Fin.val_succ] + rw [Kernel.integral_comp hI,integral_markStateKernel (κ 0) z _ hH] + simp only [markPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro a + simp only [markPairEndpoint_cons] + exact ih (fun i => κ (i+1)) j (z+a) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/MarkEndpointKernel.lean b/lean/OAI/Probability/InvariantIsing/Fields/MarkEndpointKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..24114955bde9573a6f644f459e245b80a1f64921 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/MarkEndpointKernel.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Fields.MarkPairRecursion +import Mathlib.Probability.Kernel.Composition.KernelLemmas +import Mathlib.Probability.Kernel.Composition.IntegralCompProd + +namespace OAI + +/-! Endpoint kernels of the finite ancestor-dependent increment chain. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing +variable {N : ℕ} + +def markStateKernel (κ : Kernel (Fin N → ℝ) (Fin N → ℝ)) : + Kernel (Fin N → ℝ) (Fin N → ℝ) := + (Kernel.id ×ₖ κ).map (fun p => p.1+p.2) + +instance markStateKernel_markov (κ : Kernel (Fin N → ℝ) (Fin N → ℝ)) + [IsMarkovKernel κ] : IsMarkovKernel (markStateKernel κ) := by + unfold markStateKernel + exact Kernel.IsMarkovKernel.map _ (measurable_fst.add measurable_snd) + +lemma markStateKernel_apply (κ : Kernel (Fin N → ℝ) (Fin N → ℝ)) + [IsMarkovKernel κ] (z : Fin N → ℝ) : + markStateKernel κ z = (κ z).map (fun a => z+a) := by + rw [markStateKernel,Kernel.map_apply _ (show Measurable (fun p : (Fin N → ℝ) × (Fin N → ℝ) => p.1+p.2) from + measurable_fst.add measurable_snd), Kernel.prod_apply,Kernel.id_apply,Measure.dirac_prod] + rw [Measure.map_map (show Measurable (fun p : (Fin N → ℝ) × (Fin N → ℝ) => p.1+p.2) from + measurable_fst.add measurable_snd) measurable_prodMk_left] + rfl + +def markTailEndpointKernel : ℕ → (ℕ → Kernel (Fin N → ℝ) (Fin N → ℝ)) → + Kernel (Fin N → ℝ) (Fin N → ℝ) + | 0, _ => Kernel.id + | n+1, κ => markTailEndpointKernel n (fun i => κ (i+1)) ∘ₖ markStateKernel (κ 0) + +instance markTailEndpointKernel_markov (n : ℕ) + (κ : ℕ → Kernel (Fin N → ℝ) (Fin N → ℝ)) [∀ i, IsMarkovKernel (κ i)] : + IsMarkovKernel (markTailEndpointKernel n κ) := by + induction n generalizing κ with + | zero => exact inferInstanceAs (IsMarkovKernel Kernel.id) + | succ n ih => + let := ih (fun i => κ (i+1)) + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +def markPairEndpointKernel : (n : ℕ) → (ℕ → Kernel (Fin N → ℝ) (Fin N → ℝ)) → + Fin (n+1) → Kernel (Fin N → ℝ) ((Fin N → ℝ) × (Fin N → ℝ)) + | 0, _, _ => Kernel.id ×ₖ Kernel.id + | n+1, κ, d => Fin.cases (markTailEndpointKernel (n+1) κ ×ₖ markTailEndpointKernel (n+1) κ) + (fun j => markPairEndpointKernel n (fun i => κ (i+1)) j ∘ₖ markStateKernel (κ 0)) d + +instance markPairEndpointKernel_markov (n : ℕ) + (κ : ℕ → Kernel (Fin N → ℝ) (Fin N → ℝ)) [∀ i, IsMarkovKernel (κ i)] + (d : Fin (n+1)) : IsMarkovKernel (markPairEndpointKernel n κ d) := by + induction n generalizing κ with + | zero => exact inferInstanceAs (IsMarkovKernel (Kernel.id ×ₖ Kernel.id)) + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) d + · change IsMarkovKernel (_ ×ₖ _) + infer_instance + · let := ih (fun i => κ (i+1)) j + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/MarkForestRootLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/MarkForestRootLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf82e0eeb793c5193dbbf688faded5c04942cfe6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/MarkForestRootLaw.lean @@ -0,0 +1,39 @@ +import OAI.Probability.IsingPerceptron.ChildLabel + +namespace OAI + +/-! The one-branch and two-distinct-branch laws of the finite independent mark forest. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {A : Type} [MeasurableSpace A] + +lemma markForestRoot_preserving (n : ℕ) (μ : ℕ → ProbabilityMeasure A) (a : ChildLabel) : + MeasurePreserving (fun z : MarkForest A (n+1) => z a.1 a.2) + (markForestLaw A (n+1) μ : Measure (MarkForest A (n+1))) + ((μ 0 : Measure A).prod (markForestLaw A n (fun i => μ (i+1)) : Measure (MarkForest A n))) := by + let Q := (μ 0 : Measure A).prod (markForestLaw A n (fun i => μ (i+1)) : Measure (MarkForest A n)) + exact (measurePreserving_eval_infinitePi (fun _ : ℕ => Q) a.2).comp + (measurePreserving_eval_infinitePi (fun _ : ℕ => Measure.infinitePi (fun _ : ℕ => Q)) a.1) + +lemma markForestRoots_preserving (n : ℕ) (μ : ℕ → ProbabilityMeasure A) + (a b : ChildLabel) (hab : a ≠ b) : + MeasurePreserving (fun z : MarkForest A (n+1) => (z a.1 a.2,z b.1 b.2)) + (markForestLaw A (n+1) μ : Measure (MarkForest A (n+1))) + (((μ 0 : Measure A).prod (markForestLaw A n (fun i => μ (i+1)) : Measure (MarkForest A n))).prod + ((μ 0 : Measure A).prod (markForestLaw A n (fun i => μ (i+1)) : Measure (MarkForest A n)))) := by + let Q := (μ 0 : Measure A).prod (markForestLaw A n (fun i => μ (i+1)) : Measure (MarkForest A n)) + have hf : MeasurePreserving (fun z : MarkForest A (n+1) => fun p : ChildLabel => z p.1 p.2) + (markForestLaw A (n+1) μ : Measure (MarkForest A (n+1))) + (Measure.infinitePi fun _ : ChildLabel => Q) := + ⟨by fun_prop, Measure.infinitePi_map_curry_symm (fun (_ _ : ℕ) => Q)⟩ + have hp : MeasurePreserving (fun z : ChildLabel → A × MarkForest A n => (z a,z b)) + (Measure.infinitePi fun _ : ChildLabel => Q) (Q.prod Q) := + ⟨by fun_prop, Measure.infinitePi_map_eval_prod hab⟩ + exact hp.comp hf + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/MarkPairRecursion.lean b/lean/OAI/Probability/InvariantIsing/Fields/MarkPairRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..32947571e7236cb13db9e67670adad36a51f3a4a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/MarkPairRecursion.lean @@ -0,0 +1,26 @@ +import OAI.Probability.InvariantIsing.Fields.SeedPairRecursion + +namespace OAI + +/-! The finite conditional-mark recursion needed by the tensor and scalar terminals. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +def markPairPathMean : (n : ℕ) → (ℕ → Kernel (ι → ℝ) (ι → ℝ)) → + ℕ → (ι → ℝ) → (ι → ℝ) → ((Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) → ℝ + | 0, _, _, _, _, F => F Fin.elim0 + | n+1, κ, 0, z₁, z₂, F => + ∫ a₁, ∫ a₂, + markPairPathMean n (fun i => κ (i+1)) 0 (z₁+a₁) (z₂+a₂) + (fun w => F (Fin.cons (a₁,a₂) w)) ∂κ 0 z₂ ∂κ 0 z₁ + | n+1, κ, d+1, z₁, z₂, F => + ∫ a, markPairPathMean n (fun i => κ (i+1)) d (z₁+a) (z₂+a) + (fun w => F (Fin.cons (a,a) w)) ∂κ 0 z₁ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/NoiseLeafAncestry.lean b/lean/OAI/Probability/InvariantIsing/Fields/NoiseLeafAncestry.lean new file mode 100644 index 0000000000000000000000000000000000000000..13485e4b8ca3f8b4bc78899633e1c832915dddfa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/NoiseLeafAncestry.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Fields.CascadeSeedLeaf + +namespace OAI + +/-! Shared ancestry read from the sequence of Poisson edge weights. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +def noiseLeafCommonDepth {A B : Type} : (n : ℕ) → NoiseLeaf A n → NoiseLeaf B n → ℕ + | 0, _, _ => 0 + | n+1, v, w => if v.1 = w.1 then 1 + noiseLeafCommonDepth n v.2.2 w.2.2 else 0 + +lemma measurable_noiseLeafCommonDepth {A B : Type} [MeasurableSpace A] [MeasurableSpace B] + (n : ℕ) : Measurable (fun p : NoiseLeaf A n × NoiseLeaf B n => + noiseLeafCommonDepth n p.1 p.2) := by + induction n with + | zero => exact measurable_const + | succ n ih => + exact Measurable.ite (measurableSet_eq_fun measurable_fst.fst measurable_snd.fst) + (measurable_const.add (ih.comp (measurable_fst.snd.snd.prodMk measurable_snd.snd.snd))) + measurable_const + +lemma noiseLeafCommonDepth_seed {ι : Type} (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (z w : ι → ℝ) (v v' : NoiseLeaf unitInterval n) : + noiseLeafCommonDepth n (cascadeSeedLeaf n ψ z v) (cascadeSeedLeaf n ψ w v') = + noiseLeafCommonDepth n v v' := by + induction n generalizing ψ z w with + | zero => rfl + | succ n ih => + change (if v.1 = v'.1 then 1 + noiseLeafCommonDepth n + (cascadeSeedLeaf n (fun j => ψ (j+1)) (z+ψ 0 z v.2.1) v.2.2) + (cascadeSeedLeaf n (fun j => ψ (j+1)) (w+ψ 0 w v'.2.1) v'.2.2) else 0) = _ + rw [ih] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/NoiseReplicaPairData.lean b/lean/OAI/Probability/InvariantIsing/Fields/NoiseReplicaPairData.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d82f69966a0c35befa3f4176090595c4492c1cc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/NoiseReplicaPairData.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Fields.CascadeSeedPath +import OAI.Probability.InvariantIsing.Fields.NoiseLeafAncestry + +namespace OAI + +/-! The joint branch-depth and two-mark-path observable on noise replicas. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +def noiseReplicaPairData {A : Type} (n : ℕ) (σ : ℕ → NoiseLeaf A n) : + ℕ × (Fin n → A × A) := + (noiseLeafCommonDepth n (σ 0) (σ 1),fun i => (noiseLeafMark n (σ 0) i,noiseLeafMark n (σ 1) i)) + +lemma measurable_noiseReplicaPairData {A : Type} [MeasurableSpace A] (n : ℕ) : + Measurable (noiseReplicaPairData (A := A) n) := by + change Measurable (fun σ : ℕ → NoiseLeaf A n => + (noiseLeafCommonDepth n (σ 0) (σ 1), + fun i => (noiseLeafMark n (σ 0) i,noiseLeafMark n (σ 1) i))) + apply Measurable.prodMk + · have hp : Measurable (fun σ : ℕ → NoiseLeaf A n => (σ 0,σ 1)) := + (measurable_pi_apply 0).prodMk (measurable_pi_apply 1) + exact (measurable_noiseLeafCommonDepth (A := A) (B := A) n).comp hp + · exact Measurable.of_eval fun i => + ((measurable_noiseLeafMark n i).comp (measurable_pi_apply 0)).prodMk + ((measurable_noiseLeafMark n i).comp (measurable_pi_apply 1)) + +lemma noiseReplicaPairData_keep_labeled {A S : Type} [MeasurableSpace A] + (n : ℕ) (c : ℕ → S × A → ℝ) (u : ℕ → S × A → S) (s : S) + (T : LabeledTree n) (g : ForestVertex n → A) (σ : ℕ → LabeledLeaf n) + (hdepth : noiseLeafCommonDepth n + (noiseLeafKeep n c u s (labeledNoiseLeaf A n (T,markForestOfCoords A n g) (σ 0))) + (noiseLeafKeep n c u s (labeledNoiseLeaf A n (T,markForestOfCoords A n g) (σ 1))) = + labeledCommonDepth n (σ 0) (σ 1)) : + noiseReplicaPairData n (fun i => noiseLeafKeep n c u s + (labeledNoiseLeaf A n (T,markForestOfCoords A n g) (σ i))) = + (labeledCommonDepth n (σ 0) (σ 1),fun i => (g (edgeAt n (σ 0) i),g (edgeAt n (σ 1) i))) := by + apply Prod.ext hdepth + funext i + simp only [noiseReplicaPairData,noiseLeafMark_keep,noiseLeafMark_labeled] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldComparison.lean b/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..2df922402fc0478864364073eb6a35ee2d2e94cb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldComparison.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Fields.PhysicalFieldPermutation +import OAI.Probability.InvariantIsing.Core.FiniteFieldMatchingBound +import OAI.Probability.InvariantIsing.Pressure.GroundStateMean + +namespace OAI + +/-! Field populations with nearby label proportions have nearby Haar-mean pressures. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma abs_rotatedPressure_fields_le {N : ℕ} (eig c d : Fin N → ℝ) (U : Rotation N) : + |rotatedPressure eig U c-rotatedPressure eig U d| ≤ + (N : ℝ)⁻¹*∑ i, |c i-d i| := by + have hh := abs_logPartition_sub_le + (fun σ => rotatedEnergy eig U σ+fieldEnergy c σ) + (fun σ => rotatedEnergy eig U σ+fieldEnergy d σ) + (∑ i, |c i-d i|) (fun σ => by + simpa only [add_sub_add_left_eq_sub] using abs_fieldEnergy_sub_le c d σ) + have hni : (0 : ℝ)≤(N : ℝ)⁻¹ := inv_nonneg.mpr (Nat.cast_nonneg N) + simpa only [rotatedPressure,← mul_sub,abs_mul,abs_of_nonneg hni] using + mul_le_mul_of_nonneg_left hh hni + +lemma physical_mean_field_l1_le {N : ℕ} (hN : 0 rotatedPressure eig (matrixRotation U⁻¹) c-rotatedPressure eig (matrixRotation U⁻¹) d) + (C := (N : ℝ)⁻¹*∑ i, |c i-d i|) + (ae_of_all _ fun U => by simpa only [Real.norm_eq_abs] using abs_rotatedPressure_fields_le eig c d (matrixRotation U⁻¹)) + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hh + +lemma physical_mean_field_counts_le {N : ℕ} (hN : 0 b (g i)) ∂μ)- + ∫ U, rotatedPressure eig (matrixRotation U⁻¹) (fun i => b (h i)) ∂μ| ≤ + 2*B*∑ a, |(spinGroupSize g a : ℝ)/N-(spinGroupSize h a : ℝ)/N| := by + obtain ⟨p,hp⟩ := exists_field_permutation_l1_bound g h b hB hb + rw [← physical_meanPressure_field_permutation μ p eig (fun i => b (h i))] + refine (physical_mean_field_l1_le hN μ eig _ _).trans + ((mul_le_mul_of_nonneg_left hp (inv_nonneg.mpr (Nat.cast_nonneg N))).trans_eq ?_) + have hnz : (0 : ℝ) false) σ)= + matrixRotation (fieldSitePermutation p) (spinVector σ) := by + ext i + change spinValue (σ (p i))=((p.permMatrix ℝ)*ᵥ (spinVector σ).ofLp) i + rw [Matrix.permMatrix_mulVec] + rfl + +lemma rotatedPressure_fieldSitePermutation {N : ℕ} (p : Equiv.Perm (Fin N)) + (eig c : Fin N → ℝ) (U : Orthogonal N) : + rotatedPressure eig (matrixRotation (U*(fieldSitePermutation p)⁻¹)) (fun i => c (p i))= + rotatedPressure eig (matrixRotation U) c := by + let e := cavitySignedSpinPermutation p (fun _ => false) + have he (σ : Spin N) : + rotatedEnergy eig (matrixRotation (U*(fieldSitePermutation p)⁻¹)) (e σ)= + rotatedEnergy eig (matrixRotation U) σ := by + have hv : matrixRotation (U*(fieldSitePermutation p)⁻¹) (spinVector (e σ))= + matrixRotation U (spinVector σ) := by + rw [spinVector_fieldSitePermutation, ← cavity_matrixRotation_mul_apply] + simp only [inv_mul_cancel_right] + simp only [rotatedEnergy,hv] + have hc (σ : Spin N) : fieldEnergy (fun i => c (p i)) (e σ)=fieldEnergy c σ := by + change (∑ i, c (p i)*spinValue (σ (p i)))=∑ i, c i*spinValue (σ i) + exact Equiv.sum_comp p (fun i => c i*spinValue (σ i)) + let H := fun σ => Real.exp (rotatedEnergy eig (matrixRotation (U*(fieldSitePermutation p)⁻¹)) σ+ + fieldEnergy (fun i => c (p i)) σ) + have hh : (∑ σ, H σ)=∑ σ, Real.exp (rotatedEnergy eig (matrixRotation U) σ+fieldEnergy c σ) := by + rw [← Equiv.sum_comp e H] + apply Finset.sum_congr rfl + intro σ _ + dsimp only [H] + rw [he,hc] + exact congrArg (fun x => (N : ℝ)⁻¹*Real.log ((Fintype.card (Spin N) : ℝ)⁻¹*x)) hh + +lemma physical_meanPressure_field_permutation {N : ℕ} + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (p : Equiv.Perm (Fin N)) (eig c : Fin N → ℝ) : + (∫ V, rotatedPressure eig (matrixRotation V⁻¹) (fun i => c (p i)) ∂μ)= + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂μ := by + let : μ.IsMulLeftInvariant := cavity_right_probability_left μ + rw [← integral_mul_left_eq_self + (fun V => rotatedPressure eig (matrixRotation V⁻¹) (fun i => c (p i))) + (fieldSitePermutation p)] + apply integral_congr_ae + filter_upwards [] with V + simp only [mul_inv_rev] + exact rotatedPressure_fieldSitePermutation p eig c V⁻¹ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldPopulationComparison.lean b/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldPopulationComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..550b669701094afdf4de4c07f14fc83ae77af09e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldPopulationComparison.lean @@ -0,0 +1,35 @@ +import OAI.Probability.InvariantIsing.Fields.PhysicalFieldPopulationLimit + +namespace OAI + +/-! Different limiting field populations give a quantitative comparison +of the physical mean pressures. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem physical_mean_field_population_comparison {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ j, 0 < N j) + (μ : (j : ℕ) → Measure (Orthogonal (N j))) [∀ j, IsProbabilityMeasure (μ j)] + [∀ j, (μ j).IsMulRightInvariant] (eig : (j : ℕ) → Fin (N j) → ℝ) + (g h : (j : ℕ) → Fin (N j) → A) (γ δ b : A → ℝ) + (hg : Tendsto (fun j a => (spinGroupSize (g j) a : ℝ)/N j) atTop (𝓝 γ)) + (hh : Tendsto (fun j a => (spinGroupSize (h j) a : ℝ)/N j) atTop (𝓝 δ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) : + ∀ ε > 0, ∀ᶠ j in atTop, + |(∫ U, rotatedPressure (eig j) (matrixRotation U⁻¹) (fun i => b (g j i)) ∂μ j)- + ∫ U, rotatedPressure (eig j) (matrixRotation U⁻¹) (fun i => b (h j i)) ∂μ j| ≤ + 2*D*(∑ a, |γ a-δ a|)+ε := by + have he a := (((tendsto_pi_nhds.mp hg) a).sub ((tendsto_pi_nhds.mp hh) a)).abs + have hs := (tendsto_finsetSum Finset.univ (fun a _ => he a)).const_mul (2*D) + intro ε hε + have hsmall := hs.eventually (Iio_mem_nhds (lt_add_of_pos_right _ hε)) + filter_upwards [hsmall] with j hj + exact (physical_mean_field_counts_le (hN j) (μ j) (eig j) (g j) (h j) b hD hb).trans hj.le + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldPopulationLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldPopulationLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ead50c676f93fe4a8be25c997ce6933324f63cbe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PhysicalFieldPopulationLimit.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Fields.PhysicalFieldComparison +import OAI.Probability.InvariantIsing.Cavity.CavityMultiplicityTransport + +namespace OAI + +/-! Continuity of physical mean pressure under matching limiting finite +spectral and field populations. Zero limiting field weights are allowed. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem physical_mean_field_populations_tendsto {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ j, 0 (spinGroupSize (g j) a : ℝ)/N j) atTop (𝓝 γ)) + (hh : Tendsto (fun j a => (spinGroupSize (h j) a : ℝ)/N j) atTop (𝓝 γ)) + {B : ℝ} (hB : 0≤B) (hb : ∀ a, |b a|≤B) : + Tendsto (fun j => (∫ U, rotatedPressure (eig j) (matrixRotation U⁻¹) (fun i => b (g j i)) ∂μ j)- + ∫ U, rotatedPressure (eig j) (matrixRotation U⁻¹) (fun i => b (h j i)) ∂μ j) + atTop (𝓝 0) := by + have he a : Tendsto (fun j => |(spinGroupSize (g j) a : ℝ)/N j- + (spinGroupSize (h j) a : ℝ)/N j|) atTop (𝓝 0) := by + simpa only [sub_self,abs_zero] using + (((tendsto_pi_nhds.mp hg) a).sub ((tendsto_pi_nhds.mp hh) a)).abs + have hs := (tendsto_finsetSum Finset.univ (fun a _ => he a)).const_mul (2*B) + simp only [Finset.sum_const_zero,mul_zero] at hs + apply squeeze_zero_norm (fun j => ?_) hs + simpa only [Real.norm_eq_abs] using physical_mean_field_counts_le (hN j) (μ j) + (eig j) (g j) (h j) b hB hb + +theorem physical_mean_joint_populations_tendsto {m : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ j, 0 (spinGroupSize (e j) a : ℝ)/N j) atTop (𝓝 ρ)) + (hf : Tendsto (fun j a => (spinGroupSize (f j) a : ℝ)/N j) atTop (𝓝 ρ)) + (lam : Fin m → ℝ) {K : ℝ} (hK : 0≤K) (hlam : ∀ a, |lam a|≤K) + (g h : (j : ℕ) → Fin (N j) → A) (γ b : A → ℝ) + (hg : Tendsto (fun j a => (spinGroupSize (g j) a : ℝ)/N j) atTop (𝓝 γ)) + (hh : Tendsto (fun j a => (spinGroupSize (h j) a : ℝ)/N j) atTop (𝓝 γ)) + {B : ℝ} (hB : 0≤B) (hb : ∀ a, |b a|≤B) : + Tendsto (fun j => (∫ U, rotatedPressure (fun i => lam (f j i)) (matrixRotation U⁻¹) + (fun i => b (h j i)) ∂μ j)- + ∫ U, rotatedPressure (fun i => lam (e j i)) (matrixRotation U⁻¹) + (fun i => b (g j i)) ∂μ j) atTop (𝓝 0) := by + have hs := cavity_meanPressure_same_proportions_tendsto N hN μ e f ρ hρ he hf lam + (fun j i => b (h j i)) K hlam (2*K) (by positivity) + (fun a b => (abs_sub _ _).trans (by linarith [hlam a,hlam b])) + have ht := physical_mean_field_populations_tendsto N hN μ (fun j i => lam (e j i)) + h g γ b hh hg hB hb + have hz := hs.add ht + simp only [add_zero] at hz + convert hz using 1 + funext j + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PoissonLabeledWeights.lean b/lean/OAI/Probability/InvariantIsing/Fields/PoissonLabeledWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb8559d5f6da79bb252792e56059b8bc6005419f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PoissonLabeledWeights.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Fields.PoissonScaledWeights + +namespace OAI + +/-! Positive rescaling cannot merge active labeled Poisson points. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal ENNReal +namespace InvariantIsing + +lemma labeledPoisson_scaled_pair (μ : ℕ → FiniteMeasure ℝ) + [∀ n, NullSingletonClass (μ n : Measure ℝ)] + (a b : ChildLabel) (hab : a ≠ b) (c d : ℝ) (hd : d ≠ 0) : + ∀ᵐ ω ∂labeledPoissonLaw μ, + a.2 < (ω a.1).1 → b.2 < (ω b.1).1 → c * (ω a.1).2 a.2 ≠ d * (ω b.1).2 b.2 := by + have hev (m : ℕ) := measurePreserving_eval_infinitePi + (fun j => finitePoissonCloud (μ j).mass ((μ j).normalize : Measure ℝ)) m + by_cases ha : μ a.1 = 0 + · have hno : ∀ᵐ p : ℕ × (ℕ → ℝ) ∂finitePoissonCloud (μ a.1).mass + ((μ a.1).normalize : Measure ℝ), ¬ a.2 < p.1 := by + rw [ha] + exact finitePoissonCloud_zero_inactive a.2 + exact ((hev a.1).quasiMeasurePreserving.tendsto_ae.eventually hno).mono + (fun ω hω hactive _ => (hω hactive).elim) + by_cases hb : μ b.1 = 0 + · have hno : ∀ᵐ p : ℕ × (ℕ → ℝ) ∂finitePoissonCloud (μ b.1).mass + ((μ b.1).normalize : Measure ℝ), ¬ b.2 < p.1 := by + rw [hb] + exact finitePoissonCloud_zero_inactive b.2 + exact ((hev b.1).quasiMeasurePreserving.tendsto_ae.eventually hno).mono + (fun ω hω _ hactive => (hω hactive).elim) + by_cases hm : a.1 = b.1 + · have hij : a.2 ≠ b.2 := fun h => hab (Prod.ext hm h) + have h := finitePoissonCloud_scaled_distinct (μ a.1) ha a.2 b.2 hij c d hd + exact ((hev a.1).quasiMeasurePreserving.tendsto_ae.eventually h).mono + (fun ω hω _ _ => by simpa only [hm] using hω) + · have hp : MeasurePreserving (fun ω : WeightCloud => (ω a.1,ω b.1)) + (labeledPoissonLaw μ) + ((finitePoissonCloud (μ a.1).mass ((μ a.1).normalize : Measure ℝ)).prod + (finitePoissonCloud (μ b.1).mass ((μ b.1).normalize : Measure ℝ))) := + ⟨by fun_prop, Measure.infinitePi_map_eval_prod hm⟩ + have hq := ((finitePoissonCloud_point_law (μ a.1) a.2).prod + (finitePoissonCloud_point_law (μ b.1) b.2)).comp hp + let : NullSingletonClass ((μ b.1).normalize : Measure ℝ) := + finiteMeasure_normalize_noAtoms _ hb + exact (hq.quasiMeasurePreserving.tendsto_ae.eventually + (independent_scaled_ne _ _ c d hd)).mono (fun _ h _ _ => h) + +lemma labeledPoisson_scaled_distinct (μ : ℕ → FiniteMeasure ℝ) + [∀ n, NullSingletonClass (μ n : Measure ℝ)] + (c : ChildLabel → ℝ) (hc : ∀ a, c a ≠ 0) : + ∀ᵐ ω ∂labeledPoissonLaw μ, ∀ a b : ChildLabel, + a.2 < (ω a.1).1 → b.2 < (ω b.1).1 → + c a * (ω a.1).2 a.2 = c b * (ω b.1).2 b.2 → a = b := by + rw [ae_all_iff] + intro a + rw [ae_all_iff] + intro b + by_cases h : a = b + · exact ae_of_all _ (fun _ _ _ _ => h) + · exact (labeledPoisson_scaled_pair μ a b h (c a) (c b) (hc b)).mono + (fun _ hh ha hb he => (hh ha hb he).elim) + +instance intensityComponents_noAtoms (b : ℝ) (m : ℕ) : + NullSingletonClass (intensityComponents (powerIntensity b) m : Measure ℝ) where + measure_singleton x := by + apply le_antisymm ?_ bot_le + calc + _ ≤ powerIntensity b {x} := sfiniteSeq_le _ _ _ + _ = 0 := measure_singleton x + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PoissonScaledWeights.lean b/lean/OAI/Probability/InvariantIsing/Fields/PoissonScaledWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..ddfd1861b46b803ec4cb1fb7243d53e04ac677e2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PoissonScaledWeights.lean @@ -0,0 +1,71 @@ +import OAI.Probability.IsingPerceptron.RetainedDisplacement +import OAI.Probability.IsingPerceptron.VariationalDefs + +namespace OAI + +/-! Distinct active Poisson weights after deterministic positive rescaling. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped ENNReal NNReal +namespace InvariantIsing + +lemma independent_scaled_ne (μ ν : Measure ℝ) [IsProbabilityMeasure μ] + [IsProbabilityMeasure ν] [NullSingletonClass ν] (c d : ℝ) (hd : d ≠ 0) : + ∀ᵐ p : ℝ × ℝ ∂μ.prod ν, c * p.1 ≠ d * p.2 := by + apply (Measure.ae_prod_iff_ae_ae (measurableSet_eq_fun + (measurable_const.mul measurable_fst) (measurable_const.mul measurable_snd)).compl).mpr + refine ae_of_all _ fun x => ?_ + have h : ∀ᵐ y ∂ν, y ≠ c * x / d := by + rw [ae_iff] + convert (measure_singleton (c * x / d) : ν {c * x / d} = 0) using 1 + congr 1 + ext y + simp + filter_upwards [h] with y hy he + apply hy + exact (eq_div_iff hd).mpr (by simpa only [Pi.mul_apply, mul_comm] using he.symm) + +lemma finiteMeasure_normalize_noAtoms (μ : FiniteMeasure ℝ) + [NullSingletonClass (μ : Measure ℝ)] (hμ : μ ≠ 0) : + NullSingletonClass (μ.normalize : Measure ℝ) := by + rw [μ.toMeasure_normalize_eq_of_nonzero hμ] + constructor + intro x + simp only [Measure.smul_apply, measure_singleton, smul_zero] + +lemma finitePoissonCloud_point_law (μ : FiniteMeasure ℝ) (i : ℕ) : + MeasurePreserving (fun p : ℕ × (ℕ → ℝ) => p.2 i) + (finitePoissonCloud μ.mass (μ.normalize : Measure ℝ)) (μ.normalize : Measure ℝ) := by + exact (measurePreserving_eval_infinitePi _ i).comp + (measurePreserving_snd (μ := poissonMeasure μ.mass) + (ν := Measure.infinitePi fun _ : ℕ => (μ.normalize : Measure ℝ))) + +lemma finitePoissonCloud_zero_inactive (i : ℕ) : + ∀ᵐ p : ℕ × (ℕ → ℝ) ∂finitePoissonCloud (0 : FiniteMeasure ℝ).mass + ((0 : FiniteMeasure ℝ).normalize : Measure ℝ), ¬ i < p.1 := by + have h : ∀ᵐ n : ℕ ∂poissonMeasure (0 : FiniteMeasure ℝ).mass, n = 0 := by + simp [poissonMeasure_zero_eq_dirac] + have hm := (measurePreserving_fst (μ := poissonMeasure (0 : FiniteMeasure ℝ).mass) + (ν := Measure.infinitePi fun _ : ℕ => ((0 : FiniteMeasure ℝ).normalize : Measure ℝ))) + filter_upwards [hm.quasiMeasurePreserving.tendsto_ae.eventually h] with p hp + simp [hp] + +lemma finitePoissonCloud_scaled_distinct (μ : FiniteMeasure ℝ) + [NullSingletonClass (μ : Measure ℝ)] (hμ : μ ≠ 0) + (i j : ℕ) (hij : i ≠ j) (c d : ℝ) (hd : d ≠ 0) : + ∀ᵐ p : ℕ × (ℕ → ℝ) ∂finitePoissonCloud μ.mass (μ.normalize : Measure ℝ), + c * p.2 i ≠ d * p.2 j := by + let : NullSingletonClass (μ.normalize : Measure ℝ) := finiteMeasure_normalize_noAtoms μ hμ + have hpair : MeasurePreserving (fun g : ℕ → ℝ => (g i,g j)) + (Measure.infinitePi fun _ : ℕ => (μ.normalize : Measure ℝ)) + ((μ.normalize : Measure ℝ).prod (μ.normalize : Measure ℝ)) := + ⟨by fun_prop, Measure.infinitePi_map_eval_prod hij⟩ + exact ((hpair.comp (measurePreserving_snd (μ := poissonMeasure μ.mass) + (ν := Measure.infinitePi fun _ : ℕ => (μ.normalize : Measure ℝ)))).quasiMeasurePreserving.tendsto_ae.eventually + (independent_scaled_ne _ _ c d hd)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PositiveFieldApproximation.lean b/lean/OAI/Probability/InvariantIsing/Fields/PositiveFieldApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0899097663e3c22e1acb9bdbb46662c963612307 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PositiveFieldApproximation.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Core.PositiveRationalApproximation +import OAI.Probability.InvariantIsing.Core.FiniteFieldLabels + +namespace OAI + +/-! Positive rational approximations to arbitrary finite field populations. -/ +noncomputable section +open Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def fieldApproxDenominator {A : Type*} [Fintype A] (γ : A → ℝ) (k : ℕ) : ℕ := + ∑ a, positiveApproxCount (γ a) k + +def fieldApproxWeights {A : Type*} [Fintype A] (γ : A → ℝ) (k : ℕ) (a : A) : ℝ := + (positiveApproxCount (γ a) k : ℝ)/fieldApproxDenominator γ k + +lemma fieldApproxDenominator_pos {A : Type*} [Fintype A] (a0 : A) (γ : A → ℝ) (k : ℕ) : + 0 < fieldApproxDenominator γ k := + (positiveApproxCount_pos (γ a0) k).trans_le + (Finset.single_le_sum (f := fun a => positiveApproxCount (γ a) k) (fun _ _ => Nat.zero_le _) (Finset.mem_univ a0)) + +lemma fieldApproxWeights_pos {A : Type*} [Fintype A] (a0 : A) (γ : A → ℝ) (k : ℕ) (a : A) : + 0 < fieldApproxWeights γ k a := + div_pos (Nat.cast_pos.mpr (positiveApproxCount_pos _ _)) + (Nat.cast_pos.mpr (fieldApproxDenominator_pos a0 γ k)) + +lemma fieldApproxWeights_sum {A : Type*} [Fintype A] (a0 : A) (γ : A → ℝ) (k : ℕ) : + ∑ a, fieldApproxWeights γ k a=1 := by + simp only [fieldApproxWeights,← Finset.sum_div,← Nat.cast_sum] + exact div_self (Nat.cast_ne_zero.mpr (fieldApproxDenominator_pos a0 γ k).ne') + +lemma fieldApproxWeights_tendsto {A : Type*} [Fintype A] (γ : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hsum : ∑ a, γ a=1) : + Tendsto (fieldApproxWeights γ) atTop (𝓝 γ) := by + have hden : Tendsto (fun k => (fieldApproxDenominator γ k : ℝ)/(k+1)) atTop (𝓝 (1:ℝ)) := by + have hh := tendsto_finsetSum Finset.univ (fun a _ => positiveApproxCount_ratio (γ a) (hγ a)) + simpa only [fieldApproxDenominator,Nat.cast_sum,Finset.sum_div,hsum] using hh + apply tendsto_pi_nhds.mpr + intro a + have hh := (positiveApproxCount_ratio (γ a) (hγ a)).div hden one_ne_zero + simp only [div_one] at hh + apply hh.congr + intro k + exact div_div_div_cancel_right₀ (by positivity : (k+1 : ℝ)≠0) _ _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8f1bce6e9c82f6203c5e35655a4584900ef5032 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayDiagonal.lean @@ -0,0 +1,109 @@ +import OAI.Probability.InvariantIsing.Fields.PriorArrayLaw +import OAI.Probability.InvariantIsing.Fields.PriorKernelDiagonal + +namespace OAI + +/-! Actual spectral-array diagonals and compact centers for constrained priors. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +lemma priorNamespacedObservableAverage_mono {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (D E : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hE : Measurable (Function.uncurry E)) + {B C : ℝ} (hDb : ∀ U x, |D U x| ≤ B) (hEb : ∀ U x, |E U x| ≤ C) + (hDE : ∀ U x, D U x ≤ E U x) : + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h D ≤ + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h E := by + apply integral_mono + (priorNamespacedObservableAverage_integrable μ ν₀ eig c I degree amplitude r h D hD hDb) + (priorNamespacedObservableAverage_integrable μ ν₀ eig c I degree amplitude r h E hE hEb) + intro p + apply integral_mono + (Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable B + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using hDb p.1 x)) + (Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable C + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using hEb p.1 x)) + exact hDE p.1 + +lemma priorSpectralDiagonal_clipping {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (a : Fin m) (center : ℝ) : + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - spectralDiagonalCenter center|) ≤ + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center|) := by + exact priorNamespacedObservableAverage_mono μ ν₀ eig c I degree amplitude r h _ _ + (measurable_spectralDiagonalDeviation (I a) n _) (measurable_spectralDiagonalDeviation (I a) n _) + (fun U x => spectralDiagonalDeviation_abs_le (specialRotation U) (I a) _ x.1) + (fun U x => spectralDiagonalDeviation_abs_le (specialRotation U) (I a) _ x.1) + (fun U x => abs_sub_spectralDiagonalCenter_le + ⟨projectedOverlap_self_nonneg _ _ _, projectedOverlap_self_le_one _ _ _⟩ center) + +theorem priorNamespacedArrayLaw_observable_test {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (F : SpectralArray (m + 1) → ℝ) (hF : Continuous F) + (D : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) (i : ℕ) + (he : ∀ (U : SpecialOrthogonal N) (σ : ℕ → Spin N × LabeledLeaf n), + F (fun ij : ℕ × ℕ => spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2)) = D U (σ i)) : + (∫ x, F x ∂(priorNamespacedArrayLaw μ ν₀ eig c I degree amplitude r h : + Measure (SpectralArray (m + 1)))) = + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h D := by + rw [priorNamespacedArrayLaw, spectralArrayLaw_integral _ _ _ _ _ _ _ F hF] + unfold priorNamespacedObservableAverage + apply integral_congr_ae + filter_upwards [] with p + let ν := priorNamespacedReference ν₀ eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p + have ht := integral_map (measurable_pi_apply i).aemeasurable + (μ := Measure.infinitePi (fun _ : ℕ => ν)) (measurable_of_countable (D p.1)).aestronglyMeasurable + rw [Measure.infinitePi_map_eval] at ht + change (∫ σ, F (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation p.1) I n (σ ij.1) (σ ij.2)) + ∂Measure.infinitePi (fun _ : ℕ => ν)) = ∫ x, D p.1 x ∂ν + simp_rw [he] + exact ht.symm + +theorem priorNamespacedArrayLaw_spectralDiagonal {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (i : ℕ) (a : Fin m) (center : ℝ) : + (∫ x, |(x (i, i) a.castSucc : ℝ) - center| + ∂(priorNamespacedArrayLaw μ ν₀ eig c I degree amplitude r h : Measure (SpectralArray (m + 1)))) = + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center|) := by + apply priorNamespacedArrayLaw_observable_test μ ν₀ eig c I degree amplitude r h _ + (by fun_prop) _ i + intro U σ + rw [spectralJointEntry_spectral] + +lemma priorNamespacedArrayLaw_treeDiagonal {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (i : ℕ) : + (∫ x, |(x (i, i) (Fin.last m) : ℝ) - (n : ℝ) / (n + 1 : ℕ)| + ∂(priorNamespacedArrayLaw μ ν₀ eig c I degree amplitude r h : Measure (SpectralArray (m + 1)))) = 0 := by + calc + _ = priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h (fun _ _ => 0) := by + apply priorNamespacedArrayLaw_observable_test μ ν₀ eig c I degree amplitude r h _ + (by fun_prop) _ i + intro U σ + rw [spectralJointEntry_tree, treeOverlap_self, sub_self, abs_zero] + _ = 0 := by unfold priorNamespacedObservableAverage; simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayDiagonalWard.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayDiagonalWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..e194e8b55a049e84e15824a06d212b6f7c6613b4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayDiagonalWard.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Fields.PriorPrincipalWard +import OAI.Probability.InvariantIsing.Fields.PriorArrayLaw +import OAI.Probability.InvariantIsing.Arrays.TensorArrayDiagonalWard + +namespace OAI + +/-! Finite diagonal Ward residual for the actual constrained-prior array. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology NNReal +namespace InvariantIsing + +lemma priorNamespacedArrayLaw_diagonalWard_residual {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) + (κ : Fin m → ℝ) (a d : Fin m) + (ha : ∀ i ∈ I a, eig i = κ a) (hd : ∀ i ∈ I d, eig i = κ d) : + spectralDiagonalWardResidual (priorNamespacedArrayLaw μ ν eig c I degree amp treeDegree h) + (fun j => ((I j).card : ℝ) / N) κ a d = + priorNamespacedReplicaAverage μ ν eig c I degree amp treeDegree h + (tensorDiagonalDirect eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) - + priorNamespacedReplicaAverage μ ν eig c I degree amp treeDegree h + (tensorDiagonalFresh eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) := by + let ρ := fun j => ((I j).card : ℝ) / N + let Q := priorNamespacedArrayLaw μ ν eig c I degree amp treeDegree h + have hdir : (∫ x, spectralDiagonalWardDirect ρ κ a d x ∂(Q : Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν eig c I degree amp treeDegree h + (tensorDiagonalDirect eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) := by + apply priorNamespacedArrayLaw_test μ ν eig c I degree amp treeDegree h + _ (continuous_spectralDiagonalWardDirect ρ κ a d) _ + (fun i : Fin 1 => i.val) Fin.val_injective + intro U σ + rw [tensorDiagonalDirect_eq_block eig (I a) (I d) (κ a) (κ d) ha hd] + simp only [spectralDiagonalWardDirect, tensorDiagonalBlockDirect, spectralJointEntry_spectral, ρ, Fin.val_zero] + ring + have hfresh : (∫ x, spectralDiagonalWardFresh κ a d x ∂(Q : Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν eig c I degree amp treeDegree h + (tensorDiagonalFresh eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) := by + apply priorNamespacedArrayLaw_test μ ν eig c I degree amp treeDegree h + _ (continuous_spectralDiagonalWardFresh κ a d) _ + (fun i : Fin 2 => i.val) Fin.val_injective + intro U σ + rw [tensorDiagonalFresh_eq_block eig (I a) (I d) (κ a) (κ d) ha hd] + simp only [spectralDiagonalWardFresh, tensorDiagonalBlockFresh, spectralJointEntry_spectral, Fin.val_zero, Fin.val_one] + ring + rw [spectralDiagonalWardResidual_integral Q ρ κ a d, hdir, hfresh] + +/-- Exact finite-volume spectral-array diagonal Ward bound for the actual +tensor-enriched law, before taking any overlap limit. -/ +theorem priorNamespacedArrayLaw_diagonalWard_bound {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin N → Fin m → ℕ) (treeDegree : Fin N → ℕ) + (u : Fin N → ℝ) (hu : ∀ r, |u r| ≤ 2) (D : ℝ) (hD : 0 ≤ D) + (hdegree : ∀ r, (∑ j, (degree r j : ℝ)) ≤ D * ((r : ℝ) + 1)) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (κ : Fin m → ℝ) (a d : Fin m) (had : Disjoint (I a) (I d)) + (ha : ∀ i ∈ I a, eig i = κ a) (hd : ∀ i ∈ I d, eig i = κ d) : + |spectralDiagonalWardResidual + (priorNamespacedArrayLaw μ ν eig c I degree (tensorPerturbationAmplitude N u) treeDegree h) + (fun j => ((I j).card : ℝ) / N) κ a d| ≤ 48 * D * perturbationScale N ^ 2 := by + rw [priorNamespacedArrayLaw_diagonalWard_residual μ ν eig c I degree (tensorPerturbationAmplitude N u) + treeDegree h κ a d ha hd] + exact priorNamespaced_diagonal_principal_bound hN μ ν eig c I degree treeDegree u hu D hD hdegree + h hh h0 (I a) (I d) had + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..931933233166b6a6ea81e2ebbf21700deddbaaba --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayLaw.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Fields.PriorReplicaAverage +import OAI.Probability.InvariantIsing.Arrays.TensorArrayLaw + +namespace OAI + +/-! The actual spectral array generated by a constrained spin/leaf prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +def priorNamespacedArrayLaw {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) : + ProbabilityMeasure (SpectralArray (m + 1)) := + spectralArrayLaw (μ.prod gaussianCoordinates) + (fun p : SpecialOrthogonal N × (ℕ → ℝ) => p.1) measurable_fst I n + (priorNamespacedReference ν₀ eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i)) + (measurable_priorNamespacedReference ν₀ eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i)) + +/-- Injection into the infinite replica sequence gives the exact actual +finite-replica mean, while retaining its common rotation. -/ +theorem priorNamespacedArrayLaw_test {N m k n z : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (F : SpectralArray (m + 1) → ℝ) (hF : Continuous F) + (D : SpecialOrthogonal N → (Fin z → Spin N × LabeledLeaf n) → ℝ) + (ι : Fin z → ℕ) (hi : Function.Injective ι) + (he : ∀ (U : SpecialOrthogonal N) (σ : ℕ → Spin N × LabeledLeaf n), F (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2)) = D U (fun i => σ (ι i))) : + (∫ x, F x ∂(priorNamespacedArrayLaw μ ν₀ eig c I degree amplitude r h : + Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h D := by + rw [priorNamespacedArrayLaw, spectralArrayLaw_integral _ _ _ _ _ _ _ F hF] + unfold priorNamespacedReplicaAverage + simp only [referenceReplicaMean_zero] + apply integral_congr_ae + filter_upwards [] with p + have hm : Measurable (fun σ : ℕ → Spin N × LabeledLeaf n => fun i : Fin z => σ (ι i)) := + Measurable.of_eval fun i => measurable_pi_apply (ι i) + let ν := priorNamespacedReference ν₀ eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p + have ht := integral_map hm.aemeasurable (μ := Measure.infinitePi (fun _ : ℕ => ν)) + (measurable_of_countable (D p.1)).aestronglyMeasurable + rw [replica_injective_map ν ι hi] at ht + change (∫ σ, F (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation p.1) I n (σ ij.1) (σ ij.2)) + ∂Measure.infinitePi (fun _ : ℕ => ν)) = ∫ σ, D p.1 σ ∂Measure.pi (fun _ : Fin z => ν) + simp_rw [he] + exact ht.symm + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayResidual.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..5069c9070ed8f72bcba9e33c8df5a06e76ab7ffd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayResidual.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Fields.PriorArrayLaw +import OAI.Probability.InvariantIsing.Fields.PriorFiniteGG +import OAI.Probability.InvariantIsing.Arrays.TensorArrayResidual + +namespace OAI + +/-! Exact equality of the constrained finite-model and spectral-array GG residuals. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +/-- Common rotation is retained in every finite test; arbitrary replica +indices are handled by injective sampling, not by independence of rotations. -/ +theorem priorNamespacedArrayLaw_residual {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (e : Equiv.Perm (Fin (q + 1))) (D : SpectralBlock (m + 1) (q + 1) → ℝ) (hD : Continuous D) : + spectralMonomialResidual (priorNamespacedArrayLaw μ ν₀ eig c I degree amplitude r h) + (q + 1) (e 0) D (Fin.lastCases (r j) (degree j)) = + priorSpectralGGResidual μ ν₀ eig c I degree amplitude r h j + (permutedSpectralBlockTest I n e D) := by + classical + let L := priorNamespacedArrayLaw μ ν₀ eig c I degree amplitude r h + let d : Fin (m + 1) → ℕ := Fin.lastCases (r j) (degree j) + let D' := permutedSpectralBlockTest I n e D + let κ := spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) I (degree j) n (r j) + have hcD : Continuous (fun x => D (spectralBlockView (m + 1) (q + 1) x)) := + hD.comp (continuous_spectralBlockView _ _) + have hmono : Continuous (spectralEntryMonomial d) := continuous_spectralEntryMonomial d + have hnew : (∫ x, D (spectralBlockView (m + 1) (q + 1) x) * + spectralEntryMonomial d (x (e 0, q + 1)) ∂(L : Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h + (fun U (τ : Fin (q + 1 + 1) → Spin N × LabeledLeaf n) => + D' U (Fin.tail τ) * κ U ((Fin.tail τ) 0) (τ 0)) := by + apply priorNamespacedArrayLaw_test μ ν₀ eig c I degree amplitude r h + _ (hcD.mul (hmono.comp (continuous_apply _))) _ + (newReplicaEmbedding (q + 1) e) (newReplicaEmbedding_injective _ e) + intro U σ + simp only [Pi.mul_apply, Function.comp_apply, newReplicaEmbedding, Fin.cases_zero, Fin.cases_succ, Fin.tail] + change D (spectralBlockView (m + 1) (q + 1) (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2))) * + spectralEntryMonomial d (spectralJointEntry (specialRotation U) I n (σ (e 0)) (σ (q + 1))) = + D' U (fun i => σ (e i)) * κ U (σ (e 0)) (σ (q + 1)) + rw [show D' U (fun i => σ ((e i).val)) = + D (spectralBlockView (m + 1) (q + 1) (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2))) from + permutedSpectralBlockTest_embedding I n e D U σ] + simp only [spectralJointEntry_selectedMonomial, d, κ] + have hblock : (∫ x, D (spectralBlockView (m + 1) (q + 1) x) + ∂(L : Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h D' := by + apply priorNamespacedArrayLaw_test μ ν₀ eig c I degree amplitude r h _ hcD D' + (fun i => (e i).val) (Fin.val_injective.comp e.injective) + intro U σ + exact (permutedSpectralBlockTest_embedding I n e D U σ).symm + have hpair : (∫ x, spectralEntryMonomial d (x (0, 1)) + ∂(L : Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h + (fun U (τ : Fin 2 → Spin N × LabeledLeaf n) => κ U (τ 1) (τ 0)) := by + refine priorNamespacedArrayLaw_test μ ν₀ eig c I degree amplitude r h _ + (hmono.comp (continuous_apply _)) _ ![1, 0] ?_ ?_ + · intro a b hab + fin_cases a <;> fin_cases b <;> simp_all + · intro U σ + exact spectralJointEntry_selectedMonomial U I n (σ 0) (σ 1) (degree j) (r j) + have hsum : (∑ a ∈ Finset.univ.erase (e 0), ∫ x, + D (spectralBlockView (m + 1) (q + 1) x) * spectralEntryMonomial d (x (e 0, a)) + ∂(L : Measure (SpectralArray (m + 1)))) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h + (fun U σ => D' U σ * ∑ l : Fin q, κ U (σ 0) (σ l.succ)) := by + have hI (a : Fin (q + 1)) : Integrable + (fun x : SpectralArray (m + 1) => D (spectralBlockView (m + 1) (q + 1) x) * + spectralEntryMonomial d (x (e 0, a))) (L : Measure (SpectralArray (m + 1))) := + compact_integrable (hcD.mul (hmono.comp (continuous_apply _))) + rw [← integral_finsetSum _ (fun a _ => hI a)] + apply priorNamespacedArrayLaw_test μ ν₀ eig c I degree amplitude r h + _ (continuous_finsetSum _ fun a _ => hcD.mul (hmono.comp (continuous_apply _))) _ + (fun i => (e i).val) (Fin.val_injective.comp e.injective) + intro U σ + rw [show D' U (fun i => σ ((e i).val)) = + D (spectralBlockView (m + 1) (q + 1) (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2))) from + permutedSpectralBlockTest_embedding I n e D U σ] + rw [sum_nonzero_permutation e (fun a => κ U (σ (e 0)) (σ a)), Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + simp only [Pi.mul_apply, Function.comp_apply, d, spectralJointEntry_selectedMonomial, κ] + unfold spectralMonomialResidual + rw [hnew, hblock, hpair, hsum] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayResidualBound.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayResidualBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d3cfc0b8e77543c7a6bd4f74b8daa4a28210b42 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayResidualBound.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Fields.PriorMinimumBounds +import OAI.Probability.InvariantIsing.Fields.PriorArrayResidual +import OAI.Probability.InvariantIsing.Arrays.TensorGGRate + +namespace OAI + +/-! Uniform GG residual bounds for the actual constrained-prior array. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +theorem priorPerturbation_arrayResidual_bound (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let L := H+4+C*(K+4*m+8)^2 + perturbationScale N≤1/32 → contactStep N≤1/4 → + (∀ u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I t h u v≤priorPerturbationObjective μ ν eig c I t h u' v') → + ∀ j : Fin N, ∀ q : ℕ, ∀ i : Fin (q+1), + ∀ D : SpectralBlock (m+1) (q+1) → ℝ, Continuous D → + ∀ B : ℝ, 0≤B → (∀ x, |D x|≤B) → + |spectralMonomialResidual + (priorNamespacedArrayLaw μ ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) r h) + (q+1) i D (Fin.lastCases (r j) (d j))|≤tensorContactGGRate N j m L B := by + obtain ⟨C,hC,hgg⟩ := priorPerturbation_minimum_bounds hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n ν hν eig c K hK heig I u hu v hv t ht h hh h0 H hH d r L + he hs hmin j q i D hD B hB hDb + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure ν := hν + let e := Equiv.swap 0 i + have hg := (hgg N hN μ hμ hμinv m n ν hν eig c K hK heig I u hu v hv t ht h hh h0 H hH + he hs hmin).2 j q B hB (permutedSpectralBlockTest I n e D) + (measurable_permutedSpectralBlockTest I n e D hD) (fun U σ => hDb _) + have hr := priorNamespacedArrayLaw_residual μ ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) r h j e D hD + have hei : e 0=i := Equiv.swap_apply_left 0 i + rw [hei] at hr + rw [hr] + exact hg + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayWard.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea46ef5434944ba8b217780ffe829dad56de7602 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorArrayWard.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Fields.PriorPrincipalWard +import OAI.Probability.InvariantIsing.Fields.PriorArrayLaw +import OAI.Probability.InvariantIsing.Arrays.TensorArrayWard + +namespace OAI + +/-! Finite off-diagonal Ward residual for the actual constrained-prior array. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma priorNamespacedArrayLaw_off_direct {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (h : ℕ → ℝ) (treeDegree : Fin k → ℕ) + (κ : Fin m → ℝ) (a b₀ : Fin m) + (ha : ∀ i ∈ I a, eig i = κ a) (hb : ∀ i ∈ I b₀, eig i = κ b₀) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) : + (∫ x, spectralOffWardDirect (fun a => (I a).card / (N : ℝ)) κ a b₀ Φ x + ∂(priorNamespacedArrayLaw μ ν eig c I degree amp treeDegree h : Measure _)) = + priorNamespacedReplicaAverage μ ν eig c I degree amp treeDegree h + (fun U => tensorOffDirect eig (I a) (I b₀) (fun s : Spin N × LabeledLeaf n => s.1) + (fun σ τ => Φ (spinPairOverlap σ τ)) U) := by + apply priorNamespacedArrayLaw_test μ ν eig c I degree amp treeDegree h _ + (continuous_spectralOffWardDirect _ _ _ _ Φ hΦ) _ Fin.val Fin.val_injective + intro U σ + rw [tensorOffDirect_eq_block eig (I a) (I b₀) (κ a) (κ b₀) ha hb] + simp only [spectralOffWardDirect, spectralSpinArray_joint (specialRotation U) I hdis hcover, + spectralJointEntry_spectral, tensorOffBlockDirect] + rfl + +lemma priorNamespacedArrayLaw_off_fresh {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (h : ℕ → ℝ) (treeDegree : Fin k → ℕ) + (κ : Fin m → ℝ) (a b₀ : Fin m) + (ha : ∀ i ∈ I a, eig i = κ a) (hb : ∀ i ∈ I b₀, eig i = κ b₀) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) : + (∫ x, spectralOffWardFresh κ a b₀ Φ x + ∂(priorNamespacedArrayLaw μ ν eig c I degree amp treeDegree h : Measure _)) = + priorNamespacedReplicaAverage μ ν eig c I degree amp treeDegree h + (fun U => tensorOffFresh eig (I a) (I b₀) (fun s : Spin N × LabeledLeaf n => s.1) + (fun σ τ => Φ (spinPairOverlap σ τ)) U) := by + apply priorNamespacedArrayLaw_test μ ν eig c I degree amp treeDegree h _ + (continuous_spectralOffWardFresh _ _ _ Φ hΦ) _ Fin.val Fin.val_injective + intro U σ + rw [tensorOffFresh_eq_block eig (I a) (I b₀) (κ a) (κ b₀) ha hb] + simp only [spectralOffWardFresh, spectralSpinArray_joint (specialRotation U) I hdis hcover, + spectralJointEntry_spectral, tensorOffBlockFresh] + rfl + + theorem priorNamespacedArrayLaw_off_ward_bound {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin N → Fin m → ℕ) (treeDegree : Fin N → ℕ) + (u : Fin N → ℝ) (hu : ∀ r, |u r| ≤ 2) (D : ℝ) (hD : 0 ≤ D) + (hdegree : ∀ r, (∑ a, (degree r a : ℝ)) ≤ D * ((r : ℝ) + 1)) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (κ : Fin m → ℝ) (a b₀ : Fin m) (hJK : Disjoint (I a) (I b₀)) + (ha : ∀ i ∈ I a, eig i = κ a) (hb : ∀ i ∈ I b₀, eig i = κ b₀) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) (B : ℝ) (hB : 0 ≤ B) (hΦB : ∀ r, |Φ r| ≤ B) : + |spectralOffWardResidual + (priorNamespacedArrayLaw μ ν eig c I degree (tensorPerturbationAmplitude N u) treeDegree h) + (fun a => (I a).card / (N : ℝ)) κ a b₀ Φ| ≤ 192 * B * D * perturbationScale N ^ 2 := by + rw [spectralOffWardResidual_eq_direct_fresh _ _ _ _ _ Φ hΦ, + priorNamespacedArrayLaw_off_direct μ ν eig c I hdis hcover degree _ h treeDegree κ a b₀ ha hb Φ hΦ, + priorNamespacedArrayLaw_off_fresh μ ν eig c I hdis hcover degree _ h treeDegree κ a b₀ ha hb Φ hΦ] + exact priorNamespaced_off_principal_bound hN μ ν eig c I degree treeDegree u hu D hD hdegree + h hh h0 (I a) (I b₀) hJK (fun σ τ => Φ (spinPairOverlap σ τ)) B hB + (fun σ τ => hΦB (spinPairOverlap σ τ)) + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorContactContinuity.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad4c45f62d9d45543009ea3a3d8ca8b29b8336ed --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactContinuity.lean @@ -0,0 +1,124 @@ +import OAI.Probability.InvariantIsing.Fields.PriorSiteModulus +import OAI.Probability.InvariantIsing.Fields.PriorTemperatureModulus +import OAI.Probability.InvariantIsing.Arrays.TensorContactRegion + +namespace OAI + +/-! Joint continuity of the constrained-prior contact pressure, including +zero covariance increments and both complete perturbation amplitudes. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology NNReal +namespace InvariantIsing + +def priorContactPressure {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (p : TensorContactParameter N m n) : ℝ := + priorPerturbationPressureMean μ ν eig c I p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2 - + finiteFieldPath p.2.1 n/2 + +lemma priorContact_raw_modulus + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (p q : TensorContactParameter N m n) + (hp : ∀ i, 0 ≤ p.2.1 i) (hq : ∀ i, 0 ≤ q.2.1 i) : + |priorPerturbationPressureMean μ ν eig c I p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2- + priorPerturbationPressureMean μ ν eig c I q.1 (finiteFieldPath q.2.1) q.2.2.1 q.2.2.2| ≤ + (K/2)*|p.1-q.1|+ + 2*∑ i : Fin (n+1), + |(NNReal.sqrt (varianceIncrement (finiteFieldPath p.2.1) i) : ℝ)- + (NNReal.sqrt (varianceIncrement (finiteFieldPath q.2.1) i) : ℝ)| * + ((NNReal.sqrt (varianceIncrement (finiteFieldPath p.2.1) i) : ℝ)+ + (NNReal.sqrt (varianceIncrement (finiteFieldPath q.2.1) i) : ℝ))+ + 2*(N : ℝ)⁻¹*tensorAmplitudeModulus (tensorPerturbationAmplitude N p.2.2.1) + (tensorPerturbationAmplitude N q.2.2.1)+perturbationScale N*∑ a, |p.2.2.2 a-q.2.2.2 a| := by + let F := fun (t : ℝ) (a : Fin (n+1) → ℝ) (u : Fin N → ℝ) (v : Fin m → ℝ) => + priorPerturbationPressureMean μ ν eig c I t (finiteFieldPath a) u v + have ht := priorPerturbationPressureMean_temperature_modulus hhaar hgauss hN μ hμ ν eig c I + (finiteFieldPath p.2.1) (monotone_finiteFieldPath hp) (finiteFieldPath_nonneg hp 0) + p.2.2.1 p.2.2.2 K hK p.1 q.1 + have ha := prior_site_pressure_modulus hhaar hgauss hN μ hμ ν + (diagonalPerturbedEigenvalues eig I p.2.2.2 q.1) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + (fun i (j : Fin N) => varianceIncrement (monomialPath n (enumeratedTreeDegree m j)) i) + (fun i => varianceIncrement (finiteFieldPath p.2.1) i) + (fun i => varianceIncrement (finiteFieldPath q.2.1) i) + change |F q.1 p.2.1 p.2.2.1 p.2.2.2-F q.1 q.2.1 p.2.2.1 p.2.2.2| ≤ _ at ha + have hu := priorPerturbationPressureMean_modulus hhaar hgauss hN μ hμ ν eig c I q.1 + (finiteFieldPath q.2.1) (monotone_finiteFieldPath hq) (finiteFieldPath_nonneg hq 0) + p.2.2.1 q.2.2.1 p.2.2.2 q.2.2.2 + have h1 := abs_sub_le (F p.1 p.2.1 p.2.2.1 p.2.2.2) + (F q.1 p.2.1 p.2.2.1 p.2.2.2) (F q.1 q.2.1 p.2.2.1 p.2.2.2) + have h2 := abs_sub_le (F p.1 p.2.1 p.2.2.1 p.2.2.2) + (F q.1 q.2.1 p.2.2.1 p.2.2.2) (F q.1 q.2.1 q.2.2.1 q.2.2.2) + change |F p.1 p.2.1 p.2.2.1 p.2.2.2-F q.1 q.2.1 q.2.2.1 q.2.2.2| ≤ _ + linarith + +lemma continuous_finiteFieldPath {n : ℕ} (i : ℕ) : + Continuous (fun a : Fin (n+1) → ℝ => finiteFieldPath a i) := by + unfold finiteFieldPath + apply continuous_finsetSum + intro j _ + split_ifs <;> fun_prop + +lemma continuous_finiteFieldVariance {n : ℕ} (i : ℕ) : + Continuous (fun a : Fin (n+1) → ℝ => varianceIncrement (finiteFieldPath a) i) := by + cases i with + | zero => + have h := continuous_finiteFieldPath (n := n) 0 + change Continuous (fun a : Fin (n+1) → ℝ => (finiteFieldPath a 0).toNNReal) + fun_prop + | succ i => + have h1 := continuous_finiteFieldPath (n := n) (i+1) + have h2 := continuous_finiteFieldPath (n := n) i + change Continuous (fun a : Fin (n+1) → ℝ => + (finiteFieldPath a (i+1)-finiteFieldPath a i).toNNReal) + fun_prop + +lemma continuousOn_priorContactPressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) {S : Set (TensorContactParameter N m n)} + (hS : ∀ p ∈ S, ∀ i, 0 ≤ p.2.1 i) : + ContinuousOn (priorContactPressure μ ν eig c I) S := by + have hraw : ContinuousOn (fun p : TensorContactParameter N m n => + priorPerturbationPressureMean μ ν eig c I p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2) S := by + rw [continuousOn_iff_continuous_domRestrict] + apply continuous_iff_continuousAt.mpr + intro q + apply tendsto_iff_norm_sub_tendsto_zero.mpr + let D := fun p : S => (K/2)*|p.val.1-q.val.1|+ + 2*∑ i : Fin (n+1), + |(NNReal.sqrt (varianceIncrement (finiteFieldPath p.val.2.1) i) : ℝ)- + (NNReal.sqrt (varianceIncrement (finiteFieldPath q.val.2.1) i) : ℝ)| * + ((NNReal.sqrt (varianceIncrement (finiteFieldPath p.val.2.1) i) : ℝ)+ + (NNReal.sqrt (varianceIncrement (finiteFieldPath q.val.2.1) i) : ℝ))+ + 2*(N : ℝ)⁻¹*tensorAmplitudeModulus (tensorPerturbationAmplitude N p.val.2.2.1) + (tensorPerturbationAmplitude N q.val.2.2.1)+perturbationScale N*∑ a, |p.val.2.2.2 a-q.val.2.2.2 a| + have hs (i : Fin (n+1)) : Continuous (fun p : S => + varianceIncrement (finiteFieldPath p.val.2.1) i) := + (continuous_finiteFieldVariance i).comp (by fun_prop) + have hD : Continuous D := by + unfold D tensorAmplitudeModulus tensorPerturbationAmplitude + fun_prop + have hz : D q=0 := by simp [D, tensorAmplitudeModulus] + apply squeeze_zero' (Eventually.of_forall fun _ => norm_nonneg _) + (Eventually.of_forall fun p => by + simpa only [Real.norm_eq_abs, domRestrict_apply] using priorContact_raw_modulus + hhaar hgauss hN μ hμ ν eig c I K hK p.val q.val (hS p.val p.property) (hS q.val q.property)) + simpa only [hz] using hD.tendsto q + unfold priorContactPressure + apply hraw.sub + exact (((continuous_finiteFieldPath n).comp (by fun_prop)).div_const 2).continuousOn + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorContactField.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactField.lean new file mode 100644 index 0000000000000000000000000000000000000000..f584826c3154391944cea4e638378f7269c456da --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactField.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFieldDerivative +import OAI.Probability.InvariantIsing.Fields.PriorContactMinimum +import OAI.Probability.InvariantIsing.Arrays.TensorContactField + +namespace OAI + +/-! Field-cone inequalities at the actual constrained-prior joint contact +minimum. No strict positivity of the covariance increments is required. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma priorContactPressure_eq_namespaced {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (p : TensorContactParameter N m n) : + priorContactPressure μ ν eig c I p = + priorNamespacedMeanPressure μ ν (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) := by + unfold priorContactPressure priorNamespacedMeanPressure priorPerturbationPressureMean + rw [priorNamespacedLog_integral] + +def priorContactFieldObjective {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (w : Fin (n+1) → ℝ) (h : ℕ → ℝ) : ℝ := + -priorNamespacedMeanPressure μ ν (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun j : Fin N => enumeratedTreeDegree m j) h-(∑ i, w i*h i)/2 + +lemma priorContactFieldObjective_right_derivative + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (w : Fin (n+1) → ℝ) + (h g : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt + (fun a => priorContactFieldObjective μ ν eig c I u v t w (fun i => h i+a*g i)) + (priorNamespacedReplicaAverage μ ν (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun j : Fin N => enumeratedTreeDegree m j) h (fun _ => tensorFieldPairObservable g)/2- + (∑ i, w i*g i)/2) (Ici 0) 0 := by + have hd := priorNamespacedMeanPressure_field_right_derivative hhaar hgauss hN μ hμ ν + (diagonalPerturbedEigenvalues eig I v t) c I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N u) (fun j : Fin N => enumeratedTreeDegree m j) h g hh h0 hg g0 + have hs : HasDerivAt (fun a : ℝ => ∑ i : Fin (n+1), w i*(h i+a*g i)) (∑ i, w i*g i) 0 := by + simpa only [one_mul,id_eq] using HasDerivAt.fun_sum + (fun (i : Fin (n+1)) (_ : i ∈ Finset.univ) => + (((hasDerivAt_id (0 : ℝ)).mul_const (g i)).const_add (h i)).const_mul (w i)) + convert! hd.fun_neg.fun_sub (hs.div_const 2).hasDerivWithinAt using 1 + simp only [neg_div,neg_neg] + +theorem priorContact_minimum_field_cone + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) (p : TensorContactParameter N m n) + (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + priorContactObjective μ ν eig c I w S V p ≤ priorContactObjective μ ν eig c I w S V q) + (hcap : (∑ i, p.2.1 i) < H) (d : Fin (n+1) → ℝ) (hd : ∀ i, 0 ≤ d i) : + (∑ i, w i*finiteFieldPath d i) ≤ + priorNamespacedReplicaAverage μ ν (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun _ => tensorFieldPairObservable (finiteFieldPath d)) := by + obtain ⟨ht,ha,hsum,hu,hv⟩ := tensorContactRegion_bounds hp + have hder := priorContactFieldObjective_right_derivative hhaar hgauss hN μ hμ ν eig c I + p.2.2.1 p.2.2.2 p.1 w (finiteFieldPath p.2.1) (finiteFieldPath d) + (monotone_finiteFieldPath ha) (finiteFieldPath_nonneg ha 0) + (monotone_finiteFieldPath hd) (finiteFieldPath_nonneg hd 0) + have hfeas : ∀ᶠ a in 𝓝[>] (0 : ℝ), (∑ i, p.2.1 i)+a*(∑ i, d i) < H := by + have hc : ContinuousAt (fun a : ℝ => (∑ i, p.2.1 i)+a*(∑ i, d i)) 0 := by fun_prop + exact (hc.eventually (gt_mem_nhds (by simpa only [zero_mul,add_zero] using hcap))).filter_mono + nhdsWithin_le_nhds + have hnon := right_derivative_nonneg_of_min hder (by + filter_upwards [hfeas,self_mem_nhdsWithin] with a hafeas ha0 + let z : TensorContactParameter N m n := (p.1,(fun i => p.2.1 i+a*d i),p.2.2.1,p.2.2.2) + have hz : z ∈ tensorContactRegion N m n H := tensorContactRegion_mem ht + (fun i => add_nonneg (ha i) (mul_nonneg ha0.le (hd i))) + (by simpa only [z,Finset.sum_add_distrib,Finset.mul_sum] using hafeas.le) hu hv + have hm := hmin z hz + simp only [priorContactObjective,priorContactPressure_eq_namespaced] at hm + simp only [z,finiteFieldPath_add,finiteFieldPath_const_mul] at hm + simp only [priorContactFieldObjective,zero_mul,add_zero] + linarith) + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorContactGG.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f9a14a85a49f74ac88a33b8fc11fe48b2434a37 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactGG.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.PriorContactMinimum +import OAI.Probability.InvariantIsing.Fields.PriorFixedGeometricLimit + +namespace OAI + +/-! Geometric GG limits at the same joint constrained-prior contact minima. +The perturbation parameters are not reselected after minimizing temperature +and field, so subsequent contact inequalities refer to this same sequence. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem priorContact_minimizers_have_GG_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 < K) + (heig : ∀ k i, |eig k i| ≤ K) (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (w : Fin (n+1) → ℝ) (S : ℝ) (V : ℝ → ℝ) (H : ℝ) + (p : (k : ℕ) → TensorContactParameter (N k) m n) + (hp : ∀ k, p k ∈ tensorContactRegion (N k) m n H) + (hmin : ∀ k q, q ∈ tensorContactRegion (N k) m n H → + priorContactObjective (μ k) (ν k) (eig k) (c k) (I k) w S V (p k) ≤ + priorContactObjective (μ k) (ν k) (eig k) (c k) (I k) w S V q) : + ∃ Q : ProbabilityMeasure (SpectralArray (m+1)), + ∃ q : Fin (m+1) → Icc (0 : ℝ) 1, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun k => priorPerturbedArrayLaw (μ (φ k)) (ν (φ k)) + (eig (φ k)) (c (φ k)) (I (φ k)) + (p (φ k)).2.2.1 (p (φ k)).2.2.2 (p (φ k)).1 (finiteFieldPath (p (φ k)).2.1)) + atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) := by + have hb k := tensorContactRegion_bounds (hp k) + have ht k : |(p k).1| ≤ 1 := by + rw [abs_of_nonneg (hb k).1.1] + exact (hb k).1.2 + have hh k : Monotone (finiteFieldPath (p k).2.1) := monotone_finiteFieldPath (hb k).2.1 + have h0 k : 0 ≤ finiteFieldPath (p k).2.1 0 := finiteFieldPath_nonneg (hb k).2.1 0 + have hcap k : finiteFieldPath (p k).2.1 n ≤ H := by + rw [finiteFieldPath_last] + exact (hb k).2.2.1 + exact prior_minimizers_geometric_GG_limit hhaar hgauss N hN hNlim m n μ hμinv ν + eig c K hK heig I (fun k => (p k).1) ht (fun k => finiteFieldPath (p k).2.1) hh h0 H hcap + (fun k => (p k).2.2.1) (fun k => (hb k).2.2.2.1) + (fun k => (p k).2.2.2) (fun k => (hb k).2.2.2.2) + (fun k => priorContact_minimum_perturbations (μ k) (ν k) (eig k) (c k) (I k) + w S V H (p k) (hp k) (hmin k)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorContactMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..87ea4eb358ea92cbacbbaa6bc2f9e31bd5d4cb63 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactMinimum.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Fields.PriorContactContinuity + +namespace OAI + +/-! Joint contact minima for a fixed spin/leaf prior. The temperature scales +only the original interaction, and a joint minimum supplies the actual +perturbation minimum required by the constrained-prior GG construction. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +def priorContactObjective {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (p : TensorContactParameter N m n) : ℝ := + -priorContactPressure μ ν eig c I p - (∑ i, w i*finiteFieldPath p.2.1 i)/2 + + S+V p.1 + ∑ j : Fin N, perturbationWeight j*(p.2.2.1 j-3/2)^2 + + ∑ a, (p.2.2.2 a-3/2)^2 + +lemma continuousOn_priorContactObjective (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (hV : Continuous V) (H : ℝ) : + ContinuousOn (priorContactObjective μ ν eig c I w S V) (tensorContactRegion N m n H) := by + have hp := continuousOn_priorContactPressure hhaar hgauss hN μ hμ ν eig c I K hK + (S := tensorContactRegion N m n H) + (fun p hp => (tensorContactRegion_bounds hp).2.1) + have hw : Continuous (fun p : TensorContactParameter N m n => + ∑ i, w i*finiteFieldPath p.2.1 i) := by + apply continuous_finsetSum + intro i _ + exact continuous_const.mul ((continuous_finiteFieldPath i).comp (by fun_prop)) + unfold priorContactObjective + exact (((hp.neg.sub (hw.div_const 2).continuousOn).add continuousOn_const).add + (hV.comp continuous_fst).continuousOn |>.add (by fun_prop)).add (by fun_prop) + +theorem priorContactObjective_exists_minimum (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (hV : Continuous V) (H : ℝ) (hH : 0 ≤ H) : + ∃ p ∈ tensorContactRegion N m n H, + ∀ q ∈ tensorContactRegion N m n H, + priorContactObjective μ ν eig c I w S V p ≤ priorContactObjective μ ν eig c I w S V q := + (isCompact_tensorContactRegion N m n H).exists_isMinOn + (tensorContactRegion_nonempty N m n hH) + (continuousOn_priorContactObjective hhaar hgauss hN μ hμ ν eig c I K hK w S V hV H) + +lemma priorContactObjective_eq_perturbation {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (p : TensorContactParameter N m n) : + priorContactObjective μ ν eig c I w S V p = + priorPerturbationObjective μ ν eig c I p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2 + + finiteFieldPath p.2.1 n/2 - (∑ i, w i*finiteFieldPath p.2.1 i)/2+S+V p.1 := by + unfold priorContactObjective priorContactPressure priorPerturbationObjective + ring + +theorem priorContact_minimum_perturbations {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) + (p : TensorContactParameter N m n) (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + priorContactObjective μ ν eig c I w S V p ≤ priorContactObjective μ ν eig c I w S V q) : + ∀ u v, (∀ j, u j ∈ Icc (1 : ℝ) 2) → (∀ a, v a ∈ Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2 ≤ + priorPerturbationObjective μ ν eig c I p.1 (finiteFieldPath p.2.1) u v := by + intro u v hu hv + let q : TensorContactParameter N m n := (p.1,p.2.1,u,v) + obtain ⟨ht,ha,hcap,_,_⟩ := tensorContactRegion_bounds hp + have hq : q ∈ tensorContactRegion N m n H := tensorContactRegion_mem ht ha hcap hu hv + have h := hmin q hq + rw [priorContactObjective_eq_perturbation μ ν eig c I w S V p, + priorContactObjective_eq_perturbation μ ν eig c I w S V q] at h + dsimp only [q] at h + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorContactTemperature.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactTemperature.lean new file mode 100644 index 0000000000000000000000000000000000000000..71fcfd46f74ff184457163720166cd6bcf075fe6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorContactTemperature.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Fields.PriorContactMinimum +import OAI.Probability.InvariantIsing.Fields.PriorTemperatureDerivative +import OAI.Probability.InvariantIsing.Spectral.SpectralTemperatureFunctional +import OAI.Probability.InvariantIsing.Arrays.TensorContactTemperature + +namespace OAI + +/-! The energy inequality at an actual constrained-prior contact minimum, +including a minimum at the upper temperature endpoint. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem priorContact_minimum_temperature + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) (p : TensorContactParameter N m n) + (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + priorContactObjective μ ν eig c I w S V p ≤ priorContactObjective μ ν eig c I w S V q) + (ht : 0 < p.1) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) + {V' : ℝ} (hV : HasDerivAt V V' p.1) : + V' ≤ priorNamespacedObservableAverage μ ν (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1) := by + obtain ⟨hpt,ha,hsum,hu,hv⟩ := tensorContactRegion_bounds hp + let M := fun t => priorPerturbationPressureMean μ ν eig c I t (finiteFieldPath p.2.1) + p.2.2.1 p.2.2.2 + let E := priorNamespacedObservableAverage μ ν (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1) + have hdM : HasDerivAt M E p.1 := hasDerivAt_priorPerturbationPressureMean_temperature + hhaar hgauss hN μ hμ ν eig c I p.2.2.1 p.2.2.2 (finiteFieldPath p.2.1) + (monotone_finiteFieldPath ha) (finiteFieldPath_nonneg ha 0) K hK p.1 + let F := fun t => -M t+V t + have hdF : HasDerivAt F (-E+V') (p.1-id 0) := by + convert! hdM.fun_neg.fun_add hV using 1 + simp only [id_eq,sub_zero] + have hd := hdF.comp 0 ((hasDerivAt_id (0 : ℝ)).const_sub p.1) + simp only [mul_neg_one] at hd + have hsmall : ∀ᶠ a in 𝓝[>] (0 : ℝ), a < p.1 := + (show ∀ᶠ a in 𝓝 (0 : ℝ), a < p.1 from Iio_mem_nhds ht).filter_mono nhdsWithin_le_nhds + have hnon := right_derivative_nonneg_of_min hd.hasDerivWithinAt (by + filter_upwards [hsmall,self_mem_nhdsWithin] with a hal ha0 + have hnew : (p.1-a,p.2.1,p.2.2.1,p.2.2.2) ∈ tensorContactRegion N m n H := + tensorContactRegion_mem ⟨sub_nonneg.mpr hal.le,(sub_le_self _ ha0.le).trans hpt.2⟩ + ha hsum hu hv + have hm := hmin _ hnew + simp only [priorContactObjective,priorContactPressure] at hm + change F (p.1-0) ≤ F (p.1-a) + rw [sub_zero] + dsimp only [F,M] + linarith) + change V' ≤ E + linarith + +theorem priorContact_minimum_energy_gap + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a=1) + (trial : OverlapPath) (δ S H : ℝ) (p : TensorContactParameter N m n) + (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + priorContactObjective μ ν eig c I w S + (fun t => finiteTemperatureFunctional ρ lam hρ hρsum trial t+t*δ) p ≤ + priorContactObjective μ ν eig c I w S + (fun t => finiteTemperatureFunctional ρ lam hρ hρsum trial t+t*δ) q) + (ht : 0 < p.1) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) : + finiteInteractionEnergy ρ lam hρ hρsum p.1 trial+δ ≤ + priorNamespacedObservableAverage μ ν (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1) := by + apply priorContact_minimum_temperature hhaar hgauss hN μ hμ ν eig c I w S + (fun t => finiteTemperatureFunctional ρ lam hρ hρsum trial t+t*δ) H p hp hmin ht K hK + convert! (hasDerivAt_finiteTemperatureFunctional ρ lam hρ hρsum trial p.1).fun_add + ((hasDerivAt_id p.1).mul_const δ) using 1 + simp only [one_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorDiagonalMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorDiagonalMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5c58f330ab71b18951eca0818804c467129c227 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorDiagonalMinimum.lean @@ -0,0 +1,129 @@ +import OAI.Probability.InvariantIsing.Fields.PriorDiagonalStatistics +import OAI.Probability.InvariantIsing.Pressure.PressureCoordinateMinimum + +namespace OAI + +/-! The spectral self-overlap estimate at a fixed-prior pressure minimum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem priorDiagonal_energy_at_minimum {N m k n : ℕ} (hN : 0 tensorPathProfile I degree n r h i)) 2 (μ.prod gaussianCoordinates)) + (hv : ∀ q : ℝ, |q|≤2 → + variance (priorNamespacedLog ν₀ (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i)) (μ.prod gaussianCoordinates)≤B) + (hmin : + let M := fun q => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν₀ + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates + ∀ q∈Set.Icc (1 : ℝ) 2, -M w+(w-3/2)^2≤-M q+(q-3/2)^2) : + let A := N*perturbationScale N + let c₀ := N/A^2 + let P := μ.prod gaussianCoordinates + let ν := priorNamespacedReference ν₀ + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) + let Y := fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + projectedOverlap (specialRotation p.1.1) (I a) p.2.1 p.2.1 + let E := fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, |Y (p,x)-2*c₀*(A*w-A*(3/2))| + ∂(ν p).tilted (fun x => A*w*Y (p,x)) + Integrable E P ∧ (∫ p, E p ∂P)≤ + (2*c₀+K^2)/(2*K)+c₀*(A*s)+4*(2*Real.sqrt B)/(A*s) := by + intro A c₀ P ν Y E + let Q := P + let M := fun q => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν₀ + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p ∂P + let L := fun z => ∫ p, priorDiagonalCGF ν₀ eig c I degree amplitude r h v t a z p ∂Q + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hA : 0 < A := mul_pos hn (Real.rpow_pos_of_pos hn _) + have hY : Measurable Y := by + apply measurable_from_prod_countable_left + intro x + exact (measurable_projectedOverlap (I a) x.1 x.1).comp measurable_fst + have hYb (p : SpecialOrthogonal N × (ℕ → ℝ)) (x : Spin N × LabeledLeaf n) : + Y (p, x) ∈ Set.Icc (0 : ℝ) 1 := + ⟨projectedOverlap_self_nonneg _ _ _, projectedOverlap_self_le_one _ _ _⟩ + have hstat (q : ℝ) (hq : |q| ≤ 2) := + priorDiagonalCGF_statistics hN μ ν₀ eig c I degree amplitude r h hh h0 v t a q B + (fun z hz => by + rcases hz with hz | hz + · rw [hz] + exact hF q hq + · rw [hz] + exact hF 0 (by norm_num)) + (fun z hz => by + rcases hz with hz | hz + · rw [hz] + exact hv q hq + · rw [hz] + exact hv 0 (by norm_num)) + have hmean (q : ℝ) (hq : |q| ≤ 2) : L (A * q) = N * (M q - M 0) := by + dsimp only [L,A,Q,P,M] + rw [(hstat q hq).2.1] + have hn0 := hn.ne' + field_simp + have hcost (q : ℝ) (hq : q ∈ Set.Icc (1 : ℝ) 2) : + 0 ≤ M q - M 0 ∧ M q - M 0 ≤ 2 * perturbationScale N := by + have hqa : |q| ≤ 2 := abs_le.mpr ⟨by linarith [hq.1], hq.2⟩ + have hqb : ∀ p, 0 ≤ priorDiagonalCGF ν₀ eig c I degree amplitude r h v t a (A * q) p ∧ + priorDiagonalCGF ν₀ eig c I degree amplitude r h v t a (A * q) p ≤ A * q := by + intro p + exact bounded_nonnegative_cgf_bounds (ν p) (fun x => Y (p, x)) + (measurable_of_countable _) (hYb p) (mul_nonneg hA.le (by linarith [hq.1])) + have hlo : 0 ≤ L (A * q) := integral_nonneg (fun p => (hqb p).1) + have hhi : L (A * q) ≤ A * q := by + calc + _ ≤ ∫ _ : SpecialOrthogonal N × (ℕ → ℝ), A * q ∂Q := + integral_mono ((hstat q hqa).1.integrable (by norm_num)) (integrable_const _) (fun p => (hqb p).2) + _ = _ := by simp [Q,P] + rw [hmean q hqa] at hlo hhi + have hbound := mul_le_mul_of_nonneg_left hq.2 hA.le + refine ⟨(mul_nonneg_iff_of_pos_left hn).mp hlo, ?_⟩ + dsimp only [A] at hbound hhi + nlinarith + have hpen := diagonalCoordinate_minimum_penalty + ⟨(hcost (3 / 2) (by constructor <;> norm_num)).1, (hcost w hw).2⟩ + (hmin (3 / 2) (by constructor <;> norm_num)) + obtain ⟨hlo, hhi⟩ := diagonalCoordinate_minimum_interior hpen he hs' + have hlocal := pressureCoordinate_minimum_rescale (Nat.cast_nonneg N) hA hw hlo hhi + (fun q hq => hmean q (abs_le.mpr ⟨by linarith [hq.1], hq.2⟩)) + (show ∀ q ∈ Set.Icc (1 : ℝ) 2, -M w + 1 * (w - 3 / 2) ^ 2 ≤ + -M q + 1 * (q - 3 / 2) ^ 2 by simpa only [one_mul] using hmin) + have hconc (z : ℝ) (hz : z ∈ ({A * w - A * s, A * w, A * w + A * s} : Set ℝ)) : + (∫ p, |priorDiagonalCGF ν₀ eig c I degree amplitude r h v t a z p - L z| ∂Q) ≤ + 2 * Real.sqrt B := by + have hzi : z ∈ Set.Icc (A * w - A * s) (A * w + A * s) := by + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hz + rcases hz with rfl | rfl | rfl <;> constructor <;> nlinarith [mul_pos hA hs] + have hzq : z / A ∈ Set.Icc (1 : ℝ) 2 := by + constructor + · apply (le_div_iff₀ hA).mpr + nlinarith [hzi.1] + · apply (div_le_iff₀ hA).mpr + nlinarith [hzi.2] + have hza : |z / A| ≤ 2 := abs_le.mpr ⟨by linarith [hzq.1], hzq.2⟩ + have hc := (hstat (z / A) hza).2.2 + simpa only [A, mul_div_cancel₀ _ hA.ne'] using hc + simpa only [mul_one] using boundedObservable_energy_at_minimum Q ν + (measurable_priorNamespacedReference ν₀ + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude (fun i => tensorPathProfile I degree n r h i)) + Y hY 1 (fun p x => projectedOverlap_abs_le_one _ _ _ _) + (mul_pos hA hs) hK hlocal hconc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorDiagonalStatistics.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorDiagonalStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..c130653bec245e1a1d020699455c0392e2ab5f1c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorDiagonalStatistics.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorReference +import OAI.Probability.InvariantIsing.Pressure.PressureDifferenceConcentration + +namespace OAI + +/-! The diagonal observable's actual CGF inherits concentration from +both neighboring finite-prior log partition functions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def priorDiagonalCGF {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (v : Fin m → ℝ) (t : ℝ) (a : Fin m) (s : ℝ) + (p : SpecialOrthogonal N × (ℕ → ℝ)) : ℝ := + cgf (fun x : Spin N × LabeledLeaf n => projectedOverlap (specialRotation p.1) (I a) x.1 x.1) + (priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p) s + +theorem priorDiagonalCGF_statistics {N m k n : ℕ} (hN : 0 tensorPathProfile I degree n r h i)) 2 (μ.prod gaussianCoordinates)) + (hv : ∀ q : ℝ, q=w ∨ q=0 → + variance (priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i)) (μ.prod gaussianCoordinates) ≤ B) : + let P := μ.prod gaussianCoordinates + let M := fun q => ∫ p, priorNamespacedLog ν + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p ∂P + let Z := priorDiagonalCGF ν eig c I degree amplitude r h v t a (N*perturbationScale N*w) + MemLp Z 2 P ∧ (∫ p, Z p ∂P)=M w-M 0 ∧ + (∫ p, |Z p-∫ p', Z p' ∂P| ∂P)≤2*Real.sqrt B := by + intro P M Z + let F := fun q => priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) + have he : Z =ᵐ[P] fun p => (1 : ℝ)*(F w p-F 0 p) := by + filter_upwards [prior_diagonal_cgf_eq_log_difference hN μ ν eig c I degree amplitude + r h hh h0 v t a w] with p hp + simpa only [one_mul,Z,F,priorDiagonalCGF] using hp + have hc := centered_scaled_difference_L1_bound P (hF w (Or.inl rfl)) + (hF 0 (Or.inr rfl)) (hv w (Or.inl rfl)) (hv 0 (Or.inr rfl)) he + refine ⟨hc.1,?_,?_⟩ + · rw [integral_congr_ae he] + simp only [one_mul] + exact integral_sub ((hF w (Or.inl rfl)).integrable (by norm_num)) + ((hF 0 (Or.inr rfl)).integrable (by norm_num)) + · simpa only [abs_one,mul_one,one_mul] using hc.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorEnergyLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorEnergyLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..c68188e524d8865d9e1a502b250feca4723d9034 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorEnergyLimit.lean @@ -0,0 +1,119 @@ +import OAI.Probability.InvariantIsing.Fields.PriorGGWardExistence +import OAI.Probability.InvariantIsing.Spectral.SpectralCanonicalIdentification +import OAI.Probability.InvariantIsing.Spectral.SpectralArrayEnergy +import OAI.Probability.InvariantIsing.Arrays.TensorSingleObservable + +namespace OAI + +/-! The original interaction energy in a constrained-prior GG limit is +identified by the actual rotation Ward equations. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma priorNamespacedObservableAverage_eq_replica_one {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → Spin N × LabeledLeaf n → ℝ) : + priorNamespacedObservableAverage μ ν eig c I degree amp r h D = + priorNamespacedReplicaAverage μ ν eig c I degree amp r h + (fun U (σ : Fin 1 → Spin N × LabeledLeaf n) => D U (σ 0)) := by + unfold priorNamespacedObservableAverage priorNamespacedReplicaAverage + apply integral_congr_ae + exact ae_of_all _ fun p => (referenceReplicaMean_zero_one + (priorNamespacedReference ν eig c I degree amp (fun i => tensorPathProfile I degree n r h i) p) + (D p.1)).symm + +lemma priorNamespacedArrayLaw_interactionEnergy {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (modelEig energyEig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I=Finset.univ) (lam : Fin m → ℝ) + (hlam : ∀ a i, i ∈ I a → energyEig i=lam a) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : + (∫ x, spectralArrayInteractionEnergy lam x + ∂(priorNamespacedArrayLaw μ ν modelEig c I degree amp r h : Measure (SpectralArray (m+1)))) = + priorNamespacedReplicaAverage μ ν modelEig c I degree amp r h + (fun U (σ : Fin 1 → Spin N × LabeledLeaf n) => + (N : ℝ)⁻¹*rotatedEnergy energyEig (specialRotation U) (σ 0).1) := by + apply priorNamespacedArrayLaw_test μ ν modelEig c I degree amp r h + _ (continuous_spectralArrayInteractionEnergy lam) _ (fun i : Fin 1 => i.val) Fin.val_injective + intro U σ + simp only [spectralArrayInteractionEnergy, spectralJointEntry_spectral, Fin.val_zero] + exact (normalized_rotatedEnergy_eq_blocks energyEig (specialRotation U) I hdis hcover lam hlam + (σ 0).1).symm + +theorem priorPerturbedArrayLaw_interactionEnergy_limit + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k)=Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i=lam a) + (u : (k : ℕ) → Fin (N k) → ℝ) (hu : ∀ k j, |u k j| ≤ 2) + (v : ℕ → Fin m → ℝ) (hv : ∀ k a, |v k a| ≤ 2) + (t : ℕ → ℝ) {t₀ : ℝ} (ht : Tendsto t atTop (𝓝 t₀)) + (h : ℕ → ℕ → ℝ) (hh : ∀ k, Monotone (h k)) (h0 : ∀ k, 0 ≤ h k 0) + (Q : ProbabilityMeasure (SpectralArray (m+1))) + (hL : Tendsto (fun k => priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a=1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1)))) + (q : Fin (m+1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) + (ht₀ : 0 ≤ t₀) : + ∃ hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x, + ∃ hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0 ≤ (x (0,1) a : ℝ), + Tendsto (fun k => priorNamespacedObservableAverage (μ k) (ν k) + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j : Fin (N k) => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude (N k) (u k)) + (fun j : Fin (N k) => enumeratedTreeDegree m j) (h k) + (fun U x => (N k : ℝ)⁻¹*rotatedEnergy (eig k) (specialRotation U) x.1)) atTop + (𝓝 (finiteInteractionEnergy ρ lam hρpos hρsum t₀ (spectralSpinQuantilePath Q hP hn))) := by + have hG := spectralArray_limit_gram hL (fun k => priorPerturbedArrayLaw_gram + (μ k) (ν k) (eig k) (c k) (I k) (u k) (v k) (t k) (h k)) + have hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q := by + intro e he + exact spectralArray_limit_reindex hL e (fun k => priorPerturbedArrayLaw_reindex + (μ k) (ν k) (eig k) (c k) (I k) (u k) (v k) (t k) (h k) e he) + have hP := spectralArray_limit_partition hL (fun k => priorPerturbedArrayLaw_partition + (hN k) (μ k) (ν k) (eig k) (c k) (I k) (hdis k) (hcover k) (u k) (v k) (t k) (h k)) + have hn := spectralGG_coordinate_nonnegative hgg hG q hq hd + obtain ⟨hoff,hdiag⟩ := priorPerturbedArrayLaw_ward_limits N hN hNlim m n μ hμinv ν + eig c I hdis hcover lam hlam u hu v hv t ht h hh h0 Q hL ρ hρ + have hid := spectralCanonical_identification hgg hG q hq hd hE hP hn + ρ (fun a => t₀*lam a) hρpos hρsum hoff hdiag + refine ⟨hP,hn,?_⟩ + have he k : (∫ x, spectralArrayInteractionEnergy lam x + ∂(priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) (u k) (v k) (t k) (h k) : + Measure (SpectralArray (m+1)))) = + priorNamespacedObservableAverage (μ k) (ν k) + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j : Fin (N k) => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude (N k) (u k)) + (fun j : Fin (N k) => enumeratedTreeDegree m j) (h k) + (fun U x => (N k : ℝ)⁻¹*rotatedEnergy (eig k) (specialRotation U) x.1) := by + rw [priorNamespacedObservableAverage_eq_replica_one] + exact priorNamespacedArrayLaw_interactionEnergy (μ k) (ν k) _ (eig k) (c k) (I k) + (hdis k) (hcover k) lam (hlam k) _ _ _ (h k) + have hlim := spectralArrayInteractionEnergy_weak_limit hL lam + simp_rw [he] at hlim + rw [spectralArrayInteractionEnergy_eq_finiteEnergy Q q hd ρ lam hρpos hρsum ht₀ + (spectralSpinQuantilePath Q hP hn) hid.1] at hlim + exact hlim + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d3b10816eddf96f7e6a5ca06a54fe4fd13da33d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldDerivative.lean @@ -0,0 +1,173 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFieldInsertionLaw +import OAI.Probability.InvariantIsing.Fields.PriorReplicaAverage +import OAI.Probability.InvariantIsing.Arrays.TensorFieldDerivativeIntegrability + +namespace OAI + +/-! The right field derivative of the actual centered constrained-prior +pressure, allowing zero and repeated field-variance levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def priorNamespacedMeanPressure {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : ℝ := + (N : ℝ)⁻¹*(∫ p, priorNamespacedLog ν eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates)-h n/2 + +def priorFieldCGFMean {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (a : ℝ) : ℝ := + ∫ p : (SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ), + cgf (fun x => cylinderField (tensorLinearCoefficients n g x) p.2) + (priorNamespacedReference ν eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) p.1) (Real.sqrt a) + ∂(μ.prod gaussianCoordinates).prod gaussianCoordinates + +def priorFieldInsertionMean {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (a : ℝ) : ℝ := + priorNamespacedMeanPressure μ ν eig c I degree amp r h+ + priorFieldCGFMean μ ν eig c I degree amp r h g a/N-a*g n/2 + +lemma priorFieldCGFMean_right_derivative {N m k n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt (priorFieldCGFMean μ ν eig c I degree amp r h g) + ((N*g n-N*priorNamespacedReplicaAverage μ ν eig c I degree amp r h + (fun _ => tensorFieldPairObservable g))/2) (Ici 0) 0 := by + let Q := μ.prod gaussianCoordinates + let G := priorNamespacedReference ν eig c I degree amp (fun i => tensorPathProfile I degree n r h i) + have hd := hasDerivWithinAt_random_cylinder_variance (P := Q) (ν := G) + (measurable_priorNamespacedReference ν eig c I degree amp + (fun i => tensorPathProfile I degree n r h i)) + (tensorLinearCoefficients n g) (fun x => (tensorLinearCoefficients_variance n g hg g0 x).le) + (d := N*g n) (fun x => by rw [cylinderCross_self,tensorLinearCoefficients_variance n g hg g0]) + (v := 0) (by norm_num) + have hc : (fun σ : Fin 2 → Spin N × LabeledLeaf n => + cylinderCross (tensorLinearCoefficients n g (σ 1)) (tensorLinearCoefficients n g (σ 0))) = + (fun σ => N*tensorFieldPairObservable g σ) := + funext (tensorLinearCoefficients_cross_normalized hN n g hg g0) + rw [Real.sqrt_zero,hc,randomReplicaAverage_zero_reference] at hd + simp only [referenceReplicaMean_const_mul,integral_const_mul] at hd + exact hd + +lemma priorFieldInsertionMean_right_derivative {N m k n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt (priorFieldInsertionMean μ ν eig c I degree amp r h g) + (-priorNamespacedReplicaAverage μ ν eig c I degree amp r h + (fun _ => tensorFieldPairObservable g)/2) (Ici 0) 0 := by + have hd := priorFieldCGFMean_right_derivative hN μ ν eig c I degree amp r h g hg g0 + have hm := ((hd.div_const (N : ℝ)).const_add + (priorNamespacedMeanPressure μ ν eig c I degree amp r h)).fun_sub + (((hasDerivAt_id (0 : ℝ)).mul_const (g n)).div_const 2).hasDerivWithinAt + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN.ne' + have he : (N*g n-N*priorNamespacedReplicaAverage μ ν eig c I degree amp r h + (fun _ => tensorFieldPairObservable g))/2/N-1*g n/2 = + -priorNamespacedReplicaAverage μ ν eig c I degree amp r h + (fun _ => tensorFieldPairObservable g)/2 := by + field_simp + ring + rw [he] at hm + exact hm + +lemma priorFieldInsertedLog_cgf_fold {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (hg : Monotone g) (g0 : 0 ≤ g 0) (a : ℝ) : + ∀ᵐ p ∂(μ.prod gaussianCoordinates).prod gaussianCoordinates, + priorFieldInsertedLog ν eig c I degree amp r h g a p = + priorNamespacedLog ν eig c I degree amp (fun i => tensorPathProfile I degree n r h i) p.1+ + cgf (fun x => cylinderField (tensorLinearCoefficients n g x) p.2) + (priorNamespacedReference ν eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) p.1) (Real.sqrt a) := by + have he := random_cgf_insertion_eq (ν := fun _ : SpecialOrthogonal N × (ℕ → ℝ) => ν) + measurable_const (measurable_priorNamespacedHamiltonian eig c I degree amp _) + (priorNamespaced_exp_integrable_ae μ ν eig c I degree amp r h hh h0) + (tensorLinearCoefficients n g) (fun x => (tensorLinearCoefficients_variance n g hg g0 x).le) + (Real.sqrt a) + filter_upwards [he] with p hp + change cgf _ (priorNamespacedReference ν eig c I degree amp _ p.1) (Real.sqrt a) = + priorFieldInsertedLog ν eig c I degree amp r h g a p- + priorNamespacedLog ν eig c I degree amp _ p.1 at hp + linarith + +theorem priorNamespacedMeanPressure_field_insert + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m k n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (hg : Monotone g) (g0 : 0 ≤ g 0) (a : ℝ) (ha : 0 ≤ a) : + priorNamespacedMeanPressure μ ν eig c I degree amp r (fun i => h i+a*g i) = + priorFieldInsertionMean μ ν eig c I degree amp r h g a := by + let Q := μ.prod gaussianCoordinates + let F := priorNamespacedLog ν eig c I degree amp (fun i => tensorPathProfile I degree n r h i) + let C := fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ) => + cgf (fun x => cylinderField (tensorLinearCoefficients n g x) p.2) + (priorNamespacedReference ν eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) p.1) (Real.sqrt a) + have hiF : Integrable F Q := priorNamespacedLog_integrable hhaar hgauss hN μ hμ ν eig c I + degree amp (fun i => varianceIncrement h i) (fun i j => varianceIncrement (monomialPath n (r j)) i) + have hiC : Integrable C (Q.prod gaussianCoordinates) := integrable_random_cylinder_cgf + (measurable_priorNamespacedReference ν eig c I degree amp _) + (tensorLinearCoefficients n g) (fun x => (tensorLinearCoefficients_variance n g hg g0 x).le) (Real.sqrt a) + have hmean : (∫ p, priorNamespacedLog ν eig c I degree amp + (fun j => tensorPathProfile I degree n r (fun i => h i+a*g i) j) p ∂Q) = + (∫ p, F p ∂Q)+∫ p, C p ∂Q.prod gaussianCoordinates := by + calc + _ = ∫ p, priorFieldInsertedLog ν eig c I degree amp r h g a p ∂Q.prod gaussianCoordinates := + (priorFieldInsertedLog_identDistrib μ ν eig c I degree amp r h g hh h0 hg g0 a ha).integral_eq.symm + _ = ∫ p, F p.1+C p ∂Q.prod gaussianCoordinates := + integral_congr_ae (priorFieldInsertedLog_cgf_fold μ ν eig c I degree amp r h g hh h0 hg g0 a) + _ = (∫ p, F p.1 ∂Q.prod gaussianCoordinates)+∫ p, C p ∂Q.prod gaussianCoordinates := + integral_add (hiF.comp_fst gaussianCoordinates) hiC + _ = _ := by rw [integral_fun_fst F,probReal_univ,one_smul] + unfold priorNamespacedMeanPressure priorFieldInsertionMean priorFieldCGFMean + rw [hmean] + change (N : ℝ)⁻¹*((∫ p, F p ∂Q)+∫ p, C p ∂Q.prod gaussianCoordinates)-(h n+a*g n)/2 = + ((N : ℝ)⁻¹*(∫ p, F p ∂Q)-h n/2)+(∫ p, C p ∂Q.prod gaussianCoordinates)/N-a*g n/2 + ring + +theorem priorNamespacedMeanPressure_field_right_derivative + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m k n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) + (h g : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt + (fun a => priorNamespacedMeanPressure μ ν eig c I degree amp r (fun i => h i+a*g i)) + (-priorNamespacedReplicaAverage μ ν eig c I degree amp r h + (fun _ => tensorFieldPairObservable g)/2) (Ici 0) 0 := by + apply (priorFieldInsertionMean_right_derivative (by omega) μ ν eig c I degree amp r h g hg g0).congr_of_eventuallyEq + · filter_upwards [self_mem_nhdsWithin] with a ha + exact priorNamespacedMeanPressure_field_insert hhaar hgauss hN μ hμ ν eig c I degree amp r h g hh h0 hg g0 a ha + · exact priorNamespacedMeanPressure_field_insert hhaar hgauss hN μ hμ ν eig c I degree amp r h g hh h0 hg g0 0 le_rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldInsertionLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldInsertionLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..baee5ec00a6fba070384ac63df6766c369fe36db --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldInsertionLaw.lean @@ -0,0 +1,160 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorFieldDerivativeLaw +import OAI.Probability.InvariantIsing.Fields.PriorTemperatureCGF + +namespace OAI + +/-! Exact Gaussian insertion for a fixed constrained spin/leaf prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def priorFieldInsertedLog {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) + (p : (SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ)) : ℝ := + Real.log (∫ x : Spin N × LabeledLeaf n, Real.exp + (priorNamespacedHamiltonian (n := n) eig c I degree amp (fun i => tensorPathProfile I degree n treeDegree h i) p.1 x + + Real.sqrt a * cylinderField (tensorLinearCoefficients n g x) p.2) + ∂ν) + +def priorFieldInsertedHamiltonian {N m k n : ℕ} (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) + (p : (SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ)) (x : Spin N × LabeledLeaf n) : ℝ := + priorNamespacedHamiltonian (n := n) eig c I degree amp (fun i => tensorPathProfile I degree n treeDegree h i) p.1 x + + Real.sqrt a * cylinderField (tensorLinearCoefficients n g x) p.2 + +lemma measurable_priorFieldInsertedHamiltonian {N m k n : ℕ} (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) : + Measurable (Function.uncurry (priorFieldInsertedHamiltonian (n := n) eig c I degree amp treeDegree h g a)) := by + have hm : Measurable (fun p : ((SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + (p.1.1,p.2)) := measurable_fst.fst.prodMk measurable_snd + have hM := (measurable_priorNamespacedHamiltonian (n := n) eig c I degree amp (fun i => tensorPathProfile I degree n treeDegree h i)).comp hm + have hH : Measurable (fun p : ((SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + priorNamespacedHamiltonian (n := n) eig c I degree amp (fun i => tensorPathProfile I degree n treeDegree h i) p.1.1 p.2) := by + convert hM using 1 + rfl + have hG : Measurable (fun p : ((SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + Real.sqrt a * cylinderField (tensorLinearCoefficients n g p.2) p.1.2) := by + apply measurable_from_prod_countable_left + intro x + have hx : Measurable (fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × (ℕ → ℝ) => + cylinderField (tensorLinearCoefficients n g x) p.2) := + (measurable_cylinderField (tensorLinearCoefficients n g x)).comp measurable_snd + exact hx.const_mul _ + exact hH.add hG + +lemma measurable_priorFieldInsertedLog {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) : + Measurable (priorFieldInsertedLog ν eig c I degree amp treeDegree h g a) := by + have hm := measurable_priorFieldInsertedHamiltonian (n := n) eig c I degree amp treeDegree h g a + exact hm.exp.stronglyMeasurable.integral_prod_right'.measurable.log + +lemma priorFieldInsertedLog_conditional_law {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (U : SpecialOrthogonal N) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) + (a : ℝ) (ha : 0 ≤ a) : + (gaussianCoordinates.prod gaussianCoordinates).map (fun z : (ℕ → ℝ) × (ℕ → ℝ) => + priorFieldInsertedLog ν eig c I degree amp treeDegree h g a ((U,z.1),z.2)) = + gaussianCoordinates.map (fun z => priorNamespacedLog ν eig c I degree amp + (fun j => tensorPathProfile I degree n treeDegree (fun i => h i+a*g i) j) (U,z)) := by + let H := fun x : Spin N × LabeledLeaf n => + rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1 + let K := fun F : (Spin N × LabeledLeaf n → ℝ) => Real.log (∫ x, Real.exp (H x + F x) ∂ν) + have : ∀ F : (Spin N × LabeledLeaf n → ℝ), IsProbabilityMeasure ((fun _ => ν) F) := + fun _ => by change IsProbabilityMeasure ν; infer_instance + have hE : Measurable (fun p : (Spin N × LabeledLeaf n → ℝ) × (Spin N × LabeledLeaf n) => + H p.2 + p.1 p.2) := by + apply measurable_from_prod_countable_left + intro x + have hx : Measurable (fun _ : Spin N × LabeledLeaf n → ℝ => H x) := measurable_const + exact hx.add (measurable_pi_apply x) + have hK : Measurable K := (measurable_random_referencePartition + (ν := fun _ : Spin N × LabeledLeaf n → ℝ => ν) measurable_const hE).log + let A : Spin N × LabeledLeaf n → ℕ →₀ ℝ := tensorNamespacedCoefficients (specialRotation U) I degree amp n + (fun i => tensorPathProfile I degree n treeDegree h i) + let B : Spin N × LabeledLeaf n → ℕ →₀ ℝ := tensorLinearCoefficients n g + let C : Spin N × LabeledLeaf n → ℕ →₀ ℝ := tensorNamespacedCoefficients (specialRotation U) I degree amp n + (fun i => tensorPathProfile I degree n treeDegree (fun j => h j + a * g j) i) + have hf : Measurable (fun z : (ℕ → ℝ) × (ℕ → ℝ) => + fun x => cylinderField (A x) z.1 + Real.sqrt a * cylinderField (B x) z.2) := + Measurable.of_eval (fun x => ((measurable_cylinderField (A x)).comp measurable_fst).add + (((measurable_cylinderField (B x)).comp measurable_snd).const_mul _)) + have hc : Measurable (fun z => fun x => cylinderField (C x) z) := + Measurable.of_eval (fun x => measurable_cylinderField (C x)) + have he := cylinder_independent_sum_law A B C (Real.sqrt a) (fun x y => by + rw [Real.sq_sqrt ha] + exact tensorNamespacedPath_field_add_cross (specialRotation U) I degree amp n treeDegree h g hh h0 hg g0 a ha x y) + have hl : (fun z : (ℕ → ℝ) × (ℕ → ℝ) => + priorFieldInsertedLog ν eig c I degree amp treeDegree h g a ((U,z.1),z.2)) = + K ∘ (fun z => fun x => cylinderField (A x) z.1 + Real.sqrt a * cylinderField (B x) z.2) := by + funext z + apply congrArg Real.log + apply integral_congr_ae + refine ae_of_all _ fun x => ?_ + apply congrArg Real.exp + dsimp [priorNamespacedHamiltonian, H, A, B] + ring + change _ = gaussianCoordinates.map (K ∘ (fun z => fun x => cylinderField (C x) z)) + rw [hl, ← Measure.map_map hK hf, ← Measure.map_map hK hc, he] + +private lemma priorField_joint_map_eq {Ω A B E : Type*} + [MeasurableSpace Ω] [MeasurableSpace A] [MeasurableSpace B] [MeasurableSpace E] + (P : Measure Ω) (Q : Measure A) (R : Measure B) [SFinite Q] [SFinite R] + (f : Ω × A → E) (g : Ω × B → E) (hf : Measurable f) (hg : Measurable g) + (he : ∀ ω, Q.map (fun z => f (ω,z)) = R.map (fun z => g (ω,z))) : + (P.prod Q).map f = (P.prod R).map g := by + apply Measure.ext + intro s hs + rw [Measure.map_apply hf hs, Measure.map_apply hg hs, + Measure.prod_apply (hf hs), Measure.prod_apply (hg hs)] + apply lintegral_congr_ae + refine ae_of_all _ fun ω => ?_ + have h := congrArg (fun ν : Measure E => ν s) (he ω) + have hfω : Measurable (fun z => f (ω,z)) := hf.comp (measurable_const.prodMk measurable_id) + have hgω : Measurable (fun z => g (ω,z)) := hg.comp (measurable_const.prodMk measurable_id) + rw [Measure.map_apply hfω hs, Measure.map_apply hgω hs] at h + exact h + +theorem priorFieldInsertedLog_identDistrib {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) + (a : ℝ) (ha : 0 ≤ a) : + IdentDistrib (priorFieldInsertedLog ν eig c I degree amp treeDegree h g a) + (priorNamespacedLog ν eig c I degree amp + (fun j => tensorPathProfile I degree n treeDegree (fun i => h i+a*g i) j)) + ((μ.prod gaussianCoordinates).prod gaussianCoordinates) + (μ.prod gaussianCoordinates) := by + let P := μ + let F := fun p : SpecialOrthogonal N × ((ℕ → ℝ) × (ℕ → ℝ)) => + priorFieldInsertedLog ν eig c I degree amp treeDegree h g a ((p.1,p.2.1),p.2.2) + let G := priorNamespacedLog (n := n) ν eig c I degree amp + (fun j => tensorPathProfile I degree n treeDegree (fun i => h i+a*g i) j) + have hf : Measurable F := (measurable_priorFieldInsertedLog ν eig c I degree amp treeDegree h g a).comp + MeasurableEquiv.prodAssoc.symm.measurable + have hg' : Measurable G := measurable_priorNamespacedLog ν eig c I degree amp _ + have he := priorField_joint_map_eq P (gaussianCoordinates.prod gaussianCoordinates) gaussianCoordinates + F G hf hg' (fun ω => priorFieldInsertedLog_conditional_law ν eig c ω I degree amp treeDegree h g hh h0 hg g0 a ha) + have hs := measurePreserving_prodAssoc P gaussianCoordinates gaussianCoordinates + refine ⟨(measurable_priorFieldInsertedLog ν eig c I degree amp treeDegree h g a).aemeasurable, + hg'.aemeasurable, ?_⟩ + change ((P.prod gaussianCoordinates).prod gaussianCoordinates).map + (F ∘ (MeasurableEquiv.prodAssoc : (SpecialOrthogonal N × (ℕ → ℝ)) × + (ℕ → ℝ) → SpecialOrthogonal N × ((ℕ → ℝ) × (ℕ → ℝ)))) = + (P.prod gaussianCoordinates).map G + rw [← Measure.map_map hf hs.measurable, hs.map_eq] + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldLogNormalizer.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldLogNormalizer.lean new file mode 100644 index 0000000000000000000000000000000000000000..a225419a40aebc42509b65fe9b668c23918d2674 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFieldLogNormalizer.lean @@ -0,0 +1,201 @@ +import OAI.Probability.InvariantIsing.Fields.FieldLogNormalizer +import OAI.Probability.InvariantIsing.Cavity.CavityRootIntegration + +namespace OAI + +/-! Logarithmic field normalizers for a deterministic finite spin prior, +with joint root/forest integrability proved from the actual recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma prior_field_energy_recursion (N n : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (z : Fin N → ℝ) : + energyRecursion n b (fun i => fieldEnergyMarkLaw N (v i)) + π (fieldEnergy z) = + cascadeRecursion n b (fun i => vectorGaussianLaw N (v i)) + (fun _ p => p.1 + p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) z := by + induction n generalizing b v z with + | zero => rfl + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + let G := energyRecursion n bs (fun i => fieldEnergyMarkLaw N (vs i)) + π + have hmG : Measurable G := measurable_energyRecursion _ _ _ _ + change Real.log (∫ a, Real.exp (b 0 * G (fieldEnergy z + a)) + ∂(fieldEnergyMarkLaw N (v 0) : Measure (Spin N → ℝ))) / b 0 = + Real.log (∫ a, Real.exp (b 0 * cascadeRecursion n bs + (fun i => vectorGaussianLaw N (vs i)) (fun _ p => p.1 + p.2) + (fun y => finiteLogIntegral π (fieldEnergy y)) (z + a)) + ∂(vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ))) / b 0 + congr 2 + have hm : Measurable (fun a : Spin N → ℝ => + Real.exp (b 0 * G (fieldEnergy z + a))) := + ((hmG.comp (measurable_const.add measurable_id)).const_mul (b 0)).exp + rw [show (fieldEnergyMarkLaw N (v 0) : Measure (Spin N → ℝ)) = + (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)).map (fieldEnergy (N := N)) from rfl, + integral_map (measurable_fieldEnergy_map N).aemeasurable hm.aestronglyMeasurable] + apply integral_congr_ae + refine ae_of_all _ fun a => ?_ + have hadd : fieldEnergy (z + a) = fieldEnergy z + fieldEnergy a := by + ext σ + simp only [fieldEnergy, Pi.add_apply, add_mul, Finset.sum_add_distrib] + dsimp only + rw [← hadd] + exact congrArg (fun x => Real.exp (b 0 * x)) (ih bs vs (z + a)) + +def priorFieldVectorLogNormalizer (N : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : ℝ := + Real.log (∫ s : Spin N × LabeledLeaf h.depth, + Real.exp (fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) + ∂(π.prod (labeledLeafLaw h.depth p.1))) + +lemma measurable_priorFieldVectorLogNormalizer (N : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (h : FieldStep) : + Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + priorFieldVectorLogNormalizer N π h p.1 p.2) := by + have hm := (measurable_labeledEnergyLog h.depth + π).comp + (show Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + (fieldEnergy p.1, (p.2.1, markForestOfCoords (Spin N → ℝ) h.depth + (fieldEnergyCoordinates N h p.2).2))) from by + have hf := measurable_fieldEnergy_map N + have hc := measurable_fieldEnergyCoordinates N h + fun_prop) + simp only [Function.comp_def, labeledEnergyLog, fieldEnergyCoordinates] at hm + simp_rw [field_labeled_energy] at hm + exact hm + +theorem prior_field_vector_log_conditional (N : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (hN : 0 < N) (h : FieldStep) + (z : Fin N → ℝ) : + let b := chainExponent h.cut + let μ := fun i => fieldEnergyMarkLaw N (fieldStepVariance h i) + let X := energyRecursion h.depth b μ π (fieldEnergy z) + Integrable (priorFieldVectorLogNormalizer N π h z) (fieldVectorCoordinateLaw N h) ∧ + (∫ p, priorFieldVectorLogNormalizer N π h z p ∂fieldVectorCoordinateLaw N h) = X ∧ + Integrable (fun p => (priorFieldVectorLogNormalizer N π h z p - X)^2) + (fieldVectorCoordinateLaw N h) ∧ + (∫ p, (priorFieldVectorLogNormalizer N π h z p - X)^2 ∂fieldVectorCoordinateLaw N h) ≤ + 4 * ∫ T, (Real.log (rawTreeTotal h.depth T).toReal)^2 + ∂(rawCascadeLaw h.depth b : Measure (RawTree h.depth)) := by + intro b μ X + let ν : Measure (Spin N) := π + have hb : CascadeExponents h.depth b := chainExponent_admissible h.ordered_cut h.first h.last + have hμ : ∀ i < h.depth, ExponentialNormMoments (μ i : Measure (Spin N → ℝ)) := + fun i _ => fieldEnergyMarkLaw_moments N hN (fieldStepVariance h i) + let T := fun p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ) => + labeledNoiseJoin (Spin N → ℝ) h.depth + ((fieldEnergyCoordinates N h p).1, + markForestOfCoords (Spin N → ℝ) h.depth (fieldEnergyCoordinates N h p).2) + have hp : MeasurePreserving T (fieldVectorCoordinateLaw N h) + (noiseCascadeLaw (Spin N → ℝ) h.depth b μ : Measure _) := + (show MeasurePreserving (labeledNoiseJoin (Spin N → ℝ) h.depth) + ((labeledCascadeLaw h.depth b : Measure (LabeledTree h.depth)).prod + (markForestLaw (Spin N → ℝ) h.depth μ)) + (noiseCascadeLaw (Spin N → ℝ) h.depth b μ : Measure _) from + ⟨measurable_labeledNoiseJoin _ _, labeledNoiseJoin_law _ _ _ _⟩).comp + ((cascadeCoordinates_preserving h.depth b μ).comp (fieldEnergyCoordinates_law N h)) + have he0 := ((cascadeCoordinates_preserving h.depth b μ).comp + (fieldEnergyCoordinates_law N h)).quasiMeasurePreserving.ae + (labeledEnergyLog_eq_cascade h.depth b hb μ ν (fieldEnergy z)) + have he : priorFieldVectorLogNormalizer N π h z =ᵐ[fieldVectorCoordinateLaw N h] + fun p => cascadeEnergyLog h.depth b μ ν (fieldEnergy z) (T p) := by + filter_upwards [he0] with p hpe + simp only [Function.comp_def, labeledEnergyLog, fieldEnergyCoordinates] at hpe + simp_rw [field_labeled_energy] at hpe + exact hpe + have hc := cascadeEnergyLog_conditional h.depth b hb μ ν hμ (fieldEnergy z) + have hs : (fun p => (priorFieldVectorLogNormalizer N π h z p - X)^2) + =ᵐ[fieldVectorCoordinateLaw N h] + (fun p => (cascadeEnergyLog h.depth b μ ν (fieldEnergy z) (T p) - X)^2) := + he.fun_comp (fun x => (x - X)^2) + refine ⟨(hp.integrable_comp_of_integrable hc.1).congr he.symm, ?_, + (hp.integrable_comp_of_integrable hc.2.2.1).congr hs.symm, ?_⟩ + · rw [integral_congr_ae he] + exact (integral_comp_preserving_ae hp hc.1.aestronglyMeasurable).trans hc.2.1 + · rw [integral_congr_ae hs, + integral_comp_preserving_ae hp hc.2.2.1.aestronglyMeasurable] + exact hc.2.2.2 + +lemma prior_field_vector_root_recursion_integrable (N : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (hN : 0 < N) (h : FieldStep) + (root : ℝ≥0) : + Integrable (fun z => energyRecursion h.depth (chainExponent h.cut) + (fun i => fieldEnergyMarkLaw N (fieldStepVariance h i)) + π (fieldEnergy z)) + (vectorGaussianLaw N root : Measure (Fin N → ℝ)) := by + let G := energyRecursion h.depth (chainExponent h.cut) + (fun i => fieldEnergyMarkLaw N (fieldStepVariance h i)) + π + have hG : Measurable G := measurable_energyRecursion _ _ _ _ + obtain ⟨C, L, _, hL, hbound⟩ := energyRecursion_linearGrowth h.depth (chainExponent h.cut) + (fun i => fieldEnergyMarkLaw N (fieldStepVariance h i)) + π + (fun i _ => fieldEnergyMarkLaw_moments N hN (fieldStepVariance h i)) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + have hi : Integrable G (fieldEnergyMarkLaw N root : Measure (Spin N → ℝ)) := by + apply ((integrable_const C).add (((fieldEnergyMarkLaw_moments N hN root) 1).const_mul L)).mono' + hG.aestronglyMeasurable + apply ae_of_all + intro y + rw [Real.norm_eq_abs] + calc + |G y| ≤ C + L * ‖y‖ := hbound y + _ ≤ C + L * Real.exp (1 * ‖y‖) := by + gcongr + simpa only [one_mul] using (le_add_of_nonneg_right zero_le_one).trans + (Real.add_one_le_exp ‖y‖) + exact (integrable_map_measure hG.aestronglyMeasurable + (measurable_fieldEnergy_map N).aemeasurable).mp hi + +theorem prior_field_vector_log_root_integral (N : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (hN : 0 < N) (h : FieldStep) + (root : ℝ≥0) : + Integrable (fun p => priorFieldVectorLogNormalizer N π h p.1 p.2) + ((vectorGaussianLaw N root : Measure (Fin N → ℝ)).prod (fieldVectorCoordinateLaw N h)) ∧ + (∫ p, priorFieldVectorLogNormalizer N π h p.1 p.2 + ∂(vectorGaussianLaw N root : Measure (Fin N → ℝ)).prod (fieldVectorCoordinateLaw N h)) = + ∫ z, cascadeRecursion h.depth (chainExponent h.cut) + (fun i => vectorGaussianLaw N (fieldStepVariance h i)) + (fun _ p => p.1 + p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) z + ∂(vectorGaussianLaw N root : Measure (Fin N → ℝ)) := by + have hh := cavity_joint_integral_of_centered_square + (vectorGaussianLaw N root : Measure (Fin N → ℝ)) (fieldVectorCoordinateLaw N h) + (fun p => priorFieldVectorLogNormalizer N π h p.1 p.2) + (fun z => energyRecursion h.depth (chainExponent h.cut) + (fun i => fieldEnergyMarkLaw N (fieldStepVariance h i)) + π (fieldEnergy z)) + (measurable_priorFieldVectorLogNormalizer N π h) + ((measurable_energyRecursion _ _ _ _).comp (measurable_fieldEnergy_map N)) + (prior_field_vector_root_recursion_integrable N π hN h root) + (fun z => (prior_field_vector_log_conditional N π hN h z).2.2.1) + ⟨_, fun z => (prior_field_vector_log_conditional N π hN h z).2.2.2⟩ + (fun z => (prior_field_vector_log_conditional N π hN h z).2.1) + exact ⟨hh.1, hh.2.trans (by simp_rw [prior_field_energy_recursion])⟩ + +theorem prior_field_vector_spin_exp_integrable (N : ℕ) (π : Measure (Spin N)) [IsProbabilityMeasure π] (hN : 0 < N) (h : FieldStep) + (z : Fin N → ℝ) : + ∀ᵐ p ∂fieldVectorCoordinateLaw N h, + Integrable (fun s : Spin N × LabeledLeaf h.depth => + Real.exp (fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1)) + (π.prod (labeledLeafLaw h.depth p.1)) := by + have he := (fieldEnergyCoordinates_law N h).quasiMeasurePreserving.ae + (cascadeCoordinate_exp_integrable h.depth (chainExponent h.cut) + (chainExponent_admissible h.ordered_cut h.first h.last) + (fun i => fieldEnergyMarkLaw N (fieldStepVariance h i)) + π + (fun i _ => fieldEnergyMarkLaw_moments N hN (fieldStepVariance h i)) (fieldEnergy z)) + filter_upwards [he] with p hp + change Integrable (fun s => Real.exp (cascadeCoordinateEnergy h.depth (fieldEnergy z) + (fieldEnergyCoordinates N h p) s)) + (π.prod (labeledLeafLaw h.depth p.1)) at hp + simpa only [fieldEnergyCoordinates_energy] using hp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFiniteGG.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFiniteGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..29ae7ae440f64af33c25e4bdc3ad0ccf3ef05539 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFiniteGG.lean @@ -0,0 +1,190 @@ +import OAI.Probability.InvariantIsing.Fields.PriorKernelDiagonal + +namespace OAI + +/-! The actual finite constrained-prior spectral Ghirlanda–Guerra residual. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +def priorSpectralGGResidual {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν₀ : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (D : SpecialOrthogonal N → (Fin (q + 1) → Spin N × LabeledLeaf n) → ℝ) : ℝ := + let avg := fun (q' : ℕ) (F : SpecialOrthogonal N → (Fin q' → Spin N × LabeledLeaf n) → ℝ) => + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h F + let κ := spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) I (degree j) n (r j) + (q + 1 : ℕ) * avg (q + 1 + 1) + (fun U τ => D U (Fin.tail τ) * κ U ((Fin.tail τ) 0) (τ 0)) - + avg (q + 1) D * avg 2 (fun U τ => κ U (τ 1) (τ 0)) - + avg (q + 1) + (fun U σ => D U σ * ∑ l : Fin q, κ U (σ 0) (σ l.succ)) + +private lemma measurable_ggFresh {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + {q : ℕ} (D : Ω → (Fin (q + 1) → X) → ℝ) (κ : Ω → X → X → ℝ) + (hD : Measurable (Function.uncurry D)) + (hκ : Measurable (fun p : Ω × (X × X) => κ p.1 p.2.1 p.2.2)) : + Measurable (Function.uncurry (fun V (τ : Fin (q + 1 + 1) → X) => + D V (Fin.tail τ) * κ V ((Fin.tail τ) 0) (τ 0))) := by + have ht : Measurable (fun p : Ω × (Fin (q + 1 + 1) → X) => (p.1, Fin.tail p.2)) := + measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_pi_apply a.succ).comp measurable_snd) + have hk : Measurable (fun p : Ω × (Fin (q + 1 + 1) → X) => + (p.1, ((Fin.tail p.2) 0, p.2 0))) := + measurable_fst.prodMk (((measurable_pi_apply (0 : Fin (q + 1)).succ).comp measurable_snd).prodMk + ((measurable_pi_apply 0).comp measurable_snd)) + exact (hD.comp ht).mul (hκ.comp hk) + +private lemma measurable_ggPair {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + (κ : Ω → X → X → ℝ) + (hκ : Measurable (fun p : Ω × (X × X) => κ p.1 p.2.1 p.2.2)) : + Measurable (Function.uncurry (fun V (τ : Fin 2 → X) => κ V (τ 1) (τ 0))) := by + have h1 : Measurable (fun p : Ω × (Fin 2 → X) => p.2 1) := + (measurable_pi_apply 1).comp measurable_snd + have h0 : Measurable (fun p : Ω × (Fin 2 → X) => p.2 0) := + (measurable_pi_apply 0).comp measurable_snd + exact hκ.comp (measurable_fst.prodMk (h1.prodMk h0)) + +private lemma measurable_ggOld {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + {q : ℕ} (D : Ω → (Fin (q + 1) → X) → ℝ) (κ : Ω → X → X → ℝ) + (hD : Measurable (Function.uncurry D)) + (hκ : Measurable (fun p : Ω × (X × X) => κ p.1 p.2.1 p.2.2)) : + Measurable (Function.uncurry (fun V (σ : Fin (q + 1) → X) => + D V σ * ∑ l : Fin q, κ V (σ 0) (σ l.succ))) := by + apply hD.mul + apply Finset.measurable_sum + intro l _ + have h0 : Measurable (fun p : Ω × (Fin (q + 1) → X) => p.2 0) := + (measurable_pi_apply 0).comp measurable_snd + have hl : Measurable (fun p : Ω × (Fin (q + 1) → X) => p.2 l.succ) := + (measurable_pi_apply l.succ).comp measurable_snd + exact hκ.comp (measurable_fst.prodMk (h0.prodMk hl)) + +theorem priorFiniteGG_bound {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (β d₀ e C : ℝ) (hC : 0 ≤ C) + (D : SpecialOrthogonal N → (Fin (q + 1) → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hDb : ∀ U σ, |D U σ| ≤ C) + (hE : + let A := spectralPerturbationCoefficients (fun ω : PriorFrozenData N j => ω.1) + I (degree j) n (r j) + let ν := priorFrozenReference ν₀ eig c I degree amplitude r h j + let E := fun p : PriorFrozenData N j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2 - β| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + Integrable E ((priorFrozenLaw μ j).prod gaussianCoordinates) ∧ + (∫ p, E p ∂(priorFrozenLaw μ j).prod gaussianCoordinates) ≤ e) : + |amplitude j| * |priorSpectralGGResidual μ ν₀ eig c I degree amplitude r h j D| ≤ + 2 * C * (e + |amplitude j| * priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) + I (degree j) n (r j) U x x - d₀|)) := by + let U := fun ω : PriorFrozenData N j => ω.1 + let κ := spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) I (degree j) n (r j) + let ν := priorFrozenReference ν₀ eig c I degree amplitude r h j + let A := spectralPerturbationCoefficients U I (degree j) n (r j) + have hκ : Measurable (fun p : SpecialOrthogonal N × + ((Spin N × LabeledLeaf n) × (Spin N × LabeledLeaf n)) => κ p.1 p.2.1 p.2.2) := by + simpa only [spectralPerturbationCoefficients_cross] using + measurable_spectralPerturbationCross (id : SpecialOrthogonal N → SpecialOrthogonal N) + measurable_id I (degree j) n (r j) + let fresh := fun (V : SpecialOrthogonal N) (τ : Fin (q + 1 + 1) → Spin N × LabeledLeaf n) => + D V (Fin.tail τ) * κ V ((Fin.tail τ) 0) (τ 0) + let pair := fun (V : SpecialOrthogonal N) (τ : Fin 2 → Spin N × LabeledLeaf n) => κ V (τ 1) (τ 0) + let old := fun (V : SpecialOrthogonal N) (σ : Fin (q + 1) → Spin N × LabeledLeaf n) => + D V σ * ∑ l : Fin q, κ V (σ 0) (σ l.succ) + have hfresh : Measurable (Function.uncurry fresh) := measurable_ggFresh D κ hD hκ + have hpair : Measurable (Function.uncurry pair) := measurable_ggPair κ hκ + have hold : Measurable (Function.uncurry old) := measurable_ggOld D κ hD hκ + have hdiag : Measurable (Function.uncurry + (fun V x => |κ V x x - d₀|)) := + ((hκ.comp (measurable_fst.prodMk (measurable_snd.prodMk measurable_snd))).sub_const d₀).abs + have hg := spectralPerturbation_gg_bound (P := priorFrozenLaw μ j) U measurable_fst + I (degree j) (r j) (measurable_priorFrozenReference ν₀ eig c I degree amplitude r h j) + (amplitude j) β d₀ (fun ω => D (U ω)) + (hD.comp (measurable_fst.fst.prodMk measurable_snd)) hC (fun ω => hDb (U ω)) hE.1 + have heq (z : ℕ) (F : SpecialOrthogonal N → (Fin z → Spin N × LabeledLeaf n) → ℝ) + (hF : Measurable (Function.uncurry F)) : + randomCoefficientAverage (priorFrozenLaw μ j) ν A (amplitude j) (fun ω => F (U ω)) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree amplitude r h F := by + simpa only [Function.update_eq_self] using + priorFrozenGaussian_replicaAverage μ ν₀ eig c I degree amplitude r h hh h0 j (amplitude j) F hF + have hd := priorFrozenGaussian_observableAverage μ ν₀ eig c I degree amplitude r h hh h0 j + (amplitude j) (fun V x => |κ V x x - d₀|) hdiag + simp only [Function.update_eq_self] at hd + change |amplitude j| * |(q + 1 : ℕ) * + randomCoefficientAverage (priorFrozenLaw μ j) ν A (amplitude j) (fun ω => fresh (U ω)) - + randomCoefficientAverage (priorFrozenLaw μ j) ν A (amplitude j) (fun ω => D (U ω)) * + randomCoefficientAverage (priorFrozenLaw μ j) ν A (amplitude j) (fun ω => pair (U ω)) - + randomCoefficientAverage (priorFrozenLaw μ j) ν A (amplitude j) (fun ω => old (U ω))| ≤ _ at hg + rw [heq _ fresh hfresh, heq _ D hD, heq _ pair hpair, heq _ old hold] at hg + change |amplitude j| * |priorSpectralGGResidual μ ν₀ eig c I degree amplitude r h j D| ≤ + 2 * C * (_ + |amplitude j| * _) at hg + have hd' : (∫ p : PriorFrozenData N j × (ℕ → ℝ), ∫ x, + |spectralPerturbationKernel U I (degree j) n (r j) p.1 x x - d₀| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + ∂(priorFrozenLaw μ j).prod gaussianCoordinates) = + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun V x => |κ V x x - d₀|) := hd + rw [hd'] at hg + exact hg.trans (mul_le_mul_of_nonneg_left + (add_le_add hE.2 le_rfl) (mul_nonneg (by norm_num) hC)) + +end InvariantIsing +namespace InvariantIsing + +/-- Each individual self-overlap error controls every selected tensor +covariance. The Gaussian energy error is expressed in the same actual model. -/ +theorem priorFiniteGG_individualDiagonal_bound {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (β e C : ℝ) (hC : 0 ≤ C) (ha : 0 < |amplitude j|) + (D : SpecialOrthogonal N → (Fin (q + 1) → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hDb : ∀ U σ, |D U σ| ≤ C) + (center δ : Fin m → ℝ) + (hδ : ∀ a, priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|) ≤ δ a) + (hE : + let A := spectralPerturbationCoefficients (fun ω : PriorFrozenData N j => ω.1) + I (degree j) n (r j) + let ν := priorFrozenReference ν₀ eig c I degree amplitude r h j + let E := fun p : PriorFrozenData N j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2 - β| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + Integrable E ((priorFrozenLaw μ j).prod gaussianCoordinates) ∧ + (∫ p, E p ∂(priorFrozenLaw μ j).prod gaussianCoordinates) ≤ e) : + |priorSpectralGGResidual μ ν₀ eig c I degree amplitude r h j D| ≤ + 2 * C * (e / |amplitude j| + ∑ a, (degree j a : ℝ) * δ a) := by + let d₀ := (∏ a, spectralDiagonalCenter (center a) ^ degree j a) * + ((n : ℝ) / (n + 1 : ℕ)) ^ r j + have hg := priorFiniteGG_bound μ ν₀ eig c I degree amplitude r h hh h0 j β d₀ e C hC D hD hDb hE + have hd := priorKernelDiagonalError_le μ ν₀ eig c I degree amplitude r h (degree j) (r j) center + have hs : (∑ a, (degree j a : ℝ) * priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|)) ≤ + ∑ a, (degree j a : ℝ) * δ a := + Finset.sum_le_sum fun a _ => mul_le_mul_of_nonneg_left (hδ a) (Nat.cast_nonneg _) + have hb := hg.trans (mul_le_mul_of_nonneg_left + (add_le_add le_rfl (mul_le_mul_of_nonneg_left (hd.trans hs) ha.le)) + (mul_nonneg (by norm_num) hC)) + apply (mul_le_mul_iff_left₀ ha).mp + calc + _ ≤ 2 * C * (e + |amplitude j| * ∑ a, (degree j a : ℝ) * δ a) := by + simpa only [mul_comm] using hb + _ = (2 * C * (e / |amplitude j| + ∑ a, (degree j a : ℝ) * δ a)) * |amplitude j| := by + field_simp [ha.ne'] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFixedGeometricLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFixedGeometricLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c99460c936a91331ab738b2edcd7be085172989 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFixedGeometricLimit.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Fields.PriorGGExistence + +namespace OAI + +/-! Every prescribed sequence of actual prior minima has a geometric GG subsequence. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem prior_minimizers_geometric_GG_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 priorPerturbedArrayLaw (μ (φ k)) (ν (φ k)) (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k))) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) := by + let L := fun k => priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) + (u k) (v k) (t k) (h k) + let center := fun k => tensorMinimumArrayDiagonal (N k) n (v k) + obtain ⟨Q,q,φ,hφ,hL,hc⟩ := spectralArray_center_subsequence (m+1) L center + have hgg := priorPerturbation_minimizers_spectralGG hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) (fun k => ν (φ k)) + (fun k => eig (φ k)) (fun k => c (φ k)) K hK (fun k => heig (φ k)) + (fun k => I (φ k)) (fun k => u (φ k)) (fun k => hu (φ k)) + (fun k => v (φ k)) (fun k => hv (φ k)) (fun k => t (φ k)) (fun k => ht (φ k)) + (fun k => h (φ k)) (fun k => hh (φ k)) (fun k => h0 (φ k)) H (fun k => hH (φ k)) + (fun k => hmin (φ k)) Q hL + have hco : Continuous (fun z : Fin (m+1) → Set.Icc (0 : ℝ) 1 => fun a => (z a : ℝ)) := + continuous_pi fun a => continuous_subtype_val.comp (continuous_apply a) + have hd := priorPerturbation_minimizers_constantDiagonal hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) (fun k => ν (φ k)) + (fun k => eig (φ k)) (fun k => c (φ k)) K hK (fun k => heig (φ k)) + (fun k => I (φ k)) (fun k => u (φ k)) (fun k => hu (φ k)) + (fun k => v (φ k)) (fun k => hv (φ k)) (fun k => t (φ k)) (fun k => ht (φ k)) + (fun k => h (φ k)) (fun k => hh (φ k)) (fun k => h0 (φ k)) H (fun k => hH (φ k)) + (fun k => hmin (φ k)) Q hL (fun a => (q a : ℝ)) ((hco.tendsto q).comp hc) + have hg := spectralArray_limit_gram hL (fun k => priorPerturbedArrayLaw_gram + (μ (φ k)) (ν (φ k)) (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k))) + have hr : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q := by + intro e he + exact spectralArray_limit_reindex hL e (fun k => priorPerturbedArrayLaw_reindex + (μ (φ k)) (ν (φ k)) (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k)) e he) + exact ⟨Q,q,φ,hφ,hL,hgg,hd,hg,hr, + spectralGG_coordinate_nonnegative hgg hg (fun a => (q a : ℝ)) (fun a => (q a).property.1) hd⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFixedMinimumLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFixedMinimumLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..2125bfcb102424b246707ad9ed28e46e08d2988a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFixedMinimumLimit.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFixedGeometricLimit +import OAI.Probability.InvariantIsing.Fields.PriorGGWardExistence + +namespace OAI + +/-! The full GG/Ward subsequence retains any prescribed actual minima. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem prior_fixed_minimum_geometric_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) + (u : (k : ℕ) → Fin (N k) → ℝ) (hu : ∀ k j, u k j∈Set.Icc (1 : ℝ) 2) + (v : ℕ → Fin m → ℝ) (hv : ∀ k a, v k a∈Set.Icc (1 : ℝ) 2) + (hmin : ∀ k u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective (μ k) (ν k) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) (u k) (v k)≤ + priorPerturbationObjective (μ k) (ν k) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) u' v') : + ∃ Q : ProbabilityMeasure (SpectralArray (m+1)), + ∃ q : Fin (m+1) → Set.Icc (0 : ℝ) 1, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun k => priorPerturbedArrayLaw (μ (φ k)) (ν (φ k)) (eig (φ k)) (fun _ => 0) + (I (φ k)) (u (φ k)) (v (φ k)) 1 (fun _ => 0)) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) ∧ + (∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ r, |Φ r|≤B) → + spectralOffWardResidual Q ρ lam a b Φ=0) ∧ + (∀ a b, spectralDiagonalWardResidual Q ρ lam a b=0) := by + obtain ⟨Q,q,φ,hφ,hL,hgg,hd,hG,hE,hn⟩ := + prior_minimizers_geometric_GG_limit hhaar hgauss N hN hNlim m n μ hμinv ν + eig (fun _ _ => 0) K hK heig I (fun _ => 1) (fun _ => by norm_num) + (fun _ _ => 0) (fun _ => monotone_const) (fun _ => le_rfl) 0 (fun _ => le_rfl) u hu v hv hmin + have hpos k : 0 priorPerturbedArrayLaw_partition + (hpos k) (μ (φ k)) (ν (φ k)) (eig (φ k)) (fun _ => 0) (I (φ k)) + (hdis (φ k)) (hcover (φ k)) (u (φ k)) (v (φ k)) 1 (fun _ => 0)) + have hua k j : |u (φ k) j|≤2 := abs_le.mpr ⟨by linarith [(hu (φ k) j).1],(hu (φ k) j).2⟩ + have hva k a : |v (φ k) a|≤2 := abs_le.mpr ⟨by linarith [(hv (φ k) a).1],(hv (φ k) a).2⟩ + have hw := priorPerturbedArrayLaw_ward_limits (fun k => N (φ k)) hpos + (hNlim.comp hφ.tendsto_atTop) m n (fun k => μ (φ k)) (fun k => hμinv (φ k)) + (fun k => ν (φ k)) (fun k => eig (φ k)) (fun _ _ => 0) (fun k => I (φ k)) + (fun k => hdis (φ k)) (fun k => hcover (φ k)) lam (fun k => hlam (φ k)) + (fun k => u (φ k)) hua (fun k => v (φ k)) hva (fun _ => 1) tendsto_const_nhds + (fun _ _ => 0) (fun _ => monotone_const) (fun _ => le_rfl) Q hL ρ (hρ.comp hφ.tendsto_atTop) + simp only [one_mul] at hw + exact ⟨Q,q,φ,hφ,hL,hgg,hd,hG,hE,hpart,hn,hw.1,hw.2⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenCGF.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenCGF.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f70f715fbea71cd3860c9f3b2af596e5d148f0e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenCGF.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFrozenReference +import OAI.Probability.InvariantIsing.Pressure.PressureDifferenceConcentration + +namespace OAI + +/-! Log-partition differences and concentration of a selected prior perturbation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def priorFrozenCGF {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) (t : ℝ) + (p : PriorFrozenData N j × (ℕ → ℝ)) : ℝ := + cgf (fun x => cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1) I (degree j) n (r j) x) p.2) + (priorFrozenReference ν eig c I degree amplitude r h j p.1) t + +theorem priorFrozenCGF_eq_log_difference {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) (t : ℝ) : + priorFrozenCGF ν eig c I degree amplitude r h j t =ᵐ[(priorFrozenLaw μ j).prod gaussianCoordinates] + fun p => priorNamespacedLog ν eig c I degree (Function.update amplitude j t) + (fun i => tensorPathProfile I degree n r h i) (priorFrozenInsertion j p) - + priorNamespacedLog ν eig c I degree (Function.update amplitude j 0) + (fun i => tensorPathProfile I degree n r h i) (priorFrozenInsertion j p) := by + have hbase := (measurePreserving_fst (μ := priorFrozenLaw μ j) + (ν := gaussianCoordinates)).quasiMeasurePreserving.ae + (priorFrozenBase_exp_integrable_ae μ ν eig c I degree amplitude r h hh h0 j) + have hfull := (priorFrozenInsertion_preserving μ j).quasiMeasurePreserving.ae + (priorNamespaced_exp_integrable_ae μ ν eig c I degree (Function.update amplitude j t) r h hh h0) + filter_upwards [hbase,hfull] with p hb hf + let H : Spin N × LabeledLeaf n → ℝ := priorFrozenBaseEnergy eig c I degree amplitude r h j p.1 + let Y := fun x : Spin N × LabeledLeaf n => cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1) I (degree j) n (r j) x) p.2 + have he (a : ℝ) (x : Spin N × LabeledLeaf n) : + priorNamespacedHamiltonian eig c I degree (Function.update amplitude j a) + (fun i => tensorPathProfile I degree n r h i) (priorFrozenInsertion j p) x = H x+a*Y x := by + simpa only [H,Y,priorFrozenBaseEnergy,Function.update_idem,Function.update_self] using + priorFrozenHamiltonian_insert eig c I degree (Function.update amplitude j a) r h hh h0 j p.1 p.2 x + have hi : Integrable (fun x => Real.exp (H x+t*Y x)) ν := by + convert hf using 1 + funext x + exact congrArg Real.exp (he t x).symm + change cgf Y (gibbsProbability ν H) t = _ + rw [cgf_fold ν H Y t hb hi] + unfold priorNamespacedLog + simp only [he,zero_mul,add_zero] + rfl + +theorem priorFrozenCGF_statistics {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) (t B : ℝ) + (hF : ∀ a : ℝ, a=t ∨ a=0 → + MemLp (priorNamespacedLog ν eig c I degree (Function.update amplitude j a) + (fun i => tensorPathProfile I degree n r h i)) 2 (μ.prod gaussianCoordinates)) + (hv : ∀ a : ℝ, a=t ∨ a=0 → + variance (priorNamespacedLog ν eig c I degree (Function.update amplitude j a) + (fun i => tensorPathProfile I degree n r h i)) (μ.prod gaussianCoordinates) ≤ B) : + let P := (priorFrozenLaw μ j).prod gaussianCoordinates + let M := fun a => ∫ p, priorNamespacedLog ν eig c I degree (Function.update amplitude j a) + (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates + let Z := priorFrozenCGF ν eig c I degree amplitude r h j t + MemLp Z 2 P ∧ (∫ p, Z p ∂P)=M t-M 0 ∧ + (∫ p, |Z p-∫ p', Z p' ∂P| ∂P)≤2*Real.sqrt B := by + intro P M Z + let F := fun a => priorNamespacedLog ν eig c I degree (Function.update amplitude j a) + (fun i => tensorPathProfile I degree n r h i) + have hp := priorFrozenInsertion_preserving μ j + have he : Z =ᵐ[P] fun p => (1 : ℝ)*(F t (priorFrozenInsertion j p)-F 0 (priorFrozenInsertion j p)) := by + simpa only [one_mul] using priorFrozenCGF_eq_log_difference μ ν eig c I degree amplitude r h hh h0 j t + have ht := hF t (Or.inl rfl) + have hz := hF 0 (Or.inr rfl) + have hc := centered_scaled_difference_L1_bound P + (ht.comp_measurePreserving hp) (hz.comp_measurePreserving hp) + ((hp.variance_fun_comp ht.aemeasurable).trans_le (hv t (Or.inl rfl))) + ((hp.variance_fun_comp hz.aemeasurable).trans_le (hv 0 (Or.inr rfl))) he + refine ⟨hc.1,?_,?_⟩ + · rw [integral_congr_ae he] + simp only [one_mul] + calc + _ = (∫ p, F t (priorFrozenInsertion j p) ∂P) - + ∫ p, F 0 (priorFrozenInsertion j p) ∂P := + integral_sub ((ht.comp_measurePreserving hp).integrable (by norm_num)) + ((hz.comp_measurePreserving hp).integrable (by norm_num)) + _ = M t-M 0 := congrArg₂ (·-·) (hp.hasLaw.integral_comp ht.aestronglyMeasurable) + (hp.hasLaw.integral_comp hz.aestronglyMeasurable) + · simpa only [abs_one,mul_one,one_mul] using hc.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenGibbs.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenGibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f83dc1a64f4ca227f877070e6e435759097b6e1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenGibbs.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFrozenReference + +namespace OAI + +/-! Both selected perturbations reconstruct the same constrained Gibbs law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +theorem priorFrozenGaussian_reference_fold_ae {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) (t : ℝ) : + ∀ᵐ p : PriorFrozenData N j × (ℕ → ℝ) ∂(priorFrozenLaw μ j).prod gaussianCoordinates, + (priorFrozenReference ν eig c I degree amplitude r h j p.1).tilted + (fun x => t*cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1) I (degree j) n (r j) x) p.2) = + priorNamespacedReference ν eig c I degree (Function.update amplitude j t) + (fun i => tensorPathProfile I degree n r h i) (priorFrozenInsertion j p) := by + have hb := (measurePreserving_fst (μ := priorFrozenLaw μ j) + (ν := gaussianCoordinates)).quasiMeasurePreserving.ae + (priorFrozenBase_exp_integrable_ae μ ν eig c I degree amplitude r h hh h0 j) + have hf := (priorFrozenInsertion_preserving μ j).quasiMeasurePreserving.ae + (priorNamespaced_exp_integrable_ae μ ν eig c I degree (Function.update amplitude j t) r h hh h0) + filter_upwards [hb,hf] with p hbase hfull + let H : Spin N × LabeledLeaf n → ℝ := priorFrozenBaseEnergy eig c I degree amplitude r h j p.1 + let G := fun x : Spin N × LabeledLeaf n => t*cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1) I (degree j) n (r j) x) p.2 + have he : priorNamespacedHamiltonian eig c I degree (Function.update amplitude j t) + (fun i => tensorPathProfile I degree n r h i) (priorFrozenInsertion j p) = fun x => H x+G x := by + funext x + simpa only [H,G,priorFrozenBaseEnergy,Function.update_idem,Function.update_self] using + priorFrozenHamiltonian_insert eig c I degree (Function.update amplitude j t) r h hh h0 j p.1 p.2 x + have hi : Integrable (fun x => Real.exp (H x+G x)) ν := by + simpa only [he] using hfull + change (gibbsProbability ν H).tilted G = gibbsProbability ν _ + rw [he,gibbsProbability_eq_tilted ν H hbase, + gibbsProbability_eq_tilted ν (fun x => H x+G x) hi,tilted_tilted hbase G] + rfl + +theorem priorFrozenDiagonal_reference_fold_ae {N m k n : ℕ} (hN : 0 tensorPathProfile I degree n r h i) p).tilted + (fun x : Spin N × LabeledLeaf n => N*perturbationScale N*w* + projectedOverlap (specialRotation p.1) (I a) x.1 x.1) = + priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p := by + have hb := priorNamespaced_exp_integrable_ae μ ν + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude r h hh h0 + have hw := priorNamespaced_exp_integrable_ae μ ν + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude r h hh h0 + filter_upwards [hb,hw] with p hp₀ hpw + let H : Spin N × LabeledLeaf n → ℝ := priorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p + let G := fun x : Spin N × LabeledLeaf n => N*perturbationScale N*w* + projectedOverlap (specialRotation p.1) (I a) x.1 x.1 + have he : priorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p = fun x => H x+G x := by + funext x + dsimp only [priorNamespacedHamiltonian,H,G] + rw [rotatedEnergy_diagonal_coordinate hN eig (specialRotation p.1) I v t a w x.1] + ring + have hi : Integrable (fun x => Real.exp (H x+G x)) ν := by + simpa only [he] using hpw + change (gibbsProbability ν H).tilted G = gibbsProbability ν _ + rw [he,gibbsProbability_eq_tilted ν H hp₀, + gibbsProbability_eq_tilted ν (fun x => H x+G x) hi,tilted_tilted hp₀ G] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenReference.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..0371fd96bcd24b3f2976424d47fd5aa71bca0b74 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFrozenReference.lean @@ -0,0 +1,104 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorReference + +namespace OAI + +/-! Freezing one actual Gaussian perturbation coordinate with a fixed prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +abbrev PriorFrozenData (N j : ℕ) := SpecialOrthogonal N × OtherNamespaces (j+1) + +def priorFrozenLaw {N : ℕ} (μ : Measure (SpecialOrthogonal N)) (j : ℕ) : + Measure (PriorFrozenData N j) := μ.prod (otherNamespacesLaw (j+1)) + +instance priorFrozenLaw_probability {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] (j : ℕ) : IsProbabilityMeasure (priorFrozenLaw μ j) := by + unfold priorFrozenLaw + infer_instance + +def priorFrozenInsertion {N : ℕ} (j : ℕ) (p : PriorFrozenData N j × (ℕ → ℝ)) : + SpecialOrthogonal N × (ℕ → ℝ) := + (p.1.1,gaussianNamespaceJoin (j+1) (p.2,p.1.2)) + +lemma priorFrozenInsertion_preserving {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] (j : ℕ) : + MeasurePreserving (priorFrozenInsertion j) ((priorFrozenLaw μ j).prod gaussianCoordinates) + (μ.prod gaussianCoordinates) := namespaceInsertion_preserving μ (j+1) + +def priorFrozenBaseEnergy {N m k n : ℕ} (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (ω : PriorFrozenData N j) (x : Spin N × LabeledLeaf n) : ℝ := + priorNamespacedHamiltonian eig c I degree (Function.update amplitude j 0) + (fun i => tensorPathProfile I degree n r h i) + (ω.1,gaussianNamespaceJoin (j+1) (0,ω.2)) x + +def priorFrozenReference {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (ω : PriorFrozenData N j) : Measure (Spin N × LabeledLeaf n) := + gibbsProbability ν (priorFrozenBaseEnergy eig c I degree amplitude r h j ω) + +instance priorFrozenReference_probability {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (ω : PriorFrozenData N j) : + IsProbabilityMeasure (priorFrozenReference ν eig c I degree amplitude r h j ω) := + gibbsProbability_probability _ _ + +lemma measurable_priorFrozenReference {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) : + Measurable (priorFrozenReference ν eig c I degree amplitude r h j) := by + have hm : Measurable (fun ω : PriorFrozenData N j => + (ω.1,gaussianNamespaceJoin (j+1) (0,ω.2))) := + measurable_fst.prodMk ((measurable_gaussianNamespaceJoin (j+1)).comp + (measurable_const.prodMk measurable_snd)) + exact (measurable_priorNamespacedReference ν eig c I degree (Function.update amplitude j 0) + (fun i => tensorPathProfile I degree n r h i)).comp hm + +lemma priorFrozenHamiltonian_insert {N m k n : ℕ} + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) + (ω : PriorFrozenData N j) (z : ℕ → ℝ) (x : Spin N × LabeledLeaf n) : + priorNamespacedHamiltonian eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) (priorFrozenInsertion j (ω,z)) x = + priorFrozenBaseEnergy eig c I degree amplitude r h j ω x + amplitude j * + cylinderField (jointSpectralMonomialCoefficients (specialRotation ω.1) I (degree j) n (r j) x) z := by + unfold priorNamespacedHamiltonian priorFrozenBaseEnergy priorFrozenInsertion + rw [tensorNamespacedField_insert (specialRotation ω.1) I degree amplitude n r h hh h0 j x z ω.2] + exact (add_assoc _ _ _).symm + +theorem priorFrozenBase_exp_integrable_ae {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) : + ∀ᵐ ω ∂priorFrozenLaw μ j, + Integrable (fun x => Real.exp (priorFrozenBaseEnergy eig c I degree amplitude r h j ω x)) ν := by + have he := (priorFrozenInsertion_preserving μ j).quasiMeasurePreserving.ae + (priorNamespaced_exp_integrable_ae μ ν eig c I degree (Function.update amplitude j 0) r h hh h0) + have he' : ∀ᵐ p : PriorFrozenData N j × (ℕ → ℝ) + ∂(priorFrozenLaw μ j).prod gaussianCoordinates, + Integrable (fun x => Real.exp (priorFrozenBaseEnergy eig c I degree amplitude r h j p.1 x)) ν := by + filter_upwards [he] with p hp + convert hp using 1 + funext x + congr 1 + unfold priorFrozenBaseEnergy priorNamespacedHamiltonian priorFrozenInsertion + rw [tensorNamespacedField_frozen (specialRotation p.1.1) I degree amplitude n r h hh h0 j x p.2 p.1.2] + filter_upwards [Measure.ae_ae_of_ae_prod he'] with ω hω + obtain ⟨z,hz⟩ := hω.exists + exact hz + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorFullLogEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorFullLogEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6c49037f3bb1c89181941c2b9ee079cf9a6d4ad --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorFullLogEvaluation.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Fields.PriorLinearLogEvaluation +import OAI.Probability.InvariantIsing.Cavity.CavityRootedReplicaTransport + +namespace OAI + +/-! The full quadratic cavity logarithmic mean for a deterministic finite +spin prior, including the actual innovation law and all normalizer terms. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator NNReal BigOperators + +namespace InvariantIsing + +theorem prior_cavity_full_log_evaluation {d k : ℕ} (hk : 0 < k) (π : Measure (Spin k)) [IsProbabilityMeasure π] (h : FieldStep) + (K : Matrix (Fin d) (Fin d) ℝ) (H S : ℕ → Matrix (Fin d) (Fin d) ℝ) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (c : ℝ) + (hK : K.transpose = K) (hH : ∀ i, (H i).transpose = H i) + (hS : ∀ i, (S i).PosSemidef) + (hb : ∀ i, 0 < chainExponent h.cut i) + (hdet : ∀ i, IsUnit (1 - H i * K).det) + (hΔ : ∀ i, H i - H (i + 1) = chainExponent h.cut i • S i) + (hQ : ∀ i, (cavityFactorPrecision + (chainExponent h.cut i • cavityBackwardQuadratic K (H (i + 1))) + (CFC.sqrt (S i))).PosDef) + (hR : (H h.depth).PosSemidef) + (hQR : (cavityFactorPrecision K (CFC.sqrt (H h.depth))).PosDef) + (v : ℝ≥0) + (hcov : ∀ i < h.depth, + L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = + (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * cavityResolvent K (H h.depth) * L = (v : ℝ) • 1) + (hroot : L.transpose * ((1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose) * L = + h.height 0 • 1) : + let P := (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _) + let F := cavityRootedLogNormalizer h.depth K (H h.depth) L (c • 1) π + Integrable F P ∧ (∫ p, F p ∂P) = + Matrix.trace (S₀ * cavityBackwardQuadratic K (H 0)) / 2 - + (∑ j ∈ Finset.range h.depth, cavityDeterminantStep K H (chainExponent h.cut) j) - + Real.log (1 - H h.depth * K).det / 2 + + (k : ℝ) * (c + v) / 2 + + ∫ z, cascadeRecursion h.depth (chainExponent h.cut) + (fun i => vectorGaussianLaw k (fieldStepVariance h i)) + (fun _ p => p.1 + p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) z + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _) := by + intro P F + let b := chainExponent h.cut + let S' := fun i => (1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose + let S₀' := (1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose + let R := cavityResolvent K (H h.depth) + let P' := (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀').prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth b (cavityGaussianMarks S') : + Measure (NoiseTree (EuclideanSpace ℝ (Fin d)) h.depth)) + let F' := cavityRootedLogNormalizer h.depth 0 R L (c • 1) π + let T := cavitySpinDisorderInnovation h.depth K H S b + let Z := fun p : EuclideanSpace ℝ (Fin d) × NoiseTree (EuclideanSpace ℝ (Fin d)) h.depth => + Real.log (cavityResidualPartition h.depth K (H h.depth) p.1 p.2).toReal + have hbC := chainExponent_admissible h.ordered_cut h.first h.last + have hS' (i : ℕ) : (S' i).PosSemidef := + cavity_innovation_covariance_posSemidef K (H i) (H (i + 1)) (S i) (hS i) + (b i) (hdet i) (hdet (i + 1)) (hΔ i) (hQ i) + have hS₀' : S₀'.PosSemidef := by + simpa only [Matrix.conjTranspose_eq_transpose_of_trivial] using + hS₀.mul_mul_conjTranspose_same (1 - H 0 * K)⁻¹ + have hR' : R.PosSemidef := cavity_tilt_covariance_posSemidef K (H h.depth) hR hQR + have hlinear := prior_linear_rooted_log_integral hk π h S' hS' R hR' S₀' hS₀' + L v hcov hres hroot c + have hquad := cavity_residual_partition_log_integral h.depth K H S b S₀ hS₀ hbC + hK hH hS hb hdet hΔ hQ hR hQR + have hTP : MeasurePreserving T P P' := + ⟨measurable_cavitySpinDisorderInnovation h.depth K H S b, + cavity_quadratic_root_tree_law h.depth K H S b S₀ hS₀ hK hH hS hb hdet hΔ hQ⟩ + have hdata := cavity_rooted_full_integrability h.depth K H S b S₀ hS₀ L (c • 1) hbC + hK hH hS hb hdet hΔ hQ hR hQR π + have hreg : ∀ᵐ p ∂P, NoiseGibbsRegular h.depth b (cavityGaussianMarks S) + (fun i => cavityQuadraticStepWeight K (H i) (H (i + 1)) (b i)) + (fun _ x => x.1 + x.2) p.1 p.2 := by + apply (Measure.ae_prod_iff_ae_ae (measurableSet_noiseGibbsRegular h.depth b + (cavityGaussianMarks S) (fun i => measurable_cavityQuadraticStepWeight _ _ _ _) + (fun _ => measurable_fst.add measurable_snd))).mpr + exact Filter.Eventually.of_forall (fun s => + cavity_quadratic_regular_ae h.depth K H S b hbC hK hH hS hb hdet hΔ hQ s) + have he : F =ᵐ[P] fun p => Z p + F' (T p) := by + filter_upwards [hdata, hreg] with p hp hr + exact cavity_full_log_normalizer_transport h.depth K H S b L (c • 1) hK hR + (hdet h.depth) hQR p.1 p.2 hp.1 hr π hp.2 + have hi : Integrable (fun p => Z p + F' (T p)) P := + hquad.1.add (hTP.integrable_comp_of_integrable hlinear.1) + refine ⟨hi.congr he.symm, ?_⟩ + have hZi : Integrable Z P := hquad.1 + have hFi : Integrable (fun p => F' (T p)) P := hTP.integrable_comp_of_integrable hlinear.1 + have hmap : (∫ p, F' (T p) ∂P) = ∫ p, F' p ∂P' := + hTP.hasLaw.integral_comp (measurable_cavityRootedLogNormalizer _ _ _ _ _ _).aestronglyMeasurable + rw [integral_congr_ae he, integral_add hZi hFi, hmap] + dsimp only [Z, F', P', P] + rw [hquad.2, hlinear.2] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorGGExistence.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorGGExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..aabe76771cc7003b65fa2891f9b10e1c59717268 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorGGExistence.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Fields.PriorLimitingDiagonal +import OAI.Probability.InvariantIsing.Spectral.SpectralGGGeometry + +namespace OAI + +/-! Construction of geometric GG limits from actual constrained-prior minima. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma priorPerturbedArrayLaw_gram {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (h : ℕ → ℝ) : + ∀ᵐ x ∂(priorPerturbedArrayLaw μ ν eig c I u v t h : Measure (SpectralArray (m+1))), + SpectralGram x := by + unfold priorPerturbedArrayLaw priorNamespacedArrayLaw + exact spectralArrayLaw_gram _ _ _ _ _ _ _ + +lemma priorPerturbedArrayLaw_reindex {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (h : ℕ → ℝ) + (e : ℕ → ℕ) (he : Function.Injective e) : + (priorPerturbedArrayLaw μ ν eig c I u v t h : Measure (SpectralArray (m+1))).map + (permuteSpectralArray e)=priorPerturbedArrayLaw μ ν eig c I u v t h := by + unfold priorPerturbedArrayLaw priorNamespacedArrayLaw + exact spectralArrayLaw_map_reindex _ _ _ _ _ _ _ e he + +theorem priorPerturbation_exists_geometric_GG_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 priorPerturbedArrayLaw (μ (φ k)) (ν (φ k)) (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k))) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) := by + choose u v hu hv hmin using fun k => priorPerturbationObjective_exists_minimum hhaar hgauss + (hN k) (μ k) (hμinv k) (ν k) (eig k) (c k) (I k) (t k) (h k) (hh k) (h0 k) + let L := fun k => priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) + (u k) (v k) (t k) (h k) + let center := fun k => tensorMinimumArrayDiagonal (N k) n (v k) + obtain ⟨Q,q,φ,hφ,hL,hc⟩ := spectralArray_center_subsequence (m+1) L center + have hgg := priorPerturbation_minimizers_spectralGG hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) (fun k => ν (φ k)) + (fun k => eig (φ k)) (fun k => c (φ k)) K hK (fun k => heig (φ k)) + (fun k => I (φ k)) (fun k => u (φ k)) (fun k => hu (φ k)) + (fun k => v (φ k)) (fun k => hv (φ k)) (fun k => t (φ k)) (fun k => ht (φ k)) + (fun k => h (φ k)) (fun k => hh (φ k)) (fun k => h0 (φ k)) H (fun k => hH (φ k)) + (fun k => hmin (φ k)) Q hL + have hco : Continuous (fun z : Fin (m+1) → Set.Icc (0 : ℝ) 1 => fun a => (z a : ℝ)) := + continuous_pi fun a => continuous_subtype_val.comp (continuous_apply a) + have hd := priorPerturbation_minimizers_constantDiagonal hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) (fun k => ν (φ k)) + (fun k => eig (φ k)) (fun k => c (φ k)) K hK (fun k => heig (φ k)) + (fun k => I (φ k)) (fun k => u (φ k)) (fun k => hu (φ k)) + (fun k => v (φ k)) (fun k => hv (φ k)) (fun k => t (φ k)) (fun k => ht (φ k)) + (fun k => h (φ k)) (fun k => hh (φ k)) (fun k => h0 (φ k)) H (fun k => hH (φ k)) + (fun k => hmin (φ k)) Q hL (fun a => (q a : ℝ)) ((hco.tendsto q).comp hc) + have hg := spectralArray_limit_gram hL (fun k => priorPerturbedArrayLaw_gram + (μ (φ k)) (ν (φ k)) (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k))) + have hr : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q := by + intro e he + exact spectralArray_limit_reindex hL e (fun k => priorPerturbedArrayLaw_reindex + (μ (φ k)) (ν (φ k)) (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k)) e he) + exact ⟨u,v,hu,hv,hmin,Q,q,φ,hφ,hL,hgg,hd,hg,hr, + spectralGG_coordinate_nonnegative hgg hg (fun a => (q a : ℝ)) (fun a => (q a).property.1) hd⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorGGMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorGGMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..e16a4fe970782abf60cb4a85b0a850b82273de75 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorGGMinimum.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Fields.PriorGaussianMinimum +import OAI.Probability.InvariantIsing.Fields.PriorFiniteGG +import OAI.Probability.InvariantIsing.Fields.PriorMinimumFluctuations + +namespace OAI + +/-! The explicit vanishing GG rate at a constrained-prior coordinate minimum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem priorGaussianGG_at_minimum {N m n q : ℕ} (hN : 0 tensorPathProfile I degree n r h i)) 2 (μ.prod gaussianCoordinates)) + (hv : ∀ z : ℝ, |z|≤2 → + variance (priorNamespacedLog ν₀ eig c I degree + (Function.update amplitude j (perturbationAmplitude N j*z)) + (fun i => tensorPathProfile I degree n r h i)) (μ.prod gaussianCoordinates)≤N*L) + (hmin : + let M := fun z => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν₀ eig c I degree + (Function.update amplitude j (perturbationAmplitude N j*z)) + (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates + ∀ z∈Set.Icc (1 : ℝ) 2, + -M w+perturbationWeight j*(w-3/2)^2≤-M z+perturbationWeight j*(z-3/2)^2) + (C : ℝ) (hC : 0≤C) + (D : SpecialOrthogonal N → (Fin (q+1) → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hDb : ∀ U σ, |D U σ|≤C) + (center δ : Fin m → ℝ) + (hδ : ∀ a, priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-center a|)≤δ a) : + |priorSpectralGGResidual μ ν₀ eig c I degree amplitude r h j D|≤ + contactGGRate N j L C+2*C*∑ a, (degree j a : ℝ)*δ a := by + let a := perturbationAmplitude N j + let c₀ := N * perturbationWeight j / a ^ 2 + let θ := 1 / perturbationScale N + let G := (2 * c₀ + θ ^ 2) / (2 * θ) + c₀ * (a * contactStep N) + + 4 * (2 * N * Real.sqrt (L / N)) / (a * contactStep N) + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have he' : 0 < perturbationScale N := Real.rpow_pos_of_pos hn _ + have hs' : 0 < contactStep N := Real.rpow_pos_of_pos hn _ + have hθ : 0 < θ := one_div_pos.mpr he' + have ha : 0 < a := perturbationAmplitude_pos hN j + have hc₀ : 0 < c₀ := div_pos (mul_pos hn (perturbationWeight_pos j)) (sq_pos_of_pos ha) + have hG : 0 ≤ G := by dsimp only [G]; positivity + have hE := priorGaussian_energy_at_minimum hN μ ν₀ eig c I degree amplitude r h hh h0 j + w (contactStep N) θ (N * L) hw he hs' hs hθ hF hv hmin + have hamp' : 0 < |amplitude j| := by + rw [hamp, abs_mul, abs_of_pos ha] + exact mul_pos ha (abs_pos.mpr (ne_of_gt (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hw.1))) + have hEa : + let A := spectralPerturbationCoefficients (fun ω : PriorFrozenData N j => ω.1) + I (degree j) n (r j) + let ν := priorFrozenReference ν₀ eig c I degree amplitude r h j + let E := fun p : PriorFrozenData N j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2 - 2 * c₀ * (a * w - a * (3 / 2))| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + Integrable E ((priorFrozenLaw μ j).prod gaussianCoordinates) ∧ + (∫ p, E p ∂(priorFrozenLaw μ j).prod gaussianCoordinates) ≤ G := by + simpa only [hamp, spectralPerturbationCoefficients, a, c₀, G, sqrt_dimension_mul hN L, mul_assoc] using hE + have hgg := priorFiniteGG_individualDiagonal_bound μ ν₀ eig c I degree amplitude r h hh h0 j + (2 * c₀ * (a * w - a * (3 / 2))) G C hC hamp' D hD hDb center δ hδ hEa + have hampl : a ≤ |amplitude j| := by + rw [hamp, abs_mul, abs_of_pos ha, abs_of_pos (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hw.1)] + nlinarith [hw.1] + calc + _ ≤ 2 * C * (G / |amplitude j| + ∑ a, (degree j a : ℝ) * δ a) := hgg + _ ≤ 2 * C * (G / a + ∑ a, (degree j a : ℝ) * δ a) := + mul_le_mul_of_nonneg_left + (add_le_add (div_le_div_of_nonneg_left hG ha hampl) le_rfl) (mul_nonneg (by norm_num) hC) + _ = _ := by unfold contactGGRate; dsimp only [G, c₀, θ, a]; ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorGGWardExistence.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorGGWardExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..793fee6963f6030608ec1083a825a7cac7becc4e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorGGWardExistence.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Fields.PriorGGExistence +import OAI.Probability.InvariantIsing.Fields.PriorPerturbedWardLimits +import OAI.Probability.InvariantIsing.Spectral.SpectralPartition + +namespace OAI + +/-! Actual fixed-prior minima admit geometric limits with both Ward identities. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma priorPerturbedArrayLaw_partition {N m n : ℕ} (hN : 0 ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) : + ∃ u : (k : ℕ) → Fin (N k) → ℝ, ∃ v : ℕ → Fin m → ℝ, + (∀ k j, u k j∈Set.Icc (1 : ℝ) 2) ∧ (∀ k a, v k a∈Set.Icc (1 : ℝ) 2) ∧ + (∀ k u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective (μ k) (ν k) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) (u k) (v k)≤ + priorPerturbationObjective (μ k) (ν k) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) u' v') ∧ + ∃ Q : ProbabilityMeasure (SpectralArray (m+1)), + ∃ q : Fin (m+1) → Set.Icc (0 : ℝ) 1, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun k => priorPerturbedArrayLaw (μ (φ k)) (ν (φ k)) (eig (φ k)) (fun _ => 0) + (I (φ k)) (u (φ k)) (v (φ k)) 1 (fun _ => 0)) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) ∧ + (∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ r, |Φ r|≤B) → + spectralOffWardResidual Q ρ lam a b Φ=0) ∧ + (∀ a b, spectralDiagonalWardResidual Q ρ lam a b=0) := by + obtain ⟨u,v,hu,hv,hmin,Q,q,φ,hφ,hL,hgg,hd,hG,hE,hn⟩ := + priorPerturbation_exists_geometric_GG_limit hhaar hgauss N hN hNlim m n μ hμinv ν + eig (fun _ _ => 0) K hK heig I (fun _ => 1) (fun _ => by norm_num) + (fun _ _ => 0) (fun _ => monotone_const) (fun _ => le_rfl) 0 (fun _ => le_rfl) + have hpos k : 0 priorPerturbedArrayLaw_partition + (hpos k) (μ (φ k)) (ν (φ k)) (eig (φ k)) (fun _ => 0) (I (φ k)) + (hdis (φ k)) (hcover (φ k)) (u (φ k)) (v (φ k)) 1 (fun _ => 0)) + have hua k j : |u (φ k) j|≤2 := abs_le.mpr ⟨by linarith [(hu (φ k) j).1],(hu (φ k) j).2⟩ + have hva k a : |v (φ k) a|≤2 := abs_le.mpr ⟨by linarith [(hv (φ k) a).1],(hv (φ k) a).2⟩ + have hw := priorPerturbedArrayLaw_ward_limits (fun k => N (φ k)) hpos + (hNlim.comp hφ.tendsto_atTop) m n (fun k => μ (φ k)) (fun k => hμinv (φ k)) + (fun k => ν (φ k)) (fun k => eig (φ k)) (fun _ _ => 0) (fun k => I (φ k)) + (fun k => hdis (φ k)) (fun k => hcover (φ k)) lam (fun k => hlam (φ k)) + (fun k => u (φ k)) hua (fun k => v (φ k)) hva (fun _ => 1) tendsto_const_nhds + (fun _ _ => 0) (fun _ => monotone_const) (fun _ => le_rfl) Q hL ρ (hρ.comp hφ.tendsto_atTop) + simp only [one_mul] at hw + exact ⟨u,v,hu,hv,hmin,Q,q,φ,hφ,hL,hgg,hd,hG,hE,hpart,hn,hw.1,hw.2⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorGaussianMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorGaussianMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c4dedfa0adbab0100e87ef631ddb019d27c219e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorGaussianMinimum.lean @@ -0,0 +1,125 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFrozenCGF +import OAI.Probability.InvariantIsing.Spectral.SpectralGG +import OAI.Probability.InvariantIsing.Pressure.PressureCoordinateMinimum + +namespace OAI + +/-! The selected Gaussian energy at the actual constrained-prior minimum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma priorFrozenCGF_mean_bounds {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) (t : ℝ) : + 0≤(∫ p, priorFrozenCGF ν eig c I degree amplitude r h j t p + ∂(priorFrozenLaw μ j).prod gaussianCoordinates) ∧ + (∫ p, priorFrozenCGF ν eig c I degree amplitude r h j t p + ∂(priorFrozenLaw μ j).prod gaussianCoordinates)≤t^2/2 := by + let U : PriorFrozenData N j → SpecialOrthogonal N := fun ω => ω.1 + have hb := randomCoefficient_cgf_mean_bounds + (P := priorFrozenLaw μ j) (measurable_priorFrozenReference ν eig c I degree amplitude r h j) + (spectralPerturbationCoefficients U I (degree j) n (r j)) + (measurable_spectralPerturbationFields U measurable_fst I (degree j) n (r j)) + (fun ω x => jointSpectralMonomialCoefficients_variance_le_one + (specialRotation (U ω)) I (degree j) n (r j) x) t + simpa only [priorFrozenCGF,spectralPerturbationCoefficients,U,mul_one] using hb + +theorem priorGaussian_energy_at_minimum {N m n : ℕ} (hN : 0 tensorPathProfile I degree n r h i)) 2 (μ.prod gaussianCoordinates)) + (hv : ∀ q : ℝ, |q|≤2 → + variance (priorNamespacedLog ν₀ eig c I degree + (Function.update amplitude j (perturbationAmplitude N j*q)) + (fun i => tensorPathProfile I degree n r h i)) (μ.prod gaussianCoordinates)≤B) + (hmin : + let M := fun q => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν₀ eig c I degree + (Function.update amplitude j (perturbationAmplitude N j*q)) + (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates + ∀ q∈Set.Icc (1 : ℝ) 2, + -M w+perturbationWeight j*(w-3/2)^2≤-M q+perturbationWeight j*(q-3/2)^2) : + let a := perturbationAmplitude N j + let c₀ := N*perturbationWeight j/a^2 + let P := (priorFrozenLaw μ j).prod gaussianCoordinates + let A := fun ω : PriorFrozenData N j => + jointSpectralMonomialCoefficients (specialRotation ω.1) I (degree j) n (r j) + let ν := priorFrozenReference ν₀ eig c I degree amplitude r h j + let E := fun p : PriorFrozenData N j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2-2*c₀*(a*w-a*(3/2))| + ∂(ν p.1).tilted (fun x => a*w*cylinderField (A p.1 x) p.2) + Integrable E P ∧ (∫ p, E p ∂P)≤ + (2*c₀+K^2)/(2*K)+c₀*(a*s)+4*(2*Real.sqrt B)/(a*s) := by + intro a c₀ P A ν E + let M := fun q => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν₀ eig c I degree + (Function.update amplitude j (a*q)) (fun i => tensorPathProfile I degree n r h i) p + ∂μ.prod gaussianCoordinates + let L := fun t => ∫ p, priorFrozenCGF ν₀ eig c I degree amplitude r h j t p ∂P + have hn : (0 : ℝ) by + rcases hb with rfl | rfl + · exact hF q hq + · simpa only [mul_zero] using hF 0 (by norm_num)) + (fun b hb => by + rcases hb with rfl | rfl + · exact hv q hq + · simpa only [mul_zero] using hv 0 (by norm_num)) + have hmean (q : ℝ) (hq : |q|≤2) : L (a*q)=N*(M q-M 0) := by + dsimp only [L,P,M] + rw [(hstat q hq).2.1] + simp only [mul_zero] + field_simp [hn.ne'] + have hcost (q : ℝ) (hq : |q|≤2) : + 0≤M q-M 0 ∧ M q-M 0≤(a*q)^2/(2*N) := by + have hb := priorFrozenCGF_mean_bounds μ ν₀ eig c I degree amplitude r h j (a*q) + change 0≤L (a*q) ∧ L (a*q)≤(a*q)^2/2 at hb + rw [hmean q hq] at hb + refine ⟨(mul_nonneg_iff_of_pos_left hn).mp hb.1,?_⟩ + apply (le_div_iff₀ (show 0<2*(N : ℝ) by positivity)).mpr + nlinarith [hb.2] + have hwa : |w|≤2 := abs_le.mpr ⟨by linarith [hw.1],hw.2⟩ + have hpen := gaussianCoordinate_minimum_penalty hN j M w hwa + ⟨(hcost (3/2) (by norm_num)).1,(hcost w hwa).2⟩ + (hmin (3/2) (by constructor <;> norm_num)) + obtain ⟨hlo,hhi⟩ := gaussianCoordinate_minimum_interior j hpen he hs' + have hlocal := pressureCoordinate_minimum_rescale (Nat.cast_nonneg N) ha hw hlo hhi + (fun q hq => hmean q (abs_le.mpr ⟨by linarith [hq.1],hq.2⟩)) hmin + have hconc (t : ℝ) (ht : t∈({a*w-a*s,a*w,a*w+a*s} : Set ℝ)) : + (∫ p, |priorFrozenCGF ν₀ eig c I degree amplitude r h j t p-L t| ∂P)≤2*Real.sqrt B := by + have hti : t∈Set.Icc (a*w-a*s) (a*w+a*s) := by + simp only [Set.mem_insert_iff,Set.mem_singleton_iff] at ht + rcases ht with rfl | rfl | rfl <;> constructor <;> nlinarith [mul_pos ha hs] + have htq : t/a∈Set.Icc (1 : ℝ) 2 := by + constructor + · apply (le_div_iff₀ ha).mpr + nlinarith [hti.1] + · apply (div_le_iff₀ ha).mpr + nlinarith [hti.2] + have hta : |t/a|≤2 := abs_le.mpr ⟨by linarith [htq.1],htq.2⟩ + simpa only [mul_div_cancel₀ _ ha.ne'] using (hstat (t/a) hta).2.2 + exact randomCoefficient_energy_at_minimum (P := priorFrozenLaw μ j) + (measurable_priorFrozenReference ν₀ eig c I degree amplitude r h j) A + (measurable_spectralPerturbationFields (fun ω : PriorFrozenData N j => ω.1) + measurable_fst I (degree j) n (r j)) + (fun ω x => jointSpectralMonomialCoefficients_variance_le_one + (specialRotation ω.1) I (degree j) n (r j) x) (mul_pos ha hs) hK hlocal hconc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorKernelDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorKernelDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3a89e27b3b09c3a14d5220b279e602cf838cf81 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorKernelDiagonal.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Fields.PriorReplicaAverage +import OAI.Probability.InvariantIsing.Arrays.TensorKernelDiagonalError + +namespace OAI + +/-! Coordinate deviations control the selected kernel for constrained priors. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem priorMonomialDiagonalError_le {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (d : Fin m → ℕ) (center : Fin m → ℝ) : + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |(∏ a, projectedOverlap (specialRotation U) (I a) x.1 x.1 ^ d a) - + ∏ a, spectralDiagonalCenter (center a) ^ d a|) ≤ + ∑ a, (d a : ℝ) * priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|) := by + let P := μ.prod gaussianCoordinates + let ν := priorNamespacedReference ν₀ eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i) + let D := fun (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) => + |(∏ a, projectedOverlap (specialRotation U) (I a) x.1 x.1 ^ d a) - + ∏ a, spectralDiagonalCenter (center a) ^ d a| + let E := fun (a : Fin m) (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) => + |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a| + let C := fun a => 1 + |center a| + have hE (a : Fin m) : Measurable (Function.uncurry (E a)) := + measurable_spectralDiagonalDeviation (I a) n (center a) + have hD : Measurable (Function.uncurry D) := by + apply measurable_from_prod_countable_left + intro x + exact ((Finset.measurable_prod _ fun a _ => + (measurable_projectedOverlap (I a) x.1 x.1).pow_const (d a)).sub_const _).abs + have hEb (a : Fin m) (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : |E a U x| ≤ C a := + spectralDiagonalDeviation_abs_le (specialRotation U) (I a) (center a) x.1 + have hle (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : + D U x ≤ ∑ a, (d a : ℝ) * E a U x := + spectralMonomial_clipped_self_deviation_le (specialRotation U) I d center x.1 + have hDb (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : + |D U x| ≤ ∑ a, (d a : ℝ) * C a := by + rw [abs_of_nonneg (abs_nonneg _)] + exact (hle U x).trans (Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_left ((le_abs_self _).trans (hEb a U x)) (Nat.cast_nonneg _)) + have hiE (a : Fin m) : Integrable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, E a p.1 x ∂ν p) P := + priorNamespacedObservableAverage_integrable μ ν₀ eig c I degree amplitude r h (E a) (hE a) (hEb a) + have hiD : Integrable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, D p.1 x ∂ν p) P := + priorNamespacedObservableAverage_integrable μ ν₀ eig c I degree amplitude r h D hD hDb + have hiS : Integrable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => + ∑ a, (d a : ℝ) * ∫ x, E a p.1 x ∂ν p) P := + integrable_finsetSum _ (fun a _ => (hiE a).const_mul (d a : ℝ)) + change (∫ p, ∫ x, D p.1 x ∂ν p ∂P) ≤ + ∑ a, (d a : ℝ) * ∫ p, ∫ x, E a p.1 x ∂ν p ∂P + calc + _ ≤ ∫ p : SpecialOrthogonal N × (ℕ → ℝ), ∑ a, (d a : ℝ) * ∫ x, E a p.1 x ∂ν p ∂P := by + apply integral_mono hiD hiS + intro p + have hiD' : Integrable (D p.1) (ν p) := + Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable _ (ae_of_all _ fun x => by + simpa only [Real.norm_eq_abs] using hDb p.1 x) + have hiE' (a : Fin m) : Integrable (E a p.1) (ν p) := + Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable _ (ae_of_all _ fun x => by + simpa only [Real.norm_eq_abs] using hEb a p.1 x) + calc + _ ≤ ∫ x, ∑ a, (d a : ℝ) * E a p.1 x ∂ν p := + integral_mono hiD' (integrable_finsetSum _ (fun a _ => (hiE' a).const_mul _)) (hle p.1) + _ = _ := by rw [integral_finsetSum _ (fun a _ => (hiE' a).const_mul _)]; simp_rw [integral_const_mul] + _ = _ := by rw [integral_finsetSum _ (fun a _ => (hiE a).const_mul _)]; simp_rw [integral_const_mul] + + +theorem priorKernelDiagonalError_le {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (d : Fin m → ℕ) (treeDegree : ℕ) (center : Fin m → ℝ) : + priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) + I d n treeDegree U x x - + (∏ a, spectralDiagonalCenter (center a) ^ d a) * ((n : ℝ) / (n + 1 : ℕ)) ^ treeDegree|) ≤ + ∑ a, (d a : ℝ) * priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|) := by + let Z := priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |(∏ a, projectedOverlap (specialRotation U) (I a) x.1 x.1 ^ d a) - + ∏ a, spectralDiagonalCenter (center a) ^ d a|) + have hZ : 0 ≤ Z := integral_nonneg (fun _ => integral_nonneg (fun _ => abs_nonneg _)) + have he : priorNamespacedObservableAverage μ ν₀ eig c I degree amplitude r h + (fun U x => |spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) + I d n treeDegree U x x - + (∏ a, spectralDiagonalCenter (center a) ^ d a) * ((n : ℝ) / (n + 1 : ℕ)) ^ treeDegree|) = + Z * ((n : ℝ) / (n + 1 : ℕ)) ^ treeDegree := by + unfold priorNamespacedObservableAverage Z + simp_rw [tensorKernel_diagonal_deviation, integral_mul_const] + rfl + rw [he] + exact (mul_le_of_le_one_right hZ (pow_le_one₀ (finiteTreeDiagonal_mem n).1 (finiteTreeDiagonal_mem n).2)).trans + (priorMonomialDiagonalError_le μ ν₀ eig c I degree amplitude r h d center) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledDepthMean.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledDepthMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..bea204df99e2bf515335364dee0b62e344a730a7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledDepthMean.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Fields.PriorLabeledDepthPair +import OAI.Probability.InvariantIsing.Cavity.CavityRootedDepthMean +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledModelSpinMean + +namespace OAI + +/-! The finite labeled common-depth mean and its full rooted law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix ENNReal BigOperators + +namespace InvariantIsing + +def priorCavityLabeledDepthMean {d k : ℕ} (n : ℕ) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] (a : ℕ → ℝ) + (ω : CavityLabeledDisorder d n) : ℝ := + referenceReplicaMean (cavityLabeledPriorKernel n R π ω) + (fun x => cavityLabeledPotential n K L C (ω,x)) + (fun σ : Fin 2 → CavityLabeledState d k n => a (labeledCommonDepth n (σ 0).1.1 (σ 1).1.1)) + +lemma prior_cavity_labeled_model_depth_mean {d k : ℕ} (n : ℕ) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] (a : ℕ → ℝ) + (ω : CavityLabeledDisorder d n) (hgi : Function.Injective ω.2.2) + (hg : GoodNoiseTree _ n (cavityLabeledNoiseDisorderMap n ω).2) + (ht : 0 < noiseTreeTotal _ n (cavityLabeledNoiseDisorderMap n ω).2 ∧ + noiseTreeTotal _ n (cavityLabeledNoiseDisorderMap n ω).2 < ∞) + (hI : Integrable (fun z => Real.exp + (cavityLogFactor K L C (cavityRootedField n z.1) z.2)) + ((cavityRootedPriorKernel n R (cavityLabeledNoiseDisorderMap n ω)).prod + π)) : + priorCavityLabeledDepthMean n K R L C π a ω = + cavityRootedDepthTestMean n K R L C π a + (cavityLabeledNoiseDisorderMap n ω) := by + have hi := cavity_labeled_model_exp_integrable n K R L C π ω hg ht hI + have hiraw : Integrable (fun p : CavityLabeledState d k n => Real.exp + (cavityLogFactor K L C + (cavityLeafSum n ω.2.1 (labeledNoiseLeaf _ n + (ω.1, markForestOfCoords _ n ω.2.2) p.1.1) + p.1.2) p.2)) + (((labeledLeafLaw n ω.1).prod (multivariateGaussian 0 R)).prod π) := by + simpa only [cavityLabeledPriorKernel_apply, cavityLabeledPotential, Function.comp_apply, + cavityLabeledEndpoint, cavityLabeledField, cavity_labeled_leaf_sum, WithLp.ofLp_add] using hi + have he := prior_cavity_labeled_rooted_depth_pair n K R L C π ω.2.1 ω.1 ω.2.2 hgi hg ht hiraw a + simpa only [priorCavityLabeledDepthMean, cavityLabeledPriorKernel_apply, + cavityLabeledPotential, Function.comp_apply, cavityLabeledEndpoint, cavityLabeledField, + cavity_labeled_leaf_sum, WithLp.ofLp_add, cavityRootedDepthTestMean, + cavityLabeledNoiseDisorderMap] using he.symm + +theorem integral_priorCavityLabeledDepthMean {d k : ℕ} (n : ℕ) (b : ℕ → ℝ) + (K R S₀ : Matrix (Fin d) (Fin d) ℝ) (S : ℕ → Matrix (Fin d) (Fin d) ℝ) + (L : Matrix (Fin d) (Fin k) ℝ) (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] + (hb : CascadeExponents n b) + (hAtom : ∀ i < n, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (hI : ∀ᵐ ω ∂(multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n b (cavityGaussianMarks S) : Measure _), + Integrable (fun z => Real.exp (cavityLogFactor K L C (cavityRootedField n z.1) z.2)) + ((cavityRootedPriorKernel n R ω).prod π)) + (a : ℕ → ℝ) : + (∫ ω, priorCavityLabeledDepthMean n K R L C π a ω ∂cavityLabeledDisorderLaw n b S₀ S) = + ∫ ω, cavityRootedDepthTestMean n K R L C π a ω + ∂(multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n b (cavityGaussianMarks S) : Measure _) := by + have hi := (cavity_labeled_noise_disorder_law n b S₀ S).quasiMeasurePreserving.ae hI + calc + _ = ∫ ω, cavityRootedDepthTestMean n K R L C π a + (cavityLabeledNoiseDisorderMap n ω) ∂cavityLabeledDisorderLaw n b S₀ S := by + apply integral_congr_ae + filter_upwards [hi, cavity_labeled_disorder_good n b S₀ S hb, + cavity_labeled_disorder_injective n b S₀ S hAtom] with ω hω hg hgi + exact prior_cavity_labeled_model_depth_mean n K R L C π a ω hgi hg.1 hg.2 hω + _ = _ := (cavity_labeled_noise_disorder_law n b S₀ S).hasLaw.integral_comp + (measurable_cavityRootedDepthTestMean n K R L C π a).aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledDepthPair.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledDepthPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..5160df4a7d17891f67e94bac2cc4256cd1560007 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledDepthPair.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledRootPair +import OAI.Probability.InvariantIsing.Cavity.CavityRootedDepthTransport + +namespace OAI + +/-! Labeled common depths in the actual rooted full Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix ENNReal + +namespace InvariantIsing + +theorem prior_cavity_labeled_rooted_depth_pair {d k : ℕ} (n : ℕ) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] + (s : EuclideanSpace ℝ (Fin d)) + (T : LabeledTree n) (g : ForestVertex n → EuclideanSpace ℝ (Fin d)) + (hg : Function.Injective g) + (hgood : GoodNoiseTree _ n (labeledNoiseJoin _ n (T, markForestOfCoords _ n g))) + (ht : 0 < noiseTreeTotal _ n (labeledNoiseJoin _ n (T, markForestOfCoords _ n g)) ∧ + noiseTreeTotal _ n (labeledNoiseJoin _ n (T, markForestOfCoords _ n g)) < ∞) + (hI : Integrable (fun p : (LabeledLeaf n × EuclideanSpace ℝ (Fin d)) × Spin k => + Real.exp (cavityLogFactor K L C + (cavityLeafSum n s (labeledNoiseLeaf _ n (T, markForestOfCoords _ n g) p.1.1) + + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2)) + (((labeledLeafLaw n T).prod (multivariateGaussian 0 R)).prod π)) + (a : ℕ → ℝ) : + (∫ σ, cavityRootedDepthTest a σ + ∂Measure.infinitePi (fun _ : ℕ => cavityRootedFullGibbs n K R L C + π (s, labeledNoiseJoin _ n (T, markForestOfCoords _ n g)))) = + referenceReplicaMean + (((labeledLeafLaw n T).prod (multivariateGaussian 0 R)).prod π) + (fun p => cavityLogFactor K L C + (cavityLeafSum n s (labeledNoiseLeaf _ n (T, markForestOfCoords _ n g) p.1.1) + + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2) + (fun σ : Fin 2 → (LabeledLeaf n × EuclideanSpace ℝ (Fin d)) × Spin k => + a (labeledCommonDepth n (σ 0).1.1 (σ 1).1.1)) := by + let ν := cavityRootedFullGibbs n K R L C π + (s, labeledNoiseJoin _ n (T, markForestOfCoords _ n g)) + let μ := (((labeledLeafLaw n T).prod (multivariateGaussian 0 R)).prod + π).tilted (fun p => cavityLogFactor K L C + (cavityLeafSum n s (labeledNoiseLeaf _ n (T, markForestOfCoords _ n g) p.1.1) + + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2) + let f := cavityAttachSpinRoot (k := k) n s ∘ cavityLabeledSpinMap n T g + have hf : Measurable f := (measurable_cavityAttachSpinRoot n s).comp + (measurable_cavityLabeledSpinMap n T g) + have hmap : μ.map f = ν := + cavity_labeled_rooted_full_spin_law n K R L C s T g hgood ht π hI + let F : (Fin 2 → CavitySpinState d k n) → ℝ := fun σ => + a (cavityCommonMarkDepth n (σ 0).1.2.1 (σ 1).1.2.1) + have hF : Measurable F := by + have hc : Measurable (fun σ : Fin 2 → CavitySpinState d k n => + cavityCommonMarkDepth n (σ 0).1.2.1 (σ 1).1.2.1) := + (cavityCommonMarkDepth_measurable n).comp + (show Measurable (fun σ : Fin 2 → CavitySpinState d k n => + ((σ 0).1.2.1, (σ 1).1.2.1)) from by fun_prop) + exact (measurable_of_countable a).comp hc + have hprefix : MeasurePreserving (fun σ : ℕ → CavitySpinState d k n => + fun i : Fin 2 => σ i) (Measure.infinitePi (fun _ : ℕ => ν)) + (Measure.pi (fun _ : Fin 2 => ν)) := + ⟨Measurable.of_eval (fun i => measurable_pi_apply (i : ℕ)), replica_prefix_map ν 2⟩ + have hpi : MeasurePreserving + (fun σ : Fin 2 → (LabeledLeaf n × EuclideanSpace ℝ (Fin d)) × Spin k => + fun i => f (σ i)) + (Measure.pi (fun _ : Fin 2 => μ)) (Measure.pi (fun _ : Fin 2 => ν)) := by + refine ⟨Measurable.of_eval (fun i => hf.comp (measurable_pi_apply i)), ?_⟩ + simpa only [hmap] using Measure.pi_map_pi + (μ := fun _ : Fin 2 => μ) (f := fun _ : Fin 2 => f) (fun _ => hf.aemeasurable) + rw [cavity_reference_pair_eq_tilted _ _ hI] + calc + _ = ∫ σ, F σ ∂Measure.pi (fun _ : Fin 2 => ν) := by + simpa only [Function.comp_def, F, cavityRootedDepthTest, Fin.val_zero, Fin.val_one, ν] using + hprefix.hasLaw.integral_comp hF.aestronglyMeasurable + _ = _ := by + have hi := (hpi.hasLaw.integral_comp hF.aestronglyMeasurable).symm + simpa only [Function.comp_def, F, f, cavityAttachSpinRoot, cavityLabeledSpinMap, + cavityCommonMarkDepth_labeled n T g hg] using hi + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledModelSpin.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledModelSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..1af08f013d851af7a602e9530d63da4924410e5a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledModelSpin.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledPriorTransport +import OAI.Probability.InvariantIsing.Fields.PriorLabeledRootPair +import OAI.Probability.InvariantIsing.Cavity.CavityRootedTestMean + +namespace OAI + +/-! The original two-replica spin test, averaged in the fixed-state +finite model used for capped numerator comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix ENNReal BigOperators + +namespace InvariantIsing + +def priorCavityLabeledSpinDepthMean {d k : ℕ} (n : ℕ) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] (a : ℕ → ℝ) (j : Fin k) + (ω : CavityLabeledDisorder d n) : ℝ := + referenceReplicaMean (cavityLabeledPriorKernel n R π ω) + (fun x => cavityLabeledPotential n K L C (ω,x)) + (fun σ : Fin 2 → CavityLabeledState d k n => a (labeledCommonDepth n (σ 0).1.1 (σ 1).1.1) * + (spinValue ((σ 0).2 j) * spinValue ((σ 1).2 j))) + +lemma prior_cavity_labeled_model_spin_mean {d k : ℕ} (n : ℕ) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] (a : ℕ → ℝ) (j : Fin k) + (ω : CavityLabeledDisorder d n) (hgi : Function.Injective ω.2.2) + (hg : GoodNoiseTree _ n (cavityLabeledNoiseDisorderMap n ω).2) + (ht : 0 < noiseTreeTotal _ n (cavityLabeledNoiseDisorderMap n ω).2 ∧ + noiseTreeTotal _ n (cavityLabeledNoiseDisorderMap n ω).2 < ∞) + (hI : Integrable (fun z => Real.exp + (cavityLogFactor K L C (cavityRootedField n z.1) z.2)) + ((cavityRootedPriorKernel n R (cavityLabeledNoiseDisorderMap n ω)).prod + π)) : + priorCavityLabeledSpinDepthMean n K R L C π a j ω = + cavityRootedSpinTestMean n K R L C π a j + (cavityLabeledNoiseDisorderMap n ω) := by + have hi := cavity_labeled_model_exp_integrable n K R L C π ω hg ht hI + have hiraw : Integrable (fun p : CavityLabeledState d k n => Real.exp + (cavityLogFactor K L C + (cavityLeafSum n ω.2.1 (labeledNoiseLeaf _ n + (ω.1, markForestOfCoords _ n ω.2.2) p.1.1) + p.1.2) p.2)) + (((labeledLeafLaw n ω.1).prod (multivariateGaussian 0 R)).prod π) := by + simpa only [cavityLabeledPriorKernel_apply, cavityLabeledPotential, Function.comp_apply, + cavityLabeledEndpoint, cavityLabeledField, cavity_labeled_leaf_sum, WithLp.ofLp_add] using hi + have he := prior_cavity_labeled_rooted_spin_pair n K R L C π ω.2.1 ω.1 ω.2.2 hgi hg ht hiraw a j + simpa only [priorCavityLabeledSpinDepthMean, cavityLabeledPriorKernel_apply, + cavityLabeledPotential, Function.comp_apply, cavityLabeledEndpoint, cavityLabeledField, + cavity_labeled_leaf_sum, WithLp.ofLp_add, cavityRootedSpinTestMean, + cavityLabeledNoiseDisorderMap] using he.symm + +theorem integral_priorCavityLabeledSpinDepthMean {d k : ℕ} (n : ℕ) (b : ℕ → ℝ) + (K R S₀ : Matrix (Fin d) (Fin d) ℝ) (S : ℕ → Matrix (Fin d) (Fin d) ℝ) + (L : Matrix (Fin d) (Fin k) ℝ) (C : Matrix (Fin k) (Fin k) ℝ) + (π : Measure (Spin k)) [IsProbabilityMeasure π] + (hb : CascadeExponents n b) + (hAtom : ∀ i < n, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (hI : ∀ᵐ ω ∂(multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n b (cavityGaussianMarks S) : Measure _), + Integrable (fun z => Real.exp (cavityLogFactor K L C (cavityRootedField n z.1) z.2)) + ((cavityRootedPriorKernel n R ω).prod π)) + (a : ℕ → ℝ) (j : Fin k) : + (∫ ω, priorCavityLabeledSpinDepthMean n K R L C π a j ω ∂cavityLabeledDisorderLaw n b S₀ S) = + ∫ ω, cavityRootedSpinTestMean n K R L C π a j ω + ∂(multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n b (cavityGaussianMarks S) : Measure _) := by + have hi := (cavity_labeled_noise_disorder_law n b S₀ S).quasiMeasurePreserving.ae hI + calc + _ = ∫ ω, cavityRootedSpinTestMean n K R L C π a j + (cavityLabeledNoiseDisorderMap n ω) ∂cavityLabeledDisorderLaw n b S₀ S := by + apply integral_congr_ae + filter_upwards [hi, cavity_labeled_disorder_good n b S₀ S hb, + cavity_labeled_disorder_injective n b S₀ S hAtom] with ω hω hg hgi + exact prior_cavity_labeled_model_spin_mean n K R L C π a j ω hgi hg.1 hg.2 hω + _ = _ := (cavity_labeled_noise_disorder_law n b S₀ S).hasLaw.integral_comp + (measurable_cavityRootedSpinTestMean n K R L C π a j).aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledOverlapObservable.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledOverlapObservable.lean new file mode 100644 index 0000000000000000000000000000000000000000..24512cbb6aa9145670afde2a133ded4d72fe3399 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledOverlapObservable.lean @@ -0,0 +1,32 @@ +import OAI.Probability.InvariantIsing.Fields.PriorLabeledDepthMean +import OAI.Probability.InvariantIsing.Cavity.CavityOverlapObservable + +namespace OAI +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators BoundedContinuousFunction +namespace InvariantIsing +lemma prior_cavity_labeled_overlap_observable {m d k n : ℕ} + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (p : OverlapPath) (q : Fin (n + 1) → ℝ) (hq : ∀ i, q i ∈ Icc 0 1) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] (Φ : ℝ → ℝ) (hΦ : Continuous Φ) + (ω : CavityLabeledDisorder d n) : + cavityWeightedReplicaMean (cavityLabeledPriorKernel n R π ω) + (fun x => Real.exp (cavityLabeledPotential n K L C (ω,x))) + (fun ξ => cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p q) + (cavityOverlapObservable Φ hΦ) (ω,ξ)) = + priorCavityLabeledDepthMean n K R L C π (fun i => Φ (q (cavityFiniteLevel n i))) ω := by + have htest (ξ : Fin 2 → CavityLabeledState d k n) : + cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p q) + (cavityOverlapObservable Φ hΦ) (ω,ξ) = + Φ (q (cavityFiniteLevel n (labeledCommonDepth n (ξ 0).1.1 (ξ 1).1.1))) := + cavityOverlapObservable_finite rho lam hrho hsum p q hq Φ hΦ _ _ + simp only [cavityWeightedReplicaMean, cavityWeightNumerator, cavityWeightNormalizer, + priorCavityLabeledDepthMean, referenceReplicaMean, referencePartition, Real.exp_sum, htest] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledRootPair.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledRootPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fc32006c02f5addf6b7620c2b0f72ef8b81c94f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledRootPair.lean @@ -0,0 +1,90 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledRoot +import OAI.Probability.InvariantIsing.Cavity.CavityRootedSpinTestTransport +import OAI.Probability.InvariantIsing.Cavity.CavityPosteriorPair + +namespace OAI + +/-! Common-depth spin tests of the actual rooted kernel in labeled coordinates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix ENNReal + +namespace InvariantIsing + +theorem prior_cavity_labeled_rooted_spin_pair {d k : ℕ} (n : ℕ) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] + (s : EuclideanSpace ℝ (Fin d)) + (T : LabeledTree n) (g : ForestVertex n → EuclideanSpace ℝ (Fin d)) + (hg : Function.Injective g) + (hgood : GoodNoiseTree _ n (labeledNoiseJoin _ n (T, markForestOfCoords _ n g))) + (ht : 0 < noiseTreeTotal _ n (labeledNoiseJoin _ n (T, markForestOfCoords _ n g)) ∧ + noiseTreeTotal _ n (labeledNoiseJoin _ n (T, markForestOfCoords _ n g)) < ∞) + (hI : Integrable (fun p : (LabeledLeaf n × EuclideanSpace ℝ (Fin d)) × Spin k => + Real.exp (cavityLogFactor K L C + (cavityLeafSum n s (labeledNoiseLeaf _ n (T, markForestOfCoords _ n g) p.1.1) + + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2)) + (((labeledLeafLaw n T).prod (multivariateGaussian 0 R)).prod π)) + (a : ℕ → ℝ) (j : Fin k) : + (∫ σ, cavityRootedSpinDepthTest a j σ + ∂Measure.infinitePi (fun _ : ℕ => cavityRootedFullGibbs n K R L C + π (s, labeledNoiseJoin _ n (T, markForestOfCoords _ n g)))) = + referenceReplicaMean + (((labeledLeafLaw n T).prod (multivariateGaussian 0 R)).prod π) + (fun p => cavityLogFactor K L C + (cavityLeafSum n s (labeledNoiseLeaf _ n (T, markForestOfCoords _ n g) p.1.1) + + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2) + (fun σ : Fin 2 → (LabeledLeaf n × EuclideanSpace ℝ (Fin d)) × Spin k => + a (labeledCommonDepth n (σ 0).1.1 (σ 1).1.1) * + (spinValue ((σ 0).2 j) * spinValue ((σ 1).2 j))) := by + let ν := cavityRootedFullGibbs n K R L C π + (s, labeledNoiseJoin _ n (T, markForestOfCoords _ n g)) + let μ := (((labeledLeafLaw n T).prod (multivariateGaussian 0 R)).prod + π).tilted (fun p => cavityLogFactor K L C + (cavityLeafSum n s (labeledNoiseLeaf _ n (T, markForestOfCoords _ n g) p.1.1) + + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2) + let f := cavityAttachSpinRoot (k := k) n s ∘ cavityLabeledSpinMap n T g + have hf : Measurable f := (measurable_cavityAttachSpinRoot n s).comp + (measurable_cavityLabeledSpinMap n T g) + have hmap : μ.map f = ν := + cavity_labeled_rooted_full_spin_law n K R L C s T g hgood ht π hI + let F : (Fin 2 → CavitySpinState d k n) → ℝ := fun σ => + a (cavityCommonMarkDepth n (σ 0).1.2.1 (σ 1).1.2.1) * + (spinValue ((σ 0).2 j) * spinValue ((σ 1).2 j)) + have hF : Measurable F := by + have hc : Measurable (fun σ : Fin 2 → CavitySpinState d k n => + cavityCommonMarkDepth n (σ 0).1.2.1 (σ 1).1.2.1) := + (cavityCommonMarkDepth_measurable n).comp + (show Measurable (fun σ : Fin 2 → CavitySpinState d k n => + ((σ 0).1.2.1, (σ 1).1.2.1)) from by fun_prop) + have hs (i : Fin 2) : Measurable (fun σ : Fin 2 → CavitySpinState d k n => + spinValue ((σ i).2 j)) := + (measurable_of_finite (fun ε : Spin k => spinValue (ε j))).comp (by fun_prop) + exact ((measurable_of_countable a).comp hc).mul ((hs 0).mul (hs 1)) + have hprefix : MeasurePreserving (fun σ : ℕ → CavitySpinState d k n => + fun i : Fin 2 => σ i) (Measure.infinitePi (fun _ : ℕ => ν)) + (Measure.pi (fun _ : Fin 2 => ν)) := + ⟨Measurable.of_eval (fun i => measurable_pi_apply (i : ℕ)), replica_prefix_map ν 2⟩ + have hpi : MeasurePreserving + (fun σ : Fin 2 → (LabeledLeaf n × EuclideanSpace ℝ (Fin d)) × Spin k => + fun i => f (σ i)) + (Measure.pi (fun _ : Fin 2 => μ)) (Measure.pi (fun _ : Fin 2 => ν)) := by + refine ⟨Measurable.of_eval (fun i => hf.comp (measurable_pi_apply i)), ?_⟩ + simpa only [hmap] using Measure.pi_map_pi + (μ := fun _ : Fin 2 => μ) (f := fun _ : Fin 2 => f) (fun _ => hf.aemeasurable) + rw [cavity_reference_pair_eq_tilted _ _ hI] + calc + _ = ∫ σ, F σ ∂Measure.pi (fun _ : Fin 2 => ν) := by + simpa only [Function.comp_def, F, cavityRootedSpinDepthTest, Fin.val_zero, Fin.val_one, ν] using + hprefix.hasLaw.integral_comp hF.aestronglyMeasurable + _ = _ := by + have hi := (hpi.hasLaw.integral_comp hF.aestronglyMeasurable).symm + simpa only [Function.comp_def, F, f, cavityAttachSpinRoot, cavityLabeledSpinMap, + cavityCommonMarkDepth_labeled n T g hg] using hi + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledSpinObservable.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledSpinObservable.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f6e066a822184c8ee68835ec636e8053cccdfd2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLabeledSpinObservable.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Cavity.CavitySpinObservable +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledModelNumerator +import OAI.Probability.InvariantIsing.Fields.PriorLabeledModelSpin + +namespace OAI + +/-! The finite-model spin mean is the normalized continuous spectral +observable used in the Haar replica comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators BoundedContinuousFunction + +namespace InvariantIsing + +lemma prior_cavity_labeled_spin_observable {m d k n : ℕ} + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (p : OverlapPath) (q : Fin (n + 1) → ℝ) (hq : ∀ i, q i ∈ Icc 0 1) + (K R : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] (Φ : ℝ → ℝ) (hΦ : Continuous Φ) (j : Fin k) + (ω : CavityLabeledDisorder d n) : + cavityWeightedReplicaMean (cavityLabeledPriorKernel n R π ω) + (fun x => Real.exp (cavityLabeledPotential n K L C (ω,x))) + (fun ξ => cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p q) + (cavitySpinObservable Φ hΦ j) (ω,ξ)) = + priorCavityLabeledSpinDepthMean n K R L C π (fun i => Φ (q (cavityFiniteLevel n i))) j ω := by + have htest (ξ : Fin 2 → CavityLabeledState d k n) : + cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p q) + (cavitySpinObservable Φ hΦ j) (ω,ξ) = + Φ (q (cavityFiniteLevel n (labeledCommonDepth n (ξ 0).1.1 (ξ 1).1.1))) * + (spinValue ((ξ 0).2 j) * spinValue ((ξ 1).2 j)) := + cavitySpinObservable_finite rho lam hrho hsum p q hq Φ hΦ j _ _ + simp only [cavityWeightedReplicaMean, cavityWeightNumerator, cavityWeightNormalizer, + priorCavityLabeledSpinDepthMean, referenceReplicaMean, referencePartition, Real.exp_sum, htest] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLimitingDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLimitingDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..9227094a7e905995c426bc3090abb9a22accde6c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLimitingDiagonal.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Fields.PriorLimitingGG +import OAI.Probability.InvariantIsing.Fields.PriorArrayDiagonal +import OAI.Probability.InvariantIsing.Arrays.TensorLimitingDiagonal + +namespace OAI + +/-! Deterministic diagonals in constrained-prior weak limits. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem priorPerturbation_minimizers_constantDiagonal + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) + (q : Fin (m+1) → ℝ) + (hc : Tendsto (fun k a => (tensorMinimumArrayDiagonal (N k) n (v k) a : ℝ)) atTop (𝓝 q)) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a := by + obtain ⟨C,hC,hbound⟩ := priorPerturbation_minimum_bounds hhaar hgauss + apply spectralArray_constant_diagonal_of_weak_limit _ Q hL _ q hc + intro i a + refine Fin.lastCases ?_ (fun a => ?_) a + · simp only [tensorMinimumArrayDiagonal,Fin.lastCases_last, + priorPerturbedArrayLaw,priorNamespacedArrayLaw_treeDiagonal] + exact tendsto_const_nhds + · let L := H+4+C*(K+4*m+8)^2 + have he : ∀ᶠ k in atTop, perturbationScale (N k)≤1/32 := + (perturbationScale_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + have hs : ∀ᶠ k in atTop, contactStep (N k)≤1/4 := + (contactStep_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + apply squeeze_zero' (Eventually.of_forall fun k => integral_nonneg (fun x => abs_nonneg _)) _ + ((diagonalContactRate_tendsto L).comp hNlim) + filter_upwards [he,hs] with k he hs + have hd := (hbound (N k) (hN k) (μ k) inferInstance (hμinv k) m n (ν k) inferInstance + (eig k) (c k) K hK (heig k) (I k) (u k) (hu k) (v k) (hv k) (t k) (ht k) + (h k) (hh k) (h0 k) H (hH k) he hs (hmin k)).1 a + have hd' := (priorSpectralDiagonal_clipping (μ k) (ν k) + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j : Fin (N k) => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude (N k) (u k)) + (fun j : Fin (N k) => enumeratedTreeDegree m j) (h k) a + (diagonalMinimumCenter (N k) (v k a))).trans hd + simpa only [priorPerturbedArrayLaw,tensorMinimumArrayDiagonal,Fin.lastCases_castSucc, + priorNamespacedArrayLaw_spectralDiagonal,L,Function.comp_def] using hd' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLimitingGG.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLimitingGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..38d38e0a25594c558d7cc10bbae6204c8b6c36ef --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLimitingGG.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Fields.PriorArrayResidualBound +import OAI.Probability.InvariantIsing.Arrays.TensorLimitingGG + +namespace OAI + +/-! Vector GG identities in weak limits of actual constrained-prior minimizers. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology BoundedContinuousFunction +namespace InvariantIsing + +def priorPerturbedArrayLaw {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (h : ℕ → ℝ) : + ProbabilityMeasure (SpectralArray (m+1)) := + priorNamespacedArrayLaw μ ν (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun j : Fin N => enumeratedTreeDegree m j) h + +theorem priorPerturbation_minimizers_spectralGG + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (ν : (k : ℕ) → Measure (Spin (N k) × LabeledLeaf n)) [∀ k, IsProbabilityMeasure (ν k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) : + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) := by + obtain ⟨C,hC,hbound⟩ := priorPerturbation_arrayResidual_bound hhaar hgauss + apply spectralGG_of_weak_nonconstant_monomial_residuals hL + intro z hz i D hD d hd + cases z with + | zero => omega + | succ q => + obtain ⟨j,hj⟩ := enumeratedJointMonomial_surjective m d hd + let BD := BoundedContinuousFunction.mkOfCompact ⟨D,hD⟩ + have hDb : ∀ x, |D x|≤‖BD‖ := fun x => by + simpa only [BD,BoundedContinuousFunction.mkOfCompact_apply,ContinuousMap.coe_mk,Real.norm_eq_abs] + using BD.norm_coe_le_norm x + let L := H+4+C*(K+4*m+8)^2 + have he : ∀ᶠ k in atTop, perturbationScale (N k)≤1/32 := + (perturbationScale_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + have hs : ∀ᶠ k in atTop, contactStep (N k)≤1/4 := + (contactStep_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + have hjN : ∀ᶠ k in atTop, j + Real.exp (cavityLogFactor 0 L (c • 1) + (cavityLeafSum h.depth s (labeledNoiseLeaf _ h.depth + (p.1, markForestOfCoords _ h.depth p.2) x.1.1) + x.1.2 : + EuclideanSpace ℝ (Fin d)) x.2)) + (((labeledLeafLaw h.depth p.1).prod (multivariateGaussian 0 R)).prod + π) := by + let f : (LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d))) → + (LabeledTree h.depth × (ForestVertex h.depth → Fin k → ℝ)) := + fun p => (p.1, fun a => cavityProjectField L (p.2 a)) + have hp : MeasurePreserving f (cavityLinearFieldCoordinateLaw h S) + (fieldVectorCoordinateLaw k h) := by + refine ⟨measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_cavityProjectField L).comp ((measurable_pi_apply a).comp measurable_snd)), ?_⟩ + exact cavity_projected_labeled_forest_law h.depth (chainExponent h.cut) + S hS L (fieldStepVariance h) hcov + have hi := hp.quasiMeasurePreserving.ae + (prior_field_vector_spin_exp_integrable k π hk h (cavityProjectField L s)) + filter_upwards [hi] with p hip + let y : LabeledLeaf h.depth → EuclideanSpace ℝ (Fin d) := fun α => + cavityLeafSum h.depth s + (labeledNoiseLeaf _ h.depth (p.1, markForestOfCoords _ h.depth p.2) α) + have hy : Measurable y := measurable_of_countable _ + have hfield : Integrable (fun t : Spin k × LabeledLeaf h.depth => + Real.exp (fieldEnergy (cavityProjectField L (y t.2)) t.1)) + ((π).prod (labeledLeafLaw h.depth p.1)) := by + simpa only [y, cavityProjectField_labeled_sum, fieldVectorEndpoint, f] using hip + exact prior_projected_spin_exp_integrable (labeledLeafLaw h.depth p.1) π + R hR L v hres y hy c hfield + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorLinearLogEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorLinearLogEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b6a8e2c781e499c613049761811d195143f89b5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorLinearLogEvaluation.lean @@ -0,0 +1,138 @@ +import OAI.Probability.InvariantIsing.Fields.PriorProjectedLog +import OAI.Probability.InvariantIsing.Fields.PriorFieldLogNormalizer +import OAI.Probability.InvariantIsing.Cavity.CavityLinearLogEvaluation + +namespace OAI + +/-! The rooted linear cavity logarithm with the finite spin prior retained. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal + +namespace InvariantIsing + +theorem prior_linear_noise_log_ae {d k : ℕ} (hk : 0 < k) (π : Measure (Spin k)) [IsProbabilityMeasure π] (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) : + ∀ᵐ p ∂cavityLinearFieldCoordinateLaw h S, + cavityRootedLogNormalizer h.depth 0 R L (c • 1) π + (s, labeledNoiseJoin _ h.depth (p.1, markForestOfCoords _ h.depth p.2)) = + (k : ℝ) * (c + v) / 2 + priorFieldVectorLogNormalizer k π h (cavityProjectField L s) + (p.1, fun a => cavityProjectField L (p.2 a)) := by + let f := fun p : LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d)) => + (p.1, fun a => cavityProjectField L (p.2 a)) + have hp : MeasurePreserving f (cavityLinearFieldCoordinateLaw h S) + (fieldVectorCoordinateLaw k h) := by + refine ⟨measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_cavityProjectField L).comp ((measurable_pi_apply a).comp measurable_snd)), ?_⟩ + exact cavity_projected_labeled_forest_law h.depth (chainExponent h.cut) + S hS L (fieldStepVariance h) hcov + have hgood := (cavity_linear_field_coordinates_law h S).quasiMeasurePreserving.ae + (noiseCascade_good (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (chainExponent_admissible h.ordered_cut h.first h.last) (cavityGaussianMarks S)) + have hI := hp.quasiMeasurePreserving.ae + (prior_field_vector_spin_exp_integrable k π hk h (cavityProjectField L s)) + filter_upwards [hgood, hI] with p hpGood hpI + rw [cavityRootedLogNormalizer_eq_residual] + have hmap := cavity_labeled_spin_prior_law h.depth p.1 p.2 hpGood + (cavity_good_noise_total _ _ hpGood) R π + have he := hmap.hasLaw.integral_comp + (measurable_cavityLeafSpinPotential h.depth 0 L (c • 1) s).exp.aestronglyMeasurable + rw [← he] + have hfield : Integrable (fun t : Spin k × LabeledLeaf h.depth => + Real.exp (fieldEnergy (cavityProjectField L + (cavityLeafSum h.depth s (labeledNoiseLeaf _ h.depth + (p.1, markForestOfCoords _ h.depth p.2) t.2))) t.1)) + (π.prod (labeledLeafLaw h.depth p.1)) := by + simpa only [cavityProjectField_labeled_sum, fieldVectorEndpoint, f] using hpI + have hh := prior_projected_log_normalizer (labeledLeafLaw h.depth p.1) π R hR L v hres + (fun α => cavityLeafSum h.depth s + (labeledNoiseLeaf _ h.depth (p.1, markForestOfCoords _ h.depth p.2) α)) + (measurable_of_countable _) c hfield + simpa only [Function.comp_def, cavityLabeledSpinMap, cavityProjectField_labeled_sum, + fieldVectorEndpoint, priorFieldVectorLogNormalizer] using hh + +theorem prior_linear_rooted_log_integral {d k : ℕ} (hk : 0 < k) (π : Measure (Spin k)) [IsProbabilityMeasure π] (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (hroot : L.transpose * S₀ * L = h.height 0 • 1) + (c : ℝ) : + let P := (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _) + Integrable (cavityRootedLogNormalizer h.depth 0 R L (c • 1) π) P ∧ + (∫ p, cavityRootedLogNormalizer h.depth 0 R L (c • 1) π p ∂P) = + (k : ℝ) * (c + v) / 2 + + ∫ z, cascadeRecursion h.depth (chainExponent h.cut) + (fun i => vectorGaussianLaw k (fieldStepVariance h i)) + (fun _ p => p.1 + p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) z + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _) := by + intro P + let Q := (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (cavityLinearFieldCoordinateLaw h S) + let f := fun p : LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d)) => + (p.1, fun a => cavityProjectField L (p.2 a)) + have hf : MeasurePreserving f (cavityLinearFieldCoordinateLaw h S) + (fieldVectorCoordinateLaw k h) := by + refine ⟨measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_cavityProjectField L).comp ((measurable_pi_apply a).comp measurable_snd)), ?_⟩ + exact cavity_projected_labeled_forest_law h.depth (chainExponent h.cut) + S hS L (fieldStepVariance h) hcov + let A := Prod.map (cavityProjectField L) f + have hA : MeasurePreserving A Q + ((vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _).prod + (fieldVectorCoordinateLaw k h)) := + (cavity_scalar_projected_field_law S₀ hS₀ L + (NNReal.mk (h.height 0) (h.nonneg 0)) hroot).prod hf + let T := Prod.map (id : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin d)) + (fun p : LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d)) => + labeledNoiseJoin _ h.depth (p.1, markForestOfCoords _ h.depth p.2)) + have hT : MeasurePreserving T Q P := + (MeasurePreserving.id (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀)).prod + (cavity_linear_field_coordinates_law h S) + let F := cavityRootedLogNormalizer h.depth 0 R L (c • 1) π + let G := fun p : (Fin k → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin k → ℝ)) => + (k : ℝ) * (c + v) / 2 + priorFieldVectorLogNormalizer k π h p.1 p.2 + have hF : Measurable F := measurable_cavityRootedLogNormalizer _ _ _ _ _ _ + have hG : Measurable G := (measurable_priorFieldVectorLogNormalizer k π h).const_add _ + have he : F ∘ T =ᵐ[Q] G ∘ A := by + apply (Measure.ae_prod_iff_ae_ae + (measurableSet_eq_fun (hF.comp hT.measurable) (hG.comp hA.measurable))).mpr + exact ae_of_all _ fun s => prior_linear_noise_log_ae hk π h S hS R hR L v hcov hres c s + have hscalar := prior_field_vector_log_root_integral k π hk h + (NNReal.mk (h.height 0) (h.nonneg 0)) + have hiG : Integrable G + ((vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _).prod + (fieldVectorCoordinateLaw k h)) := (integrable_const _).add hscalar.1 + have hi : Integrable F P := by + rw [← hT.map_eq] + exact (integrable_map_measure hF.aestronglyMeasurable hT.measurable.aemeasurable).mpr + ((hA.integrable_comp_of_integrable hiG).congr he.symm) + refine ⟨hi, ?_⟩ + calc + _ = ∫ p, F (T p) ∂Q := (hT.hasLaw.integral_comp hF.aestronglyMeasurable).symm + _ = ∫ p, G (A p) ∂Q := integral_congr_ae he + _ = ∫ p, G p ∂((vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _).prod + (fieldVectorCoordinateLaw k h)) := hA.hasLaw.integral_comp hG.aestronglyMeasurable + _ = _ := by + change (∫ p, (k : ℝ) * (c + v) / 2 + priorFieldVectorLogNormalizer k π h p.1 p.2 + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _).prod + (fieldVectorCoordinateLaw k h)) = _ + rw [integral_add (integrable_const _) hscalar.1, integral_const, + probReal_univ, one_smul, hscalar.2] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumBounds.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c86bd82446514ec05103d2be1827fc166d35719 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumBounds.lean @@ -0,0 +1,98 @@ +import OAI.Probability.InvariantIsing.Fields.PriorGGMinimum +import OAI.Probability.InvariantIsing.Fields.PriorMinimumCoordinates +import OAI.Probability.InvariantIsing.Fields.PriorNamespacedVariance + +namespace OAI + +/-! Actual constrained-prior minima satisfy both uniform perturbation bounds. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem priorPerturbation_minimum_bounds (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let L := H+4+C*(K+4*m+8)^2 + perturbationScale N≤1/32 → contactStep N≤1/4 → + (∀ u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I t h u v≤priorPerturbationObjective μ ν eig c I t h u' v') → + (∀ a, priorNamespacedObservableAverage μ ν (diagonalPerturbedEigenvalues eig I v t) + c I d (tensorPerturbationAmplitude N u) r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-diagonalMinimumCenter N (v a)|) + ≤diagonalContactRate N L) ∧ + (∀ j : Fin N, ∀ q : ℕ, ∀ B : ℝ, 0≤B → + ∀ D : SpecialOrthogonal N → (Fin (q+1) → Spin N × LabeledLeaf n) → ℝ, + Measurable (Function.uncurry D) → (∀ U σ, |D U σ|≤B) → + |priorSpectralGGResidual μ ν (diagonalPerturbedEigenvalues eig I v t) + c I d (tensorPerturbationAmplitude N u) r h j D|≤ + contactGGRate N j L B+2*B*(∑ a, (d j a : ℝ))*diagonalContactRate N L) := by + obtain ⟨C,hC,hvar⟩ := priorNamespacedPerturbation_variance hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n ν hν eig c K hK heig I u hu v hv t ht h hh h0 H hH d r L he hs hmin + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure ν := hν + have hNp : 0 abs_le.mpr ⟨by linarith [(hu j).1],(hu j).2⟩ + have hva : ∀ a, |v a|≤2 := fun a => abs_le.mpr ⟨by linarith [(hv a).1],(hv a).2⟩ + let amplitude := tensorPerturbationAmplitude N u + have hcoords := priorPerturbation_minimum_coordinates μ ν eig c I t h u v hu hv hmin + have hgv (a : Fin m) (w : ℝ) (hw : |w|≤2) : + MemLp (priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I d amplitude (fun i => tensorPathProfile I d n r h i)) 2 (μ.prod gaussianCoordinates) ∧ + variance (priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I d amplitude (fun i => tensorPathProfile I d n r h i)) (μ.prod gaussianCoordinates)≤N*L := by + exact hvar N hN μ hμ hμinv m n ν hν eig c K hK heig I u hua + (Function.update v a w) (update_abs_le_two hva a hw) t ht h hh h0 H hH + have hdiag (a : Fin m) : priorNamespacedObservableAverage μ ν + (diagonalPerturbedEigenvalues eig I v t) c I d amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-diagonalMinimumCenter N (v a)|) + ≤diagonalContactRate N L := by + have hd := priorDiagonal_fluctuation_at_minimum hNp μ ν eig c I d amplitude r h hh h0 + v t a (v a) L (hv a) he hs (fun w hw => (hgv a w hw).1) (fun w hw => (hgv a w hw).2) (by + dsimp only + intro w hw + simpa only [priorPerturbationPressureMean_eq_namespaced,Function.update_eq_self] + using hcoords.2 a w hw) + simpa only [Function.update_eq_self,diagonalMinimumCenter] using hd + refine ⟨hdiag,?_⟩ + intro j q B hB D hD hDb + have hgu (w : ℝ) (hw : |w|≤2) : + MemLp (priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (Function.update amplitude j (perturbationAmplitude N j*w)) + (fun i => tensorPathProfile I d n r h i)) 2 (μ.prod gaussianCoordinates) ∧ + variance (priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (Function.update amplitude j (perturbationAmplitude N j*w)) + (fun i => tensorPathProfile I d n r h i)) (μ.prod gaussianCoordinates)≤N*L := by + simpa only [tensorPerturbationAmplitude_update] using + hvar N hN μ hμ hμinv m n ν hν eig c K hK heig I (Function.update u j w) + (update_abs_le_two hua j hw) v hva t ht h hh h0 H hH + have hgm : + let M := fun w => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v t) + c I d (Function.update amplitude j (perturbationAmplitude N j*w)) + (fun i => tensorPathProfile I d n r h i) p ∂μ.prod gaussianCoordinates + ∀ w∈Set.Icc (1 : ℝ) 2, + -M (u j)+perturbationWeight j*(u j-3/2)^2≤-M w+perturbationWeight j*(w-3/2)^2 := by + dsimp only + intro w hw + simpa only [amplitude,priorPerturbationPressureMean_eq_namespaced,← tensorPerturbationAmplitude_update, + Function.update_eq_self] using hcoords.1 j w hw + have hg := priorGaussianGG_at_minimum hNp μ ν (diagonalPerturbedEigenvalues eig I v t) + c I d amplitude r h hh h0 j (u j) L (hu j) (by linarith) hs rfl + (fun w hw => (hgu w hw).1) (fun w hw => (hgu w hw).2) hgm B hB D hD hDb + (fun a => diagonalMinimumCenter N (v a)) (fun _ => diagonalContactRate N L) hdiag + simpa only [← Finset.sum_mul,mul_assoc] using hg + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumCoordinates.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6917c4ae8f47db68a412cca53eb25d995f36e96 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumCoordinates.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorMinimum +import OAI.Probability.InvariantIsing.Fields.PriorTensorNamespace + +namespace OAI + +/-! A joint constrained-prior minimum gives the two actual coordinate minima. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma priorPerturbationPressureMean_eq_namespaced {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) : + priorPerturbationPressureMean μ ν eig c I t h u v = + (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) n + (fun j => enumeratedTreeDegree m j) h i) p ∂μ.prod gaussianCoordinates := by + unfold priorPerturbationPressureMean + congr 1 + symm + exact (priorNamespacedLog_law μ ν _ c I _ _ _).integral_eq.trans + (integral_map (measurable_priorTensorLog ν _ c I _ _ _).aemeasurable aestronglyMeasurable_id) + +private lemma penalty_update {z : ℕ} (u w : Fin z → ℝ) (j : Fin z) (s : ℝ) : + (∑ i, w i * (Function.update u j s i - 3 / 2) ^ 2) = + (∑ i, w i * (u i - 3 / 2) ^ 2) - w j * (u j - 3 / 2) ^ 2 + w j * (s - 3 / 2) ^ 2 := by + classical + rw [← Finset.add_sum_erase _ _ (Finset.mem_univ j), + ← Finset.add_sum_erase _ _ (Finset.mem_univ j)] + have he : (∑ i ∈ Finset.univ.erase j, w i * (Function.update u j s i - 3 / 2) ^ 2) = + ∑ i ∈ Finset.univ.erase j, w i * (u i - 3 / 2) ^ 2 := by + apply Finset.sum_congr rfl + intro i hi + rw [Function.update_of_ne (Finset.mem_erase.mp hi).1] + rw [he, Function.update_self] + ring + +private lemma update_mem_Icc {z : ℕ} (u : Fin z → ℝ) (hu : ∀ i, u i ∈ Set.Icc (1 : ℝ) 2) + (j : Fin z) (s : ℝ) (hs : s ∈ Set.Icc (1 : ℝ) 2) : + ∀ i, Function.update u j s i ∈ Set.Icc (1 : ℝ) 2 := by + intro i + by_cases hi : i = j + · subst i + simpa only [Function.update_self] using hs + · simpa only [Function.update_of_ne hi] using hu i + +theorem priorPerturbation_minimum_coordinates {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) + (hu : ∀ j, u j∈Set.Icc (1 : ℝ) 2) (hv : ∀ a, v a∈Set.Icc (1 : ℝ) 2) + (hmin : ∀ u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I t h u v≤priorPerturbationObjective μ ν eig c I t h u' v') : + let M := priorPerturbationPressureMean μ ν eig c I t h + (∀ (j : Fin N) (s : ℝ), s∈Set.Icc (1 : ℝ) 2 → + -M u v+perturbationWeight j*(u j-3/2)^2≤ + -M (Function.update u j s) v+perturbationWeight j*(s-3/2)^2) ∧ + (∀ (a : Fin m) (s : ℝ), s∈Set.Icc (1 : ℝ) 2 → + -M u v+(v a-3/2)^2≤-M u (Function.update v a s)+(s-3/2)^2) := by + intro M + constructor + · intro j s hs + have hc := hmin (Function.update u j s) v (update_mem_Icc u hu j s hs) hv + unfold priorPerturbationObjective at hc + rw [penalty_update] at hc + linarith + · intro a s hs + have hc := hmin u (Function.update v a s) hu (update_mem_Icc v hv a s hs) + unfold priorPerturbationObjective at hc + have he := penalty_update v (fun _ => 1) a s + simp only [one_mul] at he + rw [he] at hc + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumEnvelope.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..b30e63d09d8a61037949ae54f47470242960608c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumEnvelope.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorMinimum +import OAI.Probability.InvariantIsing.Arrays.TensorMinimumPenalty + +namespace OAI + +/-! Minimum envelopes for the actual fixed-prior model. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma priorPerturbationObjective_eq {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) : + priorPerturbationObjective μ ν eig c I t h u v = + -priorPerturbationPressureMean μ ν eig c I t h u v + tensorMinimumPenalty u v := by + unfold priorPerturbationObjective tensorMinimumPenalty + ring + +/-- A genuine minimum lies within the same uniform cost of the base pressure, +and its quadratic penalty is at most twice that cost. -/ +theorem prior_minimum_envelope_cost {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) + (hu : ∀ j, u j ∈ Set.Icc (1 : ℝ) 2) (hv : ∀ a, v a ∈ Set.Icc (1 : ℝ) 2) + (hmin : ∀ u' v', (∀ j, u' j ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I t h u v ≤ + priorPerturbationObjective μ ν eig c I t h u' v') + (P δ : ℝ) + (hcost : ∀ u' v', (∀ j, u' j ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + |priorPerturbationPressureMean μ ν eig c I t h u' v' - P| ≤ δ) : + |(-priorPerturbationObjective μ ν eig c I t h u v) - P| ≤ δ ∧ + tensorMinimumPenalty u v ≤ 2 * δ := by + have hcenter : ∀ j : Fin N, (3 : ℝ)/2 ∈ Set.Icc (1 : ℝ) 2 := fun _ => by norm_num + have hcenter' : ∀ a : Fin m, (3 : ℝ)/2 ∈ Set.Icc (1 : ℝ) 2 := fun _ => by norm_num + have hc := abs_le.mp (hcost _ _ hcenter hcenter') + have hp := abs_le.mp (hcost u v hu hv) + have hm := hmin _ _ hcenter hcenter' + rw [priorPerturbationObjective_eq, priorPerturbationObjective_eq, + tensorMinimumPenalty_center] at hm + have hn := tensorMinimumPenalty_nonneg u v + rw [priorPerturbationObjective_eq] + exact ⟨abs_le.mpr ⟨by linarith, by linarith⟩, by linarith⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumFluctuations.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumFluctuations.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb452a8dc54026c3669551a0a0bbf994cf897176 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumFluctuations.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Fields.PriorDiagonalMinimum +import OAI.Probability.InvariantIsing.Fields.PriorReplicaAverage +import OAI.Probability.InvariantIsing.Arrays.PerturbationMinimumRates + +namespace OAI + +/-! Vanishing self-overlap fluctuation in the actual constrained-prior Gibbs law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma sqrt_dimension_mul {N : ℕ} (hN : 0 tensorPathProfile I degree n r h i)) 2 (μ.prod gaussianCoordinates)) + (hv : ∀ q : ℝ, |q|≤2 → + variance (priorNamespacedLog ν₀ (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i)) (μ.prod gaussianCoordinates)≤N*L) + (hmin : + let M := fun q => (N : ℝ)⁻¹ * ∫ p, priorNamespacedLog ν₀ + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates + ∀ q∈Set.Icc (1 : ℝ) 2, -M w+(w-3/2)^2≤-M q+(q-3/2)^2) : + let A := N*perturbationScale N + let center := 2*(N/A^2)*(A*w-A*(3/2)) + priorNamespacedObservableAverage μ ν₀ + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-center|)≤diagonalContactRate N L := by + intro A center + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have he' : 0 < perturbationScale N := Real.rpow_pos_of_pos hn _ + have hs' : 0 < contactStep N := Real.rpow_pos_of_pos hn _ + have hθ : 0 < 1 / (Real.sqrt N * perturbationScale N) := + one_div_pos.mpr (mul_pos (Real.sqrt_pos.mpr hn) he') + have hE := priorDiagonal_energy_at_minimum hN μ ν₀ eig c I degree amplitude r h hh h0 v t a + w (contactStep N) (1 / (Real.sqrt N * perturbationScale N)) (N * L) hw he hs' hs hθ hF hv hmin + have ht := priorFrozenDiagonal_observableAverage hN μ ν₀ eig c I degree amplitude r h hh h0 v t a w + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center|) + rw [← ht] + simpa only [sqrt_dimension_mul hN L,center,A,diagonalContactRate,mul_assoc] using hE.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumIncrement.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..72092ba785cb91d502ff1df46d97dfa5a9e2863d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorMinimumIncrement.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Fields.PriorMinimumEnvelope +import OAI.Probability.InvariantIsing.Cavity.CavityAmplitudePenalty + +namespace OAI + +/-! Physical increments of the fixed-prior minimum envelope. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem prior_minimum_increment {N n m depth : ℕ} + (μ : Measure (SpecialOrthogonal (N+n))) (ν : Measure (SpecialOrthogonal N)) + (ρF : Measure (Spin (N+n) × LabeledLeaf depth)) (ρB : Measure (Spin N × LabeledLeaf depth)) + (eigF cF : Fin (N+n) → ℝ) (eigB cB : Fin N → ℝ) + (IF : Fin m → Finset (Fin (N+n))) (IB : Fin m → Finset (Fin N)) + (t : ℝ) (h : ℕ → ℝ) (uF : Fin (N+n) → ℝ) (vF : Fin m → ℝ) + (uB : Fin N → ℝ) (vB : Fin m → ℝ) + (huB : ∀ j, uB j ∈ Set.Icc (1 : ℝ) 2) (hvB : ∀ a, vB a ∈ Set.Icc (1 : ℝ) 2) + (hminF : ∀ u' v', (∀ j, u' j ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ρF eigF cF IF t h uF vF ≤ + priorPerturbationObjective μ ρF eigF cF IF t h u' v') : + let uE := fun j : Fin (N+n) => cavityBaseAmplitude uB j; + -(N+n : ℝ)*priorPerturbationObjective μ ρF eigF cF IF t h uF vF + + (N : ℝ)*priorPerturbationObjective ν ρB eigB cB IB t h uB vB ≥ + ((N+n : ℝ)*priorPerturbationPressureMean μ ρF eigF cF IF t h uE vB - + (N : ℝ)*priorPerturbationPressureMean ν ρB eigB cB IB t h uB vB) - + (n : ℝ)*tensorMinimumPenalty uB vB - (N+n : ℝ)*(1/4:ℝ)*(1/2:ℝ)^N := by + intro uE + have hm := hminF uE vB (fun j => cavityBaseAmplitude_mem uB huB j) hvB + simp only [priorPerturbationObjective_eq] at hm + have hp := cavityBaseAmplitude_penalty_le (n := n) uB vB + have hscale := mul_le_mul_of_nonneg_left hm (by positivity : (0:ℝ)≤N+n) + have hpscale := mul_le_mul_of_nonneg_left hp (by positivity : (0:ℝ)≤N+n) + simp only [priorPerturbationObjective_eq] + dsimp only [uE] at hscale ⊢ + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorNamespacedVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorNamespacedVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c53e579f2bcc5e1cacb5563a6c4d033eb689089 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorNamespacedVariance.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Fields.PriorPerturbationVariance +import OAI.Probability.InvariantIsing.Fields.PriorTensorNamespace + +namespace OAI + +/-! The same uniform bound for the raw, independently namespaced log partition. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +theorem priorNamespacedPerturbation_variance (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let F := priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) (fun i => tensorPathProfile I d n r h i) + MemLp F 2 (μ.prod gaussianCoordinates) ∧ + variance F (μ.prod gaussianCoordinates) ≤ N*(H+4+C*(K+4*m+8)^2) := by + obtain ⟨C,hC,hvar⟩ := priorPerturbation_variance hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n ν hν eig c K hK heig I u hu v hv t ht h hh h0 H hH d r F + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure ν := hν + let G := priorTensorLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) (fun i => tensorPathProfile I d n r h i) + have hn : (N : ℝ)≠0 := Nat.cast_ne_zero.mpr (by omega) + have hscaled := hvar N hN μ hμ hμinv m n ν hν eig c K hK heig I u hu v hv t ht h hh h0 H hH + have heq : (fun p => (N : ℝ)*((N : ℝ)⁻¹*G p))=G := by + funext p + simp only [← mul_assoc,mul_inv_cancel₀ hn,one_mul] + have hg : MemLp G 2 (μ.prod gaussianCoordinates) := by + rw [← heq] + exact hscaled.1.const_mul N + have hvg : variance G (μ.prod gaussianCoordinates)≤N*(H+4+C*(K+4*m+8)^2) := by + calc + _ = (N : ℝ)^2 * variance (fun p => (N : ℝ)⁻¹*G p) (μ.prod gaussianCoordinates) := by + conv_lhs => rw [← heq] + exact variance_const_mul N _ _ + _ ≤ (N : ℝ)^2*((H+4+C*(K+4*m+8)^2)/N) := + mul_le_mul_of_nonneg_left hscaled.2 (sq_nonneg _) + _ = _ := by field_simp + have hm := priorNamespacedLog_moments μ ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) (fun i => tensorPathProfile I d n r h i) hg + exact ⟨hm.1,hm.2.1.trans_le hvg⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbationCost.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbationCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0909d136580790994343adf257f27107b2daa69 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbationCost.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Fields.PriorMinimumEnvelope +import OAI.Probability.InvariantIsing.Arrays.TensorMinimumPressure + +namespace OAI + +/-! The perturbation cost is uniform over all probability priors, including +product constraints whose masses can vanish exponentially in the dimension. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma priorPerturbationPressureMean_cost (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (u : Fin N → ℝ) (hu : ∀ j, |u j| ≤ 2) + (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) : + |priorPerturbationPressureMean μ ν eig c I t h u v - + priorPerturbationPressureMean μ ν eig c I t h 0 0| ≤ + 2*m*perturbationScale N + 8*perturbationScale N^2 := by + have hc := priorPerturbationPressureMean_modulus hhaar hgauss hN μ hμ ν eig c I t h hh h0 u 0 v 0 + have he : tensorAmplitudeModulus (tensorPerturbationAmplitude N u) + (tensorPerturbationAmplitude N 0) = ∑ j, (tensorPerturbationAmplitude N u j)^2 := by + simp [tensorAmplitudeModulus, tensorPerturbationAmplitude, ← pow_two, mul_pow] + rw [he] at hc + have hs : (∑ a : Fin m, |v a - (0 : Fin m → ℝ) a|) ≤ 2*m := by + calc + _ ≤ ∑ _a : Fin m, (2 : ℝ) := Finset.sum_le_sum fun a _ => by simpa using hv a + _ = _ := by simp; ring + have hb := add_le_add + (mul_le_mul_of_nonneg_left (tensorPerturbationAmplitude_square_sum_le N u hu) + (show 0 ≤ 2*(N : ℝ)⁻¹ by positivity)) + (mul_le_mul_of_nonneg_left hs (show 0 ≤ perturbationScale N from Real.rpow_nonneg (Nat.cast_nonneg _) _)) + apply hc.trans + apply hb.trans_eq + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + field_simp + ring + +lemma prior_minimum_perturbation_cost (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (u : Fin N → ℝ) (v : Fin m → ℝ) + (hu : ∀ j, u j ∈ Set.Icc (1 : ℝ) 2) (hv : ∀ a, v a ∈ Set.Icc (1 : ℝ) 2) + (hmin : ∀ u' v', (∀ j, u' j ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I t h u v ≤ + priorPerturbationObjective μ ν eig c I t h u' v') : + |(-priorPerturbationObjective μ ν eig c I t h u v) - + priorPerturbationPressureMean μ ν eig c I t h 0 0| ≤ + 2*m*perturbationScale N + 8*perturbationScale N^2 ∧ + tensorMinimumPenalty u v ≤ 2*(2*m*perturbationScale N + 8*perturbationScale N^2) := by + exact prior_minimum_envelope_cost μ ν eig c I t h u v hu hv hmin _ _ + (fun u' v' hu' hv' => priorPerturbationPressureMean_cost hhaar hgauss hN μ hμ ν eig c I t h hh h0 + u' (fun j => abs_le.mpr ⟨by linarith [(hu' j).1], (hu' j).2⟩) + v' (fun a => abs_le.mpr ⟨by linarith [(hv' a).1], (hv' a).2⟩)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbationVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbationVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..c59c7fe952f926b147472bdc070143836b616caa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbationVariance.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorPressure +import OAI.Probability.InvariantIsing.Arrays.FullPerturbationVariance + +namespace OAI + +/-! Uniform concentration of the actual finite perturbation for a fixed +constrained prior. No full-cube symmetry is used in this estimate. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +theorem priorPerturbation_variance (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let F := fun p => (N : ℝ)⁻¹ * priorTensorLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) (fun i => tensorPathProfile I d n r h i) p + MemLp F 2 (μ.prod gaussianCoordinates) ∧ + variance F (μ.prod gaussianCoordinates) ≤ (H+4+C*(K+4*m+8)^2)/N := by + obtain ⟨C,hC,hvar⟩ := priorTensorLog_variance hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n ν hν eig c K hK heig I u hu v hv t ht h hh h0 H hH d r F + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure ν := hν + have hNp : 0 varianceIncrement h i) (fun i j => varianceIncrement (monomialPath n (r j)) i) + have hsum := tensorPerturbationAmplitude_square_sum_le N u hu + have hsmall := perturbationScale_sq_le_one hNp + have hsum' : (∑ j : Fin N, a j^2) ≤ 4*N := + hsum.trans ((mul_le_mul_of_nonneg_left hsmall (by positivity : 0≤4*(N : ℝ))).trans_eq (mul_one _)) + have hG : (∑ i : Fin (n+1), ((varianceIncrement h i : ℝ)*N+ + ∑ j : Fin N, (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2)) ≤ (H+4)*N := by + rw [Finset.sum_add_distrib,← Finset.sum_mul,varianceIncrement_sum hh h0,Finset.sum_comm] + have hm : (∑ j : Fin N, ∑ i : Fin (n+1), + (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2) ≤ ∑ j : Fin N, a j^2 := by + apply Finset.sum_le_sum + intro j _ + rw [← Finset.sum_mul] + exact (mul_le_mul_of_nonneg_right (monomialVarianceIncrement_sum_le n (r j)) + (sq_nonneg _)).trans_eq (one_mul _) + have hhN := mul_le_mul_of_nonneg_right hH hNr.le + linarith + have hdeg : ∀ j : Fin N, (∑ b, (d j b : ℝ)) ≤ 1*((j : ℝ)+1) := by + intro j + simpa only [one_mul] using enumeratedSpectralDegree_real_sum_le m j + have hrot := (tensorPathProfile_rotation_cap d a n r).trans + (tensorPerturbationAmplitude_degree_sum_le u hu d 1 zero_le_one hdeg) + have hrot' : (∑ i : Fin (n+1), ∑ j : Fin N, + (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2*∑ b, (d j b : ℝ)) ≤ 4*N := by + apply hrot.trans + simpa only [mul_one] using mul_le_mul_of_nonneg_left hsmall (by positivity : 0≤4*(N : ℝ)) + have hL0 : 0≤L := by dsimp only [L]; positivity + have hL : L≤N*(K+4*m+8) := by dsimp only [L]; linarith + have hLsq := pow_le_pow_left₀ hL0 hL 2 + have hvbound := hp.2.trans (add_le_add hG + (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hLsq hC.le) hNr.le)) + refine ⟨hp.1.const_mul _,?_⟩ + rw [variance_const_mul] + have he := mul_le_mul_of_nonneg_left hvbound (sq_nonneg (N : ℝ)⁻¹) + apply he.trans_eq + field_simp [hNr.ne'] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbedWardLimits.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbedWardLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6082f395a97f9ab00360a13c7dc1f3404078853 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorPerturbedWardLimits.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Fields.PriorArrayWard +import OAI.Probability.InvariantIsing.Fields.PriorArrayDiagonalWard +import OAI.Probability.InvariantIsing.Fields.PriorLimitingGG +import OAI.Probability.InvariantIsing.Spectral.SpectralPerturbedBlocks + +namespace OAI + +/-! Both Ward equations for weak limits of the actual fixed-prior model. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem priorPerturbedArrayLaw_ward_limits + (N : ℕ → ℕ) (hN : ∀ k, 0 priorPerturbedArrayLaw (μ k) (ν k) (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) + (ρ : Fin m → ℝ) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) : + (∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ r, |Φ r|≤B) → + spectralOffWardResidual Q ρ (fun a => t₀*lam a) a b Φ=0) ∧ + (∀ a b, spectralDiagonalWardResidual Q ρ (fun a => t₀*lam a) a b=0) := by + let E := fun k => diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k) + let κ := fun k a => t k*lam a+2*perturbationScale (N k)*v k a + have hκ : ∀ k a i, i∈I k a → E k i=κ k a := fun k => + diagonalPerturbedEigenvalues_block (eig k) (I k) (hdis k) (v k) (t k) lam (hlam k) + have hκlim : Tendsto κ atTop (𝓝 (fun a => t₀*lam a)) := + perturbedBlockEigenvalues_tendsto N hNlim v hv t ht lam + have hdegree (k : ℕ) (j : Fin (N k)) : + (∑ a, (enumeratedSpectralDegree m j a : ℝ))≤1*((j : ℝ)+1) := by + simpa only [one_mul] using enumeratedSpectralDegree_real_sum_le m j + refine ⟨?_,?_⟩ + · intro a b Φ hΦ B hB hΦB + by_cases hab : a=b + · subst b + simp [spectralOffWardResidual] + have he : Tendsto (fun k => 192*B*1*perturbationScale (N k)^2) atTop (𝓝 0) := by + simpa only [zero_pow (by norm_num : (2 : ℕ)≠0),mul_zero] using + (tendsto_const_nhds.mul ((perturbationScale_tendsto.comp hNlim).pow 2) : + Tendsto (fun k => 192*B*1*perturbationScale (N k)^2) atTop (𝓝 (192*B*1*0^2))) + apply spectralOffWardResidual_zero_of_vanishing_bound hL hρ hκlim a b Φ hΦ he + intro k + let := hμinv k + exact priorNamespacedArrayLaw_off_ward_bound (hN k) (μ k) (ν k) (E k) (c k) (I k) + (hdis k) (hcover k) (fun j => enumeratedSpectralDegree m j) + (fun j => enumeratedTreeDegree m j) (u k) (hu k) 1 zero_le_one (hdegree k) + (h k) (hh k) (h0 k) (κ k) a b + (hdis k (Set.mem_univ a) (Set.mem_univ b) hab) (hκ k a) (hκ k b) Φ hΦ B hB hΦB + · intro a b + by_cases hab : a=b + · subst b + simp [spectralDiagonalWardResidual] + have he : Tendsto (fun k => 48*1*perturbationScale (N k)^2) atTop (𝓝 0) := by + simpa only [zero_pow (by norm_num : (2 : ℕ)≠0),mul_zero] using + (tendsto_const_nhds.mul ((perturbationScale_tendsto.comp hNlim).pow 2) : + Tendsto (fun k => 48*1*perturbationScale (N k)^2) atTop (𝓝 (48*1*0^2))) + apply spectralDiagonalWardResidual_zero_of_vanishing_bound hL hρ hκlim a b he + intro k + let := hμinv k + exact priorNamespacedArrayLaw_diagonalWard_bound (hN k) (μ k) (ν k) (E k) (c k) (I k) + (fun j => enumeratedSpectralDegree m j) (fun j => enumeratedTreeDegree m j) + (u k) (hu k) 1 zero_le_one (hdegree k) (h k) (hh k) (h0 k) (κ k) a b + (hdis k (Set.mem_univ a) (Set.mem_univ b) hab) (hκ k a) (hκ k b) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorPosteriorPair.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorPosteriorPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c4ad1e30770916897d239f2ab05c803298ad944 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorPosteriorPair.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Fields.PriorResidualIntegrability +import OAI.Probability.InvariantIsing.Cavity.CavityPosteriorPair + +namespace OAI + +/-! Exact residual-free two-spin law with the constrained prior retained. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +theorem prior_residual_spin_pair_marginal {A : Type*} [MeasurableSpace A] {N : ℕ} + (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin N)) [IsProbabilityMeasure π] + (Y : A → Fin N → ℝ) (hY : Measurable Y) (v : ℝ≥0) (c : ℝ) + (hI : Integrable (fun p : Spin N × A => Real.exp (fieldEnergy (Y p.2) p.1)) + (π.prod ν)) + (D : (Fin 2 → Spin N × A) → ℝ) (hD : Measurable D) : + referenceReplicaMean ((ν.prod (vectorGaussianLaw N v)).prod π) + (fun p => fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2) + (fun σ => D (fun i => ((σ i).2, (σ i).1.1))) = + referenceReplicaMean (π.prod ν) + (fun p => fieldEnergy (Y p.2) p.1) D := by + have hI' : Integrable (fun p : A × Spin N => Real.exp (fieldEnergy (Y p.1) p.2)) + (ν.prod π) := hI.swap + have hfull := prior_residual_spin_exp_integrable ν π Y hY v c hI' + let f : (A × (Fin N → ℝ)) × Spin N → Spin N × A := fun p => (p.2, p.1.1) + have hf : Measurable f := measurable_snd.prodMk measurable_fst.fst + have hJ : Measurable (fun p : Spin N × A => fieldEnergy (Y p.2) p.1) := by + unfold fieldEnergy + fun_prop + have hmap : + ((((ν.prod (vectorGaussianLaw N v)).prod π).tilted + (fun p => fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2)).map f) = + (π.prod ν).tilted + (fun p => fieldEnergy (Y p.2) p.1) := by + change (((ν.prod (vectorGaussianLaw N v)).prod π).tilted + (fun p => fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2)).map + (Prod.swap ∘ (fun p : (A × (Fin N → ℝ)) × Spin N => + (p.1.1, p.2))) = _ + rw [← Measure.map_map measurable_swap (measurable_fst.fst.prodMk measurable_snd), + prior_residual_leaf_spin_marginal ν π Y hY v c hfull] + have h := cavity_tilt_map (ν.prod π) Prod.swap measurable_swap + (fun p : Spin N × A => fieldEnergy (Y p.2) p.1) hJ + simpa only [Function.comp_def, Prod.swap, Measure.prod_swap] using h + exact cavity_posterior_pair_map _ _ _ _ hfull hI f hf hmap D hD + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorPrincipalWard.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorPrincipalWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..804c0598b277e2282bd1c6cfe82626868506d2e3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorPrincipalWard.lean @@ -0,0 +1,72 @@ +import OAI.Probability.InvariantIsing.Fields.PriorReplicaAverage +import OAI.Probability.InvariantIsing.Arrays.TensorCascadeReplicaAverage +import OAI.Probability.InvariantIsing.Arrays.TensorCountableWard +import OAI.Probability.InvariantIsing.Arrays.TensorCountableDiagonalWard + +namespace OAI + +/-! The principal Ward bounds hold for each fixed constrained spin prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +lemma priorNamespacedReplicaAverage_reference {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0≤h 0) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) : + priorNamespacedReplicaAverage μ ν eig c I degree amp r h D = + ∫ z : SpecialOrthogonal N × (ℕ → ℝ), referenceReplicaMean ν + (tensorRestrictionHamiltonian eig c I degree amp + (fun a => tensorPathProfile I degree n r h a) id z.1 z.2) (D z.1) + ∂μ.prod gaussianCoordinates := by + unfold priorNamespacedReplicaAverage + apply integral_congr_ae + filter_upwards [priorNamespaced_exp_integrable_ae μ ν eig c I degree amp r h hh h0] with z hz + exact referenceReplicaMean_gibbsProbability ν _ hz _ + +theorem priorNamespaced_off_principal_bound {N m n : ℕ} (hN : 0 tensorOffDirect eig J K Prod.fst F U) - + 2*priorNamespacedReplicaAverage μ ν eig c I degree (tensorPerturbationAmplitude N u) r h + (fun U => tensorOffFresh eig J K Prod.fst F U)|≤192*B*D*perturbationScale N^2 := by + rw [priorNamespacedReplicaAverage_reference μ ν eig c I degree _ r h hh h0, + priorNamespacedReplicaAverage_reference μ ν eig c I degree _ r h hh h0] + exact tensorCountable_off_principal_bound hN μ ν eig c I degree r u hu D hD hd + h hh h0 id J K hJK F B hB hF + +theorem priorNamespaced_diagonal_principal_bound {N m n : ℕ} (hN : 0 + Real.exp (fieldEnergy (cavityProjectField L (y p.2)) p.1)) + (π.prod ν)) : + Real.log (∫ p : (A × EuclideanSpace ℝ (Fin d)) × Spin k, + Real.exp (cavityLogFactor 0 L (c • 1) (y p.1.1 + p.1.2 : + EuclideanSpace ℝ (Fin d)) p.2) + ∂((ν.prod (multivariateGaussian 0 R)).prod π)) = + (k : ℝ) * (c + v) / 2 + + Real.log (∫ p : Spin k × A, + Real.exp (fieldEnergy (cavityProjectField L (y p.2)) p.1) + ∂(π.prod ν)) := by + let Y := fun a => cavityProjectField L (y a) + have hY : Measurable Y := (measurable_cavityProjectField L).comp hy + let F : (A × (Fin k → ℝ)) × Spin k → ℝ := fun p => + Real.exp (fieldEnergy (Y p.1.1 + p.1.2) p.2 + (k : ℝ) * c / 2) + have hF : Measurable F := by + have harg : Measurable (fun p : (A × (Fin k → ℝ)) × Spin k => Y p.1.1 + p.1.2) := + (hY.comp measurable_fst.fst).add measurable_fst.snd + unfold F fieldEnergy + fun_prop + have hp := prior_projected_spin_law ν π R hR L v hres + have hproject := hp.hasLaw.integral_comp hF.aestronglyMeasurable + have hr := prior_spin_residual_reorder_law (N := k) ν π v + let G : (A × Spin k) × (Fin k → ℝ) → ℝ := fun p => + Real.exp (fieldEnergy (Y p.1.1 + p.2) p.1.2 + (k : ℝ) * c / 2) + have hG : Measurable G := by + have harg : Measurable (fun p : (A × Spin k) × (Fin k → ℝ) => Y p.1.1 + p.2) := + (hY.comp measurable_fst.fst).add measurable_snd + unfold G fieldEnergy + fun_prop + have hIG : Integrable G ((ν.prod π).prod (vectorGaussianLaw k v)) := by + have hIF := prior_residual_spin_exp_integrable ν π Y hY v c hI.swap + rw [← hr.map_eq] + exact (integrable_map_measure hG.aestronglyMeasurable hr.measurable.aemeasurable).mpr + (by simpa only [Function.comp_def, G, F, cavitySpinResidualReorder] using hIF) + have he : (∫ p : (A × EuclideanSpace ℝ (Fin d)) × Spin k, + Real.exp (cavityLogFactor 0 L (c • 1) (y p.1.1 + p.1.2 : + EuclideanSpace ℝ (Fin d)) p.2) + ∂((ν.prod (multivariateGaussian 0 R)).prod π)) = + Real.exp ((k : ℝ) * (c + v) / 2) * + ∫ p : Spin k × A, Real.exp (fieldEnergy (Y p.2) p.1) + ∂(π.prod ν) := by + calc + _ = ∫ p, F p ∂((ν.prod (vectorGaussianLaw k v)).prod π) := by + simpa only [Function.comp_def, F, Y, cavityResidualFieldProjection, + cavity_linear_factor_project, cavityProjectField_add] using hproject + _ = ∫ p, G p ∂((ν.prod π).prod (vectorGaussianLaw k v)) := + hr.hasLaw.integral_comp hG.aestronglyMeasurable + _ = _ := by + rw [integral_prod _ hIG] + simp only [G] + simp_rw [cavity_residual_spin_integral, Real.exp_add] + rw [integral_mul_const, mul_comm] + congr 1 + exact (integral_prod_swap _).symm + rw [he, Real.log_mul (Real.exp_ne_zero _) (integral_exp_pos hI).ne', Real.log_exp] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorProjectedPair.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorProjectedPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9b5449dcd99d2420dcb2eaf1cc89c032ff1e327 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorProjectedPair.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Fields.PriorPosteriorPair +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledSpin + +namespace OAI + +/-! Euclidean Gaussian projection and residual removal for a finite spin prior. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal + +namespace InvariantIsing + +lemma prior_projected_spin_law {A : Type*} [MeasurableSpace A] + {d k : ℕ} (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin k)) [IsProbabilityMeasure π] + (S : Matrix (Fin d) (Fin d) ℝ) (hS : S.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : L.transpose * S * L = (v : ℝ) • 1) : + MeasurePreserving (cavityResidualFieldProjection (A := A) L) + ((ν.prod (multivariateGaussian 0 S)).prod π) + ((ν.prod (vectorGaussianLaw k v)).prod π) := by + have h1 := (MeasurePreserving.id ν).prod + (cavity_scalar_projected_field_law S hS L v hcov) + exact h1.prod (MeasurePreserving.id π) + +theorem prior_projected_spin_exp_integrable {A : Type*} [MeasurableSpace A] + {d k : ℕ} (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin k)) [IsProbabilityMeasure π] + (S : Matrix (Fin d) (Fin d) ℝ) (hS : S.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : L.transpose * S * L = (v : ℝ) • 1) + (y : A → EuclideanSpace ℝ (Fin d)) (hy : Measurable y) (c : ℝ) + (hI : Integrable (fun p : Spin k × A => + Real.exp (fieldEnergy (cavityProjectField L (y p.2)) p.1)) + (π.prod ν)) : + Integrable (fun p : (A × EuclideanSpace ℝ (Fin d)) × Spin k => + Real.exp (cavityLogFactor 0 L (c • 1) + (y p.1.1 + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2)) + ((ν.prod (multivariateGaussian 0 S)).prod π) := by + have hY := (measurable_cavityProjectField L).comp hy + have hfull := prior_residual_spin_exp_integrable ν π + (fun a => cavityProjectField L (y a)) hY v c hI.swap + have hp := prior_projected_spin_law ν π S hS L v hcov + have hi := hp.hasLaw.integrable_comp hfull + simpa only [Function.comp_def, cavityResidualFieldProjection, + cavity_linear_factor_project, cavityProjectField_add] using hi + +theorem prior_projected_spin_pair_reduce {A : Type*} [MeasurableSpace A] + {d k : ℕ} (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin k)) [IsProbabilityMeasure π] + (S : Matrix (Fin d) (Fin d) ℝ) (hS : S.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : L.transpose * S * L = (v : ℝ) • 1) + (y : A → EuclideanSpace ℝ (Fin d)) (hy : Measurable y) (c : ℝ) + (hI : Integrable (fun p : Spin k × A => + Real.exp (fieldEnergy (cavityProjectField L (y p.2)) p.1)) + (π.prod ν)) + (D : (Fin 2 → Spin k × A) → ℝ) (hD : Measurable D) : + referenceReplicaMean ((ν.prod (multivariateGaussian 0 S)).prod π) + (fun p => cavityLogFactor 0 L (c • 1) + (y p.1.1 + p.1.2 : EuclideanSpace ℝ (Fin d)) p.2) + (fun σ => D (fun i => ((σ i).2, (σ i).1.1))) = + referenceReplicaMean (π.prod ν) + (fun p => fieldEnergy (cavityProjectField L (y p.2)) p.1) D := by + have hY := (measurable_cavityProjectField L).comp hy + have hfull := prior_projected_spin_exp_integrable ν π S hS L v hcov y hy c hI + have hfield := prior_residual_spin_exp_integrable ν π + (fun a => cavityProjectField L (y a)) hY v c hI.swap + have hp := cavity_projected_linear_spin_law ν S hS L v hcov y hy c + π + have hD' : Measurable (fun σ : Fin 2 → (A × (Fin k → ℝ)) × Spin k => + D (fun i => ((σ i).2, (σ i).1.1))) := + hD.comp (Measurable.of_eval fun i => + ((measurable_pi_apply i).snd).prodMk (measurable_pi_apply i).fst.fst) + calc + _ = referenceReplicaMean ((ν.prod (vectorGaussianLaw k v)).prod π) + (fun p => fieldEnergy (cavityProjectField L (y p.1.1) + p.1.2) p.2 + + (k : ℝ) * c / 2) + (fun σ => D (fun i => ((σ i).2, (σ i).1.1))) := by + exact cavity_posterior_pair_map _ _ _ _ hfull hfield + (cavityResidualFieldProjection L) (measurable_cavityResidualFieldProjection L) hp _ hD' + _ = _ := prior_residual_spin_pair_marginal ν π _ hY v c hI D hD + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorReplicaAverage.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorReplicaAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..9375b5a318b0a70ecdce750ff37064a6af77177a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorReplicaAverage.lean @@ -0,0 +1,167 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFrozenGibbs +import OAI.Probability.InvariantIsing.Arrays.TensorReplicaAverageLaw + +namespace OAI + +/-! Observable and replica averages for the actual fixed-prior Gibbs measure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +def priorNamespacedObservableAverage {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → Spin N × LabeledLeaf n → ℝ) : ℝ := + ∫ p : SpecialOrthogonal N × (ℕ → ℝ), ∫ x, D p.1 x + ∂priorNamespacedReference ν eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p + ∂μ.prod gaussianCoordinates + +lemma measurable_priorNamespacedObservableMean {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → Spin N × LabeledLeaf n → ℝ) + (hD : Measurable (Function.uncurry D)) : + Measurable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, D p.1 x + ∂priorNamespacedReference ν eig c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p) := by + have hm := measurable_random_tilted_integral + (measurable_priorNamespacedReference ν eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i)) + (H := fun _ => 0) measurable_const (hD.comp (measurable_fst.fst.prodMk measurable_snd)) + change Measurable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, D p.1 x + ∂(priorNamespacedReference ν eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p).tilted 0) at hm + simpa only [tilted_zero] using hm + +lemma priorNamespacedObservableAverage_integrable {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → Spin N × LabeledLeaf n → ℝ) + (hD : Measurable (Function.uncurry D)) {B : ℝ} (hB : ∀ U x, |D U x|≤B) : + Integrable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, D p.1 x + ∂priorNamespacedReference ν eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p) (μ.prod gaussianCoordinates) := by + apply Integrable.of_bound + (measurable_priorNamespacedObservableMean ν eig c I degree amplitude r h D hD).aestronglyMeasurable B + exact ae_of_all _ fun p => by + simpa only [probReal_univ,mul_one,Real.norm_eq_abs] using + norm_integral_le_of_norm_le_const + (μ := priorNamespacedReference ν eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p) + (f := fun x => D p.1 x) (C := B) (ae_of_all _ fun x => by + simpa only [Real.norm_eq_abs] using hB p.1 x) + +theorem priorFrozenGaussian_observableAverage {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) (t : ℝ) + (D : SpecialOrthogonal N → Spin N × LabeledLeaf n → ℝ) + (hD : Measurable (Function.uncurry D)) : + (∫ p : PriorFrozenData N j × (ℕ → ℝ), ∫ x, D p.1.1 x + ∂(priorFrozenReference ν eig c I degree amplitude r h j p.1).tilted + (fun x => t*cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1) I (degree j) n (r j) x) p.2) + ∂(priorFrozenLaw μ j).prod gaussianCoordinates) = + priorNamespacedObservableAverage μ ν eig c I degree (Function.update amplitude j t) r h D := by + let F := fun p : SpecialOrthogonal N × (ℕ → ℝ) => ∫ x, D p.1 x + ∂priorNamespacedReference ν eig c I degree (Function.update amplitude j t) + (fun i => tensorPathProfile I degree n r h i) p + have hF := measurable_priorNamespacedObservableMean ν eig c I degree (Function.update amplitude j t) r h D hD + calc + _ = ∫ p, F (priorFrozenInsertion j p) ∂(priorFrozenLaw μ j).prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [priorFrozenGaussian_reference_fold_ae μ ν eig c I degree amplitude r h hh h0 j t] + with p hp + rw [hp] + rfl + _ = _ := (priorFrozenInsertion_preserving μ j).hasLaw.integral_comp hF.aestronglyMeasurable + +theorem priorFrozenDiagonal_observableAverage {N m k n : ℕ} (hN : 0 tensorPathProfile I degree n r h i) p).tilted + (fun x => N*perturbationScale N*w*projectedOverlap (specialRotation p.1) (I a) x.1 x.1) + ∂μ.prod gaussianCoordinates) = + priorNamespacedObservableAverage μ ν + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude r h D := by + apply integral_congr_ae + filter_upwards [priorFrozenDiagonal_reference_fold_ae hN μ ν eig c I degree amplitude r h hh h0 v t a w] + with p hp + rw [hp] + +def priorNamespacedReplicaAverage {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) : ℝ := + ∫ p : SpecialOrthogonal N × (ℕ → ℝ), + referenceReplicaMean (priorNamespacedReference ν eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p) (fun _ => 0) (D p.1) + ∂μ.prod gaussianCoordinates + +lemma measurable_priorNamespacedReplicaMean {N m k n q : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) : + Measurable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => + referenceReplicaMean (priorNamespacedReference ν eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p) (fun _ => 0) (D p.1)) := + measurable_random_referenceReplicaMean (measurable_priorNamespacedReference ν eig c I degree amplitude _) + measurable_const (hD.comp (measurable_fst.fst.prodMk measurable_snd)) + +theorem priorFrozenGaussian_replicaAverage {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν₀ : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν₀] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) (j : Fin k) (t : ℝ) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) : + let U := fun ω : PriorFrozenData N j => ω.1 + randomCoefficientAverage (priorFrozenLaw μ j) (priorFrozenReference ν₀ eig c I degree amplitude r h j) + (spectralPerturbationCoefficients U I (degree j) n (r j)) t (fun ω => D (U ω)) = + priorNamespacedReplicaAverage μ ν₀ eig c I degree (Function.update amplitude j t) r h D := by + intro U + let ν := priorFrozenReference ν₀ eig c I degree amplitude r h j + let A := spectralPerturbationCoefficients U I (degree j) n (r j) + have he := randomCoefficient_all_exp_ae (P := priorFrozenLaw μ j) + (measurable_priorFrozenReference ν₀ eig c I degree amplitude r h j) A + (measurable_spectralPerturbationFields U measurable_fst I (degree j) n (r j)) + (fun ω x => jointSpectralMonomialCoefficients_variance_le_one + (specialRotation (U ω)) I (degree j) n (r j) x) + let F := fun p : SpecialOrthogonal N × (ℕ → ℝ) => + referenceReplicaMean (priorNamespacedReference ν₀ eig c I degree (Function.update amplitude j t) + (fun i => tensorPathProfile I degree n r h i) p) (fun _ => 0) (D p.1) + have hF := measurable_priorNamespacedReplicaMean ν₀ eig c I degree (Function.update amplitude j t) r h D hD + unfold randomCoefficientAverage + calc + _ = ∫ p, F (priorFrozenInsertion j p) ∂(priorFrozenLaw μ j).prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [he,priorFrozenGaussian_reference_fold_ae μ ν₀ eig c I degree amplitude r h hh h0 j t] + with p hp hf + rw [referenceReplicaMean_eq_tilted _ _ (hp t)] + change (∫ σ, D (U p.1) σ ∂Measure.pi (fun _ : Fin q => + (ν p.1).tilted (fun x => t*cylinderField (A p.1 x) p.2))) = _ + change (ν p.1).tilted (fun x => t*cylinderField (A p.1 x) p.2) = _ at hf + rw [hf] + exact (referenceReplicaMean_zero _ _).symm + _ = _ := (priorFrozenInsertion_preserving μ j).hasLaw.integral_comp hF.aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorResidualIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorResidualIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5ce1290ab6fc3445d2c39c1285e69b100aea697 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorResidualIntegrability.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Fields.PriorResidualSpinMarginal + +namespace OAI + +/-! Residual exponential integrability for the actual finite spin prior. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +theorem prior_residual_spin_exp_integrable {A : Type*} [MeasurableSpace A] {N : ℕ} + (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin N)) [IsProbabilityMeasure π] + (Y : A → Fin N → ℝ) (hY : Measurable Y) (v : ℝ≥0) (c : ℝ) + (hI : Integrable (fun p : A × Spin N => Real.exp (fieldEnergy (Y p.1) p.2)) + (ν.prod π)) : + Integrable (fun p : (A × (Fin N → ℝ)) × Spin N => + Real.exp (fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2)) + ((ν.prod (vectorGaussianLaw N v)).prod π) := by + let F : (A × Spin N) × (Fin N → ℝ) → ℝ := fun p => + fieldEnergy (Y p.1.1 + p.2) p.1.2 + (N : ℝ) * c / 2 + have hE : Measurable (fun p : (Fin N → ℝ) × Spin N => fieldEnergy p.1 p.2) := by + apply measurable_from_prod_countable_left + intro σ + exact (measurable_pi_apply σ).comp (measurable_fieldEnergy_map N) + have hY' : Measurable (fun p : (A × Spin N) × (Fin N → ℝ) => Y p.1.1 + p.2) := + (hY.comp measurable_fst.fst).add measurable_snd + have hF : Measurable F := + (hE.comp (hY'.prodMk measurable_fst.snd)).add_const _ + have haug : Integrable (fun p => Real.exp (F p)) + ((ν.prod π).prod (vectorGaussianLaw N v)) := by + apply (integrable_prod_iff hF.exp.aestronglyMeasurable).mpr + constructor + · exact ae_of_all _ fun p => cavity_residual_spin_integrable v c (Y p.1) p.2 + · have h := hI.mul_const (Real.exp ((N : ℝ) * (c + v) / 2)) + convert h using 1 + funext p + simp only [F, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + rw [cavity_residual_spin_integral, Real.exp_add] + have hp := prior_spin_residual_reorder_law (N := N) ν π v + simpa only [Function.comp_def, F, cavitySpinResidualReorder] using + hp.hasLaw.integrable_comp haug + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorResidualSpinMarginal.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorResidualSpinMarginal.lean new file mode 100644 index 0000000000000000000000000000000000000000..6dfd2cc7adad19b0aa08b049df80a752be364525 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorResidualSpinMarginal.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityResidualSpinMarginal + +namespace OAI + +/-! The residual marginal identity for a deterministic finite spin prior, +including the normalized constrained prior. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma prior_spin_residual_reorder_law {A : Type*} [MeasurableSpace A] {N : ℕ} + (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin N)) [IsProbabilityMeasure π] (v : ℝ≥0) : + MeasurePreserving (cavitySpinResidualReorder (A := A) (N := N)) + ((ν.prod (vectorGaussianLaw N v)).prod π) + ((ν.prod π).prod (vectorGaussianLaw N v)) := by + let μ : Measure (Fin N → ℝ) := vectorGaussianLaw N v + have hs : MeasurePreserving (Prod.swap : (Fin N → ℝ) × Spin N → _) + (μ.prod π) (π.prod μ) := ⟨measurable_swap, Measure.prod_swap⟩ + have h1 := measurePreserving_prodAssoc ν μ π + have h2 := (MeasurePreserving.id ν).prod hs + have h3 := MeasurePreserving.symm MeasurableEquiv.prodAssoc (measurePreserving_prodAssoc ν π μ) + exact h3.comp (h2.comp h1) + +theorem prior_residual_leaf_spin_marginal {A : Type*} [MeasurableSpace A] {N : ℕ} + (ν : Measure A) [IsProbabilityMeasure ν] (π : Measure (Spin N)) [IsProbabilityMeasure π] + (Y : A → Fin N → ℝ) (hY : Measurable Y) (v : ℝ≥0) (c : ℝ) + (hI : Integrable (fun p : (A × (Fin N → ℝ)) × Spin N => + Real.exp (fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2)) + ((ν.prod (vectorGaussianLaw N v)).prod π)) : + (((ν.prod (vectorGaussianLaw N v)).prod π).tilted + (fun p => fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2)).map + (fun p => (p.1.1, p.2)) = + (ν.prod π).tilted (fun p => fieldEnergy (Y p.1) p.2) := by + let R := cavitySpinResidualReorder (A := A) (N := N) + let F : (A × Spin N) × (Fin N → ℝ) → ℝ := fun p => + fieldEnergy (Y p.1.1 + p.2) p.1.2 + (N : ℝ) * c / 2 + have hp := prior_spin_residual_reorder_law (N := N) ν π v + have hF : Measurable F := by unfold F fieldEnergy; fun_prop + have hIR : Integrable (fun p => Real.exp (F p)) + ((ν.prod π).prod (vectorGaussianLaw N v)) := by + rw [← hp.map_eq] + exact (integrable_map_measure hF.exp.aestronglyMeasurable hp.measurable.aemeasurable).mpr hI + have hR : Measurable R := hp.measurable + have he : (fun p : (A × (Fin N → ℝ)) × Spin N => + fieldEnergy (Y p.1.1 + p.1.2) p.2 + (N : ℝ) * c / 2) = F ∘ R := rfl + have hmap : (fun p : (A × (Fin N → ℝ)) × Spin N => (p.1.1, p.2)) = Prod.fst ∘ R := rfl + rw [he, hmap, ← Measure.map_map measurable_fst hR, + cavity_tilt_map _ R hR F hF, hp.map_eq] + rw [cavity_field_residual_marginal (ν.prod π) + (fun p => Y p.1) (hY.comp measurable_fst) Prod.snd measurable_snd v c hIR, + cavity_tilt_add_constant] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorSiteModulus.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorSiteModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..88e4ffbb7c2c021ad25446ac2b460c7e4860f20e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorSiteModulus.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorSiteMean +import OAI.Probability.InvariantIsing.Fields.PriorTensorMinimum + +namespace OAI + +/-! Continuity in the finite ordinary-field variances for an actual +fixed spin/leaf prior, uniformly in its spin constraints. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology NNReal +namespace InvariantIsing + +lemma prior_site_pressure_modulus + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m k n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (d : Fin k → Fin m → ℕ) + (amp : Fin k → ℝ) (mono : Fin (n+1) → Fin k → ℝ≥0) (a b : Fin (n+1) → ℝ≥0) : + |(N : ℝ)⁻¹*(∫ p, priorTensorLog ν eig c I d amp + (fun i => tensorVarianceProfile I d (a i) (mono i)) p ∂μ.prod gaussianCoordinates) - + (N : ℝ)⁻¹*(∫ p, priorTensorLog ν eig c I d amp + (fun i => tensorVarianceProfile I d (b i) (mono i)) p ∂μ.prod gaussianCoordinates)| ≤ + 2*∑ i, |(NNReal.sqrt (a i) : ℝ)-(NNReal.sqrt (b i) : ℝ)| * + ((NNReal.sqrt (a i) : ℝ)+(NNReal.sqrt (b i) : ℝ)) := by + let F := fun (a : Fin (n+1) → ℝ≥0) => priorTensorLog ν eig c I d amp + (fun i => tensorVarianceProfile I d (a i) (mono i)) + let M := ∑ i, |(NNReal.sqrt (a i) : ℝ)-(NNReal.sqrt (b i) : ℝ)| * + ((NNReal.sqrt (a i) : ℝ)+(NNReal.sqrt (b i) : ℝ)) + have hi x : Integrable (F x) (μ.prod gaussianCoordinates) := + priorTensorLog_integrable hhaar hgauss hN μ hμ ν eig c I d amp x mono + have hp (U : SpecialOrthogonal N) : + |(∫ z, F a (U,z) ∂gaussianCoordinates)-∫ z, F b (U,z) ∂gaussianCoordinates| ≤ 2*((N : ℝ)*M) := + tensorSiteLogMean_modulus (specialRotation U) I d amp a b mono ν + (fun x => rotatedEnergy eig (specialRotation U) x.1+fieldEnergy c x.1) + (finite_spin_base_exp_integrable ν (fun σ => rotatedEnergy eig (specialRotation U) σ+fieldEnergy c σ)) + change |(N : ℝ)⁻¹*(∫ p, F a p ∂_)-(N : ℝ)⁻¹*(∫ p, F b p ∂_)| ≤ _ + rw [← mul_sub, abs_mul, abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg N)), + integral_prod _ (hi a), integral_prod _ (hi b), + ← integral_sub (hi a).integral_prod_left (hi b).integral_prod_left] + have hv := norm_integral_le_of_norm_le_const (μ := μ) + (f := fun U => (∫ z, F a (U,z) ∂gaussianCoordinates)-∫ z, F b (U,z) ∂gaussianCoordinates) + (C := 2*((N : ℝ)*M)) + (ae_of_all _ fun U => by simpa only [Real.norm_eq_abs] using hp U) + simp only [probReal_univ, mul_one, Real.norm_eq_abs] at hv + refine (mul_le_mul_of_nonneg_left hv (inv_nonneg.mpr (Nat.cast_nonneg N))).trans_eq ?_ + have hnz : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + dsimp only [M] + field_simp + +lemma continuous_prior_site_pressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m k n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (d : Fin k → Fin m → ℕ) + (amp : Fin k → ℝ) (mono : Fin (n+1) → Fin k → ℝ≥0) : + Continuous (fun a : Fin (n+1) → ℝ≥0 => (N : ℝ)⁻¹*∫ p, priorTensorLog ν eig c I d amp + (fun i => tensorVarianceProfile I d (a i) (mono i)) p ∂μ.prod gaussianCoordinates) := by + apply continuous_iff_continuousAt.mpr + intro b + apply tendsto_iff_norm_sub_tendsto_zero.mpr + let M := fun a : Fin (n+1) → ℝ≥0 => 2*∑ i, + |(NNReal.sqrt (a i) : ℝ)-(NNReal.sqrt (b i) : ℝ)| * + ((NNReal.sqrt (a i) : ℝ)+(NNReal.sqrt (b i) : ℝ)) + have hM : Continuous M := by fun_prop + have hz : M b=0 := by simp [M] + apply squeeze_zero' (Eventually.of_forall fun _ => norm_nonneg _) + (Eventually.of_forall fun a => by + simpa only [Real.norm_eq_abs] using prior_site_pressure_modulus hhaar hgauss hN μ hμ ν eig c I d amp mono a b) + simpa only [hz] using hM.tendsto b + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorSpinLeafConditioning.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorSpinLeafConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..c91ce4963887a7d7ce0300d08ef9174b23d13e72 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorSpinLeafConditioning.lean @@ -0,0 +1,161 @@ +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorPairConditioning + +namespace OAI + +/-! Conditional independent spin sampling for a finite constrained prior. +The prior is retained in both its terminal and its conditional spin kernels. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators ENNReal NNReal + +namespace InvariantIsing + +def priorSpinLeafTerminal {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (H : Spin N × LabeledLeaf n → ℝ) (α : LabeledLeaf n) : ℝ := + finiteLogIntegral μ (fun σ => H (σ, α)) + +lemma exp_priorSpinLeafTerminal {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (H : Spin N × LabeledLeaf n → ℝ) (α : LabeledLeaf n) : + Real.exp (priorSpinLeafTerminal μ H α) = + referencePartition μ (fun σ => H (σ, α)) := by + exact Real.exp_log (integral_exp_pos (Integrable.of_finite)) + +lemma priorSpinLeafPartition_eq {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (H : Spin N × LabeledLeaf n → ℝ) + (he : Integrable (fun x => Real.exp (H x)) (μ.prod ν)) : + referencePartition (μ.prod ν) H = + referencePartition ν (priorSpinLeafTerminal μ H) := by + unfold referencePartition + rw [integral_prod_symm _ he] + apply integral_congr_ae + exact ae_of_all _ fun α => (exp_priorSpinLeafTerminal μ H α).symm + +lemma priorSpinLeafTerminal_exp_integrable {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (H : Spin N × LabeledLeaf n → ℝ) + (he : Integrable (fun x => Real.exp (H x)) (μ.prod ν)) : + Integrable (fun α => Real.exp (priorSpinLeafTerminal μ H α)) ν := by + convert he.integral_prod_right using 1 + ext α + exact exp_priorSpinLeafTerminal μ H α + +lemma priorSpinLeafGibbs_singleton {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (H : Spin N × LabeledLeaf n → ℝ) + (he : Integrable (fun x => Real.exp (H x)) (μ.prod ν)) + (σ : Spin N) (α : LabeledLeaf n) : + gibbsProbability (μ.prod ν) H {(σ, α)} = + gibbsProbability ν (priorSpinLeafTerminal μ H) {α} * + gibbsProbability μ (fun τ => H (τ, α)) {σ} := by + have hi := priorSpinLeafTerminal_exp_integrable μ ν H he + have hs : Integrable (fun τ : Spin N => Real.exp (H (τ, α))) + μ := Integrable.of_finite + have hZ : 0 < referencePartition ν (priorSpinLeafTerminal μ H) := integral_exp_pos hi + have hS : 0 < referencePartition μ (fun τ => H (τ, α)) := + integral_exp_pos hs + rw [gibbsProbability_eq_tilted _ _ he, gibbsProbability_eq_tilted _ _ hi, + gibbsProbability_eq_tilted _ _ hs, tilted_singleton, tilted_singleton, tilted_singleton, + ← Set.singleton_prod_singleton, Measure.prod_prod, + priorSpinLeafPartition_eq μ ν H he, exp_priorSpinLeafTerminal] + have hc : + ENNReal.ofReal (Real.exp (H (σ, α)) / referencePartition ν (priorSpinLeafTerminal μ H)) = + ENNReal.ofReal + (referencePartition μ (fun τ => H (τ, α)) / + referencePartition ν (priorSpinLeafTerminal μ H)) * + ENNReal.ofReal + (Real.exp (H (σ, α)) / + referencePartition μ (fun τ => H (τ, α))) := by + rw [← ENNReal.ofReal_mul (div_nonneg hS.le hZ.le)] + congr 1 + field_simp + rw [hc] + ac_rfl + +def priorSpinLeafPairResidualKernel {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (H : Spin N × LabeledLeaf n → ℝ) : + Kernel (Fin 2 → LabeledLeaf n) (Fin 2 → Spin N) := + ⟨fun α => Measure.pi (fun i : Fin 2 => + gibbsProbability μ (fun σ => H (σ, α i))), + measurable_of_countable _⟩ + +instance priorSpinLeafPairResidualKernel_markov {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (H : Spin N × LabeledLeaf n → ℝ) : + IsMarkovKernel (priorSpinLeafPairResidualKernel μ H) := + ⟨fun _ => inferInstanceAs (IsProbabilityMeasure (Measure.pi _))⟩ + +def priorSpinLeafPairJoin {N n : ℕ} + (p : (Fin 2 → LabeledLeaf n) × (Fin 2 → Spin N)) : Fin 2 → Spin N × LabeledLeaf n := + fun i => (p.2 i, p.1 i) + +lemma measurable_priorSpinLeafPairJoin {N n : ℕ} : + Measurable (priorSpinLeafPairJoin (N := N) (n := n)) := by + unfold priorSpinLeafPairJoin + fun_prop + +/-- Conditional on the two leaf labels, the spin residual draws are +independent, including when the leaf labels coincide. -/ +theorem priorSpinLeafPairLaw {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (H : Spin N × LabeledLeaf n → ℝ) + (he : Integrable (fun x => Real.exp (H x)) (μ.prod ν)) : + ((Measure.pi (fun _ : Fin 2 => gibbsProbability ν (priorSpinLeafTerminal μ H))) ⊗ₘ + priorSpinLeafPairResidualKernel μ H).map priorSpinLeafPairJoin = + Measure.pi (fun _ : Fin 2 => gibbsProbability (μ.prod ν) H) := by + apply Measure.ext_of_singleton + intro x + rw [Measure.map_apply measurable_priorSpinLeafPairJoin (measurableSet_singleton _)] + have hp : priorSpinLeafPairJoin ⁻¹' {x} = + {(fun i => (x i).2, fun i => (x i).1)} := by + ext p + simp only [Set.mem_preimage, Set.mem_singleton_iff] + constructor + · intro h + apply Prod.ext + · funext i + exact congrArg Prod.snd (congrFun h i) + · funext i + exact congrArg Prod.fst (congrFun h i) + · intro h + subst p + rfl + rw [hp, ← Set.singleton_prod_singleton, Measure.compProd_apply_prod + (measurableSet_singleton _) (measurableSet_singleton _), lintegral_singleton] + change (Measure.pi (fun i : Fin 2 => + gibbsProbability μ (fun σ => H (σ, (x i).2)))) + {fun i => (x i).1} * + (Measure.pi (fun _ : Fin 2 => gibbsProbability ν (priorSpinLeafTerminal μ H))) + {fun i => (x i).2} = _ + simp only [Measure.pi_singleton] + rw [← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + rw [mul_comm] + exact (priorSpinLeafGibbs_singleton μ ν H he (x i).1 (x i).2).symm + +theorem priorSpinLeafPair_conditioning {N n : ℕ} (μ : Measure (Spin N)) [IsProbabilityMeasure μ] (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (H : Spin N × LabeledLeaf n → ℝ) + (he : Integrable (fun x => Real.exp (H x)) (μ.prod ν)) + (D : (Fin 2 → Spin N × LabeledLeaf n) → ℝ) + (hD : ∃ C : ℝ, ∀ x, |D x| ≤ C) : + referenceReplicaMean (μ.prod ν) H D = + referenceReplicaMean ν (priorSpinLeafTerminal μ H) + (fun α => ∫ σ, D (priorSpinLeafPairJoin (α, σ)) ∂priorSpinLeafPairResidualKernel μ H α) := by + have hmD : Measurable D := measurable_of_countable _ + have hiD : Integrable D + (Measure.pi (fun _ : Fin 2 => + gibbsProbability (μ.prod ν) H)) := by + obtain ⟨C, hC⟩ := hD + exact integrable_of_measurable_abs_le hmD hC + have hp : MeasurePreserving priorSpinLeafPairJoin + ((Measure.pi (fun _ : Fin 2 => gibbsProbability ν (priorSpinLeafTerminal μ H))) ⊗ₘ + priorSpinLeafPairResidualKernel μ H) + (Measure.pi (fun _ : Fin 2 => + gibbsProbability (μ.prod ν) H)) := + ⟨measurable_priorSpinLeafPairJoin, priorSpinLeafPairLaw μ ν H he⟩ + have hcomp := hp.hasLaw.integrable_comp hiD + rw [referenceReplicaMean_eq_tilted _ _ he, ← gibbsProbability_eq_tilted _ _ he, + referenceReplicaMean_eq_tilted _ _ (priorSpinLeafTerminal_exp_integrable μ ν H he), + ← gibbsProbability_eq_tilted _ _ (priorSpinLeafTerminal_exp_integrable μ ν H he)] + rw [← hp.hasLaw.integral_comp hmD.aestronglyMeasurable] + exact integral_compProd hcomp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureCGF.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureCGF.lean new file mode 100644 index 0000000000000000000000000000000000000000..ceb25bac219797c7398f9167b228be65dfa2ef87 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureCGF.lean @@ -0,0 +1,134 @@ +import OAI.Probability.InvariantIsing.Fields.PriorReplicaAverage +import OAI.Probability.InvariantIsing.Fields.PriorTensorMinimum +import OAI.Probability.InvariantIsing.Pressure.RandomBoundedDerivative + +namespace OAI + +/-! Temperature is a bounded tilt of the actual constrained-prior Gibbs +measure. The spectral and Gaussian perturbations stay fixed under the tilt. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology NNReal +namespace InvariantIsing + +lemma priorTemperatureHamiltonian_affine {N m k n : ℕ} (hN : 0 < N) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (q : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (p : SpecialOrthogonal N × (ℕ → ℝ)) (t : ℝ) : + priorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v t) c I degree amp q p = + fun x => priorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp q p x + t*rotatedEnergy eig (specialRotation p.1) x.1 := by + funext x + unfold priorNamespacedHamiltonian + rw [rotatedEnergy_diagonalPerturbation hN, rotatedEnergy_diagonalPerturbation hN] + ring + +lemma measurable_priorTemperatureObservable {N n : ℕ} (eig : Fin N → ℝ) : + Measurable (fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation p.1.1) p.2.1) := by + apply measurable_from_prod_countable_left + intro x + unfold rotatedEnergy + exact (Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).comp measurable_fst).pow_const 2 + |>.const_mul (eig i)).const_mul _ + +lemma priorTemperature_reference_fold {N m k n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) (t : ℝ) : + ∀ᵐ p ∂μ.prod gaussianCoordinates, + (priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I v 0) c I degree amp + (fun i => tensorPathProfile I degree n r h i) p).tilted + (fun x => t*rotatedEnergy eig (specialRotation p.1) x.1) = + priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I v t) c I degree amp + (fun i => tensorPathProfile I degree n r h i) p := by + filter_upwards [priorNamespaced_exp_integrable_ae μ ν (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp r h hh h0, priorNamespaced_exp_integrable_ae μ ν + (diagonalPerturbedEigenvalues eig I v t) c I degree amp r h hh h0] with p hp ht + let H : Spin N × LabeledLeaf n → ℝ := priorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp (fun i => tensorPathProfile I degree n r h i) p + let G := fun x : Spin N × LabeledLeaf n => t*rotatedEnergy eig (specialRotation p.1) x.1 + have he := priorTemperatureHamiltonian_affine (n := n) hN eig c I v degree amp + (fun i => tensorPathProfile I degree n r h i) p t + have hH : Integrable (fun x => Real.exp (H x)) ν := hp + have hi : Integrable (fun x => Real.exp (H x+G x)) ν := by + rw [he] at ht + exact ht + change (gibbsProbability ν H).tilted G = gibbsProbability ν _ + rw [he, gibbsProbability_eq_tilted ν H hH, + gibbsProbability_eq_tilted ν (fun x => H x+G x) hi, tilted_tilted hH G] + rfl + +lemma priorTemperatureCGF_eq_log_difference {N m k n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) (t : ℝ) : + ∀ᵐ p ∂μ.prod gaussianCoordinates, + cgf (fun x : Spin N × LabeledLeaf n => rotatedEnergy eig (specialRotation p.1) x.1) + (priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I v 0) c I degree amp + (fun i => tensorPathProfile I degree n r h i) p) t = + priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v t) c I degree amp + (fun i => tensorPathProfile I degree n r h i) p - + priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v 0) c I degree amp + (fun i => tensorPathProfile I degree n r h i) p := by + filter_upwards [priorNamespaced_exp_integrable_ae μ ν (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp r h hh h0, priorNamespaced_exp_integrable_ae μ ν + (diagonalPerturbedEigenvalues eig I v t) c I degree amp r h hh h0] with p hp ht + let H : Spin N × LabeledLeaf n → ℝ := priorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp (fun i => tensorPathProfile I degree n r h i) p + let Y := fun x : Spin N × LabeledLeaf n => rotatedEnergy eig (specialRotation p.1) x.1 + have he := priorTemperatureHamiltonian_affine (n := n) hN eig c I v degree amp + (fun i => tensorPathProfile I degree n r h i) p t + have hi : Integrable (fun x => Real.exp (H x+t*Y x)) ν := by + rw [he] at ht + exact ht + change cgf Y (gibbsProbability ν H) t = _ + rw [cgf_fold ν H Y t hp hi] + rw [show (fun x => H x+t*Y x) = priorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I v t) c I degree amp + (fun i => tensorPathProfile I degree n r h i) p from he.symm] + rfl + +lemma priorNamespacedLog_integrable (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m k n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (site : Fin (n+1) → ℝ≥0) (monomial : Fin (n+1) → Fin k → ℝ≥0) : + Integrable (priorNamespacedLog ν eig c I degree amp + (fun i => tensorVarianceProfile I degree (site i) (monomial i))) + (μ.prod gaussianCoordinates) := by + obtain ⟨C,hC,hv⟩ := priorTensorLog_variance hhaar hgauss + have hK : 0 < 1+∑ i, |eig i| := by positivity + have he : ∀ i, |eig i| ≤ 1+∑ i, |eig i| := fun i => by + have hi := Finset.single_le_sum (f := fun j => |eig j|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ i) + linarith + exact (priorNamespacedLog_moments μ ν eig c I degree amp _ + (hv N hN μ inferInstance hμ m k n ν inferInstance eig c _ hK he I degree amp site monomial).1).1.integrable + (by norm_num) + +lemma priorNamespacedLog_integral {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (q : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + (∫ p, priorNamespacedLog ν eig c I degree amp q p ∂μ.prod gaussianCoordinates) = + ∫ p, priorTensorLog ν eig c I degree amp q p ∂μ.prod gaussianCoordinates := + (priorNamespacedLog_law μ ν eig c I degree amp q).integral_eq.trans + (integral_map (measurable_priorTensorLog ν eig c I degree amp q).aemeasurable + aestronglyMeasurable_id) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..33f28fda6852082ac51d89b244cfcb5e37ce6d23 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureDerivative.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTemperatureCGF +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure + +namespace OAI + +/-! Differentiation of the actual fixed-prior mean pressure. The derivative +is the original interaction energy, with both perturbations held fixed. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +theorem hasDerivAt_priorPerturbationPressureMean_temperature + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (t : ℝ) : + HasDerivAt (fun s => priorPerturbationPressureMean μ ν eig c I s h u v) + (priorNamespacedObservableAverage μ ν (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun j : Fin N => enumeratedTreeDegree m j) h + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1)) t := by + let d := fun j : Fin N => enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let q := fun i : Fin (n+1) => tensorPathProfile I d n r h i + let P := μ.prod gaussianCoordinates + let G := priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I v 0) + c I d (tensorPerturbationAmplitude N u) q + let Y := fun (p : SpecialOrthogonal N × (ℕ → ℝ)) (x : Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation p.1) x.1 + have hY : Measurable (Function.uncurry Y) := measurable_priorTemperatureObservable eig + have hB p x : |Y p x| ≤ K*N/2 := abs_rotatedEnergy_le eig (specialRotation p.1) K hK x.1 + have hd := hasDerivAt_bounded_random_cgf P G + (measurable_priorNamespacedReference ν _ c I d _ q) Y hY (K*N/2) hB t + let M := fun s => priorPerturbationPressureMean μ ν eig c I s h u v + have hi s : Integrable (priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I v s) + c I d (tensorPerturbationAmplitude N u) q) P := + priorNamespacedLog_integrable hhaar hgauss hN μ hμ ν _ c I d _ + (fun i => varianceIncrement h i) (fun i j => varianceIncrement (monomialPath n (r j)) i) + have he s : M s = M 0+(∫ p, cgf (Y p) (G p) s ∂P)/N := by + rw [integral_congr_ae (priorTemperatureCGF_eq_log_difference (by omega) μ ν eig c I v + d (tensorPerturbationAmplitude N u) r h hh h0 s), integral_sub (hi s) (hi 0)] + dsimp only [P] + rw [priorNamespacedLog_integral, priorNamespacedLog_integral] + dsimp only [M, priorPerturbationPressureMean, q, d, r] + ring + have hfold : (∫ p, ∫ x, Y p x ∂(G p).tilted (fun x => t*Y p x) ∂P) = + ∫ p, ∫ x, Y p x ∂priorNamespacedReference ν + (diagonalPerturbedEigenvalues eig I v t) c I d (tensorPerturbationAmplitude N u) q p ∂P := by + apply integral_congr_ae + filter_upwards [priorTemperature_reference_fold (by omega) μ ν eig c I v + d (tensorPerturbationAmplitude N u) r h hh h0 t] with p hp + rw [hp] + have hf : M = fun s => M 0+(∫ p, cgf (Y p) (G p) s ∂P)/N := funext he + have hD := (hd.div_const (N : ℝ)).const_add (M 0) + rw [hfold, ← hf] at hD + simpa only [M, Y, P, d, r, q, priorNamespacedObservableAverage, integral_const_mul, + integral_mul_const, div_eq_mul_inv, mul_comm] using hD + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureModulus.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..e51f37fa5ec1d1e605cb818b93018682a0918d5a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTemperatureModulus.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorMinimum +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure + +namespace OAI + +/-! Temperature continuity for the actual fixed-prior pressure. The +spectral perturbation is held fixed while the original interaction scales. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem priorPerturbationPressureMean_temperature_modulus + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (u : Fin N → ℝ) (v : Fin m → ℝ) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (s t : ℝ) : + |priorPerturbationPressureMean μ ν eig c I s h u v- + priorPerturbationPressureMean μ ν eig c I t h u v| ≤ (K/2)*|s-t| := by + let d := fun j : Fin N => enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let q := fun i : Fin (n+1) => tensorPathProfile I d n r h i + let F := fun t => priorTensorLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) q + have hi a : Integrable (F a) (μ.prod gaussianCoordinates) := + priorTensorLog_integrable hhaar hgauss hN μ hμ ν _ c I d _ + (fun i => varianceIncrement h i) (fun i j => varianceIncrement (monomialPath n (r j)) i) + have hb (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : |(rotatedEnergy (diagonalPerturbedEigenvalues eig I v s) (specialRotation U) x.1+ + fieldEnergy c x.1)- + (rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) (specialRotation U) x.1+ + fieldEnergy c x.1)| ≤ |s-t| *(K*N/2) := by + rw [add_sub_add_right_eq_sub, rotatedEnergy_diagonalPerturbation (by omega), + rotatedEnergy_diagonalPerturbation (by omega)] + rw [show s*rotatedEnergy eig (specialRotation U) x.1+ + (N : ℝ)*perturbationScale N*∑ a, v a*projectedOverlap (specialRotation U) (I a) x.1 x.1- + (t*rotatedEnergy eig (specialRotation U) x.1+ + (N : ℝ)*perturbationScale N*∑ a, v a*projectedOverlap (specialRotation U) (I a) x.1 x.1) = + (s-t)*rotatedEnergy eig (specialRotation U) x.1 by ring] + rw [abs_mul] + exact mul_le_mul_of_nonneg_left (abs_rotatedEnergy_le eig (specialRotation U) K hK x.1) (abs_nonneg _) + have hp U : |(∫ z, F s (U,z) ∂gaussianCoordinates)- + ∫ z, F t (U,z) ∂gaussianCoordinates| ≤ |s-t| *(K*N/2) := + countable_cylinder_log_mean_base_compare ν + (fun x => rotatedEnergy (diagonalPerturbedEigenvalues eig I v s) (specialRotation U) x.1+ + fieldEnergy c x.1) + (fun x => rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) (specialRotation U) x.1+ + fieldEnergy c x.1) + (finite_spin_base_exp_integrable ν (fun σ => rotatedEnergy (diagonalPerturbedEigenvalues eig I v s) + (specialRotation U) σ+fieldEnergy c σ)) + (finite_spin_base_exp_integrable ν (fun σ => rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) + (specialRotation U) σ+fieldEnergy c σ)) + (tensorLeafCoefficients (specialRotation U) I d (tensorPerturbationAmplitude N u) n q) + (tensorPathProfile_variance_cap (specialRotation U) I d (tensorPerturbationAmplitude N u) + n r h hh h0) (hb U) + unfold priorPerturbationPressureMean + change |(N : ℝ)⁻¹*(∫ p, F s p ∂μ.prod gaussianCoordinates)- + (N : ℝ)⁻¹*(∫ p, F t p ∂μ.prod gaussianCoordinates)| ≤ _ + rw [← mul_sub, abs_mul, abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg N)), + integral_prod _ (hi s), integral_prod _ (hi t), + ← integral_sub (hi s).integral_prod_left (hi t).integral_prod_left] + have ha := norm_integral_le_of_norm_le_const (μ := μ) + (f := fun U => (∫ z, F s (U,z) ∂gaussianCoordinates)-∫ z, F t (U,z) ∂gaussianCoordinates) + (ae_of_all _ fun U => by simpa only [Real.norm_eq_abs] using hp U) + simp only [probReal_univ, mul_one, Real.norm_eq_abs] at ha + refine (mul_le_mul_of_nonneg_left ha (inv_nonneg.mpr (Nat.cast_nonneg N))).trans_eq ?_ + have hnz : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad116511eef8c6434cb496fda89441ebdeb8fc57 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorMinimum.lean @@ -0,0 +1,171 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorPressure +import OAI.Probability.InvariantIsing.Arrays.TensorObjectiveContinuity + +namespace OAI + +/-! Compact perturbation minima for a fixed constrained spin/leaf prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators Topology NNReal +namespace InvariantIsing + +def priorPerturbationPressureMean {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) : ℝ := + (N : ℝ)⁻¹ * ∫ p, priorTensorLog ν (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) n + (fun j => enumeratedTreeDegree m j) h i) p ∂μ.prod gaussianCoordinates + +def priorPerturbationObjective {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) : ℝ := + -priorPerturbationPressureMean μ ν eig c I t h u v + + ∑ j : Fin N, perturbationWeight j*(u j-3/2)^2 + ∑ a, (v a-3/2)^2 + +lemma priorTensorLog_integrable (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m k n : ℕ} (hN : 3≤N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (site : Fin (n+1) → ℝ≥0) (monomial : Fin (n+1) → Fin k → ℝ≥0) : + Integrable (priorTensorLog ν eig c I degree amplitude + (fun i => tensorVarianceProfile I degree (site i) (monomial i))) + (μ.prod gaussianCoordinates) := by + obtain ⟨C,hC,hv⟩ := priorTensorLog_variance hhaar hgauss + have hs : 0≤∑ i, |eig i| := Finset.sum_nonneg fun _ _ => abs_nonneg _ + have hK : 0<1+∑ i, |eig i| := by linarith + have he : ∀ i, |eig i|≤1+∑ i, |eig i| := fun i => by + have hi := Finset.single_le_sum (f := fun j => |eig j|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ i) + linarith + exact (hv N hN μ inferInstance hμ m k n ν inferInstance eig c _ hK he I degree + amplitude site monomial).1.integrable (by norm_num) + +lemma priorPerturbationPressureMean_modulus (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3≤N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0≤h 0) + (u u' : Fin N → ℝ) (v v' : Fin m → ℝ) : + |priorPerturbationPressureMean μ ν eig c I t h u v- + priorPerturbationPressureMean μ ν eig c I t h u' v'| ≤ + 2*(N : ℝ)⁻¹*tensorAmplitudeModulus + (tensorPerturbationAmplitude N u) (tensorPerturbationAmplitude N u') + + perturbationScale N*∑ a, |v a-v' a| := by + let d := fun j : Fin N => enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let q := fun i : Fin (n+1) => tensorPathProfile I d n r h i + let F := fun u v => priorTensorLog ν (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) q + have hi u v : Integrable (F u v) (μ.prod gaussianCoordinates) := + priorTensorLog_integrable hhaar hgauss hN μ hμ ν _ c I d _ + (fun i => varianceIncrement h i) (fun i j => varianceIncrement (monomialPath n (r j)) i) + have hpoint U : |(∫ z, F u v (U,z) ∂gaussianCoordinates)- + ∫ z, F u' v' (U,z) ∂gaussianCoordinates| ≤ + 2*tensorAmplitudeModulus (tensorPerturbationAmplitude N u) (tensorPerturbationAmplitude N u')+ + N*perturbationScale N*∑ a, |v a-v' a| := by + have ha := tensorPathLogMean_amplitude_comparison (specialRotation U) I d + (tensorPerturbationAmplitude N u) (tensorPerturbationAmplitude N u') n r h hh h0 ν + (fun x => rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) (specialRotation U) x.1+ + fieldEnergy c x.1) (finite_spin_base_exp_integrable ν (fun σ => rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) (specialRotation U) σ + fieldEnergy c σ)) + have hb := countable_cylinder_log_mean_base_compare ν + (fun x => rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) (specialRotation U) x.1+ + fieldEnergy c x.1) + (fun x => rotatedEnergy (diagonalPerturbedEigenvalues eig I v' t) (specialRotation U) x.1+ + fieldEnergy c x.1) + (finite_spin_base_exp_integrable ν (fun σ => rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) (specialRotation U) σ + fieldEnergy c σ)) (finite_spin_base_exp_integrable ν (fun σ => rotatedEnergy (diagonalPerturbedEigenvalues eig I v' t) (specialRotation U) σ + fieldEnergy c σ)) + (tensorLeafCoefficients (specialRotation U) I d (tensorPerturbationAmplitude N u') n q) + (tensorPathProfile_variance_cap (specialRotation U) I d (tensorPerturbationAmplitude N u') + n r h hh h0) + (fun x => by simpa only [add_sub_add_right_eq_sub] using + rotatedEnergy_diagonal_difference_le (by omega) eig (specialRotation U) I v v' t x.1) + exact (abs_sub_le _ _ _).trans (add_le_add ha hb) + unfold priorPerturbationPressureMean + change |(N : ℝ)⁻¹*(∫ p, F u v p ∂μ.prod gaussianCoordinates)- + (N : ℝ)⁻¹*(∫ p, F u' v' p ∂μ.prod gaussianCoordinates)| ≤ _ + rw [← mul_sub, abs_mul, abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg N)), + integral_prod _ (hi u v), integral_prod _ (hi u' v'), + ← integral_sub (hi u v).integral_prod_left (hi u' v').integral_prod_left] + have hb := norm_integral_le_of_norm_le_const (μ := μ) + (f := fun U => (∫ z, F u v (U,z) ∂gaussianCoordinates)- + ∫ z, F u' v' (U,z) ∂gaussianCoordinates) + (C := 2*tensorAmplitudeModulus (tensorPerturbationAmplitude N u) (tensorPerturbationAmplitude N u')+ + N*perturbationScale N*∑ a, |v a-v' a|) + (ae_of_all _ fun U => by simpa only [Real.norm_eq_abs] using hpoint U) + simp only [probReal_univ,mul_one,Real.norm_eq_abs] at hb + have hb' := mul_le_mul_of_nonneg_left hb (show 0≤(N : ℝ)⁻¹ by positivity) + refine hb'.trans_eq ?_ + have hn : (N : ℝ)≠0 := Nat.cast_ne_zero.mpr (by omega) + field_simp + +lemma continuous_priorPerturbationObjective (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3≤N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0≤h 0) : + Continuous (fun p : (Fin N → ℝ) × (Fin m → ℝ) => + priorPerturbationObjective μ ν eig c I t h p.1 p.2) := by + have hM : Continuous (fun p : (Fin N → ℝ) × (Fin m → ℝ) => + priorPerturbationPressureMean μ ν eig c I t h p.1 p.2) := by + apply continuous_iff_continuousAt.mpr + intro p + apply tendsto_iff_norm_sub_tendsto_zero.mpr + let M := fun z : (Fin N → ℝ) × (Fin m → ℝ) => + 2*(N : ℝ)⁻¹*tensorAmplitudeModulus (tensorPerturbationAmplitude N z.1) + (tensorPerturbationAmplitude N p.1)+perturbationScale N*∑ a, |z.2 a-p.2 a| + have hc : Continuous M := by + unfold M tensorAmplitudeModulus tensorPerturbationAmplitude + fun_prop + have hz : M p=0 := by simp [M,tensorAmplitudeModulus] + have ht : Filter.Tendsto M (𝓝 p) (𝓝 0) := by simpa only [hz] using hc.tendsto p + exact squeeze_zero' (Filter.Eventually.of_forall fun _ => norm_nonneg _) + (Filter.Eventually.of_forall fun z => by + simpa only [Real.norm_eq_abs,M] using priorPerturbationPressureMean_modulus + hhaar hgauss hN μ hμ ν eig c I t h hh h0 z.1 p.1 z.2 p.2) ht + unfold priorPerturbationObjective + exact (hM.neg.add (by fun_prop)).add (by fun_prop) + +private lemma priorFiniteBox_minimum {N m : ℕ} + (F : (Fin N → ℝ) × (Fin m → ℝ) → ℝ) (hF : Continuous F) : + ∃ u : Fin N → ℝ, ∃ v : Fin m → ℝ, + (∀ j, u j∈Icc (1 : ℝ) 2) ∧ (∀ a, v a∈Icc (1 : ℝ) 2) ∧ + ∀ u' v', (∀ j, u' j∈Icc (1 : ℝ) 2) → (∀ a, v' a∈Icc (1 : ℝ) 2) → + F (u,v) ≤ F (u',v') := by + let B := (Fin N → Icc (1 : ℝ) 2) × (Fin m → Icc (1 : ℝ) 2) + let g : B → (Fin N → ℝ) × (Fin m → ℝ) := fun p => (fun j => p.1 j,fun a => p.2 a) + have hg : Continuous g := by + exact (continuous_pi fun j => continuous_subtype_val.comp + ((continuous_apply j).comp continuous_fst)).prodMk + (continuous_pi fun a => continuous_subtype_val.comp ((continuous_apply a).comp continuous_snd)) + let p₀ : B := (fun _ => ⟨1,by norm_num⟩,fun _ => ⟨1,by norm_num⟩) + obtain ⟨p,_,hp⟩ := (isCompact_univ : IsCompact (univ : Set B)).exists_isMinOn + ⟨p₀,mem_univ _⟩ (hF.comp hg).continuousOn + exact ⟨fun j => p.1 j,fun a => p.2 a,fun j => (p.1 j).property,fun a => (p.2 a).property, + fun u' v' hu' hv' => hp (mem_univ ((fun j => ⟨u' j,hu' j⟩,fun a => ⟨v' a,hv' a⟩) : B))⟩ + + +theorem priorPerturbationObjective_exists_minimum (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3≤N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) + (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0≤h 0) : + ∃ u : Fin N → ℝ, ∃ v : Fin m → ℝ, + (∀ j, u j∈Icc (1 : ℝ) 2) ∧ (∀ a, v a∈Icc (1 : ℝ) 2) ∧ + ∀ u' v', (∀ j, u' j∈Icc (1 : ℝ) 2) → (∀ a, v' a∈Icc (1 : ℝ) 2) → + priorPerturbationObjective μ ν eig c I t h u v ≤ + priorPerturbationObjective μ ν eig c I t h u' v' := by + exact priorFiniteBox_minimum _ + (continuous_priorPerturbationObjective hhaar hgauss hN μ hμ ν eig c I t h hh h0) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorNamespace.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorNamespace.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc3a5cf375ba93412ccbd806a5e2da609db80195 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorNamespace.lean @@ -0,0 +1,119 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorPressure +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorFrozenCGF + +namespace OAI + +/-! Independent Gaussian namespaces for the actual fixed-prior model. +Changing Gaussian coordinates preserves its entire pressure law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def priorNamespacedHamiltonian {N m k n : ℕ} (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (p : SpecialOrthogonal N × (ℕ → ℝ)) (x : Spin N × LabeledLeaf n) : ℝ := + rotatedEnergy eig (specialRotation p.1) x.1 + fieldEnergy c x.1 + + cylinderField (tensorNamespacedCoefficients (specialRotation p.1) I degree amplitude n v x) p.2 + +lemma measurable_priorNamespacedHamiltonian {N m k n : ℕ} (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (Function.uncurry (priorNamespacedHamiltonian eig c I degree amplitude v)) := by + apply measurable_from_prod_countable_left + intro x + have hb : Measurable (fun U : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1) := by + exact ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).pow_const 2).const_mul (eig i)).const_mul + (1/2 : ℝ)).add_const _ + exact (hb.comp measurable_fst).add (measurable_tensorNamespacedFields_joint I degree amplitude n v x) + +def priorNamespacedLog {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (p : SpecialOrthogonal N × (ℕ → ℝ)) : ℝ := + Real.log (∫ x, Real.exp (priorNamespacedHamiltonian eig c I degree amplitude v p x) ∂ν) + +lemma measurable_priorNamespacedLog {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (priorNamespacedLog ν eig c I degree amplitude v) := + (measurable_priorNamespacedHamiltonian eig c I degree amplitude v).exp.stronglyMeasurable + |>.integral_prod_right' |>.measurable.log + +lemma priorNamespacedLog_conditional_law {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (U : SpecialOrthogonal N) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + gaussianCoordinates.map (fun z => priorTensorLog ν eig c I degree amplitude v (U,z)) = + gaussianCoordinates.map (fun z => priorNamespacedLog ν eig c I degree amplitude v (U,z)) := by + let H := fun x : Spin N × LabeledLeaf n => rotatedEnergy eig (specialRotation U) x.1+fieldEnergy c x.1 + let K := fun F : Spin N × LabeledLeaf n → ℝ => Real.log (∫ x, Real.exp (H x+F x) ∂ν) + have hK : Measurable K := by + have he : Measurable (fun p : (Spin N × LabeledLeaf n → ℝ) × + (Spin N × LabeledLeaf n) => H p.2+p.1 p.2) := + measurable_from_prod_countable_left fun x => by + change Measurable (fun F : Spin N × LabeledLeaf n → ℝ => H x+F x) + exact measurable_const.add (measurable_pi_apply x) + exact he.exp.stronglyMeasurable.integral_prod_right'.measurable.log + have hl : Measurable (fun z x => cylinderField + (tensorLeafCoefficients (specialRotation U) I degree amplitude n v x) z) := + Measurable.of_eval fun _ => measurable_cylinderField _ + have hr : Measurable (fun z x => cylinderField + (tensorNamespacedCoefficients (specialRotation U) I degree amplitude n v x) z) := + Measurable.of_eval fun _ => measurable_cylinderField _ + change gaussianCoordinates.map (K ∘ (fun z x => cylinderField + (tensorLeafCoefficients (specialRotation U) I degree amplitude n v x) z)) = + gaussianCoordinates.map (K ∘ (fun z x => cylinderField + (tensorNamespacedCoefficients (specialRotation U) I degree amplitude n v x) z)) + rw [← Measure.map_map hK hl,← Measure.map_map hK hr,tensorNamespacedFields_law] + +theorem priorNamespacedLog_law {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + HasLaw (priorNamespacedLog ν eig c I degree amplitude v) + ((μ.prod gaussianCoordinates).map (priorTensorLog ν eig c I degree amplitude v)) + (μ.prod gaussianCoordinates) := by + have hl := measurable_priorTensorLog ν eig c I degree amplitude v + have hr := measurable_priorNamespacedLog ν eig c I degree amplitude v + refine ⟨hr.aemeasurable,?_⟩ + apply Measure.ext + intro s hs + rw [Measure.map_apply hr hs,Measure.map_apply hl hs,Measure.prod_apply (hr hs),Measure.prod_apply (hl hs)] + apply lintegral_congr_ae + apply ae_of_all + intro U + have he := congrArg (fun Q : Measure ℝ => Q s) + (priorNamespacedLog_conditional_law ν eig c U I degree amplitude v) + have hlU : Measurable (fun z : ℕ → ℝ => priorTensorLog ν eig c I degree amplitude v (U,z)) := + hl.comp (measurable_const.prodMk measurable_id) + have hrU : Measurable (fun z : ℕ → ℝ => priorNamespacedLog ν eig c I degree amplitude v (U,z)) := + hr.comp (measurable_const.prodMk measurable_id) + rw [Measure.map_apply hlU hs,Measure.map_apply hrU hs] at he + exact he.symm + +theorem priorNamespacedLog_moments {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (hF : MemLp (priorTensorLog ν eig c I degree amplitude v) 2 (μ.prod gaussianCoordinates)) : + MemLp (priorNamespacedLog ν eig c I degree amplitude v) 2 (μ.prod gaussianCoordinates) ∧ + variance (priorNamespacedLog ν eig c I degree amplitude v) (μ.prod gaussianCoordinates) = + variance (priorTensorLog ν eig c I degree amplitude v) (μ.prod gaussianCoordinates) ∧ + (∫ p, priorNamespacedLog ν eig c I degree amplitude v p ∂μ.prod gaussianCoordinates) = + ∫ p, priorTensorLog ν eig c I degree amplitude v p ∂μ.prod gaussianCoordinates := by + have hlaw := priorNamespacedLog_law μ ν eig c I degree amplitude v + have hid : MemLp id 2 ((μ.prod gaussianCoordinates).map (priorTensorLog ν eig c I degree amplitude v)) := + (memLp_map_measure_iff aestronglyMeasurable_id hF.aemeasurable).mpr hF + exact ⟨hlaw.memLp hid,hlaw.variance_eq.trans (variance_id_map hF.aemeasurable), + hlaw.integral_eq.trans (integral_map hF.aemeasurable aestronglyMeasurable_id)⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorPressure.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b8fc814f80b56367750e251aad344217d6f1afe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorPressure.lean @@ -0,0 +1,129 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorGaussianMean +import OAI.Probability.InvariantIsing.Haar.HaarVariance + +namespace OAI + +/-! The actual finite tensor perturbation with a fixed spin/leaf prior. +The prior may be a normalized spin constraint; it is independent of the rotation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def priorTensorLog {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (p : SpecialOrthogonal N × (ℕ → ℝ)) : ℝ := + Real.log (∫ x, Real.exp (rotatedEnergy eig (specialRotation p.1) x.1 + fieldEnergy c x.1 + + cylinderField (tensorLeafCoefficients (specialRotation p.1) I degree amplitude n v x) p.2) ∂ν) + +lemma measurable_priorTensorLog {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (priorTensorLog ν eig c I degree amplitude v) := by + have hm : Measurable (fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × + (Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation p.1.1) p.2.1 + fieldEnergy c p.2.1 + + cylinderField (tensorLeafCoefficients (specialRotation p.1.1) I degree amplitude n v p.2) p.1.2) := by + apply measurable_from_prod_countable_left + intro x + have hbase : Measurable (fun U : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1) := by + exact ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).pow_const 2).const_mul + (eig i)).const_mul (1/2 : ℝ)).add_const _ + apply (hbase.comp measurable_fst).add + simp only [tensorLeafCoefficients, cylinderField_feature] + apply Finset.measurable_sum + intro i _ + exact (((measurable_spinTensorFeature I degree amplitude x.1 i.2).comp + measurable_fst).const_mul _).mul + ((measurable_pi_apply (treeFeatureTag n x.2 i)).comp measurable_snd) + exact hm.exp.stronglyMeasurable.integral_prod_right'.measurable.log + +lemma priorTensorLog_gaussian_memLp {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (site : Fin (n+1) → ℝ≥0) (monomial : Fin (n+1) → Fin k → ℝ≥0) + (U : SpecialOrthogonal N) : + MemLp (fun z => priorTensorLog ν eig c I degree amplitude + (fun i => tensorVarianceProfile I degree (site i) (monomial i)) (U,z)) 2 gaussianCoordinates := by + have hi := cylinder_log_partition_memLp_two ν + (fun x => rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1) + (finite_spin_base_exp_integrable ν + (fun σ => rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ)) + (tensorLeafCoefficients (specialRotation U) I degree amplitude n + (fun i => tensorVarianceProfile I degree (site i) (monomial i))) + (tensorLeafCoefficients_variance_le (specialRotation U) I degree amplitude n site monomial) 1 + simpa only [one_mul,priorTensorLog] using hi + +lemma priorTensorLog_gaussian_variance (hgauss : GaussianLipschitzVarianceInput) + {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (site : Fin (n+1) → ℝ≥0) (monomial : Fin (n+1) → Fin k → ℝ≥0) + (U : SpecialOrthogonal N) : + variance (fun z => priorTensorLog ν eig c I degree amplitude + (fun i => tensorVarianceProfile I degree (site i) (monomial i)) (U,z)) gaussianCoordinates ≤ + ∑ i, ((site i : ℝ)*N + ∑ j, (monomial i j : ℝ)*amplitude j^2) := by + have hv := countable_cylinder_log_partition_variance_le hgauss ν + (fun x => rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1) + (finite_spin_base_exp_integrable ν + (fun σ => rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ)) + (tensorLeafCoefficients (specialRotation U) I degree amplitude n + (fun i => tensorVarianceProfile I degree (site i) (monomial i))) + _ (by positivity) + (tensorLeafCoefficients_variance_le (specialRotation U) I degree amplitude n site monomial) 1 + simpa only [one_pow, one_mul,priorTensorLog] using hv + +/-- The variance constant is independent of the mass and cardinality of +an imposed spin constraint. -/ +theorem priorTensorLog_variance (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 tensorVarianceProfile I degree (site i) (monomial i)) + let L := K*N + 2*(∑ i : Fin (n+1), ∑ j, (monomial i j : ℝ)*amplitude j^2* + ∑ a, (degree j a : ℝ)) + MemLp F 2 (μ.prod gaussianCoordinates) ∧ + variance F (μ.prod gaussianCoordinates) ≤ + (∑ i, ((site i : ℝ)*N + ∑ j, (monomial i j : ℝ)*amplitude j^2)) + C*L^2/N := by + obtain ⟨C,hC,hvar⟩ := haar_frobeniusLipschitz_variance hhaar + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m k n ν hν eig c K hK heig I degree amplitude site monomial F L + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure ν := hν + let M := fun U => ∫ z, F (U,z) ∂gaussianCoordinates + have hm : Measurable M := (measurable_priorTensorLog ν eig c I degree amplitude _).stronglyMeasurable + |>.integral_prod_right' |>.measurable + have hL : 0 + tensorLeafLogMean_abs_sub_le (by omega) eig c U V K hK.le heig I degree amplitude n site monomial ν + have hM := haar_frobeniusLipschitz_memLp_two hhaar N hN μ hμinv M hm L hL hLip + have hlocal U := priorTensorLog_gaussian_memLp ν eig c I degree amplitude site monomial U + have hlocalVar U := priorTensorLog_gaussian_variance hgauss ν eig c I degree amplitude site monomial U + have hresult := variance_of_conditional_center μ gaussianCoordinates + (measurable_priorTensorLog ν eig c I degree amplitude _) hM + (fun U => ((hlocal U).sub (memLp_const (M U))).integrable_sq) (fun _ => rfl) + (fun U => by + rw [← variance_eq_integral (hlocal U).aestronglyMeasurable.aemeasurable] + exact hlocalVar U) + exact ⟨hresult.1,hresult.2.trans (add_le_add le_rfl + (hvar N hN μ hμ hμinv M hm L hL hLip))⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorReference.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d2688a69cda85bc2746157cb0c4bbf89368bd54 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorTensorReference.lean @@ -0,0 +1,138 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorNamespace +import OAI.Probability.InvariantIsing.Arrays.TensorDiagonalCGF + +namespace OAI + +/-! The actual fixed-prior Gibbs law and its spectral diagonal tilt. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def priorNamespacedReference {N m k n : ℕ} (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (p : SpecialOrthogonal N × (ℕ → ℝ)) : Measure (Spin N × LabeledLeaf n) := + gibbsProbability ν (priorNamespacedHamiltonian eig c I degree amplitude v p) + +instance priorNamespacedReference_probability {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) + (p : SpecialOrthogonal N × (ℕ → ℝ)) : + IsProbabilityMeasure (priorNamespacedReference ν eig c I degree amplitude v p) := + gibbsProbability_probability _ _ + +lemma measurable_priorNamespacedReference {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (priorNamespacedReference ν eig c I degree amplitude v) := + measurable_gibbsProbability (ν := fun _ => ν) measurable_const + (measurable_priorNamespacedHamiltonian eig c I degree amplitude v) + +private lemma base_coefficient_exp_integrable_ae {Ω X : Type*} + [MeasurableSpace Ω] [MeasurableSpace X] [Countable X] [MeasurableSingletonClass X] + (μ : Measure Ω) (ν : Measure X) [IsProbabilityMeasure ν] + (H : Ω → X → ℝ) (hH : Measurable (Function.uncurry H)) + (hi : ∀ ω, Integrable (fun x => Real.exp (H ω x)) ν) + (A : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (K : ℝ) (hb : ∀ ω x, (A ω x).sum (fun _ c => c^2) ≤ K) : + ∀ᵐ p ∂μ.prod gaussianCoordinates, + Integrable (fun x => Real.exp (H p.1 x+cylinderField (A p.1 x) p.2)) ν := by + have : ∀ ω, IsProbabilityMeasure (ν.tilted (H ω)) := + fun ω => isProbabilityMeasure_tilted (hi ω) + have hm : Measurable (fun ω => ν.tilted (H ω)) := + measurable_random_tilted_measure (ν := fun _ => ν) (H := Function.uncurry H) measurable_const hH + have he := randomCoefficient_all_exp_ae (P := μ) hm A hA hb + filter_upwards [he] with p hp + have hi' := hp 1 + rw [integrable_tilted_iff (hi p.1)] at hi' + simpa only [one_mul,smul_eq_mul,← Real.exp_add] using hi' + +private lemma prior_base_measurable {N n : ℕ} (eig c : Fin N → ℝ) : + Measurable (fun p : SpecialOrthogonal N × (Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation p.1) p.2.1 + fieldEnergy c p.2.1) := by + apply measurable_from_prod_countable_left + intro x + change Measurable (fun U : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1) + unfold rotatedEnergy + exact ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).pow_const 2).const_mul (eig i)).const_mul + (1/2 : ℝ)).add_const _ + +private lemma prior_field_measurable {N m k n : ℕ} + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + cylinderField (tensorNamespacedCoefficients (specialRotation p.1.1) I degree amplitude n v p.2) p.1.2) := by + apply measurable_from_prod_countable_left + intro x + exact measurable_tensorNamespacedFields_joint I degree amplitude n v x + +lemma priorNamespaced_exp_integrable_ae {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) [IsProbabilityMeasure ν] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0≤h 0) : + ∀ᵐ p ∂μ.prod gaussianCoordinates, + Integrable (fun x => Real.exp (priorNamespacedHamiltonian eig c I degree amplitude + (fun i => tensorPathProfile I degree n r h i) p x)) ν := by + exact base_coefficient_exp_integrable_ae μ ν + (fun U x => rotatedEnergy eig (specialRotation U) x.1+fieldEnergy c x.1) + (prior_base_measurable eig c) + (fun U => finite_spin_base_exp_integrable ν + (fun σ => rotatedEnergy eig (specialRotation U) σ+fieldEnergy c σ)) + (fun U => tensorNamespacedCoefficients (specialRotation U) I degree amplitude n + (fun i => tensorPathProfile I degree n r h i)) + (prior_field_measurable I degree amplitude _) _ + (fun U x => tensorNamespacedPath_variance_le (specialRotation U) I degree amplitude n r h hh h0 x) + +lemma prior_diagonal_cgf_eq_log_difference {N m k n : ℕ} (hN : 0 projectedOverlap (specialRotation p.1) (I a) x.1 x.1) + (priorNamespacedReference ν (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p) + (N*perturbationScale N*w) = + priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p - + priorNamespacedLog ν (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p := by + filter_upwards [priorNamespaced_exp_integrable_ae μ ν + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude r h hh h0] with p hp + let H : Spin N × LabeledLeaf n → ℝ := + priorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p + let Y := fun x : Spin N × LabeledLeaf n => projectedOverlap (specialRotation p.1) (I a) x.1 x.1 + have hbnd x : |(N*perturbationScale N*w)*Y x| ≤ |N*perturbationScale N*w| := by + rw [abs_mul] + exact (mul_le_mul_of_nonneg_left (projectedOverlap_abs_le_one _ _ _ _) + (abs_nonneg _)).trans_eq (mul_one _) + have hi : Integrable (fun x => Real.exp (H x+(N*perturbationScale N*w)*Y x)) ν := by + simpa only [add_comm] using integrable_exp_bounded_add (H := H) hp + (measurable_of_countable (fun x => (N*perturbationScale N*w)*Y x)) + (fun x => (le_abs_self _).trans (hbnd x)) + have he : (fun x => H x+(N*perturbationScale N*w)*Y x) = + priorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude (fun i => tensorPathProfile I degree n r h i) p := by + funext x + dsimp only [H,Y,priorNamespacedHamiltonian] + rw [rotatedEnergy_diagonal_coordinate hN eig (specialRotation p.1) I v t a w x.1] + ring + change cgf Y (gibbsProbability ν H) _ = _ + rw [cgf_fold ν H Y _ hp hi,he] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/PriorZeroFieldPressure.lean b/lean/OAI/Probability/InvariantIsing/Fields/PriorZeroFieldPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc639302c1c99fd95c5c8ffbcb54bf35cbe3007e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/PriorZeroFieldPressure.lean @@ -0,0 +1,111 @@ +import OAI.Probability.InvariantIsing.Fields.PriorPerturbationCost +import OAI.Probability.InvariantIsing.Magnetic.RestrictedZeroTreeArrayLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressure + +namespace OAI + +/-! The unperturbed fixed-prior pressure is exactly the physical constrained +pressure with its cube-mass constant removed. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma tensor_zero_field_zero_amplitude {N m k n : ℕ} (U : Rotation N) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (r : Fin k → ℕ) + (x : Spin N × LabeledLeaf n) (z : ℕ → ℝ) : + cylinderField (tensorLeafCoefficients U I degree 0 n + (fun i => tensorPathProfile I degree n r (fun _ => 0) i) x) z = 0 := by + rw [tensorLeafCoefficients, cylinderField_feature] + apply Finset.sum_eq_zero + rintro ⟨i,j⟩ _ + cases j <;> simp [tensorPathProfile, tensorVarianceProfile, spinTensorFeature, + varianceIncrement_zero_path] + +lemma priorTensorLog_zero_field {N m k n : ℕ} + (ν : Measure (Spin N × LabeledLeaf n)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (r : Fin k → ℕ) + (p : SpecialOrthogonal N × (ℕ → ℝ)) : + priorTensorLog ν eig c I degree 0 + (fun i => tensorPathProfile I degree n r (fun _ => 0) i) p = + finiteLogIntegral ν (fun x => rotatedEnergy eig (specialRotation p.1) x.1 + fieldEnergy c x.1) := by + simp only [priorTensorLog, tensor_zero_field_zero_amplitude, add_zero, finiteLogIntegral] + +lemma prior_zero_field_pressure {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (ν : Measure (Spin N × LabeledLeaf n)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) : + priorPerturbationPressureMean μ ν eig c I t (fun _ => 0) 0 0 = + (N : ℝ)⁻¹ * ∫ U, finiteLogIntegral ν + (fun x => rotatedEnergy (fun i => t*eig i) (specialRotation U) x.1 + fieldEnergy c x.1) ∂μ := by + have hamp : tensorPerturbationAmplitude N 0 = 0 := by + ext j + simp [tensorPerturbationAmplitude] + have heig : diagonalPerturbedEigenvalues eig I 0 t = fun i => t*eig i := by + ext i + simp [diagonalPerturbedEigenvalues] + simp only [priorPerturbationPressureMean, hamp, heig, priorTensorLog_zero_field] + congr 1 + simpa only [probReal_univ, one_smul] using integral_fun_fst (μ := μ) (ν := gaussianCoordinates) + (fun U : SpecialOrthogonal N => finiteLogIntegral ν + (fun x => rotatedEnergy (fun i => t*eig i) (specialRotation U) x.1 + fieldEnergy c x.1)) + +lemma restricted_zero_field_pressure {N m : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (S : Finset (Spin N)) (hS : S.Nonempty) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) : + priorPerturbationPressureMean μ (restrictedZeroTreePrior S hS) eig c I t (fun _ => 0) 0 0 = + (∫ U, restrictedRotatedPressure S (fun i => t*eig i) (specialRotation U) c ∂μ) - + (N : ℝ)⁻¹*(Real.log S.card-N*Real.log 2) := by + rw [prior_zero_field_pressure] + let : IsProbabilityMeasure (labeledLeafLaw 0 (PUnit.unit : LabeledTree 0)) := + labeledLeafLaw_probability 0 PUnit.unit + have he (U : SpecialOrthogonal N) : finiteLogIntegral (restrictedZeroTreePrior S hS) + (fun x => rotatedEnergy (fun i => t*eig i) (specialRotation U) x.1 + fieldEnergy c x.1) = + finiteLogIntegral (restrictedSpinPrior S hS : Measure (Spin N)) + (fun σ => rotatedEnergy (fun i => t*eig i) (specialRotation U) σ + fieldEnergy c σ) := by + unfold restrictedZeroTreePrior labeledSpinReference finiteLogIntegral + congr 1 + simpa only [probReal_univ, one_smul] using integral_fun_fst + (μ := (restrictedSpinPrior S hS : Measure (Spin N))) (ν := labeledLeafLaw 0 PUnit.unit) + (fun σ => Real.exp (rotatedEnergy (fun i => t*eig i) (specialRotation U) σ + fieldEnergy c σ)) + simp_rw [he, finiteLogIntegral_restrictedSpinPrior] + let H := fun (U : SpecialOrthogonal N) (σ : Spin N) => + rotatedEnergy (fun i => t*eig i) (specialRotation U) σ + fieldEnergy c σ + have hE (σ : Spin N) : Measurable (fun U => H U σ) := + ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector σ) i).pow_const 2).const_mul + (t*eig i)).const_mul (1/2 : ℝ)).add_const _ + have hm : Measurable (fun U => restrictedSpinLog S (H U)) := by + unfold restrictedSpinLog + exact ((Finset.measurable_sum _ fun σ _ => (hE σ).exp).log).sub_const _ + let B := (∑ i, |t*eig i|)*N/2 + ∑ i, |c i| + have hb (U : SpecialOrthogonal N) (σ : Spin N) : |H U σ| ≤ B := by + have hq := abs_rotatedEnergy_le (fun i => t*eig i) (specialRotation U) + (∑ i, |t*eig i|) + (fun i => Finset.single_le_sum (fun j _ => abs_nonneg (t*eig j)) (Finset.mem_univ i)) σ + have hf := abs_fieldEnergy_sub_le c 0 σ + simp only [fieldEnergy, Pi.zero_apply, zero_mul, Finset.sum_const_zero, sub_zero] at hf + exact (abs_add_le _ _).trans (add_le_add hq hf) + have hi : Integrable (fun U => restrictedSpinLog S (H U)) μ := by + apply Integrable.of_bound hm.aestronglyMeasurable (B+|restrictedSpinLog S (fun _ => 0)|) + apply ae_of_all + intro U + rw [Real.norm_eq_abs] + have hh := abs_restrictedSpinLog_sub_le S hS (H U) (fun _ => 0) B + (fun σ _ => by simpa only [sub_zero] using hb U σ) + calc + _ = |(restrictedSpinLog S (H U)-restrictedSpinLog S (fun _ => 0))+ + restrictedSpinLog S (fun _ => 0)| := by congr 1; ring + _ ≤ |restrictedSpinLog S (H U)-restrictedSpinLog S (fun _ => 0)|+ + |restrictedSpinLog S (fun _ => 0)| := abs_add_le _ _ + _ ≤ _ := add_le_add hh le_rfl + rw [integral_sub hi (integrable_const _), integral_const, probReal_univ, one_smul, mul_sub] + rw [← integral_const_mul] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/RationalFieldApproximation.lean b/lean/OAI/Probability/InvariantIsing/Fields/RationalFieldApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..46eb96bbbd05d164372f7eb51ff1fd9d3398200b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/RationalFieldApproximation.lean @@ -0,0 +1,32 @@ +import OAI.Probability.InvariantIsing.Fields.FieldCouplingExtension +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteLawExtension +import OAI.Probability.InvariantIsing.Fields.RationalFieldLaw + +namespace OAI + +/-! Every convergent finite rational approximation gives the same magnetic value. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem magneticFieldFunctional_rational_approximation + (ν μ : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) (p : ℕ → RationalFieldLaw) + (hw : Tendsto (fun n => fieldWassersteinOne (p n).law μ) atTop (𝓝 0)) : + Tendsto (fun n => (p n).magneticValue (measureR (ν : Measure ℝ) b)) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b μ)) := by + have hh := magneticFieldFunctional_tendsto_wasserstein ν μ (fun n => (p n).law) a b + hcompact hbound ha hb hμ (fun n => (p n).integrable_id) hw + have he n := magneticFieldFunctional_finite ν a b hcompact hbound ha hb + (p n).mass (p n).field (p n).mass_pos (p n).mass_sum (p n).law rfl + simpa only [he,RationalFieldLaw.magneticValue] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/RationalFieldLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/RationalFieldLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a1f6eaf819fc5d55bf8855eb260ed55350481b0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/RationalFieldLaw.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureMagneticLawInvariance + +namespace OAI + +/-! The finite positive rational field laws used in the W1 extension of +the magnetic pressure formula. Labels may repeat the same field value. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing + +structure RationalFieldLaw where + size : ℕ + weight : Fin size → ℚ + positive : ∀ i, 0 < weight i + total : ∑ i, weight i=1 + field : Fin size → ℝ + +namespace RationalFieldLaw + +def mass (p : RationalFieldLaw) (i : Fin p.size) : ℝ := p.weight i + +lemma mass_pos (p : RationalFieldLaw) (i : Fin p.size) : 0 < p.mass i := by + change 0 < (p.weight i : ℝ) + exact_mod_cast p.positive i + +lemma mass_sum (p : RationalFieldLaw) : ∑ i, p.mass i=1 := by + change (∑ i, (p.weight i : ℝ))=1 + exact_mod_cast p.total + +def measure (p : RationalFieldLaw) : Measure ℝ := finiteSpectralMeasure p.mass p.field + +instance probability (p : RationalFieldLaw) : IsProbabilityMeasure p.measure := + finiteSpectralMeasure_probability p.mass p.field (fun i => (p.mass_pos i).le) p.mass_sum + +def law (p : RationalFieldLaw) : ProbabilityMeasure ℝ := ⟨p.measure,inferInstance⟩ + +def magneticValue (p : RationalFieldLaw) (R : ℝ → ℝ) : ℝ := + (finiteMagneticFunctional R p.mass p.field).toReal + +lemma magneticValue_eq_of_law_eq (p q : RationalFieldLaw) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Set.Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (he : p.law=q.law) : + p.magneticValue (measureR (ν : Measure ℝ) b)=q.magneticValue (measureR (ν : Measure ℝ) b) := + measureMagnetic_eq_of_field_law_eq ν a b hcompact hbound ha hb p.mass p.field q.mass q.field + p.mass_pos q.mass_pos p.mass_sum q.mass_sum (congrArg ProbabilityMeasure.toMeasure he) + +lemma integrable_id (p : RationalFieldLaw) : Integrable (fun x : ℝ => x) p.measure := by + change Integrable (fun x : ℝ => x) (Measure.sum (fun i => ENNReal.ofReal (p.mass i) • Measure.dirac (p.field i))) + rw [Measure.sum_fintype] + apply integrable_finsetSum_measure.mpr + intro i _ + exact (integrable_dirac (by simp)).smul_measure (by finiteness) + +end RationalFieldLaw +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedForestPairData.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedForestPairData.lean new file mode 100644 index 0000000000000000000000000000000000000000..23f7210b10651ea42bb9c687271b353ca74d9122 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedForestPairData.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Fields.CascadeSeedPath + +namespace OAI + +/-! A pair of ancestor-generated paths on the independent uniform forest. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +def seedForestPairData (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) (z : ι → ℝ) + (q : (ℕ → LabeledLeaf n) × MarkForest unitInterval n) : + ℕ × (Fin n → (ι → ℝ) × (ι → ℝ)) := + (labeledCommonDepth n (q.1 0) (q.1 1),fun i => + (cascadeSeedPath n ψ z q.2 (q.1 0) i,cascadeSeedPath n ψ z q.2 (q.1 1) i)) + +lemma measurable_seedForestPairData (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) (z : ι → ℝ) : + Measurable (seedForestPairData n ψ z) := by + have hm : Measurable (fun p : LabeledLeaf n × MarkForest unitInterval n => + cascadeSeedPath n ψ z p.2 p.1) := by + apply measurable_from_prod_countable_right + intro α + exact (measurable_cascadeSeedPath n ψ hψ α).comp (measurable_const.prodMk measurable_id) + change Measurable (fun q : (ℕ → LabeledLeaf n) × MarkForest unitInterval n => + (labeledCommonDepth n (q.1 0) (q.1 1),fun i => + (cascadeSeedPath n ψ z q.2 (q.1 0) i,cascadeSeedPath n ψ z q.2 (q.1 1) i))) + apply Measurable.prodMk + · have hp : Measurable (fun q : (ℕ → LabeledLeaf n) × MarkForest unitInterval n => + (q.1 0,q.1 1)) := + ((measurable_pi_apply 0).comp measurable_fst).prodMk + ((measurable_pi_apply 1).comp measurable_fst) + exact (measurable_of_countable (fun p : LabeledLeaf n × LabeledLeaf n => + labeledCommonDepth n p.1 p.2)).comp hp + · have hp (j : ℕ) : Measurable (fun q : (ℕ → LabeledLeaf n) × MarkForest unitInterval n => + (q.1 j,q.2)) := + ((measurable_pi_apply j).comp measurable_fst).prodMk measurable_snd + exact Measurable.of_eval fun i => + ((measurable_pi_apply i).comp (hm.comp (hp 0))).prodMk + ((measurable_pi_apply i).comp (hm.comp (hp 1))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedIndependentKernel.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedIndependentKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..708ab840df6cf76f4cc71463369fad5437ed37e2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedIndependentKernel.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.MarkPairRecursion + +namespace OAI + +/-! Replacing independent uniform seeds by their normalized conditional mark kernels. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +theorem seed_independent_kernel (n : ℕ) (κ : ℕ → Kernel (ι → ℝ) (ι → ℝ)) + (hκ : ∀ i, IsMarkovKernel (κ i)) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) + (hlaw : ∀ i z, volume.map (ψ i z) = κ i z) (z₁ z₂ : ι → ℝ) + (F : (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) (hF : Measurable F) + {C : ℝ} (hB : ∀ w, |F w| ≤ C) : + seedPairPathMean n ψ 0 z₁ z₂ F = markPairPathMean n κ 0 z₁ z₂ F := by + induction n generalizing κ ψ z₁ z₂ with + | zero => rfl + | succ n ih => + let H := fun p : (ι → ℝ) × (ι → ℝ) => + seedPairPathMean n (fun j => ψ (j+1)) 0 (z₁+p.1) (z₂+p.2) + (fun w => F (Fin.cons (p.1,p.2) w)) + have hH : Measurable H := measurable_seedPairPathMean n (fun j => ψ (j+1)) + (fun j => hψ (j+1)) 0 (fun p : (ι → ℝ) × (ι → ℝ) => z₁+p.1) (fun p => z₂+p.2) + (measurable_const.add measurable_fst) (measurable_const.add measurable_snd) + (fun (p : (ι → ℝ) × (ι → ℝ)) w => F (Fin.cons (p.1,p.2) w)) + (hF.comp (measurable_finCons measurable_fst measurable_snd)) + have hP : MeasurePreserving (fun u : unitInterval × unitInterval => + (ψ 0 z₁ u.1,ψ 0 z₂ u.2)) (volume.prod volume) ((κ 0 z₁).prod (κ 0 z₂)) := + (show MeasurePreserving (ψ 0 z₁) volume (κ 0 z₁) from + ⟨(hψ 0).comp (measurable_const.prodMk measurable_id),hlaw 0 z₁⟩).prod + (show MeasurePreserving (ψ 0 z₂) volume (κ 0 z₂) from + ⟨(hψ 0).comp (measurable_const.prodMk measurable_id),hlaw 0 z₂⟩) + let := hκ 0 + have hiH : Integrable H ((κ 0 z₁).prod (κ 0 z₂)) := + Integrable.of_bound hH.aestronglyMeasurable C (ae_of_all _ fun p => by + simpa only [Real.norm_eq_abs] using seedPairPathMean_abs_le n (fun j => ψ (j+1)) + 0 (z₁+p.1) (z₂+p.2) (fun w => F (Fin.cons (p.1,p.2) w)) (fun w => hB _)) + calc + _ = ∫ p, H p ∂(κ 0 z₁).prod (κ 0 z₂) := hP.hasLaw.integral_comp hH.aestronglyMeasurable + _ = ∫ a₁, ∫ a₂, H (a₁,a₂) ∂κ 0 z₂ ∂κ 0 z₁ := integral_prod _ hiH + _ = markPairPathMean (n+1) κ 0 z₁ z₂ F := by + rw [markPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro a₁ + apply integral_congr_ae + apply ae_of_all + intro a₂ + exact ih (fun j => κ (j+1)) (fun j => hκ (j+1)) + (fun j => ψ (j+1)) (fun j => hψ (j+1)) (fun j z => hlaw (j+1) z) + (z₁+a₁) (z₂+a₂) (fun w => F (Fin.cons (a₁,a₂) w)) + (hF.comp (measurable_finCons measurable_const measurable_id)) (fun w => hB _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedIndependentPairEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedIndependentPairEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea7ec4786498708f2aaaa41a3e845e20039727b1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedIndependentPairEvaluation.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Fields.SeedPairRecursion +import OAI.Probability.InvariantIsing.Core.PairProductShuffle + +namespace OAI + +/-! Two independent seed forests give the independent branch of the finite recursion. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +private lemma zip_finCons {A B : Type*} {n : ℕ} (a : A) (b : B) + (f : Fin n → A) (g : Fin n → B) : + (fun i : Fin (n+1) => ((Fin.cons a f : Fin (n+1) → A) i, + (Fin.cons b g : Fin (n+1) → B) i)) = + (Fin.cons (a,b) (fun i => (f i,g i)) : Fin (n+1) → A × B) := by + funext i + exact Fin.cases rfl (fun _ => rfl) i + +theorem seed_independent_pair_evaluation (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) (z₁ z₂ : ι → ℝ) + (α β : LabeledLeaf n) (F : (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) + (hF : Measurable F) {C : ℝ} (hB : ∀ w, |F w| ≤ C) : + (∫ g : MarkForest unitInterval n × MarkForest unitInterval n, + F (fun i => (cascadeSeedPath n ψ z₁ g.1 α i,cascadeSeedPath n ψ z₂ g.2 β i)) + ∂(markForestLaw unitInterval n (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval n)).prod + (markForestLaw unitInterval n (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval n))) = + seedPairPathMean n ψ 0 z₁ z₂ F := by + induction n generalizing ψ z₁ z₂ with + | zero => + have he (g : MarkForest unitInterval 0 × MarkForest unitInterval 0) : + (fun i => (cascadeSeedPath 0 ψ z₁ g.1 α i,cascadeSeedPath 0 ψ z₂ g.2 β i)) = Fin.elim0 := + funext fun i => i.elim0 + simp only [he,integral_const,probReal_univ,one_smul,seedPairPathMean] + | succ n ih => + let Q : Measure (MarkForest unitInterval n) := markForestLaw unitInterval n (fun _ => cascadeSeedLaw) + let H := fun p : (unitInterval × unitInterval) × + (MarkForest unitInterval n × MarkForest unitInterval n) => + F (Fin.cons (ψ 0 z₁ p.1.1,ψ 0 z₂ p.1.2) (fun i => + (cascadeSeedPath n (fun j => ψ (j+1)) (z₁+ψ 0 z₁ p.1.1) p.2.1 α.2 i, + cascadeSeedPath n (fun j => ψ (j+1)) (z₂+ψ 0 z₂ p.1.2) p.2.2 β.2 i))) + have hA : Measurable (fun p : (unitInterval × unitInterval) × + (MarkForest unitInterval n × MarkForest unitInterval n) => ψ 0 z₁ p.1.1) := + (hψ 0).comp (measurable_const.prodMk measurable_fst.fst) + have hD : Measurable (fun p : (unitInterval × unitInterval) × + (MarkForest unitInterval n × MarkForest unitInterval n) => ψ 0 z₂ p.1.2) := + (hψ 0).comp (measurable_const.prodMk measurable_fst.snd) + have hP := (measurable_cascadeSeedPath n (fun j => ψ (j+1)) (fun j => hψ (j+1)) α.2).comp + (((measurable_const (a := z₁)).add hA).prodMk measurable_snd.fst) + have hR := (measurable_cascadeSeedPath n (fun j => ψ (j+1)) (fun j => hψ (j+1)) β.2).comp + (((measurable_const (a := z₂)).add hD).prodMk measurable_snd.snd) + have hH : Measurable H := hF.comp (measurable_finCons (hA.prodMk hD) + (Measurable.of_eval fun i => ((measurable_pi_apply i).comp hP).prodMk + ((measurable_pi_apply i).comp hR))) + have hiH : Integrable H ((volume.prod volume).prod (Q.prod Q)) := + Integrable.of_bound hH.aestronglyMeasurable C (ae_of_all _ fun p => by + simpa only [Real.norm_eq_abs] using hB _) + let R := fun g : MarkForest unitInterval (n+1) × MarkForest unitInterval (n+1) => + (((g.1 α.1.1 α.1.2).1,(g.2 β.1.1 β.1.2).1), + ((g.1 α.1.1 α.1.2).2,(g.2 β.1.1 β.1.2).2)) + calc + _ = ∫ g, H (R g) + ∂(markForestLaw unitInterval (n+1) (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval (n+1))).prod + (markForestLaw unitInterval (n+1) (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval (n+1))) := by + apply integral_congr_ae + apply ae_of_all + intro g + exact congrArg F (zip_finCons _ _ _ _) + _ = ∫ p, H p ∂(volume.prod volume).prod (Q.prod Q) := + (markForestPairRoots_preserving n (fun _ => cascadeSeedLaw) α.1 β.1).hasLaw.integral_comp hH.aestronglyMeasurable + _ = ∫ u, ∫ g, H (u,g) ∂Q.prod Q ∂volume.prod volume := integral_prod _ hiH + _ = seedPairPathMean (n+1) ψ 0 z₁ z₂ F := by + rw [seedPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro u + exact ih (fun j => ψ (j+1)) (fun j => hψ (j+1)) + (z₁+ψ 0 z₁ u.1) (z₂+ψ 0 z₂ u.2) α.2 β.2 + (fun w => F (Fin.cons (ψ 0 z₁ u.1,ψ 0 z₂ u.2) w)) + (hF.comp (measurable_finCons measurable_const measurable_id)) (fun w => hB _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedPairIntegral.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedPairIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..0014ce42325cf26d6125be4d6923c4434e33676a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedPairIntegral.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Fields.CascadeSeedPairCoordinates +import OAI.Probability.InvariantIsing.Fields.SeedSharedPairEvaluation + +namespace OAI + +/-! Averaging the exact shared-prefix seed recursion over the unperturbed cascade. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +theorem seed_pair_mean_integral (n : ℕ) (b : ℕ → ℝ) (hb : CascadeExponents n b) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) (z : ι → ℝ) + (Φ : ℕ × (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) (hΦ : Measurable Φ) + {C : ℝ} (hB : ∀ p, |Φ p| ≤ C) : + (∫ p : NoiseTree unitInterval n × (ℕ → NoiseLeaf unitInterval n), + Φ (noiseReplicaPairData n (fun i => cascadeSeedLeaf n ψ z (p.2 i))) + ∂((noiseCascadeLaw unitInterval n b (fun _ => cascadeSeedLaw) : Measure (NoiseTree unitInterval n)) ⊗ₘ + probabilityReplicaKernel (noiseLeafKernel unitInterval n) (noiseLeafKernel unitInterval n).measurable)) = + ∫ α : ℕ → LabeledLeaf n, seedPairPathMean n ψ (labeledCommonDepth n (α 0) (α 1)) z z + (fun w => Φ (labeledCommonDepth n (α 0) (α 1),w)) ∂cascadeReplicaLaw n b := by + have hS : Measurable (fun p : NoiseTree unitInterval n × (ℕ → NoiseLeaf unitInterval n) => + noiseReplicaPairData n (fun i => cascadeSeedLeaf n ψ z (p.2 i))) := + (measurable_noiseReplicaPairData n).comp (Measurable.of_eval fun i => + (measurable_cascadeSeedLeaf n ψ hψ).comp + (measurable_const.prodMk ((measurable_pi_apply i).comp measurable_snd))) + have hG : Measurable (fun q : (ℕ → LabeledLeaf n) × MarkForest unitInterval n => + Φ (seedForestPairData n ψ z q)) := hΦ.comp (measurable_seedForestPairData n ψ hψ z) + have hiG : Integrable (fun q => Φ (seedForestPairData n ψ z q)) + ((cascadeReplicaLaw n b).prod + (markForestLaw unitInterval n (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval n))) := + Integrable.of_bound hG.aestronglyMeasurable C (ae_of_all _ fun q => by + simpa only [Real.norm_eq_abs] using hB _) + have h := congrArg (fun μ => ∫ p, Φ p ∂μ) (cascade_seed_pair_coordinates n b hb ψ hψ z) + rw [integral_map hS.aemeasurable hΦ.aestronglyMeasurable, + integral_map (measurable_seedForestPairData n ψ hψ z).aemeasurable hΦ.aestronglyMeasurable] at h + rw [h,integral_prod _ hiG] + apply integral_congr_ae + apply ae_of_all + intro α + exact seed_shared_pair_evaluation n ψ hψ z z (α 0) (α 1) + (fun w => Φ (labeledCommonDepth n (α 0) (α 1),w)) + (hΦ.comp (measurable_const.prodMk measurable_id)) (fun w => hB _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedPairRecursion.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedPairRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..ebb498456ac791a74957806fa29279cea2bd0436 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedPairRecursion.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Fields.CascadeSeedPath + +namespace OAI + +/-! Finite two-path recursion for the ancestor-dependent uniform seeds. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +def seedPairPathMean : (n : ℕ) → (ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) → + ℕ → (ι → ℝ) → (ι → ℝ) → ((Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) → ℝ + | 0, _, _, _, _, F => F Fin.elim0 + | n+1, ψ, 0, z₁, z₂, F => + ∫ u : unitInterval × unitInterval, + seedPairPathMean n (fun i => ψ (i+1)) 0 + (z₁+ψ 0 z₁ u.1) (z₂+ψ 0 z₂ u.2) + (fun w => F (Fin.cons (ψ 0 z₁ u.1,ψ 0 z₂ u.2) w)) ∂volume.prod volume + | n+1, ψ, d+1, z₁, z₂, F => + ∫ u : unitInterval, + seedPairPathMean n (fun i => ψ (i+1)) d + (z₁+ψ 0 z₁ u) (z₂+ψ 0 z₂ u) + (fun w => F (Fin.cons (ψ 0 z₁ u,ψ 0 z₂ u) w)) + +lemma measurable_finCons {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + {n : ℕ} {a : X → Y} {w : X → Fin n → Y} (ha : Measurable a) (hw : Measurable w) : + Measurable (fun x => (Fin.cons (a x) (w x) : Fin (n+1) → Y)) := by + apply Measurable.of_eval + intro i + exact Fin.cases ha (fun j => (measurable_pi_apply j).comp hw) i + +lemma measurable_seedPairPathMean (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) (d : ℕ) + {X : Type*} [MeasurableSpace X] (z₁ z₂ : X → (ι → ℝ)) + (h₁ : Measurable z₁) (h₂ : Measurable z₂) + (F : X → (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) + (hF : Measurable (Function.uncurry F)) : + Measurable (fun x => seedPairPathMean n ψ d (z₁ x) (z₂ x) (F x)) := by + induction n generalizing X ψ d with + | zero => exact hF.comp (measurable_id.prodMk measurable_const) + | succ n ih => + cases d with + | zero => + have hA : Measurable (fun p : X × (unitInterval × unitInterval) => ψ 0 (z₁ p.1) p.2.1) := + (hψ 0).comp ((h₁.comp measurable_fst).prodMk measurable_snd.fst) + have hB : Measurable (fun p : X × (unitInterval × unitInterval) => ψ 0 (z₂ p.1) p.2.2) := + (hψ 0).comp ((h₂.comp measurable_fst).prodMk measurable_snd.snd) + have hC : Measurable (fun p : (X × (unitInterval × unitInterval)) × + (Fin n → (ι → ℝ) × (ι → ℝ)) => + F p.1.1 (Fin.cons (ψ 0 (z₁ p.1.1) p.1.2.1,ψ 0 (z₂ p.1.1) p.1.2.2) p.2)) := + hF.comp (measurable_fst.fst.prodMk + (measurable_finCons ((hA.comp measurable_fst).prodMk (hB.comp measurable_fst)) measurable_snd)) + exact (ih (fun i => ψ (i+1)) (fun i => hψ (i+1)) 0 + (fun p : X × (unitInterval × unitInterval) => z₁ p.1+ψ 0 (z₁ p.1) p.2.1) + (fun p => z₂ p.1+ψ 0 (z₂ p.1) p.2.2) + ((h₁.comp measurable_fst).add hA) ((h₂.comp measurable_fst).add hB) + (fun p w => F p.1 (Fin.cons (ψ 0 (z₁ p.1) p.2.1,ψ 0 (z₂ p.1) p.2.2) w)) hC + ).stronglyMeasurable.integral_prod_right.measurable + | succ d => + have hA : Measurable (fun p : X × unitInterval => ψ 0 (z₁ p.1) p.2) := + (hψ 0).comp ((h₁.comp measurable_fst).prodMk measurable_snd) + have hB : Measurable (fun p : X × unitInterval => ψ 0 (z₂ p.1) p.2) := + (hψ 0).comp ((h₂.comp measurable_fst).prodMk measurable_snd) + have hC : Measurable (fun p : (X × unitInterval) × + (Fin n → (ι → ℝ) × (ι → ℝ)) => + F p.1.1 (Fin.cons (ψ 0 (z₁ p.1.1) p.1.2,ψ 0 (z₂ p.1.1) p.1.2) p.2)) := + hF.comp (measurable_fst.fst.prodMk + (measurable_finCons ((hA.comp measurable_fst).prodMk (hB.comp measurable_fst)) measurable_snd)) + exact (ih (fun i => ψ (i+1)) (fun i => hψ (i+1)) d + (fun p : X × unitInterval => z₁ p.1+ψ 0 (z₁ p.1) p.2) + (fun p => z₂ p.1+ψ 0 (z₂ p.1) p.2) + ((h₁.comp measurable_fst).add hA) ((h₂.comp measurable_fst).add hB) + (fun p w => F p.1 (Fin.cons (ψ 0 (z₁ p.1) p.2,ψ 0 (z₂ p.1) p.2) w)) hC + ).stronglyMeasurable.integral_prod_right.measurable + +private lemma seed_abs_integral_bound {A : Type*} [MeasurableSpace A] + {μ : Measure A} [IsProbabilityMeasure μ] (f : A → ℝ) {C : ℝ} + (hf : ∀ a, |f a| ≤ C) : |∫ a, f a ∂μ| ≤ C := by + have hh : ∀ᵐ a ∂μ, ‖f a‖ ≤ C := ae_of_all _ fun a => by + simpa only [Real.norm_eq_abs] using hf a + simpa only [Real.norm_eq_abs, probReal_univ, mul_one] using + norm_integral_le_of_norm_le_const (μ := μ) (f := f) hh + +lemma seedPairPathMean_abs_le (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) (d : ℕ) (z₁ z₂ : ι → ℝ) + (F : (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) {C : ℝ} (hF : ∀ w, |F w| ≤ C) : + |seedPairPathMean n ψ d z₁ z₂ F| ≤ C := by + induction n generalizing ψ d z₁ z₂ with + | zero => exact hF _ + | succ n ih => + cases d <;> simp only [seedPairPathMean] + all_goals + apply seed_abs_integral_bound + intro u + exact ih _ _ _ _ _ (fun w => hF _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedPairStep.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedPairStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..25719c929a51bdf04f61fe65749112a81b584148 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedPairStep.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Fields.SeedIndependentPairEvaluation + +namespace OAI + +/-! Measurability of one pair of root updates with both descendant paths. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +def seedPairStep (n : ℕ) (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (z₁ z₂ : ι → ℝ) (α β : LabeledLeaf n) + (F : (Fin (n+1) → (ι → ℝ) × (ι → ℝ)) → ℝ) + (p : (unitInterval × unitInterval) × (MarkForest unitInterval n × MarkForest unitInterval n)) : ℝ := + F (Fin.cons (ψ 0 z₁ p.1.1,ψ 0 z₂ p.1.2) (fun i => + (cascadeSeedPath n (fun j => ψ (j+1)) (z₁+ψ 0 z₁ p.1.1) p.2.1 α i, + cascadeSeedPath n (fun j => ψ (j+1)) (z₂+ψ 0 z₂ p.1.2) p.2.2 β i))) + +lemma measurable_seedPairStep (n : ℕ) (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) (z₁ z₂ : ι → ℝ) + (α β : LabeledLeaf n) (F : (Fin (n+1) → (ι → ℝ) × (ι → ℝ)) → ℝ) + (hF : Measurable F) : Measurable (seedPairStep n ψ z₁ z₂ α β F) := by + have hA : Measurable (fun p : (unitInterval × unitInterval) × + (MarkForest unitInterval n × MarkForest unitInterval n) => ψ 0 z₁ p.1.1) := + (hψ 0).comp (measurable_const.prodMk measurable_fst.fst) + have hB : Measurable (fun p : (unitInterval × unitInterval) × + (MarkForest unitInterval n × MarkForest unitInterval n) => ψ 0 z₂ p.1.2) := + (hψ 0).comp (measurable_const.prodMk measurable_fst.snd) + have hP := (measurable_cascadeSeedPath n (fun j => ψ (j+1)) (fun j => hψ (j+1)) α).comp + (((measurable_const (a := z₁)).add hA).prodMk measurable_snd.fst) + have hR := (measurable_cascadeSeedPath n (fun j => ψ (j+1)) (fun j => hψ (j+1)) β).comp + (((measurable_const (a := z₂)).add hB).prodMk measurable_snd.snd) + exact hF.comp (measurable_finCons (hA.prodMk hB) + (Measurable.of_eval fun i => ((measurable_pi_apply i).comp hP).prodMk + ((measurable_pi_apply i).comp hR))) + +lemma seedPairStep_root (n : ℕ) (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (z₁ z₂ : ι → ℝ) (α β : LabeledLeaf (n+1)) + (F : (Fin (n+1) → (ι → ℝ) × (ι → ℝ)) → ℝ) + (g h : MarkForest unitInterval (n+1)) : + F (fun i => (cascadeSeedPath (n+1) ψ z₁ g α i,cascadeSeedPath (n+1) ψ z₂ h β i)) = + seedPairStep n ψ z₁ z₂ α.2 β.2 F + (((g α.1.1 α.1.2).1,(h β.1.1 β.1.2).1),((g α.1.1 α.1.2).2,(h β.1.1 β.1.2).2)) := by + apply congrArg F + funext i + exact Fin.cases rfl (fun _ => rfl) i + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedSharedKernel.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedSharedKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..761afd6d83a38370e9e16797022bb3088e70d324 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedSharedKernel.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Fields.SeedIndependentKernel + +namespace OAI + +/-! Common-prefix seed updates become common conditional marks from the same ancestor state. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +theorem seed_shared_kernel (n : ℕ) (κ : ℕ → Kernel (ι → ℝ) (ι → ℝ)) + (hκ : ∀ i, IsMarkovKernel (κ i)) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) + (hlaw : ∀ i z, volume.map (ψ i z) = κ i z) (d : ℕ) (z : ι → ℝ) + (F : (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) (hF : Measurable F) + {C : ℝ} (hB : ∀ w, |F w| ≤ C) : + seedPairPathMean n ψ d z z F = markPairPathMean n κ d z z F := by + induction n generalizing κ ψ d z with + | zero => rfl + | succ n ih => + cases d with + | zero => exact seed_independent_kernel (n+1) κ hκ ψ hψ hlaw z z F hF hB + | succ d => + let H := fun a : ι → ℝ => seedPairPathMean n (fun j => ψ (j+1)) d + (z+a) (z+a) (fun w => F (Fin.cons (a,a) w)) + have hH : Measurable H := measurable_seedPairPathMean n (fun j => ψ (j+1)) + (fun j => hψ (j+1)) d (fun a => z+a) (fun a => z+a) + (measurable_const.add measurable_id) (measurable_const.add measurable_id) + (fun a w => F (Fin.cons (a,a) w)) + (hF.comp (measurable_finCons (measurable_fst.prodMk measurable_fst) measurable_snd)) + have hP : MeasurePreserving (ψ 0 z) volume (κ 0 z) := + ⟨(hψ 0).comp (measurable_const.prodMk measurable_id),hlaw 0 z⟩ + calc + _ = ∫ a, H a ∂κ 0 z := hP.hasLaw.integral_comp hH.aestronglyMeasurable + _ = markPairPathMean (n+1) κ (d+1) z z F := by + rw [markPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro a + exact ih (fun j => κ (j+1)) (fun j => hκ (j+1)) + (fun j => ψ (j+1)) (fun j => hψ (j+1)) (fun j z => hlaw (j+1) z) + d (z+a) (fun w => F (Fin.cons (a,a) w)) + (hF.comp (measurable_finCons measurable_const measurable_id)) (fun w => hB _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SeedSharedPairEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Fields/SeedSharedPairEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa7e5d382df3fcf4d479d0445c089269f30de918 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SeedSharedPairEvaluation.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Fields.SeedPairStep + +namespace OAI + +/-! The common labeled prefix determines the shared seed updates exactly. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing +variable {ι : Type} + +theorem seed_shared_pair_evaluation (n : ℕ) + (ψ : ℕ → (ι → ℝ) → unitInterval → (ι → ℝ)) + (hψ : ∀ i, Measurable (Function.uncurry (ψ i))) (z₁ z₂ : ι → ℝ) + (α β : LabeledLeaf n) (F : (Fin n → (ι → ℝ) × (ι → ℝ)) → ℝ) + (hF : Measurable F) {C : ℝ} (hB : ∀ w, |F w| ≤ C) : + (∫ g : MarkForest unitInterval n, + F (fun i => (cascadeSeedPath n ψ z₁ g α i,cascadeSeedPath n ψ z₂ g β i)) + ∂(markForestLaw unitInterval n (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval n))) = + seedPairPathMean n ψ (labeledCommonDepth n α β) z₁ z₂ F := by + induction n generalizing ψ z₁ z₂ with + | zero => + have he (g : MarkForest unitInterval 0) : + (fun i => (cascadeSeedPath 0 ψ z₁ g α i,cascadeSeedPath 0 ψ z₂ g β i)) = Fin.elim0 := + funext fun i => i.elim0 + simp only [he,integral_const,probReal_univ,one_smul,seedPairPathMean] + | succ n ih => + rcases α with ⟨a,α⟩ + rcases β with ⟨b,β⟩ + let Q : Measure (MarkForest unitInterval n) := markForestLaw unitInterval n (fun _ => cascadeSeedLaw) + by_cases hab : a = b + · subst b + rw [labeledCommonDepth,ite_eq_left rfl] + let H := fun p : unitInterval × MarkForest unitInterval n => + seedPairStep n ψ z₁ z₂ α β F ((p.1,p.1),(p.2,p.2)) + have hH : Measurable H := (measurable_seedPairStep n ψ hψ z₁ z₂ α β F hF).comp (by fun_prop) + have hiH : Integrable H (volume.prod Q) := + Integrable.of_bound hH.aestronglyMeasurable C (ae_of_all _ fun p => by + simpa only [Real.norm_eq_abs,H,seedPairStep] using hB _) + calc + _ = ∫ g : MarkForest unitInterval (n+1), H (g a.1 a.2) + ∂(markForestLaw unitInterval (n+1) (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval (n+1))) := by + apply integral_congr_ae + apply ae_of_all + intro g + exact seedPairStep_root n ψ z₁ z₂ (a,α) (a,β) F g g + _ = ∫ p, H p ∂volume.prod Q := + (markForestRoot_preserving n (fun _ => cascadeSeedLaw) a).hasLaw.integral_comp hH.aestronglyMeasurable + _ = ∫ u, ∫ g, H (u,g) ∂Q ∂volume := integral_prod _ hiH + _ = seedPairPathMean (n+1) ψ (labeledCommonDepth n α β+1) z₁ z₂ F := by + rw [seedPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro u + exact ih (fun j => ψ (j+1)) (fun j => hψ (j+1)) + (z₁+ψ 0 z₁ u) (z₂+ψ 0 z₂ u) α β + (fun w => F (Fin.cons (ψ 0 z₁ u,ψ 0 z₂ u) w)) + (hF.comp (measurable_finCons measurable_const measurable_id)) (fun w => hB _) + · rw [labeledCommonDepth,ite_eq_right hab] + let H := seedPairStep n ψ z₁ z₂ α β F + have hH : Measurable H := measurable_seedPairStep n ψ hψ z₁ z₂ α β F hF + have hiH : Integrable H ((volume.prod volume).prod (Q.prod Q)) := + Integrable.of_bound hH.aestronglyMeasurable C (ae_of_all _ fun p => by + simpa only [Real.norm_eq_abs,H,seedPairStep] using hB _) + calc + _ = ∫ g : MarkForest unitInterval (n+1), + H (((g a.1 a.2).1,(g b.1 b.2).1),((g a.1 a.2).2,(g b.1 b.2).2)) + ∂(markForestLaw unitInterval (n+1) (fun _ => cascadeSeedLaw) : Measure (MarkForest unitInterval (n+1))) := by + apply integral_congr_ae + apply ae_of_all + intro g + exact seedPairStep_root n ψ z₁ z₂ (a,α) (b,β) F g g + _ = ∫ p, H p ∂(volume.prod volume).prod (Q.prod Q) := + (markForestDistinctRoots_preserving n (fun _ => cascadeSeedLaw) a b hab).hasLaw.integral_comp hH.aestronglyMeasurable + _ = ∫ u, ∫ g, H (u,g) ∂Q.prod Q ∂volume.prod volume := integral_prod _ hiH + _ = seedPairPathMean (n+1) ψ 0 z₁ z₂ F := by + rw [seedPairPathMean] + apply integral_congr_ae + apply ae_of_all + intro u + exact seed_independent_pair_evaluation n (fun j => ψ (j+1)) (fun j => hψ (j+1)) + (z₁+ψ 0 z₁ u.1) (z₂+ψ 0 z₂ u.2) α β + (fun w => F (Fin.cons (ψ 0 z₁ u.1,ψ 0 z₂ u.2) w)) + (hF.comp (measurable_finCons measurable_const measurable_id)) (fun w => hB _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldComparison.lean b/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0e509f70488fc5c8bd5c52f46a9be2d29f86ab3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldComparison.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Fields.SimpleFieldData +import OAI.Probability.InvariantIsing.Core.FiniteIndexMagnetic +import OAI.Probability.InvariantIsing.Spectral.MeasureMagneticLawInvariance + +namespace OAI + +/-! Law invariance and the integral transportation bound for simple fields. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped BigOperators +namespace InvariantIsing + +variable (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + +include hcompact hbound ha hb + +lemma simpleFieldValue_eq_of_map_eq {Ω Ξ : Type*} [MeasurableSpace Ω] [MeasurableSpace Ξ] + (P : Measure Ω) (Q : Measure Ξ) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] + (s : SimpleFunc Ω ℝ) (t : SimpleFunc Ξ ℝ) (he : P.map s=Q.map t) : + simpleFieldValue P s (measureR (ν : Measure ℝ) b)= + simpleFieldValue Q t (measureR (ν : Measure ℝ) b) := by + apply measureMagnetic_eq_of_field_law_eq ν a b hcompact hbound ha hb + (fun i : SimpleFieldPositive P s => simpleFieldWeight P s i) (fun i => i.val.val) + (fun i : SimpleFieldPositive Q t => simpleFieldWeight Q t i) (fun i => i.val.val) + (fun i => i.property) (fun i => i.property) + (positiveSpectralWeights_sum _ (fun _ => measureReal_nonneg) (simpleFieldWeight_sum P s)) + (positiveSpectralWeights_sum _ (fun _ => measureReal_nonneg) (simpleFieldWeight_sum Q t)) + rw [← simpleField_law P s,← simpleField_law Q t,he] + +lemma simpleFieldValue_sub_le {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (s t : SimpleFunc Ω ℝ) : + simpleFieldValue P s (measureR (ν : Measure ℝ) b)- + simpleFieldValue P t (measureR (ν : Measure ℝ) b) ≤ ∫ x, |s x-t x| ∂P := by + have hh := finiteIndex_magnetic_sub_le P (simpleFieldPositiveIndex P s) + (simpleFieldPositiveIndex P t) (measurable_simpleFieldPositiveIndex P s) + (measurable_simpleFieldPositiveIndex P t) (fun i => i.val.val) (fun i => i.val.val) + (fun i => by rw [simpleFieldPositiveIndex_weight]; exact i.property) + ν a b hcompact hbound ha hb + have hsw := funext (simpleFieldPositiveIndex_weight P s) + have htw := funext (simpleFieldPositiveIndex_weight P t) + rw [hsw,htw] at hh + change simpleFieldValue P s _-simpleFieldValue P t _ ≤ _ at hh + convert hh using 1 + apply integral_congr_ae + filter_upwards [simpleFieldPositiveIndex_ae P s,simpleFieldPositiveIndex_ae P t] with x hs ht + rw [hs,ht] + +lemma simpleFieldValue_abs_sub_le {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (s t : SimpleFunc Ω ℝ) : + |simpleFieldValue P s (measureR (ν : Measure ℝ) b)- + simpleFieldValue P t (measureR (ν : Measure ℝ) b)| ≤ ∫ x, |s x-t x| ∂P := by + have h1 := simpleFieldValue_sub_le ν a b hcompact hbound ha hb P s t + have h2 := simpleFieldValue_sub_le ν a b hcompact hbound ha hb P t s + simp_rw [abs_sub_comm (t _) (s _)] at h2 + exact abs_le.mpr ⟨by linarith,h1⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldData.lean b/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldData.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6d7e6adc4158082b294ff687da13ead8d660048 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldData.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Core.FiniteIndexDistribution +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralPartition +import OAI.Probability.InvariantIsing.Spectral.MeasureMagneticTransport +import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp + +namespace OAI + +/-! A simple random field is represented using only its positive-mass values. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped BigOperators Classical +namespace InvariantIsing + +variable {Ω : Type*} [MeasurableSpace Ω] + +def simpleFieldIndex (s : SimpleFunc Ω ℝ) (x : Ω) : s.range := + ⟨s x,s.mem_range_self x⟩ + +lemma measurable_simpleFieldIndex (s : SimpleFunc Ω ℝ) : Measurable (simpleFieldIndex s) := + s.measurable.subtype_mk + +def simpleFieldWeight (P : Measure Ω) (s : SimpleFunc Ω ℝ) := + finiteIndexWeight P (simpleFieldIndex s) + +abbrev SimpleFieldPositive (P : Measure Ω) (s : SimpleFunc Ω ℝ) := + {i : s.range // 0 < simpleFieldWeight P s i} + +lemma simpleFieldWeight_sum (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) : + ∑ i, simpleFieldWeight P s i=1 := + finiteIndexWeight_sum P _ (measurable_simpleFieldIndex s) + +instance simpleFieldPositive_nonempty (P : Measure Ω) [IsProbabilityMeasure P] + (s : SimpleFunc Ω ℝ) : Nonempty (SimpleFieldPositive P s) := by + obtain ⟨i,hi⟩ := exists_pos_spectral_weight (fun _ => measureReal_nonneg) (simpleFieldWeight_sum P s) + exact ⟨⟨i,hi⟩⟩ + +def simpleFieldPositiveIndex (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) : + Ω → SimpleFieldPositive P s := + positiveSpectralLabel (simpleFieldWeight P s) (Classical.choice inferInstance) ∘ simpleFieldIndex s + +lemma measurable_simpleFieldPositiveIndex (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) : + Measurable (simpleFieldPositiveIndex P s) := + (measurable_of_finite _).comp (measurable_simpleFieldIndex s) + +def simpleFieldValue (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) + (R : ℝ → ℝ) : ℝ := + (finiteMagneticFunctional R (fun i : SimpleFieldPositive P s => simpleFieldWeight P s i) + (fun i => i.val.val)).toReal + +lemma simpleFieldPositiveIndex_weight (P : Measure Ω) [IsProbabilityMeasure P] + (s : SimpleFunc Ω ℝ) (i : SimpleFieldPositive P s) : + finiteIndexWeight P (simpleFieldPositiveIndex P s) i=simpleFieldWeight P s i := + positiveIndexWeight P (simpleFieldIndex s) _ i + +lemma simpleFieldPositiveIndex_ae (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) : + (fun x => (simpleFieldPositiveIndex P s x).val.val) =ᵐ[P] s := by + filter_upwards [ae_finiteIndexWeight_pos P (simpleFieldIndex s)] with x hx + change 0 < simpleFieldWeight P s (simpleFieldIndex s x) at hx + change (positiveSpectralLabel (simpleFieldWeight P s) _ (simpleFieldIndex s x)).val.val=s x + rw [positiveSpectralLabel,dite_eq_left hx] + rfl + +lemma simpleField_law (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) : + P.map s=finiteSpectralMeasure + (fun i : SimpleFieldPositive P s => simpleFieldWeight P s i) (fun i => i.val.val) := by + rw [← Measure.map_congr (simpleFieldPositiveIndex_ae P s)] + have hh := finiteIndex_map P _ (measurable_simpleFieldPositiveIndex P s) + (fun i : SimpleFieldPositive P s => i.val.val) + have hw : finiteIndexWeight P (simpleFieldPositiveIndex P s)= + (fun i : SimpleFieldPositive P s => simpleFieldWeight P s i) := funext (simpleFieldPositiveIndex_weight P s) + rw [hw] at hh + exact hh + +lemma simpleField_integrable (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) : + Integrable s P := by + apply s.integrable_of_isFiniteMeasure + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldTransport.lean b/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bda1d8ad7614a44118cdefe958817ec669d2dd5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SimpleFieldTransport.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Fields.FieldWasserstein + +namespace OAI + +/-! Comparing simple fields through an arbitrary joint law of their arguments. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +variable (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + +include hcompact hbound ha hb + +lemma simpleFieldValue_comp {Ω Ξ : Type*} [MeasurableSpace Ω] [MeasurableSpace Ξ] + (P : Measure Ω) (Q : Measure Ξ) [IsProbabilityMeasure P] [IsProbabilityMeasure Q] + (f : Ω → Ξ) (hf : Measurable f) (he : P.map f=Q) (s : SimpleFunc Ξ ℝ) : + simpleFieldValue P (s.comp f hf) (measureR (ν : Measure ℝ) b)= + simpleFieldValue Q s (measureR (ν : Measure ℝ) b) := by + apply simpleFieldValue_eq_of_map_eq ν a b hcompact hbound ha hb + change P.map (s ∘ f)=Q.map s + rw [← Measure.map_map s.measurable hf,he] + +lemma fieldCoupling_simple_error {μ ξ : ProbabilityMeasure ℝ} (p : FieldLawCoupling μ ξ) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) + (hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) (s t : SimpleFunc ℝ ℝ) : + |simpleFieldValue (μ : Measure ℝ) s (measureR (ν : Measure ℝ) b)- + simpleFieldValue (ξ : Measure ℝ) t (measureR (ν : Measure ℝ) b)| ≤ + (∫ x, |s x-x| ∂(μ : Measure ℝ))+ + (∫ xy, |xy.1-xy.2| ∂(p.law : Measure (ℝ × ℝ)))+ + (∫ y, |t y-y| ∂(ξ : Measure ℝ)) := by + let P := (p.law : Measure (ℝ × ℝ)) + let S : SimpleFunc (ℝ × ℝ) ℝ := s.comp Prod.fst measurable_fst + let T : SimpleFunc (ℝ × ℝ) ℝ := t.comp Prod.snd measurable_snd + have hS := simpleFieldValue_comp ν a b hcompact hbound ha hb P (μ : Measure ℝ) + Prod.fst measurable_fst p.fst s + have hT := simpleFieldValue_comp ν a b hcompact hbound ha hb P (ξ : Measure ℝ) + Prod.snd measurable_snd p.snd t + rw [← hS,← hT] + refine (simpleFieldValue_abs_sub_le ν a b hcompact hbound ha hb P S T).trans ?_ + have iS := ((simpleField_integrable P S).sub (p.integrable_fst hμ)).abs + have iM := ((p.integrable_fst hμ).sub (p.integrable_snd hξ)).abs + have iT := ((simpleField_integrable P T).sub (p.integrable_snd hξ)).abs + have eS : (∫ xy, |S xy-xy.1| ∂P)=∫ x, |s x-x| ∂(μ : Measure ℝ) := by + rw [← p.fst,integral_map measurable_fst.aemeasurable] + · rfl + · exact ((s.measurable.sub measurable_id).abs).aestronglyMeasurable + have eT : (∫ xy, |T xy-xy.2| ∂P)=∫ x, |t x-x| ∂(ξ : Measure ℝ) := by + rw [← p.snd,integral_map measurable_snd.aemeasurable] + · rfl + · exact ((t.measurable.sub measurable_id).abs).aestronglyMeasurable + have e1 := integral_add iS iM + have e2 := integral_add (iS.add iM) iT + dsimp only [Pi.add_apply,Pi.sub_apply] at e1 e2 + rw [← eS,← eT] + change (∫ xy, |S xy-T xy| ∂P) ≤ + (∫ xy, |S xy-xy.1| ∂P)+(∫ xy, |xy.1-xy.2| ∂P)+(∫ xy, |T xy-xy.2| ∂P) + rw [← e1,← e2] + apply integral_mono ((simpleField_integrable P S).sub (simpleField_integrable P T)).abs + ((iS.add iM).add iT) + intro xy + change |S xy-T xy| ≤ (|S xy-xy.1|+|xy.1-xy.2|)+|T xy-xy.2| + have h1 := abs_sub_le (S xy) xy.1 xy.2 + have h2 := abs_sub_le (S xy) xy.2 (T xy) + rw [abs_sub_comm xy.2 (T xy)] at h2 + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinCountMagnetization.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinCountMagnetization.lean new file mode 100644 index 0000000000000000000000000000000000000000..4edfda30afaa3f5be11d6685732ac8c86238d8f1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinCountMagnetization.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRoundedCount + +namespace OAI + +/-! The real magnetization associated with an attainable integer count. -/ +noncomputable section +namespace InvariantIsing + +def spinCountMagnetization (G k : ℕ) : ℝ := if G=0 then 0 else 2*(k:ℝ)/G-1 + +lemma spinCountMagnetization_bounds {G k : ℕ} (hk : k≤G) : + |spinCountMagnetization G k|≤1 := by + by_cases hG : G=0 + · simp [spinCountMagnetization,hG] + · have hp : (0:ℝ) linarith + have he : (k:ℝ)-(G:ℝ)*((1+q)/2)= + (G:ℝ)/2*(spinCountMagnetization G k-q) := by + rw [spinCountMagnetization_count hk] + ring + calc + _ ≤ |(k:ℝ)-(G:ℝ)*((1+q)/2)|+ + |(G:ℝ)*((1+q)/2)-(magneticRoundedCount G q:ℝ)| := abs_sub_le _ _ _ + _ ≤ (G:ℝ)/2*δ+1 := by + rw [he,abs_mul,abs_of_nonneg (by positivity : (0:ℝ)≤(G:ℝ)/2)] + exact add_le_add (mul_le_mul_of_nonneg_left hd (by positivity)) ha + _ = _ := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinCoverError.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinCoverError.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4ec2e316bf03fb4a8ba47a976bb796cc58de594 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinCoverError.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Fields.SpinFiniteCoverMean + +namespace OAI + +/-! Normalization of the finite-cover error and its dimension limit. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +lemma normalized_spinCover_error {N : ℕ} (hN : 0 (d k:ℝ)/(N k:ℝ)) atTop (𝓝 δ)) : + Tendsto (fun k => Q*Real.sqrt (B*K^2/(N k:ℝ))+ + (N k:ℝ)⁻¹*(Real.log Q+2*K*Real.sqrt ((N k:ℝ)*d k)+2*C*d k+t*d k)+ + Real.log (1+Real.exp (-t))) atTop + (𝓝 (2*K*Real.sqrt δ+(2*C+t)*δ+Real.log (1+Real.exp (-t)))) := by + have hn : Tendsto (fun k => (N k:ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp hNlim + have hsq : Tendsto (fun k => Q*Real.sqrt (B*K^2/(N k:ℝ))) atTop (𝓝 0) := by + simpa using (Real.continuous_sqrt.tendsto 0 |>.comp (tendsto_const_nhds.div_atTop hn)).const_mul (Q:ℝ) + have hlog : Tendsto (fun k => Real.log Q/(N k:ℝ)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop hn + have he := ((hsq.add hlog).add ((Real.continuous_sqrt.tendsto δ |>.comp hd).const_mul (2*K))).add + (hd.const_mul (2*C+t)) + have hh := he.add_const (Real.log (1+Real.exp (-t))) + simp only [zero_add] at hh + convert hh using 1 + ext k + dsimp only [Function.comp_apply] + linarith [normalized_spinCover_error (hN k) (d k) Q K C t] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinCoverParameters.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinCoverParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..d320a30e0f67d0ec20853c592890b7ac57e35548 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinCoverParameters.lean @@ -0,0 +1,33 @@ +import OAI.Probability.InvariantIsing.Fields.SpinCoverError + +namespace OAI + +/-! The geometric and fiber-count costs of a fine spin cover can both be made small. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +lemma exists_small_spinCover_error (K C : ℝ) {ε : ℝ} (hε : 0<ε) : + ∃ δ t : ℝ, 0<δ ∧ 0≤t ∧ + 2*K*Real.sqrt δ+(2*C+t)*δ+Real.log (1+Real.exp (-t))<ε := by + have he : Tendsto (fun n : ℕ => Real.exp (-(n:ℝ))) atTop (𝓝 0) := + Real.tendsto_exp_atBot.comp (tendsto_neg_atTop_atBot.comp tendsto_natCast_atTop_atTop) + have hl : Tendsto (fun n : ℕ => Real.log (1+Real.exp (-(n:ℝ)))) atTop (𝓝 0) := by + have hh : Tendsto (fun n : ℕ => 1+Real.exp (-(n:ℝ))) atTop (𝓝 1) := by + simpa using (tendsto_const_nhds (x := (1:ℝ))).add he + simpa only [Function.comp_def,Real.log_one] using (Real.continuousAt_log (by norm_num : (1:ℝ)≠0)).tendsto.comp hh + obtain ⟨n,hn⟩ := (hl.eventually (Iio_mem_nhds (half_pos hε))).exists + have hd := tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ) + have hf : Tendsto (fun j : ℕ => 2*K*Real.sqrt (1/(j+1:ℝ))+ + (2*C+(n:ℝ))*(1/(j+1:ℝ))) atTop (𝓝 0) := by + simpa [Function.comp_def] using ((Real.continuous_sqrt.tendsto 0 |>.comp hd).const_mul (2*K)).add + (hd.const_mul (2*C+(n:ℝ))) + obtain ⟨j,hj⟩ := (hf.eventually (Iio_mem_nhds (half_pos hε))).exists + exact ⟨1/(j+1:ℝ),(n:ℝ),by positivity,Nat.cast_nonneg n,by linarith⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinFactorization.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd50390e47188ef0578084d1951ec74cd29406b2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinFactorization.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Pressure.PressureMean + +namespace OAI + +/-! Exact factorization of the Ising reference at zero interaction. -/ + +noncomputable section + +open scoped BigOperators + +namespace InvariantIsing + +lemma sum_exp_fieldEnergy {N : ℕ} (c : Fin N → ℝ) : + (∑ σ : Spin N, Real.exp (fieldEnergy c σ)) = ∏ i, 2 * Real.cosh (c i) := by + simp only [fieldEnergy, Real.exp_sum] + rw [← Fintype.prod_sum (fun (i : Fin N) (b : Bool) => Real.exp (c i * spinValue b))] + apply Finset.prod_congr rfl + intro i _ + simp only [Fintype.sum_bool] + norm_num [spinValue, Real.cosh_eq] + ring + +/-- The site factorization used before the backward Gaussian cascade recursion. -/ +theorem logPartition_fieldEnergy {N : ℕ} (c : Fin N → ℝ) : + logPartition (fieldEnergy c) = ∑ i, Real.log (Real.cosh (c i)) := by + have hcard : (Fintype.card (Spin N) : ℝ) = ∏ _ : Fin N, (2 : ℝ) := by + simp [Spin] + have hc : (Fintype.card (Spin N) : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + rw [logPartition, sum_exp_fieldEnergy, Finset.prod_mul_distrib, ← hcard, + ← mul_assoc, inv_mul_cancel₀ hc, one_mul] + exact Real.log_prod (fun i _ => (Real.cosh_pos (c i)).ne') + +theorem noninteractingPressure_eq_logCosh {N : ℕ} (c : Fin N → ℝ) : + noninteractingPressure c = (N : ℝ)⁻¹ * ∑ i, Real.log (Real.cosh (c i)) := by + rw [noninteractingPressure, logPartition_fieldEnergy] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinFiniteCover.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinFiniteCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..fab62189969aa875a0acb69e49890c1b9e86a767 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinFiniteCover.lean @@ -0,0 +1,93 @@ +import OAI.Probability.InvariantIsing.Fields.SpinSliceComparison +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressure + +namespace OAI + +/-! Finite unions of spin constraints approximate the full partition function +with an explicit spin-projection error and a finite-union cost. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma sum_biUnion_le_sum_of_nonneg {X J : Type*} [DecidableEq X] + (B : Finset J) (S : J → Finset X) (f : X → ℝ) (hf : ∀ x, 0≤f x) : + ∑ x ∈ B.biUnion S, f x ≤ ∑ j ∈ B, ∑ x ∈ S j, f x := by + classical + induction B using Finset.induction_on with + | empty => simp + | @insert j B hj ih => + rw [Finset.biUnion_insert, Finset.sum_insert hj] + have hu := Finset.sum_union_inter (s₁ := S j) (s₂ := B.biUnion S) (f := f) + have hp : 0≤∑ x ∈ S j ∩ B.biUnion S, f x := + Finset.sum_nonneg (fun x _ => hf x) + linarith + +lemma restrictedSpinLog_finite_union_le {N : ℕ} {J : Type*} + (B : Finset J) (hB : B.Nonempty) (S : J → Finset (Spin N)) + (hS : ∀ j ∈ B, (S j).Nonempty) (H : Spin N → ℝ) (M : ℝ) + (hM : ∀ j ∈ B, restrictedSpinLog (S j) H ≤ M) : + restrictedSpinLog (B.biUnion S) H ≤ M+Real.log B.card := by + classical + have hU : (B.biUnion S).Nonempty := by + obtain ⟨j,hj⟩ := hB + obtain ⟨σ,hσ⟩ := hS j hj + exact ⟨σ, Finset.mem_biUnion.mpr ⟨j,hj,hσ⟩⟩ + have hsum (j : J) (hj : j∈B) : + (∑ σ ∈ S j, Real.exp (H σ)) ≤ Real.exp (M+N*Real.log 2) := by + have hp : 0<∑ σ ∈ S j, Real.exp (H σ) := + Finset.sum_pos (fun σ _ => Real.exp_pos _) (hS j hj) + have he := Real.exp_le_exp.mpr (show Real.log (∑ σ ∈ S j, Real.exp (H σ)) ≤ + M+N*Real.log 2 by have := hM j hj; unfold restrictedSpinLog at this; linarith) + rwa [Real.exp_log hp] at he + have hb : (0:ℝ) Real.exp_pos _) hU + have he : (∑ σ ∈ B.biUnion S, Real.exp (H σ)) ≤ + (B.card : ℝ)*Real.exp (M+N*Real.log 2) := by + apply (sum_biUnion_le_sum_of_nonneg B S (fun σ => Real.exp (H σ)) + (fun _ => (Real.exp_pos _).le)).trans + simpa using Finset.sum_le_sum hsum + have hl := Real.log_le_log hu he + rw [Real.log_mul hb.ne' (Real.exp_ne_zero _), Real.log_exp] at hl + unfold restrictedSpinLog + linarith + +lemma full_pressure_le_finite_cover {N : ℕ} (hN : 0 false), hf _⟩ + have hb := restricted_spin_pressure_map_le Finset.univ (B.biUnion S) + Finset.univ_nonempty hU f eig c U d hK hC ht heig hc + (fun σ _ => hf σ) (fun σ _ => hd σ) + have hm : ∀ j∈B, restrictedSpinLog (S j) + (fun σ => rotatedEnergy eig U σ+fieldEnergy c σ) ≤ N*M := by + intro j hj + have h := hM j hj + unfold restrictedRotatedPressure at h + exact (inv_mul_le_iff₀ (by exact_mod_cast hN : (0:ℝ) rotatedEnergy eig U σ+fieldEnergy c σ) ≤ + N*M+Real.log B.card+(2*K*Real.sqrt ((N:ℝ)*d)+2*C*d)+ + t*d+N*Real.log (1+Real.exp (-t)) := by linarith + have hh := mul_le_mul_of_nonneg_left hb' hi + change (N:ℝ)⁻¹*logPartition (fun σ => rotatedEnergy eig U σ+fieldEnergy c σ) ≤ _ + have hn : (N:ℝ)≠0 := Nat.cast_ne_zero.mpr hN.ne' + convert hh using 1 + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinFiniteCoverMean.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinFiniteCoverMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..b582eb6c23d28a8ae08bfd9fd1c3143c6cede1f6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinFiniteCoverMean.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Fields.SpinFiniteCover +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureFluctuation + +namespace OAI + +/-! Haar fluctuations allow a fixed finite spin cover to be used inside +the expectation of the full pressure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing + +theorem haar_finite_cover_mean_pressure_upper (hpub : HaarConcentrationInput) : + ∃ B : ℝ, 0 restrictedRotatedPressure (S j) eig (specialRotation U) c + let D := fun U => ∑ j∈Q, |F j U-∫ V, F j V ∂μ| + have hFi j (hj : j∈Q) : Integrable (F j) μ := + (hfluc N hN μ hμ hμinv (S j) (hS j hj) eig c K hK heig).1 + have hDi : Integrable D μ := by + exact integrable_finsetSum _ (fun j hj => ((hFi j hj).sub (integrable_const _)).abs) + have hD : (∫ U, D U ∂μ)≤Q.card*Real.sqrt (B*K^2/N) := by + change (∫ U, ∑ j∈Q, |F j U-∫ V, F j V ∂μ| ∂μ)≤_ + rw [integral_finsetSum _ (fun j hj => + (show Integrable (fun U => |F j U-∫ V, F j V ∂μ|) μ from + ((hFi j hj).sub (integrable_const _)).abs))] + calc + _ ≤ ∑ _j∈Q, Real.sqrt (B*K^2/N) := Finset.sum_le_sum (fun j hj => + (hfluc N hN μ hμ hμinv (S j) (hS j hj) eig c K hK heig).2) + _ = _ := by simp + have hi : Integrable (fun U => rotatedPressure eig (specialRotation U) c) μ := by + simpa only [restrictedRotatedPressure_univ] using + (hfluc N hN μ hμ hμinv Finset.univ Finset.univ_nonempty eig c K hK heig).1 + let E : ℝ := (N:ℝ)⁻¹*(Real.log Q.card+2*K*Real.sqrt ((N:ℝ)*d)+2*C*d+t*d)+ + Real.log (1+Real.exp (-t)) + have hp (U : SpecialOrthogonal N) : rotatedPressure eig (specialRotation U) c ≤ V+D U+E := by + have hm : ∀ j∈Q, restrictedRotatedPressure (S j) eig (specialRotation U) c≤V+D U := by + intro j hj + have hb : |F j U-∫ V, F j V ∂μ|≤D U := + Finset.single_le_sum (fun a _ => abs_nonneg (F a U-∫ V, F a V ∂μ)) hj + have ha := le_abs_self (F j U-∫ V, F j V ∂μ) + have hme := hmean j hj + change F j U≤V+D U + linarith + have hh := full_pressure_le_finite_cover (by omega) Q hQ S hS f d hf hd eig c + (specialRotation U) hK.le hC ht heig hc hm + simpa only [E,add_assoc] using hh + have hh := integral_mono hi (((integrable_const V).add hDi).add (integrable_const E)) hp + change (∫ U, rotatedPressure eig (specialRotation U) c ∂μ)≤∫ U, V+D U+E ∂μ at hh + rw [integral_add (f := fun U => V+D U) (g := fun _ => E) + ((integrable_const V).add hDi) (integrable_const E), + integral_add (f := fun _ => V) (g := D) (integrable_const V) hDi] at hh + simp only [integral_const,probReal_univ,one_smul] at hh + dsimp only [E] at hh + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupCountVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupCountVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c323bb955b5d2fb3e17e9af2b9290a36b852db7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupCountVariance.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Fields.SpinGroupProjectionMoment +import Mathlib.Probability.Moments.Variance + +namespace OAI + +/-! Count fluctuations under the independent canonical site law. The +result applies to the averaged Gaussian spin kernels as soon as their +bias equations give the prescribed group means. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators ProbabilityTheory + +namespace InvariantIsing + +def spinGroupCountSummand {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (i : Fin N) (b : Bool) : ℝ := + if group i = a ∧ b = true then 1 else 0 + +lemma sum_spinGroupCountSummand {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (σ : Spin N) : + (∑ i, spinGroupCountSummand group a i (σ i)) = spinGroupCount group σ a := by + simp [spinGroupCountSummand, spinGroupCount] + +lemma spinGroupCountSummand_memLp {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (i : Fin N) (μ : Measure Bool) [IsFiniteMeasure μ] : + MemLp (spinGroupCountSummand group a i) 2 μ := by + apply MemLp.of_bound (measurable_of_finite _).aestronglyMeasurable 1 + apply ae_of_all + intro b + simp only [spinGroupCountSummand] + split_ifs <;> norm_num + +lemma variance_spinGroupCountSummand_le {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (i : Fin N) (μ : Measure Bool) [IsProbabilityMeasure μ] : + Var[spinGroupCountSummand group a i; μ] ≤ if group i = a then (1 : ℝ) else 0 := by + rw [variance_eq_sub (spinGroupCountSummand_memLp group a i μ)] + have hi : (∫ b, (spinGroupCountSummand group a i b) ^ 2 ∂μ) ≤ + if group i = a then (1 : ℝ) else 0 := by + calc + _ ≤ ∫ _b, (if group i = a then (1 : ℝ) else 0) ∂μ := + integral_mono Integrable.of_finite (integrable_const _) (fun b => by + by_cases hg : group i = a <;> cases b <;> simp [spinGroupCountSummand, hg]) + _ = _ := by + have hu : μ.real Set.univ = 1 := by rw [measureReal_def, measure_univ]; norm_num + simp only [integral_const, hu, one_smul] + change (∫ b, (spinGroupCountSummand group a i b) ^ 2 ∂μ) - _ ≤ _ + linarith [sq_nonneg (∫ b, spinGroupCountSummand group a i b ∂μ)] + +theorem spinGroupCount_variance_le {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (μ : Fin N → Measure Bool) + [∀ i, IsProbabilityMeasure (μ i)] : + Var[fun σ : Spin N => (spinGroupCount group σ a : ℝ); Measure.pi μ] ≤ + spinGroupSize group a := by + have hf : (fun σ : Spin N => (spinGroupCount group σ a : ℝ)) = + ∑ i, fun σ : Spin N => spinGroupCountSummand group a i (σ i) := by + funext σ + simp only [Finset.sum_apply, sum_spinGroupCountSummand] + rw [hf, variance_sum_pi (fun i => spinGroupCountSummand_memLp group a i (μ i))] + calc + _ ≤ ∑ i, if group i = a then (1 : ℝ) else 0 := + Finset.sum_le_sum (fun i _ => variance_spinGroupCountSummand_le group a i (μ i)) + _ = _ := by simp [spinGroupSize] + +theorem spinGroupCount_centered_sq_le {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (μ : Fin N → Measure Bool) + [∀ i, IsProbabilityMeasure (μ i)] (k : ℕ) + (hmean : (∫ σ : Spin N, (spinGroupCount group σ a : ℝ) ∂Measure.pi μ) = k) : + (∫ σ : Spin N, ((spinGroupCount group σ a : ℝ) - k) ^ 2 ∂Measure.pi μ) ≤ + spinGroupSize group a := by + have hv := spinGroupCount_variance_le group a μ + rw [variance_eq_integral (measurable_of_finite _).aemeasurable, hmean] at hv + exact hv + +theorem spinGroupProjection_product_mean_distance {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (μ : Fin N → Measure Bool) + [∀ i, IsProbabilityMeasure (μ i)] + (hmean : ∀ a, (∫ σ : Spin N, (spinGroupCount group σ a : ℝ) ∂Measure.pi μ) = k a) : + (∫ σ : Spin N, (hammingDist σ (spinGroupProjection group k hk σ) : ℝ) ∂Measure.pi μ) ≤ + ∑ a, Real.sqrt (spinGroupSize group a) := by + simp_rw [spinGroupProjection_distance_real] + rw [integral_finsetSum _ (fun _ _ => Integrable.of_finite)] + apply Finset.sum_le_sum + intro a _ + exact (finite_integral_abs_le_sqrt_sq (Measure.pi μ) + (fun σ : Spin N => (spinGroupCount group σ a : ℝ) - k a)).trans + (Real.sqrt_le_sqrt (spinGroupCount_centered_sq_le group a μ (k a) (hmean a))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupFieldPressure.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupFieldPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..d25979900ad66e633aa5c2cad126415de65d75aa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupFieldPressure.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Cavity.ConsecutiveFieldPressure + +namespace OAI + +/-! The field contribution on a prescribed group slice is deterministic. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma restrictedRotatedPressure_group_field {N : ℕ} (hN : 0 b (group i)) = + restrictedRotatedPressure (spinGroupSlice group count) eig U (fun _ => 0)+ + ∑ a, γ a*b a*mag a := by + have hS := spinGroupSlice_nonempty group count hc + have hM := spinGroupFieldConstant_magnetization group count b γ mag hg hm + have hlog : restrictedSpinLog (spinGroupSlice group count) + (fun σ => rotatedEnergy eig U σ+fieldEnergy (fun i => b (group i)) σ) = + restrictedSpinLog (spinGroupSlice group count) (fun σ => rotatedEnergy eig U σ)+ + N*(∑ a, γ a*b a*mag a) := by + rw [← restrictedSpinLog_add_const _ hS] + unfold restrictedSpinLog + congr 2 + apply Finset.sum_congr rfl + intro σ hσ + dsimp only + rw [fieldEnergy_on_group_slice group count b hσ, hM] + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN.ne' + unfold restrictedRotatedPressure + rw [hlog] + simp only [fieldEnergy, zero_mul, Finset.sum_const_zero, add_zero] + field_simp + +lemma mean_restrictedRotatedPressure_group_field {N : ℕ} (hN : 0 + restrictedRotatedPressure (spinGroupSlice group count) eig (specialRotation U) (fun _ => 0)) μ) : + (∫ U, restrictedRotatedPressure (spinGroupSlice group count) eig + (specialRotation U) (fun i => b (group i)) ∂μ) = + (∫ U, restrictedRotatedPressure (spinGroupSlice group count) eig + (specialRotation U) (fun _ => 0) ∂μ)+(∑ a, γ a*b a*mag a) := by + simp_rw [restrictedRotatedPressure_group_field hN group count hc γ mag b hg hm] + rw [integral_add hi (integrable_const _), integral_const, probReal_univ, one_smul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupProjection.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..08508d5c632b789d0c5c7c42e11f67111b545e6a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupProjection.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Fields.SpinGroupSlice +import OAI.Probability.InvariantIsing.Fields.SpinSliceProjection + +namespace OAI + +/-! A nearest projection to all group constraints at once. Its number of +changed spins is exactly the sum of the group count discrepancies. -/ + +noncomputable section +open scoped BigOperators symmDiff + +namespace InvariantIsing + +lemma exists_subset_card_nearest {I : Type*} [DecidableEq I] (A S : Finset I) + (hAS : A ⊆ S) (k : ℕ) (hk : k ≤ S.card) : + ∃ T ⊆ S, T.card = k ∧ (A ∆ T).card = A.card - k + (k - A.card) := by + by_cases hka : k ≤ A.card + · obtain ⟨T, hTA, hT⟩ := Finset.exists_subset_card_eq hka + refine ⟨T, hTA.trans hAS, hT, ?_⟩ + rw [Finset.symmDiff_def, Finset.sdiff_eq_empty_iff_subset.mpr hTA, + Finset.union_empty, Finset.card_sdiff_of_subset hTA, hT, Nat.sub_eq_zero_of_le hka, + Nat.add_zero] + · have hak : A.card ≤ k := Nat.le_of_lt (Nat.lt_of_not_ge hka) + have hrem : k - A.card ≤ (S \ A).card := by + rw [Finset.card_sdiff_of_subset hAS] + omega + obtain ⟨B, hB, hBc⟩ := Finset.exists_subset_card_eq hrem + have hd : Disjoint A B := by + rw [Finset.disjoint_left] + intro i hiA hiB + exact (Finset.mem_sdiff.mp (hB hiB)).2 hiA + have hT : (A ∪ B).card = k := by + rw [Finset.card_union_of_disjoint hd, hBc] + omega + refine ⟨A ∪ B, Finset.union_subset hAS (hB.trans Finset.sdiff_subset), hT, ?_⟩ + rw [Finset.symmDiff_def, + Finset.sdiff_eq_empty_iff_subset.mpr Finset.subset_union_left, + Finset.empty_union, Finset.card_sdiff_of_subset Finset.subset_union_left, hT, + Nat.sub_eq_zero_of_le hak, Nat.zero_add] + +lemma exists_spin_group_projection {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) (σ : Spin N) : + ∃ τ ∈ spinGroupSlice group k, + hammingDist σ τ = ∑ a, ((spinGroupCount group σ a - k a) + + (k a - spinGroupCount group σ a)) := by + classical + let S := fun a => Finset.univ.filter (fun i => group i = a) + let P := fun a => Finset.univ.filter (fun i => group i = a ∧ σ i = true) + have hPS (a : A) : P a ⊆ S a := by + intro i hi + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (Finset.mem_filter.mp hi).2.1⟩ + choose T hT hcard hdist using fun a => exists_subset_card_nearest (P a) (S a) (hPS a) (k a) (hk a) + let τ : Spin N := fun i => decide (i ∈ T (group i)) + have hTa {a : A} {i : Fin N} (hi : i ∈ T a) : group i = a := + (Finset.mem_filter.mp (hT a hi)).2 + have hcount (a : A) : spinGroupCount group τ a = k a := by + have he : (Finset.univ.filter fun i => group i = a ∧ τ i = true) = T a := by + ext i + by_cases hi : group i = a + · simp [τ, hi] + · have hn : i ∉ T a := fun hm => hi (hTa hm) + simp [hi, hn] + exact (congrArg Finset.card he).trans (hcard a) + refine ⟨τ, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcount⟩, ?_⟩ + let D := Finset.univ.filter (fun i => σ i ≠ τ i) + have he (a : A) : D.filter (fun i => group i = a) = P a ∆ T a := by + ext i + by_cases hi : group i = a + · cases hσ : σ i <;> simp [D, P, τ, hi, hσ, Finset.mem_symmDiff] + · have hn : i ∉ T a := fun hm => hi (hTa hm) + simp [D, P, hi, hn, Finset.mem_symmDiff] + change D.card = _ + rw [Finset.card_eq_sum_card_fiberwise (s := D) (t := Finset.univ) + (f := group) (fun _ _ => Finset.mem_univ _)] + apply Finset.sum_congr rfl + intro a _ + rw [he, hdist] + rfl + +def spinGroupProjection {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (σ : Spin N) : Spin N := Classical.choose (exists_spin_group_projection group k hk σ) + +lemma spinGroupProjection_mem {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) (σ : Spin N) : + spinGroupProjection group k hk σ ∈ spinGroupSlice group k := + (Classical.choose_spec (exists_spin_group_projection group k hk σ)).1 + +lemma spinGroupProjection_distance {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) (σ : Spin N) : + hammingDist σ (spinGroupProjection group k hk σ) = + ∑ a, ((spinGroupCount group σ a - k a) + (k a - spinGroupCount group σ a)) := + (Classical.choose_spec (exists_spin_group_projection group k hk σ)).2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupProjectionMoment.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupProjectionMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..615e427eb866e71414603ca806fc5e7b7dca3de3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupProjectionMoment.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Fields.SpinGroupProjection +import OAI.Probability.InvariantIsing.Core.FiniteWeightedCauchy + +namespace OAI + +/-! The expected number of flips in the nearest group-slice projection. +The input consists of ordinary count variances, which can be checked +under the independent canonical site law. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma cast_nat_distance_eq_abs (a b : ℕ) : + (((a - b) + (b - a) : ℕ) : ℝ) = |(a : ℝ) - b| := by + by_cases h : b ≤ a + · rw [Nat.sub_eq_zero_of_le h, add_zero, Nat.cast_sub h, + abs_of_nonneg (sub_nonneg.mpr (Nat.cast_le.mpr h))] + · have h' : a ≤ b := (Nat.le_of_not_ge h) + rw [Nat.sub_eq_zero_of_le h', zero_add, Nat.cast_sub h', + abs_of_nonpos (sub_nonpos.mpr (Nat.cast_le.mpr h'))] + ring + +lemma spinGroupProjection_distance_real {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (σ : Spin N) : + (hammingDist σ (spinGroupProjection group k hk σ) : ℝ) = + ∑ a, |(spinGroupCount group σ a : ℝ) - k a| := by + rw [spinGroupProjection_distance, Nat.cast_sum] + apply Finset.sum_congr rfl + intro a _ + exact cast_nat_distance_eq_abs _ _ + +theorem spinGroupProjection_expected_distance {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (p : Spin N → ℝ) + (hp : ∀ σ, 0 ≤ p σ) (hpSum : ∑ σ, p σ = 1) : + (∑ σ, p σ * (hammingDist σ (spinGroupProjection group k hk σ) : ℝ)) ≤ + ∑ a, Real.sqrt (∑ σ, p σ * ((spinGroupCount group σ a : ℝ) - k a) ^ 2) := by + simp_rw [spinGroupProjection_distance_real, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro a _ + have hnonneg : 0 ≤ ∑ σ, p σ * |(spinGroupCount group σ a : ℝ) - k a| := + Finset.sum_nonneg (fun σ _ => mul_nonneg (hp σ) (abs_nonneg _)) + have he := finite_weighted_sum_abs_le_sqrt p + (fun σ => |(spinGroupCount group σ a : ℝ) - k a|) hp hpSum + simpa only [abs_of_nonneg hnonneg, sq_abs] using he + +theorem spinGroupProjection_expected_distance_le {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (p : Spin N → ℝ) + (hp : ∀ σ, 0 ≤ p σ) (hpSum : ∑ σ, p σ = 1) (V : A → ℝ) + (hV : ∀ a, (∑ σ, p σ * ((spinGroupCount group σ a : ℝ) - k a) ^ 2) ≤ V a) : + (∑ σ, p σ * (hammingDist σ (spinGroupProjection group k hk σ) : ℝ)) ≤ + ∑ a, Real.sqrt (V a) := + (spinGroupProjection_expected_distance group k hk p hp hpSum).trans + (Finset.sum_le_sum (fun a _ => Real.sqrt_le_sqrt (hV a))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupSlice.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupSlice.lean new file mode 100644 index 0000000000000000000000000000000000000000..63aaab217d61e4ad577c8bda8e5a1096eaa2a3d5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupSlice.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinLog + +namespace OAI + +/-! Finite magnetization slices for an arbitrary grouping of the sites. +Constant group fields factor exactly, with the original cube mass. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +def spinGroupSize {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) : ℕ := + (Finset.univ.filter fun i => group i = a).card + +def spinGroupCount {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (σ : Spin N) (a : A) : ℕ := + (Finset.univ.filter fun i => group i = a ∧ σ i = true).card + +def spinGroupSlice {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) : Finset (Spin N) := + Finset.univ.filter fun σ => ∀ a, spinGroupCount group σ a = k a + +lemma spinGroupSlice_nonempty {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) : + (spinGroupSlice group k).Nonempty := by + classical + choose S hS hcard using fun a => Finset.exists_subset_card_eq (hk a) + let σ : Spin N := fun i => decide (i ∈ S (group i)) + refine ⟨σ, Finset.mem_filter.mpr ⟨Finset.mem_univ _, fun a => ?_⟩⟩ + have he : (Finset.univ.filter fun i => group i = a ∧ σ i = true) = S a := by + ext i + constructor + · intro hi + obtain ⟨_, hga, hpos⟩ := Finset.mem_filter.mp hi + have hm : i ∈ S (group i) := of_decide_eq_true hpos + simpa only [hga] using hm + · intro hi + have hga : group i = a := (Finset.mem_filter.mp (hS a hi)).2 + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, hga, ?_⟩ + change decide (i ∈ S (group i)) = true + exact decide_eq_true (by simpa only [hga] using hi) + exact (congrArg Finset.card he).trans (hcard a) + +lemma sum_spinValue_eq_count {N : ℕ} (S : Finset (Fin N)) (σ : Spin N) : + (∑ i ∈ S, spinValue (σ i)) = + 2 * ((S.filter fun i => σ i = true).card : ℝ) - S.card := by + have hi (i : Fin N) : spinValue (σ i) = (if σ i = true then 2 else 0) - 1 := by + cases hσ : σ i <;> norm_num [spinValue] + simp_rw [hi] + rw [Finset.sum_sub_distrib] + simp [Finset.sum_ite, mul_comm] + +lemma fieldEnergy_group_counts {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (b : A → ℝ) (σ : Spin N) : + fieldEnergy (fun i => b (group i)) σ = + ∑ a, b a * (2 * (spinGroupCount group σ a : ℝ) - spinGroupSize group a) := by + rw [fieldEnergy, ← Finset.sum_fiberwise Finset.univ group] + apply Finset.sum_congr rfl + intro a _ + calc + _ = ∑ i ∈ Finset.univ.filter (fun i => group i = a), b a * spinValue (σ i) := by + apply Finset.sum_congr rfl + intro i hi + rw [(Finset.mem_filter.mp hi).2] + _ = b a * (∑ i ∈ Finset.univ.filter (fun i => group i = a), spinValue (σ i)) := + (Finset.mul_sum _ _ _).symm + _ = _ := by + rw [sum_spinValue_eq_count] + simp only [Finset.filter_filter, spinGroupCount, spinGroupSize] + +def spinGroupFieldConstant {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (b : A → ℝ) : ℝ := + ∑ a, b a * (2 * (k a : ℝ) - spinGroupSize group a) + +lemma fieldEnergy_on_group_slice {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (b : A → ℝ) {σ : Spin N} + (hσ : σ ∈ spinGroupSlice group k) : + fieldEnergy (fun i => b (group i)) σ = spinGroupFieldConstant group k b := by + have hk := (Finset.mem_filter.mp hσ).2 + rw [fieldEnergy_group_counts] + simp only [hk, spinGroupFieldConstant] + +lemma restrictedSpinLog_group_field {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (b : A → ℝ) (H : Spin N → ℝ) : + restrictedSpinLog (spinGroupSlice group k) (fun σ => H σ + fieldEnergy (fun i => b (group i)) σ) = + restrictedSpinLog (spinGroupSlice group k) H + spinGroupFieldConstant group k b := by + rw [← restrictedSpinLog_add_const _ (spinGroupSlice_nonempty group k hk)] + unfold restrictedSpinLog + congr 2 + apply Finset.sum_congr rfl + intro σ hσ + dsimp only + rw [fieldEnergy_on_group_slice group k b hσ] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupSliceComparison.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupSliceComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..33317c4d9ea9e054f91b230ed76395ab2c9f8130 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinGroupSliceComparison.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Fields.SpinGroupProjection +import OAI.Probability.InvariantIsing.Fields.SpinSliceComparison + +namespace OAI + +/-! Comparison of two attainable magnetization slices, with the precise +number of required spin flips summed over the field groups. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +def spinGroupCountDistance {A : Type*} [Fintype A] (k l : A → ℕ) : ℕ := + ∑ a, ((k a - l a) + (l a - k a)) + +lemma spinGroupCountDistance_comm {A : Type*} [Fintype A] (k l : A → ℕ) : + spinGroupCountDistance k l = spinGroupCountDistance l k := by + unfold spinGroupCountDistance + apply Finset.sum_congr rfl + intro a _ + omega + +lemma spinGroupProjection_from_slice {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k l : A → ℕ) (hl : ∀ a, l a ≤ spinGroupSize group a) + {σ : Spin N} (hσ : σ ∈ spinGroupSlice group k) : + hammingDist σ (spinGroupProjection group l hl σ) = spinGroupCountDistance k l := by + have hcount := (Finset.mem_filter.mp hσ).2 + rw [spinGroupProjection_distance] + simp only [hcount, spinGroupCountDistance] + +theorem abs_restricted_group_slice_sub_le {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k l : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (hl : ∀ a, l a ≤ spinGroupSize group a) + (eig c : Fin N → ℝ) (U : Rotation N) {K C t : ℝ} + (hK : 0 ≤ K) (hC : 0 ≤ C) (ht : 0 ≤ t) + (heig : ∀ i, |eig i| ≤ K) (hc : ∀ i, |c i| ≤ C) : + |restrictedSpinLog (spinGroupSlice group k) (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) - + restrictedSpinLog (spinGroupSlice group l) (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ)| ≤ + 2 * K * Real.sqrt ((N : ℝ) * spinGroupCountDistance k l) + + 2 * C * spinGroupCountDistance k l + t * spinGroupCountDistance k l + + N * Real.log (1 + Real.exp (-t)) := by + apply abs_restricted_spin_pressure_sub_le _ _ + (spinGroupSlice_nonempty group k hk) (spinGroupSlice_nonempty group l hl) + (spinGroupProjection group l hl) (spinGroupProjection group k hk) + eig c U (spinGroupCountDistance k l) hK hC ht heig hc + · exact fun σ _ => spinGroupProjection_mem group l hl σ + · exact fun σ hσ => (spinGroupProjection_from_slice group k l hl hσ).le + · exact fun σ _ => spinGroupProjection_mem group k hk σ + · intro σ hσ + rw [spinGroupProjection_from_slice group l k hk hσ, spinGroupCountDistance_comm] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinHammingBall.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinHammingBall.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6fb8857339a6ba561640a645b53746c752db252 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinHammingBall.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Fields.SpinSliceProjection +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinLog + +namespace OAI + +/-! Exponential bounds for Hamming balls and for the fibers of a +nearest-slice map. The bound is uniform over the target configuration. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +def spinHammingBall {N : ℕ} (τ : Spin N) (d : ℕ) : Finset (Spin N) := + Finset.univ.filter (fun σ => hammingDist σ τ ≤ d) + +lemma sum_exp_hamming {N : ℕ} (τ : Spin N) (t : ℝ) : + (∑ σ : Spin N, Real.exp (-t * (hammingDist σ τ : ℝ))) = + (1 + Real.exp (-t)) ^ N := by + classical + have he (σ : Spin N) : (hammingDist σ τ : ℝ) = + ∑ i, if σ i ≠ τ i then (1 : ℝ) else 0 := by + simp [hammingDist, Finset.sum_ite] + simp_rw [he, Finset.mul_sum, Real.exp_sum] + have hp := Fintype.prod_sum (fun (i : Fin N) (b : Bool) => + Real.exp (-t * (if b ≠ τ i then (1 : ℝ) else 0))) + rw [← hp] + have hi (i : Fin N) : (∑ b : Bool, Real.exp (-t * (if b ≠ τ i then (1 : ℝ) else 0))) = + 1 + Real.exp (-t) := by + cases τ i <;> simp [add_comm] + simp only [hi, Finset.prod_const, Finset.card_univ, Fintype.card_fin] + +lemma card_spinHammingBall_le {N : ℕ} (τ : Spin N) (d : ℕ) {t : ℝ} (ht : 0 ≤ t) : + ((spinHammingBall τ d).card : ℝ) ≤ + Real.exp (t * d) * (1 + Real.exp (-t)) ^ N := by + have hsum : ((spinHammingBall τ d).card : ℝ) ≤ + Real.exp (t * d) * ∑ σ : Spin N, Real.exp (-t * (hammingDist σ τ : ℝ)) := by + calc + _ = ∑ _σ ∈ spinHammingBall τ d, (1 : ℝ) := by simp + _ ≤ ∑ σ ∈ spinHammingBall τ d, + Real.exp (t * d) * Real.exp (-t * (hammingDist σ τ : ℝ)) := by + apply Finset.sum_le_sum + intro σ hσ + rw [← Real.exp_add] + apply Real.one_le_exp_iff.mpr + have hd : (hammingDist σ τ : ℝ) ≤ d := by + exact_mod_cast (Finset.mem_filter.mp hσ).2 + nlinarith + _ ≤ ∑ σ : Spin N, Real.exp (t * d) * Real.exp (-t * (hammingDist σ τ : ℝ)) := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) + (fun σ _ _ => (mul_pos (Real.exp_pos _) (Real.exp_pos _)).le) + _ = _ := (Finset.mul_sum _ _ _).symm + rwa [sum_exp_hamming] at hsum + +lemma spin_map_fiber_bound {N : ℕ} (S : Finset (Spin N)) (f : Spin N → Spin N) + (d : ℕ) {t : ℝ} (ht : 0 ≤ t) (hf : ∀ σ ∈ S, hammingDist σ (f σ) ≤ d) + (τ : Spin N) : + ((S.filter fun σ => f σ = τ).card : ℝ) ≤ + Real.exp (t * d) * (1 + Real.exp (-t)) ^ N := by + have hsub : (S.filter fun σ => f σ = τ) ⊆ spinHammingBall τ d := by + intro σ hσ + obtain ⟨hS, he⟩ := Finset.mem_filter.mp hσ + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, by simpa only [← he] using hf σ hS⟩ + exact (Nat.cast_le.mpr (Finset.card_le_card hsub)).trans (card_spinHammingBall_le τ d ht) + +lemma restrictedSpinLog_le_of_hamming_map {N : ℕ} (S T : Finset (Spin N)) + (hS : S.Nonempty) (hT : T.Nonempty) (f : Spin N → Spin N) + (H K : Spin N → ℝ) (c : ℝ) (d : ℕ) {t : ℝ} (ht : 0 ≤ t) + (hf : ∀ σ ∈ S, f σ ∈ T) (hd : ∀ σ ∈ S, hammingDist σ (f σ) ≤ d) + (hE : ∀ σ ∈ S, H σ ≤ K (f σ) + c) : + restrictedSpinLog S H ≤ restrictedSpinLog T K + c + + t * d + N * Real.log (1 + Real.exp (-t)) := by + have hpos : 0 < 1 + Real.exp (-t) := by positivity + have hh := restrictedSpinLog_le_of_map S T hS hT f H K c + (Real.exp (t * d) * (1 + Real.exp (-t)) ^ N) (by positivity) hf hE + (fun τ _ => spin_map_fiber_bound S f d ht hd τ) + rw [Real.log_mul (Real.exp_ne_zero _) (pow_pos hpos N).ne', + Real.log_exp, Real.log_pow] at hh + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinHammingEnergy.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinHammingEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..af714ee4d87dfd6682573c7156589c54d0f479c5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinHammingEnergy.lean @@ -0,0 +1,110 @@ +import OAI.Probability.InvariantIsing.Pressure.PressureLipschitz + +namespace OAI + +/-! The deterministic energy cost of changing a prescribed number of +spins. These bounds apply to the slice comparisons in the magnetic theorem. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma spinVector_sub_norm_sq {N : ℕ} (σ τ : Spin N) : + ‖spinVector σ - spinVector τ‖ ^ 2 = 4 * (hammingDist σ τ : ℝ) := by + classical + rw [EuclideanSpace.real_norm_sq_eq] + change (∑ i, (spinValue (σ i) - spinValue (τ i)) ^ 2) = _ + have hi (i : Fin N) : (spinValue (σ i) - spinValue (τ i)) ^ 2 = + if σ i ≠ τ i then 4 else 0 := by + cases hσ : σ i <;> cases hτ : τ i <;> norm_num [spinValue] + simp_rw [hi] + simp [hammingDist, Finset.sum_ite, mul_comm] + +lemma sum_abs_spinValue_sub {N : ℕ} (σ τ : Spin N) : + (∑ i, |spinValue (σ i) - spinValue (τ i)|) = 2 * (hammingDist σ τ : ℝ) := by + classical + have hi (i : Fin N) : |spinValue (σ i) - spinValue (τ i)| = + if σ i ≠ τ i then 2 else 0 := by + cases hσ : σ i <;> cases hτ : τ i <;> norm_num [spinValue] + simp_rw [hi] + simp [hammingDist, Finset.sum_ite, mul_comm] + +lemma abs_fieldEnergy_sub_spin_le {N : ℕ} (c : Fin N → ℝ) (σ τ : Spin N) + {C : ℝ} (hc : ∀ i, |c i| ≤ C) : + |fieldEnergy c σ - fieldEnergy c τ| ≤ 2 * C * (hammingDist σ τ : ℝ) := by + have he : fieldEnergy c σ - fieldEnergy c τ = + ∑ i, c i * (spinValue (σ i) - spinValue (τ i)) := by + simp only [fieldEnergy, mul_sub, Finset.sum_sub_distrib] + rw [he] + calc + _ ≤ ∑ i, |c i * (spinValue (σ i) - spinValue (τ i))| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i, C * |spinValue (σ i) - spinValue (τ i)| := by + apply Finset.sum_le_sum + intro i _ + rw [abs_mul] + exact mul_le_mul_of_nonneg_right (hc i) (abs_nonneg _) + _ = 2 * C * (hammingDist σ τ : ℝ) := by + rw [← Finset.mul_sum, sum_abs_spinValue_sub] + ring + +lemma abs_rotatedEnergy_sub_spin_le {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (σ τ : Spin N) {K : ℝ} (hK : 0 ≤ K) (heig : ∀ i, |eig i| ≤ K) : + |rotatedEnergy eig U σ - rotatedEnergy eig U τ| ≤ + 2 * K * Real.sqrt ((N : ℝ) * (hammingDist σ τ : ℝ)) := by + let x := U (spinVector σ) + let y := U (spinVector τ) + let D : ℝ := hammingDist σ τ + have hD : 0 ≤ D := Nat.cast_nonneg _ + have hx : ∑ i, x i ^ 2 = N := rotated_spin_sq_sum U σ + have hy : ∑ i, y i ^ 2 = N := rotated_spin_sq_sum U τ + have hm : (∑ i, (x i - y i) ^ 2) = 4 * D := by + calc + _ = ‖x - y‖ ^ 2 := by rw [EuclideanSpace.real_norm_sq_eq]; rfl + _ = 4 * D := by + change ‖U (spinVector σ) - U (spinVector τ)‖ ^ 2 = _ + rw [← U.map_sub, U.norm_map, spinVector_sub_norm_sq] + have hp : (∑ i, (x i + y i) ^ 2) ≤ 4 * (N : ℝ) := by + have hi := Finset.sum_le_sum (s := Finset.univ) (fun i _ => + show (x i + y i) ^ 2 ≤ 2 * x i ^ 2 + 2 * y i ^ 2 by + nlinarith [sq_nonneg (x i - y i)]) + simp only [Finset.sum_add_distrib, ← Finset.mul_sum, hx, hy] at hi + linarith + have hw : (∑ i, (eig i * (x i - y i)) ^ 2) ≤ K ^ 2 * (4 * D) := by + rw [← hm, Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + rw [mul_pow] + have hb : eig i ^ 2 ≤ K ^ 2 := by + simpa only [sq_abs] using (sq_le_sq₀ (abs_nonneg _) hK).mpr (heig i) + exact mul_le_mul_of_nonneg_right hb (sq_nonneg _) + have hcs := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ + (fun i => eig i * (x i - y i)) (fun i => x i + y i) + have hs : (∑ i, (eig i * (x i - y i)) * (x i + y i)) ^ 2 ≤ + (4 * K * Real.sqrt ((N : ℝ) * D)) ^ 2 := by + calc + _ ≤ (∑ i, (eig i * (x i - y i)) ^ 2) * ∑ i, (x i + y i) ^ 2 := hcs + _ ≤ (K ^ 2 * (4 * D)) * (4 * (N : ℝ)) := + mul_le_mul hw hp (Finset.sum_nonneg fun i _ => sq_nonneg _) (by positivity) + _ = _ := by rw [mul_pow, Real.sq_sqrt (by positivity)]; ring + have ha : |∑ i, (eig i * (x i - y i)) * (x i + y i)| ≤ + 4 * K * Real.sqrt ((N : ℝ) * D) := by + apply (sq_le_sq₀ (abs_nonneg _) (by positivity)).mp + simpa only [sq_abs] using hs + have he : rotatedEnergy eig U σ - rotatedEnergy eig U τ = + (1 / 2 : ℝ) * ∑ i, (eig i * (x i - y i)) * (x i + y i) := by + rw [rotatedEnergy, rotatedEnergy, ← mul_sub, ← Finset.sum_sub_distrib] + change (1 / 2 : ℝ) * (∑ i, (eig i * x i ^ 2 - eig i * y i ^ 2)) = _ + congr 1 + apply Finset.sum_congr rfl + intro i _ + ring + rw [he, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2)] + exact (mul_le_mul_of_nonneg_left ha (by norm_num)).trans_eq (by dsimp [D]; ring) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPairSubGaussian.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPairSubGaussian.lean new file mode 100644 index 0000000000000000000000000000000000000000..36cd259816c8077210132c3885e32b42bd81c964 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPairSubGaussian.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Pressure.EntropyMeanComparison +import OAI.Probability.InvariantIsing.Fields.FieldPairProductLaw + +namespace OAI + +/-! The independent canonical site-pair law supplies the dimension-sharp +concentration bound needed in constrained magnetic replacement. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +def spinPairSiteValue (p : Bool × Bool) : ℝ := spinValue p.1 * spinValue p.2 + +def spinPairSiteSum {N : ℕ} (u : Fin N → Bool × Bool) : ℝ := ∑ j, spinPairSiteValue (u j) + +lemma spinPairSiteValue_bounds (p : Bool × Bool) : spinPairSiteValue p ∈ Set.Icc (-1) 1 := by + rcases p with ⟨a,b⟩ + cases a <;> cases b <;> norm_num [spinPairSiteValue, spinValue] + +lemma spinPairSiteSum_subgaussian {N : ℕ} (ν : Fin N → Measure (Bool × Bool)) + [∀ i, IsProbabilityMeasure (ν i)] : + HasSubgaussianMGF (fun u => spinPairSiteSum u - ∑ j, ∫ p, spinPairSiteValue p ∂ν j) + (N : ℝ≥0) (Measure.pi ν) := by + let X := fun j p => spinPairSiteValue p - ∫ q, spinPairSiteValue q ∂ν j + have hi := iIndepFun_pi (μ := ν) (X := X) + (fun _ => (measurable_of_finite _).aemeasurable) + have hg (j : Fin N) : HasSubgaussianMGF (fun u : Fin N → Bool × Bool => X j (u j)) 1 + (Measure.pi ν) := by + apply HasSubgaussianMGF.of_map (X := X j) (μ := Measure.pi ν) (c := 1) + (measurePreserving_eval ν j).measurable.aemeasurable + rw [(measurePreserving_eval ν j).map_eq] + have hs := hasSubgaussianMGF_of_mem_Icc (μ := ν j) (X := spinPairSiteValue) + (measurable_of_finite _).aemeasurable (Filter.Eventually.of_forall spinPairSiteValue_bounds) + norm_num at hs + exact hs + have hs := HasSubgaussianMGF.sum_of_iIndepFun hi (s := Finset.univ) (c := fun _ => 1) + (fun j _ => hg j) + simpa only [X, spinPairSiteSum, Finset.sum_sub_distrib, Finset.sum_const, + Finset.card_univ, Fintype.card_fin, nsmul_one] using hs + +lemma spinPairSiteSum_entropy_bound {N : ℕ} (μ : Measure (Fin N → Bool × Bool)) + [IsProbabilityMeasure μ] (ν : Fin N → Measure (Bool × Bool)) + [∀ i, IsProbabilityMeasure (ν i)] (hK : klDiv μ (Measure.pi ν) ≠ ⊤) + {t : ℝ} (ht : 0 < t) : + |(∫ u, spinPairSiteSum u ∂μ) - ∑ j, ∫ p, spinPairSiteValue p ∂ν j| ≤ + (klDiv μ (Measure.pi ν)).toReal / t + N * t / 2 := by + have hk := klDiv_ne_top_iff.mp hK + have he := entropy_subgaussian_mean μ (Measure.pi ν) hk.1 hk.2 + (fun u => spinPairSiteSum u - ∑ j, ∫ p, spinPairSiteValue p ∂ν j) + Integrable.of_finite (spinPairSiteSum_subgaussian ν) ht + simpa only [integral_sub Integrable.of_finite (integrable_const _), integral_const, + measureReal_def, measure_univ, ENNReal.toReal_one, one_smul, NNReal.coe_natCast] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..fae66547259ab22cefbf8ece49175f46438336d7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayDiagonal.lean @@ -0,0 +1,109 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayLaw +import OAI.Probability.InvariantIsing.Fields.SpinPriorKernelDiagonal + +namespace OAI + +/-! Actual spectral-array diagonals and compact centers for constrained priors. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +lemma spinPriorObservableAverage_mono {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (D E : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hE : Measurable (Function.uncurry E)) + {B C : ℝ} (hDb : ∀ U x, |D U x| ≤ B) (hEb : ∀ U x, |E U x| ≤ C) + (hDE : ∀ U x, D U x ≤ E U x) : + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h D ≤ + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h E := by + apply integral_mono + (spinPriorObservableAverage_integrable μ π eig c I degree amplitude n b r h D hD hDb) + (spinPriorObservableAverage_integrable μ π eig c I degree amplitude n b r h E hE hEb) + intro p + apply integral_mono + (Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable B + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using hDb p.1.1 x)) + (Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable C + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using hEb p.1.1 x)) + exact hDE p.1.1 + +lemma spinPriorSpectralDiagonal_clipping {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (a : Fin m) (center : ℝ) : + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - spectralDiagonalCenter center|) ≤ + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center|) := by + exact spinPriorObservableAverage_mono μ π b eig c I degree amplitude r h _ _ + (measurable_spectralDiagonalDeviation (I a) n _) (measurable_spectralDiagonalDeviation (I a) n _) + (fun U x => spectralDiagonalDeviation_abs_le (specialRotation U) (I a) _ x.1) + (fun U x => spectralDiagonalDeviation_abs_le (specialRotation U) (I a) _ x.1) + (fun U x => abs_sub_spectralDiagonalCenter_le + ⟨projectedOverlap_self_nonneg _ _ _, projectedOverlap_self_le_one _ _ _⟩ center) + +theorem spinPriorArrayLaw_observable_test {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (F : SpectralArray (m + 1) → ℝ) (hF : Continuous F) + (D : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) (i : ℕ) + (he : ∀ (U : SpecialOrthogonal N) (σ : ℕ → Spin N × LabeledLeaf n), + F (fun ij : ℕ × ℕ => spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2)) = D U (σ i)) : + (∫ x, F x ∂(spinPriorArrayLaw μ π eig c I degree amplitude n b r h : + Measure (SpectralArray (m + 1)))) = + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h D := by + rw [spinPriorArrayLaw, spectralArrayLaw_integral _ _ _ _ _ _ _ F hF] + unfold spinPriorObservableAverage + apply integral_congr_ae + filter_upwards [] with p + let ν := spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p + have ht := integral_map (measurable_pi_apply i).aemeasurable + (μ := Measure.infinitePi (fun _ : ℕ => ν)) (measurable_of_countable (D p.1.1)).aestronglyMeasurable + rw [Measure.infinitePi_map_eval] at ht + change (∫ σ, F (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation p.1.1) I n (σ ij.1) (σ ij.2)) + ∂Measure.infinitePi (fun _ : ℕ => ν)) = ∫ x, D p.1.1 x ∂ν + simp_rw [he] + exact ht.symm + +theorem spinPriorArrayLaw_spectralDiagonal {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (i : ℕ) (a : Fin m) (center : ℝ) : + (∫ x, |(x (i, i) a.castSucc : ℝ) - center| + ∂(spinPriorArrayLaw μ π eig c I degree amplitude n b r h : Measure (SpectralArray (m + 1)))) = + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center|) := by + apply spinPriorArrayLaw_observable_test μ π b eig c I degree amplitude r h _ + (by fun_prop) _ i + intro U σ + rw [spectralJointEntry_spectral] + +lemma spinPriorArrayLaw_treeDiagonal {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (i : ℕ) : + (∫ x, |(x (i, i) (Fin.last m) : ℝ) - (n : ℝ) / (n + 1 : ℕ)| + ∂(spinPriorArrayLaw μ π eig c I degree amplitude n b r h : Measure (SpectralArray (m + 1)))) = 0 := by + calc + _ = spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h (fun _ _ => 0) := by + apply spinPriorArrayLaw_observable_test μ π b eig c I degree amplitude r h _ + (by fun_prop) _ i + intro U σ + rw [spectralJointEntry_tree, treeOverlap_self, sub_self, abs_zero] + _ = 0 := by unfold spinPriorObservableAverage; simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayDiagonalWard.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayDiagonalWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..c64963e1638de46c733940fc418435b4ea3d8789 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayDiagonalWard.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorPrincipalWard +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayLaw +import OAI.Probability.InvariantIsing.Spectral.SpectralDiagonalWardLimits +import OAI.Probability.InvariantIsing.Arrays.TensorArrayDiagonalWard + +namespace OAI + +/-! The actual enriched diagonal Ward bound is exactly the corresponding +spectral-array residual, retaining the common rotation in both replicas. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology NNReal + +namespace InvariantIsing + +lemma spinPriorArrayLaw_diagonalWard_residual {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) + (κ : Fin m → ℝ) (a d : Fin m) + (ha : ∀ i ∈ I a, eig i = κ a) (hd : ∀ i ∈ I d, eig i = κ d) : + spectralDiagonalWardResidual (spinPriorArrayLaw μ π eig c I degree amp n b treeDegree h) + (fun j => ((I j).card : ℝ) / N) κ a d = + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (tensorDiagonalDirect eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) - + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (tensorDiagonalFresh eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) := by + let ρ := fun j => ((I j).card : ℝ) / N + let Q := spinPriorArrayLaw μ π eig c I degree amp n b treeDegree h + have hdir : (∫ x, spectralDiagonalWardDirect ρ κ a d x ∂(Q : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (tensorDiagonalDirect eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) := by + apply spinPriorArrayLaw_test μ π eig c I degree amp n b treeDegree h + _ (continuous_spectralDiagonalWardDirect ρ κ a d) _ + (fun i : Fin 1 => i.val) Fin.val_injective + intro U σ + rw [tensorDiagonalDirect_eq_block eig (I a) (I d) (κ a) (κ d) ha hd] + simp only [spectralDiagonalWardDirect, tensorDiagonalBlockDirect, spectralJointEntry_spectral, ρ, Fin.val_zero] + ring + have hfresh : (∫ x, spectralDiagonalWardFresh κ a d x ∂(Q : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (tensorDiagonalFresh eig (I a) (I d) (Prod.fst : Spin N × LabeledLeaf n → Spin N)) := by + apply spinPriorArrayLaw_test μ π eig c I degree amp n b treeDegree h + _ (continuous_spectralDiagonalWardFresh κ a d) _ + (fun i : Fin 2 => i.val) Fin.val_injective + intro U σ + rw [tensorDiagonalFresh_eq_block eig (I a) (I d) (κ a) (κ d) ha hd] + simp only [spectralDiagonalWardFresh, tensorDiagonalBlockFresh, spectralJointEntry_spectral, Fin.val_zero, Fin.val_one] + ring + rw [spectralDiagonalWardResidual_integral Q ρ κ a d, hdir, hfresh] + +/-- Exact finite-volume spectral-array diagonal Ward bound for the actual +tensor-enriched law, before taking any overlap limit. -/ +theorem spinPriorArrayLaw_diagonalWard_bound {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin N → Fin m → ℕ) (treeDegree : Fin N → ℕ) + (u : Fin N → ℝ) (hu : ∀ r, |u r| ≤ 2) (D : ℝ) (hD : 0 ≤ D) + (hdegree : ∀ r, (∑ j, (degree r j : ℝ)) ≤ D * ((r : ℝ) + 1)) + (b h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (κ : Fin m → ℝ) (a d : Fin m) (had : Disjoint (I a) (I d)) + (ha : ∀ i ∈ I a, eig i = κ a) (hd : ∀ i ∈ I d, eig i = κ d) : + |spectralDiagonalWardResidual + (spinPriorArrayLaw μ π eig c I degree (tensorPerturbationAmplitude N u) n b treeDegree h) + (fun j => ((I j).card : ℝ) / N) κ a d| ≤ 48 * D * perturbationScale N ^ 2 := by + rw [spinPriorArrayLaw_diagonalWard_residual μ π eig c I degree (tensorPerturbationAmplitude N u) + b treeDegree h κ a d ha hd] + exact spinPrior_diagonal_principal_bound hN μ π eig c I degree treeDegree u hu D hD hdegree + b h hh h0 (I a) (I d) had + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..86259bcd320a23b921ee62f8411ac23e7a8bf504 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayLaw.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralReplicaLaw +import OAI.Probability.InvariantIsing.Fields.SpinPriorReplicaAverage + +namespace OAI + +/-! Finite-replica tests of the actual tensor spectral-array law. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology + +namespace InvariantIsing + +def spinPriorArrayLaw {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : + ProbabilityMeasure (SpectralArray (m + 1)) := + spectralArrayLaw ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) + (fun p : TensorFlatDisorder N n => p.1.1) measurable_fst.fst I n + (spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h) + (measurable_spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h) + +/-- Injection into the infinite replica sequence gives the exact actual +finite-replica mean, while retaining its common rotation. -/ +theorem spinPriorArrayLaw_test {N m k z : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (F : SpectralArray (m + 1) → ℝ) (hF : Continuous F) + (D : SpecialOrthogonal N → (Fin z → Spin N × LabeledLeaf n) → ℝ) + (ι : Fin z → ℕ) (hi : Function.Injective ι) + (he : ∀ (U : SpecialOrthogonal N) (σ : ℕ → Spin N × LabeledLeaf n), F (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2)) = D U (fun i => σ (ι i))) : + (∫ x, F x ∂(spinPriorArrayLaw μ π eig c I degree amplitude n b r h : + Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h D := by + rw [spinPriorArrayLaw, spectralArrayLaw_integral _ _ _ _ _ _ _ F hF] + unfold spinPriorReplicaAverage + simp only [referenceReplicaMean_zero] + apply integral_congr_ae + filter_upwards [] with p + have hm : Measurable (fun σ : ℕ → Spin N × LabeledLeaf n => fun i : Fin z => σ (ι i)) := + Measurable.of_eval fun i => measurable_pi_apply (ι i) + let ν := spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p + have ht := integral_map hm.aemeasurable (μ := Measure.infinitePi (fun _ : ℕ => ν)) + (measurable_of_countable (D p.1.1)).aestronglyMeasurable + rw [replica_injective_map ν ι hi] at ht + change (∫ σ, F (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation p.1.1) I n (σ ij.1) (σ ij.2)) + ∂Measure.infinitePi (fun _ : ℕ => ν)) = ∫ σ, D p.1.1 σ ∂Measure.pi (fun _ : Fin z => ν) + simp_rw [he] + exact ht.symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayResidual.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..98281d16febfb1ea81d11b29cb098680c8f6f7fc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayResidual.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayLaw +import OAI.Probability.InvariantIsing.Fields.SpinPriorFiniteGG +import OAI.Probability.InvariantIsing.Arrays.TensorArrayResidual + +namespace OAI + +/-! Exact equality of the constrained finite-model and spectral-array GG residuals. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +/-- Common rotation is retained in every finite test; arbitrary replica +indices are handled by injective sampling, not by independence of rotations. -/ +theorem spinPriorArrayLaw_residual {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (e : Equiv.Perm (Fin (q + 1))) (D : SpectralBlock (m + 1) (q + 1) → ℝ) (hD : Continuous D) : + spectralMonomialResidual (spinPriorArrayLaw μ π eig c I degree amplitude n b r h) + (q + 1) (e 0) D (Fin.lastCases (r j) (degree j)) = + spinPriorSpectralGGResidual μ π b eig c I degree amplitude r h j + (permutedSpectralBlockTest I n e D) := by + classical + let L := spinPriorArrayLaw μ π eig c I degree amplitude n b r h + let d : Fin (m + 1) → ℕ := Fin.lastCases (r j) (degree j) + let D' := permutedSpectralBlockTest I n e D + let κ := spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) I (degree j) n (r j) + have hcD : Continuous (fun x => D (spectralBlockView (m + 1) (q + 1) x)) := + hD.comp (continuous_spectralBlockView _ _) + have hmono : Continuous (spectralEntryMonomial d) := continuous_spectralEntryMonomial d + have hnew : (∫ x, D (spectralBlockView (m + 1) (q + 1) x) * + spectralEntryMonomial d (x (e 0, q + 1)) ∂(L : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h + (fun U (τ : Fin (q + 1 + 1) → Spin N × LabeledLeaf n) => + D' U (Fin.tail τ) * κ U ((Fin.tail τ) 0) (τ 0)) := by + apply spinPriorArrayLaw_test μ π eig c I degree amplitude n b r h + _ (hcD.mul (hmono.comp (continuous_apply _))) _ + (newReplicaEmbedding (q + 1) e) (newReplicaEmbedding_injective _ e) + intro U σ + simp only [Pi.mul_apply, Function.comp_apply, newReplicaEmbedding, Fin.cases_zero, Fin.cases_succ, Fin.tail] + change D (spectralBlockView (m + 1) (q + 1) (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2))) * + spectralEntryMonomial d (spectralJointEntry (specialRotation U) I n (σ (e 0)) (σ (q + 1))) = + D' U (fun i => σ (e i)) * κ U (σ (e 0)) (σ (q + 1)) + rw [show D' U (fun i => σ ((e i).val)) = + D (spectralBlockView (m + 1) (q + 1) (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2))) from + permutedSpectralBlockTest_embedding I n e D U σ] + simp only [spectralJointEntry_selectedMonomial, d, κ] + have hblock : (∫ x, D (spectralBlockView (m + 1) (q + 1) x) + ∂(L : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h D' := by + apply spinPriorArrayLaw_test μ π eig c I degree amplitude n b r h _ hcD D' + (fun i => (e i).val) (Fin.val_injective.comp e.injective) + intro U σ + exact (permutedSpectralBlockTest_embedding I n e D U σ).symm + have hpair : (∫ x, spectralEntryMonomial d (x (0, 1)) + ∂(L : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h + (fun U (τ : Fin 2 → Spin N × LabeledLeaf n) => κ U (τ 1) (τ 0)) := by + refine spinPriorArrayLaw_test μ π eig c I degree amplitude n b r h _ + (hmono.comp (continuous_apply _)) _ ![1, 0] ?_ ?_ + · intro a b hab + fin_cases a <;> fin_cases b <;> simp_all + · intro U σ + exact spectralJointEntry_selectedMonomial U I n (σ 0) (σ 1) (degree j) (r j) + have hsum : (∑ a ∈ Finset.univ.erase (e 0), ∫ x, + D (spectralBlockView (m + 1) (q + 1) x) * spectralEntryMonomial d (x (e 0, a)) + ∂(L : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h + (fun U σ => D' U σ * ∑ l : Fin q, κ U (σ 0) (σ l.succ)) := by + have hI (a : Fin (q + 1)) : Integrable + (fun x : SpectralArray (m + 1) => D (spectralBlockView (m + 1) (q + 1) x) * + spectralEntryMonomial d (x (e 0, a))) (L : Measure (SpectralArray (m + 1))) := + compact_integrable (hcD.mul (hmono.comp (continuous_apply _))) + rw [← integral_finsetSum _ (fun a _ => hI a)] + apply spinPriorArrayLaw_test μ π eig c I degree amplitude n b r h + _ (continuous_finsetSum _ fun a _ => hcD.mul (hmono.comp (continuous_apply _))) _ + (fun i => (e i).val) (Fin.val_injective.comp e.injective) + intro U σ + rw [show D' U (fun i => σ ((e i).val)) = + D (spectralBlockView (m + 1) (q + 1) (fun ij : ℕ × ℕ => + spectralJointEntry (specialRotation U) I n (σ ij.1) (σ ij.2))) from + permutedSpectralBlockTest_embedding I n e D U σ] + rw [sum_nonzero_permutation e (fun a => κ U (σ (e 0)) (σ a)), Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + simp only [Pi.mul_apply, Function.comp_apply, d, spectralJointEntry_selectedMonomial, κ] + unfold spectralMonomialResidual + rw [hnew, hblock, hpair, hsum] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayResidualBound.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayResidualBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8e7c2f29b63eaa87204ca319db76519de258187 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayResidualBound.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorMinimumBounds +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayResidual +import OAI.Probability.InvariantIsing.Arrays.TensorGGRate + +namespace OAI + +/-! Uniform GG residual bounds for the actual constrained-prior array. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +theorem spinPriorPerturbation_arrayResidual_bound (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let L := 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n)))+H+4+C*(K+4*m+8)^2 + perturbationScale N≤1/32 → contactStep N≤1/4 → + (∀ u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + spinPriorPerturbationObjective (n := n) μ π eig c I b t h u v≤ spinPriorPerturbationObjective (n := n) μ π eig c I b t h u' v') → + ∀ j : Fin N, ∀ q : ℕ, ∀ i : Fin (q+1), + ∀ D : SpectralBlock (m+1) (q+1) → ℝ, Continuous D → + ∀ B : ℝ, 0≤B → (∀ x, |D x|≤B) → + |spectralMonomialResidual + (spinPriorArrayLaw μ π (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) n b r h) + (q+1) i D (Fin.lastCases (r j) (d j))|≤tensorContactGGRate N j m L B := by + obtain ⟨C,hC,hgg⟩ := spinPriorPerturbation_minimum_bounds hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n π hπ b hb eig c K hK heig I u hu v hv t ht h hh h0 H hH d r L + he hs hmin j q i D hD B hB hDb + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure π := hπ + let e := Equiv.swap 0 i + have hg := (hgg N hN μ hμ hμinv m n π hπ b hb eig c K hK heig I u hu v hv t ht h hh h0 H hH + he hs hmin).2 j q B hB (permutedSpectralBlockTest I n e D) + (measurable_permutedSpectralBlockTest I n e D hD) (fun U σ => hDb _) + have hr := spinPriorArrayLaw_residual (n := n) μ π b (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) r h j e D hD + have hei : e 0=i := Equiv.swap_apply_left 0 i + rw [hei] at hr + rw [hr] + exact hg + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayWard.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..617d15bac0834ade5dcb291ea1a849d4cce43750 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorArrayWard.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorPrincipalWard +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayLaw +import OAI.Probability.InvariantIsing.Arrays.TensorArrayWard + +namespace OAI +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma spinPriorArrayLaw_off_direct {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (b h : ℕ → ℝ) (treeDegree : Fin k → ℕ) + (κ : Fin m → ℝ) (a b₀ : Fin m) + (ha : ∀ i ∈ I a, eig i = κ a) (hb : ∀ i ∈ I b₀, eig i = κ b₀) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) : + (∫ x, spectralOffWardDirect (fun a => (I a).card / (N : ℝ)) κ a b₀ Φ x + ∂(spinPriorArrayLaw μ π eig c I degree amp n b treeDegree h : Measure _)) = + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun U => tensorOffDirect eig (I a) (I b₀) (fun s : Spin N × LabeledLeaf n => s.1) + (fun σ τ => Φ (spinPairOverlap σ τ)) U) := by + apply spinPriorArrayLaw_test μ π eig c I degree amp n b treeDegree h _ + (continuous_spectralOffWardDirect _ _ _ _ Φ hΦ) _ Fin.val Fin.val_injective + intro U σ + rw [tensorOffDirect_eq_block eig (I a) (I b₀) (κ a) (κ b₀) ha hb] + simp only [spectralOffWardDirect, spectralSpinArray_joint (specialRotation U) I hdis hcover, + spectralJointEntry_spectral, tensorOffBlockDirect] + rfl + +lemma spinPriorArrayLaw_off_fresh {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (b h : ℕ → ℝ) (treeDegree : Fin k → ℕ) + (κ : Fin m → ℝ) (a b₀ : Fin m) + (ha : ∀ i ∈ I a, eig i = κ a) (hb : ∀ i ∈ I b₀, eig i = κ b₀) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) : + (∫ x, spectralOffWardFresh κ a b₀ Φ x + ∂(spinPriorArrayLaw μ π eig c I degree amp n b treeDegree h : Measure _)) = + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun U => tensorOffFresh eig (I a) (I b₀) (fun s : Spin N × LabeledLeaf n => s.1) + (fun σ τ => Φ (spinPairOverlap σ τ)) U) := by + apply spinPriorArrayLaw_test μ π eig c I degree amp n b treeDegree h _ + (continuous_spectralOffWardFresh _ _ _ Φ hΦ) _ Fin.val Fin.val_injective + intro U σ + rw [tensorOffFresh_eq_block eig (I a) (I b₀) (κ a) (κ b₀) ha hb] + simp only [spectralOffWardFresh, spectralSpinArray_joint (specialRotation U) I hdis hcover, + spectralJointEntry_spectral, tensorOffBlockFresh] + rfl + + theorem spinPriorArrayLaw_off_ward_bound {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin N → Fin m → ℕ) (treeDegree : Fin N → ℕ) + (u : Fin N → ℝ) (hu : ∀ r, |u r| ≤ 2) (D : ℝ) (hD : 0 ≤ D) + (hdegree : ∀ r, (∑ a, (degree r a : ℝ)) ≤ D * ((r : ℝ) + 1)) + (b h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (κ : Fin m → ℝ) (a b₀ : Fin m) (hJK : Disjoint (I a) (I b₀)) + (ha : ∀ i ∈ I a, eig i = κ a) (hb : ∀ i ∈ I b₀, eig i = κ b₀) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) (B : ℝ) (hB : 0 ≤ B) (hΦB : ∀ r, |Φ r| ≤ B) : + |spectralOffWardResidual + (spinPriorArrayLaw μ π eig c I degree (tensorPerturbationAmplitude N u) n b treeDegree h) + (fun a => (I a).card / (N : ℝ)) κ a b₀ Φ| ≤ 192 * B * D * perturbationScale N ^ 2 := by + rw [spectralOffWardResidual_eq_direct_fresh _ _ _ _ _ Φ hΦ, + spinPriorArrayLaw_off_direct μ π eig c I hdis hcover degree _ b h treeDegree κ a b₀ ha hb Φ hΦ, + spinPriorArrayLaw_off_fresh μ π eig c I hdis hcover degree _ b h treeDegree κ a b₀ ha hb Φ hΦ] + exact spinPrior_off_principal_bound hN μ π eig c I degree treeDegree u hu D hD hdegree + b h hh h0 (I a) (I b₀) hJK (fun σ τ => Φ (spinPairOverlap σ τ)) B hB + (fun σ τ => hΦB (spinPairOverlap σ τ)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorCascadeAverage.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorCascadeAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..284aada779bdba5e7c68a239444bb7a28ef79566 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorCascadeAverage.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorCascadePressure +import OAI.Probability.InvariantIsing.Fields.PriorFieldDerivative + +namespace OAI + +/-! The quenched cascade pressure is exactly the average of the fixed-leaf +prior pressures. The logarithm remains inside the cascade average. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +lemma spinPriorMeanPressure_prior_average + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m k n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) : + Integrable (fun T => priorNamespacedMeanPressure μ (labeledSpinReference n π T) + eig c I degree amp r h) (labeledCascadeLaw n b : Measure (LabeledTree n)) ∧ + spinPriorMeanPressure (n := n) μ π eig c I degree amp b r h = + ∫ T, priorNamespacedMeanPressure μ (labeledSpinReference n π T) eig c I degree amp r h + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) := by + let τ := (labeledCascadeLaw n b : Measure (LabeledTree n)) + let F := spinPriorNamespacedLog (n := n) π eig c I degree amp r h + let G := fun q : SpecialOrthogonal N × LabeledTree n => ∫ z, F (q,z) ∂gaussianCoordinates + have hF : Integrable F ((μ.prod τ).prod gaussianCoordinates) := + spinPriorNamespacedLog_integrable μ π eig c I degree amp b r h hh h0 + have hG : Integrable G (μ.prod τ) := hF.integral_prod_left + have he T : (∫ U, G (U,T) ∂μ) = + ∫ p, priorNamespacedLog (labeledSpinReference n π T) eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates := by + exact (integral_prod _ (priorNamespacedLog_integrable hhaar hgauss hN μ hμ + (labeledSpinReference n π T) eig c I degree amp (fun i => varianceIncrement h i) + (fun i j => varianceIncrement (monomialPath n (r j)) i))).symm + have hraw : (∫ p, F p ∂(μ.prod τ).prod gaussianCoordinates) = + ∫ T, ∫ p, priorNamespacedLog (labeledSpinReference n π T) eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) p ∂μ.prod gaussianCoordinates ∂τ := by + rw [integral_prod _ hF] + change (∫ q, G q ∂μ.prod τ) = _ + rw [integral_prod _ hG, integral_integral_swap hG] + simp_rw [he] + have hi : Integrable (fun T => ∫ p, priorNamespacedLog (labeledSpinReference n π T) + eig c I degree amp (fun i => tensorPathProfile I degree n r h i) p + ∂μ.prod gaussianCoordinates) τ := by + exact hG.swap.integral_prod_left.congr (ae_of_all _ he) + refine ⟨(hi.const_mul (N : ℝ)⁻¹).sub (integrable_const _),?_⟩ + unfold spinPriorMeanPressure priorNamespacedMeanPressure + change (N : ℝ)⁻¹*(∫ p, F p ∂(μ.prod τ).prod gaussianCoordinates)-h n/2 = _ + rw [hraw, integral_sub (hi.const_mul _) (integrable_const _), integral_const_mul, + integral_const, probReal_univ, one_smul] + +lemma spinPriorNamespacedLog_uniform {N m k n : ℕ} + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (p : TensorFlatDisorder N n) : + spinPriorNamespacedLog (uniformSpinPrior N : Measure (Spin N)) eig c I degree amp r h p = + tensorNamespacedLog eig c I degree amp n r h p := rfl + +lemma spinPriorMeanPressure_uniform {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : + spinPriorMeanPressure (n := n) μ (uniformSpinPrior N : Measure (Spin N)) eig c I degree amp b r h = + tensorNamespacedMeanPressure μ eig c I degree amp n b r h := by + unfold spinPriorMeanPressure tensorNamespacedMeanPressure tensorNamespacedPressure + simp_rw [spinPriorNamespacedLog_uniform,integral_const_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorCascadePressure.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorCascadePressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..bdc4e8af767f4b7418bfdd12204d4a1811caa263 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorCascadePressure.lean @@ -0,0 +1,126 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorFieldDerivativeIntegrability +import OAI.Probability.InvariantIsing.Fields.PriorTemperatureCGF +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure + +namespace OAI + +/-! The actual cascade-enriched pressure for a deterministic spin prior. +Normalized magnetization slices are allowed, while the cascade remains +quenched and is averaged only after taking the logarithm. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +def spinPriorNamespacedLog {N m k n : ℕ} (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (p : TensorFlatDisorder N n) : ℝ := + priorNamespacedLog (labeledSpinReference n π p.1.2) eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) (p.1.1,p.2) + +def spinPriorNamespacedReference {N m k n : ℕ} (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (p : TensorFlatDisorder N n) : Measure (Spin N × LabeledLeaf n) := + priorNamespacedReference (labeledSpinReference n π p.1.2) eig c I degree amp + (fun i => tensorPathProfile I degree n r h i) (p.1.1,p.2) + +def spinPriorMeanPressure {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : ℝ := + (N : ℝ)⁻¹*(∫ p, spinPriorNamespacedLog π eig c I degree amp r h p + ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates)-h n/2 + +lemma measurable_spinPriorNamespacedLog {N m k n : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : + Measurable (spinPriorNamespacedLog (n := n) π eig c I degree amp r h) := by + have hν : Measurable (fun p : TensorFlatDisorder N n => labeledSpinReference n π p.1.2) := + (measurable_labeledSpinReference_general n π).comp measurable_fst.snd + exact (measurable_random_referencePartition hν + (measurable_tensorNamespacedHamiltonian eig c I degree amp n r h)).log + +lemma measurable_spinPriorNamespacedReference {N m k n : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : + Measurable (spinPriorNamespacedReference (n := n) π eig c I degree amp r h) := by + have hν : Measurable (fun p : TensorFlatDisorder N n => labeledSpinReference n π p.1.2) := + (measurable_labeledSpinReference_general n π).comp measurable_fst.snd + exact measurable_gibbsProbability hν (measurable_tensorNamespacedHamiltonian eig c I degree amp n r h) + +instance spinPriorNamespacedReference_probability {N m k n : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (p : TensorFlatDisorder N n) : + IsProbabilityMeasure (spinPriorNamespacedReference π eig c I degree amp r h p) := by + unfold spinPriorNamespacedReference + infer_instance + +lemma spinPriorDeterministicLog_abs_le {N n : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (ω : SpecialOrthogonal N × LabeledTree n) : + |Real.log (∫ x : Spin N × LabeledLeaf n, Real.exp + (tensorDeterministicEnergy eig c n ω x) ∂labeledSpinReference n π ω.2)| ≤ + (∑ i, |eig i|)*N/2+∑ i, |c i| := by + let ν := labeledSpinReference n π ω.2 + let H := tensorDeterministicEnergy eig c n ω + have hH : Integrable (fun x => Real.exp (H x)) ν := finite_spin_base_exp_integrable ν + (fun σ => rotatedEnergy eig (specialRotation ω.1) σ+fieldEnergy c σ) + have hbound (x : Spin N × LabeledLeaf n) : |H x| ≤ (∑ i, |eig i|)*N/2+∑ i, |c i| := by + have he := abs_rotatedEnergy_le eig (specialRotation ω.1) (∑ i, |eig i|) + (fun i => Finset.single_le_sum (fun j _ => abs_nonneg (eig j)) (Finset.mem_univ i)) x.1 + have hf : |fieldEnergy c x.1| ≤ ∑ i, |c i| := by + simpa only [fieldEnergy,zero_mul,Finset.sum_const_zero,sub_zero] using + abs_fieldEnergy_sub_le c (fun _ => 0) x.1 + exact (abs_add_le _ _).trans (add_le_add he hf) + have hb := logMean_abs_sub_le ν (F := H) (G := fun _ => 0) (b := 1) (by norm_num) + (by simpa only [one_mul] using hH) + (by simpa only [mul_zero,Real.exp_zero] using (integrable_const (1 : ℝ))) + (fun x => by simpa only [sub_zero] using hbound x) + simpa only [logMean,one_mul,div_one,Real.exp_zero,integral_const,probReal_univ, + one_smul,Real.log_one,sub_zero] using hb + +lemma spinPriorDeterministicLog_integrable {N n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) (b : ℕ → ℝ) : + Integrable (fun ω : SpecialOrthogonal N × LabeledTree n => Real.log + (∫ x, Real.exp (tensorDeterministicEnergy eig c n ω x) ∂labeledSpinReference n π ω.2)) + (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))) := by + have hν : Measurable (fun ω : SpecialOrthogonal N × LabeledTree n => labeledSpinReference n π ω.2) := + (measurable_labeledSpinReference_general n π).comp measurable_snd + apply integrable_of_measurable_abs_le + (c := (∑ i, |eig i|)*N/2+∑ i, |c i|) + ((measurable_random_referencePartition hν (measurable_tensorDeterministicEnergy eig c n)).log) + exact spinPriorDeterministicLog_abs_le π eig c + +theorem spinPriorNamespacedLog_integrable {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) : + Integrable (spinPriorNamespacedLog (n := n) π eig c I degree amp r h) + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) := by + have hν : Measurable (fun ω : SpecialOrthogonal N × LabeledTree n => labeledSpinReference n π ω.2) := + (measurable_labeledSpinReference_general n π).comp measurable_snd + exact randomCoefficient_log_partition_integrable hν (tensorDeterministicEnergy eig c n) + (measurable_tensorDeterministicEnergy eig c n) + (fun ω => finite_spin_base_exp_integrable (labeledSpinReference n π ω.2) + (fun σ => rotatedEnergy eig (specialRotation ω.1) σ+fieldEnergy c σ)) + (spinPriorDeterministicLog_integrable μ π eig c b) + (fun ω => tensorNamespacedCoefficients (specialRotation ω.1) I degree amp n + (fun i => tensorPathProfile I degree n r h i)) + (measurable_tensorNamespacedPathFields I degree amp n r h) + (fun ω x => tensorNamespacedPath_variance_le (specialRotation ω.1) I degree amp n r h hh h0 x) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContact.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContact.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a90a02086d24592b603616b053d86307a9bbf27 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContact.lean @@ -0,0 +1,92 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorCascadeAverage +import OAI.Probability.InvariantIsing.Fields.PriorContactField +import OAI.Probability.InvariantIsing.Core.ContactModulus + +namespace OAI + +/-! Joint continuity for the actual cascade-enriched spin-prior contact +pressure, with the quenched cascade retained in the pressure integral. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def spinPriorContactPressure {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (p : TensorContactParameter N m n) : ℝ := + spinPriorMeanPressure (n := n) μ π (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + b (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + +lemma spinPriorContactPressure_prior_average + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (p : TensorContactParameter N m n) (hp : ∀ i, 0 ≤ p.2.1 i) : + Integrable (fun T => priorContactPressure μ (labeledSpinReference n π T) eig c I p) + (labeledCascadeLaw n b : Measure (LabeledTree n)) ∧ + spinPriorContactPressure μ π eig c I b p = + ∫ T, priorContactPressure μ (labeledSpinReference n π T) eig c I p + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) := by + have h := spinPriorMeanPressure_prior_average (n := n) hhaar hgauss hN μ hμ π + (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + b (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (monotone_finiteFieldPath hp) (finiteFieldPath_nonneg hp 0) + simpa only [spinPriorContactPressure,priorContactPressure_eq_namespaced] using h + +lemma spinPriorContactPressure_modulus + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (p q : TensorContactParameter N m n) + (hp : ∀ i, 0 ≤ p.2.1 i) (hq : ∀ i, 0 ≤ q.2.1 i) : + |spinPriorContactPressure μ π eig c I b p-spinPriorContactPressure μ π eig c I b q| ≤ + contactModulus K p q := by + obtain ⟨hi,he⟩ := spinPriorContactPressure_prior_average hhaar hgauss hN μ hμ π eig c I b p hp + obtain ⟨hj,hf⟩ := spinPriorContactPressure_prior_average hhaar hgauss hN μ hμ π eig c I b q hq + rw [he,hf,← integral_sub hi hj] + have hn := norm_integral_le_of_norm_le_const + (μ := (labeledCascadeLaw n b : Measure (LabeledTree n))) + (f := fun T => priorContactPressure μ (labeledSpinReference n π T) eig c I p- + priorContactPressure μ (labeledSpinReference n π T) eig c I q) + (C := contactModulus K p q) + (ae_of_all _ fun T => by + have hb := priorContactPressure_modulus hhaar hgauss hN μ hμ (labeledSpinReference n π T) + eig c I K hK p q hp hq + simpa only [Real.norm_eq_abs] using hb) + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hn + +theorem continuousOn_spinPriorContactPressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) {S : Set (TensorContactParameter N m n)} + (hS : ∀ p ∈ S, ∀ i, 0 ≤ p.2.1 i) : + ContinuousOn (spinPriorContactPressure μ π eig c I b) S := by + rw [continuousOn_iff_continuous_domRestrict] + apply continuous_iff_continuousAt.mpr + intro q + apply tendsto_iff_norm_sub_tendsto_zero.mpr + have hD : Continuous (fun p : S => contactModulus K p.val q.val) := + (continuous_contactModulus K q.val).comp continuous_subtype_val + apply squeeze_zero' (Eventually.of_forall fun _ => norm_nonneg _) + (Eventually.of_forall fun p => by + simpa only [Real.norm_eq_abs,domRestrict_apply] using + spinPriorContactPressure_modulus hhaar hgauss hN μ hμ π eig c I b K hK p.val q.val + (hS p.val p.property) (hS q.val q.property)) + simpa only [contactModulus_self] using hD.tendsto q + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactContradiction.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactContradiction.lean new file mode 100644 index 0000000000000000000000000000000000000000..36d804defd0149a53828bb6dd8758af3c50c31e6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactContradiction.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactTailOrder +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactTemperature +import OAI.Probability.InvariantIsing.Arrays.TensorSingleObservable +import OAI.Probability.InvariantIsing.Fields.SpinPriorEnergyLimit +import OAI.Probability.InvariantIsing.Spectral.SpectralContactContradiction + +namespace OAI + +/-! At an actual positive-temperature contact minimum, the field directions +and temperature direction contradict the identified limiting energy. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem spinPriorContact_limit_contradiction + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (δ S H : ℝ) (hδ : 0 < δ) + (p : (k : ℕ) → TensorContactParameter (N k) m n) + (hp : ∀ k, p k ∈ tensorContactRegion (N k) m n H) + (hmin : ∀ k q, q ∈ tensorContactRegion (N k) m n H → + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) S + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) (p k) ≤ + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) S + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) q) + (hcap : ∀ k, (∑ i, (p k).2.1 i) < H) + (hpos : ∀ k, 0 < (p k).1) + (t : ℝ) (ht : Tendsto (fun k => (p k).1) atTop (𝓝 t)) + (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hL : Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) (chainExponent cut) (eig k) (c k) (I k) + (p k).2.2.1 (p k).2.2.2 (p k).1 (finiteFieldPath (p k).2.1)) + atTop (𝓝 Q)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) : False := by + have ht0 : 0 ≤ t := ge_of_tendsto' ht (fun k => (hpos k).le) + have hh k := monotone_finiteFieldPath (tensorContactRegion_bounds (hp k)).2.1 + have h0 k := finiteFieldPath_nonneg (tensorContactRegion_bounds (hp k)).2.1 0 + have hu k j : |(p k).2.2.1 j| ≤ 2 := by + have h := (tensorContactRegion_bounds (hp k)).2.2.2.1 j + rw [abs_of_nonneg (by linarith [h.1] : 0 ≤ (p k).2.2.1 j)] + exact h.2 + have hv k a : |(p k).2.2.2 a| ≤ 2 := by + have h := (tensorContactRegion_bounds (hp k)).2.2.2.2 a + rw [abs_of_nonneg (by linarith [h.1] : 0 ≤ (p k).2.2.2 a)] + exact h.2 + obtain ⟨hP, hn, henergy⟩ := spinPriorPerturbedArrayLaw_interactionEnergy_limit N hN hNlim m n + μ hμinv π (chainExponent cut) eig c I hdis hcover lam hlam + (fun k => (p k).2.2.1) hu (fun k => (p k).2.2.2) hv + (fun k => (p k).1) ht (fun k => finiteFieldPath (p k).2.1) + hh h0 Q hL ρ hρpos hρsum hρ hgg q hq hd ht0 + have htail := spinPriorContact_limit_tail_order N hN m n μ π eig c I hdis hcover + cut hc hfirst hlast trial values hvalues S + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) + H p hp hmin hcap Q hL hgg q hq hd hP hn + apply spectralContact_contradiction ρ lam hρpos hρsum + (spectralSpinQuantilePath Q hP hn) trial hδ ht0 (fun k => (p k).1) _ ht henergy _ htail + apply Filter.Eventually.of_forall + intro k + have he := spinPriorContact_minimum_energy_gap (hN k) (μ k) (π k) (chainExponent cut) (eig k) (c k) (I k) + (fun i => (cut i.succ - cut i.castSucc) * values i) + ρ lam hρpos hρsum trial δ S H (p k) (hp k) (hmin k) (hpos k) K (heig k) + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactField.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactField.lean new file mode 100644 index 0000000000000000000000000000000000000000..f12326275d23c88f55416a812001d78f00ef4d09 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactField.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactMinimum +import OAI.Probability.InvariantIsing.Fields.SpinPriorFieldDerivativeMean +import OAI.Probability.IsingPerceptron.TimeIncrement + +namespace OAI + +/-! The field-coordinate inequality at the actual joint minimum. Tied and +zero covariance levels are allowed; only the upper cap must be inactive. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +def spinPriorContactFieldObjective {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : Fin N → ℝ) (v : Fin m → ℝ) + (t : ℝ) (b : ℕ → ℝ) (w : Fin (n + 1) → ℝ) (h : ℕ → ℝ) : ℝ := + -spinPriorMeanPressure (n := n) μ π (diagonalPerturbedEigenvalues eig I v t) c I + (fun j => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + b (fun j => enumeratedTreeDegree m j) h - (∑ i, w i * h i) / 2 + +theorem spinPriorContactFieldObjective_right_derivative {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : Fin N → ℝ) (v : Fin m → ℝ) + (t : ℝ) (b : ℕ → ℝ) (w : Fin (n + 1) → ℝ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt + (fun a => spinPriorContactFieldObjective μ π eig c I u v t b w (fun i => h i + a * g i)) + (spinPriorReplicaAverage μ π (diagonalPerturbedEigenvalues eig I v t) c I + (fun j => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + n b (fun j => enumeratedTreeDegree m j) h + (fun _ => tensorFieldPairObservable g) / 2 - (∑ i, w i * g i) / 2) (Ici 0) 0 := by + have hd := spinPriorMeanPressure_field_right_derivative hN μ π + (diagonalPerturbedEigenvalues eig I v t) c I (fun j => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N u) n b (fun j => enumeratedTreeDegree m j) h g hh h0 hg g0 + have hs : HasDerivAt (fun a : ℝ => ∑ i : Fin (n + 1), w i * (h i + a * g i)) + (∑ i, w i * g i) 0 := by + simpa only [one_mul, id_eq] using HasDerivAt.fun_sum + (fun (i : Fin (n + 1)) (_ : i ∈ Finset.univ) => + (((hasDerivAt_id (0 : ℝ)).mul_const (g i)).const_add (h i)).const_mul (w i)) + convert! hd.fun_neg.fun_sub (hs.div_const 2).hasDerivWithinAt using 1 + simp only [neg_div, neg_neg] + +theorem spinPriorContact_minimum_field_cone {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) (w : Fin (n + 1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) (p : TensorContactParameter N m n) + (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + spinPriorContactObjective μ π eig c I b w S V p ≤ spinPriorContactObjective μ π eig c I b w S V q) + (hcap : (∑ i, p.2.1 i) < H) (d : Fin (n + 1) → ℝ) (hd : ∀ i, 0 ≤ d i) : + (∑ i, w i * finiteFieldPath d i) ≤ + spinPriorReplicaAverage μ π (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) c I + (fun j => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) + n b (fun j => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun _ => tensorFieldPairObservable (finiteFieldPath d)) := by + obtain ⟨ht, ha, hsum, hu, hv⟩ := tensorContactRegion_bounds hp + have hder := spinPriorContactFieldObjective_right_derivative hN μ π eig c I p.2.2.1 p.2.2.2 + p.1 b w (finiteFieldPath p.2.1) (finiteFieldPath d) + (monotone_finiteFieldPath ha) (finiteFieldPath_nonneg ha 0) + (monotone_finiteFieldPath hd) (finiteFieldPath_nonneg hd 0) + have hfeas : ∀ᶠ a in 𝓝[>] (0 : ℝ), (∑ i, p.2.1 i) + a * (∑ i, d i) < H := by + have hc : ContinuousAt (fun a : ℝ => (∑ i, p.2.1 i) + a * (∑ i, d i)) 0 := by fun_prop + exact (hc.eventually (gt_mem_nhds (by simpa only [zero_mul, add_zero] using hcap))).filter_mono + nhdsWithin_le_nhds + have hnon := right_derivative_nonneg_of_min hder (by + filter_upwards [hfeas, self_mem_nhdsWithin] with a hafeas ha0 + have hnew : (p.1, (fun i => p.2.1 i + a * d i), p.2.2.1, p.2.2.2) ∈ + tensorContactRegion N m n H := tensorContactRegion_mem ht + (fun i => add_nonneg (ha i) (mul_nonneg ha0.le (hd i))) + (by simpa only [Finset.sum_add_distrib, Finset.mul_sum] using hafeas.le) hu hv + have hm := hmin _ hnew + simp only [spinPriorContactObjective, spinPriorContactPressure, finiteFieldPath_add, + finiteFieldPath_const_mul] at hm + simp only [spinPriorContactFieldObjective, zero_mul, add_zero] + linarith) + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactGG.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d32071176dea51d77b2d4a2f063e19781c73574 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactGG.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactMinimum +import OAI.Probability.InvariantIsing.Fields.SpinPriorGeometricLimit + +namespace OAI + +/-! Geometric GG limits at the same joint constrained-prior contact minima. +The perturbation parameters are not reselected after minimizing temperature +and field, so subsequent contact inequalities refer to this same sequence. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem spinPriorContact_minimizers_have_GG_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (b : ℕ → ℝ) (hb : CascadeExponents n b) + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 < K) + (heig : ∀ k i, |eig k i| ≤ K) (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (w : Fin (n+1) → ℝ) (S : ℝ) (V : ℝ → ℝ) (H : ℝ) + (p : (k : ℕ) → TensorContactParameter (N k) m n) + (hp : ∀ k, p k ∈ tensorContactRegion (N k) m n H) + (hmin : ∀ k q, q ∈ tensorContactRegion (N k) m n H → + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) b w S V (p k) ≤ + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) b w S V q) : + ∃ Q : ProbabilityMeasure (SpectralArray (m+1)), + ∃ q : Fin (m+1) → Icc (0 : ℝ) 1, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ (φ k)) (π (φ k)) b + (eig (φ k)) (c (φ k)) (I (φ k)) + (p (φ k)).2.2.1 (p (φ k)).2.2.2 (p (φ k)).1 (finiteFieldPath (p (φ k)).2.1)) + atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) := by + have hbounds k := tensorContactRegion_bounds (hp k) + have ht k : |(p k).1| ≤ 1 := by + rw [abs_of_nonneg (hbounds k).1.1] + exact (hbounds k).1.2 + have hh k : Monotone (finiteFieldPath (p k).2.1) := monotone_finiteFieldPath (hbounds k).2.1 + have h0 k : 0 ≤ finiteFieldPath (p k).2.1 0 := finiteFieldPath_nonneg (hbounds k).2.1 0 + have hcap k : finiteFieldPath (p k).2.1 n ≤ H := by + rw [finiteFieldPath_last] + exact (hbounds k).2.2.1 + exact spinPrior_minimizers_geometric_GG_limit hhaar hgauss N hN hNlim m n μ hμinv π b hb + eig c K hK heig I (fun k => (p k).1) ht (fun k => finiteFieldPath (p k).2.1) hh h0 H hcap + (fun k => (p k).2.2.1) (fun k => (hbounds k).2.2.2.1) + (fun k => (p k).2.2.2) (fun k => (hbounds k).2.2.2.2) + (fun k => spinPriorContact_minimum_perturbations (μ k) (π k) (eig k) (c k) (I k) b + w S V H (p k) (hp k) (hmin k)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..7520a62e72954ca0e68c64182030e7acd13def05 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactMinimum.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContact + +namespace OAI + +/-! Joint contact minima for the actual cascade-enriched spin prior. +The pressure averages the logarithm over the quenched cascade. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +def spinPriorPerturbationPressureMean {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (t : ℝ) (h : ℕ → ℝ) (u : Fin N → ℝ) (v : Fin m → ℝ) : ℝ := + spinPriorMeanPressure (n := n) μ π (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + b (fun j : Fin N => enumeratedTreeDegree m j) h+h n/2 + +def spinPriorPerturbationObjective {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (t : ℝ) (h : ℕ → ℝ) (u : Fin N → ℝ) (v : Fin m → ℝ) : ℝ := + -spinPriorPerturbationPressureMean (n := n) μ π eig c I b t h u v+ + ∑ j : Fin N, perturbationWeight j*(u j-3/2)^2+∑ a, (v a-3/2)^2 + +def spinPriorContactObjective {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (p : TensorContactParameter N m n) : ℝ := + -spinPriorContactPressure μ π eig c I b p - (∑ i, w i*finiteFieldPath p.2.1 i)/2 + + S+V p.1 + ∑ j : Fin N, perturbationWeight j*(p.2.2.1 j-3/2)^2 + + ∑ a, (p.2.2.2 a-3/2)^2 + +lemma continuousOn_spinPriorContactObjective (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (hV : Continuous V) (H : ℝ) : + ContinuousOn (spinPriorContactObjective μ π eig c I b w S V) (tensorContactRegion N m n H) := by + have hp := continuousOn_spinPriorContactPressure hhaar hgauss hN μ hμ π eig c I b K hK + (S := tensorContactRegion N m n H) + (fun p hp => (tensorContactRegion_bounds hp).2.1) + have hw : Continuous (fun p : TensorContactParameter N m n => + ∑ i, w i*finiteFieldPath p.2.1 i) := by + apply continuous_finsetSum + intro i _ + exact continuous_const.mul ((continuous_finiteFieldPath i).comp (by fun_prop)) + unfold spinPriorContactObjective + exact (((hp.neg.sub (hw.div_const 2).continuousOn).add continuousOn_const).add + (hV.comp continuous_fst).continuousOn |>.add (by fun_prop)).add (by fun_prop) + +theorem spinPriorContactObjective_exists_minimum (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (hV : Continuous V) (H : ℝ) (hH : 0 ≤ H) : + ∃ p ∈ tensorContactRegion N m n H, + ∀ q ∈ tensorContactRegion N m n H, + spinPriorContactObjective μ π eig c I b w S V p ≤ spinPriorContactObjective μ π eig c I b w S V q := + (isCompact_tensorContactRegion N m n H).exists_isMinOn + (tensorContactRegion_nonempty N m n hH) + (continuousOn_spinPriorContactObjective hhaar hgauss hN μ hμ π eig c I b K hK w S V hV H) + +lemma spinPriorContactObjective_eq_perturbation {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (p : TensorContactParameter N m n) : + spinPriorContactObjective μ π eig c I b w S V p = + spinPriorPerturbationObjective (n := n) μ π eig c I b p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2 + + finiteFieldPath p.2.1 n/2 - (∑ i, w i*finiteFieldPath p.2.1 i)/2+S+V p.1 := by + unfold spinPriorContactObjective spinPriorContactPressure spinPriorPerturbationObjective spinPriorPerturbationPressureMean + ring + +theorem spinPriorContact_minimum_perturbations {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) + (p : TensorContactParameter N m n) (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + spinPriorContactObjective μ π eig c I b w S V p ≤ spinPriorContactObjective μ π eig c I b w S V q) : + ∀ u v, (∀ j, u j ∈ Icc (1 : ℝ) 2) → (∀ a, v a ∈ Icc (1 : ℝ) 2) → + spinPriorPerturbationObjective (n := n) μ π eig c I b p.1 (finiteFieldPath p.2.1) p.2.2.1 p.2.2.2 ≤ + spinPriorPerturbationObjective (n := n) μ π eig c I b p.1 (finiteFieldPath p.2.1) u v := by + intro u v hu hv + let q : TensorContactParameter N m n := (p.1,p.2.1,u,v) + obtain ⟨ht,ha,hcap,_,_⟩ := tensorContactRegion_bounds hp + have hq : q ∈ tensorContactRegion N m n H := tensorContactRegion_mem ht ha hcap hu hv + have h := hmin q hq + rw [spinPriorContactObjective_eq_perturbation μ π eig c I b w S V p, + spinPriorContactObjective_eq_perturbation μ π eig c I b w S V q] at h + dsimp only [q] at h + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactNoSequence.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactNoSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..4dea8de6f6f7b6204adaffc826e170c8383d0c0a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactNoSequence.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactContradiction +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactGG + +namespace OAI + +/-! Compactness and the minimizing GG subsequence discharge the limiting +array assumptions in the contact contradiction. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem spinPriorContact_no_positive_minimizing_sequence + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (δ S H : ℝ) (hδ : 0 < δ) + (p : (k : ℕ) → TensorContactParameter (N k) m n) + (hp : ∀ k, p k ∈ tensorContactRegion (N k) m n H) + (hmin : ∀ k q, q ∈ tensorContactRegion (N k) m n H → + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) S + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) (p k) ≤ + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) S + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) q) + (hcap : ∀ k, (∑ i, (p k).2.1 i) < H) + (hpos : ∀ k, 0 < (p k).1) : False := by + obtain ⟨Q, q, φ, hφ, hL, hgg, hd, _⟩ := spinPriorContact_minimizers_have_GG_limit hhaar hgauss + N hN hNlim m n μ hμinv π (chainExponent cut) (chainExponent_admissible hc hfirst hlast) + eig c K hK heig I (fun i => (cut i.succ - cut i.castSucc) * values i) S + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) H p hp hmin + obtain ⟨t, _, ψ, hψ, hT⟩ := isCompact_Icc.tendsto_subseq + (fun k => (tensorContactRegion_bounds (hp (φ k))).1) + let τ : ℕ → ℕ := φ ∘ ψ + have hτ : StrictMono τ := hφ.comp hψ + apply spinPriorContact_limit_contradiction (fun k => N (τ k)) (fun k => by have := hN (τ k); omega) + (hNlim.comp hτ.tendsto_atTop) m n (fun k => μ (τ k)) (fun k => hμinv (τ k)) (fun k => π (τ k)) + (fun k => eig (τ k)) (fun k => c (τ k)) K (fun k => heig (τ k)) + (fun k => I (τ k)) (fun k => hdis (τ k)) (fun k => hcover (τ k)) + lam (fun k => hlam (τ k)) ρ hρpos hρsum (hρ.comp hτ.tendsto_atTop) + cut hc hfirst hlast trial values hvalues δ S H hδ + (fun k => p (τ k)) (fun k => hp (τ k)) (fun k => hmin (τ k)) + (fun k => hcap (τ k)) (fun k => hpos (τ k)) t hT Q + (hL.comp hψ.tendsto_atTop) hgg (fun a => (q a : ℝ)) (fun a => (q a).property.1) hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactTailOrder.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactTailOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..4016a92e3c31978c65e46a3c92fb3cacab300aa3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactTailOrder.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralContactTails +import OAI.Probability.InvariantIsing.Fields.SpinPriorFieldTailBridge +import OAI.Probability.InvariantIsing.Fields.SpinPriorTreeGeometry + +namespace OAI + +/-! The actual joint minima enforce upper-tail order at their synchronized +GG limit. All finite field directions are taken at those same minima. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem spinPriorContact_limit_tail_order + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) + (p : (k : ℕ) → TensorContactParameter (N k) m n) + (hp : ∀ k, p k ∈ tensorContactRegion (N k) m n H) + (hmin : ∀ k q, q ∈ tensorContactRegion (N k) m n H → + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) S V (p k) ≤ + spinPriorContactObjective (μ k) (π k) (eig k) (c k) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) S V q) + (hcap : ∀ k, (∑ i, (p k).2.1 i) < H) + (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hL : Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) (chainExponent cut) (eig k) (c k) (I k) + (p k).2.2.1 (p k).2.2.2 (p k).1 (finiteFieldPath (p k).2.1)) + atTop (𝓝 Q)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) : + ∀ s ∈ Icc (0 : ℝ) 1, pathTail trial s ≤ pathTail (spectralSpinQuantilePath Q hP hn) s := by + classical + have hb := chainExponent_admissible hc hfirst hlast + have hh k := monotone_finiteFieldPath (tensorContactRegion_bounds (hp k)).2.1 + have h0 k := finiteFieldPath_nonneg (tensorContactRegion_bounds (hp k)).2.1 0 + have hgeom := spinPriorPerturbedArrayLaw_limit_geometry N m n μ π eig c I + (fun k => (p k).2.2.1) (fun k => (p k).2.2.2) (fun k => (p k).1) + (chainExponent cut) (fun k => finiteFieldPath (p k).2.1) Q hL + have hlevels := spinPriorPerturbedArrayLaw_limit_treeLevels N m n μ π eig c I + (fun k => (p k).2.2.1) (fun k => (p k).2.2.2) (fun k => (p k).1) + (chainExponent cut) (fun k => finiteFieldPath (p k).2.1) Q hL 0 1 + have htails (d : Fin n) : + (∫ x, treeTail n d (x (0,1) (Fin.last m) : ℝ) + ∂(Q : Measure (SpectralArray (m + 1)))) = 1 - cut d.succ.castSucc := by + have he := spinPriorPerturbedArrayLaw_limit_treeTail N hN m n μ π eig c I + (fun k => (p k).2.2.1) (fun k => (p k).2.2.2) (fun k => (p k).1) + (chainExponent cut) hb (fun k => finiteFieldPath (p k).2.1) hh h0 Q hL d + rw [chainExponent_apply cut d.isLt] at he + convert he using 1 + apply congrArg (fun a => 1 - cut a) + exact Fin.ext rfl + have hcut (j) : cut j ∈ Icc (0 : ℝ) 1 := + ⟨by rw [← hfirst]; exact hc.monotone (Fin.zero_le _), + by rw [← hlast]; exact hc.monotone (Fin.le_last _)⟩ + apply contact_partition_tail_order _ trial cut hc hfirst hlast values hvalues + intro j + have hlim := spectralSpinDepthTail_weak_limit hL (n := n) j + have hineq : (∑ i, ((cut i.succ - cut i.castSucc) * values i) * + finiteFieldPath (Pi.single j 1) i) ≤ + ∫ x, spectralSpinDepthTail n j x ∂(Q : Measure (SpectralArray (m + 1))) := by + apply ge_of_tendsto' hlim + intro k + have he := spinPriorArrayLaw_field_tail (μ k) (π k) + (diagonalPerturbedEigenvalues (eig k) (I k) (p k).2.2.2 (p k).1) (c k) (I k) + (hdis k) (hcover k) (fun r => enumeratedSpectralDegree m r) + (tensorPerturbationAmplitude (N k) (p k).2.2.1) (chainExponent cut) + (finiteFieldPath (p k).2.1) (fun r => enumeratedTreeDegree m r) j + have hcdir := spinPriorContact_minimum_field_cone (hN k) (μ k) (π k) (eig k) (c k) (I k) + (chainExponent cut) (fun i => (cut i.succ - cut i.castSucc) * values i) + S V H (p k) (hp k) (hmin k) (hcap k) (Pi.single j 1) + (fun i => by simp only [Pi.single_apply]; split_ifs <;> norm_num) + exact hcdir.trans_eq he.symm + rwa [spectralPair_depthTail_integral Q hgg hgeom.1 q hq hd + (fun e => hgeom.2 e e.injective) hP hn hlevels cut hfirst hcut htails j] at hineq + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactTemperature.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactTemperature.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e28d1e74c35b2a6d43e7ac179b58c612a5f68ab --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorContactTemperature.lean @@ -0,0 +1,98 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactMinimum +import OAI.Probability.InvariantIsing.Fields.SpinPriorTemperatureDerivative +import OAI.Probability.InvariantIsing.Spectral.SpectralTemperatureFunctional +import OAI.Probability.InvariantIsing.Arrays.TensorContactTemperature + +namespace OAI + +/-! The energy inequality at an actual constrained-prior contact minimum, +including a minimum at the upper temperature endpoint. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem spinPriorContact_minimum_temperature + {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (S : ℝ) (V : ℝ → ℝ) (H : ℝ) (p : TensorContactParameter N m n) + (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + spinPriorContactObjective μ π eig c I b w S V p ≤ spinPriorContactObjective μ π eig c I b w S V q) + (ht : 0 < p.1) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) + {V' : ℝ} (hV : HasDerivAt V V' p.1) : + V' ≤ spinPriorObservableAverage (n := n) μ π (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) b + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1) := by + obtain ⟨hpt,ha,hsum,hu,hv⟩ := tensorContactRegion_bounds hp + let M := fun t => spinPriorPerturbationPressureMean (n := n) μ π eig c I b t (finiteFieldPath p.2.1) + p.2.2.1 p.2.2.2 + let E := spinPriorObservableAverage (n := n) μ π (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) b + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1) + have hdM : HasDerivAt M E p.1 := by + have hd := hasDerivAt_spinPriorMeanPressure_temperature hN + μ π eig c I p.2.2.2 (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N p.2.2.1) n b (fun j : Fin N => enumeratedTreeDegree m j) + (finiteFieldPath p.2.1) (monotone_finiteFieldPath ha) + (finiteFieldPath_nonneg ha 0) K hK p.1 + convert hd.add_const (finiteFieldPath p.2.1 n / 2) using 1 + simp only [M, spinPriorPerturbationPressureMean] + + let F := fun t => -M t+V t + have hdF : HasDerivAt F (-E+V') (p.1-id 0) := by + convert! hdM.fun_neg.fun_add hV using 1 + simp only [id_eq,sub_zero] + have hd := hdF.comp 0 ((hasDerivAt_id (0 : ℝ)).const_sub p.1) + simp only [mul_neg_one] at hd + have hsmall : ∀ᶠ a in 𝓝[>] (0 : ℝ), a < p.1 := + (show ∀ᶠ a in 𝓝 (0 : ℝ), a < p.1 from Iio_mem_nhds ht).filter_mono nhdsWithin_le_nhds + have hnon := right_derivative_nonneg_of_min hd.hasDerivWithinAt (by + filter_upwards [hsmall,self_mem_nhdsWithin] with a hal ha0 + have hnew : (p.1-a,p.2.1,p.2.2.1,p.2.2.2) ∈ tensorContactRegion N m n H := + tensorContactRegion_mem ⟨sub_nonneg.mpr hal.le,(sub_le_self _ ha0.le).trans hpt.2⟩ + ha hsum hu hv + have hm := hmin _ hnew + simp only [spinPriorContactObjective,spinPriorContactPressure] at hm + change F (p.1-0) ≤ F (p.1-a) + rw [sub_zero] + dsimp only [F,M,spinPriorPerturbationPressureMean] + linarith) + change V' ≤ E + linarith + +theorem spinPriorContact_minimum_energy_gap + {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (w : Fin (n+1) → ℝ) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a=1) + (trial : OverlapPath) (δ S H : ℝ) (p : TensorContactParameter N m n) + (hp : p ∈ tensorContactRegion N m n H) + (hmin : ∀ q ∈ tensorContactRegion N m n H, + spinPriorContactObjective μ π eig c I b w S + (fun t => finiteTemperatureFunctional ρ lam hρ hρsum trial t+t*δ) p ≤ + spinPriorContactObjective μ π eig c I b w S + (fun t => finiteTemperatureFunctional ρ lam hρ hρsum trial t+t*δ) q) + (ht : 0 < p.1) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) : + finiteInteractionEnergy ρ lam hρ hρsum p.1 trial+δ ≤ + spinPriorObservableAverage (n := n) μ π (diagonalPerturbedEigenvalues eig I p.2.2.2 p.1) + c I (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N p.2.2.1) b + (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath p.2.1) + (fun U x => (N : ℝ)⁻¹*rotatedEnergy eig (specialRotation U) x.1) := by + apply spinPriorContact_minimum_temperature hN μ π b eig c I w S + (fun t => finiteTemperatureFunctional ρ lam hρ hρsum trial t+t*δ) H p hp hmin ht K hK + convert! (hasDerivAt_finiteTemperatureFunctional ρ lam hρ hρsum trial p.1).fun_add + ((hasDerivAt_id p.1).mul_const δ) using 1 + simp only [one_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorDiagonalMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorDiagonalMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dd5fc828ed481e5675a165295c6cfb7bf41523e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorDiagonalMinimum.lean @@ -0,0 +1,129 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorDiagonalStatistics +import OAI.Probability.InvariantIsing.Pressure.PressureCoordinateMinimum + +namespace OAI + +/-! The spectral self-overlap estimate at a actual quenched constrained-cascade pressure minimum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem spinPriorDiagonal_energy_at_minimum {N m k n : ℕ} (hN : 0 (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude r h p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + ∀ q∈Set.Icc (1 : ℝ) 2, -M w+(w-3/2)^2≤-M q+(q-3/2)^2) : + let A := N*perturbationScale N + let c₀ := N/A^2 + let P := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let ν := spinPriorNamespacedReference (n := n) π + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude + r h + let Y := fun p : (TensorFlatDisorder N n) × (Spin N × LabeledLeaf n) => + projectedOverlap (specialRotation p.1.1.1) (I a) p.2.1 p.2.1 + let E := fun p : TensorFlatDisorder N n => ∫ x, |Y (p,x)-2*c₀*(A*w-A*(3/2))| + ∂(ν p).tilted (fun x => A*w*Y (p,x)) + Integrable E P ∧ (∫ p, E p ∂P)≤ + (2*c₀+K^2)/(2*K)+c₀*(A*s)+4*(2*Real.sqrt B)/(A*s) := by + intro A c₀ P ν Y E + let Q := P + let M := fun q => (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude r h p ∂P + let L := fun z => ∫ p, spinPriorDiagonalCGF π eig c I degree amplitude n r h v t a z p ∂Q + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hA : 0 < A := mul_pos hn (Real.rpow_pos_of_pos hn _) + have hY : Measurable Y := by + apply measurable_from_prod_countable_left + intro x + exact (measurable_projectedOverlap (I a) x.1 x.1).comp measurable_fst.fst + have hYb (p : TensorFlatDisorder N n) (x : Spin N × LabeledLeaf n) : + Y (p, x) ∈ Set.Icc (0 : ℝ) 1 := + ⟨projectedOverlap_self_nonneg _ _ _, projectedOverlap_self_le_one _ _ _⟩ + have hstat (q : ℝ) (hq : |q| ≤ 2) := + spinPriorDiagonalCGF_statistics hN μ π b eig c I degree amplitude r h hh h0 v t a q B + (fun z hz => by + rcases hz with hz | hz + · rw [hz] + exact hF q hq + · rw [hz] + exact hF 0 (by norm_num)) + (fun z hz => by + rcases hz with hz | hz + · rw [hz] + exact hv q hq + · rw [hz] + exact hv 0 (by norm_num)) + have hmean (q : ℝ) (hq : |q| ≤ 2) : L (A * q) = N * (M q - M 0) := by + dsimp only [L,A,Q,P,M] + rw [(hstat q hq).2.1] + have hn0 := hn.ne' + field_simp + have hcost (q : ℝ) (hq : q ∈ Set.Icc (1 : ℝ) 2) : + 0 ≤ M q - M 0 ∧ M q - M 0 ≤ 2 * perturbationScale N := by + have hqa : |q| ≤ 2 := abs_le.mpr ⟨by linarith [hq.1], hq.2⟩ + have hqb : ∀ p, 0 ≤ spinPriorDiagonalCGF π eig c I degree amplitude n r h v t a (A * q) p ∧ + spinPriorDiagonalCGF π eig c I degree amplitude n r h v t a (A * q) p ≤ A * q := by + intro p + exact bounded_nonnegative_cgf_bounds (ν p) (fun x => Y (p, x)) + (measurable_of_countable _) (hYb p) (mul_nonneg hA.le (by linarith [hq.1])) + have hlo : 0 ≤ L (A * q) := integral_nonneg (fun p => (hqb p).1) + have hhi : L (A * q) ≤ A * q := by + calc + _ ≤ ∫ _ : TensorFlatDisorder N n, A * q ∂Q := + integral_mono ((hstat q hqa).1.integrable (by norm_num)) (integrable_const _) (fun p => (hqb p).2) + _ = _ := by simp [Q,P] + rw [hmean q hqa] at hlo hhi + have hbound := mul_le_mul_of_nonneg_left hq.2 hA.le + refine ⟨(mul_nonneg_iff_of_pos_left hn).mp hlo, ?_⟩ + dsimp only [A] at hbound hhi + nlinarith + have hpen := diagonalCoordinate_minimum_penalty + ⟨(hcost (3 / 2) (by constructor <;> norm_num)).1, (hcost w hw).2⟩ + (hmin (3 / 2) (by constructor <;> norm_num)) + obtain ⟨hlo, hhi⟩ := diagonalCoordinate_minimum_interior hpen he hs' + have hlocal := pressureCoordinate_minimum_rescale (Nat.cast_nonneg N) hA hw hlo hhi + (fun q hq => hmean q (abs_le.mpr ⟨by linarith [hq.1], hq.2⟩)) + (show ∀ q ∈ Set.Icc (1 : ℝ) 2, -M w + 1 * (w - 3 / 2) ^ 2 ≤ + -M q + 1 * (q - 3 / 2) ^ 2 by simpa only [one_mul] using hmin) + have hconc (z : ℝ) (hz : z ∈ ({A * w - A * s, A * w, A * w + A * s} : Set ℝ)) : + (∫ p, |spinPriorDiagonalCGF π eig c I degree amplitude n r h v t a z p - L z| ∂Q) ≤ + 2 * Real.sqrt B := by + have hzi : z ∈ Set.Icc (A * w - A * s) (A * w + A * s) := by + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hz + rcases hz with rfl | rfl | rfl <;> constructor <;> nlinarith [mul_pos hA hs] + have hzq : z / A ∈ Set.Icc (1 : ℝ) 2 := by + constructor + · apply (le_div_iff₀ hA).mpr + nlinarith [hzi.1] + · apply (div_le_iff₀ hA).mpr + nlinarith [hzi.2] + have hza : |z / A| ≤ 2 := abs_le.mpr ⟨by linarith [hzq.1], hzq.2⟩ + have hc := (hstat (z / A) hza).2.2 + simpa only [A, mul_div_cancel₀ _ hA.ne'] using hc + simpa only [mul_one] using boundedObservable_energy_at_minimum Q ν + (measurable_spinPriorNamespacedReference (n := n) π + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude r h) + Y hY 1 (fun p x => projectedOverlap_abs_le_one _ _ _ _) + (mul_pos hA hs) hK hlocal hconc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorDiagonalStatistics.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorDiagonalStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8901d1e541aea497833ae9cf4634eb9166ddb2f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorDiagonalStatistics.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFrozenGibbs +import OAI.Probability.InvariantIsing.Pressure.PressureDifferenceConcentration + +namespace OAI + +/-! Diagonal CGF and pressure concentration for the actual constrained +cascade model. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def spinPriorDiagonalCGF {N m k : ℕ} (π : Measure (Spin N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (r : Fin k → ℕ) (h : ℕ → ℝ) (v : Fin m → ℝ) (t : ℝ) (a : Fin m) + (s : ℝ) (p : TensorFlatDisorder N n) : ℝ := + cgf (fun x : Spin N × LabeledLeaf n => projectedOverlap (specialRotation p.1.1) (I a) x.1 x.1) + (spinPriorNamespacedReference (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude r h p) s + +/-- At its true coefficient `N e_N w`, a frozen diagonal tilt is exactly +the actual perturbed partition difference. -/ +theorem spinPriorDiagonalCGF_eq_log_difference {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (v : Fin m → ℝ) (t : ℝ) (a : Fin m) (w : ℝ) : + spinPriorDiagonalCGF π eig c I degree amplitude n r h v t a (N * perturbationScale N * w) =ᵐ[ + (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates] + (fun p => spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude r h p - + spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude r h p) := by + have he := spinPriorNamespaced_exp_integrable_ae μ π + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude n b r h hh h0 + filter_upwards [he] with p hp + let H := tensorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude n r h p + let Y := fun x : Spin N × LabeledLeaf n => projectedOverlap (specialRotation p.1.1) (I a) x.1 x.1 + have hbnd : ∀ x, |(N * perturbationScale N * w) * Y x| ≤ |N * perturbationScale N * w| := by + intro x + rw [abs_mul] + exact (mul_le_mul_of_nonneg_left (projectedOverlap_abs_le_one _ _ _ _) (abs_nonneg _)).trans_eq (mul_one _) + have ht : Integrable (fun x => Real.exp (H x + (N * perturbationScale N * w) * Y x)) + (labeledSpinReference n π p.1.2) := by + simpa only [add_comm] using integrable_exp_bounded_add (H := H) + (B := fun x => (N * perturbationScale N * w) * Y x) hp (measurable_of_countable _) + (fun x => (le_abs_self _).trans (hbnd x)) + have heq : (fun x => H x + (N * perturbationScale N * w) * Y x) = + tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude n r h p := by + funext x + dsimp only [H, Y, tensorNamespacedHamiltonian] + rw [rotatedEnergy_diagonal_coordinate hN eig (specialRotation p.1.1) I v t a w x.1] + ring + change cgf Y (gibbsProbability _ H) _ = _ + rw [cgf_fold _ H Y _ hp ht, heq] + rfl + +theorem spinPriorDiagonalCGF_statistics {N m k n : ℕ} (hN : 0 ∫ p, spinPriorNamespacedLog (n := n) π + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude r h p ∂P + let Z := spinPriorDiagonalCGF π eig c I degree amplitude n r h v t a (N*perturbationScale N*w) + MemLp Z 2 P ∧ (∫ p, Z p ∂P)=M w-M 0 ∧ + (∫ p, |Z p-∫ p', Z p' ∂P| ∂P)≤2*Real.sqrt B := by + intro P M Z + let F := fun q => spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude r h + have he : Z =ᵐ[P] fun p => (1 : ℝ)*(F w p-F 0 p) := by + filter_upwards [spinPriorDiagonalCGF_eq_log_difference hN μ π eig c I degree amplitude + n b r h hh h0 v t a w] with p hp + simpa only [one_mul,Z,F,spinPriorDiagonalCGF] using hp + have hc := centered_scaled_difference_L1_bound P (hF w (Or.inl rfl)) + (hF 0 (Or.inr rfl)) (hv w (Or.inl rfl)) (hv 0 (Or.inr rfl)) he + refine ⟨hc.1,?_,?_⟩ + · rw [integral_congr_ae he] + simp only [one_mul] + exact integral_sub ((hF w (Or.inl rfl)).integrable (by norm_num)) + ((hF 0 (Or.inr rfl)).integrable (by norm_num)) + · simpa only [abs_one,mul_one,one_mul] using hc.2 + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorEnergyLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorEnergyLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..6007460928eeca4142ff596da163d8542ec26d57 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorEnergyLimit.lean @@ -0,0 +1,135 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorWardLimits +import OAI.Probability.InvariantIsing.Fields.SpinPriorObservableAverageLaw +import OAI.Probability.InvariantIsing.Spectral.SpectralPartition +import OAI.Probability.InvariantIsing.Spectral.SpectralCanonicalIdentification +import OAI.Probability.InvariantIsing.Spectral.SpectralArrayEnergy +import OAI.Probability.InvariantIsing.Arrays.TensorSingleObservable + +namespace OAI + +/-! The original interaction energy in a constrained-prior GG limit is +identified by the actual rotation Ward equations. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma spinPriorPerturbedArrayLaw_partition {N m n : ℕ} (hN : 0 D U (σ 0)) := by + unfold spinPriorObservableAverage spinPriorReplicaAverage + apply integral_congr_ae + exact ae_of_all _ fun p => (referenceReplicaMean_zero_one + (spinPriorNamespacedReference (n := n) π eig c I degree amp r h p) + (D p.1.1)).symm + +lemma spinPriorArrayLaw_interactionEnergy {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) (b : ℕ → ℝ) [IsProbabilityMeasure π] + (modelEig energyEig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I=Finset.univ) (lam : Fin m → ℝ) + (hlam : ∀ a i, i ∈ I a → energyEig i=lam a) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) : + (∫ x, spectralArrayInteractionEnergy lam x + ∂(spinPriorArrayLaw μ π modelEig c I degree amp n b r h : Measure (SpectralArray (m+1)))) = + spinPriorReplicaAverage μ π modelEig c I degree amp n b r h + (fun U (σ : Fin 1 → Spin N × LabeledLeaf n) => + (N : ℝ)⁻¹*rotatedEnergy energyEig (specialRotation U) (σ 0).1) := by + apply spinPriorArrayLaw_test μ π modelEig c I degree amp n b r h + _ (continuous_spectralArrayInteractionEnergy lam) _ (fun i : Fin 1 => i.val) Fin.val_injective + intro U σ + simp only [spectralArrayInteractionEnergy, spectralJointEntry_spectral, Fin.val_zero] + exact (normalized_rotatedEnergy_eq_blocks energyEig (specialRotation U) I hdis hcover lam hlam + (σ 0).1).symm + +theorem spinPriorPerturbedArrayLaw_interactionEnergy_limit + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (b : ℕ → ℝ) + (eig c : (k : ℕ) → Fin (N k) → ℝ) (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k)=Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i=lam a) + (u : (k : ℕ) → Fin (N k) → ℝ) (hu : ∀ k j, |u k j| ≤ 2) + (v : ℕ → Fin m → ℝ) (hv : ∀ k a, |v k a| ≤ 2) + (t : ℕ → ℝ) {t₀ : ℝ} (ht : Tendsto t atTop (𝓝 t₀)) + (h : ℕ → ℕ → ℝ) (hh : ∀ k, Monotone (h k)) (h0 : ∀ k, 0 ≤ h k 0) + (Q : ProbabilityMeasure (SpectralArray (m+1))) + (hL : Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a=1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1)))) + (q : Fin (m+1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) + (ht₀ : 0 ≤ t₀) : + ∃ hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x, + ∃ hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0 ≤ (x (0,1) a : ℝ), + Tendsto (fun k => spinPriorObservableAverage (n := n) (μ k) (π k) + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j : Fin (N k) => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude (N k) (u k)) + b (fun j : Fin (N k) => enumeratedTreeDegree m j) (h k) + (fun U x => (N k : ℝ)⁻¹*rotatedEnergy (eig k) (specialRotation U) x.1)) atTop + (𝓝 (finiteInteractionEnergy ρ lam hρpos hρsum t₀ (spectralSpinQuantilePath Q hP hn))) := by + have hG := spectralArray_limit_gram hL (fun k => spinPriorPerturbedArrayLaw_gram (n := n) + (μ k) (π k) b (eig k) (c k) (I k) (u k) (v k) (t k) (h k)) + have hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q := by + intro e he + exact spectralArray_limit_reindex hL e (fun k => spinPriorPerturbedArrayLaw_reindex (n := n) + (μ k) (π k) b (eig k) (c k) (I k) (u k) (v k) (t k) (h k) e he) + have hP := spectralArray_limit_partition hL (fun k => spinPriorPerturbedArrayLaw_partition (n := n) + (hN k) (μ k) (π k) b (eig k) (c k) (I k) (hdis k) (hcover k) (u k) (v k) (t k) (h k)) + have hn := spectralGG_coordinate_nonnegative hgg hG q hq hd + obtain ⟨hoff,hdiag⟩ := spinPriorPerturbedArrayLaw_ward_limits N hN hNlim m n μ hμinv π b + eig c I hdis hcover lam hlam u hu v hv t ht h hh h0 Q hL ρ hρ + have hid := spectralCanonical_identification hgg hG q hq hd hE hP hn + ρ (fun a => t₀*lam a) hρpos hρsum hoff hdiag + refine ⟨hP,hn,?_⟩ + have he k : (∫ x, spectralArrayInteractionEnergy lam x + ∂(spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) (u k) (v k) (t k) (h k) : + Measure (SpectralArray (m+1)))) = + spinPriorObservableAverage (n := n) (μ k) (π k) + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j : Fin (N k) => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude (N k) (u k)) + b (fun j : Fin (N k) => enumeratedTreeDegree m j) (h k) + (fun U x => (N k : ℝ)⁻¹*rotatedEnergy (eig k) (specialRotation U) x.1) := by + rw [spinPriorObservableAverage_eq_replica_one] + exact spinPriorArrayLaw_interactionEnergy (n := n) (μ k) (π k) b _ (eig k) (c k) (I k) + (hdis k) (hcover k) lam (hlam k) _ _ _ (h k) + have hlim := spectralArrayInteractionEnergy_weak_limit hL lam + simp_rw [he] at hlim + rw [spectralArrayInteractionEnergy_eq_finiteEnergy Q q hd ρ lam hρpos hρsum ht₀ + (spectralSpinQuantilePath Q hP hn) hid.1] at hlim + exact hlim + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorExponential.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorExponential.lean new file mode 100644 index 0000000000000000000000000000000000000000..e099c78fbd742bdfbb18eabb91bfe74ec2ecc179 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorExponential.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorCascadePressure + +namespace OAI + +/-! Exponential integrability of the actual cascade-enriched Hamiltonian +for a normalized deterministic spin constraint. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Topology +namespace InvariantIsing + +theorem spinPriorNamespaced_exp_integrable_ae {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) : + ∀ᵐ p : (SpecialOrthogonal N × LabeledTree n) × (ℕ → ℝ) + ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates, + Integrable (fun x : Spin N × LabeledLeaf n => Real.exp + (rotatedEnergy eig (specialRotation p.1.1) x.1 + fieldEnergy c x.1 + + cylinderField (tensorNamespacedCoefficients (specialRotation p.1.1) I degree amplitude n + (fun i => tensorPathProfile I degree n treeDegree h i) x) p.2)) + (labeledSpinReference n π p.1.2) := by + let Ω := SpecialOrthogonal N × LabeledTree n + let ν := fun ω : Ω => labeledSpinReference n π ω.2 + let H := fun (ω : Ω) (x : Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation ω.1) x.1 + fieldEnergy c x.1 + let A := fun (ω : Ω) => tensorNamespacedCoefficients (specialRotation ω.1) I degree amplitude n + (fun i => tensorPathProfile I degree n treeDegree h i) + have : ∀ ω, IsProbabilityMeasure (ν ω) := fun ω => by + change IsProbabilityMeasure (labeledSpinReference n π ω.2) + infer_instance + have hν : Measurable ν := + (measurable_labeledSpinReference_general n π).comp measurable_snd + have hbase (ω : Ω) : Integrable (fun x => Real.exp (H ω x)) (ν ω) := + finite_spin_base_exp_integrable (ν ω) + (fun σ => rotatedEnergy eig (specialRotation ω.1) σ+fieldEnergy c σ) + have : ∀ ω, IsProbabilityMeasure ((ν ω).tilted (H ω)) := fun ω => isProbabilityMeasure_tilted (hbase ω) + have htilt : Measurable (fun ω => (ν ω).tilted (H ω)) := + measurable_random_tilted_measure (H := Function.uncurry H) hν (measurable_tensorDeterministicEnergy eig c n) + have hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + cylinderField (A p.1.1 p.2) p.1.2) := measurable_tensorNamespacedPathFields I degree amplitude n treeDegree h + have hA (ω : Ω) (x : Spin N × LabeledLeaf n) : + (A ω x).sum (fun _ c => c ^ 2) ≤ h n * N + ∑ j, amplitude j ^ 2 := + tensorNamespacedPath_variance_le (specialRotation ω.1) I degree amplitude n treeDegree h hh h0 x + have he := randomCoefficient_all_exp_ae + (P := μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))) htilt A hAm hA + filter_upwards [he] with p hp + have hi := hp 1 + rw [integrable_tilted_iff (hbase p.1)] at hi + simpa only [H, A, ν, one_mul, smul_eq_mul, ← Real.exp_add] using hi + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9a8163e78e68ef8bc2419eb6a920b779c421866 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldDerivative.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorReplicaAverage +import OAI.Probability.InvariantIsing.Fields.SpinPriorCascadePressure +import OAI.Probability.InvariantIsing.Arrays.TensorFieldDerivative +import OAI.Probability.IsingPerceptron.VarianceDerivative + +namespace OAI + +/-! The right derivative of an independent linear-field insertion in the +actual namespaced tensor model. The variance-zero endpoint is included. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +def spinPriorFieldCGFMean {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) : ℝ := + ∫ z : TensorFlatDisorder N n × (ℕ → ℝ), + cgf (fun x => cylinderField (tensorLinearCoefficients n g x) z.2) + (spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h z.1) (Real.sqrt a) + ∂((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates).prod + gaussianCoordinates + +def spinPriorFieldInsertionMean {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) : ℝ := + spinPriorMeanPressure (n := n) μ π eig c I degree amp b treeDegree h + + spinPriorFieldCGFMean μ π eig c I degree amp n b treeDegree h g a / N - a * g n / 2 + +theorem spinPriorFieldCGFMean_right_derivative {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt (spinPriorFieldCGFMean μ π eig c I degree amp n b treeDegree h g) + ((N * g n - N * spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun _ => tensorFieldPairObservable g)) / 2) (Ici 0) 0 := by + let Q := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let ν := spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h + have hν : Measurable ν := measurable_spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h + have hd := hasDerivWithinAt_random_cylinder_variance (P := Q) hν + (tensorLinearCoefficients n g) (fun x => (tensorLinearCoefficients_variance n g hg g0 x).le) + (d := N * g n) (fun x => by rw [cylinderCross_self, tensorLinearCoefficients_variance n g hg g0]) + (v := 0) (by norm_num) + have hc : (fun σ : Fin 2 → Spin N × LabeledLeaf n => + cylinderCross (tensorLinearCoefficients n g (σ 1)) (tensorLinearCoefficients n g (σ 0))) = + (fun σ => N * tensorFieldPairObservable g σ) := + funext (tensorLinearCoefficients_cross_normalized hN n g hg g0) + rw [Real.sqrt_zero, hc, randomReplicaAverage_zero_reference] at hd + simp only [referenceReplicaMean_const_mul, integral_const_mul] at hd + exact hd + +/-- The diagonal Gaussian term is canceled by the actual `-h(top)/2` +normalization. This is the contact derivative, including zero and tied +field increments, before identifying the inserted field with `h+a*g`. -/ +theorem spinPriorFieldInsertionMean_right_derivative {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt (spinPriorFieldInsertionMean μ π eig c I degree amp n b treeDegree h g) + (-spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun _ => tensorFieldPairObservable g) / 2) (Ici 0) 0 := by + have hd := spinPriorFieldCGFMean_right_derivative hN μ π eig c I degree amp n b treeDegree h g hg g0 + have hm := ((hd.div_const (N : ℝ)).const_add + (spinPriorMeanPressure (n := n) μ π eig c I degree amp b treeDegree h)).fun_sub + (((hasDerivAt_id (0 : ℝ)).mul_const (g n)).div_const 2).hasDerivWithinAt + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + have he : (N * g n - N * spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun _ => tensorFieldPairObservable g)) / 2 / N - 1 * g n / 2 = + -spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun _ => tensorFieldPairObservable g) / 2 := by + field_simp + ring + rw [he] at hm + convert hm using 1 + rfl + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldDerivativeMean.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldDerivativeMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe4e924da26d88fb9085468b750805079a4065c7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldDerivativeMean.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFieldInsertionLaw +import OAI.Probability.InvariantIsing.Fields.SpinPriorCascadeAverage + +namespace OAI + +/-! The actual field-direction derivative used by the upper contact +argument. All Gaussian insertions and actual model means are identified. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem spinPriorFieldInsertedLog_cgf_fold {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) (a : ℝ) : + ∀ᵐ p : TensorFlatDisorder N n × (ℕ → ℝ) + ∂(((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates).prod gaussianCoordinates), + spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a p = + spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree h p.1 + + cgf (fun x => cylinderField (tensorLinearCoefficients n g x) p.2) + (spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h p.1) (Real.sqrt a) := by + let ν := fun p : TensorFlatDisorder N n => + labeledSpinReference n π p.1.2 + have : ∀ p, IsProbabilityMeasure (ν p) := fun p => by + change IsProbabilityMeasure (labeledSpinReference n π p.1.2) + infer_instance + have hν : Measurable ν := + (measurable_labeledSpinReference_general n π).comp measurable_fst.snd + have he := random_cgf_insertion_eq hν + (measurable_tensorNamespacedHamiltonian eig c I degree amp n treeDegree h) + (spinPriorNamespaced_exp_integrable_ae μ π eig c I degree amp n b treeDegree h hh h0) + (tensorLinearCoefficients n g) (fun x => (tensorLinearCoefficients_variance n g hg g0 x).le) + (Real.sqrt a) + filter_upwards [he] with p hp + change cgf _ (spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h p.1) (Real.sqrt a) = + spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a p - + spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree h p.1 at hp + linarith + +theorem spinPriorMeanPressure_field_insert {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) + (a : ℝ) (ha : 0 ≤ a) : + spinPriorMeanPressure (n := n) μ π eig c I degree amp b treeDegree (fun i => h i + a * g i) = + spinPriorFieldInsertionMean μ π eig c I degree amp n b treeDegree h g a := by + let Q := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let F := spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree h + let C := fun p : TensorFlatDisorder N n × (ℕ → ℝ) => + cgf (fun x => cylinderField (tensorLinearCoefficients n g x) p.2) + (spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h p.1) (Real.sqrt a) + have hiF : Integrable F Q := spinPriorNamespacedLog_integrable (n := n) μ π eig c I degree amp b treeDegree h hh h0 + have hiC : Integrable C (Q.prod gaussianCoordinates) := integrable_random_cylinder_cgf + (measurable_spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h) + (tensorLinearCoefficients n g) (fun x => (tensorLinearCoefficients_variance n g hg g0 x).le) (Real.sqrt a) + have hmean : (∫ p, spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree (fun i => h i + a * g i) p ∂Q) = + (∫ p, F p ∂Q) + ∫ p, C p ∂Q.prod gaussianCoordinates := by + calc + _ = ∫ p, spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a p + ∂Q.prod gaussianCoordinates := + (spinPriorFieldInsertedLog_identDistrib μ π eig c I degree amp n b treeDegree h g hh h0 hg g0 a ha).integral_eq.symm + _ = ∫ p, F p.1 + C p ∂Q.prod gaussianCoordinates := + integral_congr_ae (spinPriorFieldInsertedLog_cgf_fold μ π eig c I degree amp n b treeDegree h g hh h0 hg g0 a) + _ = (∫ p, F p.1 ∂Q.prod gaussianCoordinates) + ∫ p, C p ∂Q.prod gaussianCoordinates := + integral_add (hiF.comp_fst gaussianCoordinates) hiC + _ = _ := by rw [integral_fun_fst F, probReal_univ, one_smul] + unfold spinPriorFieldInsertionMean spinPriorMeanPressure spinPriorFieldCGFMean + rw [hmean] + change (N : ℝ)⁻¹ * ((∫ p, F p ∂Q) + ∫ p, C p ∂Q.prod gaussianCoordinates) - + (h n + a * g n) / 2 = + ((N : ℝ)⁻¹ * (∫ p, F p ∂Q) - h n / 2) + + (∫ p, C p ∂Q.prod gaussianCoordinates) / N - a * g n / 2 + rw [div_eq_mul_inv (∫ p, C p ∂Q.prod gaussianCoordinates) (N : ℝ)] + ring + +/-- A nonnegative monotone field direction is feasible even when base +increments vanish or tie. The actual centered pressure has the stated +right derivative, with no concentration or path-law input. -/ +theorem spinPriorMeanPressure_field_right_derivative {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) : + HasDerivWithinAt + (fun a => spinPriorMeanPressure (n := n) μ π eig c I degree amp b treeDegree (fun i => h i + a * g i)) + (-spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun _ => tensorFieldPairObservable g) / 2) (Ici 0) 0 := by + apply (spinPriorFieldInsertionMean_right_derivative hN μ π eig c I degree amp n b treeDegree h g hg g0).congr_of_eventuallyEq + · filter_upwards [self_mem_nhdsWithin] with a ha + exact spinPriorMeanPressure_field_insert μ π eig c I degree amp n b treeDegree h g hh h0 hg g0 a ha + · exact spinPriorMeanPressure_field_insert μ π eig c I degree amp n b treeDegree h g hh h0 hg g0 0 le_rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldInsertionLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldInsertionLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d44d6675245db6c7ecde13c602c8f8208a77bd8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldInsertionLaw.lean @@ -0,0 +1,144 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFieldDerivative +import OAI.Probability.InvariantIsing.Fields.SpinPriorExponential +import OAI.Probability.InvariantIsing.Arrays.TensorFieldDerivativeLaw + +namespace OAI + +/-! Independent Gaussian insertion for the actual constrained cascade. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def spinPriorFieldInsertedLog {N m k : ℕ} (π : Measure (Spin N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) + (p : TensorFlatDisorder N n × (ℕ → ℝ)) : ℝ := + Real.log (∫ x : Spin N × LabeledLeaf n, Real.exp + (tensorNamespacedHamiltonian eig c I degree amp n treeDegree h p.1 x + + Real.sqrt a * cylinderField (tensorLinearCoefficients n g x) p.2) + ∂labeledSpinReference n π p.1.1.2) + +lemma measurable_spinPriorFieldInsertedLog {N m k : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) (a : ℝ) : + Measurable (spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a) := by + let ν := fun p : TensorFlatDisorder N n × (ℕ → ℝ) => + labeledSpinReference n π p.1.1.2 + have : ∀ p, IsProbabilityMeasure (ν p) := fun p => by + change IsProbabilityMeasure (labeledSpinReference n π p.1.1.2) + infer_instance + have hν : Measurable ν := + (measurable_labeledSpinReference_general n π).comp + measurable_fst.fst.snd + have hm := (measurable_random_referencePartition hν + (measurable_tensorFieldInsertedHamiltonian eig c I degree amp n treeDegree h g a)).log + convert hm using 1 + rfl + +lemma spinPriorFieldInsertedLog_conditional_law {N m k n : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (U : SpecialOrthogonal N) (T : LabeledTree n) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) + (a : ℝ) (ha : 0 ≤ a) : + (gaussianCoordinates.prod gaussianCoordinates).map (fun z : (ℕ → ℝ) × (ℕ → ℝ) => + spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a (((U,T),z.1),z.2)) = + gaussianCoordinates.map (fun z => spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree + (fun i => h i + a * g i) ((U,T),z)) := by + let ν := labeledSpinReference n π T + let H := fun x : Spin N × LabeledLeaf n => + rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1 + let K := fun F : (Spin N × LabeledLeaf n → ℝ) => Real.log (∫ x, Real.exp (H x + F x) ∂ν) + have : ∀ F : (Spin N × LabeledLeaf n → ℝ), IsProbabilityMeasure ((fun _ => ν) F) := + fun _ => by change IsProbabilityMeasure ν; infer_instance + have hE : Measurable (fun p : (Spin N × LabeledLeaf n → ℝ) × (Spin N × LabeledLeaf n) => + H p.2 + p.1 p.2) := by + apply measurable_from_prod_countable_left + intro x + have hx : Measurable (fun _ : Spin N × LabeledLeaf n → ℝ => H x) := measurable_const + exact hx.add (measurable_pi_apply x) + have hK : Measurable K := (measurable_random_referencePartition + (ν := fun _ : Spin N × LabeledLeaf n → ℝ => ν) measurable_const hE).log + let A : Spin N × LabeledLeaf n → ℕ →₀ ℝ := tensorNamespacedCoefficients (specialRotation U) I degree amp n + (fun i => tensorPathProfile I degree n treeDegree h i) + let B : Spin N × LabeledLeaf n → ℕ →₀ ℝ := tensorLinearCoefficients n g + let C : Spin N × LabeledLeaf n → ℕ →₀ ℝ := tensorNamespacedCoefficients (specialRotation U) I degree amp n + (fun i => tensorPathProfile I degree n treeDegree (fun j => h j + a * g j) i) + have hf : Measurable (fun z : (ℕ → ℝ) × (ℕ → ℝ) => + fun x => cylinderField (A x) z.1 + Real.sqrt a * cylinderField (B x) z.2) := + Measurable.of_eval (fun x => ((measurable_cylinderField (A x)).comp measurable_fst).add + (((measurable_cylinderField (B x)).comp measurable_snd).const_mul _)) + have hc : Measurable (fun z => fun x => cylinderField (C x) z) := + Measurable.of_eval (fun x => measurable_cylinderField (C x)) + have he := cylinder_independent_sum_law A B C (Real.sqrt a) (fun x y => by + rw [Real.sq_sqrt ha] + exact tensorNamespacedPath_field_add_cross (specialRotation U) I degree amp n treeDegree h g hh h0 hg g0 a ha x y) + have hl : (fun z : (ℕ → ℝ) × (ℕ → ℝ) => + spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a (((U,T),z.1),z.2)) = + K ∘ (fun z => fun x => cylinderField (A x) z.1 + Real.sqrt a * cylinderField (B x) z.2) := by + funext z + apply congrArg Real.log + apply integral_congr_ae + refine ae_of_all _ fun x => ?_ + apply congrArg Real.exp + dsimp [tensorNamespacedHamiltonian, H, A, B] + ring + change _ = gaussianCoordinates.map (K ∘ (fun z => fun x => cylinderField (C x) z)) + rw [hl, ← Measure.map_map hK hf, ← Measure.map_map hK hc, he] + +private lemma tensorField_joint_map_eq {Ω A B E : Type*} + [MeasurableSpace Ω] [MeasurableSpace A] [MeasurableSpace B] [MeasurableSpace E] + (P : Measure Ω) (Q : Measure A) (R : Measure B) [SFinite Q] [SFinite R] + (f : Ω × A → E) (g : Ω × B → E) (hf : Measurable f) (hg : Measurable g) + (he : ∀ ω, Q.map (fun z => f (ω,z)) = R.map (fun z => g (ω,z))) : + (P.prod Q).map f = (P.prod R).map g := by + apply Measure.ext + intro s hs + rw [Measure.map_apply hf hs, Measure.map_apply hg hs, + Measure.prod_apply (hf hs), Measure.prod_apply (hg hs)] + apply lintegral_congr_ae + refine ae_of_all _ fun ω => ?_ + have h := congrArg (fun ν : Measure E => ν s) (he ω) + have hfω : Measurable (fun z => f (ω,z)) := hf.comp (measurable_const.prodMk measurable_id) + have hgω : Measurable (fun z => g (ω,z)) := hg.comp (measurable_const.prodMk measurable_id) + rw [Measure.map_apply hfω hs, Measure.map_apply hgω hs] at h + exact h + +theorem spinPriorFieldInsertedLog_identDistrib {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h g : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (hg : Monotone g) (g0 : 0 ≤ g 0) + (a : ℝ) (ha : 0 ≤ a) : + IdentDistrib (spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a) + (spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree (fun i => h i + a * g i)) + (((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates).prod gaussianCoordinates) + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) := by + let P := μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n)) + let F := fun p : (SpecialOrthogonal N × LabeledTree n) × ((ℕ → ℝ) × (ℕ → ℝ)) => + spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a ((p.1,p.2.1),p.2.2) + let G := spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree (fun i => h i + a * g i) + have hf : Measurable F := (measurable_spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a).comp + MeasurableEquiv.prodAssoc.symm.measurable + have hg' : Measurable G := measurable_spinPriorNamespacedLog (n := n) π eig c I degree amp treeDegree _ + have he := tensorField_joint_map_eq P (gaussianCoordinates.prod gaussianCoordinates) gaussianCoordinates + F G hf hg' (fun ω => spinPriorFieldInsertedLog_conditional_law π eig c ω.1 ω.2 I degree amp treeDegree h g hh h0 hg g0 a ha) + have hs := measurePreserving_prodAssoc P gaussianCoordinates gaussianCoordinates + refine ⟨(measurable_spinPriorFieldInsertedLog π eig c I degree amp n treeDegree h g a).aemeasurable, + hg'.aemeasurable, ?_⟩ + change ((P.prod gaussianCoordinates).prod gaussianCoordinates).map + (F ∘ (MeasurableEquiv.prodAssoc : ((SpecialOrthogonal N × LabeledTree n) × (ℕ → ℝ)) × + (ℕ → ℝ) → (SpecialOrthogonal N × LabeledTree n) × ((ℕ → ℝ) × (ℕ → ℝ)))) = + (P.prod gaussianCoordinates).map G + rw [← Measure.map_map hf hs.measurable, hs.map_eq] + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldMean.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..64dc6cfc5544abf1b3e6b1f044b80457bb6a3024 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldMean.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFieldRecursion +import OAI.Probability.InvariantIsing.Fields.SpinPriorProfileVariance +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactMinimum +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldLogNormalizer +import OAI.Probability.InvariantIsing.Fields.FieldLogMean + +namespace OAI + +/-! Exact zero-temperature constrained field value, including the finite +constraint's probability normalization. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +lemma spinPriorMeanPressure_field (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m k : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (r : Fin k → ℕ) + (h : FieldStep) : + spinPriorMeanPressure (n := h.depth) μ π (fun _ => 0) (fun _ => 0) I degree 0 + (chainExponent h.cut) r (heightSequence h) = + (N : ℝ)⁻¹ * (∫ z, cascadeRecursion h.depth (chainExponent h.cut) + (fun i => vectorGaussianLaw N (fieldStepVariance h i)) (fun _ p => p.1+p.2) + (fun y => finiteLogIntegral π (fieldEnergy y)) z + ∂(vectorGaussianLaw N ⟨h.height 0,h.nonneg 0⟩ : Measure (Fin N → ℝ))) - + h.height (Fin.last h.depth)/2 := by + let b := chainExponent h.cut + let v := fun i => tensorPathProfile I degree h.depth r (heightSequence h) i + let P := (μ.prod (labeledCascadeLaw h.depth b : Measure (LabeledTree h.depth))).prod gaussianCoordinates + let F := spinPriorJointFlatLog (n := h.depth) π (fun _ => 0) (fun _ => 0) I degree 0 (fun i => v i) + have hb := chainExponent_admissible h.ordered_cut h.first h.last + obtain ⟨C,hC,hvar⟩ := spinPriorJointFlatLog_variance hhaar hgauss + have hi : Integrable F P := (hvar N hN μ inferInstance hμ π inferInstance m k h.depth + (fun _ => 0) (fun _ => 0) 1 (by norm_num) (by intro i; norm_num) I degree 0 b hb + (fun i => varianceIncrement (heightSequence h) i) + (fun i j => varianceIncrement (monomialPath h.depth (r j)) i)).1.integrable (by norm_num) + have hl := (spinPriorProfileLog_law (n := h.depth) μ π (fun _ => 0) (fun _ => 0) I degree 0 b (fun i => v i)).integral_eq + have hmap : (∫ x : ℝ, x ∂P.map F) = ∫ p, F p ∂P := integral_map (μ := P) (φ := F) + (measurable_spinPriorJointFlatLog (n := h.depth) π (fun _ => 0) (fun _ => 0) + I degree 0 (fun i => v i)).aemeasurable aestronglyMeasurable_id + have hl' := hl.trans hmap + change (∫ p, spinPriorNamespacedLog π (fun _ => 0) (fun _ => 0) I degree 0 r + (heightSequence h) p ∂P)=∫ p, F p ∂P at hl' + unfold spinPriorMeanPressure + rw [hl', integral_prod _ hi, integral_prod _ hi.integral_prod_left] + have hsec U : Integrable (spinPriorFlatLog π (fun _ => 0) (specialRotation U) + (fun _ => 0) I degree 0 h.depth v) + ((labeledCascadeLaw h.depth b : Measure (LabeledTree h.depth)).prod gaussianCoordinates) := + (spinPriorFlatLog_variance hgauss (by omega) π (fun _ => 0) (specialRotation U) (fun _ => 0) + I degree 0 h.depth b (fun i => varianceIncrement (heightSequence h) i) + (fun i j => varianceIncrement (monomialPath h.depth (r j)) i) hb).1.integrable (by norm_num) + have he U := spinPriorFlatLog_field_integral hgauss (by omega) π (specialRotation U) + I degree h.depth b hb r (heightSequence h) + have hm : (∫ U, ∫ T, ∫ z, F ((U,T),z) ∂gaussianCoordinates + ∂(labeledCascadeLaw h.depth b : Measure (LabeledTree h.depth)) ∂μ) = + ∫ z, cascadeRecursion h.depth b (fun i => vectorGaussianLaw N (varianceIncrement (heightSequence h) (i+1))) + (fun _ p => p.1+p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) z + ∂(vectorGaussianLaw N (varianceIncrement (heightSequence h) 0) : Measure (Fin N → ℝ)) := by + have he' U : (∫ T, ∫ z, F ((U,T),z) ∂gaussianCoordinates + ∂(labeledCascadeLaw h.depth b : Measure (LabeledTree h.depth))) = _ := + (integral_prod _ (hsec U)).symm.trans (he U) + simp_rw [he'] + simp + rw [hm] + simp_rw [varianceIncrement_heightSequence, varianceIncrement_heightSequence_zero, + ← fieldStepVariance_eq_fieldCascadeVariance] + have he : (⟨h.height 0,h.nonneg 0⟩ : ℝ≥0)=NNReal.mk (h.height 0) (h.nonneg 0) := by + apply Subtype.ext + rfl + rw [he, heightSequence_eq h h.depth le_rfl] + rfl + +lemma spinPriorMeanPressure_restricted_field (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m k : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (S : Finset (Spin N)) (hS : S.Nonempty) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (r : Fin k → ℕ) + (h : FieldStep) : + spinPriorMeanPressure (n := h.depth) μ (restrictedSpinPrior S hS : Measure (Spin N)) + (fun _ => 0) (fun _ => 0) I degree 0 (chainExponent h.cut) r (heightSequence h) = + constrainedBlockValue S h-(N : ℝ)⁻¹*(Real.log S.card-N*Real.log 2) := by + rw [spinPriorMeanPressure_field hhaar hgauss hN μ hμ] + rw [restricted_normalized_root_integral (by omega) S hS h ⟨h.height 0,h.nonneg 0⟩] + unfold constrainedBlockValue + have he : (⟨h.height 0,h.nonneg 0⟩ : ℝ≥0)=NNReal.mk (h.height 0) (h.nonneg 0) := by + apply Subtype.ext + rfl + rw [he] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldRecursion.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..627ebb728dafbab60e1de406501657683e1e93e5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldRecursion.lean @@ -0,0 +1,90 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFlatVariance +import OAI.Probability.InvariantIsing.Arrays.TensorZeroAmplitude + +namespace OAI + +/-! Removing the unused tensor marks from the field recursion preserves any +finite probability spin prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +lemma tensorEnergyMarkLaw_zero_amplitude {N m k : ℕ} (U : Rotation N) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (v : SpinTensorIndex I degree → ℝ≥0) (site : ℝ≥0) + (hv : ∀ i, v (Sum.inl i)=site) : + tensorEnergyMarkLaw U I degree 0 v=fieldEnergyMarkLaw N site := by + apply Subtype.ext + change (tensorGaussianLaw I degree v : Measure _).map + (fun z => spinTensorEnergy U I degree 0 z) = + (vectorGaussianLaw N site : Measure _).map (fieldEnergy (N := N)) + have hp := tensorSiteProjection_measurePreserving I degree v site hv + rw [← hp.map_eq, Measure.map_map (measurable_fieldEnergy_map N) hp.measurable] + congr 1 + funext z + funext σ + exact spinTensorEnergy_zero_amplitude U I degree z σ + +lemma spinPriorCascadeValue_field {N m k : ℕ} (π : Measure (Spin N)) [IsProbabilityMeasure π] + (U : Rotation N) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (z : SpinTensorIndex I degree → ℝ) : + spinPriorCascadeValue π (fun _ => 0) U (fun _ => 0) I degree 0 n b + (fun i => tensorPathProfile I degree n r h (i+1)) z = + cascadeRecursion n b (fun i => vectorGaussianLaw N (varianceIncrement h (i+1))) + (fun _ p => p.1+p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) + (tensorSiteProjection I degree z) := by + have he : tensorSpinBaseEnergy (fun _ => 0) U (fun _ => 0) I degree 0 z = + fieldEnergy (tensorSiteProjection I degree z) := by + funext σ + simp only [tensorSpinBaseEnergy, rotatedEnergy, zero_mul, Finset.sum_const_zero, + mul_zero, fieldEnergy, zero_add] + exact spinTensorEnergy_zero_amplitude U I degree z σ + have hm i : tensorEnergyMarkLaw U I degree 0 (tensorPathProfile I degree n r h (i+1)) = + fieldEnergyMarkLaw N (varianceIncrement h (i+1)) := + tensorEnergyMarkLaw_zero_amplitude U I degree _ _ (fun _ => rfl) + unfold spinPriorCascadeValue + simp_rw [hm] + rw [he] + exact prior_field_energy_recursion N n π b (fun i => varianceIncrement h (i+1)) _ + +lemma spinPriorFlatLog_field_integral (hgauss : GaussianLipschitzVarianceInput) + {N m k : ℕ} (hN : 0 0) U (fun _ => 0) I degree 0 n + (fun i => tensorPathProfile I degree n r h i) p + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates) = + ∫ z, cascadeRecursion n b (fun i => vectorGaussianLaw N (varianceIncrement h (i+1))) + (fun _ p => p.1+p.2) (fun y => finiteLogIntegral π (fieldEnergy y)) z + ∂(vectorGaussianLaw N (varianceIncrement h 0) : Measure (Fin N → ℝ)) := by + let v := fun i => tensorPathProfile I degree n r h i + let G := fun q : (SpinTensorIndex I degree → ℝ) × TensorLabeledData N n => + spinPriorLabeledLog π (fun _ => 0) U (fun _ => 0) I degree 0 n q.1 q.2 + have hp := tensorFlatToLabeled_measurePreserving U I degree 0 n b v + have hm := measurable_spinPriorLabeledLog_root π (fun _ => 0) U (fun _ => 0) I degree 0 n + have hi := (spinPriorLabeledLog_root_variance hgauss hN π (fun _ => 0) U (fun _ => 0) + I degree 0 n b (fun i => v (i+1)) hb (varianceIncrement h 0) + (fun j => varianceIncrement (monomialPath n (r j)) 0)).1.integrable (by norm_num) + change Integrable G ((tensorGaussianLaw I degree (v 0) : Measure _).prod + (tensorLabeledLaw U I degree 0 n b (fun i => v (i+1)))) at hi + have he := hp.hasLaw.integral_comp hm.aestronglyMeasurable + change (∫ p, G (tensorFlatToLabeled U I degree 0 n v p) ∂_) = ∫ q, G q ∂_ at he + simp_rw [spinPriorFlatLog_eq_labeled] + rw [he, integral_prod _ hi] + dsimp only [G] + simp_rw [(spinPriorLabeledLog_conditional hN π (fun _ => 0) U (fun _ => 0) + I degree 0 n b (fun i => v (i+1)) hb _).2.1] + dsimp only [v] + simp_rw [spinPriorCascadeValue_field] + exact (tensorSiteProjection_measurePreserving I degree (v 0) (varianceIncrement h 0) + (fun _ => rfl)).hasLaw.integral_comp + (measurable_cascadeRecursion n b _ (fun _ => measurable_fst.add measurable_snd) + ((measurable_finiteLogIntegral π).comp (measurable_fieldEnergy_map N))).aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldTailBridge.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldTailBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..a18af8711e2fedfda21a744f27f1d00724e5e459 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFieldTailBridge.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactField +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayLaw +import OAI.Probability.InvariantIsing.Arrays.TensorFieldTailBridge + +namespace OAI + +/-! The constrained field-direction test is a continuous spectral-array test. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma spinPriorArrayLaw_field_tail {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (b h : ℕ → ℝ) + (r : Fin k → ℕ) (j : Fin (n + 1)) : + (∫ x, spectralSpinDepthTail n j x + ∂(spinPriorArrayLaw μ π eig c I degree amp n b r h : Measure (SpectralArray (m + 1)))) = + spinPriorReplicaAverage μ π eig c I degree amp n b r h + (fun _ => tensorFieldPairObservable (finiteFieldPath (Pi.single j 1))) := by + classical + refine spinPriorArrayLaw_test μ π eig c I degree amp n b r h _ + (continuous_spectralSpinDepthTail n j) _ ![1,0] ?_ ?_ + · intro a b hab + fin_cases a <;> fin_cases b <;> simp_all + · intro U σ + simp only [spectralSpinDepthTail, spectralSpinArray_joint (specialRotation U) I hdis hcover, + spectralJointEntry_tree, tensorFieldPairObservable, spinPairOverlap, + Matrix.cons_val_zero, Matrix.cons_val_one] + rw [treeOverlap, depthTail_level, finiteFieldPath_single] + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFiniteGG.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFiniteGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..4584e3b5c8a3951fb82ad37e6536f61996ab6fb1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFiniteGG.lean @@ -0,0 +1,190 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorKernelDiagonal + +namespace OAI + +/-! The actual finite constrained-prior spectral Ghirlanda–Guerra residual. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +def spinPriorSpectralGGResidual {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (b : ℕ → ℝ) + (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (D : SpecialOrthogonal N → (Fin (q + 1) → Spin N × LabeledLeaf n) → ℝ) : ℝ := + let avg := fun (q' : ℕ) (F : SpecialOrthogonal N → (Fin q' → Spin N × LabeledLeaf n) → ℝ) => + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h F + let κ := spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) I (degree j) n (r j) + (q + 1 : ℕ) * avg (q + 1 + 1) + (fun U τ => D U (Fin.tail τ) * κ U ((Fin.tail τ) 0) (τ 0)) - + avg (q + 1) D * avg 2 (fun U τ => κ U (τ 1) (τ 0)) - + avg (q + 1) + (fun U σ => D U σ * ∑ l : Fin q, κ U (σ 0) (σ l.succ)) + +private lemma measurable_ggFresh {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + {q : ℕ} (D : Ω → (Fin (q + 1) → X) → ℝ) (κ : Ω → X → X → ℝ) + (hD : Measurable (Function.uncurry D)) + (hκ : Measurable (fun p : Ω × (X × X) => κ p.1 p.2.1 p.2.2)) : + Measurable (Function.uncurry (fun V (τ : Fin (q + 1 + 1) → X) => + D V (Fin.tail τ) * κ V ((Fin.tail τ) 0) (τ 0))) := by + have ht : Measurable (fun p : Ω × (Fin (q + 1 + 1) → X) => (p.1, Fin.tail p.2)) := + measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_pi_apply a.succ).comp measurable_snd) + have hk : Measurable (fun p : Ω × (Fin (q + 1 + 1) → X) => + (p.1, ((Fin.tail p.2) 0, p.2 0))) := + measurable_fst.prodMk (((measurable_pi_apply (0 : Fin (q + 1)).succ).comp measurable_snd).prodMk + ((measurable_pi_apply 0).comp measurable_snd)) + exact (hD.comp ht).mul (hκ.comp hk) + +private lemma measurable_ggPair {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + (κ : Ω → X → X → ℝ) + (hκ : Measurable (fun p : Ω × (X × X) => κ p.1 p.2.1 p.2.2)) : + Measurable (Function.uncurry (fun V (τ : Fin 2 → X) => κ V (τ 1) (τ 0))) := by + have h1 : Measurable (fun p : Ω × (Fin 2 → X) => p.2 1) := + (measurable_pi_apply 1).comp measurable_snd + have h0 : Measurable (fun p : Ω × (Fin 2 → X) => p.2 0) := + (measurable_pi_apply 0).comp measurable_snd + exact hκ.comp (measurable_fst.prodMk (h1.prodMk h0)) + +private lemma measurable_ggOld {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + {q : ℕ} (D : Ω → (Fin (q + 1) → X) → ℝ) (κ : Ω → X → X → ℝ) + (hD : Measurable (Function.uncurry D)) + (hκ : Measurable (fun p : Ω × (X × X) => κ p.1 p.2.1 p.2.2)) : + Measurable (Function.uncurry (fun V (σ : Fin (q + 1) → X) => + D V σ * ∑ l : Fin q, κ V (σ 0) (σ l.succ))) := by + apply hD.mul + apply Finset.measurable_sum + intro l _ + have h0 : Measurable (fun p : Ω × (Fin (q + 1) → X) => p.2 0) := + (measurable_pi_apply 0).comp measurable_snd + have hl : Measurable (fun p : Ω × (Fin (q + 1) → X) => p.2 l.succ) := + (measurable_pi_apply l.succ).comp measurable_snd + exact hκ.comp (measurable_fst.prodMk (h0.prodMk hl)) + +theorem spinPriorFiniteGG_bound {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (β d₀ e C : ℝ) (hC : 0 ≤ C) + (D : SpecialOrthogonal N → (Fin (q + 1) → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hDb : ∀ U σ, |D U σ| ≤ C) + (hE : + let A := spectralPerturbationCoefficients (fun ω : TensorFrozenData N n j => ω.1.1) + I (degree j) n (r j) + let ν := spinPriorFrozenReference π eig c I degree amplitude n r h j + let E := fun p : TensorFrozenData N n j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2 - β| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + Integrable E ((tensorFrozenLaw μ n b j).prod gaussianCoordinates) ∧ + (∫ p, E p ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates) ≤ e) : + |amplitude j| * |spinPriorSpectralGGResidual μ π b eig c I degree amplitude r h j D| ≤ + 2 * C * (e + |amplitude j| * spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) + I (degree j) n (r j) U x x - d₀|)) := by + let U := fun ω : TensorFrozenData N n j => ω.1.1 + let κ := spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) I (degree j) n (r j) + let ν := spinPriorFrozenReference π eig c I degree amplitude n r h j + let A := spectralPerturbationCoefficients U I (degree j) n (r j) + have hκ : Measurable (fun p : SpecialOrthogonal N × + ((Spin N × LabeledLeaf n) × (Spin N × LabeledLeaf n)) => κ p.1 p.2.1 p.2.2) := by + simpa only [spectralPerturbationCoefficients_cross] using + measurable_spectralPerturbationCross (id : SpecialOrthogonal N → SpecialOrthogonal N) + measurable_id I (degree j) n (r j) + let fresh := fun (V : SpecialOrthogonal N) (τ : Fin (q + 1 + 1) → Spin N × LabeledLeaf n) => + D V (Fin.tail τ) * κ V ((Fin.tail τ) 0) (τ 0) + let pair := fun (V : SpecialOrthogonal N) (τ : Fin 2 → Spin N × LabeledLeaf n) => κ V (τ 1) (τ 0) + let old := fun (V : SpecialOrthogonal N) (σ : Fin (q + 1) → Spin N × LabeledLeaf n) => + D V σ * ∑ l : Fin q, κ V (σ 0) (σ l.succ) + have hfresh : Measurable (Function.uncurry fresh) := measurable_ggFresh D κ hD hκ + have hpair : Measurable (Function.uncurry pair) := measurable_ggPair κ hκ + have hold : Measurable (Function.uncurry old) := measurable_ggOld D κ hD hκ + have hdiag : Measurable (Function.uncurry + (fun V x => |κ V x x - d₀|)) := + ((hκ.comp (measurable_fst.prodMk (measurable_snd.prodMk measurable_snd))).sub_const d₀).abs + have hg := spectralPerturbation_gg_bound (P := tensorFrozenLaw μ n b j) U measurable_fst.fst + I (degree j) (r j) (measurable_spinPriorFrozenReference π eig c I degree amplitude n r h j) + (amplitude j) β d₀ (fun ω => D (U ω)) + (hD.comp (measurable_fst.fst.fst.prodMk measurable_snd)) hC (fun ω => hDb (U ω)) hE.1 + have heq (z : ℕ) (F : SpecialOrthogonal N → (Fin z → Spin N × LabeledLeaf n) → ℝ) + (hF : Measurable (Function.uncurry F)) : + randomCoefficientAverage (tensorFrozenLaw μ n b j) ν A (amplitude j) (fun ω => F (U ω)) = + spinPriorReplicaAverage μ π eig c I degree amplitude n b r h F := by + simpa only [Function.update_eq_self] using + spinPriorFrozenGaussian_replicaAverage μ π eig c I degree amplitude n b r h hh h0 j (amplitude j) F hF + have hd := spinPriorFrozenGaussian_observableAverage μ π eig c I degree amplitude n b r h hh h0 j + (amplitude j) (fun V x => |κ V x x - d₀|) hdiag + simp only [Function.update_eq_self] at hd + change |amplitude j| * |(q + 1 : ℕ) * + randomCoefficientAverage (tensorFrozenLaw μ n b j) ν A (amplitude j) (fun ω => fresh (U ω)) - + randomCoefficientAverage (tensorFrozenLaw μ n b j) ν A (amplitude j) (fun ω => D (U ω)) * + randomCoefficientAverage (tensorFrozenLaw μ n b j) ν A (amplitude j) (fun ω => pair (U ω)) - + randomCoefficientAverage (tensorFrozenLaw μ n b j) ν A (amplitude j) (fun ω => old (U ω))| ≤ _ at hg + rw [heq _ fresh hfresh, heq _ D hD, heq _ pair hpair, heq _ old hold] at hg + change |amplitude j| * |spinPriorSpectralGGResidual μ π b eig c I degree amplitude r h j D| ≤ + 2 * C * (_ + |amplitude j| * _) at hg + have hd' : (∫ p : TensorFrozenData N n j × (ℕ → ℝ), ∫ x, + |spectralPerturbationKernel U I (degree j) n (r j) p.1 x x - d₀| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates) = + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun V x => |κ V x x - d₀|) := hd + rw [hd'] at hg + exact hg.trans (mul_le_mul_of_nonneg_left + (add_le_add hE.2 le_rfl) (mul_nonneg (by norm_num) hC)) + +end InvariantIsing +namespace InvariantIsing + +/-- Each individual self-overlap error controls every selected tensor +covariance. The Gaussian energy error is expressed in the same actual model. -/ +theorem spinPriorFiniteGG_individualDiagonal_bound {N m k n q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (β e C : ℝ) (hC : 0 ≤ C) (ha : 0 < |amplitude j|) + (D : SpecialOrthogonal N → (Fin (q + 1) → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hDb : ∀ U σ, |D U σ| ≤ C) + (center δ : Fin m → ℝ) + (hδ : ∀ a, spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|) ≤ δ a) + (hE : + let A := spectralPerturbationCoefficients (fun ω : TensorFrozenData N n j => ω.1.1) + I (degree j) n (r j) + let ν := spinPriorFrozenReference π eig c I degree amplitude n r h j + let E := fun p : TensorFrozenData N n j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2 - β| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + Integrable E ((tensorFrozenLaw μ n b j).prod gaussianCoordinates) ∧ + (∫ p, E p ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates) ≤ e) : + |spinPriorSpectralGGResidual μ π b eig c I degree amplitude r h j D| ≤ + 2 * C * (e / |amplitude j| + ∑ a, (degree j a : ℝ) * δ a) := by + let d₀ := (∏ a, spectralDiagonalCenter (center a) ^ degree j a) * + ((n : ℝ) / (n + 1 : ℕ)) ^ r j + have hg := spinPriorFiniteGG_bound μ π b eig c I degree amplitude r h hh h0 j β d₀ e C hC D hD hDb hE + have hd := spinPriorKernelDiagonalError_le (n := n) μ π b eig c I degree amplitude r h (degree j) (r j) center + have hs : (∑ a, (degree j a : ℝ) * spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|)) ≤ + ∑ a, (degree j a : ℝ) * δ a := + Finset.sum_le_sum fun a _ => mul_le_mul_of_nonneg_left (hδ a) (Nat.cast_nonneg _) + have hb := hg.trans (mul_le_mul_of_nonneg_left + (add_le_add le_rfl (mul_le_mul_of_nonneg_left (hd.trans hs) ha.le)) + (mul_nonneg (by norm_num) hC)) + apply (mul_le_mul_iff_left₀ ha).mp + calc + _ ≤ 2 * C * (e + |amplitude j| * ∑ a, (degree j a : ℝ) * δ a) := by + simpa only [mul_comm] using hb + _ = (2 * C * (e / |amplitude j| + ∑ a, (degree j a : ℝ) * δ a)) * |amplitude j| := by + field_simp [ha.ne'] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFlatLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFlatLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f849df5fe2cd8f5cfe7b9b1ee475e2f4a6d23d8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFlatLaw.lean @@ -0,0 +1,103 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFlatVariance +import OAI.Probability.InvariantIsing.Fields.SpinPriorCascadePressure + +namespace OAI + +/-! Gaussian namespace changes preserve the constrained, quenched cascade +logarithm, including its full probability law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def spinPriorJointFlatLog {N m k n : ℕ} (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) (p : TensorFlatDisorder N n) : ℝ := + priorTensorLog (labeledSpinReference n π p.1.2) eig c I degree amp v (p.1.1,p.2) + +def spinPriorProfileLog {N m k n : ℕ} (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) (p : TensorFlatDisorder N n) : ℝ := + priorNamespacedLog (labeledSpinReference n π p.1.2) eig c I degree amp v (p.1.1,p.2) + +lemma measurable_spinPriorJointFlatLog {N m k n : ℕ} (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (spinPriorJointFlatLog π eig c I degree amp v) := by + have : ∀ p : TensorFlatDisorder N n, + IsProbabilityMeasure ((labeledSpinReference n π ∘ fun p => p.1.2) p) := fun p => by + change IsProbabilityMeasure (labeledSpinReference n π p.1.2) + infer_instance + have hν := (measurable_labeledSpinReference_general n π).comp + (show Measurable (fun p : TensorFlatDisorder N n => p.1.2) from by fun_prop) + have hH : Measurable (fun p : TensorFlatDisorder N n × (Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation p.1.1.1) p.2.1+fieldEnergy c p.2.1+ + cylinderField (tensorLeafCoefficients (specialRotation p.1.1.1) I degree amp n v p.2) p.1.2) := by + apply measurable_from_prod_countable_left + intro x + have hbase : Measurable (fun U : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1) := by + exact ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).pow_const 2).const_mul + (eig i)).const_mul (1/2 : ℝ)).add_const _ + apply (hbase.comp measurable_fst.fst).add + simp only [tensorLeafCoefficients, cylinderField_feature] + apply Finset.measurable_sum + intro i _ + exact (((measurable_spinTensorFeature I degree amp x.1 i.2).comp + measurable_fst.fst).const_mul _).mul + ((measurable_pi_apply (treeFeatureTag n x.2 i)).comp measurable_snd) + exact (measurable_random_referencePartition hν hH).log + +lemma measurable_spinPriorProfileLog {N m k n : ℕ} (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + Measurable (spinPriorProfileLog π eig c I degree amp v) := by + have : ∀ p : TensorFlatDisorder N n, + IsProbabilityMeasure ((labeledSpinReference n π ∘ fun p => p.1.2) p) := fun p => by + change IsProbabilityMeasure (labeledSpinReference n π p.1.2) + infer_instance + have hν := (measurable_labeledSpinReference_general n π).comp + (show Measurable (fun p : TensorFlatDisorder N n => p.1.2) from by fun_prop) + have hH := (measurable_priorNamespacedHamiltonian eig c I degree amp v).comp + (show Measurable (fun p : TensorFlatDisorder N n × (Spin N × LabeledLeaf n) => + ((p.1.1.1,p.1.2),p.2)) from by fun_prop) + exact (measurable_random_referencePartition hν hH).log + +theorem spinPriorProfileLog_law {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (v : Fin (n+1) → SpinTensorIndex I degree → ℝ≥0) : + let P := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + HasLaw (spinPriorProfileLog π eig c I degree amp v) + (P.map (spinPriorJointFlatLog π eig c I degree amp v)) P := by + intro P + have hl := measurable_spinPriorJointFlatLog π eig c I degree amp v + have hr := measurable_spinPriorProfileLog π eig c I degree amp v + refine ⟨hr.aemeasurable, ?_⟩ + apply Measure.ext + intro s hs + rw [Measure.map_apply hr hs, Measure.map_apply hl hs, + Measure.prod_apply (hr hs), Measure.prod_apply (hl hs)] + apply lintegral_congr_ae + apply ae_of_all + intro q + have he := congrArg (fun Q : Measure ℝ => Q s) + (priorNamespacedLog_conditional_law (labeledSpinReference n π q.2) eig c q.1 I degree amp v) + have hlq : Measurable (fun z => spinPriorJointFlatLog π eig c I degree amp v (q,z)) := hl.comp (show Measurable (fun z => (q,z)) from measurable_const.prodMk measurable_id) + have hrq : Measurable (fun z => spinPriorProfileLog π eig c I degree amp v (q,z)) := hr.comp (show Measurable (fun z => (q,z)) from measurable_const.prodMk measurable_id) + change (gaussianCoordinates.map (fun z => spinPriorJointFlatLog π eig c I degree amp v (q,z))) s = + (gaussianCoordinates.map (fun z => spinPriorProfileLog π eig c I degree amp v (q,z))) s at he + rw [Measure.map_apply hlq hs, Measure.map_apply hrq hs] at he + exact he.symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFlatVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFlatVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca277314bf4d97426c9276342758b913fa8b0b42 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFlatVariance.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorRootVariance + +namespace OAI + +/-! Actual root/cascade fluctuations and their flat Gaussian realization, +uniformly over probability spin priors. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def spinPriorFlatLog {N m k : ℕ} (π : Measure (Spin N)) + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) (p : LabeledTree n × (ℕ → ℝ)) : ℝ := + Real.log (∫ x : Spin N × LabeledLeaf n, + Real.exp (rotatedEnergy eig U x.1+fieldEnergy c x.1+ + cylinderField (tensorLeafCoefficients U I degree amp n (fun i => v i) x) p.2) + ∂labeledSpinReference n π p.1) + +lemma spinPriorFlatLog_eq_labeled {N m k : ℕ} (π : Measure (Spin N)) + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) (p : LabeledTree n × (ℕ → ℝ)) : + spinPriorFlatLog π eig U c I degree amp n v p = + spinPriorLabeledLog π eig U c I degree amp n + (tensorFlatToLabeled U I degree amp n v p).1 (tensorFlatToLabeled U I degree amp n v p).2 := by + apply congrArg Real.log + apply integral_congr_ae + exact ae_of_all _ fun x => congrArg Real.exp + (tensorLabeledEnergy_flat_eq eig U c I degree amp n v p x).symm + +lemma spinPriorLabeledLog_root_variance (hpub : GaussianLipschitzVarianceInput) + {N m k : ℕ} (hN : 0 < N) (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (hb : CascadeExponents n b) (site : ℝ≥0) (monomial : Fin k → ℝ≥0) : + let P := (tensorGaussianLaw I degree (tensorVarianceProfile I degree site monomial) : Measure _).prod + (tensorLabeledLaw U I degree amp n b v) + let F := fun q => spinPriorLabeledLog π eig U c I degree amp n q.1 q.2 + MemLp F 2 P ∧ variance F P ≤ + 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 ∂(rawCascadeLaw n b : Measure (RawTree n)))+ + (site : ℝ)*N+∑ j, (monomial j : ℝ)*amp j^2 := by + intro P F + have hr := spinPriorCascadeValue_root_memLp_variance hpub hN π eig U c I degree amp n b v hb site monomial + have hc z := spinPriorLabeledLog_conditional hN π eig U c I degree amp n b v hb z + have hs := variance_of_conditional_center + (tensorGaussianLaw I degree (tensorVarianceProfile I degree site monomial) : Measure _) + (tensorLabeledLaw U I degree amp n b v) + (measurable_spinPriorLabeledLog_root π eig U c I degree amp n) + hr.1 (fun z => (hc z).2.2.1) (fun z => (hc z).2.1) (fun z => (hc z).2.2.2) + exact ⟨hs.1, hs.2.trans (by linarith [hr.2])⟩ + +theorem spinPriorFlatLog_variance (hpub : GaussianLipschitzVarianceInput) + {N m k : ℕ} (hN : 0 < N) (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (site : ℕ → ℝ≥0) (monomial : ℕ → Fin k → ℝ≥0) + (hb : CascadeExponents n b) : + let v := fun i => tensorVarianceProfile I degree (site i) (monomial i) + let P := (labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates + let F := spinPriorFlatLog π eig U c I degree amp n v + MemLp F 2 P ∧ variance F P ≤ + 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 ∂(rawCascadeLaw n b : Measure (RawTree n)))+ + (site 0 : ℝ)*N+∑ j, (monomial 0 j : ℝ)*amp j^2 := by + intro v P F + let G := fun q : (SpinTensorIndex I degree → ℝ) × TensorLabeledData N n => spinPriorLabeledLog π eig U c I degree amp n q.1 q.2 + have hp := tensorFlatToLabeled_measurePreserving U I degree amp n b v + have hm := measurable_spinPriorLabeledLog_root π eig U c I degree amp n + have he : F = G ∘ tensorFlatToLabeled U I degree amp n v := + funext (spinPriorFlatLog_eq_labeled π eig U c I degree amp n v) + have hv := spinPriorLabeledLog_root_variance hpub hN π eig U c I degree amp n b + (fun i => v (i+1)) hb (site 0) (monomial 0) + rw [he] + refine ⟨hv.1.comp_measurePreserving hp, ?_⟩ + exact (hp.variance_fun_comp hm.aemeasurable).trans_le hv.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenCGF.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenCGF.lean new file mode 100644 index 0000000000000000000000000000000000000000..375611411f5325c422185d123d1648c9f23693a6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenCGF.lean @@ -0,0 +1,103 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFrozenReference +import OAI.Probability.InvariantIsing.Pressure.PressureDifferenceConcentration + +namespace OAI + +/-! Frozen Gaussian cumulants in the actual constrained cascade model. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def spinPriorFrozenCGF {N m k : ℕ} (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amp : Fin k → ℝ) (n : ℕ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) (t : ℝ) + (p : TensorFrozenData N n j × (ℕ → ℝ)) : ℝ := + cgf (fun x => cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1.1) I (degree j) n (r j) x) p.2) + (spinPriorFrozenReference π eig c I degree amp n r h j p.1) t + +theorem spinPriorFrozenCGF_eq_log_difference {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (j : Fin k) (t : ℝ) : + spinPriorFrozenCGF π eig c I degree amp n r h j t =ᵐ[(tensorFrozenLaw μ n b j).prod gaussianCoordinates] + fun p => spinPriorNamespacedLog π eig c I degree (Function.update amp j t) r h + (p.1.1, gaussianNamespaceJoin (j+1) (p.2,p.1.2))- + spinPriorNamespacedLog π eig c I degree (Function.update amp j 0) r h + (p.1.1, gaussianNamespaceJoin (j+1) (p.2,p.1.2)) := by + have hbase := (measurePreserving_fst (μ := tensorFrozenLaw μ n b j) + (ν := gaussianCoordinates)).quasiMeasurePreserving.ae + (spinPriorFrozenBase_exp_integrable_ae μ π eig c I degree amp n b r h hh h0 j) + have hfull := (tensorFrozenInsertion_measurePreserving μ n b j).quasiMeasurePreserving.ae + (spinPriorNamespaced_exp_integrable_ae μ π eig c I degree (Function.update amp j t) n b r h hh h0) + filter_upwards [hbase,hfull] with p hb hf + let ν := labeledSpinReference n π p.1.1.2 + let H := tensorFrozenBaseEnergy eig c I degree amp n r h j p.1 + let Y := fun x : Spin N × LabeledLeaf n => cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1.1) I (degree j) n (r j) x) p.2 + have he (a : ℝ) (x : Spin N × LabeledLeaf n) : + tensorNamespacedHamiltonian eig c I degree (Function.update amp j a) n r h + (p.1.1,gaussianNamespaceJoin (j+1) (p.2,p.1.2)) x = H x+a*Y x := by + simpa only [H,Y,tensorNamespacedHamiltonian,tensorFrozenBaseEnergy,Function.update_idem,Function.update_self] using + tensorFrozenEnergy_insert eig c I degree (Function.update amp j a) n r h hh h0 j p.1 p.2 x + have hi : Integrable (fun x => Real.exp (H x+t*Y x)) ν := by + convert hf using 1 + funext x + exact congrArg Real.exp (he t x).symm + change cgf Y (gibbsProbability ν H) t = _ + rw [cgf_fold ν H Y t hb hi] + change Real.log (∫ x, Real.exp (H x+t*Y x) ∂ν)-Real.log (∫ x, Real.exp (H x) ∂ν) = _ + change _ = Real.log (∫ x, Real.exp (tensorNamespacedHamiltonian eig c I degree + (Function.update amp j t) n r h (p.1.1,gaussianNamespaceJoin (j+1) (p.2,p.1.2)) x) ∂ν)- + Real.log (∫ x, Real.exp (tensorNamespacedHamiltonian eig c I degree + (Function.update amp j 0) n r h (p.1.1,gaussianNamespaceJoin (j+1) (p.2,p.1.2)) x) ∂ν) + simp only [he,zero_mul,add_zero] + +theorem spinPriorFrozenCGF_statistics {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (j : Fin k) (t B : ℝ) + (hF : ∀ a : ℝ, a=t ∨ a=0 → + MemLp (spinPriorNamespacedLog (n := n) π eig c I degree (Function.update amp j a) r h) 2 + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates)) + (hv : ∀ a : ℝ, a=t ∨ a=0 → + variance (spinPriorNamespacedLog (n := n) π eig c I degree (Function.update amp j a) r h) + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ≤ B) : + let P := (tensorFrozenLaw μ n b j).prod gaussianCoordinates + let Q := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let M := fun a => ∫ p, spinPriorNamespacedLog π eig c I degree (Function.update amp j a) r h p ∂Q + let Z := spinPriorFrozenCGF π eig c I degree amp n r h j t + MemLp Z 2 P ∧ (∫ p, Z p ∂P)=M t-M 0 ∧ + (∫ p, |Z p-∫ p', Z p' ∂P| ∂P) ≤ 2*Real.sqrt B := by + intro P Q M Z + let F := fun a => spinPriorNamespacedLog (n := n) π eig c I degree (Function.update amp j a) r h + let J := fun p : TensorFrozenData N n j × (ℕ → ℝ) => + (p.1.1,gaussianNamespaceJoin (j+1) (p.2,p.1.2)) + have hp : MeasurePreserving J P Q := tensorFrozenInsertion_measurePreserving μ n b j + have he : Z =ᵐ[P] fun p => (1 : ℝ)*(F t (J p)-F 0 (J p)) := by + simpa only [one_mul] using spinPriorFrozenCGF_eq_log_difference μ π eig c I degree amp n b r h hh h0 j t + have ht := hF t (Or.inl rfl) + have hz := hF 0 (Or.inr rfl) + have hc := centered_scaled_difference_L1_bound P + (ht.comp_measurePreserving hp) (hz.comp_measurePreserving hp) + ((hp.variance_fun_comp ht.aemeasurable).trans_le (hv t (Or.inl rfl))) + ((hp.variance_fun_comp hz.aemeasurable).trans_le (hv 0 (Or.inr rfl))) he + refine ⟨hc.1,?_,?_⟩ + · rw [integral_congr_ae he] + simp only [one_mul] + exact (integral_sub ((ht.comp_measurePreserving hp).integrable (by norm_num)) + ((hz.comp_measurePreserving hp).integrable (by norm_num))).trans + (congrArg₂ (·-·) (hp.hasLaw.integral_comp ht.aestronglyMeasurable) + (hp.hasLaw.integral_comp hz.aestronglyMeasurable)) + · simpa only [abs_one,mul_one,one_mul] using hc.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenGibbs.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenGibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..14a1ccbaee32b980bbe17185b01186c6f89d4982 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenGibbs.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFrozenReference + +namespace OAI + +/-! Frozen Gaussian and diagonal tilts reconstruct the same actual Gibbs law. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem spinPriorFrozenGaussian_reference_fold_ae {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (t : ℝ) : + ∀ᵐ p : TensorFrozenData N n j × (ℕ → ℝ) ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates, + (spinPriorFrozenReference π eig c I degree amplitude n r h j p.1).tilted + (fun x => t * cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1.1) I (degree j) n (r j) x) p.2) = + spinPriorNamespacedReference (n := n) π eig c I degree (Function.update amplitude j t) r h + (p.1.1, gaussianNamespaceJoin (j + 1) (p.2, p.1.2)) := by + have hp := tensorFrozenInsertion_measurePreserving μ n b j + have hbase := (measurePreserving_fst (μ := tensorFrozenLaw μ n b j) + (ν := gaussianCoordinates)).quasiMeasurePreserving.ae + (spinPriorFrozenBase_exp_integrable_ae μ π eig c I degree amplitude n b r h hh h0 j) + have hfull := hp.quasiMeasurePreserving.ae + (spinPriorNamespaced_exp_integrable_ae μ π eig c I degree (Function.update amplitude j t) n b r h hh h0) + filter_upwards [hbase, hfull] with p hb hf + let ν := labeledSpinReference n π p.1.1.2 + let H := tensorFrozenBaseEnergy eig c I degree amplitude n r h j p.1 + let G := fun x : Spin N × LabeledLeaf n => t * cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1.1) I (degree j) n (r j) x) p.2 + have he : tensorNamespacedHamiltonian eig c I degree (Function.update amplitude j t) n r h + (p.1.1, gaussianNamespaceJoin (j + 1) (p.2, p.1.2)) = fun x => H x + G x := by + funext x + have he := tensorFrozenEnergy_insert eig c I degree (Function.update amplitude j t) + n r h hh h0 j p.1 p.2 x + simpa only [tensorNamespacedHamiltonian, tensorFrozenBaseEnergy, Function.update_idem, + Function.update_self, H, G] using he + have hi : Integrable (fun x => Real.exp (H x + G x)) ν := by + convert hf using 1 + funext x + exact congrArg Real.exp (congrFun he x).symm + change (gibbsProbability ν H).tilted G = gibbsProbability ν + (tensorNamespacedHamiltonian eig c I degree (Function.update amplitude j t) n r h + (p.1.1, gaussianNamespaceJoin (j+1) (p.2,p.1.2))) + have hH : Integrable (fun x => Real.exp (H x)) ν := hb + rw [he, gibbsProbability_eq_tilted ν H hH, gibbsProbability_eq_tilted ν (fun x => H x + G x) hi] + rw [tilted_tilted hH G] + rfl + +theorem spinPriorFrozenDiagonal_reference_fold_ae {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (v : Fin m → ℝ) (t : ℝ) (a : Fin m) (w : ℝ) : + ∀ᵐ p : TensorFlatDisorder N n + ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates, + (spinPriorNamespacedReference (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude r h p).tilted + (fun x : Spin N × LabeledLeaf n => N * perturbationScale N * w * + projectedOverlap (specialRotation p.1.1) (I a) x.1 x.1) = + spinPriorNamespacedReference (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude r h p := by + have hb := spinPriorNamespaced_exp_integrable_ae μ π + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude n b r h hh h0 + have hw := spinPriorNamespaced_exp_integrable_ae μ π + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude n b r h hh h0 + filter_upwards [hb, hw] with p hp₀ hpw + let ν := labeledSpinReference n π p.1.2 + let H := tensorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) c I degree amplitude n r h p + let G := fun x : Spin N × LabeledLeaf n => N * perturbationScale N * w * + projectedOverlap (specialRotation p.1.1) (I a) x.1 x.1 + have he : tensorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude n r h p = + fun x => H x + G x := by + funext x + dsimp only [tensorNamespacedHamiltonian, H, G] + rw [rotatedEnergy_diagonal_coordinate hN eig (specialRotation p.1.1) I v t a w x.1] + ring + have hi : Integrable (fun x => Real.exp (H x + G x)) ν := by + convert hpw using 1 + funext x + exact congrArg Real.exp (congrFun he x).symm + change (gibbsProbability ν H).tilted G = gibbsProbability ν + (tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I degree amplitude n r h p) + have hH : Integrable (fun x => Real.exp (H x)) ν := hp₀ + rw [he, gibbsProbability_eq_tilted ν H hH, gibbsProbability_eq_tilted ν (fun x => H x + G x) hi] + rw [tilted_tilted hH G] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenReference.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..e883766dff2ea1af4f1a3ca4a5a1af2f22877947 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorFrozenReference.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorExponential + +namespace OAI + +/-! One independent Gaussian coordinate frozen inside the actual constrained +cascade model. The cascade tree remains part of the external disorder. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def spinPriorFrozenReference {N m k : ℕ} (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amp : Fin k → ℝ) (n : ℕ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) + (ω : TensorFrozenData N n j) : Measure (Spin N × LabeledLeaf n) := + gibbsProbability (labeledSpinReference n π ω.1.2) + (tensorFrozenBaseEnergy eig c I degree amp n r h j ω) + +instance spinPriorFrozenReference_probability {N m k : ℕ} (π : Measure (Spin N)) + [IsProbabilityMeasure π] (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (n : ℕ) (r : Fin k → ℕ) + (h : ℕ → ℝ) (j : Fin k) (ω : TensorFrozenData N n j) : + IsProbabilityMeasure (spinPriorFrozenReference π eig c I degree amp n r h j ω) := + gibbsProbability_probability _ _ + +lemma measurable_spinPriorFrozenReference {N m k : ℕ} (π : Measure (Spin N)) + [IsProbabilityMeasure π] (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (n : ℕ) (r : Fin k → ℕ) + (h : ℕ → ℝ) (j : Fin k) : + Measurable (spinPriorFrozenReference π eig c I degree amp n r h j) := by + have : ∀ ω : TensorFrozenData N n j, IsProbabilityMeasure + ((labeledSpinReference n π ∘ fun ω : TensorFrozenData N n j => ω.1.2) ω) := fun ω => by + change IsProbabilityMeasure (labeledSpinReference n π ω.1.2) + infer_instance + exact measurable_gibbsProbability + (H := Function.uncurry (tensorFrozenBaseEnergy eig c I degree amp n r h j)) + ((measurable_labeledSpinReference_general n π).comp measurable_fst.snd) + (measurable_tensorFrozenBaseEnergy eig c I degree amp n r h j) + +theorem spinPriorFrozenBase_exp_integrable_ae {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) (j : Fin k) : + ∀ᵐ ω ∂tensorFrozenLaw μ n b j, + Integrable (fun x => Real.exp (tensorFrozenBaseEnergy eig c I degree amp n r h j ω x)) + (labeledSpinReference n π ω.1.2) := by + have he := (tensorFrozenInsertion_measurePreserving μ n b j).quasiMeasurePreserving.ae + (spinPriorNamespaced_exp_integrable_ae μ π eig c I degree (Function.update amp j 0) n b r h hh h0) + have he' : ∀ᵐ p : TensorFrozenData N n j × (ℕ → ℝ) + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates, + Integrable (fun x => Real.exp (tensorFrozenBaseEnergy eig c I degree amp n r h j p.1 x)) + (labeledSpinReference n π p.1.1.2) := by + filter_upwards [he] with p hp + convert hp using 1 + funext x + congr 1 + unfold tensorFrozenBaseEnergy + rw [tensorNamespacedField_frozen (specialRotation p.1.1.1) I degree amp n r h hh h0 j x p.2 p.1.2] + filter_upwards [Measure.ae_ae_of_ae_prod he'] with ω hω + obtain ⟨z,hz⟩ := hω.exists + exact hz + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGGMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGGMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f69292509740ecd951e00b17a881bb413d38984 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGGMinimum.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorGaussianMinimum +import OAI.Probability.InvariantIsing.Fields.SpinPriorFiniteGG +import OAI.Probability.InvariantIsing.Fields.SpinPriorMinimumFluctuations + +namespace OAI + +/-! The explicit vanishing GG rate at a constrained-prior coordinate minimum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem spinPriorGaussianGG_at_minimum {N m n q : ℕ} (hN : 0 (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π eig c I degree + (Function.update amplitude j (perturbationAmplitude N j*z)) + r h p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + ∀ z∈Set.Icc (1 : ℝ) 2, + -M w+perturbationWeight j*(w-3/2)^2≤-M z+perturbationWeight j*(z-3/2)^2) + (C : ℝ) (hC : 0≤C) + (D : SpecialOrthogonal N → (Fin (q+1) → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) (hDb : ∀ U σ, |D U σ|≤C) + (center δ : Fin m → ℝ) + (hδ : ∀ a, spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-center a|)≤δ a) : + |spinPriorSpectralGGResidual μ π b eig c I degree amplitude r h j D|≤ + contactGGRate N j L C+2*C*∑ a, (degree j a : ℝ)*δ a := by + let a := perturbationAmplitude N j + let c₀ := N * perturbationWeight j / a ^ 2 + let θ := 1 / perturbationScale N + let G := (2 * c₀ + θ ^ 2) / (2 * θ) + c₀ * (a * contactStep N) + + 4 * (2 * N * Real.sqrt (L / N)) / (a * contactStep N) + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have he' : 0 < perturbationScale N := Real.rpow_pos_of_pos hn _ + have hs' : 0 < contactStep N := Real.rpow_pos_of_pos hn _ + have hθ : 0 < θ := one_div_pos.mpr he' + have ha : 0 < a := perturbationAmplitude_pos hN j + have hc₀ : 0 < c₀ := div_pos (mul_pos hn (perturbationWeight_pos j)) (sq_pos_of_pos ha) + have hG : 0 ≤ G := by dsimp only [G]; positivity + have hE := spinPriorGaussian_energy_at_minimum hN μ π b eig c I degree amplitude r h hh h0 j + w (contactStep N) θ (N * L) hw he hs' hs hθ hF hv hmin + have hamp' : 0 < |amplitude j| := by + rw [hamp, abs_mul, abs_of_pos ha] + exact mul_pos ha (abs_pos.mpr (ne_of_gt (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hw.1))) + have hEa : + let A := spectralPerturbationCoefficients (fun ω : TensorFrozenData N n j => ω.1.1) + I (degree j) n (r j) + let ν := spinPriorFrozenReference π eig c I degree amplitude n r h j + let E := fun p : TensorFrozenData N n j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2 - 2 * c₀ * (a * w - a * (3 / 2))| + ∂(ν p.1).tilted (fun x => amplitude j * cylinderField (A p.1 x) p.2) + Integrable E ((tensorFrozenLaw μ n b j).prod gaussianCoordinates) ∧ + (∫ p, E p ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates) ≤ G := by + simpa only [hamp, spectralPerturbationCoefficients, a, c₀, G, sqrt_dimension_mul hN L, mul_assoc] using hE + have hgg := spinPriorFiniteGG_individualDiagonal_bound μ π b eig c I degree amplitude r h hh h0 j + (2 * c₀ * (a * w - a * (3 / 2))) G C hC hamp' D hD hDb center δ hδ hEa + have hampl : a ≤ |amplitude j| := by + rw [hamp, abs_mul, abs_of_pos ha, abs_of_pos (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hw.1)] + nlinarith [hw.1] + calc + _ ≤ 2 * C * (G / |amplitude j| + ∑ a, (degree j a : ℝ) * δ a) := hgg + _ ≤ 2 * C * (G / a + ∑ a, (degree j a : ℝ) * δ a) := + mul_le_mul_of_nonneg_left + (add_le_add (div_le_div_of_nonneg_left hG ha hampl) le_rfl) (mul_nonneg (by norm_num) hC) + _ = _ := by unfold contactGGRate; dsimp only [G, c₀, θ, a]; ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGaussianMinimum.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGaussianMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9b0d896c68bd29afbcc17a08e16ec6c93d70c40 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGaussianMinimum.lean @@ -0,0 +1,125 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFrozenCGF +import OAI.Probability.InvariantIsing.Spectral.SpectralGG +import OAI.Probability.InvariantIsing.Pressure.PressureCoordinateMinimum + +namespace OAI + +/-! The selected Gaussian energy at the actual constrained-prior minimum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma spinPriorFrozenCGF_mean_bounds {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amplitude : Fin k → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (j : Fin k) (t : ℝ) : + 0≤(∫ p, spinPriorFrozenCGF π eig c I degree amplitude n r h j t p + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates) ∧ + (∫ p, spinPriorFrozenCGF π eig c I degree amplitude n r h j t p + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates)≤t^2/2 := by + let U : TensorFrozenData N n j → SpecialOrthogonal N := fun ω => ω.1.1 + have hb := randomCoefficient_cgf_mean_bounds + (P := tensorFrozenLaw μ n b j) (measurable_spinPriorFrozenReference π eig c I degree amplitude n r h j) + (spectralPerturbationCoefficients U I (degree j) n (r j)) + (measurable_spectralPerturbationFields U measurable_fst.fst I (degree j) n (r j)) + (fun ω x => jointSpectralMonomialCoefficients_variance_le_one + (specialRotation (U ω)) I (degree j) n (r j) x) t + simpa only [spinPriorFrozenCGF,spectralPerturbationCoefficients,U,mul_one] using hb + +theorem spinPriorGaussian_energy_at_minimum {N m n : ℕ} (hN : 0 (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π eig c I degree + (Function.update amplitude j (perturbationAmplitude N j*q)) + r h p ∂((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) + ∀ q∈Set.Icc (1 : ℝ) 2, + -M w+perturbationWeight j*(w-3/2)^2≤-M q+perturbationWeight j*(q-3/2)^2) : + let a := perturbationAmplitude N j + let c₀ := N*perturbationWeight j/a^2 + let P := (tensorFrozenLaw μ n b j).prod gaussianCoordinates + let A := fun ω : TensorFrozenData N n j => + jointSpectralMonomialCoefficients (specialRotation ω.1.1) I (degree j) n (r j) + let ν := spinPriorFrozenReference π eig c I degree amplitude n r h j + let E := fun p : TensorFrozenData N n j × (ℕ → ℝ) => ∫ x, + |cylinderField (A p.1 x) p.2-2*c₀*(a*w-a*(3/2))| + ∂(ν p.1).tilted (fun x => a*w*cylinderField (A p.1 x) p.2) + Integrable E P ∧ (∫ p, E p ∂P)≤ + (2*c₀+K^2)/(2*K)+c₀*(a*s)+4*(2*Real.sqrt B)/(a*s) := by + intro a c₀ P A ν E + let M := fun q => (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π eig c I degree + (Function.update amplitude j (a*q)) r h p + ∂((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) + let L := fun t => ∫ p, spinPriorFrozenCGF π eig c I degree amplitude n r h j t p ∂P + have hn : (0 : ℝ) by + rcases hb with rfl | rfl + · exact hF q hq + · simpa only [mul_zero] using hF 0 (by norm_num)) + (fun b hb => by + rcases hb with rfl | rfl + · exact hv q hq + · simpa only [mul_zero] using hv 0 (by norm_num)) + have hmean (q : ℝ) (hq : |q|≤2) : L (a*q)=N*(M q-M 0) := by + dsimp only [L,P,M] + rw [(hstat q hq).2.1] + simp only [mul_zero] + field_simp [hn.ne'] + have hcost (q : ℝ) (hq : |q|≤2) : + 0≤M q-M 0 ∧ M q-M 0≤(a*q)^2/(2*N) := by + have hb := spinPriorFrozenCGF_mean_bounds (n := n) μ π b eig c I degree amplitude r h j (a*q) + change 0≤L (a*q) ∧ L (a*q)≤(a*q)^2/2 at hb + rw [hmean q hq] at hb + refine ⟨(mul_nonneg_iff_of_pos_left hn).mp hb.1,?_⟩ + apply (le_div_iff₀ (show 0<2*(N : ℝ) by positivity)).mpr + nlinarith [hb.2] + have hwa : |w|≤2 := abs_le.mpr ⟨by linarith [hw.1],hw.2⟩ + have hpen := gaussianCoordinate_minimum_penalty hN j M w hwa + ⟨(hcost (3/2) (by norm_num)).1,(hcost w hwa).2⟩ + (hmin (3/2) (by constructor <;> norm_num)) + obtain ⟨hlo,hhi⟩ := gaussianCoordinate_minimum_interior j hpen he hs' + have hlocal := pressureCoordinate_minimum_rescale (Nat.cast_nonneg N) ha hw hlo hhi + (fun q hq => hmean q (abs_le.mpr ⟨by linarith [hq.1],hq.2⟩)) hmin + have hconc (t : ℝ) (ht : t∈({a*w-a*s,a*w,a*w+a*s} : Set ℝ)) : + (∫ p, |spinPriorFrozenCGF π eig c I degree amplitude n r h j t p-L t| ∂P)≤2*Real.sqrt B := by + have hti : t∈Set.Icc (a*w-a*s) (a*w+a*s) := by + simp only [Set.mem_insert_iff,Set.mem_singleton_iff] at ht + rcases ht with rfl | rfl | rfl <;> constructor <;> nlinarith [mul_pos ha hs] + have htq : t/a∈Set.Icc (1 : ℝ) 2 := by + constructor + · apply (le_div_iff₀ ha).mpr + nlinarith [hti.1] + · apply (div_le_iff₀ ha).mpr + nlinarith [hti.2] + have hta : |t/a|≤2 := abs_le.mpr ⟨by linarith [htq.1],htq.2⟩ + simpa only [mul_div_cancel₀ _ ha.ne'] using (hstat (t/a) hta).2.2 + exact randomCoefficient_energy_at_minimum (P := tensorFrozenLaw μ n b j) + (measurable_spinPriorFrozenReference π eig c I degree amplitude n r h j) A + (measurable_spectralPerturbationFields (fun ω : TensorFrozenData N n j => ω.1.1) + measurable_fst.fst I (degree j) n (r j)) + (fun ω x => jointSpectralMonomialCoefficients_variance_le_one + (specialRotation ω.1.1) I (degree j) n (r j) x) (mul_pos ha hs) hK hlocal hconc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGeometricLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGeometricLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..df2ada1eb3aebcf98f693c41c7e8554f635f3f32 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorGeometricLimit.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorLimitingDiagonal +import OAI.Probability.InvariantIsing.Spectral.SpectralGGGeometry + +namespace OAI + +/-! Every prescribed sequence of actual prior minima has a geometric GG subsequence. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma spinPriorPerturbedArrayLaw_gram {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (h : ℕ → ℝ) : + ∀ᵐ x ∂(spinPriorPerturbedArrayLaw (n := n) μ π b eig c I u v t h : Measure (SpectralArray (m+1))), + SpectralGram x := by + unfold spinPriorPerturbedArrayLaw spinPriorArrayLaw + exact spectralArrayLaw_gram _ _ _ _ _ _ _ + +lemma spinPriorPerturbedArrayLaw_reindex {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (h : ℕ → ℝ) + (e : ℕ → ℕ) (he : Function.Injective e) : + (spinPriorPerturbedArrayLaw (n := n) μ π b eig c I u v t h : Measure (SpectralArray (m+1))).map + (permuteSpectralArray e)=spinPriorPerturbedArrayLaw (n := n) μ π b eig c I u v t h := by + unfold spinPriorPerturbedArrayLaw spinPriorArrayLaw + exact spectralArrayLaw_map_reindex _ _ _ _ _ _ _ e he + + +theorem spinPrior_minimizers_geometric_GG_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (b : ℕ → ℝ) (hb : CascadeExponents n b) + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 spinPriorPerturbedArrayLaw (n := n) (μ (φ k)) (π (φ k)) b (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k))) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) := by + let L := fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k) + let center := fun k => tensorMinimumArrayDiagonal (N k) n (v k) + obtain ⟨Q,q,φ,hφ,hL,hc⟩ := spectralArray_center_subsequence (m+1) L center + have hgg := spinPriorPerturbation_minimizers_spectralGG hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) (fun k => π (φ k)) b hb + (fun k => eig (φ k)) (fun k => c (φ k)) K hK (fun k => heig (φ k)) + (fun k => I (φ k)) (fun k => u (φ k)) (fun k => hu (φ k)) + (fun k => v (φ k)) (fun k => hv (φ k)) (fun k => t (φ k)) (fun k => ht (φ k)) + (fun k => h (φ k)) (fun k => hh (φ k)) (fun k => h0 (φ k)) H (fun k => hH (φ k)) + (fun k => hmin (φ k)) Q hL + have hco : Continuous (fun z : Fin (m+1) → Set.Icc (0 : ℝ) 1 => fun a => (z a : ℝ)) := + continuous_pi fun a => continuous_subtype_val.comp (continuous_apply a) + have hd := spinPriorPerturbation_minimizers_constantDiagonal hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) (fun k => π (φ k)) b hb + (fun k => eig (φ k)) (fun k => c (φ k)) K hK (fun k => heig (φ k)) + (fun k => I (φ k)) (fun k => u (φ k)) (fun k => hu (φ k)) + (fun k => v (φ k)) (fun k => hv (φ k)) (fun k => t (φ k)) (fun k => ht (φ k)) + (fun k => h (φ k)) (fun k => hh (φ k)) (fun k => h0 (φ k)) H (fun k => hH (φ k)) + (fun k => hmin (φ k)) Q hL (fun a => (q a : ℝ)) ((hco.tendsto q).comp hc) + have hg := spectralArray_limit_gram hL (fun k => spinPriorPerturbedArrayLaw_gram + (μ (φ k)) (π (φ k)) b (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k))) + have hr : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q := by + intro e he + exact spectralArray_limit_reindex hL e (fun k => spinPriorPerturbedArrayLaw_reindex + (μ (φ k)) (π (φ k)) b (eig (φ k)) (c (φ k)) (I (φ k)) + (u (φ k)) (v (φ k)) (t (φ k)) (h (φ k)) e he) + exact ⟨Q,q,φ,hφ,hL,hgg,hd,hg,hr, + spectralGG_coordinate_nonnegative hgg hg (fun a => (q a : ℝ)) (fun a => (q a).property.1) hd⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorHaarMean.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorHaarMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..75324b4ae067cd6f79d89272404c5bed87c8bac0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorHaarMean.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFlatLaw + +namespace OAI + +/-! The Gaussian/cascade-averaged logarithm has a rotation modulus uniform +in the normalized spin constraint. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +theorem spinPriorFlatMean_rotation_bound (hgauss : GaussianLipschitzVarianceInput) + {N m k : ℕ} (hN : 0 < N) (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (K : ℝ) (hK : 0 ≤ K) (heig : ∀ i, |eig i| ≤ K) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (hb : CascadeExponents n b) + (site : ℕ → ℝ≥0) (monomial : ℕ → Fin k → ℝ≥0) (U V : SpecialOrthogonal N) : + |(∫ p, spinPriorFlatLog π eig (specialRotation U) c I degree amp n + (fun i => tensorVarianceProfile I degree (site i) (monomial i)) p + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates)- + ∫ p, spinPriorFlatLog π eig (specialRotation V) c I degree amp n + (fun i => tensorVarianceProfile I degree (site i) (monomial i)) p + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates| ≤ + (K*N+2*(∑ i : Fin (n+1), ∑ j, (monomial i j : ℝ)*amp j^2*∑ a, (degree j a : ℝ))) * + frobeniusDistance U V := by + let F := fun W => spinPriorFlatLog π eig (specialRotation W) c I degree amp n + (fun i => tensorVarianceProfile I degree (site i) (monomial i)) + have hi (W : SpecialOrthogonal N) := (spinPriorFlatLog_variance hgauss hN π eig (specialRotation W) + c I degree amp n b site monomial hb).1.integrable (by norm_num) + rw [integral_prod _ (hi U), integral_prod _ (hi V), + ← integral_sub (hi U).integral_prod_left (hi V).integral_prod_left] + have hh := norm_integral_le_of_norm_le_const + (μ := (labeledCascadeLaw n b : Measure (LabeledTree n))) + (f := fun T => (∫ z, F U (T,z) ∂gaussianCoordinates)-∫ z, F V (T,z) ∂gaussianCoordinates) + (C := (K*N+2*(∑ i : Fin (n+1), ∑ j, (monomial i j : ℝ)*amp j^2*∑ a, (degree j a : ℝ)))*frobeniusDistance U V) + (ae_of_all _ fun T => by + simpa only [Real.norm_eq_abs, F, spinPriorFlatLog] using + tensorLeafLogMean_abs_sub_le hN eig c U V K hK heig I degree amp n + (fun i => site i) (fun i => monomial i) (labeledSpinReference n π T)) + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorHaarVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorHaarVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..b73652a8d6f5887f3a3818989924e8b3a972b9a8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorHaarVariance.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorHaarMean + +namespace OAI + +/-! Haar concentration combined with the proved constrained root/cascade +estimate. All constants are independent of the spin constraint. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +theorem spinPriorJointFlatLog_variance (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 < C ∧ ∀ N : ℕ, 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ π : Measure (Spin N), IsProbabilityMeasure π → + ∀ m k n : ℕ, ∀ eig c : Fin N → ℝ, ∀ K : ℝ, 0 < K → (∀ i, |eig i| ≤ K) → + ∀ I : Fin m → Finset (Fin N), ∀ degree : Fin k → Fin m → ℕ, ∀ amp : Fin k → ℝ, + ∀ b : ℕ → ℝ, CascadeExponents n b → ∀ site : ℕ → ℝ≥0, ∀ monomial : ℕ → Fin k → ℝ≥0, + let v := fun i => tensorVarianceProfile I degree (site i) (monomial i) + let P := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let F := spinPriorJointFlatLog π eig c I degree amp (fun i => v i) + let L := K*N+2*(∑ i : Fin (n+1), ∑ j, (monomial i j : ℝ)*amp j^2*∑ a, (degree j a : ℝ)) + MemLp F 2 P ∧ variance F P ≤ + 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 ∂(rawCascadeLaw n b : Measure (RawTree n)))+ + (site 0 : ℝ)*N+∑ j, (monomial 0 j : ℝ)*amp j^2+C*L^2/N := by + obtain ⟨C,hC,hvar⟩ := haar_frobeniusLipschitz_variance hhaar + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv π hπ m k n eig c K hK heig I degree amp b hb site monomial v P F L + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure π := hπ + let τ := (labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates + let G := fun q : SpecialOrthogonal N × (LabeledTree n × (ℕ → ℝ)) => F ((q.1,q.2.1),q.2.2) + let M := fun U => ∫ p, G (U,p) ∂τ + have hmG : Measurable G := (measurable_spinPriorJointFlatLog π eig c I degree amp _).comp + (show Measurable (fun q : SpecialOrthogonal N × (LabeledTree n × (ℕ → ℝ)) => + ((q.1,q.2.1),q.2.2)) from by fun_prop) + have hm : Measurable M := hmG.stronglyMeasurable.integral_prod_right'.measurable + have hsec U := spinPriorFlatLog_variance hgauss (by omega : 0 G (U,p)) τ := (hsec U).1.integrable (by norm_num) + have hL : 0 < L := by + dsimp only [L] + exact add_pos_of_pos_of_nonneg (mul_pos hK (by exact_mod_cast (show 0 + spinPriorFlatMean_rotation_bound hgauss (by omega) π eig c K hK.le heig + I degree amp n b hb site monomial U V + + have hM := haar_frobeniusLipschitz_memLp_two hhaar N hN μ hμinv M hm L hL hLip + have hg := variance_of_conditional_center μ τ hmG hM + (fun U => ((hsec U).1.sub (memLp_const (M U))).integrable_sq) (fun _ => rfl) + (fun U => by + have he := variance_eq_integral (hsec U).1.aemeasurable + change variance (fun p => G (U,p)) τ = ∫ p, (G (U,p)-M U)^2 ∂τ at he + rw [← he] + exact (hsec U).2) + have hp := (measurePreserving_prodAssoc μ (labeledCascadeLaw n b : Measure (LabeledTree n)) + gaussianCoordinates) + let φ := fun p : TensorFlatDisorder N n => (p.1.1,p.1.2,p.2) + have hφ : MeasurePreserving φ P (μ.prod τ) := hp + have hFG : G ∘ φ = F := rfl + have hF : MemLp F 2 P := by + have hh : MemLp (G ∘ φ) 2 P := hg.1.comp_measurePreserving hφ + exact hFG ▸ hh + have hvarF : variance F P = variance G (μ.prod τ) := + (congrArg (fun f => variance f P) hFG).symm.trans (hφ.variance_fun_comp hmG.aemeasurable) + exact ⟨hF, hvarF.trans_le (hg.2.trans + (add_le_add le_rfl (hvar N hN μ hμ hμinv M hm L hL hLip)))⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorKernelDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorKernelDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..316251664e123a97f40390acede9218c10a4dd5b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorKernelDiagonal.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorObservableAverageLaw +import OAI.Probability.InvariantIsing.Arrays.TensorKernelDiagonalError + +namespace OAI + +/-! Coordinate deviations control the selected kernel for constrained priors. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem spinPriorMonomialDiagonalError_le {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (d : Fin m → ℕ) (center : Fin m → ℝ) : + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |(∏ a, projectedOverlap (specialRotation U) (I a) x.1 x.1 ^ d a) - + ∏ a, spectralDiagonalCenter (center a) ^ d a|) ≤ + ∑ a, (d a : ℝ) * spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|) := by + let P := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let ν := spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h + let D := fun (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) => + |(∏ a, projectedOverlap (specialRotation U) (I a) x.1 x.1 ^ d a) - + ∏ a, spectralDiagonalCenter (center a) ^ d a| + let E := fun (a : Fin m) (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) => + |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a| + let C := fun a => 1 + |center a| + have hE (a : Fin m) : Measurable (Function.uncurry (E a)) := + measurable_spectralDiagonalDeviation (I a) n (center a) + have hD : Measurable (Function.uncurry D) := by + apply measurable_from_prod_countable_left + intro x + exact ((Finset.measurable_prod _ fun a _ => + (measurable_projectedOverlap (I a) x.1 x.1).pow_const (d a)).sub_const _).abs + have hEb (a : Fin m) (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : |E a U x| ≤ C a := + spectralDiagonalDeviation_abs_le (specialRotation U) (I a) (center a) x.1 + have hle (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : + D U x ≤ ∑ a, (d a : ℝ) * E a U x := + spectralMonomial_clipped_self_deviation_le (specialRotation U) I d center x.1 + have hDb (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf n) : + |D U x| ≤ ∑ a, (d a : ℝ) * C a := by + rw [abs_of_nonneg (abs_nonneg _)] + exact (hle U x).trans (Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_left ((le_abs_self _).trans (hEb a U x)) (Nat.cast_nonneg _)) + have hiE (a : Fin m) : Integrable (fun p : TensorFlatDisorder N n => ∫ x, E a p.1.1 x ∂ν p) P := + spinPriorObservableAverage_integrable μ π eig c I degree amplitude n b r h (E a) (hE a) (hEb a) + have hiD : Integrable (fun p : TensorFlatDisorder N n => ∫ x, D p.1.1 x ∂ν p) P := + spinPriorObservableAverage_integrable μ π eig c I degree amplitude n b r h D hD hDb + have hiS : Integrable (fun p : TensorFlatDisorder N n => + ∑ a, (d a : ℝ) * ∫ x, E a p.1.1 x ∂ν p) P := + integrable_finsetSum _ (fun a _ => (hiE a).const_mul (d a : ℝ)) + change (∫ p, ∫ x, D p.1.1 x ∂ν p ∂P) ≤ + ∑ a, (d a : ℝ) * ∫ p, ∫ x, E a p.1.1 x ∂ν p ∂P + calc + _ ≤ ∫ p : TensorFlatDisorder N n, ∑ a, (d a : ℝ) * ∫ x, E a p.1.1 x ∂ν p ∂P := by + apply integral_mono hiD hiS + intro p + have hiD' : Integrable (D p.1.1) (ν p) := + Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable _ (ae_of_all _ fun x => by + simpa only [Real.norm_eq_abs] using hDb p.1.1 x) + have hiE' (a : Fin m) : Integrable (E a p.1.1) (ν p) := + Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable _ (ae_of_all _ fun x => by + simpa only [Real.norm_eq_abs] using hEb a p.1.1 x) + calc + _ ≤ ∫ x, ∑ a, (d a : ℝ) * E a p.1.1 x ∂ν p := + integral_mono hiD' (integrable_finsetSum _ (fun a _ => (hiE' a).const_mul _)) (hle p.1.1) + _ = _ := by rw [integral_finsetSum _ (fun a _ => (hiE' a).const_mul _)]; simp_rw [integral_const_mul] + _ = _ := by rw [integral_finsetSum _ (fun a _ => (hiE a).const_mul _)]; simp_rw [integral_const_mul] + + +theorem spinPriorKernelDiagonalError_le {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (r : Fin k → ℕ) (h : ℕ → ℝ) + (d : Fin m → ℕ) (treeDegree : ℕ) (center : Fin m → ℝ) : + spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) + I d n treeDegree U x x - + (∏ a, spectralDiagonalCenter (center a) ^ d a) * ((n : ℝ) / (n + 1 : ℕ)) ^ treeDegree|) ≤ + ∑ a, (d a : ℝ) * spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center a|) := by + let Z := spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |(∏ a, projectedOverlap (specialRotation U) (I a) x.1 x.1 ^ d a) - + ∏ a, spectralDiagonalCenter (center a) ^ d a|) + have hZ : 0 ≤ Z := integral_nonneg (fun _ => integral_nonneg (fun _ => abs_nonneg _)) + have he : spinPriorObservableAverage (n := n) μ π eig c I degree amplitude b r h + (fun U x => |spectralPerturbationKernel (id : SpecialOrthogonal N → SpecialOrthogonal N) + I d n treeDegree U x x - + (∏ a, spectralDiagonalCenter (center a) ^ d a) * ((n : ℝ) / (n + 1 : ℕ)) ^ treeDegree|) = + Z * ((n : ℝ) / (n + 1 : ℕ)) ^ treeDegree := by + unfold spinPriorObservableAverage Z + simp_rw [tensorKernel_diagonal_deviation, integral_mul_const] + rfl + rw [he] + exact (mul_le_of_le_one_right hZ (pow_le_one₀ (finiteTreeDiagonal_mem n).1 (finiteTreeDiagonal_mem n).2)).trans + (spinPriorMonomialDiagonalError_le μ π b eig c I degree amplitude r h d center) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLabeledMoments.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLabeledMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c54e56dc8e034fb53ca4567ebadd39ee205c21d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLabeledMoments.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorGaussianLaw +import OAI.Probability.InvariantIsing.Fields.PriorFieldLogNormalizer + +namespace OAI + +/-! Conditional cascade moments for the actual tensor field with an arbitrary +probability spin constraint. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +def spinPriorCascadeValue {N m k : ℕ} (π : Measure (Spin N)) + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (z : SpinTensorIndex I degree → ℝ) : ℝ := + energyRecursion n b (fun i => tensorEnergyMarkLaw U I degree amp (v i)) π + (tensorSpinBaseEnergy eig U c I degree amp z) + +def spinPriorLabeledLog {N m k : ℕ} (π : Measure (Spin N)) + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (z : SpinTensorIndex I degree → ℝ) (p : TensorLabeledData N n) : ℝ := + Real.log (∫ x, Real.exp (tensorLabeledEnergy eig U c I degree amp n z p x) + ∂labeledSpinReference n π p.1) + +lemma measurable_spinPriorCascadeValue {N m k : ℕ} (π : Measure (Spin N)) + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) : + Measurable (spinPriorCascadeValue π eig U c I degree amp n b v) := by + apply (measurable_energyRecursion n b _ π).comp + unfold tensorSpinBaseEnergy spinTensorEnergy + fun_prop + +lemma measurable_spinPriorLabeledLog_root {N m k : ℕ} (π : Measure (Spin N)) + [IsProbabilityMeasure π] (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (n : ℕ) : + Measurable (fun q : (SpinTensorIndex I degree → ℝ) × TensorLabeledData N n => + spinPriorLabeledLog π eig U c I degree amp n q.1 q.2) := by + have : ∀ q : (SpinTensorIndex I degree → ℝ) × TensorLabeledData N n, + IsProbabilityMeasure ((labeledSpinReference n π ∘ fun q => q.2.1) q) := fun q => by + change IsProbabilityMeasure (labeledSpinReference n π q.2.1) + infer_instance + exact (measurable_random_referencePartition + ((measurable_labeledSpinReference_general n π).comp measurable_snd.fst) + (measurable_tensorLabeledEnergy_root eig U c I degree amp n)).log + +theorem spinPriorLabeledLog_conditional {N m k : ℕ} (hN : 0 < N) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (hb : CascadeExponents n b) (z : SpinTensorIndex I degree → ℝ) : + let P := tensorLabeledLaw U I degree amp n b v + let F := spinPriorLabeledLog π eig U c I degree amp n z + let X := spinPriorCascadeValue π eig U c I degree amp n b v z + Integrable F P ∧ (∫ p, F p ∂P) = X ∧ + Integrable (fun p => (F p-X)^2) P ∧ + (∫ p, (F p-X)^2 ∂P) ≤ + 4 * ∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n)) := by + intro P F X + let μ := fun i => tensorEnergyMarkLaw U I degree amp (v i) + let H := tensorSpinBaseEnergy eig U c I degree amp z + let J := fun p : TensorLabeledData N n => + labeledNoiseJoin (Spin N → ℝ) n (p.1, markForestOfCoords (Spin N → ℝ) n p.2) + have hp : MeasurePreserving J P (noiseCascadeLaw (Spin N → ℝ) n b μ : Measure _) := + (show MeasurePreserving (labeledNoiseJoin (Spin N → ℝ) n) + ((labeledCascadeLaw n b : Measure (LabeledTree n)).prod (markForestLaw (Spin N → ℝ) n μ)) + (noiseCascadeLaw (Spin N → ℝ) n b μ : Measure _) from + ⟨measurable_labeledNoiseJoin _ _, labeledNoiseJoin_law _ _ _ _⟩).comp + (cascadeCoordinates_preserving n b μ) + have he0 := (cascadeCoordinates_preserving n b μ).quasiMeasurePreserving.ae + (labeledEnergyLog_eq_cascade n b hb μ π H) + have he : F =ᵐ[P] fun p => cascadeEnergyLog n b μ π H (J p) := by + filter_upwards [he0] with p hpe + simpa only [F, spinPriorLabeledLog, tensorLabeledEnergy, cascadeCoordinateEnergy_eq, labeledEnergyLog] using hpe + have hc := cascadeEnergyLog_conditional n b hb μ π + (fun i _ => tensorEnergyMarkLaw_moments hN U I degree amp (v i)) H + have hs : (fun p => (F p-X)^2) =ᵐ[P] + fun p => (cascadeEnergyLog n b μ π H (J p)-X)^2 := he.fun_comp (fun x => (x-X)^2) + refine ⟨(hp.integrable_comp_of_integrable hc.1).congr he.symm, ?_, + (hp.integrable_comp_of_integrable hc.2.2.1).congr hs.symm, ?_⟩ + · rw [integral_congr_ae he] + exact (integral_comp_preserving_ae hp hc.1.aestronglyMeasurable).trans hc.2.1 + · rw [integral_congr_ae hs] + change (∫ p, (cascadeEnergyLog n b μ π H (J p)-energyRecursion n b μ π H)^2 ∂P) ≤ _ + rw [integral_comp_preserving_ae hp hc.2.2.1.aestronglyMeasurable] + exact hc.2.2.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLeafTail.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLeafTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..f463916b120e5279183d9fca9a16ee24f0fc59f2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLeafTail.lean @@ -0,0 +1,242 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorReplicaAverage +import OAI.Probability.InvariantIsing.Fields.SpinPriorExponential +import OAI.Probability.InvariantIsing.Arrays.TensorLeafTail + +namespace OAI + +/-! The finite cascade prefix law retains an arbitrary deterministic spin constraint. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Topology NNReal +namespace InvariantIsing + +def spinPriorLabeledReference {N : ℕ} (π : Measure (Spin N)) (n : ℕ) + (p : TensorLabeledData N n) : Measure (Spin N × LabeledLeaf n) := + labeledSpinReference n π p.1 + +instance spinPriorLabeledReference_probability {N : ℕ} (π : Measure (Spin N)) + [IsProbabilityMeasure π] (n : ℕ) (p : TensorLabeledData N n) : + IsProbabilityMeasure (spinPriorLabeledReference π n p) := by + unfold spinPriorLabeledReference + infer_instance + +lemma measurable_spinPriorLabeledReference {N : ℕ} (π : Measure (Spin N)) + [IsProbabilityMeasure π] (n : ℕ) : Measurable (spinPriorLabeledReference π n) := + (measurable_labeledSpinReference_general n π).comp measurable_fst + +lemma spinPriorLabeled_tilted_parent_tail {N m k : ℕ} (hN : 0 < N) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (hb : CascadeExponents n b) (z : SpinTensorIndex I degree → ℝ) (d : Fin n) : + (∫ p, referenceReplicaMean (spinPriorLabeledReference π n p) + (tensorLabeledEnergy eig U c I degree amp n z p) (tensorLeafPrefixTest d) + ∂tensorLabeledLaw U I degree amp n b v) = 1 - b d := + cascadeCoordinate_tilted_label_tail n b hb + (fun i => tensorEnergyMarkLaw U I degree amp (v i)) π + (fun i _ => tensorEnergyMarkLaw_moments hN U I degree amp (v i)) _ d + +lemma spinPriorFlat_leafPrefix_mean {N m k : ℕ} (hN : 0 < N) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (hb : CascadeExponents n b) (d : Fin n) : + (∫ p : LabeledTree n × (ℕ → ℝ), + referenceReplicaMean (labeledSpinReference n π p.1) + (fun x => rotatedEnergy eig U x.1 + fieldEnergy c x.1 + + cylinderField (tensorLeafCoefficients U I degree amp n (fun i => v i) x) p.2) + (tensorLeafPrefixTest d) + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates) = 1 - b d := by + let F := fun p : (SpinTensorIndex I degree → ℝ) × TensorLabeledData N n => + referenceReplicaMean (spinPriorLabeledReference π n p.2) + (tensorLabeledEnergy eig U c I degree amp n p.1 p.2) (tensorLeafPrefixTest d) + have : ∀ p : (SpinTensorIndex I degree → ℝ) × TensorLabeledData N n, + IsProbabilityMeasure ((spinPriorLabeledReference π n ∘ Prod.snd) p) := fun p => by + dsimp only [Function.comp_apply] + infer_instance + have hF : Measurable F := measurable_random_referenceReplicaMean + ((measurable_spinPriorLabeledReference π n).comp measurable_snd) + (measurable_tensorLabeledEnergy_root eig U c I degree amp n) + ((measurable_of_countable (tensorLeafPrefixTest (N := N) d)).comp measurable_snd) + have hFb p : |F p| ≤ 1 := referenceReplicaMean_abs_le _ _ _ + (measurable_of_countable _) zero_le_one (tensorLeafPrefixTest_abs_le d) + have hi : Integrable F + ((tensorGaussianLaw I degree (v 0) : Measure (SpinTensorIndex I degree → ℝ)).prod + (tensorLabeledLaw U I degree amp n b (fun i => v (i + 1)))) := + integrable_of_measurable_abs_le hF hFb + calc + _ = ∫ p, F (tensorFlatToLabeled U I degree amp n v p) + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates := by + apply integral_congr_ae + refine ae_of_all _ fun p => ?_ + dsimp only [F] + have he : tensorLabeledEnergy eig U c I degree amp n + (tensorFlatToLabeled U I degree amp n v p).1 + (tensorFlatToLabeled U I degree amp n v p).2 = + fun x => rotatedEnergy eig U x.1 + fieldEnergy c x.1 + + cylinderField (tensorLeafCoefficients U I degree amp n (fun i => v i) x) p.2 := by + funext x + exact tensorLabeledEnergy_flat_eq eig U c I degree amp n v p x + rw [he] + rfl + _ = ∫ p, F p ∂(tensorGaussianLaw I degree (v 0) : Measure _).prod + (tensorLabeledLaw U I degree amp n b (fun i => v (i + 1))) := + (tensorFlatToLabeled_measurePreserving U I degree amp n b v).hasLaw.integral_comp + hF.aestronglyMeasurable + _ = ∫ z, ∫ T, F (z,T) ∂tensorLabeledLaw U I degree amp n b (fun i => v (i + 1)) + ∂(tensorGaussianLaw I degree (v 0) : Measure _) := integral_prod _ hi + _ = 1 - b d := by + have he (z : SpinTensorIndex I degree → ℝ) : + (∫ T, F (z,T) ∂tensorLabeledLaw U I degree amp n b (fun i => v (i + 1))) = 1 - b d := + spinPriorLabeled_tilted_parent_tail hN π eig U c I degree amp n b _ hb z d + simp_rw [he] + simp only [integral_const, probReal_univ, one_smul] + + +lemma spinPriorGaussian_replicaMean_namespace {N m k r : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (T : LabeledTree n) (v : Fin (n + 1) → SpinTensorIndex I degree → ℝ≥0) + (D : (Fin r → Spin N × LabeledLeaf n) → ℝ) : + (∫ z, referenceReplicaMean (labeledSpinReference n π T) + (fun x => rotatedEnergy eig U x.1 + fieldEnergy c x.1 + + cylinderField (tensorLeafCoefficients U I degree amp n v x) z) D ∂gaussianCoordinates) = + (∫ z, referenceReplicaMean (labeledSpinReference n π T) + (fun x => rotatedEnergy eig U x.1 + fieldEnergy c x.1 + + cylinderField (tensorNamespacedCoefficients U I degree amp n v x) z) D ∂gaussianCoordinates) := by + let ν := labeledSpinReference n π T + let H := fun x : Spin N × LabeledLeaf n => rotatedEnergy eig U x.1 + fieldEnergy c x.1 + let F := fun f : Spin N × LabeledLeaf n → ℝ => referenceReplicaMean ν (fun x => H x + f x) D + have hν : Measurable (fun _ : (Spin N × LabeledLeaf n → ℝ) => ν) := measurable_const + have : ∀ f : (Spin N × LabeledLeaf n → ℝ), IsProbabilityMeasure ((fun _ => ν) f) := + fun _ => inferInstanceAs (IsProbabilityMeasure (labeledSpinReference n + π T)) + have hH : Measurable (fun p : (Spin N × LabeledLeaf n → ℝ) × (Spin N × LabeledLeaf n) => + H p.2 + p.1 p.2) := by + apply measurable_from_prod_countable_left + intro x + exact (show Measurable (fun _ : (Spin N × LabeledLeaf n → ℝ) => H x) from + measurable_const).add (measurable_pi_apply x) + have hF : Measurable F := measurable_random_referenceReplicaMean hν hH + ((measurable_of_countable D).comp measurable_snd) + have hleft : Measurable (fun z x => cylinderField (tensorLeafCoefficients U I degree amp n v x) z) := + Measurable.of_eval (fun _ => measurable_cylinderField _) + have hright : Measurable (fun z x => cylinderField (tensorNamespacedCoefficients U I degree amp n v x) z) := + Measurable.of_eval (fun _ => measurable_cylinderField _) + have hL := integral_map (μ := gaussianCoordinates) hleft.aemeasurable hF.aestronglyMeasurable + have hR := integral_map (μ := gaussianCoordinates) hright.aemeasurable hF.aestronglyMeasurable + rw [tensorNamespacedFields_law] at hL + exact hL.symm.trans hR + + +lemma measurable_spinPriorFlat_replicaMean {N m k r : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (v : Fin (n + 1) → SpinTensorIndex I degree → ℝ≥0) + (D : (Fin r → Spin N × LabeledLeaf n) → ℝ) : + Measurable (fun p : LabeledTree n × (ℕ → ℝ) => + referenceReplicaMean (labeledSpinReference n π p.1) + (fun x => rotatedEnergy eig U x.1 + fieldEnergy c x.1 + + cylinderField (tensorLeafCoefficients U I degree amp n v x) p.2) D) := by + let ν : LabeledTree n × (ℕ → ℝ) → Measure (Spin N × LabeledLeaf n) := fun p => + labeledSpinReference n π p.1 + let H : (LabeledTree n × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) → ℝ := fun p => + rotatedEnergy eig U p.2.1 + fieldEnergy c p.2.1 + + cylinderField (tensorLeafCoefficients U I degree amp n v p.2) p.1.2 + have : ∀ p, IsProbabilityMeasure (ν p) := fun p => + inferInstanceAs (IsProbabilityMeasure (labeledSpinReference n + π p.1)) + have hν : Measurable ν := + (measurable_labeledSpinReference_general n π).comp + measurable_fst + have hH : Measurable H := by + apply measurable_from_prod_countable_left + intro x + change Measurable (fun p : LabeledTree n × (ℕ → ℝ) => + (rotatedEnergy eig U x.1 + fieldEnergy c x.1) + + cylinderField (tensorLeafCoefficients U I degree amp n v x) p.2) + exact (show Measurable (fun _ : LabeledTree n × (ℕ → ℝ) => + rotatedEnergy eig U x.1 + fieldEnergy c x.1) from + measurable_const).add ((measurable_cylinderField + (tensorLeafCoefficients U I degree amp n v x)).comp measurable_snd) + have hD : Measurable (fun p : (LabeledTree n × (ℕ → ℝ)) × + (Fin r → Spin N × LabeledLeaf n) => D p.2) := + (measurable_of_countable D).comp measurable_snd + exact measurable_random_referenceReplicaMean hν hH hD + + +lemma spinPriorReplicaAverage_leafPrefix {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hb : CascadeExponents n b) (hh : Monotone h) (h0 : 0 ≤ h 0) (d : Fin n) : + spinPriorReplicaAverage μ π eig c I degree amp n b r h + (fun _ => tensorLeafPrefixTest d) = 1 - b d := by + let D := tensorLeafPrefixTest (N := N) d + let ν := fun p : TensorFlatDisorder N n => + labeledSpinReference n π p.1.2 + let F := fun p : TensorFlatDisorder N n => referenceReplicaMean (ν p) + (tensorNamespacedHamiltonian eig c I degree amp n r h p) D + have : ∀ p, IsProbabilityMeasure (ν p) := fun p => + inferInstanceAs (IsProbabilityMeasure (labeledSpinReference n + π p.1.2)) + have hν : Measurable ν := + (measurable_labeledSpinReference_general n π).comp + measurable_fst.snd + have hF : Measurable F := measurable_random_referenceReplicaMean hν + (measurable_tensorNamespacedHamiltonian eig c I degree amp n r h) + ((measurable_of_countable D).comp measurable_snd) + have hFb p : |F p| ≤ 1 := referenceReplicaMean_abs_le _ _ _ + (measurable_of_countable D) zero_le_one (tensorLeafPrefixTest_abs_le d) + have hFi : Integrable F ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod + gaussianCoordinates) := integrable_of_measurable_abs_le hF hFb + calc + _ = ∫ p, F p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod + gaussianCoordinates := by + unfold spinPriorReplicaAverage + apply integral_congr_ae + filter_upwards [spinPriorNamespaced_exp_integrable_ae μ π eig c I degree amp n b r h hh h0] + with p hp + exact referenceReplicaMean_gibbsProbability (ν p) + (tensorNamespacedHamiltonian eig c I degree amp n r h p) hp D + _ = ∫ p, ∫ z, F (p,z) ∂gaussianCoordinates + ∂μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n)) := integral_prod _ hFi + _ = ∫ U, ∫ T, ∫ z, F ((U,T),z) ∂gaussianCoordinates + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) ∂μ := + integral_prod _ hFi.integral_prod_left + _ = ∫ _U, 1 - b d ∂μ := by + apply integral_congr_ae + refine ae_of_all _ fun U => ?_ + let v := tensorPathProfile I degree n r h + let G := fun p : LabeledTree n × (ℕ → ℝ) => + referenceReplicaMean (labeledSpinReference n π p.1) + (fun x => rotatedEnergy eig (specialRotation U) x.1 + fieldEnergy c x.1 + + cylinderField (tensorLeafCoefficients (specialRotation U) I degree amp n (fun i => v i) x) p.2) D + have hG : Measurable G := measurable_spinPriorFlat_replicaMean π eig + (specialRotation U) c I degree amp n (fun i => v i) D + have hGi : Integrable G ((labeledCascadeLaw n b : Measure (LabeledTree n)).prod + gaussianCoordinates) := integrable_of_measurable_abs_le hG (fun _ => + referenceReplicaMean_abs_le _ _ D (measurable_of_countable D) zero_le_one + (tensorLeafPrefixTest_abs_le d)) + calc + _ = ∫ T, ∫ z, G (T,z) ∂gaussianCoordinates + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) := by + apply integral_congr_ae + refine ae_of_all _ fun T => ?_ + exact (spinPriorGaussian_replicaMean_namespace π eig (specialRotation U) c I degree amp + n T (fun i => v i) D).symm + _ = ∫ p, G p ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod gaussianCoordinates := + (integral_prod _ hGi).symm + _ = 1 - b d := spinPriorFlat_leafPrefix_mean hN π eig (specialRotation U) c I degree amp n b v hb d + _ = _ := by simp only [integral_const, probReal_univ, one_smul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLimitingDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLimitingDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..38b5ca2c8b2ba35e153061c7db44c6fe8d6bfde0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLimitingDiagonal.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorLimitingGG +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayDiagonal +import OAI.Probability.InvariantIsing.Arrays.TensorLimitingDiagonal + +namespace OAI + +/-! Deterministic diagonals in constrained-prior weak limits. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem spinPriorPerturbation_minimizers_constantDiagonal + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (b : ℕ → ℝ) (hb : CascadeExponents n b) + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) + (q : Fin (m+1) → ℝ) + (hc : Tendsto (fun k a => (tensorMinimumArrayDiagonal (N k) n (v k) a : ℝ)) atTop (𝓝 q)) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a := by + obtain ⟨C,hC,hbound⟩ := spinPriorPerturbation_minimum_bounds hhaar hgauss + apply spectralArray_constant_diagonal_of_weak_limit _ Q hL _ q hc + intro i a + refine Fin.lastCases ?_ (fun a => ?_) a + · simp only [tensorMinimumArrayDiagonal,Fin.lastCases_last, + spinPriorPerturbedArrayLaw,spinPriorArrayLaw_treeDiagonal] + exact tendsto_const_nhds + · let L := 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n)))+H+4+C*(K+4*m+8)^2 + have he : ∀ᶠ k in atTop, perturbationScale (N k)≤1/32 := + (perturbationScale_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + have hs : ∀ᶠ k in atTop, contactStep (N k)≤1/4 := + (contactStep_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + apply squeeze_zero' (Eventually.of_forall fun k => integral_nonneg (fun x => abs_nonneg _)) _ + ((diagonalContactRate_tendsto L).comp hNlim) + filter_upwards [he,hs] with k he hs + have hd := (hbound (N k) (hN k) (μ k) inferInstance (hμinv k) m n (π k) inferInstance b hb + (eig k) (c k) K hK (heig k) (I k) (u k) (hu k) (v k) (hv k) (t k) (ht k) + (h k) (hh k) (h0 k) H (hH k) he hs (hmin k)).1 a + have hd' := (spinPriorSpectralDiagonal_clipping (n := n) (μ k) (π k) b + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j : Fin (N k) => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude (N k) (u k)) + (fun j : Fin (N k) => enumeratedTreeDegree m j) (h k) a + (diagonalMinimumCenter (N k) (v k a))).trans hd + simpa only [spinPriorPerturbedArrayLaw,tensorMinimumArrayDiagonal,Fin.lastCases_castSucc, + spinPriorArrayLaw_spectralDiagonal,L,Function.comp_def] using hd' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLimitingGG.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLimitingGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ff613441a0ebb5b41231d9c45cc90fdcfbf438c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorLimitingGG.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayResidualBound +import OAI.Probability.InvariantIsing.Arrays.TensorLimitingGG + +namespace OAI + +/-! Vector GG identities in weak limits of actual constrained-prior minimizers. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology BoundedContinuousFunction +namespace InvariantIsing + +def spinPriorPerturbedArrayLaw {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (h : ℕ → ℝ) : + ProbabilityMeasure (SpectralArray (m+1)) := + spinPriorArrayLaw μ π (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) n b + (fun j : Fin N => enumeratedTreeDegree m j) h + +theorem spinPriorPerturbation_minimizers_spectralGG + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (b : ℕ → ℝ) (hb : CascadeExponents n b) + (eig c : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) : + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) := by + obtain ⟨C,hC,hbound⟩ := spinPriorPerturbation_arrayResidual_bound hhaar hgauss + apply spectralGG_of_weak_nonconstant_monomial_residuals hL + intro z hz i D hD d hd + cases z with + | zero => omega + | succ q => + obtain ⟨j,hj⟩ := enumeratedJointMonomial_surjective m d hd + let BD := BoundedContinuousFunction.mkOfCompact ⟨D,hD⟩ + have hDb : ∀ x, |D x|≤‖BD‖ := fun x => by + simpa only [BD,BoundedContinuousFunction.mkOfCompact_apply,ContinuousMap.coe_mk,Real.norm_eq_abs] + using BD.norm_coe_le_norm x + let L := 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n)))+H+4+C*(K+4*m+8)^2 + have he : ∀ᶠ k in atTop, perturbationScale (N k)≤1/32 := + (perturbationScale_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + have hs : ∀ᶠ k in atTop, contactStep (N k)≤1/4 := + (contactStep_tendsto.comp hNlim).eventually (eventually_le_nhds (by norm_num)) + have hjN : ∀ᶠ k in atTop, j enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let L := 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n)))+H+4+C*(K+4*m+8)^2 + perturbationScale N≤1/32 → contactStep N≤1/4 → + (∀ u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + spinPriorPerturbationObjective (n := n) μ π eig c I b t h u v≤ spinPriorPerturbationObjective (n := n) μ π eig c I b t h u' v') → + (∀ a, spinPriorObservableAverage (n := n) μ π (diagonalPerturbedEigenvalues eig I v t) + c I d (tensorPerturbationAmplitude N u) b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-diagonalMinimumCenter N (v a)|) + ≤diagonalContactRate N L) ∧ + (∀ j : Fin N, ∀ q : ℕ, ∀ B : ℝ, 0≤B → + ∀ D : SpecialOrthogonal N → (Fin (q+1) → Spin N × LabeledLeaf n) → ℝ, + Measurable (Function.uncurry D) → (∀ U σ, |D U σ|≤B) → + |spinPriorSpectralGGResidual μ π b (diagonalPerturbedEigenvalues eig I v t) + c I d (tensorPerturbationAmplitude N u) r h j D|≤ + contactGGRate N j L B+2*B*(∑ a, (d j a : ℝ))*diagonalContactRate N L) := by + obtain ⟨C,hC,hvar⟩ := spinPriorPerturbation_variance hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n π hπ b hb eig c K hK heig I u hu v hv t ht h hh h0 H hH d r L he hs hmin + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure π := hπ + have hNp : 0 abs_le.mpr ⟨by linarith [(hu j).1],(hu j).2⟩ + have hva : ∀ a, |v a|≤2 := fun a => abs_le.mpr ⟨by linarith [(hv a).1],(hv a).2⟩ + let amplitude := tensorPerturbationAmplitude N u + have hcoords := spinPriorPerturbation_minimum_coordinates (n := n) μ π b eig c I t h u v hu hv hmin + have hgv (a : Fin m) (w : ℝ) (hw : |w|≤2) : + MemLp (spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I d amplitude r h) 2 ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ∧ + variance (spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) + c I d amplitude r h) ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates)≤N*L := by + exact hvar N hN μ hμ hμinv m n π hπ b hb eig c K hK heig I u hua + (Function.update v a w) (update_abs_le_two hva a hw) t ht h hh h0 H hH + have hdiag (a : Fin m) : spinPriorObservableAverage (n := n) μ π + (diagonalPerturbedEigenvalues eig I v t) c I d amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-diagonalMinimumCenter N (v a)|) + ≤diagonalContactRate N L := by + have hd := spinPriorDiagonal_fluctuation_at_minimum hNp μ π b eig c I d amplitude r h hh h0 + v t a (v a) L (hv a) he hs (fun w hw => (hgv a w hw).1) (fun w hw => (hgv a w hw).2) (by + dsimp only + intro w hw + simpa only [spinPriorPerturbationPressureMean_eq_namespaced,Function.update_eq_self] + using hcoords.2 a w hw) + simpa only [Function.update_eq_self,diagonalMinimumCenter] using hd + refine ⟨hdiag,?_⟩ + intro j q B hB D hD hDb + have hgu (w : ℝ) (hw : |w|≤2) : + MemLp (spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I v t) c I d + (Function.update amplitude j (perturbationAmplitude N j*w)) + r h) 2 ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ∧ + variance (spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I v t) c I d + (Function.update amplitude j (perturbationAmplitude N j*w)) + r h) ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates)≤N*L := by + have hx := hvar N hN μ hμ hμinv m n π hπ b hb eig c K hK heig I (Function.update u j w) + (update_abs_le_two hua j hw) v hva t ht h hh h0 H hH + change MemLp (spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I v t) + c I d (tensorPerturbationAmplitude N (Function.update u j w)) r h) 2 + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ∧ + variance (spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I v t) + c I d (tensorPerturbationAmplitude N (Function.update u j w)) r h) + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ≤ N*L at hx + simpa only [tensorPerturbationAmplitude_update] using hx + + have hgm : + let M := fun w => (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I v t) + c I d (Function.update amplitude j (perturbationAmplitude N j*w)) + r h p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + ∀ w∈Set.Icc (1 : ℝ) 2, + -M (u j)+perturbationWeight j*(u j-3/2)^2≤-M w+perturbationWeight j*(w-3/2)^2 := by + dsimp only + intro w hw + simpa only [amplitude,spinPriorPerturbationPressureMean_eq_namespaced,← tensorPerturbationAmplitude_update, + Function.update_eq_self] using hcoords.1 j w hw + have hg := spinPriorGaussianGG_at_minimum hNp μ π b (diagonalPerturbedEigenvalues eig I v t) + c I d amplitude r h hh h0 j (u j) L (hu j) (by linarith) hs rfl + (fun w hw => (hgu w hw).1) (fun w hw => (hgu w hw).2) hgm B hB D hD hDb + (fun a => diagonalMinimumCenter N (v a)) (fun _ => diagonalContactRate N L) hdiag + simpa only [← Finset.sum_mul,mul_assoc] using hg + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorMinimumCoordinates.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorMinimumCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b94539953611341ca484a8af0788bf7e37a89a4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorMinimumCoordinates.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactMinimum + +namespace OAI + +/-! A joint constrained-prior minimum gives the two actual coordinate minima. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma spinPriorPerturbationPressureMean_eq_namespaced {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) : + spinPriorPerturbationPressureMean (n := n) μ π eig c I b t h u v = + (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun j => enumeratedTreeDegree m j) h p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates := by + unfold spinPriorPerturbationPressureMean spinPriorMeanPressure + ring + +private lemma penalty_update {z : ℕ} (u w : Fin z → ℝ) (j : Fin z) (s : ℝ) : + (∑ i, w i * (Function.update u j s i - 3 / 2) ^ 2) = + (∑ i, w i * (u i - 3 / 2) ^ 2) - w j * (u j - 3 / 2) ^ 2 + w j * (s - 3 / 2) ^ 2 := by + classical + rw [← Finset.add_sum_erase _ _ (Finset.mem_univ j), + ← Finset.add_sum_erase _ _ (Finset.mem_univ j)] + have he : (∑ i ∈ Finset.univ.erase j, w i * (Function.update u j s i - 3 / 2) ^ 2) = + ∑ i ∈ Finset.univ.erase j, w i * (u i - 3 / 2) ^ 2 := by + apply Finset.sum_congr rfl + intro i hi + rw [Function.update_of_ne (Finset.mem_erase.mp hi).1] + rw [he, Function.update_self] + ring + +private lemma update_mem_Icc {z : ℕ} (u : Fin z → ℝ) (hu : ∀ i, u i ∈ Set.Icc (1 : ℝ) 2) + (j : Fin z) (s : ℝ) (hs : s ∈ Set.Icc (1 : ℝ) 2) : + ∀ i, Function.update u j s i ∈ Set.Icc (1 : ℝ) 2 := by + intro i + by_cases hi : i = j + · subst i + simpa only [Function.update_self] using hs + · simpa only [Function.update_of_ne hi] using hu i + +theorem spinPriorPerturbation_minimum_coordinates {N m n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (b : ℕ → ℝ) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) (h : ℕ → ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) + (hu : ∀ j, u j∈Set.Icc (1 : ℝ) 2) (hv : ∀ a, v a∈Set.Icc (1 : ℝ) 2) + (hmin : ∀ u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + spinPriorPerturbationObjective (n := n) μ π eig c I b t h u v≤ spinPriorPerturbationObjective (n := n) μ π eig c I b t h u' v') : + let M := spinPriorPerturbationPressureMean (n := n) μ π eig c I b t h + (∀ (j : Fin N) (s : ℝ), s∈Set.Icc (1 : ℝ) 2 → + -M u v+perturbationWeight j*(u j-3/2)^2≤ + -M (Function.update u j s) v+perturbationWeight j*(s-3/2)^2) ∧ + (∀ (a : Fin m) (s : ℝ), s∈Set.Icc (1 : ℝ) 2 → + -M u v+(v a-3/2)^2≤-M u (Function.update v a s)+(s-3/2)^2) := by + intro M + constructor + · intro j s hs + have hc := hmin (Function.update u j s) v (update_mem_Icc u hu j s hs) hv + unfold spinPriorPerturbationObjective at hc + rw [penalty_update] at hc + linarith + · intro a s hs + have hc := hmin u (Function.update v a s) hu (update_mem_Icc v hv a s hs) + unfold spinPriorPerturbationObjective at hc + have he := penalty_update v (fun _ => 1) a s + simp only [one_mul] at he + rw [he] at hc + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorMinimumFluctuations.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorMinimumFluctuations.lean new file mode 100644 index 0000000000000000000000000000000000000000..83595b490a1bba6b8d9ab8378b6ad1f9a5b4464b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorMinimumFluctuations.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorDiagonalMinimum +import OAI.Probability.InvariantIsing.Fields.SpinPriorObservableAverageLaw +import OAI.Probability.InvariantIsing.Fields.PriorMinimumFluctuations +import OAI.Probability.InvariantIsing.Arrays.PerturbationMinimumRates + +namespace OAI + +/-! Vanishing self-overlap fluctuation in the actual constrained-prior Gibbs law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +theorem spinPriorDiagonal_fluctuation_at_minimum {N m k n : ℕ} (hN : 0 (N : ℝ)⁻¹ * ∫ p, spinPriorNamespacedLog (n := n) π + (diagonalPerturbedEigenvalues eig I (Function.update v a q) t) + c I degree amplitude r h p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + ∀ q∈Set.Icc (1 : ℝ) 2, -M w+(w-3/2)^2≤-M q+(q-3/2)^2) : + let A := N*perturbationScale N + let center := 2*(N/A^2)*(A*w-A*(3/2)) + spinPriorObservableAverage (n := n) μ π + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude b r h + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1-center|)≤diagonalContactRate N L := by + intro A center + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have he' : 0 < perturbationScale N := Real.rpow_pos_of_pos hn _ + have hs' : 0 < contactStep N := Real.rpow_pos_of_pos hn _ + have hθ : 0 < 1 / (Real.sqrt N * perturbationScale N) := + one_div_pos.mpr (mul_pos (Real.sqrt_pos.mpr hn) he') + have hE := spinPriorDiagonal_energy_at_minimum hN μ π b eig c I degree amplitude r h hh h0 v t a + w (contactStep N) (1 / (Real.sqrt N * perturbationScale N)) (N * L) hw he hs' hs hθ hF hv hmin + have ht := spinPriorFrozenDiagonal_observableAverage hN μ π eig c I degree amplitude n b r h hh h0 v t a w + (fun U x => |projectedOverlap (specialRotation U) (I a) x.1 x.1 - center|) + rw [← ht] + simpa only [sqrt_dimension_mul hN L,center,A,diagonalContactRate,mul_assoc] using hE.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorObservableAverageLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorObservableAverageLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cbef8f04f7a00a99b01a4520d6e652fb2fec649 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorObservableAverageLaw.lean @@ -0,0 +1,103 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorReplicaAverage +import OAI.Probability.InvariantIsing.Fields.SpinPriorTemperatureDerivative +import OAI.Probability.InvariantIsing.Spectral.SpectralDiagonalCenters + +namespace OAI + +/-! Both frozen coordinates control observables in the same actual Gibbs law. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma measurable_spinPriorObservableMean {N m k : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) : + Measurable (fun p : TensorFlatDisorder N n => ∫ x, D p.1.1 x + ∂spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p) := by + have hm := measurable_random_tilted_integral + (measurable_spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h) + (H := fun _ => 0) measurable_const + (hD.comp (measurable_fst.fst.fst.prodMk measurable_snd)) + change Measurable (fun p : TensorFlatDisorder N n => ∫ x, D p.1.1 x + ∂(spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p).tilted 0) at hm + simpa only [tilted_zero] using hm + +theorem spinPriorFrozenGaussian_observableAverage {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (t : ℝ) + (D : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) : + (∫ p : TensorFrozenData N n j × (ℕ → ℝ), ∫ x, D p.1.1.1 x + ∂(spinPriorFrozenReference π eig c I degree amplitude n r h j p.1).tilted + (fun x => t * cylinderField (jointSpectralMonomialCoefficients + (specialRotation p.1.1.1) I (degree j) n (r j) x) p.2) + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates) = + spinPriorObservableAverage μ π eig c I degree (Function.update amplitude j t) b r h D := by + let F := fun p : TensorFlatDisorder N n => ∫ x, D p.1.1 x + ∂spinPriorNamespacedReference (n := n) π eig c I degree (Function.update amplitude j t) r h p + have hF : Measurable F := measurable_spinPriorObservableMean π eig c I degree + (Function.update amplitude j t) n r h D hD + calc + _ = ∫ p : TensorFrozenData N n j × (ℕ → ℝ), + F (p.1.1, gaussianNamespaceJoin (j + 1) (p.2, p.1.2)) + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [spinPriorFrozenGaussian_reference_fold_ae μ π eig c I degree amplitude n b r h hh h0 j t] + with p hp + rw [hp] + _ = _ := (tensorFrozenInsertion_measurePreserving μ n b j).hasLaw.integral_comp hF.aestronglyMeasurable + +theorem spinPriorFrozenDiagonal_observableAverage {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (v : Fin m → ℝ) (t : ℝ) (a : Fin m) (w : ℝ) + (D : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) : + (∫ p : TensorFlatDisorder N n, ∫ x, D p.1.1 x + ∂(spinPriorNamespacedReference (n := n) π (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) + c I degree amplitude r h p).tilted + (fun x : Spin N × LabeledLeaf n => N * perturbationScale N * w * + projectedOverlap (specialRotation p.1.1) (I a) x.1 x.1) + ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) = + spinPriorObservableAverage μ π + (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) c I degree amplitude b r h D := by + apply integral_congr_ae + filter_upwards [spinPriorFrozenDiagonal_reference_fold_ae hN μ π eig c I degree amplitude n b r h hh h0 v t a w] + with p hp + rw [hp] + +lemma spinPriorObservableAverage_integrable {N m k : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → (Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) {B : ℝ} (hB : ∀ U x, |D U x| ≤ B) : + Integrable (fun p : TensorFlatDisorder N n => ∫ x, D p.1.1 x + ∂spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p) + ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) := by + apply Integrable.of_bound + (measurable_spinPriorObservableMean π eig c I degree amplitude n r h D hD).aestronglyMeasurable B + exact ae_of_all _ fun p => by + simpa only [probReal_univ, mul_one, Real.norm_eq_abs] using + norm_integral_le_of_norm_le_const + (μ := spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p) + (f := fun x => D p.1.1 x) (C := B) (ae_of_all _ fun x => by + simpa only [Real.norm_eq_abs] using hB p.1.1 x) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPerturbationCost.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPerturbationCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..80b4c81c7ebadcb5fc87627061e5eb702e88d081 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPerturbationCost.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactMinimum +import OAI.Probability.InvariantIsing.Fields.PriorPerturbationCost +import OAI.Probability.InvariantIsing.Fields.PriorMinimumCoordinates + +namespace OAI + +/-! Uniform perturbation removal with the quenched cascade kept inside the logarithm. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma spinPriorPerturbationPressureMean_prior_average + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (t : ℝ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (u : Fin N → ℝ) (v : Fin m → ℝ) : + Integrable (fun T => priorPerturbationPressureMean μ (labeledSpinReference n π T) + eig c I t h u v) (labeledCascadeLaw n b : Measure (LabeledTree n)) ∧ + spinPriorPerturbationPressureMean (n := n) μ π eig c I b t h u v = + ∫ T, priorPerturbationPressureMean μ (labeledSpinReference n π T) eig c I t h u v + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) := by + obtain ⟨hi,he⟩ := spinPriorMeanPressure_prior_average (n := n) hhaar hgauss hN μ hμ π + (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) b + (fun j : Fin N => enumeratedTreeDegree m j) h hh h0 + have hpoint T : priorNamespacedMeanPressure μ (labeledSpinReference n π T) + (diagonalPerturbedEigenvalues eig I v t) c I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N u) + (fun j : Fin N => enumeratedTreeDegree m j) h+h n/2 = + priorPerturbationPressureMean μ (labeledSpinReference n π T) eig c I t h u v := by + rw [priorPerturbationPressureMean_eq_namespaced] + unfold priorNamespacedMeanPressure + ring + refine ⟨(hi.add (integrable_const (h n/2))).congr (ae_of_all _ hpoint),?_⟩ + unfold spinPriorPerturbationPressureMean + rw [he] + have he' := integral_add hi (integrable_const (h n/2)) + simp only [integral_const,probReal_univ,one_smul] at he' + rw [← he'] + exact integral_congr_ae (ae_of_all _ hpoint) + +lemma spinPriorPerturbationPressureMean_cost + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (t : ℝ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (u : Fin N → ℝ) (hu : ∀ j, |u j| ≤ 2) (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) : + |spinPriorPerturbationPressureMean (n := n) μ π eig c I b t h u v- + spinPriorPerturbationPressureMean (n := n) μ π eig c I b t h 0 0| ≤ + 2*m*perturbationScale N+8*perturbationScale N^2 := by + obtain ⟨hi,he⟩ := spinPriorPerturbationPressureMean_prior_average hhaar hgauss hN μ hμ π + eig c I b t h hh h0 u v + obtain ⟨hj,hf⟩ := spinPriorPerturbationPressureMean_prior_average hhaar hgauss hN μ hμ π + eig c I b t h hh h0 0 0 + rw [he,hf,← integral_sub hi hj] + have hn := norm_integral_le_of_norm_le_const + (μ := (labeledCascadeLaw n b : Measure (LabeledTree n))) + (f := fun T => priorPerturbationPressureMean μ (labeledSpinReference n π T) eig c I t h u v- + priorPerturbationPressureMean μ (labeledSpinReference n π T) eig c I t h 0 0) + (C := 2*m*perturbationScale N+8*perturbationScale N^2) + (ae_of_all _ fun T => by + simpa only [Real.norm_eq_abs] using priorPerturbationPressureMean_cost hhaar hgauss hN + μ hμ (labeledSpinReference n π T) eig c I t h hh h0 u hu v hv) + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hn + +lemma spinPriorContactPressure_temperature_modulus + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) + (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i) + (u : Fin N → ℝ) (v : Fin m → ℝ) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (s t : ℝ) : + |spinPriorContactPressure μ π eig c I b (s,a,u,v)- + spinPriorContactPressure μ π eig c I b (t,a,u,v)| ≤ (K/2)*|s-t| := by + obtain ⟨hi,he⟩ := spinPriorContactPressure_prior_average hhaar hgauss hN μ hμ π eig c I b (s,a,u,v) ha + obtain ⟨hj,hf⟩ := spinPriorContactPressure_prior_average hhaar hgauss hN μ hμ π eig c I b (t,a,u,v) ha + rw [he,hf,← integral_sub hi hj] + have hn := norm_integral_le_of_norm_le_const + (μ := (labeledCascadeLaw n b : Measure (LabeledTree n))) + (f := fun T => priorContactPressure μ (labeledSpinReference n π T) eig c I (s,a,u,v)- + priorContactPressure μ (labeledSpinReference n π T) eig c I (t,a,u,v)) + (C := (K/2)*|s-t|) + (ae_of_all _ fun T => by + have ht := priorPerturbationPressureMean_temperature_modulus hhaar hgauss hN μ hμ + (labeledSpinReference n π T) eig c I (finiteFieldPath a) (monotone_finiteFieldPath ha) + (finiteFieldPath_nonneg ha 0) u v K hK s t + simpa only [priorContactPressure, sub_sub_sub_cancel_right, Real.norm_eq_abs] using ht) + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hn + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPerturbationVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPerturbationVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..af1b1709d38622411771a3d221c653eccf2fda90 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPerturbationVariance.lean @@ -0,0 +1,104 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorProfileVariance +import OAI.Probability.InvariantIsing.Arrays.FullPerturbationVariance + +namespace OAI + +/-! Uniform concentration of the actual finite perturbation for a deterministic +spin constraint, with the cascade retained as quenched disorder. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +theorem spinPriorPerturbation_variance (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 enumeratedSpectralDegree m j + let r := fun j : Fin N => enumeratedTreeDegree m j + let F := spinPriorProfileLog π (diagonalPerturbedEigenvalues eig I v t) c I d + (tensorPerturbationAmplitude N u) (fun i => tensorPathProfile I d n r h i) + MemLp F 2 ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ∧ + variance F ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ≤ + N*(4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n)))+H+4+C*(K+4*m+8)^2) := by + obtain ⟨C,hC,hvar⟩ := spinPriorProfileLog_variance hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv m n π hπ b hb eig c K hK heig I u hu v hv t ht h hh h0 H hH d r F + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure π := hπ + have hNp : 0 varianceIncrement h i) (fun i j => varianceIncrement (monomialPath n (r j)) i) + have hsum := tensorPerturbationAmplitude_square_sum_le N u hu + have hsmall := perturbationScale_sq_le_one hNp + have hsum' : (∑ j : Fin N, a j^2) ≤ 4*N := + hsum.trans ((mul_le_mul_of_nonneg_left hsmall (by positivity : 0≤4*(N : ℝ))).trans_eq (mul_one _)) + have hG : (∑ i : Fin (n+1), ((varianceIncrement h i : ℝ)*N+ + ∑ j : Fin N, (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2)) ≤ (H+4)*N := by + rw [Finset.sum_add_distrib,← Finset.sum_mul,varianceIncrement_sum hh h0,Finset.sum_comm] + have hm : (∑ j : Fin N, ∑ i : Fin (n+1), + (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2) ≤ ∑ j : Fin N, a j^2 := by + apply Finset.sum_le_sum + intro j _ + rw [← Finset.sum_mul] + exact (mul_le_mul_of_nonneg_right (monomialVarianceIncrement_sum_le n (r j)) + (sq_nonneg _)).trans_eq (one_mul _) + have hhN := mul_le_mul_of_nonneg_right hH hNr.le + linarith + have hdeg : ∀ j : Fin N, (∑ b, (d j b : ℝ)) ≤ 1*((j : ℝ)+1) := by + intro j + simpa only [one_mul] using enumeratedSpectralDegree_real_sum_le m j + have hrot := (tensorPathProfile_rotation_cap d a n r).trans + (tensorPerturbationAmplitude_degree_sum_le u hu d 1 zero_le_one hdeg) + have hrot' : (∑ i : Fin (n+1), ∑ j : Fin N, + (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2*∑ b, (d j b : ℝ)) ≤ 4*N := by + apply hrot.trans + simpa only [mul_one] using mul_le_mul_of_nonneg_left hsmall (by positivity : 0≤4*(N : ℝ)) + have hL0 : 0≤L := by dsimp only [L]; positivity + have hL : L≤N*(K+4*m+8) := by dsimp only [L]; linarith + have hLsq := pow_le_pow_left₀ hL0 hL 2 + let T := 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 + ∂(rawCascadeLaw n b : Measure (RawTree n))) + have hT : 0 ≤ T := mul_nonneg (by norm_num) (integral_nonneg fun _ => sq_nonneg _) + have hroot : (varianceIncrement h 0 : ℝ)*N+ + ∑ j : Fin N, (varianceIncrement (monomialPath n (r j)) 0 : ℝ)*a j^2 ≤ (H+4)*N := by + apply le_trans ?_ hG + exact Finset.single_le_sum + (f := fun i : Fin (n+1) => (varianceIncrement h i : ℝ)*N+ + ∑ j : Fin N, (varianceIncrement (monomialPath n (r j)) i : ℝ)*a j^2) + (fun i _ => add_nonneg (by positivity) (Finset.sum_nonneg fun j _ => by positivity)) + (Finset.mem_univ (0 : Fin (n+1))) + have hroot' : T+(varianceIncrement h 0 : ℝ)*N+ + ∑ j : Fin N, (varianceIncrement (monomialPath n (r j)) 0 : ℝ)*a j^2 ≤ T+(H+4)*N := by + linarith + have hvar' := hp.2.trans (add_le_add hroot' + (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hLsq hC.le) hNr.le)) + refine ⟨hp.1, ?_⟩ + have he : C*(N*(K+4*m+8))^2/N = N*(C*(K+4*m+8)^2) := by + field_simp [hNr.ne'] + rw [he] at hvar' + have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast (show 1 ≤ N by omega) + have hTN : T ≤ N*T := by nlinarith + change variance F ((μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates) ≤ + T+(H+4)*N+N*(C*(K+4*m+8)^2) at hvar' + change variance F _ ≤ N*(T+H+4+C*(K+4*m+8)^2) + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPhysicalPressure.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPhysicalPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..822cc475b2fea936821b7e54942766992259be94 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPhysicalPressure.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorPerturbationCost +import OAI.Probability.InvariantIsing.Fields.PriorZeroFieldPressure + +namespace OAI + +/-! With no Gaussian field or perturbation, the arbitrary-depth quenched +cascade disappears and leaves the original physical constrained pressure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma finiteLogIntegral_labeledSpinReference {N n : ℕ} + (π : Measure (Spin N)) (T : LabeledTree n) (H : Spin N → ℝ) : + finiteLogIntegral (labeledSpinReference n π T) (fun x => H x.1)=finiteLogIntegral π H := by + unfold finiteLogIntegral labeledSpinReference + congr 1 + simpa only [probReal_univ,one_smul] using integral_fun_fst + (μ := π) (ν := labeledLeafLaw n T) (fun σ => Real.exp (H σ)) + +lemma spinPrior_unperturbed_pressure (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) (t : ℝ) : + spinPriorPerturbationPressureMean (n := n) μ π eig c I b t (fun _ => 0) 0 0 = + priorPerturbationPressureMean μ (labeledSpinReference 0 π PUnit.unit) + eig c I t (fun _ => 0) 0 0 := by + have he := (spinPriorPerturbationPressureMean_prior_average (n := n) hhaar hgauss hN μ hμ + π eig c I b t (fun _ => 0) (fun _ _ _ => le_rfl) le_rfl 0 0).2 + rw [he] + have hpoint (T : LabeledTree n) : + priorPerturbationPressureMean μ (labeledSpinReference n π T) eig c I t (fun _ => 0) 0 0 = + priorPerturbationPressureMean μ (labeledSpinReference 0 π PUnit.unit) eig c I t (fun _ => 0) 0 0 := by + rw [prior_zero_field_pressure,prior_zero_field_pressure] + congr 1 + apply integral_congr_ae + filter_upwards [] with U + exact (finiteLogIntegral_labeledSpinReference π T + (fun σ => rotatedEnergy (fun i => t*eig i) (specialRotation U) σ+fieldEnergy c σ)).trans + (finiteLogIntegral_labeledSpinReference (n := 0) π (PUnit.unit : LabeledTree 0) + (fun σ => rotatedEnergy (fun i => t*eig i) (specialRotation U) σ+fieldEnergy c σ)).symm + simp_rw [hpoint] + simp + +lemma spinPrior_restricted_unperturbed_pressure (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (C : Finset (Spin N)) (hC : C.Nonempty) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (b : ℕ → ℝ) (t : ℝ) : + spinPriorPerturbationPressureMean (n := n) μ (restrictedSpinPrior C hC : Measure (Spin N)) + eig c I b t (fun _ => 0) 0 0 = + (∫ U, restrictedRotatedPressure C (fun i => t*eig i) (specialRotation U) c ∂μ)- + (N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2) := by + rw [spinPrior_unperturbed_pressure hhaar hgauss hN μ hμ] + exact restricted_zero_field_pressure μ C hC eig c I t + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPrincipalWard.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPrincipalWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..da98e74746af287094916b853f2d54848f73623e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorPrincipalWard.lean @@ -0,0 +1,120 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorReplicaMixture +import OAI.Probability.InvariantIsing.Arrays.TensorCascadeWard +import OAI.Probability.InvariantIsing.Arrays.TensorCascadeDiagonalWard + +namespace OAI + +/-! Principal Ward bounds for the actual quenched constrained cascade. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + + theorem spinPrior_off_principal_bound {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin N → Fin m → ℕ) (treeDegree : Fin N → ℕ) + (u : Fin N → ℝ) (hu : ∀ r, |u r| ≤ 2) (D : ℝ) (hD : 0 ≤ D) + (hdegree : ∀ r, (∑ a, (degree r a : ℝ)) ≤ D * ((r : ℝ) + 1)) + (b h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (J K : Finset (Fin N)) (hJK : Disjoint J K) + (F : Spin N → Spin N → ℝ) (B : ℝ) (hB : 0 ≤ B) (hF : ∀ σ τ, |F σ τ| ≤ B) : + let amp := tensorPerturbationAmplitude N u + |spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun U => tensorOffDirect eig J K (fun s : Spin N × LabeledLeaf n => s.1) F U) - + 2 * spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h + (fun U => tensorOffFresh eig J K (fun s : Spin N × LabeledLeaf n => s.1) F U)| ≤ + 192 * B * D * perturbationScale N ^ 2 := by + intro amp + let sp := fun s : Spin N × LabeledLeaf n => s.1 + let v : Fin (n + 1) → SpinTensorIndex I degree → ℝ≥0 := + fun a => tensorPathProfile I degree n treeDegree h a + let H := fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + tensorRestrictionHamiltonian eig c I degree amp v id z.1.1 z.1.2 z.2 + let D₂ := fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × (Fin 2 → Spin N × LabeledLeaf n) => + tensorOffDirect eig J K sp F z.1.1 z.2 + let D₃ := fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × (Fin 3 → Spin N × LabeledLeaf n) => + tensorOffFresh eig J K sp F z.1.1 z.2 + have hm₂ : Measurable (Function.uncurry (fun U => tensorOffDirect eig J K sp F U)) := + measurable_tensorOffDirect eig J K sp F + have hm₃ : Measurable (Function.uncurry (fun U => tensorOffFresh eig J K sp F U)) := + measurable_tensorOffFresh eig J K sp F + rw [spinPriorReplicaAverage_cascade_mixture μ π eig c I degree amp n b treeDegree h hh h0 + _ hm₂ (tensorOffDirectCap_nonneg eig J K hB) + (fun U σ => tensorOffDirect_abs_le eig J K sp F hB hF U σ), + spinPriorReplicaAverage_cascade_mixture μ π eig c I degree amp n b treeDegree h hh h0 + _ hm₃ (tensorOffFreshCap_nonneg eig J K hB) + (fun U σ => tensorOffFresh_abs_le eig J K sp F hB hF U σ)] + have hH : Measurable H := measurable_from_prod_countable_left + (fun s => measurable_tensorRestrictionHamiltonian eig c I degree amp v id s) + have hD₂ : Measurable D₂ := measurable_from_prod_countable_left + (fun σ => (measurable_tensorOffDirect_at eig J K sp F σ).comp measurable_fst) + have hD₃ : Measurable D₃ := measurable_from_prod_countable_left + (fun σ => (measurable_tensorOffFresh_at eig J K sp F σ).comp measurable_fst) + apply expectedReplicaWard_mixture_abs_le (labeledCascadeLaw n b : Measure (LabeledTree n)) + (μ.prod gaussianCoordinates) + (labeledSpinReference n π) + (measurable_labeledSpinReference_general n π) H hH + D₂ hD₂ D₃ hD₃ (tensorOffDirectCap_nonneg eig J K hB) (tensorOffFreshCap_nonneg eig J K hB) + (fun z => tensorOffDirect_abs_le eig J K sp F hB hF z.1.1 z.2) + (fun z => tensorOffFresh_abs_le eig J K sp F hB hF z.1.1 z.2) + intro T + exact tensorCountable_off_principal_bound hN μ + (labeledSpinReference n π T) + eig c I degree treeDegree u hu D hD hdegree h hh h0 id J K hJK F B hB hF + +theorem spinPrior_diagonal_principal_bound {N m n : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin N → Fin m → ℕ) (treeDegree : Fin N → ℕ) + (u : Fin N → ℝ) (hu : ∀ r, |u r| ≤ 2) (D : ℝ) (hD : 0 ≤ D) + (hdegree : ∀ r, (∑ a, (degree r a : ℝ)) ≤ D * ((r : ℝ) + 1)) + (b h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (J K : Finset (Fin N)) (hJK : Disjoint J K) : + |spinPriorReplicaAverage μ π eig c I degree (tensorPerturbationAmplitude N u) + n b treeDegree h (tensorDiagonalDirect eig J K (Prod.fst : Spin N × LabeledLeaf n → Spin N)) - + spinPriorReplicaAverage μ π eig c I degree (tensorPerturbationAmplitude N u) + n b treeDegree h (tensorDiagonalFresh eig J K (Prod.fst : Spin N × LabeledLeaf n → Spin N))| ≤ + 48 * D * perturbationScale N ^ 2 := by + let amp := tensorPerturbationAmplitude N u + let v : Fin (n + 1) → SpinTensorIndex I degree → ℝ≥0 := + fun a => tensorPathProfile I degree n treeDegree h a + let P := μ.prod gaussianCoordinates + let ν := labeledSpinReference n π + let H := fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + tensorRestrictionHamiltonian eig c I degree amp v id z.1.1 z.1.2 z.2 + let D₁ := fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × (Fin 1 → Spin N × LabeledLeaf n) => + tensorDiagonalDirect eig J K Prod.fst z.1.1 z.2 + let D₂ := fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × (Fin 2 → Spin N × LabeledLeaf n) => + tensorDiagonalFresh eig J K Prod.fst z.1.1 z.2 + have hH : Measurable H := measurable_from_prod_countable_left + (fun s => measurable_tensorRestrictionHamiltonian eig c I degree amp v id s) + have hm₁ : Measurable D₁ := measurable_from_prod_countable_left + (fun σ => (measurable_tensorDiagonalDirect_at eig J K Prod.fst σ).comp measurable_fst) + have hm₂ : Measurable D₂ := measurable_from_prod_countable_left + (fun σ => (measurable_tensorDiagonalFresh_at eig J K Prod.fst σ).comp measurable_fst) + have hward (T : LabeledTree n) : |expectedDiagonalWard P (ν T) H D₁ D₂| ≤ + 48 * D * perturbationScale N ^ 2 := + tensorCountable_diagonal_principal_bound hN μ (ν T) eig c I degree treeDegree u hu D hD + hdegree h hh h0 id J K hJK + have hmix := expectedDiagonalWard_mixture_abs_le (labeledCascadeLaw n b : Measure (LabeledTree n)) P + ν (measurable_labeledSpinReference_general n π) H hH D₁ hm₁ D₂ hm₂ + (tensorDiagonalDirectCap_nonneg eig J K) (tensorDiagonalFreshCap_nonneg eig J K) + (fun z => tensorDiagonalDirect_abs_le eig J K Prod.fst z.1.1 z.2) + (fun z => tensorDiagonalFresh_abs_le eig J K Prod.fst z.1.1 z.2) hward + rw [spinPriorReplicaAverage_cascade_mixture μ π eig c I degree amp n b treeDegree h hh h0 + (tensorDiagonalDirect eig J K Prod.fst) (measurable_tensorDiagonalDirect eig J K Prod.fst) + (tensorDiagonalDirectCap_nonneg eig J K) (tensorDiagonalDirect_abs_le eig J K Prod.fst), + spinPriorReplicaAverage_cascade_mixture μ π eig c I degree amp n b treeDegree h hh h0 + (tensorDiagonalFresh eig J K Prod.fst) (measurable_tensorDiagonalFresh eig J K Prod.fst) + (tensorDiagonalFreshCap_nonneg eig J K) (tensorDiagonalFresh_abs_le eig J K Prod.fst)] + exact hmix + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorProfileVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorProfileVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d7a44ec28dc7373cc1e34d6ad1ee37bf8489c9a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorProfileVariance.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorHaarVariance + +namespace OAI + +/-! Full Haar/cascade/Gaussian concentration in the independent namespaces +used by the actual perturbation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +theorem spinPriorProfileLog_variance (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) : + ∃ C : ℝ, 0 < C ∧ ∀ N : ℕ, 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ π : Measure (Spin N), IsProbabilityMeasure π → + ∀ m k n : ℕ, ∀ eig c : Fin N → ℝ, ∀ K : ℝ, 0 < K → (∀ i, |eig i| ≤ K) → + ∀ I : Fin m → Finset (Fin N), ∀ degree : Fin k → Fin m → ℕ, ∀ amp : Fin k → ℝ, + ∀ b : ℕ → ℝ, CascadeExponents n b → ∀ site : ℕ → ℝ≥0, ∀ monomial : ℕ → Fin k → ℝ≥0, + let v := fun i => tensorVarianceProfile I degree (site i) (monomial i) + let P := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let F := spinPriorProfileLog π eig c I degree amp (fun i => v i) + let L := K*N+2*(∑ i : Fin (n+1), ∑ j, (monomial i j : ℝ)*amp j^2*∑ a, (degree j a : ℝ)) + MemLp F 2 P ∧ variance F P ≤ + 4*(∫ T, (Real.log (rawTreeTotal n T).toReal)^2 ∂(rawCascadeLaw n b : Measure (RawTree n)))+ + (site 0 : ℝ)*N+∑ j, (monomial 0 j : ℝ)*amp j^2+C*L^2/N := by + obtain ⟨C,hC,hvar⟩ := spinPriorJointFlatLog_variance hhaar hgauss + refine ⟨C,hC,?_⟩ + intro N hN μ hμ hμinv π hπ m k n eig c K hK heig I degree amp b hb site monomial v P F L + let : IsProbabilityMeasure μ := hμ + let : IsProbabilityMeasure π := hπ + have hv := hvar N hN μ hμ hμinv π hπ m k n eig c K hK heig I degree amp b hb site monomial + have hlaw := spinPriorProfileLog_law (n := n) μ π eig c I degree amp b (fun i => v i) + have hid : MemLp id 2 (P.map (spinPriorJointFlatLog π eig c I degree amp (fun i => v i))) := + (memLp_map_measure_iff aestronglyMeasurable_id hv.1.aemeasurable).mpr hv.1 + exact ⟨hlaw.memLp hid, (hlaw.variance_eq.trans (variance_id_map hv.1.aemeasurable)).trans_le hv.2⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorReplicaAverage.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorReplicaAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..e72c6f409f0c12689e067494ce59fee5b9a39ab8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorReplicaAverage.lean @@ -0,0 +1,90 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorFrozenGibbs +import OAI.Probability.InvariantIsing.Arrays.TensorReplicaAverageLaw +import OAI.Probability.InvariantIsing.Spectral.SpectralGG + +namespace OAI + +/-! Finite replica averages under the actual namespaced tensor Gibbs law. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def spinPriorReplicaAverage {N m k q : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) : ℝ := + ∫ p : TensorFlatDisorder N n, + referenceReplicaMean (spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p) + (fun _ => 0) (D p.1.1) + ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + +lemma measurable_spinPriorReplicaMean {N m k q : ℕ} + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) : + Measurable (fun p : TensorFlatDisorder N n => + referenceReplicaMean (spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h p) + (fun _ => 0) (D p.1.1)) := by + exact measurable_random_referenceReplicaMean + (measurable_spinPriorNamespacedReference (n := n) π eig c I degree amplitude r h) measurable_const + (hD.comp (measurable_fst.fst.fst.prodMk measurable_snd)) + +/-- Gaussian insertion and actual full-model sampling give exactly the +same bounded finite-replica averages, retaining the common Haar rotation. -/ +theorem spinPriorFrozenGaussian_replicaAverage {N m k q : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amplitude : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (j : Fin k) (t : ℝ) + (D : SpecialOrthogonal N → (Fin q → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) : + let U := fun ω : TensorFrozenData N n j => ω.1.1 + randomCoefficientAverage (tensorFrozenLaw μ n b j) + (spinPriorFrozenReference π eig c I degree amplitude n r h j) + (spectralPerturbationCoefficients U I (degree j) n (r j)) t (fun ω => D (U ω)) = + spinPriorReplicaAverage μ π eig c I degree (Function.update amplitude j t) n b r h D := by + intro U + let ν := spinPriorFrozenReference π eig c I degree amplitude n r h j + let A := spectralPerturbationCoefficients U I (degree j) n (r j) + have hAm := measurable_spectralPerturbationFields U measurable_fst.fst I (degree j) n (r j) + have hA (ω : TensorFrozenData N n j) (x : Spin N × LabeledLeaf n) : + (A ω x).sum (fun _ c => c ^ 2) ≤ 1 := + jointSpectralMonomialCoefficients_variance_le_one (specialRotation (U ω)) I (degree j) n (r j) x + have he := randomCoefficient_all_exp_ae (P := tensorFrozenLaw μ n b j) + (measurable_spinPriorFrozenReference π eig c I degree amplitude n r h j) A hAm hA + have hf := spinPriorFrozenGaussian_reference_fold_ae μ π eig c I degree amplitude n b r h hh h0 j t + let F := fun p : TensorFlatDisorder N n => + referenceReplicaMean (spinPriorNamespacedReference (n := n) π eig c I degree (Function.update amplitude j t) r h p) + (fun _ => 0) (D p.1.1) + have hF : Measurable F := measurable_spinPriorReplicaMean π eig c I degree + (Function.update amplitude j t) n r h D hD + unfold randomCoefficientAverage + calc + _ = ∫ p : TensorFrozenData N n j × (ℕ → ℝ), + F (p.1.1, gaussianNamespaceJoin (j + 1) (p.2, p.1.2)) + ∂(tensorFrozenLaw μ n b j).prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [he, hf] with p hp hpf + rw [referenceReplicaMean_eq_tilted _ _ (hp t)] + change (∫ σ, D (U p.1) σ ∂Measure.pi + (fun _ : Fin q => (ν p.1).tilted (fun x => t * cylinderField (A p.1 x) p.2))) = _ + have hpf' : (ν p.1).tilted (fun x => t * cylinderField (A p.1 x) p.2) = + spinPriorNamespacedReference (n := n) π eig c I degree (Function.update amplitude j t) r h + (p.1.1, gaussianNamespaceJoin (j + 1) (p.2, p.1.2)) := hpf + rw [hpf'] + exact (referenceReplicaMean_zero _ _).symm + _ = _ := (tensorFrozenInsertion_measurePreserving μ n b j).hasLaw.integral_comp + hF.aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorReplicaMixture.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorReplicaMixture.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e734c56d09c748440a7619d6642f967994cc43b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorReplicaMixture.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorReplicaAverage +import OAI.Probability.InvariantIsing.Fields.SpinPriorExponential +import OAI.Probability.InvariantIsing.Arrays.TensorCascadeReplicaAverage + +namespace OAI + +/-! Exact quenched cascade mixture for an arbitrary constrained spin prior. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + + theorem spinPriorReplicaAverage_cascade_mixture {N m k r : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) + (hh : Monotone h) (h0 : 0 ≤ h 0) + (D : SpecialOrthogonal N → (Fin r → Spin N × LabeledLeaf n) → ℝ) + (hD : Measurable (Function.uncurry D)) {B : ℝ} (hB : 0 ≤ B) + (hDB : ∀ U σ, |D U σ| ≤ B) : + spinPriorReplicaAverage μ π eig c I degree amp n b treeDegree h D = + ∫ T, ∫ z : SpecialOrthogonal N × (ℕ → ℝ), + referenceReplicaMean (labeledSpinReference n π T) + (tensorRestrictionHamiltonian eig c I degree amp + (fun a => tensorPathProfile I degree n treeDegree h a) id z.1 z.2) (D z.1) + ∂μ.prod gaussianCoordinates ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) := by + let F := fun p : TensorFlatDisorder N n => + referenceReplicaMean (spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h p) + (fun _ => 0) (D p.1.1) + let S := fun q : LabeledTree n × (SpecialOrthogonal N × (ℕ → ℝ)) => ((q.2.1,q.1),q.2.2) + have hS := tensorCascadeDisorderShuffle_preserving μ (n := n) b + have hmF : Measurable F := measurable_spinPriorReplicaMean π eig c I degree amp n treeDegree h D hD + have hiF : Integrable (F ∘ S) + ((labeledCascadeLaw n b : Measure (LabeledTree n)).prod (μ.prod gaussianCoordinates)) := by + apply integrable_of_measurable_abs_le (hmF.comp hS.measurable) + intro q + change |referenceReplicaMean (spinPriorNamespacedReference (n := n) π eig c I degree amp treeDegree h (S q)) + (fun _ => 0) (D q.2.1)| ≤ B + exact referenceReplicaMean_abs_le _ _ _ (measurable_of_countable (D q.2.1)) hB (hDB q.2.1) + unfold spinPriorReplicaAverage + change (∫ p, F p ∂_) = _ + calc + _ = ∫ q, F (S q) ∂(labeledCascadeLaw n b : Measure (LabeledTree n)).prod + (μ.prod gaussianCoordinates) := (hS.hasLaw.integral_comp hmF.aestronglyMeasurable).symm + _ = ∫ T, ∫ z, F (S (T,z)) ∂μ.prod gaussianCoordinates + ∂(labeledCascadeLaw n b : Measure (LabeledTree n)) := integral_prod _ hiF + _ = _ := by + apply integral_congr_ae + refine ae_of_all _ fun T => ?_ + have he := tensorCountableHamiltonian_exp_integrable_ae μ + (labeledSpinReference n π T) + eig c I degree amp treeDegree h hh h0 (id : Spin N × LabeledLeaf n → _) + apply integral_congr_ae + filter_upwards [he] with z hz + dsimp only [F, S] + change referenceReplicaMean (gibbsProbability (labeledSpinReference n π T) + (tensorRestrictionHamiltonian eig c I degree amp + (fun a => tensorPathProfile I degree n treeDegree h a) id z.1 z.2)) + (fun _ => 0) (D z.1) = _ + exact referenceReplicaMean_gibbsProbability _ _ hz _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedAsymptotic.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedAsymptotic.lean new file mode 100644 index 0000000000000000000000000000000000000000..85a6ed049351b6d34b72c3a53e1150a8a1a39e3a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedAsymptotic.lean @@ -0,0 +1,124 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactNoSequence +import OAI.Probability.InvariantIsing.Fields.SpinPriorRestrictedCap + +namespace OAI + + +/-! Uniform asymptotic nonnegativity of the actual contact problem for a +fixed trial partition. The hypotheses are the Haar and root/cascade concentration estimates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem spinPriorRestrictedContact_eventually_nonnegative + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (C : (k : ℕ) → Finset (Spin (N k))) (hC : ∀ k, (C k).Nonempty) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (d : ℝ) (hd : 0 < d) (htrial : ∀ᵐ s ∂pathMeasure, trial s ≤ 1 - d) + (δ S : ℝ) (hδ : 0 < δ) (hS : ∀ k (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i), + constrainedBlockValue (C k) (contactFieldStep cut hc hfirst hlast a ha)+ + fieldPairing trial (contactFieldStep cut hc hfirst hlast a ha)/2 ≤ S) : + ∃ H : ℝ, 0 < H ∧ ∀ η : ℝ, 0 < η → ∀ᶠ k in atTop, + ∀ p ∈ tensorContactRegion (N k) m n H, + -η ≤ spinPriorContactObjective (μ k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) (eig k) (fun _ => 0) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N k : ℝ)⁻¹*(Real.log (C k).card-N k*Real.log 2)) + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) p := by + classical + let V : ℝ → ℝ := fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ + have hV : Continuous V := (continuous_finiteTemperatureFunctional ρ lam hρpos hρsum trial).add + (continuous_id.mul continuous_const) + have hV0 : V 0 = 0 := by simp [V, finiteTemperatureFunctional] + obtain ⟨tmin, _, hlow⟩ := isCompact_Icc.exists_isMinOn (nonempty_Icc.mpr zero_le_one) hV.continuousOn + obtain ⟨H, hH, hcap⟩ := exists_spinPriorRestrictedContactObjective_cap hhaar hgauss m n cut hc hfirst hlast + trial values hvalues d hd htrial K S (V tmin) + refine ⟨H, hH, ?_⟩ + intro η hη + have hcost : ∀ᶠ k in atTop, + 2 * m * perturbationScale (N k) + 8 * perturbationScale (N k) ^ 2 < η := + ((fullPerturbationCost_tendsto m).comp hNlim).eventually (gt_mem_nhds hη) + by_contra hbad + have hbad' : ∃ᶠ k in atTop, ∃ p ∈ tensorContactRegion (N k) m n H, + spinPriorContactObjective (μ k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) (eig k) (fun _ => 0) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N k : ℝ)⁻¹*(Real.log (C k).card-N k*Real.log 2)) V p < -η := by + simpa only [V, Filter.not_eventually, not_forall, not_imp, not_le, exists_prop] using hbad + obtain ⟨φ, hφ, hφbad⟩ := extraction_of_frequently_atTop (hbad'.and_eventually hcost) + have hmins (k : ℕ) := spinPriorContactObjective_exists_minimum hhaar hgauss (hN (φ k)) + (μ (φ k)) (hμinv (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k)))) (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + K (heig (φ k)) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N (φ k) : ℝ)⁻¹*(Real.log (C (φ k)).card-N (φ k)*Real.log 2)) V hV H hH.le + choose p hp hmin using hmins + have hneg (k : ℕ) : + spinPriorContactObjective (μ (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k)))) (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N (φ k) : ℝ)⁻¹*(Real.log (C (φ k)).card-N (φ k)*Real.log 2)) V (p k) < -η := by + obtain ⟨q, hq, hqneg⟩ := (hφbad k).1 + exact (hmin k q hq).trans_lt hqneg + have hcap' (k : ℕ) : (∑ i, (p k).2.1 i) < H := by + have hb := tensorContactRegion_bounds (hp k) + apply hcap (N (φ k)) (hN (φ k)) (μ (φ k)) inferInstance (hμinv (φ k)) (C (φ k)) (hC (φ k)) + (eig (φ k)) (I (φ k)) (heig (φ k)) V (fun t ht => hlow ht) (p k) hb.1 hb.2.1 + · intro j + rw [abs_of_nonneg (by have := (hb.2.2.2.1 j).1; linarith)] + exact (hb.2.2.2.1 j).2 + · intro j + rw [abs_of_nonneg (by have := (hb.2.2.2.2 j).1; linarith)] + exact (hb.2.2.2.2 j).2 + · linarith [hneg k] + have hpos (k : ℕ) : 0 < (p k).1 := by + have hb := tensorContactRegion_bounds (hp k) + by_contra hzero + have heq : (p k).1 = 0 := le_antisymm (not_lt.mp hzero) hb.1.1 + have hu j : |(p k).2.2.1 j| ≤ 2 := by + rw [abs_of_nonneg (by have := (hb.2.2.2.1 j).1; linarith)] + exact (hb.2.2.2.1 j).2 + have hv j : |(p k).2.2.2 j| ≤ 2 := by + rw [abs_of_nonneg (by have := (hb.2.2.2.2 j).1; linarith)] + exact (hb.2.2.2.2 j).2 + have hzeroBound := spinPriorRestrictedContact_zero_bound hhaar hgauss (hN (φ k)) + (μ (φ k)) (hμinv (φ k)) (C (φ k)) (hC (φ k)) (eig (φ k)) (I (φ k)) cut hc hfirst hlast + (p k).2.1 hb.2.1 (p k).2.2.1 hu (p k).2.2.2 hv trial values hvalues S (hS (φ k) (p k).2.1 hb.2.1) V hV0 + have hpEq : p k = (0, (p k).2.1, (p k).2.2.1, (p k).2.2.2) := by + exact Prod.ext heq (Prod.ext rfl (Prod.ext rfl rfl)) + rw [← hpEq] at hzeroBound + have := (hφbad k).2 + linarith [hneg k] + have hmin0 (k : ℕ) (z : TensorContactParameter (N (φ k)) m n) + (hz : z ∈ tensorContactRegion (N (φ k)) m n H) : + spinPriorContactObjective (μ (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k))) + (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ-cut i.castSucc)*values i) 0 V (p k) ≤ + spinPriorContactObjective (μ (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k))) + (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ-cut i.castSucc)*values i) 0 V z := by + have hm := hmin k z hz + simp only [spinPriorContactObjective] at hm ⊢ + linarith + exact spinPriorContact_no_positive_minimizing_sequence hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) + (fun k => (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k))))) (fun k => eig (φ k)) (fun _ _ => 0) + K hK (fun k => heig (φ k)) (fun k => I (φ k)) (fun k => hdis (φ k)) + (fun k => hcover (φ k)) lam (fun k => hlam (φ k)) ρ hρpos hρsum + (hρ.comp hφ.tendsto_atTop) cut hc hfirst hlast trial values hvalues δ 0 H hδ p hp hmin0 hcap' hpos + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedBoundary.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9fc62dc168794515cf025a326713379c2dba930 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedBoundary.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorPerturbationCost +import OAI.Probability.InvariantIsing.Fields.SpinPriorFieldMean +import OAI.Probability.InvariantIsing.Magnetic.MagneticSliceFieldBound +import OAI.Probability.InvariantIsing.Arrays.TensorContactStep + +namespace OAI + +/-! The actual constrained contact boundary retains the cube-mass constant +until it cancels from the physical objective. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators +namespace InvariantIsing + +lemma spinPriorRestrictedContact_zero_cost + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (C : Finset (Spin N)) (hC : C.Nonempty) (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (cut : Fin (n+2) → ℝ) (hc : StrictMono cut) (hfirst : cut 0=0) (hlast : cut (Fin.last (n+1))=1) + (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i) + (u : Fin N → ℝ) (hu : ∀ j, |u j| ≤ 2) (v : Fin m → ℝ) (hv : ∀ j, |v j| ≤ 2) : + |spinPriorContactPressure μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I + (chainExponent cut) (0,a,u,v)- + (constrainedBlockValue C (contactFieldStep cut hc hfirst hlast a ha)- + (N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2))| ≤ + 2*m*perturbationScale N+8*perturbationScale N^2 := by + let step := contactFieldStep cut hc hfirst hlast a ha + have hp := spinPriorPerturbationPressureMean_cost (n := n) hhaar hgauss hN μ hμ + (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I (chainExponent cut) 0 + (finiteFieldPath a) (monotone_finiteFieldPath ha) (finiteFieldPath_nonneg ha 0) u hu v hv + have he := spinPriorMeanPressure_restricted_field hhaar hgauss hN μ hμ C hC I + (fun j : Fin N => enumeratedSpectralDegree m j) + (fun j : Fin N => enumeratedTreeDegree m j) step + rw [heightSequence_contactFieldStep] at he + change spinPriorMeanPressure (n := n) μ (restrictedSpinPrior C hC : Measure (Spin N)) + (fun _ => 0) (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) 0 + (chainExponent cut) (fun j : Fin N => enumeratedTreeDegree m j) (finiteFieldPath a) = + constrainedBlockValue C (contactFieldStep cut hc hfirst hlast a ha)- + (N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2) at he + have hdiag : diagonalPerturbedEigenvalues eig I 0 0 = fun _ => 0 := by + ext i + simp [diagonalPerturbedEigenvalues] + have hamp : tensorPerturbationAmplitude N 0 = 0 := by + ext i + simp [tensorPerturbationAmplitude] + simp only [spinPriorPerturbationPressureMean, hdiag, hamp, he, add_sub_add_right_eq_sub] at hp + exact hp + +lemma spinPriorRestrictedContact_zero_bound + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (C : Finset (Spin N)) (hC : C.Nonempty) (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (cut : Fin (n+2) → ℝ) (hc : StrictMono cut) (hfirst : cut 0=0) (hlast : cut (Fin.last (n+1))=1) + (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i) + (u : Fin N → ℝ) (hu : ∀ j, |u j| ≤ 2) (v : Fin m → ℝ) (hv : ∀ j, |v j| ≤ 2) + (trial : OverlapPath) (values : Fin (n+1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s=values i) + (S : ℝ) (hS : constrainedBlockValue C (contactFieldStep cut hc hfirst hlast a ha)+ + fieldPairing trial (contactFieldStep cut hc hfirst hlast a ha)/2 ≤ S) + (V : ℝ → ℝ) (hV : V 0=0) : + -(2*m*perturbationScale N+8*perturbationScale N^2) ≤ + spinPriorContactObjective μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I + (chainExponent cut) (fun i => (cut i.succ-cut i.castSucc)*values i) + (S-(N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2)) V (0,a,u,v) := by + have hp := spinPriorRestrictedContact_zero_cost hhaar hgauss hN μ hμ C hC eig I + cut hc hfirst hlast a ha u hu v hv + have hpair := fieldPairing_contactFieldStep trial cut hc hfirst hlast a ha values hvalues + rw [hpair] at hS + have hU : 0 ≤ ∑ j : Fin N, perturbationWeight j*(u j-3/2)^2 := + Finset.sum_nonneg fun j _ => mul_nonneg (perturbationWeight_nonneg j) (sq_nonneg _) + have hW : 0 ≤ ∑ j : Fin m, (v j-3/2)^2 := Finset.sum_nonneg fun j _ => sq_nonneg _ + have hh := (abs_le.mp hp).2 + simp only [spinPriorContactObjective, hV] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedCap.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ac47503fac5e9ef77ef7a932442fff7cae05feb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedCap.lean @@ -0,0 +1,155 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorRestrictedBoundary +import OAI.Probability.InvariantIsing.Arrays.TensorContactCap + +namespace OAI + +/-! A fixed field cap for constrained contact objectives, uniform in the +finite constraint and with its cube mass canceled. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators +namespace InvariantIsing + +lemma constrainedBlockValue_le_fieldValue {N : ℕ} (hN : 0 0)).1 + have hu := biasedConstrainedBlockValue_univ hN h (fun _ => 0) + have hz : biasedConstrainedBlockValue C h (fun _ => 0)=constrainedBlockValue C h := rfl + rw [hz, hu] at hp + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hp + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN.ne' + rw [← mul_assoc, inv_mul_cancel₀ hn, one_mul] at hp + linarith + +lemma spinPriorRestrictedContactPressure_field_le + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (C : Finset (Spin N)) (hC : C.Nonempty) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (K : ℝ) (heig : ∀ i, |eig i| ≤ K) + (cut : Fin (n+2) → ℝ) (hc : StrictMono cut) (hfirst : cut 0=0) (hlast : cut (Fin.last (n+1))=1) + (p : TensorContactParameter N m n) (ht : p.1 ∈ Icc (0 : ℝ) 1) + (ha : ∀ i, 0 ≤ p.2.1 i) (hu : ∀ j, |p.2.2.1 j| ≤ 2) (hv : ∀ j, |p.2.2.2 j| ≤ 2) : + spinPriorContactPressure μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I + (chainExponent cut) p + (N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2) ≤ + fieldValue (contactFieldStep cut hc hfirst hlast p.2.1 ha) 0+K/2+ + (2*m*perturbationScale N+8*perturbationScale N^2) := by + have hp := spinPriorRestrictedContact_zero_cost hhaar hgauss hN μ hμ C hC eig I + cut hc hfirst hlast p.2.1 ha p.2.2.1 hu p.2.2.2 hv + have hb := constrainedBlockValue_le_fieldValue (by omega) C hC + (contactFieldStep cut hc hfirst hlast p.2.1 ha) + have hT := spinPriorContactPressure_temperature_modulus hhaar hgauss hN μ hμ + (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I (chainExponent cut) + p.2.1 ha p.2.2.1 p.2.2.2 K heig p.1 0 + have hK : 0 ≤ K := (abs_nonneg (eig ⟨0,by omega⟩)).trans (heig _) + have ht' : |p.1-0| ≤ 1 := by simpa only [sub_zero,abs_of_nonneg ht.1] using ht.2 + have hT' := hT.trans (mul_le_of_le_one_right (div_nonneg hK (by norm_num)) ht') + have htemp := (le_abs_self _).trans hT' + have hbase := (le_abs_self _).trans hp + change spinPriorContactPressure μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I + (chainExponent cut) p+_ ≤ _ + have heq : (p.1,p.2.1,p.2.2.1,p.2.2.2)=p := by cases p; rfl + rw [heq] at htemp + linarith + +/-- A coercive lower bound in the total nonnegative field increment. -/ +theorem spinPriorRestrictedContactObjective_cap_bound + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m n : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (C : Finset (Spin N)) (hC : C.Nonempty) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (K : ℝ) + (heig : ∀ i, |eig i| ≤ K) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (d : ℝ) (hd : 0 ≤ d) (htrial : ∀ᵐ s ∂pathMeasure, trial s ≤ 1 - d) + (S : ℝ) (V : ℝ → ℝ) (p : TensorContactParameter N m n) + (ht : p.1 ∈ Icc (0 : ℝ) 1) (ha : ∀ i, 0 ≤ p.2.1 i) + (hu : ∀ j, |p.2.2.1 j| ≤ 2) (hv : ∀ j, |p.2.2.2 j| ≤ 2) : + (d * (1 - cut (Fin.last n).castSucc) / 2) * (∑ i, p.2.1 i) - + gaussianAbsoluteMean * Real.sqrt (∑ i, p.2.1 i) - + (∑ i : Fin n, Real.log 2 / cut i.succ.castSucc) - K / 2 - + (2 * m * perturbationScale N + 8 * perturbationScale N ^ 2) + S + V p.1 ≤ + spinPriorContactObjective μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2)) V p := by + let step := contactFieldStep cut hc hfirst hlast p.2.1 ha + have hp := spinPriorRestrictedContactPressure_field_le hhaar hgauss hN μ hμ C hC eig I K heig + cut hc hfirst hlast p ht ha hu hv + have hf := fieldValue_add_pairing_cap trial hd htrial step + have hpair := fieldPairing_contactFieldStep trial cut hc hfirst hlast p.2.1 ha values hvalues + change fieldPairing trial step = _ at hpair + rw [hpair, fieldPartitionConstant_contactFieldStep] at hf + change fieldValue step 0 + (∑ i, ((cut i.succ - cut i.castSucc) * values i) * + finiteFieldPath p.2.1 i) / 2 ≤ + -(d * (1 - cut (Fin.last n).castSucc) / 2) * finiteFieldPath p.2.1 n + + gaussianAbsoluteMean * Real.sqrt (finiteFieldPath p.2.1 n) + + (∑ i : Fin n, Real.log 2 / cut i.succ.castSucc) at hf + rw [finiteFieldPath_last] at hf + have hU : 0 ≤ ∑ j : Fin N, perturbationWeight j * (p.2.2.1 j - 3 / 2) ^ 2 := + Finset.sum_nonneg (fun j _ => mul_nonneg (perturbationWeight_nonneg j) (sq_nonneg _)) + have hW : 0 ≤ ∑ j : Fin m, (p.2.2.2 j - 3 / 2) ^ 2 := + Finset.sum_nonneg (fun j _ => sq_nonneg _) + change spinPriorContactPressure μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I (chainExponent cut) p+(N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2) ≤ + fieldValue step 0 + K / 2 + (2 * m * perturbationScale N + 8 * perturbationScale N ^ 2) at hp + unfold spinPriorContactObjective + linarith + +/-- One fixed cap works for every dimension and every allowed perturbation +parameter. Thus a negative contact sublevel cannot touch its field face. -/ +theorem exists_spinPriorRestrictedContactObjective_cap + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (m n : ℕ) (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (d : ℝ) (hd : 0 < d) (htrial : ∀ᵐ s ∂pathMeasure, trial s ≤ 1 - d) + (K S L : ℝ) : + ∃ H : ℝ, 0 < H ∧ ∀ (N : ℕ) (_hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) (_hμprob : IsProbabilityMeasure μ) + (_hμ : μ.IsMulLeftInvariant) (C : Finset (Spin N)) (hC : C.Nonempty) (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (_heig : ∀ i, |eig i| ≤ K) (V : ℝ → ℝ) + (_hV : ∀ t ∈ Icc (0 : ℝ) 1, L ≤ V t) (p : TensorContactParameter N m n), + p.1 ∈ Icc (0 : ℝ) 1 → (∀ i, 0 ≤ p.2.1 i) → + (∀ j, |p.2.2.1 j| ≤ 2) → (∀ j, |p.2.2.2 j| ≤ 2) → + spinPriorContactObjective μ (restrictedSpinPrior C hC : Measure (Spin N)) eig (fun _ => 0) I (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N : ℝ)⁻¹*(Real.log C.card-N*Real.log 2)) V p < 0 → + (∑ i, p.2.1 i) < H := by + let e := d * (1 - cut (Fin.last n).castSucc) / 2 + let Cq := ∑ i : Fin n, Real.log 2 / cut i.succ.castSucc + have he : 0 < e := by + have hcut : cut (Fin.last n).castSucc < 1 := by + simpa only [hlast] using hc (Fin.castSucc_lt_last (Fin.last n)) + dsimp only [e] + positivity + obtain ⟨H, hH, hbound⟩ := exists_linear_sqrt_cap he gaussianAbsoluteMean + (Cq + K / 2 + (2 * m + 8) - S - L) 0 + refine ⟨H, hH, ?_⟩ + intro N hN μ hμprob hμ C hC eig I heig V hV p ht ha hu hv hneg + have : IsProbabilityMeasure μ := hμprob + by_contra hn + have hx : H ≤ ∑ i, p.2.1 i := le_of_not_gt hn + have hs := hbound (∑ i, p.2.1 i) hx + have hcap := spinPriorRestrictedContactObjective_cap_bound hhaar hgauss hN μ hμ C hC eig I K heig + cut hc hfirst hlast trial values hvalues d hd.le htrial S V p ht ha hu hv + have herr : 2 * m * perturbationScale N + 8 * perturbationScale N ^ 2 ≤ 2 * m + 8 := by + have h1 := InvariantIsing.perturbationScale_le_one (by omega : 0 < N) + have h2 := perturbationScale_sq_le_one (by omega : 0 < N) + have h1' := mul_le_mul_of_nonneg_left h1 + (show 0 ≤ (2 : ℝ) * m from mul_nonneg (by norm_num) (Nat.cast_nonneg m)) + have h2' := mul_le_mul_of_nonneg_left h2 (show 0 ≤ (8 : ℝ) by norm_num) + linarith + have hv' := hV p.1 ht + change -e * (∑ i, p.2.1 i) + gaussianAbsoluteMean * Real.sqrt (∑ i, p.2.1 i) + + (Cq + K / 2 + (2 * m + 8) - S - L) ≤ 0 at hs + change e * (∑ i, p.2.1 i) - gaussianAbsoluteMean * Real.sqrt (∑ i, p.2.1 i) - + Cq - K / 2 - _ + S + V p.1 ≤ _ at hcap + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedEntropyLimit.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedEntropyLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a7139af179015acb7e4d8abe66f3a7a8caf3552 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRestrictedEntropyLimit.lean @@ -0,0 +1,138 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorContactNoSequence +import OAI.Probability.InvariantIsing.Fields.SpinPriorRestrictedCap + +namespace OAI + + +/-! Uniform asymptotic nonnegativity of the actual contact problem for a +fixed trial partition. The hypotheses are the Haar and root/cascade concentration estimates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem spinPriorRestrictedContact_entropy_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (C : (k : ℕ) → Finset (Spin (N k))) (hC : ∀ k, (C k).Nonempty) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (d : ℝ) (hd : 0 < d) (htrial : ∀ᵐ s ∂pathMeasure, trial s ≤ 1 - d) + (δ S : ℝ) (hδ : 0 < δ) (hS : ∀ H ε : ℝ, 0<ε → ∀ᶠ k in atTop, + ∀ (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i), (∑ i, a i) ≤ H → + constrainedBlockValue (C k) (contactFieldStep cut hc hfirst hlast a ha)+ + fieldPairing trial (contactFieldStep cut hc hfirst hlast a ha)/2 ≤ S+ε) : + ∃ H : ℝ, 0 < H ∧ ∀ η : ℝ, 0 < η → ∀ᶠ k in atTop, + ∀ p ∈ tensorContactRegion (N k) m n H, + -η ≤ spinPriorContactObjective (μ k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) (eig k) (fun _ => 0) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N k : ℝ)⁻¹*(Real.log (C k).card-N k*Real.log 2)) + (fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ) p := by + classical + let V : ℝ → ℝ := fun t => finiteTemperatureFunctional ρ lam hρpos hρsum trial t + t * δ + have hV : Continuous V := (continuous_finiteTemperatureFunctional ρ lam hρpos hρsum trial).add + (continuous_id.mul continuous_const) + have hV0 : V 0 = 0 := by simp [V, finiteTemperatureFunctional] + obtain ⟨tmin, _, hlow⟩ := isCompact_Icc.exists_isMinOn (nonempty_Icc.mpr zero_le_one) hV.continuousOn + obtain ⟨H, hH, hcap⟩ := exists_spinPriorRestrictedContactObjective_cap hhaar hgauss m n cut hc hfirst hlast + trial values hvalues d hd htrial K S (V tmin) + refine ⟨H, hH, ?_⟩ + intro η hη + have hcost : ∀ᶠ k in atTop, + 2 * m * perturbationScale (N k) + 8 * perturbationScale (N k) ^ 2 < η/3 := + ((fullPerturbationCost_tendsto m).comp hNlim).eventually (gt_mem_nhds (show 0<η/3 by positivity)) + by_contra hbad + have hbad' : ∃ᶠ k in atTop, ∃ p ∈ tensorContactRegion (N k) m n H, + spinPriorContactObjective (μ k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) (eig k) (fun _ => 0) (I k) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N k : ℝ)⁻¹*(Real.log (C k).card-N k*Real.log 2)) V p < -η := by + simpa only [V, Filter.not_eventually, not_forall, not_imp, not_le, exists_prop] using hbad + obtain ⟨φ, hφ, hφbad⟩ := extraction_of_frequently_atTop (hbad'.and_eventually (hcost.and (hS H (η/3) (by positivity)))) + have hmins (k : ℕ) := spinPriorContactObjective_exists_minimum hhaar hgauss (hN (φ k)) + (μ (φ k)) (hμinv (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k)))) (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + K (heig (φ k)) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N (φ k) : ℝ)⁻¹*(Real.log (C (φ k)).card-N (φ k)*Real.log 2)) V hV H hH.le + choose p hp hmin using hmins + have hneg (k : ℕ) : + spinPriorContactObjective (μ (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k)))) (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ - cut i.castSucc) * values i) (S-(N (φ k) : ℝ)⁻¹*(Real.log (C (φ k)).card-N (φ k)*Real.log 2)) V (p k) < -η := by + obtain ⟨q, hq, hqneg⟩ := (hφbad k).1 + exact (hmin k q hq).trans_lt hqneg + have hcap' (k : ℕ) : (∑ i, (p k).2.1 i) < H := by + have hb := tensorContactRegion_bounds (hp k) + apply hcap (N (φ k)) (hN (φ k)) (μ (φ k)) inferInstance (hμinv (φ k)) (C (φ k)) (hC (φ k)) + (eig (φ k)) (I (φ k)) (heig (φ k)) V (fun t ht => hlow ht) (p k) hb.1 hb.2.1 + · intro j + rw [abs_of_nonneg (by have := (hb.2.2.2.1 j).1; linarith)] + exact (hb.2.2.2.1 j).2 + · intro j + rw [abs_of_nonneg (by have := (hb.2.2.2.2 j).1; linarith)] + exact (hb.2.2.2.2 j).2 + · linarith [hneg k] + have hpos (k : ℕ) : 0 < (p k).1 := by + have hb := tensorContactRegion_bounds (hp k) + by_contra hzero + have heq : (p k).1 = 0 := le_antisymm (not_lt.mp hzero) hb.1.1 + have hu j : |(p k).2.2.1 j| ≤ 2 := by + rw [abs_of_nonneg (by have := (hb.2.2.2.1 j).1; linarith)] + exact (hb.2.2.2.1 j).2 + have hv j : |(p k).2.2.2 j| ≤ 2 := by + rw [abs_of_nonneg (by have := (hb.2.2.2.2 j).1; linarith)] + exact (hb.2.2.2.2 j).2 + have hzeroBound := spinPriorRestrictedContact_zero_bound hhaar hgauss (hN (φ k)) + (μ (φ k)) (hμinv (φ k)) (C (φ k)) (hC (φ k)) (eig (φ k)) (I (φ k)) cut hc hfirst hlast + (p k).2.1 hb.2.1 (p k).2.2.1 hu (p k).2.2.2 hv trial values hvalues (S+η/3) ((hφbad k).2.2 (p k).2.1 hb.2.1 hb.2.2.1) V hV0 + have hpEq : p k = (0, (p k).2.1, (p k).2.2.1, (p k).2.2.2) := by + exact Prod.ext heq (Prod.ext rfl (Prod.ext rfl rfl)) + rw [← hpEq] at hzeroBound + have hshift : spinPriorContactObjective (μ (φ k)) + (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k)))) + (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ-cut i.castSucc)*values i) + (S+η/3-(N (φ k) : ℝ)⁻¹*(Real.log (C (φ k)).card-N (φ k)*Real.log 2)) V (p k) = + spinPriorContactObjective (μ (φ k)) + (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k)))) + (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ-cut i.castSucc)*values i) + (S-(N (φ k) : ℝ)⁻¹*(Real.log (C (φ k)).card-N (φ k)*Real.log 2)) V (p k)+η/3 := by + unfold spinPriorContactObjective + ring + rw [hshift] at hzeroBound + have := (hφbad k).2.1 + linarith [hneg k] + have hmin0 (k : ℕ) (z : TensorContactParameter (N (φ k)) m n) + (hz : z ∈ tensorContactRegion (N (φ k)) m n H) : + spinPriorContactObjective (μ (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k))) + (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ-cut i.castSucc)*values i) 0 V (p k) ≤ + spinPriorContactObjective (μ (φ k)) (restrictedSpinPrior (C (φ k)) (hC (φ k))) + (eig (φ k)) (fun _ => 0) (I (φ k)) (chainExponent cut) + (fun i => (cut i.succ-cut i.castSucc)*values i) 0 V z := by + have hm := hmin k z hz + simp only [spinPriorContactObjective] at hm ⊢ + linarith + exact spinPriorContact_no_positive_minimizing_sequence hhaar hgauss + (fun k => N (φ k)) (fun k => hN (φ k)) (hNlim.comp hφ.tendsto_atTop) m n + (fun k => μ (φ k)) (fun k => hμinv (φ k)) + (fun k => (restrictedSpinPrior (C (φ k)) (hC (φ k)) : Measure (Spin (N (φ k))))) (fun k => eig (φ k)) (fun _ _ => 0) + K hK (fun k => heig (φ k)) (fun k => I (φ k)) (fun k => hdis (φ k)) + (fun k => hcover (φ k)) lam (fun k => hlam (φ k)) ρ hρpos hρsum + (hρ.comp hφ.tendsto_atTop) cut hc hfirst hlast trial values hvalues δ 0 H hδ p hp hmin0 hcap' hpos + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRootVariance.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRootVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fab1a45f2b97de80cf09a3e67c9cd1f281d2e1b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorRootVariance.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorLabeledMoments +import OAI.Probability.InvariantIsing.Arrays.NSpinTensorRootVariance + +namespace OAI + +/-! The root Gaussian variance estimate is uniform in the normalized spin +constraint. Its constant is the physical tensor coefficient norm. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal InnerProductSpace +namespace InvariantIsing + +theorem spinPriorCascadeValue_root_lipschitz {N m k : ℕ} (hN : 0 < N) + (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (hb : CascadeExponents n b) (site : ℝ≥0) (monomial : Fin k → ℝ≥0) : + let B : ℝ≥0 := ⟨(site : ℝ)*N + ∑ j, (monomial j : ℝ)*amp j^2, by positivity⟩ + LipschitzWith (NNReal.sqrt B) (fun g => spinPriorCascadeValue π eig U c I degree amp n b v + (tensorRootMark I degree (tensorVarianceProfile I degree site monomial) g)) := by + intro B + have hs : (NNReal.sqrt B : ℝ)^2 = B := by exact_mod_cast NNReal.sq_sqrt B + have hn (σ : Spin N) : + ‖tensorRootCoefficient U I degree amp (tensorVarianceProfile I degree site monomial) σ‖ ≤ + (NNReal.sqrt B : ℝ) := by + have hcap := tensorRootCoefficient_norm_sq_le U I degree amp site monomial σ + change ‖tensorRootCoefficient U I degree amp (tensorVarianceProfile I degree site monomial) σ‖^2 ≤ (B : ℝ) at hcap + nlinarith [norm_nonneg (tensorRootCoefficient U I degree amp + (tensorVarianceProfile I degree site monomial) σ), NNReal.coe_nonneg (NNReal.sqrt B)] + apply LipschitzWith.of_dist_le_mul + intro g h + rw [Real.dist_eq] + refine (energyRecursion_lipschitz n b _ π + (fun i _ => tensorEnergyMarkLaw_moments hN U I degree amp (v i)) + (fun i hi => (hb.1 i hi).1) _ _).trans ?_ + apply (pi_norm_le_iff_of_nonneg (mul_nonneg (NNReal.coe_nonneg _) (dist_nonneg))).mpr + intro σ + simp only [Pi.sub_apply, Real.norm_eq_abs, tensorSpinBaseEnergy, + add_sub_add_left_eq_sub, spinTensorEnergy_tensorRootMark, ← inner_sub_right] + exact (abs_real_inner_le_norm _ _).trans + (by simpa only [dist_eq_norm] using mul_le_mul_of_nonneg_right (hn σ) (norm_nonneg (g-h))) + +theorem spinPriorCascadeValue_root_memLp_variance (hpub : GaussianLipschitzVarianceInput) + {N m k : ℕ} (hN : 0 < N) (π : Measure (Spin N)) [IsProbabilityMeasure π] + (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → SpinTensorIndex I degree → ℝ≥0) + (hb : CascadeExponents n b) (site : ℝ≥0) (monomial : Fin k → ℝ≥0) : + MemLp (spinPriorCascadeValue π eig U c I degree amp n b v) 2 + (tensorGaussianLaw I degree (tensorVarianceProfile I degree site monomial) : Measure _) ∧ + variance (spinPriorCascadeValue π eig U c I degree amp n b v) + (tensorGaussianLaw I degree (tensorVarianceProfile I degree site monomial) : Measure _) ≤ + (site : ℝ)*N + ∑ j, (monomial j : ℝ)*amp j^2 := by + let B : ℝ≥0 := ⟨(site : ℝ)*N + ∑ j, (monomial j : ℝ)*amp j^2, by positivity⟩ + let F := fun g => spinPriorCascadeValue π eig U c I degree amp n b v + (tensorRootMark I degree (tensorVarianceProfile I degree site monomial) g) + have hLip : LipschitzWith (NNReal.sqrt B) F := + spinPriorCascadeValue_root_lipschitz hN π eig U c I degree amp n b v hb site monomial + have hLip0 : LipschitzWith (NNReal.sqrt B) (fun g => F g-F 0) := by + apply LipschitzWith.of_dist_le_mul + intro g h + simpa only [dist_sub_right] using hLip.dist_le_mul g h + have hL := hLip0.comp_memLp (by simp) + (IsGaussian.memLp_two_id : MemLp id 2 (stdGaussian (TensorGaussianSpace I degree))) + have hF : MemLp F 2 (stdGaussian (TensorGaussianSpace I degree)) := by + convert hL.add (memLp_const (F 0)) using 1 + ext g + simp only [Pi.add_apply, Function.comp_apply, id_eq, sub_add_cancel] + have hm := measurable_spinPriorCascadeValue π eig U c I degree amp n b v + have hp := tensorRootMark_measurePreserving I degree (tensorVarianceProfile I degree site monomial) + refine ⟨?_, ?_⟩ + · rw [← hp.map_eq] + exact (memLp_map_measure_iff hm.aestronglyMeasurable hp.aemeasurable).mpr hF + · have hv := hpub (Fintype.card (SpinTensorIndex I degree)) (NNReal.sqrt B) F hLip + rw [hp.variance_fun_comp hm.aemeasurable] at hv + exact hv.trans_eq (by + change (NNReal.sqrt B : ℝ)^2 = (B : ℝ) + exact_mod_cast NNReal.sq_sqrt B) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTemperatureCGF.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTemperatureCGF.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dfe626949a2b5e36c0671274041e7be4e1293df --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTemperatureCGF.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorExponential +import OAI.Probability.InvariantIsing.Arrays.TensorTemperatureCGF + +namespace OAI + +/-! Temperature is a bounded tilt with the actual quenched cascade and +constrained spin prior retained. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped Topology +namespace InvariantIsing + +lemma spinPriorTemperature_reference_fold {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) (t : ℝ) : + ∀ᵐ p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates, + (spinPriorNamespacedReference π (diagonalPerturbedEigenvalues eig I v 0) c I degree amp r h p).tilted + (fun x => t * rotatedEnergy eig (specialRotation p.1.1) x.1) = + spinPriorNamespacedReference π (diagonalPerturbedEigenvalues eig I v t) c I degree amp r h p := by + filter_upwards [spinPriorNamespaced_exp_integrable_ae μ π (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp n b r h hh h0, + spinPriorNamespaced_exp_integrable_ae μ π (diagonalPerturbedEigenvalues eig I v t) + c I degree amp n b r h hh h0] with p hp ht + let ν := labeledSpinReference n π p.1.2 + let H := tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v 0) c I degree amp n r h p + let G := fun x : Spin N × LabeledLeaf n => t * rotatedEnergy eig (specialRotation p.1.1) x.1 + have he := tensorTemperatureHamiltonian_affine hN eig c I v degree amp n r h p t + have hH : Integrable (fun x => Real.exp (H x)) ν := hp + have hi : Integrable (fun x => Real.exp (H x + G x)) ν := by + change Integrable (fun x => Real.exp + (tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v t) c I degree amp n r h p x)) ν at ht + rw [he] at ht + exact ht + change (gibbsProbability ν H).tilted G = gibbsProbability ν + (tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v t) c I degree amp n r h p) + rw [he, gibbsProbability_eq_tilted ν H hH, + gibbsProbability_eq_tilted ν (fun x => H x + G x) hi, tilted_tilted hH G] + rfl + +lemma spinPriorTemperatureCGF_eq_log_difference {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) (t : ℝ) : + ∀ᵐ p ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates, + cgf (fun x : Spin N × LabeledLeaf n => rotatedEnergy eig (specialRotation p.1.1) x.1) + (spinPriorNamespacedReference π (diagonalPerturbedEigenvalues eig I v 0) c I degree amp r h p) t = + spinPriorNamespacedLog π (diagonalPerturbedEigenvalues eig I v t) c I degree amp r h p - + spinPriorNamespacedLog π (diagonalPerturbedEigenvalues eig I v 0) c I degree amp r h p := by + filter_upwards [spinPriorNamespaced_exp_integrable_ae μ π (diagonalPerturbedEigenvalues eig I v 0) + c I degree amp n b r h hh h0, + spinPriorNamespaced_exp_integrable_ae μ π (diagonalPerturbedEigenvalues eig I v t) + c I degree amp n b r h hh h0] with p hp ht + have he := tensorTemperatureHamiltonian_affine hN eig c I v degree amp n r h p t + let ν := labeledSpinReference n π p.1.2 + let H := tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v 0) c I degree amp n r h p + let Y := fun x : Spin N × LabeledLeaf n => rotatedEnergy eig (specialRotation p.1.1) x.1 + have hH : Integrable (fun x => Real.exp (H x)) ν := hp + have hi : Integrable (fun x => Real.exp (H x + t * Y x)) ν := by + change Integrable (fun x => Real.exp + (tensorNamespacedHamiltonian (diagonalPerturbedEigenvalues eig I v t) c I degree amp n r h p x)) ν at ht + rw [he] at ht + exact ht + change cgf Y (gibbsProbability ν H) t = _ + rw [cgf_fold ν H Y t hH hi] + rw [show (fun x => H x + t * Y x) = tensorNamespacedHamiltonian + (diagonalPerturbedEigenvalues eig I v t) c I degree amp n r h p from he.symm] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTemperatureDerivative.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTemperatureDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..30e962b7291f4e65b69058f3678e55dee6cf518e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTemperatureDerivative.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorTemperatureCGF +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure + +namespace OAI + +/-! The temperature derivative for the actual constrained cascade model. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def spinPriorObservableAverage {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) (π : Measure (Spin N)) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (D : SpecialOrthogonal N → Spin N × LabeledLeaf n → ℝ) : ℝ := + ∫ p : TensorFlatDisorder N n, ∫ x, D p.1.1 x + ∂spinPriorNamespacedReference π eig c I degree amp r h p + ∂(μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + +theorem hasDerivAt_spinPriorMeanPressure_temperature {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) (hh : Monotone h) (h0 : 0 ≤ h 0) + (K : ℝ) (hK : ∀ i, |eig i| ≤ K) (t : ℝ) : + HasDerivAt (fun s => spinPriorMeanPressure (n := n) μ π + (diagonalPerturbedEigenvalues eig I v s) c I degree amp b r h) + (spinPriorObservableAverage (n := n) μ π (diagonalPerturbedEigenvalues eig I v t) + c I degree amp b r h (fun U x => (N : ℝ)⁻¹ * rotatedEnergy eig (specialRotation U) x.1)) t := by + let P := (μ.prod (labeledCascadeLaw n b : Measure (LabeledTree n))).prod gaussianCoordinates + let ν := spinPriorNamespacedReference (n := n) π (diagonalPerturbedEigenvalues eig I v 0) c I degree amp r h + let Y := fun (p : TensorFlatDisorder N n) (x : Spin N × LabeledLeaf n) => + rotatedEnergy eig (specialRotation p.1.1) x.1 + have hY : Measurable (Function.uncurry Y) := measurable_tensorTemperatureObservable eig + have hB (p : TensorFlatDisorder N n) (x : Spin N × LabeledLeaf n) : |Y p x| ≤ K * N / 2 := + abs_rotatedEnergy_le eig (specialRotation p.1.1) K hK x.1 + have hd := hasDerivAt_bounded_random_cgf P ν + (measurable_spinPriorNamespacedReference (n := n) π _ c I degree amp r h) Y hY (K * N / 2) hB t + let M := fun s => spinPriorMeanPressure (n := n) μ π + (diagonalPerturbedEigenvalues eig I v s) c I degree amp b r h + have he (s : ℝ) : M s = M 0 + (∫ p, cgf (Y p) (ν p) s ∂P) / N := by + have hi (s : ℝ) := spinPriorNamespacedLog_integrable (n := n) μ π + (diagonalPerturbedEigenvalues eig I v s) c I degree amp b r h hh h0 + rw [integral_congr_ae (spinPriorTemperatureCGF_eq_log_difference hN μ π eig c I v degree amp n b r h hh h0 s), + integral_sub (hi s) (hi 0)] + dsimp only [M, spinPriorMeanPressure] + ring + have hf : M = fun s => M 0 + (∫ p, cgf (Y p) (ν p) s ∂P) / N := funext he + have hfold : (∫ p, ∫ x, Y p x ∂(ν p).tilted (fun x => t * Y p x) ∂P) = + ∫ p, ∫ x, Y p x ∂spinPriorNamespacedReference (n := n) π (diagonalPerturbedEigenvalues eig I v t) + c I degree amp r h p ∂P := by + apply integral_congr_ae + filter_upwards [spinPriorTemperature_reference_fold hN μ π eig c I v degree amp n b r h hh h0 t] with p hp + rw [hp] + have hhD := (hd.div_const (N : ℝ)).const_add (M 0) + rw [hfold] at hhD + rw [← hf] at hhD + simpa only [M, Y, P, spinPriorObservableAverage, integral_const_mul, integral_mul_const, div_eq_mul_inv, + mul_comm] using hhD + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTreeGeometry.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTreeGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..4261035d681b0969e9e15de738131abe9d17f4f4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorTreeGeometry.lean @@ -0,0 +1,112 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorGeometricLimit +import OAI.Probability.InvariantIsing.Fields.SpinPriorLeafTail +import OAI.Probability.InvariantIsing.Arrays.TensorTreeLevels + +namespace OAI + +/-! Geometry and exact tree tails of the constrained cascade limit. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem spinPriorPerturbedArrayLaw_limit_geometry (N : ℕ → ℕ) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (u : (k : ℕ) → Fin (N k) → ℝ) (v : ℕ → Fin m → ℝ) (t : ℕ → ℝ) + (b : ℕ → ℝ) (h : ℕ → ℕ → ℝ) (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hL : Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) : + (∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) ∧ + ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q := by + constructor + · exact spectralArray_limit_gram hL (fun k => spinPriorPerturbedArrayLaw_gram (n := n) + (μ k) (π k) b (eig k) (c k) (I k) (u k) (v k) (t k) (h k)) + · intro e he + exact spectralArray_limit_reindex hL e (fun k => spinPriorPerturbedArrayLaw_reindex (n := n) + (μ k) (π k) b (eig k) (c k) (I k) (u k) (v k) (t k) (h k) e he) + +lemma spinPriorPerturbedArrayLaw_treeLevels {N m : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) + (n : ℕ) (b h : ℕ → ℝ) (i j : ℕ) : + ∀ᵐ x ∂(spinPriorPerturbedArrayLaw (n := n) μ π b eig c I u v t h : Measure (SpectralArray (m + 1))), + (x (i,j) (Fin.last m) : ℝ) ∈ treeLevels n := by + unfold spinPriorPerturbedArrayLaw spinPriorArrayLaw + exact spectralArrayLaw_treeLevels _ _ _ _ _ _ _ i j + +lemma spinPriorPerturbedArrayLaw_limit_treeLevels (N : ℕ → ℕ) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (u : (k : ℕ) → Fin (N k) → ℝ) (v : ℕ → Fin m → ℝ) (t : ℕ → ℝ) + (b : ℕ → ℝ) (h : ℕ → ℕ → ℝ) (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hL : Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) (i j : ℕ) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (i,j) (Fin.last m) : ℝ) ∈ treeLevels n := by + exact ae_closed_of_weak_limit hL ((isClosed_treeLevels n).preimage (by fun_prop)) + (fun k => spinPriorPerturbedArrayLaw_treeLevels (μ k) (π k) (eig k) (c k) (I k) + (u k) (v k) (t k) n b (h k) i j) + + +lemma spinPriorArrayLaw_treeTail {N m k : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (π : Measure (Spin N)) [IsProbabilityMeasure π] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (n : ℕ) (b : ℕ → ℝ) (r : Fin k → ℕ) (h : ℕ → ℝ) + (hb : CascadeExponents n b) (hh : Monotone h) (h0 : 0 ≤ h 0) (d : Fin n) : + (∫ x, treeTail n d (x (0,1) (Fin.last m) : ℝ) + ∂(spinPriorArrayLaw μ π eig c I degree amp n b r h : Measure (SpectralArray (m + 1)))) = 1 - b d := by + have he := spinPriorArrayLaw_test μ π eig c I degree amp n b r h + (fun x => treeTail n d (x (0,1) (Fin.last m) : ℝ)) + ((continuous_treeTail n d).comp (by fun_prop)) + (fun _ => tensorLeafPrefixTest (N := N) d) ![1,0] + (by intro a b hab; fin_cases a <;> fin_cases b <;> simp_all) + (by + intro U σ + simp only [spectralJointEntry_tree, tensorLeafPrefixTest, + Matrix.cons_val_zero, Matrix.cons_val_one] + exact treeTail_overlap n d (σ 0).2 (σ 1).2) + rw [he] + exact spinPriorReplicaAverage_leafPrefix hN μ π eig c I degree amp n b r h hb hh h0 d + +lemma spinPriorPerturbedArrayLaw_limit_treeTail (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (π : (k : ℕ) → Measure (Spin (N k))) [∀ k, IsProbabilityMeasure (π k)] + (eig c : (k : ℕ) → Fin (N k) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (u : (k : ℕ) → Fin (N k) → ℝ) (v : ℕ → Fin m → ℝ) (t : ℕ → ℝ) + (b : ℕ → ℝ) (hb : CascadeExponents n b) (h : ℕ → ℕ → ℝ) + (hh : ∀ k, Monotone (h k)) (h0 : ∀ k, 0 ≤ h k 0) + (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hL : Tendsto (fun k => spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) (d : Fin n) : + (∫ x, treeTail n d (x (0,1) (Fin.last m) : ℝ) + ∂(Q : Measure (SpectralArray (m + 1)))) = 1 - b d := by + have hi := (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hL) + (BoundedContinuousFunction.mkOfCompact + ⟨fun x => treeTail n d (x (0,1) (Fin.last m) : ℝ), + (continuous_treeTail n d).comp (by fun_prop)⟩) + have he k := spinPriorArrayLaw_treeTail (hN k) (μ k) (π k) + (diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k)) (c k) (I k) + (fun j => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude (N k) (u k)) + n b (fun j => enumeratedTreeDegree m j) (h k) hb (hh k) (h0 k) d + have hconst : Tendsto (fun k => ∫ x, treeTail n d (x (0,1) (Fin.last m) : ℝ) + ∂(spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) (u k) (v k) (t k) (h k) : + Measure (SpectralArray (m + 1)))) atTop (𝓝 (1 - b d)) := by + simpa only [spinPriorPerturbedArrayLaw, he] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => 1 - b d) atTop (𝓝 (1 - b d))) + exact tendsto_nhds_unique hi hconst + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorWardLimits.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorWardLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..0edf1fa694386ded53ffb200cd8f27c9119627f1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinPriorWardLimits.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayWard +import OAI.Probability.InvariantIsing.Fields.SpinPriorArrayDiagonalWard +import OAI.Probability.InvariantIsing.Fields.SpinPriorGeometricLimit +import OAI.Probability.InvariantIsing.Spectral.SpectralPerturbedBlocks + +namespace OAI + +/-! Both Ward equations for weak limits of the actual fixed-prior model. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem spinPriorPerturbedArrayLaw_ward_limits + (N : ℕ → ℕ) (hN : ∀ k, 0 spinPriorPerturbedArrayLaw (n := n) (μ k) (π k) b (eig k) (c k) (I k) + (u k) (v k) (t k) (h k)) atTop (𝓝 Q)) + (ρ : Fin m → ℝ) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) : + (∀ a b₀, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ r, |Φ r|≤B) → + spectralOffWardResidual Q ρ (fun a => t₀*lam a) a b₀ Φ=0) ∧ + (∀ a b, spectralDiagonalWardResidual Q ρ (fun a => t₀*lam a) a b=0) := by + let E := fun k => diagonalPerturbedEigenvalues (eig k) (I k) (v k) (t k) + let κ := fun k a => t k*lam a+2*perturbationScale (N k)*v k a + have hκ : ∀ k a i, i∈I k a → E k i=κ k a := fun k => + diagonalPerturbedEigenvalues_block (eig k) (I k) (hdis k) (v k) (t k) lam (hlam k) + have hκlim : Tendsto κ atTop (𝓝 (fun a => t₀*lam a)) := + perturbedBlockEigenvalues_tendsto N hNlim v hv t ht lam + have hdegree (k : ℕ) (j : Fin (N k)) : + (∑ a, (enumeratedSpectralDegree m j a : ℝ))≤1*((j : ℝ)+1) := by + simpa only [one_mul] using enumeratedSpectralDegree_real_sum_le m j + refine ⟨?_,?_⟩ + · intro a b₀ Φ hΦ B hB hΦB + by_cases hab : a=b₀ + · subst b₀ + simp [spectralOffWardResidual] + have he : Tendsto (fun k => 192*B*1*perturbationScale (N k)^2) atTop (𝓝 0) := by + simpa only [zero_pow (by norm_num : (2 : ℕ)≠0),mul_zero] using + (tendsto_const_nhds.mul ((perturbationScale_tendsto.comp hNlim).pow 2) : + Tendsto (fun k => 192*B*1*perturbationScale (N k)^2) atTop (𝓝 (192*B*1*0^2))) + apply spectralOffWardResidual_zero_of_vanishing_bound hL hρ hκlim a b₀ Φ hΦ he + intro k + let := hμinv k + exact spinPriorArrayLaw_off_ward_bound (hN k) (μ k) (π k) (E k) (c k) (I k) + (hdis k) (hcover k) (fun j => enumeratedSpectralDegree m j) + (fun j => enumeratedTreeDegree m j) (u k) (hu k) 1 zero_le_one (hdegree k) + b (h k) (hh k) (h0 k) (κ k) a b₀ + (hdis k (Set.mem_univ a) (Set.mem_univ b₀) hab) (hκ k a) (hκ k b₀) Φ hΦ B hB hΦB + · intro a b₀ + by_cases hab : a=b₀ + · subst b₀ + simp [spectralDiagonalWardResidual] + have he : Tendsto (fun k => 48*1*perturbationScale (N k)^2) atTop (𝓝 0) := by + simpa only [zero_pow (by norm_num : (2 : ℕ)≠0),mul_zero] using + (tendsto_const_nhds.mul ((perturbationScale_tendsto.comp hNlim).pow 2) : + Tendsto (fun k => 48*1*perturbationScale (N k)^2) atTop (𝓝 (48*1*0^2))) + apply spectralDiagonalWardResidual_zero_of_vanishing_bound hL hρ hκlim a b₀ he + intro k + let := hμinv k + exact spinPriorArrayLaw_diagonalWard_bound (n := n) (hN k) (μ k) (π k) (E k) (c k) (I k) + (fun j => enumeratedSpectralDegree m j) (fun j => enumeratedTreeDegree m j) + (u k) (hu k) 1 zero_le_one (hdegree k) b (h k) (hh k) (h0 k) (κ k) a b₀ + (hdis k (Set.mem_univ a) (Set.mem_univ b₀) hab) (hκ k a) (hκ k b₀) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinProjectionEntropy.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinProjectionEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..bed25fd2a898daf4eecd402886002d5e11b09f3b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinProjectionEntropy.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Core.FinitePushforwardEntropy +import OAI.Probability.InvariantIsing.Fields.SpinHammingBall + +namespace OAI + +/-! Entropy lost by a deterministic spin projection is controlled by its +expected Hamming distance. The estimate uses one finite conditional kernel, +so its constant does not depend on the depth of a Gaussian cascade. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma finitePushforwardWeights_pos_image {X Y : Type*} [Fintype X] [DecidableEq Y] + (f : X → Y) (p : X → ℝ) (hp : ∀ x, 0 < p x) (x : X) : + 0 < finitePushforwardWeights f p (f x) := + (hp x).trans_le (finitePushforwardWeights_at_image f p (fun x => (hp x).le) x) + +theorem finite_pushforward_entropy_bound {X Y : Type*} + [Fintype X] [Fintype Y] [DecidableEq Y] + (f : X → Y) (p C : X → ℝ) (hp : ∀ x, 0 < p x) (hpSum : ∑ x, p x = 1) + (Z : ℝ) (hZ : 0 < Z) + (hkernel : ∀ y, (∑ x ∈ Finset.univ.filter (fun x => f x = y), + Real.exp (-C x)) ≤ Z) : + finiteShannonEntropy p - finiteShannonEntropy (finitePushforwardWeights f p) ≤ + (∑ x, p x * C x) + Real.log Z := by + let q := finitePushforwardWeights f p + let r := fun x => q (f x) * Real.exp (-C x) / Z + have hq (y : Y) : 0 ≤ q y := + finitePushforwardWeights_nonneg f p (fun x => (hp x).le) y + have hqi (x : X) : 0 < q (f x) := finitePushforwardWeights_pos_image f p hp x + have hr (x : X) : 0 < r x := div_pos (mul_pos (hqi x) (Real.exp_pos _)) hZ + have hrSum : ∑ x, r x ≤ 1 := by + rw [← Finset.sum_fiberwise Finset.univ f r] + calc + _ = ∑ y, q y / Z * + (∑ x ∈ Finset.univ.filter (fun x => f x = y), Real.exp (-C x)) := by + apply Finset.sum_congr rfl + intro y _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x hx + dsimp only [r] + rw [(Finset.mem_filter.mp hx).2] + ring + _ ≤ ∑ y, q y / Z * Z := Finset.sum_le_sum (fun y _ => + mul_le_mul_of_nonneg_left (hkernel y) (div_nonneg (hq y) hZ.le)) + _ = 1 := by + simp only [div_mul_cancel₀ _ hZ.ne'] + exact (finitePushforwardWeights_sum f p).trans hpSum + have hk := finite_relativeEntropy_nonneg_of_sum_le p r + (fun x => (hp x).le) hpSum hr hrSum + have hlog (x : X) : Real.log (r x) = Real.log (q (f x)) - C x - Real.log Z := by + dsimp only [r] + rw [Real.log_div (mul_ne_zero (hqi x).ne' (Real.exp_ne_zero _)) hZ.ne', + Real.log_mul (hqi x).ne' (Real.exp_ne_zero _), Real.log_exp] + ring + have hi (x : X) : p x * Real.log (p x / r x) = + p x * Real.log (p x) - p x * Real.log (q (f x)) + + p x * C x + p x * Real.log Z := by + rw [Real.log_div (hp x).ne' (hr x).ne', hlog] + ring + simp_rw [hi] at hk + rw [Finset.sum_add_distrib, Finset.sum_add_distrib, Finset.sum_sub_distrib, + ← Finset.sum_mul, hpSum, one_mul] at hk + rw [finiteShannonEntropy, finitePushforwardWeights_entropy] + change -(∑ x, p x * Real.log (p x)) - (-(∑ x, p x * Real.log (q (f x)))) ≤ _ + linarith + +theorem spin_projection_entropy_bound {N : ℕ} (f : Spin N → Spin N) + (p : Spin N → ℝ) (hp : ∀ σ, 0 < p σ) (hpSum : ∑ σ, p σ = 1) (t : ℝ) : + finiteShannonEntropy p - finiteShannonEntropy (finitePushforwardWeights f p) ≤ + t * (∑ σ, p σ * (hammingDist σ (f σ) : ℝ)) + + N * Real.log (1 + Real.exp (-t)) := by + have hZ : 0 < (1 + Real.exp (-t)) ^ N := by positivity + have hkernel (τ : Spin N) : + (∑ σ ∈ Finset.univ.filter (fun σ => f σ = τ), + Real.exp (-(t * (hammingDist σ (f σ) : ℝ)))) ≤ + (1 + Real.exp (-t)) ^ N := by + calc + _ = ∑ σ ∈ Finset.univ.filter (fun σ => f σ = τ), + Real.exp (-t * (hammingDist σ τ : ℝ)) := by + apply Finset.sum_congr rfl + intro σ hσ + rw [(Finset.mem_filter.mp hσ).2] + congr 1 + ring + _ ≤ ∑ σ : Spin N, Real.exp (-t * (hammingDist σ τ : ℝ)) := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun σ _ _ => (Real.exp_pos _).le) + _ = _ := sum_exp_hamming τ t + have he := finite_pushforward_entropy_bound f p + (fun σ => t * (hammingDist σ (f σ) : ℝ)) hp hpSum _ hZ hkernel + rw [Real.log_pow] at he + calc + _ ≤ (∑ σ, p σ * (t * (hammingDist σ (f σ) : ℝ))) + + N * Real.log (1 + Real.exp (-t)) := he + _ = _ := by rw [Finset.mul_sum]; congr 1; apply Finset.sum_congr rfl; intros; ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinProjectionTrial.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinProjectionTrial.lean new file mode 100644 index 0000000000000000000000000000000000000000..de9a4dba5e24f4d70d911cdc796e375ab3782a07 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinProjectionTrial.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Core.FiniteProjectionTrial + +namespace OAI + +/-! Actual restricted spin partitions admit the projected canonical law as +a trial law. The prior remains the mass inherited from the full cube. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +theorem restrictedSpinLog_projection_bound {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (f : Spin N → Spin N) + (hf : ∀ σ, f σ ∈ S) (H : Spin N → ℝ) (t : ℝ) : + logPartition H - restrictedSpinLog S H ≤ + (∑ σ, finiteCanonicalWeights H σ * (H σ - H (f σ))) + + t * (∑ σ, finiteCanonicalWeights H σ * (hammingDist σ (f σ) : ℝ)) + + N * Real.log (1 + Real.exp (-t)) := by + classical + let : Nonempty {τ // τ ∈ S} := ⟨⟨hS.choose, hS.choose_spec⟩⟩ + let g : Spin N → {τ // τ ∈ S} := fun σ => ⟨f σ, hf σ⟩ + have hkernel (τ : {τ // τ ∈ S}) : + (∑ σ ∈ Finset.univ.filter (fun σ => g σ = τ), + Real.exp (-(t * (hammingDist σ (f σ) : ℝ)))) ≤ + (1 + Real.exp (-t)) ^ N := by + calc + _ = ∑ σ ∈ Finset.univ.filter (fun σ => g σ = τ), + Real.exp (-t * (hammingDist σ τ.val : ℝ)) := by + apply Finset.sum_congr rfl + intro σ hσ + have he : f σ = τ.val := congrArg Subtype.val (Finset.mem_filter.mp hσ).2 + rw [he] + congr 1 + ring + _ ≤ ∑ σ : Spin N, Real.exp (-t * (hammingDist σ τ.val : ℝ)) := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun σ _ _ => (Real.exp_pos _).le) + _ = _ := sum_exp_hamming τ.val t + have he := log_sum_exp_projection_bound g H (fun τ => H τ.val) + (fun σ => t * (hammingDist σ (f σ) : ℝ)) _ (by positivity) hkernel + have hsum : (∑ τ : {τ // τ ∈ S}, Real.exp (H τ.val)) = + ∑ τ ∈ S, Real.exp (H τ) := by + change (∑ τ ∈ S.attach, Real.exp (H τ.val)) = _ + exact Finset.sum_attach S (fun τ : Spin N => Real.exp (H τ)) + rw [hsum, Real.log_pow] at he + have hcost : (∑ σ, finiteCanonicalWeights H σ * (t * (hammingDist σ (f σ) : ℝ))) = + t * (∑ σ, finiteCanonicalWeights H σ * (hammingDist σ (f σ) : ℝ)) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intros + ring + rw [hcost] at he + rw [logPartition_eq, log_card_spin, restrictedSpinLog] + change Real.log (∑ σ, Real.exp (H σ)) - ↑N * Real.log 2 - + (Real.log (∑ σ ∈ S, Real.exp (H σ)) - ↑N * Real.log 2) ≤ _ + change Real.log (∑ σ, Real.exp (H σ)) ≤ Real.log (∑ σ ∈ S, Real.exp (H σ)) + + (∑ σ, finiteCanonicalWeights H σ * (H σ - H (f σ))) + + t * (∑ σ, finiteCanonicalWeights H σ * (hammingDist σ (f σ) : ℝ)) + + ↑N * Real.log (1 + Real.exp (-t)) at he + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinSliceComparison.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinSliceComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..615faf28de012107db70f95aa6a89568f8eb5182 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinSliceComparison.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Fields.SpinHammingBall + +namespace OAI + +/-! Deterministic comparison of restricted pressures through bounded +spin-flip maps, including the multiplicity cost of those maps. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma rotated_spin_energy_map_bound {N : ℕ} (eig c : Fin N → ℝ) (U : Rotation N) + (σ τ : Spin N) (d : ℕ) (hd : hammingDist σ τ ≤ d) + {K C : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) + (heig : ∀ i, |eig i| ≤ K) (hc : ∀ i, |c i| ≤ C) : + |(rotatedEnergy eig U σ + fieldEnergy c σ) - + (rotatedEnergy eig U τ + fieldEnergy c τ)| ≤ + 2 * K * Real.sqrt ((N : ℝ) * d) + 2 * C * d := by + have hd' : (hammingDist σ τ : ℝ) ≤ d := Nat.cast_le.mpr hd + have hquad := abs_rotatedEnergy_sub_spin_le eig U σ τ hK heig + have hfield := abs_fieldEnergy_sub_spin_le c σ τ hc + have hsqrt : Real.sqrt ((N : ℝ) * (hammingDist σ τ : ℝ)) ≤ + Real.sqrt ((N : ℝ) * d) := + Real.sqrt_le_sqrt (mul_le_mul_of_nonneg_left hd' (Nat.cast_nonneg _)) + have he : (rotatedEnergy eig U σ + fieldEnergy c σ) - + (rotatedEnergy eig U τ + fieldEnergy c τ) = + (rotatedEnergy eig U σ - rotatedEnergy eig U τ) + + (fieldEnergy c σ - fieldEnergy c τ) := by ring + rw [he] + exact (abs_add_le _ _).trans (add_le_add + (hquad.trans (mul_le_mul_of_nonneg_left hsqrt (by positivity))) + (hfield.trans (mul_le_mul_of_nonneg_left hd' (by positivity)))) + +lemma restricted_spin_pressure_map_le {N : ℕ} (S T : Finset (Spin N)) + (hS : S.Nonempty) (hT : T.Nonempty) (f : Spin N → Spin N) + (eig c : Fin N → ℝ) (U : Rotation N) (d : ℕ) + {K C t : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) (ht : 0 ≤ t) + (heig : ∀ i, |eig i| ≤ K) (hc : ∀ i, |c i| ≤ C) + (hf : ∀ σ ∈ S, f σ ∈ T) (hd : ∀ σ ∈ S, hammingDist σ (f σ) ≤ d) : + restrictedSpinLog S (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) ≤ + restrictedSpinLog T (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + + (2 * K * Real.sqrt ((N : ℝ) * d) + 2 * C * d) + + t * d + N * Real.log (1 + Real.exp (-t)) := by + apply restrictedSpinLog_le_of_hamming_map S T hS hT f _ _ _ d ht hf hd + intro σ hσ + have hh := rotated_spin_energy_map_bound eig c U σ (f σ) d (hd σ hσ) hK hC heig hc + linarith [(le_abs_self _).trans hh] + +lemma abs_restricted_spin_pressure_sub_le {N : ℕ} (S T : Finset (Spin N)) + (hS : S.Nonempty) (hT : T.Nonempty) (f g : Spin N → Spin N) + (eig c : Fin N → ℝ) (U : Rotation N) (d : ℕ) + {K C t : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) (ht : 0 ≤ t) + (heig : ∀ i, |eig i| ≤ K) (hc : ∀ i, |c i| ≤ C) + (hf : ∀ σ ∈ S, f σ ∈ T) (hd : ∀ σ ∈ S, hammingDist σ (f σ) ≤ d) + (hg : ∀ τ ∈ T, g τ ∈ S) (he : ∀ τ ∈ T, hammingDist τ (g τ) ≤ d) : + |restrictedSpinLog S (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) - + restrictedSpinLog T (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ)| ≤ + 2 * K * Real.sqrt ((N : ℝ) * d) + 2 * C * d + + t * d + N * Real.log (1 + Real.exp (-t)) := by + have h₁ := restricted_spin_pressure_map_le S T hS hT f eig c U d hK hC ht heig hc hf hd + have h₂ := restricted_spin_pressure_map_le T S hT hS g eig c U d hK hC ht heig hc hg he + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/SpinSliceProjection.lean b/lean/OAI/Probability/InvariantIsing/Fields/SpinSliceProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9c5f67ecae6203050577d64d5fe8d8278c3c203 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/SpinSliceProjection.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Fields.SpinHammingEnergy + +namespace OAI + +/-! Attainability of every positive-spin count and deterministic projection +to a nearest magnetization slice. -/ + +noncomputable section +open scoped BigOperators symmDiff + +namespace InvariantIsing + +def spinPositiveSites {N : ℕ} (σ : Spin N) : Finset (Fin N) := + Finset.univ.filter (fun i => σ i = true) + +def spinOfPositiveSites {N : ℕ} (S : Finset (Fin N)) : Spin N := + fun i => decide (i ∈ S) + +@[simp] lemma spinPositiveSites_of_set {N : ℕ} (S : Finset (Fin N)) : + spinPositiveSites (spinOfPositiveSites S) = S := by + ext i + simp [spinPositiveSites, spinOfPositiveSites] + +@[simp] lemma spinOfPositiveSites_of_spin {N : ℕ} (σ : Spin N) : + spinOfPositiveSites (spinPositiveSites σ) = σ := by + funext i + cases hσ : σ i <;> simp [spinPositiveSites, spinOfPositiveSites, hσ] + +lemma spin_hamming_eq_symmDiff {N : ℕ} (σ τ : Spin N) : + hammingDist σ τ = (spinPositiveSites σ ∆ spinPositiveSites τ).card := by + unfold hammingDist + congr 1 + ext i + cases hσ : σ i <;> cases hτ : τ i <;> + simp [spinPositiveSites, hσ, hτ, Finset.mem_symmDiff] + +lemma exists_spin_with_count_nearest {N : ℕ} (σ : Spin N) (k : ℕ) (hk : k ≤ N) : + ∃ τ : Spin N, (spinPositiveSites τ).card = k ∧ + hammingDist σ τ = (spinPositiveSites σ).card - k + (k - (spinPositiveSites σ).card) := by + classical + let A := spinPositiveSites σ + by_cases hka : k ≤ A.card + · obtain ⟨T, hTA, hT⟩ := Finset.exists_subset_card_eq hka + refine ⟨spinOfPositiveSites T, by simpa using hT, ?_⟩ + rw [spin_hamming_eq_symmDiff, spinPositiveSites_of_set] + change (A ∆ T).card = A.card - k + (k - A.card) + rw [Finset.symmDiff_def, Finset.sdiff_eq_empty_iff_subset.mpr hTA, + Finset.union_empty, Finset.card_sdiff_of_subset hTA, hT, Nat.sub_eq_zero_of_le hka, + Nat.add_zero] + · have hak : A.card ≤ k := (Nat.le_of_lt (Nat.lt_of_not_ge hka)) + have hrem : k - A.card ≤ (Finset.univ \ A).card := by + rw [Finset.card_sdiff_of_subset (Finset.subset_univ A), Finset.card_univ, + Fintype.card_fin] + omega + obtain ⟨B, hB, hBc⟩ := Finset.exists_subset_card_eq hrem + have hd : Disjoint A B := by + rw [Finset.disjoint_left] + intro i hiA hiB + exact (Finset.mem_sdiff.mp (hB hiB)).2 hiA + have hT : (A ∪ B).card = k := by + rw [Finset.card_union_of_disjoint hd, hBc] + omega + refine ⟨spinOfPositiveSites (A ∪ B), by simpa using hT, ?_⟩ + rw [spin_hamming_eq_symmDiff, spinPositiveSites_of_set] + change (A ∆ (A ∪ B)).card = A.card - k + (k - A.card) + rw [Finset.symmDiff_def, + Finset.sdiff_eq_empty_iff_subset.mpr Finset.subset_union_left, + Finset.empty_union, Finset.card_sdiff_of_subset Finset.subset_union_left, hT, + Nat.sub_eq_zero_of_le hak, Nat.zero_add] + +def spinCountProjection {N : ℕ} (k : ℕ) (hk : k ≤ N) (σ : Spin N) : Spin N := + Classical.choose (exists_spin_with_count_nearest σ k hk) + +lemma spinCountProjection_count {N : ℕ} (k : ℕ) (hk : k ≤ N) (σ : Spin N) : + (spinPositiveSites (spinCountProjection k hk σ)).card = k := + (Classical.choose_spec (exists_spin_with_count_nearest σ k hk)).1 + +lemma spinCountProjection_distance {N : ℕ} (k : ℕ) (hk : k ≤ N) (σ : Spin N) : + hammingDist σ (spinCountProjection k hk σ) = + (spinPositiveSites σ).card - k + (k - (spinPositiveSites σ).card) := + (Classical.choose_spec (exists_spin_with_count_nearest σ k hk)).2 + +def spinCountSlice (N k : ℕ) : Finset (Spin N) := + Finset.univ.filter (fun σ => (spinPositiveSites σ).card = k) + +lemma spinCountSlice_nonempty {N k : ℕ} (hk : k ≤ N) : (spinCountSlice N k).Nonempty := by + let σ : Spin N := fun _ => false + refine ⟨spinCountProjection k hk σ, ?_⟩ + simp only [spinCountSlice, Finset.mem_filter, Finset.mem_univ, true_and, + spinCountProjection_count] + +lemma spinCountProjection_mem {N k : ℕ} (hk : k ≤ N) (σ : Spin N) : + spinCountProjection k hk σ ∈ spinCountSlice N k := by + simp only [spinCountSlice, Finset.mem_filter, Finset.mem_univ, true_and, + spinCountProjection_count] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorGaussianTransition.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorGaussianTransition.lean new file mode 100644 index 0000000000000000000000000000000000000000..f68ea14b954b38d8c7de5c5bf6ffd0e11e6358c4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorGaussianTransition.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldFactorization +import OAI.Probability.InvariantIsing.Core.TiltedRelativeEntropy + +namespace OAI + +/-! The actual vector Gaussian transition for a nonseparable terminal, +including constrained spin blocks. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal BigOperators + +namespace InvariantIsing + +def vectorShiftGaussianKernel (N : ℕ) (v : ℝ≥0) : Kernel (Fin N → ℝ) (Fin N → ℝ) := + fieldVectorTransitionKernel N 0 v (fun _ => 0) measurable_const + +instance vectorShiftGaussianKernel_markov (N : ℕ) (v : ℝ≥0) : + IsMarkovKernel (vectorShiftGaussianKernel N v) := by + unfold vectorShiftGaussianKernel + infer_instance + +lemma vectorShiftGaussianKernel_apply (N : ℕ) (v : ℝ≥0) (z : Fin N → ℝ) : + vectorShiftGaussianKernel N v z = Measure.pi (fun i => gaussianReal (z i) v) := by + have hg : HasLinearGrowth (fun _ : ℝ => (0 : ℝ)) := + ⟨0, 0, le_rfl, le_rfl, fun _ => by simp⟩ + rw [vectorShiftGaussianKernel, fieldVectorTransitionKernel_eq_tilted 0 v _ measurable_const hg] + simp + +def vectorGaussianTransition (N : ℕ) (a : ℝ) (v : ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) : Kernel (Fin N → ℝ) (Fin N → ℝ) := by + have hW : Measurable (fun y : Fin N → ℝ => ENNReal.ofReal (Real.exp (a * F y))) := + (hF.const_mul a).exp.ennreal_ofReal + have hm := measurable_normalizeMass.comp + ((measurable_withDensity_fixed hW).comp (vectorShiftGaussianKernel N v).measurable) + exact ⟨fun z => normalizeMass ((vectorShiftGaussianKernel N v z).withDensity + (fun y => ENNReal.ofReal (Real.exp (a * F y)))), hm⟩ + +instance vectorGaussianTransition_markov (N : ℕ) (a : ℝ) (v : ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) : + IsMarkovKernel (vectorGaussianTransition N a v F hF) := + ⟨fun _ => normalizeMass_probability _⟩ + +lemma vectorGaussian_shift_exp_integrable {N : ℕ} (hN : 0 < N) (a : ℝ) (v : ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + Integrable (fun y => Real.exp (a * F y)) (Measure.pi (fun i => gaussianReal (z i) v)) := by + rw [← (vectorGaussian_shift v z).map_eq] + apply (integrable_map_measure (hF.const_mul a).exp.aestronglyMeasurable + (show AEMeasurable (fun w : Fin N → ℝ => z + w) (vectorGaussianLaw N v : Measure (Fin N → ℝ)) from + (measurable_const.add measurable_id).aemeasurable)).mpr + exact integrable_exp_of_linearGrowth _ (vectorGaussianLaw_moments hN v) + (hF.comp (measurable_const.add measurable_id)) (hG.add_left z) a + +lemma vectorGaussianTransition_eq_tilted {N : ℕ} (hN : 0 < N) (a : ℝ) (v : ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + vectorGaussianTransition N a v F hF z = + (Measure.pi (fun i => gaussianReal (z i) v)).tilted (fun y => a * F y) := by + change normalizeMass ((vectorShiftGaussianKernel N v z).withDensity _) = _ + rw [vectorShiftGaussianKernel_apply] + exact normalizeMass_exp _ _ (hF.const_mul a) + (vectorGaussian_shift_exp_integrable hN a v F hF hG z) + +lemma vectorGaussianTransition_eq_map {N : ℕ} (hN : 0 < N) (a : ℝ) (v : ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + vectorGaussianTransition N a v F hF z = + ((vectorGaussianLaw N v : Measure (Fin N → ℝ)).tilted + (fun w => a * F (z + w))).map (fun w => z + w) := by + rw [vectorGaussianTransition_eq_tilted hN a v F hF hG z] + have he := cavity_tilt_map (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + (fun w => z + w) (measurable_const.add measurable_id) (fun y => a * F y) (hF.const_mul a) + rw [(vectorGaussian_shift v z).map_eq] at he + exact he.symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledNoiseTransport.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledNoiseTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8802288176b510bb32ae54e2574153de09c708e0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledNoiseTransport.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalLabeled + +namespace OAI + +/-! Sampling the labeled vector terminal agrees with sampling its noise-tree representation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +theorem vector_labeled_noise_replica_law (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : CascadeExponents n b) (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (z : Fin N → ℝ) + (he : ∀ᵐ p ∂vectorTerminalCoordinateLaw N n b v, + Integrable (fun α => Real.exp (F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z))) + (labeledLeafLaw n p.1)) : + (vectorTerminalCoordinateLaw N n b v ⊗ₘ + probabilityReplicaKernel (vectorLabeledTerminalLaw N n F z) (measurable_vectorLabeledTerminalLaw N n F hF z)).map + (fun p i => labeledNoiseLeaf (Fin N → ℝ) n (p.1.1,markForestOfCoords (Fin N → ℝ) n p.1.2) (p.2 i)) = + probabilityReplicaKernel (vectorTerminalNoiseLaw N n F z) (measurable_vectorTerminalNoiseLaw N n F hF z) ∘ₘ + (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure _) := by + let T := fun p : VectorTerminalCoordinates N n => labeledNoiseJoin (Fin N → ℝ) n + (p.1,markForestOfCoords (Fin N → ℝ) n p.2) + have hT : Measurable T := by fun_prop + have hPQ : (vectorTerminalCoordinateLaw N n b v).map T = + (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure _) := + labeledNoiseCoordinates_law (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) + have hp : MeasurePreserving T (vectorTerminalCoordinateLaw N n b v) + (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure _) := ⟨hT,hPQ⟩ + apply sampling_replica_morphism (vectorTerminalCoordinateLaw N n b v) _ + (measurable_vectorLabeledTerminalLaw N n F hF z) (measurable_vectorTerminalNoiseLaw N n F hF z) hT hPQ + (ψ := fun p α => labeledNoiseLeaf (Fin N → ℝ) n (p.1,markForestOfCoords (Fin N → ℝ) n p.2) α) + · apply measurable_from_prod_countable_left + intro α + exact (measurable_labeledNoiseLeaf (Fin N → ℝ) n α).comp (by fun_prop) + · have hg := hp.quasiMeasurePreserving.tendsto_ae.eventually + (noiseCascade_good (Fin N → ℝ) n b hb (fun i => vectorGaussianLaw N (v i))) + filter_upwards [hg,he] with p hg hi + have ht : 0 < noiseTreeTotal (Fin N → ℝ) n (T p) ∧ noiseTreeTotal (Fin N → ℝ) n (T p) < ⊤ := by + cases n with + | zero => simp [noiseTreeTotal,rawTreeTotal] + | succ n => exact hg.1 + have hbase := labeledLeafLaw_noiseMap (Fin N → ℝ) n p.1 (markForestOfCoords (Fin N → ℝ) n p.2) hg ht + let f := labeledNoiseLeaf (Fin N → ℝ) n (p.1,markForestOfCoords (Fin N → ℝ) n p.2) + let H := fun w => F (vectorLeafSum N n z w) + have hH : Measurable H := hF.comp ((measurable_vectorLeafSum N n).comp (measurable_const.prodMk measurable_id)) + have hs : (fun α => H (f α)) = (fun α => F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z)) := by + funext α + exact congrArg F (vectorLeafSum_labeled N n z p α) + have hi' : Integrable (fun α => Real.exp (H (f α))) (labeledLeafLaw n p.1) := by + convert hi using 1 + funext α + exact congrArg Real.exp (congrFun hs α) + have h := gibbsProbability_map_normalize (labeledLeafLaw n p.1) (measurable_of_countable f) hH hi' + rw [hs,hbase] at h + exact h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledPairLaw.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledPairLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..189d410a8d823421a5445b72747d73b125877c37 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledPairLaw.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Fields.VectorLabeledSeedTransport +import OAI.Probability.InvariantIsing.Arrays.CoordinateReplicaAncestry +import OAI.Probability.InvariantIsing.Fields.NoiseReplicaPairData +import OAI.Probability.InvariantIsing.Arrays.CoordinatePairData + +namespace OAI + +/-! Joint ancestry and both complete paths for the original finite vector terminal. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +theorem vector_labeled_seed_pair_law {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) : + ∃ ψ : ℕ → (Fin N → ℝ) → unitInterval → (Fin N → ℝ), + (∀ i, Measurable (Function.uncurry (ψ i))) ∧ + (∀ i z, volume.map (ψ i z) = vectorTerminalAncestorKernel N n b v F hF i z) ∧ + ∀ z, (∀ᵐ p ∂vectorTerminalCoordinateLaw N n b v, + Integrable (fun α => Real.exp (F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z))) + (labeledLeafLaw n p.1)) → + (vectorTerminalCoordinateLaw N n b v ⊗ₘ + probabilityReplicaKernel (vectorLabeledTerminalLaw N n F z) + (measurable_vectorLabeledTerminalLaw N n F hF z)).map + (fun p => coordinatePairData n (p.1.2,p.2)) = + ((noiseCascadeLaw unitInterval n b (fun _ => cascadeSeedLaw) : Measure (NoiseTree unitInterval n)) ⊗ₘ + probabilityReplicaKernel (noiseLeafKernel unitInterval n) (noiseLeafKernel unitInterval n).measurable).map + (fun p => noiseReplicaPairData n (fun i => cascadeSeedLeaf n ψ z (p.2 i))) := by + obtain ⟨ψ,hψ,hψlaw,hfull⟩ := vector_labeled_seed_replica_law hN n b v hb F hF hG + refine ⟨ψ,hψ,hψlaw,fun z he => ?_⟩ + have hm : Measurable (fun p : VectorTerminalCoordinates N n × LabeledLeaf n => + noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z + (labeledNoiseLeaf (Fin N → ℝ) n (p.1.1,markForestOfCoords (Fin N → ℝ) n p.1.2) p.2)) := by + apply measurable_from_prod_countable_left + intro α + exact (measurable_noiseLeafKeep n (measurable_vectorTerminalMultiplier N n b v F hF) + (measurable_vectorTerminalUpdate N n)).comp + (measurable_const.prodMk ((measurable_labeledNoiseLeaf (Fin N → ℝ) n α).comp (by fun_prop))) + have hK : Measurable (fun p : VectorTerminalCoordinates N n × (ℕ → LabeledLeaf n) => + fun i => noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z + (labeledNoiseLeaf (Fin N → ℝ) n (p.1.1,markForestOfCoords (Fin N → ℝ) n p.1.2) (p.2 i))) := + Measurable.of_eval fun i => hm.comp (measurable_fst.prodMk ((measurable_pi_apply i).comp measurable_snd)) + have hS : Measurable (fun p : NoiseTree unitInterval n × (ℕ → NoiseLeaf unitInterval n) => + fun i => cascadeSeedLeaf n ψ z (p.2 i)) := + Measurable.of_eval fun i => (measurable_cascadeSeedLeaf n ψ hψ).comp + (measurable_const.prodMk ((measurable_pi_apply i).comp measurable_snd)) + have hdepth := coordinate_sampled_ancestry_ae n b hb (fun i => vectorGaussianLaw N (v i)) + (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) + (measurable_vectorTerminalMultiplier N n b v F hF) (measurable_vectorTerminalUpdate N n) + (fun _ _ => (Real.exp_pos _).ne') z (vectorLabeledTerminalLaw N n F z) + (measurable_vectorLabeledTerminalLaw N n F hF z) + (fun p => gibbsProbability_absolutelyContinuous (labeledLeafLaw n p.1) _) + have h := congrArg (Measure.map (noiseReplicaPairData (A := Fin N → ℝ) n)) (hfull z he) + rw [Measure.map_map (measurable_noiseReplicaPairData n) hK, + Measure.map_map (measurable_noiseReplicaPairData n) hS] at h + refine (Measure.map_congr ?_).trans h + filter_upwards [hdepth] with p hp + exact (noiseReplicaPairData_keep_labeled n (vectorTerminalMultiplier N n b v F) + (vectorTerminalUpdate N n) z p.1.1 p.1.2 p.2 hp).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledSeedTransport.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledSeedTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6d81e9d4661c18f6102a4e525aa38d4a67499fa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorLabeledSeedTransport.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Fields.VectorLabeledNoiseTransport +import OAI.Probability.InvariantIsing.Fields.VectorTerminalSeed +import OAI.Probability.InvariantIsing.Arrays.ReplicaPushforward + +namespace OAI + +/-! Full labeled field replicas transported to the common uniform-seed construction. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +theorem vector_labeled_seed_replica_law {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) : + ∃ ψ : ℕ → (Fin N → ℝ) → unitInterval → (Fin N → ℝ), + (∀ i, Measurable (Function.uncurry (ψ i))) ∧ + (∀ i z, volume.map (ψ i z) = vectorTerminalAncestorKernel N n b v F hF i z) ∧ + ∀ z, (∀ᵐ p ∂vectorTerminalCoordinateLaw N n b v, + Integrable (fun α => Real.exp (F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z))) + (labeledLeafLaw n p.1)) → + (vectorTerminalCoordinateLaw N n b v ⊗ₘ + probabilityReplicaKernel (vectorLabeledTerminalLaw N n F z) + (measurable_vectorLabeledTerminalLaw N n F hF z)).map + (fun p i => noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z + (labeledNoiseLeaf (Fin N → ℝ) n (p.1.1,markForestOfCoords (Fin N → ℝ) n p.1.2) (p.2 i))) = + ((noiseCascadeLaw unitInterval n b (fun _ => cascadeSeedLaw) : Measure (NoiseTree unitInterval n)) ⊗ₘ + probabilityReplicaKernel (noiseLeafKernel unitInterval n) (noiseLeafKernel unitInterval n).measurable).map + (fun p i => cascadeSeedLeaf n ψ z (p.2 i)) := by + obtain ⟨ψ,hψ,hψlaw,hseed⟩ := vectorTerminal_seed_replica_law hN n b v hb F hF hG + refine ⟨ψ,hψ,hψlaw,fun z he => ?_⟩ + have hkeep : Measurable (fun σ : ℕ → NoiseLeaf (Fin N → ℝ) n => + fun i => noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z (σ i)) := by + apply Measurable.of_eval + intro i + exact ((measurable_noiseLeafKeep n (measurable_vectorTerminalMultiplier N n b v F hF) + (measurable_vectorTerminalUpdate N n)).comp + ((measurable_const (a := z)).prodMk measurable_id)).comp (measurable_pi_apply i) + have hleaf : Measurable (fun p : VectorTerminalCoordinates N n × LabeledLeaf n => + labeledNoiseLeaf (Fin N → ℝ) n (p.1.1,markForestOfCoords (Fin N → ℝ) n p.1.2) p.2) := by + apply measurable_from_prod_countable_left + intro α + exact (measurable_labeledNoiseLeaf (Fin N → ℝ) n α).comp (by fun_prop) + have hlabel : Measurable (fun p : VectorTerminalCoordinates N n × (ℕ → LabeledLeaf n) => + fun i => labeledNoiseLeaf (Fin N → ℝ) n (p.1.1,markForestOfCoords (Fin N → ℝ) n p.1.2) (p.2 i)) := + Measurable.of_eval fun i => hleaf.comp (measurable_fst.prodMk ((measurable_pi_apply i).comp measurable_snd)) + have h := congrArg (Measure.map (fun σ : ℕ → NoiseLeaf (Fin N → ℝ) n => + fun i => noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z (σ i))) + (vector_labeled_noise_replica_law N n b v hb F hF z he) + rw [Measure.map_map hkeep hlabel] at h + exact h.trans ((map_compProd_snd + (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n)) + (probabilityReplicaKernel (vectorTerminalNoiseLaw N n F z) (measurable_vectorTerminalNoiseLaw N n F hF z)) hkeep).symm.trans (hseed z)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorPairIntegral.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorPairIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9979e2f45cfeb458f01405fcaf643260e09e9de --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorPairIntegral.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Fields.VectorLabeledPairLaw +import OAI.Probability.InvariantIsing.Fields.SeedPairIntegral +import OAI.Probability.InvariantIsing.Fields.SeedSharedKernel + +namespace OAI + +/-! The proved two-path formula for a finite Gaussian vector terminal. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +def vectorTerminalPairMean (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (z : Fin N → ℝ) + (Φ : ℕ × (Fin n → (Fin N → ℝ) × (Fin N → ℝ)) → ℝ) : ℝ := + ∫ p : VectorTerminalCoordinates N n, + referenceReplicaMean (labeledLeafLaw n p.1) + (fun α => F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z)) + (fun σ : Fin 2 → LabeledLeaf n => Φ + (labeledCommonDepth n (σ 0) (σ 1),fun i => (p.2 (edgeAt n (σ 0) i),p.2 (edgeAt n (σ 1) i)))) + ∂vectorTerminalCoordinateLaw N n b v + +lemma vectorTerminalPairMean_eq_integral (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (z : Fin N → ℝ) + (he : ∀ᵐ p ∂vectorTerminalCoordinateLaw N n b v, + Integrable (fun α => Real.exp (F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z))) + (labeledLeafLaw n p.1)) + (Φ : ℕ × (Fin n → (Fin N → ℝ) × (Fin N → ℝ)) → ℝ) (hΦ : Measurable Φ) + {C : ℝ} (hB : ∀ p, |Φ p| ≤ C) : + vectorTerminalPairMean N n b v F z Φ = + ∫ q : VectorTerminalCoordinates N n × (ℕ → LabeledLeaf n), Φ (coordinatePairData n (q.1.2,q.2)) + ∂(vectorTerminalCoordinateLaw N n b v ⊗ₘ + probabilityReplicaKernel (vectorLabeledTerminalLaw N n F z) (measurable_vectorLabeledTerminalLaw N n F hF z)) := by + have hm : Measurable (fun q : VectorTerminalCoordinates N n × (ℕ → LabeledLeaf n) => + Φ (coordinatePairData n (q.1.2,q.2))) := + hΦ.comp ((measurable_coordinatePairData n).comp (measurable_fst.snd.prodMk measurable_snd)) + have hi : Integrable (fun q : VectorTerminalCoordinates N n × (ℕ → LabeledLeaf n) => + Φ (coordinatePairData n (q.1.2,q.2))) + (vectorTerminalCoordinateLaw N n b v ⊗ₘ + probabilityReplicaKernel (vectorLabeledTerminalLaw N n F z) (measurable_vectorLabeledTerminalLaw N n F hF z)) := + Integrable.of_bound hm.aestronglyMeasurable C (ae_of_all _ fun q => by + simpa only [Real.norm_eq_abs] using hB _) + rw [Measure.integral_compProd hi] + apply integral_congr_ae + filter_upwards [he] with p hp + exact referenceReplicaMean_infinite (labeledLeafLaw n p.1) + (fun α => F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z)) hp + (fun σ : Fin 2 → LabeledLeaf n => Φ + (labeledCommonDepth n (σ 0) (σ 1),fun i => (p.2 (edgeAt n (σ 0) i),p.2 (edgeAt n (σ 1) i)))) + (measurable_of_countable _) + +theorem vectorTerminal_pair_formula {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) + (he : ∀ᵐ p ∂vectorTerminalCoordinateLaw N n b v, + Integrable (fun α => Real.exp (F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z))) + (labeledLeafLaw n p.1)) + (Φ : ℕ × (Fin n → (Fin N → ℝ) × (Fin N → ℝ)) → ℝ) (hΦ : Measurable Φ) + {C : ℝ} (hB : ∀ p, |Φ p| ≤ C) : + vectorTerminalPairMean N n b v F z Φ = + ∫ α : ℕ → LabeledLeaf n, + markPairPathMean n (vectorTerminalAncestorKernel N n b v F hF) + (labeledCommonDepth n (α 0) (α 1)) z z + (fun w => Φ (labeledCommonDepth n (α 0) (α 1),w)) ∂cascadeReplicaLaw n b := by + obtain ⟨ψ,hψ,hψlaw,hlaw⟩ := vector_labeled_seed_pair_law hN n b v hb F hF hG + have hD : Measurable (fun p : VectorTerminalCoordinates N n × (ℕ → LabeledLeaf n) => + coordinatePairData n (p.1.2,p.2)) := + (measurable_coordinatePairData n).comp (measurable_fst.snd.prodMk measurable_snd) + have hS : Measurable (fun p : NoiseTree unitInterval n × (ℕ → NoiseLeaf unitInterval n) => + noiseReplicaPairData n (fun i => cascadeSeedLeaf n ψ z (p.2 i))) := + (measurable_noiseReplicaPairData n).comp (Measurable.of_eval fun i => + (measurable_cascadeSeedLeaf n ψ hψ).comp + (measurable_const.prodMk ((measurable_pi_apply i).comp measurable_snd))) + have hi := congrArg (fun μ => ∫ x, Φ x ∂μ) (hlaw z he) + rw [integral_map hD.aemeasurable hΦ.aestronglyMeasurable, + integral_map hS.aemeasurable hΦ.aestronglyMeasurable] at hi + rw [vectorTerminalPairMean_eq_integral N n b v F hF z he Φ hΦ hB,hi, + seed_pair_mean_integral n b hb ψ hψ z Φ hΦ hB] + apply integral_congr_ae + apply ae_of_all + intro α + exact seed_shared_kernel n (vectorTerminalAncestorKernel N n b v F hF) + (fun i => vectorTerminalAncestorKernel_markov hN n b v hb F hF hG i) + ψ hψ hψlaw (labeledCommonDepth n (α 0) (α 1)) z _ + (hΦ.comp (measurable_const.prodMk measurable_id)) (fun w => hB _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalCascade.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalCascade.lean new file mode 100644 index 0000000000000000000000000000000000000000..42fd75f4545742eef0dd2fe1c909004101aedcfd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalCascade.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Arrays.NSpinFactorization +import OAI.Probability.InvariantIsing.Fields.VectorGaussianTransition +import Mathlib.Probability.Kernel.Representation + +namespace OAI + +/-! Ancestor kernels for the two finite-dimensional Gaussian field terminals. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal ENNReal +namespace InvariantIsing + +def vectorTerminalBackward (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (i : ℕ) : (Fin N → ℝ) → ℝ := + backwardValue n b (fun j => vectorGaussianLaw N (v j)) (fun _ p => p.1+p.2) F i + +def vectorTerminalUpdate (N n : ℕ) : ℕ → (Fin N → ℝ) × (Fin N → ℝ) → (Fin N → ℝ) := + stoppedUpdate n (fun _ p => p.1+p.2) + +def vectorTerminalMultiplier (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (i : ℕ) (p : (Fin N → ℝ) × (Fin N → ℝ)) : ℝ := + Real.exp (vectorTerminalBackward N n b v F (i+1) (vectorTerminalUpdate N n i p) - + vectorTerminalBackward N n b v F i p.1) + +lemma measurable_vectorTerminalBackward (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (i : ℕ) : + Measurable (vectorTerminalBackward N n b v F i) := + measurable_backwardValue n b _ (fun _ => measurable_fst.add measurable_snd) hF i + +lemma measurable_vectorTerminalUpdate (N n i : ℕ) : Measurable (vectorTerminalUpdate N n i) := + measurable_stoppedUpdate n (fun _ => measurable_fst.add measurable_snd) i + +lemma measurable_vectorTerminalMultiplier (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (i : ℕ) : + Measurable (vectorTerminalMultiplier N n b v F i) := + (((measurable_vectorTerminalBackward N n b v F hF (i+1)).comp + (measurable_vectorTerminalUpdate N n i)).sub + ((measurable_vectorTerminalBackward N n b v F hF i).comp measurable_fst)).exp + +lemma vectorTerminalMultiplier_moment {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (i : ℕ) (z : Fin N → ℝ) : + (∫⁻ a, ENNReal.ofReal (vectorTerminalMultiplier N n b v F i (z,a)^b i) + ∂(vectorGaussianLaw N (v i) : Measure (Fin N → ℝ))) = 1 := by + have hadm := backwardValue_linearGrowth_moments n b (fun j => vectorGaussianLaw N (v j)) + (fun j _ => vectorGaussianLaw_moments hN (v j)) hF hG (fun j hj => (hb.1 j hj).1) + exact backwardValue_multiplier_moment_admissible n b (fun j => vectorGaussianLaw N (v j)) + (fun _ p => p.1+p.2) F (fun j hj => (hb.1 j hj).1) hadm i z + +def vectorTerminalAncestorKernel (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (i : ℕ) : + Kernel (Fin N → ℝ) (Fin N → ℝ) := + ⟨fun z => (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)).withDensity + (fun a => ENNReal.ofReal (vectorTerminalMultiplier N n b v F i (z,a)^b i)), + measurable_random_withDensity (ν := fun _ => (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ))) + (W := fun p => ENNReal.ofReal (vectorTerminalMultiplier N n b v F i p^b i)) + measurable_const ((measurable_vectorTerminalMultiplier N n b v F hF i).pow_const (b i)).ennreal_ofReal⟩ + +lemma vectorTerminalAncestorKernel_markov {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (i : ℕ) : + IsMarkovKernel (vectorTerminalAncestorKernel N n b v F hF i) := by + constructor + intro z + constructor + change ((vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)).withDensity _) Set.univ = 1 + rw [withDensity_apply _ MeasurableSet.univ,setLIntegral_univ] + exact vectorTerminalMultiplier_moment hN n b v hb F hF hG i z + +lemma vectorTerminalAncestorKernel_seed {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) : + ∃ ψ : ℕ → (Fin N → ℝ) → unitInterval → (Fin N → ℝ), + (∀ i, Measurable (Function.uncurry (ψ i))) ∧ + ∀ i z, volume.map (ψ i z) = vectorTerminalAncestorKernel N n b v F hF i z := by + have hex i : ∃ ψ : (Fin N → ℝ) → unitInterval → (Fin N → ℝ), + Measurable (Function.uncurry ψ) ∧ ∀ z, volume.map (ψ z) = vectorTerminalAncestorKernel N n b v F hF i z := by + let := vectorTerminalAncestorKernel_markov hN n b v hb F hF hG i + exact (vectorTerminalAncestorKernel N n b v F hF i).exists_measurable_map_eq_unitInterval + choose ψ hψ hLaw using hex + exact ⟨ψ,hψ,hLaw⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalLabeled.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalLabeled.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd3c39d711d4cbc2cf7cf9b5619c7d8e9716459a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalLabeled.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalNoise +import OAI.Probability.InvariantIsing.Pressure.GibbsMap +import OAI.Probability.InvariantIsing.Core.ReferenceInfiniteReplicas + +namespace OAI + +/-! Original labeled Gibbs laws for finite Gaussian vector terminals. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +abbrev VectorTerminalCoordinates (N n : ℕ) := LabeledTree n × (ForestVertex n → Fin N → ℝ) + +def vectorTerminalCoordinateLaw (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) : Measure (VectorTerminalCoordinates N n) := + (labeledCascadeLaw n b : Measure (LabeledTree n)).prod + (Measure.infinitePi fun a : ForestVertex n => (vectorGaussianLaw N (v (forestVertexDepth n a)) : Measure (Fin N → ℝ))) + +instance vectorTerminalCoordinateLaw_probability (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) : + IsProbabilityMeasure (vectorTerminalCoordinateLaw N n b v) := by + unfold vectorTerminalCoordinateLaw + infer_instance + +def vectorLabeledTerminalLaw (N n : ℕ) (F : (Fin N → ℝ) → ℝ) + (z : Fin N → ℝ) (p : VectorTerminalCoordinates N n) : Measure (LabeledLeaf n) := + gibbsProbability (labeledLeafLaw n p.1) + (fun α => F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z)) + +instance vectorLabeledTerminalLaw_probability (N n : ℕ) (F : (Fin N → ℝ) → ℝ) + (z : Fin N → ℝ) (p : VectorTerminalCoordinates N n) : + IsProbabilityMeasure (vectorLabeledTerminalLaw N n F z p) := by + unfold vectorLabeledTerminalLaw + infer_instance + +lemma measurable_vectorLabeledTerminalLaw (N n : ℕ) (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) + (z : Fin N → ℝ) : Measurable (vectorLabeledTerminalLaw N n F z) := by + unfold vectorLabeledTerminalLaw + apply measurable_gibbsProbability (ν := fun p : VectorTerminalCoordinates N n => labeledLeafLaw n p.1) + (H := fun p : VectorTerminalCoordinates N n × LabeledLeaf n => + F (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.1.2) p.2 z)) + ((measurable_labeledLeafLaw n).comp measurable_fst) + apply measurable_from_prod_countable_left + intro α + exact hF.comp ((measurable_labeledEnergy n α).comp + (((measurable_markForestOfCoords _ n).comp measurable_snd).prodMk measurable_const)) + +lemma vectorLeafSum_labeled (N n : ℕ) (z : Fin N → ℝ) (p : VectorTerminalCoordinates N n) + (α : LabeledLeaf n) : + vectorLeafSum N n z (labeledNoiseLeaf (Fin N → ℝ) n (p.1,markForestOfCoords (Fin N → ℝ) n p.2) α) = + labeledEnergy n (markForestOfCoords (Fin N → ℝ) n p.2) α z := by + induction n generalizing z with + | zero => rfl + | succ n ih => + exact ih (z+p.2 (α.1.1,α.1.2,none)) + (p.1.2 α.1.1 α.1.2,fun a => p.2 (α.1.1,α.1.2,some a)) α.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalNoise.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalNoise.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca0154c5fd20a818ec933f0fad312f7f5534d857 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalNoise.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalCascade +import OAI.Probability.InvariantIsing.Fields.CascadeSeedReplicaLaw +import OAI.Probability.InvariantIsing.Fields.CascadeKeepUpdate +import OAI.Probability.IsingPerceptron.NoiseGibbsRegular + +namespace OAI + +/-! Terminal Gibbs sampling and retained trees for finite vector fields. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal ENNReal +namespace InvariantIsing + +def vectorLeafSum (N : ℕ) : (n : ℕ) → (Fin N → ℝ) → NoiseLeaf (Fin N → ℝ) n → (Fin N → ℝ) + | 0,z,_ => z + | n+1,z,w => vectorLeafSum N n (z+w.2.1) w.2.2 + +lemma measurable_vectorLeafSum (N n : ℕ) : + Measurable (fun p : (Fin N → ℝ) × NoiseLeaf (Fin N → ℝ) n => vectorLeafSum N n p.1 p.2) := by + induction n with + | zero => exact measurable_fst + | succ n ih => exact ih.comp ((measurable_fst.add measurable_snd.snd.fst).prodMk measurable_snd.snd.snd) + +lemma noiseLeafTerminal_vector_sum (N n : ℕ) (X : ℕ → (Fin N → ℝ) → ℝ) + (u : ℕ → (Fin N → ℝ) × (Fin N → ℝ) → (Fin N → ℝ)) + (F : (Fin N → ℝ) → ℝ) (hX : X n = F) + (hu : ∀ i < n, u i = fun p => p.1+p.2) (z : Fin N → ℝ) (w : NoiseLeaf (Fin N → ℝ) n) : + noiseLeafTerminal n X u z w = F (vectorLeafSum N n z w) := by + induction n generalizing X u z with + | zero => exact congrFun hX z + | succ n ih => + rw [noiseLeafTerminal,hu 0 (by omega)] + exact ih (fun i => X (i+1)) (fun i => u (i+1)) + (by simpa only [Nat.add_comm] using hX) (fun i hi => hu (i+1) (by omega)) (z+w.2.1) w.2.2 + +def vectorTerminalNoiseLaw (N n : ℕ) (F : (Fin N → ℝ) → ℝ) + (z : Fin N → ℝ) (T : NoiseTree (Fin N → ℝ) n) : Measure (NoiseLeaf (Fin N → ℝ) n) := + normalizeMass ((noiseLeafKernel (Fin N → ℝ) n T).withDensity + (fun w => ENNReal.ofReal (Real.exp (F (vectorLeafSum N n z w))))) + +instance vectorTerminalNoiseLaw_probability (N n : ℕ) (F : (Fin N → ℝ) → ℝ) + (z : Fin N → ℝ) (T : NoiseTree (Fin N → ℝ) n) : + IsProbabilityMeasure (vectorTerminalNoiseLaw N n F z T) := normalizeMass_probability _ + +lemma measurable_vectorTerminalNoiseLaw (N n : ℕ) (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) + (z : Fin N → ℝ) : Measurable (vectorTerminalNoiseLaw N n F z) := + measurable_normalizeMass.comp ((measurable_withDensity_fixed + ((hF.comp ((measurable_vectorLeafSum N n).comp (measurable_const.prodMk measurable_id))).exp.ennreal_ofReal)).comp + (noiseLeafKernel (Fin N → ℝ) n).measurable) + +lemma vectorTerminalNoiseLaw_eq_backward (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (z : Fin N → ℝ) (T : NoiseTree (Fin N → ℝ) n) : + vectorTerminalNoiseLaw N n F z T = noiseTerminalGibbsLaw n + (vectorTerminalBackward N n b v F) (vectorTerminalUpdate N n) z T := by + have hX : vectorTerminalBackward N n b v F n = F := + backwardValue_terminal n b (fun j => vectorGaussianLaw N (v j)) (fun _ p => p.1+p.2) F (le_refl n) + have hu : ∀ i < n, vectorTerminalUpdate N n i = fun p => p.1+p.2 := by + intro i hi + funext p + simp only [vectorTerminalUpdate,stoppedUpdate,hi,ite_true] + unfold vectorTerminalNoiseLaw noiseTerminalGibbsLaw + congr 2 + funext w + rw [noiseLeafTerminal_vector_sum N n _ _ _ hX hu] + +lemma vectorTerminalNoiseLaw_keep_ae {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + ∀ᵐ T ∂(noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n)), + (vectorTerminalNoiseLaw N n F z T).map + (noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z) = + noiseLeafKernel (Fin N → ℝ) n (noiseTreeKeep n b (fun i => vectorGaussianLaw N (v i)) + (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z T) := by + have hr := noiseGibbsRegular_ae n b hb (fun i => vectorGaussianLaw N (v i)) + (measurable_vectorTerminalMultiplier N n b v F hF) (measurable_vectorTerminalUpdate N n) + (fun _ _ _ => Real.exp_pos _) (vectorTerminalMultiplier_moment hN n b v hb F hF hG) z + filter_upwards [hr] with T hT + rw [vectorTerminalNoiseLaw_eq_backward] + exact noiseTerminalGibbsLaw_keep n b (fun i => vectorGaussianLaw N (v i)) + (measurable_vectorTerminalBackward N n b v F hF) (measurable_vectorTerminalUpdate N n) z T hT + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalSeed.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalSeed.lean new file mode 100644 index 0000000000000000000000000000000000000000..c733d4d735ba49e0b43aa7f5508e8243bbccd0ad --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalSeed.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalNoise +import OAI.Probability.InvariantIsing.Fields.CascadeSeedRetainedLaw + +namespace OAI + +/-! Joint uniform-seed representation for terminal-tilted finite Gaussian vector fields. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +theorem vectorTerminal_seed_replica_law {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) : + ∃ ψ : ℕ → (Fin N → ℝ) → unitInterval → (Fin N → ℝ), + (∀ i, Measurable (Function.uncurry (ψ i))) ∧ + (∀ i z, volume.map (ψ i z) = vectorTerminalAncestorKernel N n b v F hF i z) ∧ + ∀ z, + (((noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n))) ⊗ₘ + probabilityReplicaKernel (vectorTerminalNoiseLaw N n F z) (measurable_vectorTerminalNoiseLaw N n F hF z)).map + (fun p i => noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z (p.2 i)) = + ((noiseCascadeLaw unitInterval n b (fun _ => cascadeSeedLaw) : Measure (NoiseTree unitInterval n)) ⊗ₘ + probabilityReplicaKernel (noiseLeafKernel unitInterval n) (noiseLeafKernel unitInterval n).measurable).map + (fun p i => cascadeSeedLeaf n ψ z (p.2 i)) := by + obtain ⟨ψ,hψ,hlaw⟩ := vectorTerminalAncestorKernel_seed hN n b v hb F hF hG + refine ⟨ψ,hψ,hlaw,fun z => ?_⟩ + have htree := cascadeSeedTree_retained_law n b (fun i => vectorGaussianLaw N (v i)) + (vectorTerminalMultiplier N n b v F) ψ (measurable_vectorTerminalMultiplier N n b v F hF) hψ + (fun _ _ _ => Real.exp_pos _) (vectorTerminalMultiplier_moment hN n b v hb F hF hG) hlaw z + have htree' : (noiseCascadeLaw unitInterval n b (fun _ => cascadeSeedLaw) : Measure (NoiseTree unitInterval n)).map + (cascadeSeedTree n b ψ z) = + (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n)).map + (noiseTreeKeep n b (fun i => vectorGaussianLaw N (v i)) + (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z) := by + apply htree.trans + apply congrArg (fun f : NoiseTree (Fin N → ℝ) n → NoiseTree (Fin N → ℝ) n => Measure.map f (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n))) + funext T + apply noiseTreeKeep_update_congr + intro i hi + funext p + simp only [vectorTerminalUpdate,stoppedUpdate,hi,ite_true] + have hkeep := sampling_replica_morphism + (P := (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n))) + (Q := (noiseCascadeLaw (Fin N → ℝ) n b (fun i => vectorGaussianLaw N (v i)) : Measure (NoiseTree (Fin N → ℝ) n)).map + (noiseTreeKeep n b (fun i => vectorGaussianLaw N (v i)) + (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z)) + (T := noiseTreeKeep n b (fun i => vectorGaussianLaw N (v i)) + (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z) + (measurable_vectorTerminalNoiseLaw N n F hF z) (noiseLeafKernel (Fin N → ℝ) n).measurable + ((measurable_noiseTreeKeep n b (fun i => vectorGaussianLaw N (v i)) + (measurable_vectorTerminalMultiplier N n b v F hF) (measurable_vectorTerminalUpdate N n)).comp + ((measurable_const (a := z)).prodMk measurable_id)) rfl + (ψ := fun _ w => noiseLeafKeep n (vectorTerminalMultiplier N n b v F) (vectorTerminalUpdate N n) z w) + (((measurable_noiseLeafKeep n (measurable_vectorTerminalMultiplier N n b v F hF) + (measurable_vectorTerminalUpdate N n)).comp ((measurable_const (a := z)).prodMk measurable_id)).comp measurable_snd) + (vectorTerminalNoiseLaw_keep_ae hN n b v hb F hF hG z) + rw [hkeep,← htree',← cascadeSeed_replica_law n b hb ψ hψ z] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalShift.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..17ffa9efaff0bf37ef7a42b87808ef5029f10350 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalShift.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalTransition + +namespace OAI + +/-! Removing the first level preserves every later conditional ancestor kernel. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +lemma vectorTerminalBackward_shift (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (i : ℕ) : + vectorTerminalBackward N (n+1) b v F (i+1) = + vectorTerminalBackward N n (fun j => b (j+1)) (fun j => v (j+1)) F i := by + simp only [vectorTerminalBackward,backwardValue,Nat.add_sub_add_right] + congr 1 <;> simp only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] + +lemma vectorTerminalAncestorKernel_shift (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (i : ℕ) : + vectorTerminalAncestorKernel N (n+1) b v F hF (i+1) = + vectorTerminalAncestorKernel N n (fun j => b (j+1)) (fun j => v (j+1)) F hF i := by + ext z : 1 + change Measure.withDensity _ _ = Measure.withDensity _ _ + congr 1 + funext a + simp only [vectorTerminalMultiplier,vectorTerminalUpdate,stoppedUpdate, + Nat.add_lt_add_iff_right,vectorTerminalBackward_shift] + +lemma vectorTerminalBackward_one (N n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (F : (Fin N → ℝ) → ℝ) : + vectorTerminalBackward N (n+1) b v F 1 = + cascadeRecursion n (fun i => b (i+1)) (fun i => vectorGaussianLaw N (v (i+1))) + (fun _ p => p.1+p.2) F := by + simp only [vectorTerminalBackward,backwardValue,Nat.add_sub_cancel,Nat.add_comm 1] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalTransition.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalTransition.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ff81d8e051155fe1f385051c7c539e173f95a04 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTerminalTransition.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalCascade + +namespace OAI + +/-! The normalized ancestor increments induce the actual Gaussian field transition. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +lemma vectorTerminalBackward_regular {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (i : ℕ) : + Measurable (vectorTerminalBackward N n b v F i) ∧ HasLinearGrowth (vectorTerminalBackward N n b v F i) := by + refine ⟨measurable_vectorTerminalBackward N n b v F hF i,?_⟩ + exact cascadeRecursion_linearGrowth (n-i) (fun j => b (i+j)) + (fun j => vectorGaussianLaw N (v (i+j))) + (fun j _ => vectorGaussianLaw_moments hN (v (i+j))) hF hG + (fun j hj => (hb.1 (i+j) (by omega)).1) + +lemma vectorTerminalAncestorKernel_eq_tilted {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (i : ℕ) (hi : i < n) (z : Fin N → ℝ) : + vectorTerminalAncestorKernel N n b v F hF i z = + (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)).tilted + (fun a => b i * vectorTerminalBackward N n b v F (i+1) (z+a)) := by + have hint := backwardValue_linearGrowth_moments n b (fun j => vectorGaussianLaw N (v j)) + (fun j _ => vectorGaussianLaw_moments hN (v j)) hF hG (fun j hj => (hb.1 j hj).1) i hi z + have hp := IsingPerceptron.integral_exp_pos (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)) + (fun a => vectorTerminalBackward N n b v F (i+1) (z+a)) hint + have hd : vectorTerminalAncestorKernel N n b v F hF i z = + (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)).withDensity + (fun a => ENNReal.ofReal (Real.exp (b i * + (vectorTerminalBackward N n b v F (i+1) (z+a) - vectorTerminalBackward N n b v F i z)))) := by + change Measure.withDensity _ _ = _ + congr 1 + funext a + simp only [vectorTerminalMultiplier,vectorTerminalUpdate,stoppedUpdate,hi,ite_true,← Real.exp_mul] + rw [mul_comm] + have hs : vectorTerminalBackward N n b v F i z = + logMean (b i) (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)) + (fun a => vectorTerminalBackward N n b v F (i+1) (z+a)) := + backwardValue_step n b (fun j => vectorGaussianLaw N (v j)) (fun _ p => p.1+p.2) F hi z + rw [hd,hs] + unfold Measure.tilted + congr 1 + funext a + congr 1 + have hx (x y : ℝ) : b i * (x - Real.log y / b i) = b i*x - Real.log y := by + field_simp [(hb.1 i hi).1.ne'] + rw [logMean,hx,Real.exp_sub,Real.exp_log hp] + +lemma vectorTerminalAncestorKernel_add {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (i : ℕ) (hi : i < n) (z : Fin N → ℝ) : + (vectorTerminalAncestorKernel N n b v F hF i z).map (fun a => z+a) = + vectorGaussianTransition N (b i) (v i) (vectorTerminalBackward N n b v F (i+1)) + (measurable_vectorTerminalBackward N n b v F hF (i+1)) z := by + rw [vectorTerminalAncestorKernel_eq_tilted hN n b v hb F hF hG i hi z] + exact (vectorGaussianTransition_eq_map hN (b i) (v i) _ + (measurable_vectorTerminalBackward N n b v F hF (i+1)) + (vectorTerminalBackward_regular hN n b v hb F hF hG (i+1)).2 z).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionEntropy.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d2a6950cd02ca1146b1190084f0cce7e89d5afa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionEntropy.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Fields.VectorGaussianTransition +import OAI.Probability.InvariantIsing.Pressure.EntropyBudget + +namespace OAI + +/-! Entropy and future loss at one actual vector Gaussian transition. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal + +namespace InvariantIsing + +lemma vectorGaussianTransition_entropy_budget {N : ℕ} (hN : 0 < N) + (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1) (v : ℝ≥0) + (F G : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : Measurable G) + (hLF : HasLinearGrowth F) (hLG : HasLinearGrowth G) + (hGF : ∀ z, G z ≤ F z) (z : Fin N → ℝ) : + klDiv (vectorGaussianTransition N a v G hG z) (vectorGaussianTransition N a v F hF z) + + (∫⁻ y, ENNReal.ofReal (F y - G y) ∂vectorGaussianTransition N a v G hG z) ≤ + ENNReal.ofReal (logMean a (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + (fun w => F (z + w)) - + logMean a (vectorGaussianLaw N v : Measure (Fin N → ℝ)) (fun w => G (z + w))) := by + let μ := (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + let f := fun w : Fin N → ℝ => z + w + have hf : Measurable f := measurable_const.add measurable_id + have heF := integrable_exp_of_linearGrowth μ (vectorGaussianLaw_moments hN v) + (hF.comp hf) (hLF.add_left z) a + have heG := integrable_exp_of_linearGrowth μ (vectorGaussianLaw_moments hN v) + (hG.comp hf) (hLG.add_left z) a + have hiF := integrable_linearGrowth_tilted μ (vectorGaussianLaw_moments hN v) + (fun w => G (f w)) (fun w => F (f w)) (hG.comp hf) (hLG.add_left z) + (hF.comp hf) (hLF.add_left z) a + have hiG := integrable_linearGrowth_tilted μ (vectorGaussianLaw_moments hN v) + (fun w => G (f w)) (fun w => G (f w)) (hG.comp hf) (hLG.add_left z) + (hG.comp hf) (hLG.add_left z) a + let _ : IsProbabilityMeasure (μ.tilted (fun w => a * F (f w))) := + isProbabilityMeasure_tilted heF + let _ : IsProbabilityMeasure (μ.tilted (fun w => a * G (f w))) := + isProbabilityMeasure_tilted heG + rw [vectorGaussianTransition_eq_map hN a v G hG hLG z, + vectorGaussianTransition_eq_map hN a v F hF hLF z] + exact (entropy_budget_map (μ.tilted (fun w => a * G (f w))) + (μ.tilted (fun w => a * F (f w))) f hf + (fun y => ENNReal.ofReal (F y - G y)) (hF.sub hG).ennreal_ofReal).trans + (tilted_pair_entropy_budget_ennreal μ (fun w => F (f w)) (fun w => G (f w)) + ha ha1 heF heG (hiF.sub hiG) (fun w => hGF (f w))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionShift.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbad298b733d8cb868319cdf1d86ad483049e076 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionShift.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Fields.VectorGaussianTransition + +namespace OAI + +/-! Translation covariance of the actual Gaussian transition when the +backward potential changes by a constant. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma tilted_add_constant {X : Type*} [MeasurableSpace X] (μ : Measure X) + [IsProbabilityMeasure μ] (f : X → ℝ) (hf : Integrable (fun x => Real.exp (f x)) μ) + (c : ℝ) : μ.tilted (fun x => f x + c) = μ.tilted f := by + let _ := isProbabilityMeasure_tilted hf + exact (tilted_tilted hf (fun _ => c)).symm.trans (tilted_const _ c) + +lemma vectorGaussianTransition_shift {N : ℕ} (hN : 0 < N) (a : ℝ) (v : ℝ≥0) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (d : Fin N → ℝ) (c : ℝ) (hshift : ∀ z, F (z + d) = F z + c) (z : Fin N → ℝ) : + vectorGaussianTransition N a v F hF (z + d) = + (vectorGaussianTransition N a v F hF z).map (fun y => y + d) := by + rw [vectorGaussianTransition_eq_map hN a v F hF hG (z + d), + vectorGaussianTransition_eq_map hN a v F hF hG z, + Measure.map_map (f := fun w : Fin N → ℝ => z + w) (g := fun y => y + d) + (measurable_id.add_const d) (measurable_const.add measurable_id)] + have he : (fun w => a * F (z + d + w)) = fun w => a * F (z + w) + a * c := by + funext w + rw [show z + d + w = (z + w) + d by abel, hshift, mul_add] + rw [he, tilted_add_constant (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + (fun w => a * F (z + w)) + (integrable_exp_of_linearGrowth (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + (vectorGaussianLaw_moments hN v) (hF.comp (measurable_const.add measurable_id)) + (hG.add_left z) a) (a * c)] + congr 1 + funext w + dsimp only [Function.comp_apply] + abel + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionZero.lean b/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f3665a3efe14fdff68aa620ea5ead63d889008f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/VectorTransitionZero.lean @@ -0,0 +1,29 @@ +import OAI.Probability.InvariantIsing.Fields.VectorGaussianTransition + +namespace OAI + +/-! A zero-variance constrained Gaussian transition fixes the current field. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma vectorGaussianTransition_zero {N : ℕ} (hN : 0 < N) (a : ℝ) + (F : (Fin N → ℝ) → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + vectorGaussianTransition N a 0 F hF z = Measure.dirac z := by + rw [vectorGaussianTransition_eq_tilted hN a 0 F hF hG z] + have hd := fieldVectorTailEndpointKernel_product N [] (by simp) z + change Measure.dirac z = Measure.pi (fun i => Measure.dirac (z i)) at hd + simp_rw [gaussianReal_zero_var] + rw [← hd] + have he := cavity_tilt_map (Measure.dirac ()) (fun _ : Unit => z) measurable_const + (fun y => a * F y) (hF.const_mul a) + simpa only [Function.comp_def, tilted_const, Measure.map_dirac' measurable_const] using he.symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Fields/ZeroFieldPopulations.lean b/lean/OAI/Probability/InvariantIsing/Fields/ZeroFieldPopulations.lean new file mode 100644 index 0000000000000000000000000000000000000000..d01459c4e07f1ef87b0fbb6c7abde9e16d892ca7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Fields/ZeroFieldPopulations.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGeneralSpectrum +import OAI.Probability.InvariantIsing.Fields.PhysicalFieldPopulationComparison + +namespace OAI + +/-! Vanishing field populations can be relabeled into a positive population. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology BigOperators Classical +namespace InvariantIsing + +lemma spectralLabelCount_eq_spinGroupSize {N : ℕ} {A : Type*} [DecidableEq A] + (g : Fin N → A) (a : A) : spectralLabelCount g a=spinGroupSize g a := by + unfold spectralLabelCount spinGroupSize + apply congrArg Finset.card + ext i + simp only [Finset.mem_filter,Finset.mem_univ,true_and] + +def positiveFieldProjection {A : Type*} (γ : A → ℝ) (fallback : {a // 0 < γ a}) (a : A) : A := + (positiveSpectralLabel γ fallback a).val + +lemma positiveFieldProjection_weight {A : Type*} [Fintype A] + (γ : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (fallback : {a // 0 < γ a}) (b : A) : + (∑ a : {a // positiveFieldProjection γ fallback a=b}, γ a)=γ b := by + rw [← Finset.sum_subtype (Finset.univ.filter (fun a => positiveFieldProjection γ fallback a=b)) + (by simp) γ,Finset.sum_filter] + have hi a : (if positiveFieldProjection γ fallback a=b then γ a else 0)= + (if a=b then γ a else 0) := by + by_cases hp : 0 < γ a + · simp only [positiveFieldProjection,positiveSpectralLabel,dite_eq_left hp] + · have hz : γ a=0 := le_antisymm (le_of_not_gt hp) (hγ a) + simp only [hz,ite_self] + simp_rw [hi] + simp + +lemma positiveFieldProjection_counts {A : Type*} [Fintype A] + (N : ℕ → ℕ) (g : (k : ℕ) → Fin (N k) → A) + (γ : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (fallback : {a // 0 < γ a}) + (hg : Tendsto (fun k a => (spectralLabelCount (g k) a : ℝ)/N k) atTop (𝓝 γ)) : + Tendsto (fun k a => (spectralLabelCount (positiveFieldProjection γ fallback ∘ g k) a : ℝ)/N k) + atTop (𝓝 γ) := by + have hh := spectral_label_counts_relabel N g γ hg (positiveFieldProjection γ fallback) + simpa only [positiveFieldProjection_weight γ hγ fallback] using hh + +lemma physical_mean_zero_field_populations {A : Type*} [Fintype A] [DecidableEq A] + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (g : (N : ℕ) → Fin N → A) (γ c : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) + (fallback : {a // 0 < γ a}) + (hg : Tendsto (fun N a => (spinGroupSize (g N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => (∫ U, rotatedPressure (eig N) (matrixRotation U⁻¹) (fun i => c (g N i)) ∂μ N)- + ∫ U, rotatedPressure (eig N) (matrixRotation U⁻¹) + (fun i => c (positiveFieldProjection γ fallback (g N i))) ∂μ N) atTop (𝓝 0) := by + let h := fun N => positiveFieldProjection γ fallback ∘ g N + have hh : Tendsto (fun N a => (spinGroupSize (h N) a : ℝ)/N) atTop (𝓝 γ) := by + have hh := positiveFieldProjection_counts id g γ hγ fallback + (by simpa only [spectralLabelCount_eq_spinGroupSize,id_eq] using hg) + simpa only [spectralLabelCount,spinGroupSize,id_eq,h] using hh + let B := ∑ a, |c a| + have hB : 0 ≤ B := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hc a : |c a| ≤ B := Finset.single_le_sum (f := fun a => |c a|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ a) + have ht := ((tendsto_finsetSum Finset.univ (fun a _ => + (((tendsto_pi_nhds.mp hg) a).sub ((tendsto_pi_nhds.mp hh) a)).abs)).const_mul (2*B)) + simp only [sub_self,abs_zero,Finset.sum_const_zero,mul_zero] at ht + apply squeeze_zero_norm' _ ht + filter_upwards [eventually_ge_atTop 1] with N hN + simpa only [Real.norm_eq_abs,h,Function.comp_apply] using physical_mean_field_counts_le (by omega) (μ N) + (eig N) (g N) (h N) c hB hc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..93238192d40bc01c7716dc7102c3270bd9fd6eb3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean @@ -0,0 +1,98 @@ +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 diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianComparison.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..6273733a883f3aa3ed84bc3f3f42b1960b73f85f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianComparison.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Gaussian.IndexedGaussianMaximum +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternEuclideanNorm + +namespace OAI + +/-! The finite bilinear Gaussian comparison behind the sharp rectangular upper edge. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +abbrev BilinearGaussianIndex (N m : ℕ) := ((Fin N × Fin m) ⊕ Unit) ⊕ (Fin N ⊕ Fin m) + +def bilinearMatrixCoefficient {X : Type*} {N m : ℕ} + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) + (x : X) : BilinearGaussianIndex N m → ℝ + | .inl (.inl (i,j)) => u x i*v x j + | .inl (.inr _) => 1 + | .inr _ => 0 + +def bilinearVectorCoefficient {X : Type*} {N m : ℕ} + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) + (x : X) : BilinearGaussianIndex N m → ℝ + | .inl _ => 0 + | .inr (.inl i) => u x i + | .inr (.inr j) => v x j + +lemma bilinearMatrix_covariance {X : Type*} {N m : ℕ} + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) (x y : X) : + (∑ i, bilinearMatrixCoefficient u v x i*bilinearMatrixCoefficient u v y i) = + 1 + ⟪u x,u y⟫*⟪v x,v y⟫ := by + simp only [Fintype.sum_sum_type,Fintype.sum_prod_type,bilinearMatrixCoefficient, + mul_zero,one_mul,Finset.sum_const_zero,Fintype.sum_unique,add_zero] + simp only [EuclideanSpace.inner_eq_star_dotProduct,dotProduct,star_trivial] + rw [Finset.sum_mul] + simp only [Finset.mul_sum] + rw [add_comm] + congr 1 + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +lemma bilinearVector_covariance {X : Type*} {N m : ℕ} + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) (x y : X) : + (∑ i, bilinearVectorCoefficient u v x i*bilinearVectorCoefficient u v y i) = + ⟪u x,u y⟫+⟪v x,v y⟫ := by + simp only [Fintype.sum_sum_type,bilinearVectorCoefficient,zero_mul,Finset.sum_const_zero,zero_add, + EuclideanSpace.inner_eq_star_dotProduct,dotProduct,star_trivial,mul_comm] + +theorem bilinear_gaussian_maximum_comparison {X : Type*} [Fintype X] [Nonempty X] {N m : ℕ} + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) + (hu : ∀ x, ‖u x‖ = 1) (hv : ∀ x, ‖v x‖ = 1) : + (∫ g, indexedGaussianMaximum (bilinearMatrixCoefficient u v) g + ∂Measure.pi (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1)) ≤ + ∫ g, indexedGaussianMaximum (bilinearVectorCoefficient u v) g + ∂Measure.pi (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1) := by + apply indexed_gaussian_maximum_comparison + · intro x y + simp only [Fintype.sum_sum_type,bilinearMatrixCoefficient,bilinearVectorCoefficient, + mul_zero,zero_mul,Finset.sum_const_zero,zero_add] + · intro x + rw [bilinearVector_covariance,bilinearMatrix_covariance] + simp only [real_inner_self_eq_norm_sq,hu,hv,one_pow,one_mul] + · intro x y + rw [bilinearVector_covariance,bilinearMatrix_covariance] + have ha : ⟪u x,u y⟫ ≤ 1 := by + simpa only [hu,mul_one] using real_inner_le_norm (u x) (u y) + have hb : ⟪v x,v y⟫ ≤ 1 := by + simpa only [hv,mul_one] using real_inner_le_norm (v x) (v y) + nlinarith [mul_nonneg (sub_nonneg.mpr ha) (sub_nonneg.mpr hb)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..93ea90b1e8b9fa644f7f4083e9d507f6a3eeb3ee --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMean.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Gaussian.BilinearGaussianComparison +import OAI.Probability.InvariantIsing.Gaussian.IndexedGaussianIntegrability + +namespace OAI + +/-! The sharp expected maximum estimate for every finite family of unit bilinear tests. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing +variable {X : Type*} [Fintype X] [Nonempty X] {N m : ℕ} + +lemma bilinearMatrix_maximum_eq + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) + (g : BilinearGaussianIndex N m → ℝ) : + indexedGaussianMaximum (bilinearMatrixCoefficient u v) g = + indexedGaussianMaximum (fun x (ij : Fin N × Fin m) => u x ij.1*v x ij.2) + (fun ij => g (.inl (.inl ij))) + g (.inl (.inr ())) := by + unfold indexedGaussianMaximum + simp only [Fintype.sum_sum_type,bilinearMatrixCoefficient,zero_mul, + one_mul,Finset.sum_const_zero,Fintype.sum_unique,add_zero] + exact indexedGaussianMaximum_add_constant _ _ _ + +theorem bilinear_gaussian_mean_le + (u : X → EuclideanSpace ℝ (Fin N)) (v : X → EuclideanSpace ℝ (Fin m)) + (hu : ∀ x, ‖u x‖ = 1) (hv : ∀ x, ‖v x‖ = 1) : + (∫ g, indexedGaussianMaximum (fun x (ij : Fin N × Fin m) => u x ij.1*v x ij.2) g + ∂Measure.pi (fun _ : Fin N × Fin m => gaussianReal 0 1)) ≤ + Real.sqrt N + Real.sqrt m := by + let μ := Measure.pi (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1) + let e : Fin N × Fin m → BilinearGaussianIndex N m := fun ij => .inl (.inl ij) + let D : X → (Fin N × Fin m) → ℝ := fun x ij => u x ij.1*v x ij.2 + have he : Function.Injective e := fun _ _ h => Sum.inl.inj (Sum.inl.inj h) + have hD := indexedGaussianMaximum_integrable D + have hR := iidGaussian_restrict_hasLaw e he + have hc : Integrable (fun g : BilinearGaussianIndex N m → ℝ => g (.inl (.inr ()))) μ := + (gaussianCoordinate_memLp _).integrable (by norm_num) + have hzero : (∫ g : BilinearGaussianIndex N m → ℝ, g (.inl (.inr ())) ∂μ) = 0 := by + simpa only [μ,integral_id_gaussianReal] using + (measurePreserving_eval (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1) + (.inl (.inr ()))).hasLaw.integral_eq + have hleft : (∫ g, indexedGaussianMaximum (bilinearMatrixCoefficient u v) g ∂μ) = + ∫ g, indexedGaussianMaximum D g ∂Measure.pi (fun _ : Fin N × Fin m => gaussianReal 0 1) := by + simp_rw [bilinearMatrix_maximum_eq] + change (∫ g, (indexedGaussianMaximum D ∘ (fun g : BilinearGaussianIndex N m → ℝ => + fun j => g (e j))) g + g (.inl (.inr ())) ∂μ) = _ + rw [integral_add (hR.integrable_comp hD) hc,hzero,add_zero] + exact hR.integral_comp hD.aestronglyMeasurable + let eu : Fin N → BilinearGaussianIndex N m := fun i => .inr (.inl i) + let ev : Fin m → BilinearGaussianIndex N m := fun j => .inr (.inr j) + have hub := ((gaussianCoordinateVector_memLp eu).integrable (by norm_num)).norm + have hvb := ((gaussianCoordinateVector_memLp ev).integrable (by norm_num)).norm + have hright : (∫ g, indexedGaussianMaximum (bilinearVectorCoefficient u v) g ∂μ) ≤ + (∫ g, ‖gaussianCoordinateVector eu g‖ ∂μ) + + ∫ g, ‖gaussianCoordinateVector ev g‖ ∂μ := by + rw [← integral_add hub hvb] + apply integral_mono (indexedGaussianMaximum_integrable _) (hub.add hvb) + intro g + apply Finset.sup'_le + intro x _ + have hu' := real_inner_le_norm (u x) (gaussianCoordinateVector eu g) + have hv' := real_inner_le_norm (v x) (gaussianCoordinateVector ev g) + rw [hu,one_mul] at hu' + rw [hv,one_mul] at hv' + convert add_le_add hu' hv' using 1 + simp only [Fintype.sum_sum_type,bilinearVectorCoefficient,zero_mul, + Finset.sum_const_zero,zero_add,EuclideanSpace.inner_eq_star_dotProduct, + dotProduct,star_trivial,gaussianCoordinateVector,eu,ev,mul_comm] + calc + _ = ∫ g, indexedGaussianMaximum (bilinearMatrixCoefficient u v) g ∂μ := hleft.symm + _ ≤ ∫ g, indexedGaussianMaximum (bilinearVectorCoefficient u v) g ∂μ := + bilinear_gaussian_maximum_comparison u v hu hv + _ ≤ _ := hright + _ ≤ Real.sqrt N + Real.sqrt m := by + simpa only [Fintype.card_fin] using add_le_add + (gaussianCoordinateVector_norm_integral_le eu) (gaussianCoordinateVector_norm_integral_le ev) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMinmax.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMinmax.lean new file mode 100644 index 0000000000000000000000000000000000000000..83a86c90fac39f5df96547694c5fe3a0f68806f2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMinmax.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Gaussian.IndexedGaussianMinmax +import OAI.Probability.InvariantIsing.Gaussian.BilinearGaussianComparison + +namespace OAI + +/-! Gordon's finite rectangular Gaussian matrix comparison. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +theorem bilinear_gaussian_minmax_comparison {N m : ℕ} + (u : U → EuclideanSpace ℝ (Fin N)) (v : V → EuclideanSpace ℝ (Fin m)) + (hu : ∀ a, ‖u a‖ = 1) (hv : ∀ b, ‖v b‖ = 1) : + (∫ g, finiteMinmax (fun x : U × V => ∑ i, + bilinearVectorCoefficient (fun x : U × V => u x.1) (fun x => v x.2) x i*g i) + ∂Measure.pi (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1)) ≤ + ∫ g, finiteMinmax (fun x : U × V => ∑ i, + bilinearMatrixCoefficient (fun x : U × V => u x.1) (fun x => v x.2) x i*g i) + ∂Measure.pi (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1) := by + apply indexed_gaussian_minmax_comparison + · intro x y + simp only [Fintype.sum_sum_type,bilinearMatrixCoefficient,bilinearVectorCoefficient, + mul_zero,zero_mul,Finset.sum_const_zero,zero_add] + · intro x a + rw [bilinearVector_covariance,bilinearMatrix_covariance] + simp only [real_inner_self_eq_norm_sq,hv,one_pow,mul_one] + ring + · intro x y + rw [bilinearVector_covariance,bilinearMatrix_covariance] + have ha : ⟪u x.1,u y.1⟫ ≤ 1 := by + simpa only [hu,mul_one] using real_inner_le_norm (u x.1) (u y.1) + have hb : ⟪v x.2,v y.2⟫ ≤ 1 := by + simpa only [hv,mul_one] using real_inner_le_norm (v x.2) (v y.2) + nlinarith [mul_nonneg (sub_nonneg.mpr ha) (sub_nonneg.mpr hb)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMinmaxMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMinmaxMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3f6e2b908f1cf66f4ce05589927e71b1b694a3e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/BilinearGaussianMinmaxMean.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Gaussian.BilinearGaussianMinmax + +namespace OAI + +/-! Removing the auxiliary Gaussian scalar and bounding the comparison's vector term. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +theorem bilinear_gaussian_minmax_mean {N m : ℕ} + (u : U → EuclideanSpace ℝ (Fin N)) (v : V → EuclideanSpace ℝ (Fin m)) + (hu : ∀ a, ‖u a‖ = 1) (hv : ∀ b, ‖v b‖ = 1) : + (∫ g, indexedGaussianMaximum (fun a i => u a i) g + ∂Measure.pi (fun _ : Fin N => gaussianReal 0 1))-Real.sqrt m ≤ + ∫ g, finiteMinmax (fun x : U × V => ∑ ij : Fin N × Fin m, (u x.1 ij.1*v x.2 ij.2)*g ij) + ∂Measure.pi (fun _ : Fin N × Fin m => gaussianReal 0 1) := by + let μ := Measure.pi (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1) + let e : Fin N × Fin m → BilinearGaussianIndex N m := fun ij => .inl (.inl ij) + let eu : Fin N → BilinearGaussianIndex N m := fun i => .inr (.inl i) + let ev : Fin m → BilinearGaussianIndex N m := fun j => .inr (.inr j) + let D : U × V → (Fin N × Fin m) → ℝ := fun x ij => u x.1 ij.1*v x.2 ij.2 + let C := bilinearMatrixCoefficient (fun x : U × V => u x.1) (fun x => v x.2) + let A := bilinearVectorCoefficient (fun x : U × V => u x.1) (fun x => v x.2) + have hR := iidGaussian_restrict_hasLaw e (fun _ _ h => Sum.inl.inj (Sum.inl.inj h)) + have hRu := iidGaussian_restrict_hasLaw eu (fun _ _ h => Sum.inl.inj (Sum.inr.inj h)) + have hc : Integrable (fun g : BilinearGaussianIndex N m → ℝ => g (.inl (.inr ()))) μ := + (gaussianCoordinate_memLp _).integrable (by norm_num) + have hzero : (∫ g : BilinearGaussianIndex N m → ℝ, g (.inl (.inr ())) ∂μ) = 0 := by + simpa only [μ,integral_id_gaussianReal] using + (measurePreserving_eval (fun _ : BilinearGaussianIndex N m => gaussianReal 0 1) + (.inl (.inr ()))).hasLaw.integral_eq + have hmatrix (g : BilinearGaussianIndex N m → ℝ) : + finiteMinmax (fun x => ∑ i, C x i*g i) = + finiteMinmax (fun x => ∑ ij, D x ij*g (e ij)) + g (.inl (.inr ())) := by + dsimp only [C] + simp only [Fintype.sum_sum_type,bilinearMatrixCoefficient,zero_mul, + one_mul,Finset.sum_const_zero,Fintype.sum_unique,add_zero] + exact finiteMinmax_add_constant _ _ + have hright : (∫ g, finiteMinmax (fun x => ∑ i, C x i*g i) ∂μ) = + ∫ g, finiteMinmax (fun x => ∑ ij, D x ij*g ij) + ∂Measure.pi (fun _ : Fin N × Fin m => gaussianReal 0 1) := by + simp_rw [hmatrix] + change (∫ g, ((fun g => finiteMinmax (fun x => ∑ ij, D x ij*g ij)) ∘ + (fun g : BilinearGaussianIndex N m → ℝ => fun j => g (e j))) g+ + g (.inl (.inr ())) ∂μ) = _ + rw [integral_add (hR.integrable_comp (indexedGaussianMinmax_integrable D)) hc,hzero,add_zero] + exact hR.integral_comp (indexedGaussianMinmax_integrable D).aestronglyMeasurable + have himax : Integrable (fun g : BilinearGaussianIndex N m → ℝ => + indexedGaussianMaximum (fun a i => u a i) (fun i => g (eu i))) μ := by + simpa only [Function.comp_def] using + hRu.integrable_comp (indexedGaussianMaximum_integrable (fun a i => u a i)) + have hinorm := ((gaussianCoordinateVector_memLp ev).integrable (by norm_num)).norm + have hleft : (∫ g, indexedGaussianMaximum (fun a i => u a i) (fun i => g (eu i)) ∂μ)- + (∫ g, ‖gaussianCoordinateVector ev g‖ ∂μ) ≤ + ∫ g, finiteMinmax (fun x => ∑ i, A x i*g i) ∂μ := by + rw [← integral_sub himax hinorm] + apply integral_mono (himax.sub hinorm) (indexedGaussianMinmax_integrable A) + intro g + obtain ⟨a,ha,he⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty + (fun a => ∑ i, u a i*g (eu i)) + change (Finset.univ.sup' Finset.univ_nonempty (fun a => ∑ i, u a i*g (eu i)))-_ ≤ _ + rw [he] + apply Finset.le_inf' + intro b _ + apply Finset.le_sup'_of_le _ (Finset.mem_univ a) + have hb := abs_real_inner_le_norm (v b) (gaussianCoordinateVector ev g) + rw [hv,one_mul] at hb + have hl := neg_le_of_abs_le hb + change -‖gaussianCoordinateVector ev g‖ ≤ _ at hl + change (∑ i, u a i*g (eu i)) - ‖gaussianCoordinateVector ev g‖ ≤ ∑ i, A (a,b) i*g i + dsimp only [A] + simp only [Fintype.sum_sum_type,bilinearVectorCoefficient,zero_mul, + Finset.sum_const_zero,zero_add] + have heq : ⟪v b,gaussianCoordinateVector ev g⟫ = ∑ j, v b j*g (ev j) := by + simp only [EuclideanSpace.inner_eq_star_dotProduct,dotProduct,star_trivial, + gaussianCoordinateVector,mul_comm] + rw [heq] at hl + dsimp only [eu,ev] at hl ⊢ + linarith + have hmaxeq : (∫ g, indexedGaussianMaximum (fun a i => u a i) (fun i => g (eu i)) ∂μ) = + ∫ g, indexedGaussianMaximum (fun a i => u a i) g + ∂Measure.pi (fun _ : Fin N => gaussianReal 0 1) := by + simpa only [Function.comp_def] using hRu.integral_comp + (indexedGaussianMaximum_integrable (fun a i => u a i)).aestronglyMeasurable + rw [hmaxeq] at hleft + have hnorm : (∫ g, ‖gaussianCoordinateVector ev g‖ ∂μ) ≤ Real.sqrt m := by + simpa only [Fintype.card_fin] using gaussianCoordinateVector_norm_integral_le ev + have hcomp := bilinear_gaussian_minmax_comparison u v hu hv + change (∫ g, finiteMinmax (fun x => ∑ i, A x i*g i) ∂μ) ≤ + (∫ g, finiteMinmax (fun x => ∑ i, C x i*g i) ∂μ) at hcomp + rw [hright] at hcomp + exact (sub_le_sub_left hnorm _).trans (hleft.trans hcomp) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/CountableGaussianComparison.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/CountableGaussianComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef3ff71bbc20268c6c47c36f2a6d60d74c835d5d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/CountableGaussianComparison.lean @@ -0,0 +1,204 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianMeanInterpolation +import OAI.Probability.InvariantIsing.Arrays.PerturbationMeasurability + +namespace OAI + +/-! Gaussian mean comparison for the actual countable spin/cascade-leaf prior. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology NNReal + +namespace InvariantIsing + +lemma finite_cylinder_mean_increment_le {X : Type*} [Fintype X] [MeasurableSpace X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (C A : X → ℕ →₀ ℝ) {K : ℝ} + (hK : ∀ s ∈ Set.Icc (0 : ℝ) 1, ∀ x y, + |cylinderCross (A x) (C y + s • A y)| ≤ K) : + |(∫ g : ℕ → ℝ, cgf (fun x => cylinderField (C x + A x) g) ν 1 ∂gaussianCoordinates) - + ∫ g : ℕ → ℝ, cgf (fun x => cylinderField (C x) g) ν 1 ∂gaussianCoordinates| ≤ 2 * K := by + classical + obtain ⟨n, hn⟩ := finite_family_support_bound (Sum.elim C A) + have hC (x : X) : ∀ j ∈ (C x).support, j < n + 1 := + fun j hj => hn (Sum.inl x) j (Finsupp.mem_support_iff.mp hj) + have hA (x : X) : ∀ j ∈ (A x).support, j < n + 1 := + fun j hj => hn (Sum.inr x) j (Finsupp.mem_support_iff.mp hj) + let C' : X → Fin (n + 1) → ℝ := fun x i => C x i + let A' : X → Fin (n + 1) → ℝ := fun x i => A x i + let w := fun x => ν.real {x} + have hw : GibbsReference w := finite_reference_GibbsReference ν + have hk (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) (x y : X) : + |gaussianCross A' (affineGaussianCoefficients C' A' s) x y| ≤ K := by + have hc := cylinderCross_prefix (A x) (C y + s • A y) (hA x) + simp only [Finsupp.add_apply, Finsupp.smul_apply, smul_eq_mul] at hc + have hh := hK s hs x y + rw [hc] at hh + exact hh + have he (s : ℝ) (g : ℕ → ℝ) : + cgf (fun x => cylinderField (C x + s • A x) g) ν 1 = + Real.log (finitePartition w (fun x => 0 + + linearGaussian (affineGaussianCoefficients C' A' s) + (fun i : Fin (n + 1) => g i) x)) := by + unfold cgf mgf + rw [integral_fintype Integrable.of_finite] + simp only [one_mul, zero_add, finitePartition] + congr 1 + apply Finset.sum_congr rfl + intro x _ + rw [cylinderField_add, cylinderField_smul, + cylinderField_eq_prefix (C x) (hC x), cylinderField_eq_prefix (A x) (hA x), + linearGaussian_affine] + rfl + have hm (s : ℝ) : (∫ g : ℕ → ℝ, + cgf (fun x => cylinderField (C x + s • A x) g) ν 1 ∂gaussianCoordinates) = + affineGaussianMean w (fun _ => 0) C' A' s := by + simp_rw [he s] + exact (gaussian_prefix_measurePreserving (n + 1)).hasLaw.integral_comp + (by simpa only [one_mul] using + (continuous_log_finitePartition hw (fun _ => 0) (affineGaussianCoefficients C' A' s) 1).aestronglyMeasurable) + have hc := affineGaussianMean_abs_sub_le hw (fun _ => 0) C' A' hk + rw [← hm 1, ← hm 0] at hc + simpa only [one_smul, zero_smul, add_zero] using hc + +lemma cylinder_cgf_restriction_mean_tendsto {X : Type*} [MeasurableSpace X] [Countable X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) + {S : ℕ → Set X} (hS : ∀ n, MeasurableSet (S n)) + (hExh : ∀ x, ∀ᶠ n in atTop, x ∈ S n) (hpos : ∀ n, ν (S n) ≠ 0) : + Tendsto (fun n => ∫ g : ℕ → ℝ, cgf (fun x => cylinderField (A x) g) + (normalizedRestriction ν (S n)) 1 ∂gaussianCoordinates) atTop + (𝓝 (∫ g : ℕ → ℝ, cgf (fun x => cylinderField (A x) g) ν 1 ∂gaussianCoordinates)) := by + have hv (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 + simpa only [cgf, mgf, one_mul] using + gaussian_log_restriction_expectation_tendsto (measurable_cylinderFields A) + (fun x => cylinderField_law (A x)) hv hS hExh hpos + +/-- The finite Gaussian mean estimate passes to countable leaf priors. +The two endpoint variance caps ensure convergence of their actual means. -/ +theorem countable_cylinder_mean_increment_le {X : Type*} [MeasurableSpace X] [Countable X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (C A : X → ℕ →₀ ℝ) {B₀ B₁ K : ℝ} + (hC : ∀ x, (C x).sum (fun _ c => c ^ 2) ≤ B₀) + (hCA : ∀ x, (C x + A x).sum (fun _ c => c ^ 2) ≤ B₁) + (hK : ∀ s ∈ Set.Icc (0 : ℝ) 1, ∀ x y, + |cylinderCross (A x) (C y + s • A y)| ≤ K) : + |(∫ g : ℕ → ℝ, cgf (fun x => cylinderField (C x + A x) g) ν 1 ∂gaussianCoordinates) - + ∫ g : ℕ → ℝ, cgf (fun x => cylinderField (C x) g) ν 1 ∂gaussianCoordinates| ≤ 2 * K := by + obtain ⟨S, hS, hpos, hExh⟩ := countable_reference_exhaustion ν + have hm₀ := cylinder_cgf_restriction_mean_tendsto ν C hC + (fun n => (hS n).measurableSet) hExh hpos + have hm₁ := cylinder_cgf_restriction_mean_tendsto ν (fun x => C x + A x) hCA + (fun n => (hS n).measurableSet) hExh hpos + apply le_of_tendsto ((hm₁.sub hm₀).abs) + apply Filter.Eventually.of_forall + intro n + let := (hS n).fintype + have : IsProbabilityMeasure (subtypeReference ν (S n)) := + subtypeReference_probability ν (hS n).measurableSet (hpos n) + have hf := finite_cylinder_mean_increment_le (subtypeReference ν (S n)) + (fun x => C x) (fun x => A x) (fun s hs x y => hK s hs x y) + have he (Q : X → ℕ →₀ ℝ) (g : ℕ → ℝ) : + cgf (fun x : S n => cylinderField (Q x) g) (subtypeReference ν (S n)) 1 = + cgf (fun x => cylinderField (Q x) g) (normalizedRestriction ν (S n)) 1 := by + unfold cgf mgf + congr 1 + exact (subtypeReference_preserving ν (hS n).measurableSet).hasLaw.integral_comp + (measurable_of_countable (fun x => Real.exp (1 * cylinderField (Q x) g))).aestronglyMeasurable + have heplus (g : ℕ → ℝ) : + cgf (fun x : S n => cylinderField (C x + A x) g) (subtypeReference ν (S n)) 1 = + cgf (fun x => cylinderField (C x + A x) g) (normalizedRestriction ν (S n)) 1 := + he (fun x => C x + A x) g + simpa only [heplus, he C] using hf + +lemma cylinder_log_partition_mean_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) : + (∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (A x) g) ∂ν) + ∂gaussianCoordinates) = Real.log (∫ x, Real.exp (H x) ∂ν) + + ∫ g : ℕ → ℝ, cgf (fun x => cylinderField (A x) g) (ν.tilted H) 1 ∂gaussianCoordinates := by + have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH + have he := cylinder_log_partition_base ν H hH A hA 1 + simp only [one_mul] at he + rw [integral_congr_ae he, integral_add (integrable_const _) + ((cylinder_cgf_memLp_two (ν.tilted H) A hA 1).integrable (by norm_num))] + simp only [integral_const, probReal_univ, one_smul] + +/-- The Gaussian mean comparison holds with the actual deterministic base +energy and any countable probability prior, including cascade-leaf weights. -/ +theorem countable_cylinder_log_mean_increment_le {X : Type*} [MeasurableSpace X] [Countable X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (H : X → ℝ) (hH : Integrable (fun x => Real.exp (H x)) ν) + (C A : X → ℕ →₀ ℝ) {B₀ B₁ K : ℝ} + (hC : ∀ x, (C x).sum (fun _ c => c ^ 2) ≤ B₀) + (hCA : ∀ x, (C x + A x).sum (fun _ c => c ^ 2) ≤ B₁) + (hK : ∀ s ∈ Set.Icc (0 : ℝ) 1, ∀ x y, + |cylinderCross (A x) (C y + s • A y)| ≤ K) : + |(∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (C x + A x) g) ∂ν) + ∂gaussianCoordinates) - + ∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (C x) g) ∂ν) + ∂gaussianCoordinates| ≤ 2 * K := by + have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH + rw [cylinder_log_partition_mean_base ν H hH (fun x => C x + A x) hCA, + cylinder_log_partition_mean_base ν H hH C hC, add_sub_add_left_eq_sub] + exact countable_cylinder_mean_increment_le (ν.tilted H) C A hC hCA hK + +lemma cylinderCross_add_right (a b c : ℕ →₀ ℝ) : + cylinderCross a (b + c) = cylinderCross a b + cylinderCross a c := by + unfold cylinderCross + simp only [Finsupp.add_apply, mul_add, Finsupp.sum] + exact Finset.sum_add_distrib + +/-- Endpoint mixed-cross bounds control the whole coefficient segment. -/ +lemma cylinderCross_segment_bound {X : Type*} (A C : X → ℕ →₀ ℝ) {L : ℝ} + (h₀ : ∀ x y, |cylinderCross (A x - C x) (C y)| ≤ L) + (h₁ : ∀ x y, |cylinderCross (A x - C x) (A y)| ≤ L) + {s : ℝ} (hs : s ∈ Set.Icc (0 : ℝ) 1) (x y : X) : + |cylinderCross (A x - C x) (C y + s • (A y - C y))| ≤ L := by + have he : C y + s • (A y - C y) = (1 - s) • C y + s • A y := by + ext i + simp only [Finsupp.add_apply, Finsupp.sub_apply, Finsupp.smul_apply, smul_eq_mul] + ring + rw [he, cylinderCross_add_right, cylinderCross_smul_right, cylinderCross_smul_right] + calc + _ ≤ |(1 - s) * cylinderCross (A x - C x) (C y)| + + |s * cylinderCross (A x - C x) (A y)| := abs_add_le _ _ + _ = (1 - s) * |cylinderCross (A x - C x) (C y)| + + s * |cylinderCross (A x - C x) (A y)| := by + rw [abs_mul, abs_mul, abs_of_nonneg (sub_nonneg.mpr hs.2), abs_of_nonneg hs.1] + _ ≤ (1 - s) * L + s * L := add_le_add + (mul_le_mul_of_nonneg_left (h₀ x y) (sub_nonneg.mpr hs.2)) + (mul_le_mul_of_nonneg_left (h₁ x y) hs.1) + _ = L := by ring + +/-- The form used for rotation comparison: any two bounded-variance +coefficient families on the actual countable prior can be compared from +mixed cross-covariances of their increment with the two endpoints. -/ +theorem countable_cylinder_log_mean_compare {X : Type*} [MeasurableSpace X] [Countable X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (H : X → ℝ) (hH : Integrable (fun x => Real.exp (H x)) ν) + (A C : X → ℕ →₀ ℝ) {B₀ B₁ L : ℝ} + (hC : ∀ x, (C x).sum (fun _ c => c ^ 2) ≤ B₀) + (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B₁) + (h₀ : ∀ x y, |cylinderCross (A x - C x) (C y)| ≤ L) + (h₁ : ∀ x y, |cylinderCross (A x - C x) (A y)| ≤ L) : + |(∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (A x) g) ∂ν) + ∂gaussianCoordinates) - + ∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (C x) g) ∂ν) + ∂gaussianCoordinates| ≤ 2 * L := by + have he (x : X) : C x + (A x - C x) = A x := by abel + have h := countable_cylinder_log_mean_increment_le ν H hH C (fun x => A x - C x) + hC (fun x => by simpa only [he] using hA x) + (fun s hs x y => cylinderCross_segment_bound A C h₀ h₁ hs x y) + simpa only [he] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/CountableGaussianVariance.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/CountableGaussianVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7bce28ea5a7dc1a2217a4ab4a06f70f6de43fd8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/CountableGaussianVariance.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Pressure.VarianceLimit +import OAI.Probability.InvariantIsing.Core.FiniteGaussianVariance +import OAI.Probability.IsingPerceptron.NormalizedRestrictionPi + +namespace OAI + +/-! The variance estimate passes from finite positive-mass leaf cutoffs to the +actual countable spin/cascade-leaf prior. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology NNReal + +namespace InvariantIsing + +theorem cylinder_cgf_variance_le_of_finite_restrictions {X : Type*} + [MeasurableSpace X] [Countable X] [MeasurableSingletonClass X] + (ν : Measure X) [IsProbabilityMeasure ν] (A : X → ℕ →₀ ℝ) + {B C : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) + (hfinite : ∀ S : Set X, S.Finite → ν S ≠ 0 → + variance (fun g : ℕ → ℝ => cgf (fun x => cylinderField (A x) g) + (normalizedRestriction ν S) t) gaussianCoordinates ≤ C) : + variance (fun g : ℕ → ℝ => cgf (fun x => cylinderField (A x) g) ν t) + gaussianCoordinates ≤ C := by + obtain ⟨S, hS, hpos, hExh⟩ := countable_reference_exhaustion ν + let νn := fun n => normalizedRestriction ν (S n) + have : ∀ n, IsProbabilityMeasure (νn n) := fun n => normalizedRestriction_probability (hpos n) + 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) + let f := fun n g => Real.log (∫ x, Real.exp (H (g, x)) ∂νn n) + let F := fun g => Real.log (∫ x, Real.exp (H (g, x)) ∂ν) + have hfm (n : ℕ) : Measurable (f n) := + hH.exp.stronglyMeasurable.integral_prod_right'.measurable.log + have hFm : Measurable F := hH.exp.stronglyMeasurable.integral_prod_right'.measurable.log + have hf (n : ℕ) : MemLp (f n) 2 gaussianCoordinates := + (memLp_two_iff_integrable_sq (hfm n).aestronglyMeasurable).mpr + (gaussian_log_partition_second (ν := νn n) hH hLaw hVar).1 + have hF : MemLp F 2 gaussianCoordinates := + (memLp_two_iff_integrable_sq hFm.aestronglyMeasurable).mpr + (gaussian_log_partition_second (ν := ν) hH hLaw hVar).1 + have hm : Tendsto (fun n => ∫ g, f n g ∂gaussianCoordinates) atTop + (𝓝 (∫ g, F g ∂gaussianCoordinates)) := + gaussian_log_restriction_expectation_tendsto hH hLaw hVar + (fun n => (hS n).measurableSet) hExh hpos + have he := (gaussian_field_exp_integrable (ν := ν) hH hLaw hVar 1).1 + simp only [one_mul] at he + have ht : ∀ᵐ g ∂gaussianCoordinates, Tendsto (fun n => f n g) atTop (𝓝 (F g)) := by + filter_upwards [he.prod_right_ae] with g hg + have hz : 0 < ∫ x, Real.exp (H (g, x)) ∂ν := MeasureTheory.integral_exp_pos hg + exact (Real.continuousAt_log hz.ne').tendsto.comp + (normalized_restriction_integral_tendsto (fun n => (hS n).measurableSet) hExh hg) + have hv (n : ℕ) : variance (f n) gaussianCoordinates ≤ C := + hfinite (S n) (hS n) (hpos n) + exact variance_le_of_ae_tendsto_of_mean_tendsto hf hF ht hm hv + +/-- The countable spin/leaf Gaussian log partition inherits the uniform +coefficient variance bound from the finite-dimensional Gaussian +Poincaré inequality. -/ +theorem countable_cylinder_cgf_variance_le (hpub : GaussianLipschitzVarianceInput) + {X : Type*} [MeasurableSpace X] [Countable X] [MeasurableSingletonClass X] + (ν : Measure X) [IsProbabilityMeasure ν] (A : X → ℕ →₀ ℝ) + (B : ℝ) (hB : 0 ≤ B) (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) : + variance (fun g : ℕ → ℝ => cgf (fun x => cylinderField (A x) g) ν t) + gaussianCoordinates ≤ t ^ 2 * B := by + apply cylinder_cgf_variance_le_of_finite_restrictions ν A hA t + intro S hS hpos + let := hS.fintype + have : IsProbabilityMeasure (subtypeReference ν S) := + subtypeReference_probability ν hS.measurableSet hpos + have h := finite_cylinder_cgf_variance_le hpub (subtypeReference ν S) + (fun x : S => A x) B hB (fun x => hA x) t + have he (g : ℕ → ℝ) : + cgf (fun x : S => cylinderField (A x) g) (subtypeReference ν S) t = + cgf (fun x => cylinderField (A x) g) (normalizedRestriction ν S) t := by + unfold cgf mgf + congr 1 + exact (subtypeReference_preserving ν hS.measurableSet).hasLaw.integral_comp + (measurable_of_countable (fun x => Real.exp (t * cylinderField (A x) g))).aestronglyMeasurable + simpa only [he] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/DavidsonSzarekInput.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/DavidsonSzarekInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..05082f5c5d4e904b36a7688a4ea073c9ee65b38d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/DavidsonSzarekInput.lean @@ -0,0 +1,22 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramEdges +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramUniformIntegrability + +namespace OAI + +/-! Gaussian spectral edge and uniform-integrability estimates, +proved using the Gaussian Poincaré inequality. -/ +noncomputable section +namespace InvariantIsing + +theorem davidsonSzarek_proved (α : ℝ) (hα : 0 < α) : DavidsonSzarekInput α hα := by + constructor + · intro Ω _ P _ Z hZ c + exact gaussianPattern_spectralExcess_tendsto hα P Z hZ c + · intro Ω _ P _ Z hZ c + exact gaussianPattern_spectralRadius_uniformIntegrable hα.le P Z hZ c + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianBaseComparison.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianBaseComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..29a24bc6351d908cc8b1504e7849050e4e4ce0ea --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianBaseComparison.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Gaussian.CountableGaussianComparison +import OAI.Probability.IsingPerceptron.MonomialGgAtMinimum +import OAI.Probability.IsingPerceptron.JointGGClosure + +namespace OAI + +/-! Stability of the actual Gaussian partition under bounded base-energy changes. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +/-- An independent Gaussian perturbation changes the mean pressure by at +most half its maximal variance, including after a fixed base-energy tilt. -/ +theorem countable_cylinder_log_mean_cost {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) : + let d := (∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (A x) g) ∂ν) + ∂gaussianCoordinates) - Real.log (∫ x, Real.exp (H x) ∂ν) + 0 ≤ d ∧ d ≤ B / 2 := by + have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH + dsimp only + rw [cylinder_log_partition_mean_base ν H hH A hA, add_sub_cancel_left] + simpa only [one_pow, one_mul] using cylinder_cgf_mean_bounds (ν.tilted H) A hA 1 + +lemma cylinder_partition_exp_integrable_ae {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) : + ∀ᵐ g : ℕ → ℝ ∂gaussianCoordinates, + Integrable (fun x => Real.exp (H x + cylinderField (A x) g)) ν := by + have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH + have hv (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)) hv 1).1.prod_right_ae + filter_upwards [he] with g hg + simpa only [one_mul, smul_eq_mul, ← Real.exp_add] using + (integrable_tilted_iff hH (fun x => Real.exp (1 * cylinderField (A x) g))).mp hg + +/-- A uniform deterministic energy change bounds the mean logpartition +change, for every countable prior and bounded-variance Gaussian field. -/ +theorem countable_cylinder_log_mean_base_compare {X : Type*} [MeasurableSpace X] [Countable X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (H J : X → ℝ) (hH : Integrable (fun x => Real.exp (H x)) ν) + (hJ : Integrable (fun x => Real.exp (J x)) ν) + (A : X → ℕ →₀ ℝ) {B K : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) + (hK : ∀ x, |H x - J x| ≤ K) : + |(∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (H x + cylinderField (A x) g) ∂ν) + ∂gaussianCoordinates) - + ∫ g : ℕ → ℝ, Real.log (∫ x, Real.exp (J x + cylinderField (A x) g) ∂ν) + ∂gaussianCoordinates| ≤ K := by + have hiH := (cylinder_log_partition_memLp_two ν H hH A hA 1).integrable (by norm_num) + have hiJ := (cylinder_log_partition_memLp_two ν J hJ A hA 1).integrable (by norm_num) + simp only [one_mul] at hiH hiJ + rw [← integral_sub hiH hiJ, ← Real.norm_eq_abs] + apply (norm_integral_le_of_norm_le_const (μ := gaussianCoordinates) (C := K) ?_).trans_eq (by simp) + filter_upwards [cylinder_partition_exp_integrable_ae ν H hH A hA, + cylinder_partition_exp_integrable_ae ν J hJ A hA] with g hgH hgJ + have h := logMean_abs_sub_le ν (b := 1) (by norm_num) + (by simpa only [one_mul] using hgH) (by simpa only [one_mul] using hgJ) + (fun x => by simpa only [add_sub_add_right_eq_sub] using hK x) + simpa only [logMean, div_one, one_mul, Real.norm_eq_abs] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCenteredSquare.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCenteredSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2cd9ec525276b263a050e4bb4add69715c034e6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCenteredSquare.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianSingularFluctuation +import OAI.Probability.InvariantIsing.Pressure.RandomSqrtLimit + +namespace OAI + +/-! Scaled centered Gaussian squares are uniformly integrable using variance alone. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology ENNReal +namespace InvariantIsing + +lemma finiteGaussian_centeredSquare_integrable {ι : Type*} [Fintype ι] + {f : EuclideanSpace ℝ ι → ℝ} (hf : LipschitzWith 1 f) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : Ω → EuclideanSpace ℝ ι) (hZ : HasLaw Z (stdGaussian _) P) (r : ℝ) : + Integrable (fun ω => (f (Z ω)-(∫ x, f x ∂stdGaussian _))^2/r) P := by + have h := (hZ.memLp_comp (finiteGaussian_lipschitz_memLp_two hf)).sub + (memLp_const (∫ x, f x ∂stdGaussian _)) + exact h.integrable_sq.div_const r + +lemma finiteGaussian_centeredSquare_L1_bound {ι : Type*} [Fintype ι] + {f : EuclideanSpace ℝ ι → ℝ} (hf : LipschitzWith 1 f) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : Ω → EuclideanSpace ℝ ι) (hZ : HasLaw Z (stdGaussian _) P) + (r : ℝ) (hr : 0 < r) : + eLpNorm (fun ω => (f (Z ω)-(∫ x, f x ∂stdGaussian _))^2/r) 1 P ≤ + ENNReal.ofReal (1/r) := by + have hi := finiteGaussian_centeredSquare_integrable hf P Z hZ r + rw [eLpNorm_one_eq_lintegral_enorm hi.aestronglyMeasurable, + ← ofReal_integral_norm_eq_lintegral_enorm hi] + have he : (∫ ω, ‖(f (Z ω)-(∫ x, f x ∂stdGaussian _))^2/r‖ ∂P) = + variance f (stdGaussian _)/r := by + have hn (ω) : ‖(f (Z ω)-(∫ x, f x ∂stdGaussian _))^2/r‖ = + (f (Z ω)-(∫ x, f x ∂stdGaussian _))^2/r := + Real.norm_of_nonneg (div_nonneg (sq_nonneg _) hr.le) + simp_rw [hn] + rw [integral_div] + have h := hZ.integral_comp (f := fun y => (f y-(∫ x, f x ∂stdGaussian _))^2) + ((hf.continuous.sub continuous_const).pow 2).aestronglyMeasurable + rw [show (∫ ω, (f (Z ω)-(∫ x, f x ∂stdGaussian _))^2 ∂P) = + ∫ y, (f y-(∫ x, f x ∂stdGaussian _))^2 ∂stdGaussian _ from h] + rw [← variance_eq_integral hf.continuous.aemeasurable] + rw [he] + apply ENNReal.ofReal_le_ofReal + apply div_le_div_of_nonneg_right _ hr.le + simpa only [NNReal.coe_one,one_pow] using finiteGaussian_lipschitz_variance hf + +theorem gaussianCenteredSquare_uniformIntegrable {ι : ℕ → Type*} [∀ k, Fintype (ι k)] + (f : (k : ℕ) → EuclideanSpace ℝ (ι k) → ℝ) (hf : ∀ k, LipschitzWith 1 (f k)) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (k : ℕ) → Ω → EuclideanSpace ℝ (ι k)) + (hZ : ∀ k, HasLaw (Z k) (stdGaussian _) P) : + UniformIntegrable (fun k ω => + (f k (Z k ω)-(∫ x, f k x ∂stdGaussian _))^2/(k+1)) 1 P := by + have hi k := finiteGaussian_centeredSquare_integrable (hf k) P (Z k) (hZ k) (k+1) + have hb k := finiteGaussian_centeredSquare_L1_bound (hf k) P (Z k) (hZ k) (k+1) + (by positivity) + have ht : Tendsto (fun k : ℕ => ENNReal.ofReal (1/(k+1 : ℝ))) atTop (𝓝 0) := by + have h := ENNReal.continuous_ofReal.continuousAt.tendsto.comp + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) + simpa only [ENNReal.ofReal_zero,Function.comp_def] using h + refine ⟨unifIntegrable_of_tendsto_Lp_zero le_rfl (by simp) + (fun k => memLp_one_iff_integrable.mpr (hi k)) (tendsto_of_tendsto_of_tendsto_of_le_of_le + tendsto_const_nhds ht (fun _ => zero_le) hb),1,?_⟩ + intro k + apply (hb k).trans + apply ENNReal.ofReal_le_one.mpr + exact (div_le_one (by positivity : (0 : ℝ) < k+1)).mpr (by have := Nat.cast_nonneg (α := ℝ) k; linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianClippedStieltjes.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianClippedStieltjes.lean new file mode 100644 index 0000000000000000000000000000000000000000..31f3e131c2e979720cb3fb9739c5b0bc42c2f559 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianClippedStieltjes.lean @@ -0,0 +1,29 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianZeroUpperExcess +import OAI.Probability.InvariantIsing.Spectral.ClippedEmpiricalTransform + +namespace OAI + +/-! The original Gaussian transform limit survives clipping to the MP support bounds. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace InvariantIsing + +theorem gaussianPattern_clipped_stieltjes {α t : ℝ} (hα : 0 < α) (ht : 0 < t) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => ∫ x, positiveResolventTest t (spectralClip 0 (marchenkoPasturB α) x) + ∂(empiricalSpectralLaw (Nat.succ_pos k) (gaussianPatternEigenvalues (Z (k+1) ω)) : Measure ℝ)) + atTop (fun _ => marchenkoPasturTransform t α) := by + have hE := tendstoInMeasure_div_pos P _ (gaussianPattern_zero_upper_excess hα P Z hZ) (sq_pos_of_pos ht) + apply tendstoInMeasure_of_dist_le P _ _ _ _ (gaussianPatternStieltjes_tendsto hα.le ht P Z hZ) hE + intro k ω + rw [Real.dist_eq,← gaussianGramStieltjes_empirical_integral (Nat.succ_pos k) ht] + exact empirical_transform_clip_excess (Nat.succ_pos k) _ (sq_nonneg _) ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianClippedWeak.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianClippedWeak.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbe9844bd27f23ec12377899c8194ef415a53867 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianClippedWeak.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPClippedTransform + +namespace OAI + +/-! Weak convergence in probability of the actual Gaussian empirical law after clipping. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace InvariantIsing + +theorem gaussianPattern_clipped_weak {α : ℝ} (hα : 0 < α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + ((empiricalSpectralLaw (Nat.succ_pos k) (gaussianPatternEigenvalues (Z (k+1) ω))).map + (spectralClip 0 (marchenkoPasturB α)))) atTop + (fun _ => LevyProkhorov.ofMeasure (⟨marchenkoPasturMeasure α,marchenkoPastur_probability hα⟩ : ProbabilityMeasure ℝ)) := by + let R := marchenkoPasturB α + have hR : 0 ≤ R := sq_nonneg _ + let ν : ProbabilityMeasure ℝ := ⟨marchenkoPasturMeasure α,marchenkoPastur_probability hα⟩ + let W := fun k ω => compactClippedLaw R hR + (empiricalSpectralLaw (Nat.succ_pos k) (gaussianPatternEigenvalues (Z (k+1) ω))) + have hh : ∀ t : {t : ℝ // 0 < t}, TendstoInMeasure P + (fun k ω => ∫ x, compactResolventTest R t x ∂(W k ω : Measure _)) atTop + (fun _ => ∫ x, compactResolventTest R t x ∂(compactClippedLaw R hR ν : Measure _)) := by + intro t + simp only [W,compactClippedLaw_integral] + change TendstoInMeasure P _ atTop (fun _ => ∫ x, + positiveResolventTest t (spectralClip 0 (marchenkoPasturB α) x) ∂marchenkoPasturMeasure α) + rw [marchenkoPastur_clipped_transform hα t.property] + exact gaussianPattern_clipped_stieltjes hα t.property P Z hZ + have hc := compact_resolvent_tendstoInMeasure R P W (compactClippedLaw R hR ν) hh + have hn : (compactClippedLaw R hR ν).map (fun x => (x : ℝ)) = ν := + compactClippedLaw_real_eq R hR ν (marchenkoPastur_mem_nonnegative_interval hα) + rw [hn] at hc + simpa only [W,compactClippedLaw_real] using hc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeletion.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeletion.lean new file mode 100644 index 0000000000000000000000000000000000000000..27d59bcd345a5efbfacbea58a706749bb86a63c6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeletion.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianColumnProductLaw +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolventEquation +import OAI.Probability.InvariantIsing.Gaussian.HermitianGaussianQuadratic + +namespace OAI + +/-! Deleting a column removes all dependence on that Gaussian coordinate. -/ +noncomputable section +open Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +lemma gaussianGramLeaveOneOut_congr {N m : ℕ} (g h : Fin m → Fin N → ℝ) (j : Fin m) + (he : ∀ l, l ≠ j → g l = h l) : + gaussianGramLeaveOneOut (gaussianColumnArray g) j = + gaussianGramLeaveOneOut (gaussianColumnArray h) j := by + unfold gaussianGramLeaveOneOut + congr 1 + apply Finset.sum_congr rfl + intro l hl + rw [gaussianColumnArray_column,gaussianColumnArray_column,he l (Finset.mem_erase.mp hl).1] + +lemma gaussianGramLeaveOneOut_insertNth {N m : ℕ} (j : Fin (m+1)) + (x y : Fin N → ℝ) (g : Fin m → Fin N → ℝ) : + gaussianGramLeaveOneOut (gaussianColumnArray (j.insertNth x g)) j = + gaussianGramLeaveOneOut (gaussianColumnArray (j.insertNth y g)) j := by + apply gaussianGramLeaveOneOut_congr + intro l hl + obtain ⟨k,rfl⟩ := Fin.exists_succAbove_eq hl + simp only [Fin.insertNth_apply_succAbove] + +lemma gaussianGramColumnQuadratic_eq {N m : ℕ} (t : ℝ) (g : Fin m → Fin N → ℝ) (j : Fin m) : + gaussianGramColumnQuadratic t (gaussianColumnArray g) j = + (1/(N : ℝ))*gaussianQuadraticForm + (gaussianGramLeaveResolvent t (gaussianColumnArray g) j) (WithLp.toLp 2 (g j)) := by + have he : ((Real.sqrt (N : ℝ))⁻¹)^2 = 1/(N : ℝ) := by + rw [inv_pow,Real.sq_sqrt (Nat.cast_nonneg N),one_div] + unfold gaussianGramColumnQuadratic gaussianPatternScaledColumn + rw [gaussianColumnArray_column,Matrix.mulVec_smul,dotProduct_smul,smul_dotProduct] + simp only [smul_eq_mul] + unfold gaussianQuadraticForm + rw [EuclideanSpace.inner_eq_star_dotProduct] + simp only [star_trivial] + rw [dotProduct_comm] + change _ = (1/(N : ℝ))*((gaussianGramLeaveResolvent t (gaussianColumnArray g) j *ᵥ g j) ⬝ᵥ g j) + calc + _ = ((Real.sqrt (N : ℝ))⁻¹)^2*((gaussianGramLeaveResolvent t (gaussianColumnArray g) j *ᵥ g j) ⬝ᵥ g j) := by ring + _ = _ := by rw [he] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeviation.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeviation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5741ef469dd4c990ed0df4cdf630b0e31dd1c8b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeviation.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianColumnResolventContinuity +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventFluctuation + +namespace OAI + +/-! Integrability of the actual leave-one-column quadratic deviation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +namespace InvariantIsing + +def gaussianGramColumnDeviation {N m : ℕ} (t : ℝ) (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : ℝ := |gaussianGramColumnQuadratic t z j-(gaussianGramLeaveResolvent t z j).trace/N| + +lemma continuous_gaussianGramColumnDeviation {N m : ℕ} {t : ℝ} (ht : 0 < t) (j : Fin m) : + Continuous (gaussianGramColumnDeviation (N := N) t · j) := + ((continuous_gaussianGramColumnQuadratic ht j).sub + ((continuous_gaussianGramLeaveResolvent ht j).matrix_trace.div_const _)).abs + +lemma gaussianGramColumnDeviation_bound {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (g : Fin m → Fin N → ℝ) (j : Fin m) : + gaussianGramColumnDeviation t (gaussianColumnArray g) j ≤ + (1/((N : ℝ)*t))*‖WithLp.toLp 2 (g j)‖^2+1/t := by + unfold gaussianGramColumnDeviation + rw [gaussianGramColumnQuadratic_eq] + exact positiveResolvent_normalized_abs_bound hN ht + (gaussianGramLeaveOneOut_posSemidef (gaussianColumnArray g) j) _ + +lemma gaussianGramColumnDeviation_integrable {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (j : Fin m) : Integrable (fun g : Fin m → Fin N → ℝ => + gaussianGramColumnDeviation t (gaussianColumnArray g) j) + (Measure.pi (fun _ : Fin m => Measure.pi (fun _ : Fin N => gaussianReal 0 1))) := by + have hi := (measurePreserving_eval + (fun _ : Fin m => Measure.pi (fun _ : Fin N => gaussianReal 0 1)) j).hasLaw.integrable_comp + (gaussianCoordinateVector_sq_integrable (id : Fin N → Fin N)) + have hm : AEStronglyMeasurable (fun g : Fin m → Fin N → ℝ => + gaussianGramColumnDeviation t (gaussianColumnArray g) j) + (Measure.pi (fun _ : Fin m => Measure.pi (fun _ : Fin N => gaussianReal 0 1))) := + ((continuous_gaussianGramColumnDeviation (N := N) ht j).comp + (continuous_gaussianColumnArray (N := N) (m := m))).aestronglyMeasurable + apply ((hi.const_mul (1/((N : ℝ)*t))).add (integrable_const (1/t))).mono' hm + apply ae_of_all + intro g + rw [Real.norm_eq_abs,abs_of_nonneg (show 0 ≤ gaussianGramColumnDeviation t (gaussianColumnArray g) j from abs_nonneg _)] + exact gaussianGramColumnDeviation_bound hN ht g j + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeviationMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeviationMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4b73ddfc01c3bd6907eedf22c7f514722df4fca --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnDeviationMean.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianColumnDeviation + +namespace OAI + +/-! Conditional Gaussian quadratic fluctuation, averaged over the actual remaining columns. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +namespace InvariantIsing + +lemma gaussianGramColumnDeviation_insert_integral {N m : ℕ} (hN : 0 < N) + {t : ℝ} (ht : 0 < t) (j : Fin (m+1)) (g : Fin m → Fin N → ℝ) : + (∫ x : Fin N → ℝ, gaussianGramColumnDeviation t (gaussianColumnArray (j.insertNth x g)) j + ∂Measure.pi (fun _ : Fin N => gaussianReal 0 1)) ≤ Real.sqrt (2/((N : ℝ)*t^2)) := by + let B := gaussianGramLeaveOneOut (gaussianColumnArray (j.insertNth 0 g)) j + have hB : B.PosSemidef := gaussianGramLeaveOneOut_posSemidef _ j + have he (x : Fin N → ℝ) : + gaussianGramColumnDeviation t (gaussianColumnArray (j.insertNth x g)) j = + |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) (WithLp.toLp 2 x)- + (positiveResolvent t B).trace/N| := by + unfold gaussianGramColumnDeviation + rw [gaussianGramColumnQuadratic_eq] + simp only [Fin.insertNth_apply_same,gaussianGramLeaveResolvent, + gaussianGramLeaveOneOut_insertNth j x 0 g,positiveResolvent,B] + simp_rw [he] + have hz : HasLaw (WithLp.toLp 2 : (Fin N → ℝ) → EuclideanSpace ℝ (Fin N)) + (stdGaussian _) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N => ℝ)).measurable.aemeasurable,map_pi_eq_stdGaussian⟩ + have htrans : (∫ x : Fin N → ℝ, |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) + (WithLp.toLp 2 x)-(positiveResolvent t B).trace/N| ∂Measure.pi (fun _ => gaussianReal 0 1)) = + ∫ x, |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x- + (positiveResolvent t B).trace/N| ∂stdGaussian _ := by + simpa only [Function.comp_def] using (hz.integral_comp + (f := fun x => |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x- + (positiveResolvent t B).trace/N|) + (((gaussianQuadraticForm_continuous _).const_mul _).sub continuous_const).abs.aestronglyMeasurable) + rw [htrans] + exact positiveResolvent_normalized_fluctuation hN ht hB + +theorem gaussianGramColumnDeviation_mean_le {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (j : Fin (m+1)) : + (∫ g : Fin (m+1) → Fin N → ℝ, gaussianGramColumnDeviation t (gaussianColumnArray g) j + ∂Measure.pi (fun _ : Fin (m+1) => Measure.pi (fun _ : Fin N => gaussianReal 0 1))) ≤ + Real.sqrt (2/((N : ℝ)*t^2)) := by + let μ := Measure.pi (fun _ : Fin N => gaussianReal 0 1) + let ν := Measure.pi (fun _ : Fin (m+1) => μ) + let ρ := Measure.pi (fun _ : Fin m => μ) + let e := (MeasurableEquiv.piFinSuccAbove (fun _ : Fin (m+1) => Fin N → ℝ) j).symm + let F := fun g : Fin (m+1) → Fin N → ℝ => gaussianGramColumnDeviation t (gaussianColumnArray g) j + have hm : MeasurePreserving e (μ.prod ρ) ν := (measurePreserving_piFinSuccAbove (fun _ => μ) j).symm + have hi : Integrable F ν := gaussianGramColumnDeviation_integrable hN ht j + have hip : Integrable (F ∘ e) (μ.prod ρ) := hm.hasLaw.integrable_comp hi + calc + _ = ∫ p, F (e p) ∂μ.prod ρ := (hm.integral_comp' F).symm + _ = ∫ g, ∫ x, F (e (x,g)) ∂μ ∂ρ := integral_prod_symm _ hip + _ ≤ ∫ _ : Fin m → Fin N → ℝ, Real.sqrt (2/((N : ℝ)*t^2)) ∂ρ := by + apply integral_mono hip.integral_prod_right (integrable_const _) + intro g + exact gaussianGramColumnDeviation_insert_integral hN ht j g + _ = _ := by simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnProductLaw.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnProductLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5c1f2b8b13ceac7e95694009154cf56c147f63b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnProductLaw.lean @@ -0,0 +1,39 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramColumns +import Mathlib.Probability.ProductMeasure + +namespace OAI + +/-! The physical Gaussian matrix as independent Gaussian columns. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +def gaussianColumnArray {N m : ℕ} (g : Fin m → Fin N → ℝ) : + EuclideanSpace ℝ (Fin N × Fin m) := WithLp.toLp 2 (fun p => g p.2 p.1) + +lemma gaussianColumnArray_hasLaw (N m : ℕ) : + HasLaw (gaussianColumnArray (N := N) (m := m)) (stdGaussian _) + (Measure.pi (fun _ : Fin m => Measure.pi (fun _ : Fin N => gaussianReal 0 1))) := by + let μ := gaussianReal 0 1 + have hc : HasLaw (MeasurableEquiv.curry (Fin m) (Fin N) ℝ).symm + (Measure.pi (fun _ : Fin m × Fin N => μ)) + (Measure.pi (fun _ : Fin m => Measure.pi (fun _ : Fin N => μ))) := by + refine ⟨(MeasurableEquiv.curry _ _ _).symm.measurable.aemeasurable,?_⟩ + simpa only [Measure.infinitePi_eq_pi] using Measure.infinitePi_map_curry_symm (fun (_ : Fin m) (_ : Fin N) => μ) + have hs := (measurePreserving_piCongrLeft (fun _ : Fin N × Fin m => μ) + (Equiv.prodComm (Fin m) (Fin N))).hasLaw + have hz : HasLaw (WithLp.toLp 2 : (Fin N × Fin m → ℝ) → EuclideanSpace ℝ (Fin N × Fin m)) + (stdGaussian _) (Measure.pi (fun _ : Fin N × Fin m => μ)) := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N × Fin m => ℝ)).measurable.aemeasurable, + map_pi_eq_stdGaussian⟩ + convert hz.comp (hs.comp hc) using 1 + rfl + +lemma gaussianColumnArray_column {N m : ℕ} (g : Fin m → Fin N → ℝ) (j : Fin m) : + gaussianGramRawColumn (gaussianColumnArray g) j = g j := rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnResolventContinuity.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnResolventContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fd4defb8b5f810742fbaea6c52965441a84f1bc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianColumnResolventContinuity.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianColumnDeletion +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventBounds + +namespace OAI + +/-! Measurability of the actual deleted-column resolvent observables. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma continuous_gaussianGramLeaveOneOut {N m : ℕ} (j : Fin m) : + Continuous (gaussianGramLeaveOneOut (N := N) · j) := by + apply continuous_matrix + intro i k + simp only [gaussianGramLeaveOneOut,Matrix.smul_apply,Matrix.sum_apply, + Matrix.vecMulVec_apply,gaussianGramRawColumn,smul_eq_mul] + fun_prop + +lemma continuous_gaussianGramLeaveResolvent {N m : ℕ} {t : ℝ} (ht : 0 < t) (j : Fin m) : + Continuous (gaussianGramLeaveResolvent (N := N) t · j) := by + apply continuous_iff_continuousAt.mpr + intro z + have hi := continuousAt_matrix_inv + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianGramLeaveOneOut z j) + (show ContinuousAt Ring.inverse _ from by + simpa only [Ring.inverse_eq_inv'] using continuousAt_inv₀ + (gaussianGramLeaveShift_posDef ht z j).det_pos.ne') + exact hi.comp (f := fun w : EuclideanSpace ℝ (Fin N × Fin m) => + t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianGramLeaveOneOut w j) + ((continuous_const.add (continuous_gaussianGramLeaveOneOut j)).continuousAt) + +lemma continuous_gaussianGramColumnQuadratic {N m : ℕ} {t : ℝ} (ht : 0 < t) (j : Fin m) : + Continuous (gaussianGramColumnQuadratic (N := N) t · j) := by + have hr := continuous_gaussianGramLeaveResolvent (N := N) ht j + simp only [gaussianGramColumnQuadratic,gaussianPatternScaledColumn,gaussianGramRawColumn, + Matrix.mulVec,dotProduct,Pi.smul_apply,smul_eq_mul] + fun_prop + +lemma continuous_gaussianColumnArray {N m : ℕ} : + Continuous (gaussianColumnArray (N := N) (m := m)) := by + unfold gaussianColumnArray + exact (PiLp.continuous_toLp 2 (fun _ : Fin N × Fin m => ℝ)).comp + (continuous_pi (fun p => (continuous_apply p.1).comp (continuous_apply p.2))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCompactVariance.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCompactVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e975c3f66b085c0cca199d82731a9b7030afea7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCompactVariance.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianTestVariance +import OAI.Probability.InvariantIsing.Gaussian.GaussianSmoothing +import OAI.Probability.InvariantIsing.Pressure.VarianceLimit + +namespace OAI + +/-! Extending Gaussian Poincare from smooth to compact Lipschitz tests. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped NNReal Topology +namespace InvariantIsing + +def gaussianApproxBump (d n : ℕ) : ContDiffBump (0 : EuclideanSpace ℝ (Fin d)) where + rIn := (1/(n+1 : ℝ))/2 + rOut := 1/(n+1 : ℝ) + rIn_pos := by positivity + rIn_lt_rOut := by + have h : 0 < 1/(n+1 : ℝ) := by positivity + linarith + +lemma gaussianApproxBump_rOut_le (d n : ℕ) : (gaussianApproxBump d n).rOut ≤ 1 := by + change 1/(n+1 : ℝ) ≤ 1 + apply (div_le_one (by positivity)).mpr + linarith [Nat.cast_nonneg (α := ℝ) n] + +theorem gaussian_compact_variance_le {d : ℕ} {L : ℝ≥0} + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) + (hc : HasCompactSupport f) : + variance f (stdGaussian (EuclideanSpace ℝ (Fin d))) ≤ (L : ℝ)^2 := by + let F := fun n => gaussianSmooth (gaussianApproxBump d n) f + have hL n : LipschitzWith L (F n) := gaussianSmooth_lipschitz _ hf + have hv n : variance (F n) (stdGaussian (EuclideanSpace ℝ (Fin d))) ≤ (L : ℝ)^2 := + gaussian_test_variance_le (gaussianSmooth_test _ hf hc) (hL n) + have ht (x : EuclideanSpace ℝ (Fin d)) : Tendsto (fun n => F n x) atTop (𝓝 (f x)) := by + exact ContDiffBump.convolution_tendsto_right_of_continuous + (show Tendsto (fun n => (gaussianApproxBump d n).rOut) atTop (𝓝 0) from + tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) hf.continuous x + obtain ⟨B, hB⟩ := hc.exists_bound_of_continuous hf.continuous + have hbound n x : ‖F n x‖ ≤ B+(L : ℝ) := by + calc + _ ≤ ‖f x‖+dist (F n x) (f x) := by + simpa only [add_sub_cancel, dist_eq_norm] using norm_add_le (f x) (F n x-f x) + _ ≤ B+(L : ℝ)*(gaussianApproxBump d n).rOut := + add_le_add (hB x) (gaussianSmooth_dist_le _ hf x) + _ ≤ B+(L : ℝ) := by + nlinarith [mul_le_mul_of_nonneg_left (gaussianApproxBump_rOut_le d n) L.coe_nonneg] + have hm : Tendsto (fun n => ∫ x, F n x ∂stdGaussian _) atTop + (𝓝 (∫ x, f x ∂stdGaussian _)) := by + apply tendsto_integral_of_dominated_convergence (fun _ => B+(L : ℝ)) + (fun n => (hL n).continuous.aestronglyMeasurable) (integrable_const _) + · exact fun n => ae_of_all _ (hbound n) + · exact ae_of_all _ ht + exact variance_le_of_ae_tendsto_of_mean_tendsto + (fun n => gaussian_lipschitz_memLp_two (hL n)) (gaussian_lipschitz_memLp_two hf) + (ae_of_all _ ht) hm hv + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianComparisonSign.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianComparisonSign.lean new file mode 100644 index 0000000000000000000000000000000000000000..3209017314138ba4ae89ed3c5c73c3934d96c16f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianComparisonSign.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityGaussianCurveMean + +namespace OAI + +/-! Covariance order gives the finite Gaussian log-partition comparison. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {X : Type*} [Fintype X] + +lemma gaussian_gibbs_linear_mean_nonneg {d : ℕ} {w : X → ℝ} (hw : GibbsReference w) + (H : X → ℝ) (A C : X → Fin (d+1) → ℝ) + (hK : ∀ x y, gaussianCross A C x y ≤ gaussianCross A C x x) : + 0 ≤ ∫ g, ∑ x, gaussianGibbs w H C g x * linearGaussian A g x + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + have hi x : Integrable (fun g => gaussianGibbs w H C g x * linearGaussian A g x) + (Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) := by + simpa only [mul_comm] using integrable_linearGaussian_mul_gibbs hw H A C x x + rw [integral_finsetSum _ (fun x _ => hi x)] + apply Finset.sum_nonneg + intro x _ + have he := gaussian_gibbs_insertion hw H A C x + simp only [mul_comm (gaussianGibbs w H C _ x)] + rw [he] + apply integral_nonneg + intro g + apply mul_nonneg (finiteGibbs_nonneg hw _ x) + apply sub_nonneg.mpr + calc + _ ≤ ∑ y, gaussianGibbs w H C g y * gaussianCross A C x x := by + apply Finset.sum_le_sum + intro y _ + exact mul_le_mul_of_nonneg_left (hK x y) (finiteGibbs_nonneg hw _ y) + _ = gaussianCross A C x x := by + rw [← Finset.sum_mul] + change (∑ y, finiteGibbs w _ y) * _ = _ + rw [finiteGibbs_sum hw,one_mul] + +theorem finite_gaussian_log_comparison {d : ℕ} {w : X → ℝ} (hw : GibbsReference w) + (H : X → ℝ) (C A : X → Fin (d+1) → ℝ) + (hCA : ∀ x y, gaussianCross C A x y = 0) + (hdiag : ∀ x, gaussianCross A A x x = gaussianCross C C x x) + (hoff : ∀ x y, gaussianCross A A x y ≤ gaussianCross C C x y) : + (∫ g, Real.log (finitePartition w (fun x => H x+linearGaussian C g x)) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) ≤ + ∫ g, Real.log (finitePartition w (fun x => H x+linearGaussian A g x)) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + have hd (s : ℝ) := cavityGaussianCurveMean_hasDerivAt hw H (fun _ => 0) 0 C A s + have hs (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) (Real.pi/2)) : + 0 ≤ cavityGaussianCurveSlope w H (fun _ => 0) 0 C A s := by + have hsc : 0 ≤ Real.sin s * Real.cos s := mul_nonneg + (Real.sin_nonneg_of_nonneg_of_le_pi hs.1 (by linarith [hs.2,Real.pi_pos])) + (Real.cos_nonneg_of_mem_Icc ⟨by linarith [hs.1,Real.pi_pos],hs.2⟩) + have hcross : ∀ x y, + gaussianCross (cavityGaussianCurveDerivative C A s) (cavityGaussianCurve C A s) x y ≤ + gaussianCross (cavityGaussianCurveDerivative C A s) (cavityGaussianCurve C A s) x x := by + intro x y + rw [cavityGaussianCurve_cross C A s x y hCA,cavityGaussianCurve_cross C A s x x hCA, + hdiag x,sub_self,mul_zero] + exact mul_nonpos_of_nonneg_of_nonpos hsc (sub_nonpos.mpr (hoff x y)) + have h := gaussian_gibbs_linear_mean_nonneg hw H (cavityGaussianCurveDerivative C A s) + (cavityGaussianCurve C A s) hcross + have hp : cavityPenaltyCurve H (fun _ => 0) 0 s = H := by + funext x + simp only [cavityPenaltyCurve,mul_zero,zero_mul,sub_zero] + simpa only [cavityGaussianCurveSlope,hp,zero_mul,mul_zero,zero_add] using h + have hm : MonotoneOn (cavityGaussianCurveMean w H (fun _ => 0) 0 C A) + (Set.Icc (0 : ℝ) (Real.pi/2)) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc _ _) + (continuous_iff_continuousAt.mpr (fun s => (hd s).continuousAt)).continuousOn + (fun s _ => (hd s).hasDerivWithinAt) + intro s hs' + exact hs s (interior_subset hs') + have hp : (0 : ℝ) ≤ Real.pi/2 := by positivity + have he := hm ⟨le_rfl,hp⟩ ⟨hp,le_rfl⟩ hp + simpa only [cavityGaussianCurveMean,cavityPenaltyCurve,linearGaussian,cavityGaussianCurve, + Real.cos_zero,Real.sin_zero,Real.cos_pi_div_two,Real.sin_pi_div_two, + one_mul,zero_mul,mul_zero,sub_zero,zero_add,add_zero] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianConeCutoff.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianConeCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..e347bf73d4a28e31b5f3ed268baa7c5547320e86 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianConeCutoff.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianCompactVariance + +namespace OAI + +/-! Compact scalar cutoffs preserving the exact Lipschitz constant. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped NNReal Topology +namespace InvariantIsing + +def gaussianCone {d : ℕ} (L : ℝ≥0) (R : ℝ) (x : EuclideanSpace ℝ (Fin d)) : ℝ := + max ((L : ℝ)*(R-‖x‖)) 0 + +def gaussianConeCutoff {d : ℕ} (L : ℝ≥0) (R : ℝ) + (f : EuclideanSpace ℝ (Fin d) → ℝ) (x : EuclideanSpace ℝ (Fin d)) : ℝ := + max (-gaussianCone L R x) (min (f x) (gaussianCone L R x)) + +lemma gaussianCone_nonneg {d : ℕ} (L : ℝ≥0) (R : ℝ) + (x : EuclideanSpace ℝ (Fin d)) : 0 ≤ gaussianCone L R x := le_max_right _ _ + +lemma gaussianCone_lipschitz {d : ℕ} (L : ℝ≥0) (R : ℝ) : + LipschitzWith L (gaussianCone (d := d) L R) := by + have h : LipschitzWith L (fun x : EuclideanSpace ℝ (Fin d) => (L : ℝ)*(R-‖x‖)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq] + have he : (L : ℝ)*(R-‖x‖)-(L : ℝ)*(R-‖y‖) = (L : ℝ)*(‖y‖-‖x‖) := by ring + rw [he, abs_mul, abs_of_nonneg L.coe_nonneg] + apply mul_le_mul_of_nonneg_left _ L.coe_nonneg + simpa only [Real.dist_eq, NNReal.coe_one, one_mul, dist_comm y x] using + (lipschitzWith_one_norm (E := EuclideanSpace ℝ (Fin d))).dist_le_mul y x + exact h.max_const 0 + +lemma gaussianConeCutoff_lipschitz {d : ℕ} {L : ℝ≥0} {R : ℝ} + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) : + LipschitzWith L (gaussianConeCutoff L R f) := by + unfold gaussianConeCutoff + simpa only [Pi.neg_apply, max_self] using + (gaussianCone_lipschitz (d := d) L R).neg.max (hf.min (gaussianCone_lipschitz L R)) + +lemma gaussianConeCutoff_zero {d : ℕ} (L : ℝ≥0) (R : ℝ) + (f : EuclideanSpace ℝ (Fin d) → ℝ) (x : EuclideanSpace ℝ (Fin d)) + (hx : R ≤ ‖x‖) : gaussianConeCutoff L R f x = 0 := by + have hc : gaussianCone L R x = 0 := + max_eq_right (mul_nonpos_of_nonneg_of_nonpos L.coe_nonneg (sub_nonpos.mpr hx)) + simp only [gaussianConeCutoff, hc, neg_zero, max_eq_left (min_le_right _ _)] + +lemma gaussianConeCutoff_compact {d : ℕ} (L : ℝ≥0) (R : ℝ) + (f : EuclideanSpace ℝ (Fin d) → ℝ) : HasCompactSupport (gaussianConeCutoff L R f) := by + apply HasCompactSupport.of_support_subset_isCompact (isCompact_closedBall (0 : EuclideanSpace ℝ (Fin d)) R) + intro x hx + by_contra hn + have he : R ≤ ‖x‖ := le_of_lt (by simpa only [Metric.mem_closedBall, dist_zero_right, not_le] using hn) + exact hx (gaussianConeCutoff_zero L R f x he) + +lemma gaussianConeCutoff_norm_le {d : ℕ} (L : ℝ≥0) (R : ℝ) + (f : EuclideanSpace ℝ (Fin d) → ℝ) (x : EuclideanSpace ℝ (Fin d)) : + ‖gaussianConeCutoff L R f x‖ ≤ ‖f x‖ := by + have ha := gaussianCone_nonneg L R x + rw [Real.norm_eq_abs, Real.norm_eq_abs] + unfold gaussianConeCutoff + by_cases hf : 0 ≤ f x + · have hlo : 0 ≤ max (-gaussianCone L R x) (min (f x) (gaussianCone L R x)) := + (le_min hf ha).trans (le_max_right _ _) + rw [abs_of_nonneg hlo, abs_of_nonneg hf] + exact max_le (by linarith) (min_le_left _ _) + · have hf' : f x ≤ 0 := (lt_of_not_ge hf).le + rw [min_eq_left (hf'.trans ha), abs_of_nonpos (max_le (by linarith) hf'), abs_of_nonpos hf'] + exact neg_le_neg (le_max_right _ _) + +lemma gaussianConeCutoff_eq {d : ℕ} {L : ℝ≥0} {R : ℝ} + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) (h0 : f 0 = 0) + (x : EuclideanSpace ℝ (Fin d)) (hx : 2*‖x‖ ≤ R) : + gaussianConeCutoff L R f x = f x := by + have hb : |f x| ≤ (L : ℝ)*‖x‖ := by + simpa only [h0, dist_zero_right, Real.norm_eq_abs] using hf.dist_le_mul x 0 + have hh : (L : ℝ)*‖x‖ ≤ (L : ℝ)*(R-‖x‖) := + mul_le_mul_of_nonneg_left (by linarith) L.coe_nonneg + have ha : |f x| ≤ gaussianCone L R x := hb.trans (hh.trans (le_max_left _ _)) + unfold gaussianConeCutoff + rw [min_eq_left ((le_abs_self _).trans ha), max_eq_right] + linarith [neg_le_abs (f x)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCoordinateNorm.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCoordinateNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb71088703cade59a15287ff7887eca610a5c360 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianCoordinateNorm.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianSingularFluctuation + +namespace OAI + +/-! Exact second moments and the square-root dimension bound for coordinate Gaussian norms. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing +variable {ι κ : Type*} [Fintype ι] [Fintype κ] + +def gaussianCoordinateVector (e : κ → ι) (g : ι → ℝ) : EuclideanSpace ℝ κ := + WithLp.toLp 2 (fun j => g (e j)) + +lemma gaussianCoordinate_memLp (i : ι) : + MemLp (fun g : ι → ℝ => g i) 2 (Measure.pi (fun _ : ι => gaussianReal 0 1)) := by + exact (measurePreserving_eval (fun _ : ι => gaussianReal 0 1) i).hasLaw.memLp + (IsGaussian.memLp_id _ 2 (by norm_num)) + +lemma gaussianCoordinate_sq_integral (i : ι) : + (∫ g : ι → ℝ, (g i)^2 ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) = 1 := by + have he : (∫ g : ι → ℝ, (g i)^2 ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) = + ∫ x : ℝ, x^2 ∂gaussianReal 0 1 := by + simpa only [Function.comp_def,Function.eval] using + (measurePreserving_eval (fun _ : ι => gaussianReal 0 1) i).hasLaw.integral_comp + (f := fun x : ℝ => x^2) (by fun_prop) + rw [he] + have hv := variance_of_integral_eq_zero (μ := gaussianReal 0 1) + (X := id) (by fun_prop) (by simp) + simpa only [variance_id_gaussianReal,NNReal.coe_one,id_eq] using hv.symm + +lemma gaussianCoordinateVector_sq_integrable (e : κ → ι) : + Integrable (fun g => ‖gaussianCoordinateVector e g‖^2) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) := by + simpa only [gaussianCoordinateVector,EuclideanSpace.real_norm_sq_eq,PiLp.toLp_apply] + using integrable_finsetSum Finset.univ (fun j _ => (gaussianCoordinate_memLp (e j)).integrable_sq) + +lemma gaussianCoordinateVector_memLp (e : κ → ι) : + MemLp (gaussianCoordinateVector e) 2 (Measure.pi (fun _ : ι => gaussianReal 0 1)) := by + have hm : Continuous (gaussianCoordinateVector e) := by + unfold gaussianCoordinateVector + exact (PiLp.continuous_toLp 2 (fun _ : κ => ℝ)).comp + (continuous_pi (fun j => continuous_apply (e j))) + apply (memLp_two_iff_integrable_sq_norm hm.aestronglyMeasurable).mpr + exact gaussianCoordinateVector_sq_integrable e + +lemma gaussianCoordinateVector_sq_integral (e : κ → ι) : + (∫ g, ‖gaussianCoordinateVector e g‖^2 + ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) = Fintype.card κ := by + simp only [gaussianCoordinateVector,EuclideanSpace.real_norm_sq_eq] + rw [integral_finsetSum _ (fun j _ => (gaussianCoordinate_memLp (e j)).integrable_sq)] + simp only [gaussianCoordinate_sq_integral,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] + +lemma gaussianCoordinateVector_norm_integral_le (e : κ → ι) : + (∫ g, ‖gaussianCoordinateVector e g‖ + ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) ≤ Real.sqrt (Fintype.card κ) := by + have hvar := variance_nonneg (fun g => ‖gaussianCoordinateVector e g‖) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) + rw [variance_eq_sub (gaussianCoordinateVector_memLp e).norm] at hvar + change 0 ≤ (∫ g, ‖gaussianCoordinateVector e g‖^2 + ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) - _ at hvar + rw [gaussianCoordinateVector_sq_integral] at hvar + have hs : (Real.sqrt (Fintype.card κ))^2 = (Fintype.card κ : ℝ) := Real.sq_sqrt (by positivity) + have hp := Real.sqrt_nonneg (Fintype.card κ) + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianDiagonalQuadratic.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianDiagonalQuadratic.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c11a4551811803ba0b01fc391a05726ca8e184a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianDiagonalQuadratic.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianFourthMoment + +namespace OAI + +/-! Exact mean and variance of a diagonal Gaussian quadratic form. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing + +def gaussianDiagonalQuadratic {N : ℕ} (a : Fin N → ℝ) (g : Fin N → ℝ) : ℝ := ∑ i, a i*(g i)^2 + +lemma gaussianDiagonalQuadratic_memLp {N : ℕ} (a : Fin N → ℝ) : + MemLp (gaussianDiagonalQuadratic a) 2 (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := by + exact memLp_finsetSum Finset.univ (fun i _ => + (gaussianReal_square_memLp.comp_measurePreserving + (measurePreserving_eval (fun _ : Fin N => gaussianReal 0 1) i)).const_mul (a i)) + +lemma gaussianDiagonalQuadratic_integrable {N : ℕ} (a : Fin N → ℝ) : + Integrable (gaussianDiagonalQuadratic a) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := by + apply integrable_finsetSum + intro i _ + exact ((gaussianReal_square_memLp.comp_measurePreserving + (measurePreserving_eval (fun _ : Fin N => gaussianReal 0 1) i)).const_mul (a i)).integrable (by norm_num) + +lemma gaussianDiagonalQuadratic_mean {N : ℕ} (a : Fin N → ℝ) : + (∫ g, gaussianDiagonalQuadratic a g ∂Measure.pi (fun _ : Fin N => gaussianReal 0 1)) = ∑ i, a i := by + unfold gaussianDiagonalQuadratic + rw [integral_finsetSum] + · apply Finset.sum_congr rfl + intro i _ + rw [integral_const_mul] + have h := (measurePreserving_eval (fun _ : Fin N => gaussianReal 0 1) i).hasLaw.integral_comp + (f := fun x : ℝ => x^2) (by fun_prop) + simpa only [Function.comp_def,Function.eval,gaussianReal_second_moment,mul_one] using + congrArg (fun x : ℝ => a i*x) h + · intro i _ + exact ((gaussianReal_square_memLp.comp_measurePreserving + (measurePreserving_eval (fun _ : Fin N => gaussianReal 0 1) i)).const_mul (a i)).integrable (by norm_num) + +lemma gaussianDiagonalQuadratic_variance {N : ℕ} (a : Fin N → ℝ) : + variance (gaussianDiagonalQuadratic a) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) = + 2*∑ i, (a i)^2 := by + have h := variance_sum_pi (μ := fun _ : Fin N => gaussianReal 0 1) + (X := fun i x => a i*x^2) (fun i => gaussianReal_square_memLp.const_mul (a i)) + have he : (∑ i : Fin N, fun g : Fin N → ℝ => a i*(g i)^2) = gaussianDiagonalQuadratic a := by + funext g + simp only [Finset.sum_apply,gaussianDiagonalQuadratic] + rw [he] at h + rw [h,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [variance_const_mul,gaussianReal_square_variance] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianEmpiricalWeak.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianEmpiricalWeak.lean new file mode 100644 index 0000000000000000000000000000000000000000..23b7d1b45848247d4510a18997bf49c97a924079 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianEmpiricalWeak.lean @@ -0,0 +1,28 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianClippedWeak +import OAI.Probability.InvariantIsing.Spectral.EmpiricalClippingDistance + +namespace OAI + +/-! The original Gaussian Gram empirical measures converge to the literal MP law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace InvariantIsing + +theorem gaussianPattern_empirical_weak {α : ℝ} (hα : 0 < α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (gaussianPatternEigenvalues (Z (k+1) ω)))) atTop + (fun _ => LevyProkhorov.ofMeasure (⟨marchenkoPasturMeasure α,marchenkoPastur_probability hα⟩ : ProbabilityMeasure ℝ)) := by + apply tendstoInMeasure_of_dist_le P _ _ _ _ (gaussianPattern_clipped_weak hα P Z hZ) + (gaussianPattern_zero_upper_excess hα P Z hZ) + intro k ω + exact empirical_clipping_distance (Nat.succ_pos k) _ (sq_nonneg _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianExponentialShift.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianExponentialShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..d93b6e1d425894967f7594143ebdb8cf85aeb121 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianExponentialShift.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianTiltLinearGrowth + +namespace OAI + +/-! Completing the square under the finite scalar Gaussian law. This is +the shift identity used to control canonical increments uniformly in the +number and size of the cascade steps. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped NNReal + +namespace InvariantIsing + +lemma gaussianPDFReal_exp_linear {v : ℝ≥0} (hv : v ≠ 0) (t x : ℝ) : + gaussianPDFReal 0 v x * Real.exp (t * x) = + Real.exp (t ^ 2 * v / 2) * gaussianPDFReal (t * v) v x := by + have hvR : (v : ℝ) ≠ 0 := by exact_mod_cast hv + have he : -(x ^ 2) / (2 * v) + t * x = + t ^ 2 * v / 2 + -(x - t * v) ^ 2 / (2 * v) := by + field_simp + ring + simp only [gaussianPDFReal, sub_zero] + rw [mul_assoc, ← Real.exp_add, he, Real.exp_add] + ring + +theorem gaussian_exp_linear_shift (v : ℝ≥0) (t : ℝ) (F : ℝ → ℝ) (hF : Measurable F) : + (∫ x, Real.exp (t * x) * F x ∂gaussianReal 0 v) = + Real.exp (t ^ 2 * v / 2) * + ∫ x, F (x + t * v) ∂gaussianReal 0 v := by + by_cases hv : v = 0 + · subst v + simp + have hshift : (∫ x, F x ∂gaussianReal (t * v) v) = + ∫ x, F (x + t * v) ∂gaussianReal 0 v := by + have he := integral_map (μ := gaussianReal 0 v) + (f := F) (by fun_prop : AEMeasurable (fun x : ℝ => x + t * v) + (gaussianReal 0 v)) hF.aestronglyMeasurable + simpa only [gaussianReal_map_add_const, zero_add] using he + rw [← hshift, integral_gaussianReal_eq_integral_smul hv, + integral_gaussianReal_eq_integral_smul hv, ← integral_const_mul] + apply integral_congr_ae + apply ae_of_all + intro x + simp only [smul_eq_mul] + rw [← mul_assoc, gaussianPDFReal_exp_linear hv] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianFiniteColumnMinimum.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianFiniteColumnMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3a9eb11b2c745d50fd3a33c1d9a3a5f961ecd2b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianFiniteColumnMinimum.lean @@ -0,0 +1,113 @@ +import OAI.Probability.InvariantIsing.Gaussian.BilinearGaussianMinmaxMean +import OAI.Probability.InvariantIsing.Core.UnitInnerMaximum + +namespace OAI + +/-! Passing the row tests to the full unit sphere in Gordon's matrix comparison. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped BigOperators RealInnerProductSpace Topology +namespace InvariantIsing + +lemma continuous_gaussianPattern_apply {N m : ℕ} (v : EuclideanSpace ℝ (Fin m)) : + Continuous (fun z : EuclideanSpace ℝ (Fin N × Fin m) => gaussianPatternEuclideanOperator z v) := by + change Continuous (fun z : EuclideanSpace ℝ (Fin N × Fin m) => + WithLp.toLp 2 (fun i => ∑ j, z (i,j)*v j)) + exact (PiLp.continuous_toLp 2 (fun _ : Fin N => ℝ)).comp + (continuous_pi (fun i => by fun_prop)) + +theorem gaussian_finite_column_minimum {V : Type*} [Fintype V] [Nonempty V] + {N m : ℕ} (hN : 0 < N) (v : V → EuclideanSpace ℝ (Fin m)) (hv : ∀ b, ‖v b‖ = 1) : + (∫ z : EuclideanSpace ℝ (Fin N), ‖z‖ ∂stdGaussian _)-Real.sqrt m ≤ + ∫ z : EuclideanSpace ℝ (Fin N × Fin m), + Finset.univ.inf' Finset.univ_nonempty (fun b => ‖gaussianPatternEuclideanOperator z (v b)‖) + ∂stdGaussian _ := by + let : NeZero N := ⟨Nat.ne_of_gt hN⟩ + let : Nonempty (UnitVector (EuclideanSpace ℝ (Fin N))) := unitVector_nonempty _ + let S := UnitVector (EuclideanSpace ℝ (Fin N)) + let s : ℕ → S := TopologicalSpace.denseSeq S + have hs : DenseRange s := TopologicalSpace.denseRange_denseSeq S + let μ := Measure.pi (fun _ : Fin N => gaussianReal 0 1) + let ν := Measure.pi (fun _ : Fin N × Fin m => gaussianReal 0 1) + let Z (g : (Fin N × Fin m) → ℝ) : EuclideanSpace ℝ (Fin N × Fin m) := WithLp.toLp 2 g + let W (g : Fin N → ℝ) : EuclideanSpace ℝ (Fin N) := WithLp.toLp 2 g + let A (n : ℕ) (g : Fin N → ℝ) : ℝ := + indexedGaussianMaximum (fun i : Fin (n+1) => fun j => (s i).1 j) g + let C (n : ℕ) (g : (Fin N × Fin m) → ℝ) : ℝ := + finiteMinmax (fun x : Fin (n+1) × V => ∑ ij, ((s x.1).1 ij.1*v x.2 ij.2)*g ij) + let M (z : EuclideanSpace ℝ (Fin N × Fin m)) := + Finset.univ.inf' Finset.univ_nonempty (fun b => ‖gaussianPatternEuclideanOperator z (v b)‖) + have hAlim (g : Fin N → ℝ) : Tendsto (fun n => A n g) atTop (𝓝 ‖W g‖) := by + have he (n : ℕ) : A n g = prefixMaximum (fun i => ⟪(s i).1,W g⟫) n := by + unfold A indexedGaussianMaximum prefixMaximum + congr 1 + funext i + simp only [EuclideanSpace.inner_eq_star_dotProduct,dotProduct,star_trivial,W, + mul_comm] + simp_rw [he] + exact unitInner_prefix_tendsto s hs (W g) + have hClim (g : (Fin N × Fin m) → ℝ) : Tendsto (fun n => C n g) atTop (𝓝 (M (Z g))) := by + have he (n : ℕ) : C n g = Finset.univ.inf' Finset.univ_nonempty + (fun b => prefixMaximum (fun i => ⟪(s i).1,gaussianPatternEuclideanOperator (Z g) (v b)⟫) n) := by + unfold C finiteMinmax finiteRowMax prefixMaximum + congr 1 + funext b + congr 1 + funext i + exact (gaussianPattern_unitBilinear (Z g) (s i).1 (v b)).symm + simp_rw [he] + exact Tendsto.finset_inf'_nhds_apply Finset.univ_nonempty + (fun b _ => unitInner_prefix_tendsto s hs (gaussianPatternEuclideanOperator (Z g) (v b))) + have hAbound (n : ℕ) (g : Fin N → ℝ) : |A n g| ≤ ‖W g‖ := by + obtain ⟨i,_,he⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty + (fun i : Fin (n+1) => ∑ j, (s i).1 j*g j) + change |Finset.univ.sup' Finset.univ_nonempty _| ≤ _ + rw [he] + have h := abs_real_inner_le_norm (s i).1 (W g) + rw [(s i).2,one_mul] at h + simpa only [EuclideanSpace.inner_eq_star_dotProduct,dotProduct,star_trivial,W, + PiLp.toLp_apply,mul_comm] using h + have hCbound (n : ℕ) (g : (Fin N × Fin m) → ℝ) : |C n g| ≤ ‖Z g‖ := by + apply finiteMinmax_abs_le + intro x + rw [← gaussianPattern_unitBilinear (Z g) (s x.1).1 (v x.2)] + calc + _ ≤ ‖(s x.1).1‖*‖gaussianPatternEuclideanOperator (Z g) (v x.2)‖ := abs_real_inner_le_norm _ _ + _ = ‖gaussianPatternEuclideanOperator (Z g) (v x.2)‖ := by rw [(s x.1).2,one_mul] + _ ≤ ‖gaussianPatternEuclideanOperator (Z g)‖*‖v x.2‖ := + (gaussianPatternEuclideanOperator (Z g)).le_opNorm _ + _ ≤ ‖Z g‖ := by rw [hv,mul_one]; exact gaussianPatternEuclideanOperator_norm_le _ + have hAint := tendsto_integral_of_dominated_convergence (μ := μ) (fun g => ‖W g‖) + (fun n => (measurable_indexedGaussianMaximum _).aestronglyMeasurable) + (((gaussianCoordinateVector_memLp (id : Fin N → Fin N)).integrable (by norm_num)).norm) + (fun n => ae_of_all _ (fun g => by simpa only [Real.norm_eq_abs] using hAbound n g)) + (ae_of_all _ hAlim) + have hCint := tendsto_integral_of_dominated_convergence (μ := ν) (fun g => ‖Z g‖) + (fun n => (indexedGaussianMinmax_integrable _).aestronglyMeasurable) + (((gaussianCoordinateVector_memLp (id : (Fin N × Fin m) → (Fin N × Fin m))).integrable + (by norm_num)).norm) + (fun n => ae_of_all _ (fun g => by simpa only [Real.norm_eq_abs] using hCbound n g)) + (ae_of_all _ hClim) + have hbound (n : ℕ) : (∫ g, A n g ∂μ)-Real.sqrt m ≤ ∫ g, C n g ∂ν := + bilinear_gaussian_minmax_mean (fun i : Fin (n+1) => (s i).1) v (fun i => (s i).2) hv + have hh := le_of_tendsto_of_tendsto (hAint.sub_const (Real.sqrt m)) hCint + (Filter.Eventually.of_forall hbound) + have hW : HasLaw W (stdGaussian _) μ := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N => ℝ)).measurable.aemeasurable,map_pi_eq_stdGaussian⟩ + have hZ : HasLaw Z (stdGaussian _) ν := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N × Fin m => ℝ)).measurable.aemeasurable, + map_pi_eq_stdGaussian⟩ + have heW : (∫ g, ‖W g‖ ∂μ) = ∫ z : EuclideanSpace ℝ (Fin N), ‖z‖ ∂stdGaussian _ := by + simpa only [Function.comp_def] using hW.integral_comp (f := norm) (by fun_prop) + have heZ : (∫ g, M (Z g) ∂ν) = ∫ z, M z ∂stdGaussian _ := by + have hM : Continuous M := Continuous.finset_inf'_apply Finset.univ_nonempty + (fun b _ => (continuous_gaussianPattern_apply (v b)).norm) + simpa only [Function.comp_def] using hZ.integral_comp hM.aestronglyMeasurable + rw [heW,heZ] at hh + exact hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianFourthMoment.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianFourthMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1b09e451770cc5a66d648c1540d334d795f909e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianFourthMoment.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianCoordinateNorm +import OAI.Probability.IsingPerceptron.GaussianIntegration + +namespace OAI + +/-! Scalar Gaussian polynomial moments needed for the quadratic leave-one-column estimate. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +lemma gaussianReal_pow_integrable (p : ℕ) : + Integrable (fun x : ℝ => x^p) (gaussianReal 0 1) := by + have hi := (IsGaussian.memLp_id (gaussianReal 0 1) p (by simp)).integrable_norm_pow' + apply (integrable_norm_iff (by fun_prop)).mp + simpa only [id_eq,Real.norm_eq_abs,abs_pow] using hi + +lemma gaussianReal_second_moment : (∫ x : ℝ, x^2 ∂gaussianReal 0 1) = 1 := by + have h := variance_id_gaussianReal (μ := (0 : ℝ)) (v := (1 : ℝ≥0)) + rw [variance_eq_integral measurable_id.aemeasurable] at h + simpa only [id_eq,integral_id_gaussianReal,sub_zero,NNReal.coe_one] using h + +lemma gaussianReal_fourth_moment : (∫ x : ℝ, x^4 ∂gaussianReal 0 1) = 3 := by + have h := gaussian_integration_by_parts + (f := fun x : ℝ => x^3) (f' := fun x => 3*x^2) + (fun x => by simpa using hasDerivAt_pow 3 x) + (gaussianReal_pow_integrable 3) ((gaussianReal_pow_integrable 2).const_mul 3) + (by convert gaussianReal_pow_integrable 4 using 1; funext x; ring) + have he : (fun x : ℝ => x*x^3) = fun x => x^4 := by funext x; ring + rw [he,integral_const_mul,gaussianReal_second_moment,mul_one] at h + exact h + +lemma gaussianReal_square_memLp : MemLp (fun x : ℝ => x^2) 2 (gaussianReal 0 1) := by + apply (memLp_two_iff_integrable_sq (by fun_prop)).mpr + simpa only [← pow_mul] using gaussianReal_pow_integrable 4 + +lemma gaussianReal_square_variance : variance (fun x : ℝ => x^2) (gaussianReal 0 1) = 2 := by + rw [variance_eq_sub gaussianReal_square_memLp,gaussianReal_second_moment] + change (∫ x : ℝ, (x^2)^2 ∂gaussianReal 0 1)-1^2 = 2 + have hp : (fun x : ℝ => (x^2)^2) = fun x => x^4 := by funext x; ring + rw [hp,gaussianReal_fourth_moment] + norm_num + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGGBounds.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGGBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..42bbac721c003acf2a3cf88e1ef8e6656df1c94e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGGBounds.lean @@ -0,0 +1,186 @@ +import OAI.Probability.InvariantIsing.Arrays.PerturbationFeatures + +namespace OAI + +/-! Gaussian GG estimates retaining the spectral diagonal error. -/ + +noncomputable section + +open MeasureTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +variable {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + [Countable X] [MeasurableSingletonClass X] + {P : Measure Ω} [IsProbabilityMeasure P] {ν : Ω → Measure X} + [∀ ω, IsProbabilityMeasure (ν ω)] + +omit [Countable X] [MeasurableSingletonClass X] [IsProbabilityMeasure P] + [∀ ω, IsProbabilityMeasure (ν ω)] in +lemma randomReplicaAverage_const_mul (A : X → ℕ →₀ ℝ) (t c : ℝ) + {r : ℕ} (D : (Fin r → X) → ℝ) : + randomReplicaAverage P ν A t (fun σ => c * D σ) = + c * randomReplicaAverage P ν A t D := by + unfold randomReplicaAverage + simp_rw [referenceReplicaMean_const_mul] + exact integral_const_mul _ _ + +lemma randomReplicaAverage_add_bounded (hν : Measurable ν) + (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) + (t : ℝ) {r : ℕ} (D E : (Fin r → X) → ℝ) + {c d : ℝ} (hc : 0 ≤ c) (hd : 0 ≤ d) + (hD : ∀ σ, |D σ| ≤ c) (hE : ∀ σ, |E σ| ≤ d) : + randomReplicaAverage P ν A t (fun σ => D σ + E σ) = + randomReplicaAverage P ν A t D + randomReplicaAverage P ν A t E := by + unfold randomReplicaAverage + calc + _ = ∫ z : Ω × (ℕ → ℝ), + referenceReplicaMean (ν z.1) (fun x => t * cylinderField (A x) z.2) D + + referenceReplicaMean (ν z.1) (fun x => t * cylinderField (A x) z.2) E + ∂P.prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [random_cylinder_all_exp_ae (P := P) hν A hA] with z hz + exact referenceReplicaMean_add_bounded _ _ (hz t) D E hD hE + _ = _ := integral_add + (integrable_random_scaled_mean hν A t D hc hD) + (integrable_random_scaled_mean hν A t E hd hE) + +/-- Gaussian integration by parts without imposing a constant diagonal. -/ +theorem randomReplicaEnergy_full_identity (hν : Measurable ν) + (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) + (t : ℝ) {r : ℕ} (D : (Fin (r + 1) → X) → ℝ) + {c : ℝ} (hc : 0 ≤ c) (hD : ∀ σ, |D σ| ≤ c) : + randomReplicaEnergy P ν A t D = t * + (randomReplicaAverage P ν A t (fun σ => D σ * + (∑ i : Fin (r + 1), cylinderCross (A (σ 0)) (A (σ i)))) - + (r + 1 : ℕ) * randomReplicaAverage P ν A t + (fun τ : Fin (r + 1 + 1) → X => D (Fin.tail τ) * + cylinderCross (A ((Fin.tail τ) 0)) (A (τ 0)))) := by + have h := joint_countable_cylinder_insertion (P := P) hν + (fun x => t • A x) A + (fun x => by rw [cylinder_norm_smul]; exact mul_le_mul_of_nonneg_left (hA x) (sq_nonneg t)) + hA D hc hD + simp only [cylinderField_smul, cylinderCross_smul_right] at h + have heq : (fun σ : Fin (r + 1) → X => + D σ * (∑ i, t * cylinderCross (A (σ 0)) (A (σ i)))) = + (fun σ => t * (D σ * ∑ i, cylinderCross (A (σ 0)) (A (σ i)))) := by + funext σ + rw [← Finset.mul_sum] + ring + have hfresh : (fun τ : Fin (r + 1 + 1) → X => + D (Fin.tail τ) * (t * cylinderCross (A ((Fin.tail τ) 0)) (A (τ 0)))) = + (fun τ => t * (D (Fin.tail τ) * + cylinderCross (A ((Fin.tail τ) 0)) (A (τ 0)))) := by + funext τ + ring + rw [heq, hfresh] at h + simp_rw [referenceReplicaMean_const_mul] at h + rw [integral_const_mul, integral_const_mul] at h + change randomReplicaEnergy P ν A t D = _ at h + rw [h] + unfold randomReplicaAverage + ring + +/-- The finite GG error splits into an energy fluctuation and an explicit +covariance of the self-overlap. Spectral self-overlaps are not constant before +adding their separate deterministic perturbations. -/ +theorem countable_gaussian_gg_bound_variable_diagonal (hν : Measurable ν) + (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) + (t b : ℝ) {r : ℕ} (D : (Fin (r + 1) → X) → ℝ) + {c : ℝ} (hc : 0 ≤ c) (hD : ∀ σ, |D σ| ≤ c) + (hE : Integrable (fun z : Ω × (ℕ → ℝ) => ∫ x, + |cylinderField (A x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A x) z.2)) + (P.prod gaussianCoordinates)) : + |t| * |(r + 1 : ℕ) * randomReplicaAverage P ν A t + (fun τ : Fin (r + 1 + 1) → X => D (Fin.tail τ) * + cylinderCross (A ((Fin.tail τ) 0)) (A (τ 0))) - + randomReplicaAverage P ν A t D * randomReplicaAverage P ν A t + (fun τ : Fin 2 → X => cylinderCross (A (τ 1)) (A (τ 0))) - + randomReplicaAverage P ν A t + (fun σ => D σ * ∑ l : Fin r, cylinderCross (A (σ 0)) (A (σ l.succ)))| ≤ + 2 * c * (∫ z : Ω × (ℕ → ℝ), ∫ x, |cylinderField (A x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A x) z.2) + ∂P.prod gaussianCoordinates) + + |t| * |randomReplicaAverage P ν A t + (fun σ => D σ * cylinderCross (A (σ 0)) (A (σ 0))) - + randomReplicaAverage P ν A t D * randomReplicaAverage P ν A t + (fun σ : Fin 1 → X => cylinderCross (A (σ 0)) (A (σ 0)))| := by + let V := randomReplicaAverage P ν A t D + let U := randomReplicaEnergy P ν A t D + let M := randomReplicaEnergy P ν A t (fun _ : Fin 1 → X => 1) + let E := ∫ z : Ω × (ℕ → ℝ), ∫ x, |cylinderField (A x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A x) z.2) + ∂P.prod gaussianCoordinates + let L := randomReplicaAverage P ν A t + (fun σ => D σ * cylinderCross (A (σ 0)) (A (σ 0))) + let L₀ := randomReplicaAverage P ν A t + (fun σ : Fin 1 → X => cylinderCross (A (σ 0)) (A (σ 0))) + have hEn : 0 ≤ E := integral_nonneg (fun _ => integral_nonneg (fun _ => abs_nonneg _)) + have hU : |U - b * V| ≤ c * E := joint_cylinder_energy_covariance_bound hν A hA t b D hc hD hE + have hM : |M - b| ≤ E := by + have h := joint_cylinder_energy_covariance_bound hν A hA t b + (fun _ : Fin (0 + 1) → X => 1) (c := 1) (by norm_num) (fun _ => by norm_num) hE + change |M - b * randomReplicaAverage P ν A t (fun _ : Fin 1 → X => 1)| ≤ 1 * E at h + simpa only [randomReplicaAverage_const hν A hA, mul_one, one_mul] using h + have hV : |V| ≤ c := randomReplicaAverage_abs_le hν A t D hc hD + have hm : M = t * (L₀ - randomReplicaAverage P ν A t + (fun τ : Fin 2 → X => cylinderCross (A (τ 1)) (A (τ 0)))) := by + have h := randomReplicaEnergy_full_identity (P := P) (r := 0) hν A hA t + (fun _ : Fin (0 + 1) → X => 1) (c := 1) (by norm_num) (fun _ => by norm_num) + simpa only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero, one_mul, Fin.tail, + Fin.succ_zero_eq_one, Nat.cast_one, Nat.zero_add] using h + have hdiag (σ : Fin (r + 1) → X) : + |D σ * cylinderCross (A (σ 0)) (A (σ 0))| ≤ c * |B| := by + rw [abs_mul] + exact mul_le_mul (hD σ) (cylinderCross_bound A hA _ _) (abs_nonneg _) hc + have hoff (σ : Fin (r + 1) → X) : + |D σ * ∑ l : Fin r, cylinderCross (A (σ 0)) (A (σ l.succ))| ≤ c * (r * |B|) := by + rw [abs_mul] + apply mul_le_mul (hD σ) _ (abs_nonneg _) hc + calc + _ ≤ ∑ l : Fin r, |cylinderCross (A (σ 0)) (A (σ l.succ))| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _l : Fin r, |B| := Finset.sum_le_sum (fun _ _ => cylinderCross_bound A hA _ _) + _ = _ := by simp + have hu : U = t * (L + randomReplicaAverage P ν A t + (fun σ => D σ * ∑ l : Fin r, cylinderCross (A (σ 0)) (A (σ l.succ))) - + (r + 1 : ℕ) * randomReplicaAverage P ν A t + (fun τ : Fin (r + 1 + 1) → X => D (Fin.tail τ) * + cylinderCross (A ((Fin.tail τ) 0)) (A (τ 0)))) := by + have h := randomReplicaEnergy_full_identity (P := P) hν A hA t D hc hD + simp only [Fin.sum_univ_succ, mul_add] at h + rw [randomReplicaAverage_add_bounded hν A hA t _ _ + (mul_nonneg hc (abs_nonneg _)) (by positivity) hdiag hoff] at h + exact h + have hr : t * ((r + 1 : ℕ) * randomReplicaAverage P ν A t + (fun τ : Fin (r + 1 + 1) → X => D (Fin.tail τ) * + cylinderCross (A ((Fin.tail τ) 0)) (A (τ 0))) - + V * randomReplicaAverage P ν A t + (fun τ : Fin 2 → X => cylinderCross (A (τ 1)) (A (τ 0))) - + randomReplicaAverage P ν A t + (fun σ => D σ * ∑ l : Fin r, cylinderCross (A (σ 0)) (A (σ l.succ)))) = + M * V - U + t * (L - V * L₀) := by + rw [hm, hu] + ring + rw [← abs_mul] + change |t * _| ≤ 2 * c * E + |t| * |L - V * L₀| + rw [hr] + calc + _ ≤ |M * V - U| + |t * (L - V * L₀)| := abs_add_le _ _ + _ = |(M - b) * V - (U - b * V)| + |t| * |L - V * L₀| := by + rw [abs_mul] + congr 2 + ring + _ ≤ (|M - b| * |V| + |U - b * V|) + |t| * |L - V * L₀| := by + exact add_le_add (by + simpa only [abs_mul] using (abs_sub ((M - b) * V) (U - b * V))) le_rfl + _ ≤ (E * c + c * E) + |t| * |L - V * L₀| := + add_le_add (add_le_add (mul_le_mul hM hV (abs_nonneg _) hEn) hU) le_rfl + _ = _ := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramColumns.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramColumns.lean new file mode 100644 index 0000000000000000000000000000000000000000..57857a1042ddbee7b2f35989d458142c2323602e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramColumns.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolvent + +namespace OAI + +/-! Exact column decomposition and the positive leave-one-column Gram matrix. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +def gaussianGramRawColumn {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : Fin N → ℝ := + fun i => z (i,j) + +def gaussianGramLeaveOneOut {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : Matrix (Fin N) (Fin N) ℝ := + (1/(N : ℝ)) • ∑ l ∈ Finset.univ.erase j, vecMulVec (gaussianGramRawColumn z l) (gaussianGramRawColumn z l) + +lemma gaussianPatternCoupling_column_sum {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternCoupling 1 z = (1/(N : ℝ)) • + ∑ j : Fin m, vecMulVec (gaussianGramRawColumn z j) (gaussianGramRawColumn z j) := by + ext i k + simp only [gaussianPatternCoupling,Matrix.smul_apply,smul_eq_mul,Matrix.mul_apply, + Matrix.transpose_apply,gaussianPatternArray,Matrix.sum_apply,Matrix.vecMulVec_apply, + gaussianGramRawColumn] + +lemma gaussianGramLeaveOneOut_posSemidef {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : (gaussianGramLeaveOneOut z j).PosSemidef := by + apply Matrix.PosSemidef.smul _ (by positivity : (0 : ℝ) ≤ 1/N) + apply Matrix.posSemidef_sum + intro l _ + simpa only [star_trivial] using Matrix.posSemidef_vecMulVec_self_star (gaussianGramRawColumn z l) + +lemma gaussianGramLeaveOneOut_decomposition {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : gaussianPatternCoupling 1 z = gaussianGramLeaveOneOut z j+ + (1/(N : ℝ)) • vecMulVec (gaussianGramRawColumn z j) (gaussianGramRawColumn z j) := by + rw [gaussianPatternCoupling_column_sum,gaussianGramLeaveOneOut,← smul_add] + congr 1 + exact (Finset.sum_erase_add Finset.univ + (fun l => vecMulVec (gaussianGramRawColumn z l) (gaussianGramRawColumn z l)) + (Finset.mem_univ j)).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramEdges.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramEdges.lean new file mode 100644 index 0000000000000000000000000000000000000000..5bda6d259816e4cb0f04c63fb29b5d4202506a5f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramEdges.lean @@ -0,0 +1,93 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramExcessBound +import OAI.Probability.InvariantIsing.Gaussian.GaussianTransposeLowerEdge +import OAI.Probability.InvariantIsing.Gaussian.GaussianSingularUpperEdge +import OAI.Probability.InvariantIsing.Spectral.SpectralExcessScale +import OAI.Probability.InvariantIsing.Spectral.SpectralExcessContinuity + +namespace OAI + +/-! Both spectral edges of the physical Gaussian Gram matrix, with arbitrary real scaling. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma marchenkoPasturLower_positive_part {α : ℝ} (hα : 0 ≤ α) : + marchenkoPasturLower α = (max (Real.sqrt α-1) 0)^2 := by + have hs := Real.sq_sqrt hα + have hn := Real.sqrt_nonneg α + by_cases ha : α ≤ 1 + · have hh : Real.sqrt α-1 ≤ 0 := by nlinarith + simp only [marchenkoPasturLower,ite_eq_left ha,max_eq_right hh,zero_pow (by decide : 2 ≠ 0)] + · have hh : 0 ≤ Real.sqrt α-1 := by nlinarith + rw [marchenkoPasturLower,ite_eq_right ha,marchenkoPasturA,max_eq_left hh] + ring + +lemma positive_part_deficit (x b : ℝ) (hb : 0 ≤ b) : + max (max x 0-b) 0 = max (x-b) 0 := by + by_cases hx : 0 ≤ x + · rw [max_eq_left hx] + · have hx' : x ≤ 0 := le_of_not_ge hx + rw [max_eq_right hx',max_eq_right (by linarith : 0-b ≤ 0),max_eq_right (by linarith : x-b ≤ 0)] + +theorem gaussianPattern_spectralExcess_tendsto {α : ℝ} (hα : 0 < α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) (c : ℝ) : + TendstoInMeasure P (fun k ω => spectralExcess + (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i) + (min (c*marchenkoPasturLower α) (c*marchenkoPasturB α)) + (max (c*marchenkoPasturLower α) (c*marchenkoPasturB α))) atTop (fun _ => 0) := by + let L := max (Real.sqrt α-1) 0 + let U := 1+Real.sqrt α + let du (k : ℕ) (ω : Ω) := max (gaussianPatternSingularMax (Z (k+1) ω)/Real.sqrt (k+1)-U) 0 + let dl (k : ℕ) (ω : Ω) := max (Real.sqrt α-1- + gaussianPatternSingularMin (gaussianPatternTranspose (k+1) (gaussianPatternCount α (k+1)) + (Z (k+1) ω))/Real.sqrt (k+1)) 0 + let E (k : ℕ) (ω : Ω) := spectralExcess + (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i) + (min (c*marchenkoPasturLower α) (c*marchenkoPasturB α)) + (max (c*marchenkoPasturLower α) (c*marchenkoPasturB α)) + have hU : TendstoInMeasure P du atTop (fun _ => 0) := gaussianPatternSingularMax_upper_edge hα.le P Z hZ + have hL : TendstoInMeasure P dl atTop (fun _ => 0) := gaussianPatternTranspose_lower_edge hα P Z hZ + have hbound (k : ℕ) (ω : Ω) : E k ω ≤ |c| * ((U+du k ω)^2-U^2+2*L*dl k ω) := by + have hh := gaussianGram_spectralExcess_bound (Z (k+1) ω) L U (le_max_right _ _) + (by dsimp [U]; positivity) + have hb : 0 ≤ gaussianPatternSingularMin + (gaussianPatternTranspose (k+1) (gaussianPatternCount α (k+1)) (Z (k+1) ω))/Real.sqrt (k+1) := + div_nonneg (gaussianPatternSingularMin_nonneg (Nat.succ_pos k) _) (Real.sqrt_nonneg _) + rw [positive_part_deficit _ _ hb] at hh + have hlo : marchenkoPasturLower α = L^2 := marchenkoPasturLower_positive_part hα.le + have hup : marchenkoPasturB α = U^2 := rfl + have he := spectralExcess_scale_le (gaussianPatternEigenvalues (Z (k+1) ω)) (L^2) (U^2) c + dsimp only [E] + rw [hlo,hup] + exact he.trans (mul_le_mul_of_nonneg_left hh (abs_nonneg c)) + have hmeas (k : ℕ) : AEStronglyMeasurable (E k) P := by + have hh := continuous_spectralExcess + (fun z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))) => + fun i => c*gaussianPatternEigenvalues z i) + (fun i => continuous_const.mul ((continuous_apply i).comp (continuous_gaussianPatternEigenvalues _ _))) + (min (c*marchenkoPasturLower α) (c*marchenkoPasturB α)) + (max (c*marchenkoPasturLower α) (c*marchenkoPasturB α)) + exact (hh.measurable.aemeasurable.comp_aemeasurable (hZ (k+1)).aemeasurable).aestronglyMeasurable + apply (exists_seq_tendstoInMeasure_atTop_iff hmeas).mpr + intro ns hns + obtain ⟨u,hu,hua⟩ := (hU.comp hns.tendsto_atTop).exists_seq_tendsto_ae + obtain ⟨v,hv,hva⟩ := (hL.comp (hns.comp hu).tendsto_atTop).exists_seq_tendsto_ae + refine ⟨u ∘ v,hu.comp hv,?_⟩ + filter_upwards [hua,hva] with ω hωu hωv + have hau : Tendsto (fun k => du (ns (u (v k))) ω) atTop (𝓝 0) := hωu.comp hv.tendsto_atTop + have hav : Tendsto (fun k => dl (ns (u (v k))) ω) atTop (𝓝 0) := hωv + have ht := (((tendsto_const_nhds (x := U)).add hau).pow 2 |>.sub_const (U^2)).add + (hav.const_mul (2*L)) |>.const_mul |c| + have ht' : Tendsto (fun k => |c| *((U+du (ns (u (v k))) ω)^2-U^2+2*L*dl (ns (u (v k))) ω)) + atTop (𝓝 0) := by simpa only [add_zero,sub_self,mul_zero,zero_add] using ht + exact squeeze_zero (fun k => spectralExcess_nonneg _ _ _) + (fun k => hbound (ns (u (v k))) ω) ht' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramEmpiricalTransform.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramEmpiricalTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b77fef56624b539e6670ed7443600a2d9fd22ce --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramEmpiricalTransform.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventEigenbasis +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramTransformProbability + +namespace OAI + +/-! Identification of the physical matrix resolvent with the empirical spectral transform. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators +namespace InvariantIsing + +def positiveResolventTest (t x : ℝ) : ℝ := 1/(t+max x 0) + +lemma continuous_positiveResolventTest {t : ℝ} (ht : 0 < t) : + Continuous (positiveResolventTest t) := by + unfold positiveResolventTest + apply continuous_const.div (continuous_const.add (continuous_id.max continuous_const)) + intro x + exact ne_of_gt (add_pos_of_pos_of_nonneg ht (le_max_right x 0)) + +lemma positiveResolventTest_bound {t : ℝ} (ht : 0 < t) (x : ℝ) : + 0 ≤ positiveResolventTest t x ∧ positiveResolventTest t x ≤ 1/t := by + have hd : 0 < t+max x 0 := add_pos_of_pos_of_nonneg ht (le_max_right x 0) + exact ⟨(one_div_pos.mpr hd).le,one_div_le_one_div_of_le ht (le_add_of_nonneg_right (le_max_right x 0))⟩ + +theorem gaussianGramStieltjes_empirical_integral {N m : ℕ} (hN : 0 < N) + {t : ℝ} (ht : 0 < t) (z : EuclideanSpace ℝ (Fin N × Fin m)) : + (∫ x, positiveResolventTest t x ∂(empiricalSpectralLaw hN (gaussianPatternEigenvalues z) : Measure ℝ)) = + gaussianGramStieltjes t z := by + rw [empiricalSpectralLaw_integral] + have hB := gaussianPatternCoupling_posSemidef z + have hs (i : Fin N) : positiveResolventTest t (gaussianPatternEigenvalues z i) = + (t+hB.isHermitian.eigenvalues i)⁻¹ := by + have hp : 0 ≤ gaussianPatternEigenvalues z i := by + unfold gaussianPatternEigenvalues + exact hB.eigenvalues_nonneg i + unfold positiveResolventTest + rw [max_eq_left hp] + simp only [one_div,gaussianPatternEigenvalues] + simp_rw [hs] + rw [← positiveResolvent_trace_eigenvalues ht hB] + change (1/(N : ℝ))*(gaussianGramResolvent t z).trace = (gaussianGramResolvent t z).trace/N + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramExcessBound.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramExcessBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e15d3bce4155b82e0b681d66e3ad1f8e3419988 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramExcessBound.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramLowerBound +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramNormBound + +namespace OAI + +/-! Deterministic transport of the two singular-value edge errors to Gram spectral excess. -/ +noncomputable section +open scoped Topology +namespace InvariantIsing + +lemma gaussianGram_singular_bounds {n m : ℕ} + (z : EuclideanSpace ℝ (Fin (n+1) × Fin m)) (i : Fin (n+1)) : + (gaussianPatternSingularMin (gaussianPatternTranspose (n+1) m z)/Real.sqrt (n+1))^2 ≤ + gaussianPatternEigenvalues z i ∧ + gaussianPatternEigenvalues z i ≤ (gaussianPatternSingularMax z/Real.sqrt (n+1))^2 := by + have hs : (Real.sqrt (n+1))^2 = (n+1 : ℝ) := Real.sq_sqrt (by positivity) + constructor + · simpa only [div_pow,hs,Nat.cast_succ,Nat.cast_add,Nat.cast_one] using + gaussianPatternEigenvalues_lower_singular (Nat.succ_pos n) z i + · have h := (le_abs_self (gaussianPatternEigenvalues z i)).trans + (gaussianPatternEigenvalues_abs_le (Nat.succ_pos n) z i) + simpa only [div_pow,hs,Nat.cast_succ,Nat.cast_add,Nat.cast_one] using h + +lemma squared_lower_edge_bound (L b : ℝ) (hL : 0 ≤ L) (hb : 0 ≤ b) : + L^2-2*L*max (L-b) 0 ≤ b^2 := by + by_cases h : L ≤ b + · rw [max_eq_right (sub_nonpos.mpr h)] + nlinarith + · rw [max_eq_left (by linarith : 0 ≤ L-b)] + nlinarith [sq_nonneg (L-b)] + +lemma gaussianGram_spectralExcess_bound {n m : ℕ} + (z : EuclideanSpace ℝ (Fin (n+1) × Fin m)) (L U : ℝ) (hL : 0 ≤ L) (hU : 0 ≤ U) : + spectralExcess (gaussianPatternEigenvalues z) (L^2) (U^2) ≤ + (U+max (gaussianPatternSingularMax z/Real.sqrt (n+1)-U) 0)^2-U^2 + + 2*L*max (L-gaussianPatternSingularMin (gaussianPatternTranspose (n+1) m z)/Real.sqrt (n+1)) 0 := by + let a := gaussianPatternSingularMax z/Real.sqrt (n+1) + let b := gaussianPatternSingularMin (gaussianPatternTranspose (n+1) m z)/Real.sqrt (n+1) + let du := max (a-U) 0 + let dl := max (L-b) 0 + have ha : 0 ≤ a := div_nonneg (norm_nonneg _) (Real.sqrt_nonneg _) + have hb : 0 ≤ b := div_nonneg (gaussianPatternSingularMin_nonneg (Nat.succ_pos n) _) + (Real.sqrt_nonneg _) + have hdu : 0 ≤ du := le_max_right _ _ + have hdl : 0 ≤ dl := le_max_right _ _ + have hu : 0 ≤ (U+du)^2-U^2 := by nlinarith + have hl : 0 ≤ 2*L*dl := by positivity + apply spectralExcess_le _ _ _ _ (add_nonneg hu hl) + intro i + have hbounds := gaussianGram_singular_bounds z i + change b^2 ≤ gaussianPatternEigenvalues z i ∧ gaussianPatternEigenvalues z i ≤ a^2 at hbounds + have hblo := squared_lower_edge_bound L b hL hb + have hau : a ≤ U+du := by dsimp only [du]; linarith [le_max_left (a-U) 0] + constructor + · change L^2-2*L*dl ≤ b^2 at hblo + linarith [hbounds.1] + · nlinarith [hbounds.2] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramLowerBound.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..b631fcd486cc751e4419341a479016fcab218707 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramLowerBound.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianTranspose + +namespace OAI + +/-! The actual Gram eigenvalues dominate the squared transposed least singular value. -/ +noncomputable section +open Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +lemma gaussianPattern_quadratic {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (x : EuclideanSpace ℝ (Fin N)) : + ⟪x,(gaussianPatternCoupling 1 z).toEuclideanLin x⟫ = + ‖gaussianPatternEuclideanOperator (gaussianPatternTranspose N m z) x‖^2/N := by + have hn : ‖gaussianPatternEuclideanOperator (gaussianPatternTranspose N m z) x‖^2 = + ((gaussianPatternArray z)ᵀ *ᵥ x.ofLp) ⬝ᵥ ((gaussianPatternArray z)ᵀ *ᵥ x.ofLp) := by + rw [EuclideanSpace.real_norm_sq_eq] + simp only [dotProduct,pow_two] + rfl + rw [hn] + rw [EuclideanSpace.inner_eq_star_dotProduct,dotProduct_comm] + simp only [star_trivial] + change x.ofLp ⬝ᵥ ((1/(N : ℝ)) • (gaussianPatternArray z*(gaussianPatternArray z)ᵀ)) *ᵥ x.ofLp = _ + rw [Matrix.smul_mulVec,dotProduct_smul,← Matrix.mulVec_mulVec,Matrix.dotProduct_transpose_mulVec] + simp only [smul_eq_mul] + ring + +lemma gaussianPatternSingularMin_nonneg {N m : ℕ} (hm : 0 < m) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : 0 ≤ gaussianPatternSingularMin z := by + let : NeZero m := ⟨Nat.ne_of_gt hm⟩ + have : Nonempty (Metric.sphere (0 : EuclideanSpace ℝ (Fin m)) 1) := by + refine ⟨⟨EuclideanSpace.single (⟨0,hm⟩ : Fin m) (1 : ℝ),?_⟩⟩ + simp + exact le_ciInf (fun _ => norm_nonneg _) + +lemma gaussianPatternEigenvalues_lower_singular {N m : ℕ} (hN : 0 < N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (i : Fin N) : + (gaussianPatternSingularMin (gaussianPatternTranspose N m z))^2/N ≤ + gaussianPatternEigenvalues z i := by + let hA := gaussianPatternCoupling_isHermitian 1 z + let u := hA.eigenvectorBasis i + have hu : ‖u‖ = 1 := hA.eigenvectorBasis.orthonormal.1 i + have hb : BddBelow (Set.range (fun x : Metric.sphere (0 : EuclideanSpace ℝ (Fin N)) 1 => + ‖gaussianPatternEuclideanOperator (gaussianPatternTranspose N m z) x‖)) := + ⟨0,by rintro _ ⟨x,rfl⟩; exact norm_nonneg _⟩ + have hl : gaussianPatternSingularMin (gaussianPatternTranspose N m z) ≤ + ‖gaussianPatternEuclideanOperator (gaussianPatternTranspose N m z) u‖ := + ciInf_le hb ⟨u,by simpa only [Metric.mem_sphere,dist_zero_right] using hu⟩ + have hs := sq_le_sq₀ (gaussianPatternSingularMin_nonneg hN _) (norm_nonneg _) |>.2 hl + have he : gaussianPatternEigenvalues z i = ⟪u,(gaussianPatternCoupling 1 z).toEuclideanLin u⟫ := by + unfold gaussianPatternEigenvalues + change hA.eigenvalues i = _ + rw [hA.eigenvalues_eq i,EuclideanSpace.inner_eq_star_dotProduct] + simp only [star_trivial,RCLike.re_to_real] + exact dotProduct_comm _ _ + rw [he,gaussianPattern_quadratic] + exact div_le_div_of_nonneg_right hs (Nat.cast_nonneg N) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramNormBound.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramNormBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..d505c7cbb097e8fddfc2d3308c729e8c246bb657 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramNormBound.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianNormMoments +import OAI.Probability.InvariantIsing.Spectral.HermitianEigenvalueRoots +import OAI.Probability.InvariantIsing.Pressure.RandomSpectralMeasurability + +namespace OAI + +/-! The actual Gram eigenvalues are bounded by the squared rectangular operator norm. -/ +noncomputable section +open Matrix +open scoped Matrix.Norms.L2Operator +namespace InvariantIsing + +lemma gaussianPatternCoupling_norm_le {N m : ℕ} (hN : 0 < N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ‖gaussianPatternCoupling 1 z‖ ≤ (gaussianPatternSingularMax z)^2/N := by + have hN' : (0 : ℝ) < N := by exact_mod_cast hN + have ht : ‖(gaussianPatternArray z)ᵀ‖ = ‖gaussianPatternArray z‖ := by + simpa only [Matrix.conjTranspose_eq_transpose_of_trivial] using + Matrix.l2_opNorm_conjTranspose (gaussianPatternArray z) + have he : ‖gaussianPatternArray z‖ = gaussianPatternSingularMax z := rfl + calc + _ = |1/(N : ℝ)| * ‖gaussianPatternArray z*(gaussianPatternArray z)ᵀ‖ := by + rw [gaussianPatternCoupling,norm_smul,Real.norm_eq_abs] + _ ≤ (1/(N : ℝ))*(‖gaussianPatternArray z‖*‖gaussianPatternArray z‖) := by + rw [abs_of_pos (one_div_pos.mpr hN')] + exact mul_le_mul_of_nonneg_left ((Matrix.l2_opNorm_mul _ _).trans_eq (by rw [ht])) + (by positivity) + _ = _ := by rw [he]; ring + +lemma gaussianPatternEigenvalues_abs_le {N m : ℕ} (hN : 0 < N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (i : Fin N) : + |gaussianPatternEigenvalues z i| ≤ (gaussianPatternSingularMax z)^2/N := by + apply le_trans _ (gaussianPatternCoupling_norm_le hN z) + unfold gaussianPatternEigenvalues Matrix.IsHermitian.eigenvalues + exact hermitian_eigenvalues₀_norm_le _ _ _ + +lemma gaussianPattern_spectralRadius_le {n m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin (n+1) × Fin m)) : + spectralRadius (fun i => c*gaussianPatternEigenvalues z i) ≤ + |c| * (gaussianPatternSingularMax z)^2/(n+1) := by + apply (spectralRadius_le_iff _ _).mpr + intro i + rw [abs_mul,mul_div_assoc] + simpa only [Nat.cast_succ,Nat.cast_add,Nat.cast_one] using + mul_le_mul_of_nonneg_left (gaussianPatternEigenvalues_abs_le (Nat.succ_pos n) z i) (abs_nonneg c) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramQuadraticError.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramQuadraticError.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a2c078e0bdfe5c62889af866ad7b738b880a694 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramQuadraticError.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianColumnDeviation +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramTraceGap +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolventBounds + +namespace OAI + +/-! Replacing a leave-one-column quadratic form by the full normalized trace. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +lemma gaussianGramColumnQuadratic_error {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : + |gaussianGramColumnQuadratic t z j-gaussianGramStieltjes t z| ≤ + gaussianGramColumnDeviation t z j+1/((N : ℝ)*t) := by + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hg := gaussianGramLeaveResolvent_trace_gap ht z j + have he : (gaussianGramLeaveResolvent t z j).trace/N-gaussianGramStieltjes t z = + ((gaussianGramLeaveResolvent t z j).trace-(gaussianGramResolvent t z).trace)/N := by + unfold gaussianGramStieltjes + ring + have hd : |(gaussianGramLeaveResolvent t z j).trace/N-gaussianGramStieltjes t z| ≤ + 1/((N : ℝ)*t) := by + rw [he,abs_of_nonneg (div_nonneg hg.1 hn.le)] + calc + _ ≤ (1/t)/N := div_le_div_of_nonneg_right hg.2 hn.le + _ = _ := by ring + exact (abs_sub_le (gaussianGramColumnQuadratic t z j) + ((gaussianGramLeaveResolvent t z j).trace/N) (gaussianGramStieltjes t z)).trans + (add_le_add le_rfl hd) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualBound.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f897c390c56866ec02bb0d77af9fe857782030a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualBound.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramQuadraticError +import OAI.Probability.InvariantIsing.Gaussian.MarchenkoPasturTransform + +namespace OAI + +/-! A pathwise residual bound for the finite Gaussian Gram transform equation. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +theorem gaussianGramResidual_bound {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + |marchenkoPasturResidual t ((m : ℝ)/N) (gaussianGramStieltjes t z)| ≤ + (1/(N : ℝ))*∑ j : Fin m, (gaussianGramColumnDeviation t z j+1/((N : ℝ)*t)) := by + let u := gaussianGramStieltjes t z + let q := fun j : Fin m => gaussianGramColumnQuadratic t z j + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hu : 0 ≤ u := gaussianGramStieltjes_nonneg ht z + have hq : ∀ j, 0 ≤ q j := gaussianGramColumnQuadratic_nonneg ht z + have he := gaussianGramStieltjes_column_equation hN ht z + have hsum : marchenkoPasturResidual t ((m : ℝ)/N) u = + (1/(N : ℝ))*∑ j : Fin m, (q j/(1+q j)-u/(1+u)) := by + unfold marchenkoPasturResidual + rw [Finset.sum_sub_distrib,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] + change 1-t*u = (1/(N : ℝ))*∑ j, q j/(1+q j) at he + rw [he] + ring + rw [hsum,abs_mul,abs_of_pos (one_div_pos.mpr hn)] + apply mul_le_mul_of_nonneg_left _ (one_div_pos.mpr hn).le + calc + _ ≤ ∑ j, |q j/(1+q j)-u/(1+u)| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ j, |q j-u| := Finset.sum_le_sum (fun j _ => nonnegative_fraction_lipschitz (hq j) hu) + _ ≤ _ := Finset.sum_le_sum (fun j _ => gaussianGramColumnQuadratic_error hN ht z j) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..52a5713e7b53b470c8a05611feeaea3f11632091 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualIntegrability.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResidualBound + +namespace OAI + +/-! Boundedness and integrability of the finite transform-equation residual. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma continuous_gaussianGramResidual {N m : ℕ} {t : ℝ} (ht : 0 < t) (α : ℝ) : + Continuous (fun z : EuclideanSpace ℝ (Fin N × Fin m) => + marchenkoPasturResidual t α (gaussianGramStieltjes t z)) := by + have hu := continuous_gaussianGramStieltjes (N := N) (m := m) ht + apply (continuous_const.sub (continuous_const.mul hu)).sub + apply continuous_const.mul + exact hu.div (continuous_const.add hu) (fun z => ne_of_gt (by + have h := gaussianGramStieltjes_nonneg ht z + linarith)) + +lemma gaussianGramResidual_abs_le {N m : ℕ} {t α : ℝ} (ht : 0 < t) (hα : 0 ≤ α) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + |marchenkoPasturResidual t α (gaussianGramStieltjes t z)| ≤ 1+α := by + let u := gaussianGramStieltjes t z + have hu : 0 ≤ u := gaussianGramStieltjes_nonneg ht z + have hu1 : t*u ≤ 1 := by + have h := (le_div_iff₀ ht).mp (gaussianGramStieltjes_le ht z) + nlinarith + have hf : 0 ≤ u/(1+u) := div_nonneg hu (by linarith) + have hf1 : u/(1+u) ≤ 1 := (div_le_one (by linarith)).mpr (by linarith) + change |1-t*u-α*(u/(1+u))| ≤ 1+α + rw [abs_le] + constructor + · nlinarith [mul_le_mul_of_nonneg_left hf1 hα] + · nlinarith [mul_nonneg ht.le hu,mul_nonneg hα hf] + +lemma gaussianGramResidual_abs_integrable {N m : ℕ} {t α : ℝ} (ht : 0 < t) (hα : 0 ≤ α) : + Integrable (fun z : EuclideanSpace ℝ (Fin N × Fin m) => + |marchenkoPasturResidual t α (gaussianGramStieltjes t z)|) (stdGaussian _) := by + apply (integrable_const (1+α)).mono' + (continuous_gaussianGramResidual ht α).abs.aestronglyMeasurable + exact ae_of_all _ (fun z => by + rw [Real.norm_eq_abs,abs_abs] + exact gaussianGramResidual_abs_le ht hα z) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e7417af3b8487f7a279612eea6815a242c401d9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResidualMean.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianColumnDeviationMean +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResidualIntegrability + +namespace OAI + +/-! An explicit mean error bound for the actual Gaussian Gram transform equation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing + +lemma gaussianGramColumnDeviation_mean_le_all {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (j : Fin m) : + (∫ g : Fin m → Fin N → ℝ, gaussianGramColumnDeviation t (gaussianColumnArray g) j + ∂Measure.pi (fun _ : Fin m => Measure.pi (fun _ : Fin N => gaussianReal 0 1))) ≤ + Real.sqrt (2/((N : ℝ)*t^2)) := by + cases m with + | zero => exact Fin.elim0 j + | succ m => exact gaussianGramColumnDeviation_mean_le hN ht j + +theorem gaussianGramResidual_mean_le {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) : + (∫ z : EuclideanSpace ℝ (Fin N × Fin m), + |marchenkoPasturResidual t ((m : ℝ)/N) (gaussianGramStieltjes t z)| ∂stdGaussian _) ≤ + ((m : ℝ)/N)*(Real.sqrt (2/((N : ℝ)*t^2))+1/((N : ℝ)*t)) := by + let μ := Measure.pi (fun _ : Fin m => Measure.pi (fun _ : Fin N => gaussianReal 0 1)) + have hi (j : Fin m) : Integrable (fun g : Fin m → Fin N → ℝ => + gaussianGramColumnDeviation t (gaussianColumnArray g) j+1/((N : ℝ)*t)) μ := + (gaussianGramColumnDeviation_integrable hN ht j).add (integrable_const _) + have hf := (gaussianColumnArray_hasLaw N m).integrable_comp + (gaussianGramResidual_abs_integrable ht (show 0 ≤ (m : ℝ)/N by positivity)) + have hμ : IsProbabilityMeasure μ := inferInstance + rw [← (gaussianColumnArray_hasLaw N m).integral_comp + (continuous_gaussianGramResidual ht ((m : ℝ)/N)).abs.aestronglyMeasurable] + calc + _ ≤ ∫ g, (1/(N : ℝ))*∑ j : Fin m, + (gaussianGramColumnDeviation t (gaussianColumnArray g) j+1/((N : ℝ)*t)) ∂μ := by + apply integral_mono hf ((integrable_finsetSum Finset.univ (fun j _ => hi j)).const_mul _) + intro g + exact gaussianGramResidual_bound hN ht (gaussianColumnArray g) + _ = (1/(N : ℝ))*∑ j : Fin m, ∫ g, + (gaussianGramColumnDeviation t (gaussianColumnArray g) j+1/((N : ℝ)*t)) ∂μ := by + rw [integral_const_mul,integral_finsetSum _ (fun j _ => hi j)] + _ ≤ (1/(N : ℝ))*∑ _ : Fin m, (Real.sqrt (2/((N : ℝ)*t^2))+1/((N : ℝ)*t)) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply Finset.sum_le_sum + intro j _ + rw [integral_add (gaussianGramColumnDeviation_integrable hN ht j) (integrable_const _)] + simp only [integral_const,probReal_univ,smul_eq_mul,one_mul] + exact add_le_add (gaussianGramColumnDeviation_mean_le_all hN ht j) le_rfl + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul]; ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolvent.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..cff8b182f283412e4cbf86f828514dc40f61dd00 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolvent.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternModel +import Mathlib.LinearAlgebra.Matrix.PosDef + +namespace OAI + +/-! The positive real resolvent of the physical Gaussian Gram matrix. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +def gaussianGramResolvent {N m : ℕ} (t : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : Matrix (Fin N) (Fin N) ℝ := + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianPatternCoupling 1 z)⁻¹ + +def gaussianGramStieltjes {N m : ℕ} (t : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := (gaussianGramResolvent t z).trace/N + +lemma gaussianPatternCoupling_posSemidef {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + (gaussianPatternCoupling 1 z).PosSemidef := by + have h := Matrix.posSemidef_self_mul_conjTranspose (gaussianPatternArray z) + simpa only [gaussianPatternCoupling,Matrix.conjTranspose_eq_transpose_of_trivial] using + h.smul (show 0 ≤ (1 : ℝ)/N by positivity) + +lemma gaussianGramShift_posDef {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianPatternCoupling 1 z).PosDef := + ((Matrix.PosDef.one).smul ht).add_posSemidef (gaussianPatternCoupling_posSemidef z) + +lemma gaussianGramResolvent_posDef {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : (gaussianGramResolvent t z).PosDef := + (gaussianGramShift_posDef ht z).inv + +lemma gaussianGramResolvent_identity {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + t • gaussianGramResolvent t z+gaussianPatternCoupling 1 z*gaussianGramResolvent t z = 1 := by + have hd := (gaussianGramShift_posDef ht z).det_pos + have h := Matrix.mul_nonsing_inv (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianPatternCoupling 1 z) + (isUnit_iff_ne_zero.mpr hd.ne') + simpa only [gaussianGramResolvent,add_mul,smul_mul_assoc,one_mul] using h + +lemma gaussianGramResolvent_trace_identity {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + t*(gaussianGramResolvent t z).trace+ + (gaussianPatternCoupling 1 z*gaussianGramResolvent t z).trace = N := by + have h := congrArg Matrix.trace (gaussianGramResolvent_identity ht z) + simpa only [Matrix.trace_add,Matrix.trace_smul,smul_eq_mul,Matrix.trace_one,Fintype.card_fin] using h + +lemma gaussianGramStieltjes_nonneg {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : 0 ≤ gaussianGramStieltjes t z := + div_nonneg (gaussianGramResolvent_posDef ht z).posSemidef.trace_nonneg (Nat.cast_nonneg N) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolventBounds.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolventBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..838553986bc3b3fc791f52d9a80399f2c5979080 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolventBounds.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolvent +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternEigenvalueMeasurability + +namespace OAI + +/-! Uniform bounds and measurability for the physical positive resolvent. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +lemma gaussianGramResolvent_mixed_trace_nonneg {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + 0 ≤ (gaussianPatternCoupling 1 z*gaussianGramResolvent t z).trace := by + have hp := ((gaussianGramResolvent_posDef ht z).posSemidef.conjTranspose_mul_mul_same + (gaussianPatternArray z)).trace_nonneg + rw [gaussianPatternCoupling,smul_mul_assoc,Matrix.trace_smul,smul_eq_mul] + apply mul_nonneg (by positivity) + rw [Matrix.trace_mul_cycle,Matrix.trace_mul_cycle] + simpa only [Matrix.conjTranspose_eq_transpose_of_trivial] using hp + +lemma gaussianGramStieltjes_le {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : gaussianGramStieltjes t z ≤ 1/t := by + by_cases hN : N = 0 + · subst N + simp only [gaussianGramStieltjes,Nat.cast_zero,div_zero] + exact (one_div_pos.mpr ht).le + have hN' : (0 : ℝ) < N := by exact_mod_cast Nat.pos_of_ne_zero hN + have hi := gaussianGramResolvent_trace_identity ht z + have hp := gaussianGramResolvent_mixed_trace_nonneg ht z + apply (div_le_iff₀ hN').mpr + calc + _ ≤ (N : ℝ)/t := (le_div_iff₀ ht).mpr (by nlinarith) + _ = 1/t*N := by ring + +lemma continuous_gaussianGramResolvent {N m : ℕ} {t : ℝ} (ht : 0 < t) : + Continuous (gaussianGramResolvent (N := N) (m := m) t) := by + apply continuous_iff_continuousAt.mpr + intro z + have hdet := (gaussianGramShift_posDef ht z).det_pos + have hi := continuousAt_matrix_inv + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianPatternCoupling 1 z) + (show ContinuousAt Ring.inverse _ from by + simpa only [Ring.inverse_eq_inv'] using continuousAt_inv₀ hdet.ne') + change ContinuousAt (fun w : EuclideanSpace ℝ (Fin N × Fin m) => + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianPatternCoupling 1 w)⁻¹) z + exact hi.comp (f := fun w : EuclideanSpace ℝ (Fin N × Fin m) => + t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianPatternCoupling 1 w) + ((continuous_const.add (continuous_gaussianPatternCoupling N m 1)).continuousAt) + +lemma continuous_gaussianGramStieltjes {N m : ℕ} {t : ℝ} (ht : 0 < t) : + Continuous (gaussianGramStieltjes (N := N) (m := m) t) := by + exact (continuous_gaussianGramResolvent ht).matrix_trace.div_const _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolventEquation.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolventEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b384f20ea51fb8a656804fb1d88bed4c4fc0a5ce --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramResolventEquation.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianLeaveOneColumn + +namespace OAI + +/-! The exact finite-dimensional leave-one-column equation for the physical Gram transform. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +def gaussianGramColumnQuadratic {N m : ℕ} (t : ℝ) (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : ℝ := + gaussianPatternScaledColumn z j ⬝ᵥ + (gaussianGramLeaveResolvent t z j *ᵥ gaussianPatternScaledColumn z j) + +lemma gaussianPatternCoupling_scaled_column_sum {N m : ℕ} + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternCoupling 1 z = ∑ j : Fin m, + vecMulVec (gaussianPatternScaledColumn z j) (gaussianPatternScaledColumn z j) := by + simp_rw [gaussianPatternScaledColumn_outer] + rw [← Finset.smul_sum,gaussianPatternCoupling_column_sum] + +lemma trace_rankOne_mul {N : ℕ} (x : Fin N → ℝ) (A : Matrix (Fin N) (Fin N) ℝ) : + (vecMulVec x x*A).trace = x ⬝ᵥ (A *ᵥ x) := by + rw [Matrix.trace_mul_comm,Matrix.mul_vecMulVec,Matrix.trace_vecMulVec,dotProduct_comm] + +lemma gaussianGramColumnQuadratic_nonneg {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : 0 ≤ gaussianGramColumnQuadratic t z j := by + have h := (gaussianGramLeaveShift_posDef ht z j).inv.posSemidef.dotProduct_mulVec_nonneg + (gaussianPatternScaledColumn z j) + simpa only [gaussianGramColumnQuadratic,gaussianGramLeaveResolvent,star_trivial] using h + +lemma gaussianGramResolvent_column_trace {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + t*(gaussianGramResolvent t z).trace+ + ∑ j : Fin m, gaussianGramColumnQuadratic t z j/(1+gaussianGramColumnQuadratic t z j) = N := by + have he := gaussianGramResolvent_trace_identity ht z + rw [gaussianPatternCoupling_scaled_column_sum,Finset.sum_mul,Matrix.trace_sum] at he + simp_rw [trace_rankOne_mul,gaussianGramLeaveResolvent_quadratic ht z] at he + exact he + +theorem gaussianGramStieltjes_column_equation {N m : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + 1-t*gaussianGramStieltjes t z = (1/(N : ℝ))* + ∑ j : Fin m, gaussianGramColumnQuadratic t z j/(1+gaussianGramColumnQuadratic t z j) := by + have h := gaussianGramResolvent_column_trace ht z + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + unfold gaussianGramStieltjes + rw [one_div_mul_eq_div] + apply (eq_div_iff hn).mpr + field_simp + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTraceGap.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTraceGap.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5e71952d39eb89a9fc6ad0c2e07dca907819237 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTraceGap.lean @@ -0,0 +1,33 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventContraction +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolventEquation + +namespace OAI + +/-! Removing one physical Gaussian column changes the normalized transform by at most 1/(Nt). -/ +noncomputable section +open Matrix +namespace InvariantIsing + +lemma gaussianGramLeaveResolvent_trace_gap {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : + 0 ≤ (gaussianGramLeaveResolvent t z j).trace-(gaussianGramResolvent t z).trace ∧ + (gaussianGramLeaveResolvent t z j).trace-(gaussianGramResolvent t z).trace ≤ 1/t := by + rw [gaussianGramLeaveResolvent_trace ht z j] + let x := gaussianPatternScaledColumn z j + let y := gaussianGramLeaveResolvent t z j *ᵥ x + have hq := gaussianGramColumnQuadratic_nonneg ht z j + change 0 ≤ x ⬝ᵥ y at hq + have hd : 0 < 1+x ⬝ᵥ y := by linarith + have hy : 0 ≤ y ⬝ᵥ y := Finset.sum_nonneg (fun i _ => mul_self_nonneg (y i)) + have hc := positiveResolvent_quadratic_contraction ht (gaussianGramLeaveOneOut_posSemidef z j) x + change t*(y ⬝ᵥ y) ≤ x ⬝ᵥ y at hc + constructor + · exact div_nonneg hy hd.le + · apply (div_le_div_iff₀ hd ht).mpr + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformError.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformError.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2fa6d9d9edd57f26794669d6cb750f8c8d98934 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformError.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResidualMean + +namespace OAI + +/-! Quantitative mean convergence of the actual Gram resolvent to the MP equation's root. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma gaussianGramTransform_error_integrable {N m : ℕ} {t : ℝ} (ht : 0 < t) (α : ℝ) : + Integrable (fun z : EuclideanSpace ℝ (Fin N × Fin m) => + |gaussianGramStieltjes t z-marchenkoPasturTransform t α|) (stdGaussian _) := by + apply (integrable_const (1/t+|marchenkoPasturTransform t α|)).mono' + ((continuous_gaussianGramStieltjes ht).sub continuous_const).abs.aestronglyMeasurable + apply ae_of_all + intro z + rw [Real.norm_eq_abs,abs_abs] + exact (abs_sub _ _).trans (add_le_add (by + rw [abs_of_nonneg (gaussianGramStieltjes_nonneg ht z)] + exact gaussianGramStieltjes_le ht z) le_rfl) + +theorem gaussianGramTransform_mean_error {N m : ℕ} (hN : 0 < N) {t α : ℝ} + (ht : 0 < t) (hα : 0 ≤ α) : + (∫ z : EuclideanSpace ℝ (Fin N × Fin m), + |gaussianGramStieltjes t z-marchenkoPasturTransform t α| ∂stdGaussian _) ≤ + (((m : ℝ)/N)*(Real.sqrt (2/((N : ℝ)*t^2))+1/((N : ℝ)*t))+|(m : ℝ)/N-α|)/t := by + have hi := gaussianGramResidual_abs_integrable (N := N) (m := m) ht + (show 0 ≤ (m : ℝ)/N by positivity) + calc + _ ≤ ∫ z : EuclideanSpace ℝ (Fin N × Fin m), + (|marchenkoPasturResidual t ((m : ℝ)/N) (gaussianGramStieltjes t z)|+|(m : ℝ)/N-α|)/t + ∂stdGaussian _ := by + apply integral_mono (gaussianGramTransform_error_integrable ht α) + ((hi.add (integrable_const _)).div_const t) + intro z + apply (marchenkoPasturTransform_error ht hα (gaussianGramStieltjes_nonneg ht z)).trans + apply div_le_div_of_nonneg_right _ ht.le + dsimp only [Pi.add_apply] + simpa only [abs_sub_comm α ((m : ℝ)/N)] using + marchenkoPasturResidual_coefficient (t := t) (α := α) (β := (m : ℝ)/N) + (gaussianGramStieltjes_nonneg ht z) + _ = ((∫ z : EuclideanSpace ℝ (Fin N × Fin m), + |marchenkoPasturResidual t ((m : ℝ)/N) (gaussianGramStieltjes t z)| ∂stdGaussian _)+ + |(m : ℝ)/N-α|)/t := by + rw [integral_div,integral_add hi (integrable_const _)] + simp + _ ≤ _ := div_le_div_of_nonneg_right (add_le_add (gaussianGramResidual_mean_le hN ht) le_rfl) ht.le + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformLimit.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3ed1e444ac3848a458cea87ca947e019a11f9e2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformLimit.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramTransformError +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternAspect + +namespace OAI + +/-! Convergence of the actual positive Gram transforms at every positive real argument. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace InvariantIsing + +lemma gaussianGramTransform_error_bound_tendsto {α t : ℝ} (hα : 0 ≤ α) (ht : 0 < t) : + Tendsto (fun k : ℕ => + (((gaussianPatternCount α (k+1) : ℝ)/(k+1))*(Real.sqrt (2/((k+1 : ℝ)*t^2))+ + 1/((k+1 : ℝ)*t))+|(gaussianPatternCount α (k+1) : ℝ)/(k+1)-α|)/t) + atTop (𝓝 0) := by + have hn : Tendsto (fun k : ℕ => (k+1 : ℝ)) atTop atTop := by + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_one] using + (tendsto_natCast_atTop_atTop (R := ℝ)).comp (tendsto_add_atTop_nat 1) + have hq : Tendsto (fun k : ℕ => (2 : ℝ)/((k+1 : ℝ)*t^2)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop (hn.atTop_mul_const (sq_pos_of_pos ht)) + have hr : Tendsto (fun k : ℕ => (1 : ℝ)/((k+1 : ℝ)*t)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop (hn.atTop_mul_const ht) + have hs := (Real.continuous_sqrt.tendsto 0).comp hq + have ha := gaussianPatternCount_ratio_tendsto hα + simpa only [Function.comp_def,Real.sqrt_zero,mul_zero,add_zero,zero_add,sub_self,abs_zero,zero_div] using + ((ha.mul (hs.add hr)).add ((ha.sub (tendsto_const_nhds (x := α))).abs)).div_const t + +theorem gaussianGramTransform_mean_tendsto {α t : ℝ} (hα : 0 ≤ α) (ht : 0 < t) : + Tendsto (fun k : ℕ => ∫ z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))), + |gaussianGramStieltjes t z-marchenkoPasturTransform t α| ∂stdGaussian _) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => integral_nonneg (fun _ => abs_nonneg _)) + (fun k => ?_) (gaussianGramTransform_error_bound_tendsto hα ht) + simpa only [Nat.cast_add,Nat.cast_one] using gaussianGramTransform_mean_error + (N := k+1) (m := gaussianPatternCount α (k+1)) (Nat.succ_pos k) ht hα + +theorem gaussianPatternStieltjes_L1 {α t : ℝ} (hα : 0 ≤ α) (ht : 0 < t) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + Tendsto (fun k : ℕ => ∫ ω, |gaussianGramStieltjes t (Z (k+1) ω)-marchenkoPasturTransform t α| ∂P) + atTop (𝓝 0) := by + have he (k : ℕ) : (∫ ω, |gaussianGramStieltjes t (Z (k+1) ω)-marchenkoPasturTransform t α| ∂P) = + ∫ z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))), + |gaussianGramStieltjes t z-marchenkoPasturTransform t α| ∂stdGaussian _ := by + simpa only [Function.comp_def,Pi.sub_apply] using (hZ (k+1)).integral_comp + (((continuous_gaussianGramStieltjes ht).sub continuous_const).abs.aestronglyMeasurable) + simp_rw [he] + exact gaussianGramTransform_mean_tendsto hα ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformProbability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformProbability.lean new file mode 100644 index 0000000000000000000000000000000000000000..3124b28cefd518f100a87f6eed441d9c5c94f4b1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramTransformProbability.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramTransformLimit +import Mathlib.MeasureTheory.Function.ConvergenceInMeasure + +namespace OAI + +/-! Convergence in probability of the physical Gaussian Gram resolvents. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology ENNReal +namespace InvariantIsing + +theorem gaussianPatternStieltjes_tendsto {α t : ℝ} (hα : 0 ≤ α) (ht : 0 < t) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => gaussianGramStieltjes t (Z (k+1) ω)) atTop + (fun _ => marchenkoPasturTransform t α) := by + have hi (k : ℕ) : Integrable (fun ω => + gaussianGramStieltjes t (Z (k+1) ω)-marchenkoPasturTransform t α) P := by + have hm : AEStronglyMeasurable + (fun z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))) => + gaussianGramStieltjes t z-marchenkoPasturTransform t α) (stdGaussian _) := + ((continuous_gaussianGramStieltjes (N := k+1) + (m := gaussianPatternCount α (k+1)) ht).sub continuous_const).aestronglyMeasurable + have hh : Integrable (fun z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))) => + gaussianGramStieltjes t z-marchenkoPasturTransform t α) (stdGaussian _) := + (integrable_norm_iff hm).mp (by + simpa only [Real.norm_eq_abs] using gaussianGramTransform_error_integrable ht α) + exact (hZ (k+1)).integrable_comp hh + have he (k : ℕ) : eLpNorm ((fun ω => gaussianGramStieltjes t (Z (k+1) ω))- + (fun _ => marchenkoPasturTransform t α)) 1 P = + ENNReal.ofReal (∫ ω, |gaussianGramStieltjes t (Z (k+1) ω)-marchenkoPasturTransform t α| ∂P) := by + change eLpNorm (fun ω => gaussianGramStieltjes t (Z (k+1) ω)-marchenkoPasturTransform t α) 1 P = _ + rw [eLpNorm_one_eq_lintegral_enorm (hi k).aestronglyMeasurable, + ← ofReal_integral_norm_eq_lintegral_enorm (hi k)] + simp only [Real.norm_eq_abs] + apply tendstoInMeasure_of_tendsto_eLpNorm (by norm_num : (1 : ℝ≥0∞) ≠ 0) + simpa only [he,ENNReal.ofReal_zero,Function.comp_def] using + (ENNReal.continuous_ofReal.tendsto 0).comp (gaussianPatternStieltjes_L1 hα ht P Z hZ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramUniformIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramUniformIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb1be2b8e74f1380713e75736ffb3ac07b36e323 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianGramUniformIntegrability.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramNormBound +import OAI.Probability.InvariantIsing.Gaussian.GaussianSingularSquareUI + +namespace OAI + +/-! The Davidson--Szarek uniform-integrability consequence for the physical Gram spectrum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma uniformIntegrable_nat_mul_real {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (X : ℕ → Ω → ℝ) + (hX : UniformIntegrable X 1 P) (n : ℕ) : + UniformIntegrable (fun k ω => (n : ℝ)*X k ω) 1 P := by + induction n with + | zero => simpa only [Nat.cast_zero,zero_mul] using + (uniformIntegrable_const (ι := ℕ) le_rfl (by simp) (memLp_const (0 : ℝ))) + | succ n ih => + simpa only [Nat.cast_add,Nat.cast_one,add_mul,one_mul] using + uniformIntegrable_add_real P _ _ ih hX + +theorem gaussianPattern_spectralRadius_uniformIntegrable {α : ℝ} (hα : 0 ≤ α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) (c : ℝ) : + UniformIntegrable (fun k ω => spectralRadius + (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i)) 1 P := by + obtain ⟨n,hn⟩ := exists_nat_gt |c| + let X (k : ℕ) (ω : Ω) := (gaussianPatternSingularMax (Z (k+1) ω))^2/(k+1) + have hX : UniformIntegrable X 1 P := gaussianPatternSingularMax_square_uniformIntegrable hα P Z hZ + refine uniformIntegrable_of_abs_le P _ _ ?_ (uniformIntegrable_nat_mul_real P X hX n) ?_ + · intro k + have he : Measurable (fun z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))) => + spectralRadius (fun i => c*gaussianPatternEigenvalues z i)) := by + apply measurable_spectralRadius + exact Measurable.of_eval (fun i => + ((measurable_pi_apply i).comp + (measurable_gaussianPatternEigenvalues (k+1) (gaussianPatternCount α (k+1)))).const_mul c) + exact (he.aemeasurable.comp_aemeasurable (hZ (k+1)).aemeasurable).aestronglyMeasurable + intro k + apply ae_of_all + intro ω + have hpos : 0 ≤ X k ω := div_nonneg (sq_nonneg _) (by positivity) + have hr : 0 ≤ spectralRadius (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i) := + (abs_nonneg _).trans (abs_le_spectralRadius _ (0 : Fin (k+1))) + rw [abs_of_nonneg hr,abs_of_nonneg (mul_nonneg (Nat.cast_nonneg n) hpos)] + exact (gaussianPattern_spectralRadius_le c (Z (k+1) ω)).trans + (by rw [mul_div_assoc]; exact mul_le_mul_of_nonneg_right hn.le hpos) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianLeaveOneColumn.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianLeaveOneColumn.lean new file mode 100644 index 0000000000000000000000000000000000000000..d52aa06c82554e5c7aef1c2b9da9144e83b42b27 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianLeaveOneColumn.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramColumns +import OAI.Probability.InvariantIsing.Spectral.PositiveRankOneQuadratic + +namespace OAI + +/-! Exact leave-one-column identities at the physical Gaussian normalization. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +def gaussianPatternScaledColumn {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : Fin N → ℝ := (Real.sqrt N)⁻¹ • gaussianGramRawColumn z j + +def gaussianGramLeaveResolvent {N m : ℕ} (t : ℝ) (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : Matrix (Fin N) (Fin N) ℝ := + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianGramLeaveOneOut z j)⁻¹ + +lemma gaussianPatternScaledColumn_outer {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (j : Fin m) : + vecMulVec (gaussianPatternScaledColumn z j) (gaussianPatternScaledColumn z j) = + (1/(N : ℝ)) • vecMulVec (gaussianGramRawColumn z j) (gaussianGramRawColumn z j) := by + have he : ((Real.sqrt (N : ℝ))⁻¹)^2 = 1/(N : ℝ) := by + rw [inv_pow,Real.sq_sqrt (Nat.cast_nonneg N),one_div] + ext i k + simp only [gaussianPatternScaledColumn,Matrix.vecMulVec_apply,Matrix.smul_apply,Pi.smul_apply,smul_eq_mul] + calc + _ = ((Real.sqrt (N : ℝ))⁻¹)^2*(gaussianGramRawColumn z j i*gaussianGramRawColumn z j k) := by ring + _ = _ := by rw [he] + +lemma gaussianGramLeaveShift_posDef {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+gaussianGramLeaveOneOut z j).PosDef := + (Matrix.PosDef.one.smul ht).add_posSemidef (gaussianGramLeaveOneOut_posSemidef z j) + +lemma gaussianGramLeaveResolvent_quadratic {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : + let x := gaussianPatternScaledColumn z j + x ⬝ᵥ (gaussianGramResolvent t z *ᵥ x) = + (x ⬝ᵥ (gaussianGramLeaveResolvent t z j *ᵥ x))/(1+x ⬝ᵥ (gaussianGramLeaveResolvent t z j *ᵥ x)) := by + have h := positive_rankOne_quadratic _ (gaussianGramLeaveShift_posDef ht z j) + (gaussianPatternScaledColumn z j) + rw [gaussianPatternScaledColumn_outer,add_assoc,← gaussianGramLeaveOneOut_decomposition] at h + exact h + +lemma gaussianGramLeaveResolvent_trace {N m : ℕ} {t : ℝ} (ht : 0 < t) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) : + let x := gaussianPatternScaledColumn z j + (gaussianGramLeaveResolvent t z j).trace-(gaussianGramResolvent t z).trace = + ((gaussianGramLeaveResolvent t z j *ᵥ x) ⬝ᵥ (gaussianGramLeaveResolvent t z j *ᵥ x))/ + (1+x ⬝ᵥ (gaussianGramLeaveResolvent t z j *ᵥ x)) := by + have h := positive_rankOne_trace_difference _ (gaussianGramLeaveShift_posDef ht z j) + (gaussianPatternScaledColumn z j) + rw [gaussianPatternScaledColumn_outer,add_assoc,← gaussianGramLeaveOneOut_decomposition] at h + exact h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianLipschitzIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianLipschitzIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b3857de2e64d1995af68d3bba5a0b742c34239a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianLipschitzIntegrability.lean @@ -0,0 +1,37 @@ +import OAI.Probability.InvariantIsing.Haar.PublishedInputs +import Mathlib.Probability.Distributions.Gaussian.Fernique + +namespace OAI + +/-! Square integrability of the actual Lipschitz observables in the Gaussian input. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped NNReal +namespace InvariantIsing + +lemma gaussian_lipschitz_memLp_two {d : ℕ} {L : ℝ≥0} + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) : + MemLp f 2 (stdGaussian (EuclideanSpace ℝ (Fin d))) := by + have hi : MemLp (fun x : EuclideanSpace ℝ (Fin d) => x) 2 + (stdGaussian (EuclideanSpace ℝ (Fin d))) := IsGaussian.memLp_id _ 2 (by norm_num) + have hc : LipschitzWith L (fun x => f x-f 0) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_eq_norm, sub_sub_sub_cancel_right] using hf.dist_le_mul x y + have hh := (hc.comp_memLp (by simp) hi).add + (memLp_const (f 0) : MemLp (fun _ : EuclideanSpace ℝ (Fin d) => f 0) 2 + (stdGaussian (EuclideanSpace ℝ (Fin d)))) + convert hh using 1 + funext x + simp + +lemma gaussian_lipschitz_integrable {d : ℕ} {L : ℝ≥0} + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) : + Integrable f (stdGaussian (EuclideanSpace ℝ (Fin d))) := + (gaussian_lipschitz_memLp_two hf).integrable (by norm_num) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMaximumComparison.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMaximumComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d9007ca1dead0e5c3cc6ce01232596301194ff9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMaximumComparison.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Core.FiniteGaussianMaximum + +namespace OAI + +/-! The finite Gaussian maximum comparison used for rectangular spectral edges. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {X : Type*} [Fintype X] [Nonempty X] + +omit [Fintype X] [Nonempty X] in +lemma gaussianCross_scale_both {d : ℕ} (A C : X → Fin d → ℝ) (β : ℝ) (x y : X) : + gaussianCross (fun x i => β*A x i) (fun x i => β*C x i) x y = + β^2*gaussianCross A C x y := by + unfold gaussianCross + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + +theorem finite_gaussian_maximum_comparison {d : ℕ} (C A : X → Fin (d+1) → ℝ) + (hCA : ∀ x y, gaussianCross C A x y = 0) + (hdiag : ∀ x, gaussianCross A A x x = gaussianCross C C x x) + (hoff : ∀ x y, gaussianCross A A x y ≤ gaussianCross C C x y) : + (∫ g, finiteGaussianMaximum C g ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) ≤ + ∫ g, finiteGaussianMaximum A g ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + let μ := Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) + let MC := ∫ g, finiteGaussianMaximum C g ∂μ + let MA := ∫ g, finiteGaussianMaximum A g ∂μ + let K := Real.log (Fintype.card X) + have hw : GibbsReference (fun _ : X => (1 : ℝ)) := + ⟨fun _ => zero_le_one,⟨Classical.choice ‹Nonempty X›,zero_lt_one⟩⟩ + have hbound (β : ℝ) (hβ : 0 < β) : β*MC ≤ β*MA+K := by + let LC := fun g : Fin (d+1) → ℝ => + Real.log (finitePartition (fun _ : X => 1) (fun x => β*linearGaussian C g x)) + let LA := fun g : Fin (d+1) → ℝ => + Real.log (finitePartition (fun _ : X => 1) (fun x => β*linearGaussian A g x)) + have hiC : Integrable LC μ := by + simpa only [zero_add] using integrable_log_finitePartition hw (fun _ => 0) C β + have hiA : Integrable LA μ := by + simpa only [zero_add] using integrable_log_finitePartition hw (fun _ => 0) A β + have hlow : β*MC ≤ ∫ g, LC g ∂μ := by + rw [← integral_const_mul] + exact integral_mono ((finiteGaussianMaximum_integrable C).const_mul β) hiC + (fun g => (finiteGaussianMaximum_log_bounds C g β hβ).1) + have hupp : (∫ g, LA g ∂μ) ≤ β*MA+K := by + have hconst : (∫ _ : Fin (d+1) → ℝ, K ∂μ) = K := by simp + rw [← integral_const_mul,← hconst,← integral_add] + · exact integral_mono hiA (((finiteGaussianMaximum_integrable A).const_mul β).add (integrable_const K)) + (fun g => (finiteGaussianMaximum_log_bounds A g β hβ).2) + · exact (finiteGaussianMaximum_integrable A).const_mul β + · exact integrable_const K + have hmid : (∫ g, LC g ∂μ) ≤ ∫ g, LA g ∂μ := by + have h := finite_gaussian_log_comparison hw (fun _ => 0) + (fun x i => β*C x i) (fun x i => β*A x i) + (fun x y => by rw [gaussianCross_scale_both,hCA x y,mul_zero]) + (fun x => by rw [gaussianCross_scale_both,gaussianCross_scale_both,hdiag x]) + (fun x y => by + rw [gaussianCross_scale_both,gaussianCross_scale_both] + exact mul_le_mul_of_nonneg_left (hoff x y) (sq_nonneg β)) + simpa only [linearGaussian_scale,zero_add] using h + exact hlow.trans (hmid.trans hupp) + change MC ≤ MA + by_contra h + have hpos : 0 < MC-MA := sub_pos.mpr (lt_of_not_ge h) + let β := (|K|+1)/(MC-MA) + have hβ : 0 < β := div_pos (by positivity) hpos + have he : β*(MC-MA) = |K|+1 := div_mul_cancel₀ _ hpos.ne' + have hh := hbound β hβ + have hk := le_abs_self K + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMeanInterpolation.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMeanInterpolation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dd6851a33916ef23c74a7d5daa4312eb4fe4707 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMeanInterpolation.lean @@ -0,0 +1,124 @@ +import OAI.Probability.InvariantIsing.Gaussian.BaseGaussianVariance + +namespace OAI + +/-! Finite Gaussian mean interpolation with arbitrary base energy and weights. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +variable {X : Type*} [Fintype X] + +def affineGaussianCoefficients {d : ℕ} (C A : X → Fin d → ℝ) (s : ℝ) : X → Fin d → ℝ := + fun x i => C x i + s * A x i + +omit [Fintype X] in +lemma linearGaussian_affine {d : ℕ} (C A : X → Fin d → ℝ) (s : ℝ) + (g : Fin d → ℝ) (x : X) : + linearGaussian (affineGaussianCoefficients C A s) g x = + linearGaussian C g x + s * linearGaussian A g x := by + simp only [linearGaussian, affineGaussianCoefficients, add_mul, Finset.sum_add_distrib, + Finset.mul_sum, mul_assoc] + +def affineGaussianMean {d : ℕ} (w H : X → ℝ) (C A : X → Fin d → ℝ) (s : ℝ) : ℝ := + ∫ g, Real.log (finitePartition w (fun x => H x + + linearGaussian (affineGaussianCoefficients C A s) g x)) + ∂Measure.pi (fun _ : Fin d => gaussianReal 0 1) + +def affineGaussianSlope {d : ℕ} (w H : X → ℝ) (C A : X → Fin d → ℝ) (s : ℝ) : ℝ := + ∫ g, ∑ x, gaussianGibbs w H (affineGaussianCoefficients C A s) g x * linearGaussian A g x + ∂Measure.pi (fun _ : Fin d => gaussianReal 0 1) + +lemma affineGaussianMean_hasDerivAt {d : ℕ} {w : X → ℝ} (hw : GibbsReference w) + (H : X → ℝ) (C A : X → Fin d → ℝ) (t : ℝ) : + HasDerivAt (affineGaussianMean w H C A) (affineGaussianSlope w H C A t) t := by + let μ := Measure.pi (fun _ : Fin d => gaussianReal 0 1) + have hm (s : ℝ) : AEStronglyMeasurable (fun g => Real.log (finitePartition w + (fun x => H x + linearGaussian (affineGaussianCoefficients C A s) g x))) μ := by + simpa only [one_mul] using + (continuous_log_finitePartition hw H (affineGaussianCoefficients C A s) 1).aestronglyMeasurable + have hi : Integrable (fun g => Real.log (finitePartition w + (fun x => H x + linearGaussian (affineGaussianCoefficients C A t) g x))) μ := by + simpa only [one_mul] using integrable_log_finitePartition hw H (affineGaussianCoefficients C A t) 1 + apply (hasDerivAt_integral_of_dominated_loc_of_deriv_le (μ := μ) (s := Set.univ) + (F' := fun s g => ∑ x, gaussianGibbs w H (affineGaussianCoefficients C A s) g x * + linearGaussian A g x) (bound := fun g => ∑ x, |linearGaussian A g x|) + (Filter.univ_mem) (Filter.Eventually.of_forall hm) hi ?_ ?_ ?_ ?_).2 + · exact (continuous_finsetSum _ (fun x _ => + (continuous_gaussianGibbs hw H _ x).mul (by unfold linearGaussian; fun_prop))).aestronglyMeasurable + · apply ae_of_all + intro g s _ + rw [Real.norm_eq_abs] + exact finiteGibbs_average_bound hw _ _ (fun x => + Finset.single_le_sum (fun y _ => abs_nonneg (linearGaussian A g y)) (Finset.mem_univ x)) + · exact integrable_finsetSum _ (fun x _ => (integrable_linearGaussian A x).abs) + · apply ae_of_all + intro g s _ + apply hasDerivAt_log_finitePartition hw + intro x + simp_rw [linearGaussian_affine] + simpa only [one_mul, id_eq] using (((hasDerivAt_id s).mul_const (linearGaussian A g x)).const_add + (linearGaussian C g x)).const_add (H x) + +lemma expectedGaussianEnergy_abs_le {d : ℕ} {w : X → ℝ} (hw : GibbsReference w) + (H : X → ℝ) (A C : X → Fin (d + 1) → ℝ) {K : ℝ} + (hK : ∀ x y, |gaussianCross A C x y| ≤ K) : + |∫ g, ∑ x, gaussianGibbs w H C g x * linearGaussian A g x + ∂Measure.pi (fun _ : Fin (d + 1) => gaussianReal 0 1)| ≤ 2 * K := by + have hb (g : Fin (d + 1) → ℝ) (x : X) : + |gaussianCross A C x x - ∑ y, gaussianGibbs w H C g y * gaussianCross A C x y| ≤ 2 * K := by + have hh := finiteGibbs_average_bound hw (fun y => H y + linearGaussian C g y) + (fun y => gaussianCross A C x y) (hK x) + exact (abs_sub _ _).trans (by dsimp only [gaussianGibbs] at *; linarith [hK x x]) + have hc (x : X) : Integrable (fun g => gaussianGibbs w H C g x * + (gaussianCross A C x x - ∑ y, gaussianGibbs w H C g y * gaussianCross A C x y)) + (Measure.pi (fun _ : Fin (d + 1) => gaussianReal 0 1)) := by + apply Integrable.of_bound + ((continuous_gaussianGibbs hw H C x).mul + (continuous_const.sub (continuous_finsetSum _ (fun y _ => + (continuous_gaussianGibbs hw H C y).mul continuous_const)))).aestronglyMeasurable (2 * K) + apply ae_of_all + intro g + change ‖gaussianGibbs w H C g x * + (gaussianCross A C x x - ∑ y, gaussianGibbs w H C g y * gaussianCross A C x y)‖ ≤ _ + rw [Real.norm_eq_abs, abs_mul, + abs_of_nonneg (show 0 ≤ gaussianGibbs w H C g x from finiteGibbs_nonneg hw _ x)] + exact (mul_le_mul_of_nonneg_right (finiteGibbs_le_one hw _ x) (abs_nonneg _)).trans + (by simpa only [one_mul] using hb g x) + rw [integral_finsetSum _ (fun x _ => by + simpa only [mul_comm] using integrable_linearGaussian_mul_gibbs hw H A C x x)] + simp_rw [mul_comm (gaussianGibbs w H C _ _) (linearGaussian A _ _), + gaussian_gibbs_insertion hw H A C] + rw [← integral_finsetSum _ (fun x _ => hc x)] + simpa only [Real.norm_eq_abs, probReal_univ, mul_one] using + (norm_integral_le_of_norm_le_const (μ := Measure.pi (fun _ : Fin (d + 1) => gaussianReal 0 1)) + (f := fun g => ∑ x, gaussianGibbs w H C g x * + (gaussianCross A C x x - ∑ y, gaussianGibbs w H C g y * gaussianCross A C x y)) + (C := 2 * K) (ae_of_all _ (fun g => by + rw [Real.norm_eq_abs] + exact finiteGibbs_average_bound hw (fun x => H x + linearGaussian C g x) _ (hb g)))) + +/-- A dimension-independent mean comparison. The cross-covariance of the +increment with the interpolated field, rather than the Gaussian coordinate +count, determines the bound. -/ +theorem affineGaussianMean_abs_sub_le {d : ℕ} {w : X → ℝ} (hw : GibbsReference w) + (H : X → ℝ) (C A : X → Fin (d + 1) → ℝ) {K : ℝ} + (hK : ∀ s ∈ Set.Icc (0 : ℝ) 1, ∀ x y, + |gaussianCross A (affineGaussianCoefficients C A s) x y| ≤ K) : + |affineGaussianMean w H C A 1 - affineGaussianMean w H C A 0| ≤ 2 * K := by + have hd (s : ℝ) := affineGaussianMean_hasDerivAt hw H C A s + have hb (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) : |affineGaussianSlope w H C A s| ≤ 2 * K := + expectedGaussianEnergy_abs_le hw H A (affineGaussianCoefficients C A s) (hK s hs) + simpa only [Real.norm_eq_abs] using + norm_image_sub_le_of_norm_deriv_le_segment_01' + (fun s _ => (hd s).hasDerivWithinAt) (fun s hs => by simpa only [Real.norm_eq_abs] using hb s (Set.Ico_subset_Icc_self hs)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMedianTail.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMedianTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..ffb65dd2363717c171aec07ab8d42a12fa9b6607 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMedianTail.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Haar.ProbabilityMedian + +namespace OAI + +/-! Conversion of two Gaussian tails about a center to tails about any median. -/ +noncomputable section +open MeasureTheory Set +namespace InvariantIsing + +theorem gaussian_median_tail {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (c m k : ℝ) (hk : 0 < k) + (hm1 : (1/2:ℝ) ≤ μ.real {ω | f ω ≤ m}) + (hm2 : (1/2:ℝ) ≤ μ.real {ω | m ≤ f ω}) + (hplus : ∀ r > 0, μ.real {ω | r ≤ f ω-c} ≤ Real.exp (-k*r^2)) + (hminus : ∀ r > 0, μ.real {ω | r ≤ c-f ω} ≤ Real.exp (-k*r^2)) + {r : ℝ} (hr : 0 < r) : + μ.real {ω | r ≤ |f ω-m|} ≤ Real.exp 1*Real.exp (-k*r^2/8) := by + let a := Real.sqrt (2/k) + have ha : 0 < a := Real.sqrt_pos.mpr (div_pos (by norm_num) hk) + have ha2 : a^2 = 2/k := Real.sq_sqrt (div_pos (by norm_num) hk).le + have hka : k*a^2 = 2 := by rw [ha2]; field_simp + have hexp : Real.exp (-2) < (1/2:ℝ) := by + have he := Real.add_one_le_exp (2:ℝ) + have hp := Real.exp_pos (-2) + have hm : Real.exp (-2)*Real.exp 2 = 1 := by rw [← Real.exp_add]; norm_num + nlinarith + have hpa : μ.real {ω | a ≤ f ω-c} < (1/2:ℝ) := by + have h := hplus a ha + have he : -k*a^2 = -(2:ℝ) := by nlinarith [hka] + rw [he] at h + exact h.trans_lt hexp + have hma : μ.real {ω | a ≤ c-f ω} < (1/2:ℝ) := by + have h := hminus a ha + have he : -k*a^2 = -(2:ℝ) := by nlinarith [hka] + rw [he] at h + exact h.trans_lt hexp + have hmc : |m-c| ≤ a := by + apply abs_le.mpr + constructor + · by_contra h + have hs : {ω | f ω ≤ m} ⊆ {ω | a ≤ c-f ω} := by + intro ω hω + simp only [mem_ofPred_eq] at * + linarith + exact (not_lt_of_ge (hm1.trans (measureReal_mono hs))) hma + · by_contra h + have hs : {ω | m ≤ f ω} ⊆ {ω | a ≤ f ω-c} := by + intro ω hω + simp only [mem_ofPred_eq] at * + linarith + exact (not_lt_of_ge (hm2.trans (measureReal_mono hs))) hpa + by_cases hsmall : r ≤ 2*a + · have hkr : k*r^2/8 ≤ 1 := by + have hsq : r^2 ≤ 4*a^2 := by nlinarith + have hm := mul_le_mul_of_nonneg_left hsq hk.le + nlinarith [hka] + have hex : 1 ≤ Real.exp 1*Real.exp (-k*r^2/8) := by + rw [← Real.exp_add] + exact Real.one_le_exp_iff.mpr (by linarith) + exact measureReal_le_one.trans hex + · have hhalf : 0 < r/2 := half_pos hr + have hs : {ω | r ≤ |f ω-m|} ⊆ {ω | r/2 ≤ |f ω-c|} := by + intro ω hω + have htri : |f ω-m| ≤ |f ω-c|+|m-c| := by + simpa only [sub_add_sub_cancel,abs_sub_comm c m] using abs_add_le (f ω-c) (c-m) + simp only [mem_ofPred_eq] at * + linarith + have he : {ω | r/2 ≤ |f ω-c|} = + {ω | r/2 ≤ f ω-c} ∪ {ω | r/2 ≤ c-f ω} := by + ext ω + simp only [mem_ofPred_eq,mem_union,le_abs,neg_sub] + have ht : μ.real {ω | r/2 ≤ |f ω-c|} ≤ 2*Real.exp (-k*(r/2)^2) := by + rw [he] + have hu := measureReal_union_le (μ := μ) {ω | r/2 ≤ f ω-c} {ω | r/2 ≤ c-f ω} + linarith [hplus (r/2) hhalf,hminus (r/2) hhalf] + calc + _ ≤ μ.real {ω | r/2 ≤ |f ω-c|} := measureReal_mono hs + _ ≤ 2*Real.exp (-k*(r/2)^2) := ht + _ ≤ Real.exp 1*Real.exp (-k*r^2/8) := by + apply mul_le_mul + · simpa only [show (1:ℝ)+1=2 by norm_num] using Real.add_one_le_exp (1:ℝ) + · apply Real.exp_le_exp.mpr + nlinarith [mul_nonneg hk.le (sq_nonneg r)] + · exact (Real.exp_pos _).le + · exact (Real.exp_pos _).le + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMinmaxComparison.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMinmaxComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..37a5882cf7bf83f88bde6b956dee9407130abe71 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianMinmaxComparison.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonComparison +import OAI.Probability.InvariantIsing.Core.FiniteMinmax +import OAI.Probability.InvariantIsing.Gaussian.GaussianMaximumComparison + +namespace OAI + +/-! Removing the finite entropy error from Gordon's Gaussian comparison. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +theorem finite_gaussian_minmax_comparison {d : ℕ} (C A : U × V → Fin (d+1) → ℝ) + (hCA : ∀ x y, gaussianCross C A x y = 0) + (hrow : ∀ x u, gaussianCross A A x (u,x.2) = gaussianCross C C x (u,x.2)) + (hoff : ∀ x y, gaussianCross A A x y ≤ gaussianCross C C x y) : + (∫ g, finiteMinmax (fun x => linearGaussian A g x) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) ≤ + ∫ g, finiteMinmax (fun x => linearGaussian C g x) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + let μ := Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) + let MA := ∫ g, finiteMinmax (fun x => linearGaussian A g x) ∂μ + let MC := ∫ g, finiteMinmax (fun x => linearGaussian C g x) ∂μ + let K := Real.log (Fintype.card V)+Real.log (Fintype.card U) + have hbound (β : ℝ) (hβ : 0 < β) : β*MA-Real.log (Fintype.card V) ≤ + β*MC+Real.log (Fintype.card U) := by + let LA := fun g => gordonValue (fun x => β*linearGaussian A g x) + let LC := fun g => gordonValue (fun x => β*linearGaussian C g x) + have hiA : Integrable LA μ := by + simpa only [zero_add,linearGaussian_scale] using + integrable_gordonValue (fun _ => 0) (fun x i => β*A x i) + have hiC : Integrable LC μ := by + simpa only [zero_add,linearGaussian_scale] using + integrable_gordonValue (fun _ => 0) (fun x i => β*C x i) + have hl : β*MA-Real.log (Fintype.card V) ≤ ∫ g, LA g ∂μ := by + have hc : (∫ _ : Fin (d+1) → ℝ, Real.log (Fintype.card V) ∂μ) = + Real.log (Fintype.card V) := by simp + change β*(∫ g, finiteMinmax (fun x => linearGaussian A g x) ∂μ)-_ ≤ _ + rw [← integral_const_mul,← hc, + ← integral_sub ((finiteMinmax_linear_integrable A).const_mul β) (integrable_const _)] + exact integral_mono (((finiteMinmax_linear_integrable A).const_mul β).sub (integrable_const _)) + hiA (fun g => (gordonValue_finiteMinmax_bounds _ β hβ).1) + have hu : (∫ g, LC g ∂μ) ≤ β*MC+Real.log (Fintype.card U) := by + have hc : (∫ _ : Fin (d+1) → ℝ, Real.log (Fintype.card U) ∂μ) = + Real.log (Fintype.card U) := by simp + change _ ≤ β*(∫ g, finiteMinmax (fun x => linearGaussian C g x) ∂μ)+_ + rw [← integral_const_mul,← hc, + ← integral_add ((finiteMinmax_linear_integrable C).const_mul β) (integrable_const _)] + exact integral_mono hiC + (((finiteMinmax_linear_integrable C).const_mul β).add (integrable_const _)) + (fun g => (gordonValue_finiteMinmax_bounds _ β hβ).2) + have hm : (∫ g, LA g ∂μ) ≤ ∫ g, LC g ∂μ := by + have h := finite_gaussian_gordon_comparison (fun x i => β*C x i) (fun x i => β*A x i) + (fun x y => by rw [gaussianCross_scale_both,hCA x y,mul_zero]) + (fun x u => by rw [gaussianCross_scale_both,gaussianCross_scale_both,hrow x u]) + (fun x y => by + rw [gaussianCross_scale_both,gaussianCross_scale_both] + exact mul_le_mul_of_nonneg_left (hoff x y) (sq_nonneg β)) + simpa only [linearGaussian_scale] using h + exact hl.trans (hm.trans hu) + change MA ≤ MC + by_contra h + have hp : 0 < MA-MC := sub_pos.mpr (lt_of_not_ge h) + let β := (|K|+1)/(MA-MC) + have hβ : 0 < β := div_pos (by positivity) hp + have he : β*(MA-MC) = |K|+1 := div_mul_cancel₀ _ hp.ne' + have hh := hbound β hβ + have hk := le_abs_self K + dsimp only [K] at hk he + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianNormLowerMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianNormLowerMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..039ce293333658ecb63048bd102aaf68e62ba57d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianNormLowerMean.lean @@ -0,0 +1,35 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianCoordinateNorm + +namespace OAI + +/-! The matching lower mean bound for a finite-dimensional Gaussian norm. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma gaussianNorm_sq_integral {ι : Type*} [Fintype ι] : + (∫ z : EuclideanSpace ℝ ι, ‖z‖^2 ∂stdGaussian _) = Fintype.card ι := by + have hZ : HasLaw (WithLp.toLp 2 : (ι → ℝ) → EuclideanSpace ℝ ι) + (stdGaussian _) (Measure.pi (fun _ : ι => gaussianReal 0 1)) := + ⟨(PiLp.continuous_toLp 2 (fun _ : ι => ℝ)).measurable.aemeasurable,map_pi_eq_stdGaussian⟩ + rw [← hZ.integral_comp (f := fun z => ‖z‖^2) (by fun_prop)] + exact gaussianCoordinateVector_sq_integral (id : ι → ι) + +lemma gaussianNorm_lower_mean {ι : Type*} [Fintype ι] : + Real.sqrt ((Fintype.card ι : ℝ)-1) ≤ ∫ z : EuclideanSpace ℝ ι, ‖z‖ ∂stdGaussian _ := by + have hL : LipschitzWith 1 (norm : EuclideanSpace ℝ ι → ℝ) := lipschitzWith_one_norm + have hv := finiteGaussian_lipschitz_variance hL + rw [variance_eq_sub (finiteGaussian_lipschitz_memLp_two hL)] at hv + change (∫ z : EuclideanSpace ℝ ι, ‖z‖^2 ∂stdGaussian _) - _ ≤ (1 : ℝ)^2 at hv + rw [gaussianNorm_sq_integral] at hv + have hn : 0 ≤ ∫ z : EuclideanSpace ℝ ι, ‖z‖ ∂stdGaussian _ := integral_nonneg (fun z => norm_nonneg z) + apply Real.sqrt_le_iff.mpr + constructor + · exact hn + · nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianNormMoments.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianNormMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b4722585c393920f768a1b22ddac60f9763ad2a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianNormMoments.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianOperatorMean + +namespace OAI + +/-! Exact variance gives the second-moment upper bound needed for Gaussian Gram tails. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +theorem gaussianPatternSingularMax_mean_le (N m : ℕ) : + (∫ z, gaussianPatternSingularMax (N := N) (m := m) z ∂stdGaussian _) ≤ + Real.sqrt N + Real.sqrt m := by + by_cases hN : N = 0 + · subst N + have hz (z : EuclideanSpace ℝ (Fin 0 × Fin m)) : gaussianPatternSingularMax z = 0 := by + unfold gaussianPatternSingularMax + rw [Subsingleton.elim (gaussianPatternEuclideanOperator z) 0,norm_zero] + simp only [hz,integral_zero,Nat.cast_zero,Real.sqrt_zero,zero_add] + exact Real.sqrt_nonneg _ + by_cases hm : m = 0 + · subst m + have hz (z : EuclideanSpace ℝ (Fin N × Fin 0)) : gaussianPatternSingularMax z = 0 := by + unfold gaussianPatternSingularMax + rw [Subsingleton.elim (gaussianPatternEuclideanOperator z) 0,norm_zero] + simp only [hz,integral_zero,Nat.cast_zero,Real.sqrt_zero,add_zero] + exact Real.sqrt_nonneg _ + exact gaussianPatternSingularMax_mean_le_pos (Nat.pos_of_ne_zero hN) (Nat.pos_of_ne_zero hm) + +lemma gaussianPatternSingularMax_mean_nonneg (N m : ℕ) : + 0 ≤ ∫ z, gaussianPatternSingularMax (N := N) (m := m) z ∂stdGaussian _ := + integral_nonneg (fun _ => norm_nonneg _) + +lemma gaussianPatternSingularMax_sq_integral_le {N m : ℕ} (hN : 0 < N) (hm : 0 < m) : + (∫ z, (gaussianPatternSingularMax (N := N) (m := m) z)^2 ∂stdGaussian _) ≤ + 1+(Real.sqrt N+Real.sqrt m)^2 := by + have hmem := finiteGaussian_lipschitz_memLp_two (gaussianPatternSingularMax_lipschitz N m) + have hv := gaussianPatternSingularMax_variance N m + rw [variance_eq_sub hmem] at hv + have hn := gaussianPatternSingularMax_mean_nonneg N m + have hb := gaussianPatternSingularMax_mean_le_pos hN hm + have hs := sq_le_sq₀ hn (by positivity : 0 ≤ Real.sqrt N+Real.sqrt m) |>.2 hb + change (∫ z, (gaussianPatternSingularMax z)^2 ∂stdGaussian _) - _ ≤ 1 at hv + linarith + +lemma gaussianPatternSingularMax_upper_tail {N m : ℕ} (hN : 0 < N) (hm : 0 < m) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : Ω → EuclideanSpace ℝ (Fin N × Fin m)) (hZ : HasLaw Z (stdGaussian _) P) + (r : ℝ) (hr : 0 < r) : + P {ω | Real.sqrt N+Real.sqrt m+r ≤ gaussianPatternSingularMax (Z ω)} ≤ + ENNReal.ofReal (1/r^2) := by + have hb := gaussianPatternSingularMax_mean_le_pos hN hm + have hsub : {ω | Real.sqrt N+Real.sqrt m+r ≤ gaussianPatternSingularMax (Z ω)} ⊆ + {ω | r ≤ |gaussianPatternSingularMax (Z ω) - + (∫ z : EuclideanSpace ℝ (Fin N × Fin m), gaussianPatternSingularMax z ∂stdGaussian _)|} := by + intro ω hω + have hr' : r ≤ gaussianPatternSingularMax (Z ω) - + (∫ z : EuclideanSpace ℝ (Fin N × Fin m), gaussianPatternSingularMax z ∂stdGaussian _) := by + change Real.sqrt N+Real.sqrt m+r ≤ gaussianPatternSingularMax (Z ω) at hω + linarith + exact hr'.trans (le_abs_self _) + refine (measure_mono hsub).trans ?_ + simpa only [div_one,one_pow,one_mul] using + finiteGaussian_lipschitz_tail (gaussianPatternSingularMax_lipschitz N m) P Z hZ 1 r + zero_lt_one hr + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianOperatorMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianOperatorMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..7066eff3d5acc88664a610a13e3f687b292bc34c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianOperatorMean.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Core.UnitBilinearNorm +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +/-! Sharp finite-dimensional upper mean bound for a rectangular Gaussian matrix. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped BigOperators RealInnerProductSpace Topology +namespace InvariantIsing + +theorem gaussianPatternSingularMax_mean_le_pos {N m : ℕ} (hN : 0 < N) (hm : 0 < m) : + (∫ z, gaussianPatternSingularMax (N := N) (m := m) z ∂stdGaussian _) ≤ + Real.sqrt N + Real.sqrt m := by + let : NeZero N := ⟨Nat.ne_of_gt hN⟩ + let : NeZero m := ⟨Nat.ne_of_gt hm⟩ + let : Nonempty (UnitVector (EuclideanSpace ℝ (Fin N))) := unitVector_nonempty _ + let : Nonempty (UnitVector (EuclideanSpace ℝ (Fin m))) := unitVector_nonempty _ + let S := UnitVector (EuclideanSpace ℝ (Fin N)) × UnitVector (EuclideanSpace ℝ (Fin m)) + let s : ℕ → S := TopologicalSpace.denseSeq S + have hs : DenseRange s := TopologicalSpace.denseRange_denseSeq S + let A (n : ℕ) (g : (Fin N × Fin m) → ℝ) : ℝ := + indexedGaussianMaximum (fun i : Fin (n+1) => fun ij => + (s i).1.1 ij.1*(s i).2.1 ij.2) g + let Z (g : (Fin N × Fin m) → ℝ) : EuclideanSpace ℝ (Fin N × Fin m) := WithLp.toLp 2 g + let μ := Measure.pi (fun _ : Fin N × Fin m => gaussianReal 0 1) + have hZ : HasLaw Z (stdGaussian _) μ := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N × Fin m => ℝ)).measurable.aemeasurable, + map_pi_eq_stdGaussian⟩ + have hA (n : ℕ) (g : (Fin N × Fin m) → ℝ) : + A n g = prefixMaximum + (fun i => ⟪(s i).1.1,gaussianPatternEuclideanOperator (Z g) (s i).2.1⟫) n := by + unfold A indexedGaussianMaximum prefixMaximum + congr 1 + funext i + exact (gaussianPattern_unitBilinear (Z g) (s i).1.1 (s i).2.1).symm + have hlim (g : (Fin N × Fin m) → ℝ) : + Tendsto (fun n => A n g) atTop (𝓝 (gaussianPatternSingularMax (Z g))) := by + simp_rw [hA] + have hc : Continuous (fun p : S => + ⟪p.1.1,gaussianPatternEuclideanOperator (Z g) p.2.1⟫) := by + dsimp [S] + fun_prop + have hb : BddAbove (range (fun p : S => + ⟪p.1.1,gaussianPatternEuclideanOperator (Z g) p.2.1⟫)) := + ⟨‖gaussianPatternEuclideanOperator (Z g)‖,by + rintro _ ⟨p,rfl⟩ + exact unitBilinear_le_norm _ p⟩ + have ht := dense_prefixMaximum_tendsto s hs _ hc hb + have hn := norm_eq_iSup_unitBilinear (gaussianPatternEuclideanOperator (Z g)) + change ‖gaussianPatternEuclideanOperator (Z g)‖ = + (⨆ p : S, ⟪p.1.1,gaussianPatternEuclideanOperator (Z g) p.2.1⟫) at hn + rw [← hn] at ht + exact ht + have hbound (n : ℕ) (g : (Fin N × Fin m) → ℝ) : |A n g| ≤ ‖Z g‖ := by + obtain ⟨i,hi,he⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty + (fun i : Fin (n+1) => ∑ ij, (s i).1.1 ij.1*(s i).2.1 ij.2*g ij) + change |Finset.univ.sup' Finset.univ_nonempty _| ≤ _ + rw [he,← gaussianPattern_unitBilinear (Z g) (s i).1.1 (s i).2.1] + calc + _ ≤ ‖(s i).1.1‖*‖gaussianPatternEuclideanOperator (Z g) (s i).2.1‖ := + abs_real_inner_le_norm _ _ + _ = ‖gaussianPatternEuclideanOperator (Z g) (s i).2.1‖ := by rw [(s i).1.2,one_mul] + _ ≤ ‖gaussianPatternEuclideanOperator (Z g)‖*‖(s i).2.1‖ := + (gaussianPatternEuclideanOperator (Z g)).le_opNorm _ + _ ≤ ‖Z g‖ := by rw [(s i).2.2,mul_one]; exact gaussianPatternEuclideanOperator_norm_le _ + have ht := tendsto_integral_of_dominated_convergence (μ := μ) (fun g => ‖Z g‖) + (fun n => (measurable_indexedGaussianMaximum _).aestronglyMeasurable) + (((gaussianCoordinateVector_memLp (id : (Fin N × Fin m) → (Fin N × Fin m))).integrable + (by norm_num)).norm) + (fun n => ae_of_all _ (fun g => by simpa only [Real.norm_eq_abs] using hbound n g)) + (ae_of_all _ hlim) + have hb (n : ℕ) : (∫ g, A n g ∂μ) ≤ Real.sqrt N + Real.sqrt m := + bilinear_gaussian_mean_le (fun i : Fin (n+1) => (s i).1.1) + (fun i : Fin (n+1) => (s i).2.1) (fun i => (s i).1.2) (fun i => (s i).2.2) + have he : (∫ g, gaussianPatternSingularMax (Z g) ∂μ) = + ∫ z : EuclideanSpace ℝ (Fin N × Fin m), gaussianPatternSingularMax z ∂stdGaussian _ := by + simpa only [Function.comp_def] using hZ.integral_comp + (gaussianPatternSingularMax_lipschitz N m).continuous.aestronglyMeasurable + rw [← he] + exact le_of_tendsto ht (Filter.Eventually.of_forall hb) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternAspect.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternAspect.lean new file mode 100644 index 0000000000000000000000000000000000000000..66c3bd1577fd141e11dd44e41fb8ff4393d30b85 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternAspect.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianNormMoments +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternPublishedInputs + +namespace OAI + +/-! The actual integer Gaussian pattern counts and their aspect-ratio limits. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +lemma gaussianPatternCount_le {α : ℝ} (hα : 0 ≤ α) (N : ℕ) : + (gaussianPatternCount α N : ℝ) ≤ α*N := by + unfold gaussianPatternCount + exact Nat.floor_le (mul_nonneg hα (Nat.cast_nonneg _)) + +lemma gaussianPatternCount_ratio_tendsto {α : ℝ} (hα : 0 ≤ α) : + Tendsto (fun k : ℕ => (gaussianPatternCount α (k+1) : ℝ)/(k+1)) atTop (𝓝 α) := by + have he (k : ℕ) : 0 ≤ α-(gaussianPatternCount α (k+1) : ℝ)/(k+1) ∧ + α-(gaussianPatternCount α (k+1) : ℝ)/(k+1) ≤ 1/(k+1) := by + have hk : (0 : ℝ) < k+1 := by positivity + have hl := gaussianPatternCount_le hα (k+1) + have hu : α*(k+1) < (gaussianPatternCount α (k+1) : ℝ)+1 := by + simpa only [gaussianPatternCount,Nat.cast_add,Nat.cast_one] using + Nat.lt_floor_add_one (α*(k+1 : ℝ)) + have hr : α-(gaussianPatternCount α (k+1) : ℝ)/(k+1) = + (α*(k+1)-(gaussianPatternCount α (k+1) : ℝ))/(k+1) := by field_simp + rw [hr] + constructor + · apply div_nonneg _ hk.le + simpa only [Nat.cast_add,Nat.cast_one] using sub_nonneg.mpr hl + · apply div_le_div_of_nonneg_right _ hk.le + linarith + have ht := squeeze_zero (fun k => (he k).1) (fun k => (he k).2) + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) + have h := (tendsto_const_nhds (x := α)).sub ht + simpa only [sub_zero,sub_sub_cancel] using h + +lemma gaussianPatternCount_sqrt_ratio_tendsto {α : ℝ} (hα : 0 ≤ α) : + Tendsto (fun k : ℕ => 1+Real.sqrt ((gaussianPatternCount α (k+1) : ℝ)/(k+1))) + atTop (𝓝 (1+Real.sqrt α)) := + tendsto_const_nhds.add (Real.continuous_sqrt.tendsto α |>.comp (gaussianPatternCount_ratio_tendsto hα)) + +lemma gaussianPattern_mean_div_sqrt_le {N m : ℕ} (hN : 0 < N) : + (∫ z, gaussianPatternSingularMax (N := N) (m := m) z + ∂ProbabilityTheory.stdGaussian _)/Real.sqrt N ≤ 1+Real.sqrt ((m : ℝ)/N) := by + have hs : 0 < Real.sqrt (N : ℝ) := Real.sqrt_pos.mpr (by exact_mod_cast hN) + calc + _ ≤ (Real.sqrt N+Real.sqrt m)/Real.sqrt N := + div_le_div_of_nonneg_right (gaussianPatternSingularMax_mean_le N m) hs.le + _ = _ := by rw [add_div,div_self hs.ne',Real.sqrt_div (Nat.cast_nonneg m)] + +lemma gaussianPattern_mean_sq_div_le {α : ℝ} (hα : 0 ≤ α) (k : ℕ) : + (∫ z, gaussianPatternSingularMax (N := k+1) (m := gaussianPatternCount α (k+1)) z + ∂ProbabilityTheory.stdGaussian _)^2/(k+1) ≤ 2+2*α := by + let M := ∫ z, gaussianPatternSingularMax (N := k+1) (m := gaussianPatternCount α (k+1)) z + ∂ProbabilityTheory.stdGaussian _ + have hM : 0 ≤ M := gaussianPatternSingularMax_mean_nonneg _ _ + have hb : M ≤ Real.sqrt (k+1 : ℝ)+Real.sqrt (gaussianPatternCount α (k+1)) := by + simpa only [Nat.cast_add,Nat.cast_one] using + gaussianPatternSingularMax_mean_le (k+1) (gaussianPatternCount α (k+1)) + have hs := (sq_le_sq₀ hM (by positivity : 0 ≤ Real.sqrt (k+1)+ + Real.sqrt (gaussianPatternCount α (k+1)))).2 hb + have hN : (Real.sqrt (k+1))^2 = (k+1 : ℝ) := Real.sq_sqrt (by positivity) + have hm : (Real.sqrt (gaussianPatternCount α (k+1)))^2 = + (gaussianPatternCount α (k+1) : ℝ) := Real.sq_sqrt (by positivity) + have hc := gaussianPatternCount_le hα (k+1) + simp only [Nat.cast_add,Nat.cast_one] at hc hb + apply (div_le_iff₀ (by positivity : (0 : ℝ) < k+1)).mpr + dsimp [M] at hM hs ⊢ + nlinarith [sq_nonneg (Real.sqrt (k+1)-Real.sqrt (gaussianPatternCount α (k+1)))] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternCorollary.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternCorollary.lean new file mode 100644 index 0000000000000000000000000000000000000000..686257bc19e25a6efe84d73de52d7b6828cd163c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternCorollary.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternGroundLimit +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternNorms +import OAI.Probability.InvariantIsing.Pressure.RandomSqrtLimit + +namespace OAI + +/-! The Gaussian-pattern maximum-norm and minimum-spin-sum limits. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +universe u +namespace InvariantIsing + +theorem gaussianPattern_norm_limits + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (α : ℝ) (hα : 0 < α) (hmp : MarchenkoPasturInput.{u} α hα) + (hds : DavidsonSzarekInput.{u} α hα) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, Measurable (Z N)) (hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + ∃ eplus eminus : ℝ, 0 ≤ eplus ∧ eminus ≤ 0 ∧ + Tendsto (fun β => gaussianPatternLimit α β/β) atTop (𝓝 eplus) ∧ + Tendsto (fun β => gaussianPatternLimit α (-β)/β) atTop (𝓝 eminus) ∧ + (TendstoInMeasure P (fun k ω => ‖gaussianPatternOperator (Z (k+1) ω)‖/(k+1)) atTop + (fun _ => Real.sqrt (2*eplus)) ∧ + Tendsto (fun k => eLpNorm (fun ω => ‖gaussianPatternOperator (Z (k+1) ω)‖/(k+1)- + Real.sqrt (2*eplus)) 1 P) atTop (𝓝 0)) ∧ + (TendstoInMeasure P (fun k ω => + (Finset.univ.inf' Finset.univ_nonempty (fun σ : Spin (k+1) => ‖gaussianPatternSum (Z (k+1) ω) σ‖))/(k+1)) + atTop (fun _ => Real.sqrt (-2*eminus)) ∧ + Tendsto (fun k => eLpNorm (fun ω => + (Finset.univ.inf' Finset.univ_nonempty (fun σ : Spin (k+1) => ‖gaussianPatternSum (Z (k+1) ω) σ‖))/(k+1)- + Real.sqrt (-2*eminus)) 1 P) atTop (𝓝 0)) := by + obtain ⟨ep,hpp,hpL1,hpmean,hpt⟩ := gaussianPattern_ground_limit + hhaar hgauss hpub α hα hmp hds P Z hZ hlaw 1 + obtain ⟨em,hmpb,hmL1,hmmean,hmt⟩ := gaussianPattern_ground_limit + hhaar hgauss hpub α hα hmp hds P Z hZ hlaw (-1) + have hp0 : 0 ≤ ep := le_of_tendsto_of_tendsto tendsto_const_nhds hpmean + (Filter.Eventually.of_forall fun k => integral_nonneg fun ω => + gaussianPatternGroundEnergy_nonneg 1 zero_le_one _) + have hm0 : em ≤ 0 := le_of_tendsto_of_tendsto hmmean tendsto_const_nhds + (Filter.Eventually.of_forall fun k => integral_nonpos fun ω => + gaussianPatternGroundEnergy_nonpos (-1) (by norm_num) _) + have hp := random_sqrt_scaled_limit P _ ep 2 (by norm_num) + (fun k => (measurable_gaussianPatternGroundEnergy _ _ 1).comp (hZ (k+1))) + (gaussianPattern_ground_uniformIntegrable α hα hds P Z hZ hlaw 1) hpp + have hm := random_sqrt_scaled_limit P _ em (-2) (by norm_num) + (fun k => (measurable_gaussianPatternGroundEnergy _ _ (-1)).comp (hZ (k+1))) + (gaussianPattern_ground_uniformIntegrable α hα hds P Z hZ hlaw (-1)) hmpb + have heqplus (k : ℕ) (ω : Ω) : Real.sqrt (2*gaussianPatternGroundEnergy 1 (Z (k+1) ω))= + ‖gaussianPatternOperator (Z (k+1) ω)‖/(k+1) := by + simpa only [Nat.cast_succ] using + gaussianPattern_max_sqrt (Nat.succ_pos k) (Z (k+1) ω) + have heqminus (k : ℕ) (ω : Ω) : Real.sqrt (-2*gaussianPatternGroundEnergy (-1) (Z (k+1) ω))= + (Finset.univ.inf' Finset.univ_nonempty + (fun σ : Spin (k+1) => ‖gaussianPatternSum (Z (k+1) ω) σ‖))/(k+1) := by + simpa only [Nat.cast_succ] using + gaussianPattern_min_sqrt (Nat.succ_pos k) (Z (k+1) ω) + simp only [Function.comp_apply,heqplus] at hp + simp only [Function.comp_apply,heqminus] at hm + refine ⟨ep,em,hp0,hm0,?_,?_,hp,hm⟩ + · simpa only [one_mul] using hpt + · simpa only [neg_one_mul] using hmt + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternEigenvalueMeasurability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternEigenvalueMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..41a2ee97c3d06b95523348bc7b4731d831f9c3af --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternEigenvalueMeasurability.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Spectral.HermitianEigenvalueLimits + +namespace OAI + +/-! Measurability of the actual sorted Gaussian Gram spectrum, including repeated zero roots. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix Filter +open scoped Topology Matrix.Norms.L2Operator +namespace InvariantIsing + +lemma continuous_hermitian_eigenvalues₀ {X : Type*} [TopologicalSpace X] [SequentialSpace X] + {N : ℕ} (A : X → Matrix (Fin N) (Fin N) ℝ) (hA : ∀ x, (A x).IsHermitian) + (hc : Continuous A) : Continuous (fun x => (hA x).eigenvalues₀) := by + apply SeqContinuous.continuous + intro x p hp + exact hermitian_eigenvalues₀_tendsto (fun n => A (x n)) (fun n => hA (x n)) (A p) (hA p) + ((hc.tendsto p).comp hp) + +lemma continuous_hermitian_eigenvalues {X : Type*} [TopologicalSpace X] [SequentialSpace X] + {N : ℕ} (A : X → Matrix (Fin N) (Fin N) ℝ) (hA : ∀ x, (A x).IsHermitian) + (hc : Continuous A) : Continuous (fun x => (hA x).eigenvalues) := by + apply continuous_pi + intro i + exact (continuous_apply _).comp (continuous_hermitian_eigenvalues₀ A hA hc) + +lemma continuous_gaussianPatternCoupling (N m : ℕ) (c : ℝ) : + Continuous (gaussianPatternCoupling (N := N) (m := m) c) := by + unfold gaussianPatternCoupling gaussianPatternArray + fun_prop + +theorem continuous_gaussianPatternEigenvalues (N m : ℕ) : + Continuous (gaussianPatternEigenvalues (N := N) (m := m)) := by + unfold gaussianPatternEigenvalues + exact continuous_hermitian_eigenvalues (gaussianPatternCoupling 1) + (gaussianPatternCoupling_isHermitian 1) (continuous_gaussianPatternCoupling N m 1) + +theorem measurable_gaussianPatternEigenvalues (N m : ℕ) : + Measurable (gaussianPatternEigenvalues (N := N) (m := m)) := + (continuous_gaussianPatternEigenvalues N m).measurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternEuclideanNorm.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternEuclideanNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1de9c2e82d1ac5ad815d34c21459bdea2750cec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternEuclideanNorm.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternEigenvalueMeasurability + +namespace OAI + +/-! The Euclidean operator norm of the physical Gaussian array is 1-Lipschitz. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators +namespace InvariantIsing + +def gaussianPatternEuclideanOperator {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + EuclideanSpace ℝ (Fin m) →L[ℝ] EuclideanSpace ℝ (Fin N) := + (gaussianPatternArray z).toEuclideanLin.toContinuousLinearMap + +open scoped Matrix.Norms.Frobenius in +lemma gaussianPattern_frobenius {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ‖gaussianPatternArray z‖ = ‖z‖ := by + rw [Matrix.frobenius_norm_def,PiLp.norm_eq_of_L2,Real.sqrt_eq_rpow] + congr 1 + simp only [gaussianPatternArray,Fintype.sum_prod_type,Real.norm_eq_abs,Real.rpow_two, sq_abs] + +open scoped Matrix.Norms.Frobenius in +lemma gaussianPatternEuclideanOperator_bound {N m : ℕ} + (z : EuclideanSpace ℝ (Fin N × Fin m)) (x : EuclideanSpace ℝ (Fin m)) : + ‖gaussianPatternEuclideanOperator z x‖ ≤ ‖z‖ * ‖x‖ := by + have h := Matrix.frobenius_norm_mul (gaussianPatternArray z) + (Matrix.replicateCol Unit (fun j => x j)) + rw [← Matrix.replicateCol_mulVec,Matrix.frobenius_norm_replicateCol, + Matrix.frobenius_norm_replicateCol,gaussianPattern_frobenius] at h + exact h + +lemma gaussianPatternEuclideanOperator_norm_le {N m : ℕ} + (z : EuclideanSpace ℝ (Fin N × Fin m)) : ‖gaussianPatternEuclideanOperator z‖ ≤ ‖z‖ := + (gaussianPatternEuclideanOperator z).opNorm_le_bound (norm_nonneg _) + (gaussianPatternEuclideanOperator_bound z) + +lemma gaussianPatternEuclideanOperator_sub {N m : ℕ} + (z w : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternEuclideanOperator (z-w) = + gaussianPatternEuclideanOperator z-gaussianPatternEuclideanOperator w := by + unfold gaussianPatternEuclideanOperator + rw [show gaussianPatternArray (z-w) = gaussianPatternArray z-gaussianPatternArray w from rfl, + map_sub,map_sub] + +def gaussianPatternSingularMax {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := + ‖gaussianPatternEuclideanOperator z‖ + +theorem gaussianPatternSingularMax_lipschitz (N m : ℕ) : + LipschitzWith 1 (gaussianPatternSingularMax (N := N) (m := m)) := by + apply LipschitzWith.of_dist_le_mul + intro z w + simp only [NNReal.coe_one,one_mul,dist_eq_norm,gaussianPatternSingularMax] + calc + _ ≤ ‖gaussianPatternEuclideanOperator z-gaussianPatternEuclideanOperator w‖ := + abs_norm_sub_norm_le _ _ + _ = ‖gaussianPatternEuclideanOperator (z-w)‖ := by rw [gaussianPatternEuclideanOperator_sub] + _ ≤ ‖z-w‖ := gaussianPatternEuclideanOperator_norm_le _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternGroundFinite.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternGroundFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..1460ce35af0c79165d6928293ee1be8f10893fc6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternGroundFinite.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternOrbit +import OAI.Probability.InvariantIsing.Pressure.GroundStateFinite +import OAI.Probability.InvariantIsing.Pressure.RandomSpectralMeasurability + +namespace OAI + +/-! Actual Gaussian-pattern maximum energies and their finite-temperature squeeze. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators Classical +namespace InvariantIsing + +def gaussianPatternGroundEnergy {N m : ℕ} (ε : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := + (N : ℝ)⁻¹*Finset.univ.sup' Finset.univ_nonempty + (fun σ : Spin N => ε/(2*N)*‖gaussianPatternSum z σ‖^2) + +lemma measurable_gaussianPatternGroundEnergy (N m : ℕ) (ε : ℝ) : + Measurable (gaussianPatternGroundEnergy (N := N) (m := m) ε) := by + have hm (σ : Spin N) : Measurable (fun z : EuclideanSpace ℝ (Fin N × Fin m) => + ε/(2*N)*‖gaussianPatternSum z σ‖^2) := by + have hs : Continuous (fun z : EuclideanSpace ℝ (Fin N × Fin m) => gaussianPatternSum z σ) := by + unfold gaussianPatternSum gaussianPatternArray + fun_prop + exact (hs.measurable.norm.pow_const 2).const_mul _ + have hh := Finset.measurable_sup' Finset.univ_nonempty (fun σ _ => hm σ) + convert hh.const_mul (N : ℝ)⁻¹ using 1 + funext z + simp only [gaussianPatternGroundEnergy,Finset.sup'_apply] + +lemma gaussianPatternGroundEnergy_squeeze {N m : ℕ} (hN : 0 < N) (ε β : ℝ) + (hβ : 0 < β) (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternPressure (ε*β) z/β ≤ gaussianPatternGroundEnergy ε z ∧ + gaussianPatternGroundEnergy ε z ≤ gaussianPatternPressure (ε*β) z/β+Real.log 2/β := by + let E := fun σ : Spin N => ε/(2*N)*‖gaussianPatternSum z σ‖^2 + have hval : (N : ℝ)*gaussianPatternGroundEnergy ε z= + Finset.univ.sup' Finset.univ_nonempty E := by + unfold gaussianPatternGroundEnergy + rw [← mul_assoc,mul_inv_cancel₀ (show (N : ℝ) ≠ 0 by exact_mod_cast hN.ne'),one_mul] + have hb : ∀ σ, E σ ≤ N*gaussianPatternGroundEnergy ε z := by + rw [hval] + exact fun σ => Finset.le_sup' E (Finset.mem_univ σ) + have ha : ∃ σ, E σ=N*gaussianPatternGroundEnergy ε z := by + obtain ⟨σ,_,hσ⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty E + exact ⟨σ,hσ.symm.trans hval.symm⟩ + have hh := finite_groundState_squeeze hN E β (gaussianPatternGroundEnergy ε z) hβ hb ha + have hp : gaussianPatternPressure (ε*β) z=(N : ℝ)⁻¹*logPartition (fun σ => β*E σ) := by + unfold gaussianPatternPressure + congr 2 + funext σ + dsimp [E] + ring + rw [hp] + exact ⟨hh.2,by linarith [hh.1]⟩ + +lemma gaussianPatternGroundEnergy_orbit {N m : ℕ} (ε : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ∃ V : Orthogonal N, gaussianPatternGroundEnergy ε z= + groundStateEnergy (fun i => ε*gaussianPatternEigenvalues z i) (matrixRotation V⁻¹) := by + obtain ⟨V,hV⟩ := gaussianPattern_diagonalization z + refine ⟨V,?_⟩ + have he (σ : Spin N) : ε/(2*N)*‖gaussianPatternSum z σ‖^2= + rotatedEnergy (fun i => ε*gaussianPatternEigenvalues z i) (matrixRotation V⁻¹) σ := by + rw [← gaussianPattern_energy,gaussianPatternCoupling_smul,hV,cavityConjugate_diagonal_smul] + exact cavityQuadratic_inverse_rotation _ V σ + unfold gaussianPatternGroundEnergy groundStateEnergy + simp only [he] + +lemma abs_gaussianPatternGroundEnergy_le {n m : ℕ} (ε : ℝ) + (z : EuclideanSpace ℝ (Fin (n+1) × Fin m)) : + |gaussianPatternGroundEnergy ε z| ≤ + spectralRadius (fun i => ε*gaussianPatternEigenvalues z i)/2 := by + obtain ⟨V,hV⟩ := gaussianPatternGroundEnergy_orbit ε z + rw [hV] + exact abs_groundStateEnergy_le (Nat.succ_pos n) _ _ _ (abs_le_spectralRadius _) + +lemma gaussianPatternGroundEnergy_nonneg {N m : ℕ} (ε : ℝ) (hε : 0 ≤ ε) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : 0 ≤ gaussianPatternGroundEnergy ε z := by + apply mul_nonneg (by positivity) + exact (mul_nonneg (div_nonneg hε (by positivity)) (sq_nonneg _)).trans + (Finset.le_sup' (fun σ : Spin N => ε/(2*N)*‖gaussianPatternSum z σ‖^2) + (Finset.mem_univ (fun _ => false))) + +lemma gaussianPatternGroundEnergy_nonpos {N m : ℕ} (ε : ℝ) (hε : ε ≤ 0) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : gaussianPatternGroundEnergy ε z ≤ 0 := by + apply mul_nonpos_of_nonneg_of_nonpos (by positivity) + apply Finset.sup'_le + intro σ _ + exact mul_nonpos_of_nonpos_of_nonneg (div_nonpos_of_nonpos_of_nonneg hε (by positivity)) (sq_nonneg _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternGroundLimit.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternGroundLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..089e0583a7085f2f9b16a3ac0031c976c79df9aa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternGroundLimit.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternPressureLimit +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternGroundFinite +import OAI.Probability.InvariantIsing.Pressure.RandomGroundLimit + +namespace OAI + +/-! Subsequent zero-temperature limits for both signs of the Gaussian energy. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +universe u +namespace InvariantIsing + +lemma gaussianPattern_ground_uniformIntegrable + (α : ℝ) (hα : 0 < α) (hds : DavidsonSzarekInput.{u} α hα) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, Measurable (Z N)) (hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) + (ε : ℝ) : UniformIntegrable (fun k ω => gaussianPatternGroundEnergy ε (Z (k+1) ω)) 1 P := by + apply uniformIntegrable_of_abs_le P _ _ + (fun k => ((measurable_gaussianPatternGroundEnergy _ _ ε).comp (hZ (k+1))).aestronglyMeasurable) + (hds.uniform_integrable P Z hlaw ε) + intro k + filter_upwards [] with ω + have hr : 0 ≤ spectralRadius (fun i => ε*gaussianPatternEigenvalues (Z (k+1) ω) i) := + (abs_nonneg (ε*gaussianPatternEigenvalues (Z (k+1) ω) 0)).trans (abs_le_spectralRadius (fun i => ε*gaussianPatternEigenvalues (Z (k+1) ω) i) 0) + exact (abs_gaussianPatternGroundEnergy_le ε _).trans ((half_le_self hr).trans (le_abs_self _)) + +theorem gaussianPattern_ground_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (α : ℝ) (hα : 0 < α) (hmp : MarchenkoPasturInput.{u} α hα) + (hds : DavidsonSzarekInput.{u} α hα) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, Measurable (Z N)) (hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) + (ε : ℝ) : + ∃ e : ℝ, + TendstoInMeasure P (fun k ω => gaussianPatternGroundEnergy ε (Z (k+1) ω)) atTop (fun _ => e) ∧ + Tendsto (fun k => eLpNorm (fun ω => gaussianPatternGroundEnergy ε (Z (k+1) ω)-e) 1 P) + atTop (𝓝 0) ∧ + Tendsto (fun k => ∫ ω, gaussianPatternGroundEnergy ε (Z (k+1) ω) ∂P) atTop (𝓝 e) ∧ + Tendsto (fun β => gaussianPatternLimit α (ε*β)/β) atTop (𝓝 e) := by + apply random_ground_limit P + (fun β k ω => gaussianPatternPressure (ε*β) (Z (k+1) ω)) + (fun k ω => gaussianPatternGroundEnergy ε (Z (k+1) ω)) + (fun β => gaussianPatternLimit α (ε*β)) (Real.log 2) + (Real.log_pos (by norm_num : (1 : ℝ)<2)).le + (gaussianPattern_ground_uniformIntegrable α hα hds P Z hZ hlaw ε) + · intro β k + exact (measurable_gaussianPatternPressure _ _ _).comp (hZ (k+1)) + · intro β _ k + exact memLp_one_iff_integrable.mp + ((gaussianPattern_pressure_uniformIntegrable α hα hmp hds P Z hZ hlaw (ε*β)).memLp k) + · intro β _ + exact (gaussianPattern_pressure_limit hhaar hgauss hpub α hα hmp hds P Z hZ hlaw (ε*β)).1 + · intro β _ + exact (gaussianPattern_pressure_limit hhaar hgauss hpub α hα hmp hds P Z hZ hlaw (ε*β)).2.2 + · intro β hβ k ω + exact gaussianPatternGroundEnergy_squeeze (Nat.succ_pos k) ε β hβ _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternModel.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..20bf705f396e016932e35975af90bc76e0742955 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternModel.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityGaussianRotation +import Mathlib.Analysis.Matrix.Spectrum + +namespace OAI + +/-! The Gaussian-pattern Hamiltonian with its diagonal self-interactions. +The array is indexed by spin coordinate first and pattern coordinate second. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators +namespace InvariantIsing + +def gaussianPatternArray {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + Matrix (Fin N) (Fin m) ℝ := fun i j => z (i,j) + +def gaussianPatternCoupling {N m : ℕ} (c : ℝ) (z : EuclideanSpace ℝ (Fin N × Fin m)) : + Matrix (Fin N) (Fin N) ℝ := + (c/N) • (gaussianPatternArray z * (gaussianPatternArray z)ᵀ) + +def gaussianPatternSum {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) (σ : Spin N) : + EuclideanSpace ℝ (Fin m) := + WithLp.toLp 2 ((gaussianPatternArray z)ᵀ *ᵥ (fun i => spinValue (σ i))) + +def gaussianPatternPressure {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := + (N : ℝ)⁻¹*logPartition (fun σ : Spin N => c/(2*N)*‖gaussianPatternSum z σ‖^2) + +lemma gaussianPatternCoupling_isHermitian {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : (gaussianPatternCoupling c z).IsHermitian := by + exact (Matrix.isHermitian_mul_conjTranspose_self (gaussianPatternArray z)).smul rfl + +lemma quadraticEnergy_dotProduct {N : ℕ} (J : Matrix (Fin N) (Fin N) ℝ) (σ : Spin N) : + quadraticEnergy J σ=(1/2 : ℝ)* + ((fun i => spinValue (σ i)) ⬝ᵥ J *ᵥ (fun i => spinValue (σ i))) := by + simp only [quadraticEnergy,dotProduct,Matrix.mulVec,Finset.mul_sum,mul_assoc] + +lemma gaussianPattern_energy {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) (σ : Spin N) : + quadraticEnergy (gaussianPatternCoupling c z) σ=c/(2*N)*‖gaussianPatternSum z σ‖^2 := by + let v := fun i => spinValue (σ i) + have hn : ‖gaussianPatternSum z σ‖^2= + ((gaussianPatternArray z)ᵀ *ᵥ v) ⬝ᵥ ((gaussianPatternArray z)ᵀ *ᵥ v) := by + rw [EuclideanSpace.real_norm_sq_eq] + simp only [gaussianPatternSum,dotProduct,pow_two] + rfl + rw [quadraticEnergy_dotProduct,gaussianPatternCoupling,Matrix.smul_mulVec,dotProduct_smul, + ← Matrix.mulVec_mulVec,hn] + rw [Matrix.dotProduct_transpose_mulVec] + simp only [smul_eq_mul] + ring + +lemma gaussianPatternPressure_eq {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternPressure c z=pressure (gaussianPatternCoupling c z) (fun _ => 0) := by + simp only [gaussianPatternPressure,pressure,gaussianPattern_energy,fieldEnergy, + zero_mul,Finset.sum_const_zero,add_zero] + +lemma measurable_gaussianPatternPressure (N m : ℕ) (c : ℝ) : + Measurable (gaussianPatternPressure (N := N) (m := m) c) := by + unfold gaussianPatternPressure logPartition + have hm (σ : Spin N) : Measurable (fun z : EuclideanSpace ℝ (Fin N × Fin m) => + c/(2*N)*‖gaussianPatternSum z σ‖^2) := by + have hs : Continuous (fun z : EuclideanSpace ℝ (Fin N × Fin m) => gaussianPatternSum z σ) := by + unfold gaussianPatternSum gaussianPatternArray + fun_prop + exact (hs.measurable.norm.pow_const 2).const_mul _ + exact ((Finset.measurable_sum _ fun σ _ => (hm σ).exp).const_mul _).log.const_mul _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternNorms.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternNorms.lean new file mode 100644 index 0000000000000000000000000000000000000000..729bed79d089274049d6782ff9630ddf6dc75886 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternNorms.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternGroundFinite +import OAI.Probability.InvariantIsing.Core.CubeOperatorNorm +import OAI.Probability.InvariantIsing.Core.FiniteSquareExtrema +import OAI.Probability.InvariantIsing.Core.FiniteOperatorDuality + +namespace OAI + +/-! Exact finite Gaussian norm and minimum identities. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped Classical BigOperators +namespace InvariantIsing + +def gaussianPatternColumn {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (i : Fin N) : EuclideanSpace ℝ (Fin m) := WithLp.toLp 2 (fun j => z (i,j)) + +lemma gaussianPatternSum_eq_sum {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) (σ : Spin N) : + gaussianPatternSum z σ=∑ i, spinValue (σ i) • gaussianPatternColumn z i := by + ext j + simp [gaussianPatternSum,gaussianPatternArray,gaussianPatternColumn,Matrix.mulVec, + dotProduct,mul_comm] + +def gaussianPatternOperator {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + (Fin N → ℝ) →L[ℝ] EuclideanSpace ℝ (Fin m) := + (PiLp.continuousLinearEquiv 2 ℝ (fun _ : Fin m => ℝ)).symm.toContinuousLinearMap.comp + ((gaussianPatternArray z)ᵀ.mulVecLin.toContinuousLinearMap) + +def gaussianPatternTransposeOperator {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + EuclideanSpace ℝ (Fin m) →L[ℝ] PiLp 1 (fun _ : Fin N => ℝ) := + ((PiLp.continuousLinearEquiv 1 ℝ (fun _ : Fin N => ℝ)).symm.toContinuousLinearMap.comp + ((gaussianPatternArray z).mulVecLin.toContinuousLinearMap)).comp + (PiLp.continuousLinearEquiv 2 ℝ (fun _ : Fin m => ℝ)).toContinuousLinearMap + +lemma gaussianPattern_transpose_norm {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ‖gaussianPatternTransposeOperator z‖=‖gaussianPatternOperator z‖ := by + apply finite_operator_duality + intro x y + rw [EuclideanSpace.inner_eq_star_dotProduct] + change (fun j => y j) ⬝ᵥ ((gaussianPatternArray z)ᵀ *ᵥ x)= + x ⬝ᵥ ((gaussianPatternArray z) *ᵥ (fun j => y j)) + exact Matrix.dotProduct_transpose_mulVec _ _ _ + +lemma gaussianPatternOperator_spin {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (σ : Spin N) : gaussianPatternOperator z (fun i => spinValue (σ i))=gaussianPatternSum z σ := rfl + +lemma gaussianPatternOperator_norm {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ‖gaussianPatternOperator z‖=Finset.univ.sup' Finset.univ_nonempty + (fun σ : Spin N => ‖gaussianPatternSum z σ‖) := cube_operator_norm _ + +lemma gaussianPattern_max_sqrt {N m : ℕ} (hN : 0 < N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + Real.sqrt (2*gaussianPatternGroundEnergy 1 z)=‖gaussianPatternOperator z‖/N := by + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + have he : 2*gaussianPatternGroundEnergy 1 z=(‖gaussianPatternOperator z‖/N)^2 := by + rw [gaussianPatternOperator_norm,gaussianPatternGroundEnergy, + finite_sup_square (fun σ : Spin N => ‖gaussianPatternSum z σ‖) (fun _ => norm_nonneg _) + (1/(2*N)) (by positivity)] + field_simp + rw [he,Real.sqrt_sq (div_nonneg (norm_nonneg _) (Nat.cast_nonneg N))] + +lemma gaussianPattern_min_sqrt {N m : ℕ} (hN : 0 < N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + Real.sqrt (-2*gaussianPatternGroundEnergy (-1) z)= + (Finset.univ.inf' Finset.univ_nonempty (fun σ : Spin N => ‖gaussianPatternSum z σ‖))/N := by + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + let M := Finset.univ.inf' Finset.univ_nonempty (fun σ : Spin N => ‖gaussianPatternSum z σ‖) + have hM : 0 ≤ M := Finset.le_inf' Finset.univ_nonempty (fun σ : Spin N => ‖gaussianPatternSum z σ‖) (fun σ _ => norm_nonneg _) + have he : -2*gaussianPatternGroundEnergy (-1) z=(M/N)^2 := by + unfold gaussianPatternGroundEnergy + have hs := finite_sup_neg_square (fun σ : Spin N => ‖gaussianPatternSum z σ‖) + (fun _ => norm_nonneg _) (1/(2*N)) (by positivity) + simp only [neg_div] + rw [hs] + dsimp [M] + field_simp + rw [he,Real.sqrt_sq (div_nonneg hM (Nat.cast_nonneg N))] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternOrbit.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..faf5bf7ca8df7027fe0ec8545d033aa4b3424f16 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternOrbit.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternRotation +import OAI.Probability.InvariantIsing.Cavity.CavityQuadraticCompression +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitLaw + +namespace OAI + +/-! Pointwise diagonalization of the actual Gaussian-pattern pressure. No +measurable choice of eigenvectors is required for Haar averaging. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma pressure_conjugate_diagonal {N : ℕ} (eig : Fin N → ℝ) (U : Orthogonal N) : + pressure (cavityConjugate U (Matrix.diagonal eig)) (fun _ => 0)= + dataPhysicalPressure (eig,fun _ => 0) U := by + unfold pressure dataPhysicalPressure rotatedPressure + congr 2 + funext σ + exact congrArg (fun x => x+fieldEnergy (fun _ => 0) σ) + (cavityQuadratic_inverse_rotation eig U σ) + +lemma gaussianPatternCoupling_smul {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternCoupling c z=c • gaussianPatternCoupling 1 z := by + simp only [gaussianPatternCoupling,smul_smul,one_div] + rw [div_eq_mul_inv] + +lemma cavityConjugate_diagonal_smul {N : ℕ} (c : ℝ) (U : Orthogonal N) (eig : Fin N → ℝ) : + c • cavityConjugate U (Matrix.diagonal eig)= + cavityConjugate U (Matrix.diagonal (fun i => c*eig i)) := by + have hd : Matrix.diagonal (fun i => c*eig i)=c • Matrix.diagonal eig := by + ext i j + by_cases h : i=j <;> simp [h] + rw [hd] + simp only [cavityConjugate,smul_mul_assoc,mul_smul_comm] + +lemma gaussianPattern_diagonalization {N m : ℕ} + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ∃ V : Orthogonal N, gaussianPatternCoupling 1 z= + cavityConjugate V (Matrix.diagonal (gaussianPatternEigenvalues z)) := by + let hA := gaussianPatternCoupling_isHermitian 1 z + refine ⟨hA.eigenvectorUnitary,?_⟩ + simpa [cavityConjugate,Unitary.conjStarAlgAut_apply,Function.comp_def, + gaussianPatternEigenvalues,hA,Matrix.star_eq_conjTranspose, + Matrix.conjTranspose_eq_transpose_of_trivial] using hA.spectral_theorem + +lemma gaussianPattern_pressure_orbit {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + ∃ V : Orthogonal N, ∀ U : Orthogonal N, + gaussianPatternPressure c (cavityColumnRotation m (matrixRotation U) z)= + dataPhysicalPressure ((fun i => c*gaussianPatternEigenvalues z i),fun _ => 0) (U*V) := by + obtain ⟨V,hV⟩ := gaussianPattern_diagonalization z + refine ⟨V,fun U => ?_⟩ + rw [gaussianPatternPressure_eq,gaussianPatternCoupling_rotation, + gaussianPatternCoupling_smul,hV,cavityConjugate_diagonal_smul] + change pressure (cavityConjugate U (cavityConjugate V + (Matrix.diagonal (fun i => c*gaussianPatternEigenvalues z i)))) (fun _ => 0)=_ + rw [← cavityConjugate_mul,pressure_conjugate_diagonal] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternOrbitLaw.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternOrbitLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..82993963b6c4597154a4804153fdcf87b9b114fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternOrbitLaw.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternOrbit +import OAI.Probability.InvariantIsing.Pressure.PhysicalOrbitKernel + +namespace OAI + +/-! Haar disintegration of the actual Gaussian-pattern pressure, proved from +finite Gaussian invariance and pointwise spectral diagonalization. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma continuous_gaussianPatternRotation (N m : ℕ) : + Continuous (fun p : Orthogonal N × EuclideanSpace ℝ (Fin N × Fin m) => + cavityColumnRotation m (matrixRotation p.1) p.2) := by + change Continuous (fun p : Orthogonal N × EuclideanSpace ℝ (Fin N × Fin m) => + WithLp.toLp 2 (fun ij : Fin N × Fin m => ∑ k, (p.1 : Matrix (Fin N) (Fin N) ℝ) ij.1 k * p.2 (k,ij.2))) + apply (PiLp.continuous_toLp 2 _).comp + apply continuous_pi + intro ij + apply continuous_finsetSum + intro k _ + have hU : Continuous (fun p : Orthogonal N × EuclideanSpace ℝ (Fin N × Fin m) => + (p.1 : Matrix (Fin N) (Fin N) ℝ)) := continuous_subtype_val.comp continuous_fst + have hu : Continuous (fun p : Orthogonal N × EuclideanSpace ℝ (Fin N × Fin m) => + (p.1 : Matrix (Fin N) (Fin N) ℝ) ij.1 k) := + (continuous_apply k).comp ((continuous_apply ij.1).comp hU) + exact hu.mul ((PiLp.continuous_apply 2 _ (k,ij.2)).comp continuous_snd) + +lemma gaussianPattern_orbit_kernel {N m : ℕ} (hN : 0 < N) (c : ℝ) + (H : Measure (Orthogonal N)) [IsProbabilityMeasure H] [H.IsMulRightInvariant] + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + H.map (fun U => (((fun i => c*gaussianPatternEigenvalues z i),fun _ : Fin N => (0 : ℝ)), + gaussianPatternPressure c (cavityColumnRotation m (matrixRotation U) z)))= + H.map (fun U => (((fun i => c*gaussianPatternEigenvalues z i),fun _ : Fin N => (0 : ℝ)), + dataPhysicalPressure ((fun i => c*gaussianPatternEigenvalues z i),fun _ => 0) U)) := by + obtain ⟨V,hV⟩ := gaussianPattern_pressure_orbit c z + exact physical_orbit_kernel hN H _ _ V hV + +theorem gaussianPattern_conditionalOrbit {N m : ℕ} (hN : 0 < N) (c : ℝ) + (heig : Measurable (gaussianPatternEigenvalues (N := N) (m := m))) + (H : Measure (Orthogonal N)) [IsProbabilityMeasure H] [H.IsMulRightInvariant] : + ConditionalFieldOrbitLaw (stdGaussian (EuclideanSpace ℝ (Fin N × Fin m))) + (fun z => ((fun i => c*gaussianPatternEigenvalues z i),fun _ => 0)) + (gaussianPatternPressure c) H := by + let d : EuclideanSpace ℝ (Fin N × Fin m) → FieldSpectralData N := fun z => + ((fun i => c*gaussianPatternEigenvalues z i),fun _ => 0) + have hd : Measurable d := (measurable_pi_iff.mpr fun i => + ((measurable_pi_apply i).comp heig).const_mul c).prodMk measurable_const + have hi : ∀ (U : Orthogonal N) (z : EuclideanSpace ℝ (Fin N × Fin m)), + d (cavityColumnRotation m (matrixRotation U) z)=d z := by + intro U z + simp only [d,gaussianPatternEigenvalues_rotation] + exact invariant_joint_orbit_law (stdGaussian (EuclideanSpace ℝ (Fin N × Fin m))) H + (fun U z => cavityColumnRotation m (matrixRotation U) z) + (continuous_gaussianPatternRotation N m).measurable + (fun U => cavityColumnRotation_gaussian (matrixRotation U)) d + (gaussianPatternPressure c) hd (measurable_gaussianPatternPressure N m c) hi + dataPhysicalPressure (measurable_dataPhysicalPressure hN) + (gaussianPattern_orbit_kernel hN c H) + +theorem gaussianPattern_conditionalOrbit_hasLaw {Ω : Type*} [MeasurableSpace Ω] + {N m : ℕ} (hN : 0 < N) (c : ℝ) (P : Measure Ω) + (Z : Ω → EuclideanSpace ℝ (Fin N × Fin m)) (hZ : Measurable Z) + (hlaw : HasLaw Z (stdGaussian _) P) + (heig : Measurable (gaussianPatternEigenvalues (N := N) (m := m))) + (H : Measure (Orthogonal N)) [IsProbabilityMeasure H] [H.IsMulRightInvariant] : + ConditionalFieldOrbitLaw P + (fun ω => ((fun i => c*gaussianPatternEigenvalues (Z ω) i),fun _ => 0)) + (fun ω => gaussianPatternPressure c (Z ω)) H := by + let d := fun z : EuclideanSpace ℝ (Fin N × Fin m) => + ((fun i => c*gaussianPatternEigenvalues z i),fun _ : Fin N => (0 : ℝ)) + have hd : Measurable d := (measurable_pi_iff.mpr fun i => + ((measurable_pi_apply i).comp heig).const_mul c).prodMk measurable_const + have hp := measurable_gaussianPatternPressure N m c + have hdm : P.map (fun ω => d (Z ω))=(stdGaussian _).map d := by + change P.map (d ∘ Z)=_ + rw [← Measure.map_map hd hZ,hlaw.map_eq] + have hym : P.map (fun ω => (d (Z ω),gaussianPatternPressure c (Z ω)))= + (stdGaussian _).map (fun z => (d z,gaussianPatternPressure c z)) := by + change P.map ((fun z => (d z,gaussianPatternPressure c z)) ∘ Z)=_ + rw [← Measure.map_map (hd.prodMk hp) hZ,hlaw.map_eq] + change P.map (fun ω => (d (Z ω),gaussianPatternPressure c (Z ω)))= + ((P.map (fun ω => d (Z ω))).prod H).map _ + rw [hym,hdm] + exact gaussianPattern_conditionalOrbit hN c heig H + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternPressureLimit.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternPressureLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..9253cc3bbf44d8b4e50b57afd268c02f4e0cc6b8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternPressureLimit.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternPublishedInputs +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternZeroOrbit +import OAI.Probability.InvariantIsing.Fields.CanonicalOrthogonalLaw + +namespace OAI + +/-! The Gaussian-pattern pressure limit from Haar concentration, cascade +identities, Marchenko–Pastur convergence, and spectral edge estimates. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +universe u +namespace InvariantIsing + +def gaussianPatternLimit (α c : ℝ) : ℝ := + (variationalFunctional (measureR + ((marchenkoPasturMeasure α).map (fun x => c*x)) + (max (c*marchenkoPasturLower α) (c*marchenkoPasturB α)))).toReal + +theorem gaussianPattern_pressure_uniformIntegrable + (α : ℝ) (hα : 0 < α) (hmp : MarchenkoPasturInput.{u} α hα) + (hds : DavidsonSzarekInput.{u} α hα) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, Measurable (Z N)) (hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) + (c : ℝ) : UniformIntegrable (fun k ω => gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω)) 1 P := by + let : ∀ N, IsProbabilityMeasure (orthogonalGaussianHaar N) := + fun N => orthogonalGaussianHaar_probability N + let : ∀ N, (orthogonalGaussianHaar N).IsMulRightInvariant := + fun N => orthogonalGaussianHaar_rightInvariant N + let eig := fun (N : ℕ) (ω : Ω) (i : Fin N) => c*gaussianPatternEigenvalues (N := N) (m := gaussianPatternCount α N) (Z N ω) i + let Y := fun (N : ℕ) (ω : Ω) => gaussianPatternPressure (N := N) (m := gaussianPatternCount α N) c (Z N ω) + have heig (N : ℕ) : Measurable (eig N) := by + exact measurable_pi_iff.mpr fun i => + (((measurable_pi_apply i).comp (hmp.measurable_eigenvalues N)).comp (hZ N)).const_mul c + have hY (N : ℕ) : Measurable (Y N) := + (measurable_gaussianPatternPressure N _ c).comp (hZ N) + have horbit (N : ℕ) : ConditionalFieldOrbitLaw P + (fun ω => (eig N ω,fun _ => 0)) (Y N) (orthogonalGaussianHaar N) := by + exact gaussianPattern_conditionalOrbit_all c P (Z N) (hZ N) (hlaw N) + (hmp.measurable_eigenvalues N) _ + have hspec := hds.uniform_integrable P Z hlaw c + change UniformIntegrable (fun k ω => spectralRadius (eig (k+1) ω)) 1 P at hspec + change UniformIntegrable (fun k => Y (k+1)) 1 P + exact random_pressure_uniformIntegrable_of_spectralRadius P eig Y heig hY + orthogonalGaussianHaar horbit hspec + +theorem gaussianPattern_pressure_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (α : ℝ) (hα : 0 < α) (hmp : MarchenkoPasturInput.{u} α hα) + (hds : DavidsonSzarekInput.{u} α hα) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, Measurable (Z N)) (hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) + (c : ℝ) : + TendstoInMeasure P (fun k ω => gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω)) atTop + (fun _ => gaussianPatternLimit α c) ∧ + Tendsto (fun k => eLpNorm (fun ω => gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω)- + gaussianPatternLimit α c) 1 P) atTop (𝓝 0) ∧ + Tendsto (fun k => ∫ ω, gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω) ∂P) atTop + (𝓝 (gaussianPatternLimit α c)) := by + let : ∀ N, IsProbabilityMeasure (orthogonalGaussianHaar N) := + fun N => orthogonalGaussianHaar_probability N + let : ∀ N, (orthogonalGaussianHaar N).IsMulRightInvariant := + fun N => orthogonalGaussianHaar_rightInvariant N + let eig := fun (N : ℕ) (ω : Ω) (i : Fin N) => c*gaussianPatternEigenvalues (N := N) (m := gaussianPatternCount α N) (Z N ω) i + let Y := fun (N : ℕ) (ω : Ω) => gaussianPatternPressure (N := N) (m := gaussianPatternCount α N) c (Z N ω) + have heig (N : ℕ) : Measurable (eig N) := by + apply measurable_pi_iff.mpr + intro i + exact (((measurable_pi_apply i).comp (hmp.measurable_eigenvalues N)).comp (hZ N)).const_mul c + have hY (N : ℕ) : Measurable (Y N) := + (measurable_gaussianPatternPressure N _ c).comp (hZ N) + have horbit (N : ℕ) : ConditionalFieldOrbitLaw P + (fun ω => (eig N ω,fun _ => 0)) (Y N) (orthogonalGaussianHaar N) := by + exact gaussianPattern_conditionalOrbit_all c P (Z N) (hZ N) (hlaw N) + (hmp.measurable_eigenvalues N) _ + let ν : ProbabilityMeasure ℝ := ⟨marchenkoPasturMeasure α,hmp.probability⟩ + let a := min (c*marchenkoPasturLower α) (c*marchenkoPasturB α) + let b := max (c*marchenkoPasturLower α) (c*marchenkoPasturB α) + have hbound : (scaledSpectralLaw ν c : Measure ℝ).support ⊆ Icc a b := + signed_scaled_spectral_support ν _ _ c hmp.support_bound + have hends := signed_scaled_spectral_endpoints ν _ _ c hmp.left_mem hmp.right_mem + have hcompact : IsCompact (scaledSpectralLaw ν c : Measure ℝ).support := + isCompact_Icc.of_isClosed_subset Measure.isClosed_support hbound + have hspec := hds.uniform_integrable P Z hlaw c + change UniformIntegrable (fun k ω => spectralRadius (eig (k+1) ω)) 1 P at hspec + have hUI : UniformIntegrable (fun k => Y (k+1)) 1 P := + random_pressure_uniformIntegrable_of_spectralRadius P eig Y heig hY + orthogonalGaussianHaar horbit hspec + exact random_pressure_limit hhaar hgauss hpub P eig Y heig hY orthogonalGaussianHaar + horbit (scaledSpectralLaw ν c) a b hcompact hbound hends.1 hends.2 + (hmp.weak P Z hlaw c) (hds.excess P Z hlaw c) hUI + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternPublishedInputs.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternPublishedInputs.lean new file mode 100644 index 0000000000000000000000000000000000000000..679c94b675a4084e76f86de3154fc6a8a4b7a6b7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternPublishedInputs.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternOrbitLaw +import OAI.Probability.InvariantIsing.Spectral.ScaledSpectralSigned +import OAI.Probability.InvariantIsing.Pressure.RandomPressureMain + +namespace OAI + +/-! Marchenko–Pastur and Davidson–Szarek estimates for Gaussian-pattern matrices. +MP1967, Theorem1 and examples pp.459,461, gives the displayed law and empirical +limit. DS2001, TheoremII.13, gives the edge-excess and uniform-integrability +consequences for the Gaussian rectangular matrix. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology ENNReal +universe u +namespace InvariantIsing + +@[irreducible] def gaussianPatternCount (α : ℝ) (N : ℕ) : ℕ := ⌊α*N⌋₊ +def marchenkoPasturA (α : ℝ) : ℝ := (1-Real.sqrt α)^2 +def marchenkoPasturB (α : ℝ) : ℝ := (1+Real.sqrt α)^2 +def marchenkoPasturLower (α : ℝ) : ℝ := if α ≤ 1 then 0 else marchenkoPasturA α + +def marchenkoPasturMeasure (α : ℝ) : Measure ℝ := + ENNReal.ofReal (max (1-α) 0) • Measure.dirac 0 + + volume.withDensity ((Icc (marchenkoPasturA α) (marchenkoPasturB α)).indicator + (fun x => ENNReal.ofReal + (Real.sqrt ((marchenkoPasturB α-x)*(x-marchenkoPasturA α))/(2*Real.pi*x)))) + +/-- The fixed-aspect-ratio Gaussian specialization of MP1967, Theorem1. -/ +structure MarchenkoPasturInput (α : ℝ) (_hα : 0 < α) : Prop where + probability : IsProbabilityMeasure (marchenkoPasturMeasure α) + support_bound : (marchenkoPasturMeasure α).support ⊆ Icc (marchenkoPasturLower α) (marchenkoPasturB α) + left_mem : marchenkoPasturLower α∈(marchenkoPasturMeasure α).support + right_mem : marchenkoPasturB α∈(marchenkoPasturMeasure α).support + measurable_eigenvalues : ∀ N, Measurable + (gaussianPatternEigenvalues (N := N) (m := gaussianPatternCount α N)) + weak : ∀ {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))), + (∀ N, HasLaw (Z N) (stdGaussian _) P) → ∀ c : ℝ, + TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) + (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i))) atTop + (fun _ => LevyProkhorov.ofMeasure + (scaledSpectralLaw ⟨marchenkoPasturMeasure α,probability⟩ c)) + +/-- The edge and integrable-tail consequences of DS2001, TheoremII.13. +The rank-deficient case uses the exact zero eigenvalues of the Gram matrix. -/ +structure DavidsonSzarekInput (α : ℝ) (_hα : 0 < α) : Prop where + excess : ∀ {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))), + (∀ N, HasLaw (Z N) (stdGaussian _) P) → ∀ c : ℝ, + TendstoInMeasure P (fun k ω => spectralExcess + (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i) + (min (c*marchenkoPasturLower α) (c*marchenkoPasturB α)) + (max (c*marchenkoPasturLower α) (c*marchenkoPasturB α))) atTop (fun _ => 0) + uniform_integrable : ∀ {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))), + (∀ N, HasLaw (Z N) (stdGaussian _) P) → ∀ c : ℝ, + UniformIntegrable (fun k ω => spectralRadius + (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i)) 1 P + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternRotation.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab2bade0a8b482ad0b3bcccf7b0d0a9a2ba1d37a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternRotation.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternModel + +namespace OAI + +/-! Finite-dimensional Gaussian orthogonal invariance and invariance of the +ordered Wishart eigenvalues, including repeated zero eigenvalues. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators +namespace InvariantIsing + +@[irreducible] def gaussianPatternEigenvalues {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : Fin N → ℝ := + (gaussianPatternCoupling_isHermitian 1 z).eigenvalues + +lemma gaussianPatternArray_rotation {N m : ℕ} (U : Orthogonal N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternArray (cavityColumnRotation m (matrixRotation U) z)= + (U : Matrix (Fin N) (Fin N) ℝ)*gaussianPatternArray z := by + ext i j + simp only [gaussianPatternArray,cavityColumnRotation_apply,matrixRotation_apply,Matrix.mul_apply] + +lemma gaussianPatternCoupling_rotation {N m : ℕ} (c : ℝ) (U : Orthogonal N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternCoupling c (cavityColumnRotation m (matrixRotation U) z)= + (U : Matrix (Fin N) (Fin N) ℝ)*gaussianPatternCoupling c z* + (U : Matrix (Fin N) (Fin N) ℝ)ᵀ := by + simp only [gaussianPatternCoupling,gaussianPatternArray_rotation,Matrix.transpose_mul, + Matrix.mul_assoc,smul_mul_assoc,mul_smul_comm] + +lemma gaussianPatternEigenvalues_rotation {N m : ℕ} (U : Orthogonal N) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternEigenvalues (cavityColumnRotation m (matrixRotation U) z)= + gaussianPatternEigenvalues z := by + unfold gaussianPatternEigenvalues + apply ((gaussianPatternCoupling_isHermitian 1 _).eigenvalues_eq_eigenvalues_iff + (gaussianPatternCoupling_isHermitian 1 z)).mpr + rw [gaussianPatternCoupling_rotation,Matrix.charpoly_mul_comm,← Matrix.mul_assoc] + have hU := (Matrix.mem_orthogonalGroup_iff' (Fin N) ℝ).mp U.property + rw [hU,Matrix.one_mul] + +lemma gaussianPattern_rotate_hasLaw {Ω : Type*} [MeasurableSpace Ω] {N m : ℕ} + (P : Measure Ω) (Z : Ω → EuclideanSpace ℝ (Fin N × Fin m)) + (hZ : HasLaw Z (stdGaussian _) P) (U : Orthogonal N) : + HasLaw (fun ω => cavityColumnRotation m (matrixRotation U) (Z ω)) (stdGaussian _) P := by + have hR : HasLaw (cavityColumnRotation m (matrixRotation U)) (stdGaussian _) (stdGaussian _) := + ⟨(cavityColumnRotation m (matrixRotation U)).continuous.aemeasurable, + cavityColumnRotation_gaussian (matrixRotation U)⟩ + exact hR.fun_comp hZ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternSingularMinimum.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternSingularMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e21e6a96293c896d10ff3c024ec8e0c305e70c3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternSingularMinimum.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternEuclideanNorm + +namespace OAI + +/-! The least singular value, as an actual unit-sphere minimum, is 1-Lipschitz. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped Topology +namespace InvariantIsing + +def gaussianPatternSingularMin {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := + ⨅ x : Metric.sphere (0 : EuclideanSpace ℝ (Fin m)) 1, ‖gaussianPatternEuclideanOperator z x‖ + +lemma gaussianPatternSingularMin_le_add {N m : ℕ} (hm : 0 < m) + (z w : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternSingularMin z ≤ gaussianPatternSingularMin w + ‖z-w‖ := by + have hx : EuclideanSpace.single (⟨0,hm⟩ : Fin m) (1 : ℝ) ∈ + Metric.sphere (0 : EuclideanSpace ℝ (Fin m)) 1 := by + simp + let : Nonempty (Metric.sphere (0 : EuclideanSpace ℝ (Fin m)) 1) := ⟨⟨_,hx⟩⟩ + have hb : BddBelow (Set.range (fun x : Metric.sphere (0 : EuclideanSpace ℝ (Fin m)) 1 => + ‖gaussianPatternEuclideanOperator z x‖)) := ⟨0,by rintro _ ⟨x,rfl⟩; exact norm_nonneg _⟩ + have hh : gaussianPatternSingularMin z - ‖z-w‖ ≤ gaussianPatternSingularMin w := by + apply le_ciInf + intro x + have hmin : gaussianPatternSingularMin z ≤ ‖gaussianPatternEuclideanOperator z x‖ := ciInf_le hb x + have hn : ‖(x : EuclideanSpace ℝ (Fin m))‖ = 1 := by + simpa only [Metric.mem_sphere,dist_zero_right] using x.property + have hd := abs_norm_sub_norm_le (gaussianPatternEuclideanOperator z x) + (gaussianPatternEuclideanOperator w x) + rw [← sub_apply,← gaussianPatternEuclideanOperator_sub] at hd + have hbound := gaussianPatternEuclideanOperator_bound (z-w) x + rw [hn,mul_one] at hbound + have hdiff := (le_abs_self (‖gaussianPatternEuclideanOperator z x‖- + ‖gaussianPatternEuclideanOperator w x‖)).trans (hd.trans hbound) + linarith + linarith + +theorem gaussianPatternSingularMin_lipschitz (N m : ℕ) (hm : 0 < m) : + LipschitzWith 1 (gaussianPatternSingularMin (N := N) (m := m)) := by + apply LipschitzWith.of_dist_le_mul + intro z w + simp only [NNReal.coe_one,one_mul,dist_eq_norm,Real.norm_eq_abs] + apply abs_le.mpr + constructor + · have h := gaussianPatternSingularMin_le_add hm w z + rw [norm_sub_rev] at h + linarith + · have h := gaussianPatternSingularMin_le_add hm z w + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternSingularVariance.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternSingularVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9af7940848e3843987bb931c188f644bb8342ff --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternSingularVariance.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternEuclideanNorm +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternSingularMinimum +import OAI.Probability.InvariantIsing.Gaussian.GaussianVarianceInput + +namespace OAI + +/-! Dimension-free Gaussian variance for the physical rectangular operator norm. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped NNReal +namespace InvariantIsing + +lemma finiteGaussian_lipschitz_variance {ι : Type*} [Fintype ι] {L : ℝ≥0} + {f : EuclideanSpace ℝ ι → ℝ} (hf : LipschitzWith L f) : + variance f (stdGaussian (EuclideanSpace ℝ ι)) ≤ (L : ℝ)^2 := by + let e : EuclideanSpace ℝ (Fin (Fintype.card ι)) ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι := + LinearIsometryEquiv.piLpCongrLeft 2 ℝ ℝ (Fintype.equivFin ι).symm + have hh : LipschitzWith L (f ∘ e) := by simpa only [mul_one] using hf.comp e.lipschitz + have hv := gaussianLipschitzVariance_proved (Fintype.card ι) L (f ∘ e) hh + have hm := stdGaussian_map e + rw [← hm,variance_map hf.continuous.aemeasurable e.continuous.aemeasurable] + exact hv + +theorem gaussianPatternSingularMax_variance (N m : ℕ) : + variance (gaussianPatternSingularMax (N := N) (m := m)) + (stdGaussian (EuclideanSpace ℝ (Fin N × Fin m))) ≤ 1 := by + simpa only [NNReal.coe_one,one_pow] using + finiteGaussian_lipschitz_variance (gaussianPatternSingularMax_lipschitz N m) + +theorem gaussianPatternSingularMin_variance (N m : ℕ) (hm : 0 < m) : + variance (gaussianPatternSingularMin (N := N) (m := m)) + (stdGaussian (EuclideanSpace ℝ (Fin N × Fin m))) ≤ 1 := by + simpa only [NNReal.coe_one,one_pow] using + finiteGaussian_lipschitz_variance (gaussianPatternSingularMin_lipschitz N m hm) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternZeroOrbit.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternZeroOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc000c54e7c9dac8a32b0919f378d1cce6261e04 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianPatternZeroOrbit.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternOrbitLaw + +namespace OAI + +/-! The empty spin space has constant zero pressure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma conditionalFieldOrbitLaw_zero {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (d : Ω → FieldSpectralData 0) + (H : Measure (Orthogonal 0)) [IsProbabilityMeasure H] : + ConditionalFieldOrbitLaw P d (fun _ => 0) H := by + let d0 : FieldSpectralData 0 := (fun _ => 0,fun _ => 0) + have hd (ω : Ω) : d ω=d0 := Subsingleton.elim _ _ + have hp (z : FieldSpectralData 0 × Orthogonal 0) : dataPhysicalPressure z.1 z.2=0 := by + simp [dataPhysicalPressure,rotatedPressure] + unfold ConditionalFieldOrbitLaw + rw [show d=(fun _ => d0) from funext hd] + simp only [hp] + simp only [Measure.map_const,measure_univ,one_smul,Measure.dirac_prod] + rw [Measure.map_map (measurable_fst.prodMk measurable_const) measurable_prodMk_left] + simp [Function.comp_def,Measure.map_const] + +lemma gaussianPattern_conditionalOrbit_zero {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] {m : ℕ} + (Z : Ω → EuclideanSpace ℝ (Fin 0 × Fin m)) (c : ℝ) + (H : Measure (Orthogonal 0)) [IsProbabilityMeasure H] : + ConditionalFieldOrbitLaw P + (fun ω => (fun i => c*gaussianPatternEigenvalues (Z ω) i,fun _ => 0)) + (fun ω => gaussianPatternPressure c (Z ω)) H := by + have hY : (fun ω => gaussianPatternPressure c (Z ω))=(fun _ : Ω => 0) := by + funext ω + simp [gaussianPatternPressure] + rw [hY] + exact conditionalFieldOrbitLaw_zero P _ H + +lemma gaussianPattern_conditionalOrbit_all {Ω : Type*} [MeasurableSpace Ω] + {N m : ℕ} (c : ℝ) (P : Measure Ω) [IsProbabilityMeasure P] + (Z : Ω → EuclideanSpace ℝ (Fin N × Fin m)) (hZ : Measurable Z) + (hlaw : HasLaw Z (stdGaussian _) P) + (heig : Measurable (gaussianPatternEigenvalues (N := N) (m := m))) + (H : Measure (Orthogonal N)) [IsProbabilityMeasure H] [H.IsMulRightInvariant] : + ConditionalFieldOrbitLaw P + (fun ω => ((fun i => c*gaussianPatternEigenvalues (Z ω) i),fun _ => 0)) + (fun ω => gaussianPatternPressure c (Z ω)) H := by + cases N with + | zero => exact gaussianPattern_conditionalOrbit_zero P Z c H + | succ n => exact gaussianPattern_conditionalOrbit_hasLaw (Nat.succ_pos n) c P Z hZ hlaw heig H + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianQuadraticLaw.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianQuadraticLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..958010ebf0b8d75a8ff6e991fc7aa14a6b3fd716 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianQuadraticLaw.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianQuadraticPotential +import Mathlib.Probability.Distributions.Gaussian.Multivariate + +namespace OAI + +/-! Identification of the normalized quadratic-potential law with stdGaussian. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +lemma gaussianQuadratic_integral_cexp {d : ℕ} (t : EuclideanSpace ℝ (Fin d)) : + (∫ x : EuclideanSpace ℝ (Fin d), Complex.exp + (-(gaussianQuadraticPotential x : ℂ)+Complex.I*(inner ℝ t x)))= + (LeanBlast.KLS.potentialPartition (gaussianQuadraticPotential (d := d)) : ℂ)* + Complex.exp (-(‖t‖ : ℂ)^2/2) := by + have hb := GaussianFourier.integral_cexp_neg_mul_sq_norm + (V := EuclideanSpace ℝ (Fin d)) (b := (1/2 : ℂ)) (by norm_num) + have hbase : (LeanBlast.KLS.potentialPartition (gaussianQuadraticPotential (d := d)) : ℂ)= + (Real.pi/(1/2 : ℂ))^(Module.finrank ℝ (EuclideanSpace ℝ (Fin d))/2 : ℂ) := by + rw [LeanBlast.KLS.potentialPartition,← integral_complex_ofReal] + convert hb using 1 + congr 1 + funext x + rw [Complex.ofReal_exp] + congr 1 + simp [gaussianQuadraticPotential,Complex.ofReal_mul,Complex.ofReal_pow] + have hf := GaussianFourier.integral_cexp_neg_mul_sq_norm_add + (V := EuclideanSpace ℝ (Fin d)) (b := (1/2 : ℂ)) (by norm_num) Complex.I t + have he : Complex.I^2*(‖t‖ : ℂ)^2/(4*(1/2 : ℂ))=-(‖t‖ : ℂ)^2/2 := by + rw [Complex.I_sq] + ring + rw [he,← hbase] at hf + convert hf using 1 + congr 1 + funext x + congr 1 + simp [gaussianQuadraticPotential,Complex.ofReal_mul,Complex.ofReal_pow] + +lemma gaussianQuadratic_charFun {d : ℕ} (t : EuclideanSpace ℝ (Fin d)) : + charFun (LeanBlast.KLS.potentialMeasure (gaussianQuadraticPotential (d := d))) t= + Complex.exp (-(‖t‖ : ℂ)^2/2) := by + let p := LeanBlast.KLS.potentialPartition (gaussianQuadraticPotential (d := d)) + have hp : (p : ℂ) ≠ 0 := by + exact_mod_cast (LeanBlast.KLS.potentialPartition_pos (gaussianQuadraticPotential_integrable d)).ne' + rw [charFun_apply,LeanBlast.KLS.potentialMeasure,integral_tilted] + change (∫ x : EuclideanSpace ℝ (Fin d), (Real.exp (-gaussianQuadraticPotential x)/p) • + Complex.exp ((inner ℝ x t : ℂ)*Complex.I))=_ + calc + _ = (p : ℂ)⁻¹*(∫ x : EuclideanSpace ℝ (Fin d), Complex.exp + (-(gaussianQuadraticPotential x : ℂ)+Complex.I*(inner ℝ t x))) := by + rw [← integral_const_mul] + apply integral_congr_ae + filter_upwards [] with x + rw [Complex.real_smul,Complex.ofReal_div,Complex.ofReal_exp,Complex.exp_add] + rw [Complex.ofReal_neg] + have he : (inner ℝ x t : ℂ)*Complex.I=Complex.I*(inner ℝ t x) := by + rw [real_inner_comm x t] + exact mul_comm _ _ + rw [he] + ring + _ = _ := by + rw [gaussianQuadratic_integral_cexp,← mul_assoc,inv_mul_cancel₀ hp,one_mul] + +lemma gaussianQuadratic_potentialMeasure_eq_stdGaussian (d : ℕ) : + LeanBlast.KLS.potentialMeasure (gaussianQuadraticPotential (d := d))= + stdGaussian (EuclideanSpace ℝ (Fin d)) := by + let : IsProbabilityMeasure (LeanBlast.KLS.potentialMeasure (gaussianQuadraticPotential (d := d))) := + LeanBlast.KLS.isProbabilityMeasure_potentialMeasure (gaussianQuadraticPotential_integrable d) + apply Measure.ext_of_charFun + ext t + rw [gaussianQuadratic_charFun,charFun_stdGaussian] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianQuadraticPotential.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianQuadraticPotential.lean new file mode 100644 index 0000000000000000000000000000000000000000..aad2c8afc71d59b2e2f7722a90cc64721397132e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianQuadraticPotential.lean @@ -0,0 +1,61 @@ +import OAI.Analysis.KLS.Spectral.RegularPoincare +import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform + +namespace OAI + +/-! The finite-dimensional quadratic potential for Gaussian Poincare. -/ +noncomputable section +open MeasureTheory +open scoped ContDiff +namespace InvariantIsing + +def gaussianQuadraticPotential {d : ℕ} (x : EuclideanSpace ℝ (Fin d)) : ℝ := + (1/2 : ℝ)*‖x‖^2 + +lemma gaussianQuadraticPotential_derivative (d : ℕ) : + fderiv ℝ (gaussianQuadraticPotential (d := d))= + ⇑(innerSL ℝ (E := EuclideanSpace ℝ (Fin d))) := by + funext x + have h := ((hasStrictFDerivAt_norm_sq x).hasFDerivAt.const_mul (1/2 : ℝ)).fderiv + change fderiv ℝ (fun y : EuclideanSpace ℝ (Fin d) => (1/2 : ℝ)*‖y‖^2) x = _ + rw [h] + ext v + simp only [smul_apply,two_smul,add_apply,smul_eq_mul] + ring + +lemma gaussianQuadraticPotential_hessian {d : ℕ} (x v : EuclideanSpace ℝ (Fin d)) : + fderiv ℝ (fderiv ℝ (gaussianQuadraticPotential (d := d))) x v v=‖v‖^2 := by + rw [gaussianQuadraticPotential_derivative] + rw [((innerSL ℝ (E := EuclideanSpace ℝ (Fin d))).hasFDerivAt (x := x)).fderiv] + exact real_inner_self_eq_norm_sq v + +lemma gaussianQuadraticPotential_regular (d : ℕ) : + LeanBlast.KLS.IsRegularPotential (gaussianQuadraticPotential (d := d)) 1 1 where + contDiff := contDiff_const.mul (contDiff_norm_sq ℝ) + lower_pos := zero_lt_one + le_upper := le_rfl + lower_bound x v := by rw [gaussianQuadraticPotential_hessian,one_mul] + upper_bound x v := by rw [gaussianQuadraticPotential_hessian,one_mul] + +lemma gaussianQuadraticPotential_integrable (d : ℕ) : + Integrable (fun x : EuclideanSpace ℝ (Fin d) => Real.exp (-gaussianQuadraticPotential x)) := by + have h := GaussianFourier.integrable_cexp_neg_mul_sq_norm_add + (V := EuclideanSpace ℝ (Fin d)) (b := (1/2 : ℂ)) (by norm_num) 0 0 + have hc : Integrable (fun x : EuclideanSpace ℝ (Fin d) => + Complex.exp ((-(1/2 : ℝ)*‖x‖^2 : ℝ) : ℂ)) := by + simpa only [zero_mul,add_zero,Complex.ofReal_mul,Complex.ofReal_neg, + Complex.ofReal_pow,Complex.ofReal_div,Complex.ofReal_one,Complex.ofReal_ofNat] using h + simpa only [Complex.norm_exp,Complex.ofReal_re,gaussianQuadraticPotential,neg_mul] using hc.norm + +lemma gaussianQuadraticPotential_poincare_test {d : ℕ} + (f : EuclideanSpace ℝ (Fin d) → ℝ) (hf : LeanBlast.KLS.IsTestFunction f) : + LeanBlast.KLS.variance (LeanBlast.KLS.potentialMeasure gaussianQuadraticPotential) f ≤ + LeanBlast.KLS.dirichletEnergy (LeanBlast.KLS.potentialMeasure gaussianQuadraticPotential) f := by + simpa only [one_mul] using (gaussianQuadraticPotential_regular d).poincare + (gaussianQuadraticPotential_integrable d) hf + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianScaledEmpiricalWeak.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianScaledEmpiricalWeak.lean new file mode 100644 index 0000000000000000000000000000000000000000..14a859b955333584d4a26eeef72d659f3f61fff2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianScaledEmpiricalWeak.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Spectral.EmpiricalLawContinuity + +namespace OAI + +/-! The full real-coupling empirical MP limit, without cross-dimensional independence. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace InvariantIsing + +lemma empiricalSpectralLaw_scale {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) (c : ℝ) : + (empiricalSpectralLaw hN eig).map (fun x => c*x) = + empiricalSpectralLaw hN (fun i => c*eig i) := by + apply ProbabilityMeasure.toMeasure_injective + exact empiricalSpectralLaw_map hN eig (fun x => c*x) (measurable_const.mul measurable_id) + +theorem gaussianPattern_scaled_empirical_weak {α : ℝ} (hα : 0 < α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) (c : ℝ) : + TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i))) atTop + (fun _ => LevyProkhorov.ofMeasure (scaledSpectralLaw + ⟨marchenkoPasturMeasure α,marchenkoPastur_probability hα⟩ c)) := by + have hm (k : ℕ) : AEStronglyMeasurable (fun ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (fun i => c*gaussianPatternEigenvalues (Z (k+1) ω) i))) P := by + exact (continuous_scaled_gaussianEmpirical (m := gaussianPatternCount α (k+1)) + (Nat.succ_pos k) c).aestronglyMeasurable.comp_aemeasurable (hZ (k+1)).aemeasurable + apply (exists_seq_tendstoInMeasure_atTop_iff hm).mpr + intro ns hns + obtain ⟨u,hu,heu⟩ := ((gaussianPattern_empirical_weak hα P Z hZ).comp hns.tendsto_atTop).exists_seq_tendsto_ae + refine ⟨u,hu,?_⟩ + filter_upwards [heu] with ω hω + have hw := (LevyProkhorov.continuous_toMeasure_probabilityMeasure.tendsto _).comp hω + have hs := (ProbabilityMeasure.continuous_map + (show Continuous (fun x : ℝ => c*x) from continuous_const.mul continuous_id)).tendsto _ |>.comp hw + have hl := (LevyProkhorov.continuous_ofMeasure_probabilityMeasure.tendsto _).comp hs + change Tendsto (fun k => LevyProkhorov.ofMeasure + ((empiricalSpectralLaw (Nat.succ_pos (ns (u k))) (gaussianPatternEigenvalues (Z (ns (u k)+1) ω))).map + (fun x => c*x))) atTop + (𝓝 (LevyProkhorov.ofMeasure (scaledSpectralLaw + ⟨marchenkoPasturMeasure α,marchenkoPastur_probability hα⟩ c))) at hl + simpa only [empiricalSpectralLaw_scale,scaledSpectralLaw,Function.comp_apply] using hl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularFluctuation.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularFluctuation.lean new file mode 100644 index 0000000000000000000000000000000000000000..cde2dcedfac928bc21cbb5d7002ec0064d14c672 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularFluctuation.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternSingularVariance +import Mathlib.MeasureTheory.Function.ConvergenceInMeasure + +namespace OAI + +/-! Centered Gaussian singular-value fluctuations vanish after square-root dimension scaling. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped NNReal ENNReal Topology +namespace InvariantIsing + +lemma finiteGaussian_lipschitz_memLp_two {ι : Type*} [Fintype ι] {L : ℝ≥0} + {f : EuclideanSpace ℝ ι → ℝ} (hf : LipschitzWith L f) : + MemLp f 2 (stdGaussian (EuclideanSpace ℝ ι)) := by + have hi : MemLp (fun x : EuclideanSpace ℝ ι => x) 2 (stdGaussian _) := + IsGaussian.memLp_id _ 2 (by norm_num) + have hc : LipschitzWith L (fun x => f x-f 0) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_eq_norm,sub_sub_sub_cancel_right] using hf.dist_le_mul x y + have hh := (hc.comp_memLp (by simp) hi).add + (memLp_const (f 0) : MemLp (fun _ : EuclideanSpace ℝ ι => f 0) 2 (stdGaussian _)) + convert hh using 1 + funext x + simp + +lemma finiteGaussian_lipschitz_tail {ι : Type*} [Fintype ι] + {f : EuclideanSpace ℝ ι → ℝ} (hf : LipschitzWith 1 f) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : Ω → EuclideanSpace ℝ ι) (hZ : HasLaw Z (stdGaussian _) P) + (r t : ℝ) (hr : 0 < r) (ht : 0 < t) : + P {ω | t ≤ |(f (Z ω)-(∫ x, f x ∂stdGaussian _))/r|} ≤ + ENNReal.ofReal (1/(r^2*t^2)) := by + have hset : {ω | t ≤ |(f (Z ω)-(∫ x, f x ∂stdGaussian _))/r|} = + {ω | t*r ≤ |f (Z ω)-(∫ x, f x ∂stdGaussian _)|} := by + ext ω + simp only [Set.mem_ofPred_eq] + rw [abs_div,abs_of_pos hr,le_div_iff₀ hr] + have hm : MeasurableSet {x : EuclideanSpace ℝ ι | t*r ≤ |f x-(∫ y, f y ∂stdGaussian _)|} := + (isClosed_le continuous_const ((hf.continuous.sub continuous_const).abs)).measurableSet + rw [hset,hZ.measure_eq hm] + have hc := meas_ge_le_variance_div_sq (finiteGaussian_lipschitz_memLp_two hf) (mul_pos ht hr) + refine hc.trans (ENNReal.ofReal_le_ofReal ?_) + have hv : variance f (stdGaussian _) ≤ 1 := by + simpa only [NNReal.coe_one,one_pow] using finiteGaussian_lipschitz_variance hf + calc + _ ≤ 1/(t*r)^2 := div_le_div_of_nonneg_right hv (sq_nonneg _) + _ = 1/(r^2*t^2) := by ring + +theorem finiteGaussian_centered_tendsto {ι : ℕ → Type*} [∀ k, Fintype (ι k)] + (f : (k : ℕ) → EuclideanSpace ℝ (ι k) → ℝ) (hf : ∀ k, LipschitzWith 1 (f k)) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : (k : ℕ) → Ω → EuclideanSpace ℝ (ι k)) + (hZ : ∀ k, HasLaw (Z k) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => + (f k (Z k ω)-(∫ x, f k x ∂stdGaussian _))/Real.sqrt (k+1)) atTop (fun _ => 0) := by + apply tendstoInMeasure_iff_dist.mpr + intro ε hε + have hbound (k : ℕ) : P {ω | ε ≤ dist + ((f k (Z k ω)-(∫ x, f k x ∂stdGaussian _))/Real.sqrt (k+1)) 0} ≤ + ENNReal.ofReal (1/((k+1 : ℝ)*ε^2)) := by + have hk : (0 : ℝ) < k+1 := by positivity + simpa only [dist_zero_right,Real.norm_eq_abs,Real.sq_sqrt hk.le] using + finiteGaussian_lipschitz_tail (hf k) P (Z k) (hZ k) (Real.sqrt (k+1)) ε + (Real.sqrt_pos.2 hk) hε + apply tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds _ (fun _ => zero_le) hbound + have ht : Tendsto (fun k : ℕ => (1 : ℝ)/((k+1 : ℝ)*ε^2)) atTop (𝓝 0) := by + have ha : Tendsto (fun k : ℕ => (k+1 : ℝ)) atTop atTop := by + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_one] using + (tendsto_natCast_atTop_atTop (R := ℝ)).comp (tendsto_add_atTop_nat 1) + have hn : Tendsto (fun k : ℕ => (k+1 : ℝ)*ε^2) atTop atTop := + ha.atTop_mul_const (sq_pos_of_pos hε) + exact tendsto_const_nhds.div_atTop hn + simpa only [ENNReal.ofReal_zero,Function.comp_def] using ENNReal.continuous_ofReal.continuousAt.tendsto.comp ht + +theorem gaussianPatternSingularMax_centered_tendsto (m : ℕ → ℕ) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : (k : ℕ) → Ω → EuclideanSpace ℝ (Fin (k+1) × Fin (m k))) + (hZ : ∀ k, HasLaw (Z k) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => + (gaussianPatternSingularMax (Z k ω) - + (∫ x : EuclideanSpace ℝ (Fin (k+1) × Fin (m k)), gaussianPatternSingularMax x ∂stdGaussian _)) / + Real.sqrt (k+1)) atTop (fun _ => 0) := + finiteGaussian_centered_tendsto (fun _ => gaussianPatternSingularMax) + (fun k => gaussianPatternSingularMax_lipschitz (k+1) (m k)) P Z hZ + +theorem gaussianPatternSingularMin_centered_tendsto (m : ℕ → ℕ) (hm : ∀ k, 0 < m k) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : (k : ℕ) → Ω → EuclideanSpace ℝ (Fin (k+1) × Fin (m k))) + (hZ : ∀ k, HasLaw (Z k) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => + (gaussianPatternSingularMin (Z k ω) - + (∫ x : EuclideanSpace ℝ (Fin (k+1) × Fin (m k)), gaussianPatternSingularMin x ∂stdGaussian _)) / + Real.sqrt (k+1)) atTop (fun _ => 0) := + finiteGaussian_centered_tendsto (fun _ => gaussianPatternSingularMin) + (fun k => gaussianPatternSingularMin_lipschitz (k+1) (m k) (hm k)) P Z hZ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularLowerMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularLowerMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..af57d61ddc2b22615880018959566b2450e4435a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularLowerMean.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianFiniteColumnMinimum +import OAI.Probability.InvariantIsing.Core.DenseFiniteMinimum +import OAI.Probability.InvariantIsing.Gaussian.GaussianNormLowerMean + +namespace OAI + +/-! The Gaussian least singular value has the sharp asymptotic lower mean bound. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped BigOperators Topology +namespace InvariantIsing + +theorem gaussianPatternSingularMin_mean_ge {N m : ℕ} (hN : 0 < N) (hm : 0 < m) : + Real.sqrt ((N : ℝ)-1)-Real.sqrt m ≤ + ∫ z : EuclideanSpace ℝ (Fin N × Fin m), gaussianPatternSingularMin z ∂stdGaussian _ := by + let : NeZero m := ⟨Nat.ne_of_gt hm⟩ + let S := Metric.sphere (0 : EuclideanSpace ℝ (Fin m)) 1 + let : Nonempty S := by + obtain ⟨x⟩ := unitVector_nonempty (EuclideanSpace ℝ (Fin m)) + exact ⟨⟨x.1,by simpa only [S,Metric.mem_sphere,dist_zero_right] using x.2⟩⟩ + let s : ℕ → S := TopologicalSpace.denseSeq S + have hs : DenseRange s := TopologicalSpace.denseRange_denseSeq S + have hn (i : ℕ) : ‖(s i).1‖ = 1 := by + simpa only [S,Metric.mem_sphere,dist_zero_right] using (s i).2 + let F (n : ℕ) (z : EuclideanSpace ℝ (Fin N × Fin m)) := + prefixMinimum (fun i => ‖gaussianPatternEuclideanOperator z (s i).1‖) n + have hlim (z : EuclideanSpace ℝ (Fin N × Fin m)) : + Tendsto (fun n => F n z) atTop (𝓝 (gaussianPatternSingularMin z)) := by + exact dense_prefixMinimum_tendsto s hs (fun x => ‖gaussianPatternEuclideanOperator z x.1‖) + (by fun_prop) ⟨0,by rintro _ ⟨x,rfl⟩; exact norm_nonneg _⟩ + have hbound (n : ℕ) (z : EuclideanSpace ℝ (Fin N × Fin m)) : |F n z| ≤ ‖z‖ := by + obtain ⟨i,_,he⟩ := Finset.exists_mem_eq_inf' Finset.univ_nonempty + (fun i : Fin (n+1) => ‖gaussianPatternEuclideanOperator z (s i).1‖) + change |Finset.univ.inf' Finset.univ_nonempty _| ≤ _ + rw [he,abs_of_nonneg (norm_nonneg _)] + have h := gaussianPatternEuclideanOperator_bound z (s i).1 + simpa only [hn,mul_one] using h + have hint := tendsto_integral_of_dominated_convergence (μ := stdGaussian _) norm + (fun n => (show Continuous (F n) from + Continuous.finset_inf'_apply Finset.univ_nonempty (fun i _ => + (continuous_gaussianPattern_apply (s i).1).norm)).aestronglyMeasurable) + ((finiteGaussian_lipschitz_memLp_two + (lipschitzWith_one_norm : LipschitzWith 1 (norm : EuclideanSpace ℝ (Fin N × Fin m) → ℝ))).integrable + (by norm_num)) + (fun n => ae_of_all _ (fun z => by simpa only [Real.norm_eq_abs] using hbound n z)) + (ae_of_all _ hlim) + have hb (n : ℕ) : Real.sqrt ((N : ℝ)-1)-Real.sqrt m ≤ ∫ z, F n z ∂stdGaussian _ := by + have hc := gaussian_finite_column_minimum hN (fun i : Fin (n+1) => (s i).1) + (fun i => hn i) + have hl := gaussianNorm_lower_mean (ι := Fin N) + simp only [Fintype.card_fin] at hl + exact (sub_le_sub_right hl (Real.sqrt m)).trans hc + exact ge_of_tendsto hint (Filter.Eventually.of_forall hb) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularSquareUI.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularSquareUI.lean new file mode 100644 index 0000000000000000000000000000000000000000..30d57c8b664854868b800a740685d6e3afcb42c9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularSquareUI.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternAspect +import OAI.Probability.InvariantIsing.Gaussian.GaussianCenteredSquare + +namespace OAI + +/-! Uniform integrability of the actual normalized squared Gaussian operator norm. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +theorem gaussianPatternSingularMax_square_uniformIntegrable {α : ℝ} (hα : 0 ≤ α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + UniformIntegrable (fun k ω => (gaussianPatternSingularMax (Z (k+1) ω))^2/(k+1)) 1 P := by + let f (k : ℕ) := gaussianPatternSingularMax (N := k+1) (m := gaussianPatternCount α (k+1)) + let M (k : ℕ) := ∫ x, f k x ∂stdGaussian _ + let C (k : ℕ) (ω : Ω) := (f k (Z (k+1) ω)-M k)^2/(k+1) + have hC : UniformIntegrable C 1 P := gaussianCenteredSquare_uniformIntegrable f + (fun k => gaussianPatternSingularMax_lipschitz _ _) P (fun k => Z (k+1)) (fun k => hZ (k+1)) + let B : ℝ := 4+4*α + have hB : 0 ≤ B := by dsimp [B]; positivity + have hdom : UniformIntegrable (fun k ω => B+(C k ω+C k ω)) 1 P := + uniformIntegrable_add_real P _ _ + (uniformIntegrable_const le_rfl (by simp) (memLp_const B)) + (uniformIntegrable_add_real P C C hC hC) + refine uniformIntegrable_of_abs_le P _ _ ?_ hdom ?_ + · intro k + exact (((hZ (k+1)).memLp_comp (finiteGaussian_lipschitz_memLp_two + (gaussianPatternSingularMax_lipschitz _ _))).integrable_sq.div_const (k+1)).aestronglyMeasurable + intro k + apply ae_of_all + intro ω + have hd : (0 : ℝ) < k+1 := by positivity + have hM : (M k)^2/(k+1) ≤ 2+2*α := gaussianPattern_mean_sq_div_le hα k + have hC0 : 0 ≤ C k ω := div_nonneg (sq_nonneg _) hd.le + rw [abs_of_nonneg (div_nonneg (sq_nonneg _) hd.le),abs_of_nonneg (by linarith : 0 ≤ B+(C k ω+C k ω))] + change (f k (Z (k+1) ω))^2/(k+1) ≤ _ + have hs : (f k (Z (k+1) ω))^2/(k+1) ≤ 2*C k ω+2*(M k)^2/(k+1) := by + dsimp [C] + rw [← mul_div_assoc,← add_div] + apply div_le_div_of_nonneg_right _ hd.le + nlinarith [sq_nonneg (f k (Z (k+1) ω)-2*M k)] + dsimp [B] + rw [mul_div_assoc] at hs + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularUpperEdge.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularUpperEdge.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f5260b9d9333f375c063b6a240d1381e5b9a62f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSingularUpperEdge.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternAspect + +namespace OAI + +/-! The sharp one-sided upper singular-value edge for the actual rectangular Gaussian model. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem gaussianPatternSingularMax_upper_edge {α : ℝ} (hα : 0 ≤ α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => + max (gaussianPatternSingularMax (Z (k+1) ω)/Real.sqrt (k+1) - (1+Real.sqrt α)) 0) + atTop (fun _ => 0) := by + let M (k : ℕ) := ∫ z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))), + gaussianPatternSingularMax z ∂stdGaussian _ + let B (k : ℕ) := 1+Real.sqrt ((gaussianPatternCount α (k+1) : ℝ)/(k+1)) + have hB : Tendsto B atTop (𝓝 (1+Real.sqrt α)) := gaussianPatternCount_sqrt_ratio_tendsto hα + have hM (k : ℕ) : M k/Real.sqrt (k+1) ≤ B k := by + simpa only [Nat.cast_succ,Nat.cast_add,Nat.cast_one] using + gaussianPattern_mean_div_sqrt_le (m := gaussianPatternCount α (k+1)) (Nat.succ_pos k) + have hmeas (k : ℕ) : AEStronglyMeasurable + (fun ω => max (gaussianPatternSingularMax (Z (k+1) ω)/Real.sqrt (k+1) - + (1+Real.sqrt α)) 0) P := by + have hc := (gaussianPatternSingularMax_lipschitz (k+1) (gaussianPatternCount α (k+1))).continuous + have hm : Measurable (fun z : EuclideanSpace ℝ (Fin (k+1) × Fin (gaussianPatternCount α (k+1))) => + max (gaussianPatternSingularMax z/Real.sqrt (k+1)-(1+Real.sqrt α)) 0) := by fun_prop + exact (hm.aemeasurable.comp_aemeasurable (hZ (k+1)).aemeasurable).aestronglyMeasurable + apply (exists_seq_tendstoInMeasure_atTop_iff hmeas).mpr + intro ns hns + obtain ⟨u,hu,hcu⟩ := ((gaussianPatternSingularMax_centered_tendsto + (fun k => gaussianPatternCount α (k+1)) P (fun k => Z (k+1)) + (fun k => hZ (k+1))).comp hns.tendsto_atTop).exists_seq_tendsto_ae + refine ⟨u,hu,?_⟩ + filter_upwards [hcu] with ω hω + have hc : Tendsto (fun k => + (gaussianPatternSingularMax (Z (ns (u k)+1) ω)-M (ns (u k)))/Real.sqrt (ns (u k)+1)) + atTop (𝓝 0) := hω + have hb := hB.comp (hns.comp hu).tendsto_atTop + have ht := ((hc.add hb).sub_const (1+Real.sqrt α)).max (tendsto_const_nhds (x := (0 : ℝ))) + have ht' : Tendsto (fun k => max + ((gaussianPatternSingularMax (Z (ns (u k)+1) ω)-M (ns (u k)))/Real.sqrt (ns (u k)+1) + + B (ns (u k))-(1+Real.sqrt α)) 0) atTop (𝓝 0) := by + simpa only [zero_add,sub_self,max_self,Function.comp_def] using ht + apply squeeze_zero (fun _ => le_max_right _ _) _ ht' + intro k + apply max_le_max _ le_rfl + have hm := hM (ns (u k)) + rw [sub_div] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSmoothing.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSmoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbffc7ef4d91fa1d62140f6fb14ba4b5e39ff624 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianSmoothing.lean @@ -0,0 +1,63 @@ +import Mathlib.Analysis.Calculus.BumpFunction.Convolution +import Mathlib.Analysis.Calculus.ContDiff.Convolution + +namespace OAI + +/-! Normalized smoothing preserves the precise scalar Lipschitz constant. -/ +noncomputable section +open MeasureTheory ContinuousLinearMap +open scoped NNReal Convolution ContDiff +namespace InvariantIsing + +def gaussianSmooth {d : ℕ} (φ : ContDiffBump (0 : EuclideanSpace ℝ (Fin d))) + (f : EuclideanSpace ℝ (Fin d) → ℝ) : EuclideanSpace ℝ (Fin d) → ℝ := + φ.normed volume ⋆[lsmul ℝ ℝ, volume] f + +lemma gaussianSmooth_lipschitz {d : ℕ} {L : ℝ≥0} + (φ : ContDiffBump (0 : EuclideanSpace ℝ (Fin d))) + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) : + LipschitzWith L (gaussianSmooth φ f) := by + have hi (x : EuclideanSpace ℝ (Fin d)) : + Integrable (fun a => φ.normed volume a * f (x-a)) := by + simpa only [ConvolutionExistsAt, lsmul_apply, smul_eq_mul] using + (φ.hasCompactSupport_normed.convolutionExists_left (lsmul ℝ ℝ) + φ.continuous_normed hf.continuous.locallyIntegrable x) + apply LipschitzWith.of_dist_le_mul + intro x y + change ‖(∫ a, φ.normed volume a * f (x-a)) - + (∫ a, φ.normed volume a * f (y-a))‖ ≤ (L : ℝ)*dist x y + rw [← integral_sub (hi x) (hi y)] + calc + _ ≤ ∫ a, φ.normed volume a * ((L : ℝ)*dist x y) := by + apply norm_integral_le_of_norm_le (φ.integrable_normed.mul_const _) + filter_upwards [] with a + rw [← mul_sub, norm_mul, Real.norm_of_nonneg (φ.nonneg_normed a)] + apply mul_le_mul_of_nonneg_left _ (φ.nonneg_normed a) + simpa only [dist_eq_norm, sub_sub_sub_cancel_right] using + hf.dist_le_mul (x-a) (y-a) + _ = _ := by rw [integral_mul_const, φ.integral_normed, one_mul] + +lemma gaussianSmooth_test {d : ℕ} {L : ℝ≥0} + (φ : ContDiffBump (0 : EuclideanSpace ℝ (Fin d))) + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) + (hc : HasCompactSupport f) : + ContDiff ℝ ∞ (gaussianSmooth φ f) ∧ HasCompactSupport (gaussianSmooth φ f) := by + exact ⟨φ.hasCompactSupport_normed.contDiff_convolution_left (lsmul ℝ ℝ) + φ.contDiff_normed hf.continuous.locallyIntegrable, + φ.hasCompactSupport_normed.convolution (lsmul ℝ ℝ) hc⟩ + +lemma gaussianSmooth_dist_le {d : ℕ} {L : ℝ≥0} + (φ : ContDiffBump (0 : EuclideanSpace ℝ (Fin d))) + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) + (x : EuclideanSpace ℝ (Fin d)) : + dist (gaussianSmooth φ f x) (f x) ≤ (L : ℝ)*φ.rOut := by + apply φ.dist_normed_convolution_le hf.continuous.aestronglyMeasurable + intro y hy + exact (hf.dist_le_mul y x).trans + (mul_le_mul_of_nonneg_left (Metric.mem_ball.mp hy).le L.coe_nonneg) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTestVariance.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTestVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..06e83d5ba1b2e9a17481b4a84c1ee2b39769d94a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTestVariance.lean @@ -0,0 +1,38 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianQuadraticLaw +import OAI.Probability.InvariantIsing.Gaussian.GaussianLipschitzIntegrability + +namespace OAI + +/-! The proved regular-potential Poincare inequality at the standard Gaussian. -/ +noncomputable section +open MeasureTheory ProbabilityTheory InnerProductSpace +open scoped NNReal +namespace InvariantIsing + +theorem gaussian_test_variance_le {d : ℕ} {L : ℝ≥0} + {f : EuclideanSpace ℝ (Fin d) → ℝ} + (ht : LeanBlast.KLS.IsTestFunction f) (hf : LipschitzWith L f) : + variance f (stdGaussian (EuclideanSpace ℝ (Fin d))) ≤ (L : ℝ)^2 := by + have hp := gaussianQuadraticPotential_poincare_test f ht + rw [gaussianQuadratic_potentialMeasure_eq_stdGaussian] at hp + have hv : variance f (stdGaussian (EuclideanSpace ℝ (Fin d))) = + LeanBlast.KLS.variance (stdGaussian (EuclideanSpace ℝ (Fin d))) f := by + rw [variance_eq_integral hf.continuous.aemeasurable] + rfl + rw [hv] + apply hp.trans + change (∫ x, ‖gradient f x‖^2 ∂stdGaussian _) ≤ _ + calc + _ ≤ ∫ _ : EuclideanSpace ℝ (Fin d), (L : ℝ)^2 ∂stdGaussian _ := by + apply integral_mono (ht.integrable_gradient_sq _) (integrable_const _) + intro x + dsimp only + rw [LeanBlast.KLS.norm_gradient_eq_norm_fderiv] + exact pow_le_pow_left₀ (norm_nonneg _) (norm_fderiv_le_of_lipschitz ℝ hf) 2 + _ = _ := by simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTiltIncrement.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTiltIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..655a2e67b408574cfc7f52b6368ba634a510d55d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTiltIncrement.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianExponentialShift + +namespace OAI + +/-! The canonical one-step Gaussian increment satisfies the sharp +exponential bound from the magnetic replacement argument. Its cost is +proportional to variance, so it can be summed over arbitrary depths. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +theorem gaussian_tilt_increment_mgf (v : ℝ≥0) (z b t : ℝ) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (hLip : ∀ x y, |F x - F y| ≤ |x - y|) (hb0 : 0 ≤ b) (hb1 : b ≤ 1) : + (∫ x, Real.exp (t * x) + ∂(gaussianReal 0 v).tilted (fun x => b * F (z + x))) ≤ + Real.exp ((t ^ 2 / 2 + |t|) * v) := by + let U := fun x => Real.exp (b * F (z + x)) + have hi : Integrable U (gaussianReal 0 v) := + integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments 0 v) + (hF.comp (measurable_const.add measurable_id)) (hG.add_left z) b + have hp : 0 < ∫ x, U x ∂gaussianReal 0 v := + integral_exp_pos _ (fun x => F (z + x)) hi + have hs : Integrable (fun x => U (x + t * v)) (gaussianReal 0 v) := by + have hx := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments 0 v) + (hF.comp (measurable_const.add measurable_id)) (hG.add_left (z + t * v)) b + convert hx using 1 + funext x + change Real.exp (b * F (z + (x + t * v))) = + Real.exp (b * F ((z + t * v) + x)) + rw [show z + (x + t * v) = (z + t * v) + x by ring] + have hbound (x : ℝ) : U (x + t * v) ≤ Real.exp (|t| * v) * U x := by + dsimp only [U] + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + have hl := (abs_le.mp (hLip (z + (x + t * v)) (z + x))).2 + rw [show z + (x + t * v) - (z + x) = t * v by ring, + abs_mul, abs_of_nonneg v.coe_nonneg] at hl + have hmul := mul_le_mul_of_nonneg_left hl hb0 + have hb := mul_le_mul_of_nonneg_right hb1 (mul_nonneg (abs_nonneg t) v.coe_nonneg) + nlinarith + have hshift : (∫ x, U (x + t * v) ∂gaussianReal 0 v) ≤ + Real.exp (|t| * v) * ∫ x, U x ∂gaussianReal 0 v := by + simpa only [integral_const_mul] using integral_mono hs (hi.const_mul _) hbound + rw [integral_tilted_eq_div] + have he : (∫ x, Real.exp (b * F (z + x)) * Real.exp (t * x) ∂gaussianReal 0 v) = + Real.exp (t ^ 2 * v / 2) * ∫ x, U (x + t * v) ∂gaussianReal 0 v := by + rw [show (fun x => Real.exp (b * F (z + x)) * Real.exp (t * x)) = + (fun x => Real.exp (t * x) * U x) by funext x; exact mul_comm _ _] + exact gaussian_exp_linear_shift v t U ((hF.comp (measurable_const.add measurable_id)).const_mul b).exp + rw [he] + apply (div_le_iff₀ hp).mpr + calc + _ ≤ Real.exp (t ^ 2 * v / 2) * (Real.exp (|t| * v) * ∫ x, U x ∂gaussianReal 0 v) := + mul_le_mul_of_nonneg_left hshift (Real.exp_pos _).le + _ = _ := by + rw [← mul_assoc, ← Real.exp_add] + congr 1 + congr 1 + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTiltLinearGrowth.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTiltLinearGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..47f52d582135bdedac816e00bf96432961850372 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTiltLinearGrowth.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldRecursion + +namespace OAI + +/-! Linear-growth observables are integrable under finite Gaussian tilts +with linear-growth potentials. This supplies the actual recursive loss +integrals, without extra moment hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma exponentialNormMoments_tilted {E : Type*} [NormedAddCommGroup E] + [MeasurableSpace E] [BorelSpace E] (μ : Measure E) (hμ : ExponentialNormMoments μ) + (F : E → ℝ) (hF : Measurable F) (hFG : HasLinearGrowth F) (b : ℝ) : + ExponentialNormMoments (μ.tilted (fun x => b * F x)) := by + have he := integrable_exp_of_linearGrowth μ hμ hF hFG b + obtain ⟨C, L, _, _, hbF⟩ := hFG + intro a + rw [integrable_tilted_iff he] + change Integrable (fun x => Real.exp (b * F x) * Real.exp (a * ‖x‖)) μ + apply ((hμ (|b| * L + a)).const_mul (Real.exp (|b| * C))).mono' + (((hF.const_mul b).exp).mul ((measurable_norm.const_mul a).exp)).aestronglyMeasurable + apply ae_of_all + intro x + change ‖Real.exp (b * F x) * Real.exp (a * ‖x‖)‖ ≤ _ + rw [Real.norm_eq_abs, abs_of_pos (mul_pos (Real.exp_pos _) (Real.exp_pos _)), + ← Real.exp_add, ← Real.exp_add] + apply Real.exp_le_exp.mpr + have hb : b * F x ≤ |b| * (C + L * ‖x‖) := by + calc + _ ≤ |b| * |F x| := by rw [← abs_mul]; exact le_abs_self _ + _ ≤ _ := mul_le_mul_of_nonneg_left (hbF x) (abs_nonneg b) + nlinarith + +lemma integrable_linearGrowth_tilted {E : Type*} [SeminormedAddCommGroup E] + [MeasurableSpace E] (μ : Measure E) (hμ : ExponentialNormMoments μ) + (F G : E → ℝ) (hF : Measurable F) (hFG : HasLinearGrowth F) + (hG : Measurable G) (hGG : HasLinearGrowth G) (b : ℝ) : + Integrable G (μ.tilted (fun x => b * F x)) := by + have he := integrable_exp_of_linearGrowth μ hμ hF hFG b + rw [integrable_tilted_iff he] + obtain ⟨C, L, hC, hL, hbF⟩ := hFG + obtain ⟨D, K, hD, hK, hbG⟩ := hGG + have henv := (hμ (|b| * L + 1)).const_mul (Real.exp (|b| * C) * (D + K)) + apply henv.mono' (((hF.const_mul b).exp).mul hG).aestronglyMeasurable + apply ae_of_all + intro x + have hexp : Real.exp (b * F x) ≤ Real.exp (|b| * C + (|b| * L) * ‖x‖) := by + apply Real.exp_le_exp.mpr + calc + _ ≤ |b| * |F x| := by rw [← abs_mul]; exact le_abs_self _ + _ ≤ |b| * (C + L * ‖x‖) := mul_le_mul_of_nonneg_left (hbF x) (abs_nonneg _) + _ = _ := by ring + have hn : ‖x‖ ≤ Real.exp ‖x‖ := by linarith [Real.add_one_le_exp ‖x‖] + have h1 : 1 ≤ Real.exp ‖x‖ := Real.one_le_exp (norm_nonneg _) + have hg : |G x| ≤ (D + K) * Real.exp ‖x‖ := by + have hd := mul_le_mul_of_nonneg_left h1 hD + have hk := mul_le_mul_of_nonneg_left hn hK + nlinarith [hbG x] + change ‖Real.exp (b * F x) * G x‖ ≤ _ + rw [Real.norm_eq_abs, abs_mul, abs_of_pos (Real.exp_pos _)] + calc + _ ≤ Real.exp (|b| * C + (|b| * L) * ‖x‖) * ((D + K) * Real.exp ‖x‖) := + mul_le_mul hexp hg (abs_nonneg _) (Real.exp_pos _).le + _ = Real.exp (|b| * C) * (D + K) * Real.exp ((|b| * L + 1) * ‖x‖) := by + rw [Real.exp_add, show (|b| * L + 1) * ‖x‖ = (|b| * L) * ‖x‖ + ‖x‖ by ring, + Real.exp_add] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTranspose.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTranspose.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0bf1dc2390f1ebfd06efc28ad7d727f12df8d37 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTranspose.lean @@ -0,0 +1,35 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternSingularMinimum + +namespace OAI + +/-! Transposition preserves the actual standard Gaussian array law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +namespace InvariantIsing + +def gaussianPatternTranspose (N m : ℕ) : + EuclideanSpace ℝ (Fin N × Fin m) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin m × Fin N) := + LinearIsometryEquiv.piLpCongrLeft 2 ℝ ℝ (Equiv.prodComm (Fin N) (Fin m)) + +lemma gaussianPatternTranspose_apply {N m : ℕ} + (z : EuclideanSpace ℝ (Fin N × Fin m)) (j : Fin m) (i : Fin N) : + gaussianPatternTranspose N m z (j,i) = z (i,j) := rfl + +lemma gaussianPatternTranspose_array {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + gaussianPatternArray (gaussianPatternTranspose N m z) = (gaussianPatternArray z)ᵀ := rfl + +lemma gaussianPatternTranspose_hasLaw {N m : ℕ} {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (Z : Ω → EuclideanSpace ℝ (Fin N × Fin m)) (hZ : HasLaw Z (stdGaussian _) P) : + HasLaw (fun ω => gaussianPatternTranspose N m (Z ω)) (stdGaussian _) P := by + have hT : HasLaw (gaussianPatternTranspose N m) + (stdGaussian (EuclideanSpace ℝ (Fin m × Fin N))) + (stdGaussian (EuclideanSpace ℝ (Fin N × Fin m))) := + ⟨(gaussianPatternTranspose N m).continuous.measurable.aemeasurable, + stdGaussian_map (gaussianPatternTranspose N m)⟩ + exact hT.comp hZ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTransposeLowerEdge.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTransposeLowerEdge.lean new file mode 100644 index 0000000000000000000000000000000000000000..448f5e14620b1b27acfda11f9df6e0a1ec4755ef --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianTransposeLowerEdge.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianSingularLowerMean +import OAI.Probability.InvariantIsing.Gaussian.GaussianTranspose +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternAspect + +namespace OAI + +/-! The lower singular edge of the transposed physical Gaussian array. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma gaussianPatternCount_sub_one_ratio_tendsto {α : ℝ} (hα : 0 ≤ α) : + Tendsto (fun k : ℕ => ((gaussianPatternCount α (k+1) : ℝ)-1)/(k+1)) atTop (𝓝 α) := by + have h := (gaussianPatternCount_ratio_tendsto hα).sub + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) + simpa only [sub_zero,sub_div] using h + +theorem gaussianPatternTranspose_lower_edge {α : ℝ} (hα : 0 < α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => max (Real.sqrt α-1- + gaussianPatternSingularMin (gaussianPatternTranspose (k+1) (gaussianPatternCount α (k+1)) + (Z (k+1) ω))/Real.sqrt (k+1)) 0) atTop (fun _ => 0) := by + let T (k : ℕ) (ω : Ω) := + gaussianPatternTranspose (k+1) (gaussianPatternCount α (k+1)) (Z (k+1) ω) + let M (k : ℕ) := ∫ z : EuclideanSpace ℝ (Fin (gaussianPatternCount α (k+1)) × Fin (k+1)), + gaussianPatternSingularMin z ∂stdGaussian _ + let B (k : ℕ) := Real.sqrt (((gaussianPatternCount α (k+1) : ℝ)-1)/(k+1))-1 + have hB : Tendsto B atTop (𝓝 (Real.sqrt α-1)) := + ((Real.continuous_sqrt.tendsto α).comp (gaussianPatternCount_sub_one_ratio_tendsto hα.le)).sub_const 1 + have hpos : ∀ᶠ k : ℕ in atTop, 0 < gaussianPatternCount α (k+1) := by + filter_upwards [(tendsto_order.1 (gaussianPatternCount_ratio_tendsto hα.le)).1 0 hα] with k hk + have hp : (0 : ℝ) < (gaussianPatternCount α (k+1) : ℝ) := + (div_pos_iff_of_pos_right (by positivity : (0 : ℝ) < k+1)).mp hk + exact_mod_cast hp + have hM : ∀ᶠ k : ℕ in atTop, B k ≤ M k/Real.sqrt (k+1) := by + filter_upwards [hpos] with k hk + have hh := gaussianPatternSingularMin_mean_ge hk (Nat.succ_pos k) + have hs : 0 < Real.sqrt (k+1 : ℝ) := by positivity + have hc : (0 : ℝ) ≤ (gaussianPatternCount α (k+1) : ℝ)-1 := by + have hc' : (1 : ℝ) ≤ (gaussianPatternCount α (k+1) : ℝ) := by + exact_mod_cast (Nat.succ_le_iff.mpr hk) + linarith + have hd := div_le_div_of_nonneg_right hh hs.le + dsimp only [B,M] + rw [Real.sqrt_div hc] + simpa only [Nat.cast_succ,Nat.cast_add,Nat.cast_one,sub_div,div_self hs.ne'] using hd + have hT (k : ℕ) : HasLaw (T k) (stdGaussian _) P := gaussianPatternTranspose_hasLaw P _ (hZ (k+1)) + have hcent := finiteGaussian_centered_tendsto (fun k => + gaussianPatternSingularMin (N := gaussianPatternCount α (k+1)) (m := k+1)) + (fun k => gaussianPatternSingularMin_lipschitz _ _ (Nat.succ_pos k)) P T hT + have hmeas (k : ℕ) : AEStronglyMeasurable + (fun ω => max (Real.sqrt α-1-gaussianPatternSingularMin (T k ω)/Real.sqrt (k+1)) 0) P := by + have h : Measurable (fun z : EuclideanSpace ℝ + (Fin (gaussianPatternCount α (k+1)) × Fin (k+1)) => + max (Real.sqrt α-1-gaussianPatternSingularMin z/Real.sqrt (k+1)) 0) := by + have hc := (gaussianPatternSingularMin_lipschitz (gaussianPatternCount α (k+1)) (k+1) + (Nat.succ_pos k)).continuous + fun_prop + exact (h.aemeasurable.comp_aemeasurable (hT k).aemeasurable).aestronglyMeasurable + apply (exists_seq_tendstoInMeasure_atTop_iff hmeas).mpr + intro ns hns + obtain ⟨u,hu,hcu⟩ := (hcent.comp hns.tendsto_atTop).exists_seq_tendsto_ae + refine ⟨u,hu,?_⟩ + filter_upwards [hcu] with ω hω + have hc : Tendsto (fun k => (gaussianPatternSingularMin (T (ns (u k)) ω)-M (ns (u k)))/ + Real.sqrt (ns (u k)+1)) atTop (𝓝 0) := hω + have hb := hB.comp (hns.comp hu).tendsto_atTop + have ht := ((hc.neg.add (tendsto_const_nhds (x := Real.sqrt α-1))).sub hb).max + (tendsto_const_nhds (x := (0 : ℝ))) + have ht' : Tendsto (fun k => max + (-(gaussianPatternSingularMin (T (ns (u k)) ω)-M (ns (u k)))/Real.sqrt (ns (u k)+1) + + (Real.sqrt α-1)-B (ns (u k))) 0) atTop (𝓝 0) := by + simpa only [neg_zero,zero_add,sub_self,max_self,neg_div,Function.comp_def] using ht + apply squeeze_zero' (Eventually.of_forall (fun _ => le_max_right _ _)) _ ht' + filter_upwards [(hns.comp hu).tendsto_atTop.eventually hM] with k hk + dsimp only [Function.comp_def] at hk + apply max_le_max _ le_rfl + rw [neg_div,sub_div] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianVarianceInput.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianVarianceInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd64b58e47f6b20ddd1d02f74e7aec21fcb1da47 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianVarianceInput.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianConeCutoff + +namespace OAI + +/-! Finite-dimensional Gaussian variance for Lipschitz functions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped NNReal Topology +namespace InvariantIsing + +lemma gaussian_centered_lipschitz_variance_le {d : ℕ} {L : ℝ≥0} + {f : EuclideanSpace ℝ (Fin d) → ℝ} (hf : LipschitzWith L f) (h0 : f 0 = 0) : + variance f (stdGaussian (EuclideanSpace ℝ (Fin d))) ≤ (L : ℝ)^2 := by + let F := fun n : ℕ => gaussianConeCutoff L (2*(n+1 : ℝ)) f + have hL n : LipschitzWith L (F n) := gaussianConeCutoff_lipschitz hf + have hv n : variance (F n) (stdGaussian (EuclideanSpace ℝ (Fin d))) ≤ (L : ℝ)^2 := + gaussian_compact_variance_le (hL n) (gaussianConeCutoff_compact _ _ _) + have ht (x : EuclideanSpace ℝ (Fin d)) : Tendsto (fun n => F n x) atTop (𝓝 (f x)) := by + have he : ∀ᶠ n : ℕ in atTop, ‖x‖ ≤ (n : ℝ) := + tendsto_natCast_atTop_atTop.eventually (eventually_ge_atTop ‖x‖) + apply tendsto_const_nhds.congr' + filter_upwards [he] with n hn + exact (gaussianConeCutoff_eq hf h0 x (by linarith)).symm + have hm : Tendsto (fun n => ∫ x, F n x ∂stdGaussian _) atTop + (𝓝 (∫ x, f x ∂stdGaussian _)) := by + apply tendsto_integral_of_dominated_convergence (fun x => ‖f x‖) + (fun n => (hL n).continuous.aestronglyMeasurable) (gaussian_lipschitz_integrable hf).norm + · exact fun n => ae_of_all _ (gaussianConeCutoff_norm_le _ _ _) + · exact ae_of_all _ ht + exact variance_le_of_ae_tendsto_of_mean_tendsto + (fun n => gaussian_lipschitz_memLp_two (hL n)) (gaussian_lipschitz_memLp_two hf) + (ae_of_all _ ht) hm hv + +/-- The Gaussian Poincaré inequality for globally Lipschitz observables. -/ +theorem gaussianLipschitzVariance_proved : GaussianLipschitzVarianceInput := by + intro d L f hf + have hc : LipschitzWith L (fun x => f x-f 0) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_eq_norm, sub_sub_sub_cancel_right] using hf.dist_le_mul x y + have h := gaussian_centered_lipschitz_variance_le hc (by simp) + rwa [variance_sub_const hf.continuous.aestronglyMeasurable] at h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianZeroUpperExcess.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianZeroUpperExcess.lean new file mode 100644 index 0000000000000000000000000000000000000000..d532e2af95429ffdcc2c9b2bb6fd601a189a8bf3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GaussianZeroUpperExcess.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramEdges +import OAI.Probability.InvariantIsing.Gaussian.MPMeasureSupport +import OAI.Probability.InvariantIsing.Pressure.InMeasurePerturbation + +namespace OAI + +/-! The proved Gaussian edge law also controls clipping to the nonnegative MP interval. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma mp_lower_nonneg {α : ℝ} (hα : 0 ≤ α) : 0 ≤ marchenkoPasturLower α := by + rw [marchenkoPasturLower_positive_part hα] + exact sq_nonneg _ + +lemma mp_lower_le_upper {α : ℝ} (hα : 0 < α) : + marchenkoPasturLower α ≤ marchenkoPasturB α := + (marchenkoPastur_support_bound hα (marchenkoPastur_left_mem hα)).2 + +theorem gaussianPattern_zero_upper_excess {α : ℝ} (hα : 0 < α) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (hZ : ∀ N, HasLaw (Z N) (stdGaussian _) P) : + TendstoInMeasure P (fun k ω => spectralExcess (gaussianPatternEigenvalues (Z (k+1) ω)) + 0 (marchenkoPasturB α)) atTop (fun _ => 0) := by + have ht := gaussianPattern_spectralExcess_tendsto hα P Z hZ 1 + simp only [one_mul,min_eq_left (mp_lower_le_upper hα),max_eq_right (mp_lower_le_upper hα)] at ht + apply tendstoInMeasure_zero_of_abs_le P _ _ ht + intro k ω + rw [abs_of_nonneg (spectralExcess_nonneg _ _ _),abs_of_nonneg (spectralExcess_nonneg _ _ _)] + apply spectralExcess_le _ _ _ _ (spectralExcess_nonneg _ _ _) + intro i + have hb := spectralExcess_bounds (gaussianPatternEigenvalues (Z (k+1) ω)) + (marchenkoPasturLower α) (marchenkoPasturB α) i + exact ⟨by linarith [mp_lower_nonneg hα.le],hb.2⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonBounds.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9dc13337d133fd480316d13c21e6abec5893471b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonBounds.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonWeights + +namespace OAI + +/-! Uniform bounds and continuity for the two-level Gaussian comparison weights. -/ +noncomputable section +open IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +omit [Fintype V] [Nonempty V] in +lemma gordonRowMean_bound (H D : U × V → ℝ) (K : ℝ) + (hD : ∀ x, |D x| ≤ K) (v : V) : |gordonRowMean H D v| ≤ K := + finiteGibbs_average_bound gordon_reference _ _ (fun u => hD (u,v)) + +lemma gordonMean_bound (H D : U × V → ℝ) (K : ℝ) + (hD : ∀ x, |D x| ≤ K) : |gordonMean H D| ≤ K := + finiteGibbs_average_bound gordon_reference _ _ (gordonRowMean_bound H D K hD) + +lemma gordonWeight_derivative_bound (H D : U × V → ℝ) (K : ℝ) (hK : 0 ≤ K) + (hD : ∀ x, |D x| ≤ K) (x : U × V) : + |gordonWeight H x*(D x-2*gordonRowMean H D x.2+gordonMean H D)| ≤ 4*K := by + have hb : |D x-2*gordonRowMean H D x.2+gordonMean H D| ≤ 4*K := by + calc + _ ≤ |D x|+|2*gordonRowMean H D x.2|+|gordonMean H D| := + (abs_add_le _ _).trans (add_le_add (abs_sub _ _) le_rfl) + _ = |D x|+2*|gordonRowMean H D x.2|+|gordonMean H D| := by rw [abs_mul,abs_of_pos (by norm_num : (0 : ℝ) < 2)] + _ ≤ 4*K := by linarith [hD x,gordonRowMean_bound H D K hD x.2,gordonMean_bound H D K hD] + rw [abs_mul,abs_of_nonneg (gordonWeight_nonneg H x)] + exact (mul_le_mul_of_nonneg_left hb (gordonWeight_nonneg H x)).trans + (by nlinarith [gordonWeight_le_one H x]) + +omit [Fintype V] [Nonempty V] in +lemma continuous_gordonRow {S : Type*} [TopologicalSpace S] (H : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) (v : V) : + Continuous (fun s => gordonRow (H s) v) := by + apply Continuous.log + · exact continuous_finsetSum _ (fun u _ => (Real.continuous_exp.comp (hH (u,v))).const_mul 1) + · intro s + exact (finitePartition_pos gordon_reference (fun u => H s (u,v))).ne' + +omit [Fintype V] [Nonempty V] in +lemma continuous_gordonInner {S : Type*} [TopologicalSpace S] (H : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) (u : U) (v : V) : + Continuous (fun s => gordonInner (H s) u v) := by + apply Continuous.div + · exact (Real.continuous_exp.comp (hH (u,v))).const_mul 1 + · exact continuous_finsetSum _ (fun u _ => (Real.continuous_exp.comp (hH (u,v))).const_mul 1) + · intro s + exact (finitePartition_pos gordon_reference (fun u => H s (u,v))).ne' + +lemma continuous_gordonOuter {S : Type*} [TopologicalSpace S] (H : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) (v : V) : + Continuous (fun s => gordonOuter (H s) v) := by + apply Continuous.div + · exact (Real.continuous_exp.comp (continuous_gordonRow H hH v).neg).const_mul 1 + · exact continuous_finsetSum _ (fun v _ => + (Real.continuous_exp.comp (continuous_gordonRow H hH v).neg).const_mul 1) + · intro s + exact (finitePartition_pos gordon_reference (fun v => -gordonRow (H s) v)).ne' + +lemma continuous_gordonWeight {S : Type*} [TopologicalSpace S] (H : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) (x : U × V) : + Continuous (fun s => gordonWeight (H s) x) := + (continuous_gordonOuter H hH x.2).mul (continuous_gordonInner H hH x.1 x.2) + +lemma continuous_gordonValue {S : Type*} [TopologicalSpace S] (H : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) : + Continuous (fun s => gordonValue (H s)) := by + apply Continuous.neg + apply Continuous.log + · exact continuous_finsetSum _ (fun v _ => + (Real.continuous_exp.comp (continuous_gordonRow H hH v).neg).const_mul 1) + · intro s + exact (finitePartition_pos gordon_reference (fun v => -gordonRow (H s) v)).ne' + +omit [Fintype V] [Nonempty V] in +lemma continuous_gordonRowMean {S : Type*} [TopologicalSpace S] (H D : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) (hD : ∀ x, Continuous (fun s => D s x)) (v : V) : + Continuous (fun s => gordonRowMean (H s) (D s) v) := + continuous_finsetSum _ (fun u _ => (continuous_gordonInner H hH u v).mul (hD (u,v))) + +lemma continuous_gordonMean {S : Type*} [TopologicalSpace S] (H D : S → U × V → ℝ) + (hH : ∀ x, Continuous (fun s => H s x)) (hD : ∀ x, Continuous (fun s => D s x)) : + Continuous (fun s => gordonMean (H s) (D s)) := + continuous_finsetSum _ (fun v _ => + (continuous_gordonOuter H hH v).mul (continuous_gordonRowMean H D hH hD v)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonComparison.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..b132c637854a0e8aa3195585e19bc0c0099f4f8f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonComparison.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonCurveMean + +namespace OAI + +/-! Finite Gaussian minimum--maximum comparison for matching row covariances. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +theorem finite_gaussian_gordon_comparison {d : ℕ} (C A : U × V → Fin (d+1) → ℝ) + (hCA : ∀ x y, gaussianCross C A x y = 0) + (hrow : ∀ x u, gaussianCross A A x (u,x.2) = gaussianCross C C x (u,x.2)) + (hoff : ∀ x y, gaussianCross A A x y ≤ gaussianCross C C x y) : + (∫ g, gordonValue (fun x => linearGaussian A g x) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) ≤ + ∫ g, gordonValue (fun x => linearGaussian C g x) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + have hd (s : ℝ) := gordonCurveMean_hasDerivAt C A s + have hs (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) (Real.pi/2)) : + gordonCurveSlope C A s ≤ 0 := by + have hsc : 0 ≤ Real.sin s*Real.cos s := mul_nonneg + (Real.sin_nonneg_of_nonneg_of_le_pi hs.1 (by linarith [hs.2,Real.pi_pos])) + (Real.cos_nonneg_of_mem_Icc ⟨by linarith [hs.1,Real.pi_pos],hs.2⟩) + apply gordon_gaussian_mean_nonpos + · intro x u + rw [cavityGaussianCurve_cross C A s x (u,x.2) hCA,hrow x u,sub_self,mul_zero] + · intro x y + rw [cavityGaussianCurve_cross C A s x y hCA] + exact mul_nonpos_of_nonneg_of_nonpos hsc (sub_nonpos.mpr (hoff x y)) + have hm : AntitoneOn (gordonCurveMean C A) (Set.Icc (0 : ℝ) (Real.pi/2)) := by + apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc _ _) + (continuous_iff_continuousAt.mpr (fun s => (hd s).continuousAt)).continuousOn + (fun s _ => (hd s).hasDerivWithinAt) + intro s hs' + exact hs s (interior_subset hs') + have hp : (0 : ℝ) ≤ Real.pi/2 := by positivity + have he := hm ⟨le_rfl,hp⟩ ⟨hp,le_rfl⟩ hp + simpa only [gordonCurveMean,linearGaussian,cavityGaussianCurve, + Real.cos_zero,Real.sin_zero,Real.cos_pi_div_two,Real.sin_pi_div_two, + one_mul,zero_mul,mul_zero,zero_add,add_zero] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonCovariance.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4c2f50a949d47f7497fbd864b01a4bf281bc1e0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonCovariance.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonGaussianInsertion + +namespace OAI + +/-! Covariance contraction of the two-level Gaussian integration-by-parts identity. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +omit [Nonempty U] [Fintype V] [Nonempty V] in +lemma gordonRowMean_linear_sum {d : ℕ} (H : U × V → ℝ) (C : U × V → Fin d → ℝ) + (a : Fin d → ℝ) (v : V) : + (∑ i, a i*gordonRowMean H (fun y => C y i) v) = + ∑ u, gordonInner H u v*(∑ i, a i*C (u,v) i) := by + simp only [gordonRowMean,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + apply Finset.sum_congr rfl + intro i _ + ring + +omit [Nonempty U] [Nonempty V] in +lemma gordonMean_linear_sum {d : ℕ} (H : U × V → ℝ) (C : U × V → Fin d → ℝ) + (a : Fin d → ℝ) : + (∑ i, a i*gordonMean H (fun y => C y i)) = + ∑ y, gordonWeight H y*(∑ i, a i*C y i) := by + simp only [gordonMean_eq_sum,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y _ + apply Finset.sum_congr rfl + intro i _ + ring + +omit [Nonempty U] [Nonempty V] in +lemma gordon_covariance_contraction {d : ℕ} (H : U × V → ℝ) + (A C : U × V → Fin d → ℝ) (x : U × V) : + (∑ i, A x i*(gordonWeight H x*(C x i-2*gordonRowMean H (fun y => C y i) x.2+ + gordonMean H (fun y => C y i)))) = + gordonWeight H x*(gaussianCross A C x x- + 2*(∑ u, gordonInner H u x.2*gaussianCross A C x (u,x.2))+ + ∑ y, gordonWeight H y*gaussianCross A C x y) := by + calc + _ = gordonWeight H x * ∑ i, (A x i*C x i- + 2*(A x i*gordonRowMean H (fun y => C y i) x.2)+ + A x i*gordonMean H (fun y => C y i)) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + _ = gordonWeight H x*((∑ i, A x i*C x i)- + 2*(∑ i, A x i*gordonRowMean H (fun y => C y i) x.2)+ + ∑ i, A x i*gordonMean H (fun y => C y i)) := by + rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,← Finset.mul_sum] + _ = _ := by rw [gordonRowMean_linear_sum,gordonMean_linear_sum]; rfl + +theorem gordon_gaussian_covariance_insertion {d : ℕ} (A C : U × V → Fin (d+1) → ℝ) + (x : U × V) : + (∫ g, linearGaussian A g x*gordonWeight (fun y => linearGaussian C g y) x + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) = + ∫ g, gordonWeight (fun y => linearGaussian C g y) x*(gaussianCross A C x x- + 2*(∑ u, gordonInner (fun y => linearGaussian C g y) u x.2*gaussianCross A C x (u,x.2))+ + ∑ y, gordonWeight (fun y => linearGaussian C g y) y*gaussianCross A C x y) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + rw [gordon_gaussian_insertion] + exact integral_congr_ae (ae_of_all _ (fun g => gordon_covariance_contraction _ A C x)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonCurveMean.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonCurveMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..10ded79158de4a66d20da968b744231deb8f9e22 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonCurveMean.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonSlopeSign + +namespace OAI + +/-! Differentiation under the finite Gaussian minimum--maximum interpolation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +def gordonCurveMean {d : ℕ} (C A : U × V → Fin d → ℝ) (t : ℝ) : ℝ := + ∫ g, gordonValue (fun x => linearGaussian (cavityGaussianCurve C A t) g x) + ∂Measure.pi (fun _ : Fin d => gaussianReal 0 1) + +def gordonCurveSlope {d : ℕ} (C A : U × V → Fin d → ℝ) (t : ℝ) : ℝ := + ∫ g, gordonMean (fun x => linearGaussian (cavityGaussianCurve C A t) g x) + (fun x => linearGaussian (cavityGaussianCurveDerivative C A t) g x) + ∂Measure.pi (fun _ : Fin d => gaussianReal 0 1) + +lemma gordonCurveMean_hasDerivAt {d : ℕ} (C A : U × V → Fin d → ℝ) (t : ℝ) : + HasDerivAt (gordonCurveMean C A) (gordonCurveSlope C A t) t := by + let μ := Measure.pi (fun _ : Fin d => gaussianReal 0 1) + let B := fun g : Fin d → ℝ => ∑ x, (|linearGaussian C g x|+|linearGaussian A g x|) + have hm (s : ℝ) : AEStronglyMeasurable (fun g => + gordonValue (fun x => linearGaussian (cavityGaussianCurve C A s) g x)) μ := + (continuous_gordonValue _ (fun x => by unfold linearGaussian; fun_prop)).aestronglyMeasurable + have hi : Integrable (fun g => + gordonValue (fun x => linearGaussian (cavityGaussianCurve C A t) g x)) μ := by + simpa only [zero_add] using integrable_gordonValue (fun _ => 0) (cavityGaussianCurve C A t) + apply (hasDerivAt_integral_of_dominated_loc_of_deriv_le (μ := μ) (s := Set.univ) + (F' := fun s g => gordonMean (fun x => linearGaussian (cavityGaussianCurve C A s) g x) + (fun x => linearGaussian (cavityGaussianCurveDerivative C A s) g x)) + (bound := B) Filter.univ_mem (Filter.Eventually.of_forall hm) hi ?_ ?_ ?_ ?_).2 + · exact (continuous_gordonMean _ _ + (fun x => by unfold linearGaussian; fun_prop) + (fun x => by unfold linearGaussian; fun_prop)).aestronglyMeasurable + · apply ae_of_all + intro g s _ + rw [Real.norm_eq_abs] + apply gordonMean_bound + intro x + exact (cavityGaussianCurveDerivative_bound C A s g x).trans + (Finset.single_le_sum + (f := fun x => |linearGaussian C g x|+|linearGaussian A g x|) + (fun _ _ => add_nonneg (abs_nonneg _) (abs_nonneg _)) + (Finset.mem_univ x)) + · exact integrable_finsetSum _ (fun x _ => + (integrable_linearGaussian C x).abs.add (integrable_linearGaussian A x).abs) + · apply ae_of_all + intro g s _ + exact gordonValue_hasDerivAt (fun x => cavityGaussianCurve_hasDerivAt C A s g x) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonGaussianInsertion.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonGaussianInsertion.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fcd458a864d10ea53ceced081ae7b328df119be --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonGaussianInsertion.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonBounds + +namespace OAI + +/-! Gaussian integration by parts for the joint minimum--maximum Gibbs weight. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +lemma gordon_gaussian_insertion {d : ℕ} (A C : U × V → Fin (d+1) → ℝ) (x : U × V) : + (∫ g, linearGaussian A g x * gordonWeight (fun y => linearGaussian C g y) x + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) = + ∫ g, ∑ i, A x i * (gordonWeight (fun y => linearGaussian C g y) x * + (C x i-2*gordonRowMean (fun y => linearGaussian C g y) (fun y => C y i) x.2+ + gordonMean (fun y => linearGaussian C g y) (fun y => C y i))) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1) := by + let H := fun g : Fin (d+1) → ℝ => fun y => linearGaussian C g y + have hH (y : U × V) : Continuous (fun g => H g y) := by dsimp [H,linearGaussian]; fun_prop + have hw : Measurable (fun g => gordonWeight (H g) x) := (continuous_gordonWeight H hH x).measurable + have hd (i : Fin (d+1)) : Continuous (fun g => gordonWeight (H g) x * + (C x i-2*gordonRowMean (H g) (fun y => C y i) x.2+gordonMean (H g) (fun y => C y i))) := by + exact (continuous_gordonWeight H hH x).mul + ((continuous_const.sub (continuous_const.mul + (continuous_gordonRowMean H (fun _ y => C y i) hH (fun _ => continuous_const) x.2))).add + (continuous_gordonMean H (fun _ y => C y i) hH (fun _ => continuous_const))) + apply gaussian_pi_linear_insertion (A x) hw (fun i => (hd i).measurable) + · intro i g t + exact gordonWeight_hasDerivAt (fun y => hasDerivAt_linearGaussian_insert C i g y t) x + · intro g + rw [abs_of_nonneg (gordonWeight_nonneg (H g) x)] + exact gordonWeight_le_one (H g) x + · intro i g + apply gordonWeight_derivative_bound (H g) (fun y => C y i) (∑ y, |C y i|) + (Finset.sum_nonneg (fun _ _ => abs_nonneg _)) + intro y + exact Finset.single_le_sum (fun z _ => abs_nonneg (C z i)) (Finset.mem_univ y) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonSlopeSign.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonSlopeSign.lean new file mode 100644 index 0000000000000000000000000000000000000000..943c07c68f2dde3ce59edaa2941f93b3186588a6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonSlopeSign.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonCovariance +import OAI.Probability.InvariantIsing.Gaussian.GordonValueBound + +namespace OAI + +/-! The sign of the Gaussian two-level Gibbs slope when row covariances agree. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +lemma gordon_gaussian_mean_nonpos {d : ℕ} (A C : U × V → Fin (d+1) → ℝ) + (hrow : ∀ x u, gaussianCross A C x (u,x.2) = 0) + (hoff : ∀ x y, gaussianCross A C x y ≤ 0) : + (∫ g, gordonMean (fun y => linearGaussian C g y) (fun y => linearGaussian A g y) + ∂Measure.pi (fun _ : Fin (d+1) => gaussianReal 0 1)) ≤ 0 := by + simp_rw [gordonMean_eq_sum] + rw [integral_finsetSum _ (fun x _ => by + simpa only [mul_comm] using integrable_gordon_linear A C x)] + apply Finset.sum_nonpos + intro x _ + simp only [mul_comm (gordonWeight _ x)] + rw [gordon_gaussian_covariance_insertion] + apply integral_nonpos + intro g + dsimp only + have hd : gaussianCross A C x x = 0 := by simpa using hrow x x.1 + have hr : (∑ u, gordonInner (fun y => linearGaussian C g y) u x.2 * + gaussianCross A C x (u,x.2)) = 0 := by simp only [hrow,mul_zero,Finset.sum_const_zero] + rw [hd,hr,mul_zero,sub_zero,zero_add] + apply mul_nonpos_of_nonneg_of_nonpos (gordonWeight_nonneg _ x) + exact Finset.sum_nonpos (fun y _ => + mul_nonpos_of_nonneg_of_nonpos (gordonWeight_nonneg _ y) (hoff x y)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonValueBound.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonValueBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..fbbb53f3720677b31dc0dd725b45423767b6c5e3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonValueBound.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Gaussian.GordonBounds + +namespace OAI + +/-! Finite Lipschitz and integrability bounds for the Gaussian minimum--maximum value. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +lemma gordonValue_sub_bound (H J : U × V → ℝ) (K : ℝ) + (hD : ∀ x, |H x-J x| ≤ K) : |gordonValue H-gordonValue J| ≤ K := by + let F := fun t : ℝ => fun x => J x+t*(H x-J x) + have hd (t : ℝ) : HasDerivAt (fun t => gordonValue (F t)) + (gordonMean (F t) (fun x => H x-J x)) t := by + apply gordonValue_hasDerivAt + intro x + simpa only [F, id_eq, one_mul] using + (((hasDerivAt_id t).mul_const (H x-J x)).const_add (J x)) + have hb (t : ℝ) : ‖gordonMean (F t) (fun x => H x-J x)‖ ≤ K := by + simpa only [Real.norm_eq_abs] using gordonMean_bound (F t) _ K hD + have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (s := (univ : Set ℝ)) (fun t _ => (hd t).hasDerivWithinAt) + (fun t _ => hb t) convex_univ (mem_univ (0 : ℝ)) (mem_univ (1 : ℝ)) + simpa only [F,zero_mul,add_zero,one_mul,add_sub_cancel,sub_zero,norm_one,mul_one, + Real.norm_eq_abs] using h + +lemma integrable_gordonValue {d : ℕ} (H : U × V → ℝ) (C : U × V → Fin d → ℝ) : + Integrable (fun g => gordonValue (fun x => H x+linearGaussian C g x)) + (Measure.pi (fun _ : Fin d => gaussianReal 0 1)) := by + have hc : Continuous (fun g : Fin d → ℝ => gordonValue (fun x => H x+linearGaussian C g x)) := + continuous_gordonValue _ (fun x => by unfold linearGaussian; fun_prop) + apply ((integrable_const |gordonValue H|).add + (integrable_finsetSum Finset.univ (fun x _ => (integrable_linearGaussian C x).abs))).mono' + hc.aestronglyMeasurable + apply ae_of_all + intro g + have hb := gordonValue_sub_bound (fun x => H x+linearGaussian C g x) H + (∑ x, |linearGaussian C g x|) (fun x => by + simpa only [add_sub_cancel_left] using + Finset.single_le_sum (fun y _ => abs_nonneg (linearGaussian C g y)) (Finset.mem_univ x)) + rw [Real.norm_eq_abs] + have ht := abs_add_le + (gordonValue (fun x => H x+linearGaussian C g x)-gordonValue H) (gordonValue H) + rw [sub_add_cancel] at ht + change |gordonValue (fun x => H x+linearGaussian C g x)| ≤ + |gordonValue H| + ∑ x, |linearGaussian C g x| + exact ht.trans (by linarith) + +lemma integrable_gordon_linear {d : ℕ} (A C : U × V → Fin d → ℝ) (x : U × V) : + Integrable (fun g => linearGaussian A g x*gordonWeight (fun y => linearGaussian C g y) x) + (Measure.pi (fun _ : Fin d => gaussianReal 0 1)) := by + apply (integrable_linearGaussian A x).mul_bdd + (continuous_gordonWeight _ (fun y => by unfold linearGaussian; fun_prop) x).aestronglyMeasurable + apply ae_of_all + intro g + rw [Real.norm_eq_abs,abs_of_nonneg (gordonWeight_nonneg _ x)] + exact gordonWeight_le_one _ x + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/GordonWeights.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..9224044be2f140834f46ec7ec645b5a4352db897 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/GordonWeights.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianComparisonSign + +namespace OAI + +/-! The two finite Gibbs levels in the Gaussian minimum--maximum comparison. -/ +noncomputable section +open IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] + +lemma gordon_reference {X : Type*} [Nonempty X] : GibbsReference (fun _ : X => (1 : ℝ)) := + ⟨fun _ => zero_le_one,⟨Classical.choice inferInstance,zero_lt_one⟩⟩ + +def gordonRow (H : U × V → ℝ) (v : V) : ℝ := + Real.log (finitePartition (fun _ : U => 1) (fun u => H (u,v))) + +def gordonValue (H : U × V → ℝ) : ℝ := + -Real.log (finitePartition (fun _ : V => 1) (fun v => -gordonRow H v)) + +def gordonInner (H : U × V → ℝ) (u : U) (v : V) : ℝ := + finiteGibbs (fun _ : U => 1) (fun u => H (u,v)) u + +def gordonOuter (H : U × V → ℝ) (v : V) : ℝ := + finiteGibbs (fun _ : V => 1) (fun v => -gordonRow H v) v + +def gordonWeight (H : U × V → ℝ) (x : U × V) : ℝ := + gordonOuter H x.2*gordonInner H x.1 x.2 + +def gordonRowMean (H D : U × V → ℝ) (v : V) : ℝ := + ∑ u, gordonInner H u v*D (u,v) + +def gordonMean (H D : U × V → ℝ) : ℝ := + ∑ v, gordonOuter H v*gordonRowMean H D v + +lemma gordonWeight_nonneg (H : U × V → ℝ) (x : U × V) : 0 ≤ gordonWeight H x := + mul_nonneg (finiteGibbs_nonneg gordon_reference _ _) (finiteGibbs_nonneg gordon_reference _ _) + +lemma gordonWeight_le_one (H : U × V → ℝ) (x : U × V) : gordonWeight H x ≤ 1 := by + calc + _ ≤ 1*1 := mul_le_mul (finiteGibbs_le_one gordon_reference _ _) + (finiteGibbs_le_one gordon_reference _ _) + (finiteGibbs_nonneg gordon_reference _ _) zero_le_one + _ = _ := one_mul _ + +lemma gordonWeight_sum (H : U × V → ℝ) : ∑ x, gordonWeight H x = 1 := by + rw [Fintype.sum_prod_type,Finset.sum_comm] + simp only [gordonWeight,← Finset.mul_sum,gordonInner, + mul_one,gordonOuter,finiteGibbs_sum gordon_reference] + +omit [Nonempty U] [Nonempty V] in +lemma gordonMean_eq_sum (H D : U × V → ℝ) : gordonMean H D = ∑ x, gordonWeight H x*D x := by + rw [Fintype.sum_prod_type,Finset.sum_comm] + simp only [gordonMean,gordonRowMean,Finset.mul_sum,gordonWeight,mul_assoc] + +omit [Fintype V] [Nonempty V] in +lemma gordonRow_hasDerivAt {H : ℝ → U × V → ℝ} {D : U × V → ℝ} {t : ℝ} + (hH : ∀ x, HasDerivAt (fun s => H s x) (D x) t) (v : V) : + HasDerivAt (fun s => gordonRow (H s) v) (gordonRowMean (H t) D v) t := + hasDerivAt_log_finitePartition gordon_reference (fun u => hH (u,v)) + +lemma gordonValue_hasDerivAt {H : ℝ → U × V → ℝ} {D : U × V → ℝ} {t : ℝ} + (hH : ∀ x, HasDerivAt (fun s => H s x) (D x) t) : + HasDerivAt (fun s => gordonValue (H s)) (gordonMean (H t) D) t := by + have h := (hasDerivAt_log_finitePartition gordon_reference + (fun v => (gordonRow_hasDerivAt hH v).neg)).neg + convert h using 1 <;> first | rfl | + simp only [gordonMean,gordonOuter,Pi.neg_apply,mul_neg,Finset.sum_neg_distrib,neg_neg] + +lemma gordonWeight_hasDerivAt {H : ℝ → U × V → ℝ} {D : U × V → ℝ} {t : ℝ} + (hH : ∀ x, HasDerivAt (fun s => H s x) (D x) t) (x : U × V) : + HasDerivAt (fun s => gordonWeight (H s) x) + (gordonWeight (H t) x*(D x-2*gordonRowMean (H t) D x.2+gordonMean (H t) D)) t := by + have hi := hasDerivAt_finiteGibbs gordon_reference (fun u => hH (u,x.2)) x.1 + have ho := hasDerivAt_finiteGibbs gordon_reference + (fun v => (gordonRow_hasDerivAt hH v).neg) x.2 + convert ho.mul hi using 1 + · rfl + simp only [gordonMean,gordonRowMean,gordonWeight,gordonInner,gordonOuter, + Pi.neg_apply,mul_neg,Finset.sum_neg_distrib] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/HermitianGaussianQuadratic.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/HermitianGaussianQuadratic.lean new file mode 100644 index 0000000000000000000000000000000000000000..c06523b7b140f512c6dda545252daf0033dc2290 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/HermitianGaussianQuadratic.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Gaussian.HermitianQuadraticCoordinates +import OAI.Probability.InvariantIsing.Gaussian.GaussianDiagonalQuadratic + +namespace OAI + +/-! Exact Gaussian quadratic mean and variance in finite dimension. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +def gaussianQuadraticForm {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (x : EuclideanSpace ℝ (Fin N)) : ℝ := ⟪x,A.toEuclideanLin x⟫ + +lemma gaussianQuadraticForm_continuous {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + Continuous (gaussianQuadraticForm A) := by unfold gaussianQuadraticForm; fun_prop + +lemma gaussianQuadraticForm_abs_le {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (x : EuclideanSpace ℝ (Fin N)) : + |gaussianQuadraticForm A x| ≤ ‖A.toEuclideanLin.toContinuousLinearMap‖*‖x‖^2 := by + calc + _ ≤ ‖x‖*‖A.toEuclideanLin x‖ := abs_real_inner_le_norm _ _ + _ ≤ ‖x‖*(‖A.toEuclideanLin.toContinuousLinearMap‖*‖x‖) := + mul_le_mul_of_nonneg_left (A.toEuclideanLin.toContinuousLinearMap.le_opNorm x) (norm_nonneg x) + _ = _ := by ring + +lemma gaussianQuadraticForm_memLp {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + MemLp (gaussianQuadraticForm A) 2 (stdGaussian _) := by + have hi := (IsGaussian.memLp_id (stdGaussian (EuclideanSpace ℝ (Fin N))) 4 (by norm_num)).integrable_norm_pow' + apply (memLp_two_iff_integrable_sq (gaussianQuadraticForm_continuous A).aestronglyMeasurable).mpr + apply (hi.const_mul (‖A.toEuclideanLin.toContinuousLinearMap‖^2)).mono' + ((gaussianQuadraticForm_continuous A).pow 2).aestronglyMeasurable + apply ae_of_all + intro x + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)] + have hh := (sq_le_sq₀ (abs_nonneg (gaussianQuadraticForm A x)) + (mul_nonneg (norm_nonneg _) (sq_nonneg ‖x‖))).2 (gaussianQuadraticForm_abs_le A x) + simpa only [sq_abs,mul_pow,← pow_mul,Pi.pow_apply,id_eq] using hh + +lemma hermitianGaussianQuadratic_mean {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.IsHermitian) : + (∫ x, gaussianQuadraticForm A x ∂stdGaussian _) = A.trace := by + let b := hA.eigenvectorBasis + let F (g : Fin N → ℝ) := b.repr.symm (WithLp.toLp 2 g) + have he : HasLaw b.repr.symm (stdGaussian _) (stdGaussian _) := + ⟨b.repr.symm.continuous.measurable.aemeasurable,stdGaussian_map b.repr.symm⟩ + have hz : HasLaw (WithLp.toLp 2 : (Fin N → ℝ) → EuclideanSpace ℝ (Fin N)) + (stdGaussian _) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N => ℝ)).measurable.aemeasurable,map_pi_eq_stdGaussian⟩ + have hF : HasLaw F (stdGaussian _) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := he.comp hz + have hdiag (g : Fin N → ℝ) : gaussianQuadraticForm A (F g) = gaussianDiagonalQuadratic hA.eigenvalues g := by + rw [gaussianQuadraticForm,hermitian_quadratic_coordinates] + simp only [F,b,LinearIsometryEquiv.apply_symm_apply] + rfl + rw [← hF.integral_comp (gaussianQuadraticForm_continuous A).aestronglyMeasurable] + simp_rw [Function.comp_def,hdiag] + rw [gaussianDiagonalQuadratic_mean,hA.trace_eq_sum_eigenvalues] + simp + +lemma hermitianGaussianQuadratic_variance {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.IsHermitian) : + variance (gaussianQuadraticForm A) (stdGaussian _) = 2*∑ i, (hA.eigenvalues i)^2 := by + let b := hA.eigenvectorBasis + let F (g : Fin N → ℝ) := b.repr.symm (WithLp.toLp 2 g) + have he : HasLaw b.repr.symm (stdGaussian _) (stdGaussian _) := + ⟨b.repr.symm.continuous.measurable.aemeasurable,stdGaussian_map b.repr.symm⟩ + have hz : HasLaw (WithLp.toLp 2 : (Fin N → ℝ) → EuclideanSpace ℝ (Fin N)) + (stdGaussian _) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := + ⟨(PiLp.continuous_toLp 2 (fun _ : Fin N => ℝ)).measurable.aemeasurable,map_pi_eq_stdGaussian⟩ + have hF : HasLaw F (stdGaussian _) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := he.comp hz + have hdiag : gaussianQuadraticForm A ∘ F = gaussianDiagonalQuadratic hA.eigenvalues := by + funext g + change ⟪F g,A.toEuclideanLin (F g)⟫ = _ + rw [hermitian_quadratic_coordinates] + simp only [F,b,LinearIsometryEquiv.apply_symm_apply] + rfl + calc + _ = variance (gaussianQuadraticForm A ∘ F) (Measure.pi (fun _ : Fin N => gaussianReal 0 1)) := by + rw [← hF.map_eq] + exact variance_map ((gaussianQuadraticForm_continuous A).measurable.aemeasurable) hF.aemeasurable + _ = _ := by rw [hdiag,gaussianDiagonalQuadratic_variance] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/HermitianQuadraticCoordinates.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/HermitianQuadraticCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..fbe57f239ea2addbd2f29a2a45abfe5de4766405 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/HermitianQuadraticCoordinates.lean @@ -0,0 +1,37 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternModel + +namespace OAI + +/-! The real quadratic form in its actual orthonormal eigenvector coordinates. -/ +noncomputable section +open Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +lemma hermitian_quadratic_coordinates {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.IsHermitian) (x : EuclideanSpace ℝ (Fin N)) : + ⟪x,A.toEuclideanLin x⟫ = + ∑ i, hA.eigenvalues i*(hA.eigenvectorBasis.repr x i)^2 := by + let b := hA.eigenvectorBasis + have he (i : Fin N) : A.toEuclideanLin (b i) = hA.eigenvalues i • b i := by + ext j + exact congrFun (hA.mulVec_eigenvectorBasis i) j + have hx : A.toEuclideanLin x = ∑ i, (b.repr x i*hA.eigenvalues i) • b i := by + nth_rw 1 [← b.sum_repr x] + rw [map_sum] + simp_rw [map_smul,he,smul_smul] + rw [hx,inner_sum] + apply Finset.sum_congr rfl + intro i _ + rw [real_inner_smul_right] + have hi : ⟪x,b i⟫ = b.repr x i := by + exact (real_inner_comm x (b i)).symm.trans (b.repr_apply_apply x i).symm + calc + _ = (b.repr x i*hA.eigenvalues i)*(b.repr x i) := congrArg _ hi + _ = _ := by dsimp only [b]; ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8970b69ae257de916562da23cedd24334b27f63 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianIntegrability.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Gaussian.IndexedGaussianMaximum +import OAI.Probability.InvariantIsing.Gaussian.GaussianCoordinateNorm + +namespace OAI + +/-! Integrability and restriction of finite Gaussian maxima. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing +variable {X ι κ : Type*} [Fintype X] [Nonempty X] [Fintype ι] [Fintype κ] + +lemma indexedGaussianMaximum_integrable (C : X → ι → ℝ) : + Integrable (indexedGaussianMaximum C) (Measure.pi (fun _ : ι => gaussianReal 0 1)) := by + have hi (x : X) : Integrable (fun g : ι → ℝ => ∑ i, C x i*g i) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) := + integrable_finsetSum Finset.univ (fun i _ => + ((gaussianCoordinate_memLp i).integrable (by norm_num)).const_mul _) + apply (integrable_finsetSum Finset.univ (fun x _ => (hi x).abs)).mono' + (measurable_indexedGaussianMaximum C).aestronglyMeasurable + apply ae_of_all + intro g + obtain ⟨x,hx,he⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty (fun x => ∑ i, C x i*g i) + change ‖Finset.univ.sup' Finset.univ_nonempty _‖ ≤ _ + rw [he,Real.norm_eq_abs] + exact Finset.single_le_sum (fun y _ => abs_nonneg (∑ i, C y i*g i)) hx + +lemma iidGaussian_restrict_hasLaw (e : κ → ι) (he : Function.Injective e) : + HasLaw (fun g : ι → ℝ => fun j => g (e j)) + (Measure.pi (fun _ : κ => gaussianReal 0 1)) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) := by + have hi : iIndepFun (fun i (g : ι → ℝ) => g i) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) := + iIndepFun_pi (fun _ => measurable_id.aemeasurable) + exact (hi.precomp he).hasLaw_pi (fun j => + (measurePreserving_eval (fun _ : ι => gaussianReal 0 1) (e j)).hasLaw) + +lemma indexedGaussianMaximum_add_constant (C : X → ι → ℝ) (g : ι → ℝ) (a : ℝ) : + Finset.univ.sup' Finset.univ_nonempty (fun x => (∑ i, C x i*g i)+a) = + indexedGaussianMaximum C g+a := by + apply le_antisymm + · apply Finset.sup'_le + intro x _ + exact add_le_add (Finset.le_sup' (fun x => ∑ i, C x i*g i) (Finset.mem_univ x)) (le_refl a) + · obtain ⟨x,hx,he⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty (fun x => ∑ i, C x i*g i) + unfold indexedGaussianMaximum + rw [he] + exact Finset.le_sup' (fun x => (∑ i, C x i*g i)+a) hx + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianMaximum.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianMaximum.lean new file mode 100644 index 0000000000000000000000000000000000000000..75204a2bbfecdbc5cc4eb499f55d47db215c4760 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianMaximum.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianMaximumComparison + +namespace OAI + +/-! The finite maximum comparison with an arbitrary nonempty Gaussian coordinate set. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {X ι : Type*} [Fintype X] [Nonempty X] [Fintype ι] + +def indexedGaussianMaximum (C : X → ι → ℝ) (g : ι → ℝ) : ℝ := + Finset.univ.sup' Finset.univ_nonempty (fun x => ∑ i, C x i*g i) + +lemma measurable_indexedGaussianMaximum (C : X → ι → ℝ) : Measurable (indexedGaussianMaximum C) := by + have hm := Finset.measurable_sup' (s := (Finset.univ : Finset X)) Finset.univ_nonempty + (fun x _ => show Measurable (fun g : ι → ℝ => ∑ i, C x i*g i) from by fun_prop) + convert hm using 1 + funext g + rw [Finset.sup'_apply] + rfl + +lemma indexedGaussianMaximum_reindex {n : ℕ} (e : Fin n ≃ ι) (C : X → ι → ℝ) : + (∫ g, indexedGaussianMaximum C g ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) = + ∫ g, finiteGaussianMaximum (fun x j => C x (e j)) g + ∂Measure.pi (fun _ : Fin n => gaussianReal 0 1) := by + let E := MeasurableEquiv.piCongrLeft (fun _ : ι => ℝ) e + have hp : MeasurePreserving E + (Measure.pi (fun _ : Fin n => gaussianReal 0 1)) (Measure.pi (fun _ : ι => gaussianReal 0 1)) := + measurePreserving_piCongrLeft (fun _ : ι => gaussianReal 0 1) e + rw [← hp.hasLaw.integral_comp (measurable_indexedGaussianMaximum C).aestronglyMeasurable] + apply integral_congr_ae + apply ae_of_all + intro g + unfold indexedGaussianMaximum finiteGaussianMaximum + dsimp only [Function.comp_def] + congr 1 + funext x + have heq (i : ι) : E g i = g (e.symm i) := by + simpa only [Equiv.apply_symm_apply] using + (MeasurableEquiv.piCongrLeft_apply_apply + (β := fun _ : ι => ℝ) e g (e.symm i)) + simp only [heq] + have hs := e.sum_comp (fun i => C x i*g (e.symm i)) + simpa only [linearGaussian,Equiv.symm_apply_apply] using hs.symm + +theorem indexed_gaussian_maximum_comparison [Nonempty ι] (C A : X → ι → ℝ) + (hCA : ∀ x y, (∑ i, C x i*A y i) = 0) + (hdiag : ∀ x, (∑ i, A x i*A x i) = ∑ i, C x i*C x i) + (hoff : ∀ x y, (∑ i, A x i*A y i) ≤ ∑ i, C x i*C y i) : + (∫ g, indexedGaussianMaximum C g ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) ≤ + ∫ g, indexedGaussianMaximum A g ∂Measure.pi (fun _ : ι => gaussianReal 0 1) := by + let d := Fintype.card ι-1 + have hc : Fintype.card ι = d+1 := by + have := Fintype.card_pos (α := ι) + dsimp [d] + omega + let e : Fin (d+1) ≃ ι := (finCongr hc.symm).trans (Fintype.equivFin ι).symm + rw [indexedGaussianMaximum_reindex e C,indexedGaussianMaximum_reindex e A] + apply finite_gaussian_maximum_comparison + · intro x y + change (∑ j, C x (e j)*A y (e j)) = 0 + rw [e.sum_comp (fun i => C x i*A y i)] + exact hCA x y + · intro x + change (∑ j, A x (e j)*A x (e j)) = ∑ j, C x (e j)*C x (e j) + rw [e.sum_comp (fun i => A x i*A x i),e.sum_comp (fun i => C x i*C x i)] + exact hdiag x + · intro x y + change (∑ j, A x (e j)*A y (e j)) ≤ ∑ j, C x (e j)*C y (e j) + rw [e.sum_comp (fun i => A x i*A y i),e.sum_comp (fun i => C x i*C y i)] + exact hoff x y + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianMinmax.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianMinmax.lean new file mode 100644 index 0000000000000000000000000000000000000000..327124edaf623ddd202b7bd2022a61dce9748dfe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/IndexedGaussianMinmax.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianMinmaxComparison +import OAI.Probability.InvariantIsing.Core.FiniteMinmaxBasic +import OAI.Probability.InvariantIsing.Gaussian.IndexedGaussianIntegrability + +namespace OAI + +/-! Gordon comparison with an arbitrary finite Gaussian coordinate set. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing +variable {U V ι : Type*} [Fintype U] [Nonempty U] [Fintype V] [Nonempty V] [Fintype ι] + +lemma indexedGaussianMinmax_integrable (C : U × V → ι → ℝ) : + Integrable (fun g => finiteMinmax (fun x => ∑ i, C x i*g i)) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) := by + have hi (x : U × V) : Integrable (fun g : ι → ℝ => ∑ i, C x i*g i) + (Measure.pi (fun _ : ι => gaussianReal 0 1)) := + integrable_finsetSum _ (fun i _ => + ((gaussianCoordinate_memLp i).integrable (by norm_num)).const_mul _) + apply (integrable_finsetSum Finset.univ (fun x _ => (hi x).abs)).mono' + (continuous_finiteMinmax _ (fun x => by fun_prop)).aestronglyMeasurable + apply ae_of_all + intro g + rw [Real.norm_eq_abs] + exact finiteMinmax_abs_le _ _ (fun x => + Finset.single_le_sum (fun y _ => abs_nonneg (∑ i, C y i*g i)) (Finset.mem_univ x)) + +lemma indexedGaussianMinmax_reindex {n : ℕ} (e : Fin n ≃ ι) (C : U × V → ι → ℝ) : + (∫ g, finiteMinmax (fun x => ∑ i, C x i*g i) + ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) = + ∫ g, finiteMinmax (fun x => linearGaussian (fun x j => C x (e j)) g x) + ∂Measure.pi (fun _ : Fin n => gaussianReal 0 1) := by + let E := MeasurableEquiv.piCongrLeft (fun _ : ι => ℝ) e + have hp : MeasurePreserving E + (Measure.pi (fun _ : Fin n => gaussianReal 0 1)) (Measure.pi (fun _ : ι => gaussianReal 0 1)) := + measurePreserving_piCongrLeft (fun _ : ι => gaussianReal 0 1) e + rw [← hp.hasLaw.integral_comp (continuous_finiteMinmax _ (fun x => by fun_prop)).aestronglyMeasurable] + apply integral_congr_ae + apply ae_of_all + intro g + dsimp only [Function.comp_def] + congr 1 + funext x + have heq (i : ι) : E g i = g (e.symm i) := by + simpa only [Equiv.apply_symm_apply] using + (MeasurableEquiv.piCongrLeft_apply_apply (β := fun _ : ι => ℝ) e g (e.symm i)) + simp only [heq] + have hs := e.sum_comp (fun i => C x i*g (e.symm i)) + simpa only [linearGaussian,Equiv.symm_apply_apply] using hs.symm + +theorem indexed_gaussian_minmax_comparison [Nonempty ι] (C A : U × V → ι → ℝ) + (hCA : ∀ x y, (∑ i, C x i*A y i) = 0) + (hrow : ∀ x u, (∑ i, A x i*A (u,x.2) i) = ∑ i, C x i*C (u,x.2) i) + (hoff : ∀ x y, (∑ i, A x i*A y i) ≤ ∑ i, C x i*C y i) : + (∫ g, finiteMinmax (fun x => ∑ i, A x i*g i) + ∂Measure.pi (fun _ : ι => gaussianReal 0 1)) ≤ + ∫ g, finiteMinmax (fun x => ∑ i, C x i*g i) + ∂Measure.pi (fun _ : ι => gaussianReal 0 1) := by + let d := Fintype.card ι-1 + have hc : Fintype.card ι = d+1 := by + have := Fintype.card_pos (α := ι) + dsimp [d] + omega + let e : Fin (d+1) ≃ ι := (finCongr hc.symm).trans (Fintype.equivFin ι).symm + rw [indexedGaussianMinmax_reindex e A,indexedGaussianMinmax_reindex e C] + apply finite_gaussian_minmax_comparison + · intro x y + change (∑ j, C x (e j)*A y (e j)) = 0 + rw [e.sum_comp (fun i => C x i*A y i)] + exact hCA x y + · intro x u + change (∑ j, A x (e j)*A (u,x.2) (e j)) = ∑ j, C x (e j)*C (u,x.2) (e j) + rw [e.sum_comp (fun i => A x i*A (u,x.2) i),e.sum_comp (fun i => C x i*C (u,x.2) i)] + exact hrow x u + · intro x y + change (∑ j, A x (e j)*A y (e j)) ≤ ∑ j, C x (e j)*C y (e j) + rw [e.sum_comp (fun i => A x i*A y i),e.sum_comp (fun i => C x i*C y i)] + exact hoff x y + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularCoordinates.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..214c4726fc06e1046e8498d6ac08991982597bec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularCoordinates.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPAngularTransform +import Mathlib.MeasureTheory.Function.JacobianOneDim + +namespace OAI + +/-! The exact change of variables for the displayed Marchenko--Pastur density. -/ +noncomputable section +open Real Set +namespace InvariantIsing + +def mpDensity (α x : ℝ) : ℝ := + sqrt ((marchenkoPasturB α-x)*(x-marchenkoPasturA α))/(2*Real.pi*x) + +def mpAngle (α x : ℝ) : ℝ := 1+α+2*sqrt α*cos x + +lemma mpAngle_endpoints {α : ℝ} (hα : 0 ≤ α) : + mpAngle α 0 = marchenkoPasturB α ∧ mpAngle α Real.pi = marchenkoPasturA α := by + obtain ⟨ha,hb⟩ := mp_edge_centre_radius hα + constructor + · simp only [mpAngle,cos_zero,mul_one,hb] + · simp only [mpAngle,cos_pi,mul_neg_one,ha,sub_eq_add_neg] + +lemma mpAngle_hasDerivAt (α x : ℝ) : + HasDerivAt (mpAngle α) (-(2*sqrt α)*sin x) x := by + unfold mpAngle + convert ((hasDerivAt_cos x).const_mul (2*sqrt α)).const_add (1+α) using 1 + simp only [mul_neg, neg_mul] + +lemma mpAngle_sqrt {α x : ℝ} (hα : 0 ≤ α) (hx : x ∈ Icc 0 Real.pi) : + sqrt ((marchenkoPasturB α-mpAngle α x)*(mpAngle α x-marchenkoPasturA α)) = + 2*sqrt α*sin x := by + obtain ⟨ha,hb⟩ := mp_edge_centre_radius hα + have he : (marchenkoPasturB α-mpAngle α x)*(mpAngle α x-marchenkoPasturA α) = + (2*sqrt α*sin x)^2 := by + rw [ha,hb] + unfold mpAngle + linear_combination -(2*sqrt α)^2*(sin_sq_add_cos_sq x) + rw [he,sqrt_sq] + exact mul_nonneg (by positivity) (sin_nonneg_of_nonneg_of_le_pi hx.1 hx.2) + +lemma mpAngle_density_jacobian {α x : ℝ} (hα : 0 ≤ α) (hx : x ∈ Icc 0 Real.pi) : + (2*sqrt α*sin x)*mpDensity α (mpAngle α x) = + (2*α/Real.pi)*((sin x)^2/mpAngle α x) := by + unfold mpDensity + rw [mpAngle_sqrt hα hx] + ring_nf + rw [sq_sqrt hα] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..ebb3396e10ad06aaf94584c56545c8816c6d9971 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularIntegrability.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPAngularMass + +namespace OAI + +/-! Integrability of the angular MP density, including the critical zero edge. -/ +noncomputable section +open Real MeasureTheory +namespace InvariantIsing + +lemma mp_critical_sine_integrable {b : ℝ} (hb : 0 < b) : + IntervalIntegrable (fun x => (sin x)^2/(b+b*cos x)) volume 0 Real.pi := by + apply (((continuous_const.sub continuous_cos).div_const b).intervalIntegrable 0 Real.pi).congr_uIoo + intro x hx + rw [Set.uIoo_of_le pi_pos.le] at hx + exact (mp_critical_sine_fraction hb hx).symm + +lemma mp_angular_sine_integrable {α : ℝ} (hα : 0 < α) : + IntervalIntegrable (fun x => (sin x)^2/(1+α+2*sqrt α*cos x)) volume 0 Real.pi := by + by_cases he : α = 1 + · subst α + simpa only [sqrt_one,mul_one,show (1 : ℝ)+1=2 by norm_num] using + mp_critical_sine_integrable (b := 2) (by norm_num) + · exact ((continuous_sin.pow 2).div + (continuous_const.add (continuous_const.mul continuous_cos)) + (fun x => (mp_cos_denominator_pos (mp_centre_exceeds_radius hα.le he) x).ne')).intervalIntegrable 0 Real.pi + +lemma mp_angular_denominator_nonneg {α : ℝ} (hα : 0 ≤ α) (x : ℝ) : + 0 ≤ 1+α+2*sqrt α*cos x := by + have hs := sq_sqrt hα + have hc := neg_one_le_cos x + have h := mul_le_mul_of_nonneg_left hc (show 0 ≤ 2*sqrt α by positivity) + nlinarith [sq_nonneg (sqrt α-1)] + +lemma mp_angular_denominator_pos {α : ℝ} (hα : 0 < α) {x : ℝ} + (hx : x ∈ Set.Ioo 0 Real.pi) : 0 < 1+α+2*sqrt α*cos x := by + have hs := sq_sqrt hα.le + have hc : -1 < cos x := by + simpa only [cos_pi] using cos_lt_cos_of_nonneg_of_le_pi hx.1.le (le_refl Real.pi) hx.2 + have h := mul_lt_mul_of_pos_left hc (mp_radius_positive hα) + nlinarith [sq_nonneg (sqrt α-1)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularMass.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..5033926647b261b2f2c9c051e53fe52c517fbfb9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularMass.lean @@ -0,0 +1,39 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPTrigonometricCritical +import OAI.Probability.InvariantIsing.Gaussian.MPEdgeArithmetic + +namespace OAI + +/-! Normalization of the continuous part of the MP law in angular coordinates. -/ +noncomputable section +open Real +namespace InvariantIsing + +theorem mp_angular_continuous_mass {α : ℝ} (hα : 0 < α) : + (2*α/Real.pi)*(∫ x in (0 : ℝ)..Real.pi, + (sin x)^2/(1+α+2*sqrt α*cos x)) = min 1 α := by + by_cases he : α = 1 + · subst α + have h := mp_integral_sine_fraction_critical (b := 2) (by norm_num) + norm_num at h ⊢ + rw [h] + field_simp + · have hab := mp_centre_exceeds_radius hα.le he + have hb := (mp_radius_positive hα).ne' + rw [mp_integral_sine_fraction hab hb,mp_centre_radius_sqrt hα.le] + have hs : (2*sqrt α)^2 = 4*α := by nlinarith [sq_sqrt hα.le] + rw [hs] + calc + _ = (1+α-|α-1|)/2 := by field_simp; ring + _ = _ := mp_continuous_mass α + +theorem mp_angular_total_mass {α : ℝ} (hα : 0 < α) : + max (1-α) 0+(2*α/Real.pi)*(∫ x in (0 : ℝ)..Real.pi, + (sin x)^2/(1+α+2*sqrt α*cos x)) = 1 := by + rw [mp_angular_continuous_mass hα] + exact mp_total_mass α + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularShift.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..d58116709ebee001fe4058472e79400e176f769e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularShift.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPAngularIntegrability + +namespace OAI + +/-! The elementary shifted angular integral for the MP Stieltjes transform. -/ +noncomputable section +open Real MeasureTheory +namespace InvariantIsing + +lemma mp_shifted_centre_exceeds_radius {α t : ℝ} (hα : 0 ≤ α) (ht : 0 < t) : + |2*sqrt α| < 1+α+t := by + have hs := sq_sqrt hα + rw [abs_of_nonneg (by positivity)] + nlinarith [sq_nonneg (sqrt α-1)] + +lemma mp_shifted_sine_integrable {α t : ℝ} (hα : 0 ≤ α) (ht : 0 < t) : + IntervalIntegrable (fun x => (sin x)^2/(1+α+t+2*sqrt α*cos x)) volume 0 Real.pi := + ((continuous_sin.pow 2).div (continuous_const.add (continuous_const.mul continuous_cos)) + (fun x => (mp_cos_denominator_pos (mp_shifted_centre_exceeds_radius hα ht) x).ne')).intervalIntegrable _ _ + +lemma mp_shifted_angular_integral {α t : ℝ} (hα : 0 < α) (ht : 0 < t) : + (2*α/Real.pi)*(∫ x in (0 : ℝ)..Real.pi, + (sin x)^2/(1+α+t+2*sqrt α*cos x)) = + (1+α+t-sqrt ((1+α+t)^2-4*α))/2 := by + have hab := mp_shifted_centre_exceeds_radius hα.le ht + rw [mp_integral_sine_fraction hab (mp_radius_positive hα).ne'] + have hs : (2*sqrt α)^2 = 4*α := by nlinarith [sq_sqrt hα.le] + rw [hs] + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularTransform.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..0191388a6af6dab650f74093d48ccda317fc639e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPAngularTransform.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPAngularShift +import OAI.Probability.InvariantIsing.Gaussian.MarchenkoPasturTransform + +namespace OAI + +/-! Exact angular Stieltjes transform, with the MP zero atom retained. -/ +noncomputable section +open Real MeasureTheory +namespace InvariantIsing + +lemma mp_angular_partial_fraction {α t : ℝ} (hα : 0 < α) (ht : 0 < t) {x : ℝ} + (hx : x ∈ Set.Ioo 0 Real.pi) : + (sin x)^2/((1+α+2*sqrt α*cos x)*(t+(1+α+2*sqrt α*cos x))) = + ((sin x)^2/(1+α+2*sqrt α*cos x)-(sin x)^2/(1+α+t+2*sqrt α*cos x))/t := by + have hd := (mp_angular_denominator_pos hα hx).ne' + have he := (mp_cos_denominator_pos (mp_shifted_centre_exceeds_radius hα.le ht) x).ne' + have hs : t+(1+α+2*sqrt α*cos x) = 1+α+t+2*sqrt α*cos x := by ring + rw [hs] + field_simp [ht.ne',hd,he] + ring + +theorem mp_angular_transform {α t : ℝ} (hα : 0 < α) (ht : 0 < t) : + max (1-α) 0/t+(2*α/Real.pi)*(∫ x in (0 : ℝ)..Real.pi, + (sin x)^2/((1+α+2*sqrt α*cos x)*(t+(1+α+2*sqrt α*cos x)))) = + marchenkoPasturTransform t α := by + have he : (∫ x in (0 : ℝ)..Real.pi, + (sin x)^2/((1+α+2*sqrt α*cos x)*(t+(1+α+2*sqrt α*cos x)))) = + ((∫ x in (0 : ℝ)..Real.pi, (sin x)^2/(1+α+2*sqrt α*cos x))- + ∫ x in (0 : ℝ)..Real.pi, (sin x)^2/(1+α+t+2*sqrt α*cos x))/t := by + rw [← intervalIntegral.integral_sub (mp_angular_sine_integrable hα) (mp_shifted_sine_integrable hα.le ht), + ← intervalIntegral.integral_div] + exact intervalIntegral.integral_congr_Ioo_of_le pi_pos.le (fun x hx => mp_angular_partial_fraction hα ht hx) + rw [he,← mul_div_assoc,mul_sub,mp_angular_continuous_mass hα,mp_shifted_angular_integral hα ht] + have hs : (1+α+t)^2-4*α = (t+α-1)^2+4*t := by ring + rw [hs] + have hm := mp_total_mass α + unfold marchenkoPasturTransform + field_simp + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPClippedTransform.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPClippedTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a8e668cf5d415dc7341fb2b35eea1d599a518d7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPClippedTransform.lean @@ -0,0 +1,31 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianClippedStieltjes + +namespace OAI + +/-! The literal MP law is fixed by clipping to its nonnegative support interval. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +lemma marchenkoPastur_mem_nonnegative_interval {α : ℝ} (hα : 0 < α) : + ∀ᵐ x ∂marchenkoPasturMeasure α, x ∈ Icc (0 : ℝ) (marchenkoPasturB α) := by + have := marchenkoPastur_probability hα + filter_upwards [(marchenkoPasturMeasure α).support_mem_ae] with x hx + have hb := marchenkoPastur_support_bound hα hx + exact ⟨(mp_lower_nonneg hα.le).trans hb.1,hb.2⟩ + +lemma marchenkoPastur_clipped_transform {α t : ℝ} (hα : 0 < α) (ht : 0 < t) : + (∫ x, positiveResolventTest t (spectralClip 0 (marchenkoPasturB α) x) + ∂marchenkoPasturMeasure α) = marchenkoPasturTransform t α := by + calc + _ = ∫ x, positiveResolventTest t x ∂marchenkoPasturMeasure α := by + apply integral_congr_ae + filter_upwards [marchenkoPastur_mem_nonnegative_interval hα] with x hx + rw [spectralClip_eq hx] + _ = _ := marchenkoPastur_transform hα ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5aeb96e35b7148751b651f0af276a744b1bb059 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityIntegrability.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPDensitySubstitution + +namespace OAI + +/-! Integrability and exact mass of the literal MP density, including the critical aspect ratio. -/ +noncomputable section +open Real Set MeasureTheory +namespace InvariantIsing + +lemma mpDensity_nonneg {α x : ℝ} (hx : x ∈ Icc (marchenkoPasturA α) (marchenkoPasturB α)) : + 0 ≤ mpDensity α x := by + have hA : 0 ≤ marchenkoPasturA α := sq_nonneg _ + have hx0 := hA.trans hx.1 + exact div_nonneg (sqrt_nonneg _) (by positivity) + +lemma mpDensity_integrable {α : ℝ} (hα : 0 < α) : + IntegrableOn (mpDensity α) (Icc (marchenkoPasturA α) (marchenkoPasturB α)) := by + have hi : IntegrableOn (fun x => (2*α/Real.pi)*((sin x)^2/mpAngle α x)) (Icc 0 Real.pi) := by + exact ((intervalIntegrable_iff_integrableOn_Icc_of_le pi_pos.le).mp + (mp_angular_sine_integrable hα)).const_mul (2*α/Real.pi) + have hc : IntegrableOn (fun x => (-(2*sqrt α)*sin x) • mpDensity α (mpAngle α x)) (Icc 0 Real.pi) := by + apply hi.neg.congr + filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx + simp only [Pi.neg_apply,smul_eq_mul] + calc + _ = -((2*sqrt α*sin x)*mpDensity α (mpAngle α x)) := by rw [mpAngle_density_jacobian hα.le hx] + _ = _ := by ring + have he := (integrableOn_Icc_deriv_smul_iff_of_deriv_nonpos + (f := mpAngle α) (f' := fun x => -(2*sqrt α)*sin x) (g := mpDensity α) + (continuous_mpAngle α).continuousOn (fun x _ => mpAngle_hasDerivAt α x) + (fun _ hx => mpAngle_deriv_nonpos hx) pi_pos.le).mp hc + simpa only [(mpAngle_endpoints hα.le).1,(mpAngle_endpoints hα.le).2] using he + +theorem mpDensity_integral {α : ℝ} (hα : 0 < α) : + (∫ x in Icc (marchenkoPasturA α) (marchenkoPasturB α), mpDensity α x) = min 1 α := by + have h := mpDensity_substitution hα (fun _ => 1) + simp only [mul_one] at h + rw [h,integral_Icc_eq_integral_Ioc,← intervalIntegral.integral_of_le pi_pos.le, + intervalIntegral.integral_const_mul] + exact mp_angular_continuous_mass hα + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityProbability.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityProbability.lean new file mode 100644 index 0000000000000000000000000000000000000000..1690893319209876fc5c7cb8a4da858de44f5cf1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityProbability.lean @@ -0,0 +1,35 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPDensityIntegrability + +namespace OAI + +/-! Normalization of the literal density and atom appearing in the MP application input. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +lemma marchenkoPasturMeasure_eq_density (α : ℝ) : + marchenkoPasturMeasure α = ENNReal.ofReal (max (1-α) 0) • Measure.dirac 0+ + (volume.restrict (Icc (marchenkoPasturA α) (marchenkoPasturB α))).withDensity + (fun x => ENNReal.ofReal (mpDensity α x)) := by + unfold marchenkoPasturMeasure + rw [withDensity_indicator measurableSet_Icc] + rfl + +theorem marchenkoPastur_probability {α : ℝ} (hα : 0 < α) : + IsProbabilityMeasure (marchenkoPasturMeasure α) := by + constructor + rw [marchenkoPasturMeasure_eq_density,Measure.add_apply,Measure.smul_apply, + measure_univ,smul_eq_mul,mul_one,withDensity_apply _ MeasurableSet.univ] + simp only [setLIntegral_univ] + have hn : 0 ≤ᵐ[volume.restrict (Icc (marchenkoPasturA α) (marchenkoPasturB α))] mpDensity α := + (ae_restrict_mem measurableSet_Icc).mono (fun _ hx => mpDensity_nonneg hx) + rw [← ofReal_integral_eq_lintegral_ofReal (mpDensity_integrable hα) hn, + mpDensity_integral hα, + ← ENNReal.ofReal_add (le_max_right (1-α) 0) (le_min (by norm_num) hα.le), + mp_total_mass,ENNReal.ofReal_one] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensitySubstitution.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensitySubstitution.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0246182ebf2a6156a45ba0f8278eeabe5ba4c1c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensitySubstitution.lean @@ -0,0 +1,47 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPAngularCoordinates + +namespace OAI + +/-! Exact real change of variables for the literal MP density on its support interval. -/ +noncomputable section +open Real Set MeasureTheory +namespace InvariantIsing + +lemma continuous_mpAngle (α : ℝ) : Continuous (mpAngle α) := + continuous_const.add (continuous_const.mul continuous_cos) + +lemma measurable_mpDensity (α : ℝ) : Measurable (mpDensity α) := by + unfold mpDensity + fun_prop + +lemma mpAngle_deriv_nonpos {α x : ℝ} (hx : x ∈ Ioo 0 Real.pi) : + -(2*sqrt α)*sin x ≤ 0 := + mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (mul_nonneg (by norm_num) (sqrt_nonneg _))) + (sin_pos_of_pos_of_lt_pi hx.1 hx.2).le + +theorem mpDensity_substitution {α : ℝ} (hα : 0 < α) (g : ℝ → ℝ) : + (∫ y in Icc (marchenkoPasturA α) (marchenkoPasturB α), mpDensity α y*g y) = + ∫ x in Icc 0 Real.pi, (2*α/Real.pi)*((sin x)^2/mpAngle α x)*g (mpAngle α x) := by + have h := integral_Icc_deriv_smul_of_deriv_nonpos + (f := mpAngle α) (f' := fun x => -(2*sqrt α)*sin x) + (g := fun y => mpDensity α y*g y) + (continuous_mpAngle α).continuousOn (fun x _ => mpAngle_hasDerivAt α x) + (fun _ hx => mpAngle_deriv_nonpos hx) pi_pos.le + have he : (∫ x in Icc 0 Real.pi, (-(2*sqrt α)*sin x) • + (mpDensity α (mpAngle α x)*g (mpAngle α x))) = + -(∫ x in Icc 0 Real.pi, (2*α/Real.pi)*((sin x)^2/mpAngle α x)*g (mpAngle α x)) := by + rw [← integral_neg] + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx + simp only [smul_eq_mul] + calc + _ = -((2*sqrt α*sin x)*mpDensity α (mpAngle α x)*g (mpAngle α x)) := by ring + _ = _ := by rw [mpAngle_density_jacobian hα.le hx] + rw [he,(mpAngle_endpoints hα.le).1,(mpAngle_endpoints hα.le).2] at h + exact (neg_injective h).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensitySupport.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensitySupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..14d773f83d53cc957f202d7f042594ecd26a9f11 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensitySupport.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPDensityProbability + +namespace OAI + +/-! Support of the literal MP density, with its zero atom distinguished. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set Real +open scoped ENNReal Topology +namespace InvariantIsing + +lemma mp_edges_strict {α : ℝ} (hα : 0 < α) : marchenkoPasturA α < marchenkoPasturB α := by + obtain ⟨ha,hb⟩ := mp_edge_centre_radius hα.le + rw [ha,hb] + linarith [sqrt_pos.mpr hα] + +lemma mpDensity_pos {α x : ℝ} (hx : x ∈ Ioo (marchenkoPasturA α) (marchenkoPasturB α)) : + 0 < mpDensity α x := by + have hx0 : 0 < x := (sq_nonneg (1-sqrt α)).trans_lt hx.1 + exact div_pos (sqrt_pos.mpr (mul_pos (sub_pos.mpr hx.2) (sub_pos.mpr hx.1))) (by positivity) + +lemma mp_interior_absolutelyContinuous {α : ℝ} : + volume.restrict (Ioo (marchenkoPasturA α) (marchenkoPasturB α)) ≪ marchenkoPasturMeasure α := by + let s := Ioo (marchenkoPasturA α) (marchenkoPasturB α) + let f := fun x => ENNReal.ofReal (mpDensity α x) + have hp : ∀ᵐ x ∂volume.restrict s, f x ≠ 0 := by + filter_upwards [ae_restrict_mem measurableSet_Ioo] with x hx + exact (ENNReal.ofReal_pos.mpr (mpDensity_pos hx)).ne' + have ha := withDensity_absolutelyContinuous' (μ := volume.restrict s) + (measurable_mpDensity α).ennreal_ofReal.aemeasurable hp + apply ha.trans + apply Measure.absolutelyContinuous_of_le + rw [marchenkoPasturMeasure_eq_density,← withDensity_indicator measurableSet_Ioo, + ← withDensity_indicator measurableSet_Icc] + apply le_trans (withDensity_mono (ae_of_all _ fun x => ?_)) (Measure.le_add_left le_rfl) + exact indicator_le_indicator_of_subset Ioo_subset_Icc_self (fun _ => bot_le) x + +theorem mp_interval_subset_support {α : ℝ} (hα : 0 < α) : + Icc (marchenkoPasturA α) (marchenkoPasturB α) ⊆ (marchenkoPasturMeasure α).support := by + have hi : Ioo (marchenkoPasturA α) (marchenkoPasturB α) ⊆ + (marchenkoPasturMeasure α).support := by + intro x hx + apply mp_interior_absolutelyContinuous.support_mono + apply Measure.interior_inter_support + exact ⟨by simpa only [isOpen_Ioo.interior_eq] using hx,by rw [Measure.support_eq_univ]; trivial⟩ + rw [← closure_Ioo (mp_edges_strict hα).ne] + exact closure_minimal hi Measure.isClosed_support + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityTransform.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..8eba1b15982584928c4dc0d47ca2ea15902c4672 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPDensityTransform.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPDensityProbability +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramEmpiricalTransform + +namespace OAI + +/-! The positive resolvent transform of the literal Marchenko--Pastur measure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set Real +namespace InvariantIsing + +lemma mpDensity_measure_integral (α : ℝ) (g : ℝ → ℝ) : + (∫ x, g x ∂(volume.restrict (Icc (marchenkoPasturA α) (marchenkoPasturB α))).withDensity + (fun x => ENNReal.ofReal (mpDensity α x))) = + ∫ x in Icc (marchenkoPasturA α) (marchenkoPasturB α), mpDensity α x*g x := by + rw [integral_withDensity_eq_integral_toReal_smul + (measurable_mpDensity α).ennreal_ofReal (ae_of_all _ fun _ => ENNReal.ofReal_lt_top)] + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx + rw [ENNReal.toReal_ofReal (mpDensity_nonneg hx),smul_eq_mul] + +theorem marchenkoPastur_transform {α t : ℝ} (hα : 0 < α) (ht : 0 < t) : + (∫ x, positiveResolventTest t x ∂marchenkoPasturMeasure α) = + marchenkoPasturTransform t α := by + have := marchenkoPastur_probability hα + let ν := (volume.restrict (Icc (marchenkoPasturA α) (marchenkoPasturB α))).withDensity + (fun x => ENNReal.ofReal (mpDensity α x)) + have hν : ν ≤ marchenkoPasturMeasure α := by + rw [marchenkoPasturMeasure_eq_density] + exact Measure.le_add_left le_rfl + have : IsFiniteMeasure ν := isFiniteMeasure_of_le _ hν + have : IsFiniteMeasure (ENNReal.ofReal (max (1-α) 0) • Measure.dirac (0 : ℝ)) := + (Measure.dirac (0 : ℝ)).smul_finite ENNReal.ofReal_ne_top + have hi (μ : Measure ℝ) [IsFiniteMeasure μ] : Integrable (positiveResolventTest t) μ := by + apply (integrable_const (1/t)).mono' (continuous_positiveResolventTest ht).aestronglyMeasurable + exact ae_of_all _ fun x => by + rw [Real.norm_eq_abs,abs_of_nonneg (positiveResolventTest_bound ht x).1] + exact (positiveResolventTest_bound ht x).2 + have hv : (∫ x, positiveResolventTest t x ∂ν) = + (2*α/Real.pi)*(∫ x in (0 : ℝ)..Real.pi, + (sin x)^2/((1+α+2*sqrt α*cos x)*(t+(1+α+2*sqrt α*cos x)))) := by + rw [mpDensity_measure_integral,mpDensity_substitution hα] + have he : (∫ x in Icc 0 Real.pi, + (2*α/Real.pi)*((sin x)^2/mpAngle α x)*positiveResolventTest t (mpAngle α x)) = + ∫ x in Icc 0 Real.pi, (2*α/Real.pi)* + ((sin x)^2/(mpAngle α x*(t+mpAngle α x))) := by + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx + unfold positiveResolventTest + rw [max_eq_left (show 0 ≤ mpAngle α x from mp_angular_denominator_nonneg hα.le x)] + simp only [div_eq_mul_inv,mul_inv_rev] + ring + rw [he,integral_Icc_eq_integral_Ioc,← intervalIntegral.integral_of_le pi_pos.le, + intervalIntegral.integral_const_mul] + rfl + rw [marchenkoPasturMeasure_eq_density,integral_add_measure (hi _) (hi ν), + integral_smul_measure,integral_dirac] + change (ENNReal.ofReal (max (1-α) 0)).toReal*positiveResolventTest t 0+ + (∫ x, positiveResolventTest t x ∂ν) = _ + rw [ENNReal.toReal_ofReal (le_max_right _ _),hv] + simpa only [positiveResolventTest,max_self,add_zero,mul_one_div] using mp_angular_transform hα ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPEdgeArithmetic.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPEdgeArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccfc04ad8c370a326d9a12ca7eac5166c9869350 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPEdgeArithmetic.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternPublishedInputs + +namespace OAI + +/-! Exact centre, radius, and critical-edge arithmetic for the displayed MP density. -/ +noncomputable section +namespace InvariantIsing + +lemma mp_edge_centre_radius {α : ℝ} (hα : 0 ≤ α) : + marchenkoPasturA α = 1+α-2*Real.sqrt α ∧ + marchenkoPasturB α = 1+α+2*Real.sqrt α := by + have hs := Real.sq_sqrt hα + constructor + · unfold marchenkoPasturA + nlinarith + · unfold marchenkoPasturB + nlinarith + +lemma mp_radius_positive {α : ℝ} (hα : 0 < α) : 0 < 2*Real.sqrt α := by positivity + +lemma mp_centre_exceeds_radius {α : ℝ} (hα : 0 ≤ α) (hne : α ≠ 1) : + |2*Real.sqrt α| < 1+α := by + have hs := Real.sq_sqrt hα + have hne' : Real.sqrt α ≠ 1 := by intro h; rw [h] at hs; norm_num at hs; exact hne hs.symm + have hp := sq_pos_of_ne_zero (sub_ne_zero.mpr hne') + rw [abs_of_nonneg (by positivity)] + nlinarith + +lemma mp_centre_radius_discriminant {α : ℝ} (hα : 0 ≤ α) : + (1+α)^2-(2*Real.sqrt α)^2 = (α-1)^2 := by + have hs := Real.sq_sqrt hα + nlinarith + +lemma mp_centre_radius_sqrt {α : ℝ} (hα : 0 ≤ α) : + Real.sqrt ((1+α)^2-(2*Real.sqrt α)^2) = |α-1| := by + rw [mp_centre_radius_discriminant hα,Real.sqrt_sq_eq_abs] + +lemma mp_continuous_mass (α : ℝ) : (1+α-|α-1|)/2 = min 1 α := by + rcases le_total α 1 with h | h + · rw [abs_of_nonpos (sub_nonpos.mpr h),min_eq_right h] + ring + · rw [abs_of_nonneg (sub_nonneg.mpr h),min_eq_left h] + ring + +lemma mp_total_mass (α : ℝ) : max (1-α) 0+min 1 α = 1 := by + rcases le_total α 1 with h | h + · rw [max_eq_left (sub_nonneg.mpr h),min_eq_right h] + ring + · rw [max_eq_right (sub_nonpos.mpr h),min_eq_left h] + simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPMeasureSupport.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPMeasureSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a76b24efc420cb860e51db3d7933130f0fc8a69 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPMeasureSupport.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPDensitySupport + +namespace OAI + +/-! The precise support and both endpoint clauses of the Gaussian MP input. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set Real +open scoped ENNReal Topology +namespace InvariantIsing + +lemma mp_continuous_support_bound (α : ℝ) : + ((volume.restrict (Icc (marchenkoPasturA α) (marchenkoPasturB α))).withDensity + (fun x => ENNReal.ofReal (mpDensity α x))).support ⊆ + Icc (marchenkoPasturA α) (marchenkoPasturB α) := by + apply (withDensity_absolutelyContinuous _ _).support_mono.trans + exact (Measure.support_restrict_subset).trans fun _ hx => by + simpa only [isClosed_Icc.closure_eq] using hx.1 + +theorem marchenkoPastur_support_bound {α : ℝ} (_hα : 0 < α) : + (marchenkoPasturMeasure α).support ⊆ Icc (marchenkoPasturLower α) (marchenkoPasturB α) := by + rw [marchenkoPasturMeasure_eq_density,Measure.support_add] + by_cases ha : α ≤ 1 + · rw [marchenkoPasturLower,ite_eq_left ha] + rintro x (hx|hx) + · have hs : (ENNReal.ofReal (max (1-α) 0) • Measure.dirac (0 : ℝ)).support ⊆ {0} := by + apply Measure.smul_absolutelyContinuous.support_mono.trans + apply Measure.support_subset_of_isClosed isClosed_singleton + rw [mem_ae_iff] + simp + have he : x = 0 := hs hx + subst x + exact ⟨le_rfl,sq_nonneg _⟩ + · exact ⟨(sq_nonneg (1-sqrt α)).trans (mp_continuous_support_bound α hx).1, + (mp_continuous_support_bound α hx).2⟩ + · rw [marchenkoPasturLower,ite_eq_right ha] + have hz : max (1-α) 0 = 0 := max_eq_right (by linarith) + simpa only [hz,ENNReal.ofReal_zero,zero_smul,Measure.support_zero,empty_union] using + mp_continuous_support_bound α + +theorem marchenkoPastur_right_mem {α : ℝ} (hα : 0 < α) : + marchenkoPasturB α ∈ (marchenkoPasturMeasure α).support := + mp_interval_subset_support hα ⟨(mp_edges_strict hα).le,le_rfl⟩ + +theorem marchenkoPastur_left_mem {α : ℝ} (hα : 0 < α) : + marchenkoPasturLower α ∈ (marchenkoPasturMeasure α).support := by + by_cases ha : α < 1 + · rw [marchenkoPasturLower,ite_eq_left ha.le] + have hp : ENNReal.ofReal (max (1-α) 0) ≠ 0 := + (ENNReal.ofReal_pos.mpr (lt_max_of_lt_left (by linarith))).ne' + have hac : Measure.dirac (0 : ℝ) ≪ marchenkoPasturMeasure α := by + apply (Measure.absolutelyContinuous_smul hp).trans + apply Measure.absolutelyContinuous_of_le + rw [marchenkoPasturMeasure_eq_density] + exact Measure.le_add_right le_rfl + apply hac.support_mono + rw [Measure.mem_support_iff_forall] + intro U hU + have hu : (0 : ℝ) ∈ U := mem_of_mem_nhds hU + simp only [Measure.dirac_apply_of_mem hu,zero_lt_one] + · have he : marchenkoPasturLower α = marchenkoPasturA α := by + by_cases hle : α ≤ 1 + · have h : α = 1 := le_antisymm hle (not_lt.mp ha) + subst α + simp [marchenkoPasturLower,marchenkoPasturA] + · simp only [marchenkoPasturLower,ite_eq_right hle] + rw [he] + exact mp_interval_subset_support hα ⟨le_rfl,(mp_edges_strict hα).le⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricCritical.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricCritical.lean new file mode 100644 index 0000000000000000000000000000000000000000..5585e3230b6fbfcadb2263929a3c387e7384d619 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricCritical.lean @@ -0,0 +1,37 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPTrigonometricIntegral + +namespace OAI + +/-! The zero-edge endpoint of the MP angular integral. -/ +noncomputable section +open Real MeasureTheory +namespace InvariantIsing + +lemma mp_critical_sine_fraction {b : ℝ} (hb : 0 < b) {x : ℝ} + (hx : x ∈ Set.Ioo 0 Real.pi) : + (sin x)^2/(b+b*cos x) = (1-cos x)/b := by + have hc : -1 < cos x := by + simpa only [cos_pi] using cos_lt_cos_of_nonneg_of_le_pi hx.1.le (le_refl Real.pi) hx.2 + have hd : b+b*cos x ≠ 0 := ne_of_gt (by nlinarith) + apply (div_eq_div_iff hd hb.ne').mpr + linear_combination b*(sin_sq_add_cos_sq x) + +theorem mp_integral_sine_fraction_critical {b : ℝ} (hb : 0 < b) : + (∫ x in (0 : ℝ)..Real.pi, (sin x)^2/(b+b*cos x)) = Real.pi/b := by + have he : (∫ x in (0 : ℝ)..Real.pi, (sin x)^2/(b+b*cos x)) = + ∫ x in (0 : ℝ)..Real.pi, (1-cos x)/b := by + apply intervalIntegral.integral_congr_ae + filter_upwards [volume.ae_ne Real.pi] with x hx + intro hmem + rw [Set.uIoc_of_le pi_pos.le] at hmem + exact mp_critical_sine_fraction hb ⟨hmem.1,lt_of_le_of_ne hmem.2 hx⟩ + rw [he,intervalIntegral.integral_div, + intervalIntegral.integral_sub intervalIntegrable_const (continuous_cos.intervalIntegrable 0 Real.pi), + intervalIntegral.integral_const,integral_cos] + simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricDenominator.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricDenominator.lean new file mode 100644 index 0000000000000000000000000000000000000000..562039981a18d19748ccd730611aedf7e2fe107c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricDenominator.lean @@ -0,0 +1,53 @@ +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv +import Mathlib.Analysis.SpecialFunctions.Trigonometric.InverseDeriv + +namespace OAI + +/-! Elementary positive-denominator identities for the MP density integral. -/ +noncomputable section +open Real Set +namespace InvariantIsing + +lemma mp_cos_denominator_pos {a b : ℝ} (hab : |b| < a) (x : ℝ) : 0 < a+b*cos x := by + have hbc : |b*cos x| ≤ |b| := by + rw [abs_mul] + exact mul_le_of_le_one_right (abs_nonneg b) (abs_cos_le_one x) + have h := neg_abs_le (b*cos x) + linarith + +lemma mp_discriminant_pos {a b : ℝ} (hab : |b| < a) : 0 < a^2-b^2 := by + have ha : 0 < a := lt_of_le_of_lt (abs_nonneg b) hab + have hs := (sq_lt_sq₀ (abs_nonneg b) ha.le).mpr hab + rw [sq_abs] at hs + linarith + +lemma mp_cos_fraction_identity {a b : ℝ} (hab : |b| < a) (x : ℝ) : + 1-((a*cos x+b)/(a+b*cos x))^2 = + (a^2-b^2)*(sin x)^2/(a+b*cos x)^2 := by + have hd := (mp_cos_denominator_pos hab x).ne' + apply (eq_div_iff (pow_ne_zero 2 hd)).mpr + rw [div_pow,sub_mul,one_mul,div_mul_cancel₀ _ (pow_ne_zero 2 hd)] + linear_combination -(a^2-b^2)*(sin_sq_add_cos_sq x) + +lemma mp_cos_fraction_mem_Ioo {a b : ℝ} (hab : |b| < a) {x : ℝ} (hx : x ∈ Ioo 0 Real.pi) : + (a*cos x+b)/(a+b*cos x) ∈ Ioo (-1) 1 := by + have hi := mp_cos_fraction_identity hab x + have hs := sin_pos_of_pos_of_lt_pi hx.1 hx.2 + have hp : 0 < (a^2-b^2)*(sin x)^2/(a+b*cos x)^2 := by + exact div_pos (mul_pos (mp_discriminant_pos hab) (sq_pos_of_pos hs)) + (sq_pos_of_pos (mp_cos_denominator_pos hab x)) + constructor <;> nlinarith + +lemma mp_cos_fraction_hasDerivAt {a b : ℝ} (hab : |b| < a) (x : ℝ) : + HasDerivAt (fun y => (a*cos y+b)/(a+b*cos y)) + (-(a^2-b^2)*sin x/(a+b*cos x)^2) x := by + have h := (((hasDerivAt_cos x).const_mul a).add_const b).div + ((hasDerivAt_cos x).const_mul b |>.const_add a) (mp_cos_denominator_pos hab x).ne' + convert h using 1 + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricIntegral.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..2645c099fdefae48058e6cdd77e871c487fe42f4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricIntegral.lean @@ -0,0 +1,47 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPTrigonometricPrimitive +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic + +namespace OAI + +/-! The elementary semicircle-over-resolvent integral needed by the MP density. -/ +noncomputable section +open Real +namespace InvariantIsing + +lemma mp_sine_fraction_identity {a b : ℝ} (hab : |b| < a) (hb : b ≠ 0) (x : ℝ) : + (sin x)^2/(a+b*cos x) = a/b^2-cos x/b- + ((a^2-b^2)/b^2)*(1/(a+b*cos x)) := by + have hd := (mp_cos_denominator_pos hab x).ne' + field_simp [hb,hd] + linear_combination b^2*(sin_sq_add_cos_sq x) + +theorem mp_integral_sine_fraction {a b : ℝ} (hab : |b| < a) (hb : b ≠ 0) : + (∫ x in (0 : ℝ)..Real.pi, (sin x)^2/(a+b*cos x)) = + Real.pi*(a-sqrt (a^2-b^2))/b^2 := by + have hc : IntervalIntegrable (fun x : ℝ => cos x/b) MeasureTheory.volume 0 Real.pi := + (continuous_cos.div_const b).intervalIntegrable _ _ + have hi : IntervalIntegrable (fun x : ℝ => 1/(a+b*cos x)) MeasureTheory.volume 0 Real.pi := + (continuous_const.div (continuous_const.add (continuous_const.mul continuous_cos)) + (fun x => (mp_cos_denominator_pos hab x).ne')).intervalIntegrable _ _ + calc + _ = ∫ x in (0 : ℝ)..Real.pi, a/b^2-cos x/b-((a^2-b^2)/b^2)*(1/(a+b*cos x)) := by + apply intervalIntegral.integral_congr + intro x _ + exact mp_sine_fraction_identity hab hb x + _ = Real.pi*(a/b^2)-((a^2-b^2)/b^2)*(Real.pi/sqrt (a^2-b^2)) := by + rw [intervalIntegral.integral_sub (intervalIntegrable_const.sub hc) (hi.const_mul _), + intervalIntegral.integral_sub intervalIntegrable_const hc, + intervalIntegral.integral_const,intervalIntegral.integral_div, + integral_cos,intervalIntegral.integral_const_mul,mp_integral_cos_denominator hab] + simp + _ = _ := by + have hs := sqrt_pos.mpr (mp_discriminant_pos hab) + have hsq := sq_sqrt (mp_discriminant_pos hab).le + field_simp [hb,hs.ne'] + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricPrimitive.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..abf5bf49939c65089408331b4a56621b08d628e3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MPTrigonometricPrimitive.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPTrigonometricDenominator +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus + +namespace OAI + +/-! An elementary antiderivative for the denominator in the MP density integral. -/ +noncomputable section +open Real Set +namespace InvariantIsing + +def mpAnglePrimitive (a b x : ℝ) : ℝ := + arccos ((a*cos x+b)/(a+b*cos x))/sqrt (a^2-b^2) + +lemma mp_cos_fraction_sqrt {a b : ℝ} (hab : |b| < a) {x : ℝ} (hx : x ∈ Ioo 0 Real.pi) : + sqrt (1-((a*cos x+b)/(a+b*cos x))^2) = + sqrt (a^2-b^2)*sin x/(a+b*cos x) := by + rw [mp_cos_fraction_identity hab x, + sqrt_div (mul_nonneg (mp_discriminant_pos hab).le (sq_nonneg _)), + sqrt_mul (mp_discriminant_pos hab).le, + sqrt_sq (sin_pos_of_pos_of_lt_pi hx.1 hx.2).le, + sqrt_sq (mp_cos_denominator_pos hab x).le] + +lemma mpAnglePrimitive_hasDerivAt {a b : ℝ} (hab : |b| < a) {x : ℝ} (hx : x ∈ Ioo 0 Real.pi) : + HasDerivAt (mpAnglePrimitive a b) (1/(a+b*cos x)) x := by + have hm := mp_cos_fraction_mem_Ioo hab hx + have hc := (hasDerivAt_arccos (ne_of_gt hm.1) (ne_of_lt hm.2)).comp x + (mp_cos_fraction_hasDerivAt hab x) + have hs := sqrt_pos.mpr (mp_discriminant_pos hab) + have hd := mp_cos_denominator_pos hab x + have hsin := sin_pos_of_pos_of_lt_pi hx.1 hx.2 + unfold mpAnglePrimitive + have hc' := hc.div_const (sqrt (a^2-b^2)) + simp only [Function.comp_def] at hc' + convert hc' using 1 + rw [mp_cos_fraction_sqrt hab hx] + have hsq := sq_sqrt (mp_discriminant_pos hab).le + field_simp [hs.ne',hd.ne',hsin.ne'] + nlinarith + +lemma continuous_mpAnglePrimitive {a b : ℝ} (hab : |b| < a) : + Continuous (mpAnglePrimitive a b) := by + unfold mpAnglePrimitive + apply Continuous.div_const + apply continuous_arccos.comp + exact ((continuous_const.mul continuous_cos).add continuous_const).div + (continuous_const.add (continuous_const.mul continuous_cos)) + (fun x => (mp_cos_denominator_pos hab x).ne') + +theorem mp_integral_cos_denominator {a b : ℝ} (hab : |b| < a) : + (∫ x in (0 : ℝ)..Real.pi, 1/(a+b*cos x)) = Real.pi/sqrt (a^2-b^2) := by + have hi : IntervalIntegrable (fun x : ℝ => 1/(a+b*cos x)) MeasureTheory.volume 0 Real.pi := + (continuous_const.div (continuous_const.add (continuous_const.mul continuous_cos)) + (fun x => (mp_cos_denominator_pos hab x).ne')).intervalIntegrable 0 Real.pi + have h := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le pi_pos.le + (continuous_mpAnglePrimitive hab).continuousOn (fun x hx => mpAnglePrimitive_hasDerivAt hab hx) hi + have hp : a+b ≠ 0 := by simpa using (mp_cos_denominator_pos hab 0).ne' + have hn : a-b ≠ 0 := by simpa only [cos_pi,mul_neg_one,sub_eq_add_neg] using (mp_cos_denominator_pos hab Real.pi).ne' + have he : (a*(-1)+b)/(a+b*(-1)) = -1 := by + apply (div_eq_iff (show a+b*(-1) ≠ 0 by simpa only [mul_neg_one,sub_eq_add_neg] using hn)).mpr + ring + simpa only [mpAnglePrimitive,cos_zero,cos_pi,mul_one,he,div_self hp, + arccos_one,arccos_neg_one,zero_div,sub_zero] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MarchenkoPasturInput.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MarchenkoPasturInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d27376fe58388e05a18151b2ea768392d017e02 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MarchenkoPasturInput.lean @@ -0,0 +1,25 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianScaledEmpiricalWeak + +namespace OAI + +/-! The Gaussian Marchenko–Pastur theorem, including real spectral scaling. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +universe u +namespace InvariantIsing + +theorem marchenkoPastur_proved (α : ℝ) (hα : 0 < α) : MarchenkoPasturInput.{u} α hα where + probability := marchenkoPastur_probability hα + support_bound := marchenkoPastur_support_bound hα + left_mem := marchenkoPastur_left_mem hα + right_mem := marchenkoPastur_right_mem hα + measurable_eigenvalues := fun N => measurable_gaussianPatternEigenvalues N (gaussianPatternCount α N) + weak := by + intro Ω _ P _ Z hZ c + exact gaussianPattern_scaled_empirical_weak hα P Z hZ c + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Gaussian/MarchenkoPasturTransform.lean b/lean/OAI/Probability/InvariantIsing/Gaussian/MarchenkoPasturTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..1028805d5cdcf3e428efe24bdf7dabbb4c915635 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Gaussian/MarchenkoPasturTransform.lean @@ -0,0 +1,96 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolventEquation + +namespace OAI + +/-! The unique nonnegative solution of the real Marchenko--Pastur transform equation. -/ +noncomputable section +namespace InvariantIsing + +def marchenkoPasturTransform (t α : ℝ) : ℝ := + (-(t+α-1)+Real.sqrt ((t+α-1)^2+4*t))/(2*t) + +def marchenkoPasturResidual (t α u : ℝ) : ℝ := 1-t*u-α*(u/(1+u)) + +lemma marchenkoPasturTransform_pos {t α : ℝ} (ht : 0 < t) : 0 < marchenkoPasturTransform t α := by + have hs : (t+α-1)^2 < (t+α-1)^2+4*t := by linarith + have ha := Real.lt_sqrt_of_sq_lt hs + unfold marchenkoPasturTransform + exact div_pos (by linarith) (by positivity) + +lemma marchenkoPasturTransform_polynomial {t α : ℝ} (ht : 0 < t) : + t*(marchenkoPasturTransform t α)^2+(t+α-1)*marchenkoPasturTransform t α-1 = 0 := by + have hs := Real.sq_sqrt (show 0 ≤ (t+α-1)^2+4*t by positivity) + rw [show 4*t=t*4 by ring] at hs + unfold marchenkoPasturTransform + field_simp [ht.ne'] + nlinarith + +lemma marchenkoPasturTransform_equation {t α : ℝ} (ht : 0 < t) : + marchenkoPasturResidual t α (marchenkoPasturTransform t α) = 0 := by + have hp := marchenkoPasturTransform_polynomial (α := α) ht + have hm := marchenkoPasturTransform_pos (α := α) ht + unfold marchenkoPasturResidual + apply (sub_eq_zero.mpr ?_) + rw [← mul_div_assoc] + apply (eq_div_iff (by linarith : 1+marchenkoPasturTransform t α ≠ 0)).mpr + nlinarith + +lemma nonnegative_fraction_mono {u v : ℝ} (hu : 0 ≤ u) (huv : u ≤ v) : + u/(1+u) ≤ v/(1+v) := by + apply (div_le_div_iff₀ (by linarith) (by linarith)).mpr + nlinarith + +lemma nonnegative_fraction_lipschitz {u v : ℝ} (hu : 0 ≤ u) (hv : 0 ≤ v) : + |u/(1+u)-v/(1+v)| ≤ |u-v| := by + have hd : 0 < (1+u)*(1+v) := mul_pos (by linarith) (by linarith) + have he : u/(1+u)-v/(1+v) = (u-v)/((1+u)*(1+v)) := by field_simp; ring + rw [he,abs_div,abs_of_pos hd] + apply (div_le_iff₀ hd).mpr + have hd1 : 1 ≤ (1+u)*(1+v) := by nlinarith [mul_nonneg hu hv] + nlinarith [abs_nonneg (u-v)] + +lemma marchenkoPasturTransform_error {t α u : ℝ} (ht : 0 < t) (hα : 0 ≤ α) (hu : 0 ≤ u) : + |u-marchenkoPasturTransform t α| ≤ |marchenkoPasturResidual t α u|/t := by + let v := marchenkoPasturTransform t α + have hv : 0 ≤ v := (marchenkoPasturTransform_pos ht).le + have he : 1-t*v-α*(v/(1+v)) = 0 := marchenkoPasturTransform_equation ht + apply (le_div_iff₀ ht).mpr + rcases le_total u v with huv | hvu + · rw [abs_of_nonpos (sub_nonpos.mpr huv)] + have hf := mul_le_mul_of_nonneg_left (nonnegative_fraction_mono hu huv) hα + have hr : 0 ≤ marchenkoPasturResidual t α u := by + unfold marchenkoPasturResidual + nlinarith + rw [abs_of_nonneg hr] + unfold marchenkoPasturResidual + nlinarith + · rw [abs_of_nonneg (sub_nonneg.mpr hvu)] + have hf := mul_le_mul_of_nonneg_left (nonnegative_fraction_mono hv hvu) hα + have hr : marchenkoPasturResidual t α u ≤ 0 := by + unfold marchenkoPasturResidual + nlinarith + rw [abs_of_nonpos hr] + unfold marchenkoPasturResidual + nlinarith + +lemma marchenkoPasturResidual_coefficient {t α β u : ℝ} (hu : 0 ≤ u) : + |marchenkoPasturResidual t α u| ≤ |marchenkoPasturResidual t β u|+|α-β| := by + have hf : |u/(1+u)| ≤ 1 := by + rw [abs_of_nonneg (div_nonneg hu (by linarith))] + exact (div_le_one (by linarith)).mpr (by linarith) + have he : marchenkoPasturResidual t α u = + marchenkoPasturResidual t β u+(β-α)*(u/(1+u)) := by + unfold marchenkoPasturResidual + ring + rw [he] + calc + _ ≤ |marchenkoPasturResidual t β u|+|(β-α)*(u/(1+u))| := abs_add_le _ _ + _ ≤ _ := by + rw [abs_mul,abs_sub_comm β α] + exact add_le_add le_rfl ((mul_le_mul_of_nonneg_left hf (abs_nonneg (α-β))).trans_eq (mul_one _)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/CompactNegativeMinimum.lean b/lean/OAI/Probability/InvariantIsing/Haar/CompactNegativeMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..8716872906aba0edacabc84abb2b7b1eabaac64e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/CompactNegativeMinimum.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Haar.CompactParabolicMinimum + +namespace OAI + +/-! A compact parabolic minimum test restricted to negative minima. -/ +noncomputable section +open Filter Set +open scoped Topology +namespace InvariantIsing + +lemma compact_nonneg_of_negative_min_derivative {K : Type*} + [TopologicalSpace K] [CompactSpace K] [Nonempty K] + {T : ℝ} (hT : 0 ≤ T) (W : ℝ → K → ℝ) (Wt : ℝ × K → ℝ) + (hc : ContinuousOn (fun z : ℝ × K => W z.1 z.2) (Icc (0:ℝ) T ×ˢ Set.univ)) + (hi : ∀ x, 0 ≤ W 0 x) + (hd : ∀ t ∈ Ioc (0:ℝ) T, ∀ x, HasDerivAt (fun s => W s x) (Wt (t,x)) t) + (hmin : ∀ t ∈ Ioc (0:ℝ) T, ∀ x, W t x < 0 → + (∀ y, W t x ≤ W t y) → 0 < Wt (t,x)) : + ∀ t ∈ Icc (0:ℝ) T, ∀ x, 0 ≤ W t x := by + intro t ht x + by_contra hn + have hneg : W t x < 0 := lt_of_not_ge hn + let x₀ : K := Classical.choice inferInstance + obtain ⟨q,hq,hm⟩ := (isCompact_Icc.prod (isCompact_univ : IsCompact (Set.univ : Set K))).exists_isMinOn + ⟨(0,x₀),⟨⟨le_rfl,hT⟩,Set.mem_univ x₀⟩⟩ hc + have hqneg : W q.1 q.2 < 0 := (hm (show (t,x) ∈ Icc (0:ℝ) T ×ˢ (Set.univ : Set K) from + ⟨ht,Set.mem_univ x⟩)).trans_lt hneg + have hqt : 0 < q.1 := by + by_contra h + have he : q.1=0 := le_antisymm (le_of_not_gt h) hq.1.1 + rw [he] at hqneg + exact (not_lt_of_ge (hi q.2)) hqneg + have hleft : ∀ᶠ s in 𝓝[<] q.1, W q.1 q.2 ≤ W s q.2 := by + have hpos : ∀ᶠ s in 𝓝[<] q.1, 0 < s := + (show ∀ᶠ s : ℝ in 𝓝 q.1, 0 < s from Ioi_mem_nhds hqt).filter_mono nhdsWithin_le_nhds + filter_upwards [hpos,self_mem_nhdsWithin] with s hs hs' + exact hm (show (s,q.2) ∈ Icc (0:ℝ) T ×ˢ (Set.univ : Set K) from + ⟨⟨hs.le,hs'.le.trans hq.1.2⟩,Set.mem_univ q.2⟩) + have htime := derivative_nonpos_at_left_min (hd q.1 ⟨hqt,hq.1.2⟩ q.2) hleft + have hsp := hmin q.1 ⟨hqt,hq.1.2⟩ q.2 hqneg + (fun y => hm (show (q.1,y) ∈ Icc (0:ℝ) T ×ˢ (Set.univ : Set K) from + ⟨hq.1,Set.mem_univ y⟩)) + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/CompactParabolicMinimum.lean b/lean/OAI/Probability/InvariantIsing/Haar/CompactParabolicMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbb28d55e857b24416fb3770fc25117d2f9e92a0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/CompactParabolicMinimum.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticMinimumCalculus +import Mathlib.Topology.Order.Compact + +namespace OAI + +/-! The scalar minimum argument on a compact spatial state space. -/ +noncomputable section +open Filter Set +open scoped Topology +namespace InvariantIsing + +lemma compact_parabolic_nonneg {K : Type*} [TopologicalSpace K] [CompactSpace K] [Nonempty K] + {T : ℝ} (hT : 0 ≤ T) (W : ℝ → K → ℝ) (Wt : ℝ × K → ℝ) (B : ℝ → K → ℝ) + (hc : ContinuousOn (fun z : ℝ × K => W z.1 z.2) (Icc (0 : ℝ) T ×ˢ Set.univ)) + (hi : ∀ x, 0 ≤ W 0 x) + (hd : ∀ t ∈ Ioc (0 : ℝ) T, ∀ x, HasDerivAt (fun s => W s x) (Wt (t,x)) t) + (hpde : ∀ t ∈ Ioc (0 : ℝ) T, ∀ x, B t x-W t x ≤ Wt (t,x)) + (hspace : ∀ t ∈ Icc (0 : ℝ) T, ∀ x, (∀ y, W t x ≤ W t y) → 0 ≤ B t x) : + ∀ t ∈ Icc (0 : ℝ) T, ∀ x, 0 ≤ W t x := by + intro t ht x + by_contra hn + have hneg : W t x < 0 := lt_of_not_ge hn + let x₀ : K := Classical.choice inferInstance + obtain ⟨q,hq,hm⟩ := (isCompact_Icc.prod (isCompact_univ : IsCompact (Set.univ : Set K))).exists_isMinOn + ⟨(0,x₀),⟨⟨le_rfl,hT⟩,Set.mem_univ x₀⟩⟩ hc + have hqneg : W q.1 q.2 < 0 := (hm (show (t,x) ∈ Icc (0 : ℝ) T ×ˢ (Set.univ : Set K) from + ⟨ht,Set.mem_univ x⟩)).trans_lt hneg + have hqt : 0 < q.1 := by + by_contra h + have he : q.1=0 := le_antisymm (le_of_not_gt h) hq.1.1 + rw [he] at hqneg + exact (not_lt_of_ge (hi q.2)) hqneg + have hleft : ∀ᶠ s in 𝓝[<] q.1, W q.1 q.2 ≤ W s q.2 := by + have hpos : ∀ᶠ s in 𝓝[<] q.1, 0 < s := + (show ∀ᶠ s : ℝ in 𝓝 q.1, 0 < s from Ioi_mem_nhds hqt).filter_mono + nhdsWithin_le_nhds + filter_upwards [hpos,self_mem_nhdsWithin] with s hs hs' + exact hm (show (s,q.2) ∈ Icc (0 : ℝ) T ×ˢ (Set.univ : Set K) from + ⟨⟨hs.le,hs'.le.trans hq.1.2⟩,Set.mem_univ q.2⟩) + have htime := derivative_nonpos_at_left_min (hd q.1 ⟨hqt,hq.1.2⟩ q.2) hleft + have hsp := hspace q.1 hq.1 q.2 (fun y => hm (show (q.1,y) ∈ Icc (0 : ℝ) T ×ˢ (Set.univ : Set K) from + ⟨hq.1,Set.mem_univ y⟩)) + have hp := hpde q.1 ⟨hqt,hq.1.2⟩ q.2 + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/DerivativeComparison.lean b/lean/OAI/Probability/InvariantIsing/Haar/DerivativeComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..cea9676a3cbec7889f1ed9c69e9639e89fd5a1f0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/DerivativeComparison.lean @@ -0,0 +1,30 @@ +import Mathlib + +namespace OAI + +/-! A derivative comparison obtained from pointwise increments. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +theorem norm_derivative_le_of_increment_bound + {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + {f : ℝ → E} {g : ℝ → F} {f' : E} {g' : F} {x L : ℝ} + (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) + (h : ∀ t, ‖f t-f x‖ ≤ L*‖g t-g x‖) : ‖f'‖ ≤ L*‖g'‖ := by + apply le_of_tendsto_of_tendsto hf.tendsto_slope.norm (hg.tendsto_slope.norm.const_mul L) + apply Eventually.of_forall + intro t + simp only [slope_def_module,norm_smul] + calc + ‖(t-x)⁻¹‖*‖f t-f x‖ ≤ ‖(t-x)⁻¹‖*(L*‖g t-g x‖) := + mul_le_mul_of_nonneg_left (h t) (norm_nonneg _) + _ = L*(‖(t-x)⁻¹‖*‖g t-g x‖) := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarCasimirAlgebra.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarCasimirAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..a91c228392d7245340be32fd734febd1227f1130 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarCasimirAlgebra.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPlaneAdjoint + +namespace OAI + +/-! Adjoint invariance of the quadratic orthogonal Casimir in any representation. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma sum_skew_symmetric_coeff_swap {N : ℕ} {V : Type*} + [AddCommGroup V] [Module ℝ V] + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) + (T : Fin N → Fin N → V) (hT : ∀ i j, T i j = T j i) : + (∑ i, ∑ j, A j i • T i j) = 0 := by + rw [Finset.sum_comm] + exact sum_skew_symmetric_coeff A hA (fun i j => T j i) (fun i j => hT j i) + +/-- The coefficient cancellation uses only skew symmetry, with no analytic premise. -/ +theorem plane_adjoint_jordan_sum {N : ℕ} {V : Type*} + [AddCommGroup V] [Module ℝ V] + (F : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] Module.End ℝ V) + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) : + (∑ i, ∑ j, + (F (planeGenerator i j)*F (A*planeGenerator i j-planeGenerator i j*A)+ + F (A*planeGenerator i j-planeGenerator i j*A)*F (planeGenerator i j))) = 0 := by + let x := fun i j => F (planeGenerator i j) + have he (i j : Fin N) : + F (planeGenerator i j)*F (A*planeGenerator i j-planeGenerator i j*A)+ + F (A*planeGenerator i j-planeGenerator i j*A)*F (planeGenerator i j) = + (∑ k, A k i • (x i j*x k j+x k j*x i j))+ + ∑ k, A k j • (x i j*x i k+x i k*x i j) := by + rw [planeGenerator_adjoint_expansion A hA i j,map_add,map_sum,map_sum] + simp only [map_smul,mul_add,add_mul,Finset.mul_sum,Finset.sum_mul, + smul_mul_assoc,mul_smul_comm,smul_add] + dsimp only [x] + simp only [Finset.sum_add_distrib] + abel + simp_rw [he,Finset.sum_add_distrib] + have h₁ : (∑ i : Fin N, ∑ j : Fin N, ∑ k : Fin N, + A k i • (x i j*x k j+x k j*x i j)) = 0 := by + rw [Finset.sum_comm] + apply Finset.sum_eq_zero + intro j _ + exact sum_skew_symmetric_coeff_swap A hA _ (fun i k => add_comm _ _) + have h₂ : (∑ i : Fin N, ∑ j : Fin N, ∑ k : Fin N, + A k j • (x i j*x i k+x i k*x i j)) = 0 := by + apply Finset.sum_eq_zero + intro i _ + exact sum_skew_symmetric_coeff_swap A hA _ (fun j k => add_comm _ _) + rw [h₁,h₂,zero_add] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarCompactness.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarCompactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..721ec20f18174f13411053cfbea32e9dee503cc8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarCompactness.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Haar.SpecialPlaneRotation + +namespace OAI + +/-! Compactness and entry bounds for the actual special orthogonal group. -/ +noncomputable section +open Matrix Set +open scoped BigOperators +namespace InvariantIsing + +lemma specialOrthogonal_entry_bound {N : ℕ} (U : SpecialOrthogonal N) (i j : Fin N) : + |(U : Matrix (Fin N) (Fin N) ℝ) i j| ≤ 1 := by + have hU := (Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).1 + have hrow : (∑ k, ((U : Matrix (Fin N) (Fin N) ℝ) i k)^2) = 1 := by + simpa only [Matrix.mul_apply,Matrix.transpose_apply,Matrix.one_apply_eq,pow_two] + using congrFun (congrFun hU i) i + have hs : ((U : Matrix (Fin N) (Fin N) ℝ) i j)^2 ≤ 1 := by + rw [← hrow] + exact Finset.single_le_sum (fun k _ => sq_nonneg _) (Finset.mem_univ j) + exact (sq_le_one_iff_abs_le_one _).mp hs + +lemma isClosed_specialOrthogonal (N : ℕ) : + IsClosed (Matrix.specialOrthogonalGroup (Fin N) ℝ : Set (Matrix (Fin N) (Fin N) ℝ)) := by + have he : (Matrix.specialOrthogonalGroup (Fin N) ℝ : Set (Matrix (Fin N) (Fin N) ℝ)) = + {A | A*A.transpose=1} ∩ {A | A.det=1} := by + ext A + simp only [Set.mem_inter_iff,Set.mem_ofPred_eq,SetLike.mem_coe, + Matrix.mem_specialOrthogonalGroup_iff,Matrix.mem_orthogonalGroup_iff] + rw [he] + apply IsClosed.inter + · apply isClosed_eq <;> fun_prop + · apply isClosed_eq <;> fun_prop + +lemma isCompact_specialOrthogonal (N : ℕ) : + IsCompact (Matrix.specialOrthogonalGroup (Fin N) ℝ : Set (Matrix (Fin N) (Fin N) ℝ)) := by + have hb : IsCompact (Set.pi Set.univ fun _ : Fin N => + Set.pi Set.univ fun _ : Fin N => Set.Icc (-1 : ℝ) 1) := + isCompact_univ_pi fun _ => isCompact_univ_pi fun _ => isCompact_Icc + apply hb.of_isClosed_subset (isClosed_specialOrthogonal N) + intro A hA + simp only [Set.mem_pi,Set.mem_univ,forall_true_left,Set.mem_Icc] + intro i j + exact abs_le.mp (specialOrthogonal_entry_bound ⟨A,hA⟩ i j) + +instance specialOrthogonal_compactSpace (N : ℕ) : CompactSpace (SpecialOrthogonal N) := + isCompact_iff_compactSpace.mp (isCompact_specialOrthogonal N) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarConcentrationInput.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarConcentrationInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..359637135198062b229bac890060d0ad98ebb871 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarConcentrationInput.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Haar.HaarTwoSidedTail +import OAI.Probability.InvariantIsing.Gaussian.GaussianMedianTail + +namespace OAI + +/-! +The exact Gromov--Milman specialization used by the pressure proof. The proof +uses the actual polynomial heat operator on SO(N), its proved curvature bound, +positive polynomial convolution, and the scalar entropy argument. +-/ +noncomputable section +open Matrix MeasureTheory +namespace InvariantIsing + +theorem haarConcentration_proved : HaarConcentrationInput := by + refine ⟨Real.exp 1,1/192,Real.exp_pos _,by norm_num,?_⟩ + intro N hN μ hμ hμinv f hf L hL hLip + let : IsProbabilityMeasure μ := hμ + let : μ.IsMulLeftInvariant := hμinv + obtain ⟨m,hm1,hm2⟩ := measurable_median μ f hf + refine ⟨m,hm1,hm2,?_⟩ + intro r hr + let k := ((N:ℝ)-2)/(8*L^2) + have hρ : 0 < (N:ℝ)-2 := by exact_mod_cast (show 0 < (N:ℤ)-2 by omega) + have hk : 0 < k := div_pos hρ (by positivity) + have hplus (s : ℝ) (hs : 0 < s) : + μ.real {U | s ≤ f U-(∫ V, f V ∂μ)} ≤ Real.exp (-k*s^2) := by + have hh := haar_lipschitz_upper_tail hN μ f L hL hLip hs + convert hh using 1 + congr 1 + dsimp only [k] + ring + have hminus (s : ℝ) (hs : 0 < s) : + μ.real {U | s ≤ (∫ V, f V ∂μ)-f U} ≤ Real.exp (-k*s^2) := by + have hh := haar_lipschitz_lower_tail hN μ f L hL hLip hs + convert hh using 1 + congr 1 + dsimp only [k] + ring + apply (gaussian_median_tail μ f (∫ V, f V ∂μ) m k hk hm1 hm2 hplus hminus hr).trans + apply mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr ?_) (Real.exp_pos _).le + have hdim : (N:ℝ) ≤ 3*((N:ℝ)-2) := by + have hn : (3:ℝ) ≤ N := by exact_mod_cast hN + linarith + have hnum : -3*((N:ℝ)-2)*r^2 ≤ -(N:ℝ)*r^2 := by + nlinarith [mul_nonneg (sub_nonneg.mpr hdim) (sq_nonneg r)] + calc + -k*r^2/8 = (-3*((N:ℝ)-2)*r^2)/(192*L^2) := by dsimp only [k]; ring + _ ≤ (-(N:ℝ)*r^2)/(192*L^2) := div_le_div_of_nonneg_right hnum (by positivity) + _ = -(1/192)*(N:ℝ)*r^2/L^2 := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarContinuousDerivative.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarContinuousDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d892f30722c9604cb230dec561bd6ca40faaaee --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarContinuousDerivative.lean @@ -0,0 +1,37 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialValue + +namespace OAI + +/-! Compact domination for continuous derivatives along actual Haar rotations. -/ +noncomputable section +open Matrix MeasureTheory +namespace InvariantIsing + +lemma continuous_haar_integrable {N : ℕ} (μ : Measure (SpecialOrthogonal N)) [IsFiniteMeasure μ] + (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) : Integrable f μ := by + obtain ⟨B,hB⟩ := isCompact_univ.exists_bound_of_continuousOn hf.continuousOn + exact Integrable.of_bound hf.measurable.aestronglyMeasurable B + (ae_of_all μ fun U => hB U (Set.mem_univ U)) + +lemma integral_haar_continuous_derivative {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (i j : Fin N) + (f q : SpecialOrthogonal N → ℝ) (hf : Continuous f) (hq : Continuous q) + (hd : ∀ U : SpecialOrthogonal N, ∀ t : ℝ, + HasDerivAt (fun s => f (specialPlaneRotation i j s*U)) + (q (specialPlaneRotation i j t*U)) t) : + (∫ U, q U ∂μ) = 0 := by + obtain ⟨B,hB⟩ := isCompact_univ.exists_bound_of_continuousOn hq.continuousOn + have he := integral_special_rotation_derivative_eq_zero μ + (specialPlaneRotation i j) (specialPlaneRotation_zero i j) f hf.measurable + (continuous_haar_integrable μ f hf) (fun t U => q (specialPlaneRotation i j t*U)) + (by simpa only [specialPlaneRotation_zero,one_mul] using hq.measurable.aestronglyMeasurable) + (fun _ => B) (integrable_const B) + (ae_of_all μ fun U t _ => hB (specialPlaneRotation i j t*U) (Set.mem_univ _)) + (ae_of_all μ fun U t _ => hd U t) + simpa only [specialPlaneRotation_zero,one_mul] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarCorrectedHessian.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarCorrectedHessian.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b0813548c3abc643deea3afd37c546c9518fa02 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarCorrectedHessian.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialCurvature + +namespace OAI + +/-! The curvature estimate survives a symmetric gradient-square correction. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma matrixPolynomial_corrected_hessian_bound {N : ℕ} + (p : MatrixPolynomial N) (M : Matrix (Fin N) (Fin N) ℝ) (c : ℝ) : + ((N:ℝ)-2)*matrixPolynomialEval M (haarPolynomialGamma p p) ≤ + ∑ i, ∑ j, ∑ k, ∑ l, + (matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator k l) + (matrixPolynomialDerivation (planeGenerator i j) p))- + c*matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator i j) p)* + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator k l) p))^2 := by + let ell := matrixPolynomialDifferential p M + let H : (Fin N × Fin N) → (Fin N × Fin N) → ℝ := fun a b => + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator b.1 b.2) + (matrixPolynomialDerivation (planeGenerator a.1 a.2) p))- + c*ell (planeGenerator a.1 a.2)*ell (planeGenerator b.1 b.2) + have hd (a b : Fin N × Fin N) : H a b-H b a = + ell (planeGenerator a.1 a.2*planeGenerator b.1 b.2- + planeGenerator b.1 b.2*planeGenerator a.1 a.2) := by + have he := congrArg (matrixPolynomialEval M) (Derivation.congr_fun + (matrixPolynomialDerivation_commutator + (planeGenerator b.1 b.2) (planeGenerator a.1 a.2)) p) + change matrixPolynomialEval M (_-_) = _ at he + rw [map_sub] at he + change matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator b.1 b.2) + (matrixPolynomialDerivation (planeGenerator a.1 a.2) p))- + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator a.1 a.2) + (matrixPolynomialDerivation (planeGenerator b.1 b.2) p)) = _ at he + dsimp only [H,ell,matrixPolynomialDifferential,LinearMap.coe_mk,AddHom.coe_mk] + linear_combination he + have hb := sum_antisymmetric_square_le H + simp_rw [hd] at hb + simp only [Fintype.sum_prod_type] at hb + rw [sum_plane_functional_double_bracket_sq ell] at hb + have hg : (∑ i : Fin N, ∑ j : Fin N, (ell (planeGenerator i j))^2) = + matrixPolynomialEval M (haarPolynomialGamma p p) := by + simp only [haarPolynomialGamma,map_sum,map_mul,pow_two] + rfl + rw [hg] at hb + dsimp only [H,ell,matrixPolynomialDifferential,LinearMap.coe_mk,AddHom.coe_mk] at hb + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarCurveBound.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarCurveBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..f59c53c909cffd1fe1048d60fe3fd3534da8241f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarCurveBound.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Haar.HaarCurveTangent +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialValue +import Mathlib.Analysis.Calculus.MeanValue + +namespace OAI + +/-! Integrating the coordinate-plane gradient bound along an orthogonal curve. -/ +noncomputable section +open Matrix MvPolynomial Set +open scoped BigOperators +namespace InvariantIsing + +lemma haarPolynomial_curve_bound {N : ℕ} (p : MatrixPolynomial N) + (U : ℝ → SpecialOrthogonal N) (B : ℝ → Matrix (Fin N) (Fin N) ℝ) + (K δ : ℝ) (hδ : 0 ≤ δ) + (hB : ∀ t ∈ Icc (0:ℝ) 1, ∀ i j, + HasDerivAt (fun s => (U s : Matrix (Fin N) (Fin N) ℝ) i j) (B t i j) t) + (hK : ∀ t ∈ Icc (0:ℝ) 1, + (∑ i, ∑ j, |(B t*(U t : Matrix (Fin N) (Fin N) ℝ).transpose) i j|) ≤ K) + (hp : ∀ V : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) V ≤ δ^2) : + |haarPolynomialValue p (U 1)-haarPolynomialValue p (U 0)| ≤ K*δ/2 := by + let f' := fun t => matrixPolynomialEval (U t : Matrix (Fin N) (Fin N) ℝ) + (matrixPolynomialDerivation (B t*(U t : Matrix (Fin N) (Fin N) ℝ).transpose) p) + have hd (t : ℝ) (ht : t ∈ Icc (0:ℝ) 1) : + HasDerivAt (fun s => haarPolynomialValue p (U s)) (f' t) t := + orthogonalCurve_polynomial_derivative p U (B t) t (hB t ht) + have hb (t : ℝ) (ht : t ∈ Ico (0:ℝ) 1) : ‖f' t‖ ≤ K*δ/2 := by + have ht' : t ∈ Icc (0:ℝ) 1 := ⟨ht.1,ht.2.le⟩ + have hx := matrixPolynomial_direction_bound p + (U t : Matrix (Fin N) (Fin N) ℝ) + (B t*(U t : Matrix (Fin N) (Fin N) ℝ).transpose) + (orthogonalCurve_tangent_skew U (B t) t (hB t ht')) δ hδ (hp (U t)) + have hy := mul_le_mul_of_nonneg_right (hK t ht') hδ + change |f' t| ≤ K*δ/2 + dsimp [f'] at * + linarith + simpa only [Real.norm_eq_abs] using + norm_image_sub_le_of_norm_deriv_le_segment_01' + (fun t ht => (hd t ht).hasDerivWithinAt) hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarCurveTangent.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarCurveTangent.lean new file mode 100644 index 0000000000000000000000000000000000000000..528d2506fcec558dc1b507aa2b99fc24bf14baaf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarCurveTangent.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Haar.HaarDirectionBound +import OAI.Probability.InvariantIsing.Haar.SpecialPlaneRotation + +namespace OAI + +/-! The velocity of an actual orthogonal curve is a skew left tangent. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma orthogonalCurve_tangent_skew {N : ℕ} (U : ℝ → SpecialOrthogonal N) + (B : Matrix (Fin N) (Fin N) ℝ) (t : ℝ) + (hB : ∀ i j, HasDerivAt (fun s => (U s : Matrix (Fin N) (Fin N) ℝ) i j) (B i j) t) : + (B*(U t : Matrix (Fin N) (Fin N) ℝ).transpose).transpose = + -(B*(U t : Matrix (Fin N) (Fin N) ℝ).transpose) := by + have hm (s : ℝ) := (Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp (U s).property).1 + have hz (i j : Fin N) : + (∑ k, (B i k*(U t : Matrix (Fin N) (Fin N) ℝ) j k+ + (U t : Matrix (Fin N) (Fin N) ℝ) i k*B j k)) = 0 := by + have hd := HasDerivAt.fun_sum (u := Finset.univ) fun k _ => (hB i k).mul (hB j k) + have he : (fun s => ∑ k, (U s : Matrix (Fin N) (Fin N) ℝ) i k* + (U s : Matrix (Fin N) (Fin N) ℝ) j k) = + fun _ : ℝ => (1 : Matrix (Fin N) (Fin N) ℝ) i j := by + funext s + exact congrFun (congrFun (hm s) i) j + change HasDerivAt (fun s => ∑ k, (U s : Matrix (Fin N) (Fin N) ℝ) i k* + (U s : Matrix (Fin N) (Fin N) ℝ) j k) _ t at hd + rw [he] at hd + exact hd.unique (hasDerivAt_const t _) + have hadd : B*(U t : Matrix (Fin N) (Fin N) ℝ).transpose+ + (U t : Matrix (Fin N) (Fin N) ℝ)*B.transpose=0 := by + ext i j + simpa only [Matrix.add_apply,Matrix.mul_apply,Matrix.transpose_apply, + Matrix.zero_apply,Finset.sum_add_distrib] using hz i j + rw [Matrix.transpose_mul,Matrix.transpose_transpose] + apply eq_neg_iff_add_eq_zero.mpr + simpa only [add_comm] using hadd + +lemma orthogonalCurve_tangent_mul {N : ℕ} (U : SpecialOrthogonal N) + (B : Matrix (Fin N) (Fin N) ℝ) : + (B*(U : Matrix (Fin N) (Fin N) ℝ).transpose)*(U : Matrix (Fin N) (Fin N) ℝ) = B := by + rw [mul_assoc,(Matrix.mem_orthogonalGroup_iff' (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).1,mul_one] + +lemma orthogonalCurve_polynomial_derivative {N : ℕ} (p : MatrixPolynomial N) + (U : ℝ → SpecialOrthogonal N) (B : Matrix (Fin N) (Fin N) ℝ) (t : ℝ) + (hB : ∀ i j, HasDerivAt (fun s => (U s : Matrix (Fin N) (Fin N) ℝ) i j) (B i j) t) : + HasDerivAt (fun s => matrixPolynomialEval (U s : Matrix (Fin N) (Fin N) ℝ) p) + (matrixPolynomialEval (U t : Matrix (Fin N) (Fin N) ℝ) + (matrixPolynomialDerivation (B*(U t : Matrix (Fin N) (Fin N) ℝ).transpose) p)) t := by + apply hasDerivAt_matrixPolynomialEval + intro i j + rw [orthogonalCurve_tangent_mul] + exact hB i j + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarDerivative.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5e9d4e309f47d6da54eb612df2db7294ce2dabe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarDerivative.lean @@ -0,0 +1,61 @@ +import Mathlib + +namespace OAI + +/-! +# Differentiating Haar rotation invariance + +Infinitesimal Haar invariance gives the integral identity for spectral Ward +identities under explicit domination assumptions. +-/ + +noncomputable section + +open MeasureTheory Filter +open scoped Topology + +namespace InvariantIsing + +abbrev Orthogonal (N : ℕ) := Matrix.orthogonalGroup (Fin N) ℝ + +/-- A dominated infinitesimal left rotation has Haar mean zero. -/ +lemma integral_rotation_derivative_eq_zero {N : ℕ} (μ : Measure (Orthogonal N)) + [μ.IsMulLeftInvariant] (R : ℝ → Orthogonal N) (hR : R 0 = 1) + (f : Orthogonal N → ℝ) (hf : Measurable f) (hfi : Integrable f μ) + (f' : ℝ → Orthogonal N → ℝ) (hf' : AEStronglyMeasurable (f' 0) μ) + (B : Orthogonal N → ℝ) (hB : Integrable B μ) + (hbound : ∀ᵐ U ∂μ, ∀ t ∈ Set.Ioo (-1 : ℝ) 1, ‖f' t U‖ ≤ B U) + (hderiv : ∀ᵐ U ∂μ, ∀ t ∈ Set.Ioo (-1 : ℝ) 1, + HasDerivAt (fun s => f (R s * U)) (f' t U) t) : + ∫ U, f' 0 U ∂μ = 0 := by + have hs : Set.Ioo (-1 : ℝ) 1 ∈ 𝓝 (0 : ℝ) := Ioo_mem_nhds (by norm_num) (by norm_num) + have hm : ∀ᶠ t in 𝓝 (0 : ℝ), AEStronglyMeasurable (fun U => f (R t * U)) μ := by + apply Filter.Eventually.of_forall + intro t + have hmul : Measurable (fun U : Orthogonal N => R t * U) := by + apply Measurable.subtype_mk + change Measurable (fun U : Orthogonal N => + (R t : Matrix (Fin N) (Fin N) ℝ) * (U : Matrix (Fin N) (Fin N) ℝ)) + apply Measurable.of_eval + intro i + apply Measurable.of_eval + intro j + simp only [Matrix.mul_apply] + exact Finset.measurable_sum _ fun k _ => + measurable_const.mul ((measurable_pi_apply j).comp + ((measurable_pi_apply k).comp measurable_subtype_coe)) + exact (hf.comp hmul).aestronglyMeasurable + have hi : Integrable (fun U => f (R 0 * U)) μ := by simpa only [hR, one_mul] using hfi + obtain ⟨_, hd⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le hs hm hi hf' + hbound hB hderiv + have he : (fun t => ∫ U, f (R t * U) ∂μ) = fun _ : ℝ => ∫ U, f U ∂μ := by + funext t + exact integral_mul_left_eq_self f (R t) + rw [he] at hd + exact hd.unique (hasDerivAt_const (0 : ℝ) (∫ U, f U ∂μ)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarDifferentiableCurve.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarDifferentiableCurve.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2c782b4eeffedeae7c63268d85575b82702e01c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarDifferentiableCurve.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Haar.HaarCurveBound + +namespace OAI + +/-! Finite-coordinate differentiable curves and their polynomial oscillation bounds. -/ +noncomputable section +open Matrix Set +open scoped BigOperators +namespace InvariantIsing + +structure HaarDifferentiableCurve (N : ℕ) where + value : ℝ → SpecialOrthogonal N + velocity : ℝ → Matrix (Fin N) (Fin N) ℝ + hasDeriv : ∀ t ∈ Icc (0:ℝ) 1, ∀ i j, + HasDerivAt (fun s => (value s : Matrix (Fin N) (Fin N) ℝ) i j) (velocity t i j) t + continuous_velocity : ∀ i j, ContinuousOn (fun t => velocity t i j) (Icc (0:ℝ) 1) + +namespace HaarDifferentiableCurve + +lemma continuous_entry {N : ℕ} (γ : HaarDifferentiableCurve N) (i j : Fin N) : + ContinuousOn (fun t => (γ.value t : Matrix (Fin N) (Fin N) ℝ) i j) (Icc (0:ℝ) 1) := + fun t ht => (γ.hasDeriv t ht i j).continuousAt.continuousWithinAt + +def constant {N : ℕ} (U : SpecialOrthogonal N) : HaarDifferentiableCurve N where + value := fun _ => U + velocity := fun _ => 0 + hasDeriv := fun t _ _ _ => hasDerivAt_const t _ + continuous_velocity := fun _ _ => continuousOn_const + +def mul {N : ℕ} (γ η : HaarDifferentiableCurve N) : HaarDifferentiableCurve N where + value := fun t => γ.value t*η.value t + velocity := fun t => γ.velocity t*(η.value t : Matrix (Fin N) (Fin N) ℝ)+ + (γ.value t : Matrix (Fin N) (Fin N) ℝ)*η.velocity t + hasDeriv := by + intro t ht i j + have hd := HasDerivAt.fun_sum (u := Finset.univ) fun k _ => + (γ.hasDeriv t ht i k).mul (η.hasDeriv t ht k j) + convert hd using 1 + · rfl + · simp only [Matrix.add_apply,Matrix.mul_apply,Finset.sum_add_distrib] + continuous_velocity := by + intro i j + simp only [Matrix.add_apply,Matrix.mul_apply] + exact (continuousOn_finsetSum _ fun k _ => + (γ.continuous_velocity i k).mul (η.continuous_entry k j)).add + (continuousOn_finsetSum _ fun k _ => + (γ.continuous_entry i k).mul (η.continuous_velocity k j)) + +lemma polynomial_bound {N : ℕ} (γ : HaarDifferentiableCurve N) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (p : MatrixPolynomial N) (δ : ℝ), 0 ≤ δ → + (∀ V : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) V ≤ δ^2) → + |haarPolynomialValue p (γ.value 1)-haarPolynomialValue p (γ.value 0)| ≤ K*δ := by + let F := fun t => ∑ i : Fin N, ∑ j : Fin N, + |(γ.velocity t*(γ.value t : Matrix (Fin N) (Fin N) ℝ).transpose) i j| + have hF : ContinuousOn F (Icc (0:ℝ) 1) := by + apply continuousOn_finsetSum + intro i _ + apply continuousOn_finsetSum + intro j _ + apply ContinuousOn.abs + change ContinuousOn (fun t => ∑ k, γ.velocity t i k* + (γ.value t : Matrix (Fin N) (Fin N) ℝ) j k) _ + exact continuousOn_finsetSum _ fun k _ => + (γ.continuous_velocity i k).mul (γ.continuous_entry j k) + obtain ⟨C,hC⟩ := isCompact_Icc.bddAbove_image hF + refine ⟨max C 0,le_max_right _ _,?_⟩ + intro p δ hδ hp + have hk (t : ℝ) (ht : t ∈ Icc (0:ℝ) 1) : F t ≤ max C 0 := + (hC (mem_image_of_mem F ht)).trans (le_max_left _ _) + have hb := haarPolynomial_curve_bound p γ.value γ.velocity (max C 0) δ hδ γ.hasDeriv hk hp + exact hb.trans (by nlinarith [mul_nonneg (le_max_right C 0) hδ]) + +end HaarDifferentiableCurve +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarDirectionBound.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarDirectionBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..49914a6634baa4eee88b8bfa0ffd3baf7a6a2bad --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarDirectionBound.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialCurvature + +namespace OAI + +/-! Directional control by coordinate-plane derivatives. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma plane_functional_abs_bound {N : ℕ} + (ell : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ) + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) + (δ : ℝ) (hδ : ∀ i j, |ell (planeGenerator i j)| ≤ δ) : + 2*|ell A| ≤ (∑ i, ∑ j, |A i j|)*δ := by + have hr := plane_functional_representation ell A hA + rw [matrixFrobeniusPair_eq_sum] at hr + change (∑ i, ∑ j, ell (planeGenerator i j)*A i j) = 2*ell A at hr + have hs : |∑ i, ∑ j, ell (planeGenerator i j)*A i j| ≤ + (∑ i, ∑ j, |A i j|)*δ := by + calc + |∑ i, ∑ j, ell (planeGenerator i j)*A i j| ≤ + ∑ i, |∑ j, ell (planeGenerator i j)*A i j| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i, ∑ j, |ell (planeGenerator i j)*A i j| := by + apply Finset.sum_le_sum; intro i _ + exact Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i, ∑ j, |A i j| * δ := by + apply Finset.sum_le_sum; intro i _ + apply Finset.sum_le_sum; intro j _ + rw [abs_mul,mul_comm] + exact mul_le_mul_of_nonneg_left (hδ i j) (abs_nonneg _) + _ = (∑ i, ∑ j, |A i j|)*δ := by simp only [Finset.sum_mul] + rw [hr,abs_mul,abs_of_nonneg (by norm_num : (0:ℝ) ≤ 2)] at hs + exact hs + +lemma matrixPolynomial_direction_bound {N : ℕ} + (p : MatrixPolynomial N) (M A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) (δ : ℝ) (hδ : 0 ≤ δ) + (hp : matrixPolynomialEval M (haarPolynomialGamma p p) ≤ δ^2) : + 2*|matrixPolynomialEval M (matrixPolynomialDerivation A p)| ≤ + (∑ i, ∑ j, |A i j|)*δ := by + apply plane_functional_abs_bound (matrixPolynomialDifferential p M) A hA δ + intro i j + change |matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator i j) p)| ≤ δ + have hpos (i j : Fin N) : + 0 ≤ (matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator i j) p))^2 := + sq_nonneg _ + have htotal : matrixPolynomialEval M (haarPolynomialGamma p p) = + ∑ i : Fin N, ∑ j : Fin N, + (matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator i j) p))^2 := by + simp only [haarPolynomialGamma,map_sum,map_mul,pow_two] + have hs : (matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator i j) p))^2 ≤ δ^2 := by + apply le_trans _ hp + rw [htotal] + exact (Finset.single_le_sum (fun k _ => hpos i k) (Finset.mem_univ j)).trans + (Finset.single_le_sum (fun k _ => Finset.sum_nonneg (fun l _ => hpos k l)) (Finset.mem_univ i)) + exact (sq_le_sq₀ (abs_nonneg _) hδ).mp (by simpa only [sq_abs] using hs) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialGradient.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..5155ffd3520095abffdd25aa195027659a5ad51a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialGradient.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Haar.HaarExponentialPolynomial +import OAI.Probability.InvariantIsing.Haar.PositiveExponentialSum + +namespace OAI + +/-! Uniform logarithmic-gradient bounds for positive exponential truncations. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma haarExpPolynomial_gamma {N : ℕ} (n : ℕ) (p : MatrixPolynomial N) : + haarPolynomialGamma (haarExpPolynomial (n+1) p) (haarExpPolynomial (n+1) p) = + (haarExpPolynomial n p)^2*haarPolynomialGamma p p := by + simp only [haarPolynomialGamma,haarExpPolynomial_derivation,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +lemma haarExpPolynomial_positive {N : ℕ} (n : ℕ) (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) (hp : 0 ≤ matrixPolynomialEval M p) : + 1 ≤ matrixPolynomialEval M (haarExpPolynomial n p) := by + rw [haarExpPolynomial_eval] + exact positiveExpSum_one_le n hp + +lemma haarExpPolynomial_log_gradient_bound {N : ℕ} (n : ℕ) (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) (hp : 0 ≤ matrixPolynomialEval M p) + (C : ℝ) (hC : 0 ≤ C) (hG : matrixPolynomialEval M (haarPolynomialGamma p p) ≤ C) : + matrixPolynomialEval M (haarPolynomialGamma (haarExpPolynomial (n+1) p) (haarExpPolynomial (n+1) p)) ≤ + C*(matrixPolynomialEval M (haarExpPolynomial (n+1) p))^2 := by + have h0 := haarExpPolynomial_positive n p M hp + have h1 := haarExpPolynomial_positive (n+1) p M hp + have hm : matrixPolynomialEval M (haarExpPolynomial n p) ≤ + matrixPolynomialEval M (haarExpPolynomial (n+1) p) := by + simp only [haarExpPolynomial_eval] + exact positiveExpSum_mono n hp + rw [haarExpPolynomial_gamma,map_mul,map_pow] + calc + _ ≤ (matrixPolynomialEval M (haarExpPolynomial n p))^2*C := + mul_le_mul_of_nonneg_left hG (sq_nonneg _) + _ ≤ C*(matrixPolynomialEval M (haarExpPolynomial (n+1) p))^2 := by + rw [mul_comm _ C] + exact mul_le_mul_of_nonneg_left ((sq_le_sq₀ (by linarith) (by linarith)).mpr hm) hC + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialLimit.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..df988ca9b7452be3aa6355fe3dc280a9ad88a32a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialLimit.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Haar.HaarExponentialGradient + +namespace OAI + +/-! Dominated transport from positive polynomial truncations to exponential observables. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma haarExpPolynomial_test_integral_tendsto {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] (p : MatrixPolynomial N) + (hp : ∀ U : SpecialOrthogonal N, 0 ≤ haarPolynomialValue p U) + (F : ℝ → ℝ) (hF : Continuous F) : + Tendsto (fun n : ℕ => ∫ U, F (haarPolynomialValue (haarExpPolynomial (n+1) p) U) ∂μ) + atTop (𝓝 (∫ U, F (Real.exp (haarPolynomialValue p U)) ∂μ)) := by + obtain ⟨B,hB⟩ := haarPolynomialValue_bound p + obtain ⟨K,hK⟩ := isCompact_Icc.exists_bound_of_continuousOn + (show ContinuousOn F (Icc 1 (Real.exp B)) from hF.continuousOn) + apply tendsto_integral_of_dominated_convergence (fun _ => K) + (fun n => (hF.comp (continuous_haarPolynomialValue _)).aestronglyMeasurable) + (integrable_const K) + · intro n + apply ae_of_all + intro U + apply hK + refine ⟨haarExpPolynomial_positive (n+1) p _ (hp U),?_⟩ + rw [haarPolynomialValue,haarExpPolynomial_eval] + exact (positiveExpSum_le_exp (n+1) (hp U)).trans + (Real.exp_le_exp.mpr ((le_abs_self _).trans (hB U))) + · apply ae_of_all + intro U + apply hF.continuousAt.tendsto.comp + have h := (positiveExpSum_tendsto (haarPolynomialValue p U)).comp (tendsto_add_atTop_nat 1) + simpa only [Function.comp_def,haarPolynomialValue,haarExpPolynomial_eval,positiveExpSum] using h + +theorem haar_exp_polynomial_entropy_bound {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : MatrixPolynomial N) (hp : ∀ U : SpecialOrthogonal N, 0 ≤ haarPolynomialValue p U) + (C : ℝ) (hC : 0 ≤ C) + (hG : ∀ U : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) U ≤ C) : + (∫ U, Real.exp (haarPolynomialValue p U)*Real.log (Real.exp (haarPolynomialValue p U)) ∂μ)- + (∫ U, Real.exp (haarPolynomialValue p U) ∂μ)* + Real.log (∫ U, Real.exp (haarPolynomialValue p U) ∂μ) ≤ + C*(∫ U, Real.exp (haarPolynomialValue p U) ∂μ)/(2*((N:ℝ)-2)) := by + have hn (n : ℕ) : + (∫ U, haarPolynomialValue (haarExpPolynomial (n+1) p) U* + Real.log (haarPolynomialValue (haarExpPolynomial (n+1) p) U) ∂μ)- + (∫ U, haarPolynomialValue (haarExpPolynomial (n+1) p) U ∂μ)* + Real.log (∫ U, haarPolynomialValue (haarExpPolynomial (n+1) p) U ∂μ) ≤ + C*(∫ U, haarPolynomialValue (haarExpPolynomial (n+1) p) U ∂μ)/(2*((N:ℝ)-2)) := by + obtain ⟨d,hd⟩ := exists_mem_haarPolynomialSpace (haarExpPolynomial (n+1) p) + exact haarPolynomial_entropy_bound hN μ ⟨_,hd⟩ 1 C zero_lt_one + (fun U => haarExpPolynomial_positive (n+1) p _ (hp U)) + (fun U => haarExpPolynomial_log_gradient_bound n p _ (hp U) C hC (hG U)) + have hm := haarExpPolynomial_test_integral_tendsto μ p hp id continuous_id + simp only [id_eq] at hm + have he := haarExpPolynomial_test_integral_tendsto μ p hp (fun x => x*Real.log x) Real.continuous_mul_log + exact le_of_tendsto_of_tendsto (he.sub (Real.continuous_mul_log.continuousAt.tendsto.comp hm)) + ((hm.const_mul C).div_const (2*((N:ℝ)-2))) (Eventually.of_forall hn) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialMomentBound.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialMomentBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..d39b406c0a36796d20474d31b1b767f5b186091a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialMomentBound.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMoment + +namespace OAI + +/-! Gaussian exponential-moment bounds for nonnegative polynomial observables. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +open scoped BigOperators +namespace InvariantIsing + +lemma haarPolynomialGamma_scaled_value {N : ℕ} (p : MatrixPolynomial N) (c : ℝ) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (haarPolynomialGamma (c • p) (c • p)) = + c^2*matrixPolynomialEval M (haarPolynomialGamma p p) := by + simp only [haarPolynomialGamma,Derivation.map_smul_of_tower,map_sum,map_mul,map_smul, + smul_eq_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +theorem haarPolynomialMoment_log_bound_of_nonneg {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : MatrixPolynomial N) (hp : ∀ U : SpecialOrthogonal N, 0 ≤ haarPolynomialValue p U) + (C : ℝ) (hC : 0 ≤ C) + (hG : ∀ U : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) U ≤ C) + {t : ℝ} (ht : 0 < t) : + Real.log (haarPolynomialMoment μ p t) ≤ + (∫ U, haarPolynomialValue p U ∂μ)*t+C/(2*((N:ℝ)-2))*t^2 := by + have hE (s : ℝ) (hs : 0 < s) : + s*haarPolynomialMomentDerivative μ p s- + haarPolynomialMoment μ p s*Real.log (haarPolynomialMoment μ p s) ≤ + (C/(2*((N:ℝ)-2)))*s^2*haarPolynomialMoment μ p s := by + have hscaled (U : SpecialOrthogonal N) : haarPolynomialValue (s • p) U = s*haarPolynomialValue p U := by + simp only [haarPolynomialValue,map_smul,smul_eq_mul] + have hp' (U : SpecialOrthogonal N) : 0 ≤ haarPolynomialValue (s • p) U := by + rw [hscaled] + exact mul_nonneg hs.le (hp U) + have hG' (U : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialGamma (s • p) (s • p)) U ≤ C*s^2 := by + rw [haarPolynomialValue,haarPolynomialGamma_scaled_value] + have hh := mul_le_mul_of_nonneg_left (hG U) (sq_nonneg s) + simpa only [haarPolynomialValue,mul_comm] using hh + have he := haar_exp_polynomial_entropy_bound hN μ (s • p) hp' (C*s^2) + (mul_nonneg hC (sq_nonneg s)) hG' + simp_rw [hscaled,Real.log_exp] at he + have hi : (∫ U, Real.exp (s*haarPolynomialValue p U)*(s*haarPolynomialValue p U) ∂μ) = + s*haarPolynomialMomentDerivative μ p s := by + rw [haarPolynomialMomentDerivative,← integral_const_mul] + apply integral_congr_ae + exact ae_of_all μ fun U => by ring + rw [hi] at he + change s*haarPolynomialMomentDerivative μ p s- + haarPolynomialMoment μ p s*Real.log (haarPolynomialMoment μ p s) ≤ + C*s^2*haarPolynomialMoment μ p s/(2*((N:ℝ)-2)) at he + linear_combination he + have hh := log_moment_le_of_entropy (haarPolynomialMoment μ p) + (haarPolynomialMomentDerivative μ p) (C/(2*((N:ℝ)-2))) + (haarPolynomialMoment_pos μ p) (haarPolynomialMoment_zero μ p) + (haarPolynomialMoment_hasDerivAt μ p) hE ht + simpa only [haarPolynomialMomentDerivative_zero] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialPolynomial.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd1d52036a121844ccb7c839927234e5d248804b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarExponentialPolynomial.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialEntropyBound + +namespace OAI + +/-! Positive polynomial truncations of an exponential observable. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def haarExpPolynomial {N : ℕ} (n : ℕ) (p : MatrixPolynomial N) : MatrixPolynomial N := + ∑ k ∈ Finset.range (n+1), ((Nat.factorial k : ℝ)⁻¹) • p^k + +lemma haarExpPolynomial_eval {N : ℕ} (n : ℕ) (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (haarExpPolynomial n p) = + ∑ k ∈ Finset.range (n+1), (matrixPolynomialEval M p)^k/(Nat.factorial k : ℝ) := by + simp only [haarExpPolynomial,map_sum,map_smul,map_pow,smul_eq_mul,div_eq_mul_inv,mul_comm] + +lemma haarExpPolynomial_derivation {N : ℕ} (n : ℕ) (p : MatrixPolynomial N) + (A : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialDerivation A (haarExpPolynomial (n+1) p) = + haarExpPolynomial n p*matrixPolynomialDerivation A p := by + unfold haarExpPolynomial + rw [Finset.sum_range_succ'] + simp only [map_add,map_sum,Derivation.map_smul_of_tower,pow_zero, + Derivation.map_one_eq_zero,smul_zero,add_zero] + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro k _ + have hk : (k:ℝ)+1 ≠ 0 := by positivity + have hf : (Nat.factorial k : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero k + have hcoef : ((Nat.factorial (k+1) : ℝ)⁻¹)*((k+1:ℕ):ℝ) = + (Nat.factorial k : ℝ)⁻¹ := by + rw [Nat.factorial_succ,Nat.cast_mul,Nat.cast_add,Nat.cast_one] + field_simp + rw [Derivation.leibniz_pow] + simp only [Nat.add_sub_cancel] + rw [← Nat.cast_smul_eq_nsmul ℝ] + change (Nat.factorial (k+1) : ℝ)⁻¹ • + (((k+1:ℕ):ℝ) • (p^k*matrixPolynomialDerivation A p)) = _ + rw [smul_smul,hcoef,smul_mul_assoc] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarFrobeniusBracket.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarFrobeniusBracket.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3fa6792a74c5b4521f9a195658cfad336de44e5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarFrobeniusBracket.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPlaneCasimir + +namespace OAI + +/-! The exact Frobenius bracket contraction for the special orthogonal algebra. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +/-- The real, unnormalized Frobenius bilinear form. -/ +def matrixFrobeniusPair {N : ℕ} (A B : Matrix (Fin N) (Fin N) ℝ) : ℝ := + (A.transpose * B).trace + +lemma matrixFrobeniusPair_self {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + matrixFrobeniusPair A A = ∑ i, ∑ j, (A i j)^2 := by + simp only [matrixFrobeniusPair,Matrix.trace,Matrix.diag_apply,Matrix.mul_apply, + Matrix.transpose_apply,pow_two] + exact Finset.sum_comm + +lemma matrixFrobeniusPair_self_nonneg {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + 0 ≤ matrixFrobeniusPair A A := by + rw [matrixFrobeniusPair_self] + exact Finset.sum_nonneg fun i _ => Finset.sum_nonneg fun j _ => sq_nonneg _ + +lemma planeGenerator_transpose {N : ℕ} (i j : Fin N) : + (planeGenerator i j).transpose = -planeGenerator i j := by + simp [planeGenerator,Matrix.transpose_sub,Matrix.transpose_single,neg_sub] + +lemma matrixFrobeniusPair_bracket {N : ℕ} + (E A B : Matrix (Fin N) (Fin N) ℝ) (hE : E.transpose = -E) : + matrixFrobeniusPair (E*A-A*E) B = -matrixFrobeniusPair A (E*B-B*E) := by + simp only [matrixFrobeniusPair,Matrix.transpose_sub,Matrix.transpose_mul,hE, + Matrix.mul_neg,Matrix.neg_mul,Matrix.sub_mul,Matrix.mul_sub,Matrix.trace_sub, + Matrix.trace_neg] + rw [← mul_assoc A.transpose E B,Matrix.trace_mul_cycle E A.transpose B] + rw [Matrix.trace_mul_cycle B E A.transpose] + simp only [mul_assoc] + ring + +/-- Ordered coordinate planes count each orthogonal tangent direction twice. -/ +theorem sum_planeGenerator_bracket_norm_sq {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) : + (∑ i : Fin N, ∑ j : Fin N, + matrixFrobeniusPair (planeGenerator i j*A-A*planeGenerator i j) + (planeGenerator i j*A-A*planeGenerator i j)) = + (4*((N : ℝ)-2))*matrixFrobeniusPair A A := by + simp_rw [matrixFrobeniusPair_bracket _ _ _ (planeGenerator_transpose _ _)] + simp only [Finset.sum_neg_distrib] + have hs : (∑ i : Fin N, ∑ j : Fin N, + matrixFrobeniusPair A + (planeGenerator i j*(planeGenerator i j*A-A*planeGenerator i j)- + (planeGenerator i j*A-A*planeGenerator i j)*planeGenerator i j)) = + matrixFrobeniusPair A (∑ i : Fin N, ∑ j : Fin N, + (planeGenerator i j*(planeGenerator i j*A-A*planeGenerator i j)- + (planeGenerator i j*A-A*planeGenerator i j)*planeGenerator i j)) := by + simp only [matrixFrobeniusPair,Matrix.mul_sum,Matrix.trace_sum] + rw [hs,sum_planeGenerator_double_commutator A hA] + simp only [matrixFrobeniusPair,Matrix.mul_smul,Matrix.trace_smul] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarFrobeniusGeometry.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarFrobeniusGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..083b2bfc2e459135b731a8d2f0561e7154546537 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarFrobeniusGeometry.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Haar.HaarKernelGeometry + +namespace OAI + +/-! Unnormalized Frobenius geometry for the averaging and tangent estimates. -/ +noncomputable section +open Matrix +open scoped BigOperators Matrix.Norms.Frobenius +namespace InvariantIsing + +lemma frobenius_norm_sq {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + ‖A‖^2 = matrixFrobeniusPair A A := by + rw [Matrix.frobenius_norm_def] + simp only [Real.rpow_two,Real.norm_eq_abs,sq_abs] + have hs : 0 ≤ ∑ i : Fin N, ∑ j : Fin N, (A i j)^2 := + Finset.sum_nonneg fun i _ => Finset.sum_nonneg fun j _ => sq_nonneg _ + rw [← Real.sqrt_eq_rpow,Real.sq_sqrt hs,matrixFrobeniusPair_self] + +lemma frobeniusDistance_eq_norm {N : ℕ} (U V : SpecialOrthogonal N) : + frobeniusDistance U V = ‖(U : Matrix (Fin N) (Fin N) ℝ)-V‖ := by + rw [Matrix.frobenius_norm_def] + simp only [Real.rpow_two,Real.norm_eq_abs,sq_abs,Matrix.sub_apply] + exact Real.sqrt_eq_rpow _ + +lemma frobenius_norm_mul_orthogonal {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (U : SpecialOrthogonal N) : ‖A*(U : Matrix (Fin N) (Fin N) ℝ)‖ = ‖A‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [frobenius_norm_sq,frobenius_norm_sq] + unfold matrixFrobeniusPair + rw [Matrix.transpose_mul,Matrix.trace_mul_cycle] + rw [mul_assoc A U (U : Matrix (Fin N) (Fin N) ℝ).transpose, + (Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).1,mul_one,Matrix.trace_mul_comm] + +lemma frobeniusDistance_mul_left {N : ℕ} (W U V : SpecialOrthogonal N) : + frobeniusDistance (W*U) (W*V) = frobeniusDistance U V := by + have h := congrArg (fun x : ℝ => 2*N-x) (haarKernelBase_mul_left W U V) + rw [haarKernelBase_dist,haarKernelBase_dist] at h + apply (sq_eq_sq₀ (Real.sqrt_nonneg _) (Real.sqrt_nonneg _)).mp + change (frobeniusDistance (W*U) (W*V))^2 = (frobeniusDistance U V)^2 + linarith + +lemma frobeniusDistance_comm {N : ℕ} (U V : SpecialOrthogonal N) : + frobeniusDistance U V = frobeniusDistance V U := by + rw [frobeniusDistance_eq_norm,frobeniusDistance_eq_norm,← norm_neg,neg_sub] + +lemma frobeniusDistance_mul_right {N : ℕ} (U V W : SpecialOrthogonal N) : + frobeniusDistance (U*W) (V*W) = frobeniusDistance U V := by + rw [frobeniusDistance_eq_norm,frobeniusDistance_eq_norm] + change ‖(U : Matrix (Fin N) (Fin N) ℝ)*W-(V : Matrix (Fin N) (Fin N) ℝ)*W‖ = _ + rw [← sub_mul,frobenius_norm_mul_orthogonal] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarFunctionalCurvature.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarFunctionalCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..42cc5afdc3ce78271148613022860d73220fb3a8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarFunctionalCurvature.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPlaneFrame + +namespace OAI + +/-! The sum of squared Lie brackets, with the precise dimension factor. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +def planeFunctionalMatrix {N : ℕ} + (ell : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ) : Matrix (Fin N) (Fin N) ℝ := + Matrix.of fun i j => ell (planeGenerator i j) + +lemma planeFunctionalMatrix_skew {N : ℕ} + (ell : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ) : + (planeFunctionalMatrix ell).transpose = -planeFunctionalMatrix ell := by + ext i j + change ell (planeGenerator j i) = -ell (planeGenerator i j) + rw [planeGenerator_swap,map_neg] + +lemma sum_plane_functional_bracket_sq {N : ℕ} + (ell : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ) + (E : Matrix (Fin N) (Fin N) ℝ) (hE : E.transpose = -E) : + (∑ i, ∑ j, (ell (E*planeGenerator i j-planeGenerator i j*E))^2) = + matrixFrobeniusPair (E*planeFunctionalMatrix ell-planeFunctionalMatrix ell*E) + (E*planeFunctionalMatrix ell-planeFunctionalMatrix ell*E) := by + let A := planeFunctionalMatrix ell + have hA : A.transpose = -A := planeFunctionalMatrix_skew ell + have hs (i j : Fin N) : + 4*(ell (E*planeGenerator i j-planeGenerator i j*E))^2 = + (matrixFrobeniusPair (E*A-A*E) (planeGenerator i j))^2 := by + have hr := plane_functional_representation ell + (E*planeGenerator i j-planeGenerator i j*E) + (skew_matrix_bracket hE (planeGenerator_transpose i j)) + have hb := matrixFrobeniusPair_bracket E A (planeGenerator i j) hE + change matrixFrobeniusPair A _ = _ at hr + rw [hr] at hb + rw [hb] + ring + have ht := sum_matrixFrobeniusPair_plane_sq (E*A-A*E) (skew_matrix_bracket hE hA) + simp_rw [← hs] at ht + simp only [← Finset.mul_sum] at ht + change _ = matrixFrobeniusPair (E*A-A*E) (E*A-A*E) + linarith + +/-- The ordered-plane convention has curvature factor `N - 2`. The factor +four here becomes one after the antisymmetric Hessian estimate. -/ +theorem sum_plane_functional_double_bracket_sq {N : ℕ} + (ell : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ) : + (∑ i, ∑ j, ∑ k, ∑ l, + (ell (planeGenerator i j*planeGenerator k l- + planeGenerator k l*planeGenerator i j))^2) = + (4*((N : ℝ)-2))*(∑ i, ∑ j, (ell (planeGenerator i j))^2) := by + simp_rw [sum_plane_functional_bracket_sq ell _ (planeGenerator_transpose _ _)] + rw [sum_planeGenerator_bracket_norm_sq _ (planeFunctionalMatrix_skew ell), + matrixFrobeniusPair_self] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarGammaCalculus.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarGammaCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..09a4b1c5f0157c8d1c1adf2ff99cbdaeb8aecec8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarGammaCalculus.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialGamma + +namespace OAI + +/-! First-order product and square-gradient identities for the rotation carré du champ. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma haarPolynomialGamma_mul {N : ℕ} (p q r : MatrixPolynomial N) : + haarPolynomialGamma p (q*r) = q*haarPolynomialGamma p r+r*haarPolynomialGamma p q := by + simp only [haarPolynomialGamma,Derivation.leibniz,smul_eq_mul, + Finset.mul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +lemma haarPolynomialGamma_sq {N : ℕ} (p q : MatrixPolynomial N) : + haarPolynomialGamma p (q^2) = 2*q*haarPolynomialGamma p q := by + rw [pow_two,haarPolynomialGamma_mul] + ring + +lemma haarPolynomialGamma_sub {N : ℕ} (p q r : MatrixPolynomial N) : + haarPolynomialGamma p (q-r) = haarPolynomialGamma p q-haarPolynomialGamma p r := by + simp only [haarPolynomialGamma,map_sub,mul_sub,Finset.sum_sub_distrib] + +lemma haarPolynomialGamma_smul {N : ℕ} (p q : MatrixPolynomial N) (c : ℝ) : + haarPolynomialGamma p (c • q) = c • haarPolynomialGamma p q := by + simp only [haarPolynomialGamma,Derivation.map_smul_of_tower,mul_smul_comm, + Finset.smul_sum] + +lemma haarPolynomialDerivation_gamma_sq {N : ℕ} (p : MatrixPolynomial N) + (A : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialDerivation A (haarPolynomialGamma p p) = + ∑ i, ∑ j, 2*(matrixPolynomialDerivation (planeGenerator i j) p* + matrixPolynomialDerivation A (matrixPolynomialDerivation (planeGenerator i j) p)) := by + simp only [haarPolynomialGamma,map_sum,Derivation.leibniz,smul_eq_mul] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarGroupTopology.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarGroupTopology.lean new file mode 100644 index 0000000000000000000000000000000000000000..6506deeb2b7a039cc4176abb400ebfb639e8e1f3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarGroupTopology.lean @@ -0,0 +1,23 @@ +import OAI.Probability.InvariantIsing.Haar.HaarCompactness + +namespace OAI + +/-! The actual matrix-group topology and positivity of finite Haar measure. -/ +noncomputable section +open Matrix MeasureTheory +namespace InvariantIsing + +instance specialOrthogonal_topologicalGroup (N : ℕ) : + IsTopologicalGroup (SpecialOrthogonal N) where + continuous_mul := continuous_mul + continuous_inv := by + apply Continuous.subtype_mk + change Continuous (fun U : SpecialOrthogonal N => + (U : Matrix (Fin N) (Fin N) ℝ).transpose) + fun_prop + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatConstants.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatConstants.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe7b51912a2f6db0d3ce84a9f818e063a5ea0673 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatConstants.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatPositivity + +namespace OAI + +/-! Preservation of constants by the constructed polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma continuousLinearMap_exp_apply_of_zero {E : Type*} [NormedAddCommGroup E] + [NormedSpace ℝ E] [CompleteSpace E] (A : E →L[ℝ] E) (v : E) (hv : A v=0) : + NormedSpace.exp A v = v := by + have hp (n : ℕ) : (A^(n+1)) v=0 := by + induction n with + | zero => simpa only [zero_add,pow_one] using hv + | succ n ih => + rw [show n+1+1=(n+1)+1 by omega,pow_succ',mul_apply_eq_comp,ih,map_zero] + have hn (n : ℕ) : ((n.factorial⁻¹ : ℝ) • A^n) v = if n=0 then v else 0 := by + cases n with + | zero => simp + | succ n => simp only [_root_.smul_apply,hp,smul_zero, + Nat.succ_ne_zero,ite_false] + have hs := (ContinuousLinearMap.apply ℝ E v).hasSum + (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) A) + have ht : HasSum (fun n : ℕ => if n=0 then v else 0) (NormedSpace.exp A v) := by + simpa only [ContinuousLinearMap.apply_apply,hn] using hs + exact ht.unique (hasSum_ite_eq 0 v) + +lemma haarPolynomialHeat_eq_of_laplacian_zero {N d : ℕ} + (p : haarPolynomialSpace N d) (hp : haarPolynomialLaplacian N (p : MatrixPolynomial N)=0) + (t : ℝ) : haarPolynomialHeat N d t p = p := by + have hr : haarPolynomialRestrictedLaplacian N d p=0 := by + apply Subtype.ext + exact hp + have hc : haarPolynomialCoordinateLaplacian N d (haarPolynomialCoordinates N d p)=0 := by + rw [haarPolynomialCoordinateLaplacian_apply,hr,map_zero] + apply (haarPolynomialCoordinates N d).injective + rw [haarPolynomialCoordinates_heat] + apply continuousLinearMap_exp_apply_of_zero + simp only [_root_.smul_apply,hc,smul_zero] + +lemma haarPolynomialLaplacian_one (N : ℕ) : + haarPolynomialLaplacian N (1 : MatrixPolynomial N) = 0 := by + simp only [haarPolynomialLaplacian_apply,Derivation.map_one_eq_zero,map_zero, + Finset.sum_const_zero] + +lemma haarPolynomialHeat_one (N d : ℕ) (t : ℝ) : + haarPolynomialHeat N d t ⟨1,one_mem_haarPolynomialSpace N d⟩ = + ⟨1,one_mem_haarPolynomialSpace N d⟩ := + haarPolynomialHeat_eq_of_laplacian_zero _ (haarPolynomialLaplacian_one N) t + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatContinuity.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fca24012e417a594b11d523c5c16d8945e0c20a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatContinuity.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialHeat + +namespace OAI + +/-! Joint continuity of the finite polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def haarPolynomialBasis (N d : ℕ) + (i : Fin (Module.finrank ℝ (haarPolynomialSpace N d))) : MatrixPolynomial N := + ((Module.finBasis ℝ (haarPolynomialSpace N d)) i : MatrixPolynomial N) + +lemma haarPolynomialEval_eq_coordinates {N d : ℕ} + (p : haarPolynomialSpace N d) (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (p : MatrixPolynomial N) = + ∑ i, haarPolynomialCoordinates N d p i* + matrixPolynomialEval M (haarPolynomialBasis N d i) := by + have hp : p = ∑ i, haarPolynomialCoordinates N d p i • + (Module.finBasis ℝ (haarPolynomialSpace N d)) i := by + simpa only [haarPolynomialCoordinates,LinearEquiv.symm_apply_apply] using + ((Module.finBasis ℝ (haarPolynomialSpace N d)).equivFun_symm_apply + (haarPolynomialCoordinates N d p)) + conv_lhs => rw [hp] + simp only [Submodule.coe_sum,Submodule.coe_smul,map_sum,map_smul,smul_eq_mul, + haarPolynomialBasis] + +lemma continuous_haarPolynomialHeat_coordinates {N d : ℕ} (p : haarPolynomialSpace N d) : + Continuous (fun t : ℝ => haarPolynomialCoordinates N d (haarPolynomialHeat N d t p)) := by + let L := haarPolynomialCoordinateLaplacian N d + have hc : Continuous (fun t : ℝ => NormedSpace.exp (t • L)) := + continuous_iff_continuousAt.mpr fun t => (hasDerivAt_exp_smul_const' L t).continuousAt + have hh := hc.clm_apply (continuous_const (y := haarPolynomialCoordinates N d p)) + simpa only [haarPolynomialCoordinates_heat] using hh + +lemma continuous_haarPolynomialHeat_value {N d : ℕ} (p : haarPolynomialSpace N d) : + Continuous (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue + ((haarPolynomialHeat N d z.1 p : haarPolynomialSpace N d) : MatrixPolynomial N) z.2) := by + have hc := continuous_haarPolynomialHeat_coordinates p + have hs : Continuous (fun z : ℝ × SpecialOrthogonal N => + ∑ i, haarPolynomialCoordinates N d (haarPolynomialHeat N d z.1 p) i* + haarPolynomialValue (haarPolynomialBasis N d i) z.2) := by + apply continuous_finsetSum + intro i _ + exact (((continuous_apply i).comp hc).comp continuous_fst).mul + ((continuous_haarPolynomialValue _).comp continuous_snd) + convert hs using 1 + funext z + exact haarPolynomialEval_eq_coordinates _ _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatEntropy.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfe348c29a5b881c371b81e4e0ac7bd0cd8a4b9b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatEntropy.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Haar.HaarLogIntegration +import OAI.Probability.InvariantIsing.Haar.HaarHeatLogGradient +import OAI.Probability.InvariantIsing.Haar.HaarHeatTestLimit + +namespace OAI + +/-! Entropy dissipation along the actual positive polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +def haarHeatEntropy {N d : ℕ} (μ : Measure (SpecialOrthogonal N)) + (p : haarPolynomialSpace N d) (t : ℝ) : ℝ := + ∫ U, haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U* + Real.log (haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U) ∂μ + +theorem haarHeatEntropy_hasDerivAt {N d : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (p : haarPolynomialSpace N d) + (ε : ℝ) (hε : 0 < ε) + (hp : ∀ U : SpecialOrthogonal N, ε ≤ haarPolynomialValue (p : MatrixPolynomial N) U) + {t : ℝ} (ht : 0 < t) : + HasDerivAt (haarHeatEntropy μ p) + (-(∫ U, haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)) U/ + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U ∂μ)) t := by + let q (s : ℝ) : MatrixPolynomial N := (haarPolynomialHeat N d s p : haarPolynomialSpace N d) + let u (s : ℝ) (U : SpecialOrthogonal N) := haarPolynomialValue (q s) U + let L (s : ℝ) (U : SpecialOrthogonal N) := haarPolynomialValue (haarPolynomialLaplacian N (q s)) U + let F' (s : ℝ) (U : SpecialOrthogonal N) := L s U*(Real.log (u s U)+1) + obtain ⟨P,hP⟩ := haarPolynomialValue_bound (p : MatrixPolynomial N) + have hpos (s : ℝ) (hs : 0 ≤ s) (U : SpecialOrthogonal N) : 0 < u s U := + hε.trans_le ((haarPolynomialHeat_bounds p ε P hp (fun V => (le_abs_self _).trans (hP V)) hs U).1) + have hcont : ContinuousOn (fun z : ℝ × SpecialOrthogonal N => F' z.1 z.2) + (Icc (t/2) (t+1) ×ˢ (Set.univ : Set (SpecialOrthogonal N))) := by + apply ((continuous_haarPolynomialHeat_operator_value (haarPolynomialLaplacian N) p).continuousOn).mul + apply ContinuousOn.add _ continuousOn_const + apply (continuous_haarPolynomialHeat_value p).continuousOn.log + intro z hz + exact (hpos z.1 (by linarith [hz.1.1]) z.2).ne' + obtain ⟨B,hB⟩ := (isCompact_Icc.prod (isCompact_univ : IsCompact (Set.univ : Set (SpecialOrthogonal N)))).exists_bound_of_continuousOn hcont + have hnb : Ioo (t/2) (t+1) ∈ 𝓝 t := Ioo_mem_nhds (by linarith) (by linarith) + have hlog : Continuous (fun U : SpecialOrthogonal N => Real.log (u t U)) := + (continuous_haarPolynomialValue _).log (fun U => (hpos t ht.le U).ne') + have hdi : HasDerivAt (haarHeatEntropy μ p) (∫ U, F' t U ∂μ) t := by + apply (hasDerivAt_integral_of_dominated_loc_of_deriv_le (μ := μ) + (s := Ioo (t/2) (t+1)) (F' := F') (bound := fun _ => B) hnb + (Eventually.of_forall fun s => (Real.continuous_mul_log.comp (continuous_haarPolynomialValue (q s))).measurable.aestronglyMeasurable) + (continuous_haar_integrable μ _ (Real.continuous_mul_log.comp (continuous_haarPolynomialValue (q t)))) + (((continuous_haarPolynomialValue _).mul (hlog.add continuous_const)).measurable.aestronglyMeasurable) + (ae_of_all μ fun U s hs => hB (s,U) ⟨⟨hs.1.le,hs.2.le⟩,mem_univ U⟩) + (integrable_const B) ?_).2 + apply ae_of_all + intro U s hs + have hu := haarPolynomialHeat_hasDerivAt p (U : Matrix (Fin N) (Fin N) ℝ) s + have hh := (Real.hasDerivAt_mul_log (hpos s (by linarith [hs.1]) U).ne').comp s hu + convert hh using 1 + · rfl + · dsimp only [F',L,u,haarPolynomialValue,q] + ring + apply hdi.congr_deriv + have hmul (U : SpecialOrthogonal N) : F' t U = L t U*Real.log (u t U)+L t U := by + dsimp only [F'] + ring + simp_rw [hmul] + have hi1 : Integrable (fun U => L t U*Real.log (u t U)) μ := + continuous_haar_integrable μ _ ((continuous_haarPolynomialValue _).mul hlog) + have hi2 : Integrable (L t) μ := haarPolynomialValue_integrable _ μ + rw [integral_add hi1 hi2] + rw [integral_haar_laplacian_log μ (q t) (hpos t ht.le)] + change _+haarPolynomialMean μ (haarPolynomialLaplacian N (q t)) = _ + rw [haarPolynomialMean_laplacian,add_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatFisherBound.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatFisherBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..4cb0a677f26b4bc9442e0b2d4fe40ad6df7aeb1c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatFisherBound.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatEntropy + +namespace OAI + +/-! Integrated logarithmic-gradient control for a positive heat orbit. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +namespace InvariantIsing + +theorem haarHeat_fisher_bound {N d : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (p : haarPolynomialSpace N d) + (ε C : ℝ) (hε : 0 < ε) + (hp : ∀ U : SpecialOrthogonal N, ε ≤ haarPolynomialValue (p : MatrixPolynomial N) U) + (hC : ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialGamma (p : MatrixPolynomial N) p) U ≤ + C*(haarPolynomialValue (p : MatrixPolynomial N) U)^2) + {t : ℝ} (ht : 0 ≤ t) : + (∫ U, haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)) U/ + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U ∂μ) ≤ + C*Real.exp (-2*((N:ℝ)-2)*t)*(∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ) := by + let q : MatrixPolynomial N := (haarPolynomialHeat N d t p : haarPolynomialSpace N d) + let a := C*Real.exp (-2*((N:ℝ)-2)*t) + obtain ⟨P,hP⟩ := haarPolynomialValue_bound (p : MatrixPolynomial N) + have hpos (U : SpecialOrthogonal N) : 0 < haarPolynomialValue q U := + hε.trans_le ((haarPolynomialHeat_bounds p ε P hp (fun V => (le_abs_self _).trans (hP V)) ht U).1) + have hiG : Integrable (fun U => haarPolynomialValue (haarPolynomialGamma q q) U/ + haarPolynomialValue q U) μ := continuous_haar_integrable μ _ + ((continuous_haarPolynomialValue _).div (continuous_haarPolynomialValue _) (fun U => (hpos U).ne')) + have hiu : Integrable (fun U => a*haarPolynomialValue q U) μ := + (haarPolynomialValue_integrable q μ).const_mul a + have hb : (∫ U, haarPolynomialValue (haarPolynomialGamma q q) U/haarPolynomialValue q U ∂μ) ≤ + ∫ U, a*haarPolynomialValue q U ∂μ := by + apply integral_mono hiG hiu + intro U + apply (div_le_iff₀ (hpos U)).mpr + have hh := haarPolynomialHeat_log_gradient_bound p ε C hε hp hC ht U + change haarPolynomialValue (haarPolynomialGamma q q) U ≤ a*(haarPolynomialValue q U)^2 at hh + nlinarith [hh] + rw [integral_const_mul,haarPolynomialHeat_mean] at hb + exact hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatGammaDerivative.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatGammaDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f73402f5b097078a02e7e603fb6aae2c87ee808 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatGammaDerivative.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatLinear +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialGamma + +namespace OAI + +/-! Time differentiation of the squared gradient along the actual polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma haarPolynomialHeat_direction_hasDerivAt {N d : ℕ} + (p : haarPolynomialSpace N d) (A M : Matrix (Fin N) (Fin N) ℝ) (t : ℝ) : + HasDerivAt (fun s => matrixPolynomialEval M (matrixPolynomialDerivation A + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N))) + (matrixPolynomialEval M (matrixPolynomialDerivation A (haarPolynomialLaplacian N + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)))) t := + haarPolynomialHeat_linear_hasDerivAt + ((matrixPolynomialEval M).toLinearMap.comp (matrixPolynomialDerivation A).toLinearMap) p t + +lemma haarPolynomialHeat_gamma_hasDerivAt {N d : ℕ} + (p : haarPolynomialSpace N d) (M : Matrix (Fin N) (Fin N) ℝ) (t : ℝ) : + HasDerivAt (fun s => matrixPolynomialEval M (haarPolynomialGamma + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N))) + (2*matrixPolynomialEval M (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + (haarPolynomialLaplacian N + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)))) t := by + have hd (i j : Fin N) := (haarPolynomialHeat_direction_hasDerivAt p (planeGenerator i j) M t).pow 2 + have hs := HasDerivAt.fun_sum (u := Finset.univ) fun i _ => + HasDerivAt.fun_sum (u := Finset.univ) fun j _ => hd i j + convert hs using 1 + · funext s + simp only [haarPolynomialGamma,map_sum,map_mul,pow_two] + rfl + · simp only [haarPolynomialGamma,map_sum,map_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + simp only [Nat.cast_ofNat] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatGradient.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..77d59c04f48b730043cc534cc582c56fd918c06f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatGradient.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatGammaDerivative +import OAI.Probability.InvariantIsing.Haar.HaarHeatOperator +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialEvolution +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialCurvature +import OAI.Probability.InvariantIsing.Haar.HaarHeatConstants + +namespace OAI + +/-! Exponential squared-gradient decay for the actual orthogonal polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial Set +namespace InvariantIsing + +theorem haarPolynomialHeat_gradient_bound {N d : ℕ} + (p : haarPolynomialSpace N d) (C : ℝ) + (hC : ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialGamma (p : MatrixPolynomial N) p) U ≤ C) + {t : ℝ} (ht : 0 ≤ t) (U : SpecialOrthogonal N) : + Real.exp (2*((N : ℝ)-2)*t)*haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)) U ≤ C := by + let u (s : ℝ) : MatrixPolynomial N := (haarPolynomialHeat N d s p : haarPolynomialSpace N d) + let g (s : ℝ) := haarPolynomialGamma (u s) (u s) + let k : ℝ := 2*((N : ℝ)-2) + let q (s : ℝ) : MatrixPolynomial N := C • 1-Real.exp (k*s) • g s + let dq (s : ℝ) (V : SpecialOrthogonal N) := + -Real.exp (k*s)*(k*haarPolynomialValue (g s) V+ + 2*haarPolynomialValue (haarPolynomialGamma (u s) (haarPolynomialLaplacian N (u s))) V) + have heval (s : ℝ) (V : SpecialOrthogonal N) : + haarPolynomialValue (q s) V = C-Real.exp (k*s)*haarPolynomialValue (g s) V := by + change matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) (_-_) = _ + simp only [map_sub,map_smul,map_one,smul_eq_mul,mul_one,haarPolynomialValue] + have hL (s : ℝ) (V : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialLaplacian N (q s)) V = + -Real.exp (k*s)*haarPolynomialValue (haarPolynomialLaplacian N (g s)) V := by + change matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) + (haarPolynomialLaplacian N (C • 1-Real.exp (k*s) • g s)) = _ + rw [map_sub,map_smul,map_smul,haarPolynomialLaplacian_one,smul_zero,zero_sub, + map_neg,map_smul,smul_eq_mul] + simp only [haarPolynomialValue,neg_mul] + have hc : Continuous (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue (q z.1) z.2) := by + simp_rw [heval] + exact continuous_const.sub + ((Real.continuous_exp.comp (continuous_const.mul continuous_fst)).mul + (continuous_haarPolynomialHeat_gamma p)) + have hi : ∀ V : SpecialOrthogonal N, 0 ≤ haarPolynomialValue (q 0) V := by + intro V + rw [heval] + simpa only [g,u,haarPolynomialHeat_zero,mul_zero,Real.exp_zero,one_mul] using + sub_nonneg.mpr (hC V) + have hd (s : ℝ) (_ : s ∈ Ioc (0 : ℝ) t) (V : SpecialOrthogonal N) : + HasDerivAt (fun r => haarPolynomialValue (q r) V) (dq s V) s := by + have he : HasDerivAt (fun r => Real.exp (k*r)) (k*Real.exp (k*s)) s := by + convert ((hasDerivAt_id s).const_mul k).exp using 1 + all_goals simp only [id_eq] + all_goals ring + have hg := haarPolynomialHeat_gamma_hasDerivAt p (V : Matrix (Fin N) (Fin N) ℝ) s + convert (hasDerivAt_const s C).sub (he.mul hg) using 1 + · funext r + exact heval r V + · dsimp only [dq,haarPolynomialValue,g,u] + ring + have hpde (s : ℝ) (_ : s ∈ Ioc (0 : ℝ) t) (V : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialLaplacian N (q s)) V ≤ dq s V := by + have hb := matrixPolynomial_curvature (u s) (V : Matrix (Fin N) (Fin N) ℝ) + have hh : k*haarPolynomialValue (g s) V+ + 2*haarPolynomialValue (haarPolynomialGamma (u s) (haarPolynomialLaplacian N (u s))) V ≤ + haarPolynomialValue (haarPolynomialLaplacian N (g s)) V := by + dsimp only [k,g,haarPolynomialValue] + linarith + rw [hL] + dsimp only [dq] + nlinarith [mul_le_mul_of_nonneg_left hh (Real.exp_pos (k*s)).le] + have hz := haarPolynomial_evolution_nonneg ht q dq hc.continuousOn hi hd hpde t ⟨ht,le_rfl⟩ U + rw [heval] at hz + exact sub_nonneg.mp hz + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLinear.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a4d11ccdff402ec04423cd1cb9f22e2eb20c367 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLinear.lean @@ -0,0 +1,47 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialHeat + +namespace OAI + +/-! Differentiating linear observables of the finite polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial +namespace InvariantIsing + +def haarPolynomialLinearCoordinates {N d : ℕ} (F : MatrixPolynomial N →ₗ[ℝ] ℝ) : + HaarPolynomialCoordinates N d →L[ℝ] ℝ := + (F.comp ((haarPolynomialSpace N d).subtype.comp + (haarPolynomialCoordinates N d).symm.toLinearMap)).toContinuousLinearMap + +lemma haarPolynomialLinearCoordinates_apply {N d : ℕ} + (F : MatrixPolynomial N →ₗ[ℝ] ℝ) (p : haarPolynomialSpace N d) : + haarPolynomialLinearCoordinates F (haarPolynomialCoordinates N d p) = F (p : MatrixPolynomial N) := by + change F (((haarPolynomialCoordinates N d).symm (haarPolynomialCoordinates N d p) : + haarPolynomialSpace N d) : MatrixPolynomial N) = _ + rw [LinearEquiv.symm_apply_apply] + +lemma haarPolynomialHeat_linear_hasDerivAt {N d : ℕ} + (F : MatrixPolynomial N →ₗ[ℝ] ℝ) (p : haarPolynomialSpace N d) (t : ℝ) : + HasDerivAt (fun s => F ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N)) + (F (haarPolynomialLaplacian N + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N))) t := by + let L := haarPolynomialCoordinateLaplacian N d + let v := haarPolynomialCoordinates N d p + let ev := (haarPolynomialLinearCoordinates F).comp + (ContinuousLinearMap.apply ℝ (HaarPolynomialCoordinates N d) v) + have h := ev.hasFDerivAt.comp_hasDerivAt t (hasDerivAt_exp_smul_const' L t) + change HasDerivAt (fun s => ev (NormedSpace.exp (s • L))) + (ev (L*NormedSpace.exp (t • L))) t at h + have he (s : ℝ) : ev (NormedSpace.exp (s • L)) = + F ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N) := rfl + simp_rw [he] at h + convert h using 1 + change F _ = haarPolynomialLinearCoordinates F (L (NormedSpace.exp (t • L) v)) + rw [← haarPolynomialCoordinates_heat,haarPolynomialCoordinateLaplacian_apply] + exact (haarPolynomialLinearCoordinates_apply F (haarPolynomialRestrictedLaplacian N d + (haarPolynomialHeat N d t p))).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLogBarrier.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLogBarrier.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c1c85be66d973931af05670672ed762292941bf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLogBarrier.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Haar.HaarLogBarrier +import OAI.Probability.InvariantIsing.Haar.HaarHeatOperator +import OAI.Probability.InvariantIsing.Haar.HaarHeatGammaDerivative + +namespace OAI + +/-! Time differentiation and continuity of the logarithmic gradient barrier. -/ +noncomputable section +open Matrix MvPolynomial +namespace InvariantIsing + +def haarHeatLogBarrier {N d : ℕ} (p : haarPolynomialSpace N d) (C t : ℝ) : MatrixPolynomial N := + haarLogBarrier ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + (C*Real.exp (-2*((N:ℝ)-2)*t)) + +lemma continuous_haarHeatLogBarrier {N d : ℕ} (p : haarPolynomialSpace N d) (C : ℝ) : + Continuous (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue (haarHeatLogBarrier p C z.1) z.2) := by + have he (t : ℝ) (U : SpecialOrthogonal N) : haarPolynomialValue (haarHeatLogBarrier p C t) U = + C*Real.exp (-2*((N:ℝ)-2)*t)* + (haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U)^2- + haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)) U := + haarLogBarrier_eval _ _ _ + simp_rw [he] + exact ((continuous_const.mul (Real.continuous_exp.comp (continuous_const.mul continuous_fst))).mul + ((continuous_haarPolynomialHeat_value p).pow 2)).sub (continuous_haarPolynomialHeat_gamma p) + +lemma haarHeatLogBarrier_hasDerivAt {N d : ℕ} (p : haarPolynomialSpace N d) + (C t : ℝ) (U : SpecialOrthogonal N) : + HasDerivAt (fun s => haarPolynomialValue (haarHeatLogBarrier p C s) U) + (let q : MatrixPolynomial N := (haarPolynomialHeat N d t p : haarPolynomialSpace N d); + let a := C*Real.exp (-2*((N:ℝ)-2)*t); + -2*((N:ℝ)-2)*a*(haarPolynomialValue q U)^2+ + 2*a*haarPolynomialValue q U*haarPolynomialValue (haarPolynomialLaplacian N q) U- + 2*haarPolynomialValue (haarPolynomialGamma q (haarPolynomialLaplacian N q)) U) t := by + have ha : HasDerivAt (fun s => C*Real.exp (-2*((N:ℝ)-2)*s)) + (-2*((N:ℝ)-2)*(C*Real.exp (-2*((N:ℝ)-2)*t))) t := by + convert (((hasDerivAt_id t).const_mul (-2*((N:ℝ)-2))).exp).const_mul C using 1 + all_goals simp only [id_eq] + all_goals ring + have hu := haarPolynomialHeat_hasDerivAt p (U : Matrix (Fin N) (Fin N) ℝ) t + have hg := haarPolynomialHeat_gamma_hasDerivAt p (U : Matrix (Fin N) (Fin N) ℝ) t + convert (ha.mul (hu.pow 2)).sub hg using 1 + · funext s + exact haarLogBarrier_eval _ _ _ + · dsimp only [haarPolynomialValue] + simp only [Nat.cast_ofNat,Pi.pow_apply] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLogGradient.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLogGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8ffa98deb575d675f49120b8afc40bb46c8b784 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatLogGradient.lean @@ -0,0 +1,96 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatLogBarrier +import OAI.Probability.InvariantIsing.Haar.HaarHeatOrder +import OAI.Probability.InvariantIsing.Haar.CompactNegativeMinimum + +namespace OAI + +/-! Exponential decay of the logarithmic gradient of a positive polynomial heat orbit. -/ +noncomputable section +open Matrix MvPolynomial Set +namespace InvariantIsing + +theorem haarPolynomialHeat_log_gradient_bound {N d : ℕ} (p : haarPolynomialSpace N d) + (ε C : ℝ) (hε : 0 < ε) + (hp : ∀ U : SpecialOrthogonal N, ε ≤ haarPolynomialValue (p : MatrixPolynomial N) U) + (hC : ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialGamma (p : MatrixPolynomial N) p) U ≤ + C*(haarPolynomialValue (p : MatrixPolynomial N) U)^2) + {T : ℝ} (hT : 0 ≤ T) (U : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d T p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d T p : haarPolynomialSpace N d) : MatrixPolynomial N)) U ≤ + C*Real.exp (-2*((N:ℝ)-2)*T)* + (haarPolynomialValue ((haarPolynomialHeat N d T p : haarPolynomialSpace N d) : MatrixPolynomial N) U)^2 := by + let q (s : ℝ) : MatrixPolynomial N := (haarPolynomialHeat N d s p : haarPolynomialSpace N d) + let a (s : ℝ) := C*Real.exp (-2*((N:ℝ)-2)*s) + let H (s : ℝ) (V : SpecialOrthogonal N) := haarPolynomialValue (haarHeatLogBarrier p C s) V + let G (s : ℝ) (V : SpecialOrthogonal N) := haarPolynomialValue (haarPolynomialGamma (q s) (q s)) V + obtain ⟨P,hP⟩ := haarPolynomialValue_bound (p : MatrixPolynomial N) + have hlow (s : ℝ) (hs : 0 ≤ s) (V : SpecialOrthogonal N) : ε ≤ haarPolynomialValue (q s) V := + (haarPolynomialHeat_bounds p ε P hp (fun W => (le_abs_self _).trans (hP W)) hs V).1 + obtain ⟨B,hB⟩ := (isCompact_Icc.prod (isCompact_univ : IsCompact (Set.univ : Set (SpecialOrthogonal N)))).exists_bound_of_continuousOn + (continuous_haarPolynomialHeat_gamma p).continuousOn + have hB0 : 0 ≤ B := (norm_nonneg _).trans (hB (0,1) ⟨⟨le_rfl,hT⟩,mem_univ _⟩) + have hGB (s : ℝ) (hs : s ∈ Icc (0:ℝ) T) (V : SpecialOrthogonal N) : G s V ≤ B := + (le_abs_self _).trans (hB (s,V) ⟨hs,mem_univ _⟩) + let A := 2*|((N:ℝ)-2)|+2*B/ε^2+1 + let W (s : ℝ) (V : SpecialOrthogonal N) := Real.exp (-A*s)*H s V + let D (s : ℝ) (V : SpecialOrthogonal N) := + -2*((N:ℝ)-2)*a s*(haarPolynomialValue (q s) V)^2+ + 2*a s*haarPolynomialValue (q s) V*haarPolynomialValue (haarPolynomialLaplacian N (q s)) V- + 2*haarPolynomialValue (haarPolynomialGamma (q s) (haarPolynomialLaplacian N (q s))) V + let Wt (z : ℝ × SpecialOrthogonal N) := Real.exp (-A*z.1)*(D z.1 z.2-A*H z.1 z.2) + have hc : Continuous (fun z : ℝ × SpecialOrthogonal N => W z.1 z.2) := + (Real.continuous_exp.comp (continuous_const.mul continuous_fst)).mul + (continuous_haarHeatLogBarrier p C) + have hi (V : SpecialOrthogonal N) : 0 ≤ W 0 V := by + simp only [W,H,haarHeatLogBarrier,haarPolynomialHeat_zero,mul_zero,Real.exp_zero,mul_one,one_mul] + change 0 ≤ matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) (haarLogBarrier p C) + rw [haarLogBarrier_eval] + exact sub_nonneg.mpr (hC V) + have hd (s : ℝ) (_ : s ∈ Ioc (0:ℝ) T) (V : SpecialOrthogonal N) : + HasDerivAt (fun r => W r V) (Wt (s,V)) s := by + have he : HasDerivAt (fun r => Real.exp (-A*r)) (-A*Real.exp (-A*s)) s := by + convert ((hasDerivAt_id s).const_mul (-A)).exp using 1 + all_goals simp only [id_eq,mul_one] + all_goals ring + have hh := haarHeatLogBarrier_hasDerivAt p C s V + convert he.mul hh using 1 + all_goals dsimp only [Wt,D,H,q,a] + all_goals ring + have hmin (s : ℝ) (hs : s ∈ Ioc (0:ℝ) T) (V : SpecialOrthogonal N) + (hneg : W s V < 0) (hm : ∀ Z, W s V ≤ W s Z) : 0 < Wt (s,V) := by + have hHneg : H s V < 0 := by + have he := Real.exp_pos (-A*s) + dsimp only [W] at hneg + nlinarith + have hHmin (Z : SpecialOrthogonal N) : H s V ≤ H s Z := + (mul_le_mul_iff_right₀ (Real.exp_pos (-A*s))).mp (hm Z) + have hu : 0 < haarPolynomialValue (q s) V := hε.trans_le (hlow s hs.1.le V) + have hD : (-2*((N:ℝ)-2)+2*G s V/(haarPolynomialValue (q s) V)^2)*H s V ≤ D s V := + haarLogBarrier_min_derivative_lower (q s) (a s) V hu.ne' hHmin + have hw : G s V/(haarPolynomialValue (q s) V)^2 ≤ B/ε^2 := by + calc + _ ≤ B/(haarPolynomialValue (q s) V)^2 := + div_le_div_of_nonneg_right (hGB s ⟨hs.1.le,hs.2⟩ V) (sq_nonneg _) + _ ≤ B/ε^2 := div_le_div_of_nonneg_left hB0 (sq_pos_of_pos hε) + ((sq_le_sq₀ hε.le hu.le).mpr (hlow s hs.1.le V)) + have hcoef : -2*((N:ℝ)-2)+2*G s V/(haarPolynomialValue (q s) V)^2 ≤ A-1 := by + dsimp only [A] + linear_combination 2*hw+2*(neg_le_abs ((N:ℝ)-2)) + have hmulf := mul_le_mul_of_nonpos_right hcoef hHneg.le + have hstrict : 0 < D s V-A*H s V := by nlinarith + exact mul_pos (Real.exp_pos (-A*s)) hstrict + have hz := compact_nonneg_of_negative_min_derivative hT W Wt hc.continuousOn hi hd hmin + T ⟨hT,le_rfl⟩ U + have hH : 0 ≤ H T U := (mul_nonneg_iff_of_pos_left (Real.exp_pos (-A*T))).mp hz + change 0 ≤ matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) + (haarLogBarrier (q T) (a T)) at hH + rw [haarLogBarrier_eval] at hH + exact sub_nonneg.mp hH + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatMean.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ea0c0f82711fcd3efa11bcb40ae55a6a0bfc051 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatMean.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatLinear + +namespace OAI + +/-! Exact preservation of Haar means by the polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +open scoped BigOperators +namespace InvariantIsing + +def haarPolynomialMean {N : ℕ} (μ : Measure (SpecialOrthogonal N)) [IsFiniteMeasure μ] : + MatrixPolynomial N →ₗ[ℝ] ℝ where + toFun p := ∫ U, haarPolynomialValue p U ∂μ + map_add' p q := by + change (∫ U, matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) (p+q) ∂μ) = _ + simp only [map_add] + exact integral_add (haarPolynomialValue_integrable p μ) (haarPolynomialValue_integrable q μ) + map_smul' c p := by + change (∫ U, matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) (c • p) ∂μ) = _ + simp only [map_smul] + exact integral_smul c _ + +lemma haarPolynomialMean_laplacian {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (p : MatrixPolynomial N) : + haarPolynomialMean μ (haarPolynomialLaplacian N p) = 0 := by + rw [haarPolynomialLaplacian_apply,map_sum] + apply Finset.sum_eq_zero + intro i _ + rw [map_sum] + apply Finset.sum_eq_zero + intro j _ + exact integral_haarPolynomialDerivation μ (matrixPolynomialDerivation (planeGenerator i j) p) i j + +theorem haarPolynomialHeat_mean {N d : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (p : haarPolynomialSpace N d) (t : ℝ) : + (∫ U, haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U ∂μ) = + ∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ := by + let f (s : ℝ) := haarPolynomialMean μ + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N) + have hd (s : ℝ) : HasDerivAt f 0 s := by + have h := haarPolynomialHeat_linear_hasDerivAt (haarPolynomialMean μ) p s + rw [haarPolynomialMean_laplacian] at h + exact h + have he : f t=f 0 := is_const_of_deriv_eq_zero + (fun s => (hd s).differentiableAt) (fun s => (hd s).deriv) t 0 + change haarPolynomialMean μ _ = haarPolynomialMean μ _ + simpa only [f,haarPolynomialHeat_zero] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatMixing.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatMixing.lean new file mode 100644 index 0000000000000000000000000000000000000000..0af35e1e7853a230f7b9eb1003d1c568514951bf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatMixing.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatOscillation +import OAI.Probability.InvariantIsing.Haar.HaarHeatMean +import OAI.Probability.InvariantIsing.Haar.HaarHeatOrder + +namespace OAI + +/-! Convergence of the actual orthogonal polynomial heat flow to its Haar mean. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter +open scoped Topology +namespace InvariantIsing + +theorem haarPolynomialHeat_tendsto_mean {N d : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : haarPolynomialSpace N d) (U : SpecialOrthogonal N) : + Tendsto (fun t : ℝ => haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U) + atTop (𝓝 (∫ V, haarPolynomialValue (p : MatrixPolynomial N) V ∂μ)) := by + let u (t : ℝ) (V : SpecialOrthogonal N) := haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) V + obtain ⟨B,hB⟩ := haarPolynomialValue_bound (p : MatrixPolynomial N) + have hub (t : ℝ) (ht : 0 ≤ t) (V : SpecialOrthogonal N) : |u t V| ≤ B := by + apply abs_le.mpr + apply haarPolynomialHeat_bounds p (-B) B + · intro W + exact (abs_le.mp (hB W)).1 + · intro W + exact (abs_le.mp (hB W)).2 + · exact ht + have hlim : Tendsto (fun t : ℝ => ∫ V, u t V-u t U ∂μ) atTop (𝓝 0) := by + have h := tendsto_integral_filter_of_dominated_convergence + (μ := μ) (l := atTop) (F := fun t V => u t V-u t U) (f := fun _ => (0:ℝ)) (fun _ => 2*B) + simp only [integral_zero] at h + apply h + · exact Eventually.of_forall fun t => + ((continuous_haarPolynomialValue _).sub continuous_const).measurable.aestronglyMeasurable + · filter_upwards [eventually_ge_atTop (0:ℝ)] with t ht + exact ae_of_all μ fun V => by + rw [Real.norm_eq_abs] + exact (abs_sub _ _).trans (by linarith [hub t ht V,hub t ht U]) + · exact integrable_const _ + · exact ae_of_all μ fun V => haarPolynomialHeat_difference_tendsto hN p V U + have he (t : ℝ) : (∫ V, u t V-u t U ∂μ) = + (∫ V, haarPolynomialValue (p : MatrixPolynomial N) V ∂μ)-u t U := by + rw [integral_sub (haarPolynomialValue_integrable _ μ) (integrable_const _), + integral_const,probReal_univ,smul_eq_mul,one_mul] + rw [haarPolynomialHeat_mean] + simp_rw [he] at hlim + have hh : Tendsto (fun t : ℝ => (∫ V, haarPolynomialValue (p : MatrixPolynomial N) V ∂μ)- + ((∫ V, haarPolynomialValue (p : MatrixPolynomial N) V ∂μ)-u t U)) atTop + (𝓝 ((∫ V, haarPolynomialValue (p : MatrixPolynomial N) V ∂μ)-0)) := + tendsto_const_nhds.sub hlim + simpa only [sub_sub_cancel,sub_zero] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOperator.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..e349eb06fa4481c236d8e071370f60024253d0a0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOperator.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatContinuity +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialGamma + +namespace OAI + +/-! Joint continuity of differentiated heat polynomials and their squared gradient. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma haarPolynomialOperator_eval_coordinates {N d : ℕ} + (A : Module.End ℝ (MatrixPolynomial N)) (p : haarPolynomialSpace N d) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (A (p : MatrixPolynomial N)) = + ∑ i, haarPolynomialCoordinates N d p i* + matrixPolynomialEval M (A (haarPolynomialBasis N d i)) := by + have hp : p = ∑ i, haarPolynomialCoordinates N d p i • + (Module.finBasis ℝ (haarPolynomialSpace N d)) i := by + simpa only [haarPolynomialCoordinates,LinearEquiv.symm_apply_apply] using + (Module.finBasis ℝ (haarPolynomialSpace N d)).equivFun_symm_apply + (haarPolynomialCoordinates N d p) + conv_lhs => rw [hp] + simp only [Submodule.coe_sum,Submodule.coe_smul,map_sum,map_smul,smul_eq_mul, + haarPolynomialBasis] + +lemma continuous_haarPolynomialHeat_operator_value {N d : ℕ} + (A : Module.End ℝ (MatrixPolynomial N)) (p : haarPolynomialSpace N d) : + Continuous (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue + (A ((haarPolynomialHeat N d z.1 p : haarPolynomialSpace N d) : MatrixPolynomial N)) z.2) := by + have hc := continuous_haarPolynomialHeat_coordinates p + have hs : Continuous (fun z : ℝ × SpecialOrthogonal N => + ∑ i, haarPolynomialCoordinates N d (haarPolynomialHeat N d z.1 p) i* + haarPolynomialValue (A (haarPolynomialBasis N d i)) z.2) := by + apply continuous_finsetSum + intro i _ + exact (((continuous_apply i).comp hc).comp continuous_fst).mul + ((continuous_haarPolynomialValue _).comp continuous_snd) + convert hs using 1 + funext z + exact haarPolynomialOperator_eval_coordinates _ _ _ + +lemma continuous_haarPolynomialHeat_gamma {N d : ℕ} (p : haarPolynomialSpace N d) : + Continuous (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue + (haarPolynomialGamma + ((haarPolynomialHeat N d z.1 p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d z.1 p : haarPolynomialSpace N d) : MatrixPolynomial N)) z.2) := by + have hs : Continuous (fun z : ℝ × SpecialOrthogonal N => + ∑ i : Fin N, ∑ j : Fin N, + (haarPolynomialValue (matrixPolynomialDerivation (planeGenerator i j) + ((haarPolynomialHeat N d z.1 p : haarPolynomialSpace N d) : MatrixPolynomial N)) z.2)^2) := by + apply continuous_finsetSum + intro i _ + apply continuous_finsetSum + intro j _ + exact (continuous_haarPolynomialHeat_operator_value + (matrixPolynomialDerivation (planeGenerator i j)).toLinearMap p).pow 2 + convert hs using 1 + funext z + simp only [haarPolynomialValue,haarPolynomialGamma,map_sum,map_mul,pow_two] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOrder.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9f6ec37582aa0477145d33036ff64f560798c8b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOrder.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatConstants + +namespace OAI + +/-! Uniform order bounds for the polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial Set +namespace InvariantIsing + +theorem haarPolynomialHeat_bounds {N d : ℕ} (p : haarPolynomialSpace N d) + (a b : ℝ) + (ha : ∀ U : SpecialOrthogonal N, a ≤ haarPolynomialValue (p : MatrixPolynomial N) U) + (hb : ∀ U : SpecialOrthogonal N, haarPolynomialValue (p : MatrixPolynomial N) U ≤ b) + {t : ℝ} (ht : 0 ≤ t) (U : SpecialOrthogonal N) : + haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U ∈ Icc a b := by + let onep : haarPolynomialSpace N d := ⟨1,one_mem_haarPolynomialSpace N d⟩ + have h1 : haarPolynomialHeat N d t onep = onep := haarPolynomialHeat_one N d t + have hscalar (c : ℝ) (V : SpecialOrthogonal N) : + matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) + ((c • onep : haarPolynomialSpace N d) : MatrixPolynomial N) = c := by + change matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) + (c • (1 : MatrixPolynomial N)) = c + rw [map_smul,map_one] + exact mul_one c + have hl : ∀ V : SpecialOrthogonal N, + 0 ≤ haarPolynomialValue ((p-a • onep : haarPolynomialSpace N d) : MatrixPolynomial N) V := by + intro V + change 0 ≤ matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) (_-_) + rw [map_sub,hscalar] + exact sub_nonneg.mpr (ha V) + have hu : ∀ V : SpecialOrthogonal N, + 0 ≤ haarPolynomialValue ((b • onep-p : haarPolynomialSpace N d) : MatrixPolynomial N) V := by + intro V + change 0 ≤ matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) (_-_) + rw [map_sub,hscalar] + exact sub_nonneg.mpr (hb V) + have hlow := haarPolynomialHeat_nonneg (p-a • onep) hl ht U + have hupp := haarPolynomialHeat_nonneg (b • onep-p) hu ht U + rw [map_sub,map_smul,h1] at hlow hupp + change 0 ≤ matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) (_-_) at hlow hupp + rw [map_sub,hscalar] at hlow hupp + exact ⟨sub_nonneg.mp hlow,sub_nonneg.mp hupp⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOscillation.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOscillation.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd25e2c67cb2d2fbbc964edf601a3a8e10af2888 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatOscillation.lean @@ -0,0 +1,39 @@ +import OAI.Probability.InvariantIsing.Haar.HaarReflectionConnectivity +import OAI.Probability.InvariantIsing.Haar.HaarHeatVanishingGradient + +namespace OAI + +/-! Pointwise decay of spatial oscillations under the actual polynomial heat flow. -/ +noncomputable section +open Matrix MvPolynomial Filter +open scoped Topology +namespace InvariantIsing + +theorem haarPolynomialHeat_difference_tendsto {N d : ℕ} (hN : 3 ≤ N) + (p : haarPolynomialSpace N d) (U V : SpecialOrthogonal N) : + Tendsto (fun t : ℝ => + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U- + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) V) + atTop (𝓝 0) := by + obtain ⟨M,hM,hgrad⟩ := haarPolynomialHeat_gradient_envelope p + have hpoint (W : SpecialOrthogonal N) : Tendsto (fun t : ℝ => + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) W- + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) 1) + atTop (𝓝 0) := by + obtain ⟨K,_,hK⟩ := haarPolynomial_global_oscillation_bound W + apply squeeze_zero_norm' _ (by simpa only [mul_zero] using + (tendsto_haar_gradient_envelope hN M).const_mul K) + filter_upwards [eventually_ge_atTop (0:ℝ)] with t ht + rw [Real.norm_eq_abs] + exact hK _ _ (mul_nonneg hM (Real.exp_pos _).le) (hgrad t ht) + have hh := (hpoint U).sub (hpoint V) + convert hh using 1 + · funext t + ring + · norm_num + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatPositivity.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatPositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..549dc1d2622026f0872ba4fc004ba6739e1941e0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatPositivity.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatContinuity +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMinimum + +namespace OAI + +/-! Positivity of the actual finite polynomial heat flow, by compact comparison. -/ +noncomputable section +open Matrix MvPolynomial Set +open scoped BigOperators +namespace InvariantIsing + +theorem haarPolynomialHeat_nonneg {N d : ℕ} (p : haarPolynomialSpace N d) + (hp : ∀ U : SpecialOrthogonal N, 0 ≤ haarPolynomialValue (p : MatrixPolynomial N) U) + {t : ℝ} (ht : 0 ≤ t) (U : SpecialOrthogonal N) : + 0 ≤ haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U := by + let q (s : ℝ) : MatrixPolynomial N := Real.exp (-s) • + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N) + let Wt (z : ℝ × SpecialOrthogonal N) := + haarPolynomialValue (haarPolynomialLaplacian N (q z.1)) z.2- + haarPolynomialValue (q z.1) z.2 + have hq (s : ℝ) (V : SpecialOrthogonal N) : haarPolynomialValue (q s) V = + Real.exp (-s)*haarPolynomialValue + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N) V := by + change matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) + (Real.exp (-s) • _) = _ + rw [map_smul] + rfl + have hL (s : ℝ) (V : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialLaplacian N (q s)) V = + Real.exp (-s)*haarPolynomialValue (haarPolynomialLaplacian N + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N)) V := by + change matrixPolynomialEval (V : Matrix (Fin N) (Fin N) ℝ) + (haarPolynomialLaplacian N (Real.exp (-s) • _)) = _ + rw [map_smul,map_smul,smul_eq_mul] + rfl + have hc : Continuous (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue (q z.1) z.2) := by + simp_rw [hq] + exact (Real.continuous_exp.comp continuous_fst.neg).mul (continuous_haarPolynomialHeat_value p) + have hi : ∀ V : SpecialOrthogonal N, 0 ≤ haarPolynomialValue (q 0) V := by + intro V + simpa only [hq,neg_zero,Real.exp_zero,one_mul,haarPolynomialHeat_zero] using hp V + have hd (s : ℝ) (_ : s ∈ Ioc (0 : ℝ) t) (V : SpecialOrthogonal N) : + HasDerivAt (fun r => haarPolynomialValue (q r) V) (Wt (s,V)) s := by + have he : HasDerivAt (fun r : ℝ => Real.exp (-r)) (-Real.exp (-s)) s := by + convert ((hasDerivAt_id s).fun_neg).exp using 1 + all_goals simp only [id_eq,mul_neg,mul_one] + have hv := haarPolynomialHeat_hasDerivAt p (V : Matrix (Fin N) (Fin N) ℝ) s + convert he.mul hv using 1 + · funext r + exact hq r V + · change haarPolynomialValue (haarPolynomialLaplacian N (q s)) V- + haarPolynomialValue (q s) V = _ + rw [hL,hq] + simp only [haarPolynomialValue] + ring + have hz := haarPolynomial_parabolic_nonneg ht q Wt hc.continuousOn hi hd + (fun _ _ _ => le_rfl) t ⟨ht,le_rfl⟩ U + rw [hq] at hz + exact nonneg_of_mul_nonneg_right hz (Real.exp_pos (-t)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatTestLimit.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatTestLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..7526bef8c5331c99a9e9a6a0d52f61e7f48e7914 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatTestLimit.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatMixing + +namespace OAI + +/-! Continuous tests of the polynomial heat flow and their Haar limits. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma haarPolynomialHeat_test_bound {N d : ℕ} (p : haarPolynomialSpace N d) + (F : ℝ → ℝ) (hF : Continuous F) : + ∃ B : ℝ, ∀ t : ℝ, 0 ≤ t → ∀ U : SpecialOrthogonal N, + ‖F (haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U)‖ ≤ B := by + obtain ⟨P,hP⟩ := haarPolynomialValue_bound (p : MatrixPolynomial N) + obtain ⟨B,hB⟩ := isCompact_Icc.exists_bound_of_continuousOn hF.continuousOn + refine ⟨B,?_⟩ + intro t ht U + apply hB + exact haarPolynomialHeat_bounds p (-P) P + (fun V => (abs_le.mp (hP V)).1) (fun V => (abs_le.mp (hP V)).2) ht U + +theorem haarPolynomialHeat_test_tendsto_mean {N d : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : haarPolynomialSpace N d) (F : ℝ → ℝ) (hF : Continuous F) : + Tendsto (fun t : ℝ => ∫ U, F (haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U) ∂μ) + atTop (𝓝 (F (∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ))) := by + obtain ⟨B,hB⟩ := haarPolynomialHeat_test_bound p F hF + have h := tendsto_integral_filter_of_dominated_convergence (μ := μ) (l := atTop) + (F := fun t U => F (haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U)) + (f := fun _ => F (∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ)) (fun _ => B) + simp only [integral_const,probReal_univ,smul_eq_mul,one_mul] at h + apply h + · exact Eventually.of_forall fun t => + (hF.comp (continuous_haarPolynomialValue _)).measurable.aestronglyMeasurable + · filter_upwards [eventually_ge_atTop (0:ℝ)] with t ht + exact ae_of_all μ (hB t ht) + · exact integrable_const _ + · exact ae_of_all μ fun U => hF.continuousAt.tendsto.comp (haarPolynomialHeat_tendsto_mean hN μ p U) + +theorem continuousOn_haarPolynomialHeat_test_integral {N d : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsFiniteMeasure μ] + (p : haarPolynomialSpace N d) (F : ℝ → ℝ) (hF : Continuous F) : + ContinuousOn (fun t : ℝ => ∫ U, F (haarPolynomialValue + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U) ∂μ) (Ici 0) := by + obtain ⟨B,hB⟩ := haarPolynomialHeat_test_bound p F hF + intro t _ + apply tendsto_integral_filter_of_dominated_convergence (fun _ => B) + · exact Eventually.of_forall fun s => + (hF.comp (continuous_haarPolynomialValue _)).measurable.aestronglyMeasurable + · filter_upwards [self_mem_nhdsWithin] with s hs + exact ae_of_all μ (hB s hs) + · exact integrable_const _ + · exact ae_of_all μ fun U => ((hF.comp + ((continuous_haarPolynomialHeat_value p).comp (continuous_id.prodMk continuous_const))).continuousAt).tendsto.mono_left + nhdsWithin_le_nhds + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatVanishingGradient.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatVanishingGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..34555625c1f27a0060cb9c45df96880b053d079c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHeatVanishingGradient.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatGradient + +namespace OAI + +/-! A single decaying gradient envelope for each polynomial heat orbit. -/ +noncomputable section +open Matrix MvPolynomial Filter +open scoped Topology +namespace InvariantIsing + +lemma haarPolynomialHeat_gradient_envelope {N d : ℕ} (p : haarPolynomialSpace N d) : + ∃ M : ℝ, 0 ≤ M ∧ ∀ t : ℝ, 0 ≤ t → ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)) U ≤ + (M*Real.exp (-((N:ℝ)-2)*t))^2 := by + obtain ⟨B,hB⟩ := haarPolynomialValue_bound (haarPolynomialGamma (p : MatrixPolynomial N) p) + let M := max B 1 + have hM1 : 1 ≤ M := le_max_right _ _ + have hM : 0 ≤ M := by linarith + have hC (U : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialGamma (p : MatrixPolynomial N) p) U ≤ M^2 := by + have hb := (le_abs_self _).trans (hB U) + have hm : B ≤ M := le_max_left _ _ + nlinarith + refine ⟨M,hM,?_⟩ + intro t ht U + have hg := haarPolynomialHeat_gradient_bound p (M^2) hC ht U + have he : Real.exp (2*((N:ℝ)-2)*t)*(M*Real.exp (-((N:ℝ)-2)*t))^2 = M^2 := by + calc + _ = M^2*Real.exp (2*((N:ℝ)-2)*t+ + (-((N:ℝ)-2)*t+-((N:ℝ)-2)*t)) := by + rw [Real.exp_add,Real.exp_add] + ring + _ = M^2 := by + rw [show 2*((N:ℝ)-2)*t+(-((N:ℝ)-2)*t+-((N:ℝ)-2)*t)=0 by ring, + Real.exp_zero,mul_one] + have hpos := Real.exp_pos (2*((N:ℝ)-2)*t) + nlinarith + +lemma tendsto_haar_gradient_envelope {N : ℕ} (hN : 3 ≤ N) (M : ℝ) : + Tendsto (fun t : ℝ => M*Real.exp (-((N:ℝ)-2)*t)) atTop (𝓝 0) := by + have hρ : 0 < (N:ℝ)-2 := by + have h3 : (3:ℝ) ≤ N := by exact_mod_cast hN + linarith + have ht : Tendsto (fun t : ℝ => -((N:ℝ)-2)*t) atTop atBot := by + simpa only [Function.comp_def,neg_mul,id_eq] using + tendsto_neg_atTop_atBot.comp (tendsto_id.const_mul_atTop hρ) + simpa only [Function.comp_def,mul_zero] using (Real.tendsto_exp_atBot.comp ht).const_mul M + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHessianBound.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHessianBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..737ca8921bdc1df11b17968bed49150481e604d9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHessianBound.lean @@ -0,0 +1,28 @@ +import OAI.Probability.InvariantIsing.Haar.HaarFunctionalCurvature + +namespace OAI + +/-! The antisymmetric part of a finite Hessian controls the curvature term. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +theorem sum_antisymmetric_square_le {J : Type*} [Fintype J] (H : J → J → ℝ) : + (∑ i, ∑ j, (H i j-H j i)^2) ≤ 4*(∑ i, ∑ j, (H i j)^2) := by + calc + (∑ i, ∑ j, (H i j-H j i)^2) ≤ + ∑ i, ∑ j, 2*((H i j)^2+(H j i)^2) := by + apply Finset.sum_le_sum; intro i _ + apply Finset.sum_le_sum; intro j _ + nlinarith [sq_nonneg (H i j+H j i)] + _ = 4*(∑ i, ∑ j, (H i j)^2) := by + simp only [mul_add,Finset.mul_sum,Finset.sum_add_distrib] + rw [Finset.sum_comm (f := fun i j => 2*(H j i)^2)] + simp only [← Finset.mul_sum] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarHessianExpansion.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarHessianExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8c1593c277c2cdb3f05a0dc272a68dc3e9b19bc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarHessianExpansion.lean @@ -0,0 +1,33 @@ +import OAI.Probability.InvariantIsing.Haar.HaarCorrectedHessian + +namespace OAI + +/-! Finite square completion in the logarithmic Bochner calculation. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma sum_gradient_outer_sq {J : Type*} [Fintype J] (g : J → ℝ) : + (∑ i, ∑ j, (g i*g j)^2) = (∑ i, (g i)^2)^2 := by + simp only [mul_pow] + rw [pow_two,Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.mul_sum] + +lemma sum_corrected_hessian_sq {J : Type*} [Fintype J] + (H : J → J → ℝ) (g : J → ℝ) (c : ℝ) : + (∑ i, ∑ j, (H i j-c*g i*g j)^2) = + (∑ i, ∑ j, (H i j)^2)-2*c*(∑ i, ∑ j, H i j*g i*g j)+ + c^2*(∑ i, (g i)^2)^2 := by + have hs (i j : J) : (H i j-c*g i*g j)^2 = + (H i j)^2-2*c*(H i j*g i*g j)+c^2*(g i*g j)^2 := by ring + simp_rw [hs] + simp only [Finset.sum_add_distrib,Finset.sum_sub_distrib,← Finset.mul_sum] + rw [sum_gradient_outer_sq] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelApproximation.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e72cdbfd34775e49c801c63b799401ec7f0760e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelApproximation.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Haar.HaarKernelMass + +namespace OAI + +/-! Uniform approximation by positive polynomial Haar convolution. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Set Filter +open scoped Topology +namespace InvariantIsing + +theorem haarKernelApprox_error {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) (B ε a : ℝ) + (hB : 0 ≤ B) (hfB : ∀ V, |f V| ≤ B) (hε : 0 ≤ ε) (ha : 0 ≤ a) + (hloc : ∀ U V, a < haarKernelBase 1 V → |f (U*V)-f U| ≤ ε) + (n : ℕ) (U : SpecialOrthogonal N) : + |haarPolynomialValue (haarKernelApprox μ f n) U-f U| ≤ + ε+2*B*(a^n/haarKernelMass μ n) := by + let Z := haarKernelMass μ n + let k (V : SpecialOrthogonal N) := (haarKernelBase 1 V)^n + have hZ : 0 < Z := haarKernelMass_pos hN μ n + have hk : Continuous k := (continuous_haarKernelBase 1).pow n + have hi : Integrable (fun V => (f (U*V)-f U)*k V) μ := + continuous_haar_integrable μ _ (((hf.comp (continuous_const.mul continuous_id)).sub continuous_const).mul hk) + have he : haarPolynomialValue (haarKernelApprox μ f n) U-f U = + Z⁻¹*(∫ V, (f (U*V)-f U)*k V ∂μ) := by + simp only [haarKernelApprox,haarPolynomialValue,map_smul,smul_eq_mul] + change Z⁻¹*haarPolynomialValue (haarKernelAverage μ f n) U-f U = _ + rw [haarKernelAverage_convolution μ f hf] + have he' : (∫ V, (f (U*V)-f U)*k V ∂μ) = + (∫ V, f (U*V)*k V ∂μ)-f U*Z := by + simp_rw [sub_mul] + have hi1 : Integrable (fun V => f (U*V)*k V) μ := + continuous_haar_integrable μ _ ((hf.comp (continuous_const.mul continuous_id)).mul hk) + have hi2 : Integrable (fun V => f U*k V) μ := + (continuous_haar_integrable μ _ hk).const_mul (f U) + rw [integral_sub hi1 hi2,integral_const_mul] + rfl + rw [he'] + dsimp only [k] + field_simp + have hb (V : SpecialOrthogonal N) : + |(f (U*V)-f U)*k V| ≤ ε*k V+2*B*a^n := by + rw [abs_mul,abs_of_nonneg (pow_nonneg (haarKernelBase_nonneg 1 V) n)] + by_cases hV : a < haarKernelBase 1 V + · have hh := mul_le_mul_of_nonneg_right (hloc U V hV) + (pow_nonneg (haarKernelBase_nonneg 1 V) n) + have ht : 0 ≤ 2*B*a^n := by positivity + exact hh.trans (le_add_of_nonneg_right ht) + · have hbd : |f (U*V)-f U| ≤ 2*B := (abs_sub (f (U*V)) (f U)).trans (by linarith [hfB (U*V),hfB U]) + have hpow : k V ≤ a^n := pow_le_pow_left₀ (haarKernelBase_nonneg 1 V) (le_of_not_gt hV) n + have hh := mul_le_mul hbd hpow (pow_nonneg (haarKernelBase_nonneg 1 V) n) (by positivity : 0 ≤ 2*B) + have ht : 0 ≤ ε*k V := mul_nonneg hε (pow_nonneg (haarKernelBase_nonneg 1 V) n) + exact hh.trans (le_add_of_nonneg_left ht) + rw [he,abs_mul,abs_of_pos (inv_pos.mpr hZ)] + have hI : |∫ V, (f (U*V)-f U)*k V ∂μ| ≤ ε*Z+2*B*a^n := by + calc + _ ≤ ∫ V, |(f (U*V)-f U)*k V| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ V, ε*k V+2*B*a^n ∂μ := + integral_mono hi.abs (((continuous_haar_integrable μ _ hk).const_mul ε).add (integrable_const _)) hb + _ = ε*Z+2*B*a^n := by + rw [integral_add ((continuous_haar_integrable μ _ hk).const_mul ε) (integrable_const _),integral_const_mul] + simp only [integral_const,probReal_univ,smul_eq_mul,one_mul] + rfl + calc + _ ≤ Z⁻¹*(ε*Z+2*B*a^n) := mul_le_mul_of_nonneg_left hI (inv_pos.mpr hZ).le + _ = ε+2*B*(a^n/Z) := by field_simp + +theorem haarKernelApprox_uniform {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) : + ∀ ε > 0, ∀ᶠ n : ℕ in atTop, ∀ U, + |haarPolynomialValue (haarKernelApprox μ f n) U-f U| ≤ ε := by + intro ε hε + obtain ⟨B,hB⟩ := isCompact_univ.exists_bound_of_continuousOn hf.continuousOn + have hfB (V : SpecialOrthogonal N) : |f V| ≤ B := by simpa only [Real.norm_eq_abs] using hB V (mem_univ V) + have hB0 : 0 ≤ B := (abs_nonneg (f 1)).trans (hfB 1) + let δ := ε/(2*L) + have hδ : 0 < δ := div_pos hε (mul_pos (by norm_num) hL) + have hδeq : L*δ = ε/2 := by dsimp [δ]; field_simp + let a := max 0 (2*N-δ^2/2) + have ha : 0 ≤ a := le_max_left _ _ + have haN : a < 2*N := max_lt (by positivity) (by nlinarith [sq_pos_of_pos hδ]) + have hloc (U V : SpecialOrthogonal N) (hV : a < haarKernelBase 1 V) : + |f (U*V)-f U| ≤ ε/2 := by + have hda : 2*N-δ^2/2 < haarKernelBase 1 V := (le_max_right _ _).trans_lt hV + rw [haarKernelBase_dist] at hda + have hd : frobeniusDistance 1 V < δ := by nlinarith [Real.sqrt_nonneg (∑ i, ∑ j, ((1 : Matrix (Fin N) (Fin N) ℝ) i j-(V : Matrix (Fin N) (Fin N) ℝ) i j)^2)] + have hh := hLip (U*V) (U*1) + rw [frobeniusDistance_mul_left,mul_one,frobeniusDistance_comm V 1] at hh + have hh' := mul_lt_mul_of_pos_left hd hL + rw [hδeq] at hh' + exact hh.trans hh'.le + have ht : Tendsto (fun n : ℕ => 2*B*(a^n/haarKernelMass μ n)) atTop (𝓝 0) := by + simpa using (haarKernelMass_ratio_tendsto_zero hN μ a ha haN).const_mul (2*B) + filter_upwards [ht.eventually (gt_mem_nhds (by linarith : (0:ℝ) < ε/2))] with n hn U + have hh := haarKernelApprox_error hN μ f hf B (ε/2) a hB0 hfB (by positivity) ha hloc n U + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelConvolution.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ad2cc43aa42a0c0ac3c4cf52d364e627cdfe7e3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelConvolution.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Haar.HaarFrobeniusGeometry +import OAI.Probability.InvariantIsing.Haar.HaarGroupTopology + +namespace OAI + +/-! Haar convolution by a positive polynomial kernel preserves Lipschitz constants. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Set +open scoped BigOperators +namespace InvariantIsing + +lemma continuous_haarKernelBase {N : ℕ} (U : SpecialOrthogonal N) : + Continuous (haarKernelBase U) := by + unfold haarKernelBase + apply continuous_const.add + apply continuous_finsetSum + intro i _ + apply continuous_finsetSum + intro j _ + exact continuous_const.mul ((continuous_apply j).comp + ((continuous_apply i).comp continuous_subtype_val)) + +def haarKernelMass {N : ℕ} (μ : Measure (SpecialOrthogonal N)) (n : ℕ) : ℝ := + ∫ V, (haarKernelBase 1 V)^n ∂μ + +def haarKernelApprox {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + (f : SpecialOrthogonal N → ℝ) (n : ℕ) : MatrixPolynomial N := + (haarKernelMass μ n)⁻¹ • haarKernelAverage μ f n + +lemma haarKernelMass_pos {N : ℕ} (hN : 0 < N) (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] (n : ℕ) : + 0 < haarKernelMass μ n := by + apply integral_pos_of_integrable_nonneg_nonzero (x := (1 : SpecialOrthogonal N)) + ((continuous_haarKernelBase 1).pow n) + (continuous_haar_integrable μ _ ((continuous_haarKernelBase 1).pow n)) + (fun V => pow_nonneg (haarKernelBase_nonneg 1 V) n) + change (haarKernelBase 1 1)^n ≠ 0 + rw [haarKernelBase_self] + exact (pow_pos (mul_pos (by norm_num) (Nat.cast_pos.mpr hN)) n).ne' + +lemma haarKernelAverage_convolution {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (f : SpecialOrthogonal N → ℝ) + (hf : Continuous f) (n : ℕ) (U : SpecialOrthogonal N) : + haarPolynomialValue (haarKernelAverage μ f n) U = + ∫ V, f (U*V)*(haarKernelBase 1 V)^n ∂μ := by + rw [haarKernelAverage_value μ f hf] + have h := integral_mul_left_eq_self (μ := μ) + (fun V => f V*(haarKernelBase U V)^n) U + rw [← h] + apply integral_congr_ae + exact ae_of_all μ fun V => by + dsimp only + rw [show haarKernelBase U (U*V) = haarKernelBase 1 V by + simpa only [mul_one] using haarKernelBase_mul_left U 1 V] + +theorem haarKernelApprox_lipschitz {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) (L : ℝ) + (hL : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) (n : ℕ) + (U V : SpecialOrthogonal N) : + |haarPolynomialValue (haarKernelApprox μ f n) U- + haarPolynomialValue (haarKernelApprox μ f n) V| ≤ L*frobeniusDistance U V := by + have hZ := haarKernelMass_pos hN μ n + let k (W : SpecialOrthogonal N) := (haarKernelBase 1 W)^n + have hk : Continuous k := (continuous_haarKernelBase 1).pow n + have hi (U : SpecialOrthogonal N) : Integrable (fun W => f (U*W)*k W) μ := + continuous_haar_integrable μ _ ((hf.comp (continuous_const.mul continuous_id)).mul hk) + have he (U : SpecialOrthogonal N) : haarPolynomialValue (haarKernelApprox μ f n) U = + (haarKernelMass μ n)⁻¹*(∫ W, f (U*W)*k W ∂μ) := by + simp only [haarKernelApprox,haarPolynomialValue,map_smul,smul_eq_mul] + change (haarKernelMass μ n)⁻¹*haarPolynomialValue (haarKernelAverage μ f n) U = _ + rw [haarKernelAverage_convolution μ f hf] + rw [he U,he V,← mul_sub,abs_mul,abs_of_pos (inv_pos.mpr hZ),← integral_sub (hi U) (hi V)] + apply (inv_mul_le_iff₀ hZ).mpr + calc + |∫ W, (f (U*W)*k W-f (V*W)*k W) ∂μ| ≤ + ∫ W, |f (U*W)*k W-f (V*W)*k W| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ W, (L*frobeniusDistance U V)*k W ∂μ := by + apply integral_mono + · exact ((hi U).sub (hi V)).abs + · exact (continuous_haar_integrable μ _ hk).const_mul _ + · intro W + dsimp only + rw [← sub_mul,abs_mul,abs_of_nonneg (pow_nonneg (haarKernelBase_nonneg 1 W) n)] + apply mul_le_mul_of_nonneg_right _ (pow_nonneg (haarKernelBase_nonneg 1 W) n) + exact (hL (U*W) (V*W)).trans_eq (by rw [frobeniusDistance_mul_right]) + _ = haarKernelMass μ n*(L*frobeniusDistance U V) := by + rw [integral_const_mul,mul_comm] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelGeometry.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..13a5504eb090fece9ab2cba1426d90f47281fb7d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelGeometry.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialKernel +import OAI.Probability.InvariantIsing.Haar.HaarPlaneFrame + +namespace OAI + +/-! The averaging kernel peaks exactly at coincident orthogonal matrices. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +open scoped BigOperators +namespace InvariantIsing + +lemma specialOrthogonal_sum_sq {N : ℕ} (U : SpecialOrthogonal N) : + (∑ i, ∑ j, ((U : Matrix (Fin N) (Fin N) ℝ) i j)^2) = N := by + rw [← matrixFrobeniusPair_self] + unfold matrixFrobeniusPair + rw [(Matrix.mem_orthogonalGroup_iff' (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).1] + simp + +lemma haarKernelBase_dist {N : ℕ} (U V : SpecialOrthogonal N) : + haarKernelBase U V = 2*N-(frobeniusDistance U V)^2/2 := by + have hU := specialOrthogonal_sum_sq U + have hV := specialOrthogonal_sum_sq V + rw [frobeniusDistance,Real.sq_sqrt (Finset.sum_nonneg fun i _ => + Finset.sum_nonneg fun j _ => sq_nonneg _)] + have hsum : (∑ i, ∑ j, ((U : Matrix (Fin N) (Fin N) ℝ) i j- + (V : Matrix (Fin N) (Fin N) ℝ) i j)^2) = 2*N- + 2*(∑ i, ∑ j, (U : Matrix (Fin N) (Fin N) ℝ) i j* + (V : Matrix (Fin N) (Fin N) ℝ) i j) := by + simp only [sub_sq,Finset.sum_add_distrib,Finset.sum_sub_distrib] + simp_rw [mul_assoc,← Finset.mul_sum] + rw [hU,hV] + ring + rw [hsum] + unfold haarKernelBase + ring + +lemma haarKernelBase_nonneg {N : ℕ} (U V : SpecialOrthogonal N) : + 0 ≤ haarKernelBase U V := by + have h := Finset.sum_nonneg (s := Finset.univ) (fun i _ => + Finset.sum_nonneg (s := Finset.univ) (fun j _ => + sq_nonneg ((U : Matrix (Fin N) (Fin N) ℝ) i j+ + (V : Matrix (Fin N) (Fin N) ℝ) i j))) + simp only [add_sq,Finset.sum_add_distrib] at h + simp_rw [mul_assoc,← Finset.mul_sum] at h + rw [specialOrthogonal_sum_sq U,specialOrthogonal_sum_sq V] at h + unfold haarKernelBase + linarith + +lemma haarKernelBase_le {N : ℕ} (U V : SpecialOrthogonal N) : + haarKernelBase U V ≤ 2*N := by + rw [haarKernelBase_dist] + nlinarith [sq_nonneg (frobeniusDistance U V)] + +lemma haarKernelBase_self {N : ℕ} (U : SpecialOrthogonal N) : + haarKernelBase U U = 2*N := by + unfold haarKernelBase + simp_rw [← pow_two] + rw [specialOrthogonal_sum_sq] + ring + +lemma haarKernelBase_mul_left {N : ℕ} (W U V : SpecialOrthogonal N) : + haarKernelBase (W*U) (W*V) = haarKernelBase U V := by + have he : matrixFrobeniusPair + ((W : Matrix (Fin N) (Fin N) ℝ)*(U : Matrix (Fin N) (Fin N) ℝ)) + ((W : Matrix (Fin N) (Fin N) ℝ)*(V : Matrix (Fin N) (Fin N) ℝ)) = + matrixFrobeniusPair (U : Matrix (Fin N) (Fin N) ℝ) + (V : Matrix (Fin N) (Fin N) ℝ) := by + unfold matrixFrobeniusPair + rw [Matrix.transpose_mul,mul_assoc,← mul_assoc (W : Matrix (Fin N) (Fin N) ℝ).transpose, + (Matrix.mem_orthogonalGroup_iff' (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp W.property).1,one_mul] + unfold haarKernelBase + rw [← matrixFrobeniusPair_eq_sum,← matrixFrobeniusPair_eq_sum] + exact congrArg (fun x : ℝ => N+x) he + +lemma haarKernelBase_mul_right {N : ℕ} (U V W : SpecialOrthogonal N) : + haarKernelBase (U*W) (V*W) = haarKernelBase U V := by + have he : matrixFrobeniusPair + ((U : Matrix (Fin N) (Fin N) ℝ)*(W : Matrix (Fin N) (Fin N) ℝ)) + ((V : Matrix (Fin N) (Fin N) ℝ)*(W : Matrix (Fin N) (Fin N) ℝ)) = + matrixFrobeniusPair (U : Matrix (Fin N) (Fin N) ℝ) + (V : Matrix (Fin N) (Fin N) ℝ) := by + unfold matrixFrobeniusPair + rw [Matrix.transpose_mul,Matrix.trace_mul_cycle] + rw [mul_assoc (V : Matrix (Fin N) (Fin N) ℝ) W (W : Matrix (Fin N) (Fin N) ℝ).transpose, + (Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mp + (Matrix.mem_specialOrthogonalGroup_iff.mp W.property).1,mul_one,Matrix.trace_mul_comm] + unfold haarKernelBase + rw [← matrixFrobeniusPair_eq_sum,← matrixFrobeniusPair_eq_sum] + exact congrArg (fun x : ℝ => N+x) he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelMass.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..6198fadd92451ce83dc2abff6d7a2edd8519a212 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarKernelMass.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Haar.HaarKernelConvolution + +namespace OAI + +/-! Quantitative concentration of the positive polynomial kernels near the identity. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Set Filter +open scoped Topology +namespace InvariantIsing + +lemma haarKernelMass_lower {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] (b : ℝ) (hb : 0 ≤ b) (n : ℕ) : + μ.real {V | b < haarKernelBase 1 V} * b^n ≤ haarKernelMass μ n := by + let S : Set (SpecialOrthogonal N) := {V | b < haarKernelBase 1 V} + have hS : MeasurableSet S := measurableSet_lt measurable_const (continuous_haarKernelBase 1).measurable + have hi : Integrable (S.indicator (fun _ => b^n)) μ := (integrable_const _).indicator hS + have hk := continuous_haar_integrable μ _ ((continuous_haarKernelBase 1).pow n) + have hle : (∫ V, S.indicator (fun _ => b^n) V ∂μ) ≤ haarKernelMass μ n := by + apply integral_mono hi hk + intro V + by_cases hV : V ∈ S + · rw [Set.indicator_of_mem hV] + exact pow_le_pow_left₀ hb hV.le n + · rw [Set.indicator_of_notMem hV] + exact pow_nonneg (haarKernelBase_nonneg 1 V) n + simpa only [integral_indicator_const _ hS,smul_eq_mul] using hle + +lemma haarKernel_superlevel_pos {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] {b : ℝ} (hb : b < 2*N) : + 0 < μ.real {V | b < haarKernelBase 1 V} := by + have hm : 0 < μ {V | b < haarKernelBase 1 V} := IsOpen.measure_pos μ + (isOpen_lt continuous_const (continuous_haarKernelBase 1)) + ⟨1,by simpa only [mem_ofPred_eq,haarKernelBase_self] using hb⟩ + exact ENNReal.toReal_pos hm.ne' (measure_ne_top μ _) + +theorem haarKernelMass_ratio_tendsto_zero {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (a : ℝ) (ha : 0 ≤ a) (haN : a < 2*N) : + Tendsto (fun n : ℕ => a^n/haarKernelMass μ n) atTop (𝓝 0) := by + let b := (a+2*N)/2 + have hab : a < b := by dsimp [b]; linarith + have hbN : b < 2*N := by dsimp [b]; linarith + have hb : 0 < b := ha.trans_lt hab + let m := μ.real {V | b < haarKernelBase 1 V} + have hm : 0 < m := haarKernel_superlevel_pos μ hbN + have hr : a/b < 1 := (div_lt_one hb).mpr hab + have hlim : Tendsto (fun n : ℕ => (a/b)^n/m) atTop (𝓝 0) := by + simpa using (tendsto_pow_atTop_nhds_zero_of_lt_one (div_nonneg ha hb.le) hr).div_const m + apply squeeze_zero (fun n => div_nonneg (pow_nonneg ha n) (haarKernelMass_pos hN μ n).le) _ hlim + intro n + have hl := haarKernelMass_lower μ b hb.le n + have hZ := haarKernelMass_pos hN μ n + have hp := pow_pos hb n + rw [div_pow] + apply (div_le_div_iff₀ hZ hm).mpr + rw [div_mul_eq_mul_div] + apply (le_div_iff₀ hp).mpr + calc + (a^n*m)*b^n = a^n*(m*b^n) := by ring + _ ≤ a^n*haarKernelMass μ n := mul_le_mul_of_nonneg_left hl (pow_nonneg ha n) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzContinuity.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..00109dac61fa44e52f66fb9d8655ebdda30f84b6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzContinuity.lean @@ -0,0 +1,37 @@ +import OAI.Probability.InvariantIsing.Haar.HaarFrobeniusGeometry + +namespace OAI + +/-! Frobenius-Lipschitz observables are continuous in the matrix-group topology. -/ +noncomputable section +open Matrix Filter +open scoped Topology +namespace InvariantIsing + +lemma continuous_frobeniusDistance_right {N : ℕ} (U : SpecialOrthogonal N) : + Continuous (fun V => frobeniusDistance V U) := by + have he (i j : Fin N) : Continuous (fun V : SpecialOrthogonal N => + (V : Matrix (Fin N) (Fin N) ℝ) i j) := + (continuous_apply j).comp ((continuous_apply i).comp continuous_subtype_val) + unfold frobeniusDistance + apply Real.continuous_sqrt.comp + exact continuous_finsetSum _ fun i _ => continuous_finsetSum _ fun j _ => + ((he i j).sub continuous_const).pow 2 + +lemma frobeniusDistance_self {N : ℕ} (U : SpecialOrthogonal N) : frobeniusDistance U U = 0 := by + simp [frobeniusDistance] + +theorem continuous_of_frobenius_lipschitz {N : ℕ} (f : SpecialOrthogonal N → ℝ) (L : ℝ) + (hf : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) : Continuous f := by + apply continuous_iff_continuousAt.mpr + intro U + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero (fun V => norm_nonneg _) (fun V => by simpa only [Real.norm_eq_abs] using hf V U) + have hh := ((continuous_frobeniusDistance_right U).tendsto U).const_mul L + simpa only [frobeniusDistance_self,mul_zero] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzGradient.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..f987a8b534dd767f6378a9e606b005af1f2e0951 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzGradient.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Haar.HaarFrobeniusGeometry +import OAI.Probability.InvariantIsing.Haar.SpecialSkewRotation +import OAI.Probability.InvariantIsing.Haar.DerivativeComparison +import OAI.Probability.InvariantIsing.Haar.HaarFunctionalCurvature +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialCurvature + +namespace OAI + +/-! A Frobenius-Lipschitz polynomial has dimension-free carré-du-champ control. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators Matrix.Norms.Frobenius +namespace InvariantIsing + +theorem haarPolynomial_direction_le_lipschitz {N : ℕ} (p : MatrixPolynomial N) + (L : ℝ) (hp : ∀ U V, |haarPolynomialValue p U-haarPolynomialValue p V| ≤ + L*frobeniusDistance U V) (U : SpecialOrthogonal N) + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) : + |matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) + (matrixPolynomialDerivation A p)| ≤ L*‖A‖ := by + have hf := hasDerivAt_specialSkewRotation_polynomial p A hA U + have hg := hasDerivAt_specialSkewRotation A hA U + have hh := norm_derivative_le_of_increment_bound hf hg (fun t => by + simpa only [specialSkewRotation_zero,one_mul,Real.norm_eq_abs,← frobeniusDistance_eq_norm, + haarPolynomialValue] + using hp (specialSkewRotation A hA t*U) U) + simpa only [Real.norm_eq_abs,frobenius_norm_mul_orthogonal] using hh + +theorem haarPolynomial_gamma_le_lipschitz {N : ℕ} (p : MatrixPolynomial N) + (L : ℝ) (hL : 0 ≤ L) + (hp : ∀ U V, |haarPolynomialValue p U-haarPolynomialValue p V| ≤ + L*frobeniusDistance U V) (U : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialGamma p p) U ≤ 4*L^2 := by + let ell := matrixPolynomialDifferential p (U : Matrix (Fin N) (Fin N) ℝ) + let A := planeFunctionalMatrix ell + have hA : A.transpose = -A := planeFunctionalMatrix_skew ell + have hrepr := plane_functional_representation ell A hA + have hsq : ‖A‖^2 = haarPolynomialValue (haarPolynomialGamma p p) U := by + rw [frobenius_norm_sq,matrixFrobeniusPair_self] + simp only [A,planeFunctionalMatrix,haarPolynomialValue,haarPolynomialGamma,map_sum,map_mul,pow_two] + rfl + have he : ‖A‖^2 = 2*ell A := by + rw [frobenius_norm_sq] + exact hrepr + have hd : |ell A| ≤ L*‖A‖ := haarPolynomial_direction_le_lipschitz p L hp U A hA + have hn : ‖A‖ ≤ 2*L := by nlinarith [norm_nonneg A,le_abs_self (ell A)] + rw [← hsq] + nlinarith [norm_nonneg A] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzMoment.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..68505f48a8c8d4cb48e0068edb39324972db16f0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzMoment.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Haar.HaarKernelApproximation +import OAI.Probability.InvariantIsing.Haar.HaarLipschitzGradient +import OAI.Probability.InvariantIsing.Haar.HaarUniformMomentLimit +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMomentShift + +namespace OAI + +/-! Exponential moments for all continuous Frobenius-Lipschitz observables. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter +open scoped Topology +namespace InvariantIsing + +theorem haar_lipschitz_moment_bound {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) {t : ℝ} (ht : 0 < t) : + (∫ U, Real.exp (t*f U) ∂μ) ≤ + Real.exp ((∫ U, f U ∂μ)*t+(4*L^2)/(2*((N:ℝ)-2))*t^2) := by + have hN0 : 0 < N := by omega + let p : ℕ → MatrixPolynomial N := haarKernelApprox μ f + have hu := haarKernelApprox_uniform hN0 μ f hf L hL hLip + obtain ⟨hmean,hmoment⟩ := haar_uniform_polynomial_integrals μ p f hf hu + have hG (n : ℕ) (U : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialGamma (p n) (p n)) U ≤ 4*L^2 := + haarPolynomial_gamma_le_lipschitz (p n) L hL.le + (haarKernelApprox_lipschitz hN0 μ f hf L hLip n) U + have hbound (n : ℕ) : haarPolynomialMoment μ (p n) t ≤ + Real.exp ((∫ U, haarPolynomialValue (p n) U ∂μ)*t+(4*L^2)/(2*((N:ℝ)-2))*t^2) := by + have hh := Real.exp_le_exp.mpr + (haarPolynomialMoment_log_bound hN μ (p n) (4*L^2) (by positivity) (hG n) ht) + rwa [Real.exp_log (haarPolynomialMoment_pos μ (p n) t)] at hh + exact le_of_tendsto_of_tendsto (hmoment t) + (Real.continuous_exp.continuousAt.tendsto.comp ((hmean.mul_const t).add_const _)) + (Eventually.of_forall hbound) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzTail.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..de32694b25f7e141135c459cc26fdf74227e6d61 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLipschitzTail.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Haar.HaarLipschitzMoment +import OAI.Probability.InvariantIsing.Haar.HaarLipschitzContinuity + +namespace OAI + +/-! Gaussian tails about the Haar mean for arbitrary Lipschitz observables. -/ +noncomputable section +open Matrix MeasureTheory Set +namespace InvariantIsing + +theorem haar_lipschitz_chernoff {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) + (r β : ℝ) (hβ : 0 < β) : + μ.real {U | r ≤ f U-(∫ V, f V ∂μ)} ≤ + Real.exp ((4*L^2)/(2*((N:ℝ)-2))*β^2-β*r) := by + have hf := continuous_of_frobenius_lipschitz f L hLip + let m := ∫ V, f V ∂μ + let A := (4*L^2)/(2*((N:ℝ)-2)) + let F (U : SpecialOrthogonal N) := Real.exp (β*(f U-m)) + have hfi : Integrable F μ := continuous_haar_integrable μ _ + (Real.continuous_exp.comp (continuous_const.mul (hf.sub continuous_const))) + have hmoment := haar_lipschitz_moment_bound hN μ f hf L hL hLip hβ + have hI : (∫ U, F U ∂μ) ≤ Real.exp (A*β^2) := by + have he : (∫ U, F U ∂μ) = Real.exp (-β*m)*(∫ U, Real.exp (β*f U) ∂μ) := by + rw [← integral_const_mul] + apply integral_congr_ae + exact ae_of_all μ fun U => by + change Real.exp (β*(f U-m)) = Real.exp (-β*m)*Real.exp (β*f U) + rw [← Real.exp_add] + congr 1 + ring + rw [he] + calc + _ ≤ Real.exp (-β*m)*Real.exp (m*β+A*β^2) := + mul_le_mul_of_nonneg_left hmoment (Real.exp_pos _).le + _ = Real.exp (A*β^2) := by + rw [← Real.exp_add] + congr 1 + ring + have hset : {U | Real.exp (β*r) ≤ F U} = {U | r ≤ f U-m} := by + ext U + simp only [mem_ofPred_eq,F,Real.exp_le_exp] + exact mul_le_mul_iff_right₀ hβ + have hm := mul_meas_ge_le_integral_of_nonneg (ae_of_all μ fun U => (Real.exp_pos _).le) + hfi (Real.exp (β*r)) + rw [hset] at hm + have hb : μ.real {U | r ≤ f U-m} ≤ Real.exp (A*β^2)/Real.exp (β*r) := by + apply (le_div_iff₀ (Real.exp_pos _)).mpr + nlinarith [hm] + simpa only [Real.exp_sub] using hb + +theorem haar_lipschitz_upper_tail {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) {r : ℝ} (hr : 0 < r) : + μ.real {U | r ≤ f U-(∫ V, f V ∂μ)} ≤ + Real.exp (-((N:ℝ)-2)*r^2/(8*L^2)) := by + have hρ : 0 < (N:ℝ)-2 := by exact_mod_cast (show 0 < (N:ℤ)-2 by omega) + have hC : 0 < 4*L^2 := by positivity + have hb : 0 < ((N:ℝ)-2)*r/(4*L^2) := div_pos (mul_pos hρ hr) hC + have h := haar_lipschitz_chernoff hN μ f L hL hLip r (((N:ℝ)-2)*r/(4*L^2)) hb + convert h using 1 + congr 1 + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLogBarrier.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLogBarrier.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e0b07a079bb84b7aa7d6959231aa3357276a7cc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLogBarrier.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Haar.HaarLogCurvature +import OAI.Probability.InvariantIsing.Haar.HaarMinimumGradient + +namespace OAI + +/-! The pointwise minimum inequality for a logarithmic heat-gradient barrier. -/ +noncomputable section +open Matrix MvPolynomial +namespace InvariantIsing + +def haarLogBarrier {N : ℕ} (p : MatrixPolynomial N) (a : ℝ) : MatrixPolynomial N := + a • p^2-haarPolynomialGamma p p + +lemma haarLogBarrier_eval {N : ℕ} (p : MatrixPolynomial N) (a : ℝ) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (haarLogBarrier p a) = + a*(matrixPolynomialEval M p)^2-matrixPolynomialEval M (haarPolynomialGamma p p) := by + simp only [haarLogBarrier,map_sub,map_smul,map_pow,smul_eq_mul] + +lemma haarLogBarrier_laplacian {N : ℕ} (p : MatrixPolynomial N) (a : ℝ) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (haarPolynomialLaplacian N (haarLogBarrier p a)) = + 2*a*(matrixPolynomialEval M p*matrixPolynomialEval M (haarPolynomialLaplacian N p)+ + matrixPolynomialEval M (haarPolynomialGamma p p))- + matrixPolynomialEval M (haarPolynomialLaplacian N (haarPolynomialGamma p p)) := by + simp only [haarLogBarrier,map_sub,map_smul,haarPolynomialLaplacian_sq, + map_mul,map_ofNat,map_add,smul_eq_mul] + ring + +lemma haarLogBarrier_gamma {N : ℕ} (p : MatrixPolynomial N) (a : ℝ) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (haarPolynomialGamma p (haarLogBarrier p a)) = + 2*a*matrixPolynomialEval M p*matrixPolynomialEval M (haarPolynomialGamma p p)- + matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialGamma p p)) := by + simp only [haarLogBarrier,haarPolynomialGamma_sub,haarPolynomialGamma_smul, + haarPolynomialGamma_sq,map_sub,map_smul,map_mul,map_ofNat,smul_eq_mul] + ring + +lemma haarLogBarrier_min_derivative_lower {N : ℕ} (p : MatrixPolynomial N) (a : ℝ) + (U : SpecialOrthogonal N) (hu : haarPolynomialValue p U ≠ 0) + (hmin : ∀ V : SpecialOrthogonal N, + haarPolynomialValue (haarLogBarrier p a) U ≤ haarPolynomialValue (haarLogBarrier p a) V) : + -2*((N:ℝ)-2)*a*(haarPolynomialValue p U)^2+ + 2*a*haarPolynomialValue p U*haarPolynomialValue (haarPolynomialLaplacian N p) U- + 2*haarPolynomialValue (haarPolynomialGamma p (haarPolynomialLaplacian N p)) U ≥ + (-2*((N:ℝ)-2)+2*haarPolynomialValue (haarPolynomialGamma p p) U/ + (haarPolynomialValue p U)^2)*haarPolynomialValue (haarLogBarrier p a) U := by + let M : Matrix (Fin N) (Fin N) ℝ := U + have hc := haarLogCurvature p M (1/matrixPolynomialEval M p) + have hl := haarPolynomialLaplacian_nonneg_at_min (haarLogBarrier p a) U hmin + have hg := haarPolynomialGamma_zero_at_min (haarLogBarrier p a) p U hmin + change 0 ≤ matrixPolynomialEval M (haarPolynomialLaplacian N (haarLogBarrier p a)) at hl + change matrixPolynomialEval M (haarPolynomialGamma p (haarLogBarrier p a)) = 0 at hg + rw [haarLogBarrier_laplacian] at hl + rw [haarLogBarrier_gamma] at hg + change matrixPolynomialEval M p ≠ 0 at hu + change -2*((N:ℝ)-2)*a*(matrixPolynomialEval M p)^2+ + 2*a*matrixPolynomialEval M p*matrixPolynomialEval M (haarPolynomialLaplacian N p)- + 2*matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialLaplacian N p)) ≥ _ + rw [show haarPolynomialValue (haarLogBarrier p a) U = + matrixPolynomialEval M (haarLogBarrier p a) from rfl,haarLogBarrier_eval] + have hq : matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialGamma p p)) / + matrixPolynomialEval M p = 2*a*matrixPolynomialEval M (haarPolynomialGamma p p) := by + rw [div_eq_iff hu] + linear_combination -hg + rw [div_eq_mul_inv] at hq + have hce : ((N:ℝ)-2)*matrixPolynomialEval M (haarPolynomialGamma p p) ≤ + matrixPolynomialEval M (haarPolynomialLaplacian N (haarPolynomialGamma p p))/2- + matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialLaplacian N p))- + 2*a*matrixPolynomialEval M (haarPolynomialGamma p p)+ + (matrixPolynomialEval M (haarPolynomialGamma p p))^2/(matrixPolynomialEval M p)^2 := by + convert hc using 1 + simp only [one_div] + rw [mul_comm ((matrixPolynomialEval M p)⁻¹),hq] + ring + have hid : + (-2*((N:ℝ)-2)+2*matrixPolynomialEval M (haarPolynomialGamma p p)/(matrixPolynomialEval M p)^2)* + (a*(matrixPolynomialEval M p)^2-matrixPolynomialEval M (haarPolynomialGamma p p)) = + -2*((N:ℝ)-2)*a*(matrixPolynomialEval M p)^2+ + 2*((N:ℝ)-2)*matrixPolynomialEval M (haarPolynomialGamma p p)+ + 2*a*matrixPolynomialEval M (haarPolynomialGamma p p)- + 2*(matrixPolynomialEval M (haarPolynomialGamma p p))^2/(matrixPolynomialEval M p)^2 := by + field_simp + ring + change _ ≥ (-2*((N:ℝ)-2)+2*matrixPolynomialEval M (haarPolynomialGamma p p)/ + (matrixPolynomialEval M p)^2)*(a*(matrixPolynomialEval M p)^2- + matrixPolynomialEval M (haarPolynomialGamma p p)) + rw [hid] + linear_combination hl+2*hce + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLogCurvature.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLogCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..230db5f8cd937b54836c045460ebd803904d799b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLogCurvature.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHessianExpansion +import OAI.Probability.InvariantIsing.Haar.HaarGammaCalculus + +namespace OAI + +/-! The pointwise curvature inequality with a logarithmic gradient correction. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def haarGradientValue {N : ℕ} (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) (a : Fin N × Fin N) : ℝ := + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator a.1 a.2) p) + +def haarHessianValue {N : ℕ} (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) (a b : Fin N × Fin N) : ℝ := + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator b.1 b.2) + (matrixPolynomialDerivation (planeGenerator a.1 a.2) p)) + +lemma haarGradientValue_sq_sum {N : ℕ} (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) : + (∑ a, (haarGradientValue p M a)^2) = matrixPolynomialEval M (haarPolynomialGamma p p) := by + simp only [Fintype.sum_prod_type,haarGradientValue,haarPolynomialGamma,map_sum,map_mul,pow_two] + +lemma haarGammaGammaValue {N : ℕ} (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialGamma p p)) = + 2*(∑ a, ∑ b, haarHessianValue p M a b*haarGradientValue p M a*haarGradientValue p M b) := by + have hd (a : Fin N × Fin N) : matrixPolynomialEval M + (matrixPolynomialDerivation (planeGenerator a.1 a.2) (haarPolynomialGamma p p)) = + 2*(∑ b, haarGradientValue p M b*haarHessianValue p M b a) := by + rw [haarPolynomialDerivation_gamma_sq] + simp only [map_sum,map_mul,map_ofNat,Fintype.sum_prod_type,Finset.mul_sum, + haarGradientValue,haarHessianValue] + have hex : matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialGamma p p)) = + ∑ a : Fin N × Fin N, haarGradientValue p M a* + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator a.1 a.2) + (haarPolynomialGamma p p)) := by + simp only [haarPolynomialGamma,map_sum,map_mul,Fintype.sum_prod_type,haarGradientValue] + rw [hex] + simp_rw [hd] + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + ring + +lemma haarLogCurvature {N : ℕ} (p : MatrixPolynomial N) + (M : Matrix (Fin N) (Fin N) ℝ) (c : ℝ) : + ((N:ℝ)-2)*matrixPolynomialEval M (haarPolynomialGamma p p) ≤ + matrixPolynomialEval M (haarPolynomialLaplacian N (haarPolynomialGamma p p))/2- + matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialLaplacian N p))- + c*matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialGamma p p))+ + c^2*(matrixPolynomialEval M (haarPolynomialGamma p p))^2 := by + have hc := matrixPolynomial_corrected_hessian_bound p M c + have he := congrArg (matrixPolynomialEval M) (haarPolynomial_bochner_identity p) + simp only [map_mul,map_ofNat,map_add,map_sum,map_pow] at he + have hc' : ((N:ℝ)-2)*matrixPolynomialEval M (haarPolynomialGamma p p) ≤ + ∑ a : Fin N × Fin N, ∑ b : Fin N × Fin N, + (haarHessianValue p M a b-c*haarGradientValue p M a*haarGradientValue p M b)^2 := by + simpa only [Fintype.sum_prod_type,haarHessianValue,haarGradientValue] using hc + rw [sum_corrected_hessian_sq,haarGradientValue_sq_sum] at hc' + rw [haarGammaGammaValue] + have he' : matrixPolynomialEval M (haarPolynomialLaplacian N (haarPolynomialGamma p p)) = + 2*(matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialLaplacian N p))+ + ∑ a : Fin N × Fin N, ∑ b : Fin N × Fin N, (haarHessianValue p M a b)^2) := by + simpa only [Fintype.sum_prod_type,haarHessianValue] using he + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarLogIntegration.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarLogIntegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa3c24f84ae2d55be727bc17d03533cba1af8ed0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarLogIntegration.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Haar.HaarContinuousDerivative +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialGamma + +namespace OAI + +/-! Integration by parts for the logarithm of a positive polynomial on SO(N). -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +open scoped BigOperators +namespace InvariantIsing + +theorem integral_haar_laplacian_log {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] (p : MatrixPolynomial N) + (hp : ∀ U : SpecialOrthogonal N, 0 < haarPolynomialValue p U) : + (∫ U, haarPolynomialValue (haarPolynomialLaplacian N p) U*Real.log (haarPolynomialValue p U) ∂μ) = + -(∫ U, haarPolynomialValue (haarPolynomialGamma p p) U/haarPolynomialValue p U ∂μ) := by + let D (i j : Fin N) := matrixPolynomialDerivation (planeGenerator i j) + let R (i j : Fin N) (U : SpecialOrthogonal N) := + haarPolynomialValue (D i j (D i j p)) U*Real.log (haarPolynomialValue p U)+ + (haarPolynomialValue (D i j p) U)^2/haarPolynomialValue p U + have hlog : Continuous (fun U : SpecialOrthogonal N => Real.log (haarPolynomialValue p U)) := + (continuous_haarPolynomialValue p).log (fun U => (hp U).ne') + have hR (i j : Fin N) : Continuous (R i j) := + ((continuous_haarPolynomialValue _).mul hlog).add + (((continuous_haarPolynomialValue _).pow 2).div (continuous_haarPolynomialValue p) + (fun U => (hp U).ne')) + have hz (i j : Fin N) : (∫ U, R i j U ∂μ) = 0 := by + apply integral_haar_continuous_derivative μ i j + (fun U => haarPolynomialValue (D i j p) U*Real.log (haarPolynomialValue p U)) + (R i j) ((continuous_haarPolynomialValue _).mul hlog) (hR i j) + intro U t + have hq := hasDerivAt_specialPlaneRotation_polynomial (D i j p) i j U t + have hpp := hasDerivAt_specialPlaneRotation_polynomial p i j U t + convert hq.mul (hpp.log (hp (specialPlaneRotation i j t*U)).ne') using 1 + · rfl + · dsimp only [R,D,haarPolynomialValue] + ring + have hs : (∫ U, ∑ i, ∑ j, R i j U ∂μ) = 0 := by + rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ + (fun j _ => continuous_haar_integrable μ _ (hR i j)))] + apply Finset.sum_eq_zero + intro i _ + rw [integral_finsetSum _ (fun j _ => continuous_haar_integrable μ _ (hR i j))] + simp only [hz,Finset.sum_const_zero] + have he (U : SpecialOrthogonal N) : (∑ i, ∑ j, R i j U) = + haarPolynomialValue (haarPolynomialLaplacian N p) U*Real.log (haarPolynomialValue p U)+ + haarPolynomialValue (haarPolynomialGamma p p) U/haarPolynomialValue p U := by + simp only [R,D,haarPolynomialValue,haarPolynomialLaplacian_apply,haarPolynomialGamma, + map_sum,map_mul,Finset.sum_add_distrib,Finset.sum_mul,Finset.sum_div,pow_two] + simp_rw [he] at hs + have hi1 : Integrable (fun U => haarPolynomialValue (haarPolynomialLaplacian N p) U* + Real.log (haarPolynomialValue p U)) μ := + continuous_haar_integrable μ _ ((continuous_haarPolynomialValue _).mul hlog) + have hi2 : Integrable (fun U => haarPolynomialValue (haarPolynomialGamma p p) U/ + haarPolynomialValue p U) μ := continuous_haar_integrable μ _ + ((continuous_haarPolynomialValue _).div (continuous_haarPolynomialValue _) (fun U => (hp U).ne')) + rw [integral_add hi1 hi2] at hs + exact eq_neg_of_add_eq_zero_left hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarMinimumGradient.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarMinimumGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae0856bea40f6869b4fe7c9fbb146863dc21ab7d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarMinimumGradient.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMinimum +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialGamma + +namespace OAI + +/-! Every coordinate-plane derivative vanishes at a global polynomial minimum. -/ +noncomputable section +open Matrix MvPolynomial Filter +open scoped Topology BigOperators +namespace InvariantIsing + +lemma haarPolynomialDerivation_zero_at_min {N : ℕ} + (p : MatrixPolynomial N) (U : SpecialOrthogonal N) + (hmin : ∀ V : SpecialOrthogonal N, haarPolynomialValue p U ≤ haarPolynomialValue p V) + (i j : Fin N) : + haarPolynomialValue (matrixPolynomialDerivation (planeGenerator i j) p) U = 0 := by + have hm : IsLocalMin (fun t => haarPolynomialValue p (specialPlaneRotation i j t*U)) 0 := by + apply Filter.Eventually.of_forall + intro t + simpa only [specialPlaneRotation_zero,one_mul] using hmin (specialPlaneRotation i j t*U) + have hd := hasDerivAt_specialPlaneRotation_polynomial p i j U 0 + simp only [specialPlaneRotation_zero,one_mul] at hd + exact hm.hasDerivAt_eq_zero hd + +lemma haarPolynomialGamma_zero_at_min {N : ℕ} + (p q : MatrixPolynomial N) (U : SpecialOrthogonal N) + (hmin : ∀ V : SpecialOrthogonal N, haarPolynomialValue p U ≤ haarPolynomialValue p V) : + haarPolynomialValue (haarPolynomialGamma q p) U = 0 := by + change matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) _ = 0 + simp only [haarPolynomialGamma,map_sum,map_mul] + apply Finset.sum_eq_zero + intro i _ + apply Finset.sum_eq_zero + intro j _ + change _*haarPolynomialValue (matrixPolynomialDerivation (planeGenerator i j) p) U = 0 + rw [haarPolynomialDerivation_zero_at_min p U hmin i j,mul_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneAdjoint.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneAdjoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c431ba9c0a8af01ae8728ea9e78c61c55d1ee5b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneAdjoint.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPlaneFrame + +namespace OAI + +/-! Coefficients of the adjoint action in the redundant coordinate-plane frame. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma planeGenerator_adjoint_expansion {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) (i j : Fin N) : + A*planeGenerator i j-planeGenerator i j*A = + (∑ k, A k i • planeGenerator k j)+(∑ k, A k j • planeGenerator i k) := by + classical + have hskew (k l : Fin N) : A k l = -A l k := congrFun (congrFun hA l) k + ext k l + simp only [planeGenerator,Matrix.mul_apply,Matrix.sub_apply,Matrix.add_apply,Matrix.smul_apply, + Matrix.sum_apply,Matrix.single_apply,smul_eq_mul,mul_sub,sub_mul, + Finset.sum_sub_distrib] + simp only [ite_and,mul_ite,ite_mul,mul_one,one_mul,mul_zero,zero_mul, + Finset.sum_ite_eq,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + simp only [Finset.sum_ite_irrel,Finset.sum_ite_eq,Finset.sum_ite_eq', + Finset.sum_const_zero,Finset.mem_univ,ite_true] + rw [hskew l i,hskew l j] + split_ifs <;> ring + +lemma sum_skew_symmetric_coeff {N : ℕ} {V : Type*} + [AddCommGroup V] [Module ℝ V] + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) + (T : Fin N → Fin N → V) (hT : ∀ i j, T i j = T j i) : + (∑ i, ∑ j, A i j • T i j) = 0 := by + have hskew (i j : Fin N) : A j i = -A i j := congrFun (congrFun hA i) j + have hs : (∑ i, ∑ j, A i j • T i j) = -(∑ i, ∑ j, A i j • T i j) := by + calc + (∑ i, ∑ j, A i j • T i j) = ∑ i, ∑ j, A j i • T j i := Finset.sum_comm + _ = ∑ i, ∑ j, -(A i j • T i j) := by + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro j _ + rw [hskew i j,hT j i,neg_smul] + _ = -(∑ i, ∑ j, A i j • T i j) := by + simp only [Finset.sum_neg_distrib] + have hz : (2 : ℝ) • (∑ i, ∑ j, A i j • T i j) = 0 := by + rw [two_smul] + nth_rw 1 [hs] + exact neg_add_cancel _ + exact (smul_eq_zero.mp hz).resolve_left (by norm_num) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneCasimir.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneCasimir.lean new file mode 100644 index 0000000000000000000000000000000000000000..077d1feffe54f3dd64438dddc14ef3c296c7ce02 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneCasimir.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPlaneSandwich + +namespace OAI + +/-! Exact orthogonal Lie-algebra contractions in the unnormalized Frobenius convention. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma sum_planeGenerator_sq {N : ℕ} : + (∑ i : Fin N, ∑ j : Fin N, planeGenerator i j*planeGenerator i j) = + (-2*((N : ℝ)-1)) • (1 : Matrix (Fin N) (Fin N) ℝ) := by + have h := sum_planeGenerator_sandwich (1 : Matrix (Fin N) (Fin N) ℝ) + simp only [mul_one,transpose_one,trace_one,Fintype.card_fin] at h + rw [h] + module + +lemma skew_matrix_trace_zero {N : ℕ} {A : Matrix (Fin N) (Fin N) ℝ} + (hA : A.transpose = -A) : A.trace = 0 := by + have h := congrArg Matrix.trace hA + rw [Matrix.trace_transpose,Matrix.trace_neg] at h + linarith + +theorem sum_planeGenerator_double_commutator {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) : + (∑ i : Fin N, ∑ j : Fin N, + (planeGenerator i j*(planeGenerator i j*A-A*planeGenerator i j)- + (planeGenerator i j*A-A*planeGenerator i j)*planeGenerator i j)) = + (-4*((N : ℝ)-2)) • A := by + have he (i j : Fin N) : + planeGenerator i j*(planeGenerator i j*A-A*planeGenerator i j)- + (planeGenerator i j*A-A*planeGenerator i j)*planeGenerator i j = + (planeGenerator i j*planeGenerator i j)*A- + (2 : ℝ) • (planeGenerator i j*A*planeGenerator i j)+ + A*(planeGenerator i j*planeGenerator i j) := by + simp only [two_smul] + noncomm_ring + simp_rw [he,Finset.sum_add_distrib,Finset.sum_sub_distrib] + have hl : (∑ i : Fin N, ∑ j : Fin N, (planeGenerator i j*planeGenerator i j)*A) = + (∑ i : Fin N, ∑ j : Fin N, planeGenerator i j*planeGenerator i j)*A := by + simp only [Finset.sum_mul] + have hr : (∑ i : Fin N, ∑ j : Fin N, A*(planeGenerator i j*planeGenerator i j)) = + A*(∑ i : Fin N, ∑ j : Fin N, planeGenerator i j*planeGenerator i j) := by + simp only [Finset.mul_sum] + have hm : (∑ i : Fin N, ∑ j : Fin N, (2 : ℝ) • (planeGenerator i j*A*planeGenerator i j)) = + (2 : ℝ) • (∑ i : Fin N, ∑ j : Fin N, planeGenerator i j*A*planeGenerator i j) := by + simp only [Finset.smul_sum] + rw [hl,hr,hm,sum_planeGenerator_sq,sum_planeGenerator_sandwich,hA,skew_matrix_trace_zero hA] + simp only [mul_zero,zero_smul,sub_zero,smul_mul_assoc,mul_smul_comm,one_mul,mul_one] + module + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneFrame.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc813a69e4401cabfc3bb36b09495d15337c9ca3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneFrame.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Haar.HaarFrobeniusBracket + +namespace OAI + +/-! Exact coordinate-plane frame identities in the skew matrix space. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma planeGenerator_swap {N : ℕ} (i j : Fin N) : + planeGenerator j i = -planeGenerator i j := by + simp only [planeGenerator,neg_sub] + +lemma sum_entry_planeGenerator {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + (∑ i, ∑ j, A i j • planeGenerator i j) = A-A.transpose := by + classical + ext k l + simp only [Matrix.sum_apply,Matrix.sub_apply,Matrix.smul_apply,smul_eq_mul, + planeGenerator,Matrix.single_apply,mul_sub,Finset.sum_sub_distrib] + simp [ite_and,Matrix.transpose_apply] + +lemma matrixFrobeniusPair_eq_sum {N : ℕ} (A B : Matrix (Fin N) (Fin N) ℝ) : + matrixFrobeniusPair A B = ∑ i, ∑ j, A i j*B i j := by + simp only [matrixFrobeniusPair,Matrix.trace,Matrix.diag_apply,Matrix.mul_apply, + Matrix.transpose_apply] + exact Finset.sum_comm + +lemma matrixFrobeniusPair_plane {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (i j : Fin N) : + matrixFrobeniusPair A (planeGenerator i j) = A i j-A j i := by + classical + rw [matrixFrobeniusPair_eq_sum] + simp [planeGenerator,Matrix.single_apply,Matrix.sub_apply,mul_sub, + Finset.sum_sub_distrib,ite_and] + +lemma skew_matrix_bracket {N : ℕ} {A B : Matrix (Fin N) (Fin N) ℝ} + (hA : A.transpose = -A) (hB : B.transpose = -B) : + (A*B-B*A).transpose = -(A*B-B*A) := by + simp only [Matrix.transpose_sub,Matrix.transpose_mul,hA,hB,neg_mul_neg,neg_sub] + +lemma matrixFrobeniusPair_plane_skew {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) (i j : Fin N) : + matrixFrobeniusPair A (planeGenerator i j) = 2*A i j := by + have h : A j i = -A i j := congrFun (congrFun hA i) j + rw [matrixFrobeniusPair_plane,h] + ring + +lemma sum_matrixFrobeniusPair_plane_sq {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) : + (∑ i, ∑ j, (matrixFrobeniusPair A (planeGenerator i j))^2) = + 4*matrixFrobeniusPair A A := by + simp_rw [matrixFrobeniusPair_plane_skew A hA] + rw [matrixFrobeniusPair_self] + simp only [mul_pow,show (2:ℝ)^2=4 by norm_num,Finset.mul_sum] + +/-- A linear functional on skew matrices is represented by its plane coordinates. -/ +lemma plane_functional_representation {N : ℕ} + (ell : Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ) + (B : Matrix (Fin N) (Fin N) ℝ) (hB : B.transpose = -B) : + matrixFrobeniusPair (Matrix.of fun i j => ell (planeGenerator i j)) B = 2*ell B := by + have h := congrArg ell (sum_entry_planeGenerator B) + simp only [map_sum,map_smul,map_sub,hB,map_neg,smul_eq_mul] at h + rw [matrixFrobeniusPair_eq_sum] + calc + (∑ i, ∑ j, ell (planeGenerator i j)*B i j) = + ∑ i, ∑ j, B i j*ell (planeGenerator i j) := by + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro j _; ring + _ = 2*ell B := by linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneSandwich.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneSandwich.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8cf065cf24d41d9c0bbea7bf709f3d1dbdba956 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPlaneSandwich.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Haar.PlaneRotation + +namespace OAI + +/-! The finite matrix contraction behind the orthogonal-group curvature calculation. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma planeGenerator_sandwich {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (i j : Fin N) : + planeGenerator i j*A*planeGenerator i j = + Matrix.single i j (A j i)-Matrix.single j j (A i i)- + Matrix.single i i (A j j)+Matrix.single j i (A i j) := by + simp only [planeGenerator,sub_mul,mul_sub,Matrix.single_mul_mul_single,one_mul,mul_one] + abel + +lemma sum_single_transpose {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + (∑ i, ∑ j, Matrix.single i j (A j i)) = A.transpose := by + classical + ext k l + simp [Matrix.sum_apply,Matrix.single_apply,ite_and] + +lemma sum_single_trace_diagonal {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + (∑ i, ∑ j, Matrix.single i i (A j j)) = A.trace • (1 : Matrix (Fin N) (Fin N) ℝ) := by + classical + ext k l + by_cases h : k=l + · subst l + simp [Matrix.sum_apply,Matrix.single_apply,Matrix.trace,Matrix.diag_apply] + · simp [Matrix.sum_apply,Matrix.single_apply,h,ite_and] + +theorem sum_planeGenerator_sandwich {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) : + (∑ i, ∑ j, planeGenerator i j*A*planeGenerator i j) = + (2 : ℝ) • A.transpose-(2*A.trace) • (1 : Matrix (Fin N) (Fin N) ℝ) := by + simp_rw [planeGenerator_sandwich,Finset.sum_add_distrib,Finset.sum_sub_distrib] + have hs : (∑ i : Fin N, ∑ j : Fin N, Matrix.single j i (A i j)) = A.transpose := by + rw [Finset.sum_comm] + exact sum_single_transpose A + have hd : (∑ i : Fin N, ∑ j : Fin N, Matrix.single j j (A i i)) = + A.trace • (1 : Matrix (Fin N) (Fin N) ℝ) := by + rw [Finset.sum_comm] + exact sum_single_trace_diagonal A + rw [sum_single_transpose,sum_single_trace_diagonal,hs,hd] + module + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialCurvature.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7dd04425dee7d0cf170f14344bbfa16e42f2017 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialCurvature.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialGamma +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialCurve +import OAI.Probability.InvariantIsing.Haar.HaarHessianBound + +namespace OAI + +/-! The curvature inequality for polynomial observables, proved by finite algebra. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def matrixPolynomialDifferential {N : ℕ} + (p : MatrixPolynomial N) (M : Matrix (Fin N) (Fin N) ℝ) : + Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ where + toFun A := matrixPolynomialEval M (matrixPolynomialDerivation A p) + map_add' A B := by simp + map_smul' c A := by simp [Derivation.smul_apply] + +lemma matrixPolynomial_hessian_bound {N : ℕ} + (p : MatrixPolynomial N) (M : Matrix (Fin N) (Fin N) ℝ) : + ((N : ℝ)-2)*(matrixPolynomialEval M (haarPolynomialGamma p p)) ≤ + ∑ i, ∑ j, ∑ k, ∑ l, + (matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator k l) + (matrixPolynomialDerivation (planeGenerator i j) p)))^2 := by + let ell := matrixPolynomialDifferential p M + let H : (Fin N × Fin N) → (Fin N × Fin N) → ℝ := fun a b => + matrixPolynomialEval M (matrixPolynomialDerivation (planeGenerator b.1 b.2) + (matrixPolynomialDerivation (planeGenerator a.1 a.2) p)) + have hd (a b : Fin N × Fin N) : H a b-H b a = + ell (planeGenerator a.1 a.2*planeGenerator b.1 b.2- + planeGenerator b.1 b.2*planeGenerator a.1 a.2) := by + change matrixPolynomialEval M + (matrixPolynomialDerivation (planeGenerator b.1 b.2) + (matrixPolynomialDerivation (planeGenerator a.1 a.2) p))- + matrixPolynomialEval M + (matrixPolynomialDerivation (planeGenerator a.1 a.2) + (matrixPolynomialDerivation (planeGenerator b.1 b.2) p)) = + matrixPolynomialEval M (matrixPolynomialDerivation + (planeGenerator a.1 a.2*planeGenerator b.1 b.2- + planeGenerator b.1 b.2*planeGenerator a.1 a.2) p) + rw [← map_sub] + exact congrArg (matrixPolynomialEval M) (Derivation.congr_fun + (matrixPolynomialDerivation_commutator + (planeGenerator b.1 b.2) (planeGenerator a.1 a.2)) p) + have hb := sum_antisymmetric_square_le H + simp_rw [hd] at hb + simp only [Fintype.sum_prod_type] at hb + rw [sum_plane_functional_double_bracket_sq ell] at hb + have hg : (∑ i : Fin N, ∑ j : Fin N, (ell (planeGenerator i j))^2) = + matrixPolynomialEval M (haarPolynomialGamma p p) := by + simp only [haarPolynomialGamma,map_sum,map_mul,pow_two] + rfl + rw [hg] at hb + dsimp only [H] at hb + linarith + +/-- With the ordered-plane Laplacian, the Ricci lower bound is `N - 2`. -/ +theorem matrixPolynomial_curvature {N : ℕ} + (p : MatrixPolynomial N) (M : Matrix (Fin N) (Fin N) ℝ) : + ((N : ℝ)-2)*matrixPolynomialEval M (haarPolynomialGamma p p) ≤ + matrixPolynomialEval M (haarPolynomialLaplacian N (haarPolynomialGamma p p))/2- + matrixPolynomialEval M (haarPolynomialGamma p (haarPolynomialLaplacian N p)) := by + have h := congrArg (matrixPolynomialEval M) (haarPolynomial_bochner_identity p) + simp only [map_mul,map_ofNat,map_add,map_sum,map_pow] at h + have hb := matrixPolynomial_hessian_bound p M + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialCurve.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialCurve.lean new file mode 100644 index 0000000000000000000000000000000000000000..d17743d9f38f48e40e68f333503a93eb7e93f0fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialCurve.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialDerivation +import OAI.Probability.InvariantIsing.Haar.SpecialPlaneRotation + +namespace OAI + +/-! Evaluation of polynomial Lie derivatives on genuine matrix curves. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def matrixPolynomialEval {N : ℕ} (M : Matrix (Fin N) (Fin N) ℝ) : + MatrixPolynomial N →ₐ[ℝ] ℝ := + MvPolynomial.aeval fun ij => M ij.1 ij.2 + +@[simp] lemma matrixPolynomialEval_X {N : ℕ} + (M : Matrix (Fin N) (Fin N) ℝ) (i j : Fin N) : + matrixPolynomialEval M (X (i,j)) = M i j := + MvPolynomial.aeval_X _ _ + +@[simp] lemma matrixPolynomialEval_C {N : ℕ} + (M : Matrix (Fin N) (Fin N) ℝ) (c : ℝ) : + matrixPolynomialEval M (C c) = c := + MvPolynomial.aeval_C _ _ + +theorem hasDerivAt_matrixPolynomialEval {N : ℕ} + (p : MatrixPolynomial N) (M : ℝ → Matrix (Fin N) (Fin N) ℝ) + (A : Matrix (Fin N) (Fin N) ℝ) (t : ℝ) + (hM : ∀ i j, HasDerivAt (fun s => M s i j) ((A*M t) i j) t) : + HasDerivAt (fun s => matrixPolynomialEval (M s) p) + (matrixPolynomialEval (M t) (matrixPolynomialDerivation A p)) t := by + induction p using MvPolynomial.induction_on with + | C c => simpa using hasDerivAt_const t c + | add p q hp hq => + convert hp.add hq using 1 + all_goals simp only [map_add] + all_goals rfl + | mul_X p ij hp => + rcases ij with ⟨i,j⟩ + have hx : matrixPolynomialEval (M t) + (matrixPolynomialDerivation A (X (i,j))) = (A*M t) i j := by + simp only [matrixPolynomialDerivation_X,map_sum,map_smul, + matrixPolynomialEval_X,smul_eq_mul,Matrix.mul_apply] + convert hp.mul (hM i j) using 1 + · simp only [map_mul,matrixPolynomialEval_X] + rfl + · rw [Derivation.leibniz,smul_eq_mul,smul_eq_mul,map_add,map_mul,map_mul, + hx,matrixPolynomialEval_X] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialDerivation.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialDerivation.lean new file mode 100644 index 0000000000000000000000000000000000000000..383666a5464d2798d804b99bbb832d58274263f2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialDerivation.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Haar.HaarFrobeniusBracket +import Mathlib.Algebra.MvPolynomial.Derivation +import Mathlib.RingTheory.Derivation.Lie + +namespace OAI + +/-! Polynomial directional derivatives for left matrix multiplication. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +abbrev MatrixPolynomial (N : ℕ) := MvPolynomial (Fin N × Fin N) ℝ + +/-- Differentiate a matrix polynomial along the vector field `U ↦ A U`. -/ +def matrixPolynomialDerivation {N : ℕ} : + Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] Derivation ℝ (MatrixPolynomial N) (MatrixPolynomial N) where + toFun A := MvPolynomial.mkDerivation ℝ fun ij => + ∑ k, A ij.1 k • MvPolynomial.X (k,ij.2) + map_add' A B := by + apply MvPolynomial.derivation_ext + intro ij + simp [MvPolynomial.mkDerivation_X,Matrix.add_apply,add_smul,Finset.sum_add_distrib] + map_smul' c A := by + apply MvPolynomial.derivation_ext + intro ij + simp [MvPolynomial.mkDerivation_X,Matrix.smul_apply,smul_smul,Finset.smul_sum] + +@[simp] lemma matrixPolynomialDerivation_X {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (i j : Fin N) : + matrixPolynomialDerivation A (X (i,j)) = ∑ k, A i k • X (k,j) := + MvPolynomial.mkDerivation_X _ _ _ + +lemma matrixPolynomialDerivation_mul_X {N : ℕ} + (A B : Matrix (Fin N) (Fin N) ℝ) (i j : Fin N) : + matrixPolynomialDerivation A (matrixPolynomialDerivation B (X (i,j))) = + matrixPolynomialDerivation (B*A) (X (i,j)) := by + simp only [matrixPolynomialDerivation_X,map_sum,Derivation.map_smul_of_tower,Finset.smul_sum, + smul_smul,Matrix.mul_apply,Finset.sum_smul] + rw [Finset.sum_comm] + +/-- Left matrix vector fields give the opposite matrix Lie bracket. -/ +theorem matrixPolynomialDerivation_commutator {N : ℕ} + (A B : Matrix (Fin N) (Fin N) ℝ) : + ⁅matrixPolynomialDerivation A,matrixPolynomialDerivation B⁆ = + matrixPolynomialDerivation (B*A-A*B) := by + apply MvPolynomial.derivation_ext + rintro ⟨i,j⟩ + rw [Derivation.commutator_apply,matrixPolynomialDerivation_mul_X, + matrixPolynomialDerivation_mul_X,map_sub,Derivation.sub_apply] + +@[simp] lemma matrixPolynomialDerivation_plane_X {N : ℕ} (i j k l : Fin N) : + matrixPolynomialDerivation (planeGenerator i j) (X (k,l)) = + (if k=i then X (j,l) else 0)-(if k=j then X (i,l) else 0) := by + simp [matrixPolynomialDerivation_X,planeGenerator,Matrix.single_apply,ite_and,eq_comm] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialEntropyBound.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialEntropyBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..e77f5642d2c2ce9f212fdaf2e6467283efdec2bf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialEntropyBound.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Haar.HaarHeatFisherBound + +namespace OAI + +/-! The entropy inequality for positive polynomials with bounded logarithmic gradient. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem haarPolynomial_entropy_bound {N d : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : haarPolynomialSpace N d) (ε C : ℝ) (hε : 0 < ε) + (hp : ∀ U : SpecialOrthogonal N, ε ≤ haarPolynomialValue (p : MatrixPolynomial N) U) + (hC : ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialGamma (p : MatrixPolynomial N) p) U ≤ + C*(haarPolynomialValue (p : MatrixPolynomial N) U)^2) : + (∫ U, haarPolynomialValue (p : MatrixPolynomial N) U* + Real.log (haarPolynomialValue (p : MatrixPolynomial N) U) ∂μ)- + (∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ)* + Real.log (∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ) ≤ + C*(∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ)/(2*((N:ℝ)-2)) := by + let ρ := (N:ℝ)-2 + let m := ∫ U, haarPolynomialValue (p : MatrixPolynomial N) U ∂μ + let k := m*C/(2*ρ) + let I (t : ℝ) := ∫ U, haarPolynomialValue (haarPolynomialGamma + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N)) U/ + haarPolynomialValue ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N) U ∂μ + let J (t : ℝ) := haarHeatEntropy μ p t-k*Real.exp (-2*ρ*t) + have hρ : 0 < ρ := by + have h3 : (3:ℝ) ≤ N := by exact_mod_cast hN + dsimp only [ρ] + linarith + have hkc : k*(2*ρ)=m*C := by + dsimp only [k] + field_simp + have hD (t : ℝ) (ht : 0 < t) : + HasDerivAt J (-I t+m*C*Real.exp (-2*ρ*t)) t := by + have he : HasDerivAt (fun s : ℝ => Real.exp (-2*ρ*s)) + (-2*ρ*Real.exp (-2*ρ*t)) t := by + convert ((hasDerivAt_id t).const_mul (-2*ρ)).exp using 1 + all_goals simp only [id_eq] + all_goals ring + have hd := (haarHeatEntropy_hasDerivAt μ p ε hε hp ht).sub (he.const_mul k) + convert hd using 1 + change -I t+m*C*Real.exp (-2*ρ*t) = -I t-k*(-2*ρ*Real.exp (-2*ρ*t)) + rw [← hkc] + ring + have hnon (t : ℝ) (ht : 0 < t) : 0 ≤ -I t+m*C*Real.exp (-2*ρ*t) := by + have hb := haarHeat_fisher_bound μ p ε C hε hp hC ht.le + change I t ≤ C*Real.exp (-2*ρ*t)*m at hb + nlinarith + have hcont : ContinuousOn J (Ici 0) := + (continuousOn_haarPolynomialHeat_test_integral μ p (fun x => x*Real.log x) + Real.continuous_mul_log).sub + ((continuous_const.mul (Real.continuous_exp.comp (continuous_const.mul continuous_id))).continuousOn) + have hmono : MonotoneOn J (Ici 0) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg (convex_Ici 0) hcont + (f' := fun t => -I t+m*C*Real.exp (-2*ρ*t)) + · intro t ht + have ht' : 0 < t := by simpa only [interior_Ici,mem_Ioi] using ht + exact (hD t ht').hasDerivWithinAt + · intro t ht + exact hnon t (by simpa only [interior_Ici,mem_Ioi] using ht) + have hexp : Tendsto (fun t : ℝ => Real.exp (-2*ρ*t)) atTop (𝓝 0) := by + have he := (tendsto_haar_gradient_envelope hN 1).comp + (tendsto_id.const_mul_atTop (by norm_num : (0:ℝ) < 2)) + convert he using 1 + funext t + simp only [one_mul,Function.comp_def,id_eq] + congr 1 + dsimp only [ρ] + ring + have hE : Tendsto (haarHeatEntropy μ p) atTop (𝓝 (m*Real.log m)) := + haarPolynomialHeat_test_tendsto_mean hN μ p (fun x => x*Real.log x) Real.continuous_mul_log + have hJ : Tendsto J atTop (𝓝 (m*Real.log m)) := by + simpa only [mul_zero,sub_zero] using hE.sub (hexp.const_mul k) + have h0 : J 0 ≤ m*Real.log m := ge_of_tendsto hJ (by + filter_upwards [eventually_ge_atTop (0:ℝ)] with t ht + exact hmono (by simp) ht ht) + have hz : J 0 = (∫ U, haarPolynomialValue (p : MatrixPolynomial N) U* + Real.log (haarPolynomialValue (p : MatrixPolynomial N) U) ∂μ)-k := by + simp only [J,haarHeatEntropy,haarPolynomialHeat_zero,mul_zero,Real.exp_zero,mul_one] + rw [hz] at h0 + change _-m*Real.log m ≤ C*m/(2*ρ) + dsimp only [k] at h0 + linear_combination h0 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialEvolution.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..95a888746c665ec40fb94dabf3addbd066bff672 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialEvolution.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMinimum + +namespace OAI + +/-! Positivity comparison for polynomial supersolutions of the rotation heat equation. -/ +noncomputable section +open Matrix MvPolynomial Set +namespace InvariantIsing + +theorem haarPolynomial_evolution_nonneg {N : ℕ} {T : ℝ} (hT : 0 ≤ T) + (p : ℝ → MatrixPolynomial N) (dp : ℝ → SpecialOrthogonal N → ℝ) + (hc : ContinuousOn (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue (p z.1) z.2) + (Icc (0 : ℝ) T ×ˢ Set.univ)) + (hi : ∀ U : SpecialOrthogonal N, 0 ≤ haarPolynomialValue (p 0) U) + (hd : ∀ t ∈ Ioc (0 : ℝ) T, ∀ U : SpecialOrthogonal N, + HasDerivAt (fun s => haarPolynomialValue (p s) U) (dp t U) t) + (hpde : ∀ t ∈ Ioc (0 : ℝ) T, ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialLaplacian N (p t)) U ≤ dp t U) : + ∀ t ∈ Icc (0 : ℝ) T, ∀ U : SpecialOrthogonal N, + 0 ≤ haarPolynomialValue (p t) U := by + let W (t : ℝ) (U : SpecialOrthogonal N) := Real.exp (-t)*haarPolynomialValue (p t) U + let D (z : ℝ × SpecialOrthogonal N) := + Real.exp (-z.1)*(dp z.1 z.2-haarPolynomialValue (p z.1) z.2) + let B (t : ℝ) (U : SpecialOrthogonal N) := + Real.exp (-t)*haarPolynomialValue (haarPolynomialLaplacian N (p t)) U + have hcW : ContinuousOn (fun z : ℝ × SpecialOrthogonal N => W z.1 z.2) + (Icc (0 : ℝ) T ×ˢ Set.univ) := + (Real.continuous_exp.comp continuous_fst.neg).continuousOn.mul hc + have hiW : ∀ U, 0 ≤ W 0 U := by simpa only [W,neg_zero,Real.exp_zero,one_mul] using hi + have hdW (t : ℝ) (ht : t ∈ Ioc (0 : ℝ) T) (U : SpecialOrthogonal N) : + HasDerivAt (fun s => W s U) (D (t,U)) t := by + have he : HasDerivAt (fun s : ℝ => Real.exp (-s)) (-Real.exp (-t)) t := by + convert ((hasDerivAt_id t).fun_neg).exp using 1 + all_goals simp only [id_eq,mul_neg,mul_one] + convert he.mul (hd t ht U) using 1 + dsimp only [D] + ring + have hP (t : ℝ) (ht : t ∈ Ioc (0 : ℝ) T) (U : SpecialOrthogonal N) : + B t U-W t U ≤ D (t,U) := by + dsimp only [B,W,D] + nlinarith [mul_le_mul_of_nonneg_left (hpde t ht U) (Real.exp_pos (-t)).le] + have hS (t : ℝ) (_ : t ∈ Icc (0 : ℝ) T) (U : SpecialOrthogonal N) + (hm : ∀ V, W t U ≤ W t V) : 0 ≤ B t U := by + apply mul_nonneg (Real.exp_pos (-t)).le + apply haarPolynomialLaplacian_nonneg_at_min + intro V + exact (mul_le_mul_iff_right₀ (Real.exp_pos (-t))).mp (hm V) + have hz := compact_parabolic_nonneg hT W D B hcW hiW hdW hP hS + intro t ht U + exact nonneg_of_mul_nonneg_right (hz t ht U) (Real.exp_pos (-t)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialGamma.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialGamma.lean new file mode 100644 index 0000000000000000000000000000000000000000..d09e74562c775eadd4a8fb513675fb184d0f064c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialGamma.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialLaplacian + +namespace OAI + +/-! Product and second-order identities for the actual polynomial rotation operator. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma derivation_double_product {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] + (D : Derivation R A A) (p q : A) : + D (D (p*q)) = p*D (D q)+q*D (D p)+2*(D p*D q) := by + simp only [Derivation.leibniz,map_add,smul_eq_mul] + ring + +def haarPolynomialGamma {N : ℕ} (p q : MatrixPolynomial N) : MatrixPolynomial N := + ∑ i, ∑ j, matrixPolynomialDerivation (planeGenerator i j) p* + matrixPolynomialDerivation (planeGenerator i j) q + +lemma haarPolynomialLaplacian_mul {N : ℕ} (p q : MatrixPolynomial N) : + haarPolynomialLaplacian N (p*q) = p*haarPolynomialLaplacian N q+ + q*haarPolynomialLaplacian N p+2*haarPolynomialGamma p q := by + simp only [haarPolynomialLaplacian_apply,derivation_double_product, + haarPolynomialGamma,Finset.sum_add_distrib,Finset.mul_sum] + +lemma haarPolynomialLaplacian_sq {N : ℕ} (p : MatrixPolynomial N) : + haarPolynomialLaplacian N (p^2) = + 2*(p*haarPolynomialLaplacian N p+haarPolynomialGamma p p) := by + rw [pow_two,haarPolynomialLaplacian_mul] + ring + +/-- The exact Bochner identity before the nonnegative Hessian estimate. -/ +theorem haarPolynomial_bochner_identity {N : ℕ} (p : MatrixPolynomial N) : + haarPolynomialLaplacian N (haarPolynomialGamma p p) = + 2*(haarPolynomialGamma p (haarPolynomialLaplacian N p)+ + ∑ i, ∑ j, ∑ k, ∑ l, + (matrixPolynomialDerivation (planeGenerator k l) + (matrixPolynomialDerivation (planeGenerator i j) p))^2) := by + unfold haarPolynomialGamma + simp only [map_sum] + simp_rw [← pow_two,haarPolynomialLaplacian_sq, + haarPolynomialLaplacian_derivation _ (planeGenerator_transpose _ _)] + simp only [haarPolynomialGamma,pow_two,mul_add,Finset.mul_sum,Finset.sum_add_distrib] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialGaussianTail.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialGaussianTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..5129867e262a98954ceab651363f40c379333a7b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialGaussianTail.lean @@ -0,0 +1,29 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialTail + +namespace OAI + +/-! Optimization of the polynomial Chernoff bound. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Set +namespace InvariantIsing + +theorem haarPolynomial_upper_tail {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : MatrixPolynomial N) (C : ℝ) (hC : 0 < C) + (hG : ∀ U : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) U ≤ C) + {r : ℝ} (hr : 0 < r) : + μ.real {U | r ≤ haarPolynomialValue p U-(∫ V, haarPolynomialValue p V ∂μ)} ≤ + Real.exp (-((N:ℝ)-2)*r^2/(2*C)) := by + have hρ : 0 < (N:ℝ)-2 := by exact_mod_cast (show 0 < (N:ℤ)-2 by omega) + have hb : 0 < ((N:ℝ)-2)*r/C := div_pos (mul_pos hρ hr) hC + have h := haarPolynomial_chernoff hN μ p C hC.le hG r (((N:ℝ)-2)*r/C) hb + convert h using 1 + congr 1 + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialHeat.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialHeat.lean new file mode 100644 index 0000000000000000000000000000000000000000..73321c855f83e1947a4a86b03bc9a2b76526f38b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialHeat.lean @@ -0,0 +1,96 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialInvariantSpace + +namespace OAI + +/-! A genuine finite-dimensional heat flow on each invariant polynomial space. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +abbrev HaarPolynomialCoordinates (N d : ℕ) := + Fin (Module.finrank ℝ (haarPolynomialSpace N d)) → ℝ + +def haarPolynomialCoordinates (N d : ℕ) : + haarPolynomialSpace N d ≃ₗ[ℝ] HaarPolynomialCoordinates N d := + (Module.finBasis ℝ (haarPolynomialSpace N d)).equivFun + +def haarPolynomialRestrictedLaplacian (N d : ℕ) : + Module.End ℝ (haarPolynomialSpace N d) := + (haarPolynomialLaplacian N).restrict (fun _ hp => haarPolynomialLaplacian_mem hp) + +def haarPolynomialCoordinateLaplacian (N d : ℕ) : + HaarPolynomialCoordinates N d →L[ℝ] HaarPolynomialCoordinates N d := + ((haarPolynomialCoordinates N d).toLinearMap.comp + ((haarPolynomialRestrictedLaplacian N d).comp + (haarPolynomialCoordinates N d).symm.toLinearMap)).toContinuousLinearMap + +def haarPolynomialHeat (N d : ℕ) (t : ℝ) : + Module.End ℝ (haarPolynomialSpace N d) := + (haarPolynomialCoordinates N d).symm.toLinearMap.comp + ((NormedSpace.exp (t • haarPolynomialCoordinateLaplacian N d)).toLinearMap.comp + (haarPolynomialCoordinates N d).toLinearMap) + +lemma haarPolynomialHeat_zero (N d : ℕ) (p : haarPolynomialSpace N d) : + haarPolynomialHeat N d 0 p = p := by + simp [haarPolynomialHeat] + +lemma haarPolynomialCoordinates_heat (N d : ℕ) (t : ℝ) + (p : haarPolynomialSpace N d) : + haarPolynomialCoordinates N d (haarPolynomialHeat N d t p) = + NormedSpace.exp (t • haarPolynomialCoordinateLaplacian N d) + (haarPolynomialCoordinates N d p) := by + simp only [haarPolynomialHeat,LinearMap.comp_apply,LinearEquiv.coe_coe, + ContinuousLinearMap.coe_coe,LinearEquiv.apply_symm_apply] + +lemma haarPolynomialCoordinateLaplacian_apply (N d : ℕ) + (p : haarPolynomialSpace N d) : + haarPolynomialCoordinateLaplacian N d (haarPolynomialCoordinates N d p) = + haarPolynomialCoordinates N d (haarPolynomialRestrictedLaplacian N d p) := by + change haarPolynomialCoordinates N d + (haarPolynomialRestrictedLaplacian N d + ((haarPolynomialCoordinates N d).symm (haarPolynomialCoordinates N d p))) = _ + rw [LinearEquiv.symm_apply_apply] + +def haarPolynomialCoordinateEval {N d : ℕ} (M : Matrix (Fin N) (Fin N) ℝ) : + HaarPolynomialCoordinates N d →L[ℝ] ℝ := + ((matrixPolynomialEval M).toLinearMap.comp + ((haarPolynomialSpace N d).subtype.comp + (haarPolynomialCoordinates N d).symm.toLinearMap)).toContinuousLinearMap + +@[simp] lemma haarPolynomialCoordinateEval_apply {N d : ℕ} + (M : Matrix (Fin N) (Fin N) ℝ) (p : haarPolynomialSpace N d) : + haarPolynomialCoordinateEval M (haarPolynomialCoordinates N d p) = + matrixPolynomialEval M (p : MatrixPolynomial N) := by + simp [haarPolynomialCoordinateEval] + +/-- The finite matrix exponential satisfies the actual heat equation under evaluation. -/ +theorem haarPolynomialHeat_hasDerivAt {N d : ℕ} + (p : haarPolynomialSpace N d) (M : Matrix (Fin N) (Fin N) ℝ) (t : ℝ) : + HasDerivAt (fun s => matrixPolynomialEval M + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N)) + (matrixPolynomialEval M (haarPolynomialLaplacian N + ((haarPolynomialHeat N d t p : haarPolynomialSpace N d) : MatrixPolynomial N))) t := by + let L := haarPolynomialCoordinateLaplacian N d + let v := haarPolynomialCoordinates N d p + let ev := (haarPolynomialCoordinateEval M).comp + (ContinuousLinearMap.apply ℝ (HaarPolynomialCoordinates N d) v) + have h := ev.hasFDerivAt.comp_hasDerivAt t (hasDerivAt_exp_smul_const' L t) + have he (s : ℝ) : ev (NormedSpace.exp (s • L)) = + matrixPolynomialEval M + ((haarPolynomialHeat N d s p : haarPolynomialSpace N d) : MatrixPolynomial N) := rfl + change HasDerivAt (fun s => ev (NormedSpace.exp (s • L))) + (ev (L*NormedSpace.exp (t • L))) t at h + simp_rw [he] at h + convert h using 1 + change matrixPolynomialEval M _ = + haarPolynomialCoordinateEval M (L (NormedSpace.exp (t • L) v)) + rw [← haarPolynomialCoordinates_heat,haarPolynomialCoordinateLaplacian_apply] + exact (haarPolynomialCoordinateEval_apply M (haarPolynomialRestrictedLaplacian N d + (haarPolynomialHeat N d t p))).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialInvariantSpace.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialInvariantSpace.lean new file mode 100644 index 0000000000000000000000000000000000000000..9dfd8d4a1ab0037dfeaf1a524cde6bd28ee891f9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialInvariantSpace.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialSpace +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialLaplacian + +namespace OAI + +/-! The finite polynomial spaces are invariant under every rotation derivative. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +lemma haarPolynomialDerivation_word_mem {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (d : ℕ) + (w : Fin d → Option (Fin N × Fin N)) : + matrixPolynomialDerivation A (haarPolynomialWord w) ∈ haarPolynomialSpace N d := by + induction d with + | zero => + simp [haarPolynomialWord] + | succ d ih => + rw [← Fin.cons_self_tail w,haarPolynomialWord_cons,Derivation.leibniz] + simp only [smul_eq_mul] + apply (haarPolynomialSpace N (d+1)).add_mem + · exact haarPolynomialSpace_atom_mul (w 0) (ih (Fin.tail w)) + · cases h : w 0 with + | none => simp [haarPolynomialAtom] + | some ij => + rcases ij with ⟨i,j⟩ + simp only [haarPolynomialAtom,matrixPolynomialDerivation_X,Finset.mul_sum] + apply (haarPolynomialSpace N (d+1)).sum_mem + intro k _ + rw [mul_smul_comm] + apply (haarPolynomialSpace N (d+1)).smul_mem + simpa only [haarPolynomialAtom,mul_comm] using + haarPolynomialSpace_atom_mul (some (k,j)) (haarPolynomialWord_mem (Fin.tail w)) + +lemma haarPolynomialDerivation_mem {N d : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) {p : MatrixPolynomial N} + (hp : p ∈ haarPolynomialSpace N d) : + matrixPolynomialDerivation A p ∈ haarPolynomialSpace N d := by + refine Submodule.span_induction (p := fun q _ => + matrixPolynomialDerivation A q ∈ haarPolynomialSpace N d) ?_ ?_ ?_ ?_ hp + · intro q hq + rcases hq with ⟨w,rfl⟩ + exact haarPolynomialDerivation_word_mem A d w + · simpa only [map_zero] using (haarPolynomialSpace N d).zero_mem + · intro p q _ _ hp hq + rw [map_add] + exact (haarPolynomialSpace N d).add_mem hp hq + · intro c p _ hp + rw [Derivation.map_smul] + exact (haarPolynomialSpace N d).smul_mem c hp + +lemma haarPolynomialLaplacian_mem {N d : ℕ} {p : MatrixPolynomial N} + (hp : p ∈ haarPolynomialSpace N d) : + haarPolynomialLaplacian N p ∈ haarPolynomialSpace N d := by + rw [haarPolynomialLaplacian_apply] + apply (haarPolynomialSpace N d).sum_mem + intro i _ + apply (haarPolynomialSpace N d).sum_mem + intro j _ + exact haarPolynomialDerivation_mem _ (haarPolynomialDerivation_mem _ hp) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialKernel.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b07f4204735f4c9b7c79cd80aa1115d8a3c7d36 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialKernel.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialSpace +import OAI.Probability.InvariantIsing.Haar.HaarContinuousDerivative + +namespace OAI + +/-! Finite polynomial averaging kernels on the actual special orthogonal group. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +open scoped BigOperators +namespace InvariantIsing + +def haarKernelAtom {N : ℕ} (V : SpecialOrthogonal N) : Option (Fin N × Fin N) → ℝ + | none => N + | some ij => (V : Matrix (Fin N) (Fin N) ℝ) ij.1 ij.2 + +def haarKernelBase {N : ℕ} (U V : SpecialOrthogonal N) : ℝ := + N + ∑ i, ∑ j, (U : Matrix (Fin N) (Fin N) ℝ) i j * + (V : Matrix (Fin N) (Fin N) ℝ) i j + +def haarKernelAverage {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + (f : SpecialOrthogonal N → ℝ) (n : ℕ) : MatrixPolynomial N := + ∑ w : Fin n → Option (Fin N × Fin N), + (∫ V, f V * ∏ k, haarKernelAtom V (w k) ∂μ) • haarPolynomialWord w + +lemma continuous_haarKernelAtom {N : ℕ} (a : Option (Fin N × Fin N)) : + Continuous (fun V : SpecialOrthogonal N => haarKernelAtom V a) := by + cases a with + | none => exact continuous_const + | some ij => + exact (continuous_apply ij.2).comp + ((continuous_apply ij.1).comp continuous_subtype_val) + +lemma haarKernelBase_sum {N : ℕ} (U V : SpecialOrthogonal N) : + haarKernelBase U V = ∑ a : Option (Fin N × Fin N), + haarKernelAtom V a * haarPolynomialValue (haarPolynomialAtom a) U := by + simp only [Fintype.sum_option,haarKernelAtom,haarPolynomialAtom, + haarPolynomialValue,map_one,mul_one,matrixPolynomialEval_X,Fintype.sum_prod_type] + unfold haarKernelBase + congr 1 + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +theorem haarKernelAverage_value {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) + (n : ℕ) (U : SpecialOrthogonal N) : + haarPolynomialValue (haarKernelAverage μ f n) U = + ∫ V, f V * (haarKernelBase U V)^n ∂μ := by + have hi (w : Fin n → Option (Fin N × Fin N)) : + Integrable (fun V => f V * ∏ k, haarKernelAtom V (w k)) μ := + continuous_haar_integrable μ _ (hf.mul (continuous_finsetProd _ fun k _ => + continuous_haarKernelAtom (w k))) + simp only [haarKernelAverage,haarPolynomialValue,map_sum,map_smul, + smul_eq_mul,haarPolynomialWord,map_prod] + simp_rw [← integral_mul_const] + rw [← integral_finsetSum _ (fun w _ => (hi w).mul_const _)] + apply integral_congr_ae + exact ae_of_all μ fun V => by + change (∑ w : Fin n → Option (Fin N × Fin N), + (f V * ∏ k, haarKernelAtom V (w k)) * + ∏ k, matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) (haarPolynomialAtom (w k))) = + f V * haarKernelBase U V ^ n + rw [haarKernelBase_sum,Fintype.sum_pow] + simp only [Finset.mul_sum,Finset.prod_mul_distrib,mul_assoc] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialLaplacian.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialLaplacian.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad377e6478809eb6fddd56304e97817e2abed56d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialLaplacian.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialDerivation +import OAI.Probability.InvariantIsing.Haar.HaarCasimirAlgebra + +namespace OAI + +/-! The polynomial Laplacian on the orthogonal group commutes with rotations. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def matrixPolynomialOperator {N : ℕ} : + Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] Module.End ℝ (MatrixPolynomial N) where + toFun A := (matrixPolynomialDerivation A).toLinearMap + map_add' A B := by ext p; simp + map_smul' c A := by ext p; simp + +@[simp] lemma matrixPolynomialOperator_apply {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (p : MatrixPolynomial N) : + matrixPolynomialOperator A p = matrixPolynomialDerivation A p := rfl + +lemma matrixPolynomialOperator_commutator {N : ℕ} + (A B : Matrix (Fin N) (Fin N) ℝ) : + matrixPolynomialOperator A*matrixPolynomialOperator B- + matrixPolynomialOperator B*matrixPolynomialOperator A = + matrixPolynomialOperator (B*A-A*B) := by + apply LinearMap.ext + intro p + exact Derivation.congr_fun (matrixPolynomialDerivation_commutator A B) p + +lemma commutator_square_identity {R : Type*} [Ring R] (X Y : R) : + X*(Y*Y)-(Y*Y)*X = -(Y*(Y*X-X*Y)+(Y*X-X*Y)*Y) := by + noncomm_ring + +/-- Ordered coordinate planes; its carré du champ is the sum of the ordered squares. -/ +def haarPolynomialLaplacian (N : ℕ) : Module.End ℝ (MatrixPolynomial N) := + ∑ i, ∑ j, matrixPolynomialOperator (planeGenerator i j)* + matrixPolynomialOperator (planeGenerator i j) + +theorem haarPolynomialLaplacian_commutes {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) : + matrixPolynomialOperator A*haarPolynomialLaplacian N = + haarPolynomialLaplacian N*matrixPolynomialOperator A := by + apply sub_eq_zero.mp + have he (i j : Fin N) : + matrixPolynomialOperator A* + (matrixPolynomialOperator (planeGenerator i j)*matrixPolynomialOperator (planeGenerator i j))- + (matrixPolynomialOperator (planeGenerator i j)*matrixPolynomialOperator (planeGenerator i j))* + matrixPolynomialOperator A = + -(matrixPolynomialOperator (planeGenerator i j)* + matrixPolynomialOperator (A*planeGenerator i j-planeGenerator i j*A)+ + matrixPolynomialOperator (A*planeGenerator i j-planeGenerator i j*A)* + matrixPolynomialOperator (planeGenerator i j)) := by + rw [← matrixPolynomialOperator_commutator (planeGenerator i j) A] + exact commutator_square_identity _ _ + simp only [haarPolynomialLaplacian,Finset.mul_sum,Finset.sum_mul,← Finset.sum_sub_distrib] + simp_rw [he] + simp only [Finset.sum_neg_distrib] + rw [plane_adjoint_jordan_sum matrixPolynomialOperator A hA,neg_zero] + +lemma haarPolynomialLaplacian_apply {N : ℕ} (p : MatrixPolynomial N) : + haarPolynomialLaplacian N p = ∑ i : Fin N, ∑ j : Fin N, + matrixPolynomialDerivation (planeGenerator i j) + (matrixPolynomialDerivation (planeGenerator i j) p) := by + simp only [haarPolynomialLaplacian,LinearMap.sum_apply,Module.End.mul_apply, + matrixPolynomialOperator_apply] + +lemma haarPolynomialLaplacian_derivation {N : ℕ} + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) (p : MatrixPolynomial N) : + haarPolynomialLaplacian N (matrixPolynomialDerivation A p) = + matrixPolynomialDerivation A (haarPolynomialLaplacian N p) := by + exact (LinearMap.congr_fun (haarPolynomialLaplacian_commutes A hA) p).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMinimum.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..823cd4732ae0162f470c3f9ca716f05bffa513a1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMinimum.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialValue +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialLaplacian +import OAI.Probability.InvariantIsing.Haar.CompactParabolicMinimum + +namespace OAI + +/-! Maximum-principle signs for the genuine rotation Laplacian. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped BigOperators Topology +namespace InvariantIsing + +lemma haarPolynomialLaplacian_nonneg_at_min {N : ℕ} + (p : MatrixPolynomial N) (U : SpecialOrthogonal N) + (hmin : ∀ V : SpecialOrthogonal N, haarPolynomialValue p U ≤ haarPolynomialValue p V) : + 0 ≤ haarPolynomialValue (haarPolynomialLaplacian N p) U := by + unfold haarPolynomialValue + rw [haarPolynomialLaplacian_apply,map_sum] + apply Finset.sum_nonneg + intro i _ + rw [map_sum] + apply Finset.sum_nonneg + intro j _ + let q := matrixPolynomialDerivation (planeGenerator i j) p + have hm : IsLocalMin (fun t => haarPolynomialValue p (specialPlaneRotation i j t*U)) 0 := by + apply Filter.Eventually.of_forall + intro t + simpa only [specialPlaneRotation_zero,one_mul] using hmin (specialPlaneRotation i j t*U) + have hd : ∀ᶠ t in 𝓝 (0 : ℝ), HasDerivAt + (fun s => haarPolynomialValue p (specialPlaneRotation i j s*U)) + (haarPolynomialValue q (specialPlaneRotation i j t*U)) t := + Filter.Eventually.of_forall fun t => hasDerivAt_specialPlaneRotation_polynomial p i j U t + have hdd := hasDerivAt_specialPlaneRotation_polynomial q i j U 0 + simp only [specialPlaneRotation_zero,one_mul] at hdd + exact second_derivative_nonneg_at_local_min hm hd hdd + +/-- Compact-space parabolic comparison, with the spatial sign proved above. -/ +theorem haarPolynomial_parabolic_nonneg {N : ℕ} {T : ℝ} (hT : 0 ≤ T) + (p : ℝ → MatrixPolynomial N) (Wt : ℝ × SpecialOrthogonal N → ℝ) + (hc : ContinuousOn (fun z : ℝ × SpecialOrthogonal N => haarPolynomialValue (p z.1) z.2) + (Icc (0 : ℝ) T ×ˢ Set.univ)) + (hi : ∀ U : SpecialOrthogonal N, 0 ≤ haarPolynomialValue (p 0) U) + (hd : ∀ t ∈ Ioc (0 : ℝ) T, ∀ U : SpecialOrthogonal N, + HasDerivAt (fun s => haarPolynomialValue (p s) U) (Wt (t,U)) t) + (hpde : ∀ t ∈ Ioc (0 : ℝ) T, ∀ U : SpecialOrthogonal N, + haarPolynomialValue (haarPolynomialLaplacian N (p t)) U- + haarPolynomialValue (p t) U ≤ Wt (t,U)) : + ∀ t ∈ Icc (0 : ℝ) T, ∀ U : SpecialOrthogonal N, + 0 ≤ haarPolynomialValue (p t) U := by + apply compact_parabolic_nonneg hT + (fun t U => haarPolynomialValue (p t) U) Wt + (fun t U => haarPolynomialValue (haarPolynomialLaplacian N (p t)) U) + hc hi hd hpde + intro t _ U hm + exact haarPolynomialLaplacian_nonneg_at_min (p t) U hm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMoment.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..b530906978b9d4e9801de3d1d816a73bb18e7348 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMoment.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Haar.HaarExponentialLimit +import OAI.Probability.InvariantIsing.Haar.HerbstDifferential + +namespace OAI + +/-! Exponential moments and their derivatives for polynomial observables on SO(N). -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +def haarPolynomialMoment {N : ℕ} (μ : Measure (SpecialOrthogonal N)) (p : MatrixPolynomial N) (t : ℝ) : ℝ := + ∫ U, Real.exp (t*haarPolynomialValue p U) ∂μ + +def haarPolynomialMomentDerivative {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + (p : MatrixPolynomial N) (t : ℝ) : ℝ := + ∫ U, haarPolynomialValue p U*Real.exp (t*haarPolynomialValue p U) ∂μ + +lemma haarPolynomialMoment_pos {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] (p : MatrixPolynomial N) (t : ℝ) : + 0 < haarPolynomialMoment μ p t := + integral_exp_pos (continuous_haar_integrable μ _ + (Real.continuous_exp.comp (continuous_const.mul (continuous_haarPolynomialValue p)))) + +@[simp] lemma haarPolynomialMoment_zero {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsProbabilityMeasure μ] (p : MatrixPolynomial N) : haarPolynomialMoment μ p 0 = 1 := by + simp [haarPolynomialMoment] + +@[simp] lemma haarPolynomialMomentDerivative_zero {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + (p : MatrixPolynomial N) : + haarPolynomialMomentDerivative μ p 0 = ∫ U, haarPolynomialValue p U ∂μ := by + simp only [haarPolynomialMomentDerivative,zero_mul,Real.exp_zero,mul_one] + +lemma haarPolynomialMoment_hasDerivAt {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [IsFiniteMeasure μ] (p : MatrixPolynomial N) (t : ℝ) : + HasDerivAt (haarPolynomialMoment μ p) (haarPolynomialMomentDerivative μ p t) t := by + let F' (s : ℝ) (U : SpecialOrthogonal N) := + haarPolynomialValue p U*Real.exp (s*haarPolynomialValue p U) + have hc : Continuous (fun z : ℝ × SpecialOrthogonal N => F' z.1 z.2) := by + have hp := (continuous_haarPolynomialValue p).comp (continuous_snd : Continuous fun z : ℝ × SpecialOrthogonal N => z.2) + exact hp.mul (Real.continuous_exp.comp (continuous_fst.mul hp)) + obtain ⟨B,hB⟩ := (isCompact_Icc.prod (isCompact_univ : IsCompact (Set.univ : Set (SpecialOrthogonal N)))).exists_bound_of_continuousOn + (show ContinuousOn (fun z => F' z.1 z.2) (Icc (t-1) (t+1) ×ˢ Set.univ) from hc.continuousOn) + apply (hasDerivAt_integral_of_dominated_loc_of_deriv_le (μ := μ) + (s := Ioo (t-1) (t+1)) (F' := F') (bound := fun _ => B) + (Ioo_mem_nhds (by linarith) (by linarith)) + (Eventually.of_forall fun s => (Real.continuous_exp.comp + (continuous_const.mul (continuous_haarPolynomialValue p))).measurable.aestronglyMeasurable) + (continuous_haar_integrable μ _ (Real.continuous_exp.comp + (continuous_const.mul (continuous_haarPolynomialValue p)))) + ((hc.comp (continuous_const.prodMk continuous_id)).measurable.aestronglyMeasurable) + (ae_of_all μ fun U s hs => hB (s,U) ⟨⟨hs.1.le,hs.2.le⟩,mem_univ _⟩) + (integrable_const B) ?_).2 + apply ae_of_all + intro U s _ + convert ((hasDerivAt_id s).mul_const (haarPolynomialValue p U)).exp using 1 + all_goals simp only [F',id_eq,Function.comp_apply,Pi.mul_apply] + all_goals ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMomentShift.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMomentShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..d91ef3865820e1f8bbe18cfc4dc73f18ea487409 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialMomentShift.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Haar.HaarExponentialMomentBound + +namespace OAI + +/-! Removing the positivity normalization from polynomial exponential-moment bounds. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +namespace InvariantIsing + +lemma haarPolynomialDerivation_C {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (c : ℝ) : + matrixPolynomialDerivation A (MvPolynomial.C c) = 0 := + (matrixPolynomialDerivation A).map_algebraMap c + +lemma haarPolynomialGamma_add_C {N : ℕ} (p : MatrixPolynomial N) (c : ℝ) : + haarPolynomialGamma (p+MvPolynomial.C c) (p+MvPolynomial.C c) = haarPolynomialGamma p p := by + simp only [haarPolynomialGamma,map_add,haarPolynomialDerivation_C,add_zero] + +lemma haarPolynomialMoment_add_C {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + (p : MatrixPolynomial N) (c t : ℝ) : + haarPolynomialMoment μ (p+MvPolynomial.C c) t = Real.exp (t*c)*haarPolynomialMoment μ p t := by + unfold haarPolynomialMoment + rw [← integral_const_mul] + apply integral_congr_ae + exact ae_of_all μ fun U => by + simp only [haarPolynomialValue,map_add,matrixPolynomialEval_C] + rw [← Real.exp_add] + congr 1 + ring + +theorem haarPolynomialMoment_log_bound {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : MatrixPolynomial N) (C : ℝ) (hC : 0 ≤ C) + (hG : ∀ U : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) U ≤ C) + {t : ℝ} (ht : 0 < t) : + Real.log (haarPolynomialMoment μ p t) ≤ + (∫ U, haarPolynomialValue p U ∂μ)*t+C/(2*((N:ℝ)-2))*t^2 := by + obtain ⟨B,hB⟩ := haarPolynomialValue_bound p + have hpq (U : SpecialOrthogonal N) : 0 ≤ haarPolynomialValue (p+MvPolynomial.C B) U := by + simp only [haarPolynomialValue,map_add,matrixPolynomialEval_C] + have hh := hB U + rw [Real.norm_eq_abs] at hh + dsimp only [haarPolynomialValue] at hh + linarith [(abs_le.mp hh).1] + have hGq (U : SpecialOrthogonal N) : + haarPolynomialValue (haarPolynomialGamma (p+MvPolynomial.C B) (p+MvPolynomial.C B)) U ≤ C := by + rw [haarPolynomialGamma_add_C] + exact hG U + have h := haarPolynomialMoment_log_bound_of_nonneg hN μ (p+MvPolynomial.C B) hpq C hC hGq ht + rw [haarPolynomialMoment_add_C,Real.log_mul (Real.exp_ne_zero _) (haarPolynomialMoment_pos μ p t).ne', + Real.log_exp] at h + have hm : (∫ U, haarPolynomialValue (p+MvPolynomial.C B) U ∂μ) = + (∫ U, haarPolynomialValue p U ∂μ)+B := by + have he (U : SpecialOrthogonal N) : haarPolynomialValue (p+MvPolynomial.C B) U = haarPolynomialValue p U+B := by + simp only [haarPolynomialValue,map_add,matrixPolynomialEval_C] + simp_rw [he] + rw [integral_add (haarPolynomialValue_integrable p μ) (integrable_const B)] + simp only [integral_const,probReal_univ,smul_eq_mul,one_mul] + rw [hm] at h + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialRotation.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cc1d64eaf144339b6925e4936bbefd627c57862 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialRotation.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialCurve + +namespace OAI + +/-! Polynomial differentiation along the actual special-orthogonal rotations. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators Matrix.Norms.Frobenius +namespace InvariantIsing + +/-- Coordinate evaluation in the Frobenius matrix space. -/ +def haarMatrixCoordinate {N : ℕ} (i j : Fin N) : + Matrix (Fin N) (Fin N) ℝ →L[ℝ] ℝ := + (show Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ from + { toFun := fun M => M i j + map_add' := by intros; rfl + map_smul' := by intros; rfl }).toContinuousLinearMap + +lemma hasDerivAt_specialPlaneRotation_entry {N : ℕ} + (i j k l : Fin N) (U : SpecialOrthogonal N) (t : ℝ) : + HasDerivAt (fun s => ((specialPlaneRotation i j s*U : SpecialOrthogonal N) : + Matrix (Fin N) (Fin N) ℝ) k l) + ((planeGenerator i j*((specialPlaneRotation i j t*U : SpecialOrthogonal N) : + Matrix (Fin N) (Fin N) ℝ)) k l) t := by + let A := planeGenerator i j + let ev := haarMatrixCoordinate k l + have hd := ev.hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_exp_smul_const' A t).mul_const (U : Matrix (Fin N) (Fin N) ℝ)) + convert hd using 1 + · rfl + · change (A*(NormedSpace.exp (t • A)*(U : Matrix (Fin N) (Fin N) ℝ))) k l = + (A*NormedSpace.exp (t • A)*(U : Matrix (Fin N) (Fin N) ℝ)) k l + rw [mul_assoc] + +theorem hasDerivAt_specialPlaneRotation_polynomial {N : ℕ} + (p : MatrixPolynomial N) (i j : Fin N) (U : SpecialOrthogonal N) (t : ℝ) : + HasDerivAt (fun s => matrixPolynomialEval + ((specialPlaneRotation i j s*U : SpecialOrthogonal N) : + Matrix (Fin N) (Fin N) ℝ) p) + (matrixPolynomialEval + ((specialPlaneRotation i j t*U : SpecialOrthogonal N) : + Matrix (Fin N) (Fin N) ℝ) + (matrixPolynomialDerivation (planeGenerator i j) p)) t := + hasDerivAt_matrixPolynomialEval p _ _ t + (fun k l => hasDerivAt_specialPlaneRotation_entry i j k l U t) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialSpace.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialSpace.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4f4aa029d0b9c086c4015e1fe81e9aaaa8e8f56 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialSpace.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialValue + +namespace OAI + +/-! Finite polynomial spaces, padded by the constant atom, for the rotation semigroup. -/ +noncomputable section +open Matrix MvPolynomial +open scoped BigOperators +namespace InvariantIsing + +def haarPolynomialAtom {N : ℕ} : Option (Fin N × Fin N) → MatrixPolynomial N + | none => 1 + | some ij => X ij + +def haarPolynomialWord {N d : ℕ} (w : Fin d → Option (Fin N × Fin N)) : MatrixPolynomial N := + ∏ k, haarPolynomialAtom (w k) + +def haarPolynomialSpace (N d : ℕ) : Submodule ℝ (MatrixPolynomial N) := + Submodule.span ℝ (Set.range (@haarPolynomialWord N d)) + +instance haarPolynomialSpace_finite (N d : ℕ) : Module.Finite ℝ (haarPolynomialSpace N d) := + Module.Finite.span_of_finite ℝ (Set.finite_range _) + +lemma haarPolynomialWord_mem {N d : ℕ} (w : Fin d → Option (Fin N × Fin N)) : + haarPolynomialWord w ∈ haarPolynomialSpace N d := + Submodule.subset_span ⟨w,rfl⟩ + +lemma haarPolynomialWord_cons {N d : ℕ} (a : Option (Fin N × Fin N)) + (w : Fin d → Option (Fin N × Fin N)) : + haarPolynomialWord (Fin.cons a w) = haarPolynomialAtom a*haarPolynomialWord w := by + simp only [haarPolynomialWord,Fin.prod_univ_succ,Fin.cons_zero,Fin.cons_succ] + +lemma haarPolynomialSpace_atom_mul {N d : ℕ} (a : Option (Fin N × Fin N)) + {p : MatrixPolynomial N} (hp : p ∈ haarPolynomialSpace N d) : + haarPolynomialAtom a*p ∈ haarPolynomialSpace N (d+1) := by + refine Submodule.span_induction (p := fun q _ => + haarPolynomialAtom a*q ∈ haarPolynomialSpace N (d+1)) ?_ ?_ ?_ ?_ hp + · intro q hq + rcases hq with ⟨w,rfl⟩ + rw [← haarPolynomialWord_cons] + exact haarPolynomialWord_mem _ + · simpa only [mul_zero] using (haarPolynomialSpace N (d+1)).zero_mem + · intro p q _ _ hp hq + rw [mul_add] + exact (haarPolynomialSpace N (d+1)).add_mem hp hq + · intro c p _ hp + rw [mul_smul_comm] + exact (haarPolynomialSpace N (d+1)).smul_mem c hp + +lemma haarPolynomialSpace_le_succ (N d : ℕ) : + haarPolynomialSpace N d ≤ haarPolynomialSpace N (d+1) := by + intro p hp + simpa only [haarPolynomialAtom,one_mul] using + haarPolynomialSpace_atom_mul (none : Option (Fin N × Fin N)) hp + +lemma haarPolynomialSpace_mono (N : ℕ) : Monotone (haarPolynomialSpace N) := + monotone_nat_of_le_succ (haarPolynomialSpace_le_succ N) + +lemma one_mem_haarPolynomialSpace (N d : ℕ) : + (1 : MatrixPolynomial N) ∈ haarPolynomialSpace N d := by + simpa only [haarPolynomialWord,haarPolynomialAtom,Finset.prod_const_one] using + haarPolynomialWord_mem (N := N) (d := d) (fun _ => none) + +/-- Every multivariate polynomial belongs to one of the finite spaces. -/ +theorem exists_mem_haarPolynomialSpace {N : ℕ} (p : MatrixPolynomial N) : + ∃ d : ℕ, p ∈ haarPolynomialSpace N d := by + induction p using MvPolynomial.induction_on with + | C c => + refine ⟨0,?_⟩ + rw [MvPolynomial.C_eq_smul_one] + exact (haarPolynomialSpace N 0).smul_mem c (one_mem_haarPolynomialSpace N 0) + | add p q hp hq => + obtain ⟨d,hd⟩ := hp + obtain ⟨e,he⟩ := hq + exact ⟨max d e,(haarPolynomialSpace N (max d e)).add_mem + (haarPolynomialSpace_mono N (le_max_left d e) hd) + (haarPolynomialSpace_mono N (le_max_right d e) he)⟩ + | mul_X p ij hp => + obtain ⟨d,hd⟩ := hp + refine ⟨d+1,?_⟩ + simpa only [haarPolynomialAtom,mul_comm] using + haarPolynomialSpace_atom_mul (some ij) hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialTail.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..85e3df872d8a13d385ef5e3a78e76b2c0fd60a0a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialTail.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMomentShift + +namespace OAI + +/-! Chernoff bounds for centered polynomial observables of the Haar matrix. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Set +namespace InvariantIsing + +theorem haarPolynomial_chernoff {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (p : MatrixPolynomial N) (C : ℝ) (hC : 0 ≤ C) + (hG : ∀ U : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) U ≤ C) + (r β : ℝ) (hβ : 0 < β) : + μ.real {U | r ≤ haarPolynomialValue p U-(∫ V, haarPolynomialValue p V ∂μ)} ≤ + Real.exp (C/(2*((N:ℝ)-2))*β^2-β*r) := by + let m := ∫ V, haarPolynomialValue p V ∂μ + let A := C/(2*((N:ℝ)-2)) + let F (U : SpecialOrthogonal N) := Real.exp (β*(haarPolynomialValue p U-m)) + have hfi : Integrable F μ := continuous_haar_integrable μ _ + (Real.continuous_exp.comp (continuous_const.mul ((continuous_haarPolynomialValue p).sub continuous_const))) + have hmoment : haarPolynomialMoment μ p β ≤ Real.exp (m*β+A*β^2) := by + have hh := Real.exp_le_exp.mpr (haarPolynomialMoment_log_bound hN μ p C hC hG hβ) + rwa [Real.exp_log (haarPolynomialMoment_pos μ p β)] at hh + have hI : (∫ U, F U ∂μ) ≤ Real.exp (A*β^2) := by + have he : (∫ U, F U ∂μ) = Real.exp (-β*m)*haarPolynomialMoment μ p β := by + rw [haarPolynomialMoment,← integral_const_mul] + apply integral_congr_ae + exact ae_of_all μ fun U => by + change Real.exp (β*(haarPolynomialValue p U-m)) = + Real.exp (-β*m)*Real.exp (β*haarPolynomialValue p U) + rw [← Real.exp_add] + congr 1 + ring + rw [he] + calc + _ ≤ Real.exp (-β*m)*Real.exp (m*β+A*β^2) := + mul_le_mul_of_nonneg_left hmoment (Real.exp_pos _).le + _ = Real.exp (A*β^2) := by + rw [← Real.exp_add] + congr 1 + ring + have hset : {U | Real.exp (β*r) ≤ F U} = + {U | r ≤ haarPolynomialValue p U-m} := by + ext U + simp only [mem_ofPred_eq,F,Real.exp_le_exp] + exact mul_le_mul_iff_right₀ hβ + have hm := mul_meas_ge_le_integral_of_nonneg (ae_of_all μ fun U => (Real.exp_pos _).le) + hfi (Real.exp (β*r)) + rw [hset] at hm + have hb : μ.real {U | r ≤ haarPolynomialValue p U-m} ≤ Real.exp (A*β^2)/Real.exp (β*r) := by + apply (le_div_iff₀ (Real.exp_pos _)).mpr + nlinarith [hm] + simpa only [Real.exp_sub] using hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialValue.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..45c84ff850aa794a43cba1bc418de25fb45ebd9a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarPolynomialValue.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialRotation +import OAI.Probability.InvariantIsing.Haar.HaarCompactness + +namespace OAI + +/-! Bounded continuous polynomial observables on the physical rotation group. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory +open scoped BigOperators +namespace InvariantIsing + +def haarPolynomialValue {N : ℕ} (p : MatrixPolynomial N) (U : SpecialOrthogonal N) : ℝ := + matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) p + +lemma continuous_haarPolynomialValue {N : ℕ} (p : MatrixPolynomial N) : + Continuous (haarPolynomialValue p) := by + have hm : Continuous (fun U : SpecialOrthogonal N => + fun ij : Fin N × Fin N => (U : Matrix (Fin N) (Fin N) ℝ) ij.1 ij.2) := by + exact continuous_pi fun ij => (continuous_apply ij.2).comp + ((continuous_apply ij.1).comp continuous_subtype_val) + exact p.continuous_eval.comp hm + +lemma haarPolynomialValue_bound {N : ℕ} (p : MatrixPolynomial N) : + ∃ B : ℝ, ∀ U : SpecialOrthogonal N, ‖haarPolynomialValue p U‖ ≤ B := by + obtain ⟨B,hB⟩ := isCompact_univ.exists_bound_of_continuousOn + (continuous_haarPolynomialValue p).continuousOn + exact ⟨B,fun U => hB U (Set.mem_univ U)⟩ + +lemma haarPolynomialValue_integrable {N : ℕ} (p : MatrixPolynomial N) + (μ : Measure (SpecialOrthogonal N)) [IsFiniteMeasure μ] : + Integrable (haarPolynomialValue p) μ := by + obtain ⟨B,hB⟩ := haarPolynomialValue_bound p + exact Integrable.of_bound (continuous_haarPolynomialValue p).measurable.aestronglyMeasurable + B (ae_of_all μ hB) + +/-- Infinitesimal Haar invariance, with the domination supplied by compactness. -/ +theorem integral_haarPolynomialDerivation {N : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsFiniteMeasure μ] [μ.IsMulLeftInvariant] + (p : MatrixPolynomial N) (i j : Fin N) : + (∫ U, haarPolynomialValue (matrixPolynomialDerivation (planeGenerator i j) p) U ∂μ) = 0 := by + let q := matrixPolynomialDerivation (planeGenerator i j) p + obtain ⟨B,hB⟩ := haarPolynomialValue_bound q + have he := integral_special_rotation_derivative_eq_zero μ + (specialPlaneRotation i j) (specialPlaneRotation_zero i j) + (haarPolynomialValue p) (continuous_haarPolynomialValue p).measurable + (haarPolynomialValue_integrable p μ) + (fun t U => haarPolynomialValue q (specialPlaneRotation i j t*U)) + (by simpa only [specialPlaneRotation_zero,one_mul] using + (continuous_haarPolynomialValue q).measurable.aestronglyMeasurable) + (fun _ => B) (integrable_const B) + (ae_of_all μ fun U t _ => hB (specialPlaneRotation i j t*U)) + (ae_of_all μ fun U t _ => hasDerivAt_specialPlaneRotation_polynomial p i j U t) + simpa only [specialPlaneRotation_zero,one_mul] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarReflectionConnectivity.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarReflectionConnectivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..c93efbf6c47adb549ded2db65c840cb7d2290b48 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarReflectionConnectivity.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Haar.ReflectionPairPath +import OAI.Probability.InvariantIsing.Haar.ReflectionParity + +namespace OAI + +/-! Differentiable connection of every special orthogonal matrix to the identity. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +lemma evenReflectionList_exists_curve {N : ℕ} (l : List (EuclideanSpace ℝ (Fin N))) + (hl : ∀ v ∈ l, v ≠ 0) (heven : Even l.length) : + ∃ γ : HaarDifferentiableCurve N, + (γ.value 0 : Matrix (Fin N) (Fin N) ℝ) = + rotationMatrix ((l.map hyperplaneReflection).prod) ∧ γ.value 1 = 1 := by + induction l using List.twoStepInduction with + | nil => + refine ⟨HaarDifferentiableCurve.constant 1,?_,rfl⟩ + simp [HaarDifferentiableCurve.constant] + | singleton v => simp at heven + | cons_cons v w l ih _ => + have hv := hl v (by simp) + have hw := hl w (by simp) + have hl' : ∀ x ∈ l, x ≠ 0 := fun x hx => hl x (by simp [hx]) + have heven' : Even l.length := by + simpa only [List.length_cons,Nat.even_add_one,Nat.odd_add_one,not_not] using heven + obtain ⟨γ,hγ0,hγ1⟩ := ih hl' heven' + obtain ⟨η,hη0,hη1⟩ := reflectionPair_exists_path v w hv hw + refine ⟨η.mul γ,?_,?_⟩ + · change (η.value 0 : Matrix (Fin N) (Fin N) ℝ)* + (γ.value 0 : Matrix (Fin N) (Fin N) ℝ) = _ + rw [hη0,hγ0] + simp only [List.map_cons,List.prod_cons,rotationMatrix_mul,reflectionPair] + exact mul_assoc _ _ _ + · change η.value 1*γ.value 1 = 1 + rw [hη1,hγ1,mul_one] + +theorem specialOrthogonal_exists_differentiableCurve {N : ℕ} (U : SpecialOrthogonal N) : + ∃ γ : HaarDifferentiableCurve N, γ.value 0 = U ∧ γ.value 1 = 1 := by + obtain ⟨l,hl,heven,heq⟩ := specialRotation_even_reflections U + obtain ⟨γ,hγ0,hγ1⟩ := evenReflectionList_exists_curve l hl heven + refine ⟨γ,?_,hγ1⟩ + apply Subtype.ext + rw [hγ0,← heq,rotationMatrix_specialRotation] + +theorem haarPolynomial_global_oscillation_bound {N : ℕ} (U : SpecialOrthogonal N) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (p : MatrixPolynomial N) (δ : ℝ), 0 ≤ δ → + (∀ V : SpecialOrthogonal N, haarPolynomialValue (haarPolynomialGamma p p) V ≤ δ^2) → + |haarPolynomialValue p U-haarPolynomialValue p 1| ≤ K*δ := by + obtain ⟨γ,hγ0,hγ1⟩ := specialOrthogonal_exists_differentiableCurve U + obtain ⟨K,hK,hbound⟩ := γ.polynomial_bound + refine ⟨K,hK,?_⟩ + intro p δ hδ hp + simpa only [hγ0,hγ1,abs_sub_comm] using hbound p δ hδ hp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarTwoSidedTail.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarTwoSidedTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..16a2e1f1a127e4540ad155f911a25e7860bf4445 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarTwoSidedTail.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Haar.HaarLipschitzTail + +namespace OAI + +/-! Both one-sided tails and the centered absolute deviation. -/ +noncomputable section +open Matrix MeasureTheory Set +namespace InvariantIsing + +theorem haar_lipschitz_lower_tail {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) {r : ℝ} (hr : 0 < r) : + μ.real {U | r ≤ (∫ V, f V ∂μ)-f U} ≤ + Real.exp (-((N:ℝ)-2)*r^2/(8*L^2)) := by + have hh := haar_lipschitz_upper_tail hN μ (fun U => -f U) L hL + (fun U V => by simpa only [neg_sub_neg,abs_sub_comm] using hLip U V) hr + simpa only [integral_neg,sub_neg_eq_add,neg_add_eq_sub] using hh + +theorem haar_lipschitz_mean_tail {N : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (f : SpecialOrthogonal N → ℝ) (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U-f V| ≤ L*frobeniusDistance U V) {r : ℝ} (hr : 0 < r) : + μ.real {U | r ≤ |f U-(∫ V, f V ∂μ)|} ≤ + 2*Real.exp (-((N:ℝ)-2)*r^2/(8*L^2)) := by + have he : {U | r ≤ |f U-(∫ V, f V ∂μ)|} = + {U | r ≤ f U-(∫ V, f V ∂μ)} ∪ {U | r ≤ (∫ V, f V ∂μ)-f U} := by + ext U + simp only [mem_ofPred_eq,mem_union,le_abs,neg_sub] + rw [he] + calc + _ ≤ μ.real {U | r ≤ f U-(∫ V, f V ∂μ)}+ + μ.real {U | r ≤ (∫ V, f V ∂μ)-f U} := measureReal_union_le _ _ + _ ≤ 2*Real.exp (-((N:ℝ)-2)*r^2/(8*L^2)) := by + linarith [haar_lipschitz_upper_tail hN μ f L hL hLip hr, + haar_lipschitz_lower_tail hN μ f L hL hLip hr] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarUniformMomentLimit.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarUniformMomentLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..daca94219e181d3bea382a6122cf5538c9d58c6b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarUniformMomentLimit.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialMoment + +namespace OAI + +/-! Passing polynomial Haar moments through uniform approximation. -/ +noncomputable section +open Matrix MvPolynomial MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem haar_uniform_polynomial_tendsto {N : ℕ} (p : ℕ → MatrixPolynomial N) + (f : SpecialOrthogonal N → ℝ) + (hu : ∀ ε > 0, ∀ᶠ n : ℕ in atTop, ∀ U, |haarPolynomialValue (p n) U-f U| ≤ ε) + (U : SpecialOrthogonal N) : + Tendsto (fun n => haarPolynomialValue (p n) U) atTop (𝓝 (f U)) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [hu (ε/2) (half_pos hε)] with n hn + rw [Real.dist_eq] + exact (hn U).trans_lt (half_lt_self hε) + +theorem haar_uniform_polynomial_integrals {N : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsFiniteMeasure μ] + (p : ℕ → MatrixPolynomial N) (f : SpecialOrthogonal N → ℝ) (hf : Continuous f) + (hu : ∀ ε > 0, ∀ᶠ n : ℕ in atTop, ∀ U, |haarPolynomialValue (p n) U-f U| ≤ ε) : + Tendsto (fun n => ∫ U, haarPolynomialValue (p n) U ∂μ) atTop (𝓝 (∫ U, f U ∂μ)) ∧ + ∀ t : ℝ, Tendsto (fun n => haarPolynomialMoment μ (p n) t) atTop + (𝓝 (∫ U, Real.exp (t*f U) ∂μ)) := by + obtain ⟨B,hB⟩ := isCompact_univ.exists_bound_of_continuousOn hf.continuousOn + have hb : ∀ᶠ n : ℕ in atTop, ∀ U, |haarPolynomialValue (p n) U| ≤ B+1 := by + filter_upwards [hu 1 zero_lt_one] with n hn U + have hbu : |f U| ≤ B := by simpa only [Real.norm_eq_abs] using hB U (mem_univ U) + calc + |haarPolynomialValue (p n) U| ≤ |haarPolynomialValue (p n) U-f U|+|f U| := by + simpa only [sub_add_cancel] using abs_add_le (haarPolynomialValue (p n) U-f U) (f U) + _ ≤ B+1 := by linarith [hn U] + constructor + · refine tendsto_integral_filter_of_dominated_convergence (fun _ => B+1) + (Eventually.of_forall fun n => (continuous_haarPolynomialValue (p n)).measurable.aestronglyMeasurable) + ?_ (integrable_const _) ?_ + · filter_upwards [hb] with n hn + exact ae_of_all μ fun U => by simpa only [Real.norm_eq_abs] using hn U + · exact ae_of_all μ fun U => haar_uniform_polynomial_tendsto p f hu U + · intro t + refine tendsto_integral_filter_of_dominated_convergence (fun _ => Real.exp (|t| *(B+1))) + (Eventually.of_forall fun n => (Real.continuous_exp.comp (continuous_const.mul + (continuous_haarPolynomialValue (p n)))).measurable.aestronglyMeasurable) + ?_ (integrable_const _) ?_ + · filter_upwards [hb] with n hn + apply ae_of_all + intro U + rw [Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + apply Real.exp_le_exp.mpr + calc + t*haarPolynomialValue (p n) U ≤ |t*haarPolynomialValue (p n) U| := le_abs_self _ + _ = |t| * |haarPolynomialValue (p n) U| := abs_mul _ _ + _ ≤ |t| *(B+1) := mul_le_mul_of_nonneg_left (hn U) (abs_nonneg _) + · exact ae_of_all μ fun U => Real.continuous_exp.continuousAt.tendsto.comp + ((haar_uniform_polynomial_tendsto p f hu U).const_mul t) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HaarVariance.lean b/lean/OAI/Probability/InvariantIsing/Haar/HaarVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..efbfcada540779299ef5aa8fd60a0240421189d7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HaarVariance.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Arrays.NSpinVariance + +namespace OAI + +/-! Haar variance for the Frobenius moduli used by the perturbed model. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory + +namespace InvariantIsing + +lemma haar_frobeniusLipschitz_memLp_two (hpub : HaarConcentrationInput) + (N : ℕ) (hN : 3 ≤ N) (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (hμinv : μ.IsMulLeftInvariant) (f : SpecialOrthogonal N → ℝ) (hf : Measurable f) + (L : ℝ) (hL : 0 < L) + (hLip : ∀ U V, |f U - f V| ≤ L * frobeniusDistance U V) : MemLp f 2 μ := by + obtain ⟨C, a, hC, ha, hp⟩ := hpub + obtain ⟨m, _, _, ht⟩ := hp N hN μ inferInstance hμinv f hf L hL hLip + have hn : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + have hd := (integral_sq_sub_le_of_gaussian_tail μ f hf m C + (a * N / L ^ 2) hC.le (by positivity) (fun r hr => by + simpa only [show -a * (N : ℝ) * r ^ 2 / L ^ 2 = -(a * N / L ^ 2) * r ^ 2 by ring] + using ht r hr)).1 + have hD := (memLp_two_iff_integrable_sq (hf.sub_const m).aestronglyMeasurable).mpr hd + convert hD.add (memLp_const m) using 1 + ext U + simp only [Pi.add_apply, sub_add_cancel] + +/-- The published concentration input bounds every measurable Frobenius +Lipschitz observable, with constants independent of dimension. -/ +theorem haar_frobeniusLipschitz_variance (hpub : HaarConcentrationInput) : + ∃ C : ℝ, 0 < C ∧ + ∀ N : ℕ, 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), + IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ f : SpecialOrthogonal N → ℝ, Measurable f → + ∀ L : ℝ, 0 < L → + (∀ U V, |f U - f V| ≤ L * frobeniusDistance U V) → + variance f μ ≤ C * L ^ 2 / N := by + obtain ⟨C, a, hC, ha, hp⟩ := hpub + refine ⟨C / a, by positivity, ?_⟩ + intro N hN μ hμ hμinv f hf L hL hLip + let : IsProbabilityMeasure μ := hμ + obtain ⟨m, _, _, ht⟩ := hp N hN μ hμ hμinv f hf L hL hLip + have hn : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + have hb := variance_le_of_gaussian_median_tail μ f hf m C + (a * N / L ^ 2) hC.le (by positivity) (fun r hr => by + simpa only [show -a * (N : ℝ) * r ^ 2 / L ^ 2 = -(a * N / L ^ 2) * r ^ 2 by ring] + using ht r hr) + refine hb.trans_eq ?_ + field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/HerbstDifferential.lean b/lean/OAI/Probability/InvariantIsing/Haar/HerbstDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..5db33149bac27dee7c2ceb6b96687071ebff4363 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/HerbstDifferential.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialEntropyBound + +namespace OAI + +/-! The one-variable entropy-to-exponential-moment argument. -/ +noncomputable section +open Filter Set +open scoped Topology +namespace InvariantIsing + +theorem log_moment_le_of_entropy (M M' : ℝ → ℝ) (A : ℝ) + (hM : ∀ t, 0 < M t) (h0 : M 0 = 1) (hD : ∀ t, HasDerivAt M (M' t) t) + (hE : ∀ t, 0 < t → t*M' t-M t*Real.log (M t) ≤ A*t^2*M t) + {t : ℝ} (ht : 0 < t) : Real.log (M t) ≤ M' 0*t+A*t^2 := by + let K (s : ℝ) := Real.log (M s)/s-A*s + let K' (s : ℝ) := (M' s/M s*s-Real.log (M s))/s^2-A + have hd (s : ℝ) (hs : 0 < s) : HasDerivAt K (K' s) s := by + convert (((hD s).log (hM s).ne').div (hasDerivAt_id s) hs.ne').sub + ((hasDerivAt_id s).const_mul A) using 1 + all_goals first | rfl | simp only [K',id_eq,mul_one] + have hn (s : ℝ) (hs : 0 < s) : K' s ≤ 0 := by + have heq : M' s/M s*s-Real.log (M s) = + (s*M' s-M s*Real.log (M s))/M s := by + field_simp [(hM s).ne'] + have hb : (M' s/M s*s-Real.log (M s))/s^2 ≤ A := by + apply (div_le_iff₀ (sq_pos_of_pos hs)).mpr + rw [heq] + apply (div_le_iff₀ (hM s)).mpr + exact hE s hs + exact sub_nonpos.mpr hb + have hanti : AntitoneOn K (Ioi 0) := by + apply antitoneOn_of_deriv_nonpos (convex_Ioi 0) + · intro s hs + exact (hd s hs).continuousAt.continuousWithinAt + · intro s hs + have hs' : 0 < s := by simpa only [interior_Ioi,mem_Ioi] using hs + exact (hd s hs').differentiableAt.differentiableWithinAt + · intro s hs + have hs' : 0 < s := by simpa only [interior_Ioi,mem_Ioi] using hs + rw [(hd s hs').deriv] + exact hn s hs' + have hlog := ((hD 0).log (hM 0).ne').tendsto_slope_zero_right + have hl : Tendsto (fun s : ℝ => Real.log (M s)/s) (𝓝[>] (0:ℝ)) (𝓝 (M' 0)) := by + simpa only [zero_add,h0,Real.log_one,sub_zero,div_one,smul_eq_mul,div_eq_mul_inv,mul_comm, + inv_one,mul_one] using hlog + have hK : Tendsto K (𝓝[>] (0:ℝ)) (𝓝 (M' 0)) := by + have hz : Tendsto (fun s : ℝ => A*s) (𝓝[>] (0:ℝ)) (𝓝 0) := by + have hid : Tendsto (fun s : ℝ => s) (𝓝[>] (0:ℝ)) (𝓝 0) := + tendsto_id.mono_left nhdsWithin_le_nhds + simpa only [mul_zero] using hid.const_mul A + simpa only [sub_zero] using hl.sub hz + have hb : K t ≤ M' 0 := ge_of_tendsto hK (by + have hu : ∀ᶠ s : ℝ in 𝓝[>] (0:ℝ), s < t := + (show ∀ᶠ s : ℝ in 𝓝 (0:ℝ), s < t from Iio_mem_nhds ht).filter_mono nhdsWithin_le_nhds + filter_upwards [self_mem_nhdsWithin,hu] with s hs hst + exact hanti hs ht hst.le) + have hh : Real.log (M t)/t ≤ M' 0+A*t := by + change Real.log (M t)/t-A*t ≤ M' 0 at hb + linarith + have hf := (div_le_iff₀ ht).mp hh + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/MatrixRotation.lean b/lean/OAI/Probability/InvariantIsing/Haar/MatrixRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d54c4d816f449789c7f9c4997b8c87801c9ab606 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/MatrixRotation.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Haar.Rotation +import OAI.Probability.InvariantIsing.Haar.HaarDerivative +import OAI.Probability.InvariantIsing.Haar.PublishedInputs + +namespace OAI + +/-! Relating the orthogonal matrix and Euclidean-isometry models. -/ + +noncomputable section + +open scoped BigOperators Matrix + +namespace InvariantIsing + +lemma orthogonal_mulVec_norm_sq {N : ℕ} (U : Orthogonal N) + (v : EuclideanSpace ℝ (Fin N)) : + ‖WithLp.toLp 2 ((U : Matrix (Fin N) (Fin N) ℝ) *ᵥ v.ofLp)‖ ^ 2 = ‖v‖ ^ 2 := by + have hU : (U : Matrix (Fin N) (Fin N) ℝ)ᵀ * + (U : Matrix (Fin N) (Fin N) ℝ) = 1 := + (Matrix.mem_orthogonalGroup_iff' (Fin N) ℝ).mp U.property + rw [EuclideanSpace.real_norm_sq_eq, EuclideanSpace.real_norm_sq_eq] + simp only [pow_two] + change ((U : Matrix (Fin N) (Fin N) ℝ) *ᵥ v.ofLp) ⬝ᵥ + ((U : Matrix (Fin N) (Fin N) ℝ) *ᵥ v.ofLp) = v.ofLp ⬝ᵥ v.ofLp + rw [← Matrix.dotProduct_transpose_mulVec, Matrix.mulVec_mulVec, hU, + Matrix.one_mulVec] + +/-- An orthogonal matrix acts as a linear isometry in the pressure model. -/ +def matrixRotation {N : ℕ} (U : Orthogonal N) : Rotation N := + { ((WithLp.linearEquiv 2 ℝ (Fin N → ℝ)).trans + (Matrix.UnitaryGroup.toLinearEquiv U)).trans + (WithLp.linearEquiv 2 ℝ (Fin N → ℝ)).symm with + norm_map' := fun v => (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + (orthogonal_mulVec_norm_sq U v) } + +@[simp] lemma matrixRotation_apply {N : ℕ} (U : Orthogonal N) + (v : EuclideanSpace ℝ (Fin N)) (i : Fin N) : + matrixRotation U v i = ∑ j, (U : Matrix (Fin N) (Fin N) ℝ) i j * v j := rfl + +/-- Restricting from O(N) to SO(N) preserves the same spectral action. -/ +def specialRotation {N : ℕ} (U : SpecialOrthogonal N) : Rotation N := + matrixRotation ⟨U.val, (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).1⟩ + +@[simp] lemma specialRotation_apply {N : ℕ} (U : SpecialOrthogonal N) + (v : EuclideanSpace ℝ (Fin N)) (i : Fin N) : + specialRotation U v i = ∑ j, (U : Matrix (Fin N) (Fin N) ℝ) i j * v j := rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/MedianMean.lean b/lean/OAI/Probability/InvariantIsing/Haar/MedianMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f231e727762efbad0f9837f97371e8deb8605af --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/MedianMean.lean @@ -0,0 +1,113 @@ +import OAI.Probability.InvariantIsing.Pressure.AlmostSure + +namespace OAI + +/-! Relating the deterministic medians and means in the concentration step. -/ + +noncomputable section + +open MeasureTheory Filter +open scoped Topology + +namespace InvariantIsing + +lemma abs_median_le_bound {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (m B : ℝ) + (hB : ∀ ω, |f ω| ≤ B) + (hl : (1 / 2 : ℝ) ≤ μ.real {ω | f ω ≤ m}) + (hu : (1 / 2 : ℝ) ≤ μ.real {ω | m ≤ f ω}) : |m| ≤ B := by + apply abs_le.mpr + constructor + · by_contra h + have hm : m < -B := lt_of_not_ge h + have he : {ω | f ω ≤ m} = (∅ : Set Ω) := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro ω hω + change f ω ≤ m at hω + have hf := (abs_le.mp (hB ω)).1 + linarith + rw [he] at hl + norm_num at hl + · by_contra h + have hm : B < m := lt_of_not_ge h + have he : {ω | m ≤ f ω} = (∅ : Set Ω) := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro ω hω + change m ≤ f ω at hω + have hf := (abs_le.mp (hB ω)).2 + linarith + rw [he] at hu + norm_num at hu + +/-- A bounded deviation has mean at most r plus its bound times the r-tail. -/ +lemma abs_integral_sub_le_deviation_tail {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) + (hfi : Integrable f μ) (m B r : ℝ) (hr : 0 ≤ r) + (hB : ∀ ω, |f ω - m| ≤ B) : + |(∫ ω, f ω ∂μ) - m| ≤ r + B * μ.real {ω | r ≤ |f ω - m|} := by + let A : Set Ω := {ω | r ≤ |f ω - m|} + have hA : MeasurableSet A := measurableSet_le measurable_const (hf.sub_const m).abs + have hiA : Integrable (A.indicator (fun _ => (1 : ℝ))) μ := + (integrable_const 1).indicator hA + have hupper : Integrable (fun ω => r + B * A.indicator (fun _ => (1 : ℝ)) ω) μ := + (integrable_const r).add (hiA.const_mul B) + have he (ω : Ω) : |f ω - m| ≤ r + B * A.indicator (fun _ => (1 : ℝ)) ω := by + by_cases hω : ω ∈ A + · rw [Set.indicator_of_mem hω, mul_one] + linarith [hB ω] + · rw [Set.indicator_of_notMem hω, mul_zero, add_zero] + exact (lt_of_not_ge hω).le + calc + _ = |∫ ω, f ω - m ∂μ| := by rw [integral_sub hfi (integrable_const m)]; simp + _ ≤ ∫ ω, |f ω - m| ∂μ := by + simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun ω => f ω - m) + _ ≤ ∫ ω, r + B * A.indicator (fun _ => (1 : ℝ)) ω ∂μ := + integral_mono (hfi.sub (integrable_const m)).abs hupper he + _ = r + B * μ.real A := by + rw [integral_add (integrable_const r) (hiA.const_mul B), integral_const_mul, + integral_indicator_const 1 hA] + simp + +/-- Uniformly bounded observables with exponential tails about their medians +have means and medians asymptotically equal. -/ +theorem tendsto_mean_sub_median_zero {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : ℕ → Ω → ℝ) (hf : ∀ n, Measurable (f n)) + (m : ℕ → ℝ) (B : ℝ) (hB : 0 ≤ B) (hbound : ∀ n ω, |f n ω| ≤ B) + (hl : ∀ n, (1 / 2 : ℝ) ≤ μ.real {ω | f n ω ≤ m n}) + (hu : ∀ n, (1 / 2 : ℝ) ≤ μ.real {ω | m n ≤ f n ω}) + (htail : ∀ r : ℝ, 0 < r → ∃ C a : ℝ, 0 ≤ C ∧ 0 < a ∧ + ∀ n, μ.real {ω | r ≤ |f n ω - m n|} ≤ C * Real.exp (-a * (n : ℝ))) : + Tendsto (fun n => (∫ ω, f n ω ∂μ) - m n) atTop (𝓝 0) := by + have hi (n : ℕ) : Integrable (f n) μ := + (integrable_const B).mono' (hf n).aestronglyMeasurable + (ae_of_all _ fun ω => by simpa only [Real.norm_eq_abs] using hbound n ω) + have hm (n : ℕ) : |m n| ≤ B := abs_median_le_bound μ (f n) (m n) B (hbound n) (hl n) (hu n) + have hdev (n : ℕ) (ω : Ω) : |f n ω - m n| ≤ 2 * B := by + have hs := (abs_sub _ _).trans (add_le_add (hbound n ω) (hm n)) + linarith + apply Metric.tendsto_atTop.mpr + intro ε hε + obtain ⟨C, a, hC, ha, ht⟩ := htail (ε / 2) (by positivity) + have hlim : Tendsto (fun n : ℕ => ε / 2 + 2 * B * (C * Real.exp (-a * (n : ℝ)))) + atTop (𝓝 (ε / 2)) := by + have hlin : Tendsto (fun n : ℕ => -a * (n : ℝ)) atTop atBot := + by simpa only [Function.comp_def, neg_mul] using + tendsto_neg_atTop_atBot.comp (tendsto_natCast_atTop_atTop.const_mul_atTop ha) + have he := (Real.tendsto_exp_atBot.comp hlin).const_mul C + simpa using (he.const_mul (2 * B)).const_add (ε / 2) + have hevent : ∀ᶠ n : ℕ in atTop, ε / 2 + 2 * B * (C * Real.exp (-a * (n : ℝ))) < ε := + hlim.eventually (gt_mem_nhds (by linarith : ε / 2 < ε)) + obtain ⟨N, hN⟩ := eventually_atTop.mp hevent + refine ⟨N, ?_⟩ + intro n hn + have hb := abs_integral_sub_le_deviation_tail μ (f n) (hf n) (hi n) (m n) (2 * B) + (ε / 2) (by positivity) (hdev n) + have hb' := hb.trans (add_le_add le_rfl + (mul_le_mul_of_nonneg_left (ht n) (by positivity : 0 ≤ 2 * B))) + simpa only [Real.dist_eq, sub_zero] using hb'.trans_lt (hN n hn) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/PlaneRotation.lean b/lean/OAI/Probability/InvariantIsing/Haar/PlaneRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6904f78b1dda462aa57ba263047fa0de57010f2f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/PlaneRotation.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Haar.MatrixRotation + +namespace OAI + +/-! Smooth coordinate-plane rotations for the finite Haar Ward calculation. -/ + +noncomputable section + +open scoped BigOperators Matrix Matrix.Norms.Frobenius + +namespace InvariantIsing + +/-- Generator with xᵢ'=xⱼ and xⱼ'=-xᵢ. -/ +def planeGenerator {N : ℕ} (i j : Fin N) : Matrix (Fin N) (Fin N) ℝ := + Matrix.single i j 1 - Matrix.single j i 1 + +lemma planeGenerator_skew {N : ℕ} (i j : Fin N) : + planeGenerator i j ∈ skewAdjoint (Matrix (Fin N) (Fin N) ℝ) := by + rw [skewAdjoint.mem_iff] + simp [planeGenerator, Matrix.star_eq_conjTranspose] + +/-- The exponential of the plane generator is orthogonal. -/ +def planeRotation {N : ℕ} (i j : Fin N) (t : ℝ) : Orthogonal N := + ⟨NormedSpace.exp (t • planeGenerator i j), + NormedSpace.exp_mem_unitary_of_mem_skewAdjoint + (by simpa only [skewAdjoint.mem_iff, star_smul, star_trivial, smul_neg] using + congrArg (fun M => t • M) (skewAdjoint.mem_iff.mp (planeGenerator_skew i j)))⟩ + +@[simp] lemma planeRotation_zero {N : ℕ} (i j : Fin N) : planeRotation i j 0 = 1 := by + apply Subtype.ext + simp [planeRotation] + +lemma planeGenerator_mulVec {N : ℕ} (i j k : Fin N) (v : Fin N → ℝ) : + (planeGenerator i j *ᵥ v) k = + (if k = i then v j else 0) - (if k = j then v i else 0) := by + simp [planeGenerator, Matrix.sub_mulVec, Matrix.single_mulVec, Function.update_apply, eq_comm] + +/-- Coordinate evaluation of matrix-vector multiplication as a continuous +linear functional, with the Frobenius norm used only for the exponential. -/ +def matrixVectorCoordinate {N : ℕ} (k : Fin N) (v : Fin N → ℝ) : + Matrix (Fin N) (Fin N) ℝ →L[ℝ] ℝ := + (show Matrix (Fin N) (Fin N) ℝ →ₗ[ℝ] ℝ from + { toFun := fun M => (M *ᵥ v) k + map_add' := by intros; simp [Matrix.add_mulVec] + map_smul' := by intros; simp [Matrix.smul_mulVec] }).toContinuousLinearMap + +/-- The coordinate derivative along a genuine Haar-preserving plane rotation. -/ +lemma hasDerivAt_planeRotation_coordinate {N : ℕ} (i j k : Fin N) + (U : Orthogonal N) (v : EuclideanSpace ℝ (Fin N)) (t : ℝ) : + HasDerivAt (fun s => matrixRotation (planeRotation i j s * U) v k) + ((if k = i then matrixRotation (planeRotation i j t * U) v j else 0) - + (if k = j then matrixRotation (planeRotation i j t * U) v i else 0)) t := by + let A := planeGenerator i j + let ev := matrixVectorCoordinate k v.ofLp + have he := (hasDerivAt_exp_smul_const' A t).mul_const + (U : Matrix (Fin N) (Fin N) ℝ) + have hd := ev.hasFDerivAt.comp_hasDerivAt t he + convert hd using 1 + · rfl + · change _ = ((A * NormedSpace.exp (t • A) * (U : Matrix (Fin N) (Fin N) ℝ)) *ᵥ + v.ofLp) k + rw [mul_assoc, ← Matrix.mulVec_mulVec] + exact (planeGenerator_mulVec i j k + ((NormedSpace.exp (t • A) * (U : Matrix (Fin N) (Fin N) ℝ)) *ᵥ v.ofLp)).symm + +lemma hasDerivAt_planeRotation_energy {N : ℕ} (i j : Fin N) + (U : Orthogonal N) (eig : Fin N → ℝ) (σ : Spin N) (t : ℝ) : + HasDerivAt (fun s => rotatedEnergy eig (matrixRotation (planeRotation i j s * U)) σ) + ((eig i - eig j) * matrixRotation (planeRotation i j t * U) (spinVector σ) i * + matrixRotation (planeRotation i j t * U) (spinVector σ) j) t := by + have hd := (HasDerivAt.fun_sum (u := Finset.univ) (fun k _ => + ((hasDerivAt_planeRotation_coordinate i j k U (spinVector σ) t).pow 2).const_mul + (eig k))).const_mul (1 / 2 : ℝ) + convert hd using 1 + · rfl + · simp only [Nat.cast_ofNat, mul_sub, mul_ite, mul_zero, sub_mul, + Finset.sum_sub_distrib, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/PositiveExponentialSum.lean b/lean/OAI/Probability/InvariantIsing/Haar/PositiveExponentialSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..546f04508ce6a29419d409b344fe4e6a1e7ea541 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/PositiveExponentialSum.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialEntropyBound + +namespace OAI + +/-! Monotone positive truncations of the scalar exponential series. -/ +noncomputable section +open Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def positiveExpSum (n : ℕ) (x : ℝ) : ℝ := + ∑ k ∈ Finset.range (n+1), x^k/(Nat.factorial k : ℝ) + +lemma positiveExpSum_one_le (n : ℕ) {x : ℝ} (hx : 0 ≤ x) : 1 ≤ positiveExpSum n x := by + have h := Finset.single_le_sum + (f := fun k => x^k/(Nat.factorial k : ℝ)) + (fun k (_ : k ∈ Finset.range (n+1)) => div_nonneg (pow_nonneg hx k) (Nat.cast_nonneg _)) + (show 0 ∈ Finset.range (n+1) by simp) + simpa only [positiveExpSum,pow_zero,Nat.factorial_zero,Nat.cast_one,div_one] using h + +lemma positiveExpSum_mono (n : ℕ) {x : ℝ} (hx : 0 ≤ x) : + positiveExpSum n x ≤ positiveExpSum (n+1) x := by + unfold positiveExpSum + conv_rhs => rw [Finset.sum_range_succ] + exact le_add_of_nonneg_right (div_nonneg (pow_nonneg hx _) (Nat.cast_nonneg _)) + +lemma positiveExpSum_le_exp (n : ℕ) {x : ℝ} (hx : 0 ≤ x) : + positiveExpSum n x ≤ Real.exp x := Real.sum_le_exp_of_nonneg hx (n+1) + +lemma positiveExpSum_tendsto (x : ℝ) : + Tendsto (fun n : ℕ => positiveExpSum n x) atTop (𝓝 (Real.exp x)) := by + have h := (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) x).tendsto_sum_nat + have hh := h.comp (tendsto_add_atTop_nat 1) + simpa only [positiveExpSum,Function.comp_def,smul_eq_mul,div_eq_mul_inv,mul_comm, + Real.exp_eq_exp_ℝ] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/ProbabilityMedian.lean b/lean/OAI/Probability/InvariantIsing/Haar/ProbabilityMedian.lean new file mode 100644 index 0000000000000000000000000000000000000000..1781a4681f84d193377fd7992ba34fc2aa1aee8c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/ProbabilityMedian.lean @@ -0,0 +1,68 @@ +import Mathlib + +namespace OAI + +/-! Existence of a median for every real probability law, including laws with atoms. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped Topology +namespace InvariantIsing + +theorem probability_real_median (ν : Measure ℝ) [IsProbabilityMeasure ν] : + ∃ m : ℝ, (1/2:ℝ) ≤ ν.real (Iic m) ∧ (1/2:ℝ) ≤ ν.real (Ici m) := by + let F := cdf ν + let S : Set ℝ := {x | (1/2:ℝ) ≤ F x} + have htop : ∃ x : ℝ, (1/2:ℝ) < F x := by + have h := (tendsto_cdf_atTop ν).eventually (lt_mem_nhds (by norm_num : (1/2:ℝ) < 1)) + exact h.exists + have hbot : ∃ x : ℝ, F x < (1/2:ℝ) := by + have h := (tendsto_cdf_atBot ν).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1/2)) + exact h.exists + obtain ⟨b,hb⟩ := hbot + have hne : S.Nonempty := by obtain ⟨x,hx⟩ := htop; exact ⟨x,hx.le⟩ + have hbb : BddBelow S := by + refine ⟨b,?_⟩ + intro x hx + by_contra h + have hm := (monotone_cdf ν) (le_of_not_ge h) + change (1/2:ℝ) ≤ F x at hx + exact (not_le_of_gt hb) (hx.trans hm) + let m := sInf S + have hright (x : ℝ) (hx : m < x) : (1/2:ℝ) ≤ F x := by + obtain ⟨y,hy,hyx⟩ := exists_lt_of_csInf_lt hne hx + exact hy.trans ((monotone_cdf ν) hyx.le) + have hleft (x : ℝ) (hx : x < m) : F x < (1/2:ℝ) := by + by_contra h + have hxS : x ∈ S := le_of_not_gt h + exact (not_le_of_gt hx) (csInf_le hbb hxS) + have hfm : (1/2:ℝ) ≤ F m := by + apply ge_of_tendsto ((F.right_continuous m).mono Ioi_subset_Ici_self) + filter_upwards [self_mem_nhdsWithin] with x hx + exact hright x hx + have hfl : Function.leftLim F m ≤ (1/2:ℝ) := by + apply le_of_tendsto (F.mono.tendsto_leftLim m) + filter_upwards [self_mem_nhdsWithin] with x hx + exact (hleft x hx).le + refine ⟨m,?_,?_⟩ + · simpa only [F,cdf_eq_real] using hfm + · have he : ν (Ici m) = ENNReal.ofReal (1-Function.leftLim F m) := by + rw [← measure_cdf ν] + exact (cdf ν).measure_Ici (tendsto_cdf_atTop ν) m + rw [Measure.real,he,ENNReal.toReal_ofReal (by linarith)] + linarith + +theorem measurable_median {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) : + ∃ m : ℝ, (1/2:ℝ) ≤ μ.real {ω | f ω ≤ m} ∧ (1/2:ℝ) ≤ μ.real {ω | m ≤ f ω} := by + obtain ⟨m,hm1,hm2⟩ := probability_real_median (μ.map f) + refine ⟨m,?_,?_⟩ + · rw [map_measureReal_apply hf measurableSet_Iic] at hm1 + exact hm1 + · rw [map_measureReal_apply hf measurableSet_Ici] at hm2 + exact hm2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/PublishedInputs.lean b/lean/OAI/Probability/InvariantIsing/Haar/PublishedInputs.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4e5955c8d2cd54140bd19c246cbe6c99a8f4f27 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/PublishedInputs.lean @@ -0,0 +1,65 @@ +import Mathlib + +namespace OAI + +/-! +Haar concentration and Gaussian Poincaré inequalities. + +Gromov–Milman, *A topological application of the isoperimetric inequality*, +American Journal of Mathematics 105 (1983), 843–854, Section 1.2, +Remark 2, and the special-orthogonal example in Section 3.4 give the +following concentration specialization. +-/ + +noncomputable section + +open MeasureTheory +open scoped BigOperators NNReal + +namespace InvariantIsing + +abbrev SpecialOrthogonal (N : ℕ) := Matrix.specialOrthogonalGroup (Fin N) ℝ + +/-- Frobenius distance, with the unnormalized matrix-coordinate convention. -/ +def frobeniusDistance {N : ℕ} (U V : SpecialOrthogonal N) : ℝ := + Real.sqrt (∑ i, ∑ j, ((U : Matrix (Fin N) (Fin N) ℝ) i j - + (V : Matrix (Fin N) (Fin N) ℝ) i j) ^ 2) + +/-- Haar concentration for arbitrary +Frobenius-Lipschitz observables on `SO(N)`. The constants are uniform in +dimension, observable, and Lipschitz constant. -/ +def HaarConcentrationInput : Prop := + ∃ C c : ℝ, 0 < C ∧ 0 < c ∧ + ∀ N : ℕ, 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), + IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ f : SpecialOrthogonal N → ℝ, Measurable f → + ∀ L : ℝ, 0 < L → + (∀ U V, |f U - f V| ≤ L * frobeniusDistance U V) → + ∃ m : ℝ, + (1 / 2 : ℝ) ≤ μ.real {U | f U ≤ m} ∧ + (1 / 2 : ℝ) ≤ μ.real {U | m ≤ f U} ∧ + ∀ r : ℝ, 0 < r → + μ.real {U | r ≤ |f U - m|} ≤ + C * Real.exp (-c * (N : ℝ) * r ^ 2 / L ^ 2) + +/-- The finite-dimensional Gaussian Poincaré inequality specialized to a +globally Lipschitz function. The Euclidean norm is essential: a coordinatewise +bound for the supremum norm would introduce a dimension factor. + +Published source: Bakry–Émery, *Diffusions hypercontractives*, Séminaire de +Probabilités XIX (1985), Proposition 5, equation (20), p.198, with `U(x)=x²`, +and Corollary 2, equation (23), p.199, with the Ornstein–Uhlenbeck example +on pp.199–200 (the carré-du-champ calculation is on p.186). The usual +Lipschitz specialization follows by smooth approximation. -/ +def GaussianLipschitzVarianceInput : Prop := + ∀ d : ℕ, ∀ L : ℝ≥0, ∀ f : EuclideanSpace ℝ (Fin d) → ℝ, + LipschitzWith L f → + ProbabilityTheory.variance f (ProbabilityTheory.stdGaussian (EuclideanSpace ℝ (Fin d))) ≤ + (L : ℝ) ^ 2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/ReflectionPairCurve.lean b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionPairCurve.lean new file mode 100644 index 0000000000000000000000000000000000000000..31dfd11655df61be498b42d5bd7ef1c84e4c6b7a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionPairCurve.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Haar.ReflectionSegmentDerivative + +namespace OAI + +/-! A genuine special-orthogonal curve for a pair of hyperplane reflections. -/ +noncomputable section +open Matrix Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +def reflectionPair {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hv : v ≠ 0) (hw : w ≠ 0) : SpecialOrthogonal N := + ⟨rotationMatrix (hyperplaneReflection v)*rotationMatrix (hyperplaneReflection w), + Matrix.mem_specialOrthogonalGroup_iff.mpr + ⟨(Matrix.orthogonalGroup (Fin N) ℝ).mul_mem (rotationMatrix_mem _) (rotationMatrix_mem _), + by rw [Matrix.det_mul,rotationMatrix_reflection_det v hv, + rotationMatrix_reflection_det w hw]; norm_num⟩⟩ + +def reflectionPairCurve {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hw : w ≠ 0) (t : ℝ) : SpecialOrthogonal N := + if h : reflectionNormalSegment v w t ≠ 0 then + reflectionPair (reflectionNormalSegment v w t) w h hw else 1 + +lemma reflectionPairCurve_hasDerivAt {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hw : w ≠ 0) (t : ℝ) (ht : reflectionNormalSegment v w t ≠ 0) (i j : Fin N) : + HasDerivAt (fun s => (reflectionPairCurve v w hw s : Matrix (Fin N) (Fin N) ℝ) i j) + ((reflectionSegmentDerivative v w t*rotationMatrix (hyperplaneReflection w)) i j) t := by + have hd := HasDerivAt.fun_sum (u := Finset.univ) fun k _ => + (reflectionSegmentMatrix_hasDerivAt v w t ht i k).mul_const + (rotationMatrix (hyperplaneReflection w) k j) + have hn : ∀ᶠ s in 𝓝 t, reflectionNormalSegment v w s ≠ 0 := by + have hc : Continuous (reflectionNormalSegment v w) := by + unfold reflectionNormalSegment + fun_prop + exact hc.continuousAt.eventually_ne ht + have he : (fun s => (reflectionPairCurve v w hw s : Matrix (Fin N) (Fin N) ℝ) i j) =ᶠ[𝓝 t] + fun s => ∑ k, reflectionSegmentMatrix v w s i k*rotationMatrix (hyperplaneReflection w) k j := by + filter_upwards [hn] with s hs + simp only [reflectionPairCurve,dite_eq_left hs,reflectionPair,Matrix.mul_apply,reflectionSegmentMatrix] + exact hd.congr_of_eventuallyEq he + +lemma reflectionPairCurve_zero {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hv : v ≠ 0) (hw : w ≠ 0) : reflectionPairCurve v w hw 0 = reflectionPair v w hv hw := by + simp only [reflectionPairCurve,reflectionNormalSegment,sub_zero,one_smul,zero_smul,add_zero, + dite_eq_left hv] + +lemma reflectionPairCurve_one {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hw : w ≠ 0) : reflectionPairCurve v w hw 1 = 1 := by + apply Subtype.ext + simp only [reflectionPairCurve,reflectionNormalSegment,sub_self,zero_smul,one_smul,zero_add, + dite_eq_left hw,reflectionPair] + rw [← rotationMatrix_mul,show hyperplaneReflection w*hyperplaneReflection w = 1 from + Submodule.reflection_mul_reflection _,rotationMatrix_one] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/ReflectionPairPath.lean b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionPairPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca9177a1ca48f77da86fca752439b8510be2f621 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionPairPath.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Haar.ReflectionPairCurve +import OAI.Probability.InvariantIsing.Haar.HaarDifferentiableCurve + +namespace OAI + +/-! Every nonzero reflection pair admits a differentiable curve to the identity. -/ +noncomputable section +open Matrix Set +open scoped BigOperators +namespace InvariantIsing + +lemma hyperplaneReflection_neg {N : ℕ} (v : EuclideanSpace ℝ (Fin N)) : + hyperplaneReflection (-v) = hyperplaneReflection v := by + have hs : (ℝ ∙ (-v)) = (ℝ ∙ v) := by + simpa only [Set.neg_singleton] using (Submodule.span_neg (R := ℝ) ({v} : Set _)) + unfold hyperplaneReflection + simp only [hs] + +def reflectionPairPath {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hv : v ≠ 0) (hw : w ≠ 0) (hvw : 0 ≤ inner ℝ v w) : HaarDifferentiableCurve N where + value := reflectionPairCurve v w hw + velocity := fun t => reflectionSegmentDerivative v w t*rotationMatrix (hyperplaneReflection w) + hasDeriv := fun t ht i j => reflectionPairCurve_hasDerivAt v w hw t + (reflectionNormalSegment_nonzero v w hv hw hvw ht) i j + continuous_velocity := by + intro i j + simp only [Matrix.mul_apply] + exact continuousOn_finsetSum _ fun k _ => + (continuousOn_reflectionSegmentDerivative v w hv hw hvw i k).mul continuousOn_const + +lemma reflectionPair_exists_path {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hv : v ≠ 0) (hw : w ≠ 0) : + ∃ γ : HaarDifferentiableCurve N, + γ.value 0 = reflectionPair v w hv hw ∧ γ.value 1 = 1 := by + by_cases h : 0 ≤ inner ℝ v w + · exact ⟨reflectionPairPath v w hv hw h,reflectionPairCurve_zero v w hv hw, + reflectionPairCurve_one v w hw⟩ + · have hw' : -w ≠ 0 := neg_ne_zero.mpr hw + have h' : 0 ≤ inner ℝ v (-w) := by rw [inner_neg_right]; linarith + refine ⟨reflectionPairPath v (-w) hv hw' h',?_,reflectionPairCurve_one v (-w) hw'⟩ + change reflectionPairCurve v (-w) hw' 0 = _ + rw [reflectionPairCurve_zero v (-w) hv hw'] + apply Subtype.ext + change rotationMatrix (hyperplaneReflection v)*rotationMatrix (hyperplaneReflection (-w)) = _ + rw [hyperplaneReflection_neg] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/ReflectionParity.lean b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionParity.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d05ddca8f56795ecf34164bbb8c06fbfd6ebd62 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionParity.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Haar.RotationMatrix +import Mathlib.Data.List.Induction + +namespace OAI + +/-! Even nonzero reflection factorizations of special orthogonal matrices. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma rotationMatrix_list_prod {N : ℕ} (l : List (Rotation N)) : + rotationMatrix l.prod = (l.map rotationMatrix).prod := by + induction l with + | nil => simp + | cons a l ih => simp only [List.prod_cons,List.map_cons,rotationMatrix_mul,ih] + +lemma reflectionList_remove_zero {N : ℕ} (l : List (EuclideanSpace ℝ (Fin N))) : + ((l.filter (fun v => v ≠ 0)).map hyperplaneReflection).prod = + (l.map hyperplaneReflection).prod := by + induction l with + | nil => rfl + | cons a l ih => + simp only [ne_eq,decide_not] at ih + by_cases ha : a = 0 + · simp [ha,ih] + · simp [ha,ih] + +lemma reflectionList_det {N : ℕ} (l : List (EuclideanSpace ℝ (Fin N))) + (hl : ∀ v ∈ l, v ≠ 0) : + (rotationMatrix ((l.map hyperplaneReflection).prod)).det = (-1 : ℝ)^l.length := by + induction l with + | nil => simp + | cons a l ih => + have ha := hl a (by simp) + have htail : ∀ v ∈ l, v ≠ 0 := fun v hv => hl v (by simp [hv]) + simp only [List.map_cons,List.prod_cons,rotationMatrix_mul,Matrix.det_mul, + rotationMatrix_reflection_det a ha,ih htail,List.length_cons,pow_succ] + ring + +lemma specialRotation_even_reflections {N : ℕ} (U : SpecialOrthogonal N) : + ∃ l : List (EuclideanSpace ℝ (Fin N)), + (∀ v ∈ l, v ≠ 0) ∧ Even l.length ∧ + specialRotation U = (l.map hyperplaneReflection).prod := by + obtain ⟨l,_,hl⟩ := (specialRotation U).reflections_generate_dim + let l' := l.filter (fun v => v ≠ 0) + have hnonzero : ∀ v ∈ l', v ≠ 0 := by + intro v hv + exact of_decide_eq_true (List.mem_filter.mp hv).2 + have heq : specialRotation U = (l'.map hyperplaneReflection).prod := by + rw [reflectionList_remove_zero] + exact hl + have hdet : (-1 : ℝ)^l'.length = 1 := by + rw [← reflectionList_det l' hnonzero,← heq,rotationMatrix_specialRotation] + exact (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).2 + exact ⟨l',hnonzero,(neg_one_pow_eq_one_iff_even (by norm_num : (-1 : ℝ) ≠ 1)).mp hdet,heq⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/ReflectionSegment.lean b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionSegment.lean new file mode 100644 index 0000000000000000000000000000000000000000..c378b7edd1b366223457cc77835a0934d249b4f0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionSegment.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Haar.RotationMatrix +import OAI.Probability.InvariantIsing.Haar.HaarCurveBound + +namespace OAI + +/-! Nonsingular interpolation of reflection normals. -/ +noncomputable section +open Matrix Set +open scoped BigOperators +namespace InvariantIsing + +def reflectionNormalSegment {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : + EuclideanSpace ℝ (Fin N) := (1-t) • v+t • w + +lemma reflectionNormalSegment_nonzero {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) + (hv : v ≠ 0) (hw : w ≠ 0) (hvw : 0 ≤ inner ℝ v w) + {t : ℝ} (ht : t ∈ Icc (0:ℝ) 1) : reflectionNormalSegment v w t ≠ 0 := by + by_cases h1 : t = 1 + · simpa [reflectionNormalSegment,h1] using hw + have hinner : 0 < inner ℝ v (reflectionNormalSegment v w t) := by + simp only [reflectionNormalSegment,inner_add_right,inner_smul_right, + real_inner_self_eq_norm_sq] + exact add_pos_of_pos_of_nonneg + (mul_pos (sub_pos.mpr (lt_of_le_of_ne ht.2 h1)) (sq_pos_of_pos (norm_pos_iff.mpr hv))) + (mul_nonneg ht.1 hvw) + intro hz + rw [hz,inner_zero_right] at hinner + exact lt_irrefl _ hinner + +lemma reflectionNormalSegment_hasDerivAt {N : ℕ} + (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) (i : Fin N) : + HasDerivAt (fun s => reflectionNormalSegment v w s i) (w i-v i) t := by + have h := (((hasDerivAt_const t 1).sub (hasDerivAt_id t)).mul_const (v i)).add + ((hasDerivAt_id t).mul_const (w i)) + convert h using 1 + · rfl + · simp only [zero_sub,one_mul,neg_mul] + ring + +def reflectionNormalSquare {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : ℝ := + ∑ i, (reflectionNormalSegment v w t i)^2 + +def reflectionNormalSquareDeriv {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : ℝ := + ∑ i, 2*reflectionNormalSegment v w t i*(w i-v i) + +lemma reflectionNormalSquare_eq {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : + reflectionNormalSquare v w t = ‖reflectionNormalSegment v w t‖^2 := by + rw [EuclideanSpace.real_norm_sq_eq] + rfl + +lemma reflectionNormalSquare_hasDerivAt {N : ℕ} + (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : + HasDerivAt (reflectionNormalSquare v w) (reflectionNormalSquareDeriv v w t) t := by + have hd := HasDerivAt.fun_sum (u := Finset.univ) fun i _ => + (reflectionNormalSegment_hasDerivAt v w t i).pow 2 + convert hd using 1 + · rfl + · apply Finset.sum_congr rfl + intro i _ + simp only [Nat.cast_ofNat] + ring + +lemma continuous_reflectionNormalSegment_entry {N : ℕ} + (v w : EuclideanSpace ℝ (Fin N)) (i : Fin N) : + Continuous (fun t => reflectionNormalSegment v w t i) := by + change Continuous (fun t : ℝ => (1-t)*v i+t*w i) + fun_prop + +lemma continuous_reflectionNormalSquare {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) : + Continuous (reflectionNormalSquare v w) := by + unfold reflectionNormalSquare + exact continuous_finsetSum _ fun i _ => (continuous_reflectionNormalSegment_entry v w i).pow 2 + +lemma continuous_reflectionNormalSquareDeriv {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) : + Continuous (reflectionNormalSquareDeriv v w) := by + unfold reflectionNormalSquareDeriv + exact continuous_finsetSum _ fun i _ => + (continuous_const.mul (continuous_reflectionNormalSegment_entry v w i)).mul continuous_const + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/ReflectionSegmentDerivative.lean b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionSegmentDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fb3d1324e9e3c5aac1420b6fc3fe7d3054d5f57 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/ReflectionSegmentDerivative.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Haar.ReflectionSegment + +namespace OAI + +/-! Entry derivatives along a nonsingular interpolation of reflection normals. -/ +noncomputable section +open Matrix Set +open scoped BigOperators +namespace InvariantIsing + +def reflectionSegmentMatrix {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : + Matrix (Fin N) (Fin N) ℝ := + rotationMatrix (hyperplaneReflection (reflectionNormalSegment v w t)) + +def reflectionSegmentDerivative {N : ℕ} (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) : + Matrix (Fin N) (Fin N) ℝ := Matrix.of fun i j => + -((2*((w i-v i)*reflectionNormalSegment v w t j+ + reflectionNormalSegment v w t i*(w j-v j)))*reflectionNormalSquare v w t- + (2*reflectionNormalSegment v w t i*reflectionNormalSegment v w t j)* + reflectionNormalSquareDeriv v w t)/(reflectionNormalSquare v w t)^2 + +lemma reflectionSegmentMatrix_hasDerivAt {N : ℕ} + (v w : EuclideanSpace ℝ (Fin N)) (t : ℝ) + (ht : reflectionNormalSegment v w t ≠ 0) (i j : Fin N) : + HasDerivAt (fun s => reflectionSegmentMatrix v w s i j) + (reflectionSegmentDerivative v w t i j) t := by + have hq : reflectionNormalSquare v w t ≠ 0 := by + rw [reflectionNormalSquare_eq] + exact pow_ne_zero _ (norm_ne_zero_iff.mpr ht) + have hd := (hasDerivAt_const t ((1 : Matrix (Fin N) (Fin N) ℝ) i j)).sub + ((((reflectionNormalSegment_hasDerivAt v w t i).const_mul 2).mul + (reflectionNormalSegment_hasDerivAt v w t j)).div + (reflectionNormalSquare_hasDerivAt v w t) hq) + convert hd using 1 + · funext s + change rotationMatrix (hyperplaneReflection (reflectionNormalSegment v w s)) i j = + (1 : Matrix (Fin N) (Fin N) ℝ) i j- + 2*reflectionNormalSegment v w s i*reflectionNormalSegment v w s j / + reflectionNormalSquare v w s + rw [reflectionNormalSquare_eq,rotationMatrix_reflection_apply] + · dsimp only [reflectionSegmentDerivative,Matrix.of_apply] + simp only [Pi.mul_apply] + ring + +lemma continuousOn_reflectionSegmentDerivative {N : ℕ} + (v w : EuclideanSpace ℝ (Fin N)) (hv : v ≠ 0) (hw : w ≠ 0) + (hvw : 0 ≤ inner ℝ v w) (i j : Fin N) : + ContinuousOn (fun t => reflectionSegmentDerivative v w t i j) (Icc (0:ℝ) 1) := by + have hq (t : ℝ) (ht : t ∈ Icc (0:ℝ) 1) : reflectionNormalSquare v w t ≠ 0 := by + rw [reflectionNormalSquare_eq] + exact pow_ne_zero _ (norm_ne_zero_iff.mpr + (reflectionNormalSegment_nonzero v w hv hw hvw ht)) + have hn (k : Fin N) : ContinuousOn (fun t => reflectionNormalSegment v w t k) + (Icc (0:ℝ) 1) := (continuous_reflectionNormalSegment_entry v w k).continuousOn + have hs : ContinuousOn (reflectionNormalSquare v w) (Icc (0:ℝ) 1) := + (continuous_reflectionNormalSquare v w).continuousOn + have hd : ContinuousOn (reflectionNormalSquareDeriv v w) (Icc (0:ℝ) 1) := + (continuous_reflectionNormalSquareDeriv v w).continuousOn + dsimp only [reflectionSegmentDerivative,Matrix.of_apply] + exact ((((continuousOn_const.mul + ((continuousOn_const.mul (hn j)).add ((hn i).mul continuousOn_const))).mul hs).sub + (((continuousOn_const.mul (hn i)).mul (hn j)).mul hd)).neg).div (hs.pow 2) + (fun t ht => pow_ne_zero _ (hq t ht)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/Rotation.lean b/lean/OAI/Probability/InvariantIsing/Haar/Rotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab82a20ac6490d174b19098c7729c8206bd32f71 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/Rotation.lean @@ -0,0 +1,128 @@ +import OAI.Probability.InvariantIsing.Core.Model + +namespace OAI + +/-! +# Ising pressure on an orthogonal spectral orbit + +The interaction is defined using a real linear isometry, so orthogonality +is part of its type. The bounds hold pointwise in the rotation; no Haar +or independence assumption is needed for these finite-volume estimates. +-/ + +noncomputable section + +open scoped BigOperators Topology +open Filter + +namespace InvariantIsing + +abbrev Rotation (N : ℕ) := + EuclideanSpace ℝ (Fin N) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin N) + +def spinVector {N : ℕ} (σ : Spin N) : EuclideanSpace ℝ (Fin N) := + WithLp.toLp 2 (fun i => spinValue (σ i)) + +@[simp] lemma spinVector_apply {N : ℕ} (σ : Spin N) (i : Fin N) : + spinVector σ i = spinValue (σ i) := rfl + +lemma spinVector_norm_sq {N : ℕ} (σ : Spin N) : ‖spinVector σ‖ ^ 2 = N := by + rw [EuclideanSpace.real_norm_sq_eq] + simp only [spinVector_apply, spinValue_sq, Finset.sum_const, Finset.card_univ, + Fintype.card_fin, nsmul_eq_mul, mul_one] + +lemma rotated_spin_sq_sum {N : ℕ} (U : Rotation N) (σ : Spin N) : + (∑ i, (U (spinVector σ) i) ^ 2) = N := by + rw [← EuclideanSpace.real_norm_sq_eq, U.norm_map, spinVector_norm_sq] + +/-- The quadratic energy in spectral coordinates, equal to +`σᵀ Uᵀ diag(eig) U σ / 2`. -/ +def rotatedEnergy {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) (σ : Spin N) : ℝ := + (1 / 2 : ℝ) * ∑ i, eig i * (U (spinVector σ) i) ^ 2 + +/-- Equation (1.1), with an optional deterministic magnetic field. -/ +def rotatedPressure {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (c : Fin N → ℝ) : ℝ := + (N : ℝ)⁻¹ * logPartition (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + +lemma rotatedEnergy_constant {N : ℕ} (a : ℝ) (U : Rotation N) (σ : Spin N) : + rotatedEnergy (fun _ => a) U σ = a * N / 2 := by + rw [rotatedEnergy, ← Finset.mul_sum, rotated_spin_sq_sum] + ring + +@[simp] lemma logPartition_zero {X : Type*} [Fintype X] [Nonempty X] : + logPartition (fun _ : X => (0 : ℝ)) = 0 := by + rw [logPartition_eq] + simp + +lemma rotatedPressure_constant {N : ℕ} (hN : 0 < N) (a : ℝ) (U : Rotation N) : + rotatedPressure (fun _ => a) U (fun _ => 0) = a / 2 := by + have he : (fun σ => rotatedEnergy (fun _ : Fin N => a) U σ + + fieldEnergy (fun _ => 0) σ) = (fun _ : Spin N => 0 + a * N / 2) := by + funext σ + simp [rotatedEnergy_constant, fieldEnergy] + rw [rotatedPressure, he, logPartition_add_const, logPartition_zero, zero_add] + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + field_simp + +/-- Pointwise operator comparison in spectral coordinates. -/ +lemma abs_rotatedEnergy_sub_le {N : ℕ} (eig κ : Fin N → ℝ) (U : Rotation N) + (δ : ℝ) (hδ : ∀ i, |eig i - κ i| ≤ δ) (σ : Spin N) : + |rotatedEnergy eig U σ - rotatedEnergy κ U σ| ≤ δ * N / 2 := by + have he : rotatedEnergy eig U σ - rotatedEnergy κ U σ = + (1 / 2 : ℝ) * ∑ i, (eig i - κ i) * (U (spinVector σ) i) ^ 2 := by + simp only [rotatedEnergy, sub_mul, Finset.sum_sub_distrib] + ring + rw [he, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2)] + calc + _ ≤ (1 / 2 : ℝ) * ∑ i, |(eig i - κ i) * (U (spinVector σ) i) ^ 2| := + mul_le_mul_of_nonneg_left (Finset.abs_sum_le_sum_abs _ _) (by norm_num) + _ = (1 / 2 : ℝ) * ∑ i, |eig i - κ i| * (U (spinVector σ) i) ^ 2 := by + simp only [abs_mul, abs_sq] + _ ≤ (1 / 2 : ℝ) * ∑ i, δ * (U (spinVector σ) i) ^ 2 := by + apply mul_le_mul_of_nonneg_left _ (by norm_num) + exact Finset.sum_le_sum fun i _ => mul_le_mul_of_nonneg_right (hδ i) (sq_nonneg _) + _ = δ * N / 2 := by rw [← Finset.mul_sum, rotated_spin_sq_sum]; ring + +/-- Equation (6.6), pointwise in the rotation and independent of the field. -/ +lemma abs_rotatedPressure_sub_le {N : ℕ} (hN : 0 < N) + (eig κ : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) + (δ : ℝ) (hδ : ∀ i, |eig i - κ i| ≤ δ) : + |rotatedPressure eig U c - rotatedPressure κ U c| ≤ δ / 2 := by + have h := abs_logPartition_sub_le + (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + (fun σ => rotatedEnergy κ U σ + fieldEnergy c σ) + (δ * N / 2) (fun σ => by + simpa only [add_sub_add_right_eq_sub] using abs_rotatedEnergy_sub_le eig κ U δ hδ σ) + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + calc + _ = (N : ℝ)⁻¹ * |logPartition (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) - + logPartition (fun σ => rotatedEnergy κ U σ + fieldEnergy c σ)| := by + rw [rotatedPressure, rotatedPressure, ← mul_sub, abs_mul, + abs_of_nonneg (show (0 : ℝ) ≤ (N : ℝ)⁻¹ by positivity)] + _ ≤ (N : ℝ)⁻¹ * (δ * N / 2) := + mul_le_mul_of_nonneg_left h (by positivity) + _ = δ / 2 := by field_simp + +/-- The point-mass spectral specialization: spectra uniformly approaching a scalar +have limiting pressure `a/2` for every choice of rotations. -/ +lemma tendsto_pressure_scalar_spectrum + (eig : (N : ℕ) → Fin (N + 1) → ℝ) (U : (N : ℕ) → Rotation (N + 1)) + (a : ℝ) (δ : ℕ → ℝ) (hδ : Tendsto δ atTop (nhds 0)) + (heig : ∀ N i, |eig N i - a| ≤ δ N) : + Tendsto (fun N => rotatedPressure (eig N) (U N) (fun _ => 0)) atTop (nhds (a / 2)) := by + have hb : ∀ N, |rotatedPressure (eig N) (U N) (fun _ => 0) - a / 2| ≤ δ N / 2 := by + intro N + have h := abs_rotatedPressure_sub_le (Nat.zero_lt_succ N) (eig N) (fun _ => a) + (U N) (fun _ => 0) (δ N) (heig N) + rwa [rotatedPressure_constant (Nat.zero_lt_succ N)] at h + have hz : Tendsto (fun N => |rotatedPressure (eig N) (U N) (fun _ => 0) - a / 2|) + atTop (nhds 0) := + squeeze_zero (fun _ => abs_nonneg _) hb (by simpa using hδ.div_const 2) + exact tendsto_iff_norm_sub_tendsto_zero.mpr (by simpa only [Real.norm_eq_abs] using hz) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/RotationMatrix.lean b/lean/OAI/Probability/InvariantIsing/Haar/RotationMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..74ffea70f715024b2d7e7bb994e7292f84962424 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/RotationMatrix.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Haar.MatrixRotation +import Mathlib.Analysis.InnerProductSpace.Projection.FiniteDimensional + +namespace OAI + +/-! Matrix coordinates for Euclidean isometries and hyperplane reflections. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +def rotationMatrix {N : ℕ} (R : Rotation N) : Matrix (Fin N) (Fin N) ℝ := + LinearMap.toMatrix (EuclideanSpace.basisFun (Fin N) ℝ).toBasis + (EuclideanSpace.basisFun (Fin N) ℝ).toBasis R.toLinearMap + +lemma rotationMatrix_apply {N : ℕ} (R : Rotation N) (i j : Fin N) : + rotationMatrix R i j = R (EuclideanSpace.single j 1) i := by + rw [rotationMatrix,LinearMap.toMatrix_apply] + change (R (EuclideanSpace.basisFun (Fin N) ℝ j)) i = _ + rw [EuclideanSpace.basisFun_apply] + +lemma rotationMatrix_mem {N : ℕ} (R : Rotation N) : + rotationMatrix R ∈ Matrix.orthogonalGroup (Fin N) ℝ := + R.toMatrix_mem_unitaryGroup (EuclideanSpace.basisFun (Fin N) ℝ) + (EuclideanSpace.basisFun (Fin N) ℝ) + +lemma rotationMatrix_mul {N : ℕ} (R S : Rotation N) : + rotationMatrix (R*S) = rotationMatrix R*rotationMatrix S := by + exact LinearMap.toMatrix_mul _ _ _ + +@[simp] lemma rotationMatrix_one {N : ℕ} : rotationMatrix (1 : Rotation N) = 1 := + LinearMap.toMatrix_one _ + +@[simp] lemma rotationMatrix_specialRotation {N : ℕ} (U : SpecialOrthogonal N) : + rotationMatrix (specialRotation U) = (U : Matrix (Fin N) (Fin N) ℝ) := by + ext i j + rw [rotationMatrix_apply,specialRotation_apply] + simp only [PiLp.single_apply,mul_ite,mul_one,mul_zero, + Finset.sum_ite_eq',Finset.mem_univ,ite_true] + +def hyperplaneReflection {N : ℕ} (v : EuclideanSpace ℝ (Fin N)) : Rotation N := + (ℝ ∙ v)ᗮ.reflection + +@[simp] lemma hyperplaneReflection_zero {N : ℕ} : + hyperplaneReflection (0 : EuclideanSpace ℝ (Fin N)) = 1 := by + apply LinearIsometryEquiv.ext + intro x + apply Submodule.reflection_mem_subspace_eq_self + simp + +lemma hyperplaneReflection_apply {N : ℕ} (v x : EuclideanSpace ℝ (Fin N)) : + hyperplaneReflection v x = x-(2*(inner ℝ v x/‖v‖^2)) • v := by + rw [hyperplaneReflection,Submodule.reflection_orthogonal_apply, + Submodule.reflection_singleton_apply] + module + +lemma rotationMatrix_reflection_apply {N : ℕ} (v : EuclideanSpace ℝ (Fin N)) + (i j : Fin N) : + rotationMatrix (hyperplaneReflection v) i j = + (1 : Matrix (Fin N) (Fin N) ℝ) i j-2*v i*v j/‖v‖^2 := by + rw [rotationMatrix_apply,hyperplaneReflection_apply] + simp only [PiLp.sub_apply,PiLp.smul_apply,smul_eq_mul, + EuclideanSpace.inner_single_right,PiLp.single_apply,starRingEnd_apply, + star_trivial,one_mul] + rw [Matrix.one_apply] + split_ifs <;> ring + +lemma rotationMatrix_reflection_det {N : ℕ} (v : EuclideanSpace ℝ (Fin N)) (hv : v ≠ 0) : + Matrix.det (rotationMatrix (hyperplaneReflection v)) = -1 := by + rw [rotationMatrix,LinearMap.det_toMatrix,hyperplaneReflection,Submodule.det_reflection, + Submodule.orthogonal_orthogonal,finrank_span_singleton hv,pow_one] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/SpecialPlaneRotation.lean b/lean/OAI/Probability/InvariantIsing/Haar/SpecialPlaneRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..23c4a53509d18e5164297a6e647b0d255f8af4fc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/SpecialPlaneRotation.lean @@ -0,0 +1,166 @@ +import OAI.Probability.InvariantIsing.Haar.PlaneRotation +import OAI.Probability.InvariantIsing.Core.Ward + +namespace OAI + +/-! Genuine coordinate-plane rotations and infinitesimal Haar invariance on +`SO(N)`, the rotation group used by the actual enriched model. -/ + +noncomputable section + +open MeasureTheory Filter IsingPerceptron +open scoped Topology Matrix Matrix.Norms.Frobenius + +namespace InvariantIsing + +/-- Forget only the determinant-one condition. -/ +def specialToOrthogonal {N : ℕ} : SpecialOrthogonal N →* Orthogonal N where + toFun U := ⟨U.val, (Matrix.mem_specialOrthogonalGroup_iff.mp U.property).1⟩ + map_one' := rfl + map_mul' _ _ := rfl + +@[simp] lemma matrixRotation_specialToOrthogonal {N : ℕ} (U : SpecialOrthogonal N) : + matrixRotation (specialToOrthogonal U) = specialRotation U := rfl + +lemma measurable_specialToOrthogonal {N : ℕ} : + Measurable (specialToOrthogonal : SpecialOrthogonal N → Orthogonal N) := + measurable_subtype_coe.subtype_mk + +/-- Orthogonal determinants have only two possible real values. -/ +lemma orthogonal_det_eq_one_or_neg_one {N : ℕ} (U : Orthogonal N) : + (U : Matrix (Fin N) (Fin N) ℝ).det = 1 ∨ + (U : Matrix (Fin N) (Fin N) ℝ).det = -1 := by + apply mul_self_eq_one_iff.mp + have h := congrArg Matrix.det ((Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mp U.property) + simpa only [Matrix.det_mul, Matrix.det_transpose, Matrix.det_one] using h + +/-- A continuous plane-rotation path starts at determinant one and cannot +switch between the two orthogonal determinant values. -/ +lemma planeRotation_det {N : ℕ} (i j : Fin N) (t : ℝ) : + (planeRotation i j t : Matrix (Fin N) (Fin N) ℝ).det = 1 := by + let f : ℝ → ℝ := fun s => (planeRotation i j s : Matrix (Fin N) (Fin N) ℝ).det + have hc : Continuous f := by + apply Continuous.matrix_det + exact continuous_iff_continuousAt.mpr fun s => + (hasDerivAt_exp_smul_const' (planeGenerator i j) s).continuousAt + have hm : Set.MapsTo f Set.univ ({1, -1} : Set ℝ) := by + intro s _ + simpa only [Set.mem_insert_iff, Set.mem_singleton_iff, f] using + orthogonal_det_eq_one_or_neg_one (planeRotation i j s) + have he : f t = f 0 := isPreconnected_univ.constant_of_mapsTo + (Set.toFinite ({1, -1} : Set ℝ)).isDiscrete hc.continuousOn hm (Set.mem_univ t) + (Set.mem_univ 0) + simpa only [f, planeRotation_zero, OneMemClass.coe_one, Matrix.det_one] using he + +/-- The same matrix exponential, now as an element of the special orthogonal group. -/ +def specialPlaneRotation {N : ℕ} (i j : Fin N) (t : ℝ) : SpecialOrthogonal N := + ⟨(planeRotation i j t).val, + Matrix.mem_specialOrthogonalGroup_iff.mpr ⟨(planeRotation i j t).property, planeRotation_det i j t⟩⟩ + +@[simp] lemma specialPlaneRotation_zero {N : ℕ} (i j : Fin N) : + specialPlaneRotation i j 0 = 1 := by + apply Subtype.ext + change (planeRotation i j 0 : Matrix (Fin N) (Fin N) ℝ) = 1 + simp only [planeRotation_zero, OneMemClass.coe_one] + +@[simp] lemma specialToOrthogonal_planeRotation {N : ℕ} (i j : Fin N) (t : ℝ) : + specialToOrthogonal (specialPlaneRotation i j t) = planeRotation i j t := rfl + +/-- A dominated infinitesimal left rotation has Haar mean zero. -/ +lemma integral_special_rotation_derivative_eq_zero {N : ℕ} (μ : Measure (SpecialOrthogonal N)) + [μ.IsMulLeftInvariant] (R : ℝ → SpecialOrthogonal N) (hR : R 0 = 1) + (f : SpecialOrthogonal N → ℝ) (hf : Measurable f) (hfi : Integrable f μ) + (f' : ℝ → SpecialOrthogonal N → ℝ) (hf' : AEStronglyMeasurable (f' 0) μ) + (B : SpecialOrthogonal N → ℝ) (hB : Integrable B μ) + (hbound : ∀ᵐ U ∂μ, ∀ t ∈ Set.Ioo (-1 : ℝ) 1, ‖f' t U‖ ≤ B U) + (hderiv : ∀ᵐ U ∂μ, ∀ t ∈ Set.Ioo (-1 : ℝ) 1, + HasDerivAt (fun s => f (R s * U)) (f' t U) t) : + ∫ U, f' 0 U ∂μ = 0 := by + have hs : Set.Ioo (-1 : ℝ) 1 ∈ 𝓝 (0 : ℝ) := Ioo_mem_nhds (by norm_num) (by norm_num) + have hm : ∀ᶠ t in 𝓝 (0 : ℝ), AEStronglyMeasurable (fun U => f (R t * U)) μ := by + apply Filter.Eventually.of_forall + intro t + have hmul : Measurable (fun U : SpecialOrthogonal N => R t * U) := by + apply Measurable.subtype_mk + change Measurable (fun U : SpecialOrthogonal N => + (R t : Matrix (Fin N) (Fin N) ℝ) * (U : Matrix (Fin N) (Fin N) ℝ)) + apply Measurable.of_eval + intro i + apply Measurable.of_eval + intro j + simp only [Matrix.mul_apply] + exact Finset.measurable_sum _ fun k _ => + measurable_const.mul ((measurable_pi_apply j).comp + ((measurable_pi_apply k).comp measurable_subtype_coe)) + exact (hf.comp hmul).aestronglyMeasurable + have hi : Integrable (fun U => f (R 0 * U)) μ := by simpa only [hR, one_mul] using hfi + obtain ⟨_, hd⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le hs hm hi hf' + hbound hB hderiv + have he : (fun t => ∫ U, f (R t * U) ∂μ) = fun _ : ℝ => ∫ U, f U ∂μ := by + funext t + exact integral_mul_left_eq_self f (R t) + rw [he] at hd + exact hd.unique (hasDerivAt_const (0 : ℝ) (∫ U, f U ∂μ)) + + +variable {S : Type*} [Fintype S] + +/-- Exact finite-volume Haar Ward identity. All regularity assumptions concern +finite-dimensional derivatives; none assumes a limiting overlap identity. -/ +theorem integral_special_gibbs_rotation_identity {N : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (R : ℝ → SpecialOrthogonal N) (hR : R 0 = 1) + {w : S → ℝ} (hw : GibbsReference w) + (H A : SpecialOrthogonal N → S → ℝ) + (hHm : ∀ σ, Measurable (fun U => H U σ)) + (hAm : ∀ σ, Measurable (fun U => A U σ)) + (dH dA : ℝ → SpecialOrthogonal N → S → ℝ) + (hdHm : ∀ σ, Measurable (fun U => dH 0 U σ)) + (hdAm : ∀ σ, Measurable (fun U => dA 0 U σ)) + (hHd : ∀ U t, t ∈ Set.Ioo (-1 : ℝ) 1 → ∀ σ, + HasDerivAt (fun s => H (R s * U) σ) (dH t U σ) t) + (hAd : ∀ U t, t ∈ Set.Ioo (-1 : ℝ) 1 → ∀ σ, + HasDerivAt (fun s => A (R s * U) σ) (dA t U σ) t) + (K L M : ℝ) (hK : 0 ≤ K) + (hAb : ∀ U σ, |A U σ| ≤ K) + (hdHb : ∀ U t, t ∈ Set.Ioo (-1 : ℝ) 1 → ∀ σ, |dH t U σ| ≤ L) + (hdAb : ∀ U t, t ∈ Set.Ioo (-1 : ℝ) 1 → ∀ σ, |dA t U σ| ≤ M) : + (∫ U, gibbsAverage w (H U) (dA 0 U) + + gibbsAverage w (H U) (fun σ => A U σ * dH 0 U σ) - + gibbsAverage w (H U) (A U) * gibbsAverage w (H U) (dH 0 U) ∂μ) = 0 := by + let f : SpecialOrthogonal N → ℝ := fun U => gibbsAverage w (H U) (A U) + let f' : ℝ → SpecialOrthogonal N → ℝ := fun t U => + gibbsAverage w (H (R t * U)) (dA t U) + + gibbsAverage w (H (R t * U)) (fun σ => A (R t * U) σ * dH t U σ) - + gibbsAverage w (H (R t * U)) (A (R t * U)) * + gibbsAverage w (H (R t * U)) (dH t U) + have hm : Measurable f := measurable_gibbsAverage w H A hHm hAm + have hi : Integrable f μ := (integrable_const K).mono' hm.aestronglyMeasurable + (ae_of_all μ fun U => by + simpa only [Real.norm_eq_abs] using + (abs_gibbsAverage_le hw (H U) (A U) (hAb U))) + have hm' : Measurable (f' 0) := by + simp only [f', hR, one_mul] + exact ((measurable_gibbsAverage w H (dA 0) hHm hdAm).add + (measurable_gibbsAverage w H (fun U σ => A U σ * dH 0 U σ) hHm + (fun σ => (hAm σ).mul (hdHm σ)))).sub + ((measurable_gibbsAverage w H A hHm hAm).mul + (measurable_gibbsAverage w H (dH 0) hHm hdHm)) + have hb : ∀ᵐ U ∂μ, ∀ t ∈ Set.Ioo (-1 : ℝ) 1, ‖f' t U‖ ≤ M + 2 * K * L := by + exact ae_of_all _ fun U t ht => by + simpa only [f', Real.norm_eq_abs] using + abs_gibbsVariation_le hw (H (R t * U)) (A (R t * U)) (dH t U) (dA t U) + hK (hAb _) (hdHb U t ht) (hdAb U t ht) + have hd : ∀ᵐ U ∂μ, ∀ t ∈ Set.Ioo (-1 : ℝ) 1, + HasDerivAt (fun s => f (R s * U)) (f' t U) t := + ae_of_all _ fun U t ht => hasDerivAt_gibbsAverage hw (hHd U t ht) (hAd U t ht) + have he := integral_special_rotation_derivative_eq_zero μ R hR f hm hi f' + hm'.aestronglyMeasurable (fun _ => M + 2 * K * L) (integrable_const _) hb hd + simpa only [f', hR, one_mul] using he + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Haar/SpecialSkewRotation.lean b/lean/OAI/Probability/InvariantIsing/Haar/SpecialSkewRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..59988dad7db550ad9b980a429405c615598acdc1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Haar/SpecialSkewRotation.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Haar.HaarPolynomialRotation + +namespace OAI + +/-! Exponentiating an arbitrary real skew matrix in the physical group. -/ +noncomputable section +open Matrix +open scoped Matrix Matrix.Norms.Frobenius +namespace InvariantIsing + +def skewRotation {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) (t : ℝ) : Orthogonal N := + ⟨NormedSpace.exp (t • A), NormedSpace.exp_mem_unitary_of_mem_skewAdjoint (by + rw [skewAdjoint.mem_iff] + simpa only [Matrix.star_eq_conjTranspose,Matrix.conjTranspose_eq_transpose_of_trivial, + star_smul,star_trivial,smul_neg] using congrArg (fun M => t • M) hA)⟩ + +lemma skewRotation_det {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) (t : ℝ) : + (skewRotation A hA t : Matrix (Fin N) (Fin N) ℝ).det = 1 := by + let f : ℝ → ℝ := fun s => (skewRotation A hA s : Matrix (Fin N) (Fin N) ℝ).det + have hc : Continuous f := by + apply Continuous.matrix_det + exact continuous_iff_continuousAt.mpr fun s => + (hasDerivAt_exp_smul_const' A s).continuousAt + have hm : Set.MapsTo f Set.univ ({1,-1} : Set ℝ) := by + intro s _ + simpa only [Set.mem_insert_iff,Set.mem_singleton_iff,f] using + orthogonal_det_eq_one_or_neg_one (skewRotation A hA s) + have he := isPreconnected_univ.constant_of_mapsTo + (Set.toFinite ({1,-1} : Set ℝ)).isDiscrete hc.continuousOn hm (Set.mem_univ t) + (Set.mem_univ (0:ℝ)) + simpa only [f,skewRotation,zero_smul,NormedSpace.exp_zero,Matrix.det_one] using he + +def specialSkewRotation {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) (t : ℝ) : SpecialOrthogonal N := + ⟨(skewRotation A hA t).val,Matrix.mem_specialOrthogonalGroup_iff.mpr + ⟨(skewRotation A hA t).property,skewRotation_det A hA t⟩⟩ + +@[simp] lemma specialSkewRotation_zero {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) : specialSkewRotation A hA 0 = 1 := by + apply Subtype.ext + simp [specialSkewRotation,skewRotation] + +lemma hasDerivAt_specialSkewRotation {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.transpose = -A) (U : SpecialOrthogonal N) : + HasDerivAt (fun t => ((specialSkewRotation A hA t*U : SpecialOrthogonal N) : + Matrix (Fin N) (Fin N) ℝ)) (A*(U : Matrix (Fin N) (Fin N) ℝ)) 0 := by + convert (hasDerivAt_exp_smul_const' A (0:ℝ)).mul_const + (U : Matrix (Fin N) (Fin N) ℝ) using 1 + all_goals first | rfl | simp only [zero_smul,NormedSpace.exp_zero,mul_one] + +lemma hasDerivAt_specialSkewRotation_polynomial {N : ℕ} (p : MatrixPolynomial N) + (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.transpose = -A) (U : SpecialOrthogonal N) : + HasDerivAt (fun t => matrixPolynomialEval + ((specialSkewRotation A hA t*U : SpecialOrthogonal N) : Matrix (Fin N) (Fin N) ℝ) p) + (matrixPolynomialEval (U : Matrix (Fin N) (Fin N) ℝ) + (matrixPolynomialDerivation A p)) 0 := by + have hd := hasDerivAt_specialSkewRotation A hA U + have hh := hasDerivAt_matrixPolynomialEval p + (fun t => ((specialSkewRotation A hA t*U : SpecialOrthogonal N) : Matrix (Fin N) (Fin N) ℝ)) + A 0 (fun i j => by + rw [specialSkewRotation_zero,one_mul] + convert (haarMatrixCoordinate i j).hasFDerivAt.comp_hasDerivAt 0 hd using 1 <;> rfl) + simpa only [specialSkewRotation_zero,one_mul] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/ConstrainedBlockBias.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/ConstrainedBlockBias.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7d9711b2bcf955ee7d2a94013aaf74325e2d592 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/ConstrainedBlockBias.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldRootLoss +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockTerminalLoss + +namespace OAI + +/-! Exact bias cancellation on a constrained block and identification of +the unrestricted block with the average scalar field functional. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +def biasedConstrainedBlockValue {N : ℕ} (S : Finset (Spin N)) (h : FieldStep) + (b : Fin N → ℝ) : ℝ := + (N : ℝ)⁻¹ * (∫ z, restrictedFieldRecursion S h.depth (chainExponent h.cut) + (fieldStepVariance h) z + ∂Measure.pi (fun i => gaussianReal (b i) (NNReal.mk (h.height 0) (h.nonneg 0)))) - + h.height (Fin.last h.depth) / 2 + +lemma fieldValue_gaussian_integral (h : FieldStep) (b : ℝ) : + (∫ z, fieldScalarValue (scalarFieldIncrements h) (fun y => Real.log (Real.cosh y)) z + ∂gaussianReal b (NNReal.mk (h.height 0) (h.nonneg 0))) = + fieldValue h b + h.height (Fin.last h.depth) / 2 := by + have he := gaussianOperator_eq_gaussian_integral (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue_regular _ (scalarFieldIncrements_positive h) + measurable_logCosh logCosh_linearGrowth).1 b + change gaussianOperator 0 (h.height 0) + (fieldScalarValue (scalarFieldIncrements h) (fun y => Real.log (Real.cosh y))) b = _ at he + rw [fieldValue_root] + linarith [he] + +theorem biasedConstrainedBlockValue_univ {N : ℕ} (hN : 0 < N) (h : FieldStep) (b : Fin N → ℝ) : + biasedConstrainedBlockValue Finset.univ h b = (N : ℝ)⁻¹ * ∑ i, fieldValue h (b i) := by + have hb := chainExponent_admissible h.ordered_cut h.first h.last + have hrec : restrictedFieldRecursion (Finset.univ : Finset (Spin N)) h.depth + (chainExponent h.cut) (fieldStepVariance h) = fun z => ∑ i, + fieldScalarValue (scalarFieldIncrements h) (fun y => Real.log (Real.cosh y)) (z i) := by + funext z + simpa only [fieldStepIncrements] using restrictedFieldRecursion_univ h.depth + (chainExponent h.cut) (fieldStepVariance h) (fun i hi => (hb.1 i hi).1) z + have hreg := fieldScalarValue_regular _ (scalarFieldIncrements_positive h) + measurable_logCosh logCosh_linearGrowth + have hi (i : Fin N) : Integrable (fun z : Fin N → ℝ => + fieldScalarValue (scalarFieldIncrements h) (fun y => Real.log (Real.cosh y)) (z i)) + (Measure.pi (fun j => gaussianReal (b j) (NNReal.mk (h.height 0) (h.nonneg 0)))) := + (measurePreserving_eval _ i).integrable_comp_of_integrable + (field_gaussian_linear_integrable _ (b i) hreg.1 hreg.2) + rw [biasedConstrainedBlockValue, hrec, integral_finsetSum _ (fun i _ => hi i)] + have he (i : Fin N) : (∫ z : Fin N → ℝ, + fieldScalarValue (scalarFieldIncrements h) (fun y => Real.log (Real.cosh y)) (z i) + ∂Measure.pi (fun j => gaussianReal (b j) (NNReal.mk (h.height 0) (h.nonneg 0)))) = + fieldValue h (b i) + h.height (Fin.last h.depth) / 2 := by + rw [integral_comp_eval (μ := fun j : Fin N => + gaussianReal (b j) (NNReal.mk (h.height 0) (h.nonneg 0))) (i := i) hreg.1.aestronglyMeasurable] + exact fieldValue_gaussian_integral h (b i) + simp_rw [he] + rw [Finset.sum_add_distrib] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + have hNr : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + field_simp + ring + +theorem biasedConstrainedBlockValue_group {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (bias : A → ℝ) (h : FieldStep) : + biasedConstrainedBlockValue (spinGroupSlice group k) h (fun i => bias (group i)) = + constrainedBlockValue (spinGroupSlice group k) h + + (N : ℝ)⁻¹ * spinGroupFieldConstant group k bias := by + let S := spinGroupSlice group k + let F := restrictedFieldRecursion S h.depth (chainExponent h.cut) (fieldStepVariance h) + have hb := chainExponent_admissible h.ordered_cut h.first h.last + have hreg := restrictedFieldRecursion_regular hN S (spinGroupSlice_nonempty group k hk) + h.depth (chainExponent h.cut) (fieldStepVariance h) (fun i hi => (hb.1 i hi).1) + have he : (∫ z, F z ∂Measure.pi (fun i => gaussianReal (bias (group i)) + (NNReal.mk (h.height 0) (h.nonneg 0)))) = + ∫ z, F z + spinGroupFieldConstant group k bias + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ)) := by + rw [← (vectorGaussian_shift _ (fun i => bias (group i))).map_eq, + integral_map (show AEMeasurable (fun z : Fin N → ℝ => (fun i => bias (group i)) + z) + (vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ)) from + (measurable_const.add measurable_id).aemeasurable) hreg.1.aestronglyMeasurable] + apply integral_congr_ae + apply ae_of_all + intro z + change F ((fun i => bias (group i)) + z) = _ + rw [add_comm] + exact restrictedFieldRecursion_group_bias hN group k hk bias _ _ _ + (fun i hi => (hb.1 i hi).1) z + change (N : ℝ)⁻¹ * (∫ z, F z ∂_) - _ = (N : ℝ)⁻¹ * (∫ z, F z ∂_) - _ + _ + rw [he, integral_add (constrainedBlockValue_root_integrable hN S + (spinGroupSlice_nonempty group k hk) h) (integrable_const _)] + simp only [integral_const, measureReal_def, measure_univ, ENNReal.toReal_one, one_smul] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/ConstrainedBlockMagneticEstimate.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/ConstrainedBlockMagneticEstimate.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa51275b1d9041612c7fb22d2b2e09d8d6e20610 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/ConstrainedBlockMagneticEstimate.lean @@ -0,0 +1,104 @@ +import OAI.Probability.InvariantIsing.Magnetic.ConstrainedBlockBias + +namespace OAI + +/-! Finite constrained-block comparison with the actual scalar magnetic +functional. Every error term is independent of the cascade depth. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma sum_sites_group {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (f : A → ℝ) : + (∑ i, f (group i)) = ∑ a, spinGroupSize group a * f a := by + rw [← Finset.sum_fiberwise Finset.univ group] + apply Finset.sum_congr rfl + intro a _ + calc + _ = ∑ _i ∈ Finset.univ.filter (fun i => group i = a), f a := by + apply Finset.sum_congr rfl + intro i hi + rw [(Finset.mem_filter.mp hi).2] + _ = _ := by simp [spinGroupSize] + +lemma spinGroupFieldConstant_of_means {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (m bias : A → ℝ) + (hc : ∀ a, (k a : ℝ) = spinGroupSize group a * ((1 + m a) / 2)) : + spinGroupFieldConstant group k bias = ∑ i, bias (group i) * m (group i) := by + rw [sum_sites_group group (fun a => bias a * m a)] + unfold spinGroupFieldConstant + apply Finset.sum_congr rfl + intro a _ + rw [hc a] + ring + +theorem biasedConstrainedBlockValue_gap {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) : + 0 ≤ biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b ∧ + biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b ≤ + (N : ℝ)⁻¹ * (∫ y, restrictedFieldTerminal Finset.univ y - restrictedFieldTerminal S y + ∂fieldCanonicalVectorLaw N h b) := by + have hF := restrictedFieldRecursion_biased_root_integrable hN Finset.univ Finset.univ_nonempty h b + have hS' := restrictedFieldRecursion_biased_root_integrable hN S hS h b + have he : biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b = + (N : ℝ)⁻¹ * (∫ z, restrictedFieldRecursion Finset.univ h.depth (chainExponent h.cut) + (fieldStepVariance h) z - restrictedFieldRecursion S h.depth (chainExponent h.cut) + (fieldStepVariance h) z + ∂Measure.pi (fun i => gaussianReal (b i) (NNReal.mk (h.height 0) (h.nonneg 0)))) := by + rw [integral_sub hF hS'] + unfold biasedConstrainedBlockValue + ring + rw [he] + constructor + · apply mul_nonneg (by positivity) + apply integral_nonneg + intro z + apply sub_nonneg.mpr + exact restrictedFieldRecursion_mono hN S Finset.univ hS Finset.univ_nonempty + (Finset.subset_univ _) _ _ _ + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) z + · exact mul_le_mul_of_nonneg_left (restrictedFieldRecursion_root_loss hN S hS h b) (by positivity) + +lemma magneticBlockGap_eq_biasedGap {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hc : ∀ a, (k a : ℝ) = spinGroupSize group a * ((1 + m a) / 2)) (h : FieldStep) : + (N : ℝ)⁻¹ * (∑ i, constrainedFieldValue h (m (group i))) - + constrainedBlockValue (spinGroupSlice group k) h = + biasedConstrainedBlockValue Finset.univ h (fun i => magneticBias h (m (group i))) - + biasedConstrainedBlockValue (spinGroupSlice group k) h (fun i => magneticBias h (m (group i))) := by + rw [biasedConstrainedBlockValue_univ hN, + biasedConstrainedBlockValue_group hN group k hk (fun a => magneticBias h (m a)), + spinGroupFieldConstant_of_means group k m (fun a => magneticBias h (m a)) hc] + simp_rw [constrainedFieldValue_magneticBias h (hm _)] + rw [Finset.sum_sub_distrib] + ring + +theorem magneticBlockGap_estimate {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hc : ∀ a, (k a : ℝ) = spinGroupSize group a * ((1 + m a) / 2)) + (h : FieldStep) {B H ε t : ℝ} (hB : ∀ i, |magneticBias h (m (group i))| ≤ B) + (hH : h.height (Fin.last h.depth) ≤ H) (hε : 0 < ε) (ht : 0 ≤ t) : + 0 ≤ (N : ℝ)⁻¹ * (∑ i, constrainedFieldValue h (m (group i))) - + constrainedBlockValue (spinGroupSlice group k) h ∧ + (N : ℝ)⁻¹ * (∑ i, constrainedFieldValue h (m (group i))) - + constrainedBlockValue (spinGroupSlice group k) h ≤ + (N : ℝ)⁻¹ * (ε * (N * (2 * Real.exp (2 * B + 4 * H))) + + (ε⁻¹ + t) * (Fintype.card A * Real.sqrt N) + N * Real.log (1 + Real.exp (-t))) := by + rw [magneticBlockGap_eq_biasedGap hN group k hk m hm hc] + have hg := biasedConstrainedBlockValue_gap hN (spinGroupSlice group k) + (spinGroupSlice_nonempty group k hk) h (fun i => magneticBias h (m (group i))) + refine ⟨hg.1, hg.2.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ (by positivity) + have he := magnetic_block_terminal_loss_size group k hk m hm hc h hB hH hε ht + simpa only [restrictedFieldTerminal_univ] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAdjacentCurvature.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAdjacentCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..f740765310138388deb50b8e251726dc536d0066 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAdjacentCurvature.lean @@ -0,0 +1,92 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticTailCongruence + +namespace OAI + +/-! Moving a nonnegative variance increment from a larger exponent to the +preceding smaller exponent decreases the actual inverse curvature. -/ + +noncomputable section +open Filter Set IsingPerceptron +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma positive_cons {a : ℝ} (ha : 0 < a) (v : ℝ≥0) + {L : List (ℝ × ℝ≥0)} (hL : ∀ av ∈ L, 0 < av.1) : + ∀ av ∈ (a, v) :: L, 0 < av.1 := by + intro av hav + rcases List.mem_cons.mp hav with rfl | hav + · exact ha + · exact hL av hav + +private lemma upper_cons {a : ℝ} (ha : a ≤ 1) (v : ℝ≥0) + {L : List (ℝ × ℝ≥0)} (hL : ∀ av ∈ L, av.1 ≤ 1) : + ∀ av ∈ (a, v) :: L, av.1 ≤ 1 := by + intro av hav + rcases List.mem_cons.mp hav with rfl | hav + · exact ha + · exact hL av hav + +theorem magneticClosedCurvature_adjacent_transfer + (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) (hb1 : b ≤ 1) + (x δ y : ℝ≥0) {η v s : ℝ} (hη : 0 ≤ η) (hη1 : η ≤ 1) + (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature ((a, x + δ) :: (b, y) :: L) + (positive_cons ha _ (positive_cons (ha.trans_le hab) _ hL)) η (v, s) ≤ + closedMagneticScalarCurvature ((a, x) :: (b, δ + y) :: L) + (positive_cons ha _ (positive_cons (ha.trans_le hab) _ hL)) η (v, s) := by + have hb : 0 < b := ha.trans_le hab + have ha1 : a ≤ 1 := hab.trans hb1 + let T := (b, y) :: L + have hT : ∀ av ∈ T, 0 < av.1 := positive_cons hb y hL + have hT1 : ∀ av ∈ T, av.1 ≤ 1 := upper_cons hb1 y hL1 + let A := (a, δ) :: T + let B := (b, δ) :: T + have hA : ∀ av ∈ A, 0 < av.1 := positive_cons ha δ hT + have hB : ∀ av ∈ B, 0 < av.1 := positive_cons hb δ hT + have hA1 : ∀ av ∈ A, av.1 ≤ 1 := upper_cons ha1 δ hT1 + have hB1 : ∀ av ∈ B, av.1 ≤ 1 := upper_cons hb1 δ hT1 + have hmid (u : ℝ) (hu : u ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature A hA a (0, u) ≤ + closedMagneticScalarCurvature B hB a (0, u) := by + rw [closedMagneticScalarCurvature_cons_initial, + closedMagneticScalarCurvature_cons_initial] + exact magneticClosedCurvature_exponent_mono T hT hT1 ha.le hab hb1 δ.property hu + have houter (u : ℝ) (hu : u ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature A hA a (x, u) ≤ + closedMagneticScalarCurvature B hB a (x, u) := + magneticClosedCurvature_compare_initial A B hA hB hA1 hB1 ha.le le_rfl ha1 + hmid x.property hu + let N := (a, x + δ) :: T + let O := (a, x) :: (b, δ + y) :: L + have hN : ∀ av ∈ N, 0 < av.1 := positive_cons ha _ hT + have hO : ∀ av ∈ O, 0 < av.1 := positive_cons ha _ (positive_cons hb _ hL) + have hN1 : ∀ av ∈ N, av.1 ≤ 1 := upper_cons ha1 _ hT1 + have hO1 : ∀ av ∈ O, av.1 ≤ 1 := upper_cons ha1 _ (upper_cons hb1 _ hL1) + have hsplit : fieldScalarValue ((a, x) :: B) (fun z => Real.log (Real.cosh z)) = + fieldScalarValue O (fun z => Real.log (Real.cosh z)) := by + change gaussianOperator a x (fieldScalarValue ((b, δ) :: (b, y) :: L) + (fun z => Real.log (Real.cosh z))) = + gaussianOperator a x (fieldScalarValue ((b, δ + y) :: L) + (fun z => Real.log (Real.cosh z))) + rw [fieldScalarValue_same_exponent L hL b δ y] + have hinit (u : ℝ) (hu : u ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature N hN η (0, u) ≤ + closedMagneticScalarCurvature O hO η (0, u) := by + have hn := closedMagneticScalarCurvature_same_exponent T hT ha x δ η (0, u) + have ho := closedMagneticScalarCurvature_eq_of_value_eq ((a, x) :: B) O + (positive_cons ha x hB) hO hsplit η (0, u) + rw [← hn, ← ho] + rw [closedMagneticScalarCurvature_cons_initial, + closedMagneticScalarCurvature_cons_initial] + exact houter u hu + exact magneticClosedCurvature_compare_initial N O hN hO hN1 hO1 hη le_rfl hη1 + hinit hv hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAdjacentSquare.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAdjacentSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf574dd405513dc79aabcdeb06a3d47eb70ece58 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAdjacentSquare.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticPrefixComparison + +namespace OAI + +/-! The conditional square means preceding a transferred variance +increment decrease at fixed total mean spin. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +theorem magneticClosedSquare_adjacent_transfer (P L : List (ℝ × ℝ≥0)) + (hP : ∀ av ∈ P, 0 < av.1) (hP1 : ∀ av ∈ P, av.1 ≤ 1) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) (hb1 : b ≤ 1) + (x δ y : ℝ≥0) + (hN : ∀ av ∈ P ++ (a, x + δ) :: (b, y) :: L, 0 < av.1) + (hO : ∀ av ∈ P ++ (a, x) :: (b, δ + y) :: L, 0 < av.1) + (i : ℕ) (hi : i ≤ P.length) {ζ v s : ℝ} + (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticContinuation (P ++ (a, x + δ) :: (b, y) :: L) + (magneticScalarSquareFourJet _ hN + ⟨i, by simp only [List.length_append, List.length_cons]; omega⟩).toMagneticContinuationJet + ζ (v, s) ≤ + closedMagneticContinuation (P ++ (a, x) :: (b, δ + y) :: L) + (magneticScalarSquareFourJet _ hO + ⟨i, by simp only [List.length_append, List.length_cons]; omega⟩).toMagneticContinuationJet + ζ (v, s) := by + let N := (a, x + δ) :: (b, y) :: L + let O := (a, x) :: (b, δ + y) :: L + have hNT : ∀ av ∈ N, 0 < av.1 := fun av hav => hN av (List.mem_append_right P hav) + have hOT : ∀ av ∈ O, 0 < av.1 := fun av hav => hO av (List.mem_append_right P hav) + have hNT1 : ∀ av ∈ N, av.1 ≤ 1 := by + intro av hav + rcases List.mem_cons.mp hav with rfl | hav + · exact hab.trans hb1 + · rcases List.mem_cons.mp hav with rfl | hav + · exact hb1 + · exact hL1 av hav + have hOT1 : ∀ av ∈ O, av.1 ≤ 1 := by + intro av hav + rcases List.mem_cons.mp hav with rfl | hav + · exact hab.trans hb1 + · rcases List.mem_cons.mp hav with rfl | hav + · exact hb1 + · exact hL1 av hav + have hinit (u : ℝ) (hu : u ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature N hNT 0 (0, u) ≤ + closedMagneticScalarCurvature O hOT 0 (0, u) := + magneticClosedCurvature_adjacent_transfer L hL hL1 ha hab hb1 x δ y + (le_refl 0) (by norm_num) (le_refl 0) hu + exact magneticClosedSquare_append_mono P N O hP hP1 hNT hNT1 hOT hOT1 hinit i hi + hζ hζ1 hv hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineFieldLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineFieldLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ab6fb37979b15cd73fb801cdafebadc7c67e603 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineFieldLower.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAffinePressureLower +import OAI.Probability.InvariantIsing.Cavity.OffsetFieldPressure + +namespace OAI + +/-! The magnetic variational lower bound contributes to the full physical +pressure along a sequence of repeated finite field blocks. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_affine_field_subsequence_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + (c : ℕ → Fin m → ℕ) + (R : (r : ℕ) → Finset (Spin (∑ a, c r a))) (hR : ∀ r, (R r).Nonempty) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (b : A → ℝ) (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ ε > 0, ∀ᶠ j in atTop, + let q := m*N r-N r+N r+3 + let M := (∑ a, c r a)+(q+j)*N r + let g := cavityAffineLabel (by omega : 0 < m) (spec r) (c r) (hspec r) M + L+(∑ a, γ a*b a*mag a)-ε ≤ ∫ V, rotatedPressure + (fun i => lam (g i)) (matrixRotation V⁻¹) + (offsetBlockField (∑ a, c r a) (q+j) (fun i => b (group r i))) ∂μ M := by + obtain ⟨r,hr⟩ := magnetic_affine_constrained_pressure_lower hhaar hgauss hpub hm + ρ lam hρ hsum hK hlam amax hmax μ N hN hNlim spec hsp hspec hρspec c R hR + group k hk γ mag hγ hγsum hcount hs hmag hc L hL + refine ⟨r,?_⟩ + intro ε hε + let q := m*N r-N r+N r+3 + let F := ∑ a, γ a*b a*mag a + have hq0 : 0 b (group r i)) σ=(N r : ℝ)*F := by + intro σ hσ + rw [fieldEnergy_on_group_slice (group r) (k r) b hσ, + spinGroupFieldConstant_magnetization (group r) (k r) b γ mag (hcount r) (hc r)] + have hdim : 0<(∑ a, c r a)+(q+j)*N r := + Nat.add_pos_right _ (Nat.mul_pos hq (hN r)) + have hh := mean_offset_field_pressure_lower hdim (μ ((∑ a, c r a)+(q+j)*N r)) + (R r) (hR r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (fun i => b (group r i)) ((N r : ℝ)*F) hM + (fun i => lam (cavityAffineLabel (by omega : 0 < m) (spec r) (c r) (hspec r) + ((∑ a, c r a)+(q+j)*N r) i)) + change L-ε/2 ≤ _ at hj + rw [Real.dist_eq] at hfj + have hfj' := (abs_lt.mp hfj).1 + change L+F-ε ≤ _ + simp only [Nat.cast_add, mul_assoc] at hh hfj' + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineIncrementLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineIncrementLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2e3818305c9830b88c46f685abb5290fff5f3b6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineIncrementLower.lean @@ -0,0 +1,116 @@ +import OAI.Probability.InvariantIsing.Cavity.OffsetAffineSubsequenceTrial +import OAI.Probability.InvariantIsing.Magnetic.MagneticTrialBarrier + +namespace OAI + +/-! A physical constrained block has eventually large cavity increments whenever +the proposed pressure level is below the magnetic variational value. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +def affineConstrainedObjective {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (spec c : Fin m → ℕ) (hspec : ∑ a, spec a=n) + (R : Finset (Spin (∑ a, c a))) (hR : R.Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (μ : (M : ℕ) → Measure (Orthogonal M)) (lam : Fin m → ℝ) (j : ℕ) + (u : Fin (cavityPrefixAffineSize n (m*n-n+n+3) c j) → ℝ) (v : Fin m → ℝ) : ℝ := + let M := cavityPrefixAffineSize n (m*n-n+n+3) c j + let g := cavityAffineLabel (by omega : 0 < m) spec c hspec M + priorPerturbationObjective (cavityOrientedBaseLaw (by + have hh := cavityRationalSize_ge_three n (m*n-n) j hn; + exact lt_of_lt_of_le (by norm_num : 0<3) + (hh.trans (Nat.le_add_left _ (∑ a, c a)))) (μ M)) + (restrictedZeroTreePrior (offsetBlockConstraint (j+(m*n-n+n+3)) R Cset) + (offsetBlockConstraint_nonempty R hR Cset hCset)) + (fun i => lam (g i)) (fun _ => 0) (cavitySpectralGroup g) 1 (fun _ => 0) u v + +theorem magnetic_affine_increment_eventually_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + (c : ℕ → Fin m → ℕ) + (R : (r : ℕ) → Finset (Spin (∑ a, c r a))) (hR : ∀ r, (R r).Nonempty) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (u : (r j : ℕ) → Fin (cavityPrefixAffineSize (N r) (m*N r-N r+N r+3) (c r) j) → ℝ) + (v : ℕ → ℕ → Fin m → ℝ) + (hu : ∀ r j i, u r j i ∈ Set.Icc (1 : ℝ) 2) + (hv : ∀ r j a, v r j a ∈ Set.Icc (1 : ℝ) 2) + (hmin : ∀ r j u' v', (∀ i, u' i ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + affineConstrainedObjective hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam j (u r j) (v r j) ≤ + affineConstrainedObjective hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) μ lam j u' v') + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ᶠ j in atTop, L < (N r : ℝ)⁻¹* + (affineRestrictedIncrement hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam (u r) (v r) j + + (Real.log (spinGroupSlice (group r) (k r)).card-N r*Real.log 2)) := by + let Δ := fun r j => (N r : ℝ)⁻¹* + (affineRestrictedIncrement hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam (u r) (v r) j + (Real.log (spinGroupSlice (group r) (k r)).card-N r*Real.log 2)) + change ∃ r, ∀ᶠ j in atTop, L < Δ r j + by_contra hnone + have hbad r : ∃ ι : ℕ → ℕ, StrictMono ι ∧ ∀ j, Δ r (ι j) ≤ L := by + have hn : ¬∀ᶠ j in atTop, L < Δ r j := fun h => hnone ⟨r,h⟩ + have hf : ∃ᶠ j in atTop, ¬L < Δ r j := by + simpa only [Filter.Frequently, not_not] using hn + obtain ⟨ι,hι,hb⟩ := extraction_of_frequently_atTop hf + exact ⟨ι,hι,fun j => not_lt.mp (hb j)⟩ + choose ι hι hbad using hbad + have hpaths r : ∃ p : OverlapPath, + (∀ Φ : ℝ →ᵇ ℝ, Tendsto (fun j => ∫ t, Φ (cavityStrictUniformPath p j t)* + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField ρ lam hρ hsum p j) t-cavityStrictUniformPath p j t) + ∂pathMeasure) atTop (𝓝 0)) ∧ + ∀ ε > 0, ∀ᶠ j in atTop, + constrainedBlockValue (spinGroupSlice (group r) (k r)) (cavityStrictUniformField ρ lam hρ hsum p j)+ + fieldPairing (cavityStrictUniformPath p j) (cavityStrictUniformField ρ lam hρ hsum p j)/2+ + spectralFunctional (finiteR ρ lam hρ hsum) (cavityStrictUniformPath p j) ≤ L+ε := by + have he : (fun a => (spec r a : ℝ)/(N r : ℝ))=ρ := by + funext a + rw [hρspec r a, mul_div_cancel_left₀ _ (Nat.cast_ne_zero.mpr (hN r).ne')] + have hReq : finiteR (fun a => (spec r a : ℝ)/(N r : ℝ)) lam + (cavityRationalMass_positive (spec r) (hsp r) (hN r)) + (cavityRationalMass_sum (spec r) (hspec r) (hN r)) = finiteR ρ lam hρ hsum := by + subst ρ + rfl + obtain ⟨p,φ,hφ,hself,htrial⟩ := offset_affine_subsequence_trial_witness + hhaar hgauss hpub hm (hN r) (spec r) (c r) (hsp r) (hspec r) (R r) (hR r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam amax hmax (ι r) (hι r) (u r) (v r) (hu r) (hv r) (hmin r) + simp only [hReq, he] at hself htrial + refine ⟨p,hself,?_⟩ + intro ε hε + filter_upwards [htrial ε hε] with j hj + have hb := hbad r (φ j) + dsimp only [Δ] at hb + linarith + choose base htest hupper using hpaths + exact (not_le_of_gt hL) (magnetic_trial_barrier ρ lam hρ hsum hK hlam N hN hNlim + group k hk γ mag hγ hγsum hcount hs hmag hc base htest L hupper) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffinePressureLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffinePressureLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7656f9ccf38dc24cb86057422281b0a21a02c13 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffinePressureLower.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAffineIncrementLower +import OAI.Probability.InvariantIsing.Cavity.OffsetPhysicalIncrement + +namespace OAI + +/-! Physical constrained pressures inherit the magnetic variational lower +bound from the proved block increment, with actual minimizing perturbations. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_affine_constrained_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + (c : ℕ → Fin m → ℕ) + (R : (r : ℕ) → Finset (Spin (∑ a, c r a))) (hR : ∀ r, (R r).Nonempty) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ ε > 0, ∀ᶠ j in atTop, + let q := m*N r-N r+N r+3 + let M := (∑ a, c r a)+(q+j)*N r + let g := cavityAffineLabel (by omega : 0 < m) (spec r) (c r) (hspec r) M + L-ε ≤ ∫ V, restrictedRotatedPressure + (offsetBlockConstraint (q+j) (R r) (spinGroupSlice (group r) (k r))) + (fun i => lam (g i)) (matrixRotation V⁻¹) (fun _ => 0) ∂μ M := by + let ν := cavityOrientedFamily μ + have hν M : (ν M).IsMulLeftInvariant := cavityOrientedFamily_leftInvariant μ M + let g := fun r M => cavityAffineLabel (by omega : 0 < m) (spec r) (c r) (hspec r) M + let eig := fun r M i => lam (g r M i) + let I := fun r M => cavitySpectralGroup (g r M) + let C := fun r => spinGroupSlice (group r) (k r) + have hC r : (C r).Nonempty := spinGroupSlice_nonempty (group r) (k r) (hk r) + let q := fun r => m*N r-N r+N r+3 + choose U V hU hV hmin using fun r => offset_prior_minimizing_sequence hhaar hgauss + ν hν (eig r) (fun _ _ => 0) (I r) (R r) (hR r) (C r) (hC r) + let u : (r j : ℕ) → Fin (cavityPrefixAffineSize (N r) (m*N r-N r+N r+3) (c r) j) → ℝ := + fun r j => U r (j+q r) + let v := fun r j => V r (j+q r) + have hum r j i : u r j i ∈ Set.Icc (1 : ℝ) 2 := hU r (j+q r) i + have hvm r j a : v r j a ∈ Set.Icc (1 : ℝ) 2 := hV r (j+q r) a + have hmm r j (u' : Fin (cavityPrefixAffineSize (N r) (m*N r-N r+N r+3) (c r) j) → ℝ) (v' : Fin m → ℝ) + (hu' : ∀ i, u' i ∈ Set.Icc (1 : ℝ) 2) (hv' : ∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) : + affineConstrainedObjective hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) (C r) (hC r) μ lam j (u r j) (v r j) ≤ + affineConstrainedObjective hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) (C r) (hC r) μ lam j u' v' := by + have hdim : 3 ≤ (∑ a, c r a)+(j+q r)*N r := + (cavityRationalSize_ge_three (N r) (m*N r-N r) j (hN r)).trans (Nat.le_add_left _ _) + have hh := hmin r (j+q r) hdim u' v' hu' hv' + have hp : 0 < (∑ a, c r a)+(j+q r)*N r := by omega + simpa only [offsetRepeatedPriorObjective, affineConstrainedObjective, ν, + cavityOrientedFamily_pos μ hp, eig, I, g, u, v, q, cavityPrefixAffineSize] using hh + obtain ⟨r,hr⟩ := magnetic_affine_increment_eventually_lower hhaar hgauss hpub hm + ρ lam hρ hsum hK hlam amax hmax μ N hN hNlim spec hsp hspec hρspec c R hR + group k hk γ mag hγ hγsum hcount hs hmag hc u v hum hvm hmm L hL + have hdim j : 3 ≤ (∑ a, c r a)+(q r+j)*N r := by + have hh := (cavityRationalSize_ge_three (N r) (m*N r-N r) j (hN r)).trans + (Nat.le_add_left _ (∑ a, c r a)) + simpa only [q, cavityRationalSize, Nat.add_comm] using hh + have hh := offset_envelope_pressure_lower hhaar hgauss (hN r) (by simpa using hdim 0) + ν (fun M _ => hν M) (eig r) (fun _ _ => 0) (I r) (R r) (hR r) (C r) (hC r) + (fun j => U r (q r+j)) (fun j => V r (q r+j)) + (fun j => hU r (q r+j)) (fun j => hV r (q r+j)) + (fun j => hmin r (q r+j) (hdim j)) L (by + intro ε hε + filter_upwards [hr] with j hj + have he := offset_prior_increment_physical hhaar hgauss μ (eig r) (I r) (R r) (hR r) (C r) (hC r) + (fun j => U r (q r+j)) (fun j => V r (q r+j)) (fun j => hU r (q r+j)) j (hdim j) + rw [he] + have hi : affineRestrictedIncrement hm (hN r) (spec r) (c r) (hspec r) (R r) (hR r) (C r) (hC r) μ lam (u r) (v r) j = + offsetRotationIncrement μ (eig r) (I r) (R r) (hR r) (C r) (hC r) (q r+j) (U r (q r+j)) (V r (q r+j)) := by + change offsetRotationIncrement μ (eig r) (I r) (R r) (hR r) (C r) (hC r) (j+q r) + (U r (j+q r)) (V r (j+q r)) = _ + rw [Nat.add_comm j (q r)] + rw [hi] at hj + have hj' := (sub_le_self L hε.le).trans hj.le + simpa only [div_eq_mul_inv, mul_comm] using hj') + refine ⟨r,?_⟩ + intro ε hε + filter_upwards [hh ε hε] with j hj + dsimp only [ν] at hj + rw [cavityOrientedFamily_pos μ (by have := hdim j; omega), cavity_oriented_restricted_pressure] at hj + exact hj + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineTemplateLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineTemplateLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2b0f9fd1d45c9a4f29451af4ce3d536086e45c3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticAffineTemplateLower.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAffineFieldLower +import OAI.Probability.InvariantIsing.Cavity.ConsecutiveGroupProfile + +namespace OAI + +/-! A single rational spectral/field template supplies the growing +attainable blocks in the physical magnetic pressure lower bound. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_affine_template_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (c : ℕ → Fin m → ℕ) + (R : (r : ℕ) → Finset (Spin (∑ a, c r a))) (hR : ∀ r, (R r).Nonempty) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin n → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=n*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ a, (k a : ℝ)=spinGroupSize group a*((1+mag a)/2)) + (b : A → ℝ) (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ ε > 0, ∀ᶠ j in atTop, + let B := (r+1)*n + let q := m*B-B+B+3 + let M := (∑ a, c r a)+(q+j)*B + let g := cavityAffineLabel (by omega : 0 < m) (fun a => (r+1)*spec a) (c r) + (by rw [← Finset.mul_sum, hspec]) M + L+(∑ a, γ a*b a*mag a)-ε ≤ ∫ V, rotatedPressure (fun i => lam (g i)) (matrixRotation V⁻¹) + (offsetBlockField (∑ a, c r a) (q+j) (fun i => b (consecutiveSiteGroup (r+1) group i))) ∂μ M := by + let N := fun r => (r+1)*n + have hN r : 0 < N r := Nat.mul_pos (Nat.succ_pos r) hn + have hNlim : Tendsto N atTop atTop := by + apply tendsto_atTop_mono (fun r => ?_) tendsto_id + exact (Nat.le_succ r).trans (Nat.le_mul_of_pos_right (r+1) hn) + let sp := fun r a => (r+1)*spec a + have hsp' r a : 0 < sp r a := Nat.mul_pos (Nat.succ_pos r) (hsp a) + have hspec' r : ∑ a, sp r a=N r := by + dsimp only [sp, N] + rw [← Finset.mul_sum, hspec] + have hρsp r a : (sp r a : ℝ)=(N r : ℝ)*ρ a := by + dsimp only [sp, N] + rw [Nat.cast_mul, hρspec, Nat.cast_mul] + ring + have hh := magnetic_affine_field_subsequence_lower hhaar hgauss hpub hm ρ lam hρ hsum hK hlam + amax hmax μ N hN hNlim sp hsp' hspec' hρsp c R hR + (fun r => consecutiveSiteGroup (r+1) group) (fun r a => (r+1)*k a) + (fun _ => consecutiveSiteGroup_attainable group k hk) γ mag hγ hγsum + (fun _ => consecutiveSiteGroup_proportion group γ hcount) hs hmag + (fun _ => consecutiveSiteGroup_magnetization group k mag hc) b L hL + exact hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBiasEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBiasEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..472d72fea85e974c411e2f8503fcab18e822eb79 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBiasEndpoint.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticDerivativeLimit +import OAI.Probability.InvariantIsing.Magnetic.MagneticRelativeThird + +namespace OAI + +/-! Endpoint behavior of the actual inverse bias and the weighted +continuation curvature. No asymptotic expansion of the field is used. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma fieldBiasMean_strict_bounds (h : FieldStep) (b : ℝ) : + -1 < fieldBiasMean h b ∧ fieldBiasMean h b < 1 := by + have hp := strictMono_fieldBiasMean h (show b < b + 1 by linarith) + have hm := strictMono_fieldBiasMean h (show b - 1 < b by linarith) + have hbp := (abs_le.mp ((fieldBiasMean_regular h).2 (b + 1))).2 + have hbm := (abs_le.mp ((fieldBiasMean_regular h).2 (b - 1))).1 + exact ⟨by linarith, by linarith⟩ + +lemma magneticBias_tendsto_one (h : FieldStep) : + Tendsto (magneticBias h) (𝓝[<] (1 : ℝ)) atTop := by + apply tendsto_atTop.2 + intro b + have hN : ∀ᶠ s : ℝ in 𝓝[<] (1 : ℝ), -1 < s ∧ fieldBiasMean h b < s := by + have h1 : ∀ᶠ s : ℝ in 𝓝 (1 : ℝ), -1 < s := + Ioi_mem_nhds (by norm_num : (-1 : ℝ) < 1) + have h2 : ∀ᶠ s : ℝ in 𝓝 (1 : ℝ), fieldBiasMean h b < s := + Ioi_mem_nhds (fieldBiasMean_strict_bounds h b).2 + exact (h1.and h2).filter_mono nhdsWithin_le_nhds + filter_upwards [hN, self_mem_nhdsWithin] with s hs hs1 + apply le_of_lt + apply (strictMono_fieldBiasMean h).lt_iff_lt.mp + rw [fieldBiasMean_magneticBias h (abs_lt.mpr ⟨hs.1, hs1⟩)] + exact hs.2 + +lemma magneticBias_tendsto_neg_one (h : FieldStep) : + Tendsto (magneticBias h) (𝓝[>] (-1 : ℝ)) atBot := by + apply tendsto_atBot.2 + intro b + have hN : ∀ᶠ s : ℝ in 𝓝[>] (-1 : ℝ), s < 1 ∧ s < fieldBiasMean h b := by + have h1 : ∀ᶠ s : ℝ in 𝓝 (-1 : ℝ), s < 1 := + Iio_mem_nhds (by norm_num : (-1 : ℝ) < 1) + have h2 : ∀ᶠ s : ℝ in 𝓝 (-1 : ℝ), s < fieldBiasMean h b := + Iio_mem_nhds (fieldBiasMean_strict_bounds h b).1 + exact (h1.and h2).filter_mono nhdsWithin_le_nhds + filter_upwards [hN, self_mem_nhdsWithin] with s hs hs1 + apply le_of_lt + apply (strictMono_fieldBiasMean h).lt_iff_lt.mp + rw [fieldBiasMean_magneticBias h (abs_lt.mpr ⟨hs1, hs.1⟩)] + exact hs.2 + +lemma fieldBiasThird_quotient_bound (h : FieldStep) (b : ℝ) : + |fieldBiasThird h b / fieldBiasCurvature h b| ≤ + magneticThirdRatioCap (scalarFieldIncrements h) := by + rw [abs_div, abs_of_pos (fieldBiasCurvature_pos h b)] + exact (div_le_iff₀ (fieldBiasCurvature_pos h b)).mpr (fieldBiasThird_relative h b) + +lemma magnetic_weighted_continuation_limit (h : FieldStep) + {F G D E : ℝ → ℝ} {c L K : ℝ} (hL : 0 ≤ L) (hK : 0 ≤ K) + (hF : ∀ x, HasDerivAt F (G x) x) (hG : ∀ x, HasDerivAt G (D x) x) + (hD : ∀ x, HasDerivAt D (E x) x) (bD : ∀ x, |D x| ≤ L) + (bE : ∀ x, |E x| ≤ K) (hlim : Tendsto F atTop (𝓝 c)) : + Tendsto (fun x => D x - G x * (fieldBiasThird h x / fieldBiasCurvature h x)) + atTop (𝓝 0) := by + have hg := magnetic_derivative_tendsto_zero hL hF hG bD hlim + have hd := magnetic_derivative_tendsto_zero hK hG hD bE hg + have hp : Tendsto (fun x => G x * (fieldBiasThird h x / fieldBiasCurvature h x)) + atTop (𝓝 0) := by + apply squeeze_zero_norm (fun x => ?_) + (show Tendsto (fun x => |G x| * magneticThirdRatioCap (scalarFieldIncrements h)) atTop (𝓝 0) by + simpa only [Real.norm_eq_abs, abs_zero, zero_mul] using + hg.norm.mul_const (magneticThirdRatioCap (scalarFieldIncrements h))) + rw [Real.norm_eq_abs, abs_mul] + exact mul_le_mul_of_nonneg_left (fieldBiasThird_quotient_bound h x) (abs_nonneg _) + simpa only [sub_zero] using hd.sub hp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockConvergence.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..807b4d3fa508d15058e0e0b8b3b2d35f6d9e25af --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockConvergence.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockError + +namespace OAI + +/-! Actual equivalence of constrained and canonical block values along +arbitrarily deep field partitions in a fixed bounded-height region. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators NNReal Topology + +namespace InvariantIsing + +theorem magneticBlockGap_tendsto {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ n, 0 < N n) (hNlim : Tendsto N atTop atTop) + (group : ∀ n, Fin (N n) → A) (k : ℕ → A → ℕ) + (hk : ∀ n a, k n a ≤ spinGroupSize (group n) a) (m : ℕ → A → ℝ) + {r H : ℝ} (hr : r < 1) (hm : ∀ n a, |m n a| ≤ r) + (hc : ∀ n a, (k n a : ℝ) = spinGroupSize (group n) a * ((1 + m n a) / 2)) + (h : ℕ → FieldStep) (hH : ∀ n, (h n).height (Fin.last (h n).depth) ≤ H) : + Tendsto (fun n => (N n : ℝ)⁻¹ * (∑ i, constrainedFieldValue (h n) (m n (group n i))) - + constrainedBlockValue (spinGroupSlice (group n) (k n)) (h n)) atTop (𝓝 0) := by + let B := magneticUniformBiasBound H r + let C := 2 * Real.exp (2 * B + 4 * H) + have hC : 0 < C := mul_pos (by norm_num) (Real.exp_pos _) + have hB (n : ℕ) (i : Fin (N n)) : |magneticBias (h n) (m n (group n i))| ≤ B := + magneticBias_uniform_bound (h n) hr (hm n _) (hH n) + have hmi (n : ℕ) (a : A) : |m n a| < 1 := (hm n a).trans_lt hr + let f := fun n => (N n : ℝ)⁻¹ * (∑ i, constrainedFieldValue (h n) (m n (group n i))) - + constrainedBlockValue (spinGroupSlice (group n) (k n)) (h n) + have hf (n : ℕ) : 0 ≤ f n := + (magneticBlockGap_estimate (hN n) (group n) (k n) (hk n) (m n) + (hmi n) (hc n) (h n) (hB n) (hH n) (by norm_num : (0 : ℝ) < 1) + (by norm_num : (0 : ℝ) ≤ 0)).1 + apply tendsto_zero_of_magneticBlockError N hNlim f hf C (Fintype.card A) hC + intro ε hε t ht n + have he := (magneticBlockGap_estimate (hN n) (group n) (k n) (hk n) (m n) + (hmi n) (hc n) (h n) (hB n) (hH n) hε ht).2 + rw [normalized_magneticBlockError (hN n)] at he + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockDiagonalLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockDiagonalLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..b86379421ccd84dd82ac54d8f741a873fada3109 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockDiagonalLower.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticDiagonalSelection +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockTrialLower + +namespace OAI + +/-! Weak tests on growing physical blocks yield the magnetic variational trial lower bound. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem magnetic_block_diagonal_trial_lower {m : ℕ} + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (base : ℕ → OverlapPath) + (htest : ∀ r (Φ : ℝ →ᵇ ℝ), Tendsto (fun j => ∫ t, Φ (cavityStrictUniformPath (base r) j t)* + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField ρ lam hρ hsum (base r) j) t- + cavityStrictUniformPath (base r) j t) ∂pathMeasure) atTop (𝓝 0)) : + ∃ d φ : ℕ → ℕ, StrictMono d ∧ StrictMono φ ∧ + ∀ ε > 0, ∀ᶠ r in atTop, + (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal-ε ≤ constrainedBlockValue (spinGroupSlice (group (φ r)) (k (φ r))) + (cavityStrictUniformField ρ lam hρ hsum (base (φ r)) (d (φ r)))+ + fieldPairing (cavityStrictUniformPath (base (φ r)) (d (φ r))) + (cavityStrictUniformField ρ lam hρ hsum (base (φ r)) (d (φ r)))/2+ + spectralFunctional (finiteR ρ lam hρ hsum) + (cavityStrictUniformPath (base (φ r)) (d (φ r))) := by + obtain ⟨d,φ,p,hd,hφ,hq,hself⟩ := exists_magnetic_consistent_diagonal + ρ lam hρ hsum hK hlam N hN hNlim group k hk (fun _ => mag) hs + (fun _ => hmag) hc base htest + refine ⟨d,φ,hd,hφ,?_⟩ + exact magnetic_block_trial_eventually_lower ρ lam hρ hsum + (fun r => N (φ r)) (fun r => hN (φ r)) (hNlim.comp hφ.tendsto_atTop) + (fun r => group (φ r)) (fun r => k (φ r)) (fun r => hk (φ r)) γ mag hγ hγsum + (fun r => hcount (φ r)) hs hmag (fun r => hc (φ r)) + (fun r => cavityStrictUniformField ρ lam hρ hsum (base (φ r)) (d (φ r))) + (fun r => cavityStrictUniformField_height_le ρ lam hρ hsum hK hlam + (base (φ r)) (d (φ r)) (Fin.last (d (φ r)))) p + (fun r => cavityStrictUniformPath (base (φ r)) (d (φ r))) hself hq + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockError.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockError.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2c3dc004c0e72e9d03a418420c2ec9a39cd3ad6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockError.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Magnetic.ConstrainedBlockMagneticEstimate +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldParameter +import Mathlib.Analysis.SpecificLimits.Basic + +namespace OAI + +/-! The finite block error vanishes uniformly over field partitions with +bounded final height and magnetizations in a fixed interior interval. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators NNReal Topology + +namespace InvariantIsing + +def magneticUniformBiasBound (H r : ℝ) : ℝ := (Real.log 2 + H / 2) / (1 - r) + +lemma magneticBias_uniform_bound (h : FieldStep) {H r m : ℝ} + (hr : r < 1) (hm : |m| ≤ r) (hH : h.height (Fin.last h.depth) ≤ H) : + |magneticBias h m| ≤ magneticUniformBiasBound H r := by + have hi := hm.trans_lt hr + have hb := magneticBias_minimum_bound h hi hH (magneticBias_minimizes h hi) + have hH0 := (h.nonneg (Fin.last h.depth)).trans hH + exact hb.trans (div_le_div_of_nonneg_left (by positivity) (sub_pos.mpr hr) (by linarith)) + +lemma normalized_magneticBlockError {N : ℕ} (hN : 0 < N) (C A ε t : ℝ) : + (N : ℝ)⁻¹ * (ε * (N * C) + (ε⁻¹ + t) * (A * Real.sqrt N) + + N * Real.log (1 + Real.exp (-t))) = + ε * C + (ε⁻¹ + t) * A / Real.sqrt N + Real.log (1 + Real.exp (-t)) := by + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + have hs : Real.sqrt (N : ℝ) ≠ 0 := (Real.sqrt_pos.mpr (by exact_mod_cast hN)).ne' + have hs2 := Real.sq_sqrt (Nat.cast_nonneg N : (0 : ℝ) ≤ N) + field_simp + linear_combination (ε⁻¹ + t) * A * hs2 + +lemma log_one_add_exp_neg_tendsto : + Tendsto (fun t : ℝ => Real.log (1 + Real.exp (-t))) atTop (𝓝 0) := by + have he := Real.tendsto_exp_atBot.comp tendsto_neg_atTop_atBot + have hh := (tendsto_const_nhds.add he).log (by norm_num : (1 : ℝ) + 0 ≠ 0) + simpa only [add_zero, Real.log_one, Function.comp_apply] using hh + +theorem tendsto_zero_of_magneticBlockError (N : ℕ → ℕ) (hN : Tendsto N atTop atTop) + (f : ℕ → ℝ) (hf : ∀ n, 0 ≤ f n) (C A : ℝ) (hC : 0 < C) + (hb : ∀ ε : ℝ, 0 < ε → ∀ t : ℝ, 0 ≤ t → ∀ n, + f n ≤ ε * C + (ε⁻¹ + t) * A / Real.sqrt (N n) + Real.log (1 + Real.exp (-t))) : + Tendsto f atTop (𝓝 0) := by + apply tendsto_order.2 + constructor + · intro a ha + exact Eventually.of_forall (fun n => ha.trans_le (hf n)) + · intro a ha + let ε := a / (4 * C) + have hε : 0 < ε := div_pos ha (by positivity) + have hεC : ε * C = a / 4 := by dsimp [ε]; field_simp + obtain ⟨t, ht, htl⟩ := ((eventually_ge_atTop (0 : ℝ)).and + (log_one_add_exp_neg_tendsto.eventually (gt_mem_nhds (by linarith : (0 : ℝ) < a / 4)))).exists + have hi : Tendsto (fun n => (Real.sqrt (N n : ℝ))⁻¹) atTop (𝓝 0) := + tendsto_inv_atTop_zero.comp (Real.tendsto_sqrt_atTop.comp (tendsto_natCast_atTop_atTop.comp hN)) + have hm : Tendsto (fun n => (ε⁻¹ + t) * A / Real.sqrt (N n)) atTop (𝓝 0) := by + simpa only [div_eq_mul_inv, mul_zero] using hi.const_mul ((ε⁻¹ + t) * A) + filter_upwards [hm.eventually (gt_mem_nhds (by linarith : (0 : ℝ) < a / 4))] with n hn + have h := hb ε hε t ht n + rw [hεC] at h + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockL1Consistency.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockL1Consistency.lean new file mode 100644 index 0000000000000000000000000000000000000000..6053f2df6e0701e8d2b075b72faedfb57af638bf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockL1Consistency.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Arrays.OverlapTestTransport +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPathConvergence + +namespace OAI + +/-! The constrained block overlap converges in L1 once its physical +weak tests hold along a sequence of growing blocks. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem magnetic_block_l1_of_constrained_tests {m : ℕ} + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) (mag : ℕ → A → ℝ) + {s : ℝ} (hs : s < 1) (hmag : ∀ r a, |mag r a| ≤ s) + (hc : ∀ r a, (k r a : ℝ) = spinGroupSize (group r) a * ((1+mag r a)/2)) + (p : OverlapPath) + (htest : ∀ Φ : ℝ →ᵇ ℝ, Tendsto (fun r => ∫ t, Φ (cavityStrictUniformPath p r t) * + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum p r) t - cavityStrictUniformPath p r t) + ∂pathMeasure) atTop (𝓝 0)) : + Tendsto (fun r => ∫ t, |restrictedBlockOverlapPath (hN r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum p r) t-p t| ∂pathMeasure) atTop (𝓝 0) := by + let h := cavityStrictUniformField rho lam hrho hsum p + let a := fun r => restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) (h r) + let b := fun r => magneticBlockPath (hN r) (h r) (fun j => mag r (group r j)) + have hab := magneticBlockPath_l1_tendsto N hN hNlim group k hk mag hs hmag hc h + (fun r => cavityStrictUniformField_height_le rho lam hrho hsum hK hlam p r (Fin.last r)) + have hab' : Tendsto (fun r => ∫ t, |b r t-a r t| ∂pathMeasure) atTop (𝓝 0) := by + simpa only [abs_sub_comm] using hab + have hb : Tendsto (fun r => ∫ t, |b r t-p t| ∂pathMeasure) atTop (𝓝 0) := by + apply cavity_strict_magnetic_block_self_consistency rho lam hrho hsum hK hlam N hN + (fun r j => mag r (group r j)) p + intro Φ + have hd := overlap_weighted_test_l1_transport (cavityStrictUniformPath p) b a hab' Φ + have ht := hd.add (htest Φ) + simpa only [a, b, h, sub_add_cancel, add_zero] using ht + have hz : Tendsto (fun r => (∫ t, |a r t-b r t| ∂pathMeasure) + + ∫ t, |b r t-p t| ∂pathMeasure) atTop (𝓝 0) := by simpa using hab.add hb + apply squeeze_zero (fun r => integral_nonneg (fun t => abs_nonneg _)) (fun r => ?_) hz + calc + (∫ t, |a r t-p t| ∂pathMeasure) ≤ ∫ t, (|a r t-b r t|+|b r t-p t|) ∂pathMeasure := + integral_mono ((a r).integrable.sub p.integrable).abs + (((a r).integrable.sub (b r).integrable).abs.add (((b r).integrable.sub p.integrable).abs)) + (fun t => abs_sub_le (a r t) (b r t) (p t)) + _ = _ := integral_add ((a r).integrable.sub (b r).integrable).abs + ((b r).integrable.sub p.integrable).abs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockModulus.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..1816e38662d2ca41a2b3b1eae8dc8d07ef286c46 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockModulus.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticLevelModulus +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPath + +namespace OAI + +/-! Height continuity after block averaging, uniformly in block size +and in every optimizing root bias. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators NNReal +namespace InvariantIsing + +lemma magneticBlockLevel_abs_sub_le {N : ℕ} (hN : 0 < N) (h : FieldStep) + {V : ℝ} (hV : h.height (Fin.last h.depth) ≤ V) (m : Fin N → ℝ) + (i j : Fin (h.depth+1)) : + |magneticBlockLevel h m i-magneticBlockLevel h m j| ≤ + |h.height i-h.height j| * fieldGaussianMomentCap (Real.sqrt V) := by + unfold magneticBlockLevel + rw [← mul_sub, ← Finset.sum_sub_distrib, abs_mul, + abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg N))] + calc + _ ≤ (N : ℝ)⁻¹ * ∑ k, |magneticFieldLevel h (m k) i-magneticFieldLevel h (m k) j| := + mul_le_mul_of_nonneg_left (Finset.abs_sum_le_sum_abs _ _) (by positivity) + _ ≤ (N : ℝ)⁻¹ * ∑ _k : Fin N, + |h.height i-h.height j| * fieldGaussianMomentCap (Real.sqrt V) := + mul_le_mul_of_nonneg_left + (Finset.sum_le_sum fun k _ => magneticFieldLevel_abs_sub_le h hV (m k) i j) (by positivity) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + rw [← mul_assoc, inv_mul_cancel₀ (Nat.cast_ne_zero.mpr hN.ne'), one_mul] + +lemma magneticBlockPath_on_cell {N : ℕ} (hN : 0 < N) (h : FieldStep) (m : Fin N → ℝ) + (i : Fin (h.depth+1)) {s : ℝ} (hs : s ∈ Ioo (h.cut i.castSucc) (h.cut i.succ)) : + magneticBlockPath hN h m s = magneticBlockLevel h m i := + fieldLevelPath_on_cell h _ _ _ i hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockPath.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e496265147752ebe4f2e4b744e8d84e8103d4cd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockPath.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairTies + +namespace OAI + +/-! The canonical site-average overlap path and its uniform comparison +with the original constrained-block overlap path. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators NNReal + +namespace InvariantIsing + +def magneticBlockLevel {N : ℕ} (h : FieldStep) (m : Fin N → ℝ) + (i : Fin (h.depth + 1)) : ℝ := (N : ℝ)⁻¹ * ∑ j, magneticFieldLevel h (m j) i + +lemma magneticBlockLevel_mem_unit {N : ℕ} (hN : 0 < N) (h : FieldStep) + (m : Fin N → ℝ) (i : Fin (h.depth + 1)) : magneticBlockLevel h m i ∈ Icc (0 : ℝ) 1 := by + have hn : (0 : ℝ) < N := by exact_mod_cast hN + constructor + · exact mul_nonneg (inv_nonneg.mpr hn.le) + (Finset.sum_nonneg (fun j _ => (magneticFieldLevel_mem_unit h (m j) i).1)) + · calc + _ ≤ (N : ℝ)⁻¹ * ∑ _j : Fin N, (1 : ℝ) := + mul_le_mul_of_nonneg_left + (Finset.sum_le_sum (fun j _ => (magneticFieldLevel_mem_unit h (m j) i).2)) + (inv_nonneg.mpr hn.le) + _ = 1 := by simp [hn.ne'] + +lemma magneticBlockLevel_monotone {N : ℕ} (h : FieldStep) (m : Fin N → ℝ) : + Monotone (magneticBlockLevel h m) := by + intro i j hij + exact mul_le_mul_of_nonneg_left + (Finset.sum_le_sum (fun k _ => magneticFieldLevel_monotone h (m k) hij)) (by positivity) + +def magneticBlockPath {N : ℕ} (hN : 0 < N) (h : FieldStep) (m : Fin N → ℝ) : OverlapPath := + fieldLevelPath h (magneticBlockLevel h m) (magneticBlockLevel_monotone h m) + (magneticBlockLevel_mem_unit hN h m) + +lemma magneticBlockPairMean_comparison {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hc : ∀ a, (k a : ℝ) = spinGroupSize group a * ((1 + m a) / 2)) + (h : FieldStep) (i : Fin (h.depth + 1)) {t : ℝ} (ht : 0 < t) : + |restrictedBlockPairMean hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + h (fun _ => 0) i - magneticBlockLevel h (fun j => m (group j)) i| ≤ + 2 * ((N : ℝ)⁻¹ * (∑ j, constrainedFieldValue h (m (group j))) - + constrainedBlockValue (spinGroupSlice group k) h) / t + t / 2 := by + have he := restrictedBlockPairMean_comparison hN (spinGroupSlice group k) + (spinGroupSlice_nonempty group k hk) h (fun j => magneticBias h (m (group j))) i ht + rw [← magneticBlockGap_eq_biasedGap hN group k hk m hm hc h, + restrictedBlockPairMean_group_bias hN group k hk (fun a => magneticBias h (m a)) h i] at he + exact he + +lemma magneticBlockPath_l1_comparison {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hc : ∀ a, (k a : ℝ) = spinGroupSize group a * ((1 + m a) / 2)) + (h : FieldStep) {t : ℝ} (ht : 0 < t) : + (∫ s, |restrictedBlockOverlapPath hN (spinGroupSlice group k) + (spinGroupSlice_nonempty group k hk) h s - magneticBlockPath hN h (fun j => m (group j)) s| + ∂pathMeasure) ≤ + 2 * ((N : ℝ)⁻¹ * (∑ j, constrainedFieldValue h (m (group j))) - + constrainedBlockValue (spinGroupSlice group k) h) / t + t / 2 := by + let p := restrictedBlockOverlapPath hN (spinGroupSlice group k) + (spinGroupSlice_nonempty group k hk) h + let q := magneticBlockPath hN h (fun j => m (group j)) + calc + _ ≤ ∫ _s, (2 * ((N : ℝ)⁻¹ * (∑ j, constrainedFieldValue h (m (group j))) - + constrainedBlockValue (spinGroupSlice group k) h) / t + t / 2) ∂pathMeasure := by + apply integral_mono (p.integrable.sub q.integrable).abs (integrable_const _) + intro s + exact magneticBlockPairMean_comparison hN group k hk m hm hc h (fieldLevelIndex h s) ht + _ = _ := by simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockPathConvergence.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockPathConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..309690381ecf9dafbaf06a96fce2930a85a61f3e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockPathConvergence.lean @@ -0,0 +1,38 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPath + +namespace OAI + +/-! Uniform replacement of the entire original constrained overlap path, +with no bound on the number of covariance levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators NNReal Topology + +namespace InvariantIsing + +theorem magneticBlockPath_l1_tendsto {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ n, 0 < N n) (hNlim : Tendsto N atTop atTop) + (group : ∀ n, Fin (N n) → A) (k : ℕ → A → ℕ) + (hk : ∀ n a, k n a ≤ spinGroupSize (group n) a) (m : ℕ → A → ℝ) + {r H : ℝ} (hr : r < 1) (hm : ∀ n a, |m n a| ≤ r) + (hc : ∀ n a, (k n a : ℝ) = spinGroupSize (group n) a * ((1 + m n a) / 2)) + (h : ℕ → FieldStep) (hH : ∀ n, (h n).height (Fin.last (h n).depth) ≤ H) : + Tendsto (fun n => ∫ s, |restrictedBlockOverlapPath (hN n) + (spinGroupSlice (group n) (k n)) (spinGroupSlice_nonempty (group n) (k n) (hk n)) (h n) s - + magneticBlockPath (hN n) (h n) (fun j => m n (group n j)) s| ∂pathMeasure) + atTop (𝓝 0) := by + apply tendsto_zero_of_pair_entropy _ + (fun n => (N n : ℝ)⁻¹ * (∑ j, constrainedFieldValue (h n) (m n (group n j))) - + constrainedBlockValue (spinGroupSlice (group n) (k n)) (h n)) + (fun n => integral_nonneg (fun _ => abs_nonneg _)) + (magneticBlockGap_tendsto N hN hNlim group k hk m hr hm hc h hH) + intro t ht n + exact magneticBlockPath_l1_comparison (hN n) (group n) (k n) (hk n) (m n) + (fun a => (hm n a).trans_lt hr) (hc n) (h n) ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockTerminalLoss.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockTerminalLoss.lean new file mode 100644 index 0000000000000000000000000000000000000000..416057e2eee2e0e74dbd17d3298416f3ec36ecd8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockTerminalLoss.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Fields.FieldProductSpinAveraging +import OAI.Probability.InvariantIsing.Fields.FieldCanonicalVectorMoments + +namespace OAI + +/-! The actual averaged constrained terminal loss, with constants +independent of the number of Gaussian steps. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators + +namespace InvariantIsing + +lemma magnetic_projection_distance_mean {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hcount : ∀ a, (k a : ℝ) = (spinGroupSize group a : ℝ) * ((1 + m a) / 2)) + (h : FieldStep) : + (∫ z, fieldProjectionDistance (spinGroupProjection group k hk) z + ∂fieldCanonicalVectorLaw N h (fun i => magneticBias h (m (group i)))) ≤ + ∑ a, Real.sqrt (spinGroupSize group a) := by + have he := field_product_spin_average + (fun i : Fin N => fieldCanonicalEndpointLaw h (magneticBias h (m (group i)))) + (fun σ => (hammingDist σ (spinGroupProjection group k hk σ) : ℝ)) + simp only [← fieldCanonicalSpinLaw_endpoint] at he + exact he.trans_le (magneticCanonical_projection_distance group k hk m hm hcount h) + +theorem magnetic_block_terminal_loss {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hcount : ∀ a, (k a : ℝ) = (spinGroupSize group a : ℝ) * ((1 + m a) / 2)) + (h : FieldStep) {B H ε t : ℝ} (hB : ∀ i, |magneticBias h (m (group i))| ≤ B) + (hH : h.height (Fin.last h.depth) ≤ H) (hε : 0 < ε) (ht : 0 ≤ t) : + (∫ z, (∑ i, Real.log (Real.cosh (z i))) - restrictedFieldTerminal (spinGroupSlice group k) z + ∂fieldCanonicalVectorLaw N h (fun i => magneticBias h (m (group i)))) ≤ + ε * (N * (2 * Real.exp (2 * B + 4 * H))) + + (ε⁻¹ + t) * (∑ a, Real.sqrt (spinGroupSize group a)) + + N * Real.log (1 + Real.exp (-t)) := by + have hl := field_projection_mean_loss (spinGroupSlice group k) + (spinGroupSlice_nonempty group k hk) (spinGroupProjection group k hk) + (spinGroupProjection_mem group k hk) + (fieldCanonicalVectorLaw N h (fun i => magneticBias h (m (group i)))) + (fieldCanonicalVectorLaw_square_integrable h (fun i => magneticBias h (m (group i)))) hε t + have hM := fieldCanonicalVectorLaw_second_moment h + (fun i => magneticBias h (m (group i))) hB hH + have hD := magnetic_projection_distance_mean group k hk m hm hcount h + exact hl.trans (add_le_add (add_le_add + (mul_le_mul_of_nonneg_left hM hε.le) + (mul_le_mul_of_nonneg_left hD (by positivity))) le_rfl) + +lemma sum_sqrt_spinGroupSize_le {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) : + (∑ a, Real.sqrt (spinGroupSize group a)) ≤ Fintype.card A * Real.sqrt N := by + calc + _ ≤ ∑ _a : A, Real.sqrt (N : ℝ) := by + apply Finset.sum_le_sum + intro a _ + apply Real.sqrt_le_sqrt + exact_mod_cast (show spinGroupSize group a ≤ N from by + simpa only [spinGroupSize, Finset.card_univ, Fintype.card_fin] using + Finset.card_filter_le (s := (Finset.univ : Finset (Fin N))) (fun i => group i = a)) + _ = _ := by simp + +theorem magnetic_block_terminal_loss_size {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hcount : ∀ a, (k a : ℝ) = (spinGroupSize group a : ℝ) * ((1 + m a) / 2)) + (h : FieldStep) {B H ε t : ℝ} (hB : ∀ i, |magneticBias h (m (group i))| ≤ B) + (hH : h.height (Fin.last h.depth) ≤ H) (hε : 0 < ε) (ht : 0 ≤ t) : + (∫ z, (∑ i, Real.log (Real.cosh (z i))) - restrictedFieldTerminal (spinGroupSlice group k) z + ∂fieldCanonicalVectorLaw N h (fun i => magneticBias h (m (group i)))) ≤ + ε * (N * (2 * Real.exp (2 * B + 4 * H))) + + (ε⁻¹ + t) * (Fintype.card A * Real.sqrt N) + + N * Real.log (1 + Real.exp (-t)) := + (magnetic_block_terminal_loss group k hk m hm hcount h hB hH hε ht).trans + (add_le_add (add_le_add le_rfl + (mul_le_mul_of_nonneg_left (sum_sqrt_spinGroupSize_le group) (by positivity))) le_rfl) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockTrialLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockTrialLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5751bcfd9990f7fc44cb7a729a34bfae125670c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBlockTrialLower.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticEntropyMaximum +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupConsistency + +namespace OAI + +/-! The original constrained block trial attains the magnetic +variational lower bound once its physical overlap is self-consistent. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_block_trial_eventually_lower {A ι : Type*} [Fintype A] [DecidableEq A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ) = N r * γ a) + {s H : ℝ} (hs : s<1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ) = spinGroupSize (group r) a*((1+mag a)/2)) + (h : ℕ → FieldStep) (hH : ∀ r, (h r).height (Fin.last (h r).depth) ≤ H) + (p : OverlapPath) (q : ℕ → OverlapPath) + (hself : Tendsto (fun r => ∫ t, |restrictedBlockOverlapPath (hN r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (h r) t-p t| ∂pathMeasure) atTop (𝓝 0)) + (hq : Tendsto (fun r => ∫ t, |q r t-p t| ∂pathMeasure) atTop (𝓝 0)) : + ∀ ε>0, ∀ᶠ r in atTop, + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal-ε ≤ + constrainedBlockValue (spinGroupSlice (group r) (k r)) (h r)+ + fieldPairing (q r) (h r)/2+spectralFunctional (finiteR ρ eig hρ hsum) (q r) := by + have hgroup := magnetic_group_l1_of_block_consistency N hN hNlim group k hk γ mag + hγ hγsum hcount hs hmag hc h hH p hself + have hlower := magnetic_entropy_trial_eventually_lower ρ eig hρ hsum γ mag hγ hγsum + (fun a => (hmag a).trans_lt hs) p q h hH hgroup hq + have hgap := magneticBlockGap_tendsto N hN hNlim group k hk (fun _ => mag) hs + (fun _ => hmag) hc h hH + have he r : (N r : ℝ)⁻¹*(∑ j, constrainedFieldValue (h r) (mag (group r j))) = + magneticGroupValue γ mag (h r) := + magneticGroupValue_eq_block (hN r) (group r) γ mag (hcount r) (h r) + simp_rw [he] at hgap + intro ε hε + filter_upwards [hlower (ε/2) (half_pos hε), + hgap.eventually (Iio_mem_nhds (half_pos hε))] with r hr hgapr + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBoundaryContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBoundaryContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ea4637bf2518c6844cce1358c03ec3038dfbd46 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBoundaryContinuity.lean @@ -0,0 +1,158 @@ +import OAI.Probability.InvariantIsing.Fields.FieldHeightBoundaryContinuity +import OAI.Probability.InvariantIsing.Magnetic.MagneticImplicitBias +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldLevels + +namespace OAI + +/-! Continuity of the prescribed-magnetization functional along the strict +height regularization, including coincident heights and zero root variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped NNReal Topology + +namespace InvariantIsing + +lemma fieldRegularized_depth (h : FieldStep) (t : ℝ) : + (fieldRegularized h t).depth = h.depth := rfl + +lemma continuous_fieldRegularizedValue_bias (h : FieldStep) : + Continuous (fun p : ℝ × ℝ => fieldValue (fieldRegularized h p.1) p.2) := by + let L := fieldRegularizedIncrements h + let V := h.height (Fin.last h.depth) + 1 + have hV : 0 ≤ V := add_nonneg (h.nonneg _) zero_le_one + have hL := fieldRegularizedIncrements_positive h + have hc := fieldRegularizedIncrements_continuous h + have hv := fieldRegularizedIncrements_bound h + have hval := continuous_fieldVaryingValue L hL hc hV hv + obtain ⟨hcap, hb⟩ := fieldVaryingValue_bound L hL hV hv + have hroot : Continuous (fun p : ℝ × ℝ => (fieldRegularizedRoot h p.1 : ℝ)) := + (NNReal.continuous_coe.comp (continuous_fieldRegularizedRoot h)).comp continuous_fst + have hi := continuous_field_gaussian_integral (E := ℝ × ℝ) + (U := fun p y => fieldVaryingValue L p.1 y) + (hval.comp (continuous_fst.fst.prodMk continuous_snd)) hroot continuous_snd + hcap zero_le_one (fun p y => by simpa only [one_mul] using hb p.1 y) + have hlast : Continuous (fun p : ℝ × ℝ => + (fieldRegularized h p.1).height (Fin.last h.depth) / 2) := by + change Continuous (fun p : ℝ × ℝ => (h.height (Fin.last h.depth) + + fieldHeightEpsilon p.1 * ((Fin.last h.depth).val + 1 : ℕ)) / 2) + have heps := continuous_fieldHeightEpsilon + fun_prop + convert hi.sub hlast using 1 + funext p + rw [fieldValue_root, ← fieldRegularizedIncrements_eval, + ← fieldVaryingValue_eq_scalar] + simp only [gaussianOperator, ite_true, fieldRegularized, fieldWithHeights, + fieldRegularizedHeight, Fin.val_zero, zero_add, Nat.cast_one, mul_one, + fieldRegularizedRoot, NNReal.coe_mk, Pi.sub_apply, L] + rfl + +lemma continuous_fieldRegularizedMean_bias (h : FieldStep) : + Continuous (fun p : ℝ × ℝ => fieldBiasMean (fieldRegularized h p.1) p.2) := by + let L := fieldRegularizedIncrements h + let V := h.height (Fin.last h.depth) + 1 + have hV : 0 ≤ V := add_nonneg (h.nonneg _) zero_le_one + have hL := fieldRegularizedIncrements_positive h + have hc := fieldRegularizedIncrements_continuous h + have hv := fieldRegularizedIncrements_bound h + have hm := continuous_fieldVaryingMean L hL hc hV hv + have hroot : Continuous (fun p : ℝ × ℝ => (fieldRegularizedRoot h p.1 : ℝ)) := + (NNReal.continuous_coe.comp (continuous_fieldRegularizedRoot h)).comp continuous_fst + have hi := continuous_field_gaussian_integral (E := ℝ × ℝ) + (U := fun p y => fieldVaryingMean L p.1 y) + (hm.comp (continuous_fst.fst.prodMk continuous_snd)) hroot continuous_snd + zero_le_one (le_refl (0 : ℝ)) (fun p y => by + simpa only [zero_mul, add_zero] using (fieldVaryingMean_regular L hL p.1).2 y) + convert hi using 1 + funext p + unfold fieldBiasMean + rw [← fieldRegularizedIncrements_eval, ← fieldVaryingValue_eq_scalar, + ← fieldVaryingMean_eq_scalar, + fieldSpinTransition_eq_standard 0 _ (fieldVaryingValue_regular L hL p.1).1 + (fieldVaryingMean_regular L hL p.1).1, gaussianTiltAverage_zero] + simp only [fieldRegularizedRoot, fieldRegularized, fieldWithHeights, + fieldRegularizedHeight, Fin.val_zero, zero_add, Nat.cast_one, mul_one, NNReal.coe_mk] + rfl + +lemma continuous_fieldRegularizedLevel_bias (h : FieldStep) (i : Fin (h.depth + 1)) : + Continuous (fun p : ℝ × ℝ => magneticLevelAtBias (fieldRegularized h p.1) p.2 i) := by + let L := fieldRegularizedIncrements h + let V := h.height (Fin.last h.depth) + 1 + have hV : 0 ≤ V := add_nonneg (h.nonneg _) zero_le_one + have hL := fieldRegularizedIncrements_positive h + have hc := fieldRegularizedIncrements_continuous h + have hv := fieldRegularizedIncrements_bound h + let j : Fin (L.length + 1) := ⟨i.val, by + simpa only [L, fieldRegularizedIncrements, List.length_ofFn] using i.isLt⟩ + have hm := continuous_fieldVaryingSquares L hL hc hV hv j + have hroot : Continuous (fun p : ℝ × ℝ => (fieldRegularizedRoot h p.1 : ℝ)) := + (NNReal.continuous_coe.comp (continuous_fieldRegularizedRoot h)).comp continuous_fst + have hi := continuous_field_gaussian_integral (E := ℝ × ℝ) + (U := fun p y => fieldVaryingSquares L p.1 j y) + (hm.comp (continuous_fst.fst.prodMk continuous_snd)) hroot continuous_snd + zero_le_one (le_refl (0 : ℝ)) (fun p y => by + have hb := (fieldVaryingSquares_regular L hL p.1 j).2 y + simpa only [zero_mul, add_zero, abs_of_nonneg hb.1] using hb.2) + convert hi using 1 + funext p + change fieldSpinTransition 0 (NNReal.mk ((fieldRegularized h p.1).height 0) + ((fieldRegularized h p.1).nonneg 0)) + (fieldScalarValue (scalarFieldIncrements (fieldRegularized h p.1)) + (fun z => Real.log (Real.cosh z))) + (fieldScalarSquares (scalarFieldIncrements (fieldRegularized h p.1)) + (fun z => Real.log (Real.cosh z)) Real.tanh + ⟨i.val, by rw [scalarFieldIncrements_length, fieldRegularized_depth]; exact i.isLt⟩) p.2 = _ + have he : fieldScalarSquares (scalarFieldIncrements (fieldRegularized h p.1)) + (fun z => Real.log (Real.cosh z)) Real.tanh + ⟨i.val, by rw [scalarFieldIncrements_length, fieldRegularized_depth]; exact i.isLt⟩ = + fieldVaryingSquares L p.1 j := by + rw [fieldVaryingSquares_eq_scalar] + exact fieldScalarSquares_congr_list (fieldRegularizedIncrements_eval h p.1).symm + (fun z => Real.log (Real.cosh z)) Real.tanh _ _ rfl + rw [he, ← fieldRegularizedIncrements_eval, ← fieldVaryingValue_eq_scalar, + fieldSpinTransition_eq_standard 0 _ (fieldVaryingValue_regular L hL p.1).1 + (fieldVaryingSquares_regular L hL p.1 j).1, gaussianTiltAverage_zero] + simp only [fieldRegularizedRoot, fieldRegularized, fieldWithHeights, + fieldRegularizedHeight, Fin.val_zero, zero_add, Nat.cast_one, mul_one, NNReal.coe_mk] + rfl + +lemma continuous_fieldRegularizedMagneticBias (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + Continuous (fun t => magneticBias (fieldRegularized h t) s) := by + apply continuous_iff_continuousAt.mpr + intro t + apply parametric_bias_continuousAt + (A := fun p => fieldBiasMean (fieldRegularized h p.1) p.2) + (s := s) + · intro z + exact ((continuous_fieldRegularizedMean_bias h).comp + (continuous_id.prodMk continuous_const)).continuousAt + · exact Eventually.of_forall (fun q => strictMono_fieldBiasMean (fieldRegularized h q)) + · exact Eventually.of_forall (fun q => fieldBiasMean_magneticBias (fieldRegularized h q) hs) + +lemma continuous_fieldRegularizedConstrainedValue (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + Continuous (fun t => constrainedFieldValue (fieldRegularized h t) s) := by + have hb := continuous_fieldRegularizedMagneticBias h hs + have hv := (continuous_fieldRegularizedValue_bias h).comp (continuous_id.prodMk hb) + convert hv.sub (hb.mul_const s) using 1 + funext t + exact constrainedFieldValue_magneticBias (fieldRegularized h t) hs + +lemma continuous_fieldRegularizedMagneticLevel (h : FieldStep) {s : ℝ} (hs : |s| < 1) + (i : Fin (h.depth + 1)) : + Continuous (fun t => magneticFieldLevel (fieldRegularized h t) s i) := by + have hb : Continuous (fun t => magneticBias (fieldRegularized h t) s) := + continuous_fieldRegularizedMagneticBias h hs + have hp : Continuous (fun t : ℝ => (t, magneticBias (fieldRegularized h t) s)) := + continuous_id.prodMk hb + have hc : Continuous (fun p : ℝ × ℝ => + magneticLevelAtBias (fieldRegularized h p.1) p.2 i) := + continuous_fieldRegularizedLevel_bias h i + change Continuous (fun t : ℝ => magneticLevelAtBias (fieldRegularized h t) + (magneticBias (fieldRegularized h t) s) i) + simpa only [Function.comp_def] using hc.comp hp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBoundedInverseComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBoundedInverseComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..15b34cd8238712c7e916d18910296954ac04a73b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticBoundedInverseComparison.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicNegative + +namespace OAI + +/-! Exponent comparison for the one-dimensional inverse-curvature equation with an arbitrary finite curvature cap. +The coefficient bound is required only where the proposed order fails. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem inverse_curvature_parabolic_comparison_bound {T ζ η K A : ℝ} + (hT : 0 ≤ T) (hη : 0 ≤ η) (hζη : ζ ≤ η) + (a aTime ax axx b bTime bx bxx : ℝ × ℝ → ℝ) + (ha : ContinuousOn a (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hb : ContinuousOn b (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hinit : ∀ s ∈ Icc (-1 : ℝ) 1, a (0, s) ≤ b (0, s)) + (hat : ∀ t ∈ Ioc (0 : ℝ) T, ∀ s ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun u => a (u, s)) (aTime (t, s)) (Iic t) t) + (hbt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ s ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun u => b (u, s)) (bTime (t, s)) (Iic t) t) + (hax : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => a (t, u)) (ax (t, s)) s) + (hbx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => b (t, u)) (bx (t, s)) s) + (haxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => ax (t, u)) (axx (t, s)) s) + (hbxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => bx (t, u)) (bxx (t, s)) s) + (ha0 : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ a p) + (hb0 : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ b p) + (ha1 : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, a p ≤ A) + (hbound : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, |a p * axx p| ≤ K) + (hend : ∀ t ∈ Icc (0 : ℝ) T, a (t, -1) = 0 ∧ b (t, -1) = 0 ∧ + a (t, 1) = 0 ∧ b (t, 1) = 0) + (hpa : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + aTime p = a p ^ 2 / 2 * axx p + ζ * a p ^ 2) + (hpb : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + bTime p = b p ^ 2 / 2 * bxx p + η * b p ^ 2) : + ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, a p ≤ b p := by + have h := parabolic_minimum_nonneg_bounded_on_negative (M := K + 2 * A * η) hT + (fun p => b p - a p) (fun p => bTime p - aTime p) (fun p => bx p - ax p) + (fun p => bxx p - axx p) (fun p => b p ^ 2 / 2) (fun _ => 0) + (fun p => (b p + a p) * (axx p / 2 + η)) + (hb.sub ha) (fun s hs => sub_nonneg.mpr (hinit s hs)) + (fun t ht s hs => (hbt t ht s hs).sub (hat t ht s hs)) + (fun t ht s hs => (hbx t ht s hs).sub (hax t ht s hs)) + (fun t ht s hs => (hbxx t ht s hs).sub (haxx t ht s hs)) + (fun p hp => div_nonneg (sq_nonneg _) (by norm_num)) + (fun p hp hn => by + exact inverse_curvature_difference_coefficient_bound + (ha0 p hp) (hb0 p hp) (by linarith) (ha1 p hp) hη (hbound p hp)) + (fun t ht => by + obtain ⟨haL, hbL, haR, hbR⟩ := hend t ht + simp only [hbL, hbR, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, + zero_div, and_self]) ?_ + · intro p hp + exact sub_nonneg.mp (h p hp) + · intro p hp + rw [hpb p hp, hpa p hp] + have hn := mul_nonneg (sub_nonneg.mpr hζη) (sq_nonneg (a p)) + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCanonicalSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCanonicalSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfcc3c33c4b63a8cdb243fd4e43b7873269c24a9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCanonicalSpin.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSpinSampling +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldInverse +import OAI.Probability.InvariantIsing.Fields.SpinGroupCountVariance + +namespace OAI + +/-! The actual canonical spin law, including the ordinary Gaussian root. +Its mean is the physical bias derivative, so optimizing the bias gives +the requested group magnetizations exactly. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +def fieldCanonicalSpinLaw (h : FieldStep) (b : ℝ) : Measure Bool := + (fieldTailSpinKernel (scalarFieldIncrements h) (scalarFieldIncrements_positive h) ∘ₖ + fieldTransitionKernel 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fieldScalarValue_regular _ (scalarFieldIncrements_positive h) + measurable_logCosh logCosh_linearGrowth).1) b + +instance fieldCanonicalSpinLaw_probability (h : FieldStep) (b : ℝ) : + IsProbabilityMeasure (fieldCanonicalSpinLaw h b) := by + unfold fieldCanonicalSpinLaw + infer_instance + +theorem fieldCanonicalSpinLaw_mean (h : FieldStep) (b : ℝ) : + (∫ σ, spinValue σ ∂fieldCanonicalSpinLaw h b) = fieldBiasMean h b := by + unfold fieldCanonicalSpinLaw + rw [Kernel.integral_comp Integrable.of_finite] + simp_rw [fieldTailSpinKernel_mean] + exact fieldTransitionKernel_integral 0 _ _ + (fieldScalarValue_regular _ (scalarFieldIncrements_positive h) + measurable_logCosh logCosh_linearGrowth).1 + (fieldScalarValue_regular _ (scalarFieldIncrements_positive h) + measurable_logCosh logCosh_linearGrowth).2 _ b + +theorem fieldCanonicalSpinLaw_magnetic_mean (h : FieldStep) {m : ℝ} (hm : |m| < 1) : + (∫ σ, spinValue σ ∂fieldCanonicalSpinLaw h (magneticBias h m)) = m := by + rw [fieldCanonicalSpinLaw_mean, fieldBiasMean_magneticBias h hm] + +lemma spin_true_mean_of_spin_mean (μ : Measure Bool) [IsProbabilityMeasure μ] + {m : ℝ} (hm : (∫ σ, spinValue σ ∂μ) = m) : + (∫ σ, (if σ = true then (1 : ℝ) else 0) ∂μ) = (1 + m) / 2 := by + have he (σ : Bool) : (if σ = true then (1 : ℝ) else 0) = (1 + spinValue σ) / 2 := by + cases σ <;> norm_num [spinValue] + simp_rw [he] + have hu : μ.real Set.univ = 1 := by rw [measureReal_def, measure_univ]; norm_num + rw [integral_div, integral_add (integrable_const _) Integrable.of_finite, + integral_const, hu, one_smul, hm] + +theorem spinGroupCount_mean_of_site_means {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (a : A) (μ : Fin N → Measure Bool) + [∀ i, IsProbabilityMeasure (μ i)] (m : ℝ) + (hm : ∀ i, group i = a → (∫ σ, spinValue σ ∂μ i) = m) : + (∫ σ : Spin N, (spinGroupCount group σ a : ℝ) ∂Measure.pi μ) = + (spinGroupSize group a : ℝ) * ((1 + m) / 2) := by + have hi (σ : Spin N) : (spinGroupCount group σ a : ℝ) = + ∑ i, spinGroupCountSummand group a i (σ i) := (sum_spinGroupCountSummand group a σ).symm + simp_rw [hi] + rw [integral_finsetSum _ (fun _ _ => Integrable.of_finite)] + have hj (i : Fin N) : + (∫ σ : Spin N, spinGroupCountSummand group a i (σ i) ∂Measure.pi μ) = + if group i = a then (1 + m) / 2 else 0 := by + rw [integral_comp_eval (μ := μ) (i := i) (measurable_of_finite _).aestronglyMeasurable] + by_cases hg : group i = a + · simpa only [spinGroupCountSummand, hg, true_and, ite_true] using + spin_true_mean_of_spin_mean (μ i) (hm i hg) + · simp [spinGroupCountSummand, hg] + simp_rw [hj] + simp [Finset.sum_ite, spinGroupSize, mul_comm] + +theorem magneticCanonical_projection_distance {N : ℕ} {A : Type*} + [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (m : A → ℝ) (hm : ∀ a, |m a| < 1) + (hcount : ∀ a, (k a : ℝ) = (spinGroupSize group a : ℝ) * ((1 + m a) / 2)) + (h : FieldStep) : + (∫ σ : Spin N, (hammingDist σ (spinGroupProjection group k hk σ) : ℝ) + ∂Measure.pi (fun i => fieldCanonicalSpinLaw h (magneticBias h (m (group i))))) ≤ + ∑ a, Real.sqrt (spinGroupSize group a) := by + apply spinGroupProjection_product_mean_distance + intro a + rw [spinGroupCount_mean_of_site_means group a _ (m a) (fun i hi => by + rw [hi] + exact fieldCanonicalSpinLaw_magnetic_mean h (hm a))] + exact (hcount a).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCenteredMoments.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCenteredMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc284d1eba896a835a377adf8834b978f152b5d3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCenteredMoments.lean @@ -0,0 +1,306 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCurvatureBound + +namespace OAI + +/-! Centered bounded-spin moments used to control the coefficients of the +inverse-mean diffusion. These estimates apply to the actual tilted Gaussian +law, including zero covariance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +private lemma magnetic_bounded_integrable (μ : Measure ℝ) [IsFiniteMeasure μ] + {f : ℝ → ℝ} (hf : Measurable f) {C : ℝ} (hC : ∀ x, |f x| ≤ C) : + Integrable f μ := + Integrable.of_bound hf.aestronglyMeasurable C + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using hC x) + +lemma magnetic_spin_mean_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : ∀ x, |M x| ≤ 1) : |∫ x, M x ∂μ| ≤ 1 := by + have h := norm_integral_le_of_norm_le_const (μ := μ) (f := M) (C := 1) + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using hM x) + simpa only [Real.norm_eq_abs, measureReal_def, measure_univ, ENNReal.toReal_one, mul_one] using h + +lemma magnetic_centered_spin_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : ∀ x, |M x| ≤ 1) (x : ℝ) : + |M x - ∫ y, M y ∂μ| ≤ 2 := by + exact (abs_sub _ _).trans (by linarith [hM x, magnetic_spin_mean_bound μ hM]) + +lemma magnetic_centered_power_integrable (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) (k : ℕ) : + Integrable (fun x => (M x - ∫ y, M y ∂μ) ^ k) μ := by + apply magnetic_bounded_integrable μ ((hM.sub measurable_const).pow_const k) + intro x + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (magnetic_centered_spin_bound μ bM x) k + +lemma magnetic_centered_second (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) : + (∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ) = + (∫ x, (M x) ^ 2 ∂μ) - (∫ x, M x ∂μ) ^ 2 := by + have h1 := magnetic_bounded_integrable μ hM bM + have h2 : Integrable (fun x => (M x) ^ 2) μ := + magnetic_bounded_integrable μ (C := 1) (hM.pow_const 2) (fun x => by + rw [abs_pow] + simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (bM x) 2) + let m := ∫ x, M x ∂μ + calc + _ = ∫ x, ((M x) ^ 2 - (2 * m) * M x) + m ^ 2 ∂μ := by + apply integral_congr_ae + exact ae_of_all _ fun x => by dsimp only [m]; ring + _ = _ := by + rw [integral_add (f := fun x => (M x) ^ 2 - (2 * m) * M x) + (g := fun _ => m ^ 2) (h2.sub (h1.const_mul _)) (integrable_const _), + integral_sub (f := fun x => (M x) ^ 2) (g := fun x => (2 * m) * M x) + h2 (h1.const_mul _), integral_const_mul, integral_const] + simp only [measureReal_def, measure_univ, ENNReal.toReal_one, one_smul] + dsimp only [m] + ring + +lemma magnetic_centered_second_bounds (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) : + 0 ≤ (∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ) ∧ + (∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ) ≤ 1 := by + constructor + · exact integral_nonneg fun _ => sq_nonneg _ + · rw [magnetic_centered_second μ hM bM] + have hi := norm_integral_le_of_norm_le_const (μ := μ) + (f := fun x => (M x) ^ 2) (C := 1) (ae_of_all _ fun x => by + rw [Real.norm_eq_abs, abs_pow] + simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (bM x) 2) + simp only [Real.norm_eq_abs, measureReal_def, measure_univ, ENNReal.toReal_one, mul_one] at hi + linarith [le_abs_self (∫ x, (M x) ^ 2 ∂μ), sq_nonneg (∫ x, M x ∂μ)] + +lemma magnetic_centered_third (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) : + (∫ x, (M x - ∫ y, M y ∂μ) ^ 3 ∂μ) = + (∫ x, (M x) ^ 3 ∂μ) - 3 * (∫ x, M x ∂μ) * (∫ x, (M x) ^ 2 ∂μ) + + 2 * (∫ x, M x ∂μ) ^ 3 := by + have hp (k : ℕ) : Integrable (fun x => (M x) ^ k) μ := + magnetic_bounded_integrable μ (C := 1) (hM.pow_const k) (fun x => by + rw [abs_pow] + simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (bM x) k) + have h1 := magnetic_bounded_integrable μ hM bM + let m := ∫ x, M x ∂μ + calc + _ = ∫ x, (((M x) ^ 3 - (3 * m) * (M x) ^ 2) + (3 * m ^ 2) * M x) - m ^ 3 ∂μ := by + apply integral_congr_ae + exact ae_of_all _ fun x => by dsimp only [m]; ring + _ = _ := by + rw [integral_sub (f := fun x => ((M x) ^ 3 - (3 * m) * (M x) ^ 2) + (3 * m ^ 2) * M x) + (g := fun _ => m ^ 3) (((hp 3).sub ((hp 2).const_mul _)).add (h1.const_mul _)) + (integrable_const _), + integral_add (f := fun x => (M x) ^ 3 - (3 * m) * (M x) ^ 2) + (g := fun x => (3 * m ^ 2) * M x) ((hp 3).sub ((hp 2).const_mul _)) (h1.const_mul _), + integral_sub (f := fun x => (M x) ^ 3) (g := fun x => (3 * m) * (M x) ^ 2) + (hp 3) ((hp 2).const_mul _), integral_const_mul, + integral_const_mul, integral_const] + simp only [measureReal_def, measure_univ, ENNReal.toReal_one, one_smul] + dsimp only [m] + ring + +lemma magnetic_centered_fourth (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) : + (∫ x, (M x - ∫ y, M y ∂μ) ^ 4 ∂μ) = + (∫ x, (M x) ^ 4 ∂μ) - 4 * (∫ x, M x ∂μ) * (∫ x, (M x) ^ 3 ∂μ) + + 6 * (∫ x, M x ∂μ) ^ 2 * (∫ x, (M x) ^ 2 ∂μ) - + 3 * (∫ x, M x ∂μ) ^ 4 := by + have hp (k : ℕ) : Integrable (fun x => (M x) ^ k) μ := + magnetic_bounded_integrable μ (C := 1) (hM.pow_const k) (fun x => by + rw [abs_pow] + simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (bM x) k) + have h1 := magnetic_bounded_integrable μ hM bM + let m := ∫ x, M x ∂μ + calc + _ = ∫ x, ((((M x) ^ 4 - (4 * m) * (M x) ^ 3) + (6 * m ^ 2) * (M x) ^ 2) - + (4 * m ^ 3) * M x) + m ^ 4 ∂μ := by + apply integral_congr_ae + exact ae_of_all _ fun x => by dsimp only [m]; ring + _ = _ := by + rw [integral_add + (f := fun x => (((M x) ^ 4 - (4 * m) * (M x) ^ 3) + (6 * m ^ 2) * (M x) ^ 2) - (4 * m ^ 3) * M x) + (g := fun _ => m ^ 4) + ((((hp 4).sub ((hp 3).const_mul _)).add ((hp 2).const_mul _)).sub (h1.const_mul _)) + (integrable_const _), + integral_sub (f := fun x => ((M x) ^ 4 - (4 * m) * (M x) ^ 3) + (6 * m ^ 2) * (M x) ^ 2) + (g := fun x => (4 * m ^ 3) * M x) + (((hp 4).sub ((hp 3).const_mul _)).add ((hp 2).const_mul _)) (h1.const_mul _), + integral_add (f := fun x => (M x) ^ 4 - (4 * m) * (M x) ^ 3) + (g := fun x => (6 * m ^ 2) * (M x) ^ 2) + ((hp 4).sub ((hp 3).const_mul _)) ((hp 2).const_mul _), + integral_sub (f := fun x => (M x) ^ 4) (g := fun x => (4 * m) * (M x) ^ 3) + (hp 4) ((hp 3).const_mul _), integral_const_mul, + integral_const_mul, integral_const_mul, integral_const] + simp only [measureReal_def, measure_univ, ENNReal.toReal_one, one_smul] + dsimp only [m] + ring + +lemma magnetic_weighted_centered_second (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M Q : ℝ → ℝ} (hM : Measurable M) (hQ : Measurable Q) + (bM : ∀ x, |M x| ≤ 1) {C : ℝ} (bQ : ∀ x, |Q x| ≤ C) : + (∫ x, Q x * (M x - ∫ y, M y ∂μ) ^ 2 ∂μ) = + (∫ x, Q x * (M x) ^ 2 ∂μ) - + 2 * (∫ x, M x ∂μ) * (∫ x, Q x * M x ∂μ) + + (∫ x, M x ∂μ) ^ 2 * (∫ x, Q x ∂μ) := by + have hiQ := magnetic_bounded_integrable μ hQ bQ + have hiQM (k : ℕ) : Integrable (fun x => Q x * (M x) ^ k) μ := + hiQ.mul_bdd (hM.pow_const k).aestronglyMeasurable (ae_of_all _ fun x => by + rw [Real.norm_eq_abs, abs_pow] + simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (bM x) k) + let m := ∫ x, M x ∂μ + calc + _ = ∫ x, (Q x * (M x) ^ 2 - (2 * m) * (Q x * (M x) ^ 1)) + + m ^ 2 * Q x ∂μ := by + apply integral_congr_ae + exact ae_of_all _ fun x => by dsimp only [m]; ring + _ = _ := by + rw [integral_add (f := fun x => Q x * (M x) ^ 2 - (2 * m) * (Q x * (M x) ^ 1)) + (g := fun x => m ^ 2 * Q x) ((hiQM 2).sub ((hiQM 1).const_mul _)) (hiQ.const_mul _), + integral_sub (f := fun x => Q x * (M x) ^ 2) (g := fun x => (2 * m) * (Q x * (M x) ^ 1)) + (hiQM 2) ((hiQM 1).const_mul _), integral_const_mul, + integral_const_mul] + simp only [pow_one] + dsimp only [m] + +lemma magnetic_centered_third_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) : + |∫ x, (M x - ∫ y, M y ∂μ) ^ 3 ∂μ| ≤ + 2 * ∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ := by + have h3 := magnetic_centered_power_integrable μ hM bM 3 + have h2 := magnetic_centered_power_integrable μ hM bM 2 + calc + _ ≤ ∫ x, |(M x - ∫ y, M y ∂μ) ^ 3| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ x, 2 * (M x - ∫ y, M y ∂μ) ^ 2 ∂μ := by + apply integral_mono h3.abs (h2.const_mul 2) + intro x + change |(M x - ∫ y, M y ∂μ) ^ 3| ≤ 2 * (M x - ∫ y, M y ∂μ) ^ 2 + rw [abs_pow, pow_succ _ 2] + have hp := mul_le_mul_of_nonneg_left (magnetic_centered_spin_bound μ bM x) + (sq_nonneg |M x - ∫ y, M y ∂μ|) + nlinarith [sq_abs (M x - ∫ y, M y ∂μ)] + _ = _ := integral_const_mul _ _ + +lemma magnetic_centered_fourth_cumulant_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M : ℝ → ℝ} (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) : + |(∫ x, (M x - ∫ y, M y ∂μ) ^ 4 ∂μ) - + 3 * (∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ) ^ 2| ≤ + 7 * ∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ := by + let V := ∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ + have hV := magnetic_centered_second_bounds μ hM bM + have h4 : (∫ x, (M x - ∫ y, M y ∂μ) ^ 4 ∂μ) ≤ 4 * V := by + calc + _ ≤ ∫ x, 4 * (M x - ∫ y, M y ∂μ) ^ 2 ∂μ := by + apply integral_mono (magnetic_centered_power_integrable μ hM bM 4) + ((magnetic_centered_power_integrable μ hM bM 2).const_mul 4) + intro x + have hs := pow_le_pow_left₀ (abs_nonneg _) (magnetic_centered_spin_bound μ bM x) 2 + rw [sq_abs] at hs + nlinarith [sq_nonneg (M x - ∫ y, M y ∂μ), + mul_nonneg (sq_nonneg (M x - ∫ y, M y ∂μ)) (sub_nonneg.mpr hs)] + _ = _ := integral_const_mul _ _ + have h4pos : 0 ≤ ∫ x, (M x - ∫ y, M y ∂μ) ^ 4 ∂μ := + integral_nonneg fun _ => by positivity + calc + _ ≤ |∫ x, (M x - ∫ y, M y ∂μ) ^ 4 ∂μ| + |3 * V ^ 2| := abs_sub _ _ + _ = (∫ x, (M x - ∫ y, M y ∂μ) ^ 4 ∂μ) + 3 * V ^ 2 := by + rw [abs_of_nonneg h4pos, abs_of_nonneg (by positivity)] + _ ≤ 7 * V := by dsimp only [V] at *; nlinarith + +lemma magnetic_weighted_centered_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M Q : ℝ → ℝ} (hM : Measurable M) (hQ : Measurable Q) + (bM : ∀ x, |M x| ≤ 1) {C : ℝ} (bQ : ∀ x, |Q x| ≤ C) + (hQpos : ∀ x, 0 ≤ Q x) : + |(∫ x, Q x * M x ∂μ) - (∫ x, Q x ∂μ) * (∫ x, M x ∂μ)| ≤ + 2 * ∫ x, Q x ∂μ := by + let m := ∫ x, M x ∂μ + have hi := magnetic_bounded_integrable μ hQ bQ + have hip : Integrable (fun x => Q x * M x) μ := + magnetic_bounded_integrable μ (hQ.mul hM) (fun x => by + rw [abs_mul] + exact (mul_le_mul_of_nonneg_left (bM x) (abs_nonneg _)).trans (by simpa using bQ x)) + have hic : Integrable (fun x => Q x * (M x - m)) μ := by + convert hip.sub (hi.mul_const m) using 1 + funext x + change Q x * (M x - m) = Q x * M x - Q x * m + ring + have he : (∫ x, Q x * M x ∂μ) - (∫ x, Q x ∂μ) * m = + ∫ x, Q x * (M x - m) ∂μ := by + rw [show (fun x => Q x * (M x - m)) = fun x => Q x * M x - Q x * m by + funext x; ring, integral_sub hip (hi.mul_const m), integral_mul_const] + change |(∫ x, Q x * M x ∂μ) - (∫ x, Q x ∂μ) * m| ≤ _ + rw [he] + calc + _ ≤ ∫ x, |Q x * (M x - m)| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ x, 2 * Q x ∂μ := by + apply integral_mono hic.abs (hi.const_mul 2) + intro x + change |Q x * (M x - m)| ≤ 2 * Q x + rw [abs_mul, abs_of_nonneg (hQpos x)] + have hb := mul_le_mul_of_nonneg_left (magnetic_centered_spin_bound μ bM x) (hQpos x) + dsimp only [m] + linarith + _ = _ := integral_const_mul _ _ + +lemma magnetic_nonnegative_spin_variance_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {Q : ℝ → ℝ} (hQ : Measurable Q) (hQpos : ∀ x, 0 ≤ Q x) (hQle : ∀ x, Q x ≤ 1) : + 0 ≤ (∫ x, (Q x) ^ 2 ∂μ) - (∫ x, Q x ∂μ) ^ 2 ∧ + (∫ x, (Q x) ^ 2 ∂μ) - (∫ x, Q x ∂μ) ^ 2 ≤ ∫ x, Q x ∂μ := by + have bQ : ∀ x, |Q x| ≤ 1 := fun x => by rw [abs_of_nonneg (hQpos x)]; exact hQle x + have hiQ := magnetic_bounded_integrable μ hQ bQ + have hiQ2 : Integrable (fun x => (Q x) ^ 2) μ := + magnetic_bounded_integrable μ (C := 1) (hQ.pow_const 2) (fun x => by + rw [abs_pow]; simpa only [one_pow] using pow_le_pow_left₀ (abs_nonneg _) (bQ x) 2) + constructor + · rw [← magnetic_centered_second μ hQ bQ] + exact integral_nonneg fun _ => sq_nonneg _ + · have hle : (∫ x, (Q x) ^ 2 ∂μ) ≤ ∫ x, Q x ∂μ := + integral_mono hiQ2 hiQ (fun x => by nlinarith [hQpos x, hQle x]) + linarith [sq_nonneg (∫ x, Q x ∂μ)] + +lemma magnetic_weighted_variance_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M Q : ℝ → ℝ} (hM : Measurable M) (hQ : Measurable Q) + (bM : ∀ x, |M x| ≤ 1) {C : ℝ} (bQ : ∀ x, |Q x| ≤ C) + (hQpos : ∀ x, 0 ≤ Q x) : + |(∫ x, Q x * (M x - ∫ y, M y ∂μ) ^ 2 ∂μ) - + (∫ x, Q x ∂μ) * (∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ)| ≤ + 5 * ∫ x, Q x ∂μ := by + let m := ∫ x, M x ∂μ + let q := ∫ x, Q x ∂μ + let V := ∫ x, (M x - m) ^ 2 ∂μ + have hq : 0 ≤ q := integral_nonneg hQpos + have hV := magnetic_centered_second_bounds μ hM bM + have hiQ := magnetic_bounded_integrable μ hQ bQ + have hib : ∀ x, |Q x * (M x - m) ^ 2| ≤ C * 4 := by + intro x + rw [abs_mul, abs_pow] + have hc : 0 ≤ C := (abs_nonneg _).trans (bQ 0) + have hs := pow_le_pow_left₀ (abs_nonneg _) (magnetic_centered_spin_bound μ bM x) 2 + exact mul_le_mul (bQ x) (by change |M x - ∫ y, M y ∂μ| ^ 2 ≤ 4; exact hs.trans_eq (by norm_num)) (by positivity) hc + have hi : Integrable (fun x => Q x * (M x - m) ^ 2) μ := + magnetic_bounded_integrable μ (hQ.mul ((hM.sub measurable_const).pow_const 2)) hib + have hip : 0 ≤ ∫ x, Q x * (M x - m) ^ 2 ∂μ := + integral_nonneg fun x => mul_nonneg (hQpos x) (sq_nonneg _) + have hi4 : (∫ x, Q x * (M x - m) ^ 2 ∂μ) ≤ 4 * q := by + calc + _ ≤ ∫ x, 4 * Q x ∂μ := by + apply integral_mono hi (hiQ.const_mul 4) + intro x + have hs := pow_le_pow_left₀ (abs_nonneg _) (magnetic_centered_spin_bound μ bM x) 2 + rw [sq_abs] at hs + dsimp only [m] + nlinarith [mul_nonneg (hQpos x) (sub_nonneg.mpr hs)] + _ = _ := integral_const_mul _ _ + change |(∫ x, Q x * (M x - m) ^ 2 ∂μ) - q * V| ≤ 5 * q + calc + _ ≤ |∫ x, Q x * (M x - m) ^ 2 ∂μ| + |q * V| := abs_sub _ _ + _ = (∫ x, Q x * (M x - m) ^ 2 ∂μ) + q * V := by + rw [abs_of_nonneg hip, abs_of_nonneg (mul_nonneg hq hV.1)] + _ ≤ _ := by nlinarith [mul_nonneg hq (sub_nonneg.mpr hV.2)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticClosedLipschitz.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticClosedLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..af7920b96507e1a191306ae6dffbd6dc5906a195 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticClosedLipschitz.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeightLipschitz +import OAI.Probability.InvariantIsing.Magnetic.MagneticBoundaryContinuity + +namespace OAI + +/-! The uniform height modulus extends to zero and repeated covariance +levels by the actual strict regularization and its bias continuity. -/ + +noncomputable section +open Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem constrainedFieldValue_height_lipschitz (h : FieldStep) {s : ℝ} (hs : |s| < 1) + (r : Fin (h.depth + 1) → ℝ) (hr0 : ∀ i, 0 ≤ r i) (hrmono : Monotone r) : + |constrainedFieldValue (fieldWithHeights h r hr0 hrmono) s - constrainedFieldValue h s| ≤ + (1 / 2 : ℝ) * ∑ i, (h.cut i.succ - h.cut i.castSucc) * |r i - h.height i| := by + let k := fieldWithHeights h r hr0 hrmono + have hc : Continuous (fun t => + |constrainedFieldValue (fieldRegularized k t) s - + constrainedFieldValue (fieldRegularized h t) s|) := + ((continuous_fieldRegularizedConstrainedValue k hs).sub + (continuous_fieldRegularizedConstrainedValue h hs)).abs + have hineq (t : ℝ) (ht : t ∈ Ioc (0 : ℝ) 1) : + |constrainedFieldValue (fieldRegularized k t) s - + constrainedFieldValue (fieldRegularized h t) s| ≤ + (1 / 2 : ℝ) * ∑ i, (h.cut i.succ - h.cut i.castSucc) * |r i - h.height i| := by + have hh : (fieldRegularized h t).height ∈ fieldStrictHeightCone h.depth := + fieldRegularized_strict h ht + have hk : (fieldRegularized k t).height ∈ fieldStrictHeightCone h.depth := + fieldRegularized_strict k ht + have heh : fieldStepOfStrictHeights h (fieldRegularized h t).height hh = + fieldRegularized h t := by + unfold fieldStepOfStrictHeights fieldRegularized fieldWithHeights + rfl + have hek : fieldStepOfStrictHeights h (fieldRegularized k t).height hk = + fieldRegularized k t := by + unfold fieldStepOfStrictHeights fieldRegularized fieldWithHeights k + rfl + have hi := constrainedFieldValue_strict_lipschitz h hs _ _ hh hk + rw [congrArg (fun v : FieldStep => constrainedFieldValue v s) heh, + congrArg (fun v : FieldStep => constrainedFieldValue v s) hek] at hi + have he (i : Fin (h.depth + 1)) : (fieldRegularized k t).height i - + (fieldRegularized h t).height i = r i - h.height i := by + change (r i + fieldHeightEpsilon t * (i.val + 1 : ℕ)) - + (h.height i + fieldHeightEpsilon t * (i.val + 1 : ℕ)) = _ + ring + simpa only [he] using hi + have hevent : ∀ᶠ t in 𝓝[>] (0 : ℝ), + |constrainedFieldValue (fieldRegularized k t) s - + constrainedFieldValue (fieldRegularized h t) s| ≤ + (1 / 2 : ℝ) * ∑ i, (h.cut i.succ - h.cut i.castSucc) * |r i - h.height i| := by + filter_upwards [self_mem_nhdsWithin, + mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds (show (0 : ℝ) < 1 by norm_num))] with t ht ht1 + exact hineq t ⟨ht, ht1.le⟩ + have hh := le_of_tendsto_of_tendsto + (hc.continuousAt.tendsto.mono_left nhdsWithin_le_nhds) tendsto_const_nhds hevent + simpa only [fieldRegularized_zero, k] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticClosedSupport.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticClosedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b82252a2694d452f41115975dbc05effc9005db --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticClosedSupport.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeightSupport +import OAI.Probability.InvariantIsing.Magnetic.MagneticBoundaryContinuity + +namespace OAI + +/-! The constrained supporting inequality on the full nonnegative height +cone, including repeated levels and zero variances. -/ + +noncomputable section +open Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem magneticHeight_support (h : FieldStep) {m : ℝ} (hm : |m| < 1) + (r : Fin (h.depth + 1) → ℝ) (hr0 : ∀ i, 0 ≤ r i) (hrmono : Monotone r) : + constrainedFieldValue (fieldWithHeights h r hr0 hrmono) m ≤ constrainedFieldValue h m + + ∑ i, (-(h.cut i.succ - h.cut i.castSucc) / 2 * magneticFieldLevel h m i) * + (r i - h.height i) := by + let k := fieldWithHeights h r hr0 hrmono + have hleft := continuous_fieldRegularizedConstrainedValue k hm + have hright : Continuous (fun t => constrainedFieldValue (fieldRegularized h t) m + + ∑ i : Fin (h.depth + 1), (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldRegularized h t) m i) * (r i - h.height i)) := by + have hval := continuous_fieldRegularizedConstrainedValue h hm + have hB := continuous_fieldRegularizedMagneticLevel h hm + fun_prop + have hineq : ∀ t ∈ Ioc (0 : ℝ) 1, + constrainedFieldValue (fieldRegularized k t) m ≤ + constrainedFieldValue (fieldRegularized h t) m + + ∑ i : Fin (h.depth + 1), (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldRegularized h t) m i) * (r i - h.height i) := by + intro t ht + have hh : (fieldRegularized h t).height ∈ fieldStrictHeightCone h.depth := + fieldRegularized_strict h ht + have hk : (fieldRegularized k t).height ∈ fieldStrictHeightCone h.depth := + fieldRegularized_strict k ht + have heh : fieldStepOfStrictHeights h (fieldRegularized h t).height hh = + fieldRegularized h t := by + unfold fieldStepOfStrictHeights fieldRegularized fieldWithHeights + rfl + have hek : fieldStepOfStrictHeights h (fieldRegularized k t).height hk = + fieldRegularized k t := by + unfold fieldStepOfStrictHeights fieldRegularized fieldWithHeights k + rfl + have hi := magneticHeight_support_strict h hm _ _ hh hk + have hevh := congrArg (fun q : FieldStep => constrainedFieldValue q m) heh + have hevk := congrArg (fun q : FieldStep => constrainedFieldValue q m) hek + rw [hevh, hevk] at hi + have hd (i : Fin (h.depth + 1)) : (fieldRegularized k t).height i - + (fieldRegularized h t).height i = r i - h.height i := by + change (r i + fieldHeightEpsilon t * (i.val + 1 : ℕ)) - + (h.height i + fieldHeightEpsilon t * (i.val + 1 : ℕ)) = _ + ring + have heBsum : + (∑ i : Fin (h.depth + 1), (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h (fieldRegularized h t).height hh) m i) * + ((fieldRegularized k t).height i - (fieldRegularized h t).height i)) = + ∑ i : Fin (h.depth + 1), (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldRegularized h t) m i) * + (r i - h.height i) := by + apply Finset.sum_congr rfl + intro i _ + rw [magneticFieldLevel_congr heh m i i rfl, hd] + exact hi.trans_eq (congrArg + (fun a : ℝ => constrainedFieldValue (fieldRegularized h t) m + a) heBsum) + have hevent : ∀ᶠ t in 𝓝[>] (0 : ℝ), + constrainedFieldValue (fieldRegularized k t) m ≤ + constrainedFieldValue (fieldRegularized h t) m + + ∑ i : Fin (h.depth + 1), (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldRegularized h t) m i) * (r i - h.height i) := by + filter_upwards [self_mem_nhdsWithin, + mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds (show (0 : ℝ) < 1 by norm_num))] with t ht ht1 + exact hineq t ⟨ht, ht1.le⟩ + have hh := le_of_tendsto_of_tendsto + (hleft.continuousAt.tendsto.mono_left nhdsWithin_le_nhds) + (hright.continuousAt.tendsto.mono_left nhdsWithin_le_nhds) hevent + have hz (i : Fin (h.depth + 1)) := + magneticFieldLevel_congr (fieldRegularized_zero h) m i i rfl + simp_rw [hz] at hh + simpa only [fieldRegularized_zero, k] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCoerciveRoot.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCoerciveRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ec4b85dd84ad841d8f0e5a9659dbf9c33d07bc3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCoerciveRoot.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldMinimum + +namespace OAI + +/-! The one-dimensional coercivity argument needed for the inverse mean +of a finite Gaussian slab. -/ + +noncomputable section +open Set Filter +open scoped Topology + +namespace InvariantIsing + +lemma exists_mean_root_of_linear_lower {F M : ℝ → ℝ} {C s : ℝ} + (dF : ∀ z, HasDerivAt F (M z) z) (hl : ∀ z, |z| - C ≤ F z) + (hs : |s| < 1) : ∃ z, M z = s := by + let δ := 1 - |s| + let R := (|F 0| + |C| + 1) / δ + have hδ : 0 < δ := sub_pos.mpr hs + have hR : 0 ≤ R := div_nonneg (by positivity) hδ.le + have he : δ * R = |F 0| + |C| + 1 := by + dsimp only [R] + field_simp + let G := fun z => F z - z * s + have hG : Continuous G := by + apply continuous_iff_continuousAt.mpr + intro z + exact ((dF z).sub ((hasDerivAt_id z).mul_const s)).continuousAt + have hlow (z : ℝ) : δ * |z| - C ≤ G z := by + have hz : z * s ≤ |z| * |s| := by + simpa only [abs_mul] using le_abs_self (z * s) + dsimp only [δ, G] + nlinarith [hl z] + obtain ⟨b, hb, hmin⟩ := isCompact_Icc.exists_isMinOn + (show (Icc (-R) R).Nonempty from ⟨0, by constructor <;> linarith⟩) hG.continuousOn + have hglobal (c : ℝ) : G b ≤ G c := by + by_cases hc : c ∈ Icc (-R) R + · exact hmin hc + have hcr : R ≤ |c| := by + by_contra hn + have hlt : |c| < R := lt_of_not_ge hn + exact hc ⟨(abs_lt.mp hlt).1.le, (abs_lt.mp hlt).2.le⟩ + have hlarge : F 0 ≤ G c := by + have hm := mul_le_mul_of_nonneg_left hcr hδ.le + have hcabs := le_abs_self C + have hfabs := le_abs_self (F 0) + linarith [hlow c] + have hz := hmin (show (0 : ℝ) ∈ Icc (-R) R by constructor <;> linarith) + change G b ≤ G 0 at hz + have hz' : G b ≤ F 0 := by + simpa only [G, zero_mul, sub_zero] using hz + exact hz'.trans hlarge + have hlocal : IsLocalMin G b := Eventually.of_forall hglobal + have hd : HasDerivAt G (M b - s) b := by + convert (dF b).sub ((hasDerivAt_id b).mul_const s) using 1 + · rfl + · simp only [one_mul] + exact ⟨b, sub_eq_zero.mp (hlocal.hasDerivAt_eq_zero hd)⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCompactPartition.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCompactPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bfa2b159a3c7d8d4f827a06eb33de442aed7769 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCompactPartition.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactPartitionPressure +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpectralPartition + +namespace OAI + +/-! Positive spectral partition bounds for the finite-field pressure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Classical Function +namespace InvariantIsing.CompactSpectralPartition +variable {ν : ProbabilityMeasure ℝ} {a b δ : ℝ} (D : CompactSpectralPartition ν a b δ) + +lemma field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ V, rotatedPressure (fun i => D.lowerValue (eig N i)) + (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) atTop + (𝓝 (finiteMagneticFunctional (measureR (D.law : Measure ℝ) D.edge) γ c).toReal) ∧ + Tendsto (fun N => ∫ V, rotatedPressure (fun i => D.upperValue (eig N i)) + (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) atTop + (𝓝 (finiteMagneticFunctional (measureR (D.law : Measure ℝ) D.edge) γ c).toReal) := by + have hh (fallback : D.Positive) := spectral_partition_field_pressure_tendsto hhaar hgauss hpub μ eig ν hweak + D.cells (spectralBallCell_cover _) (spectralBallCell_disjoint _) + (spectralBallCell_measurable _ (fun _ => measurableSet_ball)) + (spectralBallCell_null_boundary (ν : Measure ℝ) _ D.null_boundary) + D.value fallback D.upper D.le_upper group γ c hγ hγsum hgroup + exact ⟨hh D.lower,hh D.upper⟩ + +lemma mean_field_pressure_bounds {N : ℕ} (hN : 0 < N) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] (eig : Fin N → ℝ) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hab : a ≤ b) (heig : ∀ i, eig i∈Icc a b) (c : Fin N → ℝ) : + (∫ V, rotatedPressure (fun i => D.lowerValue (eig i)) + (matrixRotation V⁻¹) c ∂μ)-δ/2 ≤ + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂μ ∧ + (∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂μ) ≤ + (∫ V, rotatedPressure (fun i => D.upperValue (eig i)) + (matrixRotation V⁻¹) c ∂μ)+δ/2 := by + let K := max |a| |b| + have hbound (x : ℝ) (hx : x∈Icc a b) : |x| ≤ K := by + apply abs_le.mpr + constructor + · have hh := neg_abs_le a + have hk : |a| ≤ K := le_max_left _ _ + linarith [hx.1] + · exact hx.2.trans ((le_abs_self b).trans (le_max_right _ _)) + exact cavity_meanPressure_squeeze hN μ eig (fun i => D.lowerValue (eig i)) + (fun i => D.upperValue (eig i)) c δ K + (fun i => hbound _ (heig i)) + (fun i => hbound _ (D.rounded_mem hab (eig i)).1) + (fun i => hbound _ (D.rounded_mem hab (eig i)).2) + (fun i => (D.rounding_bounds ha hb _ (heig i)).1) + (fun i => (D.rounding_bounds ha hb _ (heig i)).2) + +end InvariantIsing.CompactSpectralPartition + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCompactSpectrum.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCompactSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..60c71e07f0de6f71264fe4fe47fe33c788150cce --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCompactSpectrum.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCompactPartition +import OAI.Probability.InvariantIsing.Magnetic.MagneticPartitionContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralApproximationSqueeze + +namespace OAI + +/-! The finite external-field formula for an arbitrary compact spectral law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem compact_spectral_field_pressure_tendsto_of_mem + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (heig : ∀ N i, eig N i∈Icc a b) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) := by + let δ := fun k : ℕ => (1 : ℝ)/(k+1) + let D (k : ℕ) : CompactSpectralPartition ν a b (δ k) := Classical.choice + (exists_compact_spectral_partition ν a b (δ k) hcompact hbound (by dsimp [δ]; positivity)) + have hab : a ≤ b := (hbound ha).2 + have hδ : Tendsto δ atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ) + have hL := compact_partition_magnetic_tendsto ν a b δ D hab ha hb hbound hδ γ c + (fun a => (hγ a).le) hγsum + apply spectral_approximation_squeeze _ + (fun k N => ∫ V, rotatedPressure (fun i => (D k).lowerValue (eig N i)) + (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) + (fun k N => ∫ V, rotatedPressure (fun i => (D k).upperValue (eig N i)) + (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) + (fun k => (finiteMagneticFunctional (measureR ((D k).law : Measure ℝ) (D k).edge) γ c).toReal) + δ _ hL hδ + (fun k => ((D k).field_pressure_tendsto hhaar hgauss hpub μ eig hweak group γ c hγ hγsum hgroup).1) + (fun k => ((D k).field_pressure_tendsto hhaar hgauss hpub μ eig hweak group γ c hγ hγsum hgroup).2) + intro k + filter_upwards [eventually_ge_atTop 1] with N hN + exact (D k).mean_field_pressure_bounds (by omega) (μ N) (eig N) ha hb hab (heig N) (fun i => c (group N i)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedPressureLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedPressureLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..ddd3e7035624e1facce004e8639c236f643257eb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedPressureLower.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticPhysicalIncrementLower +import OAI.Probability.InvariantIsing.Cavity.ConsecutivePhysicalIncrement + +namespace OAI + +/-! Physical constrained pressures inherit the magnetic variational lower +bound from the proved block increment, with actual minimizing perturbations. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_physical_constrained_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ ε > 0, ∀ᶠ j in atTop, + let q := m*N r-N r+N r+3 + let M := (q+j)*N r + let g := cavityRationalLabel (by omega : 0 < m) (spec r) (hspec r) M + L-ε ≤ ∫ V, restrictedRotatedPressure + (consecutiveBlockConstraint (N r) (q+j) (spinGroupSlice (group r) (k r))) + (fun i => lam (g i)) (matrixRotation V⁻¹) (fun _ => 0) ∂μ M := by + let ν := cavityOrientedFamily μ + have hν M : (ν M).IsMulLeftInvariant := cavityOrientedFamily_leftInvariant μ M + let g := fun r M => cavityRationalLabel (by omega : 0 < m) (spec r) (hspec r) M + let eig := fun r M i => lam (g r M i) + let I := fun r M => cavitySpectralGroup (g r M) + let C := fun r => spinGroupSlice (group r) (k r) + have hC r : (C r).Nonempty := spinGroupSlice_nonempty (group r) (k r) (hk r) + let q := fun r => m*N r-N r+N r+3 + choose U V hU hV hmin using fun r => repeated_prior_minimizing_sequence hhaar hgauss + ν hν (eig r) (fun _ _ => 0) (I r) (C r) (hC r) + let u : (r j : ℕ) → Fin (cavityRationalSize (N r) (m*N r-N r) j) → ℝ := + fun r j => U r (j+q r) + let v := fun r j => V r (j+q r) + have hum r j i : u r j i ∈ Set.Icc (1 : ℝ) 2 := hU r (j+q r) i + have hvm r j a : v r j a ∈ Set.Icc (1 : ℝ) 2 := hV r (j+q r) a + have hmm r j (u' : Fin (cavityRationalSize (N r) (m*N r-N r) j) → ℝ) (v' : Fin m → ℝ) + (hu' : ∀ i, u' i ∈ Set.Icc (1 : ℝ) 2) (hv' : ∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) : + rationalConstrainedObjective hm (hN r) (spec r) (hspec r) (C r) (hC r) μ lam j (u r j) (v r j) ≤ + rationalConstrainedObjective hm (hN r) (spec r) (hspec r) (C r) (hC r) μ lam j u' v' := by + have hdim : 3 ≤ (j+q r)*N r := cavityRationalSize_ge_three (N r) (m*N r-N r) j (hN r) + have hh := hmin r (j+q r) hdim u' v' hu' hv' + have hp : 0 < (j+q r)*N r := by omega + simpa only [repeatedPriorObjective, rationalConstrainedObjective, ν, + cavityOrientedFamily_pos μ hp, eig, I, g, u, v, q, cavityRationalSize] using hh + obtain ⟨r,hr⟩ := magnetic_rational_increment_eventually_lower hhaar hgauss hpub hm + ρ lam hρ hsum hK hlam amax hmax μ N hN hNlim spec hsp hspec hρspec + group k hk γ mag hγ hγsum hcount hs hmag hc u v hum hvm hmm L hL + have hdim j : 3 ≤ (q r+j)*N r := by + simpa only [q, cavityRationalSize, Nat.add_comm] using cavityRationalSize_ge_three (N r) (m*N r-N r) j (hN r) + have hh := consecutive_envelope_pressure_lower hhaar hgauss (hN r) (by simpa using hdim 0) + ν (fun M _ => hν M) (eig r) (fun _ _ => 0) (I r) (C r) (hC r) + (fun j => U r (q r+j)) (fun j => V r (q r+j)) + (fun j => hU r (q r+j)) (fun j => hV r (q r+j)) + (fun j => hmin r (q r+j) (hdim j)) L (by + intro ε hε + filter_upwards [hr] with j hj + have he := consecutive_prior_increment_physical hhaar hgauss μ (eig r) (I r) (C r) (hC r) + (fun j => U r (q r+j)) (fun j => V r (q r+j)) (fun j => hU r (q r+j)) j (hdim j) + rw [he] + have hi : rationalRestrictedIncrement hm (hN r) (spec r) (hspec r) (C r) (hC r) μ lam (u r) (v r) j = + repeatedRotationIncrement μ (eig r) (I r) (C r) (hC r) (q r+j) (U r (q r+j)) (V r (q r+j)) := by + change repeatedRotationIncrement μ (eig r) (I r) (C r) (hC r) (j+q r) + (U r (j+q r)) (V r (j+q r)) = _ + rw [Nat.add_comm j (q r)] + rw [hi] at hj + have hj' := (sub_le_self L hε.le).trans hj.le + simpa only [div_eq_mul_inv, mul_comm] using hj') + refine ⟨r,?_⟩ + intro ε hε + filter_upwards [hh ε hε] with j hj + dsimp only [ν] at hj + rw [cavityOrientedFamily_pos μ (by have := hdim j; omega), cavity_oriented_restricted_pressure] at hj + exact hj + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..2eb54ab2b16d27f919a077a21f958acf38ca66bf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedUpper.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpectrumStepUpper +import OAI.Probability.InvariantIsing.Magnetic.MagneticTrialApproximation +import OAI.Probability.InvariantIsing.Core.TrialGridApproximation + +namespace OAI + +/-! Manuscript Proposition up:bound, in the equivalent eventual-epsilon +form against every trial of finite entropy. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_magneticPressure_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) (count : ℕ → A → ℕ) + (hcount : ∀ k a, count k a ≤ spinGroupSize (group k) a) + (γ mag : A → ℝ) (hmag : ∀ a, |mag a|<1) + (hc : ∀ k a, (count k a : ℝ)=spinGroupSize (group k) a*((1+mag a)/2)) + (hgroup : ∀ k a, (spinGroupSize (group k) a : ℝ)=N k*γ a) + (p : OverlapPath) (S : ℝ) (hS : magneticEntropyFunctional γ mag p ≤ (S : EReal)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (spinGroupSlice (group k) (count k)) (eig k) (specialRotation U) (fun _ => 0) ∂μ k) ≤ + S + spectralFunctional (finiteR ρ lam hρpos hρsum) p + ε := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + have hgrid := lowerGridPath_spectral_tendsto ρ lam hρpos hρsum p + obtain ⟨n, hn⟩ := (hgrid.eventually (gt_mem_nhds + (show spectralFunctional (finiteR ρ lam hρpos hρsum) p < + spectralFunctional (finiteR ρ lam hρpos hρsum) p + ε / 2 by linarith))).exists + have hup := finiteSpectrum_restrictedPressure_step_upper hhaar hgauss N hN hNlim m n + μ hμinv (fun k => spinGroupSlice (group k) (count k)) + (fun k => spinGroupSlice_nonempty (group k) (count k) (hcount k)) eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + (uniformCut n) (uniformCut_strict n) (uniformCut_zero n) (uniformCut_last n) + (lowerGridPath p n) + (fun i => (1 - 1 / (n + 1 : ℕ)) * p ((i.val : ℝ) / (n + 1 : ℕ))) + (lowerGridPath_on_cell p n) (1 / (n + 1 : ℕ)) (by positivity) + (ae_of_all _ (lowerGridPath_below_one p n)) S + (fun k a ha => constrainedBlockValue_entropy_bound (by have := hN k; omega) + (group k) (count k) (hcount k) mag γ hmag (hc k) (hgroup k) + (lowerGridPath p n) S ((lowerGridPath_magneticEntropy_le γ mag p n).trans hS) + (contactFieldStep (uniformCut n) (uniformCut_strict n) (uniformCut_zero n) (uniformCut_last n) a ha)) (ε / 2) hhalf + filter_upwards [hup] with k hk + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedVariationalUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedVariationalUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f91b9462dc049c39bc873f83aa8517b001b332c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConstrainedVariationalUpper.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticConstrainedUpper +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds + +namespace OAI + +/-! The finite-spectrum pressure upper bound after taking the path infimum, +under Haar and Gaussian concentration hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_magneticPressure_variational_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) (count : ℕ → A → ℕ) + (hcount : ∀ k a, count k a ≤ spinGroupSize (group k) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a|<1) + (hc : ∀ k a, (count k a : ℝ)=spinGroupSize (group k) a*((1+mag a)/2)) + (hgroup : ∀ k a, (spinGroupSize (group k) a : ℝ)=N k*γ a) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (spinGroupSlice (group k) (count k)) (eig k) (specialRotation U) (fun _ => 0) ∂μ k) ≤ + (magneticVariationalFunctional (finiteR ρ lam hρpos hρsum) γ mag).toReal + ε := by + intro ε hε + obtain ⟨p, S, hS, hp⟩ := exists_finiteMagneticEntropy_trial + ρ lam hρpos hρsum γ mag hγ hγsum (fun a => (hmag a).le) (half_pos hε) + have hup := finiteSpectrum_magneticPressure_upper hhaar hgauss N hN hNlim m μ hμinv + eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ group count hcount γ mag hmag hc hgroup p S hS.le (ε / 2) (half_pos hε) + filter_upwards [hup] with k hk + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationClosed.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationClosed.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd1141ad0827b9d897e063b98da4a39cc6cbfe80 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationClosed.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareSlabConvex +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatContinuity + +namespace OAI + +/-! The finite square continuation on the closed spin interval. Its two +endpoint values are one, and its time derivatives there vanish. -/ + +noncomputable section +open Filter Set IsingPerceptron +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSlabContinuation_bounds (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + magneticScalarSlabContinuation L A ζ v s ∈ Icc (s ^ 2) 1 := by + have hb := magneticScalarSlabContinuation_sandwich L hL A hA ζ v (magneticScalarSlabBias L ζ v s) + have hr := magneticScalarSlabMean_bias L hL hζ hs v + change (magneticScalarSlabJet L hL ζ v).value (magneticScalarSlabBias L ζ v s) = s at hr + rw [hr] at hb + rwa [magneticScalarSlabContinuation_eq_jet L hL A ζ v s] + +lemma magneticScalarSlabContinuation_continuousAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ : ℝ} (hζ : 0 ≤ ζ) {p : ℝ × ℝ} (hp : |p.2| < 1) : + ContinuousAt (fun q : ℝ × ℝ => magneticScalarSlabContinuation L A ζ q.1 q.2) p := by + let F := fieldScalarValue L (fun y => Real.log (Real.cosh y)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hcF : Continuous F := continuous_iff_continuousAt.mpr fun z => + (hasDerivAt_fieldScalarLogCosh L hL z).continuousAt + have hc := (continuous_magneticHeatMean A F hcF hF.2 ζ).continuousAt + (x := (p.1, magneticScalarSlabBias L ζ p.1 p.2)) + have hb := magneticScalarSlabBias_continuousAt_joint L hL (v := p.1) hζ hp + exact hc.comp' (f := fun q : ℝ × ℝ => (q.1, magneticScalarSlabBias L ζ q.1 q.2)) + (x := p) (continuousAt_fst.prodMk hb) + +def closedMagneticContinuation (L : List (ℝ × ℝ≥0)) + (A : MagneticContinuationJet) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarSlabContinuation L A ζ p.1 p.2 else 1 + +lemma closedMagneticContinuation_bounds (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (p : ℝ × ℝ) (hp : p.2 ∈ Icc (-1 : ℝ) 1) : + closedMagneticContinuation L A ζ p ∈ Icc (p.2 ^ 2) 1 := by + by_cases hs : |p.2| < 1 + · simpa only [closedMagneticContinuation, hs, ite_true] using + magneticScalarSlabContinuation_bounds L hL A hA hζ hs p.1 + · have hsq : p.2 ^ 2 ≤ 1 := by nlinarith [hp.1, hp.2] + simpa only [closedMagneticContinuation, hs, ite_false, Set.mem_Icc, le_refl, and_true] using hsq + +lemma continuousOn_closedMagneticContinuation (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) : + ContinuousOn (closedMagneticContinuation L A ζ) (univ ×ˢ Icc (-1 : ℝ) 1) := by + intro p hp + by_cases hs : |p.2| < 1 + · have he : closedMagneticContinuation L A ζ =ᶠ[𝓝 p] + (fun q : ℝ × ℝ => magneticScalarSlabContinuation L A ζ q.1 q.2) := by + filter_upwards [(isOpen_lt continuous_snd.abs continuous_const).mem_nhds hs] with q hq + exact ite_eq_left hq + exact ((magneticScalarSlabContinuation_continuousAt L hL A hζ hs).congr_of_eventuallyEq he).continuousWithinAt + · have hps : |p.2| = 1 := le_antisymm (abs_le.mpr hp.2) (le_of_not_gt hs) + have hps2 : p.2 ^ 2 = 1 := by nlinarith [sq_abs p.2] + change Tendsto (closedMagneticContinuation L A ζ) (𝓝[univ ×ˢ Icc (-1 : ℝ) 1] p) (𝓝 _) + rw [show closedMagneticContinuation L A ζ p = 1 from ite_eq_right hs] + have hlo : Tendsto (fun q : ℝ × ℝ => q.2 ^ 2) + (𝓝[univ ×ˢ Icc (-1 : ℝ) 1] p) (𝓝 (1 : ℝ)) := by + have hc : ContinuousWithinAt (fun q : ℝ × ℝ => q.2 ^ 2) + (univ ×ˢ Icc (-1 : ℝ) 1) p := by fun_prop + simpa only [ContinuousWithinAt, hps2] using hc + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlo tendsto_const_nhds + · filter_upwards [self_mem_nhdsWithin] with q hq + exact (closedMagneticContinuation_bounds L hL A hA hζ q hq.2).1 + · filter_upwards [self_mem_nhdsWithin] with q hq + exact (closedMagneticContinuation_bounds L hL A hA hζ q hq.2).2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationClosedPDE.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationClosedPDE.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0775e3758ee4d33629a81353c44a36f3cdce0ed --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationClosedPDE.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationClosed + +namespace OAI + +/-! Closed-interval derivative data for finite inverse-coordinate square +continuations, with a zero second derivative chosen at the endpoints. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def closedMagneticContinuationSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ : ℝ) + (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarSlabContinuationSlope L hL A ζ p.1 p.2 else 0 + +def closedMagneticContinuationSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ : ℝ) + (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarSlabContinuationSecond L hL A ζ p.1 p.2 else 0 + +def closedMagneticContinuationTime (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ : ℝ) + (p : ℝ × ℝ) : ℝ := + (closedMagneticScalarCurvature L hL ζ p) ^ 2 / 2 * closedMagneticContinuationSecond L hL A ζ p + +lemma closedMagneticContinuation_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => closedMagneticContinuation L A ζ (v, u)) + (closedMagneticContinuationSlope L hL A ζ (v, s)) s := by + have he : (fun u => closedMagneticContinuation L A ζ (v, u)) =ᶠ[𝓝 s] + magneticScalarSlabContinuation L A ζ v := by + filter_upwards [(isOpen_lt continuous_id.abs continuous_const).mem_nhds hs] with u hu + exact ite_eq_left hu + simpa only [closedMagneticContinuationSlope, hs, ite_true] using + (magneticScalarSlabContinuation_hasDerivAt_spin L hL A hζ hs v).congr_of_eventuallyEq he + +lemma closedMagneticContinuationSlope_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => closedMagneticContinuationSlope L hL A ζ (v, u)) + (closedMagneticContinuationSecond L hL A ζ (v, s)) s := by + have he : (fun u => closedMagneticContinuationSlope L hL A ζ (v, u)) =ᶠ[𝓝 s] + magneticScalarSlabContinuationSlope L hL A ζ v := by + filter_upwards [(isOpen_lt continuous_id.abs continuous_const).mem_nhds hs] with u hu + exact ite_eq_left hu + simpa only [closedMagneticContinuationSecond, hs, ite_true] using + (magneticScalarSlabContinuationSlope_hasDerivAt L hL A hζ hs v).congr_of_eventuallyEq he + +lemma closedMagneticContinuation_hasDerivAt_time (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ v : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (s : ℝ) : + HasDerivAt (fun t => closedMagneticContinuation L A ζ (t, s)) + (closedMagneticContinuationTime L hL A ζ (v, s)) v := by + by_cases hs : |s| < 1 + · have hd := magneticScalarSlabContinuation_PDE L hL A hζ hs hv + rw [magneticScalarSlabContinuation_second_deriv L hL A hζ hs v] at hd + simpa only [closedMagneticContinuation, closedMagneticContinuationTime, + closedMagneticScalarCurvature, closedMagneticContinuationSecond, hs, ite_true] using hd + · simpa only [closedMagneticContinuation, closedMagneticContinuationTime, + closedMagneticScalarCurvature, closedMagneticContinuationSecond, hs, ite_false, + zero_pow (by norm_num : 2 ≠ 0), zero_div, zero_mul] using (hasDerivAt_const v (1 : ℝ)) + +lemma closedMagneticSquareContinuationSecond_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (i : Fin (L.length + 1)) {ζ v : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hv : 0 ≤ v) (s : ℝ) : + 0 ≤ closedMagneticContinuationSecond L hL + (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ (v, s) := by + by_cases hs : |s| < 1 + · simpa only [closedMagneticContinuationSecond, hs, ite_true] using + magneticScalarSlabSquare_second_nonneg L hL hL1 i hζ hζ1 hv hs + · simp only [closedMagneticContinuationSecond, hs, ite_false, le_refl] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..36687d8d593c351badd0a9828ca6c1d2537e924b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationComparison.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicComparison + +namespace OAI + +/-! Increasing the inverse-curvature coefficient increases a convex +continued observable. This is the comparison used for conditional square means. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem magnetic_continuation_coefficient_comparison {T : ℝ} (hT : 0 ≤ T) + (U Ut Ux Uxx V Vt Vx Vxx a b : ℝ × ℝ → ℝ) + (hU : ContinuousOn U (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hV : ContinuousOn V (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hinit : ∀ s ∈ Icc (-1 : ℝ) 1, U (0, s) ≤ V (0, s)) + (hUt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ s ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun r => U (r, s)) (Ut (t, s)) (Iic t) t) + (hVt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ s ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun r => V (r, s)) (Vt (t, s)) (Iic t) t) + (hUx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun r => U (t, r)) (Ux (t, s)) s) + (hVx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun r => V (t, r)) (Vx (t, s)) s) + (hUxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun r => Ux (t, r)) (Uxx (t, s)) s) + (hVxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun r => Vx (t, r)) (Vxx (t, s)) s) + (ha : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ a p) + (hab : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, a p ≤ b p) + (hconvex : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ Uxx p) + (hbdy : ∀ t ∈ Icc (0 : ℝ) T, b (t, -1) = 0 ∧ b (t, 1) = 0) + (hPU : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, Ut p = a p ^ 2 / 2 * Uxx p) + (hPV : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, Vt p = b p ^ 2 / 2 * Vxx p) : + ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, U p ≤ V p := by + have hn := parabolic_minimum_nonneg_bounded (M := 0) hT + (fun p => V p - U p) (fun p => Vt p - Ut p) + (fun p => Vx p - Ux p) (fun p => Vxx p - Uxx p) + (fun p => b p ^ 2 / 2) (fun _ => 0) (fun _ => 0) + (hV.sub hU) (fun s hs => sub_nonneg.mpr (hinit s hs)) + (fun t ht s hs => (hVt t ht s hs).sub (hUt t ht s hs)) + (fun t ht s hs => (hVx t ht s hs).sub (hUx t ht s hs)) + (fun t ht s hs => (hVxx t ht s hs).sub (hUxx t ht s hs)) + (fun p hp => div_nonneg (sq_nonneg _) (by norm_num)) + (fun p hp => le_refl 0) + (fun t ht => by + rcases hbdy t ht with ⟨hl, hr⟩ + simp only [hl, hr, zero_pow (by norm_num : 2 ≠ 0), zero_div, and_self]) ?_ + · intro p hp + exact sub_nonneg.mp (hn p hp) + · intro p hp + have hp' : p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1 := ⟨⟨hp.1.1.le, hp.1.2⟩, hp.2⟩ + have hs : 0 ≤ (b p) ^ 2 - (a p) ^ 2 := by + have ha0 := ha p hp' + have hab' := hab p hp' + nlinarith + have hmul := mul_nonneg hs (hconvex p hp) + rw [hPV p hp, hPU p hp] + simp only [zero_mul, add_zero] + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccd1313176b42570325029a6157488508a50e2cc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationEndpoint.lean @@ -0,0 +1,141 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarContinuation +import OAI.Probability.InvariantIsing.Magnetic.MagneticBiasEndpoint + +namespace OAI + +/-! Endpoint decay for the literal finite-field conditional square levels. +The inverse-coordinate weighted curvature has zero boundary values, proved +from bounded ordinary derivatives rather than an asymptotic expansion. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma fieldBiasMean_tendsto_one (h : FieldStep) : + Tendsto (fieldBiasMean h) atTop (𝓝 (1 : ℝ)) := by + apply tendsto_order.2 + constructor + · intro l hl + let s := (max l (-1) + 1) / 2 + have hm : max l (-1 : ℝ) < 1 := max_lt hl (by norm_num) + have hs : |s| < 1 := by + apply abs_lt.mpr + dsimp only [s] + constructor <;> linarith [le_max_right l (-1 : ℝ)] + have hls : l < s := by dsimp only [s]; linarith [le_max_left l (-1 : ℝ)] + filter_upwards [eventually_gt_atTop (magneticBias h s)] with b hb + have hh := strictMono_fieldBiasMean h hb + rw [fieldBiasMean_magneticBias h hs] at hh + exact hls.trans hh + · intro u hu + exact Eventually.of_forall fun b => (fieldBiasMean_strict_bounds h b).2.trans hu + +lemma fieldBiasMean_tendsto_neg_one (h : FieldStep) : + Tendsto (fieldBiasMean h) atBot (𝓝 (-1 : ℝ)) := by + apply tendsto_order.2 + constructor + · intro l hl + exact Eventually.of_forall fun b => hl.trans (fieldBiasMean_strict_bounds h b).1 + · intro u hu + let s := (min u 1 - 1) / 2 + have hm : (-1 : ℝ) < min u 1 := lt_min hu (by norm_num) + have hs : |s| < 1 := by + apply abs_lt.mpr + dsimp only [s] + constructor <;> linarith [min_le_right u (1 : ℝ)] + have hsu : s < u := by dsimp only [s]; linarith [min_le_left u (1 : ℝ)] + filter_upwards [eventually_lt_atBot (magneticBias h s)] with b hb + have hh := strictMono_fieldBiasMean h hb + rw [fieldBiasMean_magneticBias h hs] at hh + exact hh.trans hsu + +lemma magneticLevelAtBias_tendsto_one (h : FieldStep) (i : Fin (h.depth + 1)) : + Tendsto (fun b => magneticLevelAtBias h b i) atTop (𝓝 (1 : ℝ)) := by + have hs := (fieldBiasMean_tendsto_one h).pow 2 + norm_num only [one_pow] at hs + exact hs.squeeze tendsto_const_nhds (fun b => fieldBiasMean_sq_le_magneticLevel h b i) + (fun b => (magneticLevelAtBias_mem_unit h b i).2) + +lemma magneticLevelAtBias_tendsto_neg_one (h : FieldStep) (i : Fin (h.depth + 1)) : + Tendsto (fun b => magneticLevelAtBias h b i) atBot (𝓝 (1 : ℝ)) := by + have hs := (fieldBiasMean_tendsto_neg_one h).pow 2 + norm_num only [neg_sq, one_pow] at hs + exact hs.squeeze tendsto_const_nhds (fun b => fieldBiasMean_sq_le_magneticLevel h b i) + (fun b => (magneticLevelAtBias_mem_unit h b i).2) + +lemma magnetic_derivative_tendsto_zero_atBot {F G D : ℝ → ℝ} {c L : ℝ} + (hL : 0 ≤ L) (hF : ∀ x, HasDerivAt F (G x) x) + (hG : ∀ x, HasDerivAt G (D x) x) (hD : ∀ x, |D x| ≤ L) + (hlimit : Tendsto F atBot (𝓝 c)) : Tendsto G atBot (𝓝 0) := by + have hdF (x : ℝ) : HasDerivAt (fun y => F (-y)) (-G (-x)) x := by + convert (hF (-x)).comp x (hasDerivAt_neg x) using 1 <;> first | rfl | simp + have hdG (x : ℝ) : HasDerivAt (fun y => -G (-y)) (D (-x)) x := by + convert ((hG (-x)).comp x (hasDerivAt_neg x)).neg using 1 <;> first | rfl | simp + have hh := magnetic_derivative_tendsto_zero hL hdF hdG (fun x => hD (-x)) + (hlimit.comp tendsto_neg_atTop_atBot) + simpa only [Function.comp_def, neg_neg, neg_zero] using hh.neg.comp tendsto_neg_atBot_atTop + +lemma MagneticContinuationJet.first_tendsto_zero (J : MagneticContinuationJet) + {c : ℝ} (hJ : Tendsto J.value atTop (𝓝 c)) : Tendsto J.first atTop (𝓝 0) := by + obtain ⟨L, hL, bL⟩ := J.bSecond + exact magnetic_derivative_tendsto_zero hL J.dValue J.dFirst bL hJ + +lemma MagneticContinuationJet.second_tendsto_zero (J : MagneticContinuationJet) + {c : ℝ} (hJ : Tendsto J.value atTop (𝓝 c)) : Tendsto J.second atTop (𝓝 0) := by + obtain ⟨L, hL, bL⟩ := J.bThird + exact magnetic_derivative_tendsto_zero hL J.dFirst J.dSecond bL (J.first_tendsto_zero hJ) + +lemma MagneticContinuationJet.first_tendsto_zero_atBot (J : MagneticContinuationJet) + {c : ℝ} (hJ : Tendsto J.value atBot (𝓝 c)) : Tendsto J.first atBot (𝓝 0) := by + obtain ⟨L, hL, bL⟩ := J.bSecond + exact magnetic_derivative_tendsto_zero_atBot hL J.dValue J.dFirst bL hJ + +lemma MagneticContinuationJet.second_tendsto_zero_atBot (J : MagneticContinuationJet) + {c : ℝ} (hJ : Tendsto J.value atBot (𝓝 c)) : Tendsto J.second atBot (𝓝 0) := by + obtain ⟨L, hL, bL⟩ := J.bThird + exact magnetic_derivative_tendsto_zero_atBot hL J.dFirst J.dSecond bL + (J.first_tendsto_zero_atBot hJ) + +lemma magneticContinuation_weighted_endpoint (h : FieldStep) (i : Fin (h.depth + 1)) + (J : MagneticContinuationJet) (hJ : J.value = fun b => magneticLevelAtBias h b i) : + Tendsto (fun s => J.second (magneticBias h s) - J.first (magneticBias h s) * + (fieldBiasThird h (magneticBias h s) / fieldBiasCurvature h (magneticBias h s))) + (𝓝[<] (1 : ℝ)) (𝓝 0) := by + obtain ⟨L, hL, bL⟩ := J.bSecond + obtain ⟨K, hK, bK⟩ := J.bThird + have hv : Tendsto J.value atTop (𝓝 (1 : ℝ)) := by + rw [hJ] + exact magneticLevelAtBias_tendsto_one h i + exact (magnetic_weighted_continuation_limit h hL hK J.dValue J.dFirst J.dSecond bL bK hv).comp + (magneticBias_tendsto_one h) + +lemma magneticContinuation_weighted_neg_endpoint (h : FieldStep) (i : Fin (h.depth + 1)) + (J : MagneticContinuationJet) (hJ : J.value = fun b => magneticLevelAtBias h b i) : + Tendsto (fun s => J.second (magneticBias h s) - J.first (magneticBias h s) * + (fieldBiasThird h (magneticBias h s) / fieldBiasCurvature h (magneticBias h s))) + (𝓝[>] (-1 : ℝ)) (𝓝 0) := by + have hv : Tendsto J.value atBot (𝓝 (1 : ℝ)) := by + rw [hJ] + exact magneticLevelAtBias_tendsto_neg_one h i + have hg := J.first_tendsto_zero_atBot hv + have hd := J.second_tendsto_zero_atBot hv + have hp : Tendsto (fun b => J.first b * (fieldBiasThird h b / fieldBiasCurvature h b)) + atBot (𝓝 0) := by + apply squeeze_zero_norm (fun b => ?_) + (show Tendsto (fun b => |J.first b| * magneticThirdRatioCap (scalarFieldIncrements h)) + atBot (𝓝 0) by + simpa only [Real.norm_eq_abs, abs_zero, zero_mul] using + hg.norm.mul_const (magneticThirdRatioCap (scalarFieldIncrements h))) + rw [Real.norm_eq_abs, abs_mul] + exact mul_le_mul_of_nonneg_left (fieldBiasThird_quotient_bound h b) (abs_nonneg _) + have hh := hd.sub hp + simp only [sub_zero] at hh + exact hh.comp (magneticBias_tendsto_neg_one h) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationGenerator.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationGenerator.lean new file mode 100644 index 0000000000000000000000000000000000000000..aefd93d25fedba872178df124ff0d56571155d0a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationGenerator.lean @@ -0,0 +1,143 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGaussianCovariance +import OAI.Probability.InvariantIsing.Fields.FieldSpinLinear + +namespace OAI + +/-! The exact heat generator of the scalar continuation. Integration by +parts removes the apparent inverse square-root singularity from the +positive-variance differential. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticGaussianGenerator (ζ v : ℝ) (F M Q A B C : ℝ → ℝ) (z : ℝ) : ℝ := + let T := fun f => gaussianTiltAverage v ζ F f z + T C / 2 + ζ * T (fun y => B y * M y) + + ζ / 2 * (T (fun y => A y * Q y) - T A * T Q) + + ζ ^ 2 / 2 * (T (fun y => A y * (M y) ^ 2) - T A * T (fun y => (M y) ^ 2)) + +lemma magneticGaussianTimeTwo_eq_generator (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + magneticGaussianTime ζ v F P.value A.value A.first z = + magneticGaussianGenerator ζ v F P.value P.first A.value A.first A.second z := by + let r := Real.sqrt v + let ν := (gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u)) + obtain ⟨KM, _, bM⟩ := P.bValue + obtain ⟨KQ, _, bQ⟩ := P.bFirst + obtain ⟨KA, hKA, bA⟩ := A.bValue + obtain ⟨KB, hKB, bB⟩ := A.bFirst + obtain ⟨KC, _, bC⟩ := A.bSecond + have hr : r ≠ 0 := (Real.sqrt_pos.mpr hv).ne' + have bAM (y : ℝ) : |A.value y * P.value y| ≤ KA * KM := by + rw [abs_mul] + exact mul_le_mul (bA y) (bM y) (abs_nonneg _) hKA + have bBM (y : ℝ) : |A.first y * P.value y| ≤ KB * KM := by + rw [abs_mul] + exact mul_le_mul (bB y) (bM y) (abs_nonneg _) hKB + have bAQ (y : ℝ) : |A.value y * P.first y| ≤ KA * KQ := by + rw [abs_mul] + exact mul_le_mul (bA y) (bQ y) (abs_nonneg _) hKA + have bdAM (y : ℝ) : |A.first y * P.value y + A.value y * P.first y| ≤ + KB * KM + KA * KQ := (abs_add_le _ _).trans (add_le_add (bBM y) (bAQ y)) + have iBM : Integrable (fun u => A.first (z + r * u) * P.value (z + r * u)) ν := + magnetic_tilted_shift_integrable hF hG (A.mFirst.mul P.mValue) bBM r ζ z + have iAQ : Integrable (fun u => A.value (z + r * u) * P.first (z + r * u)) ν := + magnetic_tilted_shift_integrable hF hG (A.mValue.mul P.mFirst) bAQ r ζ z + have hB := magnetic_tilted_scaled_test_ibp hF hG P.mValue A.mFirst A.mSecond + bM bB bC dF A.dFirst hr ζ z + have hM := magnetic_tilted_scaled_test_ibp hF hG P.mValue P.mValue P.mFirst + bM bM bQ dF P.dValue hr ζ z + have hAM := magnetic_tilted_scaled_test_ibp hF hG P.mValue + (A.mValue.mul P.mValue) ((A.mFirst.mul P.mValue).add (A.mValue.mul P.mFirst)) + bM bAM bdAM dF (fun y => (A.dValue y).mul (P.dValue y)) hr ζ z + dsimp only [Pi.mul_apply, Pi.add_apply] at hAM + have hAMleft : (∫ u, A.value (z + r * u) * + (P.value (z + r * u) * ((1 / (2 * r)) * u)) ∂ν) = + (∫ u, (A.value (z + r * u) * P.value (z + r * u)) * + ((1 / (2 * r)) * u) ∂ν) := by + congr 1 + funext u + ring + have hAMright : (∫ u, (A.value (z + r * u) * P.value (z + r * u)) * + P.value (z + r * u) ∂ν) = + ∫ u, A.value (z + r * u) * (P.value (z + r * u)) ^ 2 ∂ν := by + congr 1 + funext u + ring + have hMright : (∫ u, P.value (z + r * u) * P.value (z + r * u) ∂ν) = + ∫ u, (P.value (z + r * u)) ^ 2 ∂ν := by + congr 1 + funext u + ring + change magneticGaussianTime ζ v F P.value A.value A.first z = _ + dsimp only [magneticGaussianTime] + rw [hB, hAMleft, hAM, hM, hAMright, hMright, integral_add iBM iAQ] + dsimp only [magneticGaussianGenerator, gaussianTiltAverage] + ring + +lemma magneticContinuation_secondTwo_generator (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (ζ : ℝ) (v : ℝ≥0) (z : ℝ) : + magneticContinuationSecond ζ v F P.value P.first A.value A.first A.second z / 2 + + ζ * fieldSpinTransition ζ v F P.value z * + fieldTiltSpatial ζ v F P.value A.value A.first z = + (let T := fun f => fieldSpinTransition ζ v F f z + T A.second / 2 + ζ * T (fun y => A.first y * P.value y) + + ζ / 2 * (T (fun y => A.value y * P.first y) - T A.value * T P.first) + + ζ ^ 2 / 2 * (T (fun y => A.value y * (P.value y) ^ 2) - + T A.value * T (fun y => (P.value y) ^ 2))) := by + obtain ⟨KM, _, bM⟩ := P.bValue + obtain ⟨KQ, _, bQ⟩ := P.bFirst + obtain ⟨KA, hKA, bA⟩ := A.bValue + obtain ⟨KB, hKB, bB⟩ := A.bFirst + have bBM (y : ℝ) : |A.first y * P.value y| ≤ KB * KM := by + rw [abs_mul] + exact mul_le_mul (bB y) (bM y) (abs_nonneg _) hKB + have bAQ (y : ℝ) : |A.value y * P.first y| ≤ KA * KQ := by + rw [abs_mul] + exact mul_le_mul (bA y) (bQ y) (abs_nonneg _) hKA + have hadd := fieldSpinTransition_add ζ v hF hG (A.mFirst.mul P.mValue) + (A.mValue.mul P.mFirst) bBM bAQ z + change fieldSpinTransition ζ v F (fun y => A.first y * P.value y + A.value y * P.first y) z = + fieldSpinTransition ζ v F (fun y => A.first y * P.value y) z + + fieldSpinTransition ζ v F (fun y => A.value y * P.first y) z at hadd + have hassoc : (fun y => (A.value y * P.value y) * P.value y) = + (fun y => A.value y * (P.value y) ^ 2) := by + funext y + ring + have hsquare : (fun y => P.value y * P.value y) = (fun y => (P.value y) ^ 2) := by + funext y + ring + dsimp only [magneticContinuationSecond, fieldTiltSpatial] + rw [hadd, hassoc, hsquare] + ring + +lemma magneticGaussianTime_eq_generator (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + magneticGaussianTime ζ v F P.value A.value A.first z = + magneticGaussianGenerator ζ v F P.value P.first A.value A.first A.second z := by + exact magneticGaussianTimeTwo_eq_generator P A.toTwoJet F hF hG dF ζ hv z + +lemma magneticContinuation_second_generator (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (ζ : ℝ) (v : ℝ≥0) (z : ℝ) : + magneticContinuationSecond ζ v F P.value P.first A.value A.first A.second z / 2 + + ζ * fieldSpinTransition ζ v F P.value z * + fieldTiltSpatial ζ v F P.value A.value A.first z = + (let T := fun f => fieldSpinTransition ζ v F f z + T A.second / 2 + ζ * T (fun y => A.first y * P.value y) + + ζ / 2 * (T (fun y => A.value y * P.first y) - T A.value * T P.first) + + ζ ^ 2 / 2 * (T (fun y => A.value y * (P.value y) ^ 2) - + T A.value * T (fun y => (P.value y) ^ 2))) := by + exact magneticContinuation_secondTwo_generator P A.toTwoJet F hF hG ζ v z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationIBP.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationIBP.lean new file mode 100644 index 0000000000000000000000000000000000000000..752aa539711f4162bca09513b075114658ae9f9f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationIBP.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationEndpoint +import OAI.Probability.InvariantIsing.Fields.FieldGaussianIntegrability + +namespace OAI + +/-! Gaussian integration by parts for the bounded continuation test, +with the actual linearly growing scalar field as tilted potential. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magnetic_gaussian_tilted_test_ibp {F M A B : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hA : Measurable A) (hB : Measurable B) + {K C D : ℝ} (bM : ∀ x, |M x| ≤ K) (bA : ∀ x, |A x| ≤ C) + (bB : ∀ x, |B x| ≤ D) (dF : ∀ x, HasDerivAt F (M x) x) + (dA : ∀ x, HasDerivAt A (B x) x) (r ζ z : ℝ) : + (∫ u, u * A (z + r * u) + ∂(gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) = + r * (∫ u, B (z + r * u) + ζ * A (z + r * u) * M (z + r * u) + ∂(gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) := by + have hC : 0 ≤ C := (abs_nonneg _).trans (bA 0) + let U := fun u => F (z + r * u) + let V := fun u => Real.exp (ζ * U u) * A (z + r * u) + let DV := fun u => r * (Real.exp (ζ * U u) * + (B (z + r * u) + ζ * A (z + r * u) * M (z + r * u))) + have hUm : Measurable U := hF.comp (by fun_prop) + have hUg : HasLinearGrowth U := (hG.add_left z).scale_argument r + have hw := integrable_exp_of_linearGrowth (gaussianReal 0 1) + (gaussianReal_exponentialNormMoments 0 1) hUm hUg ζ + have bgen (x : ℝ) : |B x + ζ * A x * M x| ≤ D + |ζ| * C * K := by + refine (abs_add_le _ _).trans (add_le_add (bB x) ?_) + rw [abs_mul, abs_mul] + exact mul_le_mul (mul_le_mul_of_nonneg_left (bA x) (abs_nonneg ζ)) + (bM x) (abs_nonneg _) (mul_nonneg (abs_nonneg ζ) hC) + have hV : Integrable V (gaussianReal 0 1) := + hw.mul_bdd (hA.comp (by fun_prop)).aestronglyMeasurable + (Filter.Eventually.of_forall fun u => by + simpa only [Real.norm_eq_abs] using bA (z + r * u)) + have hDV : Integrable DV (gaussianReal 0 1) := by + apply Integrable.const_mul + exact hw.mul_bdd + ((hB.comp (by fun_prop)).add + (((hA.comp (by fun_prop)).const_mul ζ).mul (hM.comp (by fun_prop)))).aestronglyMeasurable + (Filter.Eventually.of_forall fun u => by + simpa only [Real.norm_eq_abs] using bgen (z + r * u)) + have hderiv (u : ℝ) : HasDerivAt V (DV u) u := by + have hs : HasDerivAt (fun x : ℝ => z + r * x) r u := by + convert ((hasDerivAt_id u).const_mul r).const_add z using 1 <;> first | rfl | simp + have hf : HasDerivAt (fun x => F (z + r * x)) (M (z + r * u) * r) u := + (dF (z + r * u)).comp u hs + have ha : HasDerivAt (fun x => A (z + r * x)) (B (z + r * u) * r) u := + (dA (z + r * u)).comp u hs + convert ((hf.const_mul ζ).exp).mul ha using 1 + dsimp only [V, DV, U] + ring + have hlinear : HasLinearGrowth (fun u => u * A (z + r * u)) := by + refine ⟨0, C, le_rfl, hC, fun u => ?_⟩ + rw [abs_mul, Real.norm_eq_abs, zero_add] + simpa only [mul_comm] using mul_le_mul_of_nonneg_left (bA (z + r * u)) (abs_nonneg u) + have hUV : Integrable (fun u => u * V u) (gaussianReal 0 1) := by + convert field_exp_mul_linear_integrable 1 0 ζ hUm hUg + (measurable_id.mul (hA.comp (by fun_prop))) hlinear using 1 + funext u + dsimp only [V, Pi.mul_apply, Function.comp_apply, id_eq] + ring + have hibp := gaussian_integration_by_parts hderiv hV hDV hUV + simp only [integral_tilted_eq_div] + have hn : (∫ u, Real.exp (ζ * F (z + r * u)) * (u * A (z + r * u)) + ∂gaussianReal 0 1) = + r * ∫ u, Real.exp (ζ * F (z + r * u)) * + (B (z + r * u) + ζ * A (z + r * u) * M (z + r * u)) ∂gaussianReal 0 1 := by + rw [← integral_const_mul] + convert hibp using 1 + congr 1 + funext u + dsimp only [V, DV, U] + ring + rw [hn] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationInverse.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b4f58b7440d684fe8c9d1749b6ea9871229d306 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationInverse.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationEndpoint + +namespace OAI + +/-! Ordinary continuation derivatives pulled back through the actual +optimizing bias. The weighted second derivative has zero boundary limits. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +def magneticContinuationPullback (h : FieldStep) (J : MagneticContinuationJet) (s : ℝ) : ℝ := + J.value (magneticBias h s) + +def magneticContinuationPullbackFirst (h : FieldStep) (J : MagneticContinuationJet) (s : ℝ) : ℝ := + J.first (magneticBias h s) / fieldBiasCurvature h (magneticBias h s) + +def magneticContinuationPullbackSecond (h : FieldStep) (J : MagneticContinuationJet) (s : ℝ) : ℝ := + J.second (magneticBias h s) / (fieldBiasCurvature h (magneticBias h s)) ^ 2 - + J.first (magneticBias h s) * fieldBiasThird h (magneticBias h s) / + (fieldBiasCurvature h (magneticBias h s)) ^ 3 + +lemma magneticContinuationPullback_hasDerivAt (h : FieldStep) (J : MagneticContinuationJet) + {s : ℝ} (hs : |s| < 1) : + HasDerivAt (magneticContinuationPullback h J) + (magneticContinuationPullbackFirst h J s) s := by + convert (J.dValue (magneticBias h s)).comp s (hasDerivAt_magneticBias h hs) using 1 + · rfl + · simp only [magneticContinuationPullbackFirst, div_eq_mul_inv] + +lemma magneticContinuationPullbackFirst_hasDerivAt (h : FieldStep) (J : MagneticContinuationJet) + {s : ℝ} (hs : |s| < 1) : + HasDerivAt (magneticContinuationPullbackFirst h J) + (magneticContinuationPullbackSecond h J s) s := by + have hZ : HasDerivAt (magneticBias h) (1 / fieldBiasCurvature h (magneticBias h s)) s := by + simpa only [one_div] using hasDerivAt_magneticBias h hs + exact inverse_mean_pullback_quotient (fieldBiasCurvature_pos h (magneticBias h s)).ne' + hZ rfl rfl (J.dFirst (magneticBias h s)) (hasDerivAt_fieldBiasCurvature h (magneticBias h s)) + +lemma magneticContinuationPullback_second_deriv (h : FieldStep) (J : MagneticContinuationJet) + {s : ℝ} (hs : |s| < 1) : + deriv (deriv (magneticContinuationPullback h J)) s = + magneticContinuationPullbackSecond h J s := by + have hh := magneticContinuationPullbackFirst_hasDerivAt h J hs + apply HasDerivAt.deriv + apply hh.congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2] with t ht + exact (magneticContinuationPullback_hasDerivAt h J (abs_lt.mpr ht)).deriv + +lemma magneticContinuation_weighted_second (h : FieldStep) (J : MagneticContinuationJet) (s : ℝ) : + (magneticCurvature h s) ^ 2 * magneticContinuationPullbackSecond h J s = + J.second (magneticBias h s) - J.first (magneticBias h s) * + (fieldBiasThird h (magneticBias h s) / fieldBiasCurvature h (magneticBias h s)) := by + unfold magneticCurvature magneticContinuationPullbackSecond + field_simp [(fieldBiasCurvature_pos h (magneticBias h s)).ne'] + +lemma magneticFieldLevel_weighted_second_endpoint (h : FieldStep) (i : Fin (h.depth + 1)) : + Tendsto (fun s => (magneticCurvature h s) ^ 2 * + deriv (deriv (fun t => magneticFieldLevel h t i)) s) + (𝓝[<] (1 : ℝ)) (𝓝 0) := by + obtain ⟨J, hJ⟩ := magneticLevelAtBias_has_bounded_jet h i + have hvalue : magneticContinuationPullback h J = fun t => magneticFieldLevel h t i := by + funext t + change J.value (magneticBias h t) = magneticLevelAtBias h (magneticBias h t) i + exact congrFun hJ (magneticBias h t) + apply (magneticContinuation_weighted_endpoint h i J hJ).congr' + have hN : ∀ᶠ s : ℝ in 𝓝[<] (1 : ℝ), -1 < s := + (show ∀ᶠ s : ℝ in 𝓝 (1 : ℝ), -1 < s from Ioi_mem_nhds (by norm_num)).filter_mono + nhdsWithin_le_nhds + filter_upwards [hN, self_mem_nhdsWithin] with s hs hs1 + rw [← hvalue, magneticContinuationPullback_second_deriv h J (abs_lt.mpr ⟨hs, hs1⟩)] + exact (magneticContinuation_weighted_second h J s).symm + +lemma magneticFieldLevel_weighted_second_neg_endpoint (h : FieldStep) (i : Fin (h.depth + 1)) : + Tendsto (fun s => (magneticCurvature h s) ^ 2 * + deriv (deriv (fun t => magneticFieldLevel h t i)) s) + (𝓝[>] (-1 : ℝ)) (𝓝 0) := by + obtain ⟨J, hJ⟩ := magneticLevelAtBias_has_bounded_jet h i + have hvalue : magneticContinuationPullback h J = fun t => magneticFieldLevel h t i := by + funext t + change J.value (magneticBias h t) = magneticLevelAtBias h (magneticBias h t) i + exact congrFun hJ (magneticBias h t) + apply (magneticContinuation_weighted_neg_endpoint h i J hJ).congr' + have hN : ∀ᶠ s : ℝ in 𝓝[>] (-1 : ℝ), s < 1 := + (show ∀ᶠ s : ℝ in 𝓝 (-1 : ℝ), s < 1 from Iio_mem_nhds (by norm_num)).filter_mono + nhdsWithin_le_nhds + filter_upwards [hN, self_mem_nhdsWithin] with s hs hs1 + rw [← hvalue, magneticContinuationPullback_second_deriv h J (abs_lt.mpr ⟨hs1, hs⟩)] + exact (magneticContinuation_weighted_second h J s).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationJet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..95237a11df138db9821fe4c9d5ca8a12ff0ee4d8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationJet.lean @@ -0,0 +1,116 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationRegular + +namespace OAI + +/-! A bounded third-order spatial jet for the finite Ising continuation. +Only the square and actual Gaussian transition operations are required. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +structure MagneticContinuationJet where + value : ℝ → ℝ + first : ℝ → ℝ + second : ℝ → ℝ + third : ℝ → ℝ + mValue : Measurable value + mFirst : Measurable first + mSecond : Measurable second + mThird : Measurable third + bValue : MagneticContinuationBound value + bFirst : MagneticContinuationBound first + bSecond : MagneticContinuationBound second + bThird : MagneticContinuationBound third + dValue : ∀ z, HasDerivAt value (first z) z + dFirst : ∀ z, HasDerivAt first (second z) z + dSecond : ∀ z, HasDerivAt second (third z) z + +namespace MagneticContinuationJet + +def square (A : MagneticContinuationJet) : MagneticContinuationJet where + value := fun z => (A.value z) ^ 2 + first := fun z => 2 * A.value z * A.first z + second := fun z => 2 * (A.first z) ^ 2 + 2 * A.value z * A.second z + third := fun z => 6 * A.first z * A.second z + 2 * A.value z * A.third z + mValue := A.mValue.pow_const 2 + mFirst := (measurable_const.mul A.mValue).mul A.mFirst + mSecond := (measurable_const.mul (A.mFirst.pow_const 2)).add + ((measurable_const.mul A.mValue).mul A.mSecond) + mThird := ((measurable_const.mul A.mFirst).mul A.mSecond).add + ((measurable_const.mul A.mValue).mul A.mThird) + bValue := by simpa only [pow_two] using A.bValue.mul A.bValue + bFirst := ((MagneticContinuationBound.const 2).mul A.bValue).mul A.bFirst + bSecond := by + have hs : MagneticContinuationBound (fun z => (A.first z) ^ 2) := by + simpa only [pow_two] using A.bFirst.mul A.bFirst + exact ((MagneticContinuationBound.const 2).mul hs).add + (((MagneticContinuationBound.const 2).mul A.bValue).mul A.bSecond) + bThird := (((MagneticContinuationBound.const 6).mul A.bFirst).mul A.bSecond).add + (((MagneticContinuationBound.const 2).mul A.bValue).mul A.bThird) + dValue := fun z => by + convert (A.dValue z).pow 2 using 1 + ring + dFirst := fun z => by + convert ((A.dValue z).const_mul 2).mul (A.dFirst z) using 1 + ring + dSecond := fun z => by + convert (((A.dFirst z).pow 2).const_mul 2).add + (((A.dValue z).const_mul 2).mul (A.dSecond z)) using 1 + ring + +def transition (A P : MagneticContinuationJet) (ζ : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : MagneticContinuationJet where + value := fieldSpinTransition ζ v F A.value + first := fieldTiltSpatial ζ v F P.value A.value A.first + second := magneticContinuationSecond ζ v F P.value P.first A.value A.first A.second + third := magneticContinuationThird ζ v F P.value P.first P.second + A.value A.first A.second A.third + mValue := measurable_fieldSpinTransition ζ v hF A.mValue + mFirst := measurable_fieldTiltSpatial ζ v hF P.mValue A.mValue A.mFirst + mSecond := measurable_magneticContinuationSecond ζ v hF P.mValue P.mFirst + A.mValue A.mFirst A.mSecond + mThird := measurable_magneticContinuationThird ζ v hF P.mValue P.mFirst P.mSecond + A.mValue A.mFirst A.mSecond A.mThird + bValue := A.bValue.transition ζ v hF hG + bFirst := MagneticContinuationBound.spatial ζ v hF hG P.bValue A.bValue A.bFirst + bSecond := magneticContinuationSecond_bounded ζ v hF hG P.bValue P.bFirst + A.bValue A.bFirst A.bSecond + bThird := magneticContinuationThird_bounded ζ v hF hG P.bValue P.bFirst P.bSecond + A.bValue A.bFirst A.bSecond A.bThird + dValue := fun z => by + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨L, hL, bL⟩ := A.bValue + obtain ⟨C, _, bC⟩ := A.bFirst + exact hasDerivAt_fieldSpinTransition ζ v hF hG P.mValue A.mValue A.mFirst + hK hL bK bL bC dF A.dValue z + dFirst := fun z => by + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨L, hL, bL⟩ := P.bFirst + obtain ⟨a, ha, ba⟩ := A.bValue + obtain ⟨b, hb, bb⟩ := A.bFirst + obtain ⟨c, _, bc⟩ := A.bSecond + exact hasDerivAt_magneticContinuationSecond ζ v hF hG P.mValue P.mFirst + A.mValue A.mFirst A.mSecond hK hL ha hb bK bL ba bb bc dF P.dValue + A.dValue A.dFirst z + dSecond := fun z => by + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨L, hL, bL⟩ := P.bFirst + obtain ⟨J, _, bJ⟩ := P.bSecond + obtain ⟨a, ha, ba⟩ := A.bValue + obtain ⟨b, hb, bb⟩ := A.bFirst + obtain ⟨c, hc, bc⟩ := A.bSecond + obtain ⟨d, _, bd⟩ := A.bThird + exact hasDerivAt_magneticContinuationThird ζ v hF hG P.mValue P.mFirst P.mSecond + A.mValue A.mFirst A.mSecond A.mThird hK hL ha hb hc bK bL bJ ba bb bc bd + dF P.dValue P.dFirst A.dValue A.dFirst A.dSecond z + +end MagneticContinuationJet +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationPDE.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationPDE.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f69202e06004160458f19ba2c15ab674c3d75db --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationPDE.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationGenerator +import OAI.Probability.InvariantIsing.Fields.FieldRealVariance + +namespace OAI + +/-! The actual bounded continuation solves the scalar heat equation with +the nonlinear backward-field drift. The first coordinate is the amount +of Gaussian variance already applied; reversing it gives the backward +time convention in the manuscript. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magneticGaussianSpaceTwo_eq (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (ζ v z : ℝ) : + magneticGaussianSpace ζ v F P.value A.value A.first z = + fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z := by + unfold magneticGaussianSpace fieldTiltSpatial + rw [field_gaussianTiltAverage_eq_transition v ζ hF A.mFirst, + field_gaussianTiltAverage_eq_transition v ζ (a := fun y => A.value y * P.value y) + hF (A.mValue.mul P.mValue), + field_gaussianTiltAverage_eq_transition v ζ hF A.mValue, + field_gaussianTiltAverage_eq_transition v ζ hF P.mValue] + +lemma magneticGaussianGeneratorTwo_eq (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (ζ v z : ℝ) : + magneticGaussianGenerator ζ v F P.value P.first A.value A.first A.second z = + magneticContinuationSecond ζ (Real.toNNReal v) F P.value P.first + A.value A.first A.second z / 2 + + ζ * fieldSpinTransition ζ (Real.toNNReal v) F P.value z * + fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z := by + rw [magneticContinuation_secondTwo_generator P A F hF hG] + dsimp only [magneticGaussianGenerator] + rw [field_gaussianTiltAverage_eq_transition v ζ hF A.mSecond, + field_gaussianTiltAverage_eq_transition v ζ (a := fun y => A.first y * P.value y) + hF (A.mFirst.mul P.mValue), + field_gaussianTiltAverage_eq_transition v ζ (a := fun y => A.value y * P.first y) + hF (A.mValue.mul P.mFirst), + field_gaussianTiltAverage_eq_transition v ζ hF A.mValue, + field_gaussianTiltAverage_eq_transition v ζ hF P.mFirst, + field_gaussianTiltAverage_eq_transition v ζ (a := fun y => A.value y * (P.value y) ^ 2) + hF (A.mValue.mul (P.mValue.pow_const 2)), + field_gaussianTiltAverage_eq_transition v ζ (a := fun y => (P.value y) ^ 2) + hF (P.mValue.pow_const 2)] + +theorem magneticGaussianAverageTwo_hasFDerivAt_generator (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F A.value q.2) + (pairLinear + (magneticContinuationSecond ζ (Real.toNNReal v) F P.value P.first + A.value A.first A.second z / 2 + + ζ * fieldSpinTransition ζ (Real.toNNReal v) F P.value z * + fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z) + (fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z)) (v, z) := by + have hd := magneticGaussianAverageTwo_hasFDerivAt P A F hF dF ζ hv z + rw [magneticGaussianAverageDifferentialTwo_eq_pair P A F hF hG, + magneticGaussianTimeTwo_eq_generator P A F hF hG dF ζ hv, + magneticGaussianGeneratorTwo_eq P A F hF hG, + magneticGaussianSpaceTwo_eq P A F hF] at hd + exact hd + +lemma magneticGaussianSpace_eq (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (ζ v z : ℝ) : + magneticGaussianSpace ζ v F P.value A.value A.first z = + fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z := by + exact magneticGaussianSpaceTwo_eq P A.toTwoJet F hF ζ v z + +lemma magneticGaussianGenerator_eq (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (ζ v z : ℝ) : + magneticGaussianGenerator ζ v F P.value P.first A.value A.first A.second z = + magneticContinuationSecond ζ (Real.toNNReal v) F P.value P.first + A.value A.first A.second z / 2 + + ζ * fieldSpinTransition ζ (Real.toNNReal v) F P.value z * + fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z := by + exact magneticGaussianGeneratorTwo_eq P A.toTwoJet F hF hG ζ v z + +theorem magneticGaussianAverage_hasFDerivAt_generator (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F A.value q.2) + (pairLinear + (magneticContinuationSecond ζ (Real.toNNReal v) F P.value P.first + A.value A.first A.second z / 2 + + ζ * fieldSpinTransition ζ (Real.toNNReal v) F P.value z * + fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z) + (fieldTiltSpatial ζ (Real.toNNReal v) F P.value A.value A.first z)) (v, z) := by + exact magneticGaussianAverageTwo_hasFDerivAt_generator P A.toTwoJet F hF hG dF ζ hv z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationRegular.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..45b689c5bbf88b44a73dd6de2d155b3bc710deff --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationRegular.lean @@ -0,0 +1,136 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationSpatial + +namespace OAI + +/-! Measurability and finite spatial derivative bounds for the actual +Gaussian continuation formulas through order three. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def MagneticContinuationBound (f : ℝ → ℝ) : Prop := + ∃ K : ℝ, 0 ≤ K ∧ ∀ x, |f x| ≤ K + +namespace MagneticContinuationBound + +lemma const (c : ℝ) : MagneticContinuationBound (fun _ => c) := + ⟨|c|, abs_nonneg _, fun _ => le_rfl⟩ + +lemma add {f g : ℝ → ℝ} (hf : MagneticContinuationBound f) + (hg : MagneticContinuationBound g) : MagneticContinuationBound (fun x => f x + g x) := by + obtain ⟨K, hK, bK⟩ := hf + obtain ⟨L, hL, bL⟩ := hg + exact ⟨K + L, add_nonneg hK hL, fun x => + (abs_add_le _ _).trans (add_le_add (bK x) (bL x))⟩ + +lemma sub {f g : ℝ → ℝ} (hf : MagneticContinuationBound f) + (hg : MagneticContinuationBound g) : MagneticContinuationBound (fun x => f x - g x) := by + obtain ⟨K, hK, bK⟩ := hf + obtain ⟨L, hL, bL⟩ := hg + exact ⟨K + L, add_nonneg hK hL, fun x => + (abs_sub _ _).trans (add_le_add (bK x) (bL x))⟩ + +lemma mul {f g : ℝ → ℝ} (hf : MagneticContinuationBound f) + (hg : MagneticContinuationBound g) : MagneticContinuationBound (fun x => f x * g x) := by + obtain ⟨K, hK, bK⟩ := hf + obtain ⟨L, hL, bL⟩ := hg + refine ⟨K * L, mul_nonneg hK hL, fun x => ?_⟩ + rw [abs_mul] + exact mul_le_mul (bK x) (bL x) (abs_nonneg _) hK + +lemma transition (ζ : ℝ) (v : ℝ≥0) {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : MagneticContinuationBound A) : + MagneticContinuationBound (fieldSpinTransition ζ v F A) := by + obtain ⟨K, hK, bK⟩ := hA + exact ⟨K, hK, fieldSpinTransition_bound ζ v hF hG bK⟩ + +lemma spatial (ζ : ℝ) (v : ℝ≥0) {F M A B : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : MagneticContinuationBound M) (hA : MagneticContinuationBound A) + (hB : MagneticContinuationBound B) : + MagneticContinuationBound (fieldTiltSpatial ζ v F M A B) := by + obtain ⟨K, hK, bK⟩ := hM + obtain ⟨L, hL, bL⟩ := hA + obtain ⟨C, hC, bC⟩ := hB + exact ⟨C + 2 * |ζ| * L * K, by positivity, + fieldSpinTransition_derivative_bound ζ v hF hG hK hL bK bL bC⟩ + +end MagneticContinuationBound + +lemma measurable_magneticContinuationSecond (ζ : ℝ) (v : ℝ≥0) + {F M Q A B C : ℝ → ℝ} (hF : Measurable F) + (hM : Measurable M) (hQ : Measurable Q) + (hA : Measurable A) (hB : Measurable B) (hC : Measurable C) : + Measurable (magneticContinuationSecond ζ v F M Q A B C) := by + have hS := measurable_fieldTiltSpatial ζ v hF hM hB hC + have hSA := measurable_fieldTiltSpatial ζ v hF hM hA hB + have hSM := measurable_fieldTiltSpatial ζ v hF hM hM hQ + have hSAM := measurable_fieldTiltSpatial ζ v hF hM (hA.mul hM) + ((hB.mul hM).add (hA.mul hQ)) + have hTA := measurable_fieldSpinTransition ζ v hF hA + have hTM := measurable_fieldSpinTransition ζ v hF hM + exact hS.add ((hSAM.sub ((hSA.mul hTM).add (hTA.mul hSM))).const_mul ζ) + +lemma magneticContinuationSecond_bounded (ζ : ℝ) (v : ℝ≥0) + {F M Q A B C : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : MagneticContinuationBound M) (hQ : MagneticContinuationBound Q) + (hA : MagneticContinuationBound A) (hB : MagneticContinuationBound B) + (hC : MagneticContinuationBound C) : + MagneticContinuationBound (magneticContinuationSecond ζ v F M Q A B C) := by + have T {A : ℝ → ℝ} (hA : MagneticContinuationBound A) := + MagneticContinuationBound.transition ζ v hF hG hA + have D {A B : ℝ → ℝ} (hA : MagneticContinuationBound A) (hB : MagneticContinuationBound B) := + MagneticContinuationBound.spatial ζ v hF hG hM hA hB + exact (D hB hC).add ((MagneticContinuationBound.const ζ).mul + ((D (hA.mul hM) ((hB.mul hM).add (hA.mul hQ))).sub + (((D hA hB).mul (T hM)).add ((T hA).mul (D hM hQ))))) + +lemma measurable_magneticContinuationThird (ζ : ℝ) (v : ℝ≥0) + {F M Q R A B C D : ℝ → ℝ} (hF : Measurable F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) + (hA : Measurable A) (hB : Measurable B) (hC : Measurable C) (hD : Measurable D) : + Measurable (magneticContinuationThird ζ v F M Q R A B C D) := by + have h1 := measurable_magneticContinuationSecond ζ v hF hM hQ hB hC hD + have h2 := measurable_magneticContinuationSecond ζ v hF hM hQ (hA.mul hM) + ((hB.mul hM).add (hA.mul hQ)) + (((hC.mul hM).add (((measurable_const (a := (2 : ℝ))).mul hB).mul hQ)).add (hA.mul hR)) + have h3 := measurable_magneticContinuationSecond ζ v hF hM hQ hA hB hC + have h4 := measurable_magneticContinuationSecond ζ v hF hM hQ hM hQ hR + have hTA := measurable_fieldSpinTransition ζ v hF hA + have hTM := measurable_fieldSpinTransition ζ v hF hM + have hSA := measurable_fieldTiltSpatial ζ v hF hM hA hB + have hSM := measurable_fieldTiltSpatial ζ v hF hM hM hQ + exact h1.add ((h2.sub (((h3.mul hTM).add + ((measurable_const.mul hSA).mul hSM)).add (hTA.mul h4))).const_mul ζ) + +lemma magneticContinuationThird_bounded (ζ : ℝ) (v : ℝ≥0) + {F M Q R A B C D : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : MagneticContinuationBound M) (hQ : MagneticContinuationBound Q) + (hR : MagneticContinuationBound R) (hA : MagneticContinuationBound A) + (hB : MagneticContinuationBound B) (hC : MagneticContinuationBound C) + (hD : MagneticContinuationBound D) : + MagneticContinuationBound (magneticContinuationThird ζ v F M Q R A B C D) := by + have T {A : ℝ → ℝ} (hA : MagneticContinuationBound A) := + MagneticContinuationBound.transition ζ v hF hG hA + have S {A B : ℝ → ℝ} (hA : MagneticContinuationBound A) (hB : MagneticContinuationBound B) := + MagneticContinuationBound.spatial ζ v hF hG hM hA hB + have D2 {A B C : ℝ → ℝ} (hA : MagneticContinuationBound A) + (hB : MagneticContinuationBound B) (hC : MagneticContinuationBound C) := + magneticContinuationSecond_bounded ζ v hF hG hM hQ hA hB hC + have hb2 := (hB.mul hM).add (hA.mul hQ) + have hb3 := ((hC.mul hM).add + (((MagneticContinuationBound.const 2).mul hB).mul hQ)).add (hA.mul hR) + exact (D2 hB hC hD).add ((MagneticContinuationBound.const ζ).mul + ((D2 (hA.mul hM) hb2 hb3).sub + ((((D2 hA hB hC).mul (T hM)).add + ((((MagneticContinuationBound.const 2).mul (S hA hB)).mul (S hM hQ)))).add + ((T hA).mul (D2 hM hQ hR))))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationSpatial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..606c6902ebe059057a0f6118f5534711a6418ec5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationSpatial.lean @@ -0,0 +1,135 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarFourth + +namespace OAI + +/-! Three spatial derivatives of a bounded continuation through a single +actual Gaussian transition. These are the derivatives needed to close the +inverse-coordinate continuation at the two mean-spin endpoints. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticContinuationSecond (ζ : ℝ) (v : ℝ≥0) + (F M Q A B C : ℝ → ℝ) (z : ℝ) : ℝ := + let T := fieldSpinTransition ζ v F + let D := fieldTiltSpatial ζ v F M + D B C z + ζ * (D (fun y => A y * M y) (fun y => B y * M y + A y * Q y) z - + (D A B z * T M z + T A z * D M Q z)) + +def magneticContinuationThird (ζ : ℝ) (v : ℝ≥0) + (F M Q R A B C D : ℝ → ℝ) (z : ℝ) : ℝ := + let T := fieldSpinTransition ζ v F + let S := fieldTiltSpatial ζ v F M + magneticContinuationSecond ζ v F M Q B C D z + ζ * + (magneticContinuationSecond ζ v F M Q + (fun y => A y * M y) (fun y => B y * M y + A y * Q y) + (fun y => C y * M y + 2 * B y * Q y + A y * R y) z - + (magneticContinuationSecond ζ v F M Q A B C z * T M z + + 2 * S A B z * S M Q z + + T A z * magneticContinuationSecond ζ v F M Q M Q R z)) + +lemma hasDerivAt_magneticContinuationSecond (ζ : ℝ) (v : ℝ≥0) + {F M Q A B C : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) + (hA : Measurable A) (hB : Measurable B) (hC : Measurable C) + {K L a b c : ℝ} (hK : 0 ≤ K) (_hL : 0 ≤ L) (ha : 0 ≤ a) (hb : 0 ≤ b) + (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ L) + (bA : ∀ y, |A y| ≤ a) (bB : ∀ y, |B y| ≤ b) (bC : ∀ y, |C y| ≤ c) + (dF : ∀ y, HasDerivAt F (M y) y) (dM : ∀ y, HasDerivAt M (Q y) y) + (dA : ∀ y, HasDerivAt A (B y) y) (dB : ∀ y, HasDerivAt B (C y) y) + (z : ℝ) : + HasDerivAt (fieldTiltSpatial ζ v F M A B) + (magneticContinuationSecond ζ v F M Q A B C z) z := by + have bAM : ∀ y, |A y * M y| ≤ a * K := by + intro y + rw [abs_mul] + exact mul_le_mul (bA y) (bM y) (abs_nonneg _) ha + have bAM' : ∀ y, |B y * M y + A y * Q y| ≤ b * K + a * L := by + intro y + refine (abs_add_le _ _).trans (add_le_add ?_ ?_) + · rw [abs_mul] + exact mul_le_mul (bB y) (bM y) (abs_nonneg _) hb + · rw [abs_mul] + exact mul_le_mul (bA y) (bQ y) (abs_nonneg _) ha + have htA := hasDerivAt_fieldSpinTransition ζ v hF hG hM hA hB hK ha bM bA bB dF dA z + have htB := hasDerivAt_fieldSpinTransition ζ v hF hG hM hB hC hK hb bM bB bC dF dB z + have htM := hasDerivAt_fieldSpinTransition ζ v hF hG hM hM hQ hK hK bM bM bQ dF dM z + have htAM := hasDerivAt_fieldSpinTransition ζ v hF hG hM (hA.mul hM) + ((hB.mul hM).add (hA.mul hQ)) hK (mul_nonneg ha hK) bM bAM bAM' + dF (fun y => (dA y).mul (dM y)) z + exact htB.add ((htAM.sub (htA.mul htM)).const_mul ζ) + +lemma hasDerivAt_magneticContinuationThird (ζ : ℝ) (v : ℝ≥0) + {F M Q R A B C D : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) + (hA : Measurable A) (hB : Measurable B) (hC : Measurable C) (hD : Measurable D) + {K L J a b c d : ℝ} (hK : 0 ≤ K) (hL : 0 ≤ L) + (ha : 0 ≤ a) (hb : 0 ≤ b) (hc : 0 ≤ c) + (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ L) (bR : ∀ y, |R y| ≤ J) + (bA : ∀ y, |A y| ≤ a) (bB : ∀ y, |B y| ≤ b) + (bC : ∀ y, |C y| ≤ c) (bD : ∀ y, |D y| ≤ d) + (dF : ∀ y, HasDerivAt F (M y) y) (dM : ∀ y, HasDerivAt M (Q y) y) + (dQ : ∀ y, HasDerivAt Q (R y) y) + (dA : ∀ y, HasDerivAt A (B y) y) (dB : ∀ y, HasDerivAt B (C y) y) + (dC : ∀ y, HasDerivAt C (D y) y) (z : ℝ) : + HasDerivAt (magneticContinuationSecond ζ v F M Q A B C) + (magneticContinuationThird ζ v F M Q R A B C D z) z := by + have bprod {U V : ℝ → ℝ} {u w : ℝ} (hu : 0 ≤ u) + (bu : ∀ y, |U y| ≤ u) (bv : ∀ y, |V y| ≤ w) (y : ℝ) : + |U y * V y| ≤ u * w := by + rw [abs_mul] + exact mul_le_mul (bu y) (bv y) (abs_nonneg _) hu + have bAM := bprod ha bA bM + have bAM' (y : ℝ) : |B y * M y + A y * Q y| ≤ b * K + a * L := + (abs_add_le _ _).trans (add_le_add (bprod hb bB bM y) (bprod ha bA bQ y)) + have bAM'' (y : ℝ) : |C y * M y + 2 * B y * Q y + A y * R y| ≤ + c * K + 2 * b * L + a * J := by + have h2 : |2 * B y * Q y| ≤ 2 * b * L := by + rw [show 2 * B y * Q y = 2 * (B y * Q y) by ring, abs_mul] + rw [abs_of_pos (by norm_num : (0 : ℝ) < 2)] + simpa only [mul_assoc] using + mul_le_mul_of_nonneg_left (bprod hb bB bQ y) (by norm_num : (0 : ℝ) ≤ 2) + exact (abs_add_le _ _).trans (add_le_add + ((abs_add_le _ _).trans (add_le_add (bprod hc bC bM y) h2)) (bprod ha bA bR y)) + have dAM (y : ℝ) : HasDerivAt (fun x => A x * M x) + (B y * M y + A y * Q y) y := (dA y).mul (dM y) + have dAM' (y : ℝ) : HasDerivAt (fun x => B x * M x + A x * Q x) + (C y * M y + 2 * B y * Q y + A y * R y) y := by + convert ((dB y).mul (dM y)).add ((dA y).mul (dQ y)) using 1 + ring + have hSA := hasDerivAt_magneticContinuationSecond ζ v hF hG hM hQ hA hB hC + hK hL ha hb bM bQ bA bB bC dF dM dA dB z + have hSB := hasDerivAt_magneticContinuationSecond ζ v hF hG hM hQ hB hC hD + hK hL hb hc bM bQ bB bC bD dF dM dB dC z + have hSM := hasDerivAt_magneticContinuationSecond ζ v hF hG hM hQ hM hQ hR + hK hL hK hL bM bQ bM bQ bR dF dM dM dQ z + have hSAM := hasDerivAt_magneticContinuationSecond ζ v hF hG hM hQ + (hA.mul hM) ((hB.mul hM).add (hA.mul hQ)) + (((hC.mul hM).add ((measurable_const.mul hB).mul hQ)).add (hA.mul hR)) + hK hL (mul_nonneg ha hK) (by positivity) bM bQ bAM bAM' bAM'' + dF dM dAM dAM' z + change HasDerivAt (fieldTiltSpatial ζ v F M (fun y => A y * M y) + (fun y => B y * M y + A y * Q y)) + (magneticContinuationSecond ζ v F M Q (fun y => A y * M y) + (fun y => B y * M y + A y * Q y) + (fun y => C y * M y + 2 * B y * Q y + A y * R y) z) z at hSAM + have hTA : HasDerivAt (fieldSpinTransition ζ v F A) + (fieldTiltSpatial ζ v F M A B z) z := + hasDerivAt_fieldSpinTransition ζ v hF hG hM hA hB hK ha bM bA bB dF dA z + have hTM : HasDerivAt (fieldSpinTransition ζ v F M) + (fieldTiltSpatial ζ v F M M Q z) z := + hasDerivAt_fieldSpinTransition ζ v hF hG hM hM hQ hK hK bM bM bQ dF dM z + have hh := hSB.add ((hSAM.sub ((hSA.mul hTM).add (hTA.mul hSM))).const_mul ζ) + convert hh using 1 + · rfl + · dsimp only [magneticContinuationThird] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationTime.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationTime.lean new file mode 100644 index 0000000000000000000000000000000000000000..665226a1d93e4a6c9f9b7b5deddeca0236721810 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationTime.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationTwoJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticStationaryFamily +import OAI.Probability.InvariantIsing.Fields.FieldAffineAverageDerivative + +namespace OAI + +/-! Joint variance/spatial differentiation of the actual scalar +continuation. The covariance differential is left as integrals here; +Gaussian integration by parts then identifies its time generator. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticGaussianAverageDifferential (ζ v : ℝ) (F M A B : ℝ → ℝ) (z : ℝ) : + (ℝ × ℝ) →L[ℝ] ℝ := + let ν := (gaussianReal 0 1).tilted (fun u => ζ * F (z + Real.sqrt v * u)) + let D := fun u => pairLinear + (M (z + Real.sqrt v * u) * ((1 / (2 * Real.sqrt v)) * u)) + (M (z + Real.sqrt v * u)) + (∫ u, pairLinear + (B (z + Real.sqrt v * u) * ((1 / (2 * Real.sqrt v)) * u)) + (B (z + Real.sqrt v * u)) + (ζ * A (z + Real.sqrt v * u)) • D u ∂ν) - + (∫ u, A (z + Real.sqrt v * u) ∂ν) • (∫ u, ζ • D u ∂ν) + +theorem magneticGaussianAverageTwo_hasFDerivAt (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (dF : ∀ z, HasDerivAt F (P.value z) z) + (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F A.value q.2) + (magneticGaussianAverageDifferential ζ v F P.value A.value A.first z) (v, z) := by + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨L, _, bL⟩ := P.bFirst + obtain ⟨CA, hCA, bCA⟩ := A.bValue + obtain ⟨CB, hCB, bCB⟩ := A.bFirst + let I := Ioo (v / 2) (v + 1) + let S := (magneticStationaryFamily I F P hF K L bK bL dF).toFieldSmoothFamily + let α : (ℝ × ℝ) → ℝ → ℝ := fun q u => A.value (q.2 + Real.sqrt q.1 * u) + let Dα : (ℝ × ℝ) → ℝ → (ℝ × ℝ) →L[ℝ] ℝ := fun q u => pairLinear + (A.first (q.2 + Real.sqrt q.1 * u) * ((1 / (2 * Real.sqrt q.1)) * u)) + (A.first (q.2 + Real.sqrt q.1 * u)) + let R := 1 / (2 * Real.sqrt (v / 2)) + have hR : 0 ≤ R := by dsimp only [R]; positivity + have hm : 0 < v / 2 := by linarith + have hbound (q : ℝ × ℝ) (hq : q.1 ∈ I) : + |1 / (2 * Real.sqrt q.1)| ≤ R := by + simpa only [abs_one] using abs_div_two_sqrt_le hm hq.1.le 1 + have hdα (q : ℝ × ℝ) (hq : q.1 ∈ I) (u : ℝ) : + HasFDerivAt (fun r => α r u) (Dα q u) q := by + have hb (p : ℝ × ℝ) (_ : p.1 ∈ I) : + HasFDerivAt (fun r : ℝ × ℝ => A.value r.2) (pairLinear 0 (A.first p.2)) p := by + convert (A.dValue p.2).hasFDerivAt.comp p hasFDerivAt_snd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro w + simp [pairLinear, mul_comm] + simpa only [zero_add, one_mul] using + affine_gaussian_shift_hasFDerivAt hb 0 1 u hq (by + dsimp only [I] at hq + linarith [hq.1]) + have hbα (q : ℝ × ℝ) (_ : q.1 ∈ I) (u : ℝ) : |α q u| ≤ CA * (1 + |u|) := by + exact (bCA _).trans (le_mul_of_one_le_right hCA (by linarith [abs_nonneg u])) + have hbDα (q : ℝ × ℝ) (hq : q.1 ∈ I) (u : ℝ) : + ‖Dα q u‖ ≤ (CB * (R + 1)) * (1 + |u|) ^ 2 := by + refine (norm_pairLinear_le _ _).trans ?_ + have hf : |A.first (q.2 + Real.sqrt q.1 * u) * ((1 / (2 * Real.sqrt q.1)) * u)| ≤ + CB * R * |u| := by + rw [abs_mul, abs_mul] + exact (mul_le_mul (bCB _) (mul_le_mul_of_nonneg_right (hbound q hq) (abs_nonneg u)) + (mul_nonneg (abs_nonneg _) (abs_nonneg _)) hCB).trans_eq (by ring) + have hg := bCB (q.2 + Real.sqrt q.1 * u) + have h1 : 1 ≤ (1 + |u|) ^ 2 := by nlinarith [abs_nonneg u] + have h2 : |u| ≤ (1 + |u|) ^ 2 := by nlinarith [sq_nonneg |u|, abs_nonneg u] + nlinarith [mul_le_mul_of_nonneg_left h1 hCB, + mul_le_mul_of_nonneg_left h2 (mul_nonneg hCB hR)] + have hp : (v, z) ∈ I ×ˢ univ := ⟨by dsimp only [I]; constructor <;> linarith, mem_univ z⟩ + have hh := S.affine_average_hasFDerivAt isOpen_Ioo α Dα 0 1 ζ hm + (fun t ht => by simpa only [zero_add, one_mul] using ht.1.le) + (fun t ht => by simpa only [zero_add, one_mul] using ht.2.le) + hCA (mul_nonneg hCB (by linarith : 0 ≤ R + 1)) + (fun q => A.mValue.comp (by fun_prop)) + (fun q => (measurable_pairLinear + (A.mFirst.comp (by fun_prop) |>.mul (by fun_prop)) + (A.mFirst.comp (by fun_prop))).aestronglyMeasurable) + hbα hbDα hdα hp.1 + simpa only [α, Dα, S, magneticStationaryFamily, FieldSmoothFamily.affineShift, + FieldSmoothFamily.affineDifferential, fieldAmplitudeSlope, zero_add, one_mul, + gaussianTiltAverage, magneticGaussianAverageDifferential] using hh + +theorem magneticGaussianAverage_hasFDerivAt (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (dF : ∀ z, HasDerivAt F (P.value z) z) + (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F A.value q.2) + (magneticGaussianAverageDifferential ζ v F P.value A.value A.first z) (v, z) := by + exact magneticGaussianAverageTwo_hasFDerivAt P A.toTwoJet F hF dF ζ hv z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationTwoJet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationTwoJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..d14d3fa9f46ca0788cecfa35fa19ef5f35778343 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticContinuationTwoJet.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationJet + +namespace OAI + +/-! The variance generator requires only two derivatives of its bounded +test. In particular it applies to the ordinary curvature without +requiring a fifth derivative of the finite scalar field. -/ + +noncomputable section +open MeasureTheory + +namespace InvariantIsing + +structure MagneticContinuationTwoJet where + value : ℝ → ℝ + first : ℝ → ℝ + second : ℝ → ℝ + mValue : Measurable value + mFirst : Measurable first + mSecond : Measurable second + bValue : MagneticContinuationBound value + bFirst : MagneticContinuationBound first + bSecond : MagneticContinuationBound second + dValue : ∀ z, HasDerivAt value (first z) z + dFirst : ∀ z, HasDerivAt first (second z) z + +def MagneticContinuationJet.toTwoJet (P : MagneticContinuationJet) : + MagneticContinuationTwoJet where + value := P.value + first := P.first + second := P.second + mValue := P.mValue + mFirst := P.mFirst + mSecond := P.mSecond + bValue := P.bValue + bFirst := P.bFirst + bSecond := P.bSecond + dValue := P.dValue + dFirst := P.dFirst + +def MagneticContinuationJet.slopeTwoJet (P : MagneticContinuationJet) : + MagneticContinuationTwoJet where + value := P.first + first := P.second + second := P.third + mValue := P.mFirst + mFirst := P.mSecond + mSecond := P.mThird + bValue := P.bFirst + bFirst := P.bSecond + bSecond := P.bThird + dValue := P.dFirst + dFirst := P.dSecond + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingFieldUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingFieldUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad82158a9484632fe6d6976150008cb4cf4105b1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingFieldUpper.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticConvergingVariationalUpper +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds +import OAI.Probability.InvariantIsing.Fields.SpinGroupFieldPressure +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureFluctuation + +namespace OAI + +/-! The finite-spectrum pressure upper bound after taking the path infimum, +under Haar and Gaussian concentration hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_magneticFieldPressure_converging_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) (count : ℕ → A → ℕ) + (hcount : ∀ k a, count k a ≤ spinGroupSize (group k) a) + (γs mags : ℕ → A → ℝ) (γ mag : A → ℝ) + (hγs : Tendsto γs atTop (𝓝 γ)) (hmags : Tendsto mags atTop (𝓝 mag)) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a|<1) + (hc : ∀ k a, (count k a : ℝ)=spinGroupSize (group k) a*((1+mags k a)/2)) + (hgroup : ∀ k a, (spinGroupSize (group k) a : ℝ)=N k*γs k a) (b : A → ℝ) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (spinGroupSlice (group k) (count k)) (eig k) (specialRotation U) (fun i => b (group k i)) ∂μ k) ≤ + (magneticVariationalFunctional (finiteR ρ lam hρpos hρsum) γ mag).toReal + + (∑ a, γ a*b a*mag a) + ε := by + intro ε hε + obtain ⟨B,hB,hfluc⟩ := haar_restrictedPressure_mean_fluctuation hhaar + have hf : Tendsto (fun k => ∑ a, γs k a*b a*mags k a) atTop + (𝓝 (∑ a, γ a*b a*mag a)) := by + apply tendsto_finsetSum + intro a _ + exact (((tendsto_pi_nhds.mp hγs) a).mul_const (b a)).mul ((tendsto_pi_nhds.mp hmags) a) + have hup := finiteSpectrum_magneticPressure_converging_variational_upper hhaar hgauss + N hN hNlim m μ hμinv eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + group count hcount γs mags γ mag hγs hmags hγ hγsum hmag hc hgroup (ε/2) (half_pos hε) + filter_upwards [hup, hf.eventually (Iio_mem_nhds (show (∑ a, γ a*b a*mag a)< + (∑ a, γ a*b a*mag a)+ε/2 by linarith))] with k hk hfk + rw [mean_restrictedRotatedPressure_group_field (by have := hN k; omega) (μ k) + (group k) (count k) (hcount k) (γs k) (mags k) b (hgroup k) (hc k) (eig k) + (hfluc (N k) (hN k) (μ k) inferInstance (hμinv k) _ + (spinGroupSlice_nonempty (group k) (count k) (hcount k)) (eig k) (fun _ => 0) K hK (heig k)).1] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..bec7524634a001a204f44d11b49a53f58a2d35e1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingUpper.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpectrumEntropyUpper +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupEntropyLimit +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupInterior +import OAI.Probability.InvariantIsing.Magnetic.MagneticTrialApproximation +import OAI.Probability.InvariantIsing.Core.TrialGridApproximation + +namespace OAI + +/-! Manuscript Proposition up:bound, in the equivalent eventual-epsilon +form against every trial of finite entropy. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_magneticPressure_converging_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) (count : ℕ → A → ℕ) + (hcount : ∀ k a, count k a ≤ spinGroupSize (group k) a) + (γs mags : ℕ → A → ℝ) (γ mag : A → ℝ) + (hγs : Tendsto γs atTop (𝓝 γ)) (hmags : Tendsto mags atTop (𝓝 mag)) + (hmag : ∀ a, |mag a|<1) + (hc : ∀ k a, (count k a : ℝ)=spinGroupSize (group k) a*((1+mags k a)/2)) + (hgroup : ∀ k a, (spinGroupSize (group k) a : ℝ)=N k*γs k a) + (p : OverlapPath) (S : ℝ) (hS : magneticEntropyFunctional γ mag p ≤ (S : EReal)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (spinGroupSlice (group k) (count k)) (eig k) (specialRotation U) (fun _ => 0) ∂μ k) ≤ + S + spectralFunctional (finiteR ρ lam hρpos hρsum) p + ε := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + have hgrid := lowerGridPath_spectral_tendsto ρ lam hρpos hρsum p + obtain ⟨n, hn⟩ := (hgrid.eventually (gt_mem_nhds + (show spectralFunctional (finiteR ρ lam hρpos hρsum) p < + spectralFunctional (finiteR ρ lam hρpos hρsum) p + ε / 2 by linarith))).exists + obtain ⟨r, hr, hmr, hmkr⟩ := exists_uniform_magnetization_radius mags mag hmags hmag + have hup := finiteSpectrum_restrictedPressure_entropy_upper hhaar hgauss N hN hNlim m n + μ hμinv (fun k => spinGroupSlice (group k) (count k)) + (fun k => spinGroupSlice_nonempty (group k) (count k) (hcount k)) eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + (uniformCut n) (uniformCut_strict n) (uniformCut_zero n) (uniformCut_last n) + (lowerGridPath p n) + (fun i => (1 - 1 / (n + 1 : ℕ)) * p ((i.val : ℝ) / (n + 1 : ℕ))) + (lowerGridPath_on_cell p n) (1 / (n + 1 : ℕ)) (by positivity) + (ae_of_all _ (lowerGridPath_below_one p n)) S + (magnetic_group_entropy_limit N (fun k => by have := hN k; omega) + group count hcount γs mags γ mag hγs hmags hr hmr hmkr hgroup hc + (lowerGridPath p n) S ((lowerGridPath_magneticEntropy_le γ mag p n).trans hS) + (uniformCut n) (uniformCut_strict n) (uniformCut_zero n) (uniformCut_last n)) (ε / 2) hhalf + filter_upwards [hup] with k hk + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingVariationalUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingVariationalUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..68a8f1865dcdad916aaf641bbfa4ac0f0f13d8a1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticConvergingVariationalUpper.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticConvergingUpper +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds + +namespace OAI + +/-! The finite-spectrum pressure upper bound after taking the path infimum, +under Haar and Gaussian concentration hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_magneticPressure_converging_variational_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) (count : ℕ → A → ℕ) + (hcount : ∀ k a, count k a ≤ spinGroupSize (group k) a) + (γs mags : ℕ → A → ℝ) (γ mag : A → ℝ) + (hγs : Tendsto γs atTop (𝓝 γ)) (hmags : Tendsto mags atTop (𝓝 mag)) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a|<1) + (hc : ∀ k a, (count k a : ℝ)=spinGroupSize (group k) a*((1+mags k a)/2)) + (hgroup : ∀ k a, (spinGroupSize (group k) a : ℝ)=N k*γs k a) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (spinGroupSlice (group k) (count k)) (eig k) (specialRotation U) (fun _ => 0) ∂μ k) ≤ + (magneticVariationalFunctional (finiteR ρ lam hρpos hρsum) γ mag).toReal + ε := by + intro ε hε + obtain ⟨p, S, hS, hp⟩ := exists_finiteMagneticEntropy_trial + ρ lam hρpos hρsum γ mag hγ hγsum (fun a => (hmag a).le) (half_pos hε) + have hup := finiteSpectrum_magneticPressure_converging_upper hhaar hgauss N hN hNlim m μ hμinv + eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ group count hcount γs mags γ mag hγs hmags hmag hc hgroup p S hS.le (ε / 2) (half_pos hε) + filter_upwards [hup] with k hk + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCountTemplateLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCountTemplateLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..d74511cde85160af2b09fe14b6a1736500e0ff3d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCountTemplateLower.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteTemplateLower +import OAI.Probability.InvariantIsing.Fields.PositiveFieldApproximation + +namespace OAI + +/-! Spectral and field rational populations with different denominators +have a common physical block template. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_count_template_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (w : A → ℕ) (hd : 0 < ∑ a, w a) + (γ : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (w a : ℝ)=(∑ a, w a : ℕ)*γ a) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + : ∀ ε > 0, ∀ᶠ M in atTop, + (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal-ε ≤ + ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M := by + let d := ∑ a, w a + have htot : ∑ a, n*w a=n*d := by rw [← Finset.mul_sum] + let group := countedFieldGroup (fun a => n*w a) htot + have hgroup a : (spinGroupSize group a : ℝ)=(n*d : ℕ)*γ a := by + rw [countedFieldGroup_size,Nat.cast_mul,hcount,Nat.cast_mul] + ring + have hspec' : ∑ a, d*spec a=n*d := by rw [← Finset.mul_sum,hspec,Nat.mul_comm] + have hρspec' a : (d*spec a : ℕ)=(n*d : ℕ)*ρ a := by + rw [Nat.cast_mul,hρspec,Nat.cast_mul] + ring + exact finite_template_magnetic_pressure_lower hhaar hgauss hpub hm (Nat.mul_pos hn hd) + ρ lam hρ hsum hK hlam amax hmax μ (fun a => d*spec a) + (fun a => Nat.mul_pos hd (hsp a)) hspec' hρspec' e he group γ hγ hγsum hgroup + g b hg hD hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCouplingField.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCouplingField.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca67852a2456f7d60d6ea8d0ee73425749b0e8b1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCouplingField.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticPopulationCoupling + +namespace OAI + +/-! The field contribution changes by at most the transportation cost +when an interior profile is averaged across field populations. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma transportedMagnetization_field_term {A B : Type*} [Fintype A] [Fintype B] + (w : A → B → ℝ) (δ c : B → ℝ) (mag : A → ℝ) (hδ : ∀ b, 0 < δ b) : + (∑ b, δ b*c b*transportedMagnetization w δ mag b)= + ∑ a, ∑ b, w a b*c b*mag a := by + calc + _ = ∑ b, c b*(∑ a, w a b*mag a) := by + apply Finset.sum_congr rfl + intro b _ + dsimp only [transportedMagnetization] + field_simp [(hδ b).ne'] + _ = ∑ b, ∑ a, w a b*c b*mag a := by + simp_rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + apply Finset.sum_congr rfl + intro a _ + ring + _ = _ := Finset.sum_comm + +lemma transportedMagnetization_field_cost {A B : Type*} [Fintype A] [Fintype B] + (w : A → B → ℝ) (γ b : A → ℝ) (δ c : B → ℝ) (mag : A → ℝ) + (hw : ∀ a j, 0 ≤ w a j) (hδ : ∀ j, 0 < δ j) + (hrow : ∀ a, ∑ j, w a j=γ a) (hm : ∀ a, |mag a| ≤ 1) : + (∑ a, γ a*b a*mag a)-(∑ j, δ j*c j*transportedMagnetization w δ mag j) ≤ + ∑ a, ∑ j, w a j* |b a-c j| := by + have hsource : (∑ a, γ a*b a*mag a)=∑ a, ∑ j, w a j*b a*mag a := by + simp_rw [← Finset.sum_mul,hrow] + rw [hsource,transportedMagnetization_field_term w δ c mag hδ,← Finset.sum_sub_distrib] + apply Finset.sum_le_sum + intro a _ + rw [← Finset.sum_sub_distrib] + apply Finset.sum_le_sum + intro j _ + calc + _ = w a j*(b a-c j)*mag a := by ring + _ ≤ |w a j*(b a-c j)*mag a| := le_abs_self _ + _ = w a j* |b a-c j| * |mag a| := by rw [abs_mul,abs_mul,abs_of_nonneg (hw a j)] + _ ≤ _ := mul_le_of_le_one_right (mul_nonneg (hw a j) (abs_nonneg _)) (hm a) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCoverDistance.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCoverDistance.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd6f3eb1e06cc7f0017ef5d32426a949395cf282 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCoverDistance.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGridProjection + +namespace OAI + +/-! The normalized radius of the magnetic grid projection converges to its mesh. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +lemma magnetic_cover_distance_tendsto (N : ℕ → ℕ) (hN : ∀ k, 0 (⌈δ*N k+A⌉₊:ℝ)/(N k:ℝ)) atTop (𝓝 δ) := by + have he k : 0≤(⌈δ*N k+A⌉₊:ℝ)/(N k:ℝ)-δ ∧ + (⌈δ*N k+A⌉₊:ℝ)/(N k:ℝ)-δ≤((A:ℝ)+1)/(N k:ℝ) := by + have hp : (0:ℝ) (he k).1) (fun k => (he k).2) + (tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.comp hNlim)) + simpa only [sub_add_cancel,zero_add] using hz.add_const δ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureBound.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b2521483baf7ee07ce961033de54069e02c5a9e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureBound.lean @@ -0,0 +1,113 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticInverseCurvature +import OAI.Probability.InvariantIsing.Fields.FieldSpinLinear + +namespace OAI + +/-! The physical curvature is bounded by the remaining spin variance. +Consequently its mean-coordinate representative vanishes at both endpoints. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma fieldCurvatureTransform_le_spin_variance {ζ : ℝ} (hζ : ζ ≤ 1) (v : ℝ≥0) + {F M Q : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) + {K C : ℝ} (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ C) + (hbound : ∀ y, Q y + (M y) ^ 2 ≤ 1) (z : ℝ) : + fieldCurvatureTransform ζ v F M Q z ≤ 1 - (fieldSpinTransition ζ v F M z) ^ 2 := by + have bM2 : ∀ y, |(M y) ^ 2| ≤ K ^ 2 := by + intro y + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (bM y) 2 + have hle := fieldSpinTransition_mono_test ζ v F (hQ.add (hM.pow_const 2)) + measurable_const + (fun y => (abs_add_le _ _).trans (add_le_add (bQ y) (bM2 y))) + (fun _ => by norm_num : ∀ y : ℝ, |(1 : ℝ)| ≤ 1) hbound z + change fieldSpinTransition ζ v F (fun y => Q y + M y ^ 2) z ≤ + fieldSpinTransition ζ v F (fun _ => 1) z at hle + rw [fieldSpinTransition_add ζ v hF hG hQ (hM.pow_const 2) bQ bM2, + fieldSpinTransition_const ζ v hF hG] at hle + have hvar := fieldSpinTransition_square_le ζ v hF hG hM bM z + have hc : ζ * (fieldSpinTransition ζ v F (fun y => M y ^ 2) z - + (fieldSpinTransition ζ v F M z) ^ 2) ≤ + fieldSpinTransition ζ v F (fun y => M y ^ 2) z - + (fieldSpinTransition ζ v F M z) ^ 2 := by + exact mul_le_of_le_one_left (sub_nonneg.mpr hvar) hζ + unfold fieldCurvatureTransform + linarith + +lemma field_logCosh_spin_variance (z : ℝ) : + 1 / (Real.cosh z) ^ 2 + (Real.tanh z) ^ 2 = 1 := by + have hc := (Real.cosh_pos z).ne' + have hr := Real.cosh_sq_sub_sinh_sq z + rw [Real.tanh_eq_sinh_div_cosh] + field_simp [hc] + nlinarith + +lemma fieldScalarLogCoshSecond_le_spin_variance (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hζ : ∀ av ∈ L, av.1 ≤ 1) (z : ℝ) : + fieldScalarSecond L (fun y => Real.log (Real.cosh y)) Real.tanh + (fun y => 1 / (Real.cosh y) ^ 2) z ≤ + 1 - (fieldScalarMean L (fun y => Real.log (Real.cosh y)) Real.tanh z) ^ 2 := by + induction L generalizing z with + | nil => + change 1 / (Real.cosh z) ^ 2 ≤ 1 - (Real.tanh z) ^ 2 + linarith [field_logCosh_spin_variance z] + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have htζ := fun bv hb => hζ bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular L ht measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular L ht + have hb : ∀ y, fieldScalarSecond L (fun y => Real.log (Real.cosh y)) Real.tanh + (fun y => 1 / (Real.cosh y) ^ 2) y + + (fieldScalarMean L (fun y => Real.log (Real.cosh y)) Real.tanh y) ^ 2 ≤ 1 := by + intro y + linarith [ih ht htζ y] + exact fieldCurvatureTransform_le_spin_variance (hζ av List.mem_cons_self) av.2 + hv.1 hv.2 ha.1 hq.1 ha.2 hq.2 hb z + +lemma fieldBiasCurvature_le_spin_variance (h : FieldStep) (b : ℝ) : + fieldBiasCurvature h b ≤ 1 - (fieldBiasMean h b) ^ 2 := by + have hL := scalarFieldIncrements_positive h + have hζ : ∀ av ∈ scalarFieldIncrements h, av.1 ≤ 1 := by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + change h.cut i.succ.castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + have hv := fieldScalarValue_regular _ hL measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular _ hL measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular _ hL + have hb : ∀ y, fieldScalarSecond (scalarFieldIncrements h) + (fun y => Real.log (Real.cosh y)) Real.tanh (fun y => 1 / (Real.cosh y) ^ 2) y + + (fieldScalarMean (scalarFieldIncrements h) (fun y => Real.log (Real.cosh y)) Real.tanh y) ^ 2 ≤ 1 := by + intro y + linarith [fieldScalarLogCoshSecond_le_spin_variance _ hL hζ y] + have hh := fieldCurvatureTransform_le_spin_variance (by norm_num : (0 : ℝ) ≤ 1) + (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 hv.2 ha.1 hq.1 ha.2 hq.2 hb b + simpa only [fieldCurvatureTransform, zero_mul, add_zero, fieldBiasCurvature, fieldBiasMean] using hh + +lemma magneticCurvature_le_spin_variance (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + magneticCurvature h s ≤ 1 - s ^ 2 := by + have hh := fieldBiasCurvature_le_spin_variance h (magneticBias h s) + rwa [fieldBiasMean_magneticBias h hs] at hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c1c8a84c041908c9e092bee2f2c05eed20aa87f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureEndpoint.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCurvatureBound + +namespace OAI + +/-! A continuous closed-interval curvature representative, obtained +from the actual spin-variance bound rather than an asymptotic expansion. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +def closedMagneticCurvature (h : FieldStep) (s : ℝ) : ℝ := + if |s| < 1 then magneticCurvature h s else 0 + +lemma closedMagneticCurvature_nonneg (h : FieldStep) (s : ℝ) : + 0 ≤ closedMagneticCurvature h s := by + unfold closedMagneticCurvature + split_ifs with hs + · exact (magneticCurvature_pos h s).le + · exact le_rfl + +lemma closedMagneticCurvature_le_spin_variance (h : FieldStep) {s : ℝ} + (hs : s ∈ Icc (-1 : ℝ) 1) : closedMagneticCurvature h s ≤ 1 - s ^ 2 := by + unfold closedMagneticCurvature + split_ifs with hi + · exact magneticCurvature_le_spin_variance h hi + · have hp := mul_nonneg (by linarith [hs.1] : 0 ≤ s + 1) + (by linarith [hs.2] : 0 ≤ 1 - s) + nlinarith + +lemma closedMagneticCurvature_eq (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + closedMagneticCurvature h s = magneticCurvature h s := ite_eq_left hs + +lemma continuousWithinAt_closedMagneticCurvature_endpoint (h : FieldStep) + {s : ℝ} (hs : |s| = 1) : + ContinuousWithinAt (closedMagneticCurvature h) (Icc (-1 : ℝ) 1) s := by + have hs2 : s ^ 2 = 1 := by nlinarith [sq_abs s] + have he : closedMagneticCurvature h s = 0 := by + simp only [closedMagneticCurvature, hs, lt_self_iff_false, ite_false] + have hg : Tendsto (fun t : ℝ => 1 - t ^ 2) (𝓝[Icc (-1 : ℝ) 1] s) (𝓝 0) := by + have hc : ContinuousWithinAt (fun t : ℝ => 1 - t ^ 2) (Icc (-1 : ℝ) 1) s := + (show ContinuousAt (fun t : ℝ => 1 - t ^ 2) s by fun_prop).continuousWithinAt + change Tendsto (fun t : ℝ => 1 - t ^ 2) (𝓝[Icc (-1 : ℝ) 1] s) (𝓝 (1 - s ^ 2)) at hc + simpa only [hs2, sub_self] using hc + change Tendsto (closedMagneticCurvature h) (𝓝[Icc (-1 : ℝ) 1] s) + (𝓝 (closedMagneticCurvature h s)) + rw [he] + apply squeeze_zero' (Filter.Eventually.of_forall (closedMagneticCurvature_nonneg h)) ?_ hg + filter_upwards [self_mem_nhdsWithin] with t ht + exact closedMagneticCurvature_le_spin_variance h ht + +lemma continuousOn_closedMagneticCurvature (h : FieldStep) : + ContinuousOn (closedMagneticCurvature h) (Icc (-1 : ℝ) 1) := by + intro s hs + by_cases hi : |s| < 1 + · have he : closedMagneticCurvature h =ᶠ[𝓝 s] magneticCurvature h := by + filter_upwards [Ioo_mem_nhds (abs_lt.mp hi).1 (abs_lt.mp hi).2] with t ht + exact closedMagneticCurvature_eq h (abs_lt.mpr ht) + exact ((hasDerivAt_magneticCurvature h hi).continuousAt.congr_of_eventuallyEq he).continuousWithinAt + · have ha : |s| ≤ 1 := abs_le.mpr hs + exact continuousWithinAt_closedMagneticCurvature_endpoint h (le_antisymm ha (le_of_not_gt hi)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..a482882572d0421bfecde14ec75d91432b4cc9ef --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticCurvatureLower.lean @@ -0,0 +1,179 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRelativeThird + +namespace OAI + +/-! A positive exponential lower bound for the actual finite-step curvature. +The constant depends only on the finite covariance data, not on the bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +def magneticGaussianLowerFactor (ζ : ℝ) (v : ℝ≥0) : ℝ := + (∫ u : ℝ, Real.exp (-(|ζ| + 2) * |u|) ∂gaussianReal 0 v) / + (∫ u : ℝ, Real.exp (|ζ| * |u|) ∂gaussianReal 0 v) + +lemma magneticGaussianLowerFactor_pos (ζ : ℝ) (v : ℝ≥0) : + 0 < magneticGaussianLowerFactor ζ v := by + have hp (a : ℝ) : 0 < ∫ u : ℝ, Real.exp (a * |u|) ∂gaussianReal 0 v := by + have hi : Integrable (fun u : ℝ => Real.exp (a * |u|)) (gaussianReal 0 v) := by + simpa only [Real.norm_eq_abs] using gaussianReal_exponentialNormMoments 0 v a + exact (integral_pos_iff_support_of_nonneg (fun _ => (Real.exp_pos _).le) hi).mpr + (by simp [Function.support, Real.exp_ne_zero]) + exact div_pos (hp _) (hp _) + +lemma fieldSpinTransition_exponential_lower (ζ : ℝ) (v : ℝ≥0) + {F Q : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hQ : Measurable Q) {B c : ℝ} (bQ : ∀ x, |Q x| ≤ B) (hc : 0 < c) + (hlo : ∀ x, c * Real.exp (-2 * |x|) ≤ Q x) + (hLip : ∀ x y, |F x - F y| ≤ |x - y|) (z : ℝ) : + (c * magneticGaussianLowerFactor ζ v) * Real.exp (-2 * |z|) ≤ + fieldSpinTransition ζ v F Q z := by + let μ := gaussianReal 0 v + let H : ℝ → ℝ := fun u => ζ * F (z + u) + let U : ℝ → ℝ := fun u => H u - ζ * F z + have hmH : Measurable H := (hF.comp (measurable_const.add measurable_id)).const_mul ζ + have hmU : Measurable U := hmH.sub_const _ + have hU (u : ℝ) : |U u| ≤ |ζ| * |u| := by + have hl := hLip (z + u) z + rw [add_sub_cancel_left] at hl + calc + |U u| = |ζ| * |F (z + u) - F z| := by + dsimp only [U, H] + rw [← mul_sub, abs_mul] + _ ≤ _ := mul_le_mul_of_nonneg_left hl (abs_nonneg ζ) + have hexp (a : ℝ) : Integrable (fun u : ℝ => Real.exp (a * |u|)) μ := by + simpa only [Real.norm_eq_abs] using gaussianReal_exponentialNormMoments 0 v a + have hiU : Integrable (fun u => Real.exp (U u)) μ := + (hexp |ζ|).mono' hmU.exp.aestronglyMeasurable (ae_of_all _ fun u => by + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact Real.exp_le_exp.mpr ((le_abs_self _).trans (hU u))) + have hprod : Integrable (fun u => Real.exp (U u) * Q (z + u)) μ := + hiU.mul_bdd (hQ.comp (measurable_const.add measurable_id)).aestronglyMeasurable + (ae_of_all _ fun u => by simpa only [Real.norm_eq_abs] using bQ (z + u)) + have hQP (x : ℝ) : 0 ≤ Q x := + (mul_pos hc (Real.exp_pos _)).le.trans (hlo x) + have hnum : c * Real.exp (-2 * |z|) * + (∫ u : ℝ, Real.exp (-(|ζ| + 2) * |u|) ∂μ) ≤ + ∫ u, Real.exp (U u) * Q (z + u) ∂μ := by + rw [← integral_const_mul] + apply integral_mono ((hexp _).const_mul _) hprod + intro u + have hQlower : c * Real.exp (-2 * |z|) * Real.exp (-2 * |u|) ≤ Q (z + u) := by + calc + _ = c * Real.exp (-2 * (|z| + |u|)) := by rw [mul_assoc, ← Real.exp_add]; congr 2; ring + _ ≤ c * Real.exp (-2 * |z + u|) := + mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (by linarith [abs_add_le z u])) hc.le + _ ≤ _ := hlo _ + have hUlower : Real.exp (-|ζ| * |u|) ≤ Real.exp (U u) := + Real.exp_le_exp.mpr (by linarith [(abs_le.mp (hU u)).1]) + calc + _ = Real.exp (-|ζ| * |u|) * (c * Real.exp (-2 * |z|) * Real.exp (-2 * |u|)) := by + change c * Real.exp (-2 * |z|) * Real.exp (-(|ζ| + 2) * |u|) = _ + rw [show -(|ζ| + 2) * |u| = -|ζ| * |u| + (-2 * |u|) by ring, Real.exp_add] + ring + _ ≤ _ := mul_le_mul hUlower hQlower (by positivity) (Real.exp_pos _).le + have hden : (∫ u, Real.exp (U u) ∂μ) ≤ ∫ u : ℝ, Real.exp (|ζ| * |u|) ∂μ := + integral_mono hiU (hexp _) (fun u => Real.exp_le_exp.mpr ((le_abs_self _).trans (hU u))) + have hdenpos : 0 < ∫ u, Real.exp (U u) ∂μ := + (integral_pos_iff_support_of_nonneg (fun _ => (Real.exp_pos _).le) hiU).mpr + (by simp [Function.support, Real.exp_ne_zero, μ]) + have hH : Integrable (fun u => Real.exp (H u)) μ := + integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments 0 v) + (hF.comp (measurable_const.add measurable_id)) (hG.add_left z) ζ + have : IsProbabilityMeasure (μ.tilted H) := isProbabilityMeasure_tilted hH + have he : μ.tilted U = μ.tilted H := by + have hh := tilted_tilted hH (fun _ => -(ζ * F z)) + simpa only [tilted_const, Pi.add_def, sub_eq_add_neg, U] using hh.symm + rw [fieldSpinTransition_eq_shifted ζ v hF hQ, ← he, integral_tilted_eq_div] + have hd := div_le_div₀ (integral_nonneg fun u => mul_nonneg (Real.exp_pos _).le (hQP _)) + hnum hdenpos hden + convert hd using 1 + unfold magneticGaussianLowerFactor + dsimp only [μ] + ring + +lemma fieldScalarLogCosh_lipschitz (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (x y : ℝ) : + |fieldScalarValue L (fun z => Real.log (Real.cosh z)) x - + fieldScalarValue L (fun z => Real.log (Real.cosh z)) y| ≤ |x - y| := by + have hm : Measurable Real.tanh := by + change Measurable (fun z : ℝ => Real.tanh z) + simp only [Real.tanh_eq] + fun_prop + have hb := fieldScalarMean_regular L hL measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have he := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun z (_ : z ∈ (univ : Set ℝ)) => (hasDerivAt_fieldScalarLogCosh L hL z).hasDerivWithinAt) + (fun z _ => by simpa only [Real.norm_eq_abs] using hb.2 z) + convex_univ (mem_univ y) (mem_univ x) + simpa only [Real.norm_eq_abs, one_mul] using he + +lemma field_logCosh_curvature_exponential_lower (z : ℝ) : + Real.exp (-2 * |z|) ≤ 1 / (Real.cosh z) ^ 2 := by + have hc : Real.cosh z ≤ Real.exp |z| := by + rw [Real.cosh_eq] + have hp := Real.exp_le_exp.mpr (le_abs_self z) + have hm := Real.exp_le_exp.mpr (neg_le_abs z) + linarith + have hs := pow_le_pow_left₀ (Real.cosh_pos z).le hc 2 + rw [one_div] + rw [show Real.exp (-2 * |z|) = (Real.exp |z| ^ 2)⁻¹ by + rw [← Real.exp_nat_mul, ← Real.exp_neg]; congr 1; ring] + exact inv_anti₀ (sq_pos_of_pos (Real.cosh_pos z)) hs + +def magneticCurvatureLowerCap : List (ℝ × ℝ≥0) → ℝ + | [] => 1 + | av :: L => magneticCurvatureLowerCap L * magneticGaussianLowerFactor av.1 av.2 + +lemma magneticCurvatureLowerCap_pos (L : List (ℝ × ℝ≥0)) : + 0 < magneticCurvatureLowerCap L := by + induction L with + | nil => exact zero_lt_one + | cons av L ih => exact mul_pos ih (magneticGaussianLowerFactor_pos _ _) + +lemma fieldScalarLogCoshSecond_exponential_lower (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + magneticCurvatureLowerCap L * Real.exp (-2 * |z|) ≤ + fieldScalarSecond L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) z := by + induction L generalizing z with + | nil => simpa only [magneticCurvatureLowerCap, one_mul, fieldScalarSecond] using + field_logCosh_curvature_exponential_lower z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hq := fieldScalarLogCoshSecond_regular L ht + have hl := fieldSpinTransition_exponential_lower av.1 av.2 hv.1 hv.2 hq.1 hq.2 + (magneticCurvatureLowerCap_pos L) (ih ht) (fieldScalarLogCosh_lipschitz L ht) z + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular L ht measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hvar := fieldSpinTransition_square_le av.1 av.2 hv.1 hv.2 ha.1 ha.2 z + change magneticCurvatureLowerCap (av :: L) * Real.exp (-2 * |z|) ≤ + fieldSpinTransition av.1 av.2 _ _ z + av.1 * + (fieldSpinTransition av.1 av.2 _ _ z - (fieldSpinTransition av.1 av.2 _ _ z) ^ 2) + exact hl.trans (le_add_of_nonneg_right + (mul_nonneg (hL av List.mem_cons_self).le (sub_nonneg.mpr hvar))) + +lemma fieldBiasCurvature_exponential_lower (h : FieldStep) (b : ℝ) : + (magneticCurvatureLowerCap (scalarFieldIncrements h) * + magneticGaussianLowerFactor 0 (NNReal.mk (h.height 0) (h.nonneg 0))) * + Real.exp (-2 * |b|) ≤ fieldBiasCurvature h b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular _ hL measurable_logCosh logCosh_linearGrowth + have hq := fieldScalarLogCoshSecond_regular _ hL + exact fieldSpinTransition_exponential_lower 0 _ hv.1 hv.2 hq.1 hq.2 + (magneticCurvatureLowerCap_pos _) (fieldScalarLogCoshSecond_exponential_lower _ hL) + (fieldScalarLogCosh_lipschitz _ hL) b + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDerivativeLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDerivativeLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..be7108cf3a1c78dbd46ebbc79da032f117e5533a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDerivativeLimit.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicNegative + +namespace OAI + +/-! Bounded second derivatives turn convergence of the scalar continuation +into vanishing first derivatives. Applied twice, this gives the endpoint +regularity of the weighted inverse-coordinate continuation curvature. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma magnetic_derivative_increment_bound {F G D : ℝ → ℝ} {L : ℝ} + (hL : 0 ≤ L) (hF : ∀ x, HasDerivAt F (G x) x) + (hG : ∀ x, HasDerivAt G (D x) x) (hD : ∀ x, |D x| ≤ L) + (x : ℝ) {h : ℝ} (hh : 0 ≤ h) : + |F (x + h) - F x - h * G x| ≤ L * h ^ 2 := by + have hLip (y : ℝ) : |G y - G x| ≤ L * |y - x| := by + have he := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun z (_ : z ∈ (univ : Set ℝ)) => (hG z).hasDerivWithinAt) + (fun z _ => by simpa only [Real.norm_eq_abs] using hD z) + convex_univ (mem_univ x) (mem_univ y) + simpa only [Real.norm_eq_abs] using he + let R := fun z => F z - (z - x) * G x + have hR (z : ℝ) : HasDerivAt R (G z - G x) z := by + convert (hF z).sub (((hasDerivAt_id z).sub_const x).mul_const (G x)) using 1 <;> + first | rfl | simp + have hB (z : ℝ) (hz : z ∈ Icc x (x + h)) : |G z - G x| ≤ L * h := by + have hb : |z - x| ≤ h := by rw [abs_of_nonneg (sub_nonneg.mpr hz.1)]; linarith [hz.2] + exact (hLip z).trans (mul_le_mul_of_nonneg_left hb hL) + have he := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun z (_ : z ∈ Icc x (x + h)) => (hR z).hasDerivWithinAt) + (fun z hz => by simpa only [Real.norm_eq_abs] using hB z hz) + (convex_Icc x (x + h)) (left_mem_Icc.mpr (by linarith : x ≤ x + h)) + (right_mem_Icc.mpr (by linarith : x ≤ x + h)) + have hdist : |x + h - x| = h := by rw [add_sub_cancel_left, abs_of_nonneg hh] + have hRe : R (x + h) - R x = F (x + h) - F x - h * G x := by dsimp only [R]; ring + simp only [Real.norm_eq_abs, hdist] at he + rw [hRe] at he + simpa only [pow_two, mul_assoc] using he + +lemma magnetic_derivative_tendsto_zero {F G D : ℝ → ℝ} {c L : ℝ} + (hL : 0 ≤ L) (hF : ∀ x, HasDerivAt F (G x) x) + (hG : ∀ x, HasDerivAt G (D x) x) (hD : ∀ x, |D x| ≤ L) + (hlimit : Tendsto F atTop (𝓝 c)) : Tendsto G atTop (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + let h := ε / (2 * (L + 1)) + have hden : 0 < 2 * (L + 1) := by positivity + have hh : 0 < h := div_pos hε hden + have hheq : 2 * (L + 1) * h = ε := by + dsimp only [h] + field_simp [hden.ne'] + have hLh : L * h ^ 2 < ε * h / 2 := by + have hh2 : 0 < h ^ 2 := sq_pos_of_pos hh + nlinarith + have hinc : Tendsto (fun x => F (x + h) - F x) atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq, sub_self] using + (hlimit.comp (tendsto_atTop_add_const_right atTop h tendsto_id)).sub hlimit + have hevent := (Metric.tendsto_nhds.mp hinc) (ε * h / 2) (by positivity) + filter_upwards [hevent] with x hx + rw [Real.dist_eq, sub_zero] at hx ⊢ + have hr := magnetic_derivative_increment_bound hL hF hG hD x hh.le + have hg : |h * G x| ≤ |F (x + h) - F x| + L * h ^ 2 := by + calc + _ = |(F (x + h) - F x) - (F (x + h) - F x - h * G x)| := by congr 1; ring + _ ≤ |F (x + h) - F x| + |F (x + h) - F x - h * G x| := abs_sub _ _ + _ ≤ _ := add_le_add_right hr _ + rw [abs_mul, abs_of_pos hh] at hg + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDiagonalL1Consistency.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDiagonalL1Consistency.lean new file mode 100644 index 0000000000000000000000000000000000000000..92572f12717823e0cf6c2aa7a165112a8eca1bbf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDiagonalL1Consistency.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Arrays.OverlapTestTransport +import OAI.Probability.InvariantIsing.Cavity.CavityMagneticDiagonal +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPathConvergence + +namespace OAI + +/-! The constrained block overlap converges in L1 along a diagonal of growing blocks and varying base quantiles, +from its physical weak tests and almost-everywhere quantile convergence. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem magnetic_diagonal_l1_of_constrained_tests {m : ℕ} + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) (mag : ℕ → A → ℝ) + {s : ℝ} (hs : s < 1) (hmag : ∀ r a, |mag r a| ≤ s) + (hc : ∀ r a, (k r a : ℝ) = spinGroupSize (group r) a * ((1+mag r a)/2)) + (base : ℕ → OverlapPath) (depth : ℕ → ℕ) (p : OverlapPath) + (hq : ∀ᵐ t ∂pathMeasure, Tendsto + (fun r => cavityStrictUniformPath (base r) (depth r) t) atTop (𝓝 (p t))) + (htest : ∀ Φ : ℝ →ᵇ ℝ, Tendsto (fun r => ∫ t, Φ (cavityStrictUniformPath (base r) (depth r) t) * + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum (base r) (depth r)) t - cavityStrictUniformPath (base r) (depth r) t) + ∂pathMeasure) atTop (𝓝 0)) : + Tendsto (fun r => ∫ t, |restrictedBlockOverlapPath (hN r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum (base r) (depth r)) t-p t| ∂pathMeasure) atTop (𝓝 0) := by + let h := fun r => cavityStrictUniformField rho lam hrho hsum (base r) (depth r) + let a := fun r => restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) (h r) + let b := fun r => magneticBlockPath (hN r) (h r) (fun j => mag r (group r j)) + have hab := magneticBlockPath_l1_tendsto N hN hNlim group k hk mag hs hmag hc h + (fun r => cavityStrictUniformField_height_le rho lam hrho hsum hK hlam (base r) (depth r) (Fin.last (depth r))) + have hab' : Tendsto (fun r => ∫ t, |b r t-a r t| ∂pathMeasure) atTop (𝓝 0) := by + simpa only [abs_sub_comm] using hab + have hb : Tendsto (fun r => ∫ t, |b r t-p t| ∂pathMeasure) atTop (𝓝 0) := by + apply cavity_magnetic_diagonal_self_consistency rho lam hrho hsum hK hlam N depth hN + (fun r j => mag r (group r j)) base p hq + intro Φ + have hd := overlap_weighted_test_l1_transport (fun r => cavityStrictUniformPath (base r) (depth r)) b a hab' Φ + have ht := hd.add (htest Φ) + simpa only [a, b, h, sub_add_cancel, add_zero] using ht + have hz : Tendsto (fun r => (∫ t, |a r t-b r t| ∂pathMeasure) + + ∫ t, |b r t-p t| ∂pathMeasure) atTop (𝓝 0) := by simpa using hab.add hb + apply squeeze_zero (fun r => integral_nonneg (fun t => abs_nonneg _)) (fun r => ?_) hz + calc + (∫ t, |a r t-p t| ∂pathMeasure) ≤ ∫ t, (|a r t-b r t|+|b r t-p t|) ∂pathMeasure := + integral_mono ((a r).integrable.sub p.integrable).abs + (((a r).integrable.sub (b r).integrable).abs.add (((b r).integrable.sub p.integrable).abs)) + (fun t => abs_sub_le (a r t) (b r t) (p t)) + _ = _ := integral_add ((a r).integrable.sub (b r).integrable).abs + ((b r).integrable.sub p.integrable).abs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDiagonalSelection.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDiagonalSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..922eeb13dcb53fdf88534bcd91e70b9eb8d6a007 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticDiagonalSelection.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticDiagonalL1Consistency +import OAI.Probability.InvariantIsing.Arrays.OverlapTestDiagonal + +namespace OAI + +/-! Selection of one increasing finite-depth diagonal and one compact +quantile subsequence for growing attainable constrained blocks. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem exists_magnetic_consistent_diagonal {m : ℕ} + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) (mag : ℕ → A → ℝ) + {s : ℝ} (hs : s < 1) (hmag : ∀ r a, |mag r a| ≤ s) + (hc : ∀ r a, (k r a : ℝ) = spinGroupSize (group r) a * ((1+mag r a)/2)) + (base : ℕ → OverlapPath) + (htest : ∀ r (Φ : ℝ →ᵇ ℝ), Tendsto (fun j => + ∫ t, Φ (cavityStrictUniformPath (base r) j t) * + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum (base r) j) t - + cavityStrictUniformPath (base r) j t) ∂pathMeasure) atTop (𝓝 0)) : + ∃ (d φ : ℕ → ℕ) (p : OverlapPath), StrictMono d ∧ StrictMono φ ∧ + Tendsto (fun r => ∫ t, |cavityStrictUniformPath (base (φ r)) (d (φ r)) t-p t| + ∂pathMeasure) atTop (𝓝 0) ∧ + Tendsto (fun r => ∫ t, |restrictedBlockOverlapPath (hN (φ r)) + (spinGroupSlice (group (φ r)) (k (φ r))) + (spinGroupSlice_nonempty (group (φ r)) (k (φ r)) (hk (φ r))) + (cavityStrictUniformField rho lam hrho hsum (base (φ r)) (d (φ r))) t-p t| + ∂pathMeasure) atTop (𝓝 0) := by + let q := fun r j => cavityStrictUniformPath (base r) j + let B := fun r j => restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum (base r) j) + obtain ⟨d, hd, hdiag⟩ := exists_diagonal_overlap_tests q B htest + obtain ⟨p, φ, hφ, hpoint, hL1⟩ := overlapPath_ae_l1_subsequence (fun r => q r (d r)) + refine ⟨d, φ, p, hd, hφ, hL1, ?_⟩ + apply magnetic_diagonal_l1_of_constrained_tests rho lam hrho hsum hK hlam + (fun r => N (φ r)) (fun r => hN (φ r)) (hNlim.comp hφ.tendsto_atTop) + (fun r => group (φ r)) (fun r => k (φ r)) (fun r => hk (φ r)) + (fun r => mag (φ r)) hs (fun r => hmag (φ r)) (fun r => hc (φ r)) + (fun r => base (φ r)) (fun r => d (φ r)) p hpoint + intro Φ + exact (hdiag Φ).comp hφ.tendsto_atTop + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticEntropyMaximum.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticEntropyMaximum.lean new file mode 100644 index 0000000000000000000000000000000000000000..4daafa045e2aa63928804eeb378bf26172267b87 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticEntropyMaximum.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupSupport +import OAI.Probability.InvariantIsing.Magnetic.MagneticTrialLimit + +namespace OAI + +/-! Magnetic entropy identification from the proved scalar supporting +inequality, with no additional concavity premise. -/ +noncomputable section +open MeasureTheory Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_entropy_sequence {A : Type*} [Fintype A] + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a|<1) (p : OverlapPath) (h : ℕ → FieldStep) + {C : ℝ} (hC : ∀ n, (h n).height (Fin.last (h n).depth) ≤ C) + (hself : Tendsto (fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s-p s| + ∂pathMeasure) atTop (𝓝 0)) : + magneticEntropyFunctional γ mag p ≠ ⊤ ∧ + Tendsto (fun n => magneticGroupValue γ mag (h n)+fieldPairing p (h n)/2) + atTop (𝓝 (magneticEntropyFunctional γ mag p).toReal) := + magnetic_entropy_sequence_of_support γ mag hγ hγsum (fun a => (hmag a).le) + p h hC (fun n k => magneticGroup_support γ mag hγ hγsum hmag (h n) k) hself + +theorem magnetic_entropy_trial_tendsto {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a|<1) (p : OverlapPath) (q : ℕ → OverlapPath) (h : ℕ → FieldStep) + {C : ℝ} (hC : ∀ n, (h n).height (Fin.last (h n).depth) ≤ C) + (hself : Tendsto (fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s-p s| + ∂pathMeasure) atTop (𝓝 0)) + (hq : Tendsto (fun n => ∫ s, |q n s-p s| ∂pathMeasure) atTop (𝓝 0)) : + magneticEntropyFunctional γ mag p ≠ ⊤ ∧ + Tendsto (fun n => magneticGroupValue γ mag (h n)+fieldPairing (q n) (h n)/2+ + spectralFunctional (finiteR ρ eig hρ hsum) (q n)) atTop + (𝓝 ((magneticEntropyFunctional γ mag p).toReal+spectralFunctional (finiteR ρ eig hρ hsum) p)) := + magnetic_entropy_trial_tendsto_of_support ρ eig hρ hsum γ mag hγ hγsum + (fun a => (hmag a).le) p q h hC + (fun n k => magneticGroup_support γ mag hγ hγsum hmag (h n) k) hself hq + +theorem magnetic_entropy_trial_eventually_lower {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a|<1) (p : OverlapPath) (q : ℕ → OverlapPath) (h : ℕ → FieldStep) + {C : ℝ} (hC : ∀ n, (h n).height (Fin.last (h n).depth) ≤ C) + (hself : Tendsto (fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s-p s| + ∂pathMeasure) atTop (𝓝 0)) + (hq : Tendsto (fun n => ∫ s, |q n s-p s| ∂pathMeasure) atTop (𝓝 0)) : + ∀ ε > 0, ∀ᶠ n in atTop, + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal-ε ≤ + magneticGroupValue γ mag (h n)+fieldPairing (q n) (h n)/2+ + spectralFunctional (finiteR ρ eig hρ hsum) (q n) := + magnetic_entropy_trial_eventually_lower_of_support ρ eig hρ hsum γ mag hγ hγsum + (fun a => (hmag a).le) p q h hC + (fun n k => magneticGroup_support γ mag hγ hγsum hmag (h n) k) hself hq + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticEntropySequence.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticEntropySequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0ab9f41aa4ee9e2643b5b93c6fa0d3e09f5ccbf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticEntropySequence.lean @@ -0,0 +1,98 @@ +import OAI.Probability.InvariantIsing.Fields.FieldPairingPathError +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupPath +import OAI.Probability.InvariantIsing.Fields.FieldBounds + +namespace OAI + +/-! Approximate self-consistency makes the weighted magnetic field values +approach the entropy supremum. Uniform height bounds avoid needing a limit +of the fields themselves. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma magnetic_group_trial_upper {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) (hmag : ∀ a, |mag a| ≤ 1) + (p : OverlapPath) (h : FieldStep) : + magneticGroupValue γ mag h + fieldPairing p h / 2 ≤ h.height (Fin.last h.depth) / 2 := by + have hp : fieldPairing p h ≤ h.height (Fin.last h.depth) := by + have hh := integral_mono (integrable_path_mul_field p h) (integrable_const (h.height (Fin.last h.depth))) + (fun s => (mul_le_of_le_one_left (fieldFunction_nonneg h s) (p.le_one s)).trans + (fieldFunction_le_last h s)) + simpa only [fieldPairing, integral_const, probReal_univ, one_smul] using hh + linarith [magneticGroupValue_le γ mag hγ hγsum hmag h, fieldValue_nonpos h] + +theorem magnetic_entropy_sequence_of_support {A : Type*} [Fintype A] + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hmag : ∀ a, |mag a| ≤ 1) (p : OverlapPath) (h : ℕ → FieldStep) + {C : ℝ} (hC : ∀ n, (h n).height (Fin.last (h n).depth) ≤ C) + (hsupport : ∀ n k, magneticGroupValue γ mag k ≤ magneticGroupValue γ mag (h n) - + (∫ s, magneticGroupPath γ mag hγ hγsum (h n) s * (fieldFunction k s - fieldFunction (h n) s) + ∂pathMeasure) / 2) + (hself : Tendsto (fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s - p s| ∂pathMeasure) + atTop (𝓝 0)) : + magneticEntropyFunctional γ mag p ≠ ⊤ ∧ + Tendsto (fun n => magneticGroupValue γ mag (h n) + fieldPairing p (h n) / 2) + atTop (𝓝 (magneticEntropyFunctional γ mag p).toReal) := by + let V := fun n => magneticGroupValue γ mag (h n) + fieldPairing p (h n) / 2 + let e := fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s - p s| ∂pathMeasure + have he0 n : 0 ≤ e n := integral_nonneg (fun _ => abs_nonneg _) + have hV n : V n ≤ C / 2 := (magnetic_group_trial_upper γ mag hγ hγsum hmag p (h n)).trans (by linarith [hC n]) + have happrox (n : ℕ) (k : FieldStep) : + magneticGroupValue γ mag k + fieldPairing p k / 2 ≤ V n + + ((k.height (Fin.last k.depth) + C) / 2) * e n := by + have hb := trial_le_of_path_support p (magneticGroupPath γ mag hγ hγsum (h n)) (h n) k _ _ (hsupport n k) + change magneticGroupValue γ mag k + fieldPairing p k / 2 ≤ V n + + ((k.height (Fin.last k.depth) + (h n).height (Fin.last (h n).depth)) / 2) * e n at hb + have hc : (k.height (Fin.last k.depth) + (h n).height (Fin.last (h n).depth)) / 2 ≤ + (k.height (Fin.last k.depth) + C) / 2 := by linarith [hC n] + exact hb.trans (add_le_add le_rfl (mul_le_mul_of_nonneg_right hc (he0 n))) + have hall (k : FieldStep) : magneticGroupValue γ mag k + fieldPairing p k / 2 ≤ C / 2 := by + have ht : Tendsto (fun n => C / 2 + + ((k.height (Fin.last k.depth) + C) / 2) * e n) atTop (𝓝 (C / 2)) := by + simpa only [mul_zero, add_zero] using + (hself.const_mul ((k.height (Fin.last k.depth) + C) / 2)).const_add (C / 2) + apply ge_of_tendsto ht + exact Eventually.of_forall (fun n => (happrox n k).trans (add_le_add (hV n) le_rfl)) + have hE : magneticEntropyFunctional γ mag p ≤ ((C / 2 : ℝ) : EReal) := by + apply iSup_le + intro k + exact_mod_cast hall k + have htop : magneticEntropyFunctional γ mag p ≠ ⊤ := ne_top_of_le_ne_top (EReal.coe_ne_top _) hE + have hbot : magneticEntropyFunctional γ mag p ≠ ⊥ := + ne_bot_of_le_ne_bot (EReal.coe_ne_bot _) + (le_iSup (fun k : FieldStep => ((magneticGroupValue γ mag k + fieldPairing p k / 2 : ℝ) : EReal)) + zeroField) + let S := (magneticEntropyFunctional γ mag p).toReal + have hS : magneticEntropyFunctional γ mag p = (S : EReal) := (EReal.coe_toReal htop hbot).symm + have hVS n : V n ≤ S := by + have hh := le_iSup (fun k : FieldStep => + ((magneticGroupValue γ mag k + fieldPairing p k / 2 : ℝ) : EReal)) (h n) + change (V n : EReal) ≤ magneticEntropyFunctional γ mag p at hh + rw [hS] at hh + exact_mod_cast hh + refine ⟨htop, Metric.tendsto_nhds.mpr ?_⟩ + intro ε hε + have hlt : ((S - ε / 2 : ℝ) : EReal) < magneticEntropyFunctional γ mag p := by + rw [hS] + exact_mod_cast (show S - ε / 2 < S by linarith) + obtain ⟨k, hk⟩ := lt_iSup_iff.mp hlt + have hk' : S - ε / 2 < magneticGroupValue γ mag k + fieldPairing p k / 2 := by exact_mod_cast hk + have hsmall := (hself.const_mul ((k.height (Fin.last k.depth) + C) / 2)).eventually + (gt_mem_nhds (show ((k.height (Fin.last k.depth) + C) / 2) * 0 < ε / 2 by + simpa using half_pos hε)) + filter_upwards [hsmall] with n hn + rw [Real.dist_eq, abs_of_nonpos (sub_nonpos.mpr (hVS n))] + have hb := happrox n k + change ((k.height (Fin.last k.depth) + C) / 2) * e n < ε / 2 at hn + change -(V n - S) < ε + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFamilyDerivative.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFamilyDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f792025e39e7091e2c05ce51c907cf92cd1064b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFamilyDerivative.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticDerivativeLimit + +namespace OAI + +/-! Uniform finite-difference estimates for a varying Gaussian slab. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma magnetic_family_derivative_tendsto_zero {ι : Type*} {l : Filter ι} + {F G D : ι → ℝ → ℝ} {x : ι → ℝ} {c L : ℝ} + (hL : 0 ≤ L) (hF : ∀ i z, HasDerivAt (F i) (G i z) z) + (hG : ∀ i z, HasDerivAt (G i) (D i z) z) (hD : ∀ i z, |D i z| ≤ L) + (hlimit : ∀ h : ℝ, Tendsto (fun i => F i (x i + h)) l (𝓝 c)) : + Tendsto (fun i => G i (x i)) l (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + let h := ε / (2 * (L + 1)) + have hden : 0 < 2 * (L + 1) := by positivity + have hh : 0 < h := div_pos hε hden + have hheq : 2 * (L + 1) * h = ε := by + dsimp only [h] + field_simp [hden.ne'] + have hLh : L * h ^ 2 < ε * h / 2 := by + have hh2 : 0 < h ^ 2 := sq_pos_of_pos hh + nlinarith + have hinc : Tendsto (fun i => F i (x i + h) - F i (x i)) l (𝓝 0) := by + simpa only [add_zero, sub_self] using (hlimit h).sub (hlimit 0) + have hevent := (Metric.tendsto_nhds.mp hinc) (ε * h / 2) (by positivity) + filter_upwards [hevent] with i hi + rw [Real.dist_eq, sub_zero] at hi ⊢ + have hr := magnetic_derivative_increment_bound hL (hF i) (hG i) (hD i) (x i) hh.le + have hg : |h * G i (x i)| ≤ |F i (x i + h) - F i (x i)| + L * h ^ 2 := by + calc + _ = |(F i (x i + h) - F i (x i)) - + (F i (x i + h) - F i (x i) - h * G i (x i))| := by congr 1; ring + _ ≤ |F i (x i + h) - F i (x i)| + + |F i (x i + h) - F i (x i) - h * G i (x i)| := abs_sub _ _ + _ ≤ _ := add_le_add_right hr _ + rw [abs_mul, abs_of_pos hh] at hg + nlinarith + +lemma magnetic_family_second_tendsto_zero {ι : Type*} {l : Filter ι} + {F G D E : ι → ℝ → ℝ} {x : ι → ℝ} {c L K : ℝ} + (hL : 0 ≤ L) (hK : 0 ≤ K) + (hF : ∀ i z, HasDerivAt (F i) (G i z) z) + (hG : ∀ i z, HasDerivAt (G i) (D i z) z) + (hD : ∀ i z, HasDerivAt (D i) (E i z) z) + (bD : ∀ i z, |D i z| ≤ L) (bE : ∀ i z, |E i z| ≤ K) + (hlimit : ∀ h : ℝ, Tendsto (fun i => F i (x i + h)) l (𝓝 c)) : + Tendsto (fun i => D i (x i)) l (𝓝 0) := by + apply magnetic_family_derivative_tendsto_zero hK hG hD bE + intro h + apply magnetic_family_derivative_tendsto_zero hL hF hG bD + intro k + simpa only [add_assoc] using hlimit (h + k) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldBias.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldBias.lean new file mode 100644 index 0000000000000000000000000000000000000000..630934e2edfd946f7b7478d2f5ca7cb84bcf5a8b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldBias.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Fields.FieldHeightChart +import OAI.Probability.InvariantIsing.Fields.FieldScalarDerivative + +namespace OAI + +/-! The physical mean spin is the bias derivative of the actual finite +field functional, including its zero-exponent root Gaussian step. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +/-- The mean spin before the root increment, at an arbitrary bias. -/ +def fieldBiasMean (h : FieldStep) : ℝ → ℝ := + fieldSpinTransition 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fieldScalarMean (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) Real.tanh) + +lemma fieldValue_root (h : FieldStep) (b : ℝ) : + fieldValue h b = + gaussianOperator 0 (h.height 0) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) b - + h.height (Fin.last h.depth) / 2 := by + rw [← fieldAllIncrements_value h b, fieldAllIncrements_root] + rfl + +lemma fieldBiasMean_regular (h : FieldStep) : + Measurable (fieldBiasMean h) ∧ ∀ b, |fieldBiasMean h b| ≤ 1 := by + have hL := scalarFieldIncrements_positive h + have hF := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun z : ℝ => Real.tanh z) + simp only [Real.tanh_eq] + fun_prop + have hD := fieldScalarMean_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth hm field_abs_tanh_le_one + exact ⟨measurable_fieldSpinTransition 0 _ hF.1 hD.1, + fieldSpinTransition_bound 0 _ hF.1 hF.2 hD.2⟩ + +lemma hasDerivAt_fieldValue_bias (h : FieldStep) (b : ℝ) : + HasDerivAt (fieldValue h) (fieldBiasMean h b) b := by + have hL := scalarFieldIncrements_positive h + have hF := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun z : ℝ => Real.tanh z) + simp only [Real.tanh_eq] + fun_prop + have hD := fieldScalarMean_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth hm field_abs_tanh_le_one + have hd := hasDerivAt_gaussianOperator 0 + (NNReal.mk (h.height 0) (h.nonneg 0)) hF.1 hF.2 hD.1 zero_le_one hD.2 + (hasDerivAt_fieldScalarLogCosh (scalarFieldIncrements h) hL) b + convert hd.sub_const (h.height (Fin.last h.depth) / 2) using 1 + · funext z + exact fieldValue_root h z + · rfl + +lemma continuous_fieldValue_bias (h : FieldStep) : Continuous (fieldValue h) := + continuous_iff_continuousAt.mpr fun b => (hasDerivAt_fieldValue_bias h b).continuousAt + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldBounds.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..91968db5ab8af8a5884a8ba88f1f198b9aa59d2f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldBounds.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldCurvature +import OAI.Probability.InvariantIsing.Fields.FieldFiniteDomain + +namespace OAI + +/-! The exact canonical bias bounds (mag:bias-bounds) on every finite +field partition, including tied heights and a degenerate root increment. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma convexOn_logcosh : ConvexOn ℝ Set.univ (fun b : ℝ => Real.log (Real.cosh b)) := by + have hc : Continuous (fun b : ℝ => Real.log (Real.cosh b)) := + continuous_iff_continuousAt.mpr fun b => + ((Real.hasDerivAt_cosh b).log (Real.cosh_pos b).ne').continuousAt + have hd : deriv (fun b : ℝ => Real.log (Real.cosh b)) = Real.tanh := by + funext b + simpa only [Real.tanh_eq_sinh_div_cosh] using + ((Real.hasDerivAt_cosh b).log (Real.cosh_pos b).ne').deriv + have hm : StrictMono Real.tanh := strictMono_of_hasDerivAt_pos field_hasDerivAt_tanh + (fun b => one_div_pos.mpr (sq_pos_of_pos (Real.cosh_pos b))) + apply (StrictMono.strictConvexOn_univ_of_deriv hc ?_).convexOn + rw [hd] + exact hm + +lemma logcosh_le_gaussianOperator {F : ℝ → ℝ} (hF : Measurable F) + (hG : HasLinearGrowth F) {a : ℝ} (ha : 0 ≤ a) (v : ℝ≥0) + (hl : ∀ z, Real.log (Real.cosh z) ≤ F z) (z : ℝ) : + Real.log (Real.cosh z) ≤ gaussianOperator a v F z := by + have hi : Integrable (fun u : ℝ => u) (gaussianReal z v) := IsGaussian.integrable_id + have hlog := field_gaussian_linear_integrable v z measurable_logCosh logCosh_linearGrowth + have hc : Continuous (fun b : ℝ => Real.log (Real.cosh b)) := + continuous_iff_continuousAt.mpr fun b => + ((Real.hasDerivAt_cosh b).log (Real.cosh_pos b).ne').continuousAt + have hj := convexOn_logcosh.map_integral_le hc.continuousOn isClosed_univ + (ae_of_all (gaussianReal z v) (fun u => mem_univ u)) hi hlog + rw [integral_id_gaussianReal] at hj + have hf := field_gaussian_linear_integrable v z hF hG + have hmean := hj.trans (integral_mono hlog hf hl) + by_cases ha0 : a = 0 + · subst a + rwa [gaussianOperator_eq_gaussian_integral v hF] + · rw [gaussianOperator_eq_gaussian_exp_integral ha0 v hF] + exact hmean.trans (mean_le_log_moment_div (gaussianReal z v) hf + (lt_of_le_of_ne ha (Ne.symm ha0)) + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG a)) + +lemma logcosh_le_fieldScalarValue (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + Real.log (Real.cosh z) ≤ + fieldScalarValue L (fun b => Real.log (Real.cosh b)) z := by + induction L generalizing z with + | nil => exact le_rfl + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + exact logcosh_le_gaussianOperator hv.1 hv.2 (hL av List.mem_cons_self).le av.2 (ih ht) z + +lemma fieldValue_ge_logcosh_sub_height (h : FieldStep) (b : ℝ) : + Real.log (Real.cosh b) - h.height (Fin.last h.depth) / 2 ≤ fieldValue h b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hl := logcosh_le_gaussianOperator hv.1 hv.2 (show (0:ℝ) ≤ 0 from le_rfl) + (NNReal.mk (h.height 0) (h.nonneg 0)) + (logcosh_le_fieldScalarValue (scalarFieldIncrements h) hL) b + change Real.log (Real.cosh b) ≤ gaussianOperator 0 (h.height 0) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) b at hl + rw [fieldValue_root] + exact sub_le_sub_right hl _ + +lemma fieldValue_le_logcosh (h : FieldStep) (b : ℝ) : + fieldValue h b ≤ Real.log (Real.cosh b) := by + have hv := fieldValue_majorant_sum h (show (0:ℝ) < 1 by norm_num) le_rfl b + rw [fieldMajorant_eq_logcosh (show (1:ℝ) ≠ 0 by norm_num), + List.map_ofFn, List.sum_ofFn] at hv + simp only [Function.comp_def, one_mul, div_one, inv_one, sub_self, zero_mul, add_zero] at hv + have hs : (∑ i : Fin (h.depth + 1), max (fieldIncrement h i).1 1 * + (fieldIncrement h i).2 / 2) = h.height (Fin.last h.depth) / 2 := by + have hmax (i : Fin (h.depth + 1)) : max (fieldIncrement h i).1 1 = 1 := by + apply max_eq_right + change h.cut i.castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + simp_rw [hmax, one_mul] + rw [← Finset.sum_div, fieldIncrement_sum] + rw [hs] at hv + linarith + +lemma fieldValue_canonical_bias_bounds (h : FieldStep) (b : ℝ) : + Real.log (Real.cosh b) ≤ fieldValue h b + h.height (Fin.last h.depth) / 2 ∧ + fieldValue h b + h.height (Fin.last h.depth) / 2 ≤ + Real.log (Real.cosh b) + h.height (Fin.last h.depth) / 2 := by + constructor + · linarith [fieldValue_ge_logcosh_sub_height h b] + · linarith [fieldValue_le_logcosh h b] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldCurvature.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..60e6eeb7497104c444f717eb0ded1575c0bb6ce3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldCurvature.lean @@ -0,0 +1,116 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldMinimum +import OAI.Probability.InvariantIsing.Fields.FieldScalarLogCoshSecond + +namespace OAI + +/-! Strict bias convexity follows from the positive terminal curvature +and the nonnegative conditional variance terms in the actual recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldSpinTransition_pos (ζ : ℝ) (v : ℝ≥0) {F a : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (ha : Measurable a) + {B : ℝ} (haB : ∀ z, |a z| ≤ B) (hap : ∀ z, 0 < a z) (z : ℝ) : + 0 < fieldSpinTransition ζ v F a z := by + have hw := integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) + hF hG ζ + let μ := (gaussianReal z v).tilted (fun u => ζ * F u) + have : IsProbabilityMeasure μ := MeasureTheory.isProbabilityMeasure_tilted hw + have hi : Integrable a μ := (integrable_const B).mono' ha.aestronglyMeasurable + (Filter.Eventually.of_forall (fun u => by simpa only [Real.norm_eq_abs] using haB u)) + have hs : Function.support a = Set.univ := by + ext u + simp only [Function.mem_support, Set.mem_univ, iff_true] + exact (hap u).ne' + change 0 < ∫ u, a u ∂μ + apply (integral_pos_iff_support_of_nonneg (fun u => (hap u).le) hi).mpr + rw [hs, measure_univ] + exact (zero_lt_one : (0 : ENNReal) < 1) + +lemma fieldScalarLogCoshSecond_pos (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + 0 < fieldScalarSecond L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) z := by + induction L generalizing z with + | nil => exact one_div_pos.mpr (sq_pos_of_pos (Real.cosh_pos z)) + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hs := fieldScalarLogCoshSecond_regular L ht + have hp := fieldSpinTransition_pos av.1 av.2 hv.1 hv.2 hs.1 hs.2 (ih ht) z + have hm : Measurable Real.tanh := by + change Measurable (fun z : ℝ => Real.tanh z) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular L ht measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hc := fieldSpinTransition_square_le av.1 av.2 hv.1 hv.2 ha.1 ha.2 z + have hζ := (hL av List.mem_cons_self).le + change 0 < fieldSpinTransition av.1 av.2 _ _ z + av.1 * + (fieldSpinTransition av.1 av.2 _ _ z - (fieldScalarMean (av :: L) _ _ z) ^ 2) + exact add_pos_of_pos_of_nonneg hp (mul_nonneg hζ (sub_nonneg.mpr hc)) + +/-- Actual second bias derivative, with the root exponent fixed at zero. -/ +def fieldBiasCurvature (h : FieldStep) : ℝ → ℝ := + fieldSpinTransition 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fieldScalarSecond (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) + Real.tanh (fun z => 1 / (Real.cosh z) ^ 2)) + +lemma fieldBiasCurvature_pos (h : FieldStep) (b : ℝ) : 0 < fieldBiasCurvature h b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hs := fieldScalarLogCoshSecond_regular (scalarFieldIncrements h) hL + exact fieldSpinTransition_pos 0 _ hv.1 hv.2 hs.1 hs.2 + (fieldScalarLogCoshSecond_pos (scalarFieldIncrements h) hL) b + +lemma hasDerivAt_fieldBiasMean (h : FieldStep) (b : ℝ) : + HasDerivAt (fieldBiasMean h) (fieldBiasCurvature h b) b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun z : ℝ => Real.tanh z) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth hm field_abs_tanh_le_one + have hs := fieldScalarLogCoshSecond_regular (scalarFieldIncrements h) hL + have hd := hasDerivAt_fieldSpinTransition 0 + (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 hv.2 ha.1 ha.1 hs.1 + zero_le_one zero_le_one ha.2 ha.2 hs.2 + (hasDerivAt_fieldScalarLogCosh (scalarFieldIncrements h) hL) + (hasDerivAt_fieldScalarLogCoshMean (scalarFieldIncrements h) hL) b + simpa only [zero_mul, add_zero, fieldBiasMean, fieldBiasCurvature] using hd + +lemma strictMono_fieldBiasMean (h : FieldStep) : StrictMono (fieldBiasMean h) := by + apply strictMono_of_deriv_pos + intro b + rw [(hasDerivAt_fieldBiasMean h b).deriv] + exact fieldBiasCurvature_pos h b + +lemma strictConvexOn_fieldValue_bias (h : FieldStep) : + StrictConvexOn ℝ Set.univ (fieldValue h) := by + have he : deriv (fieldValue h) = fieldBiasMean h := by + funext b + exact (hasDerivAt_fieldValue_bias h b).deriv + apply StrictMono.strictConvexOn_univ_of_deriv (continuous_fieldValue_bias h) + rw [he] + exact strictMono_fieldBiasMean h + +lemma magneticBias_minimum_unique (h : FieldStep) {s b c : ℝ} + (hb : ∀ x, magneticBiasObjective h s b ≤ magneticBiasObjective h s x) + (hc : ∀ x, magneticBiasObjective h s c ≤ magneticBiasObjective h s x) : b = c := by + apply (strictMono_fieldBiasMean h).injective + rw [magneticBiasMean_eq_of_minimum h hb, magneticBiasMean_eq_of_minimum h hc] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldExtension.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..00d894b6fa87b830073ccaccf38d5edfaad961ea --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldExtension.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Fields.FieldSimpleApproximation + +namespace OAI + +/-! The magnetic value for a field law with finite first absolute moment. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +def magneticFieldFunctional (spectral : Measure ℝ) (edge : ℝ) (field : ProbabilityMeasure ℝ) : ℝ := + limUnder atTop (fun n => simpleFieldValue (field : Measure ℝ) (fieldSimpleApproximation n) + (measureR spectral edge)) + +lemma magneticFieldFunctional_approximation + (ν μ : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) : + Tendsto (fun n => simpleFieldValue (μ : Measure ℝ) (fieldSimpleApproximation n) + (measureR (ν : Measure ℝ) b)) atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b μ)) := by + exact (simpleFieldValue_cauchy (μ : Measure ℝ) fieldSimpleApproximation id hμ + (fieldSimpleApproximation_tendsto _ hμ) ν a b hcompact hbound ha hb).tendsto_limUnder + +lemma magneticFieldFunctional_simple_error + (ν μ : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) (s : SimpleFunc ℝ ℝ) : + |magneticFieldFunctional (ν : Measure ℝ) b μ-simpleFieldValue (μ : Measure ℝ) s + (measureR (ν : Measure ℝ) b)| ≤ ∫ x, |x-s x| ∂(μ : Measure ℝ) := by + have hv := ((magneticFieldFunctional_approximation ν μ a b hcompact hbound ha hb hμ).sub_const + (simpleFieldValue (μ : Measure ℝ) s (measureR (ν : Measure ℝ) b))).abs + have he := (fieldSimpleApproximation_tendsto (μ : Measure ℝ) hμ).add_const + (∫ x, |x-s x| ∂(μ : Measure ℝ)) + rw [zero_add] at he + apply le_of_tendsto_of_tendsto hv he + apply Eventually.of_forall + intro n + dsimp only + refine (simpleFieldValue_abs_sub_le ν a b hcompact hbound ha hb + (μ : Measure ℝ) (fieldSimpleApproximation n) s).trans ?_ + have hsum := integral_add ((simpleField_integrable (μ : Measure ℝ) (fieldSimpleApproximation n)).sub hμ).abs + (hμ.sub (simpleField_integrable (μ : Measure ℝ) s)).abs + dsimp only [Pi.add_apply,Pi.sub_apply] at hsum + rw [← hsum] + apply integral_mono ((simpleField_integrable (μ : Measure ℝ) (fieldSimpleApproximation n)).sub + (simpleField_integrable (μ : Measure ℝ) s)).abs + (((simpleField_integrable (μ : Measure ℝ) (fieldSimpleApproximation n)).sub hμ).abs.add + (hμ.sub (simpleField_integrable (μ : Measure ℝ) s)).abs) + intro x + change |fieldSimpleApproximation n x-s x| ≤ |fieldSimpleApproximation n x-x|+|x-s x| + exact abs_sub_le _ _ _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldFamily.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef83f8e58067ef71bfcedf25c9cb6f8c391b763f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldFamily.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticImplicitBias +import OAI.Probability.InvariantIsing.Fields.FieldHeightLocal + +namespace OAI + +/-! Identification of the joint finite-height derivatives with the actual +physical mean and curvature at every bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Classical +open scoped Topology + +namespace InvariantIsing + +lemma fieldFiniteFamily_mean_at_bias (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hs : r ∈ fieldStrictHeightCone h.depth) (b : ℝ) : + F.X (r, b) = fieldBiasMean (fieldStepOfStrictHeights h r hs) b := by + have hd := (F.spatial_derivative r hr b).sub_const (r (Fin.last h.depth) / 2) + have he : (fun z => F.U (r, z) - r (Fin.last h.depth) / 2) = + fieldValue (fieldStepOfStrictHeights h r hs) := by + funext z + rw [hU] + exact fieldHeightJointValue_strict h r hs z + rw [he] at hd + exact hd.unique (hasDerivAt_fieldValue_bias (fieldStepOfStrictHeights h r hs) b) + +lemma fieldFiniteFamily_curvature_at_bias (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hs : r ∈ fieldStrictHeightCone h.depth) (b : ℝ) : + F.XX (r, b) = fieldBiasCurvature (fieldStepOfStrictHeights h r hs) b := by + have hd := F.spatial_mean_derivative r hr b + have he : (fun z => F.X (r, z)) = fieldBiasMean (fieldStepOfStrictHeights h r hs) := by + funext z + exact fieldFiniteFamily_mean_at_bias h F hU r hr hs z + rw [he] at hd + exact hd.unique (hasDerivAt_fieldBiasMean (fieldStepOfStrictHeights h r hs) b) + +lemma fieldFiniteFamily_curvature_pos (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hs : r ∈ fieldStrictHeightCone h.depth) (b : ℝ) : 0 < F.XX (r, b) := by + rw [fieldFiniteFamily_curvature_at_bias h F hU r hr hs] + exact fieldBiasCurvature_pos _ _ + +/-- The unique interior minimizing bias for the actual literal height vector. -/ +def magneticHeightBias (h : FieldStep) (s : ℝ) (r : Fin (h.depth + 1) → ℝ) : ℝ := + if hr : r ∈ fieldStrictHeightCone h.depth then + magneticBias (fieldStepOfStrictHeights h r hr) s else 0 + +lemma magneticHeightBias_eq (h : FieldStep) (s : ℝ) (r : Fin (h.depth + 1) → ℝ) + (hr : r ∈ fieldStrictHeightCone h.depth) : + magneticHeightBias h s r = magneticBias (fieldStepOfStrictHeights h r hr) s := by + simp only [magneticHeightBias, dite_eq_left hr] + +lemma fieldFiniteFamily_magneticHeightBias (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) {s : ℝ} (hs : |s| < 1) + (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + F.X (r, magneticHeightBias h s r) = s := by + rw [fieldFiniteFamily_mean_at_bias h F hU r hr hrs, magneticHeightBias_eq h s r hrs] + exact fieldBiasMean_magneticBias _ hs + +lemma continuousAt_magneticHeightBias_line (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + ContinuousAt (fun t : ℝ => magneticHeightBias h s (r + t • d)) 0 := by + let A := fun p : ℝ × ℝ => F.X (r + p.1 • d, p.2) + have hpath : Continuous (fun t : ℝ => r + t • d) := by fun_prop + have hN : ∀ᶠ t : ℝ in 𝓝 0, r + t • d ∈ I ∩ fieldStrictHeightCone h.depth := by + exact hpath.continuousAt.eventually + ((hI.inter (isOpen_fieldStrictHeightCone _)).mem_nhds (by simpa using And.intro hr hrs)) + apply parametric_bias_continuousAt (A := A) + · intro z + have hc : ContinuousAt F.X (r + (0 : ℝ) • d, z) := by + simpa only [zero_smul, add_zero] using (F.derivativeX (r, z) hr).continuousAt + have hp : ContinuousAt (fun t : ℝ => (r + t • d, z)) 0 := by fun_prop + simpa only [A, zero_smul, add_zero, Function.comp_def] using + (hc.comp (f := fun t : ℝ => (r + t • d, z)) hp) + · filter_upwards [hN] with t ht + have he : (fun z => A (t, z)) = + fieldBiasMean (fieldStepOfStrictHeights h (r + t • d) ht.2) := by + funext z + exact fieldFiniteFamily_mean_at_bias h F hU _ ht.1 ht.2 z + rw [he] + exact strictMono_fieldBiasMean _ + · filter_upwards [hN] with t ht + exact fieldFiniteFamily_magneticHeightBias h F hU hs _ ht.1 ht.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldGradient.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..8baadf986fa242079bb3f983a6f9cb7ce227f9d0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldGradient.lean @@ -0,0 +1,139 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldLevels +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldHeightDerivative +import OAI.Probability.InvariantIsing.Fields.FieldHeightGradient +import OAI.Probability.InvariantIsing.Fields.FieldHeightLists + +namespace OAI + +/-! The exact physical height gradient at an arbitrary bias, and hence +at the bias realizing a prescribed magnetization. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma hasDerivAt_fieldInteriorChart_bias (h : FieldStep) (i : Fin h.depth) + (hstrict : ∀ j, 0 < (fieldIncrement h j).2) (b : ℝ) : + HasDerivAt (fun t => fieldInteriorChart h i t b) + (-(h.cut i.castSucc.succ - h.cut i.castSucc.castSucc) / 2 * + magneticLevelAtBias h b i.castSucc) 0 := by + have hd := hasDerivAt_fieldInteriorChart h i hstrict b + rw [magneticLevelAtBias_allSquares] + exact hd + +private lemma magnetic_terminal_list_zero (h : FieldStep) : + fieldTerminalIncrements ((fieldAllIncrements h).take h.depth) + (fieldIncrement h (Fin.last h.depth)).2 (fieldIncrement h (Fin.last h.depth)).1 0 = + fieldAllIncrements h := by + have he := updated_increments_final h 0 + simp only [add_zero, Function.update_eq_self] at he + rw [← he] + unfold fieldAllIncrements + apply congrArg List.ofFn + funext j + apply Prod.ext + · rfl + · exact Real.toNNReal_of_nonneg (fieldIncrement_nonneg h j) + +lemma hasDerivAt_fieldFinalChart_bias (h : FieldStep) + (hstrict : ∀ j, 0 < (fieldIncrement h j).2) (b : ℝ) : + HasDerivAt (fun t => fieldFinalChart h t b) + (-(1 - h.cut (Fin.last h.depth).castSucc) / 2 * + magneticLevelAtBias h b (Fin.last h.depth)) 0 := by + let L := fieldAllIncrements h + have hP : ∀ av ∈ L.take h.depth, 0 < (av.2 : ℝ) := fun av hav => + fieldAllIncrements_strict h hstrict av (List.mem_of_mem_take hav) + have ht : (0 : ℝ) ∈ Ioi (-(fieldIncrement h (Fin.last h.depth)).2) := by + change -(fieldIncrement h (Fin.last h.depth)).2 < 0 + linarith [hstrict (Fin.last h.depth)] + have hd := hasDerivAt_fieldTerminalValue (L.take h.depth) hP + (fieldIncrement h (Fin.last h.depth)).2 (fieldIncrement h (Fin.last h.depth)).1 + (h.height (Fin.last h.depth)) 0 b ht + have hs := fieldScalarSquares_congr_list (magnetic_terminal_list_zero h) + (fun y => Real.log (Real.cosh y)) Real.tanh + (fieldTerminalLevel (L.take h.depth) (fieldIncrement h (Fin.last h.depth)).2 + (fieldIncrement h (Fin.last h.depth)).1 0) + ⟨(Fin.last h.depth).val + 1, by simp⟩ (by + simp [fieldTerminalLevel, fieldAppendIndex, L]) + rw [congrFun hs b, ← magneticLevelAtBias_allSquares] at hd + exact hd + +lemma hasDerivAt_fieldHeightCoordinate_bias (h : FieldStep) + (i : Fin (h.depth + 1)) (hstrict : ∀ j, 0 < (fieldIncrement h j).2) (b : ℝ) : + HasDerivAt (fun t => fieldHeightCoordinateValue h i t b) + (-(h.cut i.succ - h.cut i.castSucc) / 2 * magneticLevelAtBias h b i) 0 := by + refine Fin.lastCases ?_ (fun j => ?_) i + · have he : (fun t => fieldHeightCoordinateValue h (Fin.last h.depth) t b) = + fun t => fieldFinalChart h t b := by + funext t + exact fieldHeightCoordinateValue_final h t b + rw [he] + simpa only [Fin.succ_last, h.last] using hasDerivAt_fieldFinalChart_bias h hstrict b + · have he : (fun t => fieldHeightCoordinateValue h j.castSucc t b) = + fun t => fieldInteriorChart h j t b := by + funext t + exact fieldHeightCoordinateValue_interior h j t b + rw [he] + exact hasDerivAt_fieldInteriorChart_bias h j hstrict b + +lemma fieldFinite_centered_coordinate_derivative_bias (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) (i : Fin (h.depth + 1)) (b : ℝ) : + HasDerivAt (fun t : ℝ => F.U (Function.update r i (r i + t), b) - + (Function.update r i (r i + t)) (Fin.last h.depth) / 2) + (F.P i (r, b) - if i = Fin.last h.depth then 1 / 2 else 0) 0 := by + classical + have hd := F.coordinate_derivative r b hr i + by_cases hi : i = Fin.last h.depth + · subst i + have hc : HasDerivAt (fun t : ℝ => (r (Fin.last h.depth) + t) / 2) (1 / 2 : ℝ) 0 := + ((hasDerivAt_id (0 : ℝ)).const_add (r (Fin.last h.depth))).div_const 2 + convert hd.sub hc using 1 + · funext t + simp only [Pi.sub_apply, Function.update_self] + · simp + · have hn : Fin.last h.depth ≠ i := Ne.symm hi + simpa [Function.update_of_ne hn, hi] using hd.sub_const (r (Fin.last h.depth) / 2) + +theorem magneticHeight_gradient_identification (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hs : r ∈ fieldStrictHeightCone h.depth) (i : Fin (h.depth + 1)) (b : ℝ) : + F.P i (r, b) - (if i = Fin.last h.depth then 1 / 2 else 0) = + -(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticLevelAtBias (fieldStepOfStrictHeights h r hs) b i := by + let k := fieldStepOfStrictHeights h r hs + have hd := fieldFinite_centered_coordinate_derivative_bias h F r hr i b + have he : (fun t : ℝ => F.U (Function.update r i (r i + t), b) - + (Function.update r i (r i + t)) (Fin.last h.depth) / 2) = + fun t => fieldHeightCoordinateValue k i t b := by + funext t + rw [hU] + change fieldHeightJointValue k (Function.update k.height i (k.height i + t)) b = _ + exact fieldHeightJointValue_update k i t b + rw [he] at hd + have hk := hasDerivAt_fieldHeightCoordinate_bias k i + (fun j => fieldStepOfStrictHeights_strict h r hs j) b + exact hd.unique hk + +lemma magneticHeight_optimized_gradient (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (_hs : |s| < 1) (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) (i : Fin (h.depth + 1)) : + F.P i (r, magneticHeightBias h s r) - + (if i = Fin.last h.depth then 1 / 2 else 0) = + -(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h r hrs) s i := by + rw [magneticHeight_gradient_identification h F hU r hr hrs i, + magneticHeightBias_eq h s r hrs] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldHeightDerivative.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldHeightDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bc8b86136ad7611b5a89adecab282209ea149b6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldHeightDerivative.lean @@ -0,0 +1,126 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldFamily + +namespace OAI + +/-! Actual height-direction envelope differentiation at fixed magnetization. +The bias response is obtained by implicit differentiation of the finite +physical mean, using its strictly positive curvature. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter Classical +open scoped Topology BigOperators + +namespace InvariantIsing + +lemma hasFDerivAt_field_line_restriction {n : ℕ} {U : FieldCovariate n → ℝ} + {r d A : Fin n → ℝ} {b c : ℝ} + (hU : HasFDerivAt U (fieldFiniteLinear A c) (r, b)) : + HasFDerivAt (fun p : ℝ × ℝ => U (r + p.1 • d, p.2)) + (pairLinear (∑ i, A i * d i) c) (0, b) := by + let L : (ℝ × ℝ) →L[ℝ] FieldCovariate n := + ((ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight d).prod (ContinuousLinearMap.snd ℝ ℝ ℝ) + have hm : HasFDerivAt (fun p : ℝ × ℝ => (r + p.1 • d, p.2)) L ((0 : ℝ), b) := by + have hf : HasFDerivAt (fun p : ℝ × ℝ => p.1) + (ContinuousLinearMap.fst ℝ ℝ ℝ) ((0 : ℝ), b) := hasFDerivAt_fst + have hs : HasFDerivAt (fun p : ℝ × ℝ => p.2) + (ContinuousLinearMap.snd ℝ ℝ ℝ) ((0 : ℝ), b) := hasFDerivAt_snd + simpa only [zero_add, L, Pi.add_apply] using + (((hasFDerivAt_const r ((0 : ℝ), b)).add (hf.smul_const d)).prodMk hs) + have hu : HasFDerivAt U (fieldFiniteLinear A c) + ((fun p : ℝ × ℝ => (r + p.1 • d, p.2)) (0, b)) := by + simpa only [zero_smul, add_zero] using hU + have hd := hu.comp ((0 : ℝ), b) hm + convert hd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro p + simp only [ContinuousLinearMap.comp_apply, L, ContinuousLinearMap.prod_apply, + ContinuousLinearMap.smulRight_apply, fieldFiniteLinear_apply, Pi.smul_apply, + smul_eq_mul, pairLinear_apply] + change (∑ i, A i * d i) * p.1 + c * p.2 = + (∑ i, A i * (p.1 * d i)) + c * p.2 + rw [Finset.sum_mul] + congr 1 + apply Finset.sum_congr rfl + intro i _ + ring + +/-- An arbitrary strict height direction has the explicitly differentiated +physical optimizing bias. -/ +lemma hasDerivAt_magneticHeightBias_line (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + HasDerivAt (fun t : ℝ => magneticHeightBias h s (r + t • d)) + (-(∑ i, F.PX i (r, magneticHeightBias h s r) * d i) / + F.XX (r, magneticHeightBias h s r)) 0 := by + let b := fun t : ℝ => magneticHeightBias h s (r + t • d) + have hb := continuousAt_magneticHeightBias_line h F hI hU hs r d hr hrs + have hpos := fieldFiniteFamily_curvature_pos h F hU r hr hrs (b 0) + have hmean := hasFDerivAt_field_line_restriction (d := d) (F.derivativeX (r, b 0) hr) + have hN : ∀ᶠ t : ℝ in 𝓝 0, r + t • d ∈ I ∩ fieldStrictHeightCone h.depth := by + have hp : ContinuousAt (fun t : ℝ => r + t • d) 0 := by fun_prop + exact hp.eventually ((hI.inter (isOpen_fieldStrictHeightCone _)).mem_nhds + (by simpa only [zero_smul, add_zero, Set.mem_inter_iff] using And.intro hr hrs)) + have he : ∀ᶠ t : ℝ in 𝓝 0, F.X (r + t • d, b t) = s := by + filter_upwards [hN] with t ht + exact fieldFiniteFamily_magneticHeightBias h F hU hs _ ht.1 ht.2 + simpa only [b, zero_smul, add_zero] using + parametric_bias_hasDerivAt hb hpos.ne' hmean he + +/-- The centered constrained field value on the strict height cone. -/ +def constrainedHeightFieldValue (h : FieldStep) (s : ℝ) + (r : Fin (h.depth + 1) → ℝ) : ℝ := + if hrs : r ∈ fieldStrictHeightCone h.depth then + constrainedFieldValue (fieldStepOfStrictHeights h r hrs) s else 0 + +lemma constrainedHeightFieldValue_eq (h : FieldStep) {s : ℝ} (hs : |s| < 1) + (r : Fin (h.depth + 1) → ℝ) (hrs : r ∈ fieldStrictHeightCone h.depth) : + constrainedHeightFieldValue h s r = + fieldHeightJointValue h r (magneticHeightBias h s r) - magneticHeightBias h s r * s := by + rw [constrainedHeightFieldValue, dite_eq_left hrs, + constrainedFieldValue_magneticBias _ hs, magneticHeightBias_eq h s r hrs, + fieldHeightJointValue_strict h r hrs] + +lemma hasDerivAt_constrainedHeightFieldValue_line (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + HasDerivAt (fun t : ℝ => constrainedHeightFieldValue h s (r + t • d)) + ((∑ i, F.P i (r, magneticHeightBias h s r) * d i) - d (Fin.last h.depth) / 2) 0 := by + let b := fun t : ℝ => magneticHeightBias h s (r + t • d) + have hdb := hasDerivAt_magneticHeightBias_line h F hI hU hs r d hr hrs + have hp := ((hasDerivAt_const (0 : ℝ) r).add + ((hasDerivAt_id (0 : ℝ)).smul_const d)).prodMk hdb + have hF := F.derivative (r + (0 : ℝ) • d, b 0) + (by simpa only [zero_smul, add_zero] using hr) + have hd := hF.comp_hasDerivAt (0 : ℝ) hp + have hemean : F.X (r, b 0) = s := by + simpa only [b, zero_smul, add_zero] using + fieldFiniteFamily_magneticHeightBias h F hU hs r hr hrs + have hemean' : F.X (r, magneticHeightBias h s r) = s := by + simpa only [b, zero_smul, add_zero] using hemean + have hcenter : HasDerivAt (fun t : ℝ => (r + t • d) (Fin.last h.depth) / 2) + (d (Fin.last h.depth) / 2) 0 := by + simpa only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, one_mul, id_eq] using + (((hasDerivAt_id (0 : ℝ)).mul_const (d (Fin.last h.depth))).const_add + (r (Fin.last h.depth))).div_const 2 + have hdf := (hd.sub hcenter).sub (hdb.mul_const s) + have hvalue : (fun t : ℝ => F.U (r + t • d, b t) - + (r + t • d) (Fin.last h.depth) / 2 - b t * s) =ᶠ[𝓝 (0 : ℝ)] + (fun t => constrainedHeightFieldValue h s (r + t • d)) := by + have hp : ContinuousAt (fun t : ℝ => r + t • d) 0 := by fun_prop + filter_upwards [hp.eventually ((isOpen_fieldStrictHeightCone _).mem_nhds + (by simpa only [zero_smul, add_zero] using hrs))] with t ht + rw [constrainedHeightFieldValue_eq h hs _ ht, fieldHeightJointValue, ← hU] + convert hdf.congr_of_eventuallyEq hvalue.symm using 1 + simp only [zero_smul, add_zero, zero_add, one_smul, fieldFiniteLinear_apply, b, hemean'] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldHeightHessian.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldHeightHessian.lean new file mode 100644 index 0000000000000000000000000000000000000000..8885310a2f98ebea1712ce4f87460e002ca12869 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldHeightHessian.lean @@ -0,0 +1,118 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldHeightDerivative + +namespace OAI + +/-! The actual constrained finite-height Hessian. Differentiating the +physical optimizing bias gives the scalar Schur-complement correction; +no twice-differentiable optimizer is assumed. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped Topology BigOperators + +namespace InvariantIsing + +lemma hasDerivAt_constrainedHeightFieldValue_line_at (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (t : ℝ) + (hr : r + t • d ∈ I) (hrs : r + t • d ∈ fieldStrictHeightCone h.depth) : + HasDerivAt (fun q : ℝ => constrainedHeightFieldValue h s (r + q • d)) + ((∑ i, F.P i (r + t • d, magneticHeightBias h s (r + t • d)) * d i) - + d (Fin.last h.depth) / 2) t := by + have h0 := hasDerivAt_constrainedHeightFieldValue_line h F hI hU hs + (r + t • d) d hr hrs + have h0' : HasDerivAt (fun q : ℝ => + constrainedHeightFieldValue h s (r + t • d + q • d)) + ((∑ i, F.P i (r + t • d, magneticHeightBias h s (r + t • d)) * d i) - + d (Fin.last h.depth) / 2) (id t - t) := by + simpa only [id_eq, sub_self] using h0 + have hd := h0'.comp (h := fun q : ℝ => q - t) t ((hasDerivAt_id t).sub_const t) + have he : (fun q : ℝ => constrainedHeightFieldValue h s + (r + t • d + (q - t) • d)) = + (fun q : ℝ => constrainedHeightFieldValue h s (r + q • d)) := by + funext q + congr 1 + ext i + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul] + ring + simpa only [Function.comp_def, sub_self, mul_one, sub_zero, he] using hd + +lemma hasDerivAt_magneticHeight_gradient (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + HasDerivAt (fun t : ℝ => + (∑ i, F.P i (r + t • d, magneticHeightBias h s (r + t • d)) * d i) - + d (Fin.last h.depth) / 2) + ((∑ i, ∑ j, F.PP i j (r, magneticHeightBias h s r) * d i * d j) - + (∑ i, F.PX i (r, magneticHeightBias h s r) * d i) ^ 2 / + F.XX (r, magneticHeightBias h s r)) 0 := by + let b := fun t : ℝ => magneticHeightBias h s (r + t • d) + let A := ∑ i, F.PX i (r, magneticHeightBias h s r) * d i + let C := F.XX (r, magneticHeightBias h s r) + have hb : HasDerivAt b (-A / C) 0 := + hasDerivAt_magneticHeightBias_line h F hI hU hs r d hr hrs + have hp := ((hasDerivAt_const (0 : ℝ) r).add + ((hasDerivAt_id (0 : ℝ)).smul_const d)).prodMk hb + have hd (i : Fin (h.depth + 1)) : + HasDerivAt (fun t => F.P i (r + t • d, b t) * d i) + (((∑ j, F.PP i j (r, magneticHeightBias h s r) * d j) + + F.PX i (r, magneticHeightBias h s r) * (-A / C)) * d i) 0 := by + have hF := F.derivativeP i (r + (0 : ℝ) • d, b 0) + (by simpa only [zero_smul, add_zero] using hr) + have hh := (hF.comp_hasDerivAt (0 : ℝ) hp).mul_const (d i) + simpa only [fieldFiniteLinear_apply, Pi.smul_apply, one_mul, + b, zero_smul, add_zero, one_smul, zero_add, Function.comp_def, Pi.add_apply, + id_eq] using hh + have hsum := (HasDerivAt.sum (fun i (_ : i ∈ Finset.univ) => hd i)).sub_const + (d (Fin.last h.depth) / 2) + convert hsum using 1 + · funext t + simp only [Finset.sum_apply, b] + · simp only [add_mul, Finset.sum_add_distrib, Finset.sum_mul] + have he : (∑ i, F.PX i (r, magneticHeightBias h s r) * (-A / C) * d i) = + A * (-A / C) := by + dsimp only [A] + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + ring + rw [he] + have hpp : (∑ i, ∑ j, F.PP i j (r, magneticHeightBias h s r) * d j * d i) = + ∑ i, ∑ j, F.PP i j (r, magneticHeightBias h s r) * d i * d j := by + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + rw [hpp] + dsimp only [A, C] + ring + +/-- The second height derivative is the Hessian at the physical bias minus +the rank-one correction from keeping the mean spin fixed. -/ +lemma hasDerivAt_deriv_constrainedHeightFieldValue_line (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + HasDerivAt (deriv (fun t : ℝ => constrainedHeightFieldValue h s (r + t • d))) + ((∑ i, ∑ j, F.PP i j (r, magneticHeightBias h s r) * d i * d j) - + (∑ i, F.PX i (r, magneticHeightBias h s r) * d i) ^ 2 / + F.XX (r, magneticHeightBias h s r)) 0 := by + have hp : ContinuousAt (fun t : ℝ => r + t • d) 0 := by fun_prop + have hn : ∀ᶠ t : ℝ in 𝓝 0, r + t • d ∈ I ∩ fieldStrictHeightCone h.depth := + hp.eventually ((hI.inter (isOpen_fieldStrictHeightCone _)).mem_nhds + (by simpa only [zero_smul, add_zero, Set.mem_inter_iff] using And.intro hr hrs)) + apply (hasDerivAt_magneticHeight_gradient h F hI hU hs r d hr hrs).congr_of_eventuallyEq + filter_upwards [hn] with t ht + exact (hasDerivAt_constrainedHeightFieldValue_line_at h F hI hU hs r d t + ht.1 ht.2).deriv + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldInverse.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff0c1d349aaa5281e725f6f504de6313a323efc1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldInverse.lean @@ -0,0 +1,90 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldCurvature + +namespace OAI + +/-! The unique interior minimizing bias is the inverse physical mean-spin +map. Its derivative and the magnetization envelope formula are actual +consequences of the scalar Gaussian recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped Topology + +namespace InvariantIsing + +def magneticBias (h : FieldStep) : ℝ → ℝ := Function.invFun (fieldBiasMean h) + +lemma fieldBiasMean_magneticBias (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + fieldBiasMean h (magneticBias h s) = s := by + obtain ⟨b, hb⟩ := exists_magneticBias_minimum h hs + exact Function.invFun_eq ⟨b, magneticBiasMean_eq_of_minimum h hb⟩ + +lemma magneticBias_minimizes (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + ∀ c, magneticBiasObjective h s (magneticBias h s) ≤ magneticBiasObjective h s c := by + obtain ⟨b, hb⟩ := exists_magneticBias_minimum h hs + have he : magneticBias h s = b := (strictMono_fieldBiasMean h).injective + ((fieldBiasMean_magneticBias h hs).trans (magneticBiasMean_eq_of_minimum h hb).symm) + rwa [he] + +lemma constrainedFieldValue_magneticBias (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + constrainedFieldValue h s = fieldValue h (magneticBias h s) - magneticBias h s * s := + constrainedFieldValue_eq_at_minimum h (magneticBias_minimizes h hs) + +lemma continuousAt_magneticBias (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + ContinuousAt (magneticBias h) s := by + have hs' := abs_lt.mp hs + have hN : Ioo (-1 : ℝ) 1 ∈ 𝓝 s := Ioo_mem_nhds hs'.1 hs'.2 + apply tendsto_order.2 + constructor + · intro l hl + have hm : fieldBiasMean h l < s := by + rw [← fieldBiasMean_magneticBias h hs] + exact strictMono_fieldBiasMean h hl + filter_upwards [hN, Ioi_mem_nhds hm] with t ht hmt + apply (strictMono_fieldBiasMean h).lt_iff_lt.mp + rw [fieldBiasMean_magneticBias h (abs_lt.mpr ht)] + exact hmt + · intro u hu + have hm : s < fieldBiasMean h u := by + rw [← fieldBiasMean_magneticBias h hs] + exact strictMono_fieldBiasMean h hu + filter_upwards [hN, Iio_mem_nhds hm] with t ht hmt + apply (strictMono_fieldBiasMean h).lt_iff_lt.mp + rw [fieldBiasMean_magneticBias h (abs_lt.mpr ht)] + exact hmt + +lemma hasDerivAt_magneticBias (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + HasDerivAt (magneticBias h) (fieldBiasCurvature h (magneticBias h s))⁻¹ s := by + have hs' := abs_lt.mp hs + apply HasDerivAt.of_local_left_inverse (continuousAt_magneticBias h hs) + (hasDerivAt_fieldBiasMean h (magneticBias h s)) + (fieldBiasCurvature_pos h _).ne' + filter_upwards [Ioo_mem_nhds hs'.1 hs'.2] with t ht + exact fieldBiasMean_magneticBias h (abs_lt.mpr ht) + +lemma hasDerivAt_constrainedFieldValue_magnetization (h : FieldStep) {s : ℝ} + (hs : |s| < 1) : + HasDerivAt (constrainedFieldValue h) (-magneticBias h s) s := by + have hb := hasDerivAt_magneticBias h hs + have hd := ((hasDerivAt_fieldValue_bias h (magneticBias h s)).comp s hb).sub + (hb.mul (hasDerivAt_id s)) + have he : (fun t => fieldValue h (magneticBias h t) - magneticBias h t * t) =ᶠ[𝓝 s] + constrainedFieldValue h := by + have hs' := abs_lt.mp hs + filter_upwards [Ioo_mem_nhds hs'.1 hs'.2] with t ht + exact (constrainedFieldValue_magneticBias h (abs_lt.mpr ht)).symm + have heq : fieldBiasMean h (magneticBias h s) * + (fieldBiasCurvature h (magneticBias h s))⁻¹ - + ((fieldBiasCurvature h (magneticBias h s))⁻¹ * s + magneticBias h s * 1) = + -magneticBias h s := by + rw [fieldBiasMean_magneticBias h hs] + ring + simp only [id_eq] at hd + rw [heq] at hd + exact hd.congr_of_eventuallyEq he.symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldInverseConvex.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldInverseConvex.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb8cdc85a7ef6d78aef1a465849418a1cd44c42c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldInverseConvex.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareSlabConvex +import Mathlib.Analysis.Convex.Deriv + +namespace OAI + +/-! The actual finite conditional overlap is convex in prescribed mean spin. +The ordinary root Gaussian is included in this identification. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma scalarFieldIncrements_exponent_le_one (h : FieldStep) : + ∀ av ∈ scalarFieldIncrements h, av.1 ≤ 1 := by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + change h.cut i.succ.castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + +lemma magneticScalarSlabBias_root (h : FieldStep) : + magneticScalarSlabBias (scalarFieldIncrements h) 0 (h.height 0) = magneticBias h := by + have he : Real.toNNReal (h.height 0) = NNReal.mk (h.height 0) (h.nonneg 0) := Real.toNNReal_of_nonneg (h.nonneg 0) + have hm : magneticScalarSlabMean (scalarFieldIncrements h) 0 (h.height 0) = fieldBiasMean h := by + funext z + simp only [magneticScalarSlabMean, fieldBiasMean, he] + funext s + change Function.invFun (magneticScalarSlabMean (scalarFieldIncrements h) 0 (h.height 0)) s = + Function.invFun (fieldBiasMean h) s + rw [hm] + +lemma magneticFieldLevel_eq_slab (h : FieldStep) (i : Fin (h.depth + 1)) : + (fun s => magneticFieldLevel h s i) = + magneticScalarSlabContinuation (scalarFieldIncrements h) + (magneticScalarSquareFourJet (scalarFieldIncrements h) (scalarFieldIncrements_positive h) + (Fin.cast (by rw [scalarFieldIncrements_length]) i)).toMagneticContinuationJet + 0 (h.height 0) := by + funext s + rw [magneticScalarSlabContinuation_eq_jet _ (scalarFieldIncrements_positive h)] + have he : Real.toNNReal (h.height 0) = NNReal.mk (h.height 0) (h.nonneg 0) := Real.toNNReal_of_nonneg (h.nonneg 0) + simp only [magneticScalarSlabContinuationJet, MagneticContinuationJet.transition, + magneticScalarSquareFourJet_value, magneticScalarSlabBias_root, he, + magneticFieldLevel, magneticLevelAtBias] + +theorem magneticFieldLevel_second_deriv_nonneg (h : FieldStep) + (i : Fin (h.depth + 1)) {s : ℝ} (hs : |s| < 1) : + 0 ≤ deriv (deriv (fun u => magneticFieldLevel h u i)) s := by + rw [magneticFieldLevel_eq_slab] + exact magneticScalarSlabSquare_deriv2_nonneg (scalarFieldIncrements h) + (scalarFieldIncrements_positive h) (scalarFieldIncrements_exponent_le_one h) + _ (le_refl (0 : ℝ)) (by norm_num) (h.nonneg 0) hs + +theorem magneticFieldLevel_convexOn_spin (h : FieldStep) (i : Fin (h.depth + 1)) : + ConvexOn ℝ (Ioo (-1 : ℝ) 1) (fun s => magneticFieldLevel h s i) := by + let L := scalarFieldIncrements h + let hL := scalarFieldIncrements_positive h + let A := (magneticScalarSquareFourJet L hL + (Fin.cast (by rw [scalarFieldIncrements_length]) i)).toMagneticContinuationJet + have he := magneticFieldLevel_eq_slab h i + have hfirst (s : ℝ) (hs : s ∈ Ioo (-1 : ℝ) 1) : + DifferentiableAt ℝ (fun u => magneticFieldLevel h u i) s := by + rw [he] + exact (magneticScalarSlabContinuation_hasDerivAt_spin L hL A + (le_refl (0 : ℝ)) (abs_lt.mpr hs) (h.height 0)).differentiableAt + have hsecond (s : ℝ) (hs : s ∈ Ioo (-1 : ℝ) 1) : + DifferentiableAt ℝ (deriv (fun u => magneticFieldLevel h u i)) s := by + rw [he] + have hd := magneticScalarSlabContinuationSlope_hasDerivAt L hL A + (le_refl (0 : ℝ)) (abs_lt.mpr hs) (h.height 0) + apply HasDerivAt.differentiableAt + apply hd.congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds hs.1 hs.2] with t ht + exact (magneticScalarSlabContinuation_hasDerivAt_spin L hL A + (le_refl (0 : ℝ)) (abs_lt.mpr ht) (h.height 0)).deriv + apply convexOn_of_deriv2_nonneg (convex_Ioo (-1 : ℝ) 1) + (fun s hs => (hfirst s hs).continuousAt.continuousWithinAt) + (fun s hs => (hfirst s (interior_subset hs)).differentiableWithinAt) + (fun s hs => (hsecond s (interior_subset hs)).differentiableWithinAt) + intro s hs + exact magneticFieldLevel_second_deriv_nonneg h i (abs_lt.mpr (show s ∈ Ioo (-1 : ℝ) 1 from interior_subset hs)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldLevels.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldLevels.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa3c2b06995db6c441cefbd3843e69004a831b30 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldLevels.lean @@ -0,0 +1,121 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldSymmetry +import OAI.Probability.InvariantIsing.Fields.FieldHeightChart + +namespace OAI + +/-! The actual conditional squared spin means at prescribed magnetization. +The root Gaussian is averaged at the optimizing bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +private lemma field_measurable_tanh : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + +def magneticLevelAtBias (h : FieldStep) (b : ℝ) (i : Fin (h.depth + 1)) : ℝ := + fieldSpinTransition 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fieldScalarSquares (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) Real.tanh + (Fin.cast (by rw [scalarFieldIncrements_length]) i)) b + +lemma magneticLevelAtBias_allSquares (h : FieldStep) (b : ℝ) + (i : Fin (h.depth + 1)) : + magneticLevelAtBias h b i = + fieldScalarSquares (fieldAllIncrements h) (fun z => Real.log (Real.cosh z)) Real.tanh + ⟨i.val + 1, by simp only [fieldAllIncrements_length]; omega⟩ b := by + let j : Fin ((scalarFieldIncrements h).length + 1) := + Fin.cast (by rw [scalarFieldIncrements_length]) i + have he := fieldScalarSquares_congr_list (fieldAllIncrements_root h) (fun z => Real.log (Real.cosh z)) Real.tanh + ⟨i.val + 1, by simp only [fieldAllIncrements_length]; omega⟩ j.succ (by rfl) + rw [congrFun he b] + rfl + +lemma magneticLevelAtBias_zero (h : FieldStep) (i : Fin (h.depth + 1)) : + magneticLevelAtBias h 0 i = fieldMagnetizationLevel h i := by + rw [magneticLevelAtBias_allSquares] + exact fieldAllSquares_magnetization h i + +lemma magneticLevelAtBias_mem_unit (h : FieldStep) (b : ℝ) + (i : Fin (h.depth + 1)) : magneticLevelAtBias h b i ∈ Icc (0 : ℝ) 1 := by + have hL := scalarFieldIncrements_positive h + have hR := fieldScalarSquares_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth field_measurable_tanh field_abs_tanh_le_one + (Fin.cast (by rw [scalarFieldIncrements_length]) i) + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hb := fieldSpinTransition_bound 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + hv.1 hv.2 (fun z => by rw [abs_of_nonneg (hR.2 z).1]; exact (hR.2 z).2) b + refine ⟨?_, (le_abs_self _).trans hb⟩ + unfold magneticLevelAtBias fieldSpinTransition + exact integral_nonneg (fun z => (hR.2 z).1) + +lemma magneticLevelAtBias_monotone (h : FieldStep) (b : ℝ) : + Monotone (magneticLevelAtBias h b) := by + have hL := scalarFieldIncrements_positive h + have hR := fieldScalarSquares_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth field_measurable_tanh field_abs_tanh_le_one + intro i j hij + apply fieldSpinTransition_mono_test + 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (hR _).1 (hR _).1 + (fun z => by rw [abs_of_nonneg ((hR _).2 z).1]; exact ((hR _).2 z).2) + (fun z => by rw [abs_of_nonneg ((hR _).2 z).1]; exact ((hR _).2 z).2) + intro z + exact fieldScalarSquares_monotone (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth field_measurable_tanh field_abs_tanh_le_one z hij + +lemma fieldBiasMean_sq_le_magneticLevel (h : FieldStep) (b : ℝ) + (i : Fin (h.depth + 1)) : (fieldBiasMean h b) ^ 2 ≤ magneticLevelAtBias h b i := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hm := fieldScalarMean_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth field_measurable_tanh field_abs_tanh_le_one + have hsq := fieldSpinTransition_square_le 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + hv.1 hv.2 hm.1 hm.2 b + have he : magneticLevelAtBias h b 0 = + fieldSpinTransition 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fun z => (fieldScalarMean (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) Real.tanh z) ^ 2) b := by + unfold magneticLevelAtBias + congr 1 + funext z + exact fieldScalarSquares_zero _ _ _ z + change (fieldBiasMean h b) ^ 2 ≤ _ at hsq + rw [← he] at hsq + exact hsq.trans (magneticLevelAtBias_monotone h b (Fin.zero_le i)) + +def magneticFieldLevel (h : FieldStep) (s : ℝ) : Fin (h.depth + 1) → ℝ := + magneticLevelAtBias h (magneticBias h s) + +lemma magneticFieldLevel_mem_unit (h : FieldStep) (s : ℝ) + (i : Fin (h.depth + 1)) : magneticFieldLevel h s i ∈ Icc (0 : ℝ) 1 := + magneticLevelAtBias_mem_unit h _ i + +lemma magneticFieldLevel_monotone (h : FieldStep) (s : ℝ) : + Monotone (magneticFieldLevel h s) := magneticLevelAtBias_monotone h _ + +lemma sq_magnetization_le_magneticFieldLevel (h : FieldStep) {s : ℝ} + (hs : |s| < 1) (i : Fin (h.depth + 1)) : s ^ 2 ≤ magneticFieldLevel h s i := by + have hh := fieldBiasMean_sq_le_magneticLevel h (magneticBias h s) i + rwa [fieldBiasMean_magneticBias h hs] at hh + +def magneticFieldPath (h : FieldStep) (s : ℝ) : OverlapPath := + fieldLevelPath h (magneticFieldLevel h s) (magneticFieldLevel_monotone h s) + (magneticFieldLevel_mem_unit h s) + +@[simp] lemma magneticFieldLevel_zero (h : FieldStep) (i : Fin (h.depth + 1)) : + magneticFieldLevel h 0 i = fieldMagnetizationLevel h i := by + simp only [magneticFieldLevel, magneticBias_zero, magneticLevelAtBias_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldLowerBound.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..153c2f2a5e0add1de731793e4c13935333c03028 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldLowerBound.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldBias +import OAI.Probability.InvariantIsing.Fields.FieldMajorantGaussian + +namespace OAI + +/-! Linear bias coercivity for the finite magnetic field functional. +The lower estimate is preserved by the actual Gaussian recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma affine_le_gaussianOperator {F : ℝ → ℝ} (hF : Measurable F) + (hG : HasLinearGrowth F) {a : ℝ} (ha : 0 ≤ a) (v : ℝ≥0) + (m c : ℝ) (hl : ∀ z, m * z + c ≤ F z) (z : ℝ) : + m * z + c ≤ gaussianOperator a v F z := by + have hi : Integrable (fun u : ℝ => u) (gaussianReal z v) := IsGaussian.integrable_id + have hmean : m * z + c ≤ ∫ u, F u ∂gaussianReal z v := by + calc + _ = ∫ u, m * u + c ∂gaussianReal z v := by + rw [integral_add (hi.const_mul m) (integrable_const c), + integral_const_mul, integral_id_gaussianReal, integral_const] + simp + _ ≤ _ := integral_mono ((hi.const_mul m).add (integrable_const c)) + (field_gaussian_linear_integrable v z hF hG) hl + by_cases ha0 : a = 0 + · subst a + rwa [gaussianOperator_eq_gaussian_integral v hF] + · have hap : 0 < a := lt_of_le_of_ne ha (Ne.symm ha0) + rw [gaussianOperator_eq_gaussian_exp_integral ha0 v hF] + exact hmean.trans (mean_le_log_moment_div (gaussianReal z v) + (field_gaussian_linear_integrable v z hF hG) hap + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG a)) + +lemma affine_le_fieldScalarValue (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (m c : ℝ) (hl : ∀ z, m * z + c ≤ F z) (z : ℝ) : + m * z + c ≤ fieldScalarValue L F z := by + induction L generalizing z with + | nil => exact hl z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have htail := fieldScalarValue_regular L ht hF hG + exact affine_le_gaussianOperator htail.1 htail.2 (hL av (List.mem_cons_self)).le + av.2 m c (ih ht) z + +lemma signed_bias_le_logcosh (b : ℝ) : + b - Real.log 2 ≤ Real.log (Real.cosh b) := by + have he : Real.exp b ≤ 2 * Real.cosh b := by + rw [Real.cosh_eq] + linarith [Real.exp_pos (-b)] + have hl := Real.log_le_log (Real.exp_pos b) he + rw [Real.log_exp, Real.log_mul (by norm_num) (Real.cosh_pos b).ne'] at hl + linarith + +lemma fieldValue_bias_lower (h : FieldStep) (b : ℝ) : + |b| - Real.log 2 - h.height (Fin.last h.depth) / 2 ≤ fieldValue h b := by + have hL := scalarFieldIncrements_positive h + have hF := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have hplus : ∀ z, (1 : ℝ) * z + -Real.log 2 ≤ + fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) z := by + apply affine_le_fieldScalarValue _ hL measurable_logCosh logCosh_linearGrowth + intro z + simpa only [one_mul, sub_eq_add_neg] using signed_bias_le_logcosh z + have hminus : ∀ z, (-1 : ℝ) * z + -Real.log 2 ≤ + fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) z := by + apply affine_le_fieldScalarValue _ hL measurable_logCosh logCosh_linearGrowth + intro z + simpa only [Real.cosh_neg, neg_mul, one_mul, sub_eq_add_neg] + using signed_bias_le_logcosh (-z) + have hp := affine_le_gaussianOperator hF.1 hF.2 (show (0:ℝ) ≤ 0 from le_rfl) + (NNReal.mk (h.height 0) (h.nonneg 0)) 1 (-Real.log 2) hplus b + have hm := affine_le_gaussianOperator hF.1 hF.2 (show (0:ℝ) ≤ 0 from le_rfl) + (NNReal.mk (h.height 0) (h.nonneg 0)) (-1) (-Real.log 2) hminus b + change 1 * b + -Real.log 2 ≤ gaussianOperator 0 (h.height 0) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) b at hp + change -1 * b + -Real.log 2 ≤ gaussianOperator 0 (h.height 0) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) b at hm + rw [fieldValue_root] + rcases le_total 0 b with hb | hb + · rw [abs_of_nonneg hb] + linarith + · rw [abs_of_nonpos hb] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldMinimum.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2bdbf748f0231005bc35e4606c4d021ee190d80 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldMinimum.lean @@ -0,0 +1,138 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldLowerBound + +namespace OAI + +/-! The finite prescribed-magnetization functional has an attained bias +minimum at every interior magnetization. No optimizer or concavity premise +is used. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped NNReal Topology + +namespace InvariantIsing + +/-- The finite canonical field value with the magnetization constraint. -/ +def magneticBiasObjective (h : FieldStep) (s b : ℝ) : ℝ := + fieldValue h b - b * s + +/-- The prescribed-magnetization field functional from (mag:constrained-functional). -/ +def constrainedFieldValue (h : FieldStep) (s : ℝ) : ℝ := + sInf (Set.range (magneticBiasObjective h s)) + +lemma magneticBiasObjective_lower (h : FieldStep) (s b : ℝ) : + (1 - |s|) * |b| - Real.log 2 - h.height (Fin.last h.depth) / 2 ≤ + magneticBiasObjective h s b := by + have hp : b * s ≤ |b| * |s| := by + simpa only [abs_mul] using le_abs_self (b * s) + have hl := fieldValue_bias_lower h b + unfold magneticBiasObjective + nlinarith + +lemma magneticBiasObjective_bddBelow (h : FieldStep) {s : ℝ} (hs : |s| ≤ 1) : + BddBelow (Set.range (magneticBiasObjective h s)) := by + refine ⟨-Real.log 2 - h.height (Fin.last h.depth) / 2, ?_⟩ + rintro _ ⟨b, rfl⟩ + have hp : 0 ≤ (1 - |s|) * |b| := mul_nonneg (sub_nonneg.mpr hs) (abs_nonneg b) + linarith [magneticBiasObjective_lower h s b] + +lemma continuous_magneticBiasObjective (h : FieldStep) (s : ℝ) : + Continuous (magneticBiasObjective h s) := + (continuous_fieldValue_bias h).sub (continuous_id.mul_const s) + +lemma hasDerivAt_magneticBiasObjective (h : FieldStep) (s b : ℝ) : + HasDerivAt (magneticBiasObjective h s) (fieldBiasMean h b - s) b := by + convert (hasDerivAt_fieldValue_bias h b).sub ((hasDerivAt_id b).mul_const s) using 1 + · rfl + · simp only [one_mul] + +/-- Linear coercivity gives a genuine global optimizer, including field +profiles with tied heights or zero increments. -/ +lemma exists_magneticBias_minimum (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + ∃ b : ℝ, ∀ c : ℝ, magneticBiasObjective h s b ≤ magneticBiasObjective h s c := by + let C := Real.log 2 + h.height (Fin.last h.depth) / 2 + let δ := 1 - |s| + let R := (C + 1) / δ + have hδ : 0 < δ := sub_pos.mpr hs + have hC : 0 ≤ C := add_nonneg (Real.log_nonneg (by norm_num)) + (div_nonneg (h.nonneg _) (by norm_num)) + have hR : 0 ≤ R := div_nonneg (by linarith) hδ.le + have he : δ * R = C + 1 := by + dsimp only [R] + field_simp + obtain ⟨b, hb, hmin⟩ := isCompact_Icc.exists_isMinOn + (show (Icc (-R) R).Nonempty from ⟨0, by constructor <;> linarith⟩) + (continuous_magneticBiasObjective h s).continuousOn + refine ⟨b, fun c => ?_⟩ + by_cases hc : c ∈ Icc (-R) R + · exact hmin hc + have hcr : R ≤ |c| := by + by_contra hlt + have hab : |c| < R := lt_of_not_ge hlt + have hab' := abs_lt.mp hab + exact hc ⟨hab'.1.le, hab'.2.le⟩ + have hlo := magneticBiasObjective_lower h s c + have hlarge : 1 ≤ magneticBiasObjective h s c := by + have hmul := mul_le_mul_of_nonneg_left hcr hδ.le + dsimp only [δ, C] at he hmul + linarith + have h0 := hmin (show (0 : ℝ) ∈ Icc (-R) R by constructor <;> linarith) + change magneticBiasObjective h s b ≤ magneticBiasObjective h s 0 at h0 + have hz : magneticBiasObjective h s 0 ≤ 0 := by + simpa only [magneticBiasObjective, zero_mul, sub_zero] using fieldValue_nonpos h + linarith + +lemma constrainedFieldValue_eq_at_minimum (h : FieldStep) {s b : ℝ} + (hmin : ∀ c : ℝ, magneticBiasObjective h s b ≤ magneticBiasObjective h s c) : + constrainedFieldValue h s = magneticBiasObjective h s b := by + apply le_antisymm + · exact csInf_le ⟨magneticBiasObjective h s b, by rintro _ ⟨c, rfl⟩; exact hmin c⟩ + ⟨b, rfl⟩ + · exact le_csInf (range_nonempty _) (by rintro _ ⟨c, rfl⟩; exact hmin c) + +lemma constrainedFieldValue_attained (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + ∃ b : ℝ, constrainedFieldValue h s = fieldValue h b - b * s ∧ + ∀ c : ℝ, fieldValue h b - b * s ≤ fieldValue h c - c * s := by + obtain ⟨b, hb⟩ := exists_magneticBias_minimum h hs + exact ⟨b, constrainedFieldValue_eq_at_minimum h hb, hb⟩ + +/-- At any minimizing bias the actual physical mean spin equals the +prescribed magnetization. -/ +lemma magneticBiasMean_eq_of_minimum (h : FieldStep) {s b : ℝ} + (hmin : ∀ c : ℝ, magneticBiasObjective h s b ≤ magneticBiasObjective h s c) : + fieldBiasMean h b = s := by + have hlocal : IsLocalMin (magneticBiasObjective h s) b := Eventually.of_forall hmin + have hz := hlocal.hasDerivAt_eq_zero (hasDerivAt_magneticBiasObjective h s b) + exact sub_eq_zero.mp hz + +/-- The real minimum agrees exactly with the extended-real infimum. -/ +lemma constrainedFieldValue_coe_iInf (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + (constrainedFieldValue h s : EReal) = + ⨅ b : ℝ, ((fieldValue h b - b * s : ℝ) : EReal) := by + obtain ⟨b, hb⟩ := exists_magneticBias_minimum h hs + rw [constrainedFieldValue_eq_at_minimum h hb] + apply le_antisymm + · apply le_iInf + intro c + exact_mod_cast hb c + · exact iInf_le _ b + +/-- Interior minimizing biases are bounded uniformly on bounded-height +families of fields. -/ +lemma magneticBias_minimum_bound (h : FieldStep) {s b C : ℝ} (hs : |s| < 1) + (hC : h.height (Fin.last h.depth) ≤ C) + (hmin : ∀ c : ℝ, magneticBiasObjective h s b ≤ magneticBiasObjective h s c) : + |b| ≤ (Real.log 2 + C / 2) / (1 - |s|) := by + have hδ : 0 < 1 - |s| := sub_pos.mpr hs + apply (le_div_iff₀ hδ).mpr + have hz : magneticBiasObjective h s b ≤ 0 := by + apply (hmin 0).trans + simpa only [magneticBiasObjective, zero_mul, sub_zero] using fieldValue_nonpos h + have hl := magneticBiasObjective_lower h s b + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldParameter.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldParameter.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b48f038fefda8244da4ab8733d23d0315204d25 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldParameter.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldMinimum + +namespace OAI + +/-! The bias infimum is finite and concave in the prescribed magnetization. +Its actual minimizing bias supplies the supporting slope. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +lemma constrainedFieldValue_le_trial (h : FieldStep) {s : ℝ} (hs : |s| ≤ 1) (b : ℝ) : + constrainedFieldValue h s ≤ fieldValue h b - b * s := + csInf_le (magneticBiasObjective_bddBelow h hs) ⟨b, rfl⟩ + +lemma constrainedFieldValue_bounds (h : FieldStep) {s : ℝ} (hs : |s| ≤ 1) : + -Real.log 2 - h.height (Fin.last h.depth) / 2 ≤ constrainedFieldValue h s ∧ + constrainedFieldValue h s ≤ 0 := by + constructor + · apply le_csInf (range_nonempty _) + rintro _ ⟨b, rfl⟩ + have hp : 0 ≤ (1 - |s|) * |b| := mul_nonneg (sub_nonneg.mpr hs) (abs_nonneg b) + linarith [magneticBiasObjective_lower h s b] + · have h0 := constrainedFieldValue_le_trial h hs 0 + simp only [zero_mul, sub_zero] at h0 + exact h0.trans (fieldValue_nonpos h) + +lemma concaveOn_constrainedFieldValue_magnetization (h : FieldStep) : + ConcaveOn ℝ (Icc (-1 : ℝ) 1) (constrainedFieldValue h) := by + refine ⟨convex_Icc _ _, ?_⟩ + intro s hs t ht a b ha hb hab + have hs' : |s| ≤ 1 := abs_le.mpr hs + have ht' : |t| ≤ 1 := abs_le.mpr ht + apply le_csInf (range_nonempty _) + rintro _ ⟨c, rfl⟩ + have hsc := mul_le_mul_of_nonneg_left (constrainedFieldValue_le_trial h hs' c) ha + have htc := mul_le_mul_of_nonneg_left (constrainedFieldValue_le_trial h ht' c) hb + simp only [smul_eq_mul, magneticBiasObjective] + calc + a * constrainedFieldValue h s + b * constrainedFieldValue h t ≤ + a * (fieldValue h c - c * s) + b * (fieldValue h c - c * t) := add_le_add hsc htc + _ = (a + b) * fieldValue h c - c * (a * s + b * t) := by ring + _ = fieldValue h c - c * (a * s + b * t) := by rw [hab, one_mul] + +lemma constrainedFieldValue_bias_support (h : FieldStep) {s t b : ℝ} + (ht : |t| ≤ 1) + (hmin : ∀ c, magneticBiasObjective h s b ≤ magneticBiasObjective h s c) : + constrainedFieldValue h t ≤ constrainedFieldValue h s - b * (t - s) := by + rw [constrainedFieldValue_eq_at_minimum h hmin] + have h := constrainedFieldValue_le_trial h ht b + unfold magneticBiasObjective + linarith + +/-- An explicit local Lipschitz bound uniform over all field partitions +whose total height is bounded. -/ +lemma constrainedFieldValue_magnetization_lipschitz (h : FieldStep) + {s t r C : ℝ} (hr : r < 1) (hs : |s| ≤ r) (ht : |t| ≤ r) + (hC : h.height (Fin.last h.depth) ≤ C) : + |constrainedFieldValue h s - constrainedFieldValue h t| ≤ + ((Real.log 2 + C / 2) / (1 - r)) * |s - t| := by + obtain ⟨b, hb⟩ := exists_magneticBias_minimum h (hs.trans_lt hr) + obtain ⟨c, hc⟩ := exists_magneticBias_minimum h (ht.trans_lt hr) + have hδ : 0 < 1 - r := sub_pos.mpr hr + have hM : 0 ≤ Real.log 2 + C / 2 := by + have hc0 := (h.nonneg (Fin.last h.depth)).trans hC + positivity + have hbb := magneticBias_minimum_bound h (hs.trans_lt hr) hC hb + have hcc := magneticBias_minimum_bound h (ht.trans_lt hr) hC hc + have hbs : |b| ≤ (Real.log 2 + C / 2) / (1 - r) := hbb.trans + (div_le_div_of_nonneg_left hM hδ (by linarith)) + have hct : |c| ≤ (Real.log 2 + C / 2) / (1 - r) := hcc.trans + (div_le_div_of_nonneg_left hM hδ (by linarith)) + have hst := constrainedFieldValue_bias_support h (ht.trans hr.le) hb + have hts := constrainedFieldValue_bias_support h (hs.trans hr.le) hc + rw [abs_le] + constructor + · have hp : -(b * (t - s)) ≤ + ((Real.log 2 + C / 2) / (1 - r)) * |s - t| := by + calc + _ ≤ |b * (t - s)| := neg_le_abs _ + _ = |b| * |s - t| := by rw [abs_mul, abs_sub_comm] + _ ≤ _ := mul_le_mul_of_nonneg_right hbs (abs_nonneg _) + linarith + · have hp : -c * (s - t) ≤ + ((Real.log 2 + C / 2) / (1 - r)) * |s - t| := by + calc + _ ≤ |-c * (s - t)| := le_abs_self _ + _ = |c| * |s - t| := by rw [abs_mul, abs_neg] + _ ≤ _ := mul_le_mul_of_nonneg_right hct (abs_nonneg _) + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldPopulationLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldPopulationLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e5fb1318d433cde5fb74d92de51436d2674a237 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldPopulationLower.lean @@ -0,0 +1,92 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCountTemplateLower +import OAI.Probability.InvariantIsing.Magnetic.MagneticPopulationContinuity +import OAI.Probability.InvariantIsing.Fields.PhysicalFieldPopulationComparison + +namespace OAI + +/-! Arbitrary positive real field populations are reached from rational +field blocks by quantitative pressure and variational comparisons. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_rational_spectrum_field_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (γ : A → ℝ) (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + : ∀ ε > 0, ∀ᶠ M in atTop, + (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal-ε ≤ + ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M := by + have hA : Nonempty A := by + by_contra h + have : IsEmpty A := not_nonempty_iff.mp h + simp at hγsum + let a0 : A := Classical.choice hA + let τ := fieldApproxWeights γ + have hτ := fieldApproxWeights_tendsto γ (fun a => (hγ a).le) hγsum + have hτpos j a : 0 < τ j a := fieldApproxWeights_pos a0 γ j a + have hτsum j : ∑ a, τ j a=1 := fieldApproxWeights_sum a0 γ j + let R := finiteR ρ lam hρ hsum + let F := (finiteMagneticFunctional R γ b).toReal + let Fq := fun j => (finiteMagneticFunctional R (τ j) b).toReal + have hF : Tendsto Fq atTop (𝓝 F) := finiteMagneticFunctional_tendsto_populations + ρ lam hρ hsum τ γ b hτpos hτsum hγ hγsum hτ + have hErr : Tendsto (fun j => 2*D*(∑ a, |γ a-τ j a|)) atTop (𝓝 0) := by + have hh := (tendsto_finsetSum Finset.univ (fun a _ => + ((tendsto_const_nhds (x := γ a)).sub ((tendsto_pi_nhds.mp hτ) a)).abs)).const_mul (2*D) + simpa only [sub_self,abs_zero,Finset.sum_const_zero,mul_zero] using hh + intro ε hε + obtain ⟨j,hjErr,hjF⟩ := ((hErr.eventually (Iio_mem_nhds (show 0<ε/4 by positivity))).and + (Metric.tendsto_nhds.mp hF (ε/4) (by positivity))).exists + let w := fun a => positiveApproxCount (γ a) j + have hd : 0 < ∑ a, w a := fieldApproxDenominator_pos a0 γ j + have hw a : (w a : ℝ)=(∑ a, w a : ℕ)*τ j a := by + dsimp only [τ,fieldApproxWeights,w,fieldApproxDenominator] + exact (mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hd.ne')).symm + let cg := canonicalFieldLabel a0 w + have hc : Tendsto (fun M a => (spinGroupSize (cg M) a : ℝ)/M) atTop (𝓝 (τ j)) := + canonicalFieldLabel_population a0 w hd + have hlo := finite_count_template_pressure_lower hhaar hgauss hpub hm hn + ρ lam hρ hsum hK hlam amax hmax μ spec hsp hspec hρspec e he w hd + (τ j) (fun a => (hτpos j a).le) (hτsum j) hw cg b hc hD hb (ε/4) (by positivity) + have hcomp := physical_mean_field_population_comparison (fun k => k+1) (fun _ => by omega) + (fun k => μ (k+1)) (fun k i => lam (e (k+1) i)) (fun k => g (k+1)) + (fun k => cg (k+1)) γ (τ j) b (hg.comp (tendsto_add_atTop_nat 1)) + (hc.comp (tendsto_add_atTop_nat 1)) hD hb (ε/4) (by positivity) + let P := fun M => ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M + have hev : ∀ᶠ k in atTop, F-ε≤P (k+1) := by + filter_upwards [(tendsto_add_atTop_nat 1).eventually hlo,hcomp] with k hk hck + have hh := (abs_le.mp hck).1 + rw [Real.dist_eq] at hjF + have hFq := (abs_lt.mp hjF).1 + change Fq j-ε/4≤_ at hk + change -_ ≤ P (k+1)-_ at hh + linarith + obtain ⟨J,hJ⟩ := eventually_atTop.mp hev + apply eventually_atTop.mpr + refine ⟨J+1,fun M hM => ?_⟩ + obtain ⟨k,rfl⟩ : ∃ k, M=k+1 := ⟨M-1,(Nat.sub_add_cancel (by omega)).symm⟩ + exact hJ k (by omega) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldRadial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldRadial.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e3663dd0dd7aaf94ef3891e5ee310bcbd8d6812 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldRadial.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldInverseConvex +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledSquareOrder +import OAI.Probability.InvariantIsing.Fields.FieldRadialCovariance + +namespace OAI + +/-! Radial monotonicity of the finite prescribed-magnetization overlap. +The root bias is chosen at the fixed prescribed magnetization at every scale. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma squareContinuation_congr_list {L M : List (ℝ × ℝ≥0)} (he : L = M) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (i : Fin (L.length + 1)) (j : Fin (M.length + 1)) (hij : i.val = j.val) + (ζ v s : ℝ) : + magneticScalarSlabContinuation L (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ v s = + magneticScalarSlabContinuation M (magneticScalarSquareFourJet M hM j).toMagneticContinuationJet ζ v s := by + subst M + have hi : i = j := Fin.ext hij + subst j + rfl + +lemma magneticFieldLevel_eq_scaled (h : FieldStep) (c : ℝ≥0) + (i : Fin (h.depth + 1)) {s : ℝ} (hs : |s| < 1) : + magneticFieldLevel (fieldScaleCovariance h c) s i = + magneticScaledSquareContinuation (scalarFieldIncrements h) (scalarFieldIncrements_positive h) + c (Fin.cast (by rw [scalarFieldIncrements_length]) i) 0 (h.height 0, s) := by + rw [congrFun (magneticFieldLevel_eq_slab (fieldScaleCovariance h c) i) s] + unfold magneticScaledSquareContinuation magneticScaledSquareJet + rw [closedMagneticContinuation, ite_eq_left hs] + exact squareContinuation_congr_list (scalarFieldIncrements_scale h c) + (scalarFieldIncrements_positive (fieldScaleCovariance h c)) + (fieldScaleIncrements_positive c (scalarFieldIncrements h) (scalarFieldIncrements_positive h)) + _ _ rfl 0 ((c : ℝ) ^ 2 * h.height 0) s + +theorem magneticFieldLevel_radial (h : FieldStep) {α β : ℝ≥0} + (hα : 0 < α) (hαβ : α ≤ β) (i : Fin (h.depth + 1)) {s : ℝ} (hs : |s| < 1) : + magneticFieldLevel (fieldScaleCovariance h α) s i ≤ + magneticFieldLevel (fieldScaleCovariance h β) s i := by + rw [magneticFieldLevel_eq_scaled h α i hs, magneticFieldLevel_eq_scaled h β i hs] + exact magneticScaledSquareContinuation_mono (scalarFieldIncrements h) + (scalarFieldIncrements_positive h) (scalarFieldIncrements_exponent_le_one h) + hα hαβ _ (by norm_num) (by norm_num) (h.nonneg 0) + ⟨(abs_lt.mp hs).1.le, (abs_lt.mp hs).2.le⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldSubsequenceLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldSubsequenceLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..c18329e4fbea21d578967e827ea0b3b4f436e227 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldSubsequenceLower.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticConstrainedPressureLower +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureMean + +namespace OAI + +/-! The magnetic variational lower bound contributes to the full physical +pressure along a sequence of repeated finite field blocks. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_field_subsequence_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (b : A → ℝ) (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ ε > 0, ∀ᶠ j in atTop, + let q := m*N r-N r+N r+3 + let M := (q+j)*N r + let g := cavityRationalLabel (by omega : 0 < m) (spec r) (hspec r) M + L+(∑ a, γ a*b a*mag a)-ε ≤ ∫ V, rotatedPressure + (fun i => lam (g i)) (matrixRotation V⁻¹) + (consecutiveBlockField (q+j) (fun i => b (group r i))) ∂μ M := by + obtain ⟨r,hr⟩ := magnetic_physical_constrained_pressure_lower hhaar hgauss hpub hm + ρ lam hρ hsum hK hlam amax hmax μ N hN hNlim spec hsp hspec hρspec + group k hk γ mag hγ hγsum hcount hs hmag hc L hL + refine ⟨r,?_⟩ + intro ε hε + filter_upwards [hr ε hε] with j hj + let q := m*N r-N r+N r+3 + have hq : 0 < q+j := by dsimp only [q]; omega + let F := ∑ a, γ a*b a*mag a + have hM : ∀ σ ∈ spinGroupSlice (group r) (k r), + fieldEnergy (fun i => b (group r i)) σ=(N r : ℝ)*F := by + intro σ hσ + rw [fieldEnergy_on_group_slice (group r) (k r) b hσ, + spinGroupFieldConstant_magnetization (group r) (k r) b γ mag (hcount r) (hc r)] + have hh := mean_consecutive_field_pressure_lower (hN r) hq (μ ((q+j)*N r)) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (fun i => b (group r i)) ((N r : ℝ)*F) hM + (fun i => lam (cavityRationalLabel (by omega : 0 < m) (spec r) (hspec r) ((q+j)*N r) i)) + have hnz : (N r : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (hN r).ne' + rw [mul_div_cancel_left₀ _ hnz] at hh + change L-ε ≤ _ at hj + change L+F-ε ≤ _ + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldSymmetry.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldSymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9f05f2c2517ca1d275ecc1a9805b8b54597f380 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFieldSymmetry.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldInverse +import OAI.Probability.InvariantIsing.Fields.FieldScalarOrder + +namespace OAI + +/-! Spin-flip symmetry of the actual bias optimization and recovery of +the zero-magnetization scalar field functional. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma fieldValue_bias_even (h : FieldStep) : Function.Even (fieldValue h) := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + have he := fieldScalarValue_even (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth (fun z => by simp only [Real.cosh_neg]) + have hr := gaussianOperator_even 0 (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 he + intro b + rw [fieldValue_root, fieldValue_root] + exact congrArg (fun x => x - h.height (Fin.last h.depth) / 2) (hr b) + +lemma fieldBiasMean_zero (h : FieldStep) : fieldBiasMean h 0 = 0 := by + have hp := hasDerivAt_fieldValue_bias h 0 + have hp' : HasDerivAt (fieldValue h) (fieldBiasMean h 0) (-0) := by simpa using hp + have hn := hp'.comp 0 (hasDerivAt_neg (0 : ℝ)) + have hn' : HasDerivAt (fieldValue h) (-fieldBiasMean h 0) 0 := by + convert hn using 1 + · funext b + exact (fieldValue_bias_even h b).symm + · ring + linarith [hp.unique hn'] + +@[simp] lemma magneticBias_zero (h : FieldStep) : magneticBias h 0 = 0 := by + apply (strictMono_fieldBiasMean h).injective + rw [fieldBiasMean_magneticBias h (by norm_num), fieldBiasMean_zero] + +@[simp] lemma constrainedFieldValue_zero_magnetization (h : FieldStep) : + constrainedFieldValue h 0 = fieldValue h 0 := by + rw [constrainedFieldValue_magneticBias h (by norm_num), magneticBias_zero] + simp only [mul_zero, sub_zero] + +lemma magneticBiasObjective_reflect (h : FieldStep) (s b : ℝ) : + magneticBiasObjective h (-s) (-b) = magneticBiasObjective h s b := by + unfold magneticBiasObjective + rw [fieldValue_bias_even h b] + ring + +lemma constrainedFieldValue_even (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + constrainedFieldValue h (-s) = constrainedFieldValue h s := by + obtain ⟨b, hb⟩ := exists_magneticBias_minimum h hs + have hbr : ∀ c, magneticBiasObjective h (-s) (-b) ≤ magneticBiasObjective h (-s) c := by + intro c + have hh := hb (-c) + rw [magneticBiasObjective_reflect] + convert hh using 1 + rw [← magneticBiasObjective_reflect h s (-c)] + simp only [neg_neg] + rw [constrainedFieldValue_eq_at_minimum h hbr, + constrainedFieldValue_eq_at_minimum h hb, magneticBiasObjective_reflect] + +lemma magneticBias_odd (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + magneticBias h (-s) = -magneticBias h s := by + have hs' : |-s| < 1 := by simpa only [abs_neg] using hs + apply magneticBias_minimum_unique h (magneticBias_minimizes h hs') + intro c + have hh := magneticBias_minimizes h hs (-c) + rw [magneticBiasObjective_reflect] + convert hh using 1 + rw [← magneticBiasObjective_reflect h s (-c)] + simp only [neg_neg] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteAlphabet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteAlphabet.lean new file mode 100644 index 0000000000000000000000000000000000000000..08f52123e25deba1c4e90217705c5ac3ac5617fa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteAlphabet.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFinitePopulationLimit +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralMeasure + +namespace OAI + +/-! The finite-alphabet external-field formula also includes a one-point +spectral law, represented by two equal eigenvalue labels. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_alphabet_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (g : (M : ℕ) → Fin M → A) (γ b : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) : + Tendsto (fun M => ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M) atTop + (𝓝 (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal) := by + by_cases hm : 2 ≤ m + · exact finite_positive_field_pressure_tendsto hhaar hgauss hpub hm ρ lam hρ hsum μ e he + g γ b hγ hγsum hg + have hm0 : 0 < m := by + by_contra hn + have hz : m=0 := by omega + subst m + simp at hsum + have hm1 : m=1 := by omega + subst m + have hlam : lam=fun _ => lam 0 := funext fun a => congrArg lam (Subsingleton.elim a 0) + have hR : finiteR ρ lam hρ hsum=fun _ => lam 0 := by + funext x + rw [hlam] + exact finiteR_constant ρ hρ hsum x (lam 0) + let ρ' : Fin 2 → ℝ := fun _ => 1/2 + have hρ' a : 0 < ρ' a := by norm_num [ρ'] + have hsum' : ∑ a, ρ' a=1 := by norm_num [ρ',Fin.sum_univ_two] + let s : Fin 2 → ℕ := fun _ => 1 + have hs : ∑ a, s a=2 := by norm_num [s,Fin.sum_univ_two] + let e' := fun M => cavityResidueLabel (by omega : 0 < 2) s hs M + have he' : Tendsto (fun M a => (spinGroupSize (e' M) a : ℝ)/M) atTop (𝓝 ρ') := by + simpa only [s,ρ',Nat.cast_one,Nat.cast_ofNat,e',spinGroupSize,cavitySpectralGroup] using + cavity_canonical_mass_tendsto (by omega : 0 < 2) (by omega : 0 < 2) s hs + have hR' : finiteR ρ' (fun _ => lam 0) hρ' hsum'=fun _ => lam 0 := by + funext x + exact finiteR_constant ρ' hρ' hsum' x (lam 0) + have hh := finite_positive_field_pressure_tendsto hhaar hgauss hpub (by omega : 2 ≤ 2) + ρ' (fun _ => lam 0) hρ' hsum' μ e' he' g γ b hγ hγsum hg + rw [hR'] at hh + rw [hR] + have heig M : (fun i => lam (e M i))=(fun _ : Fin M => lam 0) := + funext fun i => congrArg lam (Subsingleton.elim (e M i) 0) + apply hh.congr + intro M + rw [heig M] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteFourth.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteFourth.lean new file mode 100644 index 0000000000000000000000000000000000000000..7112d00ec42b8edab9f201581166b9d0474f7505 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteFourth.lean @@ -0,0 +1,132 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRelativeFourth + +namespace OAI + +/-! Relative fourth derivatives for the actual finite Ising field recursion, +and the bounded coefficients needed for inverse-coordinate comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticFourthRatioCap : List (ℝ × ℝ≥0) → ℝ + | [] => 6 + | av :: L => magneticFourthRatioCap L + 8 * |av.1| * magneticThirdRatioCap L + + 3 * |av.1| + 37 * av.1 ^ 2 + +lemma magneticFourthRatioCap_nonneg (L : List (ℝ × ℝ≥0)) : + 0 ≤ magneticFourthRatioCap L := by + induction L with + | nil => norm_num [magneticFourthRatioCap] + | cons av L ih => + change 0 ≤ magneticFourthRatioCap L + 8 * |av.1| * magneticThirdRatioCap L + + 3 * |av.1| + 37 * av.1 ^ 2 + have ht := magneticThirdRatioCap_nonneg L + positivity + +lemma field_logCosh_fourth_relative (z : ℝ) : + |fieldLogCoshFourth z| ≤ 6 * (1 / (Real.cosh z) ^ 2) := by + let q := 1 / (Real.cosh z) ^ 2 + have hq : 0 ≤ q := by dsimp only [q]; positivity + have hq1 : q ≤ 1 := (le_abs_self q).trans (field_tanh_second_bound z) + have hm2 : (Real.tanh z) ^ 2 ≤ 1 := by + have h := pow_le_pow_left₀ (abs_nonneg _) (field_abs_tanh_le_one z) 2 + simpa only [sq_abs, one_pow] using h + change |-2 * q ^ 2 + 4 * (Real.tanh z) ^ 2 * q| ≤ 6 * q + have h1 : |-2 * q ^ 2| ≤ 2 * q := by + rw [abs_mul, abs_neg, abs_of_pos (by norm_num : (0 : ℝ) < 2), + abs_of_nonneg (sq_nonneg q)] + nlinarith + have h2 : |4 * (Real.tanh z) ^ 2 * q| ≤ 4 * q := by + rw [abs_of_nonneg (by positivity)] + nlinarith [mul_nonneg hq (sub_nonneg.mpr hm2)] + exact (abs_add_le _ _).trans (by linarith) + +theorem fieldScalarLogCoshFourth_relative (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hζ : ∀ av ∈ L, av.1 ≤ 1) (z : ℝ) : + |fieldScalarFourth L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) + (fun x => -2 * Real.tanh x / (Real.cosh x) ^ 2) fieldLogCoshFourth z| ≤ + magneticFourthRatioCap L * fieldScalarSecond L + (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) z := by + induction L generalizing z with + | nil => exact field_logCosh_fourth_relative z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have htζ := fun bv hb => hζ bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular L ht measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular L ht + have hr := fieldScalarThird_regular L ht measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound + have hterminal : Measurable fieldLogCoshFourth := by + unfold fieldLogCoshFourth + fun_prop + have hs := fieldScalarFourth_regular L ht measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) hterminal zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound field_logCosh_fourth_bound + have hq1 (x : ℝ) : fieldScalarSecond L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) x ≤ 1 := by + have hh := fieldScalarLogCoshSecond_le_spin_variance L ht htζ x + linarith [sq_nonneg (fieldScalarMean L (fun x => Real.log (Real.cosh x)) Real.tanh x)] + have hp := (hL av List.mem_cons_self).le + have he := fieldFourthTransform_relative_bound hp av.2 hv.1 hv.2 ha.1 hq.1 hr.1 hs.1 + ha.2 (fun x => (fieldScalarLogCoshSecond_pos L ht x).le) hq1 + (magneticThirdRatioCap_nonneg L) (magneticFourthRatioCap_nonneg L) + (fieldScalarLogCoshThird_relative L ht) (ih ht htζ) z + simpa only [fieldScalarFourth, fieldScalarSecond, fieldScalarMean, magneticFourthRatioCap, + abs_of_nonneg hp, fieldCurvatureTransform] using he + +lemma fieldBiasFourth_relative (h : FieldStep) (b : ℝ) : + |fieldBiasFourth h b| ≤ magneticFourthRatioCap (scalarFieldIncrements h) * + fieldBiasCurvature h b := by + have hL := scalarFieldIncrements_positive h + have hζ : ∀ av ∈ scalarFieldIncrements h, av.1 ≤ 1 := by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + change h.cut i.succ.castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + have hv := fieldScalarValue_regular _ hL measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular _ hL measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular _ hL + have hr := fieldScalarThird_regular _ hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound + have hterminal : Measurable fieldLogCoshFourth := by unfold fieldLogCoshFourth; fun_prop + have hs := fieldScalarFourth_regular _ hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) hterminal zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound field_logCosh_fourth_bound + have hq1 (x : ℝ) : fieldScalarSecond (scalarFieldIncrements h) + (fun x => Real.log (Real.cosh x)) Real.tanh (fun x => 1 / (Real.cosh x) ^ 2) x ≤ 1 := by + have hh := fieldScalarLogCoshSecond_le_spin_variance _ hL hζ x + linarith [sq_nonneg (fieldScalarMean (scalarFieldIncrements h) + (fun x => Real.log (Real.cosh x)) Real.tanh x)] + have he := fieldFourthTransform_relative_bound (by norm_num : (0 : ℝ) ≤ 0) + (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 hv.2 ha.1 hq.1 hr.1 hs.1 ha.2 + (fun x => (fieldScalarLogCoshSecond_pos _ hL x).le) hq1 + (magneticThirdRatioCap_nonneg _) (magneticFourthRatioCap_nonneg _) + (fieldScalarLogCoshThird_relative _ hL) (fieldScalarLogCoshFourth_relative _ hL hζ) b + simpa only [fieldFourthTransform, fieldTiltSpatial, fieldThirdTransform, + fieldCurvatureTransform, zero_mul, mul_zero, zero_pow (by decide : 2 ≠ 0), + add_zero, fieldBiasFourth, fieldBiasCurvature] using he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteLawExtension.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteLawExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..3abd455c85f0edf6ae345aadcb0b5fd836726159 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteLawExtension.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Fields.SimpleFieldTransport + +namespace OAI + +/-! The field-law extension agrees exactly with the finite variational formula. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology BigOperators Classical +namespace InvariantIsing + +variable (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) +include hcompact hbound ha hb + +lemma simpleFieldValue_eq_finite_law {Ω A : Type*} [MeasurableSpace Ω] [Fintype A] + (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) + (γ c : A → ℝ) (hγ : ∀ i, 0 < γ i) (hsum : ∑ i, γ i=1) + (he : P.map s=finiteSpectralMeasure γ c) : + simpleFieldValue P s (measureR (ν : Measure ℝ) b)= + (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal := by + apply measureMagnetic_eq_of_field_law_eq ν a b hcompact hbound ha hb + (fun i : SimpleFieldPositive P s => simpleFieldWeight P s i) (fun i => i.val.val) + γ c (fun i => i.property) hγ + (positiveSpectralWeights_sum _ (fun _ => measureReal_nonneg) (simpleFieldWeight_sum P s)) hsum + rw [← simpleField_law P s,he] + +lemma magneticFieldFunctional_eq_simple {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) + (μ : ProbabilityMeasure ℝ) (he : P.map s=(μ : Measure ℝ)) + (hμ : Integrable (fun x : ℝ => x) (μ : Measure ℝ)) : + magneticFieldFunctional (ν : Measure ℝ) b μ=simpleFieldValue P s (measureR (ν : Measure ℝ) b) := by + have herr := fieldSimpleApproximation_tendsto (μ : Measure ℝ) hμ + have hv := magneticFieldFunctional_approximation ν μ a b hcompact hbound ha hb hμ + have hdiff : Tendsto (fun n => simpleFieldValue (μ : Measure ℝ) (fieldSimpleApproximation n) + (measureR (ν : Measure ℝ) b)-simpleFieldValue P s (measureR (ν : Measure ℝ) b)) atTop (𝓝 0) := by + apply squeeze_zero_norm _ herr + intro n + have hm := simpleFieldValue_comp ν a b hcompact hbound ha hb P (μ : Measure ℝ) + s s.measurable he (fieldSimpleApproximation n) + rw [← hm,Real.norm_eq_abs] + refine (simpleFieldValue_abs_sub_le ν a b hcompact hbound ha hb P + ((fieldSimpleApproximation n).comp s s.measurable) s).trans_eq ?_ + rw [← he,integral_map s.aemeasurable] + · rfl + · exact (((fieldSimpleApproximation n).measurable.sub measurable_id).abs).aestronglyMeasurable + exact sub_eq_zero.mp (tendsto_nhds_unique (hv.sub_const _) hdiff) + +lemma magneticFieldFunctional_finite {A : Type*} [Fintype A] + (γ c : A → ℝ) (hγ : ∀ i, 0 < γ i) (hsum : ∑ i, γ i=1) + (μ : ProbabilityMeasure ℝ) (he : (μ : Measure ℝ)=finiteSpectralMeasure γ c) : + magneticFieldFunctional (ν : Measure ℝ) b μ= + (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal := by + let : MeasurableSpace A := ⊤ + let P : Measure A := Measure.sum fun i => ENNReal.ofReal (γ i) • Measure.dirac i + let : IsProbabilityMeasure P := HasSum.isProbabilityMeasure_sum_dirac + (fun i => (hγ i).le) (by simpa only [hsum] using hasSum_fintype γ) + let s := SimpleFunc.ofFinite c + have hp : P.map s=(μ : Measure ℝ) := by + rw [he] + change P.map (c ∘ id)=_ + have hh := finiteIndex_map P id measurable_id c + have hw : finiteIndexWeight P id=γ := by + funext i + change (P.real {i})=γ i + simp [P,measureReal_def,Pi.single_apply,(hγ i).le] + rw [hw] at hh + exact hh + have hi : Integrable (fun x : ℝ => x) (μ : Measure ℝ) := by + rw [← hp] + exact (integrable_map_measure aestronglyMeasurable_id s.aemeasurable).mpr + (simpleField_integrable P s) + rw [magneticFieldFunctional_eq_simple ν a b hcompact hbound ha hb P s μ hp hi] + exact simpleFieldValue_eq_finite_law ν a b hcompact hbound ha hb P s γ c hγ hsum (hp.trans he) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFinitePopulationLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFinitePopulationLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..c79c439b23ad54ea4d7bb5489fd6f1095105025c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFinitePopulationLimit.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpectralPopulationLower +import OAI.Probability.InvariantIsing.Magnetic.MagneticPhysicalFieldUpper + +namespace OAI + +/-! The full finite-alphabet external-field pressure formula with arbitrary +positive real spectral and field populations. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_positive_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (g : (M : ℕ) → Fin M → A) (γ b : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) : + Tendsto (fun M => ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M) atTop + (𝓝 (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal) := by + let K := ∑ a, |lam a| + have hK : 0 ≤ K := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hlam a : |lam a|≤K := Finset.single_le_sum (f := fun a => |lam a|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ a) + obtain ⟨amax,_,hmax⟩ := Finset.exists_max_image Finset.univ lam + ⟨⟨0,by omega⟩,Finset.mem_univ _⟩ + let D := ∑ a, |b a| + have hD : 0 ≤ D := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hb a : |b a|≤D := Finset.single_le_sum (f := fun a => |b a|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ a) + have hlo := finite_physical_field_pressure_lower hhaar hgauss hpub hm ρ lam hρ hsum + hK hlam amax (fun a => hmax a (Finset.mem_univ _)) μ e he γ hγ hγsum g b hg hD hb + have hup := finite_physical_field_pressure_upper hhaar hgauss ρ lam hρ hsum μ e he + g γ b hγ hγsum hg + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [hlo (ε/2) (half_pos hε),hup (ε/2) (half_pos hε)] with M hl hu + rw [Real.dist_eq,abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTemplateLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTemplateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..516cb13159e91a5787698f6b8fb06dbc0f52b41c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTemplateLimit.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteTemplateLower +import OAI.Probability.InvariantIsing.Magnetic.MagneticPhysicalFieldUpper + +namespace OAI + +/-! Conditional full-sequence pressure convergence for a finite spectral +and external-field template. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_template_magnetic_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin n → A) (γ : A → ℝ) (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=n*γ a) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + : Tendsto (fun M => ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M) atTop + (𝓝 (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal) := by + have hlo := finite_template_magnetic_pressure_lower hhaar hgauss hpub hm hn + ρ lam hρ hsum hK hlam amax hmax μ spec hsp hspec hρspec e he group γ + (fun a => (hγ a).le) hγsum hcount g b hg hD hb + have hup := finite_physical_field_pressure_upper hhaar hgauss ρ lam hρ hsum μ e he + g γ b hγ hγsum hg + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [hlo (ε/2) (half_pos hε),hup (ε/2) (half_pos hε)] with M hl hu + rw [Real.dist_eq,abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTemplateLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTemplateLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..cfbf9534b68f107079f1480f5ec9febf8e68b386 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTemplateLower.lean @@ -0,0 +1,69 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRationalTemplateLower +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalContinuity +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalBounds + +namespace OAI + +/-! The full rational magnetization supremum is a lower bound for physical +pressure whenever the spectral and field populations have a finite template. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_template_magnetic_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin n → A) (γ : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=n*γ a) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + : ∀ ε > 0, ∀ᶠ M in atTop, + (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal-ε ≤ + ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M := by + intro ε hε + let R := finiteR ρ lam hρ hsum + let F := (finiteMagneticFunctional R γ b).toReal + have hr := finiteVariational_ne_top_bot ρ lam hρ hsum + have hf := finiteMagneticFunctional_ne_top_bot R γ b hγ hγsum hr.1 hr.2 + have hlt : ((F-ε/3 : ℝ) : EReal) (mag.val a : ℝ)) hγ hγsum (fun a => (mag.property a).le) + change ((F-ε/3 : ℝ) : EReal)< + ((∑ a, γ a*b a*(mag.val a : ℝ) : ℝ) : EReal)+ + magneticVariationalFunctional R γ (fun a => (mag.val a : ℝ)) at hmag + rw [← EReal.coe_toReal hmfin.1 hmfin.2,← EReal.coe_add] at hmag + have hmag' := EReal.coe_lt_coe_iff.mp hmag + let V := (magneticVariationalFunctional R γ (fun a => (mag.val a : ℝ))).toReal + have hevent := magnetic_rational_template_pressure_lower hhaar hgauss hpub hm hn + ρ lam hρ hsum hK hlam amax hmax μ spec hsp hspec hρspec e he group γ hγ hγsum + hcount mag g b hg hD hb (V-ε/3) (by dsimp only [V,R]; linarith) (ε/3) (by positivity) + filter_upwards [hevent] with M hM + change F-ε ≤ _ + change V-ε/3+(∑ a, γ a*b a*(mag.val a : ℝ))-ε/3 ≤ _ at hM + change F-ε/3<(∑ a, γ a*b a*(mag.val a : ℝ))+V at hmag' + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTrial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTrial.lean new file mode 100644 index 0000000000000000000000000000000000000000..58ca533a744e6654d988ba3b0aba5382ae4ba09e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteTrial.lean @@ -0,0 +1,34 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalBounds +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalContinuity + +namespace OAI + +/-! Each rational magnetic trial lies below the finite-field variational supremum. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma finiteMagnetic_trial_le {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0<ρ a) (hsum : ∑ a, ρ a=1) + (γ b : A → ℝ) (hγ : ∀ a, 0≤γ a) (hγsum : ∑ a, γ a=1) + (q : RationalMagnetization A) : + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ (fun a => (q.val a:ℝ))).toReal+ + (∑ a, γ a*b a*(q.val a:ℝ)) ≤ + (finiteMagneticFunctional (finiteR ρ eig hρ hsum) γ b).toReal := by + have hm := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum γ + (fun a => (q.val a:ℝ)) hγ hγsum (fun a => (q.property a).le) + have hv := finiteVariational_ne_top_bot ρ eig hρ hsum + have hf := finiteMagneticFunctional_ne_top_bot (finiteR ρ eig hρ hsum) γ b hγ hγsum hv.1 hv.2 + have hi := le_iSup (fun q : RationalMagnetization A => + ((∑ a, γ a*b a*(q.val a:ℝ) : ℝ) : EReal)+ + magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ (fun a => (q.val a:ℝ))) q + change _≤finiteMagneticFunctional (finiteR ρ eig hρ hsum) γ b at hi + rw [←EReal.coe_toReal hm.1 hm.2,←EReal.coe_toReal hf.1 hf.2,←EReal.coe_add] at hi + have := EReal.coe_le_coe_iff.mp hi + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteType.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteType.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ee23f5d03e52429a0bc795a3ab1a707bd8f91f1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFiniteType.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteAlphabet +import OAI.Probability.InvariantIsing.Core.FiniteTypePressure + +namespace OAI + +/-! The external-field formula with a general finite type of spectral labels. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Classical BigOperators +namespace InvariantIsing + +theorem finite_type_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {ι : Type*} [Fintype ι] + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (lam : ι → ℝ) + (g : (N : ℕ) → Fin N → ι) + (w : ι → ℝ) (hw : ∀ a, 0 < w a) (hsum : ∑ a, w a=1) + (hlim : Tendsto (fun N a => (spectralLabelCount (g N) a : ℝ)/N) atTop (𝓝 w)) + (aMax : ι) (hMax : ∀ a, lam a ≤ lam aMax) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ b : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ V, rotatedPressure (fun i => lam (g N i)) + (matrixRotation V⁻¹) (fun i => b (group N i)) ∂μ N) atTop + (𝓝 (finiteMagneticFunctional (measureR (finiteSpectralMeasure w lam) (lam aMax)) γ b).toReal) := by + let e := Fintype.equivFin ι + let wf := w ∘ e.symm + let lf := lam ∘ e.symm + have hwp : ∀ a, 0 < wf a := fun a => hw (e.symm a) + have hws : ∑ a, wf a=1 := (e.symm.sum_comp w).trans hsum + have hl : Tendsto (fun N a => + ((cavitySpectralGroup (fun i => e (g N i)) a).card : ℝ)/N) atTop (𝓝 wf) := by + apply tendsto_pi_nhds.mpr + intro a + change Tendsto (fun N => ((cavitySpectralGroup (fun i => e (g N i)) a).card : ℝ)/N) + atTop (𝓝 (w (e.symm a))) + convert (tendsto_pi_nhds.mp hlim) (e.symm a) using 1 + funext N + congr 2 + apply congrArg Finset.card + ext i + simp only [cavitySpectralGroup,Finset.mem_filter,Finset.mem_univ, + true_and,← e.eq_symm_apply] + have hh := finite_alphabet_field_pressure_tendsto hhaar hgauss hpub wf lf hwp hws μ + (fun N i => e (g N i)) hl group γ b hγ hγsum hgroup + have hR : measureR (finiteSpectralMeasure w lam) (lam aMax)=finiteR wf lf hwp hws := by + funext x + rw [← finiteSpectralMeasure_equiv e.symm w lam] + have he := measureR_finiteSpectralMeasure wf lf hwp hws (e aMax) + (fun a => by simpa only [lf,Function.comp_apply,e.symm_apply_apply] using hMax (e.symm a)) x + simpa only [lf,Function.comp_apply,e.symm_apply_apply] using he + rw [hR] + convert hh using 1 + funext N + simp only [lf,Function.comp_apply,e.symm_apply_apply] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFourJet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFourJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3527a1b05a71ed323938fd6e0acd940c12426a0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFourJet.lean @@ -0,0 +1,137 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticJetProduct + +namespace OAI + +/-! One additional bounded spatial derivative, exactly as needed to +differentiate the inverse-coordinate curvature equation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +structure MagneticContinuationFourJet extends MagneticContinuationJet where + fourth : ℝ → ℝ + mFourth : Measurable fourth + bFourth : MagneticContinuationBound fourth + dThird : ∀ z, HasDerivAt third (fourth z) z + +namespace MagneticContinuationFourJet + +def slope (A : MagneticContinuationFourJet) : MagneticContinuationJet where + value := A.first + first := A.second + second := A.third + third := A.fourth + mValue := A.mFirst + mFirst := A.mSecond + mSecond := A.mThird + mThird := A.mFourth + bValue := A.bFirst + bFirst := A.bSecond + bSecond := A.bThird + bThird := A.bFourth + dValue := A.dFirst + dFirst := A.dSecond + dSecond := A.dThird + +def square (A : MagneticContinuationFourJet) : MagneticContinuationFourJet where + toMagneticContinuationJet := A.toMagneticContinuationJet.square + fourth := fun z => 6 * (A.second z) ^ 2 + 8 * A.first z * A.third z + 2 * A.value z * A.fourth z + mFourth := ((measurable_const.mul (A.mSecond.pow_const 2)).add + ((measurable_const.mul A.mFirst).mul A.mThird)).add + ((measurable_const.mul A.mValue).mul A.mFourth) + bFourth := by + have h2 : MagneticContinuationBound (fun z => (A.second z) ^ 2) := by + simpa only [pow_two] using A.bSecond.mul A.bSecond + exact (((MagneticContinuationBound.const 6).mul h2).add + (((MagneticContinuationBound.const 8).mul A.bFirst).mul A.bThird)).add + (((MagneticContinuationBound.const 2).mul A.bValue).mul A.bFourth) + dThird := fun z => by + convert (((A.dFirst z).const_mul 6).mul (A.dSecond z)).add + (((A.dValue z).const_mul 2).mul (A.dThird z)) using 1 + · funext y + dsimp only [MagneticContinuationJet.square, Pi.add_apply, Pi.mul_apply] + · ring + +def transitionFourth (A : MagneticContinuationFourJet) (P : MagneticContinuationJet) + (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (z : ℝ) : ℝ := + let U := A.toMagneticContinuationJet.transition P ζ v F hF hG dF + let V := P.transition P ζ v F hF hG dF + let W := (A.toMagneticContinuationJet.mul P).transition P ζ v F hF hG dF + let R := A.slope.transition P ζ v F hF hG dF + R.third z + ζ * (W.third z - (U.third z * V.value z + + 3 * U.second z * V.first z + 3 * U.first z * V.second z + U.value z * V.third z)) + +lemma transition_third_eq (A : MagneticContinuationFourJet) (P : MagneticContinuationJet) + (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : + let U := A.toMagneticContinuationJet.transition P ζ v F hF hG dF + let V := P.transition P ζ v F hF hG dF + let W := (A.toMagneticContinuationJet.mul P).transition P ζ v F hF hG dF + let R := A.slope.transition P ζ v F hF hG dF + U.third = fun z => R.second z + ζ * (W.second z - + (U.second z * V.value z + 2 * U.first z * V.first z + U.value z * V.second z)) := by + rfl + +lemma transitionFourth_measurable (A : MagneticContinuationFourJet) (P : MagneticContinuationJet) + (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : + Measurable (A.transitionFourth P ζ v F hF hG dF) := by + let U := A.toMagneticContinuationJet.transition P ζ v F hF hG dF + let V := P.transition P ζ v F hF hG dF + let W := (A.toMagneticContinuationJet.mul P).transition P ζ v F hF hG dF + let R := A.slope.transition P ζ v F hF hG dF + exact R.mThird.add ((W.mThird.sub ((((U.mThird.mul V.mValue).add + ((measurable_const.mul U.mSecond).mul V.mFirst)).add + ((measurable_const.mul U.mFirst).mul V.mSecond)).add (U.mValue.mul V.mThird))).const_mul ζ) + +lemma transitionFourth_bounded (A : MagneticContinuationFourJet) (P : MagneticContinuationJet) + (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : + MagneticContinuationBound (A.transitionFourth P ζ v F hF hG dF) := by + let U := A.toMagneticContinuationJet.transition P ζ v F hF hG dF + let V := P.transition P ζ v F hF hG dF + let W := (A.toMagneticContinuationJet.mul P).transition P ζ v F hF hG dF + let R := A.slope.transition P ζ v F hF hG dF + exact R.bThird.add ((MagneticContinuationBound.const ζ).mul + (W.bThird.sub ((((U.bThird.mul V.bValue).add + (((MagneticContinuationBound.const 3).mul U.bSecond).mul V.bFirst)).add + (((MagneticContinuationBound.const 3).mul U.bFirst).mul V.bSecond)).add + (U.bValue.mul V.bThird)))) + +lemma transition_hasDerivAt_third (A : MagneticContinuationFourJet) (P : MagneticContinuationJet) + (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (z : ℝ) : + HasDerivAt (A.toMagneticContinuationJet.transition P ζ v F hF hG dF).third + (A.transitionFourth P ζ v F hF hG dF z) z := by + let U := A.toMagneticContinuationJet.transition P ζ v F hF hG dF + let V := P.transition P ζ v F hF hG dF + let W := (A.toMagneticContinuationJet.mul P).transition P ζ v F hF hG dF + let R := A.slope.transition P ζ v F hF hG dF + rw [transition_third_eq] + have hd := (R.dSecond z).add (((W.dSecond z).sub + ((((U.dSecond z).mul (V.dValue z)).add + (((U.dFirst z).const_mul 2).mul (V.dFirst z))).add + ((U.dValue z).mul (V.dSecond z)))).const_mul ζ) + convert hd using 1 + dsimp only [transitionFourth] + ring + +def transition (A : MagneticContinuationFourJet) (P : MagneticContinuationJet) + (ζ : ℝ) (v : ℝ≥0) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : MagneticContinuationFourJet where + toMagneticContinuationJet := A.toMagneticContinuationJet.transition P ζ v F hF hG dF + fourth := A.transitionFourth P ζ v F hF hG dF + mFourth := A.transitionFourth_measurable P ζ v F hF hG dF + bFourth := A.transitionFourth_bounded P ζ v F hF hG dF + dThird := A.transition_hasDerivAt_third P ζ v F hF hG dF + +end MagneticContinuationFourJet +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFourthCumulant.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFourthCumulant.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac252390621e28493be3729c814b487ed46c5896 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFourthCumulant.lean @@ -0,0 +1,129 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRelativeThird + +namespace OAI + +/-! The actual fourth-derivative recursion in centered-cumulant form. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma fieldFourthTransform_centered (ζ : ℝ) (v : ℝ≥0) + {F M Q R S : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) + (bM : ∀ x, |M x| ≤ 1) {C D : ℝ} + (bQ : ∀ x, |Q x| ≤ C) (bR : ∀ x, |R x| ≤ D) (z : ℝ) : + fieldFourthTransform ζ v F M Q R S z = + fieldSpinTransition ζ v F S z + + 4 * ζ * (fieldSpinTransition ζ v F (fun x => R x * M x) z - + fieldSpinTransition ζ v F R z * fieldSpinTransition ζ v F M z) + + 3 * ζ * (fieldSpinTransition ζ v F (fun x => (Q x) ^ 2) z - + (fieldSpinTransition ζ v F Q z) ^ 2) + + 6 * ζ ^ 2 * (fieldSpinTransition ζ v F + (fun x => Q x * (M x - fieldSpinTransition ζ v F M z) ^ 2) z - + fieldSpinTransition ζ v F Q z * fieldSpinTransition ζ v F + (fun x => (M x - fieldSpinTransition ζ v F M z) ^ 2) z) + + ζ ^ 3 * (fieldSpinTransition ζ v F + (fun x => (M x - fieldSpinTransition ζ v F M z) ^ 4) z - + 3 * (fieldSpinTransition ζ v F + (fun x => (M x - fieldSpinTransition ζ v F M z) ^ 2) z) ^ 2) := by + let μ := (gaussianReal z v).tilted (fun x => ζ * F x) + have : IsProbabilityMeasure μ := isProbabilityMeasure_tilted + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG ζ) + let T := fun a : ℝ → ℝ => fieldSpinTransition ζ v F a z + have bRM : ∀ x, |R x * M x| ≤ D := by + intro x + rw [abs_mul] + exact (mul_le_mul_of_nonneg_left (bM x) (abs_nonneg _)).trans (by simpa using bR x) + have bQ2 : ∀ x, |(Q x) ^ 2| ≤ C ^ 2 := by + intro x + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (bQ x) 2 + have hRMQ : T (fun x => R x * M x + Q x * Q x) = + T (fun x => R x * M x) + T (fun x => (Q x) ^ 2) := by + change fieldSpinTransition ζ v F (fun x => R x * M x + Q x * Q x) z = _ + simp only [← pow_two] + exact fieldSpinTransition_add ζ v hF hG (hR.mul hM) (hQ.pow_const 2) bRM bQ2 z + have h2QR : T (fun x => 2 * Q x * Q x + 2 * M x * R x) = + 2 * T (fun x => (Q x) ^ 2) + 2 * T (fun x => R x * M x) := by + have he : (fun x => 2 * Q x * Q x + 2 * M x * R x) = + fun x => 2 * ((Q x) ^ 2 + R x * M x) := by funext x; ring + rw [he] + change fieldSpinTransition ζ v F (fun x => 2 * ((Q x) ^ 2 + R x * M x)) z = _ + rw [fieldSpinTransition_const_mul] + have hadd := fieldSpinTransition_add ζ v hF hG (hQ.pow_const 2) (hR.mul hM) bQ2 bRM z + change fieldSpinTransition ζ v F (fun x => (Q x) ^ 2 + R x * M x) z = + fieldSpinTransition ζ v F (fun x => (Q x) ^ 2) z + + fieldSpinTransition ζ v F (fun x => R x * M x) z at hadd + rw [hadd] + dsimp only [T] + ring + have h2MQ : T (fun x => 2 * M x * Q x) = 2 * T (fun x => Q x * M x) := by + change (∫ x, 2 * M x * Q x ∂μ) = 2 * ∫ x, Q x * M x ∂μ + rw [← integral_const_mul] + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have h3M2Q : T (fun x => 3 * (M x) ^ 2 * Q x) = 3 * T (fun x => Q x * (M x) ^ 2) := by + change (∫ x, 3 * (M x) ^ 2 * Q x ∂μ) = 3 * ∫ x, Q x * (M x) ^ 2 ∂μ + rw [← integral_const_mul] + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have h2MQM : T (fun x => (2 * M x * Q x) * M x) = 2 * T (fun x => Q x * (M x) ^ 2) := by + change (∫ x, (2 * M x * Q x) * M x ∂μ) = 2 * ∫ x, Q x * (M x) ^ 2 ∂μ + rw [← integral_const_mul] + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have hQMM : T (fun x => (Q x * M x) * M x) = T (fun x => Q x * (M x) ^ 2) := by + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have hM3 : T (fun x => (M x) ^ 2 * M x) = T (fun x => (M x) ^ 3) := by + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have hM4 : T (fun x => ((M x) ^ 2 * M x) * M x) = T (fun x => (M x) ^ 4) := by + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have hc2 := magnetic_centered_second μ hM bM + have hc4 := magnetic_centered_fourth μ hM bM + have hqc2 := magnetic_weighted_centered_second μ hM hQ bM bQ + change T (fun x => (M x - T M) ^ 2) = T (fun x => (M x) ^ 2) - (T M) ^ 2 at hc2 + change T (fun x => (M x - T M) ^ 4) = T (fun x => (M x) ^ 4) - + 4 * T M * T (fun x => (M x) ^ 3) + 6 * (T M) ^ 2 * T (fun x => (M x) ^ 2) - + 3 * (T M) ^ 4 at hc4 + change T (fun x => Q x * (M x - T M) ^ 2) = T (fun x => Q x * (M x) ^ 2) - + 2 * T M * T (fun x => Q x * M x) + (T M) ^ 2 * T Q at hqc2 + change _ = T S + 4 * ζ * (T (fun x => R x * M x) - T R * T M) + + 3 * ζ * (T (fun x => (Q x) ^ 2) - (T Q) ^ 2) + + 6 * ζ ^ 2 * (T (fun x => Q x * (M x - T M) ^ 2) - + T Q * T (fun x => (M x - T M) ^ 2)) + + ζ ^ 3 * (T (fun x => (M x - T M) ^ 4) - + 3 * (T (fun x => (M x - T M) ^ 2)) ^ 2) + rw [hc2, hc4, hqc2] + unfold fieldFourthTransform fieldTiltSpatial fieldCurvatureTransform fieldThirdTransform + change T S + ζ * (T (fun x => R x * M x) - T R * T M) + + ζ * ((T (fun x => R x * M x + Q x * Q x) + + ζ * (T (fun x => (Q x * M x) * M x) - T (fun x => Q x * M x) * T M)) - + ((T R + ζ * (T (fun x => Q x * M x) - T Q * T M)) * T M + + T Q * (T Q + ζ * (T (fun x => (M x) ^ 2) - (T M) ^ 2)))) + + ζ * ((T (fun x => 2 * Q x * Q x + 2 * M x * R x) + + ζ * (T (fun x => (2 * M x * Q x) * M x) - T (fun x => 2 * M x * Q x) * T M) + + ζ * ((T (fun x => 3 * (M x) ^ 2 * Q x) + + ζ * (T (fun x => ((M x) ^ 2 * M x) * M x) - T (fun x => (M x) ^ 2 * M x) * T M)) - + ((T (fun x => 2 * M x * Q x) + + ζ * (T (fun x => (M x) ^ 2 * M x) - T (fun x => (M x) ^ 2) * T M)) * T M + + T (fun x => (M x) ^ 2) * (T Q + ζ * (T (fun x => (M x) ^ 2) - (T M) ^ 2))))) - + 2 * ((T Q + ζ * (T (fun x => (M x) ^ 2) - (T M) ^ 2)) * + (T Q + ζ * (T (fun x => (M x) ^ 2) - (T M) ^ 2)) + + T M * ((T R + ζ * (T (fun x => Q x * M x) - T Q * T M)) + + ζ * ((T (fun x => 2 * M x * Q x) + + ζ * (T (fun x => (M x) ^ 2 * M x) - T (fun x => (M x) ^ 2) * T M)) - + 2 * T M * (T Q + ζ * (T (fun x => (M x) ^ 2) - (T M) ^ 2)))))) = _ + rw [hRMQ, h2QR, h2MQ, h3M2Q, h2MQM, hQMM, hM4, hM3] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFullFieldUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFullFieldUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1aef635f5d66a1d818f3affbc34e7acbcc21314 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticFullFieldUpper.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRoundedFieldUpper +import OAI.Probability.InvariantIsing.Magnetic.MagneticCoverDistance +import OAI.Probability.InvariantIsing.Fields.SpinCoverParameters +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupRounding +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteTrial +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds +import OAI.Probability.InvariantIsing.Fields.SpinGroupFieldPressure +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureFluctuation + +namespace OAI + +/-! The finite-spectrum pressure upper bound after taking the path infimum, +under Haar and Gaussian concentration hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_fullField_pressure_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) + (γ b : A → ℝ) (hγ : ∀ a, 0<γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun k a => (spinGroupSize (group k) a:ℝ)/(N k:ℝ)) atTop (𝓝 γ)) + : ∀ ε : ℝ, 0<ε → ∀ᶠ k in atTop, + (∫ U, rotatedPressure (eig k) (specialRotation U) (fun i => b (group k i)) ∂μ k) ≤ + (finiteMagneticFunctional (finiteR ρ lam hρpos hρsum) γ b).toReal+ε := by + classical + intro ε hε + let V := (finiteMagneticFunctional (finiteR ρ lam hρpos hρsum) γ b).toReal + let C := ∑ a, |b a| + have hC : 0≤C := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hb a : |b a|≤C := Finset.single_le_sum (f := fun a => |b a|) (fun _ _ => abs_nonneg _) (Finset.mem_univ a) + obtain ⟨B,hB,hcoverBound⟩ := haar_finite_cover_mean_pressure_upper hhaar + obtain ⟨δ,t,hδ,ht,hsmall⟩ := exists_small_spinCover_error K C (show 0<ε/3 by positivity) + obtain ⟨Q,hQ,hnet⟩ := finite_rational_magnetization_cover (A := A) hδ + let S := fun k (q : RationalMagnetization A) => spinGroupSlice (group k) + (fun a => magneticRoundedCount (spinGroupSize (group k) a) (q.val a:ℝ)) + have hS k q : (S k q).Nonempty := spinGroupSlice_nonempty (group k) _ + (fun a => magneticRoundedCount_le _ (q.property a).le) + let d := fun k => ⌈δ*N k+Fintype.card A⌉₊ + have hproj k := magnetic_grid_projection (group k) hδ Q hnet + choose f hf hd using hproj + have hmeans : ∀ᶠ k in atTop, ∀ q∈Q, + (∫ U, restrictedRotatedPressure (S k q) (eig k) (specialRotation U) + (fun i => b (group k i)) ∂μ k)≤V+ε/3 := by + have hh (q : Q) := finiteSpectrum_magneticRoundedFieldPressure_upper hhaar hgauss + N hN hNlim m μ hμinv eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + group γ b hγ hγsum hgroup q.val (ε/3) (by positivity) + have hh' := (Filter.eventually_all).mpr hh + filter_upwards [hh'] with k hk q hq + exact hk ⟨q,hq⟩ + have herr := spinCover_error_tendsto N d (fun k => by have := hN k; omega) + hNlim Q.card B K C t δ + (magnetic_cover_distance_tendsto N (fun k => by have := hN k; omega) hNlim (Fintype.card A) hδ) + have hevent := herr.eventually (Iio_mem_nhds (show + 2*K*Real.sqrt δ+(2*C+t)*δ+Real.log (1+Real.exp (-t)) < + (2*K*Real.sqrt δ+(2*C+t)*δ+Real.log (1+Real.exp (-t)))+ε/3 by linarith)) + filter_upwards [hmeans,hevent] with k hk he + have hup := hcoverBound (N k) (hN k) (μ k) inferInstance (hμinv k) + (RationalMagnetization A) Q hQ (S k) (fun q _ => hS k q) (f k) (d k) (hf k) (hd k) + (eig k) (fun i => b (group k i)) K C t (V+ε/3) hK hC ht (heig k) + (fun i => hb (group k i)) hk + change (∫ U, rotatedPressure (eig k) (specialRotation U) (fun i => b (group k i)) ∂μ k)≤V+ε + dsimp only [d] at he hup + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianCovariance.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..98417796e4d0f4d9045d18abac15045afe467f16 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianCovariance.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGaussianMoments +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationTime +import OAI.Probability.InvariantIsing.Fields.FieldSecondCovariance + +namespace OAI + +/-! Scalar-coordinate form of the actual joint Gaussian continuation +differential. All integrability is supplied by bounded finite-spin jets. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticGaussianTime (ζ v : ℝ) (F M A B : ℝ → ℝ) (z : ℝ) : ℝ := + let ν := (gaussianReal 0 1).tilted (fun u => ζ * F (z + Real.sqrt v * u)) + (∫ u, B (z + Real.sqrt v * u) * ((1 / (2 * Real.sqrt v)) * u) ∂ν) + + ζ * ((∫ u, A (z + Real.sqrt v * u) * + (M (z + Real.sqrt v * u) * ((1 / (2 * Real.sqrt v)) * u)) ∂ν) - + (∫ u, A (z + Real.sqrt v * u) ∂ν) * + (∫ u, M (z + Real.sqrt v * u) * ((1 / (2 * Real.sqrt v)) * u) ∂ν)) + +def magneticGaussianSpace (ζ v : ℝ) (F M A B : ℝ → ℝ) (z : ℝ) : ℝ := + gaussianTiltAverage v ζ F B z + ζ * + (gaussianTiltAverage v ζ F (fun y => A y * M y) z - + gaussianTiltAverage v ζ F A z * gaussianTiltAverage v ζ F M z) + +lemma magneticGaussianAverageDifferentialTwo_eq_pair (P : MagneticContinuationJet) (A : MagneticContinuationTwoJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (ζ v z : ℝ) : + magneticGaussianAverageDifferential ζ v F P.value A.value A.first z = + pairLinear (magneticGaussianTime ζ v F P.value A.value A.first z) + (magneticGaussianSpace ζ v F P.value A.value A.first z) := by + let r := Real.sqrt v + let c := 1 / (2 * r) + let ν := (gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u)) + obtain ⟨KM, _, bM⟩ := P.bValue + obtain ⟨KA, hKA, bA⟩ := A.bValue + obtain ⟨KB, _, bB⟩ := A.bFirst + have bAM (y : ℝ) : |A.value y * P.value y| ≤ KA * KM := by + rw [abs_mul] + exact mul_le_mul (bA y) (bM y) (abs_nonneg _) hKA + have iB : Integrable (fun u => A.first (z + r * u)) ν := + magnetic_tilted_shift_integrable hF hG A.mFirst bB r ζ z + have iM : Integrable (fun u => P.value (z + r * u)) ν := + magnetic_tilted_shift_integrable hF hG P.mValue bM r ζ z + have iAM : Integrable (fun u => A.value (z + r * u) * P.value (z + r * u)) ν := + magnetic_tilted_shift_integrable hF hG (A.mValue.mul P.mValue) bAM r ζ z + have linear {a : ℝ → ℝ} (ha : Measurable a) {K : ℝ} (ba : ∀ y, |a y| ≤ K) : + Integrable (fun u => a (z + r * u) * (c * u)) ν := by + have hi := (magnetic_tilted_linear_integrable hF hG ha ba r ζ z).const_mul c + convert hi using 1 + funext u + ring + have iBt := linear A.mFirst bB + have iMt := linear P.mValue bM + have iAMt : Integrable (fun u => A.value (z + r * u) * + (P.value (z + r * u) * (c * u))) ν := by + convert linear (A.mValue.mul P.mValue) bAM using 1 + funext u + dsimp only [Pi.mul_apply] + ring + exact field_pair_covariance ν ζ (fun u => A.value (z + r * u)) + (fun u => A.first (z + r * u) * (c * u)) (fun u => A.first (z + r * u)) + (fun u => P.value (z + r * u) * (c * u)) (fun u => P.value (z + r * u)) + iBt iB iMt iM iAMt iAM + +lemma magneticGaussianAverageDifferential_eq_pair (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (ζ v z : ℝ) : + magneticGaussianAverageDifferential ζ v F P.value A.value A.first z = + pairLinear (magneticGaussianTime ζ v F P.value A.value A.first z) + (magneticGaussianSpace ζ v F P.value A.value A.first z) := by + exact magneticGaussianAverageDifferentialTwo_eq_pair P A.toTwoJet F hF hG ζ v z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianLaplace.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianLaplace.lean new file mode 100644 index 0000000000000000000000000000000000000000..f158c2c62ab349385b8142d68aeb7ff93670fe37 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianLaplace.lean @@ -0,0 +1,119 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatContinuity +import Mathlib.Probability.Moments.MGFAnalytic + +namespace OAI + +/-! Positive weighted Gaussian Laplace transforms. This supplies spatial +smoothing of the finite field without assuming additional derivatives of +the terminal observable. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticWeightedGaussian (F A : ℝ → ℝ) (ζ : ℝ) (v : ℝ≥0) : Measure ℝ := + (gaussianReal 0 v).withDensity (fun y => ENNReal.ofReal (Real.exp (ζ * F y) * A y)) + +lemma magneticWeightedGaussian_exp_integrable {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {K : ℝ} (bA : ∀ y, |A y| ≤ K) (hA0 : ∀ y, 0 ≤ A y) + (ζ t : ℝ) (v : ℝ≥0) : + Integrable (fun y => Real.exp (t * y)) (magneticWeightedGaussian F A ζ v) := by + have hm : Measurable (fun y => ENNReal.ofReal (Real.exp (ζ * F y) * A y)) := + ((hF.const_mul ζ).exp.mul hA).ennreal_ofReal + unfold magneticWeightedGaussian + apply (integrable_withDensity_iff_integrable_smul' hm + (ae_of_all _ fun _ => ENNReal.ofReal_lt_top)).mpr + have hg : HasLinearGrowth (fun y => ζ * F y + t * y) := by + obtain ⟨C, L, hC, hL, hB⟩ := hG + refine ⟨|ζ| * C, |ζ| * L + |t|, by positivity, by positivity, fun y => ?_⟩ + have hb := hB y + rw [Real.norm_eq_abs] at hb ⊢ + calc + |ζ * F y + t * y| ≤ |ζ| * |F y| + |t| * |y| := by + simpa only [abs_mul] using abs_add_le (ζ * F y) (t * y) + _ ≤ |ζ| * (C + L * |y|) + |t| * |y| := by gcongr + _ = _ := by ring + have hi : Integrable (fun y => Real.exp (ζ * F y + t * y)) (gaussianReal 0 v) := by + simpa only [one_mul, Pi.add_apply, Pi.mul_apply, id_eq] using integrable_exp_of_linearGrowth _ + (gaussianReal_exponentialNormMoments 0 v) + ((hF.const_mul ζ).add (measurable_const.mul measurable_id)) hg 1 + have hh := hi.mul_bdd hA.aestronglyMeasurable + (ae_of_all _ fun y => by simpa only [Real.norm_eq_abs] using bA y) + convert hh using 1 + funext y + rw [ENNReal.toReal_ofReal (mul_nonneg (Real.exp_pos _).le (hA0 y)), smul_eq_mul, + Real.exp_add] + ring + +lemma magneticWeightedGaussian_mgf_analytic {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {K : ℝ} (bA : ∀ y, |A y| ≤ K) (hA0 : ∀ y, 0 ≤ A y) + (ζ : ℝ) (v : ℝ≥0) (t : ℝ) : + AnalyticAt ℝ (mgf (fun y : ℝ => y) (magneticWeightedGaussian F A ζ v)) t := by + have he : integrableExpSet (fun y : ℝ => y) (magneticWeightedGaussian F A ζ v) = univ := by + ext u + simp only [mem_univ, iff_true, integrableExpSet, mem_ofPred_eq] + exact magneticWeightedGaussian_exp_integrable hF hG hA bA hA0 ζ u v + apply analyticAt_mgf + simp only [he, interior_univ, mem_univ] + +lemma magneticGaussian_pdf_shift (v : ℝ≥0) (z y : ℝ) : + gaussianPDFReal z v y = Real.exp (-(z ^ 2) / (2 * v)) * + gaussianPDFReal 0 v y * Real.exp ((z / v) * y) := by + by_cases hv : (v : ℝ) = 0 + · simp [gaussianPDFReal, hv] + have he : -((y - z) ^ 2) / (2 * (v : ℝ)) = + -(z ^ 2) / (2 * v) + -(y ^ 2) / (2 * v) + (z / v) * y := by + field_simp [hv] + ring + simp only [gaussianPDFReal, sub_zero] + rw [he, Real.exp_add, Real.exp_add] + ring + +lemma magneticGaussian_weighted_eq_laplace {F A : ℝ → ℝ} + (hF : Measurable F) (hA : Measurable A) (hA0 : ∀ y, 0 ≤ A y) + (ζ : ℝ) (v : ℝ≥0) (hv : v ≠ 0) (z : ℝ) : + (∫ y, Real.exp (ζ * F y) * A y ∂gaussianReal z v) = + Real.exp (-(z ^ 2) / (2 * v)) * + mgf (fun y : ℝ => y) (magneticWeightedGaussian F A ζ v) (z / v) := by + have hm : Measurable (fun y => ENNReal.ofReal (Real.exp (ζ * F y) * A y)) := + ((hF.const_mul ζ).exp.mul hA).ennreal_ofReal + unfold mgf magneticWeightedGaussian + rw [integral_withDensity_eq_integral_toReal_smul hm + (ae_of_all _ fun _ => ENNReal.ofReal_lt_top)] + simp_rw [ENNReal.toReal_ofReal (mul_nonneg (Real.exp_pos _).le (hA0 _)), smul_eq_mul] + rw [integral_gaussianReal_eq_integral_smul hv, integral_gaussianReal_eq_integral_smul hv, + ← integral_const_mul] + apply integral_congr_ae + apply ae_of_all + intro y + dsimp only + rw [magneticGaussian_pdf_shift] + simp only [smul_eq_mul] + ring + +lemma magneticGaussian_weighted_analytic {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {K : ℝ} (bA : ∀ y, |A y| ≤ K) (hA0 : ∀ y, 0 ≤ A y) + (ζ : ℝ) (v : ℝ≥0) (hv : v ≠ 0) (z : ℝ) : + AnalyticAt ℝ (fun x => ∫ y, Real.exp (ζ * F y) * A y ∂gaussianReal x v) z := by + have hM := magneticWeightedGaussian_mgf_analytic hF hG hA bA hA0 ζ v (z / v) + have hc : AnalyticAt ℝ (fun x : ℝ => Real.exp (-(x ^ 2) / (2 * v))) z := by + fun_prop + have hl : AnalyticAt ℝ (fun x : ℝ => x / (v : ℝ)) z := by fun_prop + have hh := hc.mul (hM.comp (f := fun x : ℝ => x / (v : ℝ)) hl) + have he : (fun x => ∫ y, Real.exp (ζ * F y) * A y ∂gaussianReal x v) = + fun x => Real.exp (-(x ^ 2) / (2 * v)) * + mgf (fun y : ℝ => y) (magneticWeightedGaussian F A ζ v) (x / v) := by + funext x + exact magneticGaussian_weighted_eq_laplace hF hA hA0 ζ v hv x + rwa [he] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianMoments.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..82c3e3f431527fc3a63f4a6becb8b4a6fd885e1b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianMoments.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationIBP + +namespace OAI + +/-! Integrable moments and the scaled Gaussian integration-by-parts identity +used to turn the variance differential of a bounded continuation into its +parabolic generator. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magnetic_tilted_shift_integrable {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {C : ℝ} (bA : ∀ x, |A x| ≤ C) (r ζ z : ℝ) : + Integrable (fun u => A (z + r * u)) + ((gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) := by + have he := integrable_exp_of_linearGrowth (gaussianReal 0 1) + (gaussianReal_exponentialNormMoments 0 1) (hF.comp (by fun_prop)) + ((hG.add_left z).scale_argument r) ζ + have : IsProbabilityMeasure ((gaussianReal 0 1).tilted + (fun u => ζ * F (z + r * u))) := MeasureTheory.isProbabilityMeasure_tilted he + exact Integrable.of_bound (hA.comp (by fun_prop)).aestronglyMeasurable C + (Filter.Eventually.of_forall fun u => by + simpa only [Real.norm_eq_abs] using bA (z + r * u)) + +lemma magnetic_tilted_linear_integrable {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {C : ℝ} (bA : ∀ x, |A x| ≤ C) (r ζ z : ℝ) : + Integrable (fun u => u * A (z + r * u)) + ((gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) := by + have hshift := hF.comp (show Measurable (fun u : ℝ => z + r * u) by fun_prop) + have hg := (hG.add_left z).scale_argument r + have he := integrable_exp_of_linearGrowth (gaussianReal 0 1) + (gaussianReal_exponentialNormMoments 0 1) hshift hg ζ + apply (integrable_tilted_iff he _).mpr + apply field_exp_mul_linear_integrable 1 0 ζ hshift hg + (measurable_id.mul (hA.comp (by fun_prop))) + refine ⟨0, C, le_rfl, (abs_nonneg _).trans (bA 0), fun u => ?_⟩ + change |u * A (z + r * u)| ≤ 0 + C * ‖u‖ + rw [abs_mul, Real.norm_eq_abs, zero_add] + simpa only [mul_comm] using + mul_le_mul_of_nonneg_left (bA (z + r * u)) (abs_nonneg u) + +lemma magnetic_tilted_scaled_test_ibp {F M A B : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hA : Measurable A) (hB : Measurable B) + {K C D : ℝ} (bM : ∀ x, |M x| ≤ K) (bA : ∀ x, |A x| ≤ C) + (bB : ∀ x, |B x| ≤ D) (dF : ∀ x, HasDerivAt F (M x) x) + (dA : ∀ x, HasDerivAt A (B x) x) {r : ℝ} (hr : r ≠ 0) (ζ z : ℝ) : + (∫ u, A (z + r * u) * ((1 / (2 * r)) * u) + ∂(gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) = + (1 / 2 : ℝ) * (∫ u, B (z + r * u) + ∂(gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) + + ζ / 2 * (∫ u, A (z + r * u) * M (z + r * u) + ∂(gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u))) := by + let ν := (gaussianReal 0 1).tilted (fun u => ζ * F (z + r * u)) + have hiB : Integrable (fun u => B (z + r * u)) ν := + magnetic_tilted_shift_integrable hF hG hB bB r ζ z + have hiAM : Integrable (fun u => A (z + r * u) * M (z + r * u)) ν := by + apply magnetic_tilted_shift_integrable hF hG (hA.mul hM) + (C := C * K) (r := r) (ζ := ζ) (z := z) + intro x + change |A x * M x| ≤ C * K + rw [abs_mul] + exact mul_le_mul (bA x) (bM x) (abs_nonneg _) ((abs_nonneg _).trans (bA 0)) + have he : (fun u => A (z + r * u) * ((1 / (2 * r)) * u)) = + fun u => (1 / (2 * r)) * (u * A (z + r * u)) := by + funext u + ring + rw [he, integral_const_mul] + rw [magnetic_gaussian_tilted_test_ibp hF hG hM hA hB bM bA bB dF dA r ζ z] + have he' : (fun u => B (z + r * u) + ζ * A (z + r * u) * M (z + r * u)) = + fun u => B (z + r * u) + ζ * (A (z + r * u) * M (z + r * u)) := by + funext u + ring + rw [he', integral_add hiB (hiAM.const_mul ζ), integral_const_mul] + field_simp [hr] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianSmoothing.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianSmoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..18aca3a079c9d177bed4e8e09e3042b491448136 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGaussianSmoothing.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGaussianLaplace +import Mathlib.Analysis.Calculus.ContDiff.Operations + +namespace OAI + +/-! Positive-variance scalar Gaussian transitions are smooth in the +spatial coordinate even when the bounded terminal test has no derivatives. +This justifies the interior fourth derivatives in the inverse-mean +parabolic comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma analyticAt_fieldSpinTransition_nonneg {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {K : ℝ} (bA : ∀ y, |A y| ≤ K) (hA0 : ∀ y, 0 ≤ A y) + (ζ : ℝ) (v : ℝ≥0) (hv : v ≠ 0) (z : ℝ) : + AnalyticAt ℝ (fieldSpinTransition ζ v F A) z := by + have hn := magneticGaussian_weighted_analytic hF hG hA bA hA0 ζ v hv z + have hd := magneticGaussian_weighted_analytic hF hG measurable_const + (show ∀ y : ℝ, |(1 : ℝ)| ≤ 1 from fun _ => by norm_num) + (show ∀ _ : ℝ, (0 : ℝ) ≤ 1 from fun _ => zero_le_one) ζ v hv z + simp only [mul_one] at hd + have hp : 0 < ∫ y, Real.exp (ζ * F y) ∂gaussianReal z v := by + apply IsingPerceptron.integral_exp_pos + exact integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG ζ + have he : fieldSpinTransition ζ v F A = fun x => + (∫ y, Real.exp (ζ * F y) * A y ∂gaussianReal x v) / + (∫ y, Real.exp (ζ * F y) ∂gaussianReal x v) := by + funext x + exact integral_tilted_eq_div (gaussianReal x v) (fun y => ζ * F y) A + rw [he] + exact hn.div hd hp.ne' + +lemma analyticAt_fieldSpinTransition {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {K : ℝ} (bA : ∀ y, |A y| ≤ K) + (ζ : ℝ) (v : ℝ≥0) (hv : v ≠ 0) (z : ℝ) : + AnalyticAt ℝ (fieldSpinTransition ζ v F A) z := by + have hK : 0 ≤ K := (abs_nonneg (A 0)).trans (bA 0) + have hB : ∀ y, |A y + K| ≤ 2 * K := by + intro y + exact (abs_add_le _ _).trans (by rw [abs_of_nonneg hK]; linarith [bA y]) + have hB0 : ∀ y, 0 ≤ A y + K := by + intro y + linarith [(abs_le.mp (bA y)).1] + have ha := analyticAt_fieldSpinTransition_nonneg hF hG (hA.add_const K) hB hB0 ζ v hv z + have he : (fun x => fieldSpinTransition ζ v F (fun y => A y + K) x - K) = + fieldSpinTransition ζ v F A := by + funext x + rw [fieldSpinTransition_add ζ v hF hG hA measurable_const bA + (fun _ => (abs_of_nonneg hK).le), fieldSpinTransition_const ζ v hF hG] + ring + rw [← he] + exact ha.sub analyticAt_const + +lemma contDiff_fieldSpinTransition {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : Measurable A) + {K : ℝ} (bA : ∀ y, |A y| ≤ K) + (ζ : ℝ) (v : ℝ≥0) (hv : v ≠ 0) (n : WithTop ℕ∞) : + ContDiff ℝ n (fieldSpinTransition ζ v F A) := by + apply contDiff_iff_contDiffAt.mpr + intro z + exact (analyticAt_fieldSpinTransition hF hG hA bA ζ v hv z).contDiffAt + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGeneralSpectrum.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGeneralSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..2249a04eb78c99e110f8bada0f2deef28d2f2b3a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGeneralSpectrum.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCompactSpectrum +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpectralClipping +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! The compact spectral law formula with finite external fields and no outliers. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem general_spectral_mean_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) := by + have hab : a ≤ b := (hbound ha).2 + have hc := compact_spectral_field_pressure_tendsto_of_mem hhaar hgauss hpub μ + (fun N i => spectralClip a b (eig N i)) ν a b hcompact hbound ha hb + (fun N i => spectralClip_mem hab (eig N i)) + (spectral_clip_empirical_tendsto eig ν a b hbound hweak) group γ c hγ hγsum hgroup + have hη := spectralExcess_tendsto eig a b hno + have hd : Tendsto (fun N => + (∫ V, rotatedPressure (fun i => spectralClip a b (eig N i)) + (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N)- + ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) + atTop (𝓝 0) := by + apply squeeze_zero_norm' _ (by simpa only [zero_div] using hη.div_const 2) + filter_upwards [eventually_ge_atTop 1] with N hN + simpa only [Real.norm_eq_abs] using spectral_clip_mean_field_pressure_close (by omega) + (μ N) (eig N) a b (spectralExcess (eig N) a b) hab + (spectralExcess_nonneg _ _ _) (spectralExcess_bounds _ _ _) (fun i => c (group N i)) + have hh := hc.sub hd + simpa only [sub_sub_cancel,sub_zero] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGridProjection.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGridProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..97d53001ce402809d8c6e47685c94e59a124196e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGridProjection.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRationalCover +import OAI.Probability.InvariantIsing.Fields.SpinCountMagnetization +import OAI.Probability.InvariantIsing.Fields.SpinGroupProjectionMoment +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupAverage + +namespace OAI + +/-! A rational net of magnetizations gives an actual spin projection onto +a finite union of attainable group slices. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma spinGroupCount_le_size {N : ℕ} {A : Type*} [DecidableEq A] + (group : Fin N → A) (σ : Spin N) (a : A) : + spinGroupCount group σ a ≤ spinGroupSize group a := by + apply Finset.card_le_card + intro i hi + exact Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hi).1,(Finset.mem_filter.mp hi).2.1⟩ + +lemma spinGroupSize_sum {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) : (∑ a, (spinGroupSize group a:ℝ))=N := by + have h := sum_grouped_sites group (fun _ => (1:ℝ)) + simpa only [mul_one,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,mul_one] using h.symm + +theorem magnetic_grid_projection {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) {δ : ℝ} (hδ : 0<δ) + (Q : Finset (RationalMagnetization A)) + (hQ : ∀ x : A → ℝ, (∀ a, |x a|≤1) → ∃ q∈Q, ∀ a, |x a-(q.val a:ℝ)|<δ) : + ∃ f : Spin N → Spin N, + (∀ σ, f σ∈Q.biUnion (fun q => spinGroupSlice group + (fun a => magneticRoundedCount (spinGroupSize group a) (q.val a:ℝ)))) ∧ + ∀ σ, hammingDist σ (f σ)≤⌈δ*N+Fintype.card A⌉₊ := by + classical + let x := fun σ a => spinCountMagnetization (spinGroupSize group a) (spinGroupCount group σ a) + choose q hq hclose using fun σ => hQ (x σ) + (fun a => spinCountMagnetization_bounds (spinGroupCount_le_size group σ a)) + let cnt := fun q : RationalMagnetization A => fun a => + magneticRoundedCount (spinGroupSize group a) (q.val a:ℝ) + have hc q a : cnt q a≤ spinGroupSize group a := magneticRoundedCount_le _ (q.property a).le + let f := fun σ => spinGroupProjection group (cnt (q σ)) (hc (q σ)) σ + refine ⟨f,fun σ => Finset.mem_biUnion.mpr ⟨q σ,hq σ,spinGroupProjection_mem _ _ _ _⟩,?_⟩ + intro σ + have hb : (hammingDist σ (f σ):ℝ) ≤ δ*N+Fintype.card A := by + rw [show f σ=spinGroupProjection group (cnt (q σ)) (hc (q σ)) σ from rfl, + spinGroupProjection_distance_real] + calc + _ ≤ ∑ a, ((spinGroupSize group a:ℝ)*δ/2+1) := by + apply Finset.sum_le_sum + intro a _ + exact rounded_count_distance (spinGroupCount_le_size group σ a) ((q σ).property a).le + (hclose σ a).le + _ = (N:ℝ)*δ/2+Fintype.card A := by + rw [Finset.sum_add_distrib,←Finset.sum_div,←Finset.sum_mul,spinGroupSize_sum] + simp + _ ≤ _ := by nlinarith [(Nat.cast_nonneg N : (0:ℝ)≤N)] + exact_mod_cast hb.trans (Nat.le_ceil (δ*N+Fintype.card A)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupAverage.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..6af2717e43bcdf0ee1a57225d3d41c1a16e59f78 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupAverage.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupPath + +namespace OAI + +/-! Exact passage from attainable block proportions to the weighted +magnetic functional and overlap path. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators +namespace InvariantIsing + +lemma sum_grouped_sites {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (f : A → ℝ) : + (∑ j, f (group j)) = ∑ a, (spinGroupSize group a : ℝ) * f a := by + rw [← Finset.sum_fiberwise Finset.univ group] + apply Finset.sum_congr rfl + intro a _ + calc + _ = ∑ _j ∈ Finset.univ.filter (fun j => group j = a), f a := by + apply Finset.sum_congr rfl + intro j hj + rw [(Finset.mem_filter.mp hj).2] + _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul, spinGroupSize] + +lemma average_grouped_sites {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (γ f : A → ℝ) + (hcount : ∀ a, (spinGroupSize group a : ℝ) = N * γ a) : + (N : ℝ)⁻¹ * (∑ j, f (group j)) = ∑ a, γ a * f a := by + rw [sum_grouped_sites, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + rw [hcount a] + rw [← mul_assoc, ← mul_assoc, inv_mul_cancel₀ (Nat.cast_ne_zero.mpr hN.ne'), one_mul] + +lemma magneticGroupValue_eq_block {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (γ mag : A → ℝ) + (hcount : ∀ a, (spinGroupSize group a : ℝ) = N * γ a) (h : FieldStep) : + (N : ℝ)⁻¹ * (∑ j, constrainedFieldValue h (mag (group j))) = + magneticGroupValue γ mag h := + average_grouped_sites hN group γ (fun a => constrainedFieldValue h (mag a)) hcount + +lemma magneticGroupLevel_eq_block {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (γ mag : A → ℝ) + (hcount : ∀ a, (spinGroupSize group a : ℝ) = N * γ a) + (h : FieldStep) (i : Fin (h.depth+1)) : + magneticBlockLevel h (fun j => mag (group j)) i = magneticGroupLevel γ mag h i := + average_grouped_sites hN group γ (fun a => magneticFieldLevel h (mag a) i) hcount + +lemma magneticGroupPath_eq_block {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hcount : ∀ a, (spinGroupSize group a : ℝ) = N * γ a) (h : FieldStep) : + magneticBlockPath hN h (fun j => mag (group j)) = magneticGroupPath γ mag hγ hγsum h := by + apply (show Function.Injective OverlapPath.val from by + intro a b hab + cases a + cases b + cases hab + rfl) + funext t + exact magneticGroupLevel_eq_block hN group γ mag hcount h (fieldLevelIndex h t) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupConsistency.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupConsistency.lean new file mode 100644 index 0000000000000000000000000000000000000000..319075faf2ff38ad91a0ff5c64ee782e921e0c34 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupConsistency.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupAverage +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPathConvergence + +namespace OAI + +/-! Uniform block replacement turns constrained self-consistency into +the weighted magnetic self-consistency used by the entropy supremum. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_group_l1_of_block_consistency {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ) = N r * γ a) + {s H : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ) = spinGroupSize (group r) a * ((1+mag a)/2)) + (h : ℕ → FieldStep) (hH : ∀ r, (h r).height (Fin.last (h r).depth) ≤ H) + (p : OverlapPath) + (hself : Tendsto (fun r => ∫ t, |restrictedBlockOverlapPath (hN r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (h r) t-p t| ∂pathMeasure) atTop (𝓝 0)) : + Tendsto (fun r => ∫ t, |magneticGroupPath γ mag hγ hγsum (h r) t-p t| ∂pathMeasure) + atTop (𝓝 0) := by + let a := fun r => restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) (h r) + let b := fun r => magneticGroupPath γ mag hγ hγsum (h r) + have hab := magneticBlockPath_l1_tendsto N hN hNlim group k hk (fun _ => mag) hs + (fun _ => hmag) hc h hH + have he r : magneticBlockPath (hN r) (h r) (fun j => mag (group r j)) = b r := + magneticGroupPath_eq_block (hN r) (group r) γ mag hγ hγsum (hcount r) (h r) + simp_rw [he] at hab + have hz : Tendsto (fun r => (∫ t, |a r t-b r t| ∂pathMeasure)+ + ∫ t, |a r t-p t| ∂pathMeasure) atTop (𝓝 0) := by + simpa only [add_zero] using hab.add hself + apply squeeze_zero (fun r => integral_nonneg (fun t => abs_nonneg _)) (fun r => ?_) hz + calc + (∫ t, |b r t-p t| ∂pathMeasure) ≤ + ∫ t, (|a r t-b r t|+|a r t-p t|) ∂pathMeasure := by + apply integral_mono ((b r).integrable.sub p.integrable).abs + (((a r).integrable.sub (b r).integrable).abs.add (((a r).integrable.sub p.integrable).abs)) + intro t + change |b r t-p t| ≤ |a r t-b r t|+|a r t-p t| + simpa only [abs_sub_comm (b r t) (a r t)] using abs_sub_le (b r t) (a r t) (p t) + _ = _ := integral_add ((a r).integrable.sub (b r).integrable).abs + ((a r).integrable.sub p.integrable).abs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupEntropyLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupEntropyLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b01bf11d19e562e81d8a3a1ff8b949fbf3cbb21b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupEntropyLimit.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupParameterBound +import OAI.Probability.InvariantIsing.Magnetic.MagneticSliceFieldBound +import OAI.Probability.InvariantIsing.Arrays.TensorContactStep + +namespace OAI + +/-! Bounded-height entropy control for attainable groups whose proportions +and interior magnetizations converge. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem magnetic_group_entropy_limit {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ k, 0 (hkm x).trans_lt hr) (hms k) (hγs k) step + have hs' : magneticGroupValue γ mag step+fieldPairing p step/2 ≤ S := by + apply EReal.coe_le_coe_iff.mp + exact (le_iSup (fun h : FieldStep => + ((magneticGroupValue γ mag h+fieldPairing p h/2 : ℝ) : EReal)) step).trans hS + change constrainedBlockValue (spinGroupSlice (group k) (count k)) step+fieldPairing p step/2 ≤ S+ε + have hd := (le_abs_self _).trans hv.le + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupInterior.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupInterior.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb569f07cf06f90ec968d4a02aa3b2fc6580ed3e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupInterior.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupParameterBound + +namespace OAI + +/-! An interior limit gives a common strict magnetization bound for all +sufficiently large members of a finite family. -/ +noncomputable section +open Filter Set +open scoped Topology +namespace InvariantIsing + +lemma exists_uniform_magnetization_radius {A : Type*} [Fintype A] + (s : ℕ → A → ℝ) (t : A → ℝ) (hs : Tendsto s atTop (𝓝 t)) + (ht : ∀ a, |t a|<1) : + ∃ r : ℝ, r<1 ∧ (∀ a, |t a|≤r) ∧ ∀ᶠ k in atTop, ∀ a, |s k a|≤r := by + classical + by_cases hA : Nonempty A + · have : Nonempty A := hA + have hne : (Finset.univ : Finset A).Nonempty := Finset.univ_nonempty + let M := Finset.univ.sup' hne (fun a => |t a|) + have hM : M<1 := (Finset.sup'_lt_iff hne).mpr (fun a _ => ht a) + obtain ⟨r, hMr, hr⟩ := exists_between hM + have htr a : |t a| |t a|) (Finset.mem_univ a)).trans_lt hMr + refine ⟨r, hr, fun a => (htr a).le, ?_⟩ + rw [Filter.eventually_all] + intro a + exact ((((tendsto_pi_nhds.mp hs) a).abs).eventually (Iio_mem_nhds (htr a))).mono + (fun _ h => h.le) + · have : IsEmpty A := not_nonempty_iff.mp hA + exact ⟨0, by norm_num, fun a => isEmptyElim a, Filter.Eventually.of_forall (fun _ a => isEmptyElim a)⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupParameterBound.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupParameterBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..2be73b5af4aa38c05f2cf0167a9884e07331c29a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupParameterBound.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariational + +namespace OAI + +/-! The finite-group magnetic field value has a parameter modulus uniform +in all covariance partitions of bounded height. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma constrainedFieldValue_abs_le_height (h : FieldStep) {s H : ℝ} + (hs : |s| ≤ 1) (hH : h.height (Fin.last h.depth) ≤ H) : + |constrainedFieldValue h s| ≤ Real.log 2+H/2 := by + have hb := constrainedFieldValue_bounds h hs + have h0 : 0 ≤ H := (h.nonneg _).trans hH + have hl : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) + exact abs_le.mpr ⟨by linarith,by linarith⟩ + +lemma magneticGroupValue_parameter_modulus {A : Type*} [Fintype A] + (γ δ s t : A → ℝ) {r H : ℝ} (hr : r<1) + (hs : ∀ a, |s a| ≤ r) (ht : ∀ a, |t a| ≤ r) + (h : FieldStep) (hH : h.height (Fin.last h.depth) ≤ H) : + |magneticGroupValue γ s h-magneticGroupValue δ t h| ≤ + (Real.log 2+H/2)*(∑ a, |γ a-δ a|)+ + ((Real.log 2+H/2)/(1-r))*(∑ a, |δ a| *|s a-t a|) := by + unfold magneticGroupValue + rw [← Finset.sum_sub_distrib] + apply (Finset.abs_sum_le_sum_abs _ _).trans + calc + (∑ a, |γ a*constrainedFieldValue h (s a)-δ a*constrainedFieldValue h (t a)|) ≤ + ∑ a, (|γ a-δ a| *(Real.log 2+H/2)+ + |δ a| *(((Real.log 2+H/2)/(1-r))*|s a-t a|)) := by + apply Finset.sum_le_sum + intro a _ + have he : γ a*constrainedFieldValue h (s a)-δ a*constrainedFieldValue h (t a) = + (γ a-δ a)*constrainedFieldValue h (s a)+ + δ a*(constrainedFieldValue h (s a)-constrainedFieldValue h (t a)) := by ring + rw [he] + apply (abs_add_le _ _).trans + rw [abs_mul,abs_mul] + exact add_le_add + (mul_le_mul_of_nonneg_left (constrainedFieldValue_abs_le_height h ((hs a).trans hr.le) hH) (abs_nonneg _)) + (mul_le_mul_of_nonneg_left (constrainedFieldValue_magnetization_lipschitz h hr (hs a) (ht a) hH) (abs_nonneg _)) + _ = _ := by + rw [Finset.sum_add_distrib, Finset.mul_sum,Finset.mul_sum] + apply congrArg₂ (·+·) <;> apply Finset.sum_congr rfl <;> intro a _ <;> ring + +lemma magneticGroupValue_parameters_uniform {A : Type*} [Fintype A] + (γ s : ℕ → A → ℝ) (δ t : A → ℝ) + (hγ : Tendsto γ atTop (𝓝 δ)) (hs : Tendsto s atTop (𝓝 t)) + {r : ℝ} (hr : r<1) (hst : ∀ a, |t a| ≤ r) + (hsk : ∀ᶠ k in atTop, ∀ a, |s k a| ≤ r) (H : ℝ) : + ∀ ε>0, ∀ᶠ k in atTop, ∀ h : FieldStep, h.height (Fin.last h.depth) ≤ H → + |magneticGroupValue (γ k) (s k) h-magneticGroupValue δ t h|<ε := by + have he : Tendsto (fun k => (Real.log 2+H/2)*(∑ a, |γ k a-δ a|)+ + ((Real.log 2+H/2)/(1-r))*(∑ a, |δ a| *|s k a-t a|)) atTop (𝓝 0) := by + have h1 : Tendsto (fun k => ∑ a, |γ k a-δ a|) atTop (𝓝 0) := by + simpa using tendsto_finsetSum Finset.univ + (fun a _ => (((tendsto_pi_nhds.mp hγ) a).sub (tendsto_const_nhds (x := δ a))).abs) + have h2 : Tendsto (fun k => ∑ a, |δ a| *|s k a-t a|) atTop (𝓝 0) := by + simpa using tendsto_finsetSum Finset.univ + (fun a _ => ((((tendsto_pi_nhds.mp hs) a).sub (tendsto_const_nhds (x := t a))).abs).const_mul |δ a|) + simpa using (h1.const_mul (Real.log 2+H/2)).add (h2.const_mul ((Real.log 2+H/2)/(1-r))) + intro ε hε + filter_upwards [hsk,he.eventually (Iio_mem_nhds hε)] with k hk he h hH + exact (magneticGroupValue_parameter_modulus (γ k) δ (s k) t hr hk hst h hH).trans_lt he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupPath.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb7be6643ab60dc57b3a9c48a4d8f577d025442f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupPath.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPath +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariational + +namespace OAI + +/-! The weighted overlap path for the same field groups as the magnetic +variational functional. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators NNReal +namespace InvariantIsing + +def magneticGroupLevel {A : Type*} [Fintype A] (γ mag : A → ℝ) (h : FieldStep) + (i : Fin (h.depth+1)) : ℝ := ∑ a, γ a * magneticFieldLevel h (mag a) i + +lemma magneticGroupLevel_mem_unit {A : Type*} [Fintype A] + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (h : FieldStep) (i : Fin (h.depth+1)) : magneticGroupLevel γ mag h i ∈ Icc (0 : ℝ) 1 := by + constructor + · exact Finset.sum_nonneg fun a _ => mul_nonneg (hγ a) (magneticFieldLevel_mem_unit h (mag a) i).1 + · calc + _ ≤ ∑ a, γ a * 1 := Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_left (magneticFieldLevel_mem_unit h (mag a) i).2 (hγ a) + _ = 1 := by simpa only [mul_one] using hγsum + +lemma magneticGroupLevel_monotone {A : Type*} [Fintype A] + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (h : FieldStep) : + Monotone (magneticGroupLevel γ mag h) := by + intro i j hij + exact Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_left (magneticFieldLevel_monotone h (mag a) hij) (hγ a) + +def magneticGroupPath {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) (h : FieldStep) : OverlapPath := + fieldLevelPath h (magneticGroupLevel γ mag h) (magneticGroupLevel_monotone γ mag hγ h) + (magneticGroupLevel_mem_unit γ mag hγ hγsum h) + +lemma magneticGroupPath_on_cell {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) (h : FieldStep) + (i : Fin (h.depth+1)) {s : ℝ} (hs : s ∈ Ioo (h.cut i.castSucc) (h.cut i.succ)) : + magneticGroupPath γ mag hγ hγsum h s = magneticGroupLevel γ mag h i := + fieldLevelPath_on_cell h _ _ _ i hs + +lemma magneticGroupPath_eq_sum {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) (h : FieldStep) (s : ℝ) : + magneticGroupPath γ mag hγ hγsum h s = ∑ a, γ a * magneticFieldPath h (mag a) s := by + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupRounding.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupRounding.lean new file mode 100644 index 0000000000000000000000000000000000000000..044b84186c8c14585aa71a97cde32a6060773ff2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupRounding.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGridProjection + +namespace OAI + +/-! Fixed interior targets round to converging attainable group profiles. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +lemma group_size_tendsto_atTop (N G : ℕ → ℕ) (hN : Tendsto N atTop atTop) + {γ : ℝ} (hγ : 0<γ) + (hG : Tendsto (fun k => (G k:ℝ)/(N k:ℝ)) atTop (𝓝 γ)) : + Tendsto G atTop atTop := by + have hpos : ∀ᶠ k in atTop, 0 (spinGroupSize (group k) a:ℝ)/(N k:ℝ)) atTop (𝓝 γ)) : + Tendsto (fun k a => magneticRoundedValue (spinGroupSize (group k) a) (mag a)) atTop (𝓝 mag) := by + apply tendsto_pi_nhds.mpr + intro a + exact magneticRoundedValue_tendsto (fun k => spinGroupSize (group k) a) + (group_size_tendsto_atTop N _ hN (hγ a) ((tendsto_pi_nhds.mp hgroup) a)) (hmag a) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupSupport.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fb04eb5c90d5b0a23081f2b4bdff30ea021f67a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticGroupSupport.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupPath +import OAI.Probability.InvariantIsing.Magnetic.MagneticPartitionSupport + +namespace OAI + +/-! The supporting inequality for the weighted magnetic functional, +with the same common height path for all field groups. -/ +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma fieldPairing_magneticGroup {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) (h k : FieldStep) : + fieldPairing (magneticGroupPath γ mag hγ hγsum h) k = + ∑ a, γ a * fieldPairing (magneticFieldPath h (mag a)) k := by + unfold fieldPairing + simp_rw [magneticGroupPath_eq_sum, Finset.sum_mul, mul_assoc] + rw [integral_finsetSum _ (fun a _ => (integrable_path_mul_field (magneticFieldPath h (mag a)) k).const_mul (γ a))] + simp only [integral_const_mul] + +lemma magneticGroup_support_pairing {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) (hmag : ∀ a, |mag a|<1) + (h k : FieldStep) : + magneticGroupValue γ mag k + fieldPairing (magneticGroupPath γ mag hγ hγsum h) k/2 ≤ + magneticGroupValue γ mag h + fieldPairing (magneticGroupPath γ mag hγ hγsum h) h/2 := by + have he (v : FieldStep) : magneticGroupValue γ mag v + + fieldPairing (magneticGroupPath γ mag hγ hγsum h) v/2 = + ∑ a, γ a * (constrainedFieldValue v (mag a) + + (1/2 : ℝ)*fieldPairing (magneticFieldPath h (mag a)) v) := by + rw [fieldPairing_magneticGroup] + simp only [magneticGroupValue, mul_add, Finset.sum_add_distrib] + congr 1 + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + ring + rw [he k,he h] + exact Finset.sum_le_sum fun a _ => mul_le_mul_of_nonneg_left + (magneticField_support_pairing h k (hmag a)) (hγ a) + +theorem magneticGroup_support {A : Type*} [Fintype A] (γ mag : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) (hmag : ∀ a, |mag a|<1) + (h k : FieldStep) : + magneticGroupValue γ mag k ≤ magneticGroupValue γ mag h - + (∫ s, magneticGroupPath γ mag hγ hγsum h s * + (fieldFunction k s-fieldFunction h s) ∂pathMeasure)/2 := by + have hs := magneticGroup_support_pairing γ mag hγ hγsum hmag h k + have he : (∫ s, magneticGroupPath γ mag hγ hγsum h s * + (fieldFunction k s-fieldFunction h s) ∂pathMeasure) = + fieldPairing (magneticGroupPath γ mag hγ hγsum h) k - + fieldPairing (magneticGroupPath γ mag hγ hγsum h) h := by + simp only [mul_sub] + exact integral_sub (integrable_path_mul_field _ _) (integrable_path_mul_field _ _) + rw [he] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..7aaa3d60dd56a457517eef9bec4d7d762a124fc7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatContinuity.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarInverse +import OAI.Probability.InvariantIsing.Fields.FieldGaussianContinuity + +namespace OAI + +/-! Joint continuity of the finite Gaussian slab and its physical inverse +coordinates, including zero Gaussian variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma continuous_magneticHeatMean (P : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Continuous F) (hG : HasLinearGrowth F) (ζ : ℝ) : + Continuous (magneticHeatMean P F ζ) := by + obtain ⟨C, L, hC, hL, hB⟩ := hG + obtain ⟨M, hM, bM⟩ := P.bValue + have hP : Continuous P.value := continuous_iff_continuousAt.mpr + fun z => (P.dValue z).continuousAt + exact continuous_field_gaussian_tilt_average + (hF.comp continuous_snd) (hP.comp continuous_snd) continuous_fst continuous_snd + hC hL hM (fun _ z => by simpa only [Real.norm_eq_abs] using hB z) + (fun _ z => bM z) ζ + +lemma continuous_magneticHeatCurvature (P : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Continuous F) (hG : HasLinearGrowth F) (ζ : ℝ) : + Continuous (magneticHeatCurvature P F ζ) := by + obtain ⟨C, L, hC, hL, hB⟩ := hG + obtain ⟨M, hM, bM⟩ := P.bFirst + have hP : Continuous P.first := continuous_iff_continuousAt.mpr + fun z => (P.dFirst z).continuousAt + have hfirst : Continuous (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F P.first q.2) := + continuous_field_gaussian_tilt_average + (hF.comp continuous_snd) (hP.comp continuous_snd) continuous_fst continuous_snd + hC hL hM (fun _ z => by simpa only [Real.norm_eq_abs] using hB z) + (fun _ z => bM z) ζ + exact hfirst.add (((continuous_magneticHeatMean P.square F hF + ⟨C, L, hC, hL, hB⟩ ζ).sub + ((continuous_magneticHeatMean P F hF ⟨C, L, hC, hL, hB⟩ ζ).pow 2)).const_mul ζ) + +lemma continuous_magneticScalarSlabMean (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) : + Continuous (fun q : ℝ × ℝ => magneticScalarSlabMean L ζ q.1 q.2) := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hc : Continuous (fieldScalarValue L (fun z => Real.log (Real.cosh z))) := + continuous_iff_continuousAt.mpr fun z => + (hasDerivAt_fieldScalarLogCosh L hL z).continuousAt + have he : (fun q : ℝ × ℝ => magneticScalarSlabMean L ζ q.1 q.2) = + magneticHeatMean (magneticLogCoshMeanJet L hL) + (fieldScalarValue L (fun z => Real.log (Real.cosh z))) ζ := by + funext q + exact magneticScalarSlabMean_eq L hL ζ q.1 q.2 + rw [he] + exact continuous_magneticHeatMean _ _ hc hF.2 ζ + +lemma continuousAt_parametric_strict_inverse (M b : ℝ → ℝ → ℝ) + (hc : Continuous (fun q : ℝ × ℝ => M q.1 q.2)) + (hm : ∀ v, StrictMono (M v)) + (hroot : ∀ v s, |s| < 1 → M v (b v s) = s) + {s v : ℝ} (hs : |s| < 1) : + ContinuousAt (fun q : ℝ × ℝ => b q.1 q.2) (v, s) := by + have hn : ∀ᶠ q : ℝ × ℝ in 𝓝 (v, s), |q.2| < 1 := + (isOpen_lt continuous_snd.abs continuous_const).mem_nhds hs + apply tendsto_order.2 + constructor + · intro l hl + have hlt : M v l < s := by + rw [← hroot v s hs] + exact hm v hl + have hlc : Continuous (fun q : ℝ × ℝ => M q.1 l) := + hc.comp (continuous_fst.prodMk continuous_const) + have hN : ∀ᶠ q : ℝ × ℝ in 𝓝 (v, s), M q.1 l < q.2 := + (isOpen_lt hlc continuous_snd).mem_nhds hlt + filter_upwards [hn, hN] with q hq hq' + apply (hm q.1).lt_iff_lt.mp + rw [hroot q.1 q.2 hq] + exact hq' + · intro u hu + have htu : s < M v u := by + rw [← hroot v s hs] + exact hm v hu + have huc : Continuous (fun q : ℝ × ℝ => M q.1 u) := + hc.comp (continuous_fst.prodMk continuous_const) + have hN : ∀ᶠ q : ℝ × ℝ in 𝓝 (v, s), q.2 < M q.1 u := + (isOpen_lt continuous_snd huc).mem_nhds htu + filter_upwards [hn, hN] with q hq hq' + apply (hm q.1).lt_iff_lt.mp + rw [hroot q.1 q.2 hq] + exact hq' + + +lemma magneticScalarSlabBias_continuousAt_joint (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s v : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) : + ContinuousAt (fun q : ℝ × ℝ => magneticScalarSlabBias L ζ q.1 q.2) (v, s) := by + exact continuousAt_parametric_strict_inverse _ _ + (continuous_magneticScalarSlabMean L hL ζ) + (magneticScalarSlabMean_strictMono L hL hζ) + (fun v s hs => magneticScalarSlabMean_bias L hL hζ hs v) hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatCurvature.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ab4cc437bc76b204629519aadefd2f2a5cc66fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatCurvature.lean @@ -0,0 +1,111 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticTwoJetSpatial + +namespace OAI + +/-! The actual scalar curvature satisfies the differentiated heat equation. +The computation uses only four derivatives of the finite scalar value. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticHeatCurvature (P : MagneticContinuationJet) (F : ℝ → ℝ) + (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + gaussianTiltAverage q.1 ζ F P.first q.2 + ζ * + (gaussianTiltAverage q.1 ζ F (fun y => (P.value y) ^ 2) q.2 - + (gaussianTiltAverage q.1 ζ F P.value q.2) ^ 2) + +lemma magneticHeatCurvature_eq (P : MagneticContinuationJet) (F : ℝ → ℝ) + (hF : Measurable F) (ζ : ℝ) (q : ℝ × ℝ) : + magneticHeatCurvature P F ζ q = + fieldCurvatureTransform ζ (Real.toNNReal q.1) F P.value P.first q.2 := by + unfold magneticHeatCurvature fieldCurvatureTransform + rw [field_gaussianTiltAverage_eq_transition q.1 ζ hF P.mFirst, + field_gaussianTiltAverage_eq_transition q.1 ζ (a := fun y => (P.value y) ^ 2) + hF (P.mValue.pow_const 2), + field_gaussianTiltAverage_eq_transition q.1 ζ hF P.mValue] + +theorem magneticHeatCurvature_hasFDerivAt (P : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + HasFDerivAt (magneticHeatCurvature P F ζ) + (pairLinear (J.third z / 2 + ζ * ((J.first z) ^ 2 + J.value z * J.second z)) + (J.second z)) (v, z) := by + let w := Real.toNNReal v + let J := P.transition P ζ w F hF hG dF + let U := fieldSpinTransition ζ w F P.first + let V := fieldSpinTransition ζ w F P.square.value + let U1 := fieldTiltSpatial ζ w F P.value P.first P.second + let V1 := fieldTiltSpatial ζ w F P.value P.square.value P.square.first + let U2 := magneticContinuationSecond ζ w F P.value P.first P.first P.second P.third + let V2 := magneticContinuationSecond ζ w F P.value P.first + P.square.value P.square.first P.square.second + have hU (x : ℝ) : HasDerivAt U (U1 x) x := + magneticTwoJet_average_hasDerivAt P P.slopeTwoJet F hF hG dF ζ w x + have hV (x : ℝ) : HasDerivAt V (V1 x) x := + magneticTwoJet_average_hasDerivAt P P.square.toTwoJet F hF hG dF ζ w x + have hU1 (x : ℝ) : HasDerivAt U1 (U2 x) x := + magneticTwoJet_spatial_hasDerivAt P P.slopeTwoJet F hF hG dF ζ w x + have hV1 (x : ℝ) : HasDerivAt V1 (V2 x) x := + magneticTwoJet_spatial_hasDerivAt P P.square.toTwoJet F hF hG dF ζ w x + have hJ : J.first = fun x => U x + ζ * (V x - (J.value x) ^ 2) := by + funext x + dsimp only [J, MagneticContinuationJet.transition, fieldTiltSpatial, U, V, + MagneticContinuationJet.square] + simp only [pow_two] + have hr (x : ℝ) : U1 x + ζ * (V1 x - 2 * J.value x * J.first x) = J.second x := by + have hd := (hU x).add (((hV x).sub ((J.dValue x).pow 2)).const_mul ζ) + change HasDerivAt (fun y => U y + ζ * (V y - (J.value y) ^ 2)) + (U1 x + ζ * (V1 x - (2 : ℝ) * J.value x ^ (2 - 1) * J.first x)) x at hd + rw [← hJ] at hd + simpa only [Nat.cast_ofNat, Nat.reduceSub, pow_one] using hd.unique (J.dFirst x) + have hR : (fun x => U1 x + ζ * (V1 x - 2 * J.value x * J.first x)) = J.second := + funext hr + have hs : U2 z + ζ * (V2 z - 2 * (J.first z) ^ 2 - + 2 * J.value z * J.second z) = J.third z := by + have hd := (hU1 z).add (((hV1 z).sub + (((J.dValue z).mul (J.dFirst z)).const_mul 2)).const_mul ζ) + have hd' : HasDerivAt + (fun x => U1 x + ζ * (V1 x - 2 * J.value x * J.first x)) + (U2 z + ζ * (V2 z - 2 * (J.first z) ^ 2 - + 2 * J.value z * J.second z)) z := by + convert hd using 1 + · funext x + dsimp + ring + · ring + rw [hR] at hd' + exact hd'.unique (J.dSecond z) + have hM := magneticGaussianAverageTwo_hasFDerivAt_generator P P.toTwoJet F hF hG dF ζ hv z + have hQ := magneticGaussianAverageTwo_hasFDerivAt_generator P P.slopeTwoJet F hF hG dF ζ hv z + have hS := magneticGaussianAverageTwo_hasFDerivAt_generator P P.square.toTwoJet F hF hG dF ζ hv z + change HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F P.value q.2) + (pairLinear (J.second z / 2 + ζ * J.value z * J.first z) (J.first z)) (v, z) at hM + change HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F P.first q.2) + (pairLinear (U2 z / 2 + ζ * J.value z * U1 z) (U1 z)) (v, z) at hQ + change HasFDerivAt (fun q : ℝ × ℝ => + gaussianTiltAverage q.1 ζ F (fun y => (P.value y) ^ 2) q.2) + (pairLinear (V2 z / 2 + ζ * J.value z * V1 z) (V1 z)) (v, z) at hS + have hm : gaussianTiltAverage v ζ F P.value z = J.value z := + congrFun (field_gaussianTiltAverage_eq_transition v ζ hF P.mValue) z + have hd := hQ.add ((hS.sub (hM.pow 2)).const_mul ζ) + change HasFDerivAt (magneticHeatCurvature P F ζ) + (pairLinear (J.third z / 2 + ζ * ((J.first z) ^ 2 + J.value z * J.second z)) + (J.second z)) (v, z) + convert hd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro p + simp only [add_apply, sub_apply, smul_apply, pairLinear_apply, smul_eq_mul] + simp only [hm] + have hrz := hr z + linear_combination -(p.1 / 2) * hs - ζ * J.value z * p.1 * hrz - p.2 * hrz + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatInverse.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ccab4459cd07b48f2c48a9e8a9362865ded2ed9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatInverse.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatMean +import OAI.Probability.InvariantIsing.Magnetic.MagneticInverseVariation + +namespace OAI + +/-! Actual Gaussian continuations in the inverse mean coordinate. The +root equation, rather than a derivative of the inverse, is the premise; +the inverse derivative and drift cancellation are proved here. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped NNReal Topology + +namespace InvariantIsing + +theorem magneticHeatInverse_hasDerivAt (P : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v s : ℝ} (hv : 0 < v) + {b : ℝ → ℝ} (hb : ContinuousAt b v) + (he : ∀ᶠ t in 𝓝 v, magneticHeatMean P F ζ (t, b t) = s) + (hq : (P.transition P ζ (Real.toNNReal v) F hF hG dF).first (b v) ≠ 0) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + HasDerivAt b (-(J.second (b v) / 2 + ζ * J.value (b v) * J.first (b v)) / + J.first (b v)) v := by + exact parametric_bias_hasDerivAt hb hq + (magneticHeatMean_hasFDerivAt P F hF hG dF ζ hv (b v)) he + +theorem magneticHeatInverse_curvature_hasDerivAt (P : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v s : ℝ} (hv : 0 < v) + {b : ℝ → ℝ} (hb : ContinuousAt b v) + (he : ∀ᶠ t in 𝓝 v, magneticHeatMean P F ζ (t, b t) = s) + (hq : (P.transition P ζ (Real.toNNReal v) F hF hG dF).first (b v) ≠ 0) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + HasDerivAt (fun t => magneticHeatCurvature P F ζ (t, b t)) + ((J.first (b v)) ^ 2 / 2 * + (J.third (b v) / (J.first (b v)) ^ 2 - + (J.second (b v)) ^ 2 / (J.first (b v)) ^ 3) + + ζ * (J.first (b v)) ^ 2) v := by + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + have hd := inverse_mean_curvature_variation hb hq + (magneticHeatMean_hasFDerivAt P F hF hG dF ζ hv (b v)) he + (magneticHeatCurvature_hasFDerivAt P F hF hG dF ζ hv (b v)) + convert hd using 1 + field_simp [hq] + ring + +theorem magneticHeatInverse_continuation_hasDerivAt (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v s : ℝ} (hv : 0 < v) + {b : ℝ → ℝ} (hb : ContinuousAt b v) + (he : ∀ᶠ t in 𝓝 v, magneticHeatMean P F ζ (t, b t) = s) + (hq : (P.transition P ζ (Real.toNNReal v) F hF hG dF).first (b v) ≠ 0) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + let K := A.transition P ζ (Real.toNNReal v) F hF hG dF + HasDerivAt (fun t => magneticHeatMean A F ζ (t, b t)) + ((J.first (b v)) ^ 2 / 2 * + (K.second (b v) / (J.first (b v)) ^ 2 - + K.first (b v) * J.second (b v) / (J.first (b v)) ^ 3)) v := by + have hd := inverse_mean_curvature_variation hb hq + (magneticHeatMean_hasFDerivAt P F hF hG dF ζ hv (b v)) he + (magneticHeatContinuation_hasFDerivAt P A F hF hG dF ζ hv (b v)) + convert hd using 1 + field_simp [hq] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatJetContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatJetContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5daf4cc9c017d300d4f13df87e8fa9db91fffaba --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatJetContinuity.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatSecond +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatContinuity + +namespace OAI + +/-! Joint continuity of the actual first and second spatial derivatives +of the finite Gaussian continuation, including zero variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma continuous_magneticGaussianTest {F B : ℝ → ℝ} + (hF : Continuous F) (hG : HasLinearGrowth F) (hB : Continuous B) + (bB : MagneticContinuationBound B) (ζ : ℝ) : + Continuous (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F B q.2) := by + obtain ⟨C, L, hC, hL, bF⟩ := hG + obtain ⟨M, hM, bM⟩ := bB + exact continuous_field_gaussian_tilt_average + (hF.comp continuous_snd) (hB.comp continuous_snd) continuous_fst continuous_snd + hC hL hM (fun _ z => by simpa only [Real.norm_eq_abs] using bF z) (fun _ z => bM z) ζ + +lemma continuous_magneticHeatSpatial (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Continuous F) (hG : HasLinearGrowth F) (ζ : ℝ) : + Continuous (magneticHeatSpatial P A F ζ) := by + have hA1 : Continuous A.first := continuous_iff_continuousAt.mpr + fun z => (A.dFirst z).continuousAt + exact (continuous_magneticGaussianTest hF hG hA1 A.bFirst ζ).add + (((continuous_magneticHeatMean (A.mul P) F hF hG ζ).sub + ((continuous_magneticHeatMean A F hF hG ζ).mul + (continuous_magneticHeatMean P F hF hG ζ))).const_mul ζ) + +lemma continuous_magneticHeatSecond (P : MagneticContinuationJet) (A : MagneticContinuationFourJet) + (F : ℝ → ℝ) (hF : Continuous F) (hG : HasLinearGrowth F) (ζ : ℝ) : + Continuous (magneticHeatSecond P A F ζ) := by + exact (continuous_magneticHeatSpatial P A.slope F hF hG ζ).add + (((continuous_magneticHeatSpatial P (A.toMagneticContinuationJet.mul P) F hF hG ζ).sub + (((continuous_magneticHeatSpatial P A.toMagneticContinuationJet F hF hG ζ).mul + (continuous_magneticHeatMean P F hF hG ζ)).add + ((continuous_magneticHeatMean A.toMagneticContinuationJet F hF hG ζ).mul + (continuous_magneticHeatSpatial P P F hF hG ζ)))).const_mul ζ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatMean.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d8f7bc072a990966e70b4181f13dc88a8152d17 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatMean.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatCurvature + +namespace OAI + +/-! Joint heat derivatives of the mean spin and of a bounded continuation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticHeatMean (P : MagneticContinuationJet) (F : ℝ → ℝ) + (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + gaussianTiltAverage q.1 ζ F P.value q.2 + +lemma magneticHeatMean_eq (P : MagneticContinuationJet) (F : ℝ → ℝ) + (hF : Measurable F) (ζ : ℝ) (q : ℝ × ℝ) : + magneticHeatMean P F ζ q = + fieldSpinTransition ζ (Real.toNNReal q.1) F P.value q.2 := by + exact congrFun (field_gaussianTiltAverage_eq_transition q.1 ζ hF P.mValue) q.2 + +theorem magneticHeatMean_hasFDerivAt (P : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + HasFDerivAt (magneticHeatMean P F ζ) + (pairLinear (J.second z / 2 + ζ * J.value z * J.first z) + (J.first z)) (v, z) := by + exact magneticGaussianAverageTwo_hasFDerivAt_generator P P.toTwoJet F hF hG dF ζ hv z + +theorem magneticHeatContinuation_hasFDerivAt (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + let K := A.transition P ζ (Real.toNNReal v) F hF hG dF + HasFDerivAt (magneticHeatMean A F ζ) + (pairLinear (K.second z / 2 + ζ * J.value z * K.first z) + (K.first z)) (v, z) := by + exact magneticGaussianAverageTwo_hasFDerivAt_generator P A.toTwoJet F hF hG dF ζ hv z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatSecond.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatSecond.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5b25e3fcd9113dee3a002c24859037b66d62912 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatSecond.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFourJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatSpatial + +namespace OAI + +/-! Joint variance/spatial differentiation of the second spatial +derivative. Fourth terminal derivatives suffice; no unproved interchange +of differentiation and Gaussian integration is used. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticHeatSecond (P : MagneticContinuationJet) (A : MagneticContinuationFourJet) + (F : ℝ → ℝ) (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + magneticHeatSpatial P A.slope F ζ q + ζ * + (magneticHeatSpatial P (A.toMagneticContinuationJet.mul P) F ζ q - + (magneticHeatSpatial P A.toMagneticContinuationJet F ζ q * magneticHeatMean P F ζ q + + magneticHeatMean A.toMagneticContinuationJet F ζ q * magneticHeatSpatial P P F ζ q)) + +lemma magneticHeatSecond_eq (P : MagneticContinuationJet) (A : MagneticContinuationFourJet) + (F : ℝ → ℝ) (hF : Measurable F) (ζ : ℝ) (q : ℝ × ℝ) : + magneticHeatSecond P A F ζ q = magneticContinuationSecond ζ (Real.toNNReal q.1) + F P.value P.first A.value A.first A.second q.2 := by + unfold magneticHeatSecond + simp only [magneticHeatSpatial_eq _ _ F hF, magneticHeatMean_eq _ F hF] + rfl + +theorem magneticHeatSecond_hasFDerivAt (P : MagneticContinuationJet) (A : MagneticContinuationFourJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + let K := A.toMagneticContinuationJet.transition P ζ (Real.toNNReal v) F hF hG dF + HasFDerivAt (magneticHeatSecond P A F ζ) + (pairLinear (A.transitionFourth P ζ (Real.toNNReal v) F hF hG dF z / 2 + + ζ * (J.value z * K.third z + 2 * J.first z * K.second z + J.second z * K.first z)) + (K.third z)) (v, z) := by + let w := Real.toNNReal v + let J := P.transition P ζ w F hF hG dF + let K := A.toMagneticContinuationJet.transition P ζ w F hF hG dF + let R := A.slope.transition P ζ w F hF hG dF + let W := (A.toMagneticContinuationJet.mul P).transition P ζ w F hF hG dF + have h2 : R.first z + ζ * (W.first z - + (K.first z * J.value z + K.value z * J.first z)) = K.second z := by rfl + have h3 : R.second z + ζ * (W.second z - + (K.second z * J.value z + 2 * K.first z * J.first z + K.value z * J.second z)) = + K.third z := by + exact (congrFun (A.transition_third_eq P ζ w F hF hG dF) z).symm + have h4 : A.transitionFourth P ζ w F hF hG dF z = R.third z + ζ * + (W.third z - (K.third z * J.value z + 3 * K.second z * J.first z + + 3 * K.first z * J.second z + K.value z * J.third z)) := by rfl + have hR := magneticHeatSpatial_hasFDerivAt P A.slope F hF hG dF ζ hv z + have hW := magneticHeatSpatial_hasFDerivAt P (A.toMagneticContinuationJet.mul P) F hF hG dF ζ hv z + have hK := magneticHeatSpatial_hasFDerivAt P A.toMagneticContinuationJet F hF hG dF ζ hv z + have hJ := magneticHeatSpatial_hasFDerivAt P P F hF hG dF ζ hv z + have hA := magneticHeatContinuation_hasFDerivAt P A.toMagneticContinuationJet F hF hG dF ζ hv z + have hP := magneticHeatMean_hasFDerivAt P F hF hG dF ζ hv z + have eK : magneticHeatSpatial P A.toMagneticContinuationJet F ζ (v, z) = K.first z := + magneticHeatSpatial_eq P A.toMagneticContinuationJet F hF ζ _ + have eJ : magneticHeatSpatial P P F ζ (v, z) = J.first z := magneticHeatSpatial_eq P P F hF ζ _ + have eA : magneticHeatMean A.toMagneticContinuationJet F ζ (v, z) = K.value z := + magneticHeatMean_eq A.toMagneticContinuationJet F hF ζ _ + have eP : magneticHeatMean P F ζ (v, z) = J.value z := magneticHeatMean_eq P F hF ζ _ + have hd := hR.add ((hW.sub ((hK.mul hP).add (hA.mul hJ))).const_mul ζ) + convert hd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro p + simp only [add_apply, sub_apply, smul_apply, pairLinear_apply, smul_eq_mul, eK, eJ, eA, eP] + dsimp only [J, K, R, W, w] at h2 h3 h4 + linear_combination (p.1 / 2) * h4 - (ζ * J.value z * p.1 + p.2) * h3 - + ζ * J.first z * p.1 * h2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatSpatial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a19c8fb122c0139c2cebbc6839c6cb23ac09b8d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatSpatial.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticJetProduct +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatMean + +namespace OAI + +/-! The mixed derivative of the first spatial derivative of a bounded +finite Gaussian continuation. The proof differentiates actual normalized +averages and identifies coefficients by ordinary derivative uniqueness. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticHeatSpatial (P A : MagneticContinuationJet) (F : ℝ → ℝ) + (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + gaussianTiltAverage q.1 ζ F A.first q.2 + ζ * + (magneticHeatMean (A.mul P) F ζ q - magneticHeatMean A F ζ q * magneticHeatMean P F ζ q) + +lemma magneticHeatSpatial_eq (P A : MagneticContinuationJet) (F : ℝ → ℝ) + (hF : Measurable F) (ζ : ℝ) (q : ℝ × ℝ) : + magneticHeatSpatial P A F ζ q = + fieldTiltSpatial ζ (Real.toNNReal q.1) F P.value A.value A.first q.2 := by + unfold magneticHeatSpatial fieldTiltSpatial + rw [magneticHeatMean_eq _ _ hF, magneticHeatMean_eq _ _ hF, magneticHeatMean_eq _ _ hF] + rw [field_gaussianTiltAverage_eq_transition q.1 ζ hF A.mFirst] + rfl + +theorem magneticHeatSpatial_hasFDerivAt (P A : MagneticContinuationJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v : ℝ} (hv : 0 < v) (z : ℝ) : + let J := P.transition P ζ (Real.toNNReal v) F hF hG dF + let K := A.transition P ζ (Real.toNNReal v) F hF hG dF + HasFDerivAt (magneticHeatSpatial P A F ζ) + (pairLinear (K.third z / 2 + ζ * (J.value z * K.second z + J.first z * K.first z)) + (K.second z)) (v, z) := by + let w := Real.toNNReal v + let J := P.transition P ζ w F hF hG dF + let K := A.transition P ζ w F hF hG dF + let U := fieldSpinTransition ζ w F A.first + let V := fieldSpinTransition ζ w F (A.mul P).value + let U1 := fieldTiltSpatial ζ w F P.value A.first A.second + let V1 := fieldTiltSpatial ζ w F P.value (A.mul P).value (A.mul P).first + let U2 := magneticContinuationSecond ζ w F P.value P.first A.first A.second A.third + let V2 := magneticContinuationSecond ζ w F P.value P.first + (A.mul P).value (A.mul P).first (A.mul P).second + have hU (x : ℝ) : HasDerivAt U (U1 x) x := + magneticTwoJet_average_hasDerivAt P A.slopeTwoJet F hF hG dF ζ w x + have hV (x : ℝ) : HasDerivAt V (V1 x) x := + ((A.mul P).transition P ζ w F hF hG dF).dValue x + have hU1 (x : ℝ) : HasDerivAt U1 (U2 x) x := + magneticTwoJet_spatial_hasDerivAt P A.slopeTwoJet F hF hG dF ζ w x + have hV1 (x : ℝ) : HasDerivAt V1 (V2 x) x := + ((A.mul P).transition P ζ w F hF hG dF).dFirst x + have hK : K.first = fun x => U x + ζ * (V x - K.value x * J.value x) := by rfl + have hr (x : ℝ) : U1 x + ζ * (V1 x - (K.first x * J.value x + K.value x * J.first x)) = + K.second x := by + have hd := (hU x).add (((hV x).sub ((K.dValue x).mul (J.dValue x))).const_mul ζ) + change HasDerivAt (fun y => U y + ζ * (V y - K.value y * J.value y)) _ x at hd + rw [← hK] at hd + exact hd.unique (K.dFirst x) + have hR : (fun x => U1 x + ζ * (V1 x - (K.first x * J.value x + K.value x * J.first x))) = + K.second := funext hr + have hs : U2 z + ζ * (V2 z - (K.second z * J.value z + + 2 * K.first z * J.first z + K.value z * J.second z)) = K.third z := by + have hd := (hU1 z).add (((hV1 z).sub + (((K.dFirst z).mul (J.dValue z)).add ((K.dValue z).mul (J.dFirst z)))).const_mul ζ) + have hd' : HasDerivAt + (fun x => U1 x + ζ * (V1 x - (K.first x * J.value x + K.value x * J.first x))) + (U2 z + ζ * (V2 z - (K.second z * J.value z + + 2 * K.first z * J.first z + K.value z * J.second z))) z := by + convert hd using 1 + ring + rw [hR] at hd' + exact hd'.unique (K.dSecond z) + have hA := magneticHeatContinuation_hasFDerivAt P A F hF hG dF ζ hv z + have hP := magneticHeatMean_hasFDerivAt P F hF hG dF ζ hv z + have hB := magneticGaussianAverageTwo_hasFDerivAt_generator P A.slopeTwoJet F hF hG dF ζ hv z + have hC := magneticHeatContinuation_hasFDerivAt P (A.mul P) F hF hG dF ζ hv z + change HasFDerivAt (fun q : ℝ × ℝ => gaussianTiltAverage q.1 ζ F A.first q.2) + (pairLinear (U2 z / 2 + ζ * J.value z * U1 z) (U1 z)) (v, z) at hB + change HasFDerivAt (magneticHeatMean (A.mul P) F ζ) + (pairLinear (V2 z / 2 + ζ * J.value z * V1 z) (V1 z)) (v, z) at hC + have eA : magneticHeatMean A F ζ (v, z) = K.value z := magneticHeatMean_eq A F hF ζ _ + have eP : magneticHeatMean P F ζ (v, z) = J.value z := magneticHeatMean_eq P F hF ζ _ + have hd := hB.add ((hC.sub (hA.mul hP)).const_mul ζ) + convert hd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro p + simp only [add_apply, sub_apply, smul_apply, pairLinear_apply, smul_eq_mul, eA, eP] + have hrz := hr z + linear_combination -(p.1 / 2) * hs - ζ * J.value z * p.1 * hrz - p.2 * hrz + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatWeighted.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatWeighted.lean new file mode 100644 index 0000000000000000000000000000000000000000..18dc0836dc0fb17d89984b012b71c6471158c233 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeatWeighted.lean @@ -0,0 +1,125 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatSecond +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatInverse + +namespace OAI + +/-! The actual drift-free equation for q²Hᵤᵤ along the inverse mean. +All time derivatives come from normalized Gaussian averages. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticHeatWeighted (P A : MagneticContinuationFourJet) (F : ℝ → ℝ) + (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + magneticHeatSecond P.toMagneticContinuationJet A F ζ q - + magneticHeatSpatial P.toMagneticContinuationJet A.toMagneticContinuationJet F ζ q * + magneticHeatSecond P.toMagneticContinuationJet P F ζ q / magneticHeatCurvature P.toMagneticContinuationJet F ζ q + +lemma magneticHeatWeighted_eq (P A : MagneticContinuationFourJet) (F : ℝ → ℝ) + (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) (q : ℝ × ℝ) : + magneticHeatWeighted P A F ζ q = + magneticWeightedJetValue + (P.transition P.toMagneticContinuationJet ζ (Real.toNNReal q.1) F hF hG dF) + (A.transition P.toMagneticContinuationJet ζ (Real.toNNReal q.1) F hF hG dF) q.2 := by + unfold magneticHeatWeighted magneticWeightedJetValue + rw [magneticHeatSecond_eq _ _ F hF, magneticHeatSecond_eq _ _ F hF, + magneticHeatSpatial_eq _ _ F hF, magneticHeatCurvature_eq _ F hF] + simp only [MagneticContinuationFourJet.transition, MagneticContinuationJet.transition, + fieldCurvatureTransform, fieldTiltSpatial, pow_two] + +theorem magneticHeatWeighted_inverse_hasDerivAt (P A : MagneticContinuationFourJet) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) {v s : ℝ} (hv : 0 < v) + {b : ℝ → ℝ} (hb : ContinuousAt b v) + (he : ∀ᶠ t in 𝓝 v, magneticHeatMean P.toMagneticContinuationJet F ζ (t, b t) = s) + (hq : (P.toMagneticContinuationJet.transition P.toMagneticContinuationJet ζ + (Real.toNNReal v) F hF hG dF).first (b v) ≠ 0) : + let J := P.transition P.toMagneticContinuationJet ζ (Real.toNNReal v) F hF hG dF + let K := A.transition P.toMagneticContinuationJet ζ (Real.toNNReal v) F hF hG dF + HasDerivAt (fun t => magneticHeatWeighted P A F ζ (t, b t)) + ((J.first (b v)) ^ 2 / 2 * magneticWeightedInverseSecond J K (b v) + + (J.third (b v) / J.first (b v) - (J.second (b v)) ^ 2 / (J.first (b v)) ^ 2 + + 2 * ζ * J.first (b v)) * magneticWeightedJetValue J K (b v)) v := by + let w := Real.toNNReal v + let J := P.transition P.toMagneticContinuationJet ζ w F hF hG dF + let K := A.transition P.toMagneticContinuationJet ζ w F hF hG dF + let q := J.first (b v) + let r := J.second (b v) + let d := J.third (b v) + let e := J.fourth (b v) + change q ≠ 0 at hq + have hm := magneticHeatMean_hasFDerivAt P.toMagneticContinuationJet F hF hG dF ζ hv (b v) + have hc := inverse_mean_curvature_variation hb hq hm he + (magneticHeatCurvature_hasFDerivAt P.toMagneticContinuationJet F hF hG dF ζ hv (b v)) + have hr := inverse_mean_curvature_variation hb hq hm he + (magneticHeatSecond_hasFDerivAt P.toMagneticContinuationJet P F hF hG dF ζ hv (b v)) + have hk1 := inverse_mean_curvature_variation hb hq hm he + (magneticHeatSpatial_hasFDerivAt P.toMagneticContinuationJet A.toMagneticContinuationJet F hF hG dF ζ hv (b v)) + have hk2 := inverse_mean_curvature_variation hb hq hm he + (magneticHeatSecond_hasFDerivAt P.toMagneticContinuationJet A F hF hG dF ζ hv (b v)) + have eqc : magneticHeatCurvature P.toMagneticContinuationJet F ζ (v, b v) = q := by + rw [magneticHeatCurvature_eq _ F hF] + simp only [q, J, w, MagneticContinuationFourJet.transition, MagneticContinuationJet.transition, + fieldCurvatureTransform, fieldTiltSpatial, pow_two] + have eqr : magneticHeatSecond P.toMagneticContinuationJet P F ζ (v, b v) = r := + magneticHeatSecond_eq _ _ F hF ζ _ + have eqk1 : magneticHeatSpatial P.toMagneticContinuationJet A.toMagneticContinuationJet F ζ + (v, b v) = K.first (b v) := magneticHeatSpatial_eq _ _ F hF ζ _ + have hc' : HasDerivAt (fun t => magneticHeatCurvature P.toMagneticContinuationJet F ζ (t, b t)) + (d / 2 - r ^ 2 / (2 * q) + ζ * q ^ 2) v := by + change HasDerivAt _ (d / 2 + ζ * (q ^ 2 + J.value (b v) * r) - + r * (r / 2 + ζ * J.value (b v) * q) / q) v at hc + convert hc using 1 + field_simp [hq] + ring + have hr' : HasDerivAt (fun t => magneticHeatSecond P.toMagneticContinuationJet P F ζ (t, b t)) + (e / 2 - r * d / (2 * q) + 3 * ζ * q * r) v := by + change HasDerivAt _ (e / 2 + ζ * (J.value (b v) * d + 2 * q * r + r * q) - + d * (r / 2 + ζ * J.value (b v) * q) / q) v at hr + convert hr using 1 + field_simp [hq] + ring + have hk1' : HasDerivAt + (fun t => magneticHeatSpatial P.toMagneticContinuationJet A.toMagneticContinuationJet F ζ (t, b t)) + (K.third (b v) / 2 - r * K.second (b v) / (2 * q) + ζ * q * K.first (b v)) v := by + change HasDerivAt _ (K.third (b v) / 2 + + ζ * (J.value (b v) * K.second (b v) + q * K.first (b v)) - + K.second (b v) * (r / 2 + ζ * J.value (b v) * q) / q) v at hk1 + convert hk1 using 1 + field_simp [hq] + ring + have hk2' : HasDerivAt (fun t => magneticHeatSecond P.toMagneticContinuationJet A F ζ (t, b t)) + (K.fourth (b v) / 2 - r * K.third (b v) / (2 * q) + + 2 * ζ * q * K.second (b v) + ζ * r * K.first (b v)) v := by + change HasDerivAt _ (K.fourth (b v) / 2 + + ζ * (J.value (b v) * K.third (b v) + 2 * q * K.second (b v) + r * K.first (b v)) - + K.third (b v) * (r / 2 + ζ * J.value (b v) * q) / q) v at hk2 + convert hk2 using 1 + field_simp [hq] + ring + have hd := hk2'.sub ((hk1'.mul hr').div hc' (eqc.symm ▸ hq)) + convert hd using 1 + · rfl + · simp only [Pi.mul_apply] + rw [eqk1, eqr, eqc] + change q ^ 2 / 2 * + ((K.fourth (b v) - K.third (b v) * r / q - 2 * K.second (b v) * d / q + + 2 * K.second (b v) * r ^ 2 / q ^ 2 - K.first (b v) * e / q + + 3 * K.first (b v) * r * d / q ^ 2 - 2 * K.first (b v) * r ^ 3 / q ^ 3) / q ^ 2 - + (K.third (b v) - (K.second (b v) * r + K.first (b v) * d) / q + + K.first (b v) * r ^ 2 / q ^ 2) * r / q ^ 3) + + (d / q - r ^ 2 / q ^ 2 + 2 * ζ * q) * + (K.second (b v) - K.first (b v) * r / q) = _ + field_simp [hq] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightConcavity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightConcavity.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d2ea869527471a3fdb41fa61b4f617170dd508b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightConcavity.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeightSupport + +namespace OAI + +/-! Constrained finite-field concavity on the strict height cone, derived +from the actual magnetic supporting planes. -/ + +noncomputable section +open Set +open scoped BigOperators + +namespace InvariantIsing + +theorem concaveOn_constrainedHeightFieldValue (h : FieldStep) {m : ℝ} (hm : |m| < 1) : + ConcaveOn ℝ (fieldStrictHeightCone h.depth) (constrainedHeightFieldValue h m) := by + refine ⟨convex_fieldStrictHeightCone _, ?_⟩ + intro r hr q hq a b ha hb hab + let p := a • r + b • q + have hp : p ∈ fieldStrictHeightCone h.depth := + convex_fieldStrictHeightCone _ hr hq ha hb hab + let G := fun i : Fin (h.depth + 1) => -(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h p hp) m i + have hR := magneticHeight_support_strict h hm p r hp hr + have hQ := magneticHeight_support_strict h hm p q hp hq + change constrainedFieldValue (fieldStepOfStrictHeights h r hr) m ≤ + constrainedFieldValue (fieldStepOfStrictHeights h p hp) m + + ∑ i, G i * (r i - p i) at hR + change constrainedFieldValue (fieldStepOfStrictHeights h q hq) m ≤ + constrainedFieldValue (fieldStepOfStrictHeights h p hp) m + + ∑ i, G i * (q i - p i) at hQ + have hc : a * (∑ i, G i * (r i - p i)) + + b * (∑ i, G i * (q i - p i)) = 0 := by + rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_eq_zero + intro i _ + have he : a * (r i - p i) + b * (q i - p i) = 0 := by + calc + _ = a * r i + b * q i - (a + b) * p i := by ring + _ = 0 := by + rw [hab, one_mul] + simp only [p, Pi.add_apply, Pi.smul_apply, smul_eq_mul, sub_self] + calc + a * (G i * (r i - p i)) + b * (G i * (q i - p i)) = + G i * (a * (r i - p i) + b * (q i - p i)) := by ring + _ = 0 := by rw [he, mul_zero] + have hRa := mul_le_mul_of_nonneg_left hR ha + have hQb := mul_le_mul_of_nonneg_left hQ hb + have hv : a * constrainedFieldValue (fieldStepOfStrictHeights h p hp) m + + b * constrainedFieldValue (fieldStepOfStrictHeights h p hp) m = + constrainedFieldValue (fieldStepOfStrictHeights h p hp) m := by + rw [← add_mul, hab, one_mul] + change a * constrainedHeightFieldValue h m r + b * constrainedHeightFieldValue h m q ≤ + constrainedHeightFieldValue h m p + simp only [constrainedHeightFieldValue, dite_eq_left hr, dite_eq_left hq, dite_eq_left hp] + nlinarith [hRa, hQb, hc, hv] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightLipschitz.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9c66ba4b57853258b8a33d29b028f54e79bd257 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightLipschitz.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldGradient +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldHeightHessian +import OAI.Probability.InvariantIsing.Fields.FieldHeightBox + +namespace OAI + +/-! The prescribed-magnetization functional has the uniform one-half +height modulus on a fixed strict partition. This uses the envelope +derivative and bounded spin products, independently of concavity. -/ + +noncomputable section +open Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma abs_weighted_unit_sum_le {I : Type*} [Fintype I] (w q d : I → ℝ) + (hw : ∀ i, 0 ≤ w i) (hq : ∀ i, q i ∈ Icc (0 : ℝ) 1) : + |∑ i, (-w i / 2 * q i) * d i| ≤ (1 / 2 : ℝ) * ∑ i, w i * |d i| := by + calc + _ ≤ ∑ i, |(-w i / 2 * q i) * d i| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i, (w i / 2) * |d i| := by + apply Finset.sum_le_sum + intro i _ + rw [abs_mul, abs_mul, abs_div, abs_neg, abs_of_nonneg (hw i), + abs_of_nonneg (hq i).1, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + exact mul_le_mul_of_nonneg_right + (mul_le_of_le_one_right (div_nonneg (hw i) (by norm_num)) (hq i).2) (abs_nonneg _) + _ = _ := by rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro i _; ring + +lemma magneticHeight_gradient_sum (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) {s : ℝ} (hs : |s| < 1) + (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) : + (∑ i, F.P i (r, magneticHeightBias h s r) * d i) - d (Fin.last h.depth) / 2 = + ∑ i, (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h r hrs) s i) * d i := by + have hc : (∑ i, (F.P i (r, magneticHeightBias h s r) - + (if i = Fin.last h.depth then 1 / 2 else 0)) * d i) = + (∑ i, F.P i (r, magneticHeightBias h s r) * d i) - d (Fin.last h.depth) / 2 := by + simp only [sub_mul, Finset.sum_sub_distrib, ite_mul, zero_mul] + simp [div_eq_mul_inv, mul_comm] + rw [← hc] + apply Finset.sum_congr rfl + intro i _ + rw [magneticHeight_optimized_gradient h F hU hs r hr hrs i] + rfl + +theorem constrainedFieldValue_strict_lipschitz (h : FieldStep) {s : ℝ} (hs : |s| < 1) + (r q : Fin (h.depth + 1) → ℝ) + (hr : r ∈ fieldStrictHeightCone h.depth) (hq : q ∈ fieldStrictHeightCone h.depth) : + |constrainedFieldValue (fieldStepOfStrictHeights h q hq) s - + constrainedFieldValue (fieldStepOfStrictHeights h r hr) s| ≤ + (1 / 2 : ℝ) * ∑ i, (h.cut i.succ - h.cut i.castSucc) * |q i - r i| := by + classical + obtain ⟨lo, V, hlo, hrI, hqI⟩ := fieldHeightBox_pair r q hr hq + let I := fieldHeightBox h.depth lo V + have hI : IsOpen I := isOpen_fieldHeightBox _ _ _ + obtain ⟨F, hF⟩ := fieldHeightBox_family h lo V hlo + let d := q - r + let f := fun t : ℝ => constrainedHeightFieldValue h s (r + t • d) + let g := fun t : ℝ => (∑ i, F.P i (r + t • d, + magneticHeightBias h s (r + t • d)) * d i) - d (Fin.last h.depth) / 2 + have hp (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : r + t • d ∈ I := by + have he : r + t • d = (1 - t) • r + t • q := by dsimp only [d]; module + rw [he] + exact convex_fieldHeightBox _ _ _ hrI hqI (sub_nonneg.mpr ht.2) ht.1 (by ring) + have hstrict (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : + r + t • d ∈ fieldStrictHeightCone h.depth := + fieldHeightBox_subset_strict hlo.le (hp t ht) + have hd (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : HasDerivAt f (g t) t := + hasDerivAt_constrainedHeightFieldValue_line_at h F hI hF hs r d t (hp t ht) (hstrict t ht) + have hb (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : + ‖g t‖ ≤ (1 / 2 : ℝ) * ∑ i, (h.cut i.succ - h.cut i.castSucc) * |q i - r i| := by + rw [Real.norm_eq_abs] + dsimp only [g] + rw [magneticHeight_gradient_sum h F hF hs _ d (hp t ht) (hstrict t ht)] + exact abs_weighted_unit_sum_le _ _ d + (fun i => (sub_pos.mpr (h.ordered_cut i.castSucc_lt_succ)).le) + (fun i => magneticFieldLevel_mem_unit (fieldStepOfStrictHeights h (r + t • d) + (hstrict t ht)) s i) + have hh := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun t ht => (hd t ht).hasDerivWithinAt) hb (convex_Icc (0 : ℝ) 1) + (show (0 : ℝ) ∈ Icc (0 : ℝ) 1 by simp) (show (1 : ℝ) ∈ Icc (0 : ℝ) 1 by simp) + have he0 : f 0 = constrainedFieldValue (fieldStepOfStrictHeights h r hr) s := by + simp only [f, zero_smul, add_zero, constrainedHeightFieldValue, dite_eq_left hr] + have he1 : f 1 = constrainedFieldValue (fieldStepOfStrictHeights h q hq) s := by + have he : r + (1 : ℝ) • d = q := by dsimp only [d]; module + simp only [f, he, constrainedHeightFieldValue, dite_eq_left hq] + simpa only [he0, he1, Real.norm_eq_abs, sub_zero, abs_one, mul_one] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightLists.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightLists.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3c0856ffa416c9db9abd67f4b60be2c980258db --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightLists.lean @@ -0,0 +1,129 @@ +import OAI.Probability.InvariantIsing.Fields.FieldHeightLists + +namespace OAI + +/-! The literal two-increment decomposition of a positive-index height +update after removing the ordinary Gaussian root. -/ + +noncomputable section +open Set +open scoped NNReal + +namespace InvariantIsing + +private lemma allIncrements_toNNReal (h : FieldStep) : + fieldAllIncrements h = List.ofFn (fun j : Fin (h.depth + 1) => + (h.cut j.castSucc, Real.toNNReal (fieldHeightIncrement h.height j))) := by + unfold fieldAllIncrements + apply congrArg List.ofFn + funext j + apply Prod.ext + · rfl + · exact (Real.toNNReal_of_nonneg (fieldIncrement_nonneg h j)).symm + +private lemma allIncrements_take_positive (h : FieldStep) (k : ℕ) (hk : 0 < k) : + (fieldAllIncrements h).take k = + (0, NNReal.mk (h.height 0) (h.nonneg 0)) :: + (scalarFieldIncrements h).take (k - 1) := by + cases k with + | zero => omega + | succ k => simp only [fieldAllIncrements_root, List.take_succ_cons, Nat.add_sub_cancel] + +private lemma scalarIncrements_of_adjacent (h k : FieldStep) (j : Fin h.depth) + (hj : 0 < j.val) (t : ℝ) (hroot : k.height 0 = h.height 0) + (hall : fieldAllIncrements k = + fieldAdjacentIncrements ((fieldAllIncrements h).take j.val) + ((fieldAllIncrements h).drop (j.val + 2)) + (fieldIncrement h j.castSucc).2 (fieldIncrement h j.succ).2 + (fieldIncrement h j.castSucc).1 (fieldIncrement h j.succ).1 t) : + scalarFieldIncrements k = (scalarFieldIncrements h).take (j.val - 1) ++ + ((fieldIncrement h j.castSucc).1, Real.toNNReal ((fieldIncrement h j.castSucc).2 + t)) :: + ((fieldIncrement h j.succ).1, Real.toNNReal ((fieldIncrement h j.succ).2 - t)) :: + (scalarFieldIncrements h).drop (j.val + 1) := by + have ht := allIncrements_take_positive h j.val hj + have hd : (fieldAllIncrements h).drop (j.val + 2) = + (scalarFieldIncrements h).drop (j.val + 1) := by + rw [fieldAllIncrements_root] + exact List.drop_succ_cons + rw [fieldAllIncrements_root k, ht, hd, fieldAdjacentIncrements_root] at hall + have hr : (NNReal.mk (k.height 0) (k.nonneg 0)) = + (NNReal.mk (h.height 0) (h.nonneg 0)) := Subtype.ext hroot + rw [hr] at hall + exact (List.cons.inj hall).2 + +lemma scalarFieldIncrements_interior_layout (h : FieldStep) (j : Fin h.depth) + (hj : 0 < j.val) : + scalarFieldIncrements h = (scalarFieldIncrements h).take (j.val - 1) ++ + ((fieldIncrement h j.castSucc).1, Real.toNNReal (fieldIncrement h j.castSucc).2) :: + ((fieldIncrement h j.succ).1, Real.toNNReal (fieldIncrement h j.succ).2) :: + (scalarFieldIncrements h).drop (j.val + 1) := by + have he := updated_increments_interior h j 0 + simp only [add_zero, Function.update_eq_self] at he + rw [← allIncrements_toNNReal h] at he + simpa only [add_zero, sub_zero] using scalarIncrements_of_adjacent h h j hj 0 rfl he + +lemma scalarFieldIncrements_update_interior (h : FieldStep) (j : Fin h.depth) + (hj : 0 < j.val) (t : ℝ) + (ht : Function.update h.height j.castSucc (h.height j.castSucc + t) ∈ + fieldStrictHeightCone h.depth) : + scalarFieldIncrements (fieldStepOfStrictHeights h + (Function.update h.height j.castSucc (h.height j.castSucc + t)) ht) = + (scalarFieldIncrements h).take (j.val - 1) ++ + ((fieldIncrement h j.castSucc).1, Real.toNNReal ((fieldIncrement h j.castSucc).2 + t)) :: + ((fieldIncrement h j.succ).1, Real.toNNReal ((fieldIncrement h j.succ).2 - t)) :: + (scalarFieldIncrements h).drop (j.val + 1) := by + apply scalarIncrements_of_adjacent h _ j hj t ?_ + (fieldAllIncrements_update_interior h j t ht) + change Function.update h.height j.castSucc (h.height j.castSucc + t) 0 = h.height 0 + apply Function.update_of_ne + intro he + have hv := congrArg Fin.val he + simp only [Fin.val_zero, Fin.val_castSucc] at hv + omega + +private lemma scalarIncrements_of_terminal (h k : FieldStep) (hn : 0 < h.depth) + (t : ℝ) (hroot : k.height 0 = h.height 0) + (hall : fieldAllIncrements k = + fieldTerminalIncrements ((fieldAllIncrements h).take h.depth) + (fieldIncrement h (Fin.last h.depth)).2 (fieldIncrement h (Fin.last h.depth)).1 t) : + scalarFieldIncrements k = (scalarFieldIncrements h).take (h.depth - 1) ++ + [((fieldIncrement h (Fin.last h.depth)).1, + Real.toNNReal ((fieldIncrement h (Fin.last h.depth)).2 + t))] := by + rw [fieldAllIncrements_root k, allIncrements_take_positive h h.depth hn] at hall + simp only [fieldTerminalIncrements, List.cons_append] at hall + have hr : (NNReal.mk (k.height 0) (k.nonneg 0)) = + (NNReal.mk (h.height 0) (h.nonneg 0)) := Subtype.ext hroot + rw [hr] at hall + exact (List.cons.inj hall).2 + +lemma scalarFieldIncrements_terminal_layout (h : FieldStep) (hn : 0 < h.depth) : + scalarFieldIncrements h = (scalarFieldIncrements h).take (h.depth - 1) ++ + [((fieldIncrement h (Fin.last h.depth)).1, + Real.toNNReal (fieldIncrement h (Fin.last h.depth)).2)] := by + have he := updated_increments_final h 0 + simp only [add_zero, Function.update_eq_self] at he + rw [← allIncrements_toNNReal h] at he + simpa only [add_zero] using scalarIncrements_of_terminal h h hn 0 rfl he + +lemma scalarFieldIncrements_update_terminal (h : FieldStep) (hn : 0 < h.depth) + (t : ℝ) (ht : Function.update h.height (Fin.last h.depth) + (h.height (Fin.last h.depth) + t) ∈ fieldStrictHeightCone h.depth) : + scalarFieldIncrements (fieldStepOfStrictHeights h + (Function.update h.height (Fin.last h.depth) (h.height (Fin.last h.depth) + t)) ht) = + (scalarFieldIncrements h).take (h.depth - 1) ++ + [((fieldIncrement h (Fin.last h.depth)).1, + Real.toNNReal ((fieldIncrement h (Fin.last h.depth)).2 + t))] := by + apply scalarIncrements_of_terminal h _ hn t ?_ + (fieldAllIncrements_update_final h t ht) + change Function.update h.height (Fin.last h.depth) (h.height (Fin.last h.depth) + t) 0 = h.height 0 + apply Function.update_of_ne + intro he + have hv := congrArg Fin.val he + simp only [Fin.val_zero, Fin.val_last] at hv + omega + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..d74b555adcf156421a54b93035d74b316f5ae8d9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightOrder.lean @@ -0,0 +1,197 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAdjacentSquare +import OAI.Probability.InvariantIsing.Magnetic.MagneticTerminalOrder +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeightLists +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldInverseConvex + +namespace OAI + +/-! A literal increase of an interior height decreases each earlier +conditional square mean at fixed prescribed magnetization. -/ + +noncomputable section +open Set +open scoped NNReal + +namespace InvariantIsing + +private lemma nonneg_toNNReal_add (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : + Real.toNNReal (a + b) = Real.toNNReal a + Real.toNNReal b := by + rw [Real.toNNReal_of_nonneg (add_nonneg ha hb), Real.toNNReal_of_nonneg ha, + Real.toNNReal_of_nonneg hb] + rfl + +private lemma closedSquare_congr {L M : List (ℝ × ℝ≥0)} (he : L = M) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (i : Fin (L.length + 1)) (j : Fin (M.length + 1)) (hij : i.val = j.val) + (ζ : ℝ) (p : ℝ × ℝ) : + closedMagneticContinuation L (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ p = + closedMagneticContinuation M (magneticScalarSquareFourJet M hM j).toMagneticContinuationJet ζ p := by + subst M + have hi : i = j := Fin.ext hij + subst j + rfl + +lemma magneticFieldLevel_eq_closed (h : FieldStep) (i : Fin (h.depth + 1)) + {s : ℝ} (hs : |s| < 1) : + magneticFieldLevel h s i = closedMagneticContinuation (scalarFieldIncrements h) + (magneticScalarSquareFourJet _ (scalarFieldIncrements_positive h) + (Fin.cast (by rw [scalarFieldIncrements_length]) i)).toMagneticContinuationJet + 0 (h.height 0, s) := by + rw [congrFun (magneticFieldLevel_eq_slab h i) s, closedMagneticContinuation, ite_eq_left hs] + +theorem magneticFieldLevel_interior_update_le (h : FieldStep) (j : Fin h.depth) + (hj : 0 < j.val) {t s : ℝ} (ht : 0 ≤ t) + (htb : t ≤ (fieldIncrement h j.succ).2) + (hk : Function.update h.height j.castSucc (h.height j.castSucc + t) ∈ + fieldStrictHeightCone h.depth) (hs : |s| < 1) + (i : Fin (h.depth + 1)) (hij : i.val < j.val) : + magneticFieldLevel (fieldStepOfStrictHeights h + (Function.update h.height j.castSucc (h.height j.castSucc + t)) hk) s i ≤ + magneticFieldLevel h s i := by + let k := fieldStepOfStrictHeights h + (Function.update h.height j.castSucc (h.height j.castSucc + t)) hk + let P := (scalarFieldIncrements h).take (j.val - 1) + let S := (scalarFieldIncrements h).drop (j.val + 1) + let a := (fieldIncrement h j.castSucc).1 + let b := (fieldIncrement h j.succ).1 + let x := Real.toNNReal (fieldIncrement h j.castSucc).2 + let δ := Real.toNNReal t + let y := Real.toNNReal ((fieldIncrement h j.succ).2 - t) + let N := P ++ (a, x + δ) :: (b, y) :: S + let O := P ++ (a, x) :: (b, δ + y) :: S + have hx : Real.toNNReal ((fieldIncrement h j.castSucc).2 + t) = x + δ := + nonneg_toNNReal_add _ _ (fieldIncrement_nonneg h _) ht + have hy : δ + y = Real.toNNReal (fieldIncrement h j.succ).2 := by + dsimp only [δ, y] + rw [← nonneg_toNNReal_add _ _ ht (sub_nonneg.mpr htb)] + congr 1 + ring + have hn : scalarFieldIncrements k = N := by + rw [scalarFieldIncrements_update_interior h j hj t hk, hx] + have ho : scalarFieldIncrements h = O := by + rw [scalarFieldIncrements_interior_layout h j hj] + dsimp only [O, P, S, a, b, x] + rw [hy] + have hN : ∀ av ∈ N, 0 < av.1 := by + intro av hav + apply scalarFieldIncrements_positive k av + rwa [hn] + have hO : ∀ av ∈ O, 0 < av.1 := by + intro av hav + apply scalarFieldIncrements_positive h av + rwa [ho] + have hP : ∀ av ∈ P, 0 < av.1 := fun av hav => + scalarFieldIncrements_positive h av (List.mem_of_mem_take hav) + have hP1 : ∀ av ∈ P, av.1 ≤ 1 := fun av hav => + scalarFieldIncrements_exponent_le_one h av (List.mem_of_mem_take hav) + have hS : ∀ av ∈ S, 0 < av.1 := fun av hav => + scalarFieldIncrements_positive h av (List.mem_of_mem_drop hav) + have hS1 : ∀ av ∈ S, av.1 ≤ 1 := fun av hav => + scalarFieldIncrements_exponent_le_one h av (List.mem_of_mem_drop hav) + have ha : 0 < a := by + change 0 < h.cut j.castSucc.castSucc + rw [← h.first] + exact h.ordered_cut (Fin.lt_def.mpr hj) + have hab : a ≤ b := by + change h.cut j.castSucc.castSucc ≤ h.cut j.succ.castSucc + exact h.ordered_cut.monotone (Fin.le_iff_val_le_val.mpr (Nat.le_succ _)) + have hb : b ≤ 1 := by + change h.cut j.succ.castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + have hip : i.val ≤ P.length := by + dsimp only [P] + rw [List.length_take, scalarFieldIncrements_length, Nat.min_eq_left (by omega)] + omega + have hcmp := magneticClosedSquare_adjacent_transfer P S hP hP1 hS hS1 ha hab hb + x δ y hN hO i.val hip (le_refl 0) (by norm_num) (h.nonneg 0) + ⟨(abs_lt.mp hs).1.le, (abs_lt.mp hs).2.le⟩ + have hroot : k.height 0 = h.height 0 := by + change Function.update h.height j.castSucc (h.height j.castSucc + t) 0 = h.height 0 + apply Function.update_of_ne + intro he + have hv := congrArg Fin.val he + simp only [Fin.val_zero, Fin.val_castSucc] at hv + omega + rw [magneticFieldLevel_eq_closed k i hs, magneticFieldLevel_eq_closed h i hs, hroot] + have en := closedSquare_congr hn (scalarFieldIncrements_positive k) hN + (Fin.cast (by rw [scalarFieldIncrements_length]; rfl) i) + ⟨i.val, by dsimp only [N]; simp only [List.length_append, List.length_cons]; omega⟩ + rfl 0 (h.height 0, s) + have eo := closedSquare_congr ho (scalarFieldIncrements_positive h) hO + (Fin.cast (by rw [scalarFieldIncrements_length]) i) + ⟨i.val, by dsimp only [O]; simp only [List.length_append, List.length_cons]; omega⟩ + rfl 0 (h.height 0, s) + exact en.le.trans (hcmp.trans eo.ge) + +theorem magneticFieldLevel_terminal_update_le (h : FieldStep) {t s : ℝ} (ht : 0 ≤ t) + (hk : Function.update h.height (Fin.last h.depth) (h.height (Fin.last h.depth) + t) ∈ + fieldStrictHeightCone h.depth) (hs : |s| < 1) + (i : Fin (h.depth + 1)) (hi : i.val < h.depth) : + magneticFieldLevel (fieldStepOfStrictHeights h + (Function.update h.height (Fin.last h.depth) (h.height (Fin.last h.depth) + t)) hk) s i ≤ + magneticFieldLevel h s i := by + have hn : 0 < h.depth := by omega + let k := fieldStepOfStrictHeights h + (Function.update h.height (Fin.last h.depth) (h.height (Fin.last h.depth) + t)) hk + let P := (scalarFieldIncrements h).take (h.depth - 1) + let a := (fieldIncrement h (Fin.last h.depth)).1 + let x := Real.toNNReal (fieldIncrement h (Fin.last h.depth)).2 + let δ := Real.toNNReal t + let N := P ++ [(a, x + δ)] + let O := P ++ [(a, x)] + have hx : Real.toNNReal ((fieldIncrement h (Fin.last h.depth)).2 + t) = x + δ := + nonneg_toNNReal_add _ _ (fieldIncrement_nonneg h _) ht + have hnew : scalarFieldIncrements k = N := by + rw [scalarFieldIncrements_update_terminal h hn t hk, hx] + have hold : scalarFieldIncrements h = O := scalarFieldIncrements_terminal_layout h hn + have hN : ∀ av ∈ N, 0 < av.1 := by + intro av hav + apply scalarFieldIncrements_positive k av + rwa [hnew] + have hO : ∀ av ∈ O, 0 < av.1 := by + intro av hav + apply scalarFieldIncrements_positive h av + rwa [hold] + have hP : ∀ av ∈ P, 0 < av.1 := fun av hav => + scalarFieldIncrements_positive h av (List.mem_of_mem_take hav) + have hP1 : ∀ av ∈ P, av.1 ≤ 1 := fun av hav => + scalarFieldIncrements_exponent_le_one h av (List.mem_of_mem_take hav) + have ha : 0 < a := by + change 0 < h.cut (Fin.last h.depth).castSucc + rw [← h.first] + exact h.ordered_cut (Fin.lt_def.mpr hn) + have ha1 : a ≤ 1 := by + change h.cut (Fin.last h.depth).castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + have hip : i.val ≤ P.length := by + dsimp only [P] + rw [List.length_take, scalarFieldIncrements_length, Nat.min_eq_left (by omega)] + omega + have hcmp := magneticClosedSquare_terminal_variance_mono P hP hP1 ha ha1 x δ hN hO + i.val hip (le_refl 0) (by norm_num) (h.nonneg 0) + ⟨(abs_lt.mp hs).1.le, (abs_lt.mp hs).2.le⟩ + have hroot : k.height 0 = h.height 0 := by + change Function.update h.height (Fin.last h.depth) (h.height (Fin.last h.depth) + t) 0 = h.height 0 + apply Function.update_of_ne + intro he + have hv := congrArg Fin.val he + simp only [Fin.val_zero, Fin.val_last] at hv + omega + rw [magneticFieldLevel_eq_closed k i hs, magneticFieldLevel_eq_closed h i hs, hroot] + have en := closedSquare_congr hnew (scalarFieldIncrements_positive k) hN + (Fin.cast (by rw [scalarFieldIncrements_length]; rfl) i) + ⟨i.val, by dsimp only [N]; simp only [List.length_append, List.length_singleton]; omega⟩ + rfl 0 (h.height 0, s) + have eo := closedSquare_congr hold (scalarFieldIncrements_positive h) hO + (Fin.cast (by rw [scalarFieldIncrements_length]) i) + ⟨i.val, by dsimp only [O]; simp only [List.length_append, List.length_singleton]; omega⟩ + rfl 0 (h.height 0, s) + exact en.le.trans (hcmp.trans eo.ge) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightSupport.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..40f026479bbf6c0dba2ce792f6a8f419129c97ab --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticHeightSupport.lean @@ -0,0 +1,125 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticOffDiagonalHessian +import OAI.Probability.InvariantIsing.Fields.FieldHeightBox + +namespace OAI + +/-! A supporting plane for the actual finite constrained field on the +strict height cone. The optimizing bias is varied along the segment. -/ + +noncomputable section +open Set Filter +open scoped BigOperators + +namespace InvariantIsing + +private lemma magnetic_gradient_line_at (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (t : ℝ) + (hr : r + t • d ∈ I) (hrs : r + t • d ∈ fieldStrictHeightCone h.depth) : + HasDerivAt (fun q : ℝ => + (∑ i, F.P i (r + q • d, magneticHeightBias h s (r + q • d)) * d i) - + d (Fin.last h.depth) / 2) + (∑ i, ∑ j, magneticHeightSchur h F s (r + t • d) i j * d i * d j) t := by + have hi (i : Fin (h.depth + 1)) := + (hasDerivAt_magneticHeightP_line h F hI hU hs (r + t • d) d hr hrs i).mul_const (d i) + have hd := (HasDerivAt.sum (fun i (_ : i ∈ Finset.univ) => hi i)).sub_const + (d (Fin.last h.depth) / 2) + have heq : (∑ i, (∑ j, magneticHeightSchur h F s (r + t • d) i j * d j) * d i) = + ∑ i, ∑ j, magneticHeightSchur h F s (r + t • d) i j * d i * d j := by + simp only [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + rw [heq] at hd + have hd' : HasDerivAt (fun q : ℝ => + (∑ i, F.P i (r + t • d + q • d, + magneticHeightBias h s (r + t • d + q • d)) * d i) - d (Fin.last h.depth) / 2) + (∑ i, ∑ j, magneticHeightSchur h F s (r + t • d) i j * d i * d j) (t - t) := by + simpa only [sub_self, Finset.sum_apply] using hd + have hc := hd'.comp (h := fun q : ℝ => q - t) t ((hasDerivAt_id t).sub_const t) + have hv (q : ℝ) : r + t • d + (q - t) • d = r + q • d := by module + simpa only [Function.comp_def, hv, mul_one] using hc + +theorem magneticHeight_support_strict (h : FieldStep) {m : ℝ} (hm : |m| < 1) + (r q : Fin (h.depth + 1) → ℝ) + (hr : r ∈ fieldStrictHeightCone h.depth) (hq : q ∈ fieldStrictHeightCone h.depth) : + constrainedFieldValue (fieldStepOfStrictHeights h q hq) m ≤ + constrainedFieldValue (fieldStepOfStrictHeights h r hr) m + + ∑ i, (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h r hr) m i) * (q i - r i) := by + classical + obtain ⟨lo, V, hlo, hrI, hqI⟩ := fieldHeightBox_pair r q hr hq + let I := fieldHeightBox h.depth lo V + have hI : IsOpen I := isOpen_fieldHeightBox _ _ _ + obtain ⟨F, hF⟩ := fieldHeightBox_family h lo V hlo + let d := q - r + let f := fun t : ℝ => constrainedHeightFieldValue h m (r + t • d) + let g := fun t : ℝ => + (∑ i, F.P i (r + t • d, magneticHeightBias h m (r + t • d)) * d i) - + d (Fin.last h.depth) / 2 + let z := fun t : ℝ => ∑ i, ∑ j, + magneticHeightSchur h F m (r + t • d) i j * d i * d j + have hp (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : r + t • d ∈ I := by + have he : r + t • d = (1 - t) • r + t • q := by dsimp only [d]; module + rw [he] + exact convex_fieldHeightBox _ _ _ hrI hqI (sub_nonneg.mpr ht.2) ht.1 (by ring) + have hstrict (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : + r + t • d ∈ fieldStrictHeightCone h.depth := + fieldHeightBox_subset_strict hlo.le (hp t ht) + have hf (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : HasDerivAt f (g t) t := + hasDerivAt_constrainedHeightFieldValue_line_at h F hI hF hm r d t (hp t ht) (hstrict t ht) + have hg (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : HasDerivAt g (z t) t := + magnetic_gradient_line_at h F hI hF hm r d t (hp t ht) (hstrict t ht) + have hz (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : z t ≤ 0 := + magneticHeightSchur_quadratic_nonpos h F hI hF hm _ (hp t ht) (hstrict t ht) d + have hanti : AntitoneOn g (Icc (0 : ℝ) 1) := + antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc 0 1) + (fun t ht => (hg t ht).continuousAt.continuousWithinAt) + (fun t ht => (hg t (interior_subset ht)).hasDerivWithinAt) + (fun t ht => hz t (interior_subset ht)) + have hbound : ∀ t ∈ interior (Icc (0 : ℝ) 1), deriv f t ≤ g 0 := by + intro t ht + rw [(hf t (interior_subset ht)).deriv] + exact hanti (by simp) (interior_subset ht) (interior_subset ht).1 + have hsup := (convex_Icc (0 : ℝ) 1).image_sub_le_mul_sub_of_deriv_le + (fun t ht => (hf t ht).continuousAt.continuousWithinAt) + (fun t ht => (hf t (interior_subset ht)).differentiableAt.differentiableWithinAt) + hbound 0 (by simp) 1 (by simp) zero_le_one + let G : Fin (h.depth + 1) → ℝ := fun i => + -(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h r hr) m i + have hgrad (i : Fin (h.depth + 1)) : + F.P i (r, magneticHeightBias h m r) = + G i + (if i = Fin.last h.depth then (1 / 2 : ℝ) else 0) := by + have he := magneticHeight_optimized_gradient h F hF hm r hrI hr i + dsimp only [G] + linarith + have hsum : (∑ i, F.P i (r, magneticHeightBias h m r) * d i) = + (∑ i, G i * d i) + d (Fin.last h.depth) / 2 := by + simp_rw [hgrad, add_mul] + rw [Finset.sum_add_distrib] + congr 1 + simp [div_eq_mul_inv, mul_comm] + have hg0 : g 0 = ∑ i, (-(h.cut i.succ - h.cut i.castSucc) / 2 * + magneticFieldLevel (fieldStepOfStrictHeights h r hr) m i) * (q i - r i) := by + simp only [g, zero_smul, add_zero] + change (∑ i, F.P i (r, magneticHeightBias h m r) * d i) - + d (Fin.last h.depth) / 2 = ∑ i, G i * (q i - r i) + rw [hsum, add_sub_cancel_right] + rfl + have he0 : f 0 = constrainedFieldValue (fieldStepOfStrictHeights h r hr) m := by + simp only [f, zero_smul, add_zero, constrainedHeightFieldValue, dite_eq_left hr] + have he1 : f 1 = constrainedFieldValue (fieldStepOfStrictHeights h q hq) m := by + have he : r + (1 : ℝ) • d = q := by dsimp only [d]; module + simp only [f, he, constrainedHeightFieldValue, dite_eq_left hq] + rw [he0, he1, hg0] at hsup + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticImplicitBias.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticImplicitBias.lean new file mode 100644 index 0000000000000000000000000000000000000000..92d5c999b167f5d5a482df07040e30203733b291 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticImplicitBias.lean @@ -0,0 +1,92 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldInverse +import OAI.Probability.InvariantIsing.Fields.FieldRealVariance + +namespace OAI + +/-! Parametric inversion of a strictly increasing physical mean spin. +This supplies the finite-dimensional inverse-coordinate and envelope steps +without assuming differentiability of the minimizing bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped Topology + +namespace InvariantIsing + +lemma parametric_bias_continuousAt {A : ℝ × ℝ → ℝ} {b : ℝ → ℝ} {t s : ℝ} + (hc : ∀ z, ContinuousAt (fun q => A (q, z)) t) + (hm : ∀ᶠ q in 𝓝 t, StrictMono (fun z => A (q, z))) + (he : ∀ᶠ q in 𝓝 t, A (q, b q) = s) : ContinuousAt b t := by + have het := he.self_of_nhds + have hmt := hm.self_of_nhds + apply tendsto_order.2 + constructor + · intro l hl + have hlt : A (t, l) < s := by rw [← het]; exact hmt hl + have hn : ∀ᶠ q in 𝓝 t, A (q, l) < s := + (hc l).tendsto.eventually (Iio_mem_nhds hlt) + filter_upwards [hm, he, hn] with q hmq heq hq + apply hmq.lt_iff_lt.mp + rwa [heq] + · intro u hu + have htu : s < A (t, u) := by rw [← het]; exact hmt hu + have hn : ∀ᶠ q in 𝓝 t, s < A (q, u) := + (hc u).tendsto.eventually (Ioi_mem_nhds htu) + filter_upwards [hm, he, hn] with q hmq heq hq + apply hmq.lt_iff_lt.mp + rwa [heq] + +/-- The implicit bias derivative follows from the derivative of the actual +mean-spin map and the local root equation. -/ +lemma parametric_bias_hasDerivAt {A : ℝ × ℝ → ℝ} {b : ℝ → ℝ} {t s a c : ℝ} + (hb : ContinuousAt b t) (hc : c ≠ 0) + (hA : HasFDerivAt A (pairLinear a c) (t, b t)) + (he : ∀ᶠ q in 𝓝 t, A (q, b q) = s) : + HasDerivAt b (-a / c) t := by + let L : (ℝ × ℝ) →L[ℝ] (ℝ × ℝ) := + (ContinuousLinearMap.fst ℝ ℝ ℝ).prod (pairLinear a c) + let M : (ℝ × ℝ) →L[ℝ] (ℝ × ℝ) := + (ContinuousLinearMap.fst ℝ ℝ ℝ).prod (pairLinear (-a / c) (1 / c)) + have hleft : Function.LeftInverse M L := by + rintro ⟨x, y⟩ + apply Prod.ext + · rfl + · change -a / c * x + (1 / c) * (a * x + c * y) = y + field_simp [hc] + ring + have hf : HasFDerivAt (fun p : ℝ × ℝ => (p.1, A p)) L (t, b t) := + hasFDerivAt_fst.prodMk hA + have hg : ContinuousAt (fun q => (q, b q)) t := continuousAt_id.prodMk hb + have hh : HasFDerivAt (fun q : ℝ => (q, s)) + ((ContinuousLinearMap.id ℝ ℝ).prod (0 : ℝ →L[ℝ] ℝ)) t := + (hasFDerivAt_id t).prodMk (hasFDerivAt_const s t) + have hcomp : (fun p : ℝ × ℝ => (p.1, A p)) ∘ (fun q => (q, b q)) =ᶠ[𝓝 t] + (fun q => (q, s)) := by + filter_upwards [he] with q hq + exact congrArg (Prod.mk q) hq + have hd := HasFDerivAt.of_comp_of_leftInverse hg hf hh hcomp hleft + have hsnd := hd.snd.hasDerivAt + convert hsnd using 1 + simp [M, pairLinear] + +/-- Envelope differentiation with the bias response derived, rather than +postulated, from the physical mean-spin equation. -/ +lemma parametric_bias_envelope {U A : ℝ × ℝ → ℝ} {b : ℝ → ℝ} + {t s a c v : ℝ} (hb : ContinuousAt b t) (hc : c ≠ 0) + (hA : HasFDerivAt A (pairLinear a c) (t, b t)) + (he : ∀ᶠ q in 𝓝 t, A (q, b q) = s) + (hU : HasFDerivAt U (pairLinear v s) (t, b t)) : + HasDerivAt (fun q => U (q, b q) - b q * s) v t := by + have hdb := parametric_bias_hasDerivAt hb hc hA he + have hp := (hasDerivAt_id t).prodMk hdb + have hd := (hU.comp_hasDerivAt t hp).sub (hdb.mul_const s) + convert hd using 1 + · rfl + · simp only [pairLinear_apply] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..e24eae0feb3b6d91a50c80c0dde7634bbe1c0ba0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseComparison.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicNegative + +namespace OAI + +/-! Exponent comparison for the one-dimensional inverse-curvature equation. +The coefficient bound is required only where the proposed order fails. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem inverse_curvature_parabolic_comparison {T ζ η K : ℝ} + (hT : 0 ≤ T) (hη : 0 ≤ η) (hζη : ζ ≤ η) + (a aTime ax axx b bTime bx bxx : ℝ × ℝ → ℝ) + (ha : ContinuousOn a (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hb : ContinuousOn b (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hinit : ∀ s ∈ Icc (-1 : ℝ) 1, a (0, s) ≤ b (0, s)) + (hat : ∀ t ∈ Ioc (0 : ℝ) T, ∀ s ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun u => a (u, s)) (aTime (t, s)) (Iic t) t) + (hbt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ s ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun u => b (u, s)) (bTime (t, s)) (Iic t) t) + (hax : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => a (t, u)) (ax (t, s)) s) + (hbx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => b (t, u)) (bx (t, s)) s) + (haxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => ax (t, u)) (axx (t, s)) s) + (hbxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ s ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun u => bx (t, u)) (bxx (t, s)) s) + (ha0 : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ a p) + (hb0 : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ b p) + (ha1 : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, a p ≤ 1) + (hbound : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, |a p * axx p| ≤ K) + (hend : ∀ t ∈ Icc (0 : ℝ) T, a (t, -1) = 0 ∧ b (t, -1) = 0 ∧ + a (t, 1) = 0 ∧ b (t, 1) = 0) + (hpa : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + aTime p = a p ^ 2 / 2 * axx p + ζ * a p ^ 2) + (hpb : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + bTime p = b p ^ 2 / 2 * bxx p + η * b p ^ 2) : + ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, a p ≤ b p := by + have h := parabolic_minimum_nonneg_bounded_on_negative (M := K + 2 * η) hT + (fun p => b p - a p) (fun p => bTime p - aTime p) (fun p => bx p - ax p) + (fun p => bxx p - axx p) (fun p => b p ^ 2 / 2) (fun _ => 0) + (fun p => (b p + a p) * (axx p / 2 + η)) + (hb.sub ha) (fun s hs => sub_nonneg.mpr (hinit s hs)) + (fun t ht s hs => (hbt t ht s hs).sub (hat t ht s hs)) + (fun t ht s hs => (hbx t ht s hs).sub (hax t ht s hs)) + (fun t ht s hs => (hbxx t ht s hs).sub (haxx t ht s hs)) + (fun p hp => div_nonneg (sq_nonneg _) (by norm_num)) + (fun p hp hn => by + simpa only [mul_one] using inverse_curvature_difference_coefficient_bound + (ha0 p hp) (hb0 p hp) (by linarith) (ha1 p hp) hη (hbound p hp)) + (fun t ht => by + obtain ⟨haL, hbL, haR, hbR⟩ := hend t ht + simp only [hbL, hbR, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, + zero_div, and_self]) ?_ + · intro p hp + exact sub_nonneg.mp (h p hp) + · intro p hp + rw [hpb p hp, hpa p hp] + have hn := mul_nonneg (sub_nonneg.mpr hζη) (sq_nonneg (a p)) + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseCurvature.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseCurvature.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b2dab8ecc6837ae404f90ff0eb0e3ebcadbd66a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseCurvature.lean @@ -0,0 +1,141 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarFourth +import OAI.Probability.InvariantIsing.Magnetic.MagneticInverseVariation +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldInverse + +namespace OAI + +/-! First and second spatial derivatives of the actual curvature in +the physical mean-spin coordinate. The root exponent remains zero. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma magnetic_tanh_measurable : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + +private lemma magnetic_third_terminal_measurable : + Measurable (fun z : ℝ => -2 * Real.tanh z / (Real.cosh z) ^ 2) := by + have hm := magnetic_tanh_measurable + fun_prop + +private lemma magnetic_tail_third_regular (h : FieldStep) : + Measurable (fieldScalarThird (scalarFieldIncrements h) + (fun z => Real.log (Real.cosh z)) Real.tanh (fun z => 1 / (Real.cosh z) ^ 2) + (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2)) ∧ + ∀ z, |fieldScalarThird (scalarFieldIncrements h) + (fun z => Real.log (Real.cosh z)) Real.tanh (fun z => 1 / (Real.cosh z) ^ 2) + (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2) z| ≤ + fieldScalarThirdCap (scalarFieldIncrements h) 1 1 2 := + fieldScalarThird_regular _ (scalarFieldIncrements_positive h) measurable_logCosh + logCosh_linearGrowth magnetic_tanh_measurable (by fun_prop) magnetic_third_terminal_measurable + zero_le_one field_abs_tanh_le_one field_tanh_second_bound field_logCosh_third_bound + +private lemma magnetic_tail_fourth_regular (h : FieldStep) : + Measurable (fieldScalarFourth (scalarFieldIncrements h) + (fun z => Real.log (Real.cosh z)) Real.tanh (fun z => 1 / (Real.cosh z) ^ 2) + (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2) fieldLogCoshFourth) ∧ + ∃ B : ℝ, 0 ≤ B ∧ ∀ z, |fieldScalarFourth (scalarFieldIncrements h) + (fun z => Real.log (Real.cosh z)) Real.tanh (fun z => 1 / (Real.cosh z) ^ 2) + (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2) fieldLogCoshFourth z| ≤ B := by + have hf : Measurable fieldLogCoshFourth := by + have hm := magnetic_tanh_measurable + unfold fieldLogCoshFourth + fun_prop + exact fieldScalarFourth_regular _ (scalarFieldIncrements_positive h) measurable_logCosh + logCosh_linearGrowth magnetic_tanh_measurable (by fun_prop) magnetic_third_terminal_measurable hf + zero_le_one field_abs_tanh_le_one field_tanh_second_bound field_logCosh_third_bound + field_logCosh_fourth_bound + +def fieldBiasThird (h : FieldStep) : ℝ → ℝ := + fieldSpinTransition 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fieldScalarThird (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) + Real.tanh (fun z => 1 / (Real.cosh z) ^ 2) + (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2)) + +def fieldBiasFourth (h : FieldStep) : ℝ → ℝ := + fieldSpinTransition 0 (NNReal.mk (h.height 0) (h.nonneg 0)) + (fieldScalarValue (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z))) + (fieldScalarFourth (scalarFieldIncrements h) (fun z => Real.log (Real.cosh z)) + Real.tanh (fun z => 1 / (Real.cosh z) ^ 2) + (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2) fieldLogCoshFourth) + +lemma hasDerivAt_fieldBiasCurvature (h : FieldStep) (b : ℝ) : + HasDerivAt (fieldBiasCurvature h) (fieldBiasThird h b) b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular _ hL measurable_logCosh logCosh_linearGrowth + have hm := fieldScalarMean_regular _ hL measurable_logCosh logCosh_linearGrowth + magnetic_tanh_measurable field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular _ hL + have hr := magnetic_tail_third_regular h + have hC : 0 ≤ fieldScalarSecondCap (scalarFieldIncrements h) 1 1 := + (abs_nonneg _).trans (hq.2 0) + have hd := hasDerivAt_fieldSpinTransition 0 + (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 hv.2 hm.1 hq.1 hr.1 + zero_le_one hC hm.2 hq.2 hr.2 + (hasDerivAt_fieldScalarLogCosh _ hL) (hasDerivAt_fieldScalarLogCoshSecond _ hL) b + simpa only [zero_mul, add_zero, fieldBiasCurvature, fieldBiasThird] using hd + +lemma hasDerivAt_fieldBiasThird (h : FieldStep) (b : ℝ) : + HasDerivAt (fieldBiasThird h) (fieldBiasFourth h b) b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular _ hL measurable_logCosh logCosh_linearGrowth + have hm := fieldScalarMean_regular _ hL measurable_logCosh logCosh_linearGrowth + magnetic_tanh_measurable field_abs_tanh_le_one + have hr := magnetic_tail_third_regular h + obtain ⟨hs, B, hB, bs⟩ := magnetic_tail_fourth_regular h + have hC : 0 ≤ fieldScalarThirdCap (scalarFieldIncrements h) 1 1 2 := + (abs_nonneg _).trans (hr.2 0) + have hd := hasDerivAt_fieldSpinTransition 0 + (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 hv.2 hm.1 hr.1 hs + zero_le_one hC hm.2 hr.2 bs + (hasDerivAt_fieldScalarLogCosh _ hL) (hasDerivAt_fieldScalarLogCoshThird _ hL) b + simpa only [zero_mul, add_zero, fieldBiasThird, fieldBiasFourth] using hd + +def magneticCurvature (h : FieldStep) (s : ℝ) : ℝ := + fieldBiasCurvature h (magneticBias h s) + +def magneticCurvatureSlope (h : FieldStep) (s : ℝ) : ℝ := + fieldBiasThird h (magneticBias h s) / magneticCurvature h s + +def magneticCurvatureSecond (h : FieldStep) (s : ℝ) : ℝ := + fieldBiasFourth h (magneticBias h s) / (magneticCurvature h s) ^ 2 - + (fieldBiasThird h (magneticBias h s)) ^ 2 / (magneticCurvature h s) ^ 3 + +lemma magneticCurvature_pos (h : FieldStep) (s : ℝ) : 0 < magneticCurvature h s := + fieldBiasCurvature_pos h _ + +lemma hasDerivAt_magneticCurvature (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + HasDerivAt (magneticCurvature h) (magneticCurvatureSlope h s) s := by + have hb : HasDerivAt (magneticBias h) (1 / magneticCurvature h s) s := by + simpa only [magneticCurvature, one_div] using hasDerivAt_magneticBias h hs + have hd := inverse_mean_pullback_derivative hb + (hasDerivAt_fieldBiasCurvature h (magneticBias h s)) + exact hd + +lemma hasDerivAt_magneticCurvatureSlope (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + HasDerivAt (magneticCurvatureSlope h) (magneticCurvatureSecond h s) s := by + have hb : HasDerivAt (magneticBias h) (1 / magneticCurvature h s) s := by + simpa only [magneticCurvature, one_div] using hasDerivAt_magneticBias h hs + have hd := inverse_mean_pullback_quotient (magneticCurvature_pos h s).ne' hb rfl rfl + (hasDerivAt_fieldBiasThird h (magneticBias h s)) + (hasDerivAt_fieldBiasCurvature h (magneticBias h s)) + unfold magneticCurvatureSlope magneticCurvatureSecond magneticCurvature + simpa only [pow_two, magneticCurvature] using hd + +lemma hasDerivAt_deriv_magneticCurvature (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + HasDerivAt (deriv (magneticCurvature h)) (magneticCurvatureSecond h s) s := by + apply (hasDerivAt_magneticCurvatureSlope h hs).congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2] with t ht + exact (hasDerivAt_magneticCurvature h (abs_lt.mpr ht)).deriv + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseGenerator.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseGenerator.lean new file mode 100644 index 0000000000000000000000000000000000000000..444127fbf2944e6d640914a222245869b35e823b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseGenerator.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticInverseVariation + +namespace OAI + +/-! The inverse-mean generator identities. The hypotheses are the +ordinary backward Gaussian derivative identities, and the inverse-coordinate +form follows from the proved implicit-bias variation rule. -/ + +noncomputable section +open IsingPerceptron Filter +open scoped Topology + +namespace InvariantIsing + +lemma inverse_curvature_generator {U Q : ℝ × ℝ → ℝ} {b : ℝ → ℝ} + {t s m q r w ζ : ℝ} (hq : q ≠ 0) (hb : ContinuousAt b t) + (hU : HasFDerivAt U (pairLinear (-r / 2 - ζ * m * q) q) (t, b t)) + (he : ∀ᶠ v in 𝓝 t, U (v, b v) = s) + (hQ : HasFDerivAt Q (pairLinear (-w / 2 - ζ * (q ^ 2 + m * r)) r) (t, b t)) : + HasDerivAt (fun v => Q (v, b v)) + (-(q ^ 2 / 2) * (w / q ^ 2 - r ^ 2 / q ^ 3) - ζ * q ^ 2) t := by + have hd := inverse_mean_curvature_variation hb hq hU he hQ + convert hd using 1 + field_simp [hq] + ring + +lemma inverse_continuation_generator {U V : ℝ × ℝ → ℝ} {b : ℝ → ℝ} + {t s m q r a d ζ : ℝ} (hq : q ≠ 0) (hb : ContinuousAt b t) + (hU : HasFDerivAt U (pairLinear (-r / 2 - ζ * m * q) q) (t, b t)) + (he : ∀ᶠ v in 𝓝 t, U (v, b v) = s) + (hV : HasFDerivAt V (pairLinear (-d / 2 - ζ * m * a) a) (t, b t)) : + HasDerivAt (fun v => V (v, b v)) + (-(q ^ 2 / 2) * (d / q ^ 2 - a * r / q ^ 3)) t := by + have hd := inverse_mean_curvature_variation hb hq hU he hV + convert hd using 1 + field_simp [hq] + ring + +/-- The zeroth-order coefficient of the twice differentiated inverse +continuation equation only needs the ratio of fourth and second ordinary +derivatives: the apparent square of the third derivative cancels. -/ +lemma inverse_diffusion_second {q r w : ℝ} (hq : q ≠ 0) : + 2 * (r / q) ^ 2 + 2 * q * (w / q ^ 2 - r ^ 2 / q ^ 3) = 2 * w / q := by + field_simp [hq] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseVariation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseVariation.lean new file mode 100644 index 0000000000000000000000000000000000000000..850df73a2ac732f1a24408a50404222b35df3a2a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInverseVariation.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticImplicitBias + +namespace OAI + +/-! Local inverse-mean-coordinate calculus used by the prescribed-spin +field comparison. These identities derive the change of curvature and +the second derivative of a pulled-back field variation. -/ + +noncomputable section +open Filter IsingPerceptron +open scoped Topology + +namespace InvariantIsing + +lemma inverse_mean_curvature_variation {A C : ℝ × ℝ → ℝ} + {b : ℝ → ℝ} {t s a c v d : ℝ} + (hb : ContinuousAt b t) (hc : c ≠ 0) + (hA : HasFDerivAt A (pairLinear a c) (t, b t)) + (he : ∀ᶠ q in 𝓝 t, A (q, b q) = s) + (hC : HasFDerivAt C (pairLinear v d) (t, b t)) : + HasDerivAt (fun q => C (q, b q)) (v - d * a / c) t := by + have hdb := parametric_bias_hasDerivAt hb hc hA he + have hd := hC.comp_hasDerivAt t ((hasDerivAt_id t).prodMk hdb) + convert hd using 1 + all_goals first | rfl | (simp only [pairLinear_apply]; ring) + +lemma inverse_mean_pullback_derivative {V Z : ℝ → ℝ} {u c v : ℝ} + (hZ : HasDerivAt Z (1 / c) u) (hV : HasDerivAt V v (Z u)) : + HasDerivAt (fun q => V (Z q)) (v / c) u := by + convert hV.comp u hZ using 1 + all_goals first | rfl | simp [div_eq_mul_inv] + +/-- The spatial derivative of the first inverse-coordinate derivative. +This is the local formula behind `delta a = a^2 delta F_uu`. -/ +lemma inverse_mean_pullback_quotient {Z V₁ C : ℝ → ℝ} {u c v v₂ d : ℝ} + (hc : c ≠ 0) (hZ : HasDerivAt Z (1 / c) u) + (hv : V₁ (Z u) = v) (hcv : C (Z u) = c) + (hV : HasDerivAt V₁ v₂ (Z u)) (hC : HasDerivAt C d (Z u)) : + HasDerivAt (fun q => V₁ (Z q) / C (Z q)) + (v₂ / c ^ 2 - v * d / c ^ 3) u := by + have hn := inverse_mean_pullback_derivative hZ hV + have hd := inverse_mean_pullback_derivative hZ hC + have hq := hn.div hd (by rwa [hcv]) + convert hq using 1 + rw [hv, hcv] + field_simp [hc] + +lemma inverse_mean_pullback_second {Z V V₁ C : ℝ → ℝ} {u c v v₂ d : ℝ} + (hc : c ≠ 0) (hZ : HasDerivAt Z (1 / c) u) + (hv : V₁ (Z u) = v) (hcv : C (Z u) = c) + (hV : HasDerivAt V₁ v₂ (Z u)) (hC : HasDerivAt C d (Z u)) + (hZloc : ∀ᶠ q in 𝓝 u, HasDerivAt Z (1 / C (Z q)) q) + (hVloc : ∀ᶠ q in 𝓝 u, HasDerivAt V (V₁ (Z q)) (Z q)) : + HasDerivAt (deriv (fun q => V (Z q))) + (v₂ / c ^ 2 - v * d / c ^ 3) u := by + apply (inverse_mean_pullback_quotient hc hZ hv hcv hV hC).congr_of_eventuallyEq + filter_upwards [hZloc, hVloc] with q hZq hVq + exact (inverse_mean_pullback_derivative hZq hVq).deriv + +lemma inverse_mean_variation_identity {c v v₂ d : ℝ} (hc : c ≠ 0) : + c ^ 2 * (v₂ / c ^ 2 - v * d / c ^ 3) = v₂ - d * v / c := by + field_simp [hc] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInwardApproximation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInwardApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c059ab12d3223c7516b528600009a452287f720 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticInwardApproximation.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalBounds +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldSymmetry + +namespace OAI + +/-! Rational approximation toward zero improves the constrained entropy. +This avoids a height-dependent continuity estimate for the magnetic profile. -/ +noncomputable section +open Set +open scoped BigOperators +namespace InvariantIsing + +lemma constrainedFieldValue_antitone_nonneg (h : FieldStep) {s t : ℝ} + (hs : 0 ≤ s) (hst : s ≤ t) (ht : t < 1) : + constrainedFieldValue h t ≤ constrainedFieldValue h s := by + have hs' : |s| < 1 := by rw [abs_of_nonneg hs]; exact hst.trans_lt ht + have ht' : |t| ≤ 1 := by rw [abs_of_nonneg (hs.trans hst)]; exact ht.le + have hb : 0 ≤ magneticBias h s := by + apply (strictMono_fieldBiasMean h).le_iff_le.mp + rw [fieldBiasMean_zero,fieldBiasMean_magneticBias h hs'] + exact hs + have hh := constrainedFieldValue_bias_support h ht' (magneticBias_minimizes h hs') + have hprod : 0 ≤ magneticBias h s*(t-s) := mul_nonneg hb (sub_nonneg.mpr hst) + linarith + +lemma constrainedFieldValue_abs (h : FieldStep) {s : ℝ} (hs : |s| < 1) : + constrainedFieldValue h |s|=constrainedFieldValue h s := by + rcases le_total 0 s with hp|hn + · rw [abs_of_nonneg hp] + · rw [abs_of_nonpos hn,constrainedFieldValue_even h hs] + +lemma constrainedFieldValue_le_of_abs_le (h : FieldStep) {s t : ℝ} + (ht : |t| < 1) (hst : |s| ≤ |t|) : + constrainedFieldValue h t ≤ constrainedFieldValue h s := by + rw [← constrainedFieldValue_abs h ht,← constrainedFieldValue_abs h (hst.trans_lt ht)] + exact constrainedFieldValue_antitone_nonneg h (abs_nonneg _) hst ht + +lemma exists_inward_rat_close {x δ : ℝ} (hx : |x| < 1) (hδ : 0 < δ) : + ∃ q : ℚ, |(q:ℝ)| ≤ |x| ∧ |(q:ℝ)| < 1 ∧ |x-(q:ℝ)| < δ := by + by_cases hz : x=0 + · subst x + exact ⟨0,by simp,by norm_num,by simpa using hδ⟩ + have hp : 0 < |x| := abs_pos.mpr hz + have hi : max 0 (|x|-δ) < |x| := max_lt hp (by linarith) + obtain ⟨q,hq,hqx⟩ := exists_rat_btwn hi + have hq0 : 0 < (q:ℝ) := (le_max_left _ _).trans_lt hq + have hqd : |x|-(q:ℝ)<δ := by have := (le_max_right _ _).trans_lt hq; linarith + by_cases hxp : 0 ≤ x + · refine ⟨q,?_,?_,?_⟩ + · rw [abs_of_pos hq0] + exact hqx.le + · rw [abs_of_pos hq0]; exact hqx.trans hx + · rw [abs_of_nonneg (by rw [abs_of_nonneg hxp] at hqx; linarith)] + rwa [abs_of_nonneg hxp] at hqd + · refine ⟨-q,?_,?_,?_⟩ + · simpa only [Rat.cast_neg,abs_neg,abs_of_pos hq0] using hqx.le + · simpa only [Rat.cast_neg,abs_neg,abs_of_pos hq0] using hqx.trans hx + · rw [Rat.cast_neg,abs_of_nonpos (by rw [abs_of_neg (lt_of_not_ge hxp)] at hqx; linarith)] + rw [abs_of_neg (lt_of_not_ge hxp)] at hqd + linarith + +lemma magneticVariational_inward_mono {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ s t : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) + (ht : ∀ a, |t a| < 1) (hst : ∀ a, |s a| ≤ |t a|) : + magneticVariationalFunctional R γ t ≤ magneticVariationalFunctional R γ s := by + apply iInf_mono + intro p + apply add_le_add _ le_rfl + apply iSup_mono + intro h + apply EReal.coe_le_coe + apply add_le_add _ le_rfl + exact Finset.sum_le_sum (fun a _ => mul_le_mul_of_nonneg_left + (constrainedFieldValue_le_of_abs_le h (ht a) (hst a)) (hγ a)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticJetProduct.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticJetProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..615f360512d89e3799a6d594e6b8756abf6fc923 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticJetProduct.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationJet + +namespace OAI + +/-! The finite third-order product needed for the fourth derivative of the +actual scalar Gaussian transition. -/ + +noncomputable section +open MeasureTheory + +namespace InvariantIsing +lemma MagneticContinuationJet.eq_of_value_eq (A B : MagneticContinuationJet) + (h : A.value = B.value) : A = B := by + have h1 : A.first = B.first := by + funext z + exact (A.dValue z).unique (h ▸ B.dValue z) + have h2 : A.second = B.second := by + funext z + exact (A.dFirst z).unique (h1 ▸ B.dFirst z) + have h3 : A.third = B.third := by + funext z + exact (A.dSecond z).unique (h2 ▸ B.dSecond z) + cases A + cases B + cases h + cases h1 + cases h2 + cases h3 + rfl + +namespace MagneticContinuationJet + +def mul (A B : MagneticContinuationJet) : MagneticContinuationJet where + value := fun z => A.value z * B.value z + first := fun z => A.first z * B.value z + A.value z * B.first z + second := fun z => A.second z * B.value z + 2 * A.first z * B.first z + A.value z * B.second z + third := fun z => A.third z * B.value z + 3 * A.second z * B.first z + + 3 * A.first z * B.second z + A.value z * B.third z + mValue := A.mValue.mul B.mValue + mFirst := (A.mFirst.mul B.mValue).add (A.mValue.mul B.mFirst) + mSecond := ((A.mSecond.mul B.mValue).add ((measurable_const.mul A.mFirst).mul B.mFirst)).add + (A.mValue.mul B.mSecond) + mThird := (((A.mThird.mul B.mValue).add ((measurable_const.mul A.mSecond).mul B.mFirst)).add + ((measurable_const.mul A.mFirst).mul B.mSecond)).add (A.mValue.mul B.mThird) + bValue := A.bValue.mul B.bValue + bFirst := (A.bFirst.mul B.bValue).add (A.bValue.mul B.bFirst) + bSecond := ((A.bSecond.mul B.bValue).add + (((MagneticContinuationBound.const 2).mul A.bFirst).mul B.bFirst)).add (A.bValue.mul B.bSecond) + bThird := (((A.bThird.mul B.bValue).add + (((MagneticContinuationBound.const 3).mul A.bSecond).mul B.bFirst)).add + (((MagneticContinuationBound.const 3).mul A.bFirst).mul B.bSecond)).add (A.bValue.mul B.bThird) + dValue := fun z => (A.dValue z).mul (B.dValue z) + dFirst := fun z => by + convert ((A.dFirst z).mul (B.dValue z)).add ((A.dValue z).mul (B.dFirst z)) using 1 + ring + dSecond := fun z => by + convert (((A.dSecond z).mul (B.dValue z)).add + (((A.dFirst z).const_mul 2).mul (B.dFirst z))).add + ((A.dValue z).mul (B.dSecond z)) using 1 + ring + +end MagneticContinuationJet +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticL1.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticL1.lean new file mode 100644 index 0000000000000000000000000000000000000000..989fe5397c972482bee5dc4c62cdb4acd927a50c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticL1.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticClosedLipschitz +import OAI.Probability.InvariantIsing.Magnetic.MagneticRefinement +import OAI.Probability.InvariantIsing.Fields.FieldPartitionSupport + +namespace OAI + +/-! The constrained field functional is one-half Lipschitz in the L1 +distance between arbitrary bounded monotone field paths. -/ + +noncomputable section +open MeasureTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma field_height_difference_integral (h : FieldStep) + (r : Fin (h.depth + 1) → ℝ) (hr0 : ∀ i, 0 ≤ r i) (hrmono : Monotone r) : + (∫ t, |fieldFunction (fieldWithHeights h r hr0 hrmono) t - fieldFunction h t| ∂pathMeasure) = + ∑ i, (h.cut i.succ - h.cut i.castSucc) * |r i - h.height i| := by + calc + _ = ∫ t, finiteStepFunction h.cut (fun i => |r i - h.height i|) t ∂pathMeasure := by + apply integral_congr_ae + filter_upwards [ae_finite_overlap_cell h.cut h.first h.last] with t ht + obtain ⟨i, hi⟩ := ht + change |finiteStepFunction h.cut r t - finiteStepFunction h.cut h.height t| = _ + rw [finiteStepFunction_on_cell h.ordered_cut _ hi, + finiteStepFunction_on_cell h.ordered_cut _ hi, + finiteStepFunction_on_cell h.ordered_cut _ hi] + _ = _ := integral_finiteStepFunction h.cut h.ordered_cut h.first h.last _ + +lemma constrainedFieldValue_lipschitz_equal_cutList {h k : FieldStep} {s : ℝ} (hs : |s| < 1) + (he : List.ofFn h.cut = List.ofFn k.cut) : + |constrainedFieldValue k s - constrainedFieldValue h s| ≤ + (1 / 2 : ℝ) * ∫ t, |fieldFunction k t - fieldFunction h t| ∂pathMeasure := by + obtain ⟨r, hr0, hrmono, rfl⟩ := field_eq_withHeights_of_cutList he + rw [field_height_difference_integral] + exact constrainedFieldValue_height_lipschitz h hs r hr0 hrmono + +theorem abs_constrainedFieldValue_sub_le_L1 (h k : FieldStep) {s : ℝ} (hs : |s| < 1) : + |constrainedFieldValue k s - constrainedFieldValue h s| ≤ + (1 / 2 : ℝ) * ∫ t, |fieldFunction k t - fieldFunction h t| ∂pathMeasure := by + obtain ⟨h', k', hh', hk', hcuts⟩ := field_common_refinement h k + have hi := constrainedFieldValue_lipschitz_equal_cutList hs hcuts + rw [hh'.constrainedValue, hk'.constrainedValue] at hi + have he : (∫ t, |fieldFunction k' t - fieldFunction h' t| ∂pathMeasure) = + ∫ t, |fieldFunction k t - fieldFunction h t| ∂pathMeasure := by + apply integral_congr_ae + filter_upwards [hh'.field_ae, hk'.field_ae] with t hh hk + rw [hh, hk] + rwa [he] at hi + +lemma constrainedFieldValue_eq_of_ae (h k : FieldStep) {s : ℝ} (hs : |s| < 1) + (he : fieldFunction h =ᵐ[pathMeasure] fieldFunction k) : + constrainedFieldValue h s = constrainedFieldValue k s := by + have hb := abs_constrainedFieldValue_sub_le_L1 h k hs + have hz : (∫ t, |fieldFunction k t - fieldFunction h t| ∂pathMeasure) = 0 := by + calc + _ = ∫ _t : ℝ, (0 : ℝ) ∂pathMeasure := by + apply integral_congr_ae + filter_upwards [he] with t ht + rw [ht, sub_self, abs_zero] + _ = 0 := integral_zero _ _ + rw [hz, mul_zero] at hb + exact (sub_eq_zero.mp (abs_eq_zero.mp (le_antisymm hb (abs_nonneg _)))).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLevelDerivative.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLevelDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..75ee71633b9e56e76a7f42540d573e6c98bac817 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLevelDerivative.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldGradient +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldHeightHessian + +namespace OAI + +/-! Differentiability of the physical conditional square levels at fixed +magnetization, including the change in the optimizing bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter Classical +open scoped Topology BigOperators + +namespace InvariantIsing + +def magneticHeightLevel (h : FieldStep) (s : ℝ) + (r : Fin (h.depth + 1) → ℝ) (i : Fin (h.depth + 1)) : ℝ := + if hr : r ∈ fieldStrictHeightCone h.depth then + magneticFieldLevel (fieldStepOfStrictHeights h r hr) s i else 0 + +def magneticHeightSchur (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (s : ℝ) (r : Fin (h.depth + 1) → ℝ) (i j : Fin (h.depth + 1)) : ℝ := + F.PP i j (r, magneticHeightBias h s r) - + F.PX i (r, magneticHeightBias h s r) * F.PX j (r, magneticHeightBias h s r) / + F.XX (r, magneticHeightBias h s r) + +lemma magneticHeightSchur_symmetric (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (s : ℝ) (r : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (i j : Fin (h.depth + 1)) : + magneticHeightSchur h F s r i j = magneticHeightSchur h F s r j i := by + unfold magneticHeightSchur + rw [F.symmetric i j (r, magneticHeightBias h s r) hr, mul_comm (F.PX i _)] + +lemma hasDerivAt_magneticHeightP_line (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) (i : Fin (h.depth + 1)) : + HasDerivAt (fun t : ℝ => F.P i (r + t • d, magneticHeightBias h s (r + t • d))) + (∑ j, magneticHeightSchur h F s r i j * d j) 0 := by + have hb := hasDerivAt_magneticHeightBias_line h F hI hU hs r d hr hrs + have hp := ((hasDerivAt_const (0 : ℝ) r).add + ((hasDerivAt_id (0 : ℝ)).smul_const d)).prodMk hb + have hF := F.derivativeP i (r + (0 : ℝ) • d, magneticHeightBias h s (r + (0 : ℝ) • d)) + (by simpa only [zero_smul, add_zero] using hr) + have hd := hF.comp_hasDerivAt 0 hp + convert hd using 1 + · rfl + · simp only [fieldFiniteLinear_apply, zero_add, one_smul, + zero_smul, add_zero, magneticHeightSchur, sub_mul, Finset.sum_sub_distrib] + rw [show (∑ j, F.PX i (r, magneticHeightBias h s r) * + F.PX j (r, magneticHeightBias h s r) / F.XX (r, magneticHeightBias h s r) * d j) = + F.PX i (r, magneticHeightBias h s r) * + (∑ j, F.PX j (r, magneticHeightBias h s r) * d j) / + F.XX (r, magneticHeightBias h s r) by + simp only [Finset.mul_sum, Finset.sum_div] + apply Finset.sum_congr rfl + intro j _ + ring] + ring + +lemma hasDerivAt_magneticHeightLevel_line (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r d : Fin (h.depth + 1) → ℝ) (hr : r ∈ I) + (hrs : r ∈ fieldStrictHeightCone h.depth) (i : Fin (h.depth + 1)) : + HasDerivAt (fun t : ℝ => magneticHeightLevel h s (r + t • d) i) + ((-2 / (h.cut i.succ - h.cut i.castSucc)) * + (∑ j, magneticHeightSchur h F s r i j * d j)) 0 := by + let w := h.cut i.succ - h.cut i.castSucc + have hw : w ≠ 0 := (sub_pos.mpr (h.ordered_cut i.castSucc_lt_succ)).ne' + have hd := ((hasDerivAt_magneticHeightP_line h F hI hU hs r d hr hrs i).sub_const + (if i = Fin.last h.depth then (1 / 2 : ℝ) else 0)).const_mul (-2 / w) + have hn : ∀ᶠ t : ℝ in 𝓝 0, r + t • d ∈ I ∩ fieldStrictHeightCone h.depth := by + have hp : ContinuousAt (fun t : ℝ => r + t • d) 0 := by fun_prop + exact hp.eventually ((hI.inter (isOpen_fieldStrictHeightCone _)).mem_nhds + (by simpa only [zero_smul, add_zero, Set.mem_inter_iff] using And.intro hr hrs)) + apply hd.congr_of_eventuallyEq + filter_upwards [hn] with t ht + rw [magneticHeightLevel, dite_eq_left ht.2] + have he := magneticHeight_optimized_gradient h F hU hs (r + t • d) ht.1 ht.2 i + rw [he] + dsimp only [w] at hw ⊢ + field_simp [hw] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLevelModulus.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLevelModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..496946079c0d9d4f090c8182410a678dea5c0b9a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLevelModulus.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Fields.FieldMagnetizationModulus +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldLevels + +namespace OAI + +/-! The overlap modulus is uniform in the root bias, including the +optimizing bias for a prescribed magnetization. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal +namespace InvariantIsing + +lemma magneticLevelAtBias_increment_le (h : FieldStep) (b : ℝ) {V : ℝ} + (hV : h.height (Fin.last h.depth) ≤ V) (i : Fin h.depth) : + magneticLevelAtBias h b i.succ - magneticLevelAtBias h b i.castSucc ≤ + (h.height i.succ - h.height i.castSucc) * fieldGaussianMomentCap (Real.sqrt V) := by + let L := scalarFieldIncrements h + let j : Fin L.length := Fin.cast (scalarFieldIncrements_length h).symm i + have hL := scalarFieldIncrements_positive h + have hζ : ∀ av ∈ L, av.1 ≤ 1 := by + intro av hav + obtain ⟨k, rfl⟩ := List.mem_ofFn.mp hav + change h.cut k.succ.castSucc ≤ 1 + rw [← h.last] + exact h.ordered_cut.monotone (Fin.le_last _) + have hvar : ∀ av ∈ L, (av.2 : ℝ) ≤ V := by + intro av hav + obtain ⟨k, rfl⟩ := List.mem_ofFn.mp hav + exact (fieldIncrement_le_last h k.succ).trans hV + have hget : ((L.get j).2 : ℝ) = h.height i.succ - h.height i.castSucc := by + have hg : L.get j = ((fieldIncrement h i.succ).1, + NNReal.mk (fieldIncrement h i.succ).2 (fieldIncrement_nonneg h i.succ)) := by + exact List.get_ofFn (fun k : Fin h.depth => ((fieldIncrement h k.succ).1, + NNReal.mk (fieldIncrement h k.succ).2 (fieldIncrement_nonneg h k.succ))) j + rw [hg] + change (fieldIncrement h i.succ).2 = _ + simp only [fieldIncrement, Fin.val_succ, Nat.succ_ne_zero, dite_false, Nat.add_sub_cancel] + rfl + have hval := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hreg := fieldScalarSquares_regular L hL measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hbnd (i : Fin (L.length+1)) (z : ℝ) : + |fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh i z| ≤ 1 := by + rw [abs_of_nonneg ((hreg i).2 z).1] + exact ((hreg i).2 z).2 + change fieldSpinTransition 0 _ _ + (fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh j.succ) b - + fieldSpinTransition 0 _ _ + (fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh j.castSucc) b ≤ _ + rw [← fieldSpinTransition_sub 0 _ hval.1 hval.2 + (hreg j.succ).1 (hreg j.castSucc).1 (hbnd j.succ) (hbnd j.castSucc)] + calc + _ ≤ fieldSpinTransition 0 _ (fieldScalarValue L (fun z => Real.log (Real.cosh z))) + (fun _ => ((L.get j).2 : ℝ) * fieldGaussianMomentCap (Real.sqrt V)) b := + fieldSpinTransition_mono_test 0 _ _ + ((hreg j.succ).1.sub (hreg j.castSucc).1) measurable_const + (fun z => (abs_sub _ _).trans (add_le_add (hbnd j.succ z) (hbnd j.castSucc z))) + (fun _ => le_rfl) (fieldScalarSquares_increment_le L hL hζ hvar j) b + _ = _ := by rw [fieldSpinTransition_const 0 _ hval.1 hval.2, hget] + +theorem magneticLevelAtBias_sub_le (h : FieldStep) (b : ℝ) {V : ℝ} + (hV : h.height (Fin.last h.depth) ≤ V) + (i j : Fin (h.depth + 1)) (hij : i ≤ j) : + magneticLevelAtBias h b j - magneticLevelAtBias h b i ≤ + (h.height j - h.height i) * fieldGaussianMomentCap (Real.sqrt V) := by + have hm : Monotone (fun i => h.height i * fieldGaussianMomentCap (Real.sqrt V) - + magneticLevelAtBias h b i) := by + apply Fin.monotone_iff_le_succ.mpr + intro k + have hk := magneticLevelAtBias_increment_le h b hV k + nlinarith + have hh := hm hij + nlinarith + +theorem magneticLevelAtBias_abs_sub_le (h : FieldStep) (b : ℝ) {V : ℝ} + (hV : h.height (Fin.last h.depth) ≤ V) (i j : Fin (h.depth + 1)) : + |magneticLevelAtBias h b i - magneticLevelAtBias h b j| ≤ + |h.height i - h.height j| * fieldGaussianMomentCap (Real.sqrt V) := by + rcases le_total i j with hij | hji + · rw [abs_of_nonpos (sub_nonpos.mpr (magneticLevelAtBias_monotone h b hij)), neg_sub, + abs_of_nonpos (sub_nonpos.mpr (h.ordered_height hij)), neg_sub] + exact magneticLevelAtBias_sub_le h b hV i j hij + · rw [abs_of_nonneg (sub_nonneg.mpr (magneticLevelAtBias_monotone h b hji)), + abs_of_nonneg (sub_nonneg.mpr (h.ordered_height hji))] + exact magneticLevelAtBias_sub_le h b hV j i hji + + +lemma magneticFieldLevel_abs_sub_le (h : FieldStep) {V : ℝ} + (hV : h.height (Fin.last h.depth) ≤ V) (s : ℝ) (i j : Fin (h.depth+1)) : + |magneticFieldLevel h s i - magneticFieldLevel h s j| ≤ + |h.height i-h.height j| * fieldGaussianMomentCap (Real.sqrt V) := + magneticLevelAtBias_abs_sub_le h (magneticBias h s) hV i j + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLimitingPressure.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLimitingPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f1ce88d105b0420a142750f5849034000b14439 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticLimitingPressure.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticPhysicalMean +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureConcentration + +namespace OAI + +/-! The finite-alphabet part of manuscript Theorem7.1, with arbitrary +compact spectrum, expectation convergence and almost-sure convergence. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem limiting_finite_field_pressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun i => c (group N i)) ∂P) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun i => c (group N i))) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) := by + refine ⟨physical_mean_field_pressure_tendsto hhaar hgauss hpub P U hU hHaar eig ν a b + hcompact hbound ha hb hno hweak group γ c hγ hγsum hgroup,?_⟩ + have hab : a ≤ b := (hbound ha).2 + let clip := fun N (i : Fin N) => spectralClip a b (eig N i) + have hcmean := physical_mean_field_pressure_tendsto hhaar hgauss hpub P U hU hHaar clip ν a b + hcompact hbound ha hb (fun ε hε => Eventually.of_forall (fun N i => by + have hh := spectralClip_mem hab (eig N i) + constructor <;> linarith [hh.1,hh.2])) + (spectral_clip_empirical_tendsto eig ν a b hbound hweak) group γ c hγ hγsum hgroup + let K := |a|+|b|+1 + have hK : 0 < K := by dsimp [K]; positivity + have hclip N i : |clip N i| ≤ K := by + have hh := spectralClip_mem hab (eig N i) + rw [abs_le] + dsimp [K] + constructor <;> linarith [hh.1,hh.2,neg_abs_le a,le_abs_self b,abs_nonneg a,abs_nonneg b] + have hconc := ae_physical_pressure_sub_mean_tendsto_zero hhaar P + (fun n => U (n+3)) (fun n => hU (n+3)) (fun n => hHaar (n+3)) + (fun n => clip (n+3)) (fun n i => c (group (n+3) i)) K hK (fun n => hclip (n+3)) + have hη := (spectralExcess_tendsto eig a b hno).comp (tendsto_add_atTop_nat 3) + filter_upwards [hconc] with ω hω + have hclim := hω.add (hcmean.comp (tendsto_add_atTop_nat 3)) + have hd : Tendsto (fun n => rotatedPressure (eig (n+3)) (matrixRotation (U (n+3) ω)⁻¹) + (fun i => c (group (n+3) i))- + rotatedPressure (clip (n+3)) (matrixRotation (U (n+3) ω)⁻¹) (fun i => c (group (n+3) i))) + atTop (𝓝 0) := by + apply squeeze_zero_norm _ (by simpa only [zero_div] using hη.div_const 2) + intro n + rw [Real.norm_eq_abs,abs_sub_comm] + exact abs_rotatedPressure_sub_le (by omega) (clip (n+3)) (eig (n+3)) + (matrixRotation (U (n+3) ω)⁻¹) (fun i => c (group (n+3) i)) + (spectralExcess (eig (n+3)) a b) + (fun i => spectralClip_close hab (spectralExcess_nonneg _ _ _) (spectralExcess_bounds _ _ _ i)) + apply (tendsto_add_atTop_iff_nat 3).mp + have hh := hclim.add hd + convert hh using 1 + · funext n + dsimp only [Function.comp_apply] + ring + · simp only [zero_add,add_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMainPressure.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMainPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..5eb9d43c57ea74e4715f09a0fc9252a987d94976 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMainPressure.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticLimitingPressure +import OAI.Probability.InvariantIsing.Spectral.SpectralExtremeLimits + +namespace OAI + +/-! The finite-field clause of Theorem7.1 with the exact manuscript +spectral-edge assumptions, in expectation and almost surely. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem limiting_finite_field_pressure_of_extreme_limits + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun i => c (group N i)) ∂P) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun i => c (group N i))) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) := + limiting_finite_field_pressure hhaar hgauss hpub P U hU hHaar eig ν a b hcompact hbound ha hb + (spectral_no_outliers_of_extreme_limits eig a b hmin hmax) hweak group γ c hγ hγsum hgroup + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMeanShift.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMeanShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3dd8bab5e0a693ce3fb3eb9fd4aad962515f972 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMeanShift.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFamilyDerivative + +namespace OAI + +/-! A uniform mean-shift estimate from the Ising variance bound. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma magnetic_mean_shift_deficit {M Q : ℝ → ℝ} + (hd : ∀ z, HasDerivAt M (Q z) z) + (hM : ∀ z, |M z| ≤ 1) (hQ : ∀ z, 0 ≤ Q z) + (hb : ∀ z, Q z ≤ 1 - (M z) ^ 2) (x h : ℝ) : + 1 - M (x + h) ≤ Real.exp (2 * |h|) * (1 - M x) := by + have hm : Monotone M := monotone_of_hasDerivAt_nonneg hd hQ + have hp (z : ℝ) : 0 ≤ 1 - M z := by linarith [(abs_le.mp (hM z)).2] + have hExp (z : ℝ) : HasDerivAt (fun t : ℝ => Real.exp (2 * t)) + (2 * Real.exp (2 * z)) z := by + simpa only [id_eq, one_mul, mul_one, mul_comm] using ((hasDerivAt_id z).const_mul 2).exp + have he (z : ℝ) : HasDerivAt (fun t => Real.exp (2 * t) * (1 - M t)) + (Real.exp (2 * z) * (2 * (1 - M z) - Q z)) z := by + convert (hExp z).mul ((hasDerivAt_const z 1).sub (hd z)) using 1 + simp only [Pi.sub_apply] + ring + have hw : Monotone (fun t => Real.exp (2 * t) * (1 - M t)) := by + apply monotone_of_hasDerivAt_nonneg he + intro z + apply mul_nonneg (Real.exp_pos _).le + have hsq : 0 ≤ (1 - M z) ^ 2 := sq_nonneg _ + nlinarith [hb z] + by_cases hh : 0 ≤ h + · have hmono := hm (show x ≤ x + h by linarith) + have hexp : 1 ≤ Real.exp (2 * |h|) := Real.one_le_exp (by positivity) + exact (sub_le_sub_left hmono 1).trans (le_mul_of_one_le_left (hp x) hexp) + · have hh' : h ≤ 0 := (lt_of_not_ge hh).le + have ht := hw (show x + h ≤ x by linarith) + change Real.exp (2 * (x + h)) * (1 - M (x + h)) ≤ Real.exp (2 * x) * (1 - M x) at ht + have heq : Real.exp (2 * (x + h)) = Real.exp (2 * x) * Real.exp (2 * h) := by + rw [← Real.exp_add] + congr 1 + ring + rw [heq, mul_assoc] at ht + have ht' := (mul_le_mul_iff_right₀ (Real.exp_pos (2 * x))).mp ht + have hmul : Real.exp (2 * |h|) * Real.exp (2 * h) = 1 := by + rw [abs_of_nonpos hh', ← Real.exp_add, show 2 * -h + 2 * h = 0 by ring, Real.exp_zero] + have hh'' := mul_le_mul_of_nonneg_left ht' (Real.exp_pos (2 * |h|)).le + simpa only [← mul_assoc, hmul, one_mul] using hh'' + +lemma magnetic_mean_shift_tendsto_one {ι : Type*} {l : Filter ι} + {M Q : ι → ℝ → ℝ} {x : ι → ℝ} + (hd : ∀ i z, HasDerivAt (M i) (Q i z) z) + (hM : ∀ i z, |M i z| ≤ 1) (hQ : ∀ i z, 0 ≤ Q i z) + (hb : ∀ i z, Q i z ≤ 1 - (M i z) ^ 2) + (hx : Tendsto (fun i => M i (x i)) l (𝓝 1)) (h : ℝ) : + Tendsto (fun i => M i (x i + h)) l (𝓝 1) := by + have he : Tendsto (fun i => Real.exp (2 * |h|) * (1 - M i (x i))) l (𝓝 0) := by + simpa only [sub_self, mul_zero] using + ((tendsto_const_nhds (x := (1 : ℝ))).sub hx).const_mul (Real.exp (2 * |h|)) + have hzero : Tendsto (fun i => 1 - M i (x i + h)) l (𝓝 0) := by + apply squeeze_zero (fun i => by linarith [(abs_le.mp (hM i (x i + h))).2]) + (fun i => magnetic_mean_shift_deficit (hd i) (hM i) (hQ i) (hb i) (x i) h) + simpa only [sub_self, mul_zero] using he + simpa only [sub_sub_cancel, sub_zero] using (tendsto_const_nhds (x := (1 : ℝ))).sub hzero + +lemma magnetic_mean_shift_tendsto_neg_one {ι : Type*} {l : Filter ι} + {M Q : ι → ℝ → ℝ} {x : ι → ℝ} + (hd : ∀ i z, HasDerivAt (M i) (Q i z) z) + (hM : ∀ i z, |M i z| ≤ 1) (hQ : ∀ i z, 0 ≤ Q i z) + (hb : ∀ i z, Q i z ≤ 1 - (M i z) ^ 2) + (hx : Tendsto (fun i => M i (x i)) l (𝓝 (-1))) (h : ℝ) : + Tendsto (fun i => M i (x i + h)) l (𝓝 (-1)) := by + have hd' (i : ι) (z : ℝ) : HasDerivAt (fun u => -M i (-u)) (Q i (-z)) z := by + convert ((hd i (-z)).comp z (hasDerivAt_neg z)).neg using 1 <;> + first | rfl | simp + have hM' (i : ι) (z : ℝ) : |-M i (-z)| ≤ 1 := by simpa only [abs_neg] using hM i (-z) + have hb' (i : ι) (z : ℝ) : Q i (-z) ≤ 1 - (-M i (-z)) ^ 2 := by + simpa only [neg_sq] using hb i (-z) + have hx' : Tendsto (fun i => -M i (- -x i)) l (𝓝 (1 : ℝ)) := by + simpa only [neg_neg] using hx.neg + have hh := magnetic_mean_shift_tendsto_one hd' hM' (fun i z => hQ i (-z)) hb' hx' (-h) + simpa only [neg_add_rev, neg_neg, add_comm] using hh.neg + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMinimumCalculus.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMinimumCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5ea9cd3f9dd79b63af2579499bea3096cff0ee5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticMinimumCalculus.lean @@ -0,0 +1,79 @@ +import Mathlib.Analysis.Calculus.LHopital +import Mathlib.Analysis.Calculus.LocalExtr.Basic +import OAI.Probability.InvariantIsing.Magnetic.MagneticImplicitBias + +namespace OAI + +/-! Necessary derivative signs at minima, for the inverse-coordinate +parabolic comparison on the closed mean-spin interval. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma second_derivative_nonneg_at_local_min {f f' : ℝ → ℝ} {a c : ℝ} + (hm : IsLocalMin f a) + (hf : ∀ᶠ x in 𝓝 a, HasDerivAt f (f' x) x) + (hf' : HasDerivAt f' c a) : 0 ≤ c := by + have hfa := hf.self_of_nhds + have hz : f' a = 0 := hm.hasDerivAt_eq_zero hfa + have hd := (hasDerivAt_iff_tendsto_slope_left_right.mp hf').2 + have hd' : Tendsto (fun x : ℝ => f' x / (2 * (x - a))) + (𝓝[>] a) (𝓝 (c / 2)) := by + have hh := hd.div_const 2 + convert hh using 1 + funext x + rw [slope_def_field, hz, sub_zero, mul_comm (2 : ℝ) (x - a), div_mul_eq_div_div] + have hnum : ∀ᶠ x in 𝓝[>] a, HasDerivAt (fun y => f y - f a) (f' x) x := by + filter_upwards [hf.filter_mono nhdsWithin_le_nhds] with x hx + exact hx.sub_const (f a) + have hden : ∀ᶠ x in 𝓝[>] a, + HasDerivAt (fun y : ℝ => (y - a) ^ 2) (2 * (x - a)) x := by + filter_upwards [] with x + convert ((hasDerivAt_id x).sub_const a).pow 2 using 1 + · funext y + rfl + · simp + have hne : ∀ᶠ x in 𝓝[>] a, 2 * (x - a) ≠ 0 := by + filter_upwards [self_mem_nhdsWithin] with x hx + exact mul_ne_zero (by norm_num) (sub_ne_zero.mpr hx.ne') + have hn0 : Tendsto (fun x => f x - f a) (𝓝[>] a) (𝓝 0) := by + simpa only [sub_self] using (hfa.continuousAt.sub_const (f a)).mono_left + nhdsWithin_le_nhds + have hd0 : Tendsto (fun x : ℝ => (x - a) ^ 2) (𝓝[>] a) (𝓝 0) := by + have hh : ContinuousAt (fun x : ℝ => (x - a) ^ 2) a := by fun_prop + simpa only [sub_self, zero_pow (by norm_num : 2 ≠ 0)] using + hh.tendsto.mono_left nhdsWithin_le_nhds + have hlim := HasDerivAt.lhopital_zero_nhdsGT hnum hden hne hn0 hd0 hd' + have hnon : ∀ᶠ x in 𝓝[>] a, 0 ≤ (f x - f a) / (x - a) ^ 2 := by + filter_upwards [hm.filter_mono nhdsWithin_le_nhds] with x hx + exact div_nonneg (sub_nonneg.mpr hx) (sq_nonneg _) + have : 0 ≤ c / 2 := ge_of_tendsto hlim hnon + linarith + +lemma derivative_nonpos_at_left_min {f : ℝ → ℝ} {a d : ℝ} + (hf : HasDerivAt f d a) (hm : ∀ᶠ x in 𝓝[<] a, f a ≤ f x) : d ≤ 0 := by + have hl := (hasDerivAt_iff_tendsto_slope_left_right.mp hf).1 + apply le_of_tendsto hl + filter_upwards [hm, self_mem_nhdsWithin] with x hx hxa + rw [slope_def_field] + exact div_nonpos_of_nonneg_of_nonpos (sub_nonneg.mpr hx) (sub_nonpos.mpr hxa.le) + +lemma derivativeWithin_nonpos_at_left_min {f : ℝ → ℝ} {a d : ℝ} + (hf : HasDerivWithinAt f d (Iic a) a) + (hm : ∀ᶠ x in 𝓝[<] a, f a ≤ f x) : d ≤ 0 := by + have hl : Tendsto (slope f a) (𝓝[<] a) (𝓝 d) := + (hasDerivWithinAt_iff_tendsto_slope' (by simp : a ∉ Iio a)).mp + (hf.mono Iio_subset_Iic_self) + apply le_of_tendsto hl + filter_upwards [hm, self_mem_nhdsWithin] with x hx hxa + rw [slope_def_field] + exact div_nonpos_of_nonneg_of_nonpos (sub_nonneg.mpr hx) (sub_nonpos.mpr hxa.le) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticOffDiagonalHessian.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticOffDiagonalHessian.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae7b3a81e345233d5a10049a65202e0b11b9547b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticOffDiagonalHessian.lean @@ -0,0 +1,137 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeightOrder +import OAI.Probability.InvariantIsing.Magnetic.MagneticRadialHessian +import OAI.Probability.InvariantIsing.Fields.FieldHessianAlgebra + +namespace OAI + +/-! The mixed sign of the constrained height Hessian follows from the +actual positive coordinate variation. Together with radial monotonicity, +it gives the negative quadratic-form sign. -/ + +noncomputable section +open Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +private lemma deriv_nonpos_of_right_order {f : ℝ → ℝ} {d : ℝ} + (hd : HasDerivAt f d 0) (hf : ∀ᶠ t in 𝓝[>] (0 : ℝ), f t ≤ f 0) : d ≤ 0 := by + apply le_of_tendsto hd.tendsto_slope_zero_right + filter_upwards [hf, self_mem_nhdsWithin] with t ht hpos + simpa only [zero_add, smul_eq_mul] using + mul_nonpos_of_nonneg_of_nonpos (inv_nonneg.mpr hpos.le) (sub_nonpos.mpr ht) + +private lemma update_eq_coordinate_line {n : ℕ} (r : Fin n → ℝ) + (j : Fin n) (t : ℝ) : + Function.update r j (r j + t) = r + t • Pi.single j (1 : ℝ) := by + classical + funext k + by_cases hkj : k = j + · subst k + simp + · simp [Function.update_of_ne hkj, Pi.single_eq_of_ne hkj] + +private lemma heightLevel_update (h : FieldStep) {s : ℝ} + (r : Fin (h.depth + 1) → ℝ) (hrs : r ∈ fieldStrictHeightCone h.depth) + (j : Fin (h.depth + 1)) (t : ℝ) + (ht : Function.update r j (r j + t) ∈ fieldStrictHeightCone h.depth) + (i : Fin (h.depth + 1)) : + magneticHeightLevel h s (r + t • Pi.single j (1 : ℝ)) i = + magneticFieldLevel (fieldStepOfStrictHeights (fieldStepOfStrictHeights h r hrs) + (Function.update r j (r j + t)) ht) s i := by + rw [← update_eq_coordinate_line, magneticHeightLevel, dite_eq_left ht] + rfl + +lemma magneticHeightLevel_coordinate_right_order (h : FieldStep) {s : ℝ} + (hs : |s| < 1) (r : Fin (h.depth + 1) → ℝ) + (hrs : r ∈ fieldStrictHeightCone h.depth) + (i j : Fin (h.depth + 1)) (hij : i < j) : + ∀ᶠ t in 𝓝[>] (0 : ℝ), + magneticHeightLevel h s (r + t • Pi.single j (1 : ℝ)) i ≤ + magneticHeightLevel h s r i := by + let k := fieldStepOfStrictHeights h r hrs + have hbase : magneticHeightLevel h s r i = magneticFieldLevel k s i := by + rw [magneticHeightLevel, dite_eq_left hrs] + have hq : ContinuousAt (fun t : ℝ => Function.update r j (r j + t)) 0 := by + apply continuousAt_pi.2 + intro l + by_cases hlj : l = j + · subst l + simp only [Function.update_self] + fun_prop + · simpa only [Function.update_of_ne hlj] using continuousAt_const + have hn : ∀ᶠ t in 𝓝 (0 : ℝ), + Function.update r j (r j + t) ∈ fieldStrictHeightCone h.depth := + hq.eventually ((isOpen_fieldStrictHeightCone _).mem_nhds (by simpa using hrs)) + revert hij hn + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij hn + filter_upwards [hn.filter_mono nhdsWithin_le_nhds, self_mem_nhdsWithin] with t ht hpos + rw [heightLevel_update h r hrs _ t ht i, hbase] + exact magneticFieldLevel_terminal_update_le k hpos.le ht hs i hij + · intro hij hn + have hj : 0 < j.val := by change i.val < j.val at hij; omega + have hgap : 0 < (fieldIncrement k j.succ).2 := hrs j.succ + have hb : ∀ᶠ t in 𝓝 (0 : ℝ), t < (fieldIncrement k j.succ).2 := + Iio_mem_nhds hgap + filter_upwards [hn.filter_mono nhdsWithin_le_nhds, + hb.filter_mono nhdsWithin_le_nhds, self_mem_nhdsWithin] with t ht hbound hpos + rw [heightLevel_update h r hrs _ t ht i, hbase] + exact magneticFieldLevel_interior_update_le k j hj hpos.le hbound.le ht hs i hij + +theorem magneticHeightSchur_mixed_nonneg (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r : Fin (h.depth + 1) → ℝ) + (hr : r ∈ I) (hrs : r ∈ fieldStrictHeightCone h.depth) + (i j : Fin (h.depth + 1)) (hij : i < j) : + 0 ≤ magneticHeightSchur h F s r i j := by + have hd := hasDerivAt_magneticHeightLevel_line h F hI hU hs r + (Pi.single j 1) hr hrs i + have hn := deriv_nonpos_of_right_order hd + (by simpa only [zero_smul, add_zero] using + magneticHeightLevel_coordinate_right_order h hs r hrs i j hij) + have he : (∑ k, magneticHeightSchur h F s r i k * (Pi.single j (1 : ℝ) : Fin (h.depth + 1) → ℝ) k) = + magneticHeightSchur h F s r i j := by + classical + simp [Pi.single_apply] + rw [he] at hn + have hw : 0 < h.cut i.succ - h.cut i.castSucc := + sub_pos.mpr (h.ordered_cut i.castSucc_lt_succ) + have hc : -2 / (h.cut i.succ - h.cut i.castSucc) < 0 := + div_neg_of_neg_of_pos (by norm_num) hw + nlinarith + +theorem magneticHeightSchur_quadratic_nonpos (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r : Fin (h.depth + 1) → ℝ) + (hr : r ∈ I) (hrs : r ∈ fieldStrictHeightCone h.depth) + (x : Fin (h.depth + 1) → ℝ) : + ∑ i, ∑ j, magneticHeightSchur h F s r i j * x i * x j ≤ 0 := by + let M := fun i j => -magneticHeightSchur h F s r i j + have hsym : ∀ i j, M i j = M j i := fun i j => + congrArg Neg.neg (magneticHeightSchur_symmetric h F s r hr i j) + have hoff : ∀ i j, i ≠ j → M i j ≤ 0 := by + intro i j hij + apply neg_nonpos.mpr + rcases lt_or_gt_of_ne hij with hlt | hgt + · exact magneticHeightSchur_mixed_nonneg h F hI hU hs r hr hrs i j hlt + · rw [magneticHeightSchur_symmetric h F s r hr i j] + exact magneticHeightSchur_mixed_nonneg h F hI hU hs r hr hrs j i hgt + have hpos : ∀ i, 0 < r i := by + intro i + have h0 : 0 < r 0 := by simpa [fieldHeightIncrement] using hrs 0 + exact h0.trans_le ((fieldStrictHeightCone_strictMono hrs).monotone (Fin.zero_le i)) + have hrow : ∀ i, 0 ≤ ∑ j, M i j * r j := by + intro i + have he := magneticHeight_radial_hessian_nonpos h F hI hU hs r hr hrs i + simpa only [M, neg_mul, Finset.sum_neg_distrib, neg_nonneg] using he + have hq := field_quadratic_nonneg_of_positive_scaling M r hsym hoff hpos hrow x + simpa only [M, neg_mul, Finset.sum_neg_distrib, neg_nonneg] using hq + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPairComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPairComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..91cef4e53c4f726e26c15dc94c4a808b58e34bb3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPairComparison.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Fields.CanonicalPairRootLaw +import OAI.Probability.InvariantIsing.Magnetic.ConstrainedBlockMagneticEstimate + +namespace OAI + +/-! A dimension-free comparison of the actual constrained two-spin mean +with the site-average magnetic field law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal BigOperators + +namespace InvariantIsing + +def restrictedBlockPairMean {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (b : Fin N → ℝ) (i : Fin (h.depth + 1)) : ℝ := + (N : ℝ)⁻¹ * ∫ p, ∑ j, spinValue (p.1 j) * spinValue (p.2 j) + ∂restrictedLevelSpinPair hN S hS h b i + +theorem restrictedBlockPairMean_comparison {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i : Fin (h.depth + 1)) {t : ℝ} (ht : 0 < t) : + |restrictedBlockPairMean hN S hS h b i - + (N : ℝ)⁻¹ * ∑ j, magneticLevelAtBias h (b j) i| ≤ + 2 * (biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b) / t + t / 2 := by + let P := restrictedLevelSpinPair hN S hS h b i + let Q := restrictedLevelSpinPair hN Finset.univ Finset.univ_nonempty h b i + let e := (MeasurableEquiv.arrowProdEquivProdArrow Bool Bool (Fin N)).symm + let μ := P.map e + let ν := fun j => biasedFieldLevelSpinPair h (b j) i + let D := biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b + have hD : 0 ≤ D := (biasedConstrainedBlockValue_gap hN S hS h b).1 + have hQ : Q.map e = Measure.pi ν := canonicalLevelSpinPair_product hN h b i + have hK : klDiv μ (Measure.pi ν) ≤ 2 * ENNReal.ofReal (N * D) := by + rw [← hQ] + exact (klDiv_map_le P Q e.measurable).trans (restrictedLevelSpinPair_entropy hN S hS h b i) + have hk : klDiv μ (Measure.pi ν) ≠ ⊤ := ne_top_of_le_ne_top (by finiteness) hK + have hkr : (klDiv μ (Measure.pi ν)).toReal ≤ 2 * (N : ℝ) * D := by + have he := ENNReal.toReal_mono (by finiteness) hK + simpa only [ENNReal.toReal_mul, ENNReal.toReal_ofNat, + ENNReal.toReal_ofReal (mul_nonneg (Nat.cast_nonneg N) hD), mul_assoc] using he + have he := spinPairSiteSum_entropy_bound μ ν hk ht + have hmean : (∫ u, spinPairSiteSum u ∂μ) = + ∫ p, ∑ j, spinValue (p.1 j) * spinValue (p.2 j) ∂P := by + rw [show μ = P.map e from rfl, integral_map e.measurable.aemeasurable + (measurable_of_finite spinPairSiteSum).aestronglyMeasurable] + rfl + rw [hmean] at he + simp_rw [show ∀ j, (∫ p, spinPairSiteValue p ∂ν j) = magneticLevelAtBias h (b j) i + from fun j => biasedFieldLevelSpinPair_mean h (b j) i] at he + have hn : (0 : ℝ) < N := by exact_mod_cast hN + calc + _ = (N : ℝ)⁻¹ * |(∫ p, ∑ j, spinValue (p.1 j) * spinValue (p.2 j) ∂P) - + ∑ j, magneticLevelAtBias h (b j) i| := by + rw [restrictedBlockPairMean, ← mul_sub, abs_mul, abs_of_pos (inv_pos.mpr hn)] + _ ≤ (N : ℝ)⁻¹ * ((2 * N * D) / t + N * t / 2) := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr hn.le) + exact he.trans (add_le_add_left (div_le_div_of_nonneg_right hkr ht.le) _) + _ = _ := by + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPairConvergence.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPairConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cebb38fafe74a70f8c76127c516bf1738fd3804 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPairConvergence.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticPairComparison +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockConvergence + +namespace OAI + +/-! Uniform two-spin replacement along arbitrary bounded-height field +partitions, including partitions of increasing depth. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators NNReal Topology + +namespace InvariantIsing + +lemma tendsto_zero_of_pair_entropy (f g : ℕ → ℝ) (hf : ∀ n, 0 ≤ f n) + (hg : Tendsto g atTop (𝓝 0)) + (hb : ∀ t : ℝ, 0 < t → ∀ n, f n ≤ 2 * g n / t + t / 2) : + Tendsto f atTop (𝓝 0) := by + apply tendsto_order.2 + constructor + · intro a ha + exact Eventually.of_forall (fun n => ha.trans_le (hf n)) + · intro a ha + have ht : Tendsto (fun n => 2 * g n / a) atTop (𝓝 0) := by + simpa using (hg.const_mul 2).div_const a + filter_upwards [ht.eventually (gt_mem_nhds (by linarith : (0 : ℝ) < a / 2))] with n hn + have he := hb a ha n + linarith + +theorem magneticBlockPairGap_tendsto {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ n, 0 < N n) (hNlim : Tendsto N atTop atTop) + (group : ∀ n, Fin (N n) → A) (k : ℕ → A → ℕ) + (hk : ∀ n a, k n a ≤ spinGroupSize (group n) a) (m : ℕ → A → ℝ) + {r H : ℝ} (hr : r < 1) (hm : ∀ n a, |m n a| ≤ r) + (hc : ∀ n a, (k n a : ℝ) = spinGroupSize (group n) a * ((1 + m n a) / 2)) + (h : ℕ → FieldStep) (hH : ∀ n, (h n).height (Fin.last (h n).depth) ≤ H) + (i : ∀ n, Fin ((h n).depth + 1)) : + Tendsto (fun n => |restrictedBlockPairMean (hN n) (spinGroupSlice (group n) (k n)) + (spinGroupSlice_nonempty (group n) (k n) (hk n)) (h n) + (fun j => magneticBias (h n) (m n (group n j))) (i n) - + (N n : ℝ)⁻¹ * ∑ j, magneticFieldLevel (h n) (m n (group n j)) (i n)|) + atTop (𝓝 0) := by + let g := fun n => (N n : ℝ)⁻¹ * (∑ j, constrainedFieldValue (h n) (m n (group n j))) - + constrainedBlockValue (spinGroupSlice (group n) (k n)) (h n) + apply tendsto_zero_of_pair_entropy _ g (fun n => abs_nonneg _) + (magneticBlockGap_tendsto N hN hNlim group k hk m hr hm hc h hH) + intro t ht n + have he := restrictedBlockPairMean_comparison (hN n) (spinGroupSlice (group n) (k n)) + (spinGroupSlice_nonempty (group n) (k n) (hk n)) (h n) + (fun j => magneticBias (h n) (m n (group n j))) (i n) ht + rw [← magneticBlockGap_eq_biasedGap (hN n) (group n) (k n) (hk n) (m n) + (fun a => (hm n a).trans_lt hr) (hc n) (h n)] at he + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd9b04e252783264570e7da3ff47807589ad8041 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicComparison.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicMinimum + +namespace OAI + +/-! Exponential damping removes the sign restriction on the bounded +zeroth-order coefficient in the degenerate closed-interval comparison. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma parabolic_minimum_nonneg_bounded {T M : ℝ} (hT : 0 ≤ T) + (W Wt Wx Wxx A B C : ℝ × ℝ → ℝ) + (hW : ContinuousOn W (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hinit : ∀ x ∈ Icc (-1 : ℝ) 1, 0 ≤ W (0, x)) + (hdt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ x ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun q => W (q, x)) (Wt (t, x)) (Iic t) t) + (hdx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => W (t, y)) (Wx (t, x)) x) + (hdxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => Wx (t, y)) (Wxx (t, x)) x) + (hA : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ A p) + (hC : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, C p ≤ M) + (hboundary : ∀ t ∈ Icc (0 : ℝ) T, + A (t, -1) = 0 ∧ B (t, -1) = 0 ∧ A (t, 1) = 0 ∧ B (t, 1) = 0) + (hPDE : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + A p * Wxx p + B p * Wx p + C p * W p ≤ Wt p) : + ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ W p := by + let E : ℝ × ℝ → ℝ := fun p => Real.exp (-(M + 1) * p.1) + let V := fun p => E p * W p + let Vt := fun p => E p * (Wt p - (M + 1) * W p) + let Vx := fun p => E p * Wx p + let Vxx := fun p => E p * Wxx p + have hV : ContinuousOn V (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1) := + ((by fun_prop : Continuous E).continuousOn).mul hW + have hVi : ∀ x ∈ Icc (-1 : ℝ) 1, 0 ≤ V (0, x) := by + intro x hx + simpa [V, E] using hinit x hx + have hVt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ x ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun q => V (q, x)) (Vt (t, x)) (Iic t) t := by + intro t ht x hx + have he := (((hasDerivAt_id t).const_mul (-(M + 1))).exp).hasDerivWithinAt (s := Iic t) + convert he.mul (hdt t ht x hx) using 1 + · rfl + · simp only [Vt, E, id_eq] + ring + have hVx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => V (t, y)) (Vx (t, x)) x := by + intro t ht x hx + exact (hdx t ht x hx).const_mul (Real.exp (-(M + 1) * t)) + have hVxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => Vx (t, y)) (Vxx (t, x)) x := by + intro t ht x hx + exact (hdxx t ht x hx).const_mul (Real.exp (-(M + 1) * t)) + have hCn : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, C p - (M + 1) < 0 := by + intro p hp + linarith [hC p hp] + have hVpde : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + A p * Vxx p + B p * Vx p + (C p - (M + 1)) * V p ≤ Vt p := by + intro p hp + have hh := mul_le_mul_of_nonneg_left (hPDE p hp) (Real.exp_pos (-(M + 1) * p.1)).le + dsimp only [Vxx, Vx, V, Vt, E] + nlinarith + have hv := parabolic_minimum_nonneg hT V Vt Vx Vxx A B + (fun p => C p - (M + 1)) hV hVi hVt hVx hVxx hA hCn hboundary hVpde + intro p hp + exact nonneg_of_mul_nonneg_right (hv p hp) (Real.exp_pos (-(M + 1) * p.1)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicMinimum.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee7c15a34bed724e357819bf2f3a9f970c771ebb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicMinimum.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticMinimumCalculus +import Mathlib.Topology.Order.Compact + +namespace OAI + +/-! Minimum comparison on the closed mean-spin interval. Diffusion and +drift may degenerate at the two endpoints, where both coefficients vanish. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma parabolic_minimum_nonneg {T : ℝ} (hT : 0 ≤ T) + (W Wt Wx Wxx A B C : ℝ × ℝ → ℝ) + (hW : ContinuousOn W (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hinit : ∀ x ∈ Icc (-1 : ℝ) 1, 0 ≤ W (0, x)) + (hdt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ x ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun q => W (q, x)) (Wt (t, x)) (Iic t) t) + (hdx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => W (t, y)) (Wx (t, x)) x) + (hdxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => Wx (t, y)) (Wxx (t, x)) x) + (hA : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ A p) + (hC : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, C p < 0) + (hboundary : ∀ t ∈ Icc (0 : ℝ) T, + A (t, -1) = 0 ∧ B (t, -1) = 0 ∧ A (t, 1) = 0 ∧ B (t, 1) = 0) + (hPDE : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + A p * Wxx p + B p * Wx p + C p * W p ≤ Wt p) : + ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ W p := by + intro p hp + by_contra hn + have hpneg : W p < 0 := lt_of_not_ge hn + obtain ⟨q, hq, hmin⟩ := (isCompact_Icc.prod isCompact_Icc).exists_isMinOn + ⟨(0, 0), by exact ⟨⟨le_rfl, hT⟩, by constructor <;> norm_num⟩⟩ hW + have hqneg : W q < 0 := (hmin hp).trans_lt hpneg + have hqt : 0 < q.1 := by + have hqn : q.1 ≠ 0 := by + intro he + have hh := hinit q.2 hq.2 + have hqe : q = (0, q.2) := Prod.ext he rfl + rw [hqe] at hqneg + linarith + exact lt_of_le_of_ne hq.1.1 (Ne.symm hqn) + have htime : ∀ᶠ t in 𝓝[<] q.1, W q ≤ W (t, q.2) := by + have hn0 : ∀ᶠ t in 𝓝[<] q.1, 0 < t := + (show ∀ᶠ t : ℝ in 𝓝 q.1, 0 < t from Ioi_mem_nhds hqt).filter_mono + nhdsWithin_le_nhds + filter_upwards [hn0, self_mem_nhdsWithin] with t ht0 htt + exact hmin ⟨⟨ht0.le, htt.le.trans hq.1.2⟩, hq.2⟩ + have htderiv : Wt q ≤ 0 := derivativeWithin_nonpos_at_left_min + (hdt q.1 ⟨hqt, hq.1.2⟩ q.2 hq.2) htime + have hqC : 0 < C q * W q := mul_pos_of_neg_of_neg (hC q hq) hqneg + have hqp : q ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1 := ⟨⟨hqt, hq.1.2⟩, hq.2⟩ + by_cases hleft : q.2 = -1 + · have hb := hboundary q.1 hq.1 + have hpde := hPDE q hqp + have hqe : q = (q.1, -1) := Prod.ext rfl hleft + rw [hqe, hb.1, hb.2.1, zero_mul, zero_mul, zero_add, zero_add] at hpde + rw [hqe] at htderiv hqC + linarith + by_cases hright : q.2 = 1 + · have hb := hboundary q.1 hq.1 + have hpde := hPDE q hqp + have hqe : q = (q.1, 1) := Prod.ext rfl hright + rw [hqe, hb.2.2.1, hb.2.2.2, zero_mul, zero_mul, zero_add, zero_add] at hpde + rw [hqe] at htderiv hqC + linarith + have hqi : q.2 ∈ Ioo (-1 : ℝ) 1 := + ⟨lt_of_le_of_ne hq.2.1 (Ne.symm hleft), lt_of_le_of_ne hq.2.2 hright⟩ + have hm : IsLocalMin (fun x => W (q.1, x)) q.2 := by + filter_upwards [isOpen_Ioo.mem_nhds hqi] with x hx + exact hmin ⟨hq.1, ⟨hx.1.le, hx.2.le⟩⟩ + have hx0 : Wx q = 0 := hm.hasDerivAt_eq_zero (hdx q.1 hq.1 q.2 hqi) + have hxx : 0 ≤ Wxx q := by + apply second_derivative_nonneg_at_local_min hm ?_ (hdxx q.1 hq.1 q.2 hqi) + filter_upwards [isOpen_Ioo.mem_nhds hqi] with x hx + exact hdx q.1 hq.1 x hx + have hprod : 0 ≤ A q * Wxx q := mul_nonneg (hA q hq) hxx + have hpde := hPDE q hqp + rw [hx0, mul_zero, add_zero] at hpde + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicNegative.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicNegative.lean new file mode 100644 index 0000000000000000000000000000000000000000..3dad89a619f048b955a99570a7a51b8c66df21aa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticParabolicNegative.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicComparison + +namespace OAI + +/-! Comparison only needs a bound for the zeroth-order coefficient on the +negative set of the proposed difference. This avoids division estimates +between two different inverse curvatures at the degenerate endpoints. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma parabolic_minimum_nonneg_bounded_on_negative {T M : ℝ} (hT : 0 ≤ T) + (W Wt Wx Wxx A B C : ℝ × ℝ → ℝ) + (hW : ContinuousOn W (Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1)) + (hinit : ∀ x ∈ Icc (-1 : ℝ) 1, 0 ≤ W (0, x)) + (hdt : ∀ t ∈ Ioc (0 : ℝ) T, ∀ x ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun q => W (q, x)) (Wt (t, x)) (Iic t) t) + (hdx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => W (t, y)) (Wx (t, x)) x) + (hdxx : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => Wx (t, y)) (Wxx (t, x)) x) + (hA : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ A p) + (hC : ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, W p < 0 → C p ≤ M) + (hboundary : ∀ t ∈ Icc (0 : ℝ) T, + A (t, -1) = 0 ∧ B (t, -1) = 0 ∧ A (t, 1) = 0 ∧ B (t, 1) = 0) + (hPDE : ∀ p ∈ Ioc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, + A p * Wxx p + B p * Wx p + C p * W p ≤ Wt p) : + ∀ p ∈ Icc (0 : ℝ) T ×ˢ Icc (-1 : ℝ) 1, 0 ≤ W p := by + apply parabolic_minimum_nonneg_bounded hT W Wt Wx Wxx A B + (fun p => min (C p) M) hW hinit hdt hdx hdxx hA + (fun p _ => min_le_right _ _) hboundary + intro p hp + by_cases hn : W p < 0 + · have hc := hC p ⟨⟨hp.1.1.le, hp.1.2⟩, hp.2⟩ hn + simpa only [min_eq_left hc] using hPDE p hp + · have hm := mul_le_mul_of_nonneg_right (min_le_left (C p) M) (le_of_not_gt hn) + linarith [hPDE p hp] + +lemma inverse_curvature_difference_coefficient_bound + {a b d ζ A K : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hba : b ≤ a) + (hA : a ≤ A) (hζ : 0 ≤ ζ) (hd : |a * d| ≤ K) : + (b + a) * (d / 2 + ζ) ≤ K + 2 * A * ζ := by + have hK : 0 ≤ K := (abs_nonneg _).trans hd + have hdiff : (b + a) * d / 2 ≤ K := by + by_cases hd0 : 0 ≤ d + · have hp := mul_nonneg (sub_nonneg.mpr hba) hd0 + nlinarith [(le_abs_self (a * d)).trans hd] + · have hp := mul_nonpos_of_nonneg_of_nonpos (add_nonneg hb ha) (le_of_not_ge hd0) + linarith + have hterm := mul_le_mul_of_nonneg_right (show b + a ≤ 2 * A by linarith) hζ + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPartitionContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPartitionContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..05de67bc65694b4ddee7363597142a8f8d4f916f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPartitionContinuity.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactPartitionContinuity +import OAI.Probability.InvariantIsing.Spectral.MeasureMagneticContinuity + +namespace OAI + +/-! Magnetic variational convergence for finite positive spectral partitions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma compact_partition_magnetic_tendsto (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (δ : ℕ → ℝ) (D : (k : ℕ) → CompactSpectralPartition ν a b (δ k)) + (hab : a ≤ b) (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) (hδ : Tendsto δ atTop (𝓝 0)) + {A : Type*} [Fintype A] (γ c : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) : + Tendsto (fun k => (finiteMagneticFunctional (measureR ((D k).law : Measure ℝ) (D k).edge) γ c).toReal) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) := by + let K := |a|+|b|+1 + have hK : 0 < K := by dsimp [K]; positivity + have haK : -K ≤ a := by dsimp [K]; linarith [neg_abs_le a,abs_nonneg b] + have hbK : b ≤ K := by dsimp [K]; linarith [le_abs_self b,abs_nonneg a] + exact measureMagnetic_tendsto_weak (fun k => (D k).law) ν + (fun k => (D k).edge) b (compact_partition_laws_tendsto ν a b δ D hδ) + (compact_partition_edges_tendsto ν a b δ D hab ha hb hδ) hK hbK + (fun k => (((D k).value_mem hab (D k).upper).2).trans hbK) + (fun k => ((D k).law_support hab).mono (fun _ hx => ⟨haK.trans hx.1,hx.2⟩)) + (by + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + exact ⟨haK.trans (hbound hx).1,(hbound hx).2⟩) γ c hγ hγsum + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPartitionSupport.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPartitionSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..2576ebe4b4df0fc63098d3748946e9772fc844fd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPartitionSupport.lean @@ -0,0 +1,108 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticClosedSupport +import OAI.Probability.InvariantIsing.Magnetic.MagneticRefinement +import OAI.Probability.InvariantIsing.Fields.FieldPartitionSupport + +namespace OAI + +/-! The constrained scalar-field supporting inequality on arbitrary +finite partitions, expressed through the physical magnetic overlap path. -/ + +noncomputable section +open MeasureTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma magneticFieldPath_step_ae (h : FieldStep) (m : ℝ) : + (magneticFieldPath h m).val =ᵐ[pathMeasure] + finiteStepFunction h.cut (magneticFieldLevel h m) := by + filter_upwards [ae_finite_overlap_cell h.cut h.first h.last] with s hs + obtain ⟨i, hi⟩ := hs + rw [magneticFieldPath_on_cell h m i hi, + finiteStepFunction_on_cell h.ordered_cut _ hi] + +lemma fieldPairing_magnetic_same (h : FieldStep) (m : ℝ) + (r : Fin (h.depth + 1) → ℝ) (hr0 : ∀ i, 0 ≤ r i) (hrmono : Monotone r) : + fieldPairing (magneticFieldPath h m) (fieldWithHeights h r hr0 hrmono) = + ∑ i, (h.cut i.succ - h.cut i.castSucc) * magneticFieldLevel h m i * r i := by + change (∫ s, magneticFieldPath h m s * fieldFunction (fieldWithHeights h r hr0 hrmono) s + ∂pathMeasure) = _ + calc + _ = ∫ s, finiteStepFunction h.cut (magneticFieldLevel h m) s * + finiteStepFunction h.cut r s ∂pathMeasure := by + apply integral_congr_ae + filter_upwards [magneticFieldPath_step_ae h m] with s hs + rw [hs] + rfl + _ = _ := integral_finiteStepFunction_mul h.cut h.ordered_cut h.first h.last _ _ + +lemma fieldPairing_magnetic_self (h : FieldStep) (m : ℝ) : + fieldPairing (magneticFieldPath h m) h = + ∑ i, (h.cut i.succ - h.cut i.castSucc) * magneticFieldLevel h m i * h.height i := by + have he : fieldWithHeights h h.height h.nonneg h.ordered_height = h := by + cases h + rfl + simpa only [he] using fieldPairing_magnetic_same h m h.height h.nonneg h.ordered_height + +lemma magneticField_support_same_partition (h : FieldStep) {m : ℝ} (hm : |m| < 1) + (r : Fin (h.depth + 1) → ℝ) (hr0 : ∀ i, 0 ≤ r i) (hrmono : Monotone r) : + constrainedFieldValue (fieldWithHeights h r hr0 hrmono) m ≤ constrainedFieldValue h m - + (1 / 2 : ℝ) * ∫ s, magneticFieldPath h m s * + (fieldFunction (fieldWithHeights h r hr0 hrmono) s - fieldFunction h s) ∂pathMeasure := by + have hi := magneticHeight_support h hm r hr0 hrmono + have he : (∫ s, magneticFieldPath h m s * + (fieldFunction (fieldWithHeights h r hr0 hrmono) s - fieldFunction h s) ∂pathMeasure) = + fieldPairing (magneticFieldPath h m) (fieldWithHeights h r hr0 hrmono) - + fieldPairing (magneticFieldPath h m) h := by + simp only [mul_sub] + exact integral_sub (integrable_path_mul_field _ _) (integrable_path_mul_field _ _) + rw [he, fieldPairing_magnetic_same, fieldPairing_magnetic_self] + have hsum : (∑ i, (-(h.cut i.succ - h.cut i.castSucc) / 2 * magneticFieldLevel h m i) * + (r i - h.height i)) = -(1 / 2 : ℝ) * + ((∑ i, (h.cut i.succ - h.cut i.castSucc) * magneticFieldLevel h m i * r i) - + ∑ i, (h.cut i.succ - h.cut i.castSucc) * magneticFieldLevel h m i * h.height i) := by + rw [← Finset.sum_sub_distrib, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + rw [hsum] at hi + linarith + +lemma magneticField_support_equal_cutList {h k : FieldStep} {m : ℝ} (hm : |m| < 1) + (he : List.ofFn h.cut = List.ofFn k.cut) : + constrainedFieldValue k m ≤ constrainedFieldValue h m - (1 / 2 : ℝ) * + ∫ s, magneticFieldPath h m s * (fieldFunction k s - fieldFunction h s) ∂pathMeasure := by + obtain ⟨r, hr0, hrmono, rfl⟩ := field_eq_withHeights_of_cutList he + exact magneticField_support_same_partition h hm r hr0 hrmono + +theorem magneticField_support (h k : FieldStep) {m : ℝ} (hm : |m| < 1) : + constrainedFieldValue k m ≤ constrainedFieldValue h m - (1 / 2 : ℝ) * + ∫ s, magneticFieldPath h m s * (fieldFunction k s - fieldFunction h s) ∂pathMeasure := by + obtain ⟨h', k', hh', hk', hcuts⟩ := field_common_refinement h k + have hi := magneticField_support_equal_cutList hm hcuts + rw [hh'.constrainedValue m, hk'.constrainedValue m] at hi + have he : (∫ s, magneticFieldPath h' m s * (fieldFunction k' s - fieldFunction h' s) + ∂pathMeasure) = ∫ s, magneticFieldPath h m s * + (fieldFunction k s - fieldFunction h s) ∂pathMeasure := by + apply integral_congr_ae + filter_upwards [hh'.magneticPath_ae m, hh'.field_ae, hk'.field_ae] with s hB hh hk + rw [hB, hh, hk] + rwa [he] at hi + +theorem magneticField_support_pairing (h k : FieldStep) {m : ℝ} (hm : |m| < 1) : + constrainedFieldValue k m + (1 / 2 : ℝ) * fieldPairing (magneticFieldPath h m) k ≤ + constrainedFieldValue h m + (1 / 2 : ℝ) * fieldPairing (magneticFieldPath h m) h := by + have hs := magneticField_support h k hm + have he : (∫ s, magneticFieldPath h m s * (fieldFunction k s - fieldFunction h s) + ∂pathMeasure) = fieldPairing (magneticFieldPath h m) k - + fieldPairing (magneticFieldPath h m) h := by + simp only [mul_sub] + exact integral_sub (integrable_path_mul_field _ _) (integrable_path_mul_field _ _) + rw [he] at hs + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalFieldUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalFieldUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..58e17b74a92e07f97b1370f857f3954cc63b48a2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalFieldUpper.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFullFieldUpper +import OAI.Probability.InvariantIsing.Cavity.CavityOrientedFamily +import OAI.Probability.InvariantIsing.Cavity.CavityGroupPartition + +namespace OAI + +/-! The finite-field upper bound for physical orthogonal Haar matrices, +with arbitrary finite eigenvalue and field labelings at every dimension. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_physical_field_pressure_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {m : ℕ} (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (g : (M : ℕ) → Fin M → A) (γ b : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) : + ∀ ε > 0, ∀ᶠ M in atTop, + (∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M) ≤ + (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal+ε := by + let N := fun k : ℕ => k+3 + have hN k : 0 < N k := by dsimp only [N]; omega + let ν := fun k => cavityOrientedBaseLaw (hN k) (μ (N k)) + let K := 1+∑ a, |lam a| + have hK : 0 < K := by dsimp only [K]; positivity + have heig k i : |lam (e (N k) i)|≤K := by + have hh := Finset.single_le_sum (f := fun a => |lam a|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ (e (N k) i)) + dsimp only [K] + linarith + have hh := finiteSpectrum_fullField_pressure_upper hhaar hgauss N (fun _ => by dsimp only [N]; omega) + (tendsto_add_atTop_nat 3) m ν + (fun k => cavityOrientedBaseLaw_leftInvariant _ _) (fun k i => lam (e (N k) i)) K hK heig + (fun k => cavitySpectralGroup (e (N k))) (fun _ => cavitySpectralGroup_pairwiseDisjoint _) + (fun _ => cavitySpectralGroup_cover _) lam + (by intro k a i hi; rw [(Finset.mem_filter.mp hi).2]) ρ hρ hsum + (he.comp (tendsto_add_atTop_nat 3)) (fun k => g (N k)) γ b hγ hγsum + (hg.comp (tendsto_add_atTop_nat 3)) + intro ε hε + obtain ⟨J,hJ⟩ := eventually_atTop.mp (hh ε hε) + apply eventually_atTop.mpr + refine ⟨J+3,fun M hM => ?_⟩ + obtain ⟨k,rfl⟩ : ∃ k, M=k+3 := ⟨M-3,(Nat.sub_add_cancel (by omega)).symm⟩ + have hx := hJ k (by omega) + rw [cavity_oriented_pressure] at hx + exact hx + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalIncrementLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalIncrementLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..a577c3dc7f2c3b56361d669d701455570bcaabfd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalIncrementLower.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Magnetic.RationalConstrainedMinima + +namespace OAI + +/-! A conditional physical cavity-increment lower bound with the actual +perturbation minima constructed, rather than assumed. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_physical_increment_eventually_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ (r : ℕ) (u : (j : ℕ) → Fin (cavityRationalSize (N r) (m*N r-N r) j) → ℝ) + (v : ℕ → Fin m → ℝ), + (∀ j i, u j i ∈ Set.Icc (1 : ℝ) 2) ∧ (∀ j a, v j a ∈ Set.Icc (1 : ℝ) 2) ∧ + (∀ j u' v', (∀ i, u' i ∈ Set.Icc (1 : ℝ) 2) → (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + rationalConstrainedObjective hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam j (u j) (v j) ≤ + rationalConstrainedObjective hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) μ lam j u' v') ∧ + ∀ᶠ j in atTop, L < (N r : ℝ)⁻¹* + (rationalRestrictedIncrement hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam u v j + (Real.log (spinGroupSlice (group r) (k r)).card-N r*Real.log 2)) := by + choose u v hu hv hmin using fun r => rational_constrained_minimizers_exist hhaar hgauss hm + (hN r) (spec r) (hspec r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) μ lam + obtain ⟨r,hr⟩ := magnetic_rational_increment_eventually_lower hhaar hgauss hpub hm + ρ lam hρ hsum hK hlam amax hmax μ N hN hNlim spec hsp hspec hρspec + group k hk γ mag hγ hγsum hcount hs hmag hc u v hu hv hmin L hL + exact ⟨r,u r,v r,hu r,hv r,hmin r,hr⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalMean.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b1ef966a2fff55b8d21f02511e826d81e902c00 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPhysicalMean.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticGeneralSpectrum +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureMean + +namespace OAI + +/-! The finite-field mean formula on the original probability space. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem physical_mean_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun i => c (group N i)) ∂P) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal) := by + let μ := fun N => P.map (U N) + let (N : ℕ) : IsProbabilityMeasure (μ N) := + (Measure.isProbabilityMeasure_map_iff (hU N).aemeasurable).mpr inferInstance + let (N : ℕ) : (μ N).IsMulRightInvariant := hHaar N + have hh := general_spectral_mean_field_pressure_tendsto hhaar hgauss hpub μ eig ν a b + hcompact hbound ha hb hno hweak group γ c hγ hγsum hgroup + apply hh.congr' + filter_upwards [eventually_ge_atTop 1] with N hN + exact physicalPressure_integral_map (by omega) P (U N) (hU N) (eig N) (fun i => c (group N i)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPopulationContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPopulationContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..e571b0f04a3869529927985762c1835153fa36b0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPopulationContinuity.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Core.FinitePopulationCoupling + +namespace OAI + +/-! Continuity in positive field populations, with the same finite field +alphabet and a bound independent of all optimizing parameters. -/ +noncomputable section +open Filter Set +open scoped BigOperators Topology +namespace InvariantIsing + +theorem finiteMagneticFunctional_population_le {A ι : Type*} + [Fintype A] [DecidableEq A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (γ δ b : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hδ : ∀ a, 0 < δ a) + (hγsum : ∑ a, γ a=1) (hδsum : ∑ a, δ a=1) + {ε D : ℝ} (hε : ε ≤ 1) (hdom : ∀ a, (1-ε)*γ a ≤ δ a) (hb : ∀ a, |b a| ≤ D) : + (finiteMagneticFunctional (finiteR ρ eig hρ hsum) γ b).toReal ≤ + (finiteMagneticFunctional (finiteR ρ eig hρ hsum) δ b).toReal+2*D*ε := by + have hh := finiteMagneticFunctional_transport_le ρ eig hρ hsum + (retainedPopulationCoupling γ δ ε) γ b δ b + (retainedPopulationCoupling_nonneg γ δ hε hγ hdom) hγ hδ hγsum hδsum + (retainedPopulationCoupling_row γ δ hγsum hδsum ε) + (retainedPopulationCoupling_col γ δ hγsum ε) + exact hh.trans (add_le_add le_rfl (retainedPopulationCoupling_cost γ δ b hγ hγsum hδsum hdom hb)) + +theorem finiteMagneticFunctional_tendsto_populations {A ι : Type*} + [Fintype A] [DecidableEq A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (γs : ℕ → A → ℝ) (γ b : A → ℝ) + (hγs : ∀ k a, 0 < γs k a) (hγssum : ∀ k, ∑ a, γs k a=1) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hlim : Tendsto γs atTop (𝓝 γ)) : + Tendsto (fun k => (finiteMagneticFunctional (finiteR ρ eig hρ hsum) (γs k) b).toReal) + atTop (𝓝 (finiteMagneticFunctional (finiteR ρ eig hρ hsum) γ b).toReal) := by + classical + let D := ∑ a, |b a| + have hD : 0 ≤ D := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hb a : |b a|≤D := Finset.single_le_sum (f := fun a => |b a|) (fun _ _ => abs_nonneg _) (Finset.mem_univ a) + apply Metric.tendsto_nhds.mpr + intro ε hε + let t := min (1/2 : ℝ) (ε/(4*(D+1))) + have ht : 0 < t := lt_min (by norm_num) (div_pos hε (by positivity)) + have ht1 : t ≤ 1 := (min_le_left _ _).trans (by norm_num) + have hleft : ∀ᶠ k in atTop, ∀ a, (1-t)*γ a ≤ γs k a := by + apply Filter.eventually_all.mpr + intro a + exact (((tendsto_pi_nhds.mp hlim) a).eventually + (Ioi_mem_nhds (by nlinarith [hγ a]))).mono (fun _ h => h.le) + have hright : ∀ᶠ k in atTop, ∀ a, (1-t)*γs k a ≤ γ a := by + apply Filter.eventually_all.mpr + intro a + exact ((((tendsto_pi_nhds.mp hlim) a).const_mul (1-t)).eventually + (Iio_mem_nhds (by nlinarith [hγ a]))).mono (fun _ h => h.le) + have hsmall : 2*D*t<ε := by + have hh : t*(4*(D+1))≤ε := (le_div_iff₀ (by positivity)).mp (min_le_right _ _) + nlinarith + filter_upwards [hleft,hright] with k hl hr + have h1 := finiteMagneticFunctional_population_le ρ eig hρ hsum γ (γs k) b + (fun a => (hγ a).le) (hγs k) hγsum (hγssum k) ht1 hl hb + have h2 := finiteMagneticFunctional_population_le ρ eig hρ hsum (γs k) γ b + (fun a => (hγs k a).le) hγ (hγssum k) hγsum ht1 hr hb + rw [Real.dist_eq,abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPopulationCoupling.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPopulationCoupling.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d18f773ffa66ba0ee3fd2ecfc88c0f82726015f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPopulationCoupling.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRealProfile +import Mathlib.Analysis.Convex.Jensen + +namespace OAI + +/-! Transporting a magnetization profile through a finite coupling of +field populations increases its grouped constrained entropy. -/ +noncomputable section +open Set +open scoped BigOperators +namespace InvariantIsing + +def transportedMagnetization {A B : Type*} [Fintype A] + (w : A → B → ℝ) (δ : B → ℝ) (mag : A → ℝ) (b : B) : ℝ := + (∑ a, w a b*mag a)/δ b + +lemma transportedMagnetization_radius {A B : Type*} [Fintype A] + (w : A → B → ℝ) (δ : B → ℝ) (mag : A → ℝ) + (hw : ∀ a b, 0 ≤ w a b) (hδ : ∀ b, 0 < δ b) (hcol : ∀ b, ∑ a, w a b=δ b) + {s : ℝ} (hm : ∀ a, |mag a| ≤ s) (b : B) : + |transportedMagnetization w δ mag b| ≤ s := by + rw [transportedMagnetization,abs_div,abs_of_pos (hδ b)] + apply (div_le_iff₀ (hδ b)).mpr + calc + |∑ a, w a b*mag a| ≤ ∑ a, |w a b*mag a| := Finset.abs_sum_le_sum_abs _ _ + _ = ∑ a, w a b*|mag a| := by simp_rw [abs_mul,abs_of_nonneg (hw _ _)] + _ ≤ ∑ a, w a b*s := Finset.sum_le_sum (fun a _ => mul_le_mul_of_nonneg_left (hm a) (hw a b)) + _ = s*δ b := by rw [← Finset.sum_mul,hcol,mul_comm] + +lemma transportedMagnetization_groupValue {A B : Type*} [Fintype A] [Fintype B] + (w : A → B → ℝ) (γ : A → ℝ) (δ : B → ℝ) (mag : A → ℝ) + (hw : ∀ a b, 0 ≤ w a b) (hδ : ∀ b, 0 < δ b) + (hrow : ∀ a, ∑ b, w a b=γ a) (hcol : ∀ b, ∑ a, w a b=δ b) + (hm : ∀ a, |mag a| ≤ 1) (h : FieldStep) : + magneticGroupValue γ mag h ≤ + magneticGroupValue δ (transportedMagnetization w δ mag) h := by + have hJ b : (∑ a, w a b*constrainedFieldValue h (mag a)) ≤ + δ b*constrainedFieldValue h (transportedMagnetization w δ mag b) := by + have hj := (concaveOn_constrainedFieldValue_magnetization h).le_map_sum + (t := Finset.univ) (w := fun a => w a b/δ b) (p := mag) + (fun a _ => div_nonneg (hw a b) (hδ b).le) + (by rw [← Finset.sum_div,hcol,div_self (hδ b).ne']) + (fun a _ => abs_le.mp (hm a)) + simp only [smul_eq_mul] at hj + have he : (∑ a, w a b/δ b*mag a)=transportedMagnetization w δ mag b := by + simp only [transportedMagnetization,Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + ring + rw [he] at hj + have hl : (∑ a, w a b/δ b*constrainedFieldValue h (mag a))= + (∑ a, w a b*constrainedFieldValue h (mag a))/δ b := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + ring + rw [hl] at hj + simpa only [mul_comm] using (div_le_iff₀ (hδ b)).mp hj + calc + magneticGroupValue γ mag h = ∑ a, ∑ b, w a b*constrainedFieldValue h (mag a) := by + simp_rw [magneticGroupValue,← Finset.sum_mul,hrow] + _ = ∑ b, ∑ a, w a b*constrainedFieldValue h (mag a) := Finset.sum_comm + _ ≤ _ := Finset.sum_le_sum (fun b _ => hJ b) + +lemma transportedMagnetization_variational {A B : Type*} [Fintype A] [Fintype B] + (R : ℝ → ℝ) (w : A → B → ℝ) (γ : A → ℝ) (δ : B → ℝ) (mag : A → ℝ) + (hw : ∀ a b, 0 ≤ w a b) (hδ : ∀ b, 0 < δ b) + (hrow : ∀ a, ∑ b, w a b=γ a) (hcol : ∀ b, ∑ a, w a b=δ b) + (hm : ∀ a, |mag a| ≤ 1) : + magneticVariationalFunctional R γ mag ≤ + magneticVariationalFunctional R δ (transportedMagnetization w δ mag) := by + apply iInf_mono + intro p + apply add_le_add _ le_rfl + apply iSup_mono + intro h + apply EReal.coe_le_coe + exact add_le_add (transportedMagnetization_groupValue w γ δ mag hw hδ hrow hcol hm h) le_rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPrefixComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPrefixComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a73ca96f19aa81b0bd1ce29394d216fffa7906e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticPrefixComparison.lean @@ -0,0 +1,121 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAdjacentCurvature +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareInitial + +namespace OAI + +/-! A common finite prefix preserves inverse-curvature order and the +associated conditional-square order up to the end of that prefix. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma positive_append (P L : List (ℝ × ℝ≥0)) + (hP : ∀ av ∈ P, 0 < av.1) (hL : ∀ av ∈ L, 0 < av.1) : + ∀ av ∈ P ++ L, 0 < av.1 := by + intro av hav + rcases List.mem_append.mp hav with hp | hl + · exact hP av hp + · exact hL av hl + +private lemma upper_append (P L : List (ℝ × ℝ≥0)) + (hP : ∀ av ∈ P, av.1 ≤ 1) (hL : ∀ av ∈ L, av.1 ≤ 1) : + ∀ av ∈ P ++ L, av.1 ≤ 1 := by + intro av hav + rcases List.mem_append.mp hav with hp | hl + · exact hP av hp + · exact hL av hl + +theorem magneticClosedCurvature_append_mono (P L M : List (ℝ × ℝ≥0)) + (hP : ∀ av ∈ P, 0 < av.1) (hP1 : ∀ av ∈ P, av.1 ≤ 1) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (hM : ∀ av ∈ M, 0 < av.1) (hM1 : ∀ av ∈ M, av.1 ≤ 1) + (hinit : ∀ u ∈ Icc (-1 : ℝ) 1, + closedMagneticScalarCurvature L hL 0 (0, u) ≤ + closedMagneticScalarCurvature M hM 0 (0, u)) + {ζ v s : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature (P ++ L) (positive_append P L hP hL) ζ (v, s) ≤ + closedMagneticScalarCurvature (P ++ M) (positive_append P M hP hM) ζ (v, s) := by + induction P generalizing ζ v s with + | nil => + apply magneticClosedCurvature_compare_initial L M hL hM hL1 hM1 hζ le_rfl hζ1 ?_ hv hs + intro u hu + rw [closedMagneticScalarCurvature_initial L hL ζ 0 u, + closedMagneticScalarCurvature_initial M hM ζ 0 u] + exact hinit u hu + | cons av P ih => + apply magneticClosedCurvature_compare_initial (av :: P ++ L) (av :: P ++ M) + (positive_append _ _ hP hL) (positive_append _ _ hP hM) + (upper_append _ _ hP1 hL1) (upper_append _ _ hP1 hM1) hζ le_rfl hζ1 ?_ hv hs + intro u hu + simp only [List.cons_append] + rw [closedMagneticScalarCurvature_cons_initial, + closedMagneticScalarCurvature_cons_initial] + exact ih (fun bv hb => hP bv (List.mem_cons_of_mem av hb)) + (fun bv hb => hP1 bv (List.mem_cons_of_mem av hb)) + (hP av List.mem_cons_self).le (hP1 av List.mem_cons_self) av.2.property hu + +theorem magneticClosedSquare_append_mono (P L M : List (ℝ × ℝ≥0)) + (hP : ∀ av ∈ P, 0 < av.1) (hP1 : ∀ av ∈ P, av.1 ≤ 1) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (hM : ∀ av ∈ M, 0 < av.1) (hM1 : ∀ av ∈ M, av.1 ≤ 1) + (hinit : ∀ u ∈ Icc (-1 : ℝ) 1, + closedMagneticScalarCurvature L hL 0 (0, u) ≤ + closedMagneticScalarCurvature M hM 0 (0, u)) + (i : ℕ) (hi : i ≤ P.length) {ζ v s : ℝ} + (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticContinuation (P ++ L) + (magneticScalarSquareFourJet (P ++ L) (positive_append P L hP hL) + ⟨i, by simp only [List.length_append]; omega⟩).toMagneticContinuationJet ζ (v, s) ≤ + closedMagneticContinuation (P ++ M) + (magneticScalarSquareFourJet (P ++ M) (positive_append P M hP hM) + ⟨i, by simp only [List.length_append]; omega⟩).toMagneticContinuationJet ζ (v, s) := by + induction P generalizing i ζ v s with + | nil => + have hi0 : i = 0 := by simpa using hi + subst i + apply magneticClosedSquare_compare_initial L M hL hM hL1 hM1 0 0 hζ hζ1 ?_ ?_ hv hs + · intro u hu + rw [closedMagneticScalarCurvature_initial L hL ζ 0 u, + closedMagneticScalarCurvature_initial M hM ζ 0 u] + exact hinit u hu + · intro u hu + rw [closedMagneticSquareContinuation_zero_initial L hL hζ hu, + closedMagneticSquareContinuation_zero_initial M hM hζ hu] + | cons av P ih => + apply magneticClosedSquare_compare_initial (av :: P ++ L) (av :: P ++ M) + (positive_append _ _ hP hL) (positive_append _ _ hP hM) + (upper_append _ _ hP1 hL1) (upper_append _ _ hP1 hM1) _ _ hζ hζ1 ?_ ?_ hv hs + · intro u hu + exact magneticClosedCurvature_append_mono (av :: P) L M hP hP1 hL hL1 hM hM1 + hinit hζ hζ1 (le_refl 0) hu + · intro u hu + simp only [List.cons_append] + cases i with + | zero => + exact (closedMagneticSquareContinuation_zero_initial (av :: P ++ L) + (positive_append _ _ hP hL) hζ hu).le.trans + (closedMagneticSquareContinuation_zero_initial (av :: P ++ M) + (positive_append _ _ hP hM) hζ hu).ge + | succ i => + have hiP : i ≤ P.length := by simpa only [List.length_cons] using Nat.le_of_succ_le_succ hi + have heL : (⟨i + 1, by simp only [List.length_cons, List.length_append]; omega⟩ : + Fin ((av :: P ++ L).length + 1)) = + (⟨i, by simp only [List.length_append]; omega⟩ : Fin ((P ++ L).length + 1)).succ := rfl + have heM : (⟨i + 1, by simp only [List.length_cons, List.length_append]; omega⟩ : + Fin ((av :: P ++ M).length + 1)) = + (⟨i, by simp only [List.length_append]; omega⟩ : Fin ((P ++ M).length + 1)).succ := rfl + rw [heL, heM, closedMagneticSquareContinuation_cons_initial, + closedMagneticSquareContinuation_cons_initial] + exact ih (fun bv hb => hP bv (List.mem_cons_of_mem av hb)) + (fun bv hb => hP1 bv (List.mem_cons_of_mem av hb)) i hiP + (hP av List.mem_cons_self).le (hP1 av List.mem_cons_self) av.2.property hu + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRadialHessian.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRadialHessian.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a15b0de2be67c12972086654bb10fa86e2c21ae --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRadialHessian.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldRadial +import OAI.Probability.InvariantIsing.Magnetic.MagneticLevelDerivative +import OAI.Probability.InvariantIsing.Fields.FieldHeightRadialHessian + +namespace OAI + +/-! The radial row sign of the constrained height Hessian, obtained from +the actual fixed-magnetization radial comparison. -/ + +noncomputable section +open Set Filter +open scoped BigOperators NNReal Topology + +namespace InvariantIsing + +lemma magneticFieldLevel_congr {h k : FieldStep} (he : h = k) (s : ℝ) + (i : Fin (h.depth + 1)) (j : Fin (k.depth + 1)) (hij : i.val = j.val) : + magneticFieldLevel h s i = magneticFieldLevel k s j := by + cases he + have hi : i = j := Fin.ext hij + subst j + rfl + +theorem magneticHeight_radial_hessian_nonpos (h : FieldStep) + {I : Set (Fin (h.depth + 1) → ℝ)} (F : FieldFiniteFamily (h.depth + 1) I) + (hI : IsOpen I) (hU : F.U = fieldFiniteValue (fieldHeightFiniteList h)) + {s : ℝ} (hs : |s| < 1) (r : Fin (h.depth + 1) → ℝ) + (hr : r ∈ I) (hrs : r ∈ fieldStrictHeightCone h.depth) (i : Fin (h.depth + 1)) : + ∑ j, magneticHeightSchur h F s r i j * r j ≤ 0 := by + let k := fieldStepOfStrictHeights h r hrs + let c : ℝ → ℝ≥0 := fun t => ⟨Real.sqrt (Real.exp t), Real.sqrt_nonneg _⟩ + let g := fun t : ℝ => magneticFieldLevel (fieldScaleCovariance k (c t)) s i + have hcpos (t : ℝ) : 0 < c t := Real.sqrt_pos.2 (Real.exp_pos t) + have hg : Monotone g := by + intro a b hab + have hc : c a ≤ c b := Real.sqrt_le_sqrt (Real.exp_le_exp.mpr hab) + exact magneticFieldLevel_radial k (hcpos a) hc i hs + have he : g = fun t : ℝ => magneticHeightLevel h s (r + (Real.exp t - 1) • r) i := by + funext t + have hvec : r + (Real.exp t - 1) • r = Real.exp t • r := by module + have htR : r + (Real.exp t - 1) • r ∈ fieldStrictHeightCone h.depth := by + rw [hvec] + exact fieldStrictHeightCone_smul hrs (Real.exp_pos t) + have hsq : (c t : ℝ) ^ 2 = Real.exp t := Real.sq_sqrt (Real.exp_pos t).le + have heq : r + (Real.exp t - 1) • r = fun j => (c t : ℝ) ^ 2 * r j := by + rw [hvec] + funext j + change Real.exp t * r j = (c t : ℝ) ^ 2 * r j + rw [hsq] + have hk : fieldStepOfStrictHeights h (r + (Real.exp t - 1) • r) htR = + fieldScaleCovariance k (c t) := by + unfold fieldStepOfStrictHeights fieldWithHeights fieldScaleCovariance k + congr 1 + rw [magneticHeightLevel, dite_eq_left htR] + exact (magneticFieldLevel_congr hk s i i rfl).symm + have hd := hasDerivAt_magneticHeightLevel_line h F hI hU hs r r hr hrs i + have hq : HasDerivAt (fun t : ℝ => Real.exp t - 1) 1 0 := by + simpa only [Real.exp_zero] using (Real.hasDerivAt_exp 0).sub_const 1 + have hd' : HasDerivAt (fun t : ℝ => magneticHeightLevel h s (r + t • r) i) + ((-2 / (h.cut i.succ - h.cut i.castSucc)) * + (∑ j, magneticHeightSchur h F s r i j * r j)) (Real.exp 0 - 1) := by + simpa only [Real.exp_zero, sub_self] using hd + have ht := hd'.comp 0 hq + have hp : 0 ≤ (-2 / (h.cut i.succ - h.cut i.castSucc)) * + (∑ j, magneticHeightSchur h F s r i j * r j) := by + have hder : HasDerivAt g + ((-2 / (h.cut i.succ - h.cut i.castSucc)) * + (∑ j, magneticHeightSchur h F s r i j * r j)) 0 := by + simpa only [he, Function.comp_def, mul_one] using ht + exact hder.nonneg_of_monotone hg + have hw : 0 < h.cut i.succ - h.cut i.castSucc := + sub_pos.mpr (h.ordered_cut i.castSucc_lt_succ) + have hn : -2 / (h.cut i.succ - h.cut i.castSucc) < 0 := + div_neg_of_neg_of_pos (by norm_num) hw + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalBlockLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalBlockLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..22084240ec66bb96d30fec967c69b92748b82753 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalBlockLower.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Cavity.ConsecutiveRationalConsistency +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockDiagonalLower + +namespace OAI + +/-! Actual rational-spectrum block laws supply the diagonal magnetic trial lower bound. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem magnetic_rational_block_diagonal_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) : + ∃ (base : ℕ → OverlapPath) (d φ : ℕ → ℕ), StrictMono d ∧ StrictMono φ ∧ + ∀ ε > 0, ∀ᶠ r in atTop, + (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal-ε ≤ constrainedBlockValue (spinGroupSlice (group (φ r)) (k (φ r))) + (cavityStrictUniformField ρ lam hρ hsum (base (φ r)) (d (φ r)))+ + fieldPairing (cavityStrictUniformPath (base (φ r)) (d (φ r))) + (cavityStrictUniformField ρ lam hρ hsum (base (φ r)) (d (φ r)))/2+ + spectralFunctional (finiteR ρ lam hρ hsum) + (cavityStrictUniformPath (base (φ r)) (d (φ r))) := by + have htests (r : ℕ) : ∃ p : OverlapPath, ∀ Φ : ℝ →ᵇ ℝ, + Tendsto (fun j => ∫ t, Φ (cavityStrictUniformPath p j t)* + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField ρ lam hρ hsum p j) t-cavityStrictUniformPath p j t) + ∂pathMeasure) atTop (𝓝 0) := by + have he : (fun a => (spec r a : ℝ)/(N r : ℝ))=ρ := by + funext a + rw [hρspec r a,mul_div_cancel_left₀ _ (Nat.cast_ne_zero.mpr (hN r).ne')] + have hh := consecutive_rational_weak_self_consistency hhaar hgauss hpub hm (hN r) + (spec r) (hsp r) (hspec r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) μ lam amax hmax + simpa only [he] using hh + choose base hb using htests + obtain ⟨d,φ,hd,hφ,hlower⟩ := magnetic_block_diagonal_trial_lower + ρ lam hρ hsum hK hlam N hN hNlim group k hk γ mag hγ hγsum hcount hs hmag hc base hb + exact ⟨base,d,φ,hd,hφ,hlower⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalCover.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b43664e2cfd4b0f0fe2336ff4fc96b44cf6b941 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalCover.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariational +import Mathlib.Topology.Compactness.Compact + +namespace OAI + +/-! Every bounded magnetization profile is close to one of finitely many +rational interior profiles, including profiles at the boundary. -/ +noncomputable section +open Set +open scoped Topology +namespace InvariantIsing + +lemma exists_interior_rat_close {x δ : ℝ} (hx : |x|≤1) (hδ : 0<δ) : + ∃ q : ℚ, |(q:ℝ)|<1 ∧ |x-(q:ℝ)|<δ := by + have hl : max (-1:ℝ) (x-δ) < min 1 (x+δ) := by + rw [max_lt_iff,lt_min_iff,lt_min_iff] + constructor <;> constructor <;> linarith [(abs_le.mp hx).1,(abs_le.mp hx).2] + obtain ⟨q,hq₁,hq₂⟩ := exists_rat_btwn hl + refine ⟨q, abs_lt.mpr ⟨(le_max_left _ _).trans_lt hq₁, + hq₂.trans_le (min_le_left _ _)⟩,?_⟩ + apply abs_lt.mpr + constructor + · have := hq₂.trans_le (min_le_right _ _) + linarith + · have := (le_max_right _ _).trans_lt hq₁ + linarith + +lemma finite_rational_magnetization_cover {A : Type*} [Fintype A] + {δ : ℝ} (hδ : 0<δ) : + ∃ Q : Finset (RationalMagnetization A), Q.Nonempty ∧ + ∀ x : A → ℝ, (∀ a, |x a|≤1) → + ∃ q∈Q, ∀ a, |x a-(q.val a:ℝ)|<δ := by + classical + let K : Set (A → ℝ) := Set.pi Set.univ (fun _ => Icc (-1:ℝ) 1) + have hK : IsCompact K := by + simpa only [K, Set.pi, Set.mem_univ, forall_const] using + (isCompact_pi_infinite (s := fun _ : A => Icc (-1:ℝ) 1) (fun _ => isCompact_Icc)) + let U : RationalMagnetization A → Set (A → ℝ) := + fun q => {x | ∀ a, |x a-(q.val a:ℝ)|<δ} + have ho (q : RationalMagnetization A) : IsOpen (U q) := by + change IsOpen {x : A → ℝ | ∀ a, |x a-(q.val a:ℝ)|<δ} + simp only [ofPred_forall] + exact isOpen_iInter_of_finite (fun a => isOpen_lt ((continuous_apply a).sub continuous_const).abs continuous_const) + have hcover : K ⊆ ⋃ q, U q := by + intro x hx + have hx' a : |x a|≤1 := abs_le.mpr (hx a (mem_univ a)) + choose q hq hd using fun a => exists_interior_rat_close (hx' a) hδ + exact mem_iUnion.mpr ⟨(⟨q,hq⟩ : RationalMagnetization A),hd⟩ + obtain ⟨Q,hQ⟩ := hK.elim_finite_subcover U ho hcover + have hzero : (fun _ : A => (0:ℝ))∈K := by intro a _; constructor <;> norm_num + have hne : Q.Nonempty := by + obtain ⟨q,hq⟩ := mem_iUnion.mp (hQ hzero) + obtain ⟨hq,_⟩ := mem_iUnion.mp hq + exact ⟨q,hq⟩ + refine ⟨Q,hne,?_⟩ + intro x hx + have hxK : x∈K := by intro a _; exact abs_le.mp (hx a) + obtain ⟨q,hq⟩ := mem_iUnion.mp (hQ hxK) + obtain ⟨hq,hxq⟩ := mem_iUnion.mp hq + exact ⟨q,hq,hxq⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalIncrementLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalIncrementLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..13dd842029b2ff8b0c9bf1437e0415215f9bb5b7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalIncrementLower.lean @@ -0,0 +1,111 @@ +import OAI.Probability.InvariantIsing.Cavity.ConsecutiveRationalSubsequenceTrial +import OAI.Probability.InvariantIsing.Magnetic.MagneticTrialBarrier + +namespace OAI + +/-! A physical constrained block has eventually large cavity increments whenever +the proposed pressure level is below the magnetic variational value. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +def rationalConstrainedObjective {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (spec : Fin m → ℕ) (hspec : ∑ a, spec a=n) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (μ : (M : ℕ) → Measure (Orthogonal M)) (lam : Fin m → ℝ) (j : ℕ) + (u : Fin (cavityRationalSize n (m*n-n) j) → ℝ) (v : Fin m → ℝ) : ℝ := + let M := cavityRationalSize n (m*n-n) j + let g := cavityRationalLabel (by omega : 0 < m) spec hspec M + priorPerturbationObjective (cavityOrientedBaseLaw (by + have := cavityRationalSize_ge_three n (m*n-n) j hn; omega) (μ M)) + (restrictedZeroTreePrior (consecutiveBlockConstraint n (j+(m*n-n+n+3)) Cset) + (consecutiveBlockConstraint_nonempty Cset hCset)) + (fun i => lam (g i)) (fun _ => 0) (cavitySpectralGroup g) 1 (fun _ => 0) u v + +theorem magnetic_rational_increment_eventually_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (spec : ℕ → Fin m → ℕ) (hsp : ∀ r a, 0 < spec r a) (hspec : ∀ r, ∑ a, spec r a=N r) + (hρspec : ∀ r a, (spec r a : ℝ)=(N r : ℝ)*ρ a) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (u : (r j : ℕ) → Fin (cavityRationalSize (N r) (m*N r-N r) j) → ℝ) + (v : ℕ → ℕ → Fin m → ℝ) + (hu : ∀ r j i, u r j i ∈ Set.Icc (1 : ℝ) 2) + (hv : ∀ r j a, v r j a ∈ Set.Icc (1 : ℝ) 2) + (hmin : ∀ r j u' v', (∀ i, u' i ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + rationalConstrainedObjective hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam j (u r j) (v r j) ≤ + rationalConstrainedObjective hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) μ lam j u' v') + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ᶠ j in atTop, L < (N r : ℝ)⁻¹* + (rationalRestrictedIncrement hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam (u r) (v r) j + + (Real.log (spinGroupSlice (group r) (k r)).card-N r*Real.log 2)) := by + let Δ := fun r j => (N r : ℝ)⁻¹* + (rationalRestrictedIncrement hm (hN r) (spec r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam (u r) (v r) j + (Real.log (spinGroupSlice (group r) (k r)).card-N r*Real.log 2)) + change ∃ r, ∀ᶠ j in atTop, L < Δ r j + by_contra hnone + have hbad r : ∃ ι : ℕ → ℕ, StrictMono ι ∧ ∀ j, Δ r (ι j) ≤ L := by + have hn : ¬∀ᶠ j in atTop, L < Δ r j := fun h => hnone ⟨r,h⟩ + have hf : ∃ᶠ j in atTop, ¬L < Δ r j := by + simpa only [Filter.Frequently, not_not] using hn + obtain ⟨ι,hι,hb⟩ := extraction_of_frequently_atTop hf + exact ⟨ι,hι,fun j => not_lt.mp (hb j)⟩ + choose ι hι hbad using hbad + have hpaths r : ∃ p : OverlapPath, + (∀ Φ : ℝ →ᵇ ℝ, Tendsto (fun j => ∫ t, Φ (cavityStrictUniformPath p j t)* + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField ρ lam hρ hsum p j) t-cavityStrictUniformPath p j t) + ∂pathMeasure) atTop (𝓝 0)) ∧ + ∀ ε > 0, ∀ᶠ j in atTop, + constrainedBlockValue (spinGroupSlice (group r) (k r)) (cavityStrictUniformField ρ lam hρ hsum p j)+ + fieldPairing (cavityStrictUniformPath p j) (cavityStrictUniformField ρ lam hρ hsum p j)/2+ + spectralFunctional (finiteR ρ lam hρ hsum) (cavityStrictUniformPath p j) ≤ L+ε := by + have he : (fun a => (spec r a : ℝ)/(N r : ℝ))=ρ := by + funext a + rw [hρspec r a, mul_div_cancel_left₀ _ (Nat.cast_ne_zero.mpr (hN r).ne')] + have hR : finiteR (fun a => (spec r a : ℝ)/(N r : ℝ)) lam + (cavityRationalMass_positive (spec r) (hsp r) (hN r)) + (cavityRationalMass_sum (spec r) (hspec r) (hN r)) = finiteR ρ lam hρ hsum := by + subst ρ + rfl + obtain ⟨p,φ,hφ,hself,htrial⟩ := consecutive_rational_subsequence_trial_witness + hhaar hgauss hpub hm (hN r) (spec r) (hsp r) (hspec r) + (spinGroupSlice (group r) (k r)) (spinGroupSlice_nonempty (group r) (k r) (hk r)) + μ lam amax hmax (ι r) (hι r) (u r) (v r) (hu r) (hv r) (hmin r) + simp only [hR, he] at hself htrial + refine ⟨p,hself,?_⟩ + intro ε hε + filter_upwards [htrial ε hε] with j hj + have hb := hbad r (φ j) + dsimp only [Δ] at hb + linarith + choose base htest hupper using hpaths + exact (not_le_of_gt hL) (magnetic_trial_barrier ρ lam hρ hsum hK hlam N hN hNlim + group k hk γ mag hγ hγsum hcount hs hmag hc base htest L hupper) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalTemplateLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalTemplateLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a750e15a298528dd2afa879516b49d8093a16a0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRationalTemplateLower.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticTemplateFullLower +import OAI.Probability.InvariantIsing.Magnetic.RationalMagnetizationCounts + +namespace OAI + +/-! Every rational interior profile is admissible after a finite common +denominator repetition of a spectral and field template. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_rational_template_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin n → A) (γ : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=n*γ a) + (mag : RationalMagnetization A) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ + (fun a => (mag.val a : ℝ))).toReal) : + ∀ ε > 0, ∀ᶠ M in atTop, L+(∑ a, γ a*b a*(mag.val a : ℝ))-ε ≤ + ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M := by + obtain ⟨d,hd,k,hk,hkc⟩ := rational_magnetization_counts (spinGroupSize group) mag + obtain ⟨s,hs,hmags,_⟩ := exists_uniform_magnetization_radius + (fun _ : ℕ => fun a => (mag.val a : ℝ)) (fun a => (mag.val a : ℝ)) + tendsto_const_nhds mag.property + have hcount' := consecutiveSiteGroup_proportion (K := d) group γ hcount + have hspec' : ∑ a, d*spec a=d*n := by rw [← Finset.mul_sum,hspec] + have hρspec' a : (d*spec a : ℕ)=(d*n : ℕ)*ρ a := by + rw [Nat.cast_mul,Nat.cast_mul,hρspec] + ring + exact magnetic_template_full_pressure_lower hhaar hgauss hpub hm (Nat.mul_pos hd hn) + ρ lam hρ hsum hK hlam amax hmax μ (fun a => d*spec a) + (fun a => Nat.mul_pos hd (hsp a)) hspec' hρspec' e he + (consecutiveSiteGroup d group) k + (by simpa only [consecutiveSiteGroup_size] using hk) γ (fun a => (mag.val a : ℝ)) + hγ hγsum hcount' hs hmags + (by simpa only [consecutiveSiteGroup_size,Nat.cast_mul] using hkc) + g b hg hD hb L hL + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRealProfile.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRealProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..d20f115220779fb37bf44f0c7e59ee2c7ca62567 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRealProfile.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticInwardApproximation +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalContinuity + +namespace OAI + +/-! The rational supremum also dominates every real interior profile. +Approximation toward zero only increases its constrained entropy. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma finiteMagneticFunctional_real_profile {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (γ b mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a| < 1) : + (∑ a, γ a*b a*mag a)+ + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal ≤ + (finiteMagneticFunctional (finiteR ρ eig hρ hsum) γ b).toReal := by + classical + let R := finiteR ρ eig hρ hsum + let V := fun s => (magneticVariationalFunctional R γ s).toReal + let F := (finiteMagneticFunctional R γ b).toReal + let C := ∑ a, γ a* |b a| + have hC : 0 ≤ C := Finset.sum_nonneg (fun a _ => mul_nonneg (hγ a) (abs_nonneg _)) + have hv := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum γ mag hγ hγsum + (fun a => (hmag a).le) + have hr := finiteVariational_ne_top_bot ρ eig hρ hsum + have hf := finiteMagneticFunctional_ne_top_bot R γ b hγ hγsum hr.1 hr.2 + by_contra hnot + let gap := (∑ a, γ a*b a*mag a)+V mag-F + have hgap : 0 < gap := sub_pos.mpr (lt_of_not_ge hnot) + let δ := gap/(2*(C+1)) + have hδ : 0 < δ := div_pos hgap (by positivity) + choose q hqabs hq hclose using fun a => exists_inward_rat_close (hmag a) hδ + let qm : RationalMagnetization A := ⟨q,hq⟩ + have hqv := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum γ + (fun a => (q a : ℝ)) hγ hγsum (fun a => (hq a).le) + have hmono := magneticVariational_inward_mono R γ (fun a => (q a : ℝ)) mag hγ hmag hqabs + rw [← EReal.coe_toReal hv.1 hv.2,← EReal.coe_toReal hqv.1 hqv.2] at hmono + have hV : V mag ≤ V (fun a => (q a : ℝ)) := EReal.coe_le_coe_iff.mp hmono + have hsup := le_iSup (fun t : RationalMagnetization A => + ((∑ a, γ a*b a*(t.val a : ℝ) : ℝ) : EReal)+ + magneticVariationalFunctional R γ (fun a => (t.val a : ℝ))) qm + change ((∑ a, γ a*b a*(q a : ℝ) : ℝ) : EReal)+ + magneticVariationalFunctional R γ (fun a => (q a : ℝ)) ≤ finiteMagneticFunctional R γ b at hsup + rw [← EReal.coe_toReal hqv.1 hqv.2,← EReal.coe_add,← EReal.coe_toReal hf.1 hf.2] at hsup + have hsup' : (∑ a, γ a*b a*(q a : ℝ))+V (fun a => (q a : ℝ)) ≤ F := + EReal.coe_le_coe_iff.mp hsup + have hdiff : (∑ a, γ a*b a*mag a)-(∑ a, γ a*b a*(q a : ℝ)) ≤ C*δ := by + rw [← Finset.sum_sub_distrib,show C*δ=∑ a, γ a* |b a| * δ by rw [Finset.sum_mul]] + apply Finset.sum_le_sum + intro a _ + calc + _ = γ a*b a*(mag a-(q a : ℝ)) := by ring + _ ≤ |γ a*b a*(mag a-(q a : ℝ))| := le_abs_self _ + _ = γ a* |b a| * |mag a-(q a : ℝ)| := by rw [abs_mul,abs_mul,abs_of_nonneg (hγ a)] + _ ≤ _ := mul_le_mul_of_nonneg_left (hclose a).le (mul_nonneg (hγ a) (abs_nonneg _)) + have hδeq : δ*(2*(C+1))=gap := div_mul_cancel₀ _ (by positivity) + have hsmall : C*δ Real.log (Real.cosh z)) + Real.tanh (i.val + 1) b = magneticLevelAtBias h b i := by + rw [fieldScalarSquareAt_eq (fieldAllIncrements h) _ _ + ⟨i.val + 1, by rw [fieldAllIncrements_length]; omega⟩] + exact (magneticLevelAtBias_allSquares h b i).symm + +lemma magneticLevelAtBias_insertCut (h : FieldStep) (i : Fin (h.depth + 1)) (c : ℝ) + (hc₀ : h.cut i.castSucc < c) (hc₁ : c < h.cut i.succ) (b : ℝ) + (j : Fin (h.depth + 2)) : + magneticLevelAtBias (fieldInsertCut h i c hc₀ hc₁) b j = + magneticLevelAtBias h b (fieldSplitIndex i j) := by + apply (fieldScalarSquareAt_magneticLevel (fieldInsertCut h i c hc₀ hc₁) b j).symm.trans + rw [fieldAllIncrements_insertCut, fieldScalarSquareAt_insert_zero] + have hp : ((fieldAllIncrements h).take (i.val + 1)).length = i.val + 1 := by + rw [List.length_take, fieldAllIncrements_length, Nat.min_eq_left (by omega)] + rw [hp, List.take_append_drop] + rw [← fieldScalarSquareAt_magneticLevel] + by_cases hj : j.val ≤ i.val + · rw [ite_eq_left (show j.val + 1 ≤ i.val + 1 by omega)] + simp only [fieldSplitIndex, hj, dite_true] + · rw [ite_eq_right (show ¬j.val + 1 ≤ i.val + 1 by omega)] + simp only [fieldSplitIndex, hj, dite_false] + have hj0 : 0 < j.val := by omega + congr 2 + omega + +lemma magneticFieldLevel_insertCut (h : FieldStep) (i : Fin (h.depth + 1)) (c : ℝ) + (hc₀ : h.cut i.castSucc < c) (hc₁ : c < h.cut i.succ) (s : ℝ) + (j : Fin (h.depth + 2)) : + magneticFieldLevel (fieldInsertCut h i c hc₀ hc₁) s j = + magneticFieldLevel h s (fieldSplitIndex i j) := by + have hr : FieldRefines h (fieldInsertCut h i c hc₀ hc₁) := + FieldRefines.insert (FieldRefines.refl h) i c hc₀ hc₁ + unfold magneticFieldLevel + rw [hr.magneticBias, magneticLevelAtBias_insertCut] + +lemma magneticFieldPath_on_cell (h : FieldStep) (s : ℝ) (i : Fin (h.depth + 1)) + {t : ℝ} (ht : t ∈ Set.Ioo (h.cut i.castSucc) (h.cut i.succ)) : + magneticFieldPath h s t = magneticFieldLevel h s i := + fieldLevelPath_on_cell h _ _ _ i ht + +lemma magneticFieldPath_insertCut_ae (h : FieldStep) (i : Fin (h.depth + 1)) (c : ℝ) + (hc₀ : h.cut i.castSucc < c) (hc₁ : c < h.cut i.succ) (s : ℝ) : + (magneticFieldPath (fieldInsertCut h i c hc₀ hc₁) s).val =ᵐ[pathMeasure] + (magneticFieldPath h s).val := by + filter_upwards [ae_finite_overlap_cell (fieldInsertCut h i c hc₀ hc₁).cut + (fieldInsertCut h i c hc₀ hc₁).first (fieldInsertCut h i c hc₀ hc₁).last] with t ht + obtain ⟨j, hj⟩ := ht + have hi := fieldInsertCut_cell_subset h i c hc₀ hc₁ j hj + rw [magneticFieldPath_on_cell _ s j hj, + magneticFieldPath_on_cell h s (fieldSplitIndex i j) hi] + exact magneticFieldLevel_insertCut h i c hc₀ hc₁ s j + +lemma FieldRefines.magneticPath_ae {h k : FieldStep} (hk : FieldRefines h k) (s : ℝ) : + (magneticFieldPath k s).val =ᵐ[pathMeasure] (magneticFieldPath h s).val := by + induction hk with + | refl => exact Filter.EventuallyEq.rfl + | insert hk i c hc₀ hc₁ ih => + exact (magneticFieldPath_insertCut_ae _ i c hc₀ hc₁ s).trans ih + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRelativeFourth.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRelativeFourth.lean new file mode 100644 index 0000000000000000000000000000000000000000..198b6ae4a98196cc98ca3224e9ddc02d27470527 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRelativeFourth.lean @@ -0,0 +1,139 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFourthCumulant + +namespace OAI + +/-! A relative fourth-derivative bound, uniform in the spatial bias. +The centered fourth cumulant costs only one spin variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magnetic_relative_centered_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {M Q A : ℝ → ℝ} (hM : Measurable M) (hQ : Measurable Q) (hA : Measurable A) + (bM : ∀ x, |M x| ≤ 1) {B C : ℝ} (bQ : ∀ x, |Q x| ≤ B) + (bA : ∀ x, |A x| ≤ C * Q x) : + |(∫ x, A x * M x ∂μ) - (∫ x, A x ∂μ) * (∫ x, M x ∂μ)| ≤ + 2 * C * ∫ x, Q x ∂μ := by + let m := ∫ x, M x ∂μ + have hiQ : Integrable Q μ := Integrable.of_bound hQ.aestronglyMeasurable B + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bQ x) + have hiA : Integrable A μ := (hiQ.const_mul C).mono' hA.aestronglyMeasurable + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bA x) + have hiAM : Integrable (fun x => A x * M x) μ := hiA.mul_bdd hM.aestronglyMeasurable + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bM x) + have he : (∫ x, A x * M x ∂μ) - (∫ x, A x ∂μ) * m = + ∫ x, A x * (M x - m) ∂μ := by + rw [show (fun x => A x * (M x - m)) = fun x => A x * M x - A x * m by + funext x; ring, integral_sub hiAM (hiA.mul_const m), integral_mul_const] + have hi : Integrable (fun x => A x * (M x - m)) μ := by + convert hiAM.sub (hiA.mul_const m) using 1 + funext x + change A x * (M x - m) = A x * M x - A x * m + ring + change |(∫ x, A x * M x ∂μ) - (∫ x, A x ∂μ) * m| ≤ _ + rw [he] + calc + _ ≤ ∫ x, |A x * (M x - m)| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ x, (2 * C) * Q x ∂μ := by + apply integral_mono hi.abs (hiQ.const_mul _) + intro x + change |A x * (M x - m)| ≤ 2 * C * Q x + rw [abs_mul] + calc + _ ≤ |A x| * 2 := mul_le_mul_of_nonneg_left + (magnetic_centered_spin_bound μ bM x) (abs_nonneg _) + _ ≤ (C * Q x) * 2 := mul_le_mul_of_nonneg_right (bA x) (by norm_num) + _ = _ := by ring + _ = _ := integral_const_mul _ _ + +private lemma magnetic_abs_five (a b c d e : ℝ) : + |a + b + c + d + e| ≤ |a| + |b| + |c| + |d| + |e| := by + have h1 := abs_add_le a b + have h2 := abs_add_le (a + b) c + have h3 := abs_add_le (a + b + c) d + have h4 := abs_add_le (a + b + c + d) e + linarith + +theorem fieldFourthTransform_relative_bound {ζ : ℝ} (hζ : 0 ≤ ζ) (v : ℝ≥0) + {F M Q R S : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) (hS : Measurable S) + (bM : ∀ x, |M x| ≤ 1) (hQpos : ∀ x, 0 ≤ Q x) (hQle : ∀ x, Q x ≤ 1) + {C D : ℝ} (hC : 0 ≤ C) (hD : 0 ≤ D) + (bR : ∀ x, |R x| ≤ C * Q x) (bS : ∀ x, |S x| ≤ D * Q x) (z : ℝ) : + |fieldFourthTransform ζ v F M Q R S z| ≤ + (D + 8 * ζ * C + 3 * ζ + 37 * ζ ^ 2) * fieldCurvatureTransform ζ v F M Q z := by + let μ := (gaussianReal z v).tilted (fun x => ζ * F x) + have : IsProbabilityMeasure μ := isProbabilityMeasure_tilted + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG ζ) + let T := fun A : ℝ → ℝ => ∫ x, A x ∂μ + let m := T M + let q := T Q + let V := T (fun x => (M x - m) ^ 2) + let rc := T (fun x => R x * M x) - T R * m + let qv := T (fun x => (Q x) ^ 2) - q ^ 2 + let qc := T (fun x => Q x * (M x - m) ^ 2) - q * V + let mc := T (fun x => (M x - m) ^ 4) - 3 * V ^ 2 + have bQ : ∀ x, |Q x| ≤ 1 := fun x => by rw [abs_of_nonneg (hQpos x)]; exact hQle x + have bRb : ∀ x, |R x| ≤ C := fun x => (bR x).trans + (mul_le_of_le_one_right hC (hQle x)) + have hiQ : Integrable Q μ := Integrable.of_bound hQ.aestronglyMeasurable 1 + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bQ x) + have hiS : Integrable S μ := (hiQ.const_mul D).mono' hS.aestronglyMeasurable + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bS x) + have hSb : |T S| ≤ D * q := by + calc + _ ≤ ∫ x, |S x| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ x, D * Q x ∂μ := integral_mono hiS.abs (hiQ.const_mul D) bS + _ = _ := integral_const_mul _ _ + have hrc : |rc| ≤ 2 * C * q := magnetic_relative_centered_bound μ hM hQ hR bM bQ bR + have hqv0 := magnetic_nonnegative_spin_variance_bound μ hQ hQpos hQle + have hqv : |qv| ≤ q := by rw [abs_of_nonneg hqv0.1]; exact hqv0.2 + have hqc : |qc| ≤ 5 * q := magnetic_weighted_variance_bound μ hM hQ bM bQ hQpos + have hmc : |mc| ≤ 7 * V := magnetic_centered_fourth_cumulant_bound μ hM bM + have hq : 0 ≤ q := integral_nonneg hQpos + have hV : 0 ≤ V := integral_nonneg fun x => sq_nonneg _ + have hcurv : fieldCurvatureTransform ζ v F M Q z = q + ζ * V := by + dsimp only [q, V, m, T] + rw [magnetic_centered_second μ hM bM] + rfl + have he := fieldFourthTransform_centered ζ v (S := S) hF hG hM hQ hR bM bQ bRb z + change fieldFourthTransform ζ v F M Q R S z = + T S + 4 * ζ * rc + 3 * ζ * qv + 6 * ζ ^ 2 * qc + ζ ^ 3 * mc at he + rw [he, hcurv] + have h4 : |4 * ζ * rc| ≤ 4 * ζ * (2 * C * q) := by + rw [abs_mul, abs_of_nonneg (by positivity : 0 ≤ 4 * ζ)] + exact mul_le_mul_of_nonneg_left hrc (by positivity) + have h3 : |3 * ζ * qv| ≤ 3 * ζ * q := by + rw [abs_mul, abs_of_nonneg (by positivity : 0 ≤ 3 * ζ)] + exact mul_le_mul_of_nonneg_left hqv (by positivity) + have h6 : |6 * ζ ^ 2 * qc| ≤ 6 * ζ ^ 2 * (5 * q) := by + rw [abs_mul, abs_of_nonneg (by positivity : 0 ≤ 6 * ζ ^ 2)] + exact mul_le_mul_of_nonneg_left hqc (by positivity) + have h7 : |ζ ^ 3 * mc| ≤ ζ ^ 3 * (7 * V) := by + rw [abs_mul, abs_of_nonneg (by positivity : 0 ≤ ζ ^ 3)] + exact mul_le_mul_of_nonneg_left hmc (by positivity) + calc + _ ≤ |T S| + |4 * ζ * rc| + |3 * ζ * qv| + |6 * ζ ^ 2 * qc| + |ζ ^ 3 * mc| := + magnetic_abs_five _ _ _ _ _ + _ ≤ D * q + 4 * ζ * (2 * C * q) + 3 * ζ * q + 6 * ζ ^ 2 * (5 * q) + ζ ^ 3 * (7 * V) := by + linarith + _ ≤ (D + 8 * ζ * C + 3 * ζ + 37 * ζ ^ 2) * (q + ζ * V) := by + let L := D + 8 * ζ * C + 3 * ζ + 30 * ζ ^ 2 + let K := D + 8 * ζ * C + 3 * ζ + 37 * ζ ^ 2 + have hLK : L ≤ K := by dsimp only [L, K]; nlinarith [sq_nonneg ζ] + have h7K : 7 * ζ ^ 2 ≤ K := by + dsimp only [K] + nlinarith [sq_nonneg ζ, mul_nonneg hζ hC] + have h1 := mul_le_mul_of_nonneg_right hLK hq + have h2 := mul_le_mul_of_nonneg_right h7K (mul_nonneg hζ hV) + dsimp only [L, K] at h1 h2 + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRelativeThird.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRelativeThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..07713b3e6cb88bb8df3a80c8cc92e4ea58a19ad4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRelativeThird.lean @@ -0,0 +1,186 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCenteredMoments + +namespace OAI + +/-! Relative third-derivative control through a physical tilted Gaussian +step. Unlike a uniform derivative bound, this remains useful at spin endpoints. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma fieldThirdTransform_centered (ζ : ℝ) (v : ℝ≥0) + {F M Q R : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (bM : ∀ x, |M x| ≤ 1) (z : ℝ) : + fieldThirdTransform ζ v F M Q R z = + fieldSpinTransition ζ v F R z + + 3 * ζ * (fieldSpinTransition ζ v F (fun x => Q x * M x) z - + fieldSpinTransition ζ v F Q z * fieldSpinTransition ζ v F M z) + + ζ ^ 2 * fieldSpinTransition ζ v F + (fun x => (M x - fieldSpinTransition ζ v F M z) ^ 3) z := by + let μ := (gaussianReal z v).tilted (fun x => ζ * F x) + have : IsProbabilityMeasure μ := isProbabilityMeasure_tilted + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG ζ) + have hQM : fieldSpinTransition ζ v F (fun x => 2 * M x * Q x) z = + 2 * fieldSpinTransition ζ v F (fun x => Q x * M x) z := by + change (∫ x, 2 * M x * Q x ∂μ) = 2 * ∫ x, Q x * M x ∂μ + rw [← integral_const_mul] + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have hM3 : fieldSpinTransition ζ v F (fun x => (M x) ^ 2 * M x) z = + fieldSpinTransition ζ v F (fun x => (M x) ^ 3) z := by + apply integral_congr_ae + exact ae_of_all _ fun x => by ring + have hc := magnetic_centered_third μ hM bM + change fieldSpinTransition ζ v F (fun x => (M x - fieldSpinTransition ζ v F M z) ^ 3) z = + fieldSpinTransition ζ v F (fun x => (M x) ^ 3) z - + 3 * fieldSpinTransition ζ v F M z * fieldSpinTransition ζ v F (fun x => (M x) ^ 2) z + + 2 * (fieldSpinTransition ζ v F M z) ^ 3 at hc + rw [hc] + unfold fieldThirdTransform fieldCurvatureTransform + rw [hQM, hM3] + ring + +theorem fieldThirdTransform_relative_bound {ζ : ℝ} (hζ : 0 ≤ ζ) (v : ℝ≥0) + {F M Q R : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) + (bM : ∀ x, |M x| ≤ 1) {B C : ℝ} (bQ : ∀ x, |Q x| ≤ B) + (hQpos : ∀ x, 0 ≤ Q x) (hC : 0 ≤ C) + (bR : ∀ x, |R x| ≤ C * Q x) (z : ℝ) : + |fieldThirdTransform ζ v F M Q R z| ≤ + (C + 8 * ζ) * fieldCurvatureTransform ζ v F M Q z := by + let μ := (gaussianReal z v).tilted (fun x => ζ * F x) + have : IsProbabilityMeasure μ := isProbabilityMeasure_tilted + (integrable_exp_of_linearGrowth _ (gaussianReal_exponentialNormMoments z v) hF hG ζ) + let q := ∫ x, Q x ∂μ + let V := ∫ x, (M x - ∫ y, M y ∂μ) ^ 2 ∂μ + have hq : 0 ≤ q := integral_nonneg hQpos + have hV : 0 ≤ V := integral_nonneg fun _ => sq_nonneg _ + have hiQ : Integrable Q μ := Integrable.of_bound hQ.aestronglyMeasurable B + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bQ x) + have hiR : Integrable R μ := (hiQ.const_mul C).mono' hR.aestronglyMeasurable + (ae_of_all _ fun x => by simpa only [Real.norm_eq_abs] using bR x) + have hRb : |∫ x, R x ∂μ| ≤ C * q := by + calc + _ ≤ ∫ x, |R x| ∂μ := abs_integral_le_integral_abs + _ ≤ ∫ x, C * Q x ∂μ := integral_mono hiR.abs (hiQ.const_mul C) bR + _ = _ := integral_const_mul _ _ + have hCov := magnetic_weighted_centered_bound μ hM hQ bM bQ hQpos + have hThird := magnetic_centered_third_bound μ hM bM + have hcurv : fieldCurvatureTransform ζ v F M Q z = q + ζ * V := by + dsimp only [q, V] + rw [magnetic_centered_second μ hM bM] + rfl + rw [fieldThirdTransform_centered ζ v hF hG hM bM, hcurv] + change |(∫ x, R x ∂μ) + 3 * ζ * ((∫ x, Q x * M x ∂μ) - q * (∫ x, M x ∂μ)) + + ζ ^ 2 * (∫ x, (M x - ∫ y, M y ∂μ) ^ 3 ∂μ)| ≤ (C + 8 * ζ) * (q + ζ * V) + calc + _ ≤ |∫ x, R x ∂μ| + 3 * ζ * |(∫ x, Q x * M x ∂μ) - q * (∫ x, M x ∂μ)| + + ζ ^ 2 * |∫ x, (M x - ∫ y, M y ∂μ) ^ 3 ∂μ| := by + have ha := abs_add_le ((∫ x, R x ∂μ) + 3 * ζ * + ((∫ x, Q x * M x ∂μ) - q * (∫ x, M x ∂μ))) + (ζ ^ 2 * (∫ x, (M x - ∫ y, M y ∂μ) ^ 3 ∂μ)) + have hb := abs_add_le (∫ x, R x ∂μ) + (3 * ζ * ((∫ x, Q x * M x ∂μ) - q * (∫ x, M x ∂μ))) + rw [abs_mul, abs_of_nonneg (sq_nonneg ζ)] at ha + rw [abs_mul, abs_of_nonneg (by positivity : 0 ≤ 3 * ζ)] at hb + linarith + _ ≤ C * q + 3 * ζ * (2 * q) + ζ ^ 2 * (2 * V) := by + exact add_le_add (add_le_add hRb (mul_le_mul_of_nonneg_left hCov (by positivity))) + (mul_le_mul_of_nonneg_left hThird (sq_nonneg ζ)) + _ ≤ (C + 8 * ζ) * (q + ζ * V) := by + have h1 := mul_nonneg hζ hq + have h2 := mul_nonneg (mul_nonneg hC hζ) hV + have h3 := mul_nonneg (sq_nonneg ζ) hV + nlinarith + +def magneticThirdRatioCap : List (ℝ × ℝ≥0) → ℝ + | [] => 2 + | av :: L => magneticThirdRatioCap L + 8 * |av.1| + +lemma magneticThirdRatioCap_nonneg (L : List (ℝ × ℝ≥0)) : + 0 ≤ magneticThirdRatioCap L := by + induction L with + | nil => norm_num [magneticThirdRatioCap] + | cons av L ih => exact add_nonneg ih (mul_nonneg (by norm_num) (abs_nonneg _)) + +lemma field_logCosh_third_relative (z : ℝ) : + |-2 * Real.tanh z / (Real.cosh z) ^ 2| ≤ 2 * (1 / (Real.cosh z) ^ 2) := by + have hp : 0 < (Real.cosh z) ^ 2 := sq_pos_of_pos (Real.cosh_pos z) + calc + _ = 2 * |Real.tanh z| * (1 / (Real.cosh z) ^ 2) := by + rw [abs_div, abs_mul, abs_neg, abs_of_pos (by norm_num : (0 : ℝ) < 2), + abs_of_pos hp] + ring + _ ≤ 2 * 1 * (1 / (Real.cosh z) ^ 2) := + mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (field_abs_tanh_le_one z) (by norm_num)) + (one_div_nonneg.mpr hp.le) + _ = _ := by ring + +theorem fieldScalarLogCoshThird_relative (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + |fieldScalarThird L (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) + (fun x => -2 * Real.tanh x / (Real.cosh x) ^ 2) z| ≤ + magneticThirdRatioCap L * fieldScalarSecond L + (fun x => Real.log (Real.cosh x)) Real.tanh + (fun x => 1 / (Real.cosh x) ^ 2) z := by + induction L generalizing z with + | nil => exact field_logCosh_third_relative z + | cons av L ih => + have ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular L ht measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular L ht + have hr := fieldScalarThird_regular L ht measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound + have hp := (hL av List.mem_cons_self).le + have he := fieldThirdTransform_relative_bound hp av.2 hv.1 hv.2 ha.1 hq.1 hr.1 + ha.2 hq.2 (fun x => (fieldScalarLogCoshSecond_pos L ht x).le) + (magneticThirdRatioCap_nonneg L) (ih ht) z + simpa only [fieldScalarThird, fieldScalarSecond, fieldScalarMean, magneticThirdRatioCap, + abs_of_nonneg hp, fieldCurvatureTransform] using he + +lemma fieldBiasThird_relative (h : FieldStep) (b : ℝ) : + |fieldBiasThird h b| ≤ magneticThirdRatioCap (scalarFieldIncrements h) * + fieldBiasCurvature h b := by + have hL := scalarFieldIncrements_positive h + have hv := fieldScalarValue_regular _ hL measurable_logCosh logCosh_linearGrowth + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have ha := fieldScalarMean_regular _ hL measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hq := fieldScalarLogCoshSecond_regular _ hL + have hr := fieldScalarThird_regular _ hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound + have he := fieldThirdTransform_relative_bound (by norm_num : (0 : ℝ) ≤ 0) + (NNReal.mk (h.height 0) (h.nonneg 0)) hv.1 hv.2 ha.1 hq.1 hr.1 ha.2 hq.2 + (fun x => (fieldScalarLogCoshSecond_pos _ hL x).le) + (magneticThirdRatioCap_nonneg _) (fieldScalarLogCoshThird_relative _ hL) b + simpa only [fieldThirdTransform, zero_mul, mul_zero, add_zero, fieldCurvatureTransform, + fieldBiasThird, fieldBiasCurvature] using he + +lemma magneticCurvatureSlope_bound (h : FieldStep) (s : ℝ) : + |magneticCurvatureSlope h s| ≤ magneticThirdRatioCap (scalarFieldIncrements h) := by + unfold magneticCurvatureSlope + rw [abs_div, abs_of_pos (magneticCurvature_pos h s)] + apply (div_le_iff₀ (magneticCurvature_pos h s)).mpr + exact fieldBiasThird_relative h (magneticBias h s) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticResidueSelection.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticResidueSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5e74710cde668a133ebce8960efdd618f69a4bf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticResidueSelection.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityResidueConvergence + +namespace OAI + +/-! Selecting a bad residue for each candidate block is enough to test the +full-sequence pressure lower bound. -/ +noncomputable section +open Filter +namespace InvariantIsing + +lemma cavity_residue_eventually_lower {n : ℕ} (hn : 0 < n) (q : ℕ) + (P : ℕ → ℝ) (L : ℝ) + (h : ∀ t : Fin n, ∀ ε > 0, ∀ᶠ j in atTop, L-ε ≤ P (t+(q+j)*n)) : + ∀ ε > 0, ∀ᶠ N in atTop, L-ε ≤ P N := by + intro ε hε + have he : ∀ᶠ j in atTop, ∀ t : Fin n, L-ε ≤ P (t+(q+j)*n) := + Filter.eventually_all.mpr (fun t => h t ε hε) + obtain ⟨J,hJ⟩ := eventually_atTop.mp he + apply eventually_atTop.mpr + refine ⟨(q+J)*n, fun N hN => ?_⟩ + have hdiv : q+J ≤ N/n := (Nat.le_div_iff_mul_le hn).mpr hN + let t : Fin n := ⟨N%n,Nat.mod_lt _ hn⟩ + have hj : J ≤ N/n-q := by omega + have heq : (t : ℕ)+(q+(N/n-q))*n=N := by + have hq : q+(N/n-q)=N/n := by omega + rw [hq] + simpa only [t, Nat.mul_comm] using Nat.mod_add_div N n + simpa only [heq] using hJ (N/n-q) hj t + +theorem magnetic_full_lower_of_residue_selection + (n q : ℕ → ℕ) (hn : ∀ r, 0 < n r) (P : ℕ → ℝ) (L : ℝ) + (h : ∀ t : (r : ℕ) → Fin (n r), ∃ r, + ∀ ε > 0, ∀ᶠ j in atTop, L-ε ≤ P (t r+(q r+j)*n r)) : + ∀ ε > 0, ∀ᶠ N in atTop, L-ε ≤ P N := by + have hex : ∃ r, ∀ t : Fin (n r), ∀ ε > 0, + ∀ᶠ j in atTop, L-ε ≤ P (t+(q r+j)*n r) := by + by_contra hnone + have hbad : ∀ r, ∃ t : Fin (n r), ¬(∀ ε > 0, + ∀ᶠ j in atTop, L-ε ≤ P (t+(q r+j)*n r)) := by + intro r + by_contra hnr + push Not at hnr + exact hnone ⟨r,hnr⟩ + choose t ht using hbad + obtain ⟨r,hr⟩ := h t + exact ht r hr + obtain ⟨r,hr⟩ := hex + exact cavity_residue_eventually_lower (hn r) (q r) P L hr + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRoundedCount.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRoundedCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b4f103b748523a1e828f53088e000f1b88cd521 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRoundedCount.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Fields.SpinGroupSlice +import Mathlib.Topology.Instances.Real.Lemmas + +namespace OAI + +/-! Rounding an interior magnetization to an attainable spin count. -/ +noncomputable section +open Filter +open scoped Topology +namespace InvariantIsing + +def magneticRoundedCount (G : ℕ) (s : ℝ) : ℕ := ⌊(G:ℝ)*((1+s)/2)⌋₊ + +def magneticRoundedValue (G : ℕ) (s : ℝ) : ℝ := + if G=0 then s else 2*(magneticRoundedCount G s : ℝ)/G-1 + +lemma magneticRoundedCount_le (G : ℕ) {s : ℝ} (hs : |s|≤1) : + magneticRoundedCount G s ≤ G := by + have h := Nat.floor_le (show 0≤(G:ℝ)*((1+s)/2) by + exact mul_nonneg (Nat.cast_nonneg _) (by linarith [(abs_le.mp hs).1])) + have ht : (G:ℝ)*((1+s)/2)≤G := by + nlinarith [(Nat.cast_nonneg G : (0:ℝ)≤G),(abs_le.mp hs).2] + exact_mod_cast h.trans ht + +lemma magneticRoundedCount_value (G : ℕ) {s : ℝ} (_hs : |s|≤1) : + (magneticRoundedCount G s : ℝ)=(G:ℝ)*((1+magneticRoundedValue G s)/2) := by + by_cases hG : G=0 + · simp [hG,magneticRoundedCount,magneticRoundedValue] + · simp only [magneticRoundedValue,ite_eq_right hG] + have hn : (G:ℝ)≠0 := Nat.cast_ne_zero.mpr hG + field_simp + ring + +lemma magneticRoundedValue_error {G : ℕ} (hG : 0 linarith + nlinarith + +lemma magneticRoundedValue_tendsto (G : ℕ → ℕ) (hG : Tendsto G atTop atTop) + {s : ℝ} (hs : |s|≤1) : + Tendsto (fun k => magneticRoundedValue (G k) s) atTop (𝓝 s) := by + have hpos : ∀ᶠ k in atTop, 0 2/(G k : ℝ)) atTop (𝓝 0) := + (tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.comp hG)) + have hzero : Tendsto (fun k => magneticRoundedValue (G k) s-s) atTop (𝓝 0) := by + refine squeeze_zero_norm' ?_ he + · filter_upwards [hpos] with k hk + simpa only [Real.norm_eq_abs] using magneticRoundedValue_error hk hs + simpa only [sub_add_cancel,zero_add] using hzero.add_const s + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRoundedFieldUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRoundedFieldUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..37a2aa5f91cb732b5ad48129a3583ff5b5ac44d0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticRoundedFieldUpper.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticConvergingFieldUpper +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupRounding +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteTrial +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds +import OAI.Probability.InvariantIsing.Fields.SpinGroupFieldPressure +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureFluctuation + +namespace OAI + +/-! The finite-spectrum pressure upper bound after taking the path infimum, +under Haar and Gaussian concentration hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_magneticRoundedFieldPressure_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : ∀ k, Fin (N k) → A) + (γ b : A → ℝ) (hγ : ∀ a, 0<γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun k a => (spinGroupSize (group k) a:ℝ)/(N k:ℝ)) atTop (𝓝 γ)) + (q : RationalMagnetization A) : + ∀ ε : ℝ, 0<ε → ∀ᶠ k in atTop, + (∫ U, restrictedRotatedPressure (spinGroupSlice (group k) + (fun a => magneticRoundedCount (spinGroupSize (group k) a) (q.val a:ℝ))) + (eig k) (specialRotation U) (fun i => b (group k i)) ∂μ k) ≤ + (finiteMagneticFunctional (finiteR ρ lam hρpos hρsum) γ b).toReal+ε := by + let mag := fun a => (q.val a:ℝ) + let γs := fun k a => (spinGroupSize (group k) a:ℝ)/(N k:ℝ) + let mags := fun k a => magneticRoundedValue (spinGroupSize (group k) a) (mag a) + let cnt := fun k a => magneticRoundedCount (spinGroupSize (group k) a) (mag a) + have hm : Tendsto mags atTop (𝓝 mag) := rounded_group_magnetizations_tendsto + N hNlim group γ mag hγ (fun a => (q.property a).le) hgroup + have hg k a : (spinGroupSize (group k) a:ℝ)=N k*γs k a := by + dsimp only [γs] + have hn : (N k:ℝ)≠0 := Nat.cast_ne_zero.mpr (by have := hN k; omega) + field_simp + have hu := finiteSpectrum_magneticFieldPressure_converging_upper hhaar hgauss + N hN hNlim m μ hμinv eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + group cnt (fun k a => magneticRoundedCount_le _ (q.property a).le) + γs mags γ mag hgroup hm (fun a => (hγ a).le) hγsum q.property + (fun k a => magneticRoundedCount_value _ (q.property a).le) hg b + intro ε hε + filter_upwards [hu ε hε] with k hk + have hb := finiteMagnetic_trial_le ρ lam hρpos hρsum γ b (fun a => (hγ a).le) hγsum q + dsimp only [mag] at hk + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarContinuation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarContinuation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7051650349dbf471320eb8eae53dd7b4cc99b25 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarContinuation.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldLevels + +namespace OAI + +/-! The literal conditional squared means of the finite Ising recursion +have bounded spatial derivatives through order three. The ordinary root +Gaussian is retained in the statement. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def magneticLogCoshMeanJet (L : List (ℝ × ℝ≥0)) (hL : ∀ av ∈ L, 0 < av.1) : + MagneticContinuationJet := by + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hf : Measurable fieldLogCoshFourth := by unfold fieldLogCoshFourth; fun_prop + have hM := fieldScalarMean_regular L hL measurable_logCosh logCosh_linearGrowth + hm field_abs_tanh_le_one + have hQ := fieldScalarLogCoshSecond_regular L hL + have hR := fieldScalarThird_regular L hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound + have hS := fieldScalarFourth_regular L hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) hf zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound field_logCosh_fourth_bound + refine { + value := fieldScalarMean L (fun z => Real.log (Real.cosh z)) Real.tanh + first := fieldScalarSecond L (fun z => Real.log (Real.cosh z)) Real.tanh + (fun z => 1 / (Real.cosh z) ^ 2) + second := fieldScalarThird L (fun z => Real.log (Real.cosh z)) Real.tanh + (fun z => 1 / (Real.cosh z) ^ 2) (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2) + third := fieldScalarFourth L (fun z => Real.log (Real.cosh z)) Real.tanh + (fun z => 1 / (Real.cosh z) ^ 2) (fun z => -2 * Real.tanh z / (Real.cosh z) ^ 2) + fieldLogCoshFourth + mValue := hM.1 + mFirst := hQ.1 + mSecond := hR.1 + mThird := hS.1 + bValue := ⟨1, zero_le_one, hM.2⟩ + bFirst := ⟨_, (abs_nonneg _).trans (hQ.2 0), hQ.2⟩ + bSecond := ⟨_, (abs_nonneg _).trans (hR.2 0), hR.2⟩ + bThird := hS.2 + dValue := hasDerivAt_fieldScalarLogCoshMean L hL + dFirst := hasDerivAt_fieldScalarLogCoshSecond L hL + dSecond := hasDerivAt_fieldScalarLogCoshThird L hL } + +theorem fieldScalarSquares_has_bounded_jet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) : + ∃ J : MagneticContinuationJet, + J.value = fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh i := by + induction L with + | nil => + exact ⟨(magneticLogCoshMeanJet [] hL).square, rfl⟩ + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + refine Fin.cases ?_ (fun j => ?_) i + · exact ⟨(magneticLogCoshMeanJet (av :: L) hL).square, rfl⟩ + · obtain ⟨J, hJ⟩ := ih ht j + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L ht + have hd : ∀ z, HasDerivAt (fieldScalarValue L (fun y => Real.log (Real.cosh y))) + (P.value z) z := hasDerivAt_fieldScalarLogCosh L ht + refine ⟨J.transition P av.1 av.2 _ hv.1 hv.2 hd, ?_⟩ + change fieldSpinTransition av.1 av.2 _ J.value = _ + rw [hJ] + rfl + +theorem magneticLevelAtBias_has_bounded_jet (h : FieldStep) (i : Fin (h.depth + 1)) : + ∃ J : MagneticContinuationJet, J.value = fun b => magneticLevelAtBias h b i := by + have hL := scalarFieldIncrements_positive h + obtain ⟨J, hJ⟩ := fieldScalarSquares_has_bounded_jet (scalarFieldIncrements h) hL + (Fin.cast (by rw [scalarFieldIncrements_length]) i) + have hv := fieldScalarValue_regular (scalarFieldIncrements h) hL + measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet (scalarFieldIncrements h) hL + have hd : ∀ z, HasDerivAt (fieldScalarValue (scalarFieldIncrements h) + (fun y => Real.log (Real.cosh y))) (P.value z) z := + hasDerivAt_fieldScalarLogCosh _ hL + refine ⟨J.transition P 0 (NNReal.mk (h.height 0) (h.nonneg 0)) _ hv.1 hv.2 hd, ?_⟩ + change fieldSpinTransition 0 _ _ J.value = _ + rw [hJ] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarFourJet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarFourJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..503354514d8ccbd36ae4d2b4201e091bb2396b99 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarFourJet.lean @@ -0,0 +1,104 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFourJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarContinuation + +namespace OAI + +/-! Every actual finite scalar Ising mean, and every continued square +observable, has the fourth spatial derivative required in the parabolic +comparison. No additional smoothness hypothesis is imposed on the model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +private def logCoshMeanFourJet : MagneticContinuationFourJet where + toMagneticContinuationJet := magneticLogCoshMeanJet [] (by simp) + fourth := fun z => 16 * Real.tanh z * (1 / Real.cosh z ^ 2) ^ 2 - + 8 * Real.tanh z ^ 3 * (1 / Real.cosh z ^ 2) + mFourth := by + simp only [Real.tanh_eq] + fun_prop + bFourth := by + let P := magneticLogCoshMeanJet [] (by simp) + have hM := P.bValue + have hQ := P.bFirst + change MagneticContinuationBound Real.tanh at hM + change MagneticContinuationBound (fun z => 1 / Real.cosh z ^ 2) at hQ + have hM3 : MagneticContinuationBound (fun z => Real.tanh z ^ 3) := by + simpa only [pow_succ, pow_zero, one_mul, mul_assoc] using (hM.mul hM).mul hM + have hQ2 : MagneticContinuationBound (fun z => (1 / Real.cosh z ^ 2) ^ 2) := by + simpa only [pow_two] using hQ.mul hQ + exact (((MagneticContinuationBound.const 16).mul hM).mul hQ2).sub + (((MagneticContinuationBound.const 8).mul hM3).mul hQ) + dThird := fun z => by + change HasDerivAt fieldLogCoshFourth _ z + have hM := field_hasDerivAt_tanh z + have hQ := field_logCosh_third_derivative z + have hd := ((hQ.pow 2).const_mul (-2)).add (((hM.pow 2).const_mul 4).mul hQ) + convert hd using 1 + · rfl + · simp only [div_eq_mul_inv, Pi.pow_apply] + ring + +lemma fieldScalarMean_has_bounded_fourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : + ∃ J : MagneticContinuationFourJet, + J.value = fieldScalarMean L (fun z => Real.log (Real.cosh z)) Real.tanh := by + induction L with + | nil => exact ⟨logCoshMeanFourJet, rfl⟩ + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + obtain ⟨J, hJ⟩ := ih ht + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + have hd : ∀ z, HasDerivAt (fieldScalarValue L (fun y => Real.log (Real.cosh y))) + (J.value z) z := by + rw [hJ] + exact hasDerivAt_fieldScalarLogCosh L ht + refine ⟨J.transition J.toMagneticContinuationJet av.1 av.2 _ hv.1 hv.2 hd, ?_⟩ + change fieldSpinTransition av.1 av.2 _ J.value = _ + rw [hJ] + rfl + +def magneticLogCoshMeanFourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : MagneticContinuationFourJet := + (fieldScalarMean_has_bounded_fourJet L hL).choose + +lemma magneticLogCoshMeanFourJet_eq (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : + (magneticLogCoshMeanFourJet L hL).toMagneticContinuationJet = magneticLogCoshMeanJet L hL := by + apply MagneticContinuationJet.eq_of_value_eq + exact (fieldScalarMean_has_bounded_fourJet L hL).choose_spec + +lemma fieldScalarSquares_has_bounded_fourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) : + ∃ J : MagneticContinuationFourJet, + J.value = fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh i := by + induction L with + | nil => + refine ⟨logCoshMeanFourJet.square, ?_⟩ + rfl + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + refine Fin.cases ?_ (fun j => ?_) i + · refine ⟨(magneticLogCoshMeanFourJet (av :: L) hL).square, ?_⟩ + change (fun z => ((magneticLogCoshMeanFourJet (av :: L) hL).value z) ^ 2) = _ + have he := congrArg MagneticContinuationJet.value (magneticLogCoshMeanFourJet_eq (av :: L) hL) + rw [he] + rfl + · obtain ⟨J, hJ⟩ := ih ht j + have hv := fieldScalarValue_regular L ht measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L ht + have hd : ∀ z, HasDerivAt (fieldScalarValue L (fun y => Real.log (Real.cosh y))) + (P.value z) z := hasDerivAt_fieldScalarLogCosh L ht + refine ⟨J.transition P av.1 av.2 _ hv.1 hv.2 hd, ?_⟩ + change fieldSpinTransition av.1 av.2 _ J.value = _ + rw [hJ] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarFourth.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarFourth.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce33b7b4b43fe70d4e3b82abfd93f7f776f4cda8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarFourth.lean @@ -0,0 +1,141 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpatialFourth + +namespace OAI + +/-! The actual fourth spatial derivative through every finite backward +level. Its global bound is finite for each fixed finite field. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldScalarFourth : List (ℝ × ℝ≥0) → + (ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ) → ℝ → ℝ + | [], _, _, _, _, d => d + | av :: L, F, a, b, c, d => fieldFourthTransform av.1 av.2 + (fieldScalarValue L F) (fieldScalarMean L F a) + (fieldScalarSecond L F a b) (fieldScalarThird L F a b c) + (fieldScalarFourth L F a b c d) + +lemma fieldScalarFourth_regular (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a b c d : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (hb : Measurable b) (hc : Measurable c) (hd : Measurable d) + {K C D E : ℝ} (hK : 0 ≤ K) + (ba : ∀ z, |a z| ≤ K) (bb : ∀ z, |b z| ≤ C) + (bc : ∀ z, |c z| ≤ D) (bd : ∀ z, |d z| ≤ E) : + Measurable (fieldScalarFourth L F a b c d) ∧ + ∃ B : ℝ, 0 ≤ B ∧ ∀ z, |fieldScalarFourth L F a b c d z| ≤ B := by + induction L with + | nil => exact ⟨hd, E, (abs_nonneg _).trans (bd 0), bd⟩ + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht hF hG + have hm := fieldScalarMean_regular L ht hF hG ha ba + have hq := fieldScalarSecond_regular L ht hF hG ha hb hK ba bb + have hr := fieldScalarThird_regular L ht hF hG ha hb hc hK ba bb bc + obtain ⟨hs, B, hB, bs⟩ := ih ht + have hC : 0 ≤ fieldScalarSecondCap L K C := (abs_nonneg _).trans (hq.2 0) + exact ⟨measurable_fieldFourthTransform av.1 av.2 hv.1 hm.1 hq.1 hr.1 hs, + fieldFourthTransform_bounded av.1 av.2 hv.1 hv.2 hK hC hm.2 hq.2 hr.2 bs⟩ + +lemma hasDerivAt_fieldScalarThird (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a b c d : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (hb : Measurable b) (hc : Measurable c) (hd : Measurable d) + {K C D E : ℝ} (hK : 0 ≤ K) + (ba : ∀ z, |a z| ≤ K) (bb : ∀ z, |b z| ≤ C) + (bc : ∀ z, |c z| ≤ D) (bd : ∀ z, |d z| ≤ E) + (dF : ∀ z, HasDerivAt F (a z) z) + (da : ∀ z, HasDerivAt a (b z) z) + (db : ∀ z, HasDerivAt b (c z) z) + (dc : ∀ z, HasDerivAt c (d z) z) (z : ℝ) : + HasDerivAt (fieldScalarThird L F a b c) + (fieldScalarFourth L F a b c d z) z := by + induction L generalizing z with + | nil => exact dc z + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht hF hG + have hm := fieldScalarMean_regular L ht hF hG ha ba + have hq := fieldScalarSecond_regular L ht hF hG ha hb hK ba bb + have hr := fieldScalarThird_regular L ht hF hG ha hb hc hK ba bb bc + obtain ⟨hs, B, hB, bs⟩ := fieldScalarFourth_regular L ht hF hG ha hb hc hd hK ba bb bc bd + have hC : 0 ≤ fieldScalarSecondCap L K C := (abs_nonneg _).trans (hq.2 0) + have hD : 0 ≤ fieldScalarThirdCap L K C D := (abs_nonneg _).trans (hr.2 0) + exact hasDerivAt_fieldThirdTransform av.1 av.2 hv.1 hv.2 hm.1 hq.1 hr.1 hs hK hC hD + hm.2 hq.2 hr.2 bs + (hasDerivAt_fieldScalarValue L ht hF hG ha hK ba dF) + (hasDerivAt_fieldScalarMean L ht hF hG ha hb hK ba bb dF da) + (hasDerivAt_fieldScalarSecond L ht hF hG ha hb hc hK ba bb bc dF da db) + (ih ht) z + +def fieldLogCoshFourth (z : ℝ) : ℝ := + -2 * (1 / (Real.cosh z) ^ 2) ^ 2 + + 4 * (Real.tanh z) ^ 2 * (1 / (Real.cosh z) ^ 2) + +lemma field_logCosh_fourth_derivative (z : ℝ) : + HasDerivAt (fun y : ℝ => -2 * Real.tanh y / (Real.cosh y) ^ 2) + (fieldLogCoshFourth z) z := by + have hd := ((field_hasDerivAt_tanh z).const_mul (-2)).mul + (field_logCosh_third_derivative z) + convert hd using 1 + · funext y + simp only [Pi.mul_apply, div_eq_mul_inv] + ring + · simp only [fieldLogCoshFourth, div_eq_mul_inv] + ring + +lemma field_logCosh_fourth_bound (z : ℝ) : |fieldLogCoshFourth z| ≤ 6 := by + have ht := field_abs_tanh_le_one z + have hq := field_tanh_second_bound z + have ht2 : |(Real.tanh z) ^ 2| ≤ 1 := by + rw [abs_pow] + simpa using pow_le_pow_left₀ (abs_nonneg _) ht 2 + have hq2 : |(1 / (Real.cosh z) ^ 2) ^ 2| ≤ 1 := by + rw [abs_pow] + simpa using pow_le_pow_left₀ (abs_nonneg _) hq 2 + unfold fieldLogCoshFourth + refine (abs_add_le _ _).trans ?_ + have hb1 : |-2 * (1 / (Real.cosh z) ^ 2) ^ 2| ≤ 2 := by + rw [abs_mul, abs_neg, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + nlinarith + have hb2 : |4 * (Real.tanh z) ^ 2 * (1 / (Real.cosh z) ^ 2)| ≤ 4 := by + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 4)] + calc + 4 * |Real.tanh z ^ 2| * |1 / Real.cosh z ^ 2| ≤ 4 * 1 * 1 := + mul_le_mul (mul_le_mul_of_nonneg_left ht2 (by norm_num)) hq (abs_nonneg _) (by norm_num) + _ = 4 := by norm_num + linarith + +lemma hasDerivAt_fieldScalarLogCoshThird (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + HasDerivAt (fieldScalarThird L (fun y => Real.log (Real.cosh y)) Real.tanh + (fun y => 1 / (Real.cosh y) ^ 2) (fun y => -2 * Real.tanh y / (Real.cosh y) ^ 2)) + (fieldScalarFourth L (fun y => Real.log (Real.cosh y)) Real.tanh + (fun y => 1 / (Real.cosh y) ^ 2) (fun y => -2 * Real.tanh y / (Real.cosh y) ^ 2) + fieldLogCoshFourth z) z := by + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hf : Measurable fieldLogCoshFourth := by + unfold fieldLogCoshFourth + fun_prop + apply hasDerivAt_fieldScalarThird L hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) hf zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound field_logCosh_fourth_bound + · intro y + simpa only [Real.tanh_eq_sinh_div_cosh] using + (Real.hasDerivAt_cosh y).log (Real.cosh_pos y).ne' + · exact field_hasDerivAt_tanh + · exact field_logCosh_third_derivative + · exact field_logCosh_fourth_derivative + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarInverse.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca12c3b15ce807cc3fd53f1d2c54a339d454a955 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarInverse.lean @@ -0,0 +1,103 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarSlab +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatInverse + +namespace OAI + +/-! Spatial and variance derivatives of the genuine finite-tail inverse +curvature. The minimizing bias is constructed by coercivity, and no +inverse-regularity assumption remains in these statements. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSlabBias_continuousAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + ContinuousAt (magneticScalarSlabBias L ζ v) s := by + have hmono := magneticScalarSlabMean_strictMono L hL hζ v + apply tendsto_order.2 + constructor + · intro l hl + have hlt : magneticScalarSlabMean L ζ v l < s := by + rw [← magneticScalarSlabMean_bias L hL hζ hs v] + exact hmono hl + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2, + Ioi_mem_nhds hlt] with t ht hlt' + apply hmono.lt_iff_lt.mp + rw [magneticScalarSlabMean_bias L hL hζ (abs_lt.mpr ht) v] + exact hlt' + · intro u hu + have htu : s < magneticScalarSlabMean L ζ v u := by + rw [← magneticScalarSlabMean_bias L hL hζ hs v] + exact hmono hu + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2, + Iio_mem_nhds htu] with t ht htu' + apply hmono.lt_iff_lt.mp + rw [magneticScalarSlabMean_bias L hL hζ (abs_lt.mpr ht) v] + exact htu' + +lemma magneticScalarSlabBias_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + let z := magneticScalarSlabBias L ζ v s + let P := magneticLogCoshMeanJet L hL + let F := fieldScalarValue L (fun x => Real.log (Real.cosh x)) + HasDerivAt (magneticScalarSlabBias L ζ v) + (fieldCurvatureTransform ζ (Real.toNNReal v) F P.value P.first z)⁻¹ s := by + apply HasDerivAt.of_local_left_inverse + (magneticScalarSlabBias_continuousAt_spin L hL hζ hs v) + (magneticScalarSlabMean_hasDerivAt L hL ζ v _) + (magneticScalarSlab_curvature_pos L hL hζ v _).ne' + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2] with t ht + exact magneticScalarSlabMean_bias L hL hζ (abs_lt.mpr ht) v + +def magneticScalarInverseCurvature (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v s : ℝ) : ℝ := + magneticHeatCurvature (magneticLogCoshMeanJet L hL) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) ζ + (v, magneticScalarSlabBias L ζ v s) + +lemma magneticScalarInverseCurvature_eq (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v s : ℝ) : + magneticScalarInverseCurvature L hL ζ v s = + fieldCurvatureTransform ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) + (magneticLogCoshMeanJet L hL).value (magneticLogCoshMeanJet L hL).first + (magneticScalarSlabBias L ζ v s) := by + exact magneticHeatCurvature_eq _ _ + (fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth).1 ζ _ + +lemma magneticScalarInverseCurvature_variance_hasDerivAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s v : ℝ} + (hζ : 0 ≤ ζ) (hs : |s| < 1) (hv : 0 < v) : + let P := magneticLogCoshMeanJet L hL + let F := fieldScalarValue L (fun x => Real.log (Real.cosh x)) + let hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let J := P.transition P ζ (Real.toNNReal v) F hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) + let z := magneticScalarSlabBias L ζ v s + HasDerivAt (fun t => magneticScalarInverseCurvature L hL ζ t s) + ((J.first z) ^ 2 / 2 * (J.third z / (J.first z) ^ 2 - + (J.second z) ^ 2 / (J.first z) ^ 3) + ζ * (J.first z) ^ 2) v := by + let P := magneticLogCoshMeanJet L hL + let F := fieldScalarValue L (fun x => Real.log (Real.cosh x)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hd : ∀ z, HasDerivAt F (P.value z) z := hasDerivAt_fieldScalarLogCosh L hL + have hq : (P.transition P ζ (Real.toNNReal v) F hF.1 hF.2 hd).first + (magneticScalarSlabBias L ζ v s) ≠ 0 := by + have hp := (magneticScalarSlab_curvature_pos L hL hζ v + (magneticScalarSlabBias L ζ v s)).ne' + simpa only [P, MagneticContinuationJet.transition, fieldTiltSpatial, + fieldCurvatureTransform, pow_two] using hp + apply magneticHeatInverse_curvature_hasDerivAt P F hF.1 hF.2 hd ζ (s := s) hv + (magneticScalarSlabBias_continuousAt_variance L hL hζ hs hv) ?_ hq + exact Eventually.of_forall fun t => by + rw [← magneticScalarSlabMean_eq L hL ζ t] + exact magneticScalarSlabMean_bias L hL hζ hs t + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarSlab.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarSlab.lean new file mode 100644 index 0000000000000000000000000000000000000000..b52a54d2e4d06695111efef68c95c427ddff217b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarSlab.lean @@ -0,0 +1,142 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatMean +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarContinuation +import OAI.Probability.InvariantIsing.Magnetic.MagneticCoerciveRoot + +namespace OAI + +/-! Actual finite-tail Gaussian slabs have a unique bias at every +interior prescribed magnetization. These are the inverse coordinates used +in the finite-step parabolic comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticScalarSlabMean (L : List (ℝ × ℝ≥0)) (ζ v : ℝ) (z : ℝ) : ℝ := + fieldSpinTransition ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) + (fieldScalarMean L (fun x => Real.log (Real.cosh x)) Real.tanh) z + +def magneticScalarSlabBias (L : List (ℝ × ℝ≥0)) (ζ v s : ℝ) : ℝ := + Function.invFun (magneticScalarSlabMean L ζ v) s + +lemma magneticScalarSlabMean_eq (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v z : ℝ) : + magneticScalarSlabMean L ζ v z = + magneticHeatMean (magneticLogCoshMeanJet L hL) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) ζ (v, z) := by + exact (magneticHeatMean_eq (magneticLogCoshMeanJet L hL) _ + (fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth).1 ζ (v, z)).symm + +lemma magneticScalarSlab_lower (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + |z| - Real.log 2 ≤ gaussianOperator ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) z := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hp : ∀ x, 1 * x + -Real.log 2 ≤ + fieldScalarValue L (fun y => Real.log (Real.cosh y)) x := by + apply affine_le_fieldScalarValue L hL measurable_logCosh logCosh_linearGrowth + intro x + simpa only [one_mul, sub_eq_add_neg] using signed_bias_le_logcosh x + have hm : ∀ x, (-1) * x + -Real.log 2 ≤ + fieldScalarValue L (fun y => Real.log (Real.cosh y)) x := by + apply affine_le_fieldScalarValue L hL measurable_logCosh logCosh_linearGrowth + intro x + simpa only [Real.cosh_neg, neg_mul, one_mul, sub_eq_add_neg] + using signed_bias_le_logcosh (-x) + have hplus := affine_le_gaussianOperator hF.1 hF.2 hζ (Real.toNNReal v) + 1 (-Real.log 2) hp z + have hminus := affine_le_gaussianOperator hF.1 hF.2 hζ (Real.toNNReal v) + (-1) (-Real.log 2) hm z + rcases le_total 0 z with hz | hz + · rw [abs_of_nonneg hz] + simpa only [one_mul, sub_eq_add_neg] using hplus + · rw [abs_of_nonpos hz] + simpa only [neg_mul, one_mul, sub_eq_add_neg] using hminus + +lemma magneticScalarSlab_value_hasDerivAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v z : ℝ) : + HasDerivAt + (gaussianOperator ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x)))) + (magneticScalarSlabMean L ζ v z) z := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L hL + obtain ⟨K, hK, bK⟩ := P.bValue + exact hasDerivAt_gaussianOperator ζ (Real.toNNReal v) hF.1 hF.2 P.mValue hK bK + (hasDerivAt_fieldScalarLogCosh L hL) z + +lemma magneticScalarSlab_curvature_pos (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + 0 < fieldCurvatureTransform ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) + (magneticLogCoshMeanJet L hL).value (magneticLogCoshMeanJet L hL).first z := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L hL + obtain ⟨K, _, bK⟩ := P.bFirst + have hpos : ∀ x, 0 < P.first x := fieldScalarLogCoshSecond_pos L hL + have hp := fieldSpinTransition_pos ζ (Real.toNNReal v) hF.1 hF.2 P.mFirst bK hpos z + obtain ⟨D, _, bD⟩ := P.bValue + have hs := fieldSpinTransition_square_le ζ (Real.toNNReal v) hF.1 hF.2 P.mValue bD z + exact add_pos_of_pos_of_nonneg hp (mul_nonneg hζ (sub_nonneg.mpr hs)) + +lemma magneticScalarSlabMean_hasDerivAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v z : ℝ) : + HasDerivAt (magneticScalarSlabMean L ζ v) + (fieldCurvatureTransform ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) + (magneticLogCoshMeanJet L hL).value (magneticLogCoshMeanJet L hL).first z) z := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L hL + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨C, _, bC⟩ := P.bFirst + have hd := hasDerivAt_fieldSpinTransition ζ (Real.toNNReal v) + hF.1 hF.2 P.mValue P.mValue P.mFirst hK hK bK bK bC + (hasDerivAt_fieldScalarLogCosh L hL) P.dValue z + change HasDerivAt (fieldSpinTransition ζ (Real.toNNReal v) _ P.value) + (fieldCurvatureTransform ζ (Real.toNNReal v) _ P.value P.first z) z + simpa only [fieldCurvatureTransform, pow_two] using hd + +lemma magneticScalarSlabMean_strictMono (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v : ℝ) : + StrictMono (magneticScalarSlabMean L ζ v) := by + apply strictMono_of_deriv_pos + intro z + rw [(magneticScalarSlabMean_hasDerivAt L hL ζ v z).deriv] + exact magneticScalarSlab_curvature_pos L hL hζ v z + +lemma magneticScalarSlabMean_bias (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + magneticScalarSlabMean L ζ v (magneticScalarSlabBias L ζ v s) = s := by + apply Function.invFun_eq + exact exists_mean_root_of_linear_lower (magneticScalarSlab_value_hasDerivAt L hL ζ v) + (magneticScalarSlab_lower L hL hζ v) hs + +lemma magneticScalarSlabBias_continuousAt_variance (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s v : ℝ} + (hζ : 0 ≤ ζ) (hs : |s| < 1) (hv : 0 < v) : + ContinuousAt (fun t => magneticScalarSlabBias L ζ t s) v := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L hL + have heq : (fun q : ℝ × ℝ => magneticScalarSlabMean L ζ q.1 q.2) = + magneticHeatMean P (fieldScalarValue L (fun x => Real.log (Real.cosh x))) ζ := by + funext q + exact magneticScalarSlabMean_eq L hL ζ q.1 q.2 + apply parametric_bias_continuousAt (A := fun q => magneticScalarSlabMean L ζ q.1 q.2) + · intro z + have hc := (magneticHeatMean_hasFDerivAt P _ hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) ζ hv z).continuousAt + rw [← heq] at hc + have hp : ContinuousAt (fun t : ℝ => (t, z)) v := + continuousAt_id.prodMk continuousAt_const + exact ContinuousAt.comp' (f := fun t : ℝ => (t, z)) (x := v) hc hp + · exact Eventually.of_forall fun t => magneticScalarSlabMean_strictMono L hL hζ t + · exact Eventually.of_forall fun t => magneticScalarSlabMean_bias L hL hζ hs t + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarSlabEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarSlabEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..6caa7d252ca6d8795c84c05808fdb76835da99b0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarSlabEndpoint.lean @@ -0,0 +1,153 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabEndpoint +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabContinuation +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabCoefficient +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabZero + +namespace OAI + +/-! Uniform endpoint decay of the actual finite-tail square continuation. +The variance may vary arbitrarily as the prescribed spin tends to ±1. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSlabJet_value_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v z : ℝ) : + |(magneticScalarSlabJet L hL ζ v).value z| ≤ 1 := by + have htan : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hP := fieldScalarMean_regular L hL measurable_logCosh logCosh_linearGrowth + htan field_abs_tanh_le_one + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + exact fieldSpinTransition_bound ζ (Real.toNNReal v) hF.1 hF.2 hP.2 z + +lemma magneticScalarSlabJet_curvature_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ1 : ζ ≤ 1) (v z : ℝ) : + (magneticScalarSlabJet L hL ζ v).first z ≤ + 1 - ((magneticScalarSlabJet L hL ζ v).value z) ^ 2 := by + let P := magneticLogCoshMeanJet L hL + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + obtain ⟨K, _, bK⟩ := P.bValue + obtain ⟨C, _, bC⟩ := P.bFirst + have hb (y : ℝ) : P.first y + (P.value y) ^ 2 ≤ 1 := by + have hh := fieldScalarLogCoshSecond_le_spin_variance L hL hL1 y + change P.first y ≤ 1 - (P.value y) ^ 2 at hh + linarith + have hh := fieldCurvatureTransform_le_spin_variance hζ1 (Real.toNNReal v) + hF.1 hF.2 P.mValue P.mFirst bK bC hb z + simpa only [magneticScalarSlabJet, MagneticContinuationJet.transition, + fieldCurvatureTransform, fieldTiltSpatial, pow_two] using hh + +lemma magneticScalarSlabJet_third_ratio_bound_pos (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 < ζ) (v z : ℝ) : + |(magneticScalarSlabJet L hL ζ v).second z / + (magneticScalarSlabJet L hL ζ v).first z| ≤ + magneticThirdRatioCap ((ζ, 0) :: L) := by + let K := (ζ, Real.toNNReal v) :: L + have hK : ∀ av ∈ K, 0 < av.1 := by + intro av hav + rcases List.mem_cons.mp hav with h | h + · simpa only [h] using hζ + · exact hL av h + have hr := fieldScalarLogCoshThird_relative K hK z + have he := magneticScalarSlabJet_eq_cons L hL hζ v + have hp := magneticScalarSlabJet_curvature_pos L hL hζ.le v z + rw [abs_div, abs_of_pos hp] + apply (div_le_iff₀ hp).mpr + rw [he] + simpa only [K, magneticThirdRatioCap, magneticLogCoshMeanJet] using hr + +lemma magneticScalarSlabJet_third_ratio_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + |(magneticScalarSlabJet L hL ζ v).second z / + (magneticScalarSlabJet L hL ζ v).first z| ≤ + magneticThirdRatioCap ((ζ, 0) :: L) := by + rcases eq_or_lt_of_le hζ with he | hp + · subst ζ + have hq := magneticScalarSlabJet_curvature_pos L hL (le_refl (0 : ℝ)) v z + rw [abs_div, abs_of_pos hq] + apply (div_le_iff₀ hq).mpr + simpa only [magneticThirdRatioCap, abs_zero, mul_zero, add_zero] using + magneticScalarSlabJet_zero_third_relative L hL v z + · exact magneticScalarSlabJet_third_ratio_bound_pos L hL hp v z + +def magneticScalarSlabWeighted (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ v s : ℝ) : ℝ := + let J := magneticScalarSlabJet L hL ζ v + let K := magneticScalarSlabContinuationJet L hL A ζ v + let z := magneticScalarSlabBias L ζ v s + K.second z - K.first z * (J.second z / J.first z) + +lemma magneticScalarSlabContinuation_sandwich (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + (ζ v z : ℝ) : + ((magneticScalarSlabJet L hL ζ v).value z) ^ 2 ≤ + (magneticScalarSlabContinuationJet L hL A ζ v).value z ∧ + (magneticScalarSlabContinuationJet L hL A ζ v).value z ≤ 1 := by + let P := magneticLogCoshMeanJet L hL + let F := fieldScalarValue L (fun y => Real.log (Real.cosh y)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + obtain ⟨C, _, bC⟩ := P.bValue + have bP2 (y : ℝ) : |(P.value y) ^ 2| ≤ C ^ 2 := by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (bC y) 2 + have bA (y : ℝ) : |A.value y| ≤ 1 := by + rw [abs_of_nonneg ((sq_nonneg _).trans (hA y).1)] + exact (hA y).2 + have hsq := fieldSpinTransition_square_le ζ (Real.toNNReal v) hF.1 hF.2 P.mValue bC z + have hle := fieldSpinTransition_mono_test ζ (Real.toNNReal v) F + (P.mValue.pow_const 2) A.mValue bP2 bA (fun y => (hA y).1) z + exact ⟨hsq.trans hle, (le_abs_self _).trans + (fieldSpinTransition_bound ζ (Real.toNNReal v) hF.1 hF.2 bA z)⟩ + +theorem magneticScalarSlabWeighted_tendsto_endpoint {ι : Type*} {l : Filter ι} + (L : List (ℝ × ℝ≥0)) (hL : ∀ av ∈ L, 0 < av.1) + (hL1 : ∀ av ∈ L, av.1 ≤ 1) (A : MagneticContinuationJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ c : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hc : c = -1 ∨ c = 1) + (v s : ι → ℝ) (hs : ∀ᶠ i in l, |s i| < 1) (hslim : Tendsto s l (𝓝 c)) : + Tendsto (fun i => magneticScalarSlabWeighted L hL A ζ (v i) (s i)) l (𝓝 0) := by + let P := magneticLogCoshMeanJet L hL + let F := fieldScalarValue L (fun y => Real.log (Real.cosh y)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let J := fun i => magneticScalarSlabJet L hL ζ (v i) + let K := fun i => magneticScalarSlabContinuationJet L hL A ζ (v i) + let x := fun i => magneticScalarSlabBias L ζ (v i) (s i) + have hroot : Tendsto (fun i => (J i).value (x i)) l (𝓝 c) := by + apply hslim.congr' + filter_upwards [hs] with i hi + exact (magneticScalarSlabMean_bias L hL hζ hi (v i)).symm + have hshift (h : ℝ) : Tendsto (fun i => (J i).value (x i + h)) l (𝓝 c) := by + rcases hc with rfl | rfl + · exact magnetic_mean_shift_tendsto_neg_one (fun i => (J i).dValue) + (fun i => magneticScalarSlabJet_value_bound L hL ζ (v i)) + (fun i z => (magneticScalarSlabJet_curvature_pos L hL hζ (v i) z).le) + (fun i => magneticScalarSlabJet_curvature_bound L hL hL1 hζ1 (v i)) hroot h + · exact magnetic_mean_shift_tendsto_one (fun i => (J i).dValue) + (fun i => magneticScalarSlabJet_value_bound L hL ζ (v i)) + (fun i z => (magneticScalarSlabJet_curvature_pos L hL hζ (v i) z).le) + (fun i => magneticScalarSlabJet_curvature_bound L hL hL1 hζ1 (v i)) hroot h + obtain ⟨C, hC, bC⟩ := A.transition_second_uniform P ζ F hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) + obtain ⟨D, hD, bD⟩ := A.transition_third_uniform P ζ F hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) + have hc2 : c ^ 2 = 1 := by rcases hc with rfl | rfl <;> norm_num + have hends := magnetic_family_continuation_endpoint hc2 hC hD + (fun i => magneticScalarSlabContinuation_sandwich L hL A hA ζ (v i)) + (fun i => (K i).dValue) (fun i => (K i).dFirst) (fun i => (K i).dSecond) + (fun i => bC (Real.toNNReal (v i))) (fun i => bD (Real.toNNReal (v i))) hshift + exact magnetic_family_weighted_endpoint hends.1 hends.2 + (fun i => magneticScalarSlabJet_third_ratio_bound L hL hζ (v i) (x i)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarThird.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..24a5e71d82dc859f6d7f4d3bd7693e7741474861 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarThird.lean @@ -0,0 +1,121 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpatialThird + +namespace OAI + +/-! The third spatial derivative propagated through the finite scalar +recursion, with an explicit finite bound at every level. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldScalarThird : List (ℝ × ℝ≥0) → + (ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ) → (ℝ → ℝ) → ℝ → ℝ + | [], _, _, _, c => c + | av :: L, F, a, b, c => fieldThirdTransform av.1 av.2 + (fieldScalarValue L F) (fieldScalarMean L F a) + (fieldScalarSecond L F a b) (fieldScalarThird L F a b c) + +def fieldScalarThirdCap : List (ℝ × ℝ≥0) → ℝ → ℝ → ℝ → ℝ + | [], _, _, D => D + | av :: L, K, C, D => fieldThirdTransformCap av.1 K + (fieldScalarSecondCap L K C) (fieldScalarThirdCap L K C D) + +lemma fieldScalarThird_regular (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a b c : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (hb : Measurable b) (hc : Measurable c) + {K C D : ℝ} (hK : 0 ≤ K) + (ba : ∀ z, |a z| ≤ K) (bb : ∀ z, |b z| ≤ C) (bc : ∀ z, |c z| ≤ D) : + Measurable (fieldScalarThird L F a b c) ∧ + ∀ z, |fieldScalarThird L F a b c z| ≤ fieldScalarThirdCap L K C D := by + induction L with + | nil => exact ⟨hc, bc⟩ + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht hF hG + have hm := fieldScalarMean_regular L ht hF hG ha ba + have hq := fieldScalarSecond_regular L ht hF hG ha hb hK ba bb + have hr := ih ht + have hC : 0 ≤ fieldScalarSecondCap L K C := (abs_nonneg _).trans (hq.2 0) + exact ⟨measurable_fieldThirdTransform av.1 av.2 hv.1 hm.1 hq.1 hr.1, + fieldThirdTransform_bound av.1 av.2 hv.1 hv.2 hK hC hm.2 hq.2 hr.2⟩ + +lemma hasDerivAt_fieldScalarSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {F a b c : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (ha : Measurable a) (hb : Measurable b) (hc : Measurable c) + {K C D : ℝ} (hK : 0 ≤ K) + (ba : ∀ z, |a z| ≤ K) (bb : ∀ z, |b z| ≤ C) (bc : ∀ z, |c z| ≤ D) + (dF : ∀ z, HasDerivAt F (a z) z) + (da : ∀ z, HasDerivAt a (b z) z) + (db : ∀ z, HasDerivAt b (c z) z) (z : ℝ) : + HasDerivAt (fieldScalarSecond L F a b) (fieldScalarThird L F a b c z) z := by + induction L generalizing z with + | nil => exact db z + | cons av L ih => + have ht : ∀ bv ∈ L, 0 < bv.1 := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + have hv := fieldScalarValue_regular L ht hF hG + have hm := fieldScalarMean_regular L ht hF hG ha ba + have hq := fieldScalarSecond_regular L ht hF hG ha hb hK ba bb + have hr := fieldScalarThird_regular L ht hF hG ha hb hc hK ba bb bc + have hC : 0 ≤ fieldScalarSecondCap L K C := (abs_nonneg _).trans (hq.2 0) + have hd := hasDerivAt_fieldCurvatureTransform av.1 av.2 hv.1 hv.2 + hm.1 hq.1 hr.1 hK hC hm.2 hq.2 hr.2 + (hasDerivAt_fieldScalarValue L ht hF hG ha hK ba dF) + (hasDerivAt_fieldScalarMean L ht hF hG ha hb hK ba bb dF da) (ih ht) z + exact hd + +lemma field_logCosh_third_derivative (z : ℝ) : + HasDerivAt (fun y : ℝ => 1 / (Real.cosh y) ^ 2) + (-2 * Real.tanh z / (Real.cosh z) ^ 2) z := by + have hd := (hasDerivAt_const z (1 : ℝ)).div ((Real.hasDerivAt_cosh z).pow 2) + (pow_ne_zero 2 (Real.cosh_pos z).ne') + convert hd using 1 + simp only [Pi.pow_apply] + rw [Real.tanh_eq_sinh_div_cosh] + field_simp + ring + +lemma field_logCosh_third_bound (z : ℝ) : + |-2 * Real.tanh z / (Real.cosh z) ^ 2| ≤ 2 := by + have ht := field_abs_tanh_le_one z + have hq := field_tanh_second_bound z + have hh : |-2 * Real.tanh z / (Real.cosh z) ^ 2| = + 2 * |Real.tanh z| * |1 / (Real.cosh z) ^ 2| := by + rw [abs_div, abs_mul, abs_neg, abs_of_pos (by norm_num : (0 : ℝ) < 2), + abs_div, abs_one] + ring + rw [hh] + calc + _ ≤ 2 * 1 * 1 := mul_le_mul (mul_le_mul_of_nonneg_left ht (by norm_num)) hq + (abs_nonneg _) (by norm_num) + _ = 2 := by norm_num + +lemma hasDerivAt_fieldScalarLogCoshSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + HasDerivAt (fieldScalarSecond L (fun z => Real.log (Real.cosh z)) Real.tanh + (fun y => 1 / (Real.cosh y) ^ 2)) + (fieldScalarThird L (fun z => Real.log (Real.cosh z)) Real.tanh + (fun y => 1 / (Real.cosh y) ^ 2) + (fun y => -2 * Real.tanh y / (Real.cosh y) ^ 2) z) z := by + have hm : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + apply hasDerivAt_fieldScalarSecond L hL measurable_logCosh logCosh_linearGrowth + hm (by fun_prop) (by fun_prop) zero_le_one field_abs_tanh_le_one + field_tanh_second_bound field_logCosh_third_bound + · intro y + simpa only [Real.tanh_eq_sinh_div_cosh] using + (Real.hasDerivAt_cosh y).log (Real.cosh_pos y).ne' + · exact field_hasDerivAt_tanh + · exact field_logCosh_third_derivative + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarWeightedPDE.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarWeightedPDE.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d0693f8df68ad9b6c6da913cff7e15b30062295 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScalarWeightedPDE.lean @@ -0,0 +1,114 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatWeighted +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarSlabEndpoint +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarFourJet + +namespace OAI + +/-! The weighted continuation equation specialized to the actual finite +Ising tail. Its inverse coordinate is the proved minimizing bias. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticLogCoshMeanFourJet_derivative (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (z : ℝ) : + HasDerivAt (fieldScalarValue L (fun y => Real.log (Real.cosh y))) + ((magneticLogCoshMeanFourJet L hL).value z) z := by + have he := congrArg MagneticContinuationJet.value (magneticLogCoshMeanFourJet_eq L hL) + rw [he] + exact hasDerivAt_fieldScalarLogCosh L hL z + +def magneticScalarSlabFourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v : ℝ) : MagneticContinuationFourJet := + let P := magneticLogCoshMeanFourJet L hL + let hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + P.transition P.toMagneticContinuationJet ζ (Real.toNNReal v) + (fieldScalarValue L (fun y => Real.log (Real.cosh y))) hF.1 hF.2 + (magneticLogCoshMeanFourJet_derivative L hL) + +def magneticScalarSlabContinuationFourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ v : ℝ) : + MagneticContinuationFourJet := + let P := magneticLogCoshMeanFourJet L hL + let hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + A.transition P.toMagneticContinuationJet ζ (Real.toNNReal v) + (fieldScalarValue L (fun y => Real.log (Real.cosh y))) hF.1 hF.2 + (magneticLogCoshMeanFourJet_derivative L hL) + +lemma magneticScalarSlabFourJet_toJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v : ℝ) : + (magneticScalarSlabFourJet L hL ζ v).toMagneticContinuationJet = + magneticScalarSlabJet L hL ζ v := by + simp only [magneticScalarSlabFourJet, MagneticContinuationFourJet.transition, + magneticLogCoshMeanFourJet_eq, magneticScalarSlabJet] + +lemma magneticScalarSlabContinuationFourJet_toJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ v : ℝ) : + (magneticScalarSlabContinuationFourJet L hL A ζ v).toMagneticContinuationJet = + magneticScalarSlabContinuationJet L hL A.toMagneticContinuationJet ζ v := by + simp only [magneticScalarSlabContinuationFourJet, MagneticContinuationFourJet.transition, + magneticLogCoshMeanFourJet_eq, magneticScalarSlabContinuationJet] + +lemma magneticScalarSlabWeighted_eq_heat (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ v s : ℝ) : + magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v s = + magneticHeatWeighted (magneticLogCoshMeanFourJet L hL) A + (fieldScalarValue L (fun y => Real.log (Real.cosh y))) ζ + (v, magneticScalarSlabBias L ζ v s) := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + rw [magneticHeatWeighted_eq _ _ _ hF.1 hF.2 (magneticLogCoshMeanFourJet_derivative L hL)] + simp only [magneticWeightedJetValue, MagneticContinuationFourJet.transition, + magneticLogCoshMeanFourJet_eq, magneticScalarSlabWeighted, + magneticScalarSlabJet, magneticScalarSlabContinuationJet] + ring + +lemma magneticScalarSlabWeighted_eq_jet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ v s : ℝ) : + magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v s = + magneticWeightedJetValue (magneticScalarSlabFourJet L hL ζ v) + (magneticScalarSlabContinuationFourJet L hL A ζ v) (magneticScalarSlabBias L ζ v s) := by + unfold magneticWeightedJetValue magneticScalarSlabWeighted + rw [← magneticScalarSlabFourJet_toJet L hL ζ v, + ← magneticScalarSlabContinuationFourJet_toJet L hL A ζ v] + ring + +theorem magneticScalarSlabWeighted_hasDerivAt_time (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ v s : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (hs : |s| < 1) : + let J := magneticScalarSlabFourJet L hL ζ v + let K := magneticScalarSlabContinuationFourJet L hL A ζ v + let b := magneticScalarSlabBias L ζ v s + HasDerivAt (fun t => magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ t s) + ((J.first b) ^ 2 / 2 * magneticWeightedInverseSecond J K b + + (J.third b / J.first b - (J.second b) ^ 2 / (J.first b) ^ 2 + 2 * ζ * J.first b) * + magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v s) v := by + let P := magneticLogCoshMeanFourJet L hL + let F := fieldScalarValue L (fun y => Real.log (Real.cosh y)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hq : (P.toMagneticContinuationJet.transition P.toMagneticContinuationJet ζ + (Real.toNNReal v) F hF.1 hF.2 (magneticLogCoshMeanFourJet_derivative L hL)).first + (magneticScalarSlabBias L ζ v s) ≠ 0 := by + have hp := (magneticScalarSlabJet_curvature_pos L hL hζ v + (magneticScalarSlabBias L ζ v s)).ne' + simpa only [P, magneticLogCoshMeanFourJet_eq, magneticScalarSlabJet, F] using hp + have he : ∀ᶠ t in 𝓝 v, magneticHeatMean P.toMagneticContinuationJet F ζ + (t, magneticScalarSlabBias L ζ t s) = s := by + filter_upwards [] with t + simp only [P, F, magneticLogCoshMeanFourJet_eq] + rw [← magneticScalarSlabMean_eq L hL] + exact magneticScalarSlabMean_bias L hL hζ hs t + have hd := magneticHeatWeighted_inverse_hasDerivAt P A F hF.1 hF.2 + (magneticLogCoshMeanFourJet_derivative L hL) ζ hv + (magneticScalarSlabBias_continuousAt_variance L hL hζ hs hv) he hq + simpa only [← magneticScalarSlabWeighted_eq_heat, magneticScalarSlabFourJet, + magneticScalarSlabContinuationFourJet, P, F, + magneticScalarSlabWeighted_eq_jet] using hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledBounds.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b802e8188f20b9be621220896b83c86075998d27 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledBounds.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledInitial +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabZero + +namespace OAI + +/-! Uniform coefficient bounds for the actual radially scaled inverse +curvature, including its ordinary zero-exponent Gaussian step. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma closedMagneticScalarCurvature_weighted_second_bound_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (p : ℝ × ℝ) : + |closedMagneticScalarCurvature L hL ζ p * closedMagneticScalarSecond L hL ζ p| ≤ + magneticSlabPotentialCap L ζ := by + rcases eq_or_lt_of_le hζ with he | hp + · subst ζ + by_cases hs : |p.2| < 1 + · simpa only [closedMagneticScalarCurvature, closedMagneticScalarSecond, hs, ite_true] using + magneticScalarInverse_zero_weighted_second_bound L hL hL1 p.1 p.2 + · simp only [closedMagneticScalarCurvature, closedMagneticScalarSecond, hs, ite_false, + mul_zero, abs_zero] + exact add_nonneg (magneticFourthRatioCap_nonneg _) (sq_nonneg _) + · exact closedMagneticScalarCurvature_weighted_second_bound L hL hL1 hp hζ1 p + +lemma magneticScaledClosedCurvature_weighted_second_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) (α : ℝ≥0) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (p : ℝ × ℝ) : + |magneticScaledClosedCurvature L hL α ζ p * magneticScaledClosedSecond L hL α ζ p| ≤ + (α : ℝ) ^ 2 * magneticSlabPotentialCap L ζ := by + have hb := closedMagneticScalarCurvature_weighted_second_bound_nonneg + (fieldScaleIncrements α L) (fieldScaleIncrements_positive α L hL) + (fieldScaleIncrements_exponent_le_one α L hL1) hζ hζ1 ((α : ℝ) ^ 2 * p.1, p.2) + rw [magneticSlabPotentialCap_scale] at hb + dsimp only [magneticScaledClosedCurvature, magneticScaledClosedSecond] + rw [show (α : ℝ) * closedMagneticScalarCurvature (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2) * + ((α : ℝ) * closedMagneticScalarSecond (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2)) = + (α : ℝ) ^ 2 * (closedMagneticScalarCurvature (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2) * + closedMagneticScalarSecond (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2)) by ring, + abs_mul, abs_of_nonneg (sq_nonneg (α : ℝ))] + exact mul_le_mul_of_nonneg_left hb (sq_nonneg _) + +lemma magneticScaledClosedCurvature_endpoints (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (ζ v : ℝ) : + magneticScaledClosedCurvature L hL α ζ (v, -1) = 0 ∧ + magneticScaledClosedCurvature L hL α ζ (v, 1) = 0 := by + obtain ⟨hl, hr⟩ := closedMagneticScalarCurvature_endpoints (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * v) + simp only [magneticScaledClosedCurvature, hl, hr, mul_zero, and_self] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledContinuation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledContinuation.lean new file mode 100644 index 0000000000000000000000000000000000000000..cad17427554a9fef8a414de114f92ea0a103bce0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledContinuation.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationClosedPDE +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledCurvatureOrder + +namespace OAI + +/-! The actual square continuation in the rescaled physical variance. +Its diffusion coefficient is the rescaled inverse curvature. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticScaledSquareJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) : + MagneticContinuationJet := + (magneticScalarSquareFourJet (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) + (Fin.cast (by rw [fieldScaleIncrements_length]) i)).toMagneticContinuationJet + +def magneticScaledSquareContinuation (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + closedMagneticContinuation (fieldScaleIncrements α L) + (magneticScaledSquareJet L hL α i) ζ ((α : ℝ) ^ 2 * p.1, p.2) + +def magneticScaledSquareSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + closedMagneticContinuationSlope (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (magneticScaledSquareJet L hL α i) + ζ ((α : ℝ) ^ 2 * p.1, p.2) + +def magneticScaledSquareSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + closedMagneticContinuationSecond (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (magneticScaledSquareJet L hL α i) + ζ ((α : ℝ) ^ 2 * p.1, p.2) + +def magneticScaledSquareTime (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (magneticScaledClosedCurvature L hL α ζ p) ^ 2 / 2 * + magneticScaledSquareSecond L hL α i ζ p + +lemma magneticScaledSquareContinuation_continuousOn (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + {ζ : ℝ} (hζ : 0 ≤ ζ) : + ContinuousOn (magneticScaledSquareContinuation L hL α i ζ) + (univ ×ˢ Icc (-1 : ℝ) 1) := by + have hc := continuousOn_closedMagneticContinuation (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (magneticScaledSquareJet L hL α i) + (magneticScalarSquareFourJet_sandwich _ _ _) hζ + have hm : Continuous (fun p : ℝ × ℝ => ((α : ℝ) ^ 2 * p.1, p.2)) := by fun_prop + exact hc.comp hm.continuousOn (fun p hp => ⟨mem_univ _, hp.2⟩) + +lemma magneticScaledSquareContinuation_hasDerivAt_time (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {α : ℝ≥0} (hα : 0 < α) + (i : Fin (L.length + 1)) {ζ v : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (s : ℝ) : + HasDerivAt (fun t => magneticScaledSquareContinuation L hL α i ζ (t, s)) + (magneticScaledSquareTime L hL α i ζ (v, s)) v := by + have hαr : 0 < (α : ℝ) := hα + have hd := closedMagneticContinuation_hasDerivAt_time (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (magneticScaledSquareJet L hL α i) + hζ (mul_pos (sq_pos_of_pos hαr) hv) s + have ht := hd.comp v ((hasDerivAt_id v).const_mul ((α : ℝ) ^ 2)) + convert ht using 1 + · rfl + · simp only [magneticScaledSquareTime, magneticScaledClosedCurvature, + magneticScaledSquareSecond, closedMagneticContinuationTime] + ring + +lemma magneticScaledSquareContinuation_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => magneticScaledSquareContinuation L hL α i ζ (v, u)) + (magneticScaledSquareSlope L hL α i ζ (v, s)) s := + closedMagneticContinuation_hasDerivAt_spin (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (magneticScaledSquareJet L hL α i) + hζ hs ((α : ℝ) ^ 2 * v) + +lemma magneticScaledSquareSlope_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (i : Fin (L.length + 1)) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => magneticScaledSquareSlope L hL α i ζ (v, u)) + (magneticScaledSquareSecond L hL α i ζ (v, s)) s := + closedMagneticContinuationSlope_hasDerivAt_spin (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (magneticScaledSquareJet L hL α i) + hζ hs ((α : ℝ) ^ 2 * v) + +lemma magneticScaledSquareSecond_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (α : ℝ≥0) (i : Fin (L.length + 1)) {ζ v : ℝ} + (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hv : 0 ≤ v) (s : ℝ) : + 0 ≤ magneticScaledSquareSecond L hL α i ζ (v, s) := + closedMagneticSquareContinuationSecond_nonneg (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (fieldScaleIncrements_exponent_le_one α L hL1) + _ hζ hζ1 (mul_nonneg (sq_nonneg _) hv) s + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledCurvatureOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledCurvatureOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e9254fc1883f893241aa32f5676ea992d80705a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledCurvatureOrder.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledBounds +import OAI.Probability.InvariantIsing.Magnetic.MagneticBoundedInverseComparison + +namespace OAI + +/-! Radial comparison of the actual inverse curvatures. The proof follows +all finite Gaussian levels, starting from α(1-s²) at the Ising terminal. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma magneticScaledClosedCurvature_mono_of_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {α β : ℝ≥0} (hα : 0 < α) (hαβ : α ≤ β) {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hinit : ∀ u ∈ Icc (-1 : ℝ) 1, + magneticScaledClosedCurvature L hL α ζ (0, u) ≤ + magneticScaledClosedCurvature L hL β ζ (0, u)) + {v s : ℝ} (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + magneticScaledClosedCurvature L hL α ζ (v, s) ≤ + magneticScaledClosedCurvature L hL β ζ (v, s) := by + have hβ : 0 < β := hα.trans_le hαβ + have hall := inverse_curvature_parabolic_comparison_bound hv + (show 0 ≤ (β : ℝ) * ζ from mul_nonneg β.coe_nonneg hζ) + (mul_le_mul_of_nonneg_right (show (α : ℝ) ≤ (β : ℝ) from hαβ) hζ) + (magneticScaledClosedCurvature L hL α ζ) (magneticScaledClosedTime L hL α ζ) + (magneticScaledClosedSlope L hL α ζ) (magneticScaledClosedSecond L hL α ζ) + (magneticScaledClosedCurvature L hL β ζ) (magneticScaledClosedTime L hL β ζ) + (magneticScaledClosedSlope L hL β ζ) (magneticScaledClosedSecond L hL β ζ) + ((magneticScaledClosedCurvature_continuousOn L hL hL1 α hζ hζ1).mono + (fun p hp => ⟨mem_univ _, hp.2⟩)) + ((magneticScaledClosedCurvature_continuousOn L hL hL1 β hζ hζ1).mono + (fun p hp => ⟨mem_univ _, hp.2⟩)) hinit + (fun t ht u _ => (magneticScaledClosedCurvature_hasDerivAt_time L hL hα hζ ht.1 u).hasDerivWithinAt) + (fun t ht u _ => (magneticScaledClosedCurvature_hasDerivAt_time L hL hβ hζ ht.1 u).hasDerivWithinAt) + (fun t _ u hu => magneticScaledClosedCurvature_hasDerivAt_spin L hL α hζ (abs_lt.mpr hu) t) + (fun t _ u hu => magneticScaledClosedCurvature_hasDerivAt_spin L hL β hζ (abs_lt.mpr hu) t) + (fun t _ u hu => magneticScaledClosedSlope_hasDerivAt_spin L hL α hζ (abs_lt.mpr hu) t) + (fun t _ u hu => magneticScaledClosedSlope_hasDerivAt_spin L hL β hζ (abs_lt.mpr hu) t) + (fun p hp => (magneticScaledClosedCurvature_mem_interval L hL hL1 α hζ hζ1 p hp.2).1) + (fun p hp => (magneticScaledClosedCurvature_mem_interval L hL hL1 β hζ hζ1 p hp.2).1) + (fun p hp => (magneticScaledClosedCurvature_mem_interval L hL hL1 α hζ hζ1 p hp.2).2) + (fun p _ => magneticScaledClosedCurvature_weighted_second_bound L hL hL1 α hζ hζ1 p) + (fun t _ => by + obtain ⟨hαm, hαp⟩ := magneticScaledClosedCurvature_endpoints L hL α ζ t + obtain ⟨hβm, hβp⟩ := magneticScaledClosedCurvature_endpoints L hL β ζ t + exact ⟨hαm, hβm, hαp, hβp⟩) + (fun _ _ => rfl) (fun _ _ => rfl) + exact hall (v, s) ⟨⟨hv, le_rfl⟩, hs⟩ + +theorem magneticScaledClosedCurvature_mono (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {α β : ℝ≥0} (hα : 0 < α) (hαβ : α ≤ β) {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + {v s : ℝ} (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + magneticScaledClosedCurvature L hL α ζ (v, s) ≤ + magneticScaledClosedCurvature L hL β ζ (v, s) := by + induction L generalizing ζ v s with + | nil => + apply magneticScaledClosedCurvature_mono_of_initial [] hL hL1 hα hαβ hζ hζ1 ?_ hv hs + intro u hu + rw [magneticScaledClosedCurvature_nil_initial hζ hu, + magneticScaledClosedCurvature_nil_initial hζ hu] + have hu2 : 0 ≤ 1 - u ^ 2 := by nlinarith [hu.1, hu.2] + exact mul_le_mul_of_nonneg_right (show (α : ℝ) ≤ (β : ℝ) from hαβ) hu2 + | cons av L ih => + apply magneticScaledClosedCurvature_mono_of_initial (av :: L) hL hL1 hα hαβ hζ hζ1 ?_ hv hs + intro u hu + rw [magneticScaledClosedCurvature_cons_initial, magneticScaledClosedCurvature_cons_initial] + exact ih (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + (fun bv hb => hL1 bv (List.mem_cons_of_mem av hb)) + (hL av List.mem_cons_self).le (hL1 av List.mem_cons_self) av.2.property hu + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledInitial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..0265948dbd303c565db2e19f2ee2d359fc849dcb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledInitial.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledSlab +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedInitial + +namespace OAI + +/-! Exact initial-data identification for induction over physical Gaussian +increments in the radial inverse-curvature comparison. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSlabBias_cons_initial (av : ℝ × ℝ≥0) (L : List (ℝ × ℝ≥0)) + (ζ s : ℝ) : + magneticScalarSlabBias (av :: L) ζ 0 s = magneticScalarSlabBias L av.1 (av.2 : ℝ) s := by + unfold magneticScalarSlabBias + apply congrArg (fun f : ℝ → ℝ => Function.invFun f s) + funext z + rw [magneticScalarSlabMean_zero] + simp only [fieldScalarMean, magneticScalarSlabMean, Real.toNNReal_coe] + +lemma magneticScalarInverseCurvature_cons_initial (av : ℝ × ℝ≥0) (L : List (ℝ × ℝ≥0)) + (hL : ∀ bv ∈ av :: L, 0 < bv.1) (ζ s : ℝ) : + magneticScalarInverseCurvature (av :: L) hL ζ 0 s = + magneticScalarInverseCurvature L (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + av.1 (av.2 : ℝ) s := by + have hp : 0 < av.1 := hL av List.mem_cons_self + rw [magneticScalarInverseCurvature_eq_jet, magneticScalarSlabJet_zero, + magneticScalarSlabBias_cons_initial, magneticScalarInverseCurvature_eq_jet, + magneticScalarSlabJet_eq_cons L _ hp] + simp only [Real.toNNReal_coe] + +lemma magneticScaledClosedCurvature_cons_initial (av : ℝ × ℝ≥0) + (L : List (ℝ × ℝ≥0)) (hL : ∀ bv ∈ av :: L, 0 < bv.1) + (α : ℝ≥0) (ζ s : ℝ) : + magneticScaledClosedCurvature (av :: L) hL α ζ (0, s) = + magneticScaledClosedCurvature L (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + α av.1 ((av.2 : ℝ), s) := by + by_cases hs : |s| < 1 + · simp only [magneticScaledClosedCurvature, mul_zero, fieldScaleIncrements, List.map_cons, + closedMagneticScalarCurvature, hs, ite_true] + rw [magneticScalarInverseCurvature_cons_initial] + rfl + · simp only [magneticScaledClosedCurvature, closedMagneticScalarCurvature, hs, ite_false, mul_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledSlab.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledSlab.lean new file mode 100644 index 0000000000000000000000000000000000000000..0835f74d011a574b397e60cfa3d2fb4ec98604fb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledSlab.lean @@ -0,0 +1,140 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabClosedDerivatives +import OAI.Probability.InvariantIsing.Fields.FieldScalarScaling + +namespace OAI + +/-! The literal scaled inverse curvature used in the radial comparison. +Time is physical variance; its scaling yields the coefficient αζ. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma fieldScaleIncrements_positive (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : + ∀ av ∈ fieldScaleIncrements c L, 0 < av.1 := by + intro av hav + obtain ⟨bv, hb, rfl⟩ := List.mem_map.mp hav + exact hL bv hb + +lemma fieldScaleIncrements_exponent_le_one (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) + (hL1 : ∀ av ∈ L, av.1 ≤ 1) : + ∀ av ∈ fieldScaleIncrements c L, av.1 ≤ 1 := by + intro av hav + obtain ⟨bv, hb, rfl⟩ := List.mem_map.mp hav + exact hL1 bv hb + +lemma magneticThirdRatioCap_scale (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) : + magneticThirdRatioCap (fieldScaleIncrements c L) = magneticThirdRatioCap L := by + induction L with + | nil => rfl + | cons av L ih => simp only [fieldScaleIncrements, List.map_cons, magneticThirdRatioCap] at *; rw [ih] + +lemma magneticFourthRatioCap_scale (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) : + magneticFourthRatioCap (fieldScaleIncrements c L) = magneticFourthRatioCap L := by + induction L with + | nil => rfl + | cons av L ih => + change magneticFourthRatioCap (fieldScaleIncrements c L) + + 8 * |av.1| * magneticThirdRatioCap (fieldScaleIncrements c L) + 3 * |av.1| + 37 * av.1 ^ 2 = _ + rw [ih, magneticThirdRatioCap_scale] + rfl + +lemma magneticSlabPotentialCap_scale (c : ℝ≥0) (L : List (ℝ × ℝ≥0)) (ζ : ℝ) : + magneticSlabPotentialCap (fieldScaleIncrements c L) ζ = magneticSlabPotentialCap L ζ := by + simp only [magneticSlabPotentialCap, magneticFourthRatioCap, magneticThirdRatioCap, + magneticFourthRatioCap_scale, magneticThirdRatioCap_scale] + +def magneticScaledClosedCurvature (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (α : ℝ) * closedMagneticScalarCurvature (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2) + +def magneticScaledClosedSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (α : ℝ) * closedMagneticScalarSlope (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2) + +def magneticScaledClosedSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (α : ℝ) * closedMagneticScalarSecond (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) ζ ((α : ℝ) ^ 2 * p.1, p.2) + +def magneticScaledClosedTime (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + (magneticScaledClosedCurvature L hL α ζ p) ^ 2 / 2 * magneticScaledClosedSecond L hL α ζ p + + ((α : ℝ) * ζ) * (magneticScaledClosedCurvature L hL α ζ p) ^ 2 + +lemma magneticScaledClosedCurvature_hasDerivAt_time (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {α : ℝ≥0} (hα : 0 < α) + {ζ v : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (s : ℝ) : + HasDerivAt (fun t => magneticScaledClosedCurvature L hL α ζ (t, s)) + (magneticScaledClosedTime L hL α ζ (v, s)) v := by + have hαr : 0 < (α : ℝ) := hα + have ht := closedMagneticScalarCurvature_hasDerivAt_time (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) hζ (mul_pos (sq_pos_of_pos hαr) hv) s + have hd := (ht.comp v ((hasDerivAt_id v).const_mul ((α : ℝ) ^ 2))).const_mul (α : ℝ) + convert hd using 1 + · rfl + · simp only [magneticScaledClosedTime, magneticScaledClosedCurvature, + magneticScaledClosedSecond, closedMagneticScalarTime] + ring + +lemma magneticScaledClosedCurvature_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => magneticScaledClosedCurvature L hL α ζ (v, u)) + (magneticScaledClosedSlope L hL α ζ (v, s)) s := + (closedMagneticScalarCurvature_hasDerivAt_spin (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) hζ hs ((α : ℝ) ^ 2 * v)).const_mul (α : ℝ) + +lemma magneticScaledClosedSlope_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => magneticScaledClosedSlope L hL α ζ (v, u)) + (magneticScaledClosedSecond L hL α ζ (v, s)) s := + (closedMagneticScalarSlope_hasDerivAt_spin (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) hζ hs ((α : ℝ) ^ 2 * v)).const_mul (α : ℝ) + +lemma magneticScaledClosedCurvature_nil_initial {α : ℝ≥0} {ζ s : ℝ} + (hζ : 0 ≤ ζ) (hs : s ∈ Icc (-1 : ℝ) 1) : + magneticScaledClosedCurvature [] (by simp) α ζ (0, s) = (α : ℝ) * (1 - s ^ 2) := by + simp only [magneticScaledClosedCurvature, mul_zero, fieldScaleIncrements, List.map_nil] + by_cases hsi : |s| < 1 + · simp only [closedMagneticScalarCurvature, hsi, ite_true] + rw [magneticScalarInverseCurvature_nil_initial hζ hsi] + · have habs : |s| = 1 := le_antisymm (abs_le.mpr hs) (le_of_not_gt hsi) + have hsq : s ^ 2 = 1 := by + rw [← sq_abs, habs] + norm_num + simp only [closedMagneticScalarCurvature, hsi, ite_false, hsq, sub_self, mul_zero] + +lemma magneticScaledClosedCurvature_continuousOn (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) (α : ℝ≥0) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) : + ContinuousOn (magneticScaledClosedCurvature L hL α ζ) (univ ×ˢ Icc (-1 : ℝ) 1) := by + have hc := continuousOn_closedMagneticScalarCurvature (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (fieldScaleIncrements_exponent_le_one α L hL1) + hζ hζ1 + have hm : Continuous (fun p : ℝ × ℝ => ((α : ℝ) ^ 2 * p.1, p.2)) := by fun_prop + exact continuousOn_const.mul (hc.comp hm.continuousOn (fun p hp => ⟨mem_univ _, hp.2⟩)) + +lemma magneticScaledClosedCurvature_mem_interval (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) (α : ℝ≥0) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (p : ℝ × ℝ) + (hp : p.2 ∈ Icc (-1 : ℝ) 1) : + magneticScaledClosedCurvature L hL α ζ p ∈ Icc 0 (α : ℝ) := by + have h0 := closedMagneticScalarCurvature_nonneg (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) hζ ((α : ℝ) ^ 2 * p.1, p.2) + have h1 := closedMagneticScalarCurvature_le_one (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) (fieldScaleIncrements_exponent_le_one α L hL1) + hζ hζ1 ((α : ℝ) ^ 2 * p.1, p.2) hp + exact ⟨mul_nonneg α.coe_nonneg h0, (mul_le_mul_of_nonneg_left h1 α.coe_nonneg).trans_eq (mul_one _)⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledSquareOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledSquareOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..155f2f761a7c6d4d9a1ac7dba06ac8db1ab428fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticScaledSquareOrder.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareInitial +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationComparison + +namespace OAI + +/-! Radial order for the actual conditional square means in inverse +magnetization coordinates, including a final ordinary Gaussian level. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma magneticScaledSquareContinuation_mono_of_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {α β : ℝ≥0} (hα : 0 < α) (hαβ : α ≤ β) (i : Fin (L.length + 1)) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hinit : ∀ u ∈ Icc (-1 : ℝ) 1, + magneticScaledSquareContinuation L hL α i ζ (0, u) ≤ + magneticScaledSquareContinuation L hL β i ζ (0, u)) + {v s : ℝ} (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + magneticScaledSquareContinuation L hL α i ζ (v, s) ≤ + magneticScaledSquareContinuation L hL β i ζ (v, s) := by + have hβ : 0 < β := hα.trans_le hαβ + have hall := magnetic_continuation_coefficient_comparison hv + (magneticScaledSquareContinuation L hL α i ζ) (magneticScaledSquareTime L hL α i ζ) + (magneticScaledSquareSlope L hL α i ζ) (magneticScaledSquareSecond L hL α i ζ) + (magneticScaledSquareContinuation L hL β i ζ) (magneticScaledSquareTime L hL β i ζ) + (magneticScaledSquareSlope L hL β i ζ) (magneticScaledSquareSecond L hL β i ζ) + (magneticScaledClosedCurvature L hL α ζ) (magneticScaledClosedCurvature L hL β ζ) + ((magneticScaledSquareContinuation_continuousOn L hL α i hζ).mono + (fun p hp => ⟨mem_univ _, hp.2⟩)) + ((magneticScaledSquareContinuation_continuousOn L hL β i hζ).mono + (fun p hp => ⟨mem_univ _, hp.2⟩)) hinit + (fun t ht u _ => (magneticScaledSquareContinuation_hasDerivAt_time L hL hα i hζ ht.1 u).hasDerivWithinAt) + (fun t ht u _ => (magneticScaledSquareContinuation_hasDerivAt_time L hL hβ i hζ ht.1 u).hasDerivWithinAt) + (fun t _ u hu => magneticScaledSquareContinuation_hasDerivAt_spin L hL α i hζ (abs_lt.mpr hu) t) + (fun t _ u hu => magneticScaledSquareContinuation_hasDerivAt_spin L hL β i hζ (abs_lt.mpr hu) t) + (fun t _ u hu => magneticScaledSquareSlope_hasDerivAt_spin L hL α i hζ (abs_lt.mpr hu) t) + (fun t _ u hu => magneticScaledSquareSlope_hasDerivAt_spin L hL β i hζ (abs_lt.mpr hu) t) + (fun p hp => (magneticScaledClosedCurvature_mem_interval L hL hL1 α hζ hζ1 p hp.2).1) + (fun p hp => magneticScaledClosedCurvature_mono L hL hL1 hα hαβ hζ hζ1 hp.1.1 hp.2) + (fun p hp => magneticScaledSquareSecond_nonneg L hL hL1 α i hζ hζ1 hp.1.1.le p.2) + (fun t _ => magneticScaledClosedCurvature_endpoints L hL β ζ t) + (fun _ _ => rfl) (fun _ _ => rfl) + exact hall (v, s) ⟨⟨hv, le_rfl⟩, hs⟩ + +theorem magneticScaledSquareContinuation_mono (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {α β : ℝ≥0} (hα : 0 < α) (hαβ : α ≤ β) (i : Fin (L.length + 1)) + {ζ v s : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + magneticScaledSquareContinuation L hL α i ζ (v, s) ≤ + magneticScaledSquareContinuation L hL β i ζ (v, s) := by + induction L generalizing ζ v s with + | nil => + have hi : i = 0 := by + apply Fin.ext + change i.val = 0 + have h := i.isLt + change i.val < 1 at h + omega + subst i + apply magneticScaledSquareContinuation_mono_of_initial [] hL hL1 hα hαβ 0 hζ hζ1 ?_ hv hs + intro u hu + rw [magneticScaledSquareContinuation_zero_initial [] hL α hζ hu, + magneticScaledSquareContinuation_zero_initial [] hL β hζ hu] + | cons av L ih => + refine Fin.cases ?_ (fun j => ?_) i + · apply magneticScaledSquareContinuation_mono_of_initial (av :: L) hL hL1 hα hαβ 0 hζ hζ1 ?_ hv hs + intro u hu + rw [magneticScaledSquareContinuation_zero_initial (av :: L) hL α hζ hu, + magneticScaledSquareContinuation_zero_initial (av :: L) hL β hζ hu] + · apply magneticScaledSquareContinuation_mono_of_initial (av :: L) hL hL1 hα hαβ j.succ hζ hζ1 ?_ hv hs + intro u hu + rw [magneticScaledSquareContinuation_cons_initial, + magneticScaledSquareContinuation_cons_initial] + exact ih (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + (fun bv hb => hL1 bv (List.mem_cons_of_mem av hb)) j + (hL av List.mem_cons_self).le (hL1 av List.mem_cons_self) av.2.property hu + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabBoundary.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..c629cca9d500c82526db5c2a560d883ce66097c3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabBoundary.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatContinuity +import OAI.Probability.InvariantIsing.Magnetic.MagneticCurvatureBound + +namespace OAI + +/-! The actual slab inverse curvature extends continuously to both spin +endpoints. The uniform bound by 1-s² gives joint boundary continuity in +the variance parameter without an asymptotic expansion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarInverseCurvature_pos (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v s : ℝ) : + 0 < magneticScalarInverseCurvature L hL ζ v s := by + rw [magneticScalarInverseCurvature_eq] + exact magneticScalarSlab_curvature_pos L hL hζ v _ + +lemma magneticScalarInverseCurvature_le_spin_variance (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hs : |s| < 1) (v : ℝ) : + magneticScalarInverseCurvature L hL ζ v s ≤ 1 - s ^ 2 := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let P := magneticLogCoshMeanJet L hL + obtain ⟨K, _, bK⟩ := P.bValue + obtain ⟨C, _, bC⟩ := P.bFirst + have hbound (y : ℝ) : P.first y + (P.value y) ^ 2 ≤ 1 := by + have hh := fieldScalarLogCoshSecond_le_spin_variance L hL hL1 y + change P.first y ≤ 1 - (P.value y) ^ 2 at hh + linarith + have hh := fieldCurvatureTransform_le_spin_variance hζ1 (Real.toNNReal v) + hF.1 hF.2 P.mValue P.mFirst bK bC hbound (magneticScalarSlabBias L ζ v s) + change _ ≤ 1 - (magneticScalarSlabMean L ζ v (magneticScalarSlabBias L ζ v s)) ^ 2 at hh + rw [magneticScalarSlabMean_bias L hL hζ hs v] at hh + rwa [magneticScalarInverseCurvature_eq] + +lemma magneticScalarInverseCurvature_continuousAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s v : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) : + ContinuousAt (fun q : ℝ × ℝ => magneticScalarInverseCurvature L hL ζ q.1 q.2) (v, s) := by + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hc : Continuous (fieldScalarValue L (fun z => Real.log (Real.cosh z))) := + continuous_iff_continuousAt.mpr fun z => + (hasDerivAt_fieldScalarLogCosh L hL z).continuousAt + have hh := continuous_magneticHeatCurvature (magneticLogCoshMeanJet L hL) _ hc hF.2 ζ + have hb := magneticScalarSlabBias_continuousAt_joint L hL hζ (v := v) hs + exact hh.continuousAt.comp' (continuousAt_fst.prodMk hb) + +def closedMagneticScalarCurvature (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + if |q.2| < 1 then magneticScalarInverseCurvature L hL ζ q.1 q.2 else 0 + +lemma closedMagneticScalarCurvature_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (q : ℝ × ℝ) : + 0 ≤ closedMagneticScalarCurvature L hL ζ q := by + unfold closedMagneticScalarCurvature + split_ifs + · exact (magneticScalarInverseCurvature_pos L hL hζ q.1 q.2).le + · exact le_rfl + +lemma closedMagneticScalarCurvature_le_spin_variance (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (q : ℝ × ℝ) (hq : q.2 ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature L hL ζ q ≤ 1 - q.2 ^ 2 := by + unfold closedMagneticScalarCurvature + split_ifs with hs + · exact magneticScalarInverseCurvature_le_spin_variance L hL hL1 hζ hζ1 hs q.1 + · have hh := mul_nonneg (by linarith [hq.1] : 0 ≤ q.2 + 1) + (by linarith [hq.2] : 0 ≤ 1 - q.2) + nlinarith + +lemma continuousOn_closedMagneticScalarCurvature (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) : + ContinuousOn (closedMagneticScalarCurvature L hL ζ) + (univ ×ˢ Icc (-1 : ℝ) 1) := by + intro p hp + by_cases hs : |p.2| < 1 + · have he : closedMagneticScalarCurvature L hL ζ =ᶠ[𝓝 p] + (fun q => magneticScalarInverseCurvature L hL ζ q.1 q.2) := by + filter_upwards [(isOpen_lt continuous_snd.abs continuous_const).mem_nhds hs] with q hq + exact ite_eq_left hq + exact ((magneticScalarInverseCurvature_continuousAt L hL hζ hs).congr_of_eventuallyEq he).continuousWithinAt + · have hps : |p.2| = 1 := le_antisymm (abs_le.mpr hp.2) (le_of_not_gt hs) + have hps2 : p.2 ^ 2 = 1 := by nlinarith [sq_abs p.2] + have he : closedMagneticScalarCurvature L hL ζ p = 0 := ite_eq_right hs + change Tendsto (closedMagneticScalarCurvature L hL ζ) + (𝓝[univ ×ˢ Icc (-1 : ℝ) 1] p) (𝓝 _) + rw [he] + have hg : Tendsto (fun q : ℝ × ℝ => 1 - q.2 ^ 2) + (𝓝[univ ×ˢ Icc (-1 : ℝ) 1] p) (𝓝 0) := by + have hc : ContinuousWithinAt (fun q : ℝ × ℝ => 1 - q.2 ^ 2) + (univ ×ˢ Icc (-1 : ℝ) 1) p := by fun_prop + change Tendsto _ _ (𝓝 (1 - p.2 ^ 2)) at hc + simpa only [hps2, sub_self] using hc + apply squeeze_zero' (Eventually.of_forall (closedMagneticScalarCurvature_nonneg L hL hζ)) ?_ hg + filter_upwards [self_mem_nhdsWithin] with q hq + exact closedMagneticScalarCurvature_le_spin_variance L hL hL1 hζ hζ1 q hq.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabClosedDerivatives.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabClosedDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dfecda4463637f4d1df5693bbec7929934fd3ed --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabClosedDerivatives.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabCoefficient +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabInitial + +namespace OAI + +/-! Closed-spin-interval derivatives of the finite slab. The two endpoints +are constant zero in time, while all spatial derivatives are used only +in the open spin interval. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def closedMagneticScalarSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + if |q.2| < 1 then magneticScalarInverseSlope L hL ζ q.1 q.2 else 0 + +def closedMagneticScalarSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + if |q.2| < 1 then magneticScalarInverseSecond L hL ζ q.1 q.2 else 0 + +def closedMagneticScalarTime (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) (q : ℝ × ℝ) : ℝ := + (closedMagneticScalarCurvature L hL ζ q) ^ 2 / 2 * closedMagneticScalarSecond L hL ζ q + + ζ * (closedMagneticScalarCurvature L hL ζ q) ^ 2 + +lemma closedMagneticScalarCurvature_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => closedMagneticScalarCurvature L hL ζ (v, u)) + (closedMagneticScalarSlope L hL ζ (v, s)) s := by + have he : (fun u => closedMagneticScalarCurvature L hL ζ (v, u)) =ᶠ[𝓝 s] + magneticScalarInverseCurvature L hL ζ v := by + filter_upwards [(isOpen_lt continuous_id.abs continuous_const).mem_nhds hs] with u hu + exact ite_eq_left hu + simpa only [closedMagneticScalarSlope, hs, ite_true] using + (magneticScalarInverseCurvature_hasDerivAt_spin L hL hζ hs v).congr_of_eventuallyEq he + +lemma closedMagneticScalarSlope_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => closedMagneticScalarSlope L hL ζ (v, u)) + (closedMagneticScalarSecond L hL ζ (v, s)) s := by + have he : (fun u => closedMagneticScalarSlope L hL ζ (v, u)) =ᶠ[𝓝 s] + magneticScalarInverseSlope L hL ζ v := by + filter_upwards [(isOpen_lt continuous_id.abs continuous_const).mem_nhds hs] with u hu + exact ite_eq_left hu + simpa only [closedMagneticScalarSecond, hs, ite_true] using + (magneticScalarInverseSlope_hasDerivAt L hL hζ hs v).congr_of_eventuallyEq he + +lemma closedMagneticScalarCurvature_hasDerivAt_time (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ v : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (s : ℝ) : + HasDerivAt (fun t => closedMagneticScalarCurvature L hL ζ (t, s)) + (closedMagneticScalarTime L hL ζ (v, s)) v := by + by_cases hs : |s| < 1 + · have hd := magneticScalarInverseCurvature_PDE L hL hζ hs hv + rw [magneticScalarInverse_second_deriv L hL hζ hs v] at hd + simpa only [closedMagneticScalarCurvature, closedMagneticScalarSecond, + closedMagneticScalarTime, hs, ite_true] using hd + · simpa only [closedMagneticScalarCurvature, closedMagneticScalarSecond, + closedMagneticScalarTime, hs, ite_false, zero_pow (by norm_num : 2 ≠ 0), + zero_div, zero_mul, mul_zero, add_zero] using (hasDerivAt_const v (0 : ℝ)) + +lemma closedMagneticScalarCurvature_endpoints (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v : ℝ) : + closedMagneticScalarCurvature L hL ζ (v, -1) = 0 ∧ + closedMagneticScalarCurvature L hL ζ (v, 1) = 0 := by + simp only [closedMagneticScalarCurvature, abs_neg, abs_one, lt_self_iff_false, ite_false, + and_self] + +lemma closedMagneticScalarCurvature_le_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (q : ℝ × ℝ) (hq : q.2 ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature L hL ζ q ≤ 1 := by + exact (closedMagneticScalarCurvature_le_spin_variance L hL hL1 hζ hζ1 q hq).trans + (by linarith [sq_nonneg q.2]) + +lemma closedMagneticScalarCurvature_weighted_second_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (q : ℝ × ℝ) : + |closedMagneticScalarCurvature L hL ζ q * closedMagneticScalarSecond L hL ζ q| ≤ + magneticSlabPotentialCap L ζ := by + by_cases hs : |q.2| < 1 + · simpa only [closedMagneticScalarCurvature, closedMagneticScalarSecond, hs, ite_true] using + magneticScalarInverse_weighted_second_bound L hL hL1 hζ hζ1 q.1 q.2 + · simp only [closedMagneticScalarCurvature, closedMagneticScalarSecond, hs, ite_false, + mul_zero, abs_zero] + exact add_nonneg (magneticFourthRatioCap_nonneg _) (sq_nonneg _) + +lemma closedMagneticScalarCurvature_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ η s : ℝ) : + closedMagneticScalarCurvature L hL ζ (0, s) = + closedMagneticScalarCurvature L hL η (0, s) := by + by_cases hs : |s| < 1 + · simp only [closedMagneticScalarCurvature, hs, ite_true, magneticScalarInverseCurvature_eq, + Real.toNNReal_zero, fieldCurvatureTransform, fieldSpinTransition_zero_variance, + sub_self, mul_zero, add_zero] + rw [magneticScalarSlabBias_zero L ζ η s] + · simp only [closedMagneticScalarCurvature, hs, ite_false] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabCoefficient.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..958458e47fa9d284ca9c01db5fdb596a4cbed334 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabCoefficient.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabPDE +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabBoundary +import OAI.Probability.InvariantIsing.Magnetic.MagneticJetProduct +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteFourth + +namespace OAI + +/-! Uniform bounded potential for the actual finite-slab inverse-curvature +comparison. The cap depends on exponents, not on the variance parameter. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magneticScalarSlabJet_eq_cons (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 < ζ) (v : ℝ) : + magneticScalarSlabJet L hL ζ v = + magneticLogCoshMeanJet ((ζ, Real.toNNReal v) :: L) + (by intro av hav; rcases List.mem_cons.mp hav with h | h + · simpa only [h] using hζ + · exact hL av h) := by + apply MagneticContinuationJet.eq_of_value_eq + rfl + +def magneticSlabPotentialCap (L : List (ℝ × ℝ≥0)) (ζ : ℝ) : ℝ := + magneticFourthRatioCap ((ζ, 0) :: L) + (magneticThirdRatioCap ((ζ, 0) :: L)) ^ 2 + +lemma magneticScalarInverse_weighted_second_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (v s : ℝ) : + |magneticScalarInverseCurvature L hL ζ v s * magneticScalarInverseSecond L hL ζ v s| ≤ + magneticSlabPotentialCap L ζ := by + let K := (ζ, Real.toNNReal v) :: L + have hK : ∀ av ∈ K, 0 < av.1 := by + intro av hav + rcases List.mem_cons.mp hav with h | h + · simpa only [h] using hζ + · exact hL av h + have hK1 : ∀ av ∈ K, av.1 ≤ 1 := by + intro av hav + rcases List.mem_cons.mp hav with h | h + · simpa only [h] using hζ1 + · exact hL1 av h + let b := magneticScalarSlabBias L ζ v s + let J := magneticScalarSlabJet L hL ζ v + have hq : 0 < J.first b := magneticScalarSlabJet_curvature_pos L hL hζ.le v b + have hr : |J.second b| ≤ magneticThirdRatioCap K * J.first b := by + have hh := fieldScalarLogCoshThird_relative K hK b + have he := magneticScalarSlabJet_eq_cons L hL hζ v + change |J.second b| ≤ _ + dsimp only [J] + rw [he] + exact hh + have hd : |J.third b| ≤ magneticFourthRatioCap K * J.first b := by + have hh := fieldScalarLogCoshFourth_relative K hK hK1 b + dsimp only [J] + rw [magneticScalarSlabJet_eq_cons L hL hζ v] + exact hh + have hrq : |J.second b / J.first b| ≤ magneticThirdRatioCap K := by + rw [abs_div, abs_of_pos hq] + exact (div_le_iff₀ hq).mpr hr + have hdq : |J.third b / J.first b| ≤ magneticFourthRatioCap K := by + rw [abs_div, abs_of_pos hq] + exact (div_le_iff₀ hq).mpr hd + have he : magneticScalarInverseCurvature L hL ζ v s * + magneticScalarInverseSecond L hL ζ v s = + J.third b / J.first b - (J.second b / J.first b) ^ 2 := by + rw [magneticScalarInverseCurvature_eq_jet] + dsimp only [magneticScalarInverseSecond, J, b] + field_simp [hq.ne'] + rw [he] + have hr2 : |(J.second b / J.first b) ^ 2| ≤ (magneticThirdRatioCap K) ^ 2 := by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) hrq 2 + have hh := (abs_sub _ _).trans (add_le_add hdq hr2) + simpa only [magneticSlabPotentialCap, K, magneticFourthRatioCap, magneticThirdRatioCap] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabContinuation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabContinuation.lean new file mode 100644 index 0000000000000000000000000000000000000000..eda7c817402721945c16454fcda7cbf7758bbab2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabContinuation.lean @@ -0,0 +1,109 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabPDE +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatContinuity + +namespace OAI + +/-! Actual bounded observables continued in the inverse mean coordinate. +Both spatial derivatives and the drift cancellation follow from the finite +Gaussian field, with no inverse-regularity assumptions left over. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticScalarSlabContinuation (L : List (ℝ × ℝ≥0)) + (A : MagneticContinuationJet) (ζ v s : ℝ) : ℝ := + magneticHeatMean A (fieldScalarValue L (fun z => Real.log (Real.cosh z))) ζ + (v, magneticScalarSlabBias L ζ v s) + +def magneticScalarSlabContinuationJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ v : ℝ) : MagneticContinuationJet := + let P := magneticLogCoshMeanJet L hL + let hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + A.transition P ζ (Real.toNNReal v) + (fieldScalarValue L (fun z => Real.log (Real.cosh z))) hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) + +lemma magneticScalarSlabContinuation_eq_jet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ v s : ℝ) : + magneticScalarSlabContinuation L A ζ v s = + (magneticScalarSlabContinuationJet L hL A ζ v).value (magneticScalarSlabBias L ζ v s) := by + exact magneticHeatMean_eq A _ + (fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth).1 ζ _ + +def magneticScalarSlabContinuationSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ v s : ℝ) : ℝ := + let J := magneticScalarSlabJet L hL ζ v + let K := magneticScalarSlabContinuationJet L hL A ζ v + let b := magneticScalarSlabBias L ζ v s + K.first b / J.first b + +def magneticScalarSlabContinuationSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ v s : ℝ) : ℝ := + let J := magneticScalarSlabJet L hL ζ v + let K := magneticScalarSlabContinuationJet L hL A ζ v + let b := magneticScalarSlabBias L ζ v s + K.second b / (J.first b) ^ 2 - K.first b * J.second b / (J.first b) ^ 3 + +lemma magneticScalarSlabContinuation_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarSlabContinuation L A ζ v) + (magneticScalarSlabContinuationSlope L hL A ζ v s) s := by + have he : magneticScalarSlabContinuation L A ζ v = fun u => + (magneticScalarSlabContinuationJet L hL A ζ v).value + (magneticScalarSlabBias L ζ v u) := + funext (magneticScalarSlabContinuation_eq_jet L hL A ζ v) + rw [he] + exact inverse_mean_pullback_derivative (magneticScalarSlabBias_hasDerivAt_jet L hL hζ hs v) + ((magneticScalarSlabContinuationJet L hL A ζ v).dValue _) + +lemma magneticScalarSlabContinuationSlope_hasDerivAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarSlabContinuationSlope L hL A ζ v) + (magneticScalarSlabContinuationSecond L hL A ζ v s) s := by + let J := magneticScalarSlabJet L hL ζ v + let K := magneticScalarSlabContinuationJet L hL A ζ v + let b := magneticScalarSlabBias L ζ v s + have hd := inverse_mean_pullback_quotient + (magneticScalarSlabJet_curvature_pos L hL hζ v b).ne' + (magneticScalarSlabBias_hasDerivAt_jet L hL hζ hs v) rfl rfl + (K.dFirst b) (J.dFirst b) + exact hd + +lemma magneticScalarSlabContinuation_second_deriv (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + deriv (deriv (magneticScalarSlabContinuation L A ζ v)) s = + magneticScalarSlabContinuationSecond L hL A ζ v s := by + apply HasDerivAt.deriv + apply (magneticScalarSlabContinuationSlope_hasDerivAt L hL A hζ hs v).congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2] with t ht + exact (magneticScalarSlabContinuation_hasDerivAt_spin L hL A hζ (abs_lt.mpr ht) v).deriv + +theorem magneticScalarSlabContinuation_PDE (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ s v : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (hv : 0 < v) : + HasDerivAt (fun t => magneticScalarSlabContinuation L A ζ t s) + ((magneticScalarInverseCurvature L hL ζ v s) ^ 2 / 2 * + deriv (deriv (magneticScalarSlabContinuation L A ζ v)) s) v := by + rw [magneticScalarSlabContinuation_second_deriv L hL A hζ hs v, + magneticScalarInverseCurvature_eq_jet] + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + apply magneticHeatInverse_continuation_hasDerivAt (s := s) + (magneticLogCoshMeanJet L hL) A _ hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) ζ hv + (magneticScalarSlabBias_continuousAt_variance L hL hζ hs hv) + · exact Eventually.of_forall fun t => by + rw [← magneticScalarSlabMean_eq L hL] + exact magneticScalarSlabMean_bias L hL hζ hs t + · exact (magneticScalarSlabJet_curvature_pos L hL hζ v _).ne' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fe60ea91072d18d877dcee3288b41cfdcf37725 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabEndpoint.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticMeanShift +import OAI.Probability.InvariantIsing.Magnetic.MagneticUniformSlabBounds + +namespace OAI + +/-! Endpoint decay for bounded square continuations in a varying slab. -/ + +noncomputable section +open Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma magnetic_family_continuation_endpoint {ι : Type*} {l : Filter ι} + {M A B C D : ι → ℝ → ℝ} {x : ι → ℝ} {c L K : ℝ} + (hc : c ^ 2 = 1) (hL : 0 ≤ L) (hK : 0 ≤ K) + (hA : ∀ i z, (M i z) ^ 2 ≤ A i z ∧ A i z ≤ 1) + (dA : ∀ i z, HasDerivAt (A i) (B i z) z) + (dB : ∀ i z, HasDerivAt (B i) (C i z) z) + (dC : ∀ i z, HasDerivAt (C i) (D i z) z) + (bC : ∀ i z, |C i z| ≤ L) (bD : ∀ i z, |D i z| ≤ K) + (hM : ∀ h : ℝ, Tendsto (fun i => M i (x i + h)) l (𝓝 c)) : + Tendsto (fun i => B i (x i)) l (𝓝 0) ∧ + Tendsto (fun i => C i (x i)) l (𝓝 0) := by + have hlim (h : ℝ) : Tendsto (fun i => A i (x i + h)) l (𝓝 (1 : ℝ)) := by + have hs : Tendsto (fun i => (M i (x i + h)) ^ 2) l (𝓝 (1 : ℝ)) := by + simpa only [hc] using (hM h).pow 2 + exact hs.squeeze tendsto_const_nhds (fun i => (hA i (x i + h)).1) + (fun i => (hA i (x i + h)).2) + exact ⟨magnetic_family_derivative_tendsto_zero hL dA dB bC hlim, + magnetic_family_second_tendsto_zero hL hK dA dB dC bC bD hlim⟩ + +lemma magnetic_family_weighted_endpoint {ι : Type*} {l : Filter ι} + {B C R : ι → ℝ} {K : ℝ} + (hB : Tendsto B l (𝓝 0)) (hC : Tendsto C l (𝓝 0)) + (hR : ∀ i, |R i| ≤ K) : + Tendsto (fun i => C i - B i * R i) l (𝓝 0) := by + have hmul : Tendsto (fun i => B i * R i) l (𝓝 0) := by + apply squeeze_zero_norm (fun i => ?_) + (show Tendsto (fun i => |B i| * K) l (𝓝 0) by + simpa only [Real.norm_eq_abs, abs_zero, zero_mul] using hB.norm.mul_const K) + rw [Real.norm_eq_abs, abs_mul] + exact mul_le_mul_of_nonneg_left (hR i) (abs_nonneg _) + simpa only [sub_zero] using hC.sub hmul + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabExponentOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabExponentOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..6be3a1b76052e870d53c8021f2165ecce7b4b6e6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabExponentOrder.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabClosedDerivatives +import OAI.Probability.InvariantIsing.Magnetic.MagneticInverseComparison + +namespace OAI + +/-! The actual finite-slab inverse curvature increases with its exponent. +All comparison hypotheses, including the degenerate endpoints and +uniform zeroth-order coefficient bound, are discharged here. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +theorem magneticScalarInverseCurvature_exponent_mono (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ η : ℝ} (hζ : 0 < ζ) (hζη : ζ ≤ η) (hη1 : η ≤ 1) + {v s : ℝ} (hv : 0 ≤ v) (hs : |s| < 1) : + magneticScalarInverseCurvature L hL ζ v s ≤ magneticScalarInverseCurvature L hL η v s := by + have hζ1 := hζη.trans hη1 + have hη : 0 ≤ η := hζ.le.trans hζη + have ht := inverse_curvature_parabolic_comparison hv hη hζη + (closedMagneticScalarCurvature L hL ζ) (closedMagneticScalarTime L hL ζ) + (closedMagneticScalarSlope L hL ζ) (closedMagneticScalarSecond L hL ζ) + (closedMagneticScalarCurvature L hL η) (closedMagneticScalarTime L hL η) + (closedMagneticScalarSlope L hL η) (closedMagneticScalarSecond L hL η) + ((continuousOn_closedMagneticScalarCurvature L hL hL1 hζ.le hζ1).mono + (by intro p hp; exact ⟨mem_univ _, hp.2⟩)) + ((continuousOn_closedMagneticScalarCurvature L hL hL1 hη hη1).mono + (by intro p hp; exact ⟨mem_univ _, hp.2⟩)) + (fun u _ => (closedMagneticScalarCurvature_initial L hL ζ η u).le) + (fun t ht u _ => (closedMagneticScalarCurvature_hasDerivAt_time L hL hζ.le ht.1 u).hasDerivWithinAt) + (fun t ht u _ => (closedMagneticScalarCurvature_hasDerivAt_time L hL hη ht.1 u).hasDerivWithinAt) + (fun t _ u hu => closedMagneticScalarCurvature_hasDerivAt_spin L hL hζ.le (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticScalarCurvature_hasDerivAt_spin L hL hη (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticScalarSlope_hasDerivAt_spin L hL hζ.le (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticScalarSlope_hasDerivAt_spin L hL hη (abs_lt.mpr hu) t) + (fun p _ => closedMagneticScalarCurvature_nonneg L hL hζ.le p) + (fun p _ => closedMagneticScalarCurvature_nonneg L hL hη p) + (fun p hp => closedMagneticScalarCurvature_le_one L hL hL1 hζ.le hζ1 p hp.2) + (fun p _ => closedMagneticScalarCurvature_weighted_second_bound L hL hL1 hζ hζ1 p) + (fun t _ => by + have ha := closedMagneticScalarCurvature_endpoints L hL ζ t + have hb := closedMagneticScalarCurvature_endpoints L hL η t + exact ⟨ha.1, hb.1, ha.2, hb.2⟩) + (fun _ _ => rfl) (fun _ _ => rfl) + have hh := ht (v, s) ⟨⟨hv, le_rfl⟩, (abs_le.mp hs.le)⟩ + simpa only [closedMagneticScalarCurvature, hs, ite_true] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabInitial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..d160df17a4cb24a8671201ee2e8f603d95b2bec2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabInitial.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabBoundary + +namespace OAI + +/-! Exact zero-variance data for the inverse-coordinate slab equations. +The continued square starts at s², and the final tanh curvature at 1-s². -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magneticScalarSlabMean_zero (L : List (ℝ × ℝ≥0)) (ζ z : ℝ) : + magneticScalarSlabMean L ζ 0 z = + fieldScalarMean L (fun x => Real.log (Real.cosh x)) Real.tanh z := by + simp only [magneticScalarSlabMean, Real.toNNReal_zero, fieldSpinTransition_zero_variance] + +lemma magneticScalarSlabBias_zero (L : List (ℝ × ℝ≥0)) (ζ η s : ℝ) : + magneticScalarSlabBias L ζ 0 s = magneticScalarSlabBias L η 0 s := by + unfold magneticScalarSlabBias + apply congrArg (fun f : ℝ → ℝ => Function.invFun f s) + funext z + rw [magneticScalarSlabMean_zero, magneticScalarSlabMean_zero] + +lemma magneticScalarSlab_square_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) : + magneticHeatMean (magneticLogCoshMeanJet L hL).square + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) ζ + (0, magneticScalarSlabBias L ζ 0 s) = s ^ 2 := by + rw [magneticHeatMean_eq _ _ + (fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth).1] + simp only [Real.toNNReal_zero, fieldSpinTransition_zero_variance, MagneticContinuationJet.square] + have hh := magneticScalarSlabMean_bias L hL hζ hs 0 + rw [magneticScalarSlabMean_zero] at hh + change (fieldScalarMean L (fun x => Real.log (Real.cosh x)) Real.tanh + (magneticScalarSlabBias L ζ 0 s)) ^ 2 = s ^ 2 + rw [hh] + +lemma magneticScalarInverseCurvature_nil_initial + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) : + magneticScalarInverseCurvature [] (by simp) ζ 0 s = 1 - s ^ 2 := by + rw [magneticScalarInverseCurvature_eq] + simp only [Real.toNNReal_zero, fieldCurvatureTransform, fieldSpinTransition_zero_variance, + sub_self, mul_zero, add_zero] + have hh := magneticScalarSlabMean_bias [] (by simp) hζ hs 0 + rw [magneticScalarSlabMean_zero] at hh + change Real.tanh (magneticScalarSlabBias [] ζ 0 s) = s at hh + change 1 / (Real.cosh (magneticScalarSlabBias [] ζ 0 s)) ^ 2 = 1 - s ^ 2 + have hv := field_logCosh_spin_variance (magneticScalarSlabBias [] ζ 0 s) + rw [hh] at hv + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabPDE.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabPDE.lean new file mode 100644 index 0000000000000000000000000000000000000000..482265f71a7499e3108b8a01d7c41be459342bce --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabPDE.lean @@ -0,0 +1,110 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarInverse + +namespace OAI + +/-! The literal inverse-coordinate PDE of a finite Gaussian slab, with +spatial derivatives and inverse regularity discharged. Time here denotes +applied variance; reversing it gives the manuscript's backward equation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticScalarSlabJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v : ℝ) : MagneticContinuationJet := + let P := magneticLogCoshMeanJet L hL + let hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + P.transition P ζ (Real.toNNReal v) + (fieldScalarValue L (fun x => Real.log (Real.cosh x))) hF.1 hF.2 + (hasDerivAt_fieldScalarLogCosh L hL) + +lemma magneticScalarInverseCurvature_eq_jet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v s : ℝ) : + magneticScalarInverseCurvature L hL ζ v s = + (magneticScalarSlabJet L hL ζ v).first (magneticScalarSlabBias L ζ v s) := by + rw [magneticScalarInverseCurvature_eq] + simp only [magneticScalarSlabJet, MagneticContinuationJet.transition, + fieldCurvatureTransform, fieldTiltSpatial, pow_two] + +lemma magneticScalarSlabJet_curvature_pos (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + 0 < (magneticScalarSlabJet L hL ζ v).first z := by + have hp := magneticScalarSlab_curvature_pos L hL hζ v z + simpa only [magneticScalarSlabJet, MagneticContinuationJet.transition, + fieldCurvatureTransform, fieldTiltSpatial, pow_two] using hp + +def magneticScalarInverseSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v s : ℝ) : ℝ := + let J := magneticScalarSlabJet L hL ζ v + let b := magneticScalarSlabBias L ζ v s + J.second b / J.first b + +def magneticScalarInverseSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v s : ℝ) : ℝ := + let J := magneticScalarSlabJet L hL ζ v + let b := magneticScalarSlabBias L ζ v s + J.third b / (J.first b) ^ 2 - (J.second b) ^ 2 / (J.first b) ^ 3 + +lemma magneticScalarSlabBias_hasDerivAt_jet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarSlabBias L ζ v) + (1 / (magneticScalarSlabJet L hL ζ v).first (magneticScalarSlabBias L ζ v s)) s := by + have hd := magneticScalarSlabBias_hasDerivAt_spin L hL hζ hs v + simpa only [magneticScalarSlabJet, MagneticContinuationJet.transition, + fieldCurvatureTransform, fieldTiltSpatial, pow_two, one_div] using hd + +lemma magneticScalarInverseCurvature_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarInverseCurvature L hL ζ v) + (magneticScalarInverseSlope L hL ζ v s) s := by + have he : magneticScalarInverseCurvature L hL ζ v = + fun t => (magneticScalarSlabJet L hL ζ v).first (magneticScalarSlabBias L ζ v t) := + funext (magneticScalarInverseCurvature_eq_jet L hL ζ v) + rw [he] + exact inverse_mean_pullback_derivative (magneticScalarSlabBias_hasDerivAt_jet L hL hζ hs v) + ((magneticScalarSlabJet L hL ζ v).dFirst _) + +lemma magneticScalarInverseSlope_hasDerivAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarInverseSlope L hL ζ v) + (magneticScalarInverseSecond L hL ζ v s) s := by + let J := magneticScalarSlabJet L hL ζ v + let b := magneticScalarSlabBias L ζ v s + have hd := inverse_mean_pullback_quotient + (magneticScalarSlabJet_curvature_pos L hL hζ v b).ne' + (magneticScalarSlabBias_hasDerivAt_jet L hL hζ hs v) rfl rfl + (J.dSecond b) (J.dFirst b) + convert hd using 1 + · rfl + · dsimp only [magneticScalarInverseSecond, J, b] + ring + +lemma magneticScalarInverse_second_deriv (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + deriv (deriv (magneticScalarInverseCurvature L hL ζ v)) s = + magneticScalarInverseSecond L hL ζ v s := by + apply HasDerivAt.deriv + apply (magneticScalarInverseSlope_hasDerivAt L hL hζ hs v).congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2] with t ht + exact (magneticScalarInverseCurvature_hasDerivAt_spin L hL hζ (abs_lt.mpr ht) v).deriv + +/-- The actual inverse curvature solves the forward-variance version of +`mag:inverse-PDE` on every positive-variance slab. -/ +theorem magneticScalarInverseCurvature_PDE (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s v : ℝ} + (hζ : 0 ≤ ζ) (hs : |s| < 1) (hv : 0 < v) : + HasDerivAt (fun t => magneticScalarInverseCurvature L hL ζ t s) + ((magneticScalarInverseCurvature L hL ζ v s) ^ 2 / 2 * + deriv (deriv (magneticScalarInverseCurvature L hL ζ v)) s + + ζ * (magneticScalarInverseCurvature L hL ζ v s) ^ 2) v := by + rw [magneticScalarInverse_second_deriv L hL hζ hs v, + magneticScalarInverseCurvature_eq_jet] + exact magneticScalarInverseCurvature_variance_hasDerivAt L hL hζ hs hv + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabZero.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..840f42f725fbc0b28c56daf108e0179477bed3ba --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSlabZero.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabCoefficient + +namespace OAI + +/-! Relative derivative bounds for the ordinary Gaussian root step. +No positive cascade exponent is needed at this level. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magneticScalarSlabJet_zero_third_relative (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (v z : ℝ) : + |(magneticScalarSlabJet L hL 0 v).second z| ≤ + magneticThirdRatioCap L * (magneticScalarSlabJet L hL 0 v).first z := by + let P := magneticLogCoshMeanJet L hL + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have htan : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hM : ∀ z, |P.value z| ≤ 1 := + (fieldScalarMean_regular L hL measurable_logCosh logCosh_linearGrowth + htan field_abs_tanh_le_one).2 + obtain ⟨B, _, bQ⟩ := P.bFirst + have hQ : ∀ z, 0 ≤ P.first z := fun z => (fieldScalarLogCoshSecond_pos L hL z).le + have hR : ∀ z, |P.second z| ≤ magneticThirdRatioCap L * P.first z := + fieldScalarLogCoshThird_relative L hL + have he := fieldThirdTransform_relative_bound (le_refl (0 : ℝ)) (Real.toNNReal v) + hF.1 hF.2 P.mValue P.mFirst P.mSecond hM bQ hQ + (magneticThirdRatioCap_nonneg L) hR z + simpa only [magneticScalarSlabJet, MagneticContinuationJet.transition, P, + magneticContinuationSecond, fieldThirdTransform, fieldCurvatureTransform, + fieldTiltSpatial, zero_mul, mul_zero, add_zero] using he + +lemma magneticScalarSlabJet_zero_fourth_relative (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) (v z : ℝ) : + |(magneticScalarSlabJet L hL 0 v).third z| ≤ + magneticFourthRatioCap L * (magneticScalarSlabJet L hL 0 v).first z := by + let P := magneticLogCoshMeanJet L hL + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have htan : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hM : ∀ z, |P.value z| ≤ 1 := + (fieldScalarMean_regular L hL measurable_logCosh logCosh_linearGrowth + htan field_abs_tanh_le_one).2 + have hQ : ∀ z, 0 ≤ P.first z := fun z => (fieldScalarLogCoshSecond_pos L hL z).le + have hQ1 : ∀ z, P.first z ≤ 1 := by + intro z + have hh := fieldScalarLogCoshSecond_le_spin_variance L hL hL1 z + change P.first z ≤ 1 - (P.value z) ^ 2 at hh + linarith [sq_nonneg (P.value z)] + have hR : ∀ z, |P.second z| ≤ magneticThirdRatioCap L * P.first z := + fieldScalarLogCoshThird_relative L hL + have hS : ∀ z, |P.third z| ≤ magneticFourthRatioCap L * P.first z := + fieldScalarLogCoshFourth_relative L hL hL1 + have he := fieldFourthTransform_relative_bound (le_refl (0 : ℝ)) (Real.toNNReal v) + hF.1 hF.2 P.mValue P.mFirst P.mSecond P.mThird hM hQ hQ1 + (magneticThirdRatioCap_nonneg L) (magneticFourthRatioCap_nonneg L) hR hS z + simpa only [magneticScalarSlabJet, MagneticContinuationJet.transition, P, + magneticContinuationThird, magneticContinuationSecond, fieldFourthTransform, + fieldThirdTransform, fieldCurvatureTransform, fieldTiltSpatial, + zero_mul, mul_zero, add_zero, zero_pow (by norm_num : 2 ≠ 0)] using he + +lemma magneticScalarInverse_zero_weighted_second_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) (v s : ℝ) : + |magneticScalarInverseCurvature L hL 0 v s * magneticScalarInverseSecond L hL 0 v s| ≤ + magneticSlabPotentialCap L 0 := by + let b := magneticScalarSlabBias L 0 v s + let J := magneticScalarSlabJet L hL 0 v + have hq : 0 < J.first b := magneticScalarSlabJet_curvature_pos L hL (le_refl _) v b + have hrq : |J.second b / J.first b| ≤ magneticThirdRatioCap L := by + rw [abs_div, abs_of_pos hq] + exact (div_le_iff₀ hq).mpr (magneticScalarSlabJet_zero_third_relative L hL v b) + have hdq : |J.third b / J.first b| ≤ magneticFourthRatioCap L := by + rw [abs_div, abs_of_pos hq] + exact (div_le_iff₀ hq).mpr (magneticScalarSlabJet_zero_fourth_relative L hL hL1 v b) + have he : magneticScalarInverseCurvature L hL 0 v s * magneticScalarInverseSecond L hL 0 v s = + J.third b / J.first b - (J.second b / J.first b) ^ 2 := by + rw [magneticScalarInverseCurvature_eq_jet] + dsimp only [magneticScalarInverseSecond, J, b] + field_simp [hq.ne'] + rw [he] + have hr2 : |(J.second b / J.first b) ^ 2| ≤ (magneticThirdRatioCap L) ^ 2 := by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) hrq 2 + have hh := (abs_sub _ _).trans (add_le_add hdq hr2) + simpa only [magneticSlabPotentialCap, magneticFourthRatioCap, magneticThirdRatioCap, + abs_zero, mul_zero, zero_mul, add_zero, zero_pow (by norm_num : 2 ≠ 0)] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSliceFieldBound.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSliceFieldBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..92303723050b09c6bc8d1ca6f2065c8e5397d68d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSliceFieldBound.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Magnetic.ConstrainedBlockMagneticEstimate +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariational + +namespace OAI + +/-! The exact magnetization-slice field bound for the zero-temperature +boundary of the magnetic contact comparison. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators +namespace InvariantIsing + +lemma constrainedBlockValue_group_le {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (mag γ : A → ℝ) (hmag : ∀ a, |mag a| < 1) + (hc : ∀ a, (k a : ℝ)=spinGroupSize group a*((1+mag a)/2)) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=N*γ a) (h : FieldStep) : + constrainedBlockValue (spinGroupSlice group k) h ≤ magneticGroupValue γ mag h := by + have hg := (biasedConstrainedBlockValue_gap hN (spinGroupSlice group k) + (spinGroupSlice_nonempty group k hk) h (fun i => magneticBias h (mag (group i)))).1 + rw [← magneticBlockGap_eq_biasedGap hN group k hk mag hmag hc] at hg + have he : (N : ℝ)⁻¹ * ∑ i, constrainedFieldValue h (mag (group i)) = magneticGroupValue γ mag h := by + rw [sum_sites_group group (fun a => constrainedFieldValue h (mag a))] + simp only [hcount, magneticGroupValue] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + rw [← mul_assoc, ← mul_assoc, inv_mul_cancel₀ (Nat.cast_ne_zero.mpr hN.ne'), one_mul] + + rw [he] at hg + linarith + +lemma constrainedBlockValue_entropy_bound {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (mag γ : A → ℝ) (hmag : ∀ a, |mag a| < 1) + (hc : ∀ a, (k a : ℝ)=spinGroupSize group a*((1+mag a)/2)) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=N*γ a) + (p : OverlapPath) (S : ℝ) (hS : magneticEntropyFunctional γ mag p ≤ (S : EReal)) (h : FieldStep) : + constrainedBlockValue (spinGroupSlice group k) h + fieldPairing p h/2 ≤ S := by + have ht : ((magneticGroupValue γ mag h+fieldPairing p h/2 : ℝ) : EReal) ≤ (S : EReal) := + (le_iSup (fun h : FieldStep => ((magneticGroupValue γ mag h+fieldPairing p h/2 : ℝ) : EReal)) h).trans hS + have ht' : magneticGroupValue γ mag h+fieldPairing p h/2 ≤ S := EReal.coe_le_coe_iff.mp ht + linarith [constrainedBlockValue_group_le hN group k hk mag γ hmag hc hcount h] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpatialFourth.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpatialFourth.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f5581c8b5c579a1f53d8bd6d7c2c9b7d5d3f1bd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpatialFourth.lean @@ -0,0 +1,259 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarThird + +namespace OAI + +/-! Fourth spatial differentiation of the actual Gaussian field step. +The derivative is expressed in bounded tilted averages; no positive-variance +assumption is needed. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldTiltSpatial (ζ : ℝ) (v : ℝ≥0) (F M A B : ℝ → ℝ) (z : ℝ) : ℝ := + fieldSpinTransition ζ v F B z + ζ * + (fieldSpinTransition ζ v F (fun y => A y * M y) z - + fieldSpinTransition ζ v F A z * fieldSpinTransition ζ v F M z) + +lemma measurable_fieldTiltSpatial (ζ : ℝ) (v : ℝ≥0) {F M A B : ℝ → ℝ} + (hF : Measurable F) (hM : Measurable M) (hA : Measurable A) (hB : Measurable B) : + Measurable (fieldTiltSpatial ζ v F M A B) := by + exact (measurable_fieldSpinTransition ζ v hF hB).add + (((measurable_fieldSpinTransition ζ v hF (hA.mul hM)).sub + ((measurable_fieldSpinTransition ζ v hF hA).mul + (measurable_fieldSpinTransition ζ v hF hM))).const_mul ζ) + +def fieldFourthTransform (ζ : ℝ) (v : ℝ≥0) (F M Q R S : ℝ → ℝ) (z : ℝ) : ℝ := + let T := fieldSpinTransition ζ v F + let D := fieldTiltSpatial ζ v F M + let q := fieldCurvatureTransform ζ v F M Q z + let r := fieldThirdTransform ζ v F M Q R z + D R S z + ζ * (D (fun y => Q y * M y) (fun y => R y * M y + Q y * Q y) z - + (D Q R z * T M z + T Q z * q)) + + ζ * ((D (fun y => 2 * M y * Q y) (fun y => 2 * Q y * Q y + 2 * M y * R y) z + + ζ * (D (fun y => (M y) ^ 2 * M y) (fun y => 3 * (M y) ^ 2 * Q y) z - + (D (fun y => (M y) ^ 2) (fun y => 2 * M y * Q y) z * T M z + + T (fun y => (M y) ^ 2) z * q))) - + 2 * (q * q + T M z * r)) + +lemma hasDerivAt_fieldThirdTransform (ζ : ℝ) (v : ℝ≥0) + {F M Q R S : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) (hS : Measurable S) + {K C D E : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) (hD : 0 ≤ D) + (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ C) + (bR : ∀ y, |R y| ≤ D) (bS : ∀ y, |S y| ≤ E) + (dF : ∀ y, HasDerivAt F (M y) y) + (dM : ∀ y, HasDerivAt M (Q y) y) + (dQ : ∀ y, HasDerivAt Q (R y) y) + (dR : ∀ y, HasDerivAt R (S y) y) (z : ℝ) : + HasDerivAt (fieldThirdTransform ζ v F M Q R) + (fieldFourthTransform ζ v F M Q R S z) z := by + have bprod {A B : ℝ → ℝ} {a b : ℝ} (ha : 0 ≤ a) + (ba : ∀ y, |A y| ≤ a) (bb : ∀ y, |B y| ≤ b) (y : ℝ) : + |A y * B y| ≤ a * b := by + rw [abs_mul] + exact mul_le_mul (ba y) (bb y) (abs_nonneg _) ha + have bsq : ∀ y, |(M y) ^ 2| ≤ K ^ 2 := by + intro y + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (bM y) 2 + have bQM := bprod hC bQ bM + have b2MQ : ∀ y, |2 * M y * Q y| ≤ 2 * K * C := by + intro y + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + exact mul_le_mul (mul_le_mul_of_nonneg_left (bM y) (by norm_num)) (bQ y) + (abs_nonneg _) (by positivity) + have bM3 := bprod (sq_nonneg K) bsq bM + have bQM' : ∀ y, |R y * M y + Q y * Q y| ≤ D * K + C * C := by + intro y + exact (abs_add_le _ _).trans (add_le_add (bprod hD bR bM y) (bprod hC bQ bQ y)) + have b2MQ' : ∀ y, |2 * Q y * Q y + 2 * M y * R y| ≤ 2 * C * C + 2 * K * D := by + intro y + rw [show 2 * Q y * Q y + 2 * M y * R y = + 2 * (Q y * Q y) + 2 * (M y * R y) by ring] + refine (abs_add_le _ _).trans (add_le_add ?_ ?_) + · rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + simpa only [mul_assoc] using mul_le_mul_of_nonneg_left (bprod hC bQ bQ y) (by norm_num : (0 : ℝ) ≤ 2) + · rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + simpa only [mul_assoc] using mul_le_mul_of_nonneg_left (bprod hK bM bR y) (by norm_num : (0 : ℝ) ≤ 2) + have bM3' : ∀ y, |3 * (M y) ^ 2 * Q y| ≤ 3 * K ^ 2 * C := by + intro y + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 3)] + exact mul_le_mul (mul_le_mul_of_nonneg_left (bsq y) (by norm_num)) (bQ y) + (abs_nonneg _) (by positivity) + have dQM (y : ℝ) : HasDerivAt (fun x => Q x * M x) (R y * M y + Q y * Q y) y := + (dQ y).mul (dM y) + have d2MQ (y : ℝ) : HasDerivAt (fun x => 2 * M x * Q x) + (2 * Q y * Q y + 2 * M y * R y) y := by + convert ((dM y).const_mul 2).mul (dQ y) using 1 + have dM3 (y : ℝ) : HasDerivAt (fun x => (M x) ^ 2 * M x) + (3 * (M y) ^ 2 * Q y) y := by + convert ((dM y).pow 2).mul (dM y) using 1 + simp only [Pi.pow_apply] + ring + have dM2 (y : ℝ) : HasDerivAt (fun x => (M x) ^ 2) (2 * M y * Q y) y := by + convert (dM y).pow 2 using 1 + ring + have ht (A B : ℝ → ℝ) (ha : Measurable A) (hb : Measurable B) + {a b : ℝ} (ha0 : 0 ≤ a) (ba : ∀ y, |A y| ≤ a) (bb : ∀ y, |B y| ≤ b) + (dab : ∀ y, HasDerivAt A (B y) y) : + HasDerivAt (fieldSpinTransition ζ v F A) (fieldTiltSpatial ζ v F M A B z) z := + hasDerivAt_fieldSpinTransition ζ v hF hG hM ha hb hK ha0 bM ba bb dF dab z + have hm := ht M Q hM hQ hK bM bQ dM + have hm' : HasDerivAt (fieldSpinTransition ζ v F M) + (fieldCurvatureTransform ζ v F M Q z) z := by + simpa only [fieldTiltSpatial, fieldCurvatureTransform, pow_two] using hm + have hq := ht Q R hQ hR hC bQ bR dQ + have hr := ht R S hR hS hD bR bS dR + have hqm := ht _ _ (hQ.mul hM) ((hR.mul hM).add (hQ.mul hQ)) + (mul_nonneg hC hK) bQM bQM' dQM + have h2mq := ht _ _ ((measurable_const.mul hM).mul hQ) + (((measurable_const.mul hQ).mul hQ).add ((measurable_const.mul hM).mul hR)) + (by positivity) b2MQ b2MQ' d2MQ + have hm3 := ht _ _ ((hM.pow_const 2).mul hM) ((measurable_const.mul (hM.pow_const 2)).mul hQ) + (by positivity) bM3 bM3' dM3 + have hm2 := ht _ _ (hM.pow_const 2) ((measurable_const.mul hM).mul hQ) + (sq_nonneg K) bsq b2MQ dM2 + have hcurv := hasDerivAt_fieldCurvatureTransform ζ v hF hG hM hQ hR hK hC bM bQ bR dF dM dQ z + have hd := (hr.add ((hqm.sub (hq.mul hm')).const_mul ζ)).add + (((h2mq.add ((hm3.sub (hm2.mul hm')).const_mul ζ)).sub + ((hm'.mul hcurv).const_mul 2)).const_mul ζ) + convert hd using 1 + · funext y + change fieldThirdTransform ζ v F M Q R y = + (fieldSpinTransition ζ v F R y + ζ * + (fieldSpinTransition ζ v F (fun u => Q u * M u) y - + fieldSpinTransition ζ v F Q y * fieldSpinTransition ζ v F M y)) + + ζ * ((fieldSpinTransition ζ v F (fun u => 2 * M u * Q u) y + ζ * + (fieldSpinTransition ζ v F (fun u => M u ^ 2 * M u) y - + fieldSpinTransition ζ v F (fun u => M u ^ 2) y * fieldSpinTransition ζ v F M y)) - + 2 * (fieldSpinTransition ζ v F M y * fieldCurvatureTransform ζ v F M Q y)) + simp only [fieldThirdTransform] + ring + · rfl + +lemma measurable_fieldFourthTransform (ζ : ℝ) (v : ℝ≥0) + {F M Q R S : ℝ → ℝ} (hF : Measurable F) (hM : Measurable M) + (hQ : Measurable Q) (hR : Measurable R) (hS : Measurable S) : + Measurable (fieldFourthTransform ζ v F M Q R S) := by + have hm := measurable_fieldSpinTransition ζ v hF hM + have hq := measurable_fieldSpinTransition ζ v hF hQ + have hm2 := measurable_fieldSpinTransition ζ v hF (hM.pow_const 2) + have hc : Measurable (fieldCurvatureTransform ζ v F M Q) := + hq.add ((hm2.sub (hm.pow_const 2)).const_mul ζ) + have hr := measurable_fieldThirdTransform ζ v hF hM hQ hR + have h1 := measurable_fieldTiltSpatial ζ v hF hM hR hS + have h2 := measurable_fieldTiltSpatial ζ v hF hM (hQ.mul hM) + ((hR.mul hM).add (hQ.mul hQ)) + have h3 := measurable_fieldTiltSpatial ζ v hF hM hQ hR + have h4 := measurable_fieldTiltSpatial ζ v hF hM (((measurable_const (a := (2 : ℝ))).mul hM).mul hQ) + ((((measurable_const (a := (2 : ℝ))).mul hQ).mul hQ).add + (((measurable_const (a := (2 : ℝ))).mul hM).mul hR)) + have h5 := measurable_fieldTiltSpatial ζ v hF hM ((hM.pow_const 2).mul hM) + (((measurable_const (a := (3 : ℝ))).mul (hM.pow_const 2)).mul hQ) + have h6 := measurable_fieldTiltSpatial ζ v hF hM (hM.pow_const 2) + (((measurable_const (a := (2 : ℝ))).mul hM).mul hQ) + exact (h1.add ((h2.sub ((h3.mul hm).add (hq.mul hc))).const_mul ζ)).add + (((h4.add ((h5.sub ((h6.mul hm).add (hm2.mul hc))).const_mul ζ)).sub + (((hc.mul hc).add (hm.mul hr)).const_mul 2)).const_mul ζ) + +private def MagneticUniformBound (f : ℝ → ℝ) : Prop := + ∃ C : ℝ, 0 ≤ C ∧ ∀ x, |f x| ≤ C + +private lemma magnetic_uniform_const (c : ℝ) : MagneticUniformBound (fun _ => c) := + ⟨|c|, abs_nonneg _, fun _ => le_rfl⟩ + +private lemma magnetic_uniform_add {f g : ℝ → ℝ} + (hf : MagneticUniformBound f) (hg : MagneticUniformBound g) : + MagneticUniformBound (fun x => f x + g x) := by + obtain ⟨C, hC, hf⟩ := hf + obtain ⟨D, hD, hg⟩ := hg + exact ⟨C + D, add_nonneg hC hD, + fun x => (abs_add_le _ _).trans (add_le_add (hf x) (hg x))⟩ + +private lemma magnetic_uniform_sub {f g : ℝ → ℝ} + (hf : MagneticUniformBound f) (hg : MagneticUniformBound g) : + MagneticUniformBound (fun x => f x - g x) := by + obtain ⟨C, hC, hf⟩ := hf + obtain ⟨D, hD, hg⟩ := hg + exact ⟨C + D, add_nonneg hC hD, + fun x => (abs_sub _ _).trans (add_le_add (hf x) (hg x))⟩ + +private lemma magnetic_uniform_mul {f g : ℝ → ℝ} + (hf : MagneticUniformBound f) (hg : MagneticUniformBound g) : + MagneticUniformBound (fun x => f x * g x) := by + obtain ⟨C, hC, hf⟩ := hf + obtain ⟨D, hD, hg⟩ := hg + refine ⟨C * D, mul_nonneg hC hD, fun x => ?_⟩ + rw [abs_mul] + exact mul_le_mul (hf x) (hg x) (abs_nonneg _) hC + +lemma fieldFourthTransform_bounded (ζ : ℝ) (v : ℝ≥0) + {F M Q R S : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + {K C D E : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) + (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ C) + (bR : ∀ y, |R y| ≤ D) (bS : ∀ y, |S y| ≤ E) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ z, |fieldFourthTransform ζ v F M Q R S z| ≤ B := by + have mM : MagneticUniformBound M := ⟨K, hK, bM⟩ + have mQ : MagneticUniformBound Q := ⟨C, hC, bQ⟩ + have mR : MagneticUniformBound R := ⟨D, (abs_nonneg _).trans (bR 0), bR⟩ + have mS : MagneticUniformBound S := ⟨E, (abs_nonneg _).trans (bS 0), bS⟩ + have hT (A : ℝ → ℝ) (ha : MagneticUniformBound A) : + MagneticUniformBound (fieldSpinTransition ζ v F A) := by + obtain ⟨a, ha0, ha⟩ := ha + exact ⟨a, ha0, fieldSpinTransition_bound ζ v hF hG ha⟩ + have hD (A B : ℝ → ℝ) (ha : MagneticUniformBound A) (hb : MagneticUniformBound B) : + MagneticUniformBound (fieldTiltSpatial ζ v F M A B) := by + obtain ⟨a, ha0, ha⟩ := ha + obtain ⟨b, hb0, hb⟩ := hb + exact ⟨b + 2 * |ζ| * a * K, by positivity, + fieldSpinTransition_derivative_bound ζ v hF hG hK ha0 bM ha hb⟩ + have mM2 : MagneticUniformBound (fun y => (M y) ^ 2) := by + simpa only [pow_two] using magnetic_uniform_mul mM mM + have m2MQ := magnetic_uniform_mul (magnetic_uniform_mul (magnetic_uniform_const 2) mM) mQ + have mQnew : MagneticUniformBound (fieldCurvatureTransform ζ v F M Q) := by + have he : (fun z => fieldSpinTransition ζ v F Q z + ζ * + (fieldSpinTransition ζ v F (fun y => M y ^ 2) z - + fieldSpinTransition ζ v F M z * fieldSpinTransition ζ v F M z)) = + fieldCurvatureTransform ζ v F M Q := by + funext z + simp only [fieldCurvatureTransform, pow_two] + rw [← he] + exact magnetic_uniform_add (hT Q mQ) (magnetic_uniform_mul (magnetic_uniform_const ζ) + (magnetic_uniform_sub (hT _ mM2) (magnetic_uniform_mul (hT M mM) (hT M mM)))) + have mRnew : MagneticUniformBound (fieldThirdTransform ζ v F M Q R) := by + have hb := fieldThirdTransform_bound ζ v hF hG hK hC bM bQ bR + exact ⟨_, (abs_nonneg _).trans (hb 0), hb⟩ + have m1 := hD R S mR mS + have m2 := hD _ _ (magnetic_uniform_mul mQ mM) + (magnetic_uniform_add (magnetic_uniform_mul mR mM) (magnetic_uniform_mul mQ mQ)) + have m3 := hD Q R mQ mR + have m4 := hD _ _ m2MQ + (magnetic_uniform_add + (magnetic_uniform_mul (magnetic_uniform_mul (magnetic_uniform_const 2) mQ) mQ) + (magnetic_uniform_mul (magnetic_uniform_mul (magnetic_uniform_const 2) mM) mR)) + have m5 := hD _ _ (magnetic_uniform_mul mM2 mM) + (magnetic_uniform_mul (magnetic_uniform_mul (magnetic_uniform_const 3) mM2) mQ) + have m6 := hD _ _ mM2 m2MQ + exact magnetic_uniform_add + (magnetic_uniform_add m1 (magnetic_uniform_mul (magnetic_uniform_const ζ) + (magnetic_uniform_sub m2 + (magnetic_uniform_add (magnetic_uniform_mul m3 (hT M mM)) + (magnetic_uniform_mul (hT Q mQ) mQnew))))) + (magnetic_uniform_mul (magnetic_uniform_const ζ) + (magnetic_uniform_sub + (magnetic_uniform_add m4 (magnetic_uniform_mul (magnetic_uniform_const ζ) + (magnetic_uniform_sub m5 + (magnetic_uniform_add (magnetic_uniform_mul m6 (hT M mM)) + (magnetic_uniform_mul (hT _ mM2) mQnew))))) + (magnetic_uniform_mul (magnetic_uniform_const 2) + (magnetic_uniform_add (magnetic_uniform_mul mQnew mQnew) + (magnetic_uniform_mul (hT M mM) mRnew))))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpatialThird.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpatialThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..53d7586d28bd489095a7cc3c69abefff91a9466c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpatialThird.lean @@ -0,0 +1,126 @@ +import OAI.Probability.InvariantIsing.Fields.FieldScalarLogCoshSecond + +namespace OAI + +/-! Third spatial differentiation of one actual Gaussian backward step. +The formula is kept as tilted averages, so it also applies to zero variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def fieldCurvatureTransform (ζ : ℝ) (v : ℝ≥0) (F M Q : ℝ → ℝ) (z : ℝ) : ℝ := + fieldSpinTransition ζ v F Q z + ζ * + (fieldSpinTransition ζ v F (fun y => (M y) ^ 2) z - + (fieldSpinTransition ζ v F M z) ^ 2) + +def fieldThirdTransform (ζ : ℝ) (v : ℝ≥0) (F M Q R : ℝ → ℝ) (z : ℝ) : ℝ := + (fieldSpinTransition ζ v F R z + ζ * + (fieldSpinTransition ζ v F (fun y => Q y * M y) z - + fieldSpinTransition ζ v F Q z * fieldSpinTransition ζ v F M z)) + + ζ * ((fieldSpinTransition ζ v F (fun y => 2 * M y * Q y) z + ζ * + (fieldSpinTransition ζ v F (fun y => (M y) ^ 2 * M y) z - + fieldSpinTransition ζ v F (fun y => (M y) ^ 2) z * + fieldSpinTransition ζ v F M z)) - + 2 * fieldSpinTransition ζ v F M z * fieldCurvatureTransform ζ v F M Q z) + +lemma hasDerivAt_fieldCurvatureTransform (ζ : ℝ) (v : ℝ≥0) + {F M Q R : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : Measurable M) (hQ : Measurable Q) (hR : Measurable R) + {K C D : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) + (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ C) (bR : ∀ y, |R y| ≤ D) + (dF : ∀ y, HasDerivAt F (M y) y) + (dM : ∀ y, HasDerivAt M (Q y) y) + (dQ : ∀ y, HasDerivAt Q (R y) y) (z : ℝ) : + HasDerivAt (fieldCurvatureTransform ζ v F M Q) + (fieldThirdTransform ζ v F M Q R z) z := by + have hm2 : Measurable (fun y => (M y) ^ 2) := hM.pow_const 2 + have hmQ : Measurable (fun y => 2 * M y * Q y) := + (measurable_const.mul hM).mul hQ + have bm2 : ∀ y, |(M y) ^ 2| ≤ K ^ 2 := by + intro y + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (bM y) 2 + have bmQ : ∀ y, |2 * M y * Q y| ≤ 2 * K * C := by + intro y + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + exact mul_le_mul (mul_le_mul_of_nonneg_left (bM y) (by norm_num)) (bQ y) + (abs_nonneg _) (by positivity) + have dm2 : ∀ y, HasDerivAt (fun w => (M w) ^ 2) (2 * M y * Q y) y := by + intro y + convert (dM y).pow 2 using 1 + norm_num + have hmean := hasDerivAt_fieldSpinTransition ζ v hF hG hM hM hQ + hK hK bM bM bQ dF dM z + have hmean' : HasDerivAt (fieldSpinTransition ζ v F M) + (fieldCurvatureTransform ζ v F M Q z) z := by + simpa only [fieldCurvatureTransform, pow_two] using hmean + have hsecond := hasDerivAt_fieldSpinTransition ζ v hF hG hM hQ hR + hK hC bM bQ bR dF dQ z + have hsq := hasDerivAt_fieldSpinTransition ζ v hF hG hM hm2 hmQ + hK (sq_nonneg K) bM bm2 bmQ dF dm2 z + have hd := hsecond.add ((hsq.sub (hmean'.pow 2)).const_mul ζ) + convert hd using 1 + · rfl + · simp [fieldThirdTransform] + +lemma measurable_fieldThirdTransform (ζ : ℝ) (v : ℝ≥0) + {F M Q R : ℝ → ℝ} (hF : Measurable F) (hM : Measurable M) + (hQ : Measurable Q) (hR : Measurable R) : + Measurable (fieldThirdTransform ζ v F M Q R) := by + have hm := measurable_fieldSpinTransition ζ v hF hM + have hq := measurable_fieldSpinTransition ζ v hF hQ + have hr := measurable_fieldSpinTransition ζ v hF hR + have hqm := measurable_fieldSpinTransition ζ v hF (hQ.mul hM) + have hm2 := measurable_fieldSpinTransition ζ v hF (hM.pow_const 2) + have hm2m := measurable_fieldSpinTransition ζ v hF ((hM.pow_const 2).mul hM) + have h2mq : Measurable (fieldSpinTransition ζ v F (fun y => 2 * M y * Q y)) := + measurable_fieldSpinTransition ζ v hF ((measurable_const.mul hM).mul hQ) + exact (hr.add ((hqm.sub (hq.mul hm)).const_mul ζ)).add + (((h2mq.add ((hm2m.sub (hm2.mul hm)).const_mul ζ)).sub + ((measurable_const.mul hm).mul + (hq.add ((hm2.sub (hm.pow_const 2)).const_mul ζ)))).const_mul ζ) + +def fieldThirdTransformCap (ζ K C D : ℝ) : ℝ := + (D + 2 * |ζ| * C * K) + |ζ| * + ((2 * K * C + 2 * |ζ| * K ^ 2 * K) + 2 * K * (C + 2 * |ζ| * K ^ 2)) + +lemma fieldThirdTransform_bound (ζ : ℝ) (v : ℝ≥0) + {F M Q R : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + {K C D : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) + (bM : ∀ y, |M y| ≤ K) (bQ : ∀ y, |Q y| ≤ C) (bR : ∀ y, |R y| ≤ D) + (z : ℝ) : |fieldThirdTransform ζ v F M Q R z| ≤ fieldThirdTransformCap ζ K C D := by + have bm2 : ∀ y, |(M y) ^ 2| ≤ K ^ 2 := by + intro y + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) (bM y) 2 + have bmQ : ∀ y, |2 * M y * Q y| ≤ 2 * K * C := by + intro y + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + exact mul_le_mul (mul_le_mul_of_nonneg_left (bM y) (by norm_num)) (bQ y) + (abs_nonneg _) (by positivity) + have hfirst := fieldSpinTransition_derivative_bound ζ v hF hG hK hC bM bQ bR z + have hsecond := fieldSpinTransition_derivative_bound ζ v hF hG hK (sq_nonneg K) + bM bm2 bmQ z + have hm := fieldSpinTransition_bound ζ v hF hG bM z + have hq : |fieldCurvatureTransform ζ v F M Q z| ≤ C + 2 * |ζ| * K ^ 2 := by + have hh := fieldSpinTransition_derivative_bound ζ v hF hG hK hK bM bM bQ z + simpa only [fieldCurvatureTransform, pow_two, mul_assoc] using hh + have hprod : |2 * fieldSpinTransition ζ v F M z * fieldCurvatureTransform ζ v F M Q z| ≤ + 2 * K * (C + 2 * |ζ| * K ^ 2) := by + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + exact mul_le_mul (mul_le_mul_of_nonneg_left hm (by norm_num)) hq + (abs_nonneg _) (by positivity) + unfold fieldThirdTransform fieldThirdTransformCap + refine (abs_add_le _ _).trans (add_le_add hfirst ?_) + rw [abs_mul] + refine mul_le_mul_of_nonneg_left ((abs_sub _ _).trans (add_le_add hsecond hprod)) + (abs_nonneg ζ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralClipping.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralClipping.lean new file mode 100644 index 0000000000000000000000000000000000000000..79eeef746713868ee6bb72ccb017dfc3b4345689 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralClipping.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralClipping + +namespace OAI + +/-! Spectral clipping has the same uniform error for every external field. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology Classical +namespace InvariantIsing + +lemma spectral_clip_mean_field_pressure_close {N : ℕ} (hN : 0 < N) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] (eig : Fin N → ℝ) + (a b η : ℝ) (hab : a ≤ b) (hη : 0 ≤ η) + (heig : ∀ i, a-η ≤ eig i ∧ eig i ≤ b+η) (c : Fin N → ℝ) : + |(∫ V, rotatedPressure (fun i => spectralClip a b (eig i)) + (matrixRotation V⁻¹) c ∂μ)- + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂μ| ≤ η/2 := by + let K := (∑ i, |eig i|)+|a|+|b| + have hsum : 0 ≤ ∑ i, |eig i| := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hi i : |eig i| ≤ K := by + have hh := Finset.single_le_sum (fun i _ => abs_nonneg (eig i)) (Finset.mem_univ i) + dsimp [K] + linarith [abs_nonneg a,abs_nonneg b] + have hc i : |spectralClip a b (eig i)| ≤ K := by + have hh := spectralClip_mem hab (eig i) + rw [abs_le] + dsimp [K] + constructor <;> linarith [hh.1,hh.2,neg_abs_le a,le_abs_self b,abs_nonneg a,abs_nonneg b] + have hd i := abs_le.mp (spectralClip_close hab hη (heig i)) + have hh := cavity_meanPressure_squeeze hN μ eig + (fun i => spectralClip a b (eig i)) (fun i => spectralClip a b (eig i)) + c η K hi hc hc + (fun i => by linarith [(hd i).2]) (fun i => by linarith [(hd i).1]) + rw [abs_le] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b28a24f0c33cd107417f8db24547ecf3e635ba08 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralContinuity.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticPopulationContinuity +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralContinuity + +namespace OAI + +/-! Uniform spectral-transform errors pass through both magnetic +optimizations, and imply continuity in positive spectral populations. -/ +noncomputable section +open Filter Set +open scoped BigOperators Topology +namespace InvariantIsing + +lemma magneticVariationalFunctional_le_add {A : Type*} [Fintype A] + (γ mag : A → ℝ) (R Q : ℝ → ℝ) (hR : Continuous R) (hQ : Continuous Q) + (δ : ℝ) (hδ : ∀ x ∈ Set.Icc (0 : ℝ) 1, |R x - Q x| ≤ δ) : + magneticVariationalFunctional R γ mag ≤ magneticVariationalFunctional Q γ mag + ((δ / 2 : ℝ) : EReal) := by + apply (EReal.sub_le_iff_le_add (.inl (EReal.coe_ne_bot _)) + (.inl (EReal.coe_ne_top _))).mp + apply le_iInf + intro p + apply (EReal.sub_le_iff_le_add (.inl (EReal.coe_ne_bot _)) + (.inl (EReal.coe_ne_top _))).mpr + have hspec : (spectralFunctional R p : EReal) ≤ + (spectralFunctional Q p : EReal) + ((δ / 2 : ℝ) : EReal) := by + rw [← EReal.coe_add] + apply EReal.coe_le_coe + have hb := (abs_le.mp (abs_spectralFunctional_sub_le R Q hR hQ δ hδ p)).2 + linarith + calc + magneticVariationalFunctional R γ mag ≤ magneticEntropyFunctional γ mag p + (spectralFunctional R p : EReal) := + iInf_le _ p + _ ≤ magneticEntropyFunctional γ mag p + + ((spectralFunctional Q p : EReal) + ((δ / 2 : ℝ) : EReal)) := + add_le_add le_rfl hspec + _ = _ := by rw [add_assoc] + + +lemma finiteMagneticFunctional_spectral_le_add {A : Type*} [Fintype A] + (γ b : A → ℝ) (R Q : ℝ → ℝ) (hR : Continuous R) (hQ : Continuous Q) + (δ : ℝ) (hδ : ∀ x ∈ Icc (0 : ℝ) 1, |R x-Q x| ≤ δ) : + finiteMagneticFunctional R γ b ≤ finiteMagneticFunctional Q γ b+((δ/2 : ℝ) : EReal) := by + apply iSup_le + intro mag + have hh := magneticVariationalFunctional_le_add γ (fun a => (mag.val a : ℝ)) R Q hR hQ δ hδ + have hi := le_iSup (fun t : RationalMagnetization A => + ((∑ a, γ a*b a*(t.val a : ℝ) : ℝ) : EReal)+ + magneticVariationalFunctional Q γ (fun a => (t.val a : ℝ))) mag + calc + _ ≤ ((∑ a, γ a*b a*(mag.val a : ℝ) : ℝ) : EReal)+ + (magneticVariationalFunctional Q γ (fun a => (mag.val a : ℝ))+((δ/2 : ℝ) : EReal)) := + add_le_add le_rfl hh + _ = (((∑ a, γ a*b a*(mag.val a : ℝ) : ℝ) : EReal)+ + magneticVariationalFunctional Q γ (fun a => (mag.val a : ℝ)))+((δ/2 : ℝ) : EReal) := + (add_assoc _ _ _).symm + _ ≤ _ := add_le_add hi le_rfl + +theorem finiteMagneticFunctional_tendsto_weights {A ι : Type*} [Fintype A] [Fintype ι] + (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a=1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) + (γ b : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) : + Tendsto (fun k => (finiteMagneticFunctional (finiteR (ρs k) eig (hspos k) (hssum k)) γ b).toReal) + atTop (𝓝 (finiteMagneticFunctional (finiteR ρ eig hpos hsum) γ b).toReal) := by + have hr := finiteVariational_ne_top_bot ρ eig hpos hsum + have hf := finiteMagneticFunctional_ne_top_bot _ γ b hγ hγsum hr.1 hr.2 + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [finiteR_uniform_weights ρs ρ eig hspos hssum hpos hsum hρs ε hε] with k hk + have hrk := finiteVariational_ne_top_bot (ρs k) eig (hspos k) (hssum k) + have hfk := finiteMagneticFunctional_ne_top_bot _ γ b hγ hγsum hrk.1 hrk.2 + have hleft := finiteMagneticFunctional_spectral_le_add γ b + (finiteR (ρs k) eig (hspos k) (hssum k)) (finiteR ρ eig hpos hsum) + (continuous_finiteR (ρs k) eig (hspos k) (hssum k)) (continuous_finiteR ρ eig hpos hsum) + ε (fun x hx => (hk x hx).le) + have hright := finiteMagneticFunctional_spectral_le_add γ b + (finiteR ρ eig hpos hsum) (finiteR (ρs k) eig (hspos k) (hssum k)) + (continuous_finiteR ρ eig hpos hsum) (continuous_finiteR (ρs k) eig (hspos k) (hssum k)) + ε (fun x hx => by simpa only [abs_sub_comm] using (hk x hx).le) + rw [← EReal.coe_toReal hfk.1 hfk.2,← EReal.coe_toReal hf.1 hf.2, + ← EReal.coe_add,EReal.coe_le_coe_iff] at hleft hright + rw [Real.dist_eq,abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralPartition.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..c26e4a61f9e90ed8f7980615716b3e10c9e30289 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralPartition.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteType +import OAI.Probability.InvariantIsing.Spectral.PositiveSpectralPartition + +namespace OAI + +/-! Null-boundary spectral rounding for the finite external-field formula. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Classical BigOperators Function +namespace InvariantIsing + +theorem spectral_partition_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {ι : Type*} [Fintype ι] + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + (S : ι → Set ℝ) (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) (hbd : ∀ i, (ν : Measure ℝ) (frontier (S i))=0) + (lam : ι → ℝ) (fallback aMax : {i // 0 < (ν : Measure ℝ).real (S i)}) + (hMax : ∀ a : {i // 0 < (ν : Measure ℝ).real (S i)}, lam a ≤ lam aMax) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ b : A → ℝ) + (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ V, rotatedPressure + (fun i => lam (positiveSpectralLabel (fun a => (ν : Measure ℝ).real (S a)) fallback + (spectralPartitionIndex S hcover (eig N i)))) + (matrixRotation V⁻¹) (fun i => b (group N i)) ∂μ N) atTop + (𝓝 (finiteMagneticFunctional (measureR + (finiteSpectralMeasure (fun i : {i // 0 < (ν : Measure ℝ).real (S i)} => + (ν : Measure ℝ).real (S i)) (fun i => lam i)) (lam aMax)) γ b).toReal) := by + let w := fun a => (ν : Measure ℝ).real (S a) + let g := fun N (i : Fin N) => spectralPartitionIndex S hcover (eig N i) + have hc := spectral_label_counts_partition (fun k => k+1) Nat.succ_pos + (fun k => eig (k+1)) ν hweak S hS hbd (fun k => g (k+1)) + (fun k a i => spectralPartitionIndex_eq_iff S hcover hdis (eig (k+1) i) a) + have hp := positive_spectral_counts_tendsto (fun k => k+1) (fun k => g (k+1)) + w (fun _ => measureReal_nonneg) fallback hc + have hfull : Tendsto (fun N a => + (spectralLabelCount (positiveSpectralLabel w fallback ∘ g N) a : ℝ)/N) + atTop (𝓝 (fun a : {i // 0 < w i} => w a)) := + (tendsto_add_atTop_iff_nat 1).mp hp + exact finite_type_field_pressure_tendsto hhaar hgauss hpub μ (fun a : {i // 0 < w i} => lam a) + (fun N => positiveSpectralLabel w fallback ∘ g N) (fun a : {i // 0 < w i} => w a) + (fun a => a.property) (positiveSpectralWeights_sum w (fun _ => measureReal_nonneg) + (spectralPartitionWeights_sum (ν : Measure ℝ) S hcover hdis hS)) hfull aMax hMax group γ b hγ hγsum hgroup + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralPopulationLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralPopulationLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e24d18fee752ec78041988daebd3e0e6e8994a2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSpectralPopulationLower.lean @@ -0,0 +1,104 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldPopulationLower +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpectralContinuity + +namespace OAI + +/-! Rational approximation of the spectral populations gives the physical +finite-field lower bound for arbitrary positive real populations. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology BigOperators +namespace InvariantIsing + +theorem finite_physical_field_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m : ℕ} (hm : 2 ≤ m) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (γ : A → ℝ) (hγ : ∀ a, 0 < γ a) (hγsum : ∑ a, γ a=1) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + : ∀ ε > 0, ∀ᶠ M in atTop, + (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal-ε ≤ + ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M := by + have hm0 : 0 < m := by omega + let τ := positiveApproxWeights ρ + have hτpos j a : 0 < τ j a := positiveApproxWeights_pos hm0 ρ j a + have hτsum j : ∑ a, τ j a=1 := positiveApproxWeights_sum hm0 ρ j + have hτ : Tendsto τ atTop (𝓝 ρ) := positiveApproxWeights_tendsto ρ (fun a => (hρ a).le) hsum + let F := (finiteMagneticFunctional (finiteR ρ lam hρ hsum) γ b).toReal + let Fq := fun j => (finiteMagneticFunctional (finiteR (τ j) lam (hτpos j) (hτsum j)) γ b).toReal + have hF : Tendsto Fq atTop (𝓝 F) := finiteMagneticFunctional_tendsto_weights + τ ρ lam hτpos hτsum hρ hsum hτ γ b (fun a => (hγ a).le) hγsum + intro ε hε + let r := ε/(4*(2*K+1)) + have hr : 0 < r := div_pos hε (by positivity) + have hrel : ∀ᶠ j in atTop, ∀ a, |ρ a-τ j a|/min (ρ a) (τ j a) ρ a) atTop (𝓝 (ρ a)) := tendsto_const_nhds + have hh := ((hc.sub ht).abs).div (hc.min ht) (by simpa only [min_self] using (hρ a).ne') + change Tendsto (fun j => |ρ a-τ j a|/min (ρ a) (τ j a)) atTop + (𝓝 (|ρ a-ρ a|/min (ρ a) (ρ a))) at hh + have hz : Tendsto (fun j => |ρ a-τ j a|/min (ρ a) (τ j a)) atTop (𝓝 0) := by + simpa only [sub_self,abs_zero,zero_div] using hh + exact hz.eventually (Iio_mem_nhds hr) + obtain ⟨j,hj,hjF⟩ := (hrel.and (Metric.tendsto_nhds.mp hF (ε/4) (by positivity))).exists + let s := fun a => positiveApproxCount (ρ a) j + let n := positiveApproxDenominator ρ j + have hn : 0 < n := positiveApproxDenominator_pos hm0 ρ j + have hs a : 0 < s a := positiveApproxCount_pos (ρ a) j + have hsn : ∑ a, s a=n := rfl + have hcount a : (s a : ℝ)=(n : ℝ)*τ j a := by + exact (mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hn.ne')).symm + let A := fun M => cavityResidueLabel hm0 s hsn M + have hA : Tendsto (fun M a => (spinGroupSize (A M) a : ℝ)/M) atTop (𝓝 (τ j)) := + cavity_canonical_mass_tendsto hm0 hn s hsn + have hlo := finite_rational_spectrum_field_pressure_lower hhaar hgauss hpub hm hn + (τ j) lam (hτpos j) (hτsum j) hK hlam amax hmax μ s hs hsn hcount A hA γ hγ hγsum + g b hg hD hb (ε/4) (by positivity) + have he' := he.comp (tendsto_add_atTop_nat 1) + have hA' := hA.comp (tendsto_add_atTop_nat 1) + have hcounts := eventually_relative_count_bound (fun k => k+1) (fun _ => by omega) + (fun k a => spinGroupSize (e (k+1)) a) (fun k a => spinGroupSize (A (k+1)) a) + ρ (τ j) hρ (hτpos j) he' hA' r hj + have hesurj := eventually_surjective_label (fun _ => by omega) (fun k => e (k+1)) ρ hρ he' + have hAsurj := eventually_surjective_label (fun _ => by omega) (fun k => A (k+1)) (τ j) (hτpos j) hA' + let P := fun M => ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M + have hsmall : 2*K*r/2<ε/4 := by + have hh : r*(4*(2*K+1))=ε := div_mul_cancel₀ _ (by positivity) + nlinarith + have hev : ∀ᶠ k in atTop, F-ε≤P (k+1) := by + filter_upwards [(tendsto_add_atTop_nat 1).eventually hlo,hcounts,hesurj,hAsurj] with k hl hk hes hAs + have hcomp := cavity_meanPressure_multiplicity_comparison (by omega : 0 < k+1) (μ (k+1)) + (e (k+1)) (A (k+1)) hes hAs lam (fun i => b (g (k+1) i)) K hlam + (2*K) r (by positivity) hr.le + (fun a b => (abs_sub _ _).trans (by linarith [hlam a,hlam b])) hk + have hh := (abs_le.mp hcomp).2 + rw [Real.dist_eq] at hjF + have hFq := (abs_lt.mp hjF).1 + change Fq j-ε/4≤_ at hl + change _-P (k+1)≤_ at hh + linarith + obtain ⟨J,hJ⟩ := eventually_atTop.mp hev + apply eventually_atTop.mpr + refine ⟨J+1,fun M hM => ?_⟩ + obtain ⟨k,rfl⟩ : ∃ k, M=k+1 := ⟨M-1,(Nat.sub_add_cancel (by omega)).symm⟩ + exact hJ k (by omega) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareInitial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2e9ef9524013a8ad9f16f95f827f29d71e9e931 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareInitial.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledContinuation + +namespace OAI + +/-! Exact initial square data for the induction over Gaussian levels. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma closedMagneticSquareContinuation_zero_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) + (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticContinuation L + (magneticScalarSquareFourJet L hL 0).toMagneticContinuationJet ζ (0, s) = s ^ 2 := by + by_cases hsi : |s| < 1 + · simp only [closedMagneticContinuation, hsi, ite_true] + rw [magneticScalarSlabContinuation_eq_jet L hL, + magneticScalarSlabContinuationJet_zero, magneticScalarSquareFourJet_value, + fieldScalarSquares_zero] + have hm := magneticScalarSlabMean_bias L hL hζ hsi (0 : ℝ) + rw [magneticScalarSlabMean_zero] at hm + rw [hm] + · have he : |s| = 1 := le_antisymm (abs_le.mpr hs) (le_of_not_gt hsi) + have hsq : s ^ 2 = 1 := by rw [← sq_abs, he]; norm_num + simp only [closedMagneticContinuation, hsi, ite_false, hsq] + +lemma closedMagneticSquareContinuation_cons_initial (av : ℝ × ℝ≥0) + (L : List (ℝ × ℝ≥0)) (hL : ∀ bv ∈ av :: L, 0 < bv.1) + (i : Fin (L.length + 1)) (ζ s : ℝ) : + closedMagneticContinuation (av :: L) + (magneticScalarSquareFourJet (av :: L) hL i.succ).toMagneticContinuationJet ζ (0, s) = + closedMagneticContinuation L + (magneticScalarSquareFourJet L + (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) i).toMagneticContinuationJet + av.1 ((av.2 : ℝ), s) := by + by_cases hs : |s| < 1 + · simp only [closedMagneticContinuation, hs, ite_true] + rw [magneticScalarSlabContinuation_eq_jet (av :: L) hL, + magneticScalarSlabContinuationJet_zero, magneticScalarSlabBias_cons_initial, + magneticScalarSlabContinuation_eq_jet L + (fun bv hb => hL bv (List.mem_cons_of_mem av hb))] + simp only [magneticScalarSlabContinuationJet, MagneticContinuationJet.transition, + magneticScalarSquareFourJet_value, Real.toNNReal_coe] + rfl + · simp only [closedMagneticContinuation, hs, ite_false] + +lemma magneticScaledSquareContinuation_zero_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (α : ℝ≥0) {ζ s : ℝ} (hζ : 0 ≤ ζ) + (hs : s ∈ Icc (-1 : ℝ) 1) : + magneticScaledSquareContinuation L hL α 0 ζ (0, s) = s ^ 2 := by + simpa only [magneticScaledSquareContinuation, magneticScaledSquareJet, mul_zero, + Fin.cast_zero] using + closedMagneticSquareContinuation_zero_initial (fieldScaleIncrements α L) + (fieldScaleIncrements_positive α L hL) hζ hs + +lemma magneticScaledSquareContinuation_cons_initial (av : ℝ × ℝ≥0) + (L : List (ℝ × ℝ≥0)) (hL : ∀ bv ∈ av :: L, 0 < bv.1) + (α : ℝ≥0) (i : Fin (L.length + 1)) (ζ s : ℝ) : + magneticScaledSquareContinuation (av :: L) hL α i.succ ζ (0, s) = + magneticScaledSquareContinuation L (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + α i av.1 ((av.2 : ℝ), s) := by + have hi : (Fin.cast (by simp only [fieldScaleIncrements_length, List.length_cons]) i.succ : + Fin ((fieldScaleIncrements α (av :: L)).length + 1)) = + (Fin.cast (by rw [fieldScaleIncrements_length]) i : + Fin ((fieldScaleIncrements α L).length + 1)).succ := by + apply Fin.ext + rfl + unfold magneticScaledSquareContinuation magneticScaledSquareJet + rw [hi] + convert closedMagneticSquareContinuation_cons_initial (av.1, α ^ 2 * av.2) + (fieldScaleIncrements α L) (fieldScaleIncrements_positive α (av :: L) hL) + (Fin.cast (by rw [fieldScaleIncrements_length]) i) ζ s using 1 <;> + simp only [fieldScaleIncrements, List.map_cons, mul_zero, NNReal.coe_mul, NNReal.coe_pow] + all_goals rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareInverseConvex.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareInverseConvex.lean new file mode 100644 index 0000000000000000000000000000000000000000..e77069183bce38a36a9342a7af1351ea5f3bfb43 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareInverseConvex.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedPosition + +namespace OAI + +/-! Every finite conditional square mean is convex in the inverse mean +coordinate. This is derived by induction through the actual Gaussian steps. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSquareFourJet_zero_toJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : + (magneticScalarSquareFourJet L hL 0).toMagneticContinuationJet = + (magneticLogCoshMeanJet L hL).square := by + apply MagneticContinuationJet.eq_of_value_eq + funext z + rw [magneticScalarSquareFourJet_value] + exact fieldScalarSquares_zero L _ _ z + +lemma magneticScalarSquareFourJet_succ_toJet (av : ℝ × ℝ≥0) (L : List (ℝ × ℝ≥0)) + (hL : ∀ bv ∈ av :: L, 0 < bv.1) (i : Fin (L.length + 1)) : + (magneticScalarSquareFourJet (av :: L) hL i.succ).toMagneticContinuationJet = + magneticScalarSlabContinuationJet L (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + (magneticScalarSquareFourJet L (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + i).toMagneticContinuationJet av.1 (av.2 : ℝ) := by + apply MagneticContinuationJet.eq_of_value_eq + funext z + rw [magneticScalarSquareFourJet_value] + simp only [magneticScalarSlabContinuationJet, MagneticContinuationJet.transition, + Real.toNNReal_coe, magneticScalarSquareFourJet_value] + rfl + +lemma magneticSquareJet_weighted_nonneg (P : MagneticContinuationJet) (z : ℝ) + (hq : P.first z ≠ 0) : + 0 ≤ P.square.second z - P.square.first z * (P.second z / P.first z) := by + have he : P.square.second z - P.square.first z * (P.second z / P.first z) = + 2 * (P.first z) ^ 2 := by + simp only [MagneticContinuationJet.square] + field_simp [hq] + ring + rw [he] + positivity + +theorem magneticScalarSquare_inverse_convex (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (i : Fin (L.length + 1)) (z : ℝ) : + let P := magneticLogCoshMeanJet L hL + let A := magneticScalarSquareFourJet L hL i + 0 ≤ A.second z - A.first z * (P.second z / P.first z) := by + induction L generalizing z with + | nil => + have hi : i = 0 := by + apply Fin.ext + change i.val = 0 + have hh : i.val < 1 := by simpa only [List.length_nil, zero_add] using i.isLt + omega + subst i + dsimp only + rw [show (magneticScalarSquareFourJet [] hL 0).second = + (magneticLogCoshMeanJet [] hL).square.second from + congrArg MagneticContinuationJet.second (magneticScalarSquareFourJet_zero_toJet [] hL)] + rw [show (magneticScalarSquareFourJet [] hL 0).first = + (magneticLogCoshMeanJet [] hL).square.first from + congrArg MagneticContinuationJet.first (magneticScalarSquareFourJet_zero_toJet [] hL)] + exact magneticSquareJet_weighted_nonneg _ z (fieldScalarLogCoshSecond_pos [] hL z).ne' + | cons av L ih => + let ht := fun bv hb => hL bv (List.mem_cons_of_mem av hb) + let ht1 := fun bv hb => hL1 bv (List.mem_cons_of_mem av hb) + refine Fin.cases ?_ (fun j => ?_) i + · have he := magneticScalarSquareFourJet_zero_toJet (av :: L) hL + dsimp only + rw [congrArg MagneticContinuationJet.second he, congrArg MagneticContinuationJet.first he] + exact magneticSquareJet_weighted_nonneg _ z (fieldScalarLogCoshSecond_pos _ hL z).ne' + · have hn := magneticScalarSlabWeighted_nonneg_at_position L ht ht1 + (magneticScalarSquareFourJet L ht j) (magneticScalarSquareFourJet_sandwich L ht j) + (hL av List.mem_cons_self).le (hL1 av List.mem_cons_self) + (fun x => ih ht ht1 j x) (show 0 ≤ (av.2 : ℝ) from av.2.property) z + have hJ := magneticScalarSlabJet_eq_cons L ht (hL av List.mem_cons_self) (av.2 : ℝ) + have hA := magneticScalarSquareFourJet_succ_toJet av L hL j + dsimp only at hn ⊢ + rw [← hA, hJ] at hn + simpa only [Real.toNNReal_coe] using hn + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareJet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..e030bf3d2906fc938b5e14a04f61eeab35f83afd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareJet.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarFourJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarSlabEndpoint +import OAI.Probability.InvariantIsing.Fields.FieldScalarOverlap + +namespace OAI + +/-! The actual finite-level square continuations satisfy every endpoint +hypothesis of the inverse-coordinate comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def magneticScalarSquareFourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) : MagneticContinuationFourJet := + (fieldScalarSquares_has_bounded_fourJet L hL i).choose + +lemma magneticScalarSquareFourJet_value (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) : + (magneticScalarSquareFourJet L hL i).value = + fieldScalarSquares L (fun z => Real.log (Real.cosh z)) Real.tanh i := + (fieldScalarSquares_has_bounded_fourJet L hL i).choose_spec + +lemma magneticScalarSquareFourJet_sandwich (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (i : Fin (L.length + 1)) (z : ℝ) : + ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ + (magneticScalarSquareFourJet L hL i).value z ∧ + (magneticScalarSquareFourJet L hL i).value z ≤ 1 := by + rw [magneticScalarSquareFourJet_value] + have htan : Measurable Real.tanh := by + change Measurable (fun x : ℝ => Real.tanh x) + simp only [Real.tanh_eq] + fun_prop + have hm := fieldScalarSquares_monotone L hL measurable_logCosh logCosh_linearGrowth + htan field_abs_tanh_le_one z (show (0 : Fin (L.length + 1)) ≤ i by exact Fin.zero_le i) + dsimp only at hm + rw [fieldScalarSquares_zero] at hm + exact ⟨hm, (fieldScalarSquares_regular L hL measurable_logCosh logCosh_linearGrowth + htan field_abs_tanh_le_one i).2 z |>.2⟩ + +theorem magneticScalarSlabSquareWeighted_tendsto_endpoint {ι : Type*} {l : Filter ι} + (L : List (ℝ × ℝ≥0)) (hL : ∀ av ∈ L, 0 < av.1) + (hL1 : ∀ av ∈ L, av.1 ≤ 1) (j : Fin (L.length + 1)) + {ζ c : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hc : c = -1 ∨ c = 1) + (v s : ι → ℝ) (hs : ∀ᶠ i in l, |s i| < 1) (hslim : Tendsto s l (𝓝 c)) : + Tendsto (fun i => magneticScalarSlabWeighted L hL + (magneticScalarSquareFourJet L hL j).toMagneticContinuationJet ζ (v i) (s i)) l (𝓝 0) := + magneticScalarSlabWeighted_tendsto_endpoint L hL hL1 _ + (magneticScalarSquareFourJet_sandwich L hL j) hζ hζ1 hc v s hs hslim + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareSlabConvex.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareSlabConvex.lean new file mode 100644 index 0000000000000000000000000000000000000000..48f5ae249a12eb4cac9ed02eba2966d820522b10 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticSquareSlabConvex.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareInverseConvex + +namespace OAI + +/-! Nonnegative inverse-spin second derivatives of the actual finite-level +conditional square means, after an additional Gaussian root step. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +theorem magneticScalarSlabSquare_second_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (i : Fin (L.length + 1)) {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + {v s : ℝ} (hv : 0 ≤ v) (hs : |s| < 1) : + 0 ≤ magneticScalarSlabContinuationSecond L hL + (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ v s := by + have hinit : ∀ u, |u| < 1 → 0 ≤ magneticScalarSlabWeighted L hL + (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ 0 u := by + intro u hu + rw [magneticScalarSlabWeighted_zero] + exact magneticScalarSquare_inverse_convex L hL hL1 i _ + have hn := magneticScalarSlabWeighted_nonneg L hL hL1 _ + (magneticScalarSquareFourJet_sandwich L hL i) hζ hζ1 hinit hv hs + rw [magneticScalarSlabWeighted_eq_curvature_square L hL _ hζ] at hn + exact nonneg_of_mul_nonneg_right hn (sq_pos_of_pos + (magneticScalarInverseCurvature_pos L hL hζ v s)) + +theorem magneticScalarSlabSquare_deriv2_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (i : Fin (L.length + 1)) {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + {v s : ℝ} (hv : 0 ≤ v) (hs : |s| < 1) : + 0 ≤ deriv (deriv (magneticScalarSlabContinuation L + (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ v)) s := by + rw [magneticScalarSlabContinuation_second_deriv L hL _ hζ hs v] + exact magneticScalarSlabSquare_second_nonneg L hL hL1 i hζ hζ1 hv hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticStationaryFamily.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticStationaryFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7340a0f9fd7c76dd4cf52daa04834eeb67dee31 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticStationaryFamily.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationIBP +import OAI.Probability.InvariantIsing.Fields.FieldSecondFamily + +namespace OAI + +/-! The fixed terminal potential as an actual two-coordinate family. +This permits use of the established affine Gaussian differentiation theorem +for the inverse-coordinate time comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def magneticStationaryFamily (I : Set ℝ) (F : ℝ → ℝ) (P : MagneticContinuationJet) + (hF : Measurable F) (K L : ℝ) (bK : ∀ z, |P.value z| ≤ K) + (bL : ∀ z, |P.first z| ≤ L) (dF : ∀ z, HasDerivAt F (P.value z) z) : + FieldSecondFamily I where + U := fun p => F p.2 + X := fun p => P.value p.2 + XX := fun p => P.first p.2 + T := fun _ => 0 + KX := K + KXX := L + KT := 0 + mU := hF.comp measurable_snd + mX := P.mValue.comp measurable_snd + mXX := P.mFirst.comp measurable_snd + mT := measurable_const + bX := fun p => bK p.2 + bXX := fun p => bL p.2 + bT := fun _ _ => by simp + derivative := fun p _ => by + convert (dF p.2).hasFDerivAt.comp p hasFDerivAt_snd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro q + simp [pairLinear, mul_comm] + spatial := fun _ => dF + second := fun _ => P.dValue + TX := fun _ => 0 + TT := fun _ => 0 + KTX := 0 + KTT := 0 + mTX := measurable_const + mTT := measurable_const + bTX := fun _ _ => by simp + bTT := fun _ _ => by simp + derivativeX := fun p _ => by + convert (P.dValue p.2).hasFDerivAt.comp p hasFDerivAt_snd using 1 + · rfl + · apply ContinuousLinearMap.ext + intro q + simp [pairLinear, mul_comm] + derivativeT := fun p _ => by + convert hasFDerivAt_const (0 : ℝ) p using 1 + apply ContinuousLinearMap.ext + intro q + simp [pairLinear] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTailComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTailComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..285afc9f09942a095febb43136330dabb5504df4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTailComparison.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationClosedPDE +import OAI.Probability.InvariantIsing.Magnetic.MagneticScaledBounds +import OAI.Probability.InvariantIsing.Magnetic.MagneticBoundedInverseComparison +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationComparison + +namespace OAI + +/-! Finite-tail comparison with initial inverse-curvature order. The +analytic comparison hypotheses are derived from the actual Gaussian +recursions, leaving only the initial orders for use in a finite induction. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +theorem magneticClosedCurvature_compare_initial (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (hL1 : ∀ av ∈ L, av.1 ≤ 1) (hM1 : ∀ av ∈ M, av.1 ≤ 1) + {ζ η : ℝ} (hζ : 0 ≤ ζ) (hζη : ζ ≤ η) (hη1 : η ≤ 1) + (hinit : ∀ u ∈ Icc (-1 : ℝ) 1, + closedMagneticScalarCurvature L hL ζ (0, u) ≤ + closedMagneticScalarCurvature M hM η (0, u)) + {v s : ℝ} (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature L hL ζ (v, s) ≤ + closedMagneticScalarCurvature M hM η (v, s) := by + have hζ1 := hζη.trans hη1 + have hη := hζ.trans hζη + have hall := inverse_curvature_parabolic_comparison_bound (A := 1) hv hη hζη + (closedMagneticScalarCurvature L hL ζ) (closedMagneticScalarTime L hL ζ) + (closedMagneticScalarSlope L hL ζ) (closedMagneticScalarSecond L hL ζ) + (closedMagneticScalarCurvature M hM η) (closedMagneticScalarTime M hM η) + (closedMagneticScalarSlope M hM η) (closedMagneticScalarSecond M hM η) + ((continuousOn_closedMagneticScalarCurvature L hL hL1 hζ hζ1).mono + (fun p hp => ⟨mem_univ _, hp.2⟩)) + ((continuousOn_closedMagneticScalarCurvature M hM hM1 hη hη1).mono + (fun p hp => ⟨mem_univ _, hp.2⟩)) hinit + (fun t ht u _ => (closedMagneticScalarCurvature_hasDerivAt_time L hL hζ ht.1 u).hasDerivWithinAt) + (fun t ht u _ => (closedMagneticScalarCurvature_hasDerivAt_time M hM hη ht.1 u).hasDerivWithinAt) + (fun t _ u hu => closedMagneticScalarCurvature_hasDerivAt_spin L hL hζ (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticScalarCurvature_hasDerivAt_spin M hM hη (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticScalarSlope_hasDerivAt_spin L hL hζ (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticScalarSlope_hasDerivAt_spin M hM hη (abs_lt.mpr hu) t) + (fun p _ => closedMagneticScalarCurvature_nonneg L hL hζ p) + (fun p _ => closedMagneticScalarCurvature_nonneg M hM hη p) + (fun p hp => closedMagneticScalarCurvature_le_one L hL hL1 hζ hζ1 p hp.2) + (fun p _ => closedMagneticScalarCurvature_weighted_second_bound_nonneg L hL hL1 hζ hζ1 p) + (fun t _ => by + obtain ⟨ha, hb⟩ := closedMagneticScalarCurvature_endpoints L hL ζ t + obtain ⟨hc, hd⟩ := closedMagneticScalarCurvature_endpoints M hM η t + exact ⟨ha, hc, hb, hd⟩) + (fun _ _ => rfl) (fun _ _ => rfl) + exact hall (v, s) ⟨⟨hv, le_rfl⟩, hs⟩ + +theorem magneticClosedSquare_compare_initial (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (hL1 : ∀ av ∈ L, av.1 ≤ 1) (hM1 : ∀ av ∈ M, av.1 ≤ 1) + (i : Fin (L.length + 1)) (j : Fin (M.length + 1)) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hcurv : ∀ u ∈ Icc (-1 : ℝ) 1, + closedMagneticScalarCurvature L hL ζ (0, u) ≤ + closedMagneticScalarCurvature M hM ζ (0, u)) + (hinit : ∀ u ∈ Icc (-1 : ℝ) 1, + closedMagneticContinuation L (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ (0, u) ≤ + closedMagneticContinuation M (magneticScalarSquareFourJet M hM j).toMagneticContinuationJet ζ (0, u)) + {v s : ℝ} (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticContinuation L (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ (v, s) ≤ + closedMagneticContinuation M (magneticScalarSquareFourJet M hM j).toMagneticContinuationJet ζ (v, s) := by + let A := (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet + let B := (magneticScalarSquareFourJet M hM j).toMagneticContinuationJet + have hall := magnetic_continuation_coefficient_comparison hv + (closedMagneticContinuation L A ζ) (closedMagneticContinuationTime L hL A ζ) + (closedMagneticContinuationSlope L hL A ζ) (closedMagneticContinuationSecond L hL A ζ) + (closedMagneticContinuation M B ζ) (closedMagneticContinuationTime M hM B ζ) + (closedMagneticContinuationSlope M hM B ζ) (closedMagneticContinuationSecond M hM B ζ) + (closedMagneticScalarCurvature L hL ζ) (closedMagneticScalarCurvature M hM ζ) + ((continuousOn_closedMagneticContinuation L hL A + (magneticScalarSquareFourJet_sandwich L hL i) hζ).mono (fun p hp => ⟨mem_univ _, hp.2⟩)) + ((continuousOn_closedMagneticContinuation M hM B + (magneticScalarSquareFourJet_sandwich M hM j) hζ).mono (fun p hp => ⟨mem_univ _, hp.2⟩)) hinit + (fun t ht u _ => (closedMagneticContinuation_hasDerivAt_time L hL A hζ ht.1 u).hasDerivWithinAt) + (fun t ht u _ => (closedMagneticContinuation_hasDerivAt_time M hM B hζ ht.1 u).hasDerivWithinAt) + (fun t _ u hu => closedMagneticContinuation_hasDerivAt_spin L hL A hζ (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticContinuation_hasDerivAt_spin M hM B hζ (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticContinuationSlope_hasDerivAt_spin L hL A hζ (abs_lt.mpr hu) t) + (fun t _ u hu => closedMagneticContinuationSlope_hasDerivAt_spin M hM B hζ (abs_lt.mpr hu) t) + (fun p _ => closedMagneticScalarCurvature_nonneg L hL hζ p) + (fun p hp => magneticClosedCurvature_compare_initial L M hL hM hL1 hM1 hζ + (le_refl ζ) hζ1 hcurv hp.1.1 hp.2) + (fun p hp => closedMagneticSquareContinuationSecond_nonneg L hL hL1 i hζ hζ1 hp.1.1.le p.2) + (fun t _ => closedMagneticScalarCurvature_endpoints M hM ζ t) + (fun _ _ => rfl) (fun _ _ => rfl) + exact hall (v, s) ⟨⟨hv, le_rfl⟩, hs⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTailCongruence.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTailCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..863f1ba390dffbc3e0ebd47da21fa7ea2e78938c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTailCongruence.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Fields.FieldGaussianSemigroup +import OAI.Probability.InvariantIsing.Magnetic.MagneticTailComparison + +namespace OAI + +/-! Equality of backward field values gives equality of their actual +inverse curvatures. In particular, an equal-exponent Gaussian step may be +split without changing the inverse-coordinate model. -/ + +noncomputable section +open Filter Set IsingPerceptron +open scoped NNReal Topology + +namespace InvariantIsing + +lemma closedMagneticScalarCurvature_cons_initial (av : ℝ × ℝ≥0) + (L : List (ℝ × ℝ≥0)) (hL : ∀ bv ∈ av :: L, 0 < bv.1) (ζ s : ℝ) : + closedMagneticScalarCurvature (av :: L) hL ζ (0, s) = + closedMagneticScalarCurvature L (fun bv hb => hL bv (List.mem_cons_of_mem av hb)) + av.1 ((av.2 : ℝ), s) := by + by_cases hs : |s| < 1 + · simp only [closedMagneticScalarCurvature, hs, ite_true] + exact magneticScalarInverseCurvature_cons_initial av L hL ζ s + · simp only [closedMagneticScalarCurvature, hs, ite_false] + +lemma magneticClosedCurvature_exponent_mono (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ η : ℝ} (hζ : 0 ≤ ζ) (hζη : ζ ≤ η) (hη1 : η ≤ 1) + {v s : ℝ} (hv : 0 ≤ v) (hs : s ∈ Set.Icc (-1 : ℝ) 1) : + closedMagneticScalarCurvature L hL ζ (v, s) ≤ + closedMagneticScalarCurvature L hL η (v, s) := by + apply magneticClosedCurvature_compare_initial L L hL hL hL1 hL1 hζ hζη hη1 ?_ hv hs + intro u _ + exact (closedMagneticScalarCurvature_initial L hL ζ η u).le + +lemma magneticLogCoshMeanJet_eq_of_value_eq (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fieldScalarValue M (fun z => Real.log (Real.cosh z))) : + magneticLogCoshMeanJet L hL = magneticLogCoshMeanJet M hM := by + apply MagneticContinuationJet.eq_of_value_eq + funext z + have hl := hasDerivAt_fieldScalarLogCosh L hL z + rw [he] at hl + exact hl.unique (hasDerivAt_fieldScalarLogCosh M hM z) + +lemma magneticScalarSlabBias_eq_of_value_eq (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fieldScalarValue M (fun z => Real.log (Real.cosh z))) (ζ v : ℝ) : + magneticScalarSlabBias L ζ v = magneticScalarSlabBias M ζ v := by + have hJ := magneticLogCoshMeanJet_eq_of_value_eq L M hL hM he + have hm : magneticScalarSlabMean L ζ v = magneticScalarSlabMean M ζ v := by + funext z + rw [magneticScalarSlabMean_eq L hL, magneticScalarSlabMean_eq M hM, hJ, he] + unfold magneticScalarSlabBias + rw [hm] + +lemma closedMagneticScalarCurvature_eq_of_value_eq (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fieldScalarValue M (fun z => Real.log (Real.cosh z))) (ζ : ℝ) (p : ℝ × ℝ) : + closedMagneticScalarCurvature L hL ζ p = closedMagneticScalarCurvature M hM ζ p := by + have hJ := magneticLogCoshMeanJet_eq_of_value_eq L M hL hM he + have hb := magneticScalarSlabBias_eq_of_value_eq L M hL hM he ζ p.1 + unfold closedMagneticScalarCurvature + split_ifs + · unfold magneticScalarInverseCurvature + rw [hJ, he, hb] + · rfl + +lemma fieldScalarValue_same_exponent (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) (v w : ℝ≥0) : + fieldScalarValue ((ζ, v) :: (ζ, w) :: L) (fun z => Real.log (Real.cosh z)) = + fieldScalarValue ((ζ, v + w) :: L) (fun z => Real.log (Real.cosh z)) := by + funext z + exact gaussianOperator_same_exponent ζ v w + (fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth).1 + (fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth).2 z + +lemma closedMagneticScalarCurvature_same_exponent (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 < ζ) + (v w : ℝ≥0) (η : ℝ) (p : ℝ × ℝ) : + closedMagneticScalarCurvature ((ζ, v) :: (ζ, w) :: L) + (by intro av hav; simp only [List.mem_cons] at hav; rcases hav with rfl | rfl | hav + · exact hζ + · exact hζ + · exact hL av hav) η p = + closedMagneticScalarCurvature ((ζ, v + w) :: L) + (by intro av hav; rcases List.mem_cons.mp hav with rfl | hav + · exact hζ + · exact hL av hav) η p := + closedMagneticScalarCurvature_eq_of_value_eq _ _ _ _ + (fieldScalarValue_same_exponent L hL ζ v w) η p + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTemplateFullLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTemplateFullLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..50e317592f8e690d66446cd6590b48b0a851c1c8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTemplateFullLower.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAffineTemplateLower +import OAI.Probability.InvariantIsing.Core.AffineTemplateComparison +import OAI.Probability.InvariantIsing.Magnetic.MagneticResidueSelection +import OAI.Probability.InvariantIsing.Cavity.CavityResidueFamily + +namespace OAI + +/-! A rational spectral and magnetic template gives a lower bound along +all physical dimensions, by selecting an arbitrary bad residue for each +candidate block size. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_template_full_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + (e : (M : ℕ) → Fin M → Fin m) + (he : Tendsto (fun M a => (spinGroupSize (e M) a : ℝ)/M) atTop (𝓝 ρ)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin n → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=n*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ a, (k a : ℝ)=spinGroupSize group a*((1+mag a)/2)) + (g : (M : ℕ) → Fin M → A) (b : A → ℝ) + (hg : Tendsto (fun M a => (spinGroupSize (g M) a : ℝ)/M) atTop (𝓝 γ)) + {D : ℝ} (hD : 0 ≤ D) (hb : ∀ a, |b a| ≤ D) + (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∀ ε > 0, ∀ᶠ M in atTop, L+(∑ a, γ a*b a*mag a)-ε ≤ + ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M := by + let B := fun r => (r+1)*n + let q := fun r => m*B r-B r+B r+3 + let P := fun M => ∫ V, rotatedPressure (fun i => lam (e M i)) (matrixRotation V⁻¹) + (fun i => b (g M i)) ∂μ M + apply magnetic_full_lower_of_residue_selection B q + (fun r => Nat.mul_pos (Nat.succ_pos r) hn) P (L+∑ a, γ a*b a*mag a) + intro t + let c := fun r => cavityResidueOffset (by omega : 0 < m) (t r) + let R := fun r => (Finset.univ : Finset (Spin (∑ a, c r a))) + have hR r : (R r).Nonempty := Finset.univ_nonempty + obtain ⟨r,hr⟩ := magnetic_affine_template_pressure_lower hhaar hgauss hpub hm hn + ρ lam hρ hsum hK hlam amax hmax μ spec hsp hspec hρspec c R hR + group k hk γ mag hγ hγsum hcount hs hmag hc b L hL + refine ⟨r,fun ε hε => ?_⟩ + have hspec' : ∑ a, (r+1)*spec a=B r := by rw [← Finset.mul_sum,hspec] + have hρspec' a : ((r+1)*spec a : ℕ)=(B r : ℝ)*ρ a := by + dsimp only [B] + rw [Nat.cast_mul,Nat.cast_mul,hρspec] + ring + have hcomp := affine_template_pressure_comparison (by omega : 0 < m) + (Nat.mul_pos (Nat.succ_pos r) hn) (q r) (by dsimp only [q]; omega) + (fun a => (r+1)*spec a) (c r) hspec' ρ lam hρ hρspec' μ e he + g γ b hg (consecutiveSiteGroup (r+1) group) + (consecutiveSiteGroup_proportion group γ hcount) hK hlam hD hb + have hevent := (tendsto_order.mp hcomp).1 (-ε/2) (by linarith) + filter_upwards [hr (ε/2) (by linarith),hevent] with j hj hd + dsimp only at hj hd + have hsumc : ∑ a, c r a=(t r : ℕ) := cavityResidueOffset_sum _ _ + rw [hsumc] at hj hd + change L+(∑ a, γ a*b a*mag a)-ε ≤ P ((t r : ℕ)+(q r+j)*B r) + dsimp only [P] + dsimp only [B,q] at * + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTemplateLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTemplateLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..413f39b7dc6404bdeb7d24c965f533f5ff119229 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTemplateLower.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldSubsequenceLower +import OAI.Probability.InvariantIsing.Cavity.ConsecutiveGroupProfile + +namespace OAI + +/-! A single rational spectral/field template supplies the growing +attainable blocks in the physical magnetic pressure lower bound. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_template_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + (amax : Fin m) (hmax : ∀ a, lam a ≤ lam amax) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] + (spec : Fin m → ℕ) (hsp : ∀ a, 0 < spec a) (hspec : ∑ a, spec a=n) + (hρspec : ∀ a, (spec a : ℝ)=(n : ℝ)*ρ a) + {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin n → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ a, (spinGroupSize group a : ℝ)=n*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ a, (k a : ℝ)=spinGroupSize group a*((1+mag a)/2)) + (b : A → ℝ) (L : ℝ) (hL : L < (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal) : + ∃ r, ∀ ε > 0, ∀ᶠ j in atTop, + let B := (r+1)*n + let q := m*B-B+B+3 + let M := (q+j)*B + let g := cavityRationalLabel (by omega : 0 < m) (fun a => (r+1)*spec a) + (by rw [← Finset.mul_sum, hspec]) M + L+(∑ a, γ a*b a*mag a)-ε ≤ ∫ V, rotatedPressure (fun i => lam (g i)) (matrixRotation V⁻¹) + (consecutiveBlockField (q+j) (fun i => b (consecutiveSiteGroup (r+1) group i))) ∂μ M := by + let N := fun r => (r+1)*n + have hN r : 0 < N r := Nat.mul_pos (Nat.succ_pos r) hn + have hNlim : Tendsto N atTop atTop := by + apply tendsto_atTop_mono (fun r => ?_) tendsto_id + exact (Nat.le_succ r).trans (Nat.le_mul_of_pos_right (r+1) hn) + let sp := fun r a => (r+1)*spec a + have hsp' r a : 0 < sp r a := Nat.mul_pos (Nat.succ_pos r) (hsp a) + have hspec' r : ∑ a, sp r a=N r := by + dsimp only [sp, N] + rw [← Finset.mul_sum, hspec] + have hρsp r a : (sp r a : ℝ)=(N r : ℝ)*ρ a := by + dsimp only [sp, N] + rw [Nat.cast_mul, hρspec, Nat.cast_mul] + ring + have hh := magnetic_field_subsequence_lower hhaar hgauss hpub hm ρ lam hρ hsum hK hlam + amax hmax μ N hN hNlim sp hsp' hspec' hρsp + (fun r => consecutiveSiteGroup (r+1) group) (fun r a => (r+1)*k a) + (fun _ => consecutiveSiteGroup_attainable group k hk) γ mag hγ hγsum + (fun _ => consecutiveSiteGroup_proportion group γ hcount) hs hmag + (fun _ => consecutiveSiteGroup_magnetization group k mag hc) b L hL + exact hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTerminalCongruence.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTerminalCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c4c9cfdb51766850d229c490c466b214e9b06b1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTerminalCongruence.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Fields.FieldTerminalOne +import OAI.Probability.InvariantIsing.Magnetic.MagneticTailCongruence +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareInitial + +namespace OAI + +/-! Constant terminal shifts leave the optimizing bias, inverse +curvature, and all preceding conditional square means unchanged. -/ + +noncomputable section +open Filter Set IsingPerceptron +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticLogCoshMeanJet_eq_of_value_const_add (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) (c : ℝ) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fun z => c + fieldScalarValue M (fun z => Real.log (Real.cosh z)) z) : + magneticLogCoshMeanJet L hL = magneticLogCoshMeanJet M hM := by + apply MagneticContinuationJet.eq_of_value_eq + funext z + have hl := hasDerivAt_fieldScalarLogCosh L hL z + rw [he] at hl + exact hl.unique ((hasDerivAt_fieldScalarLogCosh M hM z).const_add c) + +lemma magneticScalarSlabMean_eq_of_value_const_add (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) (c : ℝ) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fun z => c + fieldScalarValue M (fun z => Real.log (Real.cosh z)) z) + (ζ v : ℝ) : magneticScalarSlabMean L ζ v = magneticScalarSlabMean M ζ v := by + have hj := magneticLogCoshMeanJet_eq_of_value_const_add L M hL hM c he + have hm := congrArg MagneticContinuationJet.value hj + change fieldScalarMean L (fun z => Real.log (Real.cosh z)) Real.tanh = + fieldScalarMean M (fun z => Real.log (Real.cosh z)) Real.tanh at hm + unfold magneticScalarSlabMean + rw [he, hm] + funext z + exact fieldSpinTransition_const_add ζ (Real.toNNReal v) _ _ c z + +lemma magneticScalarSlabBias_eq_of_value_const_add (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) (c : ℝ) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fun z => c + fieldScalarValue M (fun z => Real.log (Real.cosh z)) z) + (ζ v : ℝ) : magneticScalarSlabBias L ζ v = magneticScalarSlabBias M ζ v := by + unfold magneticScalarSlabBias + rw [magneticScalarSlabMean_eq_of_value_const_add L M hL hM c he] + +lemma closedMagneticScalarCurvature_eq_of_value_const_add (L M : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) (c : ℝ) + (he : fieldScalarValue L (fun z => Real.log (Real.cosh z)) = + fun z => c + fieldScalarValue M (fun z => Real.log (Real.cosh z)) z) + (ζ : ℝ) (p : ℝ × ℝ) : + closedMagneticScalarCurvature L hL ζ p = closedMagneticScalarCurvature M hM ζ p := by + have hj := magneticLogCoshMeanJet_eq_of_value_const_add L M hL hM c he + have hb := magneticScalarSlabBias_eq_of_value_const_add L M hL hM c he ζ p.1 + unfold closedMagneticScalarCurvature + split_ifs + · rw [magneticScalarInverseCurvature_eq, magneticScalarInverseCurvature_eq, hj, he, hb] + unfold fieldCurvatureTransform + simp only [fieldSpinTransition_const_add] + · rfl + +lemma closedMagneticScalarCurvature_terminal_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (v : ℝ≥0) + (hT : ∀ av ∈ L ++ [(1, v)], 0 < av.1) (ζ : ℝ) (p : ℝ × ℝ) : + closedMagneticScalarCurvature (L ++ [(1, v)]) hT ζ p = + closedMagneticScalarCurvature L hL ζ p := + closedMagneticScalarCurvature_eq_of_value_const_add _ _ hT hL (v / 2) + (fieldScalarValue_terminal_one L hL v) ζ p + +lemma closedMagneticSquare_terminal_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (v : ℝ≥0) + (hT : ∀ av ∈ L ++ [(1, v)], 0 < av.1) + (i : ℕ) (hi : i ≤ L.length) (ζ : ℝ) (p : ℝ × ℝ) : + closedMagneticContinuation (L ++ [(1, v)]) + (magneticScalarSquareFourJet _ hT + ⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩).toMagneticContinuationJet ζ p = + closedMagneticContinuation L + (magneticScalarSquareFourJet L hL ⟨i, by omega⟩).toMagneticContinuationJet ζ p := by + have hb := magneticScalarSlabBias_eq_of_value_const_add _ _ hT hL (v / 2) + (fieldScalarValue_terminal_one L hL v) ζ p.1 + unfold closedMagneticContinuation + split_ifs + · rw [magneticScalarSlabContinuation_eq_jet _ hT, + magneticScalarSlabContinuation_eq_jet _ hL] + simp only [magneticScalarSlabContinuationJet, MagneticContinuationJet.transition, + magneticScalarSquareFourJet_value] + rw [fieldScalarSquares_terminal_one L hL v i hi, fieldScalarValue_terminal_one L hL v, + fieldSpinTransition_const_add, hb] + · rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTerminalOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTerminalOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..d10b9cd9af598ce73595ff694da7b2f7779e7195 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTerminalOrder.lean @@ -0,0 +1,92 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticAdjacentSquare +import OAI.Probability.InvariantIsing.Magnetic.MagneticTerminalCongruence + +namespace OAI + +/-! Increasing the final covariance height decreases each preceding +conditional square at fixed total magnetization. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma square_congr_list {L M : List (ℝ × ℝ≥0)} (he : L = M) + (hL : ∀ av ∈ L, 0 < av.1) (hM : ∀ av ∈ M, 0 < av.1) + (i : Fin (L.length + 1)) (j : Fin (M.length + 1)) (hij : i.val = j.val) + (ζ : ℝ) (p : ℝ × ℝ) : + closedMagneticContinuation L + (magneticScalarSquareFourJet L hL i).toMagneticContinuationJet ζ p = + closedMagneticContinuation M + (magneticScalarSquareFourJet M hM j).toMagneticContinuationJet ζ p := by + subst M + have hj : i = j := Fin.ext hij + subst j + rfl + +theorem magneticClosedSquare_terminal_variance_mono (P : List (ℝ × ℝ≥0)) + (hP : ∀ av ∈ P, 0 < av.1) (hP1 : ∀ av ∈ P, av.1 ≤ 1) + {a : ℝ} (ha : 0 < a) (ha1 : a ≤ 1) (x δ : ℝ≥0) + (hN : ∀ av ∈ P ++ [(a, x + δ)], 0 < av.1) + (hO : ∀ av ∈ P ++ [(a, x)], 0 < av.1) + (i : ℕ) (hi : i ≤ P.length) {ζ v s : ℝ} + (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hv : 0 ≤ v) (hs : s ∈ Icc (-1 : ℝ) 1) : + closedMagneticContinuation (P ++ [(a, x + δ)]) + (magneticScalarSquareFourJet _ hN + ⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩).toMagneticContinuationJet + ζ (v, s) ≤ + closedMagneticContinuation (P ++ [(a, x)]) + (magneticScalarSquareFourJet _ hO + ⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩).toMagneticContinuationJet + ζ (v, s) := by + have hn : ∀ av ∈ P ++ (a, x + δ) :: (1, (0 : ℝ≥0)) :: [], 0 < av.1 := by + intro av hav + rcases List.mem_append.mp hav with hp | ht + · exact hP av hp + · simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl + · exact ha + · norm_num + have ho : ∀ av ∈ P ++ (a, x) :: (1, δ + 0) :: [], 0 < av.1 := by + intro av hav + rcases List.mem_append.mp hav with hp | ht + · exact hP av hp + · simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl + · exact ha + · norm_num + have h := magneticClosedSquare_adjacent_transfer P [] hP hP1 (by simp) (by simp) + ha ha1 (le_refl 1) x δ 0 hn ho i hi hζ hζ1 hv hs + have hn' : ∀ av ∈ (P ++ [(a, x + δ)]) ++ [(1, (0 : ℝ≥0))], 0 < av.1 := by + simpa only [List.append_assoc, List.cons_append, List.nil_append] using hn + have ho' : ∀ av ∈ (P ++ [(a, x)]) ++ [(1, δ)], 0 < av.1 := by + simpa only [List.append_assoc, List.cons_append, List.nil_append, add_zero] using ho + have hni : i ≤ (P ++ [(a, x + δ)]).length := by + simp only [List.length_append, List.length_singleton] + omega + have hoi : i ≤ (P ++ [(a, x)]).length := by + simp only [List.length_append, List.length_singleton] + omega + have en := closedMagneticSquare_terminal_one (P ++ [(a, x + δ)]) hN 0 hn' i hni ζ (v, s) + have eo := closedMagneticSquare_terminal_one (P ++ [(a, x)]) hO δ ho' i hoi ζ (v, s) + have enC := square_congr_list + (show (P ++ [(a, x + δ)]) ++ [(1, (0 : ℝ≥0))] = + P ++ (a, x + δ) :: (1, (0 : ℝ≥0)) :: [] by simp only [List.append_assoc, + List.cons_append, List.nil_append]) hn' hn + ⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩ + ⟨i, by simp only [List.length_append, List.length_cons, List.length_nil]; omega⟩ + rfl ζ (v, s) + have eoC := square_congr_list + (show (P ++ [(a, x)]) ++ [(1, δ)] = P ++ (a, x) :: (1, δ + 0) :: [] by + simp only [List.append_assoc, List.cons_append, List.nil_append, add_zero]) ho' ho + ⟨i, by simp only [List.length_append, List.length_singleton]; omega⟩ + ⟨i, by simp only [List.length_append, List.length_cons, List.length_nil]; omega⟩ + rfl ζ (v, s) + exact (enC.symm.trans en).ge.trans (h.trans (eoC.symm.trans eo).le) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticThresholdDiagonal.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticThresholdDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..9691030e49dcdc99f57d7c724e4aa86c7e40dcf6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticThresholdDiagonal.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticDiagonalL1Consistency +import OAI.Probability.InvariantIsing.Arrays.OverlapTestDiagonal + +namespace OAI + +/-! Selection of one increasing finite-depth diagonal and one compact +quantile subsequence for growing attainable constrained blocks. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem exists_magnetic_consistent_diagonal_above {m : ℕ} + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) (mag : ℕ → A → ℝ) + {s : ℝ} (hs : s < 1) (hmag : ∀ r a, |mag r a| ≤ s) + (hc : ∀ r a, (k r a : ℝ) = spinGroupSize (group r) a * ((1+mag r a)/2)) + (threshold : ℕ → ℕ) (base : ℕ → OverlapPath) + (htest : ∀ r (Φ : ℝ →ᵇ ℝ), Tendsto (fun j => + ∫ t, Φ (cavityStrictUniformPath (base r) j t) * + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum (base r) j) t - + cavityStrictUniformPath (base r) j t) ∂pathMeasure) atTop (𝓝 0)) : + ∃ (d φ : ℕ → ℕ) (p : OverlapPath), (∀ r, threshold r ≤ d r) ∧ StrictMono φ ∧ + Tendsto (fun r => ∫ t, |cavityStrictUniformPath (base (φ r)) (d (φ r)) t-p t| + ∂pathMeasure) atTop (𝓝 0) ∧ + Tendsto (fun r => ∫ t, |restrictedBlockOverlapPath (hN (φ r)) + (spinGroupSlice (group (φ r)) (k (φ r))) + (spinGroupSlice_nonempty (group (φ r)) (k (φ r)) (hk (φ r))) + (cavityStrictUniformField rho lam hrho hsum (base (φ r)) (d (φ r))) t-p t| + ∂pathMeasure) atTop (𝓝 0) := by + let q := fun r j => cavityStrictUniformPath (base r) (threshold r+j) + let B := fun r j => restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField rho lam hrho hsum (base r) (threshold r+j)) + have ht r : Tendsto (fun j => threshold r+j) atTop atTop := by + simpa only [Nat.add_comm] using tendsto_add_atTop_nat (threshold r) + obtain ⟨d₀, _hd₀, hdiag⟩ := exists_diagonal_overlap_tests q B + (fun r Φ => (htest r Φ).comp (ht r)) + let d := fun r => threshold r+d₀ r + obtain ⟨p, φ, hφ, hpoint, hL1⟩ := overlapPath_ae_l1_subsequence (fun r => q r (d₀ r)) + refine ⟨d, φ, p, fun r => Nat.le_add_right _ _, hφ, hL1, ?_⟩ + apply magnetic_diagonal_l1_of_constrained_tests rho lam hrho hsum hK hlam + (fun r => N (φ r)) (fun r => hN (φ r)) (hNlim.comp hφ.tendsto_atTop) + (fun r => group (φ r)) (fun r => k (φ r)) (fun r => hk (φ r)) + (fun r => mag (φ r)) hs (fun r => hmag (φ r)) (fun r => hc (φ r)) + (fun r => base (φ r)) (fun r => d (φ r)) p hpoint + intro Φ + exact (hdiag Φ).comp hφ.tendsto_atTop + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialApproximation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4728a2d1c0927677643318382ab0c26637ae1eb2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialApproximation.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalBounds +import OAI.Probability.InvariantIsing.Core.TrialGridApproximation + +namespace OAI + +/-! Lower finite-grid trials preserve the magnetic entropy bound and +approximate the finite-spectrum magnetic variational infimum. -/ +noncomputable section +open MeasureTheory IsingPerceptron Set +open scoped BigOperators +namespace InvariantIsing + +lemma magneticEntropyFunctional_mono {A : Type*} [Fintype A] + (γ mag : A → ℝ) {p q : OverlapPath} (hpq : p.val ≤ᵐ[pathMeasure] q.val) : + magneticEntropyFunctional γ mag p ≤ magneticEntropyFunctional γ mag q := by + apply iSup_mono + intro h + apply EReal.coe_le_coe_iff.mpr + apply add_le_add le_rfl + apply div_le_div_of_nonneg_right _ (by norm_num) + apply integral_mono_ae (integrable_path_mul_field p h) (integrable_path_mul_field q h) + filter_upwards [hpq] with s hs + exact mul_le_mul_of_nonneg_right hs (fieldFunction_nonneg h s) + +lemma lowerGridPath_magneticEntropy_le {A : Type*} [Fintype A] + (γ mag : A → ℝ) (p : OverlapPath) (n : ℕ) : + magneticEntropyFunctional γ mag (lowerGridPath p n) ≤ magneticEntropyFunctional γ mag p := + magneticEntropyFunctional_mono γ mag (lowerGridPath_le p n) + +theorem exists_finiteMagneticEntropy_trial {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hmag : ∀ a, |mag a| ≤ 1) {ε : ℝ} (hε : 0<ε) : + ∃ p : OverlapPath, ∃ S : ℝ, magneticEntropyFunctional γ mag p=(S : EReal) ∧ + S+spectralFunctional (finiteR ρ eig hρ hsum) p < + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal+ε := by + have hf := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum γ mag hγ hγsum hmag + have hlt : magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag < + ((magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal+ε : ℝ) := by + rw [← EReal.coe_toReal hf.1 hf.2] + exact_mod_cast (show (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal < + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal+ε by linarith) + obtain ⟨p,hp⟩ := iInf_lt_iff.mp hlt + have htop : magneticEntropyFunctional γ mag p ≠ ⊤ := by + intro he + simp only [he,EReal.top_add_coe,not_top_lt] at hp + have hbot : magneticEntropyFunctional γ mag p ≠ ⊥ := + ne_bot_of_le_ne_bot (EReal.coe_ne_bot _) (magneticEntropyFunctional_lower γ mag hγ hγsum hmag p) + refine ⟨p,(magneticEntropyFunctional γ mag p).toReal,(EReal.coe_toReal htop hbot).symm,?_⟩ + rw [← EReal.coe_toReal htop hbot,← EReal.coe_add] at hp + exact_mod_cast hp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialBarrier.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialBarrier.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff3334b493a054ebcfffac2f0c8d347896df5afb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialBarrier.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticThresholdDiagonal +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockTrialLower + +namespace OAI + +/-! Weak tests on growing physical blocks yield the magnetic variational trial lower bound. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators BoundedContinuousFunction +namespace InvariantIsing + +theorem magnetic_trial_barrier {m : ℕ} + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + {K : ℝ} (hK : 0 ≤ K) (hlam : ∀ a, |lam a| ≤ K) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ r, 0 < N r) (hNlim : Tendsto N atTop atTop) + (group : ∀ r, Fin (N r) → A) (k : ℕ → A → ℕ) + (hk : ∀ r a, k r a ≤ spinGroupSize (group r) a) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (hcount : ∀ r a, (spinGroupSize (group r) a : ℝ)=N r*γ a) + {s : ℝ} (hs : s < 1) (hmag : ∀ a, |mag a| ≤ s) + (hc : ∀ r a, (k r a : ℝ)=spinGroupSize (group r) a*((1+mag a)/2)) + (base : ℕ → OverlapPath) + (htest : ∀ r (Φ : ℝ →ᵇ ℝ), Tendsto (fun j => ∫ t, Φ (cavityStrictUniformPath (base r) j t)* + (restrictedBlockOverlapPath (hN r) (spinGroupSlice (group r) (k r)) + (spinGroupSlice_nonempty (group r) (k r) (hk r)) + (cavityStrictUniformField ρ lam hρ hsum (base r) j) t- + cavityStrictUniformPath (base r) j t) ∂pathMeasure) atTop (𝓝 0)) + (L : ℝ) + (hupper : ∀ r, ∀ ε > 0, ∀ᶠ j in atTop, + constrainedBlockValue (spinGroupSlice (group r) (k r)) + (cavityStrictUniformField ρ lam hρ hsum (base r) j)+ + fieldPairing (cavityStrictUniformPath (base r) j) + (cavityStrictUniformField ρ lam hρ hsum (base r) j)/2+ + spectralFunctional (finiteR ρ lam hρ hsum) (cavityStrictUniformPath (base r) j) ≤ L+ε) : + (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal ≤ L := by + let T := fun r j => constrainedBlockValue (spinGroupSlice (group r) (k r)) + (cavityStrictUniformField ρ lam hρ hsum (base r) j)+ + fieldPairing (cavityStrictUniformPath (base r) j) + (cavityStrictUniformField ρ lam hρ hsum (base r) j)/2+ + spectralFunctional (finiteR ρ lam hρ hsum) (cavityStrictUniformPath (base r) j) + have hup r : ∃ b : ℕ, ∀ j ≥ b, T r j ≤ L+1/((r : ℝ)+1) := by + exact eventually_atTop.mp (hupper r _ (by positivity)) + choose threshold hthreshold using hup + obtain ⟨d,φ,p,hd,hφ,hq,hself⟩ := exists_magnetic_consistent_diagonal_above + ρ lam hρ hsum hK hlam N hN hNlim group k hk (fun _ => mag) hs + (fun _ => hmag) hc threshold base htest + have hlower := magnetic_block_trial_eventually_lower ρ lam hρ hsum + (fun r => N (φ r)) (fun r => hN (φ r)) (hNlim.comp hφ.tendsto_atTop) + (fun r => group (φ r)) (fun r => k (φ r)) (fun r => hk (φ r)) γ mag hγ hγsum + (fun r => hcount (φ r)) hs hmag (fun r => hc (φ r)) + (fun r => cavityStrictUniformField ρ lam hρ hsum (base (φ r)) (d (φ r))) + (fun r => cavityStrictUniformField_height_le ρ lam hρ hsum hK hlam + (base (φ r)) (d (φ r)) (Fin.last (d (φ r)))) p + (fun r => cavityStrictUniformPath (base (φ r)) (d (φ r))) hself hq + have herr : Tendsto (fun r => 1/((φ r : ℝ)+1)) atTop (𝓝 0) := + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).comp hφ.tendsto_atTop + apply le_of_forall_pos_le_add + intro ε hε + obtain ⟨r,hr,he⟩ := ((hlower (ε/2) (half_pos hε)).and + (herr.eventually (Iio_mem_nhds (half_pos hε)))).exists + have hb := hthreshold (φ r) (d (φ r)) (hd (φ r)) + change (magneticVariationalFunctional (finiteR ρ lam hρ hsum) γ mag).toReal-ε/2 ≤ + T (φ r) (d (φ r)) at hr + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..2256d82008f31cc5a07e0c13229d7240b1b6b18e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTrialLimit.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticEntropySequence +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalBounds +import OAI.Probability.InvariantIsing.Fields.FieldPairingContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralPathLimit + +namespace OAI + +/-! Identification of the magnetic cavity trial from weighted +self-consistency and its supporting inequality. -/ +noncomputable section +open MeasureTheory Filter +open scoped Topology BigOperators +namespace InvariantIsing + +theorem magnetic_entropy_trial_tendsto_of_support {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hmag : ∀ a, |mag a| ≤ 1) (p : OverlapPath) (q : ℕ → OverlapPath) (h : ℕ → FieldStep) + {C : ℝ} (hC : ∀ n, (h n).height (Fin.last (h n).depth) ≤ C) + (hsupport : ∀ n k, magneticGroupValue γ mag k ≤ magneticGroupValue γ mag (h n) - + (∫ s, magneticGroupPath γ mag hγ hγsum (h n) s * + (fieldFunction k s-fieldFunction (h n) s) ∂pathMeasure)/2) + (hself : Tendsto (fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s-p s| + ∂pathMeasure) atTop (𝓝 0)) + (hq : Tendsto (fun n => ∫ s, |q n s-p s| ∂pathMeasure) atTop (𝓝 0)) : + magneticEntropyFunctional γ mag p ≠ ⊤ ∧ + Tendsto (fun n => magneticGroupValue γ mag (h n) + fieldPairing (q n) (h n)/2 + + spectralFunctional (finiteR ρ eig hρ hsum) (q n)) atTop + (𝓝 ((magneticEntropyFunctional γ mag p).toReal + spectralFunctional (finiteR ρ eig hρ hsum) p)) := by + obtain ⟨htop,hent⟩ := magnetic_entropy_sequence_of_support γ mag hγ hγsum hmag p h hC hsupport hself + have hpair := field_pairing_path_tendsto p q h hC hq + have hspec := finiteTemperatureFunctional_tendsto_of_L1 ρ eig hρ hsum p q hq zero_le_one + simp only [finiteTemperatureFunctional_eq ρ eig hρ hsum _ zero_le_one,one_mul] at hspec + refine ⟨htop,?_⟩ + have ht := (hent.add (hpair.div_const 2)).add hspec + have he : (fun n => (magneticGroupValue γ mag (h n) + fieldPairing p (h n)/2 + + (fieldPairing (q n) (h n)-fieldPairing p (h n))/2) + + spectralFunctional (finiteR ρ eig hρ hsum) (q n)) = + (fun n => magneticGroupValue γ mag (h n) + fieldPairing (q n) (h n)/2 + + spectralFunctional (finiteR ρ eig hρ hsum) (q n)) := by + funext n + ring + rw [he] at ht + simpa only [zero_div,add_zero] using ht + +theorem magnetic_entropy_trial_eventually_lower_of_support {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hmag : ∀ a, |mag a| ≤ 1) (p : OverlapPath) (q : ℕ → OverlapPath) (h : ℕ → FieldStep) + {C : ℝ} (hC : ∀ n, (h n).height (Fin.last (h n).depth) ≤ C) + (hsupport : ∀ n k, magneticGroupValue γ mag k ≤ magneticGroupValue γ mag (h n) - + (∫ s, magneticGroupPath γ mag hγ hγsum (h n) s * + (fieldFunction k s-fieldFunction (h n) s) ∂pathMeasure)/2) + (hself : Tendsto (fun n => ∫ s, |magneticGroupPath γ mag hγ hγsum (h n) s-p s| + ∂pathMeasure) atTop (𝓝 0)) + (hq : Tendsto (fun n => ∫ s, |q n s-p s| ∂pathMeasure) atTop (𝓝 0)) : + ∀ ε > 0, ∀ᶠ n in atTop, + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal - ε ≤ + magneticGroupValue γ mag (h n) + fieldPairing (q n) (h n)/2 + + spectralFunctional (finiteR ρ eig hρ hsum) (q n) := by + obtain ⟨htop,ht⟩ := magnetic_entropy_trial_tendsto_of_support + ρ eig hρ hsum γ mag hγ hγsum hmag p q h hC hsupport hself hq + have hbot : magneticEntropyFunctional γ mag p ≠ ⊥ := ne_bot_of_le_ne_bot + (EReal.coe_ne_bot _) (magneticEntropyFunctional_lower γ mag hγ hγsum hmag p) + have hfinite := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum γ mag hγ hγsum hmag + have hi := iInf_le (fun v : OverlapPath => magneticEntropyFunctional γ mag v + + (spectralFunctional (finiteR ρ eig hρ hsum) v : EReal)) p + change magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag ≤ _ at hi + rw [← EReal.coe_toReal hfinite.1 hfinite.2, ← EReal.coe_toReal htop hbot, + ← EReal.coe_add] at hi + have hi' : (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal ≤ + (magneticEntropyFunctional γ mag p).toReal + spectralFunctional (finiteR ρ eig hρ hsum) p := by + exact_mod_cast hi + intro ε hε + have he := ht.eventually (lt_mem_nhds (show + (magneticVariationalFunctional (finiteR ρ eig hρ hsum) γ mag).toReal - ε < + (magneticEntropyFunctional γ mag p).toReal + spectralFunctional (finiteR ρ eig hρ hsum) p by linarith)) + exact he.mono (fun _ h => h.le) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTwoJetSpatial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTwoJetSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..0648e03de40207e34f0dbbf8b73e73ea2cf3b3d4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticTwoJetSpatial.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationTwoJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationPDE + +namespace OAI + +/-! Spatial derivatives for the minimal bounded test data used by the +variance generator, including the ordinary scalar curvature test. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magneticTwoJet_average_hasDerivAt (P : MagneticContinuationJet) + (A : MagneticContinuationTwoJet) (F : ℝ → ℝ) + (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) (v : ℝ≥0) (z : ℝ) : + HasDerivAt (fieldSpinTransition ζ v F A.value) + (fieldTiltSpatial ζ v F P.value A.value A.first z) z := by + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨C, hC, bC⟩ := A.bValue + obtain ⟨D, _, bD⟩ := A.bFirst + exact hasDerivAt_fieldSpinTransition ζ v hF hG P.mValue A.mValue A.mFirst + hK hC bK bC bD dF A.dValue z + +lemma magneticTwoJet_spatial_hasDerivAt (P : MagneticContinuationJet) + (A : MagneticContinuationTwoJet) (F : ℝ → ℝ) + (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) (ζ : ℝ) (v : ℝ≥0) (z : ℝ) : + HasDerivAt (fieldTiltSpatial ζ v F P.value A.value A.first) + (magneticContinuationSecond ζ v F P.value P.first A.value A.first A.second z) z := by + obtain ⟨K, hK, bK⟩ := P.bValue + obtain ⟨L, hL, bL⟩ := P.bFirst + obtain ⟨a, ha, ba⟩ := A.bValue + obtain ⟨b, hb, bb⟩ := A.bFirst + obtain ⟨c, _, bc⟩ := A.bSecond + exact hasDerivAt_magneticContinuationSecond ζ v hF hG P.mValue P.mFirst + A.mValue A.mFirst A.mSecond hK hL ha hb bK bL ba bb bc dF P.dValue + A.dValue A.dFirst z + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticUniformSlabBounds.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticUniformSlabBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..309a6357774c2fdffa45f6ad6ae4afbf44d1cff2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticUniformSlabBounds.lean @@ -0,0 +1,117 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticContinuationJet + +namespace OAI + +/-! Spatial bounds for the actual Gaussian transition, uniform in its +variance. These are used to control both endpoints of inverse coordinates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def MagneticSlabBound (f : ℝ≥0 → ℝ → ℝ) : Prop := + ∃ C : ℝ, 0 ≤ C ∧ ∀ v z, |f v z| ≤ C + +namespace MagneticSlabBound + +lemma const (c : ℝ) : MagneticSlabBound (fun _ _ => c) := + ⟨|c|, abs_nonneg _, fun _ _ => le_rfl⟩ + +lemma add {f g : ℝ≥0 → ℝ → ℝ} (hf : MagneticSlabBound f) + (hg : MagneticSlabBound g) : MagneticSlabBound (fun v z => f v z + g v z) := by + obtain ⟨C, hC, bC⟩ := hf + obtain ⟨D, hD, bD⟩ := hg + exact ⟨C + D, add_nonneg hC hD, fun v z => + (abs_add_le _ _).trans (add_le_add (bC v z) (bD v z))⟩ + +lemma sub {f g : ℝ≥0 → ℝ → ℝ} (hf : MagneticSlabBound f) + (hg : MagneticSlabBound g) : MagneticSlabBound (fun v z => f v z - g v z) := by + obtain ⟨C, hC, bC⟩ := hf + obtain ⟨D, hD, bD⟩ := hg + exact ⟨C + D, add_nonneg hC hD, fun v z => + (abs_sub _ _).trans (add_le_add (bC v z) (bD v z))⟩ + +lemma mul {f g : ℝ≥0 → ℝ → ℝ} (hf : MagneticSlabBound f) + (hg : MagneticSlabBound g) : MagneticSlabBound (fun v z => f v z * g v z) := by + obtain ⟨C, hC, bC⟩ := hf + obtain ⟨D, hD, bD⟩ := hg + refine ⟨C * D, mul_nonneg hC hD, fun v z => ?_⟩ + rw [abs_mul] + exact mul_le_mul (bC v z) (bD v z) (abs_nonneg _) hC + +lemma transition (ζ : ℝ) {F A : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) (hA : MagneticContinuationBound A) : + MagneticSlabBound (fun v => fieldSpinTransition ζ v F A) := by + obtain ⟨C, hC, bC⟩ := hA + exact ⟨C, hC, fun v => fieldSpinTransition_bound ζ v hF hG bC⟩ + +lemma spatial (ζ : ℝ) {F M A B : ℝ → ℝ} + (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : MagneticContinuationBound M) (hA : MagneticContinuationBound A) + (hB : MagneticContinuationBound B) : + MagneticSlabBound (fun v => fieldTiltSpatial ζ v F M A B) := by + obtain ⟨C, hC, bC⟩ := hM + obtain ⟨D, hD, bD⟩ := hA + obtain ⟨E, _, bE⟩ := hB + exact ⟨E + 2 * |ζ| * D * C, by positivity, + fun v => fieldSpinTransition_derivative_bound ζ v hF hG hC hD bC bD bE⟩ + +end MagneticSlabBound + +lemma magneticContinuationSecond_uniform (ζ : ℝ) + {F M Q A B C : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : MagneticContinuationBound M) (hQ : MagneticContinuationBound Q) + (hA : MagneticContinuationBound A) (hB : MagneticContinuationBound B) + (hC : MagneticContinuationBound C) : + MagneticSlabBound (fun v => magneticContinuationSecond ζ v F M Q A B C) := by + have T {A : ℝ → ℝ} (hA : MagneticContinuationBound A) := + MagneticSlabBound.transition ζ hF hG hA + have D {A B : ℝ → ℝ} (hA : MagneticContinuationBound A) (hB : MagneticContinuationBound B) := + MagneticSlabBound.spatial ζ hF hG hM hA hB + exact (D hB hC).add ((MagneticSlabBound.const ζ).mul + ((D (hA.mul hM) ((hB.mul hM).add (hA.mul hQ))).sub + (((D hA hB).mul (T hM)).add ((T hA).mul (D hM hQ))))) + +lemma magneticContinuationThird_uniform (ζ : ℝ) + {F M Q R A B C D : ℝ → ℝ} (hF : Measurable F) (hG : HasLinearGrowth F) + (hM : MagneticContinuationBound M) (hQ : MagneticContinuationBound Q) + (hR : MagneticContinuationBound R) (hA : MagneticContinuationBound A) + (hB : MagneticContinuationBound B) (hC : MagneticContinuationBound C) + (hD : MagneticContinuationBound D) : + MagneticSlabBound (fun v => magneticContinuationThird ζ v F M Q R A B C D) := by + have T {A : ℝ → ℝ} (hA : MagneticContinuationBound A) := + MagneticSlabBound.transition ζ hF hG hA + have S {A B : ℝ → ℝ} (hA : MagneticContinuationBound A) (hB : MagneticContinuationBound B) := + MagneticSlabBound.spatial ζ hF hG hM hA hB + have D2 {A B C : ℝ → ℝ} (hA : MagneticContinuationBound A) + (hB : MagneticContinuationBound B) (hC : MagneticContinuationBound C) := + magneticContinuationSecond_uniform ζ hF hG hM hQ hA hB hC + have hb2 := (hB.mul hM).add (hA.mul hQ) + have hb3 := ((hC.mul hM).add + (((MagneticContinuationBound.const 2).mul hB).mul hQ)).add (hA.mul hR) + exact (D2 hB hC hD).add ((MagneticSlabBound.const ζ).mul + ((D2 (hA.mul hM) hb2 hb3).sub + ((((D2 hA hB hC).mul (T hM)).add + ((((MagneticSlabBound.const 2).mul (S hA hB)).mul (S hM hQ)))).add + ((T hA).mul (D2 hM hQ hR))))) + +lemma MagneticContinuationJet.transition_second_uniform (A P : MagneticContinuationJet) + (ζ : ℝ) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : + MagneticSlabBound (fun v z => (A.transition P ζ v F hF hG dF).second z) := + magneticContinuationSecond_uniform ζ hF hG P.bValue P.bFirst A.bValue A.bFirst A.bSecond + +lemma MagneticContinuationJet.transition_third_uniform (A P : MagneticContinuationJet) + (ζ : ℝ) (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) + (dF : ∀ z, HasDerivAt F (P.value z) z) : + MagneticSlabBound (fun v z => (A.transition P ζ v F hF hG dF).third z) := + magneticContinuationThird_uniform ζ hF hG P.bValue P.bFirst P.bSecond + A.bValue A.bFirst A.bSecond A.bThird + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariational.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariational.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a172f453130aabb9d13797cea3d8aa9a3efe098 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariational.lean @@ -0,0 +1,114 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticL1 +import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldParameter + +namespace OAI + +/-! The prescribed-magnetization variational expression in (7.3)--(7.4). +One common covariance path is used for every field group. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +def magneticGroupValue {A : Type*} [Fintype A] (γ m : A → ℝ) (h : FieldStep) : ℝ := + ∑ a, γ a * constrainedFieldValue h (m a) + +def magneticEntropyFunctional {A : Type*} [Fintype A] (γ m : A → ℝ) + (p : OverlapPath) : EReal := + ⨆ h : FieldStep, ((magneticGroupValue γ m h + fieldPairing p h / 2 : ℝ) : EReal) + +def magneticVariationalFunctional {A : Type*} [Fintype A] (R : ℝ → ℝ) (γ m : A → ℝ) : EReal := + ⨅ p : OverlapPath, magneticEntropyFunctional γ m p + (spectralFunctional R p : EReal) + +def RationalMagnetization (A : Type*) := {m : A → ℚ // ∀ a, |(m a : ℝ)| < 1} + +instance {A : Type*} : Inhabited (RationalMagnetization A) := + ⟨⟨fun _ => 0, by intro a; norm_num⟩⟩ + +def finiteMagneticFunctional {A : Type*} [Fintype A] (R : ℝ → ℝ) (γ c : A → ℝ) : EReal := + ⨆ m : RationalMagnetization A, + ((∑ a, γ a * c a * (m.val a : ℝ) : ℝ) : EReal) + + magneticVariationalFunctional R γ (fun a => (m.val a : ℝ)) + +lemma magneticGroupValue_zero {A : Type*} [Fintype A] (γ : A → ℝ) + (hγ : ∑ a, γ a = 1) (h : FieldStep) : + magneticGroupValue γ (fun _ => 0) h = fieldValue h 0 := by + simp only [magneticGroupValue, constrainedFieldValue_zero_magnetization, + ← Finset.sum_mul, hγ, one_mul] + +lemma magneticGroupValue_le {A : Type*} [Fintype A] (γ m : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hm : ∀ a, |m a| ≤ 1) (h : FieldStep) : + magneticGroupValue γ m h ≤ fieldValue h 0 := by + calc + _ ≤ ∑ a, γ a * fieldValue h 0 := Finset.sum_le_sum (fun a _ => + mul_le_mul_of_nonneg_left (by + simpa only [zero_mul, sub_zero] using constrainedFieldValue_le_trial h (hm a) 0) (hγ a)) + _ = _ := by rw [← Finset.sum_mul, hγsum, one_mul] + +lemma magneticEntropyFunctional_le {A : Type*} [Fintype A] (γ m : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) (hm : ∀ a, |m a| ≤ 1) + (p : OverlapPath) : magneticEntropyFunctional γ m p ≤ entropyFunctional p := by + apply iSup_le + intro h + apply (show ((magneticGroupValue γ m h + fieldPairing p h / 2 : ℝ) : EReal) ≤ + ((fieldValue h 0 + fieldPairing p h / 2 : ℝ) : EReal) from + EReal.coe_le_coe (add_le_add (magneticGroupValue_le γ m hγ hγsum hm h) le_rfl)).trans + exact le_iSup (fun h : FieldStep => ((fieldValue h 0 + fieldPairing p h / 2 : ℝ) : EReal)) h + +lemma magneticEntropyFunctional_zero {A : Type*} [Fintype A] (γ : A → ℝ) + (hγ : ∑ a, γ a = 1) (p : OverlapPath) : + magneticEntropyFunctional γ (fun _ => 0) p = entropyFunctional p := by + simp only [magneticEntropyFunctional, magneticGroupValue_zero γ hγ, entropyFunctional] + +lemma magneticVariationalFunctional_zero {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ : A → ℝ) (hγ : ∑ a, γ a = 1) : + magneticVariationalFunctional R γ (fun _ => 0) = variationalFunctional R := by + simp only [magneticVariationalFunctional, magneticEntropyFunctional_zero γ hγ, + variationalFunctional] + +lemma magneticVariationalFunctional_le {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ m : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) + (hγsum : ∑ a, γ a = 1) (hm : ∀ a, |m a| ≤ 1) : + magneticVariationalFunctional R γ m ≤ variationalFunctional R := by + apply iInf_mono + intro p + exact add_le_add (magneticEntropyFunctional_le γ m hγ hγsum hm p) le_rfl + +lemma finiteMagneticFunctional_lower {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ c : A → ℝ) (hγ : ∑ a, γ a = 1) : + variationalFunctional R ≤ finiteMagneticFunctional R γ c := by + have hh := le_iSup (fun m : RationalMagnetization A => + ((∑ a, γ a * c a * (m.val a : ℝ) : ℝ) : EReal) + + magneticVariationalFunctional R γ (fun a => (m.val a : ℝ))) + (⟨fun _ => 0, by intro a; norm_num⟩ : RationalMagnetization A) + simpa only [Rat.cast_zero, mul_zero, Finset.sum_const_zero, EReal.coe_zero, zero_add, + magneticVariationalFunctional_zero R γ hγ, finiteMagneticFunctional] using hh + +lemma finiteMagneticFunctional_upper {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ c : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) : + finiteMagneticFunctional R γ c ≤ variationalFunctional R + + ((∑ a, γ a * |c a| : ℝ) : EReal) := by + apply iSup_le + intro m + have hcm : (∑ a, γ a * c a * (m.val a : ℝ)) ≤ ∑ a, γ a * |c a| := by + apply Finset.sum_le_sum + intro a _ + calc + γ a * c a * (m.val a : ℝ) = γ a * (c a * (m.val a : ℝ)) := by ring + _ ≤ γ a * |c a * (m.val a : ℝ)| := + mul_le_mul_of_nonneg_left (le_abs_self _) (hγ a) + _ ≤ γ a * |c a| := by + rw [abs_mul] + exact mul_le_mul_of_nonneg_left + (mul_le_of_le_one_right (abs_nonneg _) (m.property a).le) (hγ a) + have hv := magneticVariationalFunctional_le R γ (fun a => (m.val a : ℝ)) + hγ hγsum (fun a => (m.property a).le) + exact (add_le_add (EReal.coe_le_coe hcm) hv).trans_eq (add_comm _ _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalBounds.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e5218a74049090de1cd3adca2d89a981654a3fc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalBounds.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariational +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds + +namespace OAI + +/-! Finiteness of the magnetic variational value, with the original +cube-mass entropy lower bound. -/ +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace InvariantIsing + +lemma magneticEntropyFunctional_lower {A : Type*} [Fintype A] + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hmag : ∀ a, |mag a| ≤ 1) (p : OverlapPath) : + ((-Real.log 2 : ℝ) : EReal) ≤ magneticEntropyFunctional γ mag p := by + have hg : -Real.log 2 ≤ magneticGroupValue γ mag zeroField := by + calc + _ = ∑ a, γ a * (-Real.log 2) := by rw [← Finset.sum_mul, hγsum, one_mul] + _ ≤ _ := Finset.sum_le_sum fun a _ => mul_le_mul_of_nonneg_left + (by simpa only [zeroField, sub_zero, zero_div] using + (constrainedFieldValue_bounds zeroField (hmag a)).1) (hγ a) + have hh := le_iSup (fun h : FieldStep => + ((magneticGroupValue γ mag h + fieldPairing p h / 2 : ℝ) : EReal)) zeroField + simp only [fieldPairing_zero, zero_div, add_zero] at hh + exact (EReal.coe_le_coe hg).trans hh + +theorem finiteMagneticVariational_mem_interval {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hmag : ∀ a, |mag a| ≤ 1) (K : ℝ) (heig : ∀ a, |eig a| ≤ K) : + ((-Real.log 2-K/2 : ℝ) : EReal) ≤ magneticVariationalFunctional (finiteR ρ eig hρ hρsum) γ mag ∧ + magneticVariationalFunctional (finiteR ρ eig hρ hρsum) γ mag ≤ ((K/2 : ℝ) : EReal) := by + constructor + · apply le_iInf + intro p + have hs := (abs_le.mp (finiteSpectralFunctional_abs_le ρ eig hρ hρsum K heig p)).1 + have hh := add_le_add (magneticEntropyFunctional_lower γ mag hγ hγsum hmag p) + (EReal.coe_le_coe hs) + simpa only [← EReal.coe_add, sub_eq_add_neg, neg_div] using hh + · exact (magneticVariationalFunctional_le (finiteR ρ eig hρ hρsum) γ mag hγ hγsum hmag).trans + (finiteVariational_mem_interval ρ eig hρ hρsum K heig).2 + +theorem finiteMagneticVariational_ne_top_bot {A ι : Type*} [Fintype A] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (γ mag : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hmag : ∀ a, |mag a| ≤ 1) : + magneticVariationalFunctional (finiteR ρ eig hρ hρsum) γ mag ≠ ⊤ ∧ + magneticVariationalFunctional (finiteR ρ eig hρ hρsum) γ mag ≠ ⊥ := by + let K := ∑ a, |eig a| + have heig a : |eig a| ≤ K := Finset.single_le_sum + (fun a _ => abs_nonneg (eig a)) (Finset.mem_univ a) + have hb := finiteMagneticVariational_mem_interval ρ eig hρ hρsum γ mag hγ hγsum hmag K heig + exact ⟨ne_top_of_le_ne_top (EReal.coe_ne_top _) hb.2, + ne_bot_of_le_ne_bot (EReal.coe_ne_bot _) hb.1⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalContinuity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2348c0c05bd899fb6b65aef539b14e36f7c2d26 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalContinuity.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariational + +namespace OAI + +/-! Field-alphabet stability of the magnetic variational formula. These +bounds are uniform over all rational interior magnetizations. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma magnetic_field_term_difference {A : Type*} [Fintype A] (γ c d m : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hm : ∀ a, |m a| ≤ 1) : + |(∑ a, γ a * c a * m a) - ∑ a, γ a * d a * m a| ≤ + ∑ a, γ a * |c a - d a| := by + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ a, |γ a * c a * m a - γ a * d a * m a| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ _ := by + apply Finset.sum_le_sum + intro a _ + have he : γ a * c a * m a - γ a * d a * m a = γ a * (c a - d a) * m a := by ring + rw [he, abs_mul, abs_mul, abs_of_nonneg (hγ a)] + exact mul_le_of_le_one_right (mul_nonneg (hγ a) (abs_nonneg _)) (hm a) + +lemma finiteMagneticFunctional_le_add {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ c d : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) : + finiteMagneticFunctional R γ c ≤ finiteMagneticFunctional R γ d + + ((∑ a, γ a * |c a - d a| : ℝ) : EReal) := by + apply iSup_le + intro m + have hb := (abs_le.mp (magnetic_field_term_difference γ c d + (fun a => (m.val a : ℝ)) hγ (fun a => (m.property a).le))).2 + have hc : ((∑ a, γ a * c a * (m.val a : ℝ) : ℝ) : EReal) ≤ + ((∑ a, γ a * d a * (m.val a : ℝ) : ℝ) : EReal) + + ((∑ a, γ a * |c a - d a| : ℝ) : EReal) := by + rw [← EReal.coe_add] + exact EReal.coe_le_coe (by linarith) + have hi := le_iSup (fun m : RationalMagnetization A => + ((∑ a, γ a * d a * (m.val a : ℝ) : ℝ) : EReal) + + magneticVariationalFunctional R γ (fun a => (m.val a : ℝ))) m + calc + _ ≤ (((∑ a, γ a * d a * (m.val a : ℝ) : ℝ) : EReal) + + ((∑ a, γ a * |c a - d a| : ℝ) : EReal)) + + magneticVariationalFunctional R γ (fun a => (m.val a : ℝ)) := add_le_add hc le_rfl + _ = (((∑ a, γ a * d a * (m.val a : ℝ) : ℝ) : EReal) + + magneticVariationalFunctional R γ (fun a => (m.val a : ℝ))) + + ((∑ a, γ a * |c a - d a| : ℝ) : EReal) := by ac_rfl + _ ≤ _ := add_le_add hi le_rfl + +lemma finiteMagneticFunctional_ne_top_bot {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ c : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hRtop : variationalFunctional R ≠ ⊤) (hRbot : variationalFunctional R ≠ ⊥) : + finiteMagneticFunctional R γ c ≠ ⊤ ∧ finiteMagneticFunctional R γ c ≠ ⊥ := by + constructor + · exact ne_top_of_le_ne_top (EReal.add_ne_top hRtop (EReal.coe_ne_top _)) + (finiteMagneticFunctional_upper R γ c hγ hγsum) + · exact ne_bot_of_le_ne_bot hRbot (finiteMagneticFunctional_lower R γ c hγsum) + +theorem abs_finiteMagneticFunctional_sub_le {A : Type*} [Fintype A] + (R : ℝ → ℝ) (γ c d : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a = 1) + (hRtop : variationalFunctional R ≠ ⊤) (hRbot : variationalFunctional R ≠ ⊥) : + |(finiteMagneticFunctional R γ c).toReal - (finiteMagneticFunctional R γ d).toReal| ≤ + ∑ a, γ a * |c a - d a| := by + have hc := finiteMagneticFunctional_ne_top_bot R γ c hγ hγsum hRtop hRbot + have hd := finiteMagneticFunctional_ne_top_bot R γ d hγ hγsum hRtop hRbot + have hcd := finiteMagneticFunctional_le_add R γ c d hγ + have hdc := finiteMagneticFunctional_le_add R γ d c hγ + rw [← EReal.coe_toReal hc.1 hc.2, ← EReal.coe_toReal hd.1 hd.2, ← EReal.coe_add] at hcd + rw [← EReal.coe_toReal hd.1 hd.2, ← EReal.coe_toReal hc.1 hc.2, ← EReal.coe_add] at hdc + have hcd' := EReal.coe_le_coe_iff.mp hcd + have hdc' := EReal.coe_le_coe_iff.mp hdc + simp_rw [abs_sub_comm (d _)] at hdc' + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalTransport.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..a375977d26a5bcc256fecf0091c309bb2105bfe6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticVariationalTransport.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticCouplingField +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupInterior + +namespace OAI + +/-! Transportation stability of the finite magnetic variational formula. +The bound is independent of the covariance path and optimizing bias. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +theorem finiteMagneticFunctional_transport_le {A B ι : Type*} + [Fintype A] [Fintype B] [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a=1) + (w : A → B → ℝ) (γ b : A → ℝ) (δ c : B → ℝ) + (hw : ∀ a j, 0 ≤ w a j) (hγ : ∀ a, 0 ≤ γ a) (hδ : ∀ j, 0 < δ j) + (hγsum : ∑ a, γ a=1) (hδsum : ∑ j, δ j=1) + (hrow : ∀ a, ∑ j, w a j=γ a) (hcol : ∀ j, ∑ a, w a j=δ j) : + (finiteMagneticFunctional (finiteR ρ eig hρ hsum) γ b).toReal ≤ + (finiteMagneticFunctional (finiteR ρ eig hρ hsum) δ c).toReal+ + ∑ a, ∑ j, w a j* |b a-c j| := by + classical + let R := finiteR ρ eig hρ hsum + let T := (finiteMagneticFunctional R δ c).toReal + let cost := ∑ a, ∑ j, w a j* |b a-c j| + have hR := finiteVariational_ne_top_bot ρ eig hρ hsum + have hF := finiteMagneticFunctional_ne_top_bot R γ b hγ hγsum hR.1 hR.2 + have hbound : finiteMagneticFunctional R γ b ≤ ((T+cost : ℝ) : EReal) := by + apply iSup_le + intro mag + let u := transportedMagnetization w δ (fun a => (mag.val a : ℝ)) + obtain ⟨s,hs,hms,_⟩ := exists_uniform_magnetization_radius + (fun _ : ℕ => fun a => (mag.val a : ℝ)) (fun a => (mag.val a : ℝ)) + tendsto_const_nhds mag.property + have hu j : |u j|<1 := + (transportedMagnetization_radius w δ _ hw hδ hcol hms j).trans_lt hs + have hv := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum γ + (fun a => (mag.val a : ℝ)) hγ hγsum (fun a => (mag.property a).le) + have hvu := finiteMagneticVariational_ne_top_bot ρ eig hρ hsum δ u + (fun j => (hδ j).le) hδsum (fun j => (hu j).le) + have he := transportedMagnetization_variational R w γ δ + (fun a => (mag.val a : ℝ)) hw hδ hrow hcol (fun a => (mag.property a).le) + rw [← EReal.coe_toReal hv.1 hv.2,← EReal.coe_toReal hvu.1 hvu.2] at he + have he' := EReal.coe_le_coe_iff.mp he + have htrial := finiteMagneticFunctional_real_profile ρ eig hρ hsum δ c u + (fun j => (hδ j).le) hδsum hu + have hcost := transportedMagnetization_field_cost w γ b δ c + (fun a => (mag.val a : ℝ)) hw hδ hrow (fun a => (mag.property a).le) + rw [← EReal.coe_toReal hv.1 hv.2,← EReal.coe_add] + apply EReal.coe_le_coe + change _ ≤ cost at hcost + change _ ≤ T at htrial + change _ ≤ (magneticVariationalFunctional R δ u).toReal at he' + linarith + rw [← EReal.coe_toReal hF.1 hF.2] at hbound + exact EReal.coe_le_coe_iff.mp hbound + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinMain.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f9ef37e6c7656ed28c264b4345747f383a8166f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinMain.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWassersteinPressure +import OAI.Probability.InvariantIsing.Spectral.SpectralExtremeLimits + +namespace OAI + +/-! Full Theorem7.1 with the manuscript spectral-edge and W1 field assumptions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem limiting_wasserstein_field_pressure_of_extreme_limits + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + (field : (N : ℕ) → Fin N → ℝ) (ξ : ProbabilityMeasure ℝ) + (hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (hw : Tendsto (fun k => fieldWassersteinOne (empiricalSpectralLaw (Nat.succ_pos k) (field (k+1))) ξ) + atTop (𝓝 0)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N) ∂P) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N)) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := + limiting_wasserstein_field_pressure hhaar hgauss hpub P U hU hHaar eig ν a b hcompact hbound ha hb + (spectral_no_outliers_of_extreme_limits eig a b hmin hmax) hweak field ξ hξ hw + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinMean.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..c726535f3c470c8cc3facd0e54fadec780ca79ae --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinMean.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Arrays.QuantizedFieldPressure +import OAI.Probability.InvariantIsing.Fields.FieldQuantizerError + +namespace OAI + +/-! The physical mean pressure formula for general first-moment field laws. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set Metric +open scoped Topology Classical +namespace InvariantIsing + +theorem general_mean_wasserstein_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + (P : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (P N)] + [∀ N, (P N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) atTop (𝓝 ν)) + (field : (N : ℕ) → Fin N → ℝ) (ξ : ProbabilityMeasure ℝ) + (hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (hw : Tendsto (fun k => fieldWassersteinOne (empiricalSpectralLaw (Nat.succ_pos k) (field (k+1))) ξ) + atTop (𝓝 0)) : + Tendsto (fun N => ∫ U, rotatedPressure (eig N) (matrixRotation U⁻¹) (field N) ∂P N) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := by + let μs := fun k => empiricalSpectralLaw (Nat.succ_pos k) (field (k+1)) + have hm k : Integrable (fun x : ℝ => x) (μs k : Measure ℝ) := + empiricalField_integrable (Nat.succ_pos k) (field (k+1)) id + have hfw : Tendsto μs atTop (𝓝 ξ) := weak_tendsto_of_fieldWasserstein ξ μs hξ hm hw + let mean := fun N => ∫ U, rotatedPressure (eig N) (matrixRotation U⁻¹) (field N) ∂P N + let F := magneticFieldFunctional (ν : Measure ℝ) b ξ + apply (tendsto_add_atTop_iff_nat 1).mp + apply Metric.tendsto_nhds.mpr + intro ε hε + obtain ⟨M,hM⟩ := ((fieldTail_integral_tendsto (ξ : Measure ℝ) hξ).eventually + (Iio_mem_nhds (by positivity : (0 : ℝ)<ε/64))).exists + let δ : ℝ := ε/8 + have hδ : 0 < δ := by dsimp [δ]; positivity + obtain ⟨n,c,r,hc,hr,hn,hcover⟩ := exists_field_ball_quantizer (ξ : Measure ℝ) + (M := (M : ℝ)) hδ + let V := simpleFieldValue (ξ : Measure ℝ) (fieldBallSimple c r) (measureR (ν : Measure ℝ) b) + let quant := fun N => ∫ U, rotatedPressure (eig N) (matrixRotation U⁻¹) + (fun i => fieldBallSimple c r (field N i)) ∂P N + have hq : Tendsto quant atTop (𝓝 V) := quantized_mean_field_pressure_tendsto + hhaar hgauss hpub P eig ν a b hcompact hbound ha hb hno hweak field ξ hfw c r hn + have hq' := hq.comp (tendsto_add_atTop_nat 1) + have ht := fieldTail_integral_tendsto_of_wasserstein ξ μs hξ hm hw (M : ℝ) + have hv : |F-V| ≤ δ+4*(∫ x, fieldTail M x ∂(ξ : Measure ℝ)) := by + refine (magneticFieldFunctional_simple_error ν ξ a b hcompact hbound ha hb hξ + (fieldBallSimple c r)).trans ?_ + simpa only [abs_sub_comm] using fieldBallSimple_integral_error (ξ : Measure ℝ) hξ + c r (Nat.cast_nonneg M) hδ.le hc hr hcover + have hqe := (Metric.tendsto_nhds.mp hq') (ε/4) (by positivity) + have hte := ht.eventually (Iio_mem_nhds (lt_add_of_pos_right _ (by positivity : (0 : ℝ)<ε/64))) + filter_upwards [hqe,hte] with k hk htk + have he := mean_field_quantizer_error (Nat.succ_pos k) (P (k+1)) (eig (k+1)) (field (k+1)) + c r (Nat.cast_nonneg M) hδ.le hc hr hcover + change |mean (k+1)-quant (k+1)| ≤ _ at he + rw [Real.dist_eq] at hk ⊢ + change |quant (k+1)-V|<ε/4 at hk + change |mean (k+1)-F|<ε + have htriangle := abs_sub_le (mean (k+1)) (quant (k+1)) F + have htriangle' := abs_sub_le (quant (k+1)) V F + rw [abs_sub_comm V F] at htriangle' + dsimp only [δ] at he hv + change (∫ x, fieldTail M x ∂(μs k : Measure ℝ))<_ at htk + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinPhysical.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..86f9fa172030bd90f4b5afa19dfa414a7e06c3c3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinPhysical.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWassersteinMean +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureMean + +namespace OAI + +/-! The general W1 field mean formula on the original probability space. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem physical_mean_wasserstein_field_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + (field : (N : ℕ) → Fin N → ℝ) (ξ : ProbabilityMeasure ℝ) + (hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (hw : Tendsto (fun k => fieldWassersteinOne (empiricalSpectralLaw (Nat.succ_pos k) (field (k+1))) ξ) + atTop (𝓝 0)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N) ∂P) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := by + let μ := fun N => P.map (U N) + let (N : ℕ) : IsProbabilityMeasure (μ N) := + (Measure.isProbabilityMeasure_map_iff (hU N).aemeasurable).mpr inferInstance + let (N : ℕ) : (μ N).IsMulRightInvariant := hHaar N + have hh := general_mean_wasserstein_field_pressure_tendsto hhaar hgauss hpub μ eig ν a b + hcompact hbound ha hb hno hweak field ξ hξ hw + apply hh.congr' + filter_upwards [eventually_ge_atTop 1] with N hN + exact physicalPressure_integral_map (by omega) P (U N) (hU N) (eig N) (field N) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinPressure.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d1990fba46fba5dfd99b11d7c0559090b4195eb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWassersteinPressure.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWassersteinPhysical +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureConcentration + +namespace OAI + +/-! Theorem7.1 for general W1 field laws, with mean and almost-sure convergence. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem limiting_wasserstein_field_pressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + (field : (N : ℕ) → Fin N → ℝ) (ξ : ProbabilityMeasure ℝ) + (hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (hw : Tendsto (fun k => fieldWassersteinOne (empiricalSpectralLaw (Nat.succ_pos k) (field (k+1))) ξ) + atTop (𝓝 0)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N) ∂P) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N)) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := by + refine ⟨physical_mean_wasserstein_field_pressure_tendsto hhaar hgauss hpub P U hU hHaar eig ν a b + hcompact hbound ha hb hno hweak field ξ hξ hw,?_⟩ + have hab : a ≤ b := (hbound ha).2 + let clip := fun N (i : Fin N) => spectralClip a b (eig N i) + have hcmean := physical_mean_wasserstein_field_pressure_tendsto hhaar hgauss hpub P U hU hHaar clip ν a b + hcompact hbound ha hb (fun ε hε => Eventually.of_forall (fun N i => by + have hh := spectralClip_mem hab (eig N i) + constructor <;> linarith [hh.1,hh.2])) + (spectral_clip_empirical_tendsto eig ν a b hbound hweak) field ξ hξ hw + let K := |a|+|b|+1 + have hK : 0 < K := by dsimp [K]; positivity + have hclip N i : |clip N i| ≤ K := by + have hh := spectralClip_mem hab (eig N i) + rw [abs_le] + dsimp [K] + constructor <;> linarith [hh.1,hh.2,neg_abs_le a,le_abs_self b,abs_nonneg a,abs_nonneg b] + have hconc := ae_physical_pressure_sub_mean_tendsto_zero hhaar P + (fun n => U (n+3)) (fun n => hU (n+3)) (fun n => hHaar (n+3)) + (fun n => clip (n+3)) (fun n => field (n+3)) K hK (fun n => hclip (n+3)) + have hη := (spectralExcess_tendsto eig a b hno).comp (tendsto_add_atTop_nat 3) + filter_upwards [hconc] with ω hω + have hclim := hω.add (hcmean.comp (tendsto_add_atTop_nat 3)) + have hd : Tendsto (fun n => rotatedPressure (eig (n+3)) (matrixRotation (U (n+3) ω)⁻¹) + (field (n+3))- + rotatedPressure (clip (n+3)) (matrixRotation (U (n+3) ω)⁻¹) (field (n+3))) + atTop (𝓝 0) := by + apply squeeze_zero_norm _ (by simpa only [zero_div] using hη.div_const 2) + intro n + rw [Real.norm_eq_abs,abs_sub_comm] + exact abs_rotatedPressure_sub_le (by omega) (clip (n+3)) (eig (n+3)) + (matrixRotation (U (n+3) ω)⁻¹) (field (n+3)) + (spectralExcess (eig (n+3)) a b) + (fun i => spectralClip_close hab (spectralExcess_nonneg _ _ _) (spectralExcess_bounds _ _ _ i)) + apply (tendsto_add_atTop_iff_nat 3).mp + have hh := hclim.add hd + convert hh using 1 + · funext n + dsimp only [Function.comp_apply] + ring + · simp only [zero_add,add_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedBoundary.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..c16780d90e972f0e15a71cd297edf2e98eb223a4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedBoundary.lean @@ -0,0 +1,98 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarWeightedPDE +import OAI.Probability.InvariantIsing.Magnetic.MagneticHeatJetContinuity + +namespace OAI + +/-! Continuous extension of the actual weighted continuation to the +closed spin interval, uniformly with respect to the slab variance. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +private lemma continuousOn_zero_spin_extension (f : ℝ × ℝ → ℝ) + (hc : ∀ p : ℝ × ℝ, |p.2| < 1 → ContinuousAt f p) + (hb : ∀ p : ℝ × ℝ, |p.2| = 1 → + Tendsto f (𝓝[{q : ℝ × ℝ | |q.2| < 1}] p) (𝓝 0)) : + ContinuousOn (fun p : ℝ × ℝ => if |p.2| < 1 then f p else 0) + (univ ×ˢ Icc (-1 : ℝ) 1) := by + let S : Set (ℝ × ℝ) := {q | |q.2| < 1} + let g := fun p : ℝ × ℝ => if |p.2| < 1 then f p else 0 + intro p hp + change ContinuousWithinAt g _ p + by_cases hi : |p.2| < 1 + · have he : g =ᶠ[𝓝 p] f := by + filter_upwards [(isOpen_lt continuous_snd.abs continuous_const).mem_nhds hi] with q hq + exact ite_eq_left hq + exact ((hc p hi).congr_of_eventuallyEq he).continuousWithinAt + · have he : |p.2| = 1 := le_antisymm (abs_le.mpr hp.2) (le_of_not_gt hi) + have hg : g p = 0 := ite_eq_right hi + have hin : Tendsto g (𝓝[S] p) (𝓝 (0 : ℝ)) := by + apply (hb p he).congr' + filter_upwards [self_mem_nhdsWithin] with q hq + exact (ite_eq_left hq).symm + have hout : Tendsto g (𝓝[Sᶜ] p) (𝓝 (0 : ℝ)) := by + apply tendsto_const_nhds.congr' + filter_upwards [self_mem_nhdsWithin] with q hq + exact (ite_eq_right hq).symm + have hall : Tendsto g (𝓝[S ∪ Sᶜ] p) (𝓝 (0 : ℝ)) := by + rw [nhdsWithin_union, tendsto_sup] + exact ⟨hin, hout⟩ + have hall' : Tendsto g (𝓝 p) (𝓝 (0 : ℝ)) := by simpa only [union_compl_self, nhdsWithin_univ] using hall + rw [← hg] at hall' + exact hall'.mono_left nhdsWithin_le_nhds + +def closedMagneticSlabWeighted (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarSlabWeighted L hL A ζ p.1 p.2 else 0 + +lemma magneticScalarSlabWeighted_continuousAt (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ : ℝ} (hζ : 0 ≤ ζ) {p : ℝ × ℝ} (hp : |p.2| < 1) : + ContinuousAt (fun q : ℝ × ℝ => + magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ q.1 q.2) p := by + let P := magneticLogCoshMeanFourJet L hL + let F := fieldScalarValue L (fun y => Real.log (Real.cosh y)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + have hcF : Continuous F := continuous_iff_continuousAt.mpr fun z => + (hasDerivAt_fieldScalarLogCosh L hL z).continuousAt + let q := (p.1, magneticScalarSlabBias L ζ p.1 p.2) + have hq : magneticHeatCurvature P.toMagneticContinuationJet F ζ q ≠ 0 := by + have hh := (magneticScalarSlab_curvature_pos L hL hζ p.1 q.2).ne' + simpa only [magneticHeatCurvature_eq _ F hF.1, P, magneticLogCoshMeanFourJet_eq, q, F] using hh + have hcont : ContinuousAt (magneticHeatWeighted P A F ζ) q := by + exact (continuous_magneticHeatSecond P.toMagneticContinuationJet A F hcF hF.2 ζ).continuousAt.sub + (((continuous_magneticHeatSpatial P.toMagneticContinuationJet A.toMagneticContinuationJet + F hcF hF.2 ζ).continuousAt.mul + (continuous_magneticHeatSecond P.toMagneticContinuationJet P F hcF hF.2 ζ).continuousAt).div + (continuous_magneticHeatCurvature P.toMagneticContinuationJet F hcF hF.2 ζ).continuousAt hq) + have hb := magneticScalarSlabBias_continuousAt_joint L hL (v := p.1) hζ hp + have hh := hcont.comp' (f := fun r : ℝ × ℝ => + (r.1, magneticScalarSlabBias L ζ r.1 r.2)) (x := p) (continuousAt_fst.prodMk hb) + simpa only [← magneticScalarSlabWeighted_eq_heat, P, F, q] using hh + +theorem continuousOn_closedMagneticSlabWeighted (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (A : MagneticContinuationFourJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) : + ContinuousOn (closedMagneticSlabWeighted L hL A.toMagneticContinuationJet ζ) + (univ ×ˢ Icc (-1 : ℝ) 1) := by + apply continuousOn_zero_spin_extension + · exact fun p hp => magneticScalarSlabWeighted_continuousAt L hL A hζ hp + · intro p hp + have he : p.2 = -1 ∨ p.2 = 1 := by + rcases le_total 0 p.2 with h | h + · exact Or.inr (by rwa [abs_of_nonneg h] at hp) + · exact Or.inl (by rw [abs_of_nonpos h] at hp; linarith) + apply magneticScalarSlabWeighted_tendsto_endpoint L hL hL1 A.toMagneticContinuationJet hA hζ hζ1 he + · exact self_mem_nhdsWithin + · exact continuous_snd.continuousAt.mono_left nhdsWithin_le_nhds + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedClosed.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedClosed.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2ee2fa5ef37d8e1f5c1a269f2e3da36025cc3ba --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedClosed.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedBoundary +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedSpatial +import OAI.Probability.InvariantIsing.Magnetic.MagneticSlabClosedDerivatives + +namespace OAI + +/-! Closed-strip derivative data for the weighted continuation. At either +spin endpoint the continued function is identically zero in time. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +def closedMagneticWeightedSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ : ℝ) + (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarWeightedSlope L hL A ζ p.1 p.2 else 0 + +def closedMagneticWeightedSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ : ℝ) + (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarWeightedSecond L hL A ζ p.1 p.2 else 0 + +def closedMagneticWeightedPotential (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) (p : ℝ × ℝ) : ℝ := + if |p.2| < 1 then magneticScalarWeightedPotential L hL ζ p.1 p.2 else 0 + +def closedMagneticWeightedTime (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ : ℝ) + (p : ℝ × ℝ) : ℝ := + (closedMagneticScalarCurvature L hL ζ p) ^ 2 / 2 * + closedMagneticWeightedSecond L hL A ζ p + + closedMagneticWeightedPotential L hL ζ p * + closedMagneticSlabWeighted L hL A.toMagneticContinuationJet ζ p + +lemma closedMagneticSlabWeighted_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => closedMagneticSlabWeighted L hL A.toMagneticContinuationJet ζ (v, u)) + (closedMagneticWeightedSlope L hL A ζ (v, s)) s := by + have he : (fun u => closedMagneticSlabWeighted L hL A.toMagneticContinuationJet ζ (v, u)) + =ᶠ[𝓝 s] magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v := by + filter_upwards [(isOpen_lt continuous_id.abs continuous_const).mem_nhds hs] with u hu + exact ite_eq_left hu + simpa only [closedMagneticWeightedSlope, hs, ite_true] using + (magneticScalarSlabWeighted_hasDerivAt_spin L hL A hζ hs v).congr_of_eventuallyEq he + +lemma closedMagneticWeightedSlope_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (fun u => closedMagneticWeightedSlope L hL A ζ (v, u)) + (closedMagneticWeightedSecond L hL A ζ (v, s)) s := by + have he : (fun u => closedMagneticWeightedSlope L hL A ζ (v, u)) + =ᶠ[𝓝 s] magneticScalarWeightedSlope L hL A ζ v := by + filter_upwards [(isOpen_lt continuous_id.abs continuous_const).mem_nhds hs] with u hu + exact ite_eq_left hu + simpa only [closedMagneticWeightedSecond, hs, ite_true] using + (magneticScalarWeightedSlope_hasDerivAt_spin L hL A hζ hs v).congr_of_eventuallyEq he + +lemma closedMagneticSlabWeighted_hasDerivAt_time (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ v : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (s : ℝ) : + HasDerivAt (fun t => closedMagneticSlabWeighted L hL A.toMagneticContinuationJet ζ (t, s)) + (closedMagneticWeightedTime L hL A ζ (v, s)) v := by + by_cases hs : |s| < 1 + · simpa only [closedMagneticSlabWeighted, closedMagneticWeightedTime, + closedMagneticScalarCurvature, closedMagneticWeightedSecond, + closedMagneticWeightedPotential, hs, ite_true] using + magneticScalarSlabWeighted_PDE L hL A hζ hv hs + · simpa only [closedMagneticSlabWeighted, closedMagneticWeightedTime, + closedMagneticScalarCurvature, closedMagneticWeightedSecond, + closedMagneticWeightedPotential, hs, ite_false, zero_pow (by norm_num : 2 ≠ 0), + zero_div, zero_mul, mul_zero, add_zero] using (hasDerivAt_const v (0 : ℝ)) + +lemma closedMagneticWeightedPotential_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (p : ℝ × ℝ) : + closedMagneticWeightedPotential L hL ζ p ≤ magneticSlabPotentialCap L ζ + 2 := by + by_cases hs : |p.2| < 1 + · exact (le_abs_self _).trans (by simpa only [closedMagneticWeightedPotential, hs, + ite_true] using magneticScalarWeightedPotential_bound L hL hL1 hζ hζ1 hs p.1) + · simp only [closedMagneticWeightedPotential, hs, ite_false] + exact add_nonneg (add_nonneg (magneticFourthRatioCap_nonneg _) (sq_nonneg _)) (by norm_num) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedGenerator.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedGenerator.lean new file mode 100644 index 0000000000000000000000000000000000000000..9986d32d70385e3825c6b9c591eda6e7711ca33a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedGenerator.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFiniteFourth + +namespace OAI + +/-! Weighted continuation curvature has a bounded potential in the +physical inverse-mean coordinate. -/ + +noncomputable section + +namespace InvariantIsing + +lemma weighted_inverse_continuation_generator + (a aTime au auu w wt wu wuu ζ : ℝ) + (ha : aTime + a ^ 2 / 2 * auu + ζ * a ^ 2 = 0) + (hw : wt + a ^ 2 / 2 * wuu + 2 * a * au * wu + (au ^ 2 + a * auu) * w = 0) : + (2 * a * aTime * w + a ^ 2 * wt) + + a ^ 2 / 2 * (2 * (au ^ 2 + a * auu) * w + 4 * a * au * wu + a ^ 2 * wuu) + + (a * auu + 2 * ζ * a) * (a ^ 2 * w) = 0 := by + linear_combination 2 * a * w * ha + a ^ 2 * hw + +lemma fieldBiasFourth_quotient_bound (h : FieldStep) (b : ℝ) : + |fieldBiasFourth h b / fieldBiasCurvature h b| ≤ + magneticFourthRatioCap (scalarFieldIncrements h) := by + rw [abs_div, abs_of_pos (fieldBiasCurvature_pos h b)] + exact (div_le_iff₀ (fieldBiasCurvature_pos h b)).mpr (fieldBiasFourth_relative h b) + +lemma magnetic_weighted_curvature_second_bound (h : FieldStep) (s : ℝ) : + |magneticCurvature h s * magneticCurvatureSecond h s| ≤ + magneticFourthRatioCap (scalarFieldIncrements h) + + (magneticThirdRatioCap (scalarFieldIncrements h)) ^ 2 := by + let b := magneticBias h s + let q := fieldBiasCurvature h b + have hq : 0 < q := fieldBiasCurvature_pos h b + have he : magneticCurvature h s * magneticCurvatureSecond h s = + fieldBiasFourth h b / q - (fieldBiasThird h b / q) ^ 2 := by + dsimp only [magneticCurvature, magneticCurvatureSecond, b, q] + field_simp [(fieldBiasCurvature_pos h (magneticBias h s)).ne'] + have hr : |fieldBiasThird h b / q| ≤ magneticThirdRatioCap (scalarFieldIncrements h) := by + rw [abs_div, abs_of_pos hq] + exact (div_le_iff₀ hq).mpr (fieldBiasThird_relative h b) + have hr2 : |(fieldBiasThird h b / q) ^ 2| ≤ (magneticThirdRatioCap (scalarFieldIncrements h)) ^ 2 := by + rw [abs_pow] + exact pow_le_pow_left₀ (abs_nonneg _) hr 2 + rw [he] + exact (abs_sub _ _).trans (add_le_add (fieldBiasFourth_quotient_bound h b) hr2) + +lemma magnetic_weighted_potential_bound (h : FieldStep) {s : ℝ} (hs : |s| < 1) (ζ : ℝ) : + |magneticCurvature h s * magneticCurvatureSecond h s + 2 * ζ * magneticCurvature h s| ≤ + magneticFourthRatioCap (scalarFieldIncrements h) + + (magneticThirdRatioCap (scalarFieldIncrements h)) ^ 2 + 2 * |ζ| := by + have ha := magneticCurvature_le_spin_variance h hs + have haq : |magneticCurvature h s| ≤ 1 := by + rw [abs_of_pos (magneticCurvature_pos h s)] + linarith [sq_nonneg s] + have ht : |2 * ζ * magneticCurvature h s| ≤ 2 * |ζ| := by + rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + simpa only [mul_one] using mul_le_mul_of_nonneg_left haq (by positivity : 0 ≤ 2 * |ζ|) + exact (abs_add_le _ _).trans (add_le_add (magnetic_weighted_curvature_second_bound h s) ht) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedInitial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..438adefd3ae440c818bf79c621c2b32229f87796 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedInitial.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedSpatial + +namespace OAI + +/-! Initial data of the weighted square-continuation equation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma magneticScalarSlabJet_zero (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ : ℝ) : + magneticScalarSlabJet L hL ζ 0 = magneticLogCoshMeanJet L hL := by + apply MagneticContinuationJet.eq_of_value_eq + funext z + simp only [magneticScalarSlabJet, MagneticContinuationJet.transition, + Real.toNNReal_zero, fieldSpinTransition_zero_variance] + +lemma magneticScalarSlabContinuationJet_zero (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ : ℝ) : + magneticScalarSlabContinuationJet L hL A ζ 0 = A := by + apply MagneticContinuationJet.eq_of_value_eq + funext z + simp only [magneticScalarSlabContinuationJet, MagneticContinuationJet.transition, + Real.toNNReal_zero, fieldSpinTransition_zero_variance] + +lemma magneticScalarSlabWeighted_zero (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) (ζ s : ℝ) : + let P := magneticLogCoshMeanJet L hL + let z := magneticScalarSlabBias L ζ 0 s + magneticScalarSlabWeighted L hL A ζ 0 s = + A.second z - A.first z * (P.second z / P.first z) := by + simp only [magneticScalarSlabWeighted, magneticScalarSlabJet_zero, + magneticScalarSlabContinuationJet_zero] + +lemma magneticScalarSlabWeighted_square_initial (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ s : ℝ) : + magneticScalarSlabWeighted L hL (magneticLogCoshMeanJet L hL).square ζ 0 s = + 2 * ((magneticLogCoshMeanJet L hL).first (magneticScalarSlabBias L ζ 0 s)) ^ 2 := by + rw [magneticScalarSlabWeighted_zero] + have hq := (fieldScalarLogCoshSecond_pos L hL (magneticScalarSlabBias L ζ 0 s)).ne' + change (magneticLogCoshMeanJet L hL).first (magneticScalarSlabBias L ζ 0 s) ≠ 0 at hq + simp only [MagneticContinuationJet.square] + field_simp [hq] + ring + +lemma magneticScalarSlabWeighted_square_initial_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ s : ℝ) : + 0 ≤ magneticScalarSlabWeighted L hL (magneticLogCoshMeanJet L hL).square ζ 0 s := by + rw [magneticScalarSlabWeighted_square_initial] + positivity + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedJet.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9faeb2017d2764217b931c034f335c4afcb9207 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedJet.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticFourJet +import OAI.Probability.InvariantIsing.Magnetic.MagneticInverseVariation + +namespace OAI + +/-! Spatial derivatives of q²Hᵤᵤ. Multiplying by q² removes the first-order +term from the differentiated inverse-coordinate continuation equation. -/ + +noncomputable section + +namespace InvariantIsing + +def magneticWeightedJetValue (P A : MagneticContinuationFourJet) (z : ℝ) : ℝ := + A.second z - A.first z * P.second z / P.first z + +def magneticWeightedJetFirst (P A : MagneticContinuationFourJet) (z : ℝ) : ℝ := + A.third z - (A.second z * P.second z + A.first z * P.third z) / P.first z + + A.first z * (P.second z) ^ 2 / (P.first z) ^ 2 + +def magneticWeightedJetSecond (P A : MagneticContinuationFourJet) (z : ℝ) : ℝ := + A.fourth z - A.third z * P.second z / P.first z - + 2 * A.second z * P.third z / P.first z + + 2 * A.second z * (P.second z) ^ 2 / (P.first z) ^ 2 - + A.first z * P.fourth z / P.first z + + 3 * A.first z * P.second z * P.third z / (P.first z) ^ 2 - + 2 * A.first z * (P.second z) ^ 3 / (P.first z) ^ 3 + +lemma magneticWeightedJetValue_hasDerivAt (P A : MagneticContinuationFourJet) + {z : ℝ} (hq : P.first z ≠ 0) : + HasDerivAt (magneticWeightedJetValue P A) (magneticWeightedJetFirst P A z) z := by + have hd := (A.dSecond z).sub (((A.dFirst z).mul (P.dSecond z)).div (P.dFirst z) hq) + convert hd using 1 + · rfl + · dsimp only [magneticWeightedJetFirst] + simp only [Pi.mul_apply] + field_simp [hq] + ring + +lemma magneticWeightedJetFirst_hasDerivAt (P A : MagneticContinuationFourJet) + {z : ℝ} (hq : P.first z ≠ 0) : + HasDerivAt (magneticWeightedJetFirst P A) (magneticWeightedJetSecond P A z) z := by + have hnum := ((A.dSecond z).mul (P.dSecond z)).add ((A.dFirst z).mul (P.dThird z)) + have hlast := ((A.dFirst z).mul ((P.dSecond z).pow 2)).div ((P.dFirst z).pow 2) + (pow_ne_zero 2 hq) + have hd := ((A.dThird z).sub (hnum.div (P.dFirst z) hq)).add hlast + convert hd using 1 + · rfl + · dsimp only [magneticWeightedJetSecond] + simp only [Pi.mul_apply, Pi.add_apply, Pi.pow_apply, Nat.cast_ofNat, Nat.reduceSub, pow_one] + field_simp [hq] + ring + +def magneticWeightedInverseSecond (P A : MagneticContinuationFourJet) (z : ℝ) : ℝ := + magneticWeightedJetSecond P A z / (P.first z) ^ 2 - + magneticWeightedJetFirst P A z * P.second z / (P.first z) ^ 3 + +lemma magneticWeightedInverseFirst_hasDerivAt (P A : MagneticContinuationFourJet) + {b : ℝ → ℝ} {s : ℝ} (hq : P.first (b s) ≠ 0) + (hb : HasDerivAt b (1 / P.first (b s)) s) : + HasDerivAt (fun u => magneticWeightedJetFirst P A (b u) / P.first (b u)) + (magneticWeightedInverseSecond P A (b s)) s := by + exact inverse_mean_pullback_quotient hq hb rfl rfl + (magneticWeightedJetFirst_hasDerivAt P A hq) (P.dFirst (b s)) + +lemma magneticWeighted_forward_generator {q r d e x₁ x₂ x₃ x₄ ζ : ℝ} + (hq : q ≠ 0) : + ((x₄ / 2 - r * x₃ / (2 * q) + 2 * ζ * q * x₂ + ζ * r * x₁) - + (x₃ / 2 - r * x₂ / (2 * q) + ζ * q * x₁) * r / q - + x₁ * (e / 2 - r * d / (2 * q) + 3 * ζ * q * r) / q + + x₁ * r * (d / 2 - r ^ 2 / (2 * q) + ζ * q ^ 2) / q ^ 2) = + q ^ 2 / 2 * + ((x₄ - x₃ * r / q - 2 * x₂ * d / q + 2 * x₂ * r ^ 2 / q ^ 2 - + x₁ * e / q + 3 * x₁ * r * d / q ^ 2 - 2 * x₁ * r ^ 3 / q ^ 3) / q ^ 2 - + (x₃ - (x₂ * r + x₁ * d) / q + x₁ * r ^ 2 / q ^ 2) * r / q ^ 3) + + (d / q - r ^ 2 / q ^ 2 + 2 * ζ * q) * (x₂ - x₁ * r / q) := by + field_simp [hq] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedNonnegative.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedNonnegative.lean new file mode 100644 index 0000000000000000000000000000000000000000..addab64dd5989639f54838da9f4401231e023a62 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedNonnegative.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedClosed +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedInitial +import OAI.Probability.InvariantIsing.Magnetic.MagneticParabolicComparison + +namespace OAI + +/-! The actual weighted inverse-coordinate continuation preserves +nonnegativity. The maximum principle uses its proved zero endpoint limits. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +theorem magneticScalarSlabWeighted_nonneg (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (A : MagneticContinuationFourJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hi : ∀ s, |s| < 1 → + 0 ≤ magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ 0 s) + {v s : ℝ} (hv : 0 ≤ v) (hs : |s| < 1) : + 0 ≤ magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v s := by + let W := closedMagneticSlabWeighted L hL A.toMagneticContinuationJet ζ + let Wt := closedMagneticWeightedTime L hL A ζ + let Wx := closedMagneticWeightedSlope L hL A ζ + let Wxx := closedMagneticWeightedSecond L hL A ζ + let a := fun p => (closedMagneticScalarCurvature L hL ζ p) ^ 2 / 2 + let c := closedMagneticWeightedPotential L hL ζ + have hw : ContinuousOn W (Icc (0 : ℝ) v ×ˢ Icc (-1 : ℝ) 1) := + (continuousOn_closedMagneticSlabWeighted L hL hL1 A hA hζ hζ1).mono + (fun p hp => ⟨mem_univ _, hp.2⟩) + have hinit : ∀ x ∈ Icc (-1 : ℝ) 1, 0 ≤ W (0, x) := by + intro x hx + by_cases h : |x| < 1 + · simpa only [W, closedMagneticSlabWeighted, h, ite_true] using hi x h + · simp only [W, closedMagneticSlabWeighted, h, ite_false, le_refl] + have hdt : ∀ t ∈ Ioc (0 : ℝ) v, ∀ x ∈ Icc (-1 : ℝ) 1, + HasDerivWithinAt (fun q => W (q, x)) (Wt (t, x)) (Iic t) t := by + intro t ht x hx + exact (closedMagneticSlabWeighted_hasDerivAt_time L hL A hζ ht.1 x).hasDerivWithinAt + have hdx : ∀ t ∈ Icc (0 : ℝ) v, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => W (t, y)) (Wx (t, x)) x := by + intro t ht x hx + exact closedMagneticSlabWeighted_hasDerivAt_spin L hL A hζ (abs_lt.mpr hx) t + have hdxx : ∀ t ∈ Icc (0 : ℝ) v, ∀ x ∈ Ioo (-1 : ℝ) 1, + HasDerivAt (fun y => Wx (t, y)) (Wxx (t, x)) x := by + intro t ht x hx + exact closedMagneticWeightedSlope_hasDerivAt_spin L hL A hζ (abs_lt.mpr hx) t + have hb : ∀ t ∈ Icc (0 : ℝ) v, + a (t, -1) = 0 ∧ (0 : ℝ) = 0 ∧ a (t, 1) = 0 ∧ (0 : ℝ) = 0 := by + intro t ht + obtain ⟨hminus, hplus⟩ := closedMagneticScalarCurvature_endpoints L hL ζ t + simp only [a, hminus, hplus, zero_pow (by norm_num : 2 ≠ 0), zero_div, and_self] + have hpde : ∀ p ∈ Ioc (0 : ℝ) v ×ˢ Icc (-1 : ℝ) 1, + a p * Wxx p + (0 : ℝ) * Wx p + c p * W p ≤ Wt p := by + intro p hp + simp only [a, Wxx, c, W, Wt, closedMagneticWeightedTime, zero_mul, add_zero, le_refl] + have hn := parabolic_minimum_nonneg_bounded hv W Wt Wx Wxx a (fun _ => 0) c hw hinit + hdt hdx hdxx (fun p hp => div_nonneg (sq_nonneg _) (by norm_num)) + (fun p hp => closedMagneticWeightedPotential_bound L hL hL1 hζ hζ1 p) hb hpde + simpa only [W, closedMagneticSlabWeighted, hs, ite_true] using + hn (v, s) ⟨⟨hv, le_rfl⟩, abs_le.mp hs.le⟩ + +lemma magneticScalarSlabWeighted_eq_curvature_square (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationJet) + {ζ : ℝ} (hζ : 0 ≤ ζ) (v s : ℝ) : + magneticScalarSlabWeighted L hL A ζ v s = + (magneticScalarInverseCurvature L hL ζ v s) ^ 2 * + magneticScalarSlabContinuationSecond L hL A ζ v s := by + let J := magneticScalarSlabJet L hL ζ v + let K := magneticScalarSlabContinuationJet L hL A ζ v + let b := magneticScalarSlabBias L ζ v s + have hq : J.first b ≠ 0 := (magneticScalarSlabJet_curvature_pos L hL hζ v b).ne' + rw [magneticScalarInverseCurvature_eq_jet] + change K.second b - K.first b * (J.second b / J.first b) = + (J.first b) ^ 2 * (K.second b / (J.first b) ^ 2 - K.first b * J.second b / (J.first b) ^ 3) + field_simp [hq] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedPosition.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedPosition.lean new file mode 100644 index 0000000000000000000000000000000000000000..8faeab07cd4180d5f82a53c6dec8da1e5991e1c6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedPosition.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWeightedNonnegative +import OAI.Probability.InvariantIsing.Magnetic.MagneticSquareJet + +namespace OAI + +/-! Transport of the weighted continuation inequality back from the inverse +spin coordinate to every finite physical field position. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSlabMean_abs_lt_one (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + |magneticScalarSlabMean L ζ v z| < 1 := by + have hm := magneticScalarSlabMean_strictMono L hL hζ v + have hb (x : ℝ) : |magneticScalarSlabMean L ζ v x| ≤ 1 := + magneticScalarSlabJet_value_bound L hL ζ v x + have hlo := hm (show z - 1 < z by linarith) + have hhi := hm (show z < z + 1 by linarith) + have hminus := (abs_le.mp (hb (z - 1))).1 + have hplus := (abs_le.mp (hb (z + 1))).2 + exact abs_lt.mpr ⟨lt_of_le_of_lt hminus hlo, lt_of_lt_of_le hhi hplus⟩ + +lemma magneticScalarSlabBias_mean (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + magneticScalarSlabBias L ζ v (magneticScalarSlabMean L ζ v z) = z := by + apply (magneticScalarSlabMean_strictMono L hL hζ v).injective + exact magneticScalarSlabMean_bias L hL hζ + (magneticScalarSlabMean_abs_lt_one L hL hζ v z) v + +lemma magneticScalarSlabWeighted_nonneg_at_position (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + (A : MagneticContinuationFourJet) + (hA : ∀ z, ((magneticLogCoshMeanJet L hL).value z) ^ 2 ≤ A.value z ∧ A.value z ≤ 1) + {ζ : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) + (hi : ∀ z, 0 ≤ A.second z - A.first z * + ((magneticLogCoshMeanJet L hL).second z / (magneticLogCoshMeanJet L hL).first z)) + {v : ℝ} (hv : 0 ≤ v) (z : ℝ) : + let J := magneticScalarSlabJet L hL ζ v + let K := magneticScalarSlabContinuationJet L hL A.toMagneticContinuationJet ζ v + 0 ≤ K.second z - K.first z * (J.second z / J.first z) := by + have hinit : ∀ s, |s| < 1 → + 0 ≤ magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ 0 s := by + intro s hs + rw [magneticScalarSlabWeighted_zero] + exact hi _ + have hn := magneticScalarSlabWeighted_nonneg L hL hL1 A hA hζ hζ1 hinit hv + (magneticScalarSlabMean_abs_lt_one L hL hζ v z) + simpa only [magneticScalarSlabWeighted, magneticScalarSlabBias_mean L hL hζ v z] using hn + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedSpatial.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..59749e719e993646f65b7b6d7d51177ea4b50432 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticWeightedSpatial.lean @@ -0,0 +1,129 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticScalarWeightedPDE + +namespace OAI + +/-! Actual spatial derivatives and the uniformly bounded potential of the +weighted inverse-coordinate continuation equation. -/ + +noncomputable section +open Filter Set +open scoped NNReal Topology + +namespace InvariantIsing + +lemma magneticScalarSlabFourJet_pos (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v z : ℝ) : + 0 < (magneticScalarSlabFourJet L hL ζ v).first z := by + have he := congrArg MagneticContinuationJet.first (magneticScalarSlabFourJet_toJet L hL ζ v) + rw [he] + exact magneticScalarSlabJet_curvature_pos L hL hζ v z + +lemma magneticScalarSlabBias_hasDerivAt_fourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarSlabBias L ζ v) + (1 / (magneticScalarSlabFourJet L hL ζ v).first (magneticScalarSlabBias L ζ v s)) s := by + have he := congrArg MagneticContinuationJet.first (magneticScalarSlabFourJet_toJet L hL ζ v) + rw [he] + exact magneticScalarSlabBias_hasDerivAt_jet L hL hζ hs v + +def magneticScalarWeightedSlope (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ v s : ℝ) : ℝ := + let J := magneticScalarSlabFourJet L hL ζ v + let K := magneticScalarSlabContinuationFourJet L hL A ζ v + let b := magneticScalarSlabBias L ζ v s + magneticWeightedJetFirst J K b / J.first b + +def magneticScalarWeightedSecond (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) (ζ v s : ℝ) : ℝ := + magneticWeightedInverseSecond (magneticScalarSlabFourJet L hL ζ v) + (magneticScalarSlabContinuationFourJet L hL A ζ v) (magneticScalarSlabBias L ζ v s) + +lemma magneticScalarSlabWeighted_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v) + (magneticScalarWeightedSlope L hL A ζ v s) s := by + have he : magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v = + fun u => magneticWeightedJetValue (magneticScalarSlabFourJet L hL ζ v) + (magneticScalarSlabContinuationFourJet L hL A ζ v) (magneticScalarSlabBias L ζ v u) := + funext (magneticScalarSlabWeighted_eq_jet L hL A ζ v) + rw [he] + exact inverse_mean_pullback_derivative (magneticScalarSlabBias_hasDerivAt_fourJet L hL hζ hs v) + (magneticWeightedJetValue_hasDerivAt _ _ (magneticScalarSlabFourJet_pos L hL hζ v _).ne') + +lemma magneticScalarWeightedSlope_hasDerivAt_spin (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + HasDerivAt (magneticScalarWeightedSlope L hL A ζ v) + (magneticScalarWeightedSecond L hL A ζ v s) s := by + exact magneticWeightedInverseFirst_hasDerivAt _ _ + (magneticScalarSlabFourJet_pos L hL hζ v _).ne' + (magneticScalarSlabBias_hasDerivAt_fourJet L hL hζ hs v) + +lemma magneticScalarSlabWeighted_second_deriv (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hs : |s| < 1) (v : ℝ) : + deriv (deriv (magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v)) s = + magneticScalarWeightedSecond L hL A ζ v s := by + apply HasDerivAt.deriv + apply (magneticScalarWeightedSlope_hasDerivAt_spin L hL A hζ hs v).congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds (abs_lt.mp hs).1 (abs_lt.mp hs).2] with t ht + exact (magneticScalarSlabWeighted_hasDerivAt_spin L hL A hζ (abs_lt.mpr ht) v).deriv + +def magneticScalarWeightedPotential (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (ζ v s : ℝ) : ℝ := + magneticScalarInverseCurvature L hL ζ v s * magneticScalarInverseSecond L hL ζ v s + + 2 * ζ * magneticScalarInverseCurvature L hL ζ v s + +lemma magneticScalarWeightedPotential_bound (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (hL1 : ∀ av ∈ L, av.1 ≤ 1) + {ζ s : ℝ} (hζ : 0 ≤ ζ) (hζ1 : ζ ≤ 1) (hs : |s| < 1) (v : ℝ) : + |magneticScalarWeightedPotential L hL ζ v s| ≤ magneticSlabPotentialCap L ζ + 2 := by + have ha := magneticScalarInverseCurvature_pos L hL hζ v s + have ha1 : magneticScalarInverseCurvature L hL ζ v s ≤ 1 := + (magneticScalarInverseCurvature_le_spin_variance L hL hL1 hζ hζ1 hs v).trans + (by linarith [sq_nonneg s]) + have hb : |magneticScalarInverseCurvature L hL ζ v s * + magneticScalarInverseSecond L hL ζ v s| ≤ magneticSlabPotentialCap L ζ := by + rcases eq_or_lt_of_le hζ with he | hp + · subst ζ + exact magneticScalarInverse_zero_weighted_second_bound L hL hL1 v s + · exact magneticScalarInverse_weighted_second_bound L hL hL1 hp hζ1 v s + have hc : |2 * ζ * magneticScalarInverseCurvature L hL ζ v s| ≤ 2 := by + rw [abs_of_nonneg (by positivity)] + nlinarith [mul_nonneg (sub_nonneg.mpr hζ1) ha.le] + exact (abs_add_le _ _).trans (add_le_add hb hc) + +lemma magneticScalarWeightedPotential_eq_fourJet (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) {ζ : ℝ} (hζ : 0 ≤ ζ) (v s : ℝ) : + let J := magneticScalarSlabFourJet L hL ζ v + let b := magneticScalarSlabBias L ζ v s + magneticScalarWeightedPotential L hL ζ v s = + J.third b / J.first b - (J.second b) ^ 2 / (J.first b) ^ 2 + 2 * ζ * J.first b := by + let b := magneticScalarSlabBias L ζ v s + have hq := (magneticScalarSlabFourJet_pos L hL hζ v b).ne' + have h1 := congrArg MagneticContinuationJet.first (magneticScalarSlabFourJet_toJet L hL ζ v) + have h2 := congrArg MagneticContinuationJet.second (magneticScalarSlabFourJet_toJet L hL ζ v) + have h3 := congrArg MagneticContinuationJet.third (magneticScalarSlabFourJet_toJet L hL ζ v) + simp only [magneticScalarWeightedPotential, magneticScalarInverseCurvature_eq_jet, + magneticScalarInverseSecond, ← h1, ← h2, ← h3] + field_simp [hq] + +theorem magneticScalarSlabWeighted_PDE (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) (A : MagneticContinuationFourJet) + {ζ v s : ℝ} (hζ : 0 ≤ ζ) (hv : 0 < v) (hs : |s| < 1) : + HasDerivAt (fun t => magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ t s) + ((magneticScalarInverseCurvature L hL ζ v s) ^ 2 / 2 * + magneticScalarWeightedSecond L hL A ζ v s + magneticScalarWeightedPotential L hL ζ v s * + magneticScalarSlabWeighted L hL A.toMagneticContinuationJet ζ v s) v := by + have hd := magneticScalarSlabWeighted_hasDerivAt_time L hL A hζ hv hs + rw [magneticScalarWeightedPotential_eq_fourJet L hL hζ] + rw [magneticScalarInverseCurvature_eq_jet, + ← congrArg MagneticContinuationJet.first (magneticScalarSlabFourJet_toJet L hL ζ v)] + exact hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticZeroPopulationLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticZeroPopulationLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8e9cb5c6d29336f0cba46435ad73b28130c344e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/MagneticZeroPopulationLimit.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Fields.ZeroFieldPopulations + +namespace OAI + +/-! The finite-field pressure theorem permits labels with zero limiting mass. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology BigOperators Classical +namespace InvariantIsing + +theorem general_spectral_mean_field_positive_part_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) atTop (𝓝 ν)) + {A : Type*} [Fintype A] [DecidableEq A] + (group : (N : ℕ) → Fin N → A) (γ c : A → ℝ) + (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) + (fallback : {a // 0 < γ a}) + (hgroup : Tendsto (fun N a => (spinGroupSize (group N) a : ℝ)/N) atTop (𝓝 γ)) : + Tendsto (fun N => ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun i => c (group N i)) ∂μ N) + atTop (𝓝 (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) + (fun i : {a // 0 < γ a} => γ i) (fun i => c i)).toReal) := by + have hpos : Tendsto (fun N i => + (spinGroupSize (positiveSpectralLabel γ fallback ∘ group N) i : ℝ)/N) + atTop (𝓝 (fun i : {a // 0 < γ a} => γ i)) := + by + have hp := positive_spectral_counts_tendsto id group γ hγ fallback + (by simpa only [spectralLabelCount_eq_spinGroupSize,id_eq] using hgroup) + simpa only [spectralLabelCount_eq_spinGroupSize,id_eq] using hp + have hp := general_spectral_mean_field_pressure_tendsto hhaar hgauss hpub μ eig ν a b + hcompact hbound ha hb hno hweak (fun N => positiveSpectralLabel γ fallback ∘ group N) + (fun i : {a // 0 < γ a} => γ i) (fun i => c i) (fun i => i.property) + (positiveSpectralWeights_sum γ hγ hγsum) hpos + have he := physical_mean_zero_field_populations μ eig group γ c hγ fallback hgroup + have hh := he.add hp + simpa only [sub_add_cancel,zero_add,positiveFieldProjection,Function.comp_apply] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RationalConstrainedMinima.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RationalConstrainedMinima.lean new file mode 100644 index 0000000000000000000000000000000000000000..09ead849a59c2a51c963c9df352bb682e51b2757 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RationalConstrainedMinima.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticRationalIncrementLower + +namespace OAI + +/-! Actual compact minimizers of each physical rational product-constraint objective. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Topology BigOperators +namespace InvariantIsing + +theorem rational_constrained_minimizers_exist + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {m n : ℕ} (hm : 2 ≤ m) (hn : 0 < n) (spec : Fin m → ℕ) (hspec : ∑ a, spec a=n) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (μ : (M : ℕ) → Measure (Orthogonal M)) [∀ M, IsProbabilityMeasure (μ M)] + [∀ M, (μ M).IsMulRightInvariant] (lam : Fin m → ℝ) : + ∃ (u : (j : ℕ) → Fin (cavityRationalSize n (m*n-n) j) → ℝ) (v : ℕ → Fin m → ℝ), + (∀ j i, u j i ∈ Set.Icc (1 : ℝ) 2) ∧ (∀ j a, v j a ∈ Set.Icc (1 : ℝ) 2) ∧ + ∀ j u' v', (∀ i, u' i ∈ Set.Icc (1 : ℝ) 2) → (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + rationalConstrainedObjective hm hn spec hspec Cset hCset μ lam j (u j) (v j) ≤ + rationalConstrainedObjective hm hn spec hspec Cset hCset μ lam j u' v' := by + let N := fun j => (j+(m*n-n+n+3))*n + let g := fun M => cavityRationalLabel (by omega : 0 < m) spec hspec M + let S : (j : ℕ) → Finset (Spin (N j)) := fun j => consecutiveBlockConstraint n (j+(m*n-n+n+3)) Cset + have hN j : 3 ≤ N j := cavityRationalSize_ge_three n (m*n-n) j hn + have hpos j : 0 < N j := by have := hN j; omega + let ν := fun j => cavityOrientedBaseLaw (hpos j) (μ (N j)) + have hν j : (ν j).IsMulLeftInvariant := cavityOrientedBaseLaw_leftInvariant (hpos j) (μ (N j)) + let π : (j : ℕ) → Measure (Spin (N j) × LabeledLeaf 0) := fun j => + restrictedZeroTreePrior (S j) (consecutiveBlockConstraint_nonempty Cset hCset) + let (j : ℕ) : IsProbabilityMeasure (π j) := + restrictedZeroTreePrior_probability (S j) (consecutiveBlockConstraint_nonempty Cset hCset) + choose u v hu hv hmin using fun j => priorPerturbationObjective_exists_minimum hhaar hgauss (hN j) + (ν j) (hν j) (π j) (fun i => lam (g (N j) i)) (fun _ => 0) (cavitySpectralGroup (g (N j))) 1 + (fun _ => 0) monotone_const le_rfl + exact ⟨u,v,hu,hv,hmin⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RationalMagnetizationCounts.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RationalMagnetizationCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e7934a0f0b3b48070294cbdc2c7f08f97c36b27 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RationalMagnetizationCounts.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Cavity.ConsecutiveGroupProfile +import OAI.Probability.InvariantIsing.Magnetic.MagneticGroupInterior + +namespace OAI + +/-! A common denominator makes any finite rational interior magnetization +attainable after repeating the original group block. -/ +noncomputable section +open scoped BigOperators +namespace InvariantIsing + +lemma rational_magnetization_counts {A : Type*} [Fintype A] [DecidableEq A] + (size : A → ℕ) (mag : RationalMagnetization A) : + ∃ d : ℕ, 0 < d ∧ ∃ k : A → ℕ, (∀ a, k a ≤ d*size a) ∧ + ∀ a, (k a : ℝ)=(d*size a : ℕ)*((1+(mag.val a : ℝ))/2) := by + let p := fun a => (1+mag.val a)/2 + have hp a : 0 ≤ p a := by + have hh := (abs_lt.mp (mag.property a)).1 + have hh' : 0 ≤ (1+(mag.val a : ℝ))/2 := by linarith + exact_mod_cast hh' + have hp1 a : (p a : ℝ) ≤ 1 := by + have hh := (abs_lt.mp (mag.property a)).2 + dsimp only [p] + push_cast + linarith + let d := ∏ a, (p a).den + have hd : 0 < d := Finset.prod_pos (fun a _ => (p a).den_pos) + have hdiv a : (p a).den ∣ d := Finset.dvd_prod_of_mem (fun a => (p a).den) (Finset.mem_univ a) + let k := fun a => (d/(p a).den)*(p a).num.toNat*size a + have he a : (k a : ℝ)=(d*size a : ℕ)*(p a : ℝ) := by + have hnum : ((p a).num.toNat : ℝ)=(p a : ℝ)*(p a).den := by + have hnat : ((p a).num.toNat : ℤ)=(p a).num := + Int.toNat_of_nonneg (Rat.num_nonneg.mpr (hp a)) + have hreal : ((p a).num.toNat : ℝ)=((p a).num : ℝ) := by exact_mod_cast hnat + rw [hreal,Rat.cast_def] + exact (div_mul_cancel₀ ((p a).num : ℝ) + (Nat.cast_ne_zero.mpr (p a).den_pos.ne')).symm + have hprod : ((d/(p a).den : ℕ) : ℝ)*(p a).den=d := by + exact_mod_cast Nat.div_mul_cancel (hdiv a) + dsimp only [k] + rw [Nat.cast_mul,Nat.cast_mul,hnum,Nat.cast_mul] + calc + _ = (((d/(p a).den : ℕ) : ℝ)*(p a).den)*size a*(p a : ℝ) := by ring + _ = _ := by rw [hprod] + refine ⟨d,hd,k,?_,?_⟩ + · intro a + have hh : (k a : ℝ) ≤ (d*size a : ℕ) := by + rw [he] + exact mul_le_of_le_one_right (Nat.cast_nonneg _) (hp1 a) + exact_mod_cast hh + · intro a + simpa only [p,Rat.cast_div,Rat.cast_add,Rat.cast_one,Rat.cast_ofNat] using he a + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedAncestorEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedAncestorEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..102bf9be49ed4436b2e5fb1d11dbdf8dd94b77b7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedAncestorEndpoint.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalShift +import OAI.Probability.InvariantIsing.Fields.MarkEndpointKernel +import OAI.Probability.InvariantIsing.Magnetic.RestrictedEndpointKernel + +namespace OAI + +/-! The ancestor increments for the constrained terminal give its physical endpoint kernels. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +lemma restrictedAncestor_state {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents (n+1) b) : + markStateKernel (vectorTerminalAncestorKernel N (n+1) b v (restrictedFieldTerminal S) + (continuous_restrictedFieldTerminal S hS).measurable 0) = + vectorGaussianTransition N (b 0) (v 0) + (restrictedFieldRecursion S n (fun i => b (i+1)) (fun i => v (i+1))) + (restrictedFieldRecursion_regular hN S hS n _ _ + (fun i hi => (hb.1 (i+1) (by omega)).1)).1 := by + let := vectorTerminalAncestorKernel_markov hN (n+1) b v hb (restrictedFieldTerminal S) + (continuous_restrictedFieldTerminal S hS).measurable (restrictedFieldTerminal_linearGrowth S hS) 0 + ext z : 1 + rw [markStateKernel_apply,vectorTerminalAncestorKernel_add hN (n+1) b v hb + (restrictedFieldTerminal S) (continuous_restrictedFieldTerminal S hS).measurable + (restrictedFieldTerminal_linearGrowth S hS) 0 (by omega)] + simp only [zero_add,vectorTerminalBackward_one,restrictedFieldRecursion] + +lemma restrictedAncestor_tail {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) : + markTailEndpointKernel n (vectorTerminalAncestorKernel N n b v (restrictedFieldTerminal S) + (continuous_restrictedFieldTerminal S hS).measurable) = + restrictedTailEndpointKernel hN S hS n b v (fun i hi => (hb.1 i hi).1) := by + induction n generalizing b v with + | zero => rfl + | succ n ih => + have hbs : CascadeExponents n (fun i => b (i+1)) := hb.tail + have hs : (fun i => vectorTerminalAncestorKernel N (n+1) b v (restrictedFieldTerminal S) + (continuous_restrictedFieldTerminal S hS).measurable (i+1)) = + vectorTerminalAncestorKernel N n (fun i => b (i+1)) (fun i => v (i+1)) + (restrictedFieldTerminal S) (continuous_restrictedFieldTerminal S hS).measurable := + funext fun i => vectorTerminalAncestorKernel_shift N n b v _ _ i + rw [markTailEndpointKernel,hs,ih _ _ hbs,restrictedAncestor_state hN S hS n b v hb] + rfl + +lemma restrictedAncestor_pair {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : CascadeExponents n b) (d : Fin (n+1)) : + markPairEndpointKernel n (vectorTerminalAncestorKernel N n b v (restrictedFieldTerminal S) + (continuous_restrictedFieldTerminal S hS).measurable) d = + restrictedPairEndpointKernel hN S hS n b v (fun i hi => (hb.1 i hi).1) d := by + induction n generalizing b v with + | zero => rfl + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) d + · simp only [markPairEndpointKernel,restrictedPairEndpointKernel,Fin.cases_zero, + restrictedAncestor_tail hN S hS (n+1) b v hb] + · have hbs : CascadeExponents n (fun i => b (i+1)) := hb.tail + have hs : (fun i => vectorTerminalAncestorKernel N (n+1) b v (restrictedFieldTerminal S) + (continuous_restrictedFieldTerminal S hS).measurable (i+1)) = + vectorTerminalAncestorKernel N n (fun i => b (i+1)) (fun i => v (i+1)) + (restrictedFieldTerminal S) (continuous_restrictedFieldTerminal S hS).measurable := + funext fun i => vectorTerminalAncestorKernel_shift N n b v _ _ i + simp only [markPairEndpointKernel,restrictedPairEndpointKernel,Fin.cases_succ] + rw [hs,ih _ _ hbs,restrictedAncestor_state hN S hS n b v hb] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseCutoffLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseCutoffLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f39e303e74708368e1335cd10767097e6a4f3b8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseCutoffLaw.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityBaseRestrictedLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLogMap +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffMap +import OAI.Probability.InvariantIsing.Cavity.CavitySpinSplit + +namespace OAI + +/-! The restricted base/cavity test in the exact product coordinates: +the shared cascade leaf stays with the base Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped Classical + +namespace InvariantIsing + +theorem restricted_base_cutoff_product_law {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (T : LabeledTree depth) + (J : Spin N × LabeledLeaf depth → ℝ) + (W : (Spin N × Spin n) × LabeledLeaf depth → ℝ) + (hj : Integrable (fun x => Real.exp (J x)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T)) + (hfull : Integrable (fun x => Real.exp (J (x.1.1,x.2) + W x)) + (((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior Cset hCset)).prod + (labeledLeafLaw depth T))) + (s : Set ((Spin N × Spin n) × LabeledLeaf depth)) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + cavityCutoffReplicaMean + (((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior Cset hCset)).prod + (labeledLeafLaw depth T)) (fun x => J (x.1.1,x.2) + W x) s F = + cavityWeightedReplicaMean + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted J).prod + (restrictedSpinPrior Cset hCset)) + ((cavityPairLeafUnswap ⁻¹' s).indicator (fun x => Real.exp (W (cavityPairLeafUnswap x)))) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) := by + let μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let π := (restrictedSpinPrior Cset hCset : Measure (Spin n)) + let ν := ((restrictedSpinPrior S hS : Measure (Spin N)).prod π).prod (labeledLeafLaw depth T) + let V := W ∘ cavityPairLeafUnswap + have hp := restricted_pair_leaf_swap_preserving S hS Cset hCset T + have he : Integrable (fun x => Real.exp (J x.1 + V x)) (μ.prod π) := + (hp.integrable_comp (measurable_of_countable _).aestronglyMeasurable).mp hfull + have hc := cavity_cutoff_replica_map ν (μ.prod π) cavityPairLeafSwap hp + (fun x => J x.1 + V x) (cavityPairLeafUnswap ⁻¹' s) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) + exact hc.trans (cavity_base_cutoff_indicator μ π J V hj he + (cavityPairLeafUnswap ⁻¹' s) (fun σ => F (fun i => cavityPairLeafUnswap (σ i)))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseCutoffProduct.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseCutoffProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..91dba19bf6ecb5abc7b16dd6c680a04399600806 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseCutoffProduct.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBaseCutoffLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalCutoff + +namespace OAI + +/-! The actual perturbed base cutoff is the base Gibbs kernel reweighted +by the unperturbed cavity factor, with the spatial cutoff inside the weight. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped Classical + +namespace InvariantIsing + +theorem restricted_base_cutoff_product {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (U : Rotation (N+n)) (V : Rotation N) (T : LabeledTree depth) + (J : Fin m → Finset (Fin N)) (eig : Fin (N+n) → ℝ) (eig₀ : Fin N → ℝ) + (v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + (w : Spin N × Spin n → ℝ) (D : ℝ) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + let μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let ν := ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior Cset hCset)).prod + (labeledLeafLaw depth T) + let s := {x : (Spin N × Spin n) × LabeledLeaf depth | w x.1 ≤ D} + let W := fun x : (Spin N × Spin n) × LabeledLeaf depth => + t * (rotatedEnergy eig U (cavityJoinedSpin x.1) - rotatedEnergy eig₀ V x.1.1) + cavityBaseCutoffReplicaMean U V J eig eig₀ v u t w D (subtypeReference ν s) + (fun σ => F (fun i => (σ i).val)) = + ∫ z, cavityWeightedReplicaMean + ((μ.tilted (cavityRotationHamiltonian V (diagonalPerturbedEigenvalues eig₀ J v t) J u z)).prod + (restrictedSpinPrior Cset hCset)) + ((cavityPairLeafUnswap ⁻¹' s).indicator (fun x => Real.exp (W (cavityPairLeafUnswap x)))) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) ∂gaussianCoordinates := by + intro μ ν s W + let H := fun x : (Spin N × Spin n) × LabeledLeaf depth => + rotatedEnergy (diagonalPerturbedEigenvalues eig₀ J v t) V x.1.1 + W x + let A := fun x : (Spin N × Spin n) × LabeledLeaf depth => + cavityPerturbationCoefficients V J u depth (x.1.1,x.2) + obtain ⟨M, hM⟩ := Finite.exists_le (fun x : Spin N × Spin n => + |rotatedEnergy (diagonalPerturbedEigenvalues eig₀ J v t) V x.1 + + t * (rotatedEnergy eig U (cavityJoinedSpin x) - rotatedEnergy eig₀ V x.1)|) + have hraw : ∀ᵐ z ∂gaussianCoordinates, + Integrable (fun x => Real.exp (H x + cylinderField (A x) z)) ν := + cylinder_partition_exp_integrable_ae ν H + (cavity_bounded_base_exp_integrable ν H (fun x => hM x.1)) A + (fun x => cavityPerturbationCoefficients_sq_le V J u hu (x.1.1,x.2)) + change (∫ z, referenceReplicaMean (subtypeReference ν s) + (fun x => H x.val + cylinderField (A x.val) z) + (fun σ => F (fun i => (σ i).val)) ∂gaussianCoordinates) = _ + apply integral_congr_ae + filter_upwards [hraw, restricted_rotation_exp_integrable_ae S hS V T + (diagonalPerturbedEigenvalues eig₀ J v t) J u hu] with z hz hj + let B : Spin N × LabeledLeaf depth → ℝ := + cavityRotationHamiltonian V (diagonalPerturbedEigenvalues eig₀ J v t) J u z + have heq : (fun x : (Spin N × Spin n) × LabeledLeaf depth => + H x + cylinderField (A x) z) = fun x => B (x.1.1,x.2) + W x := by + funext x + dsimp only [H, A, B, cavityRotationHamiltonian] + ring + have hfull : Integrable (fun x => Real.exp (B (x.1.1,x.2) + W x)) ν := by + apply hz.congr + filter_upwards [] with x + exact congrArg Real.exp (congrFun heq x) + have hs : MeasurableSet s := (Set.to_countable s).measurableSet + rw [← cavity_cutoff_replica_subtype_all ν _ hz s hs F] + rw [heq] + exact restricted_base_cutoff_product_law S hS Cset hCset T B W hj hfull s F + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseRawCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseRawCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..e77b5dc0b75d19a4fadbe804da3091adfab8adda --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBaseRawCutoff.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBaseCutoffProduct + +namespace OAI + +/-! The base cutoff interpolation law in unconditioned product +coordinates. This form permits replacement of the whole Gaussian field. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped Classical + +namespace InvariantIsing + +theorem restricted_base_raw_cutoff_law {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (U : Rotation (N+n)) (V : Rotation N) (T : LabeledTree depth) + (J : Fin m → Finset (Fin N)) (eig : Fin (N+n) → ℝ) (eig₀ : Fin N → ℝ) + (v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + (w : Spin N × Spin n → ℝ) (D : ℝ) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + let μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let ν := ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior Cset hCset)).prod + (labeledLeafLaw depth T) + let s := {x : (Spin N × Spin n) × LabeledLeaf depth | w x.1 ≤ D} + let W := fun x : (Spin N × Spin n) × LabeledLeaf depth => + t * (rotatedEnergy eig U (cavityJoinedSpin x.1) - rotatedEnergy eig₀ V x.1.1) + cavityBaseCutoffReplicaMean U V J eig eig₀ v u t w D (subtypeReference ν s) + (fun σ => F (fun i => (σ i).val)) = + ∫ z, cavityCutoffReplicaMean (μ.prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityRotationHamiltonian V + (diagonalPerturbedEigenvalues eig₀ J v t) J u z x.1 + W (cavityPairLeafUnswap x)) + (cavityPairLeafUnswap ⁻¹' s) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) ∂gaussianCoordinates := by + intro μ ν s W + let H := fun x : (Spin N × Spin n) × LabeledLeaf depth => + rotatedEnergy (diagonalPerturbedEigenvalues eig₀ J v t) V x.1.1 + W x + let A := fun x : (Spin N × Spin n) × LabeledLeaf depth => + cavityPerturbationCoefficients V J u depth (x.1.1,x.2) + obtain ⟨M, hM⟩ := Finite.exists_le (fun x : Spin N × Spin n => + |rotatedEnergy (diagonalPerturbedEigenvalues eig₀ J v t) V x.1 + + t * (rotatedEnergy eig U (cavityJoinedSpin x) - rotatedEnergy eig₀ V x.1)|) + have hraw : ∀ᵐ z ∂gaussianCoordinates, + Integrable (fun x => Real.exp (H x + cylinderField (A x) z)) ν := + cylinder_partition_exp_integrable_ae ν H + (cavity_bounded_base_exp_integrable ν H (fun x => hM x.1)) A + (fun x => cavityPerturbationCoefficients_sq_le V J u hu (x.1.1,x.2)) + change (∫ z, referenceReplicaMean (subtypeReference ν s) + (fun x => H x.val + cylinderField (A x.val) z) + (fun σ => F (fun i => (σ i).val)) ∂gaussianCoordinates) = _ + apply integral_congr_ae + filter_upwards [hraw] with z hz + rw [← cavity_cutoff_replica_subtype_all ν _ hz s (Set.to_countable s).measurableSet F] + have heq : (fun x : (Spin N × Spin n) × LabeledLeaf depth => + H x + cylinderField (A x) z) = fun x => + cavityRotationHamiltonian V (diagonalPerturbedEigenvalues eig₀ J v t) J u z + (x.1.1,x.2) + W x := by + funext x + dsimp only [H, A, cavityRotationHamiltonian] + ring + rw [heq] + have hm := cavity_cutoff_replica_map ν (μ.prod (restrictedSpinPrior Cset hCset)) cavityPairLeafSwap + (restricted_pair_leaf_swap_preserving S hS Cset hCset T) + (fun x => cavityRotationHamiltonian V (diagonalPerturbedEigenvalues eig₀ J v t) J u z x.1 + + W (cavityPairLeafUnswap x)) (cavityPairLeafUnswap ⁻¹' s) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) + have hs : cavityPairLeafSwap ⁻¹' (cavityPairLeafUnswap ⁻¹' s) = s := by + ext x + rfl + rw [hs] at hm + simpa only [Function.comp_def, cavityPairLeafSwap, cavityPairLeafUnswap] using hm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockConsistency.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockConsistency.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a12dee58484af21906e4e9d7578afcbb27eeecd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockConsistency.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairTies +import OAI.Probability.InvariantIsing.Cavity.CavityFieldSelfConsistency + +namespace OAI + +/-! Plateau consistency and the L1 self-consistency implication for the +actual constrained block overlap, with arbitrary finite cascade depth. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology BoundedContinuousFunction + +namespace InvariantIsing + +private lemma restricted_finite_level_fiber {n : ℕ} (f q : Fin (n + 1) → ℝ) + (hf : Monotone f) + (hq : ∀ k : Fin n, f k.castSucc = f k.succ → q k.castSucc = q k.succ) + (i j : Fin (n + 1)) (he : f i = f j) : q i = q j := by + have hord : ∀ j i : Fin (n + 1), i ≤ j → f i = f j → q i = q j := by + intro j + induction j using Fin.induction with + | zero => + intro i hi _ + have hi0 : i = 0 := le_antisymm hi (Fin.zero_le i) + subst i + rfl + | succ j ih => + intro i hij he + by_cases hi : i = j.succ + · rw [hi] + have hij' : i ≤ j.castSucc := by + change i.val ≤ j.val + have hil : i.val ≤ j.val + 1 := hij + have hne : i.val ≠ j.val + 1 := by + intro hv + apply hi + exact Fin.ext hv + omega + have hleft := hf hij' + have hright := hf (show j.castSucc ≤ j.succ by exact Nat.le_succ j.val) + have he' : f i = f j.castSucc := by linarith + have hs : f j.castSucc = f j.succ := by linarith + exact (ih i hij' he').trans (hq j hs) + rcases le_total i j with hij | hji + · exact hord j i hij he + · exact (hord i j hji he.symm).symm + + +lemma restrictedBlockPairMean_eq_of_height_eq {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i j : Fin (h.depth+1)) (he : h.height i = h.height j) : + restrictedBlockPairMean hN S hS h b i = restrictedBlockPairMean hN S hS h b j := + restricted_finite_level_fiber h.height (restrictedBlockPairMean hN S hS h b) + h.ordered_height (restrictedBlockPairMean_tied hN S hS h b) i j he + +lemma restrictedBlockOverlapPath_on_cell {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (i : Fin (h.depth+1)) {s : ℝ} (hs : s ∈ Ioo (h.cut i.castSucc) (h.cut i.succ)) : + restrictedBlockOverlapPath hN S hS h s = restrictedBlockPairMean hN S hS h (fun _ => 0) i := + fieldLevelPath_on_cell h _ _ _ i hs + +lemma restrictedBlockOverlapPath_eq_of_cell_height_eq {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (i j : Fin (h.depth+1)) {s t : ℝ} + (hs : s ∈ Ioo (h.cut i.castSucc) (h.cut i.succ)) + (ht : t ∈ Ioo (h.cut j.castSucc) (h.cut j.succ)) + (he : h.height i = h.height j) : + restrictedBlockOverlapPath hN S hS h s = restrictedBlockOverlapPath hN S hS h t := by + rw [restrictedBlockOverlapPath_on_cell hN S hS h i hs, + restrictedBlockOverlapPath_on_cell hN S hS h j ht] + exact restrictedBlockPairMean_eq_of_height_eq hN S hS h _ i j he + +theorem restricted_block_self_consistency_l1 {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (p : OverlapPath) + (q : ℕ → OverlapPath) (h : ℕ → FieldStep) (height : ℕ → ℝ → ℝ) + (hheight : ∀ a i s, s ∈ Ioo ((h a).cut i.castSucc) ((h a).cut i.succ) → + (h a).height i = height a (p s)) + (hq : ∀ᵐ s ∂pathMeasure, Tendsto (fun a => q a s) atTop (𝓝 (p s))) + (htest : ∀ Φ : ℝ →ᵇ ℝ, Tendsto + (fun a => ∫ s, Φ (q a s) * (restrictedBlockOverlapPath hN S hS (h a) s - q a s) ∂pathMeasure) + atTop (𝓝 0)) : + Tendsto (fun a => ∫ s, |restrictedBlockOverlapPath hN S hS (h a) s - p s| ∂pathMeasure) + atTop (𝓝 0) := by + let D := {s | ∀ a, ∃ i : Fin ((h a).depth+1), + s ∈ Ioo ((h a).cut i.castSucc) ((h a).cut i.succ)} + have hDae : ∀ᵐ s ∂pathMeasure, s ∈ D := + ae_all_iff.mpr (fun a => ae_finite_overlap_cell (h a).cut (h a).first (h a).last) + apply cavity_rounded_self_consistency_l1_on p q (fun a => restrictedBlockOverlapPath hN S hS (h a)) + hq D hDae ?_ htest + intro a x hx y hy hxy + obtain ⟨i,hi⟩ := hx a + obtain ⟨j,hj⟩ := hy a + apply restrictedBlockOverlapPath_eq_of_cell_height_eq hN S hS (h a) i j hi hj + rw [hheight a i x hi, hheight a j y hj, hxy] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockMeasurability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bd75df772abf3873e89cb29aab7f7dbf699339f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockMeasurability.lean @@ -0,0 +1,38 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockSpinEvaluation + +namespace OAI + +/-! Joint measurability of the original constrained block spin test. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma measurable_restrictedFieldBlockSpinIntegrand {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + restrictedFieldBlockSpinIntegrand S hS h p.1 p.2 q Φ) := by + have he : (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + restrictedFieldBlockSpinIntegrand S hS h p.1 p.2 q Φ) = + fun p => (N : ℝ)⁻¹ * ∑ j, restrictedFieldSpinPairIntegrand S hS h p.1 p.2 q Φ j := by + funext p + exact restrictedFieldBlockSpinIntegrand_eq_sum S hS h _ _ q Φ hΦ + rw [he] + exact (Finset.measurable_sum _ (fun j _ => measurable_restrictedFieldSpinPairIntegrand S hS h q Φ j)).const_mul _ + +lemma measurable_restrictedFieldBlockSpinMean {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + Measurable (fun z => restrictedFieldBlockSpinMean S hS h z q Φ) := + (measurable_restrictedFieldBlockSpinIntegrand S hS h q Φ hΦ).stronglyMeasurable.integral_prod_right'.measurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockOverlap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..5969ef38b018c84a295bbfa5646f09763691a6db --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockOverlap.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRootShift +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairOrder + +namespace OAI + +/-! The actual constrained block overlap levels form an admissible path. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal BigOperators + +namespace InvariantIsing + +lemma restrictedBlockPairMean_eq_average {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i : Fin (h.depth + 1)) : + restrictedBlockPairMean hN S hS h b i = (N : ℝ)⁻¹ * ∑ j, + ∫ z, restrictedPairCoordinateMean hN S hS h.depth (chainExponent h.cut) (fieldStepVariance h) + (fun l hl => ((chainExponent_admissible h.ordered_cut h.first h.last).1 l hl).1) i j z + ∂Measure.pi (fun l => gaussianReal (b l) (NNReal.mk (h.height 0) (h.nonneg 0))) := by + rw [restrictedBlockPairMean, integral_finsetSum _ (fun j _ => Integrable.of_finite)] + congr 1 + apply Finset.sum_congr rfl + intro j _ + unfold restrictedLevelSpinPair + rw [Measure.comp_eq_comp_const_apply, Kernel.integral_comp (Integrable.of_finite)] + rfl + +lemma restrictedBlockPairMean_mem_unit {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i : Fin (h.depth + 1)) : restrictedBlockPairMean hN S hS h b i ∈ Icc (0 : ℝ) 1 := by + rw [restrictedBlockPairMean_eq_average] + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hi (j : Fin N) : (∫ z, + restrictedPairCoordinateMean hN S hS h.depth (chainExponent h.cut) (fieldStepVariance h) + (fun l hl => ((chainExponent_admissible h.ordered_cut h.first h.last).1 l hl).1) i j z + ∂Measure.pi (fun l => gaussianReal (b l) (NNReal.mk (h.height 0) (h.nonneg 0)))) ∈ + Icc (0 : ℝ) 1 := by + constructor + · exact integral_nonneg (fun z => restrictedPairCoordinateMean_nonneg hN S hS _ _ _ _ i j z) + · calc + _ ≤ ∫ _z, (1 : ℝ) ∂Measure.pi + (fun l => gaussianReal (b l) (NNReal.mk (h.height 0) (h.nonneg 0))) := + integral_mono (integrable_restrictedPairCoordinateMean hN S hS _ _ _ _ i j _) + (integrable_const _) (fun z => (le_abs_self _).trans + (restrictedPairCoordinateMean_bound hN S hS _ _ _ _ i j z)) + _ = 1 := by simp + constructor + · exact mul_nonneg (inv_nonneg.mpr hn.le) (Finset.sum_nonneg (fun j _ => (hi j).1)) + · calc + _ ≤ (N : ℝ)⁻¹ * ∑ _j : Fin N, (1 : ℝ) := + mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun j _ => (hi j).2)) (inv_nonneg.mpr hn.le) + _ = 1 := by simp [hn.ne'] + +lemma restrictedBlockPairMean_monotone {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) : + Monotone (restrictedBlockPairMean hN S hS h b) := by + intro i k hik + rw [restrictedBlockPairMean_eq_average, restrictedBlockPairMean_eq_average] + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply Finset.sum_le_sum + intro j _ + exact integral_mono (integrable_restrictedPairCoordinateMean hN S hS _ _ _ _ i j _) + (integrable_restrictedPairCoordinateMean hN S hS _ _ _ _ k j _) + (fun z => restrictedPairCoordinateMean_monotone hN S hS _ _ _ _ j z hik) + +def restrictedBlockOverlapPath {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) : OverlapPath := + fieldLevelPath h (restrictedBlockPairMean hN S hS h (fun _ => 0)) + (restrictedBlockPairMean_monotone hN S hS h _) + (restrictedBlockPairMean_mem_unit hN S hS h _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockSpinEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockSpinEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c5651f5b00a4a6778ae71e3cc55aa06707cffef --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedBlockSpinEvaluation.lean @@ -0,0 +1,120 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinEvaluation +import OAI.Probability.InvariantIsing.Cavity.CavityReplicaLinearity + +namespace OAI + +/-! The constrained cavity spin test is exactly the integral against the +original constrained block overlap path. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma integrable_fieldLevelIndex (h : FieldStep) (f : Fin (h.depth + 1) → ℝ) : + Integrable (fun s => f (fieldLevelIndex h s)) pathMeasure := by + apply integrable_of_measurable_abs_le + ((measurable_of_finite f).comp (fieldLevelIndex_monotone h).measurable) + (c := ∑ i, |f i|) + intro s + exact Finset.single_le_sum (fun i _ => abs_nonneg (f i)) (Finset.mem_univ _) + +def restrictedFieldBlockSpinIntegrand {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) : ℝ := + referenceReplicaMean + ((restrictedSpinPrior S hS : Measure (Spin N)).prod (labeledLeafLaw h.depth p.1)) + (fun s : Spin N × LabeledLeaf h.depth => fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + ((N : ℝ)⁻¹ * ∑ j, spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) + +def restrictedFieldBlockSpinMean {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (z : Fin N → ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) : ℝ := + ∫ p, restrictedFieldBlockSpinIntegrand S hS h z p q Φ ∂fieldVectorCoordinateLaw N h + +lemma restrictedFieldBlockSpinIntegrand_eq_sum {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + restrictedFieldBlockSpinIntegrand S hS h z p q Φ = + (N : ℝ)⁻¹ * ∑ j, restrictedFieldSpinPairIntegrand S hS h z p q Φ j := by + let F := fun (j : Fin N) (σ : Fin 2 → Spin N × LabeledLeaf h.depth) => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j)) + have hm : ∀ j, Measurable (F j) := fun _ => measurable_of_countable _ + have hb : ∀ j σ, |F j σ| ≤ C := by + intro j σ + simpa only [F, abs_mul, abs_spinValue, mul_one, one_mul] using hΦ _ + have he : (fun σ : Fin 2 → Spin N × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + ((N : ℝ)⁻¹ * ∑ j, spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) = + (fun σ => (N : ℝ)⁻¹ * ∑ j, F j σ) := by + funext σ + dsimp only [F] + rw [← Finset.mul_sum] + ring + unfold restrictedFieldBlockSpinIntegrand + rw [he, referenceReplicaMean_const_mul, cavity_referenceReplicaMean_sum _ _ F hm (fun _ => C) hb] + rfl + +lemma restrictedFieldBlockSpinMean_eq_sum {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (z : Fin N → ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + restrictedFieldBlockSpinMean S hS h z q Φ = + (N : ℝ)⁻¹ * ∑ j, restrictedFieldSpinPairMean S hS h z q Φ j := by + unfold restrictedFieldBlockSpinMean + simp_rw [restrictedFieldBlockSpinIntegrand_eq_sum S hS h z _ q Φ hΦ] + have hi (j : Fin N) : Integrable (fun p => restrictedFieldSpinPairIntegrand S hS h z p q Φ j) + (fieldVectorCoordinateLaw N h) := by + have hp : Measurable (fun p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ) => + (z, p)) := measurable_const.prodMk measurable_id + have hm0 := (measurable_restrictedFieldSpinPairIntegrand S hS h q Φ j).comp hp + dsimp only [Function.comp_def] at hm0 + have hm : Measurable (fun p => restrictedFieldSpinPairIntegrand S hS h z p q Φ j) := hm0 + exact integrable_of_measurable_abs_le hm + (fun p => restrictedFieldSpinPairIntegrand_abs_le S hS h q Φ j hΦ z p) + rw [integral_const_mul, integral_finsetSum _ (fun j _ => hi j)] + rfl + +theorem restricted_field_block_spin_evaluation + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + (∫ z, restrictedFieldBlockSpinMean S hS h z q Φ + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) = + ∫ s, Φ (q (fieldLevelIndex h s)) * restrictedBlockOverlapPath hN S hS h s ∂pathMeasure := by + simp_rw [restrictedFieldBlockSpinMean_eq_sum S hS h _ q Φ hΦ] + rw [integral_const_mul, integral_finsetSum _ (fun j _ => + integrable_of_measurable_abs_le (measurable_restrictedFieldSpinPairMean S hS h q Φ j) + (fun z => restrictedFieldSpinPairMean_abs_le S hS h q Φ j hΦ z))] + simp_rw [restricted_field_spin_pair_evaluation hpub hN S hS h q Φ _ hΦ] + let a := fun (j : Fin N) (i : Fin (h.depth + 1)) => Φ (q i) * + (∫ z, restrictedPairCoordinateMean hN S hS h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun l hl => ((chainExponent_admissible h.ordered_cut h.first h.last).1 l hl).1) + i j z ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) + change (N : ℝ)⁻¹ * (∑ j, ∫ s, a j (fieldLevelIndex h s) ∂pathMeasure) = _ + have hi (j : Fin N) : Integrable (fun s => a j (fieldLevelIndex h s)) pathMeasure := + integrable_fieldLevelIndex h (a j) + rw [← integral_finsetSum _ (fun j _ => hi j), ← integral_const_mul] + apply integral_congr_ae + apply Filter.Eventually.of_forall + intro s + dsimp only [a] + change _ = Φ (q (fieldLevelIndex h s)) * + restrictedBlockPairMean hN S hS h (fun _ => 0) (fieldLevelIndex h s) + rw [restrictedBlockPairMean_eq_average] + rw [← Finset.mul_sum] + simp only [vectorGaussianLaw, ProbabilityMeasure.coe_mk] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalCappedLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalCappedLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7bc55151f31f203756cf3b2bf61571c7fb0e352 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalCappedLog.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedGroupedCappedLog +import OAI.Probability.InvariantIsing.Cavity.CavityCanonicalGroupAverage + +namespace OAI + +/-! The canonical base-projector logarithm is the actual fresh-group +spin/leaf logarithm, including its geometric quadratic penalty. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_canonical_capped_log_group_average {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) + [IsProbabilityMeasure η] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t cap δ : ℝ) (hcap : 0 ≤ cap) + (B : CavityFactorBlocks d n) : + (∫ V, restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ B (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂μ) = + let dims := cavityBaseGroupDimension k a₀ + let E := cavityBaseGroupEquiv k e a₀ + let A₀ := cavityCanonicalGroupFrame k e a₀ hk + ∫ V, ∫ W, ∫ z, Real.log (∫ x, Real.exp + (min (t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection (fun j => (a₀ j,j)) (cavityGroupSpinCoordinates dims E V) + (cavityGroupHaarFrames A₀ W) x.1.1) x.2) cap - + δ*(1+‖cavitySelectedSiteProjection (fun j => (a₀ j,j)) (cavityGroupSpinCoordinates dims E V) + (cavityGroupHaarFrames A₀ W) x.1.1‖^2)) + ∂((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)).tilted (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t) + (cavitySpectralGroup (fun i => (E.symm i).1)) u z x.1)) + ∂gaussianCoordinates ∂η ∂μ := by + dsimp only + simp_rw [cavityCanonicalProjectorFrame_grouped k e a₀ hk] + apply restricted_grouped_capped_log_average S hS C hC _ _ _ _ ?_ μ η T lam v u hu t cap δ hcap B + rw [cavityCanonicalGroupFrame_special, cavityCanonicalSpecial_gram] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalGroupCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalGroupCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..38ce861c7929de4fb664c5e4451b798a026c6b01 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalGroupCutoff.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityCanonicalGroupAverage +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalWeighted + +namespace OAI + +/-! The original full-system cutoff and its actual fresh-group Gibbs +representation have the same limit after deterministic coefficient replacement. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Matrix Topology + +namespace InvariantIsing + +def restrictedCanonicalGroupCutoffMean {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (g : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k g a))) + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t D : ℝ) (B : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) : ℝ := + let E := cavityBaseGroupEquiv k e g + let A := cavityCanonicalGroupFrame k e g hk + ∫ V, ∫ W, ∫ z, cavityWeightedReplicaMean + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted + (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t) + (cavitySpectralGroup (fun i => (E.symm i).1)) u z)).prod (restrictedSpinPrior Cset hCset)) + ({x | 1+‖cavitySelectedSiteProjection (fun j => (g j,j)) + (cavityGroupSpinCoordinates (cavityBaseGroupDimension k g) E V) + (cavityGroupHaarFrames A W) x.1.1‖^2 ≤ D}.indicator (fun x => + Real.exp (t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection (fun j => (g j,j)) + (cavityGroupSpinCoordinates (cavityBaseGroupDimension k g) E V) + (cavityGroupHaarFrames A W) x.1.1) x.2))) F ∂gaussianCoordinates ∂η ∂μ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalHaarLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalHaarLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd31ac2e8652634beca3526bd1665a66561d407a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalHaarLog.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityCanonicalHaarLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarLogObservable +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability + +namespace OAI + +/-! The constrained base Gibbs law and independent fresh group frames +in the actual canonical capped logarithm. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +def restrictedCanonicalHaarLog {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (B : CavityFactorBlocks d n) + (p : (((Orthogonal N × LabeledTree depth) × (ℕ → ℝ)) × + ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a)))) : ℝ := + let E := cavityBaseGroupEquiv k e a₀ + let dims := cavityBaseGroupDimension k a₀ + let eig := diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t + restrictedHaarLogObservable C hC + (restrictedRotationProbability S hS eig (cavitySpectralGroup (fun i => (E.symm i).1)) u) + (fun j => (a₀ j,j)) (cavityRotationVectors dims E) + (cavityCanonicalGroupFrame k e a₀ hk) (fun _ => B) t cap δ p + +lemma measurable_restrictedCanonicalHaarLog {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (B : CavityFactorBlocks d n) : + Measurable (restrictedCanonicalHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ B) := by + unfold restrictedCanonicalHaarLog + exact measurable_restrictedHaarLogObservable C hC _ (measurable_restrictedRotationProbability S hS _ _ _) _ _ + (measurable_cavityRotationVectors _ _) _ _ measurable_const t cap δ + +lemma restrictedCanonicalHaarLog_bound {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (B : CavityFactorBlocks d n) + (p : (((Orthogonal N × LabeledTree depth) × (ℕ → ℝ)) × + ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a)))) : + |restrictedCanonicalHaarLog S hS C hC k e a₀ hk lam v u t cap δ B p| ≤ + (|t| *cavityFactorSize B.1 B.2.1 B.2.2+|δ|)*(1+N) := by + let E := cavityBaseGroupEquiv k e a₀ + let dims := cavityBaseGroupDimension k a₀ + let Ω := (Orthogonal N × LabeledTree depth) × (ℕ → ℝ) + let eig := diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t + let ν : Ω → Measure (Spin N × LabeledLeaf depth) := + restrictedRotationProbability S hS eig (cavitySpectralGroup (fun i => (E.symm i).1)) u + let vectors := cavityRotationVectors (depth := depth) dims E + let frames := cavityCanonicalGroupFrame k e a₀ hk + have hy (ω : Ω) (W : (a : Fin m) → Orthogonal (dims a)) (x : Spin N × LabeledLeaf depth) : + ‖cavitySelectedSiteProjection (fun j => (a₀ j,j)) (vectors ω) + (cavityGroupHaarFrames frames W) x‖^2 ≤ (N : ℝ) := by + change ‖cavitySelectedSiteProjection (fun j => (a₀ j,j)) + (cavityGroupSpinCoordinates dims E ω.1.1) (cavityGroupHaarFrames frames W) x.1‖^2 ≤ N + exact cavity_canonical_group_projection_bound k e a₀ hk ω.1.1 W x.1 + exact restrictedHaarLogObservable_bound C hC ν (fun j => (a₀ j,j)) vectors frames (fun _ => B) + t cap δ hcap (fun _ => le_rfl) hy p + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c0e80e310d5ac053b9856dfcc00a256c7156f4d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLaw.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityRotationRestrictedIntegral +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalGroupCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability +import OAI.Probability.InvariantIsing.Cavity.CavityFactorScaling + +namespace OAI + +/-! The actual canonical cutoff mean, with fixed tree, is exactly the +restricted Haar Gibbs model used in the finite-replica comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_canonical_law {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (g : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k g a))) + [IsProbabilityMeasure η] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t : ℝ) (A : CavityFactorBlocks d n) + {R M : ℝ} (hR : 0 ≤ R) (hM : 0 ≤ M) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + let E := cavityBaseGroupEquiv k e g + let eig := diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t + let K := t • A.1 + let L := t • A.2.1 + let C := t • A.2.2 + let τ := cavityFactorSize K L C * (1+R^2) + (∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability S hS eig + (cavitySpectralGroup (fun i => (E.symm i).1)) u p.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun j => (g j,j)) + (cavityRotationVectors (cavityBaseGroupDimension k g) E) + (cavityCanonicalGroupFrame k e g hk) K L C τ R (p,x)) F + ∂(((μ.prod (Measure.dirac T)).prod gaussianCoordinates).prod η)) = + restrictedCanonicalGroupCutoffMean S hS Cset hCset k e g hk μ η T lam v u t (1+R^2) A F := by + intro E eig K L C τ + let I := cavitySpectralGroup (fun i => (E.symm i).1) + let ν := restrictedRotationProbability S hS (depth := depth) eig I u + let w := cavityHaarRestrictedWeight (fun j => (g j,j)) + (cavityRotationVectors (depth := depth) (cavityBaseGroupDimension k g) E) + (cavityCanonicalGroupFrame k e g hk) K L C τ R + let κ := cavityHaarSpinPriorKernel + (U := (a : Fin m) → Orthogonal (cavityBaseGroupDimension k g a)) + ν (measurable_restrictedRotationProbability S hS eig I u) (restrictedSpinPrior Cset hCset : Measure (Spin n)) + let f := fun p => cavityWeightedReplicaMean (κ p) (fun x => w (p,x)) F + have hw : Measurable w := measurable_cavityHaarRestrictedWeight _ _ + (measurable_cavityRotationVectors _ E) _ K L C τ R + have hm : Measurable f := by + have hh := measurable_cavityRegularizedReplicaMean (fun p => κ p) κ.measurable + w hw (fun p => F p.2) ((measurable_of_countable F).comp measurable_snd) 0 + simpa only [f,cavityRegularizedReplicaMean,add_zero,cavityWeightedReplicaMean] using hh + have hb p : |f p| ≤ M := by + have hh := cavityRegularizedReplicaMean_abs_le (κ p) (fun x => w (p,x)) + (hw.comp measurable_prodMk_left) F (measurable_of_countable F) + (Real.exp_pos τ).le hM (δ := 0) le_rfl + (fun x => cavityHaarRestrictedWeight_mem _ _ _ K L C τ R (p,x)) hF + simpa only [f,cavityRegularizedReplicaMean,add_zero,cavityWeightedReplicaMean] using hh + have hs := cavity_bounded_disorder_dirac_shuffle μ T gaussianCoordinates η f hm hb + change _ = ∫ V, ∫ W, ∫ z, _ ∂gaussianCoordinates ∂η ∂μ + rw [show (∫ p, cavityWeightedReplicaMean ((ν p.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => w (p,x)) F ∂(((μ.prod (Measure.dirac T)).prod gaussianCoordinates).prod η)) = + ∫ p, f p ∂(((μ.prod (Measure.dirac T)).prod gaussianCoordinates).prod η) by + simp only [f,κ,cavityHaarSpinPriorKernel_apply]] + rw [hs] + apply integral_congr_ae + filter_upwards [] with V + apply integral_congr_ae + filter_upwards [] with W + apply integral_congr_ae + filter_upwards [restrictedRotationProbability_eq_tilted_ae S hS eig I u hu V T] with z hz + simp only [f,κ,cavityHaarSpinPriorKernel_apply] + rw [show ν ((V,T),z) = _ from hz] + congr 1 + funext x + have he := cavityRestrictedFactor_eq_indicator K L C τ hR (le_refl _) + (fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavitySelectedSiteProjection (fun j => (g j,j)) + (cavityGroupSpinCoordinates (cavityBaseGroupDimension k g) E V) + (cavityGroupHaarFrames (cavityCanonicalGroupFrame k e g hk) W) x.1.1) + Prod.snd x + change cavityRestrictedFactor K L C τ R + (cavitySelectedSiteProjection (fun j => (g j,j)) + (cavityGroupSpinCoordinates (cavityBaseGroupDimension k g) E V) + (cavityGroupHaarFrames (cavityCanonicalGroupFrame k e g hk) W) x.1.1) x.2 = _ + rw [he] + rw [cavity_radial_square_cutoff _ (fun x => norm_nonneg _) hR] + simp only [K,L,C,E,cavityLogFactor_smul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogCoefficients.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..aae39feb636e02065c894091d437defdf9102184 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogCoefficients.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalLogCoefficients +import OAI.Probability.InvariantIsing.Magnetic.RestrictedConstantHaarLog + +namespace OAI + +/-! Random coefficient replacement on the canonical physical cavity +space, with the independent compression coordinate integrated out. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology + +namespace InvariantIsing + +theorem restricted_canonical_log_coefficients {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (hN : ∀ r, 00, Tendsto (fun r => (P r).real + {z | ε + (∫ p, restrictedRandomHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap (δ r) (A r) p + ∂((P r).prod (((μ r).prod (θ r)).prod gaussianCoordinates)).prod (Measure.pi (μG r))) - + ∫ p, restrictedCanonicalHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap 0 A₁ p + ∂(((μ r).prod (θ r)).prod gaussianCoordinates).prod (Measure.pi (μG r))) atTop (𝓝 0) := by + let dims := fun r => cavityBaseGroupDimension (k r) a₀ + let E := fun r => cavityBaseGroupEquiv (k r) (e r) a₀ + let frames := fun r => cavityCanonicalGroupFrame (k r) (e r) a₀ (hk r) + let eig := fun r => diagonalPerturbedEigenvalues (fun i => lam ((E r).symm i).1) + (cavitySpectralGroup (fun i => ((E r).symm i).1)) (v r) 1 + have h := restricted_physical_penalized_log_coefficients N depth S hS C hC hN dims hgroups E μ θ μG + frames (fun r a => cavityCanonicalGroupFrame_gram (k r) (e r) a₀ (hk r) a) + eig u hc hfrac Z P A hA A₁ hD hAb hA₁ hprob (fun j => (a₀ j,j)) cap hcap δ hδ hδlim + change Tendsto (fun r => + (∫ p, restrictedRandomHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap (δ r) (A r) p + ∂((P r).prod (((μ r).prod (θ r)).prod gaussianCoordinates)).prod (Measure.pi (μG r))) - + ∫ p, restrictedRandomHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap 0 (fun _ => A₁) p + ∂((P r).prod (((μ r).prod (θ r)).prod gaussianCoordinates)).prod (Measure.pi (μG r))) + atTop (𝓝 0) at h + have he r := restricted_constant_haar_log_average (S r) (hS r) C hC (P r) (k r) (e r) a₀ (hk r) + (μ r) (θ r) (Measure.pi (μG r)) lam (v r) (u r) 1 cap 0 hcap A₁ + exact h.congr (fun r => by rw [he r]) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..aefc37f3f3190cc89b5d0f55d36e23c610526ec4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogIntegrability.lean @@ -0,0 +1,90 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFrameLogBound +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationLogMean +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorPartition +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorHaarMean + +namespace OAI + +/-! Integrability of the canonical base partition and the random-block +cavity logarithm under the product Haar law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma restricted_canonical_log_partition {N m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (t : ℝ) : + restrictedProjectorLogPartition S hS T (fun a => t*lam a+2*perturbationScale N*v a) u + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)).1 = + restrictedRotationLogMean S hS T + (diagonalPerturbedEigenvalues + (fun i => lam (Sum.elim (fun w => w.1) a₀ (e.symm i))) + (cavityBaseGroup k e a₀) v t) (cavityBaseGroup k e a₀) u V := by + rw [cavityCanonicalProjectorFrame_action_fst] + exact restricted_projector_log_partition S hS _ V T lam v u t + +lemma integrable_restricted_canonical_log_partition {N m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t : ℝ) : + Integrable (fun V => restrictedProjectorLogPartition S hS T + (fun a => t*lam a+2*perturbationScale N*v a) u + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)).1) ν := by + simp_rw [restricted_canonical_log_partition S hS k e a₀] + exact integrable_restrictedRotationLogMean S hS ν T _ _ u hu + +lemma restricted_canonical_capped_log_bound {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (A : CavityFactorBlocks d n) {D : ℝ} + (hAb : cavityFactorSize A.1 A.2.1 A.2.2 ≤ D) : + |restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ A (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀))| ≤ + (|t| *D+|δ|)*(1+N) := by + let g : Fin N → Fin m := fun i => Sum.elim (fun w => w.1) a₀ (e.symm i) + let p := cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + have hp : p.1=fun a => cavitySpectralProjector V (cavitySpectralGroup g a) := + cavityCanonicalProjectorFrame_action_fst k e a₀ V + have hFrame : p.2.transpose*p.2=1 := cavity_canonical_action_frame_gram k e a₀ V + exact restricted_projector_capped_log_bound S hS C hC g V T lam v u hu t cap δ hcap A hAb p hp hFrame + +lemma integrable_restricted_canonical_capped_log {Ω : Type*} [MeasurableSpace Ω] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (P : Measure Ω) [IsProbabilityMeasure P] + (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t cap δ : ℝ) (hcap : 0 ≤ cap) + (A : Ω → CavityFactorBlocks d n) (hA : Measurable A) {D : ℝ} + (hAb : ∀ ω, cavityFactorSize (A ω).1 (A ω).2.1 (A ω).2.2 ≤ D) : + Integrable (fun q : Ω × Orthogonal N => restrictedProjectorCappedLog S hS C hC T + (fun a => t*lam a+2*perturbationScale N*v a) u t cap δ (A q.1) + (cavityLabeledProjectorAction q.2 (cavityCanonicalProjectorFrame k e a₀))) (P.prod ν) := by + have hp : Measurable (fun q : Ω × Orthogonal N => + cavityLabeledProjectorAction q.2 (cavityCanonicalProjectorFrame k e a₀)) := + (measurable_cavityCanonicalProjectorAction k e a₀).comp measurable_snd + have hm := measurable_restrictedProjectorCappedLog S hS C hC T + (fun a => t*lam a+2*perturbationScale N*v a) u t cap δ + (fun q : Ω × Orthogonal N => A q.1) (hA.comp measurable_fst) + (fun q : Ω × Orthogonal N => + cavityLabeledProjectorAction q.2 (cavityCanonicalProjectorFrame k e a₀)) hp + apply Integrable.of_bound hm.aestronglyMeasurable ((|t| *D+|δ|)*(1+N)) + apply ae_of_all + intro q + rw [Real.norm_eq_abs] + exact restricted_canonical_capped_log_bound S hS C hC k e a₀ q.2 T lam v u hu t cap δ hcap (A q.1) (hAb q.1) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..3576395274809cb693de46ec190677812959ba86 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogLaw.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalHaarLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalCappedLog + +namespace OAI + +/-! Identification of the canonical capped logarithm with the full +original spin/leaf Gibbs probability and fresh spectral-group rotations. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + + +theorem restricted_canonical_capped_log_law {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) + [IsProbabilityMeasure η] (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (B : CavityFactorBlocks d n) : + (∫ V, restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ B (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂μ) = + ∫ p, restrictedCanonicalHaarLog S hS C hC k e a₀ hk lam v u t cap δ B p + ∂(((μ.prod (Measure.dirac T)).prod gaussianCoordinates).prod η) := by + let E := cavityBaseGroupEquiv k e a₀ + let I := cavitySpectralGroup (fun i => (E.symm i).1) + let eig := diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) I v t + let f := restrictedCanonicalHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ B + have hm := measurable_restrictedCanonicalHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ B + have hb := restrictedCanonicalHaarLog_bound (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ hcap B + have hs := cavity_bounded_disorder_dirac_shuffle μ T gaussianCoordinates η f hm hb + change _ = ∫ p, f p ∂(((μ.prod (Measure.dirac T)).prod gaussianCoordinates).prod η) + rw [hs, restricted_canonical_capped_log_group_average S hS C hC k e a₀ hk μ η T lam v u hu t cap δ hcap B] + apply integral_congr_ae + apply ae_of_all + intro V + apply integral_congr_ae + apply ae_of_all + intro W + apply integral_congr_ae + filter_upwards [restrictedRotationProbability_eq_tilted_ae S hS eig I u hu V T] with z hz + dsimp only [f, restrictedCanonicalHaarLog, restrictedHaarLogObservable, cavityRotationVectors] + rw [hz, cavity_tilt_prod_left _ _ _ (measurable_of_countable _)] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dd47f30ac3887065a53edf26f680f9e5ed4b7c4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalLogLimit.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalLogLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalHaarLog + +namespace OAI + +/-! The spectral/GG logarithmic limit in the canonical coordinates of the +physical pressure increment. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators + +namespace InvariantIsing + +theorem restricted_canonical_capped_log_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (hN : ∀ r, 0 cavityBaseGroupDimension (k r) a₀ a) atTop atTop) + (μ : (r : ℕ) → Measure (Orthogonal (N r))) [∀ r, IsProbabilityMeasure (μ r)] + (θ : (r : ℕ) → Measure (LabeledTree (depth r))) [∀ r, IsProbabilityMeasure (θ r)] + (μG : (r : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k r) a₀ a))) + [∀ r a, IsProbabilityMeasure (μG r a)] [∀ r a, (μG r a).IsMulRightInvariant] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) (u : ℕ → ℕ → ℝ) + {c : ℝ} (hc : 0 (cavityBaseGroupDimension (k r) a₀ a : ℝ)/N r) atTop (𝓝 ρ)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun r => restrictedRotationArrayLaw (S r) (hS r) (μ r) (θ r) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1)) (v r) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1)) + (u r)) atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (d₀ : Fin (m+1) → ℝ) (hd0 : ∀ j, 0≤d₀ j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ)=d₀ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0≤(x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ t, |Φ t|≤B) → + spectralOffWardResidual Q₀ ρ lam j l Φ=0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l=0) + (A : CavityFactorBlocks d n) (cap : ℝ) (hcap : 0≤cap) : + let p := spectralSpinQuantilePath Q₀ hP hn + let Qf := fun r => cavityLabeledDisorderLaw r (chainExponent (uniformCut r)) + (cavityFiniteRootCovariance ρ lam hρ hρsum a₀ (cavityStrictUniformPath p r) + (cavityStrictUniformLevels p r)) + (cavityFiniteNoiseCovariance ρ lam hρ hρsum a₀ (cavityStrictUniformPath p r) + (uniformCut r) (cavityStrictUniformLevels p r)) + let η := fun r => cavityLabeledPriorKernel r + (cavityFiniteCovariancePath ρ lam hρ hρsum a₀ (cavityStrictUniformPath p r) + (cavityStrictUniformLevels p r) r) (restrictedSpinPrior C hC) + Tendsto (fun r => + (∫ ω, restrictedCanonicalHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap 0 A ω + ∂(((μ r).prod (θ r)).prod gaussianCoordinates).prod (Measure.pi (μG r))) - + ∫ ω, Real.log (∫ x, Real.exp (min (cavityLabeledPotential r A.1 A.2.1 A.2.2 (ω,x)) cap) + ∂η r ω) ∂Qf r) atTop (𝓝 0) := by + intro p Qf η + let dims := fun r => cavityBaseGroupDimension (k r) a₀ + let E := fun r => cavityBaseGroupEquiv (k r) (e r) a₀ + let frames := fun r => cavityCanonicalGroupFrame (k r) (e r) a₀ (hk r) + let eig := fun r => diagonalPerturbedEigenvalues (fun i => lam ((E r).symm i).1) + (cavitySpectralGroup (fun i => ((E r).symm i).1)) (v r) 1 + have hinj : Function.Injective (fun j : Fin d => (a₀ j,j)) := by + intro i j hij + exact congrArg Prod.snd hij + have h := restricted_physical_capped_log_limit N depth S hS C hC hN dims hgroups hdims E μ θ μG frames + (fun r a => cavityCanonicalGroupFrame_gram (k r) (e r) a₀ (hk r) a) eig u hc hfrac + ρ lam hρ hρsum hρlim Q₀ hlim hgg hG d₀ hd0 hd hE hP hn hoff hdiag + a₀ (fun j => (a₀ j,j)) hinj (fun _ => rfl) A.1 A.2.1 A.2.2 cap hcap + simpa only [restrictedCanonicalHaarLog, restrictedHaarLogObservable, cavityHaarSpinPotential, + one_mul, zero_mul, sub_zero, dims, E, frames, eig, p, Qf, η] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalTreeLogLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalTreeLogLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..473ba6f87a9a8768ae72f6c6c8778c0843b1db5a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalTreeLogLaw.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalLogLaw +import OAI.Probability.InvariantIsing.Cavity.CavityDiracAverage + +namespace OAI + +/-! Restoring the common random cascade in the canonical capped +logarithmic identity, while retaining the original Gaussian disorder. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_canonical_tree_log_law {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) + [IsProbabilityMeasure η] (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (B : CavityFactorBlocks d n) : + (∫ T, ∫ V, restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ B (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂μ ∂θ) = + ∫ p, restrictedCanonicalHaarLog S hS C hC k e a₀ hk lam v u t cap δ B p + ∂(((μ.prod θ).prod gaussianCoordinates).prod η) := by + let f := restrictedCanonicalHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ B + have hm := measurable_restrictedCanonicalHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ B + have hb := restrictedCanonicalHaarLog_bound (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ hcap B + have hfix (T : LabeledTree depth) := + restricted_canonical_capped_log_law S hS C hC k e a₀ hk μ η T lam v u hu t cap δ hcap B + change (∫ T, ∫ V, restrictedProjectorCappedLog S hS C hC T + (fun a => t*lam a+2*perturbationScale N*v a) u t cap δ B + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂μ ∂θ) = + ∫ p, f p ∂(((μ.prod θ).prod gaussianCoordinates).prod η) + simp_rw [hfix] + exact cavity_bounded_dirac_average μ θ gaussianCoordinates η f hm hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalWeighted.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalWeighted.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bae3e4d4902e67228e8cb3a507cc0769a4fffc9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCanonicalWeighted.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityCanonicalGroupAverage +import OAI.Probability.InvariantIsing.Magnetic.RestrictedGroupedWeighted + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix +namespace InvariantIsing + +theorem restricted_canonical_weighted_average {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (g : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k g a))) + [IsProbabilityMeasure η] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t D : ℝ) (B : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) : + (∫ V, restrictedProjectorCavityMean S hS Cset hCset T + (fun a => t*lam a+2*perturbationScale N*v a) u t D B F + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e g)) ∂μ) = + let E := cavityBaseGroupEquiv k e g + let A := cavityCanonicalGroupFrame k e g hk + ∫ V, ∫ W, ∫ z, cavityWeightedReplicaMean + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted + (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t) + (cavitySpectralGroup (fun i => (E.symm i).1)) u z)).prod (restrictedSpinPrior Cset hCset)) + ({x | 1+‖cavitySelectedSiteProjection (fun j => (g j,j)) + (cavityGroupSpinCoordinates (cavityBaseGroupDimension k g) E V) + (cavityGroupHaarFrames A W) x.1.1‖^2 ≤ D}.indicator (fun x => + Real.exp (t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection (fun j => (g j,j)) + (cavityGroupSpinCoordinates (cavityBaseGroupDimension k g) E V) + (cavityGroupHaarFrames A W) x.1.1) x.2))) F ∂gaussianCoordinates ∂η ∂μ := by + simp_rw [cavityCanonicalProjectorFrame_grouped k e g hk] + exact restricted_grouped_weighted_average S hS Cset hCset (cavityBaseGroupDimension k g) + (cavityBaseGroupEquiv k e g) (fun j => (g j,j)) (cavityCanonicalGroupFrame k e g hk) + μ η T lam v u hu t D B F hM hF + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCompressionCappedLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCompressionCappedLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bdd554fe0a713b7eece0750eee302775fdb3041 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCompressionCappedLog.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalLogLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCompressionLogLimit + +namespace OAI + +/-! The actual random-compression pressure integrand converges to the +finite cascade logarithm, including its vanishing geometric penalty. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators + +namespace InvariantIsing + +theorem restricted_compression_capped_log_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (hN : ∀ r, 0 cavityBaseGroupDimension (k r) a₀ a) atTop atTop) + (μ : (r : ℕ) → Measure (Orthogonal (N r+n))) [∀ r, IsProbabilityMeasure (μ r)] + (ν : (r : ℕ) → Measure (Orthogonal (N r))) [∀ r, IsProbabilityMeasure (ν r)] + (θ : (r : ℕ) → Measure (LabeledTree (depth r))) [∀ r, IsProbabilityMeasure (θ r)] + (μG : (r : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k r) a₀ a))) + [∀ r a, IsProbabilityMeasure (μG r a)] [∀ r a, (μG r a).IsMulRightInvariant] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) (u : ℕ → ℕ → ℝ) + {c : ℝ} (hc : 0 (cavityBaseGroupDimension (k r) a₀ a : ℝ)/N r) atTop (𝓝 ρ)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun r => restrictedRotationArrayLaw (S r) (hS r) (ν r) (θ r) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1)) (v r) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1)) + (u r)) atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (d₀ : Fin (m+1) → ℝ) (hd0 : ∀ j, 0≤d₀ j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ)=d₀ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0≤(x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ t, |Φ t|≤B) → + spectralOffWardResidual Q₀ ρ lam j l Φ=0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l=0) + (A : CavityFactorBlocks d n) + (hprob : ∀ ε>0, Tendsto (fun r => (μ r).real {U | ε lam (a₀ j)) B₀ + (cavityCompressionGrams (g r) U)) A}) atTop (𝓝 0)) + (cap : ℝ) (hcap : 0≤cap) : + let AR := fun r U => cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams (g r) U) + let δ := fun r => cavityDeterministicRate n m (2*(2*n+1)) (N r)+ + 2*cavityCovarianceRate n (2*n+1) (N r) + let p := spectralSpinQuantilePath Q₀ hP hn + let Qf := fun r => cavityLabeledDisorderLaw r (chainExponent (uniformCut r)) + (cavityFiniteRootCovariance ρ lam hρ hρsum a₀ (cavityStrictUniformPath p r) + (cavityStrictUniformLevels p r)) + (cavityFiniteNoiseCovariance ρ lam hρ hρsum a₀ (cavityStrictUniformPath p r) + (uniformCut r) (cavityStrictUniformLevels p r)) + let η := fun r => cavityLabeledPriorKernel r + (cavityFiniteCovariancePath ρ lam hρ hρsum a₀ (cavityStrictUniformPath p r) + (cavityStrictUniformLevels p r) r) (restrictedSpinPrior C hC) + Tendsto (fun r => + (∫ ω, restrictedRandomHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap (δ r) (AR r) ω + ∂((μ r).prod (((ν r).prod (θ r)).prod gaussianCoordinates)).prod (Measure.pi (μG r))) - + ∫ ω, Real.log (∫ x, Real.exp (min (cavityLabeledPotential r A.1 A.2.1 A.2.2 (ω,x)) cap) + ∂η r ω) ∂Qf r) atTop (𝓝 0) := by + intro AR δ p Qf η + have hc₀ := restricted_compression_log_limit N depth S hS C hC hN hNlim g k e es B₀ a₀ hk hgroups + μ ν θ μG lam v u hc hfrac A hprob cap hcap + have hf := restricted_canonical_capped_log_limit N depth S hS C hC hN k e a₀ hk hgroups hdims + ν θ μG lam v u hc hfrac ρ hρ hρsum hρlim Q₀ hlim hgg hG d₀ hd0 hd hE hP hn + hoff hdiag A cap hcap + have ht := hc₀.add hf + simpa only [sub_add_sub_cancel, add_zero] using ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCompressionLogLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCompressionLogLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..abd2934e88a5e14bf6ead7c50bd4063aab7c209c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCompressionLogLimit.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalLogCoefficients +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionFactorBound +import OAI.Probability.InvariantIsing.Cavity.CavityActualErrorRates + +namespace OAI + +/-! The actual random compression and its explicit geometric error give +the canonical logarithm with fixed coefficients in the large-system limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology + +namespace InvariantIsing + +theorem restricted_compression_log_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (hN : ∀ r, 00, Tendsto (fun r => (μ r).real {U | ε lam (a₀ j)) B₀ + (cavityCompressionGrams (g r) U)) A₁}) atTop (𝓝 0)) + (cap : ℝ) (hcap : 0≤cap) : + let A := fun r U => cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams (g r) U) + let δ := fun r => cavityDeterministicRate n m (2*(2*n+1)) (N r)+ + 2*cavityCovarianceRate n (2*n+1) (N r) + Tendsto (fun r => + (∫ p, restrictedRandomHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap (δ r) (A r) p + ∂((μ r).prod (((ν r).prod (θ r)).prod gaussianCoordinates)).prod (Measure.pi (μG r))) - + ∫ p, restrictedCanonicalHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 cap 0 A₁ p + ∂(((ν r).prod (θ r)).prod gaussianCoordinates).prod (Measure.pi (μG r))) atTop (𝓝 0) := by + intro A δ + let D₀ := ((d : ℝ)*d+d*n+n*n)*cavityMatrixMass (cavityRepeatedSpectrum (n := n) lam)+ + cavityMatrixMass (Matrix.diagonal (fun j => lam (a₀ j))) + let D := max D₀ (cavityFactorSize A₁.1 A₁.2.1 A₁.2.2) + have hD : 0≤D := (cavityFactorSize_nonneg A₁.1 A₁.2.1 A₁.2.2).trans (le_max_right _ _) + have hA r : Measurable (A r) := + (measurable_cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀).comp + (measurable_cavityCompressionGrams (g r)) + have hAb r U : cavityFactorSize (A r U).1 (A r U).2.1 (A r U).2.2 ≤ D := + (cavity_compression_factor_size_bound (g r) es lam (fun j => lam (a₀ j)) B₀ U).trans + (le_max_left _ _) + have hδ r : 0≤δ r := by + dsimp only [δ] + have hd : 0≤cavityDeterministicRate n m (2*(2*n+1)) (N r) := by + unfold cavityDeterministicRate perturbationScale + positivity + exact add_nonneg hd (mul_nonneg (by norm_num) + (cavityCovarianceRate_nonneg n (by positivity) (N r))) + have hδlim : Tendsto δ atTop (𝓝 0) := by + have ht := ((cavityDeterministicRate_tendsto n m (2*(2*n+1))).comp hNlim).add + (((cavityCovarianceRate_tendsto n (2*n+1)).comp hNlim).const_mul 2) + simpa only [δ, Function.comp_def, mul_zero, add_zero] using ht + exact restricted_canonical_log_coefficients N depth S hS C hC hN k e a₀ hk hgroups ν θ μG lam v u + hc hfrac (fun r => Orthogonal (N r+n)) μ A hA A₁ hD hAb (le_max_right _ _) + hprob cap hcap δ hδ hδlim + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedConcentration.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedConcentration.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b254fc24d215cd9b5f54607f55b29fdcb4a68f7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedConcentration.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressure + +namespace OAI + +/-! The published SO(N) concentration input for every fixed nonempty +spin constraint, with constants independent of its cardinality. -/ + +noncomputable section +open MeasureTheory + +namespace InvariantIsing + +theorem haar_restricted_pressure_median_tail (hpub : HaarConcentrationInput) : + ∃ C c₀ : ℝ, 0 < C ∧ 0 < c₀ ∧ + ∀ N : ℕ, 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), + IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ S : Finset (Spin N), S.Nonempty → + ∀ eig c : Fin N → ℝ, ∀ K : ℝ, 0 < K → (∀ i, |eig i| ≤ K) → + ∃ m : ℝ, + (1 / 2 : ℝ) ≤ μ.real {U | restrictedRotatedPressure S eig (specialRotation U) c ≤ m} ∧ + (1 / 2 : ℝ) ≤ μ.real {U | m ≤ restrictedRotatedPressure S eig (specialRotation U) c} ∧ + ∀ r : ℝ, 0 < r → + μ.real {U | r ≤ |restrictedRotatedPressure S eig (specialRotation U) c - m|} ≤ + C * Real.exp (-c₀ * (N : ℝ) * r ^ 2 / K ^ 2) := by + obtain ⟨C, c₀, hC, hc, hp⟩ := hpub + refine ⟨C, c₀, hC, hc, ?_⟩ + intro N hN μ hμ hμinv S hS eig c K hK heig + exact hp N hN μ hμ hμinv _ (measurable_restrictedRotatedPressure S eig c) K hK + (fun U V => abs_restrictedRotatedPressure_sub_rotation_le (by omega) S hS eig U V c K hK.le heig) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedConstantHaarLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedConstantHaarLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c457284f59510cb059f4617c6c2d5af83278e53 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedConstantHaarLog.lean @@ -0,0 +1,42 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRandomHaarLog +import OAI.Probability.InvariantIsing.Cavity.CavityExtraLogAverage + +namespace OAI + +/-! An independent compression coordinate disappears once its coefficient +has been replaced by the deterministic limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma restricted_constant_haar_log_average {Z : Type*} [MeasurableSpace Z] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (P : Measure Z) [IsProbabilityMeasure P] + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) + [IsProbabilityMeasure η] (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (A : CavityFactorBlocks d n) : + (∫ p, restrictedRandomHaarLog S hS C hC k e a₀ hk lam v u t cap δ (fun _ : Z => A) p + ∂(P.prod ((μ.prod θ).prod gaussianCoordinates)).prod η) = + ∫ p, restrictedCanonicalHaarLog S hS C hC k e a₀ hk lam v u t cap δ A p + ∂((μ.prod θ).prod gaussianCoordinates).prod η := by + let F := restrictedRandomHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ (fun _ : Z => A) + have hF : Measurable F := + measurable_restrictedRandomHaarLog S hS C hC k e a₀ hk lam v u t cap δ _ measurable_const + have hb p : |F p| ≤ (|t| * cavityFactorSize A.1 A.2.1 A.2.2+|δ|)*(1+N) := + restrictedRandomHaarLog_bound S hS C hC k e a₀ hk lam v u t cap δ hcap _ (fun _ => le_rfl) p + rw [cavity_bounded_extra_product_integral P ((μ.prod θ).prod gaussianCoordinates) η F hF hb] + change (∫ _ : Z, (∫ p, restrictedCanonicalHaarLog S hS C hC k e a₀ hk lam v u t cap δ A p + ∂((μ.prod θ).prod gaussianCoordinates).prod η) ∂P) = _ + simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCoordinateAverage.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCoordinateAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..07197f558100389d534b4df169ec6e1d8f6bad8d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCoordinateAverage.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCoordinateOverlap + +namespace OAI + +/-! Averaging the physical coordinate identities yields the exact block test. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +lemma restricted_block_test_eq_average {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : OverlapPath) (Φ : ℝ →ᵇ ℝ) : + (∫ t, Φ (q t) * restrictedBlockOverlapPath hN S hS h t ∂pathMeasure) = + (N : ℝ)⁻¹ * ∑ j, ∫ t, + Φ (q t) * restrictedCoordinateOverlapPath hN S hS h j t ∂pathMeasure := by + have hi (j : Fin N) : Integrable + (fun t => Φ (q t) * restrictedCoordinateOverlapPath hN S hS h j t) pathMeasure := by + let p := restrictedCoordinateOverlapPath hN S hS h j + apply integrable_of_measurable_abs_le + ((Φ.continuous.measurable.comp q.measurable).mul p.measurable) + intro t + change |Φ (q t) * p t| ≤ ‖Φ‖ + rw [abs_mul, abs_of_nonneg (p.nonneg t)] + exact (mul_le_mul_of_nonneg_left (p.le_one t) (abs_nonneg _)).trans + (by simpa only [mul_one, Real.norm_eq_abs] using Φ.norm_coe_le_norm (q t)) + simp_rw [restrictedBlockOverlapPath_eq_average hN S hS h] + conv_lhs => arg 2; ext t; rw [mul_left_comm, Finset.mul_sum] + rw [integral_const_mul, integral_finsetSum _ (fun j _ => hi j)] + +theorem restricted_coordinate_averages_tendsto {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : ℕ → FieldStep) + (q : ℕ → OverlapPath) (Φ : ℝ →ᵇ ℝ) (v : ℕ → Fin N → ℝ) + (hcoord : ∀ j, Tendsto (fun r => v r j - ∫ t, + Φ (q r t) * restrictedCoordinateOverlapPath hN S hS (h r) j t ∂pathMeasure) + atTop (𝓝 0)) : + Tendsto (fun r => (N : ℝ)⁻¹ * ∑ j, v r j - + ∫ t, Φ (q r t) * restrictedBlockOverlapPath hN S hS (h r) t ∂pathMeasure) + atTop (𝓝 0) := by + have hs := (tendsto_finsetSum Finset.univ (fun j _ => hcoord j)).const_mul (N : ℝ)⁻¹ + simp only [Finset.sum_const_zero, mul_zero] at hs + convert hs using 1 + funext r + rw [restricted_block_test_eq_average, Finset.sum_sub_distrib] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCoordinateOverlap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCoordinateOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..b27187febc62f3cda5b6011a7f9e6787ba753f5c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCoordinateOverlap.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockOverlap + +namespace OAI + +/-! Coordinate overlap paths for the actual constrained scalar-field law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators NNReal + +namespace InvariantIsing + +def restrictedCoordinatePairMean {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (j : Fin N) (i : Fin (h.depth+1)) : ℝ := + ∫ z, restrictedPairCoordinateMean hN S hS h.depth (chainExponent h.cut) (fieldStepVariance h) + (fun l hl => ((chainExponent_admissible h.ordered_cut h.first h.last).1 l hl).1) i j z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ)) + +lemma restrictedCoordinatePairMean_mem_unit {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (j : Fin N) + (i : Fin (h.depth+1)) : restrictedCoordinatePairMean hN S hS h j i ∈ Icc (0 : ℝ) 1 := by + constructor + · exact integral_nonneg (fun z => restrictedPairCoordinateMean_nonneg hN S hS _ _ _ _ i j z) + · calc + _ ≤ ∫ _z, (1 : ℝ) ∂(vectorGaussianLaw N + (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ)) := + integral_mono (integrable_restrictedPairCoordinateMean hN S hS _ _ _ _ i j _) + (integrable_const _) (fun z => (le_abs_self _).trans + (restrictedPairCoordinateMean_bound hN S hS _ _ _ _ i j z)) + _ = 1 := by simp + +lemma restrictedCoordinatePairMean_monotone {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (j : Fin N) : + Monotone (restrictedCoordinatePairMean hN S hS h j) := by + intro i k hik + exact integral_mono (integrable_restrictedPairCoordinateMean hN S hS _ _ _ _ i j _) + (integrable_restrictedPairCoordinateMean hN S hS _ _ _ _ k j _) + (fun z => restrictedPairCoordinateMean_monotone hN S hS _ _ _ _ j z hik) + +def restrictedCoordinateOverlapPath {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (j : Fin N) : OverlapPath := + fieldLevelPath h (restrictedCoordinatePairMean hN S hS h j) + (restrictedCoordinatePairMean_monotone hN S hS h j) + (restrictedCoordinatePairMean_mem_unit hN S hS h j) + +lemma restrictedBlockOverlapPath_eq_average {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (t : ℝ) : + restrictedBlockOverlapPath hN S hS h t = + (N : ℝ)⁻¹ * ∑ j, restrictedCoordinateOverlapPath hN S hS h j t := by + change restrictedBlockPairMean hN S hS h (fun _ => 0) (fieldLevelIndex h t) = _ + rw [restrictedBlockPairMean_eq_average] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCubeIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCubeIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3b0a3838ac43d8305191bd7124715f920c8566e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCubeIncrement.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreePressureIncrement + +namespace OAI + +/-! The physical constrained increment includes the original cube masses +of the base and cavity slices. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_tree_cube_increment {N n m d depth : ℕ} (hN : 0 cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams g U) + let q := fun V => cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + let c := fun a => t*lam a+2*perturbationScale N*v a + let δ := cavityDeterministicRate n m (2*(2*n+1)) N+ + 2*cavityCovarianceRate n (2*n+1) N + let I₀ := cavityBaseGroup k e a₀ + let eig₀ := diagonalPerturbedEigenvalues + (fun i => lam (Sum.elim (fun w => w.1) a₀ (e.symm i))) I₀ v t + let I := cavitySpectralGroup g + let eig := diagonalPerturbedEigenvalues (fun i => lam (g i)) I v t + (∫ T, ∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) + ∂μ.prod ν ∂θ) + (Real.log C.card - n * Real.log 2) ≤ + ((∫ z, restrictedRotationLogMean (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) z.2 eig I u z.1 ∂μ.prod θ) + + (Real.log (cavityProductSlice S C).card - (N+n) * Real.log 2)) - + ((∫ z, restrictedRotationLogMean S hS z.2 eig₀ I₀ u z.1 ∂ν.prod θ) + + (Real.log S.card - N * Real.log 2)) := by + intro A q c δ I₀ eig₀ I eig + have h := restricted_tree_pressure_capped_increment hN S hS C hC g k ek e es B₀ a₀ l r + hg hln hr μ ν θ lam v hv u hu t cap hcap + change (∫ T, ∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) + ∂μ.prod ν ∂θ) ≤ + (∫ z, restrictedRotationLogMean (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) z.2 eig I u z.1 ∂μ.prod θ) - + ∫ z, restrictedRotationLogMean S hS z.2 eig₀ I₀ u z.1 ∂ν.prod θ at h + rw [cavityProductSlice_log_mass S hS C hC] + linarith only [h] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCutoffMap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCutoffMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..60e4df8f887fbe8a52e2c008328a6e8cc6544834 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedCutoffMap.lean @@ -0,0 +1,34 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffMap +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProductPrior + +namespace OAI + +/-! Cutoffs commute with the constrained spin product decomposition. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +theorem restricted_spin_cutoff_split {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (T : LabeledTree depth) (H : (Spin N × Spin n) × LabeledLeaf depth → ℝ) + (s : Set ((Spin N × Spin n) × LabeledLeaf depth)) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T) + (fun x => H (cavitySpinSplit N n x.1,x.2)) + {x | (cavitySpinSplit N n x.1,x.2) ∈ s} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) = + cavityCutoffReplicaMean + (((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T)) H s F := + cavity_cutoff_replica_map _ _ _ ((restricted_cavity_spin_split_prior S hS C hC).prod + (MeasurePreserving.id (labeledLeafLaw depth T))) H s F + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDepthPair.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDepthPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..55cf7ad900f01efdf8881c293d286ff953b6859a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDepthPair.lean @@ -0,0 +1,112 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinEvaluation +import OAI.Probability.InvariantIsing.Fields.FieldDepthPair + +namespace OAI + +/-! Preservation of the common-level law by the published finite-field +terminal tilt, including the independent scalar-field spins. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma restricted_leaf_depth_pair_conditioning {N n : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (Y : LabeledLeaf n → Fin N → ℝ) + (he : Integrable (fun p : Spin N × LabeledLeaf n => Real.exp (fieldEnergy (Y p.2) p.1)) + ((restrictedSpinPrior S hS : Measure (Spin N)).prod ν)) + (ψ : ℕ → ℝ) {C : ℝ} (hψ : ∀ d, |ψ d| ≤ C) : + referenceReplicaMean ((restrictedSpinPrior S hS : Measure (Spin N)).prod ν) + (fun p => fieldEnergy (Y p.2) p.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf n => ψ (labeledCommonDepth n (σ 0).2 (σ 1).2)) = + referenceReplicaMean ν (fun α => restrictedFieldTerminal S (Y α)) + (fun α : Fin 2 → LabeledLeaf n => ψ (labeledCommonDepth n (α 0) (α 1))) := by + let μ : Measure (Spin N) := restrictedSpinPrior S hS + let H := fun p : Spin N × LabeledLeaf n => fieldEnergy (Y p.2) p.1 + let T := priorSpinLeafTerminal μ H + let c := Real.log S.card - N * Real.log 2 + have ht : (fun α => T α + c) = (fun α => restrictedFieldTerminal S (Y α)) := by + funext α + change finiteLogIntegral μ (fieldEnergy (Y α)) + c = _ + rw [show μ = (restrictedSpinPrior S hS : Measure (Spin N)) from rfl, + finiteLogIntegral_restrictedSpinPrior] + dsimp only [c, restrictedFieldTerminal] + ring + have hi := priorSpinLeafTerminal_exp_integrable μ ν H he + rw [priorSpinLeafPair_conditioning μ ν H he _ ⟨C, fun σ => hψ _⟩] + have hc := referenceReplicaMean_add_constant ν T hi c + (fun α : Fin 2 → LabeledLeaf n => ψ (labeledCommonDepth n (α 0) (α 1))) + rw [ht] at hc + rw [hc] + congr 1 + funext α + change (∫ _ : Fin 2 → Spin N, ψ (labeledCommonDepth n (α 0) (α 1)) ∂_) = _ + simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] + +lemma restricted_published_depth_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (hN : 0 < N) (h : FieldStep) (ψ : ℕ → ℝ) + {C : ℝ} (hψ : ∀ d, |ψ d| ≤ C) (z : Fin N → ℝ) : + restrictedFieldTiltedPairMean S h z (fun p => ψ p.1) = + ∫ s, ψ (fieldLevelIndex h s).val ∂pathMeasure := by + have hm : Measurable (fun p : ℕ × ((Fin N → ℝ) × (Fin N → ℝ)) => ψ p.1) := + (measurable_of_countable ψ).comp measurable_fst + rw [hpub N hN S hS h z (fun p => ψ p.1) hm ⟨C, fun p => hψ p.1⟩] + simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] + exact fieldCommonLevel_integral h (fun i => ψ i.val) + +def restrictedFieldDepthPairIntegrand {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) (ψ : ℕ → ℝ) : ℝ := + referenceReplicaMean + ((restrictedSpinPrior S hS : Measure (Spin N)).prod (labeledLeafLaw h.depth p.1)) + (fun s : Spin N × LabeledLeaf h.depth => fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf h.depth => + ψ (labeledCommonDepth h.depth (σ 0).2 (σ 1).2)) + +def restrictedFieldDepthPairMean {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (z : Fin N → ℝ) (ψ : ℕ → ℝ) : ℝ := + ∫ p, restrictedFieldDepthPairIntegrand S hS h z p ψ ∂fieldVectorCoordinateLaw N h + +lemma measurable_restrictedFieldDepthPairIntegrand {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (ψ : ℕ → ℝ) : + Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + restrictedFieldDepthPairIntegrand S hS h p.1 p.2 ψ) := by + let D : (Fin 2 → Spin N × LabeledLeaf h.depth) → ℝ := fun σ => + ψ (labeledCommonDepth h.depth (σ 0).2 (σ 1).2) + have hm := measurable_cascadeCoordinateReplicaMean h.depth + (restrictedSpinPrior S hS : Measure (Spin N)) (measurable_fieldEnergy_map N) D + have hc : Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + (p.1, fieldEnergyCoordinates N h p.2)) := + measurable_fst.prodMk ((measurable_fieldEnergyCoordinates N h).comp measurable_snd) + have he (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : + cascadeCoordinateEnergy h.depth (fieldEnergy z) (fieldEnergyCoordinates N h p) = + fun s => fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1 := + funext (fieldEnergyCoordinates_energy N h p z) + have hh := hm.comp hc + simp only [Function.comp_def] at hh + simp_rw [he] at hh + simpa only [labeledSpinReference, fieldEnergyCoordinates, restrictedFieldDepthPairIntegrand, D] using hh + +lemma measurable_restrictedFieldDepthPairMean {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (ψ : ℕ → ℝ) : + Measurable (fun z => restrictedFieldDepthPairMean S hS h z ψ) := + (measurable_restrictedFieldDepthPairIntegrand S hS h ψ).stronglyMeasurable.integral_prod_right'.measurable + +theorem restricted_field_depth_pair_evaluation (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (hN : 0 < N) (h : FieldStep) (ψ : ℕ → ℝ) + {C : ℝ} (hψ : ∀ d, |ψ d| ≤ C) (z : Fin N → ℝ) : + restrictedFieldDepthPairMean S hS h z ψ = ∫ s, ψ (fieldLevelIndex h s).val ∂pathMeasure := by + rw [← restricted_published_depth_test hpub S hS hN h ψ hψ z] + unfold restrictedFieldDepthPairMean restrictedFieldTiltedPairMean + apply integral_congr_ae + filter_upwards [restricted_field_vector_spin_exp_integrable hN S hS h z] with p hp + exact restricted_leaf_depth_pair_conditioning S hS (labeledLeafLaw h.depth p.1) + (fieldVectorEndpoint N h p z) hp ψ hψ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDepthTestEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDepthTestEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0a757a7907e89f52130abbb3ecea3e6369defec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDepthTestEvaluation.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Cavity.CavitySpinTestEvaluation +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLinearNoiseDepth + +namespace OAI + +/-! The quadratic cavity tilt preserves the common-level distribution. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator NNReal + +namespace InvariantIsing + +theorem restricted_cavity_full_depth_test_evaluation (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (K : Matrix (Fin d) (Fin d) ℝ) (H S : ℕ → Matrix (Fin d) (Fin d) ℝ) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (c : ℝ) + (hK : K.transpose = K) (hH : ∀ i, (H i).transpose = H i) + (hS : ∀ i, (S i).PosSemidef) + (hb : ∀ i, 0 < chainExponent h.cut i) + (hdet : ∀ i, IsUnit (1 - H i * K).det) + (hΔ : ∀ i, H i - H (i + 1) = chainExponent h.cut i • S i) + (hQ : ∀ i, (cavityFactorPrecision + (chainExponent h.cut i • cavityBackwardQuadratic K (H (i + 1))) + (CFC.sqrt (S i))).PosDef) + (hR : (H h.depth).PosSemidef) + (hQR : (cavityFactorPrecision K (CFC.sqrt (H h.depth))).PosDef) + (hAtom : ∀ i < h.depth, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (v : ℝ≥0) + (hcov : ∀ i < h.depth, + L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = + (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * cavityResolvent K (H h.depth) * L = (v : ℝ) • 1) + (ψ : ℕ → ℝ) + {B : ℝ} (hψ : ∀ i, |ψ i| ≤ B) : + (∫ σ, cavityRootedDepthTest ψ σ + ∂((probabilityReplicaKernel + (cavityRootedFullGibbs h.depth K (H h.depth) L (c • 1) (restrictedSpinPrior T hT)) + (cavityRootedFullGibbs h.depth K (H h.depth) L (c • 1) (restrictedSpinPrior T hT)).measurable) + ∘ₘ (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _))) = + ∫ t, ψ (fieldLevelIndex h t).val ∂pathMeasure := by + let b := chainExponent h.cut + let S' := fun i => (1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose + let S₀' := (1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose + let R := cavityResolvent K (H h.depth) + have hbC := chainExponent_admissible h.ordered_cut h.first h.last + have hS' (i : ℕ) : (S' i).PosSemidef := + cavity_innovation_covariance_posSemidef K (H i) (H (i + 1)) (S i) (hS i) + (b i) (hdet i) (hdet (i + 1)) (hΔ i) (hQ i) + have hR' : R.PosSemidef := cavity_tilt_covariance_posSemidef K (H h.depth) hR hQR + have hAtom' (i : ℕ) (hi : i < h.depth) : + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S' i)) := by + let := hAtom i hi + exact cavity_quadratic_innovation_nullSingleton K (H i) (H (i + 1)) (S i) + hK (hH (i + 1)) (hS i) (b i) (hb i) (hdet i) (hdet (i + 1)) (hΔ i) (hQ i) + rw [cavity_rooted_depth_test_transport h.depth K H S b S₀ hS₀ L (c • 1) + hbC hK hH hS hb hdet hΔ hQ hR hQR (restrictedSpinPrior T hT)] + rw [cavity_rooted_depth_test_product_disintegration h.depth 0 R L (c • 1) + (restrictedSpinPrior T hT) (multivariateGaussian 0 S₀') + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth b (cavityGaussianMarks S') : Measure _) + ψ hψ] + trans (∫ _s : EuclideanSpace ℝ (Fin d), (∫ t, ψ (fieldLevelIndex h t).val ∂pathMeasure) + ∂multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀') + · apply integral_congr_ae + exact ae_of_all _ (fun s => restricted_cavity_linear_rooted_depth_evaluation hpub hk T hT h S' hS' hAtom' R hR' + L v hcov hres c s ψ hψ) + · simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDisorderTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDisorderTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2e98a5777613ece97c27eaadda15211af22c9eb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedDisorderTest.lean @@ -0,0 +1,142 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityDisorderMean +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarSymmetry + +namespace OAI + +/-! Disorder-dependent bounded tests, used for physical spectral +projections before any restriction of the Gibbs probability. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma measurable_restrictedCavityFullDisorderInner {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hFm : Measurable (Function.uncurry F)) : + Measurable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => referenceReplicaMean + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (fun x => rotatedEnergy eig (specialRotation p.1) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation p.1) I u depth x) p.2) + (F p.1)) := by + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let : IsProbabilityMeasure ν := inferInstanceAs + (IsProbabilityMeasure (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T)) + let H : (SpecialOrthogonal N × (ℕ → ℝ)) × (Spin N × LabeledLeaf depth) → ℝ := + fun z => rotatedEnergy eig (specialRotation z.1.1) z.2.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation z.1.1) I u depth z.2) z.1.2 + have hmH : Measurable H := by + apply measurable_from_prod_countable_left + intro x + have hr : Measurable (fun U : SpecialOrthogonal N => rotatedEnergy eig (specialRotation U) x.1) := by + unfold rotatedEnergy + exact (Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).pow_const 2).const_mul (eig i)).const_mul _ + exact (hr.comp measurable_fst).add (measurable_cavityPerturbationField I u x) + change Measurable (fun p => referenceReplicaMean ν (fun x => H (p, x)) (F p.1)) + exact measurable_referenceReplicaMean ν (H := H) (D := fun z => F z.1.1 z.2) + hmH (hFm.comp (measurable_fst.fst.prodMk measurable_snd)) + +theorem restricted_full_disorder_site_symmetry {N m depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [μ.IsMulRightInvariant] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (p : Equiv.Perm (Fin N)) + (hinv : ∀ σ, cavitySignedSpinPermutation p (cavityPermutationFlip hN p) σ ∈ S ↔ σ ∈ S) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hFm : Measurable (Function.uncurry F)) {B : ℝ} + (hB : 0 ≤ B) (hF : ∀ U σ, |F U σ| ≤ B) : + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + (∫ U, ∫ g, referenceReplicaMean ν + (fun x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + (F U) ∂gaussianCoordinates ∂μ) = + ∫ U, ∫ g, referenceReplicaMean ν + (fun x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + (fun σ => F (U * (spectralPermutation hN p)⁻¹) (fun i => + (cavitySignedSpinPermutation p (cavityPermutationFlip hN p) (σ i).1, (σ i).2))) + ∂gaussianCoordinates ∂μ := by + dsimp only + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let e := cavitySignedSpinPermutation p (cavityPermutationFlip hN p) + let H := fun (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf depth) => + rotatedEnergy eig (specialRotation U) x.1 + let C := fun (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf depth) => + cavityPerturbationCoefficients (specialRotation U) I u depth x + have hmean : Measurable (fun U => ∫ g, referenceReplicaMean ν + (fun x => H U x + cylinderField (C U x) g) (F U) ∂gaussianCoordinates) := + (measurable_restrictedCavityFullDisorderInner S hS T eig I u F hFm).stronglyMeasurable.integral_prod_right'.measurable + apply cavity_twoReplica_disorder_symmetry μ + (fun U => U * (spectralPermutation hN p)⁻¹) + (measurePreserving_mul_right μ _) ν (fun x => (e x.1, x.2)) + (restricted_labeled_spin_reference_equiv S hS T e hinv) H C + (fun U => ∑ σ : Spin N, |rotatedEnergy eig (specialRotation U) σ|) + (fun _ => 4 * (N * perturbationScale N ^ 2)) + · intro U x + exact Finset.single_le_sum (f := fun σ : Spin N => + |rotatedEnergy eig (specialRotation U) σ|) (fun _ _ => abs_nonneg _) + (Finset.mem_univ x.1) + · intro U x + exact cavityPerturbationCoefficients_sq_le _ I u hu x + · intro U x + exact rotatedEnergy_cavityPermutation hN p eig U x.1 + · intro U x y + simp only [C, e, cavityPerturbationCoefficients_cross, cavityWeightedKernel, + cavityPerturbationKernel, projectedOverlap_cavityPermutation] + · exact hB + · exact hF + · exact hmean.aestronglyMeasurable + +def restrictedCavityFullDisorderTest {N m depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (μ : Measure (SpecialOrthogonal N)) + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) : ℝ := + ∫ U, ∫ g, referenceReplicaMean + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (fun x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + (F U) ∂gaussianCoordinates ∂μ + +lemma restrictedCavityFullDisorderTest_abs_le {N m depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hFm : Measurable (Function.uncurry F)) {B : ℝ} + (hB : 0 ≤ B) (hF : ∀ U σ, |F U σ| ≤ B) : + |restrictedCavityFullDisorderTest S hS μ T eig I u F| ≤ B := by + exact cavity_nested_disorder_abs_le μ gaussianCoordinates + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (fun U g x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + F (fun _ => measurable_of_countable _) + (measurable_restrictedCavityFullDisorderInner S hS T eig I u F hFm) hB hF + +lemma restrictedCavityFullDisorderTest_sum {N m depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) {ι : Type*} [Fintype ι] + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : ι → SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hmF : ∀ i, Measurable (Function.uncurry (F i))) + {B : ℝ} (hB : 0 ≤ B) (hF : ∀ i U σ, |F i U σ| ≤ B) : + restrictedCavityFullDisorderTest S hS μ T eig I u (fun U σ => ∑ i, F i U σ) = + ∑ i, restrictedCavityFullDisorderTest S hS μ T eig I u (F i) := by + exact cavity_nested_disorder_replica_sum μ gaussianCoordinates + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (fun U g x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + F (fun _ _ => measurable_of_countable _) + (fun i => measurable_restrictedCavityFullDisorderInner S hS T eig I u (F i) (hmF i)) hB hF + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEndpointKernel.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEndpointKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..b31c449c21dbd0ee0703bf438b4f2f3971e236a0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEndpointKernel.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairSpinKernel +import Mathlib.Probability.Kernel.Composition.KernelLemmas + +namespace OAI + +/-! Actual constrained Gaussian endpoint kernels. Sampling terminal +constrained spins commutes with the shared-prefix construction. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def restrictedTailEndpointKernel {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) : + (n : ℕ) → (b : ℕ → ℝ) → (v : ℕ → ℝ≥0) → (∀ i < n, 0 < b i) → + Kernel (Fin N → ℝ) (Fin N → ℝ) + | 0, _, _, _ => Kernel.id + | n + 1, b, v, hb => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + let hbs := fun i hi => hb (i + 1) (by omega) + let hreg := restrictedFieldRecursion_regular hN S hS n bs vs hbs + restrictedTailEndpointKernel hN S hS n bs vs hbs ∘ₖ + vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) hreg.1 + +instance restrictedTailEndpointKernel_markov {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) : IsMarkovKernel (restrictedTailEndpointKernel hN S hS n b v hb) := by + induction n generalizing b v with + | zero => change IsMarkovKernel Kernel.id; infer_instance + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + let _ := ih bs vs hbs + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +lemma restrictedTailSpinKernel_endpoint {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) : + restrictedTailSpinKernel hN S hS n b v hb = + restrictedSpinKernel S ∘ₖ restrictedTailEndpointKernel hN S hS n b v hb := by + let _ := restrictedSpinKernel_markov S hS + induction n generalizing b v with + | zero => simp only [restrictedTailSpinKernel, restrictedTailEndpointKernel, Kernel.comp_id] + | succ n ih => + simp only [restrictedTailSpinKernel, restrictedTailEndpointKernel] + rw [ih, Kernel.comp_assoc] + +def restrictedPairEndpointKernel {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) : + (n : ℕ) → (b : ℕ → ℝ) → (v : ℕ → ℝ≥0) → (∀ i < n, 0 < b i) → Fin (n + 1) → + Kernel (Fin N → ℝ) ((Fin N → ℝ) × (Fin N → ℝ)) + | 0, _, _, _, _ => Kernel.id ×ₖ Kernel.id + | n + 1, b, v, hb, i => + let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + let hbs := fun j hj => hb (j + 1) (by omega) + let hreg := restrictedFieldRecursion_regular hN S hS n bs vs hbs + Fin.cases (restrictedTailEndpointKernel hN S hS (n + 1) b v hb ×ₖ + restrictedTailEndpointKernel hN S hS (n + 1) b v hb) + (fun j => restrictedPairEndpointKernel hN S hS n bs vs hbs j ∘ₖ + vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) hreg.1) i + +instance restrictedPairEndpointKernel_markov {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (i : Fin (n + 1)) : + IsMarkovKernel (restrictedPairEndpointKernel hN S hS n b v hb i) := by + induction n generalizing b v with + | zero => change IsMarkovKernel (Kernel.id ×ₖ Kernel.id); infer_instance + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) i + · change IsMarkovKernel (_ ×ₖ _) + infer_instance + · let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + have hbs : ∀ j < n, 0 < bs j := fun j hj => hb (j + 1) (by omega) + let _ := ih bs vs hbs j + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +lemma restrictedPairSpinKernel_endpoint {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (i : Fin (n + 1)) : + restrictedPairSpinKernel hN S hS n b v hb i = + (restrictedSpinKernel S ∥ₖ restrictedSpinKernel S) ∘ₖ + restrictedPairEndpointKernel hN S hS n b v hb i := by + let _ := restrictedSpinKernel_markov S hS + induction n generalizing b v with + | zero => + simp only [restrictedPairSpinKernel, restrictedPairEndpointKernel, + Kernel.parallelComp_comp_prod, Kernel.comp_id] + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) i + · simp only [restrictedPairSpinKernel, restrictedPairEndpointKernel, Fin.cases_zero, + Kernel.parallelComp_comp_prod, restrictedTailSpinKernel_endpoint] + · simp only [restrictedPairSpinKernel, restrictedPairEndpointKernel, Fin.cases_succ] + rw [ih, Kernel.comp_assoc] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEndpointTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEndpointTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..1581ce323b0a02d1764b04db67356a0af9fc7393 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEndpointTest.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldPublishedInput +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairRecursion +import OAI.Probability.InvariantIsing.Fields.FieldPublishedEvaluation + +namespace OAI + +/-! Coordinate spin tests of the constrained endpoint law. These are +consequences of the published marking input and the actual spin kernels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def restrictedTerminalPairMean {N : ℕ} (S : Finset (Spin N)) (j : Fin N) + (y : (Fin N → ℝ) × (Fin N → ℝ)) : ℝ := + ∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) + ∂(restrictedSpinKernel S ∥ₖ restrictedSpinKernel S) y + +lemma measurable_restrictedTerminalPairMean {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (j : Fin N) : Measurable (restrictedTerminalPairMean S j) := by + let _ := restrictedSpinKernel_markov S hS + have hm : Measurable (fun p : ((Fin N → ℝ) × (Fin N → ℝ)) × (Spin N × Spin N) => + spinValue (p.2.1 j) * spinValue (p.2.2 j)) := + (measurable_of_finite (fun σ : Spin N × Spin N => spinValue (σ.1 j) * spinValue (σ.2 j))).comp measurable_snd + exact (hm.stronglyMeasurable.integral_kernel_prod_right' + (κ := restrictedSpinKernel S ∥ₖ restrictedSpinKernel S)).measurable + +lemma restrictedTerminalPairMean_bound {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (j : Fin N) (y : (Fin N → ℝ) × (Fin N → ℝ)) : |restrictedTerminalPairMean S j y| ≤ 1 := by + let _ := restrictedSpinKernel_markov S hS + have he := norm_integral_le_of_norm_le_const (C := (1 : ℝ)) + (μ := (restrictedSpinKernel S ∥ₖ restrictedSpinKernel S) y) + (f := fun σ => spinValue (σ.1 j) * spinValue (σ.2 j)) + (Filter.Eventually.of_forall (fun σ => by + simp only [Real.norm_eq_abs, abs_mul, abs_spinValue, mul_one, le_refl])) + simpa only [restrictedTerminalPairMean, Real.norm_eq_abs, measureReal_def, + measure_univ, ENNReal.toReal_one, mul_one] using he + +lemma restrictedPairCoordinateMean_endpoint {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (i : Fin (n + 1)) (j : Fin N) (z : Fin N → ℝ) : + restrictedPairCoordinateMean hN S hS n b v hb i j z = + ∫ y, restrictedTerminalPairMean S j y ∂restrictedPairEndpointKernel hN S hS n b v hb i z := by + let _ := restrictedSpinKernel_markov S hS + rw [restrictedPairCoordinateMean, restrictedPairSpinKernel_endpoint, + Kernel.integral_comp (Integrable.of_finite)] + rfl + +def restrictedEndpointCoordinateTest {N : ℕ} (S : Finset (Spin N)) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + (p : ℕ × ((Fin N → ℝ) × (Fin N → ℝ))) : ℝ := + Φ (q (fieldDepthLevel h p.1)) * restrictedTerminalPairMean S j p.2 + +lemma measurable_restrictedEndpointCoordinateTest {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + Measurable (restrictedEndpointCoordinateTest S h q Φ j) := + ((measurable_of_countable (fun d => Φ (q (fieldDepthLevel h d)))).comp measurable_fst).mul + ((measurable_restrictedTerminalPairMean S hS j).comp measurable_snd) + +lemma restrictedEndpointCoordinateTest_bound {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) + (p : ℕ × ((Fin N → ℝ) × (Fin N → ℝ))) : + |restrictedEndpointCoordinateTest S h q Φ j p| ≤ C := by + rw [restrictedEndpointCoordinateTest, abs_mul] + exact (mul_le_mul_of_nonneg_left (restrictedTerminalPairMean_bound S hS j p.2) + (abs_nonneg _)).trans (by simpa only [mul_one] using hΦ _) + +theorem restricted_field_published_coordinate_test + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) (z : Fin N → ℝ) : + restrictedFieldTiltedPairMean S h z (restrictedEndpointCoordinateTest S h q Φ j) = + ∫ α : ℕ → LabeledLeaf h.depth, + Φ (q (fieldCommonLevel h α)) * restrictedPairCoordinateMean hN S hS h.depth + (chainExponent h.cut) (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldCommonLevel h α) j z + ∂cascadeReplicaLaw h.depth (chainExponent h.cut) := by + rw [hpub N hN S hS h z _ (measurable_restrictedEndpointCoordinateTest S hS h q Φ j) + ⟨C, restrictedEndpointCoordinateTest_bound S hS h q Φ j hΦ⟩] + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun α => by + have hc : fieldDepthLevel h (fieldCommonLevel h α).val = fieldCommonLevel h α := by + apply Fin.ext + exact min_eq_left (Nat.le_of_lt_succ (fieldCommonLevel h α).isLt) + simp only [restrictedEndpointCoordinateTest, hc, integral_const_mul, + restrictedPairCoordinateMean_endpoint]) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEnvelopeLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEnvelopeLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..89d99ad1b5aab1d5f8fe97be4138a02e07509f7e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedEnvelopeLower.lean @@ -0,0 +1,104 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedMinimumPressure +import OAI.Probability.InvariantIsing.Fields.PriorMinimumIncrement +import OAI.Probability.InvariantIsing.Cavity.CavityEnvelopeTelescoping +import OAI.Probability.InvariantIsing.Cavity.CavityPenaltyRate + +namespace OAI + +/-! The cavity increment lower bound passes through actual minimizing +pressure envelopes to the ordinary Haar pressure on an arithmetic progression. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology + +namespace InvariantIsing + +theorem restricted_envelope_pressure_lower + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (m N₀ n : ℕ) (hN₀ : 3≤N₀) (hn : 0 0) (u N) (v N) ≤ + priorPerturbationObjective (μ N) (restrictedZeroTreePrior (S N) (hS N)) (eig N) (c N) (I N) 1 (fun _ => 0) u' v') + (L : ℝ) + (hlower : ∀ ε>0, ∀ᶠ r in atTop, + let N := N₀+n*r + L-ε ≤ ((N+n : ℝ)*priorPerturbationPressureMean (μ (N+n)) + (restrictedZeroTreePrior (S (N+n)) (hS (N+n))) (eig (N+n)) (c (N+n)) + (I (N+n)) 1 (fun _ => 0) (fun j => cavityBaseAmplitude (u N) j) (v N) - + (N : ℝ)*priorPerturbationPressureMean (μ N) (restrictedZeroTreePrior (S N) (hS N)) + (eig N) (c N) (I N) 1 (fun _ => 0) (u N) (v N)+M)/(n : ℝ)) : + ∀ ε>0, ∀ᶠ r in atTop, L-ε ≤ + ∫ U, restrictedRotatedPressure (S (N₀+n*r)) (eig (N₀+n*r)) (specialRotation U) (c (N₀+n*r)) ∂μ (N₀+n*r) := by + let N := fun r => N₀+n*r + have hN r : 3≤N r := by dsimp only [N]; omega + have hNlim : Tendsto N atTop atTop := by + apply tendsto_atTop_mono (fun r => ?_) tendsto_id + dsimp only [N] + change r≤N₀+n*r + have : r≤n*r := Nat.le_mul_of_pos_left r hn + omega + let O := fun k => priorPerturbationObjective (μ k) (restrictedZeroTreePrior (S k) (hS k)) (eig k) (c k) (I k) 1 + (fun _ => 0) (u k) (v k) + let mass := fun k => Real.log (S k).card-k*Real.log 2 + let A := fun r => -(N r : ℝ)*O (N r)+mass (N r) + let P := fun r => ∫ U, restrictedRotatedPressure (S (N r)) (eig (N r)) (specialRotation U) (c (N r)) ∂μ (N r) + let Δ := fun r => ((N r+n : ℝ)*priorPerturbationPressureMean (μ (N r+n)) + (restrictedZeroTreePrior (S (N r+n)) (hS (N r+n))) (eig (N r+n)) (c (N r+n)) (I (N r+n)) + 1 (fun _ => 0) (fun j => cavityBaseAmplitude (u (N r)) j) (v (N r)) - + (N r : ℝ)*priorPerturbationPressureMean (μ (N r)) (restrictedZeroTreePrior (S (N r)) (hS (N r))) + (eig (N r)) (c (N r)) (I (N r)) 1 (fun _ => 0) (u (N r)) (v (N r))+M) + let p := fun r => tensorMinimumPenalty (u (N r)) (v (N r)) + let E := fun r => (n : ℝ)*p r+(N r+n : ℝ)*(1/4:ℝ)*(1/2:ℝ)^(N r) + have hcost := restricted_zero_field_minimum_tendsto hhaar hgauss N hN hNlim m + (fun r => μ (N r)) (fun r => hμ (N r)) (fun r => S (N r)) (fun r => hS (N r)) + (fun r => eig (N r)) (fun r => c (N r)) (fun r => I (N r)) (fun _ => 1) + (fun r => u (N r)) (fun r => v (N r)) (fun r => hu (N r)) (fun r => hv (N r)) + (fun r => hmin (N r) (hN r)) + have hclose : Tendsto (fun r => A r/((N₀ : ℝ)+(n : ℝ)*r)-P r) atTop (𝓝 0) := by + have hz := hcost.1 + simp only [one_mul] at hz + convert hz using 1 + funext r + have hpos : (N r : ℝ)≠0 := Nat.cast_ne_zero.mpr (by have := hN r; omega) + have hNr : (N₀ : ℝ)+(n : ℝ)*r=(N r : ℝ) := by simp only [N, Nat.cast_add, Nat.cast_mul] + rw [hNr] + dsimp only [A, O, P, mass] + apply congrArg (fun x : ℝ => x - ∫ U, restrictedRotatedPressure (S (N r)) (eig (N r)) + (specialRotation U) (c (N r)) ∂μ (N r)) + apply (div_eq_iff hpos).mpr + field_simp + have hE : Tendsto E atTop (𝓝 0) := cavity_total_minimum_penalty_tendsto N hNlim n p hcost.2 + have hinc r : Δ r-(n : ℝ)*(E r/(n : ℝ))≤A (r+1)-A r := by + have hh := prior_minimum_increment (μ (N r+n)) (μ (N r)) + (restrictedZeroTreePrior (S (N r+n)) (hS (N r+n))) + (restrictedZeroTreePrior (S (N r)) (hS (N r))) + (eig (N r+n)) (c (N r+n)) (eig (N r)) (c (N r)) (I (N r+n)) (I (N r)) + 1 (fun _ => 0) (u (N r+n)) (v (N r+n)) (u (N r)) (v (N r)) + (hu (N r)) (hv (N r)) (hmin (N r+n) (by have := hN r; omega)) + have hsucc : N (r+1)=N r+n := by simp only [N, Nat.mul_add, Nat.mul_one, Nat.add_assoc] + dsimp only [A] + rw [hsucc, mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hn.ne')] + have hM := hmass (N r) + dsimp only [Δ, E, p, O, mass] at * + simp only [Nat.cast_add] at ⊢ + linarith + exact cavity_envelope_progression_lower A P Δ (fun r => E r/(n : ℝ)) N₀ n L + (by exact_mod_cast (show 0 F x - G x) := by + obtain ⟨C, L, hC, hL, hF⟩ := hF + obtain ⟨D, K, hD, hK, hG⟩ := hG + refine ⟨C + D, L + K, by positivity, by positivity, fun x => ?_⟩ + calc + _ ≤ |F x| + |G x| := abs_sub _ _ + _ ≤ (C + L * ‖x‖) + (D + K * ‖x‖) := add_le_add (hF x) (hG x) + _ = _ := by ring + +lemma restrictedFieldTerminal_loss_regular {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + Measurable (fun z => restrictedFieldTerminal Finset.univ z - restrictedFieldTerminal S z) ∧ + HasLinearGrowth (fun z => restrictedFieldTerminal Finset.univ z - restrictedFieldTerminal S z) := + ⟨(continuous_restrictedFieldTerminal Finset.univ Finset.univ_nonempty).measurable.sub + (continuous_restrictedFieldTerminal S hS).measurable, + linearGrowth_difference (restrictedFieldTerminal_linearGrowth Finset.univ Finset.univ_nonempty) + (restrictedFieldTerminal_linearGrowth S hS)⟩ + +theorem restrictedFieldRecursion_endpoint_loss {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (hb1 : ∀ i < n, b i ≤ 1) (z : Fin N → ℝ) : + restrictedFieldRecursion Finset.univ n b v z - restrictedFieldRecursion S n b v z ≤ + ∫ y, restrictedFieldTerminal Finset.univ y - restrictedFieldTerminal S y + ∂fieldVectorTailEndpointKernel N (List.ofFn (fun i : Fin n => (b i, v i))) + (by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + exact hb i i.isLt) z := by + induction n generalizing b v z with + | zero => + simp only [List.ofFn_zero, fieldVectorTailEndpointKernel, Kernel.id_apply, integral_dirac] + exact le_rfl + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + let L := List.ofFn (fun i : Fin n => (bs i, vs i)) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + have hbs1 : ∀ i < n, bs i ≤ 1 := fun i hi => hb1 (i + 1) (by omega) + have hL : ∀ av ∈ L, 0 < av.1 := by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + exact hbs i i.isLt + have hL1 : ∀ av ∈ L, av.1 ≤ 1 := by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + exact hbs1 i i.isLt + let F := fieldScalarValue L (fun y => Real.log (Real.cosh y)) + have hF := fieldScalarValue_regular L hL measurable_logCosh logCosh_linearGrowth + let κ := fieldVectorTransitionKernel N (b 0) (v 0) F hF.1 + let η := fieldVectorTailEndpointKernel N L hL + let D := fun y => restrictedFieldTerminal Finset.univ y - restrictedFieldTerminal S y + have hD := restrictedFieldTerminal_loss_regular S hS + have hInt : Integrable D ((η ∘ₖ κ) z) := by + have hfull : ∀ av ∈ (b 0, v 0) :: L, 0 < av.1 := by + simpa only [List.forall_mem_cons] using And.intro (hb 0 (by omega)) hL + have hfull1 : ∀ av ∈ (b 0, v 0) :: L, av.1 ≤ 1 := by + simpa only [List.forall_mem_cons] using And.intro (hb1 0 (by omega)) hL1 + exact fieldVectorTailEndpointKernel_integrable N _ hfull hfull1 z D hD.1 hD.2 + have hOuter : Integrable (fun y => ∫ w, D w ∂η y) (κ z) := hInt.integral_comp + let d := fun y => restrictedFieldRecursion Finset.univ n bs vs y - + restrictedFieldRecursion S n bs vs y + have hregF := restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n bs vs hbs + have hregS := restrictedFieldRecursion_regular hN S hS n bs vs hbs + have hdM : Measurable d := hregF.1.sub hregS.1 + let μ := (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)).tilted + (fun w => b 0 * restrictedFieldRecursion Finset.univ n bs vs (z + w)) + have hmap : μ.map (fun w => z + w) = κ z := by + have he : (fun w => b 0 * restrictedFieldRecursion Finset.univ n bs vs (z + w)) = + (fun w => b 0 * ∑ i, F ((z + w) i)) := by + funext w + rw [restrictedFieldRecursion_univ n bs vs hbs] + change ((vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)).tilted _).map _ = _ + rw [he] + exact vectorGaussian_tilt_transition (b 0) (v 0) F hF.1 hF.2 z + have hdInt : Integrable d (κ z) := by + rw [← hmap] + apply (integrable_map_measure hdM.aestronglyMeasurable + (measurable_const.add measurable_id).aemeasurable).mpr + exact (restrictedFieldRecursion_tilt_integrable hN Finset.univ Finset.univ + Finset.univ_nonempty Finset.univ_nonempty n bs vs hbs (v 0) (b 0) z).sub + (restrictedFieldRecursion_tilt_integrable hN Finset.univ S + Finset.univ_nonempty hS n bs vs hbs (v 0) (b 0) z) + have hm : (∫ w, d (z + w) ∂μ) = ∫ y, d y ∂κ z := by + rw [← hmap] + exact (integral_map (show AEMeasurable (fun w : Fin N → ℝ => z + w) μ from + (measurable_const.add measurable_id).aemeasurable) hdM.aestronglyMeasurable).symm + calc + _ ≤ ∫ w, d (z + w) ∂μ := restrictedFieldRecursion_step_loss hN S hS n b v hb z + _ = ∫ y, d y ∂κ z := hm + _ ≤ ∫ y, ∫ w, D w ∂η y ∂κ z := by + apply integral_mono hdInt hOuter + intro y + exact ih bs vs hbs hbs1 y + _ = ∫ y, D y ∂(η ∘ₖ κ) z := (Kernel.integral_comp hInt).symm + _ = _ := by + simp only [List.ofFn_succ, fieldVectorTailEndpointKernel] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldFactorization.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..590321476dd7585250e460db1c6dae5a663df548 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldFactorization.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldRecursion +import OAI.Probability.InvariantIsing.Fields.FieldEndpointProduct +import OAI.Probability.InvariantIsing.Cavity.CavityTiltTransport + +namespace OAI + +/-! The unrestricted recursion and its canonical transition are exactly +products of the scalar field recursions. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma fieldScalarValue_ofFn (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) : + fieldScalarValue (List.ofFn (fun i : Fin n => (b i, v i))) + (fun y => Real.log (Real.cosh y)) = + cascadeRecursion n b (fun i => gaussianCascadeMarks v i) + (fun _ p => p.1 + p.2) (fun y => Real.log (Real.cosh y)) := by + induction n generalizing b v with + | zero => rfl + | succ n ih => + have ht : ∀ i < n, 0 < b (i + 1) := fun i hi => hb (i + 1) (by omega) + rw [List.ofFn_succ] + change gaussianOperator (b 0) (v 0) + (fieldScalarValue (List.ofFn (fun i : Fin n => (b (i + 1), v (i + 1)))) + (fun y => Real.log (Real.cosh y))) = _ + rw [ih (fun i => b (i + 1)) (fun i => v (i + 1)) ht] + funext z + exact gaussianOperator_eq_gaussian_logMean (hb 0 (by omega)).ne' _ + (measurable_cascadeRecursion n _ _ (fun _ => measurable_fst.add measurable_snd) + measurable_logCosh) z + +theorem restrictedFieldRecursion_univ {N : ℕ} (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (z : Fin N → ℝ) : + restrictedFieldRecursion Finset.univ n b v z = + ∑ i, fieldScalarValue (List.ofFn (fun j : Fin n => (b j, v j))) + (fun y => Real.log (Real.cosh y)) (z i) := by + have ht : restrictedFieldTerminal (Finset.univ : Finset (Spin N)) = + (fun z => ∑ i, Real.log (Real.cosh (z i))) := by + funext y + exact restrictedFieldTerminal_univ y + rw [restrictedFieldRecursion, ht] + have he := vectorCascade_logCosh_sum N n b v hb (fun _ => 0) z + simp only [zero_add] at he + rw [he, fieldScalarValue_ofFn n b v hb] + +lemma vectorGaussian_shift {N : ℕ} (v : ℝ≥0) (z : Fin N → ℝ) : + MeasurePreserving (fun w : Fin N → ℝ => z + w) + (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + (Measure.pi (fun i => gaussianReal (z i) v)) := by + apply measurePreserving_pi + intro i + refine ⟨measurable_const.add measurable_id, ?_⟩ + change (gaussianReal 0 v).map (fun x : ℝ => z i + x) = gaussianReal (z i) v + simpa only [zero_add] using gaussianReal_map_const_add (μ := 0) (v := v) (z i) + +lemma vectorGaussian_tilt_transition {N : ℕ} (a : ℝ) (v : ℝ≥0) + (F : ℝ → ℝ) (hF : Measurable F) (hG : HasLinearGrowth F) (z : Fin N → ℝ) : + ((vectorGaussianLaw N v : Measure (Fin N → ℝ)).tilted + (fun w => a * ∑ i, F ((z + w) i))).map (fun w => z + w) = + fieldVectorTransitionKernel N a v F hF z := by + have hm : Measurable (fun y : Fin N → ℝ => a * ∑ i, F (y i)) := by fun_prop + have he := cavity_tilt_map (vectorGaussianLaw N v : Measure (Fin N → ℝ)) + (fun w => z + w) (measurable_const.add measurable_id) (fun y => a * ∑ i, F (y i)) hm + rw [(vectorGaussian_shift v z).map_eq, fieldGaussian_product_tilt a v F hF hG z] at he + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldLogNormalizer.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldLogNormalizer.lean new file mode 100644 index 0000000000000000000000000000000000000000..51467cec6f780106bbb50e2d39a19bcadbf880a9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldLogNormalizer.lean @@ -0,0 +1,108 @@ +import OAI.Probability.InvariantIsing.Fields.PriorFieldLogNormalizer +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldRecursion + +namespace OAI + +/-! The constrained block's actual logarithmic normalizer, with the +original cube mass retained, equals its vector Gaussian recursion. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal BigOperators + +namespace InvariantIsing + +lemma restricted_vector_recursion_const_add {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (a : ℝ) (z : Fin N → ℝ) : + cascadeRecursion n b (fun i => vectorGaussianLaw N (v i)) (fun _ p => p.1 + p.2) + (fun y => a + restrictedFieldTerminal S y) z = a + restrictedFieldRecursion S n b v z := by + induction n generalizing b v z with + | zero => rfl + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + change logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => cascadeRecursion n bs (fun i => vectorGaussianLaw N (vs i)) + (fun _ p => p.1 + p.2) (fun y => a + restrictedFieldTerminal S y) (z + w)) = + a + logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => restrictedFieldRecursion S n bs vs (z + w)) + simp_rw [ih bs vs hbs] + exact logMean_const_add _ (hb 0 (by omega)).ne' + (integrable_exp_restrictedFieldRecursion hN S hS n bs vs hbs (v 0) (b 0) z) a + +lemma restricted_normalized_field_recursion {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (z : Fin N → ℝ) : + cascadeRecursion n b (fun i => vectorGaussianLaw N (v i)) (fun _ p => p.1 + p.2) + (fun y => finiteLogIntegral (restrictedSpinPrior S hS : Measure (Spin N)) (fieldEnergy y)) z = + restrictedFieldRecursion S n b v z - (Real.log S.card - N * Real.log 2) := by + have he : (fun y => finiteLogIntegral (restrictedSpinPrior S hS : Measure (Spin N)) (fieldEnergy y)) = + fun y => -(Real.log S.card - N * Real.log 2) + restrictedFieldTerminal S y := by + funext y + rw [finiteLogIntegral_restrictedSpinPrior] + unfold restrictedFieldTerminal + ring + rw [he, restricted_vector_recursion_const_add hN S hS n b v hb] + ring + +def restrictedFieldVectorLogNormalizer {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : ℝ := + priorFieldVectorLogNormalizer N (restrictedSpinPrior S hS : Measure (Spin N)) h z p + + (Real.log S.card - N * Real.log 2) + +lemma measurable_restrictedFieldVectorLogNormalizer {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) : + Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + restrictedFieldVectorLogNormalizer S hS h p.1 p.2) := + (measurable_priorFieldVectorLogNormalizer N (restrictedSpinPrior S hS : Measure (Spin N)) h).add_const _ + +lemma restricted_normalized_root_integral {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (root : ℝ≥0) : + (∫ z, cascadeRecursion h.depth (chainExponent h.cut) + (fun i => vectorGaussianLaw N (fieldStepVariance h i)) (fun _ p => p.1 + p.2) + (fun y => finiteLogIntegral (restrictedSpinPrior S hS : Measure (Spin N)) (fieldEnergy y)) z + ∂(vectorGaussianLaw N root : Measure (Fin N → ℝ))) = + (∫ z, restrictedFieldRecursion S h.depth (chainExponent h.cut) (fieldStepVariance h) z + ∂(vectorGaussianLaw N root : Measure (Fin N → ℝ))) - (Real.log S.card - N * Real.log 2) := by + have hb : ∀ i < h.depth, 0 < chainExponent h.cut i := + fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1 + have he := fun z => restricted_normalized_field_recursion hN S hS h.depth + (chainExponent h.cut) (fieldStepVariance h) hb z + simp_rw [he] + rw [integral_sub (restrictedFieldRecursion_root_integrable hN S hS h.depth + (chainExponent h.cut) (fieldStepVariance h) hb root) (integrable_const _)] + simp + +lemma integrable_restrictedFieldVectorLogNormalizer {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (root : ℝ≥0) : + Integrable (fun p => restrictedFieldVectorLogNormalizer S hS h p.1 p.2) + ((vectorGaussianLaw N root : Measure (Fin N → ℝ)).prod (fieldVectorCoordinateLaw N h)) := by + have hi := (prior_field_vector_log_root_integral N + (restrictedSpinPrior S hS : Measure (Spin N)) hN h root).1 + exact hi.add (integrable_const _) + +theorem restricted_field_vector_log_root_integral {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (root : ℝ≥0) : + Integrable (fun p => restrictedFieldVectorLogNormalizer S hS h p.1 p.2) + ((vectorGaussianLaw N root : Measure (Fin N → ℝ)).prod (fieldVectorCoordinateLaw N h)) ∧ + (∫ p, restrictedFieldVectorLogNormalizer S hS h p.1 p.2 + ∂(vectorGaussianLaw N root : Measure (Fin N → ℝ)).prod (fieldVectorCoordinateLaw N h)) = + ∫ z, restrictedFieldRecursion S h.depth (chainExponent h.cut) (fieldStepVariance h) z + ∂(vectorGaussianLaw N root : Measure (Fin N → ℝ)) := by + refine ⟨integrable_restrictedFieldVectorLogNormalizer hN S hS h root, ?_⟩ + have hh := prior_field_vector_log_root_integral N (restrictedSpinPrior S hS : Measure (Spin N)) hN h root + simp only [restrictedFieldVectorLogNormalizer] + rw [integral_add hh.1 (integrable_const _), hh.2, + restricted_normalized_root_integral hN S hS h root] + simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c57d0c15f3d2f40c933e702b5444a0b10f20c85 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldOrder.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldRecursion + +namespace OAI + +/-! Inclusion and exact bias transport through the constrained Gaussian +recursion, before normalizing per cavity spin. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +theorem restrictedFieldRecursion_mono {N : ℕ} (hN : 0 < N) + (S T : Finset (Spin N)) (hS : S.Nonempty) (hT : T.Nonempty) (hST : S ⊆ T) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) (z : Fin N → ℝ) : + restrictedFieldRecursion S n b v z ≤ restrictedFieldRecursion T n b v z := by + induction n generalizing b v z with + | zero => exact restrictedSpinLog_mono hS hST (fun _ _ => le_rfl) + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + change logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => restrictedFieldRecursion S n bs vs (z + w)) ≤ + logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => restrictedFieldRecursion T n bs vs (z + w)) + exact logMean_mono _ (hb 0 (by omega)) + (integrable_exp_restrictedFieldRecursion hN S hS n bs vs hbs (v 0) (b 0) z) + (integrable_exp_restrictedFieldRecursion hN T hT n bs vs hbs (v 0) (b 0) z) + (fun w => ih bs vs hbs (z + w)) + +theorem constrainedBlockValue_mono {N : ℕ} (hN : 0 < N) + (S T : Finset (Spin N)) (hS : S.Nonempty) (hT : T.Nonempty) (hST : S ⊆ T) + (h : FieldStep) : constrainedBlockValue S h ≤ constrainedBlockValue T h := by + unfold constrainedBlockValue + apply sub_le_sub_right + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply integral_mono (constrainedBlockValue_root_integrable hN S hS h) + (constrainedBlockValue_root_integrable hN T hT h) + intro z + exact restrictedFieldRecursion_mono hN S T hS hT hST _ _ _ + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) z + +theorem restrictedFieldRecursion_group_bias {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (bias : A → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) (z : Fin N → ℝ) : + restrictedFieldRecursion (spinGroupSlice group k) n b v (z + fun i => bias (group i)) = + restrictedFieldRecursion (spinGroupSlice group k) n b v z + + spinGroupFieldConstant group k bias := by + induction n generalizing b v z with + | zero => exact restrictedFieldTerminal_group_bias group k hk bias z + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + change logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => restrictedFieldRecursion (spinGroupSlice group k) n bs vs + ((z + fun i => bias (group i)) + w)) = + logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => restrictedFieldRecursion (spinGroupSlice group k) n bs vs (z + w)) + _ + have he : (fun w : Fin N → ℝ => restrictedFieldRecursion (spinGroupSlice group k) n bs vs + ((z + fun i => bias (group i)) + w)) = + fun w => spinGroupFieldConstant group k bias + + restrictedFieldRecursion (spinGroupSlice group k) n bs vs (z + w) := by + funext w + have hz : (z + fun i => bias (group i)) + w = (z + w) + fun i => bias (group i) := by abel + rw [hz, ih bs vs hbs] + ring + rw [he, logMean_const_add _ (hb 0 (by omega)).ne' + (integrable_exp_restrictedFieldRecursion hN _ (spinGroupSlice_nonempty group k hk) + n bs vs hbs (v 0) (b 0) z)] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldPairInput.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldPairInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..e97f8edc0d9f90ae24fba14f08bbda828524bf02 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldPairInput.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedAncestorEndpoint +import OAI.Probability.InvariantIsing.Fields.MarkEndpointIntegral +import OAI.Probability.InvariantIsing.Fields.VectorPairIntegral +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTerminalIntegrability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldPublishedInput + +namespace OAI + +/-! The constrained vector terminal specialization of the joint marked-cascade theorem. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +lemma markPairEndpoint_coordinates {N n : ℕ} (g : ForestVertex n → Fin N → ℝ) + (z : Fin N → ℝ) (α β : LabeledLeaf n) : + markPairEndpoint n z z (fun i => (g (edgeAt n α i),g (edgeAt n β i))) = + (labeledEnergy n (markForestOfCoords (Fin N → ℝ) n g) α z, + labeledEnergy n (markForestOfCoords (Fin N → ℝ) n g) β z) := by + apply Prod.ext <;> funext j <;> + simp only [markPairEndpoint,Pi.add_apply,Finset.sum_apply,labeledEnergy_edge_sum] + +lemma restrictedFieldTiltedPairMean_eq_vector {N : ℕ} (S : Finset (Spin N)) + (h : FieldStep) (z : Fin N → ℝ) + (Φ : ℕ × ((Fin N → ℝ) × (Fin N → ℝ)) → ℝ) : + restrictedFieldTiltedPairMean S h z Φ = + vectorTerminalPairMean N h.depth (chainExponent h.cut) (fieldStepVariance h) + (restrictedFieldTerminal S) z + (fun p => Φ (p.1,markPairEndpoint h.depth z z p.2)) := by + unfold restrictedFieldTiltedPairMean vectorTerminalPairMean + simp only [markPairEndpoint_coordinates] + rfl + +theorem panchenkoTalagrandRestrictedFieldPair_proved : PanchenkoTalagrandRestrictedFieldPairInput := by + intro N hN S hS h z Φ hΦ hbounded + obtain ⟨C,hB⟩ := hbounded + let b := chainExponent h.cut + let v := fieldStepVariance h + have hb : CascadeExponents h.depth b := chainExponent_admissible h.ordered_cut h.first h.last + let F := restrictedFieldTerminal S + have hF : Measurable F := (continuous_restrictedFieldTerminal S hS).measurable + have hG : HasLinearGrowth F := restrictedFieldTerminal_linearGrowth S hS + have hD : Measurable (fun p : ℕ × (Fin h.depth → (Fin N → ℝ) × (Fin N → ℝ)) => + Φ (p.1,markPairEndpoint h.depth z z p.2)) := + hΦ.comp (measurable_fst.prodMk ((measurable_markPairEndpoint h.depth z z).comp measurable_snd)) + rw [restrictedFieldTiltedPairMean_eq_vector, + vectorTerminal_pair_formula hN h.depth b v hb F hF hG z + (restrictedTerminal_exp_integrable_ae hN S hS h z) _ hD (fun p => hB _)] + apply integral_congr_ae + apply ae_of_all + intro α + let κ := vectorTerminalAncestorKernel N h.depth b v F hF + let : ∀ i, IsMarkovKernel (κ i) := fun i => + vectorTerminalAncestorKernel_markov hN h.depth b v hb F hF hG i + change markPairPathMean h.depth κ (fieldCommonLevel h α).val z z + (fun w => Φ ((fieldCommonLevel h α).val,markPairEndpoint h.depth z z w)) = _ + calc + _ = ∫ y, Φ ((fieldCommonLevel h α).val,y) ∂markPairEndpointKernel h.depth κ + (fieldCommonLevel h α) z := + markPairPathMean_shared_endpoint h.depth κ (fieldCommonLevel h α) z + (fun y => Φ ((fieldCommonLevel h α).val,y)) + (hΦ.comp (measurable_const.prodMk measurable_id)) (fun y => hB _) + _ = _ := by + rw [restrictedAncestor_pair hN S hS h.depth b v hb (fieldCommonLevel h α)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldPublishedInput.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldPublishedInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee92f61128985a482f1f332481a8784d088c093f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldPublishedInput.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedEndpointKernel +import OAI.Probability.InvariantIsing.Fields.FieldPublishedPairInput + +namespace OAI + +/-! Panchenko--Talagrand (2007), Lemma 3.1 (8), p.655 and Corollary +3.2 (9), p.656, specialized to the actual finite constrained terminal. +The hypothesis concerns only the marked endpoint law; no pressure, +spin expectation, or limiting assertion is an input. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +def restrictedFieldTiltedPairMean {N : ℕ} (S : Finset (Spin N)) + (h : FieldStep) (z : Fin N → ℝ) + (Φ : ℕ × ((Fin N → ℝ) × (Fin N → ℝ)) → ℝ) : ℝ := + ∫ p, referenceReplicaMean (labeledLeafLaw h.depth p.1) + (fun α => restrictedFieldTerminal S (fieldVectorEndpoint N h p z α)) + (fun σ : Fin 2 → LabeledLeaf h.depth => + Φ (labeledCommonDepth h.depth (σ 0) (σ 1), + fieldVectorEndpoint N h p z (σ 0), fieldVectorEndpoint N h p z (σ 1))) + ∂fieldVectorCoordinateLaw N h + +def RestrictedFieldAncestorPairLaw {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) : Prop := + ∀ z : Fin N → ℝ, + ∀ Φ : ℕ × ((Fin N → ℝ) × (Fin N → ℝ)) → ℝ, + Measurable Φ → (∃ C : ℝ, ∀ p, |Φ p| ≤ C) → + restrictedFieldTiltedPairMean S h z Φ = + ∫ α : ℕ → LabeledLeaf h.depth, + ∫ y, Φ ((fieldCommonLevel h α).val, y) + ∂restrictedPairEndpointKernel hN S hS h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldCommonLevel h α) z + ∂cascadeReplicaLaw h.depth (chainExponent h.cut) + +/-- The same published marking theorem, with a nonempty finite spin +constraint retained inside the terminal log partition. -/ +def PanchenkoTalagrandRestrictedFieldPairInput : Prop := + ∀ (N : ℕ) (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep), + RestrictedFieldAncestorPairLaw hN S hS h + +/-- The constrained terminal satisfies the published exponential-moment +condition on every finite Gaussian path, also for zero variances. -/ +theorem restrictedFieldFinitePath_exp_integrable {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) + (n : ℕ) (v : ℕ → ℝ≥0) (z : Fin N → ℝ) : + Integrable (fun w : Fin n → Fin N → ℝ => + Real.exp (restrictedFieldTerminal S (z + ∑ i, w i))) + (Measure.pi (fun i : Fin n => (vectorGaussianLaw N (v i) : Measure (Fin N → ℝ)))) := by + have hm : Measurable (fun w : Fin n → Fin N → ℝ => + Real.exp (restrictedFieldTerminal S (z + ∑ i, w i))) := + (((continuous_restrictedFieldTerminal S hS).measurable.comp + (measurable_const.add (Finset.measurable_sum _ fun i _ => measurable_pi_apply i))).exp) + apply (fieldVectorFinitePath_exp_integrable N hN n v z).mono' hm.aestronglyMeasurable + exact Filter.Eventually.of_forall (fun w => by + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact Real.exp_le_exp.mpr (restrictedFieldTerminal_le_univ S hS _)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldRecursion.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..4dd1ad61c0cfe5b6c7e7c198a58a2b7d93611faf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldRecursion.lean @@ -0,0 +1,85 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldTerminal +import OAI.Probability.InvariantIsing.Fields.FieldPublishedPairInput +import OAI.Probability.InvariantIsing.Arrays.NSpinFactorization + +namespace OAI + +/-! The actual vector Gaussian recursion for a constrained cavity block. +Regularity follows from the terminal's finite-spin estimates, with no +assumption on the number of cascade levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def restrictedFieldRecursion {N : ℕ} (S : Finset (Spin N)) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) : (Fin N → ℝ) → ℝ := + cascadeRecursion n b (fun i => vectorGaussianLaw N (v i)) + (fun _ p => p.1 + p.2) (restrictedFieldTerminal S) + +lemma restrictedFieldRecursion_regular {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) : + Measurable (restrictedFieldRecursion S n b v) ∧ + HasLinearGrowth (restrictedFieldRecursion S n b v) := by + have hm := (continuous_restrictedFieldTerminal S hS).measurable + exact ⟨measurable_cascadeRecursion n b _ (fun _ => measurable_fst.add measurable_snd) hm, + cascadeRecursion_linearGrowth n b _ (fun i _ => vectorGaussianLaw_moments hN (v i)) + hm (restrictedFieldTerminal_linearGrowth S hS) hb⟩ + +lemma restrictedFieldRecursion_lipschitz {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (z y : Fin N → ℝ) : + |restrictedFieldRecursion S n b v z - restrictedFieldRecursion S n b v y| ≤ N * ‖z - y‖ := + cascadeRecursion_lipschitz n b _ (fun i _ => vectorGaussianLaw_moments hN (v i)) + (continuous_restrictedFieldTerminal S hS).measurable + (restrictedFieldTerminal_linearGrowth S hS) + (restrictedFieldTerminal_norm_difference S hS) hb z y + +lemma integrable_exp_restrictedFieldRecursion {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (root : ℝ≥0) (t : ℝ) (z : Fin N → ℝ) : + Integrable (fun w => Real.exp (t * restrictedFieldRecursion S n b v (z + w))) + (vectorGaussianLaw N root : Measure (Fin N → ℝ)) := by + obtain ⟨hm, hg⟩ := restrictedFieldRecursion_regular hN S hS n b v hb + exact integrable_exp_of_linearGrowth _ (vectorGaussianLaw_moments hN root) + (hm.comp (measurable_const.add measurable_id)) (hg.add_left z) t + +lemma restrictedFieldRecursion_root_integrable {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (root : ℝ≥0) : + Integrable (restrictedFieldRecursion S n b v) + (vectorGaussianLaw N root : Measure (Fin N → ℝ)) := by + obtain ⟨hm, C, L, _, hL, hbound⟩ := restrictedFieldRecursion_regular hN S hS n b v hb + apply ((integrable_const C).add (((vectorGaussianLaw_moments hN root) 1).const_mul L)).mono' + hm.aestronglyMeasurable + apply ae_of_all + intro z + rw [Real.norm_eq_abs] + calc + _ ≤ C + L * ‖z‖ := hbound z + _ ≤ C + L * Real.exp (1 * ‖z‖) := by + gcongr + simpa only [one_mul] using (le_add_of_nonneg_right zero_le_one).trans + (Real.add_one_le_exp ‖z‖) + +def constrainedBlockValue {N : ℕ} (S : Finset (Spin N)) (h : FieldStep) : ℝ := + (N : ℝ)⁻¹ * (∫ z, restrictedFieldRecursion S h.depth (chainExponent h.cut) + (fieldStepVariance h) z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) - + h.height (Fin.last h.depth) / 2 + +lemma constrainedBlockValue_root_integrable {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) : + Integrable (restrictedFieldRecursion S h.depth (chainExponent h.cut) (fieldStepVariance h)) + (vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ)) := + restrictedFieldRecursion_root_integrable hN S hS _ _ _ + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldRootLoss.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldRootLoss.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f55db725449461819e13978265c659cc42d9923 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldRootLoss.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldEndpointLoss +import OAI.Probability.InvariantIsing.Fields.FieldCanonicalRootLaw + +namespace OAI + +/-! The constrained recursion loss, averaged over the actual biased root, +is bounded by the averaged terminal loss. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma fieldStepIncrements (h : FieldStep) : + List.ofFn (fun i : Fin h.depth => (chainExponent h.cut i, fieldStepVariance h i)) = + scalarFieldIncrements h := by + unfold scalarFieldIncrements + apply congrArg List.ofFn + funext i + apply Prod.ext + · rw [chainExponent_apply h.cut i.isLt] + rfl + · simp only [fieldStepVariance, dite_eq_left i.isLt, scalarFieldIncrements, List.get_ofFn] + congr 3 + + +lemma restrictedFieldRecursion_biased_root_integrable {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) : + Integrable (restrictedFieldRecursion S h.depth (chainExponent h.cut) (fieldStepVariance h)) + (Measure.pi (fun i => gaussianReal (b i) (NNReal.mk (h.height 0) (h.nonneg 0)))) := by + have hr := restrictedFieldRecursion_regular hN S hS h.depth (chainExponent h.cut) + (fieldStepVariance h) (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + exact integrable_linearGrowth_pi _ (fun _ => IsGaussian.integrable_id) _ hr.1 hr.2 + +theorem restrictedFieldRecursion_root_loss {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) : + (∫ z, restrictedFieldRecursion Finset.univ h.depth (chainExponent h.cut) (fieldStepVariance h) z - + restrictedFieldRecursion S h.depth (chainExponent h.cut) (fieldStepVariance h) z + ∂Measure.pi (fun i => gaussianReal (b i) (NNReal.mk (h.height 0) (h.nonneg 0)))) ≤ + ∫ y, restrictedFieldTerminal Finset.univ y - restrictedFieldTerminal S y + ∂fieldCanonicalVectorLaw N h b := by + let μ := Measure.pi (fun i => gaussianReal (b i) (NNReal.mk (h.height 0) (h.nonneg 0))) + let η := fieldVectorTailEndpointKernel N (scalarFieldIncrements h) (scalarFieldIncrements_positive h) + let D := fun y => restrictedFieldTerminal Finset.univ y - restrictedFieldTerminal S y + have hD := restrictedFieldTerminal_loss_regular S hS + have hi : Integrable D (η ∘ₘ μ) := by + rw [fieldCanonicalVectorLaw_root] + exact fieldCanonicalVectorLaw_linear_integrable N h b D hD.1 hD.2 + have ho : Integrable (fun z => ∫ y, D y ∂η z) μ := by + rw [Measure.comp_eq_comp_const_apply] at hi + simpa only [Kernel.const_apply] using hi.integral_comp + have hl := (restrictedFieldRecursion_biased_root_integrable hN Finset.univ + Finset.univ_nonempty h b).sub (restrictedFieldRecursion_biased_root_integrable hN S hS h b) + have hb := chainExponent_admissible h.ordered_cut h.first h.last + calc + _ ≤ ∫ z, ∫ y, D y ∂η z ∂μ := by + apply integral_mono hl ho + intro z + have he := restrictedFieldRecursion_endpoint_loss hN S hS h.depth + (chainExponent h.cut) (fieldStepVariance h) (fun i hi => (hb.1 i hi).1) + (fun i hi => (hb.1 i hi).2.le) z + change restrictedFieldRecursion Finset.univ h.depth (chainExponent h.cut) + (fieldStepVariance h) z - restrictedFieldRecursion S h.depth (chainExponent h.cut) + (fieldStepVariance h) z ≤ _ + simpa only [fieldStepIncrements] using he + _ = ∫ y, D y ∂(η ∘ₘ μ) := by + rw [Measure.comp_eq_comp_const_apply] at hi ⊢ + exact (Kernel.integral_comp hi).symm + _ = _ := by rw [fieldCanonicalVectorLaw_root] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldStepEntropy.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldStepEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..dce0ab8c0369d138d1270b186f2788be8f65461c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldStepEntropy.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Core.TiltedRelativeEntropy +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldStepLoss + +namespace OAI + +/-! Exact weighted conditional-entropy loss at one actual constrained +Gaussian step. The ordinary entropy is bounded with no lower cutoff on +the positive cascade exponent. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron InformationTheory +open scoped NNReal + +namespace InvariantIsing + +theorem restrictedFieldRecursion_step_entropy {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n + 1, 0 < b i) (hb1 : b 0 ≤ 1) (z : Fin N → ℝ) : + let F := fun w => restrictedFieldRecursion Finset.univ n (fun i => b (i + 1)) + (fun i => v (i + 1)) (z + w) + let G := fun w => restrictedFieldRecursion S n (fun i => b (i + 1)) + (fun i => v (i + 1)) (z + w) + let μ := (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + klDiv (μ.tilted (fun w => b 0 * G w)) (μ.tilted (fun w => b 0 * F w)) ≠ ⊤ ∧ + (klDiv (μ.tilted (fun w => b 0 * G w)) (μ.tilted (fun w => b 0 * F w))).toReal + + (∫ w, F w - G w ∂μ.tilted (fun w => b 0 * G w)) ≤ + restrictedFieldRecursion Finset.univ (n + 1) b v z - + restrictedFieldRecursion S (n + 1) b v z := by + dsimp only + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + let F := fun w => restrictedFieldRecursion (Finset.univ : Finset (Spin N)) n bs vs (z + w) + let G := fun w => restrictedFieldRecursion S n bs vs (z + w) + let μ := (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + have hF := integrable_exp_restrictedFieldRecursion hN Finset.univ Finset.univ_nonempty + n bs vs hbs (v 0) (b 0) z + have hG := integrable_exp_restrictedFieldRecursion hN S hS n bs vs hbs (v 0) (b 0) z + have hGF := restrictedFieldRecursion_tilt_integrable hN S Finset.univ hS + Finset.univ_nonempty n bs vs hbs (v 0) (b 0) z + have hGG := restrictedFieldRecursion_tilt_integrable hN S S hS hS + n bs vs hbs (v 0) (b 0) z + have hD : Integrable (fun w => F w - G w) (μ.tilted (fun w => b 0 * G w)) := hGF.sub hGG + exact ⟨(tilted_pair_entropy_identity μ F G (hb 0 (by omega)) hF hG hD).1, + tilted_pair_entropy_budget μ F G (hb 0 (by omega)) hb1 hF hG hD⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldStepLoss.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldStepLoss.lean new file mode 100644 index 0000000000000000000000000000000000000000..25cbe419ac1e8af13dbc6b1645396de1319a147c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldStepLoss.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Core.LogMeanLoss +import OAI.Probability.InvariantIsing.Gaussian.GaussianTiltLinearGrowth + +namespace OAI + +/-! The canonical transition propagates the actual constrained-block +loss by expectation. All integrability obligations follow from the +finite-spin terminal and Gaussian exponential moments. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma restrictedFieldRecursion_succ {N : ℕ} (S : Finset (Spin N)) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (z : Fin N → ℝ) : + restrictedFieldRecursion S (n + 1) b v z = + logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) + (fun w => restrictedFieldRecursion S n (fun i => b (i + 1)) + (fun i => v (i + 1)) (z + w)) := rfl + +lemma restrictedFieldRecursion_tilt_integrable {N : ℕ} (hN : 0 < N) + (S T : Finset (Spin N)) (hS : S.Nonempty) (hT : T.Nonempty) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) + (root : ℝ≥0) (q : ℝ) (z : Fin N → ℝ) : + Integrable (fun w => restrictedFieldRecursion T n b v (z + w)) + ((vectorGaussianLaw N root : Measure (Fin N → ℝ)).tilted + (fun w => q * restrictedFieldRecursion S n b v (z + w))) := by + have hF := restrictedFieldRecursion_regular hN S hS n b v hb + have hG := restrictedFieldRecursion_regular hN T hT n b v hb + exact integrable_linearGrowth_tilted (vectorGaussianLaw N root : Measure (Fin N → ℝ)) + (vectorGaussianLaw_moments hN root) + (fun w : Fin N → ℝ => restrictedFieldRecursion S n b v (z + w)) + (fun w : Fin N → ℝ => restrictedFieldRecursion T n b v (z + w)) + (hF.1.comp (measurable_const.add measurable_id)) (hF.2.add_left z) + (hG.1.comp (measurable_const.add measurable_id)) (hG.2.add_left z) q + +theorem restrictedFieldRecursion_step_loss {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n + 1, 0 < b i) (z : Fin N → ℝ) : + restrictedFieldRecursion Finset.univ (n + 1) b v z - + restrictedFieldRecursion S (n + 1) b v z ≤ + ∫ w, restrictedFieldRecursion Finset.univ n (fun i => b (i + 1)) + (fun i => v (i + 1)) (z + w) - + restrictedFieldRecursion S n (fun i => b (i + 1)) (fun i => v (i + 1)) (z + w) + ∂(vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)).tilted + (fun w => b 0 * restrictedFieldRecursion Finset.univ n (fun i => b (i + 1)) + (fun i => v (i + 1)) (z + w)) := by + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + let F := fun w => restrictedFieldRecursion (Finset.univ : Finset (Spin N)) n bs vs (z + w) + let G := fun w => restrictedFieldRecursion S n bs vs (z + w) + change logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) F - + logMean (b 0) (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) G ≤ + ∫ w, F w - G w ∂(vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)).tilted + (fun w => b 0 * F w) + have hiF := integrable_exp_restrictedFieldRecursion hN (Finset.univ : Finset (Spin N)) + Finset.univ_nonempty n bs vs hbs (v 0) (b 0) z + have hiG := integrable_exp_restrictedFieldRecursion hN S hS n bs vs hbs (v 0) (b 0) z + have hiFF := restrictedFieldRecursion_tilt_integrable hN Finset.univ Finset.univ + Finset.univ_nonempty Finset.univ_nonempty n bs vs hbs (v 0) (b 0) z + have hiFG := restrictedFieldRecursion_tilt_integrable hN Finset.univ S + Finset.univ_nonempty hS n bs vs hbs (v 0) (b 0) z + have hD : Integrable (fun w => F w - G w) + ((vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)).tilted (fun w => b 0 * F w)) := + hiFF.sub hiFG + exact logMean_loss_le_tilted_mean (vectorGaussianLaw N (v 0) : Measure (Fin N → ℝ)) F G + (hb 0 (by omega)) hiF hiG hD + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldTerminal.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f037e9ef91d33a5749f5a1cbaade0856be65bcd3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFieldTerminal.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Fields.SpinGroupSlice +import OAI.Probability.InvariantIsing.Fields.SpinFactorization +import OAI.Probability.IsingPerceptron.MonomialGgAtMinimum + +namespace OAI + +/-! The actual constrained-block terminal payoff. Its prior mass is not +renormalized; the Lipschitz and growth estimates include that fixed mass. -/ + +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +lemma restrictedSpinLog_le_add {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H K : Spin N → ℝ) (c : ℝ) (h : ∀ σ ∈ S, H σ ≤ K σ + c) : + restrictedSpinLog S H ≤ restrictedSpinLog S K + c := by + rw [← restrictedSpinLog_add_const S hS K c] + exact restrictedSpinLog_mono hS (Finset.Subset.refl _) h + +lemma abs_restrictedSpinLog_sub_le {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H K : Spin N → ℝ) (c : ℝ) (h : ∀ σ ∈ S, |H σ - K σ| ≤ c) : + |restrictedSpinLog S H - restrictedSpinLog S K| ≤ c := by + have h₁ := restrictedSpinLog_le_add S hS H K c (fun σ hσ => by + have hh := (abs_le.mp (h σ hσ)).2 + linarith) + have h₂ := restrictedSpinLog_le_add S hS K H c (fun σ hσ => by + have hh := (abs_le.mp (h σ hσ)).1 + linarith) + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +def restrictedFieldTerminal {N : ℕ} (S : Finset (Spin N)) (z : Fin N → ℝ) : ℝ := + restrictedSpinLog S (fieldEnergy z) + +lemma restrictedFieldTerminal_univ {N : ℕ} (z : Fin N → ℝ) : + restrictedFieldTerminal Finset.univ z = ∑ i, Real.log (Real.cosh (z i)) := by + rw [restrictedFieldTerminal, restrictedSpinLog_univ, logPartition_fieldEnergy] + +lemma restrictedFieldTerminal_zero {N : ℕ} (S : Finset (Spin N)) : + restrictedFieldTerminal S 0 = Real.log S.card - N * Real.log 2 := by + simp [restrictedFieldTerminal, restrictedSpinLog, fieldEnergy] + +lemma restrictedFieldTerminal_le_univ {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (z : Fin N → ℝ) : restrictedFieldTerminal S z ≤ ∑ i, Real.log (Real.cosh (z i)) := by + rw [restrictedFieldTerminal, ← logPartition_fieldEnergy] + exact restrictedSpinLog_le_full S hS _ + +lemma restrictedFieldTerminal_difference {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (z y : Fin N → ℝ) : + |restrictedFieldTerminal S z - restrictedFieldTerminal S y| ≤ ∑ i, |z i - y i| := + abs_restrictedSpinLog_sub_le S hS _ _ _ (fun σ _ => abs_fieldEnergy_sub_le z y σ) + +lemma restrictedFieldTerminal_norm_difference {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (z y : Fin N → ℝ) : + |restrictedFieldTerminal S z - restrictedFieldTerminal S y| ≤ N * ‖z - y‖ := by + apply (restrictedFieldTerminal_difference S hS z y).trans + calc + _ ≤ ∑ _i : Fin N, ‖z - y‖ := Finset.sum_le_sum (fun i _ => by + simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (z - y) i) + _ = _ := by simp + +lemma continuous_restrictedFieldTerminal {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + Continuous (restrictedFieldTerminal S) := by + apply LipschitzWith.continuous (K := (N : ℝ≥0)) + apply LipschitzWith.of_dist_le_mul + intro z y + simpa only [dist_eq_norm, Real.norm_eq_abs, NNReal.coe_natCast] using + restrictedFieldTerminal_norm_difference S hS z y + +lemma restrictedFieldTerminal_linearGrowth {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + HasLinearGrowth (restrictedFieldTerminal S) := by + refine ⟨|restrictedFieldTerminal S 0|, N, abs_nonneg _, Nat.cast_nonneg _, fun z => ?_⟩ + have hb := restrictedFieldTerminal_norm_difference S hS z 0 + simp only [sub_zero] at hb + have hh := abs_add_le (restrictedFieldTerminal S z - restrictedFieldTerminal S 0) + (restrictedFieldTerminal S 0) + rw [sub_add_cancel] at hh + linarith + +lemma restrictedFieldTerminal_group_bias {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (b : A → ℝ) (z : Fin N → ℝ) : + restrictedFieldTerminal (spinGroupSlice group k) (z + fun i => b (group i)) = + restrictedFieldTerminal (spinGroupSlice group k) z + spinGroupFieldConstant group k b := by + have he : fieldEnergy (z + fun i => b (group i)) = + fun σ => fieldEnergy z σ + fieldEnergy (fun i => b (group i)) σ := by + funext σ + simp only [fieldEnergy, Pi.add_apply, add_mul, Finset.sum_add_distrib] + rw [restrictedFieldTerminal, he, restrictedSpinLog_group_field group k hk] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteBlockSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteBlockSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cadbe392c022dc24f44c664121e0c7bb47abfc7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteBlockSpin.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteCovariancePath +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteSpinTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRootedBlock + +namespace OAI + +/-! The full quadratic cavity spin test specialized to a genuine finite +spectral law and overlap quantile. All matrix and scalar covariance +hypotheses of the marking calculation are discharged here. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_block_spin_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ σ, cavityRootedBlockDepthTest (fun i => Φ (q (fieldDepthLevel h i))) σ + ∂((probabilityReplicaKernel + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)) + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)).measurable) + ∘ₘ (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n (chainExponent cut) + (cavityGaussianMarks S) : Measure (NoiseTree (EuclideanSpace ℝ (Fin d)) n)))) = + ∫ t, Φ (p t) * restrictedBlockOverlapPath hN T hT h t ∂pathMeasure := by + intro hq0 h H S S₀ K L c + let M : Measure (ℕ → CavitySpinState d N n) := + (probabilityReplicaKernel + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)) + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)).measurable) + ∘ₘ (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n (chainExponent cut) + (cavityGaussianMarks S) : Measure (NoiseTree (EuclideanSpace ℝ (Fin d)) n)) + have hM : IsProbabilityMeasure M := by + dsimp only [M] + infer_instance + have he := @restricted_rooted_block_evaluation d N hN T hT h M hM q Φ C hΦ + have hindex : ∀ᵐ t ∂pathMeasure, q (fieldLevelIndex h t) = p t := by + filter_upwards [ae_finite_overlap_cell cut hfirst hlast] with t ht + obtain ⟨i, hi⟩ := ht + rw [fieldLevelIndex_on_cell h i hi, hp i t hi] + refine (he ?_).trans ?_ + · intro j + have hj := restricted_cavity_finite_spin_test hpub hd hN T hT rho lam hrho hsum B hB + hBE hcomplete g a ha p cut hcut hfirst hlast q hq hp htop Φ j hΦ + apply hj.trans + apply integral_congr_ae + filter_upwards [hindex] with t ht + rw [ht] + · apply integral_congr_ae + filter_upwards [hindex] with t ht + rw [ht] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteDepthTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteDepthTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2987e56155680d7855b959d45944bdb2836e527 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteDepthTest.lean @@ -0,0 +1,123 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteSpinTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedDepthTestEvaluation + +namespace OAI + +/-! The finite spectral quadratic cavity has the original common-overlap law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_depth_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ σ, cavityRootedDepthTest (fun i => Φ (q (fieldDepthLevel h i))) σ + ∂((probabilityReplicaKernel + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)) + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)).measurable) + ∘ₘ (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n (chainExponent cut) + (cavityGaussianMarks S) : Measure _))) = + ∫ t, Φ (p t) ∂pathMeasure := by + intro hq0 h H S S₀ K L c + let x := cavityFiniteDeficitPath p q + have hx (i : ℕ) : 0 < x i := + cavityFiniteDeficitPath_pos p cut hfirst hlast q hq.monotone hp htop i + have hxm : Antitone x := cavityFiniteDeficitPath_antitone p q hq.monotone + have hK : K.transpose = K := by + dsimp only [K, cavityRepeatedSpectrum] + simp only [Matrix.transpose_sub, Matrix.transpose_mul, Matrix.transpose_transpose, + Matrix.diagonal_transpose, Matrix.mul_assoc] + have hH (i : ℕ) : (H i).transpose = H i := + cavityFiniteCovariancePath_symmetric rho lam hrho hsum g p q i + have hS (i : ℕ) : (S i).PosSemidef := + cavityFiniteNoiseCovariance_posSemidef rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop i + have hS₀ : S₀.PosSemidef := + cavityFiniteCovariance_root_posSemidef rho lam hrho hsum g (hx 0) (hq0 0) + have hdet (i : ℕ) : IsUnit (1 - H i * K).det := + cavity_finite_tilt_isUnit rho lam hrho hsum B hB g (x i) (hx i) + have hΔ (i : ℕ) : H i - H (i + 1) = chainExponent cut i • S i := + cavityFiniteNoiseCovariance_delta rho lam hrho hsum g p cut hcut hfirst q i + have hA := cavity_finite_spectral_upper lam a ha B hB + have hQ (i : ℕ) : (cavityFactorPrecision + (chainExponent cut i • cavityBackwardQuadratic K (H (i + 1))) (CFC.sqrt (S i))).PosDef := + cavityFiniteCovariance_step_precision rho lam hrho hsum g _ a hK hA + (hx (i + 1)) (hxm (Nat.le_succ i)) (finite_chainExponent_pos cut hcut hfirst i).le + (S i) (hS i) (hΔ i) + have hR : (H n).PosSemidef := + (cavityFiniteCovariancePath_posDef rho lam hrho hsum g p cut hfirst hlast q hq hp htop n).posSemidef + have hQR : (cavityFactorPrecision K (CFC.sqrt (H n))).PosDef := + cavityFiniteCovariance_terminal_precision rho lam hrho hsum g _ a (fun i => ha (g i)) hK hA (hx n) + have hAtom (i : ℕ) (hi : i < n) : + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i)) := + cavityFiniteNoiseCovariance_atomless rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop hd i hi + have hcov (i : ℕ) (hi : i < n) : + L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = + (fieldStepVariance h i : ℝ) • 1 := by + let k : Fin n := ⟨i, hi⟩ + have he := cavity_finite_projected_innovation rho lam hrho hsum B hB hBE hcomplete g + (x i) (x (i + 1)) (chainExponent cut i) (hx i) (hx (i + 1)) + (finite_chainExponent_pos cut hcut hfirst i).ne' (S i) (hΔ i) + change L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = _ at he + rw [he] + have hv := cavityFieldStep_variance rho lam hrho hsum p cut hcut hfirst hlast + q hq hq0 hp htop k + change (fieldStepVariance h i : ℝ) = _ at hv + rw [hv] + simp only [x, cavityFiniteDeficitPath, show i = (k : ℕ) from rfl, + cavityFiniteLevel_castSucc, cavityFiniteLevel_succ] + rw [chainExponent_apply cut k.isLt] + rfl + have hnonneg : 0 ≤ finiteR rho lam hrho hsum (x n) - c := by + apply sub_nonneg.mpr + have hc : c = ∑ a, rho a * lam a := by simp [c, finiteR] + rw [hc] + exact mean_le_finiteR rho lam hrho hsum (hx n) + let v : ℝ≥0 := (finiteR rho lam hrho hsum (x n) - c).toNNReal + have hres : L.transpose * cavityResolvent K (H n) * L = (v : ℝ) • 1 := by + rw [show (v : ℝ) = finiteR rho lam hrho hsum (x n) - c from Real.coe_toNNReal _ hnonneg] + exact cavity_finite_projected_residual rho lam hrho hsum B hB hBE hcomplete g (x n) (hx n) + have he := restricted_cavity_full_depth_test_evaluation hpub hN T hT h K H S S₀ hS₀ L c hK hH hS + (fun i => field_chainExponent_pos h i) hdet hΔ hQ hR hQR hAtom v hcov hres + (fun i => Φ (q (fieldDepthLevel h i))) (fun i => hΦ _) + apply he.trans + apply integral_congr_ae + filter_upwards [ae_finite_overlap_cell cut hfirst hlast] with t ht + obtain ⟨i, hi⟩ := ht + have hindex : fieldLevelIndex h t = i := fieldLevelIndex_on_cell h i hi + rw [hindex] + have hlev : fieldDepthLevel h i.val = i := by + apply Fin.ext + exact min_eq_left (Nat.le_of_lt_succ i.isLt) + rw [hlev, hp i t hi] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteLabeledLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteLabeledLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..bce7401e1f75af4131008efd1289713cf7c3149f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteLabeledLog.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteLogEvaluation +import OAI.Probability.InvariantIsing.Cavity.CavityLabeledLog + +namespace OAI + +/-! The exact finite spectral trial value in the labeled coordinates +used for physical Haar replica limits. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_labeled_log_evaluation + {m d N n : ℕ} (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (counts : Fin m → ℕ) (hcounts_le : ∀ a, counts a ≤ N) + (hcounts : ∀ a, (Finset.univ.filter (fun i => g i = a)).card = N - counts a) + (hcounts_rho : ∀ a, (counts a : ℝ) = (N : ℝ) * rho a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + let P := cavityLabeledDisorderLaw n (chainExponent cut) S₀ S + let ν := cavityLabeledPriorKernel n (H n) (restrictedSpinPrior T hT) + let V := cavityLabeledPotential n K L (c • 1) + Integrable (fun ω => Real.log (∫ x, Real.exp (V (ω,x)) ∂ν ω)) P ∧ + (N : ℝ)⁻¹ * (∫ ω, Real.log (∫ x, Real.exp (V (ω,x)) ∂ν ω) ∂P) + (N : ℝ)⁻¹ * (Real.log T.card - N * Real.log 2) = + constrainedBlockValue T h + fieldPairing p h / 2 + spectralFunctional (finiteR rho lam hrho hsum) p := by + intro hq0 h H S S₀ K L c P ν V + have hv := restricted_cavity_finite_log_evaluation hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha counts hcounts_le hcounts hcounts_rho p cut hcut hfirst hlast q hq hp htop + have ht := cavity_labeled_log_mean n (chainExponent cut) + (chainExponent_admissible hcut hfirst hlast) S₀ (H n) S K L (c • 1) + (restrictedSpinPrior T hT) hv.1 + refine ⟨ht.1, ?_⟩ + rw [ht.2] + exact hv.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteLogEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteLogEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0803aae4f91d3a4635b72c8883ec1ad55e2656d7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteLogEvaluation.lean @@ -0,0 +1,208 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteCovariancePath +import OAI.Probability.InvariantIsing.Fields.PriorFullLogEvaluation +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldLogNormalizer +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteEvaluation +import OAI.Probability.InvariantIsing.Cavity.CavityFieldResidual + +namespace OAI + +/-! The actual finite spectral cavity logarithmic normalizer is exactly +its variational trial value. All covariance and precision requirements +are derived from the finite spectrum and its block geometry. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_log_evaluation + {m d N n : ℕ} (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (counts : Fin m → ℕ) (hcounts_le : ∀ a, counts a ≤ N) + (hcounts : ∀ a, (Finset.univ.filter (fun i => g i = a)).card = N - counts a) + (hcounts_rho : ∀ a, (counts a : ℝ) = (N : ℝ) * rho a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + let P := (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n (chainExponent cut) + (cavityGaussianMarks S) : Measure (NoiseTree (EuclideanSpace ℝ (Fin d)) n)) + Integrable (cavityRootedLogNormalizer n K (H n) L (c • 1) (restrictedSpinPrior T hT)) P ∧ + (N : ℝ)⁻¹ * (∫ ω, cavityRootedLogNormalizer n K (H n) L (c • 1) + (restrictedSpinPrior T hT) ω ∂P) + (N : ℝ)⁻¹ * + (Real.log T.card - N * Real.log 2) = + constrainedBlockValue T h + fieldPairing p h / 2 + spectralFunctional (finiteR rho lam hrho hsum) p := by + intro hq0 h H S S₀ K L c P + let x := cavityFiniteDeficitPath p q + have hx (i : ℕ) : 0 < x i := + cavityFiniteDeficitPath_pos p cut hfirst hlast q hq.monotone hp htop i + have hxm : Antitone x := cavityFiniteDeficitPath_antitone p q hq.monotone + have hK : K.transpose = K := by + dsimp only [K, cavityRepeatedSpectrum] + simp only [Matrix.transpose_sub, Matrix.transpose_mul, Matrix.transpose_transpose, + Matrix.diagonal_transpose, Matrix.mul_assoc] + have hH (i : ℕ) : (H i).transpose = H i := + cavityFiniteCovariancePath_symmetric rho lam hrho hsum g p q i + have hS (i : ℕ) : (S i).PosSemidef := + cavityFiniteNoiseCovariance_posSemidef rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop i + have hS₀ : S₀.PosSemidef := + cavityFiniteCovariance_root_posSemidef rho lam hrho hsum g (hx 0) (hq0 0) + have hdet (i : ℕ) : IsUnit (1 - H i * K).det := + cavity_finite_tilt_isUnit rho lam hrho hsum B hB g (x i) (hx i) + have hΔ (i : ℕ) : H i - H (i + 1) = chainExponent cut i • S i := + cavityFiniteNoiseCovariance_delta rho lam hrho hsum g p cut hcut hfirst q i + have hA := cavity_finite_spectral_upper lam a ha B hB + have hQ (i : ℕ) : (cavityFactorPrecision + (chainExponent cut i • cavityBackwardQuadratic K (H (i + 1))) (CFC.sqrt (S i))).PosDef := + cavityFiniteCovariance_step_precision rho lam hrho hsum g _ a hK hA + (hx (i + 1)) (hxm (Nat.le_succ i)) (finite_chainExponent_pos cut hcut hfirst i).le + (S i) (hS i) (hΔ i) + have hR : (H n).PosSemidef := + (cavityFiniteCovariancePath_posDef rho lam hrho hsum g p cut hfirst hlast q hq hp htop n).posSemidef + have hQR : (cavityFactorPrecision K (CFC.sqrt (H n))).PosDef := + cavityFiniteCovariance_terminal_precision rho lam hrho hsum g _ a (fun i => ha (g i)) hK hA (hx n) + have hcov (i : ℕ) (hi : i < n) : + L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = + (fieldStepVariance h i : ℝ) • 1 := by + let k : Fin n := ⟨i, hi⟩ + have he := cavity_finite_projected_innovation rho lam hrho hsum B hB hBE hcomplete g + (x i) (x (i + 1)) (chainExponent cut i) (hx i) (hx (i + 1)) + (finite_chainExponent_pos cut hcut hfirst i).ne' (S i) (hΔ i) + change L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = _ at he + rw [he] + have hv := cavityFieldStep_variance rho lam hrho hsum p cut hcut hfirst hlast + q hq hq0 hp htop k + change (fieldStepVariance h i : ℝ) = _ at hv + rw [hv] + simp only [x, cavityFiniteDeficitPath, show i = (k : ℕ) from rfl, + cavityFiniteLevel_castSucc, cavityFiniteLevel_succ] + rw [chainExponent_apply cut k.isLt] + rfl + have hnonneg : 0 ≤ finiteR rho lam hrho hsum (x n) - c := by + apply sub_nonneg.mpr + have hc : c = ∑ a, rho a * lam a := by simp [c, finiteR] + rw [hc] + exact mean_le_finiteR rho lam hrho hsum (hx n) + let v : ℝ≥0 := (finiteR rho lam hrho hsum (x n) - c).toNNReal + have hres : L.transpose * cavityResolvent K (H n) * L = (v : ℝ) • 1 := by + rw [show (v : ℝ) = finiteR rho lam hrho hsum (x n) - c from Real.coe_toNNReal _ hnonneg] + exact cavity_finite_projected_residual rho lam hrho hsum B hB hBE hcomplete g (x n) (hx n) + have hroot : L.transpose * ((1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose) * L = + h.height 0 • 1 := by + have hv := cavityFieldStep_root_variance rho lam hrho hsum p cut hcut hfirst hlast + q hq.monotone hq0 hp htop + change h.height 0 = _ at hv + have hroot := cavity_finite_projected_scaled_root rho lam hrho hsum B hB hBE hcomplete + g (x 0) (q 0) (hx 0) + change L.transpose * ((1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose) * L = _ at hroot + rw [hroot, hv] + simp only [x, cavityFiniteDeficitPath, cavityFiniteLevel_zero] + have he := prior_cavity_full_log_evaluation hN (restrictedSpinPrior T hT) h K H S S₀ hS₀ L c hK hH hS + (fun i => field_chainExponent_pos h i) hdet hΔ hQ hR hQR v hcov hres hroot + have heq : (∫ ω, cavityRootedLogNormalizer n K (H n) L (c • 1) + (restrictedSpinPrior T hT) ω ∂P) = + Matrix.trace (S₀ * cavityBackwardQuadratic K (H 0)) / 2 - + (∑ i ∈ Finset.range n, cavityDeterminantStep K H (chainExponent cut) i) - + Real.log (1 - H n * K).det / 2 + (N : ℝ) * (c + v) / 2 + + ∫ z, cascadeRecursion h.depth (chainExponent h.cut) + (fun i => vectorGaussianLaw N (fieldStepVariance h i)) + (fun _ p => p.1 + p.2) (fun y => finiteLogIntegral (restrictedSpinPrior T hT : Measure (Spin N)) (fieldEnergy y)) z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _) := he.2 + refine ⟨he.1, ?_⟩ + rw [heq] + let Hf := fun j : Fin (n + 1) => + (finiteInverse rho lam hrho hsum (deficit p (q j)) • (1 : Matrix (Fin d) (Fin d) ℝ) - + Matrix.diagonal (fun i => lam (g i)))⁻¹ + have hHf (j : Fin (n + 1)) : H j = Hf j := by + have hl : cavityFiniteLevel n (j : ℕ) = j := by + apply Fin.ext + exact min_eq_left (Nat.le_of_lt_succ j.isLt) + dsimp only [H, cavityFiniteCovariancePath, cavityFiniteCovariance, + cavityFiniteDeficitPath, Hf] + rw [hl] + have hsteps : (∑ i ∈ Finset.range n, cavityDeterminantStep K H (chainExponent cut) i) = + ∑ i : Fin n, Real.log ((1 - Hf i.castSucc * K).det / (1 - Hf i.succ * K).det) / + (2 * cut i.castSucc.succ) := by + rw [← Fin.sum_univ_eq_sum_range] + apply Finset.sum_congr rfl + intro i _ + have hi : H (i : ℕ) = Hf i.castSucc := hHf i.castSucc + have hj : H ((i : ℕ) + 1) = Hf i.succ := hHf i.succ + rw [cavityDeterminantStep, chainExponent_apply cut i.isLt, hi, hj] + rfl + have hquad := cavity_finite_quadratic_mean rho lam hrho hsum B hB hBE hcomplete + g counts hcounts_le hcounts hcounts_rho p cut hcut hfirst hlast q hq hp htop + change cavityFiniteQuadraticMean K Hf S₀ cut = _ at hquad + unfold cavityFiniteQuadraticMean at hquad + have hzero : H 0 = Hf 0 := hHf 0 + have hlastH : H n = Hf (Fin.last n) := hHf (Fin.last n) + rw [hsteps, hzero, hlastH, hquad] + have hraw := restrictedFieldRecursion_root_integrable hN T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (NNReal.mk (h.height 0) (h.nonneg 0)) + simp_rw [restricted_normalized_field_recursion hN T hT _ _ _ + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1)] + rw [integral_sub hraw (integrable_const _)] + simp only [integral_const, probReal_univ, one_smul] + have htail := cavityField_residual rho lam hrho hsum p htop.le + ((finite_overlap_ae_bounds p cut hfirst hlast q hq.monotone hp).mono (fun _ h => h.2)) + change cavityFieldDiagonal rho lam hrho hsum p - h.height (Fin.last h.depth) = + finiteR rho lam hrho hsum (deficit p (q (Fin.last n))) - c at htail + have hv : (v : ℝ) = cavityFieldDiagonal rho lam hrho hsum p - h.height (Fin.last h.depth) := by + rw [show (v : ℝ) = finiteR rho lam hrho hsum (x n) - c from Real.coe_toNNReal _ hnonneg] + simpa only [x, cavityFiniteDeficitPath, cavityFiniteLevel_last] using htail.symm + rw [hv] + have hNr : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN.ne' + have hvalue := cavity_finite_value_identity rho lam hrho hsum p cut hcut hfirst hlast + q hq.monotone hq0 hp + change fieldValue h 0 + _ = _ at hvalue + have hdeterministic : (c + cavityFieldDiagonal rho lam hrho hsum p - + (∫ r in 0..1, cavityNormalizerDensity rho lam hrho hsum p r)) / 2 = + fieldPairing p h / 2 + spectralFunctional (finiteR rho lam hrho hsum) p := by + change fieldValue h 0 + + (c + cavityFieldDiagonal rho lam hrho hsum p - + (∫ r in 0..1, cavityNormalizerDensity rho lam hrho hsum p r)) / 2 = + fieldValue h 0 + fieldPairing p h / 2 + spectralFunctional (finiteR rho lam hrho hsum) p + at hvalue + linarith only [hvalue] + unfold constrainedBlockValue + rw [show (N : ℝ)⁻¹ * (-((N : ℝ) / 2) * + (∫ r in 0..1, cavityNormalizerDensity rho lam hrho hsum p r) + + (N : ℝ) * (c + (cavityFieldDiagonal rho lam hrho hsum p - h.height (Fin.last h.depth))) / 2 + + ((∫ z, restrictedFieldRecursion T h.depth (chainExponent h.cut) (fieldStepVariance h) z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) - + (Real.log T.card - N * Real.log 2))) + + (N : ℝ)⁻¹ * (Real.log T.card - N * Real.log 2) = + (N : ℝ)⁻¹ * (∫ z, restrictedFieldRecursion T h.depth (chainExponent h.cut) (fieldStepVariance h) z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) - + h.height (Fin.last h.depth) / 2 + + (c + cavityFieldDiagonal rho lam hrho hsum p - + (∫ r in 0..1, cavityNormalizerDensity rho lam hrho hsum p r)) / 2 by + field_simp + ring] + rw [hdeterministic] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteModelDepth.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteModelDepth.lean new file mode 100644 index 0000000000000000000000000000000000000000..abcf6b7de5a9b0b721663f9d5d80a0b7e8c1f48c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteModelDepth.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteModelSpinTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteDepthTest +import OAI.Probability.InvariantIsing.Fields.PriorLabeledDepthMean + +namespace OAI + +/-! Common-depth preservation in the actual normalized finite spectral model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_model_depth_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ ω, priorCavityLabeledDepthMean n K (H n) L (c • 1) (restrictedSpinPrior T hT) + (fun i => Φ (q (fieldDepthLevel h i))) ω + ∂cavityLabeledDisorderLaw n (chainExponent cut) S₀ S) = + ∫ t, Φ (p t) ∂pathMeasure := by + intro hq0 h H S S₀ K L c + have hI := cavity_finite_original_integrability rho lam hrho hsum B hB g a ha + p cut hcut hfirst hlast q hq hp htop L (c • 1) (restrictedSpinPrior T hT) + have hAtom (i : ℕ) (hi : i < n) : + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i)) := + cavityFiniteNoiseCovariance_atomless rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop hd i hi + rw [integral_priorCavityLabeledDepthMean n (chainExponent cut) K (H n) S₀ S L (c • 1) (restrictedSpinPrior T hT) + (chainExponent_admissible hcut hfirst hlast) hAtom hI] + rw [← cavity_rooted_depth_test_disintegration n K (H n) L (c • 1) + (restrictedSpinPrior T hT) _ _ (fun i => hΦ (q (fieldDepthLevel h i)))] + exact restricted_cavity_finite_depth_test hpub hd hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha p cut hcut hfirst hlast q hq hp htop Φ hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteModelSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteModelSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..581ceca23a15f4124af8497b9448b19250bd4513 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteModelSpin.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteSpinTest +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteOriginalIntegrability +import OAI.Probability.InvariantIsing.Fields.PriorLabeledModelSpin + +namespace OAI + +/-! The full normalized finite-model spin test equals the scalar-field +magnetization path appearing in the pressure lower bound. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_model_spin_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ ω, priorCavityLabeledSpinDepthMean n K (H n) L (c • 1) (restrictedSpinPrior T hT) + (fun i => Φ (q (fieldDepthLevel h i))) j ω + ∂cavityLabeledDisorderLaw n (chainExponent cut) S₀ S) = + ∫ t, Φ (p t) * + (∫ z, restrictedPairCoordinateMean hN T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h t) j z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) ∂pathMeasure := by + intro hq0 h H S S₀ K L c + have hI := cavity_finite_original_integrability rho lam hrho hsum B hB g a ha + p cut hcut hfirst hlast q hq hp htop L (c • 1) (restrictedSpinPrior T hT) + have hAtom (i : ℕ) (hi : i < n) : + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i)) := + cavityFiniteNoiseCovariance_atomless rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop hd i hi + rw [integral_priorCavityLabeledSpinDepthMean n (chainExponent cut) K (H n) S₀ S L (c • 1) (restrictedSpinPrior T hT) + (chainExponent_admissible hcut hfirst hlast) hAtom hI] + rw [← cavity_rooted_spin_test_disintegration n K (H n) L (c • 1) + (restrictedSpinPrior T hT) _ _ j (fun i => hΦ (q (fieldDepthLevel h i)))] + exact restricted_cavity_finite_spin_test hpub hd hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha p cut hcut hfirst hlast q hq hp htop Φ j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteNormalizedSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteNormalizedSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..af30b71ca366007f2b481f8829ea2d70788f11d7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteNormalizedSpin.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteModelSpin +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCoordinateOverlap +import OAI.Probability.InvariantIsing.Fields.PriorLabeledSpinObservable + +namespace OAI + +/-! The normalized spectral-block spin observable has exactly the +finite scalar-field value needed for the physical cavity limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_finite_normalized_spin_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) (hΦc : Continuous Φ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ ω, cavityWeightedReplicaMean + (cavityLabeledPriorKernel n (H n) (restrictedSpinPrior T hT) ω) + (fun x => Real.exp (cavityLabeledPotential n K L (c • 1) (ω,x))) + (fun ξ => cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p q) + (cavitySpinObservable Φ hΦc j) (ω,ξ)) + ∂cavityLabeledDisorderLaw n (chainExponent cut) S₀ S) = + ∫ t, Φ (p t) * restrictedCoordinateOverlapPath hN T hT h j t ∂pathMeasure := by + intro hq0 h H S S₀ K L c + have hqmem := fun i => finite_overlap_value_mem_unit p cut hcut q hp i + simp_rw [prior_cavity_labeled_spin_observable rho lam hrho hsum p q hqmem K (H n) L + (c • 1) (restrictedSpinPrior T hT) Φ hΦc j] + exact restricted_cavity_finite_model_spin_test hpub hd hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha p cut hcut hfirst hlast q hq hp htop Φ j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteSpinTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteSpinTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..64273c070b1b64d21e7d4094114265d5887d561b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteSpinTest.lean @@ -0,0 +1,135 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteCovariancePath +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullSpinTest + +namespace OAI + +/-! The full quadratic cavity spin test specialized to a genuine finite +spectral law and overlap quantile. All matrix and scalar covariance +hypotheses of the marking calculation are discharged here. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_spin_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let hq0 := fun i => (finite_overlap_value_mem_unit p cut hcut q hp i).1 + let h := cavityFieldStep rho lam hrho hsum p cut hcut hfirst hlast q hq.monotone hq0 + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ σ, cavityRootedSpinDepthTest (fun i => Φ (q (fieldDepthLevel h i))) j σ + ∂((probabilityReplicaKernel + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)) + (cavityRootedFullGibbs n K (H n) L (c • 1) (restrictedSpinPrior T hT)).measurable) + ∘ₘ (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) n (chainExponent cut) + (cavityGaussianMarks S) : Measure _))) = + ∫ t, Φ (p t) * + (∫ z, restrictedPairCoordinateMean hN T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h t) j z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) ∂pathMeasure := by + intro hq0 h H S S₀ K L c + let x := cavityFiniteDeficitPath p q + have hx (i : ℕ) : 0 < x i := + cavityFiniteDeficitPath_pos p cut hfirst hlast q hq.monotone hp htop i + have hxm : Antitone x := cavityFiniteDeficitPath_antitone p q hq.monotone + have hK : K.transpose = K := by + dsimp only [K, cavityRepeatedSpectrum] + simp only [Matrix.transpose_sub, Matrix.transpose_mul, Matrix.transpose_transpose, + Matrix.diagonal_transpose, Matrix.mul_assoc] + have hH (i : ℕ) : (H i).transpose = H i := + cavityFiniteCovariancePath_symmetric rho lam hrho hsum g p q i + have hS (i : ℕ) : (S i).PosSemidef := + cavityFiniteNoiseCovariance_posSemidef rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop i + have hS₀ : S₀.PosSemidef := + cavityFiniteCovariance_root_posSemidef rho lam hrho hsum g (hx 0) (hq0 0) + have hdet (i : ℕ) : IsUnit (1 - H i * K).det := + cavity_finite_tilt_isUnit rho lam hrho hsum B hB g (x i) (hx i) + have hΔ (i : ℕ) : H i - H (i + 1) = chainExponent cut i • S i := + cavityFiniteNoiseCovariance_delta rho lam hrho hsum g p cut hcut hfirst q i + have hA := cavity_finite_spectral_upper lam a ha B hB + have hQ (i : ℕ) : (cavityFactorPrecision + (chainExponent cut i • cavityBackwardQuadratic K (H (i + 1))) (CFC.sqrt (S i))).PosDef := + cavityFiniteCovariance_step_precision rho lam hrho hsum g _ a hK hA + (hx (i + 1)) (hxm (Nat.le_succ i)) (finite_chainExponent_pos cut hcut hfirst i).le + (S i) (hS i) (hΔ i) + have hR : (H n).PosSemidef := + (cavityFiniteCovariancePath_posDef rho lam hrho hsum g p cut hfirst hlast q hq hp htop n).posSemidef + have hQR : (cavityFactorPrecision K (CFC.sqrt (H n))).PosDef := + cavityFiniteCovariance_terminal_precision rho lam hrho hsum g _ a (fun i => ha (g i)) hK hA (hx n) + have hAtom (i : ℕ) (hi : i < n) : + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i)) := + cavityFiniteNoiseCovariance_atomless rho lam hrho hsum g p cut hcut hfirst hlast + q hq hp htop hd i hi + have hcov (i : ℕ) (hi : i < n) : + L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = + (fieldStepVariance h i : ℝ) • 1 := by + let k : Fin n := ⟨i, hi⟩ + have he := cavity_finite_projected_innovation rho lam hrho hsum B hB hBE hcomplete g + (x i) (x (i + 1)) (chainExponent cut i) (hx i) (hx (i + 1)) + (finite_chainExponent_pos cut hcut hfirst i).ne' (S i) (hΔ i) + change L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = _ at he + rw [he] + have hv := cavityFieldStep_variance rho lam hrho hsum p cut hcut hfirst hlast + q hq hq0 hp htop k + change (fieldStepVariance h i : ℝ) = _ at hv + rw [hv] + simp only [x, cavityFiniteDeficitPath, show i = (k : ℕ) from rfl, + cavityFiniteLevel_castSucc, cavityFiniteLevel_succ] + rw [chainExponent_apply cut k.isLt] + rfl + have hnonneg : 0 ≤ finiteR rho lam hrho hsum (x n) - c := by + apply sub_nonneg.mpr + have hc : c = ∑ a, rho a * lam a := by simp [c, finiteR] + rw [hc] + exact mean_le_finiteR rho lam hrho hsum (hx n) + let v : ℝ≥0 := (finiteR rho lam hrho hsum (x n) - c).toNNReal + have hres : L.transpose * cavityResolvent K (H n) * L = (v : ℝ) • 1 := by + rw [show (v : ℝ) = finiteR rho lam hrho hsum (x n) - c from Real.coe_toNNReal _ hnonneg] + exact cavity_finite_projected_residual rho lam hrho hsum B hB hBE hcomplete g (x n) (hx n) + have hroot : L.transpose * ((1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose) * L = + h.height 0 • 1 := by + have hv := cavityFieldStep_root_variance rho lam hrho hsum p cut hcut hfirst hlast + q hq.monotone hq0 hp htop + change h.height 0 = _ at hv + have hroot := cavity_finite_projected_scaled_root rho lam hrho hsum B hB hBE hcomplete + g (x 0) (q 0) (hx 0) + change L.transpose * ((1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose) * L = _ at hroot + rw [hroot, hv] + simp only [x, cavityFiniteDeficitPath, cavityFiniteLevel_zero] + have he := restricted_cavity_full_spin_test_evaluation hpub hN T hT h K H S S₀ hS₀ L c hK hH hS + (fun i => field_chainExponent_pos h i) hdet hΔ hQ hR hQR hAtom v hcov hres hroot q Φ j hΦ + apply he.trans + apply integral_congr_ae + filter_upwards [ae_finite_overlap_cell cut hfirst hlast] with t ht + obtain ⟨i, hi⟩ := ht + have hindex : fieldLevelIndex h t = i := fieldLevelIndex_on_cell h i hi + rw [hindex, hp i t hi] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteTrialLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteTrialLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bc02aa4278aacb1daf8520fa115e19ed1266ec0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFiniteTrialLower.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteLabeledLog +import OAI.Probability.InvariantIsing.Cavity.CavityPreliminaryLower +import OAI.Probability.InvariantIsing.Cavity.CavityStrictFiniteSpin + +namespace OAI + +/-! The preliminary logarithmic lower bound in the manuscript's exact +finite-field trial-value coordinates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_cavity_finite_trial_preliminary_lower + {m d N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (counts : Fin m → ℕ) (hcounts_le : ∀ a, counts a ≤ N) + (hcounts : ∀ a, (Finset.univ.filter (fun i => g i = a)).card = N - counts a) + (hcounts_rho : ∀ a, (counts a : ℝ) = (N : ℝ) * rho a) + (p : OverlapPath) + (A : ℕ → ℝ) (cap : ℝ → ℕ → ℝ) (hu : ∀ T > 0, ∀ n, cap T n ≤ A n) : + let p' := cavityStrictUniformPath p + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + let Q := fun n => cavityLabeledDisorderLaw n (chainExponent (uniformCut n)) + (cavityFiniteRootCovariance rho lam hrho hsum g (p' n) (cavityStrictUniformLevels p n)) + (cavityFiniteNoiseCovariance rho lam hrho hsum g (p' n) (uniformCut n) + (cavityStrictUniformLevels p n)) + let η := fun n => cavityLabeledPriorKernel n + (cavityFiniteCovariancePath rho lam hrho hsum g (p' n) (cavityStrictUniformLevels p n) n) + (restrictedSpinPrior S hS) + (∀ T > 0, Tendsto (fun n => cap T n - + ∫ ω, Real.log (∫ x, Real.exp (min (cavityLabeledPotential n K L (c • 1) (ω,x)) T) + ∂η n ω) ∂Q n) atTop (𝓝 0)) → + ∀ ε > 0, ∀ᶠ n in atTop, + constrainedBlockValue S (cavityStrictUniformField rho lam hrho hsum p n) + + fieldPairing (p' n) (cavityStrictUniformField rho lam hrho hsum p n) / 2 + + spectralFunctional (finiteR rho lam hrho hsum) (p' n) - (N : ℝ)⁻¹ * (A n + (Real.log S.card - N * Real.log 2)) < ε := by + intro p' K L c Q η hcap ε hε + have hn : 0 < (N : ℝ) := Nat.cast_pos.mpr hN + have hlower := cavity_finite_preliminary_lower rho lam hrho hsum B hB g a ha p + L (c • 1) (restrictedSpinPrior S hS) A cap hu hcap + filter_upwards [hlower (ε * N) (mul_pos hε hn)] with j hj + have hv := restricted_cavity_finite_labeled_log_evaluation hN S hS rho lam hrho hsum B hB hBE hcomplete + g a ha counts hcounts_le hcounts hcounts_rho (p' j) (uniformCut j) (uniformCut_strict j) + (uniformCut_zero j) (uniformCut_last j) (cavityStrictUniformLevels p j) + (cavityStrictUniformLevels_strict p j) (cavityStrictUniformPath_on_cell p j) + (cavityStrictUniformLevels_mem p j (Fin.last j)).2 + have he : (N : ℝ)⁻¹ * + (∫ ω, Real.log (∫ x, Real.exp (cavityLabeledPotential j K L (c • 1) (ω,x)) ∂η j ω) ∂Q j) + (N : ℝ)⁻¹ * (Real.log S.card - N * Real.log 2) = + constrainedBlockValue S (cavityStrictUniformField rho lam hrho hsum p j) + + fieldPairing (p' j) (cavityStrictUniformField rho lam hrho hsum p j) / 2 + + spectralFunctional (finiteR rho lam hrho hsum) (p' j) := hv.2 + calc + _ = (N : ℝ)⁻¹ * ((∫ ω, Real.log + (∫ x, Real.exp (cavityLabeledPotential j K L (c • 1) (ω,x)) ∂η j ω) ∂Q j) - A j) := by + rw [mul_sub] + linarith [he] + _ < (N : ℝ)⁻¹ * (ε * N) := mul_lt_mul_of_pos_left hj (inv_pos.mpr hn) + _ = ε := by field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFixedMinimumLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFixedMinimumLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa9a9fa2407748340e20a36eeda89d3e679d72c7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFixedMinimumLimit.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalGG +import OAI.Probability.InvariantIsing.Fields.PriorFixedMinimumLimit + +namespace OAI + +/-! Physical GG/Ward limits preserve any specified sequence of constrained minima. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem restricted_fixed_minimum_geometric_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (S : (k : ℕ) → Finset (Spin (N k))) (hS : ∀ k, (S k).Nonempty) + (μ : (k : ℕ) → Measure (Orthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + [∀ k, (μ k).IsMulRightInvariant] + (θ : ℕ → Measure (LabeledTree 0)) [∀ k, IsProbabilityMeasure (θ k)] + (eig : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) + (u : (k : ℕ) → Fin (N k) → ℝ) (hu : ∀ k j, u k j∈Set.Icc (1 : ℝ) 2) + (v : ℕ → Fin m → ℝ) (hv : ∀ k a, v k a∈Set.Icc (1 : ℝ) 2) + (hmin : ∀ k u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective (cavityOrientedBaseLaw (by have := hN k; omega) (μ k)) + (restrictedZeroTreePrior (S k) (hS k)) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) (u k) (v k)≤ + priorPerturbationObjective (cavityOrientedBaseLaw (by have := hN k; omega) (μ k)) + (restrictedZeroTreePrior (S k) (hS k)) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) u' v') : + ∃ Q : ProbabilityMeasure (SpectralArray (m+1)), + ∃ q : Fin (m+1) → Set.Icc (0 : ℝ) 1, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun k => restrictedRotationArrayLaw (S (φ k)) (hS (φ k)) (μ (φ k)) (θ (φ k)) + (diagonalPerturbedEigenvalues (eig (φ k)) (I (φ k)) (v (φ k)) 1) + (I (φ k)) (cavityBaseAmplitude (u (φ k)))) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) ∧ + (∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ r, |Φ r|≤B) → + spectralOffWardResidual Q ρ lam a b Φ=0) ∧ + (∀ a b, spectralDiagonalWardResidual Q ρ lam a b=0) := by + have hpos k : 0 cavityOrientedBaseLaw (hpos k) (μ k)) + (fun k => cavityOrientedBaseLaw_leftInvariant (hpos k) (μ k)) + (fun k => restrictedZeroTreePrior (S k) (hS k)) eig K hK heig I hdis hcover lam hlam ρ hρ u hu v hv hmin + refine ⟨Q,q,φ,hφ,?_,hgg,hd,hG,hE,hP,hn,hoff,hdiag⟩ + apply hL.congr + intro k + exact (restricted_zero_tree_perturbed_array_law (hpos (φ k)) (S (φ k)) (hS (φ k)) + (μ (φ k)) (θ (φ k)) (eig (φ k)) (I (φ k)) (u (φ k)) (v (φ k)) 1).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFrameLogBound.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFrameLogBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..81d0d68d34be55bdf194d3562d5b49d29574a15b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFrameLogBound.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorLog +import OAI.Probability.InvariantIsing.Cavity.CavityFrameLogBound + +namespace OAI + +/-! Finite bounds for the constrained cavity logarithm on orthonormal frames. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_projector_capped_log_bound {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (R : Finset (Spin n)) (hR : R.Nonempty) + (g : Fin N → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (A : CavityFactorBlocks d n) {D : ℝ} + (hA : cavityFactorSize A.1 A.2.1 A.2.2 ≤ D) + (p : CavityProjectorFrame N m d) + (hp : p.1=fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) + (hFrame : p.2.transpose*p.2=1) : + |restrictedProjectorCappedLog S hS R hR T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ A p| ≤ (|t| *D+|δ|)*(1+N) := by + rw [restricted_projector_capped_log S hS R hR g V T lam v u t cap δ A p hp] + let eig := diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t + let X := (Spin N × LabeledLeaf depth) × Spin n + let ν : Measure X := (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior R hR : Measure (Spin n)) + let H : X → ℝ := fun x => rotatedEnergy eig (matrixRotation V⁻¹) x.1.1 + let C : X → ℕ →₀ ℝ := fun x => cavityPerturbationCoefficients (matrixRotation V⁻¹) + (cavitySpectralGroup g) u depth x.1 + let W : X → ℝ := fun x => + min (t*cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) cap - + δ*(1+‖cavityFrameCoordinates p.2 x.1.1‖^2) + have hH (x : X) : |H x| ≤ ∑ σ : Spin N, |rotatedEnergy eig (matrixRotation V⁻¹) σ| := + Finset.single_le_sum (f := fun σ : Spin N => |rotatedEnergy eig (matrixRotation V⁻¹) σ|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ x.1.1) + have hC (x : X) : (C x).sum (fun _ c => c^2) ≤ 4*(N*perturbationScale N^2) := + cavityPerturbationCoefficients_sq_le (matrixRotation V⁻¹) (cavitySpectralGroup g) u hu x.1 + have hW (x : X) : |W x| ≤ (|t| *D+|δ|)*(1+N) := + cavity_frame_capped_potential_bound p.2 hFrame A hA t cap δ hcap x.1.1 x.2 + exact cavity_bounded_log_weight_mean_bound ν H hH C hC W hW + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullSpinAverage.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullSpinAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e5fd513221c2145eed3c46203f414a214d62211 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullSpinAverage.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTest +import OAI.Probability.InvariantIsing.Cavity.RepeatedBlockSpinIdentity +import OAI.Probability.InvariantIsing.Cavity.CavitySplitSpinTest + +namespace OAI + +/-! Finite coordinate averaging of full constrained spin tests. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators BoundedContinuousFunction +namespace InvariantIsing + +lemma restricted_full_spin_average {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (Φ : ℝ →ᵇ ℝ) (site : Fin n → Fin N) : + restrictedFullTest S hS μ T eig I u (fun σ => Φ (cavityReplicaOverlap σ) * + ((n : ℝ)⁻¹ * ∑ i, spinValue ((σ 0).1 (site i)) * spinValue ((σ 1).1 (site i)))) = + (n : ℝ)⁻¹ * ∑ i, restrictedFullTest S hS μ T eig I u (cavityFullSpinInsertion Φ (site i)) := by + have he : (fun (_ : SpecialOrthogonal N) (σ : Fin 2 → Spin N × LabeledLeaf depth) => + Φ (cavityReplicaOverlap σ) * ((n : ℝ)⁻¹ * ∑ i, + spinValue ((σ 0).1 (site i)) * spinValue ((σ 1).1 (site i)))) = + (fun U σ => (n : ℝ)⁻¹ * ∑ i, (fun _ => cavityFullSpinInsertion Φ (site i)) U σ) := by + funext U σ + simp only [cavityFullSpinInsertion, ← Finset.mul_sum] + ring + unfold restrictedFullTest + rw [he, restrictedCavityFullDisorderTest_const_mul] + congr 1 + apply restrictedCavityFullDisorderTest_sum S hS μ T eig I u + (fun i _ => cavityFullSpinInsertion Φ (site i)) + (fun i => (measurable_of_countable _).comp measurable_snd) (norm_nonneg Φ) + intro i U σ + simpa only [cavityFullSpinInsertion, abs_mul, abs_spinValue, mul_one, one_mul, Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityReplicaOverlap σ) + +lemma restricted_full_tree_spin_average {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (Φ : ℝ →ᵇ ℝ) (site : Fin n → Fin N) : + (∫ T, restrictedFullTest S hS μ T eig I u (fun σ => Φ (cavityReplicaOverlap σ) * + ((n : ℝ)⁻¹ * ∑ i, spinValue ((σ 0).1 (site i)) * spinValue ((σ 1).1 (site i)))) ∂θ) = + (n : ℝ)⁻¹ * ∑ i, ∫ T, restrictedFullTest S hS μ T eig I u + (cavityFullSpinInsertion Φ (site i)) ∂θ := by + simp_rw [restricted_full_spin_average S hS μ _ eig I u Φ site] + rw [integral_const_mul, integral_finsetSum] + intro i _ + apply integrable_of_measurable_abs_le + (measurable_restrictedFullTest_tree S hS μ eig I u _) + intro T + change |restrictedCavityFullDisorderTest S hS μ T eig I u + (fun _ => cavityFullSpinInsertion Φ (site i))| ≤ ‖Φ‖ + apply restrictedCavityFullDisorderTest_abs_le S hS μ T eig I u + (fun _ => cavityFullSpinInsertion Φ (site i)) + ((measurable_of_countable (cavityFullSpinInsertion Φ (site i))).comp measurable_snd) (norm_nonneg Φ) + intro U σ + simpa only [cavityFullSpinInsertion, abs_mul, abs_spinValue, mul_one, one_mul, Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityReplicaOverlap σ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullSpinTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullSpinTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..99f211d1b355e6a51d4bc0733a08f566e3179f80 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullSpinTest.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLinearNoiseEvaluation +import OAI.Probability.InvariantIsing.Cavity.CavityInnovationAtomless + +namespace OAI + +/-! The full quadratic cavity spin test, evaluated through its actual +rooted innovation law and the published finite marking specialization. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator NNReal + +namespace InvariantIsing + +theorem restricted_cavity_full_spin_test_evaluation (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (K : Matrix (Fin d) (Fin d) ℝ) (H S : ℕ → Matrix (Fin d) (Fin d) ℝ) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (c : ℝ) + (hK : K.transpose = K) (hH : ∀ i, (H i).transpose = H i) + (hS : ∀ i, (S i).PosSemidef) + (hb : ∀ i, 0 < chainExponent h.cut i) + (hdet : ∀ i, IsUnit (1 - H i * K).det) + (hΔ : ∀ i, H i - H (i + 1) = chainExponent h.cut i • S i) + (hQ : ∀ i, (cavityFactorPrecision + (chainExponent h.cut i • cavityBackwardQuadratic K (H (i + 1))) + (CFC.sqrt (S i))).PosDef) + (hR : (H h.depth).PosSemidef) + (hQR : (cavityFactorPrecision K (CFC.sqrt (H h.depth))).PosDef) + (hAtom : ∀ i < h.depth, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (v : ℝ≥0) + (hcov : ∀ i < h.depth, + L.transpose * ((1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose) * L = + (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * cavityResolvent K (H h.depth) * L = (v : ℝ) • 1) + (hroot : L.transpose * ((1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose) * L = + h.height 0 • 1) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin k) + {B : ℝ} (hΦ : ∀ x, |Φ x| ≤ B) : + (∫ σ, cavityRootedSpinDepthTest (fun i => Φ (q (fieldDepthLevel h i))) j σ + ∂((probabilityReplicaKernel + (cavityRootedFullGibbs h.depth K (H h.depth) L (c • 1) (restrictedSpinPrior T hT)) + (cavityRootedFullGibbs h.depth K (H h.depth) L (c • 1) (restrictedSpinPrior T hT)).measurable) + ∘ₘ (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀).prod + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _))) = + ∫ t, Φ (q (fieldLevelIndex h t)) * + (∫ z, restrictedPairCoordinateMean hk T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h t) j z + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) ∂pathMeasure := by + let b := chainExponent h.cut + let S' := fun i => (1 - H i * K)⁻¹ * S i * ((1 - H (i + 1) * K)⁻¹).transpose + let S₀' := (1 - H 0 * K)⁻¹ * S₀ * ((1 - H 0 * K)⁻¹).transpose + let R := cavityResolvent K (H h.depth) + have hbC := chainExponent_admissible h.ordered_cut h.first h.last + have hS' (i : ℕ) : (S' i).PosSemidef := + cavity_innovation_covariance_posSemidef K (H i) (H (i + 1)) (S i) (hS i) + (b i) (hdet i) (hdet (i + 1)) (hΔ i) (hQ i) + have hS₀' : S₀'.PosSemidef := by + simpa only [Matrix.conjTranspose_eq_transpose_of_trivial] using + hS₀.mul_mul_conjTranspose_same (1 - H 0 * K)⁻¹ + have hR' : R.PosSemidef := cavity_tilt_covariance_posSemidef K (H h.depth) hR hQR + have hAtom' (i : ℕ) (hi : i < h.depth) : + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S' i)) := by + let := hAtom i hi + exact cavity_quadratic_innovation_nullSingleton K (H i) (H (i + 1)) (S i) + hK (hH (i + 1)) (hS i) (b i) (hb i) (hdet i) (hdet (i + 1)) (hΔ i) (hQ i) + rw [cavity_rooted_spin_depth_test_transport h.depth K H S b S₀ hS₀ L (c • 1) + hbC hK hH hS hb hdet hΔ hQ hR hQR (restrictedSpinPrior T hT)] + rw [cavity_rooted_spin_test_product_disintegration h.depth 0 R L (c • 1) + (restrictedSpinPrior T hT) (multivariateGaussian 0 S₀') + (noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth b (cavityGaussianMarks S') : Measure _) + (fun i => Φ (q (fieldDepthLevel h i))) j (fun i => hΦ _)] + exact restricted_cavity_linear_rooted_spin_evaluation hpub hk T hT h S' hS' hAtom' R hR' S₀' hS₀' + L v hcov hres hroot c q Φ j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTail.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..e174ac2342c76c7de089bc41f8bee4410f8e21d8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTail.lean @@ -0,0 +1,174 @@ +import OAI.Probability.InvariantIsing.Cavity.RepeatedBlockSpinIdentity +import OAI.Probability.InvariantIsing.Cavity.CavityFullTail + +namespace OAI + +/-! Cutoff control in the full perturbed model. The bad compression +event is paid for only by its probability, never by an inverse moment. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma restrictedCavityFullDisorderTest_sub {N m depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F G : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hmF : Measurable (Function.uncurry F)) (hmG : Measurable (Function.uncurry G)) + {B : ℝ} (hB : 0 ≤ B) (hF : ∀ U σ, |F U σ| ≤ B) (hG : ∀ U σ, |G U σ| ≤ B) : + restrictedCavityFullDisorderTest S hS μ T eig I u (fun U σ => F U σ - G U σ) = + restrictedCavityFullDisorderTest S hS μ T eig I u F - restrictedCavityFullDisorderTest S hS μ T eig I u G := by + let H : Fin 2 → SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ := + ![F, fun U σ => (-1 : ℝ) * G U σ] + have hmH : ∀ i, Measurable (Function.uncurry (H i)) := by + intro i + fin_cases i + · exact hmF + · exact hmG.const_mul (-1) + have hH : ∀ i U σ, |H i U σ| ≤ B := by + intro i U σ + fin_cases i + · exact hF U σ + · change |(-1 : ℝ) * G U σ| ≤ B + simpa only [neg_one_mul, abs_neg] using hG U σ + have hs := restrictedCavityFullDisorderTest_sum S hS μ T eig I u H hmH hB hH + simp only [Fin.sum_univ_two] at hs + change restrictedCavityFullDisorderTest S hS μ T eig I u (fun U σ => F U σ + (-1 : ℝ) * G U σ) = + restrictedCavityFullDisorderTest S hS μ T eig I u F + + restrictedCavityFullDisorderTest S hS μ T eig I u (fun U σ => (-1 : ℝ) * G U σ) at hs + rw [restrictedCavityFullDisorderTest_const_mul] at hs + simpa only [neg_one_mul, sub_eq_add_neg] using hs + +lemma restrictedCavityFullDisorderTest_le_envelope {N m depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hmF : Measurable (Function.uncurry F)) {B : ℝ} + (hB : 0 ≤ B) (hF : ∀ U σ, |F U σ| ≤ B) + (c : SpecialOrthogonal N → ℝ) (hc : Integrable c μ) + (hc0 : ∀ U, 0 ≤ c U) (hFc : ∀ U σ, F U σ ≤ c U) : + restrictedCavityFullDisorderTest S hS μ T eig I u F ≤ ∫ U, c U ∂μ := by + exact cavity_nested_disorder_upper μ gaussianCoordinates + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (fun U g x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + F (fun _ => measurable_of_countable _) + (measurable_restrictedCavityFullDisorderInner S hS T eig I u F hmF) hB hF c hc hc0 hFc + +theorem restricted_full_radial_cutoff {N m k d depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (axes : Fin k → Fin N) {M₀ : ℝ} + (hmean : restrictedCavityFullDisorderTest S hS μ T eig I u (cavityProjectionAxesTest I axes) ≤ M₀) + (good : Set (SpecialOrthogonal N)) + (hgood : MeasurableSet good) + (y : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → + EuclideanSpace ℝ (Fin d)) + (φ : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hmφ : Measurable (Function.uncurry φ)) (hφ : ∀ U σ, 0 ≤ φ U σ ∧ φ U σ ≤ 1) + {c B : ℝ} (hc : 0 < c) (hB : 0 < B) + (hzero : ∀ U σ, ‖y U σ‖ ≤ B → φ U σ = 0) + (hgeometry : ∀ U ∈ good, ∀ σ, + c * ‖y U σ‖ ^ 2 ≤ cavityProjectionAxesTest I axes U σ) : + restrictedCavityFullDisorderTest S hS μ T eig I u φ ≤ + μ.real goodᶜ + M₀ / (c * B ^ 2) := by + let R := cavityProjectionAxesTest (depth := depth) I axes + let C := (c * B ^ 2)⁻¹ + have hden : 0 < c * B ^ 2 := mul_pos hc (sq_pos_of_pos hB) + have hC : 0 ≤ C := inv_nonneg.mpr hden.le + have hmR : Measurable (Function.uncurry R) := measurable_cavityProjectionAxesTest I axes + have hR0 : ∀ U σ, 0 ≤ R U σ := cavityProjectionAxesTest_nonneg I axes + have hRb : ∀ U σ, |R U σ| ≤ (m : ℝ) * k * N := cavityProjectionAxesTest_bound I axes + have hφb : ∀ U σ, |φ U σ| ≤ 1 := fun U σ => by + rw [abs_of_nonneg (hφ U σ).1] + exact (hφ U σ).2 + have hdom : ∀ U ∈ good, ∀ σ, φ U σ ≤ C * R U σ := by + intro U hU σ + by_cases hy : ‖y U σ‖ ≤ B + · rw [hzero U σ hy] + exact mul_nonneg hC (hR0 U σ) + · have hsq : B ^ 2 ≤ ‖y U σ‖ ^ 2 := + (sq_le_sq₀ hB.le (norm_nonneg _)).mpr (le_of_not_ge hy) + have hprod : c * B ^ 2 ≤ R U σ := + (mul_le_mul_of_nonneg_left hsq hc.le).trans (hgeometry U hU σ) + apply (hφ U σ).2.trans + dsimp only [C] + rw [← div_eq_inv_mul, le_div_iff₀ hden, one_mul] + exact hprod + let M := 1 + C * ((m : ℝ) * k * N) + have hM : 0 ≤ M := by dsimp [M]; positivity + have hφM : ∀ U σ, |φ U σ| ≤ M := by + intro U σ + apply (hφb U σ).trans + dsimp only [M] + exact le_add_of_nonneg_right (mul_nonneg hC (by positivity)) + have hCRM : ∀ U σ, |C * R U σ| ≤ M := by + intro U σ + rw [abs_mul, abs_of_nonneg hC] + exact (mul_le_mul_of_nonneg_left (hRb U σ) hC).trans (by dsimp [M]; linarith) + have hDb : ∀ U σ, |φ U σ - C * R U σ| ≤ 1 + C * ((m : ℝ) * k * N) := by + intro U σ + calc + _ ≤ |φ U σ| + |C * R U σ| := abs_sub _ _ + _ ≤ 1 + C * ((m : ℝ) * k * N) := by + rw [abs_mul, abs_of_nonneg hC] + exact add_le_add (hφb U σ) (mul_le_mul_of_nonneg_left (hRb U σ) hC) + have hbad : Integrable (goodᶜ.indicator (fun _ => (1 : ℝ))) μ := + (integrable_const 1).indicator hgood.compl + have hpoint : ∀ U σ, φ U σ - C * R U σ ≤ goodᶜ.indicator (fun _ => (1 : ℝ)) U := by + intro U σ + by_cases hU : U ∈ good + · simpa only [Set.indicator_of_notMem (show U ∉ goodᶜ from fun hn => hn hU)] using + sub_nonpos.mpr (hdom U hU σ) + · rw [Set.indicator_of_mem hU] + exact sub_le_iff_le_add.mpr ((hφ U σ).2.trans (le_add_of_nonneg_right (mul_nonneg hC (hR0 U σ)))) + have ht := restrictedCavityFullDisorderTest_le_envelope S hS μ T eig I u + (fun U σ => φ U σ - C * R U σ) (hmφ.sub (hmR.const_mul C)) + hM hDb (goodᶜ.indicator (fun _ => (1 : ℝ))) hbad + (fun U => Set.indicator_nonneg (fun _ _ => zero_le_one) U) hpoint + rw [restrictedCavityFullDisorderTest_sub S hS μ T eig I u φ (fun U σ => C * R U σ) + hmφ (hmR.const_mul C) hM hφM hCRM, restrictedCavityFullDisorderTest_const_mul, + integral_indicator hgood.compl, setIntegral_const, smul_eq_mul, mul_one] at ht + have hscale := mul_le_mul_of_nonneg_left hmean hC + have he : C * M₀ = M₀ / (c * B ^ 2) := by + simp only [C, div_eq_mul_inv, mul_comm] + rw [he] at hscale + dsimp only [R] at ht + linarith + +theorem restricted_full_tail_probability {N m k d depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (axes : Fin k → Fin N) {M₀ : ℝ} + (hmean : restrictedCavityFullDisorderTest S hS μ T eig I u (cavityProjectionAxesTest I axes) ≤ M₀) + (good : Set (SpecialOrthogonal N)) + (hgood : MeasurableSet good) + (y : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → + EuclideanSpace ℝ (Fin d)) (hmy : Measurable (Function.uncurry y)) + {c B : ℝ} (hc : 0 < c) (hB : 0 < B) + (hgeometry : ∀ U ∈ good, ∀ σ, + c * ‖y U σ‖ ^ 2 ≤ cavityProjectionAxesTest I axes U σ) : + restrictedCavityFullDisorderTest S hS μ T eig I u (fun U σ => if B < ‖y U σ‖ then 1 else 0) ≤ + μ.real goodᶜ + M₀ / (c * B ^ 2) := by + apply restricted_full_radial_cutoff S hS μ T eig I u axes hmean good hgood y + · exact Measurable.ite (measurableSet_lt measurable_const hmy.norm) + measurable_const measurable_const + · intro U σ + split_ifs <;> norm_num + · exact hc + · exact hB + · intro U σ hy + simp only [not_lt.mpr hy, ite_false] + · exact hgeometry + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..63620da5f071701f34e17c9d8ed9dce7e7359b0e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTest.lean @@ -0,0 +1,20 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeFullRegular + +namespace OAI + +/-! The full constrained two-replica test with a rotation-independent observable. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +def restrictedFullTest {N m depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) (T : LabeledTree depth) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) : ℝ := + restrictedCavityFullDisorderTest S hS μ T eig I u (fun _ => F) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTreeCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTreeCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..7731486f6f7d2d11a03da76d3e0ce41d9b90bd45 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedFullTreeCutoff.lean @@ -0,0 +1,98 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeFullRegular +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpecialCutoffError +import OAI.Probability.InvariantIsing.Magnetic.RestrictedGeometricTail + +namespace OAI + +/-! Removal of the original special-coordinate cutoff after averaging +over the actual random tree, uniformly in its depth. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator + +namespace InvariantIsing + +theorem restricted_full_tree_cutoff_sequence {n m d : ℕ} + (N depth : ℕ → ℕ) + (S : (k : ℕ) → Finset (Spin (N k+n))) (hS : ∀ k, (S k).Nonempty) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k + n))) + [∀ k, IsProbabilityMeasure (μ k)] + (θ : (k : ℕ) → Measure (LabeledTree (depth k))) [∀ k, IsProbabilityMeasure (θ k)] + (eig : (k : ℕ) → Fin (N k + n) → ℝ) + (g : (k : ℕ) → Fin (N k + n) → Fin m) + (u : ℕ → ℕ → ℝ) (hu : ∀ k j, |u k j| ≤ 2) + {M₀ : ℝ} (hmean : ∀ k (T : LabeledTree (depth k)), restrictedCavityFullDisorderTest (S k) (hS k) (μ k) T (eig k) + (cavitySpectralGroup (g k)) (u k) + (cavityProjectionAxesTest (cavitySpectralGroup (g k)) (Fin.natAdd (N k))) ≤ M₀) + (B : (k : ℕ) → SpecialOrthogonal (N k + n) → Matrix (Fin (m * n)) (Fin d) ℝ) + (hmB : ∀ k, Measurable (B k)) (hB : ∀ k U, (B k U).transpose * B k U = 1) + (good : (k : ℕ) → Set (SpecialOrthogonal (N k + n))) + (hgood : ∀ k, MeasurableSet (good k)) + (hp : Tendsto (fun k => (μ k).real (good k)) atTop (𝓝 1)) + {L : ℝ} (hL : 0 < L) + (hbound : ∀ k U, U ∈ good k → ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams (g k) (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) + (F : (k : ℕ) → (Fin 2 → Spin (N k + n) × LabeledLeaf (depth k)) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ k σ, |F k σ| ≤ M) + (b : ℕ → ℝ) (hb : ∀ j, 0 < b j) (hblim : Tendsto b atTop atTop) : + ∀ ε > 0, ∀ᶠ j in atTop, ∀ᶠ k in atTop, + |(∫ T, restrictedCavityFullDisorderTest (S k) (hS k) (μ k) T (eig k) (cavitySpectralGroup (g k)) (u k) (fun _ => F k) ∂θ k) - + ∫ T, restrictedCavityFullCutoffDisorderTest (S k) (hS k) (μ k) T (eig k) (cavitySpectralGroup (g k)) (u k) + (cavitySpecialCutoff (g k) (B k) (b j)) (fun _ => F k) ∂θ k| < ε := by + have he : Tendsto (fun k => (μ k).real (good k)ᶜ) atTop (𝓝 0) := by + have ht := (tendsto_const_nhds : + Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)).sub hp + simpa only [measureReal_compl (hgood _),probReal_univ,sub_self] using ht + have hscaled : Tendsto (fun k => 4*M*(μ k).real (good k)ᶜ) atTop (𝓝 0) := by + simpa only [mul_zero] using he.const_mul (4*M) + have hinv := tendsto_inv_atTop_zero.comp hblim + have hrad : Tendsto (fun j => 4*M*L^2*M₀/(b j)^2) atTop (𝓝 0) := by + simpa only [Function.comp_apply,div_eq_mul_inv,inv_pow,zero_pow (by decide : 2 ≠ 0),mul_zero] + using (hinv.pow 2).const_mul (4*M*L^2*M₀) + intro ε hε + filter_upwards [hrad.eventually (Iio_mem_nhds (show (0:ℝ) < ε/2 by positivity))] with j hj + filter_upwards [hscaled.eventually (Iio_mem_nhds (show (0:ℝ) < ε/2 by positivity))] with k hk + let O := fun T : LabeledTree (depth k) => + restrictedCavityFullDisorderTest (S k) (hS k) (μ k) T (eig k) (cavitySpectralGroup (g k)) (u k) (fun _ => F k) + let C := fun T : LabeledTree (depth k) => + restrictedCavityFullCutoffDisorderTest (S k) (hS k) (μ k) T (eig k) (cavitySpectralGroup (g k)) (u k) + (cavitySpecialCutoff (g k) (B k) (b j)) (fun _ => F k) + have hmF : Measurable (Function.uncurry (fun _ : SpecialOrthogonal (N k+n) => F k)) := + (measurable_of_countable (F k)).comp measurable_snd + have hOm : Measurable O := measurable_restrictedFullTest_tree (S k) (hS k) _ _ _ _ _ + have hCm : Measurable C := measurable_restrictedCavityFullCutoffDisorderTest_tree (S k) (hS k) _ _ _ _ _ + (measurableSet_cavitySpecialCutoff (g k) (B k) (hmB k) (b j)) _ hmF + have hOi : Integrable O (θ k) := integrable_of_measurable_abs_le hOm (fun T => + restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) T (eig k) (cavitySpectralGroup (g k)) (u k) + (fun _ => F k) hmF hM (fun _ => hF k)) + have hCi : Integrable C (θ k) := integrable_of_measurable_abs_le hCm (fun T => + restrictedCavityFullCutoffDisorderTest_abs_le (S k) (hS k) (μ k) T (eig k) (cavitySpectralGroup (g k)) (u k) + _ _ hM (fun _ => hF k)) + have hbound T : |O T-C T| ≤ + (4*M)*(μ k).real (good k)ᶜ + 4*M*L^2*M₀/(b j)^2 := by + have hcut := restricted_full_special_cutoff_error (S k) (hS k) (μ k) T (eig k) (g k) (u k) + (hu k) (B k) (hmB k) (b j) (fun _ => F k) hmF hM (fun _ => hF k) + rw [abs_sub_comm] at hcut + have htail := restricted_full_geometric_tail (S k) (hS k) (μ k) T (eig k) (g k) + (u k) (hmean k T) (B k) (hmB k) (hB k) (good k) (hgood k) hL (hb j) (hbound k) + have hmul := mul_le_mul_of_nonneg_left htail (show 0 ≤ 4*M by positivity) + have heq : 4*M*((μ k).real (good k)ᶜ + L^2*M₀/(b j)^2) = + (4*M)*(μ k).real (good k)ᶜ + 4*M*L^2*M₀/(b j)^2 := by ring + rw [heq] at hmul + exact hcut.trans hmul + change |(∫ T, O T ∂θ k)-(∫ T, C T ∂θ k)| < ε + rw [← integral_sub hOi hCi] + have hh := norm_integral_le_of_norm_le_const (μ := θ k) (f := fun T => O T-C T) + (C := (4*M)*(μ k).real (good k)ᶜ + 4*M*L^2*M₀/(b j)^2) + (ae_of_all _ fun T => by simpa only [Real.norm_eq_abs] using hbound T) + have hh' : |∫ T, O T-C T ∂θ k| ≤ + (4*M)*(μ k).real (good k)ᶜ + 4*M*L^2*M₀/(b j)^2 := by + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hh + exact hh'.trans_lt (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricMean.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..6042272e009bb9830f45ab3977eeb613907be83a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricMean.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityGeometricTest +import OAI.Probability.InvariantIsing.Cavity.CavityGeometricTail +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffTotalBound +import OAI.Probability.InvariantIsing.Cavity.CavityOriginalFactor +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProductPrior + +namespace OAI + +/-! The actual original-spin geometric cutoff as a measurable bounded +function of its orthogonal disorder. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +def restrictedOriginalGeometricMean {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (T : LabeledTree depth) (eig : Fin (N+n) → ℝ) (u : ℕ → ℝ) (D : ℝ) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + (U : SpecialOrthogonal (N+n)) : ℝ := + ∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian (specialRotation U) eig (cavitySpectralGroup g) u z) + {x | cavityGeometricWeight g (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) U + (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates + +lemma measurable_restrictedOriginalGeometricMean {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : Measurable B) (T : LabeledTree depth) (eig : Fin (N+n) → ℝ) + (u : ℕ → ℝ) (D : ℝ) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + Measurable (restrictedOriginalGeometricMean S hS Cset hCset g B T eig u D F) := by + let X := Spin (N+n) × LabeledLeaf depth + let I := cavitySpectralGroup g + have hO : Measurable (cavitySpecialOrthogonal (N := N+n)) := + measurable_subtype_coe.subtype_mk + have hBc := hB.comp ((measurable_cavityCompressionGrams g).comp hO) + have hs : MeasurableSet {q : (SpecialOrthogonal (N+n) × (ℕ → ℝ)) × X | + cavityGeometricWeight g (B (cavityCompressionGrams g (cavitySpecialOrthogonal q.1.1))) + q.1.1 (cavitySpinSplit N n q.2.1) ≤ D} := by + apply measurableSet_le _ measurable_const + apply measurable_from_prod_countable_left + intro x + exact ((measurable_cavityFullSpecialCoordinates g _ hBc + (cavityJoinedSpin (cavitySpinSplit N n x.1))).norm.pow_const 2).const_add 1 |>.comp + measurable_fst + have hH := measurable_cavityFullHamiltonian (N := N+n) (m := m) (depth := depth) eig I u + have hF : Measurable (fun q : (SpecialOrthogonal (N+n) × (ℕ → ℝ)) × (Fin 2 → X) => + F (fun i => (cavitySpinSplit N n (q.2 i).1,(q.2 i).2))) := by + have hf : Measurable (fun σ : Fin 2 → X => + F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) := measurable_of_countable _ + exact hf.comp measurable_snd + have hc := measurable_cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (Function.uncurry (cavityFullHamiltonian (depth := depth) eig I u)) hH + (fun q => {x | cavityGeometricWeight g + (B (cavityCompressionGrams g (cavitySpecialOrthogonal q.1))) q.1 + (cavitySpinSplit N n x.1) ≤ D}) hs _ hF + exact hc.stronglyMeasurable.integral_prod_right'.measurable + +lemma restrictedOriginalGeometricMean_bound {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (T : LabeledTree depth) (eig : Fin (N+n) → ℝ) (u : ℕ → ℝ) (D : ℝ) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) (U : SpecialOrthogonal (N+n)) : + ‖restrictedOriginalGeometricMean S hS Cset hCset g B T eig u D F U‖ ≤ M := by + have hb := fun z => cavity_cutoff_replica_abs_le_all + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian (specialRotation U) eig (cavitySpectralGroup g) u z) + {x | cavityGeometricWeight g (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) U + (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) hM (fun σ => hF _) + have ht := norm_integral_le_of_norm_le_const (μ := gaussianCoordinates) + (f := fun z => cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian (specialRotation U) eig (cavitySpectralGroup g) u z) + {x | cavityGeometricWeight g (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) U + (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2)))) + (C := M) (ae_of_all gaussianCoordinates (fun z => by + simpa only [Real.norm_eq_abs] using hb z)) + simpa only [restrictedOriginalGeometricMean, probReal_univ, mul_one] using ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricTail.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bdf1379c20097169a9ddbccb8b5ae4fd0b30ace --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricTail.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityGeometricTail +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTail + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators Matrix MatrixOrder Matrix.Norms.L2Operator +namespace InvariantIsing + +theorem restricted_full_geometric_tail {N n m d depth : ℕ} + (S : Finset (Spin (N+n))) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal (N + n))) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin (N + n) → ℝ) (g : Fin (N + n) → Fin m) + (u : ℕ → ℝ) + {M₀ : ℝ} (hmean : restrictedCavityFullDisorderTest S hS μ T eig (cavitySpectralGroup g) u + (cavityProjectionAxesTest (cavitySpectralGroup g) (Fin.natAdd N)) ≤ M₀) + (B : SpecialOrthogonal (N + n) → Matrix (Fin (m * n)) (Fin d) ℝ) + (hmB : Measurable B) (hB : ∀ U, (B U).transpose * B U = 1) + (good : Set (SpecialOrthogonal (N + n))) (hgood : MeasurableSet good) + {L R : ℝ} (hL : 0 < L) (hR : 0 < R) + (hbound : ∀ U ∈ good, ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams g (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) : + restrictedCavityFullDisorderTest S hS μ T eig (cavitySpectralGroup g) u + (fun U σ => if R < ‖cavityFullSpecialCoordinates g (B U) U (σ 0).1‖ then 1 else 0) ≤ + μ.real goodᶜ + L ^ 2 * M₀ / R ^ 2 := by + let y := fun (U : SpecialOrthogonal (N + n)) + (σ : Fin 2 → Spin (N + n) × LabeledLeaf depth) => + cavityFullSpecialCoordinates g (B U) U (σ 0).1 + have hmy : Measurable (Function.uncurry y) := by + apply measurable_from_prod_countable_left + intro σ + exact measurable_cavityFullSpecialCoordinates g B hmB (σ 0).1 + have hgeom : ∀ U ∈ good, ∀ σ, + (L ^ 2)⁻¹ * ‖y U σ‖ ^ 2 ≤ + cavityProjectionAxesTest (cavitySpectralGroup g) (Fin.natAdd N) U σ := by + intro U hU σ + have h := cavity_full_special_coordinates_control g (B U) (hB U) U (σ 0).1 hL.le (hbound U hU) + have he : (∑ a, ∑ j : Fin n, + (cavitySpectralProjection (specialRotation U) (cavitySpectralGroup g a) + (spinVector (σ 0).1) (Fin.natAdd N j)) ^ 2) = + cavityProjectionAxesTest (cavitySpectralGroup g) (Fin.natAdd N) U σ := by + exact (Fintype.sum_prod_type (fun t : Fin m × Fin n => + (cavitySpectralProjection (specialRotation U) (cavitySpectralGroup g t.1) + (spinVector (σ 0).1) (Fin.natAdd N t.2)) ^ 2)).symm + rw [he] at h + exact (inv_mul_le_iff₀ (sq_pos_of_pos hL)).mpr h + have ht := restricted_full_tail_probability S hS μ T eig (cavitySpectralGroup g) u + (Fin.natAdd N) hmean good hgood y hmy (inv_pos.mpr (sq_pos_of_pos hL)) hR hgeom + have hid : M₀ / ((L ^ 2)⁻¹ * R ^ 2) = + L ^ 2 * M₀ / R ^ 2 := by + field_simp + simpa only [hid, y] using ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricWeightedTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricWeightedTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fee94c97a4ea8434ec55876a4379d9ffa754b87 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGeometricWeightedTest.lean @@ -0,0 +1,120 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityCoupledEnergy +import OAI.Probability.InvariantIsing.Cavity.CavityGeometricTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalWeightedComparison + +namespace OAI + +/-! The actual original-model cutoff comparison in base Gibbs variables, +with its weight identified as the physical finite-block cavity factor. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators Matrix + +namespace InvariantIsing + +theorem restricted_geometric_weighted_test {N n m d depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i = a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) + (U : SpecialOrthogonal (N+n)) (lam : Fin m → ℝ) (a₀ : Fin d → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + B (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 1) + (hBT : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + cavitySpectralStack (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 0) + (hA : ∀ a, (cavityCompressionGrams g (cavitySpecialOrthogonal U) a).PosDef) + (T₀ : LabeledTree depth) (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + {D M s : ℝ} (hD : 1 ≤ D) (hM : 0 ≤ M) (hs : 0 < s) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + ∃ V : Orthogonal N, + cavityPhysicalBase g lam B (Matrix.diagonal (fun j => lam (a₀ j))) + (cavitySpecialOrthogonal U) = + (V : Matrix (Fin N) (Fin N) ℝ) * + Matrix.diagonal (fun j => Sum.elim (fun w => lam w.1) + (fun j => lam (a₀ j)) (e.symm j)) * + (V : Matrix (Fin N) (Fin N) ℝ).transpose ∧ + cavityPhysicalSpecial g B (cavitySpecialOrthogonal U) = + (V : Matrix (Fin N) (Fin N) ℝ) * cavityCanonicalSpecial e ∧ + let eig₀ := fun j => Sum.elim (fun w => lam w.1) (fun j => lam (a₀ j)) (e.symm j) + let B₁ := B (cavityCompressionGrams g (cavitySpecialOrthogonal U)) + let Ds := cavityRepeatedSpectrum (n := n) lam + let Ts := cavitySpectralStack (cavityCompressionGrams g (cavitySpecialOrthogonal U)) + let y := fun σ : Spin N => (cavityCanonicalSpecial e).transpose *ᵥ + (matrixRotation V⁻¹ (spinVector σ)).ofLp + let μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T₀ + let w := cavityGeometricWeight g B₁ U + |(∫ z, cavityWeightedReplicaMean + ((μ.tilted (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues eig₀ (cavityBaseGroup k e a₀) v t) + (cavityBaseGroup k e a₀) u z)).prod (restrictedSpinPrior Cset hCset)) + ({x : (Spin N × LabeledLeaf depth) × Spin n | + 1 + ‖(WithLp.toLp 2 (y x.1.1) : EuclideanSpace ℝ (Fin d))‖^2 ≤ D}.indicator + (fun x => Real.exp (t * cavityLogFactor + (B₁.transpose * Ds * B₁ - Matrix.diagonal (fun j => lam (a₀ j))) + (B₁.transpose * Ds * Ts) (Ts.transpose * Ds * Ts) (y x.1.1) x.2))) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) ∂gaussianCoordinates) - + (∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T₀) + (cavityRotationHamiltonian (specialRotation U) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z) + {x | w (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates)| ≤ + (2 * (2 : ℝ)^2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityDeterministicRate n m (2*(2*n+1)) N * D)) / s + M^2*s/2 := by + obtain ⟨V, hV, hVS, herr₀⟩ := cavity_coupled_spectral_overlap + hN g k ek e es U lam a₀ B hB hBT hA + refine ⟨V, hV, hVS, ?_⟩ + dsimp only + let eig₀ := fun j => Sum.elim (fun w => lam w.1) (fun j => lam (a₀ j)) (e.symm j) + let B₁ := B (cavityCompressionGrams g (cavitySpecialOrthogonal U)) + let w := cavityGeometricWeight g B₁ U + have herr (x z : Spin N × Spin n) (a : Fin m) : + |projectedOverlap (specialRotation U) (cavitySpectralGroup g a) + (cavityJoinedSpin x) (cavityJoinedSpin z) - + projectedOverlap (matrixRotation V⁻¹) (cavityBaseGroup k e a₀ a) x.1 z.1| ≤ + (2 * (n : ℝ) + 1) / N * (w x + w z) := by + have h := herr₀ a (cavityJoinedSpin x) (cavityJoinedSpin z) + simp only [cavityJoinedSpin, Fin.append_left] at h + apply h.trans + apply mul_le_mul_of_nonneg_left _ (div_nonneg (by positivity) (Nat.cast_nonneg N)) + dsimp only [w, cavityGeometricWeight, B₁, cavityJoinedSpin] + linarith + have hc := restricted_original_weighted_comparison hN S hS Cset hCset (specialRotation U) (matrixRotation V⁻¹) + T₀ (cavitySpectralGroup g) (cavityBaseGroup k e a₀) (fun i => lam (g i)) eig₀ + v hv u hu t w (cavityGeometricWeight_one_le g B₁ U) (by positivity) hD hM hs herr F hF + have hw (x : (Spin N × LabeledLeaf depth) × Spin n) : + w (cavityPairLeafUnswap x).1 = + 1 + ‖(WithLp.toLp 2 ((cavityCanonicalSpecial e).transpose *ᵥ + (matrixRotation V⁻¹ (spinVector x.1.1)).ofLp) : EuclideanSpace ℝ (Fin d))‖^2 := by + dsimp only [w, cavityGeometricWeight, cavityPairLeafUnswap] + rw [← WithLp.toLp_ofLp 2 (cavityFullSpecialCoordinates g B₁ U + (cavityJoinedSpin (x.1.1,x.2))), + cavity_coupled_special_coordinates g U B hBT hA V _ hVS x.1.1 x.2] + have he (x : (Spin N × LabeledLeaf depth) × Spin n) := + cavity_coupled_energy_difference g es U lam (fun j => lam (a₀ j)) B hB hBT hA + V eig₀ (cavityCanonicalSpecial e) hV hVS x.1.1 x.2 + have hcut : (cavityPairLeafUnswap ⁻¹' + {x : (Spin N × Spin n) × LabeledLeaf depth | w x.1 ≤ D}) = + {x : (Spin N × LabeledLeaf depth) × Spin n | + 1 + ‖(WithLp.toLp 2 ((cavityCanonicalSpecial e).transpose *ᵥ + (matrixRotation V⁻¹ (spinVector x.1.1)).ofLp) : EuclideanSpace ℝ (Fin d))‖^2 ≤ D} := by + ext x + change w (cavityPairLeafUnswap x).1 ≤ D ↔ _ + rw [hw] + rfl + dsimp only at hc he + rw [hcut] at hc + simpa only [he, eig₀, B₁, w, cavityPairLeafUnswap] using hc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedCappedLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedCappedLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..a078f1c68d0de905c31e7b2470e33b38af5c1afd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedCappedLog.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityOrbitAverage +import OAI.Probability.InvariantIsing.Cavity.CavityGroupedCoordinates +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFrameLogBound + +namespace OAI + +/-! Fresh group rotations inside the actual capped logarithm. The +base Gaussian Hamiltonian and its original Gibbs normalization are +preserved by the labeled-projector stabilizer. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_grouped_capped_log_average {N n m q d depth : ℕ} + (P : Finset (Spin N)) (hP : P.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : ((a : Fin m) × Fin (k a)) ≃ Fin N) + (f : Fin d → Fin m × Fin q) + (A : (a : Fin m) → Matrix (Fin (k a)) (Fin q) ℝ) + (hA : (cavityGroupedSelectedFrame k e f A).transpose*cavityGroupedSelectedFrame k e f A=1) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (k a))) [IsProbabilityMeasure η] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t cap δ : ℝ) (hcap : 0 ≤ cap) + (B : CavityFactorBlocks d n) : + (∫ V, restrictedProjectorCappedLog P hP C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ B + (fun a => cavitySpectralProjector V (cavitySpectralGroup (fun i => (e.symm i).1) a), + (V : Matrix (Fin N) (Fin N) ℝ)*cavityGroupedSelectedFrame k e f A) ∂μ) = + ∫ V, ∫ W, ∫ z, Real.log (∫ x, Real.exp + (min (t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1.1) x.2) cap - + δ*(1+‖cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1.1‖^2)) + ∂((labeledSpinReference depth (restrictedSpinPrior P hP : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)).tilted (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (e.symm i).1) + (cavitySpectralGroup (fun i => (e.symm i).1)) v t) + (cavitySpectralGroup (fun i => (e.symm i).1)) u z x.1)) + ∂gaussianCoordinates ∂η ∂μ := by + let c := fun a => t*lam a+2*perturbationScale N*v a + let S := cavityGroupedSelectedFrame k e f A + let G : CavityProjectorFrame N m d → ℝ := restrictedProjectorCappedLog P hP C hC T c u t cap δ B + have hG : Measurable G := measurable_restrictedProjectorCappedLog P hP C hC T c u t cap δ + (fun _ => B) measurable_const id measurable_id + have hb (V : Orthogonal N) : ‖G + (fun a => cavitySpectralProjector V (cavitySpectralGroup (fun i => (e.symm i).1) a), + (V : Matrix (Fin N) (Fin N) ℝ)*S)‖ ≤ + (|t| *cavityFactorSize B.1 B.2.1 B.2.2+|δ|)*(1+N) := by + rw [Real.norm_eq_abs] + exact restricted_projector_capped_log_bound P hP C hC (fun i => (e.symm i).1) V T lam v u hu + t cap δ hcap B le_rfl _ rfl (cavity_orthogonal_frame_gram V S hA) + rw [cavity_labeled_stabilizer_average_on_orbit k e S μ η G hG _ hb] + apply integral_congr_ae + apply ae_of_all + intro V + apply integral_congr_ae + apply ae_of_all + intro W + let p : CavityProjectorFrame N m d := + (fun a => cavitySpectralProjector V (cavitySpectralGroup (fun i => (e.symm i).1) a), + (V : Matrix (Fin N) (Fin N) ℝ)* + ((cavityGroupRotation k e W : Matrix (Fin N) (Fin N) ℝ)*S)) + change restrictedProjectorCappedLog P hP C hC T c u t cap δ B p = _ + rw [restricted_projector_capped_log P hP C hC (fun i => (e.symm i).1) V T lam v u t cap δ B p rfl] + simp only [p, S, cavityGroupedSelectedFrame_rotated_coordinates] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..96b505630b4993be8d8d34beeb88911dcc6000b9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedCutoff.lean @@ -0,0 +1,72 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityGroupedCoordinates +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorCutoffLaw + +namespace OAI + +/-! The fixed-block Haar cutoff is precisely the fresh-group-frame +observable over the original base Hamiltonian. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_grouped_cutoff_average {N n m q d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (k : Fin m → ℕ) (e : ((a : Fin m) × Fin (k a)) ≃ Fin N) + (f : Fin d → Fin m × Fin q) + (A : (a : Fin m) → Matrix (Fin (k a)) (Fin q) ℝ) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (k a))) [IsProbabilityMeasure η] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) + (B : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) : + (∫ V, restrictedProjectorCavityMean S hS Cset hCset T + (fun a => t*lam a+2*perturbationScale N*v a) u t D B F + (fun a => cavitySpectralProjector V (cavitySpectralGroup (fun i => (e.symm i).1) a), + (V : Matrix (Fin N) (Fin N) ℝ)*cavityGroupedSelectedFrame k e f A) ∂μ) = + ∫ V, ∫ W, ∫ z, cavityCutoffReplicaMean + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset)) + (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (e.symm i).1) + (cavitySpectralGroup (fun i => (e.symm i).1)) v t) + (cavitySpectralGroup (fun i => (e.symm i).1)) u z x.1 + + t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1.1) x.2) + {x | 1+‖cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1.1‖^2 ≤ D} F ∂gaussianCoordinates ∂η ∂μ := by + let c := fun a => t*lam a+2*perturbationScale N*v a + let G : CavityProjectorFrame N m d → ℝ := restrictedProjectorCavityMean S hS Cset hCset T c u t D B F + have hFs : Measurable (fun x : CavityProjectorFrame N m d × + (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) => F x.2) := + (measurable_of_countable F).comp measurable_snd + have hG : Measurable G := measurable_restrictedProjectorCavityMean S hS Cset hCset T c u t D + (fun _ => B) measurable_const id measurable_id (fun _ => F) hFs + have hb : ∀ p, ‖G p‖ ≤ M := fun p => restrictedProjectorCavityMean_bound S hS Cset hCset T c u t D B F hM hF p + rw [cavity_labeled_stabilizer_average k e (cavityGroupedSelectedFrame k e f A) μ η G hG M hb] + apply integral_congr_ae + apply ae_of_all + intro V + apply integral_congr_ae + apply ae_of_all + intro W + let p : CavityProjectorFrame N m d := + (fun a => cavitySpectralProjector V (cavitySpectralGroup (fun i => (e.symm i).1) a), + (V : Matrix (Fin N) (Fin N) ℝ)* + ((cavityGroupRotation k e W : Matrix (Fin N) (Fin N) ℝ)* + cavityGroupedSelectedFrame k e f A)) + have hp : p.1 = fun a => cavitySpectralProjector V + (cavitySpectralGroup (fun i => (e.symm i).1) a) := rfl + change restrictedProjectorCavityMean S hS Cset hCset T c u t D B F p = _ + rw [restricted_projector_cavity_cutoff S hS Cset hCset (fun i => (e.symm i).1) V T lam v u t D B p hp F] + simp only [p, cavityGroupedSelectedFrame_rotated_coordinates] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedWeighted.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedWeighted.lean new file mode 100644 index 0000000000000000000000000000000000000000..10a8feb67064b6a2f0916efb7353697fc2da9ea9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedGroupedWeighted.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedGroupedCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationCutoffWeight + +namespace OAI + +/-! Fresh-frame cutoff tests over the actual base Gibbs probability. +The diagonal and Gaussian perturbations stay in that base law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_grouped_weighted_average {N n m q d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (k : Fin m → ℕ) (e : ((a : Fin m) × Fin (k a)) ≃ Fin N) + (f : Fin d → Fin m × Fin q) + (A : (a : Fin m) → Matrix (Fin (k a)) (Fin q) ℝ) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (η : Measure ((a : Fin m) → Orthogonal (k a))) [IsProbabilityMeasure η] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t D : ℝ) + (B : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) : + (∫ V, restrictedProjectorCavityMean S hS Cset hCset T + (fun a => t*lam a+2*perturbationScale N*v a) u t D B F + (fun a => cavitySpectralProjector V (cavitySpectralGroup (fun i => (e.symm i).1) a), + (V : Matrix (Fin N) (Fin N) ℝ)*cavityGroupedSelectedFrame k e f A) ∂μ) = + ∫ V, ∫ W, ∫ z, cavityWeightedReplicaMean + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted + (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (e.symm i).1) + (cavitySpectralGroup (fun i => (e.symm i).1)) v t) + (cavitySpectralGroup (fun i => (e.symm i).1)) u z)).prod (restrictedSpinPrior Cset hCset)) + ({x | 1+‖cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1.1‖^2 ≤ D}.indicator (fun x => + Real.exp (t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1.1) x.2))) F ∂gaussianCoordinates ∂η ∂μ := by + rw [restricted_grouped_cutoff_average S hS Cset hCset k e f A μ η T lam v u t D B F hM hF] + apply integral_congr_ae + apply ae_of_all + intro V + apply integral_congr_ae + apply ae_of_all + intro W + exact restricted_rotation_cutoff_weight S hS Cset hCset (matrixRotation V⁻¹) T + (diagonalPerturbedEigenvalues (fun i => lam (e.symm i).1) + (cavitySpectralGroup (fun i => (e.symm i).1)) v t) + (cavitySpectralGroup (fun i => (e.symm i).1)) u hu + (fun x => t*cavityLogFactor B.1 B.2.1 B.2.2 + (cavitySelectedSiteProjection f (cavityGroupSpinCoordinates k e V) + (cavityGroupHaarFrames A W) x.1) x.2) _ F + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCoefficients.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8ebb893b55738595a85c4f80719e9ab7426774d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCoefficients.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorHaarMean +import OAI.Probability.InvariantIsing.Cavity.CavityCoefficientValueLimit + +namespace OAI + +/-! Normalized coefficient replacement for varying finite perturbation minimizers. + +Normalized coefficient replacement under independent compression +and base-Haar averages. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Matrix + +namespace InvariantIsing + +theorem restricted_haar_normalized_coefficient_tendsto {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (k : ℕ → Fin m → ℕ) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (a₀ : Fin d → Fin m) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) [∀ j, IsProbabilityMeasure (μ j)] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) [∀ j, IsProbabilityMeasure (ν j)] + (T : (j : ℕ) → LabeledTree (depth j)) (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) (t : ℝ) {D : ℝ} (hD : 0 ≤ D) + (A : (j : ℕ) → Orthogonal (N j+n) → CavityFactorBlocks d n) + (hA : ∀ j, Measurable (A j)) (A₀ : CavityFactorBlocks d n) + (F : (j : ℕ) → (Fin 2 → (Spin (N j) × LabeledLeaf (depth j)) × Spin n) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ j σ, |F j σ| ≤ M) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation (A j U) A₀}) atTop (𝓝 0)) : + Tendsto (fun j => + (∫ U, ∫ V, restrictedProjectorCavityMean (S j) (hS j) Cset hCset (T j) + (fun a => t*lam a+2*perturbationScale (N j)*v j a) (u j) t D (A j U) (F j) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame (k j) (e j) a₀)) ∂ν j ∂μ j) - + ∫ _U, ∫ V, restrictedProjectorCavityMean (S j) (hS j) Cset hCset (T j) + (fun a => t*lam a+2*perturbationScale (N j)*v j a) (u j) t D A₀ (F j) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame (k j) (e j) a₀)) ∂ν j ∂μ j) + atTop (𝓝 0) := by + apply cavity_coefficient_values_tendsto μ A hA A₀ _ _ + (fun j => measurable_restrictedProjectorHaarMean (S j) (hS j) Cset hCset (k j) (e j) a₀ (ν j) (T j) _ (u j) t D + (A j) (hA j) (F j)) + (fun j => measurable_restrictedProjectorHaarMean (S j) (hS j) Cset hCset (k j) (e j) a₀ (ν j) (T j) _ (u j) t D + (fun _ => A₀) measurable_const (F j)) hM + (show 0 ≤ 4*|t| *D by positivity) + (fun j U => restrictedProjectorHaarMean_bound (S j) (hS j) Cset hCset (k j) (e j) a₀ (ν j) (T j) _ (u j) t D + (A j U) (F j) hM (hF j)) + (fun j _ => restrictedProjectorHaarMean_bound (S j) (hS j) Cset hCset (k j) (e j) a₀ (ν j) (T j) _ (u j) t D + A₀ (F j) hM (hF j)) + (fun j U s hs => restricted_projector_haar_coefficient_error (S j) (hS j) Cset hCset (k j) (e j) a₀ (ν j) + (T j) lam (v j) (u j) (hu j) t hD (A j U) A₀ (F j) hM (hF j) hs) hprob + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCutoffComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCutoffComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..a219550e2820578f8a3c94a6ff6d49733f6024ba --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCutoffComparison.lean @@ -0,0 +1,108 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalCutoffComparison +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalCavityHaar +import OAI.Probability.InvariantIsing.Cavity.CavityOrientedProjectors +import OAI.Probability.InvariantIsing.Magnetic.RestrictedGeometricMean + +namespace OAI + +/-! The original Ising cutoff, averaged over its actual Haar disorder, +is compared with an independent Haar base cavity law. All random block +coefficients remain inside the normalized test. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_haar_cutoff_comparison {N n m d depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i = a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (l w : Fin m → ℕ) (hg : ∀ a i, g i=a ↔ l a ≤ i.val ∧ i.val < w a) + (hln : ∀ a, l a+n ≤ w a) (hw : ∀ a, w a ≤ N+n) + (μ : Measure (Orthogonal (N+n))) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] [ν.IsMulRightInvariant] + (T : LabeledTree depth) (lam v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + {D M s : ℝ} (hD : 1 ≤ D) (hM : 0 ≤ M) (hs : 0 < s) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + let B := cavityConcreteComplement es B₀ + let A := cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + |(∫ U, ∫ V, restrictedProjectorCavityMean S hS Cset hCset T + (fun a => t*lam a+2*perturbationScale N*v a) u t D + (A (cavityCompressionGrams g U)) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂ν ∂μ) - + (∫ U, restrictedOriginalGeometricMean S hS Cset hCset g B T + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + u D F (cavityOrientationLift (Nat.add_pos_left hN n) U) ∂μ)| ≤ + (2 * (2 : ℝ)^2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityDeterministicRate n m (2*(2*n+1)) N * D)) / s + M^2*s/2 := by + intro B A + let c := fun a => t*lam a+2*perturbationScale N*v a + let f := fun U : Orthogonal (N+n) => restrictedProjectorCavityMean S hS Cset hCset T c u t D + (A (cavityCompressionGrams g U)) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) + (cavityPhysicalLabeledProjectors g B a₀ U) + let h := fun U : Orthogonal (N+n) => restrictedOriginalGeometricMean S hS Cset hCset g B T + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + u D F (cavityOrientationLift (Nat.add_pos_left hN n) U) + have hBm : Measurable B := measurable_cavityConcreteComplement es B₀ + have hAm : Measurable A := measurable_cavityCompressionFactorBlocks es lam _ B₀ + have hFs : Measurable (fun σ : Fin 2 → (Spin N × LabeledLeaf depth) × Spin n => + F (fun i => cavityPairLeafUnswap (σ i))) := measurable_of_countable _ + have hfm : Measurable f := measurable_restrictedProjectorCavityMean + (N := N) (n := n) (m := m) (d := d) (depth := depth) S hS Cset hCset T c u t D + (fun U => A (cavityCompressionGrams g U)) + (hAm.comp (measurable_cavityCompressionGrams g)) + (cavityPhysicalLabeledProjectors g B a₀) + (measurable_cavityPhysicalLabeledProjectors g B hBm a₀) + (fun _ σ => F (fun i => cavityPairLeafUnswap (σ i))) + (hFs.comp measurable_snd) + have hhm : Measurable h := (measurable_restrictedOriginalGeometricMean S hS Cset hCset g B hBm T _ u D F).comp + (measurable_cavityOrientationLift (Nat.add_pos_left hN n)) + have hfb U : ‖f U‖ ≤ M := restrictedProjectorCavityMean_bound S hS Cset hCset T c u t D _ _ hM + (fun σ => hF _) _ + have hhb U : ‖h U‖ ≤ M := restrictedOriginalGeometricMean_bound S hS Cset hCset g B T _ u D F hM hF _ + have hfi : Integrable f μ := Integrable.of_bound hfm.aestronglyMeasurable M (ae_of_all _ hfb) + have hhi : Integrable h μ := Integrable.of_bound hhm.aestronglyMeasurable M (ae_of_all _ hhb) + have hcmp : ∀ᵐ U ∂μ, |f U-h U| ≤ + (2 * (2 : ℝ)^2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityDeterministicRate n m (2*(2*n+1)) N * D)) / s + M^2*s/2 := by + filter_upwards [cavityCompressionGrams_posDef_ae g l w hg hln hw μ] with U hU + let R := cavityOrientationLift (Nat.add_pos_left hN n) U + have hpos : ∀ a, (cavityCompressionGrams g (cavitySpecialOrthogonal R) a).PosDef := by + simpa only [R, cavityOrientationLift_compression] using hU + have hh := restricted_physical_cutoff_comparison hN S hS Cset hCset g k ek e es R lam a₀ B + (cavityConcreteComplement_gram g es B₀ (cavitySpecialOrthogonal R)) + (cavityConcreteComplement_perp g es B₀ (cavitySpecialOrthogonal R)) hpos + T v hv u hu t hD hM hs F hF + dsimp only at hh + simpa only [f, h, c, A, B, cavityCompressionFactorBlocks, R, + cavityOrientationLift_compression, cavityOrientationLift_projectors, + restrictedOriginalGeometricMean] using hh + have havg := restricted_physical_cavity_haar S hS Cset hCset g k ek e es B₀ a₀ l w hg hln hw μ ν + T c u t D A hAm + (fun _ σ => F (fun i => cavityPairLeafUnswap (σ i))) + (hFs.comp measurable_snd) hM (fun _ σ => hF _) + change (∫ U, f U ∂μ) = _ at havg + rw [← havg, ← integral_sub hfi hhi] + have hb := norm_integral_le_of_norm_le_const (f := fun U => f U-h U) + (C := (2 * (2 : ℝ)^2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2*2*(cavityCovarianceRate n (2*n+1) N*(2*D)) + + 2*2*(cavityDeterministicRate n m (2*(2*n+1)) N*D))/s+M^2*s/2) + (hcmp.mono fun U hU => by simpa only [Real.norm_eq_abs] using hU) + simpa only [Real.norm_eq_abs, probReal_univ, mul_one] using hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCutoffLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCutoffLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..31d3ce565c76f0284d964ad62eff13218244f0c1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarCutoffLimit.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarCoefficients +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarCutoffComparison +import OAI.Probability.InvariantIsing.Cavity.CavityTestLimit + +namespace OAI + +/-! At a fixed spatial cutoff the original spin test converges to the +independent base-Haar cavity test with deterministic limiting blocks. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Matrix + +namespace InvariantIsing + +theorem restricted_haar_cutoff_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (T : (j : ℕ) → LabeledTree (depth j)) (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) (t : ℝ) + {D M : ℝ} (hD : 1 ≤ D) (hM : 0 ≤ M) + (F : (j : ℕ) → (Fin 2 → (Spin (N j) × Spin n) × LabeledLeaf (depth j)) → ℝ) + (hF : ∀ j σ, |F j σ| ≤ M) (A₀ : CavityFactorBlocks d n) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A₀}) atTop (𝓝 0)) : + Tendsto (fun j => + (∫ U, restrictedOriginalGeometricMean (S j) (hS j) Cset hCset (g j) (cavityConcreteComplement es B₀) (T j) + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) D (F j) (cavityOrientationLift (Nat.add_pos_left (hN j) n) U) ∂μ j) - + ∫ V, restrictedProjectorCavityMean (S j) (hS j) Cset hCset (T j) + (fun a => t*lam a+2*perturbationScale (N j)*v j a) (u j) t D A₀ + (fun σ => F j (fun i => cavityPairLeafUnswap (σ i))) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame (k j) (e j) a₀)) ∂ν j) + atTop (𝓝 0) := by + let A : (j : ℕ) → Orthogonal (N j+n) → CavityFactorBlocks d n := fun j U => + cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U) + let R : ℕ → ℝ := fun j => ∫ U, ∫ V, restrictedProjectorCavityMean (S j) (hS j) Cset hCset (T j) + (fun a => t*lam a+2*perturbationScale (N j)*v j a) (u j) t D (A j U) + (fun σ => F j (fun i => cavityPairLeafUnswap (σ i))) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame (k j) (e j) a₀)) ∂ν j ∂μ j + let O : ℕ → ℝ := fun j => ∫ U, restrictedOriginalGeometricMean (S j) (hS j) Cset hCset (g j) + (cavityConcreteComplement es B₀) (T j) + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) D (F j) (cavityOrientationLift (Nat.add_pos_left (hN j) n) U) ∂μ j + let L : ℕ → ℝ := fun j => ∫ V, restrictedProjectorCavityMean (S j) (hS j) Cset hCset (T j) + (fun a => t*lam a+2*perturbationScale (N j)*v j a) (u j) t D A₀ + (fun σ => F j (fun i => cavityPairLeafUnswap (σ i))) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame (k j) (e j) a₀)) ∂ν j + have hcov := (cavityCovarianceRate_tendsto n (2*n+1)).comp hNlim + have hdet := (cavityDeterministicRate_tendsto n m (2*(2*n+1))).comp hNlim + have hδ : Tendsto (fun j => + 2*(2:ℝ)^2*(cavityCovarianceRate n (2*n+1) (N j)*(2*D)) + + 2*2*(cavityCovarianceRate n (2*n+1) (N j)*(2*D)) + + 2*2*(cavityDeterministicRate n m (2*(2*n+1)) (N j)*D)) atTop (𝓝 0) := by + simpa only [mul_zero, zero_mul, add_zero, Function.comp_apply] using + (((hcov.mul_const (2*D)).const_mul (2*(2:ℝ)^2)).add + ((hcov.mul_const (2*D)).const_mul (2*2))).add + ((hdet.mul_const D).const_mul (2*2)) + have hRO : Tendsto (fun j => R j-O j) atTop (𝓝 0) := by + apply cavity_secant_error_tendsto (C := M^2/2) (by positivity) hδ + intro s hs + apply Eventually.of_forall + intro j + have hh := restricted_haar_cutoff_comparison (hN j) (S j) (hS j) Cset hCset (g j) (k j) (ek j) (e j) es + B₀ a₀ (l j) (w j) (hg j) (hln j) (hw j) (μ j) (ν j) (T j) lam (v j) (hv j) + (u j) (hu j) t hD hM hs (F j) (hF j) + change |R j-O j| ≤ _ at hh + convert hh using 1 + ring + have hA j : Measurable (A j) := + (measurable_cavityCompressionFactorBlocks es lam _ B₀).comp + (measurable_cavityCompressionGrams (g j)) + have hRL : Tendsto (fun j => R j-L j) atTop (𝓝 0) := by + have hh := restricted_haar_normalized_coefficient_tendsto N depth S hS Cset hCset k e a₀ μ ν T lam v + u hu t (show 0 ≤ D by linarith) A hA A₀ + (fun j σ => F j (fun i => cavityPairLeafUnswap (σ i))) hM (fun j σ => hF j _) + hprob + simpa only [integral_const, probReal_univ, smul_eq_mul, one_mul] using hh + have hh := hRL.sub hRO + convert hh using 1 + · funext j + dsimp only [R, O, L] + ring + · norm_num + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarFiniteOverlap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarFiniteOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..1918222d4fe3a2cb2287b46d347078371f5d7f3d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarFiniteOverlap.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityHaarFiniteSpin +import OAI.Probability.InvariantIsing.Magnetic.RestrictedStrictFiniteOverlap + +namespace OAI + +/-! The physical restricted Haar overlap test converges to the +unmodified common-level law of the finite cavity model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +theorem restricted_haar_finite_overlap_cutoff (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m q dim kspin : ℕ} + (N : ℕ → Fin m → ℕ) (hN : ∀ a, Tendsto (fun k => N k a) atTop atTop) + (μ : (k : ℕ) → (a : Fin m) → Measure (Orthogonal (N k a))) + [∀ k a, IsProbabilityMeasure (μ k a)] [∀ k a, (μ k a).IsMulRightInvariant] + (A₀ : (k : ℕ) → (a : Fin m) → Matrix (Fin (N k a)) (Fin q) ℝ) + (hA₀ : ∀ k a, (A₀ k a).transpose * A₀ k a = 1) + (Ω X : ℕ → Type*) [∀ k, MeasurableSpace (Ω k)] [∀ k, MeasurableSpace (X k)] + [∀ k, Countable (X k)] [∀ k, MeasurableSingletonClass (X k)] + (P : (k : ℕ) → Measure (Ω k)) [∀ k, IsProbabilityMeasure (P k)] + (ν : (k : ℕ) → Ω k → Measure (X k)) (hν : ∀ k, Measurable (ν k)) + [∀ k ω, IsProbabilityMeasure (ν k ω)] + (B : (k : ℕ) → Ω k → X k → X k → SpectralEntry (m + 1)) + (hB : ∀ k x y, Measurable (fun ω => B k ω x y)) + (hGram : ∀ k x, SpectralGram (cavitySampledEntryArray (B k) x)) + (v₀ : (k : ℕ) → Ω k → (j : Fin m) → X k → Fin (N k j) → ℝ) + (hvM : ∀ k x, Measurable (fun ω j => v₀ k ω j x)) + (C : ℝ) + (hv : ∀ s k (x : Ω k × (ℕ → X k)) j (i l : Fin s), |cavityGroupReplicaGram (fun j (i : Fin s) => v₀ k x.1 j (x.2 i)) j i l| ≤ C) + (ρs : ℕ → Fin m → ℝ) (ρ eig : Fin m → ℝ) + (hρs : ∀ k j, 0 < ρs k j) (hρ : ∀ j, 0 < ρ j) + (hρlim : Tendsto ρs atTop (𝓝 ρ)) (hρsum : ∑ j, ρ j = 1) + (hcov : ∀ s k (x : Ω k × (ℕ → X k)), cavityGroupReplicaCovariance q (cavityGroupReplicaGram (fun j (i : Fin s) => v₀ k x.1 j (x.2 i))) = + cavitySpectralBlockCovariance q (ρs k) (spectralBlockView (m + 1) s (cavitySampledEntryArray (B k) x))) + (Q : ℕ → ProbabilityMeasure (SpectralArray (m + 1))) + (Q₀ : ProbabilityMeasure (SpectralArray (m + 1))) + (hQ : ∀ k, (Q k : Measure (SpectralArray (m + 1))) = (disorderReplicaLaw (P k) (ν k) (hν k)).map (cavitySampledEntryArray (B k))) + (hlim : Tendsto Q atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralGram x) + (d : Fin (m + 1) → ℝ) (hd0 : ∀ j, 0 ≤ d j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ i j, (x (i,i) j : ℝ) = d j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ eig j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ eig j l = 0) + (g : Fin dim → Fin m) (e : Fin dim → Fin m × Fin q) + (he : Function.Injective e) (heg : ∀ j, (e j).1 = g j) + (hNpos : ∀ n a, 0 < N n a) (hC : 0 ≤ C) + (hdim : 0 < dim) (hkspin : 0 < kspin) + (T : Finset (Spin kspin)) (hT : T.Nonempty) + (B₀ : Matrix (Fin (m*kspin)) (Fin dim) ℝ) (hB₀ : B₀.transpose * B₀ = 1) + (hBE : B₀.transpose * cavityLimitingStack (n := kspin) ρ = 0) + (hcomplete : B₀ * B₀.transpose + cavityLimitingStack (n := kspin) ρ * + (cavityLimitingStack (n := kspin) ρ).transpose = 1) + (a : Fin m) (ha : ∀ b, eig b ≤ eig a) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) + {M : ℝ} (hΦb : ∀ x, |Φ x| ≤ M) + (b : ℕ → ℝ) (hb : ∀ j, 0 < b j) (hblim : Tendsto b atTop atTop) + (hnull : ∀ j s, (cavityBlockMarkedLaw (q := q) Q₀ ρ (cavitySpectralGroupBlock m s) : Measure + (SpectralBlock m s × EuclideanSpace ℝ (Fin m × (Fin s × Fin q)))) + {z | cavityReplicaRadius (cavitySelectedGroupProjection e) z = b j} = 0) : + let p := spectralSpinQuantilePath Q₀ hP hn + let K := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * B₀ - + Matrix.diagonal (fun i => eig (g i)) + let L := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * + cavityLimitingStack (n := kspin) ρ + let Cspin := (finiteR ρ eig hρ hρsum 0) • (1 : Matrix (Fin kspin) (Fin kspin) ℝ) + let τ := fun j => cavityFactorSize K L Cspin * (1+(b j)^2) + ∀ ε > 0, ∀ᶠ j in atTop, ∀ᶠ n in atTop, + |(∫ ω, cavityWeightedReplicaMean ((ν n ω.1).prod (restrictedSpinPrior T hT)) + (fun x => cavityHaarRestrictedWeight e (v₀ n) (A₀ n) K L Cspin (τ j) (b j) (ω,x)) + (cavityProjectedSpinTest (cavitySampledGroupBlock (B n) ω.1) + (cavityOverlapObservable Φ hΦ)) ∂(P n).prod (Measure.pi (μ n))) - + ∫ t, Φ (cavityStrictUniformPath p n t) ∂pathMeasure| < ε := by + intro p K L Cspin τ + have hh := cavity_haar_finite_cutoff_comparison N hN μ A₀ hA₀ Ω X P ν hν B hB + hGram v₀ hvM C hv ρs ρ eig hρs hρ hρlim hρsum hcov Q Q₀ hQ hlim hgg hG + d hd0 hd hE hP hn hoff hdiag g e he heg K L Cspin (restrictedSpinPrior T hT) + (cavityOverlapObservable Φ hΦ) hNpos hC B₀ hB₀ a ha rfl b hb hblim hnull + dsimp only at hh + intro ε hε + filter_upwards [hh ε hε] with j hj + filter_upwards [hj] with n hn' + have hf := restricted_strict_finite_overlap_test hpub hdim hkspin T hT ρ eig hρ hρsum B₀ hB₀ + hBE hcomplete g a ha p Φ hΦ (n := n) hΦb + dsimp only at hf + rw [hf] at hn' + exact hn' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarFiniteSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarFiniteSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce70760a685b129145b059147967a973899f6ddb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarFiniteSpin.lean @@ -0,0 +1,103 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityHaarFiniteCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedStrictFiniteSpin + +namespace OAI + +/-! The restricted physical Haar spin test has the scalar-field value +of the actual strict finite spectral cavity construction. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +theorem restricted_haar_finite_spin_cutoff (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m q dim kspin : ℕ} + (N : ℕ → Fin m → ℕ) (hN : ∀ a, Tendsto (fun k => N k a) atTop atTop) + (μ : (k : ℕ) → (a : Fin m) → Measure (Orthogonal (N k a))) + [∀ k a, IsProbabilityMeasure (μ k a)] [∀ k a, (μ k a).IsMulRightInvariant] + (A₀ : (k : ℕ) → (a : Fin m) → Matrix (Fin (N k a)) (Fin q) ℝ) + (hA₀ : ∀ k a, (A₀ k a).transpose * A₀ k a = 1) + (Ω X : ℕ → Type*) [∀ k, MeasurableSpace (Ω k)] [∀ k, MeasurableSpace (X k)] + [∀ k, Countable (X k)] [∀ k, MeasurableSingletonClass (X k)] + (P : (k : ℕ) → Measure (Ω k)) [∀ k, IsProbabilityMeasure (P k)] + (ν : (k : ℕ) → Ω k → Measure (X k)) (hν : ∀ k, Measurable (ν k)) + [∀ k ω, IsProbabilityMeasure (ν k ω)] + (B : (k : ℕ) → Ω k → X k → X k → SpectralEntry (m + 1)) + (hB : ∀ k x y, Measurable (fun ω => B k ω x y)) + (hGram : ∀ k x, SpectralGram (cavitySampledEntryArray (B k) x)) + (v₀ : (k : ℕ) → Ω k → (j : Fin m) → X k → Fin (N k j) → ℝ) + (hvM : ∀ k x, Measurable (fun ω j => v₀ k ω j x)) + (C : ℝ) + (hv : ∀ s k (x : Ω k × (ℕ → X k)) j (i l : Fin s), |cavityGroupReplicaGram (fun j (i : Fin s) => v₀ k x.1 j (x.2 i)) j i l| ≤ C) + (ρs : ℕ → Fin m → ℝ) (ρ eig : Fin m → ℝ) + (hρs : ∀ k j, 0 < ρs k j) (hρ : ∀ j, 0 < ρ j) + (hρlim : Tendsto ρs atTop (𝓝 ρ)) (hρsum : ∑ j, ρ j = 1) + (hcov : ∀ s k (x : Ω k × (ℕ → X k)), cavityGroupReplicaCovariance q (cavityGroupReplicaGram (fun j (i : Fin s) => v₀ k x.1 j (x.2 i))) = + cavitySpectralBlockCovariance q (ρs k) (spectralBlockView (m + 1) s (cavitySampledEntryArray (B k) x))) + (Q : ℕ → ProbabilityMeasure (SpectralArray (m + 1))) + (Q₀ : ProbabilityMeasure (SpectralArray (m + 1))) + (hQ : ∀ k, (Q k : Measure (SpectralArray (m + 1))) = (disorderReplicaLaw (P k) (ν k) (hν k)).map (cavitySampledEntryArray (B k))) + (hlim : Tendsto Q atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralGram x) + (d : Fin (m + 1) → ℝ) (hd0 : ∀ j, 0 ≤ d j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ i j, (x (i,i) j : ℝ) = d j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ eig j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ eig j l = 0) + (g : Fin dim → Fin m) (e : Fin dim → Fin m × Fin q) + (he : Function.Injective e) (heg : ∀ j, (e j).1 = g j) + (hNpos : ∀ n a, 0 < N n a) (hC : 0 ≤ C) + (hdim : 0 < dim) (hkspin : 0 < kspin) + (T : Finset (Spin kspin)) (hT : T.Nonempty) + (B₀ : Matrix (Fin (m*kspin)) (Fin dim) ℝ) (hB₀ : B₀.transpose * B₀ = 1) + (hBE : B₀.transpose * cavityLimitingStack (n := kspin) ρ = 0) + (hcomplete : B₀ * B₀.transpose + cavityLimitingStack (n := kspin) ρ * + (cavityLimitingStack (n := kspin) ρ).transpose = 1) + (a : Fin m) (ha : ∀ b, eig b ≤ eig a) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) (site : Fin kspin) + {M : ℝ} (hΦb : ∀ x, |Φ x| ≤ M) + (b : ℕ → ℝ) (hb : ∀ j, 0 < b j) (hblim : Tendsto b atTop atTop) + (hnull : ∀ j s, (cavityBlockMarkedLaw (q := q) Q₀ ρ (cavitySpectralGroupBlock m s) : Measure + (SpectralBlock m s × EuclideanSpace ℝ (Fin m × (Fin s × Fin q)))) + {z | cavityReplicaRadius (cavitySelectedGroupProjection e) z = b j} = 0) : + let p := spectralSpinQuantilePath Q₀ hP hn + let K := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * B₀ - + Matrix.diagonal (fun i => eig (g i)) + let L := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * + cavityLimitingStack (n := kspin) ρ + let Cspin := (finiteR ρ eig hρ hρsum 0) • (1 : Matrix (Fin kspin) (Fin kspin) ℝ) + let τ := fun j => cavityFactorSize K L Cspin * (1+(b j)^2) + ∀ ε > 0, ∀ᶠ j in atTop, ∀ᶠ n in atTop, + |(∫ ω, cavityWeightedReplicaMean ((ν n ω.1).prod (restrictedSpinPrior T hT)) + (fun x => cavityHaarRestrictedWeight e (v₀ n) (A₀ n) K L Cspin (τ j) (b j) (ω,x)) + (cavityProjectedSpinTest (cavitySampledGroupBlock (B n) ω.1) + (cavitySpinObservable Φ hΦ site)) ∂(P n).prod (Measure.pi (μ n))) - + ∫ t, Φ (cavityStrictUniformPath p n t) * + restrictedCoordinateOverlapPath hkspin T hT (cavityStrictUniformField ρ eig hρ hρsum p n) site t ∂pathMeasure| < ε := by + intro p K L Cspin τ + have hh := cavity_haar_finite_cutoff_comparison N hN μ A₀ hA₀ Ω X P ν hν B hB + hGram v₀ hvM C hv ρs ρ eig hρs hρ hρlim hρsum hcov Q Q₀ hQ hlim hgg hG + d hd0 hd hE hP hn hoff hdiag g e he heg K L Cspin (restrictedSpinPrior T hT) + (cavitySpinObservable Φ hΦ site) hNpos hC B₀ hB₀ a ha rfl b hb hblim hnull + dsimp only at hh + intro ε hε + filter_upwards [hh ε hε] with j hj + filter_upwards [hj] with n hn' + have hf := restricted_strict_finite_spin_test hpub hdim hkspin T hT ρ eig hρ hρsum B₀ hB₀ + hBE hcomplete g a ha p Φ hΦ (n := n) site hΦb + dsimp only at hf + rw [hf] at hn' + exact hn' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarLogIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarLogIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b83f622812f6068ecf88a18ca5e56a2a2e86ffe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarLogIncrement.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorLogAverage +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalProjectorIncrement +import OAI.Probability.InvariantIsing.Cavity.CavityOrientedProjectors +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOrientationLog + +namespace OAI + +/-! The geometric cavity lower bound averaged over its physical Haar +disorder. Full-rank compression and all logarithmic integrability +requirements are supplied by the actual finite model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_haar_capped_log_increment {N n m d depth : ℕ} (hN : 0 cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams g U) + let q := fun V => cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + let c := fun a => t*lam a+2*perturbationScale N*v a + let δ := cavityDeterministicRate n m (2*(2*n+1)) N+ + 2*cavityCovarianceRate n (2*n+1) N + (∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) ∂μ.prod ν) + + (∫ V, restrictedProjectorLogPartition S hS T c u (q V).1 ∂ν) ≤ + ∫ U, restrictedRotationLogMean (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) T + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u + ((cavitySpecialOrthogonal (cavityOrientationLift (by omega : 0 cavityPhysicalLabeledProjectors g B a₀ U + let F := fun U => restrictedProjectorCappedLog S hS C hC T c u t cap δ (A U) (p U) + + restrictedProjectorLogPartition S hS T c u (p U).1 + let R := fun U : Orthogonal (N+n) => + (cavitySpecialOrthogonal (cavityOrientationLift (by omega : 0 lam (g i)) (cavitySpectralGroup g) v t + let J := fun U => restrictedRotationLogMean (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) T eig (cavitySpectralGroup g) u (R U) + have hav := restricted_physical_log_average S hS C hC g k ek e es B₀ a₀ l r hg hln hr μ ν T lam v u hu + t cap δ hcap + have hR : Measurable R := + (measurable_subtype_coe.subtype_mk.comp + (measurable_cavityOrientationLift (by omega : 0 by + rw [Real.norm_eq_abs] + simpa only [Nat.cast_add, Function.comp_apply] using + restrictedRotationLogMean_bound (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) T eig (cavitySpectralGroup g) u hu (R U) + have hle : F ≤ᵐ[μ] J := by + filter_upwards [cavityCompressionGrams_posDef_ae g l r hg hln hr μ] with U hU + let V := cavityOrientationLift (by omega : 0 v ω a x)) + (A₀ : (a : Fin m) → Matrix (Fin (dims a)) (Fin q) ℝ) + (B : Ω → CavityFactorBlocks d n) (hB : Measurable B) (t cap δ : ℝ) : + Measurable (restrictedHaarLogObservable C hC ν e v A₀ B t cap δ) := by + let U := (a : Fin m) → Orthogonal (dims a) + let κ := cavityHaarSpinPriorKernel (U := U) ν hν (restrictedSpinPrior C hC : Measure (Spin n)) + let Y := fun p : (Ω × U) × (X × Spin n) => + cavitySelectedSiteProjection e (v p.1.1) (cavityGroupHaarFrames A₀ p.1.2) p.2.1 + have hY : Measurable Y := (measurable_cavitySelectedSiteProjection e v hv A₀).comp + (measurable_fst.prodMk measurable_snd.fst) + let H := fun p : (Ω × U) × (X × Spin n) => + min (t*cavityLogFactor (B p.1.1).1 (B p.1.1).2.1 (B p.1.1).2.2 (Y p) p.2.2) cap - + δ*(1+‖Y p‖^2) + have hH : Measurable H := by + have hB' : Measurable (fun p : (Ω × U) × (X × Spin n) => B p.1.1) := + hB.comp measurable_fst.fst + dsimp only [H] + unfold cavityLogFactor cavityQuadratic + fun_prop + have hh := (measurable_random_referencePartition (ν := fun p => κ p) κ.measurable hH).log + change Measurable (fun p => restrictedHaarLogObservable C hC ν e v A₀ B t cap δ p) + simpa only [κ, cavityHaarSpinPriorKernel_apply, H, Y, restrictedHaarLogObservable, + referencePartition] using hh + +lemma restrictedHaarLogObservable_bound {m q d n : ℕ} {dims : Fin m → ℕ} {Ω X : Type*} + [MeasurableSpace X] [Countable X] [MeasurableSingletonClass X] + (C : Finset (Spin n)) (hC : C.Nonempty) (ν : Ω → Measure X) [∀ ω, IsProbabilityMeasure (ν ω)] + (e : Fin d → Fin m × Fin q) (v : Ω → (a : Fin m) → X → Fin (dims a) → ℝ) + (A₀ : (a : Fin m) → Matrix (Fin (dims a)) (Fin q) ℝ) + (B : Ω → CavityFactorBlocks d n) (t cap δ : ℝ) (hcap : 0 ≤ cap) + {D R : ℝ} (hD : ∀ ω, cavityFactorSize (B ω).1 (B ω).2.1 (B ω).2.2 ≤ D) + (hy : ∀ ω W x, ‖cavitySelectedSiteProjection e (v ω) (cavityGroupHaarFrames A₀ W) x‖^2 ≤ R) + (p : Ω × ((a : Fin m) → Orthogonal (dims a))) : + |restrictedHaarLogObservable C hC ν e v A₀ B t cap δ p| ≤ (|t| *D+|δ|)*(1+R) := by + simpa only [logMean, one_mul, div_one, restrictedHaarLogObservable] using + logMean_bounds ((ν p.1).prod (restrictedSpinPrior C hC : Measure (Spin n))) + (measurable_of_countable _) (by norm_num : (0:ℝ)<1) + (fun x => cavity_capped_factor_growth_bound (B p.1) (hD p.1) _ (hy p.1 p.2 x.1) x.2 + t cap δ hcap) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarSymmetry.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarSymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..95b7b05b49c73471d82f13e77cbfeb783f233599 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedHaarSymmetry.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFullSymmetry +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinSymmetry + +namespace OAI + +/-! The full finite Ising model with its actual spectral/tree tensor +perturbation has signed site-permutation symmetry after Haar averaging. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +theorem restricted_full_signed_site_symmetry {N m depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [μ.IsMulRightInvariant] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (p : Equiv.Perm (Fin N)) + (hinv : ∀ σ, cavitySignedSpinPermutation p (cavityPermutationFlip hN p) σ ∈ S ↔ σ ∈ S) + (F : (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + {B : ℝ} (hB : 0 ≤ B) (hF : ∀ σ, |F σ| ≤ B) : + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + (∫ U, ∫ g, referenceReplicaMean ν + (fun x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) F + ∂gaussianCoordinates ∂μ) = + ∫ U, ∫ g, referenceReplicaMean ν + (fun x => rotatedEnergy eig (specialRotation U) x.1 + + cylinderField (cavityPerturbationCoefficients (specialRotation U) I u depth x) g) + (fun σ => F (fun i => + (cavitySignedSpinPermutation p (cavityPermutationFlip hN p) (σ i).1, (σ i).2))) + ∂gaussianCoordinates ∂μ := by + dsimp only + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let e := cavitySignedSpinPermutation p (cavityPermutationFlip hN p) + let H := fun (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf depth) => + rotatedEnergy eig (specialRotation U) x.1 + let C := fun (U : SpecialOrthogonal N) (x : Spin N × LabeledLeaf depth) => + cavityPerturbationCoefficients (specialRotation U) I u depth x + have hHm : Measurable (fun z : (SpecialOrthogonal N × (ℕ → ℝ)) × + (Spin N × LabeledLeaf depth) => H z.1.1 z.2 + cylinderField (C z.1.1 z.2) z.1.2) := by + apply measurable_from_prod_countable_left + intro x + have hr : Measurable (fun U : SpecialOrthogonal N => H U x) := by + unfold H rotatedEnergy + exact (Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector x.1) i).pow_const 2).const_mul (eig i)).const_mul _ + exact (hr.comp measurable_fst).add (measurable_cavityPerturbationField I u x) + have hmean : Measurable (fun U => ∫ g, referenceReplicaMean ν + (fun x => H U x + cylinderField (C U x) g) F ∂gaussianCoordinates) := + (measurable_referenceReplicaMean ν hHm + ((measurable_of_countable F).comp measurable_snd)).stronglyMeasurable.integral_prod_right'.measurable + apply cavity_twoReplica_ensemble_symmetry μ + (fun U => U * (spectralPermutation hN p)⁻¹) + (measurePreserving_mul_right μ _) ν (fun x => (e x.1, x.2)) + (restricted_labeled_spin_reference_equiv S hS T e hinv) H C + (fun U => ∑ σ : Spin N, |rotatedEnergy eig (specialRotation U) σ|) + (fun _ => 4 * (N * perturbationScale N ^ 2)) + · intro U x + exact Finset.single_le_sum + (f := fun σ : Spin N => |rotatedEnergy eig (specialRotation U) σ|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ x.1) + · intro U x + exact cavityPerturbationCoefficients_sq_le _ I u hu x + · intro U x + exact rotatedEnergy_cavityPermutation hN p eig U x.1 + · intro U x y + simp only [C, e, cavityPerturbationCoefficients_cross, cavityWeightedKernel, + cavityPerturbationKernel, projectedOverlap_cavityPermutation] + · exact measurable_of_countable F + · exact hB + · exact hF + · exact hmean.aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedKernelFactorization.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedKernelFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..8da7fc9e3fca0ca4964ac635342705a91e2158d6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedKernelFactorization.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairRootEntropy +import OAI.Probability.InvariantIsing.Fields.FieldPairProductLaw + +namespace OAI + +/-! The unrestricted member of the constrained sampling construction is +exactly the previously evaluated canonical scalar-field law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal BigOperators + +namespace InvariantIsing + +lemma finiteFieldIncrements_positive (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) : + ∀ av ∈ List.ofFn (fun i : Fin n => (b i, v i)), 0 < av.1 := by + intro av hav + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hav + exact hb i i.isLt + +lemma vectorGaussianTransition_univ {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) (a : ℝ) (r : ℝ≥0) : + vectorGaussianTransition N a r (restrictedFieldRecursion Finset.univ n b v) + (restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n b v hb).1 = + fieldVectorTransitionKernel N a r + (fieldScalarValue (List.ofFn (fun i : Fin n => (b i, v i))) (fun y => Real.log (Real.cosh y))) + (fieldScalarValue_regular _ (finiteFieldIncrements_positive n b v hb) + measurable_logCosh logCosh_linearGrowth).1 := by + ext z : 1 + rw [vectorGaussianTransition_eq_tilted hN a r _ _ + (restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n b v hb).2, + fieldVectorTransitionKernel_eq_tilted a r _ _ + (fieldScalarValue_regular _ (finiteFieldIncrements_positive n b v hb) + measurable_logCosh logCosh_linearGrowth).2] + congr 1 + funext y + rw [restrictedFieldRecursion_univ n b v hb] + +lemma restrictedTailSpinKernel_univ {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) : + restrictedTailSpinKernel hN Finset.univ Finset.univ_nonempty n b v hb = + fieldVectorTailSpinKernel N (List.ofFn (fun i : Fin n => (b i, v i))) + (finiteFieldIncrements_positive n b v hb) := by + induction n generalizing b v with + | zero => exact restrictedSpinKernel_univ N + | succ n ih => + let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + have hbs : ∀ j < n, 0 < bs j := fun j hj => hb (j + 1) (by omega) + simp only [List.ofFn_succ, fieldVectorTailSpinKernel] + change restrictedTailSpinKernel hN Finset.univ Finset.univ_nonempty n bs vs hbs ∘ₖ + vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion Finset.univ n bs vs) + (restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n bs vs hbs).1 = _ + rw [ih bs vs hbs, vectorGaussianTransition_univ hN n bs vs hbs] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedKernelShift.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedKernelShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..77686c240df5b72e5aa81f57dc2804b917034ff1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedKernelShift.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinBias +import OAI.Probability.InvariantIsing.Fields.VectorTransitionShift +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairSpinKernel + +namespace OAI + +/-! Group-constant bias leaves every constrained continuation unchanged +once the same translation is applied to its current field. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma restrictedTailSpinKernel_group_shift {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (bias : A → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) (z : Fin N → ℝ) : + restrictedTailSpinKernel hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + n b v hb (z + fun j => bias (group j)) = + restrictedTailSpinKernel hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + n b v hb z := by + induction n generalizing b v z with + | zero => exact restrictedSpinKernel_group_bias group k hk bias z + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + let S := spinGroupSlice group k + have hS := spinGroupSlice_nonempty group k hk + let F := restrictedFieldRecursion S n bs vs + have hF := restrictedFieldRecursion_regular hN S hS n bs vs hbs + let κ := restrictedTailSpinKernel hN S hS n bs vs hbs + let K := vectorGaussianTransition N (b 0) (v 0) F hF.1 + change (κ ∘ₖ K) (z + fun j => bias (group j)) = (κ ∘ₖ K) z + ext T hT : 1 + rw [Kernel.comp_apply' _ _ _ hT, Kernel.comp_apply' _ _ _ hT, + vectorGaussianTransition_shift hN (b 0) (v 0) F hF.1 hF.2 + (fun j => bias (group j)) (spinGroupFieldConstant group k bias) + (fun y => restrictedFieldRecursion_group_bias hN group k hk bias n bs vs hbs y) z, + lintegral_map (g := fun y : Fin N → ℝ => y + fun j => bias (group j)) + (κ.measurable_coe hT) (measurable_id.add_const _)] + exact lintegral_congr (fun y => congrArg (fun μ : Measure (Spin N) => μ T) + (ih bs vs hbs y)) + +lemma restrictedPairSpinKernel_group_shift {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (bias : A → ℝ) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ j < n, 0 < b j) + (i : Fin (n + 1)) (z : Fin N → ℝ) : + restrictedPairSpinKernel hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + n b v hb i (z + fun j => bias (group j)) = + restrictedPairSpinKernel hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + n b v hb i z := by + let _ := restrictedSpinKernel_markov (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + induction n generalizing b v z with + | zero => + simp only [restrictedPairSpinKernel, Kernel.prod_apply, restrictedSpinKernel_group_bias group k hk bias] + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) i + · simp only [restrictedPairSpinKernel, Fin.cases_zero, Kernel.prod_apply, + restrictedTailSpinKernel_group_shift hN group k hk bias] + · let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + have hbs : ∀ j < n, 0 < bs j := fun j hj => hb (j + 1) (by omega) + let S := spinGroupSlice group k + have hS := spinGroupSlice_nonempty group k hk + let F := restrictedFieldRecursion S n bs vs + have hF := restrictedFieldRecursion_regular hN S hS n bs vs hbs + let κ := restrictedPairSpinKernel hN S hS n bs vs hbs j + let K := vectorGaussianTransition N (b 0) (v 0) F hF.1 + change (κ ∘ₖ K) (z + fun j => bias (group j)) = (κ ∘ₖ K) z + ext T hT : 1 + rw [Kernel.comp_apply' _ _ _ hT, Kernel.comp_apply' _ _ _ hT, + vectorGaussianTransition_shift hN (b 0) (v 0) F hF.1 hF.2 + (fun j => bias (group j)) (spinGroupFieldConstant group k bias) + (fun y => restrictedFieldRecursion_group_bias hN group k hk bias n bs vs hbs y) z, + lintegral_map (g := fun y : Fin N → ℝ => y + fun j => bias (group j)) + (κ.measurable_coe hT) (measurable_id.add_const _)] + exact lintegral_congr (fun y => congrArg (fun μ : Measure (Spin N × Spin N) => μ T) + (ih bs vs hbs j y)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLeafConditioning.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLeafConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb296c3bb5aac7f94687acab2872afd054edb8fd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLeafConditioning.lean @@ -0,0 +1,93 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPriorIntegrability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedEndpointTest +import OAI.Probability.InvariantIsing.Fields.VectorTransitionShift + +namespace OAI + +/-! Exact conditioning of two constrained spins on their marked leaves. +The finite-prior normalization cancels from the leaf Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma referenceReplicaMean_add_constant {X : Type*} [MeasurableSpace X] [Countable X] + [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] + (F : X → ℝ) (hF : Integrable (fun x => Real.exp (F x)) ν) (c : ℝ) + {r : ℕ} (D : (Fin r → X) → ℝ) : + referenceReplicaMean ν (fun x => F x + c) D = referenceReplicaMean ν F D := by + have hi : Integrable (fun x => Real.exp (F x + c)) ν := by + simpa only [Real.exp_add] using hF.mul_const (Real.exp c) + rw [referenceReplicaMean_eq_tilted ν _ hi, referenceReplicaMean_eq_tilted ν _ hF, + tilted_add_constant ν F hF c] + +lemma restricted_two_gibbs_coordinate_mean {N : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (z : Fin 2 → Fin N → ℝ) (j : Fin N) : + (∫ σ : Fin 2 → Spin N, spinValue (σ 0 j) * spinValue (σ 1 j) + ∂Measure.pi (fun i => gibbsProbability (restrictedSpinPrior S hS : Measure (Spin N)) + (fieldEnergy (z i)))) = restrictedTerminalPairMean S j (z 0, z 1) := by + let μ := fun i : Fin 2 => gibbsProbability (restrictedSpinPrior S hS : Measure (Spin N)) + (fieldEnergy (z i)) + have hm : Measurable (fun p : Spin N × Spin N => spinValue (p.1 j) * spinValue (p.2 j)) := + measurable_of_finite _ + have hp := (measurePreserving_piFinTwo μ).hasLaw.integral_comp hm.aestronglyMeasurable + simp only [Function.comp_apply, MeasurableEquiv.piFinTwo_apply] at hp + change (∫ σ : Fin 2 → Spin N, spinValue (σ 0 j) * spinValue (σ 1 j) ∂Measure.pi μ) = _ + rw [hp] + dsimp only [μ] + simp_rw [gibbsProbability_restrictedSpinPrior] + let _ := restrictedSpinKernel_markov S hS + rw [restrictedTerminalPairMean, Kernel.parallelComp_apply] + rfl + +theorem restricted_leaf_spin_pair_conditioning {N n : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (ν : Measure (LabeledLeaf n)) [IsProbabilityMeasure ν] + (Y : LabeledLeaf n → Fin N → ℝ) + (he : Integrable (fun p : Spin N × LabeledLeaf n => Real.exp (fieldEnergy (Y p.2) p.1)) + ((restrictedSpinPrior S hS : Measure (Spin N)).prod ν)) + (ψ : ℕ → ℝ) {C : ℝ} (hψ : ∀ d, |ψ d| ≤ C) (j : Fin N) : + referenceReplicaMean ((restrictedSpinPrior S hS : Measure (Spin N)).prod ν) + (fun p => fieldEnergy (Y p.2) p.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf n => + ψ (labeledCommonDepth n (σ 0).2 (σ 1).2) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) = + referenceReplicaMean ν (fun α => restrictedFieldTerminal S (Y α)) + (fun α : Fin 2 → LabeledLeaf n => ψ (labeledCommonDepth n (α 0) (α 1)) * + restrictedTerminalPairMean S j (Y (α 0), Y (α 1))) := by + let μ : Measure (Spin N) := restrictedSpinPrior S hS + let H := fun p : Spin N × LabeledLeaf n => fieldEnergy (Y p.2) p.1 + let T := priorSpinLeafTerminal μ H + let c := Real.log S.card - N * Real.log 2 + have ht : (fun α => T α + c) = (fun α => restrictedFieldTerminal S (Y α)) := by + funext α + change finiteLogIntegral μ (fieldEnergy (Y α)) + c = _ + rw [show μ = (restrictedSpinPrior S hS : Measure (Spin N)) from rfl, + finiteLogIntegral_restrictedSpinPrior] + dsimp only [c, restrictedFieldTerminal] + ring + have hi := priorSpinLeafTerminal_exp_integrable μ ν H he + have hD : ∃ C : ℝ, ∀ σ : Fin 2 → Spin N × LabeledLeaf n, + |ψ (labeledCommonDepth n (σ 0).2 (σ 1).2) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))| ≤ C := by + refine ⟨C, fun σ => ?_⟩ + simpa only [abs_mul, abs_spinValue, one_mul, mul_one] using + hψ (labeledCommonDepth n (σ 0).2 (σ 1).2) + rw [priorSpinLeafPair_conditioning μ ν H he _ hD, ← ht, + referenceReplicaMean_add_constant ν T hi c] + congr 1 + funext α + change (∫ σ : Fin 2 → Spin N, + ψ (labeledCommonDepth n (α 0) (α 1)) * (spinValue (σ 0 j) * spinValue (σ 1 j)) + ∂Measure.pi (fun i => gibbsProbability μ (fieldEnergy (Y (α i))))) = _ + rw [integral_const_mul] + exact congrArg (fun x => ψ (labeledCommonDepth n (α 0) (α 1)) * x) + (restricted_two_gibbs_coordinate_mean S hS (fun i => Y (α i)) j) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearCoordinate.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fe18e394094f658345a14e3fff0fbbf6be24542 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearCoordinate.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Fields.PriorProjectedPair +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockMeasurability +import OAI.Probability.InvariantIsing.Cavity.CavityLinearSpinEvaluation + +namespace OAI + +/-! The constrained block spin test under its original Euclidean +Gaussian forest, including the independent residual and shared root. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal BigOperators + +namespace InvariantIsing + +def restrictedCavityLinearCoordinateMean {d k : ℕ} (T : Finset (Spin k)) (hT : T.Nonempty) + (h : FieldStep) (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (R : Matrix (Fin d) (Fin d) ℝ) + (L : Matrix (Fin d) (Fin k) ℝ) (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin k) : ℝ := + ∫ p, referenceReplicaMean + (((labeledLeafLaw h.depth p.1).prod (multivariateGaussian 0 R)).prod (restrictedSpinPrior T hT)) + (fun x : (LabeledLeaf h.depth × EuclideanSpace ℝ (Fin d)) × Spin k => + cavityLogFactor 0 L (c • 1) + (cavityLeafSum h.depth s (labeledNoiseLeaf _ h.depth + (p.1, markForestOfCoords _ h.depth p.2) x.1.1) + x.1.2 : EuclideanSpace ℝ (Fin d)) x.2) + (fun σ : Fin 2 → (LabeledLeaf h.depth × EuclideanSpace ℝ (Fin d)) × Spin k => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).1.1 (σ 1).1.1))) * + (spinValue ((σ 0).2 j) * spinValue ((σ 1).2 j))) + ∂cavityLinearFieldCoordinateLaw h S + +theorem restricted_cavity_linear_coordinate_reduce {d k : ℕ} (hk : 0 < k) + (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin k) : + restrictedCavityLinearCoordinateMean T hT h S R L c s q Φ j = + restrictedFieldSpinPairMean T hT h (cavityProjectField L s) q Φ j := by + let f : (LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d))) → + (LabeledTree h.depth × (ForestVertex h.depth → Fin k → ℝ)) := + fun p => (p.1, fun a => cavityProjectField L (p.2 a)) + have hf : Measurable f := measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_cavityProjectField L).comp ((measurable_pi_apply a).comp measurable_snd)) + have hp : MeasurePreserving f (cavityLinearFieldCoordinateLaw h S) + (fieldVectorCoordinateLaw k h) := + ⟨hf, cavity_projected_labeled_forest_law h.depth (chainExponent h.cut) + S hS L (fieldStepVariance h) hcov⟩ + have hi := hp.quasiMeasurePreserving.ae + (restricted_field_vector_spin_exp_integrable hk T hT h (cavityProjectField L s)) + calc + _ = ∫ p, restrictedFieldSpinPairIntegrand T hT h (cavityProjectField L s) (f p) q Φ j + ∂cavityLinearFieldCoordinateLaw h S := by + apply integral_congr_ae + filter_upwards [hi] with p hip + have he := prior_projected_spin_pair_reduce (labeledLeafLaw h.depth p.1) + (restrictedSpinPrior T hT : Measure (Spin k)) R hR L v hres + (fun α => cavityLeafSum h.depth s + (labeledNoiseLeaf _ h.depth (p.1, markForestOfCoords _ h.depth p.2) α)) + (measurable_of_countable _) c + (by simpa only [cavityProjectField_labeled_sum, fieldVectorEndpoint, f] using hip) + (fun σ : Fin 2 → Spin k × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) + (measurable_of_countable _) + simpa only [restrictedFieldSpinPairIntegrand, cavityProjectField_labeled_sum, + fieldVectorEndpoint, f] using he + _ = _ := hp.hasLaw.integral_comp + ((measurable_restrictedFieldSpinPairIntegrand T hT h q Φ j).comp + (measurable_const.prodMk measurable_id)).aestronglyMeasurable + +theorem restricted_cavity_linear_coordinate_evaluation + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {d k : ℕ} (hk : 0 < k) + (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (hroot : L.transpose * S₀ * L = h.height 0 • 1) + (c : ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin k) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + (∫ s, restrictedCavityLinearCoordinateMean T hT h S R L c s q Φ j + ∂multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀) = + ∫ t, Φ (q (fieldLevelIndex h t)) * + (∫ z, restrictedPairCoordinateMean hk T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h t) j z + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) ∂pathMeasure := by + simp_rw [restricted_cavity_linear_coordinate_reduce hk T hT h S hS R hR L v hcov hres c _ q Φ j] + have hp := cavity_scalar_projected_field_law S₀ hS₀ L + (NNReal.mk (h.height 0) (h.nonneg 0)) hroot + have hi := hp.hasLaw.integral_comp + (measurable_restrictedFieldSpinPairMean T hT h q Φ j).aestronglyMeasurable + simp only [Function.comp_def] at hi + exact hi.trans (restricted_field_spin_pair_evaluation hpub hk T hT h q Φ j hΦ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearDepthEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearDepthEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a518789538628a60768ba337ae34b3d6a22ff761 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearDepthEvaluation.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLinearSpinEvaluation +import OAI.Probability.InvariantIsing.Magnetic.RestrictedDepthPair +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLinearCoordinate + +namespace OAI + +/-! The common-depth law of the full linear cavity model, after +projection and ordinary-residual marginalization. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal + +namespace InvariantIsing + +def restrictedCavityLinearDepthPairMean {d k : ℕ} (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (R : Matrix (Fin d) (Fin d) ℝ) + (L : Matrix (Fin d) (Fin k) ℝ) (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (ψ : ℕ → ℝ) : ℝ := + ∫ p, referenceReplicaMean + (((labeledLeafLaw h.depth p.1).prod (multivariateGaussian 0 R)).prod (restrictedSpinPrior T hT)) + (fun x : (LabeledLeaf h.depth × EuclideanSpace ℝ (Fin d)) × Spin k => + cavityLogFactor 0 L (c • 1) + (cavityLeafSum h.depth s (labeledNoiseLeaf _ h.depth + (p.1, markForestOfCoords _ h.depth p.2) x.1.1) + x.1.2 : + EuclideanSpace ℝ (Fin d)) x.2) + (fun σ : Fin 2 → (LabeledLeaf h.depth × EuclideanSpace ℝ (Fin d)) × Spin k => + ψ (labeledCommonDepth h.depth (σ 0).1.1 (σ 1).1.1)) + ∂cavityLinearFieldCoordinateLaw h S + +theorem restricted_cavity_labeled_linear_depth_pair_reduce {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (ψ : ℕ → ℝ) : + restrictedCavityLinearDepthPairMean T hT h S R L c s ψ = + restrictedFieldDepthPairMean T hT h (cavityProjectField L s) ψ := by + let f : (LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d))) → + (LabeledTree h.depth × (ForestVertex h.depth → Fin k → ℝ)) := + fun p => (p.1, fun a => cavityProjectField L (p.2 a)) + have hf : Measurable f := measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_cavityProjectField L).comp ((measurable_pi_apply a).comp measurable_snd)) + have hp : MeasurePreserving f (cavityLinearFieldCoordinateLaw h S) + (fieldVectorCoordinateLaw k h) := + ⟨hf, cavity_projected_labeled_forest_law h.depth (chainExponent h.cut) + S hS L (fieldStepVariance h) hcov⟩ + have hi := hp.quasiMeasurePreserving.ae + (restricted_field_vector_spin_exp_integrable hk T hT h (cavityProjectField L s)) + calc + _ = ∫ p, restrictedFieldDepthPairIntegrand T hT h (cavityProjectField L s) (f p) ψ + ∂cavityLinearFieldCoordinateLaw h S := by + apply integral_congr_ae + filter_upwards [hi] with p hip + have he := prior_projected_spin_pair_reduce (labeledLeafLaw h.depth p.1) + (restrictedSpinPrior T hT) + R hR L v hres + (fun α => cavityLeafSum h.depth s + (labeledNoiseLeaf _ h.depth (p.1, markForestOfCoords _ h.depth p.2) α)) + (measurable_of_countable _) c + (by simpa only [cavityProjectField_labeled_sum, fieldVectorEndpoint, f] using hip) + (fun σ : Fin 2 → Spin k × LabeledLeaf h.depth => + ψ (labeledCommonDepth h.depth (σ 0).2 (σ 1).2)) + (measurable_of_countable _) + simpa only [restrictedFieldDepthPairIntegrand, cavityProjectField_labeled_sum, + fieldVectorEndpoint, f] using he + _ = _ := hp.hasLaw.integral_comp + ((measurable_restrictedFieldDepthPairIntegrand T hT h ψ).comp + (measurable_const.prodMk measurable_id)).aestronglyMeasurable + +theorem restricted_cavity_labeled_linear_depth_pair_evaluation (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) (ψ : ℕ → ℝ) + {C : ℝ} (hψ : ∀ i, |ψ i| ≤ C) : + restrictedCavityLinearDepthPairMean T hT h S R L c s ψ = + ∫ t, ψ (fieldLevelIndex h t).val ∂pathMeasure := by + rw [restricted_cavity_labeled_linear_depth_pair_reduce hk T hT h S hS R hR L v hcov hres c] + exact restricted_field_depth_pair_evaluation hpub T hT hk h ψ hψ _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearNoiseDepth.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearNoiseDepth.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd438adc30c174bbc9570f0d4fbb2c14974a6924 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearNoiseDepth.lean @@ -0,0 +1,84 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLinearNoiseEvaluation +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLinearDepthEvaluation +import OAI.Probability.InvariantIsing.Fields.PriorLabeledDepthPair +import OAI.Probability.InvariantIsing.Fields.PriorLinearIntegrability +import OAI.Probability.InvariantIsing.Cavity.CavityRootedDepthMean + +namespace OAI + +/-! Preservation of common-depth law under the full linear rooted Gibbs tilt. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal ENNReal + +namespace InvariantIsing + +theorem restricted_cavity_linear_noise_depth_test {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (hAtom : ∀ i < h.depth, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (ψ : ℕ → ℝ) : + (∫ V, cavityRootedDepthTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + ψ (s, V) + ∂(noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _)) = + restrictedCavityLinearDepthPairMean T hT h S R L c s ψ := by + let f := fun p : LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d)) => + labeledNoiseJoin _ h.depth (p.1, markForestOfCoords _ h.depth p.2) + have hp := cavity_linear_field_coordinates_law h S + have hb := chainExponent_admissible h.ordered_cut h.first h.last + have hgood := hp.quasiMeasurePreserving.ae + (noiseCascade_good (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) hb + (cavityGaussianMarks S)) + have hgi : ∀ᵐ p ∂cavityLinearFieldCoordinateLaw h S, Function.Injective p.2 := + (measurePreserving_snd + (μ := (labeledCascadeLaw h.depth (chainExponent h.cut) : Measure (LabeledTree h.depth))) + (ν := Measure.infinitePi (fun a : ForestVertex h.depth => + multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S (forestVertexDepth h.depth a))))).quasiMeasurePreserving.ae + (cavity_atomless_marks_injective h.depth (cavityGaussianMarks S) hAtom) + have hI := prior_cavity_linear_labeled_exp_ae hk (restrictedSpinPrior T hT) h S hS R hR L v hcov hres c s + have hm : Measurable (fun V => cavityRootedDepthTestMean h.depth 0 R L (c • 1) + (restrictedSpinPrior T hT) ψ (s, V)) := + (measurable_cavityRootedDepthTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + ψ).comp (measurable_const.prodMk measurable_id) + calc + _ = ∫ p, cavityRootedDepthTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + ψ (s, f p) + ∂cavityLinearFieldCoordinateLaw h S := + (hp.hasLaw.integral_comp hm.aestronglyMeasurable).symm + _ = _ := by + unfold restrictedCavityLinearDepthPairMean + apply integral_congr_ae + filter_upwards [hgood, hgi, hI] with p hpGood hpGi hpI + exact prior_cavity_labeled_rooted_depth_pair h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) s p.1 p.2 hpGi hpGood + (cavity_good_noise_total _ _ hpGood) hpI ψ + +theorem restricted_cavity_linear_rooted_depth_evaluation (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (hAtom : ∀ i < h.depth, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) (ψ : ℕ → ℝ) + {C : ℝ} (hψ : ∀ i, |ψ i| ≤ C) : + (∫ V, cavityRootedDepthTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) ψ (s,V) + ∂(noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _)) = + ∫ t, ψ (fieldLevelIndex h t).val ∂pathMeasure := by + rw [restricted_cavity_linear_noise_depth_test hk T hT h S hS hAtom R hR L v hcov hres c] + exact restricted_cavity_labeled_linear_depth_pair_evaluation hpub hk T hT h S hS R hR L v hcov hres c s ψ hψ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearNoiseEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearNoiseEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..38f774343001e6c48449cb6b7099a1674901b09e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearNoiseEvaluation.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLinearNoiseEvaluation +import OAI.Probability.InvariantIsing.Fields.PriorLabeledRootPair +import OAI.Probability.InvariantIsing.Fields.PriorLinearIntegrability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLinearCoordinate + +namespace OAI + +/-! The actual rooted linear Gibbs kernel, averaged over its marked +cascade disorder, has the scalar-field two-spin evaluation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal ENNReal + +namespace InvariantIsing + +theorem restricted_cavity_linear_noise_spin_test {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (hAtom : ∀ i < h.depth, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin k) : + (∫ V, cavityRootedSpinTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + (fun i => Φ (q (fieldDepthLevel h i))) j (s, V) + ∂(noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _)) = + restrictedCavityLinearCoordinateMean T hT h S R L c s q Φ j := by + let f := fun p : LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d)) => + labeledNoiseJoin _ h.depth (p.1, markForestOfCoords _ h.depth p.2) + have hp := cavity_linear_field_coordinates_law h S + have hb := chainExponent_admissible h.ordered_cut h.first h.last + have hgood := hp.quasiMeasurePreserving.ae + (noiseCascade_good (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) hb + (cavityGaussianMarks S)) + have hgi : ∀ᵐ p ∂cavityLinearFieldCoordinateLaw h S, Function.Injective p.2 := + (measurePreserving_snd + (μ := (labeledCascadeLaw h.depth (chainExponent h.cut) : Measure (LabeledTree h.depth))) + (ν := Measure.infinitePi (fun a : ForestVertex h.depth => + multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S (forestVertexDepth h.depth a))))).quasiMeasurePreserving.ae + (cavity_atomless_marks_injective h.depth (cavityGaussianMarks S) hAtom) + have hI := prior_cavity_linear_labeled_exp_ae hk (restrictedSpinPrior T hT) h S hS R hR L v hcov hres c s + have hm : Measurable (fun V => cavityRootedSpinTestMean h.depth 0 R L (c • 1) + (restrictedSpinPrior T hT) (fun i => Φ (q (fieldDepthLevel h i))) j (s, V)) := + (measurable_cavityRootedSpinTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + (fun i => Φ (q (fieldDepthLevel h i))) j).comp (measurable_const.prodMk measurable_id) + calc + _ = ∫ p, cavityRootedSpinTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + (fun i => Φ (q (fieldDepthLevel h i))) j (s, f p) + ∂cavityLinearFieldCoordinateLaw h S := + (hp.hasLaw.integral_comp hm.aestronglyMeasurable).symm + _ = _ := by + unfold restrictedCavityLinearCoordinateMean + apply integral_congr_ae + filter_upwards [hgood, hgi, hI] with p hpGood hpGi hpI + exact prior_cavity_labeled_rooted_spin_pair h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) s p.1 p.2 hpGi hpGood + (cavity_good_noise_total _ _ hpGood) hpI (fun i => Φ (q (fieldDepthLevel h i))) j + +theorem restricted_cavity_linear_rooted_spin_evaluation (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {d k : ℕ} (hk : 0 < k) (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (hAtom : ∀ i < h.depth, + NullSingletonClass (multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) (S i))) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (hroot : L.transpose * S₀ * L = h.height 0 • 1) + (c : ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin k) + {B : ℝ} (hΦ : ∀ x, |Φ x| ≤ B) : + (∫ s, ∫ V, cavityRootedSpinTestMean h.depth 0 R L (c • 1) (restrictedSpinPrior T hT) + (fun i => Φ (q (fieldDepthLevel h i))) j (s, V) + ∂(noiseCascadeLaw (EuclideanSpace ℝ (Fin d)) h.depth (chainExponent h.cut) + (cavityGaussianMarks S) : Measure _) + ∂multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀) = + ∫ t, Φ (q (fieldLevelIndex h t)) * + (∫ z, restrictedPairCoordinateMean hk T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h t) j z + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) ∂pathMeasure := by + simp_rw [restricted_cavity_linear_noise_spin_test hk T hT h S hS hAtom R hR L v hcov hres c] + exact restricted_cavity_linear_coordinate_evaluation hpub hk T hT h S hS R hR S₀ hS₀ L v + hcov hres hroot c q Φ j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearSpinEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearSpinEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..738a3d15fec0e8278570b82176c6f61842badbc9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLinearSpinEvaluation.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Fields.PriorProjectedPair +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockMeasurability +import OAI.Probability.InvariantIsing.Cavity.CavityLinearSpinEvaluation + +namespace OAI + +/-! The constrained block spin test under its original Euclidean +Gaussian forest, including the independent residual and shared root. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix NNReal BigOperators + +namespace InvariantIsing + +def restrictedCavityLinearBlockMean {d k : ℕ} (T : Finset (Spin k)) (hT : T.Nonempty) + (h : FieldStep) (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (R : Matrix (Fin d) (Fin d) ℝ) + (L : Matrix (Fin d) (Fin k) ℝ) (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) : ℝ := + ∫ p, referenceReplicaMean + (((labeledLeafLaw h.depth p.1).prod (multivariateGaussian 0 R)).prod (restrictedSpinPrior T hT)) + (fun x : (LabeledLeaf h.depth × EuclideanSpace ℝ (Fin d)) × Spin k => + cavityLogFactor 0 L (c • 1) + (cavityLeafSum h.depth s (labeledNoiseLeaf _ h.depth + (p.1, markForestOfCoords _ h.depth p.2) x.1.1) + x.1.2 : EuclideanSpace ℝ (Fin d)) x.2) + (fun σ : Fin 2 → (LabeledLeaf h.depth × EuclideanSpace ℝ (Fin d)) × Spin k => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).1.1 (σ 1).1.1))) * + ((k : ℝ)⁻¹ * ∑ j, spinValue ((σ 0).2 j) * spinValue ((σ 1).2 j))) + ∂cavityLinearFieldCoordinateLaw h S + +theorem restricted_cavity_linear_block_reduce {d k : ℕ} (hk : 0 < k) + (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (c : ℝ) (s : EuclideanSpace ℝ (Fin d)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + restrictedCavityLinearBlockMean T hT h S R L c s q Φ = + restrictedFieldBlockSpinMean T hT h (cavityProjectField L s) q Φ := by + let f : (LabeledTree h.depth × (ForestVertex h.depth → EuclideanSpace ℝ (Fin d))) → + (LabeledTree h.depth × (ForestVertex h.depth → Fin k → ℝ)) := + fun p => (p.1, fun a => cavityProjectField L (p.2 a)) + have hf : Measurable f := measurable_fst.prodMk (Measurable.of_eval fun a => + (measurable_cavityProjectField L).comp ((measurable_pi_apply a).comp measurable_snd)) + have hp : MeasurePreserving f (cavityLinearFieldCoordinateLaw h S) + (fieldVectorCoordinateLaw k h) := + ⟨hf, cavity_projected_labeled_forest_law h.depth (chainExponent h.cut) + S hS L (fieldStepVariance h) hcov⟩ + have hi := hp.quasiMeasurePreserving.ae + (restricted_field_vector_spin_exp_integrable hk T hT h (cavityProjectField L s)) + calc + _ = ∫ p, restrictedFieldBlockSpinIntegrand T hT h (cavityProjectField L s) (f p) q Φ + ∂cavityLinearFieldCoordinateLaw h S := by + apply integral_congr_ae + filter_upwards [hi] with p hip + have he := prior_projected_spin_pair_reduce (labeledLeafLaw h.depth p.1) + (restrictedSpinPrior T hT : Measure (Spin k)) R hR L v hres + (fun α => cavityLeafSum h.depth s + (labeledNoiseLeaf _ h.depth (p.1, markForestOfCoords _ h.depth p.2) α)) + (measurable_of_countable _) c + (by simpa only [cavityProjectField_labeled_sum, fieldVectorEndpoint, f] using hip) + (fun σ : Fin 2 → Spin k × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + ((k : ℝ)⁻¹ * ∑ j, spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) + (measurable_of_countable _) + simpa only [restrictedFieldBlockSpinIntegrand, cavityProjectField_labeled_sum, + fieldVectorEndpoint, f] using he + _ = _ := hp.hasLaw.integral_comp + ((measurable_restrictedFieldBlockSpinIntegrand T hT h q Φ hΦ).comp + (measurable_const.prodMk measurable_id)).aestronglyMeasurable + +theorem restricted_cavity_linear_block_evaluation + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {d k : ℕ} (hk : 0 < k) + (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (S : ℕ → Matrix (Fin d) (Fin d) ℝ) (hS : ∀ i, (S i).PosSemidef) + (R : Matrix (Fin d) (Fin d) ℝ) (hR : R.PosSemidef) + (S₀ : Matrix (Fin d) (Fin d) ℝ) (hS₀ : S₀.PosSemidef) + (L : Matrix (Fin d) (Fin k) ℝ) (v : ℝ≥0) + (hcov : ∀ i < h.depth, L.transpose * S i * L = (fieldStepVariance h i : ℝ) • 1) + (hres : L.transpose * R * L = (v : ℝ) • 1) + (hroot : L.transpose * S₀ * L = h.height 0 • 1) + (c : ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + (∫ s, restrictedCavityLinearBlockMean T hT h S R L c s q Φ + ∂multivariateGaussian (0 : EuclideanSpace ℝ (Fin d)) S₀) = + ∫ t, Φ (q (fieldLevelIndex h t)) * restrictedBlockOverlapPath hk T hT h t ∂pathMeasure := by + simp_rw [restricted_cavity_linear_block_reduce hk T hT h S hS R hR L v hcov hres c _ q Φ hΦ] + have hp := cavity_scalar_projected_field_law S₀ hS₀ L + (NNReal.mk (h.height 0) (h.nonneg 0)) hroot + have hi := hp.hasLaw.integral_comp + (measurable_restrictedFieldBlockSpinMean T hT h q Φ hΦ).aestronglyMeasurable + simp only [Function.comp_def] at hi + exact hi.trans (restricted_field_block_spin_evaluation hpub hk T hT h q Φ hΦ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLogMap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLogMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b3451bebda996133a2d5aa7df709e618c42ef35 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedLogMap.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProductPrior +import OAI.Probability.InvariantIsing.Cavity.CavityLogMap + +namespace OAI + +/-! Logarithmic cavity transport for the actual constrained spin priors. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma restricted_pair_leaf_swap_preserving {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (T : LabeledTree depth) : + MeasurePreserving (cavityPairLeafSwap (N := N) (n := n) (depth := depth)) + (((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T)) + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)) := by + have h₁ := measurePreserving_prodAssoc (restrictedSpinPrior S hS : Measure (Spin N)) + (restrictedSpinPrior C hC : Measure (Spin n)) (labeledLeafLaw depth T) + have h₂ := (MeasurePreserving.id (restrictedSpinPrior S hS : Measure (Spin N))).prod + (Measure.measurePreserving_swap (μ := (restrictedSpinPrior C hC : Measure (Spin n))) + (ν := labeledLeafLaw depth T)) + have h₃ := (measurePreserving_prodAssoc (restrictedSpinPrior S hS : Measure (Spin N)) + (labeledLeafLaw depth T) (restrictedSpinPrior C hC : Measure (Spin n))).symm MeasurableEquiv.prodAssoc + exact h₃.comp (h₂.comp h₁) + +lemma restricted_pair_leaf_base_partition {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (H : Spin N × LabeledLeaf depth → ℝ) : + (∫ x : (Spin N × Spin n) × LabeledLeaf depth, Real.exp (H (x.1.1,x.2)) + ∂((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T)) = + ∫ x, Real.exp (H x) + ∂labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T := by + have hp := restricted_pair_leaf_swap_preserving S hS C hC T + have hi := integral_map + (μ := ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T)) hp.measurable.aemeasurable + ((measurable_of_countable (fun x : (Spin N × LabeledLeaf depth) × Spin n => + Real.exp (H x.1))).aestronglyMeasurable) + rw [hp.map_eq] at hi + have he := integral_fun_fst + (μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (ν := (restrictedSpinPrior C hC : Measure (Spin n))) (fun x => Real.exp (H x)) + rw [he] at hi + simpa only [probReal_univ, one_smul, Function.comp_def, cavityPairLeafSwap] using hi.symm + +lemma restricted_pair_leaf_full_partition {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (H : Spin (N+n) × LabeledLeaf depth → ℝ) : + (∫ x : (Spin N × Spin n) × LabeledLeaf depth, Real.exp (H (cavityJoinedSpin x.1,x.2)) + ∂((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T)) = + ∫ x, Real.exp (H x) + ∂labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T := by + have hp := (restricted_cavity_spin_split_prior S hS C hC).prod (MeasurePreserving.id (labeledLeafLaw depth T)) + have hi := integral_map + (μ := labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T) + hp.measurable.aemeasurable + ((measurable_of_countable (fun x : (Spin N × Spin n) × LabeledLeaf depth => + Real.exp (H (cavityJoinedSpin x.1,x.2)))).aestronglyMeasurable) + unfold labeledSpinReference at hi ⊢ + rw [hp.map_eq] at hi + have he (σ : Spin (N+n)) : cavityJoinedSpin (cavitySpinSplit N n σ) = σ := by + funext i + refine Fin.addCases (fun j => ?_) (fun j => ?_) i <;> + simp [cavityJoinedSpin, cavitySpinSplit] + simpa only [Function.comp_def, Prod.map_fst, Prod.map_snd, id_eq, he] using hi + +lemma restricted_log_weight_pair_leaf {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (H W : (Spin N × LabeledLeaf depth) × Spin n → ℝ) : + Real.log (∫ x, Real.exp (W (cavityPairLeafSwap x)) + ∂(((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T)).tilted (H ∘ cavityPairLeafSwap)) = + Real.log (∫ x, Real.exp (W x) + ∂((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)).tilted H) := + cavity_log_weight_map _ _ _ (restricted_pair_leaf_swap_preserving S hS C hC T) H W + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedMinimumPressure.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedMinimumPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ed7f16436751cb5a8029b250d3a8fc57db15b41 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedMinimumPressure.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Fields.PriorZeroFieldPressure + +namespace OAI + +/-! The minimizing constrained pressure envelope has exactly the physical +pressure limit, with its finite-volume cube-mass normalization restored. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +lemma restricted_zero_field_minimum_cost + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + {N m : ℕ} (hN : 3 ≤ N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (hμ : μ.IsMulLeftInvariant) + (S : Finset (Spin N)) (hS : S.Nonempty) + (eig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (t : ℝ) + (u : Fin N → ℝ) (v : Fin m → ℝ) + (hu : ∀ j, u j ∈ Set.Icc (1 : ℝ) 2) (hv : ∀ a, v a ∈ Set.Icc (1 : ℝ) 2) + (hmin : ∀ u' v', (∀ j, u' j ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective μ (restrictedZeroTreePrior S hS) eig c I t (fun _ => 0) u v ≤ + priorPerturbationObjective μ (restrictedZeroTreePrior S hS) eig c I t (fun _ => 0) u' v') : + |(-priorPerturbationObjective μ (restrictedZeroTreePrior S hS) eig c I t (fun _ => 0) u v + + (N : ℝ)⁻¹*(Real.log S.card-N*Real.log 2)) - + ∫ U, restrictedRotatedPressure S (fun i => t*eig i) (specialRotation U) c ∂μ| ≤ + 2*m*perturbationScale N+8*perturbationScale N^2 ∧ + tensorMinimumPenalty u v ≤ 2*(2*m*perturbationScale N+8*perturbationScale N^2) := by + have hc := prior_minimum_perturbation_cost hhaar hgauss hN μ hμ (restrictedZeroTreePrior S hS) + eig c I t (fun _ => 0) monotone_const le_rfl u v hu hv hmin + rw [restricted_zero_field_pressure] at hc + constructor + · convert hc.1 using 1 + congr 1 + ring + · exact hc.2 + +lemma restricted_zero_field_minimum_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ r, 3 ≤ N r) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (μ : (r : ℕ) → Measure (SpecialOrthogonal (N r))) [∀ r, IsProbabilityMeasure (μ r)] + (hμ : ∀ r, (μ r).IsMulLeftInvariant) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (eig c : (r : ℕ) → Fin (N r) → ℝ) (I : (r : ℕ) → Fin m → Finset (Fin (N r))) + (t : ℕ → ℝ) (u : (r : ℕ) → Fin (N r) → ℝ) (v : ℕ → Fin m → ℝ) + (hu : ∀ r j, u r j ∈ Set.Icc (1 : ℝ) 2) (hv : ∀ r a, v r a ∈ Set.Icc (1 : ℝ) 2) + (hmin : ∀ r u' v', (∀ j, u' j ∈ Set.Icc (1 : ℝ) 2) → + (∀ a, v' a ∈ Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective (μ r) (restrictedZeroTreePrior (S r) (hS r)) + (eig r) (c r) (I r) (t r) (fun _ => 0) (u r) (v r) ≤ + priorPerturbationObjective (μ r) (restrictedZeroTreePrior (S r) (hS r)) + (eig r) (c r) (I r) (t r) (fun _ => 0) u' v') : + Tendsto (fun r => -priorPerturbationObjective (μ r) (restrictedZeroTreePrior (S r) (hS r)) + (eig r) (c r) (I r) (t r) (fun _ => 0) (u r) (v r) + + (N r : ℝ)⁻¹*(Real.log (S r).card-N r*Real.log 2) - + ∫ U, restrictedRotatedPressure (S r) (fun i => t r*eig r i) (specialRotation U) (c r) ∂μ r) + atTop (𝓝 0) ∧ + Tendsto (fun r => tensorMinimumPenalty (u r) (v r)) atTop (𝓝 0) := by + have hc r := restricted_zero_field_minimum_cost hhaar hgauss (hN r) (μ r) (hμ r) + (S r) (hS r) (eig r) (c r) (I r) (t r) (u r) (v r) (hu r) (hv r) (hmin r) + have hδ := (fullPerturbationCost_tendsto m).comp hNlim + constructor + · exact squeeze_zero_norm (fun r => by simpa only [Real.norm_eq_abs, Function.comp_def] using (hc r).1) hδ + · apply squeeze_zero (fun r => tensorMinimumPenalty_nonneg (u r) (v r)) (fun r => (hc r).2) + simpa only [mul_zero, Function.comp_def] using hδ.const_mul 2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOrientationLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOrientationLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..524aa25d79da189a7a30496064d37681eb056acd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOrientationLog.lean @@ -0,0 +1,47 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationLogMean +import OAI.Probability.InvariantIsing.Cavity.CavityOrientationProbability +import OAI.Probability.InvariantIsing.Cavity.CavityLogCovariance +import OAI.Probability.InvariantIsing.Cavity.CavityHaarSides + +namespace OAI + +/-! The orientation correction preserves the expected logarithmic +partition, not only the normalized Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma restricted_orientation_log_mean {N m depth : ℕ} (hN : 0 cavityOrientationLift_perturbation_covariance hN V I u x y) + +theorem restricted_orientation_haar_log_mean {N m depth : ℕ} (hN : 0 F (fun i => (σ i).val)) - + (∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian U (diagonalPerturbedEigenvalues eig I v t) I u z) + {x | w (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates)| ≤ + (2 * (2 : ℝ)^2 * (cavityCovarianceRate n C N * (2 * D)) + + 2 * 2 * (cavityCovarianceRate n C N * (2 * D)) + + 2 * 2 * (cavityDeterministicRate n m (2 * C) N * D)) / s₀ + M^2 * s₀ / 2 := by + intro ν s + rw [restricted_original_cutoff_subtype S hS Cset hCset U T eig I v u hu t w D F] + by_cases hp : ν s = 0 + · have hc : ν.comap (Subtype.val : s → (Spin N × Spin n) × LabeledLeaf depth) = 0 := by + apply Measure.ext + intro A hA + rw [comap_subtype_coe_apply (Set.to_countable s).measurableSet] + exact measure_mono_null (by rintro x ⟨y, _, rfl⟩; exact y.property) hp + have hz : subtypeReference ν s = 0 := by simp [subtypeReference, hp, hc] + change |cavityBaseCutoffReplicaMean U V J eig eig₀ v u t w D (subtypeReference ν s) _ - + cavityFullCutoffReplicaMean U I eig v u t w D (subtypeReference ν s) _| ≤ _ + rw [hz] + simp only [cavityBaseCutoffReplicaMean, cavityFullCutoffReplicaMean, + cavityCylinderReplicaMean, referenceReplicaMean, referencePartition, + integral_zero_measure, zero_pow (by decide : 2 ≠ 0), div_zero, + integral_zero, sub_self, abs_zero] + have hcov := cavityCovarianceRate_nonneg n hC N + have hdet : 0 ≤ cavityDeterministicRate n m (2 * C) N := by + unfold cavityDeterministicRate perturbationScale + positivity + positivity + · let := subtypeReference_probability ν ((Set.to_countable s).measurableSet) hp + exact cavity_finite_cutoff_test_comparison hN U V I J eig eig₀ v hv u hu t + w hw hC hD herr (subtypeReference ν s) (fun σ => F (fun i => (σ i).val)) + hM (fun σ => hF _) hs₀ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..e03575aa172b529b1fd9ef6cd1bccd6c979ee402 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalCutoff.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCutoffMap +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffZero +import OAI.Probability.InvariantIsing.Cavity.CavityOriginalFactor +import OAI.Probability.InvariantIsing.Cavity.CavityDisorderTestComparison + +namespace OAI + +/-! The cutoff in the original perturbed spin model is exactly the +subtype-prior test occurring in the finite geometric comparison. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators Classical + +namespace InvariantIsing + +theorem restricted_original_cutoff_subtype {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (U : Rotation (N+n)) (T : LabeledTree depth) + (eig : Fin (N+n) → ℝ) (I : Fin m → Finset (Fin (N+n))) + (v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + (w : Spin N × Spin n → ℝ) (D : ℝ) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + let ν := ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior Cset hCset)).prod + (labeledLeafLaw depth T) + let s := {x : (Spin N × Spin n) × LabeledLeaf depth | w x.1 ≤ D} + (∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian U (diagonalPerturbedEigenvalues eig I v t) I u z) + {x | w (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates) = + cavityFullCutoffReplicaMean U I eig v u t w D (subtypeReference ν s) + (fun σ => F (fun i => (σ i).val)) := by + intro ν s + let H := fun x : (Spin N × Spin n) × LabeledLeaf depth => + rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) U (cavityJoinedSpin x.1) + let A := fun x : (Spin N × Spin n) × LabeledLeaf depth => + cavityPerturbationCoefficients U I u depth (cavityJoinedSpin x.1,x.2) + have hi : ∀ᵐ z ∂gaussianCoordinates, + Integrable (fun x => Real.exp (H x + cylinderField (A x) z)) ν := by + apply cylinder_partition_exp_integrable_ae ν H + · exact cavity_bounded_base_exp_integrable ν H (fun x => + Finset.single_le_sum + (f := fun σ : Spin (N+n) => |rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) U σ|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ (cavityJoinedSpin x.1))) + · exact fun x => cavityPerturbationCoefficients_sq_le U I u hu (cavityJoinedSpin x.1,x.2) + change (∫ z, _ ∂gaussianCoordinates) = ∫ z, _ ∂gaussianCoordinates + apply integral_congr_ae + filter_upwards [hi] with z hz + have he := restricted_spin_cutoff_split S hS Cset hCset T (fun x => H x + cylinderField (A x) z) s F + have hfun : (fun x : Spin (N+n) × LabeledLeaf depth => + H (cavitySpinSplit N n x.1,x.2) + cylinderField (A (cavitySpinSplit N n x.1,x.2)) z) = + cavityRotationHamiltonian U (diagonalPerturbedEigenvalues eig I v t) I u z := by + funext x + simp only [H, A, cavityJoinedSpin_split, cavityRotationHamiltonian] + rw [hfun] at he + exact he.trans (cavity_cutoff_replica_subtype_all ν _ hz s + ((Set.to_countable s).measurableSet) F) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb024ff4c63cfcfd18d592c363483411604b6644 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullComparison.lean @@ -0,0 +1,127 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalTreeLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTreeCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTest + +namespace OAI + +/-! The full original Gibbs law converges, through the proved geometric +cutoff, to the actual fresh-Haar restricted law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator + +namespace InvariantIsing + +theorem restricted_original_full_haar_comparison {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (η : (j : ℕ) → Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j, IsProbabilityMeasure (η j)] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (θ : (j : ℕ) → Measure (LabeledTree (depth j))) [∀ j, IsProbabilityMeasure (θ j)] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) (t : ℝ) + {M₀ : ℝ} (hmean : ∀ j (T : LabeledTree (depth j)), restrictedCavityFullDisorderTest + (cavityProductSlice (S j) Cset) (cavityProductSlice_nonempty (S j) (hS j) Cset hCset) + ((μ j).map (cavityOrientationLift (Nat.add_pos_left (hN j) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (cavitySpectralGroup (g j)) (u j) + (cavityProjectionAxesTest (cavitySpectralGroup (g j)) (Fin.natAdd (N j))) ≤ M₀) + (good : (j : ℕ) → Set (SpecialOrthogonal (N j+n))) + (hgood : ∀ j, MeasurableSet (good j)) + (hp : Tendsto (fun j => ((μ j).map (cavityOrientationLift + (Nat.add_pos_left (hN j) n))).real (good j)) atTop (𝓝 1)) + {L M : ℝ} (hL : 0 < L) + (hbound : ∀ j U, U ∈ good j → ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams (g j) (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) + (hM : 0 ≤ M) + (F : (j : ℕ) → (Fin 2 → (Spin (N j) × LabeledLeaf (depth j)) × Spin n) → ℝ) + (hF : ∀ j σ, |F j σ| ≤ M) (A : CavityFactorBlocks d n) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) + (b : ℕ → ℝ) (hb : ∀ j, 0 < b j) (hblim : Tendsto b atTop atTop) : + let E := fun j => cavityBaseGroupEquiv (k j) (e j) a₀ + let eig := fun j => diagonalPerturbedEigenvalues (fun i => lam ((E j).symm i).1) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (v j) t + let τ := fun j => cavityFactorSize (t • A.1) (t • A.2.1) (t • A.2.2) * (1+(b j)^2) + ∀ ε > 0, ∀ᶠ j in atTop, ∀ᶠ r in atTop, + |(∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) t) + (cavitySpectralGroup (g r)) (u r) + (fun σ => F r (fun i => (((cavitySpinSplit (N r) n (σ i).1).1,(σ i).2), + (cavitySpinSplit (N r) n (σ i).1).2))) ∂θ r) - + ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability (S r) (hS r) (eig r) + (cavitySpectralGroup (fun i => ((E r).symm i).1)) (u r) p.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun i => (a₀ i,i)) + (cavityRotationVectors (cavityBaseGroupDimension (k r) a₀) (E r)) + (cavityCanonicalGroupFrame (k r) (e r) a₀ (hk r)) + (t • A.1) (t • A.2.1) (t • A.2.2) (τ j) (b j) (p,x)) (F r) + ∂((((ν r).prod (θ r)).prod gaussianCoordinates).prod (η r))| < ε := by + intro E eig τ + let μO := fun j => (μ j).map (cavityOrientationLift (Nat.add_pos_left (hN j) n)) + let (j : ℕ) : IsProbabilityMeasure (μO j) := + (Measure.isProbabilityMeasure_map_iff (measurable_cavityOrientationLift _).aemeasurable).mpr inferInstance + let (j : ℕ) : (μO j).IsMulRightInvariant := cavityOrientationLift_measure_rightInvariant _ _ + let eigFull := fun j => diagonalPerturbedEigenvalues (fun i => lam (g j i)) + (cavitySpectralGroup (g j)) (v j) t + let test := fun j (σ : Fin 2 → Spin (N j+n) × LabeledLeaf (depth j)) => + F j (fun i => (((cavitySpinSplit (N j) n (σ i).1).1,(σ i).2), + (cavitySpinSplit (N j) n (σ i).1).2)) + let B := fun j (U : SpecialOrthogonal (N j+n)) => + cavityConcreteComplement es B₀ (cavityCompressionGrams (g j) (cavitySpecialOrthogonal U)) + have hmB : ∀ j, Measurable (B j) := fun j => + (measurable_cavityConcreteComplement es B₀).comp + ((measurable_cavityCompressionGrams (g j)).comp + (show Measurable (cavitySpecialOrthogonal (N := N j+n)) from + measurable_subtype_coe.subtype_mk)) + have hcut := restricted_full_tree_cutoff_sequence N depth + (fun j => cavityProductSlice (S j) Cset) + (fun j => cavityProductSlice_nonempty (S j) (hS j) Cset hCset) μO θ eigFull g u hu hmean B hmB + (fun j U => cavityConcreteComplement_gram (g j) es B₀ (cavitySpecialOrthogonal U)) + good hgood hp hL hbound test hM (fun j σ => hF j _) b hb hblim + intro ε hε + filter_upwards [hcut (ε/2) (by positivity)] with j hj + have hmatch := restricted_original_tree_limit N depth S hS Cset hCset hN hNlim g k ek e es B₀ a₀ hk η + l w hg hln hw μ ν θ lam v hv u hu t (hb j).le hM F hF A hprob + have hmatch' := hmatch.eventually + (Metric.ball_mem_nhds 0 (show 0 < ε/2 by positivity)) + filter_upwards [hj,hmatch'] with r hr hr' + rw [Real.dist_eq,sub_zero] at hr' + have heq : + (∫ T, ∫ U, restrictedOriginalGeometricMean (S r) (hS r) Cset hCset (g r) (cavityConcreteComplement es B₀) T + (eigFull r) (u r) (1+(b j)^2) + (fun σ => F r (fun i => (((σ i).1.1,(σ i).2),(σ i).1.2))) + (cavityOrientationLift (Nat.add_pos_left (hN r) n) U) ∂μ r ∂θ r) = + ∫ T, restrictedCavityFullCutoffDisorderTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) (μO r) T (eigFull r) (cavitySpectralGroup (g r)) (u r) + (cavitySpecialCutoff (g r) (B r) (b j)) (fun _ => test r) ∂θ r := by + apply integral_congr_ae + filter_upwards [] with T + exact restricted_original_radial_cutoff (S r) (hS r) Cset hCset (μ r) (Nat.add_pos_left (hN r) n) (g r) + (cavityConcreteComplement es B₀) (measurable_cavityConcreteComplement es B₀) T + (eigFull r) (u r) (hb j).le _ + change |(∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) (μO r) T (eigFull r) (cavitySpectralGroup (g r)) (u r) + (test r) ∂θ r) - _| < ε + rw [heq] at hr' + exact (abs_sub_le _ _ _).trans_lt (add_lt_add hr hr') |>.trans_eq (by ring) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullOverlap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..a864bd541df05f779c368b27166b7dd6ff9fb86f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullOverlap.lean @@ -0,0 +1,125 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalOverlapLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSplitOverlapTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalOverlapCutoff +import OAI.Probability.InvariantIsing.Cavity.CavitySpectralCutoffRadii +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionLimitGeometry +import OAI.Probability.InvariantIsing.Cavity.CavitySplitOverlapTest + +namespace OAI + +/-! The actual full model, including the original random tree and both +perturbations, has the scalar-field two-spin limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator BoundedContinuousFunction BigOperators + +namespace InvariantIsing + +theorem restricted_original_overlap_limit (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (μG : (j : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j a, IsProbabilityMeasure (μG j a)] [∀ j a, (μG j a).IsMulRightInvariant] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (θ : (j : ℕ) → Measure (LabeledTree (depth j))) [∀ j, IsProbabilityMeasure (θ j)] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) + {M₀ : ℝ} (hmean : ∀ j (T : LabeledTree (depth j)), restrictedCavityFullDisorderTest + (cavityProductSlice (S j) Cset) (cavityProductSlice_nonempty (S j) (hS j) Cset hCset) + ((μ j).map (cavityOrientationLift (Nat.add_pos_left (hN j) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) 1) + (cavitySpectralGroup (g j)) (u j) + (cavityProjectionAxesTest (cavitySpectralGroup (g j)) (Fin.natAdd (N j))) ≤ M₀) + (good : (j : ℕ) → Set (SpecialOrthogonal (N j+n))) + (hgood : ∀ j, MeasurableSet (good j)) + (hp : Tendsto (fun j => ((μ j).map (cavityOrientationLift + (Nat.add_pos_left (hN j) n))).real (good j)) atTop (𝓝 1)) + {L : ℝ} (hL : 0 < L) + (hbound : ∀ j U, U ∈ good j → ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams (g j) (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) + (hd : 0 < d) (hn : 0 < n) + (hB₀ : B₀.transpose * B₀ = 1) + (ρ : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hperp : (cavityReindexedStack es (fun a => ρ a • 1)).transpose * B₀ = 0) + (hgroups : ∀ j a, 0 < cavityBaseGroupDimension (k j) a₀ a) + (hdims : ∀ a, Tendsto (fun j => cavityBaseGroupDimension (k j) a₀ a) atTop atTop) + {c : ℝ} (hc : 0 < c) + (hcG : ∀ j a, c ≤ (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) + (hρlim : Tendsto (fun j a => (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) atTop (𝓝 ρ)) + (A : CavityFactorBlocks d n) + (hA : A = ((cavityCompressionLimitFrame es B₀).transpose * + cavityRepeatedSpectrum (n := n) lam * cavityCompressionLimitFrame es B₀ - + Matrix.diagonal (fun i => lam (a₀ i)), + (cavityCompressionLimitFrame es B₀).transpose * cavityRepeatedSpectrum (n := n) lam * + cavityLimitingStack (n := n) ρ, + (finiteR ρ lam hρ hρsum 0) • (1 : Matrix (Fin n) (Fin n) ℝ))) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun j => restrictedRotationArrayLaw (S j) (hS j) (ν j) (θ j) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (v j) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (u j)) + atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (δ : Fin (m+1) → ℝ) (hδ0 : ∀ j, 0 ≤ δ j) + (hδ : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ) = δ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hnonneg : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ lam j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l = 0) + (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (Φ : ℝ →ᵇ ℝ) : + let p := spectralSpinQuantilePath Q₀ hP hnonneg + Tendsto (fun r => + (∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) (cavityFullOverlapInsertion Φ) ∂θ r) - + ∫ t, Φ (cavityStrictUniformPath p r t) ∂pathMeasure) + atTop (𝓝 0) := by + intro p + have ho := restricted_original_split_overlap_limit hpub N depth S hS Cset hCset hN hNlim + g k ek e es B₀ a₀ hk μG l w hg hln hw μ ν θ lam v hv u hu hmean good hgood hp hL hbound + hd hn hB₀ ρ hρ hρsum hperp hgroups hdims hc hcG hρlim A hA hprob Q₀ hlim hgg hG + δ hδ0 hδ hE hP hnonneg hoff hdiag a ha Φ + let μO := fun r => (μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n)) + let (r : ℕ) : IsProbabilityMeasure (μO r) := + (Measure.isProbabilityMeasure_map_iff (measurable_cavityOrientationLift _).aemeasurable).mpr inferInstance + have hs := restricted_full_split_tree_overlap_test_tendsto N depth + (fun r => cavityProductSlice (S r) Cset) + (fun r => cavityProductSlice_nonempty (S r) (hS r) Cset hCset) + hN hNlim μO θ + (fun r => diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (fun r => cavitySpectralGroup (g r)) u Φ + have hh := hs.add ho + simp only [add_zero] at hh + convert hh using 1 + funext r + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc0c932c31a6f29101058a3b82fa0cfc5a73473f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalFullSpin.lean @@ -0,0 +1,126 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalSpinLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSplitTreeSpinTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalSpinCutoff +import OAI.Probability.InvariantIsing.Cavity.CavitySpectralCutoffRadii +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionLimitGeometry +import OAI.Probability.InvariantIsing.Cavity.CavitySplitSpinTest + +namespace OAI + +/-! The actual full model, including the original random tree and both +perturbations, has the scalar-field two-spin limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator BoundedContinuousFunction BigOperators + +namespace InvariantIsing + +theorem restricted_original_spin_limit (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (μG : (j : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j a, IsProbabilityMeasure (μG j a)] [∀ j a, (μG j a).IsMulRightInvariant] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (θ : (j : ℕ) → Measure (LabeledTree (depth j))) [∀ j, IsProbabilityMeasure (θ j)] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) + {M₀ : ℝ} (hmean : ∀ j (T : LabeledTree (depth j)), restrictedCavityFullDisorderTest + (cavityProductSlice (S j) Cset) (cavityProductSlice_nonempty (S j) (hS j) Cset hCset) + ((μ j).map (cavityOrientationLift (Nat.add_pos_left (hN j) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) 1) + (cavitySpectralGroup (g j)) (u j) + (cavityProjectionAxesTest (cavitySpectralGroup (g j)) (Fin.natAdd (N j))) ≤ M₀) + (good : (j : ℕ) → Set (SpecialOrthogonal (N j+n))) + (hgood : ∀ j, MeasurableSet (good j)) + (hp : Tendsto (fun j => ((μ j).map (cavityOrientationLift + (Nat.add_pos_left (hN j) n))).real (good j)) atTop (𝓝 1)) + {L : ℝ} (hL : 0 < L) + (hbound : ∀ j U, U ∈ good j → ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams (g j) (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) + (hd : 0 < d) (hn : 0 < n) + (hB₀ : B₀.transpose * B₀ = 1) + (ρ : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hperp : (cavityReindexedStack es (fun a => ρ a • 1)).transpose * B₀ = 0) + (hgroups : ∀ j a, 0 < cavityBaseGroupDimension (k j) a₀ a) + (hdims : ∀ a, Tendsto (fun j => cavityBaseGroupDimension (k j) a₀ a) atTop atTop) + {c : ℝ} (hc : 0 < c) + (hcG : ∀ j a, c ≤ (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) + (hρlim : Tendsto (fun j a => (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) atTop (𝓝 ρ)) + (A : CavityFactorBlocks d n) + (hA : A = ((cavityCompressionLimitFrame es B₀).transpose * + cavityRepeatedSpectrum (n := n) lam * cavityCompressionLimitFrame es B₀ - + Matrix.diagonal (fun i => lam (a₀ i)), + (cavityCompressionLimitFrame es B₀).transpose * cavityRepeatedSpectrum (n := n) lam * + cavityLimitingStack (n := n) ρ, + (finiteR ρ lam hρ hρsum 0) • (1 : Matrix (Fin n) (Fin n) ℝ))) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun j => restrictedRotationArrayLaw (S j) (hS j) (ν j) (θ j) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (v j) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (u j)) + atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (δ : Fin (m+1) → ℝ) (hδ0 : ∀ j, 0 ≤ δ j) + (hδ : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ) = δ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hnonneg : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ lam j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l = 0) + (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (Φ : ℝ →ᵇ ℝ) (site : Fin n) : + let p := spectralSpinQuantilePath Q₀ hP hnonneg + Tendsto (fun r => + (∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) (cavityFullSpinInsertion Φ (Fin.natAdd (N r) site)) ∂θ r) - + ∫ t, Φ (cavityStrictUniformPath p r t) * + restrictedCoordinateOverlapPath hn Cset hCset (cavityStrictUniformField ρ lam hρ hρsum p r) site t ∂pathMeasure) + atTop (𝓝 0) := by + intro p + have ho := restricted_original_split_spin_limit hpub N depth S hS Cset hCset hN hNlim + g k ek e es B₀ a₀ hk μG l w hg hln hw μ ν θ lam v hv u hu hmean good hgood hp hL hbound + hd hn hB₀ ρ hρ hρsum hperp hgroups hdims hc hcG hρlim A hA hprob Q₀ hlim hgg hG + δ hδ0 hδ hE hP hnonneg hoff hdiag a ha Φ site + let μO := fun r => (μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n)) + let (r : ℕ) : IsProbabilityMeasure (μO r) := + (Measure.isProbabilityMeasure_map_iff (measurable_cavityOrientationLift _).aemeasurable).mpr inferInstance + have hs := restricted_full_split_tree_spin_test_tendsto N depth + (fun r => cavityProductSlice (S r) Cset) + (fun r => cavityProductSlice_nonempty (S r) (hS r) Cset hCset) + hN hNlim μO θ + (fun r => diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (fun r => cavitySpectralGroup (g r)) u Φ site + have hh := hs.add ho + simp only [add_zero] at hh + convert hh using 1 + funext r + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalGroupLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalGroupLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..e440caef97b7e0605026fbb3f3107128c45f25d2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalGroupLimit.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalGroupCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalWeighted +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarCutoffLimit + +namespace OAI + +/-! The original full-system cutoff and its actual fresh-group Gibbs +representation have the same limit after deterministic coefficient replacement. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Matrix Topology + +namespace InvariantIsing + +theorem restricted_original_group_cutoff_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (η : (j : ℕ) → Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j, IsProbabilityMeasure (η j)] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (T : (j : ℕ) → LabeledTree (depth j)) (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) (t : ℝ) + {D M : ℝ} (hD : 1 ≤ D) (hM : 0 ≤ M) + (F : (j : ℕ) → (Fin 2 → (Spin (N j) × Spin n) × LabeledLeaf (depth j)) → ℝ) + (hF : ∀ j σ, |F j σ| ≤ M) (A₀ : CavityFactorBlocks d n) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A₀}) atTop (𝓝 0)) : + Tendsto (fun j => + (∫ U, restrictedOriginalGeometricMean (S j) (hS j) Cset hCset (g j) (cavityConcreteComplement es B₀) (T j) + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) D (F j) (cavityOrientationLift (Nat.add_pos_left (hN j) n) U) ∂μ j) - + restrictedCanonicalGroupCutoffMean (S j) (hS j) Cset hCset (k j) (e j) a₀ (hk j) (ν j) (η j) (T j) + lam (v j) (u j) t D A₀ (fun σ => F j (fun i => cavityPairLeafUnswap (σ i)))) + atTop (𝓝 0) := by + have hh := restricted_haar_cutoff_limit N depth S hS Cset hCset hN hNlim g k ek e es B₀ a₀ l w hg hln hw + μ ν T lam v hv u hu t hD hM F hF A₀ hprob + apply hh.congr' + filter_upwards [] with j + congr 1 + exact restricted_canonical_weighted_average (S j) (hS j) Cset hCset (k j) (e j) a₀ (hk j) (ν j) (η j) + (T j) lam (v j) (u j) (hu j) t D A₀ (fun σ => F j (fun i => cavityPairLeafUnswap (σ i))) + hM (fun σ => hF j _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalHaarLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalHaarLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..83b34b08b1aeb63a8f44bab2ad73ea4ceee6227f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalHaarLimit.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalGroupLimit + +namespace OAI + +/-! The original cutoff spin law and the concrete restricted fresh-Haar +law agree asymptotically after coefficient replacement. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Matrix + +namespace InvariantIsing + +theorem restricted_original_haar_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (η : (j : ℕ) → Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j, IsProbabilityMeasure (η j)] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (T : (j : ℕ) → LabeledTree (depth j)) (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) (t : ℝ) + {R M : ℝ} (hR : 0 ≤ R) (hM : 0 ≤ M) + (F : (j : ℕ) → (Fin 2 → (Spin (N j) × LabeledLeaf (depth j)) × Spin n) → ℝ) + (hF : ∀ j σ, |F j σ| ≤ M) (A : CavityFactorBlocks d n) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) : + let E := fun j => cavityBaseGroupEquiv (k j) (e j) a₀ + let eig := fun j => diagonalPerturbedEigenvalues (fun i => lam ((E j).symm i).1) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (v j) t + let τ := cavityFactorSize (t • A.1) (t • A.2.1) (t • A.2.2) * (1+R^2) + Tendsto (fun j => + (∫ U, restrictedOriginalGeometricMean (S j) (hS j) Cset hCset (g j) (cavityConcreteComplement es B₀) (T j) + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) (1+R^2) (fun σ => F j (fun i => + (((σ i).1.1,(σ i).2),(σ i).1.2))) + (cavityOrientationLift (Nat.add_pos_left (hN j) n) U) ∂μ j) - + ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability (S j) (hS j) (eig j) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (u j) p.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun i => (a₀ i,i)) + (cavityRotationVectors (cavityBaseGroupDimension (k j) a₀) (E j)) + (cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (t • A.1) (t • A.2.1) (t • A.2.2) τ R (p,x)) (F j) + ∂((((ν j).prod (Measure.dirac (T j))).prod gaussianCoordinates).prod (η j))) + atTop (𝓝 0) := by + intro E eig τ + have hh := restricted_original_group_cutoff_limit N depth S hS Cset hCset hN hNlim g k ek e es B₀ a₀ hk η + l w hg hln hw μ ν T lam v hv u hu t (le_add_of_nonneg_right (sq_nonneg R)) hM + (fun j σ => F j (fun i => (((σ i).1.1,(σ i).2),(σ i).1.2))) + (fun j σ => hF j _) A hprob + apply hh.congr' + filter_upwards [] with j + have he := restricted_canonical_law (S j) (hS j) Cset hCset (k j) (e j) a₀ (hk j) (ν j) (η j) + (T j) lam (v j) (u j) (hu j) t A hR hM (F j) (hF j) + dsimp only at he + rw [he] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalOverlapLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalOverlapLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cfb9c1601d78b0ca256aec940ec01d5974aa7a3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalOverlapLimit.lean @@ -0,0 +1,163 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalFullComparison +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalOverlapCutoff +import OAI.Probability.InvariantIsing.Cavity.CavitySpectralCutoffRadii +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionLimitGeometry +import OAI.Probability.InvariantIsing.Cavity.CavitySplitOverlapTest + +namespace OAI + +/-! The actual full model, including the original random tree and both +perturbations, has the scalar-field two-spin limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator BoundedContinuousFunction BigOperators + +namespace InvariantIsing + +theorem restricted_original_split_overlap_limit (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (μG : (j : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j a, IsProbabilityMeasure (μG j a)] [∀ j a, (μG j a).IsMulRightInvariant] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (θ : (j : ℕ) → Measure (LabeledTree (depth j))) [∀ j, IsProbabilityMeasure (θ j)] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) + {M₀ : ℝ} (hmean : ∀ j (T : LabeledTree (depth j)), restrictedCavityFullDisorderTest + (cavityProductSlice (S j) Cset) (cavityProductSlice_nonempty (S j) (hS j) Cset hCset) + ((μ j).map (cavityOrientationLift (Nat.add_pos_left (hN j) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) 1) + (cavitySpectralGroup (g j)) (u j) + (cavityProjectionAxesTest (cavitySpectralGroup (g j)) (Fin.natAdd (N j))) ≤ M₀) + (good : (j : ℕ) → Set (SpecialOrthogonal (N j+n))) + (hgood : ∀ j, MeasurableSet (good j)) + (hp : Tendsto (fun j => ((μ j).map (cavityOrientationLift + (Nat.add_pos_left (hN j) n))).real (good j)) atTop (𝓝 1)) + {L : ℝ} (hL : 0 < L) + (hbound : ∀ j U, U ∈ good j → ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams (g j) (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) + (hd : 0 < d) (hn : 0 < n) + (hB₀ : B₀.transpose * B₀ = 1) + (ρ : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hperp : (cavityReindexedStack es (fun a => ρ a • 1)).transpose * B₀ = 0) + (hgroups : ∀ j a, 0 < cavityBaseGroupDimension (k j) a₀ a) + (hdims : ∀ a, Tendsto (fun j => cavityBaseGroupDimension (k j) a₀ a) atTop atTop) + {c : ℝ} (hc : 0 < c) + (hcG : ∀ j a, c ≤ (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) + (hρlim : Tendsto (fun j a => (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) atTop (𝓝 ρ)) + (A : CavityFactorBlocks d n) + (hA : A = ((cavityCompressionLimitFrame es B₀).transpose * + cavityRepeatedSpectrum (n := n) lam * cavityCompressionLimitFrame es B₀ - + Matrix.diagonal (fun i => lam (a₀ i)), + (cavityCompressionLimitFrame es B₀).transpose * cavityRepeatedSpectrum (n := n) lam * + cavityLimitingStack (n := n) ρ, + (finiteR ρ lam hρ hρsum 0) • (1 : Matrix (Fin n) (Fin n) ℝ))) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun j => restrictedRotationArrayLaw (S j) (hS j) (ν j) (θ j) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (v j) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (u j)) + atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (δ : Fin (m+1) → ℝ) (hδ0 : ∀ j, 0 ≤ δ j) + (hδ : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ) = δ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hnonneg : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ lam j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l = 0) + (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (Φ : ℝ →ᵇ ℝ) : + let p := spectralSpinQuantilePath Q₀ hP hnonneg + Tendsto (fun r => + (∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) (cavitySplitOverlapInsertion Φ) ∂θ r) - + ∫ t, Φ (cavityStrictUniformPath p r t) ∂pathMeasure) + atTop (𝓝 0) := by + intro p + let E := fun j => cavityBaseGroupEquiv (k j) (e j) a₀ + let eig := fun j => diagonalPerturbedEigenvalues (fun i => lam ((E j).symm i).1) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (v j) 1 + let B := cavityCompressionLimitFrame es B₀ + let F := fun j (σ : Fin 2 → (Spin (N j) × LabeledLeaf (depth j)) × Spin n) => + Φ (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1)) + have hF j σ : |F j σ| ≤ ‖Φ‖ := by + simpa only [F,abs_mul,abs_spinValue,mul_one,one_mul,Real.norm_eq_abs] using + Φ.norm_coe_le_norm (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1)) + obtain ⟨b,hblim,hb⟩ := cavity_spectral_common_cutoff_radii Q₀ ρ (fun i : Fin d => (a₀ i,i)) + have hbpos j := (hb j).1 + have hnull j r := (hb j).2 r + have hfinite := restricted_physical_overlap_cutoff hpub N depth hN S hS + (fun j => cavityBaseGroupDimension (k j) a₀) hgroups hdims E ν θ μG + (fun j => cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (fun j a => cavityCanonicalGroupFrame_gram (k j) (e j) a₀ (hk j) a) + eig u hc hcG ρ lam hρ hρsum hρlim Q₀ hlim hgg hG δ hδ0 hδ hE hP hnonneg hoff hdiag + a₀ (fun i => (a₀ i,i)) (fun i j hij => congrArg Prod.snd hij) (fun _ => rfl) + hd hn Cset hCset B (cavityCompressionLimitFrame_gram es B₀ hB₀) + (cavityCompressionLimitFrame_perp es B₀ ρ (fun a => (hρ a).le) hperp) + (cavityCompressionLimitFrame_complete es B₀ hB₀ ρ (fun a => (hρ a).le) hρsum hperp) + a ha Φ Φ.continuous (fun x => by simpa only [Real.norm_eq_abs] using Φ.norm_coe_le_norm x) + b hbpos hblim hnull + have horig := restricted_original_full_haar_comparison N depth S hS Cset hCset hN hNlim g k ek e es B₀ a₀ hk + (fun j => Measure.pi (μG j)) l w hg hln hw μ ν θ lam v hv u hu 1 hmean good hgood hp hL hbound + (norm_nonneg Φ) F hF A hprob b hbpos hblim + dsimp only at hfinite horig + rw [hA] at horig + simp only [one_smul] at horig + let cut := fun j r => ∫ ω, cavityWeightedReplicaMean + ((restrictedRotationProbability (S r) (hS r) (eig r) (cavitySpectralGroup (fun i => ((E r).symm i).1)) + (u r) ω.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun i => (a₀ i,i)) + (cavityRotationVectors (cavityBaseGroupDimension (k r) a₀) (E r)) + (cavityCanonicalGroupFrame (k r) (e r) a₀ (hk r)) + A.1 A.2.1 A.2.2 (cavityFactorSize A.1 A.2.1 A.2.2*(1+(b j)^2)) (b j) (ω,x)) (F r) + ∂(((ν r).prod (θ r)).prod gaussianCoordinates).prod (Measure.pi (μG r)) + let full := fun r => ∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) + ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) (cavitySplitOverlapInsertion Φ) ∂θ r + let scalar := fun r => ∫ t, Φ (cavityStrictUniformPath p r t) ∂pathMeasure + apply Metric.tendsto_nhds.mpr + intro ε hε + obtain ⟨j,hjO,hjF⟩ := ((horig (ε/2) (by positivity)).and + (hfinite (ε/2) (by positivity))).exists + filter_upwards [hjO,hjF] with r hrO hrF + have hrO' : |full r-cut j r| < ε/2 := by + dsimp only [cut] + rw [hA] + exact hrO + have hrF' : |cut j r-scalar r| < ε/2 := by + dsimp only [cut] + rw [hA] + exact hrF + rw [Real.dist_eq,sub_zero] + exact (abs_sub_le (full r) (cut j r) (scalar r)).trans_lt (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalRadialCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalRadialCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..743506d7d32a8801311fe9762dfdf4f94fe4bb0e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalRadialCutoff.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedGeometricMean +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpecialCutoffError +import OAI.Probability.InvariantIsing.Cavity.CavityFactorScaling +import OAI.Probability.InvariantIsing.Cavity.CavityOrientation + +namespace OAI + +/-! The original geometric cutoff is the radial special-coordinate +cutoff under the oriented Haar law, with the exact spin split. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +lemma restricted_original_radial_cutoff {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (μ : Measure (Orthogonal (N+n))) (hN : 0 < N+n) + (g : Fin (N+n) → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : Measurable B) (T : LabeledTree depth) (eig : Fin (N+n) → ℝ) + (u : ℕ → ℝ) {R : ℝ} (hR : 0 ≤ R) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) : + (∫ U, restrictedOriginalGeometricMean S hS Cset hCset g B T eig u (1+R^2) F + (cavityOrientationLift hN U) ∂μ) = + restrictedCavityFullCutoffDisorderTest (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) (μ.map (cavityOrientationLift hN)) T eig + (cavitySpectralGroup g) u + (cavitySpecialCutoff g (fun U => B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) R) + (fun _ σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) := by + have hs (U : SpecialOrthogonal (N+n)) : + {x : Spin (N+n) × LabeledLeaf depth | cavityGeometricWeight g + (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) U + (cavitySpinSplit N n x.1) ≤ 1+R^2} = + cavitySpecialCutoff g + (fun U => B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) R U := by + have he (σ : Spin (N+n)) : cavityJoinedSpin (cavitySpinSplit N n σ) = σ := by + funext i + refine Fin.addCases (fun j => ?_) (fun j => ?_) i <;> + simp [cavityJoinedSpin, cavitySpinSplit] + dsimp only [cavityGeometricWeight,cavitySpecialCutoff] + simp only [he] + exact (cavity_radial_square_cutoff _ (fun x => norm_nonneg _) hR).symm + have he : (fun U => restrictedOriginalGeometricMean S hS Cset hCset g B T eig u (1+R^2) F U) = + fun U => ∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityFullHamiltonian eig (cavitySpectralGroup g) u (U,z)) + (cavitySpecialCutoff g + (fun U => B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) R U) + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates := by + funext U + simp only [restrictedOriginalGeometricMean,hs] + rfl + rw [← integral_map_of_stronglyMeasurable (measurable_cavityOrientationLift hN) + (measurable_restrictedOriginalGeometricMean S hS Cset hCset g B hB T eig u (1+R^2) F).stronglyMeasurable] + rw [he] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalSpinLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalSpinLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..1083c532f67fb00429109b26127003f491569f5c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalSpinLimit.lean @@ -0,0 +1,166 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalFullComparison +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalSpinCutoff +import OAI.Probability.InvariantIsing.Cavity.CavitySpectralCutoffRadii +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionLimitGeometry +import OAI.Probability.InvariantIsing.Cavity.CavitySplitSpinTest + +namespace OAI + +/-! The actual full model, including the original random tree and both +perturbations, has the scalar-field two-spin limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Matrix MatrixOrder Matrix.Norms.L2Operator BoundedContinuousFunction BigOperators + +namespace InvariantIsing + +theorem restricted_original_split_spin_limit (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (μG : (j : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j a, IsProbabilityMeasure (μG j a)] [∀ j a, (μG j a).IsMulRightInvariant] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (θ : (j : ℕ) → Measure (LabeledTree (depth j))) [∀ j, IsProbabilityMeasure (θ j)] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) + {M₀ : ℝ} (hmean : ∀ j (T : LabeledTree (depth j)), restrictedCavityFullDisorderTest + (cavityProductSlice (S j) Cset) (cavityProductSlice_nonempty (S j) (hS j) Cset hCset) + ((μ j).map (cavityOrientationLift (Nat.add_pos_left (hN j) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) 1) + (cavitySpectralGroup (g j)) (u j) + (cavityProjectionAxesTest (cavitySpectralGroup (g j)) (Fin.natAdd (N j))) ≤ M₀) + (good : (j : ℕ) → Set (SpecialOrthogonal (N j+n))) + (hgood : ∀ j, MeasurableSet (good j)) + (hp : Tendsto (fun j => ((μ j).map (cavityOrientationLift + (Nat.add_pos_left (hN j) n))).real (good j)) atTop (𝓝 1)) + {L : ℝ} (hL : 0 < L) + (hbound : ∀ j U, U ∈ good j → ∀ a, + ‖(CFC.sqrt (cavityCompressionGrams (g j) (cavitySpecialOrthogonal U) a))⁻¹‖ ≤ L) + (hd : 0 < d) (hn : 0 < n) + (hB₀ : B₀.transpose * B₀ = 1) + (ρ : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hperp : (cavityReindexedStack es (fun a => ρ a • 1)).transpose * B₀ = 0) + (hgroups : ∀ j a, 0 < cavityBaseGroupDimension (k j) a₀ a) + (hdims : ∀ a, Tendsto (fun j => cavityBaseGroupDimension (k j) a₀ a) atTop atTop) + {c : ℝ} (hc : 0 < c) + (hcG : ∀ j a, c ≤ (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) + (hρlim : Tendsto (fun j a => (cavityBaseGroupDimension (k j) a₀ a : ℝ)/N j) atTop (𝓝 ρ)) + (A : CavityFactorBlocks d n) + (hA : A = ((cavityCompressionLimitFrame es B₀).transpose * + cavityRepeatedSpectrum (n := n) lam * cavityCompressionLimitFrame es B₀ - + Matrix.diagonal (fun i => lam (a₀ i)), + (cavityCompressionLimitFrame es B₀).transpose * cavityRepeatedSpectrum (n := n) lam * + cavityLimitingStack (n := n) ρ, + (finiteR ρ lam hρ hρsum 0) • (1 : Matrix (Fin n) (Fin n) ℝ))) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun j => restrictedRotationArrayLaw (S j) (hS j) (ν j) (θ j) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (v j) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k j) (e j) a₀).symm i).1)) (u j)) + atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (δ : Fin (m+1) → ℝ) (hδ0 : ∀ j, 0 ≤ δ j) + (hδ : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ) = δ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hnonneg : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ lam j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l = 0) + (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (Φ : ℝ →ᵇ ℝ) (site : Fin n) : + let p := spectralSpinQuantilePath Q₀ hP hnonneg + Tendsto (fun r => + (∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) (cavitySplitSpinInsertion Φ site) ∂θ r) - + ∫ t, Φ (cavityStrictUniformPath p r t) * + restrictedCoordinateOverlapPath hn Cset hCset (cavityStrictUniformField ρ lam hρ hρsum p r) site t ∂pathMeasure) + atTop (𝓝 0) := by + intro p + let E := fun j => cavityBaseGroupEquiv (k j) (e j) a₀ + let eig := fun j => diagonalPerturbedEigenvalues (fun i => lam ((E j).symm i).1) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (v j) 1 + let B := cavityCompressionLimitFrame es B₀ + let F := fun j (σ : Fin 2 → (Spin (N j) × LabeledLeaf (depth j)) × Spin n) => + Φ (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1)) * + (spinValue ((σ 0).2 site) * spinValue ((σ 1).2 site)) + have hF j σ : |F j σ| ≤ ‖Φ‖ := by + simpa only [F,abs_mul,abs_spinValue,mul_one,one_mul,Real.norm_eq_abs] using + Φ.norm_coe_le_norm (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1)) + obtain ⟨b,hblim,hb⟩ := cavity_spectral_common_cutoff_radii Q₀ ρ (fun i : Fin d => (a₀ i,i)) + have hbpos j := (hb j).1 + have hnull j r := (hb j).2 r + have hfinite := restricted_physical_spin_cutoff hpub N depth hN S hS + (fun j => cavityBaseGroupDimension (k j) a₀) hgroups hdims E ν θ μG + (fun j => cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (fun j a => cavityCanonicalGroupFrame_gram (k j) (e j) a₀ (hk j) a) + eig u hc hcG ρ lam hρ hρsum hρlim Q₀ hlim hgg hG δ hδ0 hδ hE hP hnonneg hoff hdiag + a₀ (fun i => (a₀ i,i)) (fun i j hij => congrArg Prod.snd hij) (fun _ => rfl) + hd hn Cset hCset B (cavityCompressionLimitFrame_gram es B₀ hB₀) + (cavityCompressionLimitFrame_perp es B₀ ρ (fun a => (hρ a).le) hperp) + (cavityCompressionLimitFrame_complete es B₀ hB₀ ρ (fun a => (hρ a).le) hρsum hperp) + a ha Φ Φ.continuous site (fun x => by simpa only [Real.norm_eq_abs] using Φ.norm_coe_le_norm x) + b hbpos hblim hnull + have horig := restricted_original_full_haar_comparison N depth S hS Cset hCset hN hNlim g k ek e es B₀ a₀ hk + (fun j => Measure.pi (μG j)) l w hg hln hw μ ν θ lam v hv u hu 1 hmean good hgood hp hL hbound + (norm_nonneg Φ) F hF A hprob b hbpos hblim + dsimp only at hfinite horig + rw [hA] at horig + simp only [one_smul] at horig + let cut := fun j r => ∫ ω, cavityWeightedReplicaMean + ((restrictedRotationProbability (S r) (hS r) (eig r) (cavitySpectralGroup (fun i => ((E r).symm i).1)) + (u r) ω.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun i => (a₀ i,i)) + (cavityRotationVectors (cavityBaseGroupDimension (k r) a₀) (E r)) + (cavityCanonicalGroupFrame (k r) (e r) a₀ (hk r)) + A.1 A.2.1 A.2.2 (cavityFactorSize A.1 A.2.1 A.2.2*(1+(b j)^2)) (b j) (ω,x)) (F r) + ∂(((ν r).prod (θ r)).prod gaussianCoordinates).prod (Measure.pi (μG r)) + let full := fun r => ∫ T, restrictedFullTest (cavityProductSlice (S r) Cset) (cavityProductSlice_nonempty (S r) (hS r) Cset hCset) + ((μ r).map (cavityOrientationLift (Nat.add_pos_left (hN r) n))) T + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) (cavitySplitSpinInsertion Φ site) ∂θ r + let scalar := fun r => ∫ t, Φ (cavityStrictUniformPath p r t) * + restrictedCoordinateOverlapPath hn Cset hCset (cavityStrictUniformField ρ lam hρ hρsum p r) site t ∂pathMeasure + apply Metric.tendsto_nhds.mpr + intro ε hε + obtain ⟨j,hjO,hjF⟩ := ((horig (ε/2) (by positivity)).and + (hfinite (ε/2) (by positivity))).exists + filter_upwards [hjO,hjF] with r hrO hrF + have hrO' : |full r-cut j r| < ε/2 := by + dsimp only [cut] + rw [hA] + exact hrO + have hrF' : |cut j r-scalar r| < ε/2 := by + dsimp only [cut] + rw [hA] + exact hrF + rw [Real.dist_eq,sub_zero] + exact (abs_sub_le (full r) (cut j r) (scalar r)).trans_lt (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalTreeLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalTreeLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bd240092c78fa9a755b4eb00034a397a41c4b7c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalTreeLimit.lean @@ -0,0 +1,108 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalHaarLimit +import OAI.Probability.InvariantIsing.Cavity.CavityUniformTreeLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalTreeRegular +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeRegular + +namespace OAI + +/-! The original cutoff comparison averaged over the actual random +cascade tree and all retained Gaussian disorder. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Matrix + +namespace InvariantIsing + +theorem restricted_original_tree_limit {m d n : ℕ} + (N depth : ℕ → ℕ) + (S : (j : ℕ) → Finset (Spin (N j))) (hS : ∀ j, (S j).Nonempty) + (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (hN : ∀ j, 0 < N j) (hNlim : Tendsto N atTop atTop) + (g : (j : ℕ) → Fin (N j+n) → Fin m) (k : ℕ → Fin m → ℕ) + (ek : ∀ j a, {i : Fin (N j+n) // g j i = a} ≃ Fin (k j a+n)) + (e : (j : ℕ) → (((a : Fin m) × Fin (k j a)) ⊕ Fin d) ≃ Fin (N j)) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (hk : ∀ j a, d ≤ k j a) + (η : (j : ℕ) → Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension (k j) a₀ a))) + [∀ j, IsProbabilityMeasure (η j)] + (l w : ℕ → Fin m → ℕ) + (hg : ∀ j a i, g j i=a ↔ l j a ≤ i.val ∧ i.val < w j a) + (hln : ∀ j a, l j a+n ≤ w j a) (hw : ∀ j a, w j a ≤ N j+n) + (μ : (j : ℕ) → Measure (Orthogonal (N j+n))) + [∀ j, IsProbabilityMeasure (μ j)] [∀ j, (μ j).IsMulRightInvariant] + (ν : (j : ℕ) → Measure (Orthogonal (N j))) + [∀ j, IsProbabilityMeasure (ν j)] [∀ j, (ν j).IsMulRightInvariant] + (θ : (j : ℕ) → Measure (LabeledTree (depth j))) [∀ j, IsProbabilityMeasure (θ j)] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) + (hv : ∀ j a, |v j a| ≤ 2) (u : ℕ → ℕ → ℝ) (hu : ∀ j i, |u j i| ≤ 2) (t : ℝ) + {R M : ℝ} (hR : 0 ≤ R) (hM : 0 ≤ M) + (F : (j : ℕ) → (Fin 2 → (Spin (N j) × LabeledLeaf (depth j)) × Spin n) → ℝ) + (hF : ∀ j σ, |F j σ| ≤ M) (A : CavityFactorBlocks d n) + (hprob : ∀ δ > 0, Tendsto (fun j => (μ j).real + {U | δ < cavityFactorDeviation + (cavityCompressionFactorBlocks es lam (fun i => lam (a₀ i)) B₀ + (cavityCompressionGrams (g j) U)) A}) atTop (𝓝 0)) : + let E := fun j => cavityBaseGroupEquiv (k j) (e j) a₀ + let eig := fun j => diagonalPerturbedEigenvalues (fun i => lam ((E j).symm i).1) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (v j) t + let τ := cavityFactorSize (t • A.1) (t • A.2.1) (t • A.2.2) * (1+R^2) + Tendsto (fun j => (∫ T, (∫ U, restrictedOriginalGeometricMean (S j) (hS j) Cset hCset (g j) (cavityConcreteComplement es B₀) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) (1+R^2) (fun σ => F j (fun i => + (((σ i).1.1,(σ i).2),(σ i).1.2))) + (cavityOrientationLift (Nat.add_pos_left (hN j) n) U) ∂μ j) ∂θ j) - + ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability (S j) (hS j) (eig j) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (u j) p.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun i => (a₀ i,i)) + (cavityRotationVectors (cavityBaseGroupDimension (k j) a₀) (E j)) + (cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (t • A.1) (t • A.2.1) (t • A.2.2) τ R (p,x)) (F j) + ∂((((ν j).prod (θ j)).prod gaussianCoordinates).prod (η j))) atTop (𝓝 0) := by + intro E eig τ + let O := fun j (T : LabeledTree (depth j)) => (∫ U, restrictedOriginalGeometricMean (S j) (hS j) Cset hCset (g j) (cavityConcreteComplement es B₀) T + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) (1+R^2) (fun σ => F j (fun i => + (((σ i).1.1,(σ i).2),(σ i).1.2))) + (cavityOrientationLift (Nat.add_pos_left (hN j) n) U) ∂μ j) + let C := fun j (T : LabeledTree (depth j)) => ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability (S j) (hS j) (eig j) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (u j) p.1).prod (restrictedSpinPrior Cset hCset)) + (fun x => cavityHaarRestrictedWeight (fun i => (a₀ i,i)) + (cavityRotationVectors (cavityBaseGroupDimension (k j) a₀) (E j)) + (cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (t • A.1) (t • A.2.1) (t • A.2.2) τ R (p,x)) (F j) + ∂((((ν j).prod (Measure.dirac T)).prod gaussianCoordinates).prod (η j)) + have hfix : ∀ T : (j : ℕ) → LabeledTree (depth j), + Tendsto (fun j => O j (T j)-C j (T j)) atTop (𝓝 0) := by + intro T + exact restricted_original_haar_limit N depth S hS Cset hCset hN hNlim g k ek e es B₀ a₀ hk η + l w hg hln hw μ ν T lam v hv u hu t hR hM F hF A hprob + have havg := cavity_average_zero_of_all_selections θ (fun j T => O j T-C j T) hfix + apply havg.congr' + filter_upwards [] with j + have hO := restricted_original_tree_regular (S j) (hS j) Cset hCset (μ j) (Nat.add_pos_left (hN j) n) (g j) + (cavityConcreteComplement es B₀) (measurable_cavityConcreteComplement es B₀) + (diagonalPerturbedEigenvalues (fun i => lam (g j i)) (cavitySpectralGroup (g j)) (v j) t) + (u j) hR hM (fun σ => F j (fun i => (((σ i).1.1,(σ i).2),(σ i).1.2))) + (fun σ => hF j _) + have hC := restricted_tree_regular (S j) (hS j) (ν j) (cavityBaseGroupDimension (k j) a₀) (E j) + (η j) (eig j) (cavitySpectralGroup (fun i => ((E j).symm i).1)) (u j) + (fun i => (a₀ i,i)) (cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (t • A.1) (t • A.2.1) (t • A.2.2) (restrictedSpinPrior Cset hCset : Measure (Spin n)) + τ R hM (F j) (hF j) + have hOi : Integrable (O j) (θ j) := integrable_of_measurable_abs_le hO.1 hO.2 + have hCi : Integrable (C j) (θ j) := integrable_of_measurable_abs_le hC.1 hC.2 + rw [integral_sub hOi hCi] + have he := restricted_tree_average (S j) (hS j) (ν j) (θ j) + (cavityBaseGroupDimension (k j) a₀) (E j) (η j) (eig j) + (cavitySpectralGroup (fun i => ((E j).symm i).1)) (u j) + (fun i => (a₀ i,i)) (cavityCanonicalGroupFrame (k j) (e j) a₀ (hk j)) + (t • A.1) (t • A.2.1) (t • A.2.2) (restrictedSpinPrior Cset hCset : Measure (Spin n)) + τ R hM (F j) (hF j) + exact congrArg (fun x => (∫ T, O j T ∂θ j)-x) he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalTreeRegular.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalTreeRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ce28949144551aa4740259d8de4e250fb1899b3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalTreeRegular.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeCutoffMeasurability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalRadialCutoff + +namespace OAI + +/-! The original geometric cutoff average is bounded and measurable in +the labeled tree, so its comparison may be averaged over that tree. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_original_tree_regular {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (μ : Measure (Orthogonal (N+n))) [IsProbabilityMeasure μ] (hN : 0 < N+n) + (g : Fin (N+n) → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : Measurable B) (eig : Fin (N+n) → ℝ) (u : ℕ → ℝ) + {R M : ℝ} (hR : 0 ≤ R) (hM : 0 ≤ M) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + Measurable (fun T : LabeledTree depth => ∫ U, + restrictedOriginalGeometricMean S hS Cset hCset g B T eig u (1+R^2) F (cavityOrientationLift hN U) ∂μ) ∧ + ∀ T : LabeledTree depth, |∫ U, + restrictedOriginalGeometricMean S hS Cset hCset g B T eig u (1+R^2) F (cavityOrientationLift hN U) ∂μ| ≤ M := by + constructor + · have he := funext fun T : LabeledTree depth => + restricted_original_radial_cutoff S hS Cset hCset μ hN g B hB T eig u hR F + rw [he] + have hmB : Measurable (fun U : SpecialOrthogonal (N+n) => + B (cavityCompressionGrams g (cavitySpecialOrthogonal U))) := + hB.comp ((measurable_cavityCompressionGrams g).comp + (measurable_subtype_coe.subtype_mk)) + exact measurable_restrictedCavityFullCutoffDisorderTest_tree (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) _ eig (cavitySpectralGroup g) u _ + (measurableSet_cavitySpecialCutoff g _ hmB R) _ + ((measurable_of_countable (fun σ : Fin 2 → Spin (N+n) × LabeledLeaf depth => + F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2)))).comp measurable_snd) + · intro T + have hh := norm_integral_le_of_norm_le_const (μ := μ) + (f := fun U => restrictedOriginalGeometricMean S hS Cset hCset g B T eig u (1+R^2) F (cavityOrientationLift hN U)) + (C := M) (ae_of_all _ fun U => restrictedOriginalGeometricMean_bound S hS Cset hCset g B T eig u (1+R^2) F hM hF _) + simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalWeightedComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalWeightedComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc842005a9c288ca9990c8030205eec70719d925 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedOriginalWeightedComparison.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalComparison +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBaseCutoffProduct + +namespace OAI + +/-! The original cutoff spin law compared with the actual base Gibbs +product reweighted by the unperturbed cavity factor. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators Classical + +namespace InvariantIsing + +theorem restricted_original_weighted_comparison {N n m depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (U : Rotation (N+n)) (V : Rotation N) (T : LabeledTree depth) + (I : Fin m → Finset (Fin (N+n))) (J : Fin m → Finset (Fin N)) + (eig : Fin (N+n) → ℝ) (eig₀ : Fin N → ℝ) + (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + (w : Spin N × Spin n → ℝ) (hw : ∀ x, 1 ≤ w x) + {C D M s₀ : ℝ} (hC : 0 ≤ C) (hD : 1 ≤ D) (hM : 0 ≤ M) (hs₀ : 0 < s₀) + (herr : ∀ x y a, |projectedOverlap U (I a) (cavityJoinedSpin x) (cavityJoinedSpin y) - + projectedOverlap V (J a) x.1 y.1| ≤ C / N * (w x + w y)) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + let μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let s := {x : (Spin N × Spin n) × LabeledLeaf depth | w x.1 ≤ D} + let W := fun x : (Spin N × Spin n) × LabeledLeaf depth => + t * (rotatedEnergy eig U (cavityJoinedSpin x.1) - rotatedEnergy eig₀ V x.1.1) + |(∫ z, cavityWeightedReplicaMean + ((μ.tilted (cavityRotationHamiltonian V (diagonalPerturbedEigenvalues eig₀ J v t) J u z)).prod + (restrictedSpinPrior Cset hCset)) + ((cavityPairLeafUnswap ⁻¹' s).indicator (fun x => Real.exp (W (cavityPairLeafUnswap x)))) + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) ∂gaussianCoordinates) - + (∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian U (diagonalPerturbedEigenvalues eig I v t) I u z) + {x | w (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates)| ≤ + (2 * (2 : ℝ)^2 * (cavityCovarianceRate n C N * (2 * D)) + + 2 * 2 * (cavityCovarianceRate n C N * (2 * D)) + + 2 * 2 * (cavityDeterministicRate n m (2 * C) N * D)) / s₀ + M^2 * s₀ / 2 := by + intro μ s W + rw [← restricted_base_cutoff_product S hS Cset hCset U V T J eig eig₀ v u hu t w D F] + exact restricted_original_cutoff_comparison hN S hS Cset hCset U V T I J eig eig₀ v hv u hu t + w hw hC hD hM hs₀ herr F hF + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairEntropy.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8063471515ecc451549c1ca88e5e3039bed3688a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairEntropy.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairSpinKernel + +namespace OAI + +/-! The entropy cost of a branching pair is at most twice the scalar +block loss, independently of the split level or number of levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal + +namespace InvariantIsing + +theorem restrictedPairSpinKernel_entropy {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (hb1 : ∀ j < n, b j ≤ 1) + (i : Fin (n + 1)) (z : Fin N → ℝ) : + klDiv (restrictedPairSpinKernel hN S hS n b v hb i z) + (restrictedPairSpinKernel hN Finset.univ Finset.univ_nonempty n b v hb i z) ≤ + 2 * ENNReal.ofReal (restrictedFieldRecursion Finset.univ n b v z - + restrictedFieldRecursion S n b v z) := by + let _ := restrictedSpinKernel_markov S hS + let _ := restrictedSpinKernel_markov (Finset.univ : Finset (Spin N)) Finset.univ_nonempty + have htail (m : ℕ) (c : ℕ → ℝ) (w : ℕ → ℝ≥0) (hc : ∀ j < m, 0 < c j) + (hc1 : ∀ j < m, c j ≤ 1) (y : Fin N → ℝ) : + klDiv ((restrictedTailSpinKernel hN S hS m c w hc y).prod + (restrictedTailSpinKernel hN S hS m c w hc y)) + ((restrictedTailSpinKernel hN Finset.univ Finset.univ_nonempty m c w hc y).prod + (restrictedTailSpinKernel hN Finset.univ Finset.univ_nonempty m c w hc y)) ≤ + 2 * ENNReal.ofReal (restrictedFieldRecursion Finset.univ m c w y - + restrictedFieldRecursion S m c w y) := by + have he := restrictedTailSpinKernel_entropy hN S hS m c w hc hc1 y + have hac := (klDiv_ne_top_iff.mp (ne_top_of_le_ne_top ENNReal.ofReal_ne_top he)).1 + rw [klDiv_prod_self _ _ hac] + exact mul_le_mul_right he 2 + induction n generalizing b v z with + | zero => + change klDiv ((_ ×ₖ _) z) ((_ ×ₖ _) z) ≤ _ + simpa only [restrictedTailSpinKernel, Kernel.prod_apply] using htail 0 b v hb hb1 z + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) i + · change klDiv ((_ ×ₖ _) z) ((_ ×ₖ _) z) ≤ _ + simp only [Kernel.prod_apply] + exact htail (n + 1) b v hb hb1 z + · let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + have hbs : ∀ j < n, 0 < bs j := fun j hj => hb (j + 1) (by omega) + have hbs1 : ∀ j < n, bs j ≤ 1 := fun j hj => hb1 (j + 1) (by omega) + let F := restrictedFieldRecursion (Finset.univ : Finset (Spin N)) n bs vs + let G := restrictedFieldRecursion S n bs vs + have hF := restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n bs vs hbs + have hG := restrictedFieldRecursion_regular hN S hS n bs vs hbs + let κ := restrictedPairSpinKernel hN S hS n bs vs hbs j + let η := restrictedPairSpinKernel hN Finset.univ Finset.univ_nonempty n bs vs hbs j + have hi (y : Fin N → ℝ) := ih bs vs hbs hbs1 j y + have hac (y : Fin N → ℝ) : κ y ≪ η y := + (klDiv_ne_top_iff.mp (ne_top_of_le_ne_top (by finiteness) (hi y))).1 + have hκ (y : Fin N → ℝ) : kernelRelativeEntropy κ η y ≤ + 2 * ENNReal.ofReal (F y - G y) := by + rw [kernelRelativeEntropy_eq κ η y (hac y)] + exact hi y + have hg := vectorGaussianTransition_entropy_budget hN (b 0) (hb 0 (by omega)) + (hb1 0 (by omega)) (v 0) F G hF.1 hG.1 hF.2 hG.2 + (fun y => restrictedFieldRecursion_mono hN S Finset.univ hS Finset.univ_nonempty + (Finset.subset_univ S) n bs vs hbs y) z + have he := entropy_budget_drop + (vectorGaussianTransition N (b 0) (v 0) G hG.1 z) + (vectorGaussianTransition N (b 0) (v 0) F hF.1 z) κ η hac + (fun y => 2 * ENNReal.ofReal (F y - G y)) hκ + rw [lintegral_const_mul 2 (f := fun y => ENNReal.ofReal (F y - G y)) + (hF.1.sub hG.1).ennreal_ofReal] at he + rw [Measure.comp_eq_comp_const_apply, Measure.comp_eq_comp_const_apply] at he + exact he.trans (entropy_budget_double hg) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairFactorization.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0ead0dda668984abee109e04b100d23e9bff40a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairFactorization.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedKernelFactorization + +namespace OAI + +/-! Identification of the canonical member of the branching-pair family. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma fieldVectorPairSpinKernel_zero (N : ℕ) (L : List (ℝ × ℝ≥0)) + (hL : ∀ av ∈ L, 0 < av.1) : + fieldVectorPairSpinKernel N L hL 0 = + fieldVectorTailSpinKernel N L hL ×ₖ fieldVectorTailSpinKernel N L hL := by + cases L <;> rfl + +lemma fieldVectorPairSpinKernel_transport (N : ℕ) {L L' : List (ℝ × ℝ≥0)} + (he : L = L') (hL : ∀ av ∈ L, 0 < av.1) (hL' : ∀ av ∈ L', 0 < av.1) + (i : Fin (L.length + 1)) (i' : Fin (L'.length + 1)) (hi : i.val = i'.val) : + fieldVectorPairSpinKernel N L hL i = fieldVectorPairSpinKernel N L' hL' i' := by + subst L' + have hii : i = i' := Fin.ext hi + subst i' + rfl + +theorem restrictedPairSpinKernel_univ {N : ℕ} (hN : 0 < N) (n : ℕ) + (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ j < n, 0 < b j) (i : Fin (n + 1)) : + restrictedPairSpinKernel hN Finset.univ Finset.univ_nonempty n b v hb i = + fieldVectorPairSpinKernel N (List.ofFn (fun j : Fin n => (b j, v j))) + (finiteFieldIncrements_positive n b v hb) (Fin.cast (by simp) i) := by + induction n generalizing b v with + | zero => + change restrictedSpinKernel Finset.univ ×ₖ restrictedSpinKernel Finset.univ = _ + rw [restrictedSpinKernel_univ] + rfl + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) i + · simp only [restrictedPairSpinKernel, Fin.cases_zero] + rw [restrictedTailSpinKernel_univ, Fin.cast_zero, fieldVectorPairSpinKernel_zero] + · let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + have hbs : ∀ j < n, 0 < bs j := fun j hj => hb (j + 1) (by omega) + let L := List.ofFn (fun k : Fin n => (bs k, vs k)) + have hlist : List.ofFn (fun k : Fin (n + 1) => (b k, v k)) = (b 0, v 0) :: L := by + rw [List.ofFn_succ] + rfl + have hL : ∀ av ∈ (b 0, v 0) :: L, 0 < av.1 := by + rw [← hlist] + exact finiteFieldIncrements_positive (n + 1) b v hb + let j' : Fin (L.length + 1) := Fin.cast (by simp [L]) j + have he := fieldVectorPairSpinKernel_transport N hlist + (finiteFieldIncrements_positive (n + 1) b v hb) hL + (Fin.cast (by simp) j.succ) j'.succ rfl + rw [he] + simp only [restrictedPairSpinKernel, Fin.cases_succ] + change restrictedPairSpinKernel hN Finset.univ Finset.univ_nonempty n bs vs hbs j ∘ₖ + vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion Finset.univ n bs vs) + (restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n bs vs hbs).1 = _ + rw [ih bs vs hbs, vectorGaussianTransition_univ hN n bs vs hbs] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairMoments.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c774875440fc18742e5ff428e5b775f8571d9b1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairMoments.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairSpinKernel + +namespace OAI + +/-! Conditional coordinate means in the constrained block and their +actual two-spin interpretation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +def restrictedCoordinateMean {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ i < n, 0 < b i) + (j : Fin N) (z : Fin N → ℝ) : ℝ := + ∫ σ, spinValue (σ j) ∂restrictedTailSpinKernel hN S hS n b v hb z + +def restrictedPairCoordinateMean {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) (hb : ∀ j < n, 0 < b j) + (i : Fin (n + 1)) (j : Fin N) (z : Fin N → ℝ) : ℝ := + ∫ σ, spinValue (σ.1 j) * spinValue (σ.2 j) ∂restrictedPairSpinKernel hN S hS n b v hb i z + +lemma measurable_restrictedCoordinateMean {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (j : Fin N) : + Measurable (restrictedCoordinateMean hN S hS n b v hb j) := by + have hm : Measurable (fun p : (Fin N → ℝ) × Spin N => spinValue (p.2 j)) := + (measurable_of_finite (fun σ : Spin N => spinValue (σ j))).comp measurable_snd + exact (hm.stronglyMeasurable.integral_kernel_prod_right' + (κ := restrictedTailSpinKernel hN S hS n b v hb)).measurable + +lemma measurable_restrictedPairCoordinateMean {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (i : Fin (n + 1)) (j : Fin N) : + Measurable (restrictedPairCoordinateMean hN S hS n b v hb i j) := by + have hm : Measurable (fun p : (Fin N → ℝ) × (Spin N × Spin N) => + spinValue (p.2.1 j) * spinValue (p.2.2 j)) := + (measurable_of_finite (fun σ : Spin N × Spin N => spinValue (σ.1 j) * spinValue (σ.2 j))).comp measurable_snd + exact (hm.stronglyMeasurable.integral_kernel_prod_right' + (κ := restrictedPairSpinKernel hN S hS n b v hb i)).measurable + +lemma restrictedCoordinateMean_bound {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (j : Fin N) (z : Fin N → ℝ) : + |restrictedCoordinateMean hN S hS n b v hb j z| ≤ 1 := by + have he := norm_integral_le_of_norm_le_const (C := (1 : ℝ)) + (μ := restrictedTailSpinKernel hN S hS n b v hb z) + (f := fun σ => spinValue (σ j)) (Filter.Eventually.of_forall (fun σ => by + simp only [Real.norm_eq_abs, abs_spinValue, le_refl])) + simpa only [restrictedCoordinateMean, Real.norm_eq_abs, measureReal_def, + measure_univ, ENNReal.toReal_one, mul_one] using he + +lemma restrictedPairCoordinateMean_bound {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (i : Fin (n + 1)) (j : Fin N) (z : Fin N → ℝ) : + |restrictedPairCoordinateMean hN S hS n b v hb i j z| ≤ 1 := by + have he := norm_integral_le_of_norm_le_const (C := (1 : ℝ)) + (μ := restrictedPairSpinKernel hN S hS n b v hb i z) + (f := fun σ => spinValue (σ.1 j) * spinValue (σ.2 j)) + (Filter.Eventually.of_forall (fun σ => by simp only [Real.norm_eq_abs, abs_mul, abs_spinValue, mul_one, le_refl])) + simpa only [restrictedPairCoordinateMean, Real.norm_eq_abs, measureReal_def, + measure_univ, ENNReal.toReal_one, mul_one] using he + +lemma restrictedPairSpinKernel_zero {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) : + restrictedPairSpinKernel hN S hS n b v hb 0 = + restrictedTailSpinKernel hN S hS n b v hb ×ₖ restrictedTailSpinKernel hN S hS n b v hb := by + cases n <;> rfl + +lemma restrictedPairCoordinateMean_zero {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (j : Fin N) (z : Fin N → ℝ) : + restrictedPairCoordinateMean hN S hS n b v hb 0 j z = + (restrictedCoordinateMean hN S hS n b v hb j z) ^ 2 := by + rw [restrictedPairCoordinateMean, restrictedPairSpinKernel_zero, Kernel.prod_apply, + integral_prod_mul (fun σ : Spin N => spinValue (σ j)) (fun σ : Spin N => spinValue (σ j))] + rw [pow_two] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairOrder.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..c155edb19f1820087669f80d0480e1ea08c3198f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairOrder.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairRecursion + +namespace OAI + +/-! Nonnegativity and conditional Jensen monotonicity of the actual +constrained block's coordinate overlap levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma restrictedPairCoordinateMean_nonneg {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (i : Fin (n + 1)) (j : Fin N) (z : Fin N → ℝ) : + 0 ≤ restrictedPairCoordinateMean hN S hS n b v hb i j z := by + induction n generalizing b v z with + | zero => + have hi : i = 0 := Fin.ext (by omega) + rw [hi, restrictedPairCoordinateMean_zero] + positivity + | succ n ih => + refine Fin.cases ?_ (fun k => ?_) i + · rw [restrictedPairCoordinateMean_zero] + positivity + · rw [restrictedPairCoordinateMean_succ] + exact integral_nonneg (fun y => ih _ _ _ k y) + +lemma restrictedPairCoordinateMean_monotone {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (j : Fin N) (z : Fin N → ℝ) : + Monotone (fun i => restrictedPairCoordinateMean hN S hS n b v hb i j z) := by + induction n generalizing b v z with + | zero => + intro i k _ + have hik : i = k := Fin.ext (by omega) + subst k + exact le_rfl + | succ n ih => + let bs := fun k => b (k + 1) + let vs := fun k => v (k + 1) + have hbs : ∀ k < n, 0 < bs k := fun k hk => hb (k + 1) (by omega) + let K := vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) + (restrictedFieldRecursion_regular hN S hS n bs vs hbs).1 + let M := restrictedCoordinateMean hN S hS n bs vs hbs j + apply Fin.monotone_iff_le_succ.mpr + intro i + refine Fin.cases ?_ (fun k => ?_) i + · rw [Fin.castSucc_zero, restrictedPairCoordinateMean_zero, + restrictedCoordinateMean_succ, restrictedPairCoordinateMean_succ] + simp_rw [restrictedPairCoordinateMean_zero] + have hm : MemLp M 2 (K z) := MemLp.of_bound + (measurable_restrictedCoordinateMean hN S hS n bs vs hbs j).aestronglyMeasurable 1 + (Filter.Eventually.of_forall (fun y => by + simpa only [Real.norm_eq_abs] using restrictedCoordinateMean_bound hN S hS n bs vs hbs j y)) + have hv := variance_nonneg M (K z) + rw [variance_eq_sub hm] at hv + exact sub_nonneg.mp hv + · change restrictedPairCoordinateMean hN S hS (n + 1) b v hb k.castSucc.succ j z ≤ + restrictedPairCoordinateMean hN S hS (n + 1) b v hb k.succ.succ j z + rw [restrictedPairCoordinateMean_succ, restrictedPairCoordinateMean_succ] + apply integral_mono + (integrable_restrictedPairCoordinateMean hN S hS n bs vs hbs k.castSucc j (K z)) + (integrable_restrictedPairCoordinateMean hN S hS n bs vs hbs k.succ j (K z)) + intro y + exact ih bs vs hbs y (by change k.val ≤ k.val + 1; omega) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairRecursion.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..99098643632b63da07f2e59b3efb974c44e31d87 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairRecursion.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairMoments + +namespace OAI + +/-! One-step recursion for the actual constrained one- and two-spin means. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma integrable_restrictedCoordinateMean {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (j : Fin N) (μ : Measure (Fin N → ℝ)) [IsFiniteMeasure μ] : + Integrable (restrictedCoordinateMean hN S hS n b v hb j) μ := by + apply Integrable.of_bound (measurable_restrictedCoordinateMean hN S hS n b v hb j).aestronglyMeasurable 1 + exact Filter.Eventually.of_forall (fun z => by + simpa only [Real.norm_eq_abs] using restrictedCoordinateMean_bound hN S hS n b v hb j z) + +lemma integrable_restrictedPairCoordinateMean {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (i : Fin (n + 1)) (j : Fin N) + (μ : Measure (Fin N → ℝ)) [IsFiniteMeasure μ] : + Integrable (restrictedPairCoordinateMean hN S hS n b v hb i j) μ := by + apply Integrable.of_bound (measurable_restrictedPairCoordinateMean hN S hS n b v hb i j).aestronglyMeasurable 1 + exact Filter.Eventually.of_forall (fun z => by + simpa only [Real.norm_eq_abs] using restrictedPairCoordinateMean_bound hN S hS n b v hb i j z) + +lemma restrictedCoordinateMean_succ {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n + 1, 0 < b i) (j : Fin N) (z : Fin N → ℝ) : + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + let hbs := fun i hi => hb (i + 1) (by omega) + restrictedCoordinateMean hN S hS (n + 1) b v hb j z = + ∫ y, restrictedCoordinateMean hN S hS n bs vs hbs j y + ∂vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) + (restrictedFieldRecursion_regular hN S hS n bs vs hbs).1 z := by + dsimp only + change (∫ σ : Spin N, spinValue (σ j) ∂(_ ∘ₖ _) z) = _ + rw [Kernel.integral_comp (Integrable.of_finite)] + rfl + +lemma restrictedPairCoordinateMean_succ {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n + 1, 0 < b j) (i : Fin (n + 1)) (j : Fin N) (z : Fin N → ℝ) : + let bs := fun k => b (k + 1) + let vs := fun k => v (k + 1) + let hbs := fun k hk => hb (k + 1) (by omega) + restrictedPairCoordinateMean hN S hS (n + 1) b v hb i.succ j z = + ∫ y, restrictedPairCoordinateMean hN S hS n bs vs hbs i j y + ∂vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) + (restrictedFieldRecursion_regular hN S hS n bs vs hbs).1 z := by + dsimp only + change (∫ σ : Spin N × Spin N, spinValue (σ.1 j) * spinValue (σ.2 j) ∂(_ ∘ₖ _) z) = _ + rw [Kernel.integral_comp (Integrable.of_finite)] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairRootEntropy.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairRootEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4730ccfdaee650460dbed7f10e7529e6932f594 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairRootEntropy.lean @@ -0,0 +1,77 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPairEntropy +import OAI.Probability.InvariantIsing.Magnetic.ConstrainedBlockBias + +namespace OAI + +/-! The shared Gaussian root preserves the pair entropy estimate. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal + +namespace InvariantIsing + +def restrictedLevelSpinPair {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (b : Fin N → ℝ) (i : Fin (h.depth + 1)) : Measure (Spin N × Spin N) := + restrictedPairSpinKernel hN S hS h.depth (chainExponent h.cut) (fieldStepVariance h) + (fun j hj => ((chainExponent_admissible h.ordered_cut h.first h.last).1 j hj).1) i ∘ₘ + Measure.pi (fun j => gaussianReal (b j) (NNReal.mk (h.height 0) (h.nonneg 0))) + +instance restrictedLevelSpinPair_probability {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i : Fin (h.depth + 1)) : IsProbabilityMeasure (restrictedLevelSpinPair hN S hS h b i) := by + unfold restrictedLevelSpinPair + infer_instance + +theorem restrictedLevelSpinPair_entropy {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i : Fin (h.depth + 1)) : + klDiv (restrictedLevelSpinPair hN S hS h b i) + (restrictedLevelSpinPair hN Finset.univ Finset.univ_nonempty h b i) ≤ + 2 * ENNReal.ofReal ((N : ℝ) * + (biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b)) := by + let μ := Measure.pi (fun j => gaussianReal (b j) (NNReal.mk (h.height 0) (h.nonneg 0))) + let B := chainExponent h.cut + let V := fieldStepVariance h + have hB : ∀ j < h.depth, 0 < B j := + fun j hj => ((chainExponent_admissible h.ordered_cut h.first h.last).1 j hj).1 + have hB1 : ∀ j < h.depth, B j ≤ 1 := + fun j hj => ((chainExponent_admissible h.ordered_cut h.first h.last).1 j hj).2.le + let κ := restrictedPairSpinKernel hN S hS h.depth B V hB i + let η := restrictedPairSpinKernel hN Finset.univ Finset.univ_nonempty h.depth B V hB i + let F := restrictedFieldRecursion (Finset.univ : Finset (Spin N)) h.depth B V + let G := restrictedFieldRecursion S h.depth B V + have hi (z : Fin N → ℝ) := restrictedPairSpinKernel_entropy hN S hS h.depth B V hB hB1 i z + have hac (z : Fin N → ℝ) : κ z ≪ η z := + (klDiv_ne_top_iff.mp (ne_top_of_le_ne_top (by finiteness) (hi z))).1 + have hκ (z : Fin N → ℝ) : kernelRelativeEntropy κ η z ≤ 2 * ENNReal.ofReal (F z - G z) := by + rw [kernelRelativeEntropy_eq κ η z (hac z)] + exact hi z + have he := entropy_budget_drop μ μ κ η hac (fun z => 2 * ENNReal.ofReal (F z - G z)) hκ + have hF := restrictedFieldRecursion_biased_root_integrable hN Finset.univ Finset.univ_nonempty h b + have hG := restrictedFieldRecursion_biased_root_integrable hN S hS h b + have hDm : Measurable (fun z => ENNReal.ofReal (F z - G z)) := + ((restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty h.depth B V hB).1.sub + (restrictedFieldRecursion_regular hN S hS h.depth B V hB).1).ennreal_ofReal + have hD0 (z : Fin N → ℝ) : 0 ≤ F z - G z := sub_nonneg.mpr + (restrictedFieldRecursion_mono hN S Finset.univ hS Finset.univ_nonempty + (Finset.subset_univ S) h.depth B V hB z) + rw [klDiv_self, zero_add, lintegral_const_mul 2 hDm, + ← ofReal_integral_eq_lintegral_ofReal (f := fun z => F z - G z) (μ := μ) + (hF.sub hG) (Filter.Eventually.of_forall hD0)] at he + have hval : (∫ z, F z - G z ∂μ) = (N : ℝ) * + (biasedConstrainedBlockValue Finset.univ h b - biasedConstrainedBlockValue S h b) := by + rw [integral_sub (f := F) (g := G) hF hG] + unfold biasedConstrainedBlockValue + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + dsimp only [μ, F, G, B, V] + field_simp + ring + rw [hval] at he + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairSpinKernel.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairSpinKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..984c7b7f2a07a9df237aa0d6e68590e01a5fe909 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairSpinKernel.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTailEntropy +import OAI.Probability.InvariantIsing.Core.KernelProductEntropy + +namespace OAI + +/-! Two constrained spins sampled independently after a prescribed common +Gaussian prefix. The common prefix is retained in the actual kernel law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal + +namespace InvariantIsing + +def restrictedPairSpinKernel {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) : + (n : ℕ) → (b : ℕ → ℝ) → (v : ℕ → ℝ≥0) → (∀ i < n, 0 < b i) → Fin (n + 1) → + Kernel (Fin N → ℝ) (Spin N × Spin N) + | 0, _, _, _, _ => restrictedSpinKernel S ×ₖ restrictedSpinKernel S + | n + 1, b, v, hb, i => + let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + let hbs := fun j hj => hb (j + 1) (by omega) + let hreg := restrictedFieldRecursion_regular hN S hS n bs vs hbs + Fin.cases (restrictedTailSpinKernel hN S hS (n + 1) b v hb ×ₖ + restrictedTailSpinKernel hN S hS (n + 1) b v hb) + (fun j => restrictedPairSpinKernel hN S hS n bs vs hbs j ∘ₖ + vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) hreg.1) i + +instance restrictedPairSpinKernel_markov {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (i : Fin (n + 1)) : + IsMarkovKernel (restrictedPairSpinKernel hN S hS n b v hb i) := by + induction n generalizing b v with + | zero => + let _ := restrictedSpinKernel_markov S hS + change IsMarkovKernel (restrictedSpinKernel S ×ₖ restrictedSpinKernel S) + infer_instance + | succ n ih => + refine Fin.cases ?_ (fun j => ?_) i + · change IsMarkovKernel (_ ×ₖ _) + infer_instance + · let bs := fun j => b (j + 1) + let vs := fun j => v (j + 1) + have hbs : ∀ j < n, 0 < bs j := fun j hj => hb (j + 1) (by omega) + let _ := ih bs vs hbs j + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairTies.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairTies.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac78d48eba0260ba7bcb613d0cc83a9b114add37 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPairTies.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockOverlap +import OAI.Probability.InvariantIsing.Fields.VectorTransitionZero + +namespace OAI + +/-! Zero Gaussian increments repeat the same conditional overlap level. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal BigOperators + +namespace InvariantIsing + +lemma restrictedPairCoordinateMean_tied {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ j < n, 0 < b j) (i : Fin n) (hv : v i = 0) (j : Fin N) (z : Fin N → ℝ) : + restrictedPairCoordinateMean hN S hS n b v hb i.castSucc j z = + restrictedPairCoordinateMean hN S hS n b v hb i.succ j z := by + induction n generalizing b v z with + | zero => exact Fin.elim0 i + | succ n ih => + let bs := fun k => b (k + 1) + let vs := fun k => v (k + 1) + have hbs : ∀ k < n, 0 < bs k := fun k hk => hb (k + 1) (by omega) + revert hv + refine Fin.cases ?_ (fun k => ?_) i + · intro hv + rw [Fin.castSucc_zero, restrictedPairCoordinateMean_zero, + restrictedCoordinateMean_succ, restrictedPairCoordinateMean_succ] + have hF := restrictedFieldRecursion_regular hN S hS n bs vs hbs + change v 0 = 0 at hv + rw [hv, vectorGaussianTransition_zero hN (b 0) _ hF.1 hF.2 z] + simp only [integral_dirac, restrictedPairCoordinateMean_zero] + · intro hv + change restrictedPairCoordinateMean hN S hS (n + 1) b v hb k.castSucc.succ j z = + restrictedPairCoordinateMean hN S hS (n + 1) b v hb k.succ.succ j z + rw [restrictedPairCoordinateMean_succ, restrictedPairCoordinateMean_succ] + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun y => ih bs vs hbs k hv y) + +lemma fieldStepVariance_tied (h : FieldStep) (i : Fin h.depth) + (hi : h.height i.castSucc = h.height i.succ) : fieldStepVariance h i = 0 := by + rw [fieldStepVariance, dite_eq_left i.isLt] + have hg : (scalarFieldIncrements h).get + ⟨i.val, by simpa only [scalarFieldIncrements_length] using i.isLt⟩ = + ((fieldIncrement h i.succ).1, + NNReal.mk (fieldIncrement h i.succ).2 (fieldIncrement_nonneg h i.succ)) := by + exact List.get_ofFn (fun k : Fin h.depth => ((fieldIncrement h k.succ).1, + NNReal.mk (fieldIncrement h k.succ).2 (fieldIncrement_nonneg h k.succ))) _ + rw [hg] + apply Subtype.ext + change (fieldIncrement h i.succ).2 = 0 + simp only [fieldIncrement, Fin.val_succ, Nat.succ_ne_zero, dite_false, Nat.add_sub_cancel] + change h.height i.succ - h.height i.castSucc = 0 + exact sub_eq_zero.mpr hi.symm + +lemma restrictedBlockPairMean_tied {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (b : Fin N → ℝ) + (i : Fin h.depth) (hi : h.height i.castSucc = h.height i.succ) : + restrictedBlockPairMean hN S hS h b i.castSucc = + restrictedBlockPairMean hN S hS h b i.succ := by + rw [restrictedBlockPairMean_eq_average, restrictedBlockPairMean_eq_average] + congr 1 + apply Finset.sum_congr rfl + intro j _ + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun z => restrictedPairCoordinateMean_tied hN S hS _ _ _ _ i + (fieldStepVariance_tied h i hi) j z) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCavityHaar.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCavityHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..830dad3cb391a86433174a6b2b39e2b57b02ebec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCavityHaar.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorCutoffLaw +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorJointHaar + +namespace OAI + +/-! Joint Haar factorization for the normalized cavity observable. +Compression-dependent coefficients and the selected frame are retained +inside the same normalized two-replica test. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_physical_cavity_haar {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i = a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) + (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) (a₀ : Fin d → Fin m) + (l w : Fin m → ℕ) + (hg : ∀ a i, g i=a ↔ l a ≤ i.val ∧ i.val < w a) + (hln : ∀ a, l a+n ≤ w a) (hw : ∀ a, w a ≤ N+n) + (μ : Measure (Orthogonal (N+n))) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] [ν.IsMulRightInvariant] + (T : LabeledTree depth) (c : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) + (A : (Fin m → Matrix (Fin n) (Fin n) ℝ) → CavityFactorBlocks d n) + (hA : Measurable A) + (F : ((Fin m → Matrix (Fin n) (Fin n) ℝ) × CavityProjectorFrame N m d) → + (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + (hF : Measurable (Function.uncurry F)) + {C : ℝ} (hC : 0 ≤ C) (hb : ∀ p σ, |F p σ| ≤ C) : + (∫ U, restrictedProjectorCavityMean S hS Cset hCset T c u t D (A (cavityCompressionGrams g U)) + (F (cavityCompressionGrams g U, + cavityPhysicalLabeledProjectors g (cavityConcreteComplement es B₀) a₀ U)) + (cavityPhysicalLabeledProjectors g (cavityConcreteComplement es B₀) a₀ U) ∂μ) = + ∫ U, ∫ V, restrictedProjectorCavityMean S hS Cset hCset T c u t D (A (cavityCompressionGrams g U)) + (F (cavityCompressionGrams g U, + cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀))) + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂ν ∂μ := by + let Ω := (Fin m → Matrix (Fin n) (Fin n) ℝ) × CavityProjectorFrame N m d + let a : Ω → CavityFactorBlocks d n := fun p => A p.1 + let p : Ω → CavityProjectorFrame N m d := Prod.snd + have ha : Measurable a := hA.comp measurable_fst + have hp : Measurable p := measurable_snd + have hm := measurable_restrictedProjectorCavityMean (Ω := Ω) + (N := N) (n := n) (m := m) (d := d) (depth := depth) S hS Cset hCset T c u t D a ha p hp F hF + have hbnd : ∀ q : Ω, ‖restrictedProjectorCavityMean S hS Cset hCset T c u t D (a q) (F q) (p q)‖ ≤ C := by + intro q + exact restrictedProjectorCavityMean_bound (N := N) (n := n) (m := m) (d := d) + (depth := depth) S hS Cset hCset T c u t D (a q) (F q) hC (hb q) (p q) + exact cavity_labeled_projector_joint_haar g k ek e es B₀ a₀ l w hg hln hw μ ν + (fun q : Ω => restrictedProjectorCavityMean S hS Cset hCset T c u t D (a q) (F q) (p q)) hm C hbnd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..d90dd25750f6e53b9ba5d97a57d7b04f7db4d8db --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCutoff.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityFullCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedDisorderTest + +namespace OAI + +/-! Bounded cutoff tests for the actual perturbed Ising law, with the +same Haar and Gaussian disorder in the full and restricted models. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators Classical + +namespace InvariantIsing + +lemma restricted_cavity_full_exp_integrable_ae {N m depth : ℕ} (C : Finset (Spin N)) (hC : C.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) : + ∀ᵐ p ∂μ.prod gaussianCoordinates, Integrable + (fun x => Real.exp (cavityFullHamiltonian eig I u p x)) + (labeledSpinReference depth (restrictedSpinPrior C hC : Measure (Spin N)) T) := by + let ν := labeledSpinReference depth (restrictedSpinPrior C hC : Measure (Spin N)) T + apply (Measure.ae_prod_iff_ae_ae (_root_.measurableSet_integrable (μ := ν) + (f := fun p x => Real.exp (cavityFullHamiltonian (depth := depth) eig I u p x)) + (measurable_cavityFullHamiltonian (depth := depth) eig I u).exp.stronglyMeasurable)).mpr + exact ae_of_all _ fun U => cylinder_partition_exp_integrable_ae ν + (fun x => rotatedEnergy eig (specialRotation U) x.1) + (cavity_bounded_base_exp_integrable ν _ (fun x => + Finset.single_le_sum (f := fun σ : Spin N => |rotatedEnergy eig (specialRotation U) σ|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ x.1))) + (cavityPerturbationCoefficients (specialRotation U) I u depth) + (cavityPerturbationCoefficients_sq_le _ I u hu) + +def restrictedCavityFullCutoffDisorderTest {N m depth : ℕ} (C : Finset (Spin N)) (hC : C.Nonempty) + (μ : Measure (SpecialOrthogonal N)) (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (s : SpecialOrthogonal N → Set (Spin N × LabeledLeaf depth)) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) : ℝ := + ∫ U, ∫ g, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior C hC : Measure (Spin N)) T) + (cavityFullHamiltonian eig I u (U, g)) (s U) (F U) ∂gaussianCoordinates ∂μ + +theorem restricted_cavity_full_cutoff_error {N m depth : ℕ} (C : Finset (Spin N)) (hC : C.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (s : SpecialOrthogonal N → Set (Spin N × LabeledLeaf depth)) + (hs : MeasurableSet {p : SpecialOrthogonal N × (Spin N × LabeledLeaf depth) | p.2 ∈ s p.1}) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hmF : Measurable (Function.uncurry F)) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ U σ, |F U σ| ≤ M) : + |restrictedCavityFullCutoffDisorderTest C hC μ T eig I u s F - restrictedCavityFullDisorderTest C hC μ T eig I u F| ≤ + 4 * M * restrictedCavityFullDisorderTest C hC μ T eig I u + (fun U σ => if σ 0 ∈ (s U)ᶜ then 1 else 0) := by + let P := μ.prod gaussianCoordinates + let ν := labeledSpinReference depth (restrictedSpinPrior C hC : Measure (Spin N)) T + let H := cavityFullHamiltonian (depth := depth) eig I u + let G : (SpecialOrthogonal N × (ℕ → ℝ)) × (Fin 2 → Spin N × LabeledLeaf depth) → ℝ := + fun p => F p.1.1 p.2 + let S := fun p : SpecialOrthogonal N × (ℕ → ℝ) => s p.1 + have hmH : Measurable (Function.uncurry H) := measurable_cavityFullHamiltonian eig I u + have hmG : Measurable G := hmF.comp (measurable_fst.fst.prodMk measurable_snd) + have hmS : MeasurableSet {p : (SpecialOrthogonal N × (ℕ → ℝ)) × + (Spin N × LabeledLeaf depth) | p.2 ∈ S p.1} := + hs.preimage (measurable_fst.fst.prodMk measurable_snd) + have hiH := restricted_cavity_full_exp_integrable_ae C hC μ T eig I u hu + have hmC := measurable_cavityCutoffReplicaMean ν (Function.uncurry H) hmH S hmS G hmG + have hmR := measurable_referenceReplicaMean ν (H := Function.uncurry H) hmH hmG + have hmTail : Measurable (fun p : SpecialOrthogonal N × (ℕ → ℝ) => + referenceReplicaMean ν (H p) (fun σ : Fin 2 → Spin N × LabeledLeaf depth => + if σ 0 ∈ (S p)ᶜ then (1 : ℝ) else 0)) := by + apply measurable_referenceReplicaMean ν (H := Function.uncurry H) + (D := fun p : (SpecialOrthogonal N × (ℕ → ℝ)) × + (Fin 2 → Spin N × LabeledLeaf depth) => + if p.2 0 ∈ (S p.1)ᶜ then 1 else 0) hmH + exact Measurable.ite ((hmS.preimage + (measurable_fst.prodMk ((measurable_pi_apply 0).comp measurable_snd))).compl) + measurable_const measurable_const + have hms (p : SpecialOrthogonal N × (ℕ → ℝ)) : MeasurableSet (S p) := + hmS.preimage measurable_prodMk_left + have hiC : Integrable (fun p => cavityCutoffReplicaMean ν (H p) (S p) (fun σ => G (p, σ))) P := + Integrable.of_bound hmC.aestronglyMeasurable M (hiH.mono fun p hp => by + simpa only [Real.norm_eq_abs] using + cavity_cutoff_replica_abs_le ν _ hp _ (hms p) _ hM (hF p.1)) + have hiR : Integrable (fun p => referenceReplicaMean ν (H p) (fun σ => G (p, σ))) P := + integrable_of_measurable_abs_le hmR (fun p => referenceReplicaMean_abs_le ν _ _ + (measurable_of_countable _) hM (hF p.1)) + have hiTail : Integrable (fun p => referenceReplicaMean ν (H p) + (fun σ : Fin 2 → Spin N × LabeledLeaf depth => if σ 0 ∈ (S p)ᶜ then 1 else 0)) P := + integrable_of_measurable_abs_le hmTail (fun p => referenceReplicaMean_abs_le ν _ _ + (measurable_of_countable _) zero_le_one (fun σ => by split_ifs <;> norm_num)) + have ht := cavity_random_cutoff_error P ν (Function.uncurry H) hmH hiH S hmS G hmG hM + (fun p => hF p.1) + dsimp only [P, Function.uncurry] at ht + rw [integral_prod _ hiC, integral_prod _ hiR, integral_prod _ hiTail] at ht + exact ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCutoffComparison.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCutoffComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a0168bbe8fe804ab1a431ac0802cbd3cfd732dc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalCutoffComparison.lean @@ -0,0 +1,123 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityCoupledProjectors +import OAI.Probability.InvariantIsing.Cavity.CavityCoupledEnergy +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorCutoffLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBaseRawCutoff +import OAI.Probability.InvariantIsing.Cavity.CavityGeometricTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOriginalComparison + +namespace OAI + +/-! The original perturbed Ising cutoff test is approximated by a +measurable physical-projector cavity observable, with the explicit +finite-volume covariance and deterministic errors. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_physical_cutoff_comparison {N n m d depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i = a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) + (U : SpecialOrthogonal (N+n)) (lam : Fin m → ℝ) (a₀ : Fin d → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + B (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 1) + (hBT : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + cavitySpectralStack (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 0) + (hA : ∀ a, (cavityCompressionGrams g (cavitySpecialOrthogonal U) a).PosDef) + (T : LabeledTree depth) (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) + {D M s : ℝ} (hD : 1 ≤ D) (hM : 0 ≤ M) (hs : 0 < s) + (F : (Fin 2 → (Spin N × Spin n) × LabeledLeaf depth) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + let G := cavityCompressionGrams g (cavitySpecialOrthogonal U) + let B₁ := B G + let A := cavitySmallFactorBlocks (cavityRepeatedSpectrum (n := n) lam) + (Matrix.diagonal (fun j => lam (a₀ j))) B₁ (cavitySpectralStack G) + let p := cavityPhysicalLabeledProjectors g B a₀ (cavitySpecialOrthogonal U) + let w := cavityGeometricWeight g B₁ U + |restrictedProjectorCavityMean S hS Cset hCset T (fun a => t*lam a+2*perturbationScale N*v a) + u t D A (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) p - + (∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S Cset) (cavityProductSlice_nonempty S hS Cset hCset) : Measure (Spin (N+n))) T) + (cavityRotationHamiltonian (specialRotation U) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z) + {x | w (cavitySpinSplit N n x.1) ≤ D} + (fun σ => F (fun i => (cavitySpinSplit N n (σ i).1,(σ i).2))) ∂gaussianCoordinates)| ≤ + (2 * (2 : ℝ)^2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityCovarianceRate n (2*n+1) N * (2*D)) + + 2 * 2 * (cavityDeterministicRate n m (2*(2*n+1)) N * D)) / s + M^2*s/2 := by + intro G B₁ A p w + obtain ⟨V, hSpectrum, hProj, hSpecial, herr₀⟩ := + cavity_coupled_labeled_projectors hN g k ek e es U a₀ B hB hBT hA + let eig₀ := fun j => Sum.elim (fun b => lam b.1) (fun j => lam (a₀ j)) (e.symm j) + have herr (x z : Spin N × Spin n) (a : Fin m) : + |projectedOverlap (specialRotation U) (cavitySpectralGroup g a) + (cavityJoinedSpin x) (cavityJoinedSpin z) - + projectedOverlap (matrixRotation V⁻¹) (cavityBaseGroup k e a₀ a) x.1 z.1| ≤ + (2 * (n : ℝ) + 1) / N * (w x + w z) := by + have h := herr₀ a (cavityJoinedSpin x) (cavityJoinedSpin z) + simp only [cavityJoinedSpin, Fin.append_left] at h + apply h.trans + apply mul_le_mul_of_nonneg_left _ (div_nonneg (by positivity) (Nat.cast_nonneg N)) + dsimp only [w, cavityGeometricWeight, B₁, G, cavityJoinedSpin] + linarith + have hc := restricted_original_cutoff_comparison hN S hS Cset hCset (specialRotation U) (matrixRotation V⁻¹) + T (cavitySpectralGroup g) (cavityBaseGroup k e a₀) (fun i => lam (g i)) eig₀ + v hv u hu t w (cavityGeometricWeight_one_le g B₁ U) (by positivity) hD hM hs herr F hF + dsimp only at hc + rw [restricted_base_raw_cutoff_law S hS Cset hCset (specialRotation U) (matrixRotation V⁻¹) T + (cavityBaseGroup k e a₀) (fun i => lam (g i)) eig₀ v u hu t w D F] at hc + let g₀ : Fin N → Fin m := fun j => Sum.elim (fun w => w.1) a₀ (e.symm j) + have hp : p.1 = fun a => cavitySpectralProjector V (cavitySpectralGroup g₀ a) := by + rw [show p = cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) from hProj] + exact cavityCanonicalProjectorFrame_action_fst k e a₀ V + have hcan := restricted_projector_cavity_cutoff S hS Cset hCset g₀ V T lam v u t D A p hp + (fun σ => F (fun i => cavityPairLeafUnswap (σ i))) + have hI : cavitySpectralGroup g₀ = cavityBaseGroup k e a₀ := rfl + have hEig : (fun j => lam (g₀ j)) = eig₀ := by + funext j + dsimp only [g₀, eig₀] + cases e.symm j <;> rfl + rw [hI, hEig] at hcan + have hw (x : (Spin N × LabeledLeaf depth) × Spin n) : + w (cavityPairLeafUnswap x).1 = 1 + ‖cavityFrameCoordinates p.2 x.1.1‖^2 := by + dsimp only [w, cavityGeometricWeight, cavityPairLeafUnswap] + rw [← WithLp.toLp_ofLp 2 (cavityFullSpecialCoordinates g B₁ U + (cavityJoinedSpin (x.1.1,x.2))), + cavity_physical_special_coordinates g U B hBT hA x.1.1 x.2] + rfl + have he (x : (Spin N × LabeledLeaf depth) × Spin n) : + rotatedEnergy (fun i => lam (g i)) (specialRotation U) + (cavityJoinedSpin (cavityPairLeafUnswap x).1) - + rotatedEnergy eig₀ (matrixRotation V⁻¹) (cavityPairLeafUnswap x).1.1 = + cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2 := by + have h := cavity_physical_energy_difference g es U lam (fun j => lam (a₀ j)) B + hB hBT hA x.1.1 x.2 + dsimp only at h + rw [hSpectrum, cavityQuadratic_inverse_rotation, + cavity_physical_special_coordinates g U B hBT hA] at h + exact h + have hcut : (cavityPairLeafUnswap ⁻¹' + {x : (Spin N × Spin n) × LabeledLeaf depth | w x.1 ≤ D}) = + {x : (Spin N × LabeledLeaf depth) × Spin n | + 1 + ‖cavityFrameCoordinates p.2 x.1.1‖^2 ≤ D} := by + ext x + change w (cavityPairLeafUnswap x).1 ≤ D ↔ _ + rw [hw] + rfl + simp_rw [he] at hc + rw [hcut, ← hcan] at hc + exact hc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalGG.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..9639b428695db9df3c7084a3e988b65047f82a66 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalGG.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedZeroTreeArrayLaw +import OAI.Probability.InvariantIsing.Fields.PriorGGWardExistence +import OAI.Probability.InvariantIsing.Cavity.CavityHaarSides + +namespace OAI + +/-! The physical constrained model has a complete GG/Ward limit along actual minima. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology +namespace InvariantIsing + +theorem restricted_physical_GG_Ward_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3≤N k) (hNlim : Tendsto N atTop atTop) (m : ℕ) + (S : (k : ℕ) → Finset (Spin (N k))) (hS : ∀ k, (S k).Nonempty) + (μ : (k : ℕ) → Measure (Orthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + [∀ k, (μ k).IsMulRightInvariant] + (θ : ℕ → Measure (LabeledTree 0)) [∀ k, IsProbabilityMeasure (θ k)] + (eig : (k : ℕ) → Fin (N k) → ℝ) (K : ℝ) (hK : 0 ((I k a).card : ℝ)/N k) atTop (𝓝 ρ)) : + ∃ u : (k : ℕ) → Fin (N k) → ℝ, ∃ v : ℕ → Fin m → ℝ, + (∀ k j, u k j∈Set.Icc (1 : ℝ) 2) ∧ (∀ k a, v k a∈Set.Icc (1 : ℝ) 2) ∧ + (∀ k u' v', (∀ j, u' j∈Set.Icc (1 : ℝ) 2) → (∀ a, v' a∈Set.Icc (1 : ℝ) 2) → + priorPerturbationObjective (cavityOrientedBaseLaw (by have := hN k; omega) (μ k)) + (restrictedZeroTreePrior (S k) (hS k)) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) (u k) (v k)≤ + priorPerturbationObjective (cavityOrientedBaseLaw (by have := hN k; omega) (μ k)) + (restrictedZeroTreePrior (S k) (hS k)) (eig k) (fun _ => 0) (I k) 1 (fun _ => 0) u' v') ∧ + ∃ Q : ProbabilityMeasure (SpectralArray (m+1)), + ∃ q : Fin (m+1) → Set.Icc (0 : ℝ) 1, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun k => restrictedRotationArrayLaw (S (φ k)) (hS (φ k)) (μ (φ k)) (θ (φ k)) + (diagonalPerturbedEigenvalues (eig (φ k)) (I (φ k)) (v (φ k)) 1) + (I (φ k)) (cavityBaseAmplitude (u (φ k)))) atTop (𝓝 Q) ∧ + HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m+1))) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ i a, (x (i,i) a : ℝ)=q a) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralGram x) ∧ + (∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) ∧ + (∀ᵐ x ∂(Q : Measure (SpectralArray (m+1))), ∀ a, 0≤(x (0,1) a : ℝ)) ∧ + (∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ r, |Φ r|≤B) → + spectralOffWardResidual Q ρ lam a b Φ=0) ∧ + (∀ a b, spectralDiagonalWardResidual Q ρ lam a b=0) := by + have hpos k : 0 cavityOrientedBaseLaw (hpos k) (μ k)) + (fun k => cavityOrientedBaseLaw_leftInvariant (hpos k) (μ k)) + (fun k => restrictedZeroTreePrior (S k) (hS k)) eig K hK heig I hdis hcover lam hlam ρ hρ + refine ⟨u,v,hu,hv,hmin,Q,q,φ,hφ,?_,hgg,hd,hG,hE,hP,hn,hoff,hdiag⟩ + apply hL.congr + intro k + exact (restricted_zero_tree_perturbed_array_law (hpos (φ k)) (S (φ k)) (hS (φ k)) + (μ (φ k)) (θ (φ k)) (eig (φ k)) (I (φ k)) (u (φ k)) (v (φ k)) 1).symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalGibbsSplit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalGibbsSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c63bf0c194e6059db9d2147fd9923d8169d4bba --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalGibbsSplit.lean @@ -0,0 +1,109 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProductPrior +import OAI.Probability.InvariantIsing.Cavity.CavityPhysicalGibbsSplit + +namespace OAI + +/-! The original spin/leaf Gibbs law equals the base Gibbs law times the +independent cavity prior, tilted by the exact cavity energy difference. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_cavity_spin_leaf_full_tilt {N n depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (J : Spin N × LabeledLeaf depth → ℝ) + (hj : Integrable (fun x => Real.exp (J x)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T)) + (H : Spin (N+n) × LabeledLeaf depth → ℝ) + (V : (Spin N × LabeledLeaf depth) × Spin n → ℝ) + (hsplit : ∀ x, H x = J (cavitySpinLeafSplit N n depth x).1 + + V (cavitySpinLeafSplit N n depth x)) : + ((labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T).tilted H).map + (cavitySpinLeafSplit N n depth) = + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted J).prod + (restrictedSpinPrior C hC)).tilted V := by + let μ := labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let E := fun z : (Spin N × LabeledLeaf depth) × Spin n => J z.1 + V z + have hE : H = E ∘ (cavitySpinLeafSplit N n depth) := funext hsplit + have hm := cavity_tilt_map μ (cavitySpinLeafSplit N n depth) (measurable_of_countable _) + E (measurable_of_countable _) + rw [← hE, (restricted_cavity_spin_leaf_split_prior S hS C hC T).map_eq] at hm + refine hm.trans ?_ + change (ν.prod (restrictedSpinPrior C hC)).tilted E = + ((ν.tilted J).prod (restrictedSpinPrior C hC)).tilted V + exact (cavity_base_product_tilt ν (restrictedSpinPrior C hC : Measure (Spin n)) J + (measurable_of_countable _) hj V).symm + +theorem restricted_cavity_spin_leaf_factor_integrable {N n depth : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (J : Spin N × LabeledLeaf depth → ℝ) + (hj : Integrable (fun x => Real.exp (J x)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T)) + (H : Spin (N+n) × LabeledLeaf depth → ℝ) + (hH : Integrable (fun x => Real.exp (H x)) + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T)) + (V : (Spin N × LabeledLeaf depth) × Spin n → ℝ) + (hsplit : ∀ x, H x = J (cavitySpinLeafSplit N n depth x).1 + + V (cavitySpinLeafSplit N n depth x)) : + Integrable (fun x => Real.exp (V x)) + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted J).prod + (restrictedSpinPrior C hC)) := by + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let E := fun z : (Spin N × LabeledLeaf depth) × Spin n => J z.1 + V z + have hi : Integrable (fun z => Real.exp (E z)) (ν.prod (restrictedSpinPrior C hC)) := by + rw [← (restricted_cavity_spin_leaf_split_prior S hS C hC T).map_eq] + apply (integrable_map_measure (measurable_of_countable _).aestronglyMeasurable + (measurable_of_countable _).aemeasurable).mpr + convert hH using 1 + funext x + exact congrArg Real.exp (hsplit x).symm + change Integrable (fun x => Real.exp (V x)) ((ν.tilted J).prod (restrictedSpinPrior C hC)) + exact cavity_base_product_tilt_integrable ν (restrictedSpinPrior C hC : Measure (Spin n)) J + (measurable_of_countable _) hj V hi + +theorem restricted_cavity_spin_leaf_replica_split {N n depth r : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (J : Spin N × LabeledLeaf depth → ℝ) + (hj : Integrable (fun x => Real.exp (J x)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T)) + (H : Spin (N+n) × LabeledLeaf depth → ℝ) + (hH : Integrable (fun x => Real.exp (H x)) + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T)) + (V : (Spin N × LabeledLeaf depth) × Spin n → ℝ) + (hsplit : ∀ x, H x = J (cavitySpinLeafSplit N n depth x).1 + + V (cavitySpinLeafSplit N n depth x)) + (F : (Fin r → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) : + referenceReplicaMean + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T) H + (fun σ => F (fun i => cavitySpinLeafSplit N n depth (σ i))) = + cavityWeightedReplicaMean + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted J).prod + (restrictedSpinPrior C hC)) (fun x => Real.exp (V x)) F := by + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let μ := labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T + let := isProbabilityMeasure_tilted hj + have he := restricted_cavity_spin_leaf_factor_integrable S hS C hC T J hj H hH V hsplit + rw [referenceReplicaMean_eq_tilted μ H hH, + cavityWeightedReplicaMean_exp _ V he] + have hm : (μ.tilted H).map (cavitySpinLeafSplit N n depth) = + ((ν.tilted J).prod (restrictedSpinPrior C hC)).tilted V := + restricted_cavity_spin_leaf_full_tilt S hS C hC T J hj H V hsplit + have hp : MeasurePreserving (fun σ : Fin r → Spin (N+n) × LabeledLeaf depth => + fun i => cavitySpinLeafSplit N n depth (σ i)) + (Measure.pi (fun _ : Fin r => μ.tilted H)) + (Measure.pi (fun _ : Fin r => ((ν.tilted J).prod (restrictedSpinPrior C hC)).tilted V)) := by + refine ⟨Measurable.of_eval (fun i => (measurable_of_countable _).comp (measurable_pi_apply i)), ?_⟩ + simpa only [hm] using Measure.pi_map_pi + (μ := fun _ : Fin r => μ.tilted H) + (f := fun _ : Fin r => cavitySpinLeafSplit N n depth) + (fun _ => (measurable_of_countable _).aemeasurable) + exact hp.hasLaw.integral_comp (measurable_of_countable F).aestronglyMeasurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..09417638934af360e25bef83ee7f8bf29e6cbc20 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalIncrement.lean @@ -0,0 +1,124 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityPhysicalCutoffComparison +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteCappedIncrement +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLogMap +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorLog + +namespace OAI + +/-! The actual geometric pressure increment dominates the capped +projector cavity logarithm, with the explicit vanishing quadratic error. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_physical_capped_increment {N n m d depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i = a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) + (U : SpecialOrthogonal (N+n)) (lam : Fin m → ℝ) (a₀ : Fin d → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + B (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 1) + (hBT : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + cavitySpectralStack (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 0) + (hA : ∀ a, (cavityCompressionGrams g (cavitySpecialOrthogonal U) a).PosDef) + (T : LabeledTree depth) (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t cap : ℝ) (hcap : 0 ≤ cap) : + let G := cavityCompressionGrams g (cavitySpecialOrthogonal U) + let A := cavitySmallFactorBlocks (cavityRepeatedSpectrum (n := n) lam) + (Matrix.diagonal (fun j => lam (a₀ j))) (B G) (cavitySpectralStack G) + let p := cavityPhysicalLabeledProjectors g B a₀ (cavitySpecialOrthogonal U) + let eig₀ := fun j => Sum.elim (fun w => lam w.1) (fun j => lam (a₀ j)) (e.symm j) + let J := cavityBaseGroup k e a₀ + let ν := ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC)).prod + (labeledLeafLaw depth T) + let δ := cavityDeterministicRate n m (2*(2*n+1)) N + + 2*cavityCovarianceRate n (2*n+1) N + ∃ V : Orthogonal N, + p = cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) ∧ + restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ A p ≤ + (∫ z, Real.log (∫ x, Real.exp + (cavityRotationHamiltonian (specialRotation U) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z (cavityJoinedSpin x.1,x.2)) ∂ν) ∂gaussianCoordinates) - + ∫ z, Real.log (∫ x, Real.exp + (cavityRotationHamiltonian (matrixRotation V⁻¹) (diagonalPerturbedEigenvalues eig₀ J v t) + J u z (x.1.1,x.2)) ∂ν) ∂gaussianCoordinates := by + intro G A p eig₀ J ν δ + obtain ⟨V, hSpectrum, hProj, hSpecial, herr₀⟩ := + cavity_coupled_labeled_projectors hN g k ek e es U a₀ B hB hBT hA + refine ⟨V, hProj, ?_⟩ + let w := cavityGeometricWeight g (B G) U + have herr (x z : Spin N × Spin n) (a : Fin m) : + |projectedOverlap (specialRotation U) (cavitySpectralGroup g a) + (cavityJoinedSpin x) (cavityJoinedSpin z) - + projectedOverlap (matrixRotation V⁻¹) (cavityBaseGroup k e a₀ a) x.1 z.1| ≤ + (2*(n : ℝ)+1)/N*(w x+w z) := by + have h := herr₀ a (cavityJoinedSpin x) (cavityJoinedSpin z) + simp only [cavityJoinedSpin, Fin.append_left] at h + apply h.trans + apply mul_le_mul_of_nonneg_left _ (div_nonneg (by positivity) (Nat.cast_nonneg N)) + dsimp only [w, cavityGeometricWeight, G, cavityJoinedSpin] + linarith + have hc := cavity_finite_capped_energy_increment hN (specialRotation U) (matrixRotation V⁻¹) + (cavitySpectralGroup g) J (fun i => lam (g i)) eig₀ v hv u hu t cap hcap ν w + (cavityGeometricWeight_one_le g (B G) U) (by positivity) herr + dsimp only at hc + have hp : p.1 = fun a => cavitySpectralProjector V + (cavitySpectralGroup (fun j => Sum.elim (fun w => w.1) a₀ (e.symm j)) a) := by + rw [show p = cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) from hProj] + exact cavityCanonicalProjectorFrame_action_fst k e a₀ V + have hI : cavitySpectralGroup (fun j => Sum.elim (fun w => w.1) a₀ (e.symm j)) = J := rfl + have hEig : (fun j => lam (Sum.elim (fun w => w.1) a₀ (e.symm j))) = eig₀ := by + funext j + dsimp only [eig₀] + cases e.symm j <;> rfl + have hw (x : Spin N × Spin n) : + w x = 1+‖cavityFrameCoordinates p.2 x.1‖^2 := by + dsimp only [w, cavityGeometricWeight] + rw [← WithLp.toLp_ofLp 2 (cavityFullSpecialCoordinates g (B G) U (cavityJoinedSpin x)), + cavity_physical_special_coordinates g U B hBT hA] + rfl + have he (x : Spin N × Spin n) : + rotatedEnergy (fun i => lam (g i)) (specialRotation U) (cavityJoinedSpin x) - + rotatedEnergy eig₀ (matrixRotation V⁻¹) x.1 = + cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1) x.2 := by + have h := cavity_physical_energy_difference g es U lam (fun j => lam (a₀ j)) B + hB hBT hA x.1 x.2 + dsimp only at h + rw [hSpectrum, cavityQuadratic_inverse_rotation, + cavity_physical_special_coordinates g U B hBT hA] at h + exact h + have hlog : restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ A p = + ∫ z, Real.log (∫ x, Real.exp + (min (t*(rotatedEnergy (fun i => lam (g i)) (specialRotation U) (cavityJoinedSpin x.1) - + rotatedEnergy eig₀ (matrixRotation V⁻¹) x.1.1)) cap - δ*w x.1) + ∂ν.tilted (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues eig₀ J v t) J u z (x.1.1,x.2))) ∂gaussianCoordinates := by + rw [restricted_projector_capped_log S hS C hC _ V T lam v u t cap δ A p hp] + rw [hI, hEig] + apply integral_congr_ae + exact ae_of_all _ fun z => by + have hm := restricted_log_weight_pair_leaf S hS C hC T + (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues eig₀ J v t) J u z x.1) + (fun x => min (t*cavityLogFactor A.1 A.2.1 A.2.2 + (cavityFrameCoordinates p.2 x.1.1) x.2) cap - + δ*(1+‖cavityFrameCoordinates p.2 x.1.1‖^2)) + simpa only [Function.comp_def, cavityPairLeafSwap, he, hw, ν] using hm.symm + rw [hlog] + exact hc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogCoefficients.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c87675c6c3cb3039b9e00a86c417ad7728658ec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogCoefficients.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityHaarPenalizedLimit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarLogObservable +import OAI.Probability.InvariantIsing.Cavity.CavityRotationVectorNorm +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability + +namespace OAI + +/-! Logarithmic coefficient replacement specialized to the actual +base-system Gibbs probability and its physical spectral-group vectors. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology + +namespace InvariantIsing + +theorem restricted_physical_penalized_log_coefficients {m q d n : ℕ} + (N depth : ℕ → ℕ) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (C : Finset (Spin n)) (hC : C.Nonempty) (hN : ∀ r, 00, Tendsto (fun r => (P r).real + {z | ε restrictedRotationProbability (depth := depth r) (S r) (hS r) (eig r) + (cavitySpectralGroup (fun i => ((E r).symm i).1)) (u r) + let vectors := fun r => cavityRotationVectors (depth := depth r) (dims r) (E r) + let Q := fun r => ((P r).prod (((μ r).prod (θ r)).prod gaussianCoordinates)).prod + (Measure.pi (μG r)) + Tendsto (fun r => + (∫ ω, restrictedHaarLogObservable C hC (fun z => ν r z.2) f (fun z => vectors r z.2) + (A₀ r) (fun z => A r z.1) 1 cap (δ r) ω ∂Q r) - + ∫ ω, restrictedHaarLogObservable C hC (fun z => ν r z.2) f (fun z => vectors r z.2) + (A₀ r) (fun _ => A₁) 1 cap 0 ω ∂Q r) atTop (𝓝 0) := by + intro ν vectors Q + let Ω := fun r => Z r × ((Orthogonal (N r) × LabeledTree (depth r)) × (ℕ → ℝ)) + let X := fun r => Spin (N r) × LabeledLeaf (depth r) + let P₀ := fun r => (P r).prod (((μ r).prod (θ r)).prod gaussianCoordinates) + let ν₀ := fun r (ω : Ω r) => ν r ω.2 + let v₀ := fun r (ω : Ω r) => vectors r ω.2 + let A₂ := fun r (ω : Ω r) => A r ω.1 + have hmν r : Measurable (ν₀ r) := + (measurable_restrictedRotationProbability (S r) (hS r) _ _ _).comp measurable_snd + have hmv r x : Measurable (fun ω a => v₀ r ω a x) := + (measurable_cavityRotationVectors (dims r) (E r) x).comp measurable_snd + have hnorm r (ω : Ω r) x a : + ‖(WithLp.toLp 2 (v₀ r ω a x) : EuclideanSpace ℝ (Fin (dims r a)))‖^2 ≤ + (1/c)*dims r a := + cavity_rotation_vectors_norm_bound (hN r) (dims r) (hgroups r) (E r) hc (hfrac r) ω.2 x a + have hmA r : Measurable (A₂ r) := (hA r).comp measurable_fst + have hp : ∀ ε>0, Tendsto (fun r => (P₀ r).real + {ω | ε hAb r ω.1) hA₁ hp (restrictedSpinPrior C hC) cap hcap δ hδ hδlim + simpa only [restrictedHaarLogObservable, ν₀, v₀, A₂, P₀, Q, one_mul, zero_mul, sub_zero] using h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogLimit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4e906aa16d99c538723f4260bcccbe687a0535d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogLimit.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityPhysicalSpinCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationArray +import OAI.Probability.InvariantIsing.Cavity.CavityHaarGibbsCappedLog + +namespace OAI + +/-! Capped logarithmic convergence with the actual base-system Gibbs +kernel and physical spectral-group coordinates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +theorem restricted_physical_capped_log_limit + {m q dim kspin : ℕ} (N depth : ℕ → ℕ) + (S : (r : ℕ) → Finset (Spin (N r))) (hS : ∀ r, (S r).Nonempty) + (C : Finset (Spin kspin)) (hC : C.Nonempty) (hN : ∀ n, 0 < N n) + (dims : ℕ → Fin m → ℕ) (hgroups : ∀ n a, 0 < dims n a) + (hdims : ∀ a, Tendsto (fun n => dims n a) atTop atTop) + (E : (n : ℕ) → ((a : Fin m) × Fin (dims n a)) ≃ Fin (N n)) + (μ : (n : ℕ) → Measure (Orthogonal (N n))) [∀ n, IsProbabilityMeasure (μ n)] + (θ : (n : ℕ) → Measure (LabeledTree (depth n))) [∀ n, IsProbabilityMeasure (θ n)] + (μG : (n : ℕ) → (a : Fin m) → Measure (Orthogonal (dims n a))) + [∀ n a, IsProbabilityMeasure (μG n a)] [∀ n a, (μG n a).IsMulRightInvariant] + (A₀ : (n : ℕ) → (a : Fin m) → Matrix (Fin (dims n a)) (Fin q) ℝ) + (hA₀ : ∀ n a, (A₀ n a).transpose * A₀ n a = 1) + (eigN : (n : ℕ) → Fin (N n) → ℝ) (u : ℕ → ℕ → ℝ) + {c : ℝ} (hc : 0 < c) (hcG : ∀ n a, c ≤ (dims n a : ℝ)/N n) + (ρ eig : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρlim : Tendsto (fun n a => (dims n a : ℝ)/N n) atTop (𝓝 ρ)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun n => restrictedRotationArrayLaw (S n) (hS n) (μ n) (θ n) (eigN n) + (cavitySpectralGroup (fun i => ((E n).symm i).1)) (u n)) atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralGram x) + (d : Fin (m + 1) → ℝ) (hd0 : ∀ j, 0 ≤ d j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ i j, (x (i,i) j : ℝ) = d j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ eig j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ eig j l = 0) + (g : Fin dim → Fin m) (e : Fin dim → Fin m × Fin q) + (he : Function.Injective e) (heg : ∀ j, (e j).1 = g j) + (K : Matrix (Fin dim) (Fin dim) ℝ) (L : Matrix (Fin dim) (Fin kspin) ℝ) + (Cspin : Matrix (Fin kspin) (Fin kspin) ℝ) (T : ℝ) (hT : 0 ≤ T) : + let p := spectralSpinQuantilePath Q₀ hP hn + let Qf := fun r => cavityLabeledDisorderLaw r (chainExponent (uniformCut r)) + (cavityFiniteRootCovariance ρ eig hρ hρsum g (cavityStrictUniformPath p r) + (cavityStrictUniformLevels p r)) + (cavityFiniteNoiseCovariance ρ eig hρ hρsum g (cavityStrictUniformPath p r) + (uniformCut r) (cavityStrictUniformLevels p r)) + let η := fun r => cavityLabeledPriorKernel r + (cavityFiniteCovariancePath ρ eig hρ hρsum g (cavityStrictUniformPath p r) + (cavityStrictUniformLevels p r) r) (restrictedSpinPrior C hC) + Tendsto (fun r => + (∫ ω, Real.log (∫ x, Real.exp (min + (cavityHaarSpinPotential e (cavityRotationVectors (dims r) (E r)) (A₀ r) K L Cspin (ω,x)) T) + ∂((restrictedRotationProbability (S r) (hS r) (eigN r) + (cavitySpectralGroup (fun i => ((E r).symm i).1)) (u r) ω.1).prod (restrictedSpinPrior C hC))) + ∂(((μ r).prod (θ r)).prod gaussianCoordinates).prod (Measure.pi (μG r))) - + ∫ ω, Real.log (∫ x, Real.exp (min (cavityLabeledPotential r K L Cspin (ω,x)) T) + ∂η r ω) ∂Qf r) atTop (𝓝 0) := by + intro p Qf η + let I r := cavitySpectralGroup (fun i => ((E r).symm i).1) + let Ω r := (Orthogonal (N r) × LabeledTree (depth r)) × (ℕ → ℝ) + let X r := Spin (N r) × LabeledLeaf (depth r) + let P r := ((μ r).prod (θ r)).prod gaussianCoordinates + let ν r := restrictedRotationProbability (depth := depth r) (S r) (hS r) (eigN r) (I r) (u r) + let B r := cavityRotationEntry (depth := depth r) (I r) + let Q r := restrictedRotationArrayLaw (S r) (hS r) (μ r) (θ r) (eigN r) (I r) (u r) + have hρs r a : 0 < (dims r a : ℝ)/N r := + div_pos (Nat.cast_pos.mpr (hgroups r a)) (Nat.cast_pos.mpr (hN r)) + exact cavity_haar_gibbs_capped_log_match dims hdims hgroups μG A₀ hA₀ Ω X P ν + (fun r => measurable_restrictedRotationProbability (S r) (hS r) _ _ _) B + (fun r => measurable_cavityRotationEntry (I r)) + (fun r => cavityRotationEntry_gram (I r)) + (fun r => cavityRotationVectors (dims r) (E r)) + (fun r => measurable_cavityRotationVectors (dims r) (E r)) (1/c) + (div_nonneg zero_le_one hc.le) + (fun s r x => cavityRotationVectors_gram_bound (r := s) (hN r) (dims r) (E r) x hc (hcG r)) + (fun r a => (dims r a : ℝ)/N r) ρ eig hρs hρ hρlim hρsum + (fun s r x => cavityRotationVectors_covariance (r := s) (hN r) (dims r) (E r) x q) + Q Q₀ (fun _ => rfl) hlim hgg hG d hd0 hd hE hP hn hoff hdiag g e he heg + K L Cspin T hT (restrictedSpinPrior C hC) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogSplit.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a2e802a17271e0a68a3b8ed05156eb55d3b68e0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalLogSplit.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalGibbsSplit +import OAI.Probability.InvariantIsing.Cavity.CavityIncrementComparison + +namespace OAI + +/-! The literal constrained log-partition increment, including the +cavity slice's original cube mass, is its Gibbs cavity logarithm. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_cavity_spin_leaf_log_increment {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (T : LabeledTree depth) (J : Spin N × LabeledLeaf depth → ℝ) + (hj : Integrable (fun x => Real.exp (J x)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T)) + (H : Spin (N+n) × LabeledLeaf depth → ℝ) + (hH : Integrable (fun x => Real.exp (H x)) + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T)) + (V : (Spin N × LabeledLeaf depth) × Spin n → ℝ) + (hsplit : ∀ x, H x = J (cavitySpinLeafSplit N n depth x).1 + + V (cavitySpinLeafSplit N n depth x)) : + (Real.log (∫ x, Real.exp (H x) + ∂labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T) + + (Real.log (cavityProductSlice S C).card - (N+n) * Real.log 2)) - + (Real.log (∫ x, Real.exp (J x) + ∂labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + + (Real.log S.card - N * Real.log 2)) = + Real.log (∫ x, Real.exp (V x) + ∂((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted J).prod + (restrictedSpinPrior C hC)) + (Real.log C.card - n * Real.log 2) := by + let μ := labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let π := (restrictedSpinPrior C hC : Measure (Spin n)) + let E := fun z : (Spin N × LabeledLeaf depth) × Spin n => J z.1 + V z + have hP := restricted_cavity_spin_leaf_split_prior S hS C hC T + have hE : Integrable (fun z => Real.exp (E z)) (ν.prod π) := by + rw [← hP.map_eq] + apply (integrable_map_measure (measurable_of_countable _).aestronglyMeasurable + (measurable_of_countable _).aemeasurable).mpr + convert hH using 1 + funext x + exact congrArg Real.exp (hsplit x).symm + have he : (∫ z, Real.exp (E z) ∂ν.prod π) = ∫ x, Real.exp (H x) ∂μ := by + have ht := hP.hasLaw.integral_comp + (measurable_of_countable (fun z => Real.exp (E z))).aestronglyMeasurable + calc + _ = ∫ x, Real.exp (E (cavitySpinLeafSplit N n depth x)) ∂μ := ht.symm + _ = _ := integral_congr_ae (ae_of_all _ fun x => congrArg Real.exp (hsplit x).symm) + have hb : Integrable (fun z : (Spin N × LabeledLeaf depth) × Spin n => Real.exp (J z.1)) + (ν.prod π) := hj.comp_fst π + have ht := cavity_log_tilt_factor (ν.prod π) (fun z => J z.1) V hb hE + rw [← cavity_tilt_prod_left ν π J (measurable_of_countable _), he] at ht + have hjmean : (∫ z : (Spin N × LabeledLeaf depth) × Spin n, Real.exp (J z.1) ∂ν.prod π) = + ∫ x, Real.exp (J x) ∂ν := by + rw [integral_prod _ hb] + simp + rw [hjmean] at ht + rw [cavityProductSlice_log_mass S hS C hC] + change (Real.log (∫ x, Real.exp (H x) ∂μ) + _) - + (Real.log (∫ x, Real.exp (J x) ∂ν) + _) = _ + linarith only [ht] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalOverlapCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalOverlapCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..43b3e79c55602adf452b4d5508b4774baea0a65d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalOverlapCutoff.lean @@ -0,0 +1,120 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarFiniteOverlap +import OAI.Probability.InvariantIsing.Cavity.CavityPhysicalOverlapCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationArray +import OAI.Probability.InvariantIsing.Cavity.CavityPhysicalSpinObservable +import OAI.Probability.InvariantIsing.Cavity.CavitySpinSplitOverlap +import OAI.Probability.InvariantIsing.Cavity.CavityRotationVectors + +namespace OAI + +/-! Actual eigenbasis/Gaussian disorder and the ordinary spin overlap +specialize the finite-cavity scalar-field identity. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +theorem restricted_physical_overlap_cutoff (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m q dim kspin : ℕ} (N depth : ℕ → ℕ) (hN : ∀ n, 0 < N n) + (S : (n : ℕ) → Finset (Spin (N n))) (hS : ∀ n, (S n).Nonempty) + (dims : ℕ → Fin m → ℕ) (hgroups : ∀ n a, 0 < dims n a) + (hdims : ∀ a, Tendsto (fun n => dims n a) atTop atTop) + (E : (n : ℕ) → ((a : Fin m) × Fin (dims n a)) ≃ Fin (N n)) + (μ : (n : ℕ) → Measure (Orthogonal (N n))) [∀ n, IsProbabilityMeasure (μ n)] + (θ : (n : ℕ) → Measure (LabeledTree (depth n))) [∀ n, IsProbabilityMeasure (θ n)] + (μG : (n : ℕ) → (a : Fin m) → Measure (Orthogonal (dims n a))) + [∀ n a, IsProbabilityMeasure (μG n a)] [∀ n a, (μG n a).IsMulRightInvariant] + (A₀ : (n : ℕ) → (a : Fin m) → Matrix (Fin (dims n a)) (Fin q) ℝ) + (hA₀ : ∀ n a, (A₀ n a).transpose * A₀ n a = 1) + (eigN : (n : ℕ) → Fin (N n) → ℝ) (u : ℕ → ℕ → ℝ) + {c : ℝ} (hc : 0 < c) (hcG : ∀ n a, c ≤ (dims n a : ℝ)/N n) + (ρ eig : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρlim : Tendsto (fun n a => (dims n a : ℝ)/N n) atTop (𝓝 ρ)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun n => restrictedRotationArrayLaw (S n) (hS n) (μ n) (θ n) (eigN n) + (cavitySpectralGroup (fun i => ((E n).symm i).1)) (u n)) atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralGram x) + (d : Fin (m + 1) → ℝ) (hd0 : ∀ j, 0 ≤ d j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ i j, (x (i,i) j : ℝ) = d j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ eig j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ eig j l = 0) + (g : Fin dim → Fin m) (e : Fin dim → Fin m × Fin q) + (he : Function.Injective e) (heg : ∀ j, (e j).1 = g j) + (hdim : 0 < dim) (hkspin : 0 < kspin) + (T : Finset (Spin kspin)) (hT : T.Nonempty) + (B₀ : Matrix (Fin (m*kspin)) (Fin dim) ℝ) (hB₀ : B₀.transpose * B₀ = 1) + (hBE : B₀.transpose * cavityLimitingStack (n := kspin) ρ = 0) + (hcomplete : B₀ * B₀.transpose + cavityLimitingStack (n := kspin) ρ * + (cavityLimitingStack (n := kspin) ρ).transpose = 1) + (a : Fin m) (ha : ∀ b, eig b ≤ eig a) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) + {M : ℝ} (hΦb : ∀ x, |Φ x| ≤ M) + (b : ℕ → ℝ) (hb : ∀ j, 0 < b j) (hblim : Tendsto b atTop atTop) + (hnull : ∀ j s, (cavityBlockMarkedLaw (q := q) Q₀ ρ (cavitySpectralGroupBlock m s) : Measure + (SpectralBlock m s × EuclideanSpace ℝ (Fin m × (Fin s × Fin q)))) + {z | cavityReplicaRadius (cavitySelectedGroupProjection e) z = b j} = 0) : + let p := spectralSpinQuantilePath Q₀ hP hn + let K := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * B₀ - + Matrix.diagonal (fun i => eig (g i)) + let L := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * + cavityLimitingStack (n := kspin) ρ + let Cspin := (finiteR ρ eig hρ hρsum 0) • (1 : Matrix (Fin kspin) (Fin kspin) ℝ) + let τ := fun j => cavityFactorSize K L Cspin * (1+(b j)^2) + ∀ ε > 0, ∀ᶠ j in atTop, ∀ᶠ n in atTop, + |(∫ ω, cavityWeightedReplicaMean + ((restrictedRotationProbability (S n) (hS n) (eigN n) + (cavitySpectralGroup (fun i => ((E n).symm i).1)) (u n) ω.1).prod + (restrictedSpinPrior T hT)) + (fun x => cavityHaarRestrictedWeight e (cavityRotationVectors (dims n) (E n)) + (A₀ n) K L Cspin (τ j) (b j) (ω,x)) + (fun σ : Fin 2 → (Spin (N n) × LabeledLeaf (depth n)) × Spin kspin => + Φ (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1))) + ∂(((μ n).prod (θ n)).prod gaussianCoordinates).prod (Measure.pi (μG n))) - + ∫ t, Φ (cavityStrictUniformPath p n t) ∂pathMeasure| < ε := by + intro p K L Cspin τ + let I n := cavitySpectralGroup (fun i => ((E n).symm i).1) + let Ω n := (Orthogonal (N n) × LabeledTree (depth n)) × (ℕ → ℝ) + let X n := Spin (N n) × LabeledLeaf (depth n) + let P n := ((μ n).prod (θ n)).prod gaussianCoordinates + let ν n := restrictedRotationProbability (S n) (hS n) (depth := depth n) (eigN n) (I n) (u n) + let B n := cavityRotationEntry (depth := depth n) (I n) + let Q n := restrictedRotationArrayLaw (S n) (hS n) (μ n) (θ n) (eigN n) (I n) (u n) + have hρs n a : 0 < (dims n a : ℝ)/N n := + div_pos (Nat.cast_pos.mpr (hgroups n a)) (Nat.cast_pos.mpr (hN n)) + have hh := restricted_haar_finite_overlap_cutoff hpub dims hdims μG A₀ hA₀ Ω X P ν + (fun n => measurable_restrictedRotationProbability _ _ _ _ _) B + (fun n => measurable_cavityRotationEntry (I n)) + (fun n => cavityRotationEntry_gram (I n)) + (fun n => cavityRotationVectors (dims n) (E n)) + (fun n => measurable_cavityRotationVectors (dims n) (E n)) (1/c) + (fun s n x => cavityRotationVectors_gram_bound (r := s) (hN n) (dims n) (E n) x hc (hcG n)) + (fun n a => (dims n a : ℝ)/N n) ρ eig hρs hρ hρlim hρsum + (fun s n x => cavityRotationVectors_covariance (r := s) (hN n) (dims n) (E n) x q) + Q Q₀ (fun _ => rfl) hlim hgg hG d hd0 hd hE hP hn hoff hdiag g e he heg + hgroups (div_nonneg zero_le_one hc.le) hdim hkspin T hT B₀ hB₀ hBE hcomplete a ha Φ hΦ hΦb + b hb hblim hnull + dsimp only at hh + intro ε hε + filter_upwards [hh ε hε] with j hj + filter_upwards [hj] with n hn' + have htest (ω : Ω n × ((a : Fin m) → Orthogonal (dims n a))) : cavityProjectedSpinTest (cavitySampledGroupBlock (B n) ω.1) + (cavityOverlapObservable Φ hΦ) = + (fun σ : Fin 2 → (Spin (N n) × LabeledLeaf (depth n)) × Spin kspin => + Φ (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1))) := by + funext σ + exact cavity_physical_overlap_observable (fun i => ((E n).symm i).1) ω.1 Φ hΦ σ + simpa only [htest] using hn' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalProjectorIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalProjectorIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..f34b7f383315deb8bd0753caf823b46ab8daca58 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalProjectorIncrement.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalIncrement +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorPartition + +namespace OAI + +/-! An additive lower bound for the literal full-system log partition, +written entirely in the physical projector and compression data. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_physical_projector_increment {N n m d depth : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i = a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) + (U : SpecialOrthogonal (N+n)) (lam : Fin m → ℝ) (a₀ : Fin d → Fin m) + (B : (Fin m → Matrix (Fin n) (Fin n) ℝ) → Matrix (Fin (m*n)) (Fin d) ℝ) + (hB : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + B (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 1) + (hBT : (B (cavityCompressionGrams g (cavitySpecialOrthogonal U))).transpose * + cavitySpectralStack (cavityCompressionGrams g (cavitySpecialOrthogonal U)) = 0) + (hA : ∀ a, (cavityCompressionGrams g (cavitySpecialOrthogonal U) a).PosDef) + (T : LabeledTree depth) (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t cap : ℝ) (hcap : 0 ≤ cap) : + let G := cavityCompressionGrams g (cavitySpecialOrthogonal U) + let A := cavitySmallFactorBlocks (cavityRepeatedSpectrum (n := n) lam) + (Matrix.diagonal (fun j => lam (a₀ j))) (B G) (cavitySpectralStack G) + let p := cavityPhysicalLabeledProjectors g B a₀ (cavitySpecialOrthogonal U) + let c := fun a => t*lam a+2*perturbationScale N*v a + let δ := cavityDeterministicRate n m (2*(2*n+1)) N + + 2*cavityCovarianceRate n (2*n+1) N + restrictedProjectorCappedLog S hS C hC T c u t cap δ A p + restrictedProjectorLogPartition S hS T c u p.1 ≤ + ∫ z, Real.log (∫ x, Real.exp + (cavityRotationHamiltonian (specialRotation U) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z x) + ∂labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T) + ∂gaussianCoordinates := by + intro G A p c δ + obtain ⟨V,hV,hc⟩ := restricted_physical_capped_increment hN S hS C hC g k ek e es U lam a₀ B + hB hBT hA T v hv u hu t cap hcap + let g₀ : Fin N → Fin m := fun j => Sum.elim (fun w => w.1) a₀ (e.symm j) + let eig₀ : Fin N → ℝ := fun j => Sum.elim (fun w => lam w.1) (fun j => lam (a₀ j)) (e.symm j) + have hp : p.1 = fun a => cavitySpectralProjector V (cavitySpectralGroup g₀ a) := by + rw [show p = cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) from hV] + exact cavityCanonicalProjectorFrame_action_fst k e a₀ V + have hEig : (fun j => lam (g₀ j)) = eig₀ := by + funext j + dsimp only [g₀,eig₀] + cases e.symm j <;> rfl + have hb := restricted_projector_log_partition S hS g₀ V T lam v u t + rw [hEig, ← hp] at hb + have hfull z := restricted_pair_leaf_full_partition S hS C hC T + (cavityRotationHamiltonian (specialRotation U) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z) + have hbase z := restricted_pair_leaf_base_partition S hS C hC T + (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues eig₀ (cavityBaseGroup k e a₀) v t) + (cavityBaseGroup k e a₀) u z) + change restrictedProjectorCappedLog S hS C hC T c u t cap δ A p ≤ + (∫ z, Real.log (∫ x, Real.exp (cavityRotationHamiltonian (specialRotation U) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z (cavityJoinedSpin x.1,x.2)) + ∂((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC : Measure (Spin n))).prod + (labeledLeafLaw depth T)) ∂gaussianCoordinates) - + ∫ z, Real.log (∫ x, Real.exp (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues eig₀ (cavityBaseGroup k e a₀) v t) + (cavityBaseGroup k e a₀) u z (x.1.1,x.2)) + ∂((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior C hC : Measure (Spin n))).prod + (labeledLeafLaw depth T)) ∂gaussianCoordinates at hc + simp_rw [hfull, hbase] at hc + have hJ : cavitySpectralGroup g₀ = cavityBaseGroup k e a₀ := rfl + rw [hJ] at hb + rw [← hb] at hc + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalSpinCutoff.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalSpinCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..daf3c16e5292c72414ca5a3896f7397396063d8a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalSpinCutoff.lean @@ -0,0 +1,122 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarFiniteSpin +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationArray +import OAI.Probability.InvariantIsing.Cavity.CavityPhysicalSpinObservable +import OAI.Probability.InvariantIsing.Cavity.CavitySpinSplitOverlap +import OAI.Probability.InvariantIsing.Cavity.CavityRotationVectors + +namespace OAI + +/-! Actual eigenbasis/Gaussian disorder and the ordinary spin overlap +specialize the finite-cavity scalar-field identity. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +theorem restricted_physical_spin_cutoff (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m q dim kspin : ℕ} (N depth : ℕ → ℕ) (hN : ∀ n, 0 < N n) + (S : (n : ℕ) → Finset (Spin (N n))) (hS : ∀ n, (S n).Nonempty) + (dims : ℕ → Fin m → ℕ) (hgroups : ∀ n a, 0 < dims n a) + (hdims : ∀ a, Tendsto (fun n => dims n a) atTop atTop) + (E : (n : ℕ) → ((a : Fin m) × Fin (dims n a)) ≃ Fin (N n)) + (μ : (n : ℕ) → Measure (Orthogonal (N n))) [∀ n, IsProbabilityMeasure (μ n)] + (θ : (n : ℕ) → Measure (LabeledTree (depth n))) [∀ n, IsProbabilityMeasure (θ n)] + (μG : (n : ℕ) → (a : Fin m) → Measure (Orthogonal (dims n a))) + [∀ n a, IsProbabilityMeasure (μG n a)] [∀ n a, (μG n a).IsMulRightInvariant] + (A₀ : (n : ℕ) → (a : Fin m) → Matrix (Fin (dims n a)) (Fin q) ℝ) + (hA₀ : ∀ n a, (A₀ n a).transpose * A₀ n a = 1) + (eigN : (n : ℕ) → Fin (N n) → ℝ) (u : ℕ → ℕ → ℝ) + {c : ℝ} (hc : 0 < c) (hcG : ∀ n a, c ≤ (dims n a : ℝ)/N n) + (ρ eig : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρlim : Tendsto (fun n a => (dims n a : ℝ)/N n) atTop (𝓝 ρ)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun n => restrictedRotationArrayLaw (S n) (hS n) (μ n) (θ n) (eigN n) + (cavitySpectralGroup (fun i => ((E n).symm i).1)) (u n)) atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralGram x) + (d : Fin (m + 1) → ℝ) (hd0 : ∀ j, 0 ≤ d j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ i j, (x (i,i) j : ℝ) = d j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m + 1))), ∀ j, 0 ≤ (x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0 ≤ B → (∀ t, |Φ t| ≤ B) → + spectralOffWardResidual Q₀ ρ eig j l Φ = 0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ eig j l = 0) + (g : Fin dim → Fin m) (e : Fin dim → Fin m × Fin q) + (he : Function.Injective e) (heg : ∀ j, (e j).1 = g j) + (hdim : 0 < dim) (hkspin : 0 < kspin) + (T : Finset (Spin kspin)) (hT : T.Nonempty) + (B₀ : Matrix (Fin (m*kspin)) (Fin dim) ℝ) (hB₀ : B₀.transpose * B₀ = 1) + (hBE : B₀.transpose * cavityLimitingStack (n := kspin) ρ = 0) + (hcomplete : B₀ * B₀.transpose + cavityLimitingStack (n := kspin) ρ * + (cavityLimitingStack (n := kspin) ρ).transpose = 1) + (a : Fin m) (ha : ∀ b, eig b ≤ eig a) + (Φ : ℝ → ℝ) (hΦ : Continuous Φ) (site : Fin kspin) + {M : ℝ} (hΦb : ∀ x, |Φ x| ≤ M) + (b : ℕ → ℝ) (hb : ∀ j, 0 < b j) (hblim : Tendsto b atTop atTop) + (hnull : ∀ j s, (cavityBlockMarkedLaw (q := q) Q₀ ρ (cavitySpectralGroupBlock m s) : Measure + (SpectralBlock m s × EuclideanSpace ℝ (Fin m × (Fin s × Fin q)))) + {z | cavityReplicaRadius (cavitySelectedGroupProjection e) z = b j} = 0) : + let p := spectralSpinQuantilePath Q₀ hP hn + let K := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * B₀ - + Matrix.diagonal (fun i => eig (g i)) + let L := B₀.transpose * cavityRepeatedSpectrum (n := kspin) eig * + cavityLimitingStack (n := kspin) ρ + let Cspin := (finiteR ρ eig hρ hρsum 0) • (1 : Matrix (Fin kspin) (Fin kspin) ℝ) + let τ := fun j => cavityFactorSize K L Cspin * (1+(b j)^2) + ∀ ε > 0, ∀ᶠ j in atTop, ∀ᶠ n in atTop, + |(∫ ω, cavityWeightedReplicaMean + ((restrictedRotationProbability (S n) (hS n) (eigN n) + (cavitySpectralGroup (fun i => ((E n).symm i).1)) (u n) ω.1).prod + (restrictedSpinPrior T hT)) + (fun x => cavityHaarRestrictedWeight e (cavityRotationVectors (dims n) (E n)) + (A₀ n) K L Cspin (τ j) (b j) (ω,x)) + (fun σ : Fin 2 → (Spin (N n) × LabeledLeaf (depth n)) × Spin kspin => + Φ (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1)) * + (spinValue ((σ 0).2 site) * spinValue ((σ 1).2 site))) + ∂(((μ n).prod (θ n)).prod gaussianCoordinates).prod (Measure.pi (μG n))) - + ∫ t, Φ (cavityStrictUniformPath p n t) * + restrictedCoordinateOverlapPath hkspin T hT (cavityStrictUniformField ρ eig hρ hρsum p n) site t ∂pathMeasure| < ε := by + intro p K L Cspin τ + let I n := cavitySpectralGroup (fun i => ((E n).symm i).1) + let Ω n := (Orthogonal (N n) × LabeledTree (depth n)) × (ℕ → ℝ) + let X n := Spin (N n) × LabeledLeaf (depth n) + let P n := ((μ n).prod (θ n)).prod gaussianCoordinates + let ν n := restrictedRotationProbability (S n) (hS n) (depth := depth n) (eigN n) (I n) (u n) + let B n := cavityRotationEntry (depth := depth n) (I n) + let Q n := restrictedRotationArrayLaw (S n) (hS n) (μ n) (θ n) (eigN n) (I n) (u n) + have hρs n a : 0 < (dims n a : ℝ)/N n := + div_pos (Nat.cast_pos.mpr (hgroups n a)) (Nat.cast_pos.mpr (hN n)) + have hh := restricted_haar_finite_spin_cutoff hpub dims hdims μG A₀ hA₀ Ω X P ν + (fun n => measurable_restrictedRotationProbability _ _ _ _ _) B + (fun n => measurable_cavityRotationEntry (I n)) + (fun n => cavityRotationEntry_gram (I n)) + (fun n => cavityRotationVectors (dims n) (E n)) + (fun n => measurable_cavityRotationVectors (dims n) (E n)) (1/c) + (fun s n x => cavityRotationVectors_gram_bound (r := s) (hN n) (dims n) (E n) x hc (hcG n)) + (fun n a => (dims n a : ℝ)/N n) ρ eig hρs hρ hρlim hρsum + (fun s n x => cavityRotationVectors_covariance (r := s) (hN n) (dims n) (E n) x q) + Q Q₀ (fun _ => rfl) hlim hgg hG d hd0 hd hE hP hn hoff hdiag g e he heg + hgroups (div_nonneg zero_le_one hc.le) hdim hkspin T hT B₀ hB₀ hBE hcomplete a ha Φ hΦ site hΦb + b hb hblim hnull + dsimp only at hh + intro ε hε + filter_upwards [hh ε hε] with j hj + filter_upwards [hj] with n hn' + have htest (ω : Ω n × ((a : Fin m) → Orthogonal (dims n a))) : cavityProjectedSpinTest (cavitySampledGroupBlock (B n) ω.1) + (cavitySpinObservable Φ hΦ site) = + (fun σ : Fin 2 → (Spin (N n) × LabeledLeaf (depth n)) × Spin kspin => + Φ (cavityTotalSpinOverlap ((σ 0).1.1,(σ 1).1.1)) * + (spinValue ((σ 0).2 site) * spinValue ((σ 1).2 site))) := by + funext σ + exact cavity_physical_spin_observable (fun i => ((E n).symm i).1) ω.1 Φ hΦ site σ + simpa only [htest] using hn' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalTrialLower.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalTrialLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf62f67dffdaec521de6e2bd23ca4bf12c09444f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPhysicalTrialLower.lean @@ -0,0 +1,115 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCompressionCappedLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRandomPressureIncrement +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteTrialLower + +namespace OAI + +/-! The physical full-minus-base pressure increment bounds the exact +finite-field trial value from below. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators + +namespace InvariantIsing + +theorem restricted_physical_trial_lower {m d n : ℕ} (hn₀ : 0 cavityBaseGroupDimension (k r) a₀ a) atTop atTop) + (μ : (r : ℕ) → Measure (Orthogonal (N r+n))) [∀ r, IsProbabilityMeasure (μ r)] [∀ r, (μ r).IsMulRightInvariant] + (ν : (r : ℕ) → Measure (Orthogonal (N r))) [∀ r, IsProbabilityMeasure (ν r)] [∀ r, (ν r).IsMulRightInvariant] + (θ : (r : ℕ) → Measure (LabeledTree (depth r))) [∀ r, IsProbabilityMeasure (θ r)] + (μG : (r : ℕ) → (a : Fin m) → Measure (Orthogonal (cavityBaseGroupDimension (k r) a₀ a))) + [∀ r a, IsProbabilityMeasure (μG r a)] [∀ r a, (μG r a).IsMulRightInvariant] + (lam : Fin m → ℝ) (v : ℕ → Fin m → ℝ) (u : ℕ → ℕ → ℝ) + (hv : ∀ r a, |v r a|≤2) (hu : ∀ r j, |u r j|≤2) + {c : ℝ} (hc : 0 (cavityBaseGroupDimension (k r) a₀ a : ℝ)/N r) atTop (𝓝 ρ)) + (Q₀ : ProbabilityMeasure (SpectralArray (m+1))) + (hlim : Tendsto (fun r => restrictedRotationArrayLaw (S r) (hS r) (ν r) (θ r) + (diagonalPerturbedEigenvalues + (fun i => lam ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1)) (v r) 1) + (cavitySpectralGroup (fun i => ((cavityBaseGroupEquiv (k r) (e r) a₀).symm i).1)) + (u r)) atTop (𝓝 Q₀)) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q₀ : Measure (SpectralArray (m+1)))) + (hG : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralGram x) + (d₀ : Fin (m+1) → ℝ) (hd0 : ∀ j, 0≤d₀ j) + (hd : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ i j, (x (i,i) j : ℝ)=d₀ j) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q₀ : Measure (SpectralArray (m+1))).map (permuteSpectralArray e)=Q₀) + (hP : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q₀ : Measure (SpectralArray (m+1))), ∀ j, 0≤(x (0,1) j : ℝ)) + (hoff : ∀ j l, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ B : ℝ, 0≤B → (∀ t, |Φ t|≤B) → + spectralOffWardResidual Q₀ ρ lam j l Φ=0) + (hdiag : ∀ j l, spectralDiagonalWardResidual Q₀ ρ lam j l=0) + (B : Matrix (Fin (m*n)) (Fin d) ℝ) (hB : B.transpose*B=1) + (hBE : B.transpose*cavityLimitingStack (n := n) ρ=0) + (hcomplete : B*B.transpose+cavityLimitingStack (n := n) ρ* + (cavityLimitingStack (n := n) ρ).transpose=1) + (amax : Fin m) (hmax : ∀ a, lam a≤lam amax) + (counts : Fin m → ℕ) (hcounts_le : ∀ a, counts a≤n) + (hcounts : ∀ a, (Finset.univ.filter (fun j => a₀ j=a)).card=n-counts a) + (hcounts_rho : ∀ a, (counts a : ℝ)=(n : ℝ)*ρ a) + (hprob : ∀ ε>0, Tendsto (fun r => (μ r).real {U | ε lam (a₀ j)) B₀ + (cavityCompressionGrams (g r) U)) + (B.transpose*cavityRepeatedSpectrum (n := n) lam*B-Matrix.diagonal (fun j => lam (a₀ j)), + B.transpose*cavityRepeatedSpectrum (n := n) lam*cavityLimitingStack (n := n) ρ, + (finiteR ρ lam hρ hρsum 0) • 1)}) atTop (𝓝 0)) : + let p := spectralSpinQuantilePath Q₀ hP hn + let Δ := fun r => + (∫ z, restrictedRotationLogMean (cavityProductSlice (S r) C) (cavityProductSlice_nonempty (S r) (hS r) C hC) z.2 + (diagonalPerturbedEigenvalues (fun i => lam (g r i)) (cavitySpectralGroup (g r)) (v r) 1) + (cavitySpectralGroup (g r)) (u r) z.1 ∂(μ r).prod (θ r)) - + ∫ z, restrictedRotationLogMean (S r) (hS r) z.2 + (diagonalPerturbedEigenvalues + (fun i => lam (Sum.elim (fun w => w.1) a₀ ((e r).symm i))) + (cavityBaseGroup (k r) (e r) a₀) (v r) 1) + (cavityBaseGroup (k r) (e r) a₀) (u r) z.1 ∂(ν r).prod (θ r) + ∀ ε>0, ∀ᶠ r in atTop, + constrainedBlockValue C (cavityStrictUniformField ρ lam hρ hρsum p r)+ + fieldPairing (cavityStrictUniformPath p r) (cavityStrictUniformField ρ lam hρ hρsum p r)/2+ + spectralFunctional (finiteR ρ lam hρ hρsum) (cavityStrictUniformPath p r)- + (n : ℝ)⁻¹*(Δ r+(Real.log C.card-n*Real.log 2)) < ε := by + intro p Δ + let A : CavityFactorBlocks d n := + (B.transpose*cavityRepeatedSpectrum (n := n) lam*B-Matrix.diagonal (fun j => lam (a₀ j)), + B.transpose*cavityRepeatedSpectrum (n := n) lam*cavityLimitingStack (n := n) ρ, + (finiteR ρ lam hρ hρsum 0) • 1) + let AR := fun r U => cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams (g r) U) + let δ := fun r => cavityDeterministicRate n m (2*(2*n+1)) (N r)+ + 2*cavityCovarianceRate n (2*n+1) (N r) + let cap := fun T r => ∫ ω, + restrictedRandomHaarLog (S r) (hS r) C hC (k r) (e r) a₀ (hk r) lam (v r) (u r) 1 T (δ r) (AR r) ω + ∂((μ r).prod (((ν r).prod (θ r)).prod gaussianCoordinates)).prod (Measure.pi (μG r)) + have hbound : ∀ T>0, ∀ r, cap T r≤Δ r := by + intro T hT r + exact restricted_random_pressure_increment (hN r) (S r) (hS r) C hC (g r) (k r) (ek r) (e r) es B₀ a₀ (hk r) + (Measure.pi (μG r)) (fun a => l a r) (fun a => w a r) (hg r) (hln r) (hw r) + (μ r) (ν r) (θ r) lam (v r) (hv r) (u r) (hu r) 1 T hT.le + have hcap T (hT : 0 rotatedEnergy eig U σ + fieldEnergy c σ) + +lemma restrictedRotatedPressure_univ {N : ℕ} (eig : Fin N → ℝ) + (U : Rotation N) (c : Fin N → ℝ) : + restrictedRotatedPressure Finset.univ eig U c = rotatedPressure eig U c := by + rw [restrictedRotatedPressure, restrictedSpinLog_univ] + rfl + +lemma restrictedRotatedPressure_le_full {N : ℕ} (S : Finset (Spin N)) + (hS : S.Nonempty) (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) : + restrictedRotatedPressure S eig U c ≤ rotatedPressure eig U c := + mul_le_mul_of_nonneg_left (restrictedSpinLog_le_full S hS _) (by positivity) + +lemma restrictedRotatedPressure_eq_prior {N : ℕ} (S : Finset (Spin N)) + (hS : S.Nonempty) (eig : Fin N → ℝ) (U : Rotation N) (c : Fin N → ℝ) : + restrictedRotatedPressure S eig U c = + (N : ℝ)⁻¹ * finiteLogIntegral (restrictedSpinPrior S hS : Measure (Spin N)) + (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + + (N : ℝ)⁻¹ * (Real.log S.card - N * Real.log 2) := by + rw [finiteLogIntegral_restrictedSpinPrior] + unfold restrictedRotatedPressure + ring + +lemma abs_restrictedRotatedPressure_sub_field_le {N : ℕ} (S : Finset (Spin N)) + (hS : S.Nonempty) (eig : Fin N → ℝ) (U : Rotation N) (c d : Fin N → ℝ) : + |restrictedRotatedPressure S eig U c - restrictedRotatedPressure S eig U d| ≤ + (N : ℝ)⁻¹ * ∑ i, |c i - d i| := by + have he := abs_restrictedSpinLog_sub_le S hS + (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + (fun σ => rotatedEnergy eig U σ + fieldEnergy d σ) (∑ i, |c i - d i|) + (fun σ _ => by simpa only [add_sub_add_left_eq_sub] using abs_fieldEnergy_sub_le c d σ) + simpa only [restrictedRotatedPressure, ← mul_sub, abs_mul, + abs_of_nonneg (show (0 : ℝ) ≤ (N : ℝ)⁻¹ by positivity)] using + mul_le_mul_of_nonneg_left he (inv_nonneg.mpr (Nat.cast_nonneg N)) + +lemma abs_restrictedRotatedPressure_sub_rotation_le {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (eig : Fin N → ℝ) + (U V : SpecialOrthogonal N) (c : Fin N → ℝ) + (K : ℝ) (hK : 0 ≤ K) (heig : ∀ i, |eig i| ≤ K) : + |restrictedRotatedPressure S eig (specialRotation U) c - + restrictedRotatedPressure S eig (specialRotation V) c| ≤ K * frobeniusDistance U V := by + have he := abs_restrictedSpinLog_sub_le S hS + (fun σ => rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ) + (fun σ => rotatedEnergy eig (specialRotation V) σ + fieldEnergy c σ) + (K * N * frobeniusDistance U V) (fun σ _ => by + simpa only [add_sub_add_right_eq_sub] using + abs_rotatedEnergy_sub_rotation_le eig U V K hK heig σ) + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN.ne' + calc + _ = (N : ℝ)⁻¹ * |restrictedSpinLog S + (fun σ => rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ) - + restrictedSpinLog S (fun σ => rotatedEnergy eig (specialRotation V) σ + fieldEnergy c σ)| := by + rw [restrictedRotatedPressure, restrictedRotatedPressure, ← mul_sub, abs_mul, + abs_of_nonneg (show (0 : ℝ) ≤ (N : ℝ)⁻¹ by positivity)] + _ ≤ (N : ℝ)⁻¹ * (K * N * frobeniusDistance U V) := + mul_le_mul_of_nonneg_left he (by positivity) + _ = _ := by field_simp + +lemma measurable_restrictedRotatedPressure {N : ℕ} (S : Finset (Spin N)) + (eig c : Fin N → ℝ) : + Measurable (fun U : SpecialOrthogonal N => restrictedRotatedPressure S eig (specialRotation U) c) := by + have hE (σ : Spin N) : Measurable (fun U : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ) := by + exact ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector σ) i).pow_const 2).const_mul + (eig i)).const_mul (1 / 2 : ℝ)).add_const _ + unfold restrictedRotatedPressure restrictedSpinLog + exact ((Finset.measurable_sum _ fun σ _ => (hE σ).exp).log.sub_const _).const_mul _ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPressureFluctuation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPressureFluctuation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e2d2cb642f3474a1c04441cdb46cab756421136 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPressureFluctuation.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Haar.HaarVariance +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressure + +namespace OAI + +/-! Uniform mean absolute fluctuations for constrained Haar pressures. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace InvariantIsing + +lemma integral_abs_sub_mean_le_sqrt_variance {X : Type*} [MeasurableSpace X] + (μ : Measure X) [IsProbabilityMeasure μ] (f : X → ℝ) (hf : MemLp f 2 μ) : + (∫ x, |f x-∫ y, f y ∂μ| ∂μ) ≤ Real.sqrt (variance f μ) := by + let g := fun x => f x-∫ y, f y ∂μ + have hg : MemLp g 2 μ := hf.sub (memLp_const _) + have hga : MemLp (fun x => |g x|) 2 μ := by simpa only [Real.norm_eq_abs] using hg.norm + have hv := variance_nonneg (fun x => |g x|) μ + rw [variance_eq_sub hga] at hv + simp only [Pi.pow_apply, sq_abs] at hv + have he : (∫ x, g x^2 ∂μ)=variance f μ := + (variance_eq_integral hf.aemeasurable).symm + rw [he] at hv + apply (sq_le_sq₀ (integral_nonneg (fun _ => abs_nonneg _)) (Real.sqrt_nonneg _)).mp + rw [Real.sq_sqrt (variance_nonneg f μ)] + linarith + +theorem haar_restrictedPressure_mean_fluctuation (hpub : HaarConcentrationInput) : + ∃ B : ℝ, 0 restrictedRotatedPressure S eig (specialRotation U) c) μ ∧ + (∫ U, |restrictedRotatedPressure S eig (specialRotation U) c- + ∫ V, restrictedRotatedPressure S eig (specialRotation V) c ∂μ| ∂μ) ≤ + Real.sqrt (B*K^2/N) := by + obtain ⟨B,hB,hv⟩ := haar_frobeniusLipschitz_variance hpub + refine ⟨B,hB,?_⟩ + intro N hN μ hμ hμinv S hS eig c K hK heig + have : IsProbabilityMeasure μ := hμ + let f := fun U => restrictedRotatedPressure S eig (specialRotation U) c + have hm : Measurable f := measurable_restrictedRotatedPressure S eig c + have hLip : ∀ U V, |f U-f V| ≤ K*frobeniusDistance U V := + fun U V => abs_restrictedRotatedPressure_sub_rotation_le (by omega) S hS eig U V c K hK.le heig + have hf := haar_frobeniusLipschitz_memLp_two hpub N hN μ hμinv f hm K hK hLip + exact ⟨hf.integrable (by norm_num), (integral_abs_sub_mean_le_sqrt_variance μ f hf).trans + (Real.sqrt_le_sqrt (hv N hN μ hμ hμinv f hm K hK hLip))⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPressureIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPressureIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a9de9b5f7efc49a5eecb3c9e7ca9a6e5629f1af --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPressureIncrement.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedHaarLogIncrement +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOrientationLog + +namespace OAI + +/-! The capped cavity logarithm is bounded by the literal difference +of the ordinary full and base Haar-averaged log partitions. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_pressure_capped_increment {N n m d depth : ℕ} (hN : 0 cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams g U) + let q := fun V => cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + let c := fun a => t*lam a+2*perturbationScale N*v a + let δ := cavityDeterministicRate n m (2*(2*n+1)) N+ + 2*cavityCovarianceRate n (2*n+1) N + (∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) ∂μ.prod ν) ≤ + (∫ U, restrictedRotationLogMean (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) T + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u U ∂μ) - + ∫ V, restrictedRotationLogMean S hS T + (diagonalPerturbedEigenvalues + (fun i => lam (Sum.elim (fun w => w.1) a₀ (e.symm i))) + (cavityBaseGroup k e a₀) v t) (cavityBaseGroup k e a₀) u V ∂ν := by + intro A q c δ + have h := restricted_haar_capped_log_increment hN S hS C hC g k ek e es B₀ a₀ l r hg hln hr + μ ν T lam v hv u hu t cap hcap + dsimp only at h + rw [restricted_orientation_haar_log_mean (by omega : 0 restrictedRotatedPressure S eig (matrixRotation V⁻¹) c) := by + have hm := (measurable_restrictedRotatedPressure S eig c).comp + ((measurable_cavityOrientationLift hN).comp measurable_inv) + convert hm using 1 + funext V + simp only [Function.comp_apply, restrictedRotatedPressure, cavityOrientationLift_energy] + +lemma integrable_physicalRestrictedPressure {N : ℕ} (hN : 0 < N) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (S : Finset (Spin N)) (hS : S.Nonempty) (eig c : Fin N → ℝ) : + Integrable (fun V => restrictedRotatedPressure S eig (matrixRotation V⁻¹) c) μ := by + let B := (∑ i, |eig i|)*N/2+∑ i, |c i| + have hb (V : Orthogonal N) (σ : Spin N) : + |rotatedEnergy eig (matrixRotation V⁻¹) σ+fieldEnergy c σ| ≤ B := by + have hq := abs_rotatedEnergy_le eig (matrixRotation V⁻¹) (∑ i, |eig i|) + (fun i => Finset.single_le_sum (fun j _ => abs_nonneg (eig j)) (Finset.mem_univ i)) σ + have hf := abs_fieldEnergy_sub_le c 0 σ + simp only [fieldEnergy, Pi.zero_apply, zero_mul, Finset.sum_const_zero, sub_zero] at hf + exact (abs_add_le _ _).trans (add_le_add hq hf) + apply Integrable.of_bound (measurable_physicalRestrictedPressure hN S eig c).aestronglyMeasurable + ((N : ℝ)⁻¹*(B+|restrictedSpinLog S (fun _ => 0)|)) + apply ae_of_all + intro V + rw [Real.norm_eq_abs, restrictedRotatedPressure, abs_mul, + abs_of_nonneg (inv_nonneg.mpr (Nat.cast_nonneg N))] + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg N)) + have hh := abs_restrictedSpinLog_sub_le S hS + (fun σ => rotatedEnergy eig (matrixRotation V⁻¹) σ+fieldEnergy c σ) (fun _ => 0) B + (fun σ _ => by simpa only [sub_zero] using hb V σ) + have ha := abs_add_le + (restrictedSpinLog S (fun σ => rotatedEnergy eig (matrixRotation V⁻¹) σ+fieldEnergy c σ)- + restrictedSpinLog S (fun _ => 0)) (restrictedSpinLog S (fun _ => 0)) + rw [sub_add_cancel] at ha + exact ha.trans (add_le_add hh le_rfl) + +lemma mean_consecutive_field_pressure_lower {n K : ℕ} (hn : 0 < n) (hK : 0 < K) + (μ : Measure (Orthogonal (K*n))) [IsProbabilityMeasure μ] + (C : Finset (Spin n)) (hC : C.Nonempty) + (b : Fin n → ℝ) (M : ℝ) (hM : ∀ σ ∈ C, fieldEnergy b σ=M) + (eig : Fin (K*n) → ℝ) : + (∫ V, restrictedRotatedPressure (consecutiveBlockConstraint n K C) eig + (matrixRotation V⁻¹) (fun _ => 0) ∂μ)+M/n ≤ + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) (consecutiveBlockField K b) ∂μ := by + have hdim : 0 < K*n := Nat.mul_pos hK hn + have hi := integrable_physicalRestrictedPressure hdim μ _ (consecutiveBlockConstraint_nonempty C hC) + eig (fun _ => 0) + have hf := integrable_physicalPressure hdim μ id measurable_id eig (consecutiveBlockField K b) + have hh := integral_mono (hi.add (integrable_const (M/n))) hf + (fun V => consecutive_field_pressure_lower hn hK C hC b M hM eig (matrixRotation V⁻¹)) + simp only [Pi.add_apply, id_eq] at hh + simpa only [integral_add hi (integrable_const (M/n)), integral_const, probReal_univ, one_smul] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorGaussianLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorGaussianLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..53b8b0a8077130d017a492b9768b7edab1ebf348 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorGaussianLaw.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Fields.PriorTensorReference +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability +import OAI.Probability.InvariantIsing.Cavity.CavityOrientationProbability + +namespace OAI + +/-! The physical constrained Gibbs probability has the fixed-prior Gaussian law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal +namespace InvariantIsing + +theorem priorTensorGibbs_law {N m k depth : ℕ} + (ν : Measure (Spin N × LabeledLeaf depth)) [IsProbabilityMeasure ν] + (U : Rotation N) (I : Fin m → Finset (Fin N)) (degree : Fin k → Fin m → ℕ) + (amp : Fin k → ℝ) (v : Fin (depth+1) → SpinTensorIndex I degree → ℝ≥0) + (H : Spin N × LabeledLeaf depth → ℝ) : + gaussianCoordinates.map (fun z => gibbsProbability ν + (fun x => H x+cylinderField (tensorLeafCoefficients U I degree amp depth v x) z)) = + gaussianCoordinates.map (fun z => gibbsProbability ν + (fun x => H x+cylinderField (tensorNamespacedCoefficients U I degree amp depth v x) z)) := by + let X := Spin N × LabeledLeaf depth + let G : (X → ℝ) → Measure X := fun f => gibbsProbability ν (fun x => H x+f x) + have hm : Measurable (fun p : (X → ℝ) × X => H p.2+p.1 p.2) := by + apply measurable_from_prod_countable_left + intro x + exact (measurable_pi_apply x : Measurable (fun w : X → ℝ => w x)).const_add (H x) + have hG : Measurable G := measurable_gibbsProbability (ν := fun _ => ν) measurable_const hm + have hA : Measurable (fun z x => cylinderField (tensorLeafCoefficients U I degree amp depth v x) z) := + Measurable.of_eval (fun x => measurable_cylinderField _) + have hC : Measurable (fun z x => cylinderField (tensorNamespacedCoefficients U I degree amp depth v x) z) := + Measurable.of_eval (fun x => measurable_cylinderField _) + have hh := congrArg (fun μ : Measure (X → ℝ) => μ.map G) + (tensorNamespacedFields_law U I degree amp depth v) + simpa only [Measure.map_map hG hA,Measure.map_map hG hC,Function.comp_def,G] using hh + +lemma restricted_orientation_probability_law {N m depth : ℕ} (hN : 0 restrictedRotationProbability S hS eig I u ((V,T),z)) = + gaussianCoordinates.map (fun z => restrictedRotationProbability S hS eig I u + (((cavitySpecialOrthogonal (cavityOrientationLift hN V⁻¹))⁻¹,T),z)) := by + have hh := cavity_gibbs_probability_same_covariance + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (fun x => rotatedEnergy eig (matrixRotation V⁻¹) x.1) + (cavityPerturbationCoefficients (matrixRotation V⁻¹) I u depth) + (cavityPerturbationCoefficients (specialRotation (cavityOrientationLift hN V⁻¹)) I u depth) + (fun x y => (cavityOrientationLift_perturbation_covariance hN V⁻¹ I u x y).symm) + simp only [restrictedRotationProbability,inv_inv] + unfold cavityRotationHamiltonian + simp only [show matrixRotation (cavitySpecialOrthogonal (cavityOrientationLift hN V⁻¹)) = + specialRotation (cavityOrientationLift hN V⁻¹) from rfl,cavityOrientationLift_energy] + exact hh + +lemma restricted_special_prior_probability_law {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (U : SpecialOrthogonal N) (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + gaussianCoordinates.map (fun z => restrictedRotationProbability S hS eig I u + (((cavitySpecialOrthogonal U)⁻¹,T),z)) = + gaussianCoordinates.map (fun z => priorNamespacedReference + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + eig (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N (fun j => u j)) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) depth + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i) (U,z)) := by + let degree := fun j : Fin N => enumeratedSpectralDegree m j + let amp := tensorPerturbationAmplitude N (fun j : Fin N => u j) + let v : Fin (depth+1) → SpinTensorIndex I degree → ℝ≥0 := fun i => tensorPathProfile I degree depth + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i + have hh := priorTensorGibbs_law + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (specialRotation U) I degree amp v (fun x => rotatedEnergy eig (specialRotation U) x.1) + simp only [restrictedRotationProbability,inv_inv, + show matrixRotation (cavitySpecialOrthogonal U)=specialRotation U from rfl,priorNamespacedReference] + unfold cavityRotationHamiltonian priorNamespacedHamiltonian + simp only [fieldEnergy,zero_mul,Finset.sum_const_zero,add_zero] + simpa only [cavityPerturbationCoefficients,degree,amp,v] using hh + +theorem restricted_orientation_prior_probability_law {N m depth : ℕ} (hN : 0 restrictedRotationProbability S hS eig I u ((V,T),z)) = + gaussianCoordinates.map (fun z => priorNamespacedReference + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + eig (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N (fun j => u j)) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) depth + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i) + (cavityOrientationLift hN V⁻¹,z)) := + (restricted_orientation_probability_law hN S hS V T eig I u).trans + (restricted_special_prior_probability_law S hS (cavityOrientationLift hN V⁻¹) T eig I u) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..2823247b367c3b06cc872e406a3d47a86a8daf58 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorIntegrability.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior +import OAI.Probability.InvariantIsing.Fields.FieldEnergyCoordinates + +namespace OAI + +/-! The normalized constrained prior inherits the actual finite-field +exponential moments from the full spin prior. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped NNReal + +namespace InvariantIsing + +lemma restrictedSpinPrior_eq_cond {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + (restrictedSpinPrior S hS : Measure (Spin N)) = cond (uniformSpinPrior N : Measure (Spin N)) S := by + change cond (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fun _ => 0)) S = _ + rw [gibbsProbability_eq_tilted _ _ Integrable.of_finite, tilted_const] + +lemma integrable_restrictedSpinPrior_prod {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + {X : Type*} [MeasurableSpace X] (ν : Measure X) [SFinite ν] + {f : Spin N × X → ℝ} (hf : Integrable f ((uniformSpinPrior N : Measure (Spin N)).prod ν)) : + Integrable f ((restrictedSpinPrior S hS : Measure (Spin N)).prod ν) := by + have hzero : gibbsProbability (uniformSpinPrior N : Measure (Spin N)) (fun _ => 0) = + (uniformSpinPrior N : Measure (Spin N)) := by + rw [gibbsProbability_eq_tilted _ _ Integrable.of_finite, tilted_const] + have hm : (uniformSpinPrior N : Measure (Spin N)) S ≠ 0 := by + apply (measureReal_ne_zero_iff).mp + have hp := spinGibbs_mass_pos (fun _ => 0) S hS + rw [hzero] at hp + exact hp.ne' + rw [restrictedSpinPrior_eq_cond, ProbabilityTheory.cond, Measure.prod_smul_left] + have he : ((uniformSpinPrior N : Measure (Spin N)).restrict S).prod ν = + ((uniformSpinPrior N : Measure (Spin N)).prod ν).restrict ((S : Set (Spin N)) ×ˢ univ) := by + conv_lhs => rw [← Measure.restrict_univ (μ := ν)] + exact Measure.prod_restrict _ _ + rw [he] + exact hf.restrict.smul_measure (ENNReal.inv_ne_top.mpr hm) + +lemma restricted_field_vector_spin_exp_integrable {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (z : Fin N → ℝ) : + ∀ᵐ p ∂fieldVectorCoordinateLaw N h, + Integrable (fun s : Spin N × LabeledLeaf h.depth => + Real.exp (fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1)) + ((restrictedSpinPrior S hS : Measure (Spin N)).prod (labeledLeafLaw h.depth p.1)) := by + filter_upwards [field_vector_spin_exp_integrable N hN h z] with p hp + exact integrable_restrictedSpinPrior_prod S hS _ hp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorPressure.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..df230c972c6c9594804b4a1cf5676cde774c3536 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedPriorPressure.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedZeroTreeArrayLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedOrientationLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeLogMeasurability +import OAI.Probability.InvariantIsing.Fields.PriorTensorMinimum + +namespace OAI + +/-! Exact pressure transport from the constrained physical rotation to its +fixed-prior realization. Normalization is kept separate from the cube mass. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal +namespace InvariantIsing + +lemma restricted_special_prior_log_mean {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (U : SpecialOrthogonal N) + (T : LabeledTree depth) (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + (∫ z, priorTensorLog (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + eig (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N (fun j => u j)) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) depth + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i) (U,z) ∂gaussianCoordinates) = + restrictedRotationLogMean S hS T eig I u ((cavitySpecialOrthogonal U)⁻¹) := by + simp only [priorTensorLog, restrictedRotationLogMean, inv_inv, + show matrixRotation (cavitySpecialOrthogonal U) = specialRotation U from rfl, + cavityRotationHamiltonian, cavityPerturbationCoefficients, + fieldEnergy, zero_mul, Finset.sum_const_zero, add_zero] + +lemma restricted_prior_pressure_mean (hhaar : HaarConcentrationInput) + (hgauss : GaussianLipschitzVarianceInput) {N m : ℕ} (hN : 3 ≤ N) + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (θ : Measure (LabeledTree 0)) [IsProbabilityMeasure θ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : Fin N → ℝ) (hu : ∀ j, u j ∈ Set.Icc (1 : ℝ) 2) + (v : Fin m → ℝ) (t : ℝ) : + (N : ℝ) * priorPerturbationPressureMean + (cavityOrientedBaseLaw (by omega) μ) (restrictedZeroTreePrior S hS) + eig (fun _ => 0) I t (fun _ => 0) u v = + ∫ p, restrictedRotationLogMean S hS p.2 (diagonalPerturbedEigenvalues eig I v t) + I (cavityBaseAmplitude u) p.1 ∂μ.prod θ := by + let E := diagonalPerturbedEigenvalues eig I v t + let degree := fun j : Fin N => enumeratedSpectralDegree m j + let profile : Fin (0+1) → SpinTensorIndex I degree → ℝ≥0 := fun i => tensorPathProfile I degree 0 + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i + let F := priorTensorLog (restrictedZeroTreePrior S hS) E (fun _ => 0) I degree + (tensorPerturbationAmplitude N u) profile + have hi : Integrable F ((cavityOrientedBaseLaw (by omega) μ).prod gaussianCoordinates) := + priorTensorLog_integrable hhaar hgauss hN _ + (cavityOrientedBaseLaw_leftInvariant (by omega) μ) _ E (fun _ => 0) I degree _ + (fun i => varianceIncrement (fun _ => 0) i) + (fun i j => varianceIncrement (monomialPath 0 (enumeratedTreeDegree m j)) i) + have hM : Measurable (fun U => ∫ z, F (U,z) ∂gaussianCoordinates) := + (measurable_priorTensorLog _ E (fun _ => 0) I degree _ profile).stronglyMeasurable + |>.integral_prod_right' |>.measurable + have he (U : SpecialOrthogonal N) : (∫ z, F (U,z) ∂gaussianCoordinates) = + restrictedRotationLogMean (depth := 0) S hS (PUnit.unit : LabeledTree 0) E I (cavityBaseAmplitude u) + ((cavitySpecialOrthogonal U)⁻¹) := by + simpa only [F,profile,degree,restrictedZeroTreePrior,cavityBaseAmplitude_restrict] using + restricted_special_prior_log_mean (depth := 0) S hS U (PUnit.unit : LabeledTree 0) E I (cavityBaseAmplitude u) + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + unfold priorPerturbationPressureMean + change (N : ℝ) * ((N : ℝ)⁻¹ * ∫ p, F p ∂_) = _ + rw [← mul_assoc, mul_inv_cancel₀ hn, one_mul, integral_prod _ hi] + rw [cavityOrientedBaseLaw] + rw [integral_map (φ := fun V : Orthogonal N => cavityOrientationLift (by omega) V⁻¹) + (((measurable_cavityOrientationLift (by omega)).comp measurable_inv).aemeasurable) + hM.aestronglyMeasurable] + simp_rw [he] + have hor (V : Orthogonal N) := restricted_orientation_log_mean (depth := 0) (by omega) S hS V⁻¹ + (PUnit.unit : LabeledTree 0) E I (cavityBaseAmplitude u) + simp only [inv_inv] at hor + simp_rw [hor] + symm + have hiR := integrable_restrictedRotationLogMean_tree S hS μ θ E I (cavityBaseAmplitude u) + (cavityBaseAmplitude_bound u hu) + rw [integral_prod _ hiR] + congr 1 + funext V + have hT (T : LabeledTree 0) : T = (PUnit.unit : LabeledTree 0) := Subsingleton.elim _ _ + simp_rw [hT] + simp only [integral_const, probReal_univ, one_smul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProductPrior.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProductPrior.lean new file mode 100644 index 0000000000000000000000000000000000000000..2229caf635f80b5f109d87e8715a7acdc5d7cb28 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProductPrior.lean @@ -0,0 +1,97 @@ +import OAI.Probability.InvariantIsing.Cavity.CavitySpinSplit +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior + +namespace OAI + +/-! Exact product decomposition for constrained cavity blocks. The +normalization cost is the sum of the two original cube-mass costs. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +def cavityProductSlice {N n : ℕ} (S : Finset (Spin N)) (T : Finset (Spin n)) : + Finset (Spin (N+n)) := + (S ×ˢ T).map (cavitySpinSplit N n).symm.toEmbedding + +lemma mem_cavityProductSlice {N n : ℕ} (S : Finset (Spin N)) (T : Finset (Spin n)) + (σ : Spin (N+n)) : σ ∈ cavityProductSlice S T ↔ + (cavitySpinSplit N n σ).1 ∈ S ∧ (cavitySpinSplit N n σ).2 ∈ T := by + simp [cavityProductSlice] + +lemma cavityProductSlice_card {N n : ℕ} (S : Finset (Spin N)) (T : Finset (Spin n)) : + (cavityProductSlice S T).card = S.card * T.card := by + simp [cavityProductSlice] + +lemma cavityProductSlice_nonempty {N n : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (T : Finset (Spin n)) (hT : T.Nonempty) : (cavityProductSlice S T).Nonempty := by + obtain ⟨σ,hσ⟩ := hS + obtain ⟨τ,hτ⟩ := hT + refine ⟨(cavitySpinSplit N n).symm (σ,τ), ?_⟩ + rw [mem_cavityProductSlice] + simpa using And.intro hσ hτ + +lemma cavityProductSlice_log_mass {N n : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (T : Finset (Spin n)) (hT : T.Nonempty) : + Real.log (cavityProductSlice S T).card - (N+n) * Real.log 2 = + (Real.log S.card - N * Real.log 2) + (Real.log T.card - n * Real.log 2) := by + rw [cavityProductSlice_card, Nat.cast_mul, Real.log_mul + (Nat.cast_ne_zero.mpr hS.card_pos.ne') (Nat.cast_ne_zero.mpr hT.card_pos.ne')] + ring + +theorem restricted_cavity_spin_split_prior {N n : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : Finset (Spin n)) (hT : T.Nonempty) : + MeasurePreserving (cavitySpinSplit N n) + (restrictedSpinPrior (cavityProductSlice S T) (cavityProductSlice_nonempty S hS T hT) : + Measure (Spin (N+n))) + ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior T hT)) := by + refine ⟨measurable_of_countable _, ?_⟩ + apply Measure.ext_of_singleton + intro p + let μ := (restrictedSpinPrior (cavityProductSlice S T) + (cavityProductSlice_nonempty S hS T hT) : Measure (Spin (N+n))) + have hp : (cavitySpinSplit N n) ⁻¹' {p} = {(cavitySpinSplit N n).symm p} := by + ext σ + exact (cavitySpinSplit N n).eq_symm_apply.symm + have he : (μ.map (cavitySpinSplit N n)).real {p} = + ((restrictedSpinPrior S hS : Measure (Spin N)).prod (restrictedSpinPrior T hT)).real {p} := by + rw [measureReal_def, Measure.map_apply (measurable_of_countable _) (measurableSet_singleton p), hp] + change μ.real {(cavitySpinSplit N n).symm p} = _ + rw [restrictedSpinPrior_singleton, measureReal_def, + ← singleton_prod_singleton, Measure.prod_prod, ENNReal.toReal_mul] + change _ = (restrictedSpinPrior S hS : Measure (Spin N)).real {p.1} * + (restrictedSpinPrior T hT : Measure (Spin n)).real {p.2} + rw [restrictedSpinPrior_singleton, restrictedSpinPrior_singleton] + simp only [mem_cavityProductSlice, Equiv.apply_symm_apply, cavityProductSlice_card, Nat.cast_mul] + by_cases h₁ : p.1 ∈ S <;> by_cases h₂ : p.2 ∈ T <;> simp [h₁, h₂, mul_comm] + have hh := congrArg ENNReal.ofReal he + simpa only [measureReal_def, ENNReal.ofReal_toReal (measure_ne_top _ _)] using hh + +theorem restricted_cavity_spin_leaf_split_prior {N n depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (T : LabeledTree depth) : + MeasurePreserving (cavitySpinLeafSplit N n depth) + (labeledSpinReference depth (restrictedSpinPrior (cavityProductSlice S C) + (cavityProductSlice_nonempty S hS C hC) : Measure (Spin (N+n))) T) + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)) := by + have h := (restricted_cavity_spin_split_prior S hS C hC).prod + (MeasurePreserving.id (labeledLeafLaw depth T)) + have hshuffle := measurePreserving_prodAssoc + (restrictedSpinPrior S hS : Measure (Spin N)) (restrictedSpinPrior C hC : Measure (Spin n)) + (labeledLeafLaw depth T) + have hswap := (MeasurePreserving.id (restrictedSpinPrior S hS : Measure (Spin N))).prod + (Measure.measurePreserving_swap (μ := (restrictedSpinPrior C hC : Measure (Spin n))) + (ν := labeledLeafLaw depth T)) + have hassoc := (measurePreserving_prodAssoc + (restrictedSpinPrior S hS : Measure (Spin N)) (labeledLeafLaw depth T) + (restrictedSpinPrior C hC : Measure (Spin n))).symm MeasurableEquiv.prodAssoc + exact hassoc.comp (hswap.comp (hshuffle.comp h)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCavity.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCavity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e651857eb492790edcde83b18b8dde080b4a83a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCavity.lean @@ -0,0 +1,93 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorCavity +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionFactors +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffTotalBound + +namespace OAI + +/-! The normalized cavity observable as a measurable function of the +physical labeled projectors, selected frame and small coefficient blocks. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +def restrictedProjectorCavityMean {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (T : LabeledTree depth) + (c : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) (A : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + (p : CavityProjectorFrame N m d) : ℝ := + ∫ z, cavityCutoffReplicaMean + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset)) + (fun x => cavityProjectorHamiltonian p.1 c u z x.1 + + t * cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) + {x | 1 + ‖cavityFrameCoordinates p.2 x.1.1‖^2 ≤ D} F ∂gaussianCoordinates + +lemma restrictedProjectorCavityMean_bound {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (T : LabeledTree depth) + (c : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) (A : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {C : ℝ} (hC : 0 ≤ C) (hF : ∀ σ, |F σ| ≤ C) + (p : CavityProjectorFrame N m d) : + ‖restrictedProjectorCavityMean S hS Cset hCset T c u t D A F p‖ ≤ C := by + have hb : ∀ᵐ z ∂gaussianCoordinates, ‖cavityCutoffReplicaMean + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset)) + (fun x => cavityProjectorHamiltonian p.1 c u z x.1 + + t * cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) + {x | 1 + ‖cavityFrameCoordinates p.2 x.1.1‖^2 ≤ D} F‖ ≤ C := by + exact ae_of_all _ fun z => by + rw [Real.norm_eq_abs] + exact cavity_cutoff_replica_abs_le_all _ _ _ _ hC hF + simpa only [restrictedProjectorCavityMean, probReal_univ, mul_one] using + norm_integral_le_of_norm_le_const hb + +lemma measurable_restrictedProjectorCavityMean {Ω : Type*} [MeasurableSpace Ω] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (T : LabeledTree depth) (c : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) + (A : Ω → CavityFactorBlocks d n) (hA : Measurable A) + (p : Ω → CavityProjectorFrame N m d) (hp : Measurable p) + (F : Ω → (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + (hF : Measurable (Function.uncurry F)) : + Measurable (fun ω => restrictedProjectorCavityMean S hS Cset hCset T c u t D (A ω) (F ω) (p ω)) := by + let X := (Spin N × LabeledLeaf depth) × Spin n + let H := fun q : (Ω × (ℕ → ℝ)) × X => + cavityProjectorHamiltonian (p q.1.1).1 c u q.1.2 q.2.1 + + t*cavityLogFactor (A q.1.1).1 (A q.1.1).2.1 (A q.1.1).2.2 + (cavityFrameCoordinates (p q.1.1).2 q.2.1.1) q.2.2 + have hH : Measurable H := by + let π : (Ω × (ℕ → ℝ)) × X → + (Ω × (ℕ → ℝ)) × (Spin N × LabeledLeaf depth) := fun q => (q.1,q.2.1) + have hπ : Measurable π := measurable_fst.prodMk measurable_snd.fst + have hb := measurable_cavityProjectorHamiltonian_pullback + (N := N) (m := m) (depth := depth) (fun ω => (p ω).1) hp.fst c u + have hg := hb.comp hπ + apply Measurable.add hg + apply measurable_from_prod_countable_left + intro x + exact ((measurable_cavityBlockPotential A hA (fun ω => (p ω).2) hp.snd x.1.1 x.2).comp + measurable_fst).const_mul t + have hs : MeasurableSet {q : (Ω × (ℕ → ℝ)) × X | + 1 + ‖cavityFrameCoordinates (p q.1.1).2 q.2.1.1‖^2 ≤ D} := by + have hy : Measurable (fun q : (Ω × (ℕ → ℝ)) × X => + cavityFrameCoordinates (p q.1.1).2 q.2.1.1) := by + apply measurable_from_prod_countable_left + intro x + exact ((continuous_cavityFrameCoordinates x.1.1).measurable.comp hp.snd).comp + measurable_fst + exact measurableSet_le (measurable_const.add (hy.norm.pow_const 2)) measurable_const + have hG := measurable_cavityCutoffReplicaMean + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset)) H hH + (fun q => {x | 1 + ‖cavityFrameCoordinates (p q.1).2 x.1.1‖^2 ≤ D}) hs + (fun q => F q.1.1 q.2) (hF.comp (measurable_fst.fst.prodMk measurable_snd)) + exact hG.stronglyMeasurable.integral_prod_right'.measurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCoefficientError.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCoefficientError.lean new file mode 100644 index 0000000000000000000000000000000000000000..5abd538fac50310d0aebe1e3864177f4fe4a4411 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCoefficientError.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorCutoffLaw +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffEnergyComparison +import OAI.Probability.InvariantIsing.Cavity.CavityCoefficientProbability +import OAI.Probability.InvariantIsing.Cavity.CavityCoefficientError + +namespace OAI + +/-! A change of the small cavity blocks on a fixed spatial cutoff +controls the normalized observable without inverse-normalizer estimates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_projector_coefficient_error {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin N → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t : ℝ) {D : ℝ} (hD : 0 ≤ D) (A A' : CavityFactorBlocks d n) + (p : CavityProjectorFrame N m d) + (hp : p.1 = fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {M s : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) (hs : 0 < s) : + |restrictedProjectorCavityMean S hS Cset hCset T (fun a => t*lam a+2*perturbationScale N*v a) + u t D A F p - + restrictedProjectorCavityMean S hS Cset hCset T (fun a => t*lam a+2*perturbationScale N*v a) + u t D A' F p| ≤ + 4*(|t| *cavityFactorDeviation A A'*D)/s+M^2*s/2 := by + rw [restricted_projector_cavity_cutoff S hS Cset hCset g V T lam v u t D A p hp F, + restricted_projector_cavity_cutoff S hS Cset hCset g V T lam v u t D A' p hp F] + let ν := (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset : Measure (Spin n)) + let eig := diagonalPerturbedEigenvalues (fun j => lam (g j)) (cavitySpectralGroup g) v t + let E := fun σ : Spin N × Spin n => rotatedEnergy eig (matrixRotation V⁻¹) σ.1 + let Q := fun A : CavityFactorBlocks d n => fun σ : Spin N × Spin n => + t*cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 σ.1) σ.2 + let H := fun x : (Spin N × LabeledLeaf depth) × Spin n => E (x.1.1,x.2)+Q A (x.1.1,x.2) + let J := fun x : (Spin N × LabeledLeaf depth) × Spin n => E (x.1.1,x.2)+Q A' (x.1.1,x.2) + let C := fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityPerturbationCoefficients (matrixRotation V⁻¹) (cavitySpectralGroup g) u depth x.1 + let S := {x : (Spin N × LabeledLeaf depth) × Spin n | + 1+‖cavityFrameCoordinates p.2 x.1.1‖^2 ≤ D} + obtain ⟨L, hL⟩ := Finite.exists_le (fun x : Spin N × Spin n => |E x+Q A x|) + obtain ⟨L', hL'⟩ := Finite.exists_le (fun x : Spin N × Spin n => |E x+Q A' x|) + have hchange (x : (Spin N × LabeledLeaf depth) × Spin n) (hx : x ∈ S) : + |H x-J x| ≤ |t| *cavityFactorDeviation A A'*D := by + dsimp only [H, J, Q] + rw [add_sub_add_left_eq_sub, ← mul_sub, abs_mul, cavityLogFactor_sub] + have hg := cavity_logFactor_growth (A.1-A'.1) (A.2.1-A'.2.1) (A.2.2-A'.2.2) + (cavityFrameCoordinates p.2 x.1.1) x.2 + apply (mul_le_mul_of_nonneg_left hg (abs_nonneg t)).trans + simpa only [cavityFactorDeviation, cavityFactorSize, mul_assoc] using + mul_le_mul_of_nonneg_left hx (mul_nonneg (abs_nonneg t) (cavityFactorDeviation_nonneg A A')) + have hb := cavity_bounded_cutoff_energy_comparison ν H J + (fun x => hL (x.1.1,x.2)) (fun x => hL' (x.1.1,x.2)) C + (fun x => cavityPerturbationCoefficients_sq_le (matrixRotation V⁻¹) (cavitySpectralGroup g) + u hu x.1) S (mul_nonneg (mul_nonneg (abs_nonneg t) (cavityFactorDeviation_nonneg A A')) hD) + hchange F hM hF hs + have he z : (fun x : (Spin N × LabeledLeaf depth) × Spin n => + H x+cylinderField (C x) z) = fun x => + cavityRotationHamiltonian (matrixRotation V⁻¹) eig (cavitySpectralGroup g) u z x.1 + + t*cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2 := by + funext x + dsimp only [H, E, Q, C, cavityRotationHamiltonian] + ring + have he' z : (fun x : (Spin N × LabeledLeaf depth) × Spin n => + J x+cylinderField (C x) z) = fun x => + cavityRotationHamiltonian (matrixRotation V⁻¹) eig (cavitySpectralGroup g) u z x.1 + + t*cavityLogFactor A'.1 A'.2.1 A'.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2 := by + funext x + dsimp only [J, E, Q, C, cavityRotationHamiltonian] + ring + simp_rw [he, he'] at hb + exact hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCutoffLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCutoffLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..b369fb12922f5a3b8943910f2cb1da977ebd424c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorCutoffLaw.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorCavity +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorGibbsHaar + +namespace OAI + +/-! The projector realization identifies the full normalized cavity +cutoff law, including its extra finite spins and added potential. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped Matrix + +namespace InvariantIsing + +theorem restricted_projector_extra_cutoff {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin N → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (t : ℝ) + (W : (Spin N × LabeledLeaf depth) × Spin n → ℝ) + (s : Set ((Spin N × LabeledLeaf depth) × Spin n)) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) : + let ν : Measure ((Spin N × LabeledLeaf depth) × Spin n) := (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset) + (∫ z, cavityCutoffReplicaMean ν + (fun x => cavityProjectorHamiltonian + (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) + (fun a => t*lam a+2*perturbationScale N*v a) u z x.1 + W x) s F + ∂gaussianCoordinates) = + ∫ z, cavityCutoffReplicaMean ν + (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z x.1 + W x) s F ∂gaussianCoordinates := by + intro ν + let eig := diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t + let H := fun x : (Spin N × LabeledLeaf depth) × Spin n => + rotatedEnergy eig (matrixRotation V⁻¹) x.1.1 + W x + let A := fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityProjectorPerturbation (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) u x.1 + let C := fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityPerturbationCoefficients (matrixRotation V⁻¹) (cavitySpectralGroup g) u depth x.1 + have he z : (fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityProjectorHamiltonian (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) + (fun a => t*lam a+2*perturbationScale N*v a) u z x.1 + W x) = + fun x => H x+cylinderField (A x) z := by + funext x + unfold cavityProjectorHamiltonian + rw [cavityProjectorHamiltonian_energy] + dsimp only [H, A, eig] + ring + have hc z : (fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityRotationHamiltonian (matrixRotation V⁻¹) eig (cavitySpectralGroup g) u z x.1 + W x) = + fun x => H x+cylinderField (C x) z := by + funext x + dsimp only [cavityRotationHamiltonian, H, C] + ring + calc + _ = ∫ z, cavityCutoffReplicaMean ν (fun x => H x+cylinderField (A x) z) s F + ∂gaussianCoordinates := by + apply integral_congr_ae + exact ae_of_all _ fun z => congrArg (fun J => cavityCutoffReplicaMean ν J s F) (he z) + _ = ∫ z, cavityCutoffReplicaMean ν (fun x => H x+cylinderField (C x) z) s F + ∂gaussianCoordinates := cavity_cutoff_same_covariance ν H A C + (fun x y => cavityProjectorPerturbation_cross V (cavitySpectralGroup g) u x.1 y.1) s F + _ = _ := by + apply integral_congr_ae + exact ae_of_all _ fun z => congrArg (fun J => cavityCutoffReplicaMean ν J s F) (hc z).symm + +theorem restricted_projector_cavity_cutoff {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (g : Fin N → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) (A : CavityFactorBlocks d n) + (p : CavityProjectorFrame N m d) + (hp : p.1 = fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) : + restrictedProjectorCavityMean (N := N) (n := n) (m := m) (d := d) (depth := depth) + S hS Cset hCset T (fun a => t*lam a+2*perturbationScale N*v a) u t D A F p = + ∫ z, cavityCutoffReplicaMean + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior Cset hCset)) + (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun j => lam (g j)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z x.1 + + t*cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) + {x | 1 + ‖cavityFrameCoordinates p.2 x.1.1‖^2 ≤ D} F ∂gaussianCoordinates := by + unfold restrictedProjectorCavityMean + rw [hp] + exact restricted_projector_extra_cutoff (N := N) (n := n) (m := m) (depth := depth) + S hS Cset hCset g V T lam v u t _ _ F + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorHaarMean.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorHaarMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..f72433fcfad38fda7bf4d4fef55b7e6bceb978a7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorHaarMean.lean @@ -0,0 +1,105 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorCoefficientError +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorHaarMean + +namespace OAI + +/-! The normalized coefficient replacement for the actual independent +compression and base-Haar factors. The chosen spectral axes remain in +the same base Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Matrix + +namespace InvariantIsing + +lemma measurable_restrictedProjectorHaarMean {Ω : Type*} [MeasurableSpace Ω] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (k : Fin m → ℕ) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) (a₀ : Fin d → Fin m) + (ν : Measure (Orthogonal N)) [SFinite ν] (T : LabeledTree depth) (c : Fin m → ℝ) + (u : ℕ → ℝ) (t D : ℝ) (A : Ω → CavityFactorBlocks d n) (hA : Measurable A) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) : + Measurable (fun ω => ∫ V, restrictedProjectorCavityMean S hS Cset hCset T c u t D (A ω) F + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂ν) := by + let a : Ω × Orthogonal N → CavityFactorBlocks d n := fun p => A p.1 + let p : Ω × Orthogonal N → CavityProjectorFrame N m d := fun q => + cavityLabeledProjectorAction q.2 (cavityCanonicalProjectorFrame k e a₀) + have ha : Measurable a := hA.comp measurable_fst + have hp : Measurable p := (measurable_cavityCanonicalProjectorAction k e a₀).comp measurable_snd + have hF : Measurable (fun q : (Ω × Orthogonal N) × + (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) => F q.2) := + (measurable_of_countable F).comp measurable_snd + have hm := measurable_restrictedProjectorCavityMean (N := N) (n := n) (m := m) + (d := d) (depth := depth) S hS Cset hCset T c u t D a ha p hp (fun _ => F) hF + exact hm.stronglyMeasurable.integral_prod_right'.measurable + +lemma restrictedProjectorHaarMean_bound {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) (k : Fin m → ℕ) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) (a₀ : Fin d → Fin m) + (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] + (T : LabeledTree depth) (c : Fin m → ℝ) (u : ℕ → ℝ) (t D : ℝ) + (A : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) : + |∫ V, restrictedProjectorCavityMean S hS Cset hCset T c u t D A F + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂ν| ≤ M := by + have hb : ∀ᵐ V ∂ν, ‖restrictedProjectorCavityMean S hS Cset hCset T c u t D A F + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀))‖ ≤ M := + ae_of_all _ fun V => restrictedProjectorCavityMean_bound S hS Cset hCset T c u t D A F hM hF _ + simpa only [Real.norm_eq_abs, probReal_univ, mul_one] using + norm_integral_le_of_norm_le_const hb + +lemma restricted_projector_haar_coefficient_error {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (Cset : Finset (Spin n)) (hCset : Cset.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] + (T : LabeledTree depth) (lam v : Fin m → ℝ) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (t : ℝ) {D : ℝ} (hD : 0 ≤ D) + (A A' : CavityFactorBlocks d n) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) + {M s : ℝ} (hM : 0 ≤ M) (hF : ∀ σ, |F σ| ≤ M) (hs : 0 < s) : + |(∫ V, restrictedProjectorCavityMean S hS Cset hCset T + (fun a => t*lam a+2*perturbationScale N*v a) u t D A F + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂ν) - + ∫ V, restrictedProjectorCavityMean S hS Cset hCset T + (fun a => t*lam a+2*perturbationScale N*v a) u t D A' F + (cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀)) ∂ν| ≤ + 4*|t| *D*cavityFactorDeviation A A'/s+M^2*s/2 := by + let c := fun a => t*lam a+2*perturbationScale N*v a + let p := fun V : Orthogonal N => + cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + let g : Fin N → Fin m := fun i => Sum.elim (fun w => w.1) a₀ (e.symm i) + have hpV (V : Orthogonal N) : (p V).1 = + fun a => cavitySpectralProjector V (cavitySpectralGroup g a) := + cavityCanonicalProjectorFrame_action_fst k e a₀ V + have hp : Measurable p := measurable_cavityCanonicalProjectorAction k e a₀ + have hFs : Measurable (fun q : Orthogonal N × + (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) => F q.2) := + (measurable_of_countable F).comp measurable_snd + have hi (B : CavityFactorBlocks d n) : + Integrable (fun V => restrictedProjectorCavityMean S hS Cset hCset T c u t D B F (p V)) ν := + Integrable.of_bound + (measurable_restrictedProjectorCavityMean S hS Cset hCset T c u t D (fun _ => B) measurable_const + p hp (fun _ => F) hFs).aestronglyMeasurable M + (ae_of_all _ fun V => restrictedProjectorCavityMean_bound S hS Cset hCset T c u t D B F hM hF (p V)) + rw [← integral_sub (hi A) (hi A')] + have hb : ∀ᵐ V ∂ν, ‖restrictedProjectorCavityMean S hS Cset hCset T c u t D A F (p V) - + restrictedProjectorCavityMean S hS Cset hCset T c u t D A' F (p V)‖ ≤ + 4*|t| *D*cavityFactorDeviation A A'/s+M^2*s/2 := by + apply ae_of_all + intro V + have hh := restricted_projector_coefficient_error + (N := N) (n := n) (m := m) (d := d) (depth := depth) + S hS Cset hCset g V T lam v u hu t hD A A' (p V) (hpV V) F hM hF hs + rw [Real.norm_eq_abs] + convert hh using 1 + ring + simpa only [Real.norm_eq_abs, probReal_univ, mul_one] using + norm_integral_le_of_norm_le_const hb + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8da44e715145035bf1aa5676f5e0d7218d96f36 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorLog.lean @@ -0,0 +1,110 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorCutoffLaw +import OAI.Probability.InvariantIsing.Cavity.CavityLogCovariance +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior + +namespace OAI + +/-! The constrained capped logarithmic cavity factor in physical projector +coordinates, including the vanishing quadratic penalty. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def restrictedProjectorCappedLog {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) + (c : Fin m → ℝ) (u : ℕ → ℝ) (t cap δ : ℝ) (A : CavityFactorBlocks d n) + (p : CavityProjectorFrame N m d) : ℝ := + ∫ z, Real.log (∫ x, Real.exp + (min (t * cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) cap - + δ * (1 + ‖cavityFrameCoordinates p.2 x.1.1‖^2)) + ∂((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)).tilted (fun x => cavityProjectorHamiltonian p.1 c u z x.1)) + ∂gaussianCoordinates + +lemma measurable_restrictedProjectorCappedLog {Ω : Type*} [MeasurableSpace Ω] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (T : LabeledTree depth) (c : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (A : Ω → CavityFactorBlocks d n) (hA : Measurable A) + (p : Ω → CavityProjectorFrame N m d) (hp : Measurable p) : + Measurable (fun ω => restrictedProjectorCappedLog S hS C hC T c u t cap δ (A ω) (p ω)) := by + let X := (Spin N × LabeledLeaf depth) × Spin n + let H := fun q : (Ω × (ℕ → ℝ)) × X => + cavityProjectorHamiltonian (p q.1.1).1 c u q.1.2 q.2.1 + let W := fun q : (Ω × (ℕ → ℝ)) × X => Real.exp + (min (t*cavityLogFactor (A q.1.1).1 (A q.1.1).2.1 (A q.1.1).2.2 + (cavityFrameCoordinates (p q.1.1).2 q.2.1.1) q.2.2) cap - + δ*(1+‖cavityFrameCoordinates (p q.1.1).2 q.2.1.1‖^2)) + have hH : Measurable H := by + dsimp only [H] + let π : (Ω × (ℕ → ℝ)) × X → + (Ω × (ℕ → ℝ)) × (Spin N × LabeledLeaf depth) := fun q => (q.1,q.2.1) + have hπ : Measurable π := measurable_fst.prodMk measurable_snd.fst + have hb := measurable_cavityProjectorHamiltonian_pullback + (N := N) (m := m) (depth := depth) (fun ω => (p ω).1) hp.fst c u + have hh := hb.comp hπ + simpa only [Function.comp_def, π] using hh + have hW : Measurable W := by + apply measurable_from_prod_countable_left + intro x + have hy : Measurable (fun q : Ω × (ℕ → ℝ) => + cavityFrameCoordinates (p q.1).2 x.1.1) := + ((continuous_cavityFrameCoordinates x.1.1).measurable.comp hp.snd).comp measurable_fst + have hb : Measurable (fun q : Ω × (ℕ → ℝ) => + cavityLogFactor (A q.1).1 (A q.1).2.1 (A q.1).2.2 + (cavityFrameCoordinates (p q.1).2 x.1.1) x.2) := + (measurable_cavityBlockPotential A hA (fun ω => (p ω).2) hp.snd x.1.1 x.2).comp + measurable_fst + exact (((hb.const_mul t).min measurable_const).sub + ((measurable_const.add (hy.norm.pow_const 2)).const_mul δ)).exp + let ν : Measure X := (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC : Measure (Spin n)) + exact (measurable_random_tilted_integral (ν := fun _ : Ω × (ℕ → ℝ) => ν) + measurable_const hH hW).log.stronglyMeasurable + |>.integral_prod_right' |>.measurable + +theorem restricted_projector_capped_log {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (g : Fin N → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (t cap δ : ℝ) (A : CavityFactorBlocks d n) + (p : CavityProjectorFrame N m d) + (hp : p.1 = fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) : + restrictedProjectorCappedLog S hS C hC T (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ A p = + ∫ z, Real.log (∫ x, Real.exp + (min (t*cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) cap - + δ*(1+‖cavityFrameCoordinates p.2 x.1.1‖^2)) + ∂((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC)).tilted (fun x => cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z x.1)) ∂gaussianCoordinates := by + let ν := (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior C hC : Measure (Spin n)) + let H := fun x : (Spin N × LabeledLeaf depth) × Spin n => + rotatedEnergy (diagonalPerturbedEigenvalues (fun i => lam (g i)) + (cavitySpectralGroup g) v t) (matrixRotation V⁻¹) x.1.1 + let B := fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityProjectorPerturbation (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) u x.1 + let D := fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityPerturbationCoefficients (matrixRotation V⁻¹) (cavitySpectralGroup g) u depth x.1 + let W := fun x : (Spin N × LabeledLeaf depth) × Spin n => + min (t*cavityLogFactor A.1 A.2.1 A.2.2 (cavityFrameCoordinates p.2 x.1.1) x.2) cap - + δ*(1+‖cavityFrameCoordinates p.2 x.1.1‖^2) + have he z : (fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityProjectorHamiltonian p.1 (fun a => t*lam a+2*perturbationScale N*v a) u z x.1) = + fun x => H x+cylinderField (B x) z := by + funext x + rw [hp] + unfold cavityProjectorHamiltonian + rw [cavityProjectorHamiltonian_energy] + unfold restrictedProjectorCappedLog + simp_rw [he] + exact cavity_log_weight_same_covariance ν H W B D + (fun x y => cavityProjectorPerturbation_cross V (cavitySpectralGroup g) u x.1 y.1) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorLogAverage.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorLogAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..447183a9ab214897321d8e6ca89b5659b7592c05 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorLogAverage.lean @@ -0,0 +1,82 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalLogIntegrability +import OAI.Probability.InvariantIsing.Cavity.CavityProjectorJointLaw +import OAI.Probability.InvariantIsing.Cavity.CavityCompressionFactorBound + +namespace OAI + +/-! Haar averaging of the two logarithmic terms in the physical +cavity inequality. Integrability follows from the actual frame and +coefficient bounds. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_physical_log_average {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (g : Fin (N+n) → Fin m) (k : Fin m → ℕ) + (ek : ∀ a, {i : Fin (N+n) // g i=a} ≃ Fin (k a+n)) + (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (es : Fin (m*n) ≃ Fin (d+n)) (B₀ : Matrix (Fin (d+n)) (Fin d) ℝ) + (a₀ : Fin d → Fin m) (l r : Fin m → ℕ) + (hg : ∀ a i, g i=a ↔ l a ≤ i.val ∧ i.val cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams g U) + let p := fun U => cavityPhysicalLabeledProjectors g (cavityConcreteComplement es B₀) a₀ U + let q := fun V => cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + let c := fun a => t*lam a+2*perturbationScale N*v a + Integrable (fun U => restrictedProjectorCappedLog S hS C hC T c u t cap δ (A U) (p U) + + restrictedProjectorLogPartition S hS T c u (p U).1) μ ∧ + (∫ U, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A U) (p U) + + restrictedProjectorLogPartition S hS T c u (p U).1 ∂μ) = + (∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) ∂μ.prod ν) + + ∫ V, restrictedProjectorLogPartition S hS T c u (q V).1 ∂ν := by + intro A p q c + let f := fun z : (Fin m → Matrix (Fin n) (Fin n) ℝ) × CavityProjectorFrame N m d => + restrictedProjectorCappedLog S hS C hC T c u t cap δ + (cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ z.1) z.2 + + restrictedProjectorLogPartition S hS T c u z.2.1 + have hf : Measurable f := + (measurable_restrictedProjectorCappedLog S hS C hC T c u t cap δ _ + ((measurable_cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀).comp + measurable_fst) _ measurable_snd).add + (measurable_restrictedProjectorLogPartition S hS T c u _ measurable_snd.fst) + have hA : Measurable A := + (measurable_cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀).comp + (measurable_cavityCompressionGrams g) + have hi₁ := integrable_restricted_canonical_capped_log S hS C hC μ ν k e a₀ T lam v u hu t cap δ hcap + A hA (fun U => cavity_compression_factor_size_bound g es lam (fun j => lam (a₀ j)) B₀ U) + have hi₂ := (integrable_restricted_canonical_log_partition S hS k e a₀ ν T lam v u hu t).comp_snd μ + have hi : Integrable (fun z => f (cavityCompressionGrams g z.1,q z.2)) (μ.prod ν) := + hi₁.add hi₂ + let F := fun U => (cavityCompressionGrams g U,p U) + let G := fun z : Orthogonal (N+n) × Orthogonal N => (cavityCompressionGrams g z.1,q z.2) + have hF : Measurable F := (measurable_cavityCompressionGrams g).prodMk + (measurable_cavityPhysicalLabeledProjectors g _ (measurable_cavityConcreteComplement es B₀) a₀) + have hG : Measurable G := ((measurable_cavityCompressionGrams g).comp measurable_fst).prodMk + ((measurable_cavityCanonicalProjectorAction k e a₀).comp measurable_snd) + have hmap : μ.map F = (μ.prod ν).map G := + cavity_labeled_projector_joint_law g k ek e es B₀ a₀ l r hg hln hr μ ν + have him : Integrable f (μ.map F) := by + rw [hmap] + exact (integrable_map_measure hf.aestronglyMeasurable hG.aemeasurable).mpr hi + have hip := (integrable_map_measure hf.aestronglyMeasurable hF.aemeasurable).mp him + refine ⟨hip, ?_⟩ + have he := cavity_labeled_projector_joint_integral g k ek e es B₀ a₀ l r hg hln hr μ ν f hf + change (∫ U, f (F U) ∂μ) = _ + rw [he, integral_add hi₁ hi₂] + congr 1 + simpa only [probReal_univ, one_smul] using + integral_fun_snd (μ := μ) (ν := ν) (fun V => restrictedProjectorLogPartition S hS T c u (q V).1) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorPartition.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..26aff5e01fa596064f2b56a5b597932722552e5c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedProjectorPartition.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorLog + +namespace OAI + +/-! The base logarithmic partition function in the same physical +projector variables as the capped cavity factor. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def restrictedProjectorLogPartition {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : LabeledTree depth) + (c : Fin m → ℝ) (u : ℕ → ℝ) (Q : Fin m → Matrix (Fin N) (Fin N) ℝ) : ℝ := + ∫ z, Real.log (∫ x, Real.exp (cavityProjectorHamiltonian Q c u z x) + ∂labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + ∂gaussianCoordinates + +lemma measurable_restrictedProjectorLogPartition {Ω : Type*} [MeasurableSpace Ω] + {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : LabeledTree depth) (c : Fin m → ℝ) (u : ℕ → ℝ) + (Q : Ω → Fin m → Matrix (Fin N) (Fin N) ℝ) (hQ : Measurable Q) : + Measurable (fun ω => restrictedProjectorLogPartition S hS T c u (Q ω)) := by + have hH := (measurable_cavityProjectorHamiltonian_pullback + (N := N) (m := m) (depth := depth) Q hQ c u).exp + exact hH.stronglyMeasurable.integral_prod_right'.measurable.log.stronglyMeasurable + |>.integral_prod_right' |>.measurable + +theorem restricted_projector_log_partition {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (g : Fin N → Fin m) (V : Orthogonal N) (T : LabeledTree depth) + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (t : ℝ) : + restrictedProjectorLogPartition S hS T (fun a => t*lam a+2*perturbationScale N*v a) u + (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) = + ∫ z, Real.log (∫ x, Real.exp + (cavityRotationHamiltonian (matrixRotation V⁻¹) + (diagonalPerturbedEigenvalues (fun i => lam (g i)) (cavitySpectralGroup g) v t) + (cavitySpectralGroup g) u z x) + ∂labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + ∂gaussianCoordinates := by + let H := fun x : Spin N × LabeledLeaf depth => + rotatedEnergy (diagonalPerturbedEigenvalues (fun i => lam (g i)) + (cavitySpectralGroup g) v t) (matrixRotation V⁻¹) x.1 + let A := fun x : Spin N × LabeledLeaf depth => + cavityProjectorPerturbation (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) u x + let C := fun x : Spin N × LabeledLeaf depth => + cavityPerturbationCoefficients (matrixRotation V⁻¹) (cavitySpectralGroup g) u depth x + have he z : (fun x : Spin N × LabeledLeaf depth => cavityProjectorHamiltonian + (fun a => cavitySpectralProjector V (cavitySpectralGroup g a)) + (fun a => t*lam a+2*perturbationScale N*v a) u z x) = + fun x => H x+cylinderField (A x) z := by + funext x + unfold cavityProjectorHamiltonian + rw [cavityProjectorHamiltonian_energy] + unfold restrictedProjectorLogPartition + simp_rw [he] + exact cavity_log_partition_same_covariance _ H A C + (fun x y => cavityProjectorPerturbation_cross V (cavitySpectralGroup g) u x y) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomHaarLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomHaarLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..def1b45f377e1bf161ad319fb48422008a88a23a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomHaarLog.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalHaarLog + +namespace OAI + +/-! The canonical logarithm with independent random compression +coefficients. The original base disorder stays in its own coordinates. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def restrictedRandomHaarLog {Z : Type*} {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (A : Z → CavityFactorBlocks d n) + (p : (Z × ((Orthogonal N × LabeledTree depth) × (ℕ → ℝ))) × + ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) : ℝ := + restrictedCanonicalHaarLog S hS C hC k e a₀ hk lam v u t cap δ (A p.1.1) (p.1.2,p.2) + +lemma measurable_restrictedRandomHaarLog {Z : Type*} [MeasurableSpace Z] {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (A : Z → CavityFactorBlocks d n) (hA : Measurable A) : + Measurable (restrictedRandomHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ A) := by + let E := cavityBaseGroupEquiv k e a₀ + let dims := cavityBaseGroupDimension k a₀ + let Ω := Z × ((Orthogonal N × LabeledTree depth) × (ℕ → ℝ)) + let eig := diagonalPerturbedEigenvalues (fun i => lam (E.symm i).1) + (cavitySpectralGroup (fun i => (E.symm i).1)) v t + let ν : Ω → Measure (Spin N × LabeledLeaf depth) := fun z => + restrictedRotationProbability S hS eig (cavitySpectralGroup (fun i => (E.symm i).1)) u z.2 + let vectors := fun z : Ω => cavityRotationVectors (depth := depth) dims E z.2 + have hmν : Measurable ν := (measurable_restrictedRotationProbability S hS _ _ _).comp measurable_snd + have hmv x : Measurable (fun z a => vectors z a x) := + (measurable_cavityRotationVectors dims E x).comp measurable_snd + exact measurable_restrictedHaarLogObservable C hC ν hmν (fun j => (a₀ j,j)) vectors hmv + (cavityCanonicalGroupFrame k e a₀ hk) (fun z => A z.1) (hA.comp measurable_fst) t cap δ + +lemma restrictedRandomHaarLog_bound {Z : Type*} {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (hcap : 0 ≤ cap) (A : Z → CavityFactorBlocks d n) {D : ℝ} + (hA : ∀ z, cavityFactorSize (A z).1 (A z).2.1 (A z).2.2 ≤ D) + (p : (Z × ((Orthogonal N × LabeledTree depth) × (ℕ → ℝ))) × + ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) : + |restrictedRandomHaarLog S hS C hC k e a₀ hk lam v u t cap δ A p| ≤ (|t| *D+|δ|)*(1+N) := by + have h := restrictedCanonicalHaarLog_bound S hS C hC k e a₀ hk lam v u t cap δ hcap (A p.1.1) (p.1.2,p.2) + apply h.trans + exact mul_le_mul_of_nonneg_right + (add_le_add (mul_le_mul_of_nonneg_left (hA p.1.1) (abs_nonneg t)) (le_refl |δ|)) (by positivity) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomPressureIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomPressureIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..f576ec05e7895bcb6d93db946ffaa670fe53d42e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomPressureIncrement.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreePressureIncrement +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRandomTreeLogLaw + +namespace OAI + +/-! The full physical pressure increment dominates the random-block +fresh-Haar logarithm on the exact probability space used for its limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_random_pressure_increment {N n m d depth : ℕ} (hN : 0 cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams g U) + let δ := cavityDeterministicRate n m (2*(2*n+1)) N+ + 2*cavityCovarianceRate n (2*n+1) N + let I₀ := cavityBaseGroup k e a₀ + let eig₀ := diagonalPerturbedEigenvalues + (fun i => lam (Sum.elim (fun w => w.1) a₀ (e.symm i))) I₀ v t + let I := cavitySpectralGroup g + let eig := diagonalPerturbedEigenvalues (fun i => lam (g i)) I v t + (∫ p, restrictedRandomHaarLog S hS C hC k e a₀ hk lam v u t cap δ A p + ∂(μ.prod ((ν.prod θ).prod gaussianCoordinates)).prod η) ≤ + (∫ z, restrictedRotationLogMean (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) z.2 eig I u z.1 ∂μ.prod θ) - + ∫ z, restrictedRotationLogMean S hS z.2 eig₀ I₀ u z.1 ∂ν.prod θ := by + intro A δ I₀ eig₀ I eig + have h := restricted_tree_pressure_capped_increment hN S hS C hC g k ek e es B₀ a₀ l r hg hln hr + μ ν θ lam v hv u hu t cap hcap + have hmA : Measurable A := + (measurable_cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀).comp + (measurable_cavityCompressionGrams g) + have he := restricted_random_tree_log_law S hS C hC μ k e a₀ hk ν θ η lam v u hu t cap δ hcap + A hmA (fun U => cavity_compression_factor_size_bound g es lam (fun j => lam (a₀ j)) B₀ U) + exact he.symm.trans_le h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomTreeLogLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomTreeLogLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..9313366ac99780a703d635888cfd7b0b8102fc9c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRandomTreeLogLaw.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRandomHaarLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalTreeLogLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeLogIntegrability +import OAI.Probability.InvariantIsing.Cavity.CavityExtraLogAverage + +namespace OAI + +/-! The random-compression version of the canonical logarithmic law. +The compression variable is independent of the base disorder and the +fresh spectral-group rotations. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_random_tree_log_law {Z : Type*} [MeasurableSpace Z] {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) + (P : Measure Z) [IsProbabilityMeasure P] + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (hk : ∀ a, d ≤ k a) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulRightInvariant] + (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (η : Measure ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a))) + [IsProbabilityMeasure η] + (lam v : Fin m → ℝ) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (t cap δ : ℝ) (hcap : 0 ≤ cap) + (A : Z → CavityFactorBlocks d n) (hA : Measurable A) {D : ℝ} + (hAb : ∀ z, cavityFactorSize (A z).1 (A z).2.1 (A z).2.2 ≤ D) : + (∫ T, ∫ z, restrictedProjectorCappedLog S hS C hC T + (fun a => t*lam a+2*perturbationScale N*v a) u t cap δ (A z.1) + (cavityLabeledProjectorAction z.2 (cavityCanonicalProjectorFrame k e a₀)) ∂P.prod μ ∂θ) = + ∫ p, restrictedRandomHaarLog S hS C hC k e a₀ hk lam v u t cap δ A p + ∂(P.prod ((μ.prod θ).prod gaussianCoordinates)).prod η := by + let f : LabeledTree depth × (Z × Orthogonal N) → ℝ := fun z : LabeledTree depth × (Z × Orthogonal N) => + restrictedProjectorCappedLog S hS C hC z.1 (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ (A z.2.1) + (cavityLabeledProjectorAction z.2.2 (cavityCanonicalProjectorFrame k e a₀)) + have hp : Measurable (fun z : LabeledTree depth × (Z × Orthogonal N) => + cavityLabeledProjectorAction z.2.2 (cavityCanonicalProjectorFrame k e a₀)) := + (measurable_cavityCanonicalProjectorAction k e a₀).comp measurable_snd.snd + have hf : Measurable f := measurable_restrictedProjectorCappedLog_tree S hS C hC Prod.fst measurable_fst + (fun a => t*lam a+2*perturbationScale N*v a) u t cap δ + (fun z : LabeledTree depth × (Z × Orthogonal N) => A z.2.1) + (hA.comp measurable_snd.fst) _ hp + have hb z : |f z| ≤ (|t| *D+|δ|)*(1+N) := + restricted_canonical_capped_log_bound S hS C hC k e a₀ z.2.2 z.1 lam v u hu t cap δ hcap + (A z.2.1) (hAb z.2.1) + have hcycle := cavity_bounded_three_integral_cycle θ P μ f hf hb + let F : (Z × ((Orthogonal N × LabeledTree depth) × (ℕ → ℝ))) × + ((a : Fin m) → Orthogonal (cavityBaseGroupDimension k a₀ a)) → ℝ := restrictedRandomHaarLog (depth := depth) S hS C hC k e a₀ hk lam v u t cap δ A + have hF : Measurable F := measurable_restrictedRandomHaarLog S hS C hC k e a₀ hk lam v u t cap δ A hA + have hFb p : |F p| ≤ (|t| *D+|δ|)*(1+N) := + restrictedRandomHaarLog_bound S hS C hC k e a₀ hk lam v u t cap δ hcap A hAb p + have he := cavity_bounded_extra_product_integral P ((μ.prod θ).prod gaussianCoordinates) + η F hF hFb + calc + _ = ∫ z, ∫ T, ∫ V, f (T,(z,V)) ∂μ ∂θ ∂P := hcycle + _ = ∫ z, ∫ p, F ((z,p.1),p.2) + ∂(((μ.prod θ).prod gaussianCoordinates).prod η) ∂P := by + apply integral_congr_ae + apply ae_of_all + intro z + exact restricted_canonical_tree_log_law S hS C hC k e a₀ hk μ η θ lam v u hu t cap δ hcap (A z) + _ = _ := he.symm + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e077e0c9efe89d666a9b984a02c6cd5c23fbc09e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootEvaluation.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedEndpointTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockOverlap + +namespace OAI + +/-! Root averaging for the constrained published endpoint law, preserving +its actual shared-prefix spin means. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal + +namespace InvariantIsing + +lemma field_common_level_root_integral {N : ℕ} (h : FieldStep) + (μ : Measure (Fin N → ℝ)) [IsProbabilityMeasure μ] + (a : Fin (h.depth + 1) → (Fin N → ℝ) → ℝ) + (ha : ∀ i, Measurable (a i)) {C : ℝ} (hb : ∀ i z, |a i z| ≤ C) : + (∫ z, ∫ α, a (fieldCommonLevel h α) z + ∂cascadeReplicaLaw h.depth (chainExponent h.cut) ∂μ) = + ∫ s, ∫ z, a (fieldLevelIndex h s) z ∂μ ∂pathMeasure := by + let ν := cascadeReplicaLaw h.depth (chainExponent h.cut) + have ham' : Measurable (fun p : Fin (h.depth + 1) × (Fin N → ℝ) => a p.1 p.2) := + measurable_from_prod_countable_right ha + have hp : Measurable (fun p : (Fin N → ℝ) × (ℕ → LabeledLeaf h.depth) => + (fieldCommonLevel h p.2, p.1)) := + ((measurable_fieldCommonLevel h).comp measurable_snd).prodMk measurable_fst + have hai : Integrable (fun p : (Fin N → ℝ) × (ℕ → LabeledLeaf h.depth) => + a (fieldCommonLevel h p.2) p.1) (μ.prod ν) := by + apply Integrable.of_bound (ham'.comp hp).aestronglyMeasurable C + exact Filter.Eventually.of_forall (fun p => by simpa only [Real.norm_eq_abs, Function.comp_apply] using hb (fieldCommonLevel h p.2) p.1) + rw [integral_integral_swap hai] + exact fieldCommonLevel_integral h (fun i => ∫ z, a i z ∂μ) + +theorem restricted_field_published_rooted_coordinate_test + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + (∫ z, restrictedFieldTiltedPairMean S h z (restrictedEndpointCoordinateTest S h q Φ j) + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) = + ∫ s, Φ (q (fieldLevelIndex h s)) * + (∫ z, restrictedPairCoordinateMean hN S hS h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h s) j z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) + ∂pathMeasure := by + let a := fun i z => Φ (q i) * restrictedPairCoordinateMean hN S hS h.depth + (chainExponent h.cut) (fieldStepVariance h) + (fun l hl => ((chainExponent_admissible h.ordered_cut h.first h.last).1 l hl).1) i j z + have ha : ∀ i, Measurable (a i) := fun i => + (measurable_restrictedPairCoordinateMean hN S hS _ _ _ _ i j).const_mul _ + have hb : ∀ i z, |a i z| ≤ C := by + intro i z + rw [show a i z = Φ (q i) * _ from rfl, abs_mul] + exact (mul_le_mul_of_nonneg_left (restrictedPairCoordinateMean_bound hN S hS _ _ _ _ i j z) + (abs_nonneg _)).trans (by simpa only [mul_one] using hΦ _) + simp_rw [restricted_field_published_coordinate_test hpub hN S hS h q Φ j hΦ] + rw [field_common_level_root_integral h _ a ha hb] + simp only [a, integral_const_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootShift.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..74c9cd790fd8d19274a67b3715845bd1807ddad4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootShift.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedKernelShift +import OAI.Probability.InvariantIsing.Magnetic.MagneticPairConvergence + +namespace OAI + +/-! Removal of the optimizing group biases from the actual shared-root +constrained spin-pair law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped NNReal BigOperators Topology + +namespace InvariantIsing + +lemma kernel_gaussian_root_shift {N : ℕ} {X : Type*} [MeasurableSpace X] + (κ : Kernel (Fin N → ℝ) X) [IsMarkovKernel κ] (v : ℝ≥0) (d : Fin N → ℝ) + (hκ : ∀ z, κ (z + d) = κ z) : + κ ∘ₘ Measure.pi (fun j => gaussianReal (d j) v) = + κ ∘ₘ (vectorGaussianLaw N v : Measure (Fin N → ℝ)) := by + ext T hT + rw [Measure.bind_apply hT κ.aemeasurable, Measure.bind_apply hT κ.aemeasurable, + ← (vectorGaussian_shift v d).map_eq, lintegral_map (g := fun w : Fin N → ℝ => d + w) (κ.measurable_coe hT) + (measurable_const.add measurable_id)] + apply lintegral_congr + intro z + rw [add_comm d z, hκ] + +lemma restrictedLevelSpinPair_group_bias {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (bias : A → ℝ) + (h : FieldStep) (i : Fin (h.depth + 1)) : + restrictedLevelSpinPair hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + h (fun j => bias (group j)) i = + restrictedLevelSpinPair hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + h (fun _ => 0) i := by + unfold restrictedLevelSpinPair + exact kernel_gaussian_root_shift _ _ (fun j => bias (group j)) + (fun z => restrictedPairSpinKernel_group_shift hN group k hk bias _ _ _ _ i z) + +lemma restrictedBlockPairMean_group_bias {N : ℕ} (hN : 0 < N) + {A : Type*} [Fintype A] [DecidableEq A] (group : Fin N → A) (k : A → ℕ) + (hk : ∀ a, k a ≤ spinGroupSize group a) (bias : A → ℝ) + (h : FieldStep) (i : Fin (h.depth + 1)) : + restrictedBlockPairMean hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + h (fun j => bias (group j)) i = + restrictedBlockPairMean hN (spinGroupSlice group k) (spinGroupSlice_nonempty group k hk) + h (fun _ => 0) i := by + unfold restrictedBlockPairMean + rw [restrictedLevelSpinPair_group_bias hN group k hk bias] + +theorem magneticBlockPairGap_unbiased_tendsto {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ n, 0 < N n) (hNlim : Tendsto N atTop atTop) + (group : ∀ n, Fin (N n) → A) (k : ℕ → A → ℕ) + (hk : ∀ n a, k n a ≤ spinGroupSize (group n) a) (m : ℕ → A → ℝ) + {r H : ℝ} (hr : r < 1) (hm : ∀ n a, |m n a| ≤ r) + (hc : ∀ n a, (k n a : ℝ) = spinGroupSize (group n) a * ((1 + m n a) / 2)) + (h : ℕ → FieldStep) (hH : ∀ n, (h n).height (Fin.last (h n).depth) ≤ H) + (i : ∀ n, Fin ((h n).depth + 1)) : + Tendsto (fun n => |restrictedBlockPairMean (hN n) (spinGroupSlice (group n) (k n)) + (spinGroupSlice_nonempty (group n) (k n) (hk n)) (h n) (fun _ => 0) (i n) - + (N n : ℝ)⁻¹ * ∑ j, magneticFieldLevel (h n) (m n (group n j)) (i n)|) + atTop (𝓝 0) := by + have he := magneticBlockPairGap_tendsto N hN hNlim group k hk m hr hm hc h hH i + have hEq (n : ℕ) := restrictedBlockPairMean_group_bias (hN n) (group n) (k n) (hk n) + (fun a => magneticBias (h n) (m n a)) (h n) (i n) + simp_rw [hEq] at he + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootedBlock.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootedBlock.lean new file mode 100644 index 0000000000000000000000000000000000000000..36c76e4a734b13391ea86377d0d0c07dd13da359 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRootedBlock.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockSpinEvaluation +import OAI.Probability.InvariantIsing.Cavity.CavityRootedTestMean + +namespace OAI + +/-! Coordinate averaging for the actual rooted constrained block spin test. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators NNReal + +namespace InvariantIsing + +def cavityRootedBlockDepthTest {d k n : ℕ} (a : ℕ → ℝ) + (σ : ℕ → CavitySpinState d k n) : ℝ := + (k : ℝ)⁻¹ * ∑ j, cavityRootedSpinDepthTest a j σ + +lemma cavityRootedBlockDepthTest_eq {d k n : ℕ} (a : ℕ → ℝ) + (σ : ℕ → CavitySpinState d k n) : + cavityRootedBlockDepthTest a σ = + a (cavityCommonMarkDepth n (σ 0).1.2.1 (σ 1).1.2.1) * + ((k : ℝ)⁻¹ * ∑ j, spinValue ((σ 0).2 j) * spinValue ((σ 1).2 j)) := by + simp only [cavityRootedBlockDepthTest, cavityRootedSpinDepthTest, ← Finset.mul_sum] + ring + +lemma integral_cavityRootedBlockDepthTest {d k n : ℕ} + (μ : Measure (ℕ → CavitySpinState d k n)) [IsProbabilityMeasure μ] + (a : ℕ → ℝ) {C : ℝ} (ha : ∀ i, |a i| ≤ C) : + (∫ σ, cavityRootedBlockDepthTest a σ ∂μ) = + (k : ℝ)⁻¹ * ∑ j, ∫ σ, cavityRootedSpinDepthTest a j σ ∂μ := by + unfold cavityRootedBlockDepthTest + rw [integral_const_mul, integral_finsetSum] + intro j _ + exact integrable_of_measurable_abs_le (measurable_cavityRootedSpinDepthTest a j) + (cavityRootedSpinDepthTest_abs_le a j ha) + +lemma restricted_rooted_block_evaluation {d k : ℕ} (hk : 0 < k) + (T : Finset (Spin k)) (hT : T.Nonempty) (h : FieldStep) + (μ : Measure (ℕ → CavitySpinState d k h.depth)) [IsProbabilityMeasure μ] + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) + (hcoord : ∀ j : Fin k, + (∫ σ, cavityRootedSpinDepthTest (fun i => Φ (q (fieldDepthLevel h i))) j σ ∂μ) = + ∫ t, Φ (q (fieldLevelIndex h t)) * + (∫ z, restrictedPairCoordinateMean hk T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h t) j z + ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) ∂pathMeasure) : + (∫ σ, cavityRootedBlockDepthTest (fun i => Φ (q (fieldDepthLevel h i))) σ ∂μ) = + ∫ t, Φ (q (fieldLevelIndex h t)) * restrictedBlockOverlapPath hk T hT h t ∂pathMeasure := by + rw [integral_cavityRootedBlockDepthTest μ _ (fun i => hΦ _)] + simp_rw [hcoord] + let a := fun (j : Fin k) (i : Fin (h.depth + 1)) => Φ (q i) * + (∫ z, restrictedPairCoordinateMean hk T hT h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun l hl => ((chainExponent_admissible h.ordered_cut h.first h.last).1 l hl).1) + i j z ∂(vectorGaussianLaw k (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure _)) + change (k : ℝ)⁻¹ * (∑ j, ∫ s, a j (fieldLevelIndex h s) ∂pathMeasure) = _ + have hi (j : Fin k) : Integrable (fun s => a j (fieldLevelIndex h s)) pathMeasure := + integrable_fieldLevelIndex h (a j) + rw [← integral_finsetSum _ (fun j _ => hi j), ← integral_const_mul] + apply integral_congr_ae + apply Filter.Eventually.of_forall + intro s + dsimp only [a] + change _ = Φ (q (fieldLevelIndex h s)) * + restrictedBlockPairMean hk T hT h (fun _ => 0) (fieldLevelIndex h s) + rw [restrictedBlockPairMean_eq_average, ← Finset.mul_sum] + simp only [vectorGaussianLaw, ProbabilityMeasure.coe_mk] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationArray.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationArray.lean new file mode 100644 index 0000000000000000000000000000000000000000..012e0815d1f82c930fb9f9b9413082aa9a14558d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationArray.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityRotationArray +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability + +namespace OAI + +/-! The spectral array sampled from the actual constrained base Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def restrictedRotationArrayLaw {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (ρ : Measure (LabeledTree depth)) [IsProbabilityMeasure ρ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + ProbabilityMeasure (SpectralArray (m+1)) := + ⟨(disorderReplicaLaw ((μ.prod ρ).prod gaussianCoordinates) + (restrictedRotationProbability S hS eig I u) (measurable_restrictedRotationProbability S hS eig I u)).map + (cavitySampledEntryArray (cavityRotationEntry I)), + (Measure.isProbabilityMeasure_map_iff + (measurable_cavitySampledEntryArray (cavityRotationEntry I) + (measurable_cavityRotationEntry I)).aemeasurable).mpr inferInstance⟩ + +lemma restrictedRotationArrayLaw_gram {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (ρ : Measure (LabeledTree depth)) [IsProbabilityMeasure ρ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + ∀ᵐ x ∂(restrictedRotationArrayLaw S hS μ ρ eig I u : Measure (SpectralArray (m+1))), + SpectralGram x := by + rw [restrictedRotationArrayLaw] + apply (ae_map_iff (measurable_cavitySampledEntryArray (cavityRotationEntry I) + (measurable_cavityRotationEntry I)).aemeasurable + (isClosed_spectralGram (m+1)).measurableSet).mpr + exact ae_of_all _ (cavityRotationEntry_gram I) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationCutoffWeight.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationCutoffWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ae9e536fdf23f7f4ce1ae84f4ecb683f9981fd1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationCutoffWeight.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityBaseCutoffFactor +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability + +namespace OAI + +/-! A bounded spin-only cavity potential factors over the actual +perturbed base Gibbs law, retaining the spatial indicator. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_rotation_cutoff_weight {N n m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (R : Finset (Spin n)) (hR : R.Nonempty) + (V : Rotation N) (T : LabeledTree depth) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (W : Spin N × Spin n → ℝ) + (s : Set ((Spin N × LabeledLeaf depth) × Spin n)) + (F : (Fin 2 → (Spin N × LabeledLeaf depth) × Spin n) → ℝ) : + (∫ z, cavityCutoffReplicaMean + ((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).prod + (restrictedSpinPrior R hR)) + (fun x => cavityRotationHamiltonian V eig I u z x.1 + W (x.1.1,x.2)) s F + ∂gaussianCoordinates) = + ∫ z, cavityWeightedReplicaMean + (((labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted + (cavityRotationHamiltonian V eig I u z)).prod (restrictedSpinPrior R hR)) + (s.indicator (fun x => Real.exp (W (x.1.1,x.2)))) F ∂gaussianCoordinates := by + let μ := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + let ν := μ.prod (restrictedSpinPrior R hR : Measure (Spin n)) + let H : (Spin N × LabeledLeaf depth) × Spin n → ℝ := fun x => + rotatedEnergy eig V x.1.1+W (x.1.1,x.2) + let C : (Spin N × LabeledLeaf depth) × Spin n → ℕ →₀ ℝ := fun x => + cavityPerturbationCoefficients V I u depth x.1 + obtain ⟨M,hM⟩ := Finite.exists_le (fun x : Spin N × Spin n => |rotatedEnergy eig V x.1+W x|) + have hfull : ∀ᵐ z ∂gaussianCoordinates, + Integrable (fun x => Real.exp (H x+cylinderField (C x) z)) ν := + cylinder_partition_exp_integrable_ae ν H + (cavity_bounded_base_exp_integrable ν H (fun x => hM (x.1.1,x.2))) C + (fun x => cavityPerturbationCoefficients_sq_le V I u hu x.1) + apply integral_congr_ae + filter_upwards [hfull, restricted_rotation_exp_integrable_ae S hS V T eig I u hu] with z hz hj + have he : (fun x => H x+cylinderField (C x) z) = + fun x : (Spin N × LabeledLeaf depth) × Spin n => + cavityRotationHamiltonian V eig I u z x.1+W (x.1.1,x.2) := by + funext x + dsimp only [H,C,cavityRotationHamiltonian] + ring + have hz' : Integrable (fun x : (Spin N × LabeledLeaf depth) × Spin n => + Real.exp (cavityRotationHamiltonian V eig I u z x.1+W (x.1.1,x.2))) ν := + hz.congr (ae_of_all _ fun x => congrArg Real.exp (congrFun he x)) + exact cavity_base_cutoff_indicator μ (restrictedSpinPrior R hR) + (cavityRotationHamiltonian V eig I u z) (fun x => W (x.1.1,x.2)) hj hz' s F + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationLogMean.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationLogMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b6e9a0730b39e52477279db04073a87f20a8144 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationLogMean.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityLogMeanBound +import OAI.Probability.InvariantIsing.Cavity.CavityRotationMeasurability +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior + +namespace OAI + +/-! The actual finite-volume expected logarithmic partition function is +measurable and integrable in the orthogonal disorder. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +def restrictedRotationLogMean {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : LabeledTree depth) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (V : Orthogonal N) : ℝ := + ∫ z, Real.log (∫ x, Real.exp + (cavityRotationHamiltonian (matrixRotation V⁻¹) eig I u z x) + ∂labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + ∂gaussianCoordinates + +lemma measurable_restrictedRotationLogMean {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : LabeledTree depth) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + Measurable (restrictedRotationLogMean S hS T eig I u) := + (measurable_cavityRotationHamiltonian eig I u).exp.stronglyMeasurable + |>.integral_prod_right' |>.measurable.log.stronglyMeasurable + |>.integral_prod_right' |>.measurable + +lemma restrictedRotationLogMean_bound {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : LabeledTree depth) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (V : Orthogonal N) : + |restrictedRotationLogMean S hS T eig I u V| ≤ + 1+2*((∑ i, |eig i|)*N/2)^2+8*Real.exp (2*(4*(N*perturbationScale N^2))) := by + apply cavity_bounded_base_log_mean_bound + · intro x + exact abs_rotatedEnergy_le eig (matrixRotation V⁻¹) (∑ i, |eig i|) + (fun i => Finset.single_le_sum (fun j _ => abs_nonneg (eig j)) (Finset.mem_univ i)) x.1 + · exact cavityPerturbationCoefficients_sq_le (matrixRotation V⁻¹) I u hu + +lemma integrable_restrictedRotationLogMean {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] (T : LabeledTree depth) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) : + Integrable (restrictedRotationLogMean S hS T eig I u) μ := by + apply Integrable.of_bound (measurable_restrictedRotationLogMean S hS T eig I u).aestronglyMeasurable + (1+2*((∑ i, |eig i|)*N/2)^2+8*Real.exp (2*(4*(N*perturbationScale N^2)))) + exact ae_of_all _ fun V => by + rw [Real.norm_eq_abs] + exact restrictedRotationLogMean_bound S hS T eig I u hu V + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationProbability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationProbability.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cb56a51d17cb39a6180436bbd61087c43ee8537 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedRotationProbability.lean @@ -0,0 +1,80 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityRotationProbability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior + +namespace OAI + +/-! The actual constrained spin/leaf Gibbs probability, with all Haar, +Gaussian and finite-tree disorder retained. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def restrictedRotationProbability {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (p : (Orthogonal N × LabeledTree depth) × (ℕ → ℝ)) : + Measure (Spin N × LabeledLeaf depth) := + gibbsProbability (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) p.1.2) + (cavityRotationHamiltonian (matrixRotation p.1.1⁻¹) eig I u p.2) + +instance restrictedRotationProbability_probability {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (p : (Orthogonal N × LabeledTree depth) × (ℕ → ℝ)) : + IsProbabilityMeasure (restrictedRotationProbability S hS eig I u p) := + gibbsProbability_probability _ _ + +lemma measurable_restrictedRotationProbability {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + Measurable (restrictedRotationProbability (depth := depth) S hS eig I u) := by + let Ω := (Orthogonal N × LabeledTree depth) × (ℕ → ℝ) + let X := Spin N × LabeledLeaf depth + let ν : Ω → Measure X := fun p => + labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) p.1.2 + let H : Ω × X → ℝ := fun p => + cavityRotationHamiltonian (matrixRotation p.1.1.1⁻¹) eig I u p.1.2 p.2 + let (p : Ω) : IsProbabilityMeasure (ν p) := by + change IsProbabilityMeasure (labeledSpinReference depth + (restrictedSpinPrior S hS : Measure (Spin N)) p.1.2) + infer_instance + have hν : Measurable ν := + (measurable_labeledSpinReference_general depth + (restrictedSpinPrior S hS : Measure (Spin N))).comp measurable_fst.snd + have hH : Measurable H := measurable_cavityRotationProbabilityHamiltonian eig I u + exact measurable_gibbsProbability (ν := ν) (H := H) hν hH + +lemma restricted_rotation_exp_integrable_ae {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (V : Rotation N) (T : LabeledTree depth) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) : + ∀ᵐ z ∂gaussianCoordinates, Integrable + (fun x => Real.exp (cavityRotationHamiltonian V eig I u z x)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) := by + let ν := labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T + exact cylinder_partition_exp_integrable_ae ν (fun x => rotatedEnergy eig V x.1) + (cavity_bounded_base_exp_integrable ν _ (fun x => + Finset.single_le_sum (f := fun σ : Spin N => |rotatedEnergy eig V σ|) + (fun _ _ => abs_nonneg _) (Finset.mem_univ x.1))) + (cavityPerturbationCoefficients V I u depth) + (cavityPerturbationCoefficients_sq_le V I u hu) + +lemma restrictedRotationProbability_eq_tilted_ae {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) (V : Orthogonal N) (T : LabeledTree depth) : + ∀ᵐ z ∂gaussianCoordinates, restrictedRotationProbability S hS eig I u ((V,T),z) = + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T).tilted + (cavityRotationHamiltonian (matrixRotation V⁻¹) eig I u z) := by + filter_upwards [restricted_rotation_exp_integrable_ae S hS (matrixRotation V⁻¹) T eig I u hu] + with z hz + exact gibbsProbability_eq_tilted _ _ hz + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpecialCutoffError.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpecialCutoffError.lean new file mode 100644 index 0000000000000000000000000000000000000000..63988b4365da288a87f7697aeb682b9299ecbd0e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpecialCutoffError.lean @@ -0,0 +1,33 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalCutoff +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffTightness + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Classical Matrix MatrixOrder Matrix.Norms.L2Operator +namespace InvariantIsing + +theorem restricted_full_special_cutoff_error {N n m d depth : ℕ} + (S : Finset (Spin (N+n))) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal (N + n))) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin (N + n) → ℝ) (g : Fin (N + n) → Fin m) + (u : ℕ → ℝ) (hu : ∀ j, |u j| ≤ 2) + (B : SpecialOrthogonal (N + n) → Matrix (Fin (m * n)) (Fin d) ℝ) + (hmB : Measurable B) (R : ℝ) + (F : SpecialOrthogonal (N + n) → (Fin 2 → Spin (N + n) × LabeledLeaf depth) → ℝ) + (hmF : Measurable (Function.uncurry F)) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ U σ, |F U σ| ≤ M) : + |restrictedCavityFullCutoffDisorderTest S hS μ T eig (cavitySpectralGroup g) u + (cavitySpecialCutoff g B R) F - restrictedCavityFullDisorderTest S hS μ T eig (cavitySpectralGroup g) u F| ≤ + 4 * M * restrictedCavityFullDisorderTest S hS μ T eig (cavitySpectralGroup g) u + (fun U σ => if R < ‖cavityFullSpecialCoordinates g (B U) U (σ 0).1‖ then 1 else 0) := by + simpa only [cavitySpecialCutoff, Set.mem_compl_iff, Set.mem_ofPred_eq, not_le] using + restricted_cavity_full_cutoff_error S hS μ T eig (cavitySpectralGroup g) u hu + (cavitySpecialCutoff g B R) (measurableSet_cavitySpecialCutoff g B hmB R) F hmF hM hF + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpectrumEntropyUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpectrumEntropyUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..31340db59401d4c83778c7adb362793c0f996d7f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpectrumEntropyUpper.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorRestrictedEntropyLimit +import OAI.Probability.InvariantIsing.Fields.SpinPriorPhysicalPressure + +namespace OAI + +/-! The finite-spectrum pressure upper bound against a fixed finite-step +trial. The hypotheses on concentration are the named published inputs. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_restrictedPressure_entropy_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (C : (k : ℕ) → Finset (Spin (N k))) (hC : ∀ k, (C k).Nonempty) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (d : ℝ) (hd : 0 < d) (htrial : ∀ᵐ s ∂pathMeasure, trial s ≤ 1 - d) + (S : ℝ) (hS : ∀ H ε : ℝ, 0<ε → ∀ᶠ k in atTop, + ∀ (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i), (∑ i, a i) ≤ H → + constrainedBlockValue (C k) (contactFieldStep cut hc hfirst hlast a ha)+ + fieldPairing trial (contactFieldStep cut hc hfirst hlast a ha)/2 ≤ S+ε) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (C k) (eig k) (specialRotation U) (fun _ => 0) ∂μ k) ≤ + S + spectralFunctional (finiteR ρ lam hρpos hρsum) trial + ε := by + intro ε hε + have hthird : 0 < ε / 3 := div_pos hε (by norm_num) + obtain ⟨H, hH, hevent⟩ := spinPriorRestrictedContact_entropy_limit hhaar hgauss + N hN hNlim m n μ hμinv C hC eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + cut hc hfirst hlast trial values hvalues d hd htrial (ε / 3) S hthird hS + have hcost : ∀ᶠ k in atTop, + 2 * m * perturbationScale (N k) + 8 * perturbationScale (N k) ^ 2 < ε / 3 := + ((fullPerturbationCost_tendsto m).comp hNlim).eventually (gt_mem_nhds hthird) + filter_upwards [hevent (ε / 3) hthird, hcost] with k hk hck + let p : TensorContactParameter (N k) m n := + (1, (fun _ => 0), (fun _ => 3 / 2), (fun _ => 3 / 2)) + have hp : p ∈ tensorContactRegion (N k) m n H := by + apply tensorContactRegion_mem (by norm_num) (fun _ => le_rfl) + · simpa only [p, Finset.sum_const_zero] using hH.le + · intro j; norm_num + · intro a; norm_num + have hj := hk p hp + have hz := spinPriorPerturbationPressureMean_cost (n := n) hhaar hgauss (hN k) + (μ k) (hμinv k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) + (eig k) (fun _ => 0) (I k) (chainExponent cut) 1 (fun _ => 0) + (fun _ _ _ => le_rfl) le_rfl (fun _ => 3/2) (by intro j; norm_num) + (fun _ => 3/2) (by intro j; norm_num) + rw [spinPrior_restricted_unperturbed_pressure hhaar hgauss (hN k) (μ k) (hμinv k)] at hz + simp only [one_mul] at hz + have hg : finiteTemperatureFunctional ρ lam hρpos hρsum trial 1 = + spectralFunctional (finiteR ρ lam hρpos hρsum) trial := by + simpa only [one_mul] using finiteTemperatureFunctional_eq ρ lam hρpos hρsum trial zero_le_one + have hzero : finiteFieldPath (fun _ : Fin (n + 1) => (0 : ℝ)) = fun _ => 0 := by + funext i + simp only [finiteFieldPath, ite_self, Finset.sum_const_zero] + simp only [spinPriorContactObjective, p, hzero, mul_zero, Finset.sum_const_zero, zero_div, + sub_zero, one_mul, sub_self, zero_pow (by norm_num : 2 ≠ 0), add_zero, hg] at hj + have hpress : spinPriorPerturbationPressureMean (n := n) (μ k) + (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) + (eig k) (fun _ => 0) (I k) (chainExponent cut) 1 (fun _ => 0) + (fun _ => 3/2) (fun _ => 3/2) = + spinPriorContactPressure (μ k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) + (eig k) (fun _ => 0) (I k) (chainExponent cut) p := by + simp only [spinPriorPerturbationPressureMean,spinPriorContactPressure,p,hzero,zero_div,add_zero] + rw [hpress] at hz + have hd := (abs_le.mp hz).1 + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpectrumStepUpper.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpectrumStepUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..320539af319ba31ab0b73ea736ebbcb4c30f7ce6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpectrumStepUpper.lean @@ -0,0 +1,88 @@ +import OAI.Probability.InvariantIsing.Fields.SpinPriorRestrictedAsymptotic +import OAI.Probability.InvariantIsing.Fields.SpinPriorPhysicalPressure + +namespace OAI + +/-! The finite-spectrum pressure upper bound against a fixed finite-step +trial. The hypotheses on concentration are the named published inputs. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +theorem finiteSpectrum_restrictedPressure_step_upper + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (N : ℕ → ℕ) (hN : ∀ k, 3 ≤ N k) (hNlim : Tendsto N atTop atTop) (m n : ℕ) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k))) [∀ k, IsProbabilityMeasure (μ k)] + (hμinv : ∀ k, (μ k).IsMulLeftInvariant) + (C : (k : ℕ) → Finset (Spin (N k))) (hC : ∀ k, (C k).Nonempty) + (eig : (k : ℕ) → Fin (N k) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ k i, |eig k i| ≤ K) + (I : (k : ℕ) → Fin m → Finset (Fin (N k))) + (hdis : ∀ k, Set.PairwiseDisjoint (Set.univ : Set (Fin m)) (I k)) + (hcover : ∀ k, Finset.univ.biUnion (I k) = Finset.univ) + (lam : Fin m → ℝ) (hlam : ∀ k a i, i ∈ I k a → eig k i = lam a) + (ρ : Fin m → ℝ) (hρpos : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hρ : Tendsto (fun k a => ((I k a).card : ℝ) / N k) atTop (𝓝 ρ)) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (trial : OverlapPath) (values : Fin (n + 1) → ℝ) + (hvalues : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = values i) + (d : ℝ) (hd : 0 < d) (htrial : ∀ᵐ s ∂pathMeasure, trial s ≤ 1 - d) + (S : ℝ) (hS : ∀ k (a : Fin (n+1) → ℝ) (ha : ∀ i, 0 ≤ a i), + constrainedBlockValue (C k) (contactFieldStep cut hc hfirst hlast a ha)+ + fieldPairing trial (contactFieldStep cut hc hfirst hlast a ha)/2 ≤ S) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, + (∫ U : SpecialOrthogonal (N k), + restrictedRotatedPressure (C k) (eig k) (specialRotation U) (fun _ => 0) ∂μ k) ≤ + S + spectralFunctional (finiteR ρ lam hρpos hρsum) trial + ε := by + intro ε hε + have hthird : 0 < ε / 3 := div_pos hε (by norm_num) + obtain ⟨H, hH, hevent⟩ := spinPriorRestrictedContact_eventually_nonnegative hhaar hgauss + N hN hNlim m n μ hμinv C hC eig K hK heig I hdis hcover lam hlam ρ hρpos hρsum hρ + cut hc hfirst hlast trial values hvalues d hd htrial (ε / 3) S hthird hS + have hcost : ∀ᶠ k in atTop, + 2 * m * perturbationScale (N k) + 8 * perturbationScale (N k) ^ 2 < ε / 3 := + ((fullPerturbationCost_tendsto m).comp hNlim).eventually (gt_mem_nhds hthird) + filter_upwards [hevent (ε / 3) hthird, hcost] with k hk hck + let p : TensorContactParameter (N k) m n := + (1, (fun _ => 0), (fun _ => 3 / 2), (fun _ => 3 / 2)) + have hp : p ∈ tensorContactRegion (N k) m n H := by + apply tensorContactRegion_mem (by norm_num) (fun _ => le_rfl) + · simpa only [p, Finset.sum_const_zero] using hH.le + · intro j; norm_num + · intro a; norm_num + have hj := hk p hp + have hz := spinPriorPerturbationPressureMean_cost (n := n) hhaar hgauss (hN k) + (μ k) (hμinv k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) + (eig k) (fun _ => 0) (I k) (chainExponent cut) 1 (fun _ => 0) + (fun _ _ _ => le_rfl) le_rfl (fun _ => 3/2) (by intro j; norm_num) + (fun _ => 3/2) (by intro j; norm_num) + rw [spinPrior_restricted_unperturbed_pressure hhaar hgauss (hN k) (μ k) (hμinv k)] at hz + simp only [one_mul] at hz + have hg : finiteTemperatureFunctional ρ lam hρpos hρsum trial 1 = + spectralFunctional (finiteR ρ lam hρpos hρsum) trial := by + simpa only [one_mul] using finiteTemperatureFunctional_eq ρ lam hρpos hρsum trial zero_le_one + have hzero : finiteFieldPath (fun _ : Fin (n + 1) => (0 : ℝ)) = fun _ => 0 := by + funext i + simp only [finiteFieldPath, ite_self, Finset.sum_const_zero] + simp only [spinPriorContactObjective, p, hzero, mul_zero, Finset.sum_const_zero, zero_div, + sub_zero, one_mul, sub_self, zero_pow (by norm_num : 2 ≠ 0), add_zero, hg] at hj + have hpress : spinPriorPerturbationPressureMean (n := n) (μ k) + (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) + (eig k) (fun _ => 0) (I k) (chainExponent cut) 1 (fun _ => 0) + (fun _ => 3/2) (fun _ => 3/2) = + spinPriorContactPressure (μ k) (restrictedSpinPrior (C k) (hC k) : Measure (Spin (N k))) + (eig k) (fun _ => 0) (I k) (chainExponent cut) p := by + simp only [spinPriorPerturbationPressureMean,spinPriorContactPressure,p,hzero,zero_div,add_zero] + rw [hpress] at hz + have hd := (abs_le.mp hz).1 + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinBias.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinBias.lean new file mode 100644 index 0000000000000000000000000000000000000000..81c03cef50aabfd65526bebccb6b9e30358aff1b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinBias.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinKernel +import OAI.Probability.InvariantIsing.Magnetic.ConstrainedBlockBias + +namespace OAI + +/-! A constant energy shift on the constraint set cancels from its +actual conditional Gibbs law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma restrictedSpinLaw_mass {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) (T : Finset (Spin N)) : + (restrictedSpinLaw S H).real T = + (∑ σ ∈ S ∩ T, Real.exp (H σ)) / ∑ σ ∈ S, Real.exp (H σ) := by + classical + rw [measureReal_def, restrictedSpinLaw, cond_apply S.measurableSet, + ENNReal.toReal_mul, ENNReal.toReal_inv] + change ((gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H).real S)⁻¹ * + (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H).real + ((S : Set (Spin N)) ∩ T) = _ + rw [← Finset.coe_inter, spinGibbs_mass_finset, spinGibbs_mass_finset] + have hZ := (sum_exp_pos H).ne' + have hZS := (Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS).ne' + field_simp + +lemma restrictedSpinLaw_eq_of_add_on_set {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H G : Spin N → ℝ) (c : ℝ) (hG : ∀ σ ∈ S, G σ = H σ + c) : + restrictedSpinLaw S G = restrictedSpinLaw S H := by + classical + have hscale (T : Finset (Spin N)) (hT : T ⊆ S) : + (∑ σ ∈ T, Real.exp (G σ)) = Real.exp c * ∑ σ ∈ T, Real.exp (H σ) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro σ hσ + rw [hG σ (hT hσ), Real.exp_add] + ring + let _ := restrictedSpinLaw_probability S hS G + let _ := restrictedSpinLaw_probability S hS H + apply Measure.ext_of_singleton + intro σ + have hreal : (restrictedSpinLaw S G).real ({σ} : Finset (Spin N)) = + (restrictedSpinLaw S H).real ({σ} : Finset (Spin N)) := by + rw [restrictedSpinLaw_mass S hS G, restrictedSpinLaw_mass S hS H, + hscale (S ∩ {σ}) Finset.inter_subset_left, hscale S (fun _ hx => hx)] + exact mul_div_mul_left _ _ (Real.exp_ne_zero c) + have he := congrArg ENNReal.ofReal hreal + rw [measureReal_def, measureReal_def, ENNReal.ofReal_toReal (measure_ne_top _ _), + ENNReal.ofReal_toReal (measure_ne_top _ _)] at he + simpa only [Finset.coe_singleton] using he + +lemma restrictedSpinKernel_group_bias {N : ℕ} {A : Type*} [Fintype A] [DecidableEq A] + (group : Fin N → A) (k : A → ℕ) (hk : ∀ a, k a ≤ spinGroupSize group a) + (bias : A → ℝ) (z : Fin N → ℝ) : + restrictedSpinKernel (spinGroupSlice group k) (z + fun j => bias (group j)) = + restrictedSpinKernel (spinGroupSlice group k) z := by + apply restrictedSpinLaw_eq_of_add_on_set _ (spinGroupSlice_nonempty group k hk) + (fieldEnergy z) (fieldEnergy (z + fun j => bias (group j))) + (spinGroupFieldConstant group k bias) + intro σ hσ + have he : fieldEnergy (z + fun j => bias (group j)) σ = + fieldEnergy z σ + fieldEnergy (fun j => bias (group j)) σ := by + simp only [fieldEnergy, Pi.add_apply, add_mul, Finset.sum_add_distrib] + rw [he, fieldEnergy_on_group_slice group k bias hσ] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinEvaluation.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2c4dbe09f399bb8f5813f94cbb11650d28d5574 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinEvaluation.lean @@ -0,0 +1,113 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedLeafConditioning +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRootEvaluation +import OAI.Probability.InvariantIsing.Fields.FieldSpinMeasurability + +namespace OAI + +/-! The actual constrained spin-pair test under the finite published +endpoint marking input. Integrability is proved from the full model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +def restrictedFieldSpinPairIntegrand {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : ℝ := + referenceReplicaMean + ((restrictedSpinPrior S hS : Measure (Spin N)).prod (labeledLeafLaw h.depth p.1)) + (fun s : Spin N × LabeledLeaf h.depth => + fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) + (fun σ : Fin 2 → Spin N × LabeledLeaf h.depth => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j))) + +def restrictedFieldSpinPairMean {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (z : Fin N → ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : ℝ := + ∫ p, restrictedFieldSpinPairIntegrand S hS h z p q Φ j ∂fieldVectorCoordinateLaw N h + +lemma measurable_restrictedFieldSpinPairIntegrand {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + restrictedFieldSpinPairIntegrand S hS h p.1 p.2 q Φ j) := by + let D : (Fin 2 → Spin N × LabeledLeaf h.depth) → ℝ := fun σ => + Φ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) * + (spinValue ((σ 0).1 j) * spinValue ((σ 1).1 j)) + have hm := measurable_cascadeCoordinateReplicaMean h.depth + (restrictedSpinPrior S hS : Measure (Spin N)) (measurable_fieldEnergy_map N) D + have hc : Measurable (fun p : (Fin N → ℝ) × + (LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) => + (p.1, fieldEnergyCoordinates N h p.2)) := + measurable_fst.prodMk ((measurable_fieldEnergyCoordinates N h).comp measurable_snd) + have he (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : + cascadeCoordinateEnergy h.depth (fieldEnergy z) (fieldEnergyCoordinates N h p) = + fun s => fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1 := + funext (fieldEnergyCoordinates_energy N h p z) + have hh := hm.comp hc + simp only [Function.comp_def] at hh + simp_rw [he] at hh + simpa only [labeledSpinReference, fieldEnergyCoordinates, + restrictedFieldSpinPairIntegrand, D] using hh + +lemma restrictedFieldSpinPairIntegrand_abs_le {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) (z : Fin N → ℝ) + (p : LabeledTree h.depth × (ForestVertex h.depth → Fin N → ℝ)) : + |restrictedFieldSpinPairIntegrand S hS h z p q Φ j| ≤ C := by + have hC : 0 ≤ C := (abs_nonneg (Φ 0)).trans (hΦ 0) + apply referenceReplicaMean_abs_le _ _ _ (measurable_of_countable _) hC + intro σ + simpa only [abs_mul, abs_spinValue, mul_one, one_mul] using + hΦ (q (fieldDepthLevel h (labeledCommonDepth h.depth (σ 0).2 (σ 1).2))) + +lemma measurable_restrictedFieldSpinPairMean {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) : + Measurable (fun z => restrictedFieldSpinPairMean S hS h z q Φ j) := + (measurable_restrictedFieldSpinPairIntegrand S hS h q Φ j).stronglyMeasurable.integral_prod_right'.measurable + +lemma restrictedFieldSpinPairMean_abs_le {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (h : FieldStep) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) (z : Fin N → ℝ) : + |restrictedFieldSpinPairMean S hS h z q Φ j| ≤ C := by + exact abs_integral_le_const_of_bound + ((measurable_restrictedFieldSpinPairIntegrand S hS h q Φ j).comp measurable_prodMk_left) + (fun p => restrictedFieldSpinPairIntegrand_abs_le S hS h q Φ j hΦ z p) + +theorem restricted_field_spin_pair_reduce {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (z : Fin N → ℝ) (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + restrictedFieldSpinPairMean S hS h z q Φ j = + restrictedFieldTiltedPairMean S h z (restrictedEndpointCoordinateTest S h q Φ j) := by + unfold restrictedFieldSpinPairMean restrictedFieldSpinPairIntegrand restrictedFieldTiltedPairMean + apply integral_congr_ae + filter_upwards [restricted_field_vector_spin_exp_integrable hN S hS h z] with p hp + exact restricted_leaf_spin_pair_conditioning S hS (labeledLeafLaw h.depth p.1) + (fieldVectorEndpoint N h p z) hp (fun d => Φ (q (fieldDepthLevel h d))) + (fun d => hΦ _) j + +theorem restricted_field_spin_pair_evaluation + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) + (q : Fin (h.depth + 1) → ℝ) (Φ : ℝ → ℝ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + (∫ z, restrictedFieldSpinPairMean S hS h z q Φ j + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) = + ∫ s, Φ (q (fieldLevelIndex h s)) * + (∫ z, restrictedPairCoordinateMean hN S hS h.depth (chainExponent h.cut) + (fieldStepVariance h) + (fun i hi => ((chainExponent_admissible h.ordered_cut h.first h.last).1 i hi).1) + (fieldLevelIndex h s) j z + ∂(vectorGaussianLaw N (NNReal.mk (h.height 0) (h.nonneg 0)) : Measure (Fin N → ℝ))) + ∂pathMeasure := by + simp_rw [restricted_field_spin_pair_reduce hN S hS h _ q Φ j hΦ] + exact restricted_field_published_rooted_coordinate_test hpub hN S hS h q Φ j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinKernel.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d05105318bd6d281fc0572f28850d25135a7624 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinKernel.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinLaw +import OAI.Probability.InvariantIsing.Fields.FieldVectorSampling + +namespace OAI + +/-! The actual constrained terminal spin kernel, including measurability +and its exact conditional entropy cost. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron Set + +namespace InvariantIsing + +def restrictedSpinKernel {N : ℕ} (S : Finset (Spin N)) : Kernel (Fin N → ℝ) (Spin N) := by + refine ⟨fun z => restrictedSpinLaw S (fieldEnergy z), ?_⟩ + apply Measure.measurable_of_measurable_coe + intro T hT + change Measurable (fun z => cond (fieldVectorSpinKernel N z) S T) + simp only [cond_apply S.measurableSet] + exact ((fieldVectorSpinKernel N).measurable_coe S.measurableSet).inv.mul + ((fieldVectorSpinKernel N).measurable_coe (S.measurableSet.inter hT)) + +lemma restrictedSpinKernel_markov {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + IsMarkovKernel (restrictedSpinKernel S) := + ⟨fun z => restrictedSpinLaw_probability S hS (fieldEnergy z)⟩ + +lemma restrictedSpinKernel_univ (N : ℕ) : + restrictedSpinKernel (Finset.univ : Finset (Spin N)) = fieldVectorSpinKernel N := by + ext z : 1 + change cond (fieldVectorSpinKernel N z) (Finset.univ : Finset (Spin N)) = _ + simpa only [Finset.coe_univ] using (cond_univ (μ := fieldVectorSpinKernel N z)) + +theorem restrictedSpinKernel_entropy {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (z : Fin N → ℝ) : + klDiv (restrictedSpinKernel S z) (fieldVectorSpinKernel N z) ≠ ⊤ ∧ + (klDiv (restrictedSpinKernel S z) (fieldVectorSpinKernel N z)).toReal = + restrictedFieldTerminal Finset.univ z - restrictedFieldTerminal S z := by + have he := restrictedSpinLaw_entropy S hS (fieldEnergy z) + rw [← restrictedSpinLog_univ] at he + exact he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc3863f197ffefe3e6b77f7388f356ec61e1291d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinLaw.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Core.ConditionalRelativeEntropy +import OAI.Probability.InvariantIsing.Fields.CanonicalSpinWeights +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldTerminal + +namespace OAI + +/-! The constrained terminal spin distribution is the physical Gibbs +law conditioned on the allowed spins. Its entropy cost is exactly the +loss in log partition functions, retaining the original cube mass. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma spinGibbs_mass_finset {N : ℕ} (H : Spin N → ℝ) (S : Finset (Spin N)) : + (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H).real S = + (∑ σ ∈ S, Real.exp (H σ)) / ∑ σ, Real.exp (H σ) := by + classical + rw [← integral_indicator_one (μ := gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H) + S.measurableSet, integral_uniformSpinGibbs_canonical] + simp only [Set.indicator, Pi.one_apply, Finset.mem_coe, + mul_ite, mul_one, mul_zero, Finset.sum_ite_mem, Finset.univ_inter] + simp only [finiteCanonicalWeights, Finset.sum_div] + +lemma spinGibbs_mass_pos {N : ℕ} (H : Spin N → ℝ) (S : Finset (Spin N)) (hS : S.Nonempty) : + 0 < (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H).real S := by + rw [spinGibbs_mass_finset] + exact div_pos (Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS) (sum_exp_pos H) + +def restrictedSpinLaw {N : ℕ} (S : Finset (Spin N)) (H : Spin N → ℝ) : Measure (Spin N) := + cond (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H) S + +lemma restrictedSpinLaw_probability {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) : IsProbabilityMeasure (restrictedSpinLaw S H) := by + apply cond_isProbabilityMeasure + exact (measureReal_ne_zero_iff).mp (spinGibbs_mass_pos H S hS).ne' + +theorem restrictedSpinLaw_entropy {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) : + klDiv (restrictedSpinLaw S H) (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H) ≠ ⊤ ∧ + (klDiv (restrictedSpinLaw S H) + (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H)).toReal = + logPartition H - restrictedSpinLog S H := by + have he := conditioned_measure_entropy + (gibbsProbability (uniformSpinPrior N : Measure (Spin N)) H) S S.measurableSet + ((measureReal_ne_zero_iff).mp (spinGibbs_mass_pos H S hS).ne') + refine ⟨he.1, he.2.trans ?_⟩ + rw [spinGibbs_mass_finset, Real.log_div + (Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS).ne' (sum_exp_pos H).ne'] + rw [logPartition_eq, log_card_spin, restrictedSpinLog] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinLog.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c52aafe51c7cd3e38acbd427815a3f59822fe7c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinLog.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Core.Model + +namespace OAI + +/-! Restricted spin sums retain the original cube mass. A deterministic +map of slices costs its energy error and the logarithm of its largest fiber. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +def restrictedSpinLog {N : ℕ} (S : Finset (Spin N)) (H : Spin N → ℝ) : ℝ := + Real.log (∑ σ ∈ S, Real.exp (H σ)) - N * Real.log 2 + +lemma restrictedSpinLog_univ {N : ℕ} (H : Spin N → ℝ) : + restrictedSpinLog Finset.univ H = logPartition H := by + rw [restrictedSpinLog, logPartition_eq, log_card_spin] + +lemma restrictedSpinLog_add_const {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) (c : ℝ) : + restrictedSpinLog S (fun σ => H σ + c) = restrictedSpinLog S H + c := by + have hp : 0 < ∑ σ ∈ S, Real.exp (H σ) := + Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS + simp_rw [restrictedSpinLog, Real.exp_add] + rw [← Finset.sum_mul, Real.log_mul hp.ne' (Real.exp_ne_zero c), Real.log_exp] + ring + +lemma restrictedSpinLog_mono {N : ℕ} {S T : Finset (Spin N)} (hS : S.Nonempty) + (hST : S ⊆ T) {H K : Spin N → ℝ} (hHK : ∀ σ ∈ S, H σ ≤ K σ) : + restrictedSpinLog S H ≤ restrictedSpinLog T K := by + apply sub_le_sub_right + apply Real.log_le_log (Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS) + exact (Finset.sum_le_sum (fun σ hσ => Real.exp_le_exp.mpr (hHK σ hσ))).trans + (Finset.sum_le_sum_of_subset_of_nonneg hST (fun σ _ _ => (Real.exp_pos (K σ)).le)) + +lemma restrictedSpinLog_le_full {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) : restrictedSpinLog S H ≤ logPartition H := by + rw [← restrictedSpinLog_univ] + exact restrictedSpinLog_mono hS (Finset.subset_univ S) (fun _ _ => le_rfl) + +lemma sum_exp_le_of_fiber_bound {X Y : Type*} [DecidableEq X] [DecidableEq Y] + (S : Finset X) (T : Finset Y) (f : X → Y) (H : X → ℝ) (K : Y → ℝ) + (c B : ℝ) (hf : ∀ x ∈ S, f x ∈ T) + (hE : ∀ x ∈ S, H x ≤ K (f x) + c) + (hB : ∀ y ∈ T, ((S.filter fun x => f x = y).card : ℝ) ≤ B) : + ∑ x ∈ S, Real.exp (H x) ≤ Real.exp c * B * ∑ y ∈ T, Real.exp (K y) := by + rw [← Finset.sum_fiberwise_of_maps_to hf, Finset.mul_sum] + apply Finset.sum_le_sum + intro y hy + calc + _ ≤ ∑ _x ∈ S.filter (fun x => f x = y), Real.exp (K y + c) := by + apply Finset.sum_le_sum + intro x hx + obtain ⟨hxS, hxy⟩ := Finset.mem_filter.mp hx + apply Real.exp_le_exp.mpr + simpa only [hxy] using hE x hxS + _ = ((S.filter fun x => f x = y).card : ℝ) * Real.exp (K y + c) := by + simp + _ ≤ B * Real.exp (K y + c) := + mul_le_mul_of_nonneg_right (hB y hy) (Real.exp_pos _).le + _ = Real.exp c * B * Real.exp (K y) := by rw [Real.exp_add]; ring + +lemma restrictedSpinLog_le_of_map {N : ℕ} (S T : Finset (Spin N)) + (hS : S.Nonempty) (hT : T.Nonempty) (f : Spin N → Spin N) + (H K : Spin N → ℝ) (c B : ℝ) (hB0 : 0 < B) + (hf : ∀ σ ∈ S, f σ ∈ T) (hE : ∀ σ ∈ S, H σ ≤ K (f σ) + c) + (hB : ∀ τ ∈ T, ((S.filter fun σ => f σ = τ).card : ℝ) ≤ B) : + restrictedSpinLog S H ≤ restrictedSpinLog T K + c + Real.log B := by + have h := Real.log_le_log (Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS) + (sum_exp_le_of_fiber_bound S T f H K c B hf hE hB) + have hp : 0 < ∑ τ ∈ T, Real.exp (K τ) := + Finset.sum_pos (fun τ _ => Real.exp_pos (K τ)) hT + rw [Real.log_mul (mul_pos (Real.exp_pos c) hB0).ne' hp.ne', + Real.log_mul (Real.exp_ne_zero c) hB0.ne', Real.log_exp] at h + unfold restrictedSpinLog + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinPrior.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinPrior.lean new file mode 100644 index 0000000000000000000000000000000000000000..43fdbf247b5f7d4d478b5f3172529128a3244f64 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinPrior.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinBias +import OAI.Probability.InvariantIsing.Fields.PriorSpinLeafConditioning + +namespace OAI + +/-! A normalized constrained prior gives exactly the conditional Gibbs +law. Its log normalizer retains the original cube mass as an explicit +constant. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +def restrictedSpinPrior {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + ProbabilityMeasure (Spin N) := + ⟨restrictedSpinLaw S (fun _ => 0), restrictedSpinLaw_probability S hS _⟩ + +lemma restrictedSpinPrior_singleton {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (σ : Spin N) : (restrictedSpinPrior S hS : Measure (Spin N)).real {σ} = + if σ ∈ S then (S.card : ℝ)⁻¹ else 0 := by + have hm := restrictedSpinLaw_mass S hS (fun _ => 0) {σ} + simp only [Finset.coe_singleton] at hm + change (restrictedSpinLaw S (fun _ => 0)).real {σ} = _ + rw [hm] + by_cases hσ : σ ∈ S <;> simp [hσ] + +lemma integral_restrictedSpinPrior {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (f : Spin N → ℝ) : + (∫ σ, f σ ∂(restrictedSpinPrior S hS : Measure (Spin N))) = + (S.card : ℝ)⁻¹ * ∑ σ ∈ S, f σ := by + rw [integral_fintype (Integrable.of_finite)] + simp_rw [restrictedSpinPrior_singleton, smul_eq_mul, ite_mul, zero_mul] + rw [Finset.sum_ite_mem, Finset.univ_inter, Finset.mul_sum] + +lemma finiteLogIntegral_restrictedSpinPrior {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) : + finiteLogIntegral (restrictedSpinPrior S hS : Measure (Spin N)) H = + restrictedSpinLog S H - (Real.log S.card - N * Real.log 2) := by + have hcard : (0 : ℝ) < S.card := by exact_mod_cast hS.card_pos + rw [finiteLogIntegral, integral_restrictedSpinPrior, Real.log_mul + (inv_pos.mpr hcard).ne' (Finset.sum_pos (fun σ _ => Real.exp_pos (H σ)) hS).ne', Real.log_inv] + unfold restrictedSpinLog + ring + +lemma integral_restrictedSpinPrior_gibbs {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H f : Spin N → ℝ) : + (∫ σ, f σ ∂gibbsProbability (restrictedSpinPrior S hS : Measure (Spin N)) H) = + (∑ σ ∈ S, Real.exp (H σ) * f σ) / ∑ σ ∈ S, Real.exp (H σ) := by + have hcard : (S.card : ℝ) ≠ 0 := by exact_mod_cast hS.card_pos.ne' + rw [gibbsProbability_eq_tilted _ _ Integrable.of_finite, integral_tilted, + integral_restrictedSpinPrior, integral_restrictedSpinPrior] + simp only [smul_eq_mul, div_mul_eq_mul_div] + rw [← Finset.sum_div] + field_simp + +lemma gibbsProbability_restrictedSpinPrior {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (H : Spin N → ℝ) : + gibbsProbability (restrictedSpinPrior S hS : Measure (Spin N)) H = restrictedSpinLaw S H := by + let _ := restrictedSpinLaw_probability S hS H + apply Measure.ext_of_singleton + intro σ + have he : (gibbsProbability (restrictedSpinPrior S hS : Measure (Spin N)) H).real {σ} = + (restrictedSpinLaw S H).real {σ} := by + rw [← integral_indicator_one (measurableSet_singleton σ), integral_restrictedSpinPrior_gibbs] + have hm := restrictedSpinLaw_mass S hS H {σ} + simp only [Finset.coe_singleton] at hm + rw [hm] + simp only [Set.indicator, Set.mem_singleton_iff, Pi.one_apply, mul_ite, mul_one, mul_zero] + by_cases hσ : σ ∈ S <;> simp [hσ] + have hh := congrArg ENNReal.ofReal he + simpa only [measureReal_def, ENNReal.ofReal_toReal (measure_ne_top _ _)] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinReplacement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..60d16845fd99873d29f4b538e523dd58c1108b0b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinReplacement.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedBlockSpinEvaluation +import OAI.Probability.InvariantIsing.Magnetic.MagneticBlockPathConvergence + +namespace OAI + +/-! Uniform replacement in the actual finite constrained cavity spin +test, with arbitrary bounded common-level tests and growing depth. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators NNReal Topology + +namespace InvariantIsing + +lemma fieldLevel_test_path_error (h : FieldStep) (q : Fin (h.depth + 1) → ℝ) + (Φ : ℝ → ℝ) (p r : OverlapPath) {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + |(∫ s, Φ (q (fieldLevelIndex h s)) * p s ∂pathMeasure) - + (∫ s, Φ (q (fieldLevelIndex h s)) * r s ∂pathMeasure)| ≤ + C * ∫ s, |p s - r s| ∂pathMeasure := by + have hC : 0 ≤ C := (abs_nonneg (Φ 0)).trans (hΦ 0) + have hm : Measurable (fun s => Φ (q (fieldLevelIndex h s))) := + (measurable_of_finite (fun i => Φ (q i))).comp (fieldLevelIndex_monotone h).measurable + have hi (v : OverlapPath) : Integrable (fun s => Φ (q (fieldLevelIndex h s)) * v s) pathMeasure := by + apply integrable_of_measurable_abs_le (hm.mul v.measurable) (c := C) + intro s + change |Φ (q (fieldLevelIndex h s)) * v s| ≤ C + rw [abs_mul, abs_of_nonneg (v.nonneg s)] + exact (mul_le_mul_of_nonneg_left (v.le_one s) (abs_nonneg _)).trans (by simpa using hΦ _) + have hid : Integrable (fun s => Φ (q (fieldLevelIndex h s)) * (p s - r s)) pathMeasure := by + apply ((hi p).sub (hi r)).congr + exact Eventually.of_forall (fun s => by dsimp; ring) + have he : (∫ s, Φ (q (fieldLevelIndex h s)) * p s ∂pathMeasure) - + (∫ s, Φ (q (fieldLevelIndex h s)) * r s ∂pathMeasure) = + ∫ s, Φ (q (fieldLevelIndex h s)) * (p s - r s) ∂pathMeasure := by + rw [← integral_sub (hi p) (hi r)] + congr 1 + funext s + ring + rw [he] + calc + _ ≤ ∫ s, |Φ (q (fieldLevelIndex h s)) * (p s - r s)| ∂pathMeasure := + abs_integral_le_integral_abs + _ ≤ ∫ s, C * |p s - r s| ∂pathMeasure := by + apply integral_mono hid.abs ((p.integrable.sub r.integrable).abs.const_mul C) + intro s + change |Φ (q (fieldLevelIndex h s)) * (p s - r s)| ≤ C * |p s - r s| + rw [abs_mul] + exact mul_le_mul_of_nonneg_right (hΦ _) (abs_nonneg _) + _ = _ := integral_const_mul _ _ + +theorem restricted_field_spin_replacement + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {A : Type*} [Fintype A] [DecidableEq A] + (N : ℕ → ℕ) (hN : ∀ n, 0 < N n) (hNlim : Tendsto N atTop atTop) + (group : ∀ n, Fin (N n) → A) (k : ℕ → A → ℕ) + (hk : ∀ n a, k n a ≤ spinGroupSize (group n) a) (m : ℕ → A → ℝ) + {r H C : ℝ} (hr : r < 1) (hm : ∀ n a, |m n a| ≤ r) + (hc : ∀ n a, (k n a : ℝ) = spinGroupSize (group n) a * ((1 + m n a) / 2)) + (h : ℕ → FieldStep) (hH : ∀ n, (h n).height (Fin.last (h n).depth) ≤ H) + (q : ∀ n, Fin ((h n).depth + 1) → ℝ) (Φ : ℕ → ℝ → ℝ) + (hΦ : ∀ n x, |Φ n x| ≤ C) : + Tendsto (fun n => + (∫ z, restrictedFieldBlockSpinMean (spinGroupSlice (group n) (k n)) + (spinGroupSlice_nonempty (group n) (k n) (hk n)) (h n) z (q n) (Φ n) + ∂(vectorGaussianLaw (N n) (NNReal.mk ((h n).height 0) ((h n).nonneg 0)) : + Measure (Fin (N n) → ℝ))) - + (∫ s, Φ n (q n (fieldLevelIndex (h n) s)) * + magneticBlockPath (hN n) (h n) (fun j => m n (group n j)) s ∂pathMeasure)) + atTop (𝓝 0) := by + have he := magneticBlockPath_l1_tendsto N hN hNlim group k hk m hr hm hc h hH + apply squeeze_zero_norm (fun n => ?_) (show Tendsto + (fun n => C * ∫ s, |restrictedBlockOverlapPath (hN n) + (spinGroupSlice (group n) (k n)) (spinGroupSlice_nonempty (group n) (k n) (hk n)) (h n) s - + magneticBlockPath (hN n) (h n) (fun j => m n (group n j)) s| ∂pathMeasure) + atTop (𝓝 0) by simpa only [mul_zero] using he.const_mul C) + rw [Real.norm_eq_abs, restricted_field_block_spin_evaluation hpub (hN n) _ _ _ _ _ (hΦ n)] + exact fieldLevel_test_path_error (h n) (q n) (Φ n) _ _ (hΦ n) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinSymmetry.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinSymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0ba3368885312c29d851152774752fff72f6763 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSpinSymmetry.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinPrior +import OAI.Probability.InvariantIsing.Cavity.CavitySpinPrior + +namespace OAI + +/-! A spin permutation preserving a constraint preserves its normalized +prior and its product with the actual cascade leaf law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restrictedSpinPrior_equiv {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) + (e : Spin N ≃ Spin N) (hinv : ∀ σ, e σ ∈ S ↔ σ ∈ S) : + MeasurePreserving e (restrictedSpinPrior S hS : Measure (Spin N)) + (restrictedSpinPrior S hS : Measure (Spin N)) := by + refine ⟨measurable_of_countable _, ?_⟩ + apply Measure.ext_of_singleton + intro σ + have hp : e ⁻¹' {σ} = {e.symm σ} := by + ext τ + exact e.eq_symm_apply.symm + have hi : e.symm σ ∈ S ↔ σ ∈ S := by + simpa only [e.apply_symm_apply] using (hinv (e.symm σ)).symm + have he : ((restrictedSpinPrior S hS : Measure (Spin N)).map e).real {σ} = + (restrictedSpinPrior S hS : Measure (Spin N)).real {σ} := by + rw [measureReal_def, Measure.map_apply (measurable_of_countable _) (measurableSet_singleton σ), hp] + change (restrictedSpinPrior S hS : Measure (Spin N)).real {e.symm σ} = _ + simp only [restrictedSpinPrior_singleton, hi] + have hh := congrArg ENNReal.ofReal he + simpa only [measureReal_def, ENNReal.ofReal_toReal (measure_ne_top _ _)] using hh + +theorem restricted_labeled_spin_reference_equiv {N depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (T : LabeledTree depth) + (e : Spin N ≃ Spin N) (hinv : ∀ σ, e σ ∈ S ↔ σ ∈ S) : + MeasurePreserving (fun x : Spin N × LabeledLeaf depth => (e x.1, x.2)) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) := + (restrictedSpinPrior_equiv S hS e hinv).prod (MeasurePreserving.id (labeledLeafLaw depth T)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitOverlapTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitOverlapTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..aad6d5c443f47deb6ba2f97782a20c126cd60885 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitOverlapTest.lean @@ -0,0 +1,95 @@ +import OAI.Probability.InvariantIsing.Cavity.CavitySplitOverlapTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTail + +namespace OAI +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BoundedContinuousFunction +namespace InvariantIsing +theorem restricted_full_split_overlap_test_tendsto {n m : ℕ} + (N depth : ℕ → ℕ) + (S : (k : ℕ) → Finset (Spin (N k+n))) (hS : ∀ k, (S k).Nonempty) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k+n))) [∀ k, IsProbabilityMeasure (μ k)] + (T : (k : ℕ) → LabeledTree (depth k)) (eig : (k : ℕ) → Fin (N k+n) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k+n))) (u : ℕ → ℕ → ℝ) + (Φ : ℝ →ᵇ ℝ) : + Tendsto (fun k => + restrictedFullTest (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) + (cavityFullOverlapInsertion Φ) - + restrictedFullTest (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) + (cavitySplitOverlapInsertion Φ)) atTop (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [cavity_split_test_uniform (n := n) N hN hNlim Φ Φ.continuous + (ε/2) (by positivity)] with k hk + let F : SpecialOrthogonal (N k+n) → (Fin 2 → Spin (N k+n) × LabeledLeaf (depth k)) → ℝ := + fun _ => cavityFullOverlapInsertion Φ + let G : SpecialOrthogonal (N k+n) → (Fin 2 → Spin (N k+n) × LabeledLeaf (depth k)) → ℝ := + fun _ => cavitySplitOverlapInsertion Φ + have hmF : Measurable (Function.uncurry F) := + (measurable_of_countable (cavityFullOverlapInsertion Φ)).comp measurable_snd + have hmG : Measurable (Function.uncurry G) := + (measurable_of_countable (cavitySplitOverlapInsertion (N := N k) Φ)).comp measurable_snd + have hFb U σ : |F U σ| ≤ ‖Φ‖ := by + simpa only [F,cavityFullOverlapInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityReplicaOverlap σ) + have hGb U σ : |G U σ| ≤ ‖Φ‖ := by + simpa only [G,cavitySplitOverlapInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityTotalSpinOverlap ((cavitySpinSplit (N k) n (σ 0).1).1, + (cavitySpinSplit (N k) n (σ 1).1).1)) + have hd U σ : |F U σ-G U σ| ≤ ε/2 := by + simpa only [F,G,cavityFullOverlapInsertion,cavitySplitOverlapInsertion,cavityReplicaOverlap, + ← sub_mul,abs_mul,abs_spinValue,one_mul,mul_one] using (hk (σ 0).1 (σ 1).1).le + have hh := restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) + (fun U σ => F U σ-G U σ) (hmF.sub hmG) (show 0 ≤ ε/2 by positivity) hd + rw [restrictedCavityFullDisorderTest_sub (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) F G hmF hmG + (norm_nonneg Φ) hFb hGb] at hh + rw [Real.dist_eq,sub_zero] + exact hh.trans_lt (by linarith) + +theorem restricted_full_split_tree_overlap_test_tendsto {n m : ℕ} + (N depth : ℕ → ℕ) + (S : (k : ℕ) → Finset (Spin (N k+n))) (hS : ∀ k, (S k).Nonempty) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k+n))) [∀ k, IsProbabilityMeasure (μ k)] + (θ : (k : ℕ) → Measure (LabeledTree (depth k))) [∀ k, IsProbabilityMeasure (θ k)] + (eig : (k : ℕ) → Fin (N k+n) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k+n))) (u : ℕ → ℕ → ℝ) + (Φ : ℝ →ᵇ ℝ) : + Tendsto (fun k => + (∫ T, restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) + (cavityFullOverlapInsertion Φ) ∂θ k) - + ∫ T, restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) + (cavitySplitOverlapInsertion Φ) ∂θ k) atTop (𝓝 0) := by + let O := fun k (T : LabeledTree (depth k)) => + restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) + (cavityFullOverlapInsertion Φ) + let C := fun k (T : LabeledTree (depth k)) => + restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) (cavitySplitOverlapInsertion Φ) + have hlim := cavity_average_zero_of_all_selections θ (fun k T => O k T-C k T) + (fun T => restricted_full_split_overlap_test_tendsto N depth S hS hN hNlim μ T eig I u Φ) + apply hlim.congr' + filter_upwards [] with k + have hO : Integrable (O k) (θ k) := integrable_of_measurable_abs_le + (measurable_restrictedFullTest_tree (S k) (hS k) _ _ _ _ _) (fun T => + restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) T (eig k) (I k) (u k) (fun _ => cavityFullOverlapInsertion Φ) + ((measurable_of_countable _).comp measurable_snd) (norm_nonneg Φ) + (fun U σ => by + simpa only [cavityFullOverlapInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityReplicaOverlap σ))) + have hC : Integrable (C k) (θ k) := integrable_of_measurable_abs_le + (measurable_restrictedFullTest_tree (S k) (hS k) _ _ _ _ _) (fun T => + restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) T (eig k) (I k) (u k) (fun _ => cavitySplitOverlapInsertion (N := N k) Φ) + ((measurable_of_countable _).comp measurable_snd) (norm_nonneg Φ) + (fun U σ => by + simpa only [cavitySplitOverlapInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityTotalSpinOverlap + ((cavitySpinSplit (N k) n (σ 0).1).1,(cavitySpinSplit (N k) n (σ 1).1).1)))) + exact integral_sub hO hC + + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitSpinTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitSpinTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7afb422cc23cb25d57f255fd1851f1d4db59f19 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitSpinTest.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Cavity.CavitySplitSpinTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTest +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFullTail + +namespace OAI + +/-! Omitting finitely many cavity sites changes a constrained spin test +by a quantity that vanishes uniformly in the constraint and tree. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BoundedContinuousFunction +namespace InvariantIsing + +theorem restricted_full_split_spin_test_tendsto {n m : ℕ} + (N depth : ℕ → ℕ) + (S : (k : ℕ) → Finset (Spin (N k+n))) (hS : ∀ k, (S k).Nonempty) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k+n))) [∀ k, IsProbabilityMeasure (μ k)] + (T : (k : ℕ) → LabeledTree (depth k)) (eig : (k : ℕ) → Fin (N k+n) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k+n))) (u : ℕ → ℕ → ℝ) + (Φ : ℝ →ᵇ ℝ) (site : Fin n) : + Tendsto (fun k => + restrictedFullTest (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) + (cavityFullSpinInsertion Φ (Fin.natAdd (N k) site)) - + restrictedFullTest (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) + (cavitySplitSpinInsertion Φ site)) atTop (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [cavity_split_test_uniform (n := n) N hN hNlim Φ Φ.continuous + (ε/2) (by positivity)] with k hk + let F : SpecialOrthogonal (N k+n) → (Fin 2 → Spin (N k+n) × LabeledLeaf (depth k)) → ℝ := + fun _ => cavityFullSpinInsertion Φ (Fin.natAdd (N k) site) + let G : SpecialOrthogonal (N k+n) → (Fin 2 → Spin (N k+n) × LabeledLeaf (depth k)) → ℝ := + fun _ => cavitySplitSpinInsertion Φ site + have hmF : Measurable (Function.uncurry F) := + (measurable_of_countable (cavityFullSpinInsertion Φ (Fin.natAdd (N k) site))).comp measurable_snd + have hmG : Measurable (Function.uncurry G) := + (measurable_of_countable (cavitySplitSpinInsertion (N := N k) Φ site)).comp measurable_snd + have hFb U σ : |F U σ| ≤ ‖Φ‖ := by + simpa only [F,cavityFullSpinInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityReplicaOverlap σ) + have hGb U σ : |G U σ| ≤ ‖Φ‖ := by + simpa only [G,cavitySplitSpinInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityTotalSpinOverlap ((cavitySpinSplit (N k) n (σ 0).1).1, + (cavitySpinSplit (N k) n (σ 1).1).1)) + have hd U σ : |F U σ-G U σ| ≤ ε/2 := by + simpa only [F,G,cavityFullSpinInsertion,cavitySplitSpinInsertion,cavityReplicaOverlap, + ← sub_mul,abs_mul,abs_spinValue,one_mul,mul_one] using (hk (σ 0).1 (σ 1).1).le + have hh := restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) + (fun U σ => F U σ-G U σ) (hmF.sub hmG) (show 0 ≤ ε/2 by positivity) hd + rw [restrictedCavityFullDisorderTest_sub (S k) (hS k) (μ k) (T k) (eig k) (I k) (u k) F G hmF hmG + (norm_nonneg Φ) hFb hGb] at hh + rw [Real.dist_eq,sub_zero] + exact hh.trans_lt (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitTreeSpinTest.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitTreeSpinTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..043500e1095137232abe47412e6d3c15f8ff8fd5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedSplitTreeSpinTest.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSplitSpinTest +import OAI.Probability.InvariantIsing.Cavity.CavityUniformTreeLimit + +namespace OAI + +/-! Uniform omission error after averaging over the original random tree. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BoundedContinuousFunction +namespace InvariantIsing + +theorem restricted_full_split_tree_spin_test_tendsto {n m : ℕ} + (N depth : ℕ → ℕ) + (S : (k : ℕ) → Finset (Spin (N k+n))) (hS : ∀ k, (S k).Nonempty) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) + (μ : (k : ℕ) → Measure (SpecialOrthogonal (N k+n))) [∀ k, IsProbabilityMeasure (μ k)] + (θ : (k : ℕ) → Measure (LabeledTree (depth k))) [∀ k, IsProbabilityMeasure (θ k)] + (eig : (k : ℕ) → Fin (N k+n) → ℝ) + (I : (k : ℕ) → Fin m → Finset (Fin (N k+n))) (u : ℕ → ℕ → ℝ) + (Φ : ℝ →ᵇ ℝ) (site : Fin n) : + Tendsto (fun k => + (∫ T, restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) + (cavityFullSpinInsertion Φ (Fin.natAdd (N k) site)) ∂θ k) - + ∫ T, restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) + (cavitySplitSpinInsertion Φ site) ∂θ k) atTop (𝓝 0) := by + let O := fun k (T : LabeledTree (depth k)) => + restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) + (cavityFullSpinInsertion Φ (Fin.natAdd (N k) site)) + let C := fun k (T : LabeledTree (depth k)) => + restrictedFullTest (S k) (hS k) (μ k) T (eig k) (I k) (u k) (cavitySplitSpinInsertion Φ site) + have hlim := cavity_average_zero_of_all_selections θ (fun k T => O k T-C k T) + (fun T => restricted_full_split_spin_test_tendsto N depth S hS hN hNlim μ T eig I u Φ site) + apply hlim.congr' + filter_upwards [] with k + have hO : Integrable (O k) (θ k) := integrable_of_measurable_abs_le + (measurable_restrictedFullTest_tree (S k) (hS k) _ _ _ _ _) (fun T => + restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) T (eig k) (I k) (u k) (fun _ => cavityFullSpinInsertion Φ (Fin.natAdd (N k) site)) + ((measurable_of_countable _).comp measurable_snd) (norm_nonneg Φ) + (fun U σ => by + simpa only [cavityFullSpinInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityReplicaOverlap σ))) + have hC : Integrable (C k) (θ k) := integrable_of_measurable_abs_le + (measurable_restrictedFullTest_tree (S k) (hS k) _ _ _ _ _) (fun T => + restrictedCavityFullDisorderTest_abs_le (S k) (hS k) (μ k) T (eig k) (I k) (u k) (fun _ => cavitySplitSpinInsertion (N := N k) Φ site) + ((measurable_of_countable _).comp measurable_snd) (norm_nonneg Φ) + (fun U σ => by + simpa only [cavitySplitSpinInsertion,abs_mul,abs_spinValue,one_mul,mul_one,Real.norm_eq_abs] + using Φ.norm_coe_le_norm (cavityTotalSpinOverlap + ((cavitySpinSplit (N k) n (σ 0).1).1,(cavitySpinSplit (N k) n (σ 1).1).1)))) + exact integral_sub hO hC + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedStrictFiniteOverlap.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedStrictFiniteOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dff6740f975e1a4e45fd724c6231a304ef848e9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedStrictFiniteOverlap.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityStrictFiniteSpin +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteModelDepth +import OAI.Probability.InvariantIsing.Fields.PriorLabeledOverlapObservable + +namespace OAI + +/-! Exact normalized overlap distribution for the strict finite cavity model. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_finite_normalized_overlap_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (cut : Fin (n + 2) → ℝ) (hcut : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (q : Fin (n + 1) → ℝ) (hq : StrictMono q) + (hp : ∀ j s, s ∈ Ioo (cut j.castSucc) (cut j.succ) → p s = q j) + (htop : q (Fin.last n) < 1) (Φ : ℝ → ℝ) (hΦc : Continuous Φ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let H := cavityFiniteCovariancePath rho lam hrho hsum g p q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p cut q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ ω, cavityWeightedReplicaMean + (cavityLabeledPriorKernel n (H n) (restrictedSpinPrior T hT) ω) + (fun x => Real.exp (cavityLabeledPotential n K L (c • 1) (ω,x))) + (fun ξ => cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p q) + (cavityOverlapObservable Φ hΦc) (ω,ξ)) + ∂cavityLabeledDisorderLaw n (chainExponent cut) S₀ S) = + ∫ t, Φ (p t) ∂pathMeasure := by + intro H S S₀ K L c + have hqmem := fun i => finite_overlap_value_mem_unit p cut hcut q hp i + simp_rw [prior_cavity_labeled_overlap_observable rho lam hrho hsum p q hqmem K (H n) L + (c • 1) (restrictedSpinPrior T hT) Φ hΦc] + exact restricted_cavity_finite_model_depth_test hpub hd hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha p cut hcut hfirst hlast q hq hp htop Φ hΦ + +theorem restricted_strict_finite_overlap_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (Φ : ℝ → ℝ) (hΦc : Continuous Φ) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let q := cavityStrictUniformLevels p n + let p' := cavityStrictUniformPath p n + let H := cavityFiniteCovariancePath rho lam hrho hsum g p' q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p' (uniformCut n) q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p' q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ ω, cavityWeightedReplicaMean + (cavityLabeledPriorKernel n (H n) (restrictedSpinPrior T hT) ω) + (fun x => Real.exp (cavityLabeledPotential n K L (c • 1) (ω,x))) + (fun ξ => cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p' q) + (cavityOverlapObservable Φ hΦc) (ω,ξ)) + ∂cavityLabeledDisorderLaw n (chainExponent (uniformCut n)) S₀ S) = + ∫ t, Φ (p' t) + ∂pathMeasure := by + exact restricted_finite_normalized_overlap_test hpub hd hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha (cavityStrictUniformPath p n) (uniformCut n) (uniformCut_strict n) + (uniformCut_zero n) (uniformCut_last n) (cavityStrictUniformLevels p n) + (cavityStrictUniformLevels_strict p n) (fun i s hs => cavityStrictUniformPath_on_cell p n i hs) + (cavityStrictUniformLevels_mem p n (Fin.last n)).2 Φ hΦc hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedStrictFiniteSpin.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedStrictFiniteSpin.lean new file mode 100644 index 0000000000000000000000000000000000000000..9456e63952046161564133f014eca8f6bda5d602 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedStrictFiniteSpin.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFiniteNormalizedSpin +import OAI.Probability.InvariantIsing.Cavity.CavityStrictFiniteSpin +import OAI.Probability.InvariantIsing.Cavity.CavityFiniteExponentLaw + +namespace OAI + +/-! The actual normalized finite spin identity on the strict uniform +approximants. All finite partition and nondegeneracy premises are proved. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set IsingPerceptron +open scoped Matrix MatrixOrder Matrix.Norms.L2Operator BigOperators NNReal + +namespace InvariantIsing + +theorem restricted_strict_finite_spin_test (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {m d N n : ℕ} (hd : 0 < d) (hN : 0 < N) (T : Finset (Spin N)) (hT : T.Nonempty) + (rho lam : Fin m → ℝ) (hrho : ∀ a, 0 < rho a) (hsum : ∑ a, rho a = 1) + (B : Matrix (Fin (m * N)) (Fin d) ℝ) (hB : B.transpose * B = 1) + (hBE : B.transpose * cavityLimitingStack (n := N) rho = 0) + (hcomplete : B * B.transpose + cavityLimitingStack (n := N) rho * + (cavityLimitingStack (n := N) rho).transpose = 1) + (g : Fin d → Fin m) (a : Fin m) (ha : ∀ b, lam b ≤ lam a) + (p : OverlapPath) (Φ : ℝ → ℝ) (hΦc : Continuous Φ) (j : Fin N) + {C : ℝ} (hΦ : ∀ x, |Φ x| ≤ C) : + let q := cavityStrictUniformLevels p n + let p' := cavityStrictUniformPath p n + let H := cavityFiniteCovariancePath rho lam hrho hsum g p' q + let S := cavityFiniteNoiseCovariance rho lam hrho hsum g p' (uniformCut n) q + let S₀ := cavityFiniteRootCovariance rho lam hrho hsum g p' q + let K := B.transpose * cavityRepeatedSpectrum (n := N) lam * B - + Matrix.diagonal (fun i => lam (g i)) + let L := B.transpose * cavityRepeatedSpectrum (n := N) lam * cavityLimitingStack (n := N) rho + let c := finiteR rho lam hrho hsum 0 + (∫ ω, cavityWeightedReplicaMean + (cavityLabeledPriorKernel n (H n) (restrictedSpinPrior T hT) ω) + (fun x => Real.exp (cavityLabeledPotential n K L (c • 1) (ω,x))) + (fun ξ => cavityLabeledReplicaTest (cavityFiniteReplicaSpectralBlock rho lam hrho hsum p' q) + (cavitySpinObservable Φ hΦc j) (ω,ξ)) + ∂cavityLabeledDisorderLaw n (chainExponent (uniformCut n)) S₀ S) = + ∫ t, Φ (p' t) * restrictedCoordinateOverlapPath hN T hT (cavityStrictUniformField rho lam hrho hsum p n) j t + ∂pathMeasure := by + exact restricted_finite_normalized_spin_test hpub hd hN T hT rho lam hrho hsum B hB hBE hcomplete + g a ha (cavityStrictUniformPath p n) (uniformCut n) (uniformCut_strict n) + (uniformCut_zero n) (uniformCut_last n) (cavityStrictUniformLevels p n) + (cavityStrictUniformLevels_strict p n) (fun i s hs => cavityStrictUniformPath_on_cell p n i hs) + (cavityStrictUniformLevels_mem p n (Fin.last n)).2 Φ hΦc j hΦ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTailEntropy.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTailEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa2b6767995456739fd12cdef65d5678050d777c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTailEntropy.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTailSpinKernel +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldOrder + +namespace OAI + +/-! The entropy of the complete constrained sampling law is bounded by +its actual recursion loss, uniformly in the number of levels. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal + +namespace InvariantIsing + +theorem restrictedTailSpinKernel_entropy {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) (hb1 : ∀ i < n, b i ≤ 1) (z : Fin N → ℝ) : + klDiv (restrictedTailSpinKernel hN S hS n b v hb z) + (restrictedTailSpinKernel hN Finset.univ Finset.univ_nonempty n b v hb z) ≤ + ENNReal.ofReal (restrictedFieldRecursion Finset.univ n b v z - + restrictedFieldRecursion S n b v z) := by + induction n generalizing b v z with + | zero => + change klDiv (restrictedSpinKernel S z) (restrictedSpinKernel Finset.univ z) ≤ _ + rw [restrictedSpinKernel_univ] + have he := restrictedSpinKernel_entropy S hS z + rw [← ENNReal.ofReal_toReal he.1, he.2] + rfl + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + have hbs1 : ∀ i < n, bs i ≤ 1 := fun i hi => hb1 (i + 1) (by omega) + let F := restrictedFieldRecursion (Finset.univ : Finset (Spin N)) n bs vs + let G := restrictedFieldRecursion S n bs vs + have hF := restrictedFieldRecursion_regular hN Finset.univ Finset.univ_nonempty n bs vs hbs + have hG := restrictedFieldRecursion_regular hN S hS n bs vs hbs + let κ := restrictedTailSpinKernel hN S hS n bs vs hbs + let η := restrictedTailSpinKernel hN Finset.univ Finset.univ_nonempty n bs vs hbs + have hac (y : Fin N → ℝ) : κ y ≪ η y := + (klDiv_ne_top_iff.mp (ne_top_of_le_ne_top ENNReal.ofReal_ne_top + (ih bs vs hbs hbs1 y))).1 + have hκ (y : Fin N → ℝ) : kernelRelativeEntropy κ η y ≤ ENNReal.ofReal (F y - G y) := by + rw [kernelRelativeEntropy_eq κ η y (hac y)] + exact ih bs vs hbs hbs1 y + have hg := vectorGaussianTransition_entropy_budget hN (b 0) (hb 0 (by omega)) + (hb1 0 (by omega)) (v 0) F G hF.1 hG.1 hF.2 hG.2 + (fun y => restrictedFieldRecursion_mono hN S Finset.univ hS Finset.univ_nonempty + (Finset.subset_univ S) n bs vs hbs y) z + have he := entropy_budget_drop + (vectorGaussianTransition N (b 0) (v 0) G hG.1 z) + (vectorGaussianTransition N (b 0) (v 0) F hF.1 z) κ η hac + (fun y => ENNReal.ofReal (F y - G y)) hκ + rw [Measure.comp_eq_comp_const_apply, Measure.comp_eq_comp_const_apply] at he + exact he.trans hg + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTailSpinKernel.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTailSpinKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..dabe59888ffe166e601192b17517dc27979dff77 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTailSpinKernel.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedSpinKernel +import OAI.Probability.InvariantIsing.Fields.VectorTransitionEntropy + +namespace OAI + +/-! The actual spin law obtained by successively sampling the constrained +Gaussian recursion and then its terminal Gibbs measure. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped NNReal ENNReal + +namespace InvariantIsing + +def restrictedTailSpinKernel {N : ℕ} (hN : 0 < N) (S : Finset (Spin N)) (hS : S.Nonempty) : + (n : ℕ) → (b : ℕ → ℝ) → (v : ℕ → ℝ≥0) → (∀ i < n, 0 < b i) → + Kernel (Fin N → ℝ) (Spin N) + | 0, _, _, _ => restrictedSpinKernel S + | n + 1, b, v, hb => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + let hbs := fun i hi => hb (i + 1) (by omega) + let hreg := restrictedFieldRecursion_regular hN S hS n bs vs hbs + restrictedTailSpinKernel hN S hS n bs vs hbs ∘ₖ + vectorGaussianTransition N (b 0) (v 0) (restrictedFieldRecursion S n bs vs) hreg.1 + +instance restrictedTailSpinKernel_markov {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (n : ℕ) (b : ℕ → ℝ) (v : ℕ → ℝ≥0) + (hb : ∀ i < n, 0 < b i) : IsMarkovKernel (restrictedTailSpinKernel hN S hS n b v hb) := by + induction n generalizing b v with + | zero => exact restrictedSpinKernel_markov S hS + | succ n ih => + let bs := fun i => b (i + 1) + let vs := fun i => v (i + 1) + have hbs : ∀ i < n, 0 < bs i := fun i hi => hb (i + 1) (by omega) + let _ := ih bs vs hbs + change IsMarkovKernel (_ ∘ₖ _) + infer_instance + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTerminalIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTerminalIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0ffe434e60ea1b41516560b77187782e0a2be55 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTerminalIntegrability.lean @@ -0,0 +1,39 @@ +import OAI.Probability.InvariantIsing.Fields.VectorTerminalLabeled +import OAI.Probability.InvariantIsing.Fields.FieldEnergyCoordinates +import OAI.Probability.InvariantIsing.Magnetic.RestrictedFieldTerminal + +namespace OAI + +/-! Actual ordinary and constrained field terminals have integrable Gibbs weights. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped NNReal BigOperators +namespace InvariantIsing + +theorem restrictedTerminal_exp_integrable_ae {N : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) (h : FieldStep) (z : Fin N → ℝ) : + ∀ᵐ p ∂vectorTerminalCoordinateLaw N h.depth (chainExponent h.cut) (fieldStepVariance h), + Integrable (fun α => Real.exp (restrictedFieldTerminal S + (labeledEnergy h.depth (markForestOfCoords (Fin N → ℝ) h.depth p.2) α z))) + (labeledLeafLaw h.depth p.1) := by + filter_upwards [field_vector_spin_exp_integrable N hN h z] with p hp + have hi := spinLeafTerminal_exp_integrable (labeledLeafLaw h.depth p.1) + (fun s : Spin N × LabeledLeaf h.depth => Real.exp 0 * fieldEnergy (fieldVectorEndpoint N h p z s.2) s.1) (by simpa using hp) + have hfull : Integrable (fun α => Real.exp (∑ j, Real.log (Real.cosh (fieldVectorEndpoint N h p z α j)))) + (labeledLeafLaw h.depth p.1) := by + convert hi using 1 + funext α + congr 1 + simp only [spinLeafTerminal,Real.exp_zero,one_mul] + rw [finiteLogIntegral_uniformSpinPrior,logPartition_fieldEnergy] + apply hfull.mono' (measurable_of_countable _).aestronglyMeasurable + apply ae_of_all + intro α + rw [Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + exact Real.exp_le_exp.mpr (restrictedFieldTerminal_le_univ S hS _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeAverage.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0f30c5558dbbf3025ed4cb2ded5f24a036accb2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeAverage.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityDiracAverage +import OAI.Probability.InvariantIsing.Cavity.CavityRotationRestrictedIntegral +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationProbability + +namespace OAI + +/-! Averaging fixed-tree restricted Gibbs means gives exactly the +physical product-disorder mean with its original random tree. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_tree_average {N m depth q d k r : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (dims : Fin m → ℕ) (E : ((a : Fin m) × Fin (dims a)) ≃ Fin N) + (η : Measure ((a : Fin m) → Orthogonal (dims a))) [IsProbabilityMeasure η] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (e : Fin d → Fin m × Fin q) + (A₀ : (a : Fin m) → Matrix (Fin (dims a)) (Fin q) ℝ) + (K : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] + (T B : ℝ) {M : ℝ} (hM : 0 ≤ M) + (F : (Fin r → (Spin N × LabeledLeaf depth) × Spin k) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + (∫ V, ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability S hS eig I u p.1).prod π) + (fun x => cavityHaarRestrictedWeight e (cavityRotationVectors dims E) A₀ K L C T B (p,x)) + F ∂(((μ.prod (Measure.dirac V)).prod gaussianCoordinates).prod η) ∂θ) = + ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability S hS eig I u p.1).prod π) + (fun x => cavityHaarRestrictedWeight e (cavityRotationVectors dims E) A₀ K L C T B (p,x)) + F ∂(((μ.prod θ).prod gaussianCoordinates).prod η) := by + let ν := restrictedRotationProbability S hS (depth := depth) eig I u + let w := cavityHaarRestrictedWeight e (cavityRotationVectors (depth := depth) dims E) A₀ K L C T B + let κ := cavityHaarSpinPriorKernel (U := (a : Fin m) → Orthogonal (dims a)) + ν (measurable_restrictedRotationProbability S hS eig I u) π + let f := fun p => cavityWeightedReplicaMean (κ p) (fun x => w (p,x)) F + have hw : Measurable w := measurable_cavityHaarRestrictedWeight e + (cavityRotationVectors dims E) (measurable_cavityRotationVectors dims E) A₀ K L C T B + have hf : Measurable f := by + have hh := measurable_cavityRegularizedReplicaMean (fun p => κ p) κ.measurable + w hw (fun p => F p.2) ((measurable_of_countable F).comp measurable_snd) 0 + simpa only [f,cavityRegularizedReplicaMean,add_zero,cavityWeightedReplicaMean] using hh + have hb p : |f p| ≤ M := by + have hh := cavityRegularizedReplicaMean_abs_le (κ p) (fun x => w (p,x)) + (hw.comp measurable_prodMk_left) F (measurable_of_countable F) + (Real.exp_pos T).le hM (δ := 0) le_rfl + (fun x => cavityHaarRestrictedWeight_mem e (cavityRotationVectors dims E) A₀ K L C T B (p,x)) hF + simpa only [f,cavityRegularizedReplicaMean,add_zero,cavityWeightedReplicaMean] using hh + have hh := cavity_bounded_dirac_average μ θ gaussianCoordinates η f hf hb + simpa only [f,κ,cavityHaarSpinPriorKernel_apply,ν,w] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeCutoffMeasurability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeCutoffMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e2b46261bfab560ac94db25bb391799b3da89f6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeCutoffMeasurability.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityRandomPriorCutoff +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPhysicalCutoff + +namespace OAI + +/-! The original cutoff average is measurable in the actual labeled +tree. The Gaussian and rotation coordinates remain unchanged. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +lemma measurable_restrictedCavityFullCutoffDisorderTest_tree {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [SFinite μ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (s : SpecialOrthogonal N → Set (Spin N × LabeledLeaf depth)) + (hs : MeasurableSet {p : SpecialOrthogonal N × (Spin N × LabeledLeaf depth) | + p.2 ∈ s p.1}) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + (hF : Measurable (Function.uncurry F)) : + Measurable (fun T => restrictedCavityFullCutoffDisorderTest S hS μ T eig I u s F) := by + let Ω := (LabeledTree depth × SpecialOrthogonal N) × (ℕ → ℝ) + let X := Spin N × LabeledLeaf depth + let ν : Ω → Measure X := fun p => + labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) p.1.1 + let (p : Ω) : IsProbabilityMeasure (ν p) := by + change IsProbabilityMeasure + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) p.1.1) + infer_instance + have hν : Measurable ν := + (measurable_labeledSpinReference_general depth + (restrictedSpinPrior S hS : Measure (Spin N))).comp measurable_fst.fst + let H : Ω × X → ℝ := fun p => cavityFullHamiltonian eig I u (p.1.1.2,p.1.2) p.2 + have hH : Measurable H := by + have hp : Measurable (fun p : Ω × X => ((p.1.1.2,p.1.2),p.2)) := + (measurable_fst.fst.snd.prodMk measurable_fst.snd).prodMk measurable_snd + exact Measurable.comp + (g := Function.uncurry (cavityFullHamiltonian (depth := depth) eig I u)) + (f := fun p : Ω × X => ((p.1.1.2,p.1.2),p.2)) + (measurable_cavityFullHamiltonian eig I u) hp + have hS : MeasurableSet {p : Ω × X | p.2 ∈ s p.1.1.2} := + hs.preimage (measurable_fst.fst.snd.prodMk measurable_snd) + have hG : Measurable (fun p : Ω × (Fin 2 → X) => F p.1.1.2 p.2) := + hF.comp (measurable_fst.fst.snd.prodMk measurable_snd) + have hh := measurable_random_cavityCutoffReplicaMean ν hν H hH + (fun p => s p.1.2) hS (fun p => F p.1.1.2 p.2) hG + exact ((hh.stronglyMeasurable.integral_prod_right' (ν := gaussianCoordinates)).integral_prod_right' + (ν := μ)).measurable + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeFullRegular.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeFullRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec04a58c3869814fa4ce219cfbcd9b1749b60e0e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeFullRegular.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeCutoffMeasurability +import OAI.Probability.InvariantIsing.Cavity.CavityFullSiteIdentity +import OAI.Probability.InvariantIsing.Cavity.CavityCutoffTotalBound + +namespace OAI + +/-! Bounded full and restricted Gibbs tests can be averaged over the +original labeled-tree law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma measurable_restrictedFullTest_tree {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [SFinite μ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (F : (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) : + Measurable (fun T => restrictedCavityFullDisorderTest S hS μ T eig I u (fun _ => F)) := by + let Ω := (LabeledTree depth × SpecialOrthogonal N) × (ℕ → ℝ) + let X := Spin N × LabeledLeaf depth + let ν : Ω → Measure X := fun p => + labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) p.1.1 + let (p : Ω) : IsProbabilityMeasure (ν p) := by + change IsProbabilityMeasure + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) p.1.1) + infer_instance + have hν : Measurable ν := + (measurable_labeledSpinReference_general depth + (restrictedSpinPrior S hS : Measure (Spin N))).comp measurable_fst.fst + let H : Ω × X → ℝ := fun p => cavityFullHamiltonian eig I u (p.1.1.2,p.1.2) p.2 + have hH : Measurable H := by + have hp : Measurable (fun p : Ω × X => ((p.1.1.2,p.1.2),p.2)) := + (measurable_fst.fst.snd.prodMk measurable_fst.snd).prodMk measurable_snd + exact Measurable.comp + (g := Function.uncurry (cavityFullHamiltonian (depth := depth) eig I u)) + (f := fun p : Ω × X => ((p.1.1.2,p.1.2),p.2)) + (measurable_cavityFullHamiltonian eig I u) hp + have hh := measurable_random_referenceReplicaMean hν hH + (D := fun p => F p.2) ((measurable_of_countable F).comp measurable_snd) + exact ((hh.stronglyMeasurable.integral_prod_right' (ν := gaussianCoordinates)).integral_prod_right' + (ν := μ)).measurable + +lemma restrictedCavityFullCutoffDisorderTest_abs_le {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (T : LabeledTree depth) (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (s : SpecialOrthogonal N → Set (Spin N × LabeledLeaf depth)) + (F : SpecialOrthogonal N → (Fin 2 → Spin N × LabeledLeaf depth) → ℝ) + {M : ℝ} (hM : 0 ≤ M) (hF : ∀ U σ, |F U σ| ≤ M) : + |restrictedCavityFullCutoffDisorderTest S hS μ T eig I u s F| ≤ M := by + have hi U : ‖∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (cavityFullHamiltonian eig I u (U,z)) (s U) (F U) ∂gaussianCoordinates‖ ≤ M := by + have hh := norm_integral_le_of_norm_le_const (μ := gaussianCoordinates) + (f := fun z => cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (cavityFullHamiltonian eig I u (U,z)) (s U) (F U)) + (C := M) (ae_of_all _ fun z => by + simpa only [Real.norm_eq_abs] using cavity_cutoff_replica_abs_le_all + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (cavityFullHamiltonian eig I u (U,z)) (s U) (F U) hM (hF U)) + simpa only [probReal_univ,mul_one] using hh + have hh := norm_integral_le_of_norm_le_const (μ := μ) + (f := fun U => ∫ z, cavityCutoffReplicaMean + (labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) T) + (cavityFullHamiltonian eig I u (U,z)) (s U) (F U) ∂gaussianCoordinates) + (C := M) (ae_of_all _ hi) + simpa only [restrictedCavityFullCutoffDisorderTest,Real.norm_eq_abs,probReal_univ,mul_one] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeLogIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeLogIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..13e7f918f2ee61397bbd8ef94b1527d02b3fd0be --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeLogIntegrability.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeLogMeasurability +import OAI.Probability.InvariantIsing.Magnetic.RestrictedCanonicalLogIntegrability + +namespace OAI + +/-! The canonical capped logarithm remains integrable after averaging +an arbitrary finite cascade law and the independent compression data. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma integrable_restricted_canonical_tree_log {Ω : Type*} [MeasurableSpace Ω] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (P : Measure Ω) [IsProbabilityMeasure P] + (ν : Measure (Orthogonal N)) [IsProbabilityMeasure ν] + (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (k : Fin m → ℕ) (e : (((a : Fin m) × Fin (k a)) ⊕ Fin d) ≃ Fin N) + (a₀ : Fin d → Fin m) (lam v : Fin m → ℝ) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) (t cap δ : ℝ) (hcap : 0 ≤ cap) + (A : Ω → CavityFactorBlocks d n) (hA : Measurable A) {D : ℝ} + (hAb : ∀ ω, cavityFactorSize (A ω).1 (A ω).2.1 (A ω).2.2 ≤ D) : + Integrable (fun z : LabeledTree depth × (Ω × Orthogonal N) => + restrictedProjectorCappedLog S hS C hC z.1 (fun a => t*lam a+2*perturbationScale N*v a) + u t cap δ (A z.2.1) + (cavityLabeledProjectorAction z.2.2 (cavityCanonicalProjectorFrame k e a₀))) + (θ.prod (P.prod ν)) := by + have hp : Measurable (fun z : LabeledTree depth × (Ω × Orthogonal N) => + cavityLabeledProjectorAction z.2.2 (cavityCanonicalProjectorFrame k e a₀)) := + (measurable_cavityCanonicalProjectorAction k e a₀).comp measurable_snd.snd + have hm := measurable_restrictedProjectorCappedLog_tree S hS C hC Prod.fst measurable_fst + (fun a => t*lam a+2*perturbationScale N*v a) u t cap δ + (fun z : LabeledTree depth × (Ω × Orthogonal N) => A z.2.1) + (hA.comp measurable_snd.fst) _ hp + apply Integrable.of_bound hm.aestronglyMeasurable ((|t| *D+|δ|)*(1+N)) + exact ae_of_all _ fun z => by + rw [Real.norm_eq_abs] + exact restricted_canonical_capped_log_bound S hS C hC k e a₀ z.2.2 z.1 lam v u hu + t cap δ hcap (A z.2.1) (hAb z.2.1) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeLogMeasurability.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeLogMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..65ba5b47d2e5a153def1971d46068387d00e9f46 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeLogMeasurability.lean @@ -0,0 +1,101 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedProjectorLog +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationLogMean +import OAI.Probability.InvariantIsing.Cavity.CavityRotationProbability + +namespace OAI + +/-! Joint measurability of the actual logarithms when the finite cascade +is randomized. This permits averaging the physical increment over trees. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma measurable_restrictedProjectorCappedLog_tree {Ω : Type*} [MeasurableSpace Ω] + {N n m d depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) (C : Finset (Spin n)) (hC : C.Nonempty) (T : Ω → LabeledTree depth) (hT : Measurable T) (c : Fin m → ℝ) (u : ℕ → ℝ) + (t cap δ : ℝ) (A : Ω → CavityFactorBlocks d n) (hA : Measurable A) + (p : Ω → CavityProjectorFrame N m d) (hp : Measurable p) : + Measurable (fun ω => restrictedProjectorCappedLog S hS C hC (T ω) c u t cap δ (A ω) (p ω)) := by + let X := (Spin N × LabeledLeaf depth) × Spin n + let H := fun q : (Ω × (ℕ → ℝ)) × X => + cavityProjectorHamiltonian (p q.1.1).1 c u q.1.2 q.2.1 + let W := fun q : (Ω × (ℕ → ℝ)) × X => Real.exp + (min (t*cavityLogFactor (A q.1.1).1 (A q.1.1).2.1 (A q.1.1).2.2 + (cavityFrameCoordinates (p q.1.1).2 q.2.1.1) q.2.2) cap - + δ*(1+‖cavityFrameCoordinates (p q.1.1).2 q.2.1.1‖^2)) + have hH : Measurable H := by + dsimp only [H] + let π : (Ω × (ℕ → ℝ)) × X → + (Ω × (ℕ → ℝ)) × (Spin N × LabeledLeaf depth) := fun q => (q.1,q.2.1) + have hπ : Measurable π := measurable_fst.prodMk measurable_snd.fst + have hb := measurable_cavityProjectorHamiltonian_pullback + (N := N) (m := m) (depth := depth) (fun ω => (p ω).1) hp.fst c u + have hh := hb.comp hπ + simpa only [Function.comp_def, π] using hh + have hW : Measurable W := by + apply measurable_from_prod_countable_left + intro x + have hy : Measurable (fun q : Ω × (ℕ → ℝ) => + cavityFrameCoordinates (p q.1).2 x.1.1) := + ((continuous_cavityFrameCoordinates x.1.1).measurable.comp hp.snd).comp measurable_fst + have hb : Measurable (fun q : Ω × (ℕ → ℝ) => + cavityLogFactor (A q.1).1 (A q.1).2.1 (A q.1).2.2 + (cavityFrameCoordinates (p q.1).2 x.1.1) x.2) := + (measurable_cavityBlockPotential A hA (fun ω => (p ω).2) hp.snd x.1.1 x.2).comp + measurable_fst + exact (((hb.const_mul t).min measurable_const).sub + ((measurable_const.add (hy.norm.pow_const 2)).const_mul δ)).exp + let ν₀ : Ω × (ℕ → ℝ) → Measure (Spin N × LabeledLeaf depth) := fun q => + labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) (T q.1) + have hν₀ : Measurable ν₀ := + (measurable_labeledSpinReference_general depth (restrictedSpinPrior S hS : Measure (Spin N))).comp + (hT.comp measurable_fst) + let κ : Kernel (Ω × (ℕ → ℝ)) (Spin N × LabeledLeaf depth) := Kernel.mk ν₀ hν₀ + let : IsMarkovKernel κ := ⟨fun q => inferInstanceAs (IsProbabilityMeasure (ν₀ q))⟩ + have hν : Measurable (fun q => (ν₀ q).prod (restrictedSpinPrior C hC : Measure (Spin n))) := by + have hh : Measurable (fun q => (κ.prod (Kernel.const (Ω × (ℕ → ℝ)) + (restrictedSpinPrior C hC : Measure (Spin n)))) q) := + (κ.prod (Kernel.const (Ω × (ℕ → ℝ)) (restrictedSpinPrior C hC : Measure (Spin n)))).measurable + simpa only [Kernel.prod_apply, Kernel.const_apply, Kernel.coe_mk, κ] using hh + exact (measurable_random_tilted_integral + (ν := fun q => (ν₀ q).prod (restrictedSpinPrior C hC : Measure (Spin n))) + hν hH hW).log.stronglyMeasurable + |>.integral_prod_right' |>.measurable + +lemma measurable_restrictedRotationLogMean_tree {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + Measurable (fun q : Orthogonal N × LabeledTree depth => + restrictedRotationLogMean S hS q.2 eig I u q.1) := by + let ν : (Orthogonal N × LabeledTree depth) × (ℕ → ℝ) → + Measure (Spin N × LabeledLeaf depth) := fun q => + labeledSpinReference depth (restrictedSpinPrior S hS : Measure (Spin N)) q.1.2 + have hν : Measurable ν := + (measurable_labeledSpinReference_general depth (restrictedSpinPrior S hS : Measure (Spin N))).comp + measurable_fst.snd + exact (measurable_random_referencePartition hν + (measurable_cavityRotationProbabilityHamiltonian eig I u)).log.stronglyMeasurable + |>.integral_prod_right' |>.measurable + +lemma integrable_restrictedRotationLogMean_tree {N m depth : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (θ : Measure (LabeledTree depth)) [IsProbabilityMeasure θ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (hu : ∀ j, |u j| ≤ 2) : + Integrable (fun q : Orthogonal N × LabeledTree depth => + restrictedRotationLogMean S hS q.2 eig I u q.1) (μ.prod θ) := by + apply Integrable.of_bound + (measurable_restrictedRotationLogMean_tree S hS eig I u).aestronglyMeasurable + (1+2*((∑ i, |eig i|)*N/2)^2+8*Real.exp (2*(4*(N*perturbationScale N^2)))) + exact ae_of_all _ fun q => by + rw [Real.norm_eq_abs] + exact restrictedRotationLogMean_bound S hS q.2 eig I u hu q.1 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreePressureIncrement.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreePressureIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c442c5a75f219c919edb52da765ce4eb327199b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreePressureIncrement.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureIncrement +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeLogIntegrability + +namespace OAI + +/-! Averaging the literal physical pressure increment over the common +finite cascade law, with no integrability assumptions left to the caller. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_tree_pressure_capped_increment {N n m d depth : ℕ} (hN : 0 cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀ + (cavityCompressionGrams g U) + let q := fun V => cavityLabeledProjectorAction V (cavityCanonicalProjectorFrame k e a₀) + let c := fun a => t*lam a+2*perturbationScale N*v a + let δ := cavityDeterministicRate n m (2*(2*n+1)) N+ + 2*cavityCovarianceRate n (2*n+1) N + let I₀ := cavityBaseGroup k e a₀ + let eig₀ := diagonalPerturbedEigenvalues + (fun i => lam (Sum.elim (fun w => w.1) a₀ (e.symm i))) I₀ v t + let I := cavitySpectralGroup g + let eig := diagonalPerturbedEigenvalues (fun i => lam (g i)) I v t + (∫ T, ∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) + ∂μ.prod ν ∂θ) ≤ + (∫ z, restrictedRotationLogMean (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) z.2 eig I u z.1 ∂μ.prod θ) - + ∫ z, restrictedRotationLogMean S hS z.2 eig₀ I₀ u z.1 ∂ν.prod θ := by + intro A q c δ I₀ eig₀ I eig + have hmA : Measurable A := + (measurable_cavityCompressionFactorBlocks es lam (fun j => lam (a₀ j)) B₀).comp + (measurable_cavityCompressionGrams g) + have hiA := integrable_restricted_canonical_tree_log S hS C hC μ ν θ k e a₀ lam v u hu + t cap δ hcap A hmA + (fun U => cavity_compression_factor_size_bound g es lam (fun j => lam (a₀ j)) B₀ U) + have hiF := integrable_restrictedRotationLogMean_tree (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) μ θ eig I u hu + have hiB := integrable_restrictedRotationLogMean_tree S hS ν θ eig₀ I₀ u hu + have hle : (∫ T, ∫ z, restrictedProjectorCappedLog S hS C hC T c u t cap δ (A z.1) (q z.2) + ∂μ.prod ν ∂θ) ≤ + ∫ T, ((∫ U, restrictedRotationLogMean (cavityProductSlice S C) (cavityProductSlice_nonempty S hS C hC) T eig I u U ∂μ) - + ∫ V, restrictedRotationLogMean S hS T eig₀ I₀ u V ∂ν) ∂θ := by + apply integral_mono hiA.integral_prod_left (hiF.integral_prod_right.sub hiB.integral_prod_right) + intro T + exact restricted_pressure_capped_increment hN S hS C hC g k ek e es B₀ a₀ l r hg hln hr + μ ν T lam v hv u hu t cap hcap + rw [integral_sub hiF.integral_prod_right hiB.integral_prod_right, + ← integral_prod_symm _ hiF, ← integral_prod_symm _ hiB] at hle + exact hle + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeRegular.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..263293cb9567e36b77c30d197e5103d95636de7b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedTreeRegular.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedTreeAverage + +namespace OAI + +/-! Measurability and boundedness of the fixed-tree physical restricted +mean needed to restore the random cascade prior. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +theorem restricted_tree_regular {N m depth q d k r : ℕ} + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (dims : Fin m → ℕ) (E : ((a : Fin m) × Fin (dims a)) ≃ Fin N) + (η : Measure ((a : Fin m) → Orthogonal (dims a))) [IsProbabilityMeasure η] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) + (e : Fin d → Fin m × Fin q) + (A₀ : (a : Fin m) → Matrix (Fin (dims a)) (Fin q) ℝ) + (K : Matrix (Fin d) (Fin d) ℝ) (L : Matrix (Fin d) (Fin k) ℝ) + (C : Matrix (Fin k) (Fin k) ℝ) (π : Measure (Spin k)) [IsProbabilityMeasure π] + (T B : ℝ) {M : ℝ} (hM : 0 ≤ M) + (F : (Fin r → (Spin N × LabeledLeaf depth) × Spin k) → ℝ) + (hF : ∀ σ, |F σ| ≤ M) : + Measurable (fun V : LabeledTree depth => + ∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability S hS eig I u p.1).prod π) + (fun x => cavityHaarRestrictedWeight e (cavityRotationVectors dims E) A₀ K L C T B (p,x)) + F ∂(((μ.prod (Measure.dirac V)).prod gaussianCoordinates).prod η)) ∧ + ∀ V : LabeledTree depth, + |∫ p, cavityWeightedReplicaMean ((restrictedRotationProbability S hS eig I u p.1).prod π) + (fun x => cavityHaarRestrictedWeight e (cavityRotationVectors dims E) A₀ K L C T B (p,x)) + F ∂(((μ.prod (Measure.dirac V)).prod gaussianCoordinates).prod η)| ≤ M := by + let ν := restrictedRotationProbability S hS (depth := depth) eig I u + let w := cavityHaarRestrictedWeight e (cavityRotationVectors (depth := depth) dims E) A₀ K L C T B + let κ := cavityHaarSpinPriorKernel (U := (a : Fin m) → Orthogonal (dims a)) + ν (measurable_restrictedRotationProbability S hS eig I u) π + let f := fun p => cavityWeightedReplicaMean (κ p) (fun x => w (p,x)) F + have hw : Measurable w := measurable_cavityHaarRestrictedWeight e + (cavityRotationVectors dims E) (measurable_cavityRotationVectors dims E) A₀ K L C T B + have hf : Measurable f := by + have hh := measurable_cavityRegularizedReplicaMean (fun p => κ p) κ.measurable + w hw (fun p => F p.2) ((measurable_of_countable F).comp measurable_snd) 0 + simpa only [f,cavityRegularizedReplicaMean,add_zero,cavityWeightedReplicaMean] using hh + have hb p : |f p| ≤ M := by + have hh := cavityRegularizedReplicaMean_abs_le (κ p) (fun x => w (p,x)) + (hw.comp measurable_prodMk_left) F (measurable_of_countable F) + (Real.exp_pos T).le hM (δ := 0) le_rfl + (fun x => cavityHaarRestrictedWeight_mem e (cavityRotationVectors dims E) A₀ K L C T B (p,x)) hF + simpa only [f,cavityRegularizedReplicaMean,add_zero,cavityWeightedReplicaMean] using hh + constructor + · have hh := measurable_cavity_bounded_dirac_integral μ gaussianCoordinates η f hf hb + simpa only [f,κ,cavityHaarSpinPriorKernel_apply,ν,w] using hh + · intro V + have hh := abs_integral_le_const_of_bound + (μ := ((μ.prod (Measure.dirac V)).prod gaussianCoordinates).prod η) hf hb + simpa only [f,κ,cavityHaarSpinPriorKernel_apply,ν,w] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedZeroTreeArrayLaw.lean b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedZeroTreeArrayLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff96176803db0421d9d6e26d15b7940a36baf687 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Magnetic/RestrictedZeroTreeArrayLaw.lean @@ -0,0 +1,112 @@ +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPriorGaussianLaw +import OAI.Probability.InvariantIsing.Cavity.CavityOrientationArrayLaw +import OAI.Probability.InvariantIsing.Magnetic.RestrictedRotationArray +import OAI.Probability.InvariantIsing.Fields.PriorArrayLaw +import OAI.Probability.InvariantIsing.Cavity.CavityBaseAmplitude +import OAI.Probability.InvariantIsing.Fields.PriorLimitingGG + +namespace OAI + +/-! Exact physical constrained array law with the trivial auxiliary tree. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +namespace InvariantIsing + +def restrictedZeroTreePrior {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + Measure (Spin N × LabeledLeaf 0) := + labeledSpinReference 0 (restrictedSpinPrior S hS : Measure (Spin N)) PUnit.unit + +instance restrictedZeroTreePrior_probability {N : ℕ} (S : Finset (Spin N)) (hS : S.Nonempty) : + IsProbabilityMeasure (restrictedZeroTreePrior S hS) := by + unfold restrictedZeroTreePrior + exact labeledSpinReference_probability 0 (restrictedSpinPrior S hS : Measure (Spin N)) PUnit.unit + +theorem restricted_zero_tree_array_law {N m : ℕ} (hN : 0 < N) + (S : Finset (Spin N)) (hS : S.Nonempty) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] + (ρ : Measure (LabeledTree 0)) [IsProbabilityMeasure ρ] + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (u : ℕ → ℝ) : + restrictedRotationArrayLaw S hS μ ρ eig I u = + priorNamespacedArrayLaw (cavityOrientedBaseLaw hN μ) (restrictedZeroTreePrior S hS) + eig (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N (fun j => u j)) + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) := by + let Ω := Orthogonal N × LabeledTree 0 + let Ξ := SpecialOrthogonal N + let X := Spin N × LabeledLeaf 0 + let φ : Ω → Ξ := fun p => cavityOrientationLift hN p.1⁻¹ + let P : Measure Ω := μ.prod ρ + let Q : Measure Ξ := cavityOrientedBaseLaw hN μ + have hφ : MeasurePreserving φ P Q := + (cavityOrientedBaseLaw_preserving hN μ).comp (measurePreserving_fst (μ := μ) (ν := ρ)) + let η : Ξ × (ℕ → ℝ) → Measure X := priorNamespacedReference (restrictedZeroTreePrior S hS) + eig (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N (fun j => u j)) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) 0 + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i) + have hη : Measurable η := measurable_priorNamespacedReference (restrictedZeroTreePrior S hS) + eig (fun _ => 0) I (fun j : Fin N => enumeratedSpectralDegree m j) + (tensorPerturbationAmplitude N (fun j => u j)) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) 0 + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i) + let ν : Ω × (ℕ → ℝ) → Measure X := restrictedRotationProbability S hS eig I u + have hν : Measurable ν := measurable_restrictedRotationProbability S hS eig I u + let (p : Ω × (ℕ → ℝ)) : IsProbabilityMeasure (ν p) := + restrictedRotationProbability_probability S hS eig I u p + let (p : Ξ × (ℕ → ℝ)) : IsProbabilityMeasure (η p) := + priorNamespacedReference_probability (restrictedZeroTreePrior S hS) eig (fun _ => 0) I + (fun j : Fin N => enumeratedSpectralDegree m j) (tensorPerturbationAmplitude N (fun j => u j)) + (fun i => tensorPathProfile I (fun j : Fin N => enumeratedSpectralDegree m j) 0 + (fun j : Fin N => enumeratedTreeDegree m j) (fun _ => 0) i) p + let (p : Ω × (ℕ → ℝ)) : IsProbabilityMeasure (η (φ p.1,p.2)) := by infer_instance + let A : Ξ → (ℕ → X) → SpectralArray (m+1) := fun U σ ij => + spectralJointEntry (specialRotation U) I 0 (σ ij.1) (σ ij.2) + have hA : Measurable (Function.uncurry A) := + measurable_spectralReplicaArray (Ω := Ξ) id measurable_id I 0 + let φS : Ω × (ℕ → X) → Ξ × (ℕ → X) := fun p => (φ p.1,p.2) + have hφS : Measurable φS := hφ.measurable.prodMap measurable_id + have hAφ : Measurable (Function.uncurry (fun ω => A (φ ω))) := by + have hh := hA.comp hφS + exact hh + let φZ : Ω × (ℕ → ℝ) → Ξ × (ℕ → ℝ) := fun p => (φ p.1,p.2) + have hφZ : Measurable φZ := hφ.measurable.prodMap measurable_id + have hηφ : Measurable (fun p : Ω × (ℕ → ℝ) => η (φ p.1,p.2)) := hη.comp hφZ + have he (ω : Ω) : gaussianCoordinates.map (fun z => ν (ω,z)) = + gaussianCoordinates.map (fun z => η (φ ω,z)) := by + have hT : ω.2 = (PUnit.unit : LabeledTree 0) := Subsingleton.elim _ _ + simpa only [ν,η,φ,restrictedZeroTreePrior,hT] using + restricted_orientation_prior_probability_law hN S hS ω.1 ω.2 eig I u + have hc := cavity_observed_replica_law_congr P gaussianCoordinates ν + (fun p => η (φ p.1,p.2)) hν hηφ he (fun ω => A (φ ω)) hAφ + have ht := cavity_observed_replica_law_transport P Q gaussianCoordinates φ hφ η hη A hA + have ho : (fun p : (Ω × (ℕ → ℝ)) × (ℕ → X) => A (φ p.1.1) p.2) = + cavitySampledEntryArray (cavityRotationEntry I) := by + funext p ij + exact cavityOrientationLift_jointEntry hN p.1.1.1⁻¹ I (p.2 ij.1) (p.2 ij.2) + apply Subtype.ext + change (disorderReplicaLaw (P.prod gaussianCoordinates) ν hν).map + (cavitySampledEntryArray (cavityRotationEntry I)) = + (disorderReplicaLaw (Q.prod gaussianCoordinates) η hη).map (fun p => A p.1.1 p.2) + rw [ho] at hc ht + exact hc.trans ht + +lemma restricted_zero_tree_perturbed_array_law {N m : ℕ} (hN : 0 0) I u v t (fun _ => 0) := by + unfold priorPerturbedArrayLaw + simpa only [cavityBaseAmplitude_restrict] using + restricted_zero_tree_array_law hN S hS μ ρ (diagonalPerturbedEigenvalues eig I v t) + I (cavityBaseAmplitude u) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/AlmostSure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/AlmostSure.lean new file mode 100644 index 0000000000000000000000000000000000000000..d290a94cc1e6d00f948c096847d8a838dcde66c5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/AlmostSure.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Pressure.Concentration + +namespace OAI + +/-! +# Almost-sure concentration without independence across dimensions + +A countable Borel–Cantelli argument upgrades Haar tails to almost-sure +concentration of the pressure about its medians. +-/ + +noncomputable section + +open MeasureTheory Filter +open scoped Topology NNReal ENNReal + +namespace InvariantIsing + +/-- Summable exponential tails imply almost-sure convergence to zero. No +independence between the random variables is required. -/ +lemma ae_tendsto_zero_of_exponential_tail {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : ℕ → Ω → ℝ) + (htail : ∀ ε : ℝ, 0 < ε → ∃ C a : ℝ, 0 ≤ C ∧ 0 < a ∧ + ∀ n, μ.real {ω | ε ≤ |f n ω|} ≤ C * Real.exp (-a * (n : ℝ))) : + ∀ᵐ ω ∂μ, Tendsto (fun n => f n ω) atTop (𝓝 0) := by + have hb (k : ℕ) : ∀ᵐ ω ∂μ, ∀ᶠ n in atTop, + ¬ (1 / (k + 1 : ℝ) ≤ |f n ω|) := by + have hk : 0 < 1 / (k + 1 : ℝ) := by positivity + obtain ⟨C, a, hC, ha, ht⟩ := htail _ hk + have hsum : Summable (fun n : ℕ => C * Real.exp (-a * (n : ℝ))) := by + simp_rw [mul_comm (-a), Real.exp_nat_mul] + exact (summable_geometric_of_lt_one (Real.exp_pos (-a)).le + (Real.exp_lt_one_iff.mpr (neg_neg_of_pos ha))).mul_left C + let q : ℕ → ℝ≥0 := fun n => NNReal.mk (C * Real.exp (-a * (n : ℝ))) + (mul_nonneg hC (Real.exp_pos _).le) + have hq : Summable q := (NNReal.summable_coe (f := q)).mp hsum + have hfinite : (∑' n, (q n : ENNReal)) ≠ ∞ := + ENNReal.tsum_coe_ne_top_iff_summable.mpr hq + have hbound (n : ℕ) : μ {ω | 1 / (k + 1 : ℝ) ≤ |f n ω|} ≤ (q n : ENNReal) := by + rw [← ENNReal.ofReal_toReal (measure_ne_top μ {ω | 1 / (k + 1 : ℝ) ≤ |f n ω|})] + change ENNReal.ofReal (μ.real {ω | 1 / (k + 1 : ℝ) ≤ |f n ω|}) ≤ _ + simpa only [q, ENNReal.ofReal_eq_coe_nnreal (mul_nonneg hC (Real.exp_pos _).le)] using + ENNReal.ofReal_le_ofReal (ht n) + exact ae_eventually_notMem (s := fun n => {ω | 1 / (k + 1 : ℝ) ≤ |f n ω|}) + (ne_top_of_le_ne_top hfinite (ENNReal.tsum_le_tsum hbound)) + filter_upwards [ae_all_iff.mpr hb] with ω hω + apply Metric.tendsto_atTop.mpr + intro ε hε + obtain ⟨k, hk⟩ := exists_nat_one_div_lt hε + obtain ⟨N, hN⟩ := eventually_atTop.mp (hω k) + refine ⟨N, ?_⟩ + intro n hn + simpa only [Real.dist_eq, sub_zero] using lt_trans (lt_of_not_ge (hN n hn)) hk + +/-- For an arbitrary joint realization of the Haar matrices, pressure is almost +surely close to a deterministic sequence of medians. -/ +theorem ae_pressure_sub_median_tendsto_zero (hpub : HaarConcentrationInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (n : ℕ) → Ω → SpecialOrthogonal (n + 3)) + (hU : ∀ n, Measurable (U n)) + (hHaar : ∀ n, (P.map (U n)).IsMulLeftInvariant) + (eig c : (n : ℕ) → Fin (n + 3) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ n i, |eig n i| ≤ K) : + ∃ m : ℕ → ℝ, ∀ᵐ ω ∂P, + Tendsto (fun n => rotatedPressure (eig n) (specialRotation (U n ω)) (c n) - m n) + atTop (𝓝 0) := by + obtain ⟨C, a, hC, ha, ht⟩ := haar_pressure_median_tail hpub + have hm (n : ℕ) : ∃ m : ℝ, + ∀ r : ℝ, 0 < r → + (P.map (U n)).real {V | r ≤ |rotatedPressure (eig n) (specialRotation V) (c n) - m|} ≤ + C * Real.exp (-a * (n + 3 : ℝ) * r ^ 2 / K ^ 2) := by + have hp : IsProbabilityMeasure (P.map (U n)) := + (Measure.isProbabilityMeasure_map_iff (hU n).aemeasurable).mpr inferInstance + obtain ⟨m, _, _, hm⟩ := ht (n + 3) (by omega) (P.map (U n)) hp (hHaar n) + (eig n) (c n) K hK (heig n) + exact ⟨m, by simpa only [Nat.cast_add, Nat.cast_ofNat] using hm⟩ + choose m hm using hm + refine ⟨m, ae_tendsto_zero_of_exponential_tail P _ ?_⟩ + intro ε hε + refine ⟨C, a * ε ^ 2 / K ^ 2, hC.le, by positivity, ?_⟩ + intro n + have hs : MeasurableSet {V : SpecialOrthogonal (n + 3) | + ε ≤ |rotatedPressure (eig n) (specialRotation V) (c n) - m n|} := + measurableSet_le measurable_const ((measurable_rotatedPressure _ _).sub_const _).abs + have hb := hm n ε hε + rw [measureReal_def, Measure.map_apply (hU n) hs] at hb + change P.real {ω | ε ≤ |rotatedPressure (eig n) (specialRotation (U n ω)) (c n) - m n|} ≤ _ at hb + refine hb.trans ?_ + apply mul_le_mul_of_nonneg_left _ hC.le + apply Real.exp_le_exp.mpr + have hnonneg : 0 ≤ a * ε ^ 2 / K ^ 2 := by positivity + calc + -a * ((n : ℝ) + 3) * ε ^ 2 / K ^ 2 = + -(a * ε ^ 2 / K ^ 2) * ((n : ℝ) + 3) := by ring + _ ≤ -(a * ε ^ 2 / K ^ 2) * (n : ℝ) := + mul_le_mul_of_nonpos_left (by linarith) (neg_nonpos.mpr hnonneg) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/Concentration.lean b/lean/OAI/Probability/InvariantIsing/Pressure/Concentration.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5be893a13057bbab5f99b7b207c4c7bf244decb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/Concentration.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Pressure.PressureLipschitz + +namespace OAI + +/-! +# Haar concentration for Ising pressure + +Frobenius Lipschitz continuity and measurability give concentration of the +Ising pressure about a median. +-/ + +noncomputable section + +open MeasureTheory +open scoped BigOperators + +namespace InvariantIsing + +lemma measurable_specialRotation_eval {N : ℕ} (v : EuclideanSpace ℝ (Fin N)) + (i : Fin N) : Measurable (fun U : SpecialOrthogonal N => specialRotation U v i) := by + simp only [specialRotation_apply] + apply Finset.measurable_sum + intro j _ + have he : Measurable (fun U : SpecialOrthogonal N => + (U : Matrix (Fin N) (Fin N) ℝ) i j) := + (measurable_pi_apply j).comp ((measurable_pi_apply i).comp measurable_subtype_coe) + exact he.mul_const (v j) + +lemma measurable_rotatedPressure {N : ℕ} (eig c : Fin N → ℝ) : + Measurable (fun U : SpecialOrthogonal N => rotatedPressure eig (specialRotation U) c) := by + have hE (σ : Spin N) : Measurable (fun U : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ) := by + exact ((Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector σ) i).pow_const 2).const_mul + (eig i)).const_mul (1 / 2 : ℝ)).add_const _ + unfold rotatedPressure logPartition + exact ((Finset.measurable_sum _ fun σ _ => (hE σ).exp).const_mul + (Fintype.card (Spin N) : ℝ)⁻¹).log.const_mul (N : ℝ)⁻¹ + +/-- Uniform concentration about a median for the actual spectral-orbit pressure, +conditional only on the cited concentration theorem. No pressure limit is an +assumption or a conclusion of this finite-volume estimate. -/ +theorem haar_pressure_median_tail (hpub : HaarConcentrationInput) : + ∃ C c₀ : ℝ, 0 < C ∧ 0 < c₀ ∧ + ∀ N : ℕ, 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), + IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ eig c : Fin N → ℝ, ∀ K : ℝ, 0 < K → (∀ i, |eig i| ≤ K) → + ∃ m : ℝ, + (1 / 2 : ℝ) ≤ μ.real {U | rotatedPressure eig (specialRotation U) c ≤ m} ∧ + (1 / 2 : ℝ) ≤ μ.real {U | m ≤ rotatedPressure eig (specialRotation U) c} ∧ + ∀ r : ℝ, 0 < r → + μ.real {U | r ≤ |rotatedPressure eig (specialRotation U) c - m|} ≤ + C * Real.exp (-c₀ * (N : ℝ) * r ^ 2 / K ^ 2) := by + obtain ⟨C, c₀, hC, hc, hp⟩ := hpub + refine ⟨C, c₀, hC, hc, ?_⟩ + intro N hN μ hμ hμinv eig c K hK heig + exact hp N hN μ hμ hμinv _ (measurable_rotatedPressure eig c) K hK + (fun U V => abs_rotatedPressure_sub_rotation_le (by omega) eig U V c K hK.le heig) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/EntropyBudget.lean b/lean/OAI/Probability/InvariantIsing/Pressure/EntropyBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..f847eda4dcd0a55bdbdbcb59e01de8484a77bcec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/EntropyBudget.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Core.KernelRelativeEntropy +import OAI.Probability.InvariantIsing.Core.TiltedRelativeEntropy + +namespace OAI + +/-! Nonnegative entropy budgets for successive finite sampling steps. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory IsingPerceptron +open scoped ENNReal + +namespace InvariantIsing + +lemma entropy_budget_of_real {X : Type*} [MeasurableSpace X] + (μ ν : Measure X) (D : X → ℝ) (hD : Integrable D μ) (hD0 : ∀ x, 0 ≤ D x) + {c : ℝ} (hK : klDiv μ ν ≠ ⊤) (h : (klDiv μ ν).toReal + (∫ x, D x ∂μ) ≤ c) : + klDiv μ ν + (∫⁻ x, ENNReal.ofReal (D x) ∂μ) ≤ ENNReal.ofReal c := by + rw [← ofReal_integral_eq_lintegral_ofReal hD (Filter.Eventually.of_forall hD0), + ← ENNReal.ofReal_toReal hK, ← ENNReal.ofReal_add ENNReal.toReal_nonneg + (integral_nonneg hD0)] + exact ENNReal.ofReal_le_ofReal h + +lemma entropy_budget_drop {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + [MeasurableSpace.CountableOrCountablyGenerated X Y] + (μ ν : Measure X) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + (κ η : Kernel X Y) [IsMarkovKernel κ] [IsMarkovKernel η] + (hac : ∀ x, κ x ≪ η x) (D : X → ℝ≥0∞) + (h : ∀ x, kernelRelativeEntropy κ η x ≤ D x) : + klDiv (κ ∘ₘ μ) (η ∘ₘ ν) ≤ klDiv μ ν + ∫⁻ x, D x ∂μ := + (klDiv_comp_le_integral μ ν κ η hac).trans (add_le_add_right (lintegral_mono h) _) + +lemma entropy_budget_map {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + (μ ν : Measure X) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + (f : X → Y) (hf : Measurable f) (D : Y → ℝ≥0∞) (hD : Measurable D) : + klDiv (μ.map f) (ν.map f) + (∫⁻ y, D y ∂μ.map f) ≤ + klDiv μ ν + ∫⁻ x, D (f x) ∂μ := by + rw [lintegral_map hD hf] + exact add_le_add_left (klDiv_map_le μ ν hf) _ + +lemma tilted_pair_entropy_budget_ennreal {X : Type*} [MeasurableSpace X] + (μ : Measure X) [IsProbabilityMeasure μ] (F G : X → ℝ) + {b : ℝ} (hb : 0 < b) (hb1 : b ≤ 1) + (hF : Integrable (fun x => Real.exp (b * F x)) μ) + (hG : Integrable (fun x => Real.exp (b * G x)) μ) + (hFG : Integrable (fun x => F x - G x) (μ.tilted (fun x => b * G x))) + (hGF : ∀ x, G x ≤ F x) : + klDiv (μ.tilted (fun x => b * G x)) (μ.tilted (fun x => b * F x)) + + (∫⁻ x, ENNReal.ofReal (F x - G x) ∂μ.tilted (fun x => b * G x)) ≤ + ENNReal.ofReal (logMean b μ F - logMean b μ G) := + entropy_budget_of_real _ _ _ hFG (fun x => sub_nonneg.mpr (hGF x)) + (tilted_pair_entropy_identity μ F G hb hF hG hFG).1 + (tilted_pair_entropy_budget μ F G hb hb1 hF hG hFG) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/EntropyMeanComparison.lean b/lean/OAI/Probability/InvariantIsing/Pressure/EntropyMeanComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..23e0b3dc92b80e25fa6bd79b891c397ecb4264fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/EntropyMeanComparison.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Core.TiltedRelativeEntropy +import Mathlib.Probability.Moments.SubGaussian + +namespace OAI + +/-! Relative entropy controls the expectation of a canonical +sub-Gaussian observable. This avoids a loss from the ambient dimension. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory InformationTheory +open scoped NNReal + +namespace InvariantIsing + +theorem entropy_variational_mean {X : Type*} [MeasurableSpace X] + (μ ν : Measure X) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + (hac : μ ≪ ν) (hllr : Integrable (llr μ ν) μ) (F : X → ℝ) + (hF : Integrable F μ) (he : Integrable (fun x => Real.exp (F x)) ν) : + (∫ x, F x ∂μ) ≤ (klDiv μ ν).toReal + Real.log (∫ x, Real.exp (F x) ∂ν) := by + let π := ν.tilted F + let : IsProbabilityMeasure π := isProbabilityMeasure_tilted he + have hac' : μ ≪ π := hac.trans (absolutelyContinuous_tilted he) + have hi : Integrable (llr μ π) μ := integrable_llr_tilted_right hac hF hllr he + have hn := integral_llr_add_sub_measure_univ_nonneg hac' hi + have hE := integral_llr_tilted_right hac hF he hllr + have hK := toReal_klDiv hac hllr + simp only [measureReal_def, measure_univ, ENNReal.toReal_one, add_sub_cancel_right] at hn hK + change 0 ≤ ∫ x, llr μ (ν.tilted F) x ∂μ at hn + linarith + +theorem entropy_subgaussian_mean {X : Type*} [MeasurableSpace X] + (μ ν : Measure X) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + (hac : μ ≪ ν) (hllr : Integrable (llr μ ν) μ) (Y : X → ℝ) {c : ℝ≥0} + (hY : Integrable Y μ) (hG : HasSubgaussianMGF Y c ν) {t : ℝ} (ht : 0 < t) : + |∫ x, Y x ∂μ| ≤ (klDiv μ ν).toReal / t + c * t / 2 := by + have hp := entropy_variational_mean μ ν hac hllr (fun x => t * Y x) + (hY.const_mul t) (hG.integrable_exp_mul t) + have hn := entropy_variational_mean μ ν hac hllr (fun x => -t * Y x) + (hY.const_mul (-t)) (hG.integrable_exp_mul (-t)) + have hgp := hG.cgf_le t + have hgn := hG.cgf_le (-t) + change Real.log (∫ x, Real.exp (t * Y x) ∂ν) ≤ _ at hgp + change Real.log (∫ x, Real.exp (-t * Y x) ∂ν) ≤ _ at hgn + rw [integral_const_mul] at hp hn + have hbound : t * |∫ x, Y x ∂μ| ≤ (klDiv μ ν).toReal + c * t ^ 2 / 2 := by + have h := (abs_le.mpr (show -( (klDiv μ ν).toReal + c * t ^ 2 / 2) ≤ + t * (∫ x, Y x ∂μ) ∧ t * (∫ x, Y x ∂μ) ≤ + (klDiv μ ν).toReal + c * t ^ 2 / 2 by constructor <;> nlinarith)) + simpa only [abs_mul, abs_of_pos ht] using h + apply (mul_le_mul_iff_right₀ ht).mp + calc + _ = t * |∫ x, Y x ∂μ| := by ring + _ ≤ _ := hbound + _ = t * ((klDiv μ ν).toReal / t + c * t / 2) := by field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GeneralSpectralPressure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GeneralSpectralPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab6d2e551ef3b1d98f1469e6b3e03e4d2353e612 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GeneralSpectralPressure.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralPressure +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! The general compact spectral law and no-outlier mean-pressure theorem. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem general_spectral_mean_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + have hab : a ≤ b := (hbound ha).2 + have hc := compact_spectral_pressure_tendsto_of_mem hhaar hgauss hpub μ + (fun N i => spectralClip a b (eig N i)) ν a b hcompact hbound ha hb + (fun N i => spectralClip_mem hab (eig N i)) + (spectral_clip_empirical_tendsto eig ν a b hbound hweak) + have hη := spectralExcess_tendsto eig a b hno + have hd : Tendsto (fun N => + (∫ V, rotatedPressure (fun i => spectralClip a b (eig N i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ N)- + ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) + atTop (𝓝 0) := by + apply squeeze_zero_norm' _ (by simpa only [zero_div] using hη.div_const 2) + filter_upwards [eventually_ge_atTop 1] with N hN + simpa only [Real.norm_eq_abs] using spectral_clip_mean_pressure_close (by omega) + (μ N) (eig N) a b (spectralExcess (eig N) a b) hab + (spectralExcess_nonneg _ _ _) (spectralExcess_bounds _ _ _) + have hh := hc.sub hd + simpa only [sub_sub_cancel,sub_zero] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GibbsMap.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GibbsMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..645dfe7e4e45f3461480139fc1e45ca0704a60d5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GibbsMap.lean @@ -0,0 +1,33 @@ +import OAI.Probability.IsingPerceptron.RetainedDisplacement +import OAI.Probability.IsingPerceptron.NamespaceSplit + +namespace OAI + +/-! Pushforward of an integrable terminal Gibbs tilt. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped ENNReal +namespace InvariantIsing + +lemma gibbsProbability_map_normalize {X Y : Type} [MeasurableSpace X] [MeasurableSpace Y] + [Nonempty X] [Nonempty Y] (ν : Measure X) [IsProbabilityMeasure ν] + {f : X → Y} (hf : Measurable f) {H : Y → ℝ} (hH : Measurable H) + (hi : Integrable (fun x => Real.exp (H (f x))) ν) : + (gibbsProbability ν (fun x => H (f x))).map f = + normalizeMass ((ν.map f).withDensity (fun y => ENNReal.ofReal (Real.exp (H y)))) := by + have hI : Integrable (fun y => Real.exp (H y)) (ν.map f) := + (integrable_map_measure hH.exp.aestronglyMeasurable hf.aemeasurable).mpr hi + have hmass : ((ν.map f).withDensity (fun y => ENNReal.ofReal (Real.exp (H y)))) Set.univ = + ENNReal.ofReal (∫ y, Real.exp (H y) ∂ν.map f) := by + rw [withDensity_apply _ MeasurableSet.univ,setLIntegral_univ, + ← ofReal_integral_eq_lintegral_ofReal hI (ae_of_all _ fun y => (Real.exp_pos _).le)] + rw [gibbsProbability_eq_tilted _ _ hi, ← normalizeMass_exp ν (fun x => H (f x)) (hH.comp hf) hi] + apply normalizeMass_weight_map ν hf hH.exp.ennreal_ofReal + rw [hmass] + exact ⟨ENNReal.ofReal_pos.mpr (integral_exp_pos hI), ENNReal.ofReal_lt_top⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GibbsSecant.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GibbsSecant.lean new file mode 100644 index 0000000000000000000000000000000000000000..512744065465ab6cdf00a74229b0960a382fe785 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GibbsSecant.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Core.Ward + +namespace OAI + +/-! Endpoint Gibbs averages bound a finite log-partition difference. These +are the convex secant inequalities used to change spectral multiplicities. -/ + +noncomputable section +open IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma log_finitePartition_sub_ge_gibbsAverage + {S : Type*} [Fintype S] {w : S → ℝ} (hw : GibbsReference w) + (H K : S → ℝ) : + gibbsAverage w H (fun s => K s - H s) ≤ + Real.log (finitePartition w K) - Real.log (finitePartition w H) := by + let Y := fun s => K s - H s + have hd := hasDerivAt_log_finitePartition hw (t := (0 : ℝ)) + (fun s => (hasDerivAt_const 0 (H s)).add ((hasDerivAt_id 0).mul_const (Y s))) + have hc := convexOn_log_finitePartition hw H Y + have hs := hc.le_slope_of_hasDerivAt (Set.mem_univ (0 : ℝ)) + (Set.mem_univ (1 : ℝ)) (by norm_num) hd + simpa only [slope_def_field, sub_zero, div_one, zero_add, zero_mul, one_mul, + add_sub_cancel, Y, gibbsAverage, Pi.add_apply, id_eq, add_zero] using hs + +lemma log_finitePartition_sub_le_gibbsAverage + {S : Type*} [Fintype S] {w : S → ℝ} (hw : GibbsReference w) + (H K : S → ℝ) : + Real.log (finitePartition w K) - Real.log (finitePartition w H) ≤ + gibbsAverage w K (fun s => K s - H s) := by + have h := log_finitePartition_sub_ge_gibbsAverage hw K H + have he : gibbsAverage w K (fun s => H s - K s) = + -gibbsAverage w K (fun s => K s - H s) := by + simp only [gibbsAverage, mul_sub, Finset.sum_sub_distrib] + ring + rw [he] at h + linarith + +lemma log_finitePartition_secant_bounds + {S : Type*} [Fintype S] {w : S → ℝ} (hw : GibbsReference w) + (H K : S → ℝ) : + gibbsAverage w H (fun s => K s - H s) ≤ + Real.log (finitePartition w K) - Real.log (finitePartition w H) ∧ + Real.log (finitePartition w K) - Real.log (finitePartition w H) ≤ + gibbsAverage w K (fun s => K s - H s) := + ⟨log_finitePartition_sub_ge_gibbsAverage hw H K, + log_finitePartition_sub_le_gibbsAverage hw H K⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateFinite.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ae2d31bc1294bdc8aa2753a937e3f1197a807f8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateFinite.lean @@ -0,0 +1,79 @@ +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureMean +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure + +namespace OAI + +/-! The actual maximum Ising energy and its uniform finite-temperature squeeze. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators Classical + +namespace InvariantIsing + +def groundStateEnergy {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) : ℝ := + (N : ℝ)⁻¹ * Finset.univ.sup' Finset.univ_nonempty (rotatedEnergy eig U) + +lemma groundStateEnergy_attained {N : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U : Rotation N) : + (∀ σ, rotatedEnergy eig U σ ≤ N*groundStateEnergy eig U) ∧ + ∃ σ, rotatedEnergy eig U σ=N*groundStateEnergy eig U := by + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + have he : (N : ℝ)*groundStateEnergy eig U= + Finset.univ.sup' Finset.univ_nonempty (rotatedEnergy eig U) := by + unfold groundStateEnergy + field_simp + rw [he] + constructor + · intro σ + exact Finset.le_sup' _ (Finset.mem_univ σ) + · obtain ⟨σ,_,hσ⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty (rotatedEnergy eig U) + exact ⟨σ,hσ.symm⟩ + +lemma groundStateEnergy_squeeze {N : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U : Rotation N) (β : ℝ) (hβ : 0 < β) : + rotatedPressure (fun i => β*eig i) U (fun _ => 0)/β ≤ groundStateEnergy eig U ∧ + groundStateEnergy eig U ≤ + rotatedPressure (fun i => β*eig i) U (fun _ => 0)/β+Real.log 2/β := by + have he := groundStateEnergy_attained hN eig U + have hh := finite_groundState_squeeze hN (rotatedEnergy eig U) β + (groundStateEnergy eig U) hβ he.1 he.2 + have hp : rotatedPressure (fun i => β*eig i) U (fun _ => 0)= + (N : ℝ)⁻¹*logPartition (fun σ => β*rotatedEnergy eig U σ) := by + simp only [rotatedPressure,rotatedEnergy_scale,fieldEnergy,zero_mul,Finset.sum_const_zero,add_zero] + rw [hp] + exact ⟨hh.2,by linarith [hh.1]⟩ + +lemma abs_groundStateEnergy_le {N : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U : Rotation N) (K : ℝ) (hK : ∀ i, |eig i| ≤ K) : + |groundStateEnergy eig U| ≤ K/2 := by + obtain ⟨σ,hσ⟩ := (groundStateEnergy_attained hN eig U).2 + have hh := abs_rotatedEnergy_le eig U K hK σ + rw [hσ,abs_mul,abs_of_nonneg (Nat.cast_nonneg N)] at hh + have hn : (0 : ℝ) < N := by exact_mod_cast hN + nlinarith + +lemma measurable_groundStateEnergy {N : ℕ} (eig : Fin N → ℝ) : + Measurable (fun V : SpecialOrthogonal N => groundStateEnergy eig (specialRotation V)) := by + have hE (σ : Spin N) : Measurable (fun V : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation V) σ) := + (Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector σ) i).pow_const 2).const_mul (eig i)).const_mul _ + have hh := Finset.measurable_sup' Finset.univ_nonempty (fun σ _ => hE σ) + convert hh.const_mul (N : ℝ)⁻¹ using 1 + funext V + simp only [groundStateEnergy,Finset.sup'_apply] + +lemma measurable_physical_groundStateEnergy {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) : + Measurable (fun V : Orthogonal N => groundStateEnergy eig (matrixRotation V⁻¹)) := by + have hm := (measurable_groundStateEnergy eig).comp + ((measurable_cavityOrientationLift hN).comp measurable_inv) + convert hm using 1 + funext V + simp only [Function.comp_apply,groundStateEnergy,cavityOrientationLift_energy] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateLimit.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c296ec7d6c0955f8b4d592f705d13625a4e93cb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateLimit.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Pressure.PositiveTemperaturePressure +import OAI.Probability.InvariantIsing.Pressure.GroundStateMean +import OAI.Probability.InvariantIsing.Pressure.ThermalLimitSqueeze + +namespace OAI + +/-! The deterministic ground-state limit, almost surely and in expectation, +and the existence of the full real-temperature variational limit. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +def thermalVariationalValue (ν : ProbabilityMeasure ℝ) (b β : ℝ) : ℝ := + (variationalFunctional (measureR (scaledSpectralLaw ν β : Measure ℝ) (β*b))).toReal/β + +theorem ground_state_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + ∃ M : ℝ, + Tendsto (fun N => ∫ ω, groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹) ∂P) + atTop (𝓝 M) ∧ + (∀ᵐ ω ∂P, Tendsto (fun N => groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹)) + atTop (𝓝 M)) ∧ + Tendsto (thermalVariationalValue ν b) atTop (𝓝 M) := by + let p := fun (k N : ℕ) => (∫ ω, rotatedPressure (fun i => ((k : ℝ)+1)*eig N i) + (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P)/((k : ℝ)+1) + let v := fun k : ℕ => thermalVariationalValue ν b ((k : ℝ)+1) + let g := fun N => ∫ ω, groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹) ∂P + have hc : 0 ≤ Real.log 2 := (Real.log_pos (by norm_num : (1 : ℝ) < 2)).le + have hp (k : ℕ) : Tendsto (p k) atTop (𝓝 (v k)) := + ((positive_temperature_pressure hhaar hgauss hpub P U hU hHaar eig ν a b + hbound ha hb hno ((k : ℝ)+1) (by positivity) hweak).1).div_const _ + have hmean (k : ℕ) : ∀ᶠ N in atTop, p k N ≤ g N ∧ g N ≤ p k N+Real.log 2/(k+1) := by + filter_upwards [eventually_ge_atTop 1] with N hN + exact mean_groundState_squeeze (by omega) P (U N) (hU N) (eig N) _ (by positivity) + obtain ⟨M,hv,hg⟩ := exists_thermal_ground_limit p g v (Real.log 2) hc hp hmean + refine ⟨M,hg,?_,?_⟩ + · have hall : ∀ᵐ ω ∂P, ∀ k : ℕ, Tendsto + (fun N => rotatedPressure (fun i => ((k : ℝ)+1)*eig N i) + (matrixRotation (U N ω)⁻¹) (fun _ => 0)/((k : ℝ)+1)) atTop (𝓝 (v k)) := by + apply ae_all_iff.mpr + intro k + filter_upwards [(positive_temperature_pressure hhaar hgauss hpub P U hU hHaar eig ν a b + hbound ha hb hno ((k : ℝ)+1) (by positivity) hweak).2] with ω hω + exact hω.div_const _ + filter_upwards [hall] with ω hω + apply thermal_squeeze_tendsto _ _ v (Real.log 2) M hc hv hω + intro k + filter_upwards [eventually_ge_atTop 1] with N hN + exact groundStateEnergy_squeeze (by omega) (eig N) (matrixRotation (U N ω)⁻¹) _ (by positivity) + · have hbounds (β : ℝ) (hβ : 0 < β) : + thermalVariationalValue ν b β ≤ M ∧ M ≤ thermalVariationalValue ν b β+Real.log 2/β := by + have ht := ((positive_temperature_pressure hhaar hgauss hpub P U hU hHaar eig ν a b + hbound ha hb hno β hβ hweak).1).div_const β + have he : ∀ᶠ N in atTop, + (∫ ω, rotatedPressure (fun i => β*eig N i) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P)/β ≤ g N ∧ + g N ≤ (∫ ω, rotatedPressure (fun i => β*eig N i) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P)/β+ + Real.log 2/β := by + filter_upwards [eventually_ge_atTop 1] with N hN + exact mean_groundState_squeeze (by omega) P (U N) (hU N) (eig N) β hβ + exact ⟨le_of_tendsto_of_tendsto ht hg (he.mono fun _ h => h.1), + le_of_tendsto_of_tendsto hg (ht.add_const _) (he.mono fun _ h => h.2)⟩ + apply tendsto_sub_nhds_zero_iff.mp + apply squeeze_zero_norm' _ (tendsto_id.const_div_atTop (Real.log 2)) + filter_upwards [eventually_gt_atTop (0 : ℝ)] with β hβ + rw [Real.norm_eq_abs,abs_le] + simp only [id_eq] + have hh := hbounds β hβ + constructor <;> linarith [hh.1,hh.2,div_nonneg hc hβ.le] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateMain.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..72f628023bc70e144ea49e5cc1f71e5743fab15d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateMain.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Pressure.GroundStateLimit +import OAI.Probability.InvariantIsing.Spectral.SpectralExtremeLimits + +namespace OAI + +/-! The ground-state corollary under the manuscript's exact extreme-eigenvalue hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem ground_state_limit_of_extreme_limits + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + ∃ M : ℝ, + Tendsto (fun N => ∫ ω, groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹) ∂P) + atTop (𝓝 M) ∧ + (∀ᵐ ω ∂P, Tendsto (fun N => groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹)) + atTop (𝓝 M)) ∧ + Tendsto (thermalVariationalValue ν b) atTop (𝓝 M) := + ground_state_limit hhaar hgauss hpub P U hU hHaar eig ν a b hbound ha hb + (spectral_no_outliers_of_extreme_limits eig a b hmin hmax) hweak + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateMean.lean b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..e75f1b14b0cdc46a793b61b05a0c6515d8d562ac --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/GroundStateMean.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Pressure.GroundStateFinite + +namespace OAI + +/-! Integrable physical energies and the expected soft-maximum inequality. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped Classical BigOperators + +namespace InvariantIsing + +lemma integrable_physicalPressure {Ω : Type*} [MeasurableSpace Ω] + {N : ℕ} (hN : 0 < N) (P : Measure Ω) [IsProbabilityMeasure P] + (U : Ω → Orthogonal N) (hU : Measurable U) (eig c : Fin N → ℝ) : + Integrable (fun ω => rotatedPressure eig (matrixRotation (U ω)⁻¹) c) P := by + let K := ∑ i, |eig i| + have he i : |eig i| ≤ K := Finset.single_le_sum (f := fun i => |eig i|) (fun _ _ => abs_nonneg _) (Finset.mem_univ i) + apply (integrable_const (K/2+|noninteractingPressure c|)).mono' + ((measurable_physicalPressure hN eig c).comp hU).aestronglyMeasurable + filter_upwards [] with ω + rw [Real.norm_eq_abs] + have hb := abs_pressure_sub_noninteracting_le hN eig c (matrixRotation (U ω)⁻¹) K he + have ha := abs_add_le (rotatedPressure eig (matrixRotation (U ω)⁻¹) c-noninteractingPressure c) + (noninteractingPressure c) + rw [sub_add_cancel] at ha + exact ha.trans (add_le_add hb le_rfl) + +lemma integrable_physicalGroundState {Ω : Type*} [MeasurableSpace Ω] + {N : ℕ} (hN : 0 < N) (P : Measure Ω) [IsProbabilityMeasure P] + (U : Ω → Orthogonal N) (hU : Measurable U) (eig : Fin N → ℝ) : + Integrable (fun ω => groundStateEnergy eig (matrixRotation (U ω)⁻¹)) P := by + let K := ∑ i, |eig i| + have he i : |eig i| ≤ K := Finset.single_le_sum (f := fun i => |eig i|) (fun _ _ => abs_nonneg _) (Finset.mem_univ i) + exact (integrable_const (K/2)).mono' + ((measurable_physical_groundStateEnergy hN eig).comp hU).aestronglyMeasurable + (ae_of_all _ fun ω => by simpa only [Real.norm_eq_abs] using + abs_groundStateEnergy_le hN eig (matrixRotation (U ω)⁻¹) K he) + +lemma mean_groundState_squeeze {Ω : Type*} [MeasurableSpace Ω] + {N : ℕ} (hN : 0 < N) (P : Measure Ω) [IsProbabilityMeasure P] + (U : Ω → Orthogonal N) (hU : Measurable U) (eig : Fin N → ℝ) + (β : ℝ) (hβ : 0 < β) : + (∫ ω, rotatedPressure (fun i => β*eig i) (matrixRotation (U ω)⁻¹) (fun _ => 0) ∂P)/β ≤ + (∫ ω, groundStateEnergy eig (matrixRotation (U ω)⁻¹) ∂P) ∧ + (∫ ω, groundStateEnergy eig (matrixRotation (U ω)⁻¹) ∂P) ≤ + (∫ ω, rotatedPressure (fun i => β*eig i) (matrixRotation (U ω)⁻¹) (fun _ => 0) ∂P)/β+ + Real.log 2/β := by + have hp := integrable_physicalPressure hN P U hU (fun i => β*eig i) (fun _ => 0) + have hg := integrable_physicalGroundState hN P U hU eig + have hl := integral_mono (hp.div_const β) hg (fun ω => + (groundStateEnergy_squeeze hN eig (matrixRotation (U ω)⁻¹) β hβ).1) + have hu := integral_mono hg ((hp.div_const β).add (integrable_const (Real.log 2/β))) (fun ω => + (groundStateEnergy_squeeze hN eig (matrixRotation (U ω)⁻¹) β hβ).2) + rw [integral_div] at hl + simp only [Pi.add_apply] at hu + rw [integral_add (hp.div_const β) (integrable_const _),integral_div,integral_const, + probReal_univ,one_smul] at hu + exact ⟨hl,hu⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/InMeasurePerturbation.lean b/lean/OAI/Probability/InvariantIsing/Pressure/InMeasurePerturbation.lean new file mode 100644 index 0000000000000000000000000000000000000000..18af9ce646a977ebaafcd8fe8106c806eea41638 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/InMeasurePerturbation.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactTestsInMeasure + +namespace OAI + +/-! A vanishing metric perturbation preserves convergence in probability. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem tendstoInMeasure_zero_of_abs_le {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (f g : ℕ → Ω → ℝ) (hg : TendstoInMeasure P g atTop (fun _ => 0)) + (hbound : ∀ n ω, |f n ω| ≤ |g n ω|) : + TendstoInMeasure P f atTop (fun _ => 0) := by + apply tendstoInMeasure_iff_dist.mpr + intro ε hε + apply tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds + (tendstoInMeasure_iff_dist.mp hg ε hε) (fun _ => bot_le) + intro n + apply measure_mono + intro ω hω + simp only [mem_ofPred_eq,Real.dist_eq,sub_zero] at hω ⊢ + exact hω.trans (hbound n ω) + +theorem tendstoInMeasure_div_pos {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (f : ℕ → Ω → ℝ) (hf : TendstoInMeasure P f atTop (fun _ => 0)) + {c : ℝ} (hc : 0 < c) : + TendstoInMeasure P (fun n ω => f n ω/c) atTop (fun _ => 0) := by + apply tendstoInMeasure_iff_dist.mpr + intro ε hε + convert (tendstoInMeasure_iff_dist.mp hf) (ε*c) (mul_pos hε hc) using 1 + funext n + congr 1 + ext ω + simp only [Real.dist_eq,sub_zero,abs_div,abs_of_pos hc] + exact le_div_iff₀ hc + +theorem tendstoInMeasure_of_dist_le {Ω Y : Type*} [MeasurableSpace Ω] [PseudoMetricSpace Y] + (P : Measure Ω) (f g : ℕ → Ω → Y) (h : ℕ → Ω → ℝ) (z : Ω → Y) + (hg : TendstoInMeasure P g atTop z) (hh : TendstoInMeasure P h atTop (fun _ => 0)) + (hbound : ∀ n ω, dist (f n ω) (g n ω) ≤ h n ω) : + TendstoInMeasure P f atTop z := by + apply tendstoInMeasure_iff_dist.mpr + intro ε hε + have hhalf : 0 < ε/2 := half_pos hε + have ht₁ := tendstoInMeasure_iff_dist.mp hh (ε/2) hhalf + have ht₂ := tendstoInMeasure_iff_dist.mp hg (ε/2) hhalf + have hb (n : ℕ) : {ω | ε ≤ dist (f n ω) (z ω)} ⊆ + {ω | ε/2 ≤ dist (h n ω) 0} ∪ {ω | ε/2 ≤ dist (g n ω) (z ω)} := by + intro ω hω + by_cases hh' : ε/2 ≤ dist (h n ω) 0 + · exact Or.inl hh' + · right + have hp : h n ω < ε/2 := lt_of_le_of_lt (by simpa only [Real.dist_eq,sub_zero] using le_abs_self (h n ω)) + (lt_of_not_ge hh') + have hx := dist_triangle (f n ω) (g n ω) (z ω) + have hb' := hbound n ω + change ε ≤ dist (f n ω) (z ω) at hω + change ε/2 ≤ dist (g n ω) (z ω) + linarith + have ht : Tendsto (fun n => P {ω | ε/2 ≤ dist (h n ω) 0}+ + P {ω | ε/2 ≤ dist (g n ω) (z ω)}) atTop (𝓝 0) := by + simpa only [zero_add] using ht₁.add ht₂ + exact tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds ht + (fun _ => bot_le) (fun n => (measure_mono (hb n)).trans (measure_union_le _ _)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/LimitingPressure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/LimitingPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..69d2bf939aa7b373a946e3e381ab5b4aa1afb183 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/LimitingPressure.lean @@ -0,0 +1,75 @@ +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureMean +import OAI.Probability.InvariantIsing.Pressure.PhysicalPressureConcentration + +namespace OAI + +/-! Manuscript Theorem 1.1, conditional only on the explicitly cited +published concentration and finite hierarchical field inputs. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem limiting_pressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0)) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + refine ⟨physical_mean_pressure_tendsto hhaar hgauss hpub P U hU hHaar eig ν a b + hcompact hbound ha hb hno hweak,?_⟩ + have hab : a ≤ b := (hbound ha).2 + let clip := fun N (i : Fin N) => spectralClip a b (eig N i) + have hcmean := physical_mean_pressure_tendsto hhaar hgauss hpub P U hU hHaar clip ν a b + hcompact hbound ha hb (fun ε hε => Eventually.of_forall (fun N i => by + have hh := spectralClip_mem hab (eig N i) + constructor <;> linarith [hh.1,hh.2])) + (spectral_clip_empirical_tendsto eig ν a b hbound hweak) + let K := |a|+|b|+1 + have hK : 0 < K := by dsimp [K]; positivity + have hclip N i : |clip N i| ≤ K := by + have hh := spectralClip_mem hab (eig N i) + rw [abs_le] + dsimp [K] + constructor <;> linarith [hh.1,hh.2,neg_abs_le a,le_abs_self b,abs_nonneg a,abs_nonneg b] + have hconc := ae_physical_pressure_sub_mean_tendsto_zero hhaar P + (fun n => U (n+3)) (fun n => hU (n+3)) (fun n => hHaar (n+3)) + (fun n => clip (n+3)) (fun _ _ => 0) K hK (fun n => hclip (n+3)) + have hη := (spectralExcess_tendsto eig a b hno).comp (tendsto_add_atTop_nat 3) + filter_upwards [hconc] with ω hω + have hclim := hω.add (hcmean.comp (tendsto_add_atTop_nat 3)) + have hd : Tendsto (fun n => rotatedPressure (eig (n+3)) (matrixRotation (U (n+3) ω)⁻¹) (fun _ => 0)- + rotatedPressure (clip (n+3)) (matrixRotation (U (n+3) ω)⁻¹) (fun _ => 0)) + atTop (𝓝 0) := by + apply squeeze_zero_norm _ (by simpa only [zero_div] using hη.div_const 2) + intro n + rw [Real.norm_eq_abs,abs_sub_comm] + exact abs_rotatedPressure_sub_le (by omega) (clip (n+3)) (eig (n+3)) + (matrixRotation (U (n+3) ω)⁻¹) (fun _ => 0) (spectralExcess (eig (n+3)) a b) + (fun i => spectralClip_close hab (spectralExcess_nonneg _ _ _) (spectralExcess_bounds _ _ _ i)) + apply (tendsto_add_atTop_iff_nat 3).mp + have hh := hclim.add hd + convert hh using 1 + · funext n + dsimp only [Function.comp_apply] + ring + · simp only [zero_add,add_zero] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/LocalizedAlmostSure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/LocalizedAlmostSure.lean new file mode 100644 index 0000000000000000000000000000000000000000..05b303852f16745d17838fc9d0abef13aa28211c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/LocalizedAlmostSure.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Pressure.AlmostSure + +namespace OAI + +/-! Eventual local exponential tails imply almost-sure convergence whenever +the localizing random bound is eventually finite. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma exponential_tail_extend_initial {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (E : ℕ → Set Ω) + {C a : ℝ} (hC : 0 ≤ C) (ha : 0 < a) (N₀ : ℕ) + (hE : ∀ n, N₀ ≤ n → P.real (E n) ≤ C*Real.exp (-a*(n : ℝ))) : + ∃ D : ℝ, 0 ≤ D ∧ ∀ n, P.real (E n) ≤ D*Real.exp (-a*(n : ℝ)) := by + let D := C+Real.exp (a*(N₀ : ℝ)) + have hCD : C ≤ D := le_add_of_nonneg_right (Real.exp_pos _).le + refine ⟨D,by dsimp [D]; positivity,fun n => ?_⟩ + by_cases hn : N₀ ≤ n + · exact (hE n hn).trans (mul_le_mul_of_nonneg_right hCD (Real.exp_pos _).le) + · have hle : (n : ℝ) ≤ N₀ := by exact_mod_cast (show n ≤ N₀ by omega) + have he : 1 ≤ Real.exp (a*(N₀ : ℝ))*Real.exp (-a*(n : ℝ)) := by + rw [← Real.exp_add,Real.one_le_exp_iff] + nlinarith + have hED : Real.exp (a*(N₀ : ℝ)) ≤ D := by dsimp [D]; linarith + exact (measureReal_le_one : P.real (E n) ≤ 1).trans + (he.trans (mul_le_mul_of_nonneg_right hED (Real.exp_pos _).le)) + +lemma ae_tendsto_zero_of_localized_exponential_tail {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (X Z : ℕ → Ω → ℝ) + (htail : ∀ K ε : ℝ, 0 < K → 0 < ε → + ∃ C a : ℝ, 0 ≤ C ∧ 0 < a ∧ ∃ N₀ : ℕ, + ∀ n, N₀ ≤ n → P.real {ω | ε ≤ |X n ω| ∧ Z n ω ≤ K} ≤ C*Real.exp (-a*(n : ℝ))) + (hbound : ∀ᵐ ω ∂P, ∃ K : ℝ, ∀ᶠ n in atTop, Z n ω ≤ K) : + ∀ᵐ ω ∂P, Tendsto (fun n => X n ω) atTop (𝓝 0) := by + let T := fun k n ω => if Z n ω ≤ (k+1 : ℝ) then X n ω else 0 + have hT (k : ℕ) : ∀ᵐ ω ∂P, Tendsto (fun n => T k n ω) atTop (𝓝 0) := by + apply ae_tendsto_zero_of_exponential_tail + intro ε hε + obtain ⟨C,a,hC,ha,N₀,hN₀⟩ := htail (k+1) ε (by positivity) hε + obtain ⟨D,hD,hDE⟩ := exponential_tail_extend_initial P + (fun n => {ω | ε ≤ |X n ω| ∧ Z n ω ≤ (k+1 : ℝ)}) hC ha N₀ hN₀ + refine ⟨D,a,hD,ha,fun n => ?_⟩ + have he : {ω | ε ≤ |T k n ω|}={ω | ε ≤ |X n ω| ∧ Z n ω ≤ (k+1 : ℝ)} := by + ext ω + by_cases hh : Z n ω ≤ (k+1 : ℝ) + · simp only [T,hh,ite_true,mem_ofPred_eq,and_true] + · simp only [T,hh,ite_false,abs_zero,mem_ofPred_eq,and_false,not_le_of_gt hε] + rw [he] + exact hDE n + filter_upwards [ae_all_iff.mpr hT,hbound] with ω hω hb + obtain ⟨K,hK⟩ := hb + obtain ⟨k,hk⟩ := exists_nat_gt K + have he : (fun n => T k n ω)=ᶠ[atTop] (fun n => X n ω) := by + filter_upwards [hK] with n hn + have hn' : Z n ω ≤ (k+1 : ℝ) := hn.trans (by exact le_trans hk.le (by linarith)) + simp only [T,ite_eq_left hn'] + exact (hω k).congr' he + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/MainPressure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/MainPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8951b874a72f085138df8094b4510624fbc4444 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/MainPressure.lean @@ -0,0 +1,39 @@ +import OAI.Probability.InvariantIsing.Pressure.LimitingPressure +import OAI.Probability.InvariantIsing.Spectral.SpectralExtremeLimits + +namespace OAI + +/-! Theorem 1.1 with the manuscript's exact extreme-eigenvalue hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem limiting_pressure_of_extreme_limits + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0)) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := + limiting_pressure hhaar hgauss hpub P U hU hHaar eig ν a b hcompact hbound ha hb + (spectral_no_outliers_of_extreme_limits eig a b hmin hmax) hweak + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalOrbitKernel.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalOrbitKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..67d8366cee8556b8ed1a9438d2118bc3923f6daa --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalOrbitKernel.lean @@ -0,0 +1,29 @@ +import OAI.Probability.InvariantIsing.Core.InvariantOrbitLaw +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitLaw + +namespace OAI + +/-! Fixed-data sections of the physical pressure and right-Haar transport. -/ +noncomputable section +open MeasureTheory +namespace InvariantIsing + +lemma measurable_dataPhysicalPressure_section {N : ℕ} (hN : 0 < N) + (d : FieldSpectralData N) : Measurable (dataPhysicalPressure d) := by + exact Measurable.of_uncurry_left (f := dataPhysicalPressure) (x := d) + (measurable_dataPhysicalPressure hN) + +lemma physical_orbit_kernel {N : ℕ} (hN : 0 < N) + (H : Measure (Orthogonal N)) [H.IsMulRightInvariant] + (d : FieldSpectralData N) (Y : Orthogonal N → ℝ) (V : Orthogonal N) + (hY : ∀ U, Y U=dataPhysicalPressure d (U*V)) : + H.map (fun U => (d,Y U))=H.map (fun U => (d,dataPhysicalPressure d U)) := by + exact paired_map_eq_of_comp H d (dataPhysicalPressure d) Y (fun U => U*V) + (measurable_dataPhysicalPressure_section hN d) (measurable_id.mul_const V) + (map_mul_right_eq_self H V) hY + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalPressureConcentration.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalPressureConcentration.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fb9d0901a167904c69732678e24bfc8a3f01389 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalPressureConcentration.lean @@ -0,0 +1,46 @@ +import OAI.Probability.InvariantIsing.Cavity.CavityOrientedFamily +import OAI.Probability.InvariantIsing.Pressure.PressureMean + +namespace OAI + +/-! Almost-sure pressure concentration for the actual orthogonal matrices. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology + +namespace InvariantIsing + +theorem ae_physical_pressure_sub_mean_tendsto_zero (hpub : HaarConcentrationInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (n : ℕ) → Ω → Orthogonal (n+3)) (hU : ∀ n, Measurable (U n)) + (hHaar : ∀ n, (P.map (U n)).IsMulRightInvariant) + (eig c : (n : ℕ) → Fin (n+3) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ n i, |eig n i| ≤ K) : + ∀ᵐ ω ∂P, Tendsto (fun n => + rotatedPressure (eig n) (matrixRotation (U n ω)⁻¹) (c n)- + ∫ η, rotatedPressure (eig n) (matrixRotation (U n η)⁻¹) (c n) ∂P) + atTop (𝓝 0) := by + let V (n : ℕ) (ω : Ω) := cavityOrientationLift (by omega : 0 < n+3) (U n ω)⁻¹ + have hm n : Measurable (V n) := + (measurable_cavityOrientationLift _).comp (hU n).inv + have hl n : P.map (V n)=cavityOrientedBaseLaw (by omega : 0 < n+3) (P.map (U n)) := by + change P.map ((fun W => cavityOrientationLift (by omega : 0 < n+3) W⁻¹) ∘ U n)=_ + exact (Measure.map_map ((measurable_cavityOrientationLift _).comp measurable_inv) (hU n)).symm + have hv n : (P.map (V n)).IsMulLeftInvariant := by + let : IsProbabilityMeasure (P.map (U n)) := + (Measure.isProbabilityMeasure_map_iff (hU n).aemeasurable).mpr inferInstance + let : (P.map (U n)).IsMulRightInvariant := hHaar n + rw [hl n] + exact cavityOrientedBaseLaw_leftInvariant _ _ + have he n ω : rotatedPressure (eig n) (specialRotation (V n ω)) (c n)= + rotatedPressure (eig n) (matrixRotation (U n ω)⁻¹) (c n) := by + simp only [V,rotatedPressure,cavityOrientationLift_energy] + have hh := ae_pressure_sub_mean_tendsto_zero hpub P V hm hv eig c K hK heig + simpa only [he] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalPressureMean.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalPressureMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..c06094c5707c37ecbc0748356cbe33d665344fa5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PhysicalPressureMean.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Pressure.GeneralSpectralPressure + +namespace OAI + +/-! Expectations on an arbitrary probability space carrying the physical Haar matrices. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma measurable_physicalPressure {N : ℕ} (hN : 0 < N) (eig c : Fin N → ℝ) : + Measurable (fun U : Orthogonal N => rotatedPressure eig (matrixRotation U⁻¹) c) := by + have hm := (measurable_rotatedPressure eig c).comp + ((measurable_cavityOrientationLift hN).comp measurable_inv) + convert hm using 1 + funext U + simp only [Function.comp_apply,rotatedPressure,cavityOrientationLift_energy] + +lemma physicalPressure_integral_map {Ω : Type*} [MeasurableSpace Ω] + {N : ℕ} (hN : 0 < N) (P : Measure Ω) (U : Ω → Orthogonal N) (hU : Measurable U) + (eig c : Fin N → ℝ) : + (∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂P.map U)= + ∫ ω, rotatedPressure eig (matrixRotation (U ω)⁻¹) c ∂P := + integral_map hU.aemeasurable (measurable_physicalPressure hN eig c).aestronglyMeasurable + +theorem physical_mean_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + let μ := fun N => P.map (U N) + let (N : ℕ) : IsProbabilityMeasure (μ N) := + (Measure.isProbabilityMeasure_map_iff (hU N).aemeasurable).mpr inferInstance + let (N : ℕ) : (μ N).IsMulRightInvariant := hHaar N + have hh := general_spectral_mean_pressure_tendsto hhaar hgauss hpub μ eig ν a b + hcompact hbound ha hb hno hweak + apply hh.congr' + filter_upwards [eventually_ge_atTop 1] with N hN + exact physicalPressure_integral_map (by omega) P (U N) (hU N) (eig N) (fun _ => 0) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PositiveTemperaturePressure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PositiveTemperaturePressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..893cc00296306c06a2b29aa26d91352b64926a41 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PositiveTemperaturePressure.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Spectral.ScaledSpectralLaw + +namespace OAI + +/-! The conditional main theorem at every positive inverse temperature. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem positive_temperature_pressure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (hU : ∀ N, Measurable (U N)) + (hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (β : ℝ) (hβ : 0 < β) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ ω, rotatedPressure (fun i => β*eig N i) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P) + atTop (𝓝 (variationalFunctional (measureR (scaledSpectralLaw ν β : Measure ℝ) (β*b))).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (fun i => β*eig N i) (matrixRotation (U N ω)⁻¹) (fun _ => 0)) + atTop (𝓝 (variationalFunctional (measureR (scaledSpectralLaw ν β : Measure ℝ) (β*b))).toReal) := + limiting_pressure hhaar hgauss hpub P U hU hHaar (fun N i => β*eig N i) + (scaledSpectralLaw ν β) (β*a) (β*b) + (scaled_spectral_compact ν a b β hβ.le hbound) + (scaled_spectral_support_bound ν a b β hβ.le hbound) + (scaled_spectral_support_mem ν β a ha) (scaled_spectral_support_mem ν β b hb) + (scaled_spectral_no_outliers eig a b β hβ hno) (scaled_spectral_weak eig ν β hweak) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PressureCoordinateMinimum.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PressureCoordinateMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..fffc48cf48de66d4c120f4b2e43a55f61d25f3f7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PressureCoordinateMinimum.lean @@ -0,0 +1,91 @@ +import OAI.Probability.InvariantIsing.Arrays.PerturbationWeights + +namespace OAI + +/-! Exact conversion of a pressure-coordinate minimum to its selected-field CGF. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma pressureCoordinate_minimum_rescale {M L : ℝ → ℝ} {N a w s c : ℝ} + (hN : 0 ≤ N) (ha : 0 < a) (hw : w ∈ Set.Icc (1 : ℝ) 2) + (hlo : 1 ≤ w - s) (hhi : w + s ≤ 2) + (hmean : ∀ v ∈ Set.Icc (1 : ℝ) 2, L (a * v) = N * (M v - M 0)) + (hmin : ∀ v ∈ Set.Icc (1 : ℝ) 2, + -M w + c * (w - 3 / 2) ^ 2 ≤ -M v + c * (v - 3 / 2) ^ 2) : + ∀ t ∈ Set.Icc (a * w - a * s) (a * w + a * s), + -L (a * w) + (N * c / a ^ 2) * (a * w - a * (3 / 2)) ^ 2 ≤ + -L t + (N * c / a ^ 2) * (t - a * (3 / 2)) ^ 2 := by + intro t ht + have htv : t / a ∈ Set.Icc (1 : ℝ) 2 := by + constructor + · apply (le_div_iff₀ ha).mpr + nlinarith [ht.1] + · apply (div_le_iff₀ ha).mpr + nlinarith [ht.2] + have hm := hmean (t / a) htv + rw [mul_div_cancel₀ _ ha.ne'] at hm + rw [hm, hmean w hw] + have hc := mul_le_mul_of_nonneg_left (hmin (t / a) htv) hN + have he1 : (N * c / a ^ 2) * (a * w - a * (3 / 2)) ^ 2 = + N * (c * (w - 3 / 2) ^ 2) := by field_simp + have he2 : (N * c / a ^ 2) * (t - a * (3 / 2)) ^ 2 = + N * (c * (t / a - 3 / 2) ^ 2) := by field_simp + rw [he1, he2] + linarith + +/-- Comparing a Gaussian-coordinate minimum with its centered choice +puts it in the interior, using the Gaussian variance cap of the frozen field. -/ +lemma gaussianCoordinate_minimum_penalty {N : ℕ} (hN : 0 < N) (j : Fin N) + (M : ℝ → ℝ) (u : ℝ) (hu : |u| ≤ 2) + (hcost : 0 ≤ M (3 / 2) - M 0 ∧ M u - M 0 ≤ (perturbationAmplitude N j * u) ^ 2 / (2 * N)) + (hmin : -M u + perturbationWeight j * (u - 3 / 2) ^ 2 ≤ + -M (3 / 2) + perturbationWeight j * (3 / 2 - 3 / 2) ^ 2) : + (u - 3 / 2) ^ 2 ≤ 2 * perturbationScale N ^ 2 * perturbationWeight j := by + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hw := perturbationWeight_pos j + have ha := perturbationAmplitude_sq N j + have hu2 : u ^ 2 ≤ 4 := by + have hb := abs_le.mp hu + nlinarith [sq_nonneg (u + 2), sq_nonneg (u - 2)] + have hanu : (perturbationAmplitude N j * u) ^ 2 / (2 * N) ≤ + 2 * perturbationScale N ^ 2 * perturbationWeight j ^ 2 := by + apply (div_le_iff₀ (show 0 < 2 * (N : ℝ) by positivity)).mpr + rw [mul_pow, ha] + nlinarith [mul_le_mul_of_nonneg_left hu2 + (show 0 ≤ (N : ℝ) * perturbationScale N ^ 2 * perturbationWeight j ^ 2 by positivity)] + have hm : perturbationWeight j * (u - 3 / 2) ^ 2 ≤ + perturbationWeight j * (2 * perturbationScale N ^ 2 * perturbationWeight j) := by + nlinarith [hcost.1, hcost.2] + exact (mul_le_mul_iff_right₀ hw).mp hm + +lemma gaussianCoordinate_minimum_interior {N : ℕ} (j : Fin N) {u s : ℝ} + (hpen : (u - 3 / 2) ^ 2 ≤ 2 * perturbationScale N ^ 2 * perturbationWeight j) + (he : perturbationScale N ≤ 1 / 8) (hs : s ≤ 1 / 4) : + 1 ≤ u - s ∧ u + s ≤ 2 := by + have he0 := perturbationScale_nonneg N + have hw := perturbationWeight_le_one j + have hbnd : (u - 3 / 2) ^ 2 ≤ 1 / 32 := by + have hm := mul_le_mul_of_nonneg_left hw (show 0 ≤ 2 * perturbationScale N ^ 2 by positivity) + nlinarith [sq_nonneg (perturbationScale N - 1 / 8)] + constructor <;> nlinarith [sq_nonneg (u - 3 / 2 - 1 / 4), sq_nonneg (u - 3 / 2 + 1 / 4)] + +lemma diagonalCoordinate_minimum_penalty {M : ℝ → ℝ} {w e : ℝ} + (hcost : 0 ≤ M (3 / 2) - M 0 ∧ M w - M 0 ≤ 2 * e) + (hmin : -M w + (w - 3 / 2) ^ 2 ≤ -M (3 / 2) + (3 / 2 - 3 / 2) ^ 2) : + (w - 3 / 2) ^ 2 ≤ 2 * e := by + nlinarith [hcost.1, hcost.2] + +lemma diagonalCoordinate_minimum_interior {w e s : ℝ} + (hpen : (w - 3 / 2) ^ 2 ≤ 2 * e) (he : e ≤ 1 / 32) (hs : s ≤ 1 / 4) : + 1 ≤ w - s ∧ w + s ≤ 2 := by + constructor <;> nlinarith [sq_nonneg (w - 3 / 2 - 1 / 4), sq_nonneg (w - 3 / 2 + 1 / 4)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PressureDifferenceConcentration.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PressureDifferenceConcentration.lean new file mode 100644 index 0000000000000000000000000000000000000000..7dbf533b5f0e341fc3427ca148d6a26d5d032ce7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PressureDifferenceConcentration.lean @@ -0,0 +1,48 @@ +import OAI.Probability.IsingPerceptron.NamespaceSplit + +namespace OAI + +/-! Centering a logpartition difference using its two pressure variances. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +/-- The frozen CGF of one perturbation is a scaled difference of two +pressures. Both variances suffice even though those pressures are dependent. -/ +theorem centered_scaled_difference_L1_bound {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] {F G Z : Ω → ℝ} {a B : ℝ} + (hF : MemLp F 2 P) (hG : MemLp G 2 P) + (hvF : variance F P ≤ B) (hvG : variance G P ≤ B) + (he : Z =ᵐ[P] fun ω => a * (F ω - G ω)) : + MemLp Z 2 P ∧ + (∫ ω, |Z ω - ∫ ω', Z ω' ∂P| ∂P) ≤ 2 * |a| * Real.sqrt B := by + have hiF := hF.integrable (by norm_num) + have hiG := hG.integrable (by norm_num) + have hZ : MemLp Z 2 P := MemLp.ae_eq he.symm ((hF.sub hG).const_mul a) + have hcF : (∫ ω, |F ω - ∫ ω', F ω' ∂P| ∂P) ≤ Real.sqrt B := + (l1_center_le_sqrt_variance hF).trans (Real.sqrt_le_sqrt hvF) + have hcG : (∫ ω, |G ω - ∫ ω', G ω' ∂P| ∂P) ≤ Real.sqrt B := + (l1_center_le_sqrt_variance hG).trans (Real.sqrt_le_sqrt hvG) + have hc := centered_sub_L1_bound P hiF hiG hcF hcG + have hm : (∫ ω, Z ω ∂P) = a * (∫ ω, F ω - G ω ∂P) := by + rw [integral_congr_ae he, integral_const_mul] + refine ⟨hZ, ?_⟩ + rw [hm] + calc + _ = ∫ ω, |a| * |F ω - G ω - ∫ ω', F ω' - G ω' ∂P| ∂P := by + apply integral_congr_ae + filter_upwards [he] with ω hω + rw [hω, ← mul_sub, abs_mul] + _ = |a| * (∫ ω, |F ω - G ω - ∫ ω', F ω' - G ω' ∂P| ∂P) := integral_const_mul _ _ + _ ≤ |a| * (Real.sqrt B + Real.sqrt B) := + mul_le_mul_of_nonneg_left hc (abs_nonneg _) + _ = _ := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PressureLipschitz.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PressureLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..32f5139e68fa936515c416b05248ecb114ac8c7c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PressureLipschitz.lean @@ -0,0 +1,125 @@ +import OAI.Probability.InvariantIsing.Haar.MatrixRotation + +namespace OAI + +/-! +# Frobenius continuity of Haar pressure + +The Lipschitz constant is independent of dimension and of a deterministic +magnetic field. This is the finite-volume estimate required to apply the +published SO(N) concentration input. +-/ + +noncomputable section + +open MeasureTheory +open scoped BigOperators Matrix + +namespace InvariantIsing + +lemma specialRotation_spin_dist_sq_le {N : ℕ} (U V : SpecialOrthogonal N) + (σ : Spin N) : + (∑ i, (specialRotation U (spinVector σ) i - + specialRotation V (spinVector σ) i) ^ 2) ≤ + (N : ℝ) * frobeniusDistance U V ^ 2 := by + have he (i : Fin N) : specialRotation U (spinVector σ) i - + specialRotation V (spinVector σ) i = + ∑ j, ((U : Matrix (Fin N) (Fin N) ℝ) i j - + (V : Matrix (Fin N) (Fin N) ℝ) i j) * spinValue (σ j) := by + simp only [specialRotation_apply, spinVector_apply, sub_mul, Finset.sum_sub_distrib] + have hrow (i : Fin N) := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ + (fun j => (U : Matrix (Fin N) (Fin N) ℝ) i j - + (V : Matrix (Fin N) (Fin N) ℝ) i j) (fun j => spinValue (σ j)) + have hsum := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hrow i) + simp only [spinValue_sq, Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, mul_one, ← Finset.sum_mul] at hsum + simp_rw [he] + rw [frobeniusDistance, Real.sq_sqrt (Finset.sum_nonneg fun i _ => + Finset.sum_nonneg fun j _ => sq_nonneg _)] + nlinarith + +lemma abs_rotatedEnergy_sub_rotation_le {N : ℕ} (eig : Fin N → ℝ) + (U V : SpecialOrthogonal N) (K : ℝ) (hK : 0 ≤ K) + (heig : ∀ i, |eig i| ≤ K) (σ : Spin N) : + |rotatedEnergy eig (specialRotation U) σ - + rotatedEnergy eig (specialRotation V) σ| ≤ + K * N * frobeniusDistance U V := by + let x := specialRotation U (spinVector σ) + let y := specialRotation V (spinVector σ) + let d := frobeniusDistance U V + have hd : 0 ≤ d := Real.sqrt_nonneg _ + have hN : (0 : ℝ) ≤ N := Nat.cast_nonneg _ + have hx : ∑ i, x i ^ 2 = N := rotated_spin_sq_sum _ _ + have hy : ∑ i, y i ^ 2 = N := rotated_spin_sq_sum _ _ + have hm : (∑ i, (x i - y i) ^ 2) ≤ (N : ℝ) * d ^ 2 := + specialRotation_spin_dist_sq_le U V σ + have hp : (∑ i, (x i + y i) ^ 2) ≤ 4 * (N : ℝ) := by + have hi := Finset.sum_le_sum (s := Finset.univ) (fun i _ => + show (x i + y i) ^ 2 ≤ 2 * x i ^ 2 + 2 * y i ^ 2 by + nlinarith [sq_nonneg (x i - y i)]) + simp only [Finset.sum_add_distrib, ← Finset.mul_sum, hx, hy] at hi + linarith + have hw : (∑ i, (eig i * (x i - y i)) ^ 2) ≤ + K ^ 2 * ∑ i, (x i - y i) ^ 2 := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + rw [mul_pow] + have hb : eig i ^ 2 ≤ K ^ 2 := by + simpa only [sq_abs] using (sq_le_sq₀ (abs_nonneg _) hK).mpr (heig i) + exact mul_le_mul_of_nonneg_right hb (sq_nonneg _) + have hcs := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ + (fun i => eig i * (x i - y i)) (fun i => x i + y i) + have hs : (∑ i, (eig i * (x i - y i)) * (x i + y i)) ^ 2 ≤ + (2 * K * (N : ℝ) * d) ^ 2 := by + calc + _ ≤ (∑ i, (eig i * (x i - y i)) ^ 2) * ∑ i, (x i + y i) ^ 2 := hcs + _ ≤ (K ^ 2 * ∑ i, (x i - y i) ^ 2) * (4 * (N : ℝ)) := + mul_le_mul hw hp (Finset.sum_nonneg fun i _ => sq_nonneg _) (by positivity) + _ ≤ (K ^ 2 * ((N : ℝ) * d ^ 2)) * (4 * (N : ℝ)) := + mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hm (sq_nonneg _)) + (by positivity) + _ = _ := by ring + have ha : |∑ i, (eig i * (x i - y i)) * (x i + y i)| ≤ + 2 * K * (N : ℝ) * d := by + apply (sq_le_sq₀ (abs_nonneg _) (by positivity)).mp + simpa only [sq_abs] using hs + have he : rotatedEnergy eig (specialRotation U) σ - + rotatedEnergy eig (specialRotation V) σ = + (1 / 2 : ℝ) * ∑ i, (eig i * (x i - y i)) * (x i + y i) := by + rw [rotatedEnergy, rotatedEnergy, ← mul_sub, ← Finset.sum_sub_distrib] + change (1 / 2 : ℝ) * (∑ i, (eig i * x i ^ 2 - eig i * y i ^ 2)) = _ + congr 1 + apply Finset.sum_congr rfl + intro i _ + ring + rw [he, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2)] + exact (mul_le_mul_of_nonneg_left ha (by norm_num)).trans_eq (by dsimp [d]; ring) + +lemma abs_rotatedPressure_sub_rotation_le {N : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U V : SpecialOrthogonal N) (c : Fin N → ℝ) + (K : ℝ) (hK : 0 ≤ K) (heig : ∀ i, |eig i| ≤ K) : + |rotatedPressure eig (specialRotation U) c - + rotatedPressure eig (specialRotation V) c| ≤ K * frobeniusDistance U V := by + have h := abs_logPartition_sub_le + (fun σ => rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ) + (fun σ => rotatedEnergy eig (specialRotation V) σ + fieldEnergy c σ) + (K * N * frobeniusDistance U V) (fun σ => by + simpa only [add_sub_add_right_eq_sub] using + abs_rotatedEnergy_sub_rotation_le eig U V K hK heig σ) + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + calc + _ = (N : ℝ)⁻¹ * |logPartition (fun σ => + rotatedEnergy eig (specialRotation U) σ + fieldEnergy c σ) - + logPartition (fun σ => rotatedEnergy eig (specialRotation V) σ + fieldEnergy c σ)| := by + rw [rotatedPressure, rotatedPressure, ← mul_sub, abs_mul, + abs_of_nonneg (show (0 : ℝ) ≤ (N : ℝ)⁻¹ by positivity)] + _ ≤ (N : ℝ)⁻¹ * (K * N * frobeniusDistance U V) := + mul_le_mul_of_nonneg_left h (by positivity) + _ = K * frobeniusDistance U V := by field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/PressureMean.lean b/lean/OAI/Probability/InvariantIsing/Pressure/PressureMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..69c8b089b0cb2c827263eb2faceb631860893407 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/PressureMean.lean @@ -0,0 +1,113 @@ +import OAI.Probability.InvariantIsing.Haar.MedianMean + +namespace OAI + +/-! Almost-sure concentration of the actual pressure about its expectation. -/ + +noncomputable section + +open MeasureTheory Filter +open scoped Topology + +namespace InvariantIsing + +/-- Deterministic reference obtained by removing the quadratic interaction. -/ +def noninteractingPressure {N : ℕ} (c : Fin N → ℝ) : ℝ := + (N : ℝ)⁻¹ * logPartition (fieldEnergy c) + +lemma rotatedPressure_zero {N : ℕ} (U : Rotation N) (c : Fin N → ℝ) : + rotatedPressure (fun _ => 0) U c = noninteractingPressure c := by + simp [rotatedPressure, rotatedEnergy, noninteractingPressure] + +lemma abs_pressure_sub_noninteracting_le {N : ℕ} (hN : 0 < N) + (eig c : Fin N → ℝ) (U : Rotation N) (K : ℝ) (heig : ∀ i, |eig i| ≤ K) : + |rotatedPressure eig U c - noninteractingPressure c| ≤ K / 2 := by + simpa only [sub_zero, rotatedPressure_zero] using + abs_rotatedPressure_sub_le hN eig (fun _ => 0) U c K (fun i => by simpa using heig i) + +/-- Uniformly bounded spectra give almost-sure concentration about the mean, +for arbitrary deterministic fields and arbitrary dependence across dimensions. -/ +theorem ae_pressure_sub_mean_tendsto_zero (hpub : HaarConcentrationInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (n : ℕ) → Ω → SpecialOrthogonal (n + 3)) + (hU : ∀ n, Measurable (U n)) + (hHaar : ∀ n, (P.map (U n)).IsMulLeftInvariant) + (eig c : (n : ℕ) → Fin (n + 3) → ℝ) + (K : ℝ) (hK : 0 < K) (heig : ∀ n i, |eig n i| ≤ K) : + ∀ᵐ ω ∂P, Tendsto (fun n => + rotatedPressure (eig n) (specialRotation (U n ω)) (c n) - + ∫ η, rotatedPressure (eig n) (specialRotation (U n η)) (c n) ∂P) + atTop (𝓝 0) := by + let F : (n : ℕ) → SpecialOrthogonal (n + 3) → ℝ := fun n V => + rotatedPressure (eig n) (specialRotation V) (c n) - noninteractingPressure (c n) + let f : ℕ → Ω → ℝ := fun n ω => F n (U n ω) + have hFm (n : ℕ) : Measurable (F n) := + (measurable_rotatedPressure (eig n) (c n)).sub_const _ + have hfm (n : ℕ) : Measurable (f n) := (hFm n).comp (hU n) + have hfb (n : ℕ) (ω : Ω) : |f n ω| ≤ K / 2 := + abs_pressure_sub_noninteracting_le (by omega) _ _ _ K (heig n) + obtain ⟨C, a, hC, ha, hp⟩ := hpub + have hm (n : ℕ) : ∃ m : ℝ, + (1 / 2 : ℝ) ≤ P.real {ω | f n ω ≤ m} ∧ + (1 / 2 : ℝ) ≤ P.real {ω | m ≤ f n ω} ∧ + ∀ r : ℝ, 0 < r → P.real {ω | r ≤ |f n ω - m|} ≤ + C * Real.exp (-a * (n + 3 : ℝ) * r ^ 2 / K ^ 2) := by + have hprob : IsProbabilityMeasure (P.map (U n)) := + (Measure.isProbabilityMeasure_map_iff (hU n).aemeasurable).mpr inferInstance + have hLip : ∀ V W, |F n V - F n W| ≤ K * frobeniusDistance V W := by + intro V W + dsimp only [F] + rw [sub_sub_sub_cancel_right] + exact abs_rotatedPressure_sub_rotation_le (by omega) _ _ _ _ K hK.le (heig n) + obtain ⟨m, hl, hu, ht⟩ := hp (n + 3) (by omega) (P.map (U n)) hprob + (hHaar n) (F n) (hFm n) K hK hLip + refine ⟨m, ?_, ?_, ?_⟩ + · simpa only [f, Set.preimage_ofPred_eq, measureReal_def, Measure.map_apply (hU n) + (measurableSet_le (hFm n) measurable_const)] using hl + · simpa only [f, Set.preimage_ofPred_eq, measureReal_def, Measure.map_apply (hU n) + (measurableSet_le measurable_const (hFm n))] using hu + · intro r hr + simpa only [f, Set.preimage_ofPred_eq, measureReal_def, Measure.map_apply (hU n) + (measurableSet_le measurable_const ((hFm n).sub_const m).abs), + Nat.cast_add, Nat.cast_ofNat] using ht r hr + choose m hl hu ht using hm + have htail : ∀ r : ℝ, 0 < r → ∃ C a : ℝ, 0 ≤ C ∧ 0 < a ∧ + ∀ n, P.real {ω | r ≤ |f n ω - m n|} ≤ C * Real.exp (-a * (n : ℝ)) := by + intro r hr + refine ⟨C, a * r ^ 2 / K ^ 2, hC.le, by positivity, ?_⟩ + intro n + refine (ht n r hr).trans (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr ?_) hC.le) + have hnonneg : 0 ≤ a * r ^ 2 / K ^ 2 := by positivity + calc + -a * ((n : ℝ) + 3) * r ^ 2 / K ^ 2 = + -(a * r ^ 2 / K ^ 2) * ((n : ℝ) + 3) := by ring + _ ≤ -(a * r ^ 2 / K ^ 2) * (n : ℝ) := + mul_le_mul_of_nonpos_left (by linarith) (neg_nonpos.mpr hnonneg) + have hmean := tendsto_mean_sub_median_zero P f hfm m (K / 2) (by positivity) + hfb hl hu htail + have hae := ae_tendsto_zero_of_exponential_tail P (fun n ω => f n ω - m n) htail + have hfi (n : ℕ) : Integrable (f n) P := + (integrable_const (K / 2)).mono' (hfm n).aestronglyMeasurable + (ae_of_all _ fun ω => by simpa only [Real.norm_eq_abs] using hfb n ω) + filter_upwards [hae] with ω hω + have hresult := hω.sub hmean + have he (n : ℕ) : + f n ω - m n - ((∫ η, f n η ∂P) - m n) = + rotatedPressure (eig n) (specialRotation (U n ω)) (c n) - + ∫ η, rotatedPressure (eig n) (specialRotation (U n η)) (c n) ∂P := by + have hadd := integral_add (hfi n) (integrable_const (noninteractingPressure (c n))) + have heq : (fun η => f n η + noninteractingPressure (c n)) = + (fun η => rotatedPressure (eig n) (specialRotation (U n η)) (c n)) := by + funext η + simp [f, F] + rw [heq] at hadd + simp only [integral_const, probReal_univ, one_smul] at hadd + dsimp only [f, F] + linarith + simpa only [he, sub_self] using hresult + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomBoundedDerivative.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomBoundedDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..52b14aa9fdb097034e2524470c44308705573e9c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomBoundedDerivative.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Core.BoundedObservableMinimum +import OAI.Probability.IsingPerceptron.EnrichedCGF + +namespace OAI + +/-! A bounded random observable has a differentiable disorder-averaged CGF. +This applies to the actual temperature observable retaining common disorder. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron + +namespace InvariantIsing + +lemma integrable_bounded_random_tilted_mean {Ω X : Type*} + [MeasurableSpace Ω] [MeasurableSpace X] + (P : Measure Ω) [IsProbabilityMeasure P] (ν : Ω → Measure X) (hν : Measurable ν) + [∀ ω, IsProbabilityMeasure (ν ω)] (Y : Ω → X → ℝ) + (hY : Measurable (Function.uncurry Y)) (B : ℝ) (hB : ∀ ω x, |Y ω x| ≤ B) (t : ℝ) : + Integrable (fun ω => ∫ x, Y ω x ∂(ν ω).tilted (fun x => t * Y ω x)) P := by + have hm := measurable_random_tilted_integral hν (hY.const_mul t) hY + apply Integrable.of_bound hm.aestronglyMeasurable B + exact ae_of_all _ fun ω => by + simpa only [Real.norm_eq_abs, Function.comp_apply, Function.uncurry_apply_pair, id_eq] using bounded_tilted_integral_abs (ν ω) + (hY.comp (measurable_const.prodMk measurable_id)) (hB ω) + (hY.comp (measurable_const.prodMk measurable_id)) (hB ω) t + +theorem hasDerivAt_bounded_random_cgf {Ω X : Type*} + [MeasurableSpace Ω] [MeasurableSpace X] + (P : Measure Ω) [IsProbabilityMeasure P] (ν : Ω → Measure X) (hν : Measurable ν) + [∀ ω, IsProbabilityMeasure (ν ω)] (Y : Ω → X → ℝ) + (hY : Measurable (Function.uncurry Y)) (B : ℝ) (hB : ∀ ω x, |Y ω x| ≤ B) (t : ℝ) : + HasDerivAt (fun s => ∫ ω, cgf (Y ω) (ν ω) s ∂P) + (∫ ω, ∫ x, Y ω x ∂(ν ω).tilted (fun x => t * Y ω x) ∂P) t := by + apply hasDerivAt_mean_cgf ν Y + · exact ae_of_all _ fun ω s => exp_mul_integrable_of_bound (ν ω) + (hY.comp (measurable_const.prodMk measurable_id)) (hB ω) s + · exact fun s => integrable_bounded_random_cgf P ν hν (Function.uncurry Y) hY B hB s + · exact fun s => integrable_bounded_random_tilted_mean P ν hν Y hY B hB s + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomCoefficientGG.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomCoefficientGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..8aa28e06254c1fdbe4d4cd421ceef6e0c7382454 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomCoefficientGG.lean @@ -0,0 +1,320 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomCoefficientIBP +import OAI.Probability.InvariantIsing.Arrays.ReplicaCovariance +import OAI.Probability.InvariantIsing.Core.GGErrorAlgebra +import OAI.Probability.IsingPerceptron.JointGGClosure + +namespace OAI + +/-! GG estimates for Haar-dependent Gaussian perturbation tensors. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +variable {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + +/-- Expectation over external disorder and independent Gaussian coordinates. -/ +def randomCoefficientAverage (P : Measure Ω) (ν : Ω → Measure X) + (A : Ω → X → ℕ →₀ ℝ) (t : ℝ) {r : ℕ} (D : Ω → (Fin r → X) → ℝ) : ℝ := + ∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => t * cylinderField (A z.1 x) z.2) (D z.1) ∂P.prod gaussianCoordinates + +def randomCoefficientEnergy (P : Measure Ω) (ν : Ω → Measure X) + (A : Ω → X → ℕ →₀ ℝ) (t : ℝ) {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) : ℝ := + ∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => t * cylinderField (A z.1 x) z.2) + (fun σ => cylinderField (A z.1 (σ 0)) z.2 * D z.1 σ) ∂P.prod gaussianCoordinates + +variable [Countable X] [MeasurableSingletonClass X] + {P : Measure Ω} [IsProbabilityMeasure P] {ν : Ω → Measure X} + [∀ ω, IsProbabilityMeasure (ν ω)] + +lemma randomCoefficientAverage_abs_le (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (t : ℝ) {r : ℕ} (D : Ω → (Fin r → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) : |randomCoefficientAverage P ν A t D| ≤ c := by + apply abs_integral_le_const_of_bound + · simpa only [cylinderField_smul] using + measurable_randomCoefficient_mean hν (fun ω x => t • A ω x) + (by simpa only [cylinderField_smul] using hAm.const_mul t) D hDm + · intro z + exact referenceReplicaMean_abs_le _ _ _ (measurable_of_countable _) hc (hD z.1) + +lemma randomCoefficientAverage_one (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) (r : ℕ) : + randomCoefficientAverage P ν A t (fun (_ : Ω) (_ : Fin r → X) => 1) = 1 := by + unfold randomCoefficientAverage + calc + _ = ∫ _z : Ω × (ℕ → ℝ), (1 : ℝ) ∂P.prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [randomCoefficient_all_exp_ae (P := P) hν A hAm hA] with z hz + exact referenceReplicaMean_const _ _ (hz t) r 1 + _ = 1 := by simp + +lemma randomCoefficientAverage_add_bounded (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) + (t : ℝ) {r : ℕ} (D E : Ω → (Fin r → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) (hEm : Measurable (Function.uncurry E)) + {c d : ℝ} (hc : 0 ≤ c) (hd : 0 ≤ d) + (hD : ∀ ω σ, |D ω σ| ≤ c) (hE : ∀ ω σ, |E ω σ| ≤ d) : + randomCoefficientAverage P ν A t (fun ω σ => D ω σ + E ω σ) = + randomCoefficientAverage P ν A t D + randomCoefficientAverage P ν A t E := by + have ht : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => + cylinderField (t • A p.1.1 p.2) p.1.2) := by + simpa only [cylinderField_smul] using hAm.const_mul t + have hiD := integrable_randomCoefficient_mean (P := P) hν + (fun ω x => t • A ω x) ht D hDm hc hD + have hiE := integrable_randomCoefficient_mean (P := P) hν + (fun ω x => t • A ω x) ht E hEm hd hE + simp only [cylinderField_smul] at hiD hiE + unfold randomCoefficientAverage + calc + _ = ∫ z : Ω × (ℕ → ℝ), + referenceReplicaMean (ν z.1) (fun x => t * cylinderField (A z.1 x) z.2) (D z.1) + + referenceReplicaMean (ν z.1) (fun x => t * cylinderField (A z.1 x) z.2) (E z.1) + ∂P.prod gaussianCoordinates := by + apply integral_congr_ae + filter_upwards [randomCoefficient_all_exp_ae (P := P) hν A hAm hA] with z hz + exact referenceReplicaMean_add_bounded _ _ (hz t) _ _ (hD z.1) (hE z.1) + _ = _ := integral_add hiD hiE + +/-- Conditional Gaussian integration by parts, with the diagonal retained. -/ +theorem randomCoefficientEnergy_full_identity (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (hcross : Measurable (fun p : Ω × (X × X) => cylinderCross (A p.1 p.2.1) (A p.1 p.2.2))) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) + (t : ℝ) {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) : + randomCoefficientEnergy P ν A t D = t * + (randomCoefficientAverage P ν A t (fun ω σ => D ω σ * + (∑ i : Fin (r + 1), cylinderCross (A ω (σ 0)) (A ω (σ i)))) - + (r + 1 : ℕ) * randomCoefficientAverage P ν A t + (fun ω (τ : Fin (r + 1 + 1) → X) => D ω (Fin.tail τ) * + cylinderCross (A ω ((Fin.tail τ) 0)) (A ω (τ 0)))) := by + have h := joint_randomCoefficient_cylinder_insertion (P := P) hν + (fun ω x => t • A ω x) A + (by simpa only [cylinderField_smul] using hAm.const_mul t) hAm + (by simpa only [cylinderCross_smul_right] using hcross.const_mul t) + (fun ω x => by rw [cylinder_norm_smul]; exact mul_le_mul_of_nonneg_left (hA ω x) (sq_nonneg t)) + hA D hDm hc hD + simp only [cylinderField_smul, cylinderCross_smul_right] at h + have heq (ω : Ω) : (fun σ : Fin (r + 1) → X => + D ω σ * (∑ i, t * cylinderCross (A ω (σ 0)) (A ω (σ i)))) = + (fun σ => t * (D ω σ * ∑ i, cylinderCross (A ω (σ 0)) (A ω (σ i)))) := by + funext σ + rw [← Finset.mul_sum] + ring + have hfresh (ω : Ω) : (fun τ : Fin (r + 1 + 1) → X => + D ω (Fin.tail τ) * (t * cylinderCross (A ω ((Fin.tail τ) 0)) (A ω (τ 0)))) = + (fun τ => t * (D ω (Fin.tail τ) * + cylinderCross (A ω ((Fin.tail τ) 0)) (A ω (τ 0)))) := by + funext τ + ring + simp_rw [heq, hfresh, referenceReplicaMean_const_mul] at h + rw [integral_const_mul, integral_const_mul] at h + change randomCoefficientEnergy P ν A t D = _ at h + rw [h] + unfold randomCoefficientAverage + ring + +/-- Energy fluctuation bounds remain valid for Haar-dependent tensors and +Haar-dependent replica tests. -/ +theorem randomCoefficient_energy_covariance_bound (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) + (t b : ℝ) {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) + (hE : Integrable (fun z : Ω × (ℕ → ℝ) => ∫ x, + |cylinderField (A z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2)) + (P.prod gaussianCoordinates)) : + |randomCoefficientEnergy P ν A t D - b * randomCoefficientAverage P ν A t D| ≤ + c * (∫ z : Ω × (ℕ → ℝ), ∫ x, |cylinderField (A z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2) + ∂P.prod gaussianCoordinates) := by + have ht : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => + cylinderField (t • A p.1.1 p.2) p.1.2) := by + simpa only [cylinderField_smul] using hAm.const_mul t + have hiU := integrable_randomCoefficient_insertion (P := P) hν + (fun ω x => t • A ω x) A ht hAm + (fun ω x => by rw [cylinder_norm_smul]; exact mul_le_mul_of_nonneg_left (hA ω x) (sq_nonneg t)) + hA D hDm hc hD + have hiV := integrable_randomCoefficient_mean (P := P) hν + (fun ω x => t • A ω x) ht D hDm hc hD + simp only [cylinderField_smul] at hiU hiV + have he := randomCoefficient_all_exp_ae (P := P) hν A hAm hA + have hY : ∀ᵐ z : Ω × (ℕ → ℝ) ∂P.prod gaussianCoordinates, + Integrable (fun x => cylinderField (A z.1 x) z.2) + ((ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2)) := by + filter_upwards [he] with z hz + exact (memLp_tilted_mul (mem_interior_integrableExpSet_of_all hz t) (1 : NNReal)).integrable + (by norm_num) + exact random_replica_energy_covariance_bound (ν := fun z : Ω × (ℕ → ℝ) => ν z.1) + (H := fun p => t * cylinderField (A p.1.1 p.2) p.1.2) + (Y := fun p => cylinderField (A p.1.1 p.2) p.1.2) + (fun p => D p.1.1 p.2) + (hDm.comp (measurable_fst.fst.prodMk measurable_snd)) hc (fun z => hD z.1) b + (he.mono fun _ hz => hz t) hY hiU hiV hE + +/-- The finite GG comparison for the actual type of perturbations used here: +both coefficients and tests may depend on the external Haar disorder, and +the spectral self-overlap covariance remains an explicit error. -/ +theorem randomCoefficient_gaussian_gg_bound (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (hcross : Measurable (fun p : Ω × (X × X) => cylinderCross (A p.1 p.2.1) (A p.1 p.2.2))) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) + (t b : ℝ) {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) + (hE : Integrable (fun z : Ω × (ℕ → ℝ) => ∫ x, + |cylinderField (A z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2)) + (P.prod gaussianCoordinates)) : + |t| * |(r + 1 : ℕ) * randomCoefficientAverage P ν A t + (fun ω (τ : Fin (r + 1 + 1) → X) => D ω (Fin.tail τ) * + cylinderCross (A ω ((Fin.tail τ) 0)) (A ω (τ 0))) - + randomCoefficientAverage P ν A t D * randomCoefficientAverage P ν A t + (fun ω (τ : Fin 2 → X) => cylinderCross (A ω (τ 1)) (A ω (τ 0))) - + randomCoefficientAverage P ν A t + (fun ω σ => D ω σ * ∑ l : Fin r, cylinderCross (A ω (σ 0)) (A ω (σ l.succ)))| ≤ + 2 * c * (∫ z : Ω × (ℕ → ℝ), ∫ x, |cylinderField (A z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2) + ∂P.prod gaussianCoordinates) + + |t| * |randomCoefficientAverage P ν A t + (fun ω σ => D ω σ * cylinderCross (A ω (σ 0)) (A ω (σ 0))) - + randomCoefficientAverage P ν A t D * randomCoefficientAverage P ν A t + (fun ω (σ : Fin 1 → X) => cylinderCross (A ω (σ 0)) (A ω (σ 0)))| := by + let V := randomCoefficientAverage P ν A t D + let U := randomCoefficientEnergy P ν A t D + let M := randomCoefficientEnergy P ν A t (fun (_ : Ω) (_ : Fin 1 → X) => 1) + let E := ∫ z : Ω × (ℕ → ℝ), ∫ x, |cylinderField (A z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2) + ∂P.prod gaussianCoordinates + let L := randomCoefficientAverage P ν A t + (fun ω σ => D ω σ * cylinderCross (A ω (σ 0)) (A ω (σ 0))) + let L₀ := randomCoefficientAverage P ν A t + (fun ω (σ : Fin 1 → X) => cylinderCross (A ω (σ 0)) (A ω (σ 0))) + have hEn : 0 ≤ E := integral_nonneg (fun _ => integral_nonneg (fun _ => abs_nonneg _)) + have hU : |U - b * V| ≤ c * E := + randomCoefficient_energy_covariance_bound hν A hAm hA t b D hDm hc hD hE + have hM : |M - b| ≤ E := by + have h := randomCoefficient_energy_covariance_bound (P := P) hν A hAm hA t b + (fun (_ : Ω) (_ : Fin (0 + 1) → X) => 1) measurable_const (c := 1) (by norm_num) + (fun _ _ => by norm_num) hE + change |M - b * randomCoefficientAverage P ν A t (fun (_ : Ω) (_ : Fin 1 → X) => 1)| ≤ 1 * E at h + simpa only [randomCoefficientAverage_one hν A hAm hA, mul_one, one_mul] using h + have hV : |V| ≤ c := randomCoefficientAverage_abs_le hν A hAm t D hDm hc hD + have hm : M = t * (L₀ - randomCoefficientAverage P ν A t + (fun ω (τ : Fin 2 → X) => cylinderCross (A ω (τ 1)) (A ω (τ 0)))) := by + have h := randomCoefficientEnergy_full_identity (P := P) (r := 0) hν A hAm hcross hA t + (fun (_ : Ω) (_ : Fin (0 + 1) → X) => 1) measurable_const (c := 1) (by norm_num) + (fun _ _ => by norm_num) + simpa only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero, one_mul, Fin.tail, + Fin.succ_zero_eq_one, Nat.cast_one, Nat.zero_add] using h + have hdiagM : Measurable (Function.uncurry (fun ω (σ : Fin (r + 1) → X) => + D ω σ * cylinderCross (A ω (σ 0)) (A ω (σ 0)))) := by + have hp : Measurable (fun p : Ω × (Fin (r + 1) → X) => (p.1, (p.2 0, p.2 0))) := + measurable_fst.prodMk + (((measurable_pi_apply 0).comp measurable_snd).prodMk + ((measurable_pi_apply 0).comp measurable_snd)) + exact hDm.mul (hcross.comp hp) + have hoffM : Measurable (Function.uncurry (fun ω (σ : Fin (r + 1) → X) => + D ω σ * ∑ l : Fin r, cylinderCross (A ω (σ 0)) (A ω (σ l.succ)))) := by + apply hDm.mul + apply Finset.measurable_sum + intro l _ + have hp : Measurable (fun p : Ω × (Fin (r + 1) → X) => (p.1, (p.2 0, p.2 l.succ))) := + measurable_fst.prodMk + (((measurable_pi_apply 0).comp measurable_snd).prodMk + ((measurable_pi_apply l.succ).comp measurable_snd)) + exact hcross.comp hp + have hdiag (ω : Ω) (σ : Fin (r + 1) → X) : + |D ω σ * cylinderCross (A ω (σ 0)) (A ω (σ 0))| ≤ c * |B| := by + rw [abs_mul] + exact mul_le_mul (hD ω σ) (cylinderCross_bound (A ω) (hA ω) _ _) (abs_nonneg _) hc + have hoff (ω : Ω) (σ : Fin (r + 1) → X) : + |D ω σ * ∑ l : Fin r, cylinderCross (A ω (σ 0)) (A ω (σ l.succ))| ≤ c * (r * |B|) := by + rw [abs_mul] + apply mul_le_mul (hD ω σ) _ (abs_nonneg _) hc + calc + _ ≤ ∑ l : Fin r, |cylinderCross (A ω (σ 0)) (A ω (σ l.succ))| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _l : Fin r, |B| := Finset.sum_le_sum (fun _ _ => cylinderCross_bound (A ω) (hA ω) _ _) + _ = _ := by simp + have hu : U = t * (L + randomCoefficientAverage P ν A t + (fun ω σ => D ω σ * ∑ l : Fin r, cylinderCross (A ω (σ 0)) (A ω (σ l.succ))) - + (r + 1 : ℕ) * randomCoefficientAverage P ν A t + (fun ω (τ : Fin (r + 1 + 1) → X) => D ω (Fin.tail τ) * + cylinderCross (A ω ((Fin.tail τ) 0)) (A ω (τ 0)))) := by + have h := randomCoefficientEnergy_full_identity (P := P) hν A hAm hcross hA t D hDm hc hD + simp only [Fin.sum_univ_succ, mul_add] at h + rw [randomCoefficientAverage_add_bounded hν A hAm hA t _ _ hdiagM hoffM + (mul_nonneg hc (abs_nonneg _)) (by positivity) hdiag hoff] at h + exact h + exact gaussianGG_of_energy_identities hEn hU hM hV hu hm + +/-- Gaussian mean logpartition bounds remain valid when the coefficient +vectors depend on the external rotation disorder. -/ +lemma randomCoefficient_cgf_mean_bounds (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) : + 0 ≤ (∫ z : Ω × (ℕ → ℝ), cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) t + ∂P.prod gaussianCoordinates) ∧ + (∫ z : Ω × (ℕ → ℝ), cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) t + ∂P.prod gaussianCoordinates) ≤ t ^ 2 * B / 2 := by + have hi := integrable_randomCoefficient_cgf (P := P) hν A hAm hA t + rw [integral_prod _ hi] + refine ⟨integral_nonneg (fun ω => (cylinder_cgf_mean_bounds (ν ω) (A ω) (hA ω) t).1), ?_⟩ + calc + _ ≤ ∫ _ : Ω, t ^ 2 * B / 2 ∂P := integral_mono hi.integral_prod_left + (integrable_const _) (fun ω => (cylinder_cgf_mean_bounds (ν ω) (A ω) (hA ω) t).2) + _ = _ := by simp + +/-- The local-minimum fluctuation estimate applies to the actual +Haar-dependent Gaussian fields, rather than requiring fixed coefficients. -/ +theorem randomCoefficient_energy_at_minimum (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hAm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {B : ℝ} (hA : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ B) + {v c a s δ K : ℝ} (hs : 0 < s) (hK : 0 < K) + (hmin : ∀ t ∈ Set.Icc (v - s) (v + s), + -(∫ z : Ω × (ℕ → ℝ), cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) v + ∂P.prod gaussianCoordinates) + c * (v - a) ^ 2 ≤ + -(∫ z : Ω × (ℕ → ℝ), cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) t + ∂P.prod gaussianCoordinates) + c * (t - a) ^ 2) + (hconc : ∀ t ∈ ({v - s, v, v + s} : Set ℝ), + (∫ z : Ω × (ℕ → ℝ), |cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) t - + (∫ z' : Ω × (ℕ → ℝ), cgf (fun x => cylinderField (A z'.1 x) z'.2) (ν z'.1) t + ∂P.prod gaussianCoordinates)| ∂P.prod gaussianCoordinates) ≤ δ) : + let E := fun z : Ω × (ℕ → ℝ) => ∫ x, + |cylinderField (A z.1 x) z.2 - 2 * c * (v - a)| + ∂(ν z.1).tilted (fun x => v * cylinderField (A z.1 x) z.2) + Integrable E (P.prod gaussianCoordinates) ∧ + (∫ z, E z ∂P.prod gaussianCoordinates) ≤ (2 * c + K ^ 2) / (2 * K) + c * s + 4 * δ / s := by + exact expected_tilted_energy_at_minimum (μ := P.prod gaussianCoordinates) + (ν := fun z : Ω × (ℕ → ℝ) => ν z.1) + (Y := fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2) + (hν.comp measurable_fst) hAm hs hK + (randomCoefficient_all_exp_ae hν A hAm hA) + (integrable_randomCoefficient_cgf hν A hAm hA) hmin hconc + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomCoefficientIBP.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomCoefficientIBP.lean new file mode 100644 index 0000000000000000000000000000000000000000..f92c798f3a163b42e399e0d4904c4f1d21571475 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomCoefficientIBP.lean @@ -0,0 +1,230 @@ +import OAI.Probability.IsingPerceptron.NormalizedRestrictionPi + +namespace OAI + +/-! +Gaussian insertion when the finite coefficient vectors depend on external +disorder. This permits the Haar-dependent spectral-overlap tensor features. +The Gaussian coordinates remain independent of the external disorder. +-/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +variable {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + [Countable X] [MeasurableSingletonClass X] + {P : Measure Ω} [IsProbabilityMeasure P] {ν : Ω → Measure X} + [∀ ω, IsProbabilityMeasure (ν ω)] + +lemma measurable_randomCoefficient_mean (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {r : ℕ} (D : Ω → (Fin r → X) → ℝ) (hD : Measurable (Function.uncurry D)) : + Measurable (fun z : Ω × (ℕ → ℝ) => referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) (D z.1)) := by + have : ∀ z : Ω × (ℕ → ℝ), IsProbabilityMeasure ((fun z => ν z.1) z) := fun _ => inferInstance + exact measurable_random_referenceReplicaMean (ν := fun z : Ω × (ℕ → ℝ) => ν z.1) + (hν.comp measurable_fst) hA + (hD.comp (measurable_fst.fst.prodMk measurable_snd)) + +lemma integrable_randomCoefficient_mean (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {r : ℕ} (D : Ω → (Fin r → X) → ℝ) (hDm : Measurable (Function.uncurry D)) + {c : ℝ} (hc : 0 ≤ c) (hD : ∀ ω σ, |D ω σ| ≤ c) : + Integrable (fun z : Ω × (ℕ → ℝ) => referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) (D z.1)) (P.prod gaussianCoordinates) := by + exact integrable_of_measurable_abs_le (measurable_randomCoefficient_mean hν A hA D hDm) + (fun z => referenceReplicaMean_abs_le (ν z.1) _ (D z.1) + (measurable_of_countable _) hc (hD z.1)) + +lemma measurable_randomCoefficient_insertion (hν : Measurable ν) + (A B : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (hB : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (B p.1.1 p.2) p.1.2)) + {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) + (hD : Measurable (Function.uncurry D)) : + Measurable (fun z : Ω × (ℕ → ℝ) => referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) + (fun σ => cylinderField (B z.1 (σ 0)) z.2 * D z.1 σ)) := by + have : ∀ z : Ω × (ℕ → ℝ), IsProbabilityMeasure ((fun z => ν z.1) z) := fun _ => inferInstance + exact measurable_random_referenceReplicaMean (ν := fun z : Ω × (ℕ → ℝ) => ν z.1) + (hν.comp measurable_fst) hA + ((hB.comp (measurable_fst.prodMk ((measurable_pi_apply 0).comp measurable_snd))).mul + (hD.comp (measurable_fst.fst.prodMk measurable_snd))) + +lemma integrable_randomCoefficient_insertion (hν : Measurable ν) + (A B : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (hB : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (B p.1.1 p.2) p.1.2)) + {K L : ℝ} (ha : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ K) + (hb : ∀ ω x, (B ω x).sum (fun _ c => c ^ 2) ≤ L) + {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) : + Integrable (fun z : Ω × (ℕ → ℝ) => referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) + (fun σ => cylinderField (B z.1 (σ 0)) z.2 * D z.1 σ)) (P.prod gaussianCoordinates) := by + have hm := measurable_randomCoefficient_insertion hν A B hA hB D hDm + have hi := joint_integrable_square_of_uniform_conditionals (P := P) hm + (fun ω => (cylinder_replica_insertion_second (ν ω) (A ω) (B ω) + (ha ω) (hb ω) (D ω) hc (hD ω)).1) + (fun ω => (cylinder_replica_insertion_second (ν ω) (A ω) (B ω) + (ha ω) (hb ω) (D ω) hc (hD ω)).2) + exact ((memLp_two_iff_integrable_sq hm.aestronglyMeasurable).mpr hi).integrable (by norm_num) + +/-- The countable Gaussian insertion identity with external-disorder-dependent +coefficients and replica tests. The uniform second-moment estimate +justifies Fubini for the countable cylinder law. -/ +theorem joint_randomCoefficient_cylinder_insertion (hν : Measurable ν) + (A B : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (hB : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (B p.1.1 p.2) p.1.2)) + (hcross : Measurable (fun p : Ω × (X × X) => cylinderCross (B p.1 p.2.1) (A p.1 p.2.2))) + {K L : ℝ} (ha : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ K) + (hb : ∀ ω x, (B ω x).sum (fun _ c => c ^ 2) ≤ L) + {r : ℕ} (D : Ω → (Fin (r + 1) → X) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) : + (∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) + (fun σ => cylinderField (B z.1 (σ 0)) z.2 * D z.1 σ) ∂P.prod gaussianCoordinates) = + (∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) + (fun σ => D z.1 σ * (∑ i, cylinderCross (B z.1 (σ 0)) (A z.1 (σ i)))) + ∂P.prod gaussianCoordinates) - + (r + 1 : ℕ) * (∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) + (fun τ : Fin (r + 1 + 1) → X => D z.1 (Fin.tail τ) * + cylinderCross (B z.1 ((Fin.tail τ) 0)) (A z.1 (τ 0))) ∂P.prod gaussianCoordinates) := by + let M : ℝ := (|K| + |L|) / 2 + have hM : 0 ≤ M := by dsimp [M]; positivity + have hcov (ω : Ω) (x y : X) : |cylinderCross (B ω x) (A ω y)| ≤ M := by + calc + _ ≤ ((B ω x).sum (fun _ t => t ^ 2) + (A ω y).sum (fun _ t => t ^ 2)) / 2 := + abs_cylinderCross_le _ _ + _ ≤ M := by dsimp [M]; linarith [hb ω x, ha ω y, le_abs_self K, le_abs_self L] + let D₁ := fun (ω : Ω) (σ : Fin (r + 1) → X) => + D ω σ * ∑ i, cylinderCross (B ω (σ 0)) (A ω (σ i)) + let D₂ := fun (ω : Ω) (τ : Fin (r + 1 + 1) → X) => + D ω (Fin.tail τ) * cylinderCross (B ω ((Fin.tail τ) 0)) (A ω (τ 0)) + have hm₁ : Measurable (Function.uncurry D₁) := by + apply hDm.mul + apply Finset.measurable_sum + intro i _ + have hp : Measurable (fun p : Ω × (Fin (r + 1) → X) => + (p.1, (p.2 0, p.2 i))) := measurable_fst.prodMk + (((measurable_pi_apply 0).comp measurable_snd).prodMk + ((measurable_pi_apply i).comp measurable_snd)) + exact hcross.comp hp + have htail : Measurable (fun p : Ω × (Fin (r + 1 + 1) → X) => (p.1, Fin.tail p.2)) := + measurable_fst.prodMk (Measurable.of_eval fun i => + (measurable_pi_apply i.succ).comp measurable_snd) + have hm₂ : Measurable (Function.uncurry D₂) := by + have hp : Measurable (fun p : Ω × (Fin (r + 1 + 1) → X) => + (p.1, (p.2 (0 : Fin (r + 1)).succ, p.2 0))) := measurable_fst.prodMk + (((measurable_pi_apply (0 : Fin (r + 1)).succ).comp measurable_snd).prodMk + ((measurable_pi_apply 0).comp measurable_snd)) + exact (hDm.comp htail).mul (hcross.comp hp) + have hb₁ : ∀ ω σ, |D₁ ω σ| ≤ c * ((r + 1 : ℕ) * M) := by + intro ω σ + have hs : |∑ i, cylinderCross (B ω (σ 0)) (A ω (σ i))| ≤ (r + 1 : ℕ) * M := by + calc + _ ≤ ∑ i, |cylinderCross (B ω (σ 0)) (A ω (σ i))| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _ : Fin (r + 1), M := Finset.sum_le_sum fun _ _ => hcov ω _ _ + _ = _ := by simp + exact (abs_mul _ _).trans_le (mul_le_mul (hD ω σ) hs (abs_nonneg _) hc) + have hb₂ : ∀ ω τ, |D₂ ω τ| ≤ c * M := by + intro ω τ + exact (abs_mul _ _).trans_le (mul_le_mul (hD ω _) (hcov ω _ _) (abs_nonneg _) hc) + have hi := integrable_randomCoefficient_insertion (P := P) hν A B hA hB ha hb D hDm hc hD + have hi₁ := integrable_randomCoefficient_mean (P := P) hν A hA D₁ hm₁ + (by positivity : 0 ≤ c * ((r + 1 : ℕ) * M)) hb₁ + have hi₂ := integrable_randomCoefficient_mean (P := P) hν A hA D₂ hm₂ (mul_nonneg hc hM) hb₂ + change (∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) + (fun σ => cylinderField (B z.1 (σ 0)) z.2 * D z.1 σ) ∂P.prod gaussianCoordinates) = + (∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) (D₁ z.1) ∂P.prod gaussianCoordinates) - + (r + 1 : ℕ) * (∫ z : Ω × (ℕ → ℝ), referenceReplicaMean (ν z.1) + (fun x => cylinderField (A z.1 x) z.2) (D₂ z.1) ∂P.prod gaussianCoordinates) + rw [integral_prod _ hi, integral_prod _ hi₁, integral_prod _ hi₂] + calc + _ = ∫ ω, ((∫ g, referenceReplicaMean (ν ω) (fun x => cylinderField (A ω x) g) + (D₁ ω) ∂gaussianCoordinates) - (r + 1 : ℕ) * + (∫ g, referenceReplicaMean (ν ω) (fun x => cylinderField (A ω x) g) + (D₂ ω) ∂gaussianCoordinates)) ∂P := by + apply integral_congr_ae + exact ae_of_all _ fun ω => countable_cylinder_reference_insertion (ν ω) (A ω) (B ω) + (ha ω) (hb ω) (D ω) hc (hD ω) + _ = _ := by + rw [integral_sub hi₁.integral_prod_left (hi₂.integral_prod_left.const_mul _), integral_const_mul] + +omit [IsProbabilityMeasure P] in +/-- All exponential tilts are integrable for almost every joint disorder. +Only integer tilts are intersected before extending to every real parameter. -/ +lemma randomCoefficient_all_exp_ae (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {K : ℝ} (ha : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ K) : + ∀ᵐ z : Ω × (ℕ → ℝ) ∂P.prod gaussianCoordinates, ∀ t : ℝ, + Integrable (fun x => Real.exp (t * cylinderField (A z.1 x) z.2)) (ν z.1) := by + let κ : Kernel (Ω × (ℕ → ℝ)) X := ⟨fun z => ν z.1, hν.comp measurable_fst⟩ + have : IsMarkovKernel κ := ⟨fun z => by + change IsProbabilityMeasure (ν z.1) + infer_instance⟩ + have hi (t : ℝ) : ∀ᵐ z : Ω × (ℕ → ℝ) ∂P.prod gaussianCoordinates, + Integrable (fun x => Real.exp (t * cylinderField (A z.1 x) z.2)) (ν z.1) := by + have hm : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => + Real.exp (t * cylinderField (A p.1.1 p.2) p.1.2)) := (hA.const_mul t).exp + have hs : MeasurableSet {z : Ω × (ℕ → ℝ) | + Integrable (fun x => Real.exp (t * cylinderField (A z.1 x) z.2)) (ν z.1)} := + ProbabilityTheory.measurableSet_kernel_integrable (κ := κ) hm.stronglyMeasurable + apply (Measure.ae_prod_iff_ae_ae hs).mpr + refine ae_of_all _ fun ω => ?_ + have hv (x : X) : (((A ω x).sum (fun _ c => c ^ 2)).toNNReal : ℝ) ≤ K := by + rw [Real.coe_toNNReal _ (show 0 ≤ (A ω x).sum (fun _ c => c ^ 2) from + Finset.sum_nonneg (fun _ _ => sq_nonneg _))] + exact ha ω x + exact (gaussian_field_exp_integrable (ν := ν ω) (measurable_cylinderFields (A ω)) + (fun x => cylinderField_law (A ω x)) hv t).1.prod_right_ae + have hn : ∀ᵐ z : Ω × (ℕ → ℝ) ∂P.prod gaussianCoordinates, ∀ n : ℤ, + Integrable (fun x => Real.exp ((n : ℝ) * cylinderField (A z.1 x) z.2)) (ν z.1) := + ae_all_iff.mpr (fun n => hi (n : ℝ)) + filter_upwards [hn] with z hz + exact integrable_exp_of_integer_exp (measurable_of_countable _) hz + +omit [Countable X] [MeasurableSingletonClass X] in +lemma measurable_randomCoefficient_cgf (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + (t : ℝ) : + Measurable (fun z : Ω × (ℕ → ℝ) => + cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) t) := by + have : ∀ z : Ω × (ℕ → ℝ), IsProbabilityMeasure ((fun z => ν z.1) z) := fun _ => inferInstance + exact (measurable_random_referencePartition (ν := fun z : Ω × (ℕ → ℝ) => ν z.1) + (hν.comp measurable_fst) (hA.const_mul t)).log + +/-- The external-disorder-dependent log partition is integrable, by the +uniform pointwise Gaussian second-moment estimate. -/ +lemma integrable_randomCoefficient_cgf (hν : Measurable ν) + (A : Ω → X → ℕ →₀ ℝ) + (hA : Measurable (fun p : (Ω × (ℕ → ℝ)) × X => cylinderField (A p.1.1 p.2) p.1.2)) + {K : ℝ} (ha : ∀ ω x, (A ω x).sum (fun _ c => c ^ 2) ≤ K) (t : ℝ) : + Integrable (fun z : Ω × (ℕ → ℝ) => + cgf (fun x => cylinderField (A z.1 x) z.2) (ν z.1) t) (P.prod gaussianCoordinates) := by + have hm := measurable_randomCoefficient_cgf hν A hA t + have hi := joint_integrable_square_of_uniform_conditionals (P := P) hm + (fun ω => (cylinder_cgf_second (ν ω) (A ω) (ha ω) t).1) + (fun ω => (cylinder_cgf_second (ν ω) (A ω) (ha ω) t).2) + exact ((memLp_two_iff_integrable_sq hm.aestronglyMeasurable).mpr hi).integrable (by norm_num) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomFieldAlmostSure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomFieldAlmostSure.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b3f10cd6cb0b190b6d09a5760977844d474f715 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomFieldAlmostSure.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitAlmostSure + +namespace OAI + +/-! Almost-sure extension of Theorem7.1 to a joint conditional orbit law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem random_field_pressure_tendsto_ae + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandRestrictedFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (d : (N : ℕ) → Ω → FieldSpectralData N) (Y : ℕ → Ω → ℝ) + (hd : ∀ N, Measurable (d N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (d N) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ᵐ ω ∂P, ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, + ∀ i, a-ε ≤ (d N ω).1 i ∧ (d N ω).1 i ≤ b+ε) + (hweak : ∀ᵐ ω ∂P, Tendsto (fun k => + empiricalSpectralLaw (Nat.succ_pos k) (d (k+1) ω).1) atTop (𝓝 ν)) + (ξ : ProbabilityMeasure ℝ) (hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (hw : ∀ᵐ ω ∂P, Tendsto (fun k => fieldWassersteinOne + (empiricalSpectralLaw (Nat.succ_pos k) (d (k+1) ω).2) ξ) atTop (𝓝 0)) : + ∀ᵐ ω ∂P, Tendsto (fun N => Y N ω) atTop + (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := by + have hbounded : ∀ᵐ ω ∂P, ∃ K : ℝ, ∀ᶠ k in atTop, + spectralRadius ((d (k+1) ω).1) ≤ K := hno.mono fun ω hω => + spectralRadius_eventually_bounded_of_no_outliers (fun N => (d N ω).1) a b hω + have ht := ae_random_orbit_pressure_sub_mean hhaar P d Y hd hY H hlaw hbounded + filter_upwards [ht,hno,hweak,hw] with ω hω hn hweakω hwω + have hm := general_mean_wasserstein_field_pressure_tendsto hhaar hgauss hpub H + (fun N => (d N ω).1) ν a b hcompact hbound ha hb hn hweakω + (fun N => (d N ω).2) ξ hξ hwω + have hadd := hω.add (hm.comp (tendsto_add_atTop_nat 1)) + simp only [dataPhysicalPressure,Function.comp_apply,sub_add_cancel,zero_add] at hadd + exact (tendsto_add_atTop_iff_nat 1).mp hadd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomGroundLimit.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomGroundLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..37163c8e7b96a1104c5252a2e8a4446e4bd9f6b3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomGroundLimit.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomThermalSqueeze + +namespace OAI + +/-! A zero-temperature limit from fixed-temperature random pressures. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem random_ground_limit {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] + (p : ℝ → ℕ → Ω → ℝ) (G : ℕ → Ω → ℝ) (A : ℝ → ℝ) (c : ℝ) + (hc : 0 ≤ c) (hG : UniformIntegrable G 1 P) + (hpm : ∀ β n, Measurable (p β n)) + (hpi : ∀ β, 0 < β → ∀ n, Integrable (p β n) P) + (hp : ∀ β, 0 < β → TendstoInMeasure P (p β) atTop (fun _ => A β)) + (hpmean : ∀ β, 0 < β → Tendsto (fun n => ∫ ω, p β n ω ∂P) atTop (𝓝 (A β))) + (hb : ∀ β, 0 < β → ∀ n ω, p β n ω/β ≤ G n ω ∧ G n ω ≤ p β n ω/β+c/β) : + ∃ L : ℝ, TendstoInMeasure P G atTop (fun _ => L) ∧ + Tendsto (fun n => eLpNorm (fun ω => G n ω-L) 1 P) atTop (𝓝 0) ∧ + Tendsto (fun n => ∫ ω, G n ω ∂P) atTop (𝓝 L) ∧ + Tendsto (fun β => A β/β) atTop (𝓝 L) := by + let g := fun n => ∫ ω, G n ω ∂P + let q := fun (k n : ℕ) => (∫ ω, p ((k : ℝ)+1) n ω ∂P)/((k : ℝ)+1) + let v := fun k : ℕ => A ((k : ℝ)+1)/((k : ℝ)+1) + have hg (n : ℕ) : Integrable (G n) P := memLp_one_iff_integrable.mp (hG.memLp n) + have hmean (β : ℝ) (hβ : 0 < β) (n : ℕ) : + (∫ ω, p β n ω ∂P)/β ≤ g n ∧ g n ≤ (∫ ω, p β n ω ∂P)/β+c/β := by + have hpi' := (hpi β hβ n).div_const β + have hl := integral_mono hpi' (hg n) (fun ω => (hb β hβ n ω).1) + have hu := integral_mono (hg n) (hpi'.add (integrable_const (c/β))) + (fun ω => (hb β hβ n ω).2) + rw [integral_div] at hl + simp only [Pi.add_apply] at hu + rw [integral_add hpi' (integrable_const _),integral_div,integral_const, + probReal_univ,one_smul] at hu + exact ⟨hl,hu⟩ + obtain ⟨L,hv,hglim⟩ := exists_thermal_ground_limit q g v c hc + (fun k => (hpmean ((k : ℝ)+1) (by positivity)).div_const _) + (fun k => Filter.Eventually.of_forall (hmean ((k : ℝ)+1) (by positivity))) + have hprob : TendstoInMeasure P G atTop (fun _ => L) := by + apply thermal_squeeze_in_measure P (fun k n ω => p ((k : ℝ)+1) n ω/((k : ℝ)+1)) + G v L c hc hv + · intro k + exact tendstoInMeasure_continuous_comp P _ _ (hpm _) (hp _ (by positivity)) + (fun x => x/((k : ℝ)+1)) (continuous_id.div_const _) + · intro k n ω + exact hb ((k : ℝ)+1) (by positivity) n ω + have hL1 := pressure_L1_of_probability_and_uniformIntegrability P G L hG hprob + refine ⟨L,hprob,hL1.1,hL1.2,?_⟩ + have hbounds (β : ℝ) (hβ : 0 < β) : A β/β ≤ L ∧ L ≤ A β/β+c/β := by + have ht := (hpmean β hβ).div_const β + exact ⟨le_of_tendsto_of_tendsto ht hglim + (Filter.Eventually.of_forall fun n => (hmean β hβ n).1), + le_of_tendsto_of_tendsto hglim (ht.add_const _) + (Filter.Eventually.of_forall fun n => (hmean β hβ n).2)⟩ + apply tendsto_sub_nhds_zero_iff.mp + apply squeeze_zero_norm' _ (tendsto_id.const_div_atTop c) + filter_upwards [eventually_gt_atTop (0 : ℝ)] with β hβ + rw [Real.norm_eq_abs,abs_le] + simp only [id_eq] + have hh := hbounds β hβ + constructor <;> linarith [hh.1,hh.2,div_nonneg hc hβ.le] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitAlmostSure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitAlmostSure.lean new file mode 100644 index 0000000000000000000000000000000000000000..c737cbe52e15d5fb90379826bae98752d3029b05 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitAlmostSure.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitTail +import OAI.Probability.InvariantIsing.Pressure.RandomSpectralBound +import OAI.Probability.InvariantIsing.Pressure.LocalizedAlmostSure + +namespace OAI + +/-! Almost-sure conditional Haar concentration for random spectra and fields. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology ENNReal +namespace InvariantIsing + +theorem ae_random_orbit_pressure_sub_mean (hhaar : HaarConcentrationInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (d : (N : ℕ) → Ω → FieldSpectralData N) (Y : ℕ → Ω → ℝ) + (hd : ∀ N, Measurable (d N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (d N) (Y N) (H N)) + (hbound : ∀ᵐ ω ∂P, ∃ K : ℝ, ∀ᶠ k in atTop, spectralRadius ((d (k+1) ω).1) ≤ K) : + ∀ᵐ ω ∂P, Tendsto (fun k => Y (k+1) ω- + ∫ U, dataPhysicalPressure (d (k+1) ω) U ∂H (k+1)) atTop (𝓝 0) := by + apply ae_tendsto_zero_of_localized_exponential_tail P + (fun k ω => Y (k+1) ω-∫ U, dataPhysicalPressure (d (k+1) ω) U ∂H (k+1)) + (fun k ω => spectralRadius ((d (k+1) ω).1)) _ hbound + intro K ε hK hε + obtain ⟨C,a,hC,ha,ht⟩ := uniform_physical_pressure_mean_tail hhaar + obtain ⟨N₀,hN₀⟩ := ht K ε hK hε + refine ⟨C,a*(ε/2)^2/K^2,hC.le,by positivity,max N₀ 3,?_⟩ + intro n hn + have hb := conditional_orbit_tail_bound (Nat.succ_pos n) P (d (n+1)) (Y (n+1)) + (hd (n+1)) (hY (n+1)) (H (n+1)) (hlaw (n+1)) K ε + (C*Real.exp (-a*(n+1 : ℝ)*(ε/2)^2/K^2)) (fun data hdata => by + simpa only [dataPhysicalPressure,Nat.cast_add,Nat.cast_one] using + hN₀ (n+1) (by omega) (by omega) (H (n+1)) inferInstance inferInstance + data.1 data.2 hdata) + have he : {ω | (∀ i, |(d (n+1) ω).1 i| ≤ K) ∧ + ε ≤ |Y (n+1) ω-∫ U, dataPhysicalPressure (d (n+1) ω) U ∂H (n+1)|}= + {ω | ε ≤ |Y (n+1) ω-∫ U, dataPhysicalPressure (d (n+1) ω) U ∂H (n+1)| ∧ + spectralRadius ((d (n+1) ω).1) ≤ K} := by + ext ω + simp only [mem_ofPred_eq,spectralRadius_le_iff,and_comm] + rw [he] at hb + have hreal := ENNReal.toReal_mono (ENNReal.ofReal_ne_top) hb + rw [ENNReal.toReal_ofReal (by positivity)] at hreal + refine hreal.trans ?_ + apply mul_le_mul_of_nonneg_left _ hC.le + apply Real.exp_le_exp.mpr + have hc : 0 ≤ a*(ε/2)^2/K^2 := by positivity + calc + -a*(n+1 : ℝ)*(ε/2)^2/K^2= -(a*(ε/2)^2/K^2)*((n : ℝ)+1) := by ring + _ ≤ -(a*(ε/2)^2/K^2)*(n : ℝ) := by nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitIntegration.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitIntegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ae244cc1735fd9dd4eff355bff2496cc90b5bf7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitIntegration.lean @@ -0,0 +1,32 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitLaw + +namespace OAI + +/-! Integration against the joint conditional orbit law does not require a +(global) integrability hypothesis for the random pressure. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped ENNReal +namespace InvariantIsing + +lemma ConditionalFieldOrbitLaw.lintegral {Ω : Type*} [MeasurableSpace Ω] {N : ℕ} + {P : Measure Ω} [IsProbabilityMeasure P] {d : Ω → FieldSpectralData N} {Y : Ω → ℝ} + {H : Measure (Orthogonal N)} [IsProbabilityMeasure H] + (h : ConditionalFieldOrbitLaw P d Y H) (hN : 0 < N) + (hd : Measurable d) (hY : Measurable Y) + (φ : FieldSpectralData N × ℝ → ℝ≥0∞) (hφ : Measurable φ) : + (∫⁻ ω, φ (d ω,Y ω) ∂P)= + ∫⁻ ω, ∫⁻ U, φ (d ω,dataPhysicalPressure (d ω) U) ∂H ∂P := by + have hm : Measurable (fun z : FieldSpectralData N × Orthogonal N => + (z.1,dataPhysicalPressure z.1 z.2)) := measurable_fst.prodMk (measurable_dataPhysicalPressure hN) + have hF : Measurable (fun z : FieldSpectralData N × Orthogonal N => + φ (z.1,dataPhysicalPressure z.1 z.2)) := hφ.comp hm + rw [← lintegral_map hφ (hd.prodMk hY),h,lintegral_map hφ hm, + lintegral_prod _ hF.aemeasurable] + exact lintegral_map hF.lintegral_prod_right' hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitLaw.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfa66384af59bcec7f6aad9c4c6cf03c9968e31b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitLaw.lean @@ -0,0 +1,62 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticWassersteinMain +import Mathlib.MeasureTheory.Measure.Prod + +namespace OAI + +/-! The joint conditional-Haar hypothesis for random spectra and fields. +Only the one-dimensional marginal orbit law is prescribed at each dimension. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators +namespace InvariantIsing + +abbrev FieldSpectralData (N : ℕ) := (Fin N → ℝ) × (Fin N → ℝ) + +def dataPhysicalPressure {N : ℕ} (d : FieldSpectralData N) (U : Orthogonal N) : ℝ := + rotatedPressure d.1 (matrixRotation U⁻¹) d.2 + +lemma measurable_random_specialPressure {Ω : Type*} [MeasurableSpace Ω] {N : ℕ} + (eig field : Ω → Fin N → ℝ) (heig : Measurable eig) (hfield : Measurable field) + (U : Ω → SpecialOrthogonal N) (hU : Measurable U) : + Measurable (fun ω => rotatedPressure (eig ω) (specialRotation (U ω)) (field ω)) := by + have hE (σ : Spin N) : Measurable (fun ω => + rotatedEnergy (eig ω) (specialRotation (U ω)) σ+fieldEnergy (field ω) σ) := by + apply Measurable.add + · exact ((Finset.measurable_sum _ fun i _ => + ((measurable_pi_apply i).comp heig).mul + (((measurable_specialRotation_eval (spinVector σ) i).comp hU).pow_const 2))).const_mul (1/2 : ℝ) + · exact Finset.measurable_sum _ fun i _ => ((measurable_pi_apply i).comp hfield).mul_const _ + unfold rotatedPressure logPartition + exact ((Finset.measurable_sum _ fun σ _ => (hE σ).exp).const_mul + (Fintype.card (Spin N) : ℝ)⁻¹).log.const_mul (N : ℝ)⁻¹ + +lemma measurable_dataPhysicalPressure {N : ℕ} (hN : 0 < N) : + Measurable (fun z : FieldSpectralData N × Orthogonal N => dataPhysicalPressure z.1 z.2) := by + have hh := measurable_random_specialPressure + (fun z : FieldSpectralData N × Orthogonal N => z.1.1) + (fun z : FieldSpectralData N × Orthogonal N => z.1.2) + (measurable_fst.comp measurable_fst) (measurable_snd.comp measurable_fst) + (fun z => cavityOrientationLift hN z.2⁻¹) + ((measurable_cavityOrientationLift hN).comp measurable_snd.inv) + convert hh using 1 + funext z + simp only [dataPhysicalPressure,rotatedPressure,cavityOrientationLift_energy] + +lemma measurable_dataPressureMean {N : ℕ} (hN : 0 < N) + (H : Measure (Orthogonal N)) [SFinite H] : + Measurable (fun d : FieldSpectralData N => ∫ U, dataPhysicalPressure d U ∂H) := + (measurable_dataPhysicalPressure hN).stronglyMeasurable.integral_prod_right'.measurable + +/-- Conditional jointly on the spectrum and field, the pressure has its Haar orbit law. +This formulation allows arbitrary dependence across dimensions and between the two data sets. -/ +def ConditionalFieldOrbitLaw {Ω : Type*} [MeasurableSpace Ω] {N : ℕ} + (P : Measure Ω) (d : Ω → FieldSpectralData N) (pressure : Ω → ℝ) + (H : Measure (Orthogonal N)) : Prop := + P.map (fun ω => (d ω,pressure ω))= + ((P.map d).prod H).map (fun z => (z.1,dataPhysicalPressure z.1 z.2)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitSupport.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..4357a96a1566a3595c8583297d2a3c2ed7a8c203 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitSupport.lean @@ -0,0 +1,27 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitLaw + +namespace OAI + +/-! Transporting deterministic orbit bounds through the joint conditional law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +lemma ConditionalFieldOrbitLaw.ae_property {Ω : Type*} [MeasurableSpace Ω] {N : ℕ} + (hN : 0 < N) (P : Measure Ω) (d : Ω → FieldSpectralData N) (Y : Ω → ℝ) + (hd : Measurable d) (hY : Measurable Y) + (H : Measure (Orthogonal N)) [SFinite H] + (hlaw : ConditionalFieldOrbitLaw P d Y H) + (Q : FieldSpectralData N × ℝ → Prop) (hQ : MeasurableSet {z | Q z}) + (hbound : ∀ data U, Q (data,dataPhysicalPressure data U)) : + ∀ᵐ ω ∂P, Q (d ω,Y ω) := by + apply ae_of_ae_map (hd.prodMk hY).aemeasurable + rw [hlaw] + apply (ae_map_iff (measurable_fst.prodMk (measurable_dataPhysicalPressure hN)).aemeasurable hQ).mpr + exact Filter.Eventually.of_forall fun z => hbound z.1 z.2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitTail.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5dac94218b830186cdffa848c074578278f9cdc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomOrbitTail.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitIntegration +import OAI.Probability.InvariantIsing.Pressure.UniformPhysicalTail + +namespace OAI + +/-! A localized tail bound under the exact joint conditional orbit hypothesis. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace InvariantIsing + +lemma conditional_orbit_tail_bound {Ω : Type*} [MeasurableSpace Ω] {N : ℕ} + (hN : 0 < N) (P : Measure Ω) [IsProbabilityMeasure P] + (d : Ω → FieldSpectralData N) (Y : Ω → ℝ) (hd : Measurable d) (hY : Measurable Y) + (H : Measure (Orthogonal N)) [IsProbabilityMeasure H] + (hlaw : ConditionalFieldOrbitLaw P d Y H) (K ε B : ℝ) + (hbound : ∀ data : FieldSpectralData N, (∀ i, |data.1 i| ≤ K) → + H.real {U | ε ≤ |dataPhysicalPressure data U-(∫ V, dataPhysicalPressure data V ∂H)|} ≤ B) : + P {ω | (∀ i, |(d ω).1 i| ≤ K) ∧ + ε ≤ |Y ω-(∫ V, dataPhysicalPressure (d ω) V ∂H)|} ≤ ENNReal.ofReal B := by + let mean := fun data : FieldSpectralData N => ∫ V, dataPhysicalPressure data V ∂H + have hm : Measurable mean := measurable_dataPressureMean hN H + let E : Set (FieldSpectralData N × ℝ) := {z | (∀ i, |z.1.1 i| ≤ K) ∧ ε ≤ |z.2-mean z.1|} + have hK : MeasurableSet {z : FieldSpectralData N × ℝ | ∀ i, |z.1.1 i| ≤ K} := by + simp only [ofPred_forall] + apply MeasurableSet.iInter + intro i + exact measurableSet_le (((measurable_pi_apply i).comp + (measurable_fst.comp measurable_fst)).abs) measurable_const + have hE : MeasurableSet E := hK.inter + (measurableSet_le measurable_const (measurable_snd.sub (hm.comp measurable_fst)).abs) + have hp : Measurable (fun z : FieldSpectralData N × Orthogonal N => + (z.1,dataPhysicalPressure z.1 z.2)) := + measurable_fst.prodMk (measurable_dataPhysicalPressure hN) + have he := congrArg (fun Q : Measure (FieldSpectralData N × ℝ) => Q E) hlaw + rw [Measure.map_apply (hd.prodMk hY) hE,Measure.map_apply hp hE, + Measure.prod_apply (hp hE)] at he + let : IsProbabilityMeasure (P.map d) := + (Measure.isProbabilityMeasure_map_iff hd.aemeasurable).mpr inferInstance + change P ((fun ω => (d ω,Y ω)) ⁻¹' E) ≤ _ + rw [he] + calc + _ ≤ ∫⁻ _data : FieldSpectralData N, ENNReal.ofReal B ∂P.map d := by + apply lintegral_mono + intro data + dsimp only + by_cases hdata : ∀ i, |data.1 i| ≤ K + · have hevent : Prod.mk data ⁻¹' ((fun z : FieldSpectralData N × Orthogonal N => + (z.1,dataPhysicalPressure z.1 z.2)) ⁻¹' E)= + {U | ε ≤ |dataPhysicalPressure data U-mean data|} := by + ext U + change ((∀ i, |data.1 i| ≤ K) ∧ ε ≤ |dataPhysicalPressure data U-mean data|) ↔ _ + exact and_iff_right hdata + rw [hevent] + have hb := ENNReal.ofReal_le_ofReal (hbound data hdata) + rwa [measureReal_def,ENNReal.ofReal_toReal (measure_ne_top H _)] at hb + · have hevent : Prod.mk data ⁻¹' ((fun z : FieldSpectralData N × Orthogonal N => + (z.1,dataPhysicalPressure z.1 z.2)) ⁻¹' E)=∅ := by + ext U + change ((∀ i, |data.1 i| ≤ K) ∧ ε ≤ |dataPhysicalPressure data U-mean data|) ↔ False + simp only [hdata,false_and] + rw [hevent,measure_empty] + exact bot_le + _ = _ := by simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureAlmostSure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureAlmostSure.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd62243525d9fa04deac4c244acf5f92cf49ff92 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureAlmostSure.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitAlmostSure +import OAI.Probability.InvariantIsing.Pressure.GeneralSpectralPressure + +namespace OAI + +/-! The almost-sure random-spectrum pressure theorem, under the conditional +orbit law in Proposition gen:random. No global integrability is assumed. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem random_pressure_tendsto_ae + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (heig : ∀ N, Measurable (eig N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ᵐ ω ∂P, ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, + ∀ i, a-ε ≤ eig N ω i ∧ eig N ω i ≤ b+ε) + (hweak : ∀ᵐ ω ∂P, Tendsto (fun k => + empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1) ω)) atTop (𝓝 ν)) : + ∀ᵐ ω ∂P, Tendsto (fun N => Y N ω) atTop + (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + have hbounded : ∀ᵐ ω ∂P, ∃ K : ℝ, ∀ᶠ k in atTop, + spectralRadius (eig (k+1) ω) ≤ K := hno.mono fun ω hω => + spectralRadius_eventually_bounded_of_no_outliers (fun N => eig N ω) a b hω + have ht := ae_random_orbit_pressure_sub_mean hhaar P + (fun N ω => (eig N ω,fun _ => 0)) Y + (fun N => (heig N).prodMk measurable_const) hY H hlaw hbounded + filter_upwards [ht,hno,hweak] with ω hω hn hw + have hm := general_spectral_mean_pressure_tendsto hhaar hgauss hpub H + (fun N => eig N ω) ν a b hcompact hbound ha hb hn hw + have hadd := hω.add (hm.comp (tendsto_add_atTop_nat 1)) + simp only [dataPhysicalPressure,Function.comp_apply,sub_add_cancel,zero_add] at hadd + exact (tendsto_add_atTop_iff_nat 1).mp hadd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureBound.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dafb310d086ca38e9071269f6c628a5c3e887ac --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureBound.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitSupport +import OAI.Probability.InvariantIsing.Pressure.RandomSpectralMeasurability +import OAI.Probability.InvariantIsing.Pressure.RandomUniformIntegrability + +namespace OAI + +/-! The operator-norm sufficient condition for uniform integrability of the +actual random pressure under its conditional orbit law. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +lemma ConditionalFieldOrbitLaw.zero_field_bound {Ω : Type*} [MeasurableSpace Ω] {n : ℕ} + (P : Measure Ω) (eig : Ω → Fin (n+1) → ℝ) (Y : Ω → ℝ) + (heig : Measurable eig) (hY : Measurable Y) + (H : Measure (Orthogonal (n+1))) [SFinite H] + (hlaw : ConditionalFieldOrbitLaw P (fun ω => (eig ω,fun _ => 0)) Y H) : + ∀ᵐ ω ∂P, |Y ω| ≤ spectralRadius (eig ω)/2 := by + let Q := fun z : FieldSpectralData (n+1) × ℝ => + z.1.2 ≠ (fun _ => 0) ∨ |z.2| ≤ spectralRadius z.1.1/2 + have hQ : MeasurableSet {z | Q z} := + (measurableSet_eq_fun (measurable_snd.comp measurable_fst) measurable_const).compl.union + (measurableSet_le measurable_snd.abs + ((measurable_spectralRadius (fun z : FieldSpectralData (n+1) × ℝ => z.1.1) + (measurable_fst.comp measurable_fst)).div_const 2)) + have hB (data : FieldSpectralData (n+1)) (U : Orthogonal (n+1)) : + Q (data,dataPhysicalPressure data U) := by + by_cases hc : data.2=(fun _ => 0) + · right + dsimp only [dataPhysicalPressure] + rw [hc] + have hh := abs_rotatedPressure_sub_le (Nat.succ_pos n) data.1 (fun _ => 0) + (matrixRotation U⁻¹) (fun _ => 0) (spectralRadius data.1) + (fun i => by simpa only [sub_zero] using abs_le_spectralRadius data.1 i) + simpa only [rotatedPressure_constant (Nat.succ_pos n),zero_div,sub_zero] using hh + · exact Or.inl hc + have hh := hlaw.ae_property (Nat.succ_pos n) P _ Y (heig.prodMk measurable_const) + hY H Q hQ hB + simpa only [Q,ne_eq,not_true_eq_false,false_or] using hh + +theorem random_pressure_uniformIntegrable_of_spectralRadius + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (heig : ∀ N, Measurable (eig N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (hUI : UniformIntegrable (fun k ω => spectralRadius (eig (k+1) ω)) 1 P) : + UniformIntegrable (fun k => Y (k+1)) 1 P := by + apply uniformIntegrable_of_abs_le P _ _ (fun k => (hY (k+1)).aestronglyMeasurable) hUI + intro k + filter_upwards [(hlaw (k+1)).zero_field_bound P (eig (k+1)) (Y (k+1)) + (heig (k+1)) (hY (k+1)) (H (k+1))] with ω hω + have hR : 0 ≤ spectralRadius (eig (k+1) ω) := + (abs_nonneg (eig (k+1) ω 0)).trans (abs_le_spectralRadius (eig (k+1) ω) 0) + exact hω.trans ((half_le_self hR).trans (le_abs_self _)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureMain.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..f292336d138f9e00896cc3a0b60fcd12eb54ce34 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureMain.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomPressureBound + +namespace OAI + +/-! The complete in-probability, L1 and expectation clauses of Proposition gen:random. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem random_pressure_limit + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (heig : ∀ N, Measurable (eig N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hweak : TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1) ω))) atTop + (fun _ => LevyProkhorov.ofMeasure ν)) + (hexcess : TendstoInMeasure P (fun k ω => spectralExcess (eig (k+1) ω) a b) + atTop (fun _ => 0)) + (hUI : UniformIntegrable (fun k => Y (k+1)) 1 P) : + TendstoInMeasure P (fun k => Y (k+1)) atTop + (fun _ => (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) ∧ + Tendsto (fun k => eLpNorm (fun ω => Y (k+1) ω- + (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) 1 P) atTop (𝓝 0) ∧ + Tendsto (fun k => ∫ ω, Y (k+1) ω ∂P) atTop + (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + have hp := random_pressure_tendsto_in_measure hhaar hgauss hpub P eig Y heig hY H hlaw + ν a b hcompact hbound ha hb hweak hexcess + exact ⟨hp,pressure_L1_of_probability_and_uniformIntegrability P _ _ hUI hp⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureProbability.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureProbability.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b0f273c33c12756c5a30a07b717f604e26db2fe --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomPressureProbability.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Spectral.SelectedSpectralPressure +import OAI.Probability.InvariantIsing.Spectral.SelectedOrbitAlmostSure +import OAI.Probability.InvariantIsing.Spectral.SelectedSpectralExcess +import Mathlib.MeasureTheory.Measure.LevyProkhorovMetric +import Mathlib.MeasureTheory.Function.ConvergenceInMeasure + +namespace OAI + +/-! Proposition gen:random: convergence in probability from weak empirical +convergence and vanishing edge excess, with no independence across dimensions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem random_pressure_tendsto_in_measure + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (heig : ∀ N, Measurable (eig N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hweak : TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1) ω))) atTop + (fun _ => LevyProkhorov.ofMeasure ν)) + (hexcess : TendstoInMeasure P (fun k ω => spectralExcess (eig (k+1) ω) a b) + atTop (fun _ => 0)) : + TendstoInMeasure P (fun k => Y (k+1)) atTop + (fun _ => (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + apply (exists_seq_tendstoInMeasure_atTop_iff + (fun k => (hY (k+1)).aestronglyMeasurable)).mpr + intro ns hns + obtain ⟨u,hu,hwu⟩ := (hweak.comp hns.tendsto_atTop).exists_seq_tendsto_ae + obtain ⟨v,hv,hev⟩ := (hexcess.comp (hns.comp hu).tendsto_atTop).exists_seq_tendsto_ae + let s := ns ∘ u ∘ v + have hs : StrictMono s := hns.comp (hu.comp hv) + have hws : ∀ᵐ ω ∂P, Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos (s k)) + (eig (s k+1) ω)) atTop (𝓝 ν) := by + filter_upwards [hwu] with ω hω + exact (LevyProkhorov.continuous_toMeasure_probabilityMeasure.tendsto _).comp + (hω.comp hv.tendsto_atTop) + have hbs : ∀ᵐ ω ∂P, ∃ K : ℝ, ∀ᶠ k in atTop, spectralRadius (eig (s k+1) ω) ≤ K := by + filter_upwards [hev] with ω hω + exact selected_spectralRadius_bounded s (fun k => eig (s k+1) ω) a b hω + have ht := ae_selected_orbit_pressure_sub_mean hhaar P s hs.id_le + (fun k ω => (eig (s k+1) ω,fun _ => 0)) (fun k => Y (s k+1)) + (fun k => (heig (s k+1)).prodMk measurable_const) (fun k => hY (s k+1)) H + (fun k => hlaw (s k+1)) hbs + refine ⟨u ∘ v,hu.comp hv,?_⟩ + filter_upwards [ht,hws,hev] with ω htω hwω heω + have hm := selected_spectral_pressure_tendsto hhaar hgauss hpub H + (fun k => s k+1) (fun k => Nat.succ_pos _) ((tendsto_add_atTop_nat 1).comp hs.tendsto_atTop) + (fun k => eig (s k+1) ω) ν a b hcompact hbound ha hb + (selected_no_outliers_of_excess (fun k => s k+1) (fun k => eig (s k+1) ω) a b heω) hwω + have hh := htω.add hm + simpa only [s,Function.comp_apply,dataPhysicalPressure,sub_add_cancel,zero_add] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomSpectralBound.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomSpectralBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9c2dd577ae04d99a14b74506c16c95748cbc12e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomSpectralBound.lean @@ -0,0 +1,64 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralExtremeLimits + +namespace OAI + +/-! The extreme eigenvalues control a random spectrum without moment hypotheses. -/ +noncomputable section +open Filter Set +open scoped Topology +namespace InvariantIsing + +def spectralRadius {n : ℕ} (eig : Fin (n+1) → ℝ) : ℝ := + max |spectralMinimum eig| |spectralMaximum eig| + +lemma abs_le_spectralRadius {n : ℕ} (eig : Fin (n+1) → ℝ) (i : Fin (n+1)) : + |eig i| ≤ spectralRadius eig := by + apply abs_le.mpr + constructor + · exact (neg_le_neg (le_max_left _ _)).trans + ((neg_abs_le (spectralMinimum eig)).trans (spectralMinimum_le eig i)) + · exact (le_spectralMaximum eig i).trans + ((le_abs_self _).trans (le_max_right _ _)) + +lemma spectralRadius_le_iff {n : ℕ} (eig : Fin (n+1) → ℝ) (K : ℝ) : + spectralRadius eig ≤ K ↔ ∀ i, |eig i| ≤ K := by + constructor + · intro h i + exact (abs_le_spectralRadius eig i).trans h + · intro h + apply max_le + · obtain ⟨i,_,hi⟩ := Finset.mem_image.mp (Finset.min'_mem + (Finset.univ.image eig) (Finset.image_nonempty.mpr Finset.univ_nonempty)) + simpa only [spectralMinimum,← hi] using h i + · obtain ⟨i,_,hi⟩ := Finset.mem_image.mp (Finset.max'_mem + (Finset.univ.image eig) (Finset.image_nonempty.mpr Finset.univ_nonempty)) + simpa only [spectralMaximum,← hi] using h i + +lemma spectralRadius_eventually_bounded (eig : (N : ℕ) → Fin N → ℝ) (a b : ℝ) + (hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) : + ∃ K : ℝ, ∀ᶠ k in atTop, spectralRadius (eig (k+1)) ≤ K := by + refine ⟨max |a| |b|+1,?_⟩ + have ht := hmin.abs.max hmax.abs + exact (ht.eventually (Iio_mem_nhds (lt_add_one _))).mono fun _ h => h.le + +lemma spectralRadius_eventually_bounded_of_no_outliers + (eig : (N : ℕ) → Fin N → ℝ) (a b : ℝ) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) : + ∃ K : ℝ, ∀ᶠ k in atTop, spectralRadius (eig (k+1)) ≤ K := by + refine ⟨max |a| |b|+1,?_⟩ + filter_upwards [(tendsto_add_atTop_nat 1).eventually (hno 1 zero_lt_one)] with k hk + apply (spectralRadius_le_iff _ _).mpr + intro i + apply abs_le.mpr + have ha := neg_abs_le a + have hb := le_abs_self b + have hma := le_max_left |a| |b| + have hmb := le_max_right |a| |b| + constructor <;> linarith [(hk i).1,(hk i).2] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomSpectralMeasurability.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomSpectralMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ef4ae41f26459fd52400232bc2c9257aea05331 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomSpectralMeasurability.lean @@ -0,0 +1,33 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomSpectralBound +import Mathlib.MeasureTheory.Order.Lattice + +namespace OAI + +/-! Measurability of the finite-dimensional spectral norm bound. -/ +noncomputable section +open MeasureTheory +namespace InvariantIsing + +lemma spectralRadius_eq_sup_abs {n : ℕ} (eig : Fin (n+1) → ℝ) : + spectralRadius eig=Finset.univ.sup' Finset.univ_nonempty (fun i => |eig i|) := by + apply le_antisymm + · apply (spectralRadius_le_iff _ _).mpr + intro i + exact Finset.le_sup' (fun i => |eig i|) (Finset.mem_univ i) + · exact Finset.sup'_le Finset.univ_nonempty _ fun i _ => abs_le_spectralRadius eig i + +lemma measurable_spectralRadius {Ω : Type*} [MeasurableSpace Ω] {n : ℕ} + (eig : Ω → Fin (n+1) → ℝ) (heig : Measurable eig) : + Measurable (fun ω => spectralRadius (eig ω)) := by + have hh := Finset.measurable_sup' (s := (Finset.univ : Finset (Fin (n+1)))) + Finset.univ_nonempty (fun i _ => ((measurable_pi_apply i).comp heig).abs) + convert hh using 1 + funext ω + rw [spectralRadius_eq_sup_abs,Finset.sup'_apply] + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomSqrtLimit.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomSqrtLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..882ad5788fd586b3b81ff05e86bfef1e9c755d95 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomSqrtLimit.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomThermalSqueeze + +namespace OAI + +/-! Continuous square-root transport with uniform integrability. -/ +noncomputable section +open MeasureTheory Filter +open scoped Topology ENNReal +namespace InvariantIsing + +lemma uniformIntegrable_add_real {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (X Y : ℕ → Ω → ℝ) + (hX : UniformIntegrable X 1 P) (hY : UniformIntegrable Y 1 P) : + UniformIntegrable (fun n ω => X n ω+Y n ω) 1 P := by + refine ⟨hX.1.add hY.1 le_rfl,?_⟩ + obtain ⟨C,hC⟩ := hX.2 + obtain ⟨D,hD⟩ := hY.2 + refine ⟨C+D,fun n => ?_⟩ + exact (eLpNorm_add_le (f := X n) (g := Y n) le_rfl).trans (add_le_add (hC n) (hD n)) + +lemma uniformIntegrable_abs_real {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (X : ℕ → Ω → ℝ) (hX : UniformIntegrable X 1 P) : + UniformIntegrable (fun n ω => |X n ω|) 1 P := by + apply uniformIntegrable_of_abs_le P _ X + (fun n => (hX.aestronglyMeasurable n).norm) hX + intro n + filter_upwards [] with ω + simp only [Real.norm_eq_abs,abs_abs,le_refl] + +lemma random_sqrt_scaled_limit {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (X : ℕ → Ω → ℝ) (L a : ℝ) + (ha : |a| ≤ 2) (hX : ∀ n, Measurable (X n)) (hUI : UniformIntegrable X 1 P) + (hprob : TendstoInMeasure P X atTop (fun _ => L)) : + TendstoInMeasure P (fun n ω => Real.sqrt (a*X n ω)) atTop (fun _ => Real.sqrt (a*L)) ∧ + Tendsto (fun n => eLpNorm (fun ω => Real.sqrt (a*X n ω)-Real.sqrt (a*L)) 1 P) + atTop (𝓝 0) := by + have hs : UniformIntegrable (fun n ω => 1+|X n ω|) 1 P := + uniformIntegrable_add_real P _ _ (uniformIntegrable_const le_rfl (by simp) (memLp_const 1)) + (uniformIntegrable_abs_real P X hUI) + have hsq : UniformIntegrable (fun n ω => Real.sqrt (a*X n ω)) 1 P := by + apply uniformIntegrable_of_abs_le P _ _ + (fun n => (((hX n).const_mul a).sqrt).aestronglyMeasurable) hs + intro n + filter_upwards [] with ω + rw [abs_of_nonneg (Real.sqrt_nonneg _),abs_of_nonneg (by positivity : 0 ≤ 1+|X n ω|)] + apply (Real.sqrt_le_iff).mpr + constructor + · positivity + · have hax : a*X n ω ≤ 2*|X n ω| := (le_abs_self (a*X n ω)).trans (by + rw [abs_mul] + exact mul_le_mul_of_nonneg_right ha (abs_nonneg _)) + nlinarith [sq_nonneg (|X n ω|),sq_abs (X n ω)] + have hp := tendstoInMeasure_continuous_comp P X L hX hprob + (fun x => Real.sqrt (a*x)) (Real.continuous_sqrt.comp (continuous_const.mul continuous_id)) + exact ⟨hp,(pressure_L1_of_probability_and_uniformIntegrability P _ _ hsq hp).1⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomThermalSqueeze.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomThermalSqueeze.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fbeaccac468a9e044c1619fe8e3a9d6f6ea8809 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomThermalSqueeze.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomUniformIntegrability +import OAI.Probability.InvariantIsing.Pressure.ThermalLimitSqueeze + +namespace OAI + +/-! A soft-maximum squeeze for convergence in probability. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +lemma tendstoInMeasure_continuous_comp {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsFiniteMeasure P] (X : ℕ → Ω → ℝ) (L : ℝ) + (hX : ∀ n, Measurable (X n)) (h : TendstoInMeasure P X atTop (fun _ => L)) + (f : ℝ → ℝ) (hf : Continuous f) : + TendstoInMeasure P (fun n ω => f (X n ω)) atTop (fun _ => f L) := by + apply (exists_seq_tendstoInMeasure_atTop_iff + (fun n => (hf.measurable.comp (hX n)).aestronglyMeasurable)).mpr + intro ns hns + obtain ⟨u,hu,he⟩ := (h.comp hns.tendsto_atTop).exists_seq_tendsto_ae + refine ⟨u,hu,he.mono fun ω hω => (hf.tendsto L).comp hω⟩ + +lemma thermal_squeeze_in_measure {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (X : ℕ → ℕ → Ω → ℝ) (G : ℕ → Ω → ℝ) + (v : ℕ → ℝ) (L c : ℝ) (hc : 0 ≤ c) + (hv : Tendsto v atTop (𝓝 L)) + (hp : ∀ k, TendstoInMeasure P (X k) atTop (fun _ => v k)) + (hb : ∀ k n ω, X k n ω ≤ G n ω ∧ G n ω ≤ X k n ω+c/(k+1)) : + TendstoInMeasure P G atTop (fun _ => L) := by + rw [tendstoInMeasure_iff_norm] + intro ε hε + have hd : Tendsto (fun k : ℕ => c/(k+1)) atTop (𝓝 0) := by + simpa only [mul_one_div,mul_zero] using + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_mul c + have hvd : Tendsto (fun k => |v k-L|+c/(k+1)) atTop (𝓝 0) := by + simpa using ((hv.sub_const L).abs.add hd) + obtain ⟨k,hk⟩ := (hvd.eventually (gt_mem_nhds (half_pos hε))).exists + have hprob := (tendstoInMeasure_iff_norm.mp (hp k)) (ε/2) (half_pos hε) + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hprob + (Filter.Eventually.of_forall fun _ => bot_le) + (Filter.Eventually.of_forall fun n => measure_mono ?_) + intro ω hω + simp only [mem_ofPred_eq,Real.norm_eq_abs] at hω ⊢ + by_contra! hbad + have hB := hb k n ω + have hc' : 0 ≤ c/(k+1) := by positivity + have hG : |G n ω-L| ≤ |X k n ω-v k|+|v k-L|+c/(k+1) := by + rw [abs_le] + constructor <;> linarith [neg_abs_le (X k n ω-v k),le_abs_self (X k n ω-v k), + neg_abs_le (v k-L),le_abs_self (v k-L)] + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/RandomUniformIntegrability.lean b/lean/OAI/Probability/InvariantIsing/Pressure/RandomUniformIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6729cb30d52ba27ba5f7cb7ae3c1e0e896a3c59 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/RandomUniformIntegrability.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomPressureProbability +import Mathlib.MeasureTheory.Function.UniformIntegrable + +namespace OAI + +/-! The uniform-integrability conclusion of Proposition gen:random. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology ENNReal +namespace InvariantIsing + +lemma uniformIntegrable_of_abs_le {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (X Z : ℕ → Ω → ℝ) (hX : ∀ n, AEStronglyMeasurable (X n) P) + (hZ : UniformIntegrable Z 1 P) (hXZ : ∀ n, ∀ᵐ ω ∂P, |X n ω| ≤ |Z n ω|) : + UniformIntegrable X 1 P := by + have hd n : (fun ω => ‖X n ω‖ₑ) ≤ᵐ[P] (fun ω => ‖Z n ω‖ₑ) := + (hXZ n).mono fun ω hω => by + simpa only [Real.enorm_eq_ofReal_abs] using ENNReal.ofReal_le_ofReal hω + refine ⟨hZ.1.ae_mono hX hd,?_⟩ + obtain ⟨C,hC⟩ := hZ.2 + exact ⟨C,fun n => (eLpNorm_mono_enorm_ae (hX n) (hd n)).trans (hC n)⟩ + +lemma pressure_L1_of_probability_and_uniformIntegrability + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (X : ℕ → Ω → ℝ) (L : ℝ) (hUI : UniformIntegrable X 1 P) + (hprob : TendstoInMeasure P X atTop (fun _ => L)) : + Tendsto (fun n => eLpNorm (fun ω => X n ω-L) 1 P) atTop (𝓝 0) ∧ + Tendsto (fun n => ∫ ω, X n ω ∂P) atTop (𝓝 L) := by + have hL := tendsto_Lp_finite_of_tendstoInMeasure (p := 1) le_rfl (by simp) + hUI.aestronglyMeasurable (memLp_const L) hUI.1 hprob + refine ⟨hL,?_⟩ + have hh := tendsto_integral_of_L1' (fun _ : Ω => L) + (Filter.Eventually.of_forall fun n => (memLp_one_iff_integrable.mp (hUI.memLp n))) hL + simpa only [integral_const,probReal_univ,one_smul] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/ThermalLimitSqueeze.lean b/lean/OAI/Probability/InvariantIsing/Pressure/ThermalLimitSqueeze.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5344a30672a754be5a1facbe9d0a53860d38d2e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/ThermalLimitSqueeze.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralApproximationSqueeze +import Mathlib.Topology.MetricSpace.Cauchy +import Mathlib.Analysis.SpecificLimits.Basic + +namespace OAI + +/-! Integer temperatures determine a unique deterministic zero-temperature limit. -/ + +noncomputable section +open Filter +open scoped Topology + +namespace InvariantIsing + +lemma thermal_squeeze_tendsto (p : ℕ → ℕ → ℝ) (g v : ℕ → ℝ) (c L : ℝ) + (hc : 0 ≤ c) (hv : Tendsto v atTop (𝓝 L)) + (hp : ∀ k, Tendsto (p k) atTop (𝓝 (v k))) + (hb : ∀ k, ∀ᶠ N in atTop, p k N ≤ g N ∧ g N ≤ p k N+c/(k+1)) : + Tendsto g atTop (𝓝 L) := by + have hδ : Tendsto (fun k : ℕ => 2*(c/(k+1))) atTop (𝓝 0) := by + have hh := (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_mul (2*c) + simp only [mul_zero] at hh + convert hh using 1 + funext k + ring + apply spectral_approximation_squeeze g p p v (fun k => 2*(c/(k+1))) L hv hδ hp hp + intro k + filter_upwards [hb k] with N hN + have hnonneg : 0 ≤ c/(k+1) := by positivity + constructor <;> linarith [hN.1,hN.2] + +lemma exists_thermal_ground_limit (p : ℕ → ℕ → ℝ) (g v : ℕ → ℝ) (c : ℝ) + (hc : 0 ≤ c) (hp : ∀ k, Tendsto (p k) atTop (𝓝 (v k))) + (hb : ∀ k, ∀ᶠ N in atTop, p k N ≤ g N ∧ g N ≤ p k N+c/(k+1)) : + ∃ L : ℝ, Tendsto v atTop (𝓝 L) ∧ Tendsto g atTop (𝓝 L) := by + have horder (k l : ℕ) : v k ≤ v l+c/(l+1) := by + apply le_of_tendsto_of_tendsto (hp k) ((hp l).add_const _) + filter_upwards [hb k,hb l] with N hk hl + exact hk.1.trans hl.2 + have hδ : Tendsto (fun k : ℕ => c/(k+1)) atTop (𝓝 0) := by + simpa only [mul_one_div,mul_zero] using + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_mul c + have hC : CauchySeq v := by + apply cauchySeq_of_le_tendsto_0 (fun k : ℕ => c/(k+1)) _ hδ + intro n m k hn hm + have hn' : (k : ℝ)+1 ≤ (n : ℝ)+1 := by exact_mod_cast Nat.add_le_add_right hn 1 + have hm' : (k : ℝ)+1 ≤ (m : ℝ)+1 := by exact_mod_cast Nat.add_le_add_right hm 1 + have hen : c/((n : ℝ)+1) ≤ c/((k : ℝ)+1) := + div_le_div_of_nonneg_left hc (by positivity) hn' + have hem : c/((m : ℝ)+1) ≤ c/((k : ℝ)+1) := + div_le_div_of_nonneg_left hc (by positivity) hm' + rw [Real.dist_eq,abs_le] + constructor <;> linarith [horder n m,horder m n] + obtain ⟨L,hL⟩ := cauchySeq_tendsto_of_complete hC + exact ⟨L,hL,thermal_squeeze_tendsto p g v c L hc hL hp hb⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/ThermalPressure.lean b/lean/OAI/Probability/InvariantIsing/Pressure/ThermalPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..878140f1a546d6d4e8797946bb2ff486100ae2ce --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/ThermalPressure.lean @@ -0,0 +1,116 @@ +import OAI.Probability.InvariantIsing.Pressure.PressureMean +import OAI.Probability.InvariantIsing.Core.Ward + +namespace OAI + +/-! Temperature differentiation for the actual finite Ising pressure. -/ + +noncomputable section + +open IsingPerceptron MeasureTheory Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma rotatedEnergy_scale {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (t : ℝ) (σ : Spin N) : + rotatedEnergy (fun i => t * eig i) U σ = t * rotatedEnergy eig U σ := by + simp only [rotatedEnergy, mul_assoc, ← Finset.mul_sum] + ring + +lemma abs_rotatedEnergy_le {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (K : ℝ) (heig : ∀ i, |eig i| ≤ K) (σ : Spin N) : + |rotatedEnergy eig U σ| ≤ K * N / 2 := by + simpa only [rotatedEnergy_constant, zero_mul, zero_div, sub_zero] using + abs_rotatedEnergy_sub_le eig (fun _ => 0) U K (fun i => by simpa using heig i) σ + +lemma GibbsReference_one {S : Type*} [Nonempty S] : + GibbsReference (fun _ : S => (1 : ℝ)) := + ⟨fun _ => zero_le_one, ⟨Classical.choice inferInstance, zero_lt_one⟩⟩ + +def thermalPressureDerivative {N : ℕ} (eig c : Fin N → ℝ) (U : Rotation N) (t : ℝ) : ℝ := + (N : ℝ)⁻¹ * gibbsAverage (fun _ => 1) + (fun σ => t * rotatedEnergy eig U σ + fieldEnergy c σ) (rotatedEnergy eig U) + +lemma hasDerivAt_rotatedPressure_temperature {N : ℕ} (eig c : Fin N → ℝ) + (U : Rotation N) (t : ℝ) : + HasDerivAt (fun s => rotatedPressure (fun i => s * eig i) U c) + (thermalPressureDerivative eig c U t) t := by + have hd := (hasDerivAt_log_finitePartition GibbsReference_one + (fun σ : Spin N => ((hasDerivAt_id t).mul_const + (rotatedEnergy eig U σ)).add_const (fieldEnergy c σ))).sub_const + (Real.log (Fintype.card (Spin N))) + have he : (fun s => Real.log (finitePartition (fun _ : Spin N => 1) + (fun σ => s * rotatedEnergy eig U σ + fieldEnergy c σ)) - + Real.log (Fintype.card (Spin N))) = + (fun s => logPartition (fun σ => rotatedEnergy (fun i => s * eig i) U σ + fieldEnergy c σ)) := by + funext s + rw [logPartition_eq] + simp only [finitePartition, one_mul, rotatedEnergy_scale] + simp only [id_eq, one_mul] at hd + rw [he] at hd + exact hd.const_mul (N : ℝ)⁻¹ + +lemma abs_thermalPressureDerivative_le {N : ℕ} (hN : 0 < N) + (eig c : Fin N → ℝ) (U : Rotation N) (K : ℝ) + (heig : ∀ i, |eig i| ≤ K) (t : ℝ) : + |thermalPressureDerivative eig c U t| ≤ K / 2 := by + have hb := abs_gibbsAverage_le GibbsReference_one + (fun σ => t * rotatedEnergy eig U σ + fieldEnergy c σ) (rotatedEnergy eig U) + (abs_rotatedEnergy_le eig U K heig) + unfold thermalPressureDerivative + rw [abs_mul, abs_of_nonneg (show (0 : ℝ) ≤ (N : ℝ)⁻¹ by positivity)] + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + calc + _ ≤ (N : ℝ)⁻¹ * (K * N / 2) := mul_le_mul_of_nonneg_left hb (by positivity) + _ = K / 2 := by field_simp + +lemma measurable_thermalPressureDerivative {N : ℕ} (eig c : Fin N → ℝ) (t : ℝ) : + Measurable (fun V : SpecialOrthogonal N => thermalPressureDerivative eig c (specialRotation V) t) := by + have hE (σ : Spin N) : Measurable (fun V : SpecialOrthogonal N => + rotatedEnergy eig (specialRotation V) σ) := + (Finset.measurable_sum _ fun i _ => + ((measurable_specialRotation_eval (spinVector σ) i).pow_const 2).const_mul (eig i)).const_mul _ + exact (measurable_gibbsAverage (fun _ => 1) _ _ + (fun σ => ((hE σ).const_mul t).add_const _) hE).const_mul _ + +/-- Differentiation commutes with the disorder expectation. The bound is +uniform in the field and does not require Haar invariance. -/ +theorem hasDerivAt_mean_pressure_temperature {N : ℕ} (hN : 0 < N) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (eig c : Fin N → ℝ) (K : ℝ) (heig : ∀ i, |eig i| ≤ K) (t : ℝ) : + HasDerivAt (fun s => ∫ ω, rotatedPressure (fun i => s * eig i) (specialRotation (U ω)) c ∂P) + (∫ ω, thermalPressureDerivative eig c (specialRotation (U ω)) t ∂P) t := by + have hm (s : ℝ) : Measurable (fun ω => + rotatedPressure (fun i => s * eig i) (specialRotation (U ω)) c) := + (measurable_rotatedPressure _ c).comp hU + have hi : Integrable (fun ω => + rotatedPressure (fun i => t * eig i) (specialRotation (U ω)) c) P := by + have hb (ω : Ω) : |rotatedPressure (fun i => t * eig i) (specialRotation (U ω)) c| ≤ + |t| * K / 2 + |noninteractingPressure c| := by + have he : ∀ i, |t * eig i| ≤ |t| * K := fun i => by + rw [abs_mul]; exact mul_le_mul_of_nonneg_left (heig i) (abs_nonneg _) + have h := abs_pressure_sub_noninteracting_le hN _ c (specialRotation (U ω)) (|t| * K) he + have hs := abs_add_le (rotatedPressure (fun i => t * eig i) (specialRotation (U ω)) c - + noninteractingPressure c) (noninteractingPressure c) + rw [sub_add_cancel] at hs + exact hs.trans (add_le_add h le_rfl) + exact (integrable_const _).mono' (hm t).aestronglyMeasurable + (ae_of_all _ fun ω => by simpa only [Real.norm_eq_abs] using hb ω) + obtain ⟨_, hd⟩ := hasDerivAt_integral_of_dominated_loc_of_deriv_le + (Ioo_mem_nhds (by linarith : t - 1 < t) (by linarith : t < t + 1)) + (Filter.Eventually.of_forall fun s => (hm s).aestronglyMeasurable) hi + ((measurable_thermalPressureDerivative eig c t).comp hU).aestronglyMeasurable + (ae_of_all _ fun ω s _ => by + simpa only [Real.norm_eq_abs] using + abs_thermalPressureDerivative_le hN eig c (specialRotation (U ω)) K heig s) + (integrable_const (K / 2)) + (ae_of_all _ fun ω s _ => hasDerivAt_rotatedPressure_temperature eig c (specialRotation (U ω)) s) + exact hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/UniformHaarMeanTail.lean b/lean/OAI/Probability/InvariantIsing/Pressure/UniformHaarMeanTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..249299ce06bea4abb9b8a913f9baee90dc2520c7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/UniformHaarMeanTail.lean @@ -0,0 +1,65 @@ +import OAI.Probability.InvariantIsing.Haar.MedianMean + +namespace OAI + +/-! Uniform centered Haar tails for bounded Lipschitz observables. The threshold +is independent of the particular observable and of its additive normalization. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem uniform_bounded_haar_mean_tail (hpub : HaarConcentrationInput) : + ∃ C a : ℝ, 0 < C ∧ 0 < a ∧ + ∀ K ε : ℝ, 0 < K → 0 < ε → ∃ N₀ : ℕ, + ∀ N : ℕ, N₀ ≤ N → 3 ≤ N → + ∀ μ : Measure (SpecialOrthogonal N), IsProbabilityMeasure μ → μ.IsMulLeftInvariant → + ∀ f : SpecialOrthogonal N → ℝ, Measurable f → + (∀ U, |f U| ≤ K) → + (∀ U V, |f U-f V| ≤ K*frobeniusDistance U V) → + μ.real {U | ε ≤ |f U-(∫ V, f V ∂μ)|} ≤ + C*Real.exp (-a*(N : ℝ)*(ε/2)^2/K^2) := by + obtain ⟨C,a,hC,ha,hinput⟩ := hpub + refine ⟨C,a,hC,ha,?_⟩ + intro K ε hK hε + let d : ℝ := a*(ε/4)^2/K^2 + have hd : 0 < d := by dsimp [d]; positivity + have hlin : Tendsto (fun n : ℕ => -d*(n : ℝ)) atTop atBot := by + simpa only [Function.comp_def,neg_mul] using + tendsto_neg_atTop_atBot.comp (tendsto_natCast_atTop_atTop.const_mul_atTop hd) + have hlim : Tendsto (fun n : ℕ => ε/4+2*K*(C*Real.exp (-d*(n : ℝ)))) atTop (𝓝 (ε/4)) := by + simpa only [mul_zero,add_zero,Function.comp_def] using + (((Real.tendsto_exp_atBot.comp hlin).const_mul C).const_mul (2*K)).const_add (ε/4) + obtain ⟨N₀,hN₀⟩ := eventually_atTop.mp (hlim.eventually + (Iio_mem_nhds (by linarith : ε/4<ε/2))) + refine ⟨N₀,?_⟩ + intro N hN hN3 μ hμ hInv f hf hbound hLip + let : IsProbabilityMeasure μ := hμ + obtain ⟨m,hl,hu,ht⟩ := hinput N hN3 μ hμ hInv f hf K hK hLip + have hm : |m| ≤ K := abs_median_le_bound μ f m K hbound hl hu + have hdev U : |f U-m| ≤ 2*K := by + have hh := (abs_sub (f U) m).trans (add_le_add (hbound U) hm) + linarith + have hfi : Integrable f μ := (integrable_const K).mono' hf.aestronglyMeasurable + (ae_of_all _ fun U => by simpa only [Real.norm_eq_abs] using hbound U) + have hmean := abs_integral_sub_le_deviation_tail μ f hf hfi m (2*K) (ε/4) + (by positivity) hdev + have hmean' := hmean.trans (add_le_add le_rfl + (mul_le_mul_of_nonneg_left (ht (ε/4) (by positivity)) (by positivity : 0 ≤ 2*K))) + have heq : -a*(N : ℝ)*(ε/4)^2/K^2= -d*(N : ℝ) := by dsimp [d]; ring + rw [heq] at hmean' + have hclose : |(∫ V, f V ∂μ)-m| < ε/2 := hmean'.trans_lt (hN₀ N hN) + have hs : {U | ε ≤ |f U-(∫ V, f V ∂μ)|} ⊆ {U | ε/2 ≤ |f U-m|} := by + intro U hU + have hh := abs_sub_le (f U) m (∫ V, f V ∂μ) + rw [abs_sub_comm m (∫ V, f V ∂μ)] at hh + change ε/2 ≤ |f U-m| + change ε ≤ |f U-(∫ V, f V ∂μ)| at hU + linarith + exact (measureReal_mono hs).trans (ht (ε/2) (by positivity)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/UniformPhysicalTail.lean b/lean/OAI/Probability/InvariantIsing/Pressure/UniformPhysicalTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cd0cd9558d3b55540dc173b4049a093acf688d2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/UniformPhysicalTail.lean @@ -0,0 +1,66 @@ +import OAI.Probability.InvariantIsing.Pressure.UniformHaarMeanTail +import OAI.Probability.InvariantIsing.Cavity.CavityOrientedFamily +import OAI.Probability.InvariantIsing.Spectral.SpectralCountComparison + +namespace OAI + +/-! A dimension-uniform centered tail for the physical Haar pressure, independent +of the external field. This can be conditioned on random spectral and field data. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology +namespace InvariantIsing + +theorem uniform_physical_pressure_mean_tail (hpub : HaarConcentrationInput) : + ∃ C a : ℝ, 0 < C ∧ 0 < a ∧ + ∀ K ε : ℝ, 0 < K → 0 < ε → ∃ N₀ : ℕ, + ∀ N : ℕ, N₀ ≤ N → 3 ≤ N → + ∀ μ : Measure (Orthogonal N), IsProbabilityMeasure μ → μ.IsMulRightInvariant → + ∀ eig c : Fin N → ℝ, (∀ i, |eig i| ≤ K) → + μ.real {U | ε ≤ |rotatedPressure eig (matrixRotation U⁻¹) c- + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂μ|} ≤ + C*Real.exp (-a*(N : ℝ)*(ε/2)^2/K^2) := by + obtain ⟨C,a,hC,ha,ht⟩ := uniform_bounded_haar_mean_tail hpub + refine ⟨C,a,hC,ha,?_⟩ + intro K ε hK hε + obtain ⟨N₀,hN₀⟩ := ht K ε hK hε + refine ⟨N₀,?_⟩ + intro N hN hN3 μ hμ hHaar eig c heig + let : IsProbabilityMeasure μ := hμ + let : μ.IsMulRightInvariant := hHaar + have hpos : 0 < N := by omega + let η := cavityOrientedBaseLaw hpos μ + let f := fun U : SpecialOrthogonal N => rotatedPressure eig (specialRotation U) c-noninteractingPressure c + have hf : Measurable f := (measurable_rotatedPressure eig c).sub_const _ + have hfb U : |f U| ≤ K := + (abs_pressure_sub_noninteracting_le hpos eig c (specialRotation U) K heig).trans (by linarith) + have hlip U V : |f U-f V| ≤ K*frobeniusDistance U V := by + dsimp only [f] + rw [sub_sub_sub_cancel_right] + exact abs_rotatedPressure_sub_rotation_le hpos eig U V c K hK.le heig + have hh := hN₀ N hN hN3 η inferInstance (cavityOrientedBaseLaw_leftInvariant hpos μ) + f hf hfb hlip + have hmean : (∫ U, f U ∂η)= + (∫ V, rotatedPressure eig (matrixRotation V⁻¹) c ∂μ)-noninteractingPressure c := by + rw [integral_sub (integrable_countPressure hpos η eig c K heig) (integrable_const _)] + simp only [integral_const,probReal_univ,one_smul] + rw [cavity_oriented_pressure] + have hset : MeasurableSet {U | ε ≤ |f U-(∫ V, f V ∂η)|} := + measurableSet_le measurable_const (hf.sub_const _).abs + change (cavityOrientedBaseLaw hpos μ).real _ ≤ _ at hh + have hT : Measurable (fun V : Orthogonal N => cavityOrientationLift hpos V⁻¹) := + (measurable_cavityOrientationLift hpos).comp measurable_inv + rw [measureReal_def,cavityOrientedBaseLaw,Measure.map_apply hT hset] at hh + convert hh using 1 + congr 1 + ext U + change (ε ≤ |_ - _|) ↔ (ε ≤ |_ - _|) + rw [hmean] + simp only [f,rotatedPressure,cavityOrientationLift_energy] + ring_nf + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Pressure/VarianceLimit.lean b/lean/OAI/Probability/InvariantIsing/Pressure/VarianceLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ff699aec720bda11f336ff7500ec8fe83464082 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Pressure/VarianceLimit.lean @@ -0,0 +1,54 @@ +import OAI.Probability.IsingPerceptron.PartitionPowLe + +namespace OAI + +/-! Passing the Gaussian variance bound from finite leaf cutoffs to their limit. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory Filter +open scoped Topology ENNReal + +namespace InvariantIsing + +/-- Fatou's lemma for centered squares. This permits finite-leaf Gaussian +variance estimates to pass to the countable cascade prior. -/ +theorem variance_le_of_ae_tendsto_of_mean_tendsto {Ω : Type*} [MeasurableSpace Ω] + {μ : Measure Ω} [IsProbabilityMeasure μ] {f : ℕ → Ω → ℝ} {g : Ω → ℝ} {C : ℝ} + (hf : ∀ n, MemLp (f n) 2 μ) (hg : MemLp g 2 μ) + (ht : ∀ᵐ ω ∂μ, Tendsto (fun n => f n ω) atTop (𝓝 (g ω))) + (hm : Tendsto (fun n => ∫ ω, f n ω ∂μ) atTop (𝓝 (∫ ω, g ω ∂μ))) + (hv : ∀ n, variance (f n) μ ≤ C) : variance g μ ≤ C := by + let F := fun n ω => (f n ω - ∫ z, f n z ∂μ) ^ 2 + let G := fun ω => (g ω - ∫ z, g z ∂μ) ^ 2 + have hFi (n : ℕ) : Integrable (F n) μ := + ((hf n).sub (memLp_const _)).integrable_sq + have hGi : Integrable G μ := (hg.sub (memLp_const _)).integrable_sq + have hlim : ∀ᵐ ω ∂μ, Tendsto (fun n => ENNReal.ofReal (F n ω)) atTop (𝓝 (ENNReal.ofReal (G ω))) := by + filter_upwards [ht] with ω hω + exact ENNReal.continuous_ofReal.continuousAt.tendsto.comp ((hω.sub hm).pow 2) + have hfatou : (∫⁻ ω, ENNReal.ofReal (G ω) ∂μ) ≤ + liminf (fun n => ∫⁻ ω, ENNReal.ofReal (F n ω) ∂μ) atTop := by + calc + _ = ∫⁻ ω, liminf (fun n => ENNReal.ofReal (F n ω)) atTop ∂μ := + lintegral_congr_ae (hlim.mono fun _ hω => hω.liminf_eq.symm) + _ ≤ _ := lintegral_liminf_le' (fun n => (hFi n).aemeasurable.ennreal_ofReal) + have hpoint (n : ℕ) : (∫⁻ ω, ENNReal.ofReal (F n ω) ∂μ) ≤ ENNReal.ofReal C := by + rw [← ofReal_integral_eq_lintegral_ofReal (hFi n) (ae_of_all _ fun _ => sq_nonneg _)] + change ENNReal.ofReal (∫ ω, (f n ω - ∫ z, f n z ∂μ) ^ 2 ∂μ) ≤ _ + rw [← variance_eq_integral (hf n).aemeasurable] + exact ENNReal.ofReal_le_ofReal (hv n) + have hb : liminf (fun n => ∫⁻ ω, ENNReal.ofReal (F n ω) ∂μ) atTop ≤ ENNReal.ofReal C := by + refine liminf_le_of_le (by isBoundedDefault) (fun b hb => ?_) + obtain ⟨n, hn⟩ := hb.exists + exact hn.trans (hpoint n) + rw [← ofReal_integral_eq_lintegral_ofReal hGi (ae_of_all _ fun _ => sq_nonneg _)] at hfatou + change ENNReal.ofReal (∫ ω, (g ω - ∫ z, g z ∂μ) ^ 2 ∂μ) ≤ _ at hfatou + rw [← variance_eq_integral hg.aemeasurable] at hfatou + exact (ENNReal.ofReal_le_ofReal_iff ((variance_nonneg (f 0) μ).trans (hv 0))).mp (hfatou.trans hb) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ClippedEmpiricalTransform.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ClippedEmpiricalTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..93d83e9f1f9172cf1789730e8e585f856e5c3e71 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ClippedEmpiricalTransform.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralClipping +import OAI.Probability.InvariantIsing.Spectral.ResolventLipschitz +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! Uniform resolvent error for the actual finite empirical spectral clipping. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +theorem empirical_transform_clip_error {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) + {R η t : ℝ} (ht : 0 < t) + (hclip : ∀ i, |spectralClip 0 R (eig i)-eig i| ≤ η) : + |(∫ x, positiveResolventTest t (spectralClip 0 R x) + ∂(empiricalSpectralLaw hN eig : Measure ℝ))- + ∫ x, positiveResolventTest t x ∂(empiricalSpectralLaw hN eig : Measure ℝ)| ≤ η/t^2 := by + let μ := (empiricalSpectralLaw hN eig : Measure ℝ) + have hc : Integrable (fun x => positiveResolventTest t (spectralClip 0 R x)) μ := by + apply Integrable.of_bound + ((continuous_positiveResolventTest ht).comp (continuous_spectralClip 0 R)).aestronglyMeasurable (1/t) + exact ae_of_all _ fun x => by + change ‖positiveResolventTest t (spectralClip 0 R x)‖ ≤ 1/t + rw [Real.norm_eq_abs,abs_of_nonneg (positiveResolventTest_bound ht _).1] + exact (positiveResolventTest_bound ht _).2 + have hi : Integrable (positiveResolventTest t) μ := by + simpa only [pow_one] using positiveResolventPower_integrable ht 1 μ + rw [← integral_sub hc hi,← Real.norm_eq_abs] + have ha : ∀ᵐ x ∂μ, |spectralClip 0 R x-x| ≤ η := ae_finiteSpectralMeasure + (fun _ => (1 : ℝ)/N) eig hclip + have hb : ∀ᵐ x ∂μ, ‖positiveResolventTest t (spectralClip 0 R x)-positiveResolventTest t x‖ ≤ η/t^2 := by + filter_upwards [ha] with x hx + rw [Real.norm_eq_abs] + exact (positiveResolventTest_sub_le ht _ _).trans + (div_le_div_of_nonneg_right hx (sq_nonneg t)) + simpa only [probReal_univ,mul_one] using norm_integral_le_of_norm_le_const hb + +theorem empirical_transform_clip_excess {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) + {R t : ℝ} (hR : 0 ≤ R) (ht : 0 < t) : + |(∫ x, positiveResolventTest t (spectralClip 0 R x) + ∂(empiricalSpectralLaw hN eig : Measure ℝ))- + ∫ x, positiveResolventTest t x ∂(empiricalSpectralLaw hN eig : Measure ℝ)| ≤ + spectralExcess eig 0 R/t^2 := by + apply empirical_transform_clip_error hN eig ht + intro i + exact spectralClip_close hR (spectralExcess_nonneg _ _ _) (spectralExcess_bounds eig 0 R i) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactFiniteTestControl.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactFiniteTestControl.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2980db14cbe72cf2ccc2e7b06894b56cd7fb157 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactFiniteTestControl.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Spectral.ResolventMeasureUniqueness +import Mathlib.MeasureTheory.Measure.Prokhorov + +namespace OAI + +/-! Finitely many separating tests control a continuous image of a compact space. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology +namespace InvariantIsing + +theorem compact_finite_test_control {X ι Y : Type*} [TopologicalSpace X] [CompactSpace X] + [PseudoMetricSpace Y] (F : ι → X → ℝ) (hF : ∀ i, Continuous (F i)) + (hsep : ∀ x y, (∀ i, F i x = F i y) → x = y) + (G : X → Y) (hG : Continuous G) (x₀ : X) {ε : ℝ} (hε : 0 < ε) : + ∃ s : Finset ι, ∃ δ : ι → ℝ, (∀ i, 0 < δ i) ∧ + ∀ x, (∀ i ∈ s, dist (F i x) (F i x₀) < δ i) → dist (G x) (G x₀) < ε := by + classical + let E : X → (ι → ℝ) := fun x i => F i x + have hE : Continuous E := continuous_pi hF + have he : Function.Injective E := fun x y h => hsep x y (congrFun h) + have hi := (hE.isClosedEmbedding he).isEmbedding.isInducing + have hu : G ⁻¹' Metric.ball (G x₀) ε ∈ 𝓝 x₀ := + hG.continuousAt.preimage_mem_nhds (Metric.ball_mem_nhds _ hε) + rw [hi.nhds_eq_comap] at hu + obtain ⟨V,hV,hVU⟩ := Filter.mem_comap.mp hu + rw [nhds_pi] at hV + obtain ⟨s,W,hW,hWV⟩ := Filter.mem_pi'.mp hV + choose δ hδ hd using fun i => Metric.mem_nhds_iff.mp (hW i) + refine ⟨s,δ,hδ,fun x hx => ?_⟩ + apply hVU + apply hWV + intro i hi' + exact hd i (hx i hi') + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactPartitionContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactPartitionContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7593ee5f50c5dee39ebfca886d2da344987f3ab --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactPartitionContinuity.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralPartition +import OAI.Probability.InvariantIsing.Spectral.MeasureVariationalContinuity + +namespace OAI + +/-! The finite positive-mass partition values converge to the compact spectral value. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +lemma compact_partition_laws_tendsto (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (δ : ℕ → ℝ) (D : (k : ℕ) → CompactSpectralPartition ν a b (δ k)) + (hδ : Tendsto δ atTop (𝓝 0)) : + Tendsto (fun k => (D k).law) atTop (𝓝 ν) := by + have hh := spectral_quantization_weak ν + (fun k => spectralBallQuantizer (D k).center (D k).radius a) + (fun k => measurable_spectralBallQuantizer _ _ _) δ hδ (fun k => (D k).quantizer_close) + apply hh.congr + intro k + apply Subtype.ext + exact (D k).law_eq_map.symm + +lemma compact_partition_edges_tendsto (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (δ : ℕ → ℝ) (D : (k : ℕ) → CompactSpectralPartition ν a b (δ k)) + (hab : a ≤ b) (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hδ : Tendsto δ atTop (𝓝 0)) : + Tendsto (fun k => (D k).edge) atTop (𝓝 b) := by + have hlo k : b-δ k ≤ (D k).edge := by linarith [(D k).endpoint_bounds ha hb] + have hhi k : (D k).edge ≤ b := ((D k).value_mem hab (D k).upper).2 + exact tendsto_of_tendsto_of_tendsto_of_le_of_le + (by simpa only [sub_zero] using tendsto_const_nhds.sub hδ) + tendsto_const_nhds hlo hhi + +lemma compact_partition_variational_tendsto (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (δ : ℕ → ℝ) (D : (k : ℕ) → CompactSpectralPartition ν a b (δ k)) + (hab : a ≤ b) (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) (hδ : Tendsto δ atTop (𝓝 0)) : + Tendsto (fun k => (variationalFunctional (measureR ((D k).law : Measure ℝ) (D k).edge)).toReal) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + let K := |a|+|b|+1 + have hK : 0 < K := by dsimp [K]; positivity + have haK : -K ≤ a := by dsimp [K]; linarith [neg_abs_le a,abs_nonneg b] + have hbK : b ≤ K := by dsimp [K]; linarith [le_abs_self b,abs_nonneg a] + exact measureVariational_tendsto_weak (fun k => (D k).law) ν + (fun k => (D k).edge) b (compact_partition_laws_tendsto ν a b δ D hδ) + (compact_partition_edges_tendsto ν a b δ D hab ha hb hδ) hK hbK + (fun k => (((D k).value_mem hab (D k).upper).2).trans hbK) + (fun k => ((D k).law_support hab).mono (fun _ hx => ⟨haK.trans hx.1,hx.2⟩)) + (by + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + exact ⟨haK.trans (hbound hx).1,(hbound hx).2⟩) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactPartitionPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactPartitionPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e9f887865b33d377bc7bfbf4678b40608d8f1f7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactPartitionPressure.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralPartition +import OAI.Probability.InvariantIsing.Spectral.SpectralPartitionPressure +import OAI.Probability.InvariantIsing.Cavity.CavitySpectralSqueeze + +namespace OAI + +/-! The finite positive spectral partitions bracket physical mean pressure. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Classical Function + +namespace InvariantIsing.CompactSpectralPartition + +variable {ν : ProbabilityMeasure ℝ} {a b δ : ℝ} (D : CompactSpectralPartition ν a b δ) + +def lowerValue (x : ℝ) : ℝ := + D.value (positiveSpectralLabel D.weight D.lower + (spectralPartitionIndex D.cells (spectralBallCell_cover _) x)) + +def upperValue (x : ℝ) : ℝ := + D.value (positiveSpectralLabel D.weight D.upper + (spectralPartitionIndex D.cells (spectralBallCell_cover _) x)) + +lemma rounding_bounds (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (x : ℝ) (hx : x∈Icc a b) : D.lowerValue x-δ ≤ x ∧ x ≤ D.upperValue x+δ := by + have he := D.endpoint_bounds ha hb + exact positive_spectral_rounding_bounds (ν : Measure ℝ) D.cells (spectralBallCell_cover _) + D.value a b δ D.lower D.upper he.1 he.2 + (positive_spectral_ball_cell_close (ν : Measure ℝ) D.center D.radius a δ + D.radius_le D.residual_zero) x hx + +lemma rounded_mem (hab : a ≤ b) (x : ℝ) : + D.lowerValue x∈Icc a b ∧ D.upperValue x∈Icc a b := + ⟨D.value_mem hab _,D.value_mem hab _⟩ + +lemma pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ V, rotatedPressure (fun i => D.lowerValue (eig N i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) atTop + (𝓝 (variationalFunctional (measureR (D.law : Measure ℝ) D.edge)).toReal) ∧ + Tendsto (fun N => ∫ V, rotatedPressure (fun i => D.upperValue (eig N i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) atTop + (𝓝 (variationalFunctional (measureR (D.law : Measure ℝ) D.edge)).toReal) := by + have hh (fallback : D.Positive) := spectral_partition_pressure_tendsto hhaar hgauss hpub μ eig ν hweak + D.cells (spectralBallCell_cover _) (spectralBallCell_disjoint _) + (spectralBallCell_measurable _ (fun _ => measurableSet_ball)) + (spectralBallCell_null_boundary (ν : Measure ℝ) _ D.null_boundary) + D.value fallback D.upper D.le_upper + exact ⟨hh D.lower,hh D.upper⟩ + +lemma mean_pressure_bounds {N : ℕ} (hN : 0 < N) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] (eig : Fin N → ℝ) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hab : a ≤ b) (heig : ∀ i, eig i∈Icc a b) : + (∫ V, rotatedPressure (fun i => D.lowerValue (eig i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ)-δ/2 ≤ + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) (fun _ => 0) ∂μ ∧ + (∫ V, rotatedPressure eig (matrixRotation V⁻¹) (fun _ => 0) ∂μ) ≤ + (∫ V, rotatedPressure (fun i => D.upperValue (eig i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ)+δ/2 := by + let K := max |a| |b| + have hbound (x : ℝ) (hx : x∈Icc a b) : |x| ≤ K := by + apply abs_le.mpr + constructor + · have hh := neg_abs_le a + have hk : |a| ≤ K := le_max_left _ _ + linarith [hx.1] + · exact hx.2.trans ((le_abs_self b).trans (le_max_right _ _)) + exact cavity_meanPressure_squeeze hN μ eig (fun i => D.lowerValue (eig i)) + (fun i => D.upperValue (eig i)) (fun _ => 0) δ K + (fun i => hbound _ (heig i)) + (fun i => hbound _ (D.rounded_mem hab (eig i)).1) + (fun i => hbound _ (D.rounded_mem hab (eig i)).2) + (fun i => (D.rounding_bounds ha hb _ (heig i)).1) + (fun i => (D.rounding_bounds ha hb _ (heig i)).2) + +end InvariantIsing.CompactSpectralPartition + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactResolventTests.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactResolventTests.lean new file mode 100644 index 0000000000000000000000000000000000000000..28fcd91fcf5efd05698db64732b906d62fb7d568 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactResolventTests.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactTestsInMeasure + +namespace OAI + +/-! Positive resolvents as a separating family for compact nonnegative spectral laws. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped Topology BoundedContinuousFunction +namespace InvariantIsing + +def compactResolventTest (R : ℝ) (t : {t : ℝ // 0 < t}) : Icc (0 : ℝ) R →ᵇ ℝ := + BoundedContinuousFunction.mkOfCompact + ⟨fun x => positiveResolventTest t x, + (continuous_positiveResolventTest t.property).comp continuous_subtype_val⟩ + +lemma compactResolventTests_separate (R : ℝ) (μ ν : ProbabilityMeasure (Icc (0 : ℝ) R)) + (h : ∀ t : {t : ℝ // 0 < t}, + (∫ x, compactResolventTest R t x ∂(μ : Measure _)) = + ∫ x, compactResolventTest R t x ∂(ν : Measure _)) : μ = ν := by + have hnonneg (η : ProbabilityMeasure (Icc (0 : ℝ) R)) : + ∀ᵐ x ∂(η.map (fun x => (x : ℝ)) : Measure ℝ), 0 ≤ x := by + rw [ProbabilityMeasure.toMeasure_map] + apply (ae_map_iff measurable_subtype_coe.aemeasurable measurableSet_Ici).mpr + exact ae_of_all _ fun x => x.property.1 + have he := positiveResolvent_unique (μ.map (fun x => (x : ℝ)) : Measure ℝ) + (ν.map (fun x => (x : ℝ)) : Measure ℝ) (hnonneg μ) (hnonneg ν) (fun t ht => ?_) + · apply ProbabilityMeasure.toMeasure_injective + apply (MeasurableEmbedding.subtype_coe measurableSet_Icc).map_injective + exact he + · simp only [ProbabilityMeasure.toMeasure_map] + rw [integral_map measurable_subtype_coe.aemeasurable + (continuous_positiveResolventTest ht).aestronglyMeasurable, + integral_map measurable_subtype_coe.aemeasurable + (continuous_positiveResolventTest ht).aestronglyMeasurable] + exact h ⟨t,ht⟩ + +theorem compact_resolvent_tendstoInMeasure (R : ℝ) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) + (Z : ℕ → Ω → ProbabilityMeasure (Icc (0 : ℝ) R)) (ν : ProbabilityMeasure (Icc (0 : ℝ) R)) + (h : ∀ t : {t : ℝ // 0 < t}, TendstoInMeasure P + (fun n ω => ∫ x, compactResolventTest R t x ∂(Z n ω : Measure _)) Filter.atTop + (fun _ => ∫ x, compactResolventTest R t x ∂(ν : Measure _))) : + TendstoInMeasure P + (fun n ω => LevyProkhorov.ofMeasure ((Z n ω).map (fun x => (x : ℝ)))) Filter.atTop + (fun _ => LevyProkhorov.ofMeasure (ν.map (fun x => (x : ℝ)))) := by + let F : {t : ℝ // 0 < t} → ProbabilityMeasure (Icc (0 : ℝ) R) → ℝ := + fun t η => ∫ x, compactResolventTest R t x ∂(η : Measure _) + let G : ProbabilityMeasure (Icc (0 : ℝ) R) → LevyProkhorov (ProbabilityMeasure ℝ) := + fun η => LevyProkhorov.ofMeasure (η.map (fun x : Icc (0 : ℝ) R => (x : ℝ))) + have hF : ∀ t, Continuous (F t) := fun t => + ProbabilityMeasure.continuous_integral_boundedContinuousFunction (compactResolventTest R t) + have hG : Continuous G := + LevyProkhorov.continuous_ofMeasure_probabilityMeasure.comp + (ProbabilityMeasure.continuous_map (f := fun x : Icc (0 : ℝ) R => (x : ℝ)) continuous_subtype_val) + exact compact_tests_tendstoInMeasure P F hF (compactResolventTests_separate R) G hG ν Z h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralClipping.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralClipping.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7a04654f706280f784b895e61fee334a60f4d4a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralClipping.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactResolventTests +import OAI.Probability.InvariantIsing.Spectral.SpectralClipping + +namespace OAI + +/-! Clipped spectral probability laws on their compact interval. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +def compactSpectralClip (R : ℝ) (hR : 0 ≤ R) (x : ℝ) : Icc (0 : ℝ) R := + ⟨spectralClip 0 R x,spectralClip_mem hR x⟩ + +lemma continuous_compactSpectralClip (R : ℝ) (hR : 0 ≤ R) : Continuous (compactSpectralClip R hR) := + (continuous_spectralClip 0 R).subtype_mk _ + +def compactClippedLaw (R : ℝ) (hR : 0 ≤ R) (μ : ProbabilityMeasure ℝ) : + ProbabilityMeasure (Icc (0 : ℝ) R) := μ.map (compactSpectralClip R hR) + +lemma compactClippedLaw_real (R : ℝ) (hR : 0 ≤ R) (μ : ProbabilityMeasure ℝ) : + (compactClippedLaw R hR μ).map (fun x => (x : ℝ)) = μ.map (spectralClip 0 R) := by + apply ProbabilityMeasure.toMeasure_injective + simp only [compactClippedLaw,ProbabilityMeasure.toMeasure_map] + rw [Measure.map_map measurable_subtype_coe (continuous_compactSpectralClip R hR).measurable] + rfl + +lemma compactClippedLaw_integral (R : ℝ) (hR : 0 ≤ R) (μ : ProbabilityMeasure ℝ) + (t : {t : ℝ // 0 < t}) : + (∫ x, compactResolventTest R t x ∂(compactClippedLaw R hR μ : Measure _)) = + ∫ x, positiveResolventTest t (spectralClip 0 R x) ∂(μ : Measure ℝ) := by + rw [compactClippedLaw,ProbabilityMeasure.toMeasure_map, + integral_map (continuous_compactSpectralClip R hR).measurable.aemeasurable + (compactResolventTest R t).continuous.aestronglyMeasurable] + rfl + +lemma compactClippedLaw_real_eq (R : ℝ) (hR : 0 ≤ R) (μ : ProbabilityMeasure ℝ) + (hμ : ∀ᵐ x ∂(μ : Measure ℝ), x ∈ Icc (0 : ℝ) R) : + (compactClippedLaw R hR μ).map (fun x => (x : ℝ)) = μ := by + rw [compactClippedLaw_real] + apply ProbabilityMeasure.toMeasure_injective + rw [ProbabilityMeasure.toMeasure_map] + calc + (μ : Measure ℝ).map (spectralClip 0 R) = (μ : Measure ℝ).map id := + Measure.map_congr (hμ.mono fun _ hx => spectralClip_eq hx) + _ = μ := Measure.map_id + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralPartition.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..031343ad7c793f9a38159c7810ffe096f7311b35 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralPartition.lean @@ -0,0 +1,118 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveSpectralRounding +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralQuantizers + +namespace OAI + +/-! Finite positive-mass spectral partitions for the compact-support approximation. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Set Metric +open scoped Topology Classical Function BigOperators + +namespace InvariantIsing + +def spectralBallWeight {n : ℕ} (ν : ProbabilityMeasure ℝ) (c r : Fin n → ℝ) + (i : Option (Fin n)) : ℝ := + (ν : Measure ℝ).real (spectralBallCell (fun i => ball (c i) (r i)) i) + +def spectralBallValue {n : ℕ} (c : Fin n → ℝ) (a : ℝ) (i : Option (Fin n)) : ℝ := + i.elim a c + +structure CompactSpectralPartition (ν : ProbabilityMeasure ℝ) (a b δ : ℝ) where + size : ℕ + center : Fin size → ℝ + radius : Fin size → ℝ + center_mem : ∀ i, center i∈Icc a b + radius_le : ∀ i, radius i ≤ δ + null_boundary : ∀ i, (ν : Measure ℝ) (frontier (ball (center i) (radius i)))=0 + covers : (ν : Measure ℝ).support ⊆ ⋃ i, ball (center i) (radius i) + lower : {i // 0 < spectralBallWeight ν center radius i} + upper : {i // 0 < spectralBallWeight ν center radius i} + lower_le : ∀ i : {i // 0 < spectralBallWeight ν center radius i}, + spectralBallValue center a lower ≤ spectralBallValue center a i + le_upper : ∀ i : {i // 0 < spectralBallWeight ν center radius i}, + spectralBallValue center a i ≤ spectralBallValue center a upper + +theorem exists_compact_spectral_partition (ν : ProbabilityMeasure ℝ) (a b δ : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (hδ : 0 < δ) : + Nonempty (CompactSpectralPartition ν a b δ) := by + obtain ⟨n,c,r,hc,hr,hn,hb⟩ := spectral_null_boundary_cover (ν : Measure ℝ) + (ν : Measure ℝ).support hcompact δ hδ + let S := spectralBallCell (fun i => ball (c i) (r i)) + let w := spectralBallWeight ν c r + have hsum : ∑ i, w i=1 := spectralPartitionWeights_sum (ν : Measure ℝ) S + (spectralBallCell_cover _) (spectralBallCell_disjoint _) + (spectralBallCell_measurable _ (fun _ => measurableSet_ball)) + obtain ⟨i,hi⟩ := exists_pos_spectral_weight (fun _ => measureReal_nonneg) hsum + let P := {i // 0 < w i} + have he : (Finset.univ : Finset P).Nonempty := ⟨⟨i,hi⟩,Finset.mem_univ _⟩ + obtain ⟨lo,_,hlo⟩ := Finset.exists_min_image Finset.univ + (fun i : P => spectralBallValue c a i) he + obtain ⟨up,_,hup⟩ := Finset.exists_max_image Finset.univ + (fun i : P => spectralBallValue c a i) he + exact ⟨⟨n,c,r,(fun i => hbound (hc i)),(fun i => (hr i).2.le),hn,hb,lo,up, + (fun i => hlo i (Finset.mem_univ i)),(fun i => hup i (Finset.mem_univ i))⟩⟩ + +namespace CompactSpectralPartition + +variable {ν : ProbabilityMeasure ℝ} {a b δ : ℝ} (D : CompactSpectralPartition ν a b δ) + +def cells : Option (Fin D.size) → Set ℝ := + spectralBallCell (fun i => ball (D.center i) (D.radius i)) + +def weight : Option (Fin D.size) → ℝ := spectralBallWeight ν D.center D.radius + +def value : Option (Fin D.size) → ℝ := spectralBallValue D.center a + +abbrev Positive := {i // 0 < D.weight i} + +lemma weight_sum : ∑ i : D.Positive, D.weight i=1 := + positiveSpectralWeights_sum D.weight (fun _ => measureReal_nonneg) + (spectralPartitionWeights_sum (ν : Measure ℝ) D.cells (spectralBallCell_cover _) + (spectralBallCell_disjoint _) (spectralBallCell_measurable _ (fun _ => measurableSet_ball))) + +def law : ProbabilityMeasure ℝ := + ⟨finiteSpectralMeasure (fun i : D.Positive => D.weight i) (fun i => D.value i), + finiteSpectralMeasure_probability _ _ (fun _ => measureReal_nonneg) D.weight_sum⟩ + +def edge : ℝ := D.value D.upper + +lemma value_mem (hab : a ≤ b) (i : Option (Fin D.size)) : D.value i∈Icc a b := by + cases i with + | none => exact ⟨le_rfl,hab⟩ + | some i => exact D.center_mem i + +lemma residual_zero : (ν : Measure ℝ) (D.cells none)=0 := + spectralBallCell_residual_null (ν : Measure ℝ) _ (ν : Measure ℝ).support + (ν : Measure ℝ).measure_compl_support D.covers + +lemma law_eq_map : (D.law : Measure ℝ)= + (ν : Measure ℝ).map (spectralBallQuantizer D.center D.radius a) := by + change finiteSpectralMeasure (fun i : D.Positive => D.weight i) (fun i => D.value i)=_ + rw [finiteSpectralMeasure_positive D.weight D.value (fun _ => measureReal_nonneg)] + exact (spectralPartition_pushforward (ν : Measure ℝ) D.cells (spectralBallCell_cover _) + (spectralBallCell_disjoint _) (spectralBallCell_measurable _ (fun _ => measurableSet_ball)) + D.value).symm + +lemma quantizer_close : ∀ᵐ x ∂(ν : Measure ℝ), + dist (spectralBallQuantizer D.center D.radius a x) x ≤ δ := by + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + exact spectralBallQuantizer_close D.center D.radius a δ x D.radius_le (D.covers hx) + +lemma endpoint_bounds (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) : + D.value D.lower-δ ≤ a ∧ b ≤ D.edge+δ := + positive_spectral_edge_bounds (ν : Measure ℝ) D.cells (spectralBallCell_cover _) + D.value δ a b ha hb D.lower D.upper D.lower_le D.le_upper D.quantizer_close + +lemma law_support (hab : a ≤ b) : ∀ᵐ x ∂(D.law : Measure ℝ), x∈Icc a D.edge := by + exact ae_finiteSpectralMeasure _ _ (fun i : D.Positive => + ⟨(D.value_mem hab i).1,D.le_upper i⟩) + +end CompactSpectralPartition +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8ca8e86106ac1982ca63df514cd8fc51f6215e8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralPressure.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactPartitionPressure +import OAI.Probability.InvariantIsing.Spectral.CompactPartitionContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralApproximationSqueeze + +namespace OAI + +/-! The zero-field pressure limit for arbitrary compact spectral laws, +when the finite spectra lie between the limiting support edges. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology + +namespace InvariantIsing + +theorem compact_spectral_pressure_tendsto_of_mem + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (heig : ∀ N i, eig N i∈Icc a b) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun N => ∫ V, rotatedPressure (eig N) (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + let δ := fun k : ℕ => (1 : ℝ)/(k+1) + let D (k : ℕ) : CompactSpectralPartition ν a b (δ k) := Classical.choice + (exists_compact_spectral_partition ν a b (δ k) hcompact hbound (by dsimp [δ]; positivity)) + have hab : a ≤ b := (hbound ha).2 + have hδ : Tendsto δ atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ) + have hL := compact_partition_variational_tendsto ν a b δ D hab ha hb hbound hδ + apply spectral_approximation_squeeze _ + (fun k N => ∫ V, rotatedPressure (fun i => (D k).lowerValue (eig N i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) + (fun k N => ∫ V, rotatedPressure (fun i => (D k).upperValue (eig N i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) + (fun k => (variationalFunctional (measureR ((D k).law : Measure ℝ) (D k).edge)).toReal) + δ _ hL hδ + (fun k => ((D k).pressure_tendsto hhaar hgauss hpub μ eig hweak).1) + (fun k => ((D k).pressure_tendsto hhaar hgauss hpub μ eig hweak).2) + intro k + filter_upwards [eventually_ge_atTop 1] with N hN + exact (D k).mean_pressure_bounds (by omega) (μ N) (eig N) ha hb hab (heig N) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralQuantizers.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralQuantizers.lean new file mode 100644 index 0000000000000000000000000000000000000000..baa1b172bb5e0f749aa8ad6e0bb21356b30b3d7a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactSpectralQuantizers.lean @@ -0,0 +1,45 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralBallQuantizer +import OAI.Probability.InvariantIsing.Spectral.SpectralQuantizationWeak + +namespace OAI + +/-! Concrete finite quantizations of a compactly supported spectral law. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set Metric +open scoped Topology + +namespace InvariantIsing + +theorem exists_compact_spectral_quantizers + (μ : ProbabilityMeasure ℝ) (K : Set ℝ) (hK : IsCompact K) + (hμ : ∀ᵐ x ∂(μ : Measure ℝ), x∈K) (a : ℝ) (ha : a∈K) : + ∃ n : ℕ → ℕ, ∃ c r : (k : ℕ) → Fin (n k) → ℝ, + (∀ k i, c k i∈K) ∧ + (∀ k i, 0 < r k i ∧ r k i < (1 : ℝ)/(k+1)) ∧ + (∀ k i, (μ : Measure ℝ) (frontier (ball (c k i) (r k i)))=0) ∧ + (∀ k, K ⊆ ⋃ i, ball (c k i) (r k i)) ∧ + (∀ k, ∀ᵐ x ∂(μ : Measure ℝ), + dist (spectralBallQuantizer (c k) (r k) a x) x ≤ (1 : ℝ)/(k+1)) ∧ + (∀ k x, spectralBallQuantizer (c k) (r k) a x∈K) ∧ + Tendsto (fun k => μ.map (spectralBallQuantizer (c k) (r k) a)) atTop (𝓝 μ) := by + have hex (k : ℕ) := spectral_null_boundary_cover (μ : Measure ℝ) K hK ((1 : ℝ)/(k+1)) (by positivity) + choose n c r hc hr hn hb using hex + have hclose (k : ℕ) : ∀ᵐ x ∂(μ : Measure ℝ), + dist (spectralBallQuantizer (c k) (r k) a x) x ≤ (1 : ℝ)/(k+1) := by + filter_upwards [hμ] with x hx + exact spectralBallQuantizer_close (c k) (r k) a _ x (fun i => (hr k i).2.le) (hb k hx) + refine ⟨n,c,r,hc,?_,hn,hb,hclose,?_,?_⟩ + · intro k i + exact ⟨lt_trans (by positivity : (0:ℝ) < ((1:ℝ)/(k+1))/2) (hr k i).1,(hr k i).2⟩ + · intro k x + exact spectralBallQuantizer_mem (c k) (r k) a K (hc k) ha x + · exact spectral_quantization_weak μ (fun k => spectralBallQuantizer (c k) (r k) a) + (fun k => measurable_spectralBallQuantizer _ _ _) + (fun k => (1:ℝ)/(k+1)) (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) hclose + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/CompactTestsInMeasure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/CompactTestsInMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1801a6fca8877813b26cdf62e0129e7abaa0dc3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/CompactTestsInMeasure.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactFiniteTestControl + +namespace OAI + +/-! Convergence in measure from separating continuous tests on a compact state space. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology +namespace InvariantIsing + +theorem compact_tests_tendstoInMeasure {X ι Y Ω : Type*} [TopologicalSpace X] [CompactSpace X] + [PseudoMetricSpace Y] [MeasurableSpace Ω] (P : Measure Ω) + (F : ι → X → ℝ) (hF : ∀ i, Continuous (F i)) + (hsep : ∀ x y, (∀ i, F i x = F i y) → x = y) + (G : X → Y) (hG : Continuous G) (x₀ : X) (Z : ℕ → Ω → X) + (hZ : ∀ i, TendstoInMeasure P (fun n ω => F i (Z n ω)) atTop (fun _ => F i x₀)) : + TendstoInMeasure P (fun n ω => G (Z n ω)) atTop (fun _ => G x₀) := by + classical + apply tendstoInMeasure_iff_dist.mpr + intro ε hε + obtain ⟨s,δ,hδ,hcontrol⟩ := compact_finite_test_control F hF hsep G hG x₀ hε + have hb (n : ℕ) : {ω | ε ≤ dist (G (Z n ω)) (G x₀)} ⊆ + ⋃ i ∈ s, {ω | δ i ≤ dist (F i (Z n ω)) (F i x₀)} := by + intro ω hω + have hh : ∃ i ∈ s, δ i ≤ dist (F i (Z n ω)) (F i x₀) := by + by_contra! hh + exact (not_lt_of_ge hω) (hcontrol (Z n ω) hh) + obtain ⟨i,hi,hii⟩ := hh + exact mem_iUnion.mpr ⟨i,mem_iUnion.mpr ⟨hi,hii⟩⟩ + have ht := tendsto_finsetSum s (fun i _ => (tendstoInMeasure_iff_dist.mp (hZ i)) (δ i) (hδ i)) + have ht' : Tendsto (fun n => ∑ i ∈ s, P {ω | δ i ≤ dist (F i (Z n ω)) (F i x₀)}) + atTop (𝓝 0) := by simpa only [Finset.sum_const_zero] using ht + exact tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds ht' + (fun _ => bot_le) (fun n => (measure_mono (hb n)).trans (measure_biUnion_finset_le _ _)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalClippingDistance.lean b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalClippingDistance.lean new file mode 100644 index 0000000000000000000000000000000000000000..67e5a57a653b24f9edfd4cf9daec5549564ab044 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalClippingDistance.lean @@ -0,0 +1,32 @@ +import OAI.Probability.InvariantIsing.Core.LevyMapDistance +import OAI.Probability.InvariantIsing.Spectral.CompactSpectralClipping +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! The finite spectral clipping moves the empirical law by at most its edge excess. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +namespace InvariantIsing + +theorem empirical_clipping_distance {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) + {R : ℝ} (hR : 0 ≤ R) : + dist (LevyProkhorov.ofMeasure (empiricalSpectralLaw hN eig)) + (LevyProkhorov.ofMeasure ((empiricalSpectralLaw hN eig).map (spectralClip 0 R))) ≤ + spectralExcess eig 0 R := by + let μ := empiricalSpectralLaw hN eig + have hh : ∀ᵐ x ∂(μ : Measure ℝ), dist (id x) (spectralClip 0 R x) ≤ spectralExcess eig 0 R := by + apply ae_finiteSpectralMeasure + intro i + rw [Real.dist_eq,abs_sub_comm] + exact spectralClip_close hR (spectralExcess_nonneg _ _ _) (spectralExcess_bounds eig 0 R i) + have h := levyProkhorov_map_dist_le_ae (μ : Measure ℝ) id (spectralClip 0 R) + measurable_id (continuous_spectralClip 0 R).measurable (spectralExcess_nonneg _ _ _) hh + rw [Measure.map_id] at h + exact h + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalFieldMoment.lean b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalFieldMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..9805064b5e5d2f1986a2e483f475192534641448 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalFieldMoment.lean @@ -0,0 +1,22 @@ +import OAI.Probability.InvariantIsing.Spectral.EmpiricalSpectralLaw + +namespace OAI + +/-! Every finite empirical field law has all real-valued moments. -/ +noncomputable section +open MeasureTheory +namespace InvariantIsing + +lemma empiricalField_integrable {N : ℕ} (hN : 0 < N) (c : Fin N → ℝ) (f : ℝ → ℝ) : + Integrable f (empiricalSpectralLaw hN c : Measure ℝ) := by + change Integrable f (Measure.sum (fun i : Fin N => ENNReal.ofReal ((1 : ℝ)/N) • Measure.dirac (c i))) + rw [Measure.sum_fintype] + apply integrable_finsetSum_measure.mpr + intro i _ + exact (integrable_dirac (by simp)).smul_measure (by finiteness) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalLawContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalLawContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1eff782bf19ec83c7b3ae91b8fca2b9e496da4af --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalLawContinuity.lean @@ -0,0 +1,31 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianEmpiricalWeak + +namespace OAI + +/-! Continuity of finite empirical spectral measures in their actual eigenvalues. -/ +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped Topology +namespace InvariantIsing + +theorem continuous_empiricalSpectralLaw {N : ℕ} (hN : 0 < N) : + Continuous (fun eig : Fin N → ℝ => empiricalSpectralLaw hN eig) := by + apply ProbabilityMeasure.continuous_iff_forall_continuous_integral.mpr + intro f + simp only [empiricalSpectralLaw_integral] + exact continuous_const.mul (continuous_finsetSum _ fun i _ => f.continuous.comp (continuous_apply i)) + +theorem continuous_scaled_gaussianEmpirical {N m : ℕ} (hN : 0 < N) (c : ℝ) : + Continuous (fun z : EuclideanSpace ℝ (Fin N × Fin m) => LevyProkhorov.ofMeasure + (empiricalSpectralLaw hN (fun i => c*gaussianPatternEigenvalues z i))) := by + apply LevyProkhorov.continuous_ofMeasure_probabilityMeasure.comp + apply (continuous_empiricalSpectralLaw hN).comp + apply continuous_pi + intro i + exact continuous_const.mul ((continuous_apply i).comp (continuous_gaussianPatternEigenvalues N m)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalSpectralLaw.lean b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalSpectralLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..147fb903f64cae7410725b1f9c93a54a76a693f9 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/EmpiricalSpectralLaw.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralMeasure +import Mathlib.MeasureTheory.Measure.Portmanteau + +namespace OAI + +/-! The empirical spectral probability measure and its finite-set masses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped BigOperators Topology Classical + +namespace InvariantIsing + +lemma empiricalSpectralWeight_sum {N : ℕ} (hN : 0 < N) : + ∑ _i : Fin N, (1 : ℝ)/N=1 := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + field_simp + +def empiricalSpectralLaw {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) : ProbabilityMeasure ℝ := + ⟨finiteSpectralMeasure (fun _ => (1 : ℝ)/N) eig, + finiteSpectralMeasure_probability _ _ (fun _ => by positivity) (empiricalSpectralWeight_sum hN)⟩ + +lemma empiricalSpectralLaw_integral {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) (f : ℝ → ℝ) : + (∫ x, f x ∂(empiricalSpectralLaw hN eig : Measure ℝ))=(1 : ℝ)/N*∑ i, f (eig i) := by + change (∫ x, f x ∂finiteSpectralMeasure (fun _ => (1 : ℝ)/N) eig)=_ + rw [integral_finiteSpectralMeasure _ _ (fun _ => by positivity)] + rw [Finset.mul_sum] + +lemma empiricalSpectralLaw_mass {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) + (S : Set ℝ) (hS : MeasurableSet S) : + (empiricalSpectralLaw hN eig : Measure ℝ).real S= + ((Finset.univ.filter (fun i => eig i∈S)).card : ℝ)/N := by + classical + have hh := empiricalSpectralLaw_integral hN eig (S.indicator (fun _ => (1 : ℝ))) + rw [integral_indicator hS,integral_const] at hh + simp only [measureReal_def,Measure.restrict_apply_univ,smul_eq_mul,mul_one] at hh ⊢ + rw [hh] + simp only [Set.indicator_apply,Finset.sum_ite,Finset.sum_const_zero,add_zero, + Finset.sum_const,nsmul_eq_mul,mul_one] + ring + +lemma empiricalSpectralLaw_map {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) + (f : ℝ → ℝ) (hf : Measurable f) : + Measure.map f (empiricalSpectralLaw hN eig : Measure ℝ)= + (empiricalSpectralLaw hN (fun i => f (eig i)) : Measure ℝ) := by + change Measure.map f (finiteSpectralMeasure (fun _ : Fin N => (1 : ℝ)/N) eig)= + finiteSpectralMeasure (fun _ : Fin N => (1 : ℝ)/N) (fun i => f (eig i)) + unfold finiteSpectralMeasure + rw [Measure.map_sum hf.aemeasurable] + congr 1 + funext i + rw [Measure.map_smul _ hf.aemeasurable,Measure.map_dirac] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/FiniteSpectralContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/FiniteSpectralContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4d9f3e5eaa74e90231729bdc7c4616eb3ffe9d2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/FiniteSpectralContinuity.lean @@ -0,0 +1,200 @@ +import OAI.Probability.InvariantIsing.Core.FiniteVariationalBounds + +namespace OAI + +/-! Continuity under changes of the positive masses of a fixed finite spectral +alphabet. The inverse is compared using its defining resolvent equation. -/ + +noncomputable section +open Filter Set +open scoped BigOperators Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem finiteResolvent_tendsto_weights (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hρs : Tendsto ρs atTop (𝓝 ρ)) (b : ℝ) : + Tendsto (fun k => finiteResolvent (ρs k) eig b) atTop (𝓝 (finiteResolvent ρ eig b)) := by + exact tendsto_finsetSum Finset.univ (fun a _ => + ((tendsto_pi_nhds.mp hρs) a).div_const (b - eig a)) + +theorem finiteInverse_tendsto_weights (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a = 1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) + (xs : ℕ → ℝ) {x : ℝ} (hxs : Tendsto xs atTop (𝓝 x)) (hx : 0 < x) : + Tendsto (fun k => finiteInverse (ρs k) eig (hspos k) (hssum k) (xs k)) + atTop (𝓝 (finiteInverse ρ eig hpos hsum x)) := by + have hs := finiteInverse_spec ρ eig hpos hsum hx + have hxp : ∀ᶠ k in atTop, 0 < xs k := hxs.eventually (Ioi_mem_nhds hx) + apply tendsto_order.2 + constructor + · intro l hl + by_cases he : ∀ a, eig a < l + · have hR : x < finiteResolvent ρ eig l := by + rw [← hs.2] + exact finiteResolvent_strictAnti (fun a => (hpos a).le) hsum he hl + have ht := hxs.eventually_lt (finiteResolvent_tendsto_weights ρs ρ eig hρs l) hR + filter_upwards [hxp, ht] with k hk hlt + have hsk := finiteInverse_spec (ρs k) eig (hspos k) (hssum k) hk + by_contra hnot + rcases (le_of_not_gt hnot).eq_or_lt with h | h + · rw [← h, hsk.2] at hlt + exact (lt_irrefl _ hlt) + · have hc := finiteResolvent_strictAnti (fun a => (hspos k a).le) + (hssum k) hsk.1 h + rw [hsk.2] at hc + exact (not_lt_of_ge hc.le hlt) + · push Not at he + obtain ⟨a, ha⟩ := he + filter_upwards [hxp] with k hk + exact ha.trans_lt ((finiteInverse_spec (ρs k) eig (hspos k) (hssum k) hk).1 a) + · intro u hu + have he : ∀ a, eig a < u := fun a => (hs.1 a).trans hu + have hR : finiteResolvent ρ eig u < x := by + rw [← hs.2] + exact finiteResolvent_strictAnti (fun a => (hpos a).le) hsum hs.1 hu + have ht := (finiteResolvent_tendsto_weights ρs ρ eig hρs u).eventually_lt hxs hR + filter_upwards [hxp, ht] with k hk hlt + have hsk := finiteInverse_spec (ρs k) eig (hspos k) (hssum k) hk + by_contra hnot + rcases (le_of_not_gt hnot).eq_or_lt with h | h + · rw [h, hsk.2] at hlt + exact (lt_irrefl _ hlt) + · have hc := finiteResolvent_strictAnti (fun a => (hspos k a).le) (hssum k) he h + rw [hsk.2] at hc + exact (not_lt_of_ge hc.le hlt) + +theorem finiteR_tendsto_weights_pos (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a = 1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) + (xs : ℕ → ℝ) {x : ℝ} (hxs : Tendsto xs atTop (𝓝 x)) (hx : 0 < x) : + Tendsto (fun k => finiteR (ρs k) eig (hspos k) (hssum k) (xs k)) + atTop (𝓝 (finiteR ρ eig hpos hsum x)) := by + have hb := finiteInverse_tendsto_weights ρs ρ eig hspos hssum hpos hsum hρs xs hxs hx + have hi : Tendsto (fun k => 1 / xs k) atTop (𝓝 (1 / x)) := + tendsto_const_nhds.div hxs hx.ne' + have he : (fun k => finiteR (ρs k) eig (hspos k) (hssum k) (xs k)) =ᶠ[atTop] + (fun k => finiteInverse (ρs k) eig (hspos k) (hssum k) (xs k) - 1 / xs k) := by + filter_upwards [hxs.eventually (Ioi_mem_nhds hx)] with k hk + simp only [finiteR, ite_eq_left hk] + have hl : Tendsto + (fun k => finiteInverse (ρs k) eig (hspos k) (hssum k) (xs k) - 1 / xs k) + atTop (𝓝 (finiteR ρ eig hpos hsum x)) := by + simpa only [finiteR, ite_eq_left hx] using hb.sub hi + exact hl.congr' he.symm + +theorem finiteR_tendsto_weights_zero (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a = 1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) + (xs : ℕ → ℝ) (hxs : Tendsto xs atTop (𝓝 0)) : + Tendsto (fun k => finiteR (ρs k) eig (hspos k) (hssum k) (xs k)) + atTop (𝓝 (finiteR ρ eig hpos hsum 0)) := by + let K := 1 + ∑ a, |eig a| + have hK : 0 < K := by + have := Finset.sum_nonneg (s := Finset.univ) (fun a _ => abs_nonneg (eig a)) + dsimp only [K] + linarith + have heig a : |eig a| ≤ K := by + have := Finset.single_le_sum (f := fun a => |eig a|) + (fun a _ => abs_nonneg (eig a)) (Finset.mem_univ a) + dsimp only [K] + linarith + have hsmall : ∀ᶠ k in atTop, xs k < 1 / (4 * K) := + hxs.eventually (Iio_mem_nhds (by positivity)) + have herr : ∀ᶠ k in atTop, + ‖finiteR (ρs k) eig (hspos k) (hssum k) (xs k) - ∑ a, ρs k a * eig a‖ ≤ + 8 * K ^ 2 * |xs k| := by + filter_upwards [hsmall] with k hk + rw [Real.norm_eq_abs] + by_cases hxk : 0 < xs k + · rw [abs_of_nonneg (sub_nonneg.mpr (mean_le_finiteR (ρs k) eig + (hspos k) (hssum k) hxk)), abs_of_pos hxk] + apply finiteR_sub_mean_le (ρs k) eig (hspos k) (hssum k) hK.le heig hxk + have := (lt_div_iff₀ (show 0 < 4 * K by positivity)).mp hk + nlinarith + · simp only [finiteR, ite_eq_right hxk, sub_self, abs_zero] + positivity + have hb : Tendsto (fun k => 8 * K ^ 2 * |xs k|) atTop (𝓝 0) := by + simpa using hxs.abs.const_mul (8 * K ^ 2) + have hz := squeeze_zero_norm' herr hb + have hm : Tendsto (fun k => ∑ a, ρs k a * eig a) atTop (𝓝 (∑ a, ρ a * eig a)) := + tendsto_finsetSum Finset.univ (fun a _ => ((tendsto_pi_nhds.mp hρs) a).mul_const _) + simpa only [sub_add_cancel, zero_add, finiteR, lt_self_iff_false, ite_false] using hz.add hm + +theorem finiteR_tendsto_weights_nonneg (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a = 1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) + (xs : ℕ → ℝ) {x : ℝ} (hxs : Tendsto xs atTop (𝓝 x)) (hx : 0 ≤ x) : + Tendsto (fun k => finiteR (ρs k) eig (hspos k) (hssum k) (xs k)) + atTop (𝓝 (finiteR ρ eig hpos hsum x)) := by + rcases hx.eq_or_lt with hx | hx + · subst x + exact finiteR_tendsto_weights_zero ρs ρ eig hspos hssum hpos hsum hρs xs hxs + · exact finiteR_tendsto_weights_pos ρs ρ eig hspos hssum hpos hsum hρs xs hxs hx + +/-- Uniformity on the whole interval includes the transform's value at zero. -/ +theorem finiteR_uniform_weights (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a = 1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, ∀ x ∈ Icc (0 : ℝ) 1, + |finiteR (ρs k) eig (hspos k) (hssum k) x - finiteR ρ eig hpos hsum x| < ε := by + classical + intro ε hε + by_contra hbad + have hbad' : ∃ᶠ k in atTop, ∃ x ∈ Icc (0 : ℝ) 1, + ε ≤ |finiteR (ρs k) eig (hspos k) (hssum k) x - finiteR ρ eig hpos hsum x| := by + simpa only [Filter.not_eventually, not_forall, not_imp, not_lt, exists_prop] using hbad + obtain ⟨φ, hφ, hφbad⟩ := extraction_of_frequently_atTop hbad' + choose xs hxs herror using hφbad + obtain ⟨x, hx, ψ, hψ, hlim⟩ := isCompact_Icc.tendsto_subseq hxs + have hweights := hρs.comp (hφ.comp hψ).tendsto_atTop + have hR := finiteR_tendsto_weights_nonneg + (fun k => ρs (φ (ψ k))) ρ eig (fun k => hspos (φ (ψ k))) + (fun k => hssum (φ (ψ k))) hpos hsum hweights (fun k => xs (ψ k)) hlim hx.1 + have hfixed := (continuous_finiteR ρ eig hpos hsum).continuousAt.tendsto.comp hlim + have hdiff := (hR.sub hfixed).abs + have hzero : Tendsto (fun k => + |finiteR (ρs (φ (ψ k))) eig (hspos (φ (ψ k))) (hssum (φ (ψ k))) (xs (ψ k)) - + finiteR ρ eig hpos hsum (xs (ψ k))|) atTop (𝓝 0) := by + simpa only [Function.comp_apply, sub_self, abs_zero] using hdiff + have hsmall : ∀ᶠ k in atTop, + |finiteR (ρs (φ (ψ k))) eig (hspos (φ (ψ k))) (hssum (φ (ψ k))) (xs (ψ k)) - + finiteR ρ eig hpos hsum (xs (ψ k))| < ε := by + exact hzero.eventually (Iio_mem_nhds hε) + obtain ⟨k, hk⟩ := hsmall.exists + exact (not_le_of_gt hk) (herror (ψ k)) + +theorem finiteVariational_tendsto_weights (ρs : ℕ → ι → ℝ) (ρ eig : ι → ℝ) + (hspos : ∀ k a, 0 < ρs k a) (hssum : ∀ k, ∑ a, ρs k a = 1) + (hpos : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (hρs : Tendsto ρs atTop (𝓝 ρ)) : + Tendsto (fun k => (variationalFunctional (finiteR (ρs k) eig (hspos k) (hssum k))).toReal) + atTop (𝓝 (variationalFunctional (finiteR ρ eig hpos hsum)).toReal) := by + have hf := finiteVariational_ne_top_bot ρ eig hpos hsum + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [finiteR_uniform_weights ρs ρ eig hspos hssum hpos hsum hρs ε hε] with k hk + have hfk := finiteVariational_ne_top_bot (ρs k) eig (hspos k) (hssum k) + have hleft := variationalFunctional_le_add (finiteR (ρs k) eig (hspos k) (hssum k)) + (finiteR ρ eig hpos hsum) (continuous_finiteR (ρs k) eig (hspos k) (hssum k)) + (continuous_finiteR ρ eig hpos hsum) ε (fun x hx => (hk x hx).le) + have hright := variationalFunctional_le_add (finiteR ρ eig hpos hsum) + (finiteR (ρs k) eig (hspos k) (hssum k)) (continuous_finiteR ρ eig hpos hsum) + (continuous_finiteR (ρs k) eig (hspos k) (hssum k)) ε + (fun x hx => by simpa only [abs_sub_comm] using (hk x hx).le) + rw [← EReal.coe_toReal hfk.1 hfk.2, ← EReal.coe_toReal hf.1 hf.2, + ← EReal.coe_add, EReal.coe_le_coe_iff] at hleft hright + rw [Real.dist_eq, abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/FiniteSpectralMeasure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/FiniteSpectralMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..3797d487ac9348c8fd4d110ce8d068152adf1859 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/FiniteSpectralMeasure.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureResolvent + +namespace OAI + +/-! The general measure transform agrees with the finite-alphabet transform. +Positive masses ensure that the upper edge is an atom and the inverse is uncapped. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped BigOperators + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +def finiteSpectralMeasure (ρ eig : ι → ℝ) : Measure ℝ := + Measure.sum fun a => ENNReal.ofReal (ρ a) • Measure.dirac (eig a) + +theorem finiteSpectralMeasure_probability (ρ eig : ι → ℝ) + (hρ : ∀ a, 0 ≤ ρ a) (hsum : ∑ a, ρ a = 1) : + IsProbabilityMeasure (finiteSpectralMeasure ρ eig) := by + apply HasSum.isProbabilityMeasure_sum_dirac hρ + simpa only [hsum] using hasSum_fintype ρ + +theorem integral_finiteSpectralMeasure (ρ eig : ι → ℝ) (hρ : ∀ a, 0 ≤ ρ a) + (f : ℝ → ℝ) : + (∫ y, f y ∂finiteSpectralMeasure ρ eig) = ∑ a, ρ a * f (eig a) := by + have hi a : Integrable f (ENNReal.ofReal (ρ a) • Measure.dirac (eig a)) := + (integrable_dirac (by simp)).smul_measure (by finiteness) + rw [finiteSpectralMeasure, Measure.sum_fintype, + integral_finsetSum_measure (fun a _ => hi a)] + simp only [integral_smul_measure, integral_dirac, ENNReal.toReal_ofReal (hρ _), smul_eq_mul] + +theorem ae_finiteSpectralMeasure (ρ eig : ι → ℝ) {P : ℝ → Prop} (hP : ∀ a, P (eig a)) : + ∀ᵐ y ∂finiteSpectralMeasure ρ eig, P y := by + rw [finiteSpectralMeasure, Measure.ae_sum_iff] + intro a + have hd : ∀ᵐ y ∂Measure.dirac (eig a), P y := by + simpa only [ae_dirac_eq, Filter.eventually_pure] using hP a + exact Measure.ae_smul_measure hd _ + +theorem measureResolvent_finiteSpectralMeasure (ρ eig : ι → ℝ) (hρ : ∀ a, 0 ≤ ρ a) + (b : ℝ) : measureResolvent (finiteSpectralMeasure ρ eig) b = finiteResolvent ρ eig b := by + rw [measureResolvent, integral_finiteSpectralMeasure ρ eig hρ] + simp only [finiteResolvent, mul_one_div] + +theorem measureR_finiteSpectralMeasure (ρ eig : ι → ℝ) + (hρ : ∀ a, 0 < ρ a) (hsum : ∑ a, ρ a = 1) + (aMax : ι) (hMax : ∀ a, eig a ≤ eig aMax) (x : ℝ) : + measureR (finiteSpectralMeasure ρ eig) (eig aMax) x = finiteR ρ eig hρ hsum x := by + let := finiteSpectralMeasure_probability ρ eig (fun a => (hρ a).le) hsum + by_cases hx : 0 < x + · have hs := finiteInverse_spec ρ eig hρ hsum hx + have hsol : measureResolvent (finiteSpectralMeasure ρ eig) (finiteInverse ρ eig hρ hsum x) = x := by + rw [measureResolvent_finiteSpectralMeasure ρ eig (fun a => (hρ a).le)] + exact hs.2 + have hi := measureInverse_eq_of_solution (finiteSpectralMeasure ρ eig) + (ae_finiteSpectralMeasure ρ eig hMax) (hs.1 aMax) hsol + simp only [measureR, finiteR, ite_eq_left hx, hi] + · simp only [measureR, finiteR, ite_eq_right hx, + integral_finiteSpectralMeasure ρ eig (fun a => (hρ a).le)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/HermitianEigenvalueLimits.lean b/lean/OAI/Probability/InvariantIsing/Spectral/HermitianEigenvalueLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..c70d54e9ec5ab29792c8fb0f0af14ffc68eced08 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/HermitianEigenvalueLimits.lean @@ -0,0 +1,67 @@ +import OAI.Probability.InvariantIsing.Spectral.HermitianEigenvalueRoots + +namespace OAI + +/-! Limits of ordered Hermitian roots, with multiplicities retained. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix Polynomial Filter Set +open scoped BigOperators Matrix.Norms.L2Operator Topology +namespace InvariantIsing + +lemma hermitian_eigenvalues₀_limit_unique {N : ℕ} + (A : ℕ → Matrix (Fin N) (Fin N) ℝ) (hA : ∀ n, (A n).IsHermitian) + (B : Matrix (Fin N) (Fin N) ℝ) (hB : B.IsHermitian) + (hAB : Tendsto A atTop (𝓝 B)) (e : Fin (Fintype.card (Fin N)) → ℝ) + (he : Tendsto (fun n => (hA n).eigenvalues₀) atTop (𝓝 e)) : e = hB.eigenvalues₀ := by + have heord : Antitone e := by + intro i j hij + exact le_of_tendsto_of_tendsto ((continuous_apply j).tendsto e |>.comp he) + ((continuous_apply i).tendsto e |>.comp he) + (Eventually.of_forall fun n => (hA n).eigenvalues₀_antitone hij) + apply (hermitian_eigenvalues₀_unique B hB e heord ?_).symm + intro t + have hp : Tendsto (fun n => ∏ i, (t-(hA n).eigenvalues₀ i)) atTop (𝓝 (∏ i, (t-e i))) := by + apply tendsto_finsetProd + intro i _ + exact tendsto_const_nhds.sub ((continuous_apply i).tendsto e |>.comp he) + have hq := hermitian_eval_tendsto hAB t + have hfn : (fun n => (A n).charpoly.eval t) = + (fun n => ∏ i, (t-(hA n).eigenvalues₀ i)) := + funext fun n => hermitian_eigenvalues₀_eval (A n) (hA n) t + rw [hfn] at hq + exact tendsto_nhds_unique hq hp + +theorem hermitian_eigenvalues₀_tendsto {N : ℕ} + (A : ℕ → Matrix (Fin N) (Fin N) ℝ) (hA : ∀ n, (A n).IsHermitian) + (B : Matrix (Fin N) (Fin N) ℝ) (hB : B.IsHermitian) + (hAB : Tendsto A atTop (𝓝 B)) : + Tendsto (fun n => (hA n).eigenvalues₀) atTop (𝓝 hB.eigenvalues₀) := by + obtain ⟨R,hR,hAR⟩ := (Metric.isBounded_range_of_tendsto A hAB).exists_pos_norm_le + have hb (n : ℕ) : ‖(hA n).eigenvalues₀‖ ≤ R := by + apply (pi_norm_le_iff_of_nonneg hR.le).mpr + intro i + exact (hermitian_eigenvalues₀_norm_le (A n) (hA n) i).trans (hAR (A n) (mem_range_self n)) + by_contra ht + simp only [Metric.tendsto_nhds] at ht + push Not at ht + obtain ⟨ε,hε,hfreq⟩ := ht + let K : Set (Fin (Fintype.card (Fin N)) → ℝ) := + Metric.closedBall 0 R ∩ {e | ε ≤ dist e hB.eigenvalues₀} + have hK : IsCompact K := (isCompact_closedBall 0 R).inter_right + (isClosed_le continuous_const (continuous_id.dist continuous_const)) + have hmem : ∃ᶠ n in atTop, (hA n).eigenvalues₀ ∈ K := by + apply hfreq.mono + intro n hn + exact ⟨by simpa only [Metric.mem_closedBall,dist_zero_right] using hb n,hn⟩ + obtain ⟨e,heK,φ,hφ,hφe⟩ := hK.tendsto_subseq' hmem + have heq : e = hB.eigenvalues₀ := hermitian_eigenvalues₀_limit_unique + (fun n => A (φ n)) (fun n => hA (φ n)) B hB (hAB.comp hφ.tendsto_atTop) e hφe + have hz : ε ≤ dist e hB.eigenvalues₀ := heK.2 + rw [heq,dist_self] at hz + exact (not_le_of_gt hε) hz + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/HermitianEigenvalueRoots.lean b/lean/OAI/Probability/InvariantIsing/Spectral/HermitianEigenvalueRoots.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4c3333315e5c014eb8a9ce53cdd2167014ad2da --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/HermitianEigenvalueRoots.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianPatternRotation +import Mathlib.Analysis.CStarAlgebra.Matrix + +namespace OAI + +/-! Ordered Hermitian eigenvalues are uniquely determined by their real characteristic roots. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix Polynomial +open scoped BigOperators Matrix.Norms.L2Operator +namespace InvariantIsing + +lemma hermitian_eigenvalues₀_eval {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.IsHermitian) (t : ℝ) : + A.charpoly.eval t = ∏ i : Fin (Fintype.card (Fin N)), (t-hA.eigenvalues₀ i) := by + have hp := hA.roots_charpoly_eq_eigenvalues₀ + have hs := hA.splits_charpoly + rw [hs.eval_eq_prod_roots_of_monic (Matrix.charpoly_monic A) t,hp] + rw [Multiset.map_map] + rfl + +lemma hermitian_eigenvalues₀_unique {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.IsHermitian) (e : Fin (Fintype.card (Fin N)) → ℝ) (he : Antitone e) + (hroot : ∀ t : ℝ, A.charpoly.eval t = ∏ i, (t-e i)) : hA.eigenvalues₀ = e := by + have hp : A.charpoly = ∏ i, (X-C (e i)) := by + apply Polynomial.funext + intro t + simpa only [Polynomial.eval_prod,Polynomial.eval_sub,Polynomial.eval_X,Polynomial.eval_C] using hroot t + have hr : A.charpoly.roots = Multiset.map e Finset.univ.val := by + rw [hp,Polynomial.roots_prod] + · simp + · simp [Finset.prod_ne_zero_iff,Polynomial.X_sub_C_ne_zero] + have ho := hA.sort_roots_charpoly_eq_eigenvalues₀ + rw [hr] at ho + simp only [Fin.univ_val_map,Multiset.map_coe,List.map_ofFn,Function.comp_def, + RCLike.re_to_real,Multiset.coe_sort] at ho + have hsort : (List.ofFn e).mergeSort (fun x y => decide (x ≥ y)) = List.ofFn e := by + apply List.mergeSort_of_pairwise + simp only [decide_eq_true_eq,← List.sortedGE_iff_pairwise] + exact he.sortedGE_ofFn + rw [hsort] at ho + exact List.ofFn_inj.mp ho.symm + +lemma hermitian_eigenvalues₀_norm_le {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) + (hA : A.IsHermitian) (i : Fin (Fintype.card (Fin N))) : |hA.eigenvalues₀ i| ≤ ‖A‖ := by + let j : Fin N := (Fintype.equivOfCardEq (Fintype.card_fin _)) i + let : Nonempty (Fin N) := ⟨j⟩ + have hm := hA.eigenvalues_mem_spectrum_real j + have hh := spectrum.norm_le_norm_of_mem hm + simpa only [Real.norm_eq_abs,Matrix.IsHermitian.eigenvalues,j,Equiv.symm_apply_apply] using hh + +lemma hermitian_eval_tendsto {N : ℕ} {A : ℕ → Matrix (Fin N) (Fin N) ℝ} + {B : Matrix (Fin N) (Fin N) ℝ} (hA : Filter.Tendsto A Filter.atTop (nhds B)) (t : ℝ) : + Filter.Tendsto (fun n => (A n).charpoly.eval t) Filter.atTop (nhds (B.charpoly.eval t)) := by + simp only [Matrix.eval_charpoly] + exact ((continuous_const.sub continuous_id).matrix_det.tendsto B).comp hA + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureInverseContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureInverseContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..84c3d5d9fb404fd211563ca14fd6868d757affcf --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureInverseContinuity.lean @@ -0,0 +1,107 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureResolvent + +namespace OAI + +/-! Order tests and continuity for the inverse across the capped branch. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical + +namespace InvariantIsing + +theorem measureInverse_le_iff (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e x b : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hx : 0 < x) (hb : e < b) : + measureInverse μ e x ≤ b ↔ measureResolvent μ b ≤ x := by + by_cases hex : ∃ r, e < r ∧ measureResolvent μ r = x + · rw [measureInverse, dite_eq_left hex] + have hs := hex.choose_spec + constructor + · intro hrb + rcases hrb.eq_or_lt with h | h + · rw [← h, hs.2] + · have ht := measureResolvent_strictAnti μ hμ hs.1 h + rw [hs.2] at ht + exact ht.le + · intro hR + by_contra hnot + have ht := measureResolvent_strictAnti μ hμ hb (lt_of_not_ge hnot) + rw [hs.2] at ht + exact (not_lt_of_ge hR) ht + · rw [measureInverse, dite_eq_right hex] + constructor + · intro _ + by_contra hnot + exact hex (exists_measureResolvent_solution μ hμ hb hx (lt_of_not_ge hnot).le) + · intro _ + exact hb.le + +theorem measureInverse_lt_iff (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e x b : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hx : 0 < x) (hb : e < b) : + measureInverse μ e x < b ↔ measureResolvent μ b < x := by + by_cases hex : ∃ r, e < r ∧ measureResolvent μ r = x + · rw [measureInverse, dite_eq_left hex] + have hs := hex.choose_spec + constructor + · intro hrb + have ht := measureResolvent_strictAnti μ hμ hs.1 hrb + rwa [hs.2] at ht + · intro hR + by_contra hnot + rcases (le_of_not_gt hnot).eq_or_lt with h | h + · rw [h, hs.2] at hR + exact lt_irrefl _ hR + · have ht := measureResolvent_strictAnti μ hμ hb h + rw [hs.2] at ht + exact (not_lt_of_ge ht.le) hR + · rw [measureInverse, dite_eq_right hex] + have hv : measureResolvent μ b < x := by + by_contra hnot + exact hex (exists_measureResolvent_solution μ hμ hb hx (le_of_not_gt hnot)) + exact ⟨fun _ => hv, fun _ => hb⟩ + +theorem continuousAt_measureInverse (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e x : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hx : 0 < x) : + ContinuousAt (measureInverse μ e) x := by + have hbound := (measureInverse_bounds μ hμ hx).1 + have hxp : ∀ᶠ y in 𝓝 x, 0 < y := Ioi_mem_nhds hx + apply tendsto_order.2 + constructor + · intro l hl + by_cases hle : l < e + · filter_upwards [hxp] with y hy + exact hle.trans_le (measureInverse_bounds μ hμ hy).1 + · let c := (l + measureInverse μ e x) / 2 + have hec : e < c := by dsimp only [c]; linarith [le_of_not_gt hle] + have hlc : l < c := by dsimp only [c]; linarith + have hci : c < measureInverse μ e x := by dsimp only [c]; linarith + have hR : x < measureResolvent μ c := by + by_contra hnot + exact (not_le_of_gt hci) + ((measureInverse_le_iff μ hμ hx hec).mpr (le_of_not_gt hnot)) + filter_upwards [hxp, Iio_mem_nhds hR] with y hy hRy + have hnot : ¬ measureInverse μ e y ≤ c := by + intro hle + exact (not_le_of_gt hRy) ((measureInverse_le_iff μ hμ hy hec).mp hle) + exact hlc.trans (lt_of_not_ge hnot) + · intro u hu + have heu : e < u := hbound.trans_lt hu + have hR := (measureInverse_lt_iff μ hμ hx heu).mp hu + filter_upwards [hxp, Ioi_mem_nhds hR] with y hy hRy + exact (measureInverse_lt_iff μ hμ hy heu).mpr hRy + +theorem continuousAt_measureR_pos (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e x : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hx : 0 < x) : + ContinuousAt (measureR μ e) x := by + have hc : ContinuousAt (fun y => measureInverse μ e y - 1 / y) x := + (continuousAt_measureInverse μ hμ hx).sub + (continuousAt_const.div continuousAt_id hx.ne') + apply hc.congr_of_eventuallyEq + filter_upwards [Ioi_mem_nhds hx] with y hy + simp only [measureR, ite_eq_left (show 0 < y from hy)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec9f0a87a09f87e7b76cba879c28d075ff4989d8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticContinuity.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticSpectralContinuity +import OAI.Probability.InvariantIsing.Spectral.MeasureVariationalContinuity + +namespace OAI + +/-! Compact spectral weak convergence preserves the finite-field magnetic value. -/ +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical +namespace InvariantIsing + +theorem measureMagnetic_tendsto_weak {A : Type*} [Fintype A] + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + {K : ℝ} (hK : 0 < K) (he : e ≤ K) (hes : ∀ k, es k ≤ K) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ∈ Icc (-K) (es k)) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ∈ Icc (-K) e) + (γ b : A → ℝ) (hγ : ∀ a, 0 ≤ γ a) (hγsum : ∑ a, γ a=1) : + Tendsto (fun k => (finiteMagneticFunctional (measureR (μs k : Measure ℝ) (es k)) γ b).toReal) + atTop (𝓝 (finiteMagneticFunctional (measureR (μ : Measure ℝ) e) γ b).toReal) := by + have hf0 := measureVariational_ne_top_bot (μ : Measure ℝ) hK he hμ + have hf := finiteMagneticFunctional_ne_top_bot _ γ b hγ hγsum hf0.1 hf0.2 + have hR := continuous_measureR (μ : Measure ℝ) hK he hμ + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [measureR_uniform_weak μs μ es e hweak hedge hK he hes hs hμ ε hε] with k hk + have hfk0 := measureVariational_ne_top_bot (μs k : Measure ℝ) hK (hes k) (hs k) + have hfk := finiteMagneticFunctional_ne_top_bot _ γ b hγ hγsum hfk0.1 hfk0.2 + have hRk := continuous_measureR (μs k : Measure ℝ) hK (hes k) (hs k) + have hl := finiteMagneticFunctional_spectral_le_add γ b _ _ hRk hR ε (fun x hx => (hk x hx).le) + have hr := finiteMagneticFunctional_spectral_le_add γ b _ _ hR hRk ε + (fun x hx => by simpa only [abs_sub_comm] using (hk x hx).le) + rw [← EReal.coe_toReal hfk.1 hfk.2, ← EReal.coe_toReal hf.1 hf.2, + ← EReal.coe_add, EReal.coe_le_coe_iff] at hl hr + rw [Real.dist_eq, abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticLawInvariance.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticLawInvariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..b27b95958d7de68e06d49c32e4d35c602e8f7f1e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticLawInvariance.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureMagneticTransport +import OAI.Probability.InvariantIsing.Core.FiniteFieldLawCoupling + +namespace OAI + +/-! The finite-field magnetic value depends on the field law, not on its +choice of positive atomic labels. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped BigOperators +namespace InvariantIsing + +theorem measureMagnetic_eq_of_field_law_eq {A B : Type*} [Fintype A] [Fintype B] + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (γ c : A → ℝ) (δ d : B → ℝ) (hγ : ∀ i, 0 < γ i) (hδ : ∀ j, 0 < δ j) + (hγsum : ∑ i, γ i=1) (hδsum : ∑ j, δ j=1) + (he : finiteSpectralMeasure γ c=finiteSpectralMeasure δ d) : + (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal= + (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) δ d).toReal := by + have hmass := fieldAtomMass_eq_of_law_eq γ c δ d (fun i => (hγ i).le) + (fun j => (hδ j).le) he + have hh := measureMagnetic_transport_le ν a b hcompact hbound ha hb + (sameFieldCoupling γ c δ d) γ c δ d + (sameFieldCoupling_nonneg γ c δ d hγ (fun j => (hδ j).le)) + (fun i => (hγ i).le) hδ hγsum hδsum + (sameFieldCoupling_row γ c δ d hγ hmass) (sameFieldCoupling_col γ c δ d hδ hmass) + have hk := measureMagnetic_transport_le ν a b hcompact hbound ha hb + (sameFieldCoupling δ d γ c) δ d γ c + (sameFieldCoupling_nonneg δ d γ c hδ (fun i => (hγ i).le)) + (fun j => (hδ j).le) hγ hδsum hγsum + (sameFieldCoupling_row δ d γ c hδ (fun x => (hmass x).symm)) + (sameFieldCoupling_col δ d γ c hγ (fun x => (hmass x).symm)) + rw [sameFieldCoupling_cost,add_zero] at hh hk + exact le_antisymm hh hk + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticTransport.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bce08f1850e458d1bd1214f7c0860c152fac48a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureMagneticTransport.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Magnetic.MagneticVariationalTransport +import OAI.Probability.InvariantIsing.Magnetic.MagneticPartitionContinuity + +namespace OAI + +/-! The field transportation bound extends from finite spectral laws to +every compact spectral law by uniform transform approximation. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology BigOperators +namespace InvariantIsing + +theorem measureMagnetic_transport_le {A B : Type*} [Fintype A] [Fintype B] + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (w : A → B → ℝ) (γ c : A → ℝ) (δ d : B → ℝ) + (hw : ∀ i j, 0 ≤ w i j) (hγ : ∀ i, 0 ≤ γ i) (hδ : ∀ j, 0 < δ j) + (hγsum : ∑ i, γ i=1) (hδsum : ∑ j, δ j=1) + (hrow : ∀ i, ∑ j, w i j=γ i) (hcol : ∀ j, ∑ i, w i j=δ j) : + (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) γ c).toReal ≤ + (finiteMagneticFunctional (measureR (ν : Measure ℝ) b) δ d).toReal+ + ∑ i, ∑ j, w i j* |c i-d j| := by + let ε := fun k : ℕ => (1 : ℝ)/(k+1) + let D (k : ℕ) : CompactSpectralPartition ν a b (ε k) := Classical.choice + (exists_compact_spectral_partition ν a b (ε k) hcompact hbound (by dsimp [ε]; positivity)) + have hε : Tendsto ε atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ) + have h1 := compact_partition_magnetic_tendsto ν a b ε D (hbound ha).2 ha hb hbound hε + γ c hγ hγsum + have h2 := compact_partition_magnetic_tendsto ν a b ε D (hbound ha).2 ha hb hbound hε + δ d (fun j => (hδ j).le) hδsum + apply le_of_tendsto_of_tendsto h1 (h2.add_const _) + apply Eventually.of_forall + intro k + let ρ := fun i : (D k).Positive => (D k).weight i + let lam := fun i : (D k).Positive => (D k).value i + have hρ i : 0 < ρ i := i.property + have hs : ∑ i, ρ i=1 := (D k).weight_sum + have heq : measureR ((D k).law : Measure ℝ) (D k).edge=finiteR ρ lam hρ hs := by + funext x + exact measureR_finiteSpectralMeasure ρ lam hρ hs (D k).upper (D k).le_upper x + dsimp only + rw [heq] + exact finiteMagneticFunctional_transport_le ρ lam hρ hs w γ c δ d hw hγ hδ + hγsum hδsum hrow hcol + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasurePointMass.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasurePointMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f952a8fbd62faf6564a65c617961fd4092cfd01 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasurePointMass.lean @@ -0,0 +1,38 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureRBounds +import OAI.Probability.InvariantIsing.Haar.Rotation + +namespace OAI + +/-! The degenerate spectral law in the general approximation argument. -/ + +noncomputable section +open MeasureTheory Filter +open scoped Topology + +namespace InvariantIsing + +@[simp] lemma measureR_dirac (a x : ℝ) : measureR (Measure.dirac a) a x = a := by + have h := measureR_bounds_all (Measure.dirac a) (l := a) (e := a) + (by simp only [ae_dirac_eq, Filter.eventually_pure, Set.mem_Icc]; exact ⟨le_rfl, le_rfl⟩) x + exact le_antisymm h.2 h.1 + +@[simp] lemma measureVariational_dirac (a : ℝ) : + variationalFunctional (measureR (Measure.dirac a) a) = ((a / 2 : ℝ) : EReal) := by + have he : measureR (Measure.dirac a) a = fun _ => a := funext (measureR_dirac a) + rw [he, variationalFunctional_constant] + +/-- The scalar spectral case of the pressure formula, for arbitrary rotations. -/ +theorem tendsto_pressure_scalar_variational + (eig : (N : ℕ) → Fin (N + 1) → ℝ) (U : (N : ℕ) → Rotation (N + 1)) + (a : ℝ) (δ : ℕ → ℝ) (hδ : Tendsto δ atTop (𝓝 0)) + (heig : ∀ N i, |eig N i - a| ≤ δ N) : + Tendsto (fun N => rotatedPressure (eig N) (U N) (fun _ => 0)) atTop + (𝓝 (variationalFunctional (measureR (Measure.dirac a) a)).toReal) := by + simpa only [measureVariational_dirac, EReal.toReal_coe] using + tendsto_pressure_scalar_spectrum eig U a δ hδ heig + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureRBounds.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureRBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2e9b46a8b1ac122ca57b6c5862cb91731b8ef76 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureRBounds.lean @@ -0,0 +1,170 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureInverseContinuity + +namespace OAI + +/-! Compact-support estimates for the general spectral transform. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical + +namespace InvariantIsing + +lemma integrable_spectralCoordinate (μ : Measure ℝ) [IsProbabilityMeasure μ] + {l e : ℝ} (hμ : ∀ᵐ y ∂μ, y ∈ Icc l e) : Integrable (fun y => y) μ := by + apply (integrable_const (|l| + |e|)).mono' measurable_id.aestronglyMeasurable + filter_upwards [hμ] with y hy + rw [Real.norm_eq_abs, abs_le] + simp only [id_eq] + constructor + · linarith [neg_abs_le l, abs_nonneg e, hy.1] + · linarith [le_abs_self e, abs_nonneg l, hy.2] + +theorem measureR_bounds_all (μ : Measure ℝ) [IsProbabilityMeasure μ] + {l e : ℝ} (hμ : ∀ᵐ y ∂μ, y ∈ Icc l e) (x : ℝ) : + l ≤ measureR μ e x ∧ measureR μ e x ≤ e := by + by_cases hx : 0 < x + · exact measureR_bounds μ hμ hx + · rw [measureR, ite_eq_right hx] + constructor + · simpa only [integral_const, probReal_univ, one_smul] using + integral_mono_ae (integrable_const l) (integrable_spectralCoordinate μ hμ) + (hμ.mono fun _ h => h.1) + · simpa only [integral_const, probReal_univ, one_smul] using + integral_mono_ae (integrable_spectralCoordinate μ hμ) (integrable_const e) + (hμ.mono fun _ h => h.2) + +theorem measureInverse_uncapped_small (μ : Measure ℝ) [IsProbabilityMeasure μ] + {K e x : ℝ} (hK : 0 < K) (he : e ≤ K) + (hμ : ∀ᵐ y ∂μ, y ∈ Icc (-K) e) (hx : 0 < x) (hsmall : 4 * K * x ≤ 1) : + e < measureInverse μ e x ∧ measureResolvent μ (measureInverse μ e x) = x := by + have htest : e < 1 / x - K := by + have h := (le_div_iff₀ hx).mpr hsmall + nlinarith + have hl := le_measureResolvent μ hμ htest + have hvalue : x ≤ measureResolvent μ (1 / x - K) := by + simpa only [sub_neg_eq_add, sub_add_cancel, one_div_one_div] using hl + have hex := exists_measureResolvent_solution μ (hμ.mono fun _ h => h.2) htest hx hvalue + obtain ⟨b, hb, hsol⟩ := hex + rw [measureInverse_eq_of_solution μ (hμ.mono fun _ h => h.2) hb hsol] + exact ⟨hb, hsol⟩ + +theorem measureR_sub_mean_identity (μ : Measure ℝ) [IsProbabilityMeasure μ] + {l e x : ℝ} (hμ : ∀ᵐ y ∂μ, y ∈ Icc l e) (hx : 0 < x) + (hs : e < measureInverse μ e x ∧ measureResolvent μ (measureInverse μ e x) = x) : + measureR μ e x - ∫ y, y ∂μ = + ∫ y, (measureR μ e x - y) ^ 2 / (measureInverse μ e x - y) ∂μ := by + let b := measureInverse μ e x + have hi := integrable_spectralCoordinate μ hμ + have hk : Integrable (fun y => 1 / (b - y)) μ := + integrable_resolventKernel μ (hμ.mono fun _ h => h.2) hs.1 + have ha : ∀ᵐ y ∂μ, (measureR μ e x - y) ^ 2 / (b - y) = + (b - y) - 2 / x + (1 / x ^ 2) * (1 / (b - y)) := by + filter_upwards [hμ] with y hy + have hby : b - y ≠ 0 := by dsimp only [b]; linarith [hs.1, hy.2] + simp only [measureR, ite_eq_left hx] + change (b - 1 / x - y) ^ 2 / (b - y) = _ + field_simp [hx.ne', hby] + ring + have hibase : Integrable (fun y => b - y) μ := (integrable_const b).sub hi + have hib : Integrable (fun y => b - y - 2 / x) μ := + hibase.sub (integrable_const (2 / x)) + have hir : Integrable (fun y => (1 / x ^ 2) * (1 / (b - y))) μ := hk.const_mul _ + have hsplit : (∫ y, b - y - 2 / x ∂μ) = b - (∫ y, y ∂μ) - 2 / x := by + calc + _ = (∫ y, b - y ∂μ) - (∫ _, 2 / x ∂μ) := + integral_sub hibase (integrable_const (2 / x)) + _ = _ := by + rw [show (∫ y, b - y ∂μ) = (∫ _, b ∂μ) - (∫ y, y ∂μ) from + integral_sub (integrable_const b) hi] + simp + rw [integral_congr_ae ha, integral_add hib hir, hsplit, integral_const_mul] + change measureR μ e x - (∫ y, y ∂μ) = + b - (∫ y, y ∂μ) - 2 / x + (1 / x ^ 2) * measureResolvent μ b + rw [hs.2] + simp only [measureR, ite_eq_left hx] + change b - 1 / x - (∫ y, y ∂μ) = _ + field_simp + ring + +theorem measureR_sub_mean_bound (μ : Measure ℝ) [IsProbabilityMeasure μ] + {K e x : ℝ} (hK : 0 < K) (he : e ≤ K) + (hμ : ∀ᵐ y ∂μ, y ∈ Icc (-K) e) (hx : 0 < x) (hsmall : 4 * K * x ≤ 1) : + 0 ≤ measureR μ e x - ∫ y, y ∂μ ∧ + measureR μ e x - ∫ y, y ∂μ ≤ 8 * K ^ 2 * x := by + let b := measureInverse μ e x + let r := measureR μ e x + have hs := measureInverse_uncapped_small μ hK he hμ hx hsmall + have hr := measureR_bounds μ hμ hx + have hbr : x * b = x * r + 1 := by + dsimp only [b, r] + simp only [measureR, ite_eq_left hx] + field_simp + ring + have hb : ∀ᵐ y ∂μ, 0 ≤ (r - y) ^ 2 / (b - y) ∧ + (r - y) ^ 2 / (b - y) ≤ 8 * K ^ 2 * x := by + filter_upwards [hμ] with y hy + have hden : 0 < b - y := by dsimp only [b]; linarith [hs.1, hy.2] + have hlo : -2 * K ≤ r - y := by dsimp only [r]; linarith [hr.1, hy.2] + have hhi : r - y ≤ 2 * K := by dsimp only [r]; linarith [hr.2, hy.1] + have hsq : (r - y) ^ 2 ≤ 4 * K ^ 2 := by + nlinarith [mul_nonneg (sub_nonneg.mpr hlo) (sub_nonneg.mpr hhi)] + have hinv : 1 / (b - y) ≤ 2 * x := by + apply (div_le_iff₀ hden).mpr + have := mul_le_mul_of_nonneg_left hlo hx.le + nlinarith + refine ⟨div_nonneg (sq_nonneg _) hden.le, ?_⟩ + calc + (r - y) ^ 2 / (b - y) = (r - y) ^ 2 * (1 / (b - y)) := by ring + _ ≤ (4 * K ^ 2) * (2 * x) := mul_le_mul hsq hinv (one_div_pos.mpr hden).le (by positivity) + _ = 8 * K ^ 2 * x := by ring + have hm : Measurable (fun y : ℝ => (r - y) ^ 2 / (b - y)) := + ((measurable_const.sub measurable_id).pow_const 2).div (measurable_const.sub measurable_id) + have hi : Integrable (fun y => (r - y) ^ 2 / (b - y)) μ := by + apply (integrable_const (8 * K ^ 2 * x)).mono' hm.aestronglyMeasurable + filter_upwards [hb] with y hy + simpa only [Real.norm_eq_abs, abs_of_nonneg hy.1] using hy.2 + rw [measureR_sub_mean_identity μ hμ hx hs] + constructor + · exact integral_nonneg_of_ae (hb.mono fun _ h => h.1) + · have hu := integral_mono_ae hi (integrable_const (8 * K ^ 2 * x)) (hb.mono fun _ h => h.2) + simpa only [integral_const, probReal_univ, one_smul] using hu + +theorem continuousAt_measureR_zero (μ : Measure ℝ) [IsProbabilityMeasure μ] + {K e : ℝ} (hK : 0 < K) (he : e ≤ K) (hμ : ∀ᵐ y ∂μ, y ∈ Icc (-K) e) : + ContinuousAt (measureR μ e) 0 := by + have herr : ∀ᶠ x : ℝ in 𝓝 0, + ‖measureR μ e x - ∫ y, y ∂μ‖ ≤ 8 * K ^ 2 * |x| := by + filter_upwards [Iio_mem_nhds (show (0 : ℝ) < 1 / (4 * K) by positivity)] with x hxsmall + by_cases hx : 0 < x + · have hsmall : 4 * K * x ≤ 1 := by + have := (lt_div_iff₀ (show (0 : ℝ) < 4 * K by positivity)).mp hxsmall + nlinarith + have hb := measureR_sub_mean_bound μ hK he hμ hx hsmall + simpa only [Real.norm_eq_abs, abs_of_nonneg hb.1, abs_of_pos hx] using hb.2 + · simp only [measureR, ite_eq_right hx, sub_self, norm_zero] + positivity + have ht : Tendsto (fun x : ℝ => 8 * K ^ 2 * |x|) (𝓝 0) (𝓝 0) := by + simpa using (continuous_abs.tendsto (0 : ℝ)).const_mul (8 * K ^ 2) + have hl := (tendsto_sub_nhds_zero_iff).mp (squeeze_zero_norm' herr ht) + simpa only [ContinuousAt, measureR, lt_self_iff_false, ite_false] using hl + +theorem continuous_measureR (μ : Measure ℝ) [IsProbabilityMeasure μ] + {K e : ℝ} (hK : 0 < K) (he : e ≤ K) (hμ : ∀ᵐ y ∂μ, y ∈ Icc (-K) e) : + Continuous (measureR μ e) := by + apply continuous_iff_continuousAt.mpr + intro x + rcases lt_trichotomy x 0 with hx | hx | hx + · have hc : ContinuousAt (fun _ : ℝ => ∫ y, y ∂μ) x := continuousAt_const + apply hc.congr_of_eventuallyEq + filter_upwards [Iio_mem_nhds hx] with y hy + simp only [measureR, ite_eq_right (not_lt.mpr (show y < 0 from hy).le)] + · subst x + exact continuousAt_measureR_zero μ hK he hμ + · exact continuousAt_measureR_pos μ (hμ.mono fun _ h => h.2) hx + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureResolvent.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureResolvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b6af580e3a2414bc549e3f0371368113bbd9a3f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureResolvent.lean @@ -0,0 +1,158 @@ +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralContinuity + +namespace OAI + +/-! The resolvent and the edge-capped inverse for a general spectral law. +The upper edge is an explicit parameter; the hypotheses below say that the +law is supported below it. No inverse is assumed to exist at the edge. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical + +namespace InvariantIsing + +def measureResolvent (μ : Measure ℝ) (b : ℝ) : ℝ := ∫ y, 1 / (b - y) ∂μ + +def measureInverse (μ : Measure ℝ) (e x : ℝ) : ℝ := + if h : ∃ b, e < b ∧ measureResolvent μ b = x then h.choose else e + +def measureR (μ : Measure ℝ) (e x : ℝ) : ℝ := + if 0 < x then measureInverse μ e x - 1 / x else ∫ y, y ∂μ + +lemma measurable_resolventKernel (b : ℝ) : Measurable (fun y : ℝ => 1 / (b - y)) := + measurable_const.div (measurable_const.sub measurable_id) + +lemma resolventKernel_bound {e b y : ℝ} (hb : e < b) (hy : y ≤ e) : + ‖1 / (b - y)‖ ≤ 1 / (b - e) := by + rw [Real.norm_eq_abs, abs_of_pos (one_div_pos.mpr (by linarith))] + exact one_div_le_one_div_of_le (sub_pos.mpr hb) (by linarith) + +lemma integrable_resolventKernel (μ : Measure ℝ) [IsFiniteMeasure μ] + {e b : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hb : e < b) : + Integrable (fun y => 1 / (b - y)) μ := by + apply (integrable_const (1 / (b - e))).mono' (measurable_resolventKernel b).aestronglyMeasurable + filter_upwards [hμ] with y hy + exact resolventKernel_bound hb hy + +lemma measureResolvent_le (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e b : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hb : e < b) : + measureResolvent μ b ≤ 1 / (b - e) := by + have hi := integral_mono_ae (integrable_resolventKernel μ hμ hb) + (integrable_const (1 / (b - e))) (hμ.mono fun y hy => + one_div_le_one_div_of_le (sub_pos.mpr hb) (by linarith)) + simpa only [measureResolvent, integral_const, probReal_univ, one_smul] using hi + +lemma le_measureResolvent (μ : Measure ℝ) [IsProbabilityMeasure μ] + {l e b : ℝ} (hμ : ∀ᵐ y ∂μ, y ∈ Icc l e) (hb : e < b) : + 1 / (b - l) ≤ measureResolvent μ b := by + have hex := hμ.exists + have hbl : l < b := by obtain ⟨y, hy⟩ := hex; linarith [hy.1, hy.2] + have hi := integral_mono_ae (integrable_const (1 / (b - l))) + (integrable_resolventKernel μ (hμ.mono fun _ h => h.2) hb) + (hμ.mono fun y hy => one_div_le_one_div_of_le (by linarith [hy.2]) (by linarith [hy.1])) + simpa only [measureResolvent, integral_const, probReal_univ, one_smul] using hi + +theorem measureResolvent_strictAnti (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e b c : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hb : e < b) (hbc : b < c) : + measureResolvent μ c < measureResolvent μ b := by + have hi := integrable_resolventKernel μ hμ hb + have hj := integrable_resolventKernel μ hμ (hb.trans hbc) + have hlt : ∀ᵐ y ∂μ, 1 / (c - y) < 1 / (b - y) := hμ.mono fun y hy => + one_div_lt_one_div_of_lt (by linarith) (by linarith) + have hle := integral_mono_ae hj hi (hlt.mono fun _ h => h.le) + apply lt_of_le_of_ne hle + intro heq + have hae := (integral_eq_iff_of_ae_le hj hi (hlt.mono fun _ h => h.le)).mp heq + obtain ⟨y, hy, he⟩ := (hlt.and hae).exists + exact (ne_of_lt hy) he + +theorem continuousAt_measureResolvent (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e b : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hb : e < b) : + ContinuousAt (measureResolvent μ) b := by + let c := (e + b) / 2 + have hce : e < c := by dsimp only [c]; linarith + have hcb : c < b := by dsimp only [c]; linarith + apply tendsto_integral_filter_of_dominated_convergence (fun _ => 1 / (c - e)) + · exact Eventually.of_forall fun z => (measurable_resolventKernel z).aestronglyMeasurable + · filter_upwards [Ioi_mem_nhds hcb] with z hz + have hz' : c < z := hz + filter_upwards [hμ] with y hy + exact (resolventKernel_bound (hce.trans hz') hy).trans + (one_div_le_one_div_of_le (sub_pos.mpr hce) (by linarith)) + · exact integrable_const _ + · filter_upwards [hμ] with y hy + exact (continuousAt_const.div (continuousAt_id.sub_const y) + (by change b - y ≠ 0; linarith)).tendsto + +theorem exists_measureResolvent_solution (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e lo x : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hlo : e < lo) + (hx : 0 < x) (hloValue : x ≤ measureResolvent μ lo) : + ∃ b, e < b ∧ measureResolvent μ b = x := by + let hi := lo + 1 / x + have hhi : lo < hi := by dsimp only [hi]; linarith [one_div_pos.mpr hx] + have hhiValue : measureResolvent μ hi ≤ x := by + apply (measureResolvent_le μ hμ (hlo.trans hhi)).trans + have hd : 1 / x ≤ hi - e := by dsimp only [hi]; linarith + simpa using one_div_le_one_div_of_le (one_div_pos.mpr hx) hd + have hc : ContinuousOn (measureResolvent μ) (Icc lo hi) := fun b hb => + (continuousAt_measureResolvent μ hμ (hlo.trans_le hb.1)).continuousWithinAt + obtain ⟨b, hb, hv⟩ := intermediate_value_Icc' hhi.le hc ⟨hhiValue, hloValue⟩ + exact ⟨b, hlo.trans_le hb.1, hv⟩ + +theorem measureInverse_eq_of_solution (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e b x : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hb : e < b) + (hsol : measureResolvent μ b = x) : measureInverse μ e x = b := by + have hex : ∃ b, e < b ∧ measureResolvent μ b = x := ⟨b, hb, hsol⟩ + rw [measureInverse, dite_eq_left hex] + have hs := hex.choose_spec + rcases lt_trichotomy hex.choose b with h | h | h + · have := measureResolvent_strictAnti μ hμ hs.1 h + linarith [hs.2] + · exact h + · have := measureResolvent_strictAnti μ hμ hb h + linarith [hs.2] + +theorem measureInverse_bounds (μ : Measure ℝ) [IsProbabilityMeasure μ] + {e x : ℝ} (hμ : ∀ᵐ y ∂μ, y ≤ e) (hx : 0 < x) : + e ≤ measureInverse μ e x ∧ measureInverse μ e x ≤ e + 1 / x := by + by_cases hex : ∃ b, e < b ∧ measureResolvent μ b = x + · rw [measureInverse, dite_eq_left hex] + have hs := hex.choose_spec + refine ⟨hs.1.le, ?_⟩ + have hu := measureResolvent_le μ hμ hs.1 + rw [hs.2] at hu + have hm := (le_div_iff₀ (sub_pos.mpr hs.1)).mp hu + have hd : hex.choose - e ≤ 1 / x := (le_div_iff₀ hx).mpr (by nlinarith) + linarith + · simp only [measureInverse, dite_eq_right hex, le_refl, true_and] + linarith [one_div_pos.mpr hx] + +theorem measureR_bounds (μ : Measure ℝ) [IsProbabilityMeasure μ] + {l e x : ℝ} (hμ : ∀ᵐ y ∂μ, y ∈ Icc l e) (hx : 0 < x) : + l ≤ measureR μ e x ∧ measureR μ e x ≤ e := by + have hu := measureInverse_bounds μ (hμ.mono fun _ h => h.2) hx + rw [measureR, ite_eq_left hx] + refine ⟨?_, by linarith [hu.2]⟩ + by_cases hex : ∃ b, e < b ∧ measureResolvent μ b = x + · rw [measureInverse, dite_eq_left hex] + have hs := hex.choose_spec + have hl := le_measureResolvent μ hμ hs.1 + rw [hs.2] at hl + obtain ⟨y, hy⟩ := hμ.exists + have hbl : 0 < hex.choose - l := by linarith [hy.1, hy.2, hs.1] + have hm := (div_le_iff₀ hbl).mp hl + have hd : 1 / x ≤ hex.choose - l := (div_le_iff₀ hx).mpr (by nlinarith) + linarith + · rw [measureInverse, dite_eq_right hex] + by_contra hbad + have hb : e < l + 1 / x := by linarith + have hl := le_measureResolvent μ hμ hb + have hv : x ≤ measureResolvent μ (l + 1 / x) := by simpa using hl + exact hex (exists_measureResolvent_solution μ (hμ.mono fun _ h => h.2) hb hx hv) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureSpectralContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureSpectralContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..9742e0e6baf9204da1e0396705fd585ddb7134e6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureSpectralContinuity.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureWeakResolvent + +namespace OAI + +/-! Spectral-transform continuity for compactly supported laws, including +the zero argument and the upper-edge branch. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical BoundedContinuousFunction + +namespace InvariantIsing + +theorem spectralMean_tendsto_weak + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (hweak : Tendsto μs atTop (𝓝 μ)) {K : ℝ} (hK : 0 ≤ K) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ∈ Icc (-K) K) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ∈ Icc (-K) K) : + Tendsto (fun k => ∫ y, y ∂(μs k : Measure ℝ)) atTop + (𝓝 (∫ y, y ∂(μ : Measure ℝ))) := by + let f : ℝ → ℝ := fun y => max (-K) (min K y) + have hf : Continuous f := continuous_const.max (continuous_const.min continuous_id) + have hb y : |f y| ≤ K := by + rw [abs_le] + exact ⟨le_max_left _ _, max_le (by linarith) (min_le_left _ _)⟩ + let F : ℝ →ᵇ ℝ := BoundedContinuousFunction.mkOfBound ⟨f, hf⟩ (2 * K) (by + intro y z + rw [Real.dist_eq] + exact (abs_sub _ _).trans ((add_le_add (hb y) (hb z)).trans_eq (by ring))) + have heq (ν : Measure ℝ) (hν : ∀ᵐ y ∂ν, y ∈ Icc (-K) K) : + (∫ y, F y ∂ν) = ∫ y, y ∂ν := by + apply integral_congr_ae + filter_upwards [hν] with y hy + change max (-K) (min K y) = y + rw [min_eq_right hy.2, max_eq_right hy.1] + have ht := (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hweak) F + rw [heq (μ : Measure ℝ) hμ] at ht + exact ht.congr' (Eventually.of_forall fun k => heq (μs k : Measure ℝ) (hs k)) + +theorem measureR_tendsto_weak_pos + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ≤ es k) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ≤ e) + (xs : ℕ → ℝ) {x : ℝ} (hxs : Tendsto xs atTop (𝓝 x)) (hx : 0 < x) : + Tendsto (fun k => measureR (μs k : Measure ℝ) (es k) (xs k)) atTop + (𝓝 (measureR (μ : Measure ℝ) e x)) := by + have hi := measureInverse_tendsto_weak μs μ es e hweak hedge hs hμ xs hxs hx + have hrecip : Tendsto (fun k => 1 / xs k) atTop (𝓝 (1 / x)) := + tendsto_const_nhds.div hxs hx.ne' + have ht : Tendsto + (fun k => measureInverse (μs k : Measure ℝ) (es k) (xs k) - 1 / xs k) + atTop (𝓝 (measureR (μ : Measure ℝ) e x)) := by + simpa only [measureR, ite_eq_left hx] using hi.sub hrecip + apply ht.congr' + filter_upwards [hxs.eventually (Ioi_mem_nhds hx)] with k hk + simp only [measureR, ite_eq_left (show 0 < xs k from hk)] + +theorem measureR_tendsto_weak_zero + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + {K : ℝ} (hK : 0 < K) (he : e ≤ K) (hes : ∀ k, es k ≤ K) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ∈ Icc (-K) (es k)) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ∈ Icc (-K) e) + (xs : ℕ → ℝ) (hxs : Tendsto xs atTop (𝓝 0)) : + Tendsto (fun k => measureR (μs k : Measure ℝ) (es k) (xs k)) atTop + (𝓝 (measureR (μ : Measure ℝ) e 0)) := by + have hm := spectralMean_tendsto_weak μs μ hweak hK.le + (fun k => (hs k).mono fun y hy => ⟨hy.1, hy.2.trans (hes k)⟩) + (hμ.mono fun y hy => ⟨hy.1, hy.2.trans he⟩) + have herr : ∀ᶠ k in atTop, + ‖measureR (μs k : Measure ℝ) (es k) (xs k) - ∫ y, y ∂(μs k : Measure ℝ)‖ ≤ + 8 * K ^ 2 * |xs k| := by + filter_upwards [hxs.eventually (Iio_mem_nhds + (show (0 : ℝ) < 1 / (4 * K) by positivity))] with k hk + by_cases hxk : 0 < xs k + · have hsmall : 4 * K * xs k ≤ 1 := by + have := (lt_div_iff₀ (show (0 : ℝ) < 4 * K by positivity)).mp hk + nlinarith + have hb := measureR_sub_mean_bound (μs k : Measure ℝ) hK (hes k) (hs k) hxk hsmall + simpa only [Real.norm_eq_abs, abs_of_nonneg hb.1, abs_of_pos hxk] using hb.2 + · simp only [measureR, ite_eq_right hxk, sub_self, norm_zero] + positivity + have hb : Tendsto (fun k => 8 * K ^ 2 * |xs k|) atTop (𝓝 0) := by + simpa using hxs.abs.const_mul (8 * K ^ 2) + have ht := (squeeze_zero_norm' herr hb).add hm + simpa only [sub_add_cancel, zero_add, measureR, lt_self_iff_false, ite_false] using ht + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureVariationalContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureVariationalContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1469b314233cdbc609b4842001c521daba5162a2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureVariationalContinuity.lean @@ -0,0 +1,116 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureSpectralContinuity + +namespace OAI + +/-! Uniform transform convergence and continuity of the variational value +for the compact spectral laws in manuscript Lemma `gen:R-continuity`. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical + +namespace InvariantIsing + +theorem measureR_tendsto_weak_nonneg + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + {K : ℝ} (hK : 0 < K) (he : e ≤ K) (hes : ∀ k, es k ≤ K) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ∈ Icc (-K) (es k)) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ∈ Icc (-K) e) + (xs : ℕ → ℝ) {x : ℝ} (hxs : Tendsto xs atTop (𝓝 x)) (hx : 0 ≤ x) : + Tendsto (fun k => measureR (μs k : Measure ℝ) (es k) (xs k)) atTop + (𝓝 (measureR (μ : Measure ℝ) e x)) := by + rcases hx.eq_or_lt with hx | hx + · subst x + exact measureR_tendsto_weak_zero μs μ es e hweak hK he hes hs hμ xs hxs + · exact measureR_tendsto_weak_pos μs μ es e hweak hedge + (fun k => (hs k).mono fun _ h => h.2) (hμ.mono fun _ h => h.2) xs hxs hx + +theorem measureR_uniform_weak + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + {K : ℝ} (hK : 0 < K) (he : e ≤ K) (hes : ∀ k, es k ≤ K) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ∈ Icc (-K) (es k)) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ∈ Icc (-K) e) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, ∀ x ∈ Icc (0 : ℝ) 1, + |measureR (μs k : Measure ℝ) (es k) x - measureR (μ : Measure ℝ) e x| < ε := by + intro ε hε + by_contra hbad + have hbad' : ∃ᶠ k in atTop, ∃ x ∈ Icc (0 : ℝ) 1, + ε ≤ |measureR (μs k : Measure ℝ) (es k) x - measureR (μ : Measure ℝ) e x| := by + simpa only [Filter.not_eventually, not_forall, not_imp, not_lt, exists_prop] using hbad + obtain ⟨φ, hφ, hφbad⟩ := extraction_of_frequently_atTop hbad' + choose xs hxs herr using hφbad + obtain ⟨x, hx, ψ, hψ, hlim⟩ := isCompact_Icc.tendsto_subseq hxs + have hR := measureR_tendsto_weak_nonneg (fun k => μs (φ (ψ k))) μ + (fun k => es (φ (ψ k))) e (hweak.comp (hφ.comp hψ).tendsto_atTop) + (hedge.comp (hφ.comp hψ).tendsto_atTop) hK he (fun k => hes (φ (ψ k))) + (fun k => hs (φ (ψ k))) hμ (fun k => xs (ψ k)) hlim hx.1 + have hfixed := (continuous_measureR (μ : Measure ℝ) hK he hμ).continuousAt.tendsto.comp hlim + have hzero : Tendsto (fun k => + |measureR (μs (φ (ψ k)) : Measure ℝ) (es (φ (ψ k))) (xs (ψ k)) - + measureR (μ : Measure ℝ) e (xs (ψ k))|) atTop (𝓝 0) := by + simpa only [Function.comp_apply, sub_self, abs_zero] using (hR.sub hfixed).abs + obtain ⟨k, hk⟩ := (hzero.eventually (Iio_mem_nhds hε)).exists + exact (not_le_of_gt hk) (herr (ψ k)) + +theorem measureVariational_ne_top_bot (μ : Measure ℝ) [IsProbabilityMeasure μ] + {K e : ℝ} (hK : 0 < K) (he : e ≤ K) (hμ : ∀ᵐ y ∂μ, y ∈ Icc (-K) e) : + variationalFunctional (measureR μ e) ≠ ⊤ ∧ variationalFunctional (measureR μ e) ≠ ⊥ := by + have hR := continuous_measureR μ hK he hμ + have hb x : |measureR μ e x - 0| ≤ K := by + have h := measureR_bounds_all μ hμ x + rw [sub_zero, abs_le] + exact ⟨h.1, h.2.trans he⟩ + have hspec p : |spectralFunctional (measureR μ e) p| ≤ K / 2 := by + simpa only [spectralFunctional_constant, zero_div, sub_zero] using + abs_spectralFunctional_sub_le (measureR μ e) (fun _ => 0) hR continuous_const + K (fun x _ => hb x) p + have hupper : variationalFunctional (measureR μ e) ≤ (K / 2 : ℝ) := by + let p := constantPath 0 (by constructor <;> norm_num) + have hi := iInf_le (fun p : OverlapPath => entropyFunctional p + + (spectralFunctional (measureR μ e) p : EReal)) p + simp only [p, entropyFunctional_zero, zero_add] at hi + exact hi.trans (by exact_mod_cast (abs_le.mp (hspec p)).2) + have hlower : ((-(K / 2) : ℝ) : EReal) ≤ variationalFunctional (measureR μ e) := by + apply le_iInf + intro p + have hl : ((-(K / 2) : ℝ) : EReal) ≤ (spectralFunctional (measureR μ e) p : EReal) := by + exact_mod_cast (abs_le.mp (hspec p)).1 + have hnonneg := add_le_add (entropyFunctional_nonneg p) + (le_rfl : (spectralFunctional (measureR μ e) p : EReal) ≤ _) + exact hl.trans (by simpa only [zero_add] using hnonneg) + exact ⟨ne_top_of_le_ne_top (EReal.coe_ne_top _) hupper, + ne_bot_of_le_ne_bot (EReal.coe_ne_bot _) hlower⟩ + +theorem measureVariational_tendsto_weak + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + {K : ℝ} (hK : 0 < K) (he : e ≤ K) (hes : ∀ k, es k ≤ K) + (hs : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ∈ Icc (-K) (es k)) + (hμ : ∀ᵐ y ∂(μ : Measure ℝ), y ∈ Icc (-K) e) : + Tendsto (fun k => (variationalFunctional (measureR (μs k : Measure ℝ) (es k))).toReal) + atTop (𝓝 (variationalFunctional (measureR (μ : Measure ℝ) e)).toReal) := by + have hf := measureVariational_ne_top_bot (μ : Measure ℝ) hK he hμ + have hR := continuous_measureR (μ : Measure ℝ) hK he hμ + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [measureR_uniform_weak μs μ es e hweak hedge hK he hes hs hμ ε hε] with k hk + have hfk := measureVariational_ne_top_bot (μs k : Measure ℝ) hK (hes k) (hs k) + have hRk := continuous_measureR (μs k : Measure ℝ) hK (hes k) (hs k) + have hl := variationalFunctional_le_add _ _ hRk hR ε (fun x hx => (hk x hx).le) + have hr := variationalFunctional_le_add _ _ hR hRk ε + (fun x hx => by simpa only [abs_sub_comm] using (hk x hx).le) + rw [← EReal.coe_toReal hfk.1 hfk.2, ← EReal.coe_toReal hf.1 hf.2, + ← EReal.coe_add, EReal.coe_le_coe_iff] at hl hr + rw [Real.dist_eq, abs_lt] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/MeasureWeakResolvent.lean b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureWeakResolvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..ddac667fc0b890e0dbb79e7999b2cf96ce723e72 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/MeasureWeakResolvent.lean @@ -0,0 +1,100 @@ +import OAI.Probability.InvariantIsing.Spectral.MeasureRBounds + +namespace OAI + +/-! Resolvent continuity under weak convergence and convergence of upper +edges. Bounded continuous test functions avoid the pole outside the supports. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical BoundedContinuousFunction + +namespace InvariantIsing + +theorem measureResolvent_tendsto_weak + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + (hsupport : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ≤ es k) + (hsupport0 : ∀ᵐ y ∂(μ : Measure ℝ), y ≤ e) + {b : ℝ} (hb : e < b) : + Tendsto (fun k => measureResolvent (μs k : Measure ℝ) b) atTop + (𝓝 (measureResolvent (μ : Measure ℝ) b)) := by + let c := (e + b) / 2 + let d := b - c + have hec : e < c := by dsimp only [c]; linarith + have hcb : c < b := by dsimp only [c]; linarith + have hd : 0 < d := sub_pos.mpr hcb + let f : ℝ → ℝ := fun y => 1 / max d (b - y) + have hf : Continuous f := continuous_const.div + (continuous_const.max (continuous_const.sub continuous_id)) + (fun y => ne_of_gt (hd.trans_le (le_max_left _ _))) + have hfb y : |f y| ≤ 1 / d := by + dsimp only [f] + rw [abs_of_pos (one_div_pos.mpr (hd.trans_le (le_max_left _ _)))] + exact one_div_le_one_div_of_le hd (le_max_left _ _) + let F : ℝ →ᵇ ℝ := BoundedContinuousFunction.mkOfBound ⟨f, hf⟩ (2 / d) (by + intro y z + rw [Real.dist_eq] + calc + |f y - f z| ≤ |f y| + |f z| := abs_sub _ _ + _ ≤ 1 / d + 1 / d := add_le_add (hfb y) (hfb z) + _ = 2 / d := by ring) + have heq (ν : Measure ℝ) (hν : ∀ᵐ y ∂ν, y ≤ c) : + (∫ y, F y ∂ν) = measureResolvent ν b := by + apply integral_congr_ae + filter_upwards [hν] with y hy + change 1 / max d (b - y) = 1 / (b - y) + rw [max_eq_right (by dsimp only [d]; linarith)] + have ht := (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hweak) F + rw [heq (μ : Measure ℝ) (hsupport0.mono fun y hy => hy.trans hec.le)] at ht + apply ht.congr' + filter_upwards [hedge.eventually (Iio_mem_nhds hec)] with k hk + exact heq (μs k : Measure ℝ) ((hsupport k).mono fun y hy => hy.trans hk.le) + +theorem measureInverse_tendsto_weak + (μs : ℕ → ProbabilityMeasure ℝ) (μ : ProbabilityMeasure ℝ) + (es : ℕ → ℝ) (e : ℝ) (hweak : Tendsto μs atTop (𝓝 μ)) + (hedge : Tendsto es atTop (𝓝 e)) + (hsupport : ∀ k, ∀ᵐ y ∂(μs k : Measure ℝ), y ≤ es k) + (hsupport0 : ∀ᵐ y ∂(μ : Measure ℝ), y ≤ e) + (xs : ℕ → ℝ) {x : ℝ} (hxs : Tendsto xs atTop (𝓝 x)) (hx : 0 < x) : + Tendsto (fun k => measureInverse (μs k : Measure ℝ) (es k) (xs k)) atTop + (𝓝 (measureInverse (μ : Measure ℝ) e x)) := by + have hbound := (measureInverse_bounds (μ : Measure ℝ) hsupport0 hx).1 + have hxp : ∀ᶠ k in atTop, 0 < xs k := hxs.eventually (Ioi_mem_nhds hx) + apply tendsto_order.2 + constructor + · intro l hl + by_cases hle : l < e + · filter_upwards [hxp, hedge.eventually (Ioi_mem_nhds hle)] with k hk hek + exact hek.trans_le (measureInverse_bounds (μs k : Measure ℝ) (hsupport k) hk).1 + · let c := (l + measureInverse (μ : Measure ℝ) e x) / 2 + have hec : e < c := by dsimp only [c]; linarith [le_of_not_gt hle] + have hlc : l < c := by dsimp only [c]; linarith + have hci : c < measureInverse (μ : Measure ℝ) e x := by dsimp only [c]; linarith + have hR : x < measureResolvent (μ : Measure ℝ) c := by + by_contra hnot + exact (not_le_of_gt hci) + ((measureInverse_le_iff (μ : Measure ℝ) hsupport0 hx hec).mpr (le_of_not_gt hnot)) + have hRc := measureResolvent_tendsto_weak μs μ es e hweak hedge hsupport hsupport0 hec + filter_upwards [hxp, hedge.eventually (Iio_mem_nhds hec), hxs.eventually_lt hRc hR] + with k hk hek hRk + apply hlc.trans + apply lt_of_not_ge + intro hnot + exact (not_le_of_gt hRk) + ((measureInverse_le_iff (μs k : Measure ℝ) (hsupport k) hk hek).mp hnot) + · intro u hu + have heu : e < u := hbound.trans_lt hu + have hR := (measureInverse_lt_iff (μ : Measure ℝ) hsupport0 hx heu).mp hu + have hRu := measureResolvent_tendsto_weak μs μ es e hweak hedge hsupport hsupport0 heu + filter_upwards [hxp, hedge.eventually (Iio_mem_nhds heu), hRu.eventually_lt hxs hR] + with k hk hek hRk + exact (measureInverse_lt_iff (μs k : Measure ℝ) (hsupport k) hk hek).mpr hRk + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveRankOneInverse.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveRankOneInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee4e25f371713faf5b54f1a0464e0acf8673edde --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveRankOneInverse.lean @@ -0,0 +1,49 @@ +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolvent + +namespace OAI + +/-! The positive rank-one inverse identity used by the Gaussian leave-one-column resolvent. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +lemma positive_rankOne_inverse {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.PosDef) + (x : Fin N → ℝ) : + (A+vecMulVec x x)⁻¹ = A⁻¹-(1+x ⬝ᵥ (A⁻¹ *ᵥ x))⁻¹ • + vecMulVec (A⁻¹ *ᵥ x) (A⁻¹ *ᵥ x) := by + let R := A⁻¹ + let u := R *ᵥ x + let q := x ⬝ᵥ u + have hq : 0 < 1+q := by + have h := hA.inv.posSemidef.dotProduct_mulVec_nonneg x + simp only [star_trivial] at h + change 0 ≤ q at h + linarith + have hR : Rᵀ = R := by + simpa only [R,Matrix.IsHermitian,Matrix.conjTranspose_eq_transpose_of_trivial] using hA.inv.isHermitian + have hxR : x ᵥ* R = u := by + calc + _ = x ᵥ* Rᵀ := congrArg (fun M => x ᵥ* M) hR.symm + _ = _ := Matrix.vecMul_transpose R x + have hAR : A*R = 1 := Matrix.mul_nonsing_inv A (isUnit_iff_ne_zero.mpr hA.det_pos.ne') + have hAx : A *ᵥ u = x := by + change A *ᵥ (R *ᵥ x) = x + rw [Matrix.mulVec_mulVec,hAR,Matrix.one_mulVec] + have h₁ : (A+vecMulVec x x)*R = 1+vecMulVec x u := by + rw [add_mul,hAR,Matrix.vecMulVec_mul,hxR] + have h₂ : (A+vecMulVec x x)*vecMulVec u u = (1+q) • vecMulVec x u := by + rw [add_mul,Matrix.mul_vecMulVec,hAx,Matrix.vecMulVec_mul_vecMulVec,Matrix.vecMulVec_smul] + ext i j + simp only [Matrix.add_apply,Matrix.smul_apply,Matrix.vecMulVec_apply,smul_eq_mul] + dsimp only [q] + ring + apply Matrix.inv_eq_right_inv + change (A+vecMulVec x x)*(R-(1+q)⁻¹ • vecMulVec u u) = 1 + rw [mul_sub,mul_smul_comm,h₁,h₂,smul_smul,inv_mul_cancel₀ hq.ne',one_smul] + exact add_sub_cancel_right 1 (vecMulVec x u) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveRankOneQuadratic.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveRankOneQuadratic.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb40b2d310c1804a4c9e8d511f189164d99bfce2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveRankOneQuadratic.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveRankOneInverse + +namespace OAI + +/-! The exact quadratic and trace increments of a positive rank-one resolvent update. -/ +noncomputable section +open Matrix +namespace InvariantIsing + +lemma positive_rankOne_quadratic {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.PosDef) + (x : Fin N → ℝ) : + x ⬝ᵥ ((A+vecMulVec x x)⁻¹ *ᵥ x) = (x ⬝ᵥ (A⁻¹ *ᵥ x))/(1+x ⬝ᵥ (A⁻¹ *ᵥ x)) := by + let u := A⁻¹ *ᵥ x + let q := x ⬝ᵥ u + have hq : 0 < 1+q := by + have hh := hA.inv.posSemidef.dotProduct_mulVec_nonneg x + simp only [star_trivial] at hh + change 0 ≤ q at hh + linarith + have hh : vecMulVec u u *ᵥ x = q • u := by + ext i + simp only [Matrix.mulVec,Matrix.vecMulVec_apply,dotProduct,Pi.smul_apply,smul_eq_mul] + dsimp only [q] + simp only [dotProduct] + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro j _ + ring + rw [positive_rankOne_inverse A hA x,Matrix.sub_mulVec,Matrix.smul_mulVec] + change x ⬝ᵥ (u-(1+q)⁻¹ • (vecMulVec u u *ᵥ x)) = q/(1+q) + rw [hh,dotProduct_sub,dotProduct_smul,dotProduct_smul] + change q-(1+q)⁻¹*(q*q) = q/(1+q) + field_simp [hq.ne'] + ring + +lemma positive_rankOne_trace_difference {N : ℕ} (A : Matrix (Fin N) (Fin N) ℝ) (hA : A.PosDef) + (x : Fin N → ℝ) : + A⁻¹.trace-(A+vecMulVec x x)⁻¹.trace = + ((A⁻¹ *ᵥ x) ⬝ᵥ (A⁻¹ *ᵥ x))/(1+x ⬝ᵥ (A⁻¹ *ᵥ x)) := by + rw [positive_rankOne_inverse A hA x,Matrix.trace_sub,Matrix.trace_smul,Matrix.trace_vecMulVec] + simp only [smul_eq_mul] + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventBounds.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..e771d988230965dbe96779075cd26d89d984e292 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventBounds.lean @@ -0,0 +1,63 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventSpectrum + +namespace OAI + +/-! Uniform trace and quadratic bounds for positive resolvents. -/ +noncomputable section +open Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +lemma positiveResolvent_trace_le {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : + (positiveResolvent t B).trace ≤ (N : ℝ)/t := by + have he := (positiveResolvent_posDef ht hB).isHermitian.trace_eq_sum_eigenvalues + simp only [RCLike.ofReal_real_eq_id,id_eq] at he + rw [he] + calc + _ ≤ ∑ _ : Fin N, 1/t := Finset.sum_le_sum (fun i _ => (positiveResolvent_eigenvalues ht hB i).2) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul]; ring + +lemma positiveResolvent_quadratic_le {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) (x : EuclideanSpace ℝ (Fin N)) : + gaussianQuadraticForm (positiveResolvent t B) x ≤ ‖x‖^2/t := by + let hR := (positiveResolvent_posDef ht hB).isHermitian + rw [gaussianQuadraticForm,hermitian_quadratic_coordinates _ hR] + calc + _ ≤ ∑ i, (1/t)*(hR.eigenvectorBasis.repr x i)^2 := + Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_right + (positiveResolvent_eigenvalues ht hB i).2 (sq_nonneg _)) + _ = (1/t)*‖hR.eigenvectorBasis.repr x‖^2 := by + rw [EuclideanSpace.real_norm_sq_eq,Finset.mul_sum] + _ = _ := by rw [LinearIsometryEquiv.norm_map]; ring + +lemma positiveResolvent_quadratic_nonneg {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) (x : EuclideanSpace ℝ (Fin N)) : + 0 ≤ gaussianQuadraticForm (positiveResolvent t B) x := by + rw [gaussianQuadraticForm,EuclideanSpace.inner_eq_star_dotProduct] + simp only [star_trivial] + rw [dotProduct_comm] + exact (positiveResolvent_posDef ht hB).posSemidef.dotProduct_mulVec_nonneg x.ofLp + +lemma positiveResolvent_normalized_abs_bound {N : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) (x : EuclideanSpace ℝ (Fin N)) : + |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x- + (positiveResolvent t B).trace/N| ≤ (1/((N : ℝ)*t))*‖x‖^2+1/t := by + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hq := positiveResolvent_quadratic_nonneg ht hB x + have htr := (positiveResolvent_posDef ht hB).posSemidef.trace_nonneg + calc + _ ≤ |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x|+ + |(positiveResolvent t B).trace/N| := abs_sub _ _ + _ = (1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x+ + (positiveResolvent t B).trace/N := by rw [abs_of_nonneg (by positivity),abs_of_nonneg (by positivity)] + _ ≤ (1/(N : ℝ))*(‖x‖^2/t)+((N : ℝ)/t)/N := add_le_add + (mul_le_mul_of_nonneg_left (positiveResolvent_quadratic_le ht hB x) (by positivity)) + (div_le_div_of_nonneg_right (positiveResolvent_trace_le ht hB) hn.le) + _ = _ := by field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventContraction.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..406489f773e29e3ea1b096012a3d0c1cd5753456 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventContraction.lean @@ -0,0 +1,36 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventSpectrum + +namespace OAI + +/-! A dimension-free quadratic contraction for positive resolvents. -/ +noncomputable section +open Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma positiveResolvent_quadratic_contraction {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) (x : Fin N → ℝ) : + t*((positiveResolvent t B *ᵥ x) ⬝ᵥ (positiveResolvent t B *ᵥ x)) ≤ + x ⬝ᵥ (positiveResolvent t B *ᵥ x) := by + let y := positiveResolvent t B *ᵥ x + have hinv : (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B)*positiveResolvent t B = 1 := + Matrix.mul_nonsing_inv _ (isUnit_iff_ne_zero.mpr + (((Matrix.PosDef.one.smul ht).add_posSemidef hB).det_pos.ne')) + have hy : (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B) *ᵥ y = x := by + change (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B) *ᵥ (positiveResolvent t B *ᵥ x) = x + rw [Matrix.mulVec_mulVec,hinv,Matrix.one_mulVec] + have hp : 0 ≤ y ⬝ᵥ (B *ᵥ y) := by + simpa only [star_trivial] using hB.dotProduct_mulVec_nonneg y + have hh := congrArg (fun z => y ⬝ᵥ z) hy + rw [Matrix.add_mulVec,Matrix.smul_mulVec,Matrix.one_mulVec, + dotProduct_add,dotProduct_smul] at hh + simp only [smul_eq_mul] at hh + rw [dotProduct_comm x y] + change t*(y ⬝ᵥ y) ≤ y ⬝ᵥ x + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventEigenbasis.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventEigenbasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b5ff10aa7cc6baa0b74d9354329fddaf65922ae --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventEigenbasis.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventSpectrum +import Mathlib.Analysis.InnerProductSpace.Trace + +namespace OAI + +/-! The positive resolvent in the eigenbasis of the original positive matrix. -/ +noncomputable section +open Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +lemma positiveResolvent_eigenvector {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) (i : Fin N) : + (positiveResolvent t B).toEuclideanLin (hB.isHermitian.eigenvectorBasis i) = + (t+hB.isHermitian.eigenvalues i)⁻¹ • hB.isHermitian.eigenvectorBasis i := by + let u := (hB.isHermitian.eigenvectorBasis i).ofLp + let a := hB.isHermitian.eigenvalues i + have ha : 0 < t+a := add_pos_of_pos_of_nonneg ht (hB.eigenvalues_nonneg i) + have hBu : B *ᵥ u = a • u := hB.isHermitian.mulVec_eigenvectorBasis i + have hAu : (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B) *ᵥ u = (t+a) • u := by + rw [Matrix.add_mulVec,Matrix.smul_mulVec,Matrix.one_mulVec,hBu,add_smul] + have hinv : positiveResolvent t B*(t • (1 : Matrix (Fin N) (Fin N) ℝ)+B) = 1 := + Matrix.nonsing_inv_mul _ (isUnit_iff_ne_zero.mpr + (((Matrix.PosDef.one.smul ht).add_posSemidef hB).det_pos.ne')) + have hh : (t+a) • (positiveResolvent t B *ᵥ u) = u := by + rw [← Matrix.mulVec_smul,← hAu,Matrix.mulVec_mulVec,hinv,Matrix.one_mulVec] + have hu : positiveResolvent t B *ᵥ u = (t+a)⁻¹ • u := by + calc + _ = (t+a)⁻¹ • ((t+a) • (positiveResolvent t B *ᵥ u)) := by + rw [smul_smul,inv_mul_cancel₀ ha.ne',one_smul] + _ = _ := by rw [hh] + ext j + exact congrFun hu j + +lemma positiveResolvent_trace_eigenvalues {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : + (positiveResolvent t B).trace = ∑ i, (t+hB.isHermitian.eigenvalues i)⁻¹ := by + have htr := LinearMap.trace_eq_sum_inner (positiveResolvent t B).toEuclideanLin hB.isHermitian.eigenvectorBasis + rw [Matrix.toEuclideanLin_eq_toLin_orthonormal,Matrix.trace_toLin_eq] at htr + rw [htr] + apply Finset.sum_congr rfl + intro i _ + rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] + rw [positiveResolvent_eigenvector ht hB,real_inner_smul_right,real_inner_self_eq_norm_sq] + simp only [hB.isHermitian.eigenvectorBasis.orthonormal.1 i,one_pow,mul_one] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventFluctuation.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventFluctuation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5d2529f40ee827696c99f23d8b809aefbc21495 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventFluctuation.lean @@ -0,0 +1,32 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventVariance +import OAI.Probability.InvariantIsing.Magnetic.RestrictedPressureFluctuation + +namespace OAI + +/-! Uniform Gaussian mean absolute fluctuations of a normalized resolvent quadratic form. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +namespace InvariantIsing + +lemma positiveResolvent_normalized_mean {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : + (∫ x, (1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x ∂stdGaussian _) = + (positiveResolvent t B).trace / N := by + rw [integral_const_mul,hermitianGaussianQuadratic_mean _ (positiveResolvent_posDef ht hB).isHermitian] + ring + +lemma positiveResolvent_normalized_fluctuation {N : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : + (∫ x, |(1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x- + (positiveResolvent t B).trace / N| ∂stdGaussian _) ≤ Real.sqrt (2/((N : ℝ)*t^2)) := by + have hf := (gaussianQuadraticForm_memLp (positiveResolvent t B)).const_mul (1/(N : ℝ)) + have h := integral_abs_sub_mean_le_sqrt_variance (stdGaussian _) + (fun x => (1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x) hf + rw [positiveResolvent_normalized_mean ht hB] at h + exact h.trans (Real.sqrt_le_sqrt (positiveResolvent_normalized_variance hN ht hB)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventSpectrum.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a891e1d07c2f6d7381bb487b97674b46fc1522c8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventSpectrum.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Gaussian.HermitianGaussianQuadratic +import OAI.Probability.InvariantIsing.Gaussian.GaussianGramResolvent + +namespace OAI + +/-! Spectral bounds for the positive resolvents occurring after deletion of a column. -/ +noncomputable section +open Matrix +open scoped BigOperators RealInnerProductSpace +namespace InvariantIsing + +def positiveResolvent {N : ℕ} (t : ℝ) (B : Matrix (Fin N) (Fin N) ℝ) : Matrix (Fin N) (Fin N) ℝ := + (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B)⁻¹ + +lemma positiveResolvent_posDef {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : (positiveResolvent t B).PosDef := + ((Matrix.PosDef.one.smul ht).add_posSemidef hB).inv + +lemma positiveResolvent_eigenvalues {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) (i : Fin N) : + 0 ≤ (positiveResolvent_posDef ht hB).isHermitian.eigenvalues i ∧ + (positiveResolvent_posDef ht hB).isHermitian.eigenvalues i ≤ 1/t := by + let R := positiveResolvent t B + let hR : R.PosDef := positiveResolvent_posDef ht hB + let u := hR.isHermitian.eigenvectorBasis i + let a := hR.isHermitian.eigenvalues i + have hu : u.ofLp ⬝ᵥ u.ofLp = 1 := by + change ⟪u,u⟫ = 1 + rw [real_inner_self_eq_norm_sq] + simp only [u,hR.isHermitian.eigenvectorBasis.orthonormal.1 i,one_pow] + have ha : 0 ≤ a := by + dsimp only [a] + rw [hR.isHermitian.eigenvalues_eq] + simpa only [star_trivial,RCLike.re_to_real] using hR.posSemidef.dotProduct_mulVec_nonneg u.ofLp + have hq : 0 ≤ u.ofLp ⬝ᵥ (B *ᵥ u.ofLp) := by + simpa only [star_trivial] using hB.dotProduct_mulVec_nonneg u.ofLp + have hinv : (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B)*R = 1 := + Matrix.mul_nonsing_inv _ (isUnit_iff_ne_zero.mpr + (((Matrix.PosDef.one.smul ht).add_posSemidef hB).det_pos.ne')) + have heig : R *ᵥ u.ofLp = a • u.ofLp := hR.isHermitian.mulVec_eigenvectorBasis i + have hh : (t • (1 : Matrix (Fin N) (Fin N) ℝ)+B) *ᵥ (R *ᵥ u.ofLp) = u.ofLp := by + rw [Matrix.mulVec_mulVec,hinv,Matrix.one_mulVec] + rw [heig,Matrix.mulVec_smul,Matrix.add_mulVec,Matrix.smul_mulVec,Matrix.one_mulVec] at hh + have hd := congrArg (fun y => u.ofLp ⬝ᵥ y) hh + rw [dotProduct_smul,dotProduct_add,dotProduct_smul,hu] at hd + simp only [smul_eq_mul,mul_one] at hd + constructor + · exact ha + · apply (le_div_iff₀ ht).mpr + nlinarith [mul_nonneg ha hq] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventVariance.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventVariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..e077ce29320e26d5eee0ab12059714fa50ec085b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveResolventVariance.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveResolventSpectrum + +namespace OAI + +/-! The dimension-explicit Gaussian quadratic variance bound for a positive resolvent. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Matrix +open scoped BigOperators +namespace InvariantIsing + +lemma positiveResolvent_quadratic_variance {N : ℕ} {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : + variance (gaussianQuadraticForm (positiveResolvent t B)) (stdGaussian _) ≤ 2*N/t^2 := by + rw [hermitianGaussianQuadratic_variance _ (positiveResolvent_posDef ht hB).isHermitian] + have hs : (∑ i, ((positiveResolvent_posDef ht hB).isHermitian.eigenvalues i)^2) ≤ + (N : ℝ)*(1/t)^2 := by + calc + _ ≤ ∑ _ : Fin N, (1/t)^2 := Finset.sum_le_sum (fun i _ => + (sq_le_sq₀ (positiveResolvent_eigenvalues ht hB i).1 (by positivity)).2 + (positiveResolvent_eigenvalues ht hB i).2) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] + calc + _ ≤ 2*((N : ℝ)*(1/t)^2) := mul_le_mul_of_nonneg_left hs (by norm_num) + _ = _ := by ring + +lemma positiveResolvent_normalized_variance {N : ℕ} (hN : 0 < N) {t : ℝ} (ht : 0 < t) + {B : Matrix (Fin N) (Fin N) ℝ} (hB : B.PosSemidef) : + variance (fun x => (1/(N : ℝ))*gaussianQuadraticForm (positiveResolvent t B) x) (stdGaussian _) ≤ + 2/((N : ℝ)*t^2) := by + rw [variance_const_mul] + have h := mul_le_mul_of_nonneg_left (positiveResolvent_quadratic_variance ht hB) (sq_nonneg (1/(N : ℝ))) + apply h.trans_eq + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + field_simp [hn] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralLabels.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d146eb1cff8681fe86dbec3c8f35d16920bdb48 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralLabels.lean @@ -0,0 +1,86 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralLabelCounts +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralMeasure + +namespace OAI + +/-! Remove zero limiting weights without dropping their finite-volume labels. -/ + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology Classical BigOperators + +namespace InvariantIsing + +def positiveSpectralLabel {ι : Type*} (w : ι → ℝ) (fallback : {i // 0 < w i}) + (i : ι) : {i // 0 < w i} := if h : 0 < w i then ⟨i,h⟩ else fallback + +lemma positiveSpectralLabel_self {ι : Type*} (w : ι → ℝ) + (fallback i : {i // 0 < w i}) : positiveSpectralLabel w fallback i=i := by + simp only [positiveSpectralLabel, dite_eq_left i.property] + +lemma positiveSpectralWeights_sum {ι : Type*} [Fintype ι] + (w : ι → ℝ) (hw : ∀ i, 0 ≤ w i) (hsum : ∑ i, w i=1) : + ∑ i : {i // 0 < w i}, w i=1 := by + have hz : (∑ i : {i // ¬0 < w i}, w i)=0 := Finset.sum_eq_zero fun i _ => + le_antisymm (le_of_not_gt i.property) (hw i) + have hh := Fintype.sum_subtype_add_sum_subtype (fun i => 0 < w i) w + rw [hz,add_zero,hsum] at hh + exact hh + +lemma positiveSpectralLabel_weight {ι : Type*} [Fintype ι] + (w : ι → ℝ) (hw : ∀ i, 0 ≤ w i) (fallback b : {i // 0 < w i}) : + (∑ a : {a // positiveSpectralLabel w fallback a=b}, w a)=w b := by + rw [← Finset.sum_subtype (Finset.univ.filter (fun a => positiveSpectralLabel w fallback a=b)) + (by simp) w] + apply Finset.sum_eq_single b.val + · intro a ha hab + by_cases hp : 0 < w a + · have hh : positiveSpectralLabel w fallback a=b := (Finset.mem_filter.mp ha).2 + have he : a=b.val := by + simpa only [positiveSpectralLabel,dite_eq_left hp] using congrArg Subtype.val hh + exact (hab he).elim + · exact le_antisymm (le_of_not_gt hp) (hw a) + · intro hb + exact (hb (by simp [positiveSpectralLabel_self])).elim + +lemma positive_spectral_counts_tendsto {ι : Type*} [Fintype ι] + (N : ℕ → ℕ) (g : (k : ℕ) → Fin (N k) → ι) + (w : ι → ℝ) (hw : ∀ i, 0 ≤ w i) (fallback : {i // 0 < w i}) + (hlim : Tendsto (fun k a => (spectralLabelCount (g k) a : ℝ)/N k) atTop (𝓝 w)) : + Tendsto (fun k b => + (spectralLabelCount (positiveSpectralLabel w fallback ∘ g k) b : ℝ)/N k) + atTop (𝓝 (fun b : {i // 0 < w i} => w b)) := by + apply tendsto_pi_nhds.mpr + intro b + have hh := (tendsto_pi_nhds.mp + (spectral_label_counts_relabel N g w hlim (positiveSpectralLabel w fallback))) b + convert hh using 1 + apply congrArg nhds + calc + w b = ∑ a : {a // positiveSpectralLabel w fallback a=b}, w a := + (positiveSpectralLabel_weight w hw fallback b).symm + _ = _ := by + apply Finset.sum_congr + · ext a + simp only [Finset.mem_univ] + · intro a _ + rfl + +lemma finiteSpectralMeasure_positive {ι : Type*} [Fintype ι] + (w lam : ι → ℝ) (hw : ∀ i, 0 ≤ w i) : + finiteSpectralMeasure (fun i : {i // 0 < w i} => w i) (fun i => lam i)= + finiteSpectralMeasure w lam := by + simp only [finiteSpectralMeasure,Measure.sum_fintype] + apply Fintype.sum_of_injective Subtype.val Subtype.val_injective + · intro i hi + have hp : ¬0 < w i := fun hp => hi ⟨⟨i,hp⟩,rfl⟩ + have hz : w i=0 := le_antisymm (le_of_not_gt hp) (hw i) + simp only [hz,ENNReal.ofReal_zero,zero_smul] + · intro i + rfl + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralPartition.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd63324ece2d967757866d7d940e4f402dcefdab --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralPartition.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveSpectralLabels +import OAI.Probability.InvariantIsing.Spectral.SpectralPartitionLaw +import Mathlib.MeasureTheory.Measure.Support + +namespace OAI + +/-! Positive-mass cells carry the same spectral law as the original partition. -/ + +noncomputable section +open MeasureTheory Set Filter +open scoped Topology Classical BigOperators Function + +namespace InvariantIsing + +lemma ae_spectralPartitionIndex_pos {ι : Type*} [Fintype ι] + (μ : Measure ℝ) [IsProbabilityMeasure μ] (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) : + ∀ᵐ x ∂μ, 0 < μ.real (S (spectralPartitionIndex S hcover x)) := by + have hi (i : ι) : ∀ᵐ x ∂μ, x∈S i → 0 < μ.real (S i) := by + by_cases hp : 0 < μ.real (S i) + · exact Filter.Eventually.of_forall (fun _ _ => hp) + · have hz : μ (S i)=0 := (measureReal_eq_zero_iff).mp + (le_antisymm (le_of_not_gt hp) measureReal_nonneg) + filter_upwards [compl_mem_ae_iff.mpr hz] with x hx + exact fun h => (hx h).elim + filter_upwards [ae_all_iff.mpr hi] with x hx + exact hx _ (spectralPartitionIndex_mem S hcover x) + +lemma positive_spectral_partition_map {ι : Type*} [Fintype ι] + (μ : Measure ℝ) [IsProbabilityMeasure μ] (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) (lam : ι → ℝ) + (fallback : {i // 0 < μ.real (S i)}) : + μ.map (fun x => lam (positiveSpectralLabel (fun i => μ.real (S i)) fallback + (spectralPartitionIndex S hcover x)))= + finiteSpectralMeasure (fun i : {i // 0 < μ.real (S i)} => μ.real (S i)) + (fun i => lam i) := by + have he : (fun x => lam (positiveSpectralLabel (fun i => μ.real (S i)) fallback + (spectralPartitionIndex S hcover x))) =ᵐ[μ] + (fun x => lam (spectralPartitionIndex S hcover x)) := by + filter_upwards [ae_spectralPartitionIndex_pos μ S hcover] with x hx + simp only [positiveSpectralLabel,dite_eq_left hx] + rw [Measure.map_congr he,spectralPartition_pushforward μ S hcover hdis hS lam, + finiteSpectralMeasure_positive _ _ (fun _ => measureReal_nonneg)] + +lemma positive_spectral_edge_bounds {ι : Type*} [Fintype ι] + (μ : Measure ℝ) [IsProbabilityMeasure μ] (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (lam : ι → ℝ) (δ a b : ℝ) + (ha : a∈μ.support) (hb : b∈μ.support) + (aMin aMax : {i // 0 < μ.real (S i)}) + (hmin : ∀ i : {i // 0 < μ.real (S i)}, lam aMin ≤ lam i) + (hmax : ∀ i : {i // 0 < μ.real (S i)}, lam i ≤ lam aMax) + (hclose : ∀ᵐ x ∂μ, dist (lam (spectralPartitionIndex S hcover x)) x ≤ δ) : + lam aMin-δ ≤ a ∧ b ≤ lam aMax+δ := by + have hl : ∀ᵐ x ∂μ, x∈Ici (lam aMin-δ) := by + filter_upwards [ae_spectralPartitionIndex_pos μ S hcover,hclose] with x hx hc + have hh := hmin ⟨spectralPartitionIndex S hcover x,hx⟩ + rw [Real.dist_eq,abs_le] at hc + change lam aMin-δ ≤ x + linarith + have hu : ∀ᵐ x ∂μ, x∈Iic (lam aMax+δ) := by + filter_upwards [ae_spectralPartitionIndex_pos μ S hcover,hclose] with x hx hc + have hh := hmax ⟨spectralPartitionIndex S hcover x,hx⟩ + rw [Real.dist_eq,abs_le] at hc + change x ≤ lam aMax+δ + linarith + exact ⟨μ.support_subset_of_isClosed isClosed_Ici hl ha, + μ.support_subset_of_isClosed isClosed_Iic hu hb⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralRounding.lean b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralRounding.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1c933f1524fee5467df2e2223e01149fd43056f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/PositiveSpectralRounding.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Spectral.PositiveSpectralPartition +import OAI.Probability.InvariantIsing.Spectral.SpectralBallQuantizer + +namespace OAI + +/-! One-sided spectral rounding remains valid on the zero-mass cells. -/ + +noncomputable section +open MeasureTheory Set Metric +open scoped Topology Classical Function + +namespace InvariantIsing + +lemma positive_spectral_rounding_bounds {ι : Type*} [Fintype ι] + (μ : Measure ℝ) (S : ι → Set ℝ) (hcover : ∀ x, ∃ i, x∈S i) + (lam : ι → ℝ) (a b δ : ℝ) + (lo hi : {i // 0 < μ.real (S i)}) + (hlo : lam lo-δ ≤ a) (hhi : b ≤ lam hi+δ) + (hcell : ∀ i, 0 < μ.real (S i) → ∀ x∈S i, dist (lam i) x ≤ δ) + (x : ℝ) (hx : x∈Icc a b) : + lam (positiveSpectralLabel (fun i => μ.real (S i)) lo + (spectralPartitionIndex S hcover x))-δ ≤ x ∧ + x ≤ lam (positiveSpectralLabel (fun i => μ.real (S i)) hi + (spectralPartitionIndex S hcover x))+δ := by + let j := spectralPartitionIndex S hcover x + by_cases hp : 0 < μ.real (S j) + · have hc := hcell j hp x (spectralPartitionIndex_mem S hcover x) + rw [Real.dist_eq,abs_le] at hc + simp only [show spectralPartitionIndex S hcover x=j from rfl, + positiveSpectralLabel,dite_eq_left hp] + constructor <;> linarith + · simp only [show spectralPartitionIndex S hcover x=j from rfl, + positiveSpectralLabel,dite_eq_right hp] + exact ⟨hlo.trans hx.1,hx.2.trans hhi⟩ + +lemma positive_spectral_ball_cell_close {n : ℕ} + (μ : Measure ℝ) [IsProbabilityMeasure μ] (c r : Fin n → ℝ) + (a δ : ℝ) (hr : ∀ i, r i ≤ δ) + (hzero : μ (spectralBallCell (fun i => ball (c i) (r i)) none)=0) + (i : Option (Fin n)) (hi : 0 < μ.real (spectralBallCell (fun i => ball (c i) (r i)) i)) + (x : ℝ) (hx : x∈spectralBallCell (fun i => ball (c i) (r i)) i) : + dist (i.elim a c) x ≤ δ := by + cases i with + | none => + have hz : μ.real (spectralBallCell (fun i => ball (c i) (r i)) none)=0 := + (measureReal_eq_zero_iff).mpr hzero + exact (not_lt_of_ge hz.le hi).elim + | some i => + have hh : x∈ball (c i) (r i) := disjointed_subset (fun i => ball (c i) (r i)) i hx + simpa only [Option.elim_some,dist_comm] using (show dist x (c i) ≤ δ from hh.le.trans (hr i)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ResolventLipschitz.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ac82a3572f2c11366478adc24f9c9c5d2fe9467 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventLipschitz.lean @@ -0,0 +1,33 @@ +import OAI.Probability.InvariantIsing.Spectral.CompactResolventTests + +namespace OAI + +/-! The exact uniform modulus used when clipping nonnegative spectra. -/ +noncomputable section +namespace InvariantIsing + +theorem positiveResolventTest_sub_le {t : ℝ} (ht : 0 < t) (x y : ℝ) : + |positiveResolventTest t x-positiveResolventTest t y| ≤ |x-y|/t^2 := by + have hx := le_max_right x 0 + have hy := le_max_right y 0 + have htx : 0 < t+max x 0 := add_pos_of_pos_of_nonneg ht hx + have hty : 0 < t+max y 0 := add_pos_of_pos_of_nonneg ht hy + have hd : t^2 ≤ (t+max x 0)*(t+max y 0) := by + nlinarith [mul_nonneg hx hy] + have hn : |max y 0-max x 0| ≤ |x-y| := by + simpa only [Real.dist_eq,NNReal.coe_one,one_mul,abs_sub_comm,id_eq] using + (LipschitzWith.id.max_const (0 : ℝ)).dist_le_mul y x + have he : positiveResolventTest t x-positiveResolventTest t y = + (max y 0-max x 0)/((t+max x 0)*(t+max y 0)) := by + unfold positiveResolventTest + field_simp [htx.ne',hty.ne'] + ring + rw [he,abs_div,abs_of_pos (mul_pos htx hty)] + exact (div_le_div_of_nonneg_right hn (mul_pos htx hty).le).trans + (div_le_div_of_nonneg_left (abs_nonneg _) (sq_pos_of_pos ht) hd) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ResolventMeasureUniqueness.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventMeasureUniqueness.lean new file mode 100644 index 0000000000000000000000000000000000000000..38dedad983c1e42ede92853466178a10729f6997 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventMeasureUniqueness.lean @@ -0,0 +1,58 @@ +import OAI.Probability.InvariantIsing.Core.UnitIntervalMomentUniqueness + +namespace OAI + +/-! Positive resolvents determine probability measures on the nonnegative real line. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set +namespace InvariantIsing + +def resolventUnit (x : ℝ) : Icc (0 : ℝ) 1 := + ⟨positiveResolventTest 1 x, (positiveResolventTest_bound (t := 1) (by norm_num) x).1, + by simpa only [one_div_one] using (positiveResolventTest_bound (t := 1) (by norm_num) x).2⟩ + +lemma continuous_resolventUnit : Continuous resolventUnit := + (continuous_positiveResolventTest (by norm_num : (0 : ℝ) < 1)).subtype_mk _ + +lemma resolventUnit_inverse {x : ℝ} (hx : 0 ≤ x) : 1/(resolventUnit x : ℝ)-1 = x := by + change 1/(1/(1+max x 0))-1=x + rw [max_eq_left hx,one_div_one_div] + ring + +lemma resolventUnit_map_inverse (μ : Measure ℝ) (hμ : ∀ᵐ x ∂μ, 0 ≤ x) : + (μ.map resolventUnit).map (fun x : Icc (0 : ℝ) 1 => 1/(x : ℝ)-1) = μ := by + have hm : Measurable (fun x : Icc (0 : ℝ) 1 => 1/(x : ℝ)-1) := by fun_prop + rw [Measure.map_map hm continuous_resolventUnit.measurable] + calc + μ.map ((fun x : Icc (0 : ℝ) 1 => 1/(x : ℝ)-1) ∘ resolventUnit) = μ.map id := by + apply Measure.map_congr + filter_upwards [hμ] with x hx + exact resolventUnit_inverse hx + _ = μ := Measure.map_id + +theorem positiveResolvent_unique (μ ν : Measure ℝ) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + (hμ : ∀ᵐ x ∂μ, 0 ≤ x) (hν : ∀ᵐ x ∂ν, 0 ≤ x) + (h : ∀ t : ℝ, 0 < t → (∫ x, positiveResolventTest t x ∂μ) = + ∫ x, positiveResolventTest t x ∂ν) : μ = ν := by + have : IsProbabilityMeasure (μ.map resolventUnit) := + (Measure.isProbabilityMeasure_map_iff continuous_resolventUnit.measurable.aemeasurable).mpr inferInstance + have : IsProbabilityMeasure (ν.map resolventUnit) := + (Measure.isProbabilityMeasure_map_iff continuous_resolventUnit.measurable.aemeasurable).mpr inferInstance + have he : μ.map resolventUnit = ν.map resolventUnit := by + apply unitInterval_moments_unique + intro n + have hc : Continuous (fun x : Icc (0 : ℝ) 1 => (x : ℝ)^n) := continuous_subtype_val.pow n + rw [integral_map continuous_resolventUnit.measurable.aemeasurable hc.aestronglyMeasurable, + integral_map continuous_resolventUnit.measurable.aemeasurable hc.aestronglyMeasurable] + cases n with + | zero => simp only [pow_zero,integral_const,probReal_univ,smul_eq_mul,mul_one] + | succ n => exact positiveResolvent_moments_eq μ ν h n 1 (by norm_num) + have hi := congrArg (fun η : Measure (Icc (0 : ℝ) 1) => + η.map (fun x : Icc (0 : ℝ) 1 => 1/(x : ℝ)-1)) he + rwa [resolventUnit_map_inverse μ hμ,resolventUnit_map_inverse ν hν] at hi + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ResolventMomentIdentification.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventMomentIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..e20e7af7e225d70b36f71738c28b6e67575cd4d8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventMomentIdentification.lean @@ -0,0 +1,34 @@ +import OAI.Probability.InvariantIsing.Spectral.ResolventPowerDerivative + +namespace OAI + +/-! Equality of positive resolvents determines all their bounded powers. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped Topology +namespace InvariantIsing + +theorem positiveResolvent_moments_eq (μ ν : Measure ℝ) [IsFiniteMeasure μ] [IsFiniteMeasure ν] + (h : ∀ t : ℝ, 0 < t → (∫ x, positiveResolventTest t x ∂μ) = + ∫ x, positiveResolventTest t x ∂ν) : + ∀ n : ℕ, ∀ t : ℝ, 0 < t → + (∫ x, (positiveResolventTest t x)^(n+1) ∂μ) = + ∫ x, (positiveResolventTest t x)^(n+1) ∂ν := by + intro n + induction n with + | zero => simpa only [zero_add,pow_one] using h + | succ n ih => + intro t ht + have he : (fun s => ∫ x, (positiveResolventTest s x)^(n+1) ∂ν) =ᶠ[𝓝 t] + fun s => ∫ x, (positiveResolventTest s x)^(n+1) ∂μ := by + filter_upwards [Ioi_mem_nhds ht] with s hs + exact (ih s hs).symm + have hd := ((positiveResolventPower_integral_hasDerivAt μ ht (n+1)).congr_of_eventuallyEq he).unique + (positiveResolventPower_integral_hasDerivAt ν ht (n+1)) + exact mul_left_cancel₀ (neg_ne_zero.mpr (Nat.cast_ne_zero.mpr (Nat.succ_ne_zero n))) hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ResolventPowerDerivative.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventPowerDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..1dff4bbc440137b3a5183edcf44621b7de503f1b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ResolventPowerDerivative.lean @@ -0,0 +1,76 @@ +import OAI.Probability.InvariantIsing.Gaussian.MPDensityTransform +import Mathlib.Analysis.Calculus.ParametricIntegral + +namespace OAI + +/-! Differentiation of bounded positive-resolvent moments. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped Topology +namespace InvariantIsing + +lemma positiveResolventTest_hasDerivAt {t : ℝ} (ht : 0 < t) (x : ℝ) : + HasDerivAt (fun s => positiveResolventTest s x) (-(positiveResolventTest t x)^2) t := by + have hn : t+max x 0 ≠ 0 := (add_pos_of_pos_of_nonneg ht (le_max_right x 0)).ne' + convert ((hasDerivAt_id t).add_const (max x 0)).inv hn using 1 + · funext s + simp only [positiveResolventTest,one_div,Pi.inv_apply,id_eq] + · simp only [positiveResolventTest,div_eq_mul_inv,inv_pow,one_mul,id_eq,neg_mul] + +lemma positiveResolventPower_hasDerivAt {t : ℝ} (ht : 0 < t) (x : ℝ) (n : ℕ) : + HasDerivAt (fun s => (positiveResolventTest s x)^n) + (-(n : ℝ)*(positiveResolventTest t x)^(n+1)) t := by + induction n with + | zero => simpa only [pow_zero,Nat.cast_zero,neg_zero,zero_mul] using hasDerivAt_const t (1 : ℝ) + | succ n ih => + convert ih.mul (positiveResolventTest_hasDerivAt ht x) using 1 + · funext s + exact pow_succ _ _ + · simp only [Nat.cast_succ,pow_succ] + ring + +lemma positiveResolventPower_integrable {t : ℝ} (ht : 0 < t) (n : ℕ) + (μ : Measure ℝ) [IsFiniteMeasure μ] : + Integrable (fun x => (positiveResolventTest t x)^n) μ := by + apply Integrable.of_bound ((continuous_positiveResolventTest ht).pow n).aestronglyMeasurable ((1/t)^n) + exact ae_of_all _ fun x => by + change ‖(positiveResolventTest t x)^n‖ ≤ _ + rw [Real.norm_eq_abs,abs_of_nonneg (pow_nonneg (positiveResolventTest_bound ht x).1 _)] + exact pow_le_pow_left₀ (positiveResolventTest_bound ht x).1 (positiveResolventTest_bound ht x).2 n + +theorem positiveResolventPower_integral_hasDerivAt (μ : Measure ℝ) [IsFiniteMeasure μ] + {t : ℝ} (ht : 0 < t) (n : ℕ) : + HasDerivAt (fun s => ∫ x, (positiveResolventTest s x)^n ∂μ) + (-(n : ℝ)*(∫ x, (positiveResolventTest t x)^(n+1) ∂μ)) t := by + have hs : Ioi (t/2) ∈ 𝓝 t := Ioi_mem_nhds (by linarith) + have hm : ∀ᶠ s in 𝓝 t, AEStronglyMeasurable (fun x => (positiveResolventTest s x)^n) μ := by + filter_upwards [hs] with s hs' + exact ((continuous_positiveResolventTest (lt_trans (half_pos ht) hs')).pow n).aestronglyMeasurable + have hd : ∀ᵐ x ∂μ, ∀ s ∈ Ioi (t/2), + HasDerivAt (fun u => (positiveResolventTest u x)^n) + (-(n : ℝ)*(positiveResolventTest s x)^(n+1)) s := + ae_of_all _ fun x s hs' => positiveResolventPower_hasDerivAt (lt_trans (half_pos ht) hs') x n + have hb : ∀ᵐ x ∂μ, ∀ s ∈ Ioi (t/2), + ‖-(n : ℝ)*(positiveResolventTest s x)^(n+1)‖ ≤ (n : ℝ)*(2/t)^(n+1) := by + refine ae_of_all _ fun x s hs' => ?_ + have hsp : 0 < s := lt_trans (half_pos ht) hs' + have hr : positiveResolventTest s x ≤ 2/t := by + calc + _ ≤ 1/s := (positiveResolventTest_bound hsp x).2 + _ ≤ 1/(t/2) := one_div_le_one_div_of_le (half_pos ht) hs'.le + _ = 2/t := by ring + rw [norm_mul,norm_neg,Real.norm_of_nonneg (Nat.cast_nonneg n), + Real.norm_of_nonneg (pow_nonneg (positiveResolventTest_bound hsp x).1 _)] + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (positiveResolventTest_bound hsp x).1 hr _) (Nat.cast_nonneg n) + have hh := (hasDerivAt_integral_of_dominated_loc_of_deriv_le hs hm + (positiveResolventPower_integrable ht n μ) + (((continuous_positiveResolventTest ht).pow (n+1)).const_mul (-(n : ℝ))).aestronglyMeasurable + hb (integrable_const _) hd).2 + simpa only [integral_const_mul] using hh + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ScaledSpectralLaw.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ScaledSpectralLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..0748418a1944662104ff5e98531d073041270152 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ScaledSpectralLaw.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Pressure.LimitingPressure + +namespace OAI + +/-! Positive temperature scaling preserves the precise spectral hypotheses. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology + +namespace InvariantIsing + +def scaledSpectralLaw (ν : ProbabilityMeasure ℝ) (β : ℝ) : ProbabilityMeasure ℝ := + ν.map (fun x => β*x) + +lemma scaled_spectral_support_bound (ν : ProbabilityMeasure ℝ) (a b β : ℝ) + (hβ : 0 ≤ β) (hbound : (ν : Measure ℝ).support ⊆ Icc a b) : + (scaledSpectralLaw ν β : Measure ℝ).support ⊆ Icc (β*a) (β*b) := by + apply Measure.support_subset_of_isClosed isClosed_Icc + change ∀ᵐ y ∂((ν : Measure ℝ).map (fun x => β*x)), y∈Icc (β*a) (β*b) + apply (ae_map_iff (measurable_const.mul measurable_id).aemeasurable measurableSet_Icc).mpr + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + exact ⟨mul_le_mul_of_nonneg_left (hbound hx).1 hβ, + mul_le_mul_of_nonneg_left (hbound hx).2 hβ⟩ + +lemma scaled_spectral_support_mem (ν : ProbabilityMeasure ℝ) (β x : ℝ) + (hx : x∈(ν : Measure ℝ).support) : + β*x∈(scaledSpectralLaw ν β : Measure ℝ).support := by + rw [Measure.support_eq_forall_isOpen] + intro S hS hopen + change ((ν : Measure ℝ).map (fun x => β*x)) S > 0 + have hm : Measurable (fun y : ℝ => β*y) := measurable_const.mul measurable_id + rw [Measure.map_apply hm hopen.measurableSet] + exact (Measure.mem_support_iff_forall x).mp hx _ + ((hopen.preimage (continuous_const.mul continuous_id)).mem_nhds hS) + +lemma scaled_spectral_compact (ν : ProbabilityMeasure ℝ) (a b β : ℝ) + (hβ : 0 ≤ β) (hbound : (ν : Measure ℝ).support ⊆ Icc a b) : + IsCompact (scaledSpectralLaw ν β : Measure ℝ).support := + isCompact_Icc.of_isClosed_subset Measure.isClosed_support + (scaled_spectral_support_bound ν a b β hβ hbound) + +lemma scaled_spectral_no_outliers (eig : (N : ℕ) → Fin N → ℝ) (a b β : ℝ) + (hβ : 0 < β) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, + β*a-ε ≤ β*eig N i ∧ β*eig N i ≤ β*b+ε := by + intro ε hε + filter_upwards [hno (ε/β) (div_pos hε hβ)] with N hN i + have hl := mul_le_mul_of_nonneg_left (hN i).1 hβ.le + have hu := mul_le_mul_of_nonneg_left (hN i).2 hβ.le + have he : β*(ε/β)=ε := mul_div_cancel₀ ε hβ.ne' + rw [mul_sub,he] at hl + rw [mul_add,he] at hu + exact ⟨hl,hu⟩ + +lemma scaled_spectral_weak (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) (β : ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (fun i => β*eig (k+1) i)) + atTop (𝓝 (scaledSpectralLaw ν β)) := by + have hh := ProbabilityMeasure.tendsto_map_of_tendsto_of_continuous _ ν hweak + (show Continuous (fun x : ℝ => β*x) from continuous_const.mul continuous_id) + apply hh.congr + intro k + apply ProbabilityMeasure.toMeasure_injective + exact empiricalSpectralLaw_map _ _ _ (measurable_const.mul measurable_id) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/ScaledSpectralSigned.lean b/lean/OAI/Probability/InvariantIsing/Spectral/ScaledSpectralSigned.lean new file mode 100644 index 0000000000000000000000000000000000000000..873dc6b9509d8b7d5ea09d77924b7396cf110680 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/ScaledSpectralSigned.lean @@ -0,0 +1,39 @@ +import OAI.Probability.InvariantIsing.Spectral.ScaledSpectralLaw + +namespace OAI + +/-! Spectral support under a scalar of either sign. -/ +noncomputable section +open MeasureTheory Set +namespace InvariantIsing + +lemma signed_scaled_spectral_support (ν : ProbabilityMeasure ℝ) (a b c : ℝ) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) : + (scaledSpectralLaw ν c : Measure ℝ).support ⊆ + Icc (min (c*a) (c*b)) (max (c*a) (c*b)) := by + apply Measure.support_subset_of_isClosed isClosed_Icc + change ∀ᵐ y ∂((ν : Measure ℝ).map (fun x => c*x)), + y∈Icc (min (c*a) (c*b)) (max (c*a) (c*b)) + apply (ae_map_iff (measurable_const.mul measurable_id).aemeasurable measurableSet_Icc).mpr + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + by_cases hc : 0 ≤ c + · exact ⟨(min_le_left _ _).trans (mul_le_mul_of_nonneg_left (hbound hx).1 hc), + (mul_le_mul_of_nonneg_left (hbound hx).2 hc).trans (le_max_right _ _)⟩ + · exact ⟨(min_le_right _ _).trans (mul_le_mul_of_nonpos_left (hbound hx).2 (le_of_not_ge hc)), + (mul_le_mul_of_nonpos_left (hbound hx).1 (le_of_not_ge hc)).trans (le_max_left _ _)⟩ + +lemma signed_scaled_spectral_endpoints (ν : ProbabilityMeasure ℝ) (a b c : ℝ) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) : + min (c*a) (c*b)∈(scaledSpectralLaw ν c : Measure ℝ).support ∧ + max (c*a) (c*b)∈(scaledSpectralLaw ν c : Measure ℝ).support := by + by_cases h : c*a ≤ c*b + · simpa only [min_eq_left h,max_eq_right h] using + And.intro (scaled_spectral_support_mem ν c a ha) (scaled_spectral_support_mem ν c b hb) + · simpa only [min_eq_right (le_of_not_ge h),max_eq_left (le_of_not_ge h)] using + And.intro (scaled_spectral_support_mem ν c b hb) (scaled_spectral_support_mem ν c a ha) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedAlphabetPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedAlphabetPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7fa83f2eb7b5ebca41cd70bf53132ddfcdf95c2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedAlphabetPressure.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Cavity.CavitySelectedDimensions +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralMeasure + +namespace OAI + +/-! The finite-alphabet pressure theorem along diverging dimensions. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BigOperators + +namespace InvariantIsing + +theorem selected_finite_alphabet_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) {m : ℕ} + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (lam : Fin m → ℝ) + (D : ℕ → ℕ) (hD : ∀ k, 0 < D k) (hDlim : Tendsto D atTop atTop) + (g : (k : ℕ) → Fin (D k) → Fin m) + (ρ : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a=1) + (hρlim : Tendsto (fun k a => ((cavitySpectralGroup (g k) a).card : ℝ)/D k) atTop (𝓝 ρ)) : + Tendsto (fun k => ∫ V, rotatedPressure (fun i => lam (g k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (D k)) atTop + (𝓝 (variationalFunctional (finiteR ρ lam hρ hρsum)).toReal) := by + by_cases hm : 2 ≤ m + · exact cavity_selected_dimensions_pressure_tendsto hhaar hgauss hpub hm μ lam D hD hDlim g ρ hρ hρsum hρlim + have hm0 : 0 < m := by + obtain ⟨a,_⟩ := exists_pos_spectral_weight (fun a => (hρ a).le) hρsum + exact Nat.pos_of_ne_zero (by intro hz; subst m; exact Fin.elim0 a) + have hm1 : m=1 := by omega + subst m + have hlam : lam=fun _ => lam 0 := funext fun a => congrArg lam (Subsingleton.elim a 0) + have hR : finiteR ρ lam hρ hρsum=fun _ => lam 0 := by + funext x + rw [hlam] + exact finiteR_constant ρ hρ hρsum x (lam 0) + rw [hR, variationalFunctional_constant, EReal.toReal_coe] + have he : ∀ᶠ k in atTop, (∫ V, rotatedPressure (fun i => lam (g k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (D k))=lam 0/2 := by + apply Filter.Eventually.of_forall + intro k + have hpos : 0 < D k := hD k + have heig : (fun i => lam (g k i))=fun _ => lam 0 := + funext fun i => congrArg lam (Subsingleton.elim (g k i) 0) + rw [heig] + simp only [rotatedPressure_constant hpos,integral_const,measureReal_def,measure_univ, + ENNReal.toReal_one,one_smul] + exact tendsto_const_nhds.congr' (he.mono fun _ h => h.symm) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedCompactPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedCompactPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca5f1e57fb473e93e1c57c5bbc4b154a0ad925d2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedCompactPressure.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Spectral.SelectedPartitionPressure +import OAI.Probability.InvariantIsing.Spectral.CompactPartitionContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralApproximationSqueeze + +namespace OAI + +/-! Compact spectral pressure along arbitrary diverging dimensions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +theorem selected_compact_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) + (eig : (k : ℕ) → Fin (N k) → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (heig : ∀ k i, eig k i∈Icc a b) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hN k) (eig k)) atTop (𝓝 ν)) : + Tendsto (fun k => ∫ V, rotatedPressure (eig k) (matrixRotation V⁻¹) (fun _ => 0) ∂μ (N k)) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + let δ := fun k : ℕ => (1 : ℝ)/(k+1) + let D (k : ℕ) : CompactSpectralPartition ν a b (δ k) := Classical.choice + (exists_compact_spectral_partition ν a b (δ k) hcompact hbound (by dsimp [δ]; positivity)) + have hab : a ≤ b := (hbound ha).2 + have hδ : Tendsto δ atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ) + have hL := compact_partition_variational_tendsto ν a b δ D hab ha hb hbound hδ + apply spectral_approximation_squeeze _ + (fun j k => ∫ V, rotatedPressure (fun i => (D j).lowerValue (eig k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (N k)) + (fun j k => ∫ V, rotatedPressure (fun i => (D j).upperValue (eig k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (N k)) + (fun j => (variationalFunctional (measureR ((D j).law : Measure ℝ) (D j).edge)).toReal) + δ _ hL hδ + (fun j => ((D j).selected_pressure_tendsto hhaar hgauss hpub μ N hN hNlim eig hweak).1) + (fun j => ((D j).selected_pressure_tendsto hhaar hgauss hpub μ N hN hNlim eig hweak).2) + intro j + exact Filter.Eventually.of_forall fun k => + (D j).mean_pressure_bounds (hN k) (μ (N k)) (eig k) ha hb hab (heig k) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedOrbitAlmostSure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedOrbitAlmostSure.lean new file mode 100644 index 0000000000000000000000000000000000000000..d247cd965757dffae8470e3460b191501aea16eb --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedOrbitAlmostSure.lean @@ -0,0 +1,59 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomOrbitAlmostSure + +namespace OAI + +/-! Conditional Haar concentration along a selected sequence of dimensions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology ENNReal +namespace InvariantIsing + +theorem ae_selected_orbit_pressure_sub_mean (hhaar : HaarConcentrationInput) + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (s : ℕ → ℕ) (hs : ∀ k, k ≤ s k) + (d : (k : ℕ) → Ω → FieldSpectralData (s k+1)) (Y : ℕ → Ω → ℝ) + (hd : ∀ N, Measurable (d N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (d N) (Y N) (H (s N+1))) + (hbound : ∀ᵐ ω ∂P, ∃ K : ℝ, ∀ᶠ k in atTop, spectralRadius ((d k ω).1) ≤ K) : + ∀ᵐ ω ∂P, Tendsto (fun k => Y k ω- + ∫ U, dataPhysicalPressure (d k ω) U ∂H (s k+1)) atTop (𝓝 0) := by + apply ae_tendsto_zero_of_localized_exponential_tail P + (fun k ω => Y k ω-∫ U, dataPhysicalPressure (d k ω) U ∂H (s k+1)) + (fun k ω => spectralRadius ((d k ω).1)) _ hbound + intro K ε hK hε + obtain ⟨C,a,hC,ha,ht⟩ := uniform_physical_pressure_mean_tail hhaar + obtain ⟨N₀,hN₀⟩ := ht K ε hK hε + refine ⟨C,a*(ε/2)^2/K^2,hC.le,by positivity,max N₀ 3,?_⟩ + intro n hn + have hb := conditional_orbit_tail_bound (Nat.succ_pos (s n)) P (d n) (Y n) + (hd n) (hY n) (H (s n+1)) (hlaw n) K ε + (C*Real.exp (-a*(s n+1 : ℝ)*(ε/2)^2/K^2)) (fun data hdata => by + simpa only [dataPhysicalPressure,Nat.cast_add,Nat.cast_one] using + hN₀ (s n+1) (by have := hs n; omega) (by have := hs n; omega) (H (s n+1)) inferInstance inferInstance + data.1 data.2 hdata) + have he : {ω | (∀ i, |(d n ω).1 i| ≤ K) ∧ + ε ≤ |Y n ω-∫ U, dataPhysicalPressure (d n ω) U ∂H (s n+1)|}= + {ω | ε ≤ |Y n ω-∫ U, dataPhysicalPressure (d n ω) U ∂H (s n+1)| ∧ + spectralRadius ((d n ω).1) ≤ K} := by + ext ω + simp only [mem_ofPred_eq,spectralRadius_le_iff,and_comm] + rw [he] at hb + have hreal := ENNReal.toReal_mono (ENNReal.ofReal_ne_top) hb + rw [ENNReal.toReal_ofReal (by positivity)] at hreal + refine hreal.trans ?_ + apply mul_le_mul_of_nonneg_left _ hC.le + apply Real.exp_le_exp.mpr + have hc : 0 ≤ a*(ε/2)^2/K^2 := by positivity + calc + -a*(s n+1 : ℝ)*(ε/2)^2/K^2= -(a*(ε/2)^2/K^2)*((s n : ℝ)+1) := by ring + _ ≤ -(a*(ε/2)^2/K^2)*(n : ℝ) := by + have hsn : (n : ℝ) ≤ s n := by exact_mod_cast hs n + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedPartitionPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedPartitionPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3e4cbf3c8f251da9d9efc1ef8dc81d4ca6a0498 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedPartitionPressure.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Spectral.SelectedTypePressure +import OAI.Probability.InvariantIsing.Spectral.CompactPartitionPressure + +namespace OAI + +/-! Spectral rounding for a sequence of selected dimensions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Classical Function +namespace InvariantIsing + +theorem selected_partition_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) {ι : Type*} [Fintype ι] + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] + (D : ℕ → ℕ) (hD : ∀ k, 0 < D k) (hDlim : Tendsto D atTop atTop) + (eig : (k : ℕ) → Fin (D k) → ℝ) (ν : ProbabilityMeasure ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hD k) (eig k)) atTop (𝓝 ν)) + (S : ι → Set ℝ) (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) (hbd : ∀ i, (ν : Measure ℝ) (frontier (S i))=0) + (lam : ι → ℝ) (fallback aMax : {i // 0 < (ν : Measure ℝ).real (S i)}) + (hMax : ∀ a : {i // 0 < (ν : Measure ℝ).real (S i)}, lam a ≤ lam aMax) : + Tendsto (fun k => ∫ V, rotatedPressure + (fun i => lam (positiveSpectralLabel (fun a => (ν : Measure ℝ).real (S a)) fallback + (spectralPartitionIndex S hcover (eig k i)))) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (D k)) atTop + (𝓝 (variationalFunctional (measureR + (finiteSpectralMeasure (fun i : {i // 0 < (ν : Measure ℝ).real (S i)} => + (ν : Measure ℝ).real (S i)) (fun i => lam i)) (lam aMax))).toReal) := by + let w := fun a => (ν : Measure ℝ).real (S a) + let g := fun k (i : Fin (D k)) => spectralPartitionIndex S hcover (eig k i) + have hc := spectral_label_counts_partition D hD eig ν hweak S hS hbd g + (fun k a i => spectralPartitionIndex_eq_iff S hcover hdis (eig k i) a) + have hp := positive_spectral_counts_tendsto D g w (fun _ => measureReal_nonneg) fallback hc + exact selected_finite_type_pressure_tendsto hhaar hgauss hpub μ + (fun a : {i // 0 < w i} => lam a) D hD hDlim + (fun k => positiveSpectralLabel w fallback ∘ g k) (fun a : {i // 0 < w i} => w a) + (fun a => a.property) (positiveSpectralWeights_sum w (fun _ => measureReal_nonneg) + (spectralPartitionWeights_sum (ν : Measure ℝ) S hcover hdis hS)) hp aMax hMax + +namespace CompactSpectralPartition + +lemma selected_pressure_tendsto {ν : ProbabilityMeasure ℝ} {a b δ : ℝ} + (P : CompactSpectralPartition ν a b δ) + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] + (D : ℕ → ℕ) (hD : ∀ k, 0 < D k) (hDlim : Tendsto D atTop atTop) + (eig : (k : ℕ) → Fin (D k) → ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hD k) (eig k)) atTop (𝓝 ν)) : + Tendsto (fun k => ∫ V, rotatedPressure (fun i => P.lowerValue (eig k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (D k)) atTop + (𝓝 (variationalFunctional (measureR (P.law : Measure ℝ) P.edge)).toReal) ∧ + Tendsto (fun k => ∫ V, rotatedPressure (fun i => P.upperValue (eig k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (D k)) atTop + (𝓝 (variationalFunctional (measureR (P.law : Measure ℝ) P.edge)).toReal) := by + have hh (fallback : P.Positive) := selected_partition_pressure_tendsto hhaar hgauss hpub μ + D hD hDlim eig ν hweak P.cells (spectralBallCell_cover _) (spectralBallCell_disjoint _) + (spectralBallCell_measurable _ (fun _ => measurableSet_ball)) + (spectralBallCell_null_boundary (ν : Measure ℝ) _ P.null_boundary) + P.value fallback P.upper P.le_upper + exact ⟨hh P.lower,hh P.upper⟩ + +end CompactSpectralPartition +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedSpectralExcess.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedSpectralExcess.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca7a781b3705d54f028cf2446ae1415ef3046353 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedSpectralExcess.lean @@ -0,0 +1,40 @@ +import OAI.Probability.InvariantIsing.Pressure.RandomSpectralBound +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! Turning a scalar edge-excess limit into the selected spectral hypotheses. -/ +noncomputable section +open Filter Set +open scoped Topology +namespace InvariantIsing + +lemma selected_no_outliers_of_excess (N : ℕ → ℕ) (eig : (k : ℕ) → Fin (N k) → ℝ) + (a b : ℝ) (he : Tendsto (fun k => spectralExcess (eig k) a b) atTop (𝓝 0)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, ∀ i, a-ε ≤ eig k i ∧ eig k i ≤ b+ε := by + intro ε hε + filter_upwards [he.eventually (Iio_mem_nhds hε)] with k hk i + have hb := spectralExcess_bounds (eig k) a b i + constructor <;> linarith + +lemma selected_spectralRadius_bounded (s : ℕ → ℕ) + (eig : (k : ℕ) → Fin (s k+1) → ℝ) (a b : ℝ) + (he : Tendsto (fun k => spectralExcess (eig k) a b) atTop (𝓝 0)) : + ∃ K : ℝ, ∀ᶠ k in atTop, spectralRadius (eig k) ≤ K := by + refine ⟨max |a| |b|+1,?_⟩ + filter_upwards [selected_no_outliers_of_excess (fun k => s k+1) eig a b he 1 zero_lt_one] + with k hk + apply (spectralRadius_le_iff _ _).mpr + intro i + apply abs_le.mpr + have ha := neg_abs_le a + have hb := le_abs_self b + have hma := le_max_left |a| |b| + have hmb := le_max_right |a| |b| + constructor <;> linarith [(hk i).1,(hk i).2] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedSpectralPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedSpectralPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..4222e6be04c86eff4007e9747a28ce43e3c1f232 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedSpectralPressure.lean @@ -0,0 +1,68 @@ +import OAI.Probability.InvariantIsing.Spectral.SelectedCompactPressure +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! No-outlier spectral pressure along selected dimensions, used in the +subsequence proof of convergence in probability. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology +namespace InvariantIsing + +lemma selected_clip_empirical_tendsto + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (eig : (k : ℕ) → Fin (N k) → ℝ) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hN k) (eig k)) atTop (𝓝 ν)) : + Tendsto (fun k => empiricalSpectralLaw (hN k) (fun i => spectralClip a b (eig k i))) + atTop (𝓝 ν) := by + have he : ν.map (spectralClip a b)=ν := by + apply ProbabilityMeasure.toMeasure_injective + rw [ProbabilityMeasure.toMeasure_map] + have h : spectralClip a b =ᵐ[(ν : Measure ℝ)] id := by + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + exact spectralClip_eq (hbound hx) + rw [Measure.map_congr h,Measure.map_id] + have hh := ProbabilityMeasure.tendsto_map_of_tendsto_of_continuous _ ν hweak + (continuous_spectralClip a b) + rw [he] at hh + apply hh.congr + intro k + apply ProbabilityMeasure.toMeasure_injective + exact empiricalSpectralLaw_map _ _ _ (continuous_spectralClip a b).measurable + +theorem selected_spectral_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (hNlim : Tendsto N atTop atTop) + (eig : (k : ℕ) → Fin (N k) → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ k in atTop, ∀ i, a-ε ≤ eig k i ∧ eig k i ≤ b+ε) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hN k) (eig k)) atTop (𝓝 ν)) : + Tendsto (fun k => ∫ V, rotatedPressure (eig k) (matrixRotation V⁻¹) (fun _ => 0) ∂μ (N k)) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + have hab : a ≤ b := (hbound ha).2 + have hc := selected_compact_pressure_tendsto hhaar hgauss hpub μ N hN hNlim + (fun k i => spectralClip a b (eig k i)) ν a b hcompact hbound ha hb + (fun k i => spectralClip_mem hab (eig k i)) + (selected_clip_empirical_tendsto N hN eig ν a b hbound hweak) + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [Metric.tendsto_nhds.mp hc (ε/2) (by positivity), + hno (ε/2) (by positivity)] with k hk he + have hd := spectral_clip_mean_pressure_close (hN k) (μ (N k)) (eig k) a b (ε/2) + hab (by positivity) he + rw [Real.dist_eq] at hk ⊢ + rw [abs_sub_comm] at hd + exact (abs_sub_le _ _ _).trans_lt (add_lt_add_of_le_of_lt hd hk) |>.trans_le (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SelectedTypePressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedTypePressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c953d0f52b64455c808915db67a04d35fcb086c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SelectedTypePressure.lean @@ -0,0 +1,60 @@ +import OAI.Probability.InvariantIsing.Spectral.SelectedAlphabetPressure +import OAI.Probability.InvariantIsing.Core.FiniteTypePressure + +namespace OAI + +/-! Finite spectral cell types along diverging dimensions. -/ +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology Classical BigOperators +namespace InvariantIsing + +theorem selected_finite_type_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) {ι : Type*} [Fintype ι] + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (lam : ι → ℝ) + (D : ℕ → ℕ) (hD : ∀ k, 0 < D k) (hDlim : Tendsto D atTop atTop) + (g : (k : ℕ) → Fin (D k) → ι) + (w : ι → ℝ) (hw : ∀ a, 0 < w a) (hsum : ∑ a, w a=1) + (hlim : Tendsto (fun k a => (spectralLabelCount (g k) a : ℝ)/D k) atTop (𝓝 w)) + (aMax : ι) (hMax : ∀ a, lam a ≤ lam aMax) : + Tendsto (fun k => ∫ V, rotatedPressure (fun i => lam (g k i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ (D k)) atTop + (𝓝 (variationalFunctional (measureR (finiteSpectralMeasure w lam) (lam aMax))).toReal) := by + let e := Fintype.equivFin ι + let wf := w ∘ e.symm + let lf := lam ∘ e.symm + have hwp : ∀ a, 0 < wf a := fun a => hw (e.symm a) + have hws : ∑ a, wf a=1 := (e.symm.sum_comp w).trans hsum + have hl : Tendsto (fun N a => + ((cavitySpectralGroup (fun i => e (g N i)) a).card : ℝ)/D N) atTop (𝓝 wf) := by + apply tendsto_pi_nhds.mpr + intro a + change Tendsto (fun N => ((cavitySpectralGroup (fun i => e (g N i)) a).card : ℝ)/D N) + atTop (𝓝 (w (e.symm a))) + convert (tendsto_pi_nhds.mp hlim) (e.symm a) using 1 + funext N + congr 2 + apply congrArg Finset.card + ext i + simp only [cavitySpectralGroup,Finset.mem_filter,Finset.mem_univ, + true_and,← e.eq_symm_apply] + have hh := selected_finite_alphabet_pressure_tendsto hhaar hgauss hpub μ lf D hD hDlim + (fun N i => e (g N i)) wf hwp hws hl + have hR : measureR (finiteSpectralMeasure w lam) (lam aMax)=finiteR wf lf hwp hws := by + funext x + rw [← finiteSpectralMeasure_equiv e.symm w lam] + have he := measureR_finiteSpectralMeasure wf lf hwp hws (e aMax) + (fun a => by simpa only [lf,Function.comp_apply,e.symm_apply_apply] using hMax (e.symm a)) x + simpa only [lf,Function.comp_apply,e.symm_apply_apply] using he + rw [hR] + convert hh using 1 + funext N + simp only [lf,Function.comp_apply,e.symm_apply_apply] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/Spectral.lean b/lean/OAI/Probability/InvariantIsing/Spectral/Spectral.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba0259339c94bc27ce9ee5cf9a025e2b7ac7a595 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/Spectral.lean @@ -0,0 +1,168 @@ +import Mathlib.Algebra.Order.BigOperators.Ring.Finset +import Mathlib.Tactic + +namespace OAI + +/-! +# Finite spectral resolvents + +The finite-alphabet arguments in Sections 3 and 5 of the manuscript use +the unique solution of `∑ a, ρ a / (b - eig a) = x` above all eigenvalues. +The solution is unique and satisfies deterministic bounds. +The weights may vanish; their sum being one is the only normalization. +-/ + +noncomputable section + +open scoped BigOperators + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +/-- The Cauchy transform of a finite spectral probability law. -/ +def finiteResolvent (ρ eig : ι → ℝ) (b : ℝ) : ℝ := + ∑ a, ρ a / (b - eig a) + +/-- The second resolvent moment, which controls the derivative of the inverse. -/ +def finiteSecondResolvent (ρ eig : ι → ℝ) (b : ℝ) : ℝ := + ∑ a, ρ a / (b - eig a) ^ 2 + +theorem exists_pos_spectral_weight {ρ : ι → ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) : + ∃ a, 0 < ρ a := by + by_contra h + push Not at h + have hz : ∑ a, ρ a = 0 := Finset.sum_eq_zero fun a _ => + le_antisymm (h a) (hρ a) + linarith + +theorem finiteResolvent_pos {ρ eig : ι → ℝ} {b : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (hb : ∀ a, eig a < b) : + 0 < finiteResolvent ρ eig b := by + obtain ⟨a, ha⟩ := exists_pos_spectral_weight hρ hρsum + unfold finiteResolvent + exact Finset.sum_pos' (fun a _ => div_nonneg (hρ a) (sub_pos.mpr (hb a)).le) + ⟨a, Finset.mem_univ a, div_pos ha (sub_pos.mpr (hb a))⟩ + +theorem finiteResolvent_strictAnti {ρ eig : ι → ℝ} {b c : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (hb : ∀ a, eig a < b) (hbc : b < c) : + finiteResolvent ρ eig c < finiteResolvent ρ eig b := by + obtain ⟨a, ha⟩ := exists_pos_spectral_weight hρ hρsum + apply Finset.sum_lt_sum + · intro j _ + exact div_le_div_of_nonneg_left (hρ j) (sub_pos.mpr (hb j)) (by linarith) + · exact ⟨a, Finset.mem_univ a, + div_lt_div_of_pos_left ha (sub_pos.mpr (hb a)) (by linarith)⟩ + +/-- The finite-alphabet inverse is unique on its required branch. -/ +theorem finiteResolvent_solution_unique {ρ eig : ι → ℝ} {b c x : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (hb : ∀ a, eig a < b) (hc : ∀ a, eig a < c) + (hbx : finiteResolvent ρ eig b = x) (hcx : finiteResolvent ρ eig c = x) : + b = c := by + rcases lt_trichotomy b c with h | h | h + · have := finiteResolvent_strictAnti hρ hρsum hb h + linarith + · exact h + · have := finiteResolvent_strictAnti hρ hρsum hc h + linarith + +theorem finiteResolvent_le {ρ eig : ι → ℝ} {b u : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (heig : ∀ a, eig a ≤ u) (hb : u < b) : + finiteResolvent ρ eig b ≤ 1 / (b - u) := by + calc + finiteResolvent ρ eig b ≤ ∑ a, ρ a / (b - u) := by + apply Finset.sum_le_sum + intro a _ + exact div_le_div_of_nonneg_left (hρ a) (sub_pos.mpr hb) (by linarith [heig a]) + _ = 1 / (b - u) := by rw [← Finset.sum_div, hρsum] + +theorem le_finiteResolvent {ρ eig : ι → ℝ} {b l : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (heig : ∀ a, l ≤ eig a) (hb : ∀ a, eig a < b) : + 1 / (b - l) ≤ finiteResolvent ρ eig b := by + calc + 1 / (b - l) = ∑ a, ρ a / (b - l) := by rw [← Finset.sum_div, hρsum] + _ ≤ finiteResolvent ρ eig b := by + apply Finset.sum_le_sum + intro a _ + exact div_le_div_of_nonneg_left (hρ a) (sub_pos.mpr (hb a)) (by linarith [heig a]) + +/-- Section 6's bound for the uncapped inverse transform. -/ +theorem finiteR_bounds {ρ eig : ι → ℝ} {b x l u : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (hl : ∀ a, l ≤ eig a) (hu : ∀ a, eig a ≤ u) + (hb : u < b) (hx : 0 < x) (hbx : finiteResolvent ρ eig b = x) : + l ≤ b - 1 / x ∧ b - 1 / x ≤ u := by + have hbeig : ∀ a, eig a < b := fun a => lt_of_le_of_lt (hu a) hb + have hupper := finiteResolvent_le hρ hρsum hu hb + have hlower := le_finiteResolvent hρ hρsum hl hbeig + rw [hbx] at hupper hlower + obtain ⟨a, _⟩ := exists_pos_spectral_weight hρ hρsum + have hbl : 0 < b - l := by linarith [hl a, hbeig a] + have hbu : 0 < b - u := sub_pos.mpr hb + have hbux : (b - u) * x ≤ 1 := by + simpa only [mul_comm] using (le_div_iff₀ hbu).mp hupper + have hblx : 1 ≤ (b - l) * x := by + simpa only [mul_comm] using (div_le_iff₀ hbl).mp hlower + constructor + · have : 1 / x ≤ b - l := (div_le_iff₀ hx).mpr hblx + linarith + · have : b - u ≤ 1 / x := (le_div_iff₀ hx).mpr hbux + linarith + +theorem finiteResolvent_translate (ρ eig : ι → ℝ) (b c : ℝ) : + finiteResolvent ρ (fun a => eig a + c) (b + c) = finiteResolvent ρ eig b := by + unfold finiteResolvent + congr 1 + ext a + congr 1 + ring + +/-- The transform of a point mass is the constant equal to its atom. -/ +theorem finiteResolvent_constant {ρ : ι → ℝ} (hρsum : ∑ a, ρ a = 1) + (b c : ℝ) : + finiteResolvent ρ (fun _ => c) b = 1 / (b - c) := by + unfold finiteResolvent + rw [← Finset.sum_div, hρsum] + +theorem constant_spectrum_solution {ρ : ι → ℝ} + (hρsum : ∑ a, ρ a = 1) {x c : ℝ} (hx : 0 < x) : + finiteResolvent ρ (fun _ => c) (c + 1 / x) = x := by + rw [finiteResolvent_constant hρsum] + have hx0 : x ≠ 0 := ne_of_gt hx + field_simp + ring + +theorem finiteResolvent_sq_le_second {ρ eig : ι → ℝ} {b : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) : + finiteResolvent ρ eig b ^ 2 ≤ finiteSecondResolvent ρ eig b := by + let r := finiteResolvent ρ eig b + have hnonneg : 0 ≤ ∑ a, ρ a * (1 / (b - eig a) - r) ^ 2 := by + exact Finset.sum_nonneg fun a _ => mul_nonneg (hρ a) (sq_nonneg _) + have hexpand : + (∑ a, ρ a * (1 / (b - eig a) - r) ^ 2) = + finiteSecondResolvent ρ eig b - 2 * r * finiteResolvent ρ eig b + r ^ 2 := by + calc + _ = ∑ a, (ρ a / (b - eig a) ^ 2 - + 2 * r * (ρ a / (b - eig a)) + r ^ 2 * ρ a) := by + apply Finset.sum_congr rfl + intro a _ + simp only [div_eq_mul_inv, ← inv_pow] + ring + _ = _ := by + simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, + ← Finset.mul_sum, hρsum, mul_one, finiteSecondResolvent, finiteResolvent] + rw [hexpand] at hnonneg + dsimp [r] at hnonneg + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralApproximationSqueeze.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralApproximationSqueeze.lean new file mode 100644 index 0000000000000000000000000000000000000000..db162b055d9fa170e3f39065df1d1a0dcbddf90f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralApproximationSqueeze.lean @@ -0,0 +1,34 @@ +import Mathlib.Topology.Instances.Real.Lemmas +import Mathlib.Tactic.Linarith + +namespace OAI + +/-! The final two-scale squeeze used in compact spectral approximation. -/ + +noncomputable section +open Filter +open scoped Topology + +namespace InvariantIsing + +lemma spectral_approximation_squeeze (p : ℕ → ℝ) (lo hi : ℕ → ℕ → ℝ) + (v δ : ℕ → ℝ) (L : ℝ) (hv : Tendsto v atTop (𝓝 L)) + (hδ : Tendsto δ atTop (𝓝 0)) + (hlo : ∀ k, Tendsto (lo k) atTop (𝓝 (v k))) + (hhi : ∀ k, Tendsto (hi k) atTop (𝓝 (v k))) + (hbound : ∀ k, ∀ᶠ N in atTop, lo k N-δ k/2 ≤ p N ∧ p N ≤ hi k N+δ k/2) : + Tendsto p atTop (𝓝 L) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + obtain ⟨k,hk,hdk⟩ := ((Metric.tendsto_nhds.mp hv (ε/3) (by positivity)).and + (Metric.tendsto_nhds.mp hδ (ε/3) (by positivity))).exists + filter_upwards [Metric.tendsto_nhds.mp (hlo k) (ε/3) (by positivity), + Metric.tendsto_nhds.mp (hhi k) (ε/3) (by positivity),hbound k] with N hl hu hp + rw [Real.dist_eq,abs_lt] at hk hdk hl hu ⊢ + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayDiagonalLimit.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayDiagonalLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..7148c29b99d3f664ad98c06b79d35271460f1c13 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayDiagonalLimit.lean @@ -0,0 +1,73 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralArrayGG +import Mathlib.MeasureTheory.Measure.Prokhorov + +namespace OAI + +/-! Compact array/center subsequences and constant limiting diagonals. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped BigOperators Topology BoundedContinuousFunction + +namespace InvariantIsing + +lemma spectralArray_center_subsequence (m : ℕ) (L : ℕ → ProbabilityMeasure (SpectralArray m)) + (c : ℕ → Fin m → Set.Icc (0 : ℝ) 1) : + ∃ Q : ProbabilityMeasure (SpectralArray m), ∃ q : Fin m → Set.Icc (0 : ℝ) 1, + ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (L ∘ φ) atTop (nhds Q) ∧ + Tendsto (c ∘ φ) atTop (nhds q) := by + obtain ⟨p, φ, hφ, hp⟩ := CompactSpace.tendsto_subseq (fun k => (L k, c k)) + refine ⟨p.1, p.2, φ, hφ, ?_, ?_⟩ + · exact (continuous_fst.tendsto p).comp hp + · exact (continuous_snd.tendsto p).comp hp + +/-- Vanishing actual L1 self-overlap fluctuations and converging compact +centers give deterministic diagonals in the weak limiting array. -/ +theorem spectralArray_constant_diagonal_of_weak_limit {m : ℕ} + (L : ℕ → ProbabilityMeasure (SpectralArray m)) (Q : ProbabilityMeasure (SpectralArray m)) + (hL : Tendsto L atTop (nhds Q)) (center : ℕ → Fin m → ℝ) (q : Fin m → ℝ) + (hc : Tendsto center atTop (nhds q)) + (hdiag : ∀ i a, Tendsto + (fun k => ∫ x, |(x (i, i) a : ℝ) - center k a| ∂(L k : Measure (SpectralArray m))) + atTop (nhds 0)) : + ∀ᵐ x ∂(Q : Measure (SpectralArray m)), ∀ i a, (x (i, i) a : ℝ) = q a := by + apply ae_all_iff.mpr + intro i + apply ae_all_iff.mpr + intro a + let F := fun x : SpectralArray m => |(x (i, i) a : ℝ) - q a| + have hF : Continuous F := by fun_prop + have hfixed : Tendsto (fun k => ∫ x, F x ∂(L k : Measure (SpectralArray m))) atTop + (nhds (∫ x, F x ∂(Q : Measure (SpectralArray m)))) := by + exact (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hL) + (BoundedContinuousFunction.mkOfCompact ⟨F, hF⟩) + have hbound (k : ℕ) : (∫ x, F x ∂(L k : Measure (SpectralArray m))) ≤ + (∫ x, |(x (i, i) a : ℝ) - center k a| ∂(L k : Measure (SpectralArray m))) + |center k a - q a| := by + have hg : Continuous (fun x : SpectralArray m => |(x (i, i) a : ℝ) - center k a|) := by fun_prop + calc + _ ≤ ∫ x, |(x (i, i) a : ℝ) - center k a| + |center k a - q a| + ∂(L k : Measure (SpectralArray m)) := + integral_mono (compact_integrable hF) (compact_integrable (hg.add continuous_const)) + (fun x => abs_sub_le _ _ _) + _ = _ := by + rw [integral_add (compact_integrable hg) (integrable_const _)] + simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] + have hcenter : Tendsto (fun k => |center k a - q a|) atTop (nhds 0) := by + simpa only [sub_self, abs_zero] using + (((tendsto_pi_nhds.mp hc a).sub + (tendsto_const_nhds : Tendsto (fun _ : ℕ => q a) atTop (nhds (q a)))).abs) + have hzero : Tendsto (fun k => ∫ x, F x ∂(L k : Measure (SpectralArray m))) atTop (nhds 0) := + squeeze_zero (fun k => integral_nonneg (fun x => abs_nonneg _)) hbound + (by simpa only [add_zero] using (hdiag i a).add hcenter) + have hz : (∫ x, F x ∂(Q : Measure (SpectralArray m))) = 0 := tendsto_nhds_unique hfixed hzero + have hae := (integral_eq_zero_iff_of_nonneg (fun x : SpectralArray m => abs_nonneg ((x (i, i) a : ℝ) - q a)) + (compact_integrable hF)).mp hz + filter_upwards [hae] with x hx + exact sub_eq_zero.mp (abs_eq_zero.mp hx) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayEnergy.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..39e46f6081846c590c7758adc2a53518260ce49f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayEnergy.lean @@ -0,0 +1,102 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorArrayLaw +import OAI.Probability.InvariantIsing.Spectral.SpectralPartition +import OAI.Probability.InvariantIsing.Spectral.SpectralTemperature + +namespace OAI + +/-! The interaction before temperature multiplication is an exact bounded +continuous spectral-array observable, so its Gibbs mean passes to weak limits. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma normalized_rotatedEnergy_eq_blocks {N m : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) (lam : Fin m → ℝ) + (hlam : ∀ a i, i ∈ I a → eig i = lam a) (σ : Spin N) : + (N : ℝ)⁻¹ * rotatedEnergy eig U σ = + (1 / 2 : ℝ) * ∑ a, lam a * projectedOverlap U (I a) σ σ := by + classical + have hs : (∑ a, ∑ i ∈ I a, eig i * (U (spinVector σ) i) ^ 2) = + ∑ i, eig i * (U (spinVector σ) i) ^ 2 := by + rw [← Finset.sum_biUnion (show Set.PairwiseDisjoint + (↑(Finset.univ : Finset (Fin m))) I by simpa using hdis), hcover] + have he : (∑ i, eig i * (U (spinVector σ) i) ^ 2) = + ∑ a, lam a * ∑ i ∈ I a, (U (spinVector σ) i) ^ 2 := by + rw [← hs] + apply Finset.sum_congr rfl + intro a _ + rw [Finset.mul_sum] + exact Finset.sum_congr rfl (fun i hi => by rw [hlam a i hi]) + simp only [rotatedEnergy, he, projectedOverlap, ← pow_two, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + ring_nf + +def spectralArrayInteractionEnergy {m : ℕ} (lam : Fin m → ℝ) + (x : SpectralArray (m + 1)) : ℝ := + (1 / 2 : ℝ) * ∑ a, lam a * (x (0,0) a.castSucc : ℝ) + +lemma continuous_spectralArrayInteractionEnergy {m : ℕ} (lam : Fin m → ℝ) : + Continuous (spectralArrayInteractionEnergy lam) := by + unfold spectralArrayInteractionEnergy + fun_prop + +lemma tensorNamespacedArrayLaw_interactionEnergy {N m k n : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (modelEig energyEig c : Fin N → ℝ) (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) (lam : Fin m → ℝ) + (hlam : ∀ a i, i ∈ I a → energyEig i = lam a) + (degree : Fin k → Fin m → ℕ) (amp : Fin k → ℝ) + (b : ℕ → ℝ) (treeDegree : Fin k → ℕ) (h : ℕ → ℝ) : + (∫ x, spectralArrayInteractionEnergy lam x + ∂(tensorNamespacedArrayLaw μ modelEig c I degree amp n b treeDegree h : + Measure (SpectralArray (m + 1)))) = + tensorNamespacedReplicaAverage μ modelEig c I degree amp n b treeDegree h + (fun U (σ : Fin 1 → Spin N × LabeledLeaf n) => + (N : ℝ)⁻¹ * rotatedEnergy energyEig (specialRotation U) (σ 0).1) := by + apply tensorNamespacedArrayLaw_test μ modelEig c I degree amp n b treeDegree h + _ (continuous_spectralArrayInteractionEnergy lam) _ + (fun i : Fin 1 => i.val) Fin.val_injective + intro U σ + simp only [spectralArrayInteractionEnergy, spectralJointEntry_spectral, Fin.val_zero] + exact (normalized_rotatedEnergy_eq_blocks energyEig (specialRotation U) I hdis hcover lam hlam (σ 0).1).symm + +lemma spectralArrayInteractionEnergy_weak_limit {m : ℕ} + {L : ℕ → ProbabilityMeasure (SpectralArray (m + 1))} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} (hL : Tendsto L atTop (𝓝 Q)) + (lam : Fin m → ℝ) : + Tendsto (fun k => ∫ x, spectralArrayInteractionEnergy lam x + ∂(L k : Measure (SpectralArray (m + 1)))) atTop + (𝓝 (∫ x, spectralArrayInteractionEnergy lam x ∂(Q : Measure (SpectralArray (m + 1))))) := + (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hL) + (BoundedContinuousFunction.mkOfCompact ⟨_, continuous_spectralArrayInteractionEnergy lam⟩) + +lemma spectralArrayInteractionEnergy_eq_finiteEnergy {m : ℕ} + (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (q : Fin (m + 1) → ℝ) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (ρ lam : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + {t : ℝ} (ht : 0 ≤ t) (p : OverlapPath) + (hdiag : ∀ a, q a.castSucc = spectralGroupDiagonal ρ (fun a => t * lam a) hρ hρsum p a) : + (∫ x, spectralArrayInteractionEnergy lam x ∂(Q : Measure (SpectralArray (m + 1)))) = + finiteInteractionEnergy ρ lam hρ hρsum t p := by + rw [finiteInteractionEnergy_eq_groupDiagonal ρ lam hρ hρsum ht p] + calc + _ = ∫ _x : SpectralArray (m + 1), (1 / 2 : ℝ) * ∑ a, lam a * q a.castSucc + ∂(Q : Measure (SpectralArray (m + 1))) := by + apply integral_congr_ae + filter_upwards [hd] with x hx + simp only [spectralArrayInteractionEnergy, hx] + _ = _ := by simp only [integral_const, probReal_univ, one_smul, hdiag] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayGG.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..fda6244fd04361dae153a037e9f1bb78e1bda561 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayGG.lean @@ -0,0 +1,268 @@ +import OAI.Probability.IsingPerceptron.JointGGClosure + +namespace OAI + +/-! Multivariate monomial GG closure for the finite vector of spectral overlaps. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology ENNReal NNReal BoundedContinuousFunction + +namespace InvariantIsing + +abbrev SpectralEntry (m : ℕ) := Fin m → Set.Icc (-1 : ℝ) 1 +abbrev SpectralArray (m : ℕ) := (ℕ × ℕ) → SpectralEntry m +abbrev SpectralBlock (m n : ℕ) := Fin n → Fin n → SpectralEntry m + +def spectralEntryMonomial {m : ℕ} (d : Fin m → ℕ) (x : SpectralEntry m) : ℝ := + ∏ a, (x a : ℝ) ^ d a + +lemma continuous_spectralEntryMonomial {m : ℕ} (d : Fin m → ℕ) : + Continuous (spectralEntryMonomial d) := by + exact continuous_finsetProd _ fun a _ => ((continuous_apply a).subtype_val).pow _ + +def spectralBlockView (m n : ℕ) (x : SpectralArray m) : SpectralBlock m n := + fun i j => x (i, j) + +def spectralBlockLink (m n i j : ℕ) (x : SpectralArray m) : SpectralBlock m n × SpectralEntry m := + (spectralBlockView m n x, x (i, j)) + +lemma continuous_spectralBlockView (m n : ℕ) : Continuous (spectralBlockView m n) := by + unfold spectralBlockView + fun_prop + +lemma continuous_spectralBlockLink (m n i j : ℕ) : Continuous (spectralBlockLink m n i j) := + (continuous_spectralBlockView m n).prodMk (continuous_apply _) + +private def spectralBlockPairCoordinate (m n : ℕ) + (i : ((Fin n × Fin n) × Fin m) ⊕ Fin m) + (x : SpectralBlock m n × SpectralEntry m) : ℝ := + match i with + | Sum.inl i => x.1 i.1.1 i.1.2 i.2 + | Sum.inr i => x.2 i + +private lemma continuous_spectralBlockPairCoordinate (m n : ℕ) + (i : ((Fin n × Fin n) × Fin m) ⊕ Fin m) : + Continuous (spectralBlockPairCoordinate m n i) := by + cases i <;> unfold spectralBlockPairCoordinate <;> fun_prop + +private lemma spectralBlockPairCoordinate_ext (m n : ℕ) + (x y : SpectralBlock m n × SpectralEntry m) + (h : ∀ i, spectralBlockPairCoordinate m n i x = spectralBlockPairCoordinate m n i y) : x = y := by + apply Prod.ext + · funext i j a + exact Subtype.ext (h (.inl ((i, j), a))) + · funext a + exact Subtype.ext (h (.inr a)) + +/-- Polynomial moments in the new link, with arbitrary continuous tests +of the old block, determine its full joint law. -/ +theorem spectralBlock_pair_monomials_unique (m n : ℕ) + (P Q : Measure (SpectralBlock m n × SpectralEntry m)) [IsFiniteMeasure P] [IsFiniteMeasure Q] + (h : ∀ D : SpectralBlock m n → ℝ, Continuous D → ∀ d : Fin m → ℕ, + (∫ x, D x.1 * spectralEntryMonomial d x.2 ∂P) = + ∫ x, D x.1 * spectralEntryMonomial d x.2 ∂Q) : P = Q := by + classical + have : TopologicalSpace.SeparableSpace (SpectralBlock m n × SpectralEntry m) := inferInstance + have : TopologicalSpace.IsCompletelyMetrizableSpace (SpectralBlock m n × SpectralEntry m) := inferInstance + let I := ((Fin n × Fin n) × Fin m) ⊕ Fin m + let g : I → ((SpectralBlock m n × SpectralEntry m) →ᵇ ℝ) := fun i => + BoundedContinuousFunction.mkOfCompact + ⟨spectralBlockPairCoordinate m n i, continuous_spectralBlockPairCoordinate m n i⟩ + let ev : MvPolynomial I ℝ →ₐ[ℝ] ((SpectralBlock m n × SpectralEntry m) →ᵇ ℝ) := + MvPolynomial.aeval g + let A : StarSubalgebra ℝ ((SpectralBlock m n × SpectralEntry m) →ᵇ ℝ) := + { ev.range with + star_mem' := by + intro f hf + have hs : star f = f := by ext x; simp + rw [hs] + exact hf } + have hap (i : I) (x : SpectralBlock m n × SpectralEntry m) : + g i x = spectralBlockPairCoordinate m n i x := rfl + have hsep : (A.map (BoundedContinuousFunction.toContinuousMapStarₐ ℝ)).SeparatesPoints := by + intro x y hxy + obtain ⟨i, hi⟩ : ∃ i : I, spectralBlockPairCoordinate m n i x ≠ + spectralBlockPairCoordinate m n i y := by + by_contra! hno + exact hxy (spectralBlockPairCoordinate_ext m n x y hno) + refine ⟨g i, ?_, ?_⟩ + · refine ⟨(g i).toContinuousMap, ?_, rfl⟩ + exact ⟨g i, ⟨MvPolynomial.X i, by simp [ev]⟩, rfl⟩ + · simpa only [hap] using hi + apply ext_of_forall_mem_subalgebra_integral_eq_of_polish hsep + intro f hf + obtain ⟨p, rfl⟩ := hf + induction p using MvPolynomial.induction_on' with + | add p q hp hq => + simpa only [map_add, BoundedContinuousFunction.coe_add, Pi.add_apply, + integral_add (BoundedContinuousFunction.integrable _ _) (BoundedContinuousFunction.integrable _ _)] + using congrArg₂ (· + ·) hp hq + | monomial k c => + let D : SpectralBlock m n → ℝ := fun b => + ∏ i : (Fin n × Fin n) × Fin m, (b i.1.1 i.1.2 i.2 : ℝ) ^ k (.inl i) + have hD : Continuous D := by + apply continuous_finsetProd + intro i _ + exact (by fun_prop : Continuous (fun b : SpectralBlock m n => (b i.1.1 i.1.2 i.2 : ℝ))).pow _ + have he (x : SpectralBlock m n × SpectralEntry m) : + ev (MvPolynomial.monomial k c) x = c * (D x.1 * spectralEntryMonomial (fun a => k (.inr a)) x.2) := by + simp only [ev, MvPolynomial.aeval_monomial] + rw [Finsupp.prod_pow] + simp only [BoundedContinuousFunction.coe_mul, Pi.mul_apply, + BoundedContinuousFunction.coe_prod, BoundedContinuousFunction.coe_pow, + BoundedContinuousFunction.algebraMap_apply, Finset.prod_apply, Pi.pow_apply, smul_eq_mul, mul_one] + change c * (∏ i : I, g i x ^ k i) = _ + rw [Fintype.prod_sum_type] + rfl + change (∫ x, ev (MvPolynomial.monomial k c) x ∂P) = + ∫ x, ev (MvPolynomial.monomial k c) x ∂Q + simp only [he, integral_const_mul] + exact congrArg (c * ·) (h D hD _) + +theorem spectral_monomial_measure_identity (m : ℕ) (μ : Measure (SpectralArray m)) + [IsProbabilityMeasure μ] (n : ℕ) (i : Fin n) + (h : ∀ D : SpectralBlock m n → ℝ, Continuous D → ∀ d : Fin m → ℕ, + (n : ℝ) * (∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, n)) ∂μ) = + (∫ x, D (spectralBlockView m n x) ∂μ) * (∫ x, spectralEntryMonomial d (x (0, 1)) ∂μ) + + ∑ j ∈ Finset.univ.erase i, + ∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, j)) ∂μ) : + (n : ℝ≥0∞) • μ.map (spectralBlockLink m n i n) = + (μ.map (spectralBlockView m n)).prod (μ.map (fun x => x (0, 1))) + + ∑ j ∈ Finset.univ.erase i, μ.map (spectralBlockLink m n i j) := by + classical + let block := μ.map (spectralBlockView m n) + let pair := μ.map (fun x => x (0, 1)) + let link := fun j : ℕ => μ.map (spectralBlockLink m n i j) + have : IsProbabilityMeasure block := (Measure.isProbabilityMeasure_map_iff + (continuous_spectralBlockView m n).measurable.aemeasurable).mpr inferInstance + have : IsProbabilityMeasure pair := (Measure.isProbabilityMeasure_map_iff + (measurable_pi_apply (0, 1)).aemeasurable).mpr inferInstance + have (j : ℕ) : IsProbabilityMeasure (link j) := (Measure.isProbabilityMeasure_map_iff + (continuous_spectralBlockLink m n i j).measurable.aemeasurable).mpr inferInstance + change (n : ℝ≥0∞) • link n = block.prod pair + ∑ j ∈ Finset.univ.erase i, link j + have : IsFiniteMeasure ((n : ℝ≥0∞) • link n) := (link n).smul_finite (by simp) + apply spectralBlock_pair_monomials_unique m n + intro D hD d + let F : SpectralBlock m n × SpectralEntry m → ℝ := fun x => D x.1 * spectralEntryMonomial d x.2 + have hF : Continuous F := (hD.comp continuous_fst).mul + ((continuous_spectralEntryMonomial d).comp continuous_snd) + have hi (j : ℕ) : (∫ x, F x ∂link j) = + ∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, j)) ∂μ := + integral_map (continuous_spectralBlockLink m n i j).measurable.aemeasurable hF.aestronglyMeasurable + change (∫ x, F x ∂(n : ℝ≥0∞) • link n) = ∫ x, F x ∂(block.prod pair + ∑ j ∈ Finset.univ.erase i, link j) + rw [integral_smul_measure, ENNReal.toReal_natCast, smul_eq_mul, + integral_add_measure (compact_integrable hF) (compact_integrable hF), + integral_finsetSum_measure (fun j _ => compact_integrable hF), hi] + simp_rw [hi] + rw [h D hD d] + congr 1 + have hp := continuous_spectralEntryMonomial d + have he : (∫ x, F x ∂block.prod pair) = + (∫ b, D b ∂block) * (∫ x, spectralEntryMonomial d x ∂pair) := + integral_prod_mul D (spectralEntryMonomial d) + rw [he, integral_map (continuous_spectralBlockView m n).measurable.aemeasurable hD.aestronglyMeasurable, + integral_map (measurable_pi_apply (0, 1)).aemeasurable hp.aestronglyMeasurable] + +theorem spectral_monomialGG_measurable (m : ℕ) (μ : Measure (SpectralArray m)) [IsProbabilityMeasure μ] + (h : ∀ n, 2 ≤ n → ∀ i : Fin n, ∀ D : SpectralBlock m n → ℝ, Continuous D → ∀ d : Fin m → ℕ, + (n : ℝ) * (∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, n)) ∂μ) = + (∫ x, D (spectralBlockView m n x) ∂μ) * (∫ x, spectralEntryMonomial d (x (0, 1)) ∂μ) + + ∑ j ∈ Finset.univ.erase i, + ∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, j)) ∂μ) : + HasEntryGhirlandaGuerra (fun x i j => x (i, j)) μ := by + classical + intro n hn i A hA t ht + have he := congrArg (fun ν : Measure (SpectralBlock m n × SpectralEntry m) => (ν (A ×ˢ t)).toReal) + (spectral_monomial_measure_identity m μ n i (h n hn i)) + have hmap : ∀ j : ℕ, Measurable (spectralBlockLink m n i j) := fun j => + (continuous_spectralBlockLink m n i j).measurable + have hblock := (continuous_spectralBlockView m n).measurable + have hpair : Measurable (fun x : SpectralArray m => x (0, 1)) := measurable_pi_apply _ + simp only [Measure.smul_apply, smul_eq_mul, ENNReal.toReal_mul, ENNReal.toReal_natCast, + Measure.add_apply, Measure.prod_prod, Measure.finsetSum_apply, + Measure.map_apply (hmap _) (hA.prod ht), Measure.map_apply hblock hA, Measure.map_apply hpair ht] at he + rw [ENNReal.toReal_add (ENNReal.mul_ne_top (measure_ne_top _ _) (measure_ne_top _ _)) + (ENNReal.sum_ne_top.mpr (fun j _ => measure_ne_top _ _)), ENNReal.toReal_mul, + ENNReal.toReal_sum (fun j _ => measure_ne_top _ _)] at he + change (n : ℝ) * μ.real ({x | spectralBlockView m n x ∈ A} ∩ {x | x (i, n) ∈ t}) = + μ.real {x | spectralBlockView m n x ∈ A} * μ.real {x | x (0, 1) ∈ t} + + ∑ j ∈ Finset.univ.erase i, μ.real ({x | spectralBlockView m n x ∈ A} ∩ {x | x (i, j) ∈ t}) at he + change μ.real ({x | spectralBlockView m n x ∈ A} ∩ {x | x (i, n) ∈ t}) = + (μ.real {x | spectralBlockView m n x ∈ A} * μ.real {x | x (0, 1) ∈ t}) / n + + (∑ j ∈ Finset.univ.erase i, μ.real ({x | spectralBlockView m n x ∈ A} ∩ {x | x (i, j) ∈ t})) / n + have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) + field_simp [hn0] + nlinarith [he] + +def spectralMonomialResidual {m : ℕ} (μ : Measure (SpectralArray m)) (n : ℕ) (i : Fin n) + (D : SpectralBlock m n → ℝ) (d : Fin m → ℕ) : ℝ := + (n : ℝ) * (∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, n)) ∂μ) - + (∫ x, D (spectralBlockView m n x) ∂μ) * (∫ x, spectralEntryMonomial d (x (0, 1)) ∂μ) - + ∑ j ∈ Finset.univ.erase i, + ∫ x, D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, j)) ∂μ + +lemma spectralMonomialResidual_zero {m : ℕ} (μ : Measure (SpectralArray m)) [IsProbabilityMeasure μ] + (n : ℕ) (i : Fin n) (D : SpectralBlock m n → ℝ) : + spectralMonomialResidual μ n i D 0 = 0 := by + classical + have hn : 1 ≤ n := by have hi := i.isLt; omega + simp only [spectralMonomialResidual, spectralEntryMonomial, Pi.zero_apply, pow_zero, + Finset.prod_const_one, mul_one, integral_const, probReal_univ, one_smul, + Finset.sum_const, Finset.card_erase_of_mem (Finset.mem_univ i), Finset.card_univ, + Fintype.card_fin, nsmul_eq_mul, Nat.cast_sub hn, Nat.cast_one] + ring + +lemma spectralMonomialResidual_weak_limit {m : ℕ} {L : ℕ → ProbabilityMeasure (SpectralArray m)} + {μ : ProbabilityMeasure (SpectralArray m)} (hL : Tendsto L atTop (𝓝 μ)) + (n : ℕ) (i : Fin n) (D : SpectralBlock m n → ℝ) (hD : Continuous D) (d : Fin m → ℕ) : + Tendsto (fun N => spectralMonomialResidual (L N) n i D d) atTop + (𝓝 (spectralMonomialResidual μ n i D d)) := by + have hI : ∀ F : SpectralArray m → ℝ, Continuous F → + Tendsto (fun N => ∫ x, F x ∂(L N : Measure (SpectralArray m))) atTop + (𝓝 (∫ x, F x ∂(μ : Measure (SpectralArray m)))) := by + intro F hF + exact (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hL) + (BoundedContinuousFunction.mkOfCompact ⟨F, hF⟩) + have hcD := hD.comp (continuous_spectralBlockView m n) + have ht (j : ℕ) := hI (fun x => D (spectralBlockView m n x) * spectralEntryMonomial d (x (i, j))) + (hcD.mul ((continuous_spectralEntryMonomial d).comp (continuous_apply _))) + exact (((ht n).const_mul (n : ℝ)).sub ((hI _ hcD).mul + (hI _ ((continuous_spectralEntryMonomial d).comp (continuous_apply _))))).sub + (tendsto_finsetSum _ fun j _ => ht j) + +/-- Vanishing monomial residuals imply the Ghirlanda–Guerra identities +for the weak limit of the spectral overlap arrays. -/ +theorem spectralGG_of_weak_monomial_residuals {m : ℕ} {L : ℕ → ProbabilityMeasure (SpectralArray m)} + {μ : ProbabilityMeasure (SpectralArray m)} (hL : Tendsto L atTop (𝓝 μ)) + (hg : ∀ n, 2 ≤ n → ∀ i : Fin n, ∀ D : SpectralBlock m n → ℝ, Continuous D → ∀ d : Fin m → ℕ, + Tendsto (fun N => spectralMonomialResidual (L N) n i D d) atTop (𝓝 0)) : + HasEntryGhirlandaGuerra (fun x i j => x (i, j)) (μ : Measure (SpectralArray m)) := by + apply spectral_monomialGG_measurable + intro n hn i D hD d + have he := tendsto_nhds_unique (spectralMonomialResidual_weak_limit hL n i D hD d) + (hg n hn i D hD d) + dsimp only [spectralMonomialResidual] at he + linarith + +theorem spectralGG_of_weak_nonconstant_monomial_residuals {m : ℕ} + {L : ℕ → ProbabilityMeasure (SpectralArray m)} {μ : ProbabilityMeasure (SpectralArray m)} + (hL : Tendsto L atTop (𝓝 μ)) + (hg : ∀ n, 2 ≤ n → ∀ i : Fin n, ∀ D : SpectralBlock m n → ℝ, Continuous D → + ∀ d : Fin m → ℕ, d ≠ 0 → + Tendsto (fun N => spectralMonomialResidual (L N) n i D d) atTop (𝓝 0)) : + HasEntryGhirlandaGuerra (fun x i j => x (i, j)) (μ : Measure (SpectralArray m)) := by + apply spectralGG_of_weak_monomial_residuals hL + intro n hn i D hD d + by_cases hd : d = 0 + · subst d + simpa only [spectralMonomialResidual_zero] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℝ)) atTop (𝓝 0)) + · exact hg n hn i D hD d hd + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayGeometry.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..43996883e205001c98fc2e6400ee2770c20a36dc --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralArrayGeometry.lean @@ -0,0 +1,132 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralReplicaLaw +import OAI.Probability.IsingPerceptron.ArrayGeometry + +namespace OAI + +/-! Gram structure and replica symmetry for spectral arrays retaining common disorder. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology Matrix + +namespace InvariantIsing + +def permuteSpectralArray {m : ℕ} (e : ℕ → ℕ) (x : SpectralArray m) : SpectralArray m := + fun ij => x (e ij.1, e ij.2) + +lemma continuous_permuteSpectralArray {m : ℕ} (e : ℕ → ℕ) : + Continuous (permuteSpectralArray (m := m) e) := by + unfold permuteSpectralArray + fun_prop + +lemma disorderReplicaLaw_map_reindex {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + [Countable X] [MeasurableSingletonClass X] (P : Measure Ω) [IsProbabilityMeasure P] + (ν : Ω → Measure X) (hν : Measurable ν) [∀ ω, IsProbabilityMeasure (ν ω)] + (e : ℕ → ℕ) (he : Function.Injective e) : + (disorderReplicaLaw P ν hν).map (Prod.map id (fun σ i => σ (e i))) = + disorderReplicaLaw P ν hν := by + unfold disorderReplicaLaw + rw [← Measure.compProd_map (by fun_prop)] + congr 1 + apply Kernel.ext + intro ω + rw [Kernel.map_apply _ (by fun_prop)] + change (Measure.infinitePi (fun _ : ℕ => ν ω)).map (fun σ i => σ (e i)) = + Measure.infinitePi (fun _ : ℕ => ν ω) + exact Measure.map_infinitePi_infinitePi_of_inj he + +lemma spectralArrayLaw_map_reindex {Ω : Type*} [MeasurableSpace Ω] {N m : ℕ} + (P : Measure Ω) [IsProbabilityMeasure P] (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (I : Fin m → Finset (Fin N)) (n : ℕ) + (ν : Ω → Measure (Spin N × LabeledLeaf n)) (hν : Measurable ν) + [∀ ω, IsProbabilityMeasure (ν ω)] (e : ℕ → ℕ) (he : Function.Injective e) : + (spectralArrayLaw P U hU I n ν hν : Measure (SpectralArray (m + 1))).map + (permuteSpectralArray e) = spectralArrayLaw P U hU I n ν hν := by + change ((disorderReplicaLaw P ν hν).map (spectralReplicaArray U I n)).map _ = _ + rw [Measure.map_map (continuous_permuteSpectralArray e).measurable + (measurable_spectralReplicaArray U hU I n)] + have heq : permuteSpectralArray e ∘ spectralReplicaArray U I n = + spectralReplicaArray U I n ∘ Prod.map id (fun σ i => σ (e i)) := rfl + rw [heq, ← Measure.map_map (measurable_spectralReplicaArray U hU I n) (by fun_prop), + disorderReplicaLaw_map_reindex P ν hν e he] + rfl + +lemma spectralArray_limit_reindex {m : ℕ} {L : ℕ → ProbabilityMeasure (SpectralArray m)} + {Q : ProbabilityMeasure (SpectralArray m)} (hL : Tendsto L atTop (𝓝 Q)) + (e : ℕ → ℕ) + (hE : ∀ k, (L k : Measure (SpectralArray m)).map (permuteSpectralArray e) = L k) : + (Q : Measure (SpectralArray m)).map (permuteSpectralArray e) = Q := by + have hc := (ProbabilityMeasure.continuous_map (continuous_permuteSpectralArray e)).tendsto Q + have he : (fun k => (L k).map (permuteSpectralArray e)) = L := by + funext k + exact Subtype.ext (hE k) + have ht := hc.comp hL + change Tendsto (fun k => (L k).map (permuteSpectralArray e)) _ _ at ht + rw [he] at ht + have heq : Q.map (permuteSpectralArray e) = Q := tendsto_nhds_unique ht hL + exact congrArg Subtype.val heq + +lemma scalar_of_spectral_exchangeable {m : ℕ} {Q : ProbabilityMeasure (SpectralArray m)} + (hE : ∀ e : Equiv.Perm ℕ, + (Q : Measure (SpectralArray m)).map (permuteSpectralArray e) = Q) + (f : SpectralEntry m → ℝ) (hf : Measurable f) : + WeaklyExchangeable (fun x i j => f (x (i,j))) (Q : Measure (SpectralArray m)) := by + intro e _ + have hm : Measurable (fun x : SpectralArray m => fun i j => f (x (i,j))) := by fun_prop + refine ⟨hm.aemeasurable, (hm.comp (continuous_permuteSpectralArray e).measurable).aemeasurable, ?_⟩ + calc + _ = ((Q : Measure (SpectralArray m)).map (permuteSpectralArray e)).map + (fun x i j => f (x (i,j))) := + congrArg (Measure.map (fun x i j => f (x (i,j)))) (hE e).symm + _ = _ := Measure.map_map hm (continuous_permuteSpectralArray e).measurable + +def spectralCoordinateArray {m : ℕ} (a : Fin m) (x : SpectralArray m) : RealArray := + fun i j => x (i,j) a + +lemma continuous_spectralCoordinateArray {m : ℕ} (a : Fin m) : + Continuous (spectralCoordinateArray a) := by + unfold spectralCoordinateArray + fun_prop + +def SpectralGram {m : ℕ} (x : SpectralArray m) : Prop := + ∀ a n, Matrix.PosSemidef (fun i j : Fin n => spectralCoordinateArray a x i j) + +lemma isClosed_spectralGram (m : ℕ) : IsClosed {x : SpectralArray m | SpectralGram x} := by + unfold SpectralGram + simp only [Set.ofPred_forall] + exact isClosed_iInter fun a => isClosed_iInter fun n => + (isClosed_setOf_posSemidef n).preimage (by unfold spectralCoordinateArray; fun_prop) + +lemma spectralReplicaArray_gram {Ω : Type*} {N m : ℕ} (U : Ω → SpecialOrthogonal N) + (I : Fin m → Finset (Fin N)) (n : ℕ) + (p : Ω × (ℕ → Spin N × LabeledLeaf n)) : SpectralGram (spectralReplicaArray U I n p) := by + intro a z + refine Fin.lastCases ?_ (fun j => ?_) a + · simpa only [spectralCoordinateArray, spectralReplicaArray, spectralJointEntry_tree] using + treeOverlap_posSemidef n (fun i : Fin z => (p.2 i).2) + · simpa only [spectralCoordinateArray, spectralReplicaArray, spectralJointEntry_spectral] using + projectedOverlap_posSemidef (specialRotation (U p.1)) (I j) (fun i : Fin z => (p.2 i).1) + +lemma spectralArrayLaw_gram {Ω : Type*} [MeasurableSpace Ω] {N m : ℕ} + (P : Measure Ω) [IsProbabilityMeasure P] (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (I : Fin m → Finset (Fin N)) (n : ℕ) + (ν : Ω → Measure (Spin N × LabeledLeaf n)) (hν : Measurable ν) + [∀ ω, IsProbabilityMeasure (ν ω)] : + ∀ᵐ x ∂(spectralArrayLaw P U hU I n ν hν : Measure (SpectralArray (m + 1))), SpectralGram x := by + change ∀ᵐ x ∂(disorderReplicaLaw P ν hν).map (spectralReplicaArray U I n), SpectralGram x + rw [ae_map_iff (measurable_spectralReplicaArray U hU I n).aemeasurable + (isClosed_spectralGram (m + 1)).measurableSet] + exact ae_of_all _ (spectralReplicaArray_gram U I n) + +lemma spectralArray_limit_gram {m : ℕ} {L : ℕ → ProbabilityMeasure (SpectralArray m)} + {Q : ProbabilityMeasure (SpectralArray m)} (hL : Tendsto L atTop (𝓝 Q)) + (hG : ∀ k, ∀ᵐ x ∂(L k : Measure (SpectralArray m)), SpectralGram x) : + ∀ᵐ x ∂(Q : Measure (SpectralArray m)), SpectralGram x := + ae_closed_of_weak_limit hL (isClosed_spectralGram m) hG + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBallPartition.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBallPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..882af2113e7249096acd88a2f0e4de030c266be8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBallPartition.lean @@ -0,0 +1,74 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPartitionIndex + +namespace OAI + +/-! A finite ball cover yields a measurable partition, including a +zero-mass residual cell outside the covered spectral support. -/ + +noncomputable section +open MeasureTheory Set +open scoped Topology Classical Function + +namespace InvariantIsing + +def spectralBallCell {n : ℕ} (B : Fin n → Set ℝ) : Option (Fin n) → Set ℝ + | none => (⋃ i, B i)ᶜ + | some i => disjointed B i + +lemma spectralBallCell_cover {n : ℕ} (B : Fin n → Set ℝ) (x : ℝ) : + ∃ i, x∈spectralBallCell B i := by + by_cases hx : x∈⋃ i, B i + · rw [← iUnion_disjointed] at hx + obtain ⟨i,hi⟩ := mem_iUnion.mp hx + exact ⟨some i,hi⟩ + · exact ⟨none,hx⟩ + +lemma spectralBallCell_disjoint {n : ℕ} (B : Fin n → Set ℝ) : + Pairwise (Disjoint on spectralBallCell B) := by + intro i j hij + cases i with + | none => + cases j with + | none => exact (hij rfl).elim + | some j => + apply Set.disjoint_left.mpr + intro x hx hy + exact hx (mem_iUnion.mpr ⟨j,disjointed_subset B j hy⟩) + | some i => + cases j with + | none => + apply Set.disjoint_left.mpr + intro x hx hy + exact hy (mem_iUnion.mpr ⟨i,disjointed_subset B i hx⟩) + | some j => exact disjoint_disjointed B (fun h => hij (congrArg some h)) + +lemma spectralBallCell_measurable {n : ℕ} (B : Fin n → Set ℝ) + (hB : ∀ i, MeasurableSet (B i)) (i : Option (Fin n)) : + MeasurableSet (spectralBallCell B i) := by + cases i with + | none => exact (MeasurableSet.iUnion hB).compl + | some i => + rw [spectralBallCell,disjointed_apply,Finset.sup_eq_iSup] + exact (hB i).diff (MeasurableSet.iUnion fun j => MeasurableSet.iUnion fun _ => hB j) + +lemma spectralBallCell_null_boundary {n : ℕ} (μ : Measure ℝ) (B : Fin n → Set ℝ) + (hB : ∀ i, μ (frontier (B i))=0) (i : Option (Fin n)) : + μ (frontier (spectralBallCell B i))=0 := by + cases i with + | none => + change μ (frontier (⋃ i, B i)ᶜ)=0 + rw [frontier_compl] + simpa only [Finset.mem_univ,iUnion_true] using + null_frontier_finsetUnion μ Finset.univ B (fun i _ => hB i) + | some i => exact null_frontier_disjointed μ B hB i + +lemma spectralBallCell_residual_null {n : ℕ} (μ : Measure ℝ) (B : Fin n → Set ℝ) + (K : Set ℝ) (hμ : μ Kᶜ=0) (hcover : K ⊆ ⋃ i, B i) : + μ (spectralBallCell B none)=0 := + measure_mono_null (compl_subset_compl.mpr hcover) hμ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBallQuantizer.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBallQuantizer.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b35349a63f7e0c2f15422708d919103f8c8afdd --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBallQuantizer.lean @@ -0,0 +1,56 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralBallPartition + +namespace OAI + +/-! The actual finite quantizer attached to the null-boundary ball cover. -/ + +noncomputable section +open MeasureTheory Set Metric +open scoped Topology Classical Function + +namespace InvariantIsing + +def spectralBallQuantizer {n : ℕ} (c r : Fin n → ℝ) (fallback : ℝ) (x : ℝ) : ℝ := + (spectralPartitionIndex (spectralBallCell (fun i => ball (c i) (r i))) + (spectralBallCell_cover _) x).elim fallback c + +lemma measurable_spectralBallQuantizer {n : ℕ} (c r : Fin n → ℝ) (fallback : ℝ) : + Measurable (spectralBallQuantizer c r fallback) := by + let : MeasurableSpace (Option (Fin n)) := ⊤ + exact (measurable_of_countable (fun i : Option (Fin n) => i.elim fallback c)).comp + (measurable_spectralPartitionIndex _ (spectralBallCell_cover _) (spectralBallCell_disjoint _) + (spectralBallCell_measurable _ (fun _ => measurableSet_ball))) + +lemma spectralBallQuantizer_close {n : ℕ} (c r : Fin n → ℝ) (fallback δ x : ℝ) + (hr : ∀ i, r i ≤ δ) (hx : x∈⋃ i, ball (c i) (r i)) : + dist (spectralBallQuantizer c r fallback x) x ≤ δ := by + let B := fun i => ball (c i) (r i) + let j := spectralPartitionIndex (spectralBallCell B) (spectralBallCell_cover B) x + have hj : x∈spectralBallCell B j := spectralPartitionIndex_mem _ _ x + cases h : j with + | none => + have hh : x ∉ ⋃ i, B i := by simpa only [h,spectralBallCell, Set.mem_compl_iff] using hj + exact False.elim (hh hx) + | some i => + have hxi : x∈B i := disjointed_subset B i (by simpa only [h,spectralBallCell] using hj) + have hd : dist x (c i) < r i := hxi + have he : spectralBallQuantizer c r fallback x=c i := by + change j.elim fallback c=c i + rw [h] + rfl + rw [he,dist_comm] + exact hd.le.trans (hr i) + +lemma spectralBallQuantizer_mem {n : ℕ} (c r : Fin n → ℝ) (fallback : ℝ) (K : Set ℝ) + (hc : ∀ i, c i∈K) (hf : fallback∈K) (x : ℝ) : spectralBallQuantizer c r fallback x∈K := by + unfold spectralBallQuantizer + cases spectralPartitionIndex (spectralBallCell (fun i => ball (c i) (r i))) + (spectralBallCell_cover _) x with + | none => exact hf + | some i => exact hc i + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBoundedSynchronization.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBoundedSynchronization.lean new file mode 100644 index 0000000000000000000000000000000000000000..f85f9537dae621ed840dbaf7a1602a2c0e5c3a3f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralBoundedSynchronization.lean @@ -0,0 +1,44 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPathSynchronization + +namespace OAI + +/-! Bounded Lipschitz group factors for the replica-product application. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Set + +namespace InvariantIsing + +theorem spectralPartition_bounded_synchronization {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (a : Fin m) : + ∃ f : ℝ → ℝ, LipschitzWith 1 f ∧ (∀ r, f r ∈ Icc (0 : ℝ) 1) ∧ + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i j, i ≠ j → + (x (i,j) a.castSucc : ℝ) = f (spectralSpinArray x i j) := by + obtain ⟨f, hf, hpair⟩ := spectralPartition_lipschitz_synchronization hgg hG q hq hd + (fun e => hE e e.injective) hP hn a + let g : ℝ → ℝ := fun r => min (max (f r) 0) 1 + have hg : LipschitzWith 1 g := (hf.max_const 0).min_const 1 + have hgb (r : ℝ) : g r ∈ Icc (0 : ℝ) 1 := + ⟨le_min (le_max_right _ _) zero_le_one, min_le_right _ _⟩ + have hgp : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (0,1) a.castSucc : ℝ) = g (spectralSpinArray x 0 1) := by + filter_upwards [hpair, hn] with x hx hnx + dsimp only [g] + rw [← hx, max_eq_left (hnx a.castSucc), min_eq_left (x (0,1) a.castSucc).property.2] + exact ⟨g, hg, hgb, spectral_factor_all_off_diagonal hE a g hg.continuous hgp⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCalculus.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..31b338cb041ce7fd1fd9a22990f6c57b303cc324 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCalculus.lean @@ -0,0 +1,219 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralExistence +import Mathlib.Analysis.Calculus.InverseFunctionTheorem.Deriv +import Mathlib.Analysis.Calculus.Deriv.Inv +import Mathlib.Analysis.Calculus.Deriv.Add +import Mathlib.Analysis.Calculus.Deriv.Pow + +namespace OAI + +/-! +Differentiation of the finite spectral inverse. The inverse function +theorem is applied to the already constructed inverse; no regularity of +that inverse is assumed. +-/ + +noncomputable section + +open scoped BigOperators Topology +open Filter + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +/-- Third resolvent moment. -/ +def finiteThirdResolvent (ρ eig : ι → ℝ) (b : ℝ) : ℝ := + ∑ a, ρ a / (b - eig a) ^ 3 + +theorem finiteSecondResolvent_pos {ρ eig : ι → ℝ} {b : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (hb : ∀ a, eig a < b) : + 0 < finiteSecondResolvent ρ eig b := by + obtain ⟨a, ha⟩ := exists_pos_spectral_weight hρ hρsum + unfold finiteSecondResolvent + exact Finset.sum_pos' (fun a _ => div_nonneg (hρ a) (sq_nonneg _)) + ⟨a, Finset.mem_univ a, div_pos ha (sq_pos_of_pos (sub_pos.mpr (hb a)))⟩ + +/-- The Cauchy–Schwarz inequality used for convexity of `x ↦ x R(t x)`. -/ +theorem finiteSecondResolvent_sq_le_first_mul_third {ρ eig : ι → ℝ} {b : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hb : ∀ a, eig a < b) : + finiteSecondResolvent ρ eig b ^ 2 ≤ + finiteResolvent ρ eig b * finiteThirdResolvent ρ eig b := by + apply Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul + · intro a _ + exact div_nonneg (hρ a) (sub_pos.mpr (hb a)).le + · intro a _ + exact div_nonneg (hρ a) (pow_nonneg (sub_pos.mpr (hb a)).le 3) + · intro a _ + apply le_of_eq + field_simp [ne_of_gt (sub_pos.mpr (hb a))] + +theorem hasStrictDerivAt_finiteResolvent (ρ eig : ι → ℝ) {b : ℝ} + (hb : ∀ a, eig a < b) : + HasStrictDerivAt (finiteResolvent ρ eig) (-finiteSecondResolvent ρ eig b) b := by + have hterm : ∀ a, HasStrictDerivAt (fun z : ℝ => ρ a / (z - eig a)) + (-ρ a / (b - eig a) ^ 2) b := by + intro a + simpa only [id_eq, zero_mul, mul_one, zero_sub] using + (hasStrictDerivAt_const b (ρ a)).fun_div + ((hasStrictDerivAt_id b).sub_const (eig a)) (ne_of_gt (sub_pos.mpr (hb a))) + convert! HasStrictDerivAt.fun_sum (u := Finset.univ) (fun a _ => hterm a) using 1 + simp only [finiteSecondResolvent, neg_div, Finset.sum_neg_distrib] + +theorem hasStrictDerivAt_finiteSecondResolvent (ρ eig : ι → ℝ) {b : ℝ} + (hb : ∀ a, eig a < b) : + HasStrictDerivAt (finiteSecondResolvent ρ eig) (-2 * finiteThirdResolvent ρ eig b) b := by + have hterm : ∀ a, HasStrictDerivAt (fun z : ℝ => ρ a / (z - eig a) ^ 2) + (-2 * (ρ a / (b - eig a) ^ 3)) b := by + intro a + have hd : HasStrictDerivAt (fun z : ℝ => z - eig a) 1 b := by + convert! (hasStrictDerivAt_id b).sub_const (eig a) using 1 + convert (hasStrictDerivAt_const b (ρ a)).fun_div + (hd.fun_pow 2) + (pow_ne_zero 2 (ne_of_gt (sub_pos.mpr (hb a)))) using 1 + field_simp [ne_of_gt (sub_pos.mpr (hb a))] + ring + convert! HasStrictDerivAt.fun_sum (u := Finset.univ) (fun a _ => hterm a) using 1 + simp only [finiteThirdResolvent, Finset.mul_sum] + +/-- Inverse transform for a finite alphabet with positive masses. +The value outside positive arguments is irrelevant to the application. -/ +def finiteInverse (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (x : ℝ) : ℝ := + if hx : 0 < x then (exists_unique_finiteResolvent_of_pos (eig := eig) hρ hρsum hx).choose else 0 + +theorem finiteInverse_spec (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + (∀ a, eig a < finiteInverse ρ eig hρ hρsum x) ∧ + finiteResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) = x := by + simp only [finiteInverse, dite_eq_left hx] + exact (exists_unique_finiteResolvent_of_pos (eig := eig) hρ hρsum hx).choose_spec.1 + +theorem finiteInverse_left (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {b : ℝ} (hb : ∀ a, eig a < b) : + finiteInverse ρ eig hρ hρsum (finiteResolvent ρ eig b) = b := by + have hx := finiteResolvent_pos (fun a => (hρ a).le) hρsum hb + have hs := finiteInverse_spec ρ eig hρ hρsum hx + exact finiteResolvent_solution_unique (fun a => (hρ a).le) hρsum hs.1 hb hs.2 rfl + +/-- The exact inverse derivative appearing in the finite-spectrum calculation. -/ +theorem hasStrictDerivAt_finiteInverse (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + HasStrictDerivAt (finiteInverse ρ eig hρ hρsum) + (-1 / finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x)) x := by + let b := finiteInverse ρ eig hρ hρsum x + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hpos := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + have hd := hasStrictDerivAt_finiteResolvent ρ eig hs.1 + have hnear : ∀ᶠ z : ℝ in 𝓝 b, ∀ a, eig a < z := by + apply Filter.eventually_all.mpr + intro a + exact Ioi_mem_nhds (hs.1 a) + have hinv : ∀ᶠ z : ℝ in 𝓝 b, + finiteInverse ρ eig hρ hρsum (finiteResolvent ρ eig z) = z := by + filter_upwards [hnear] with z hz + exact finiteInverse_left ρ eig hρ hρsum hz + have hi := hd.to_local_left_inverse (neg_ne_zero.mpr hpos.ne') hinv + rw [hs.2] at hi + simpa only [inv_neg, one_div, neg_div] using hi + +/-- Finite-alphabet `R`-transform, with its prescribed value at zero. -/ +def finiteR (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (x : ℝ) : ℝ := + if 0 < x then finiteInverse ρ eig hρ hρsum x - 1 / x else ∑ a, ρ a * eig a + +theorem hasStrictDerivAt_finiteR (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + HasStrictDerivAt (finiteR ρ eig hρ hρsum) + (-1 / finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) + 1 / x ^ 2) x := by + have hb := hasStrictDerivAt_finiteInverse ρ eig hρ hρsum hx + have hi : HasStrictDerivAt (fun y : ℝ => 1 / y) (-1 / x ^ 2) x := by + simpa using (hasStrictDerivAt_const x (1 : ℝ)).fun_div + (hasStrictDerivAt_id x) (ne_of_gt hx) + have h := hb.fun_sub hi + have heq : finiteR ρ eig hρ hρsum =ᶠ[𝓝 x] + fun y => finiteInverse ρ eig hρ hρsum y - 1 / y := by + filter_upwards [Ioi_mem_nhds hx] with y hy + simp only [finiteR, ite_eq_left (show 0 < y from hy)] + convert h.congr_of_eventuallyEq heq.symm using 1 + ring + +theorem finiteR_derivative_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + 0 ≤ -1 / finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) + 1 / x ^ 2 := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hsecond := finiteResolvent_sq_le_second (fun a => (hρ a).le) hρsum + (eig := eig) (b := finiteInverse ρ eig hρ hρsum x) + rw [hs.2] at hsecond + have h := one_div_le_one_div_of_le (sq_pos_of_pos hx) hsecond + simp only [neg_div] + linarith + +theorem hasStrictDerivAt_finiteInverseDerivative (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + HasStrictDerivAt + (fun y => -1 / finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum y)) + (2 * finiteThirdResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) / + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 3) x := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hpos := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + have hb := hasStrictDerivAt_finiteInverse ρ eig hρ hρsum hx + have hm := (hasStrictDerivAt_finiteSecondResolvent ρ eig hs.1).comp x hb + convert (hasStrictDerivAt_const x (-1 : ℝ)).fun_div hm hpos.ne' using 1 + · rfl + · simp only [Function.comp_apply] + field_simp [hpos.ne'] + ring + +/-- First derivative of `x R(x)`, in a form without cancellation at zero. -/ +def finiteEnergyDerivative (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (x : ℝ) : ℝ := + finiteInverse ρ eig hρ hρsum x + + x * (-1 / finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x)) + +theorem hasStrictDerivAt_mul_finiteR (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + HasStrictDerivAt (fun y => y * finiteR ρ eig hρ hρsum y) + (finiteEnergyDerivative ρ eig hρ hρsum x) x := by + have hr := hasStrictDerivAt_finiteR ρ eig hρ hρsum hx + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hpos := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + convert (hasStrictDerivAt_id x).fun_mul hr using 1 + · rfl + · simp only [id_eq, finiteR, ite_eq_left hx, finiteEnergyDerivative] + field_simp [ne_of_gt hx, hpos.ne'] + ring + +/-- The second derivative used in manuscript `up:energy`. -/ +theorem hasStrictDerivAt_finiteEnergyDerivative (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + HasStrictDerivAt (finiteEnergyDerivative ρ eig hρ hρsum) + (2 * (x * finiteThirdResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) - + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 2) / + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 3) x := by + have hb := hasStrictDerivAt_finiteInverse ρ eig hρ hρsum hx + have hbp := hasStrictDerivAt_finiteInverseDerivative ρ eig hρ hρsum hx + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hpos := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + convert hb.fun_add ((hasStrictDerivAt_id x).fun_mul hbp) using 1 + · rfl + · simp only [id_eq] + field_simp [hpos.ne'] + ring + +theorem finiteEnergy_secondDerivative_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + 0 ≤ 2 * (x * finiteThirdResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) - + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 2) / + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 3 := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hm := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + have hcs := finiteSecondResolvent_sq_le_first_mul_third (fun a => (hρ a).le) hs.1 + rw [hs.2] at hcs + exact div_nonneg (mul_nonneg (by norm_num) (sub_nonneg.mpr hcs)) (pow_nonneg hm.le 3) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalIdentification.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..a65806223a49a79de1571fe3154acb5348e5aac1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalIdentification.lean @@ -0,0 +1,48 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCanonicalSymbols +import OAI.Probability.InvariantIsing.Fields.CanonicalRootReconstruction + +namespace OAI + +/-! The actual off-diagonal and diagonal limiting Ward equations identify +the canonical spectral-group paths and their deterministic diagonals. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + + theorem spectralCanonical_identification {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (ρ eig : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hoff : ∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ C : ℝ, 0 ≤ C → (∀ r, |Φ r| ≤ C) → + spectralOffWardResidual Q ρ eig a b Φ = 0) + (hdiag : ∀ a b, spectralDiagonalWardResidual Q ρ eig a b = 0) : + let p := spectralSpinQuantilePath Q hP hn + (∀ a, q a.castSucc = spectralGroupDiagonal ρ eig hρ hρsum p a) ∧ + ∀ᵐ s ∂pathMeasure, ∀ a, spectralGroupQuantilePath Q hn a s = + spectralGroupPath ρ eig hρ hρsum p a s := by + intro p + have hs := spectralCanonical_symbols hgg hG q hq hd hE hP hn ρ eig hρ hρsum hoff hdiag + apply canonical_groups_identification_of_symbols_rootWard ρ eig hρ hρsum p + (spectralGroupQuantilePath Q hn) (fun a => q a.castSucc) + · intro a + filter_upwards [hs] with s hs + exact hs a + · exact spectralPartition_quantile_sum hgg hG q hq hd (fun e => hE e e.injective) hP hn + · intro a b + exact (spectralCanonicalWard_pair hgg hG q hq hd hE hP hn ρ eig a b (hoff a b) (hdiag a b)).2 + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalSymbols.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalSymbols.lean new file mode 100644 index 0000000000000000000000000000000000000000..3700686c9a3b5a311f3b05a990601f1188abe5b0 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalSymbols.lean @@ -0,0 +1,118 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCanonicalWard +import OAI.Probability.InvariantIsing.Spectral.SpectralReconstruction +import OAI.Probability.InvariantIsing.Arrays.PathSymbolCongruence + +namespace OAI + +/-! Positive semidefinite array geometry supplies the diagonal bound needed +for nonnegative canonical group symbols. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma gramDiagonal_pair_le {B : RealArray} {d : ℝ} (h : GramDiagonal d B) : + B 0 1 ≤ d := by + have hp := (h.1 2).dotProduct_mulVec_nonneg (![1, -1] : Fin 2 → ℝ) + simp only [dotProduct, Matrix.mulVec, Fin.sum_univ_two, star_trivial, + Matrix.cons_val_zero, Matrix.cons_val_one, Fin.isValue, + Fin.val_zero, Fin.val_one, one_mul, mul_one, neg_mul, mul_neg] at hp + rw [h.2 0, h.2 1, ← h.symm 0 1] at hp + linarith + +lemma spectralGroupQuantilePath_le_diagonal {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (a : Fin m) : + ∀ᵐ s ∂pathMeasure, spectralGroupQuantilePath Q hn a s ≤ q a.castSucc := by + have hx : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + spectralLinearArray (Pi.single a.castSucc 1) x 0 1 ≤ q a.castSucc := by + filter_upwards [hG, hd] with x hx hdx + simpa only [spectralLinearArray_single] using + gramDiagonal_pair_le (spectralGram_diagonal hx q hdx a.castSucc) + have hm : Measurable (fun x : SpectralArray (m + 1) => + spectralLinearArray (Pi.single a.castSucc 1) x 0 1) := by + unfold spectralLinearArray spectralLinearEntry + fun_prop + have hy : ∀ᵐ r ∂spectralLinearLaw Q (Pi.single a.castSucc 1), r ≤ q a.castSucc := + (ae_map_iff hm.aemeasurable measurableSet_Iic).mpr hx + rw [← spectralQuantilePath_law Q (Pi.single a.castSucc 1) + (spectralCoordinate_unit hn a.castSucc)] at hy + exact (ae_map_iff (spectralGroupQuantilePath Q hn a).measurable.aemeasurable + measurableSet_Iic).mp hy + +lemma OverlapPath.symbol_nonneg_ae (p : OverlapPath) (d : ℝ) + (hd : ∀ᵐ s ∂pathMeasure, p s ≤ d) : + ∀ᵐ s ∂pathMeasure, 0 ≤ pathSymbol d p s := by + have hdv : ∀ᵐ u ∂volume, u ∈ Ioo (0 : ℝ) 1 → p u ≤ d := + (ae_restrict_iff' measurableSet_Ioo).mp hd + filter_upwards [hd, ae_restrict_mem measurableSet_Ioo] with s hs hsmem + have ht : ∀ᵐ u ∂volume.restrict (Icc s 1), p u ≤ d := by + apply (ae_restrict_iff' measurableSet_Icc).mpr + filter_upwards [hdv, volume.ae_ne (1 : ℝ)] with u hu hu1 humem + exact hu ⟨hsmem.1.trans_le humem.1, lt_of_le_of_ne humem.2 hu1⟩ + have hi := intervalIntegral.integral_mono_ae_restrict hsmem.2.le + p.monotone.intervalIntegrable intervalIntegrable_const ht + rw [intervalIntegral.integral_const, smul_eq_mul] at hi + have hm := mul_le_mul_of_nonneg_left hs hsmem.1.le + unfold pathSymbol + nlinarith + +lemma sum_pathSymbols_ae {ι : Type*} [Fintype ι] (pa : ι → OverlapPath) + (p : OverlapPath) (q : ι → ℝ) (hq : ∑ a, q a = 1) + (hsum : ∀ᵐ s ∂pathMeasure, (∑ a, pa a s) = p s) : + ∀ᵐ s ∂pathMeasure, (∑ a, pathSymbol (q a) (pa a) s) = deficit p (p s) := by + filter_upwards [hsum, ae_restrict_mem measurableSet_Ioo] with s hs hsmem + simp only [pathSymbol, Finset.sum_sub_distrib, ← Finset.mul_sum] + rw [hq, hs, ← intervalIntegral.integral_finsetSum + (fun a _ => (pa a).monotone.intervalIntegrable), + intervalIntegral_congr_path_ae hsum hsmem.1.le le_rfl hsmem.2.le] + exact (deficit_at_path_eq_symbol p ⟨hsmem.1.le, hsmem.2.le⟩).symm + + theorem spectralCanonical_symbols {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (ρ eig : Fin m → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (hoff : ∀ a b, ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ C : ℝ, 0 ≤ C → (∀ r, |Φ r| ≤ C) → + spectralOffWardResidual Q ρ eig a b Φ = 0) + (hdiag : ∀ a b, spectralDiagonalWardResidual Q ρ eig a b = 0) : + ∀ᵐ s ∂pathMeasure, ∀ a, + pathSymbol (q a.castSucc) (spectralGroupQuantilePath Q hn a) s = + projectedResolvent ρ eig hρ hρsum a + (deficit (spectralSpinQuantilePath Q hP hn) (spectralSpinQuantilePath Q hP hn s)) := by + let pa := spectralGroupQuantilePath Q hn + let p := spectralSpinQuantilePath Q hP hn + have hnn : ∀ᵐ s ∂pathMeasure, ∀ a, 0 ≤ pathSymbol (q a.castSucc) (pa a) s := + ae_all_iff.mpr fun a => (pa a).symbol_nonneg_ae (q a.castSucc) + (spectralGroupQuantilePath_le_diagonal hG q hd hn a) + have hws : ∀ᵐ s ∂pathMeasure, ∀ a b, + ρ b * pathSymbol (q a.castSucc) (pa a) s - + ρ a * pathSymbol (q b.castSucc) (pa b) s = + (eig a - eig b) * pathSymbol (q a.castSucc) (pa a) s * pathSymbol (q b.castSucc) (pa b) s := + ae_all_iff.mpr fun a => ae_all_iff.mpr fun b => + (spectralCanonicalWard_pair hgg hG q hq hd hE hP hn ρ eig a b (hoff a b) (hdiag a b)).1 + have hsum : ∀ᵐ s ∂pathMeasure, (∑ a, pathSymbol (q a.castSucc) (pa a) s) = deficit p (p s) := + sum_pathSymbols_ae pa p (fun a => q a.castSucc) (spectralPartition_diagonal_sum hP q hd) + (spectralPartition_quantile_sum hgg hG q hq hd (fun e => hE e e.injective) hP hn) + filter_upwards [hnn, hws, hsum] with s hs hw hsum + intro a + rw [spectral_symbol_reconstruction ρ eig hρ hρsum + (fun a => pathSymbol (q a.castSucc) (pa a) s) hs hw a, hsum] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalWard.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalWard.lean new file mode 100644 index 0000000000000000000000000000000000000000..11440f883a9b22642a721261737147ec5f428f11 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCanonicalWard.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralWardSymbols +import OAI.Probability.InvariantIsing.Spectral.SpectralQuantileSynchronization +import OAI.Probability.InvariantIsing.Arrays.PathSymbolCongruence + +namespace OAI + +/-! Both limiting Ward identities act on the canonical group quantiles, +independently of the synchronized factors chosen for a pair of groups. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped Topology + +namespace InvariantIsing + + theorem spectralCanonicalWard_pair {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (ρ eig : Fin m → ℝ) (a b : Fin m) + (hoff : ∀ Φ : ℝ → ℝ, Continuous Φ → ∀ C : ℝ, 0 ≤ C → (∀ r, |Φ r| ≤ C) → + spectralOffWardResidual Q ρ eig a b Φ = 0) + (hdiag : spectralDiagonalWardResidual Q ρ eig a b = 0) : + let A := spectralGroupQuantilePath Q hn a + let B := spectralGroupQuantilePath Q hn b + (∀ᵐ s ∂pathMeasure, ρ b * pathSymbol (q a.castSucc) A s - + ρ a * pathSymbol (q b.castSucc) B s = + (eig a - eig b) * pathSymbol (q a.castSucc) A s * pathSymbol (q b.castSucc) B s) ∧ + (ρ b * Function.rightLim A.val 0 - ρ a * Function.rightLim B.val 0 = + (eig a - eig b) * + ((q a.castSucc - ∫ u in 0..1, A u) * Function.rightLim B.val 0 + + Function.rightLim A.val 0 * (q b.castSucc - ∫ u in 0..1, B u))) := by + intro A B + obtain ⟨f, g, hf, hg, hfb, hgb, hfa, hga, hw⟩ := + spectralPartition_offWardPath hgg hG q hq hd hE hP hn ρ eig a b hoff + have hfa01 : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (0,1) a.castSucc : ℝ) = f (spectralSpinArray x 0 1) := by + filter_upwards [hfa] with x hx + exact hx 0 1 (by omega) + have hga01 : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (0,1) b.castSucc : ℝ) = g (spectralSpinArray x 0 1) := by + filter_upwards [hga] with x hx + exact hx 0 1 (by omega) + have hEperm := fun e : Equiv.Perm ℕ => hE e e.injective + have hAf := spectralGroupQuantilePath_eq_factor hgg hG q hq hd hEperm hP hn a f hf.continuous hfa01 + have hBg := spectralGroupQuantilePath_eq_factor hgg hG q hq hd hEperm hP hn b g hg.continuous hga01 + obtain ⟨hsymbol, hroot⟩ := spectralSynchronizedWard_symbols Q hP hn q hd ρ eig a b + f g hf hg hfb hgb hfa01 hga01 hdiag hw + refine ⟨?_, ?_⟩ + · filter_upwards [hsymbol, pathSymbol_congr_ae (q a.castSucc) hAf, + pathSymbol_congr_ae (q b.castSucc) hBg] with s hs ha hb + rw [ha, hb] + exact hs + · have hAr := synchronized_quantile_root f hf.continuous hAf + have hBr := synchronized_quantile_root g hg.continuous hBg + rw [hAr, hBr, intervalIntegral_congr_path_ae hAf le_rfl le_rfl zero_le_one, + intervalIntegral_congr_path_ae hBg le_rfl le_rfl zero_le_one] + exact hroot + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralClipping.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralClipping.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7420566c89d2a30611cbca3c2b6febacd798761 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralClipping.lean @@ -0,0 +1,90 @@ +import OAI.Probability.InvariantIsing.Spectral.EmpiricalSpectralLaw +import OAI.Probability.InvariantIsing.Cavity.CavitySpectralSqueeze + +namespace OAI + +/-! Clipping the finite spectra to the limiting support interval. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology Classical + +namespace InvariantIsing + +def spectralClip (a b x : ℝ) : ℝ := max a (min b x) + +lemma continuous_spectralClip (a b : ℝ) : Continuous (spectralClip a b) := + continuous_const.max (continuous_const.min continuous_id) + +lemma spectralClip_mem {a b : ℝ} (hab : a ≤ b) (x : ℝ) : spectralClip a b x∈Icc a b := + ⟨le_max_left _ _,max_le hab (min_le_left _ _)⟩ + +lemma spectralClip_eq {a b x : ℝ} (hx : x∈Icc a b) : spectralClip a b x=x := by + simp only [spectralClip,min_eq_right hx.2,max_eq_right hx.1] + +lemma spectralClip_close {a b x η : ℝ} (hab : a ≤ b) (hη : 0 ≤ η) + (hx : a-η ≤ x ∧ x ≤ b+η) : |spectralClip a b x-x| ≤ η := by + by_cases ha : x < a + · have he : spectralClip a b x=a := by simp [spectralClip,min_eq_right (ha.le.trans hab),max_eq_left ha.le] + rw [he,abs_of_nonneg (sub_nonneg.mpr ha.le)] + linarith [hx.1] + · by_cases hb : b < x + · have he : spectralClip a b x=b := by simp [spectralClip,min_eq_left hb.le,max_eq_right hab] + rw [he,abs_of_nonpos (sub_nonpos.mpr hb.le)] + linarith [hx.2] + · rw [spectralClip_eq ⟨le_of_not_gt ha,le_of_not_gt hb⟩,sub_self,abs_zero] + exact hη + +lemma spectral_clip_empirical_tendsto + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) : + Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) + (fun i => spectralClip a b (eig (k+1) i))) atTop (𝓝 ν) := by + have he : ν.map (spectralClip a b)=ν := by + apply ProbabilityMeasure.toMeasure_injective + rw [ProbabilityMeasure.toMeasure_map] + have h : spectralClip a b =ᵐ[(ν : Measure ℝ)] id := by + filter_upwards [(ν : Measure ℝ).support_mem_ae] with x hx + exact spectralClip_eq (hbound hx) + rw [Measure.map_congr h,Measure.map_id] + have hh := ProbabilityMeasure.tendsto_map_of_tendsto_of_continuous _ ν hweak + (continuous_spectralClip a b) + rw [he] at hh + apply hh.congr + intro k + apply ProbabilityMeasure.toMeasure_injective + exact empiricalSpectralLaw_map _ _ _ (continuous_spectralClip a b).measurable + +lemma spectral_clip_mean_pressure_close {N : ℕ} (hN : 0 < N) + (μ : Measure (Orthogonal N)) [IsProbabilityMeasure μ] (eig : Fin N → ℝ) + (a b η : ℝ) (hab : a ≤ b) (hη : 0 ≤ η) + (heig : ∀ i, a-η ≤ eig i ∧ eig i ≤ b+η) : + |(∫ V, rotatedPressure (fun i => spectralClip a b (eig i)) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ)- + ∫ V, rotatedPressure eig (matrixRotation V⁻¹) (fun _ => 0) ∂μ| ≤ η/2 := by + let K := (∑ i, |eig i|)+|a|+|b| + have hsum : 0 ≤ ∑ i, |eig i| := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + have hi i : |eig i| ≤ K := by + have hh := Finset.single_le_sum (fun i _ => abs_nonneg (eig i)) (Finset.mem_univ i) + dsimp [K] + linarith [abs_nonneg a,abs_nonneg b] + have hc i : |spectralClip a b (eig i)| ≤ K := by + have hh := spectralClip_mem hab (eig i) + rw [abs_le] + dsimp [K] + constructor <;> linarith [hh.1,hh.2,neg_abs_le a,le_abs_self b,abs_nonneg a,abs_nonneg b] + have hd i := abs_le.mp (spectralClip_close hab hη (heig i)) + have hh := cavity_meanPressure_squeeze hN μ eig + (fun i => spectralClip a b (eig i)) (fun i => spectralClip a b (eig i)) + (fun _ => 0) η K hi hc hc + (fun i => by linarith [(hd i).2]) (fun i => by linarith [(hd i).1]) + rw [abs_le] + constructor <;> linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralComparison.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ee12625918fd35d498ed86e95330a79c8bdb108 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralComparison.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCountComparison + +namespace OAI + +/-! Monotonicity and scalar shifts for the pointwise and mean pressures. +These are the finite-volume squeeze estimates used in spectral discretization. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators + +namespace InvariantIsing + +lemma rotatedEnergy_mono {N : ℕ} (eig kap : Fin N → ℝ) (U : Rotation N) + (h : ∀ i, eig i ≤ kap i) (σ : Spin N) : + rotatedEnergy eig U σ ≤ rotatedEnergy kap U σ := by + unfold rotatedEnergy + apply mul_le_mul_of_nonneg_left _ (by norm_num) + exact Finset.sum_le_sum fun i _ => mul_le_mul_of_nonneg_right (h i) (sq_nonneg _) + +lemma rotatedPressure_mono {N : ℕ} (eig kap c : Fin N → ℝ) (U : Rotation N) + (h : ∀ i, eig i ≤ kap i) : + rotatedPressure eig U c ≤ rotatedPressure kap U c := by + have hp := logPartition_le_add + (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + (fun σ => rotatedEnergy kap U σ + fieldEnergy c σ) 0 + (fun σ => by simpa only [add_zero] using add_le_add (rotatedEnergy_mono eig kap U h σ) le_rfl) + simpa only [rotatedPressure, add_zero] using + mul_le_mul_of_nonneg_left hp (inv_nonneg.mpr (Nat.cast_nonneg N)) + +lemma rotatedEnergy_add_scalar {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (a : ℝ) (σ : Spin N) : + rotatedEnergy (fun i => eig i + a) U σ = rotatedEnergy eig U σ + a * N / 2 := by + simp only [rotatedEnergy, add_mul, Finset.sum_add_distrib, ← Finset.mul_sum, + rotated_spin_sq_sum] + ring + +lemma rotatedPressure_add_scalar {N : ℕ} (hN : 0 < N) + (eig c : Fin N → ℝ) (U : Rotation N) (a : ℝ) : + rotatedPressure (fun i => eig i + a) U c = rotatedPressure eig U c + a / 2 := by + have he : (fun σ => rotatedEnergy (fun i => eig i + a) U σ + fieldEnergy c σ) = + (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ + a * N / 2) := by + funext σ + rw [rotatedEnergy_add_scalar] + ring + rw [rotatedPressure, he, logPartition_add_const] + unfold rotatedPressure + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + field_simp + +lemma meanPressure_add_scalar {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (eig c : Fin N → ℝ) (a K : ℝ) (heig : ∀ i, |eig i| ≤ K) : + (∫ U, rotatedPressure (fun i => eig i + a) (specialRotation U) c ∂μ) = + (∫ U, rotatedPressure eig (specialRotation U) c ∂μ) + a / 2 := by + simp_rw [rotatedPressure_add_scalar hN] + rw [integral_add (integrable_countPressure hN μ eig c K heig) (integrable_const _)] + simp + +lemma meanPressure_squeeze {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (eig lo hi c : Fin N → ℝ) (δ K : ℝ) + (heig : ∀ i, |eig i| ≤ K) (hlo : ∀ i, |lo i| ≤ K) (hhi : ∀ i, |hi i| ≤ K) + (hl : ∀ i, lo i - δ ≤ eig i) (hu : ∀ i, eig i ≤ hi i + δ) : + (∫ U, rotatedPressure lo (specialRotation U) c ∂μ) - δ / 2 ≤ + ∫ U, rotatedPressure eig (specialRotation U) c ∂μ ∧ + (∫ U, rotatedPressure eig (specialRotation U) c ∂μ) ≤ + (∫ U, rotatedPressure hi (specialRotation U) c ∂μ) + δ / 2 := by + have hli : Integrable (fun U => rotatedPressure (fun i => lo i + -δ) (specialRotation U) c) μ := by + simp_rw [rotatedPressure_add_scalar hN] + exact (integrable_countPressure hN μ lo c K hlo).add (integrable_const _) + have hui : Integrable (fun U => rotatedPressure (fun i => hi i + δ) (specialRotation U) c) μ := by + simp_rw [rotatedPressure_add_scalar hN] + exact (integrable_countPressure hN μ hi c K hhi).add (integrable_const _) + have hei := integrable_countPressure hN μ eig c K heig + have hlow := integral_mono hli hei (fun U => + rotatedPressure_mono _ _ c (specialRotation U) (fun i => by simpa only [sub_eq_add_neg] using hl i)) + have hupp := integral_mono hei hui (fun U => rotatedPressure_mono _ _ c (specialRotation U) hu) + rw [meanPressure_add_scalar hN μ lo c (-δ) K hlo] at hlow + rw [meanPressure_add_scalar hN μ hi c δ K hhi] at hupp + exact ⟨by linarith, hupp⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContactContradiction.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContactContradiction.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b7cfa1922dd8f8728ceed62195e3b447fbbf87b --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContactContradiction.lean @@ -0,0 +1,31 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralTemperatureFunctional + +namespace OAI + +/-! The strict temperature tilt contradicts the energy order obtained from +contact tails. The energy sequence is the actual interaction observable +when this lemma is applied to contact minima. -/ + +noncomputable section +open MeasureTheory Set Filter +open scoped Topology + +namespace InvariantIsing + +lemma spectralContact_contradiction {ι : Type*} [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (p q : OverlapPath) {δ t : ℝ} (hδ : 0 < δ) (ht : 0 ≤ t) + (tk energy : ℕ → ℝ) (htk : Tendsto tk atTop (𝓝 t)) + (henergy : Tendsto energy atTop (𝓝 (finiteInteractionEnergy ρ eig hρ hρsum t p))) + (hcontact : ∀ᶠ k in atTop, finiteInteractionEnergy ρ eig hρ hρsum (tk k) q + δ ≤ energy k) + (htail : ∀ s ∈ Icc (0 : ℝ) 1, pathTail q s ≤ pathTail p s) : False := by + have hq := ((continuous_finiteInteractionEnergy_temperature ρ eig hρ hρsum q).tendsto t).comp htk + have hle := le_of_tendsto_of_tendsto (hq.add_const δ) henergy hcontact + have hord := finiteInteractionEnergy_mono_tail ρ eig hρ hρsum ht p q htail + linarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContactTails.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContactTails.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9661e8596fe990137f5d9fe04ed72a20e31c9f3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContactTails.lean @@ -0,0 +1,106 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorFieldTailBridge +import OAI.Probability.InvariantIsing.Arrays.TensorTreeLevels +import OAI.Probability.InvariantIsing.Core.FiniteTailOrder + +namespace OAI + +/-! Synchronized field-contact tests include the root and identify every +partition-endpoint tail without excluding atoms at those endpoints. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma spectralSpin_integral {m : ℕ} (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) : + (∫ x, spectralSpinArray x 0 1 ∂(Q : Measure (SpectralArray (m + 1)))) = + pathTail (spectralSpinQuantilePath Q hP hn) 0 := by + have hm : Measurable (fun x : SpectralArray (m + 1) => spectralSpinArray x 0 1) := by + unfold spectralSpinArray + fun_prop + have he := integral_map hm.aemeasurable + (measurable_id.aestronglyMeasurable : AEStronglyMeasurable (fun x : ℝ => x) + (scalarOverlapLaw (Q : Measure (SpectralArray (m + 1))) spectralSpinArray)) + change (∫ x : ℝ, x ∂scalarOverlapLaw (Q : Measure (SpectralArray (m + 1))) spectralSpinArray) = _ at he + rw [← spectralSpinQuantilePath_law Q hP hn, + integral_map (μ := pathMeasure) (f := fun x : ℝ => x) + (spectralSpinQuantilePath Q hP hn).measurable.aemeasurable + measurable_id.aestronglyMeasurable] at he + simp only [id_eq] at he + rw [← he, pathTail, intervalIntegral.integral_of_le zero_le_one, + integral_Ioc_eq_integral_Ioo] + rfl + +lemma spectralPair_depthTail_integral {m n : ℕ} + (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : Equiv.Perm ℕ, + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (hlevel : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (0,1) (Fin.last m) : ℝ) ∈ treeLevels n) + (cut : Fin (n + 2) → ℝ) (hfirst : cut 0 = 0) + (hb : ∀ i, cut i ∈ Icc (0 : ℝ) 1) + (htail : ∀ d : Fin n, (∫ x, treeTail n d (x (0,1) (Fin.last m) : ℝ) + ∂(Q : Measure (SpectralArray (m + 1)))) = 1 - cut d.succ.castSucc) + (j : Fin (n + 1)) : + (∫ x, spectralSpinDepthTail n j x ∂(Q : Measure (SpectralArray (m + 1)))) = + pathTail (spectralSpinQuantilePath Q hP hn) (cut j.castSucc) := by + refine Fin.cases ?_ (fun d => ?_) j + · simpa only [Fin.val_zero, Fin.castSucc_zero, hfirst, spectralSpinDepthTail, + depthTail, ite_true, mul_one] using spectralSpin_integral Q hP hn + · simpa only [spectralSpinDepthTail, Fin.val_succ, depthTail, + Nat.succ_ne_zero, ite_false, Nat.add_sub_cancel] using + spectralPair_treeTail_integral Q hgg hG q hq hd hE hP hn hlevel + (hb d.succ.castSucc) (htail d) + +lemma contact_partition_tail_order {n : ℕ} (p trial : OverlapPath) + (cut : Fin (n + 2) → ℝ) (hc : StrictMono cut) + (hfirst : cut 0 = 0) (hlast : cut (Fin.last (n + 1)) = 1) + (v : Fin (n + 1) → ℝ) + (hv : ∀ i s, s ∈ Ioo (cut i.castSucc) (cut i.succ) → trial s = v i) + (hcontact : ∀ j : Fin (n + 1), + (∑ i, ((cut i.succ - cut i.castSucc) * v i) * + finiteFieldPath (Pi.single j 1) i) ≤ pathTail p (cut j.castSucc)) : + ∀ s ∈ Icc (0 : ℝ) 1, pathTail trial s ≤ pathTail p s := by + apply pathTail_order_of_finite_partition p trial cut hc hfirst hlast v hv + intro j + refine Fin.lastCases ?_ (fun i => ?_) j + · simp only [hlast, pathTail, intervalIntegral.integral_same, le_refl] + · have he : (∫ s in Ioi (cut i.castSucc), trial s ∂pathMeasure) = + ∑ k, if i.val ≤ k.val then (cut k.succ - cut k.castSucc) * v k else 0 := by + have hstep : finiteStepFunction cut v =ᵐ[pathMeasure] trial := by + let : NullSingletonClass pathMeasure := by unfold pathMeasure; infer_instance + have hne : ∀ᵐ s ∂pathMeasure, ∀ k, s ≠ cut k := + ae_all_iff.mpr (fun k => Measure.ae_ne pathMeasure (cut k)) + filter_upwards [ae_restrict_mem measurableSet_Ioo, hne] with s hs hns + obtain ⟨k, hlo, hhi⟩ := finite_partition_cell cut + (by simpa only [hfirst] using hs.1.le) + (by simpa only [hlast] using hs.2) + have hk : s ∈ Ioo (cut k.castSucc) (cut k.succ) := + ⟨lt_of_le_of_ne hlo (hns k.castSucc).symm, hhi⟩ + rw [finiteStepFunction_on_cell hc v hk] + exact (hv k s hk).symm + rw [← integral_congr_ae hstep.restrict] + have ht := integral_finiteStep_tail cut hc hfirst hlast v i.castSucc + change (∫ s in Ioi (cut i.castSucc), finiteStepFunction cut v s ∂pathMeasure) = _ at ht + simpa only [Fin.le_def, Fin.val_castSucc] using ht + have hb : cut i.castSucc ∈ Icc (0 : ℝ) 1 := + ⟨by rw [← hfirst]; exact hc.monotone (Fin.zero_le _), + by rw [← hlast]; exact hc.monotone (Fin.le_last _)⟩ + rw [integral_pathMeasure_Ioi trial hb] at he + rw [he] + simpa only [finiteFieldPath_single, mul_ite, mul_one, mul_zero] using hcontact i + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..2df3bb1bd5235914d373eb11663b18e6d437b873 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralContinuity.lean @@ -0,0 +1,134 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralConvexity + +namespace OAI + +/-! A quantitative estimate at zero for the finite spectral transform. -/ + +noncomputable section + +open scoped BigOperators Topology +open Filter Set + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +/-- An exact remainder identity for the finite inverse resolvent. -/ +theorem finiteR_sub_mean (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + finiteR ρ eig hρ hρsum x - ∑ a, ρ a * eig a = + ∑ a, ρ a * (finiteR ρ eig hρ hρsum x - eig a) ^ 2 / + (finiteInverse ρ eig hρ hρsum x - eig a) := by + let b := finiteInverse ρ eig hρ hρsum x + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hterm : ∀ a, + ρ a * (b - 1 / x - eig a) ^ 2 / (b - eig a) = + ρ a * (b - eig a) - (2 / x) * ρ a + + (1 / x ^ 2) * (ρ a / (b - eig a)) := by + intro a + have hba : b - eig a ≠ 0 := (sub_pos.mpr (hs.1 a)).ne' + field_simp [hx.ne', hba] + ring + simp only [finiteR, ite_eq_left hx] + change b - 1 / x - ∑ a, ρ a * eig a = + ∑ a, ρ a * (b - 1 / x - eig a) ^ 2 / (b - eig a) + simp_rw [hterm, mul_sub] + simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.sum_mul, + ← Finset.mul_sum, hρsum, one_mul, mul_one] + change b - 1 / x - ∑ a, ρ a * eig a = + b - ∑ a, ρ a * eig a - 2 / x + (1 / x ^ 2) * finiteResolvent ρ eig b + rw [hs.2] + field_simp + ring + +theorem mean_le_finiteR (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) : + (∑ a, ρ a * eig a) ≤ finiteR ρ eig hρ hρsum x := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + apply sub_nonneg.mp + rw [finiteR_sub_mean ρ eig hρ hρsum hx] + exact Finset.sum_nonneg fun a _ => div_nonneg + (mul_nonneg (hρ a).le (sq_nonneg _)) (sub_pos.mpr (hs.1 a)).le + +/-- The uniform `O(K²x)` estimate from manuscript `gen:R-at-zero`. -/ +theorem finiteR_sub_mean_le (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {K x : ℝ} (_hK : 0 ≤ K) + (heig : ∀ a, |eig a| ≤ K) (hx : 0 < x) (hsmall : 4 * K * x ≤ 1) : + finiteR ρ eig hρ hρsum x - ∑ a, ρ a * eig a ≤ 8 * K ^ 2 * x := by + let b := finiteInverse ρ eig hρ hρsum x + let r := finiteR ρ eig hρ hρsum x + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hr := finiteR_mem_interval ρ eig hρ hρsum + (fun a => (abs_le.mp (heig a)).1) (fun a => (abs_le.mp (heig a)).2) x + have hbx : x * b = x * r + 1 := by + dsimp [b, r] + simp only [finiteR, ite_eq_left hx] + field_simp + ring + have hterm : ∀ a, ρ a * (r - eig a) ^ 2 / (b - eig a) ≤ ρ a * (8 * K ^ 2 * x) := by + intro a + have he := abs_le.mp (heig a) + have hsq : (r - eig a) ^ 2 ≤ 4 * K ^ 2 := by + have hlow : -2 * K ≤ r - eig a := by linarith [hr.1] + have hupp : r - eig a ≤ 2 * K := by linarith [hr.2] + have hprod := mul_nonneg (sub_nonneg.mpr hlow) (sub_nonneg.mpr hupp) + nlinarith + have hden : 0 < b - eig a := sub_pos.mpr (hs.1 a) + have hrecip : 1 / (b - eig a) ≤ 2 * x := by + apply (div_le_iff₀ hden).mpr + have hrlow : -K ≤ r := hr.1 + have hex : eig a ≤ K := he.2 + have hscaled := mul_le_mul_of_nonneg_left (show -2 * K ≤ r - eig a by linarith) hx.le + nlinarith + calc + ρ a * (r - eig a) ^ 2 / (b - eig a) = + ρ a * ((r - eig a) ^ 2 * (1 / (b - eig a))) := by ring + _ ≤ ρ a * (4 * K ^ 2 * (2 * x)) := by + apply mul_le_mul_of_nonneg_left _ (hρ a).le + exact mul_le_mul hsq hrecip (one_div_pos.mpr hden).le (by positivity) + _ = ρ a * (8 * K ^ 2 * x) := by ring + rw [finiteR_sub_mean ρ eig hρ hρsum hx] + calc + (∑ a, ρ a * (r - eig a) ^ 2 / (b - eig a)) ≤ + ∑ a, ρ a * (8 * K ^ 2 * x) := Finset.sum_le_sum fun a _ => hterm a + _ = 8 * K ^ 2 * x := by rw [← Finset.sum_mul, hρsum, one_mul] + +theorem continuousAt_finiteR_zero (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) : + ContinuousAt (finiteR ρ eig hρ hρsum) 0 := by + let K := 1 + ∑ a, |eig a| + have hK : 0 < K := by + have hsum : 0 ≤ ∑ a, |eig a| := Finset.sum_nonneg fun _ _ => abs_nonneg _ + dsimp [K] + linarith + have heig : ∀ a, |eig a| ≤ K := by + intro a + have hs : |eig a| ≤ ∑ a, |eig a| := + Finset.single_le_sum (f := fun a => |eig a|) + (fun a _ => abs_nonneg (eig a)) (Finset.mem_univ a) + dsimp [K] + linarith + have ht : Tendsto (fun x : ℝ => 8 * K ^ 2 * |x|) (𝓝 0) (𝓝 0) := by + simpa using (continuous_abs.tendsto (0 : ℝ)).const_mul (8 * K ^ 2) + have hevent : ∀ᶠ x : ℝ in 𝓝 0, + ‖finiteR ρ eig hρ hρsum x - ∑ a, ρ a * eig a‖ ≤ 8 * K ^ 2 * |x| := by + filter_upwards [Iio_mem_nhds (show (0 : ℝ) < 1 / (4 * K) by positivity)] with x hxsmall + rw [Real.norm_eq_abs] + by_cases hx : 0 < x + · have hsmall : 4 * K * x ≤ 1 := by + have h := (lt_div_iff₀ (show (0 : ℝ) < 4 * K by positivity)).mp hxsmall + nlinarith + rw [abs_of_nonneg (sub_nonneg.mpr (mean_le_finiteR ρ eig hρ hρsum hx)), abs_of_pos hx] + exact finiteR_sub_mean_le ρ eig hρ hρsum hK.le heig hx hsmall + · simp only [finiteR, ite_eq_right hx, sub_self, abs_zero] + positivity + have hdiff := squeeze_zero_norm' hevent ht + have hlim : Tendsto (finiteR ρ eig hρ hρsum) (𝓝 0) (𝓝 (∑ a, ρ a * eig a)) := + (tendsto_sub_nhds_zero_iff).mp hdiff + simpa only [ContinuousAt, finiteR, lt_self_iff_false, ite_false] using hlim + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralConvexity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralConvexity.lean new file mode 100644 index 0000000000000000000000000000000000000000..f42675876e890dc45c5d6a72549e74d84aa7a0b5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralConvexity.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCovariance +import Mathlib.Analysis.Convex.Deriv + +namespace OAI + +/-! Convexity of the spectral energy primitive, including zero. -/ + +noncomputable section + +open scoped BigOperators Topology +open Filter Set + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem finiteR_mem_interval (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {l u : ℝ} + (hl : ∀ a, l ≤ eig a) (hu : ∀ a, eig a ≤ u) (x : ℝ) : + l ≤ finiteR ρ eig hρ hρsum x ∧ finiteR ρ eig hρ hρsum x ≤ u := by + by_cases hx : 0 < x + · simp only [finiteR, ite_eq_left hx] + have hs := finiteInverse_spec ρ eig hρ hρsum hx + obtain ⟨a, _⟩ := exists_pos_spectral_weight (fun a => (hρ a).le) hρsum + have hbl : 0 < finiteInverse ρ eig hρ hρsum x - l := by linarith [hl a, hs.1 a] + have hlow := le_finiteResolvent (fun a => (hρ a).le) hρsum hl hs.1 + rw [hs.2] at hlow + have hlow' := (div_le_iff₀ hbl).mp hlow + have hlow'' : 1 / x ≤ finiteInverse ρ eig hρ hρsum x - l := by + apply (div_le_iff₀ hx).mpr + nlinarith + refine ⟨by linarith, ?_⟩ + by_cases hbu : finiteInverse ρ eig hρ hρsum x ≤ u + · linarith [one_div_pos.mpr hx] + · exact (finiteR_bounds (fun a => (hρ a).le) hρsum hl hu + (lt_of_not_ge hbu) hx hs.2).2 + · simp only [finiteR, ite_eq_right hx] + constructor + · calc + l = ∑ a, ρ a * l := by rw [← Finset.sum_mul, hρsum, one_mul] + _ ≤ ∑ a, ρ a * eig a := Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_left (hl a) (hρ a).le + · calc + (∑ a, ρ a * eig a) ≤ ∑ a, ρ a * u := Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_left (hu a) (hρ a).le + _ = u := by rw [← Finset.sum_mul, hρsum, one_mul] + +theorem continuousAt_mul_finiteR_zero (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) : + ContinuousAt (fun x => x * finiteR ρ eig hρ hρsum x) 0 := by + let K := ∑ a, |eig a| + have hK : 0 ≤ K := Finset.sum_nonneg fun _ _ => abs_nonneg _ + have heig : ∀ a, |eig a| ≤ K := by + intro a + change |eig a| ≤ ∑ a, |eig a| + exact Finset.single_le_sum (f := fun a => |eig a|) + (fun a _ => abs_nonneg (eig a)) (Finset.mem_univ a) + have hR : ∀ x, |finiteR ρ eig hρ hρsum x| ≤ K := by + intro x + exact abs_le.mpr (finiteR_mem_interval ρ eig hρ hρsum + (fun a => (abs_le.mp (heig a)).1) (fun a => (abs_le.mp (heig a)).2) x) + have ht : Tendsto (fun x : ℝ => |x| * K) (𝓝 0) (𝓝 0) := by + simpa using (continuous_abs.tendsto (0 : ℝ)).mul_const K + have ht' : Tendsto (fun x => x * finiteR ρ eig hρ hρsum x) (𝓝 0) (𝓝 0) := by + apply squeeze_zero_norm (fun x => ?_) ht + rw [Real.norm_eq_abs, abs_mul] + exact mul_le_mul_of_nonneg_left (hR x) (abs_nonneg x) + simpa only [ContinuousAt, zero_mul] using ht' + +theorem convexOn_mul_finiteR (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {c : ℝ} : + ConvexOn ℝ (Icc 0 c) (fun x => x * finiteR ρ eig hρ hρsum x) := by + have hcont : ContinuousOn (fun x => x * finiteR ρ eig hρ hρsum x) (Icc 0 c) := by + intro x hx + rcases hx.1.eq_or_lt with h | h + · subst x + exact (continuousAt_mul_finiteR_zero ρ eig hρ hρsum).continuousWithinAt + · exact (hasStrictDerivAt_mul_finiteR ρ eig hρ hρsum h).hasDerivAt.continuousAt.continuousWithinAt + apply convexOn_of_hasDerivWithinAt2_nonneg (convex_Icc 0 c) hcont + (f' := finiteEnergyDerivative ρ eig hρ hρsum) + (f'' := fun x => + 2 * (x * finiteThirdResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) - + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 2) / + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) ^ 3) + · intro x hx + have hx' : 0 < x := (show x ∈ Ioo 0 c by simpa only [interior_Icc] using hx).1 + exact (hasStrictDerivAt_mul_finiteR ρ eig hρ hρsum hx').hasDerivAt.hasDerivWithinAt + · intro x hx + have hx' : 0 < x := (show x ∈ Ioo 0 c by simpa only [interior_Icc] using hx).1 + exact (hasStrictDerivAt_finiteEnergyDerivative ρ eig hρ hρsum hx').hasDerivAt.hasDerivWithinAt + · intro x hx + have hx' : 0 < x := (show x ∈ Ioo 0 c by simpa only [interior_Icc] using hx).1 + exact finiteEnergy_secondDerivative_nonneg ρ eig hρ hρsum hx' + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountAlignment.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountAlignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..a81b175e587124c8bff1a0ac19429b22484919d1 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountAlignment.lean @@ -0,0 +1,132 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralGroupMass + +namespace OAI + +/-! Align two finite spectral labelings so each common eigenspace retains +as many axes as possible. A maximizing permutation has no unmatched pair +that can be improved by a transposition. -/ + +noncomputable section +open scoped BigOperators + +namespace InvariantIsing + +lemma exists_spectral_label_alignment {ι A : Type*} [Fintype ι] + [DecidableEq ι] [DecidableEq A] (a b : ι → A) : + ∃ p : Equiv.Perm ι, ∀ v : A, + (∀ i, a i = v → b (p i) = v) ∨ (∀ i, b (p i) = v → a i = v) := by + classical + let matchSet := fun p : Equiv.Perm ι => Finset.univ.filter fun i => a i = b (p i) + obtain ⟨p, _, hp⟩ := Finset.exists_max_image Finset.univ + (fun p : Equiv.Perm ι => (matchSet p).card) Finset.univ_nonempty + refine ⟨p, fun v => ?_⟩ + by_contra h + push Not at h + obtain ⟨⟨i, hi, hbi⟩, j, hj, haj⟩ := h + have hij : i ≠ j := by + intro he + subst j + exact hbi hj + let q : Equiv.Perm ι := (Equiv.swap i j).trans p + have hqi : q i = p j := by simp [q] + have hqk k (hki : k ≠ i) (hkj : k ≠ j) : q k = p k := by + simp only [q, Equiv.trans_apply, Equiv.swap_apply_of_ne_of_ne hki hkj] + have hsub : matchSet p ⊆ matchSet q := by + intro k hk + have hk' : a k = b (p k) := (Finset.mem_filter.mp hk).2 + have hki : k ≠ i := by + intro he + subst k + exact hbi (hk'.symm.trans hi) + have hkj : k ≠ j := by + intro he + subst k + exact haj (hk'.trans hj) + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ k, by rw [hqk k hki hkj]; exact hk'⟩ + have hin : i ∈ matchSet q := Finset.mem_filter.mpr + ⟨Finset.mem_univ i, by rw [hqi]; exact hi.trans hj.symm⟩ + have hout : i ∉ matchSet p := by + intro hi' + exact hbi ((Finset.mem_filter.mp hi').2.symm.trans hi) + have hstrict : (matchSet p).card < (matchSet q).card := + Finset.card_lt_card (Finset.ssubset_iff_subset_ne.mpr + ⟨hsub, by intro he; rw [← he] at hin; exact hout hin⟩) + exact (not_lt_of_ge (hp q (Finset.mem_univ q))) hstrict + +lemma spectral_alignment_common_count {ι A : Type*} [Fintype ι] + [DecidableEq ι] [DecidableEq A] (a b : ι → A) (p : Equiv.Perm ι) (v : A) + (hp : (∀ i, a i = v → b (p i) = v) ∨ (∀ i, b (p i) = v → a i = v)) : + ((Finset.univ.filter fun i => a i = v ∧ b (p i) = v).card) = + min ((Finset.univ.filter fun i => a i = v).card) + ((Finset.univ.filter fun i => b (p i) = v).card) := by + let left := Finset.univ.filter fun i => a i = v + let right := Finset.univ.filter fun i => b (p i) = v + let both := Finset.univ.filter fun i => a i = v ∧ b (p i) = v + change both.card = min left.card right.card + rcases hp with hp | hp + · have hsub : left ⊆ right := by + intro i hi + exact Finset.mem_filter.mpr ⟨Finset.mem_univ i, hp i (Finset.mem_filter.mp hi).2⟩ + have he : both = left := by + ext i + simp only [both, left, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fun hi => hi.1, fun hi => ⟨hi, hp i hi⟩⟩ + rw [he, min_eq_left (Finset.card_le_card hsub)] + · have hsub : right ⊆ left := by + intro i hi + exact Finset.mem_filter.mpr ⟨Finset.mem_univ i, hp i (Finset.mem_filter.mp hi).2⟩ + have he : both = right := by + ext i + simp only [both, right, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fun hi => hi.2, fun hi => ⟨hp i hi, hi⟩⟩ + rw [he, min_eq_right (Finset.card_le_card hsub)] + +lemma spectral_label_count_comp {ι A : Type*} [Fintype ι] + [DecidableEq A] (b : ι → A) (p : Equiv.Perm ι) (v : A) : + (Finset.univ.filter fun i => b (p i) = v).card = + (Finset.univ.filter fun i => b i = v).card := by + classical + have h := Equiv.sum_comp p (fun i => if b i = v then (1 : ℕ) else 0) + simpa using h + +lemma aligned_changed_count_le {ι A : Type*} [Fintype ι] + [DecidableEq ι] [DecidableEq A] (a b : ι → A) (v : A) + (hp : (∀ i, a i = v → b i = v) ∨ (∀ i, b i = v → a i = v)) : + ((Finset.univ.filter fun i => a i = v ∧ a i ≠ b i).card : ℝ) ≤ + |((Finset.univ.filter fun i => a i = v).card : ℝ) - + ((Finset.univ.filter fun i => b i = v).card : ℝ)| := by + let left := Finset.univ.filter fun i => a i = v + let both := Finset.univ.filter fun i => a i = v ∧ b i = v + let diff := Finset.univ.filter fun i => a i = v ∧ a i ≠ b i + have heq : both.card + diff.card = left.card := by + have h := Finset.card_filter_add_card_filter_not (s := left) (fun i => b i = v) + have hpos : left.filter (fun i => b i = v) = both := by + ext i + simp only [left, both, Finset.mem_filter, Finset.mem_univ, true_and] + have hneg : left.filter (fun i => ¬ b i = v) = diff := by + ext i + simp only [left, diff, Finset.mem_filter, Finset.mem_univ, true_and] + aesop + rw [hpos, hneg] at h + exact h + have hboth := spectral_alignment_common_count a b (Equiv.refl ι) v hp + change both.card = min left.card (Finset.univ.filter fun i => b i = v).card at hboth + rw [hboth] at heq + rcases le_total left.card (Finset.univ.filter fun i => b i = v).card with hl | hr + · rw [min_eq_left hl] at heq + have hd : diff.card = 0 := by omega + change (diff.card : ℝ) ≤ _ + rw [hd, Nat.cast_zero] + exact abs_nonneg _ + · rw [min_eq_right hr] at heq + have hc : ((Finset.univ.filter fun i => b i = v).card : ℝ) + diff.card = left.card := by + exact_mod_cast heq + change (diff.card : ℝ) ≤ |(left.card : ℝ) - _| + exact (le_abs_self _).trans' (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountComparison.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..46a0da3f74ba7cc46f7bfab671e9711f98d88e45 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountComparison.lean @@ -0,0 +1,119 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCountEndpoint +import OAI.Probability.InvariantIsing.Pressure.ThermalPressure + +namespace OAI + +/-! Pressure comparison from the fractions of changed axes in the two +endpoint eigenspaces. This is the analytic part of manuscript Lemma gen:counts. -/ + +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma measurable_countPressure {N : ℕ} (eig c : Fin N → ℝ) : + Measurable (fun U : SpecialOrthogonal N => rotatedPressure eig (specialRotation U) c) := by + exact measurable_rotatedPressure eig c + +lemma integrable_countPressure {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + (eig c : Fin N → ℝ) (K : ℝ) (heig : ∀ i, |eig i| ≤ K) : + Integrable (fun U => rotatedPressure eig (specialRotation U) c) μ := by + apply (integrable_const (K / 2 + |noninteractingPressure c|)).mono' + (measurable_countPressure eig c).aestronglyMeasurable + filter_upwards [] with U + rw [Real.norm_eq_abs] + have hb := abs_pressure_sub_noninteracting_le hN eig c (specialRotation U) K heig + have ha := abs_add_le (rotatedPressure eig (specialRotation U) c - noninteractingPressure c) + (noninteractingPressure c) + rw [sub_add_cancel] at ha + exact ha.trans (add_le_add hb le_rfl) + +lemma rotatedPressure_spectral_secant {N : ℕ} (eig kap c : Fin N → ℝ) + (U : SpecialOrthogonal N) : + (N : ℝ)⁻¹ * (1 / 2) * gibbsAverage (fun _ => 1) (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => ∑ i, (kap i - eig i) * spinCoordinate (specialToOrthogonal U) σ i ^ 2) ≤ + rotatedPressure kap (specialRotation U) c - rotatedPressure eig (specialRotation U) c ∧ + rotatedPressure kap (specialRotation U) c - rotatedPressure eig (specialRotation U) c ≤ + (N : ℝ)⁻¹ * (1 / 2) * gibbsAverage (fun _ => 1) (orbitHamiltonian kap c (specialToOrthogonal U)) + (fun σ => ∑ i, (kap i - eig i) * spinCoordinate (specialToOrthogonal U) σ i ^ 2) := by + have h := log_finitePartition_secant_bounds GibbsReference_one + (orbitHamiltonian eig c (specialToOrthogonal U)) (orbitHamiltonian kap c (specialToOrthogonal U)) + have hd (σ : Spin N) : orbitHamiltonian kap c (specialToOrthogonal U) σ - orbitHamiltonian eig c (specialToOrthogonal U) σ = + (1 / 2 : ℝ) * ∑ i, (kap i - eig i) * spinCoordinate (specialToOrthogonal U) σ i ^ 2 := by + simp only [orbitHamiltonian, add_sub_add_right_eq_sub, rotatedEnergy, + sub_mul, Finset.sum_sub_distrib, spinCoordinate] + ring + have he : Real.log (finitePartition (fun _ : Spin N => 1) (orbitHamiltonian kap c (specialToOrthogonal U))) - + Real.log (finitePartition (fun _ : Spin N => 1) (orbitHamiltonian eig c (specialToOrthogonal U))) = + logPartition (orbitHamiltonian kap c (specialToOrthogonal U)) - logPartition (orbitHamiltonian eig c (specialToOrthogonal U)) := by + simp only [logPartition_eq, finitePartition, one_mul] + ring + simp_rw [hd] at h + rw [gibbsAverage_const_mul, gibbsAverage_const_mul, he] at h + constructor + · convert mul_le_mul_of_nonneg_left h.1 (inv_nonneg.mpr (Nat.cast_nonneg N)) using 1 <;> + simp only [rotatedPressure, mul_sub, mul_assoc] + all_goals rfl + · convert mul_le_mul_of_nonneg_left h.2 (inv_nonneg.mpr (Nat.cast_nonneg N)) using 1 <;> + simp only [rotatedPressure, mul_sub, mul_assoc] + all_goals rfl + +/-- Changing a fraction at most `r` of every endpoint eigenspace changes the +mean pressure by at most `L*r/2`, where every eigenvalue displacement is at most `L`. -/ +theorem meanPressure_change_counts_le {N m : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (eig kap c : Fin N → ℝ) (K : ℝ) + (heig : ∀ i, |eig i| ≤ K) (hkap : ∀ i, |kap i| ≤ K) + (label label' : Fin N → Fin m) + (hl : Function.Surjective label) (hl' : Function.Surjective label') + (lam : Fin m → ℝ) (he : ∀ i, eig i = lam (label i)) + (hk : ∀ i, kap i = lam (label' i)) + (changed : Finset (Fin N)) (hzero : ∀ i, i ∉ changed → kap i = eig i) + (L r : ℝ) (hL : 0 ≤ L) (hdelta : ∀ i, |kap i - eig i| ≤ L) + (hc : ∀ a, ((changed.filter fun i => label i = a).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => label i = a).card : ℝ)) + (hc' : ∀ a, ((changed.filter fun i => label' i = a).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => label' i = a).card : ℝ)) : + |(∫ U, rotatedPressure kap (specialRotation U) c ∂μ) - + ∫ U, rotatedPressure eig (specialRotation U) c ∂μ| ≤ L * r / 2 := by + let delta := fun i => kap i - eig i + have hz : ∀ i, i ∉ changed → delta i = 0 := by + intro i hi + simp only [delta, hzero i hi, sub_self] + have hAe := integrable_gibbsSpectralDirection μ GibbsReference_one eig c delta + have hAk := integrable_gibbsSpectralDirection μ GibbsReference_one kap c delta + have hPe := integrable_countPressure hN μ eig c K heig + have hPk := integrable_countPressure hN μ kap c K hkap + have hlo := integral_mono (hAe.const_mul ((N : ℝ)⁻¹ * (1 / 2))) (hPk.sub hPe) + (fun U => (rotatedPressure_spectral_secant eig kap c U).1) + have hup := integral_mono (hPk.sub hPe) (hAk.const_mul ((N : ℝ)⁻¹ * (1 / 2))) + (fun U => (rotatedPressure_spectral_secant eig kap c U).2) + have hsub : (∫ U, rotatedPressure kap (specialRotation U) c - + rotatedPressure eig (specialRotation U) c ∂μ) = + (∫ U, rotatedPressure kap (specialRotation U) c ∂μ) - + ∫ U, rotatedPressure eig (specialRotation U) c ∂μ := integral_sub hPk hPe + simp only [Pi.sub_apply] at hlo hup + rw [integral_const_mul, hsub] at hlo + rw [integral_const_mul, hsub] at hup + have hbe := abs_integral_gibbsSpectralDirection_le μ GibbsReference_one eig c delta + label hl lam he changed hz L r hL hdelta hc + have hbk := abs_integral_gibbsSpectralDirection_le μ GibbsReference_one kap c delta + label' hl' lam hk changed hz L r hL hdelta hc' + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' + have hn0 : 0 ≤ (N : ℝ)⁻¹ * (1 / 2) := by positivity + have hbL := mul_le_mul_of_nonneg_left (abs_le.mp hbe).1 hn0 + have hbU := mul_le_mul_of_nonneg_left (abs_le.mp hbk).2 hn0 + have hs : (N : ℝ)⁻¹ * (1 / 2) * (L * r * N) = L * r / 2 := by field_simp + have hs' : (N : ℝ)⁻¹ * (1 / 2) * -(L * r * N) = -(L * r / 2) := by + rw [mul_neg, hs] + rw [hs'] at hbL + rw [hs] at hbU + exact abs_le.mpr ⟨hbL.trans hlo, hup.trans hbU⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountEndpoint.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..29c685119f448e201b49330b5c235056f0a55826 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCountEndpoint.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralGroupMass +import OAI.Probability.InvariantIsing.Pressure.GibbsSecant + +namespace OAI + +/-! Endpoint derivative bounds for changing spectral multiplicities. The +fraction estimate uses the actual Haar Gibbs projection masses. -/ + +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma integrable_gibbsSpectralDirection {N : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + {w : Spin N → ℝ} (hw : GibbsReference w) (eig c delta : Fin N → ℝ) : + Integrable (fun U => gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => ∑ i, delta i * spinCoordinate (specialToOrthogonal U) σ i ^ 2)) μ := by + have he (U : SpecialOrthogonal N) : + gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => ∑ i, delta i * spinCoordinate (specialToOrthogonal U) σ i ^ 2) = + ∑ i, delta i * gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => spinCoordinate (specialToOrthogonal U) σ i ^ 2) := by + simp only [gibbsAverage, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro σ _ + ring + simp_rw [he] + exact integrable_finsetSum _ fun i _ => + (integrable_gibbsCoordinateSquare μ hw eig c i).const_mul _ + +lemma integral_gibbsSpectralDirection {N : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] + {w : Spin N → ℝ} (hw : GibbsReference w) (eig c delta : Fin N → ℝ) : + (∫ U, gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => ∑ i, delta i * spinCoordinate (specialToOrthogonal U) σ i ^ 2) ∂μ) = + ∑ i, delta i * meanCoordinateSquare μ w eig c i := by + have he (U : SpecialOrthogonal N) : + gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => ∑ i, delta i * spinCoordinate (specialToOrthogonal U) σ i ^ 2) = + ∑ i, delta i * gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => spinCoordinate (specialToOrthogonal U) σ i ^ 2) := by + simp only [gibbsAverage, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro σ _ + ring + simp_rw [he] + rw [integral_finsetSum _ (fun i _ => + (integrable_gibbsCoordinateSquare μ hw eig c i).const_mul _)] + simp only [integral_const_mul, meanCoordinateSquare] + +lemma abs_integral_gibbsSpectralDirection_le {N m : ℕ} + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + {w : Spin N → ℝ} (hw : GibbsReference w) (eig c delta : Fin N → ℝ) + (label : Fin N → Fin m) (hlabel : Function.Surjective label) + (lam : Fin m → ℝ) (hspectral : ∀ i, eig i = lam (label i)) + (changed : Finset (Fin N)) (hzero : ∀ i, i ∉ changed → delta i = 0) + (L r : ℝ) (hL : 0 ≤ L) (hdelta : ∀ i, |delta i| ≤ L) + (hcount : ∀ a, ((changed.filter fun i => label i = a).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => label i = a).card : ℝ)) : + |∫ U, gibbsAverage w (orbitHamiltonian eig c (specialToOrthogonal U)) + (fun σ => ∑ i, delta i * spinCoordinate (specialToOrthogonal U) σ i ^ 2) ∂μ| ≤ L * r * N := by + let rep : Fin m → Fin N := fun a => (hlabel a).choose + have hrep a : label (rep a) = a := (hlabel a).choose_spec + let mass : Fin m → ℝ := fun a => meanCoordinateSquare μ w eig c (rep a) + have hm a : 0 ≤ mass a := meanCoordinateSquare_nonneg μ hw eig c (rep a) + have he i : meanCoordinateSquare μ w eig c i = mass (label i) := by + apply meanCoordinateSquare_eq_of_eigenvalue_eq μ hw eig c + rw [hspectral i, hspectral (rep (label i)), hrep] + rw [integral_gibbsSpectralDirection μ hw] + simp_rw [he] + have hs : (∑ i, mass (label i)) = N := by + simp_rw [← he] + exact sum_meanCoordinateSquare μ hw eig c + simpa only [hs] using abs_weighted_spectral_change_le label changed mass hm delta + hzero L r hL hdelta hcount + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCovariance.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..7bdef0fccd6337542cf08778a2d40c9fc70b8757 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralCovariance.lean @@ -0,0 +1,93 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCalculus + +namespace OAI + +/-! Translation and positive scaling of the finite spectral transform. -/ + +noncomputable section + +open scoped BigOperators + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem finiteInverse_constant (ρ : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) (c : ℝ) : + finiteInverse ρ (fun _ => c) hρ hρsum x = c + 1 / x := by + have hs := finiteInverse_spec ρ (fun _ => c) hρ hρsum hx + apply finiteResolvent_solution_unique (fun a => (hρ a).le) hρsum hs.1 + (fun _ => by linarith [one_div_pos.mpr hx]) hs.2 + exact constant_spectrum_solution hρsum hx + +theorem finiteR_constant (ρ : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (x c : ℝ) : + finiteR ρ (fun _ => c) hρ hρsum x = c := by + by_cases hx : 0 < x + · simp only [finiteR, ite_eq_left hx, finiteInverse_constant ρ hρ hρsum hx c] + ring + · simp only [finiteR, ite_eq_right hx] + rw [← Finset.sum_mul, hρsum, one_mul] + +theorem finiteResolvent_scale (ρ eig : ι → ℝ) (b t : ℝ) : + finiteResolvent ρ (fun a => t * eig a) (t * b) = + (1 / t) * finiteResolvent ρ eig b := by + unfold finiteResolvent + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + rw [← mul_sub, div_mul_eq_div_div] + ring + +theorem finiteInverse_translate (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 < x) (c : ℝ) : + finiteInverse ρ (fun a => eig a + c) hρ hρsum x = + finiteInverse ρ eig hρ hρsum x + c := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have ht := finiteInverse_spec ρ (fun a => eig a + c) hρ hρsum hx + apply finiteResolvent_solution_unique (fun a => (hρ a).le) hρsum ht.1 + (fun a => by linarith [hs.1 a]) ht.2 + rw [finiteResolvent_translate, hs.2] + +theorem finiteInverse_scale (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x t : ℝ} (hx : 0 < x) (ht : 0 < t) : + finiteInverse ρ (fun a => t * eig a) hρ hρsum x = + t * finiteInverse ρ eig hρ hρsum (t * x) := by + have hs := finiteInverse_spec ρ eig hρ hρsum (mul_pos ht hx) + have hs' := finiteInverse_spec ρ (fun a => t * eig a) hρ hρsum hx + apply finiteResolvent_solution_unique (fun a => (hρ a).le) hρsum hs'.1 + (fun a => mul_lt_mul_of_pos_left (hs.1 a) ht) hs'.2 + rw [finiteResolvent_scale ρ eig _ t, hs.2] + field_simp + +theorem finiteR_translate (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 ≤ x) (c : ℝ) : + finiteR ρ (fun a => eig a + c) hρ hρsum x = + finiteR ρ eig hρ hρsum x + c := by + rcases hx.eq_or_lt with h | h + · subst x + simp only [finiteR, lt_self_iff_false, ite_false, mul_add, Finset.sum_add_distrib, + ← Finset.sum_mul, hρsum, one_mul] + · simp only [finiteR, ite_eq_left h, finiteInverse_translate ρ eig hρ hρsum h c] + ring + +theorem finiteR_scale (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x t : ℝ} (hx : 0 ≤ x) (ht : 0 < t) : + finiteR ρ (fun a => t * eig a) hρ hρsum x = + t * finiteR ρ eig hρ hρsum (t * x) := by + rcases hx.eq_or_lt with h | h + · subst x + simp only [finiteR, mul_zero, lt_self_iff_false, ite_false] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + ring + · simp only [finiteR, ite_eq_left h, ite_eq_left (mul_pos ht h), + finiteInverse_scale ρ eig hρ hρsum h ht] + field_simp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDeficitDerivative.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDeficitDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..e26ed162581e6fbf025a72dd13711cfa15a7365f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDeficitDerivative.lean @@ -0,0 +1,87 @@ +import OAI.Probability.InvariantIsing.Core.Variational +import Mathlib.Analysis.Calculus.ParametricIntegral + +namespace OAI + +/-! Differentiating the overlap deficit away from atoms of the overlap law. -/ + +noncomputable section + +open MeasureTheory Set Filter +open scoped Topology + +namespace InvariantIsing + +/-- At every non-atom of the path law, the derivative of `D_p` is minus +the distribution function. This is the analytic step in `rot:function-path`. -/ +theorem hasDerivAt_deficit_of_nonatom (p : OverlapPath) (r : ℝ) + (hnonatom : pathMeasure {s | p s = r} = 0) : + HasDerivAt (deficit p) (-pathMeasure.real {s | p s ≤ r}) r := by + let A : Set ℝ := {s | p s ≤ r} + have hA : MeasurableSet A := measurableSet_le p.measurable measurable_const + let F : ℝ → ℝ → ℝ := fun t s => max (p s - t) 0 + let F' : ℝ → ℝ := fun s => A.indicator (fun _ => (1 : ℝ)) s - 1 + have hiA : Integrable (A.indicator (fun _ => (1 : ℝ))) pathMeasure := + (integrable_const (1 : ℝ)).indicator hA + have hi' : Integrable F' pathMeasure := hiA.sub (integrable_const 1) + have hmean : (∫ s, F' s ∂pathMeasure) = pathMeasure.real A - 1 := by + dsimp [F'] + rw [integral_sub hiA (integrable_const 1), integral_indicator_const 1 hA] + simp only [smul_eq_mul, mul_one, integral_const, measureReal_def, + pathMeasure_univ, ENNReal.toReal_one] + have hne : ∀ᵐ s ∂pathMeasure, p s ≠ r := by + rw [ae_iff] + simpa only [not_not] using hnonatom + have hdiff : ∀ᵐ s ∂pathMeasure, HasDerivAt (F · s) (F' s) r := by + filter_upwards [hne] with s hs + rcases lt_or_gt_of_ne hs with h | h + · have heq : (F · s) =ᶠ[𝓝 r] (fun _ => (0 : ℝ)) := by + filter_upwards [Ioi_mem_nhds h] with t ht + exact max_eq_right (sub_nonpos.mpr (show p s ≤ t from ht.le)) + have hd : HasDerivAt (F · s) 0 r := + (hasDerivAt_const r (0 : ℝ)).congr_of_eventuallyEq heq + simpa only [F', indicator_of_mem (show s ∈ A from h.le), sub_self] using hd + · have heq : (F · s) =ᶠ[𝓝 r] (fun t => p s - t) := by + filter_upwards [Iio_mem_nhds h] with t ht + exact max_eq_left (sub_nonneg.mpr (show t ≤ p s from ht.le)) + have hd : HasDerivAt (fun t : ℝ => p s - t) (-1) r := by + convert! (hasDerivAt_const r (p s)).sub (hasDerivAt_id r) using 1 + ring + have hd' := hd.congr_of_eventuallyEq heq + simpa only [F', indicator_of_notMem (show s ∉ A from not_le.mpr h), + zero_sub] using hd' + have hlip : ∀ s, LipschitzWith 1 (F · s) := by + intro s + apply LipschitzWith.of_dist_le_mul + intro x y + have h := abs_max_sub_max_le_abs (p s - x) (p s - y) 0 + have he : (p s - x) - (p s - y) = -(x - y) := by ring + simpa only [F, Real.dist_eq, NNReal.coe_one, one_mul, he, abs_neg] using h + have hmeas : ∀ᶠ t in 𝓝 r, AEStronglyMeasurable (F t) pathMeasure := + Eventually.of_forall fun _t => + ((p.measurable.sub measurable_const).max measurable_const).aestronglyMeasurable + obtain ⟨_, hd⟩ := hasDerivAt_integral_of_dominated_loc_of_lip + (μ := pathMeasure) (F := F) (F' := F') (bound := fun _ => (1 : ℝ)) + (s := univ) univ_mem hmeas (p.integrable_posPart r) hi'.aestronglyMeasurable + (ae_of_all _ fun s => by simpa using hlip s) + (integrable_const 1) hdiff + have hdD : HasDerivAt (deficit p) ((0 - 1) - ∫ s, F' s ∂pathMeasure) r := by + convert! ((hasDerivAt_const r (1 : ℝ)).sub (hasDerivAt_id r)).sub hd using 1 + rw [hmean] at hdD + convert hdD using 1 + ring + +theorem ae_hasDerivAt_deficit (p : OverlapPath) : + ∀ᵐ r ∂(volume : Measure ℝ), + HasDerivAt (deficit p) (-pathMeasure.real {s | p s ≤ r}) r := by + have hc : {r | 0 < pathMeasure {s | p s = r}}.Countable := + Measure.countable_meas_level_set_pos p.measurable + filter_upwards [hc.ae_notMem (volume : Measure ℝ)] with r hr + apply hasDerivAt_deficit_of_nonatom p r + exact le_antisymm (le_of_not_gt hr) bot_le + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDensityContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDensityContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..840c06c224069271e6f42873baf61805f4e2470f --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDensityContinuity.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralOverlapPaths + +namespace OAI + +/-! A continuous bounded extension of the spectral path density. -/ + +noncomputable section + +open Set Filter +open scoped Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem continuous_projectedResolventDerivative + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (a : ι) : + Continuous (projectedResolventDerivative ρ eig hρ hρsum a) := by + apply continuous_iff_continuousAt.mpr + intro x + rcases lt_trichotomy x 0 with hx | hx | hx + · have hc : ContinuousAt (fun _ : ℝ => ρ a) x := continuousAt_const + apply hc.congr_of_eventuallyEq + filter_upwards [Iio_mem_nhds hx] with y hy + simp only [projectedResolventDerivative, + ite_eq_right (not_lt.mpr (le_of_lt (show y < 0 from hy)))] + · subst x + apply continuousAt_iff_continuous_left_right.mpr + refine ⟨?_, continuousWithinAt_projectedResolventDerivative_zero ρ eig hρ hρsum a⟩ + have hc : ContinuousWithinAt (fun _ : ℝ => ρ a) (Iic 0) 0 := continuousWithinAt_const + apply hc.congr + · intro y hy + simp only [projectedResolventDerivative, ite_eq_right (not_lt.mpr (show y ≤ 0 from hy))] + · simp only [projectedResolventDerivative, lt_self_iff_false, ite_false] + · exact continuousAt_projectedResolventDerivative_pos ρ eig hρ hρsum a hx + +theorem continuous_spectralPathDensity + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (p : OverlapPath) (a : ι) : + Continuous (spectralPathDensity ρ eig hρ hρsum p a) := + (continuous_projectedResolventDerivative ρ eig hρ hρsum a).comp (continuous_deficit p) + +theorem spectralPathDensity_le_one + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (p : OverlapPath) (a : ι) (r : ℝ) : + spectralPathDensity ρ eig hρ hρsum p a r ≤ 1 := + projectedResolventDerivative_le_one ρ eig hρ hρsum a (deficit p r) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalCenters.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalCenters.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b430d2ca2bfb58c23f162c991f6c926920db9ac --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalCenters.lean @@ -0,0 +1,52 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralGG + +namespace OAI + +/-! Compact deterministic centers without assuming constant finite self-overlap. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +def spectralDiagonalCenter (b : ℝ) : ℝ := max 0 (min 1 b) + +lemma spectralDiagonalCenter_mem (b : ℝ) : spectralDiagonalCenter b ∈ Set.Icc (0 : ℝ) 1 := by + exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ + +lemma abs_sub_spectralDiagonalCenter_le {x : ℝ} (hx : x ∈ Set.Icc (0 : ℝ) 1) (b : ℝ) : + |x - spectralDiagonalCenter b| ≤ |x - b| := by + by_cases hb : b ≤ 0 + · rw [spectralDiagonalCenter, min_eq_right (by linarith : b ≤ 1), max_eq_left hb, + sub_zero, abs_of_nonneg hx.1, abs_of_nonneg (by linarith [hx.1] : 0 ≤ x - b)] + linarith + · by_cases hb' : 1 ≤ b + · rw [spectralDiagonalCenter, min_eq_left hb', max_eq_right (by norm_num : (0 : ℝ) ≤ 1), + abs_of_nonpos (by linarith [hx.2] : x - 1 ≤ 0), abs_of_nonpos (by linarith [hx.2] : x - b ≤ 0)] + linarith + · rw [spectralDiagonalCenter, min_eq_right (le_of_not_ge hb'), max_eq_right (le_of_not_ge hb)] + +/-- Each deterministic center may be clipped to the geometrically allowed +interval before taking a subsequence. The true finite self-overlap remains +inside the integral and its error is no larger. -/ +lemma spectralMonomial_clipped_self_deviation_le {N m : ℕ} (U : Rotation N) + (I : Fin m → Finset (Fin N)) (d : Fin m → ℕ) (b : Fin m → ℝ) (σ : Spin N) : + |(∏ a, projectedOverlap U (I a) σ σ ^ d a) - + ∏ a, spectralDiagonalCenter (b a) ^ d a| ≤ + ∑ a, (d a : ℝ) * |projectedOverlap U (I a) σ σ - b a| := by + refine (spectralMonomial_self_deviation_le U I d (fun a => spectralDiagonalCenter (b a)) + (fun a => spectralDiagonalCenter_mem (b a)) σ).trans ?_ + apply Finset.sum_le_sum + intro a _ + exact mul_le_mul_of_nonneg_left + (abs_sub_spectralDiagonalCenter_le + ⟨projectedOverlap_self_nonneg _ _ _, projectedOverlap_self_le_one _ _ _⟩ (b a)) + (Nat.cast_nonneg _) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalPerturbation.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalPerturbation.lean new file mode 100644 index 0000000000000000000000000000000000000000..43574d33e4beab250155a684bed07ff81a2d3978 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalPerturbation.lean @@ -0,0 +1,135 @@ +import OAI.Probability.InvariantIsing.Arrays.PerturbationWeights +import OAI.Probability.InvariantIsing.Arrays.OverlapBounds + +namespace OAI + +/-! The deterministic spectral-diagonal perturbation as an exact eigenvalue shift. -/ + +noncomputable section + +open IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +def diagonalPerturbedEigenvalues {N m : ℕ} (eig : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) (t : ℝ) (i : Fin N) : ℝ := + t * eig i + 2 * perturbationScale N * ∑ a, if i ∈ I a then v a else 0 + +/-- This is the first term of the manuscript's perturbation, including +its coefficient `N e_N`, in the actual rotated Ising Hamiltonian. -/ +theorem rotatedEnergy_diagonalPerturbation {N m : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U : Rotation N) (I : Fin m → Finset (Fin N)) + (v : Fin m → ℝ) (t : ℝ) (σ : Spin N) : + rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) U σ = + t * rotatedEnergy eig U σ + N * perturbationScale N * ∑ a, v a * projectedOverlap U (I a) σ σ := by + classical + have hn : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN.ne' + unfold rotatedEnergy diagonalPerturbedEigenvalues projectedOverlap + simp_rw [add_mul, Finset.sum_add_distrib] + have he : (∑ i, (2 * perturbationScale N * ∑ a, if i ∈ I a then v a else 0) * + U (spinVector σ) i ^ 2) = + 2 * perturbationScale N * ∑ a, v a * ∑ i ∈ I a, U (spinVector σ) i ^ 2 := by + calc + _ = (2 * perturbationScale N) * + ∑ i, ∑ a, (if i ∈ I a then v a else 0) * U (spinVector σ) i ^ 2 := by + simp only [Finset.mul_sum, Finset.sum_mul, mul_assoc] + _ = (2 * perturbationScale N) * + ∑ a, ∑ i, (if i ∈ I a then v a else 0) * U (spinVector σ) i ^ 2 := by + rw [Finset.sum_comm] + _ = _ := by + congr 1 + apply Finset.sum_congr rfl + intro a _ + rw [Finset.mul_sum] + simp only [ite_mul, zero_mul, Finset.sum_ite_mem, Finset.univ_inter] + rw [he] + simp_rw [← pow_two] + have hl : (∑ i, t * eig i * U (spinVector σ) i ^ 2) = + t * ∑ i, eig i * U (spinVector σ) i ^ 2 := by + simp only [Finset.mul_sum, mul_assoc] + have hs : (∑ a, v a * ((N : ℝ)⁻¹ * ∑ i ∈ I a, U (spinVector σ) i ^ 2)) = + (N : ℝ)⁻¹ * ∑ a, v a * ∑ i ∈ I a, U (spinVector σ) i ^ 2 := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + ring + rw [hl, hs] + field_simp [hn] + +lemma diagonalPerturbedEigenvalues_abs_le {N m : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (I : Fin m → Finset (Fin N)) (v : Fin m → ℝ) + (hv : ∀ a, |v a| ≤ 2) (t : ℝ) (ht : |t| ≤ 1) + (K : ℝ) (heig : ∀ i, |eig i| ≤ K) (i : Fin N) : + |diagonalPerturbedEigenvalues eig I v t i| ≤ K + 4 * m := by + have hs : |∑ a, if i ∈ I a then v a else 0| ≤ 2 * m := by + calc + _ ≤ ∑ a, |if i ∈ I a then v a else 0| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _a : Fin m, (2 : ℝ) := Finset.sum_le_sum fun a _ => by + split_ifs + · exact hv a + · norm_num + _ = _ := by simp; ring + have hp : 0 ≤ perturbationScale N := Real.rpow_nonneg (Nat.cast_nonneg _) _ + have htE : |t * eig i| ≤ K := by + rw [abs_mul] + exact (mul_le_mul ht (heig i) (abs_nonneg _) (by norm_num)).trans_eq (one_mul _) + have hshift : |2 * perturbationScale N * ∑ a, if i ∈ I a then v a else 0| ≤ 4 * m := by + rw [abs_mul, abs_of_nonneg (mul_nonneg (by norm_num) hp)] + calc + _ ≤ (2 * perturbationScale N) * (2 * m) := mul_le_mul_of_nonneg_left hs (by positivity) + _ ≤ 2 * (2 * m) := by + exact mul_le_mul_of_nonneg_right + (by simpa only [mul_one] using + (mul_le_mul_of_nonneg_left (perturbationScale_le_one hN) + (show (0 : ℝ) ≤ 2 by norm_num))) (show 0 ≤ 2 * (m : ℝ) by positivity) + _ = _ := by ring + exact (abs_add_le _ _).trans (add_le_add htE hshift) + +/-- Replacing one diagonal coordinate adds exactly its bounded observable, +even when all other spectral coordinates and the temperature are present. -/ +lemma rotatedEnergy_diagonal_coordinate {N m : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U : Rotation N) (I : Fin m → Finset (Fin N)) + (v : Fin m → ℝ) (t : ℝ) (a : Fin m) (w : ℝ) (σ : Spin N) : + rotatedEnergy (diagonalPerturbedEigenvalues eig I (Function.update v a w) t) U σ = + rotatedEnergy (diagonalPerturbedEigenvalues eig I (Function.update v a 0) t) U σ + + N * perturbationScale N * w * projectedOverlap U (I a) σ σ := by + classical + rw [rotatedEnergy_diagonalPerturbation hN, rotatedEnergy_diagonalPerturbation hN] + have hs : (∑ b, Function.update v a w b * projectedOverlap U (I b) σ σ) = + (∑ b, Function.update v a 0 b * projectedOverlap U (I b) σ σ) + + w * projectedOverlap U (I a) σ σ := by + rw [← Finset.sum_erase_add _ _ (Finset.mem_univ a), + ← Finset.sum_erase_add _ _ (Finset.mem_univ a)] + simp only [Function.update_self, zero_mul, add_zero] + congr 1 + apply Finset.sum_congr rfl + intro b hb + have hba : b ≠ a := (Finset.mem_erase.mp hb).1 + simp only [Function.update_of_ne hba] + rw [hs] + ring + +lemma abs_rotatedEnergy_diagonalPerturbation_le {N m : ℕ} (hN : 0 < N) + (eig : Fin N → ℝ) (U : Rotation N) (I : Fin m → Finset (Fin N)) + (v : Fin m → ℝ) (hv : ∀ a, |v a| ≤ 2) (t : ℝ) (σ : Spin N) : + |rotatedEnergy (diagonalPerturbedEigenvalues eig I v t) U σ - t * rotatedEnergy eig U σ| ≤ + 2 * m * N * perturbationScale N := by + have he : 0 ≤ perturbationScale N := Real.rpow_nonneg (Nat.cast_nonneg _) _ + have hs : |∑ a, v a * projectedOverlap U (I a) σ σ| ≤ 2 * m := by + calc + _ ≤ ∑ a, |v a * projectedOverlap U (I a) σ σ| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _a : Fin m, (2 : ℝ) := Finset.sum_le_sum fun a _ => by + rw [abs_mul] + exact (mul_le_mul (hv a) (projectedOverlap_abs_le_one U (I a) σ σ) + (abs_nonneg _) (by norm_num)).trans_eq (mul_one _) + _ = _ := by simp; ring + rw [rotatedEnergy_diagonalPerturbation hN, add_sub_cancel_left, abs_mul, + abs_of_nonneg (mul_nonneg (Nat.cast_nonneg _) he)] + exact (mul_le_mul_of_nonneg_left hs (mul_nonneg (Nat.cast_nonneg _) he)).trans_eq (by ring) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalWardLimits.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalWardLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..316b670092dbe12049075841fcb4af0d205a2ab8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralDiagonalWardLimits.lean @@ -0,0 +1,89 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPartition + +namespace OAI + +/-! Weak closure of the one-replica diagonal Ward residual. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter +open scoped Topology BoundedContinuousFunction + +namespace InvariantIsing + +def spectralDiagonalWardResidual {m : ℕ} (Q : ProbabilityMeasure (SpectralArray (m + 1))) + (ρ eig : Fin m → ℝ) (a b : Fin m) : ℝ := + ρ a * (∫ x, (x (0,0) b.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1)))) - + ρ b * (∫ x, (x (0,0) a.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1)))) + + (eig a - eig b) * (∫ x, (x (0,0) a.castSucc : ℝ) * (x (0,0) b.castSucc : ℝ) - + (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1)))) + +lemma spectralDiagonalWardResidual_constant_diagonal {m : ℕ} + (Q : ProbabilityMeasure (SpectralArray (m + 1))) (ρ eig : Fin m → ℝ) (a b : Fin m) + (q : Fin (m + 1) → ℝ) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i c, (x (i,i) c : ℝ) = q c) : + spectralDiagonalWardResidual Q ρ eig a b = + ρ a * q b.castSucc - ρ b * q a.castSucc + + (eig a - eig b) * (q a.castSucc * q b.castSucc - + ∫ x, (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1)))) := by + have hi (c : Fin m) : (∫ x, (x (0,0) c.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1)))) = q c.castSucc := by + calc + _ = ∫ _x, q c.castSucc ∂(Q : Measure (SpectralArray (m + 1))) := by + apply integral_congr_ae + filter_upwards [hd] with x hx + exact hx 0 c.castSucc + _ = _ := by simp + have hm : Integrable (fun x : SpectralArray (m + 1) => + (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ)) (Q : Measure (SpectralArray (m + 1))) := + (BoundedContinuousFunction.mkOfCompact + ⟨fun x : SpectralArray (m + 1) => (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ), by fun_prop⟩).integrable _ + have hp : (∫ x, (x (0,0) a.castSucc : ℝ) * (x (0,0) b.castSucc : ℝ) - + (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1)))) = + q a.castSucc * q b.castSucc - + ∫ x, (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1))) := by + calc + _ = ∫ x, q a.castSucc * q b.castSucc - + (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ) ∂(Q : Measure (SpectralArray (m + 1))) := by + apply integral_congr_ae + filter_upwards [hd] with x hx + rw [hx 0 a.castSucc, hx 0 b.castSucc] + _ = _ := by rw [integral_sub (integrable_const _) hm]; simp + simp only [spectralDiagonalWardResidual, hi, hp] + +lemma spectralDiagonalWardResidual_weak_limit {m : ℕ} + {L : ℕ → ProbabilityMeasure (SpectralArray (m + 1))} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} (hL : Tendsto L atTop (𝓝 Q)) + {ρ eig : ℕ → Fin m → ℝ} {ρ₀ eig₀ : Fin m → ℝ} + (hρ : Tendsto ρ atTop (𝓝 ρ₀)) (heig : Tendsto eig atTop (𝓝 eig₀)) (a b : Fin m) : + Tendsto (fun n => spectralDiagonalWardResidual (L n) (ρ n) (eig n) a b) atTop + (𝓝 (spectralDiagonalWardResidual Q ρ₀ eig₀ a b)) := by + have hI (F : SpectralArray (m + 1) → ℝ) (hF : Continuous F) : + Tendsto (fun n => ∫ x, F x ∂(L n : Measure (SpectralArray (m + 1)))) atTop + (𝓝 (∫ x, F x ∂(Q : Measure (SpectralArray (m + 1))))) := + (ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mp hL) + (BoundedContinuousFunction.mkOfCompact ⟨F, hF⟩) + have hIa := hI (fun x => (x (0,0) a.castSucc : ℝ)) (by fun_prop) + have hIb := hI (fun x => (x (0,0) b.castSucc : ℝ)) (by fun_prop) + have hIp := hI (fun x => (x (0,0) a.castSucc : ℝ) * (x (0,0) b.castSucc : ℝ) - + (x (0,1) a.castSucc : ℝ) * (x (0,1) b.castSucc : ℝ)) (by fun_prop) + exact (((tendsto_pi_nhds.mp hρ a).mul hIb).sub + ((tendsto_pi_nhds.mp hρ b).mul hIa)).add + (((tendsto_pi_nhds.mp heig a).sub (tendsto_pi_nhds.mp heig b)).mul hIp) + +theorem spectralDiagonalWardResidual_zero_of_vanishing_bound {m : ℕ} + {L : ℕ → ProbabilityMeasure (SpectralArray (m + 1))} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} (hL : Tendsto L atTop (𝓝 Q)) + {ρ eig : ℕ → Fin m → ℝ} {ρ₀ eig₀ : Fin m → ℝ} + (hρ : Tendsto ρ atTop (𝓝 ρ₀)) (heig : Tendsto eig atTop (𝓝 eig₀)) (a b : Fin m) + {ε : ℕ → ℝ} (hε : Tendsto ε atTop (𝓝 0)) + (hb : ∀ n, |spectralDiagonalWardResidual (L n) (ρ n) (eig n) a b| ≤ ε n) : + spectralDiagonalWardResidual Q ρ₀ eig₀ a b = 0 := by + have ht := spectralDiagonalWardResidual_weak_limit hL hρ heig a b + have hz := squeeze_zero (fun n => abs_nonneg (spectralDiagonalWardResidual (L n) (ρ n) (eig n) a b)) hb hε + exact abs_eq_zero.mp (tendsto_nhds_unique ht.abs hz) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEndpoints.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEndpoints.lean new file mode 100644 index 0000000000000000000000000000000000000000..09985110198884bd3ca79aedffb6327e7bba5c2d --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEndpoints.lean @@ -0,0 +1,152 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralPaths +import Mathlib.Analysis.Calculus.Deriv.Slope + +namespace OAI + +/-! Endpoint regularity for the finite spectral-group functions. -/ + +noncomputable section + +open scoped BigOperators Topology +open Filter Set + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem projectedResolventDerivative_eq_regular (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) {x : ℝ} (hx : 0 ≤ x) : + projectedResolventDerivative ρ eig hρ hρsum a x = ρ a / + ((∑ b, ρ b / (1 + x * (finiteR ρ eig hρ hρsum x - eig b)) ^ 2) * + (1 + x * (finiteR ρ eig hρ hρsum x - eig a)) ^ 2) := by + rcases hx.eq_or_lt with h | h + · subst x + simp only [projectedResolventDerivative, lt_self_iff_false, ite_false, + zero_mul, add_zero, one_pow, div_one, hρsum, mul_one] + · let B := finiteInverse ρ eig hρ hρsum x + have hs := finiteInverse_spec ρ eig hρ hρsum h + have hgap : ∀ b, B - eig b ≠ 0 := fun b => (sub_pos.mpr (hs.1 b)).ne' + have hM := finiteSecondResolvent_pos (fun b => (hρ b).le) hρsum hs.1 + have hden : ∀ b, 1 + x * (finiteR ρ eig hρ hρsum x - eig b) = x * (B - eig b) := by + intro b + simp only [finiteR, ite_eq_left h] + dsimp [B] + field_simp + ring + have hsum : (∑ b, ρ b / (x * (B - eig b)) ^ 2) = + finiteSecondResolvent ρ eig B / x ^ 2 := by + unfold finiteSecondResolvent + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro b _ + rw [div_div] + congr 1 + ring + simp only [projectedResolventDerivative, ite_eq_left h, hden] + change ρ a / (finiteSecondResolvent ρ eig B * (B - eig a) ^ 2) = _ + rw [hsum] + field_simp [h.ne', hM.ne', hgap a] + +theorem continuousWithinAt_projectedResolventDerivative_zero + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (a : ι) : + ContinuousWithinAt (projectedResolventDerivative ρ eig hρ hρsum a) (Ici 0) 0 := by + let g := fun b x => 1 + x * (finiteR ρ eig hρ hρsum x - eig b) + have hg : ∀ b, ContinuousAt (g b) 0 := by + intro b + exact continuousAt_const.add + (continuousAt_id.mul ((continuousAt_finiteR_zero ρ eig hρ hρsum).sub continuousAt_const)) + have hS : ContinuousAt (fun x => ∑ b, ρ b / (g b x) ^ 2) 0 := by + apply tendsto_finsetSum + intro b _ + exact continuousAt_const.div ((hg b).pow 2) (by simp [g]) + have hc : ContinuousAt (fun x => ρ a / ((∑ b, ρ b / (g b x) ^ 2) * (g a x) ^ 2)) 0 := + continuousAt_const.div (hS.mul ((hg a).pow 2)) (by simp [g, hρsum]) + apply hc.continuousWithinAt.congr + · intro x hx + exact projectedResolventDerivative_eq_regular ρ eig hρ hρsum a hx + · exact projectedResolventDerivative_eq_regular ρ eig hρ hρsum a le_rfl + +theorem continuousAt_projectedResolventDerivative_pos + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (a : ι) + {x : ℝ} (hx : 0 < x) : + ContinuousAt (projectedResolventDerivative ρ eig hρ hρsum a) x := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hm := finiteSecondResolvent_pos (fun b => (hρ b).le) hρsum hs.1 + have hcB := (hasStrictDerivAt_finiteInverse ρ eig hρ hρsum hx).hasDerivAt.continuousAt + have hcM := ((hasStrictDerivAt_finiteSecondResolvent ρ eig hs.1).hasDerivAt.continuousAt).comp hcB + have hc : ContinuousAt (fun y => ρ a / + (finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum y) * + (finiteInverse ρ eig hρ hρsum y - eig a) ^ 2)) x := + continuousAt_const.div (hcM.mul ((hcB.sub continuousAt_const).pow 2)) + (mul_ne_zero hm.ne' (pow_ne_zero 2 (sub_pos.mpr (hs.1 a)).ne')) + apply hc.congr_of_eventuallyEq + filter_upwards [Ioi_mem_nhds hx] with y hy + simp only [projectedResolventDerivative, ite_eq_left (show 0 < y from hy)] + +theorem continuousOn_projectedResolventDerivative + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (a : ι) {c : ℝ} : + ContinuousOn (projectedResolventDerivative ρ eig hρ hρsum a) (Icc 0 c) := by + intro x hx + rcases hx.1.eq_or_lt with h | h + · subst x + exact (continuousWithinAt_projectedResolventDerivative_zero ρ eig hρ hρsum a).mono + (fun y hy => hy.1) + · exact (continuousAt_projectedResolventDerivative_pos ρ eig hρ hρsum a h).continuousWithinAt + +theorem projectedResolventDerivative_constant (ρ : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (c : ℝ) (a : ι) (x : ℝ) : + projectedResolventDerivative ρ (fun _ => c) hρ hρsum a x = ρ a := by + by_cases hx : 0 ≤ x + · rw [projectedResolventDerivative_eq_regular ρ (fun _ => c) hρ hρsum a hx] + simp only [finiteR_constant, sub_self, mul_zero, add_zero, one_pow, + div_one, hρsum, mul_one] + · simp only [projectedResolventDerivative, ite_eq_right (show ¬ 0 < x by linarith)] + +theorem projectedResolvent_eq_regular (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) {x : ℝ} (hx : 0 ≤ x) : + projectedResolvent ρ eig hρ hρsum a x = + ρ a * x / (1 + x * (finiteR ρ eig hρ hρsum x - eig a)) := by + rcases hx.eq_or_lt with h | h + · subst x + simp only [projectedResolvent, lt_self_iff_false, ite_false, mul_zero, zero_mul, + add_zero, zero_div] + · have hs := finiteInverse_spec ρ eig hρ hρsum h + have hden : 1 + x * (finiteR ρ eig hρ hρsum x - eig a) = + x * (finiteInverse ρ eig hρ hρsum x - eig a) := by + simp only [finiteR, ite_eq_left h] + field_simp + ring + simp only [projectedResolvent, ite_eq_left h, hden] + field_simp [h.ne', (sub_pos.mpr (hs.1 a)).ne'] + +/-- The right derivative at the origin is the spectral mass, as asserted +in manuscript `rot:f-derivative`. -/ +theorem hasDerivWithinAt_projectedResolvent_zero (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) : + HasDerivWithinAt (projectedResolvent ρ eig hρ hρsum a) (ρ a) (Ioi 0) 0 := by + have hcR := continuousAt_finiteR_zero ρ eig hρ hρsum + have hden : ContinuousAt + (fun x : ℝ => 1 + x * (finiteR ρ eig hρ hρsum x - eig a)) 0 := + continuousAt_const.add (continuousAt_id.mul (hcR.sub continuousAt_const)) + have hquot : Tendsto + (fun x : ℝ => ρ a / (1 + x * (finiteR ρ eig hρ hρsum x - eig a))) + (𝓝 0) (𝓝 (ρ a)) := by + have hc : ContinuousAt + (fun x : ℝ => ρ a / (1 + x * (finiteR ρ eig hρ hρsum x - eig a))) 0 := + continuousAt_const.div hden (by simp) + simpa only [zero_mul, add_zero, div_one] using + hc.tendsto + apply (hasDerivWithinAt_iff_tendsto_slope' (by simp : (0 : ℝ) ∉ Ioi 0)).mpr + apply Tendsto.congr' _ (hquot.mono_left nhdsWithin_le_nhds) + filter_upwards [self_mem_nhdsWithin] with x hx + have hx' : 0 < x := hx + rw [slope_def_field, projectedResolvent_eq_regular ρ eig hρ hρsum a hx.le] + simp only [projectedResolvent, lt_self_iff_false, ite_false, sub_zero] + field_simp [hx'.ne'] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEnergy.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..4daacf20f8ebdabe5e5e2502c0152aa5f1a2e9c6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEnergy.lean @@ -0,0 +1,205 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPrimitive +import OAI.Probability.InvariantIsing.Spectral.SpectralDensityContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralConvexity +import OAI.Probability.InvariantIsing.Fields.Field +import OAI.Probability.InvariantIsing.Core.TailOrder + +namespace OAI + +/-! Finite-spectrum interaction energy and its monotonicity. -/ + +noncomputable section + +open MeasureTheory Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +def finiteSpectralSlope (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (x : ℝ) : ℝ := + ∑ a, eig a * projectedResolventDerivative ρ eig hρ hρsum a x + +def finiteThermalScalar (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (t x : ℝ) : ℝ := + x * finiteR ρ eig hρ hρsum (t * x) + +def finiteInteractionEnergy (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (t : ℝ) (p : OverlapPath) : ℝ := + spectralFunctional (fun x => finiteSpectralSlope ρ eig hρ hρsum (t * x)) p + +theorem continuous_finiteR (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) : Continuous (finiteR ρ eig hρ hρsum) := by + apply continuous_iff_continuousAt.mpr + intro x + rcases lt_trichotomy x 0 with hx | hx | hx + · have hc : ContinuousAt (fun _ : ℝ => ∑ a, ρ a * eig a) x := continuousAt_const + apply hc.congr_of_eventuallyEq + filter_upwards [Iio_mem_nhds hx] with y hy + simp only [finiteR, ite_eq_right (not_lt.mpr (le_of_lt (show y < 0 from hy)))] + · subst x + exact continuousAt_finiteR_zero ρ eig hρ hρsum + · exact (hasStrictDerivAt_finiteR ρ eig hρ hρsum hx).hasDerivAt.continuousAt + +theorem continuous_finiteSpectralSlope (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) : Continuous (finiteSpectralSlope ρ eig hρ hρsum) := by + exact continuous_finsetSum _ fun a _ => continuous_const.mul + (continuous_projectedResolventDerivative ρ eig hρ hρsum a) + +theorem finiteSpectralSlope_zero (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) : + finiteSpectralSlope ρ eig hρ hρsum 0 = ∑ a, ρ a * eig a := by + simp only [finiteSpectralSlope, projectedResolventDerivative, lt_self_iff_false, ite_false] + apply Finset.sum_congr rfl + intro a _ + ring + +theorem finiteSpectralSlope_bounds (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {l u : ℝ} + (hl : ∀ a, l ≤ eig a) (hu : ∀ a, eig a ≤ u) (x : ℝ) : + l ≤ finiteSpectralSlope ρ eig hρ hρsum x ∧ finiteSpectralSlope ρ eig hρ hρsum x ≤ u := by + have hw := sum_projectedResolventDerivative ρ eig hρ hρsum x + constructor + · calc + l = ∑ a, l * projectedResolventDerivative ρ eig hρ hρsum a x := by + rw [← Finset.mul_sum, hw, mul_one] + _ ≤ finiteSpectralSlope ρ eig hρ hρsum x := Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_right (hl a) + (projectedResolventDerivative_pos ρ eig hρ hρsum a x).le + · calc + finiteSpectralSlope ρ eig hρ hρsum x ≤ + ∑ a, u * projectedResolventDerivative ρ eig hρ hρsum a x := Finset.sum_le_sum fun a _ => + mul_le_mul_of_nonneg_right (hu a) + (projectedResolventDerivative_pos ρ eig hρ hρsum a x).le + _ = u := by rw [← Finset.mul_sum, hw, mul_one] + +theorem sum_eig_projectedResolvent (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 ≤ x) : + (∑ a, eig a * projectedResolvent ρ eig hρ hρsum a x) = + x * finiteR ρ eig hρ hρsum x := by + rcases hx.eq_or_lt with h | h + · subst x + simp only [projectedResolvent, lt_self_iff_false, ite_false, mul_zero, + Finset.sum_const_zero, zero_mul] + · let B := finiteInverse ρ eig hρ hρsum x + have hs := finiteInverse_spec ρ eig hρ hρsum h + have hterm : ∀ a, eig a * (ρ a / (B - eig a)) = B * (ρ a / (B - eig a)) - ρ a := by + intro a + have hgap : B - eig a ≠ 0 := (sub_pos.mpr (hs.1 a)).ne' + field_simp [hgap] + ring + simp only [projectedResolvent, finiteR, ite_eq_left h] + change (∑ a, eig a * (ρ a / (B - eig a))) = x * (B - 1 / x) + simp_rw [hterm] + rw [Finset.sum_sub_distrib, ← Finset.mul_sum, hρsum] + change B * finiteResolvent ρ eig B - 1 = x * (B - 1 / x) + rw [hs.2] + field_simp + +theorem hasDerivWithinAt_mul_finiteR_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 ≤ x) : + HasDerivWithinAt (fun y => y * finiteR ρ eig hρ hρsum y) + (finiteSpectralSlope ρ eig hρ hρsum x) (Ici 0) x := by + have hd : HasDerivWithinAt + (fun y => ∑ a, eig a * projectedResolvent ρ eig hρ hρsum a y) + (finiteSpectralSlope ρ eig hρ hρsum x) (Ici 0) x := by + convert! HasDerivWithinAt.fun_sum (u := Finset.univ) (fun a _ => + (hasDerivWithinAt_projectedResolvent_nonneg ρ eig hρ hρsum a hx).const_mul (eig a)) using 1 + exact hd.congr (fun y hy => (sum_eig_projectedResolvent ρ eig hρ hρsum hy).symm) + (sum_eig_projectedResolvent ρ eig hρ hρsum hx).symm + +theorem finiteSpectralSlope_monotoneOn (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) : + MonotoneOn (finiteSpectralSlope ρ eig hρ hρsum) (Ici 0) := by + intro x hx y hy hxy + let c := y + 1 + have hc : 0 < c := by dsimp [c]; linarith [show 0 ≤ y from hy] + have hdx : HasDerivWithinAt (fun z => z * finiteR ρ eig hρ hρsum z) + (finiteSpectralSlope ρ eig hρ hρsum x) (Icc 0 c) x := + (hasDerivWithinAt_mul_finiteR_nonneg ρ eig hρ hρsum hx).mono (fun _ hz => hz.1) + have hdy : HasDerivWithinAt (fun z => z * finiteR ρ eig hρ hρsum z) + (finiteSpectralSlope ρ eig hρ hρsum y) (Icc 0 c) y := + (hasDerivWithinAt_mul_finiteR_nonneg ρ eig hρ hρsum hy).mono (fun _ hz => hz.1) + have hdiff : DifferentiableOn ℝ (fun z => z * finiteR ρ eig hρ hρsum z) (Icc 0 c) := by + intro z hz + exact ((hasDerivWithinAt_mul_finiteR_nonneg ρ eig hρ hρsum hz.1).mono + (fun _ hu => hu.1)).differentiableWithinAt + have hmono := (convexOn_mul_finiteR ρ eig hρ hρsum).monotoneOn_derivWithin hdiff + have hx' : x ∈ Icc 0 c := ⟨hx, by dsimp [c]; linarith⟩ + have hy' : y ∈ Icc 0 c := ⟨hy, by dsimp [c]; linarith⟩ + have h := hmono hx' hy' hxy + rw [hdx.derivWithin (uniqueDiffOn_Icc hc x hx'), + hdy.derivWithin (uniqueDiffOn_Icc hc y hy')] at h + exact h + +theorem hasDerivWithinAt_finiteThermalScalar (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {t x : ℝ} (ht : 0 ≤ t) (hx : 0 ≤ x) : + HasDerivWithinAt (finiteThermalScalar ρ eig hρ hρsum t) + (finiteSpectralSlope ρ eig hρ hρsum (t * x)) (Ici 0) x := by + rcases ht.eq_or_lt with h | h + · subst t + rw [zero_mul, finiteSpectralSlope_zero] + have hd := (hasDerivAt_id x).mul_const (∑ a, ρ a * eig a) + convert! hd.hasDerivWithinAt using 1 + · funext y + simp [finiteThermalScalar, finiteR] + · simp + · have hdH := hasDerivWithinAt_mul_finiteR_nonneg ρ eig hρ hρsum (mul_nonneg h.le hx) + have hdlin : HasDerivWithinAt (fun y : ℝ => t * y) t (Ici 0) x := by + convert! ((hasDerivAt_id x).const_mul t).hasDerivWithinAt using 1 + ring + have hd := (hdH.comp x hdlin (fun y hy => mul_nonneg h.le hy)).const_mul (1 / t) + convert! hd using 1 + · funext y + dsimp [finiteThermalScalar, Function.comp_def] + field_simp [h.ne'] + · field_simp [h.ne'] + +theorem finiteInteractionEnergy_mono_deficit (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {t : ℝ} (ht : 0 ≤ t) (p q : OverlapPath) + (hD : ∀ r ∈ Icc (0 : ℝ) 1, deficit p r ≤ deficit q r) : + finiteInteractionEnergy ρ eig hρ hρsum t p ≤ finiteInteractionEnergy ρ eig hρ hρsum t q := by + have hc : Continuous (fun x => finiteSpectralSlope ρ eig hρ hρsum (t * x)) := + (continuous_finiteSpectralSlope ρ eig hρ hρsum).comp (continuous_const.mul continuous_id) + unfold finiteInteractionEnergy spectralFunctional + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply integral_mono_ae (integrable_spectral_composition _ hc p) (integrable_spectral_composition _ hc q) + filter_upwards [ae_restrict_mem measurableSet_Ioo] with r hr + have hp := deficit_mem_unit p ⟨hr.1.le, hr.2.le⟩ + have hq := deficit_mem_unit q ⟨hr.1.le, hr.2.le⟩ + exact finiteSpectralSlope_monotoneOn ρ eig hρ hρsum + (mul_nonneg ht hp.1) (mul_nonneg ht hq.1) + (mul_le_mul_of_nonneg_left (hD r ⟨hr.1.le, hr.2.le⟩) ht) + +/-- The energy comparison in Section 4 follows from the upper-tail order, +including paths with atoms. -/ +theorem finiteInteractionEnergy_mono_tail (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {t : ℝ} (ht : 0 ≤ t) (p q : OverlapPath) + (htail : ∀ s ∈ Icc (0 : ℝ) 1, pathTail q s ≤ pathTail p s) : + finiteInteractionEnergy ρ eig hρ hρsum t p ≤ finiteInteractionEnergy ρ eig hρ hρsum t q := by + exact finiteInteractionEnergy_mono_deficit ρ eig hρ hρsum ht p q + (fun r _ => deficit_le_of_pathTail_le p q htail r) + +theorem abs_finiteInteractionEnergy_le (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {K : ℝ} (heig : ∀ a, |eig a| ≤ K) + (t : ℝ) (p : OverlapPath) : + |finiteInteractionEnergy ρ eig hρ hρsum t p| ≤ K / 2 := by + have hb : ∀ x, |finiteSpectralSlope ρ eig hρ hρsum x| ≤ K := by + intro x + exact abs_le.mpr (finiteSpectralSlope_bounds ρ eig hρ hρsum + (fun a => (abs_le.mp (heig a)).1) (fun a => (abs_le.mp (heig a)).2) x) + have hi := norm_integral_le_of_norm_le_const (μ := pathMeasure) + (f := fun r => finiteSpectralSlope ρ eig hρ hρsum (t * deficit p r)) + (C := K) (ae_of_all _ fun r => by simpa only [Real.norm_eq_abs] using hb (t * deficit p r)) + unfold finiteInteractionEnergy spectralFunctional + rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 2)] + have hi' : |∫ r, finiteSpectralSlope ρ eig hρ hρsum (t * deficit p r) ∂pathMeasure| ≤ K := by + simpa only [Real.norm_eq_abs, measureReal_def, pathMeasure_univ, ENNReal.toReal_one, mul_one] using hi + nlinarith + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEnergyPrimitive.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEnergyPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3eef12ba383a0a3a87f79f97bf1d54cf402bfa3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralEnergyPrimitive.lean @@ -0,0 +1,78 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralEnergy + +namespace OAI + +/-! The temperature primitive of the finite-spectrum interaction energy. -/ + +noncomputable section + +open MeasureTheory Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem integral_finiteSpectralSlope_temperature (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {t x : ℝ} (ht : 0 ≤ t) (hx : 0 ≤ x) : + (∫ u in 0..t, finiteSpectralSlope ρ eig hρ hρsum (u * x)) = + t * finiteR ρ eig hρ hρsum (t * x) := by + have hc : Continuous (finiteThermalScalar ρ eig hρ hρsum x) := + continuous_id.mul ((continuous_finiteR ρ eig hρ hρsum).comp + (continuous_const.mul continuous_id)) + have hd : ∀ u ∈ Ioo (0 : ℝ) t, + HasDerivWithinAt (finiteThermalScalar ρ eig hρ hρsum x) + (finiteSpectralSlope ρ eig hρ hρsum (u * x)) (Ioi u) u := by + intro u hu + have h := hasDerivWithinAt_finiteThermalScalar ρ eig hρ hρsum hx hu.1.le + rw [mul_comm x u] at h + exact h.mono fun y hy => (lt_trans hu.1 (show u < y from hy)).le + have hint : IntervalIntegrable (fun u => finiteSpectralSlope ρ eig hρ hρsum (u * x)) + volume 0 t := + ((continuous_finiteSpectralSlope ρ eig hρ hρsum).comp + (continuous_id.mul continuous_const)).intervalIntegrable 0 t + have hFTC := intervalIntegral.integral_eq_sub_of_hasDeriv_right_of_le ht hc.continuousOn hd hint + simpa only [finiteThermalScalar, zero_mul, sub_zero, mul_comm x t] using hFTC + +/-- Equation `up:primitive`, for the actual finite atomic spectral transform. -/ +theorem integral_finiteInteractionEnergy (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {t : ℝ} (ht : 0 ≤ t) (p : OverlapPath) : + (∫ u in 0..t, finiteInteractionEnergy ρ eig hρ hρsum u p) = + spectralFunctional (fun x => t * finiteR ρ eig hρ hρsum (t * x)) p := by + let K := ∑ a, |eig a| + have heig : ∀ a, |eig a| ≤ K := by + intro a + exact Finset.single_le_sum (f := fun a => |eig a|) + (fun a _ => abs_nonneg (eig a)) (Finset.mem_univ a) + have hS : ∀ x, |finiteSpectralSlope ρ eig hρ hρsum x| ≤ K := by + intro x + exact abs_le.mpr (finiteSpectralSlope_bounds ρ eig hρ hρsum + (fun a => (abs_le.mp (heig a)).1) (fun a => (abs_le.mp (heig a)).2) x) + let f : ℝ → ℝ → ℝ := fun u r => finiteSpectralSlope ρ eig hρ hρsum (u * deficit p r) + let : IsFiniteMeasure (volume.restrict (uIoc 0 t)) := by + change IsFiniteMeasure (volume.restrict (Ioc (min 0 t) (max 0 t))) + infer_instance + have hm : Measurable (Function.uncurry f) := + (continuous_finiteSpectralSlope ρ eig hρ hρsum).measurable.comp + (measurable_fst.mul ((continuous_deficit p).measurable.comp measurable_snd)) + have hi : Integrable (Function.uncurry f) ((volume.restrict (uIoc 0 t)).prod pathMeasure) := by + apply (integrable_const K).mono' hm.aestronglyMeasurable + exact ae_of_all _ fun z => by + change ‖finiteSpectralSlope ρ eig hρ hρsum (z.1 * deficit p z.2)‖ ≤ K + simpa only [Real.norm_eq_abs] using hS (z.1 * deficit p z.2) + have hswap := intervalIntegral_integral_swap hi + unfold finiteInteractionEnergy spectralFunctional + rw [intervalIntegral.integral_const_mul] + change (1 / 2 : ℝ) * (∫ u in 0..t, ∫ r, f u r ∂pathMeasure) = + (1 / 2 : ℝ) * ∫ r, t * finiteR ρ eig hρ hρsum (t * deficit p r) ∂pathMeasure + rw [hswap] + congr 1 + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Ioo] with r hr + exact integral_finiteSpectralSlope_temperature ρ eig hρ hρsum ht (deficit_nonneg p hr.2.le) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcess.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcess.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8188a37040d211f3c0312c8a5d6d75b3a4b6e88 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcess.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralClipping + +namespace OAI + +/-! The finite spectral excess vanishes under the no-outlier condition. -/ + +noncomputable section +open Filter +open scoped Topology Classical + +namespace InvariantIsing + +def spectralExcess {N : ℕ} (eig : Fin N → ℝ) (a b : ℝ) : ℝ := + (insert 0 (Finset.univ.image (fun i => max (a-eig i) (eig i-b)))).max' + (Finset.insert_nonempty 0 _) + +lemma spectralExcess_nonneg {N : ℕ} (eig : Fin N → ℝ) (a b : ℝ) : + 0 ≤ spectralExcess eig a b := Finset.le_max' _ _ (Finset.mem_insert_self _ _) + +lemma spectralExcess_bounds {N : ℕ} (eig : Fin N → ℝ) (a b : ℝ) (i : Fin N) : + a-spectralExcess eig a b ≤ eig i ∧ eig i ≤ b+spectralExcess eig a b := by + have hh : max (a-eig i) (eig i-b) ≤ spectralExcess eig a b := by + unfold spectralExcess + exact Finset.le_max' (insert (0 : ℝ) (Finset.univ.image (fun j => max (a-eig j) (eig j-b)))) + (max (a-eig i) (eig i-b)) (by + rw [Finset.mem_insert] + exact Or.inr (Finset.mem_image.mpr ⟨i,Finset.mem_univ i,rfl⟩)) + have hl := (le_max_left (a-eig i) (eig i-b)).trans hh + have hu := (le_max_right (a-eig i) (eig i-b)).trans hh + constructor <;> linarith + +lemma spectralExcess_le {N : ℕ} (eig : Fin N → ℝ) (a b ε : ℝ) (hε : 0 ≤ ε) + (h : ∀ i, a-ε ≤ eig i ∧ eig i ≤ b+ε) : spectralExcess eig a b ≤ ε := by + apply Finset.max'_le + intro x hx + rcases Finset.mem_insert.mp hx with rfl | hx + · exact hε + · obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hx + exact max_le (by linarith [(h i).1]) (by linarith [(h i).2]) + +lemma spectralExcess_tendsto (eig : (N : ℕ) → Fin N → ℝ) (a b : ℝ) + (h : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) : + Tendsto (fun N => spectralExcess (eig N) a b) atTop (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [h (ε/2) (by positivity)] with N hN + rw [Real.dist_eq,sub_zero,abs_of_nonneg (spectralExcess_nonneg _ _ _)] + exact (spectralExcess_le _ _ _ _ (by positivity) hN).trans_lt (by linarith) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcessContinuity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcessContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9e13912396916a0b1a14c010752bbe6151f71ca --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcessContinuity.lean @@ -0,0 +1,29 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess +import Mathlib.Topology.Order.Lattice + +namespace OAI + +/-! Continuity of the finite nonempty spectral excess. -/ +noncomputable section +namespace InvariantIsing + +lemma spectralExcess_eq_max_sup {n : ℕ} (eig : Fin (n+1) → ℝ) (a b : ℝ) : + spectralExcess eig a b = max 0 + (Finset.univ.sup' Finset.univ_nonempty (fun i => max (a-eig i) (eig i-b))) := by + classical + unfold spectralExcess + rw [Finset.max'_insert _ _ (Finset.univ_nonempty.image _),Finset.max'_eq_sup',Finset.sup'_image] + rfl + +lemma continuous_spectralExcess {X : Type*} [TopologicalSpace X] {n : ℕ} + (eig : X → Fin (n+1) → ℝ) (heig : ∀ i, Continuous (fun x => eig x i)) (a b : ℝ) : + Continuous (fun x => spectralExcess (eig x) a b) := by + simp_rw [spectralExcess_eq_max_sup] + exact continuous_const.max (Continuous.finset_sup'_apply Finset.univ_nonempty + (fun i _ => (continuous_const.sub (heig i)).max ((heig i).sub continuous_const))) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcessScale.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcessScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cc0a30d4ebca89db45048c6747a04d27f322af7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExcessScale.lean @@ -0,0 +1,35 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! Multiplication by a real coupling transports the spectral interval and its error. -/ +noncomputable section +namespace InvariantIsing + +lemma spectralExcess_scale_le {N : ℕ} (eig : Fin N → ℝ) (a b c : ℝ) : + spectralExcess (fun i => c*eig i) (min (c*a) (c*b)) (max (c*a) (c*b)) ≤ + |c| * spectralExcess eig a b := by + have he := spectralExcess_nonneg eig a b + apply spectralExcess_le _ _ _ _ (mul_nonneg (abs_nonneg c) he) + intro i + have h := spectralExcess_bounds eig a b i + by_cases hc : 0 ≤ c + · rw [abs_of_nonneg hc] + have hl := mul_le_mul_of_nonneg_left h.1 hc + have hu := mul_le_mul_of_nonneg_left h.2 hc + constructor + · nlinarith [min_le_left (c*a) (c*b)] + · nlinarith [le_max_right (c*a) (c*b)] + · have hc' : c ≤ 0 := le_of_not_ge hc + rw [abs_of_nonpos hc'] + have hl := mul_le_mul_of_nonpos_left h.1 hc' + have hu := mul_le_mul_of_nonpos_left h.2 hc' + constructor + · nlinarith [min_le_right (c*a) (c*b)] + · nlinarith [le_max_left (c*a) (c*b)] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExistence.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1ee84022ff91af8f9e562a990e67a1e99f41826 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExistence.lean @@ -0,0 +1,83 @@ +import OAI.Probability.InvariantIsing.Spectral.Spectral +import Mathlib.Topology.Order.IntermediateValue + +namespace OAI + +/-! +The inverse Cauchy transform of a finite alphabet always lies strictly +above its largest atom. This supplies existence, as well as uniqueness, +for the resolvent used by the finite-alphabet cavity construction. +-/ + +noncomputable section + +open scoped BigOperators +open Set + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem continuousOn_finiteResolvent (ρ eig : ι → ℝ) (s : Set ℝ) + (hs : ∀ b ∈ s, ∀ a, eig a < b) : + ContinuousOn (finiteResolvent ρ eig) s := by + unfold finiteResolvent + apply continuousOn_finsetSum + intro a _ + exact continuousOn_const.div (continuousOn_id.sub continuousOn_const) + (fun b hb => ne_of_gt (sub_pos.mpr (hs b hb a))) + +/-- Existence and uniqueness above an upper edge carrying positive mass. -/ +theorem exists_unique_finiteResolvent_solution {ρ eig : ι → ℝ} {a₀ : ι} {x : ℝ} + (hρ : ∀ a, 0 ≤ ρ a) (hρsum : ∑ a, ρ a = 1) + (ha₀ : 0 < ρ a₀) (he : ∀ a, eig a ≤ eig a₀) (hx : 0 < x) : + ∃! b : ℝ, (∀ a, eig a < b) ∧ finiteResolvent ρ eig b = x := by + let lo := eig a₀ + ρ a₀ / (2 * x) + let hi := lo + 1 / x + have hx0 : x ≠ 0 := ne_of_gt hx + have hdist : 0 < ρ a₀ / (2 * x) := div_pos ha₀ (by positivity) + have helo : eig a₀ < lo := by dsimp [lo]; linarith + have hlohi : lo < hi := by dsimp [hi]; linarith [one_div_pos.mpr hx] + have hEiglo : ∀ a, eig a < lo := fun a => (he a).trans_lt helo + have hsingle : ρ a₀ / (lo - eig a₀) = 2 * x := by + dsimp [lo] + field_simp [ne_of_gt ha₀] + ring + have hxlo : x ≤ finiteResolvent ρ eig lo := by + have hterm : ρ a₀ / (lo - eig a₀) ≤ finiteResolvent ρ eig lo := + Finset.single_le_sum (fun a _ => div_nonneg (hρ a) (sub_pos.mpr (hEiglo a)).le) + (Finset.mem_univ a₀) + rw [hsingle] at hterm + linarith + have hhiedge : eig a₀ < hi := helo.trans hlohi + have hupper := finiteResolvent_le hρ hρsum he hhiedge + have hxhi : finiteResolvent ρ eig hi ≤ x := by + apply hupper.trans + have hhidist : 1 / x ≤ hi - eig a₀ := by dsimp [hi, lo]; linarith + have h := one_div_le_one_div_of_le (one_div_pos.mpr hx) hhidist + simpa using h + have hcont : ContinuousOn (finiteResolvent ρ eig) (Icc lo hi) := + continuousOn_finiteResolvent ρ eig _ (fun b hb a => (hEiglo a).trans_le hb.1) + obtain ⟨b, hb, hbx⟩ := intermediate_value_Icc' hlohi.le hcont ⟨hxhi, hxlo⟩ + have hbEig : ∀ a, eig a < b := fun a => (hEiglo a).trans_le hb.1 + refine ⟨b, ⟨hbEig, hbx⟩, ?_⟩ + intro c hc + exact finiteResolvent_solution_unique hρ hρsum hc.1 hbEig hc.2 hbx + +/-- In particular every finite spectral probability law with positive masses +has an uncapped inverse at every positive argument. -/ +theorem exists_unique_finiteResolvent_of_pos {ρ eig : ι → ℝ} {x : ℝ} + (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (hx : 0 < x) : + ∃! b : ℝ, (∀ a, eig a < b) ∧ finiteResolvent ρ eig b = x := by + classical + obtain ⟨a, _⟩ := exists_pos_spectral_weight (fun a => (hρ a).le) hρsum + have hnonempty : (Finset.univ : Finset ι).Nonempty := ⟨a, Finset.mem_univ a⟩ + obtain ⟨a₀, _, he⟩ := Finset.exists_max_image Finset.univ eig hnonempty + exact exists_unique_finiteResolvent_solution (fun a => (hρ a).le) hρsum + (hρ a₀) (fun a => he a (Finset.mem_univ a)) hx + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExtremeLimits.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExtremeLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ad4451cdec7fdd04d1950c034ecb1726ef9a18e --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralExtremeLimits.lean @@ -0,0 +1,50 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralExcess + +namespace OAI + +/-! Convergence of the actual extreme eigenvalues implies the uniform +no-outlier formulation used by the pressure theorem. -/ + +noncomputable section +open Filter +open scoped Topology Classical + +namespace InvariantIsing + +def spectralMinimum {n : ℕ} (eig : Fin (n+1) → ℝ) : ℝ := + (Finset.univ.image eig).min' (Finset.image_nonempty.mpr Finset.univ_nonempty) + +def spectralMaximum {n : ℕ} (eig : Fin (n+1) → ℝ) : ℝ := + (Finset.univ.image eig).max' (Finset.image_nonempty.mpr Finset.univ_nonempty) + +lemma spectralMinimum_le {n : ℕ} (eig : Fin (n+1) → ℝ) (i : Fin (n+1)) : + spectralMinimum eig ≤ eig i := + Finset.min'_le _ _ (Finset.mem_image.mpr ⟨i,Finset.mem_univ i,rfl⟩) + +lemma le_spectralMaximum {n : ℕ} (eig : Fin (n+1) → ℝ) (i : Fin (n+1)) : + eig i ≤ spectralMaximum eig := + Finset.le_max' _ _ (Finset.mem_image.mpr ⟨i,Finset.mem_univ i,rfl⟩) + +lemma spectral_no_outliers_of_extreme_limits + (eig : (N : ℕ) → Fin N → ℝ) (a b : ℝ) + (hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε := by + intro ε hε + have hh : ∀ᶠ k in atTop, ∀ i, a-ε ≤ eig (k+1) i ∧ eig (k+1) i ≤ b+ε := by + filter_upwards [hmin.eventually (Ioi_mem_nhds (by linarith : a-ε < a)), + hmax.eventually (Iio_mem_nhds (by linarith : b < b+ε))] with k hl hu i + exact ⟨hl.le.trans (spectralMinimum_le _ i),(le_spectralMaximum _ i).trans hu.le⟩ + obtain ⟨M,hM⟩ := eventually_atTop.mp hh + apply eventually_atTop.mpr + refine ⟨M+1,fun N hN => ?_⟩ + have hn : N-1+1=N := by omega + have hs := hM (N-1) (by omega) + rw [hn] at hs + exact hs + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralFubini.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralFubini.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2542b4e9ebe2678ec258824db0d1a32d7b44565 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralFubini.lean @@ -0,0 +1,152 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralDensityContinuity +import OAI.Probability.InvariantIsing.Spectral.SpectralPrimitive +import OAI.Probability.InvariantIsing.Spectral.SpectralSymbols + +namespace OAI + +/-! Fubini identification of reconstructed spectral-group symbols. -/ + +noncomputable section + +open MeasureTheory Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +/-- The layer-cake calculation in manuscript `rot:function-path`. -/ +theorem integral_spectralDensity_CDF_fubini (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) {q : ℝ} + (hq : q ∈ Icc (0 : ℝ) 1) : + (∫ r in q..1, spectralPathDensity ρ eig hρ hρsum p a r * + pathMeasure.real {u | p u ≤ r}) = + ∫ u, (∫ r in max q (p u)..1, spectralPathDensity ρ eig hρ hρsum p a r) ∂pathMeasure := by + let h := spectralPathDensity ρ eig hρ hρsum p a + let K : ℝ → ℝ → ℝ := fun r u => if p u ≤ r then h r else 0 + let : IsFiniteMeasure (volume.restrict (uIoc q 1)) := by + change IsFiniteMeasure (volume.restrict (Ioc (min q 1) (max q 1))) + infer_instance + have hm : Measurable (Function.uncurry K) := by + exact Measurable.ite + (measurableSet_le (p.measurable.comp measurable_snd) measurable_fst) + ((continuous_spectralPathDensity ρ eig hρ hρsum p a).measurable.comp measurable_fst) + measurable_const + have hK : Integrable (Function.uncurry K) + ((volume.restrict (uIoc q 1)).prod pathMeasure) := by + apply (integrable_const (1 : ℝ)).mono' hm.aestronglyMeasurable + exact ae_of_all _ fun z => by + dsimp [Function.uncurry, K] + split_ifs + · rw [abs_of_nonneg (spectralPathDensity_nonneg ρ eig hρ hρsum p a z.1)] + exact spectralPathDensity_le_one ρ eig hρ hρsum p a z.1 + · simp + have hinner_u : ∀ r, (∫ u, K r u ∂pathMeasure) = h r * pathMeasure.real {u | p u ≤ r} := by + intro r + change (∫ u, ({u | p u ≤ r}).indicator (fun _ => h r) u ∂pathMeasure) = _ + rw [integral_indicator_const (h r) (measurableSet_le p.measurable measurable_const)] + simp only [smul_eq_mul, mul_comm] + have hinner_r : ∀ u, (∫ r in q..1, K r u) = ∫ r in max q (p u)..1, h r := by + intro u + rw [intervalIntegral.integral_of_le hq.2, + intervalIntegral.integral_of_le (max_le hq.2 (p.le_one u))] + change (∫ r, (Ici (p u)).indicator h r ∂volume.restrict (Ioc q 1)) = _ + rw [integral_indicator measurableSet_Ici, + ← restrict_Ioi_eq_restrict_Ici, + Measure.restrict_restrict measurableSet_Ioi, inter_comm, Ioc_inter_Ioi] + have hswap := intervalIntegral_integral_swap hK + simp_rw [hinner_u, hinner_r] at hswap + exact hswap + +theorem spectralGroupSymbol_eq_CDF_integral (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) {s : ℝ} + (hs : s ∈ Icc (0 : ℝ) 1) : + pathSymbol (spectralGroupDiagonal ρ eig hρ hρsum p a) + (spectralGroupPath ρ eig hρ hρsum p a) s = + ∫ r in p s..1, spectralPathDensity ρ eig hρ hρsum p a r * + pathMeasure.real {u | p u ≤ r} := by + let h := spectralPathDensity ρ eig hρ hρsum p a + let G : ℝ → ℝ := fun q => ∫ r in 0..q, h r + have hc : Continuous h := continuous_spectralPathDensity ρ eig hρ hρsum p a + have hG : Monotone G := by + intro q r hqr + have hi := intervalIntegral.integral_nonneg_of_forall (μ := volume) hqr + (spectralPathDensity_nonneg ρ eig hρ hρsum p a) + have hadd := intervalIntegral.integral_add_adjacent_intervals + (hc.intervalIntegrable (μ := volume) 0 q) (hc.intervalIntegrable (μ := volume) q r) + dsimp [G] + linarith + let H : ℝ → ℝ := fun u => G (max (p s) (p u)) + have hH : Monotone H := by + intro u v huv + exact hG (max_le_max le_rfl (p.monotone huv)) + have hHbounds : ∀ u, 0 ≤ H u ∧ H u ≤ spectralGroupDiagonal ρ eig hρ hρsum p a := by + intro u + have h0 : G 0 = 0 := by simp [G] + constructor + · rw [← h0] + exact hG (le_max_of_le_left (p.nonneg s)) + · exact hG (max_le (p.le_one s) (p.le_one u)) + have hHi : Integrable H pathMeasure := by + apply (integrable_const (spectralGroupDiagonal ρ eig hρ hρsum p a)).mono' + hH.measurable.aestronglyMeasurable + exact ae_of_all _ fun u => by + rw [Real.norm_eq_abs, abs_of_nonneg (hHbounds u).1] + exact (hHbounds u).2 + have htail : ∀ u, (∫ r in max (p s) (p u)..1, h r) = + spectralGroupDiagonal ρ eig hρ hρsum p a - H u := by + intro u + have hadd := intervalIntegral.integral_add_adjacent_intervals + (hc.intervalIntegrable (μ := volume) 0 (max (p s) (p u))) + (hc.intervalIntegrable (μ := volume) (max (p s) (p u)) 1) + change _ = (∫ r in 0..1, h r) - (∫ r in 0..max (p s) (p u), h r) + linarith + have hlow : (∫ u in 0..s, H u) = s * spectralGroupPath ρ eig hρ hρsum p a s := by + calc + _ = ∫ _ in 0..s, spectralGroupPath ρ eig hρ hρsum p a s := by + apply intervalIntegral.integral_congr_Ioo_of_le hs.1 + intro u hu + dsimp [H] + rw [max_eq_left (p.monotone hu.2.le)] + rfl + _ = _ := by simp only [intervalIntegral.integral_const, sub_zero, smul_eq_mul] + have hhigh : (∫ u in s..1, H u) = ∫ u in s..1, spectralGroupPath ρ eig hρ hρsum p a u := by + apply intervalIntegral.integral_congr_Ioo_of_le hs.2 + intro u hu + dsimp [H] + rw [max_eq_right (p.monotone hu.1.le)] + rfl + have hHmean : (∫ u, H u ∂pathMeasure) = + s * spectralGroupPath ρ eig hρ hρsum p a s + + ∫ u in s..1, spectralGroupPath ρ eig hρ hρsum p a u := by + have hadd := intervalIntegral.integral_add_adjacent_intervals + (hH.intervalIntegrable (μ := volume) (a := 0) (b := s)) + (hH.intervalIntegrable (μ := volume) (a := s) (b := 1)) + rw [hlow, hhigh] at hadd + change (∫ u in Ioo 0 1, H u) = _ + rw [← integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le zero_le_one] + exact hadd.symm + rw [integral_spectralDensity_CDF_fubini ρ eig hρ hρsum p a ⟨p.nonneg s, p.le_one s⟩] + change _ = ∫ u, (∫ r in max (p s) (p u)..1, h r) ∂pathMeasure + simp_rw [htail] + rw [integral_sub (integrable_const _) hHi] + simp only [integral_const, measureReal_def, pathMeasure_univ, ENNReal.toReal_one, one_smul] + rw [hHmean] + unfold pathSymbol + ring + +/-- The full reconstructed-symbol identity in manuscript `rot:function-path`. -/ +theorem spectralGroupSymbol_eq_projectedResolvent (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) {s : ℝ} + (hs : s ∈ Icc (0 : ℝ) 1) : + pathSymbol (spectralGroupDiagonal ρ eig hρ hρsum p a) + (spectralGroupPath ρ eig hρ hρsum p a) s = + projectedResolvent ρ eig hρ hρsum a (deficit p (p s)) := by + rw [spectralGroupSymbol_eq_CDF_integral ρ eig hρ hρsum p a hs] + exact integral_spectralDensity_mul_CDF ρ eig hρ hρsum p a ⟨p.nonneg s, p.le_one s⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGG.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGG.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa4327772a718790e88d708a1c54d453eaf74d15 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGG.lean @@ -0,0 +1,122 @@ +import OAI.Probability.InvariantIsing.Arrays.DiagonalCovariance +import OAI.Probability.InvariantIsing.Arrays.PerturbationMeasurability + +namespace OAI + +/-! The Gaussian GG bound specialized to the manuscript's spectral/tree kernels. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma spectralMonomial_self_deviation_le {N m : ℕ} (U : Rotation N) + (I : Fin m → Finset (Fin N)) (d : Fin m → ℕ) (q : Fin m → ℝ) + (hq : ∀ a, q a ∈ Set.Icc (0 : ℝ) 1) (σ : Spin N) : + |(∏ a, projectedOverlap U (I a) σ σ ^ d a) - ∏ a, q a ^ d a| ≤ + ∑ a, (d a : ℝ) * |projectedOverlap U (I a) σ σ - q a| := by + have hqa (a : Fin m) : |q a| ≤ 1 := by + rw [abs_of_nonneg (hq a).1] + exact (hq a).2 + have hp (a : Fin m) : |projectedOverlap U (I a) σ σ ^ d a| ≤ 1 := by + rw [abs_pow] + exact pow_le_one₀ (abs_nonneg _) (projectedOverlap_abs_le_one _ _ _ _) + have hqp (a : Fin m) : |q a ^ d a| ≤ 1 := by + rw [abs_pow] + exact pow_le_one₀ (abs_nonneg _) (hqa a) + exact (abs_prod_sub_prod_le_sum Finset.univ _ _ (fun a _ => hp a) (fun a _ => hqp a)).trans + (Finset.sum_le_sum fun a _ => abs_pow_sub_pow_le_degree + (projectedOverlap_abs_le_one _ _ _ _) (hqa a) (d a)) + +/-- The concrete Haar-dependent tensor coefficient map. -/ +def spectralPerturbationCoefficients {Ω : Type*} {N m : ℕ} + (U : Ω → SpecialOrthogonal N) (I : Fin m → Finset (Fin N)) + (d : Fin m → ℕ) (n r : ℕ) : Ω → (Spin N × LabeledLeaf n) → ℕ →₀ ℝ := + fun ω => jointSpectralMonomialCoefficients (specialRotation (U ω)) I d n r + +def spectralPerturbationKernel {Ω : Type*} {N m : ℕ} + (U : Ω → SpecialOrthogonal N) (I : Fin m → Finset (Fin N)) + (d : Fin m → ℕ) (n r : ℕ) (ω : Ω) (x y : Spin N × LabeledLeaf n) : ℝ := + (∏ a, projectedOverlap (specialRotation (U ω)) (I a) x.1 y.1 ^ d a) * + treeOverlap n x.2 y.2 ^ r + +lemma spectralPerturbationCoefficients_cross {Ω : Type*} {N m : ℕ} + (U : Ω → SpecialOrthogonal N) (I : Fin m → Finset (Fin N)) + (d : Fin m → ℕ) (n r : ℕ) (ω : Ω) (x y : Spin N × LabeledLeaf n) : + cylinderCross (spectralPerturbationCoefficients U I d n r ω x) + (spectralPerturbationCoefficients U I d n r ω y) = + spectralPerturbationKernel U I d n r ω x y := + jointSpectralMonomialCoefficients_cross (specialRotation (U ω)) I d n r x y + +lemma measurable_spectralPerturbationFields {Ω : Type*} [MeasurableSpace Ω] {N m : ℕ} + (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (I : Fin m → Finset (Fin N)) (d : Fin m → ℕ) (n r : ℕ) : + Measurable (fun p : (Ω × (ℕ → ℝ)) × (Spin N × LabeledLeaf n) => + cylinderField (spectralPerturbationCoefficients U I d n r p.1.1 p.2) p.1.2) := by + apply measurable_from_prod_countable_left + intro x + have h := (measurable_jointSpectralMonomialField I d n r x).comp + (hU.prodMap measurable_id) + simpa only [spectralPerturbationCoefficients, Function.comp_def, Prod.map_fst, Prod.map_snd, id_eq] using h + +lemma measurable_spectralPerturbationCross {Ω : Type*} [MeasurableSpace Ω] {N m : ℕ} + (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (I : Fin m → Finset (Fin N)) (d : Fin m → ℕ) (n r : ℕ) : + Measurable (fun p : Ω × ((Spin N × LabeledLeaf n) × (Spin N × LabeledLeaf n)) => + cylinderCross (spectralPerturbationCoefficients U I d n r p.1 p.2.1) + (spectralPerturbationCoefficients U I d n r p.1 p.2.2)) := by + apply measurable_from_prod_countable_left + intro xy + simp only [spectralPerturbationCoefficients, jointSpectralMonomialCoefficients_cross] + exact (Finset.measurable_prod Finset.univ (fun a _ => + ((measurable_projectedOverlap (I a) xy.1.1 xy.2.1).comp hU).pow_const (d a))).mul_const _ + +/-- Concrete conditional Gaussian GG estimate. The distribution of the external +rotation and the other disorder is arbitrary; Gaussian coordinates are the +independent product factor. -/ +theorem spectralPerturbation_gg_bound {Ω : Type*} [MeasurableSpace Ω] + {P : Measure Ω} [IsProbabilityMeasure P] {N m n k : ℕ} + (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (I : Fin m → Finset (Fin N)) (d : Fin m → ℕ) (treeDegree : ℕ) + {ν : Ω → Measure (Spin N × LabeledLeaf n)} (hν : Measurable ν) + [∀ ω, IsProbabilityMeasure (ν ω)] (t b d₀ : ℝ) + (D : Ω → (Fin (k + 1) → Spin N × LabeledLeaf n) → ℝ) + (hDm : Measurable (Function.uncurry D)) {c : ℝ} (hc : 0 ≤ c) + (hD : ∀ ω σ, |D ω σ| ≤ c) + (hE : Integrable (fun z : Ω × (ℕ → ℝ) => ∫ x, + |cylinderField (spectralPerturbationCoefficients U I d n treeDegree z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * + cylinderField (spectralPerturbationCoefficients U I d n treeDegree z.1 x) z.2)) + (P.prod gaussianCoordinates)) : + let A := spectralPerturbationCoefficients U I d n treeDegree + let κ := spectralPerturbationKernel U I d n treeDegree + |t| * |(k + 1 : ℕ) * randomCoefficientAverage P ν A t + (fun ω (τ : Fin (k + 1 + 1) → Spin N × LabeledLeaf n) => + D ω (Fin.tail τ) * κ ω ((Fin.tail τ) 0) (τ 0)) - + randomCoefficientAverage P ν A t D * randomCoefficientAverage P ν A t + (fun ω (τ : Fin 2 → Spin N × LabeledLeaf n) => κ ω (τ 1) (τ 0)) - + randomCoefficientAverage P ν A t + (fun ω σ => D ω σ * ∑ l : Fin k, κ ω (σ 0) (σ l.succ))| ≤ + 2 * c * ((∫ z : Ω × (ℕ → ℝ), ∫ x, |cylinderField (A z.1 x) z.2 - b| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2) + ∂P.prod gaussianCoordinates) + + |t| * (∫ z : Ω × (ℕ → ℝ), ∫ x, |κ z.1 x x - d₀| + ∂(ν z.1).tilted (fun x => t * cylinderField (A z.1 x) z.2) + ∂P.prod gaussianCoordinates)) := by + let A := spectralPerturbationCoefficients U I d n treeDegree + have hA (ω : Ω) (x : Spin N × LabeledLeaf n) : + (A ω x).sum (fun _ c => c ^ 2) ≤ 1 := + jointSpectralMonomialCoefficients_variance_le_one (specialRotation (U ω)) I d n treeDegree x + have hg := randomCoefficient_gaussian_gg_L1_bound (P := P) hν A + (measurable_spectralPerturbationFields U hU I d n treeDegree) + (measurable_spectralPerturbationCross U hU I d n treeDegree) + hA t b d₀ D hDm hc hD hE + simpa only [A, spectralPerturbationCoefficients_cross] using hg + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGGGeometry.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGGGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..11a0cb6d77c4dc0f904a23d54f440d2ea0505bf7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGGGeometry.lean @@ -0,0 +1,115 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralArrayGeometry + +namespace OAI + +/-! Published ultrametricity and synchronization applied to spectral GG limits. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators Topology Matrix + +namespace InvariantIsing + +lemma spectralGram_diagonal {m : ℕ} {x : SpectralArray m} (hG : SpectralGram x) + (q : Fin m → ℝ) (hd : ∀ i a, (x (i,i) a : ℝ) = q a) (a : Fin m) : + GramDiagonal (q a) (spectralCoordinateArray a x) := + ⟨hG a, fun i => hd i a⟩ + +def spectralLinearEntry {m : ℕ} (w : Fin m → ℝ) (x : SpectralEntry m) : ℝ := + ∑ a, w a * (x a : ℝ) + +def spectralLinearArray {m : ℕ} (w : Fin m → ℝ) (x : SpectralArray m) : RealArray := + fun i j => spectralLinearEntry w (x (i,j)) + +lemma continuous_spectralLinearEntry {m : ℕ} (w : Fin m → ℝ) : + Continuous (spectralLinearEntry w) := by + unfold spectralLinearEntry + fun_prop + +lemma continuous_spectralLinearArray {m : ℕ} (w : Fin m → ℝ) : + Continuous (spectralLinearArray w) := by + unfold spectralLinearArray spectralLinearEntry + fun_prop + +lemma spectralGram_linear {m : ℕ} {x : SpectralArray m} (hG : SpectralGram x) + (q w : Fin m → ℝ) (hd : ∀ i a, (x (i,i) a : ℝ) = q a) + (hw : ∀ a, 0 ≤ w a) : + GramDiagonal (∑ a, w a * q a) (spectralLinearArray w x) := by + constructor + · intro n + have hp := Matrix.posSemidef_sum Finset.univ (fun a _ => (hG a n).smul (hw a)) + have he : (fun i j : Fin n => spectralLinearArray w x i j) = + ∑ a : Fin m, w a • (fun i j : Fin n => spectralCoordinateArray a x i j) := by + ext i j + simp [spectralLinearArray, spectralLinearEntry, spectralCoordinateArray] + rw [he] + exact hp + · intro i + simp only [spectralLinearArray, spectralLinearEntry, hd] + +lemma spectralGG_coordinate_nonnegative {m : ℕ} {Q : ProbabilityMeasure (SpectralArray m)} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray m))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), SpectralGram x) + (q : Fin m → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), ∀ i a, (x (i,i) a : ℝ) = q a) : + ∀ᵐ x ∂(Q : Measure (SpectralArray m)), ∀ a, 0 ≤ (x (0,1) a : ℝ) := by + apply ae_all_iff.mpr + intro a + exact gg_pair_nonnegative_ae (continuous_spectralCoordinateArray a).measurable + (hgg.real_map (f := fun x => (x a : ℝ)) (by fun_prop)) (hq a) + (by filter_upwards [hG, hd] with x hx hdx; exact spectralGram_diagonal hx q hdx a) + +lemma spectralGG_linear_ultrametric {m : ℕ} {Q : ProbabilityMeasure (SpectralArray m)} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray m))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), SpectralGram x) + (q : Fin m → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : Equiv.Perm ℕ, + (Q : Measure (SpectralArray m)).map (permuteSpectralArray e) = Q) + (w : Fin m → ℝ) (hw : ∀ a, 0 ≤ w a) : + ∀ᵐ x ∂(Q : Measure (SpectralArray m)), IsUltrametricArray (spectralLinearArray w x) := by + exact gg_ultrametric_ae (continuous_spectralLinearArray w).measurable + (scalar_of_spectral_exchangeable hE (spectralLinearEntry w) + (continuous_spectralLinearEntry w).measurable) + (hgg.real_map (continuous_spectralLinearEntry w).measurable) + (Finset.sum_nonneg fun a _ => mul_nonneg (hw a) (hq a)) + (by filter_upwards [hG, hd] with x hx hdx; exact spectralGram_linear hx q w hdx hw) + +/-- Nonnegative combinations of the actual spectral and tree coordinates have +ordered joint support. This is the finite-vector consequence used for the +manuscript's simultaneous overlap paths. -/ +theorem spectralGG_support_ordered {m : ℕ} {Q : ProbabilityMeasure (SpectralArray m)} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray m))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), SpectralGram x) + (q : Fin m → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : Equiv.Perm ℕ, + (Q : Measure (SpectralArray m)).map (permuteSpectralArray e) = Q) + (w z : Fin m → ℝ) (hw : ∀ a, 0 ≤ w a) (hz : ∀ a, 0 ≤ z a) : + let ν := (Q : Measure (SpectralArray m)).map + (fun x => (spectralLinearArray w x 0 1, spectralLinearArray z x 0 1)) + ∀ x ∈ ν.support, ∀ y ∈ ν.support, x.1 < y.1 → x.2 ≤ y.2 := by + have hsum := spectralGG_linear_ultrametric hgg hG q hq hd hE + (w + z) (fun a => add_nonneg (hw a) (hz a)) + have he (x : SpectralArray m) : spectralLinearArray (w + z) x = + fun i j => spectralLinearArray w x i j + spectralLinearArray z x i j := by + funext i j + simp only [spectralLinearArray, spectralLinearEntry, Pi.add_apply, add_mul, Finset.sum_add_distrib] + simp_rw [he] at hsum + exact jointGG_support_ordered (continuous_spectralLinearArray w).measurable + (continuous_spectralLinearArray z).measurable + (hgg.map (f := fun x => (spectralLinearEntry w x, spectralLinearEntry z x)) + ((continuous_spectralLinearEntry w).prodMk (continuous_spectralLinearEntry z)).measurable) + (spectralGG_linear_ultrametric hgg hG q hq hd hE w hw) + (spectralGG_linear_ultrametric hgg hG q hq hd hE z hz) hsum + (by filter_upwards [hG, hd] with x hx hdx + exact (spectralGram_linear hx q w hdx hw).symm) + (by filter_upwards [hG, hd] with x hx hdx + exact (spectralGram_linear hx q z hdx hz).symm) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupIdentification.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..444040bc283582da13c99874c6efdcf4c1baa7e8 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupIdentification.lean @@ -0,0 +1,71 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralFubini +import OAI.Probability.InvariantIsing.Spectral.SpectralGroupRoots +import OAI.Probability.InvariantIsing.Arrays.PathSymbolAEUniqueness + +namespace OAI + +/-! A canonical group quantile and its diagonal are identified by the +spectral symbols and roots derived from the actual Ward equations. -/ + +noncomputable section + +open MeasureTheory Set Filter Function +open scoped BigOperators Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +/-- Equality with the reconstructed spectral group follows from its +proved symbol and root formulas and the AE path uniqueness theorem. -/ +theorem spectralGroup_identification_of_symbol_root (ρ eig : ι → ℝ) + (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (p q : OverlapPath) (d : ℝ) (a : ι) + (hsymbol : ∀ᵐ s ∂pathMeasure, pathSymbol d q.val s = + projectedResolvent ρ eig hρ hρsum a (deficit p (p s))) + (hroot : Function.rightLim q.val 0 = Function.rightLim p.val 0 * + projectedResolventDerivative ρ eig hρ hρsum a (deficit p (Function.rightLim p.val 0))) : + d = spectralGroupDiagonal ρ eig hρ hρsum p a ∧ + q.val =ᵐ[pathMeasure] spectralGroupPath ρ eig hρ hρsum p a := by + have hqB (s : ℝ) : |q s| ≤ 1 := by + rw [abs_of_nonneg (q.nonneg s)] + exact q.le_one s + have hGB (s : ℝ) : |spectralGroupPath ρ eig hρ hρsum p a s| ≤ 1 := by + rw [abs_of_nonneg (spectralGroupPath_nonneg ρ eig hρ hρsum p a s)] + exact (spectralGroupPath_le_diagonal ρ eig hρ hρsum p a s).trans + (spectralGroupDiagonal_le_one ρ eig hρ hρsum p a) + have heq : ∀ᵐ s ∂pathMeasure, pathSymbol d q.val s = + pathSymbol (spectralGroupDiagonal ρ eig hρ hρsum p a) + (spectralGroupPath ρ eig hρ hρsum p a) s := by + filter_upwards [ae_restrict_mem measurableSet_Ioo, hsymbol] with s hs hsym + exact hsym.trans (spectralGroupSymbol_eq_projectedResolvent ρ eig hρ hρsum p a + ⟨hs.1.le, hs.2.le⟩).symm + have hqr : Tendsto q.val (𝓝[>] (0 : ℝ)) + (𝓝 (Function.rightLim p.val 0 * projectedResolventDerivative ρ eig hρ hρsum a + (deficit p (Function.rightLim p.val 0)))) := by + rw [← hroot] + exact q.monotone.tendsto_rightLim 0 + exact ae_equal_pathSymbols_equal_roots q.val (spectralGroupPath ρ eig hρ hρsum p a) + q.measurable (spectralGroupPath_monotone ρ eig hρ hρsum p a).measurable hqB hGB + d (spectralGroupDiagonal ρ eig hρ hρsum p a) _ heq hqr + (spectralGroupPath_root_tendsto ρ eig hρ hρsum p a) + +/-- The finite family form keeps all group quantiles on one common full +measure set, as needed for the actual limiting spectral-array law. -/ +theorem spectralGroups_identification_of_symbols_roots (ρ eig : ι → ℝ) + (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) + (q : ι → OverlapPath) (d : ι → ℝ) + (hsymbol : ∀ a, ∀ᵐ s ∂pathMeasure, pathSymbol (d a) (q a).val s = + projectedResolvent ρ eig hρ hρsum a (deficit p (p s))) + (hroot : ∀ a, Function.rightLim (q a).val 0 = Function.rightLim p.val 0 * + projectedResolventDerivative ρ eig hρ hρsum a (deficit p (Function.rightLim p.val 0))) : + (∀ a, d a = spectralGroupDiagonal ρ eig hρ hρsum p a) ∧ + ∀ᵐ s ∂pathMeasure, ∀ a, q a s = spectralGroupPath ρ eig hρ hρsum p a s := by + have he (a : ι) := spectralGroup_identification_of_symbol_root ρ eig hρ hρsum p (q a) (d a) a + (hsymbol a) (hroot a) + exact ⟨fun a => (he a).1, ae_all_iff.mpr fun a => (he a).2⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupMass.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..89fe517a34691eb9b302ce7c760d8eb41bf76fa3 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupMass.lean @@ -0,0 +1,57 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralProjectionMass + +namespace OAI + +/-! The changed coordinates in an eigenspace carry precisely their fraction +of its Haar-averaged squared spin norm. -/ + +noncomputable section +open MeasureTheory IsingPerceptron +open scoped BigOperators + +namespace InvariantIsing + +lemma sum_changed_group_mass_le {ι A : Type*} [Fintype ι] [Fintype A] + [DecidableEq ι] [DecidableEq A] (label : ι → A) (changed : Finset ι) + (mass : A → ℝ) (hmass : ∀ a, 0 ≤ mass a) (r : ℝ) + (hcount : ∀ a, ((changed.filter fun i => label i = a).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => label i = a).card : ℝ)) : + ∑ i ∈ changed, mass (label i) ≤ r * ∑ i, mass (label i) := by + have hchanged := Finset.sum_fiberwise' changed label mass + have hall := Finset.sum_fiberwise' Finset.univ label mass + rw [← hchanged, ← hall, Finset.mul_sum] + apply Finset.sum_le_sum + intro a _ + simpa only [Finset.sum_const, nsmul_eq_mul, mul_assoc] using + mul_le_mul_of_nonneg_right (hcount a) (hmass a) + +lemma abs_weighted_spectral_change_le {ι A : Type*} [Fintype ι] [Fintype A] + [DecidableEq ι] [DecidableEq A] (label : ι → A) (changed : Finset ι) + (mass : A → ℝ) (hmass : ∀ a, 0 ≤ mass a) (delta : ι → ℝ) + (hzero : ∀ i, i ∉ changed → delta i = 0) + (L r : ℝ) (hL : 0 ≤ L) (hdelta : ∀ i, |delta i| ≤ L) + (hcount : ∀ a, ((changed.filter fun i => label i = a).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => label i = a).card : ℝ)) : + |∑ i, delta i * mass (label i)| ≤ L * r * ∑ i, mass (label i) := by + have he : (∑ i, delta i * mass (label i)) = + ∑ i ∈ changed, delta i * mass (label i) := by + symm + exact Finset.sum_subset (Finset.subset_univ changed) (fun i _ hi => by rw [hzero i hi, zero_mul]) + rw [he] + calc + _ ≤ ∑ i ∈ changed, |delta i * mass (label i)| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i ∈ changed, L * mass (label i) := by + apply Finset.sum_le_sum + intro i _ + rw [abs_mul, abs_of_nonneg (hmass _)] + exact mul_le_mul_of_nonneg_right (hdelta i) (hmass _) + _ = L * ∑ i ∈ changed, mass (label i) := (Finset.mul_sum _ _ _).symm + _ ≤ L * (r * ∑ i, mass (label i)) := + mul_le_mul_of_nonneg_left (sum_changed_group_mass_le label changed mass hmass r hcount) hL + _ = _ := by ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupRoots.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupRoots.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b1943bff3edb14c852fcc4bf1ed3c32084eeda7 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralGroupRoots.lean @@ -0,0 +1,94 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralDensityContinuity + +namespace OAI + +/-! Right roots of the reconstructed finite spectral-group paths. The +deficit is constant below the total path's right root, including root zero. -/ + +noncomputable section + +open MeasureTheory Set Filter Function +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma OverlapPath.rightLim_mem_unit (p : OverlapPath) : + Function.rightLim p.val 0 ∈ Icc (0 : ℝ) 1 := + ⟨(p.nonneg 0).trans (p.monotone.le_rightLim le_rfl), + (p.monotone.rightLim_le zero_lt_one).trans (p.le_one 1)⟩ + +lemma OverlapPath.rightLim_le_of_pos (p : OverlapPath) {u : ℝ} (hu : 0 < u) : + Function.rightLim p.val 0 ≤ p u := p.monotone.rightLim_le hu + +lemma deficit_eq_one_sub_mean_of_le_rightLim (p : OverlapPath) {r : ℝ} + (hr : r ≤ Function.rightLim p.val 0) : + deficit p r = 1 - ∫ s, p s ∂pathMeasure := by + have he : (fun s => max (p s - r) 0) =ᵐ[pathMeasure] fun s => p s - r := by + filter_upwards [ae_restrict_mem measurableSet_Ioo] with s hs + exact max_eq_left (sub_nonneg.mpr (hr.trans (p.rightLim_le_of_pos hs.1))) + unfold deficit + rw [integral_congr_ae he, integral_sub p.integrable (integrable_const r)] + simp only [integral_const, probReal_univ, one_smul] + ring + +lemma deficit_eq_at_rightLim_of_le (p : OverlapPath) {r : ℝ} + (hr : r ≤ Function.rightLim p.val 0) : + deficit p r = deficit p (Function.rightLim p.val 0) := by + rw [deficit_eq_one_sub_mean_of_le_rightLim p hr, + deficit_eq_one_sub_mean_of_le_rightLim p le_rfl] + +variable {ι : Type*} [Fintype ι] + +lemma spectralPathDensity_eq_at_rightLim (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) {r : ℝ} + (hr : r ≤ Function.rightLim p.val 0) : + spectralPathDensity ρ eig hρ hρsum p a r = + projectedResolventDerivative ρ eig hρ hρsum a (deficit p (Function.rightLim p.val 0)) := by + unfold spectralPathDensity + rw [deficit_eq_at_rightLim_of_le p hr] + +lemma integral_spectralDensity_rightLim (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + (∫ r in 0..Function.rightLim p.val 0, spectralPathDensity ρ eig hρ hρsum p a r) = + Function.rightLim p.val 0 * projectedResolventDerivative ρ eig hρ hρsum a + (deficit p (Function.rightLim p.val 0)) := by + calc + _ = ∫ _r in 0..Function.rightLim p.val 0, projectedResolventDerivative ρ eig hρ hρsum a + (deficit p (Function.rightLim p.val 0)) := by + apply intervalIntegral.integral_congr_Ioo_of_le p.rightLim_mem_unit.1 + intro r hr + exact spectralPathDensity_eq_at_rightLim ρ eig hρ hρsum p a hr.2.le + _ = _ := by simp only [intervalIntegral.integral_const, sub_zero, smul_eq_mul] + +/-- The reconstructed group path has the exact root prescribed by the +root Ward equations, with no assumption that the total path is continuous. -/ +theorem spectralGroupPath_root_tendsto (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + Tendsto (spectralGroupPath ρ eig hρ hρsum p a) (𝓝[>] (0 : ℝ)) + (𝓝 (Function.rightLim p.val 0 * projectedResolventDerivative ρ eig hρ hρsum a + (deficit p (Function.rightLim p.val 0)))) := by + have hc := continuous_spectralPathDensity ρ eig hρ hρsum p a + have hG : Continuous (fun q => ∫ r in 0..q, spectralPathDensity ρ eig hρ hρsum p a r) := + intervalIntegral.continuous_primitive (fun s t => hc.intervalIntegrable s t) 0 + have ht := hG.continuousAt.tendsto.comp (p.monotone.tendsto_rightLim 0) + rw [integral_spectralDensity_rightLim ρ eig hρ hρsum p a] at ht + exact ht + +theorem spectralGroupPath_rightLim (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + Function.rightLim (spectralGroupPath ρ eig hρ hρsum p a) 0 = + Function.rightLim p.val 0 * projectedResolventDerivative ρ eig hρ hρsum a + (deficit p (Function.rightLim p.val 0)) := + rightLim_eq_of_tendsto (spectralGroupPath_root_tendsto ρ eig hρ hρsum p a) + +theorem sum_spectralGroupPath_rightLim (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) : + (∑ a, Function.rightLim (spectralGroupPath ρ eig hρ hρsum p a) 0) = + Function.rightLim p.val 0 := by + simp only [spectralGroupPath_rightLim, ← Finset.mul_sum, sum_projectedResolventDerivative, mul_one] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralLabelCounts.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralLabelCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..b35b493f8aa9d67a622fd9047171c63b43e8c864 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralLabelCounts.lean @@ -0,0 +1,70 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPartitionCounts + +namespace OAI + +/-! Counts on arbitrary finite spectral labels and their deterministic relabeling. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology Classical BigOperators + +namespace InvariantIsing + +def spectralLabelCount {ι : Type*} {N : ℕ} + (g : Fin N → ι) (a : ι) : ℕ := by + classical + exact (Finset.univ.filter (fun i => g i=a)).card + +lemma spectral_label_counts_partition {ι : Type*} [Fintype ι] + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (eig : (k : ℕ) → Fin (N k) → ℝ) + (ν : ProbabilityMeasure ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hN k) (eig k)) atTop (𝓝 ν)) + (S : ι → Set ℝ) (hS : ∀ a, MeasurableSet (S a)) + (hboundary : ∀ a, (ν : Measure ℝ) (frontier (S a))=0) + (g : (k : ℕ) → Fin (N k) → ι) + (hg : ∀ k a i, g k i=a ↔ eig k i∈S a) : + Tendsto (fun k a => (spectralLabelCount (g k) a : ℝ)/N k) atTop + (𝓝 (fun a => (ν : Measure ℝ).real (S a))) := by + apply tendsto_pi_nhds.mpr + intro a + have hh := ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto' hweak (hboundary a) + have hr := (ENNReal.tendsto_toReal (measure_ne_top (ν : Measure ℝ) (S a))).comp hh + apply hr.congr + intro k + change (empiricalSpectralLaw (hN k) (eig k) : Measure ℝ).real (S a)=_ + rw [empiricalSpectralLaw_mass (hN k) (eig k) (S a) (hS a)] + congr 2 + apply congrArg Finset.card + ext i + simp only [Finset.mem_filter,Finset.mem_univ,true_and,hg] + +lemma spectralLabelCount_relabel {ι κ : Type*} [Fintype ι] [DecidableEq κ] + {N : ℕ} (g : Fin N → ι) (f : ι → κ) (b : κ) : + spectralLabelCount (f ∘ g) b = + ∑ a : {a : ι // f a=b}, spectralLabelCount g a := by + have hh := Finset.sum_card_fiberwise_eq_card_filter Finset.univ + (Finset.univ.filter (fun a => f a=b)) g + rw [← Finset.sum_subtype (Finset.univ.filter (fun a => f a=b)) (by simp) + (fun a => spectralLabelCount g a)] + simpa only [spectralLabelCount, Finset.mem_filter,Finset.mem_univ,true_and, + Function.comp_apply] using hh.symm + +lemma spectral_label_counts_relabel {ι κ : Type*} [Fintype ι] [Fintype κ] + (N : ℕ → ℕ) (g : (k : ℕ) → Fin (N k) → ι) (w : ι → ℝ) + (hlim : Tendsto (fun k a => (spectralLabelCount (g k) a : ℝ)/N k) atTop (𝓝 w)) + (f : ι → κ) : + Tendsto (fun k b => (spectralLabelCount (f ∘ g k) b : ℝ)/N k) atTop + (𝓝 (fun b => ∑ a : {a : ι // f a=b}, w a)) := by + apply tendsto_pi_nhds.mpr + intro b + have hh := tendsto_finsetSum (Finset.univ : Finset {a : ι // f a=b}) (fun a _ => + (tendsto_pi_nhds.mp hlim) (a : ι)) + convert hh using 1 + funext k + rw [spectralLabelCount_relabel, Nat.cast_sum, Finset.sum_div] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralMultiplicity.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralMultiplicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fef61ff0d025da8f90155ea1b4ee4366a938361 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralMultiplicity.lean @@ -0,0 +1,81 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPermutation +import OAI.Probability.InvariantIsing.Spectral.SpectralCountAlignment + +namespace OAI + +/-! The spectral multiplicity comparison, with an arbitrary deterministic +magnetic field. The relative count error is supplied as a scalar bound. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators + +namespace InvariantIsing + +/-- Manuscript Lemma gen:counts. Taking `r` to be the maximum relative +multiplicity error gives its displayed bound. -/ +theorem meanPressure_multiplicity_comparison {N m : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] [μ.IsMulLeftInvariant] + (a b : Fin N → Fin m) (ha : Function.Surjective a) (hb : Function.Surjective b) + (lam : Fin m → ℝ) (c : Fin N → ℝ) + (K : ℝ) (hK : ∀ v, |lam v| ≤ K) + (L r : ℝ) (hL : 0 ≤ L) (hr : 0 ≤ r) + (hdiam : ∀ v w, |lam v - lam w| ≤ L) + (herr : ∀ v, + |((Finset.univ.filter fun i => a i = v).card : ℝ) - + ((Finset.univ.filter fun i => b i = v).card : ℝ)| ≤ + r * min ((Finset.univ.filter fun i => a i = v).card : ℝ) + ((Finset.univ.filter fun i => b i = v).card : ℝ)) : + |(∫ U, rotatedPressure (fun i => lam (b i)) (specialRotation U) c ∂μ) - + ∫ U, rotatedPressure (fun i => lam (a i)) (specialRotation U) c ∂μ| ≤ L * r / 2 := by + classical + obtain ⟨p, hp⟩ := exists_spectral_label_alignment a b + let b' := fun i => b (p i) + let changed := Finset.univ.filter fun i => a i ≠ b' i + have herr' v : + |((Finset.univ.filter fun i => a i = v).card : ℝ) - + ((Finset.univ.filter fun i => b' i = v).card : ℝ)| ≤ + r * min ((Finset.univ.filter fun i => a i = v).card : ℝ) + ((Finset.univ.filter fun i => b' i = v).card : ℝ) := by + simpa only [b', spectral_label_count_comp] using herr v + have hc v : ((changed.filter fun i => a i = v).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => a i = v).card : ℝ) := by + have hd := aligned_changed_count_le a b' v (hp v) + have he : changed.filter (fun i => a i = v) = + Finset.univ.filter (fun i => a i = v ∧ a i ≠ b' i) := by + ext i + simp only [changed, Finset.mem_filter, Finset.mem_univ, true_and] + exact and_comm + rw [he] + exact hd.trans ((herr' v).trans + (mul_le_mul_of_nonneg_left (min_le_left _ _) hr)) + have hc' v : ((changed.filter fun i => b' i = v).card : ℝ) ≤ + r * ((Finset.univ.filter fun i => b' i = v).card : ℝ) := by + have hp' : (∀ i, b' i = v → a i = v) ∨ (∀ i, a i = v → b' i = v) := (hp v).symm + have hd := aligned_changed_count_le b' a v hp' + have he : changed.filter (fun i => b' i = v) = + Finset.univ.filter (fun i => b' i = v ∧ b' i ≠ a i) := by + ext i + simp only [changed, Finset.mem_filter, Finset.mem_univ, true_and, ne_comm] + exact and_comm + rw [he] + rw [abs_sub_comm] at hd + exact hd.trans ((herr' v).trans + (mul_le_mul_of_nonneg_left (min_le_right _ _) hr)) + have hcomp := meanPressure_change_counts_le hN μ + (fun i => lam (a i)) (fun i => lam (b' i)) c K + (fun i => hK (a i)) (fun i => hK (b' i)) a b' ha (hb.comp p.surjective) + lam (fun _ => rfl) (fun _ => rfl) changed + (fun i hi => by + have hlabel : a i = b' i := by simpa only [changed, Finset.mem_filter, + Finset.mem_univ, true_and, not_not] using hi + rw [hlabel]) + L r hL (fun i => hdiam (b' i) (a i)) hc hc' + have he := meanPressure_spectralPermutation hN μ p (fun i => lam (b i)) c + simpa only [b', he] using hcomp + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralNullBoundaryCover.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralNullBoundaryCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9ed70d5ae9c0eab52ad96b9f3d3acacd16f4fe6 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralNullBoundaryCover.lean @@ -0,0 +1,44 @@ +import Mathlib.MeasureTheory.Measure.Portmanteau + +namespace OAI + +/-! A compact spectral set has a finite small-ball cover whose boundaries +have zero mass. The centers remain in the spectral set. -/ + +noncomputable section +open MeasureTheory Set Metric +open scoped Topology Classical + +namespace InvariantIsing + +lemma spectral_null_boundary_cover (μ : Measure ℝ) [SFinite μ] + (K : Set ℝ) (hK : IsCompact K) (δ : ℝ) (hδ : 0 < δ) : + ∃ n : ℕ, ∃ c r : Fin n → ℝ, + (∀ i, c i∈K) ∧ (∀ i, δ/2 < r i ∧ r i < δ) ∧ + (∀ i, μ (frontier (ball (c i) (r i)))=0) ∧ + K ⊆ ⋃ i, ball (c i) (r i) := by + have hex (x : K) : ∃ r ∈ Ioo (δ/2) δ, μ (frontier (ball (x : ℝ) r))=0 := by + simpa only [thickening_singleton] using + exists_null_frontier_thickening μ ({(x : ℝ)} : Set ℝ) (by linarith : δ/2 < δ) + choose r hr hnull using hex + obtain ⟨t,ht⟩ := hK.elim_finite_subcover (fun x : K => ball (x : ℝ) (r x)) + (fun _ => isOpen_ball) (by + intro x hx + exact mem_iUnion.mpr ⟨⟨x,hx⟩,mem_ball_self (lt_trans (half_pos hδ) (hr ⟨x,hx⟩).1)⟩) + let A := {x : K // x∈t} + let e := Fintype.equivFin A + let c : Fin (Fintype.card A) → ℝ := fun i => ((e.symm i).1 : ℝ) + let r' : Fin (Fintype.card A) → ℝ := fun i => r (e.symm i).1 + refine ⟨Fintype.card A,c,r',fun i => (e.symm i).1.2,fun i => hr (e.symm i).1, + fun i => hnull (e.symm i).1,?_⟩ + intro x hx + obtain ⟨y,hy⟩ := mem_iUnion.mp (ht hx) + obtain ⟨hyt,hxy⟩ := mem_iUnion.mp hy + refine mem_iUnion.mpr ⟨e ⟨y,hyt⟩,?_⟩ + simpa only [c,r',Equiv.symm_apply_apply] using hxy + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralNullBoundaryPartition.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralNullBoundaryPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..b63168eb8d195c8a51a22c538c8c2df3c5b2e83c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralNullBoundaryPartition.lean @@ -0,0 +1,41 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralNullBoundaryCover +import Mathlib.Order.Disjointed + +namespace OAI + +/-! Ordered disjointization preserves the null boundaries required by +the spectral empirical-measure convergence argument. -/ + +noncomputable section +open MeasureTheory Set +open scoped Topology + +namespace InvariantIsing + +lemma null_frontier_sdiff (μ : Measure ℝ) (A B : Set ℝ) + (hA : μ (frontier A)=0) (hB : μ (frontier B)=0) : μ (frontier (A\B))=0 := by + apply measure_mono_null _ (measure_union_null_iff.mpr ⟨hA,hB⟩) + intro x hx + have hh := frontier_inter_subset A Bᶜ hx + rcases hh with ⟨ha,_⟩ | ⟨_,hb⟩ + · exact Or.inl ha + · exact Or.inr (by simpa only [frontier_compl] using hb) + +lemma null_frontier_finsetUnion {ι : Type*} (μ : Measure ℝ) (t : Finset ι) + (B : ι → Set ℝ) (hB : ∀ i∈t, μ (frontier (B i))=0) : + μ (frontier (⋃ i∈t, B i))=0 := by + apply measure_mono_null (t.frontier_biUnion_subset B) + exact (measure_biUnion_null_iff t.countable_toSet).mpr hB + +lemma null_frontier_disjointed {n : ℕ} (μ : Measure ℝ) (B : Fin n → Set ℝ) + (hB : ∀ i, μ (frontier (B i))=0) (i : Fin n) : + μ (frontier (disjointed B i))=0 := by + rw [disjointed_apply,Finset.sup_eq_iSup] + exact null_frontier_sdiff μ _ _ (hB i) + (null_frontier_finsetUnion μ (Finset.Iio i) B (fun j _ => hB j)) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralOrder.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..34baa7e01eceada7621e40ba1b013a27044979ab --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralOrder.lean @@ -0,0 +1,61 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCovariance + +namespace OAI + +/-! Order and uniform perturbation bounds for finite spectral transforms. -/ + +noncomputable section + +open scoped BigOperators + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +theorem finiteResolvent_mono_eig (ρ eig eig' : ι → ℝ) (hρ : ∀ a, 0 ≤ ρ a) + (heig : ∀ a, eig a ≤ eig' a) {b : ℝ} (hb : ∀ a, eig' a < b) : + finiteResolvent ρ eig b ≤ finiteResolvent ρ eig' b := by + apply Finset.sum_le_sum + intro a _ + exact div_le_div_of_nonneg_left (hρ a) (sub_pos.mpr (hb a)) (by linarith [heig a]) + +theorem finiteInverse_mono_eig (ρ eig eig' : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (heig : ∀ a, eig a ≤ eig' a) {x : ℝ} (hx : 0 < x) : + finiteInverse ρ eig hρ hρsum x ≤ finiteInverse ρ eig' hρ hρsum x := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hs' := finiteInverse_spec ρ eig' hρ hρsum hx + by_contra! h + have hlt := finiteResolvent_strictAnti (fun a => (hρ a).le) hρsum + (fun a => lt_of_le_of_lt (heig a) (hs'.1 a)) h + have hle := finiteResolvent_mono_eig ρ eig eig' (fun a => (hρ a).le) heig hs'.1 + rw [hs.2] at hlt + rw [hs'.2] at hle + linarith + +theorem finiteR_mono_eig (ρ eig eig' : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (heig : ∀ a, eig a ≤ eig' a) (x : ℝ) : + finiteR ρ eig hρ hρsum x ≤ finiteR ρ eig' hρ hρsum x := by + by_cases hx : 0 < x + · simp only [finiteR, ite_eq_left hx] + exact sub_le_sub_right (finiteInverse_mono_eig ρ eig eig' hρ hρsum heig hx) _ + · simp only [finiteR, ite_eq_right hx] + exact Finset.sum_le_sum fun a _ => mul_le_mul_of_nonneg_left (heig a) (hρ a).le + +/-- Uniform coordinate perturbations give the same uniform error in `R`. -/ +theorem finiteR_perturbation (ρ eig eig' : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {δ : ℝ} (heig : ∀ a, |eig a - eig' a| ≤ δ) + {x : ℝ} (hx : 0 ≤ x) : + |finiteR ρ eig hρ hρsum x - finiteR ρ eig' hρ hρsum x| ≤ δ := by + have hupper := finiteR_mono_eig ρ eig (fun a => eig' a + δ) hρ hρsum + (fun a => by have h := (abs_le.mp (heig a)).2; linarith) x + have hlower := finiteR_mono_eig ρ eig' (fun a => eig a + δ) hρ hρsum + (fun a => by have h := (abs_le.mp (heig a)).1; linarith) x + rw [finiteR_translate ρ eig' hρ hρsum hx δ] at hupper + rw [finiteR_translate ρ eig hρ hρsum hx δ] at hlower + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralOverlapPaths.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralOverlapPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..83fb4b1581c672ccae9a8bf07949f50b15d514f2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralOverlapPaths.lean @@ -0,0 +1,143 @@ +import OAI.Probability.InvariantIsing.Core.Variational +import OAI.Probability.InvariantIsing.Spectral.SpectralEndpoints + +namespace OAI + +/-! The reconstructed finite-alphabet overlap paths in manuscript `rot:full-paths`. +The formulas and their positivity and sum constraints are proved here; +identification with limiting Gibbs overlaps is separate. -/ + +noncomputable section + +open MeasureTheory Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +def spectralPathDensity (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (r : ℝ) : ℝ := + projectedResolventDerivative ρ eig hρ hρsum a (deficit p r) + +def spectralGroupPath (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (s : ℝ) : ℝ := + ∫ r in 0..p s, spectralPathDensity ρ eig hρ hρsum p a r + +def spectralGroupDiagonal (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : ℝ := + ∫ r in 0..1, spectralPathDensity ρ eig hρ hρsum p a r + +theorem spectralPathDensity_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (r : ℝ) : + 0 ≤ spectralPathDensity ρ eig hρ hρsum p a r := + (projectedResolventDerivative_pos ρ eig hρ hρsum a (deficit p r)).le + +theorem spectralPathDensity_continuousOn (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + ContinuousOn (spectralPathDensity ρ eig hρ hρsum p a) (Icc 0 1) := + (continuousOn_projectedResolventDerivative ρ eig hρ hρsum a).comp + (continuous_deficit p).continuousOn (fun _r hr => deficit_mem_unit p hr) + +theorem spectralPathDensity_intervalIntegrable (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) {q : ℝ} + (hq : q ∈ Icc (0 : ℝ) 1) : + IntervalIntegrable (spectralPathDensity ρ eig hρ hρsum p a) volume 0 q := + ((spectralPathDensity_continuousOn ρ eig hρ hρsum p a).mono + (Icc_subset_Icc le_rfl hq.2)).intervalIntegrable_of_Icc hq.1 + +theorem spectralGroupPath_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (s : ℝ) : + 0 ≤ spectralGroupPath ρ eig hρ hρsum p a s := + intervalIntegral.integral_nonneg_of_forall (p.nonneg s) + (spectralPathDensity_nonneg ρ eig hρ hρsum p a) + +theorem spectralGroupDiagonal_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + 0 ≤ spectralGroupDiagonal ρ eig hρ hρsum p a := + intervalIntegral.integral_nonneg_of_forall zero_le_one + (spectralPathDensity_nonneg ρ eig hρ hρsum p a) + +theorem spectralGroupPath_monotone (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + Monotone (spectralGroupPath ρ eig hρ hρsum p a) := by + intro s t hst + exact intervalIntegral.integral_mono_interval le_rfl (p.nonneg s) (p.monotone hst) + (Eventually.of_forall (spectralPathDensity_nonneg ρ eig hρ hρsum p a)) + (spectralPathDensity_intervalIntegrable ρ eig hρ hρsum p a ⟨p.nonneg t, p.le_one t⟩) + +theorem sum_spectralGroupPath (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (s : ℝ) : + (∑ a, spectralGroupPath ρ eig hρ hρsum p a s) = p s := by + unfold spectralGroupPath + rw [← intervalIntegral.integral_finsetSum + (fun a _ => spectralPathDensity_intervalIntegrable ρ eig hρ hρsum p a + ⟨p.nonneg s, p.le_one s⟩)] + simp only [spectralPathDensity, sum_projectedResolventDerivative, + intervalIntegral.integral_const, sub_zero, smul_eq_mul, mul_one] + +theorem sum_spectralGroupDiagonal (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) : + (∑ a, spectralGroupDiagonal ρ eig hρ hρsum p a) = 1 := by + unfold spectralGroupDiagonal + rw [← intervalIntegral.integral_finsetSum + (fun a _ => spectralPathDensity_intervalIntegrable ρ eig hρ hρsum p a + ⟨zero_le_one, le_rfl⟩)] + simp only [spectralPathDensity, sum_projectedResolventDerivative, + intervalIntegral.integral_const, sub_zero, smul_eq_mul, mul_one] + +theorem spectralGroupPath_le_diagonal (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (s : ℝ) : + spectralGroupPath ρ eig hρ hρsum p a s ≤ spectralGroupDiagonal ρ eig hρ hρsum p a := + intervalIntegral.integral_mono_interval le_rfl (p.nonneg s) (p.le_one s) + (Eventually.of_forall (spectralPathDensity_nonneg ρ eig hρ hρsum p a)) + (spectralPathDensity_intervalIntegrable ρ eig hρ hρsum p a ⟨zero_le_one, le_rfl⟩) + +theorem spectralGroup_diagonalExcess_nonneg (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (top : ℝ) : + 0 ≤ spectralGroupDiagonal ρ eig hρ hρsum p a - spectralGroupPath ρ eig hρ hρsum p a top := + sub_nonneg.mpr (spectralGroupPath_le_diagonal ρ eig hρ hρsum p a top) + +theorem spectralGroup_diagonalExcess_eq_integral (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) (top : ℝ) : + spectralGroupDiagonal ρ eig hρ hρsum p a - spectralGroupPath ρ eig hρ hρsum p a top = + ∫ r in p top..1, spectralPathDensity ρ eig hρ hρsum p a r := by + have h0 := spectralPathDensity_intervalIntegrable ρ eig hρ hρsum p a + ⟨p.nonneg top, p.le_one top⟩ + have h1 : IntervalIntegrable (spectralPathDensity ρ eig hρ hρsum p a) volume (p top) 1 := + ((spectralPathDensity_continuousOn ρ eig hρ hρsum p a).mono + (Icc_subset_Icc (p.nonneg top) le_rfl)).intervalIntegrable_of_Icc (p.le_one top) + have hadd := intervalIntegral.integral_add_adjacent_intervals h0 h1 + unfold spectralGroupDiagonal spectralGroupPath + linarith + +theorem spectralGroup_diagonalExcess_zero_of_top_one + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (p : OverlapPath) (a : ι) {top : ℝ} (htop : p top = 1) : + spectralGroupDiagonal ρ eig hρ hρsum p a - spectralGroupPath ρ eig hρ hρsum p a top = 0 := by + rw [spectralGroup_diagonalExcess_eq_integral, htop, intervalIntegral.integral_same] + +theorem spectralGroupDiagonal_le_one (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (p : OverlapPath) (a : ι) : + spectralGroupDiagonal ρ eig hρ hρsum p a ≤ 1 := by + rw [← sum_spectralGroupDiagonal ρ eig hρ hρsum p] + exact Finset.single_le_sum (fun b _ => spectralGroupDiagonal_nonneg ρ eig hρ hρsum p b) + (Finset.mem_univ a) + +theorem spectralGroupPath_constant (ρ : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (c : ℝ) (p : OverlapPath) (a : ι) (s : ℝ) : + spectralGroupPath ρ (fun _ => c) hρ hρsum p a s = ρ a * p s := by + simp only [spectralGroupPath, spectralPathDensity, projectedResolventDerivative_constant, + intervalIntegral.integral_const, sub_zero, smul_eq_mul, mul_comm] + +theorem spectralGroupDiagonal_constant (ρ : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (c : ℝ) (p : OverlapPath) (a : ι) : + spectralGroupDiagonal ρ (fun _ => c) hρ hρsum p a = ρ a := by + simp only [spectralGroupDiagonal, spectralPathDensity, projectedResolventDerivative_constant, + intervalIntegral.integral_const, sub_zero, smul_eq_mul, one_mul] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartition.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ae6f37264d26358f512544e683694b83b13f05a --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartition.lean @@ -0,0 +1,148 @@ +import OAI.Probability.InvariantIsing.Arrays.TensorArrayGeometry + +namespace OAI + +/-! Total spin overlap and self normalization for a genuine spectral partition. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma projectedOverlap_partition {N m : ℕ} (U : Rotation N) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) (σ τ : Spin N) : + (∑ a, projectedOverlap U (I a) σ τ) = projectedOverlap U Finset.univ σ τ := by + classical + unfold projectedOverlap + rw [← Finset.mul_sum] + congr 1 + have hs := Finset.sum_biUnion (f := fun i => U (spinVector σ) i * U (spinVector τ) i) + (show Set.PairwiseDisjoint (↑(Finset.univ : Finset (Fin m))) I by simpa using hdis) + rw [hcover] at hs + exact hs.symm + +lemma projectedOverlap_partition_self {N m : ℕ} (hN : 0 < N) (U : Rotation N) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) (σ : Spin N) : + (∑ a, projectedOverlap U (I a) σ σ) = 1 := by + rw [projectedOverlap_partition U I hdis hcover, projectedOverlap_univ] + simp only [← pow_two, spinValue_sq, Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, mul_one] + exact inv_mul_cancel₀ (Nat.cast_ne_zero.mpr hN.ne') + +def spectralSpinArray {m : ℕ} (x : SpectralArray (m + 1)) : RealArray := + fun i j => ∑ a : Fin m, (x (i,j) a.castSucc : ℝ) + +lemma continuous_spectralSpinArray (m : ℕ) : Continuous (spectralSpinArray (m := m)) := by + unfold spectralSpinArray + fun_prop + +def SpectralPartitionGeometry (m : ℕ) (x : SpectralArray (m + 1)) : Prop := + (∀ i j, |spectralSpinArray x i j| ≤ 1) ∧ ∀ i, spectralSpinArray x i i = 1 + +lemma isClosed_spectralPartitionGeometry (m : ℕ) : + IsClosed {x : SpectralArray (m + 1) | SpectralPartitionGeometry m x} := by + unfold SpectralPartitionGeometry + apply IsClosed.inter + · change IsClosed {x : SpectralArray (m + 1) | ∀ i j, |spectralSpinArray x i j| ≤ 1} + simp only [Set.ofPred_forall] + exact isClosed_iInter fun i => isClosed_iInter fun j => isClosed_le + (by unfold spectralSpinArray; fun_prop) continuous_const + · change IsClosed {x : SpectralArray (m + 1) | ∀ i, spectralSpinArray x i i = 1} + simp only [Set.ofPred_forall] + exact isClosed_iInter fun i => isClosed_eq (by unfold spectralSpinArray; fun_prop) continuous_const + +lemma spectralReplicaArray_partition {Ω : Type*} {N m : ℕ} (hN : 0 < N) + (U : Ω → SpecialOrthogonal N) (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) (n : ℕ) + (p : Ω × (ℕ → Spin N × LabeledLeaf n)) : + SpectralPartitionGeometry m (spectralReplicaArray U I n p) := by + have he (i j : ℕ) : spectralSpinArray (spectralReplicaArray U I n p) i j = + projectedOverlap (specialRotation (U p.1)) Finset.univ (p.2 i).1 (p.2 j).1 := by + simp only [spectralSpinArray, spectralReplicaArray, spectralJointEntry_spectral] + exact projectedOverlap_partition _ I hdis hcover _ _ + constructor + · intro i j + rw [he] + exact projectedOverlap_abs_le_one _ _ _ _ + · intro i + simpa only [spectralSpinArray, spectralReplicaArray, spectralJointEntry_spectral] using + projectedOverlap_partition_self hN (specialRotation (U p.1)) I hdis hcover (p.2 i).1 + +lemma spectralArrayLaw_partition {Ω : Type*} [MeasurableSpace Ω] {N m : ℕ} (hN : 0 < N) + (P : Measure Ω) [IsProbabilityMeasure P] (U : Ω → SpecialOrthogonal N) (hU : Measurable U) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) (n : ℕ) + (ν : Ω → Measure (Spin N × LabeledLeaf n)) (hν : Measurable ν) + [∀ ω, IsProbabilityMeasure (ν ω)] : + ∀ᵐ x ∂(spectralArrayLaw P U hU I n ν hν : Measure (SpectralArray (m + 1))), + SpectralPartitionGeometry m x := by + change ∀ᵐ x ∂(disorderReplicaLaw P ν hν).map (spectralReplicaArray U I n), + SpectralPartitionGeometry m x + rw [ae_map_iff (measurable_spectralReplicaArray U hU I n).aemeasurable + (isClosed_spectralPartitionGeometry m).measurableSet] + exact ae_of_all _ (spectralReplicaArray_partition hN U I hdis hcover n) + +lemma spectralArray_limit_partition {m : ℕ} {L : ℕ → ProbabilityMeasure (SpectralArray (m + 1))} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} (hL : Tendsto L atTop (𝓝 Q)) + (hG : ∀ k, ∀ᵐ x ∂(L k : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x := + ae_closed_of_weak_limit hL (isClosed_spectralPartitionGeometry m) hG + + +lemma tensorPerturbedArrayLaw_partition {N m : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [IsProbabilityMeasure μ] (eig c : Fin N → ℝ) + (I : Fin m → Finset (Fin N)) + (hdis : Set.PairwiseDisjoint (Set.univ : Set (Fin m)) I) + (hcover : Finset.univ.biUnion I = Finset.univ) + (u : Fin N → ℝ) (v : Fin m → ℝ) (t : ℝ) (n : ℕ) (b h : ℕ → ℝ) : + ∀ᵐ x ∂(tensorPerturbedArrayLaw μ eig c I u v t n b h : Measure (SpectralArray (m + 1))), + SpectralPartitionGeometry m x := by + unfold tensorPerturbedArrayLaw tensorNamespacedArrayLaw + exact spectralArrayLaw_partition hN _ _ _ _ hdis hcover _ _ _ + +lemma spectralPartition_diagonal_sum {m : ℕ} {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (q : Fin (m + 1) → ℝ) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) : + (∑ a : Fin m, q a.castSucc) = 1 := by + obtain ⟨x, hx, hdx⟩ := (hP.and hd).exists + simpa only [spectralSpinArray, hdx] using hx.2 0 + +lemma spectralPartition_spin_unit {m : ℕ} {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), spectralSpinArray x 0 1 ∈ Icc (0 : ℝ) 1 := by + filter_upwards [hP, hn] with x hx hnx + exact ⟨Finset.sum_nonneg (fun a _ => hnx a.castSucc), (le_abs_self _).trans (hx.1 0 1)⟩ + +def spectralSpinWeight (m : ℕ) : Fin (m + 1) → ℝ := Fin.lastCases 0 (fun _ => 1) + +lemma spectralSpinWeight_nonneg (m : ℕ) (a : Fin (m + 1)) : 0 ≤ spectralSpinWeight m a := by + refine Fin.lastCases ?_ (fun _ => ?_) a <;> simp [spectralSpinWeight] + +lemma spectralLinearArray_spinWeight {m : ℕ} (x : SpectralArray (m + 1)) : + spectralLinearArray (spectralSpinWeight m) x = spectralSpinArray x := by + funext i j + simp only [spectralLinearArray, spectralLinearEntry, Fin.sum_univ_castSucc, + spectralSpinWeight, Fin.lastCases_castSucc, Fin.lastCases_last, one_mul, zero_mul, add_zero, + spectralSpinArray] + +lemma spectralLinearArray_single {m : ℕ} (a : Fin m) (x : SpectralArray m) : + spectralLinearArray (Pi.single a 1) x = spectralCoordinateArray a x := by + classical + funext i j + simp [spectralLinearArray, spectralLinearEntry, spectralCoordinateArray, Pi.single_apply] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionCounts.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..be99a6214b08d38ecefa1c246826ad5e5a64899c --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionCounts.lean @@ -0,0 +1,43 @@ +import OAI.Probability.InvariantIsing.Spectral.EmpiricalSpectralLaw +import OAI.Probability.InvariantIsing.Cavity.CavityProjectionGeometry + +namespace OAI + +/-! Weak empirical convergence gives the actual spectral group +proportions on finite partitions with null boundaries. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology Classical + +namespace InvariantIsing + +lemma spectral_partition_counts_tendsto {m : ℕ} + (N : ℕ → ℕ) (hN : ∀ k, 0 < N k) (eig : (k : ℕ) → Fin (N k) → ℝ) + (ν : ProbabilityMeasure ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (hN k) (eig k)) atTop (𝓝 ν)) + (S : Fin m → Set ℝ) (hS : ∀ a, MeasurableSet (S a)) + (hboundary : ∀ a, (ν : Measure ℝ) (frontier (S a))=0) + (g : (k : ℕ) → Fin (N k) → Fin m) + (hg : ∀ k a i, g k i=a ↔ eig k i∈S a) : + Tendsto (fun k a => ((cavitySpectralGroup (g k) a).card : ℝ)/N k) atTop + (𝓝 (fun a => (ν : Measure ℝ).real (S a))) := by + apply tendsto_pi_nhds.mpr + intro a + have hh := ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto' hweak (hboundary a) + have hr := (ENNReal.tendsto_toReal (measure_ne_top (ν : Measure ℝ) (S a))).comp hh + apply hr.congr + intro k + change (empiricalSpectralLaw (hN k) (eig k) : Measure ℝ).real (S a)=_ + rw [empiricalSpectralLaw_mass (hN k) (eig k) (S a) (hS a)] + congr 2 + apply congrArg Finset.card + apply Finset.ext + intro i + simp only [cavitySpectralGroup,Finset.mem_filter,Finset.mem_univ,true_and,hg] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionIndex.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3536d8b2124b7938bfb103a58c88713b752ead4 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionIndex.lean @@ -0,0 +1,51 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralNullBoundaryPartition + +namespace OAI + +/-! Deterministic spectral labels associated with a finite measurable +partition, allowing empty cells until zero masses are removed. -/ + +noncomputable section +open MeasureTheory Set +open scoped Topology Classical Function + +namespace InvariantIsing + +def spectralPartitionIndex {ι : Type*} (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (x : ℝ) : ι := (hcover x).choose + +lemma spectralPartitionIndex_mem {ι : Type*} (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (x : ℝ) : x∈S (spectralPartitionIndex S hcover x) := + (hcover x).choose_spec + +lemma spectralPartitionIndex_eq_iff {ι : Type*} (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) (x : ℝ) (i : ι) : + spectralPartitionIndex S hcover x=i ↔ x∈S i := by + constructor + · intro h + rw [← h] + exact spectralPartitionIndex_mem S hcover x + · intro hx + by_contra hne + exact (Set.disjoint_left.mp (hdis hne)) (spectralPartitionIndex_mem S hcover x) hx + +lemma measurable_spectralPartitionIndex {ι : Type*} [Fintype ι] [MeasurableSpace ι] + (S : ι → Set ℝ) (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) : Measurable (spectralPartitionIndex S hcover) := by + intro T _hT + have he : (spectralPartitionIndex S hcover) ⁻¹' T=⋃ i∈T, S i := by + ext x + simp only [Set.mem_preimage,Set.mem_iUnion] + constructor + · intro hx + exact ⟨spectralPartitionIndex S hcover x,hx,spectralPartitionIndex_mem S hcover x⟩ + · rintro ⟨i,hi,hxi⟩ + rwa [(spectralPartitionIndex_eq_iff S hcover hdis x i).mpr hxi] + rw [he] + exact MeasurableSet.iUnion fun i => MeasurableSet.iUnion fun _ => hS i + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionLaw.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..d607e0e22e1eeb9383fa680b35b3eed40b1eb0b5 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionLaw.lean @@ -0,0 +1,55 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPartitionIndex +import OAI.Probability.InvariantIsing.Spectral.FiniteSpectralMeasure + +namespace OAI + +/-! The exact finite spectral law produced by a measurable partition. -/ + +noncomputable section +open MeasureTheory Set +open scoped Topology Classical Function BigOperators + +namespace InvariantIsing + +lemma spectralPartitionIndex_preimage {ι : Type*} (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) (i : ι) : + (spectralPartitionIndex S hcover) ⁻¹' {i}=S i := by + ext x + exact spectralPartitionIndex_eq_iff S hcover hdis x i + +lemma spectralPartitionWeights_sum {ι : Type*} [Fintype ι] + (μ : Measure ℝ) [IsProbabilityMeasure μ] (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) : ∑ i, μ.real (S i)=1 := by + let : MeasurableSpace ι := ⊤ + have hm := measurable_spectralPartitionIndex S hcover hdis hS + have hh := sum_measureReal_preimage_singleton (μ := μ) Finset.univ + (f := spectralPartitionIndex S hcover) (fun i _ => hm (measurableSet_singleton i)) + simpa only [spectralPartitionIndex_preimage S hcover hdis,Finset.coe_univ, + Set.preimage_univ,probReal_univ] using hh + +lemma spectralPartition_pushforward {ι : Type*} [Fintype ι] + (μ : Measure ℝ) [IsProbabilityMeasure μ] (S : ι → Set ℝ) + (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) (lam : ι → ℝ) : + μ.map (fun x => lam (spectralPartitionIndex S hcover x))= + finiteSpectralMeasure (fun i => μ.real (S i)) lam := by + let : MeasurableSpace ι := ⊤ + have hm := measurable_spectralPartitionIndex S hcover hdis hS + have hl : Measurable lam := measurable_of_countable lam + change μ.map (lam ∘ spectralPartitionIndex S hcover)=_ + rw [← Measure.map_map hl hm, Measure.map_eq_sum μ _ hm, + Measure.map_sum hl.aemeasurable] + change Measure.sum (fun i => Measure.map lam (μ ((spectralPartitionIndex S hcover) ⁻¹' {i}) • + Measure.dirac i))=Measure.sum (fun i => ENNReal.ofReal (μ.real (S i)) • Measure.dirac (lam i)) + congr 1 + funext i + rw [spectralPartitionIndex_preimage S hcover hdis, Measure.map_smul _ hl.aemeasurable, + Measure.map_dirac] + rw [measureReal_def,ENNReal.ofReal_toReal (measure_ne_top μ (S i))] + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionPaths.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ce0bd5b3b3612cf5011337e44536ac7da25e888 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionPaths.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPartition +import OAI.Probability.InvariantIsing.Spectral.SpectralQuantileMoments + +namespace OAI + +/-! The actual spectral-group quantiles sum to the total spin quantile. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma spectralCoordinate_unit {m : ℕ} {Q : ProbabilityMeasure (SpectralArray m)} + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray m)), ∀ a, 0 ≤ (x (0,1) a : ℝ)) (a : Fin m) : + ∀ᵐ x ∂(Q : Measure (SpectralArray m)), + spectralLinearArray (Pi.single a 1) x 0 1 ∈ Icc (0 : ℝ) 1 := by + filter_upwards [hn] with x hx + rw [spectralLinearArray_single] + exact ⟨hx a, (x (0,1) a).property.2⟩ + +def spectralPartitionQuantileWeights (m : ℕ) : Fin (m + 1) → Fin (m + 1) → ℝ := + Fin.lastCases (spectralSpinWeight m) (fun a => Pi.single a.castSucc 1) + +def spectralPartitionRelation (m : ℕ) : Fin (m + 1) → ℝ := + Fin.lastCases (-1) (fun _ => 1) + +lemma spectralPartitionQuantileWeights_nonneg (m : ℕ) (i a : Fin (m + 1)) : + 0 ≤ spectralPartitionQuantileWeights m i a := by + classical + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [spectralPartitionQuantileWeights, Fin.lastCases_last] using + spectralSpinWeight_nonneg m a + · simp only [spectralPartitionQuantileWeights, Fin.lastCases_castSucc, Pi.single_apply] + split_ifs <;> norm_num + +lemma spectralPartitionRelation_eq_zero (m : ℕ) (a : Fin (m + 1)) : + (∑ i, spectralPartitionRelation m i * spectralPartitionQuantileWeights m i a) = 0 := by + classical + rw [Fin.sum_univ_castSucc] + simp only [spectralPartitionRelation, spectralPartitionQuantileWeights, + Fin.lastCases_castSucc, Fin.lastCases_last, one_mul, neg_mul, one_mul] + refine Fin.lastCases ?_ (fun j => ?_) a + · simp [spectralSpinWeight] + · simp [Pi.single_apply, spectralSpinWeight, Fin.castSucc_inj] + +theorem spectralPartitionQuantileWeights_unit {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (i : Fin (m + 1)) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + spectralLinearArray (spectralPartitionQuantileWeights m i) x 0 1 ∈ Icc (0 : ℝ) 1 := by + refine Fin.lastCases ?_ (fun a => ?_) i + · simpa only [spectralPartitionQuantileWeights, Fin.lastCases_last, + spectralLinearArray_spinWeight] using spectralPartition_spin_unit hP hn + · simpa only [spectralPartitionQuantileWeights, Fin.lastCases_castSucc] using + spectralCoordinate_unit hn a.castSucc + +/-- The spectral partition and vector Ghirlanda–Guerra synchronization +yield the sum identity. -/ +theorem spectralPartition_quantile_sum {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : Equiv.Perm ℕ, + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) : + ∀ᵐ s ∂pathMeasure, + (∑ a : Fin m, spectralQuantilePath Q (Pi.single a.castSucc 1) (spectralCoordinate_unit hn a.castSucc) s) = + spectralQuantilePath Q (spectralSpinWeight m) + (by simpa only [spectralLinearArray_spinWeight] using spectralPartition_spin_unit hP hn) s := by + have hr := spectralQuantilePath_linear_relation hgg hG q hq hd hE + (spectralPartitionQuantileWeights m) (spectralPartitionQuantileWeights_nonneg m) + (spectralPartitionQuantileWeights_unit hP hn) (spectralPartitionRelation m) + (spectralPartitionRelation_eq_zero m) + filter_upwards [hr] with s hs + rw [Fin.sum_univ_castSucc] at hs + simp only [spectralPartitionRelation, spectralPartitionQuantileWeights, + Fin.lastCases_castSucc, Fin.lastCases_last, one_mul, neg_mul, one_mul] at hs + linarith + +lemma group_increment_le_total {m : ℕ} (p : OverlapPath) (pa : Fin m → OverlapPath) + {s t : ℝ} (hst : s ≤ t) (hs : (∑ a, pa a s) = p s) (ht : (∑ a, pa a t) = p t) + (a : Fin m) : 0 ≤ pa a t - pa a s ∧ pa a t - pa a s ≤ p t - p s := by + have hn (b : Fin m) : 0 ≤ pa b t - pa b s := sub_nonneg.mpr ((pa b).monotone hst) + refine ⟨hn a, ?_⟩ + rw [← ht, ← hs, ← Finset.sum_sub_distrib] + exact Finset.single_le_sum (fun b _ => hn b) (Finset.mem_univ a) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionPressure.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..9dd573d682280edfb4ed38bc0112d911e440fc53 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPartitionPressure.lean @@ -0,0 +1,54 @@ +import OAI.Probability.InvariantIsing.Core.FiniteTypePressure +import OAI.Probability.InvariantIsing.Spectral.PositiveSpectralPartition + +namespace OAI + +/-! A null-boundary spectral partition gives the physical pressure limit, +with its zero-mass cells assigned to a chosen positive-mass cell. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory IsingPerceptron Filter Set +open scoped Topology Classical BigOperators Function + +namespace InvariantIsing + +theorem spectral_partition_pressure_tendsto + (hhaar : HaarConcentrationInput) (hgauss : GaussianLipschitzVarianceInput) + (hpub : PanchenkoTalagrandFieldPairInput) {ι : Type*} [Fintype ι] + (μ : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (μ N)] + [∀ N, (μ N).IsMulRightInvariant] (eig : (N : ℕ) → Fin N → ℝ) + (ν : ProbabilityMeasure ℝ) + (hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + (S : ι → Set ℝ) (hcover : ∀ x, ∃ i, x∈S i) (hdis : Pairwise (Disjoint on S)) + (hS : ∀ i, MeasurableSet (S i)) (hbd : ∀ i, (ν : Measure ℝ) (frontier (S i))=0) + (lam : ι → ℝ) (fallback aMax : {i // 0 < (ν : Measure ℝ).real (S i)}) + (hMax : ∀ a : {i // 0 < (ν : Measure ℝ).real (S i)}, lam a ≤ lam aMax) : + Tendsto (fun N => ∫ V, rotatedPressure + (fun i => lam (positiveSpectralLabel (fun a => (ν : Measure ℝ).real (S a)) fallback + (spectralPartitionIndex S hcover (eig N i)))) + (matrixRotation V⁻¹) (fun _ => 0) ∂μ N) atTop + (𝓝 (variationalFunctional (measureR + (finiteSpectralMeasure (fun i : {i // 0 < (ν : Measure ℝ).real (S i)} => + (ν : Measure ℝ).real (S i)) (fun i => lam i)) (lam aMax))).toReal) := by + let w := fun a => (ν : Measure ℝ).real (S a) + let g := fun N (i : Fin N) => spectralPartitionIndex S hcover (eig N i) + have hc := spectral_label_counts_partition (fun k => k+1) Nat.succ_pos + (fun k => eig (k+1)) ν hweak S hS hbd (fun k => g (k+1)) + (fun k a i => spectralPartitionIndex_eq_iff S hcover hdis (eig (k+1) i) a) + have hp := positive_spectral_counts_tendsto (fun k => k+1) (fun k => g (k+1)) + w (fun _ => measureReal_nonneg) fallback hc + have hfull : Tendsto (fun N a => + (spectralLabelCount (positiveSpectralLabel w fallback ∘ g N) a : ℝ)/N) + atTop (𝓝 (fun a : {i // 0 < w i} => w a)) := + (tendsto_add_atTop_iff_nat 1).mp hp + exact finite_type_pressure_tendsto hhaar hgauss hpub μ (fun a : {i // 0 < w i} => lam a) + (fun N => positiveSpectralLabel w fallback ∘ g N) (fun a : {i // 0 < w i} => w a) + (fun a => a.property) (positiveSpectralWeights_sum w (fun _ => measureReal_nonneg) + (spectralPartitionWeights_sum (ν : Measure ℝ) S hcover hdis hS)) hfull aMax hMax + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPathLimit.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPathLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..469122fbc9a29c6fee8f6f16eb64a44beeddfac2 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPathLimit.lean @@ -0,0 +1,53 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralTemperatureFunctional + +namespace OAI + +/-! L1 approximation of the trial path preserves the finite spectral +interaction functional, as required when removing a finite partition. -/ + +noncomputable section +open MeasureTheory Set Filter +open scoped BigOperators Topology + +namespace InvariantIsing + +lemma finiteTemperatureFunctional_tendsto_of_L1 {ι : Type*} [Fintype ι] + (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) (hρsum : ∑ a, ρ a = 1) + (p : OverlapPath) (q : ℕ → OverlapPath) + (hL : Tendsto (fun k => ∫ s, |q k s - p s| ∂pathMeasure) atTop (𝓝 0)) + {t : ℝ} (ht : 0 ≤ t) : + Tendsto (fun k => finiteTemperatureFunctional ρ eig hρ hρsum (q k) t) atTop + (𝓝 (finiteTemperatureFunctional ρ eig hρ hρsum p t)) := by + let K := ∑ a, |eig a| + have heig (a : ι) : |eig a| ≤ K := + Finset.single_le_sum (fun b _ => abs_nonneg (eig b)) (Finset.mem_univ a) + have hbound (x : ℝ) : |finiteR ρ eig hρ hρsum x| ≤ K := + abs_le.mpr (finiteR_mem_interval ρ eig hρ hρsum + (fun a => (abs_le.mp (heig a)).1) (fun a => (abs_le.mp (heig a)).2) x) + have hd (r : ℝ) : Tendsto (fun k => deficit (q k) r) atTop (𝓝 (deficit p r)) := by + apply tendsto_sub_nhds_zero_iff.mp + apply squeeze_zero_norm' _ hL + exact Filter.Eventually.of_forall (fun k => by + simpa only [Real.norm_eq_abs] using abs_deficit_sub_path_le (q k) p r) + have hi : Tendsto (fun k => ∫ r, t * finiteR ρ eig hρ hρsum (t * deficit (q k) r) + ∂pathMeasure) atTop + (𝓝 (∫ r, t * finiteR ρ eig hρ hρsum (t * deficit p r) ∂pathMeasure)) := by + apply tendsto_integral_of_dominated_convergence (fun _ => t * K) + · intro k + exact (continuous_const.mul ((continuous_finiteR ρ eig hρ hρsum).comp + (continuous_const.mul (continuous_deficit (q k))))).aestronglyMeasurable + · exact integrable_const _ + · intro k + exact ae_of_all _ (fun r => by + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg ht] + exact mul_le_mul_of_nonneg_left (hbound _) ht) + · exact ae_of_all _ (fun r => + (((continuous_finiteR ρ eig hρ hρsum).tendsto _).comp ((hd r).const_mul t)).const_mul t) + simpa only [finiteTemperatureFunctional_eq ρ eig hρ hρsum _ ht, + spectralFunctional] using hi.const_mul (1 / 2 : ℝ) + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPathSynchronization.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPathSynchronization.lean new file mode 100644 index 0000000000000000000000000000000000000000..80b8ec9d7582fa0380364353156ac15c39757b11 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPathSynchronization.lean @@ -0,0 +1,152 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralPartitionPaths + +namespace OAI + +/-! Lipschitz synchronization of group quantiles, including total plateaus. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory IsingPerceptron Set +open scoped BigOperators + +namespace InvariantIsing + +lemma group_abs_increment_le_total {m : ℕ} (p : OverlapPath) (pa : Fin m → OverlapPath) + {s t : ℝ} (hs : (∑ a, pa a s) = p s) (ht : (∑ a, pa a t) = p t) + (a : Fin m) : |pa a s - pa a t| ≤ |p s - p t| := by + rcases le_total s t with hst | hts + · have he := (group_increment_le_total p pa hst hs ht a).2 + rw [abs_of_nonpos (sub_nonpos.mpr ((pa a).monotone hst)), + abs_of_nonpos (sub_nonpos.mpr (p.monotone hst))] + linarith + · have he := (group_increment_le_total p pa hts ht hs a).2 + rw [abs_of_nonneg (sub_nonneg.mpr ((pa a).monotone hts)), + abs_of_nonneg (sub_nonneg.mpr (p.monotone hts))] + exact he + +/-- A group coordinate is a Lipschitz function of total overlap on the +entire set of good quantile parameters. Plateaus give a unique value. -/ +theorem group_quantile_lipschitz_factor {m : ℕ} (p : OverlapPath) (pa : Fin m → OverlapPath) + (hsum : ∀ᵐ s ∂pathMeasure, (∑ a, pa a s) = p s) (a : Fin m) : + ∃ f : ℝ → ℝ, LipschitzWith 1 f ∧ ∀ᵐ s ∂pathMeasure, pa a s = f (p s) := by + classical + let good := {s : ℝ | (∑ b, pa b s) = p s} + let S := p '' good + let witness : S → ℝ := fun r => r.property.choose + have hw (r : S) : witness r ∈ good ∧ p (witness r) = r := r.property.choose_spec + let F : ℝ → ℝ := fun r => if hr : r ∈ S then pa a (witness ⟨r,hr⟩) else 0 + have hF (r : ℝ) (hr : r ∈ S) : F r = pa a (witness ⟨r,hr⟩) := dite_eq_left hr + have hLip : LipschitzOnWith 1 F S := by + apply LipschitzOnWith.of_dist_le_mul + intro r hr t ht + rw [Real.dist_eq, Real.dist_eq, hF r hr, hF t ht, NNReal.coe_one, one_mul] + have he := group_abs_increment_le_total p pa (hw ⟨r,hr⟩).1 (hw ⟨t,ht⟩).1 a + simpa only [(hw ⟨r,hr⟩).2, (hw ⟨t,ht⟩).2] using he + obtain ⟨f, hf, hfe⟩ := hLip.extend_real + refine ⟨f, hf, ?_⟩ + filter_upwards [hsum] with s hs + have hps : p s ∈ S := ⟨s,hs,rfl⟩ + have he := group_abs_increment_le_total p pa (hw ⟨p s,hps⟩).1 hs a + rw [(hw ⟨p s,hps⟩).2, sub_self, abs_zero] at he + have heq : pa a (witness ⟨p s,hps⟩) = pa a s := + sub_eq_zero.mp (abs_eq_zero.mp (le_antisymm he (abs_nonneg _))) + exact heq.symm.trans ((hF (p s) hps).symm.trans (hfe hps)) + +lemma factor_of_pair_law {Ω T : Type*} [MeasurableSpace Ω] [MeasurableSpace T] + (μ : Measure Ω) (ν : Measure T) (p a : Ω → ℝ) (P A : T → ℝ) + (hp : Measurable p) (ha : Measurable a) (hP : Measurable P) (hA : Measurable A) + (hl : μ.map (fun s => (p s, a s)) = ν.map (fun x => (P x, A x))) + (f : ℝ → ℝ) (hf : Continuous f) (he : ∀ᵐ s ∂μ, a s = f (p s)) : + ∀ᵐ x ∂ν, A x = f (P x) := by + have hm : MeasurableSet {z : ℝ × ℝ | z.2 = f z.1} := + (isClosed_eq continuous_snd (hf.comp continuous_fst)).measurableSet + have hmap : ∀ᵐ z ∂μ.map (fun s => (p s, a s)), z.2 = f z.1 := + (ae_map_iff (hp.prodMk ha).aemeasurable hm).mpr he + rw [hl] at hmap + exact (ae_map_iff (hP.prodMk hA).aemeasurable hm).mp hmap + +/-- The actual group overlap is a measurable, one-Lipschitz function of +the actual total overlap. No separate synchronization hypothesis is used. -/ +theorem spectralPartition_lipschitz_synchronization {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hgg : HasEntryGhirlandaGuerra (fun x i j => x (i,j)) (Q : Measure (SpectralArray (m + 1)))) + (hG : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralGram x) + (q : Fin (m + 1) → ℝ) (hq : ∀ a, 0 ≤ q a) + (hd : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i a, (x (i,i) a : ℝ) = q a) + (hE : ∀ e : Equiv.Perm ℕ, + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (hP : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), SpectralPartitionGeometry m x) + (hn : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ a, 0 ≤ (x (0,1) a : ℝ)) + (a : Fin m) : + ∃ f : ℝ → ℝ, LipschitzWith 1 f ∧ + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (0,1) a.castSucc : ℝ) = f (spectralSpinArray x 0 1) := by + classical + let hs := spectralCoordinate_unit hn + let hp := (show ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + spectralLinearArray (spectralSpinWeight m) x 0 1 ∈ Icc (0 : ℝ) 1 by + simpa only [spectralLinearArray_spinWeight] using spectralPartition_spin_unit hP hn) + let p := spectralQuantilePath Q (spectralSpinWeight m) hp + let pa := fun b : Fin m => spectralQuantilePath Q (Pi.single b.castSucc 1) (hs b.castSucc) + have hsum : ∀ᵐ s ∂pathMeasure, (∑ b, pa b s) = p s := + spectralPartition_quantile_sum hgg hG q hq hd hE hP hn + obtain ⟨f, hf, hfa⟩ := group_quantile_lipschitz_factor p pa hsum a + refine ⟨f, hf, ?_⟩ + have hsingle : ∀ b, 0 ≤ (Pi.single a.castSucc 1 : Fin (m + 1) → ℝ) b := by + intro b + simp only [Pi.single_apply] + split_ifs <;> norm_num + have he := factor_of_pair_law pathMeasure (Q : Measure (SpectralArray (m + 1))) + p (pa a) (fun x => spectralLinearArray (spectralSpinWeight m) x 0 1) + (fun x => spectralLinearArray (Pi.single a.castSucc 1) x 0 1) + p.measurable (pa a).measurable + (by unfold spectralLinearArray spectralLinearEntry; fun_prop) + (by unfold spectralLinearArray spectralLinearEntry; fun_prop) + (spectralQuantilePath_pair_law hgg hG q hq hd hE (spectralSpinWeight m) (Pi.single a.castSucc 1) + (spectralSpinWeight_nonneg m) hsingle hp (hs a.castSucc)) + f hf.continuous hfa + simpa only [spectralLinearArray_spinWeight, spectralLinearArray_single, spectralCoordinateArray] using he + +lemma exists_injective_nat_pair {i j : ℕ} (hij : i ≠ j) : + ∃ e : ℕ → ℕ, Function.Injective e ∧ e 0 = i ∧ e 1 = j := by + let e : ℕ → ℕ := fun n => if n = 0 then i else if n = 1 then j else max i j + n + refine ⟨e, ?_, by simp [e], by simp [e]⟩ + intro a b hab + have hi := le_max_left i j + have hj := le_max_right i j + dsimp only [e] at hab + split_ifs at hab <;> omega + +lemma spectral_factor_all_off_diagonal {m : ℕ} + {Q : ProbabilityMeasure (SpectralArray (m + 1))} + (hE : ∀ e : ℕ → ℕ, Function.Injective e → + (Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e) = Q) + (a : Fin m) (f : ℝ → ℝ) (hf : Continuous f) + (hpair : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), + (x (0,1) a.castSucc : ℝ) = f (spectralSpinArray x 0 1)) : + ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))), ∀ i j, i ≠ j → + (x (i,j) a.castSucc : ℝ) = f (spectralSpinArray x i j) := by + apply ae_all_iff.mpr + intro i + apply ae_all_iff.mpr + intro j + by_cases hij : i = j + · exact ae_of_all _ fun _ h => (h hij).elim + obtain ⟨e, he, he0, he1⟩ := exists_injective_nat_pair hij + have hm : MeasurableSet {x : SpectralArray (m + 1) | + (x (0,1) a.castSucc : ℝ) = f (spectralSpinArray x 0 1)} := + (isClosed_eq (by fun_prop) (hf.comp (by unfold spectralSpinArray; fun_prop))).measurableSet + have hmap : ∀ᵐ x ∂(Q : Measure (SpectralArray (m + 1))).map (permuteSpectralArray e), + (x (0,1) a.castSucc : ℝ) = f (spectralSpinArray x 0 1) := by + rw [hE e he] + exact hpair + have ha := (ae_map_iff (continuous_permuteSpectralArray e).measurable.aemeasurable hm).mp hmap + filter_upwards [ha] with x hx + intro _ + simpa only [permuteSpectralArray, spectralSpinArray, he0, he1] using hx + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPaths.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..a838254123d2db96cabe61b3f695a9f551efb314 --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPaths.lean @@ -0,0 +1,99 @@ +import OAI.Probability.InvariantIsing.Spectral.SpectralCalculus + +namespace OAI + +/-! The finite spectral-group functions from manuscript `rot:f`. -/ + +noncomputable section + +open scoped BigOperators Topology +open Filter + +namespace InvariantIsing + +variable {ι : Type*} [Fintype ι] + +def projectedResolvent (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) (x : ℝ) : ℝ := + if 0 < x then ρ a / (finiteInverse ρ eig hρ hρsum x - eig a) else 0 + +def projectedResolventDerivative (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) (x : ℝ) : ℝ := + if 0 < x then ρ a / + (finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) * + (finiteInverse ρ eig hρ hρsum x - eig a) ^ 2) else ρ a + +theorem sum_projectedResolvent (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) {x : ℝ} (hx : 0 ≤ x) : + (∑ a, projectedResolvent ρ eig hρ hρsum a x) = x := by + rcases hx.eq_or_lt with h | h + · subst x + simp only [projectedResolvent, lt_self_iff_false, ite_false, Finset.sum_const_zero] + · simp only [projectedResolvent, ite_eq_left h] + exact (finiteInverse_spec ρ eig hρ hρsum h).2 + +theorem projectedResolventDerivative_pos (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) (x : ℝ) : + 0 < projectedResolventDerivative ρ eig hρ hρsum a x := by + by_cases hx : 0 < x + · simp only [projectedResolventDerivative, ite_eq_left hx] + have hs := finiteInverse_spec ρ eig hρ hρsum hx + exact div_pos (hρ a) (mul_pos + (finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1) + (sq_pos_of_pos (sub_pos.mpr (hs.1 a)))) + · simpa only [projectedResolventDerivative, ite_eq_right hx] using hρ a + +theorem sum_projectedResolventDerivative (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (x : ℝ) : + (∑ a, projectedResolventDerivative ρ eig hρ hρsum a x) = 1 := by + by_cases hx : 0 < x + · simp only [projectedResolventDerivative, ite_eq_left hx] + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hm := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + calc + _ = (∑ a, ρ a / (finiteInverse ρ eig hρ hρsum x - eig a) ^ 2) / + finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x) := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + rw [div_div] + congr 1 + ring + _ = 1 := div_self hm.ne' + · simpa only [projectedResolventDerivative, ite_eq_right hx] using hρsum + +theorem projectedResolventDerivative_le_one (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) (x : ℝ) : + projectedResolventDerivative ρ eig hρ hρsum a x ≤ 1 := by + rw [← sum_projectedResolventDerivative ρ eig hρ hρsum x] + exact Finset.single_le_sum + (fun b _ => (projectedResolventDerivative_pos ρ eig hρ hρsum b x).le) + (Finset.mem_univ a) + +theorem hasStrictDerivAt_projectedResolvent (ρ eig : ι → ℝ) (hρ : ∀ a, 0 < ρ a) + (hρsum : ∑ a, ρ a = 1) (a : ι) {x : ℝ} (hx : 0 < x) : + HasStrictDerivAt (projectedResolvent ρ eig hρ hρsum a) + (projectedResolventDerivative ρ eig hρ hρsum a x) x := by + have hs := finiteInverse_spec ρ eig hρ hρsum hx + have hm := finiteSecondResolvent_pos (fun a => (hρ a).le) hρsum hs.1 + have hd := hasStrictDerivAt_finiteInverse ρ eig hρ hρsum hx + have hden : HasStrictDerivAt + (fun y => finiteInverse ρ eig hρ hρsum y - eig a) + (-1 / finiteSecondResolvent ρ eig (finiteInverse ρ eig hρ hρsum x)) x := by + convert! hd.sub_const (eig a) using 1 + have hquot := (hasStrictDerivAt_const x (ρ a)).fun_div hden + (ne_of_gt (sub_pos.mpr (hs.1 a))) + have heq : (fun y => ρ a / (finiteInverse ρ eig hρ hρsum y - eig a)) =ᶠ[𝓝 x] + projectedResolvent ρ eig hρ hρsum a := by + filter_upwards [Ioi_mem_nhds hx] with y hy + simp only [projectedResolvent, ite_eq_left (show 0 < y from hy)] + convert hquot.congr_of_eventuallyEq heq using 1 + simp only [projectedResolventDerivative, ite_eq_left hx] + field_simp + ring + +end InvariantIsing + +end + +end OAI diff --git a/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPermutation.lean b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b1862d1f51f24ef69dae1d04aca4e041aa34aec --- /dev/null +++ b/lean/OAI/Probability/InvariantIsing/Spectral/SpectralPermutation.lean @@ -0,0 +1,109 @@ +import OAI.Probability.InvariantIsing.Haar.SpecialPlaneRotation +import OAI.Probability.InvariantIsing.Spectral.SpectralCountComparison + +namespace OAI + +/-! Spectral reorderings can be realized inside SO(N). A single row sign +corrects a permutation determinant without changing any squared projection. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators Matrix + +namespace InvariantIsing + +lemma permutationMatrix_orthogonal {N : ℕ} (p : Equiv.Perm (Fin N)) : + p.permMatrix ℝ ∈ Matrix.orthogonalGroup (Fin N) ℝ := by + apply (Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mpr + rw [Matrix.transpose_permMatrix, ← Matrix.permMatrix_mul] + simp + +lemma permutationMatrix_det_sq {N : ℕ} (p : Equiv.Perm (Fin N)) : + (p.permMatrix ℝ).det ^ 2 = 1 := by + let U : Orthogonal N := ⟨p.permMatrix ℝ, permutationMatrix_orthogonal p⟩ + rcases orthogonal_det_eq_one_or_neg_one U with h | h <;> + change (p.permMatrix ℝ).det = _ at h <;> rw [h] <;> norm_num + +def permutationSignDiagonal {N : ℕ} (hN : 0 < N) (p : Equiv.Perm (Fin N)) : + Matrix (Fin N) (Fin N) ℝ := + Matrix.diagonal fun i => if i = (⟨0, hN⟩ : Fin N) then (p.permMatrix ℝ).det else 1 + +lemma permutationSignDiagonal_sq {N : ℕ} (hN : 0 < N) (p : Equiv.Perm (Fin N)) : + permutationSignDiagonal hN p * (permutationSignDiagonal hN p)ᵀ = 1 := by + rw [permutationSignDiagonal, Matrix.diagonal_transpose, Matrix.diagonal_mul_diagonal] + ext i j + by_cases hij : i = j + · subst j + simp only [Matrix.diagonal_apply_eq, Matrix.one_apply_eq] + split_ifs + · exact (pow_two ((p.permMatrix ℝ).det)).symm.trans (permutationMatrix_det_sq p) + · norm_num + · simp [Matrix.diagonal_apply_ne _ hij, Matrix.one_apply_ne hij] + +lemma permutationSignDiagonal_det {N : ℕ} (hN : 0 < N) (p : Equiv.Perm (Fin N)) : + (permutationSignDiagonal hN p).det = (p.permMatrix ℝ).det := by + simp [permutationSignDiagonal, Matrix.det_diagonal] + +/-- A permutation of spectral coordinates, with determinant corrected to one. -/ +def spectralPermutation {N : ℕ} (hN : 0 < N) (p : Equiv.Perm (Fin N)) : + SpecialOrthogonal N := + ⟨permutationSignDiagonal hN p * p.permMatrix ℝ, by + apply Matrix.mem_specialOrthogonalGroup_iff.mpr + constructor + · apply (Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mpr + rw [Matrix.transpose_mul] + calc + _ = permutationSignDiagonal hN p * + (p.permMatrix ℝ * (p.permMatrix ℝ)ᵀ) * (permutationSignDiagonal hN p)ᵀ := by + simp only [Matrix.mul_assoc] + _ = permutationSignDiagonal hN p * (permutationSignDiagonal hN p)ᵀ := by + rw [(Matrix.mem_orthogonalGroup_iff (Fin N) ℝ).mp (permutationMatrix_orthogonal p)] + simp + _ = 1 := permutationSignDiagonal_sq hN p + · rw [Matrix.det_mul, permutationSignDiagonal_det, ← pow_two, permutationMatrix_det_sq]⟩ + +lemma spectralPermutation_coordinate_sq {N : ℕ} (hN : 0 < N) + (p : Equiv.Perm (Fin N)) (U : SpecialOrthogonal N) + (x : EuclideanSpace ℝ (Fin N)) (i : Fin N) : + (specialRotation (spectralPermutation hN p * U) x i) ^ 2 = + (specialRotation U x (p i)) ^ 2 := by + have he : specialRotation (spectralPermutation hN p * U) x i = + (if i = (⟨0, hN⟩ : Fin N) then (p.permMatrix ℝ).det else 1) * + specialRotation U x (p i) := by + change (((permutationSignDiagonal hN p * p.permMatrix ℝ) * + (U : Matrix (Fin N) (Fin N) ℝ)) *ᵥ x.ofLp) i = _ + rw [← Matrix.mulVec_mulVec, ← Matrix.mulVec_mulVec, Matrix.permMatrix_mulVec] + simp only [permutationSignDiagonal, Matrix.mulVec_diagonal, + Function.comp_apply, specialRotation_apply] + rfl + rw [he, mul_pow] + split_ifs + · rw [permutationMatrix_det_sq, one_mul] + · rw [one_pow, one_mul] + +lemma rotatedEnergy_spectralPermutation {N : ℕ} (hN : 0 < N) + (p : Equiv.Perm (Fin N)) (eig : Fin N → ℝ) (U : SpecialOrthogonal N) (σ : Spin N) : + rotatedEnergy (fun i => eig (p i)) (specialRotation (spectralPermutation hN p * U)) σ = + rotatedEnergy eig (specialRotation U) σ := by + simp only [rotatedEnergy, spectralPermutation_coordinate_sq] + rw [Equiv.sum_comp p (fun i => eig i * (specialRotation U (spinVector σ) i) ^ 2)] + +lemma meanPressure_spectralPermutation {N : ℕ} (hN : 0 < N) + (μ : Measure (SpecialOrthogonal N)) [μ.IsMulLeftInvariant] + (p : Equiv.Perm (Fin N)) (eig c : Fin N → ℝ) : + (∫ U, rotatedPressure (fun i => eig (p i)) (specialRotation U) c ∂μ) = + ∫ U, rotatedPressure eig (specialRotation U) c ∂μ := by + have he (U : SpecialOrthogonal N) : + rotatedPressure (fun i => eig (p i)) (specialRotation (spectralPermutation hN p * U)) c = + rotatedPressure eig (specialRotation U) c := by + simp only [rotatedPressure, rotatedEnergy_spectralPermutation] + rw [← integral_mul_left_eq_self + (fun U => rotatedPressure (fun i => eig (p i)) (specialRotation U) c) + (spectralPermutation hN p)] + simp only [he] + +end InvariantIsing + +end + +end OAI