File size: 8,737 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | import Mathlib
import OAI.Probability.Perceptron.Interpolation.PerturbationContact
namespace OAI
noncomputable section
namespace SphericalPerceptronFreeEnergy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal ENNReal BigOperators BoundedContinuousFunction
section
variable {X : Type*} [TopologicalSpace X] [MeasurableSpace X] [OpensMeasurableSpace X]
def boundedTestIntegral (ΞΌ : Measure X) [IsProbabilityMeasure ΞΌ] : (X βα΅ β) βL[β] β :=
LinearMap.mkContinuous
{ toFun := fun f => β« x, f x βΞΌ
map_add' := fun f g => integral_add (f.integrable ΞΌ) (g.integrable ΞΌ)
map_smul' := fun c f => by simpa using integral_const_mul c (fun x => f x) }
1 (fun f => by simpa using f.norm_integral_le_norm ΞΌ)
def compactGGTestCLM {K : Type*} [TopologicalSpace K] [MeasurableSpace K]
[BorelSpace K] [SecondCountableTopology K]
(ΞΌ : ProbabilityMeasure (CompactArray K)) (n : β) (i : Fin n)
(f : CompactBlock K n βα΅ β) : (K βα΅ β) βL[β] β := by
classical
let I := boundedTestIntegral (ΞΌ : Measure (CompactArray K))
let F := f.compContinuous β¨compactBlock n,compactBlock_continuous nβ©
let E (a b : β) := BoundedContinuousFunction.compContinuousCLM β β
(β¨fun Q : CompactArray K => Q a b,by fun_propβ© : C(CompactArray K,K))
let L (a b : β) := I.comp ((ContinuousLinearMap.mul β (CompactArray K βα΅ β) F).comp (E a b))
exact (n:β) β’ L i n - (I F) β’ (I.comp (E 0 1)) - β j β Finset.univ.erase i, L i j
lemma compactGGTestCLM_apply {K : Type*} [TopologicalSpace K] [MeasurableSpace K]
[BorelSpace K] [SecondCountableTopology K]
(ΞΌ : ProbabilityMeasure (CompactArray K)) (n : β) (i : Fin n)
(f : CompactBlock K n βα΅ β) (g : K βα΅ β) :
compactGGTestCLM ΞΌ n i f g = compactGGDefect ΞΌ n i f g := by
classical
simp [compactGGTestCLM,compactGGDefect,boundedTestIntegral]
lemma compactJoint_monomials_total (L : (CompactJointOverlap βα΅ β) βL[β] β)
(hL : β p d, L (compactJointMonomial p d)=0) : L=0 := by
let e := ContinuousMap.linearIsometryBoundedOfCompact CompactJointOverlap β β
let L' := L.comp e.toContinuousLinearEquiv.toContinuousLinearMap
let m (a : βΓβ) : C(CompactJointOverlap,β) := (compactJointMonomial a.1 a.2).toContinuousMap
have hm0 : m 0=1 := by ext x; simp [m]
have hmadd (a b : βΓβ) : m (a+b)=m a*m b := by
ext x
exact congrArg (fun f : CompactJointOverlap βα΅ β => f x) (compactJointMonomial_add _ _ _ _)
let M : Submonoid C(CompactJointOverlap,β) :=
{ carrier := Set.range m
one_mem' := β¨0,hm0β©
mul_mem' := by rintro _ _ β¨a,rflβ© β¨b,rflβ©; exact β¨a+b,hmadd a bβ© }
let A := Algebra.adjoin β (M : Set C(CompactJointOverlap,β))
have hsep : A.SeparatesPoints := by
intro x y hxy
obtain β¨p,d,hpdβ© := compactJointMonomial_separates x y hxy
have hmem : m (p,d) β A :=
Algebra.subset_adjoin (show m (p,d) β M from β¨(p,d),rflβ©)
exact β¨m (p,d),β¨m (p,d),hmem,rflβ©,hpdβ©
have hA : (A : Set C(CompactJointOverlap,β)) β (L'.ker : Set C(CompactJointOverlap,β)) := by
have hspan : Submodule.span β (M : Set C(CompactJointOverlap,β)) β€ L'.ker := by
apply Submodule.span_le.mpr
rintro _ β¨β¨p,dβ©,rflβ©
change L (e ((compactJointMonomial p d).toContinuousMap)) = 0
have he : e ((compactJointMonomial p d).toContinuousMap) = compactJointMonomial p d := by
ext x; rfl
rw [he]
exact hL p d
intro f hf
apply hspan
change f β A.toSubmodule at hf
simpa only [A,Algebra.adjoin_eq_span,Submonoid.closure_eq] using hf
have hclosed := L'.isClosed_ker
have hc := closure_minimal hA hclosed
have htop := ContinuousMap.subalgebra_topologicalClosure_eq_top_of_separatesPoints A hsep
have hall (f : C(CompactJointOverlap,β)) : L' f=0 := by
apply hc
change f β A.topologicalClosure
rw [htop]
trivial
ext g
have h := hall (e.symm g)
simpa [L'] using h
lemma compactGG_of_joint_monomials (ΞΌ : ProbabilityMeasure (CompactArray CompactJointOverlap))
(n : β) (i : Fin n) (f : CompactBlock CompactJointOverlap n βα΅ β)
(h : β p d, compactGGDefect ΞΌ n i f (compactJointMonomial p d)=0)
(g : CompactJointOverlap βα΅ β) : compactGGDefect ΞΌ n i f g=0 := by
have hz := compactJoint_monomials_total (compactGGTestCLM ΞΌ n i f)
(fun p d => (compactGGTestCLM_apply ΞΌ n i f _).trans (h p d))
rw [β compactGGTestCLM_apply,hz]
rfl
end
lemma compactGGDefect_one (ΞΌ : ProbabilityMeasure (CompactArray CompactJointOverlap))
(r : β) (i : Fin r) (G : CompactBlock CompactJointOverlap r βα΅ β) :
compactGGDefect ΞΌ r i G 1=0 := by
have hr : 1β€r := by have := i.isLt; omega
simp only [compactGGDefect,BoundedContinuousFunction.coe_one,Pi.one_apply,mul_one,
integral_const,probReal_univ,smul_eq_mul,Finset.sum_const,Finset.card_erase_of_mem
(Finset.mem_univ i),Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,Nat.cast_sub hr,Nat.cast_one]
ring
variable (k : β) (f : β βα΅ β) (p d : βββ) (z : Fin kββ)
variable (hz : StrictMono z) (hz0 : β i, 0<z i) (hz1 : β i, z i<1)
variable (t : ββββ₯0) (h : ββFin (k+1)ββ)
variable (hh0 : β n l, 0β€h n l) (hh : β n, Monotone (h n))
variable (u : (n : β)βFin (n+1)ββ) (hu : β n, u nβIcc (fun _=>1) (fun _=>2))
variable (hmin : β n, IsMinOn (fun v => quadraticBoxPenalty (sourcePenaltyWeight (n+1)) v-
sourceExpectedPressure n k f (fun j=>p j.val) (fun j=>d j.val) (h n) z (t n) v)
(Icc (fun _ : Fin (n+1)=>1) (fun _=>2)) (u n))
variable {H T : β} (hH : 0β€H) (hhH : β n, h n 0β€H) (ht : β n, (t n:β)β€T)
include hz hz0 hz1 hh0 hh hu hmin hH hhH ht in
lemma source_contact_monomial_tendsto (j r : β) (i : Fin r)
(G : CompactBlock CompactJointOverlap r βα΅ β) :
Tendsto (fun n => compactGGDefect (sourceGibbsArrayLaw n k f (fun a=>p a.val)
(fun a=>d a.val) (h n) (u n) z (t n)) r i G (compactJointMonomial (p j) (d j))) atTop (π 0) := by
let c : β := (2:β)^(-((j+1:β):β€))
have hc : 0<c := by dsimp [c]; positivity
have hN : Tendsto (fun n : β => ((n+1:β):β)) atTop atTop :=
tendsto_natCast_atTop_atTop.comp (tendsto_add_atTop_nat 1)
have he : Tendsto (fun n : β => perturbationScale (n+1)) atTop (π 0) := by
convert (tendsto_rpow_neg_atTop (by norm_num : (0:β)<1/16)).comp hN using 1
simp only [perturbationScale,neg_div]; rfl
have he' : Tendsto (fun n : β => 8*perturbationScale (n+1)^2) atTop (π 0) := by
simpa using (he.pow 2).const_mul 8
have hs : Tendsto (fun n : β => ((n+1:β):β)^(-(1:β)/4)) atTop (π 0) := by
convert (tendsto_rpow_neg_atTop (by norm_num : (0:β)<1/4)).comp hN using 1
simp only [neg_div,Function.comp_def]
apply squeeze_zero_norm' (a := fun n => βGβ/c^2*(Real.sqrt (2*c)*((n+1:β):β)^(-(3:β)/8)+
(c+4*Real.sqrt (enrichedVarianceConstant k z f H T))*((n+1:β):β)^(-(1:β)/8)))
Β· filter_upwards [eventually_ge_atTop j,he'.eventually (gt_mem_nhds (by positivity : (0:β)<c/16)),
hs.eventually (gt_mem_nhds (by norm_num : (0:β)<1/4))] with n hn he hs
have hj : j<n+1 := by omega
simpa only [Real.norm_eq_abs,sourcePenaltyWeight,c] using
source_contact_compact_gg_rate n k f (fun a=>p a.val) (fun a=>d a.val) (h n)
(hh0 n) (hh n) z hz hz0 hz1 (t n) (hu n) (hmin n) β¨j,hjβ© hH (hhH n) (ht n)
he hs.le r i G
Β· exact (contact_gg_rate_tendsto c (enrichedVarianceConstant k z f H T) βGβ c).comp hN
include hz hz0 hz1 hh0 hh hu hmin hH hhH ht in
lemma source_contact_limit_joint_gg
{Ξ½ : ProbabilityMeasure (CompactArray CompactJointOverlap)} {s : βββ} (hs : StrictMono s)
(hlim : Tendsto (fun n=>sourceGibbsArrayLaw (s n) k f (fun a=>p a.val) (fun a=>d a.val)
(h (s n)) (u (s n)) z (t (s n))) atTop (π Ξ½))
(hcover : β a b : β, 1β€a+b β β j, p j=a β§ d j=b)
(r : β) (i : Fin r) (G : CompactBlock CompactJointOverlap r βα΅ β)
(g : CompactJointOverlap βα΅ β) : compactGGDefect Ξ½ r i G g=0 := by
apply compactGG_of_joint_monomials Ξ½ r i G
intro a b
by_cases hab : a+b=0
Β· have ha : a=0 := by omega
have hb : b=0 := by omega
subst a b
simpa only [compactJointMonomial_zero] using compactGGDefect_one Ξ½ r i G
obtain β¨j,hp,hdβ© := hcover a b (by omega)
apply compactGGDefect_limit hlim
simpa only [hp,hd,Function.comp_def] using
(source_contact_monomial_tendsto k f p d z hz hz0 hz1 t h hh0 hh u hu hmin hH hhH ht j r i G).comp hs.tendsto_atTop
end SphericalPerceptronFreeEnergy
end
end OAI
|