Add lean source and binary files (part 124)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarLogCoshSecond.leanAdded+62
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOrder.leanAdded+101
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOverlap.leanAdded+114
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSampling.leanAdded+105
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarScaling.leanAdded+152
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSecondDerivative.leanAdded+71
- lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSquareOrder.leanAdded+111
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondBounds.leanAdded+103
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondCovariance.leanAdded+50
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondFamily.leanAdded+136
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanBounds.leanAdded+131
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanDerivative.leanAdded+123
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeasurable.leanAdded+74
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondRecursion.leanAdded+67
- lean/OAI/Probability/InvariantIsing/Fields/FieldSecondTangentDerivative.leanAdded+139
- lean/OAI/Probability/InvariantIsing/Fields/FieldShiftMoments.leanAdded+63
- lean/OAI/Probability/InvariantIsing/Fields/FieldSimpleApproximation.leanAdded+53
- lean/OAI/Probability/InvariantIsing/Fields/FieldSmoothFamily.leanAdded+170
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpatialParameterOrder.leanAdded+65
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinDerivative.leanAdded+77
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinEvaluation.leanAdded+54
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinFolding.leanAdded+62
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinKernelOrder.leanAdded+110
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLinear.leanAdded+64
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLipschitz.leanAdded+35
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinMeasurability.leanAdded+74
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinPairConditioning.leanAdded+68
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProduct.leanAdded+72
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProductLaw.leanAdded+42
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProjectionEnergy.leanAdded+61
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSampling.leanAdded+123
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSecondDerivative.leanAdded+86
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinTransition.leanAdded+159
- lean/OAI/Probability/InvariantIsing/Fields/FieldSpinVariance.leanAdded+119
- lean/OAI/Probability/InvariantIsing/Fields/FieldSquarePrefix.leanAdded+54
- lean/OAI/Probability/InvariantIsing/Fields/FieldTail.leanAdded+61
- lean/OAI/Probability/InvariantIsing/Fields/FieldTailMgf.leanAdded+62
- lean/OAI/Probability/InvariantIsing/Fields/FieldTangentOrder.leanAdded+97
- lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalGenerator.leanAdded+57
- lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOne.leanAdded+116
- lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOrder.leanAdded+128
- lean/OAI/Probability/InvariantIsing/Fields/FieldTiltAverageDerivative.leanAdded+130
- lean/OAI/Probability/InvariantIsing/Fields/FieldTiltDerivative.leanAdded+46
- lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedFamilyDerivative.leanAdded+102
- lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedPairDerivative.leanAdded+63
- lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingContinuity.leanAdded+139
- lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingRecursion.leanAdded+158
- lean/OAI/Probability/InvariantIsing/Fields/FieldVectorPairSampling.leanAdded+139
- lean/OAI/Probability/InvariantIsing/Fields/FieldVectorSampling.leanAdded+121
- lean/OAI/Probability/InvariantIsing/Fields/FieldWasserstein.leanAdded+58
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import OAI.Probability.InvariantIsing.Fields.FieldScalarSecondDerivative
namespace OAI
/-! Bounded first and second spatial derivatives for the scalar Isingbackward recursion, including degenerate covariance increments. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101import OAI.Probability.InvariantIsing.Fields.FieldScalarChain
namespace OAI
/-! Radial order of the actual scalar backward values and physical spinmeans, with covariance increments fixed. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114import OAI.Probability.InvariantIsing.Fields.FieldScalarChain
namespace OAI
/-! The scalar field's actual level overlaps. Their ordering is theconditional Jensen inequality, and zero increments give exact ties. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105import OAI.Probability.InvariantIsing.Fields.FieldSpinSamplingimport OAI.Probability.InvariantIsing.Fields.FieldMagnetization
namespace OAI
/-! Common-prefix sampling of two scalar Ising spins. After the splitthe two tails are independent; before the split they use the same actualtilted Gaussian transition. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152import OAI.Probability.InvariantIsing.Fields.FieldScalarOverlapimport OAI.Probability.InvariantIsing.Fields.FieldCovarianceScaling
namespace OAI
/-! Change of position units for the actual finite conditional spinchain. The spin observable acquires no multiplicative derivative factor. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071import OAI.Probability.InvariantIsing.Fields.FieldSpinSecondDerivativeimport OAI.Probability.InvariantIsing.Fields.FieldScalarDerivative
namespace OAI
/-! Bounded second derivatives through the actual finite scalar recursion. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111import OAI.Probability.InvariantIsing.Fields.FieldScalarOrderimport OAI.Probability.InvariantIsing.Fields.FieldScalarOverlapimport OAI.Probability.InvariantIsing.Fields.FieldEvenTransition
namespace OAI
/-! Ordered even second-moment tests propagated through the actualfinite tilted position chain. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103import OAI.Probability.InvariantIsing.Fields.FieldSecondFamily
namespace OAI
/-! Local bounds for the explicit first and second derivatives of theaffine Gaussian mark in the finite scalar recursion. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Set
namespace InvariantIsingnamespace 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 FieldSecondFamilyend InvariantIsing
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import OAI.Probability.InvariantIsing.Fields.FieldAffineAverageDerivative
namespace OAI
/-! The two-coordinate covariance algebra for second derivatives ofthe scalar Gaussian recursion. -/
noncomputable sectionopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136import OAI.Probability.InvariantIsing.Fields.FieldAffineRecursionimport 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 thescalar field. All bounds are local in the covariance coordinate. -/
noncomputable sectionopen 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 FieldSecondFamilyend InvariantIsing
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131import 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 sectionopen 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 FieldSecondFamilyend InvariantIsing
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123import OAI.Probability.InvariantIsing.Fields.FieldSecondCovarianceimport 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 spatialderivative of the incoming scalar payoff. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Set
namespace InvariantIsingnamespace 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 FieldSecondFamilyend InvariantIsing
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374import OAI.Probability.InvariantIsing.Fields.FieldSecondTangentDerivative
namespace OAI
/-! Measurability of the explicit second derivatives of the scalarGaussian recursion, including their affine Gaussian weights. -/
noncomputable sectionopen 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 FieldSecondFamilyend InvariantIsing
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667import OAI.Probability.InvariantIsing.Fields.FieldSecondMeanBounds
namespace OAI
/-! Closure of the actual finite scalar recursion under two derivativeson every interval with positive, bounded affine variances. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Set
namespace InvariantIsingnamespace 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139import OAI.Probability.InvariantIsing.Fields.FieldSecondMeanDerivativeimport OAI.Probability.InvariantIsing.Fields.FieldRawTangent
namespace OAI
/-! The second covariance derivative of the actual scalar Gaussianvalue, obtained by differentiating its raw affine-noise tangent. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen scoped Topology
namespace InvariantIsingnamespace 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 FieldSecondFamilyend InvariantIsing
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263import OAI.Probability.InvariantIsing.Fields.FieldSmoothFamilyimport OAI.Probability.InvariantIsing.Fields.FieldGaussianTiltMoments
namespace OAI
/-! Uniform polynomial moments for the actual shifted Gaussian weightsof the finite scalar field. The bound is independent of the spatial bias. -/
noncomputable sectionopen 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import OAI.Probability.InvariantIsing.Fields.SimpleFieldComparison
namespace OAI
/-! Canonical finite field approximations in first absolute moment. -/noncomputable sectionopen MeasureTheory ProbabilityTheory Filter Setopen scoped Topologynamespace 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170import OAI.Probability.InvariantIsing.Fields.FieldRealVariance
namespace OAI
/-! The scalar field family carrying exactly the derivatives needed forfinite covariance-coordinate differentiation. No bound on the value isrequired: bounded spatial derivative supplies its Gaussian moments. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 FieldSmoothFamilyend InvariantIsing
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import OAI.Probability.InvariantIsing.Fields.FieldAdjacentDerivativeimport OAI.Probability.InvariantIsing.Fields.FieldScalarSquareOrderimport OAI.Probability.InvariantIsing.Fields.FieldParameterOrder
namespace OAI
/-! The spatial consequence of the backward covariance derivative.Radial antitonicity of that derivative gives ordering of the physicalconditional means, and hence ordering of all earlier squared means. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 FieldSmoothFamilyend InvariantIsing
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677import OAI.Probability.InvariantIsing.Fields.FieldSpinTransitionimport OAI.Probability.InvariantIsing.Arrays.NSpinTensorBackwardDerivative
namespace OAI
/-! Spatial differentiation of the scalar Gaussian operator. The payoffmay grow linearly; only its derivative is bounded. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import OAI.Probability.InvariantIsing.Fields.FieldEnergyCoordinatesimport OAI.Probability.InvariantIsing.Fields.FieldSpinPairConditioning
namespace OAI
/-! The actual finite vector-spin common-depth test under the publishedmarking input. Both the spin conditioning and exponential integrabilityare derived for this model. -/
noncomputable sectionopen 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 fieldrepresentation, 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import OAI.Probability.InvariantIsing.Fields.FieldGaussianTransformLaw
namespace OAI
/-! Exact odd-observable law for an even Gaussian tilt. This is theconditional-spin kernel in the radial field comparison. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 foldedobservable 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110import OAI.Probability.InvariantIsing.Fields.FieldSpinFolding
namespace OAI
/-! Monotonicity of the physical conditional-spin transition. This keepsthe spin observable, rather than the derivative in rescaled coordinates. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 actualGaussian 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import OAI.Probability.InvariantIsing.Fields.FieldSpinSecondDerivative
namespace OAI
/-! Linear identities for the actual tilted scalar transition. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI1234567891011121314151617181920212223242526272829303132333435import 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 sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374import OAI.Probability.InvariantIsing.Fields.FieldSpinEvaluation
namespace OAI
/-! Measurability of the actual scalar-field spin test before averagingthe Gaussian root and the labeled forest. -/
noncomputable sectionopen 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768import OAI.Probability.InvariantIsing.Fields.FieldPublishedEvaluationimport OAI.Probability.InvariantIsing.Arrays.NSpinTensorPairConditioning
namespace OAI
/-! Physical spins conditional on the two scalar-field endpoints. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172import OAI.Probability.InvariantIsing.Fields.FieldSpinSamplingimport OAI.Probability.InvariantIsing.Fields.SpinFactorization
namespace OAI
/-! The finite Ising spin law with a scalar field at each site factorsinto the actual one-site Gibbs kernels, including its two-spin tests. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142import OAI.Probability.InvariantIsing.Core.ProductKernelSampling
namespace OAI
/-! Exact product law of the canonical terminal spins after all Gaussiantransitions. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061import OAI.Probability.InvariantIsing.Core.FiniteWeightedCauchyimport 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 sectionopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123import OAI.Probability.InvariantIsing.Fields.FieldScalarOverlapimport OAI.Probability.InvariantIsing.Arrays.NSpinTensorLabeledimport Mathlib.Probability.Kernel.Composition.IntegralCompProd
namespace OAI
/-! Actual spin sampling and Gaussian transitions for the scalar Isingrecursion. The transition kernels remain probabilities at zero variance. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 Gaussiantransitions, 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586import OAI.Probability.InvariantIsing.Fields.FieldTiltAverageDerivative
namespace OAI
/-! The derivative of the actual scalar spin transition, with alinearly growing potential. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159import OAI.Probability.InvariantIsing.Fields.FieldSpinKernelOrderimport Mathlib.Probability.Moments.Variance
namespace OAI
/-! The scalar physical-spin transition and its bounded martingaleproperties, including degenerate covariance increments. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119import OAI.Probability.InvariantIsing.Fields.FieldSpinLipschitzimport OAI.Probability.InvariantIsing.Fields.FieldGaussianTiltMoments
namespace OAI
/-! A quantitative conditional-variance bound for a Lipschitz spinmean. The constant depends only on an upper bound for the Gaussianvariance, rather than on the depth of the scalar recursion. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import OAI.Probability.InvariantIsing.Fields.FieldScalarComposition
namespace OAI
/-! Composition of an earlier conditional spin square with an unchangedlater scalar recursion. This keeps the ordinary Gaussian root separate. -/
noncomputable sectionopen IsingPerceptronopen 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061import OAI.Probability.InvariantIsing.Fields.FieldLipschitzTransport
namespace OAI
/-! The excess of the absolute field above a cutoff is a one-Lipschitz tail test. -/noncomputable sectionopen MeasureTheory ProbabilityTheory Filter Setopen scoped Topologynamespace 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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import OAI.Probability.InvariantIsing.Core.KernelExponentialBoundimport OAI.Probability.InvariantIsing.Fields.FieldIncrementMgf
namespace OAI
/-! Canonical endpoint exponential moments depend only on the sum ofincrement variances. Arbitrarily small positive exponents and arbitrarilymany levels are allowed. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697import OAI.Probability.InvariantIsing.Fields.FieldConstantPrefiximport OAI.Probability.InvariantIsing.Fields.FieldEvenTransition
namespace OAI
/-! Evenness and radial antitonicity of a backward covariance derivativeare preserved by each unchanged earlier Gaussian transition. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657import OAI.Probability.InvariantIsing.Fields.FieldSpinLinearimport OAI.Probability.InvariantIsing.Fields.FieldScalarLogCoshSecond
namespace OAI
/-! The terminal Ising identity gives the constant term at the lastcovariance level of the backward derivative. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116import OAI.Probability.InvariantIsing.Fields.FieldGaussianTerminal
namespace OAI
/-! Appending an exponent-one terminal increment changes the scalarvalue by its Gaussian constant and preserves every earlier spin moment. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128import OAI.Probability.InvariantIsing.Fields.FieldAdjacentOrderimport 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 sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130import OAI.Probability.InvariantIsing.Fields.FieldTiltDerivative
namespace OAI
/-! Differentiation of the scalar tilted spin average. The potentialneeds an exponential moment at the base point, rather than a global bound. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546import OAI.Probability.InvariantIsing.Fields.FieldSpinDerivative
namespace OAI
/-! A local integrable envelope permits covariance derivatives of aGaussian logarithmic mean without a bounded-payoff assumption. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102import OAI.Probability.InvariantIsing.Fields.FieldGaussianFamilyEnvelopeimport OAI.Probability.InvariantIsing.Fields.FieldGaussianTiltMoments
namespace OAI
/-! Differentiating a normalized scalar Gaussian average with a varyingobservable. The local envelopes allow the affine-noise quadratic termsneeded in the second derivative of the finite Ising recursion. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263import 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 sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filter Setopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139import OAI.Probability.InvariantIsing.Fields.FieldVaryingRecursion
namespace OAI
/-! Joint continuity of the actual finite scalar recursion and itsphysical-spin second moments, including zero variance increments. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Filteropen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158import OAI.Probability.InvariantIsing.Fields.FieldGaussianContinuityimport OAI.Probability.InvariantIsing.Fields.FieldCapEstimateimport OAI.Probability.InvariantIsing.Fields.FieldScalarChain
namespace OAI
/-! Fixed finite cascade exponents with varying nonnegative scalarvariances. These are the actual log-cosh recursion and spin observables. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139import OAI.Probability.InvariantIsing.Fields.FieldVectorSamplingimport OAI.Probability.InvariantIsing.Fields.FieldScalarSamplingimport OAI.Probability.InvariantIsing.Fields.FieldCommonDepthLaw
namespace OAI
/-! Evaluation of the common-prefix vector Ising spin pair law, with theactual cascade depth distribution and its independent root Gaussian. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptronopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121import OAI.Probability.InvariantIsing.Fields.FieldGaussianProductimport OAI.Probability.InvariantIsing.Fields.FieldSpinProduct
namespace OAI
/-! Actual vector spin sampling for independent scalar cavity fields. -/
noncomputable sectionopen MeasureTheory ProbabilityTheory IsingPerceptron Setopen 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import OAI.Probability.InvariantIsing.Magnetic.MagneticFieldExtensionimport Mathlib.MeasureTheory.Measure.Prod
namespace OAI
/-! First-moment transport is the infimum of the costs of joint laws. -/noncomputable sectionopen MeasureTheory ProbabilityTheory Filter Setopen scoped ENNRealnamespace 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 OAIlean/OAI/Probability/InvariantIsing/Fields/FieldScalarLogCoshSecond.leanAdded+62
lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOrder.leanAdded+101
lean/OAI/Probability/InvariantIsing/Fields/FieldScalarOverlap.leanAdded+114
lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSampling.leanAdded+105
lean/OAI/Probability/InvariantIsing/Fields/FieldScalarScaling.leanAdded+152
lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSecondDerivative.leanAdded+71
lean/OAI/Probability/InvariantIsing/Fields/FieldScalarSquareOrder.leanAdded+111
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondBounds.leanAdded+103
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondCovariance.leanAdded+50
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondFamily.leanAdded+136
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanBounds.leanAdded+131
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeanDerivative.leanAdded+123
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondMeasurable.leanAdded+74
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondRecursion.leanAdded+67
lean/OAI/Probability/InvariantIsing/Fields/FieldSecondTangentDerivative.leanAdded+139
lean/OAI/Probability/InvariantIsing/Fields/FieldShiftMoments.leanAdded+63
lean/OAI/Probability/InvariantIsing/Fields/FieldSimpleApproximation.leanAdded+53
lean/OAI/Probability/InvariantIsing/Fields/FieldSmoothFamily.leanAdded+170
lean/OAI/Probability/InvariantIsing/Fields/FieldSpatialParameterOrder.leanAdded+65
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinDerivative.leanAdded+77
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinEvaluation.leanAdded+54
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinFolding.leanAdded+62
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinKernelOrder.leanAdded+110
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLinear.leanAdded+64
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinLipschitz.leanAdded+35
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinMeasurability.leanAdded+74
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinPairConditioning.leanAdded+68
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProduct.leanAdded+72
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProductLaw.leanAdded+42
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinProjectionEnergy.leanAdded+61
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSampling.leanAdded+123
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinSecondDerivative.leanAdded+86
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinTransition.leanAdded+159
lean/OAI/Probability/InvariantIsing/Fields/FieldSpinVariance.leanAdded+119
lean/OAI/Probability/InvariantIsing/Fields/FieldSquarePrefix.leanAdded+54
lean/OAI/Probability/InvariantIsing/Fields/FieldTail.leanAdded+61
lean/OAI/Probability/InvariantIsing/Fields/FieldTailMgf.leanAdded+62
lean/OAI/Probability/InvariantIsing/Fields/FieldTangentOrder.leanAdded+97
lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalGenerator.leanAdded+57
lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOne.leanAdded+116
lean/OAI/Probability/InvariantIsing/Fields/FieldTerminalOrder.leanAdded+128
lean/OAI/Probability/InvariantIsing/Fields/FieldTiltAverageDerivative.leanAdded+130
lean/OAI/Probability/InvariantIsing/Fields/FieldTiltDerivative.leanAdded+46
lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedFamilyDerivative.leanAdded+102
lean/OAI/Probability/InvariantIsing/Fields/FieldTiltedPairDerivative.leanAdded+63
lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingContinuity.leanAdded+139
lean/OAI/Probability/InvariantIsing/Fields/FieldVaryingRecursion.leanAdded+158
lean/OAI/Probability/InvariantIsing/Fields/FieldVectorPairSampling.leanAdded+139
lean/OAI/Probability/InvariantIsing/Fields/FieldVectorSampling.leanAdded+121
lean/OAI/Probability/InvariantIsing/Fields/FieldWasserstein.leanAdded+58