Sync from openai/math@faee2cf485a8 (part 15)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lean/OAI/Probability/SKValue/GroundState/GaussianTree.lean +149 -149
- lean/OAI/Probability/SKValue/GroundState/GramSchmidtLimit.lean +182 -182
- lean/OAI/Probability/SKValue/GroundState/GumbelMax.lean +152 -152
- lean/OAI/Probability/SKValue/GroundState/GumbelReplacement.lean +132 -132
- lean/OAI/Probability/SKValue/GroundState/LiteralLower.lean +153 -153
- lean/OAI/Probability/SKValue/GroundState/LogComparison.lean +165 -165
- lean/OAI/Probability/SKValue/GroundState/MainConclusions.lean +32 -32
- lean/OAI/Probability/SKValue/GroundState/PredictableNormalizer.lean +294 -294
- lean/OAI/Probability/SKValue/GroundState/QuadraticSK.lean +199 -199
- lean/OAI/Probability/SKValue/GroundState/RandomColumn.lean +155 -155
- lean/OAI/Probability/SKValue/GroundState/RandomGuerra.lean +178 -178
- lean/OAI/Probability/SKValue/GroundState/RotatedCoefficients.lean +396 -396
- lean/OAI/Probability/SKValue/GroundState/RoundingSpin.lean +126 -126
- lean/OAI/Probability/SKValue/GroundState/StandardGaussian.lean +384 -384
- lean/OAI/Probability/SKValue/GroundState/TreeGuerra.lean +161 -161
- lean/OAI/Probability/SKValue/GroundState/TreeProductLaw.lean +204 -204
- lean/OAI/Probability/SKValue/GroundState/TreeWidths.lean +119 -119
- lean/OAI/Probability/SKValue/GroundState/WeakGuerra.lean +147 -147
- lean/OAI/Probability/SKValue/Main.lean +28 -28
- lean/OAI/Probability/SKValue/Model.lean +165 -165
- lean/OAI/Probability/SKValue/Processes/CrossMesh.lean +153 -153
- lean/OAI/Probability/SKValue/Processes/CrossMeshComparison.lean +90 -90
- lean/OAI/Probability/SKValue/Processes/CrossValueBound.lean +108 -108
- lean/OAI/Probability/SKValue/Processes/CurvatureNonneg.lean +43 -43
- lean/OAI/Probability/SKValue/Processes/DiffusionExistence.lean +84 -84
- lean/OAI/Probability/SKValue/Processes/DiffusionGradientCondExp.lean +143 -143
- lean/OAI/Probability/SKValue/Processes/DiffusionGradientWeakMartingaleLocal.lean +131 -131
- lean/OAI/Probability/SKValue/Processes/EulerL1.lean +202 -202
- lean/OAI/Probability/SKValue/Processes/EulerLimitProcess.lean +128 -128
- lean/OAI/Probability/SKValue/Processes/EulerMemLp.lean +151 -151
- lean/OAI/Probability/SKValue/Processes/Feedback.lean +299 -299
- lean/OAI/Probability/SKValue/Processes/FiniteGaussianFixedStrip.lean +55 -55
- lean/OAI/Probability/SKValue/Processes/FiniteProfileLaw.lean +40 -40
- lean/OAI/Probability/SKValue/Processes/ForcedDiffusion.lean +66 -66
- lean/OAI/Probability/SKValue/Processes/ForcedExpectation.lean +202 -202
- lean/OAI/Probability/SKValue/Processes/GradientSquareIntegral.lean +96 -96
- lean/OAI/Probability/SKValue/Processes/Measurable.lean +147 -147
- lean/OAI/Probability/SKValue/Processes/MeshBrownian.lean +343 -343
- lean/OAI/Probability/SKValue/Processes/MeshMaxError.lean +87 -87
- lean/OAI/Probability/SKValue/Processes/MeshMeanBound.lean +145 -145
- lean/OAI/Probability/SKValue/Processes/MeshRaw.lean +143 -143
- lean/OAI/Probability/SKValue/Processes/StripPaths.lean +78 -78
- lean/OAI/Probability/SKValue/Processes/TerminalCondExp.lean +105 -105
- lean/OAI/Probability/SKValue/Processes/TestDiffusion.lean +57 -57
- lean/OAI/Probability/SKValue/Processes/TestExpectation.lean +191 -191
- lean/OAI/Probability/SKValue/Processes/UnitMomentMartingale.lean +396 -396
- lean/OAI/Probability/SKValue/Processes/ValueEulerOneStep.lean +91 -91
- lean/OAI/Probability/SKValue/Processes/VariableTestLaw.lean +32 -32
- lean/OAI/Probability/SKValue/Processes/Volterra.lean +131 -131
- lean/OAI/Probability/SKValue/Processes/WeightedTerminalExpectation.lean +78 -78
lean/OAI/Probability/SKValue/GroundState/GaussianTree.lean
CHANGED
|
@@ -1,149 +1,149 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.AffineComparison
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
|
| 12 |
-
structure TreeLevel where
|
| 13 |
-
branchExcess : ℕ
|
| 14 |
-
endpoint : ℝ
|
| 15 |
-
height : ℝ
|
| 16 |
-
|
| 17 |
-
abbrev GaussianTree := List TreeLevel
|
| 18 |
-
|
| 19 |
-
abbrev TreeLeaves : GaussianTree → Type
|
| 20 |
-
| [] => PUnit
|
| 21 |
-
| l::T => Fin (l.branchExcess+1) × TreeLeaves T
|
| 22 |
-
|
| 23 |
-
abbrev TreeEdges : GaussianTree → Type
|
| 24 |
-
| [] => PEmpty
|
| 25 |
-
| l::T => Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T)
|
| 26 |
-
|
| 27 |
-
instance treeLeavesFintype (T : GaussianTree) : Fintype (TreeLeaves T) := by
|
| 28 |
-
induction T with
|
| 29 |
-
| nil => exact inferInstanceAs (Fintype PUnit)
|
| 30 |
-
| cons l T ih => exact inferInstanceAs (Fintype (Fin (l.branchExcess+1) × TreeLeaves T))
|
| 31 |
-
instance treeLeavesNonempty (T : GaussianTree) : Nonempty (TreeLeaves T) := by
|
| 32 |
-
induction T with
|
| 33 |
-
| nil => exact inferInstanceAs (Nonempty PUnit)
|
| 34 |
-
| cons l T ih => exact inferInstanceAs (Nonempty (Fin (l.branchExcess+1) × TreeLeaves T))
|
| 35 |
-
instance treeEdgesFintype (T : GaussianTree) : Fintype (TreeEdges T) := by
|
| 36 |
-
induction T with
|
| 37 |
-
| nil => exact inferInstanceAs (Fintype PEmpty)
|
| 38 |
-
| cons l T ih => exact inferInstanceAs (Fintype (Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T)))
|
| 39 |
-
|
| 40 |
-
noncomputable def treePathCoeff (c : ℝ → TreeLevel → ℝ) (q : ℝ) :
|
| 41 |
-
(T : GaussianTree) → TreeLeaves T → TreeEdges T → ℝ
|
| 42 |
-
| [],_,e => PEmpty.elim e
|
| 43 |
-
| l::T,α,e => match e with
|
| 44 |
-
| Sum.inl i => if α.1=i then c q l else 0
|
| 45 |
-
| Sum.inr (i,e) => if α.1=i then treePathCoeff c l.endpoint T α.2 e else 0
|
| 46 |
-
|
| 47 |
-
noncomputable def treeOverlap (q : ℝ) : (T : GaussianTree) → TreeLeaves T → TreeLeaves T → ℝ
|
| 48 |
-
| [],_,_ => q
|
| 49 |
-
| l::T,α,β => if α.1=β.1 then treeOverlap l.endpoint T α.2 β.2 else q
|
| 50 |
-
|
| 51 |
-
def ValidTreeGrid (q : ℝ) : GaussianTree → Prop
|
| 52 |
-
| [] => q=1
|
| 53 |
-
| l::T => q≤l.endpoint ∧ ValidTreeGrid l.endpoint T
|
| 54 |
-
|
| 55 |
-
lemma treePath_inner_node (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 56 |
-
(α β : TreeLeaves (l::T)) :
|
| 57 |
-
(∑ e,treePathCoeff c q (l::T) α e*treePathCoeff c q (l::T) β e)=
|
| 58 |
-
if α.1=β.1 then (c q l)^2+∑ e,treePathCoeff c l.endpoint T α.2 e*treePathCoeff c l.endpoint T β.2 e else 0 := by
|
| 59 |
-
classical
|
| 60 |
-
change (∑ e : Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T),_)=_
|
| 61 |
-
rw [Fintype.sum_sum_type,Fintype.sum_prod_type]
|
| 62 |
-
simp only [treePathCoeff]
|
| 63 |
-
by_cases h : α.1=β.1
|
| 64 |
-
· simp only [h,ite_true]
|
| 65 |
-
simp [←h,ite_mul,mul_ite,sq]
|
| 66 |
-
· simp only [h,ite_false]
|
| 67 |
-
have he (i : Fin (l.branchExcess+1)) : ¬(α.1=i ∧ β.1=i) := by
|
| 68 |
-
rintro ⟨ha,hb⟩; exact h (ha.trans hb.symm)
|
| 69 |
-
simp_rw [ite_mul,zero_mul]
|
| 70 |
-
simp only [mul_ite,mul_zero]
|
| 71 |
-
have hzero (i : Fin (l.branchExcess+1)) (r s : ℝ) :
|
| 72 |
-
(if α.1=i then if β.1=i then r*s else 0 else 0)=0 := by
|
| 73 |
-
split_ifs with ha hb <;> try rfl
|
| 74 |
-
exact (he i ⟨ha,hb⟩).elim
|
| 75 |
-
simp only [hzero,Finset.sum_const_zero,add_zero]
|
| 76 |
-
|
| 77 |
-
noncomputable def treeFieldVector (q : ℝ) (T : GaussianTree) : TreeLeaves T → TreeEdges T → ℝ :=
|
| 78 |
-
treePathCoeff (fun q l ↦ Real.sqrt (l.endpoint-q)) q T
|
| 79 |
-
|
| 80 |
-
noncomputable def treeAuxVector (n : ℕ) (q : ℝ) (T : GaussianTree) : TreeLeaves T → TreeEdges T → ℝ :=
|
| 81 |
-
treePathCoeff (fun q l ↦ Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)) q T
|
| 82 |
-
|
| 83 |
-
lemma treeField_inner (q : ℝ) (T : GaussianTree) (hT : ValidTreeGrid q T)
|
| 84 |
-
(α β : TreeLeaves T) :
|
| 85 |
-
(∑ e,treeFieldVector q T α e*treeFieldVector q T β e)=treeOverlap q T α β-q := by
|
| 86 |
-
induction T generalizing q with
|
| 87 |
-
| nil =>
|
| 88 |
-
simp only [treeFieldVector,treePathCoeff,treeOverlap,sub_self]
|
| 89 |
-
exact Finset.sum_eq_zero (by intro e he; exact PEmpty.elim e)
|
| 90 |
-
| cons l T ih =>
|
| 91 |
-
change q≤l.endpoint ∧ ValidTreeGrid l.endpoint T at hT
|
| 92 |
-
rw [treeFieldVector,treePath_inner_node]
|
| 93 |
-
dsimp [treeOverlap]
|
| 94 |
-
split_ifs with h
|
| 95 |
-
· rw [Real.sq_sqrt (sub_nonneg.mpr hT.1)]
|
| 96 |
-
have hh := ih l.endpoint hT.2 α.2 β.2
|
| 97 |
-
change (l.endpoint-q)+(∑ e,treeFieldVector l.endpoint T α.2 e*treeFieldVector l.endpoint T β.2 e)=_
|
| 98 |
-
rw [hh]; ring
|
| 99 |
-
· ring
|
| 100 |
-
|
| 101 |
-
lemma treeAux_inner (n : ℕ) (q : ℝ) (hq : 0≤q) (T : GaussianTree) (hT : ValidTreeGrid q T)
|
| 102 |
-
(α β : TreeLeaves T) :
|
| 103 |
-
(∑ e,treeAuxVector n q T α e*treeAuxVector n q T β e)=
|
| 104 |
-
((n : ℝ)/2)*((treeOverlap q T α β)^2-q^2) := by
|
| 105 |
-
induction T generalizing q with
|
| 106 |
-
| nil =>
|
| 107 |
-
simp only [treeAuxVector,treePathCoeff,treeOverlap,sub_self,mul_zero]
|
| 108 |
-
exact Finset.sum_eq_zero (by intro e he; exact PEmpty.elim e)
|
| 109 |
-
| cons l T ih =>
|
| 110 |
-
change q≤l.endpoint ∧ ValidTreeGrid l.endpoint T at hT
|
| 111 |
-
rw [treeAuxVector,treePath_inner_node]
|
| 112 |
-
dsimp [treeOverlap]
|
| 113 |
-
split_ifs with h
|
| 114 |
-
· rw [mul_pow,Real.sq_sqrt (by positivity),Real.sq_sqrt (by nlinarith [hT.1])]
|
| 115 |
-
have hh := ih l.endpoint (hq.trans hT.1) hT.2 α.2 β.2
|
| 116 |
-
change ((n : ℝ)/2)*(l.endpoint^2-q^2)+
|
| 117 |
-
(∑ e,treeAuxVector n l.endpoint T α.2 e*treeAuxVector n l.endpoint T β.2 e)=_
|
| 118 |
-
rw [hh]; ring
|
| 119 |
-
· ring
|
| 120 |
-
|
| 121 |
-
lemma treeOverlap_self (q : ℝ) (T : GaussianTree) (hT : ValidTreeGrid q T) (α : TreeLeaves T) :
|
| 122 |
-
treeOverlap q T α α=1 := by
|
| 123 |
-
induction T generalizing q with
|
| 124 |
-
| nil => exact hT
|
| 125 |
-
| cons l T ih => simp only [treeOverlap,ite_true]; exact ih l.endpoint hT.2 α.2
|
| 126 |
-
|
| 127 |
-
lemma treeField_unit (T : GaussianTree) (hT : ValidTreeGrid 0 T) (α : TreeLeaves T) :
|
| 128 |
-
(∑ e,(treeFieldVector 0 T α e)^2)=1 := by
|
| 129 |
-
simp only [sq]
|
| 130 |
-
rw [treeField_inner 0 T hT,treeOverlap_self 0 T hT]
|
| 131 |
-
norm_num
|
| 132 |
-
|
| 133 |
-
lemma treeAux_distance (n : ℕ) (T : GaussianTree) (hT : ValidTreeGrid 0 T)
|
| 134 |
-
(α β : TreeLeaves T) :
|
| 135 |
-
(∑ e,(treeAuxVector n 0 T α e-treeAuxVector n 0 T β e)^2)=
|
| 136 |
-
(n : ℝ)*(1-(treeOverlap 0 T α β)^2) := by
|
| 137 |
-
rw [sq_distance_sum]
|
| 138 |
-
simp only [sq]
|
| 139 |
-
rw [treeAux_inner n 0 (by norm_num) T hT,
|
| 140 |
-
treeAux_inner n 0 (by norm_num) T hT,
|
| 141 |
-
treeAux_inner n 0 (by norm_num) T hT,
|
| 142 |
-
treeOverlap_self 0 T hT,treeOverlap_self 0 T hT]
|
| 143 |
-
ring
|
| 144 |
-
|
| 145 |
-
end SKValueG
|
| 146 |
-
|
| 147 |
-
end
|
| 148 |
-
|
| 149 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.AffineComparison
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
|
| 12 |
+
structure TreeLevel where
|
| 13 |
+
branchExcess : ℕ
|
| 14 |
+
endpoint : ℝ
|
| 15 |
+
height : ℝ
|
| 16 |
+
|
| 17 |
+
abbrev GaussianTree := List TreeLevel
|
| 18 |
+
|
| 19 |
+
abbrev TreeLeaves : GaussianTree → Type
|
| 20 |
+
| [] => PUnit
|
| 21 |
+
| l::T => Fin (l.branchExcess+1) × TreeLeaves T
|
| 22 |
+
|
| 23 |
+
abbrev TreeEdges : GaussianTree → Type
|
| 24 |
+
| [] => PEmpty
|
| 25 |
+
| l::T => Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T)
|
| 26 |
+
|
| 27 |
+
instance treeLeavesFintype (T : GaussianTree) : Fintype (TreeLeaves T) := by
|
| 28 |
+
induction T with
|
| 29 |
+
| nil => exact inferInstanceAs (Fintype PUnit)
|
| 30 |
+
| cons l T ih => exact inferInstanceAs (Fintype (Fin (l.branchExcess+1) × TreeLeaves T))
|
| 31 |
+
instance treeLeavesNonempty (T : GaussianTree) : Nonempty (TreeLeaves T) := by
|
| 32 |
+
induction T with
|
| 33 |
+
| nil => exact inferInstanceAs (Nonempty PUnit)
|
| 34 |
+
| cons l T ih => exact inferInstanceAs (Nonempty (Fin (l.branchExcess+1) × TreeLeaves T))
|
| 35 |
+
instance treeEdgesFintype (T : GaussianTree) : Fintype (TreeEdges T) := by
|
| 36 |
+
induction T with
|
| 37 |
+
| nil => exact inferInstanceAs (Fintype PEmpty)
|
| 38 |
+
| cons l T ih => exact inferInstanceAs (Fintype (Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T)))
|
| 39 |
+
|
| 40 |
+
noncomputable def treePathCoeff (c : ℝ → TreeLevel → ℝ) (q : ℝ) :
|
| 41 |
+
(T : GaussianTree) → TreeLeaves T → TreeEdges T → ℝ
|
| 42 |
+
| [],_,e => PEmpty.elim e
|
| 43 |
+
| l::T,α,e => match e with
|
| 44 |
+
| Sum.inl i => if α.1=i then c q l else 0
|
| 45 |
+
| Sum.inr (i,e) => if α.1=i then treePathCoeff c l.endpoint T α.2 e else 0
|
| 46 |
+
|
| 47 |
+
noncomputable def treeOverlap (q : ℝ) : (T : GaussianTree) → TreeLeaves T → TreeLeaves T → ℝ
|
| 48 |
+
| [],_,_ => q
|
| 49 |
+
| l::T,α,β => if α.1=β.1 then treeOverlap l.endpoint T α.2 β.2 else q
|
| 50 |
+
|
| 51 |
+
def ValidTreeGrid (q : ℝ) : GaussianTree → Prop
|
| 52 |
+
| [] => q=1
|
| 53 |
+
| l::T => q≤l.endpoint ∧ ValidTreeGrid l.endpoint T
|
| 54 |
+
|
| 55 |
+
lemma treePath_inner_node (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 56 |
+
(α β : TreeLeaves (l::T)) :
|
| 57 |
+
(∑ e,treePathCoeff c q (l::T) α e*treePathCoeff c q (l::T) β e)=
|
| 58 |
+
if α.1=β.1 then (c q l)^2+∑ e,treePathCoeff c l.endpoint T α.2 e*treePathCoeff c l.endpoint T β.2 e else 0 := by
|
| 59 |
+
classical
|
| 60 |
+
change (∑ e : Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T),_)=_
|
| 61 |
+
rw [Fintype.sum_sum_type,Fintype.sum_prod_type]
|
| 62 |
+
simp only [treePathCoeff]
|
| 63 |
+
by_cases h : α.1=β.1
|
| 64 |
+
· simp only [h,ite_true]
|
| 65 |
+
simp [←h,ite_mul,mul_ite,sq]
|
| 66 |
+
· simp only [h,ite_false]
|
| 67 |
+
have he (i : Fin (l.branchExcess+1)) : ¬(α.1=i ∧ β.1=i) := by
|
| 68 |
+
rintro ⟨ha,hb⟩; exact h (ha.trans hb.symm)
|
| 69 |
+
simp_rw [ite_mul,zero_mul]
|
| 70 |
+
simp only [mul_ite,mul_zero]
|
| 71 |
+
have hzero (i : Fin (l.branchExcess+1)) (r s : ℝ) :
|
| 72 |
+
(if α.1=i then if β.1=i then r*s else 0 else 0)=0 := by
|
| 73 |
+
split_ifs with ha hb <;> try rfl
|
| 74 |
+
exact (he i ⟨ha,hb⟩).elim
|
| 75 |
+
simp only [hzero,Finset.sum_const_zero,add_zero]
|
| 76 |
+
|
| 77 |
+
noncomputable def treeFieldVector (q : ℝ) (T : GaussianTree) : TreeLeaves T → TreeEdges T → ℝ :=
|
| 78 |
+
treePathCoeff (fun q l ↦ Real.sqrt (l.endpoint-q)) q T
|
| 79 |
+
|
| 80 |
+
noncomputable def treeAuxVector (n : ℕ) (q : ℝ) (T : GaussianTree) : TreeLeaves T → TreeEdges T → ℝ :=
|
| 81 |
+
treePathCoeff (fun q l ↦ Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)) q T
|
| 82 |
+
|
| 83 |
+
lemma treeField_inner (q : ℝ) (T : GaussianTree) (hT : ValidTreeGrid q T)
|
| 84 |
+
(α β : TreeLeaves T) :
|
| 85 |
+
(∑ e,treeFieldVector q T α e*treeFieldVector q T β e)=treeOverlap q T α β-q := by
|
| 86 |
+
induction T generalizing q with
|
| 87 |
+
| nil =>
|
| 88 |
+
simp only [treeFieldVector,treePathCoeff,treeOverlap,sub_self]
|
| 89 |
+
exact Finset.sum_eq_zero (by intro e he; exact PEmpty.elim e)
|
| 90 |
+
| cons l T ih =>
|
| 91 |
+
change q≤l.endpoint ∧ ValidTreeGrid l.endpoint T at hT
|
| 92 |
+
rw [treeFieldVector,treePath_inner_node]
|
| 93 |
+
dsimp [treeOverlap]
|
| 94 |
+
split_ifs with h
|
| 95 |
+
· rw [Real.sq_sqrt (sub_nonneg.mpr hT.1)]
|
| 96 |
+
have hh := ih l.endpoint hT.2 α.2 β.2
|
| 97 |
+
change (l.endpoint-q)+(∑ e,treeFieldVector l.endpoint T α.2 e*treeFieldVector l.endpoint T β.2 e)=_
|
| 98 |
+
rw [hh]; ring
|
| 99 |
+
· ring
|
| 100 |
+
|
| 101 |
+
lemma treeAux_inner (n : ℕ) (q : ℝ) (hq : 0≤q) (T : GaussianTree) (hT : ValidTreeGrid q T)
|
| 102 |
+
(α β : TreeLeaves T) :
|
| 103 |
+
(∑ e,treeAuxVector n q T α e*treeAuxVector n q T β e)=
|
| 104 |
+
((n : ℝ)/2)*((treeOverlap q T α β)^2-q^2) := by
|
| 105 |
+
induction T generalizing q with
|
| 106 |
+
| nil =>
|
| 107 |
+
simp only [treeAuxVector,treePathCoeff,treeOverlap,sub_self,mul_zero]
|
| 108 |
+
exact Finset.sum_eq_zero (by intro e he; exact PEmpty.elim e)
|
| 109 |
+
| cons l T ih =>
|
| 110 |
+
change q≤l.endpoint ∧ ValidTreeGrid l.endpoint T at hT
|
| 111 |
+
rw [treeAuxVector,treePath_inner_node]
|
| 112 |
+
dsimp [treeOverlap]
|
| 113 |
+
split_ifs with h
|
| 114 |
+
· rw [mul_pow,Real.sq_sqrt (by positivity),Real.sq_sqrt (by nlinarith [hT.1])]
|
| 115 |
+
have hh := ih l.endpoint (hq.trans hT.1) hT.2 α.2 β.2
|
| 116 |
+
change ((n : ℝ)/2)*(l.endpoint^2-q^2)+
|
| 117 |
+
(∑ e,treeAuxVector n l.endpoint T α.2 e*treeAuxVector n l.endpoint T β.2 e)=_
|
| 118 |
+
rw [hh]; ring
|
| 119 |
+
· ring
|
| 120 |
+
|
| 121 |
+
lemma treeOverlap_self (q : ℝ) (T : GaussianTree) (hT : ValidTreeGrid q T) (α : TreeLeaves T) :
|
| 122 |
+
treeOverlap q T α α=1 := by
|
| 123 |
+
induction T generalizing q with
|
| 124 |
+
| nil => exact hT
|
| 125 |
+
| cons l T ih => simp only [treeOverlap,ite_true]; exact ih l.endpoint hT.2 α.2
|
| 126 |
+
|
| 127 |
+
lemma treeField_unit (T : GaussianTree) (hT : ValidTreeGrid 0 T) (α : TreeLeaves T) :
|
| 128 |
+
(∑ e,(treeFieldVector 0 T α e)^2)=1 := by
|
| 129 |
+
simp only [sq]
|
| 130 |
+
rw [treeField_inner 0 T hT,treeOverlap_self 0 T hT]
|
| 131 |
+
norm_num
|
| 132 |
+
|
| 133 |
+
lemma treeAux_distance (n : ℕ) (T : GaussianTree) (hT : ValidTreeGrid 0 T)
|
| 134 |
+
(α β : TreeLeaves T) :
|
| 135 |
+
(∑ e,(treeAuxVector n 0 T α e-treeAuxVector n 0 T β e)^2)=
|
| 136 |
+
(n : ℝ)*(1-(treeOverlap 0 T α β)^2) := by
|
| 137 |
+
rw [sq_distance_sum]
|
| 138 |
+
simp only [sq]
|
| 139 |
+
rw [treeAux_inner n 0 (by norm_num) T hT,
|
| 140 |
+
treeAux_inner n 0 (by norm_num) T hT,
|
| 141 |
+
treeAux_inner n 0 (by norm_num) T hT,
|
| 142 |
+
treeOverlap_self 0 T hT,treeOverlap_self 0 T hT]
|
| 143 |
+
ring
|
| 144 |
+
|
| 145 |
+
end SKValueG
|
| 146 |
+
|
| 147 |
+
end
|
| 148 |
+
|
| 149 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/GramSchmidtLimit.lean
CHANGED
|
@@ -1,182 +1,182 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.GaussianColumn
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open Filter Set InnerProductSpace
|
| 9 |
-
open scoped Topology BigOperators RealInnerProductSpace
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
variable {E : ℕ → Type*} [∀ n, NormedAddCommGroup (E n)] [∀ n, InnerProductSpace ℝ (E n)]
|
| 12 |
-
|
| 13 |
-
lemma inner_approx_tendsto {x x' y : (n : ℕ) → E n} {a b : ℝ}
|
| 14 |
-
(hx : Tendsto (fun n ↦ ‖x n-x' n‖) atTop (
|
| 15 |
-
(hy : Tendsto (fun n ↦ ‖y n‖) atTop (𝓝 b))
|
| 16 |
-
(hxy : Tendsto (fun n ↦ ⟪x' n,y n⟫) atTop (𝓝 a)) :
|
| 17 |
-
Tendsto (fun n ↦ ⟪x n,y n⟫) atTop (𝓝 a) := by
|
| 18 |
-
have hdiff : Tendsto (fun n ↦ ⟪x n,y n⟫-⟪x' n,y n⟫) atTop (𝓝 0) := by
|
| 19 |
-
apply squeeze_zero_norm (fun n ↦ ?_) (by simpa using hx.mul hy)
|
| 20 |
-
rw [←inner_sub_left,Real.norm_eq_abs]
|
| 21 |
-
exact abs_real_inner_le_norm _ _
|
| 22 |
-
simpa only [sub_add_cancel,zero_add] using hdiff.add hxy
|
| 23 |
-
|
| 24 |
-
omit [∀ n, InnerProductSpace ℝ (E n)] in
|
| 25 |
-
lemma norm_approx_tendsto {x x' : (n : ℕ) → E n} {a : ℝ}
|
| 26 |
-
(hx : Tendsto (fun n ↦ ‖x n-x' n‖) atTop (𝓝 0))
|
| 27 |
-
(hx' : Tendsto (fun n ↦ ‖x' n‖) atTop (𝓝 a)) :
|
| 28 |
-
Tendsto (fun n ↦ ‖x n‖) atTop (𝓝 a) := by
|
| 29 |
-
have hd : Tendsto (fun n ↦ ‖x n‖-‖x' n‖) atTop (𝓝 0) := by
|
| 30 |
-
exact squeeze_zero_norm (fun n ↦ by simpa only [Real.norm_eq_abs] using abs_norm_sub_norm_le (x n) (x' n)) hx
|
| 31 |
-
simpa only [sub_add_cancel,zero_add] using hd.add hx'
|
| 32 |
-
|
| 33 |
-
theorem gramSchmidt_approx (a : (n : ℕ) → ℕ → E n) (K : ℕ)
|
| 34 |
-
(hn : ∀ i≤K,Tendsto (fun n ↦ ‖a n i‖) atTop (𝓝 1))
|
| 35 |
-
(hi : ∀ i j,i<j → j≤K → Tendsto (fun n ↦ ⟪a n i,a n j⟫) atTop (𝓝 0))
|
| 36 |
-
(j : ℕ) (hj : j≤K) :
|
| 37 |
-
Tendsto (fun n ↦ ‖gramSchmidt ℝ (a n) j-a n j‖) atTop (𝓝 0) := by
|
| 38 |
-
induction j using Nat.strong_induction_on with
|
| 39 |
-
| h j ih =>
|
| 40 |
-
have hnorm (i : ℕ) (hij : i<j) :
|
| 41 |
-
Tendsto (fun n ↦ ‖gramSchmidt ℝ (a n) i‖) atTop (𝓝 1) :=
|
| 42 |
-
norm_approx_tendsto (ih i hij (hij.le.trans hj)) (hn i (hij.le.trans hj))
|
| 43 |
-
have hinner (i : ℕ) (hij : i<j) :
|
| 44 |
-
Tendsto (fun n ↦ ⟪gramSchmidt ℝ (a n) i,a n j⟫) atTop (𝓝 0) :=
|
| 45 |
-
inner_approx_tendsto (ih i hij (hij.le.trans hj)) (hn j hj) (hi i j hij hj)
|
| 46 |
-
have hterm (i : ℕ) (hij : i<j) :
|
| 47 |
-
Tendsto (fun n ↦ ‖(⟪gramSchmidt ℝ (a n) i,a n j⟫ /
|
| 48 |
-
‖gramSchmidt ℝ (a n) i‖^2) • gramSchmidt ℝ (a n) i‖) atTop (𝓝 0) := by
|
| 49 |
-
simp only [norm_smul,Real.norm_eq_abs]
|
| 50 |
-
have h := ((hinner i hij).div ((hnorm i hij).pow 2) (by norm_num)).abs.mul (hnorm i hij)
|
| 51 |
-
simpa using h
|
| 52 |
-
have hs : Tendsto (fun n ↦ ∑ i∈Finset.range j,
|
| 53 |
-
‖(⟪gramSchmidt ℝ (a n) i,a n j⟫/‖gramSchmidt ℝ (a n) i‖^2) •
|
| 54 |
-
gramSchmidt ℝ (a n) i‖) atTop (𝓝 0) := by
|
| 55 |
-
simpa only [Finset.sum_const_zero] using tendsto_finsetSum (Finset.range j)
|
| 56 |
-
(fun i hi ↦ hterm i (Finset.mem_range.mp hi))
|
| 57 |
-
apply squeeze_zero (fun n ↦ norm_nonneg _) (fun n ↦ ?_) hs
|
| 58 |
-
have he := gramSchmidt_def'' ℝ (a n) j
|
| 59 |
-
have he' : gramSchmidt ℝ (a n) j-a n j =
|
| 60 |
-
-(∑ i∈Finset.range j,(⟪gramSchmidt ℝ (a n) i,a n j⟫ /
|
| 61 |
-
‖gramSchmidt ℝ (a n) i‖^2) • gramSchmidt ℝ (a n) i) := by
|
| 62 |
-
simp only [Nat.Iio_eq_range] at he
|
| 63 |
-
calc
|
| 64 |
-
_ = gramSchmidt ℝ (a n) j-(gramSchmidt ℝ (a n) j+_) := congrArg (fun x ↦ gramSchmidt ℝ (a n) j-x) he
|
| 65 |
-
_ = _ := by abel
|
| 66 |
-
rw [he',norm_neg]
|
| 67 |
-
exact norm_sum_le _ _
|
| 68 |
-
|
| 69 |
-
theorem gramSchmidtNormed_approx (a : (n : ℕ) → ℕ → E n) (K : ℕ)
|
| 70 |
-
(hn : ∀ i≤K,Tendsto (fun n ↦ ‖a n i‖) atTop (𝓝 1))
|
| 71 |
-
(hi : ∀ i j,i<j → j≤K → Tendsto (fun n ↦ ⟪a n i,a n j⟫) atTop (𝓝 0))
|
| 72 |
-
(j : ℕ) (hj : j≤K) :
|
| 73 |
-
Tendsto (fun n ↦ ‖gramSchmidtNormed ℝ (a n) j-a n j‖) atTop (𝓝 0) := by
|
| 74 |
-
have hg := gramSchmidt_approx a K hn hi j hj
|
| 75 |
-
have hgn := norm_approx_tendsto hg (hn j hj)
|
| 76 |
-
have hscale : Tendsto (fun n ↦ |‖gramSchmidt ℝ (a n) j‖⁻¹-1| *
|
| 77 |
-
‖gramSchmidt ℝ (a n) j‖) atTop (𝓝 0) := by
|
| 78 |
-
simpa using ((hgn.inv₀ (by norm_num)).sub_const 1).abs.mul hgn
|
| 79 |
-
apply squeeze_zero (fun n ↦ norm_nonneg _) (fun n ↦ ?_) (by simpa using hscale.add hg)
|
| 80 |
-
calc
|
| 81 |
-
_ ≤ ‖gramSchmidtNormed ℝ (a n) j-gramSchmidt ℝ (a n) j‖+
|
| 82 |
-
‖gramSchmidt ℝ (a n) j-a n j‖ := by
|
| 83 |
-
calc
|
| 84 |
-
_ = ‖(gramSchmidtNormed ℝ (a n) j-gramSchmidt ℝ (a n) j)+(gramSchmidt ℝ (a n) j-a n j)‖ := by congr 1; abel
|
| 85 |
-
_ ≤ _ := norm_add_le _ _
|
| 86 |
-
_ = _ := by
|
| 87 |
-
congr 1
|
| 88 |
-
change ‖‖gramSchmidt ℝ (a n) j‖⁻¹ • gramSchmidt ℝ (a n) j-gramSchmidt ℝ (a n) j‖ = _
|
| 89 |
-
have he : ‖gramSchmidt ℝ (a n) j‖⁻¹ • gramSchmidt ℝ (a n) j-gramSchmidt ℝ (a n) j =
|
| 90 |
-
(‖gramSchmidt ℝ (a n) j‖⁻¹-1) • gramSchmidt ℝ (a n) j := by rw [sub_smul,one_smul]
|
| 91 |
-
rw [he,norm_smul,Real.norm_eq_abs]
|
| 92 |
-
|
| 93 |
-
end SKValueG
|
| 94 |
-
|
| 95 |
-
end
|
| 96 |
-
|
| 97 |
-
section
|
| 98 |
-
|
| 99 |
-
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 100 |
-
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 101 |
-
namespace SKValueG
|
| 102 |
-
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
|
| 103 |
-
|
| 104 |
-
noncomputable def orthogonalRemainder (v : ℕ → E) (w : E) (j : ℕ) : E :=
|
| 105 |
-
w-∑ i∈Finset.range j,(⟪v i,w⟫ : ℝ) • v i
|
| 106 |
-
|
| 107 |
-
lemma inner_orthogonalRemainder (v : ℕ → E) (w : E) (j : ℕ)
|
| 108 |
-
(ho : ∀ i<j,⟪v j,v i⟫=0) :
|
| 109 |
-
⟪v j,orthogonalRemainder v w j⟫=⟪v j,w⟫ := by
|
| 110 |
-
simp only [orthogonalRemainder,inner_sub_right,inner_sum,real_inner_smul_right]
|
| 111 |
-
have hz : (∑ i∈Finset.range j,⟪v i,w⟫*⟪v j,v i⟫)=0 := by
|
| 112 |
-
apply Finset.sum_eq_zero
|
| 113 |
-
intro i hi
|
| 114 |
-
simp [ho i (Finset.mem_range.mp hi)]
|
| 115 |
-
rw [hz,sub_zero]
|
| 116 |
-
|
| 117 |
-
lemma orthogonalRemainder_succ (v : ℕ → E) (w : E) (j : ℕ) :
|
| 118 |
-
orthogonalRemainder v w (j+1)=orthogonalRemainder v w j-⟪v j,w⟫ • v j := by
|
| 119 |
-
simp only [orthogonalRemainder,Finset.sum_range_succ]
|
| 120 |
-
abel
|
| 121 |
-
|
| 122 |
-
lemma columnResidual_orthogonalRemainder {κ : Type*} [Fintype κ]
|
| 123 |
-
(v : ℕ → EuclideanSpace ℝ κ) (w : EuclideanSpace ℝ κ) (j : ℕ)
|
| 124 |
-
(ho : ∀ i<j,⟪v j,v i⟫=0) :
|
| 125 |
-
columnResidual (v j) (orthogonalRemainder v w j)=orthogonalRemainder v w (j+1) := by
|
| 126 |
-
rw [columnResidual,inner_orthogonalRemainder v w j ho,orthogonalRemainder_succ]
|
| 127 |
-
|
| 128 |
-
lemma column_revealed_energy {κ : Type*} [Fintype κ]
|
| 129 |
-
(v : ℕ → EuclideanSpace ℝ κ) (w z : EuclideanSpace ℝ κ) (j : ℕ)
|
| 130 |
-
(ho : ∀ i<j,⟪v j,v i⟫=0) :
|
| 131 |
-
⟪columnVector (v j) (orthogonalRemainder v w j),z⟫=
|
| 132 |
-
⟪v j,w⟫*⟪orthogonalRemainder v w (j+1),z⟫+
|
| 133 |
-
(⟪v j,w⟫^2/Real.sqrt 2)*⟪v j,z⟫ := by
|
| 134 |
-
simp only [columnVector,inner_add_left,real_inner_smul_left]
|
| 135 |
-
rw [inner_orthogonalRemainder v w j ho,columnResidual_orthogonalRemainder v w j ho]
|
| 136 |
-
|
| 137 |
-
section Limit
|
| 138 |
-
variable {E' : ℕ → Type*} [∀ n,NormedAddCommGroup (E' n)] [∀ n,InnerProductSpace ℝ (E' n)]
|
| 139 |
-
|
| 140 |
-
lemma orthogonalRemainder_inner_tendsto (v : (n : ℕ) → ℕ → E' n)
|
| 141 |
-
(w z : (n : ℕ) → E' n) (K : ℕ) (A : ℕ → ℝ) (B : ℝ)
|
| 142 |
-
(ha : ∀ j<K,Tendsto (fun n ↦ ⟪v n j,w n⟫) atTop (𝓝 (A j)))
|
| 143 |
-
(hz : ∀ j<K,Tendsto (fun n ↦ ⟪v n j,z n⟫) atTop (𝓝 0))
|
| 144 |
-
(hwz : Tendsto (fun n ↦ ⟪w n,z n⟫) atTop (𝓝 B)) :
|
| 145 |
-
Tendsto (fun n ↦ ⟪orthogonalRemainder (v n) (w n) K,z n⟫) atTop (𝓝 B) := by
|
| 146 |
-
have hs : Tendsto (fun n ↦ ∑ j∈Finset.range K,⟪v n j,w n⟫*⟪v n j,z n⟫) atTop (𝓝 0) := by
|
| 147 |
-
have hh := tendsto_finsetSum (s:=Finset.range K)
|
| 148 |
-
(fun j hj ↦ (ha j (Finset.mem_range.mp hj)).mul (hz j (Finset.mem_range.mp hj)))
|
| 149 |
-
simpa using hh
|
| 150 |
-
have ht := hwz.sub hs
|
| 151 |
-
simpa only [orthogonalRemainder,inner_sub_left,sum_inner,real_inner_smul_left,sub_zero] using ht
|
| 152 |
-
|
| 153 |
-
theorem normalized_column_energy_tendsto (a : (n : ℕ) → ℕ → E' n)
|
| 154 |
-
(w z : (n : ℕ) → E' n) (K : ℕ) (A : ℕ → ℝ) (B : ℝ)
|
| 155 |
-
(hn : ∀ i≤K,Tendsto (fun n ↦ ‖a n i‖) atTop (𝓝 1))
|
| 156 |
-
(hi : ∀ i j,i<j → j≤K → Tendsto (fun n ↦ ⟪a n i,a n j⟫) atTop (𝓝 0))
|
| 157 |
-
(hwn : Tendsto (fun n ↦ ‖w n‖) atTop (𝓝 1))
|
| 158 |
-
(hzn : Tendsto (fun n ↦ ‖z n‖) atTop (𝓝 1))
|
| 159 |
-
(ha : ∀ j≤K,Tendsto (fun n ↦ ⟪a n j,w n⟫) atTop (𝓝 (A j)))
|
| 160 |
-
(hz : ∀ j≤K,Tendsto (fun n ↦ ⟪a n j,z n⟫) atTop (𝓝 0))
|
| 161 |
-
(hb : Tendsto (fun n ↦ ⟪w n,z n⟫) atTop (𝓝 B)) :
|
| 162 |
-
Tendsto (fun n ↦
|
| 163 |
-
⟪gramSchmidtNormed ℝ (a n) K,w n⟫*
|
| 164 |
-
⟪orthogonalRemainder (gramSchmidtNormed ℝ (a n)) (w n) (K+1),z n⟫+
|
| 165 |
-
(⟪gramSchmidtNormed ℝ (a n) K,w n⟫^2/Real.sqrt 2)*
|
| 166 |
-
⟪gramSchmidtNormed ℝ (a n) K,z n⟫) atTop (𝓝 (A K*B)) := by
|
| 167 |
-
have hp (j : ℕ) (hj : j≤K) :
|
| 168 |
-
Tendsto (fun n ↦ ‖gramSchmidtNormed ℝ (a n) j-a n j‖) atTop (𝓝 0) :=
|
| 169 |
-
gramSchmidtNormed_approx a j (fun i h ↦ hn i (h.trans hj))
|
| 170 |
-
(fun i l hil hl ↦ hi i l hil (hl.trans hj)) j le_rfl
|
| 171 |
-
have ha' (j : ℕ) (hj : j≤K) := inner_approx_tendsto (hp j hj) hwn (ha j hj)
|
| 172 |
-
have hz' (j : ℕ) (hj : j≤K) := inner_approx_tendsto (hp j hj) hzn (hz j hj)
|
| 173 |
-
have hr := orthogonalRemainder_inner_tendsto (fun n ↦ gramSchmidtNormed ℝ (a n)) w z
|
| 174 |
-
(K+1) A B (fun j hj ↦ ha' j (by omega)) (fun j hj ↦ hz' j (by omega)) hb
|
| 175 |
-
simpa only [mul_zero,add_zero] using
|
| 176 |
-
((ha' K le_rfl).mul hr).add (((ha' K le_rfl).pow 2 |>.div_const _).mul (hz' K le_rfl))
|
| 177 |
-
end Limit
|
| 178 |
-
end SKValueG
|
| 179 |
-
|
| 180 |
-
end
|
| 181 |
-
|
| 182 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.GaussianColumn
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open Filter Set InnerProductSpace
|
| 9 |
+
open scoped Topology BigOperators RealInnerProductSpace
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
variable {E : ℕ → Type*} [∀ n, NormedAddCommGroup (E n)] [∀ n, InnerProductSpace ℝ (E n)]
|
| 12 |
+
|
| 13 |
+
lemma inner_approx_tendsto {x x' y : (n : ℕ) → E n} {a b : ℝ}
|
| 14 |
+
(hx : Tendsto (fun n ↦ ‖x n-x' n‖) atTop (��� 0))
|
| 15 |
+
(hy : Tendsto (fun n ↦ ‖y n‖) atTop (𝓝 b))
|
| 16 |
+
(hxy : Tendsto (fun n ↦ ⟪x' n,y n⟫) atTop (𝓝 a)) :
|
| 17 |
+
Tendsto (fun n ↦ ⟪x n,y n⟫) atTop (𝓝 a) := by
|
| 18 |
+
have hdiff : Tendsto (fun n ↦ ⟪x n,y n⟫-⟪x' n,y n⟫) atTop (𝓝 0) := by
|
| 19 |
+
apply squeeze_zero_norm (fun n ↦ ?_) (by simpa using hx.mul hy)
|
| 20 |
+
rw [←inner_sub_left,Real.norm_eq_abs]
|
| 21 |
+
exact abs_real_inner_le_norm _ _
|
| 22 |
+
simpa only [sub_add_cancel,zero_add] using hdiff.add hxy
|
| 23 |
+
|
| 24 |
+
omit [∀ n, InnerProductSpace ℝ (E n)] in
|
| 25 |
+
lemma norm_approx_tendsto {x x' : (n : ℕ) → E n} {a : ℝ}
|
| 26 |
+
(hx : Tendsto (fun n ↦ ‖x n-x' n‖) atTop (𝓝 0))
|
| 27 |
+
(hx' : Tendsto (fun n ↦ ‖x' n‖) atTop (𝓝 a)) :
|
| 28 |
+
Tendsto (fun n ↦ ‖x n‖) atTop (𝓝 a) := by
|
| 29 |
+
have hd : Tendsto (fun n ↦ ‖x n‖-‖x' n‖) atTop (𝓝 0) := by
|
| 30 |
+
exact squeeze_zero_norm (fun n ↦ by simpa only [Real.norm_eq_abs] using abs_norm_sub_norm_le (x n) (x' n)) hx
|
| 31 |
+
simpa only [sub_add_cancel,zero_add] using hd.add hx'
|
| 32 |
+
|
| 33 |
+
theorem gramSchmidt_approx (a : (n : ℕ) → ℕ → E n) (K : ℕ)
|
| 34 |
+
(hn : ∀ i≤K,Tendsto (fun n ↦ ‖a n i‖) atTop (𝓝 1))
|
| 35 |
+
(hi : ∀ i j,i<j → j≤K → Tendsto (fun n ↦ ⟪a n i,a n j⟫) atTop (𝓝 0))
|
| 36 |
+
(j : ℕ) (hj : j≤K) :
|
| 37 |
+
Tendsto (fun n ↦ ‖gramSchmidt ℝ (a n) j-a n j‖) atTop (𝓝 0) := by
|
| 38 |
+
induction j using Nat.strong_induction_on with
|
| 39 |
+
| h j ih =>
|
| 40 |
+
have hnorm (i : ℕ) (hij : i<j) :
|
| 41 |
+
Tendsto (fun n ↦ ‖gramSchmidt ℝ (a n) i‖) atTop (𝓝 1) :=
|
| 42 |
+
norm_approx_tendsto (ih i hij (hij.le.trans hj)) (hn i (hij.le.trans hj))
|
| 43 |
+
have hinner (i : ℕ) (hij : i<j) :
|
| 44 |
+
Tendsto (fun n ↦ ⟪gramSchmidt ℝ (a n) i,a n j⟫) atTop (𝓝 0) :=
|
| 45 |
+
inner_approx_tendsto (ih i hij (hij.le.trans hj)) (hn j hj) (hi i j hij hj)
|
| 46 |
+
have hterm (i : ℕ) (hij : i<j) :
|
| 47 |
+
Tendsto (fun n ↦ ‖(⟪gramSchmidt ℝ (a n) i,a n j⟫ /
|
| 48 |
+
‖gramSchmidt ℝ (a n) i‖^2) • gramSchmidt ℝ (a n) i‖) atTop (𝓝 0) := by
|
| 49 |
+
simp only [norm_smul,Real.norm_eq_abs]
|
| 50 |
+
have h := ((hinner i hij).div ((hnorm i hij).pow 2) (by norm_num)).abs.mul (hnorm i hij)
|
| 51 |
+
simpa using h
|
| 52 |
+
have hs : Tendsto (fun n ↦ ∑ i∈Finset.range j,
|
| 53 |
+
‖(⟪gramSchmidt ℝ (a n) i,a n j⟫/‖gramSchmidt ℝ (a n) i‖^2) •
|
| 54 |
+
gramSchmidt ℝ (a n) i‖) atTop (𝓝 0) := by
|
| 55 |
+
simpa only [Finset.sum_const_zero] using tendsto_finsetSum (Finset.range j)
|
| 56 |
+
(fun i hi ↦ hterm i (Finset.mem_range.mp hi))
|
| 57 |
+
apply squeeze_zero (fun n ↦ norm_nonneg _) (fun n ↦ ?_) hs
|
| 58 |
+
have he := gramSchmidt_def'' ℝ (a n) j
|
| 59 |
+
have he' : gramSchmidt ℝ (a n) j-a n j =
|
| 60 |
+
-(∑ i∈Finset.range j,(⟪gramSchmidt ℝ (a n) i,a n j⟫ /
|
| 61 |
+
‖gramSchmidt ℝ (a n) i‖^2) • gramSchmidt ℝ (a n) i) := by
|
| 62 |
+
simp only [Nat.Iio_eq_range] at he
|
| 63 |
+
calc
|
| 64 |
+
_ = gramSchmidt ℝ (a n) j-(gramSchmidt ℝ (a n) j+_) := congrArg (fun x ↦ gramSchmidt ℝ (a n) j-x) he
|
| 65 |
+
_ = _ := by abel
|
| 66 |
+
rw [he',norm_neg]
|
| 67 |
+
exact norm_sum_le _ _
|
| 68 |
+
|
| 69 |
+
theorem gramSchmidtNormed_approx (a : (n : ℕ) → ℕ → E n) (K : ℕ)
|
| 70 |
+
(hn : ∀ i≤K,Tendsto (fun n ↦ ‖a n i‖) atTop (𝓝 1))
|
| 71 |
+
(hi : ∀ i j,i<j → j≤K → Tendsto (fun n ↦ ⟪a n i,a n j⟫) atTop (𝓝 0))
|
| 72 |
+
(j : ℕ) (hj : j≤K) :
|
| 73 |
+
Tendsto (fun n ↦ ‖gramSchmidtNormed ℝ (a n) j-a n j‖) atTop (𝓝 0) := by
|
| 74 |
+
have hg := gramSchmidt_approx a K hn hi j hj
|
| 75 |
+
have hgn := norm_approx_tendsto hg (hn j hj)
|
| 76 |
+
have hscale : Tendsto (fun n ↦ |‖gramSchmidt ℝ (a n) j‖⁻¹-1| *
|
| 77 |
+
‖gramSchmidt ℝ (a n) j‖) atTop (𝓝 0) := by
|
| 78 |
+
simpa using ((hgn.inv₀ (by norm_num)).sub_const 1).abs.mul hgn
|
| 79 |
+
apply squeeze_zero (fun n ↦ norm_nonneg _) (fun n ↦ ?_) (by simpa using hscale.add hg)
|
| 80 |
+
calc
|
| 81 |
+
_ ≤ ‖gramSchmidtNormed ℝ (a n) j-gramSchmidt ℝ (a n) j‖+
|
| 82 |
+
‖gramSchmidt ℝ (a n) j-a n j‖ := by
|
| 83 |
+
calc
|
| 84 |
+
_ = ‖(gramSchmidtNormed ℝ (a n) j-gramSchmidt ℝ (a n) j)+(gramSchmidt ℝ (a n) j-a n j)‖ := by congr 1; abel
|
| 85 |
+
_ ≤ _ := norm_add_le _ _
|
| 86 |
+
_ = _ := by
|
| 87 |
+
congr 1
|
| 88 |
+
change ‖‖gramSchmidt ℝ (a n) j‖⁻¹ • gramSchmidt ℝ (a n) j-gramSchmidt ℝ (a n) j‖ = _
|
| 89 |
+
have he : ‖gramSchmidt ℝ (a n) j‖⁻¹ • gramSchmidt ℝ (a n) j-gramSchmidt ℝ (a n) j =
|
| 90 |
+
(‖gramSchmidt ℝ (a n) j‖⁻¹-1) • gramSchmidt ℝ (a n) j := by rw [sub_smul,one_smul]
|
| 91 |
+
rw [he,norm_smul,Real.norm_eq_abs]
|
| 92 |
+
|
| 93 |
+
end SKValueG
|
| 94 |
+
|
| 95 |
+
end
|
| 96 |
+
|
| 97 |
+
section
|
| 98 |
+
|
| 99 |
+
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 100 |
+
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 101 |
+
namespace SKValueG
|
| 102 |
+
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
|
| 103 |
+
|
| 104 |
+
noncomputable def orthogonalRemainder (v : ℕ → E) (w : E) (j : ℕ) : E :=
|
| 105 |
+
w-∑ i∈Finset.range j,(⟪v i,w⟫ : ℝ) • v i
|
| 106 |
+
|
| 107 |
+
lemma inner_orthogonalRemainder (v : ℕ → E) (w : E) (j : ℕ)
|
| 108 |
+
(ho : ∀ i<j,⟪v j,v i⟫=0) :
|
| 109 |
+
⟪v j,orthogonalRemainder v w j⟫=⟪v j,w⟫ := by
|
| 110 |
+
simp only [orthogonalRemainder,inner_sub_right,inner_sum,real_inner_smul_right]
|
| 111 |
+
have hz : (∑ i∈Finset.range j,⟪v i,w⟫*⟪v j,v i⟫)=0 := by
|
| 112 |
+
apply Finset.sum_eq_zero
|
| 113 |
+
intro i hi
|
| 114 |
+
simp [ho i (Finset.mem_range.mp hi)]
|
| 115 |
+
rw [hz,sub_zero]
|
| 116 |
+
|
| 117 |
+
lemma orthogonalRemainder_succ (v : ℕ → E) (w : E) (j : ℕ) :
|
| 118 |
+
orthogonalRemainder v w (j+1)=orthogonalRemainder v w j-⟪v j,w⟫ • v j := by
|
| 119 |
+
simp only [orthogonalRemainder,Finset.sum_range_succ]
|
| 120 |
+
abel
|
| 121 |
+
|
| 122 |
+
lemma columnResidual_orthogonalRemainder {κ : Type*} [Fintype κ]
|
| 123 |
+
(v : ℕ → EuclideanSpace ℝ κ) (w : EuclideanSpace ℝ κ) (j : ℕ)
|
| 124 |
+
(ho : ∀ i<j,⟪v j,v i⟫=0) :
|
| 125 |
+
columnResidual (v j) (orthogonalRemainder v w j)=orthogonalRemainder v w (j+1) := by
|
| 126 |
+
rw [columnResidual,inner_orthogonalRemainder v w j ho,orthogonalRemainder_succ]
|
| 127 |
+
|
| 128 |
+
lemma column_revealed_energy {κ : Type*} [Fintype κ]
|
| 129 |
+
(v : ℕ → EuclideanSpace ℝ κ) (w z : EuclideanSpace ℝ κ) (j : ℕ)
|
| 130 |
+
(ho : ∀ i<j,⟪v j,v i⟫=0) :
|
| 131 |
+
⟪columnVector (v j) (orthogonalRemainder v w j),z⟫=
|
| 132 |
+
⟪v j,w⟫*⟪orthogonalRemainder v w (j+1),z⟫+
|
| 133 |
+
(⟪v j,w⟫^2/Real.sqrt 2)*⟪v j,z⟫ := by
|
| 134 |
+
simp only [columnVector,inner_add_left,real_inner_smul_left]
|
| 135 |
+
rw [inner_orthogonalRemainder v w j ho,columnResidual_orthogonalRemainder v w j ho]
|
| 136 |
+
|
| 137 |
+
section Limit
|
| 138 |
+
variable {E' : ℕ → Type*} [∀ n,NormedAddCommGroup (E' n)] [∀ n,InnerProductSpace ℝ (E' n)]
|
| 139 |
+
|
| 140 |
+
lemma orthogonalRemainder_inner_tendsto (v : (n : ℕ) → ℕ → E' n)
|
| 141 |
+
(w z : (n : ℕ) → E' n) (K : ℕ) (A : ℕ → ℝ) (B : ℝ)
|
| 142 |
+
(ha : ∀ j<K,Tendsto (fun n ↦ ⟪v n j,w n⟫) atTop (𝓝 (A j)))
|
| 143 |
+
(hz : ∀ j<K,Tendsto (fun n ↦ ⟪v n j,z n⟫) atTop (𝓝 0))
|
| 144 |
+
(hwz : Tendsto (fun n ↦ ⟪w n,z n⟫) atTop (𝓝 B)) :
|
| 145 |
+
Tendsto (fun n ↦ ⟪orthogonalRemainder (v n) (w n) K,z n⟫) atTop (𝓝 B) := by
|
| 146 |
+
have hs : Tendsto (fun n ↦ ∑ j∈Finset.range K,⟪v n j,w n⟫*⟪v n j,z n⟫) atTop (𝓝 0) := by
|
| 147 |
+
have hh := tendsto_finsetSum (s:=Finset.range K)
|
| 148 |
+
(fun j hj ↦ (ha j (Finset.mem_range.mp hj)).mul (hz j (Finset.mem_range.mp hj)))
|
| 149 |
+
simpa using hh
|
| 150 |
+
have ht := hwz.sub hs
|
| 151 |
+
simpa only [orthogonalRemainder,inner_sub_left,sum_inner,real_inner_smul_left,sub_zero] using ht
|
| 152 |
+
|
| 153 |
+
theorem normalized_column_energy_tendsto (a : (n : ℕ) → ℕ → E' n)
|
| 154 |
+
(w z : (n : ℕ) → E' n) (K : ℕ) (A : ℕ → ℝ) (B : ℝ)
|
| 155 |
+
(hn : ∀ i≤K,Tendsto (fun n ↦ ‖a n i‖) atTop (𝓝 1))
|
| 156 |
+
(hi : ∀ i j,i<j → j≤K → Tendsto (fun n ↦ ⟪a n i,a n j⟫) atTop (𝓝 0))
|
| 157 |
+
(hwn : Tendsto (fun n ↦ ‖w n‖) atTop (𝓝 1))
|
| 158 |
+
(hzn : Tendsto (fun n ↦ ‖z n‖) atTop (𝓝 1))
|
| 159 |
+
(ha : ∀ j≤K,Tendsto (fun n ↦ ⟪a n j,w n⟫) atTop (𝓝 (A j)))
|
| 160 |
+
(hz : ∀ j≤K,Tendsto (fun n ↦ ⟪a n j,z n⟫) atTop (𝓝 0))
|
| 161 |
+
(hb : Tendsto (fun n ↦ ⟪w n,z n⟫) atTop (𝓝 B)) :
|
| 162 |
+
Tendsto (fun n ↦
|
| 163 |
+
⟪gramSchmidtNormed ℝ (a n) K,w n⟫*
|
| 164 |
+
⟪orthogonalRemainder (gramSchmidtNormed ℝ (a n)) (w n) (K+1),z n⟫+
|
| 165 |
+
(⟪gramSchmidtNormed ℝ (a n) K,w n⟫^2/Real.sqrt 2)*
|
| 166 |
+
⟪gramSchmidtNormed ℝ (a n) K,z n⟫) atTop (𝓝 (A K*B)) := by
|
| 167 |
+
have hp (j : ℕ) (hj : j≤K) :
|
| 168 |
+
Tendsto (fun n ↦ ‖gramSchmidtNormed ℝ (a n) j-a n j‖) atTop (𝓝 0) :=
|
| 169 |
+
gramSchmidtNormed_approx a j (fun i h ↦ hn i (h.trans hj))
|
| 170 |
+
(fun i l hil hl ↦ hi i l hil (hl.trans hj)) j le_rfl
|
| 171 |
+
have ha' (j : ℕ) (hj : j≤K) := inner_approx_tendsto (hp j hj) hwn (ha j hj)
|
| 172 |
+
have hz' (j : ℕ) (hj : j≤K) := inner_approx_tendsto (hp j hj) hzn (hz j hj)
|
| 173 |
+
have hr := orthogonalRemainder_inner_tendsto (fun n ↦ gramSchmidtNormed ℝ (a n)) w z
|
| 174 |
+
(K+1) A B (fun j hj ↦ ha' j (by omega)) (fun j hj ↦ hz' j (by omega)) hb
|
| 175 |
+
simpa only [mul_zero,add_zero] using
|
| 176 |
+
((ha' K le_rfl).mul hr).add (((ha' K le_rfl).pow 2 |>.div_const _).mul (hz' K le_rfl))
|
| 177 |
+
end Limit
|
| 178 |
+
end SKValueG
|
| 179 |
+
|
| 180 |
+
end
|
| 181 |
+
|
| 182 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/GumbelMax.lean
CHANGED
|
@@ -1,152 +1,152 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.RotatedCoefficients
|
| 3 |
-
import OAI.Probability.SKValue.GroundState.ExponentialMoments
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped Topology ENNReal NNReal BigOperators
|
| 11 |
-
namespace SKValueG
|
| 12 |
-
|
| 13 |
-
lemma finiteMaximum_le_iff {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (t : ℝ) :
|
| 14 |
-
finiteMaximum x ≤ t ↔ ∀ i, x i≤t := by
|
| 15 |
-
constructor
|
| 16 |
-
· intro h i; exact (le_finiteMaximum x i).trans h
|
| 17 |
-
· intro h; obtain ⟨i,hi⟩ := exists_finiteMaximum x; simpa only [←hi] using h i
|
| 18 |
-
|
| 19 |
-
noncomputable def logSumExp {ι : Type*} [Fintype ι] (d : ι → ℝ) : ℝ :=
|
| 20 |
-
Real.log (∑ i, Real.exp (d i))
|
| 21 |
-
|
| 22 |
-
lemma exp_sum_pos {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 23 |
-
0<∑ i, Real.exp (d i) := Finset.sum_pos (fun _ _ ↦ Real.exp_pos _) Finset.univ_nonempty
|
| 24 |
-
|
| 25 |
-
lemma gumbel_shift_cdf (d t : ℝ) :
|
| 26 |
-
cdf (gumbelLaw.map (fun x ↦ x+d)) t=Real.exp (-Real.exp (-(t-d))) := by
|
| 27 |
-
have : IsProbabilityMeasure (gumbelLaw.map (fun x ↦ x+d)) := inferInstance
|
| 28 |
-
rw [cdf_eq_real,measureReal_def,Measure.map_apply (by fun_prop) measurableSet_Iic]
|
| 29 |
-
have he : (fun x : ℝ ↦ x+d) ⁻¹' Iic t=Iic (t-d) := by ext x; simp only [mem_preimage,mem_Iic]; constructor <;> intro h <;> linarith
|
| 30 |
-
rw [he,←measureReal_def,←cdf_eq_real,gumbel_cdf]
|
| 31 |
-
|
| 32 |
-
lemma gumbel_max_cdf {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) (t : ℝ) :
|
| 33 |
-
cdf ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 34 |
-
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) t=
|
| 35 |
-
Real.exp (-Real.exp (-(t-logSumExp d))) := by
|
| 36 |
-
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 37 |
-
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 38 |
-
have : IsProbabilityMeasure ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 39 |
-
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) := inferInstance
|
| 40 |
-
rw [cdf_eq_real,measureReal_def,Measure.map_apply hm measurableSet_Iic]
|
| 41 |
-
have he : (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) ⁻¹' Iic t=
|
| 42 |
-
univ.pi (fun i ↦ Iic (t-d i)) := by
|
| 43 |
-
ext z
|
| 44 |
-
simp only [mem_preimage,mem_Iic,finiteMaximum_le_iff,mem_univ_pi]
|
| 45 |
-
exact forall_congr' (fun i ↦ by constructor <;> intro h <;> linarith)
|
| 46 |
-
rw [he,Measure.pi_pi,ENNReal.toReal_prod]
|
| 47 |
-
simp only [←measureReal_def,←cdf_eq_real,gumbel_cdf]
|
| 48 |
-
rw [←Real.exp_sum]
|
| 49 |
-
congr 1
|
| 50 |
-
simp only [logSumExp]
|
| 51 |
-
rw [show -(t-Real.log (∑ i, Real.exp (d i)))=-t+Real.log (∑ i, Real.exp (d i)) by ring,
|
| 52 |
-
Real.exp_add,Real.exp_log (exp_sum_pos d)]
|
| 53 |
-
simp_rw [show ∀ i, -(t-d i)=-t+d i by intro i; ring,Real.exp_add]
|
| 54 |
-
rw [Finset.sum_neg_distrib,←Finset.mul_sum]
|
| 55 |
-
|
| 56 |
-
theorem gumbel_max_law {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 57 |
-
(Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 58 |
-
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))=
|
| 59 |
-
gumbelLaw.map (fun x ↦ x+logSumExp d) := by
|
| 60 |
-
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 61 |
-
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 62 |
-
have : IsProbabilityMeasure ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 63 |
-
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) := inferInstance
|
| 64 |
-
have : IsProbabilityMeasure (gumbelLaw.map (fun x ↦ x+logSumExp d)) := inferInstance
|
| 65 |
-
apply prob_measure_eq_of_cdf
|
| 66 |
-
intro t
|
| 67 |
-
rw [gumbel_max_cdf,gumbel_shift_cdf]
|
| 68 |
-
|
| 69 |
-
lemma gumbel_max_integrable {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 70 |
-
Integrable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i))
|
| 71 |
-
(Measure.pi (fun _ : ι ↦ gumbelLaw)) := by
|
| 72 |
-
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 73 |
-
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 74 |
-
have h : Integrable (fun x : ℝ ↦ x) ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 75 |
-
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) := by
|
| 76 |
-
rw [gumbel_max_law,integrable_map_measure (by fun_prop) (by fun_prop)]
|
| 77 |
-
exact gumbel_integrable.add (integrable_const _)
|
| 78 |
-
exact (integrable_map_measure (by fun_prop) hm.aemeasurable).mp h
|
| 79 |
-
|
| 80 |
-
lemma integral_gumbel_max {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 81 |
-
(∫ z, finiteMaximum (fun i ↦ d i+z i) ∂Measure.pi (fun _ : ι ↦ gumbelLaw))=
|
| 82 |
-
gumbelMean+logSumExp d := by
|
| 83 |
-
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 84 |
-
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 85 |
-
have h := congrArg (fun μ : Measure ℝ ↦ ∫ x, x ∂μ) (gumbel_max_law d)
|
| 86 |
-
rw [integral_map hm.aemeasurable (by fun_prop),integral_map (by fun_prop) (by fun_prop)] at h
|
| 87 |
-
rw [h,integral_add gumbel_integrable (integrable_const _)]
|
| 88 |
-
simp only [integral_const,probReal_univ,smul_eq_mul,one_mul,gumbelMean]
|
| 89 |
-
|
| 90 |
-
end SKValueG
|
| 91 |
-
|
| 92 |
-
end
|
| 93 |
-
|
| 94 |
-
section
|
| 95 |
-
|
| 96 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 97 |
-
open scoped Topology BigOperators ENNReal NNReal
|
| 98 |
-
namespace SKValueG
|
| 99 |
-
|
| 100 |
-
lemma log_tangent_bound {x m : ℝ} (hx : 0<x) (hm : 0 < m) :
|
| 101 |
-
Real.log x ≤ x/m-1+Real.log m := by
|
| 102 |
-
have h := Real.log_le_sub_one_of_pos (div_pos hx hm)
|
| 103 |
-
rw [Real.log_div hx.ne' hm.ne'] at h
|
| 104 |
-
linarith
|
| 105 |
-
|
| 106 |
-
lemma log_mean_lower {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 107 |
-
(x : ι → ℝ) (hx : ∀ i, 0<x i) :
|
| 108 |
-
(∑ i, Real.log (x i))/(Fintype.card ι : ℝ) ≤
|
| 109 |
-
Real.log ((∑ i, x i)/(Fintype.card ι : ℝ)) := by
|
| 110 |
-
let c : ℝ := Fintype.card ι
|
| 111 |
-
have hc : 0<c := by dsimp [c]; positivity
|
| 112 |
-
let m : ℝ := (∑ i, x i)/c
|
| 113 |
-
have hm : 0 < m := div_pos (Finset.sum_pos (fun i _ ↦ hx i) Finset.univ_nonempty) hc
|
| 114 |
-
have h := Finset.sum_le_sum (s := Finset.univ) (fun i _ ↦ log_tangent_bound (hx i) hm)
|
| 115 |
-
have hs : (∑ i, x i) ≠ 0 := (Finset.sum_pos (fun i _ ↦ hx i) Finset.univ_nonempty).ne'
|
| 116 |
-
have he : (∑ i, (x i/m-1+Real.log m))=c*Real.log m := by
|
| 117 |
-
rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,←Finset.sum_div]
|
| 118 |
-
simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul]
|
| 119 |
-
dsimp [m,c]
|
| 120 |
-
field_simp [hs]
|
| 121 |
-
ring
|
| 122 |
-
rw [he] at h
|
| 123 |
-
exact (div_le_iff₀ hc).mpr (by nlinarith)
|
| 124 |
-
|
| 125 |
-
lemma integral_log_le_log_integral {Ω : Type*} [MeasurableSpace Ω]
|
| 126 |
-
{μ : Measure Ω} [IsProbabilityMeasure μ] {f : Ω → ℝ}
|
| 127 |
-
(hf : Integrable f μ) (hl : Integrable (fun ω ↦ Real.log (f ω)) μ)
|
| 128 |
-
(hp : ∀ᵐ ω ∂μ, 0<f ω) :
|
| 129 |
-
(∫ ω, Real.log (f ω) ∂μ) ≤ Real.log (∫ ω, f ω ∂μ) := by
|
| 130 |
-
have hm : 0<∫ ω, f ω ∂μ := integral_pos_iff_support_of_nonneg_ae (hp.mono (fun _ h ↦ h.le)) hf |>.mpr (by
|
| 131 |
-
have hs : Function.support f =ᵐ[μ] univ := hp.mono (fun ω hω ↦ by apply propext; change (f ω≠0) ↔ True; simp [hω.ne'])
|
| 132 |
-
rw [measure_congr hs]
|
| 133 |
-
simp)
|
| 134 |
-
have h := integral_mono_ae hl
|
| 135 |
-
(((hf.div_const (∫ ω, f ω ∂μ)).sub (integrable_const 1)).add
|
| 136 |
-
(integrable_const (Real.log (∫ ω, f ω ∂μ))))
|
| 137 |
-
(hp.mono (fun ω hω ↦ log_tangent_bound hω hm))
|
| 138 |
-
have he : (∫ ω, (f ω/(∫ ω, f ω ∂μ)-1)+Real.log (∫ ω, f ω ∂μ) ∂μ)=
|
| 139 |
-
Real.log (∫ ω, f ω ∂μ) := by
|
| 140 |
-
rw [integral_add (f := fun ω ↦ f ω/(∫ ω, f ω ∂μ)-1)
|
| 141 |
-
(g := fun _ ↦ Real.log (∫ ω, f ω ∂μ))
|
| 142 |
-
((hf.div_const _).sub (integrable_const 1)) (integrable_const _),
|
| 143 |
-
integral_sub (f := fun ω ↦ f ω/(∫ ω, f ω ∂μ)) (g := fun _ ↦ (1 : ℝ))
|
| 144 |
-
(hf.div_const _) (integrable_const 1),integral_div]
|
| 145 |
-
simp [hm.ne']
|
| 146 |
-
exact h.trans_eq he
|
| 147 |
-
|
| 148 |
-
end SKValueG
|
| 149 |
-
|
| 150 |
-
end
|
| 151 |
-
|
| 152 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.RotatedCoefficients
|
| 3 |
+
import OAI.Probability.SKValue.GroundState.ExponentialMoments
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped Topology ENNReal NNReal BigOperators
|
| 11 |
+
namespace SKValueG
|
| 12 |
+
|
| 13 |
+
lemma finiteMaximum_le_iff {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (t : ℝ) :
|
| 14 |
+
finiteMaximum x ≤ t ↔ ∀ i, x i≤t := by
|
| 15 |
+
constructor
|
| 16 |
+
· intro h i; exact (le_finiteMaximum x i).trans h
|
| 17 |
+
· intro h; obtain ⟨i,hi⟩ := exists_finiteMaximum x; simpa only [←hi] using h i
|
| 18 |
+
|
| 19 |
+
noncomputable def logSumExp {ι : Type*} [Fintype ι] (d : ι → ℝ) : ℝ :=
|
| 20 |
+
Real.log (∑ i, Real.exp (d i))
|
| 21 |
+
|
| 22 |
+
lemma exp_sum_pos {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 23 |
+
0<∑ i, Real.exp (d i) := Finset.sum_pos (fun _ _ ↦ Real.exp_pos _) Finset.univ_nonempty
|
| 24 |
+
|
| 25 |
+
lemma gumbel_shift_cdf (d t : ℝ) :
|
| 26 |
+
cdf (gumbelLaw.map (fun x ↦ x+d)) t=Real.exp (-Real.exp (-(t-d))) := by
|
| 27 |
+
have : IsProbabilityMeasure (gumbelLaw.map (fun x ↦ x+d)) := inferInstance
|
| 28 |
+
rw [cdf_eq_real,measureReal_def,Measure.map_apply (by fun_prop) measurableSet_Iic]
|
| 29 |
+
have he : (fun x : ℝ ↦ x+d) ⁻¹' Iic t=Iic (t-d) := by ext x; simp only [mem_preimage,mem_Iic]; constructor <;> intro h <;> linarith
|
| 30 |
+
rw [he,←measureReal_def,←cdf_eq_real,gumbel_cdf]
|
| 31 |
+
|
| 32 |
+
lemma gumbel_max_cdf {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) (t : ℝ) :
|
| 33 |
+
cdf ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 34 |
+
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) t=
|
| 35 |
+
Real.exp (-Real.exp (-(t-logSumExp d))) := by
|
| 36 |
+
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 37 |
+
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 38 |
+
have : IsProbabilityMeasure ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 39 |
+
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) := inferInstance
|
| 40 |
+
rw [cdf_eq_real,measureReal_def,Measure.map_apply hm measurableSet_Iic]
|
| 41 |
+
have he : (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) ⁻¹' Iic t=
|
| 42 |
+
univ.pi (fun i ↦ Iic (t-d i)) := by
|
| 43 |
+
ext z
|
| 44 |
+
simp only [mem_preimage,mem_Iic,finiteMaximum_le_iff,mem_univ_pi]
|
| 45 |
+
exact forall_congr' (fun i ↦ by constructor <;> intro h <;> linarith)
|
| 46 |
+
rw [he,Measure.pi_pi,ENNReal.toReal_prod]
|
| 47 |
+
simp only [←measureReal_def,←cdf_eq_real,gumbel_cdf]
|
| 48 |
+
rw [←Real.exp_sum]
|
| 49 |
+
congr 1
|
| 50 |
+
simp only [logSumExp]
|
| 51 |
+
rw [show -(t-Real.log (∑ i, Real.exp (d i)))=-t+Real.log (∑ i, Real.exp (d i)) by ring,
|
| 52 |
+
Real.exp_add,Real.exp_log (exp_sum_pos d)]
|
| 53 |
+
simp_rw [show ∀ i, -(t-d i)=-t+d i by intro i; ring,Real.exp_add]
|
| 54 |
+
rw [Finset.sum_neg_distrib,←Finset.mul_sum]
|
| 55 |
+
|
| 56 |
+
theorem gumbel_max_law {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 57 |
+
(Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 58 |
+
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))=
|
| 59 |
+
gumbelLaw.map (fun x ↦ x+logSumExp d) := by
|
| 60 |
+
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 61 |
+
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 62 |
+
have : IsProbabilityMeasure ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 63 |
+
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) := inferInstance
|
| 64 |
+
have : IsProbabilityMeasure (gumbelLaw.map (fun x ↦ x+logSumExp d)) := inferInstance
|
| 65 |
+
apply prob_measure_eq_of_cdf
|
| 66 |
+
intro t
|
| 67 |
+
rw [gumbel_max_cdf,gumbel_shift_cdf]
|
| 68 |
+
|
| 69 |
+
lemma gumbel_max_integrable {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 70 |
+
Integrable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i))
|
| 71 |
+
(Measure.pi (fun _ : ι ↦ gumbelLaw)) := by
|
| 72 |
+
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 73 |
+
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 74 |
+
have h : Integrable (fun x : ℝ ↦ x) ((Measure.pi (fun _ : ι ↦ gumbelLaw)).map
|
| 75 |
+
(fun z ↦ finiteMaximum (fun i ↦ d i+z i))) := by
|
| 76 |
+
rw [gumbel_max_law,integrable_map_measure (by fun_prop) (by fun_prop)]
|
| 77 |
+
exact gumbel_integrable.add (integrable_const _)
|
| 78 |
+
exact (integrable_map_measure (by fun_prop) hm.aemeasurable).mp h
|
| 79 |
+
|
| 80 |
+
lemma integral_gumbel_max {ι : Type*} [Fintype ι] [Nonempty ι] (d : ι → ℝ) :
|
| 81 |
+
(∫ z, finiteMaximum (fun i ↦ d i+z i) ∂Measure.pi (fun _ : ι ↦ gumbelLaw))=
|
| 82 |
+
gumbelMean+logSumExp d := by
|
| 83 |
+
have hm : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ d i+z i)) :=
|
| 84 |
+
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 85 |
+
have h := congrArg (fun μ : Measure ℝ ↦ ∫ x, x ∂μ) (gumbel_max_law d)
|
| 86 |
+
rw [integral_map hm.aemeasurable (by fun_prop),integral_map (by fun_prop) (by fun_prop)] at h
|
| 87 |
+
rw [h,integral_add gumbel_integrable (integrable_const _)]
|
| 88 |
+
simp only [integral_const,probReal_univ,smul_eq_mul,one_mul,gumbelMean]
|
| 89 |
+
|
| 90 |
+
end SKValueG
|
| 91 |
+
|
| 92 |
+
end
|
| 93 |
+
|
| 94 |
+
section
|
| 95 |
+
|
| 96 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 97 |
+
open scoped Topology BigOperators ENNReal NNReal
|
| 98 |
+
namespace SKValueG
|
| 99 |
+
|
| 100 |
+
lemma log_tangent_bound {x m : ℝ} (hx : 0<x) (hm : 0 < m) :
|
| 101 |
+
Real.log x ≤ x/m-1+Real.log m := by
|
| 102 |
+
have h := Real.log_le_sub_one_of_pos (div_pos hx hm)
|
| 103 |
+
rw [Real.log_div hx.ne' hm.ne'] at h
|
| 104 |
+
linarith
|
| 105 |
+
|
| 106 |
+
lemma log_mean_lower {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 107 |
+
(x : ι → ℝ) (hx : ∀ i, 0<x i) :
|
| 108 |
+
(∑ i, Real.log (x i))/(Fintype.card ι : ℝ) ≤
|
| 109 |
+
Real.log ((∑ i, x i)/(Fintype.card ι : ℝ)) := by
|
| 110 |
+
let c : ℝ := Fintype.card ι
|
| 111 |
+
have hc : 0<c := by dsimp [c]; positivity
|
| 112 |
+
let m : ℝ := (∑ i, x i)/c
|
| 113 |
+
have hm : 0 < m := div_pos (Finset.sum_pos (fun i _ ↦ hx i) Finset.univ_nonempty) hc
|
| 114 |
+
have h := Finset.sum_le_sum (s := Finset.univ) (fun i _ ↦ log_tangent_bound (hx i) hm)
|
| 115 |
+
have hs : (∑ i, x i) ≠ 0 := (Finset.sum_pos (fun i _ ↦ hx i) Finset.univ_nonempty).ne'
|
| 116 |
+
have he : (∑ i, (x i/m-1+Real.log m))=c*Real.log m := by
|
| 117 |
+
rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,←Finset.sum_div]
|
| 118 |
+
simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul]
|
| 119 |
+
dsimp [m,c]
|
| 120 |
+
field_simp [hs]
|
| 121 |
+
ring
|
| 122 |
+
rw [he] at h
|
| 123 |
+
exact (div_le_iff₀ hc).mpr (by nlinarith)
|
| 124 |
+
|
| 125 |
+
lemma integral_log_le_log_integral {Ω : Type*} [MeasurableSpace Ω]
|
| 126 |
+
{μ : Measure Ω} [IsProbabilityMeasure μ] {f : Ω → ℝ}
|
| 127 |
+
(hf : Integrable f μ) (hl : Integrable (fun ω ↦ Real.log (f ω)) μ)
|
| 128 |
+
(hp : ∀ᵐ ω ∂μ, 0<f ω) :
|
| 129 |
+
(∫ ω, Real.log (f ω) ∂μ) ≤ Real.log (∫ ω, f ω ∂μ) := by
|
| 130 |
+
have hm : 0<∫ ω, f ω ∂μ := integral_pos_iff_support_of_nonneg_ae (hp.mono (fun _ h ↦ h.le)) hf |>.mpr (by
|
| 131 |
+
have hs : Function.support f =ᵐ[μ] univ := hp.mono (fun ω hω ↦ by apply propext; change (f ω≠0) ↔ True; simp [hω.ne'])
|
| 132 |
+
rw [measure_congr hs]
|
| 133 |
+
simp)
|
| 134 |
+
have h := integral_mono_ae hl
|
| 135 |
+
(((hf.div_const (∫ ω, f ω ∂μ)).sub (integrable_const 1)).add
|
| 136 |
+
(integrable_const (Real.log (∫ ω, f ω ∂μ))))
|
| 137 |
+
(hp.mono (fun ω hω ↦ log_tangent_bound hω hm))
|
| 138 |
+
have he : (∫ ω, (f ω/(∫ ω, f ω ∂μ)-1)+Real.log (∫ ω, f ω ∂μ) ∂μ)=
|
| 139 |
+
Real.log (∫ ω, f ω ∂μ) := by
|
| 140 |
+
rw [integral_add (f := fun ω ↦ f ω/(∫ ω, f ω ∂μ)-1)
|
| 141 |
+
(g := fun _ ↦ Real.log (∫ ω, f ω ∂μ))
|
| 142 |
+
((hf.div_const _).sub (integrable_const 1)) (integrable_const _),
|
| 143 |
+
integral_sub (f := fun ω ↦ f ω/(∫ ω, f ω ∂μ)) (g := fun _ ↦ (1 : ℝ))
|
| 144 |
+
(hf.div_const _) (integrable_const 1),integral_div]
|
| 145 |
+
simp [hm.ne']
|
| 146 |
+
exact h.trans_eq he
|
| 147 |
+
|
| 148 |
+
end SKValueG
|
| 149 |
+
|
| 150 |
+
end
|
| 151 |
+
|
| 152 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/GumbelReplacement.lean
CHANGED
|
@@ -1,132 +1,132 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.FiniteBranching
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology ENNReal NNReal BigOperators
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
|
| 12 |
-
lemma lipschitz_integrable_comp {Ω : Type*} [MeasurableSpace Ω]
|
| 13 |
-
{μ : Measure Ω} [IsFiniteMeasure μ] {f : Ω → ℝ} (hi : Integrable f μ)
|
| 14 |
-
{ψ : ℝ → ℝ} {L : ℝ≥0} (hψ : LipschitzWith L ψ) : Integrable (fun ω ↦ ψ (f ω)) μ := by
|
| 15 |
-
apply ((hi.norm.const_mul (L : ℝ)).add (integrable_const ‖ψ 0‖)).mono'
|
| 16 |
-
(hψ.continuous.comp_aestronglyMeasurable hi.aestronglyMeasurable)
|
| 17 |
-
exact Eventually.of_forall (fun ω ↦ by
|
| 18 |
-
have h : ‖ψ (f ω)-ψ 0‖ ≤ (L : ℝ)*‖f ω‖ := by simpa only [sub_zero] using hψ.norm_sub_le (f ω) 0
|
| 19 |
-
have htri := norm_add_le (ψ (f ω)-ψ 0) (ψ 0)
|
| 20 |
-
simp only [sub_add_cancel] at htri
|
| 21 |
-
change ‖ψ (f ω)‖ ≤ (L : ℝ)*‖f ω‖+‖ψ 0‖
|
| 22 |
-
linarith)
|
| 23 |
-
|
| 24 |
-
noncomputable def gumbelSmooth (m : ℝ) (ψ : ℝ → ℝ) (s : ℝ) : ℝ :=
|
| 25 |
-
∫ g, ψ (g/m+s) ∂gumbelLaw
|
| 26 |
-
|
| 27 |
-
lemma gumbelSmooth_lipschitz {m : ℝ} {ψ : ℝ → ℝ} {L : ℝ≥0}
|
| 28 |
-
(hψ : LipschitzWith L ψ) : LipschitzWith L (gumbelSmooth m ψ) := by
|
| 29 |
-
rw [lipschitzWith_iff_dist_le_mul]
|
| 30 |
-
intro x y
|
| 31 |
-
have hix := lipschitz_integrable_comp ((gumbel_integrable.div_const m).add (integrable_const x)) hψ
|
| 32 |
-
have hiy := lipschitz_integrable_comp ((gumbel_integrable.div_const m).add (integrable_const y)) hψ
|
| 33 |
-
change |(∫ g, ψ (g/m+x) ∂gumbelLaw)-(∫ g, ψ (g/m+y) ∂gumbelLaw)|≤L*|x-y|
|
| 34 |
-
rw [←integral_sub (f := fun g ↦ ψ (g/m+x)) (g := fun g ↦ ψ (g/m+y)) hix hiy]
|
| 35 |
-
have hbound (g : ℝ) : ‖ψ (g/m+x)-ψ (g/m+y)‖≤(L : ℝ)*|x-y| := by
|
| 36 |
-
simpa only [Real.norm_eq_abs,add_sub_add_left_eq_sub] using hψ.norm_sub_le (g/m+x) (g/m+y)
|
| 37 |
-
simpa using norm_integral_le_of_norm_le_const (μ := gumbelLaw) (Eventually.of_forall hbound)
|
| 38 |
-
|
| 39 |
-
lemma integral_comp_diff_le {Ω : Type*} [MeasurableSpace Ω]
|
| 40 |
-
{μ : Measure Ω} [IsProbabilityMeasure μ] {s : Ω → ℝ} (hi : Integrable s μ)
|
| 41 |
-
{ψ : ℝ → ℝ} {L : ℝ≥0} (hψ : LipschitzWith L ψ) (c : ℝ) :
|
| 42 |
-
|(∫ ω,ψ (s ω) ∂μ)-ψ c|≤(L : ℝ)*(∫ ω,|s ω-c| ∂μ) := by
|
| 43 |
-
have his := lipschitz_integrable_comp hi hψ
|
| 44 |
-
have hie : Integrable (fun ω ↦ |s ω-c|) μ := (hi.sub (integrable_const c)).abs
|
| 45 |
-
calc
|
| 46 |
-
_ = |∫ ω,ψ (s ω)-ψ c ∂μ| := by rw [integral_sub his (integrable_const _)]; simp
|
| 47 |
-
_ ≤ ∫ ω,|ψ (s ω)-ψ c| ∂μ := by simpa only [Real.norm_eq_abs] using
|
| 48 |
-
norm_integral_le_integral_norm (fun
|
| 49 |
-
_ ≤ ∫ ω,(L : ℝ)*|s ω-c| ∂μ := integral_mono
|
| 50 |
-
(his.sub (integrable_const _)).abs (hie.const_mul _)
|
| 51 |
-
(fun ω ↦ by simpa only [Real.norm_eq_abs] using hψ.norm_sub_le (s ω) c)
|
| 52 |
-
_ = _ := integral_const_mul _ _
|
| 53 |
-
|
| 54 |
-
lemma scaled_gumbel_test_integral {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 55 |
-
(d : ι → ℝ) {m : ℝ} (hm : 0 < m) (ψ : ℝ → ℝ) (hψ : Measurable ψ) :
|
| 56 |
-
(∫ z,ψ (finiteMaximum (fun i ↦ d i+z i/m)-Real.log (Fintype.card ι : ℝ)/m)
|
| 57 |
-
∂Measure.pi (fun _ : ι ↦ gumbelLaw))=
|
| 58 |
-
gumbelSmooth m ψ (Real.log ((∑ i,Real.exp (m*d i))/(Fintype.card ι : ℝ))/m) := by
|
| 59 |
-
have hmmax : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ m*d i+z i)) :=
|
| 60 |
-
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 61 |
-
have ht : Measurable (fun y : ℝ ↦ ψ (y/m-Real.log (Fintype.card ι : ℝ)/m)) := by fun_prop
|
| 62 |
-
have h := congrArg (fun μ : Measure ℝ ↦ ∫ y,ψ (y/m-Real.log (Fintype.card ι : ℝ)/m) ∂μ)
|
| 63 |
-
(gumbel_max_law (fun i ↦ m*d i))
|
| 64 |
-
rw [integral_map hmmax.aemeasurable ht.aestronglyMeasurable,
|
| 65 |
-
integral_map (by fun_prop) ht.aestronglyMeasurable] at h
|
| 66 |
-
have he (z : ι → ℝ) : finiteMaximum (fun i ↦ d i+z i/m)=
|
| 67 |
-
finiteMaximum (fun i ↦ m*d i+z i)/m := by
|
| 68 |
-
rw [←finiteMaximum_div_pos _ hm]
|
| 69 |
-
congr 1; ext i; field_simp
|
| 70 |
-
simp_rw [he]
|
| 71 |
-
rw [h]
|
| 72 |
-
apply integral_congr_ae
|
| 73 |
-
exact Eventually.of_forall (fun g ↦ by
|
| 74 |
-
apply congrArg ψ
|
| 75 |
-
rw [Real.log_div (exp_sum_pos _).ne' (by positivity)]
|
| 76 |
-
dsimp [logSumExp]
|
| 77 |
-
ring)
|
| 78 |
-
|
| 79 |
-
theorem marked_branching_limit {Ω : Type*} [MeasurableSpace Ω]
|
| 80 |
-
{μ : Measure Ω} [IsProbabilityMeasure μ] (X : ℕ → Ω → ℝ)
|
| 81 |
-
{m : ℝ} (hm : 0 < m) (hi : Integrable (X 0) μ)
|
| 82 |
-
(he : Integrable (fun ω ↦ Real.exp (m*X 0 ω)) μ)
|
| 83 |
-
(hind : Pairwise (Function.onFun (fun x1 x2 ↦ x1 ⟂ᵢ[μ] x2) X))
|
| 84 |
-
(hid : ∀ i,IdentDistrib (X i) (X 0) μ μ)
|
| 85 |
-
{ψ : ℝ → ℝ} {L : ℝ≥0} (hψ : LipschitzWith L ψ) :
|
| 86 |
-
Tendsto (fun n ↦ ∫ ω,
|
| 87 |
-
(∫ z,ψ (finiteMaximum (fun i : Fin (n+1) ↦ X i ω+z i/m)-Real.log (n+1 : ℝ)/m)
|
| 88 |
-
∂Measure.pi (fun _ : Fin (n+1) ↦ gumbelLaw)) ∂μ)
|
| 89 |
-
atTop (𝓝 (gumbelSmooth m ψ (Real.log (∫ ω,Real.exp (m*X 0 ω) ∂μ)/m))) := by
|
| 90 |
-
let Y := fun i ω ↦ Real.exp (m*X i ω)
|
| 91 |
-
have hf : Measurable (fun x : ℝ ↦ Real.exp (m*x)) := by fun_prop
|
| 92 |
-
have hl : Integrable (fun ω ↦ Real.log (Y 0 ω)) μ := by
|
| 93 |
-
simpa only [Y,Real.log_exp] using hi.const_mul m
|
| 94 |
-
have hiY (i) : Integrable (Y i) μ := ((hid i).comp hf).integrable_iff.mpr he
|
| 95 |
-
have hilogY (i) : Integrable (fun ω ↦ Real.log (Y i ω)) μ :=
|
| 96 |
-
(((hid i).comp hf).comp Real.measurable_log).integrable_iff.mpr hl
|
| 97 |
-
have hpY (i) : ∀ᵐ ω ∂μ,0<Y i ω := Eventually.of_forall (fun ω ↦ Real.exp_pos _)
|
| 98 |
-
have hlim := log_empiricalMean_L1 Y he hl hpY
|
| 99 |
-
(fun i j hij ↦ (hind hij).comp hf hf) (fun i ↦ (hid i).comp hf)
|
| 100 |
-
let c := Real.log (∫ ω,Y 0 ω ∂μ)/m
|
| 101 |
-
let s := fun n ω ↦ Real.log (empiricalMean Y n ω)/m
|
| 102 |
-
have his (n) : Integrable (s n) μ :=
|
| 103 |
-
(empiricalMean_log_integrable Y hiY hilogY hpY n).div_const m
|
| 104 |
-
have herr (n) : (∫ ω,|s n ω-c| ∂μ)=
|
| 105 |
-
(∫ ω,|Real.log (empiricalMean Y n ω)-Real.log (∫ ω,Y 0 ω ∂μ)| ∂μ)/m := by
|
| 106 |
-
rw [←integral_div]
|
| 107 |
-
apply integral_congr_ae
|
| 108 |
-
exact Eventually.of_forall (fun ω ↦ by dsimp [s,c]; rw [←sub_div,abs_div,abs_of_pos hm])
|
| 109 |
-
have ht : Tendsto (fun n ↦ ∫ ω,|s n ω-c| ∂μ) atTop (𝓝 0) := by
|
| 110 |
-
simpa only [herr,zero_div] using hlim.div_const m
|
| 111 |
-
have hg := gumbelSmooth_lipschitz (m := m) hψ
|
| 112 |
-
have hb (n) := integral_comp_diff_le (his n) hg c
|
| 113 |
-
have hx : Tendsto (fun n ↦ |(∫ ω,gumbelSmooth m ψ (s n ω) ∂μ)-gumbelSmooth m ψ c|)
|
| 114 |
-
atTop (𝓝 0) := squeeze_zero (fun n ↦ abs_nonneg _) hb (by simpa using ht.const_mul (L : ℝ))
|
| 115 |
-
have hconv : Tendsto (fun n ↦ ∫ ω,gumbelSmooth m ψ (s n ω) ∂μ) atTop
|
| 116 |
-
(𝓝 (gumbelSmooth m ψ c)) := tendsto_iff_norm_sub_tendsto_zero.mpr (by
|
| 117 |
-
simpa only [Real.norm_eq_abs] using hx)
|
| 118 |
-
have heq (n : ℕ) : (∫ ω,(∫ z,ψ (finiteMaximum (fun i : Fin (n+1) ↦ X i ω+z i/m)-
|
| 119 |
-
Real.log (n+1 : ℝ)/m) ∂Measure.pi (fun _ : Fin (n+1) ↦ gumbelLaw)) ∂μ)=
|
| 120 |
-
∫ ω,gumbelSmooth m ψ (s n ω) ∂μ := by
|
| 121 |
-
apply integral_congr_ae
|
| 122 |
-
exact Eventually.of_forall (fun ω ↦ by
|
| 123 |
-
have hh := scaled_gumbel_test_integral (fun i : Fin (n+1) ↦ X i ω) hm ψ hψ.continuous.measurable
|
| 124 |
-
rw [Fin.sum_univ_eq_sum_range (fun i ↦ Real.exp (m*X i ω))] at hh
|
| 125 |
-
simpa only [Fintype.card_fin,Nat.cast_add,Nat.cast_one,empiricalMean,Y,s] using hh)
|
| 126 |
-
simpa only [heq,c,Y] using hconv
|
| 127 |
-
|
| 128 |
-
end SKValueG
|
| 129 |
-
|
| 130 |
-
end
|
| 131 |
-
|
| 132 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.FiniteBranching
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology ENNReal NNReal BigOperators
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
|
| 12 |
+
lemma lipschitz_integrable_comp {Ω : Type*} [MeasurableSpace Ω]
|
| 13 |
+
{μ : Measure Ω} [IsFiniteMeasure μ] {f : Ω → ℝ} (hi : Integrable f μ)
|
| 14 |
+
{ψ : ℝ → ℝ} {L : ℝ≥0} (hψ : LipschitzWith L ψ) : Integrable (fun ω ↦ ψ (f ω)) μ := by
|
| 15 |
+
apply ((hi.norm.const_mul (L : ℝ)).add (integrable_const ‖ψ 0‖)).mono'
|
| 16 |
+
(hψ.continuous.comp_aestronglyMeasurable hi.aestronglyMeasurable)
|
| 17 |
+
exact Eventually.of_forall (fun ω ↦ by
|
| 18 |
+
have h : ‖ψ (f ω)-ψ 0‖ ≤ (L : ℝ)*‖f ω‖ := by simpa only [sub_zero] using hψ.norm_sub_le (f ω) 0
|
| 19 |
+
have htri := norm_add_le (ψ (f ω)-ψ 0) (ψ 0)
|
| 20 |
+
simp only [sub_add_cancel] at htri
|
| 21 |
+
change ‖ψ (f ω)‖ ≤ (L : ℝ)*‖f ω‖+‖ψ 0‖
|
| 22 |
+
linarith)
|
| 23 |
+
|
| 24 |
+
noncomputable def gumbelSmooth (m : ℝ) (ψ : ℝ → ℝ) (s : ℝ) : ℝ :=
|
| 25 |
+
∫ g, ψ (g/m+s) ∂gumbelLaw
|
| 26 |
+
|
| 27 |
+
lemma gumbelSmooth_lipschitz {m : ℝ} {ψ : ℝ → ℝ} {L : ℝ≥0}
|
| 28 |
+
(hψ : LipschitzWith L ψ) : LipschitzWith L (gumbelSmooth m ψ) := by
|
| 29 |
+
rw [lipschitzWith_iff_dist_le_mul]
|
| 30 |
+
intro x y
|
| 31 |
+
have hix := lipschitz_integrable_comp ((gumbel_integrable.div_const m).add (integrable_const x)) hψ
|
| 32 |
+
have hiy := lipschitz_integrable_comp ((gumbel_integrable.div_const m).add (integrable_const y)) hψ
|
| 33 |
+
change |(∫ g, ψ (g/m+x) ∂gumbelLaw)-(∫ g, ψ (g/m+y) ∂gumbelLaw)|≤L*|x-y|
|
| 34 |
+
rw [←integral_sub (f := fun g ↦ ψ (g/m+x)) (g := fun g ↦ ψ (g/m+y)) hix hiy]
|
| 35 |
+
have hbound (g : ℝ) : ‖ψ (g/m+x)-ψ (g/m+y)‖≤(L : ℝ)*|x-y| := by
|
| 36 |
+
simpa only [Real.norm_eq_abs,add_sub_add_left_eq_sub] using hψ.norm_sub_le (g/m+x) (g/m+y)
|
| 37 |
+
simpa using norm_integral_le_of_norm_le_const (μ := gumbelLaw) (Eventually.of_forall hbound)
|
| 38 |
+
|
| 39 |
+
lemma integral_comp_diff_le {Ω : Type*} [MeasurableSpace Ω]
|
| 40 |
+
{μ : Measure Ω} [IsProbabilityMeasure μ] {s : Ω → ℝ} (hi : Integrable s μ)
|
| 41 |
+
{ψ : ℝ → ℝ} {L : ℝ≥0} (hψ : LipschitzWith L ψ) (c : ℝ) :
|
| 42 |
+
|(∫ ω,ψ (s ω) ∂μ)-ψ c|≤(L : ℝ)*(∫ ω,|s ω-c| ∂μ) := by
|
| 43 |
+
have his := lipschitz_integrable_comp hi hψ
|
| 44 |
+
have hie : Integrable (fun ω ↦ |s ω-c|) μ := (hi.sub (integrable_const c)).abs
|
| 45 |
+
calc
|
| 46 |
+
_ = |∫ ω,ψ (s ω)-ψ c ∂μ| := by rw [integral_sub his (integrable_const _)]; simp
|
| 47 |
+
_ ≤ ∫ ω,|ψ (s ω)-ψ c| ∂μ := by simpa only [Real.norm_eq_abs] using
|
| 48 |
+
norm_integral_le_integral_norm (fun �� ↦ ψ (s ω)-ψ c)
|
| 49 |
+
_ ≤ ∫ ω,(L : ℝ)*|s ω-c| ∂μ := integral_mono
|
| 50 |
+
(his.sub (integrable_const _)).abs (hie.const_mul _)
|
| 51 |
+
(fun ω ↦ by simpa only [Real.norm_eq_abs] using hψ.norm_sub_le (s ω) c)
|
| 52 |
+
_ = _ := integral_const_mul _ _
|
| 53 |
+
|
| 54 |
+
lemma scaled_gumbel_test_integral {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 55 |
+
(d : ι → ℝ) {m : ℝ} (hm : 0 < m) (ψ : ℝ → ℝ) (hψ : Measurable ψ) :
|
| 56 |
+
(∫ z,ψ (finiteMaximum (fun i ↦ d i+z i/m)-Real.log (Fintype.card ι : ℝ)/m)
|
| 57 |
+
∂Measure.pi (fun _ : ι ↦ gumbelLaw))=
|
| 58 |
+
gumbelSmooth m ψ (Real.log ((∑ i,Real.exp (m*d i))/(Fintype.card ι : ℝ))/m) := by
|
| 59 |
+
have hmmax : Measurable (fun z : ι → ℝ ↦ finiteMaximum (fun i ↦ m*d i+z i)) :=
|
| 60 |
+
(continuous_finiteMaximum.comp (continuous_const.add continuous_id)).measurable
|
| 61 |
+
have ht : Measurable (fun y : ℝ ↦ ψ (y/m-Real.log (Fintype.card ι : ℝ)/m)) := by fun_prop
|
| 62 |
+
have h := congrArg (fun μ : Measure ℝ ↦ ∫ y,ψ (y/m-Real.log (Fintype.card ι : ℝ)/m) ∂μ)
|
| 63 |
+
(gumbel_max_law (fun i ↦ m*d i))
|
| 64 |
+
rw [integral_map hmmax.aemeasurable ht.aestronglyMeasurable,
|
| 65 |
+
integral_map (by fun_prop) ht.aestronglyMeasurable] at h
|
| 66 |
+
have he (z : ι → ℝ) : finiteMaximum (fun i ↦ d i+z i/m)=
|
| 67 |
+
finiteMaximum (fun i ↦ m*d i+z i)/m := by
|
| 68 |
+
rw [←finiteMaximum_div_pos _ hm]
|
| 69 |
+
congr 1; ext i; field_simp
|
| 70 |
+
simp_rw [he]
|
| 71 |
+
rw [h]
|
| 72 |
+
apply integral_congr_ae
|
| 73 |
+
exact Eventually.of_forall (fun g ↦ by
|
| 74 |
+
apply congrArg ψ
|
| 75 |
+
rw [Real.log_div (exp_sum_pos _).ne' (by positivity)]
|
| 76 |
+
dsimp [logSumExp]
|
| 77 |
+
ring)
|
| 78 |
+
|
| 79 |
+
theorem marked_branching_limit {Ω : Type*} [MeasurableSpace Ω]
|
| 80 |
+
{μ : Measure Ω} [IsProbabilityMeasure μ] (X : ℕ → Ω → ℝ)
|
| 81 |
+
{m : ℝ} (hm : 0 < m) (hi : Integrable (X 0) μ)
|
| 82 |
+
(he : Integrable (fun ω ↦ Real.exp (m*X 0 ω)) μ)
|
| 83 |
+
(hind : Pairwise (Function.onFun (fun x1 x2 ↦ x1 ⟂ᵢ[μ] x2) X))
|
| 84 |
+
(hid : ∀ i,IdentDistrib (X i) (X 0) μ μ)
|
| 85 |
+
{ψ : ℝ → ℝ} {L : ℝ≥0} (hψ : LipschitzWith L ψ) :
|
| 86 |
+
Tendsto (fun n ↦ ∫ ω,
|
| 87 |
+
(∫ z,ψ (finiteMaximum (fun i : Fin (n+1) ↦ X i ω+z i/m)-Real.log (n+1 : ℝ)/m)
|
| 88 |
+
∂Measure.pi (fun _ : Fin (n+1) ↦ gumbelLaw)) ∂μ)
|
| 89 |
+
atTop (𝓝 (gumbelSmooth m ψ (Real.log (∫ ω,Real.exp (m*X 0 ω) ∂μ)/m))) := by
|
| 90 |
+
let Y := fun i ω ↦ Real.exp (m*X i ω)
|
| 91 |
+
have hf : Measurable (fun x : ℝ ↦ Real.exp (m*x)) := by fun_prop
|
| 92 |
+
have hl : Integrable (fun ω ↦ Real.log (Y 0 ω)) μ := by
|
| 93 |
+
simpa only [Y,Real.log_exp] using hi.const_mul m
|
| 94 |
+
have hiY (i) : Integrable (Y i) μ := ((hid i).comp hf).integrable_iff.mpr he
|
| 95 |
+
have hilogY (i) : Integrable (fun ω ↦ Real.log (Y i ω)) μ :=
|
| 96 |
+
(((hid i).comp hf).comp Real.measurable_log).integrable_iff.mpr hl
|
| 97 |
+
have hpY (i) : ∀ᵐ ω ∂μ,0<Y i ω := Eventually.of_forall (fun ω ↦ Real.exp_pos _)
|
| 98 |
+
have hlim := log_empiricalMean_L1 Y he hl hpY
|
| 99 |
+
(fun i j hij ↦ (hind hij).comp hf hf) (fun i ↦ (hid i).comp hf)
|
| 100 |
+
let c := Real.log (∫ ω,Y 0 ω ∂μ)/m
|
| 101 |
+
let s := fun n ω ↦ Real.log (empiricalMean Y n ω)/m
|
| 102 |
+
have his (n) : Integrable (s n) μ :=
|
| 103 |
+
(empiricalMean_log_integrable Y hiY hilogY hpY n).div_const m
|
| 104 |
+
have herr (n) : (∫ ω,|s n ω-c| ∂μ)=
|
| 105 |
+
(∫ ω,|Real.log (empiricalMean Y n ω)-Real.log (∫ ω,Y 0 ω ∂μ)| ∂μ)/m := by
|
| 106 |
+
rw [←integral_div]
|
| 107 |
+
apply integral_congr_ae
|
| 108 |
+
exact Eventually.of_forall (fun ω ↦ by dsimp [s,c]; rw [←sub_div,abs_div,abs_of_pos hm])
|
| 109 |
+
have ht : Tendsto (fun n ↦ ∫ ω,|s n ω-c| ∂μ) atTop (𝓝 0) := by
|
| 110 |
+
simpa only [herr,zero_div] using hlim.div_const m
|
| 111 |
+
have hg := gumbelSmooth_lipschitz (m := m) hψ
|
| 112 |
+
have hb (n) := integral_comp_diff_le (his n) hg c
|
| 113 |
+
have hx : Tendsto (fun n ↦ |(∫ ω,gumbelSmooth m ψ (s n ω) ∂μ)-gumbelSmooth m ψ c|)
|
| 114 |
+
atTop (𝓝 0) := squeeze_zero (fun n ↦ abs_nonneg _) hb (by simpa using ht.const_mul (L : ℝ))
|
| 115 |
+
have hconv : Tendsto (fun n ↦ ∫ ω,gumbelSmooth m ψ (s n ω) ∂μ) atTop
|
| 116 |
+
(𝓝 (gumbelSmooth m ψ c)) := tendsto_iff_norm_sub_tendsto_zero.mpr (by
|
| 117 |
+
simpa only [Real.norm_eq_abs] using hx)
|
| 118 |
+
have heq (n : ℕ) : (∫ ω,(∫ z,ψ (finiteMaximum (fun i : Fin (n+1) ↦ X i ω+z i/m)-
|
| 119 |
+
Real.log (n+1 : ℝ)/m) ∂Measure.pi (fun _ : Fin (n+1) ↦ gumbelLaw)) ∂μ)=
|
| 120 |
+
∫ ω,gumbelSmooth m ψ (s n ω) ∂μ := by
|
| 121 |
+
apply integral_congr_ae
|
| 122 |
+
exact Eventually.of_forall (fun ω ↦ by
|
| 123 |
+
have hh := scaled_gumbel_test_integral (fun i : Fin (n+1) ↦ X i ω) hm ψ hψ.continuous.measurable
|
| 124 |
+
rw [Fin.sum_univ_eq_sum_range (fun i ↦ Real.exp (m*X i ω))] at hh
|
| 125 |
+
simpa only [Fintype.card_fin,Nat.cast_add,Nat.cast_one,empiricalMean,Y,s] using hh)
|
| 126 |
+
simpa only [heq,c,Y] using hconv
|
| 127 |
+
|
| 128 |
+
end SKValueG
|
| 129 |
+
|
| 130 |
+
end
|
| 131 |
+
|
| 132 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/LiteralLower.lean
CHANGED
|
@@ -1,153 +1,153 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.LiteralNormalizer
|
| 3 |
-
import OAI.Probability.SKValue.Control.Regularity
|
| 4 |
-
import OAI.Probability.SKValue.GroundState.RoundingSpin
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
|
| 10 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 12 |
-
namespace SKValue
|
| 13 |
-
|
| 14 |
-
theorem shiftedCoefficientSum_le_groundState (W : BrownianSpace) (γ : OrderParameter)
|
| 15 |
-
{T : ℝ} (hT : 0≤T) (hT1 : T<1) {N : ℕ} (hN : 0<N)
|
| 16 |
-
(hpos : ∀ j<N,0<∫ z,(rawCoefficient W γ T N j z)^2 ∂gaussianProduct (Fin (N+1))) :
|
| 17 |
-
shiftedCoefficientSum W γ T N≤groundStateValue := by
|
| 18 |
-
obtain ⟨Kv,Lv,K,L,D,Lu,La,hV,hG,hD,hLu,hLa,hDb,hu,ha⟩ := sourceStripRegularity W γ T ⟨hT,hT1⟩
|
| 19 |
-
rw [literal_shiftedCoefficientSum]
|
| 20 |
-
exact normalized_shifted_sum_le_groundState
|
| 21 |
-
(fun j : Fin N ↦ meshRaw T N γ.coeff (gradient W γ) j)
|
| 22 |
-
(meshTerminal T N γ.coeff (gradient W γ))
|
| 23 |
-
(fun j ↦ mesh_raw_measurable hT hG hN j.isLt.le)
|
| 24 |
-
(fun j ↦ mesh_raw_depends T j.isLt.le γ.coeff (gradient W γ))
|
| 25 |
-
(fun j ↦ mesh_raw_memLp hT hG hDb hN j.isLt.le)
|
| 26 |
-
(fun j ↦ hpos j j.isLt)
|
| 27 |
-
(mesh_terminal_measurable hT hG hN) (mesh_terminal_depends T N γ.coeff (gradient W γ))
|
| 28 |
-
|
| 29 |
-
end SKValue
|
| 30 |
-
|
| 31 |
-
end
|
| 32 |
-
|
| 33 |
-
section
|
| 34 |
-
|
| 35 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 36 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 37 |
-
namespace SKValueG
|
| 38 |
-
|
| 39 |
-
lemma finiteMaximum_prod_add {ι Λ : Type*} [Fintype ι] [Nonempty ι]
|
| 40 |
-
[Fintype Λ] [Nonempty Λ] (f : ι → ℝ) (g : Λ → ℝ) :
|
| 41 |
-
finiteMaximum (fun p : ι×Λ ↦ f p.1+g p.2)=finiteMaximum f+finiteMaximum g := by
|
| 42 |
-
apply le_antisymm
|
| 43 |
-
· obtain ⟨p,hp⟩ := exists_finiteMaximum (fun p : ι×Λ ↦ f p.1+g p.2)
|
| 44 |
-
rw [←hp]
|
| 45 |
-
exact add_le_add (le_finiteMaximum f p.1) (le_finiteMaximum g p.2)
|
| 46 |
-
· obtain ⟨i,hi⟩ := exists_finiteMaximum f
|
| 47 |
-
obtain ⟨a,ha⟩ := exists_finiteMaximum g
|
| 48 |
-
rw [←hi,←ha]
|
| 49 |
-
exact le_finiteMaximum (fun p : ι×Λ ↦ f p.1+g p.2) (i,a)
|
| 50 |
-
|
| 51 |
-
lemma finiteMaximum_prod_curry {ι Λ : Type*} [Fintype ι] [Nonempty ι]
|
| 52 |
-
[Fintype Λ] [Nonempty Λ] (f : ι×Λ → ℝ) :
|
| 53 |
-
finiteMaximum f=finiteMaximum (fun a ↦ finiteMaximum (fun i ↦ f (i,a))) := by
|
| 54 |
-
apply le_antisymm
|
| 55 |
-
· obtain ⟨p,hp⟩ := exists_finiteMaximum f
|
| 56 |
-
rw [←hp]
|
| 57 |
-
exact (le_finiteMaximum (fun i ↦ f (i,p.2)) p.1).trans
|
| 58 |
-
(le_finiteMaximum (fun a ↦ finiteMaximum (fun i ↦ f (i,a))) p.2)
|
| 59 |
-
· obtain ⟨a,ha⟩ := exists_finiteMaximum (fun a ↦ finiteMaximum (fun i ↦ f (i,a)))
|
| 60 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum (fun i ↦ f (i,a))
|
| 61 |
-
rw [←ha,←hi]
|
| 62 |
-
exact le_finiteMaximum f (i,a)
|
| 63 |
-
|
| 64 |
-
lemma spinMaximum_eq_sum_abs {ι : Type*} [Fintype ι] (x : ι → ℝ) :
|
| 65 |
-
finiteMaximum (fun σ : ι → Bool ↦ ∑ i, spin (σ i)*x i)=∑ i, |x i| := by
|
| 66 |
-
classical
|
| 67 |
-
apply le_antisymm
|
| 68 |
-
· obtain ⟨σ,hσ⟩ := exists_finiteMaximum (fun σ : ι → Bool ↦ ∑ i, spin (σ i)*x i)
|
| 69 |
-
rw [←hσ]
|
| 70 |
-
apply Finset.sum_le_sum
|
| 71 |
-
intro i _
|
| 72 |
-
calc
|
| 73 |
-
_ ≤ |spin (σ i)*x i| := le_abs_self _
|
| 74 |
-
_ = _ := by rw [abs_mul,abs_spin,one_mul]
|
| 75 |
-
· let σ : ι → Bool := fun i ↦ decide (0≤x i)
|
| 76 |
-
have he (i : ι) : spin (σ i)*x i=|x i| := by
|
| 77 |
-
by_cases h : 0≤x i
|
| 78 |
-
· simp [σ,spin,h,abs_of_nonneg h]
|
| 79 |
-
· simp [σ,spin,h,abs_of_neg (lt_of_not_ge h)]
|
| 80 |
-
simpa only [he] using le_finiteMaximum (fun σ : ι → Bool ↦ ∑ i, spin (σ i)*x i) σ
|
| 81 |
-
|
| 82 |
-
noncomputable def leafField {Λ κ : Type*} [Fintype κ] {n : ℕ}
|
| 83 |
-
(v : Λ → κ → ℝ) (z : Fin n×κ → ℝ) (α : Λ) (i : Fin n) : ℝ :=
|
| 84 |
-
∑ k, v α k*z (i,k)
|
| 85 |
-
|
| 86 |
-
lemma linearProcess_leafField {Λ κ : Type*} [Fintype κ] (n : ℕ)
|
| 87 |
-
(v : Λ → κ → ℝ) (z : Fin n×κ → ℝ) (p : (Fin n → Bool)×Λ) :
|
| 88 |
-
linearProcess (leafFieldCoeff n v) z p=∑ i, spin (p.1 i)*leafField v z p.2 i := by
|
| 89 |
-
simp only [linearProcess,leafFieldCoeff,Fintype.sum_prod_type,leafField,Finset.mul_sum]
|
| 90 |
-
apply Finset.sum_congr rfl
|
| 91 |
-
intro i _
|
| 92 |
-
apply Finset.sum_congr rfl
|
| 93 |
-
intro k _
|
| 94 |
-
ring
|
| 95 |
-
|
| 96 |
-
lemma leafField_max {Λ κ : Type*} [Fintype Λ] [Nonempty Λ] [Fintype κ]
|
| 97 |
-
(n : ℕ) (v : Λ → κ → ℝ) (d : Λ → ℝ) (z : Fin n×κ → ℝ) :
|
| 98 |
-
finiteMaximum (fun p ↦ linearProcess (leafFieldCoeff n v) z p+d p.2)=
|
| 99 |
-
finiteMaximum (fun α ↦ (∑ i, |leafField v z α i|)+d α) := by
|
| 100 |
-
rw [finiteMaximum_prod_curry]
|
| 101 |
-
simp only [linearProcess_leafField,finiteMaximum_add_const,spinMaximum_eq_sum_abs]
|
| 102 |
-
|
| 103 |
-
lemma expected_guerra_max {Λ κ : Type*} [Fintype Λ] [Nonempty Λ] [Fintype κ]
|
| 104 |
-
(n : ℕ) (v : Λ → κ → ℝ) (d : Λ → ℝ) :
|
| 105 |
-
(∫ z, finiteMaximum (fun p ↦ linearProcess (guerraCoeff n v) z p+d p.2)
|
| 106 |
-
∂gaussianProduct ((Fin n×Fin n)⊕(κ×κ))) = expectedMaximum n+
|
| 107 |
-
∫ z, finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z α+d α)
|
| 108 |
-
∂gaussianProduct (κ×κ) := by
|
| 109 |
-
have he := measurePreserving_sumPiEquivProdPi_symm
|
| 110 |
-
(fun _ : (Fin n×Fin n)⊕(κ×κ) ↦ standardGaussian)
|
| 111 |
-
change (∫ z, finiteMaximum (fun p ↦ linearProcess (guerraCoeff n v) z p+d p.2)
|
| 112 |
-
∂Measure.pi (fun _ : (Fin n×Fin n)⊕(κ×κ) ↦ standardGaussian)) = _
|
| 113 |
-
rw [←he.integral_comp' (fun z ↦ finiteMaximum (fun p ↦ linearProcess (guerraCoeff n v) z p+d p.2))]
|
| 114 |
-
have hlin (z : ((Fin n×Fin n) → ℝ)×((κ×κ) → ℝ)) :
|
| 115 |
-
(fun p ↦ linearProcess (guerraCoeff n v)
|
| 116 |
-
((MeasurableEquiv.sumPiEquivProdPi (fun _ : (Fin n×Fin n)⊕(κ×κ) ↦ ℝ)).symm z) p+d p.2) =
|
| 117 |
-
(fun p ↦ linearProcess (hamCoeff n) z.1 p.1+(linearProcess (leafAuxCoeff n v) z.2 p.2+d p.2)) := by
|
| 118 |
-
funext p
|
| 119 |
-
simp [linearProcess,guerraCoeff,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm,add_assoc]
|
| 120 |
-
have hm (z : ((Fin n×Fin n) → ℝ)×((κ×κ) → ℝ)) :
|
| 121 |
-
finiteMaximum (fun p : (Fin n → Bool)×Λ ↦ linearProcess (hamCoeff n) z.1 p.1+
|
| 122 |
-
(linearProcess (leafAuxCoeff n v) z.2 p.2+d p.2)) =
|
| 123 |
-
finiteMaximum (linearProcess (hamCoeff n) z.1)+
|
| 124 |
-
finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z.2 α+d α) :=
|
| 125 |
-
finiteMaximum_prod_add (linearProcess (hamCoeff n) z.1)
|
| 126 |
-
(fun α ↦ linearProcess (leafAuxCoeff n v) z.2 α+d α)
|
| 127 |
-
simp only [hlin,hm]
|
| 128 |
-
change (∫ z, finiteMaximum (linearProcess (hamCoeff n) z.1)+
|
| 129 |
-
finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z.2 α+d α)
|
| 130 |
-
∂(gaussianProduct (Fin n×Fin n)).prod (gaussianProduct (κ×κ))) = _
|
| 131 |
-
rw [integral_add ((finiteMaximum_integrable (hamCoeff n)).comp_fst _)
|
| 132 |
-
((affineMaximum_integrable (leafAuxCoeff n v) d).comp_snd _),
|
| 133 |
-
integral_fun_fst (fun z ↦ finiteMaximum (linearProcess (hamCoeff n) z)),
|
| 134 |
-
integral_fun_snd (fun z ↦ finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z α+d α))]
|
| 135 |
-
simp [expectedMaximum]
|
| 136 |
-
|
| 137 |
-
theorem finite_guerra_upper {Λ κ : Type*} [Fintype Λ] [Nonempty Λ] [Fintype κ]
|
| 138 |
-
{n : ℕ} (hn : 0<n) (v : Λ → κ → ℝ)
|
| 139 |
-
(hv : ∀ α, ∑ k, (v α k)^2=1) (d : Λ → ℝ) :
|
| 140 |
-
expectedMaximum n+
|
| 141 |
-
(∫ z, finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z α+d α)
|
| 142 |
-
∂gaussianProduct (κ×κ)) ≤
|
| 143 |
-
∫ z, finiteMaximum (fun α ↦ (∑ i, |leafField v z α i|)+d α)
|
| 144 |
-
∂gaussianProduct (Fin n×κ) := by
|
| 145 |
-
have h := expected_affine_max_le (guerraCoeff n v) (leafFieldCoeff n v)
|
| 146 |
-
(fun p ↦ d p.2) (guerra_metric_le hn v hv)
|
| 147 |
-
simpa only [expected_guerra_max,leafField_max] using h
|
| 148 |
-
|
| 149 |
-
end SKValueG
|
| 150 |
-
|
| 151 |
-
end
|
| 152 |
-
|
| 153 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.LiteralNormalizer
|
| 3 |
+
import OAI.Probability.SKValue.Control.Regularity
|
| 4 |
+
import OAI.Probability.SKValue.GroundState.RoundingSpin
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
|
| 10 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 12 |
+
namespace SKValue
|
| 13 |
+
|
| 14 |
+
theorem shiftedCoefficientSum_le_groundState (W : BrownianSpace) (γ : OrderParameter)
|
| 15 |
+
{T : ℝ} (hT : 0≤T) (hT1 : T<1) {N : ℕ} (hN : 0<N)
|
| 16 |
+
(hpos : ∀ j<N,0<∫ z,(rawCoefficient W γ T N j z)^2 ∂gaussianProduct (Fin (N+1))) :
|
| 17 |
+
shiftedCoefficientSum W γ T N≤groundStateValue := by
|
| 18 |
+
obtain ⟨Kv,Lv,K,L,D,Lu,La,hV,hG,hD,hLu,hLa,hDb,hu,ha⟩ := sourceStripRegularity W γ T ⟨hT,hT1⟩
|
| 19 |
+
rw [literal_shiftedCoefficientSum]
|
| 20 |
+
exact normalized_shifted_sum_le_groundState
|
| 21 |
+
(fun j : Fin N ↦ meshRaw T N γ.coeff (gradient W γ) j)
|
| 22 |
+
(meshTerminal T N γ.coeff (gradient W γ))
|
| 23 |
+
(fun j ↦ mesh_raw_measurable hT hG hN j.isLt.le)
|
| 24 |
+
(fun j ↦ mesh_raw_depends T j.isLt.le γ.coeff (gradient W γ))
|
| 25 |
+
(fun j ↦ mesh_raw_memLp hT hG hDb hN j.isLt.le)
|
| 26 |
+
(fun j ↦ hpos j j.isLt)
|
| 27 |
+
(mesh_terminal_measurable hT hG hN) (mesh_terminal_depends T N γ.coeff (gradient W γ))
|
| 28 |
+
|
| 29 |
+
end SKValue
|
| 30 |
+
|
| 31 |
+
end
|
| 32 |
+
|
| 33 |
+
section
|
| 34 |
+
|
| 35 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 36 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 37 |
+
namespace SKValueG
|
| 38 |
+
|
| 39 |
+
lemma finiteMaximum_prod_add {ι Λ : Type*} [Fintype ι] [Nonempty ι]
|
| 40 |
+
[Fintype Λ] [Nonempty Λ] (f : ι → ℝ) (g : Λ → ℝ) :
|
| 41 |
+
finiteMaximum (fun p : ι×Λ ↦ f p.1+g p.2)=finiteMaximum f+finiteMaximum g := by
|
| 42 |
+
apply le_antisymm
|
| 43 |
+
· obtain ⟨p,hp⟩ := exists_finiteMaximum (fun p : ι×Λ ↦ f p.1+g p.2)
|
| 44 |
+
rw [←hp]
|
| 45 |
+
exact add_le_add (le_finiteMaximum f p.1) (le_finiteMaximum g p.2)
|
| 46 |
+
· obtain ⟨i,hi⟩ := exists_finiteMaximum f
|
| 47 |
+
obtain ⟨a,ha⟩ := exists_finiteMaximum g
|
| 48 |
+
rw [←hi,←ha]
|
| 49 |
+
exact le_finiteMaximum (fun p : ι×Λ ↦ f p.1+g p.2) (i,a)
|
| 50 |
+
|
| 51 |
+
lemma finiteMaximum_prod_curry {ι Λ : Type*} [Fintype ι] [Nonempty ι]
|
| 52 |
+
[Fintype Λ] [Nonempty Λ] (f : ι×Λ → ℝ) :
|
| 53 |
+
finiteMaximum f=finiteMaximum (fun a ↦ finiteMaximum (fun i ↦ f (i,a))) := by
|
| 54 |
+
apply le_antisymm
|
| 55 |
+
· obtain ⟨p,hp⟩ := exists_finiteMaximum f
|
| 56 |
+
rw [←hp]
|
| 57 |
+
exact (le_finiteMaximum (fun i ↦ f (i,p.2)) p.1).trans
|
| 58 |
+
(le_finiteMaximum (fun a ↦ finiteMaximum (fun i ↦ f (i,a))) p.2)
|
| 59 |
+
· obtain ⟨a,ha⟩ := exists_finiteMaximum (fun a ↦ finiteMaximum (fun i ↦ f (i,a)))
|
| 60 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum (fun i ↦ f (i,a))
|
| 61 |
+
rw [←ha,←hi]
|
| 62 |
+
exact le_finiteMaximum f (i,a)
|
| 63 |
+
|
| 64 |
+
lemma spinMaximum_eq_sum_abs {ι : Type*} [Fintype ι] (x : ι → ℝ) :
|
| 65 |
+
finiteMaximum (fun σ : ι → Bool ↦ ∑ i, spin (σ i)*x i)=∑ i, |x i| := by
|
| 66 |
+
classical
|
| 67 |
+
apply le_antisymm
|
| 68 |
+
· obtain ⟨σ,hσ⟩ := exists_finiteMaximum (fun σ : ι → Bool ↦ ∑ i, spin (σ i)*x i)
|
| 69 |
+
rw [←hσ]
|
| 70 |
+
apply Finset.sum_le_sum
|
| 71 |
+
intro i _
|
| 72 |
+
calc
|
| 73 |
+
_ ≤ |spin (σ i)*x i| := le_abs_self _
|
| 74 |
+
_ = _ := by rw [abs_mul,abs_spin,one_mul]
|
| 75 |
+
· let σ : ι → Bool := fun i ↦ decide (0≤x i)
|
| 76 |
+
have he (i : ι) : spin (σ i)*x i=|x i| := by
|
| 77 |
+
by_cases h : 0≤x i
|
| 78 |
+
· simp [σ,spin,h,abs_of_nonneg h]
|
| 79 |
+
· simp [σ,spin,h,abs_of_neg (lt_of_not_ge h)]
|
| 80 |
+
simpa only [he] using le_finiteMaximum (fun σ : ι → Bool ↦ ∑ i, spin (σ i)*x i) σ
|
| 81 |
+
|
| 82 |
+
noncomputable def leafField {Λ κ : Type*} [Fintype κ] {n : ℕ}
|
| 83 |
+
(v : Λ → κ → ℝ) (z : Fin n×κ → ℝ) (α : Λ) (i : Fin n) : ℝ :=
|
| 84 |
+
∑ k, v α k*z (i,k)
|
| 85 |
+
|
| 86 |
+
lemma linearProcess_leafField {Λ κ : Type*} [Fintype κ] (n : ℕ)
|
| 87 |
+
(v : Λ → κ → ℝ) (z : Fin n×κ → ℝ) (p : (Fin n → Bool)×Λ) :
|
| 88 |
+
linearProcess (leafFieldCoeff n v) z p=∑ i, spin (p.1 i)*leafField v z p.2 i := by
|
| 89 |
+
simp only [linearProcess,leafFieldCoeff,Fintype.sum_prod_type,leafField,Finset.mul_sum]
|
| 90 |
+
apply Finset.sum_congr rfl
|
| 91 |
+
intro i _
|
| 92 |
+
apply Finset.sum_congr rfl
|
| 93 |
+
intro k _
|
| 94 |
+
ring
|
| 95 |
+
|
| 96 |
+
lemma leafField_max {Λ κ : Type*} [Fintype Λ] [Nonempty Λ] [Fintype κ]
|
| 97 |
+
(n : ℕ) (v : Λ → κ → ℝ) (d : Λ → ℝ) (z : Fin n×κ → ℝ) :
|
| 98 |
+
finiteMaximum (fun p ↦ linearProcess (leafFieldCoeff n v) z p+d p.2)=
|
| 99 |
+
finiteMaximum (fun α ↦ (∑ i, |leafField v z α i|)+d α) := by
|
| 100 |
+
rw [finiteMaximum_prod_curry]
|
| 101 |
+
simp only [linearProcess_leafField,finiteMaximum_add_const,spinMaximum_eq_sum_abs]
|
| 102 |
+
|
| 103 |
+
lemma expected_guerra_max {Λ κ : Type*} [Fintype Λ] [Nonempty Λ] [Fintype κ]
|
| 104 |
+
(n : ℕ) (v : Λ → κ → ℝ) (d : Λ → ℝ) :
|
| 105 |
+
(∫ z, finiteMaximum (fun p ↦ linearProcess (guerraCoeff n v) z p+d p.2)
|
| 106 |
+
∂gaussianProduct ((Fin n×Fin n)⊕(κ×κ))) = expectedMaximum n+
|
| 107 |
+
∫ z, finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z α+d α)
|
| 108 |
+
∂gaussianProduct (κ×κ) := by
|
| 109 |
+
have he := measurePreserving_sumPiEquivProdPi_symm
|
| 110 |
+
(fun _ : (Fin n×Fin n)⊕(κ×κ) ↦ standardGaussian)
|
| 111 |
+
change (∫ z, finiteMaximum (fun p ↦ linearProcess (guerraCoeff n v) z p+d p.2)
|
| 112 |
+
∂Measure.pi (fun _ : (Fin n×Fin n)⊕(κ×κ) ↦ standardGaussian)) = _
|
| 113 |
+
rw [←he.integral_comp' (fun z ↦ finiteMaximum (fun p ↦ linearProcess (guerraCoeff n v) z p+d p.2))]
|
| 114 |
+
have hlin (z : ((Fin n×Fin n) → ℝ)×((κ×κ) → ℝ)) :
|
| 115 |
+
(fun p ↦ linearProcess (guerraCoeff n v)
|
| 116 |
+
((MeasurableEquiv.sumPiEquivProdPi (fun _ : (Fin n×Fin n)⊕(κ×κ) ↦ ℝ)).symm z) p+d p.2) =
|
| 117 |
+
(fun p ↦ linearProcess (hamCoeff n) z.1 p.1+(linearProcess (leafAuxCoeff n v) z.2 p.2+d p.2)) := by
|
| 118 |
+
funext p
|
| 119 |
+
simp [linearProcess,guerraCoeff,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm,add_assoc]
|
| 120 |
+
have hm (z : ((Fin n×Fin n) → ℝ)×((κ×κ) → ℝ)) :
|
| 121 |
+
finiteMaximum (fun p : (Fin n → Bool)×Λ ↦ linearProcess (hamCoeff n) z.1 p.1+
|
| 122 |
+
(linearProcess (leafAuxCoeff n v) z.2 p.2+d p.2)) =
|
| 123 |
+
finiteMaximum (linearProcess (hamCoeff n) z.1)+
|
| 124 |
+
finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z.2 α+d α) :=
|
| 125 |
+
finiteMaximum_prod_add (linearProcess (hamCoeff n) z.1)
|
| 126 |
+
(fun α ↦ linearProcess (leafAuxCoeff n v) z.2 α+d α)
|
| 127 |
+
simp only [hlin,hm]
|
| 128 |
+
change (∫ z, finiteMaximum (linearProcess (hamCoeff n) z.1)+
|
| 129 |
+
finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z.2 α+d α)
|
| 130 |
+
∂(gaussianProduct (Fin n×Fin n)).prod (gaussianProduct (κ×κ))) = _
|
| 131 |
+
rw [integral_add ((finiteMaximum_integrable (hamCoeff n)).comp_fst _)
|
| 132 |
+
((affineMaximum_integrable (leafAuxCoeff n v) d).comp_snd _),
|
| 133 |
+
integral_fun_fst (fun z ↦ finiteMaximum (linearProcess (hamCoeff n) z)),
|
| 134 |
+
integral_fun_snd (fun z ↦ finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z α+d α))]
|
| 135 |
+
simp [expectedMaximum]
|
| 136 |
+
|
| 137 |
+
theorem finite_guerra_upper {Λ κ : Type*} [Fintype Λ] [Nonempty Λ] [Fintype κ]
|
| 138 |
+
{n : ℕ} (hn : 0<n) (v : Λ → κ → ℝ)
|
| 139 |
+
(hv : ∀ α, ∑ k, (v α k)^2=1) (d : Λ → ℝ) :
|
| 140 |
+
expectedMaximum n+
|
| 141 |
+
(∫ z, finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n v) z α+d α)
|
| 142 |
+
∂gaussianProduct (κ×κ)) ≤
|
| 143 |
+
∫ z, finiteMaximum (fun α ↦ (∑ i, |leafField v z α i|)+d α)
|
| 144 |
+
∂gaussianProduct (Fin n×κ) := by
|
| 145 |
+
have h := expected_affine_max_le (guerraCoeff n v) (leafFieldCoeff n v)
|
| 146 |
+
(fun p ↦ d p.2) (guerra_metric_le hn v hv)
|
| 147 |
+
simpa only [expected_guerra_max,leafField_max] using h
|
| 148 |
+
|
| 149 |
+
end SKValueG
|
| 150 |
+
|
| 151 |
+
end
|
| 152 |
+
|
| 153 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/LogComparison.lean
CHANGED
|
@@ -1,165 +1,165 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.RotatedCoefficients
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
|
| 12 |
-
lemma expected_logPartition_reindex {ι κ ν : Type*} [Fintype ι] [Fintype κ]
|
| 13 |
-
[Fintype ν] (e : κ ≃ ν) (a : ι → κ → ℝ) :
|
| 14 |
-
(∫ z, logPartition (linearProcess (fun i k ↦ a i (e.symm k)) z)
|
| 15 |
-
∂gaussianProduct ν) = ∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ := by
|
| 16 |
-
simpa only [linearProcess_reindex] using gaussian_integral_reindex e
|
| 17 |
-
(fun z ↦ logPartition (linearProcess a z))
|
| 18 |
-
|
| 19 |
-
lemma expected_logPartition_le_orthogonal {ι κ : Type*}
|
| 20 |
-
[Fintype ι] [Nonempty ι] [Fintype κ] (a b : ι → κ → ℝ)
|
| 21 |
-
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 22 |
-
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 23 |
-
(∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 24 |
-
∫ z, logPartition (linearProcess b z) ∂gaussianProduct κ := by
|
| 25 |
-
let e := Fintype.equivFin κ
|
| 26 |
-
have h := expected_logPartition_le_of_pair_distances
|
| 27 |
-
(fun i k ↦ a i (e.symm k)) (fun i k ↦ b i (e.symm k))
|
| 28 |
-
(fun i j ↦ by
|
| 29 |
-
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)*(b i k-b j k))]
|
| 30 |
-
exact horth i j)
|
| 31 |
-
(fun i j ↦ by
|
| 32 |
-
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)^2),
|
| 33 |
-
e.symm.sum_comp (fun k ↦ (b i k-b j k)^2)]
|
| 34 |
-
exact hdist i j)
|
| 35 |
-
simpa only [expected_logPartition_reindex] using h
|
| 36 |
-
|
| 37 |
-
lemma expected_logPartition_embedLeft {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]
|
| 38 |
-
(a : ι → κ → ℝ) :
|
| 39 |
-
(∫ z, logPartition (linearProcess (embedLeft (ν := ν) a) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 40 |
-
∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ := by
|
| 41 |
-
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ⊕ ν ↦ standardGaussian)
|
| 42 |
-
change (∫ z, logPartition (linearProcess (embedLeft a) z)
|
| 43 |
-
∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 44 |
-
rw [← he.integral_comp' (fun z ↦ logPartition (linearProcess (embedLeft a) z))]
|
| 45 |
-
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 46 |
-
linearProcess (embedLeft a) ((MeasurableEquiv.sumPiEquivProdPi
|
| 47 |
-
(fun _ : κ ⊕ ν ↦ ℝ)).symm p) = linearProcess a p.1 := by
|
| 48 |
-
funext i
|
| 49 |
-
simp [linearProcess,embedLeft,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 50 |
-
simp only [hlin]
|
| 51 |
-
simpa [gaussianProduct] using integral_fun_fst (μ := gaussianProduct κ)
|
| 52 |
-
(ν := gaussianProduct ν) (fun z ↦ logPartition (linearProcess a z))
|
| 53 |
-
|
| 54 |
-
lemma expected_logPartition_embedRight {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]
|
| 55 |
-
(b : ι → ν → ℝ) :
|
| 56 |
-
(∫ z, logPartition (linearProcess (embedRight (κ := κ) b) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 57 |
-
∫ z, logPartition (linearProcess b z) ∂gaussianProduct ν := by
|
| 58 |
-
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ⊕ ν ↦ standardGaussian)
|
| 59 |
-
change (∫ z, logPartition (linearProcess (embedRight b) z)
|
| 60 |
-
∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 61 |
-
rw [← he.integral_comp' (fun z ↦ logPartition (linearProcess (embedRight b) z))]
|
| 62 |
-
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 63 |
-
linearProcess (embedRight b) ((MeasurableEquiv.sumPiEquivProdPi
|
| 64 |
-
(fun _ : κ ⊕ ν ↦ ℝ)).symm p) = linearProcess b p.2 := by
|
| 65 |
-
funext i
|
| 66 |
-
simp [linearProcess,embedRight,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 67 |
-
simp only [hlin]
|
| 68 |
-
simpa [gaussianProduct] using integral_fun_snd (μ := gaussianProduct κ)
|
| 69 |
-
(ν := gaussianProduct ν) (fun z ↦ logPartition (linearProcess b z))
|
| 70 |
-
|
| 71 |
-
lemma expected_logPartition_le {ι κ ν : Type*}
|
| 72 |
-
[Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 73 |
-
(a : ι → κ → ℝ) (b : ι → ν → ℝ)
|
| 74 |
-
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 75 |
-
(∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 76 |
-
∫ z, logPartition (linearProcess b z) ∂gaussianProduct ν := by
|
| 77 |
-
have h := expected_logPartition_le_orthogonal
|
| 78 |
-
(embedLeft (ν := ν) a) (embedRight (κ := κ) b)
|
| 79 |
-
(fun i j ↦ by simp [embedLeft,embedRight,Fintype.sum_sum_type])
|
| 80 |
-
(fun i j ↦ by simpa only [Fintype.sum_sum_type,embedLeft,embedRight,
|
| 81 |
-
Sum.elim_inl,Sum.elim_inr,sub_self,zero_pow (by decide : 2 ≠ 0),
|
| 82 |
-
Finset.sum_const_zero,zero_add,add_zero] using hdist i j)
|
| 83 |
-
simpa only [expected_logPartition_embedLeft,expected_logPartition_embedRight] using h
|
| 84 |
-
|
| 85 |
-
end SKValueG
|
| 86 |
-
|
| 87 |
-
end
|
| 88 |
-
|
| 89 |
-
section
|
| 90 |
-
|
| 91 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 92 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 93 |
-
namespace SKValueG
|
| 94 |
-
|
| 95 |
-
lemma finiteMaximum_mono {ι : Type*} [Fintype ι] [Nonempty ι] {x y : ι → ℝ}
|
| 96 |
-
(h : ∀ i, x i ≤ y i) : finiteMaximum x ≤ finiteMaximum y := by
|
| 97 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 98 |
-
rw [← hi]
|
| 99 |
-
exact (h i).trans (le_finiteMaximum y i)
|
| 100 |
-
|
| 101 |
-
lemma finiteMaximum_add_const {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 102 |
-
(x : ι → ℝ) (c : ℝ) : finiteMaximum (fun i ↦ x i+c)=finiteMaximum x+c := by
|
| 103 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 104 |
-
obtain ⟨j,hj⟩ := exists_finiteMaximum (fun i ↦ x i+c)
|
| 105 |
-
apply le_antisymm
|
| 106 |
-
· rw [← hj]
|
| 107 |
-
linarith [le_finiteMaximum x j]
|
| 108 |
-
· rw [← hi]
|
| 109 |
-
exact le_finiteMaximum (fun i ↦ x i+c) i
|
| 110 |
-
|
| 111 |
-
lemma affineMaximum_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 112 |
-
(a : ι → κ → ℝ) (d : ι → ℝ) :
|
| 113 |
-
Integrable (fun z ↦ finiteMaximum (fun i ↦ linearProcess a z i+d i)) (gaussianProduct κ) := by
|
| 114 |
-
apply (integrable_finsetSum Finset.univ (fun i _ ↦
|
| 115 |
-
((linearProcess_integrable a i).add (integrable_const (d i))).abs)).mono'
|
| 116 |
-
· exact (continuous_finiteMaximum.comp ((continuous_linearProcess a).add continuous_const)).aestronglyMeasurable
|
| 117 |
-
· exact Eventually.of_forall (fun z ↦ by
|
| 118 |
-
simpa only [Real.norm_eq_abs,Pi.add_apply] using abs_finiteMaximum_le
|
| 119 |
-
(fun i ↦ linearProcess a z i + d i))
|
| 120 |
-
|
| 121 |
-
lemma replicated_partition_bounds {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 122 |
-
(x d : ι → ℝ) (β : ℝ) (hβ : 0≤β) (m : ι → ℕ)
|
| 123 |
-
(hl : ∀ i, Real.exp (β*d i) ≤ (m i : ℝ))
|
| 124 |
-
(hu : ∀ i, (m i : ℝ) ≤ 2*Real.exp (β*d i)) :
|
| 125 |
-
β*finiteMaximum (fun i ↦ x i+d i) ≤
|
| 126 |
-
logPartition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) ∧
|
| 127 |
-
logPartition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) ≤
|
| 128 |
-
β*finiteMaximum (fun i ↦ x i+d i)+Real.log (2*(Fintype.card ι : ℝ)) := by
|
| 129 |
-
have hp : partition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) =
|
| 130 |
-
∑ i, (m i : ℝ)*Real.exp (β*x i) := by
|
| 131 |
-
simp [partition,Fintype.sum_sigma]
|
| 132 |
-
have hlo : Real.exp (β*finiteMaximum (fun i ↦ x i+d i)) ≤
|
| 133 |
-
partition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) := by
|
| 134 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum (fun i ↦ x i+d i)
|
| 135 |
-
rw [← hi,hp]
|
| 136 |
-
calc
|
| 137 |
-
_ = Real.exp (β*d i)*Real.exp (β*x i) := by rw [←Real.exp_add]; congr 1; ring
|
| 138 |
-
_ ≤ (m i : ℝ)*Real.exp (β*x i) := mul_le_mul_of_nonneg_right (hl i) (Real.exp_pos _).le
|
| 139 |
-
_ ≤ _ := Finset.single_le_sum (f := fun j ↦ (m j : ℝ)*Real.exp (β*x j)) (fun j _ ↦ by positivity) (Finset.mem_univ i)
|
| 140 |
-
have hup : partition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) ≤
|
| 141 |
-
2*(Fintype.card ι : ℝ)*Real.exp (β*finiteMaximum (fun i ↦ x i+d i)) := by
|
| 142 |
-
rw [hp]
|
| 143 |
-
calc
|
| 144 |
-
_ ≤ ∑ i : ι, 2*Real.exp (β*finiteMaximum (fun i ↦ x i+d i)) := by
|
| 145 |
-
apply Finset.sum_le_sum
|
| 146 |
-
intro i _
|
| 147 |
-
calc
|
| 148 |
-
_ ≤ 2*Real.exp (β*d i)*Real.exp (β*x i) :=
|
| 149 |
-
mul_le_mul_of_nonneg_right (hu i) (Real.exp_pos _).le
|
| 150 |
-
_ = 2*Real.exp (β*(x i+d i)) := by rw [mul_assoc,←Real.exp_add]; congr 2; ring
|
| 151 |
-
_ ≤ _ := mul_le_mul_of_nonneg_left
|
| 152 |
-
(Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (le_finiteMaximum (fun i ↦ x i+d i) i) hβ)) (by norm_num)
|
| 153 |
-
_ = _ := by simp; ring
|
| 154 |
-
refine ⟨?_,?_⟩
|
| 155 |
-
· simpa only [Real.log_exp,logPartition] using Real.log_le_log (Real.exp_pos _) hlo
|
| 156 |
-
· have hc : 0<2*(Fintype.card ι : ℝ) := by positivity
|
| 157 |
-
have hh := Real.log_le_log ((Real.exp_pos _).trans_le hlo) hup
|
| 158 |
-
simpa only [logPartition,Real.log_mul hc.ne' (Real.exp_pos _).ne',
|
| 159 |
-
Real.log_exp,add_comm] using hh
|
| 160 |
-
|
| 161 |
-
end SKValueG
|
| 162 |
-
|
| 163 |
-
end
|
| 164 |
-
|
| 165 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.RotatedCoefficients
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
|
| 12 |
+
lemma expected_logPartition_reindex {ι κ ν : Type*} [Fintype ι] [Fintype κ]
|
| 13 |
+
[Fintype ν] (e : κ ≃ ν) (a : ι → κ → ℝ) :
|
| 14 |
+
(∫ z, logPartition (linearProcess (fun i k ↦ a i (e.symm k)) z)
|
| 15 |
+
∂gaussianProduct ν) = ∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ := by
|
| 16 |
+
simpa only [linearProcess_reindex] using gaussian_integral_reindex e
|
| 17 |
+
(fun z ↦ logPartition (linearProcess a z))
|
| 18 |
+
|
| 19 |
+
lemma expected_logPartition_le_orthogonal {ι κ : Type*}
|
| 20 |
+
[Fintype ι] [Nonempty ι] [Fintype κ] (a b : ι → κ → ℝ)
|
| 21 |
+
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 22 |
+
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 23 |
+
(∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 24 |
+
∫ z, logPartition (linearProcess b z) ∂gaussianProduct κ := by
|
| 25 |
+
let e := Fintype.equivFin κ
|
| 26 |
+
have h := expected_logPartition_le_of_pair_distances
|
| 27 |
+
(fun i k ↦ a i (e.symm k)) (fun i k ↦ b i (e.symm k))
|
| 28 |
+
(fun i j ↦ by
|
| 29 |
+
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)*(b i k-b j k))]
|
| 30 |
+
exact horth i j)
|
| 31 |
+
(fun i j ↦ by
|
| 32 |
+
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)^2),
|
| 33 |
+
e.symm.sum_comp (fun k ↦ (b i k-b j k)^2)]
|
| 34 |
+
exact hdist i j)
|
| 35 |
+
simpa only [expected_logPartition_reindex] using h
|
| 36 |
+
|
| 37 |
+
lemma expected_logPartition_embedLeft {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]
|
| 38 |
+
(a : ι → κ → ℝ) :
|
| 39 |
+
(∫ z, logPartition (linearProcess (embedLeft (ν := ν) a) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 40 |
+
∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ := by
|
| 41 |
+
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ⊕ ν ↦ standardGaussian)
|
| 42 |
+
change (∫ z, logPartition (linearProcess (embedLeft a) z)
|
| 43 |
+
∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 44 |
+
rw [← he.integral_comp' (fun z ↦ logPartition (linearProcess (embedLeft a) z))]
|
| 45 |
+
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 46 |
+
linearProcess (embedLeft a) ((MeasurableEquiv.sumPiEquivProdPi
|
| 47 |
+
(fun _ : κ ⊕ ν ↦ ℝ)).symm p) = linearProcess a p.1 := by
|
| 48 |
+
funext i
|
| 49 |
+
simp [linearProcess,embedLeft,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 50 |
+
simp only [hlin]
|
| 51 |
+
simpa [gaussianProduct] using integral_fun_fst (μ := gaussianProduct κ)
|
| 52 |
+
(ν := gaussianProduct ν) (fun z ↦ logPartition (linearProcess a z))
|
| 53 |
+
|
| 54 |
+
lemma expected_logPartition_embedRight {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]
|
| 55 |
+
(b : ι → ν → ℝ) :
|
| 56 |
+
(∫ z, logPartition (linearProcess (embedRight (κ := κ) b) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 57 |
+
∫ z, logPartition (linearProcess b z) ∂gaussianProduct ν := by
|
| 58 |
+
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ⊕ ν ↦ standardGaussian)
|
| 59 |
+
change (∫ z, logPartition (linearProcess (embedRight b) z)
|
| 60 |
+
∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 61 |
+
rw [← he.integral_comp' (fun z ↦ logPartition (linearProcess (embedRight b) z))]
|
| 62 |
+
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 63 |
+
linearProcess (embedRight b) ((MeasurableEquiv.sumPiEquivProdPi
|
| 64 |
+
(fun _ : κ ⊕ ν ↦ ℝ)).symm p) = linearProcess b p.2 := by
|
| 65 |
+
funext i
|
| 66 |
+
simp [linearProcess,embedRight,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 67 |
+
simp only [hlin]
|
| 68 |
+
simpa [gaussianProduct] using integral_fun_snd (μ := gaussianProduct κ)
|
| 69 |
+
(ν := gaussianProduct ν) (fun z ↦ logPartition (linearProcess b z))
|
| 70 |
+
|
| 71 |
+
lemma expected_logPartition_le {ι κ ν : Type*}
|
| 72 |
+
[Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 73 |
+
(a : ι → κ → ℝ) (b : ι → ν → ℝ)
|
| 74 |
+
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 75 |
+
(∫ z, logPartition (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 76 |
+
∫ z, logPartition (linearProcess b z) ∂gaussianProduct ν := by
|
| 77 |
+
have h := expected_logPartition_le_orthogonal
|
| 78 |
+
(embedLeft (ν := ν) a) (embedRight (κ := κ) b)
|
| 79 |
+
(fun i j ↦ by simp [embedLeft,embedRight,Fintype.sum_sum_type])
|
| 80 |
+
(fun i j ↦ by simpa only [Fintype.sum_sum_type,embedLeft,embedRight,
|
| 81 |
+
Sum.elim_inl,Sum.elim_inr,sub_self,zero_pow (by decide : 2 ≠ 0),
|
| 82 |
+
Finset.sum_const_zero,zero_add,add_zero] using hdist i j)
|
| 83 |
+
simpa only [expected_logPartition_embedLeft,expected_logPartition_embedRight] using h
|
| 84 |
+
|
| 85 |
+
end SKValueG
|
| 86 |
+
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
section
|
| 90 |
+
|
| 91 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 92 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 93 |
+
namespace SKValueG
|
| 94 |
+
|
| 95 |
+
lemma finiteMaximum_mono {ι : Type*} [Fintype ι] [Nonempty ι] {x y : ι → ℝ}
|
| 96 |
+
(h : ∀ i, x i ≤ y i) : finiteMaximum x ≤ finiteMaximum y := by
|
| 97 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 98 |
+
rw [← hi]
|
| 99 |
+
exact (h i).trans (le_finiteMaximum y i)
|
| 100 |
+
|
| 101 |
+
lemma finiteMaximum_add_const {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 102 |
+
(x : ι → ℝ) (c : ℝ) : finiteMaximum (fun i ↦ x i+c)=finiteMaximum x+c := by
|
| 103 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 104 |
+
obtain ⟨j,hj⟩ := exists_finiteMaximum (fun i ↦ x i+c)
|
| 105 |
+
apply le_antisymm
|
| 106 |
+
· rw [← hj]
|
| 107 |
+
linarith [le_finiteMaximum x j]
|
| 108 |
+
· rw [← hi]
|
| 109 |
+
exact le_finiteMaximum (fun i ↦ x i+c) i
|
| 110 |
+
|
| 111 |
+
lemma affineMaximum_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 112 |
+
(a : ι → κ → ℝ) (d : ι → ℝ) :
|
| 113 |
+
Integrable (fun z ↦ finiteMaximum (fun i ↦ linearProcess a z i+d i)) (gaussianProduct κ) := by
|
| 114 |
+
apply (integrable_finsetSum Finset.univ (fun i _ ↦
|
| 115 |
+
((linearProcess_integrable a i).add (integrable_const (d i))).abs)).mono'
|
| 116 |
+
· exact (continuous_finiteMaximum.comp ((continuous_linearProcess a).add continuous_const)).aestronglyMeasurable
|
| 117 |
+
· exact Eventually.of_forall (fun z ↦ by
|
| 118 |
+
simpa only [Real.norm_eq_abs,Pi.add_apply] using abs_finiteMaximum_le
|
| 119 |
+
(fun i ↦ linearProcess a z i + d i))
|
| 120 |
+
|
| 121 |
+
lemma replicated_partition_bounds {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 122 |
+
(x d : ι → ℝ) (β : ℝ) (hβ : 0≤β) (m : ι → ℕ)
|
| 123 |
+
(hl : ∀ i, Real.exp (β*d i) ≤ (m i : ℝ))
|
| 124 |
+
(hu : ∀ i, (m i : ℝ) ≤ 2*Real.exp (β*d i)) :
|
| 125 |
+
β*finiteMaximum (fun i ↦ x i+d i) ≤
|
| 126 |
+
logPartition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) ∧
|
| 127 |
+
logPartition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) ≤
|
| 128 |
+
β*finiteMaximum (fun i ↦ x i+d i)+Real.log (2*(Fintype.card ι : ℝ)) := by
|
| 129 |
+
have hp : partition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) =
|
| 130 |
+
∑ i, (m i : ℝ)*Real.exp (β*x i) := by
|
| 131 |
+
simp [partition,Fintype.sum_sigma]
|
| 132 |
+
have hlo : Real.exp (β*finiteMaximum (fun i ↦ x i+d i)) ≤
|
| 133 |
+
partition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) := by
|
| 134 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum (fun i ↦ x i+d i)
|
| 135 |
+
rw [← hi,hp]
|
| 136 |
+
calc
|
| 137 |
+
_ = Real.exp (β*d i)*Real.exp (β*x i) := by rw [←Real.exp_add]; congr 1; ring
|
| 138 |
+
_ ≤ (m i : ℝ)*Real.exp (β*x i) := mul_le_mul_of_nonneg_right (hl i) (Real.exp_pos _).le
|
| 139 |
+
_ ≤ _ := Finset.single_le_sum (f := fun j ↦ (m j : ℝ)*Real.exp (β*x j)) (fun j _ ↦ by positivity) (Finset.mem_univ i)
|
| 140 |
+
have hup : partition (fun i : (Σ i, Fin (m i)) ↦ β*x i.1) ≤
|
| 141 |
+
2*(Fintype.card ι : ℝ)*Real.exp (β*finiteMaximum (fun i ↦ x i+d i)) := by
|
| 142 |
+
rw [hp]
|
| 143 |
+
calc
|
| 144 |
+
_ ≤ ∑ i : ι, 2*Real.exp (β*finiteMaximum (fun i ↦ x i+d i)) := by
|
| 145 |
+
apply Finset.sum_le_sum
|
| 146 |
+
intro i _
|
| 147 |
+
calc
|
| 148 |
+
_ ≤ 2*Real.exp (β*d i)*Real.exp (β*x i) :=
|
| 149 |
+
mul_le_mul_of_nonneg_right (hu i) (Real.exp_pos _).le
|
| 150 |
+
_ = 2*Real.exp (β*(x i+d i)) := by rw [mul_assoc,←Real.exp_add]; congr 2; ring
|
| 151 |
+
_ ≤ _ := mul_le_mul_of_nonneg_left
|
| 152 |
+
(Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (le_finiteMaximum (fun i ↦ x i+d i) i) hβ)) (by norm_num)
|
| 153 |
+
_ = _ := by simp; ring
|
| 154 |
+
refine ⟨?_,?_⟩
|
| 155 |
+
· simpa only [Real.log_exp,logPartition] using Real.log_le_log (Real.exp_pos _) hlo
|
| 156 |
+
· have hc : 0<2*(Fintype.card ι : ℝ) := by positivity
|
| 157 |
+
have hh := Real.log_le_log ((Real.exp_pos _).trans_le hlo) hup
|
| 158 |
+
simpa only [logPartition,Real.log_mul hc.ne' (Real.exp_pos _).ne',
|
| 159 |
+
Real.log_exp,add_comm] using hh
|
| 160 |
+
|
| 161 |
+
end SKValueG
|
| 162 |
+
|
| 163 |
+
end
|
| 164 |
+
|
| 165 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/MainConclusions.lean
CHANGED
|
@@ -1,32 +1,32 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Variation.MinimizerContact
|
| 3 |
-
import OAI.Probability.SKValue.Variation.ContactAssembly
|
| 4 |
-
import OAI.Probability.SKValue.Processes.DiffusionExistence
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
-
open scoped Topology NNReal
|
| 11 |
-
namespace SKValue
|
| 12 |
-
|
| 13 |
-
theorem scalar_value_target (W:BrownianSpace) (γ:OrderParameter) (X:ℝ → W.Ω → ℝ)
|
| 14 |
-
(hmin:IsMinimizer W γ) (hX:IsDiffusion W γ X):ScalarValueConclusion W γ X :=
|
| 15 |
-
hX.scalar_value_of_contact (hmin.gradient_moment_contact hX)
|
| 16 |
-
|
| 17 |
-
theorem finite_gaussian_target (W:BrownianSpace) (γ:OrderParameter) (X:ℝ → W.Ω → ℝ)
|
| 18 |
-
(T:ℝ) (hT:0<T) (hT1:T<1) (hmin:IsMinimizer W γ) (hX:IsDiffusion W γ X):
|
| 19 |
-
FiniteGaussianConclusion W γ X T :=
|
| 20 |
-
hX.finite_gaussian_of_contact (hmin.gradient_moment_contact hX) hT hT1
|
| 21 |
-
lemma IsMinimizer.ground_state_parisi_of_diffusion {W:BrownianSpace} {γ:OrderParameter} {X:ℝ → W.Ω → ℝ}
|
| 22 |
-
(hmin:IsMinimizer W γ) (hX:IsDiffusion W γ X):groundStateValue=parisi W γ :=
|
| 23 |
-
hX.groundState_eq_parisi_of_contact (hmin.gradient_moment_contact hX)
|
| 24 |
-
|
| 25 |
-
theorem ground_state_parisi_target (W:BrownianSpace) (γ:OrderParameter)
|
| 26 |
-
(hmin:IsMinimizer W γ):groundStateValue=parisi W γ :=
|
| 27 |
-
hmin.ground_state_parisi_of_diffusion (diffusionProcess_isDiffusion W γ)
|
| 28 |
-
end SKValue
|
| 29 |
-
|
| 30 |
-
end
|
| 31 |
-
|
| 32 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Variation.MinimizerContact
|
| 3 |
+
import OAI.Probability.SKValue.Variation.ContactAssembly
|
| 4 |
+
import OAI.Probability.SKValue.Processes.DiffusionExistence
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
+
open scoped Topology NNReal
|
| 11 |
+
namespace SKValue
|
| 12 |
+
|
| 13 |
+
theorem scalar_value_target (W:BrownianSpace) (γ:OrderParameter) (X:ℝ → W.Ω → ℝ)
|
| 14 |
+
(hmin:IsMinimizer W γ) (hX:IsDiffusion W γ X):ScalarValueConclusion W γ X :=
|
| 15 |
+
hX.scalar_value_of_contact (hmin.gradient_moment_contact hX)
|
| 16 |
+
|
| 17 |
+
theorem finite_gaussian_target (W:BrownianSpace) (γ:OrderParameter) (X:ℝ → W.Ω → ℝ)
|
| 18 |
+
(T:ℝ) (hT:0<T) (hT1:T<1) (hmin:IsMinimizer W γ) (hX:IsDiffusion W γ X):
|
| 19 |
+
FiniteGaussianConclusion W γ X T :=
|
| 20 |
+
hX.finite_gaussian_of_contact (hmin.gradient_moment_contact hX) hT hT1
|
| 21 |
+
lemma IsMinimizer.ground_state_parisi_of_diffusion {W:BrownianSpace} {γ:OrderParameter} {X:ℝ → W.Ω → ℝ}
|
| 22 |
+
(hmin:IsMinimizer W γ) (hX:IsDiffusion W γ X):groundStateValue=parisi W γ :=
|
| 23 |
+
hX.groundState_eq_parisi_of_contact (hmin.gradient_moment_contact hX)
|
| 24 |
+
|
| 25 |
+
theorem ground_state_parisi_target (W:BrownianSpace) (γ:OrderParameter)
|
| 26 |
+
(hmin:IsMinimizer W γ):groundStateValue=parisi W γ :=
|
| 27 |
+
hmin.ground_state_parisi_of_diffusion (diffusionProcess_isDiffusion W γ)
|
| 28 |
+
end SKValue
|
| 29 |
+
|
| 30 |
+
end
|
| 31 |
+
|
| 32 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/PredictableNormalizer.lean
CHANGED
|
@@ -1,294 +1,294 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Model
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Set
|
| 9 |
-
open scoped ENNReal NNReal BigOperators
|
| 10 |
-
namespace SKValue
|
| 11 |
-
|
| 12 |
-
lemma independent_of_coordinate_not_in {ι β : Type*} [Fintype ι] [DecidableEq ι]
|
| 13 |
-
[MeasurableSpace β]
|
| 14 |
-
{μ : ι → Measure ℝ} [∀ i, IsProbabilityMeasure (μ i)]
|
| 15 |
-
(S : Finset ι) {j : ι} (hj : j ∉ S) {F : (ι → ℝ) → β}
|
| 16 |
-
(hF : Measurable F)
|
| 17 |
-
(hdep : ∀ x y, (∀ i ∈ S, x i=y i) → F x=F y) :
|
| 18 |
-
IndepFun F (fun x ↦ x j) (Measure.pi μ) := by
|
| 19 |
-
let fill : (S → ℝ) → ι → ℝ := fun x i ↦ if hi : i ∈ S then x ⟨i,hi⟩ else 0
|
| 20 |
-
have hfill : Measurable fill := by
|
| 21 |
-
apply Measurable.of_eval
|
| 22 |
-
intro i
|
| 23 |
-
by_cases hi : i ∈ S
|
| 24 |
-
· simpa only [fill, dite_eq_left hi] using (measurable_pi_apply (⟨i,hi⟩ : S))
|
| 25 |
-
· simp only [fill, dite_eq_right hi]
|
| 26 |
-
exact measurable_const
|
| 27 |
-
have hid : ∀ x : ι → ℝ, F (fill (fun i : S ↦ x i)) = F x := by
|
| 28 |
-
intro x
|
| 29 |
-
apply hdep
|
| 30 |
-
intro i hi
|
| 31 |
-
simp [fill,hi]
|
| 32 |
-
have hST : Disjoint S {j} := by simpa using hj
|
| 33 |
-
have hind : iIndepFun (fun i (x : ι → ℝ) ↦ x i) (Measure.pi μ) :=
|
| 34 |
-
iIndepFun_pi (fun i ↦ (measurable_id : Measurable (id : ℝ → ℝ)).aemeasurable)
|
| 35 |
-
have H := (hind.indepFun_finset S {j} hST (fun i ↦ measurable_pi_apply i)).comp
|
| 36 |
-
(hF.comp hfill) (measurable_pi_apply (⟨j,by simp⟩ : ({j} : Finset ι)))
|
| 37 |
-
simpa only [Function.comp_def, hid] using H
|
| 38 |
-
|
| 39 |
-
lemma measurable_coordinate (N j : ℕ) : Measurable (coordinate N j) :=
|
| 40 |
-
measurable_pi_apply _
|
| 41 |
-
|
| 42 |
-
lemma coordinate_eq_apply {N j : ℕ} (hj : j < N+1) (z : Fin (N+1) → ℝ) :
|
| 43 |
-
coordinate N j z = z ⟨j,hj⟩ := by
|
| 44 |
-
simp [coordinate, Nat.mod_eq_of_lt hj]
|
| 45 |
-
|
| 46 |
-
lemma euler_depends_on_past (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 47 |
-
(j : ℕ) (z z' : Fin (N+1) → ℝ)
|
| 48 |
-
(h : ∀ i < j, coordinate N i z=coordinate N i z') :
|
| 49 |
-
euler T N γ u z j=euler T N γ u z' j := by
|
| 50 |
-
induction j with
|
| 51 |
-
| zero => rfl
|
| 52 |
-
| succ j ih =>
|
| 53 |
-
have hp := ih (fun i hi ↦ h i (by omega))
|
| 54 |
-
simp only [euler, hp,h j (by omega)]
|
| 55 |
-
|
| 56 |
-
lemma measurable_euler (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 57 |
-
(hU : ∀ k < N, Measurable (u (meshTime T N k))) :
|
| 58 |
-
∀ j ≤ N, Measurable (fun z ↦ euler T N γ u z j) := by
|
| 59 |
-
intro j hj
|
| 60 |
-
induction j with
|
| 61 |
-
| zero => exact measurable_const
|
| 62 |
-
| succ j ih =>
|
| 63 |
-
have hjN : j < N := by omega
|
| 64 |
-
have hy := ih (by omega)
|
| 65 |
-
have hz := measurable_coordinate N j
|
| 66 |
-
have hu := (hU j hjN).comp hy
|
| 67 |
-
simp only [euler]
|
| 68 |
-
fun_prop
|
| 69 |
-
|
| 70 |
-
lemma euler_coefficient_independent {T : ℝ} {N j : ℕ} {γ : ℝ → ℝ}
|
| 71 |
-
{u a : ℝ → ℝ → ℝ} (hj : j < N+1)
|
| 72 |
-
(hU : ∀ k < N, Measurable (u (meshTime T N k)))
|
| 73 |
-
(hA : Measurable (a (meshTime T N j))) :
|
| 74 |
-
IndepFun (fun z ↦ a (meshTime T N j) (euler T N γ u z j))
|
| 75 |
-
(coordinate N j) (gaussianProduct (Fin (N+1))) := by
|
| 76 |
-
let S : Finset (Fin (N+1)) := Finset.univ.filter (fun i ↦ (i : ℕ)<j)
|
| 77 |
-
have hjS : (⟨j,hj⟩ : Fin (N+1)) ∉ S := by simp [S]
|
| 78 |
-
have hF : Measurable (fun z ↦ a (meshTime T N j) (euler T N γ u z j)) :=
|
| 79 |
-
hA.comp (measurable_euler T N γ u hU j (by omega))
|
| 80 |
-
have h := independent_of_coordinate_not_in (μ := fun _ : Fin (N+1) ↦ standardGaussian)
|
| 81 |
-
S hjS hF
|
| 82 |
-
(fun z z' heq ↦ by
|
| 83 |
-
apply congrArg (a (meshTime T N j))
|
| 84 |
-
apply euler_depends_on_past T N γ u j z z'
|
| 85 |
-
intro i hi
|
| 86 |
-
have hiN : i < N+1 := hi.trans hj
|
| 87 |
-
rw [coordinate_eq_apply hiN,coordinate_eq_apply hiN]
|
| 88 |
-
apply heq
|
| 89 |
-
simp [S,hi])
|
| 90 |
-
have heq : coordinate N j = fun z : Fin (N+1) → ℝ ↦ z ⟨j,hj⟩ :=
|
| 91 |
-
funext (coordinate_eq_apply hj)
|
| 92 |
-
rw [heq]
|
| 93 |
-
exact h
|
| 94 |
-
|
| 95 |
-
variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 96 |
-
|
| 97 |
-
lemma gaussian_mean {Z : Ω → ℝ} (hZ : HasLaw Z (gaussianReal 0 1) μ) :
|
| 98 |
-
∫ ω, Z ω ∂μ = 0 := by
|
| 99 |
-
rw [hZ.integral_eq, integral_id_gaussianReal]
|
| 100 |
-
|
| 101 |
-
lemma gaussian_memLp {Z : Ω → ℝ} (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 102 |
-
(p : ℝ≥0∞) (hp : p ≠ ∞) : MemLp Z p μ := by
|
| 103 |
-
have H : MemLp (id : ℝ → ℝ) p (μ.map Z) := by
|
| 104 |
-
rw [hZ.map_eq]
|
| 105 |
-
exact memLp_id_gaussianReal' p hp
|
| 106 |
-
simpa using (memLp_map_measure_iff H.aestronglyMeasurable hZ.aemeasurable).1 H
|
| 107 |
-
|
| 108 |
-
lemma gaussian_second_moment {Z : Ω → ℝ} (hZ : HasLaw Z (gaussianReal 0 1) μ) :
|
| 109 |
-
∫ ω, (Z ω)^2 ∂μ = 1 := by
|
| 110 |
-
have hvar := hZ.variance_eq
|
| 111 |
-
rw [variance_eq_integral hZ.aemeasurable, gaussian_mean hZ] at hvar
|
| 112 |
-
simpa using hvar
|
| 113 |
-
|
| 114 |
-
noncomputable def predictableNormalizer (H : Ω → ℝ) (μ : Measure Ω) : ℝ :=
|
| 115 |
-
(Real.sqrt (∫ ω, (H ω)^2 ∂μ))⁻¹
|
| 116 |
-
|
| 117 |
-
noncomputable def normalizedIncrement (H Z : Ω → ℝ) (μ : Measure Ω) : Ω → ℝ :=
|
| 118 |
-
fun ω ↦ predictableNormalizer H μ * H ω * Z ω
|
| 119 |
-
|
| 120 |
-
lemma predictableNormalizer_pos {H : Ω → ℝ}
|
| 121 |
-
(hHpos : 0 < ∫ ω, (H ω)^2 ∂μ) :
|
| 122 |
-
0 < predictableNormalizer H μ := by
|
| 123 |
-
exact inv_pos.mpr (Real.sqrt_pos.mpr hHpos)
|
| 124 |
-
|
| 125 |
-
lemma normalizedIncrement_mean {H Z : Ω → ℝ}
|
| 126 |
-
(hH : AEStronglyMeasurable H μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 127 |
-
(hind : IndepFun H Z μ) :
|
| 128 |
-
∫ ω, normalizedIncrement H Z μ ω ∂μ = 0 := by
|
| 129 |
-
simp only [normalizedIncrement, mul_assoc]
|
| 130 |
-
rw [integral_const_mul]
|
| 131 |
-
have hi := hind.integral_mul_eq_mul_integral hH hZ.aemeasurable.aestronglyMeasurable
|
| 132 |
-
change (∫ ω, H ω * Z ω ∂μ) = _ at hi
|
| 133 |
-
rw [hi, gaussian_mean hZ, mul_zero, mul_zero]
|
| 134 |
-
|
| 135 |
-
lemma normalizedIncrement_second_moment {H Z : Ω → ℝ}
|
| 136 |
-
(hH : AEStronglyMeasurable H μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 137 |
-
(hind : IndepFun H Z μ) (hHpos : 0 < ∫ ω, (H ω)^2 ∂μ) :
|
| 138 |
-
∫ ω, (normalizedIncrement H Z μ ω)^2 ∂μ = 1 := by
|
| 139 |
-
have hind2 : IndepFun (fun ω ↦ (H ω)^2) (fun ω ↦ (Z ω)^2) μ :=
|
| 140 |
-
hind.comp (measurable_id.pow_const 2) (measurable_id.pow_const 2)
|
| 141 |
-
have hi := hind2.integral_mul_eq_mul_integral
|
| 142 |
-
(hH.fun_pow 2)
|
| 143 |
-
(hZ.aemeasurable.aestronglyMeasurable.fun_pow 2)
|
| 144 |
-
change (∫ ω, (H ω)^2 * (Z ω)^2 ∂μ) =
|
| 145 |
-
(∫ ω, (H ω)^2 ∂μ) * (∫ ω, (Z ω)^2 ∂μ) at hi
|
| 146 |
-
simp only [normalizedIncrement, mul_pow, mul_assoc]
|
| 147 |
-
rw [integral_const_mul, hi, gaussian_second_moment hZ, mul_one]
|
| 148 |
-
simp only [predictableNormalizer, inv_pow, Real.sq_sqrt (le_of_lt hHpos)]
|
| 149 |
-
exact inv_mul_cancel₀ (ne_of_gt hHpos)
|
| 150 |
-
|
| 151 |
-
lemma normalizedIncrement_memLp_two {H Z : Ω → ℝ}
|
| 152 |
-
(hH : MemLp H 2 μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 153 |
-
(hind : IndepFun H Z μ) :
|
| 154 |
-
MemLp (normalizedIncrement H Z μ) 2 μ := by
|
| 155 |
-
apply (memLp_two_iff_integrable_sq
|
| 156 |
-
((hH.aestronglyMeasurable.const_mul _).mul hZ.aemeasurable.aestronglyMeasurable)).2
|
| 157 |
-
have hi := (hind.comp (measurable_id.pow_const 2) (measurable_id.pow_const 2)).integrable_mul
|
| 158 |
-
hH.integrable_sq (gaussian_memLp hZ 2 (by norm_num)).integrable_sq
|
| 159 |
-
have hj := hi.const_mul (predictableNormalizer H μ ^ 2)
|
| 160 |
-
simpa only [normalizedIncrement, Pi.mul_apply, mul_pow, mul_assoc, Function.comp_def, id_eq] using hj
|
| 161 |
-
|
| 162 |
-
lemma normalizedIncrement_gaussian_coefficient {H Z : Ω → ℝ}
|
| 163 |
-
(hH : AEStronglyMeasurable H μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 164 |
-
(hind : IndepFun H Z μ) :
|
| 165 |
-
∫ ω, normalizedIncrement H Z μ ω * Z ω ∂μ =
|
| 166 |
-
predictableNormalizer H μ * ∫ ω, H ω ∂μ := by
|
| 167 |
-
have hind2 : IndepFun H (fun ω ↦ (Z ω)^2) μ :=
|
| 168 |
-
hind.comp measurable_id (measurable_id.pow_const 2)
|
| 169 |
-
have hi := hind2.integral_mul_eq_mul_integral hH
|
| 170 |
-
(hZ.aemeasurable.aestronglyMeasurable.fun_pow 2)
|
| 171 |
-
change (∫ ω, H ω * (Z ω)^2 ∂μ) =
|
| 172 |
-
(∫ ω, H ω ∂μ) * (∫ ω, (Z ω)^2 ∂μ) at hi
|
| 173 |
-
simp only [normalizedIncrement, mul_assoc, ← pow_two]
|
| 174 |
-
rw [integral_const_mul, hi, gaussian_second_moment hZ, mul_one]
|
| 175 |
-
|
| 176 |
-
lemma predictable_product_mean_zero {H K Z : Ω → ℝ}
|
| 177 |
-
(hH : AEStronglyMeasurable H μ) (hK : AEStronglyMeasurable K μ)
|
| 178 |
-
(hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 179 |
-
(hind : IndepFun (fun ω ↦ H ω * K ω) Z μ) :
|
| 180 |
-
∫ ω, K ω * normalizedIncrement H Z μ ω ∂μ = 0 := by
|
| 181 |
-
have hi := hind.integral_mul_eq_mul_integral (hH.mul hK)
|
| 182 |
-
hZ.aemeasurable.aestronglyMeasurable
|
| 183 |
-
change (∫ ω, (H ω * K ω) * Z ω ∂μ) = _ at hi
|
| 184 |
-
calc
|
| 185 |
-
_ = predictableNormalizer H μ * ∫ ω, (H ω * K ω) * Z ω ∂μ := by
|
| 186 |
-
rw [← integral_const_mul]
|
| 187 |
-
congr 1
|
| 188 |
-
ext ω
|
| 189 |
-
simp only [normalizedIncrement]
|
| 190 |
-
ring
|
| 191 |
-
_ = 0 := by rw [hi, gaussian_mean hZ, mul_zero, mul_zero]
|
| 192 |
-
|
| 193 |
-
lemma coordinate_hasLaw (N j : ℕ) :
|
| 194 |
-
HasLaw (coordinate N j) (gaussianReal 0 1) (gaussianProduct (Fin (N+1))) :=
|
| 195 |
-
(measurePreserving_eval (fun _ : Fin (N+1) ↦ standardGaussian)
|
| 196 |
-
⟨j % (N+1), Nat.mod_lt _ (Nat.succ_pos _)⟩).hasLaw
|
| 197 |
-
|
| 198 |
-
def DependsBefore {N : ℕ} {β : Type*} (j : ℕ) (F : (Fin (N+1) → ℝ) → β) : Prop :=
|
| 199 |
-
∀ z z', (∀ i : Fin (N+1), (i : ℕ)<j → z i=z' i) → F z=F z'
|
| 200 |
-
|
| 201 |
-
lemma DependsBefore.independent {N j : ℕ} {β : Type*} [MeasurableSpace β] (hj : j<N+1)
|
| 202 |
-
{F : (Fin (N+1) → ℝ) → β} (hF : DependsBefore j F) (hm : Measurable F) :
|
| 203 |
-
IndepFun F (coordinate N j) (gaussianProduct (Fin (N+1))) := by
|
| 204 |
-
have H := independent_of_coordinate_not_in (μ := fun _ : Fin (N+1) ↦ standardGaussian)
|
| 205 |
-
(Finset.univ.filter (fun i : Fin (N+1) ↦ (i : ℕ)<j))
|
| 206 |
-
(j := ⟨j,hj⟩) (by simp) hm (fun z z' heq ↦ hF z z' (by simpa using heq))
|
| 207 |
-
have heq : coordinate N j = fun z : Fin (N+1) → ℝ ↦ z ⟨j,hj⟩ :=
|
| 208 |
-
funext (coordinate_eq_apply hj)
|
| 209 |
-
rw [heq]
|
| 210 |
-
exact H
|
| 211 |
-
|
| 212 |
-
lemma DependsBefore.mono {N i j : ℕ} {β : Type*} {F : (Fin (N+1) → ℝ) → β}
|
| 213 |
-
(hF : DependsBefore i F) (hij : i≤j) : DependsBefore j F :=
|
| 214 |
-
fun z z' h ↦ hF z z' (fun k hk ↦ h k (hk.trans_le hij))
|
| 215 |
-
|
| 216 |
-
lemma DependsBefore.prodMk {N j : ℕ} {β β' : Type*}
|
| 217 |
-
{F : (Fin (N+1) → ℝ) → β} {G : (Fin (N+1) → ℝ) → β'}
|
| 218 |
-
(hF : DependsBefore j F) (hG : DependsBefore j G) :
|
| 219 |
-
DependsBefore j (fun z ↦ (F z,G z)) := by
|
| 220 |
-
intro z z' h
|
| 221 |
-
exact Prod.ext (hF z z' h) (hG z z' h)
|
| 222 |
-
|
| 223 |
-
lemma DependsBefore.mul {N j : ℕ} {F G : (Fin (N+1) → ℝ) → ℝ}
|
| 224 |
-
(hF : DependsBefore j F) (hG : DependsBefore j G) :
|
| 225 |
-
DependsBefore j (fun z ↦ F z * G z) := by
|
| 226 |
-
intro z z' h
|
| 227 |
-
dsimp only
|
| 228 |
-
rw [hF z z' h, hG z z' h]
|
| 229 |
-
|
| 230 |
-
lemma eulerCoefficient_dependsBefore (T : ℝ) {N j : ℕ} (hj : j≤N)
|
| 231 |
-
(γ : ℝ → ℝ) (u a : ℝ → ℝ → ℝ) :
|
| 232 |
-
DependsBefore j (fun z ↦ a (meshTime T N j) (euler T N γ u z j)) := by
|
| 233 |
-
intro z z' h
|
| 234 |
-
apply congrArg (a (meshTime T N j))
|
| 235 |
-
apply euler_depends_on_past
|
| 236 |
-
intro i hi
|
| 237 |
-
have hiN : i<N+1 := by omega
|
| 238 |
-
rw [coordinate_eq_apply hiN, coordinate_eq_apply hiN]
|
| 239 |
-
exact h ⟨i,hiN⟩ hi
|
| 240 |
-
|
| 241 |
-
lemma normalizedIncrement_dependsBefore {N j : ℕ} (hj : j<N+1)
|
| 242 |
-
{H : (Fin (N+1) → ℝ) → ℝ} (hH : DependsBefore j H) :
|
| 243 |
-
DependsBefore (j+1) (normalizedIncrement H (coordinate N j) (gaussianProduct (Fin (N+1)))) := by
|
| 244 |
-
intro z z' h
|
| 245 |
-
have heq := hH.mono (Nat.le_succ j) z z' h
|
| 246 |
-
have hz : coordinate N j z=coordinate N j z' := by
|
| 247 |
-
rw [coordinate_eq_apply hj, coordinate_eq_apply hj]
|
| 248 |
-
exact h ⟨j,hj⟩ (Nat.lt_succ_self j)
|
| 249 |
-
simp only [normalizedIncrement,heq,hz]
|
| 250 |
-
|
| 251 |
-
lemma measurable_normalizedIncrement {N j : ℕ} {H : (Fin (N+1) → ℝ) → ℝ}
|
| 252 |
-
(hH : Measurable H) :
|
| 253 |
-
Measurable (normalizedIncrement H (coordinate N j) (gaussianProduct (Fin (N+1)))) :=
|
| 254 |
-
(hH.const_mul _).mul (measurable_coordinate N j)
|
| 255 |
-
|
| 256 |
-
lemma normalizedIncrements_orthogonal {N i j : ℕ} (hij : i<j) (hj : j<N+1)
|
| 257 |
-
{H K : (Fin (N+1) → ℝ) → ℝ} (hHm : Measurable H) (hKm : Measurable K)
|
| 258 |
-
(hH : DependsBefore i H) (hK : DependsBefore j K) :
|
| 259 |
-
∫ z, normalizedIncrement H (coordinate N i) (gaussianProduct (Fin (N+1))) z *
|
| 260 |
-
normalizedIncrement K (coordinate N j) (gaussianProduct (Fin (N+1))) z
|
| 261 |
-
∂gaussianProduct (Fin (N+1)) = 0 := by
|
| 262 |
-
have hi : i<N+1 := hij.trans hj
|
| 263 |
-
have hprev := (normalizedIncrement_dependsBefore hi hH).mono (by omega : i+1≤j)
|
| 264 |
-
exact predictable_product_mean_zero hKm.aestronglyMeasurable
|
| 265 |
-
(measurable_normalizedIncrement hHm).aestronglyMeasurable (coordinate_hasLaw N j)
|
| 266 |
-
((hK.mul hprev).independent hj
|
| 267 |
-
(hKm.mul (measurable_normalizedIncrement hHm)))
|
| 268 |
-
|
| 269 |
-
lemma euler_normalized_increment_properties {T : ℝ} {N j : ℕ} {γ : ℝ → ℝ}
|
| 270 |
-
{u a : ℝ → ℝ → ℝ} (hj : j<N+1)
|
| 271 |
-
(hU : ∀ k<N, Measurable (u (meshTime T N k)))
|
| 272 |
-
(hA : Measurable (a (meshTime T N j)))
|
| 273 |
-
(hpos : 0 < ∫ z, (a (meshTime T N j) (euler T N γ u z j))^2
|
| 274 |
-
∂gaussianProduct (Fin (N+1))) :
|
| 275 |
-
let H := fun z ↦ a (meshTime T N j) (euler T N γ u z j)
|
| 276 |
-
let μ := gaussianProduct (Fin (N+1))
|
| 277 |
-
0 < predictableNormalizer H μ ∧
|
| 278 |
-
(∫ z, normalizedIncrement H (coordinate N j) μ z ∂μ)=0 ∧
|
| 279 |
-
(∫ z, (normalizedIncrement H (coordinate N j) μ z)^2 ∂μ)=1 := by
|
| 280 |
-
dsimp only
|
| 281 |
-
have hm := hA.comp (measurable_euler T N γ u hU j (by omega))
|
| 282 |
-
have hind := euler_coefficient_independent (γ := γ) hj hU hA
|
| 283 |
-
exact ⟨predictableNormalizer_pos hpos,
|
| 284 |
-
normalizedIncrement_mean hm.aestronglyMeasurable (coordinate_hasLaw N j) hind,
|
| 285 |
-
normalizedIncrement_second_moment hm.aestronglyMeasurable (coordinate_hasLaw N j) hind hpos⟩
|
| 286 |
-
|
| 287 |
-
end SKValue
|
| 288 |
-
|
| 289 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 290 |
-
open scoped BigOperators Topology
|
| 291 |
-
|
| 292 |
-
end
|
| 293 |
-
|
| 294 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Model
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Set
|
| 9 |
+
open scoped ENNReal NNReal BigOperators
|
| 10 |
+
namespace SKValue
|
| 11 |
+
|
| 12 |
+
lemma independent_of_coordinate_not_in {ι β : Type*} [Fintype ι] [DecidableEq ι]
|
| 13 |
+
[MeasurableSpace β]
|
| 14 |
+
{μ : ι → Measure ℝ} [∀ i, IsProbabilityMeasure (μ i)]
|
| 15 |
+
(S : Finset ι) {j : ι} (hj : j ∉ S) {F : (ι → ℝ) → β}
|
| 16 |
+
(hF : Measurable F)
|
| 17 |
+
(hdep : ∀ x y, (∀ i ∈ S, x i=y i) → F x=F y) :
|
| 18 |
+
IndepFun F (fun x ↦ x j) (Measure.pi μ) := by
|
| 19 |
+
let fill : (S → ℝ) → ι → ℝ := fun x i ↦ if hi : i ∈ S then x ⟨i,hi⟩ else 0
|
| 20 |
+
have hfill : Measurable fill := by
|
| 21 |
+
apply Measurable.of_eval
|
| 22 |
+
intro i
|
| 23 |
+
by_cases hi : i ∈ S
|
| 24 |
+
· simpa only [fill, dite_eq_left hi] using (measurable_pi_apply (⟨i,hi⟩ : S))
|
| 25 |
+
· simp only [fill, dite_eq_right hi]
|
| 26 |
+
exact measurable_const
|
| 27 |
+
have hid : ∀ x : ι → ℝ, F (fill (fun i : S ↦ x i)) = F x := by
|
| 28 |
+
intro x
|
| 29 |
+
apply hdep
|
| 30 |
+
intro i hi
|
| 31 |
+
simp [fill,hi]
|
| 32 |
+
have hST : Disjoint S {j} := by simpa using hj
|
| 33 |
+
have hind : iIndepFun (fun i (x : ι → ℝ) ↦ x i) (Measure.pi μ) :=
|
| 34 |
+
iIndepFun_pi (fun i ↦ (measurable_id : Measurable (id : ℝ → ℝ)).aemeasurable)
|
| 35 |
+
have H := (hind.indepFun_finset S {j} hST (fun i ↦ measurable_pi_apply i)).comp
|
| 36 |
+
(hF.comp hfill) (measurable_pi_apply (⟨j,by simp⟩ : ({j} : Finset ι)))
|
| 37 |
+
simpa only [Function.comp_def, hid] using H
|
| 38 |
+
|
| 39 |
+
lemma measurable_coordinate (N j : ℕ) : Measurable (coordinate N j) :=
|
| 40 |
+
measurable_pi_apply _
|
| 41 |
+
|
| 42 |
+
lemma coordinate_eq_apply {N j : ℕ} (hj : j < N+1) (z : Fin (N+1) → ℝ) :
|
| 43 |
+
coordinate N j z = z ⟨j,hj⟩ := by
|
| 44 |
+
simp [coordinate, Nat.mod_eq_of_lt hj]
|
| 45 |
+
|
| 46 |
+
lemma euler_depends_on_past (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 47 |
+
(j : ℕ) (z z' : Fin (N+1) → ℝ)
|
| 48 |
+
(h : ∀ i < j, coordinate N i z=coordinate N i z') :
|
| 49 |
+
euler T N γ u z j=euler T N γ u z' j := by
|
| 50 |
+
induction j with
|
| 51 |
+
| zero => rfl
|
| 52 |
+
| succ j ih =>
|
| 53 |
+
have hp := ih (fun i hi ↦ h i (by omega))
|
| 54 |
+
simp only [euler, hp,h j (by omega)]
|
| 55 |
+
|
| 56 |
+
lemma measurable_euler (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 57 |
+
(hU : ∀ k < N, Measurable (u (meshTime T N k))) :
|
| 58 |
+
∀ j ≤ N, Measurable (fun z ↦ euler T N γ u z j) := by
|
| 59 |
+
intro j hj
|
| 60 |
+
induction j with
|
| 61 |
+
| zero => exact measurable_const
|
| 62 |
+
| succ j ih =>
|
| 63 |
+
have hjN : j < N := by omega
|
| 64 |
+
have hy := ih (by omega)
|
| 65 |
+
have hz := measurable_coordinate N j
|
| 66 |
+
have hu := (hU j hjN).comp hy
|
| 67 |
+
simp only [euler]
|
| 68 |
+
fun_prop
|
| 69 |
+
|
| 70 |
+
lemma euler_coefficient_independent {T : ℝ} {N j : ℕ} {γ : ℝ → ℝ}
|
| 71 |
+
{u a : ℝ → ℝ → ℝ} (hj : j < N+1)
|
| 72 |
+
(hU : ∀ k < N, Measurable (u (meshTime T N k)))
|
| 73 |
+
(hA : Measurable (a (meshTime T N j))) :
|
| 74 |
+
IndepFun (fun z ↦ a (meshTime T N j) (euler T N γ u z j))
|
| 75 |
+
(coordinate N j) (gaussianProduct (Fin (N+1))) := by
|
| 76 |
+
let S : Finset (Fin (N+1)) := Finset.univ.filter (fun i ↦ (i : ℕ)<j)
|
| 77 |
+
have hjS : (⟨j,hj⟩ : Fin (N+1)) ∉ S := by simp [S]
|
| 78 |
+
have hF : Measurable (fun z ↦ a (meshTime T N j) (euler T N γ u z j)) :=
|
| 79 |
+
hA.comp (measurable_euler T N γ u hU j (by omega))
|
| 80 |
+
have h := independent_of_coordinate_not_in (μ := fun _ : Fin (N+1) ↦ standardGaussian)
|
| 81 |
+
S hjS hF
|
| 82 |
+
(fun z z' heq ↦ by
|
| 83 |
+
apply congrArg (a (meshTime T N j))
|
| 84 |
+
apply euler_depends_on_past T N γ u j z z'
|
| 85 |
+
intro i hi
|
| 86 |
+
have hiN : i < N+1 := hi.trans hj
|
| 87 |
+
rw [coordinate_eq_apply hiN,coordinate_eq_apply hiN]
|
| 88 |
+
apply heq
|
| 89 |
+
simp [S,hi])
|
| 90 |
+
have heq : coordinate N j = fun z : Fin (N+1) → ℝ ↦ z ⟨j,hj⟩ :=
|
| 91 |
+
funext (coordinate_eq_apply hj)
|
| 92 |
+
rw [heq]
|
| 93 |
+
exact h
|
| 94 |
+
|
| 95 |
+
variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 96 |
+
|
| 97 |
+
lemma gaussian_mean {Z : Ω → ℝ} (hZ : HasLaw Z (gaussianReal 0 1) μ) :
|
| 98 |
+
∫ ω, Z ω ∂μ = 0 := by
|
| 99 |
+
rw [hZ.integral_eq, integral_id_gaussianReal]
|
| 100 |
+
|
| 101 |
+
lemma gaussian_memLp {Z : Ω → ℝ} (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 102 |
+
(p : ℝ≥0∞) (hp : p ≠ ∞) : MemLp Z p μ := by
|
| 103 |
+
have H : MemLp (id : ℝ → ℝ) p (μ.map Z) := by
|
| 104 |
+
rw [hZ.map_eq]
|
| 105 |
+
exact memLp_id_gaussianReal' p hp
|
| 106 |
+
simpa using (memLp_map_measure_iff H.aestronglyMeasurable hZ.aemeasurable).1 H
|
| 107 |
+
|
| 108 |
+
lemma gaussian_second_moment {Z : Ω → ℝ} (hZ : HasLaw Z (gaussianReal 0 1) μ) :
|
| 109 |
+
∫ ω, (Z ω)^2 ∂μ = 1 := by
|
| 110 |
+
have hvar := hZ.variance_eq
|
| 111 |
+
rw [variance_eq_integral hZ.aemeasurable, gaussian_mean hZ] at hvar
|
| 112 |
+
simpa using hvar
|
| 113 |
+
|
| 114 |
+
noncomputable def predictableNormalizer (H : Ω → ℝ) (μ : Measure Ω) : ℝ :=
|
| 115 |
+
(Real.sqrt (∫ ω, (H ω)^2 ∂μ))⁻¹
|
| 116 |
+
|
| 117 |
+
noncomputable def normalizedIncrement (H Z : Ω → ℝ) (μ : Measure Ω) : Ω → ℝ :=
|
| 118 |
+
fun ω ↦ predictableNormalizer H μ * H ω * Z ω
|
| 119 |
+
|
| 120 |
+
lemma predictableNormalizer_pos {H : Ω → ℝ}
|
| 121 |
+
(hHpos : 0 < ∫ ω, (H ω)^2 ∂μ) :
|
| 122 |
+
0 < predictableNormalizer H μ := by
|
| 123 |
+
exact inv_pos.mpr (Real.sqrt_pos.mpr hHpos)
|
| 124 |
+
|
| 125 |
+
lemma normalizedIncrement_mean {H Z : Ω → ℝ}
|
| 126 |
+
(hH : AEStronglyMeasurable H μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 127 |
+
(hind : IndepFun H Z μ) :
|
| 128 |
+
∫ ω, normalizedIncrement H Z μ ω ∂μ = 0 := by
|
| 129 |
+
simp only [normalizedIncrement, mul_assoc]
|
| 130 |
+
rw [integral_const_mul]
|
| 131 |
+
have hi := hind.integral_mul_eq_mul_integral hH hZ.aemeasurable.aestronglyMeasurable
|
| 132 |
+
change (∫ ω, H ω * Z ω ∂μ) = _ at hi
|
| 133 |
+
rw [hi, gaussian_mean hZ, mul_zero, mul_zero]
|
| 134 |
+
|
| 135 |
+
lemma normalizedIncrement_second_moment {H Z : Ω → ℝ}
|
| 136 |
+
(hH : AEStronglyMeasurable H μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 137 |
+
(hind : IndepFun H Z μ) (hHpos : 0 < ∫ ω, (H ω)^2 ∂μ) :
|
| 138 |
+
∫ ω, (normalizedIncrement H Z μ ω)^2 ∂μ = 1 := by
|
| 139 |
+
have hind2 : IndepFun (fun ω ↦ (H ω)^2) (fun ω ↦ (Z ω)^2) μ :=
|
| 140 |
+
hind.comp (measurable_id.pow_const 2) (measurable_id.pow_const 2)
|
| 141 |
+
have hi := hind2.integral_mul_eq_mul_integral
|
| 142 |
+
(hH.fun_pow 2)
|
| 143 |
+
(hZ.aemeasurable.aestronglyMeasurable.fun_pow 2)
|
| 144 |
+
change (∫ ω, (H ω)^2 * (Z ω)^2 ∂μ) =
|
| 145 |
+
(∫ ω, (H ω)^2 ∂μ) * (∫ ω, (Z ω)^2 ∂μ) at hi
|
| 146 |
+
simp only [normalizedIncrement, mul_pow, mul_assoc]
|
| 147 |
+
rw [integral_const_mul, hi, gaussian_second_moment hZ, mul_one]
|
| 148 |
+
simp only [predictableNormalizer, inv_pow, Real.sq_sqrt (le_of_lt hHpos)]
|
| 149 |
+
exact inv_mul_cancel₀ (ne_of_gt hHpos)
|
| 150 |
+
|
| 151 |
+
lemma normalizedIncrement_memLp_two {H Z : Ω → ℝ}
|
| 152 |
+
(hH : MemLp H 2 μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 153 |
+
(hind : IndepFun H Z μ) :
|
| 154 |
+
MemLp (normalizedIncrement H Z μ) 2 μ := by
|
| 155 |
+
apply (memLp_two_iff_integrable_sq
|
| 156 |
+
((hH.aestronglyMeasurable.const_mul _).mul hZ.aemeasurable.aestronglyMeasurable)).2
|
| 157 |
+
have hi := (hind.comp (measurable_id.pow_const 2) (measurable_id.pow_const 2)).integrable_mul
|
| 158 |
+
hH.integrable_sq (gaussian_memLp hZ 2 (by norm_num)).integrable_sq
|
| 159 |
+
have hj := hi.const_mul (predictableNormalizer H μ ^ 2)
|
| 160 |
+
simpa only [normalizedIncrement, Pi.mul_apply, mul_pow, mul_assoc, Function.comp_def, id_eq] using hj
|
| 161 |
+
|
| 162 |
+
lemma normalizedIncrement_gaussian_coefficient {H Z : Ω → ℝ}
|
| 163 |
+
(hH : AEStronglyMeasurable H μ) (hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 164 |
+
(hind : IndepFun H Z μ) :
|
| 165 |
+
∫ ω, normalizedIncrement H Z μ ω * Z ω ∂μ =
|
| 166 |
+
predictableNormalizer H μ * ∫ ω, H ω ∂μ := by
|
| 167 |
+
have hind2 : IndepFun H (fun ω ↦ (Z ω)^2) μ :=
|
| 168 |
+
hind.comp measurable_id (measurable_id.pow_const 2)
|
| 169 |
+
have hi := hind2.integral_mul_eq_mul_integral hH
|
| 170 |
+
(hZ.aemeasurable.aestronglyMeasurable.fun_pow 2)
|
| 171 |
+
change (∫ ω, H ω * (Z ω)^2 ∂μ) =
|
| 172 |
+
(∫ ω, H ω ∂μ) * (∫ ω, (Z ω)^2 ∂μ) at hi
|
| 173 |
+
simp only [normalizedIncrement, mul_assoc, ← pow_two]
|
| 174 |
+
rw [integral_const_mul, hi, gaussian_second_moment hZ, mul_one]
|
| 175 |
+
|
| 176 |
+
lemma predictable_product_mean_zero {H K Z : Ω → ℝ}
|
| 177 |
+
(hH : AEStronglyMeasurable H μ) (hK : AEStronglyMeasurable K μ)
|
| 178 |
+
(hZ : HasLaw Z (gaussianReal 0 1) μ)
|
| 179 |
+
(hind : IndepFun (fun ω ↦ H ω * K ω) Z μ) :
|
| 180 |
+
∫ ω, K ω * normalizedIncrement H Z μ ω ∂μ = 0 := by
|
| 181 |
+
have hi := hind.integral_mul_eq_mul_integral (hH.mul hK)
|
| 182 |
+
hZ.aemeasurable.aestronglyMeasurable
|
| 183 |
+
change (∫ ω, (H ω * K ω) * Z ω ∂μ) = _ at hi
|
| 184 |
+
calc
|
| 185 |
+
_ = predictableNormalizer H μ * ∫ ω, (H ω * K ω) * Z ω ∂μ := by
|
| 186 |
+
rw [← integral_const_mul]
|
| 187 |
+
congr 1
|
| 188 |
+
ext ω
|
| 189 |
+
simp only [normalizedIncrement]
|
| 190 |
+
ring
|
| 191 |
+
_ = 0 := by rw [hi, gaussian_mean hZ, mul_zero, mul_zero]
|
| 192 |
+
|
| 193 |
+
lemma coordinate_hasLaw (N j : ℕ) :
|
| 194 |
+
HasLaw (coordinate N j) (gaussianReal 0 1) (gaussianProduct (Fin (N+1))) :=
|
| 195 |
+
(measurePreserving_eval (fun _ : Fin (N+1) ↦ standardGaussian)
|
| 196 |
+
⟨j % (N+1), Nat.mod_lt _ (Nat.succ_pos _)⟩).hasLaw
|
| 197 |
+
|
| 198 |
+
def DependsBefore {N : ℕ} {β : Type*} (j : ℕ) (F : (Fin (N+1) → ℝ) → β) : Prop :=
|
| 199 |
+
∀ z z', (∀ i : Fin (N+1), (i : ℕ)<j → z i=z' i) → F z=F z'
|
| 200 |
+
|
| 201 |
+
lemma DependsBefore.independent {N j : ℕ} {β : Type*} [MeasurableSpace β] (hj : j<N+1)
|
| 202 |
+
{F : (Fin (N+1) → ℝ) → β} (hF : DependsBefore j F) (hm : Measurable F) :
|
| 203 |
+
IndepFun F (coordinate N j) (gaussianProduct (Fin (N+1))) := by
|
| 204 |
+
have H := independent_of_coordinate_not_in (μ := fun _ : Fin (N+1) ↦ standardGaussian)
|
| 205 |
+
(Finset.univ.filter (fun i : Fin (N+1) ↦ (i : ℕ)<j))
|
| 206 |
+
(j := ⟨j,hj⟩) (by simp) hm (fun z z' heq ↦ hF z z' (by simpa using heq))
|
| 207 |
+
have heq : coordinate N j = fun z : Fin (N+1) → ℝ ↦ z ⟨j,hj⟩ :=
|
| 208 |
+
funext (coordinate_eq_apply hj)
|
| 209 |
+
rw [heq]
|
| 210 |
+
exact H
|
| 211 |
+
|
| 212 |
+
lemma DependsBefore.mono {N i j : ℕ} {β : Type*} {F : (Fin (N+1) → ℝ) → β}
|
| 213 |
+
(hF : DependsBefore i F) (hij : i≤j) : DependsBefore j F :=
|
| 214 |
+
fun z z' h ↦ hF z z' (fun k hk ↦ h k (hk.trans_le hij))
|
| 215 |
+
|
| 216 |
+
lemma DependsBefore.prodMk {N j : ℕ} {β β' : Type*}
|
| 217 |
+
{F : (Fin (N+1) → ℝ) → β} {G : (Fin (N+1) → ℝ) → β'}
|
| 218 |
+
(hF : DependsBefore j F) (hG : DependsBefore j G) :
|
| 219 |
+
DependsBefore j (fun z ↦ (F z,G z)) := by
|
| 220 |
+
intro z z' h
|
| 221 |
+
exact Prod.ext (hF z z' h) (hG z z' h)
|
| 222 |
+
|
| 223 |
+
lemma DependsBefore.mul {N j : ℕ} {F G : (Fin (N+1) → ℝ) → ℝ}
|
| 224 |
+
(hF : DependsBefore j F) (hG : DependsBefore j G) :
|
| 225 |
+
DependsBefore j (fun z ↦ F z * G z) := by
|
| 226 |
+
intro z z' h
|
| 227 |
+
dsimp only
|
| 228 |
+
rw [hF z z' h, hG z z' h]
|
| 229 |
+
|
| 230 |
+
lemma eulerCoefficient_dependsBefore (T : ℝ) {N j : ℕ} (hj : j≤N)
|
| 231 |
+
(γ : ℝ → ℝ) (u a : ℝ → ℝ → ℝ) :
|
| 232 |
+
DependsBefore j (fun z ↦ a (meshTime T N j) (euler T N γ u z j)) := by
|
| 233 |
+
intro z z' h
|
| 234 |
+
apply congrArg (a (meshTime T N j))
|
| 235 |
+
apply euler_depends_on_past
|
| 236 |
+
intro i hi
|
| 237 |
+
have hiN : i<N+1 := by omega
|
| 238 |
+
rw [coordinate_eq_apply hiN, coordinate_eq_apply hiN]
|
| 239 |
+
exact h ⟨i,hiN⟩ hi
|
| 240 |
+
|
| 241 |
+
lemma normalizedIncrement_dependsBefore {N j : ℕ} (hj : j<N+1)
|
| 242 |
+
{H : (Fin (N+1) → ℝ) → ℝ} (hH : DependsBefore j H) :
|
| 243 |
+
DependsBefore (j+1) (normalizedIncrement H (coordinate N j) (gaussianProduct (Fin (N+1)))) := by
|
| 244 |
+
intro z z' h
|
| 245 |
+
have heq := hH.mono (Nat.le_succ j) z z' h
|
| 246 |
+
have hz : coordinate N j z=coordinate N j z' := by
|
| 247 |
+
rw [coordinate_eq_apply hj, coordinate_eq_apply hj]
|
| 248 |
+
exact h ⟨j,hj⟩ (Nat.lt_succ_self j)
|
| 249 |
+
simp only [normalizedIncrement,heq,hz]
|
| 250 |
+
|
| 251 |
+
lemma measurable_normalizedIncrement {N j : ℕ} {H : (Fin (N+1) → ℝ) → ℝ}
|
| 252 |
+
(hH : Measurable H) :
|
| 253 |
+
Measurable (normalizedIncrement H (coordinate N j) (gaussianProduct (Fin (N+1)))) :=
|
| 254 |
+
(hH.const_mul _).mul (measurable_coordinate N j)
|
| 255 |
+
|
| 256 |
+
lemma normalizedIncrements_orthogonal {N i j : ℕ} (hij : i<j) (hj : j<N+1)
|
| 257 |
+
{H K : (Fin (N+1) → ℝ) → ℝ} (hHm : Measurable H) (hKm : Measurable K)
|
| 258 |
+
(hH : DependsBefore i H) (hK : DependsBefore j K) :
|
| 259 |
+
∫ z, normalizedIncrement H (coordinate N i) (gaussianProduct (Fin (N+1))) z *
|
| 260 |
+
normalizedIncrement K (coordinate N j) (gaussianProduct (Fin (N+1))) z
|
| 261 |
+
∂gaussianProduct (Fin (N+1)) = 0 := by
|
| 262 |
+
have hi : i<N+1 := hij.trans hj
|
| 263 |
+
have hprev := (normalizedIncrement_dependsBefore hi hH).mono (by omega : i+1≤j)
|
| 264 |
+
exact predictable_product_mean_zero hKm.aestronglyMeasurable
|
| 265 |
+
(measurable_normalizedIncrement hHm).aestronglyMeasurable (coordinate_hasLaw N j)
|
| 266 |
+
((hK.mul hprev).independent hj
|
| 267 |
+
(hKm.mul (measurable_normalizedIncrement hHm)))
|
| 268 |
+
|
| 269 |
+
lemma euler_normalized_increment_properties {T : ℝ} {N j : ℕ} {γ : ℝ → ℝ}
|
| 270 |
+
{u a : ℝ → ℝ → ℝ} (hj : j<N+1)
|
| 271 |
+
(hU : ∀ k<N, Measurable (u (meshTime T N k)))
|
| 272 |
+
(hA : Measurable (a (meshTime T N j)))
|
| 273 |
+
(hpos : 0 < ∫ z, (a (meshTime T N j) (euler T N γ u z j))^2
|
| 274 |
+
∂gaussianProduct (Fin (N+1))) :
|
| 275 |
+
let H := fun z ↦ a (meshTime T N j) (euler T N γ u z j)
|
| 276 |
+
let μ := gaussianProduct (Fin (N+1))
|
| 277 |
+
0 < predictableNormalizer H μ ∧
|
| 278 |
+
(∫ z, normalizedIncrement H (coordinate N j) μ z ∂μ)=0 ∧
|
| 279 |
+
(∫ z, (normalizedIncrement H (coordinate N j) μ z)^2 ∂μ)=1 := by
|
| 280 |
+
dsimp only
|
| 281 |
+
have hm := hA.comp (measurable_euler T N γ u hU j (by omega))
|
| 282 |
+
have hind := euler_coefficient_independent (γ := γ) hj hU hA
|
| 283 |
+
exact ⟨predictableNormalizer_pos hpos,
|
| 284 |
+
normalizedIncrement_mean hm.aestronglyMeasurable (coordinate_hasLaw N j) hind,
|
| 285 |
+
normalizedIncrement_second_moment hm.aestronglyMeasurable (coordinate_hasLaw N j) hind hpos⟩
|
| 286 |
+
|
| 287 |
+
end SKValue
|
| 288 |
+
|
| 289 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 290 |
+
open scoped BigOperators Topology
|
| 291 |
+
|
| 292 |
+
end
|
| 293 |
+
|
| 294 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/QuadraticSK.lean
CHANGED
|
@@ -1,199 +1,199 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.AdaptiveColumns
|
| 3 |
-
import OAI.Probability.SKValue.GroundState.GramSchmidtLimit
|
| 4 |
-
import OAI.Probability.SKValue.GroundState.EmpiricalVectors
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
|
| 10 |
-
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 11 |
-
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 12 |
-
namespace SKValueG
|
| 13 |
-
|
| 14 |
-
noncomputable def spinVector (n : ℕ) (s : Fin n → Bool) : EuclideanSpace ℝ (Fin n) :=
|
| 15 |
-
WithLp.toLp 2 (fun i ↦ spin (s i))
|
| 16 |
-
|
| 17 |
-
lemma spinVector_inner (n : ℕ) (s t : Fin n → Bool) :
|
| 18 |
-
⟪spinVector n s,spinVector n t⟫=∑ i,spin (s i)*spin (t i) := euclidean_inner_sum _ _
|
| 19 |
-
|
| 20 |
-
lemma spinVector_sqNorm (n : ℕ) (s : Fin n → Bool) : ‖spinVector n s‖^2=(n : ℝ) := by
|
| 21 |
-
rw [←real_inner_self_eq_norm_sq,spinVector_inner]
|
| 22 |
-
simp only [←sq,spin_sq,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,mul_one]
|
| 23 |
-
|
| 24 |
-
lemma spinVector_norm (n : ℕ) (s : Fin n → Bool) : ‖spinVector n s‖=Real.sqrt (n : ℝ) := by
|
| 25 |
-
rw [←spinVector_sqNorm n s,Real.sqrt_sq (norm_nonneg _)]
|
| 26 |
-
|
| 27 |
-
lemma finiteMaximum_mul_nonneg {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 28 |
-
(f : ι → ℝ) {c : ℝ} (hc : 0≤c) :
|
| 29 |
-
finiteMaximum (fun i ↦ c*f i)=c*finiteMaximum f := by
|
| 30 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum f
|
| 31 |
-
apply le_antisymm
|
| 32 |
-
· obtain ⟨j,hj⟩ := exists_finiteMaximum (fun i ↦ c*f i)
|
| 33 |
-
rw [←hj]
|
| 34 |
-
exact mul_le_mul_of_nonneg_left (le_finiteMaximum f j) hc
|
| 35 |
-
· rw [←hi]
|
| 36 |
-
exact le_finiteMaximum (fun i ↦ c*f i) i
|
| 37 |
-
|
| 38 |
-
lemma scaled_linearProcess {ι κ : Type*} [Fintype κ] (a : ι → κ → ℝ) (c : ℝ)
|
| 39 |
-
(z : κ → ℝ) (i : ι) : linearProcess (fun i k ↦ c*a i k) z i=c*linearProcess a z i := by
|
| 40 |
-
simp only [linearProcess,Finset.mul_sum,mul_assoc]
|
| 41 |
-
|
| 42 |
-
lemma quadratic_spin_distance {n : ℕ} (hn : 0<n) (s t : Fin n → Bool) :
|
| 43 |
-
(∑ k,(quadraticCoeff (spinVector n s) k-quadraticCoeff (spinVector n t) k)^2)=
|
| 44 |
-
∑ k,(Real.sqrt (n : ℝ)*hamCoeff n s k-Real.sqrt (n : ℝ)*hamCoeff n t k)^2 := by
|
| 45 |
-
have hs0 : (n : ℝ)≠0 := by exact_mod_cast hn.ne'
|
| 46 |
-
have hq (s : Fin n → Bool) :
|
| 47 |
-
(∑ k,(quadraticCoeff (spinVector n s) k)^2)=(n : ℝ)^2/2 := by
|
| 48 |
-
simp only [sq]
|
| 49 |
-
rw [quadraticCoeff_inner,real_inner_self_eq_norm_sq,spinVector_sqNorm]
|
| 50 |
-
ring
|
| 51 |
-
rw [sq_distance_sum,hq,hq,quadraticCoeff_inner,spinVector_inner]
|
| 52 |
-
have hs : (∑ k,(Real.sqrt (n : ℝ)*hamCoeff n s k-Real.sqrt (n : ℝ)*hamCoeff n t k)^2)=
|
| 53 |
-
(n : ℝ)*(∑ k,(hamCoeff n s k-hamCoeff n t k)^2) := by
|
| 54 |
-
simp only [←mul_sub,mul_pow,Real.sq_sqrt (Nat.cast_nonneg n),Finset.mul_sum]
|
| 55 |
-
rw [hs,hamCoeff_distance hn]
|
| 56 |
-
field_simp
|
| 57 |
-
ring
|
| 58 |
-
|
| 59 |
-
theorem quadraticValue_spin {n : ℕ} (hn : 0<n) :
|
| 60 |
-
quadraticValue (spinVector n) (fun _ ↦ 0)=Real.sqrt (n : ℝ)*expectedMaximum n := by
|
| 61 |
-
have he : (∫ z,finiteMaximum (fun s ↦ linearProcess (fun s ↦ quadraticCoeff (spinVector n s)) z s+0)
|
| 62 |
-
∂gaussianProduct (Fin n×Fin n))=
|
| 63 |
-
∫ z,finiteMaximum (fun s ↦ linearProcess (fun s k ↦ Real.sqrt (n : ℝ)*hamCoeff n s k) z s+0)
|
| 64 |
-
∂gaussianProduct (Fin n×Fin n) := by
|
| 65 |
-
apply le_antisymm
|
| 66 |
-
· exact expected_affine_max_le _ _ (fun _ ↦ 0) (fun s t ↦ (quadratic_spin_distance hn s t).le)
|
| 67 |
-
· exact expected_affine_max_le _ _ (fun _ ↦ 0) (fun s t ↦ (quadratic_spin_distance hn s t).ge)
|
| 68 |
-
unfold quadraticValue
|
| 69 |
-
rw [he]
|
| 70 |
-
simp only [add_zero,scaled_linearProcess,finiteMaximum_mul_nonneg _ (Real.sqrt_nonneg _)]
|
| 71 |
-
rw [integral_const_mul]
|
| 72 |
-
rfl
|
| 73 |
-
|
| 74 |
-
theorem finite_adaptive_SK_lower {n : ℕ} (hn : 0<n)
|
| 75 |
-
(v : (j : ℕ) → ColumnHistory (Fin n) j → EuclideanSpace ℝ (Fin n))
|
| 76 |
-
(hv : ∀ j,Measurable (v j)) (hu : ∀ j h,v j h=0 ∨ ⟪v j h,v j h⟫=1)
|
| 77 |
-
(K : ℕ) (s : ColumnHistory (Fin n) K → (Fin n → Bool))
|
| 78 |
-
(hs : Measurable (fun h ↦ adaptiveOffset (spinVector n) v K h (s h))) :
|
| 79 |
-
(∫ h,adaptiveOffset (spinVector n) v K h (s h) ∂columnHistoryLaw (Fin n) K)/
|
| 80 |
-
((n : ℝ)*Real.sqrt (n : ℝ))≤groundStateSequence n := by
|
| 81 |
-
have hh := adaptive_spin_lower (spinVector n) v hv hu (Real.sqrt (n : ℝ))
|
| 82 |
-
(fun s ↦ (spinVector_norm n s).le) K s hs
|
| 83 |
-
rw [quadraticValue_spin hn] at hh
|
| 84 |
-
have hn' : (0 : ℝ)<n := by exact_mod_cast hn
|
| 85 |
-
have pro : (0 : ℝ)<(n : ℝ)*Real.sqrt (n : ℝ) := mul_pos hn' (Real.sqrt_pos.mpr hn')
|
| 86 |
-
apply (div_le_div_of_nonneg_right hh pro.le).trans_eq
|
| 87 |
-
rw [groundStateSequence_eq]
|
| 88 |
-
field_simp
|
| 89 |
-
|
| 90 |
-
end SKValueG
|
| 91 |
-
|
| 92 |
-
end
|
| 93 |
-
|
| 94 |
-
section
|
| 95 |
-
|
| 96 |
-
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 97 |
-
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 98 |
-
namespace SKValueG
|
| 99 |
-
|
| 100 |
-
lemma orthogonalRemainder_smul {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
|
| 101 |
-
(v : ℕ → E) (w : E) (j : ℕ) (c : ℝ) :
|
| 102 |
-
orthogonalRemainder v (c • w) j=c • orthogonalRemainder v w j := by
|
| 103 |
-
simp only [orthogonalRemainder,smul_sub,Finset.smul_sum,real_inner_smul_right,smul_smul]
|
| 104 |
-
|
| 105 |
-
lemma columnVector_smul {κ : Type*} [Fintype κ]
|
| 106 |
-
(v w : EuclideanSpace ℝ κ) (c : ℝ) : columnVector v (c • w)=c^2 • columnVector v w := by
|
| 107 |
-
simp only [columnVector,columnResidual,real_inner_smul_right,smul_sub,smul_add,smul_smul]
|
| 108 |
-
module
|
| 109 |
-
|
| 110 |
-
lemma empiricalVector_scale {Ω : Type*} (f : Ω → ℝ) (x : ℕ → Ω) {n : ℕ} (hn : 0<n) :
|
| 111 |
-
Real.sqrt (n : ℝ) • empiricalVector f x n=WithLp.toLp 2 (fun i : Fin n ↦ f (x i)) := by
|
| 112 |
-
rw [empiricalVector,smul_smul,mul_inv_cancel₀,one_smul]
|
| 113 |
-
exact Real.sqrt_ne_zero'.mpr (by exact_mod_cast hn)
|
| 114 |
-
|
| 115 |
-
variable (K n : ℕ) (f : ℕ → (Fin (K+1) → ℝ) → ℝ)
|
| 116 |
-
(ha : ∀ l x y,(∀ i : Fin (K+1),i.val≤l → x i=y i) → f l x=f l y)
|
| 117 |
-
(x : ℕ → (Fin (K+1) → ℝ))
|
| 118 |
-
|
| 119 |
-
include ha in
|
| 120 |
-
lemma predictableResidual_rows {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 121 |
-
(w : ι → EuclideanSpace ℝ (Fin n)) (j : ℕ) (s : ι) :
|
| 122 |
-
adaptiveResidual w (predictableDirection K n f) (j+1)
|
| 123 |
-
(rowHistory K n (fun i ↦ x i) (j+1)) s=
|
| 124 |
-
orthogonalRemainder (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n)) (w s) j := by
|
| 125 |
-
induction j with
|
| 126 |
-
| zero => simp [adaptiveResidual,predictableDirection,columnResidual,orthogonalRemainder]
|
| 127 |
-
| succ j ih =>
|
| 128 |
-
change columnResidual (predictableDirection K n f (j+1)
|
| 129 |
-
(rowHistory K n (fun i ↦ x i) (j+1)))
|
| 130 |
-
(adaptiveResidual w (predictableDirection K n f) (j+1)
|
| 131 |
-
(rowHistory K n (fun i ↦ x i) (j+1)) s)=_
|
| 132 |
-
rw [predictableDirection_rows K n f ha x j,ih]
|
| 133 |
-
apply columnResidual_orthogonalRemainder
|
| 134 |
-
intro i hi
|
| 135 |
-
exact gramSchmidtNormed_pairwise_orthogonal _ (Ne.symm (Nat.ne_of_lt hi))
|
| 136 |
-
|
| 137 |
-
include ha in
|
| 138 |
-
lemma predictableOffset_rows {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 139 |
-
(w : ι → EuclideanSpace ℝ (Fin n)) (J : ℕ) (s : ι) :
|
| 140 |
-
adaptiveOffset w (predictableDirection K n f) (J+1)
|
| 141 |
-
(rowHistory K n (fun i ↦ x i) (J+1)) s=
|
| 142 |
-
∑ j∈Finset.range J,
|
| 143 |
-
⟪columnVector (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n) j)
|
| 144 |
-
(orthogonalRemainder (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n)) (w s) j),
|
| 145 |
-
WithLp.toLp 2 (rowColumn K n (fun i ↦ x i) (j+1))⟫ := by
|
| 146 |
-
induction J with
|
| 147 |
-
| zero => simp [adaptiveOffset,predictableDirection,columnVector,columnResidual,linearProcess]
|
| 148 |
-
| succ J ih =>
|
| 149 |
-
change adaptiveOffset w (predictableDirection K n f) (J+1)
|
| 150 |
-
(rowHistory K n (fun i ↦ x i) (J+1)) s+
|
| 151 |
-
linearProcess (fun i k ↦ columnVector
|
| 152 |
-
(predictableDirection K n f (J+1) (rowHistory K n (fun i ↦ x i) (J+1)))
|
| 153 |
-
(adaptiveResidual w (predictableDirection K n f) (J+1)
|
| 154 |
-
(rowHistory K n (fun i ↦ x i) (J+1)) i) k)
|
| 155 |
-
(rowColumn K n (fun i ↦ x i) (J+1)) s=_
|
| 156 |
-
rw [ih,Finset.sum_range_succ,predictableDirection_rows K n f ha x J]
|
| 157 |
-
congr 1
|
| 158 |
-
unfold linearProcess
|
| 159 |
-
dsimp only
|
| 160 |
-
rw [predictableResidual_rows K n f ha x w J s]
|
| 161 |
-
rw [euclidean_inner_sum]
|
| 162 |
-
|
| 163 |
-
noncomputable def empiricalColumnEnergy (F : (Fin (K+1) → ℝ) → ℝ) (j : ℕ) : ℝ :=
|
| 164 |
-
⟪columnVector (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n) j)
|
| 165 |
-
(orthogonalRemainder (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n))
|
| 166 |
-
(empiricalVector F x n) j),
|
| 167 |
-
empiricalVector (fun y ↦ if hj : j+1<K+1 then y ⟨j+1,hj⟩ else 0) x n⟫
|
| 168 |
-
|
| 169 |
-
include ha in
|
| 170 |
-
lemma normalizedOffset_rows (hn : 0<n) (F : (Fin (K+1) → ℝ) → Bool) :
|
| 171 |
-
adaptiveOffset (spinVector n) (predictableDirection K n f) (K+1)
|
| 172 |
-
(rowHistory K n (fun i ↦ x i) (K+1)) (fun i ↦ F (x i))/
|
| 173 |
-
((n : ℝ)*Real.sqrt (n : ℝ))=
|
| 174 |
-
∑ j∈Finset.range K,empiricalColumnEnergy K n f x (fun y ↦ spin (F y)) j := by
|
| 175 |
-
rw [predictableOffset_rows K n f ha x (spinVector n) K]
|
| 176 |
-
rw [Finset.sum_div]
|
| 177 |
-
apply Finset.sum_congr rfl
|
| 178 |
-
intro j hj
|
| 179 |
-
have hw : spinVector n (fun i ↦ F (x i))=
|
| 180 |
-
Real.sqrt (n : ℝ) • empiricalVector (fun y ↦ spin (F y)) x n :=
|
| 181 |
-
(empiricalVector_scale (fun y ↦ spin (F y)) x hn).symm
|
| 182 |
-
have hz : WithLp.toLp 2 (rowColumn K n (fun i ↦ x i) (j+1))=
|
| 183 |
-
Real.sqrt (n : ℝ) • empiricalVector
|
| 184 |
-
(fun y ↦ if hj : j+1<K+1 then y ⟨j+1,hj⟩ else 0) x n :=
|
| 185 |
-
by
|
| 186 |
-
change (WithLp.toLp 2 (fun i : Fin n ↦ if hj : j+1<K+1 then x i ⟨j+1,hj⟩ else 0)) = _
|
| 187 |
-
exact (empiricalVector_scale (fun y : Fin (K+1) → ℝ ↦ if hj : j+1<K+1 then y ⟨j+1,hj⟩ else 0) x hn).symm
|
| 188 |
-
rw [hw,hz,orthogonalRemainder_smul,columnVector_smul,real_inner_smul_left,real_inner_smul_right,
|
| 189 |
-
Real.sq_sqrt (Nat.cast_nonneg n)]
|
| 190 |
-
unfold empiricalColumnEnergy
|
| 191 |
-
have hn' : (n : ℝ)≠0 := by exact_mod_cast hn.ne'
|
| 192 |
-
have hs : Real.sqrt (n : ℝ)≠0 := Real.sqrt_ne_zero'.mpr (by exact_mod_cast hn)
|
| 193 |
-
field_simp
|
| 194 |
-
|
| 195 |
-
end SKValueG
|
| 196 |
-
|
| 197 |
-
end
|
| 198 |
-
|
| 199 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.AdaptiveColumns
|
| 3 |
+
import OAI.Probability.SKValue.GroundState.GramSchmidtLimit
|
| 4 |
+
import OAI.Probability.SKValue.GroundState.EmpiricalVectors
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
|
| 10 |
+
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 11 |
+
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 12 |
+
namespace SKValueG
|
| 13 |
+
|
| 14 |
+
noncomputable def spinVector (n : ℕ) (s : Fin n → Bool) : EuclideanSpace ℝ (Fin n) :=
|
| 15 |
+
WithLp.toLp 2 (fun i ↦ spin (s i))
|
| 16 |
+
|
| 17 |
+
lemma spinVector_inner (n : ℕ) (s t : Fin n → Bool) :
|
| 18 |
+
⟪spinVector n s,spinVector n t⟫=∑ i,spin (s i)*spin (t i) := euclidean_inner_sum _ _
|
| 19 |
+
|
| 20 |
+
lemma spinVector_sqNorm (n : ℕ) (s : Fin n → Bool) : ‖spinVector n s‖^2=(n : ℝ) := by
|
| 21 |
+
rw [←real_inner_self_eq_norm_sq,spinVector_inner]
|
| 22 |
+
simp only [←sq,spin_sq,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,mul_one]
|
| 23 |
+
|
| 24 |
+
lemma spinVector_norm (n : ℕ) (s : Fin n → Bool) : ‖spinVector n s‖=Real.sqrt (n : ℝ) := by
|
| 25 |
+
rw [←spinVector_sqNorm n s,Real.sqrt_sq (norm_nonneg _)]
|
| 26 |
+
|
| 27 |
+
lemma finiteMaximum_mul_nonneg {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 28 |
+
(f : ι → ℝ) {c : ℝ} (hc : 0≤c) :
|
| 29 |
+
finiteMaximum (fun i ↦ c*f i)=c*finiteMaximum f := by
|
| 30 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum f
|
| 31 |
+
apply le_antisymm
|
| 32 |
+
· obtain ⟨j,hj⟩ := exists_finiteMaximum (fun i ↦ c*f i)
|
| 33 |
+
rw [←hj]
|
| 34 |
+
exact mul_le_mul_of_nonneg_left (le_finiteMaximum f j) hc
|
| 35 |
+
· rw [←hi]
|
| 36 |
+
exact le_finiteMaximum (fun i ↦ c*f i) i
|
| 37 |
+
|
| 38 |
+
lemma scaled_linearProcess {ι κ : Type*} [Fintype κ] (a : ι → κ → ℝ) (c : ℝ)
|
| 39 |
+
(z : κ → ℝ) (i : ι) : linearProcess (fun i k ↦ c*a i k) z i=c*linearProcess a z i := by
|
| 40 |
+
simp only [linearProcess,Finset.mul_sum,mul_assoc]
|
| 41 |
+
|
| 42 |
+
lemma quadratic_spin_distance {n : ℕ} (hn : 0<n) (s t : Fin n → Bool) :
|
| 43 |
+
(∑ k,(quadraticCoeff (spinVector n s) k-quadraticCoeff (spinVector n t) k)^2)=
|
| 44 |
+
∑ k,(Real.sqrt (n : ℝ)*hamCoeff n s k-Real.sqrt (n : ℝ)*hamCoeff n t k)^2 := by
|
| 45 |
+
have hs0 : (n : ℝ)≠0 := by exact_mod_cast hn.ne'
|
| 46 |
+
have hq (s : Fin n → Bool) :
|
| 47 |
+
(∑ k,(quadraticCoeff (spinVector n s) k)^2)=(n : ℝ)^2/2 := by
|
| 48 |
+
simp only [sq]
|
| 49 |
+
rw [quadraticCoeff_inner,real_inner_self_eq_norm_sq,spinVector_sqNorm]
|
| 50 |
+
ring
|
| 51 |
+
rw [sq_distance_sum,hq,hq,quadraticCoeff_inner,spinVector_inner]
|
| 52 |
+
have hs : (∑ k,(Real.sqrt (n : ℝ)*hamCoeff n s k-Real.sqrt (n : ℝ)*hamCoeff n t k)^2)=
|
| 53 |
+
(n : ℝ)*(∑ k,(hamCoeff n s k-hamCoeff n t k)^2) := by
|
| 54 |
+
simp only [←mul_sub,mul_pow,Real.sq_sqrt (Nat.cast_nonneg n),Finset.mul_sum]
|
| 55 |
+
rw [hs,hamCoeff_distance hn]
|
| 56 |
+
field_simp
|
| 57 |
+
ring
|
| 58 |
+
|
| 59 |
+
theorem quadraticValue_spin {n : ℕ} (hn : 0<n) :
|
| 60 |
+
quadraticValue (spinVector n) (fun _ ↦ 0)=Real.sqrt (n : ℝ)*expectedMaximum n := by
|
| 61 |
+
have he : (∫ z,finiteMaximum (fun s ↦ linearProcess (fun s ↦ quadraticCoeff (spinVector n s)) z s+0)
|
| 62 |
+
∂gaussianProduct (Fin n×Fin n))=
|
| 63 |
+
∫ z,finiteMaximum (fun s ↦ linearProcess (fun s k ↦ Real.sqrt (n : ℝ)*hamCoeff n s k) z s+0)
|
| 64 |
+
∂gaussianProduct (Fin n×Fin n) := by
|
| 65 |
+
apply le_antisymm
|
| 66 |
+
· exact expected_affine_max_le _ _ (fun _ ↦ 0) (fun s t ↦ (quadratic_spin_distance hn s t).le)
|
| 67 |
+
· exact expected_affine_max_le _ _ (fun _ ↦ 0) (fun s t ↦ (quadratic_spin_distance hn s t).ge)
|
| 68 |
+
unfold quadraticValue
|
| 69 |
+
rw [he]
|
| 70 |
+
simp only [add_zero,scaled_linearProcess,finiteMaximum_mul_nonneg _ (Real.sqrt_nonneg _)]
|
| 71 |
+
rw [integral_const_mul]
|
| 72 |
+
rfl
|
| 73 |
+
|
| 74 |
+
theorem finite_adaptive_SK_lower {n : ℕ} (hn : 0<n)
|
| 75 |
+
(v : (j : ℕ) → ColumnHistory (Fin n) j → EuclideanSpace ℝ (Fin n))
|
| 76 |
+
(hv : ∀ j,Measurable (v j)) (hu : ∀ j h,v j h=0 ∨ ⟪v j h,v j h⟫=1)
|
| 77 |
+
(K : ℕ) (s : ColumnHistory (Fin n) K → (Fin n → Bool))
|
| 78 |
+
(hs : Measurable (fun h ↦ adaptiveOffset (spinVector n) v K h (s h))) :
|
| 79 |
+
(∫ h,adaptiveOffset (spinVector n) v K h (s h) ∂columnHistoryLaw (Fin n) K)/
|
| 80 |
+
((n : ℝ)*Real.sqrt (n : ℝ))≤groundStateSequence n := by
|
| 81 |
+
have hh := adaptive_spin_lower (spinVector n) v hv hu (Real.sqrt (n : ℝ))
|
| 82 |
+
(fun s ↦ (spinVector_norm n s).le) K s hs
|
| 83 |
+
rw [quadraticValue_spin hn] at hh
|
| 84 |
+
have hn' : (0 : ℝ)<n := by exact_mod_cast hn
|
| 85 |
+
have pro : (0 : ℝ)<(n : ℝ)*Real.sqrt (n : ℝ) := mul_pos hn' (Real.sqrt_pos.mpr hn')
|
| 86 |
+
apply (div_le_div_of_nonneg_right hh pro.le).trans_eq
|
| 87 |
+
rw [groundStateSequence_eq]
|
| 88 |
+
field_simp
|
| 89 |
+
|
| 90 |
+
end SKValueG
|
| 91 |
+
|
| 92 |
+
end
|
| 93 |
+
|
| 94 |
+
section
|
| 95 |
+
|
| 96 |
+
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 97 |
+
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 98 |
+
namespace SKValueG
|
| 99 |
+
|
| 100 |
+
lemma orthogonalRemainder_smul {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
|
| 101 |
+
(v : ℕ → E) (w : E) (j : ℕ) (c : ℝ) :
|
| 102 |
+
orthogonalRemainder v (c • w) j=c • orthogonalRemainder v w j := by
|
| 103 |
+
simp only [orthogonalRemainder,smul_sub,Finset.smul_sum,real_inner_smul_right,smul_smul]
|
| 104 |
+
|
| 105 |
+
lemma columnVector_smul {κ : Type*} [Fintype κ]
|
| 106 |
+
(v w : EuclideanSpace ℝ κ) (c : ℝ) : columnVector v (c • w)=c^2 • columnVector v w := by
|
| 107 |
+
simp only [columnVector,columnResidual,real_inner_smul_right,smul_sub,smul_add,smul_smul]
|
| 108 |
+
module
|
| 109 |
+
|
| 110 |
+
lemma empiricalVector_scale {Ω : Type*} (f : Ω → ℝ) (x : ℕ → Ω) {n : ℕ} (hn : 0<n) :
|
| 111 |
+
Real.sqrt (n : ℝ) • empiricalVector f x n=WithLp.toLp 2 (fun i : Fin n ↦ f (x i)) := by
|
| 112 |
+
rw [empiricalVector,smul_smul,mul_inv_cancel₀,one_smul]
|
| 113 |
+
exact Real.sqrt_ne_zero'.mpr (by exact_mod_cast hn)
|
| 114 |
+
|
| 115 |
+
variable (K n : ℕ) (f : ℕ → (Fin (K+1) → ℝ) → ℝ)
|
| 116 |
+
(ha : ∀ l x y,(∀ i : Fin (K+1),i.val≤l → x i=y i) → f l x=f l y)
|
| 117 |
+
(x : ℕ → (Fin (K+1) → ℝ))
|
| 118 |
+
|
| 119 |
+
include ha in
|
| 120 |
+
lemma predictableResidual_rows {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 121 |
+
(w : ι → EuclideanSpace ℝ (Fin n)) (j : ℕ) (s : ι) :
|
| 122 |
+
adaptiveResidual w (predictableDirection K n f) (j+1)
|
| 123 |
+
(rowHistory K n (fun i ↦ x i) (j+1)) s=
|
| 124 |
+
orthogonalRemainder (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n)) (w s) j := by
|
| 125 |
+
induction j with
|
| 126 |
+
| zero => simp [adaptiveResidual,predictableDirection,columnResidual,orthogonalRemainder]
|
| 127 |
+
| succ j ih =>
|
| 128 |
+
change columnResidual (predictableDirection K n f (j+1)
|
| 129 |
+
(rowHistory K n (fun i ↦ x i) (j+1)))
|
| 130 |
+
(adaptiveResidual w (predictableDirection K n f) (j+1)
|
| 131 |
+
(rowHistory K n (fun i ↦ x i) (j+1)) s)=_
|
| 132 |
+
rw [predictableDirection_rows K n f ha x j,ih]
|
| 133 |
+
apply columnResidual_orthogonalRemainder
|
| 134 |
+
intro i hi
|
| 135 |
+
exact gramSchmidtNormed_pairwise_orthogonal _ (Ne.symm (Nat.ne_of_lt hi))
|
| 136 |
+
|
| 137 |
+
include ha in
|
| 138 |
+
lemma predictableOffset_rows {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 139 |
+
(w : ι → EuclideanSpace ℝ (Fin n)) (J : ℕ) (s : ι) :
|
| 140 |
+
adaptiveOffset w (predictableDirection K n f) (J+1)
|
| 141 |
+
(rowHistory K n (fun i ↦ x i) (J+1)) s=
|
| 142 |
+
∑ j∈Finset.range J,
|
| 143 |
+
⟪columnVector (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n) j)
|
| 144 |
+
(orthogonalRemainder (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n)) (w s) j),
|
| 145 |
+
WithLp.toLp 2 (rowColumn K n (fun i ↦ x i) (j+1))⟫ := by
|
| 146 |
+
induction J with
|
| 147 |
+
| zero => simp [adaptiveOffset,predictableDirection,columnVector,columnResidual,linearProcess]
|
| 148 |
+
| succ J ih =>
|
| 149 |
+
change adaptiveOffset w (predictableDirection K n f) (J+1)
|
| 150 |
+
(rowHistory K n (fun i ↦ x i) (J+1)) s+
|
| 151 |
+
linearProcess (fun i k ↦ columnVector
|
| 152 |
+
(predictableDirection K n f (J+1) (rowHistory K n (fun i ↦ x i) (J+1)))
|
| 153 |
+
(adaptiveResidual w (predictableDirection K n f) (J+1)
|
| 154 |
+
(rowHistory K n (fun i ↦ x i) (J+1)) i) k)
|
| 155 |
+
(rowColumn K n (fun i ↦ x i) (J+1)) s=_
|
| 156 |
+
rw [ih,Finset.sum_range_succ,predictableDirection_rows K n f ha x J]
|
| 157 |
+
congr 1
|
| 158 |
+
unfold linearProcess
|
| 159 |
+
dsimp only
|
| 160 |
+
rw [predictableResidual_rows K n f ha x w J s]
|
| 161 |
+
rw [euclidean_inner_sum]
|
| 162 |
+
|
| 163 |
+
noncomputable def empiricalColumnEnergy (F : (Fin (K+1) → ℝ) → ℝ) (j : ℕ) : ℝ :=
|
| 164 |
+
⟪columnVector (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n) j)
|
| 165 |
+
(orthogonalRemainder (gramSchmidtNormed ℝ (fun l ↦ empiricalVector (f l) x n))
|
| 166 |
+
(empiricalVector F x n) j),
|
| 167 |
+
empiricalVector (fun y ↦ if hj : j+1<K+1 then y ⟨j+1,hj⟩ else 0) x n⟫
|
| 168 |
+
|
| 169 |
+
include ha in
|
| 170 |
+
lemma normalizedOffset_rows (hn : 0<n) (F : (Fin (K+1) → ℝ) → Bool) :
|
| 171 |
+
adaptiveOffset (spinVector n) (predictableDirection K n f) (K+1)
|
| 172 |
+
(rowHistory K n (fun i ↦ x i) (K+1)) (fun i ↦ F (x i))/
|
| 173 |
+
((n : ℝ)*Real.sqrt (n : ℝ))=
|
| 174 |
+
∑ j∈Finset.range K,empiricalColumnEnergy K n f x (fun y ↦ spin (F y)) j := by
|
| 175 |
+
rw [predictableOffset_rows K n f ha x (spinVector n) K]
|
| 176 |
+
rw [Finset.sum_div]
|
| 177 |
+
apply Finset.sum_congr rfl
|
| 178 |
+
intro j hj
|
| 179 |
+
have hw : spinVector n (fun i ↦ F (x i))=
|
| 180 |
+
Real.sqrt (n : ℝ) • empiricalVector (fun y ↦ spin (F y)) x n :=
|
| 181 |
+
(empiricalVector_scale (fun y ↦ spin (F y)) x hn).symm
|
| 182 |
+
have hz : WithLp.toLp 2 (rowColumn K n (fun i ↦ x i) (j+1))=
|
| 183 |
+
Real.sqrt (n : ℝ) • empiricalVector
|
| 184 |
+
(fun y ↦ if hj : j+1<K+1 then y ⟨j+1,hj⟩ else 0) x n :=
|
| 185 |
+
by
|
| 186 |
+
change (WithLp.toLp 2 (fun i : Fin n ↦ if hj : j+1<K+1 then x i ⟨j+1,hj⟩ else 0)) = _
|
| 187 |
+
exact (empiricalVector_scale (fun y : Fin (K+1) → ℝ ↦ if hj : j+1<K+1 then y ⟨j+1,hj⟩ else 0) x hn).symm
|
| 188 |
+
rw [hw,hz,orthogonalRemainder_smul,columnVector_smul,real_inner_smul_left,real_inner_smul_right,
|
| 189 |
+
Real.sq_sqrt (Nat.cast_nonneg n)]
|
| 190 |
+
unfold empiricalColumnEnergy
|
| 191 |
+
have hn' : (n : ℝ)≠0 := by exact_mod_cast hn.ne'
|
| 192 |
+
have hs : Real.sqrt (n : ℝ)≠0 := Real.sqrt_ne_zero'.mpr (by exact_mod_cast hn)
|
| 193 |
+
field_simp
|
| 194 |
+
|
| 195 |
+
end SKValueG
|
| 196 |
+
|
| 197 |
+
end
|
| 198 |
+
|
| 199 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/RandomColumn.lean
CHANGED
|
@@ -1,155 +1,155 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.ColumnBounds
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
variable {Ω ι κ ν : Type*} [MeasurableSpace Ω] [Fintype ι] [Nonempty ι]
|
| 12 |
-
[Fintype κ] [Fintype ν] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 13 |
-
|
| 14 |
-
lemma measurable_finiteMaximum {f : Ω → ι → ℝ} (hf : ∀ i,Measurable (fun ω ↦ f ω i)) :
|
| 15 |
-
Measurable (fun ω ↦ finiteMaximum (f ω)) :=
|
| 16 |
-
continuous_finiteMaximum.measurable.comp (Measurable.of_eval hf)
|
| 17 |
-
|
| 18 |
-
omit [IsProbabilityMeasure μ] in
|
| 19 |
-
lemma integrable_randomMaximum [IsProbabilityMeasure μ] {f : Ω → ι → ℝ}
|
| 20 |
-
(hf : ∀ i,Integrable (fun ω ↦ f ω i) μ) :
|
| 21 |
-
Integrable (fun ω ↦ finiteMaximum (f ω)) μ := by
|
| 22 |
-
apply (integrable_finsetSum Finset.univ (fun i _ ↦ (hf i).abs)).mono'
|
| 23 |
-
(continuous_finiteMaximum.comp_aestronglyMeasurable
|
| 24 |
-
((integrable_pi_iff.mpr hf).aestronglyMeasurable))
|
| 25 |
-
exact Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs] using abs_finiteMaximum_le (f ω))
|
| 26 |
-
|
| 27 |
-
omit [Fintype ι] [Nonempty ι] in
|
| 28 |
-
lemma random_linear_integrable [Fintype ι] [Nonempty ι] (a : Ω → ι → ν → ℝ)
|
| 29 |
-
(ha : ∀ i k,Measurable (fun ω ↦ a ω i k)) (C : ℝ)
|
| 30 |
-
(hC : ∀ ω i k,|a ω i k|≤C) (i : ι) :
|
| 31 |
-
Integrable (fun p : Ω×(ν → ℝ) ↦ linearProcess (a p.1) p.2 i)
|
| 32 |
-
(μ.prod (gaussianProduct ν)) := by
|
| 33 |
-
unfold linearProcess
|
| 34 |
-
apply integrable_finsetSum
|
| 35 |
-
intro k _
|
| 36 |
-
apply ((gaussian_coordinate_integrable k).abs.const_mul C |>.comp_snd μ).mono'
|
| 37 |
-
(((ha i k).comp measurable_fst).mul ((measurable_pi_apply k).comp measurable_snd)).aestronglyMeasurable
|
| 38 |
-
exact Eventually.of_forall (fun p ↦ by
|
| 39 |
-
change |a p.1 i k * p.2 k| ≤ C * |p.2 k|
|
| 40 |
-
rw [abs_mul]
|
| 41 |
-
exact mul_le_mul_of_nonneg_right (hC p.1 i k) (abs_nonneg _))
|
| 42 |
-
|
| 43 |
-
lemma measurable_quadraticValue (w : Ω → ι → EuclideanSpace ℝ κ) (d : Ω → ι → ℝ)
|
| 44 |
-
(hw : ∀ i,Measurable (fun ω ↦ w ω i)) (hd : ∀ i,Measurable (fun ω ↦ d ω i)) :
|
| 45 |
-
Measurable (fun ω ↦ quadraticValue (w ω) (d ω)) := by
|
| 46 |
-
have hm : Measurable (fun p : Ω×((κ×κ) → ℝ) ↦
|
| 47 |
-
finiteMaximum (fun i ↦ linearProcess (fun i ↦ quadraticCoeff (w p.1 i)) p.2 i+d p.1 i)) := by
|
| 48 |
-
apply measurable_finiteMaximum
|
| 49 |
-
intro i
|
| 50 |
-
unfold linearProcess quadraticCoeff
|
| 51 |
-
fun_prop
|
| 52 |
-
exact hm.stronglyMeasurable.integral_prod_right.measurable
|
| 53 |
-
|
| 54 |
-
lemma random_quadratic_integrable (w : Ω → ι → EuclideanSpace ℝ κ) (d : Ω → ι → ℝ)
|
| 55 |
-
(hw : ∀ i,Measurable (fun ω ↦ w ω i)) (hd : ∀ i,Integrable (fun ω ↦ d ω i) μ)
|
| 56 |
-
(R : ℝ) (hR : ∀ ω i,‖w ω i‖≤R) :
|
| 57 |
-
Integrable (fun ω ↦ quadraticValue (w ω) (d ω)) μ := by
|
| 58 |
-
have hi : Integrable (fun p : Ω×((κ×κ) → ℝ) ↦
|
| 59 |
-
finiteMaximum (fun i ↦ linearProcess (fun i ↦ quadraticCoeff (w p.1 i)) p.2 i+d p.1 i))
|
| 60 |
-
(μ.prod (gaussianProduct (κ×κ))) := by
|
| 61 |
-
apply integrable_randomMaximum
|
| 62 |
-
intro i
|
| 63 |
-
apply Integrable.add _ ((hd i).comp_fst _)
|
| 64 |
-
apply random_linear_integrable (fun ω i ↦ quadraticCoeff (w ω i)) _ (R^2) _ i
|
| 65 |
-
· intro i k; unfold quadraticCoeff; fun_prop
|
| 66 |
-
· intro ω i k
|
| 67 |
-
exact (quadraticCoeff_coord_bound _ _).trans (sq_le_sq₀ (norm_nonneg _) (le_trans (norm_nonneg _) (hR ω i)) |>.mpr (hR ω i))
|
| 68 |
-
exact hi.integral_prod_left
|
| 69 |
-
|
| 70 |
-
lemma columnVector_coord_bound {v : EuclideanSpace ℝ κ} (hv : v=0 ∨ ⟪v,v⟫=1)
|
| 71 |
-
(w : EuclideanSpace ℝ κ) (k : κ) : |columnVector v w k|≤‖w‖^2 :=
|
| 72 |
-
(PiLp.norm_apply_le _ k).trans (columnVector_norm_le hv w)
|
| 73 |
-
|
| 74 |
-
theorem random_column_identity (w : Ω → ι → EuclideanSpace ℝ κ) (d : Ω → ι → ℝ)
|
| 75 |
-
(v : Ω → EuclideanSpace ℝ κ) (hw : ∀ i,Measurable (fun ω ↦ w ω i))
|
| 76 |
-
(_hdm : ∀ i,Measurable (fun ω ↦ d ω i))
|
| 77 |
-
(hd : ∀ i,Integrable (fun ω ↦ d ω i) μ) (hv : Measurable v)
|
| 78 |
-
(hu : ∀ ω,v ω=0 ∨ ⟪v ω,v ω⟫=1) (R : ℝ) (hR : ∀ ω i,‖w ω i‖≤R) :
|
| 79 |
-
(∫ ω,quadraticValue (w ω) (d ω) ∂μ)=
|
| 80 |
-
∫ p : Ω×(κ → ℝ),quadraticValue (fun i ↦ columnResidual (v p.1) (w p.1 i))
|
| 81 |
-
(fun i ↦ d p.1 i+linearProcess (fun i k ↦ columnVector (v p.1) (w p.1 i) k) p.2 i)
|
| 82 |
-
∂μ.prod (gaussianProduct κ) := by
|
| 83 |
-
have hw' (i : ι) : Measurable (fun p : Ω×(κ → ℝ) ↦ columnResidual (v p.1) (w p.1 i)) :=
|
| 84 |
-
measurable_columnResidual (hv.comp measurable_fst) ((hw i).comp measurable_fst)
|
| 85 |
-
have hd' (i : ι) : Integrable (fun p : Ω×(κ → ℝ) ↦
|
| 86 |
-
d p.1 i+linearProcess (fun i k ↦ columnVector (v p.1) (w p.1 i) k) p.2 i)
|
| 87 |
-
(μ.prod (gaussianProduct κ)) := by
|
| 88 |
-
apply ((hd i).comp_fst _).add
|
| 89 |
-
apply random_linear_integrable (fun ω i k ↦ columnVector (v ω) (w ω i) k) _ (R^2) _ i
|
| 90 |
-
· intro i k
|
| 91 |
-
exact (PiLp.continuous_apply 2 (fun _ : κ ↦ ℝ) k).measurable.comp (measurable_columnVector hv (hw i))
|
| 92 |
-
· intro ω i k
|
| 93 |
-
exact (columnVector_coord_bound (hu ω) _ _).trans
|
| 94 |
-
((sq_le_sq₀ (norm_nonneg _) ((norm_nonneg _).trans (hR ω i))).mpr (hR ω i))
|
| 95 |
-
have hi := random_quadratic_integrable _ _ hw' hd' R
|
| 96 |
-
(fun p i ↦ (columnResidual_norm_le (hu p.1) (w p.1 i)).trans (hR p.1 i))
|
| 97 |
-
rw [integral_prod _ hi]
|
| 98 |
-
apply integral_congr_ae
|
| 99 |
-
exact Eventually.of_forall (fun ω ↦ quadraticValue_column (w ω) (d ω) (v ω) (hu ω))
|
| 100 |
-
|
| 101 |
-
end SKValueG
|
| 102 |
-
|
| 103 |
-
end
|
| 104 |
-
|
| 105 |
-
section
|
| 106 |
-
|
| 107 |
-
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 108 |
-
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 109 |
-
namespace SKValueG
|
| 110 |
-
variable (κ : Type*) [Fintype κ]
|
| 111 |
-
|
| 112 |
-
abbrev ColumnHistory (j : ℕ) := Fin j → κ → ℝ
|
| 113 |
-
noncomputable def columnHistoryLaw (j : ℕ) : Measure (ColumnHistory κ j) :=
|
| 114 |
-
Measure.pi (fun _ ↦ gaussianProduct κ)
|
| 115 |
-
instance (j : ℕ) : IsProbabilityMeasure (columnHistoryLaw κ j) := by
|
| 116 |
-
unfold columnHistoryLaw; infer_instance
|
| 117 |
-
|
| 118 |
-
def historyInit {j : ℕ} (h : ColumnHistory κ (j+1)) : ColumnHistory κ j := fun i ↦ h i.castSucc
|
| 119 |
-
|
| 120 |
-
def historySplit (j : ℕ) : ColumnHistory κ (j+1) ≃ᵐ ColumnHistory κ j × (κ → ℝ) :=
|
| 121 |
-
(MeasurableEquiv.piFinSuccAbove (fun _ : Fin (j+1) ↦ κ → ℝ) (Fin.last j)).trans
|
| 122 |
-
MeasurableEquiv.prodComm
|
| 123 |
-
|
| 124 |
-
omit [Fintype κ] in
|
| 125 |
-
lemma historySplit_apply [Fintype κ] (j : ℕ) (h : ColumnHistory κ (j+1)) :
|
| 126 |
-
historySplit κ j h=(historyInit κ h,h (Fin.last j)) := by
|
| 127 |
-
simp [historySplit,MeasurableEquiv.piFinSuccAbove,Fin.insertNthEquiv]
|
| 128 |
-
rfl
|
| 129 |
-
|
| 130 |
-
lemma historySplit_preserving (j : ℕ) :
|
| 131 |
-
MeasurePreserving (historySplit κ j) (columnHistoryLaw κ (j+1))
|
| 132 |
-
((columnHistoryLaw κ j).prod (gaussianProduct κ)) := by
|
| 133 |
-
exact (Measure.measurePreserving_swap).comp
|
| 134 |
-
(measurePreserving_piFinSuccAbove (fun _ : Fin (j+1) ↦ gaussianProduct κ) (Fin.last j))
|
| 135 |
-
|
| 136 |
-
omit [Fintype κ] in
|
| 137 |
-
lemma historyInit_measurable [Fintype κ] (j : ℕ) : Measurable (historyInit κ (j:=j)) := by
|
| 138 |
-
unfold historyInit; fun_prop
|
| 139 |
-
|
| 140 |
-
lemma history_integral_succ (j : ℕ) (f : ColumnHistory κ j × (κ → ℝ) → ℝ) :
|
| 141 |
-
(∫ h,f (historyInit κ h,h (Fin.last j)) ∂columnHistoryLaw κ (j+1))=
|
| 142 |
-
∫ p,f p ∂(columnHistoryLaw κ j).prod (gaussianProduct κ) := by
|
| 143 |
-
simpa only [historySplit_apply] using (historySplit_preserving κ j).integral_comp' f
|
| 144 |
-
|
| 145 |
-
lemma history_integrable_succ (j : ℕ) {f : ColumnHistory κ j × (κ → ℝ) → ℝ}
|
| 146 |
-
(hf : Integrable f ((columnHistoryLaw κ j).prod (gaussianProduct κ))) :
|
| 147 |
-
Integrable (fun h ↦ f (historyInit κ h,h (Fin.last j))) (columnHistoryLaw κ (j+1)) := by
|
| 148 |
-
simpa only [Function.comp_def,historySplit_apply] using (historySplit_preserving κ j).integrable_comp
|
| 149 |
-
hf.aestronglyMeasurable |>.mpr hf
|
| 150 |
-
|
| 151 |
-
end SKValueG
|
| 152 |
-
|
| 153 |
-
end
|
| 154 |
-
|
| 155 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.ColumnBounds
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
variable {Ω ι κ ν : Type*} [MeasurableSpace Ω] [Fintype ι] [Nonempty ι]
|
| 12 |
+
[Fintype κ] [Fintype ν] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 13 |
+
|
| 14 |
+
lemma measurable_finiteMaximum {f : Ω → ι → ℝ} (hf : ∀ i,Measurable (fun ω ↦ f ω i)) :
|
| 15 |
+
Measurable (fun ω ↦ finiteMaximum (f ω)) :=
|
| 16 |
+
continuous_finiteMaximum.measurable.comp (Measurable.of_eval hf)
|
| 17 |
+
|
| 18 |
+
omit [IsProbabilityMeasure μ] in
|
| 19 |
+
lemma integrable_randomMaximum [IsProbabilityMeasure μ] {f : Ω → ι → ℝ}
|
| 20 |
+
(hf : ∀ i,Integrable (fun ω ↦ f ω i) μ) :
|
| 21 |
+
Integrable (fun ω ↦ finiteMaximum (f ω)) μ := by
|
| 22 |
+
apply (integrable_finsetSum Finset.univ (fun i _ ↦ (hf i).abs)).mono'
|
| 23 |
+
(continuous_finiteMaximum.comp_aestronglyMeasurable
|
| 24 |
+
((integrable_pi_iff.mpr hf).aestronglyMeasurable))
|
| 25 |
+
exact Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs] using abs_finiteMaximum_le (f ω))
|
| 26 |
+
|
| 27 |
+
omit [Fintype ι] [Nonempty ι] in
|
| 28 |
+
lemma random_linear_integrable [Fintype ι] [Nonempty ι] (a : Ω → ι → ν → ℝ)
|
| 29 |
+
(ha : ∀ i k,Measurable (fun ω ↦ a ω i k)) (C : ℝ)
|
| 30 |
+
(hC : ∀ ω i k,|a ω i k|≤C) (i : ι) :
|
| 31 |
+
Integrable (fun p : Ω×(ν → ℝ) ↦ linearProcess (a p.1) p.2 i)
|
| 32 |
+
(μ.prod (gaussianProduct ν)) := by
|
| 33 |
+
unfold linearProcess
|
| 34 |
+
apply integrable_finsetSum
|
| 35 |
+
intro k _
|
| 36 |
+
apply ((gaussian_coordinate_integrable k).abs.const_mul C |>.comp_snd μ).mono'
|
| 37 |
+
(((ha i k).comp measurable_fst).mul ((measurable_pi_apply k).comp measurable_snd)).aestronglyMeasurable
|
| 38 |
+
exact Eventually.of_forall (fun p ↦ by
|
| 39 |
+
change |a p.1 i k * p.2 k| ≤ C * |p.2 k|
|
| 40 |
+
rw [abs_mul]
|
| 41 |
+
exact mul_le_mul_of_nonneg_right (hC p.1 i k) (abs_nonneg _))
|
| 42 |
+
|
| 43 |
+
lemma measurable_quadraticValue (w : Ω → ι → EuclideanSpace ℝ κ) (d : Ω → ι → ℝ)
|
| 44 |
+
(hw : ∀ i,Measurable (fun ω ↦ w ω i)) (hd : ∀ i,Measurable (fun ω ↦ d ω i)) :
|
| 45 |
+
Measurable (fun ω ↦ quadraticValue (w ω) (d ω)) := by
|
| 46 |
+
have hm : Measurable (fun p : Ω×((κ×κ) → ℝ) ↦
|
| 47 |
+
finiteMaximum (fun i ↦ linearProcess (fun i ↦ quadraticCoeff (w p.1 i)) p.2 i+d p.1 i)) := by
|
| 48 |
+
apply measurable_finiteMaximum
|
| 49 |
+
intro i
|
| 50 |
+
unfold linearProcess quadraticCoeff
|
| 51 |
+
fun_prop
|
| 52 |
+
exact hm.stronglyMeasurable.integral_prod_right.measurable
|
| 53 |
+
|
| 54 |
+
lemma random_quadratic_integrable (w : Ω → ι → EuclideanSpace ℝ κ) (d : Ω → ι → ℝ)
|
| 55 |
+
(hw : ∀ i,Measurable (fun ω ↦ w ω i)) (hd : ∀ i,Integrable (fun ω ↦ d ω i) μ)
|
| 56 |
+
(R : ℝ) (hR : ∀ ω i,‖w ω i‖≤R) :
|
| 57 |
+
Integrable (fun ω ↦ quadraticValue (w ω) (d ω)) μ := by
|
| 58 |
+
have hi : Integrable (fun p : Ω×((κ×κ) → ℝ) ↦
|
| 59 |
+
finiteMaximum (fun i ↦ linearProcess (fun i ↦ quadraticCoeff (w p.1 i)) p.2 i+d p.1 i))
|
| 60 |
+
(μ.prod (gaussianProduct (κ×κ))) := by
|
| 61 |
+
apply integrable_randomMaximum
|
| 62 |
+
intro i
|
| 63 |
+
apply Integrable.add _ ((hd i).comp_fst _)
|
| 64 |
+
apply random_linear_integrable (fun ω i ↦ quadraticCoeff (w ω i)) _ (R^2) _ i
|
| 65 |
+
· intro i k; unfold quadraticCoeff; fun_prop
|
| 66 |
+
· intro ω i k
|
| 67 |
+
exact (quadraticCoeff_coord_bound _ _).trans (sq_le_sq₀ (norm_nonneg _) (le_trans (norm_nonneg _) (hR ω i)) |>.mpr (hR ω i))
|
| 68 |
+
exact hi.integral_prod_left
|
| 69 |
+
|
| 70 |
+
lemma columnVector_coord_bound {v : EuclideanSpace ℝ κ} (hv : v=0 ∨ ⟪v,v⟫=1)
|
| 71 |
+
(w : EuclideanSpace ℝ κ) (k : κ) : |columnVector v w k|≤‖w‖^2 :=
|
| 72 |
+
(PiLp.norm_apply_le _ k).trans (columnVector_norm_le hv w)
|
| 73 |
+
|
| 74 |
+
theorem random_column_identity (w : Ω → ι → EuclideanSpace ℝ κ) (d : Ω → ι → ℝ)
|
| 75 |
+
(v : Ω → EuclideanSpace ℝ κ) (hw : ∀ i,Measurable (fun ω ↦ w ω i))
|
| 76 |
+
(_hdm : ∀ i,Measurable (fun ω ↦ d ω i))
|
| 77 |
+
(hd : ∀ i,Integrable (fun ω ↦ d ω i) μ) (hv : Measurable v)
|
| 78 |
+
(hu : ∀ ω,v ω=0 ∨ ⟪v ω,v ω⟫=1) (R : ℝ) (hR : ∀ ω i,‖w ω i‖≤R) :
|
| 79 |
+
(∫ ω,quadraticValue (w ω) (d ω) ∂μ)=
|
| 80 |
+
∫ p : Ω×(κ → ℝ),quadraticValue (fun i ↦ columnResidual (v p.1) (w p.1 i))
|
| 81 |
+
(fun i ↦ d p.1 i+linearProcess (fun i k ↦ columnVector (v p.1) (w p.1 i) k) p.2 i)
|
| 82 |
+
∂μ.prod (gaussianProduct κ) := by
|
| 83 |
+
have hw' (i : ι) : Measurable (fun p : Ω×(κ → ℝ) ↦ columnResidual (v p.1) (w p.1 i)) :=
|
| 84 |
+
measurable_columnResidual (hv.comp measurable_fst) ((hw i).comp measurable_fst)
|
| 85 |
+
have hd' (i : ι) : Integrable (fun p : Ω×(κ → ℝ) ↦
|
| 86 |
+
d p.1 i+linearProcess (fun i k ↦ columnVector (v p.1) (w p.1 i) k) p.2 i)
|
| 87 |
+
(μ.prod (gaussianProduct κ)) := by
|
| 88 |
+
apply ((hd i).comp_fst _).add
|
| 89 |
+
apply random_linear_integrable (fun ω i k ↦ columnVector (v ω) (w ω i) k) _ (R^2) _ i
|
| 90 |
+
· intro i k
|
| 91 |
+
exact (PiLp.continuous_apply 2 (fun _ : κ ↦ ℝ) k).measurable.comp (measurable_columnVector hv (hw i))
|
| 92 |
+
· intro ω i k
|
| 93 |
+
exact (columnVector_coord_bound (hu ω) _ _).trans
|
| 94 |
+
((sq_le_sq₀ (norm_nonneg _) ((norm_nonneg _).trans (hR ω i))).mpr (hR ω i))
|
| 95 |
+
have hi := random_quadratic_integrable _ _ hw' hd' R
|
| 96 |
+
(fun p i ↦ (columnResidual_norm_le (hu p.1) (w p.1 i)).trans (hR p.1 i))
|
| 97 |
+
rw [integral_prod _ hi]
|
| 98 |
+
apply integral_congr_ae
|
| 99 |
+
exact Eventually.of_forall (fun ω ↦ quadraticValue_column (w ω) (d ω) (v ω) (hu ω))
|
| 100 |
+
|
| 101 |
+
end SKValueG
|
| 102 |
+
|
| 103 |
+
end
|
| 104 |
+
|
| 105 |
+
section
|
| 106 |
+
|
| 107 |
+
open MeasureTheory ProbabilityTheory Filter Set InnerProductSpace
|
| 108 |
+
open scoped Topology NNReal ENNReal BigOperators RealInnerProductSpace
|
| 109 |
+
namespace SKValueG
|
| 110 |
+
variable (κ : Type*) [Fintype κ]
|
| 111 |
+
|
| 112 |
+
abbrev ColumnHistory (j : ℕ) := Fin j → κ → ℝ
|
| 113 |
+
noncomputable def columnHistoryLaw (j : ℕ) : Measure (ColumnHistory κ j) :=
|
| 114 |
+
Measure.pi (fun _ ↦ gaussianProduct κ)
|
| 115 |
+
instance (j : ℕ) : IsProbabilityMeasure (columnHistoryLaw κ j) := by
|
| 116 |
+
unfold columnHistoryLaw; infer_instance
|
| 117 |
+
|
| 118 |
+
def historyInit {j : ℕ} (h : ColumnHistory κ (j+1)) : ColumnHistory κ j := fun i ↦ h i.castSucc
|
| 119 |
+
|
| 120 |
+
def historySplit (j : ℕ) : ColumnHistory κ (j+1) ≃ᵐ ColumnHistory κ j × (κ → ℝ) :=
|
| 121 |
+
(MeasurableEquiv.piFinSuccAbove (fun _ : Fin (j+1) ↦ κ → ℝ) (Fin.last j)).trans
|
| 122 |
+
MeasurableEquiv.prodComm
|
| 123 |
+
|
| 124 |
+
omit [Fintype κ] in
|
| 125 |
+
lemma historySplit_apply [Fintype κ] (j : ℕ) (h : ColumnHistory κ (j+1)) :
|
| 126 |
+
historySplit κ j h=(historyInit κ h,h (Fin.last j)) := by
|
| 127 |
+
simp [historySplit,MeasurableEquiv.piFinSuccAbove,Fin.insertNthEquiv]
|
| 128 |
+
rfl
|
| 129 |
+
|
| 130 |
+
lemma historySplit_preserving (j : ℕ) :
|
| 131 |
+
MeasurePreserving (historySplit κ j) (columnHistoryLaw κ (j+1))
|
| 132 |
+
((columnHistoryLaw κ j).prod (gaussianProduct κ)) := by
|
| 133 |
+
exact (Measure.measurePreserving_swap).comp
|
| 134 |
+
(measurePreserving_piFinSuccAbove (fun _ : Fin (j+1) ↦ gaussianProduct κ) (Fin.last j))
|
| 135 |
+
|
| 136 |
+
omit [Fintype κ] in
|
| 137 |
+
lemma historyInit_measurable [Fintype κ] (j : ℕ) : Measurable (historyInit κ (j:=j)) := by
|
| 138 |
+
unfold historyInit; fun_prop
|
| 139 |
+
|
| 140 |
+
lemma history_integral_succ (j : ℕ) (f : ColumnHistory κ j × (κ → ℝ) → ℝ) :
|
| 141 |
+
(∫ h,f (historyInit κ h,h (Fin.last j)) ∂columnHistoryLaw κ (j+1))=
|
| 142 |
+
∫ p,f p ∂(columnHistoryLaw κ j).prod (gaussianProduct κ) := by
|
| 143 |
+
simpa only [historySplit_apply] using (historySplit_preserving κ j).integral_comp' f
|
| 144 |
+
|
| 145 |
+
lemma history_integrable_succ (j : ℕ) {f : ColumnHistory κ j × (κ → ℝ) → ℝ}
|
| 146 |
+
(hf : Integrable f ((columnHistoryLaw κ j).prod (gaussianProduct κ))) :
|
| 147 |
+
Integrable (fun h ↦ f (historyInit κ h,h (Fin.last j))) (columnHistoryLaw κ (j+1)) := by
|
| 148 |
+
simpa only [Function.comp_def,historySplit_apply] using (historySplit_preserving κ j).integrable_comp
|
| 149 |
+
hf.aestronglyMeasurable |>.mpr hf
|
| 150 |
+
|
| 151 |
+
end SKValueG
|
| 152 |
+
|
| 153 |
+
end
|
| 154 |
+
|
| 155 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/RandomGuerra.lean
CHANGED
|
@@ -1,178 +1,178 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.FieldTreeLaw
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
|
| 12 |
-
lemma scalar_pairing_law (T : GaussianTree) :
|
| 13 |
-
MeasurePreserving (fun p : (TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ fun e ↦ (p.1 e,p.2 e))
|
| 14 |
-
((gaussianProduct (TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw)))
|
| 15 |
-
(Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)) :=
|
| 16 |
-
(measurePreserving_arrowProdEquivProdArrow ℝ ℝ (TreeEdges T)
|
| 17 |
-
(fun _ ↦ standardGaussian) (fun _ ↦ gumbelLaw)).symm
|
| 18 |
-
|
| 19 |
-
lemma field_pairing_law (n : ℕ) (T : GaussianTree) :
|
| 20 |
-
MeasurePreserving (fun p : (Fin n×TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ fun e ↦ ((fun i ↦ p.1 (i,e)),p.2 e))
|
| 21 |
-
((gaussianProduct (Fin n×TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw)))
|
| 22 |
-
(Measure.pi (fun _ : TreeEdges T ↦ fieldNoiseLaw n)) := by
|
| 23 |
-
have hs := measurePreserving_piCongrLeft (fun _ : TreeEdges T×Fin n ↦ standardGaussian)
|
| 24 |
-
(Equiv.prodComm (Fin n) (TreeEdges T))
|
| 25 |
-
have hc := (measurePreserving_finite_curry (I := TreeEdges T) (E := Fin n) standardGaussian).comp hs
|
| 26 |
-
have hp := (measurePreserving_arrowProdEquivProdArrow (Fin n → ℝ) ℝ (TreeEdges T)
|
| 27 |
-
(fun _ ↦ gaussianProduct (Fin n)) (fun _ ↦ gumbelLaw)).symm
|
| 28 |
-
exact hp.comp (hc.prod (MeasurePreserving.id (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))))
|
| 29 |
-
|
| 30 |
-
lemma scalarTreeEval_integrable (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 31 |
-
Integrable (scalarTreeEval c q T) (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)) :=
|
| 32 |
-
(scalarTreeEval_law c q T).integrable_comp aestronglyMeasurable_id |>.mpr (scalarTreeLaw_integrable c q T)
|
| 33 |
-
|
| 34 |
-
lemma scalarTreeValue_integrable_prod (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 35 |
-
Integrable (fun p : (TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ scalarTreeValue c q T p.1 p.2)
|
| 36 |
-
((gaussianProduct (TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))) := by
|
| 37 |
-
exact (scalar_pairing_law T).integrable_comp (continuous_scalarTreeEval c q T).aestronglyMeasurable
|
| 38 |
-
|>.mpr (scalarTreeEval_integrable c q T)
|
| 39 |
-
|
| 40 |
-
lemma fieldTreeValue_integrable_prod (n : ℕ) (q : ℝ) (T : GaussianTree) (x : Fin n → ℝ) :
|
| 41 |
-
Integrable (fun p : (Fin n×TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ fieldTreeValue n q T x p.1 p.2)
|
| 42 |
-
((gaussianProduct (Fin n×TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))) := by
|
| 43 |
-
have hc : Continuous (fieldTreeEval n q T x) :=
|
| 44 |
-
(continuous_fieldTreeEval n q T).comp (continuous_const.prodMk continuous_id)
|
| 45 |
-
exact (field_pairing_law n T).integrable_comp hc.aestronglyMeasurable
|
| 46 |
-
|>.mpr (fieldTreeEval_integrable n q T x)
|
| 47 |
-
|
| 48 |
-
lemma scalarTreeValue_mean (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 49 |
-
(∫ g,∫ z,scalarTreeValue c q T z g ∂gaussianProduct (TreeEdges T)
|
| 50 |
-
∂Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))=∫ y,y ∂scalarTreeLaw c q T := by
|
| 51 |
-
rw [←integral_prod_symm _ (scalarTreeValue_integrable_prod c q T)]
|
| 52 |
-
have hcomp := (scalarTreeEval_law c q T).comp (scalar_pairing_law T)
|
| 53 |
-
have he := hcomp.hasLaw.integral_comp aestronglyMeasurable_id
|
| 54 |
-
exact he
|
| 55 |
-
|
| 56 |
-
lemma fieldTreeValue_mean (n : ℕ) (q : ℝ) (T : GaussianTree) (x : Fin n → ℝ) :
|
| 57 |
-
(∫ g,∫ z,fieldTreeValue n q T x z g ∂gaussianProduct (Fin n×TreeEdges T)
|
| 58 |
-
∂Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))=
|
| 59 |
-
∫ w,fieldTreeEval n q T x w ∂Measure.pi (fun _ : TreeEdges T ↦ fieldNoiseLaw n) := by
|
| 60 |
-
rw [←integral_prod_symm _ (fieldTreeValue_integrable_prod n q T x)]
|
| 61 |
-
have hc : Continuous (fieldTreeEval n q T x) :=
|
| 62 |
-
(continuous_fieldTreeEval n q T).comp (continuous_const.prodMk continuous_id)
|
| 63 |
-
exact (field_pairing_law n T).hasLaw.integral_comp hc.aestronglyMeasurable
|
| 64 |
-
|
| 65 |
-
theorem randomized_tree_guerra_upper {n : ℕ} (hn : 0 < n) (T : GaussianTree) (hT : ValidTreeGrid 0 T) :
|
| 66 |
-
expectedMaximum n+(∫ y,y ∂scalarTreeLaw (fun q l ↦ Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)) 0 T) ≤
|
| 67 |
-
∫ w,fieldTreeEval n 0 T (fun _ ↦ 0) w ∂Measure.pi (fun _ : TreeEdges T ↦ fieldNoiseLaw n) := by
|
| 68 |
-
let c : ℝ → TreeLevel → ℝ := fun q l ↦ Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)
|
| 69 |
-
have hiA := scalarTreeValue_integrable_prod c 0 T
|
| 70 |
-
have hiF := fieldTreeValue_integrable_prod n 0 T (fun _ ↦ 0)
|
| 71 |
-
have hg : ∀ g : TreeEdges T → ℝ, expectedMaximum n+
|
| 72 |
-
(∫ z,scalarTreeValue c 0 T z g ∂gaussianProduct (TreeEdges T)) ≤
|
| 73 |
-
∫ z,fieldTreeValue n 0 T (fun _ ↦ 0) z g ∂gaussianProduct (Fin n×TreeEdges T) := by
|
| 74 |
-
intro g
|
| 75 |
-
simpa only [scalarTreeValue,fieldTreeValue,zero_add,treeAuxVector,c] using
|
| 76 |
-
finite_tree_guerra_upper hn T hT (treeOffset T g)
|
| 77 |
-
have hu := integral_mono ((integrable_const (expectedMaximum n)).add hiA.integral_prod_right)
|
| 78 |
-
hiF.integral_prod_right hg
|
| 79 |
-
simp only [Pi.add_apply] at hu
|
| 80 |
-
rw [integral_add (integrable_const _) hiA.integral_prod_right,integral_const,probReal_univ,one_smul,
|
| 81 |
-
scalarTreeValue_mean,fieldTreeValue_mean] at hu
|
| 82 |
-
exact hu
|
| 83 |
-
|
| 84 |
-
end SKValueG
|
| 85 |
-
|
| 86 |
-
end
|
| 87 |
-
|
| 88 |
-
section
|
| 89 |
-
|
| 90 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 91 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 92 |
-
namespace SKValueG
|
| 93 |
-
|
| 94 |
-
lemma coleHopf_one_sided {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ) {m : ℝ} (hm : 0 < m)
|
| 95 |
-
(h x y : ℝ) : SKValue.coleHopf m h ψ x ≤ SKValue.coleHopf m h ψ y+|x-y| := by
|
| 96 |
-
have hiX := SKValue.lipschitz_exp_integrable hψ hm.le x (Real.sqrt h)
|
| 97 |
-
have hiY := SKValue.lipschitz_exp_integrable hψ hm.le y (Real.sqrt h)
|
| 98 |
-
have hpX := SKValue.lipschitz_exp_integral_pos hψ hm.le x (Real.sqrt h)
|
| 99 |
-
have hpY := SKValue.lipschitz_exp_integral_pos hψ hm.le y (Real.sqrt h)
|
| 100 |
-
have e : SKValue.standardGaussian=standardGaussian := rfl
|
| 101 |
-
rw [e] at hiX hiY hpX hpY
|
| 102 |
-
have hbound : (∫ z,Real.exp (m*ψ (x+Real.sqrt h*z)) ∂standardGaussian) ≤
|
| 103 |
-
Real.exp (m*|x-y|)*(∫ z,Real.exp (m*ψ (y+Real.sqrt h*z)) ∂standardGaussian) := by
|
| 104 |
-
rw [←integral_const_mul]
|
| 105 |
-
apply integral_mono hiX (hiY.const_mul _)
|
| 106 |
-
intro z
|
| 107 |
-
have hl := hψ.dist_le_mul (x+Real.sqrt h*z) (y+Real.sqrt h*z)
|
| 108 |
-
simp only [Real.dist_eq,NNReal.coe_one,one_mul] at hl
|
| 109 |
-
rw [show x+Real.sqrt h*z-(y+Real.sqrt h*z)=x-y by ring] at hl
|
| 110 |
-
dsimp only
|
| 111 |
-
rw [←Real.exp_add]
|
| 112 |
-
apply Real.exp_le_exp.mpr
|
| 113 |
-
have hh := le_abs_self (ψ (x+Real.sqrt h*z)-ψ (y+Real.sqrt h*z))
|
| 114 |
-
nlinarith
|
| 115 |
-
have hh := Real.log_le_log hpX hbound
|
| 116 |
-
rw [Real.log_mul (Real.exp_pos _).ne' hpY.ne',Real.log_exp] at hh
|
| 117 |
-
simp only [SKValue.coleHopf,ite_eq_right hm.ne',SKValue.heat,e]
|
| 118 |
-
apply (div_le_iff₀ hm).mpr
|
| 119 |
-
have he : (Real.log (∫ z,Real.exp (m*ψ (y+Real.sqrt h*z)) ∂standardGaussian)/m+|x-y|)*m=
|
| 120 |
-
m*|x-y|+Real.log (∫ z,Real.exp (m*ψ (y+Real.sqrt h*z)) ∂standardGaussian) := by field_simp; ring
|
| 121 |
-
rw [he]
|
| 122 |
-
exact hh
|
| 123 |
-
|
| 124 |
-
lemma coleHopf_lipschitz {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ) {m : ℝ} (hm : 0 < m)
|
| 125 |
-
(h : ℝ) : LipschitzWith 1 (SKValue.coleHopf m h ψ) := by
|
| 126 |
-
apply LipschitzWith.of_dist_le_mul
|
| 127 |
-
intro x y
|
| 128 |
-
simp only [NNReal.coe_one,one_mul,Real.dist_eq]
|
| 129 |
-
have hxy := coleHopf_one_sided hψ hm h x y
|
| 130 |
-
have hyx := coleHopf_one_sided hψ hm h y x
|
| 131 |
-
rw [abs_sub_comm y x] at hyx
|
| 132 |
-
exact abs_le.mpr ⟨by linarith,by linarith⟩
|
| 133 |
-
|
| 134 |
-
noncomputable def fieldProfile (q : ℝ) : GaussianTree → ℝ → ℝ
|
| 135 |
-
| [] => abs
|
| 136 |
-
| l::T => SKValue.coleHopf l.height (l.endpoint-q) (fieldProfile l.endpoint T)
|
| 137 |
-
|
| 138 |
-
def TreeScale (a : ℝ) : GaussianTree → Prop
|
| 139 |
-
| [] => 0 ≤ a
|
| 140 |
-
| l::T => 0 ≤ a ∧ a < l.height ∧ TreeScale l.height T
|
| 141 |
-
|
| 142 |
-
lemma fieldProfile_lipschitz {T : GaussianTree} {a : ℝ} (h : TreeScale a T) (q : ℝ) :
|
| 143 |
-
LipschitzWith 1 (fieldProfile q T) := by
|
| 144 |
-
induction T generalizing a q with
|
| 145 |
-
| nil =>
|
| 146 |
-
apply LipschitzWith.of_dist_le_mul
|
| 147 |
-
intro x y
|
| 148 |
-
simpa only [fieldProfile,NNReal.coe_one,one_mul,Real.dist_eq] using abs_abs_sub_abs_le_abs_sub x y
|
| 149 |
-
| cons l T ih =>
|
| 150 |
-
obtain ⟨ha,ham,hT⟩ := h
|
| 151 |
-
exact coleHopf_lipschitz (ih hT _) (ha.trans_lt ham) _
|
| 152 |
-
|
| 153 |
-
lemma gaussian_exp_sum_profile_integrable {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ)
|
| 154 |
-
{m : ℝ} (hm : 0 ≤ m) (n : ℕ) (x : Fin n → ℝ) (s : ℝ) :
|
| 155 |
-
Integrable (fun z : Fin n → ℝ ↦ Real.exp (m*∑ i,ψ (x i+s*z i))) (gaussianProduct (Fin n)) := by
|
| 156 |
-
have hi := Integrable.fintype_prod (fun i : Fin n ↦ SKValue.lipschitz_exp_integrable hψ hm (x i) s)
|
| 157 |
-
convert hi using 1
|
| 158 |
-
· funext z
|
| 159 |
-
simp only [Finset.mul_sum,Real.exp_sum]
|
| 160 |
-
· rfl
|
| 161 |
-
|
| 162 |
-
lemma gaussian_exp_sum_coleHopf {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ)
|
| 163 |
-
{m : ℝ} (hm : 0 < m) (n : ℕ) (x : Fin n → ℝ) (h : ℝ) :
|
| 164 |
-
(∫ z : Fin n → ℝ,Real.exp (m*∑ i,ψ (x i+Real.sqrt h*z i)) ∂gaussianProduct (Fin n))=
|
| 165 |
-
Real.exp (m*∑ i,SKValue.coleHopf m h ψ (x i)) := by
|
| 166 |
-
simp only [Finset.mul_sum,Real.exp_sum]
|
| 167 |
-
rw [gaussianProduct,integral_fintype_prod_eq_prod (fun i : Fin n ↦ fun z : ℝ ↦ Real.exp (m*ψ (x i+Real.sqrt h*z)))]
|
| 168 |
-
apply Finset.prod_congr rfl
|
| 169 |
-
intro i _
|
| 170 |
-
simp only [SKValue.coleHopf,ite_eq_right hm.ne',SKValue.heat]
|
| 171 |
-
rw [mul_div_cancel₀ _ hm.ne',Real.exp_log (SKValue.lipschitz_exp_integral_pos hψ hm.le (x i) (Real.sqrt h))]
|
| 172 |
-
rfl
|
| 173 |
-
|
| 174 |
-
end SKValueG
|
| 175 |
-
|
| 176 |
-
end
|
| 177 |
-
|
| 178 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.FieldTreeLaw
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
|
| 12 |
+
lemma scalar_pairing_law (T : GaussianTree) :
|
| 13 |
+
MeasurePreserving (fun p : (TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ fun e ↦ (p.1 e,p.2 e))
|
| 14 |
+
((gaussianProduct (TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw)))
|
| 15 |
+
(Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)) :=
|
| 16 |
+
(measurePreserving_arrowProdEquivProdArrow ℝ ℝ (TreeEdges T)
|
| 17 |
+
(fun _ ↦ standardGaussian) (fun _ ↦ gumbelLaw)).symm
|
| 18 |
+
|
| 19 |
+
lemma field_pairing_law (n : ℕ) (T : GaussianTree) :
|
| 20 |
+
MeasurePreserving (fun p : (Fin n×TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ fun e ↦ ((fun i ↦ p.1 (i,e)),p.2 e))
|
| 21 |
+
((gaussianProduct (Fin n×TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw)))
|
| 22 |
+
(Measure.pi (fun _ : TreeEdges T ↦ fieldNoiseLaw n)) := by
|
| 23 |
+
have hs := measurePreserving_piCongrLeft (fun _ : TreeEdges T×Fin n ↦ standardGaussian)
|
| 24 |
+
(Equiv.prodComm (Fin n) (TreeEdges T))
|
| 25 |
+
have hc := (measurePreserving_finite_curry (I := TreeEdges T) (E := Fin n) standardGaussian).comp hs
|
| 26 |
+
have hp := (measurePreserving_arrowProdEquivProdArrow (Fin n → ℝ) ℝ (TreeEdges T)
|
| 27 |
+
(fun _ ↦ gaussianProduct (Fin n)) (fun _ ↦ gumbelLaw)).symm
|
| 28 |
+
exact hp.comp (hc.prod (MeasurePreserving.id (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))))
|
| 29 |
+
|
| 30 |
+
lemma scalarTreeEval_integrable (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 31 |
+
Integrable (scalarTreeEval c q T) (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)) :=
|
| 32 |
+
(scalarTreeEval_law c q T).integrable_comp aestronglyMeasurable_id |>.mpr (scalarTreeLaw_integrable c q T)
|
| 33 |
+
|
| 34 |
+
lemma scalarTreeValue_integrable_prod (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 35 |
+
Integrable (fun p : (TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ scalarTreeValue c q T p.1 p.2)
|
| 36 |
+
((gaussianProduct (TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))) := by
|
| 37 |
+
exact (scalar_pairing_law T).integrable_comp (continuous_scalarTreeEval c q T).aestronglyMeasurable
|
| 38 |
+
|>.mpr (scalarTreeEval_integrable c q T)
|
| 39 |
+
|
| 40 |
+
lemma fieldTreeValue_integrable_prod (n : ℕ) (q : ℝ) (T : GaussianTree) (x : Fin n → ℝ) :
|
| 41 |
+
Integrable (fun p : (Fin n×TreeEdges T → ℝ)×(TreeEdges T → ℝ) ↦ fieldTreeValue n q T x p.1 p.2)
|
| 42 |
+
((gaussianProduct (Fin n×TreeEdges T)).prod (Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))) := by
|
| 43 |
+
have hc : Continuous (fieldTreeEval n q T x) :=
|
| 44 |
+
(continuous_fieldTreeEval n q T).comp (continuous_const.prodMk continuous_id)
|
| 45 |
+
exact (field_pairing_law n T).integrable_comp hc.aestronglyMeasurable
|
| 46 |
+
|>.mpr (fieldTreeEval_integrable n q T x)
|
| 47 |
+
|
| 48 |
+
lemma scalarTreeValue_mean (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 49 |
+
(∫ g,∫ z,scalarTreeValue c q T z g ∂gaussianProduct (TreeEdges T)
|
| 50 |
+
∂Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))=∫ y,y ∂scalarTreeLaw c q T := by
|
| 51 |
+
rw [←integral_prod_symm _ (scalarTreeValue_integrable_prod c q T)]
|
| 52 |
+
have hcomp := (scalarTreeEval_law c q T).comp (scalar_pairing_law T)
|
| 53 |
+
have he := hcomp.hasLaw.integral_comp aestronglyMeasurable_id
|
| 54 |
+
exact he
|
| 55 |
+
|
| 56 |
+
lemma fieldTreeValue_mean (n : ℕ) (q : ℝ) (T : GaussianTree) (x : Fin n → ℝ) :
|
| 57 |
+
(∫ g,∫ z,fieldTreeValue n q T x z g ∂gaussianProduct (Fin n×TreeEdges T)
|
| 58 |
+
∂Measure.pi (fun _ : TreeEdges T ↦ gumbelLaw))=
|
| 59 |
+
∫ w,fieldTreeEval n q T x w ∂Measure.pi (fun _ : TreeEdges T ↦ fieldNoiseLaw n) := by
|
| 60 |
+
rw [←integral_prod_symm _ (fieldTreeValue_integrable_prod n q T x)]
|
| 61 |
+
have hc : Continuous (fieldTreeEval n q T x) :=
|
| 62 |
+
(continuous_fieldTreeEval n q T).comp (continuous_const.prodMk continuous_id)
|
| 63 |
+
exact (field_pairing_law n T).hasLaw.integral_comp hc.aestronglyMeasurable
|
| 64 |
+
|
| 65 |
+
theorem randomized_tree_guerra_upper {n : ℕ} (hn : 0 < n) (T : GaussianTree) (hT : ValidTreeGrid 0 T) :
|
| 66 |
+
expectedMaximum n+(∫ y,y ∂scalarTreeLaw (fun q l ↦ Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)) 0 T) ≤
|
| 67 |
+
∫ w,fieldTreeEval n 0 T (fun _ ↦ 0) w ∂Measure.pi (fun _ : TreeEdges T ↦ fieldNoiseLaw n) := by
|
| 68 |
+
let c : ℝ → TreeLevel → ℝ := fun q l ↦ Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)
|
| 69 |
+
have hiA := scalarTreeValue_integrable_prod c 0 T
|
| 70 |
+
have hiF := fieldTreeValue_integrable_prod n 0 T (fun _ ↦ 0)
|
| 71 |
+
have hg : ∀ g : TreeEdges T → ℝ, expectedMaximum n+
|
| 72 |
+
(∫ z,scalarTreeValue c 0 T z g ∂gaussianProduct (TreeEdges T)) ≤
|
| 73 |
+
∫ z,fieldTreeValue n 0 T (fun _ ↦ 0) z g ∂gaussianProduct (Fin n×TreeEdges T) := by
|
| 74 |
+
intro g
|
| 75 |
+
simpa only [scalarTreeValue,fieldTreeValue,zero_add,treeAuxVector,c] using
|
| 76 |
+
finite_tree_guerra_upper hn T hT (treeOffset T g)
|
| 77 |
+
have hu := integral_mono ((integrable_const (expectedMaximum n)).add hiA.integral_prod_right)
|
| 78 |
+
hiF.integral_prod_right hg
|
| 79 |
+
simp only [Pi.add_apply] at hu
|
| 80 |
+
rw [integral_add (integrable_const _) hiA.integral_prod_right,integral_const,probReal_univ,one_smul,
|
| 81 |
+
scalarTreeValue_mean,fieldTreeValue_mean] at hu
|
| 82 |
+
exact hu
|
| 83 |
+
|
| 84 |
+
end SKValueG
|
| 85 |
+
|
| 86 |
+
end
|
| 87 |
+
|
| 88 |
+
section
|
| 89 |
+
|
| 90 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 91 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 92 |
+
namespace SKValueG
|
| 93 |
+
|
| 94 |
+
lemma coleHopf_one_sided {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ) {m : ℝ} (hm : 0 < m)
|
| 95 |
+
(h x y : ℝ) : SKValue.coleHopf m h ψ x ≤ SKValue.coleHopf m h ψ y+|x-y| := by
|
| 96 |
+
have hiX := SKValue.lipschitz_exp_integrable hψ hm.le x (Real.sqrt h)
|
| 97 |
+
have hiY := SKValue.lipschitz_exp_integrable hψ hm.le y (Real.sqrt h)
|
| 98 |
+
have hpX := SKValue.lipschitz_exp_integral_pos hψ hm.le x (Real.sqrt h)
|
| 99 |
+
have hpY := SKValue.lipschitz_exp_integral_pos hψ hm.le y (Real.sqrt h)
|
| 100 |
+
have e : SKValue.standardGaussian=standardGaussian := rfl
|
| 101 |
+
rw [e] at hiX hiY hpX hpY
|
| 102 |
+
have hbound : (∫ z,Real.exp (m*ψ (x+Real.sqrt h*z)) ∂standardGaussian) ≤
|
| 103 |
+
Real.exp (m*|x-y|)*(∫ z,Real.exp (m*ψ (y+Real.sqrt h*z)) ∂standardGaussian) := by
|
| 104 |
+
rw [←integral_const_mul]
|
| 105 |
+
apply integral_mono hiX (hiY.const_mul _)
|
| 106 |
+
intro z
|
| 107 |
+
have hl := hψ.dist_le_mul (x+Real.sqrt h*z) (y+Real.sqrt h*z)
|
| 108 |
+
simp only [Real.dist_eq,NNReal.coe_one,one_mul] at hl
|
| 109 |
+
rw [show x+Real.sqrt h*z-(y+Real.sqrt h*z)=x-y by ring] at hl
|
| 110 |
+
dsimp only
|
| 111 |
+
rw [←Real.exp_add]
|
| 112 |
+
apply Real.exp_le_exp.mpr
|
| 113 |
+
have hh := le_abs_self (ψ (x+Real.sqrt h*z)-ψ (y+Real.sqrt h*z))
|
| 114 |
+
nlinarith
|
| 115 |
+
have hh := Real.log_le_log hpX hbound
|
| 116 |
+
rw [Real.log_mul (Real.exp_pos _).ne' hpY.ne',Real.log_exp] at hh
|
| 117 |
+
simp only [SKValue.coleHopf,ite_eq_right hm.ne',SKValue.heat,e]
|
| 118 |
+
apply (div_le_iff₀ hm).mpr
|
| 119 |
+
have he : (Real.log (∫ z,Real.exp (m*ψ (y+Real.sqrt h*z)) ∂standardGaussian)/m+|x-y|)*m=
|
| 120 |
+
m*|x-y|+Real.log (∫ z,Real.exp (m*ψ (y+Real.sqrt h*z)) ∂standardGaussian) := by field_simp; ring
|
| 121 |
+
rw [he]
|
| 122 |
+
exact hh
|
| 123 |
+
|
| 124 |
+
lemma coleHopf_lipschitz {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ) {m : ℝ} (hm : 0 < m)
|
| 125 |
+
(h : ℝ) : LipschitzWith 1 (SKValue.coleHopf m h ψ) := by
|
| 126 |
+
apply LipschitzWith.of_dist_le_mul
|
| 127 |
+
intro x y
|
| 128 |
+
simp only [NNReal.coe_one,one_mul,Real.dist_eq]
|
| 129 |
+
have hxy := coleHopf_one_sided hψ hm h x y
|
| 130 |
+
have hyx := coleHopf_one_sided hψ hm h y x
|
| 131 |
+
rw [abs_sub_comm y x] at hyx
|
| 132 |
+
exact abs_le.mpr ⟨by linarith,by linarith⟩
|
| 133 |
+
|
| 134 |
+
noncomputable def fieldProfile (q : ℝ) : GaussianTree → ℝ → ℝ
|
| 135 |
+
| [] => abs
|
| 136 |
+
| l::T => SKValue.coleHopf l.height (l.endpoint-q) (fieldProfile l.endpoint T)
|
| 137 |
+
|
| 138 |
+
def TreeScale (a : ℝ) : GaussianTree → Prop
|
| 139 |
+
| [] => 0 ≤ a
|
| 140 |
+
| l::T => 0 ≤ a ∧ a < l.height ∧ TreeScale l.height T
|
| 141 |
+
|
| 142 |
+
lemma fieldProfile_lipschitz {T : GaussianTree} {a : ℝ} (h : TreeScale a T) (q : ℝ) :
|
| 143 |
+
LipschitzWith 1 (fieldProfile q T) := by
|
| 144 |
+
induction T generalizing a q with
|
| 145 |
+
| nil =>
|
| 146 |
+
apply LipschitzWith.of_dist_le_mul
|
| 147 |
+
intro x y
|
| 148 |
+
simpa only [fieldProfile,NNReal.coe_one,one_mul,Real.dist_eq] using abs_abs_sub_abs_le_abs_sub x y
|
| 149 |
+
| cons l T ih =>
|
| 150 |
+
obtain ⟨ha,ham,hT⟩ := h
|
| 151 |
+
exact coleHopf_lipschitz (ih hT _) (ha.trans_lt ham) _
|
| 152 |
+
|
| 153 |
+
lemma gaussian_exp_sum_profile_integrable {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ)
|
| 154 |
+
{m : ℝ} (hm : 0 ≤ m) (n : ℕ) (x : Fin n → ℝ) (s : ℝ) :
|
| 155 |
+
Integrable (fun z : Fin n → ℝ ↦ Real.exp (m*∑ i,ψ (x i+s*z i))) (gaussianProduct (Fin n)) := by
|
| 156 |
+
have hi := Integrable.fintype_prod (fun i : Fin n ↦ SKValue.lipschitz_exp_integrable hψ hm (x i) s)
|
| 157 |
+
convert hi using 1
|
| 158 |
+
· funext z
|
| 159 |
+
simp only [Finset.mul_sum,Real.exp_sum]
|
| 160 |
+
· rfl
|
| 161 |
+
|
| 162 |
+
lemma gaussian_exp_sum_coleHopf {ψ : ℝ → ℝ} (hψ : LipschitzWith 1 ψ)
|
| 163 |
+
{m : ℝ} (hm : 0 < m) (n : ℕ) (x : Fin n → ℝ) (h : ℝ) :
|
| 164 |
+
(∫ z : Fin n → ℝ,Real.exp (m*∑ i,ψ (x i+Real.sqrt h*z i)) ∂gaussianProduct (Fin n))=
|
| 165 |
+
Real.exp (m*∑ i,SKValue.coleHopf m h ψ (x i)) := by
|
| 166 |
+
simp only [Finset.mul_sum,Real.exp_sum]
|
| 167 |
+
rw [gaussianProduct,integral_fintype_prod_eq_prod (fun i : Fin n ↦ fun z : ℝ ↦ Real.exp (m*ψ (x i+Real.sqrt h*z)))]
|
| 168 |
+
apply Finset.prod_congr rfl
|
| 169 |
+
intro i _
|
| 170 |
+
simp only [SKValue.coleHopf,ite_eq_right hm.ne',SKValue.heat]
|
| 171 |
+
rw [mul_div_cancel₀ _ hm.ne',Real.exp_log (SKValue.lipschitz_exp_integral_pos hψ hm.le (x i) (Real.sqrt h))]
|
| 172 |
+
rfl
|
| 173 |
+
|
| 174 |
+
end SKValueG
|
| 175 |
+
|
| 176 |
+
end
|
| 177 |
+
|
| 178 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/RotatedCoefficients.lean
CHANGED
|
@@ -1,396 +1,396 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.StandardGaussian
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 8 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 9 |
-
namespace SKValueG
|
| 10 |
-
|
| 11 |
-
lemma gaussian_gibbs_derivative_nonneg {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 12 |
-
{n : ℕ} (c d : ι → Fin n → ℝ)
|
| 13 |
-
(h : ∀ i j, 0 ≤ ∑ k, (d i k-d j k)*(c i k-c j k)) :
|
| 14 |
-
0 ≤ ∫ z, ∑ i, gibbsWeight (linearProcess c z) i*linearProcess d z i ∂gaussianProduct (Fin n) := by
|
| 15 |
-
have hi : ∀ i, Integrable (fun z ↦ gibbsWeight (linearProcess c z) i*linearProcess d z i)
|
| 16 |
-
(gaussianProduct (Fin n)) := fun i ↦ gibbsWeight_mul_integrable c i (linearProcess_integrable d i)
|
| 17 |
-
have hi' : ∀ i, Integrable (fun z ↦ gibbsWeight (linearProcess c z) i *
|
| 18 |
-
((∑ k, d i k*c i k)-∑ j, gibbsWeight (linearProcess c z) j*(∑ k, d i k*c j k)))
|
| 19 |
-
(gaussianProduct (Fin n)) := by
|
| 20 |
-
intro i
|
| 21 |
-
apply gibbsWeight_mul_integrable
|
| 22 |
-
exact (integrable_const _).sub (integrable_finsetSum _ (fun j _ ↦ (integrable_linear_gibbsWeight c j).mul_const _))
|
| 23 |
-
rw [integral_finsetSum _ (fun i _ ↦ hi i)]
|
| 24 |
-
simp_rw [gaussian_linear_gibbsWeight]
|
| 25 |
-
rw [← integral_finsetSum _ (fun i _ ↦ hi' i)]
|
| 26 |
-
apply integral_nonneg
|
| 27 |
-
intro z
|
| 28 |
-
change (0 : ℝ) ≤ ∑ i, gibbsWeight (linearProcess c z) i *
|
| 29 |
-
((∑ k, d i k*c i k)-∑ j, gibbsWeight (linearProcess c z) j*(∑ k, d i k*c j k))
|
| 30 |
-
rw [weighted_covariance_pairs _ (fun i j ↦ ∑ k, d i k*c j k) (sum_gibbsWeight (linearProcess c z))]
|
| 31 |
-
apply mul_nonneg (by norm_num)
|
| 32 |
-
apply Finset.sum_nonneg
|
| 33 |
-
intro i _
|
| 34 |
-
apply Finset.sum_nonneg
|
| 35 |
-
intro j _
|
| 36 |
-
apply mul_nonneg (mul_nonneg (gibbsWeight_nonneg _ _) (gibbsWeight_nonneg _ _))
|
| 37 |
-
have he : (∑ k, d i k*c i k)+(∑ k, d j k*c j k)-
|
| 38 |
-
(∑ k, d i k*c j k)-(∑ k, d j k*c i k) = ∑ k, (d i k-d j k)*(c i k-c j k) := by
|
| 39 |
-
rw [← Finset.sum_add_distrib,← Finset.sum_sub_distrib,← Finset.sum_sub_distrib]
|
| 40 |
-
apply Finset.sum_congr rfl; intro k _; ring
|
| 41 |
-
rw [he]
|
| 42 |
-
exact h i j
|
| 43 |
-
|
| 44 |
-
noncomputable def rotatedCoefficients {ι κ : Type*} (a b : ι → κ → ℝ) (t : ℝ) (i : ι) (k : κ) : ℝ :=
|
| 45 |
-
Real.cos t*a i k + Real.sin t*b i k
|
| 46 |
-
|
| 47 |
-
noncomputable def rotationVelocity {ι κ : Type*} (a b : ι → κ → ℝ) (t : ℝ) (i : ι) (k : κ) : ℝ :=
|
| 48 |
-
-Real.sin t*a i k + Real.cos t*b i k
|
| 49 |
-
|
| 50 |
-
lemma hasDerivAt_rotatedProcess {ι κ : Type*} [Fintype κ] (a b : ι → κ → ℝ)
|
| 51 |
-
(t : ℝ) (z : κ → ℝ) (i : ι) :
|
| 52 |
-
HasDerivAt (fun s ↦ linearProcess (rotatedCoefficients a b s) z i)
|
| 53 |
-
(linearProcess (rotationVelocity a b t) z i) t := by
|
| 54 |
-
exact HasDerivAt.fun_sum (u := Finset.univ) (fun k _ ↦
|
| 55 |
-
(((Real.hasDerivAt_cos t).mul_const (a i k)).add ((Real.hasDerivAt_sin t).mul_const (b i k))).mul_const (z k))
|
| 56 |
-
|
| 57 |
-
lemma abs_rotationVelocity_le {ι κ : Type*} (a b : ι → κ → ℝ) (t : ℝ) (i : ι) (k : κ) :
|
| 58 |
-
|rotationVelocity a b t i k| ≤ |a i k|+|b i k| := by
|
| 59 |
-
calc
|
| 60 |
-
_ ≤ |-Real.sin t*a i k| + |Real.cos t*b i k| := abs_add_le _ _
|
| 61 |
-
_ = |Real.sin t| *|a i k| + |Real.cos t| *|b i k| := by rw [abs_mul,abs_neg,abs_mul]
|
| 62 |
-
_ ≤ 1*|a i k| + 1*|b i k| := add_le_add
|
| 63 |
-
(mul_le_mul_of_nonneg_right (Real.abs_sin_le_one t) (abs_nonneg _))
|
| 64 |
-
(mul_le_mul_of_nonneg_right (Real.abs_cos_le_one t) (abs_nonneg _))
|
| 65 |
-
_ = _ := by ring
|
| 66 |
-
|
| 67 |
-
lemma rotation_derivative_bound {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 68 |
-
(a b : ι → κ → ℝ) (t : ℝ) (z : κ → ℝ) :
|
| 69 |
-
|∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 70 |
-
linearProcess (rotationVelocity a b t) z i| ≤
|
| 71 |
-
∑ i, ∑ k, (|a i k|+|b i k|)*|z k| := by
|
| 72 |
-
apply abs_gibbsMean_le
|
| 73 |
-
intro i
|
| 74 |
-
calc
|
| 75 |
-
_ ≤ ∑ k, |rotationVelocity a b t i k*z k| := Finset.abs_sum_le_sum_abs _ _
|
| 76 |
-
_ ≤ ∑ k, (|a i k|+|b i k|)*|z k| := by
|
| 77 |
-
apply Finset.sum_le_sum
|
| 78 |
-
intro k _
|
| 79 |
-
rw [abs_mul]
|
| 80 |
-
exact mul_le_mul_of_nonneg_right (abs_rotationVelocity_le _ _ _ _ _) (abs_nonneg _)
|
| 81 |
-
_ ≤ _ := Finset.single_le_sum (f := fun j ↦ ∑ k, (|a j k|+|b j k|)*|z k|) (fun j _ ↦ Finset.sum_nonneg (fun k _ ↦ mul_nonneg (add_nonneg (abs_nonneg _) (abs_nonneg _)) (abs_nonneg _))) (Finset.mem_univ i)
|
| 82 |
-
|
| 83 |
-
lemma hasDerivAt_expected_rotated_logPartition {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 84 |
-
{n : ℕ} (a b : ι → Fin n → ℝ) (t : ℝ) :
|
| 85 |
-
HasDerivAt (fun s ↦ ∫ z, logPartition (linearProcess (rotatedCoefficients a b s) z) ∂gaussianProduct (Fin n))
|
| 86 |
-
(∫ z, ∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 87 |
-
linearProcess (rotationVelocity a b t) z i ∂gaussianProduct (Fin n)) t := by
|
| 88 |
-
have hb : Integrable (fun z : Fin n → ℝ ↦ ∑ i, ∑ k, (|a i k|+|b i k|)*|z k|)
|
| 89 |
-
(gaussianProduct (Fin n)) :=
|
| 90 |
-
integrable_finsetSum _ (fun i _ ↦ integrable_finsetSum _ (fun k _ ↦
|
| 91 |
-
(gaussian_coordinate_integrable k).abs.const_mul _))
|
| 92 |
-
have hmc : Continuous (fun z : Fin n → ℝ ↦ ∑ i,
|
| 93 |
-
gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 94 |
-
linearProcess (rotationVelocity a b t) z i) := by
|
| 95 |
-
apply continuous_finsetSum
|
| 96 |
-
intro i _
|
| 97 |
-
apply (continuous_linear_gibbsWeight _ _).mul
|
| 98 |
-
exact (continuous_apply i).comp (continuous_linearProcess _)
|
| 99 |
-
exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le (s := Set.univ) (μ := gaussianProduct (Fin n))
|
| 100 |
-
(F := fun s z ↦ logPartition (linearProcess (rotatedCoefficients a b s) z))
|
| 101 |
-
(F' := fun s z ↦ ∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b s) z) i *
|
| 102 |
-
linearProcess (rotationVelocity a b s) z i)
|
| 103 |
-
(bound := fun z ↦ ∑ i, ∑ k, (|a i k|+|b i k|)*|z k|)
|
| 104 |
-
(Filter.univ_mem)
|
| 105 |
-
(Eventually.of_forall (fun s ↦ (continuous_logPartition.comp (continuous_linearProcess _)).aestronglyMeasurable))
|
| 106 |
-
(logPartition_integrable _) hmc.aestronglyMeasurable
|
| 107 |
-
(Eventually.of_forall (fun z s _ ↦ by simpa only [Real.norm_eq_abs] using rotation_derivative_bound a b s z)) hb
|
| 108 |
-
(Eventually.of_forall (fun z s _ ↦ hasDerivAt_logPartition (hasDerivAt_rotatedProcess a b s z)))).2
|
| 109 |
-
|
| 110 |
-
lemma rotation_pair_covariance {ι κ : Type*} [Fintype κ] (a b : ι → κ → ℝ) (t : ℝ) (i j : ι) :
|
| 111 |
-
(∑ k, (rotationVelocity a b t i k-rotationVelocity a b t j k)*
|
| 112 |
-
(rotatedCoefficients a b t i k-rotatedCoefficients a b t j k)) =
|
| 113 |
-
Real.sin t*Real.cos t*((∑ k, (b i k-b j k)^2)-(∑ k, (a i k-a j k)^2)) +
|
| 114 |
-
((Real.cos t)^2-(Real.sin t)^2)*∑ k, (a i k-a j k)*(b i k-b j k) := by
|
| 115 |
-
simp only [rotationVelocity,rotatedCoefficients,← Finset.sum_sub_distrib,Finset.mul_sum,← Finset.sum_add_distrib]
|
| 116 |
-
apply Finset.sum_congr rfl
|
| 117 |
-
intro k _
|
| 118 |
-
ring
|
| 119 |
-
|
| 120 |
-
lemma expected_logPartition_le_of_pair_distances {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 121 |
-
{n : ℕ} (a b : ι → Fin n → ℝ)
|
| 122 |
-
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 123 |
-
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 124 |
-
(∫ z, logPartition (linearProcess a z) ∂gaussianProduct (Fin n)) ≤
|
| 125 |
-
∫ z, logPartition (linearProcess b z) ∂gaussianProduct (Fin n) := by
|
| 126 |
-
let F := fun t ↦ ∫ z, logPartition (linearProcess (rotatedCoefficients a b t) z) ∂gaussianProduct (Fin n)
|
| 127 |
-
have hd : ∀ t, HasDerivAt F (∫ z, ∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 128 |
-
linearProcess (rotationVelocity a b t) z i ∂gaussianProduct (Fin n)) t :=
|
| 129 |
-
hasDerivAt_expected_rotated_logPartition a b
|
| 130 |
-
have hc : Continuous F := continuous_iff_continuousAt.mpr (fun t ↦ (hd t).continuousAt)
|
| 131 |
-
have hm : MonotoneOn F (Icc (0 : ℝ) (Real.pi/2)) := by
|
| 132 |
-
apply monotoneOn_of_deriv_nonneg (convex_Icc _ _) hc.continuousOn
|
| 133 |
-
(fun t _ ↦ (hd t).differentiableAt.differentiableWithinAt)
|
| 134 |
-
intro t ht
|
| 135 |
-
have ht' : t ∈ Icc (0 : ℝ) (Real.pi/2) := interior_subset ht
|
| 136 |
-
rw [(hd t).deriv]
|
| 137 |
-
apply gaussian_gibbs_derivative_nonneg
|
| 138 |
-
intro i j
|
| 139 |
-
rw [rotation_pair_covariance,horth,mul_zero,add_zero]
|
| 140 |
-
exact mul_nonneg (mul_nonneg
|
| 141 |
-
(Real.sin_nonneg_of_nonneg_of_le_pi ht'.1 (ht'.2.trans (by linarith [Real.pi_pos])))
|
| 142 |
-
(Real.cos_nonneg_of_mem_Icc ⟨by linarith [Real.pi_pos, ht'.1],ht'.2⟩)) (sub_nonneg.mpr (hdist i j))
|
| 143 |
-
have hπ : (0 : ℝ) ≤ Real.pi/2 := by positivity
|
| 144 |
-
have hh := hm ⟨le_rfl,hπ⟩ ⟨hπ,le_rfl⟩ hπ
|
| 145 |
-
have ha0 : rotatedCoefficients a b 0 = a := by funext i k; simp [rotatedCoefficients]
|
| 146 |
-
have hb0 : rotatedCoefficients a b (Real.pi/2) = b := by funext i k; simp [rotatedCoefficients]
|
| 147 |
-
simpa only [F,ha0,hb0] using hh
|
| 148 |
-
|
| 149 |
-
noncomputable def finiteMaximum {ι : Type*} (x : ι → ℝ) : ℝ := sSup (Set.range x)
|
| 150 |
-
|
| 151 |
-
lemma le_finiteMaximum {ι : Type*} [Fintype ι] (x : ι → ℝ) (i : ι) : x i ≤ finiteMaximum x :=
|
| 152 |
-
le_csSup (Set.finite_range x).bddAbove (Set.mem_range_self i)
|
| 153 |
-
|
| 154 |
-
lemma exists_finiteMaximum {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 155 |
-
∃ i, x i = finiteMaximum x := (Set.range_nonempty x).csSup_mem (Set.finite_range x)
|
| 156 |
-
|
| 157 |
-
lemma continuous_finiteMaximum {ι : Type*} [Fintype ι] [Nonempty ι] :
|
| 158 |
-
Continuous (@finiteMaximum ι) := by
|
| 159 |
-
have he (x : ι → ℝ) : finiteMaximum x = Finset.univ.sup' Finset.univ_nonempty x := by
|
| 160 |
-
rw [Finset.sup'_eq_csSup_image]
|
| 161 |
-
simp only [Finset.coe_univ,Set.image_univ,finiteMaximum]
|
| 162 |
-
simp_rw [funext he]
|
| 163 |
-
exact Continuous.finset_sup'_apply Finset.univ_nonempty (fun i _ ↦ continuous_apply i)
|
| 164 |
-
|
| 165 |
-
lemma abs_finiteMaximum_le {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 166 |
-
|finiteMaximum x| ≤ ∑ i, |x i| := by
|
| 167 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 168 |
-
rw [← hi]
|
| 169 |
-
exact Finset.single_le_sum (fun j _ ↦ abs_nonneg (x j)) (Finset.mem_univ i)
|
| 170 |
-
|
| 171 |
-
lemma finiteMaximum_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 172 |
-
(c : ι → κ → ℝ) : Integrable (fun z ↦ finiteMaximum (linearProcess c z)) (gaussianProduct κ) := by
|
| 173 |
-
apply (integrable_finsetSum Finset.univ (fun i _ ↦ (linearProcess_integrable c i).abs)).mono'
|
| 174 |
-
((continuous_finiteMaximum.comp (continuous_linearProcess c)).aestronglyMeasurable)
|
| 175 |
-
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_def] using abs_finiteMaximum_le (linearProcess c z))
|
| 176 |
-
|
| 177 |
-
lemma scaled_max_le_logPartition {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ)
|
| 178 |
-
(β : ℝ) : β*finiteMaximum x ≤ logPartition (fun i ↦ β*x i) := by
|
| 179 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 180 |
-
rw [← hi]
|
| 181 |
-
exact le_logPartition (fun i ↦ β*x i) i
|
| 182 |
-
|
| 183 |
-
lemma logPartition_le_scaled_max {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ)
|
| 184 |
-
{β : ℝ} (hβ : 0 ≤ β) : logPartition (fun i ↦ β*x i) ≤ β*finiteMaximum x+Real.log (Fintype.card ι) := by
|
| 185 |
-
exact (logPartition_le _ (fun i ↦ mul_le_mul_of_nonneg_left (le_finiteMaximum x i) hβ)).trans_eq (add_comm _ _)
|
| 186 |
-
|
| 187 |
-
lemma linearProcess_scaled {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) (β : ℝ) (z : κ → ℝ) :
|
| 188 |
-
linearProcess (fun i k ↦ β*c i k) z = fun i ↦ β*linearProcess c z i := by
|
| 189 |
-
funext i
|
| 190 |
-
simp only [linearProcess,Finset.mul_sum,mul_assoc]
|
| 191 |
-
|
| 192 |
-
lemma expected_max_le_of_pair_distances_orthogonal {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 193 |
-
{n : ℕ} (a b : ι → Fin n → ℝ)
|
| 194 |
-
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 195 |
-
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 196 |
-
(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) ≤
|
| 197 |
-
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n) := by
|
| 198 |
-
have hb (β : ℝ) (hβ : 0 ≤ β) :
|
| 199 |
-
β*(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) ≤
|
| 200 |
-
β*(∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n)) + Real.log (Fintype.card ι) := by
|
| 201 |
-
have hiA := logPartition_integrable (fun i k ↦ β*a i k)
|
| 202 |
-
have hiB := logPartition_integrable (fun i k ↦ β*b i k)
|
| 203 |
-
have hcomp := expected_logPartition_le_of_pair_distances
|
| 204 |
-
(fun i k ↦ β*a i k) (fun i k ↦ β*b i k)
|
| 205 |
-
(fun i j ↦ by
|
| 206 |
-
calc
|
| 207 |
-
(∑ k, (β*a i k-β*a j k)*(β*b i k-β*b j k)) =
|
| 208 |
-
β^2*(∑ k, (a i k-a j k)*(b i k-b j k)) := by
|
| 209 |
-
rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring
|
| 210 |
-
_ = 0 := by rw [horth,mul_zero])
|
| 211 |
-
(fun i j ↦ by
|
| 212 |
-
have he (c : ι → Fin n → ℝ) : (∑ k, (β*c i k-β*c j k)^2) = β^2*∑ k, (c i k-c j k)^2 := by
|
| 213 |
-
rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring
|
| 214 |
-
rw [he,he]
|
| 215 |
-
exact mul_le_mul_of_nonneg_left (hdist i j) (sq_nonneg β))
|
| 216 |
-
calc
|
| 217 |
-
_ = ∫ z, β*finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n) := by rw [integral_const_mul]
|
| 218 |
-
_ ≤ ∫ z, logPartition (linearProcess (fun i k ↦ β*a i k) z) ∂gaussianProduct (Fin n) := by
|
| 219 |
-
apply integral_mono ((finiteMaximum_integrable a).const_mul _) hiA
|
| 220 |
-
intro z
|
| 221 |
-
change β*finiteMaximum (linearProcess a z) ≤ logPartition (linearProcess (fun i k ↦ β*a i k) z)
|
| 222 |
-
rw [linearProcess_scaled]
|
| 223 |
-
exact scaled_max_le_logPartition _ _
|
| 224 |
-
_ ≤ _ := hcomp
|
| 225 |
-
_ ≤ ∫ z, β*finiteMaximum (linearProcess b z)+Real.log (Fintype.card ι) ∂gaussianProduct (Fin n) := by
|
| 226 |
-
apply integral_mono hiB (((finiteMaximum_integrable b).const_mul _).add (integrable_const _))
|
| 227 |
-
intro z
|
| 228 |
-
change logPartition (linearProcess (fun i k ↦ β*b i k) z) ≤ β*finiteMaximum (linearProcess b z)+Real.log (Fintype.card ι)
|
| 229 |
-
rw [linearProcess_scaled]
|
| 230 |
-
exact logPartition_le_scaled_max _ hβ
|
| 231 |
-
_ = _ := by rw [integral_add ((finiteMaximum_integrable b).const_mul _) (integrable_const _),integral_const_mul,integral_const]; simp
|
| 232 |
-
by_contra hh
|
| 233 |
-
have hΔ : 0 < (∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) -
|
| 234 |
-
(∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n)) := sub_pos.mpr (lt_of_not_ge hh)
|
| 235 |
-
let Δ := (∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) -
|
| 236 |
-
(∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n))
|
| 237 |
-
let β := (|Real.log (Fintype.card ι)|+1)/Δ
|
| 238 |
-
have hβ : 0 < β := div_pos (by positivity) hΔ
|
| 239 |
-
have hh' := hb β hβ.le
|
| 240 |
-
have he : β*Δ = |Real.log (Fintype.card ι)|+1 := div_mul_cancel₀ _ hΔ.ne'
|
| 241 |
-
have hlog := le_abs_self (Real.log (Fintype.card ι))
|
| 242 |
-
dsimp [Δ] at he
|
| 243 |
-
nlinarith
|
| 244 |
-
|
| 245 |
-
lemma gaussian_integral_reindex {κ ν : Type*} [Fintype κ] [Fintype ν] (e : κ ≃ ν)
|
| 246 |
-
(f : (κ → ℝ) → ℝ) :
|
| 247 |
-
(∫ z : ν → ℝ, f (fun k ↦ z (e k)) ∂gaussianProduct ν) = ∫ z, f z ∂gaussianProduct κ := by
|
| 248 |
-
have he := measurePreserving_piCongrLeft (α := fun _ : κ ↦ ℝ)
|
| 249 |
-
(fun _ : κ ↦ standardGaussian) e.symm
|
| 250 |
-
have hf (z : ν → ℝ) : (MeasurableEquiv.piCongrLeft (π := fun _ : κ ↦ ℝ) e.symm) z = fun k ↦ z (e k) := by
|
| 251 |
-
funext k
|
| 252 |
-
simp [MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply]
|
| 253 |
-
simpa only [gaussianProduct,hf] using he.integral_comp' f
|
| 254 |
-
|
| 255 |
-
lemma linearProcess_reindex {ι κ ν : Type*} [Fintype κ] [Fintype ν]
|
| 256 |
-
(c : ι → κ → ℝ) (e : κ ≃ ν) (z : ν → ℝ) :
|
| 257 |
-
linearProcess c (fun k ↦ z (e k)) = linearProcess (fun i l ↦ c i (e.symm l)) z := by
|
| 258 |
-
funext i
|
| 259 |
-
simpa only [linearProcess, Equiv.symm_apply_apply] using e.sum_comp (fun l ↦ c i (e.symm l)*z l)
|
| 260 |
-
|
| 261 |
-
lemma expected_max_reindex {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]
|
| 262 |
-
(c : ι → κ → ℝ) (e : κ ≃ ν) :
|
| 263 |
-
(∫ z, finiteMaximum (linearProcess (fun i l ↦ c i (e.symm l)) z) ∂gaussianProduct ν) =
|
| 264 |
-
∫ z, finiteMaximum (linearProcess c z) ∂gaussianProduct κ := by
|
| 265 |
-
simpa only [linearProcess_reindex] using gaussian_integral_reindex e (fun z ↦ finiteMaximum (linearProcess c z))
|
| 266 |
-
|
| 267 |
-
lemma expected_max_le_of_pair_distances_orthogonal_fintype {ι κ : Type*}
|
| 268 |
-
[Fintype ι] [Nonempty ι] [Fintype κ] (a b : ι → κ → ℝ)
|
| 269 |
-
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 270 |
-
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 271 |
-
(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 272 |
-
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct κ := by
|
| 273 |
-
let e := Fintype.equivFin κ
|
| 274 |
-
have hh := expected_max_le_of_pair_distances_orthogonal
|
| 275 |
-
(fun i k ↦ a i (e.symm k)) (fun i k ↦ b i (e.symm k))
|
| 276 |
-
(fun i j ↦ by
|
| 277 |
-
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)*(b i k-b j k))]
|
| 278 |
-
exact horth i j)
|
| 279 |
-
(fun i j ↦ by
|
| 280 |
-
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)^2), e.symm.sum_comp (fun k ↦ (b i k-b j k)^2)]
|
| 281 |
-
exact hdist i j)
|
| 282 |
-
simpa only [expected_max_reindex] using hh
|
| 283 |
-
|
| 284 |
-
noncomputable def embedLeft {ι κ ν : Type*} (a : ι → κ → ℝ) (i : ι) : κ ⊕ ν → ℝ :=
|
| 285 |
-
Sum.elim (a i) (fun _ ↦ 0)
|
| 286 |
-
noncomputable def embedRight {ι κ ν : Type*} (b : ι → ν → ℝ) (i : ι) : κ ⊕ ν → ℝ :=
|
| 287 |
-
Sum.elim (fun _ ↦ 0) (b i)
|
| 288 |
-
|
| 289 |
-
lemma expected_max_embedLeft {ι κ ν : Type*} [Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 290 |
-
(a : ι → κ → ℝ) :
|
| 291 |
-
(∫ z, finiteMaximum (linearProcess (embedLeft (ν := ν) a) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 292 |
-
∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct κ := by
|
| 293 |
-
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ
|
| 294 |
-
change (∫ z, finiteMaximum (linearProcess (embedLeft a) z) ∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 295 |
-
rw [← he.integral_comp' (fun z ↦ finiteMaximum (linearProcess (embedLeft a) z))]
|
| 296 |
-
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 297 |
-
linearProcess (embedLeft a) ((MeasurableEquiv.sumPiEquivProdPi (fun _ : κ ⊕ ν ↦ ℝ)).symm p) =
|
| 298 |
-
linearProcess a p.1 := by
|
| 299 |
-
funext i
|
| 300 |
-
simp [linearProcess,embedLeft,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 301 |
-
simp only [hlin]
|
| 302 |
-
simpa [gaussianProduct] using integral_fun_fst (μ := gaussianProduct κ) (ν := gaussianProduct ν) (fun z ↦ finiteMaximum (linearProcess a z))
|
| 303 |
-
|
| 304 |
-
lemma expected_max_embedRight {ι κ ν : Type*} [Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 305 |
-
(b : ι → ν → ℝ) :
|
| 306 |
-
(∫ z, finiteMaximum (linearProcess (embedRight (κ := κ) b) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 307 |
-
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct ν := by
|
| 308 |
-
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ⊕ ν ↦ standardGaussian)
|
| 309 |
-
change (∫ z, finiteMaximum (linearProcess (embedRight b) z) ∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 310 |
-
rw [← he.integral_comp' (fun z ↦ finiteMaximum (linearProcess (embedRight b) z))]
|
| 311 |
-
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 312 |
-
linearProcess (embedRight b) ((MeasurableEquiv.sumPiEquivProdPi (fun _ : κ ⊕ ν ↦ ℝ)).symm p) =
|
| 313 |
-
linearProcess b p.2 := by
|
| 314 |
-
funext i
|
| 315 |
-
simp [linearProcess,embedRight,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 316 |
-
simp only [hlin]
|
| 317 |
-
simpa [gaussianProduct] using integral_fun_snd (μ := gaussianProduct κ) (ν := gaussianProduct ν) (fun z ↦ finiteMaximum (linearProcess b z))
|
| 318 |
-
|
| 319 |
-
lemma expected_max_le_of_pair_distances {ι κ ν : Type*}
|
| 320 |
-
[Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 321 |
-
(a : ι → κ → ℝ) (b : ι → ν → ℝ)
|
| 322 |
-
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 323 |
-
(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 324 |
-
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct ν := by
|
| 325 |
-
have h := expected_max_le_of_pair_distances_orthogonal_fintype
|
| 326 |
-
(embedLeft (ν := ν) a) (embedRight (κ := κ) b)
|
| 327 |
-
(fun i j ↦ by simp [embedLeft,embedRight,Fintype.sum_sum_type])
|
| 328 |
-
(fun i j ↦ by simpa only [Fintype.sum_sum_type,embedLeft,embedRight,
|
| 329 |
-
Sum.elim_inl,Sum.elim_inr,sub_self,zero_pow (by decide : 2 ≠ 0),Finset.sum_const_zero,zero_add,add_zero] using hdist i j)
|
| 330 |
-
simpa only [expected_max_embedLeft,expected_max_embedRight] using h
|
| 331 |
-
|
| 332 |
-
noncomputable def spin (b : Bool) : ℝ := if b then 1 else -1
|
| 333 |
-
noncomputable def hamiltonian (n : ℕ) (J : (Fin n × Fin n) → ℝ)
|
| 334 |
-
(σ : Fin n → Bool) : ℝ :=
|
| 335 |
-
(Real.sqrt (n : ℝ))⁻¹ *
|
| 336 |
-
∑ i : Fin n, ∑ j : Fin n, if i < j then J (i,j) * spin (σ i) * spin (σ j) else 0
|
| 337 |
-
noncomputable def groundStateSequence (n : ℕ) : ℝ :=
|
| 338 |
-
(n : ℝ)⁻¹ * ∫ J, sSup (range (hamiltonian n J)) ∂gaussianProduct (Fin n × Fin n)
|
| 339 |
-
noncomputable def groundStateValue : ℝ := limUnder atTop groundStateSequence
|
| 340 |
-
|
| 341 |
-
noncomputable def hamCoeff (n : ℕ) (σ : Fin n → Bool) (k : Fin n × Fin n) : ℝ :=
|
| 342 |
-
if k.1 < k.2 then (Real.sqrt (n : ℝ))⁻¹ * spin (σ k.1) * spin (σ k.2) else 0
|
| 343 |
-
noncomputable def expectedMaximum (n : ℕ) : ℝ :=
|
| 344 |
-
∫ J, finiteMaximum (linearProcess (hamCoeff n) J) ∂gaussianProduct (Fin n × Fin n)
|
| 345 |
-
|
| 346 |
-
lemma spin_sq (b : Bool) : spin b ^ 2 = 1 := by cases b <;> norm_num [spin]
|
| 347 |
-
lemma abs_spin (b : Bool) : |spin b| = 1 := by cases b <;> norm_num [spin]
|
| 348 |
-
|
| 349 |
-
lemma linearProcess_hamCoeff (n : ℕ) (J : (Fin n × Fin n) → ℝ) :
|
| 350 |
-
linearProcess (hamCoeff n) J = hamiltonian n J := by
|
| 351 |
-
funext σ
|
| 352 |
-
simp only [linearProcess,hamCoeff,hamiltonian,Fintype.sum_prod_type,Finset.mul_sum]
|
| 353 |
-
apply Finset.sum_congr rfl
|
| 354 |
-
intro i _
|
| 355 |
-
apply Finset.sum_congr rfl
|
| 356 |
-
intro j _
|
| 357 |
-
split_ifs <;> ring
|
| 358 |
-
|
| 359 |
-
lemma groundStateSequence_eq (n : ℕ) : groundStateSequence n = (n : ℝ)⁻¹ * expectedMaximum n := by
|
| 360 |
-
simp only [groundStateSequence,expectedMaximum,linearProcess_hamCoeff,finiteMaximum]
|
| 361 |
-
|
| 362 |
-
lemma twice_upper_sum {ι : Type*} [Fintype ι] [LinearOrder ι] (f : ι → ι → ℝ)
|
| 363 |
-
(hsymm : ∀ i j, f i j = f j i) (hdiag : ∀ i, f i i = 0) :
|
| 364 |
-
2*(∑ i, ∑ j, if i < j then f i j else 0) = ∑ i, ∑ j, f i j := by
|
| 365 |
-
have hs : (∑ i, ∑ j, if j < i then f i j else 0) = ∑ i, ∑ j, if i < j then f i j else 0 := by
|
| 366 |
-
rw [Finset.sum_comm]
|
| 367 |
-
apply Finset.sum_congr rfl
|
| 368 |
-
intro i _
|
| 369 |
-
apply Finset.sum_congr rfl
|
| 370 |
-
intro j _
|
| 371 |
-
rw [hsymm j i]
|
| 372 |
-
have hsplit (i j : ι) : f i j = (if i < j then f i j else 0)+(if j < i then f i j else 0) := by
|
| 373 |
-
rcases lt_trichotomy i j with h | h | h
|
| 374 |
-
· simp [h,not_lt_of_ge h.le]
|
| 375 |
-
· subst j; simp [hdiag]
|
| 376 |
-
· simp [h,not_lt_of_ge h.le]
|
| 377 |
-
conv_rhs => arg 2; ext i; arg 2; ext j; rw [hsplit i j]
|
| 378 |
-
simp only [Finset.sum_add_distrib,hs]
|
| 379 |
-
ring
|
| 380 |
-
|
| 381 |
-
lemma spin_pair_difference {dimension : ℕ} (σ τ : Fin dimension → Bool) (i j : Fin dimension) :
|
| 382 |
-
(spin (σ i)*spin (σ j)-spin (τ i)*spin (τ j))^2 =
|
| 383 |
-
2-2*(spin (σ i)*spin (τ i))*(spin (σ j)*spin (τ j)) := by
|
| 384 |
-
have h1 := spin_sq (σ i)
|
| 385 |
-
have h2 := spin_sq (σ j)
|
| 386 |
-
have h3 := spin_sq (τ i)
|
| 387 |
-
have h4 := spin_sq (τ j)
|
| 388 |
-
calc
|
| 389 |
-
_ = (spin (σ i))^2*(spin (σ j))^2+(spin (τ i))^2*(spin (τ j))^2 -
|
| 390 |
-
2*(spin (σ i)*spin (τ i))*(spin (σ j)*spin (τ j)) := by ring
|
| 391 |
-
_ = _ := by rw [h1,h2,h3,h4]; ring
|
| 392 |
-
|
| 393 |
-
end SKValueG
|
| 394 |
-
end
|
| 395 |
-
|
| 396 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.StandardGaussian
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 8 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 9 |
+
namespace SKValueG
|
| 10 |
+
|
| 11 |
+
lemma gaussian_gibbs_derivative_nonneg {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 12 |
+
{n : ℕ} (c d : ι → Fin n → ℝ)
|
| 13 |
+
(h : ∀ i j, 0 ≤ ∑ k, (d i k-d j k)*(c i k-c j k)) :
|
| 14 |
+
0 ≤ ∫ z, ∑ i, gibbsWeight (linearProcess c z) i*linearProcess d z i ∂gaussianProduct (Fin n) := by
|
| 15 |
+
have hi : ∀ i, Integrable (fun z ↦ gibbsWeight (linearProcess c z) i*linearProcess d z i)
|
| 16 |
+
(gaussianProduct (Fin n)) := fun i ↦ gibbsWeight_mul_integrable c i (linearProcess_integrable d i)
|
| 17 |
+
have hi' : ∀ i, Integrable (fun z ↦ gibbsWeight (linearProcess c z) i *
|
| 18 |
+
((∑ k, d i k*c i k)-∑ j, gibbsWeight (linearProcess c z) j*(∑ k, d i k*c j k)))
|
| 19 |
+
(gaussianProduct (Fin n)) := by
|
| 20 |
+
intro i
|
| 21 |
+
apply gibbsWeight_mul_integrable
|
| 22 |
+
exact (integrable_const _).sub (integrable_finsetSum _ (fun j _ ↦ (integrable_linear_gibbsWeight c j).mul_const _))
|
| 23 |
+
rw [integral_finsetSum _ (fun i _ ↦ hi i)]
|
| 24 |
+
simp_rw [gaussian_linear_gibbsWeight]
|
| 25 |
+
rw [← integral_finsetSum _ (fun i _ ↦ hi' i)]
|
| 26 |
+
apply integral_nonneg
|
| 27 |
+
intro z
|
| 28 |
+
change (0 : ℝ) ≤ ∑ i, gibbsWeight (linearProcess c z) i *
|
| 29 |
+
((∑ k, d i k*c i k)-∑ j, gibbsWeight (linearProcess c z) j*(∑ k, d i k*c j k))
|
| 30 |
+
rw [weighted_covariance_pairs _ (fun i j ↦ ∑ k, d i k*c j k) (sum_gibbsWeight (linearProcess c z))]
|
| 31 |
+
apply mul_nonneg (by norm_num)
|
| 32 |
+
apply Finset.sum_nonneg
|
| 33 |
+
intro i _
|
| 34 |
+
apply Finset.sum_nonneg
|
| 35 |
+
intro j _
|
| 36 |
+
apply mul_nonneg (mul_nonneg (gibbsWeight_nonneg _ _) (gibbsWeight_nonneg _ _))
|
| 37 |
+
have he : (∑ k, d i k*c i k)+(∑ k, d j k*c j k)-
|
| 38 |
+
(∑ k, d i k*c j k)-(∑ k, d j k*c i k) = ∑ k, (d i k-d j k)*(c i k-c j k) := by
|
| 39 |
+
rw [← Finset.sum_add_distrib,← Finset.sum_sub_distrib,← Finset.sum_sub_distrib]
|
| 40 |
+
apply Finset.sum_congr rfl; intro k _; ring
|
| 41 |
+
rw [he]
|
| 42 |
+
exact h i j
|
| 43 |
+
|
| 44 |
+
noncomputable def rotatedCoefficients {ι κ : Type*} (a b : ι → κ → ℝ) (t : ℝ) (i : ι) (k : κ) : ℝ :=
|
| 45 |
+
Real.cos t*a i k + Real.sin t*b i k
|
| 46 |
+
|
| 47 |
+
noncomputable def rotationVelocity {ι κ : Type*} (a b : ι → κ → ℝ) (t : ℝ) (i : ι) (k : κ) : ℝ :=
|
| 48 |
+
-Real.sin t*a i k + Real.cos t*b i k
|
| 49 |
+
|
| 50 |
+
lemma hasDerivAt_rotatedProcess {ι κ : Type*} [Fintype κ] (a b : ι → κ → ℝ)
|
| 51 |
+
(t : ℝ) (z : κ → ℝ) (i : ι) :
|
| 52 |
+
HasDerivAt (fun s ↦ linearProcess (rotatedCoefficients a b s) z i)
|
| 53 |
+
(linearProcess (rotationVelocity a b t) z i) t := by
|
| 54 |
+
exact HasDerivAt.fun_sum (u := Finset.univ) (fun k _ ↦
|
| 55 |
+
(((Real.hasDerivAt_cos t).mul_const (a i k)).add ((Real.hasDerivAt_sin t).mul_const (b i k))).mul_const (z k))
|
| 56 |
+
|
| 57 |
+
lemma abs_rotationVelocity_le {ι κ : Type*} (a b : ι → κ → ℝ) (t : ℝ) (i : ι) (k : κ) :
|
| 58 |
+
|rotationVelocity a b t i k| ≤ |a i k|+|b i k| := by
|
| 59 |
+
calc
|
| 60 |
+
_ ≤ |-Real.sin t*a i k| + |Real.cos t*b i k| := abs_add_le _ _
|
| 61 |
+
_ = |Real.sin t| *|a i k| + |Real.cos t| *|b i k| := by rw [abs_mul,abs_neg,abs_mul]
|
| 62 |
+
_ ≤ 1*|a i k| + 1*|b i k| := add_le_add
|
| 63 |
+
(mul_le_mul_of_nonneg_right (Real.abs_sin_le_one t) (abs_nonneg _))
|
| 64 |
+
(mul_le_mul_of_nonneg_right (Real.abs_cos_le_one t) (abs_nonneg _))
|
| 65 |
+
_ = _ := by ring
|
| 66 |
+
|
| 67 |
+
lemma rotation_derivative_bound {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 68 |
+
(a b : ι → κ → ℝ) (t : ℝ) (z : κ → ℝ) :
|
| 69 |
+
|∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 70 |
+
linearProcess (rotationVelocity a b t) z i| ≤
|
| 71 |
+
∑ i, ∑ k, (|a i k|+|b i k|)*|z k| := by
|
| 72 |
+
apply abs_gibbsMean_le
|
| 73 |
+
intro i
|
| 74 |
+
calc
|
| 75 |
+
_ ≤ ∑ k, |rotationVelocity a b t i k*z k| := Finset.abs_sum_le_sum_abs _ _
|
| 76 |
+
_ ≤ ∑ k, (|a i k|+|b i k|)*|z k| := by
|
| 77 |
+
apply Finset.sum_le_sum
|
| 78 |
+
intro k _
|
| 79 |
+
rw [abs_mul]
|
| 80 |
+
exact mul_le_mul_of_nonneg_right (abs_rotationVelocity_le _ _ _ _ _) (abs_nonneg _)
|
| 81 |
+
_ ≤ _ := Finset.single_le_sum (f := fun j ↦ ∑ k, (|a j k|+|b j k|)*|z k|) (fun j _ ↦ Finset.sum_nonneg (fun k _ ↦ mul_nonneg (add_nonneg (abs_nonneg _) (abs_nonneg _)) (abs_nonneg _))) (Finset.mem_univ i)
|
| 82 |
+
|
| 83 |
+
lemma hasDerivAt_expected_rotated_logPartition {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 84 |
+
{n : ℕ} (a b : ι → Fin n → ℝ) (t : ℝ) :
|
| 85 |
+
HasDerivAt (fun s ↦ ∫ z, logPartition (linearProcess (rotatedCoefficients a b s) z) ∂gaussianProduct (Fin n))
|
| 86 |
+
(∫ z, ∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 87 |
+
linearProcess (rotationVelocity a b t) z i ∂gaussianProduct (Fin n)) t := by
|
| 88 |
+
have hb : Integrable (fun z : Fin n → ℝ ↦ ∑ i, ∑ k, (|a i k|+|b i k|)*|z k|)
|
| 89 |
+
(gaussianProduct (Fin n)) :=
|
| 90 |
+
integrable_finsetSum _ (fun i _ ↦ integrable_finsetSum _ (fun k _ ↦
|
| 91 |
+
(gaussian_coordinate_integrable k).abs.const_mul _))
|
| 92 |
+
have hmc : Continuous (fun z : Fin n → ℝ ↦ ∑ i,
|
| 93 |
+
gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 94 |
+
linearProcess (rotationVelocity a b t) z i) := by
|
| 95 |
+
apply continuous_finsetSum
|
| 96 |
+
intro i _
|
| 97 |
+
apply (continuous_linear_gibbsWeight _ _).mul
|
| 98 |
+
exact (continuous_apply i).comp (continuous_linearProcess _)
|
| 99 |
+
exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le (s := Set.univ) (μ := gaussianProduct (Fin n))
|
| 100 |
+
(F := fun s z ↦ logPartition (linearProcess (rotatedCoefficients a b s) z))
|
| 101 |
+
(F' := fun s z ↦ ∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b s) z) i *
|
| 102 |
+
linearProcess (rotationVelocity a b s) z i)
|
| 103 |
+
(bound := fun z ↦ ∑ i, ∑ k, (|a i k|+|b i k|)*|z k|)
|
| 104 |
+
(Filter.univ_mem)
|
| 105 |
+
(Eventually.of_forall (fun s ↦ (continuous_logPartition.comp (continuous_linearProcess _)).aestronglyMeasurable))
|
| 106 |
+
(logPartition_integrable _) hmc.aestronglyMeasurable
|
| 107 |
+
(Eventually.of_forall (fun z s _ ↦ by simpa only [Real.norm_eq_abs] using rotation_derivative_bound a b s z)) hb
|
| 108 |
+
(Eventually.of_forall (fun z s _ ↦ hasDerivAt_logPartition (hasDerivAt_rotatedProcess a b s z)))).2
|
| 109 |
+
|
| 110 |
+
lemma rotation_pair_covariance {ι κ : Type*} [Fintype κ] (a b : ι → κ → ℝ) (t : ℝ) (i j : ι) :
|
| 111 |
+
(∑ k, (rotationVelocity a b t i k-rotationVelocity a b t j k)*
|
| 112 |
+
(rotatedCoefficients a b t i k-rotatedCoefficients a b t j k)) =
|
| 113 |
+
Real.sin t*Real.cos t*((∑ k, (b i k-b j k)^2)-(∑ k, (a i k-a j k)^2)) +
|
| 114 |
+
((Real.cos t)^2-(Real.sin t)^2)*∑ k, (a i k-a j k)*(b i k-b j k) := by
|
| 115 |
+
simp only [rotationVelocity,rotatedCoefficients,← Finset.sum_sub_distrib,Finset.mul_sum,← Finset.sum_add_distrib]
|
| 116 |
+
apply Finset.sum_congr rfl
|
| 117 |
+
intro k _
|
| 118 |
+
ring
|
| 119 |
+
|
| 120 |
+
lemma expected_logPartition_le_of_pair_distances {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 121 |
+
{n : ℕ} (a b : ι → Fin n → ℝ)
|
| 122 |
+
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 123 |
+
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 124 |
+
(∫ z, logPartition (linearProcess a z) ∂gaussianProduct (Fin n)) ≤
|
| 125 |
+
∫ z, logPartition (linearProcess b z) ∂gaussianProduct (Fin n) := by
|
| 126 |
+
let F := fun t ↦ ∫ z, logPartition (linearProcess (rotatedCoefficients a b t) z) ∂gaussianProduct (Fin n)
|
| 127 |
+
have hd : ∀ t, HasDerivAt F (∫ z, ∑ i, gibbsWeight (linearProcess (rotatedCoefficients a b t) z) i *
|
| 128 |
+
linearProcess (rotationVelocity a b t) z i ∂gaussianProduct (Fin n)) t :=
|
| 129 |
+
hasDerivAt_expected_rotated_logPartition a b
|
| 130 |
+
have hc : Continuous F := continuous_iff_continuousAt.mpr (fun t ↦ (hd t).continuousAt)
|
| 131 |
+
have hm : MonotoneOn F (Icc (0 : ℝ) (Real.pi/2)) := by
|
| 132 |
+
apply monotoneOn_of_deriv_nonneg (convex_Icc _ _) hc.continuousOn
|
| 133 |
+
(fun t _ ↦ (hd t).differentiableAt.differentiableWithinAt)
|
| 134 |
+
intro t ht
|
| 135 |
+
have ht' : t ∈ Icc (0 : ℝ) (Real.pi/2) := interior_subset ht
|
| 136 |
+
rw [(hd t).deriv]
|
| 137 |
+
apply gaussian_gibbs_derivative_nonneg
|
| 138 |
+
intro i j
|
| 139 |
+
rw [rotation_pair_covariance,horth,mul_zero,add_zero]
|
| 140 |
+
exact mul_nonneg (mul_nonneg
|
| 141 |
+
(Real.sin_nonneg_of_nonneg_of_le_pi ht'.1 (ht'.2.trans (by linarith [Real.pi_pos])))
|
| 142 |
+
(Real.cos_nonneg_of_mem_Icc ⟨by linarith [Real.pi_pos, ht'.1],ht'.2⟩)) (sub_nonneg.mpr (hdist i j))
|
| 143 |
+
have hπ : (0 : ℝ) ≤ Real.pi/2 := by positivity
|
| 144 |
+
have hh := hm ⟨le_rfl,hπ⟩ ⟨hπ,le_rfl⟩ hπ
|
| 145 |
+
have ha0 : rotatedCoefficients a b 0 = a := by funext i k; simp [rotatedCoefficients]
|
| 146 |
+
have hb0 : rotatedCoefficients a b (Real.pi/2) = b := by funext i k; simp [rotatedCoefficients]
|
| 147 |
+
simpa only [F,ha0,hb0] using hh
|
| 148 |
+
|
| 149 |
+
noncomputable def finiteMaximum {ι : Type*} (x : ι → ℝ) : ℝ := sSup (Set.range x)
|
| 150 |
+
|
| 151 |
+
lemma le_finiteMaximum {ι : Type*} [Fintype ι] (x : ι → ℝ) (i : ι) : x i ≤ finiteMaximum x :=
|
| 152 |
+
le_csSup (Set.finite_range x).bddAbove (Set.mem_range_self i)
|
| 153 |
+
|
| 154 |
+
lemma exists_finiteMaximum {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 155 |
+
∃ i, x i = finiteMaximum x := (Set.range_nonempty x).csSup_mem (Set.finite_range x)
|
| 156 |
+
|
| 157 |
+
lemma continuous_finiteMaximum {ι : Type*} [Fintype ι] [Nonempty ι] :
|
| 158 |
+
Continuous (@finiteMaximum ι) := by
|
| 159 |
+
have he (x : ι → ℝ) : finiteMaximum x = Finset.univ.sup' Finset.univ_nonempty x := by
|
| 160 |
+
rw [Finset.sup'_eq_csSup_image]
|
| 161 |
+
simp only [Finset.coe_univ,Set.image_univ,finiteMaximum]
|
| 162 |
+
simp_rw [funext he]
|
| 163 |
+
exact Continuous.finset_sup'_apply Finset.univ_nonempty (fun i _ ↦ continuous_apply i)
|
| 164 |
+
|
| 165 |
+
lemma abs_finiteMaximum_le {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 166 |
+
|finiteMaximum x| ≤ ∑ i, |x i| := by
|
| 167 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 168 |
+
rw [← hi]
|
| 169 |
+
exact Finset.single_le_sum (fun j _ ↦ abs_nonneg (x j)) (Finset.mem_univ i)
|
| 170 |
+
|
| 171 |
+
lemma finiteMaximum_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 172 |
+
(c : ι → κ → ℝ) : Integrable (fun z ↦ finiteMaximum (linearProcess c z)) (gaussianProduct κ) := by
|
| 173 |
+
apply (integrable_finsetSum Finset.univ (fun i _ ↦ (linearProcess_integrable c i).abs)).mono'
|
| 174 |
+
((continuous_finiteMaximum.comp (continuous_linearProcess c)).aestronglyMeasurable)
|
| 175 |
+
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_def] using abs_finiteMaximum_le (linearProcess c z))
|
| 176 |
+
|
| 177 |
+
lemma scaled_max_le_logPartition {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ)
|
| 178 |
+
(β : ℝ) : β*finiteMaximum x ≤ logPartition (fun i ↦ β*x i) := by
|
| 179 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum x
|
| 180 |
+
rw [← hi]
|
| 181 |
+
exact le_logPartition (fun i ↦ β*x i) i
|
| 182 |
+
|
| 183 |
+
lemma logPartition_le_scaled_max {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ)
|
| 184 |
+
{β : ℝ} (hβ : 0 ≤ β) : logPartition (fun i ↦ β*x i) ≤ β*finiteMaximum x+Real.log (Fintype.card ι) := by
|
| 185 |
+
exact (logPartition_le _ (fun i ↦ mul_le_mul_of_nonneg_left (le_finiteMaximum x i) hβ)).trans_eq (add_comm _ _)
|
| 186 |
+
|
| 187 |
+
lemma linearProcess_scaled {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) (β : ℝ) (z : κ → ℝ) :
|
| 188 |
+
linearProcess (fun i k ↦ β*c i k) z = fun i ↦ β*linearProcess c z i := by
|
| 189 |
+
funext i
|
| 190 |
+
simp only [linearProcess,Finset.mul_sum,mul_assoc]
|
| 191 |
+
|
| 192 |
+
lemma expected_max_le_of_pair_distances_orthogonal {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 193 |
+
{n : ℕ} (a b : ι → Fin n → ℝ)
|
| 194 |
+
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 195 |
+
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 196 |
+
(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) ≤
|
| 197 |
+
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n) := by
|
| 198 |
+
have hb (β : ℝ) (hβ : 0 ≤ β) :
|
| 199 |
+
β*(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) ≤
|
| 200 |
+
β*(∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n)) + Real.log (Fintype.card ι) := by
|
| 201 |
+
have hiA := logPartition_integrable (fun i k ↦ β*a i k)
|
| 202 |
+
have hiB := logPartition_integrable (fun i k ↦ β*b i k)
|
| 203 |
+
have hcomp := expected_logPartition_le_of_pair_distances
|
| 204 |
+
(fun i k ↦ β*a i k) (fun i k ↦ β*b i k)
|
| 205 |
+
(fun i j ↦ by
|
| 206 |
+
calc
|
| 207 |
+
(∑ k, (β*a i k-β*a j k)*(β*b i k-β*b j k)) =
|
| 208 |
+
β^2*(∑ k, (a i k-a j k)*(b i k-b j k)) := by
|
| 209 |
+
rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring
|
| 210 |
+
_ = 0 := by rw [horth,mul_zero])
|
| 211 |
+
(fun i j ↦ by
|
| 212 |
+
have he (c : ι → Fin n → ℝ) : (∑ k, (β*c i k-β*c j k)^2) = β^2*∑ k, (c i k-c j k)^2 := by
|
| 213 |
+
rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring
|
| 214 |
+
rw [he,he]
|
| 215 |
+
exact mul_le_mul_of_nonneg_left (hdist i j) (sq_nonneg β))
|
| 216 |
+
calc
|
| 217 |
+
_ = ∫ z, β*finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n) := by rw [integral_const_mul]
|
| 218 |
+
_ ≤ ∫ z, logPartition (linearProcess (fun i k ↦ β*a i k) z) ∂gaussianProduct (Fin n) := by
|
| 219 |
+
apply integral_mono ((finiteMaximum_integrable a).const_mul _) hiA
|
| 220 |
+
intro z
|
| 221 |
+
change β*finiteMaximum (linearProcess a z) ≤ logPartition (linearProcess (fun i k ↦ β*a i k) z)
|
| 222 |
+
rw [linearProcess_scaled]
|
| 223 |
+
exact scaled_max_le_logPartition _ _
|
| 224 |
+
_ ≤ _ := hcomp
|
| 225 |
+
_ ≤ ∫ z, β*finiteMaximum (linearProcess b z)+Real.log (Fintype.card ι) ∂gaussianProduct (Fin n) := by
|
| 226 |
+
apply integral_mono hiB (((finiteMaximum_integrable b).const_mul _).add (integrable_const _))
|
| 227 |
+
intro z
|
| 228 |
+
change logPartition (linearProcess (fun i k ↦ β*b i k) z) ≤ β*finiteMaximum (linearProcess b z)+Real.log (Fintype.card ι)
|
| 229 |
+
rw [linearProcess_scaled]
|
| 230 |
+
exact logPartition_le_scaled_max _ hβ
|
| 231 |
+
_ = _ := by rw [integral_add ((finiteMaximum_integrable b).const_mul _) (integrable_const _),integral_const_mul,integral_const]; simp
|
| 232 |
+
by_contra hh
|
| 233 |
+
have hΔ : 0 < (∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) -
|
| 234 |
+
(∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n)) := sub_pos.mpr (lt_of_not_ge hh)
|
| 235 |
+
let Δ := (∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct (Fin n)) -
|
| 236 |
+
(∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct (Fin n))
|
| 237 |
+
let β := (|Real.log (Fintype.card ι)|+1)/Δ
|
| 238 |
+
have hβ : 0 < β := div_pos (by positivity) hΔ
|
| 239 |
+
have hh' := hb β hβ.le
|
| 240 |
+
have he : β*Δ = |Real.log (Fintype.card ι)|+1 := div_mul_cancel₀ _ hΔ.ne'
|
| 241 |
+
have hlog := le_abs_self (Real.log (Fintype.card ι))
|
| 242 |
+
dsimp [Δ] at he
|
| 243 |
+
nlinarith
|
| 244 |
+
|
| 245 |
+
lemma gaussian_integral_reindex {κ ν : Type*} [Fintype κ] [Fintype ν] (e : κ ≃ ν)
|
| 246 |
+
(f : (κ → ℝ) → ℝ) :
|
| 247 |
+
(∫ z : ν → ℝ, f (fun k ↦ z (e k)) ∂gaussianProduct ν) = ∫ z, f z ∂gaussianProduct κ := by
|
| 248 |
+
have he := measurePreserving_piCongrLeft (α := fun _ : κ ↦ ℝ)
|
| 249 |
+
(fun _ : κ ↦ standardGaussian) e.symm
|
| 250 |
+
have hf (z : ν → ℝ) : (MeasurableEquiv.piCongrLeft (π := fun _ : κ ↦ ℝ) e.symm) z = fun k ↦ z (e k) := by
|
| 251 |
+
funext k
|
| 252 |
+
simp [MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply]
|
| 253 |
+
simpa only [gaussianProduct,hf] using he.integral_comp' f
|
| 254 |
+
|
| 255 |
+
lemma linearProcess_reindex {ι κ ν : Type*} [Fintype κ] [Fintype ν]
|
| 256 |
+
(c : ι → κ → ℝ) (e : κ ≃ ν) (z : ν → ℝ) :
|
| 257 |
+
linearProcess c (fun k ↦ z (e k)) = linearProcess (fun i l ↦ c i (e.symm l)) z := by
|
| 258 |
+
funext i
|
| 259 |
+
simpa only [linearProcess, Equiv.symm_apply_apply] using e.sum_comp (fun l ↦ c i (e.symm l)*z l)
|
| 260 |
+
|
| 261 |
+
lemma expected_max_reindex {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]
|
| 262 |
+
(c : ι → κ → ℝ) (e : κ ≃ ν) :
|
| 263 |
+
(∫ z, finiteMaximum (linearProcess (fun i l ↦ c i (e.symm l)) z) ∂gaussianProduct ν) =
|
| 264 |
+
∫ z, finiteMaximum (linearProcess c z) ∂gaussianProduct κ := by
|
| 265 |
+
simpa only [linearProcess_reindex] using gaussian_integral_reindex e (fun z ↦ finiteMaximum (linearProcess c z))
|
| 266 |
+
|
| 267 |
+
lemma expected_max_le_of_pair_distances_orthogonal_fintype {ι κ : Type*}
|
| 268 |
+
[Fintype ι] [Nonempty ι] [Fintype κ] (a b : ι → κ → ℝ)
|
| 269 |
+
(horth : ∀ i j, (∑ k, (a i k-a j k)*(b i k-b j k)) = 0)
|
| 270 |
+
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 271 |
+
(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 272 |
+
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct κ := by
|
| 273 |
+
let e := Fintype.equivFin κ
|
| 274 |
+
have hh := expected_max_le_of_pair_distances_orthogonal
|
| 275 |
+
(fun i k ↦ a i (e.symm k)) (fun i k ↦ b i (e.symm k))
|
| 276 |
+
(fun i j ↦ by
|
| 277 |
+
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)*(b i k-b j k))]
|
| 278 |
+
exact horth i j)
|
| 279 |
+
(fun i j ↦ by
|
| 280 |
+
rw [e.symm.sum_comp (fun k ↦ (a i k-a j k)^2), e.symm.sum_comp (fun k ↦ (b i k-b j k)^2)]
|
| 281 |
+
exact hdist i j)
|
| 282 |
+
simpa only [expected_max_reindex] using hh
|
| 283 |
+
|
| 284 |
+
noncomputable def embedLeft {ι κ ν : Type*} (a : ι → κ → ℝ) (i : ι) : κ ⊕ ν → ℝ :=
|
| 285 |
+
Sum.elim (a i) (fun _ ↦ 0)
|
| 286 |
+
noncomputable def embedRight {ι κ ν : Type*} (b : ι → ν → ℝ) (i : ι) : κ ⊕ ν → ℝ :=
|
| 287 |
+
Sum.elim (fun _ ↦ 0) (b i)
|
| 288 |
+
|
| 289 |
+
lemma expected_max_embedLeft {ι κ ν : Type*} [Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 290 |
+
(a : ι → κ → ℝ) :
|
| 291 |
+
(∫ z, finiteMaximum (linearProcess (embedLeft (ν := ν) a) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 292 |
+
∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct κ := by
|
| 293 |
+
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ��� ν ↦ standardGaussian)
|
| 294 |
+
change (∫ z, finiteMaximum (linearProcess (embedLeft a) z) ∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 295 |
+
rw [← he.integral_comp' (fun z ↦ finiteMaximum (linearProcess (embedLeft a) z))]
|
| 296 |
+
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 297 |
+
linearProcess (embedLeft a) ((MeasurableEquiv.sumPiEquivProdPi (fun _ : κ ⊕ ν ↦ ℝ)).symm p) =
|
| 298 |
+
linearProcess a p.1 := by
|
| 299 |
+
funext i
|
| 300 |
+
simp [linearProcess,embedLeft,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 301 |
+
simp only [hlin]
|
| 302 |
+
simpa [gaussianProduct] using integral_fun_fst (μ := gaussianProduct κ) (ν := gaussianProduct ν) (fun z ↦ finiteMaximum (linearProcess a z))
|
| 303 |
+
|
| 304 |
+
lemma expected_max_embedRight {ι κ ν : Type*} [Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 305 |
+
(b : ι → ν → ℝ) :
|
| 306 |
+
(∫ z, finiteMaximum (linearProcess (embedRight (κ := κ) b) z) ∂gaussianProduct (κ ⊕ ν)) =
|
| 307 |
+
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct ν := by
|
| 308 |
+
have he := measurePreserving_sumPiEquivProdPi_symm (fun _ : κ ⊕ ν ↦ standardGaussian)
|
| 309 |
+
change (∫ z, finiteMaximum (linearProcess (embedRight b) z) ∂Measure.pi (fun _ : κ ⊕ ν ↦ standardGaussian)) = _
|
| 310 |
+
rw [← he.integral_comp' (fun z ↦ finiteMaximum (linearProcess (embedRight b) z))]
|
| 311 |
+
have hlin (p : (κ → ℝ) × (ν → ℝ)) :
|
| 312 |
+
linearProcess (embedRight b) ((MeasurableEquiv.sumPiEquivProdPi (fun _ : κ ⊕ ν ↦ ℝ)).symm p) =
|
| 313 |
+
linearProcess b p.2 := by
|
| 314 |
+
funext i
|
| 315 |
+
simp [linearProcess,embedRight,Fintype.sum_sum_type,MeasurableEquiv.coe_sumPiEquivProdPi_symm]
|
| 316 |
+
simp only [hlin]
|
| 317 |
+
simpa [gaussianProduct] using integral_fun_snd (μ := gaussianProduct κ) (ν := gaussianProduct ν) (fun z ↦ finiteMaximum (linearProcess b z))
|
| 318 |
+
|
| 319 |
+
lemma expected_max_le_of_pair_distances {ι κ ν : Type*}
|
| 320 |
+
[Fintype ι] [Nonempty ι] [Fintype κ] [Fintype ν]
|
| 321 |
+
(a : ι → κ → ℝ) (b : ι → ν → ℝ)
|
| 322 |
+
(hdist : ∀ i j, (∑ k, (a i k-a j k)^2) ≤ ∑ k, (b i k-b j k)^2) :
|
| 323 |
+
(∫ z, finiteMaximum (linearProcess a z) ∂gaussianProduct κ) ≤
|
| 324 |
+
∫ z, finiteMaximum (linearProcess b z) ∂gaussianProduct ν := by
|
| 325 |
+
have h := expected_max_le_of_pair_distances_orthogonal_fintype
|
| 326 |
+
(embedLeft (ν := ν) a) (embedRight (κ := κ) b)
|
| 327 |
+
(fun i j ↦ by simp [embedLeft,embedRight,Fintype.sum_sum_type])
|
| 328 |
+
(fun i j ↦ by simpa only [Fintype.sum_sum_type,embedLeft,embedRight,
|
| 329 |
+
Sum.elim_inl,Sum.elim_inr,sub_self,zero_pow (by decide : 2 ≠ 0),Finset.sum_const_zero,zero_add,add_zero] using hdist i j)
|
| 330 |
+
simpa only [expected_max_embedLeft,expected_max_embedRight] using h
|
| 331 |
+
|
| 332 |
+
noncomputable def spin (b : Bool) : ℝ := if b then 1 else -1
|
| 333 |
+
noncomputable def hamiltonian (n : ℕ) (J : (Fin n × Fin n) → ℝ)
|
| 334 |
+
(σ : Fin n → Bool) : ℝ :=
|
| 335 |
+
(Real.sqrt (n : ℝ))⁻¹ *
|
| 336 |
+
∑ i : Fin n, ∑ j : Fin n, if i < j then J (i,j) * spin (σ i) * spin (σ j) else 0
|
| 337 |
+
noncomputable def groundStateSequence (n : ℕ) : ℝ :=
|
| 338 |
+
(n : ℝ)⁻¹ * ∫ J, sSup (range (hamiltonian n J)) ∂gaussianProduct (Fin n × Fin n)
|
| 339 |
+
noncomputable def groundStateValue : ℝ := limUnder atTop groundStateSequence
|
| 340 |
+
|
| 341 |
+
noncomputable def hamCoeff (n : ℕ) (σ : Fin n → Bool) (k : Fin n × Fin n) : ℝ :=
|
| 342 |
+
if k.1 < k.2 then (Real.sqrt (n : ℝ))⁻¹ * spin (σ k.1) * spin (σ k.2) else 0
|
| 343 |
+
noncomputable def expectedMaximum (n : ℕ) : ℝ :=
|
| 344 |
+
∫ J, finiteMaximum (linearProcess (hamCoeff n) J) ∂gaussianProduct (Fin n × Fin n)
|
| 345 |
+
|
| 346 |
+
lemma spin_sq (b : Bool) : spin b ^ 2 = 1 := by cases b <;> norm_num [spin]
|
| 347 |
+
lemma abs_spin (b : Bool) : |spin b| = 1 := by cases b <;> norm_num [spin]
|
| 348 |
+
|
| 349 |
+
lemma linearProcess_hamCoeff (n : ℕ) (J : (Fin n × Fin n) → ℝ) :
|
| 350 |
+
linearProcess (hamCoeff n) J = hamiltonian n J := by
|
| 351 |
+
funext σ
|
| 352 |
+
simp only [linearProcess,hamCoeff,hamiltonian,Fintype.sum_prod_type,Finset.mul_sum]
|
| 353 |
+
apply Finset.sum_congr rfl
|
| 354 |
+
intro i _
|
| 355 |
+
apply Finset.sum_congr rfl
|
| 356 |
+
intro j _
|
| 357 |
+
split_ifs <;> ring
|
| 358 |
+
|
| 359 |
+
lemma groundStateSequence_eq (n : ℕ) : groundStateSequence n = (n : ℝ)⁻¹ * expectedMaximum n := by
|
| 360 |
+
simp only [groundStateSequence,expectedMaximum,linearProcess_hamCoeff,finiteMaximum]
|
| 361 |
+
|
| 362 |
+
lemma twice_upper_sum {ι : Type*} [Fintype ι] [LinearOrder ι] (f : ι → ι → ℝ)
|
| 363 |
+
(hsymm : ∀ i j, f i j = f j i) (hdiag : ∀ i, f i i = 0) :
|
| 364 |
+
2*(∑ i, ∑ j, if i < j then f i j else 0) = ∑ i, ∑ j, f i j := by
|
| 365 |
+
have hs : (∑ i, ∑ j, if j < i then f i j else 0) = ∑ i, ∑ j, if i < j then f i j else 0 := by
|
| 366 |
+
rw [Finset.sum_comm]
|
| 367 |
+
apply Finset.sum_congr rfl
|
| 368 |
+
intro i _
|
| 369 |
+
apply Finset.sum_congr rfl
|
| 370 |
+
intro j _
|
| 371 |
+
rw [hsymm j i]
|
| 372 |
+
have hsplit (i j : ι) : f i j = (if i < j then f i j else 0)+(if j < i then f i j else 0) := by
|
| 373 |
+
rcases lt_trichotomy i j with h | h | h
|
| 374 |
+
· simp [h,not_lt_of_ge h.le]
|
| 375 |
+
· subst j; simp [hdiag]
|
| 376 |
+
· simp [h,not_lt_of_ge h.le]
|
| 377 |
+
conv_rhs => arg 2; ext i; arg 2; ext j; rw [hsplit i j]
|
| 378 |
+
simp only [Finset.sum_add_distrib,hs]
|
| 379 |
+
ring
|
| 380 |
+
|
| 381 |
+
lemma spin_pair_difference {dimension : ℕ} (σ τ : Fin dimension → Bool) (i j : Fin dimension) :
|
| 382 |
+
(spin (σ i)*spin (σ j)-spin (τ i)*spin (τ j))^2 =
|
| 383 |
+
2-2*(spin (σ i)*spin (τ i))*(spin (σ j)*spin (τ j)) := by
|
| 384 |
+
have h1 := spin_sq (σ i)
|
| 385 |
+
have h2 := spin_sq (σ j)
|
| 386 |
+
have h3 := spin_sq (τ i)
|
| 387 |
+
have h4 := spin_sq (τ j)
|
| 388 |
+
calc
|
| 389 |
+
_ = (spin (σ i))^2*(spin (σ j))^2+(spin (τ i))^2*(spin (τ j))^2 -
|
| 390 |
+
2*(spin (σ i)*spin (τ i))*(spin (σ j)*spin (τ j)) := by ring
|
| 391 |
+
_ = _ := by rw [h1,h2,h3,h4]; ring
|
| 392 |
+
|
| 393 |
+
end SKValueG
|
| 394 |
+
end
|
| 395 |
+
|
| 396 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/RoundingSpin.lean
CHANGED
|
@@ -1,126 +1,126 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.ConstantFatou
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValue
|
| 11 |
-
|
| 12 |
-
noncomputable def boolSign (x : ℝ) : Bool := if 0≤x then true else false
|
| 13 |
-
|
| 14 |
-
lemma measurable_boolSign : Measurable boolSign :=
|
| 15 |
-
Measurable.ite measurableSet_Ici measurable_const measurable_const
|
| 16 |
-
|
| 17 |
-
lemma spin_boolSign_eq {x : ℝ} (hx : x≠0) : SKValueG.spin (boolSign x)=Real.sign x := by
|
| 18 |
-
rcases lt_or_gt_of_ne hx with h | h
|
| 19 |
-
· simp [boolSign,SKValueG.spin,not_le.mpr h,Real.sign_of_neg h]
|
| 20 |
-
· simp [boolSign,SKValueG.spin,h.le,Real.sign_of_pos h]
|
| 21 |
-
|
| 22 |
-
lemma gaussian_rounding_nonzero (a : ℝ) :
|
| 23 |
-
∀ᵐ z ∂standardGaussian,a+2*cdf standardGaussian z-1≠0 := by
|
| 24 |
-
have hh : ∀ᵐ z ∂standardGaussian,cdf standardGaussian z≠(1-a)/2 :=
|
| 25 |
-
(standardGaussian_cdf_hasLaw_uniform.ae_iff (measurableSet_setOfPred.mp ((measurableSet_eq_fun measurable_id measurable_const).compl))).mpr
|
| 26 |
-
((volume.restrict (Ioc (0 : ℝ) 1)).ae_ne ((1-a)/2))
|
| 27 |
-
filter_upwards [hh] with z hz
|
| 28 |
-
intro h
|
| 29 |
-
apply hz
|
| 30 |
-
linarith
|
| 31 |
-
|
| 32 |
-
lemma independent_rounding_nonzero {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 33 |
-
[IsProbabilityMeasure μ] {U Z : Ω → ℝ}
|
| 34 |
-
(hU : Measurable U) (hZ : HasLaw Z standardGaussian μ) (hind : IndepFun U Z μ) :
|
| 35 |
-
∀ᵐ ω ∂μ,U ω+2*cdf standardGaussian (Z ω)-1≠0 := by
|
| 36 |
-
have hLaw : HasLaw U (μ.map U) μ := ⟨hU.aemeasurable,rfl⟩
|
| 37 |
-
have hJoint := hind.hasLaw_prod hLaw hZ
|
| 38 |
-
have hm : Measurable (fun p : ℝ×ℝ ↦ p.1+2*cdf standardGaussian p.2-1) :=
|
| 39 |
-
(measurable_fst.add (((monotone_cdf _).measurable.comp measurable_snd).const_mul 2)).sub_const 1
|
| 40 |
-
apply (hJoint.ae_iff (measurableSet_setOfPred.mp ((measurableSet_eq_fun hm measurable_const).compl))).mpr
|
| 41 |
-
apply (Measure.ae_prod_iff_ae_ae ((measurableSet_eq_fun hm measurable_const).compl)).mpr
|
| 42 |
-
exact Eventually.of_forall gaussian_rounding_nonzero
|
| 43 |
-
|
| 44 |
-
lemma finite_rounding_signed_spin {N : ℕ} {U : (Fin (N+1) → ℝ) → ℝ}
|
| 45 |
-
(hU : Measurable U) (hUp : DependsBefore N U) :
|
| 46 |
-
(fun z ↦ SKValueG.spin (boolSign (U z+2*cdf standardGaussian (coordinate N N z)-1)))
|
| 47 |
-
=ᵐ[gaussianProduct (Fin (N+1))]
|
| 48 |
-
(fun z ↦ Real.sign (U z+2*cdf standardGaussian (coordinate N N z)-1)) := by
|
| 49 |
-
have := gaussianProduct_probability (Fin (N+1))
|
| 50 |
-
exact (independent_rounding_nonzero hU (coordinate_hasLaw N N)
|
| 51 |
-
(hUp.independent (by omega) hU)).mono (fun _ ↦ spin_boolSign_eq)
|
| 52 |
-
|
| 53 |
-
end SKValue
|
| 54 |
-
|
| 55 |
-
end
|
| 56 |
-
|
| 57 |
-
section
|
| 58 |
-
|
| 59 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 60 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 61 |
-
namespace SKValue
|
| 62 |
-
|
| 63 |
-
theorem normalized_shifted_sum_le_groundState {N : ℕ}
|
| 64 |
-
(H : Fin N → (Fin (N+1) → ℝ) → ℝ) (U : (Fin (N+1) → ℝ) → ℝ)
|
| 65 |
-
(hm : ∀ j,Measurable (H j)) (hp : ∀ j : Fin N,DependsBefore j (H j))
|
| 66 |
-
(hL : ∀ j,MemLp (H j) 2 (gaussianProduct (Fin (N+1))))
|
| 67 |
-
(hpos : ∀ j,0<∫ z,(H j z)^2 ∂gaussianProduct (Fin (N+1)))
|
| 68 |
-
(hU : Measurable U) (hUp : DependsBefore N U) :
|
| 69 |
-
(∑ j : Fin N,(∫ z,finiteRounded U z*
|
| 70 |
-
normalizedIncrement (H j) (coordinate N j) (gaussianProduct (Fin (N+1))) z
|
| 71 |
-
∂gaussianProduct (Fin (N+1)))*
|
| 72 |
-
(∫ z,finiteRounded U z*coordinate N (j+1) z ∂gaussianProduct (Fin (N+1))))≤groundStateValue := by
|
| 73 |
-
let f := fun j : ℕ ↦ if hj : j<N then
|
| 74 |
-
normalizedIncrement (H ⟨j,hj⟩) (coordinate N j) (gaussianProduct (Fin (N+1))) else fun _ ↦ 0
|
| 75 |
-
let F := fun z ↦ boolSign (U z+2*cdf standardGaussian (coordinate N N z)-1)
|
| 76 |
-
have hfm (j : ℕ) : Measurable (f j) := by
|
| 77 |
-
dsimp only [f]
|
| 78 |
-
split_ifs with hj
|
| 79 |
-
· exact measurable_normalizedIncrement (hm ⟨j,hj⟩)
|
| 80 |
-
· exact measurable_const
|
| 81 |
-
have hfa (l : ℕ) (x y : Fin (N+1) → ℝ)
|
| 82 |
-
(he : ∀ i : Fin (N+1),i.val≤l → x i=y i) : f l x=f l y := by
|
| 83 |
-
dsimp only [f]
|
| 84 |
-
split_ifs with hl
|
| 85 |
-
· apply normalizedIncrement_dependsBefore (by omega) (hp ⟨l,hl⟩)
|
| 86 |
-
intro i hi
|
| 87 |
-
change i.val<l+1 at hi
|
| 88 |
-
exact he i (by omega)
|
| 89 |
-
· rfl
|
| 90 |
-
have hfL (j : ℕ) (hj : j<N) : MemLp (f j) 2 (SKValueG.gaussianProduct (Fin (N+1))) := by
|
| 91 |
-
simp only [f,dite_eq_left hj]
|
| 92 |
-
exact normalizedIncrement_memLp_two (hL ⟨j,hj⟩) (coordinate_hasLaw N j)
|
| 93 |
-
((hp ⟨j,hj⟩).independent (by omega) (hm ⟨j,hj⟩))
|
| 94 |
-
have hfu (j : ℕ) (hj : j<N) : (∫ z,(f j z)^2 ∂SKValueG.gaussianProduct (Fin (N+1)))=1 := by
|
| 95 |
-
simp only [f,dite_eq_left hj]
|
| 96 |
-
exact normalizedIncrement_second_moment (hm ⟨j,hj⟩).aestronglyMeasurable (coordinate_hasLaw N j)
|
| 97 |
-
((hp ⟨j,hj⟩).independent (by omega) (hm ⟨j,hj⟩)) (hpos ⟨j,hj⟩)
|
| 98 |
-
have hfo (i j : ℕ) (hij : i<j) (hj : j<N) :
|
| 99 |
-
(∫ z,f i z*f j z ∂SKValueG.gaussianProduct (Fin (N+1)))=0 := by
|
| 100 |
-
have hi : i<N := hij.trans hj
|
| 101 |
-
simp only [f,dite_eq_left hi,dite_eq_left hj]
|
| 102 |
-
exact normalizedIncrements_orthogonal hij (by omega) (hm
|
| 103 |
-
(hp ⟨i,hi⟩) (hp ⟨j,hj⟩)
|
| 104 |
-
have hFm : Measurable F := measurable_boolSign.comp
|
| 105 |
-
((hU.add (((monotone_cdf _).measurable.comp (measurable_coordinate N N)).const_mul 2)).sub_const 1)
|
| 106 |
-
have he : (fun z ↦ SKValueG.spin (F z))=ᵐ[gaussianProduct (Fin (N+1))] finiteRounded U :=
|
| 107 |
-
finite_rounding_signed_spin hU hUp
|
| 108 |
-
have hb := SKValueG.predictable_coefficients_le_groundState N f F hfm hfa hfL hfu hfo hFm
|
| 109 |
-
change _≤SKValueG.groundStateValue
|
| 110 |
-
convert hb using 1
|
| 111 |
-
apply Finset.sum_congr rfl
|
| 112 |
-
intro j hj
|
| 113 |
-
congr 1
|
| 114 |
-
· apply integral_congr_ae
|
| 115 |
-
filter_upwards [he] with z hz
|
| 116 |
-
simp only [f,dite_eq_left j.isLt,hz]
|
| 117 |
-
exact mul_comm _ _
|
| 118 |
-
· apply integral_congr_ae
|
| 119 |
-
filter_upwards [he] with z hz
|
| 120 |
-
rw [hz,coordinate_eq_apply (by omega)]
|
| 121 |
-
|
| 122 |
-
end SKValue
|
| 123 |
-
|
| 124 |
-
end
|
| 125 |
-
|
| 126 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.ConstantFatou
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValue
|
| 11 |
+
|
| 12 |
+
noncomputable def boolSign (x : ℝ) : Bool := if 0≤x then true else false
|
| 13 |
+
|
| 14 |
+
lemma measurable_boolSign : Measurable boolSign :=
|
| 15 |
+
Measurable.ite measurableSet_Ici measurable_const measurable_const
|
| 16 |
+
|
| 17 |
+
lemma spin_boolSign_eq {x : ℝ} (hx : x≠0) : SKValueG.spin (boolSign x)=Real.sign x := by
|
| 18 |
+
rcases lt_or_gt_of_ne hx with h | h
|
| 19 |
+
· simp [boolSign,SKValueG.spin,not_le.mpr h,Real.sign_of_neg h]
|
| 20 |
+
· simp [boolSign,SKValueG.spin,h.le,Real.sign_of_pos h]
|
| 21 |
+
|
| 22 |
+
lemma gaussian_rounding_nonzero (a : ℝ) :
|
| 23 |
+
∀ᵐ z ∂standardGaussian,a+2*cdf standardGaussian z-1≠0 := by
|
| 24 |
+
have hh : ∀ᵐ z ∂standardGaussian,cdf standardGaussian z≠(1-a)/2 :=
|
| 25 |
+
(standardGaussian_cdf_hasLaw_uniform.ae_iff (measurableSet_setOfPred.mp ((measurableSet_eq_fun measurable_id measurable_const).compl))).mpr
|
| 26 |
+
((volume.restrict (Ioc (0 : ℝ) 1)).ae_ne ((1-a)/2))
|
| 27 |
+
filter_upwards [hh] with z hz
|
| 28 |
+
intro h
|
| 29 |
+
apply hz
|
| 30 |
+
linarith
|
| 31 |
+
|
| 32 |
+
lemma independent_rounding_nonzero {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 33 |
+
[IsProbabilityMeasure μ] {U Z : Ω → ℝ}
|
| 34 |
+
(hU : Measurable U) (hZ : HasLaw Z standardGaussian μ) (hind : IndepFun U Z μ) :
|
| 35 |
+
∀ᵐ ω ∂μ,U ω+2*cdf standardGaussian (Z ω)-1≠0 := by
|
| 36 |
+
have hLaw : HasLaw U (μ.map U) μ := ⟨hU.aemeasurable,rfl⟩
|
| 37 |
+
have hJoint := hind.hasLaw_prod hLaw hZ
|
| 38 |
+
have hm : Measurable (fun p : ℝ×ℝ ↦ p.1+2*cdf standardGaussian p.2-1) :=
|
| 39 |
+
(measurable_fst.add (((monotone_cdf _).measurable.comp measurable_snd).const_mul 2)).sub_const 1
|
| 40 |
+
apply (hJoint.ae_iff (measurableSet_setOfPred.mp ((measurableSet_eq_fun hm measurable_const).compl))).mpr
|
| 41 |
+
apply (Measure.ae_prod_iff_ae_ae ((measurableSet_eq_fun hm measurable_const).compl)).mpr
|
| 42 |
+
exact Eventually.of_forall gaussian_rounding_nonzero
|
| 43 |
+
|
| 44 |
+
lemma finite_rounding_signed_spin {N : ℕ} {U : (Fin (N+1) → ℝ) → ℝ}
|
| 45 |
+
(hU : Measurable U) (hUp : DependsBefore N U) :
|
| 46 |
+
(fun z ↦ SKValueG.spin (boolSign (U z+2*cdf standardGaussian (coordinate N N z)-1)))
|
| 47 |
+
=ᵐ[gaussianProduct (Fin (N+1))]
|
| 48 |
+
(fun z ↦ Real.sign (U z+2*cdf standardGaussian (coordinate N N z)-1)) := by
|
| 49 |
+
have := gaussianProduct_probability (Fin (N+1))
|
| 50 |
+
exact (independent_rounding_nonzero hU (coordinate_hasLaw N N)
|
| 51 |
+
(hUp.independent (by omega) hU)).mono (fun _ ↦ spin_boolSign_eq)
|
| 52 |
+
|
| 53 |
+
end SKValue
|
| 54 |
+
|
| 55 |
+
end
|
| 56 |
+
|
| 57 |
+
section
|
| 58 |
+
|
| 59 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 60 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 61 |
+
namespace SKValue
|
| 62 |
+
|
| 63 |
+
theorem normalized_shifted_sum_le_groundState {N : ℕ}
|
| 64 |
+
(H : Fin N → (Fin (N+1) → ℝ) → ℝ) (U : (Fin (N+1) → ℝ) → ℝ)
|
| 65 |
+
(hm : ∀ j,Measurable (H j)) (hp : ∀ j : Fin N,DependsBefore j (H j))
|
| 66 |
+
(hL : ∀ j,MemLp (H j) 2 (gaussianProduct (Fin (N+1))))
|
| 67 |
+
(hpos : ∀ j,0<∫ z,(H j z)^2 ∂gaussianProduct (Fin (N+1)))
|
| 68 |
+
(hU : Measurable U) (hUp : DependsBefore N U) :
|
| 69 |
+
(∑ j : Fin N,(∫ z,finiteRounded U z*
|
| 70 |
+
normalizedIncrement (H j) (coordinate N j) (gaussianProduct (Fin (N+1))) z
|
| 71 |
+
∂gaussianProduct (Fin (N+1)))*
|
| 72 |
+
(∫ z,finiteRounded U z*coordinate N (j+1) z ∂gaussianProduct (Fin (N+1))))≤groundStateValue := by
|
| 73 |
+
let f := fun j : ℕ ↦ if hj : j<N then
|
| 74 |
+
normalizedIncrement (H ⟨j,hj⟩) (coordinate N j) (gaussianProduct (Fin (N+1))) else fun _ ↦ 0
|
| 75 |
+
let F := fun z ↦ boolSign (U z+2*cdf standardGaussian (coordinate N N z)-1)
|
| 76 |
+
have hfm (j : ℕ) : Measurable (f j) := by
|
| 77 |
+
dsimp only [f]
|
| 78 |
+
split_ifs with hj
|
| 79 |
+
· exact measurable_normalizedIncrement (hm ⟨j,hj⟩)
|
| 80 |
+
· exact measurable_const
|
| 81 |
+
have hfa (l : ℕ) (x y : Fin (N+1) → ℝ)
|
| 82 |
+
(he : ∀ i : Fin (N+1),i.val≤l → x i=y i) : f l x=f l y := by
|
| 83 |
+
dsimp only [f]
|
| 84 |
+
split_ifs with hl
|
| 85 |
+
· apply normalizedIncrement_dependsBefore (by omega) (hp ⟨l,hl⟩)
|
| 86 |
+
intro i hi
|
| 87 |
+
change i.val<l+1 at hi
|
| 88 |
+
exact he i (by omega)
|
| 89 |
+
· rfl
|
| 90 |
+
have hfL (j : ℕ) (hj : j<N) : MemLp (f j) 2 (SKValueG.gaussianProduct (Fin (N+1))) := by
|
| 91 |
+
simp only [f,dite_eq_left hj]
|
| 92 |
+
exact normalizedIncrement_memLp_two (hL ⟨j,hj⟩) (coordinate_hasLaw N j)
|
| 93 |
+
((hp ⟨j,hj⟩).independent (by omega) (hm ⟨j,hj⟩))
|
| 94 |
+
have hfu (j : ℕ) (hj : j<N) : (∫ z,(f j z)^2 ∂SKValueG.gaussianProduct (Fin (N+1)))=1 := by
|
| 95 |
+
simp only [f,dite_eq_left hj]
|
| 96 |
+
exact normalizedIncrement_second_moment (hm ⟨j,hj⟩).aestronglyMeasurable (coordinate_hasLaw N j)
|
| 97 |
+
((hp ⟨j,hj⟩).independent (by omega) (hm ⟨j,hj⟩)) (hpos ⟨j,hj⟩)
|
| 98 |
+
have hfo (i j : ℕ) (hij : i<j) (hj : j<N) :
|
| 99 |
+
(∫ z,f i z*f j z ∂SKValueG.gaussianProduct (Fin (N+1)))=0 := by
|
| 100 |
+
have hi : i<N := hij.trans hj
|
| 101 |
+
simp only [f,dite_eq_left hi,dite_eq_left hj]
|
| 102 |
+
exact normalizedIncrements_orthogonal hij (by omega) (hm ⟨i,hi⟩) (hm ⟨j,hj⟩)
|
| 103 |
+
(hp ⟨i,hi⟩) (hp ⟨j,hj⟩)
|
| 104 |
+
have hFm : Measurable F := measurable_boolSign.comp
|
| 105 |
+
((hU.add (((monotone_cdf _).measurable.comp (measurable_coordinate N N)).const_mul 2)).sub_const 1)
|
| 106 |
+
have he : (fun z ↦ SKValueG.spin (F z))=ᵐ[gaussianProduct (Fin (N+1))] finiteRounded U :=
|
| 107 |
+
finite_rounding_signed_spin hU hUp
|
| 108 |
+
have hb := SKValueG.predictable_coefficients_le_groundState N f F hfm hfa hfL hfu hfo hFm
|
| 109 |
+
change _≤SKValueG.groundStateValue
|
| 110 |
+
convert hb using 1
|
| 111 |
+
apply Finset.sum_congr rfl
|
| 112 |
+
intro j hj
|
| 113 |
+
congr 1
|
| 114 |
+
· apply integral_congr_ae
|
| 115 |
+
filter_upwards [he] with z hz
|
| 116 |
+
simp only [f,dite_eq_left j.isLt,hz]
|
| 117 |
+
exact mul_comm _ _
|
| 118 |
+
· apply integral_congr_ae
|
| 119 |
+
filter_upwards [he] with z hz
|
| 120 |
+
rw [hz,coordinate_eq_apply (by omega)]
|
| 121 |
+
|
| 122 |
+
end SKValue
|
| 123 |
+
|
| 124 |
+
end
|
| 125 |
+
|
| 126 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/StandardGaussian.lean
CHANGED
|
@@ -1,384 +1,384 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Evolution.BoundedSmooth
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
|
| 12 |
-
noncomputable def standardGaussian : Measure ℝ := gaussianReal 0 1
|
| 13 |
-
noncomputable def gaussianProduct (ι : Type*) [Fintype ι] : Measure (ι → ℝ) :=
|
| 14 |
-
Measure.pi (fun _ : ι ↦ standardGaussian)
|
| 15 |
-
|
| 16 |
-
instance : IsProbabilityMeasure standardGaussian := by unfold standardGaussian; infer_instance
|
| 17 |
-
instance {ι : Type*} [Fintype ι] : IsProbabilityMeasure (gaussianProduct ι) := by
|
| 18 |
-
unfold gaussianProduct; infer_instance
|
| 19 |
-
|
| 20 |
-
lemma density_hasDerivAt (x : ℝ) :
|
| 21 |
-
HasDerivAt (gaussianPDFReal 0 1) (-x*gaussianPDFReal 0 1 x) x := by
|
| 22 |
-
have h1 : HasDerivAt (fun y : ℝ ↦ -y^2/2) (-x) x := by
|
| 23 |
-
have hh := ((hasDerivAt_id x).pow 2).neg.div_const (2 : ℝ)
|
| 24 |
-
simpa only [Pi.pow_def,Pi.neg_def,id_eq,pow_one,show (2 : ℕ)-1=1 from rfl,
|
| 25 |
-
Nat.cast_ofNat,mul_one,neg_div,mul_div_cancel_left₀ _ (by norm_num : (2 : ℝ) ≠ 0)] using hh
|
| 26 |
-
have hd := h1.exp.const_mul ((Real.sqrt (2*Real.pi))⁻¹)
|
| 27 |
-
convert hd using 1 <;> try rfl
|
| 28 |
-
· funext y
|
| 29 |
-
simp only [gaussianPDFReal,NNReal.coe_one,mul_one,sub_zero]
|
| 30 |
-
· simp only [gaussianPDFReal,NNReal.coe_one,mul_one,sub_zero]
|
| 31 |
-
ring
|
| 32 |
-
|
| 33 |
-
lemma density_mul_integrable {f : ℝ → ℝ} (hf : Integrable f standardGaussian) :
|
| 34 |
-
Integrable (fun x ↦ gaussianPDFReal 0 1 x*f x) := by
|
| 35 |
-
rw [standardGaussian,gaussianReal_of_var_ne_zero _ (by norm_num)] at hf
|
| 36 |
-
have hh := (integrable_withDensity_iff_integrable_smul'
|
| 37 |
-
(measurable_gaussianPDF 0 1) (Eventually.of_forall (fun x ↦ gaussianPDF_lt_top (μ := 0) (v := 1) (x := x)))).mp hf
|
| 38 |
-
simpa only [toReal_gaussianPDF,smul_eq_mul] using hh
|
| 39 |
-
|
| 40 |
-
lemma standardGaussian_integrable_id : Integrable (fun x : ℝ ↦ x) standardGaussian := by
|
| 41 |
-
have hh := (memLp_id_gaussianReal' (μ := (0 : ℝ)) (v := (1 : ℝ≥0)) (1 : ℝ≥0∞) (by norm_num))
|
| 42 |
-
exact hh.integrable (by norm_num)
|
| 43 |
-
|
| 44 |
-
lemma gaussian_stein_bounded {f f' : ℝ → ℝ} {C D : ℝ}
|
| 45 |
-
(hf : ∀ x, HasDerivAt f (f' x) x) (hm : AEStronglyMeasurable f' standardGaussian)
|
| 46 |
-
(hC : ∀ x, |f x|≤C) (hD : ∀ x, |f' x|≤D) :
|
| 47 |
-
(∫ x, x*f x ∂standardGaussian) = ∫ x, f' x ∂standardGaussian := by
|
| 48 |
-
have hfm : Continuous f := continuous_iff_continuousAt.mpr (fun x ↦ (hf x).continuousAt)
|
| 49 |
-
have hfi : Integrable f standardGaussian := Integrable.of_bound hfm.aestronglyMeasurable C
|
| 50 |
-
(Eventually.of_forall (fun x ↦ (Real.norm_eq_abs _).trans_le (hC x)))
|
| 51 |
-
have hf'i : Integrable f' standardGaussian := Integrable.of_bound hm D
|
| 52 |
-
(Eventually.of_forall (fun x ↦ (Real.norm_eq_abs _).trans_le (hD x)))
|
| 53 |
-
have hxfi : Integrable (fun x ↦ x*f x) standardGaussian :=
|
| 54 |
-
standardGaussian_integrable_id.mul_bdd hfm.aestronglyMeasurable
|
| 55 |
-
(Eventually.of_forall (fun x ↦ (Real.norm_eq_abs _).trans_le (hC x)))
|
| 56 |
-
have hi1 : Integrable (fun x ↦ f x*(-x*gaussianPDFReal 0 1 x)) := by
|
| 57 |
-
convert (density_mul_integrable hxfi).neg using 1
|
| 58 |
-
ext x
|
| 59 |
-
simp only [Pi.neg_apply]
|
| 60 |
-
ring
|
| 61 |
-
have hi2 : Integrable (fun x ↦ f' x*gaussianPDFReal 0 1 x) := by
|
| 62 |
-
simpa only [mul_comm] using density_mul_integrable hf'i
|
| 63 |
-
have hi3 : Integrable (fun x ↦ f x*gaussianPDFReal 0 1 x) := by
|
| 64 |
-
simpa only [mul_comm] using density_mul_integrable hfi
|
| 65 |
-
have hibp := integral_mul_deriv_eq_deriv_mul_of_integrable
|
| 66 |
-
(u := f) (v := gaussianPDFReal 0 1) (u' := f') (v' := fun x ↦ -x*gaussianPDFReal 0 1 x)
|
| 67 |
-
(fun x _ ↦ hf x) (fun x _ ↦ density_hasDerivAt x) hi1 hi2 hi3
|
| 68 |
-
have hb : (∫ x, f x*(-x*gaussianPDFReal 0 1 x)) =
|
| 69 |
-
-(∫ x, gaussianPDFReal 0 1 x*(x*f x)) := by
|
| 70 |
-
rw [← integral_neg]
|
| 71 |
-
apply integral_congr_ae
|
| 72 |
-
exact Eventually.of_forall (fun x ↦ by ring)
|
| 73 |
-
rw [hb] at hibp
|
| 74 |
-
have he : (∫ x, gaussianPDFReal 0 1 x*(x*f x)) =
|
| 75 |
-
∫ x, gaussianPDFReal 0 1 x*f' x := by
|
| 76 |
-
exact neg_injective hibp |>.trans (by congr 1; funext x; ring)
|
| 77 |
-
simpa only [standardGaussian,integral_gaussianReal_eq_integral_smul (by norm_num : (1 : ℝ≥0) ≠ 0),
|
| 78 |
-
smul_eq_mul] using he
|
| 79 |
-
|
| 80 |
-
lemma gaussian_coordinate_integrable {ι : Type*} [Fintype ι] (i : ι) :
|
| 81 |
-
Integrable (fun z : ι → ℝ ↦ z i) (gaussianProduct ι) := by
|
| 82 |
-
exact ((measurePreserving_eval (fun _ : ι ↦ standardGaussian) i).integrable_comp
|
| 83 |
-
standardGaussian_integrable_id.aestronglyMeasurable).mpr standardGaussian_integrable_id
|
| 84 |
-
|
| 85 |
-
lemma gaussian_pi_stein_bounded {n : ℕ} (i : Fin n) {f f' : (Fin n → ℝ) → ℝ} {C D : ℝ}
|
| 86 |
-
(hf : Continuous f) (hf' : Continuous f')
|
| 87 |
-
(hd : ∀ z, HasDerivAt (fun x ↦ f (Function.update z i x)) (f' z) (z i))
|
| 88 |
-
(hC : ∀ z, |f z| ≤ C) (hD : ∀ z, |f' z| ≤ D) :
|
| 89 |
-
(∫ z, z i*f z ∂gaussianProduct (Fin n)) = ∫ z, f' z ∂gaussianProduct (Fin n) := by
|
| 90 |
-
cases n with
|
| 91 |
-
| zero => exact Fin.elim0 i
|
| 92 |
-
| succ n =>
|
| 93 |
-
let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) ↦ ℝ) i
|
| 94 |
-
have he : MeasurePreserving e.symm (standardGaussian.prod (gaussianProduct (Fin n)))
|
| 95 |
-
(gaussianProduct (Fin (n+1))) :=
|
| 96 |
-
(measurePreserving_piFinSuccAbove (fun _ : Fin (n+1) ↦ standardGaussian) i).symm
|
| 97 |
-
have hi : Integrable (fun z : Fin (n+1) → ℝ ↦ z i*f z) (gaussianProduct (Fin (n+1))) :=
|
| 98 |
-
(gaussian_coordinate_integrable i).mul_bdd hf.aestronglyMeasurable
|
| 99 |
-
(Eventually.of_forall (fun z ↦ (Real.norm_eq_abs _).trans_le (hC z)))
|
| 100 |
-
have hi' : Integrable f' (gaussianProduct (Fin (n+1))) :=
|
| 101 |
-
Integrable.of_bound hf'.aestronglyMeasurable D
|
| 102 |
-
(Eventually.of_forall (fun z ↦ (Real.norm_eq_abs _).trans_le (hD z)))
|
| 103 |
-
have hip : Integrable (fun p ↦ e.symm p i * f (e.symm p))
|
| 104 |
-
(standardGaussian.prod (gaussianProduct (Fin n))) := (he.integrable_comp hi.aestronglyMeasurable).mpr hi
|
| 105 |
-
have hi'p : Integrable (fun p ↦ f' (e.symm p))
|
| 106 |
-
(standardGaussian.prod (gaussianProduct (Fin n))) := (he.integrable_comp hi'.aestronglyMeasurable).mpr hi'
|
| 107 |
-
rw [← he.integral_comp' (fun z ↦ z i*f z), ← he.integral_comp' f',
|
| 108 |
-
integral_prod _ hip, integral_prod _ hi'p,
|
| 109 |
-
integral_integral_swap (f := fun x y ↦ e.symm (x,y) i * f (e.symm (x,y))) hip,
|
| 110 |
-
integral_integral_swap (f := fun x y ↦ f' (e.symm (x,y))) hi'p]
|
| 111 |
-
apply integral_congr_ae
|
| 112 |
-
apply Eventually.of_forall
|
| 113 |
-
intro y
|
| 114 |
-
simp only [e, MeasurableEquiv.piFinSuccAbove_symm_apply,Fin.insertNthEquiv,Equiv.coe_fn_mk,Fin.insertNth_apply_same]
|
| 115 |
-
change (∫ x, x*f (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y) ∂standardGaussian) =
|
| 116 |
-
∫ x, f' (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y) ∂standardGaussian
|
| 117 |
-
have hmeas : Measurable (fun x : ℝ ↦ i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y) := by
|
| 118 |
-
exact e.symm.measurable.comp (measurable_id.prodMk measurable_const)
|
| 119 |
-
apply gaussian_stein_bounded (f' := fun x ↦ f' (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y))
|
| 120 |
-
· intro x
|
| 121 |
-
simpa only [Fin.update_insertNth,Fin.insertNth_apply_same] using hd (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y)
|
| 122 |
-
· exact (hf'.measurable.comp hmeas).aestronglyMeasurable
|
| 123 |
-
· exact fun x ↦ hC _
|
| 124 |
-
· exact fun x ↦ hD _
|
| 125 |
-
|
| 126 |
-
noncomputable def partition {ι : Type*} [Fintype ι] (x : ι → ℝ) : ℝ :=
|
| 127 |
-
∑ i, Real.exp (x i)
|
| 128 |
-
|
| 129 |
-
noncomputable def gibbsWeight {ι : Type*} [Fintype ι] (x : ι → ℝ) (i : ι) : ℝ :=
|
| 130 |
-
Real.exp (x i) / partition x
|
| 131 |
-
|
| 132 |
-
noncomputable def logPartition {ι : Type*} [Fintype ι] (x : ι → ℝ) : ℝ :=
|
| 133 |
-
Real.log (partition x)
|
| 134 |
-
|
| 135 |
-
lemma partition_pos {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) : 0 < partition x := by
|
| 136 |
-
exact Finset.sum_pos (fun i _ ↦ Real.exp_pos _) Finset.univ_nonempty
|
| 137 |
-
|
| 138 |
-
lemma gibbsWeight_nonneg {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (i : ι) :
|
| 139 |
-
0 ≤ gibbsWeight x i := le_of_lt (div_pos (Real.exp_pos _) (partition_pos x))
|
| 140 |
-
|
| 141 |
-
lemma sum_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 142 |
-
∑ i, gibbsWeight x i = 1 := by
|
| 143 |
-
simp only [gibbsWeight,← Finset.sum_div]
|
| 144 |
-
change partition x / partition x = 1
|
| 145 |
-
exact div_self (ne_of_gt (partition_pos x))
|
| 146 |
-
|
| 147 |
-
lemma gibbsWeight_le_one {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (i : ι) :
|
| 148 |
-
gibbsWeight x i ≤ 1 := by
|
| 149 |
-
calc
|
| 150 |
-
_ ≤ ∑ j, gibbsWeight x j := Finset.single_le_sum (fun j _ ↦ gibbsWeight_nonneg x j) (Finset.mem_univ i)
|
| 151 |
-
_ = 1 := sum_gibbsWeight x
|
| 152 |
-
|
| 153 |
-
lemma continuous_partition {ι : Type*} [Fintype ι] : Continuous (@partition ι _) := by
|
| 154 |
-
unfold partition
|
| 155 |
-
fun_prop
|
| 156 |
-
|
| 157 |
-
lemma continuous_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι] (i : ι) :
|
| 158 |
-
Continuous (fun x : ι → ℝ ↦ gibbsWeight x i) := by
|
| 159 |
-
exact (Real.continuous_exp.comp (continuous_apply i)).div continuous_partition (fun x ↦ ne_of_gt (partition_pos x))
|
| 160 |
-
|
| 161 |
-
lemma hasDerivAt_partition {ι : Type*} [Fintype ι] {x : ℝ → ι → ℝ} {v : ι → ℝ} {t : ℝ}
|
| 162 |
-
(h : ∀ i, HasDerivAt (fun s ↦ x s i) (v i) t) :
|
| 163 |
-
HasDerivAt (fun s ↦ partition (x s)) (∑ i, Real.exp (x t i)*v i) t := by
|
| 164 |
-
simpa only [partition,Finset.sum_apply] using (HasDerivAt.fun_sum (u := Finset.univ) (fun i _ ↦ (h i).exp))
|
| 165 |
-
|
| 166 |
-
lemma hasDerivAt_logPartition {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 167 |
-
{x : ℝ → ι → ℝ} {v : ι → ℝ} {t : ℝ}
|
| 168 |
-
(h : ∀ i, HasDerivAt (fun s ↦ x s i) (v i) t) :
|
| 169 |
-
HasDerivAt (fun s ↦ logPartition (x s)) (∑ i, gibbsWeight (x t) i*v i) t := by
|
| 170 |
-
convert (hasDerivAt_partition h).log (ne_of_gt (partition_pos _)) using 1 <;> try rfl
|
| 171 |
-
simp only [gibbsWeight,Finset.sum_div,mul_div_assoc]
|
| 172 |
-
apply Finset.sum_congr rfl
|
| 173 |
-
intro i _
|
| 174 |
-
ring
|
| 175 |
-
|
| 176 |
-
lemma hasDerivAt_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 177 |
-
{x : ℝ → ι → ℝ} {v : ι → ℝ} {t : ℝ}
|
| 178 |
-
(h : ∀ i, HasDerivAt (fun s ↦ x s i) (v i) t) (i : ι) :
|
| 179 |
-
HasDerivAt (fun s ↦ gibbsWeight (x s) i)
|
| 180 |
-
(gibbsWeight (x t) i*(v i-∑ j, gibbsWeight (x t) j*v j)) t := by
|
| 181 |
-
convert (h i).exp.div (hasDerivAt_partition h) (ne_of_gt (partition_pos _)) using 1 <;> try rfl
|
| 182 |
-
simp only [gibbsWeight]
|
| 183 |
-
rw [show (∑ j, Real.exp (x t j)/partition (x t)*v j) =
|
| 184 |
-
(∑ j, Real.exp (x t j)*v j)/partition (x t) by
|
| 185 |
-
rw [Finset.sum_div]; apply Finset.sum_congr rfl; intro j _; ring]
|
| 186 |
-
field_simp [ne_of_gt (partition_pos (x t))]
|
| 187 |
-
|
| 188 |
-
lemma abs_gibbsMean_le {ι : Type*} [Fintype ι] [Nonempty ι] (x v : ι → ℝ) {C : ℝ}
|
| 189 |
-
(hC : ∀ i, |v i| ≤ C) : |∑ i, gibbsWeight x i*v i| ≤ C := by
|
| 190 |
-
calc
|
| 191 |
-
_ ≤ ∑ i, |gibbsWeight x i*v i| := Finset.abs_sum_le_sum_abs _ _
|
| 192 |
-
_ = ∑ i, gibbsWeight x i*|v i| := by simp only [abs_mul,abs_of_nonneg (gibbsWeight_nonneg _ _)]
|
| 193 |
-
_ ≤ ∑ i, gibbsWeight x i*C := Finset.sum_le_sum (fun i _ ↦ mul_le_mul_of_nonneg_left (hC i) (gibbsWeight_nonneg _ _))
|
| 194 |
-
_ = C := by rw [← Finset.sum_mul,sum_gibbsWeight,one_mul]
|
| 195 |
-
|
| 196 |
-
noncomputable def linearProcess {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) (z : κ → ℝ) (i : ι) : ℝ :=
|
| 197 |
-
∑ k, c i k*z k
|
| 198 |
-
|
| 199 |
-
lemma continuous_linearProcess {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) :
|
| 200 |
-
Continuous (linearProcess c) := by
|
| 201 |
-
unfold linearProcess
|
| 202 |
-
fun_prop
|
| 203 |
-
|
| 204 |
-
lemma hasDerivAt_linearProcess_update {ι κ : Type*} [Fintype κ] [DecidableEq κ]
|
| 205 |
-
(c : ι → κ → ℝ) (z : κ → ℝ) (i : ι) (k : κ) :
|
| 206 |
-
HasDerivAt (fun x ↦ linearProcess c (Function.update z k x) i) (c i k) (z k) := by
|
| 207 |
-
have h : ∀ j, HasDerivAt (fun x ↦ c i j * Function.update z k x j)
|
| 208 |
-
(if j=k then c i k else 0) (z k) := by
|
| 209 |
-
intro j
|
| 210 |
-
by_cases hj : j=k
|
| 211 |
-
· subst j
|
| 212 |
-
simpa only [Function.update_self,ite_true,mul_one,id_eq] using (hasDerivAt_id (z k)).const_mul (c i k)
|
| 213 |
-
· simpa only [Function.update_of_ne hj,ite_eq_right hj] using hasDerivAt_const (z k) (c i j*z j)
|
| 214 |
-
simpa only [linearProcess,Finset.sum_apply,Finset.sum_ite_eq',Finset.mem_univ,ite_true]
|
| 215 |
-
using HasDerivAt.fun_sum (u := Finset.univ) (fun j _ ↦ h j)
|
| 216 |
-
|
| 217 |
-
lemma continuous_linear_gibbsWeight {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 218 |
-
(c : ι → κ → ℝ) (i : ι) : Continuous (fun z ↦ gibbsWeight (linearProcess c z) i) :=
|
| 219 |
-
(continuous_gibbsWeight i).comp (continuous_linearProcess c)
|
| 220 |
-
|
| 221 |
-
lemma integrable_linear_gibbsWeight {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 222 |
-
(c : ι → κ → ℝ) (i : ι) : Integrable (fun z ↦ gibbsWeight (linearProcess c z) i) (gaussianProduct κ) := by
|
| 223 |
-
apply Integrable.of_bound (continuous_linear_gibbsWeight c i).aestronglyMeasurable 1
|
| 224 |
-
exact Eventually.of_forall (fun z ↦ by rw [Real.norm_eq_abs,abs_of_nonneg (gibbsWeight_nonneg _ _)]; exact gibbsWeight_le_one _ _)
|
| 225 |
-
|
| 226 |
-
lemma coordinate_gibbsWeight_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 227 |
-
(c : ι → κ → ℝ) (i : ι) (k : κ) :
|
| 228 |
-
Integrable (fun z ↦ z k*gibbsWeight (linearProcess c z) i) (gaussianProduct κ) := by
|
| 229 |
-
apply (gaussian_coordinate_integrable k).mul_bdd (continuous_linear_gibbsWeight c i).aestronglyMeasurable
|
| 230 |
-
exact Eventually.of_forall (fun z ↦ by rw [Real.norm_eq_abs,abs_of_nonneg (gibbsWeight_nonneg _ _)]; exact gibbsWeight_le_one _ _)
|
| 231 |
-
|
| 232 |
-
lemma gaussian_coordinate_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 233 |
-
{n : ℕ} (c : ι → Fin n → ℝ) (i : ι) (k : Fin n) :
|
| 234 |
-
(∫ z, z k*gibbsWeight (linearProcess c z) i ∂gaussianProduct (Fin n)) =
|
| 235 |
-
∫ z, gibbsWeight (linearProcess c z) i *
|
| 236 |
-
(c i k - ∑ j, gibbsWeight (linearProcess c z) j*c j k) ∂gaussianProduct (Fin n) := by
|
| 237 |
-
apply gaussian_pi_stein_bounded k (C := 1) (D := 2*∑ j, |c j k|)
|
| 238 |
-
· exact continuous_linear_gibbsWeight c i
|
| 239 |
-
· apply Continuous.mul (continuous_linear_gibbsWeight c i)
|
| 240 |
-
apply continuous_const.sub
|
| 241 |
-
exact continuous_finsetSum _ (fun j _ ↦ (continuous_linear_gibbsWeight c j).mul continuous_const)
|
| 242 |
-
· intro z
|
| 243 |
-
simpa only [Function.update_eq_self] using
|
| 244 |
-
hasDerivAt_gibbsWeight (fun j ↦ hasDerivAt_linearProcess_update c z j k) i
|
| 245 |
-
· intro z
|
| 246 |
-
rw [abs_of_nonneg (gibbsWeight_nonneg _ _)]
|
| 247 |
-
exact gibbsWeight_le_one _ _
|
| 248 |
-
· intro z
|
| 249 |
-
have hsum : ∀ j, |c j k| ≤ ∑ l, |c l k| := fun j ↦
|
| 250 |
-
Finset.single_le_sum (f := fun l ↦ |c l k|) (fun l _ ↦ abs_nonneg _) (Finset.mem_univ j)
|
| 251 |
-
calc
|
| 252 |
-
_ = gibbsWeight (linearProcess c z) i * |c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k| := by
|
| 253 |
-
rw [abs_mul,abs_of_nonneg (gibbsWeight_nonneg _ _)]
|
| 254 |
-
_ ≤ |c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k| :=
|
| 255 |
-
mul_le_of_le_one_left (abs_nonneg _) (gibbsWeight_le_one _ _)
|
| 256 |
-
_ ≤ |c i k| + |∑ j, gibbsWeight (linearProcess c z) j*c j k| := abs_sub _ _
|
| 257 |
-
_ ≤ (∑ j, |c j k|) + (∑ j, |c j k|) := add_le_add (hsum i) (abs_gibbsMean_le _ _ hsum)
|
| 258 |
-
_ = _ := by ring
|
| 259 |
-
|
| 260 |
-
lemma le_logPartition {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (i : ι) :
|
| 261 |
-
x i ≤ logPartition x := by
|
| 262 |
-
apply (Real.le_log_iff_exp_le (partition_pos x)).mpr
|
| 263 |
-
exact Finset.single_le_sum (fun j _ ↦ (Real.exp_pos _).le) (Finset.mem_univ i)
|
| 264 |
-
|
| 265 |
-
lemma logPartition_le {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) {C : ℝ}
|
| 266 |
-
(h : ∀ i, x i ≤ C) : logPartition x ≤ Real.log (Fintype.card ι) + C := by
|
| 267 |
-
have hc : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos
|
| 268 |
-
calc
|
| 269 |
-
logPartition x ≤ Real.log ((Fintype.card ι : ℝ)*Real.exp C) := by
|
| 270 |
-
apply Real.log_le_log (partition_pos x)
|
| 271 |
-
calc
|
| 272 |
-
partition x ≤ ∑ _ : ι, Real.exp C := Finset.sum_le_sum (fun i _ ↦ Real.exp_le_exp.mpr (h i))
|
| 273 |
-
_ = _ := by simp
|
| 274 |
-
_ = _ := by rw [Real.log_mul (ne_of_gt hc) (Real.exp_ne_zero _),Real.log_exp]
|
| 275 |
-
|
| 276 |
-
lemma abs_logPartition_le {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 277 |
-
|logPartition x| ≤ |Real.log (Fintype.card ι)| + ∑ i, |x i| := by
|
| 278 |
-
have hsum : ∀ i, |x i| ≤ ∑ j, |x j| := fun i ↦
|
| 279 |
-
Finset.single_le_sum (f := fun j ↦ |x j|) (fun j _ ↦ abs_nonneg _) (Finset.mem_univ i)
|
| 280 |
-
have hu := logPartition_le x (fun i ↦ (le_abs_self _).trans (hsum i))
|
| 281 |
-
obtain ⟨i⟩ := ‹Nonempty ι›
|
| 282 |
-
have hl := le_logPartition x i
|
| 283 |
-
have hx := neg_abs_le (x i)
|
| 284 |
-
have hxi := hsum i
|
| 285 |
-
rw [abs_le]
|
| 286 |
-
constructor <;> linarith [le_abs_self (Real.log (Fintype.card ι)),abs_nonneg (Real.log (Fintype.card ι))]
|
| 287 |
-
|
| 288 |
-
lemma continuous_logPartition {ι : Type*} [Fintype ι] [Nonempty ι] :
|
| 289 |
-
Continuous (@logPartition ι _) :=
|
| 290 |
-
continuous_partition.log (fun x ↦ ne_of_gt (partition_pos x))
|
| 291 |
-
|
| 292 |
-
lemma linearProcess_integrable {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) (i : ι) :
|
| 293 |
-
Integrable (fun z ↦ linearProcess c z i) (gaussianProduct κ) :=
|
| 294 |
-
integrable_finsetSum _ (fun k _ ↦ (gaussian_coordinate_integrable k).const_mul (c i k))
|
| 295 |
-
|
| 296 |
-
lemma logPartition_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 297 |
-
(c : ι → κ → ℝ) : Integrable (fun z ↦ logPartition (linearProcess c z)) (gaussianProduct κ) := by
|
| 298 |
-
have hb := (integrable_const (|Real.log (Fintype.card ι)| : ℝ)).add
|
| 299 |
-
(integrable_finsetSum Finset.univ (fun i _ ↦ (linearProcess_integrable c i).abs))
|
| 300 |
-
apply hb.mono' ((continuous_logPartition.comp (continuous_linearProcess c)).aestronglyMeasurable)
|
| 301 |
-
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_def,Pi.add_apply] using abs_logPartition_le (linearProcess c z))
|
| 302 |
-
|
| 303 |
-
lemma gibbsWeight_mul_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 304 |
-
(c : ι → κ → ℝ) (i : ι) {f : (κ → ℝ) → ℝ} (hi : Integrable f (gaussianProduct κ)) :
|
| 305 |
-
Integrable (fun z ↦ gibbsWeight (linearProcess c z) i*f z) (gaussianProduct κ) := by
|
| 306 |
-
simpa only [mul_comm] using hi.mul_bdd (continuous_linear_gibbsWeight c i).aestronglyMeasurable
|
| 307 |
-
(Eventually.of_forall (fun z ↦ by rw [Real.norm_eq_abs,abs_of_nonneg (gibbsWeight_nonneg _ _)]; exact gibbsWeight_le_one _ _))
|
| 308 |
-
|
| 309 |
-
lemma gaussian_linear_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 310 |
-
{n : ℕ} (c d : ι → Fin n → ℝ) (i : ι) :
|
| 311 |
-
(∫ z, gibbsWeight (linearProcess c z) i * linearProcess d z i ∂gaussianProduct (Fin n)) =
|
| 312 |
-
∫ z, gibbsWeight (linearProcess c z) i *
|
| 313 |
-
((∑ k, d i k*c i k) - ∑ j, gibbsWeight (linearProcess c z) j*(∑ k, d i k*c j k))
|
| 314 |
-
∂gaussianProduct (Fin n) := by
|
| 315 |
-
have hid : ∀ k, Integrable (fun z ↦ d i k * (z k*gibbsWeight (linearProcess c z) i))
|
| 316 |
-
(gaussianProduct (Fin n)) := fun k ↦ (coordinate_gibbsWeight_integrable c i k).const_mul _
|
| 317 |
-
have hic : ∀ k, Integrable (fun z ↦ d i k * (gibbsWeight (linearProcess c z) i *
|
| 318 |
-
(c i k - ∑ j, gibbsWeight (linearProcess c z) j*c j k))) (gaussianProduct (Fin n)) := by
|
| 319 |
-
intro k
|
| 320 |
-
apply Integrable.const_mul
|
| 321 |
-
apply gibbsWeight_mul_integrable
|
| 322 |
-
exact (integrable_const _).sub (integrable_finsetSum Finset.univ
|
| 323 |
-
(fun j _ ↦ (integrable_linear_gibbsWeight c j).mul_const _))
|
| 324 |
-
calc
|
| 325 |
-
_ = ∫ z, ∑ k, d i k*(z k*gibbsWeight (linearProcess c z) i) ∂gaussianProduct (Fin n) := by
|
| 326 |
-
apply integral_congr_ae
|
| 327 |
-
exact Eventually.of_forall (fun z ↦ by simp only [linearProcess,Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring)
|
| 328 |
-
_ = ∑ k, d i k * (∫ z, z k*gibbsWeight (linearProcess c z) i ∂gaussianProduct (Fin n)) := by
|
| 329 |
-
rw [integral_finsetSum Finset.univ (fun k _ ↦ hid k)]
|
| 330 |
-
simp only [integral_const_mul]
|
| 331 |
-
_ = ∑ k, d i k * (∫ z, gibbsWeight (linearProcess c z) i *
|
| 332 |
-
(c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k) ∂gaussianProduct (Fin n)) := by
|
| 333 |
-
simp only [gaussian_coordinate_gibbsWeight]
|
| 334 |
-
_ = ∫ z, ∑ k, d i k * (gibbsWeight (linearProcess c z) i *
|
| 335 |
-
(c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k)) ∂gaussianProduct (Fin n) := by
|
| 336 |
-
rw [integral_finsetSum Finset.univ (fun k _ ↦ hic k)]
|
| 337 |
-
simp only [integral_const_mul]
|
| 338 |
-
_ = _ := by
|
| 339 |
-
apply integral_congr_ae
|
| 340 |
-
apply Eventually.of_forall
|
| 341 |
-
intro z
|
| 342 |
-
simp only [mul_sub,Finset.sum_sub_distrib,Finset.mul_sum]
|
| 343 |
-
congr 1
|
| 344 |
-
· apply Finset.sum_congr rfl; intro k _; ring
|
| 345 |
-
· rw [Finset.sum_comm]
|
| 346 |
-
apply Finset.sum_congr rfl; intro j _
|
| 347 |
-
apply Finset.sum_congr rfl; intro k _; ring
|
| 348 |
-
|
| 349 |
-
lemma weighted_covariance_pairs {ι : Type*} [Fintype ι] (p : ι → ℝ) (D : ι → ι → ℝ)
|
| 350 |
-
(hp : ∑ i, p i = 1) :
|
| 351 |
-
∑ i, p i*(D i i-∑ j, p j*D i j) =
|
| 352 |
-
(1/2 : ℝ)*∑ i, ∑ j, p i*p j*(D i i+D j j-D i j-D j i) := by
|
| 353 |
-
have h1 : (∑ i, ∑ j, p i*p j*D i i) = ∑ i, p i*D i i := by
|
| 354 |
-
apply Finset.sum_congr rfl
|
| 355 |
-
intro i _
|
| 356 |
-
calc
|
| 357 |
-
_ = p i*D i i*∑ j, p j := by rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro j _; ring
|
| 358 |
-
_ = _ := by rw [hp,mul_one]
|
| 359 |
-
have h2 : (∑ i, ∑ j, p i*p j*D j j) = ∑ j, p j*D j j := by
|
| 360 |
-
rw [Finset.sum_comm]
|
| 361 |
-
apply Finset.sum_congr rfl
|
| 362 |
-
intro j _
|
| 363 |
-
calc
|
| 364 |
-
_ = (∑ i, p i)*(p j*D j j) := by rw [Finset.sum_mul]; apply Finset.sum_congr rfl; intro i _; ring
|
| 365 |
-
_ = _ := by rw [hp,one_mul]
|
| 366 |
-
have h3 : (∑ i, ∑ j, p i*p j*D j i) = ∑ i, ∑ j, p i*p j*D i j := by
|
| 367 |
-
rw [Finset.sum_comm]
|
| 368 |
-
apply Finset.sum_congr rfl; intro i _
|
| 369 |
-
apply Finset.sum_congr rfl; intro j _; ring
|
| 370 |
-
have hl : (∑ i, p i*(D i i-∑ j, p j*D i j)) =
|
| 371 |
-
(∑ i, p i*D i i) - ∑ i, ∑ j, p i*p j*D i j := by
|
| 372 |
-
simp only [mul_sub,Finset.sum_sub_distrib,Finset.mul_sum,mul_assoc]
|
| 373 |
-
have hr : (∑ i, ∑ j, p i*p j*(D i i+D j j-D i j-D j i)) =
|
| 374 |
-
2*(∑ i, p i*D i i)-2*(∑ i, ∑ j, p i*p j*D i j) := by
|
| 375 |
-
simp only [mul_sub,mul_add,Finset.sum_sub_distrib,Finset.sum_add_distrib]
|
| 376 |
-
rw [h1,h2,h3]
|
| 377 |
-
ring
|
| 378 |
-
rw [hl,hr]
|
| 379 |
-
ring
|
| 380 |
-
|
| 381 |
-
end SKValueG
|
| 382 |
-
end
|
| 383 |
-
|
| 384 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Evolution.BoundedSmooth
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
|
| 12 |
+
noncomputable def standardGaussian : Measure ℝ := gaussianReal 0 1
|
| 13 |
+
noncomputable def gaussianProduct (ι : Type*) [Fintype ι] : Measure (ι → ℝ) :=
|
| 14 |
+
Measure.pi (fun _ : ι ↦ standardGaussian)
|
| 15 |
+
|
| 16 |
+
instance : IsProbabilityMeasure standardGaussian := by unfold standardGaussian; infer_instance
|
| 17 |
+
instance {ι : Type*} [Fintype ι] : IsProbabilityMeasure (gaussianProduct ι) := by
|
| 18 |
+
unfold gaussianProduct; infer_instance
|
| 19 |
+
|
| 20 |
+
lemma density_hasDerivAt (x : ℝ) :
|
| 21 |
+
HasDerivAt (gaussianPDFReal 0 1) (-x*gaussianPDFReal 0 1 x) x := by
|
| 22 |
+
have h1 : HasDerivAt (fun y : ℝ ↦ -y^2/2) (-x) x := by
|
| 23 |
+
have hh := ((hasDerivAt_id x).pow 2).neg.div_const (2 : ℝ)
|
| 24 |
+
simpa only [Pi.pow_def,Pi.neg_def,id_eq,pow_one,show (2 : ℕ)-1=1 from rfl,
|
| 25 |
+
Nat.cast_ofNat,mul_one,neg_div,mul_div_cancel_left₀ _ (by norm_num : (2 : ℝ) ≠ 0)] using hh
|
| 26 |
+
have hd := h1.exp.const_mul ((Real.sqrt (2*Real.pi))⁻¹)
|
| 27 |
+
convert hd using 1 <;> try rfl
|
| 28 |
+
· funext y
|
| 29 |
+
simp only [gaussianPDFReal,NNReal.coe_one,mul_one,sub_zero]
|
| 30 |
+
· simp only [gaussianPDFReal,NNReal.coe_one,mul_one,sub_zero]
|
| 31 |
+
ring
|
| 32 |
+
|
| 33 |
+
lemma density_mul_integrable {f : ℝ → ℝ} (hf : Integrable f standardGaussian) :
|
| 34 |
+
Integrable (fun x ↦ gaussianPDFReal 0 1 x*f x) := by
|
| 35 |
+
rw [standardGaussian,gaussianReal_of_var_ne_zero _ (by norm_num)] at hf
|
| 36 |
+
have hh := (integrable_withDensity_iff_integrable_smul'
|
| 37 |
+
(measurable_gaussianPDF 0 1) (Eventually.of_forall (fun x ↦ gaussianPDF_lt_top (μ := 0) (v := 1) (x := x)))).mp hf
|
| 38 |
+
simpa only [toReal_gaussianPDF,smul_eq_mul] using hh
|
| 39 |
+
|
| 40 |
+
lemma standardGaussian_integrable_id : Integrable (fun x : ℝ ↦ x) standardGaussian := by
|
| 41 |
+
have hh := (memLp_id_gaussianReal' (μ := (0 : ℝ)) (v := (1 : ℝ≥0)) (1 : ℝ≥0∞) (by norm_num))
|
| 42 |
+
exact hh.integrable (by norm_num)
|
| 43 |
+
|
| 44 |
+
lemma gaussian_stein_bounded {f f' : ℝ → ℝ} {C D : ℝ}
|
| 45 |
+
(hf : ∀ x, HasDerivAt f (f' x) x) (hm : AEStronglyMeasurable f' standardGaussian)
|
| 46 |
+
(hC : ∀ x, |f x|≤C) (hD : ∀ x, |f' x|≤D) :
|
| 47 |
+
(∫ x, x*f x ∂standardGaussian) = ∫ x, f' x ∂standardGaussian := by
|
| 48 |
+
have hfm : Continuous f := continuous_iff_continuousAt.mpr (fun x ↦ (hf x).continuousAt)
|
| 49 |
+
have hfi : Integrable f standardGaussian := Integrable.of_bound hfm.aestronglyMeasurable C
|
| 50 |
+
(Eventually.of_forall (fun x ↦ (Real.norm_eq_abs _).trans_le (hC x)))
|
| 51 |
+
have hf'i : Integrable f' standardGaussian := Integrable.of_bound hm D
|
| 52 |
+
(Eventually.of_forall (fun x ↦ (Real.norm_eq_abs _).trans_le (hD x)))
|
| 53 |
+
have hxfi : Integrable (fun x ↦ x*f x) standardGaussian :=
|
| 54 |
+
standardGaussian_integrable_id.mul_bdd hfm.aestronglyMeasurable
|
| 55 |
+
(Eventually.of_forall (fun x ↦ (Real.norm_eq_abs _).trans_le (hC x)))
|
| 56 |
+
have hi1 : Integrable (fun x ↦ f x*(-x*gaussianPDFReal 0 1 x)) := by
|
| 57 |
+
convert (density_mul_integrable hxfi).neg using 1
|
| 58 |
+
ext x
|
| 59 |
+
simp only [Pi.neg_apply]
|
| 60 |
+
ring
|
| 61 |
+
have hi2 : Integrable (fun x ↦ f' x*gaussianPDFReal 0 1 x) := by
|
| 62 |
+
simpa only [mul_comm] using density_mul_integrable hf'i
|
| 63 |
+
have hi3 : Integrable (fun x ↦ f x*gaussianPDFReal 0 1 x) := by
|
| 64 |
+
simpa only [mul_comm] using density_mul_integrable hfi
|
| 65 |
+
have hibp := integral_mul_deriv_eq_deriv_mul_of_integrable
|
| 66 |
+
(u := f) (v := gaussianPDFReal 0 1) (u' := f') (v' := fun x ↦ -x*gaussianPDFReal 0 1 x)
|
| 67 |
+
(fun x _ ↦ hf x) (fun x _ ↦ density_hasDerivAt x) hi1 hi2 hi3
|
| 68 |
+
have hb : (∫ x, f x*(-x*gaussianPDFReal 0 1 x)) =
|
| 69 |
+
-(∫ x, gaussianPDFReal 0 1 x*(x*f x)) := by
|
| 70 |
+
rw [← integral_neg]
|
| 71 |
+
apply integral_congr_ae
|
| 72 |
+
exact Eventually.of_forall (fun x ↦ by ring)
|
| 73 |
+
rw [hb] at hibp
|
| 74 |
+
have he : (∫ x, gaussianPDFReal 0 1 x*(x*f x)) =
|
| 75 |
+
∫ x, gaussianPDFReal 0 1 x*f' x := by
|
| 76 |
+
exact neg_injective hibp |>.trans (by congr 1; funext x; ring)
|
| 77 |
+
simpa only [standardGaussian,integral_gaussianReal_eq_integral_smul (by norm_num : (1 : ℝ≥0) ≠ 0),
|
| 78 |
+
smul_eq_mul] using he
|
| 79 |
+
|
| 80 |
+
lemma gaussian_coordinate_integrable {ι : Type*} [Fintype ι] (i : ι) :
|
| 81 |
+
Integrable (fun z : ι → ℝ ↦ z i) (gaussianProduct ι) := by
|
| 82 |
+
exact ((measurePreserving_eval (fun _ : ι ↦ standardGaussian) i).integrable_comp
|
| 83 |
+
standardGaussian_integrable_id.aestronglyMeasurable).mpr standardGaussian_integrable_id
|
| 84 |
+
|
| 85 |
+
lemma gaussian_pi_stein_bounded {n : ℕ} (i : Fin n) {f f' : (Fin n → ℝ) → ℝ} {C D : ℝ}
|
| 86 |
+
(hf : Continuous f) (hf' : Continuous f')
|
| 87 |
+
(hd : ∀ z, HasDerivAt (fun x ↦ f (Function.update z i x)) (f' z) (z i))
|
| 88 |
+
(hC : ∀ z, |f z| ≤ C) (hD : ∀ z, |f' z| ≤ D) :
|
| 89 |
+
(∫ z, z i*f z ∂gaussianProduct (Fin n)) = ∫ z, f' z ∂gaussianProduct (Fin n) := by
|
| 90 |
+
cases n with
|
| 91 |
+
| zero => exact Fin.elim0 i
|
| 92 |
+
| succ n =>
|
| 93 |
+
let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) ↦ ℝ) i
|
| 94 |
+
have he : MeasurePreserving e.symm (standardGaussian.prod (gaussianProduct (Fin n)))
|
| 95 |
+
(gaussianProduct (Fin (n+1))) :=
|
| 96 |
+
(measurePreserving_piFinSuccAbove (fun _ : Fin (n+1) ↦ standardGaussian) i).symm
|
| 97 |
+
have hi : Integrable (fun z : Fin (n+1) → ℝ ↦ z i*f z) (gaussianProduct (Fin (n+1))) :=
|
| 98 |
+
(gaussian_coordinate_integrable i).mul_bdd hf.aestronglyMeasurable
|
| 99 |
+
(Eventually.of_forall (fun z ↦ (Real.norm_eq_abs _).trans_le (hC z)))
|
| 100 |
+
have hi' : Integrable f' (gaussianProduct (Fin (n+1))) :=
|
| 101 |
+
Integrable.of_bound hf'.aestronglyMeasurable D
|
| 102 |
+
(Eventually.of_forall (fun z ↦ (Real.norm_eq_abs _).trans_le (hD z)))
|
| 103 |
+
have hip : Integrable (fun p ↦ e.symm p i * f (e.symm p))
|
| 104 |
+
(standardGaussian.prod (gaussianProduct (Fin n))) := (he.integrable_comp hi.aestronglyMeasurable).mpr hi
|
| 105 |
+
have hi'p : Integrable (fun p ↦ f' (e.symm p))
|
| 106 |
+
(standardGaussian.prod (gaussianProduct (Fin n))) := (he.integrable_comp hi'.aestronglyMeasurable).mpr hi'
|
| 107 |
+
rw [← he.integral_comp' (fun z ↦ z i*f z), ← he.integral_comp' f',
|
| 108 |
+
integral_prod _ hip, integral_prod _ hi'p,
|
| 109 |
+
integral_integral_swap (f := fun x y ↦ e.symm (x,y) i * f (e.symm (x,y))) hip,
|
| 110 |
+
integral_integral_swap (f := fun x y ↦ f' (e.symm (x,y))) hi'p]
|
| 111 |
+
apply integral_congr_ae
|
| 112 |
+
apply Eventually.of_forall
|
| 113 |
+
intro y
|
| 114 |
+
simp only [e, MeasurableEquiv.piFinSuccAbove_symm_apply,Fin.insertNthEquiv,Equiv.coe_fn_mk,Fin.insertNth_apply_same]
|
| 115 |
+
change (∫ x, x*f (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y) ∂standardGaussian) =
|
| 116 |
+
∫ x, f' (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y) ∂standardGaussian
|
| 117 |
+
have hmeas : Measurable (fun x : ℝ ↦ i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y) := by
|
| 118 |
+
exact e.symm.measurable.comp (measurable_id.prodMk measurable_const)
|
| 119 |
+
apply gaussian_stein_bounded (f' := fun x ↦ f' (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y))
|
| 120 |
+
· intro x
|
| 121 |
+
simpa only [Fin.update_insertNth,Fin.insertNth_apply_same] using hd (i.insertNth (α := fun _ : Fin (n+1) ↦ ℝ) x y)
|
| 122 |
+
· exact (hf'.measurable.comp hmeas).aestronglyMeasurable
|
| 123 |
+
· exact fun x ↦ hC _
|
| 124 |
+
· exact fun x ↦ hD _
|
| 125 |
+
|
| 126 |
+
noncomputable def partition {ι : Type*} [Fintype ι] (x : ι → ℝ) : ℝ :=
|
| 127 |
+
∑ i, Real.exp (x i)
|
| 128 |
+
|
| 129 |
+
noncomputable def gibbsWeight {ι : Type*} [Fintype ι] (x : ι → ℝ) (i : ι) : ℝ :=
|
| 130 |
+
Real.exp (x i) / partition x
|
| 131 |
+
|
| 132 |
+
noncomputable def logPartition {ι : Type*} [Fintype ι] (x : ι → ℝ) : ℝ :=
|
| 133 |
+
Real.log (partition x)
|
| 134 |
+
|
| 135 |
+
lemma partition_pos {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) : 0 < partition x := by
|
| 136 |
+
exact Finset.sum_pos (fun i _ ↦ Real.exp_pos _) Finset.univ_nonempty
|
| 137 |
+
|
| 138 |
+
lemma gibbsWeight_nonneg {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (i : ι) :
|
| 139 |
+
0 ≤ gibbsWeight x i := le_of_lt (div_pos (Real.exp_pos _) (partition_pos x))
|
| 140 |
+
|
| 141 |
+
lemma sum_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 142 |
+
∑ i, gibbsWeight x i = 1 := by
|
| 143 |
+
simp only [gibbsWeight,← Finset.sum_div]
|
| 144 |
+
change partition x / partition x = 1
|
| 145 |
+
exact div_self (ne_of_gt (partition_pos x))
|
| 146 |
+
|
| 147 |
+
lemma gibbsWeight_le_one {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (i : ι) :
|
| 148 |
+
gibbsWeight x i ≤ 1 := by
|
| 149 |
+
calc
|
| 150 |
+
_ ≤ ∑ j, gibbsWeight x j := Finset.single_le_sum (fun j _ ↦ gibbsWeight_nonneg x j) (Finset.mem_univ i)
|
| 151 |
+
_ = 1 := sum_gibbsWeight x
|
| 152 |
+
|
| 153 |
+
lemma continuous_partition {ι : Type*} [Fintype ι] : Continuous (@partition ι _) := by
|
| 154 |
+
unfold partition
|
| 155 |
+
fun_prop
|
| 156 |
+
|
| 157 |
+
lemma continuous_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι] (i : ι) :
|
| 158 |
+
Continuous (fun x : ι → ℝ ↦ gibbsWeight x i) := by
|
| 159 |
+
exact (Real.continuous_exp.comp (continuous_apply i)).div continuous_partition (fun x ↦ ne_of_gt (partition_pos x))
|
| 160 |
+
|
| 161 |
+
lemma hasDerivAt_partition {ι : Type*} [Fintype ι] {x : ℝ → ι → ℝ} {v : ι → ℝ} {t : ℝ}
|
| 162 |
+
(h : ∀ i, HasDerivAt (fun s ↦ x s i) (v i) t) :
|
| 163 |
+
HasDerivAt (fun s ↦ partition (x s)) (∑ i, Real.exp (x t i)*v i) t := by
|
| 164 |
+
simpa only [partition,Finset.sum_apply] using (HasDerivAt.fun_sum (u := Finset.univ) (fun i _ ↦ (h i).exp))
|
| 165 |
+
|
| 166 |
+
lemma hasDerivAt_logPartition {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 167 |
+
{x : ℝ → ι → ℝ} {v : ι → ℝ} {t : ℝ}
|
| 168 |
+
(h : ∀ i, HasDerivAt (fun s ↦ x s i) (v i) t) :
|
| 169 |
+
HasDerivAt (fun s ↦ logPartition (x s)) (∑ i, gibbsWeight (x t) i*v i) t := by
|
| 170 |
+
convert (hasDerivAt_partition h).log (ne_of_gt (partition_pos _)) using 1 <;> try rfl
|
| 171 |
+
simp only [gibbsWeight,Finset.sum_div,mul_div_assoc]
|
| 172 |
+
apply Finset.sum_congr rfl
|
| 173 |
+
intro i _
|
| 174 |
+
ring
|
| 175 |
+
|
| 176 |
+
lemma hasDerivAt_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 177 |
+
{x : ℝ → ι → ℝ} {v : ι → ℝ} {t : ℝ}
|
| 178 |
+
(h : ∀ i, HasDerivAt (fun s ↦ x s i) (v i) t) (i : ι) :
|
| 179 |
+
HasDerivAt (fun s ↦ gibbsWeight (x s) i)
|
| 180 |
+
(gibbsWeight (x t) i*(v i-∑ j, gibbsWeight (x t) j*v j)) t := by
|
| 181 |
+
convert (h i).exp.div (hasDerivAt_partition h) (ne_of_gt (partition_pos _)) using 1 <;> try rfl
|
| 182 |
+
simp only [gibbsWeight]
|
| 183 |
+
rw [show (∑ j, Real.exp (x t j)/partition (x t)*v j) =
|
| 184 |
+
(∑ j, Real.exp (x t j)*v j)/partition (x t) by
|
| 185 |
+
rw [Finset.sum_div]; apply Finset.sum_congr rfl; intro j _; ring]
|
| 186 |
+
field_simp [ne_of_gt (partition_pos (x t))]
|
| 187 |
+
|
| 188 |
+
lemma abs_gibbsMean_le {ι : Type*} [Fintype ι] [Nonempty ι] (x v : ι → ℝ) {C : ℝ}
|
| 189 |
+
(hC : ∀ i, |v i| ≤ C) : |∑ i, gibbsWeight x i*v i| ≤ C := by
|
| 190 |
+
calc
|
| 191 |
+
_ ≤ ∑ i, |gibbsWeight x i*v i| := Finset.abs_sum_le_sum_abs _ _
|
| 192 |
+
_ = ∑ i, gibbsWeight x i*|v i| := by simp only [abs_mul,abs_of_nonneg (gibbsWeight_nonneg _ _)]
|
| 193 |
+
_ ≤ ∑ i, gibbsWeight x i*C := Finset.sum_le_sum (fun i _ ↦ mul_le_mul_of_nonneg_left (hC i) (gibbsWeight_nonneg _ _))
|
| 194 |
+
_ = C := by rw [← Finset.sum_mul,sum_gibbsWeight,one_mul]
|
| 195 |
+
|
| 196 |
+
noncomputable def linearProcess {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) (z : κ → ℝ) (i : ι) : ℝ :=
|
| 197 |
+
∑ k, c i k*z k
|
| 198 |
+
|
| 199 |
+
lemma continuous_linearProcess {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) :
|
| 200 |
+
Continuous (linearProcess c) := by
|
| 201 |
+
unfold linearProcess
|
| 202 |
+
fun_prop
|
| 203 |
+
|
| 204 |
+
lemma hasDerivAt_linearProcess_update {ι κ : Type*} [Fintype κ] [DecidableEq κ]
|
| 205 |
+
(c : ι → κ → ℝ) (z : κ → ℝ) (i : ι) (k : κ) :
|
| 206 |
+
HasDerivAt (fun x ↦ linearProcess c (Function.update z k x) i) (c i k) (z k) := by
|
| 207 |
+
have h : ∀ j, HasDerivAt (fun x ↦ c i j * Function.update z k x j)
|
| 208 |
+
(if j=k then c i k else 0) (z k) := by
|
| 209 |
+
intro j
|
| 210 |
+
by_cases hj : j=k
|
| 211 |
+
· subst j
|
| 212 |
+
simpa only [Function.update_self,ite_true,mul_one,id_eq] using (hasDerivAt_id (z k)).const_mul (c i k)
|
| 213 |
+
· simpa only [Function.update_of_ne hj,ite_eq_right hj] using hasDerivAt_const (z k) (c i j*z j)
|
| 214 |
+
simpa only [linearProcess,Finset.sum_apply,Finset.sum_ite_eq',Finset.mem_univ,ite_true]
|
| 215 |
+
using HasDerivAt.fun_sum (u := Finset.univ) (fun j _ ↦ h j)
|
| 216 |
+
|
| 217 |
+
lemma continuous_linear_gibbsWeight {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 218 |
+
(c : ι → κ → ℝ) (i : ι) : Continuous (fun z ↦ gibbsWeight (linearProcess c z) i) :=
|
| 219 |
+
(continuous_gibbsWeight i).comp (continuous_linearProcess c)
|
| 220 |
+
|
| 221 |
+
lemma integrable_linear_gibbsWeight {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 222 |
+
(c : ι → κ → ℝ) (i : ι) : Integrable (fun z ↦ gibbsWeight (linearProcess c z) i) (gaussianProduct κ) := by
|
| 223 |
+
apply Integrable.of_bound (continuous_linear_gibbsWeight c i).aestronglyMeasurable 1
|
| 224 |
+
exact Eventually.of_forall (fun z ↦ by rw [Real.norm_eq_abs,abs_of_nonneg (gibbsWeight_nonneg _ _)]; exact gibbsWeight_le_one _ _)
|
| 225 |
+
|
| 226 |
+
lemma coordinate_gibbsWeight_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 227 |
+
(c : ι → κ → ℝ) (i : ι) (k : κ) :
|
| 228 |
+
Integrable (fun z ↦ z k*gibbsWeight (linearProcess c z) i) (gaussianProduct κ) := by
|
| 229 |
+
apply (gaussian_coordinate_integrable k).mul_bdd (continuous_linear_gibbsWeight c i).aestronglyMeasurable
|
| 230 |
+
exact Eventually.of_forall (fun z ↦ by rw [Real.norm_eq_abs,abs_of_nonneg (gibbsWeight_nonneg _ _)]; exact gibbsWeight_le_one _ _)
|
| 231 |
+
|
| 232 |
+
lemma gaussian_coordinate_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 233 |
+
{n : ℕ} (c : ι → Fin n → ℝ) (i : ι) (k : Fin n) :
|
| 234 |
+
(∫ z, z k*gibbsWeight (linearProcess c z) i ∂gaussianProduct (Fin n)) =
|
| 235 |
+
∫ z, gibbsWeight (linearProcess c z) i *
|
| 236 |
+
(c i k - ∑ j, gibbsWeight (linearProcess c z) j*c j k) ∂gaussianProduct (Fin n) := by
|
| 237 |
+
apply gaussian_pi_stein_bounded k (C := 1) (D := 2*∑ j, |c j k|)
|
| 238 |
+
· exact continuous_linear_gibbsWeight c i
|
| 239 |
+
· apply Continuous.mul (continuous_linear_gibbsWeight c i)
|
| 240 |
+
apply continuous_const.sub
|
| 241 |
+
exact continuous_finsetSum _ (fun j _ ↦ (continuous_linear_gibbsWeight c j).mul continuous_const)
|
| 242 |
+
· intro z
|
| 243 |
+
simpa only [Function.update_eq_self] using
|
| 244 |
+
hasDerivAt_gibbsWeight (fun j ↦ hasDerivAt_linearProcess_update c z j k) i
|
| 245 |
+
· intro z
|
| 246 |
+
rw [abs_of_nonneg (gibbsWeight_nonneg _ _)]
|
| 247 |
+
exact gibbsWeight_le_one _ _
|
| 248 |
+
· intro z
|
| 249 |
+
have hsum : ∀ j, |c j k| ≤ ∑ l, |c l k| := fun j ↦
|
| 250 |
+
Finset.single_le_sum (f := fun l ↦ |c l k|) (fun l _ ↦ abs_nonneg _) (Finset.mem_univ j)
|
| 251 |
+
calc
|
| 252 |
+
_ = gibbsWeight (linearProcess c z) i * |c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k| := by
|
| 253 |
+
rw [abs_mul,abs_of_nonneg (gibbsWeight_nonneg _ _)]
|
| 254 |
+
_ ≤ |c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k| :=
|
| 255 |
+
mul_le_of_le_one_left (abs_nonneg _) (gibbsWeight_le_one _ _)
|
| 256 |
+
_ ≤ |c i k| + |∑ j, gibbsWeight (linearProcess c z) j*c j k| := abs_sub _ _
|
| 257 |
+
_ ≤ (∑ j, |c j k|) + (∑ j, |c j k|) := add_le_add (hsum i) (abs_gibbsMean_le _ _ hsum)
|
| 258 |
+
_ = _ := by ring
|
| 259 |
+
|
| 260 |
+
lemma le_logPartition {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) (i : ι) :
|
| 261 |
+
x i ≤ logPartition x := by
|
| 262 |
+
apply (Real.le_log_iff_exp_le (partition_pos x)).mpr
|
| 263 |
+
exact Finset.single_le_sum (fun j _ ↦ (Real.exp_pos _).le) (Finset.mem_univ i)
|
| 264 |
+
|
| 265 |
+
lemma logPartition_le {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) {C : ℝ}
|
| 266 |
+
(h : ∀ i, x i ≤ C) : logPartition x ≤ Real.log (Fintype.card ι) + C := by
|
| 267 |
+
have hc : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos
|
| 268 |
+
calc
|
| 269 |
+
logPartition x ≤ Real.log ((Fintype.card ι : ℝ)*Real.exp C) := by
|
| 270 |
+
apply Real.log_le_log (partition_pos x)
|
| 271 |
+
calc
|
| 272 |
+
partition x ≤ ∑ _ : ι, Real.exp C := Finset.sum_le_sum (fun i _ ↦ Real.exp_le_exp.mpr (h i))
|
| 273 |
+
_ = _ := by simp
|
| 274 |
+
_ = _ := by rw [Real.log_mul (ne_of_gt hc) (Real.exp_ne_zero _),Real.log_exp]
|
| 275 |
+
|
| 276 |
+
lemma abs_logPartition_le {ι : Type*} [Fintype ι] [Nonempty ι] (x : ι → ℝ) :
|
| 277 |
+
|logPartition x| ≤ |Real.log (Fintype.card ι)| + ∑ i, |x i| := by
|
| 278 |
+
have hsum : ∀ i, |x i| ≤ ∑ j, |x j| := fun i ↦
|
| 279 |
+
Finset.single_le_sum (f := fun j ↦ |x j|) (fun j _ ↦ abs_nonneg _) (Finset.mem_univ i)
|
| 280 |
+
have hu := logPartition_le x (fun i ↦ (le_abs_self _).trans (hsum i))
|
| 281 |
+
obtain ⟨i⟩ := ‹Nonempty ι›
|
| 282 |
+
have hl := le_logPartition x i
|
| 283 |
+
have hx := neg_abs_le (x i)
|
| 284 |
+
have hxi := hsum i
|
| 285 |
+
rw [abs_le]
|
| 286 |
+
constructor <;> linarith [le_abs_self (Real.log (Fintype.card ι)),abs_nonneg (Real.log (Fintype.card ι))]
|
| 287 |
+
|
| 288 |
+
lemma continuous_logPartition {ι : Type*} [Fintype ι] [Nonempty ι] :
|
| 289 |
+
Continuous (@logPartition ι _) :=
|
| 290 |
+
continuous_partition.log (fun x ↦ ne_of_gt (partition_pos x))
|
| 291 |
+
|
| 292 |
+
lemma linearProcess_integrable {ι κ : Type*} [Fintype κ] (c : ι → κ → ℝ) (i : ι) :
|
| 293 |
+
Integrable (fun z ↦ linearProcess c z i) (gaussianProduct κ) :=
|
| 294 |
+
integrable_finsetSum _ (fun k _ ↦ (gaussian_coordinate_integrable k).const_mul (c i k))
|
| 295 |
+
|
| 296 |
+
lemma logPartition_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 297 |
+
(c : ι → κ → ℝ) : Integrable (fun z ↦ logPartition (linearProcess c z)) (gaussianProduct κ) := by
|
| 298 |
+
have hb := (integrable_const (|Real.log (Fintype.card ι)| : ℝ)).add
|
| 299 |
+
(integrable_finsetSum Finset.univ (fun i _ ↦ (linearProcess_integrable c i).abs))
|
| 300 |
+
apply hb.mono' ((continuous_logPartition.comp (continuous_linearProcess c)).aestronglyMeasurable)
|
| 301 |
+
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_def,Pi.add_apply] using abs_logPartition_le (linearProcess c z))
|
| 302 |
+
|
| 303 |
+
lemma gibbsWeight_mul_integrable {ι κ : Type*} [Fintype ι] [Nonempty ι] [Fintype κ]
|
| 304 |
+
(c : ι → κ → ℝ) (i : ι) {f : (κ → ℝ) → ℝ} (hi : Integrable f (gaussianProduct κ)) :
|
| 305 |
+
Integrable (fun z ↦ gibbsWeight (linearProcess c z) i*f z) (gaussianProduct κ) := by
|
| 306 |
+
simpa only [mul_comm] using hi.mul_bdd (continuous_linear_gibbsWeight c i).aestronglyMeasurable
|
| 307 |
+
(Eventually.of_forall (fun z ↦ by rw [Real.norm_eq_abs,abs_of_nonneg (gibbsWeight_nonneg _ _)]; exact gibbsWeight_le_one _ _))
|
| 308 |
+
|
| 309 |
+
lemma gaussian_linear_gibbsWeight {ι : Type*} [Fintype ι] [Nonempty ι]
|
| 310 |
+
{n : ℕ} (c d : ι → Fin n → ℝ) (i : ι) :
|
| 311 |
+
(∫ z, gibbsWeight (linearProcess c z) i * linearProcess d z i ∂gaussianProduct (Fin n)) =
|
| 312 |
+
∫ z, gibbsWeight (linearProcess c z) i *
|
| 313 |
+
((∑ k, d i k*c i k) - ∑ j, gibbsWeight (linearProcess c z) j*(∑ k, d i k*c j k))
|
| 314 |
+
∂gaussianProduct (Fin n) := by
|
| 315 |
+
have hid : ∀ k, Integrable (fun z ↦ d i k * (z k*gibbsWeight (linearProcess c z) i))
|
| 316 |
+
(gaussianProduct (Fin n)) := fun k ↦ (coordinate_gibbsWeight_integrable c i k).const_mul _
|
| 317 |
+
have hic : ∀ k, Integrable (fun z ↦ d i k * (gibbsWeight (linearProcess c z) i *
|
| 318 |
+
(c i k - ∑ j, gibbsWeight (linearProcess c z) j*c j k))) (gaussianProduct (Fin n)) := by
|
| 319 |
+
intro k
|
| 320 |
+
apply Integrable.const_mul
|
| 321 |
+
apply gibbsWeight_mul_integrable
|
| 322 |
+
exact (integrable_const _).sub (integrable_finsetSum Finset.univ
|
| 323 |
+
(fun j _ ↦ (integrable_linear_gibbsWeight c j).mul_const _))
|
| 324 |
+
calc
|
| 325 |
+
_ = ∫ z, ∑ k, d i k*(z k*gibbsWeight (linearProcess c z) i) ∂gaussianProduct (Fin n) := by
|
| 326 |
+
apply integral_congr_ae
|
| 327 |
+
exact Eventually.of_forall (fun z ↦ by simp only [linearProcess,Finset.mul_sum]; apply Finset.sum_congr rfl; intro k _; ring)
|
| 328 |
+
_ = ∑ k, d i k * (∫ z, z k*gibbsWeight (linearProcess c z) i ∂gaussianProduct (Fin n)) := by
|
| 329 |
+
rw [integral_finsetSum Finset.univ (fun k _ ↦ hid k)]
|
| 330 |
+
simp only [integral_const_mul]
|
| 331 |
+
_ = ∑ k, d i k * (∫ z, gibbsWeight (linearProcess c z) i *
|
| 332 |
+
(c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k) ∂gaussianProduct (Fin n)) := by
|
| 333 |
+
simp only [gaussian_coordinate_gibbsWeight]
|
| 334 |
+
_ = ∫ z, ∑ k, d i k * (gibbsWeight (linearProcess c z) i *
|
| 335 |
+
(c i k-∑ j, gibbsWeight (linearProcess c z) j*c j k)) ∂gaussianProduct (Fin n) := by
|
| 336 |
+
rw [integral_finsetSum Finset.univ (fun k _ ↦ hic k)]
|
| 337 |
+
simp only [integral_const_mul]
|
| 338 |
+
_ = _ := by
|
| 339 |
+
apply integral_congr_ae
|
| 340 |
+
apply Eventually.of_forall
|
| 341 |
+
intro z
|
| 342 |
+
simp only [mul_sub,Finset.sum_sub_distrib,Finset.mul_sum]
|
| 343 |
+
congr 1
|
| 344 |
+
· apply Finset.sum_congr rfl; intro k _; ring
|
| 345 |
+
· rw [Finset.sum_comm]
|
| 346 |
+
apply Finset.sum_congr rfl; intro j _
|
| 347 |
+
apply Finset.sum_congr rfl; intro k _; ring
|
| 348 |
+
|
| 349 |
+
lemma weighted_covariance_pairs {ι : Type*} [Fintype ι] (p : ι → ℝ) (D : ι → ι → ℝ)
|
| 350 |
+
(hp : ∑ i, p i = 1) :
|
| 351 |
+
∑ i, p i*(D i i-∑ j, p j*D i j) =
|
| 352 |
+
(1/2 : ℝ)*∑ i, ∑ j, p i*p j*(D i i+D j j-D i j-D j i) := by
|
| 353 |
+
have h1 : (∑ i, ∑ j, p i*p j*D i i) = ∑ i, p i*D i i := by
|
| 354 |
+
apply Finset.sum_congr rfl
|
| 355 |
+
intro i _
|
| 356 |
+
calc
|
| 357 |
+
_ = p i*D i i*∑ j, p j := by rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro j _; ring
|
| 358 |
+
_ = _ := by rw [hp,mul_one]
|
| 359 |
+
have h2 : (∑ i, ∑ j, p i*p j*D j j) = ∑ j, p j*D j j := by
|
| 360 |
+
rw [Finset.sum_comm]
|
| 361 |
+
apply Finset.sum_congr rfl
|
| 362 |
+
intro j _
|
| 363 |
+
calc
|
| 364 |
+
_ = (∑ i, p i)*(p j*D j j) := by rw [Finset.sum_mul]; apply Finset.sum_congr rfl; intro i _; ring
|
| 365 |
+
_ = _ := by rw [hp,one_mul]
|
| 366 |
+
have h3 : (∑ i, ∑ j, p i*p j*D j i) = ∑ i, ∑ j, p i*p j*D i j := by
|
| 367 |
+
rw [Finset.sum_comm]
|
| 368 |
+
apply Finset.sum_congr rfl; intro i _
|
| 369 |
+
apply Finset.sum_congr rfl; intro j _; ring
|
| 370 |
+
have hl : (∑ i, p i*(D i i-∑ j, p j*D i j)) =
|
| 371 |
+
(∑ i, p i*D i i) - ∑ i, ∑ j, p i*p j*D i j := by
|
| 372 |
+
simp only [mul_sub,Finset.sum_sub_distrib,Finset.mul_sum,mul_assoc]
|
| 373 |
+
have hr : (∑ i, ∑ j, p i*p j*(D i i+D j j-D i j-D j i)) =
|
| 374 |
+
2*(∑ i, p i*D i i)-2*(∑ i, ∑ j, p i*p j*D i j) := by
|
| 375 |
+
simp only [mul_sub,mul_add,Finset.sum_sub_distrib,Finset.sum_add_distrib]
|
| 376 |
+
rw [h1,h2,h3]
|
| 377 |
+
ring
|
| 378 |
+
rw [hl,hr]
|
| 379 |
+
ring
|
| 380 |
+
|
| 381 |
+
end SKValueG
|
| 382 |
+
end
|
| 383 |
+
|
| 384 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/TreeGuerra.lean
CHANGED
|
@@ -1,161 +1,161 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.LiteralLower
|
| 3 |
-
import OAI.Probability.SKValue.GroundState.GaussianTree
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
-
namespace SKValueG
|
| 12 |
-
|
| 13 |
-
lemma treeAux_tensor_distance (n : ℕ) (T : GaussianTree) (hT : ValidTreeGrid 0 T)
|
| 14 |
-
(α β : TreeLeaves T) :
|
| 15 |
-
(∑ e,(leafAuxCoeff n (treeFieldVector 0 T) α e-leafAuxCoeff n (treeFieldVector 0 T) β e)^2)=
|
| 16 |
-
∑ e,(treeAuxVector n 0 T α e-treeAuxVector n 0 T β e)^2 := by
|
| 17 |
-
rw [sq_distance_sum,leafAux_sq n _ (treeField_unit T hT),
|
| 18 |
-
leafAux_sq n _ (treeField_unit T hT),leafAux_inner,treeField_inner 0 T hT,
|
| 19 |
-
treeAux_distance n T hT]
|
| 20 |
-
ring
|
| 21 |
-
|
| 22 |
-
lemma expected_treeAux_eq_tensor (n : ℕ) (T : GaussianTree) (hT : ValidTreeGrid 0 T)
|
| 23 |
-
(d : TreeLeaves T → ℝ) :
|
| 24 |
-
(∫ z,finiteMaximum (fun α ↦ linearProcess (treeAuxVector n 0 T) z α+d α)
|
| 25 |
-
∂gaussianProduct (TreeEdges T))=
|
| 26 |
-
∫ z,finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n (treeFieldVector 0 T)) z α+d α)
|
| 27 |
-
∂gaussianProduct (TreeEdges T × TreeEdges T) := by
|
| 28 |
-
apply le_antisymm
|
| 29 |
-
· exact expected_affine_max_le _ _ d (fun α β ↦ (treeAux_tensor_distance n T hT α β).symm.le)
|
| 30 |
-
· exact expected_affine_max_le _ _ d (fun α β ↦ (treeAux_tensor_distance n T hT α β).le)
|
| 31 |
-
|
| 32 |
-
theorem finite_tree_guerra_upper {n : ℕ} (hn : 0 < n)
|
| 33 |
-
(T : GaussianTree) (hT : ValidTreeGrid 0 T) (d : TreeLeaves T → ℝ) :
|
| 34 |
-
expectedMaximum n+
|
| 35 |
-
(∫ z,finiteMaximum (fun α ↦ linearProcess (treeAuxVector n 0 T) z α+d α)
|
| 36 |
-
∂gaussianProduct (TreeEdges T))≤
|
| 37 |
-
∫ z,finiteMaximum (fun α ↦ (∑ i,|leafField (treeFieldVector 0 T) z α i|)+d α)
|
| 38 |
-
∂gaussianProduct (Fin n × TreeEdges T) := by
|
| 39 |
-
rw [expected_treeAux_eq_tensor n T hT d]
|
| 40 |
-
exact finite_guerra_upper hn (treeFieldVector 0 T) (treeField_unit T hT) d
|
| 41 |
-
|
| 42 |
-
end SKValueG
|
| 43 |
-
|
| 44 |
-
end
|
| 45 |
-
|
| 46 |
-
section
|
| 47 |
-
|
| 48 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 49 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 50 |
-
namespace SKValueG
|
| 51 |
-
|
| 52 |
-
lemma finiteMaximum_prod_curry_left {ι κ : Type*} [Fintype ι] [Nonempty ι]
|
| 53 |
-
[Fintype κ] [Nonempty κ] (f : ι×κ → ℝ) :
|
| 54 |
-
finiteMaximum f=finiteMaximum (fun i ↦ finiteMaximum (fun j ↦ f (i,j))) := by
|
| 55 |
-
apply le_antisymm
|
| 56 |
-
· obtain ⟨p,hp⟩ := exists_finiteMaximum f
|
| 57 |
-
rw [←hp]
|
| 58 |
-
exact (le_finiteMaximum (fun j ↦ f (p.1,j)) p.2).trans
|
| 59 |
-
(le_finiteMaximum (fun i ↦ finiteMaximum (fun j ↦ f (i,j))) p.1)
|
| 60 |
-
· obtain ⟨i,hi⟩ := exists_finiteMaximum (fun i ↦ finiteMaximum (fun j ↦ f (i,j)))
|
| 61 |
-
obtain ⟨j,hj⟩ := exists_finiteMaximum (fun j ↦ f (i,j))
|
| 62 |
-
rw [←hi,←hj]
|
| 63 |
-
exact le_finiteMaximum f (i,j)
|
| 64 |
-
|
| 65 |
-
lemma treeLinear_step (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 66 |
-
(z : TreeEdges (l::T) → ℝ) (α : TreeLeaves (l::T)) :
|
| 67 |
-
linearProcess (treePathCoeff c q (l::T)) z α=
|
| 68 |
-
c q l*z (Sum.inl α.1)+linearProcess (treePathCoeff c l.endpoint T)
|
| 69 |
-
(fun e ↦ z (Sum.inr (α.1,e))) α.2 := by
|
| 70 |
-
classical
|
| 71 |
-
change (∑ e : Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T),_)=_
|
| 72 |
-
rw [Fintype.sum_sum_type,Fintype.sum_prod_type]
|
| 73 |
-
simp only [treePathCoeff,ite_mul,zero_mul]
|
| 74 |
-
simp [linearProcess]
|
| 75 |
-
|
| 76 |
-
noncomputable def treeCenter : GaussianTree → ℝ
|
| 77 |
-
| [] => 0
|
| 78 |
-
| l::T => Real.log (l.branchExcess+1 : ℝ)/l.height+treeCenter T
|
| 79 |
-
|
| 80 |
-
noncomputable def treeOffset (T : GaussianTree) (g : TreeEdges T → ℝ) (α : TreeLeaves T) : ℝ :=
|
| 81 |
-
linearProcess (treePathCoeff (fun _ l ↦ 1/l.height) 0 T) g α-treeCenter T
|
| 82 |
-
|
| 83 |
-
lemma treePathCoeff_const_q (c : TreeLevel → ℝ) (q r : ℝ) (T : GaussianTree) :
|
| 84 |
-
treePathCoeff (fun _ l ↦ c l) q T=treePathCoeff (fun _ l ↦ c l) r T := by
|
| 85 |
-
induction T with
|
| 86 |
-
| nil => rfl
|
| 87 |
-
| cons l T ih => funext α e; cases e <;> rfl
|
| 88 |
-
|
| 89 |
-
lemma treeOffset_step (l : TreeLevel) (T : GaussianTree)
|
| 90 |
-
(g : TreeEdges (l::T) → ℝ) (α : TreeLeaves (l::T)) :
|
| 91 |
-
treeOffset (l::T) g α=(g (Sum.inl α.1)-Real.log (l.branchExcess+1 : ℝ))/l.height+
|
| 92 |
-
treeOffset T (fun e ↦ g (Sum.inr (α.1,e))) α.2 := by
|
| 93 |
-
rw [treeOffset,treeLinear_step,treeCenter]
|
| 94 |
-
rw [treePathCoeff_const_q (fun l ↦ 1/l.height) l.endpoint 0 T]
|
| 95 |
-
simp only [treeOffset]
|
| 96 |
-
ring
|
| 97 |
-
|
| 98 |
-
noncomputable def scalarTreeValue (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree)
|
| 99 |
-
(z g : TreeEdges T → ℝ) : ℝ :=
|
| 100 |
-
finiteMaximum (fun α ↦ linearProcess (treePathCoeff c q T) z α+treeOffset T g α)
|
| 101 |
-
|
| 102 |
-
lemma scalarTreeValue_step (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 103 |
-
(z g : TreeEdges (l::T) → ℝ) :
|
| 104 |
-
scalarTreeValue c q (l::T) z g=finiteMaximum (fun i : Fin (l.branchExcess+1) ↦
|
| 105 |
-
c q l*z (Sum.inl i)+scalarTreeValue c l.endpoint T
|
| 106 |
-
(fun e ↦ z (Sum.inr (i,e))) (fun e ↦ g (Sum.inr (i,e)))+
|
| 107 |
-
(g (Sum.inl i)-Real.log (l.branchExcess+1 :
|
| 108 |
-
unfold scalarTreeValue
|
| 109 |
-
change finiteMaximum (fun α : Fin (l.branchExcess+1) × TreeLeaves T ↦ _)=_
|
| 110 |
-
rw [finiteMaximum_prod_curry_left]
|
| 111 |
-
congr 1; funext i
|
| 112 |
-
conv_lhs =>
|
| 113 |
-
arg 1
|
| 114 |
-
ext α
|
| 115 |
-
rw [treeLinear_step c q l T z (i,α),treeOffset_step l T g (i,α)]
|
| 116 |
-
have he (a b d e : ℝ) : a+b+(d+e)=(b+e)+(a+d) := by ring
|
| 117 |
-
conv_lhs =>
|
| 118 |
-
arg 1
|
| 119 |
-
ext α
|
| 120 |
-
rw [he]
|
| 121 |
-
dsimp only
|
| 122 |
-
rw [finiteMaximum_add_const]
|
| 123 |
-
ring
|
| 124 |
-
|
| 125 |
-
noncomputable def fieldTreeValue (n : ℕ) (q : ℝ) (T : GaussianTree) (x : Fin n → ℝ)
|
| 126 |
-
(z : Fin n × TreeEdges T → ℝ) (g : TreeEdges T → ℝ) : ℝ :=
|
| 127 |
-
finiteMaximum (fun α ↦ (∑ i,|x i+leafField (treeFieldVector q T) z α i|)+treeOffset T g α)
|
| 128 |
-
|
| 129 |
-
lemma fieldTreeValue_step (n : ℕ) (q : ℝ) (l : TreeLevel) (T : GaussianTree) (x : Fin n → ℝ)
|
| 130 |
-
(z : Fin n × TreeEdges (l::T) → ℝ) (g : TreeEdges (l::T) → ℝ) :
|
| 131 |
-
fieldTreeValue n q (l::T) x z g=finiteMaximum (fun j : Fin (l.branchExcess+1) ↦
|
| 132 |
-
fieldTreeValue n l.endpoint T (fun i ↦ x i+Real.sqrt (l.endpoint-q)*z (i,Sum.inl j))
|
| 133 |
-
(fun p ↦ z (p.1,Sum.inr (j,p.2))) (fun e ↦ g (Sum.inr (j,e)))+
|
| 134 |
-
(g (Sum.inl j)-Real.log (l.branchExcess+1 : ℝ))/l.height) := by
|
| 135 |
-
have hh (α : TreeLeaves (l::T)) (i : Fin n) :
|
| 136 |
-
leafField (treeFieldVector q (l::T)) z α i=
|
| 137 |
-
Real.sqrt (l.endpoint-q)*z (i,Sum.inl α.1)+
|
| 138 |
-
leafField (treeFieldVector l.endpoint T) (fun p ↦ z (p.1,Sum.inr (α.1,p.2))) α.2 i := by
|
| 139 |
-
exact treeLinear_step (fun q l ↦ Real.sqrt (l.endpoint-q)) q l T (fun e ↦ z (i,e)) α
|
| 140 |
-
unfold fieldTreeValue
|
| 141 |
-
change finiteMaximum (fun α : Fin (l.branchExcess+1) × TreeLeaves T ↦ _)=_
|
| 142 |
-
rw [finiteMaximum_prod_curry_left]
|
| 143 |
-
congr 1; funext j
|
| 144 |
-
conv_lhs =>
|
| 145 |
-
arg 1
|
| 146 |
-
ext α
|
| 147 |
-
rw [treeOffset_step l T g (j,α)]
|
| 148 |
-
simp only [hh (j,α),←add_assoc]
|
| 149 |
-
dsimp only
|
| 150 |
-
have he (a b d : ℝ) : a+b+d=(a+d)+b := by ring
|
| 151 |
-
conv_lhs =>
|
| 152 |
-
arg 1
|
| 153 |
-
ext α
|
| 154 |
-
rw [he]
|
| 155 |
-
rw [finiteMaximum_add_const]
|
| 156 |
-
|
| 157 |
-
end SKValueG
|
| 158 |
-
|
| 159 |
-
end
|
| 160 |
-
|
| 161 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.LiteralLower
|
| 3 |
+
import OAI.Probability.SKValue.GroundState.GaussianTree
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
+
namespace SKValueG
|
| 12 |
+
|
| 13 |
+
lemma treeAux_tensor_distance (n : ℕ) (T : GaussianTree) (hT : ValidTreeGrid 0 T)
|
| 14 |
+
(α β : TreeLeaves T) :
|
| 15 |
+
(∑ e,(leafAuxCoeff n (treeFieldVector 0 T) α e-leafAuxCoeff n (treeFieldVector 0 T) β e)^2)=
|
| 16 |
+
∑ e,(treeAuxVector n 0 T α e-treeAuxVector n 0 T β e)^2 := by
|
| 17 |
+
rw [sq_distance_sum,leafAux_sq n _ (treeField_unit T hT),
|
| 18 |
+
leafAux_sq n _ (treeField_unit T hT),leafAux_inner,treeField_inner 0 T hT,
|
| 19 |
+
treeAux_distance n T hT]
|
| 20 |
+
ring
|
| 21 |
+
|
| 22 |
+
lemma expected_treeAux_eq_tensor (n : ℕ) (T : GaussianTree) (hT : ValidTreeGrid 0 T)
|
| 23 |
+
(d : TreeLeaves T → ℝ) :
|
| 24 |
+
(∫ z,finiteMaximum (fun α ↦ linearProcess (treeAuxVector n 0 T) z α+d α)
|
| 25 |
+
∂gaussianProduct (TreeEdges T))=
|
| 26 |
+
∫ z,finiteMaximum (fun α ↦ linearProcess (leafAuxCoeff n (treeFieldVector 0 T)) z α+d α)
|
| 27 |
+
∂gaussianProduct (TreeEdges T × TreeEdges T) := by
|
| 28 |
+
apply le_antisymm
|
| 29 |
+
· exact expected_affine_max_le _ _ d (fun α β ↦ (treeAux_tensor_distance n T hT α β).symm.le)
|
| 30 |
+
· exact expected_affine_max_le _ _ d (fun α β ↦ (treeAux_tensor_distance n T hT α β).le)
|
| 31 |
+
|
| 32 |
+
theorem finite_tree_guerra_upper {n : ℕ} (hn : 0 < n)
|
| 33 |
+
(T : GaussianTree) (hT : ValidTreeGrid 0 T) (d : TreeLeaves T → ℝ) :
|
| 34 |
+
expectedMaximum n+
|
| 35 |
+
(∫ z,finiteMaximum (fun α ↦ linearProcess (treeAuxVector n 0 T) z α+d α)
|
| 36 |
+
∂gaussianProduct (TreeEdges T))≤
|
| 37 |
+
∫ z,finiteMaximum (fun α ↦ (∑ i,|leafField (treeFieldVector 0 T) z α i|)+d α)
|
| 38 |
+
∂gaussianProduct (Fin n × TreeEdges T) := by
|
| 39 |
+
rw [expected_treeAux_eq_tensor n T hT d]
|
| 40 |
+
exact finite_guerra_upper hn (treeFieldVector 0 T) (treeField_unit T hT) d
|
| 41 |
+
|
| 42 |
+
end SKValueG
|
| 43 |
+
|
| 44 |
+
end
|
| 45 |
+
|
| 46 |
+
section
|
| 47 |
+
|
| 48 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 49 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 50 |
+
namespace SKValueG
|
| 51 |
+
|
| 52 |
+
lemma finiteMaximum_prod_curry_left {ι κ : Type*} [Fintype ι] [Nonempty ι]
|
| 53 |
+
[Fintype κ] [Nonempty κ] (f : ι×κ → ℝ) :
|
| 54 |
+
finiteMaximum f=finiteMaximum (fun i ↦ finiteMaximum (fun j ↦ f (i,j))) := by
|
| 55 |
+
apply le_antisymm
|
| 56 |
+
· obtain ⟨p,hp⟩ := exists_finiteMaximum f
|
| 57 |
+
rw [←hp]
|
| 58 |
+
exact (le_finiteMaximum (fun j ↦ f (p.1,j)) p.2).trans
|
| 59 |
+
(le_finiteMaximum (fun i ↦ finiteMaximum (fun j ↦ f (i,j))) p.1)
|
| 60 |
+
· obtain ⟨i,hi⟩ := exists_finiteMaximum (fun i ↦ finiteMaximum (fun j ↦ f (i,j)))
|
| 61 |
+
obtain ⟨j,hj⟩ := exists_finiteMaximum (fun j ↦ f (i,j))
|
| 62 |
+
rw [←hi,←hj]
|
| 63 |
+
exact le_finiteMaximum f (i,j)
|
| 64 |
+
|
| 65 |
+
lemma treeLinear_step (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 66 |
+
(z : TreeEdges (l::T) → ℝ) (α : TreeLeaves (l::T)) :
|
| 67 |
+
linearProcess (treePathCoeff c q (l::T)) z α=
|
| 68 |
+
c q l*z (Sum.inl α.1)+linearProcess (treePathCoeff c l.endpoint T)
|
| 69 |
+
(fun e ↦ z (Sum.inr (α.1,e))) α.2 := by
|
| 70 |
+
classical
|
| 71 |
+
change (∑ e : Fin (l.branchExcess+1) ⊕ (Fin (l.branchExcess+1) × TreeEdges T),_)=_
|
| 72 |
+
rw [Fintype.sum_sum_type,Fintype.sum_prod_type]
|
| 73 |
+
simp only [treePathCoeff,ite_mul,zero_mul]
|
| 74 |
+
simp [linearProcess]
|
| 75 |
+
|
| 76 |
+
noncomputable def treeCenter : GaussianTree → ℝ
|
| 77 |
+
| [] => 0
|
| 78 |
+
| l::T => Real.log (l.branchExcess+1 : ℝ)/l.height+treeCenter T
|
| 79 |
+
|
| 80 |
+
noncomputable def treeOffset (T : GaussianTree) (g : TreeEdges T → ℝ) (α : TreeLeaves T) : ℝ :=
|
| 81 |
+
linearProcess (treePathCoeff (fun _ l ↦ 1/l.height) 0 T) g α-treeCenter T
|
| 82 |
+
|
| 83 |
+
lemma treePathCoeff_const_q (c : TreeLevel → ℝ) (q r : ℝ) (T : GaussianTree) :
|
| 84 |
+
treePathCoeff (fun _ l ↦ c l) q T=treePathCoeff (fun _ l ↦ c l) r T := by
|
| 85 |
+
induction T with
|
| 86 |
+
| nil => rfl
|
| 87 |
+
| cons l T ih => funext α e; cases e <;> rfl
|
| 88 |
+
|
| 89 |
+
lemma treeOffset_step (l : TreeLevel) (T : GaussianTree)
|
| 90 |
+
(g : TreeEdges (l::T) → ℝ) (α : TreeLeaves (l::T)) :
|
| 91 |
+
treeOffset (l::T) g α=(g (Sum.inl α.1)-Real.log (l.branchExcess+1 : ℝ))/l.height+
|
| 92 |
+
treeOffset T (fun e ↦ g (Sum.inr (α.1,e))) α.2 := by
|
| 93 |
+
rw [treeOffset,treeLinear_step,treeCenter]
|
| 94 |
+
rw [treePathCoeff_const_q (fun l ↦ 1/l.height) l.endpoint 0 T]
|
| 95 |
+
simp only [treeOffset]
|
| 96 |
+
ring
|
| 97 |
+
|
| 98 |
+
noncomputable def scalarTreeValue (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree)
|
| 99 |
+
(z g : TreeEdges T → ℝ) : ℝ :=
|
| 100 |
+
finiteMaximum (fun α ↦ linearProcess (treePathCoeff c q T) z α+treeOffset T g α)
|
| 101 |
+
|
| 102 |
+
lemma scalarTreeValue_step (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 103 |
+
(z g : TreeEdges (l::T) → ℝ) :
|
| 104 |
+
scalarTreeValue c q (l::T) z g=finiteMaximum (fun i : Fin (l.branchExcess+1) ↦
|
| 105 |
+
c q l*z (Sum.inl i)+scalarTreeValue c l.endpoint T
|
| 106 |
+
(fun e ↦ z (Sum.inr (i,e))) (fun e ↦ g (Sum.inr (i,e)))+
|
| 107 |
+
(g (Sum.inl i)-Real.log (l.branchExcess+1 : ℝ))/l.height) := by
|
| 108 |
+
unfold scalarTreeValue
|
| 109 |
+
change finiteMaximum (fun α : Fin (l.branchExcess+1) × TreeLeaves T ↦ _)=_
|
| 110 |
+
rw [finiteMaximum_prod_curry_left]
|
| 111 |
+
congr 1; funext i
|
| 112 |
+
conv_lhs =>
|
| 113 |
+
arg 1
|
| 114 |
+
ext α
|
| 115 |
+
rw [treeLinear_step c q l T z (i,α),treeOffset_step l T g (i,α)]
|
| 116 |
+
have he (a b d e : ℝ) : a+b+(d+e)=(b+e)+(a+d) := by ring
|
| 117 |
+
conv_lhs =>
|
| 118 |
+
arg 1
|
| 119 |
+
ext α
|
| 120 |
+
rw [he]
|
| 121 |
+
dsimp only
|
| 122 |
+
rw [finiteMaximum_add_const]
|
| 123 |
+
ring
|
| 124 |
+
|
| 125 |
+
noncomputable def fieldTreeValue (n : ℕ) (q : ℝ) (T : GaussianTree) (x : Fin n → ℝ)
|
| 126 |
+
(z : Fin n × TreeEdges T → ℝ) (g : TreeEdges T → ℝ) : ℝ :=
|
| 127 |
+
finiteMaximum (fun α ↦ (∑ i,|x i+leafField (treeFieldVector q T) z α i|)+treeOffset T g α)
|
| 128 |
+
|
| 129 |
+
lemma fieldTreeValue_step (n : ℕ) (q : ℝ) (l : TreeLevel) (T : GaussianTree) (x : Fin n → ℝ)
|
| 130 |
+
(z : Fin n × TreeEdges (l::T) → ℝ) (g : TreeEdges (l::T) → ℝ) :
|
| 131 |
+
fieldTreeValue n q (l::T) x z g=finiteMaximum (fun j : Fin (l.branchExcess+1) ↦
|
| 132 |
+
fieldTreeValue n l.endpoint T (fun i ↦ x i+Real.sqrt (l.endpoint-q)*z (i,Sum.inl j))
|
| 133 |
+
(fun p ↦ z (p.1,Sum.inr (j,p.2))) (fun e ↦ g (Sum.inr (j,e)))+
|
| 134 |
+
(g (Sum.inl j)-Real.log (l.branchExcess+1 : ℝ))/l.height) := by
|
| 135 |
+
have hh (α : TreeLeaves (l::T)) (i : Fin n) :
|
| 136 |
+
leafField (treeFieldVector q (l::T)) z α i=
|
| 137 |
+
Real.sqrt (l.endpoint-q)*z (i,Sum.inl α.1)+
|
| 138 |
+
leafField (treeFieldVector l.endpoint T) (fun p ↦ z (p.1,Sum.inr (α.1,p.2))) α.2 i := by
|
| 139 |
+
exact treeLinear_step (fun q l ↦ Real.sqrt (l.endpoint-q)) q l T (fun e ↦ z (i,e)) α
|
| 140 |
+
unfold fieldTreeValue
|
| 141 |
+
change finiteMaximum (fun α : Fin (l.branchExcess+1) × TreeLeaves T ↦ _)=_
|
| 142 |
+
rw [finiteMaximum_prod_curry_left]
|
| 143 |
+
congr 1; funext j
|
| 144 |
+
conv_lhs =>
|
| 145 |
+
arg 1
|
| 146 |
+
ext α
|
| 147 |
+
rw [treeOffset_step l T g (j,α)]
|
| 148 |
+
simp only [hh (j,α),←add_assoc]
|
| 149 |
+
dsimp only
|
| 150 |
+
have he (a b d : ℝ) : a+b+d=(a+d)+b := by ring
|
| 151 |
+
conv_lhs =>
|
| 152 |
+
arg 1
|
| 153 |
+
ext α
|
| 154 |
+
rw [he]
|
| 155 |
+
rw [finiteMaximum_add_const]
|
| 156 |
+
|
| 157 |
+
end SKValueG
|
| 158 |
+
|
| 159 |
+
end
|
| 160 |
+
|
| 161 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/TreeProductLaw.lean
CHANGED
|
@@ -1,204 +1,204 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.TreeGuerra
|
| 3 |
-
import OAI.Probability.SKValue.GroundState.BranchLaw
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
-
namespace SKValueG
|
| 12 |
-
|
| 13 |
-
lemma measurePreserving_finite_curry {I E A : Type*} [Fintype I] [Fintype E]
|
| 14 |
-
[MeasurableSpace A] (μ : Measure A) [IsProbabilityMeasure μ] :
|
| 15 |
-
MeasurePreserving (fun z : I×E → A ↦ fun i e ↦ z (i,e))
|
| 16 |
-
(Measure.pi (fun _ ↦ μ)) (Measure.pi (fun _ : I ↦ Measure.pi (fun _ : E ↦ μ))) := by
|
| 17 |
-
refine ⟨by fun_prop,?_⟩
|
| 18 |
-
have h := Measure.infinitePi_map_curry (fun (_ : I) (_ : E) ↦ μ)
|
| 19 |
-
simp only [Measure.infinitePi_eq_pi,MeasurableEquiv.coe_curry] at h
|
| 20 |
-
convert h using 1
|
| 21 |
-
rfl
|
| 22 |
-
|
| 23 |
-
lemma measurePreserving_nodeBlocks {I E A : Type*} [Fintype I] [Fintype E]
|
| 24 |
-
[MeasurableSpace A] (μ : Measure A) [IsProbabilityMeasure μ] :
|
| 25 |
-
MeasurePreserving (fun z : I⊕(I×E) → A ↦ fun i ↦ (z (Sum.inl i),fun e ↦ z (Sum.inr (i,e))))
|
| 26 |
-
(Measure.pi (fun _ ↦ μ))
|
| 27 |
-
(Measure.pi (fun _ : I ↦ μ.prod (Measure.pi (fun _ : E ↦ μ)))) := by
|
| 28 |
-
have hsum := measurePreserving_sumPiEquivProdPi (fun _ : I⊕(I×E) ↦ μ)
|
| 29 |
-
have hc := (MeasurePreserving.id (Measure.pi (fun _ : I ↦ μ))).prod
|
| 30 |
-
(measurePreserving_finite_curry (I := I) (E := E) μ)
|
| 31 |
-
have hp := (measurePreserving_arrowProdEquivProdArrow A (E → A) I
|
| 32 |
-
(fun _ ↦ μ) (fun _ ↦ Measure.pi (fun _ : E ↦ μ))).symm
|
| 33 |
-
exact hp.comp (hc.comp hsum)
|
| 34 |
-
|
| 35 |
-
lemma measurePreserving_midSwap {A B C : Type*} [MeasurableSpace A]
|
| 36 |
-
[MeasurableSpace B] [MeasurableSpace C] (μ : Measure A) (ν : Measure B) (σ : Measure C)
|
| 37 |
-
[SFinite μ] [SFinite ν] [SFinite σ] :
|
| 38 |
-
MeasurePreserving (fun p : (A×B)×C ↦ ((p.1.1,p.2),p.1.2))
|
| 39 |
-
((μ.prod ν).prod σ) ((μ.prod σ).prod ν) := by
|
| 40 |
-
have h1 := measurePreserving_prodAssoc μ ν σ
|
| 41 |
-
have h2 := (MeasurePreserving.id μ).prod (Measure.measurePreserving_swap (μ := ν) (ν := σ))
|
| 42 |
-
have h3 := (measurePreserving_prodAssoc μ σ ν).symm
|
| 43 |
-
exact h3.comp (h2.comp h1)
|
| 44 |
-
|
| 45 |
-
noncomputable def gaussianAddLaw (c : ℝ) (μ : Measure ℝ) : Measure ℝ :=
|
| 46 |
-
(standardGaussian.prod μ).map (fun p : ℝ×ℝ ↦ c*p.1+p.2)
|
| 47 |
-
|
| 48 |
-
instance gaussianAddLaw_probability (c : ℝ) (μ : Measure ℝ) [IsProbabilityMeasure μ] :
|
| 49 |
-
IsProbabilityMeasure (gaussianAddLaw c μ) := by
|
| 50 |
-
unfold gaussianAddLaw
|
| 51 |
-
infer_instance
|
| 52 |
-
|
| 53 |
-
lemma gaussianAddLaw_integrable (c : ℝ) {μ : Measure ℝ} [IsProbabilityMeasure μ]
|
| 54 |
-
(hi : Integrable (fun x : ℝ ↦ x) μ) :
|
| 55 |
-
Integrable (fun x : ℝ ↦ x) (gaussianAddLaw c μ) := by
|
| 56 |
-
rw [gaussianAddLaw,integrable_map_measure (by fun_prop) (by fun_prop)]
|
| 57 |
-
exact ((standardGaussian_integrable_id.const_mul c).comp_fst μ).add (hi.comp_snd _)
|
| 58 |
-
|
| 59 |
-
lemma gaussianAddLaw_exp_integrable (c a : ℝ) {μ : Measure ℝ} [IsProbabilityMeasure μ]
|
| 60 |
-
(hi : Integrable (fun x : ℝ ↦ Real.exp (a*x)) μ) :
|
| 61 |
-
Integrable (fun x : ℝ ↦ Real.exp (a*x)) (gaussianAddLaw c μ) := by
|
| 62 |
-
rw [gaussianAddLaw,integrable_map_measure (by fun_prop) (by fun_prop)]
|
| 63 |
-
have hg : Integrable (fun z : ℝ ↦ Real.exp ((a*c)*z)) standardGaussian :=
|
| 64 |
-
integrable_exp_mul_gaussianReal (μ := 0) (v := 1) (a*c)
|
| 65 |
-
convert hg.mul_prod hi using 1
|
| 66 |
-
funext p
|
| 67 |
-
dsimp only [Function.comp_def]
|
| 68 |
-
rw [←Real.exp_add]
|
| 69 |
-
congr 1
|
| 70 |
-
ring
|
| 71 |
-
|
| 72 |
-
lemma gaussianAddLaw_exp (c a : ℝ) {μ : Measure ℝ} [IsProbabilityMeasure μ] :
|
| 73 |
-
(∫ x,Real.exp (a*x) ∂gaussianAddLaw c μ)=
|
| 74 |
-
Real.exp ((a*c)^2/2)*(∫ x,Real.exp (a*x) ∂μ) := by
|
| 75 |
-
rw [gaussianAddLaw,integral_map (by fun_prop) (by fun_prop)]
|
| 76 |
-
have he (p : ℝ×ℝ) : Real.exp (a*(c*p.1+p.2))=
|
| 77 |
-
Real.exp ((a*c)*p.1)*Real.exp (a*p.2) := by
|
| 78 |
-
rw [←Real.exp_add]; congr 1; ring
|
| 79 |
-
simp_rw [he]
|
| 80 |
-
rw [integral_prod_mul (fun z : ℝ ↦ Real.exp ((a*c)*z)) (fun x : ℝ ↦ Real.exp (a*x))]
|
| 81 |
-
have heq := congrFun (mgf_fun_id_gaussianReal (μ := 0) (v := 1)) (a*c)
|
| 82 |
-
simpa [mgf,standardGaussian] using congrArg (fun x ↦ x*(∫ x,Real.exp (a*x) ∂μ)) heq
|
| 83 |
-
|
| 84 |
-
end SKValueG
|
| 85 |
-
|
| 86 |
-
end
|
| 87 |
-
|
| 88 |
-
section
|
| 89 |
-
|
| 90 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 91 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 92 |
-
namespace SKValueG
|
| 93 |
-
|
| 94 |
-
noncomputable def edgeNoiseLaw : Measure (ℝ×ℝ) := standardGaussian.prod gumbelLaw
|
| 95 |
-
instance edgeNoiseLaw_probability : IsProbabilityMeasure edgeNoiseLaw := by
|
| 96 |
-
unfold edgeNoiseLaw; infer_instance
|
| 97 |
-
|
| 98 |
-
noncomputable def scalarTreeLaw (c : ℝ → TreeLevel → ℝ) (q : ℝ) : GaussianTree → Measure ℝ
|
| 99 |
-
| [] => Measure.dirac 0
|
| 100 |
-
| l::T => branchLaw (gaussianAddLaw (c q l) (scalarTreeLaw c l.endpoint T)) l.height l.branchExcess
|
| 101 |
-
|
| 102 |
-
instance scalarTreeLaw_probability (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 103 |
-
IsProbabilityMeasure (scalarTreeLaw c q T) := by
|
| 104 |
-
induction T generalizing q with
|
| 105 |
-
| nil => exact inferInstanceAs (IsProbabilityMeasure (Measure.dirac (0 : ℝ)))
|
| 106 |
-
| cons l T ih =>
|
| 107 |
-
have := ih l.endpoint
|
| 108 |
-
exact inferInstanceAs (IsProbabilityMeasure
|
| 109 |
-
(branchLaw (gaussianAddLaw (c q l) (scalarTreeLaw c l.endpoint T)) l.height l.branchExcess))
|
| 110 |
-
|
| 111 |
-
noncomputable def scalarTreeEval (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree)
|
| 112 |
-
(w : TreeEdges T → ℝ×ℝ) : ℝ :=
|
| 113 |
-
scalarTreeValue c q T (fun e ↦ (w e).1) (fun e ↦ (w e).2)
|
| 114 |
-
|
| 115 |
-
lemma finiteMaximum_const {I : Type*} [Fintype I] [Nonempty I] (a : ℝ) :
|
| 116 |
-
finiteMaximum (fun _ : I ↦ a)=a := by
|
| 117 |
-
obtain ⟨i,hi⟩ := exists_finiteMaximum (fun _ : I ↦ a)
|
| 118 |
-
exact hi.symm
|
| 119 |
-
|
| 120 |
-
lemma scalarTreeEval_nil (c : ℝ → TreeLevel → ℝ) (q : ℝ) (w : TreeEdges [] → ℝ×ℝ) :
|
| 121 |
-
scalarTreeEval c q [] w=0 := by
|
| 122 |
-
simp only [scalarTreeEval,scalarTreeValue,treeOffset,treeCenter,linearProcess]
|
| 123 |
-
simp only [show ∀ f : PEmpty → ℝ, (∑ e,f e)=0 from fun f ↦ Fintype.sum_empty f,
|
| 124 |
-
sub_self,zero_add,finiteMaximum_const]
|
| 125 |
-
|
| 126 |
-
lemma continuous_scalarTreeEval (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 127 |
-
Continuous (scalarTreeEval c q T) := by
|
| 128 |
-
unfold scalarTreeEval scalarTreeValue treeOffset
|
| 129 |
-
apply continuous_finiteMaximum.comp
|
| 130 |
-
apply continuous_pi
|
| 131 |
-
intro α
|
| 132 |
-
unfold linearProcess
|
| 133 |
-
fun_prop
|
| 134 |
-
|
| 135 |
-
lemma marked_gaussianAddLaw {S : Type*} [MeasurableSpace S] (σ : Measure S) [IsProbabilityMeasure σ]
|
| 136 |
-
{μ : Measure ℝ} [IsProbabilityMeasure μ] {f : S → ℝ}
|
| 137 |
-
(hf : MeasurePreserving f σ μ) (c : ℝ) :
|
| 138 |
-
MeasurePreserving (fun p : (ℝ×ℝ)×S ↦ (c*p.1.1+f p.2,p.1.2))
|
| 139 |
-
(edgeNoiseLaw.prod σ) ((gaussianAddLaw c μ).prod gumbelLaw) := by
|
| 140 |
-
have hadd : MeasurePreserving (fun p : ℝ×ℝ ↦ c*p.1+p.2)
|
| 141 |
-
(standardGaussian.prod μ) (gaussianAddLaw c μ) := ⟨by fun_prop,rfl⟩
|
| 142 |
-
exact ((hadd.prod (MeasurePreserving.id gumbelLaw)).comp
|
| 143 |
-
(((MeasurePreserving.id standardGaussian).prod hf).prod (MeasurePreserving.id gumbelLaw))).comp
|
| 144 |
-
(measurePreserving_midSwap standardGaussian gumbelLaw σ)
|
| 145 |
-
|
| 146 |
-
lemma scalarTreeEval_step (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 147 |
-
(w : TreeEdges (l::T) → ℝ×ℝ) :
|
| 148 |
-
scalarTreeEval c q (l::T) w=branchMax l.height l.branchExcess
|
| 149 |
-
((fun i ↦ c q l*(w (Sum.inl i)).1+
|
| 150 |
-
scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))),
|
| 151 |
-
fun i ↦ (w (Sum.inl i)).2) := by
|
| 152 |
-
rw [scalarTreeEval,scalarTreeValue_step]
|
| 153 |
-
unfold branchMax
|
| 154 |
-
have he (i : Fin (l.branchExcess+1)) :
|
| 155 |
-
c q l*(w (Sum.inl i)).1+scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))+
|
| 156 |
-
((w (Sum.inl i)).2-Real.log (l.branchExcess+1 : ℝ))/l.height=
|
| 157 |
-
(c q l*(w (Sum.inl i)).1+scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))+
|
| 158 |
-
(w (Sum.inl i)).2/l.height)+(-Real.log (l.branchExcess+1 : ℝ)/l.height) := by ring
|
| 159 |
-
change finiteMaximum (fun i ↦ c q l*(w (Sum.inl i)).1+
|
| 160 |
-
scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))+
|
| 161 |
-
((w (Sum.inl i)).2-Real.log (l.branchExcess+1 : ℝ))/l.height)=_
|
| 162 |
-
conv_lhs => arg 1; ext i; rw [he i]
|
| 163 |
-
rw [finiteMaximum_add_const]
|
| 164 |
-
ring
|
| 165 |
-
|
| 166 |
-
theorem scalarTreeEval_law (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 167 |
-
MeasurePreserving (scalarTreeEval c q T) (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw))
|
| 168 |
-
(scalarTreeLaw c q T) := by
|
| 169 |
-
induction T generalizing q with
|
| 170 |
-
| nil =>
|
| 171 |
-
have he : scalarTreeEval c q []=fun _ ↦ (0 : ℝ) := funext (scalarTreeEval_nil c q)
|
| 172 |
-
rw [he,scalarTreeLaw]
|
| 173 |
-
exact ⟨measurable_const,by simp⟩
|
| 174 |
-
| cons l T ih =>
|
| 175 |
-
let ν := gaussianAddLaw (c q l) (scalarTreeLaw c l.endpoint T)
|
| 176 |
-
have hblock := measurePreserving_nodeBlocks (I := Fin (l.branchExcess+1)) (E := TreeEdges T) edgeNoiseLaw
|
| 177 |
-
have hchild := marked_gaussianAddLaw (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)) (ih l.endpoint) (c q l)
|
| 178 |
-
have hchildren := measurePreserving_pi (fun _ : Fin (l.branchExcess+1) ↦
|
| 179 |
-
edgeNoiseLaw.prod (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)))
|
| 180 |
-
(fun _ ↦ ν.prod gumbelLaw) (fun _ ↦ hchild)
|
| 181 |
-
have hpair := measurePreserving_arrowProdEquivProdArrow ℝ ℝ (Fin (l.branchExcess+1))
|
| 182 |
-
(fun _ ↦ ν) (fun _ ↦ gumbelLaw)
|
| 183 |
-
have hmax : MeasurePreserving (branchMax l.height l.branchExcess)
|
| 184 |
-
((Measure.pi (fun _ : Fin (l.branchExcess+1) ↦ ν)).prod
|
| 185 |
-
(Measure.pi (fun _ : Fin (l.branchExcess+1) ↦ gumbelLaw)))
|
| 186 |
-
(scalarTreeLaw c q (l::T)) := ⟨(continuous_branchMax _ _).measurable,rfl⟩
|
| 187 |
-
have hall := hmax.comp (hpair.comp (hchildren.comp hblock))
|
| 188 |
-
convert hall using 1
|
| 189 |
-
funext w
|
| 190 |
-
exact scalarTreeEval_step c q l T w
|
| 191 |
-
|
| 192 |
-
lemma scalarTreeLaw_integrable (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 193 |
-
Integrable (fun x : ℝ ↦ x) (scalarTreeLaw c q T) := by
|
| 194 |
-
induction T generalizing q with
|
| 195 |
-
| nil =>
|
| 196 |
-
change Integrable (fun x : ℝ ↦ x) (Measure.dirac (0 : ℝ))
|
| 197 |
-
exact integrable_dirac (by simp)
|
| 198 |
-
| cons l T ih => exact branchLaw_integrable (gaussianAddLaw_integrable _ (ih l.endpoint)) _ _
|
| 199 |
-
|
| 200 |
-
end SKValueG
|
| 201 |
-
|
| 202 |
-
end
|
| 203 |
-
|
| 204 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.TreeGuerra
|
| 3 |
+
import OAI.Probability.SKValue.GroundState.BranchLaw
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
+
namespace SKValueG
|
| 12 |
+
|
| 13 |
+
lemma measurePreserving_finite_curry {I E A : Type*} [Fintype I] [Fintype E]
|
| 14 |
+
[MeasurableSpace A] (μ : Measure A) [IsProbabilityMeasure μ] :
|
| 15 |
+
MeasurePreserving (fun z : I×E → A ↦ fun i e ↦ z (i,e))
|
| 16 |
+
(Measure.pi (fun _ ↦ μ)) (Measure.pi (fun _ : I ↦ Measure.pi (fun _ : E ↦ μ))) := by
|
| 17 |
+
refine ⟨by fun_prop,?_⟩
|
| 18 |
+
have h := Measure.infinitePi_map_curry (fun (_ : I) (_ : E) ↦ μ)
|
| 19 |
+
simp only [Measure.infinitePi_eq_pi,MeasurableEquiv.coe_curry] at h
|
| 20 |
+
convert h using 1
|
| 21 |
+
rfl
|
| 22 |
+
|
| 23 |
+
lemma measurePreserving_nodeBlocks {I E A : Type*} [Fintype I] [Fintype E]
|
| 24 |
+
[MeasurableSpace A] (μ : Measure A) [IsProbabilityMeasure μ] :
|
| 25 |
+
MeasurePreserving (fun z : I⊕(I×E) → A ↦ fun i ↦ (z (Sum.inl i),fun e ↦ z (Sum.inr (i,e))))
|
| 26 |
+
(Measure.pi (fun _ ↦ μ))
|
| 27 |
+
(Measure.pi (fun _ : I ↦ μ.prod (Measure.pi (fun _ : E ↦ μ)))) := by
|
| 28 |
+
have hsum := measurePreserving_sumPiEquivProdPi (fun _ : I⊕(I×E) ↦ μ)
|
| 29 |
+
have hc := (MeasurePreserving.id (Measure.pi (fun _ : I ↦ μ))).prod
|
| 30 |
+
(measurePreserving_finite_curry (I := I) (E := E) μ)
|
| 31 |
+
have hp := (measurePreserving_arrowProdEquivProdArrow A (E → A) I
|
| 32 |
+
(fun _ ↦ μ) (fun _ ↦ Measure.pi (fun _ : E ↦ μ))).symm
|
| 33 |
+
exact hp.comp (hc.comp hsum)
|
| 34 |
+
|
| 35 |
+
lemma measurePreserving_midSwap {A B C : Type*} [MeasurableSpace A]
|
| 36 |
+
[MeasurableSpace B] [MeasurableSpace C] (μ : Measure A) (ν : Measure B) (σ : Measure C)
|
| 37 |
+
[SFinite μ] [SFinite ν] [SFinite σ] :
|
| 38 |
+
MeasurePreserving (fun p : (A×B)×C ↦ ((p.1.1,p.2),p.1.2))
|
| 39 |
+
((μ.prod ν).prod σ) ((μ.prod σ).prod ν) := by
|
| 40 |
+
have h1 := measurePreserving_prodAssoc μ ν σ
|
| 41 |
+
have h2 := (MeasurePreserving.id μ).prod (Measure.measurePreserving_swap (μ := ν) (ν := σ))
|
| 42 |
+
have h3 := (measurePreserving_prodAssoc μ σ ν).symm
|
| 43 |
+
exact h3.comp (h2.comp h1)
|
| 44 |
+
|
| 45 |
+
noncomputable def gaussianAddLaw (c : ℝ) (μ : Measure ℝ) : Measure ℝ :=
|
| 46 |
+
(standardGaussian.prod μ).map (fun p : ℝ×ℝ ↦ c*p.1+p.2)
|
| 47 |
+
|
| 48 |
+
instance gaussianAddLaw_probability (c : ℝ) (μ : Measure ℝ) [IsProbabilityMeasure μ] :
|
| 49 |
+
IsProbabilityMeasure (gaussianAddLaw c μ) := by
|
| 50 |
+
unfold gaussianAddLaw
|
| 51 |
+
infer_instance
|
| 52 |
+
|
| 53 |
+
lemma gaussianAddLaw_integrable (c : ℝ) {μ : Measure ℝ} [IsProbabilityMeasure μ]
|
| 54 |
+
(hi : Integrable (fun x : ℝ ↦ x) μ) :
|
| 55 |
+
Integrable (fun x : ℝ ↦ x) (gaussianAddLaw c μ) := by
|
| 56 |
+
rw [gaussianAddLaw,integrable_map_measure (by fun_prop) (by fun_prop)]
|
| 57 |
+
exact ((standardGaussian_integrable_id.const_mul c).comp_fst μ).add (hi.comp_snd _)
|
| 58 |
+
|
| 59 |
+
lemma gaussianAddLaw_exp_integrable (c a : ℝ) {μ : Measure ℝ} [IsProbabilityMeasure μ]
|
| 60 |
+
(hi : Integrable (fun x : ℝ ↦ Real.exp (a*x)) μ) :
|
| 61 |
+
Integrable (fun x : ℝ ↦ Real.exp (a*x)) (gaussianAddLaw c μ) := by
|
| 62 |
+
rw [gaussianAddLaw,integrable_map_measure (by fun_prop) (by fun_prop)]
|
| 63 |
+
have hg : Integrable (fun z : ℝ ↦ Real.exp ((a*c)*z)) standardGaussian :=
|
| 64 |
+
integrable_exp_mul_gaussianReal (μ := 0) (v := 1) (a*c)
|
| 65 |
+
convert hg.mul_prod hi using 1
|
| 66 |
+
funext p
|
| 67 |
+
dsimp only [Function.comp_def]
|
| 68 |
+
rw [←Real.exp_add]
|
| 69 |
+
congr 1
|
| 70 |
+
ring
|
| 71 |
+
|
| 72 |
+
lemma gaussianAddLaw_exp (c a : ℝ) {μ : Measure ℝ} [IsProbabilityMeasure μ] :
|
| 73 |
+
(∫ x,Real.exp (a*x) ∂gaussianAddLaw c μ)=
|
| 74 |
+
Real.exp ((a*c)^2/2)*(∫ x,Real.exp (a*x) ∂μ) := by
|
| 75 |
+
rw [gaussianAddLaw,integral_map (by fun_prop) (by fun_prop)]
|
| 76 |
+
have he (p : ℝ×ℝ) : Real.exp (a*(c*p.1+p.2))=
|
| 77 |
+
Real.exp ((a*c)*p.1)*Real.exp (a*p.2) := by
|
| 78 |
+
rw [←Real.exp_add]; congr 1; ring
|
| 79 |
+
simp_rw [he]
|
| 80 |
+
rw [integral_prod_mul (fun z : ℝ ↦ Real.exp ((a*c)*z)) (fun x : ℝ ↦ Real.exp (a*x))]
|
| 81 |
+
have heq := congrFun (mgf_fun_id_gaussianReal (μ := 0) (v := 1)) (a*c)
|
| 82 |
+
simpa [mgf,standardGaussian] using congrArg (fun x ↦ x*(∫ x,Real.exp (a*x) ∂μ)) heq
|
| 83 |
+
|
| 84 |
+
end SKValueG
|
| 85 |
+
|
| 86 |
+
end
|
| 87 |
+
|
| 88 |
+
section
|
| 89 |
+
|
| 90 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 91 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 92 |
+
namespace SKValueG
|
| 93 |
+
|
| 94 |
+
noncomputable def edgeNoiseLaw : Measure (ℝ×ℝ) := standardGaussian.prod gumbelLaw
|
| 95 |
+
instance edgeNoiseLaw_probability : IsProbabilityMeasure edgeNoiseLaw := by
|
| 96 |
+
unfold edgeNoiseLaw; infer_instance
|
| 97 |
+
|
| 98 |
+
noncomputable def scalarTreeLaw (c : ℝ → TreeLevel → ℝ) (q : ℝ) : GaussianTree → Measure ℝ
|
| 99 |
+
| [] => Measure.dirac 0
|
| 100 |
+
| l::T => branchLaw (gaussianAddLaw (c q l) (scalarTreeLaw c l.endpoint T)) l.height l.branchExcess
|
| 101 |
+
|
| 102 |
+
instance scalarTreeLaw_probability (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 103 |
+
IsProbabilityMeasure (scalarTreeLaw c q T) := by
|
| 104 |
+
induction T generalizing q with
|
| 105 |
+
| nil => exact inferInstanceAs (IsProbabilityMeasure (Measure.dirac (0 : ℝ)))
|
| 106 |
+
| cons l T ih =>
|
| 107 |
+
have := ih l.endpoint
|
| 108 |
+
exact inferInstanceAs (IsProbabilityMeasure
|
| 109 |
+
(branchLaw (gaussianAddLaw (c q l) (scalarTreeLaw c l.endpoint T)) l.height l.branchExcess))
|
| 110 |
+
|
| 111 |
+
noncomputable def scalarTreeEval (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree)
|
| 112 |
+
(w : TreeEdges T → ℝ×ℝ) : ℝ :=
|
| 113 |
+
scalarTreeValue c q T (fun e ↦ (w e).1) (fun e ↦ (w e).2)
|
| 114 |
+
|
| 115 |
+
lemma finiteMaximum_const {I : Type*} [Fintype I] [Nonempty I] (a : ℝ) :
|
| 116 |
+
finiteMaximum (fun _ : I ↦ a)=a := by
|
| 117 |
+
obtain ⟨i,hi⟩ := exists_finiteMaximum (fun _ : I ↦ a)
|
| 118 |
+
exact hi.symm
|
| 119 |
+
|
| 120 |
+
lemma scalarTreeEval_nil (c : ℝ → TreeLevel → ℝ) (q : ℝ) (w : TreeEdges [] → ℝ×ℝ) :
|
| 121 |
+
scalarTreeEval c q [] w=0 := by
|
| 122 |
+
simp only [scalarTreeEval,scalarTreeValue,treeOffset,treeCenter,linearProcess]
|
| 123 |
+
simp only [show ∀ f : PEmpty → ℝ, (∑ e,f e)=0 from fun f ↦ Fintype.sum_empty f,
|
| 124 |
+
sub_self,zero_add,finiteMaximum_const]
|
| 125 |
+
|
| 126 |
+
lemma continuous_scalarTreeEval (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 127 |
+
Continuous (scalarTreeEval c q T) := by
|
| 128 |
+
unfold scalarTreeEval scalarTreeValue treeOffset
|
| 129 |
+
apply continuous_finiteMaximum.comp
|
| 130 |
+
apply continuous_pi
|
| 131 |
+
intro α
|
| 132 |
+
unfold linearProcess
|
| 133 |
+
fun_prop
|
| 134 |
+
|
| 135 |
+
lemma marked_gaussianAddLaw {S : Type*} [MeasurableSpace S] (σ : Measure S) [IsProbabilityMeasure σ]
|
| 136 |
+
{μ : Measure ℝ} [IsProbabilityMeasure μ] {f : S → ℝ}
|
| 137 |
+
(hf : MeasurePreserving f σ μ) (c : ℝ) :
|
| 138 |
+
MeasurePreserving (fun p : (ℝ×ℝ)×S ↦ (c*p.1.1+f p.2,p.1.2))
|
| 139 |
+
(edgeNoiseLaw.prod σ) ((gaussianAddLaw c μ).prod gumbelLaw) := by
|
| 140 |
+
have hadd : MeasurePreserving (fun p : ℝ×ℝ ↦ c*p.1+p.2)
|
| 141 |
+
(standardGaussian.prod μ) (gaussianAddLaw c μ) := ⟨by fun_prop,rfl⟩
|
| 142 |
+
exact ((hadd.prod (MeasurePreserving.id gumbelLaw)).comp
|
| 143 |
+
(((MeasurePreserving.id standardGaussian).prod hf).prod (MeasurePreserving.id gumbelLaw))).comp
|
| 144 |
+
(measurePreserving_midSwap standardGaussian gumbelLaw σ)
|
| 145 |
+
|
| 146 |
+
lemma scalarTreeEval_step (c : ℝ → TreeLevel → ℝ) (q : ℝ) (l : TreeLevel) (T : GaussianTree)
|
| 147 |
+
(w : TreeEdges (l::T) → ℝ×ℝ) :
|
| 148 |
+
scalarTreeEval c q (l::T) w=branchMax l.height l.branchExcess
|
| 149 |
+
((fun i ↦ c q l*(w (Sum.inl i)).1+
|
| 150 |
+
scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))),
|
| 151 |
+
fun i ↦ (w (Sum.inl i)).2) := by
|
| 152 |
+
rw [scalarTreeEval,scalarTreeValue_step]
|
| 153 |
+
unfold branchMax
|
| 154 |
+
have he (i : Fin (l.branchExcess+1)) :
|
| 155 |
+
c q l*(w (Sum.inl i)).1+scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))+
|
| 156 |
+
((w (Sum.inl i)).2-Real.log (l.branchExcess+1 : ℝ))/l.height=
|
| 157 |
+
(c q l*(w (Sum.inl i)).1+scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))+
|
| 158 |
+
(w (Sum.inl i)).2/l.height)+(-Real.log (l.branchExcess+1 : ℝ)/l.height) := by ring
|
| 159 |
+
change finiteMaximum (fun i ↦ c q l*(w (Sum.inl i)).1+
|
| 160 |
+
scalarTreeEval c l.endpoint T (fun e ↦ w (Sum.inr (i,e)))+
|
| 161 |
+
((w (Sum.inl i)).2-Real.log (l.branchExcess+1 : ℝ))/l.height)=_
|
| 162 |
+
conv_lhs => arg 1; ext i; rw [he i]
|
| 163 |
+
rw [finiteMaximum_add_const]
|
| 164 |
+
ring
|
| 165 |
+
|
| 166 |
+
theorem scalarTreeEval_law (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 167 |
+
MeasurePreserving (scalarTreeEval c q T) (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw))
|
| 168 |
+
(scalarTreeLaw c q T) := by
|
| 169 |
+
induction T generalizing q with
|
| 170 |
+
| nil =>
|
| 171 |
+
have he : scalarTreeEval c q []=fun _ ↦ (0 : ℝ) := funext (scalarTreeEval_nil c q)
|
| 172 |
+
rw [he,scalarTreeLaw]
|
| 173 |
+
exact ⟨measurable_const,by simp⟩
|
| 174 |
+
| cons l T ih =>
|
| 175 |
+
let ν := gaussianAddLaw (c q l) (scalarTreeLaw c l.endpoint T)
|
| 176 |
+
have hblock := measurePreserving_nodeBlocks (I := Fin (l.branchExcess+1)) (E := TreeEdges T) edgeNoiseLaw
|
| 177 |
+
have hchild := marked_gaussianAddLaw (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)) (ih l.endpoint) (c q l)
|
| 178 |
+
have hchildren := measurePreserving_pi (fun _ : Fin (l.branchExcess+1) ↦
|
| 179 |
+
edgeNoiseLaw.prod (Measure.pi (fun _ : TreeEdges T ↦ edgeNoiseLaw)))
|
| 180 |
+
(fun _ ↦ ν.prod gumbelLaw) (fun _ ↦ hchild)
|
| 181 |
+
have hpair := measurePreserving_arrowProdEquivProdArrow ℝ ℝ (Fin (l.branchExcess+1))
|
| 182 |
+
(fun _ ↦ ν) (fun _ ↦ gumbelLaw)
|
| 183 |
+
have hmax : MeasurePreserving (branchMax l.height l.branchExcess)
|
| 184 |
+
((Measure.pi (fun _ : Fin (l.branchExcess+1) ↦ ν)).prod
|
| 185 |
+
(Measure.pi (fun _ : Fin (l.branchExcess+1) ↦ gumbelLaw)))
|
| 186 |
+
(scalarTreeLaw c q (l::T)) := ⟨(continuous_branchMax _ _).measurable,rfl⟩
|
| 187 |
+
have hall := hmax.comp (hpair.comp (hchildren.comp hblock))
|
| 188 |
+
convert hall using 1
|
| 189 |
+
funext w
|
| 190 |
+
exact scalarTreeEval_step c q l T w
|
| 191 |
+
|
| 192 |
+
lemma scalarTreeLaw_integrable (c : ℝ → TreeLevel → ℝ) (q : ℝ) (T : GaussianTree) :
|
| 193 |
+
Integrable (fun x : ℝ ↦ x) (scalarTreeLaw c q T) := by
|
| 194 |
+
induction T generalizing q with
|
| 195 |
+
| nil =>
|
| 196 |
+
change Integrable (fun x : ℝ ↦ x) (Measure.dirac (0 : ℝ))
|
| 197 |
+
exact integrable_dirac (by simp)
|
| 198 |
+
| cons l T ih => exact branchLaw_integrable (gaussianAddLaw_integrable _ (ih l.endpoint)) _ _
|
| 199 |
+
|
| 200 |
+
end SKValueG
|
| 201 |
+
|
| 202 |
+
end
|
| 203 |
+
|
| 204 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/TreeWidths.lean
CHANGED
|
@@ -1,119 +1,119 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.BranchMeanUpper
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValueG
|
| 11 |
-
|
| 12 |
-
noncomputable def auxAmplitude (n : ℕ) (q : ℝ) (l : TreeLevel) : ℝ :=
|
| 13 |
-
Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)
|
| 14 |
-
|
| 15 |
-
noncomputable def auxShape (n : ℕ) (q : ℝ) : GaussianTree → CascadeShape
|
| 16 |
-
| [] => []
|
| 17 |
-
| l::T => (auxAmplitude n q l,l.height)::auxShape n l.endpoint T
|
| 18 |
-
|
| 19 |
-
noncomputable def resizeTree (n : ℕ) (q : ℝ) : (T : GaussianTree) → CascadeWidths (auxShape n q T) → GaussianTree
|
| 20 |
-
| [],_ => []
|
| 21 |
-
| l::T,w => {l with branchExcess := w.1}::resizeTree n l.endpoint T w.2
|
| 22 |
-
|
| 23 |
-
lemma resizeTree_valid (n : ℕ) {q : ℝ} {T : GaussianTree} (h : ValidTreeGrid q T)
|
| 24 |
-
(w : CascadeWidths (auxShape n q T)) : ValidTreeGrid q (resizeTree n q T w) := by
|
| 25 |
-
induction T generalizing q with
|
| 26 |
-
| nil => exact h
|
| 27 |
-
| cons l T ih => exact ⟨h.1,ih h.2 w.2⟩
|
| 28 |
-
|
| 29 |
-
lemma resizeTree_scale (n : ℕ) (q : ℝ) {a : ℝ} {T : GaussianTree} (h : TreeScale a T)
|
| 30 |
-
(w : CascadeWidths (auxShape n q T)) : TreeScale a (resizeTree n q T w) := by
|
| 31 |
-
induction T generalizing a q with
|
| 32 |
-
| nil => exact h
|
| 33 |
-
| cons l T ih => exact ⟨h.1,h.2.1,ih _ h.2.2 w.2⟩
|
| 34 |
-
|
| 35 |
-
lemma auxShape_scale (n : ℕ) (q : ℝ) {a : ℝ} {T : GaussianTree} (h : TreeScale a T) :
|
| 36 |
-
CascadeScale a (auxShape n q T) := by
|
| 37 |
-
induction T generalizing a q with
|
| 38 |
-
| nil => exact h
|
| 39 |
-
| cons l T ih => exact ⟨h.1,h.2.1,ih _ h.2.2⟩
|
| 40 |
-
|
| 41 |
-
lemma resizeTree_profile (n : ℕ) (q : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 42 |
-
fieldProfile q (resizeTree n q T w)=fieldProfile q T := by
|
| 43 |
-
induction T generalizing q with
|
| 44 |
-
| nil => rfl
|
| 45 |
-
| cons l T ih => simp only [resizeTree,fieldProfile,ih]
|
| 46 |
-
|
| 47 |
-
lemma resizeTree_gumbelMoment (n : ℕ) (q a : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 48 |
-
gumbelTreeMoment a (resizeTree n q T w)=gumbelTreeMoment a T := by
|
| 49 |
-
induction T generalizing q a with
|
| 50 |
-
| nil => rfl
|
| 51 |
-
| cons l T ih => simp only [resizeTree,gumbelTreeMoment,ih]
|
| 52 |
-
|
| 53 |
-
lemma resizeTree_gumbelMean (n : ℕ) (q : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 54 |
-
gumbelTreeMean (resizeTree n q T w)=gumbelTreeMean T := by
|
| 55 |
-
cases T with
|
| 56 |
-
| nil => rfl
|
| 57 |
-
| cons l T => simp only [resizeTree,gumbelTreeMean,resizeTree_gumbelMoment]
|
| 58 |
-
|
| 59 |
-
lemma resizeTree_scalarLaw (n : ℕ) (q : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 60 |
-
scalarTreeLaw (auxAmplitude n) q (resizeTree n q T w)=cascadeLaw (auxShape n q T) w := by
|
| 61 |
-
induction T generalizing q with
|
| 62 |
-
| nil => rfl
|
| 63 |
-
| cons l T ih => simp only [resizeTree,scalarTreeLaw,auxShape,cascadeLaw,ih,auxAmplitude]
|
| 64 |
-
|
| 65 |
-
noncomputable def treeCorrection (q : ℝ) : GaussianTree → ℝ
|
| 66 |
-
| [] => 0
|
| 67 |
-
| l::T => l.height*(l.endpoint^2-q^2)/4+treeCorrection l.endpoint T
|
| 68 |
-
|
| 69 |
-
lemma auxAmplitude_sq (n : ℕ) {q : ℝ} {l : TreeLevel} (hq : 0 ≤ q) (hql : q ≤ l.endpoint) :
|
| 70 |
-
(auxAmplitude n q l)^2=(n : ℝ)/2*(l.endpoint^2-q^2) := by
|
| 71 |
-
have hl := hq.trans hql
|
| 72 |
-
have hs : 0 ≤ l.endpoint^2-q^2 := by nlinarith
|
| 73 |
-
rw [auxAmplitude,mul_pow,Real.sq_sqrt (by positivity),Real.sq_sqrt hs]
|
| 74 |
-
|
| 75 |
-
lemma auxShape_moment (n : ℕ) {q a : ℝ} {T : GaussianTree} (hq : 0 ≤ q)
|
| 76 |
-
(hgrid : ValidTreeGrid q T) (h : TreeScale a T) :
|
| 77 |
-
cascadeMoment a (auxShape n q T)=gumbelTreeMoment a T*Real.exp (a*(n : ℝ)*treeCorrection q T) := by
|
| 78 |
-
induction T generalizing q a with
|
| 79 |
-
| nil => simp [auxShape,cascadeMoment,gumbelTreeMoment,treeCorrection]
|
| 80 |
-
| cons l T ih =>
|
| 81 |
-
obtain ⟨ha,ham,hT⟩ := h
|
| 82 |
-
have hm : 0 < l.height := ha.trans_lt ham
|
| 83 |
-
have hs := auxAmplitude_sq n hq hgrid.1
|
| 84 |
-
rw [auxShape,cascadeMoment,ih (hq.trans hgrid.1) hgrid.2 hT]
|
| 85 |
-
rw [mul_pow,hs]
|
| 86 |
-
have he : Real.exp (l.height^2*((n : ℝ)/2*(l.endpoint^2-q^2))/2)*
|
| 87 |
-
(gumbelTreeMoment l.height T*Real.exp (l.height*(n : ℝ)*treeCorrection l.endpoint T))=
|
| 88 |
-
gumbelTreeMoment l.height T*Real.exp (l.height*(n : ℝ)*treeCorrection q (l::T)) := by
|
| 89 |
-
rw [mul_left_comm,←Real.exp_add]
|
| 90 |
-
congr 2
|
| 91 |
-
simp only [treeCorrection]
|
| 92 |
-
ring
|
| 93 |
-
rw [he,Real.mul_rpow (gumbelTreeMoment_pos hT).le (Real.exp_pos _).le,←Real.exp_mul]
|
| 94 |
-
have he2 : l.height*(n : ℝ)*treeCorrection q (l::T)*(a/l.height)=a*(n : ℝ)*treeCorrection q (l::T) := by
|
| 95 |
-
field_simp
|
| 96 |
-
rw [he2]
|
| 97 |
-
simp only [gumbelTreeMoment,mul_assoc]
|
| 98 |
-
|
| 99 |
-
lemma auxShape_mean (n : ℕ) {q : ℝ} {T : GaussianTree} (hq : 0 ≤ q)
|
| 100 |
-
(hgrid : ValidTreeGrid q T) (h : TreeScale 0 T) :
|
| 101 |
-
cascadeMean (auxShape n q T)=gumbelTreeMean T+(n : ℝ)*treeCorrection q T := by
|
| 102 |
-
cases T with
|
| 103 |
-
| nil => simp [auxShape,cascadeMean,gumbelTreeMean,treeCorrection]
|
| 104 |
-
| cons l T =>
|
| 105 |
-
obtain ⟨_,hm,hT⟩ := h
|
| 106 |
-
have hs := auxAmplitude_sq n hq hgrid.1
|
| 107 |
-
rw [auxShape,cascadeMean,auxShape_moment n (hq.trans hgrid.1) hgrid.2 hT]
|
| 108 |
-
rw [Real.log_mul (Real.exp_pos _).ne' (mul_pos (gumbelTreeMoment_pos hT) (Real.exp_pos _)).ne',
|
| 109 |
-
Real.log_exp,Real.log_mul (gumbelTreeMoment_pos hT).ne' (Real.exp_pos _).ne',Real.log_exp]
|
| 110 |
-
rw [mul_pow,hs]
|
| 111 |
-
simp only [gumbelTreeMean,treeCorrection]
|
| 112 |
-
field_simp
|
| 113 |
-
ring
|
| 114 |
-
|
| 115 |
-
end SKValueG
|
| 116 |
-
|
| 117 |
-
end
|
| 118 |
-
|
| 119 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.BranchMeanUpper
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValueG
|
| 11 |
+
|
| 12 |
+
noncomputable def auxAmplitude (n : ℕ) (q : ℝ) (l : TreeLevel) : ℝ :=
|
| 13 |
+
Real.sqrt ((n : ℝ)/2)*Real.sqrt (l.endpoint^2-q^2)
|
| 14 |
+
|
| 15 |
+
noncomputable def auxShape (n : ℕ) (q : ℝ) : GaussianTree → CascadeShape
|
| 16 |
+
| [] => []
|
| 17 |
+
| l::T => (auxAmplitude n q l,l.height)::auxShape n l.endpoint T
|
| 18 |
+
|
| 19 |
+
noncomputable def resizeTree (n : ℕ) (q : ℝ) : (T : GaussianTree) → CascadeWidths (auxShape n q T) → GaussianTree
|
| 20 |
+
| [],_ => []
|
| 21 |
+
| l::T,w => {l with branchExcess := w.1}::resizeTree n l.endpoint T w.2
|
| 22 |
+
|
| 23 |
+
lemma resizeTree_valid (n : ℕ) {q : ℝ} {T : GaussianTree} (h : ValidTreeGrid q T)
|
| 24 |
+
(w : CascadeWidths (auxShape n q T)) : ValidTreeGrid q (resizeTree n q T w) := by
|
| 25 |
+
induction T generalizing q with
|
| 26 |
+
| nil => exact h
|
| 27 |
+
| cons l T ih => exact ⟨h.1,ih h.2 w.2⟩
|
| 28 |
+
|
| 29 |
+
lemma resizeTree_scale (n : ℕ) (q : ℝ) {a : ℝ} {T : GaussianTree} (h : TreeScale a T)
|
| 30 |
+
(w : CascadeWidths (auxShape n q T)) : TreeScale a (resizeTree n q T w) := by
|
| 31 |
+
induction T generalizing a q with
|
| 32 |
+
| nil => exact h
|
| 33 |
+
| cons l T ih => exact ⟨h.1,h.2.1,ih _ h.2.2 w.2⟩
|
| 34 |
+
|
| 35 |
+
lemma auxShape_scale (n : ℕ) (q : ℝ) {a : ℝ} {T : GaussianTree} (h : TreeScale a T) :
|
| 36 |
+
CascadeScale a (auxShape n q T) := by
|
| 37 |
+
induction T generalizing a q with
|
| 38 |
+
| nil => exact h
|
| 39 |
+
| cons l T ih => exact ⟨h.1,h.2.1,ih _ h.2.2⟩
|
| 40 |
+
|
| 41 |
+
lemma resizeTree_profile (n : ℕ) (q : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 42 |
+
fieldProfile q (resizeTree n q T w)=fieldProfile q T := by
|
| 43 |
+
induction T generalizing q with
|
| 44 |
+
| nil => rfl
|
| 45 |
+
| cons l T ih => simp only [resizeTree,fieldProfile,ih]
|
| 46 |
+
|
| 47 |
+
lemma resizeTree_gumbelMoment (n : ℕ) (q a : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 48 |
+
gumbelTreeMoment a (resizeTree n q T w)=gumbelTreeMoment a T := by
|
| 49 |
+
induction T generalizing q a with
|
| 50 |
+
| nil => rfl
|
| 51 |
+
| cons l T ih => simp only [resizeTree,gumbelTreeMoment,ih]
|
| 52 |
+
|
| 53 |
+
lemma resizeTree_gumbelMean (n : ℕ) (q : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 54 |
+
gumbelTreeMean (resizeTree n q T w)=gumbelTreeMean T := by
|
| 55 |
+
cases T with
|
| 56 |
+
| nil => rfl
|
| 57 |
+
| cons l T => simp only [resizeTree,gumbelTreeMean,resizeTree_gumbelMoment]
|
| 58 |
+
|
| 59 |
+
lemma resizeTree_scalarLaw (n : ℕ) (q : ℝ) (T : GaussianTree) (w : CascadeWidths (auxShape n q T)) :
|
| 60 |
+
scalarTreeLaw (auxAmplitude n) q (resizeTree n q T w)=cascadeLaw (auxShape n q T) w := by
|
| 61 |
+
induction T generalizing q with
|
| 62 |
+
| nil => rfl
|
| 63 |
+
| cons l T ih => simp only [resizeTree,scalarTreeLaw,auxShape,cascadeLaw,ih,auxAmplitude]
|
| 64 |
+
|
| 65 |
+
noncomputable def treeCorrection (q : ℝ) : GaussianTree → ℝ
|
| 66 |
+
| [] => 0
|
| 67 |
+
| l::T => l.height*(l.endpoint^2-q^2)/4+treeCorrection l.endpoint T
|
| 68 |
+
|
| 69 |
+
lemma auxAmplitude_sq (n : ℕ) {q : ℝ} {l : TreeLevel} (hq : 0 ≤ q) (hql : q ≤ l.endpoint) :
|
| 70 |
+
(auxAmplitude n q l)^2=(n : ℝ)/2*(l.endpoint^2-q^2) := by
|
| 71 |
+
have hl := hq.trans hql
|
| 72 |
+
have hs : 0 ≤ l.endpoint^2-q^2 := by nlinarith
|
| 73 |
+
rw [auxAmplitude,mul_pow,Real.sq_sqrt (by positivity),Real.sq_sqrt hs]
|
| 74 |
+
|
| 75 |
+
lemma auxShape_moment (n : ℕ) {q a : ℝ} {T : GaussianTree} (hq : 0 ≤ q)
|
| 76 |
+
(hgrid : ValidTreeGrid q T) (h : TreeScale a T) :
|
| 77 |
+
cascadeMoment a (auxShape n q T)=gumbelTreeMoment a T*Real.exp (a*(n : ℝ)*treeCorrection q T) := by
|
| 78 |
+
induction T generalizing q a with
|
| 79 |
+
| nil => simp [auxShape,cascadeMoment,gumbelTreeMoment,treeCorrection]
|
| 80 |
+
| cons l T ih =>
|
| 81 |
+
obtain ⟨ha,ham,hT⟩ := h
|
| 82 |
+
have hm : 0 < l.height := ha.trans_lt ham
|
| 83 |
+
have hs := auxAmplitude_sq n hq hgrid.1
|
| 84 |
+
rw [auxShape,cascadeMoment,ih (hq.trans hgrid.1) hgrid.2 hT]
|
| 85 |
+
rw [mul_pow,hs]
|
| 86 |
+
have he : Real.exp (l.height^2*((n : ℝ)/2*(l.endpoint^2-q^2))/2)*
|
| 87 |
+
(gumbelTreeMoment l.height T*Real.exp (l.height*(n : ℝ)*treeCorrection l.endpoint T))=
|
| 88 |
+
gumbelTreeMoment l.height T*Real.exp (l.height*(n : ℝ)*treeCorrection q (l::T)) := by
|
| 89 |
+
rw [mul_left_comm,←Real.exp_add]
|
| 90 |
+
congr 2
|
| 91 |
+
simp only [treeCorrection]
|
| 92 |
+
ring
|
| 93 |
+
rw [he,Real.mul_rpow (gumbelTreeMoment_pos hT).le (Real.exp_pos _).le,←Real.exp_mul]
|
| 94 |
+
have he2 : l.height*(n : ℝ)*treeCorrection q (l::T)*(a/l.height)=a*(n : ℝ)*treeCorrection q (l::T) := by
|
| 95 |
+
field_simp
|
| 96 |
+
rw [he2]
|
| 97 |
+
simp only [gumbelTreeMoment,mul_assoc]
|
| 98 |
+
|
| 99 |
+
lemma auxShape_mean (n : ℕ) {q : ℝ} {T : GaussianTree} (hq : 0 ≤ q)
|
| 100 |
+
(hgrid : ValidTreeGrid q T) (h : TreeScale 0 T) :
|
| 101 |
+
cascadeMean (auxShape n q T)=gumbelTreeMean T+(n : ℝ)*treeCorrection q T := by
|
| 102 |
+
cases T with
|
| 103 |
+
| nil => simp [auxShape,cascadeMean,gumbelTreeMean,treeCorrection]
|
| 104 |
+
| cons l T =>
|
| 105 |
+
obtain ⟨_,hm,hT⟩ := h
|
| 106 |
+
have hs := auxAmplitude_sq n hq hgrid.1
|
| 107 |
+
rw [auxShape,cascadeMean,auxShape_moment n (hq.trans hgrid.1) hgrid.2 hT]
|
| 108 |
+
rw [Real.log_mul (Real.exp_pos _).ne' (mul_pos (gumbelTreeMoment_pos hT) (Real.exp_pos _)).ne',
|
| 109 |
+
Real.log_exp,Real.log_mul (gumbelTreeMoment_pos hT).ne' (Real.exp_pos _).ne',Real.log_exp]
|
| 110 |
+
rw [mul_pow,hs]
|
| 111 |
+
simp only [gumbelTreeMean,treeCorrection]
|
| 112 |
+
field_simp
|
| 113 |
+
ring
|
| 114 |
+
|
| 115 |
+
end SKValueG
|
| 116 |
+
|
| 117 |
+
end
|
| 118 |
+
|
| 119 |
+
end OAI
|
lean/OAI/Probability/SKValue/GroundState/WeakGuerra.lean
CHANGED
|
@@ -1,147 +1,147 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.CascadePassage
|
| 3 |
-
import OAI.Probability.SKValue.Equations.StrictProfile
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
-
namespace SKValueG
|
| 12 |
-
|
| 13 |
-
lemma profile_penalty_mono (ε : ℝ≥0) (k : ℕ) {l : SKValue.HeatProfile}
|
| 14 |
-
(hT : SKValue.profileTime l=1) :
|
| 15 |
-
(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t) ≤
|
| 16 |
-
∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff (SKValue.liftProfile ε k l) t := by
|
| 17 |
-
have h1 := profile_weighted_integrable 0 l
|
| 18 |
-
have h2 := profile_weighted_integrable 0 (SKValue.liftProfile ε k l)
|
| 19 |
-
simp only [zero_add,SKValue.liftProfile_time,hT] at h1 h2
|
| 20 |
-
apply intervalIntegral.integral_mono_on (by norm_num) h1 h2
|
| 21 |
-
intro t ht
|
| 22 |
-
exact mul_le_mul_of_nonneg_left (SKValue.liftProfile_coeff_lower ε k l t) ht.1
|
| 23 |
-
|
| 24 |
-
lemma weak_profile_guerra_upper (W : SKValue.BrownianSpace) {n : ℕ} (hn : 0<n)
|
| 25 |
-
{ψ : ℝ → ℝ} (hψ : SKValue.SmoothTerminal ψ) (hb : ∀ x,|x|≤ψ x)
|
| 26 |
-
{l : SKValue.HeatProfile} (hl : l.Pairwise (fun p r ↦ p.2≤r.2)) (hT : SKValue.profileTime l=1) :
|
| 27 |
-
expectedMaximum n ≤ (n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 28 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)) := by
|
| 29 |
-
have he : ∀ ε : ℝ,0<ε → expectedMaximum n ≤ (n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 30 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)+(3/2 : ℝ)*ε*(1+l.length)) := by
|
| 31 |
-
intro ε hε
|
| 32 |
-
let e : ℝ≥0 := ⟨ε,hε.le⟩
|
| 33 |
-
have hepos : 0<e := hε
|
| 34 |
-
have hs := profileTree_scale (q := 0) (by norm_num : (0 : ℝ)≤0)
|
| 35 |
-
(SKValue.liftProfile_strict hepos 1 hl) (SKValue.liftProfile_positive hepos (by norm_num : 0<1) l)
|
| 36 |
-
have hg := profileTree_valid (q := 0) (l := SKValue.liftProfile e 1 l)
|
| 37 |
-
(by rw [zero_add,SKValue.liftProfile_time,hT])
|
| 38 |
-
have hu := finite_step_guerra_upper hn _ hg hs
|
| 39 |
-
have hv := profileTree_le_smooth hψ hb hs 0
|
| 40 |
-
have hvb := abs_le.mp (hψ.liftProfile_bound W hl hT hepos 1 0)
|
| 41 |
-
have hc := profile_penalty_mono e 1 hT
|
| 42 |
-
rw [profileTree_correction] at hu
|
| 43 |
-
simp only [SKValue.liftProfile_time,hT,zero_add] at hu
|
| 44 |
-
have hnn : (0 : ℝ)≤n := by positivity
|
| 45 |
-
have hvb' : SKValue.profileValue ψ (SKValue.liftProfile e 1 l) 0 0-SKValue.profileValue ψ l 0 0 ≤
|
| 46 |
-
(3/2 : ℝ)*ε*(1+l.length) := by
|
| 47 |
-
have h := hvb.2
|
| 48 |
-
have hcoe : (e : ℝ)=ε := rfl
|
| 49 |
-
rw [Nat.cast_one,hcoe] at h
|
| 50 |
-
exact h
|
| 51 |
-
apply hu.trans
|
| 52 |
-
apply mul_le_mul_of_nonneg_left _ hnn
|
| 53 |
-
linarith
|
| 54 |
-
have hh : Tendsto (fun j : ℕ ↦ (n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 55 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)+
|
| 56 |
-
(3/2 : ℝ)*(1/(j+1 : ℝ))*(1+l.length))) atTop
|
| 57 |
-
(𝓝 ((n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 58 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)))) := by
|
| 59 |
-
have hr : Tendsto (fun j : ℕ ↦ (3/2 : ℝ)*(1/(j+1 : ℝ))*(1+l.length)) atTop (𝓝 0) := by
|
| 60 |
-
simpa only [mul_zero,zero_mul] using
|
| 61 |
-
(tendsto_one_div_add_atTop_nhds_zero_nat.const_mul (3/2 : ℝ)).mul_const (1+(l.length : ℝ))
|
| 62 |
-
simpa only [add_zero] using (hr.const_add (SKValue.profileValue ψ l 0 0-
|
| 63 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t))).const_mul (n : ℝ)
|
| 64 |
-
exact ge_of_tendsto hh (Eventually.of_forall (fun (j : ℕ) ↦ he (1/(j+1 : ℝ)) (one_div_pos.mpr (by exact_mod_cast Nat.succ_pos j))))
|
| 65 |
-
|
| 66 |
-
end SKValueG
|
| 67 |
-
|
| 68 |
-
end
|
| 69 |
-
|
| 70 |
-
section
|
| 71 |
-
|
| 72 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 73 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 74 |
-
namespace SKValue
|
| 75 |
-
|
| 76 |
-
lemma logCoshTerminal_ge_abs {M : ℝ} (hM : 0<M) (x : ℝ) :
|
| 77 |
-
|x|≤logCoshTerminal M x := by
|
| 78 |
-
have hh := (log_two_cosh_bounds (M*x)).1
|
| 79 |
-
rw [abs_mul,abs_of_pos hM] at hh
|
| 80 |
-
exact (le_div_iff₀ hM).mpr (by simpa only [mul_comm] using hh)
|
| 81 |
-
|
| 82 |
-
lemma OrderParameter.weighted_cutoff_integral (γ : OrderParameter) :
|
| 83 |
-
(∫ t in (0 : ℝ)..1,t*γ.cutoff t)=∫ t in (0 : ℝ)..1,t*γ.coeff t := by
|
| 84 |
-
apply intervalIntegral.integral_congr_ae
|
| 85 |
-
filter_upwards [Measure.ae_ne volume (1 : ℝ)] with t hne ht
|
| 86 |
-
rw [uIoc_of_le (by norm_num : (0 : ℝ)≤1)] at ht
|
| 87 |
-
have ht' : t∈Ico (0 : ℝ) 1 := ⟨ht.1.le,lt_of_le_of_ne ht.2 hne⟩
|
| 88 |
-
simp only [OrderParameter.cutoff,indicator_of_mem ht']
|
| 89 |
-
|
| 90 |
-
lemma OrderParameter.weighted_grid_error (γ : OrderParameter) (j : ℕ) :
|
| 91 |
-
|(∫ t in (0 : ℝ)..1,t*profileCoeff (γ.grid j) t)-(∫ t in (0 : ℝ)..1,t*γ.cutoff t)|≤γ.gridError j := by
|
| 92 |
-
have hi : IntervalIntegrable (profileCoeff (γ.grid j)) volume 0 1 :=
|
| 93 |
-
γ.grid_time j ▸ profileCoeff_integrable (γ.grid j)
|
| 94 |
-
have hj : IntervalIntegrable γ.cutoff volume 0 1 := γ.cutoff_integrable.intervalIntegrable
|
| 95 |
-
have hiw := hi.continuousOn_mul (continuous_id : Continuous (fun t : ℝ ↦ t)).continuousOn
|
| 96 |
-
have hjw := hj.continuousOn_mul (continuous_id : Continuous (fun t : ℝ ↦ t)).continuousOn
|
| 97 |
-
simp only [id_eq] at hiw hjw
|
| 98 |
-
rw [←intervalIntegral.integral_sub hiw hjw]
|
| 99 |
-
calc
|
| 100 |
-
_ ≤ ∫ t in (0 : ℝ)..1,|t*profileCoeff (γ.grid j) t-t*γ.cutoff t| :=
|
| 101 |
-
intervalIntegral.abs_integral_le_integral_abs (by norm_num)
|
| 102 |
-
_ ≤ ∫ t in (0 : ℝ)..1,|profileCoeff (γ.grid j) t-γ.cutoff t| := by
|
| 103 |
-
apply intervalIntegral.integral_mono_on (by norm_num) (hiw.sub hjw).abs (hi.sub hj).abs
|
| 104 |
-
intro t ht
|
| 105 |
-
rw [←mul_sub,abs_mul,abs_of_nonneg ht.1]
|
| 106 |
-
exact mul_le_of_le_one_left (abs_nonneg _) ht.2
|
| 107 |
-
_ = γ.gridError j := rfl
|
| 108 |
-
|
| 109 |
-
lemma OrderParameter.weighted_grid_tendsto (γ : OrderParameter) :
|
| 110 |
-
Tendsto (fun j ↦ ∫ t in (0 : ℝ)..1,t*profileCoeff (γ.grid j) t) atTop
|
| 111 |
-
(𝓝 (∫ t in (0 : ℝ)..1,t*γ.coeff t)) := by
|
| 112 |
-
rw [←γ.weighted_cutoff_integral]
|
| 113 |
-
apply (tendsto_iff_dist_tendsto_zero).mpr
|
| 114 |
-
simp only [Real.dist_eq]
|
| 115 |
-
exact squeeze_zero (fun _ ↦ abs_nonneg _) γ.weighted_grid_error γ.gridError_tendsto
|
| 116 |
-
|
| 117 |
-
theorem expectedMaximum_le_parisi (W : BrownianSpace) (γ : OrderParameter) {n : ℕ} (hn : 0<n) :
|
| 118 |
-
SKValueG.expectedMaximum n≤(n : ℝ)*parisi W γ := by
|
| 119 |
-
have ht := (smoothApprox_tendsto W γ).tendsto_at ((⟨0,by norm_num⟩ : Ico (0 : ℝ) 1),0)
|
| 120 |
-
have hp := γ.weighted_grid_tendsto
|
| 121 |
-
have hf : Tendsto (fun j ↦ (n : ℝ)*(smoothApprox γ j 0 0-
|
| 122 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*profileCoeff (γ.grid j) t))) atTop (𝓝 ((n : ℝ)*parisi W γ)) := by
|
| 123 |
-
simpa only [parisi] using tendsto_const_nhds.mul (ht.sub (tendsto_const_nhds.mul hp))
|
| 124 |
-
apply ge_of_tendsto hf
|
| 125 |
-
exact Eventually.of_forall (fun j ↦ SKValueG.weak_profile_guerra_upper W hn
|
| 126 |
-
(logCoshTerminal_smoothTerminal (by positivity : (0 : ℝ)<j+1))
|
| 127 |
-
(logCoshTerminal_ge_abs (by positivity)) (γ.grid_mono j) (γ.grid_time j))
|
| 128 |
-
|
| 129 |
-
theorem groundStateValue_le_parisi (W : BrownianSpace) (γ : OrderParameter) :
|
| 130 |
-
groundStateValue≤parisi W γ := by
|
| 131 |
-
have he : SKValueG.groundStateSequence=groundStateSequence := rfl
|
| 132 |
-
have hev : SKValueG.groundStateValue=groundStateValue := rfl
|
| 133 |
-
have ht := SKValueG.groundStateSequence_tendsto
|
| 134 |
-
rw [he,hev] at ht
|
| 135 |
-
apply le_of_tendsto ht
|
| 136 |
-
filter_upwards [eventually_gt_atTop (0 : ℕ)] with n hn
|
| 137 |
-
change SKValueG.groundStateSequence n≤_
|
| 138 |
-
rw [SKValueG.groundStateSequence_eq]
|
| 139 |
-
have hn' : (0 : ℝ)<n := by exact_mod_cast hn
|
| 140 |
-
have hh := mul_le_mul_of_nonneg_left (expectedMaximum_le_parisi W γ hn) (inv_nonneg.mpr hn'.le)
|
| 141 |
-
simpa only [←mul_assoc,inv_mul_cancel₀ hn'.ne',one_mul] using hh
|
| 142 |
-
|
| 143 |
-
end SKValue
|
| 144 |
-
|
| 145 |
-
end
|
| 146 |
-
|
| 147 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.CascadePassage
|
| 3 |
+
import OAI.Probability.SKValue.Equations.StrictProfile
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
+
namespace SKValueG
|
| 12 |
+
|
| 13 |
+
lemma profile_penalty_mono (ε : ℝ≥0) (k : ℕ) {l : SKValue.HeatProfile}
|
| 14 |
+
(hT : SKValue.profileTime l=1) :
|
| 15 |
+
(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t) ≤
|
| 16 |
+
∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff (SKValue.liftProfile ε k l) t := by
|
| 17 |
+
have h1 := profile_weighted_integrable 0 l
|
| 18 |
+
have h2 := profile_weighted_integrable 0 (SKValue.liftProfile ε k l)
|
| 19 |
+
simp only [zero_add,SKValue.liftProfile_time,hT] at h1 h2
|
| 20 |
+
apply intervalIntegral.integral_mono_on (by norm_num) h1 h2
|
| 21 |
+
intro t ht
|
| 22 |
+
exact mul_le_mul_of_nonneg_left (SKValue.liftProfile_coeff_lower ε k l t) ht.1
|
| 23 |
+
|
| 24 |
+
lemma weak_profile_guerra_upper (W : SKValue.BrownianSpace) {n : ℕ} (hn : 0<n)
|
| 25 |
+
{ψ : ℝ → ℝ} (hψ : SKValue.SmoothTerminal ψ) (hb : ∀ x,|x|≤ψ x)
|
| 26 |
+
{l : SKValue.HeatProfile} (hl : l.Pairwise (fun p r ↦ p.2≤r.2)) (hT : SKValue.profileTime l=1) :
|
| 27 |
+
expectedMaximum n ≤ (n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 28 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)) := by
|
| 29 |
+
have he : ∀ ε : ℝ,0<ε → expectedMaximum n ≤ (n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 30 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)+(3/2 : ℝ)*ε*(1+l.length)) := by
|
| 31 |
+
intro ε hε
|
| 32 |
+
let e : ℝ≥0 := ⟨ε,hε.le⟩
|
| 33 |
+
have hepos : 0<e := hε
|
| 34 |
+
have hs := profileTree_scale (q := 0) (by norm_num : (0 : ℝ)≤0)
|
| 35 |
+
(SKValue.liftProfile_strict hepos 1 hl) (SKValue.liftProfile_positive hepos (by norm_num : 0<1) l)
|
| 36 |
+
have hg := profileTree_valid (q := 0) (l := SKValue.liftProfile e 1 l)
|
| 37 |
+
(by rw [zero_add,SKValue.liftProfile_time,hT])
|
| 38 |
+
have hu := finite_step_guerra_upper hn _ hg hs
|
| 39 |
+
have hv := profileTree_le_smooth hψ hb hs 0
|
| 40 |
+
have hvb := abs_le.mp (hψ.liftProfile_bound W hl hT hepos 1 0)
|
| 41 |
+
have hc := profile_penalty_mono e 1 hT
|
| 42 |
+
rw [profileTree_correction] at hu
|
| 43 |
+
simp only [SKValue.liftProfile_time,hT,zero_add] at hu
|
| 44 |
+
have hnn : (0 : ℝ)≤n := by positivity
|
| 45 |
+
have hvb' : SKValue.profileValue ψ (SKValue.liftProfile e 1 l) 0 0-SKValue.profileValue ψ l 0 0 ≤
|
| 46 |
+
(3/2 : ℝ)*ε*(1+l.length) := by
|
| 47 |
+
have h := hvb.2
|
| 48 |
+
have hcoe : (e : ℝ)=ε := rfl
|
| 49 |
+
rw [Nat.cast_one,hcoe] at h
|
| 50 |
+
exact h
|
| 51 |
+
apply hu.trans
|
| 52 |
+
apply mul_le_mul_of_nonneg_left _ hnn
|
| 53 |
+
linarith
|
| 54 |
+
have hh : Tendsto (fun j : ℕ ↦ (n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 55 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)+
|
| 56 |
+
(3/2 : ℝ)*(1/(j+1 : ℝ))*(1+l.length))) atTop
|
| 57 |
+
(𝓝 ((n : ℝ)*(SKValue.profileValue ψ l 0 0-
|
| 58 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t)))) := by
|
| 59 |
+
have hr : Tendsto (fun j : ℕ ↦ (3/2 : ℝ)*(1/(j+1 : ℝ))*(1+l.length)) atTop (𝓝 0) := by
|
| 60 |
+
simpa only [mul_zero,zero_mul] using
|
| 61 |
+
(tendsto_one_div_add_atTop_nhds_zero_nat.const_mul (3/2 : ℝ)).mul_const (1+(l.length : ℝ))
|
| 62 |
+
simpa only [add_zero] using (hr.const_add (SKValue.profileValue ψ l 0 0-
|
| 63 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*SKValue.profileCoeff l t))).const_mul (n : ℝ)
|
| 64 |
+
exact ge_of_tendsto hh (Eventually.of_forall (fun (j : ℕ) ↦ he (1/(j+1 : ℝ)) (one_div_pos.mpr (by exact_mod_cast Nat.succ_pos j))))
|
| 65 |
+
|
| 66 |
+
end SKValueG
|
| 67 |
+
|
| 68 |
+
end
|
| 69 |
+
|
| 70 |
+
section
|
| 71 |
+
|
| 72 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 73 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 74 |
+
namespace SKValue
|
| 75 |
+
|
| 76 |
+
lemma logCoshTerminal_ge_abs {M : ℝ} (hM : 0<M) (x : ℝ) :
|
| 77 |
+
|x|≤logCoshTerminal M x := by
|
| 78 |
+
have hh := (log_two_cosh_bounds (M*x)).1
|
| 79 |
+
rw [abs_mul,abs_of_pos hM] at hh
|
| 80 |
+
exact (le_div_iff₀ hM).mpr (by simpa only [mul_comm] using hh)
|
| 81 |
+
|
| 82 |
+
lemma OrderParameter.weighted_cutoff_integral (γ : OrderParameter) :
|
| 83 |
+
(∫ t in (0 : ℝ)..1,t*γ.cutoff t)=∫ t in (0 : ℝ)..1,t*γ.coeff t := by
|
| 84 |
+
apply intervalIntegral.integral_congr_ae
|
| 85 |
+
filter_upwards [Measure.ae_ne volume (1 : ℝ)] with t hne ht
|
| 86 |
+
rw [uIoc_of_le (by norm_num : (0 : ℝ)≤1)] at ht
|
| 87 |
+
have ht' : t∈Ico (0 : ℝ) 1 := ⟨ht.1.le,lt_of_le_of_ne ht.2 hne⟩
|
| 88 |
+
simp only [OrderParameter.cutoff,indicator_of_mem ht']
|
| 89 |
+
|
| 90 |
+
lemma OrderParameter.weighted_grid_error (γ : OrderParameter) (j : ℕ) :
|
| 91 |
+
|(∫ t in (0 : ℝ)..1,t*profileCoeff (γ.grid j) t)-(∫ t in (0 : ℝ)..1,t*γ.cutoff t)|≤γ.gridError j := by
|
| 92 |
+
have hi : IntervalIntegrable (profileCoeff (γ.grid j)) volume 0 1 :=
|
| 93 |
+
γ.grid_time j ▸ profileCoeff_integrable (γ.grid j)
|
| 94 |
+
have hj : IntervalIntegrable γ.cutoff volume 0 1 := γ.cutoff_integrable.intervalIntegrable
|
| 95 |
+
have hiw := hi.continuousOn_mul (continuous_id : Continuous (fun t : ℝ ↦ t)).continuousOn
|
| 96 |
+
have hjw := hj.continuousOn_mul (continuous_id : Continuous (fun t : ℝ ↦ t)).continuousOn
|
| 97 |
+
simp only [id_eq] at hiw hjw
|
| 98 |
+
rw [←intervalIntegral.integral_sub hiw hjw]
|
| 99 |
+
calc
|
| 100 |
+
_ ≤ ∫ t in (0 : ℝ)..1,|t*profileCoeff (γ.grid j) t-t*γ.cutoff t| :=
|
| 101 |
+
intervalIntegral.abs_integral_le_integral_abs (by norm_num)
|
| 102 |
+
_ ≤ ∫ t in (0 : ℝ)..1,|profileCoeff (γ.grid j) t-γ.cutoff t| := by
|
| 103 |
+
apply intervalIntegral.integral_mono_on (by norm_num) (hiw.sub hjw).abs (hi.sub hj).abs
|
| 104 |
+
intro t ht
|
| 105 |
+
rw [←mul_sub,abs_mul,abs_of_nonneg ht.1]
|
| 106 |
+
exact mul_le_of_le_one_left (abs_nonneg _) ht.2
|
| 107 |
+
_ = γ.gridError j := rfl
|
| 108 |
+
|
| 109 |
+
lemma OrderParameter.weighted_grid_tendsto (γ : OrderParameter) :
|
| 110 |
+
Tendsto (fun j ↦ ∫ t in (0 : ℝ)..1,t*profileCoeff (γ.grid j) t) atTop
|
| 111 |
+
(𝓝 (∫ t in (0 : ℝ)..1,t*γ.coeff t)) := by
|
| 112 |
+
rw [←γ.weighted_cutoff_integral]
|
| 113 |
+
apply (tendsto_iff_dist_tendsto_zero).mpr
|
| 114 |
+
simp only [Real.dist_eq]
|
| 115 |
+
exact squeeze_zero (fun _ ↦ abs_nonneg _) γ.weighted_grid_error γ.gridError_tendsto
|
| 116 |
+
|
| 117 |
+
theorem expectedMaximum_le_parisi (W : BrownianSpace) (γ : OrderParameter) {n : ℕ} (hn : 0<n) :
|
| 118 |
+
SKValueG.expectedMaximum n≤(n : ℝ)*parisi W γ := by
|
| 119 |
+
have ht := (smoothApprox_tendsto W γ).tendsto_at ((⟨0,by norm_num⟩ : Ico (0 : ℝ) 1),0)
|
| 120 |
+
have hp := γ.weighted_grid_tendsto
|
| 121 |
+
have hf : Tendsto (fun j ↦ (n : ℝ)*(smoothApprox γ j 0 0-
|
| 122 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..1,t*profileCoeff (γ.grid j) t))) atTop (𝓝 ((n : ℝ)*parisi W γ)) := by
|
| 123 |
+
simpa only [parisi] using tendsto_const_nhds.mul (ht.sub (tendsto_const_nhds.mul hp))
|
| 124 |
+
apply ge_of_tendsto hf
|
| 125 |
+
exact Eventually.of_forall (fun j ↦ SKValueG.weak_profile_guerra_upper W hn
|
| 126 |
+
(logCoshTerminal_smoothTerminal (by positivity : (0 : ℝ)<j+1))
|
| 127 |
+
(logCoshTerminal_ge_abs (by positivity)) (γ.grid_mono j) (γ.grid_time j))
|
| 128 |
+
|
| 129 |
+
theorem groundStateValue_le_parisi (W : BrownianSpace) (γ : OrderParameter) :
|
| 130 |
+
groundStateValue≤parisi W γ := by
|
| 131 |
+
have he : SKValueG.groundStateSequence=groundStateSequence := rfl
|
| 132 |
+
have hev : SKValueG.groundStateValue=groundStateValue := rfl
|
| 133 |
+
have ht := SKValueG.groundStateSequence_tendsto
|
| 134 |
+
rw [he,hev] at ht
|
| 135 |
+
apply le_of_tendsto ht
|
| 136 |
+
filter_upwards [eventually_gt_atTop (0 : ℕ)] with n hn
|
| 137 |
+
change SKValueG.groundStateSequence n≤_
|
| 138 |
+
rw [SKValueG.groundStateSequence_eq]
|
| 139 |
+
have hn' : (0 : ℝ)<n := by exact_mod_cast hn
|
| 140 |
+
have hh := mul_le_mul_of_nonneg_left (expectedMaximum_le_parisi W γ hn) (inv_nonneg.mpr hn'.le)
|
| 141 |
+
simpa only [←mul_assoc,inv_mul_cancel₀ hn'.ne',one_mul] using hh
|
| 142 |
+
|
| 143 |
+
end SKValue
|
| 144 |
+
|
| 145 |
+
end
|
| 146 |
+
|
| 147 |
+
end OAI
|
lean/OAI/Probability/SKValue/Main.lean
CHANGED
|
@@ -1,28 +1,28 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Gaussian.IntegralPositiveMulGaussian
|
| 3 |
-
import OAI.Probability.SKValue.Processes.TestExpectation
|
| 4 |
-
import OAI.Probability.SKValue.Processes.ForcedExpectation
|
| 5 |
-
import OAI.Probability.SKValue.Processes.ForcedDiffusion
|
| 6 |
-
import OAI.Probability.SKValue.Equations.PolynomialForced
|
| 7 |
-
import OAI.Probability.SKValue.Evolution.HeatConvexity
|
| 8 |
-
import OAI.Probability.SKValue.Evolution.TerminalAlgebra
|
| 9 |
-
import OAI.Probability.SKValue.Evolution.TestStrip
|
| 10 |
-
import OAI.Probability.SKValue.GroundState.MainConclusions
|
| 11 |
-
|
| 12 |
-
namespace OAI
|
| 13 |
-
|
| 14 |
-
namespace SKValue
|
| 15 |
-
|
| 16 |
-
theorem value_consequences :
|
| 17 |
-
(∀ (W : BrownianSpace) (γ : OrderParameter) (X : ℝ → W.Ω → ℝ),
|
| 18 |
-
IsMinimizer W γ → IsDiffusion W γ X → ScalarValueConclusion W γ X) ∧
|
| 19 |
-
(∀ (W : BrownianSpace) (γ : OrderParameter) (X : ℝ → W.Ω → ℝ) (T : ℝ),
|
| 20 |
-
0 < T → T < 1 → IsMinimizer W γ → IsDiffusion W γ X →
|
| 21 |
-
FiniteGaussianConclusion W γ X T) ∧
|
| 22 |
-
(∀ (W : BrownianSpace) (γ : OrderParameter),
|
| 23 |
-
IsMinimizer W γ → groundStateValue = parisi W γ) := by
|
| 24 |
-
exact ⟨scalar_value_target, finite_gaussian_target, ground_state_parisi_target⟩
|
| 25 |
-
|
| 26 |
-
end SKValue
|
| 27 |
-
|
| 28 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Gaussian.IntegralPositiveMulGaussian
|
| 3 |
+
import OAI.Probability.SKValue.Processes.TestExpectation
|
| 4 |
+
import OAI.Probability.SKValue.Processes.ForcedExpectation
|
| 5 |
+
import OAI.Probability.SKValue.Processes.ForcedDiffusion
|
| 6 |
+
import OAI.Probability.SKValue.Equations.PolynomialForced
|
| 7 |
+
import OAI.Probability.SKValue.Evolution.HeatConvexity
|
| 8 |
+
import OAI.Probability.SKValue.Evolution.TerminalAlgebra
|
| 9 |
+
import OAI.Probability.SKValue.Evolution.TestStrip
|
| 10 |
+
import OAI.Probability.SKValue.GroundState.MainConclusions
|
| 11 |
+
|
| 12 |
+
namespace OAI
|
| 13 |
+
|
| 14 |
+
namespace SKValue
|
| 15 |
+
|
| 16 |
+
theorem value_consequences :
|
| 17 |
+
(∀ (W : BrownianSpace) (γ : OrderParameter) (X : ℝ → W.Ω → ℝ),
|
| 18 |
+
IsMinimizer W γ → IsDiffusion W γ X → ScalarValueConclusion W γ X) ∧
|
| 19 |
+
(∀ (W : BrownianSpace) (γ : OrderParameter) (X : ℝ → W.Ω → ℝ) (T : ℝ),
|
| 20 |
+
0 < T → T < 1 → IsMinimizer W γ → IsDiffusion W γ X →
|
| 21 |
+
FiniteGaussianConclusion W γ X T) ∧
|
| 22 |
+
(∀ (W : BrownianSpace) (γ : OrderParameter),
|
| 23 |
+
IsMinimizer W γ → groundStateValue = parisi W γ) := by
|
| 24 |
+
exact ⟨scalar_value_target, finite_gaussian_target, ground_state_parisi_target⟩
|
| 25 |
+
|
| 26 |
+
end SKValue
|
| 27 |
+
|
| 28 |
+
end OAI
|
lean/OAI/Probability/SKValue/Model.lean
CHANGED
|
@@ -1,165 +1,165 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
|
| 3 |
-
namespace OAI
|
| 4 |
-
|
| 5 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 6 |
-
open scoped Topology ENNReal NNReal BigOperators
|
| 7 |
-
|
| 8 |
-
namespace SKValue
|
| 9 |
-
|
| 10 |
-
noncomputable def standardGaussian : Measure ℝ := gaussianReal 0 1
|
| 11 |
-
|
| 12 |
-
instance : IsProbabilityMeasure standardGaussian := by unfold standardGaussian; infer_instance
|
| 13 |
-
|
| 14 |
-
noncomputable def gaussianProduct (ι : Type) [Fintype ι] : Measure (ι → ℝ) :=
|
| 15 |
-
Measure.pi (fun _ : ι ↦ standardGaussian)
|
| 16 |
-
instance gaussianProduct_probability (ι : Type) [Fintype ι] :
|
| 17 |
-
IsProbabilityMeasure (gaussianProduct ι) := by
|
| 18 |
-
unfold gaussianProduct
|
| 19 |
-
infer_instance
|
| 20 |
-
|
| 21 |
-
def coordinate (N : ℕ) (j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 22 |
-
z ⟨j % (N+1), Nat.mod_lt _ (Nat.succ_pos _)⟩
|
| 23 |
-
|
| 24 |
-
noncomputable def stepSize (T : ℝ) (N : ℕ) : ℝ := T / N
|
| 25 |
-
noncomputable def meshTime (T : ℝ) (N j : ℕ) : ℝ := j * stepSize T N
|
| 26 |
-
|
| 27 |
-
noncomputable def euler (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 28 |
-
(z : Fin (N+1) → ℝ) : ℕ → ℝ
|
| 29 |
-
| 0 => 0
|
| 30 |
-
| j+1 => euler T N γ u z j + Real.sqrt (stepSize T N) * coordinate N j z +
|
| 31 |
-
stepSize T N * γ (meshTime T N j) * u (meshTime T N j) (euler T N γ u z j)
|
| 32 |
-
|
| 33 |
-
structure OrderParameter where
|
| 34 |
-
coeff : ℝ → ℝ
|
| 35 |
-
nonneg : ∀ t ∈ Ico (0 : ℝ) 1, 0 ≤ coeff t
|
| 36 |
-
monotone : MonotoneOn coeff (Ico (0 : ℝ) 1)
|
| 37 |
-
rightContinuous : ∀ t ∈ Ico (0 : ℝ) 1, ContinuousWithinAt coeff (Ici t) t
|
| 38 |
-
integrable : IntegrableOn coeff (Ioc (0 : ℝ) 1)
|
| 39 |
-
|
| 40 |
-
structure BrownianSpace where
|
| 41 |
-
Ω : Type
|
| 42 |
-
measurableSpace : MeasurableSpace Ω
|
| 43 |
-
μ : @Measure Ω measurableSpace
|
| 44 |
-
probability : @IsProbabilityMeasure Ω measurableSpace μ
|
| 45 |
-
B : ℝ≥0 → Ω → ℝ
|
| 46 |
-
measurable : ∀ t, @StronglyMeasurable Ω ℝ _ measurableSpace (B t)
|
| 47 |
-
brownian : @IsBrownianReal Ω measurableSpace B μ
|
| 48 |
-
|
| 49 |
-
attribute [instance] BrownianSpace.measurableSpace BrownianSpace.probability
|
| 50 |
-
|
| 51 |
-
noncomputable def BrownianSpace.filtration (W : BrownianSpace) :
|
| 52 |
-
Filtration ℝ≥0 W.measurableSpace := Filtration.natural W.B W.measurable
|
| 53 |
-
|
| 54 |
-
noncomputable def shiftedFiltration (W : BrownianSpace) (t : ℝ) :
|
| 55 |
-
Filtration ℝ≥0 W.measurableSpace :=
|
| 56 |
-
Filtration.natural (fun s ω ↦ W.B (Real.toNNReal t + s) ω - W.B (Real.toNNReal t) ω)
|
| 57 |
-
(fun _ ↦ (W.measurable _).sub (W.measurable _))
|
| 58 |
-
|
| 59 |
-
def Admissible (W : BrownianSpace) (t : ℝ) (α : ℝ≥0 → W.Ω → ℝ) : Prop :=
|
| 60 |
-
IsProgressive (shiftedFiltration W t) α ∧ ∀ s ω, |α s ω| ≤ 1
|
| 61 |
-
|
| 62 |
-
noncomputable def controlPayoff (W : BrownianSpace) (γ : OrderParameter)
|
| 63 |
-
(t x : ℝ) (α : ℝ≥0 → W.Ω → ℝ) : ℝ :=
|
| 64 |
-
∫ ω, (|x + W.B 1 ω - W.B (Real.toNNReal t) ω +
|
| 65 |
-
∫ s in (0 : ℝ)..(1-t), γ.coeff (t+s) * α (Real.toNNReal s) ω| -
|
| 66 |
-
(1/2 : ℝ) * ∫ s in (0 : ℝ)..(1-t), γ.coeff (t+s) * α (Real.toNNReal s) ω ^ 2) ∂W.μ
|
| 67 |
-
|
| 68 |
-
noncomputable def phi (W : BrownianSpace) (γ : OrderParameter) (t x : ℝ) : ℝ :=
|
| 69 |
-
sSup {r | ∃ α, Admissible W t α ∧ r = controlPayoff W γ t x α}
|
| 70 |
-
|
| 71 |
-
noncomputable def gradient (W : BrownianSpace) (γ : OrderParameter) (t x : ℝ) : ℝ :=
|
| 72 |
-
deriv (phi W γ t) x
|
| 73 |
-
|
| 74 |
-
noncomputable def curvature (W : BrownianSpace) (γ : OrderParameter) (t x : ℝ) : ℝ :=
|
| 75 |
-
deriv (gradient W γ t) x
|
| 76 |
-
|
| 77 |
-
noncomputable def parisi (W : BrownianSpace) (γ : OrderParameter) : ℝ :=
|
| 78 |
-
phi W γ 0 0 - (1/2 : ℝ) * ∫ t in (0 : ℝ)..1, t * γ.coeff t
|
| 79 |
-
|
| 80 |
-
def IsMinimizer (W : BrownianSpace) (γ : OrderParameter) : Prop :=
|
| 81 |
-
∀ η : OrderParameter, parisi W γ ≤ parisi W η
|
| 82 |
-
|
| 83 |
-
def IsDiffusion (W : BrownianSpace) (γ : OrderParameter) (X : ℝ → W.Ω → ℝ) : Prop :=
|
| 84 |
-
Adapted W.filtration (fun t ω ↦ X (min (t : ℝ) 1) ω) ∧
|
| 85 |
-
(∀ᵐ ω ∂W.μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) 1) ∧
|
| 86 |
-
∀ t ∈ Icc (0 : ℝ) 1,
|
| 87 |
-
X t ω = W.B (Real.toNNReal t) ω +
|
| 88 |
-
∫ s in (0 : ℝ)..t, γ.coeff s * gradient W γ s (X s ω))
|
| 89 |
-
|
| 90 |
-
noncomputable def spin (b : Bool) : ℝ := if b then 1 else -1
|
| 91 |
-
|
| 92 |
-
noncomputable def hamiltonian (n : ℕ) (J : (Fin n × Fin n) → ℝ)
|
| 93 |
-
(σ : Fin n → Bool) : ℝ :=
|
| 94 |
-
(Real.sqrt (n : ℝ))⁻¹ *
|
| 95 |
-
∑ i : Fin n, ∑ j : Fin n, if i < j then J (i,j) * spin (σ i) * spin (σ j) else 0
|
| 96 |
-
|
| 97 |
-
noncomputable def groundStateSequence (n : ℕ) : ℝ :=
|
| 98 |
-
(n : ℝ)⁻¹ * ∫ J, sSup (range (hamiltonian n J)) ∂gaussianProduct (Fin n × Fin n)
|
| 99 |
-
|
| 100 |
-
noncomputable def groundStateValue : ℝ := limUnder atTop groundStateSequence
|
| 101 |
-
|
| 102 |
-
noncomputable def gradientStopped (W : BrownianSpace) (γ : OrderParameter)
|
| 103 |
-
(X : ℝ → W.Ω → ℝ) (U : W.Ω → ℝ) (t : ℝ≥0) (ω : W.Ω) : ℝ :=
|
| 104 |
-
if (t : ℝ) < 1 then gradient W γ t (X t ω) else U ω
|
| 105 |
-
|
| 106 |
-
def ScalarValueConclusion (W : BrownianSpace) (γ : OrderParameter)
|
| 107 |
-
(X : ℝ → W.Ω → ℝ) : Prop :=
|
| 108 |
-
Tendsto groundStateSequence atTop (𝓝 groundStateValue) ∧
|
| 109 |
-
∃ U : W.Ω → ℝ,
|
| 110 |
-
Martingale (gradientStopped W γ X U) W.filtration W.μ ∧
|
| 111 |
-
(∀ᵐ ω ∂W.μ, |U ω| ≤ 1
|
| 112 |
-
Tendsto (fun t ↦ gradient W γ t (X t ω)) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) ∧
|
| 113 |
-
Tendsto (fun t ↦ ∫ ω, (gradient W γ t (X t ω) - U ω)^2 ∂W.μ)
|
| 114 |
-
(𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) ∧
|
| 115 |
-
groundStateValue = (∫ ω, |X 1 ω| ∂W.μ) - ∫ t in (0 : ℝ)..1, t * γ.coeff t ∧
|
| 116 |
-
groundStateValue = ∫ ω, U ω * W.B 1 ω ∂W.μ ∧
|
| 117 |
-
groundStateValue = ∫ t in (0 : ℝ)..1, ∫ ω, curvature W γ t (X t ω) ∂W.μ ∧
|
| 118 |
-
IntervalIntegrable (fun t ↦ ∫ ω, curvature W γ t (X t ω) ∂W.μ) volume 0 1
|
| 119 |
-
|
| 120 |
-
noncomputable def eulerPath (W : BrownianSpace) (γ : OrderParameter) (T : ℝ) (N : ℕ)
|
| 121 |
-
(z : Fin (N+1) → ℝ) (j : ℕ) : ℝ :=
|
| 122 |
-
euler T N γ.coeff (gradient W γ) z j
|
| 123 |
-
|
| 124 |
-
noncomputable def rawCoefficient (W : BrownianSpace) (γ : OrderParameter)
|
| 125 |
-
(T : ℝ) (N j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 126 |
-
curvature W γ (meshTime T N j) (eulerPath W γ T N z j)
|
| 127 |
-
|
| 128 |
-
noncomputable def normalizer (W : BrownianSpace) (γ : OrderParameter)
|
| 129 |
-
(T : ℝ) (N j : ℕ) : ℝ :=
|
| 130 |
-
(Real.sqrt (∫ z, (rawCoefficient W γ T N j z)^2 ∂gaussianProduct (Fin (N+1))))⁻¹
|
| 131 |
-
|
| 132 |
-
noncomputable def gaussianIncrement (W : BrownianSpace) (γ : OrderParameter)
|
| 133 |
-
(T : ℝ) (N j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 134 |
-
normalizer W γ T N j * rawCoefficient W γ T N j z * coordinate N j z
|
| 135 |
-
|
| 136 |
-
noncomputable def roundedSign (W : BrownianSpace) (γ : OrderParameter)
|
| 137 |
-
(T : ℝ) (N : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 138 |
-
Real.sign (gradient W γ T (eulerPath W γ T N z N) +
|
| 139 |
-
2 * cdf standardGaussian (coordinate N N z) - 1)
|
| 140 |
-
|
| 141 |
-
noncomputable def coefficientA (W : BrownianSpace) (γ : OrderParameter)
|
| 142 |
-
(T : ℝ) (N j : ℕ) : ℝ :=
|
| 143 |
-
if j = 0 then 0 else
|
| 144 |
-
∫ z, roundedSign W γ T N z * gaussianIncrement W γ T N (j-1) z
|
| 145 |
-
∂gaussianProduct (Fin (N+1))
|
| 146 |
-
|
| 147 |
-
noncomputable def coefficientB (W : BrownianSpace) (γ : OrderParameter)
|
| 148 |
-
(T : ℝ) (N i : ℕ) : ℝ :=
|
| 149 |
-
∫ z, roundedSign W γ T N z * coordinate N (i-1) z ∂gaussianProduct (Fin (N+1))
|
| 150 |
-
|
| 151 |
-
noncomputable def shiftedCoefficientSum (W : BrownianSpace) (γ : OrderParameter)
|
| 152 |
-
(T : ℝ) (N : ℕ) : ℝ :=
|
| 153 |
-
∑ j ∈ Finset.range (N+1), coefficientA W γ T N j * coefficientB W γ T N (j+1)
|
| 154 |
-
|
| 155 |
-
def FiniteGaussianConclusion (W : BrownianSpace) (γ : OrderParameter)
|
| 156 |
-
(X : ℝ → W.Ω → ℝ) (T : ℝ) : Prop :=
|
| 157 |
-
(∀ᶠ N in atTop, ∀ j < N, 0 < normalizer W γ T N j) ∧
|
| 158 |
-
Tendsto (shiftedCoefficientSum W γ T) atTop
|
| 159 |
-
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, curvature W γ t (X t ω) ∂W.μ)) ∧
|
| 160 |
-
Tendsto (fun S ↦ ∫ t in (0 : ℝ)..S, ∫ ω, curvature W γ t (X t ω) ∂W.μ)
|
| 161 |
-
(𝓝[<] (1 : ℝ)) (𝓝 groundStateValue)
|
| 162 |
-
|
| 163 |
-
end SKValue
|
| 164 |
-
|
| 165 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 6 |
+
open scoped Topology ENNReal NNReal BigOperators
|
| 7 |
+
|
| 8 |
+
namespace SKValue
|
| 9 |
+
|
| 10 |
+
noncomputable def standardGaussian : Measure ℝ := gaussianReal 0 1
|
| 11 |
+
|
| 12 |
+
instance : IsProbabilityMeasure standardGaussian := by unfold standardGaussian; infer_instance
|
| 13 |
+
|
| 14 |
+
noncomputable def gaussianProduct (ι : Type) [Fintype ι] : Measure (ι → ℝ) :=
|
| 15 |
+
Measure.pi (fun _ : ι ↦ standardGaussian)
|
| 16 |
+
instance gaussianProduct_probability (ι : Type) [Fintype ι] :
|
| 17 |
+
IsProbabilityMeasure (gaussianProduct ι) := by
|
| 18 |
+
unfold gaussianProduct
|
| 19 |
+
infer_instance
|
| 20 |
+
|
| 21 |
+
def coordinate (N : ℕ) (j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 22 |
+
z ⟨j % (N+1), Nat.mod_lt _ (Nat.succ_pos _)⟩
|
| 23 |
+
|
| 24 |
+
noncomputable def stepSize (T : ℝ) (N : ℕ) : ℝ := T / N
|
| 25 |
+
noncomputable def meshTime (T : ℝ) (N j : ℕ) : ℝ := j * stepSize T N
|
| 26 |
+
|
| 27 |
+
noncomputable def euler (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 28 |
+
(z : Fin (N+1) → ℝ) : ℕ → ℝ
|
| 29 |
+
| 0 => 0
|
| 30 |
+
| j+1 => euler T N γ u z j + Real.sqrt (stepSize T N) * coordinate N j z +
|
| 31 |
+
stepSize T N * γ (meshTime T N j) * u (meshTime T N j) (euler T N γ u z j)
|
| 32 |
+
|
| 33 |
+
structure OrderParameter where
|
| 34 |
+
coeff : ℝ → ℝ
|
| 35 |
+
nonneg : ∀ t ∈ Ico (0 : ℝ) 1, 0 ≤ coeff t
|
| 36 |
+
monotone : MonotoneOn coeff (Ico (0 : ℝ) 1)
|
| 37 |
+
rightContinuous : ∀ t ∈ Ico (0 : ℝ) 1, ContinuousWithinAt coeff (Ici t) t
|
| 38 |
+
integrable : IntegrableOn coeff (Ioc (0 : ℝ) 1)
|
| 39 |
+
|
| 40 |
+
structure BrownianSpace where
|
| 41 |
+
Ω : Type
|
| 42 |
+
measurableSpace : MeasurableSpace Ω
|
| 43 |
+
μ : @Measure Ω measurableSpace
|
| 44 |
+
probability : @IsProbabilityMeasure Ω measurableSpace μ
|
| 45 |
+
B : ℝ≥0 → Ω → ℝ
|
| 46 |
+
measurable : ∀ t, @StronglyMeasurable Ω ℝ _ measurableSpace (B t)
|
| 47 |
+
brownian : @IsBrownianReal Ω measurableSpace B μ
|
| 48 |
+
|
| 49 |
+
attribute [instance] BrownianSpace.measurableSpace BrownianSpace.probability
|
| 50 |
+
|
| 51 |
+
noncomputable def BrownianSpace.filtration (W : BrownianSpace) :
|
| 52 |
+
Filtration ℝ≥0 W.measurableSpace := Filtration.natural W.B W.measurable
|
| 53 |
+
|
| 54 |
+
noncomputable def shiftedFiltration (W : BrownianSpace) (t : ℝ) :
|
| 55 |
+
Filtration ℝ≥0 W.measurableSpace :=
|
| 56 |
+
Filtration.natural (fun s ω ↦ W.B (Real.toNNReal t + s) ω - W.B (Real.toNNReal t) ω)
|
| 57 |
+
(fun _ ↦ (W.measurable _).sub (W.measurable _))
|
| 58 |
+
|
| 59 |
+
def Admissible (W : BrownianSpace) (t : ℝ) (α : ℝ≥0 → W.Ω → ℝ) : Prop :=
|
| 60 |
+
IsProgressive (shiftedFiltration W t) α ∧ ∀ s ω, |α s ω| ≤ 1
|
| 61 |
+
|
| 62 |
+
noncomputable def controlPayoff (W : BrownianSpace) (γ : OrderParameter)
|
| 63 |
+
(t x : ℝ) (α : ℝ≥0 → W.Ω → ℝ) : ℝ :=
|
| 64 |
+
∫ ω, (|x + W.B 1 ω - W.B (Real.toNNReal t) ω +
|
| 65 |
+
∫ s in (0 : ℝ)..(1-t), γ.coeff (t+s) * α (Real.toNNReal s) ω| -
|
| 66 |
+
(1/2 : ℝ) * ∫ s in (0 : ℝ)..(1-t), γ.coeff (t+s) * α (Real.toNNReal s) ω ^ 2) ∂W.μ
|
| 67 |
+
|
| 68 |
+
noncomputable def phi (W : BrownianSpace) (γ : OrderParameter) (t x : ℝ) : ℝ :=
|
| 69 |
+
sSup {r | ∃ α, Admissible W t α ∧ r = controlPayoff W γ t x α}
|
| 70 |
+
|
| 71 |
+
noncomputable def gradient (W : BrownianSpace) (γ : OrderParameter) (t x : ℝ) : ℝ :=
|
| 72 |
+
deriv (phi W γ t) x
|
| 73 |
+
|
| 74 |
+
noncomputable def curvature (W : BrownianSpace) (γ : OrderParameter) (t x : ℝ) : ℝ :=
|
| 75 |
+
deriv (gradient W γ t) x
|
| 76 |
+
|
| 77 |
+
noncomputable def parisi (W : BrownianSpace) (γ : OrderParameter) : ℝ :=
|
| 78 |
+
phi W γ 0 0 - (1/2 : ℝ) * ∫ t in (0 : ℝ)..1, t * γ.coeff t
|
| 79 |
+
|
| 80 |
+
def IsMinimizer (W : BrownianSpace) (γ : OrderParameter) : Prop :=
|
| 81 |
+
∀ η : OrderParameter, parisi W γ ≤ parisi W η
|
| 82 |
+
|
| 83 |
+
def IsDiffusion (W : BrownianSpace) (γ : OrderParameter) (X : ℝ → W.Ω → ℝ) : Prop :=
|
| 84 |
+
Adapted W.filtration (fun t ω ↦ X (min (t : ℝ) 1) ω) ∧
|
| 85 |
+
(∀ᵐ ω ∂W.μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) 1) ∧
|
| 86 |
+
∀ t ∈ Icc (0 : ℝ) 1,
|
| 87 |
+
X t ω = W.B (Real.toNNReal t) ω +
|
| 88 |
+
∫ s in (0 : ℝ)..t, γ.coeff s * gradient W γ s (X s ω))
|
| 89 |
+
|
| 90 |
+
noncomputable def spin (b : Bool) : ℝ := if b then 1 else -1
|
| 91 |
+
|
| 92 |
+
noncomputable def hamiltonian (n : ℕ) (J : (Fin n × Fin n) → ℝ)
|
| 93 |
+
(σ : Fin n → Bool) : ℝ :=
|
| 94 |
+
(Real.sqrt (n : ℝ))⁻¹ *
|
| 95 |
+
∑ i : Fin n, ∑ j : Fin n, if i < j then J (i,j) * spin (σ i) * spin (σ j) else 0
|
| 96 |
+
|
| 97 |
+
noncomputable def groundStateSequence (n : ℕ) : ℝ :=
|
| 98 |
+
(n : ℝ)⁻¹ * ∫ J, sSup (range (hamiltonian n J)) ∂gaussianProduct (Fin n × Fin n)
|
| 99 |
+
|
| 100 |
+
noncomputable def groundStateValue : ℝ := limUnder atTop groundStateSequence
|
| 101 |
+
|
| 102 |
+
noncomputable def gradientStopped (W : BrownianSpace) (γ : OrderParameter)
|
| 103 |
+
(X : ℝ → W.Ω → ℝ) (U : W.Ω → ℝ) (t : ℝ≥0) (ω : W.Ω) : ℝ :=
|
| 104 |
+
if (t : ℝ) < 1 then gradient W γ t (X t ω) else U ω
|
| 105 |
+
|
| 106 |
+
def ScalarValueConclusion (W : BrownianSpace) (γ : OrderParameter)
|
| 107 |
+
(X : ℝ → W.Ω → ℝ) : Prop :=
|
| 108 |
+
Tendsto groundStateSequence atTop (𝓝 groundStateValue) ∧
|
| 109 |
+
∃ U : W.Ω → ℝ,
|
| 110 |
+
Martingale (gradientStopped W γ X U) W.filtration W.μ ∧
|
| 111 |
+
(∀ᵐ ω ∂W.μ, |U ω| ≤ 1 ∧ (U ω)^2 = 1 ∧
|
| 112 |
+
Tendsto (fun t ↦ gradient W γ t (X t ω)) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) ∧
|
| 113 |
+
Tendsto (fun t ↦ ∫ ω, (gradient W γ t (X t ω) - U ω)^2 ∂W.μ)
|
| 114 |
+
(𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) ∧
|
| 115 |
+
groundStateValue = (∫ ω, |X 1 ω| ∂W.μ) - ∫ t in (0 : ℝ)..1, t * γ.coeff t ∧
|
| 116 |
+
groundStateValue = ∫ ω, U ω * W.B 1 ω ∂W.μ ∧
|
| 117 |
+
groundStateValue = ∫ t in (0 : ℝ)..1, ∫ ω, curvature W γ t (X t ω) ∂W.μ ∧
|
| 118 |
+
IntervalIntegrable (fun t ↦ ∫ ω, curvature W γ t (X t ω) ∂W.μ) volume 0 1
|
| 119 |
+
|
| 120 |
+
noncomputable def eulerPath (W : BrownianSpace) (γ : OrderParameter) (T : ℝ) (N : ℕ)
|
| 121 |
+
(z : Fin (N+1) → ℝ) (j : ℕ) : ℝ :=
|
| 122 |
+
euler T N γ.coeff (gradient W γ) z j
|
| 123 |
+
|
| 124 |
+
noncomputable def rawCoefficient (W : BrownianSpace) (γ : OrderParameter)
|
| 125 |
+
(T : ℝ) (N j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 126 |
+
curvature W γ (meshTime T N j) (eulerPath W γ T N z j)
|
| 127 |
+
|
| 128 |
+
noncomputable def normalizer (W : BrownianSpace) (γ : OrderParameter)
|
| 129 |
+
(T : ℝ) (N j : ℕ) : ℝ :=
|
| 130 |
+
(Real.sqrt (∫ z, (rawCoefficient W γ T N j z)^2 ∂gaussianProduct (Fin (N+1))))⁻¹
|
| 131 |
+
|
| 132 |
+
noncomputable def gaussianIncrement (W : BrownianSpace) (γ : OrderParameter)
|
| 133 |
+
(T : ℝ) (N j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 134 |
+
normalizer W γ T N j * rawCoefficient W γ T N j z * coordinate N j z
|
| 135 |
+
|
| 136 |
+
noncomputable def roundedSign (W : BrownianSpace) (γ : OrderParameter)
|
| 137 |
+
(T : ℝ) (N : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 138 |
+
Real.sign (gradient W γ T (eulerPath W γ T N z N) +
|
| 139 |
+
2 * cdf standardGaussian (coordinate N N z) - 1)
|
| 140 |
+
|
| 141 |
+
noncomputable def coefficientA (W : BrownianSpace) (γ : OrderParameter)
|
| 142 |
+
(T : ℝ) (N j : ℕ) : ℝ :=
|
| 143 |
+
if j = 0 then 0 else
|
| 144 |
+
∫ z, roundedSign W γ T N z * gaussianIncrement W γ T N (j-1) z
|
| 145 |
+
∂gaussianProduct (Fin (N+1))
|
| 146 |
+
|
| 147 |
+
noncomputable def coefficientB (W : BrownianSpace) (γ : OrderParameter)
|
| 148 |
+
(T : ℝ) (N i : ℕ) : ℝ :=
|
| 149 |
+
∫ z, roundedSign W γ T N z * coordinate N (i-1) z ∂gaussianProduct (Fin (N+1))
|
| 150 |
+
|
| 151 |
+
noncomputable def shiftedCoefficientSum (W : BrownianSpace) (γ : OrderParameter)
|
| 152 |
+
(T : ℝ) (N : ℕ) : ℝ :=
|
| 153 |
+
∑ j ∈ Finset.range (N+1), coefficientA W γ T N j * coefficientB W γ T N (j+1)
|
| 154 |
+
|
| 155 |
+
def FiniteGaussianConclusion (W : BrownianSpace) (γ : OrderParameter)
|
| 156 |
+
(X : ℝ → W.Ω → ℝ) (T : ℝ) : Prop :=
|
| 157 |
+
(∀ᶠ N in atTop, ∀ j < N, 0 < normalizer W γ T N j) ∧
|
| 158 |
+
Tendsto (shiftedCoefficientSum W γ T) atTop
|
| 159 |
+
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, curvature W γ t (X t ω) ∂W.μ)) ∧
|
| 160 |
+
Tendsto (fun S ↦ ∫ t in (0 : ℝ)..S, ∫ ω, curvature W γ t (X t ω) ∂W.μ)
|
| 161 |
+
(𝓝[<] (1 : ℝ)) (𝓝 groundStateValue)
|
| 162 |
+
|
| 163 |
+
end SKValue
|
| 164 |
+
|
| 165 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/CrossMesh.lean
CHANGED
|
@@ -1,153 +1,153 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.GroundState.CrossExpectation
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValue
|
| 11 |
-
|
| 12 |
-
lemma abs_telescope_source {N : ℕ} {A b Γ Δ : ℕ → ℝ} {c d e : ℝ}
|
| 13 |
-
(h : ∀ j<N,|A (j+1)-A j+b j|≤c+d*(Γ (j+1)-Γ j)+e*(Δ (j+1)-Δ j)) :
|
| 14 |
-
|A N-A 0+∑ j∈Finset.range N,b j|≤
|
| 15 |
-
(N : ℝ)*c+d*(Γ N-Γ 0)+e*(Δ N-Δ 0) := by
|
| 16 |
-
have hs := (Finset.abs_sum_le_sum_abs (fun j ↦ A (j+1)-A j+b j) (Finset.range N)).trans
|
| 17 |
-
(Finset.sum_le_sum (fun j hj ↦ h j (Finset.mem_range.mp hj)))
|
| 18 |
-
simpa only [Finset.sum_add_distrib,Finset.sum_range_sub,←Finset.mul_sum,
|
| 19 |
-
Finset.sum_const,Finset.card_range,nsmul_eq_mul] using hs
|
| 20 |
-
|
| 21 |
-
noncomputable def crossMeshSource (T : ℝ) (N : ℕ) (γ β : ℝ → ℝ) (V U : ℝ → ℝ → ℝ) : ℝ :=
|
| 22 |
-
∑ j∈Finset.range N,(stepSize T N/2)*(β (meshTime T N j)-γ (meshTime T N j))*
|
| 23 |
-
(∫ z,(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2
|
| 24 |
-
∂gaussianProduct (Fin (N+1)))
|
| 25 |
-
|
| 26 |
-
lemma cross_value_mesh_expectation {T K L K' L' G : ℝ}
|
| 27 |
-
{γ β : ℝ → ℝ} {V U : ℝ → ℝ → ℝ}
|
| 28 |
-
(hV : ValueStrip T γ V K L) (hU : ValueStrip T β U K' L')
|
| 29 |
-
(hT : 0<T) (hT1 : T≤1) (hG : γ T≤G) (hG' : β T≤G) {N : ℕ} (hN : 0<N) :
|
| 30 |
-
|(∫ z,U T (euler T N β (crossFeedback V U) z N)-
|
| 31 |
-
V T (euler T N β (crossFeedback V U) z N) ∂gaussianProduct (Fin (N+1)))-
|
| 32 |
-
(U 0 0-V 0 0)+crossMeshSource T N γ β V U|≤
|
| 33 |
-
T*Real.sqrt (stepSize T N)*(cubicEnvelopeMean G K ((1/2+G)*L)+
|
| 34 |
-
cubicEnvelopeMean G K' ((1/2+G)*L'))+
|
| 35 |
-
stepSize T N*K*(γ T-γ 0)+stepSize T N*K'*(β T-β 0) := by
|
| 36 |
-
let δ := stepSize T N
|
| 37 |
-
let Y := euler T N β (crossFeedback V U)
|
| 38 |
-
let A := fun j ↦ ∫ z,U (meshTime T N j) (Y z j)-V (meshTime T N j) (Y z j)
|
| 39 |
-
∂gaussianProduct (Fin (N+1))
|
| 40 |
-
let b := fun j ↦ (δ/2)*(β (meshTime T N j)-γ (meshTime T N j))*
|
| 41 |
-
(∫ z,(deriv (V (meshTime T N j)) (Y z j))^2 ∂gaussianProduct (Fin (N+1)))
|
| 42 |
-
have hNr : 0<(N : ℝ) := by exact_mod_cast hN
|
| 43 |
-
have hδ : 0≤δ := div_nonneg hT.le hNr.le
|
| 44 |
-
have hδ1 : δ≤1 := by
|
| 45 |
-
apply (div_le_iff₀ hNr).mpr
|
| 46 |
-
have hN1 : (1 : ℝ)≤N := by exact_mod_cast hN
|
| 47 |
-
simpa only [one_mul] using hT1.trans hN1
|
| 48 |
-
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT.le hN hj
|
| 49 |
-
have hs (j : ℕ) : meshTime T N j+δ=meshTime T N (j+1) := by
|
| 50 |
-
dsimp [meshTime]; push_cast; ring
|
| 51 |
-
have hlast : meshTime T N N=T := by dsimp [meshTime,stepSize]; field_simp
|
| 52 |
-
have hzero : meshTime T N 0=0 := by simp [meshTime]
|
| 53 |
-
have hfm (j : ℕ) (hj : j<N) : Measurable (crossFeedback V U (meshTime T N j)) :=
|
| 54 |
-
(((hU.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable.add
|
| 55 |
-
((hV.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable).div_const 2
|
| 56 |
-
have hfb (j : ℕ) (hj : j<N) (x : ℝ) : |crossFeedback V U (meshTime T N j) x|≤1 :=
|
| 57 |
-
crossFeedback_bound (hV.bounded _ (htime j hj.le) x) (hU.bounded _ (htime j hj.le) x)
|
| 58 |
-
have hstep (j : ℕ) (hj : j<N) : |A (j+1)-A j+b j|≤
|
| 59 |
-
δ*Real.sqrt δ*(cubicEnvelopeMean G K ((1/2+G)*L)+cubicEnvelopeMean G K' ((1/2+G)*L'))+
|
| 60 |
-
δ*K*(γ (meshTime T N (j+1))-γ (meshTime T N j))+
|
| 61 |
-
δ*K'*(β (meshTime T N (j+1))-β (meshTime T N j)) := by
|
| 62 |
-
have hYp : DependsBefore j (fun z ↦ Y z j) :=
|
| 63 |
-
eulerCoefficient_dependsBefore T hj.le β (crossFeedback V U) (fun _ y ↦ y)
|
| 64 |
-
have he := cross_value_expectation_step hV hU (htime j hj.le).1 hδ hδ1
|
| 65 |
-
(by rw [hs]; exact (htime (j+1) (by omega)).2) hG hG' (by omega : j<N+1)
|
| 66 |
-
(measurable_euler T N β (crossFeedback V U) hfm j hj.le) hYp
|
| 67 |
-
(euler_memLp T N β (crossFeedback V U) hfm hfb j hj.le)
|
| 68 |
-
dsimp only at he
|
| 69 |
-
rw [hs] at he
|
| 70 |
-
simpa only [A,b,Y,euler,δ,mul_assoc] using he
|
| 71 |
-
have hh := abs_telescope_source (A := A) (b := b)
|
| 72 |
-
(Γ := fun j ↦ γ (meshTime T N j)) (Δ := fun j ↦ β (meshTime T N j)) hstep
|
| 73 |
-
have hA0 : A 0=U 0 0-V 0 0 := by simp [A,Y,meshTime,euler]
|
| 74 |
-
rw [hA0,show A N=(∫ z,U T (Y z N)-V T (Y z N) ∂gaussianProduct (Fin (N+1))) by
|
| 75 |
-
dsimp only [A]; rw [hlast],hlast,hzero] at hh
|
| 76 |
-
have hNd : (N : ℝ)*δ=T := by dsimp [δ,stepSize]; field_simp
|
| 77 |
-
convert hh using 1
|
| 78 |
-
· rfl
|
| 79 |
-
· dsimp only [δ] at hNd ⊢
|
| 80 |
-
simp only [←mul_assoc,hNd]
|
| 81 |
-
|
| 82 |
-
end SKValue
|
| 83 |
-
|
| 84 |
-
end
|
| 85 |
-
|
| 86 |
-
section
|
| 87 |
-
|
| 88 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 89 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 90 |
-
namespace SKValue
|
| 91 |
-
|
| 92 |
-
lemma euler_same_noise_bound {T G L d e : ℝ} {N : ℕ} {γ β : ℝ → ℝ}
|
| 93 |
-
{u v : ℝ → ℝ → ℝ} (hT : 0≤T) (hN : 0<N)
|
| 94 |
-
(hG : 0≤G) (hL : 0≤L) (hd : 0≤d) (he : 0≤e)
|
| 95 |
-
(hg : ∀ j<N,|γ (meshTime T N j)|≤G)
|
| 96 |
-
(hc : ∀ j<N,|β (meshTime T N j)-γ (meshTime T N j)|≤d)
|
| 97 |
-
(hv : ∀ j<N,∀ x,|v (meshTime T N j) x|≤1)
|
| 98 |
-
(hs : ∀ j<N,∀ x,|v (meshTime T N j) x-u (meshTime T N j) x|≤e)
|
| 99 |
-
(hu : ∀ j<N,∀ x y,|u (meshTime T N j) x-u (meshTime T N j) y|≤L*|x-y|)
|
| 100 |
-
(z : Fin (N+1) → ℝ) {j : ℕ} (hj : j≤N) :
|
| 101 |
-
|euler T N β v z j-euler T N γ u z j|≤T*(d+G*e)*Real.exp (T*G*L) := by
|
| 102 |
-
let δ := stepSize T N
|
| 103 |
-
have hδ : 0≤δ := div_nonneg hT (Nat.cast_nonneg _)
|
| 104 |
-
have hNd : (N : ℝ)*δ=T := by dsimp [δ,stepSize]; field_simp
|
| 105 |
-
have hrec (k : ℕ) (hk : k<N) :
|
| 106 |
-
|euler T N β v z (k+1)-euler T N γ u z (k+1)|≤
|
| 107 |
-
(1+δ*G*L)*|euler T N β v z k-euler T N γ u z k|+δ*(d+G*e) := by
|
| 108 |
-
let y := euler T N β v z k
|
| 109 |
-
let x := euler T N γ u z k
|
| 110 |
-
let t := meshTime T N k
|
| 111 |
-
have hb : |β t*v t y-γ t*u t x|≤d+G*e+G*L*|y-x| := by
|
| 112 |
-
calc
|
| 113 |
-
|β t*v t y-γ t*u t x| = |(β t-γ t)*v t y+γ t*(v t y-u t y)+γ t*(u t y-u t x)| := by congr 1; ring
|
| 114 |
-
_ ≤ |(β t-γ t)*v t y|+|γ t*(v t y-u t y)|+|γ t*(u t y-u t x)| := (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl)
|
| 115 |
-
_ ≤ d*1+G*e+G*(L*|y-x|) := by
|
| 116 |
-
simp only [abs_mul]
|
| 117 |
-
gcongr
|
| 118 |
-
· exact hc k hk
|
| 119 |
-
· exact hv k hk y
|
| 120 |
-
· exact hg k hk
|
| 121 |
-
· exact hs k hk y
|
| 122 |
-
· exact hg k hk
|
| 123 |
-
· exact hu k hk y x
|
| 124 |
-
_ = _ := by ring
|
| 125 |
-
change |y+Real.sqrt δ*coordinate N k z+δ*β t*v t y-
|
| 126 |
-
(x+Real.sqrt δ*coordinate N k z+δ*γ t*u t x)|≤_
|
| 127 |
-
calc
|
| 128 |
-
_ = |(y-x)+δ*(β t*v t y-γ t*u t x)| := by congr 1; ring
|
| 129 |
-
_ ≤ |y-x|+δ*|β t*v t y-γ t*u t x| := by simpa only [abs_mul,abs_of_nonneg hδ] using abs_add_le (y-x) (δ*(β t*v t y-γ t*u t x))
|
| 130 |
-
_ ≤ |y-x|+δ*(d+G*e+G*L*|y-x|) := add_le_add_right (mul_le_mul_of_nonneg_left hb hδ) _
|
| 131 |
-
_ = _ := by ring
|
| 132 |
-
have h := finite_discrete_gronwall (e := fun k ↦ |euler T N β v z k-euler T N γ u z k|) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 133 |
-
(show |euler T N β v z 0-euler T N γ u z 0|=0 by simp [euler])
|
| 134 |
-
(fun k hk ↦ mul_nonneg hδ (add_nonneg hd (mul_nonneg hG he))) hrec j hj
|
| 135 |
-
have hsum : (∑ k∈Finset.range j,δ*(d+G*e))≤T*(d+G*e) := by
|
| 136 |
-
simp only [Finset.sum_const,Finset.card_range,nsmul_eq_mul]
|
| 137 |
-
rw [←hNd]
|
| 138 |
-
have hjs : (j : ℝ)≤N := by exact_mod_cast hj
|
| 139 |
-
nlinarith [mul_nonneg hG he,mul_nonneg hd hδ,mul_nonneg hδ (mul_nonneg hG he)]
|
| 140 |
-
apply h.trans
|
| 141 |
-
apply mul_le_mul hsum
|
| 142 |
-
· apply Real.exp_le_exp.mpr
|
| 143 |
-
calc
|
| 144 |
-
(j : ℝ)*(δ*G*L)≤(N : ℝ)*(δ*G*L) := mul_le_mul_of_nonneg_right (by exact_mod_cast hj) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 145 |
-
_=T*G*L := by rw [←hNd]; ring
|
| 146 |
-
· positivity
|
| 147 |
-
· positivity
|
| 148 |
-
|
| 149 |
-
end SKValue
|
| 150 |
-
|
| 151 |
-
end
|
| 152 |
-
|
| 153 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.GroundState.CrossExpectation
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValue
|
| 11 |
+
|
| 12 |
+
lemma abs_telescope_source {N : ℕ} {A b Γ Δ : ℕ → ℝ} {c d e : ℝ}
|
| 13 |
+
(h : ∀ j<N,|A (j+1)-A j+b j|≤c+d*(Γ (j+1)-Γ j)+e*(Δ (j+1)-Δ j)) :
|
| 14 |
+
|A N-A 0+∑ j∈Finset.range N,b j|≤
|
| 15 |
+
(N : ℝ)*c+d*(Γ N-Γ 0)+e*(Δ N-Δ 0) := by
|
| 16 |
+
have hs := (Finset.abs_sum_le_sum_abs (fun j ↦ A (j+1)-A j+b j) (Finset.range N)).trans
|
| 17 |
+
(Finset.sum_le_sum (fun j hj ↦ h j (Finset.mem_range.mp hj)))
|
| 18 |
+
simpa only [Finset.sum_add_distrib,Finset.sum_range_sub,←Finset.mul_sum,
|
| 19 |
+
Finset.sum_const,Finset.card_range,nsmul_eq_mul] using hs
|
| 20 |
+
|
| 21 |
+
noncomputable def crossMeshSource (T : ℝ) (N : ℕ) (γ β : ℝ → ℝ) (V U : ℝ → ℝ → ℝ) : ℝ :=
|
| 22 |
+
∑ j∈Finset.range N,(stepSize T N/2)*(β (meshTime T N j)-γ (meshTime T N j))*
|
| 23 |
+
(∫ z,(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2
|
| 24 |
+
∂gaussianProduct (Fin (N+1)))
|
| 25 |
+
|
| 26 |
+
lemma cross_value_mesh_expectation {T K L K' L' G : ℝ}
|
| 27 |
+
{γ β : ℝ → ℝ} {V U : ℝ → ℝ → ℝ}
|
| 28 |
+
(hV : ValueStrip T γ V K L) (hU : ValueStrip T β U K' L')
|
| 29 |
+
(hT : 0<T) (hT1 : T≤1) (hG : γ T≤G) (hG' : β T≤G) {N : ℕ} (hN : 0<N) :
|
| 30 |
+
|(∫ z,U T (euler T N β (crossFeedback V U) z N)-
|
| 31 |
+
V T (euler T N β (crossFeedback V U) z N) ∂gaussianProduct (Fin (N+1)))-
|
| 32 |
+
(U 0 0-V 0 0)+crossMeshSource T N γ β V U|≤
|
| 33 |
+
T*Real.sqrt (stepSize T N)*(cubicEnvelopeMean G K ((1/2+G)*L)+
|
| 34 |
+
cubicEnvelopeMean G K' ((1/2+G)*L'))+
|
| 35 |
+
stepSize T N*K*(γ T-γ 0)+stepSize T N*K'*(β T-β 0) := by
|
| 36 |
+
let δ := stepSize T N
|
| 37 |
+
let Y := euler T N β (crossFeedback V U)
|
| 38 |
+
let A := fun j ↦ ∫ z,U (meshTime T N j) (Y z j)-V (meshTime T N j) (Y z j)
|
| 39 |
+
∂gaussianProduct (Fin (N+1))
|
| 40 |
+
let b := fun j ↦ (δ/2)*(β (meshTime T N j)-γ (meshTime T N j))*
|
| 41 |
+
(∫ z,(deriv (V (meshTime T N j)) (Y z j))^2 ∂gaussianProduct (Fin (N+1)))
|
| 42 |
+
have hNr : 0<(N : ℝ) := by exact_mod_cast hN
|
| 43 |
+
have hδ : 0≤δ := div_nonneg hT.le hNr.le
|
| 44 |
+
have hδ1 : δ≤1 := by
|
| 45 |
+
apply (div_le_iff₀ hNr).mpr
|
| 46 |
+
have hN1 : (1 : ℝ)≤N := by exact_mod_cast hN
|
| 47 |
+
simpa only [one_mul] using hT1.trans hN1
|
| 48 |
+
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT.le hN hj
|
| 49 |
+
have hs (j : ℕ) : meshTime T N j+δ=meshTime T N (j+1) := by
|
| 50 |
+
dsimp [meshTime]; push_cast; ring
|
| 51 |
+
have hlast : meshTime T N N=T := by dsimp [meshTime,stepSize]; field_simp
|
| 52 |
+
have hzero : meshTime T N 0=0 := by simp [meshTime]
|
| 53 |
+
have hfm (j : ℕ) (hj : j<N) : Measurable (crossFeedback V U (meshTime T N j)) :=
|
| 54 |
+
(((hU.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable.add
|
| 55 |
+
((hV.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable).div_const 2
|
| 56 |
+
have hfb (j : ℕ) (hj : j<N) (x : ℝ) : |crossFeedback V U (meshTime T N j) x|≤1 :=
|
| 57 |
+
crossFeedback_bound (hV.bounded _ (htime j hj.le) x) (hU.bounded _ (htime j hj.le) x)
|
| 58 |
+
have hstep (j : ℕ) (hj : j<N) : |A (j+1)-A j+b j|≤
|
| 59 |
+
δ*Real.sqrt δ*(cubicEnvelopeMean G K ((1/2+G)*L)+cubicEnvelopeMean G K' ((1/2+G)*L'))+
|
| 60 |
+
δ*K*(γ (meshTime T N (j+1))-γ (meshTime T N j))+
|
| 61 |
+
δ*K'*(β (meshTime T N (j+1))-β (meshTime T N j)) := by
|
| 62 |
+
have hYp : DependsBefore j (fun z ↦ Y z j) :=
|
| 63 |
+
eulerCoefficient_dependsBefore T hj.le β (crossFeedback V U) (fun _ y ↦ y)
|
| 64 |
+
have he := cross_value_expectation_step hV hU (htime j hj.le).1 hδ hδ1
|
| 65 |
+
(by rw [hs]; exact (htime (j+1) (by omega)).2) hG hG' (by omega : j<N+1)
|
| 66 |
+
(measurable_euler T N β (crossFeedback V U) hfm j hj.le) hYp
|
| 67 |
+
(euler_memLp T N β (crossFeedback V U) hfm hfb j hj.le)
|
| 68 |
+
dsimp only at he
|
| 69 |
+
rw [hs] at he
|
| 70 |
+
simpa only [A,b,Y,euler,δ,mul_assoc] using he
|
| 71 |
+
have hh := abs_telescope_source (A := A) (b := b)
|
| 72 |
+
(Γ := fun j ↦ γ (meshTime T N j)) (Δ := fun j ↦ β (meshTime T N j)) hstep
|
| 73 |
+
have hA0 : A 0=U 0 0-V 0 0 := by simp [A,Y,meshTime,euler]
|
| 74 |
+
rw [hA0,show A N=(∫ z,U T (Y z N)-V T (Y z N) ∂gaussianProduct (Fin (N+1))) by
|
| 75 |
+
dsimp only [A]; rw [hlast],hlast,hzero] at hh
|
| 76 |
+
have hNd : (N : ℝ)*δ=T := by dsimp [δ,stepSize]; field_simp
|
| 77 |
+
convert hh using 1
|
| 78 |
+
· rfl
|
| 79 |
+
· dsimp only [δ] at hNd ⊢
|
| 80 |
+
simp only [←mul_assoc,hNd]
|
| 81 |
+
|
| 82 |
+
end SKValue
|
| 83 |
+
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
section
|
| 87 |
+
|
| 88 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 89 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 90 |
+
namespace SKValue
|
| 91 |
+
|
| 92 |
+
lemma euler_same_noise_bound {T G L d e : ℝ} {N : ℕ} {γ β : ℝ → ℝ}
|
| 93 |
+
{u v : ℝ → ℝ → ℝ} (hT : 0≤T) (hN : 0<N)
|
| 94 |
+
(hG : 0≤G) (hL : 0≤L) (hd : 0≤d) (he : 0≤e)
|
| 95 |
+
(hg : ∀ j<N,|γ (meshTime T N j)|≤G)
|
| 96 |
+
(hc : ∀ j<N,|β (meshTime T N j)-γ (meshTime T N j)|≤d)
|
| 97 |
+
(hv : ∀ j<N,∀ x,|v (meshTime T N j) x|≤1)
|
| 98 |
+
(hs : ∀ j<N,∀ x,|v (meshTime T N j) x-u (meshTime T N j) x|≤e)
|
| 99 |
+
(hu : ∀ j<N,∀ x y,|u (meshTime T N j) x-u (meshTime T N j) y|≤L*|x-y|)
|
| 100 |
+
(z : Fin (N+1) → ℝ) {j : ℕ} (hj : j≤N) :
|
| 101 |
+
|euler T N β v z j-euler T N γ u z j|≤T*(d+G*e)*Real.exp (T*G*L) := by
|
| 102 |
+
let δ := stepSize T N
|
| 103 |
+
have hδ : 0≤δ := div_nonneg hT (Nat.cast_nonneg _)
|
| 104 |
+
have hNd : (N : ℝ)*δ=T := by dsimp [δ,stepSize]; field_simp
|
| 105 |
+
have hrec (k : ℕ) (hk : k<N) :
|
| 106 |
+
|euler T N β v z (k+1)-euler T N γ u z (k+1)|≤
|
| 107 |
+
(1+δ*G*L)*|euler T N β v z k-euler T N γ u z k|+δ*(d+G*e) := by
|
| 108 |
+
let y := euler T N β v z k
|
| 109 |
+
let x := euler T N γ u z k
|
| 110 |
+
let t := meshTime T N k
|
| 111 |
+
have hb : |β t*v t y-γ t*u t x|≤d+G*e+G*L*|y-x| := by
|
| 112 |
+
calc
|
| 113 |
+
|β t*v t y-γ t*u t x| = |(β t-γ t)*v t y+γ t*(v t y-u t y)+γ t*(u t y-u t x)| := by congr 1; ring
|
| 114 |
+
_ ≤ |(β t-γ t)*v t y|+|γ t*(v t y-u t y)|+|γ t*(u t y-u t x)| := (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl)
|
| 115 |
+
_ ≤ d*1+G*e+G*(L*|y-x|) := by
|
| 116 |
+
simp only [abs_mul]
|
| 117 |
+
gcongr
|
| 118 |
+
· exact hc k hk
|
| 119 |
+
· exact hv k hk y
|
| 120 |
+
· exact hg k hk
|
| 121 |
+
· exact hs k hk y
|
| 122 |
+
· exact hg k hk
|
| 123 |
+
· exact hu k hk y x
|
| 124 |
+
_ = _ := by ring
|
| 125 |
+
change |y+Real.sqrt δ*coordinate N k z+δ*β t*v t y-
|
| 126 |
+
(x+Real.sqrt δ*coordinate N k z+δ*γ t*u t x)|≤_
|
| 127 |
+
calc
|
| 128 |
+
_ = |(y-x)+δ*(β t*v t y-γ t*u t x)| := by congr 1; ring
|
| 129 |
+
_ ≤ |y-x|+δ*|β t*v t y-γ t*u t x| := by simpa only [abs_mul,abs_of_nonneg hδ] using abs_add_le (y-x) (δ*(β t*v t y-γ t*u t x))
|
| 130 |
+
_ ≤ |y-x|+δ*(d+G*e+G*L*|y-x|) := add_le_add_right (mul_le_mul_of_nonneg_left hb hδ) _
|
| 131 |
+
_ = _ := by ring
|
| 132 |
+
have h := finite_discrete_gronwall (e := fun k ↦ |euler T N β v z k-euler T N γ u z k|) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 133 |
+
(show |euler T N β v z 0-euler T N γ u z 0|=0 by simp [euler])
|
| 134 |
+
(fun k hk ↦ mul_nonneg hδ (add_nonneg hd (mul_nonneg hG he))) hrec j hj
|
| 135 |
+
have hsum : (∑ k∈Finset.range j,δ*(d+G*e))≤T*(d+G*e) := by
|
| 136 |
+
simp only [Finset.sum_const,Finset.card_range,nsmul_eq_mul]
|
| 137 |
+
rw [←hNd]
|
| 138 |
+
have hjs : (j : ℝ)≤N := by exact_mod_cast hj
|
| 139 |
+
nlinarith [mul_nonneg hG he,mul_nonneg hd hδ,mul_nonneg hδ (mul_nonneg hG he)]
|
| 140 |
+
apply h.trans
|
| 141 |
+
apply mul_le_mul hsum
|
| 142 |
+
· apply Real.exp_le_exp.mpr
|
| 143 |
+
calc
|
| 144 |
+
(j : ℝ)*(δ*G*L)≤(N : ℝ)*(δ*G*L) := mul_le_mul_of_nonneg_right (by exact_mod_cast hj) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 145 |
+
_=T*G*L := by rw [←hNd]; ring
|
| 146 |
+
· positivity
|
| 147 |
+
· positivity
|
| 148 |
+
|
| 149 |
+
end SKValue
|
| 150 |
+
|
| 151 |
+
end
|
| 152 |
+
|
| 153 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/CrossMeshComparison.lean
CHANGED
|
@@ -1,90 +1,90 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.CrossMesh
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
|
| 8 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 9 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
-
namespace SKValue
|
| 11 |
-
|
| 12 |
-
noncomputable def ordinaryMeshSource (T : ℝ) (N : ℕ) (γ β : ℝ → ℝ) (V : ℝ → ℝ → ℝ) : ℝ :=
|
| 13 |
-
stepSize T N*∑ j : Fin N,(β (meshTime T N j)-γ (meshTime T N j))*
|
| 14 |
-
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j))
|
| 15 |
-
(euler T N γ (fun t ↦ deriv (V t)) z j))^2 ∂gaussianProduct (Fin (N+1)))
|
| 16 |
-
|
| 17 |
-
lemma crossMeshSource_half_form (T : ℝ) (N : ℕ) (γ β : ℝ → ℝ) (V U : ℝ → ℝ → ℝ) :
|
| 18 |
-
crossMeshSource T N γ β V U=stepSize T N*∑ j : Fin N,(β (meshTime T N j)-γ (meshTime T N j))*
|
| 19 |
-
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j))
|
| 20 |
-
(euler T N β (crossFeedback V U) z j))^2 ∂gaussianProduct (Fin (N+1))) := by
|
| 21 |
-
unfold crossMeshSource
|
| 22 |
-
rw [Fin.sum_univ_eq_sum_range (fun j : ℕ ↦ (β (meshTime T N j)-γ (meshTime T N j))*
|
| 23 |
-
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j))
|
| 24 |
-
(euler T N β (crossFeedback V U) z j))^2 ∂gaussianProduct (Fin (N+1))))]
|
| 25 |
-
simp only [integral_const_mul,Finset.mul_sum]
|
| 26 |
-
apply Finset.sum_congr rfl
|
| 27 |
-
intro j hj
|
| 28 |
-
ring
|
| 29 |
-
|
| 30 |
-
lemma crossMeshSource_difference_bound {T K L K' L' d R : ℝ}
|
| 31 |
-
{γ β : ℝ → ℝ} {V U : ℝ → ℝ → ℝ}
|
| 32 |
-
(hV : ValueStrip T γ V K L) (hU : ValueStrip T β U K' L')
|
| 33 |
-
(hT : 0≤T) {N : ℕ} (hN : 0<N) (hd : 0≤d) (hR : 0≤R)
|
| 34 |
-
(hc : ∀ t∈Icc (0 : ℝ) T,|β t-γ t|≤d)
|
| 35 |
-
(hY : ∀ z : Fin (N+1) → ℝ,∀ j≤N,
|
| 36 |
-
|euler T N β (crossFeedback V U) z j-euler T N γ (fun t ↦ deriv (V t)) z j|≤R) :
|
| 37 |
-
|crossMeshSource T N γ β V U-ordinaryMeshSource T N γ β V|≤T*d*L*R := by
|
| 38 |
-
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg _)
|
| 39 |
-
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT hN hj
|
| 40 |
-
have hfm (j : ℕ) (hj : j<N) : Measurable (crossFeedback V U (meshTime T N j)) :=
|
| 41 |
-
(((hU.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable.add
|
| 42 |
-
((hV.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable).div_const 2
|
| 43 |
-
have hfb (j : ℕ) (hj : j<N) (x : ℝ) : |crossFeedback V U (meshTime T N j) x|≤1 :=
|
| 44 |
-
crossFeedback_bound (hV.bounded _ (htime j hj.le) x) (hU.bounded _ (htime j hj.le) x)
|
| 45 |
-
have hm (j : Fin N) :
|
| 46 |
-
|(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2
|
| 47 |
-
∂gaussianProduct (Fin (N+1)))-
|
| 48 |
-
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N γ (fun t ↦ deriv (V t)) z j))^2
|
| 49 |
-
∂gaussianProduct (Fin (N+1)))|≤L*R := by
|
| 50 |
-
have hLip := hV.product_lipschitzWith (htime j j.isLt.le)
|
| 51 |
-
have hM1 := lipschitz_comp_memLp_finite hLip (euler_memLp T N β (crossFeedback V U) hfm hfb j j.isLt.le)
|
| 52 |
-
have hM2 := lipschitz_comp_memLp_finite hLip (euler_memLp T N γ (fun t ↦ deriv (V t))
|
| 53 |
-
(fun k hk ↦ ((hV.smooth _ (htime k hk.le)).continuous_deriv (by norm_num)).measurable)
|
| 54 |
-
(fun k hk x ↦ hV.bounded _ (htime k hk.le) x) j j.isLt.le)
|
| 55 |
-
rw [←integral_sub (f := fun z ↦ (1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2)
|
| 56 |
-
(g := fun z ↦ (1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N γ (fun t ↦ deriv (V t)) z j))^2)
|
| 57 |
-
(hM1.integrable (by norm_num)) (hM2.integrable (by norm_num))]
|
| 58 |
-
apply (abs_integral_le_integral_abs).trans
|
| 59 |
-
calc
|
| 60 |
-
_ ≤ ∫ _ : Fin (N+1) → ℝ,|L*R| ∂gaussianProduct (Fin (N+1)) := by
|
| 61 |
-
apply integral_mono ((hM1.integrable (by norm_num)).sub (hM2.integrable (by norm_num))).norm (integrable_const _)
|
| 62 |
-
intro z
|
| 63 |
-
have hh := hLip.dist_le_mul (euler T N β (crossFeedback V U) z j) (euler T N γ (fun t ↦ deriv (V t)) z j)
|
| 64 |
-
rw [Real.dist_eq,Real.dist_eq,Real.coe_toNNReal _ hV.L_nonneg] at hh
|
| 65 |
-
exact (hh.trans (mul_le_mul_of_nonneg_left (hY z j j.isLt.le) hV.L_nonneg)).trans
|
| 66 |
-
(le_abs_self (L*R))
|
| 67 |
-
_=L*R := by simp [abs_of_nonneg (mul_nonneg hV.L_nonneg hR)]
|
| 68 |
-
rw [crossMeshSource_half_form,ordinaryMeshSource,←mul_sub,←Finset.sum_sub_distrib,
|
| 69 |
-
abs_mul,abs_of_nonneg hδ]
|
| 70 |
-
calc
|
| 71 |
-
_ ≤ stepSize T N*∑ j : Fin N,|(β (meshTime T N j)-γ (meshTime T N j))*
|
| 72 |
-
((∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2 ∂gaussianProduct (Fin (N+1)))-
|
| 73 |
-
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N γ (fun t ↦ deriv (V t)) z j))^2 ∂gaussianProduct (Fin (N+1))))| := by
|
| 74 |
-
simp_rw [←mul_sub]
|
| 75 |
-
exact mul_le_mul_of_nonneg_left (Finset.abs_sum_le_sum_abs _ _) hδ
|
| 76 |
-
_ ≤ stepSize T N*∑ _ : Fin N,d*(L*R) := by
|
| 77 |
-
apply mul_le_mul_of_nonneg_left _ hδ
|
| 78 |
-
apply Finset.sum_le_sum
|
| 79 |
-
intro j hj
|
| 80 |
-
rw [abs_mul]
|
| 81 |
-
exact mul_le_mul (hc _ (htime j j.isLt.le)) (hm j) (abs_nonneg _) hd
|
| 82 |
-
_=T*d*L*R := by
|
| 83 |
-
simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,stepSize]
|
| 84 |
-
field_simp
|
| 85 |
-
|
| 86 |
-
end SKValue
|
| 87 |
-
|
| 88 |
-
end
|
| 89 |
-
|
| 90 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.CrossMesh
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
|
| 8 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 9 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 10 |
+
namespace SKValue
|
| 11 |
+
|
| 12 |
+
noncomputable def ordinaryMeshSource (T : ℝ) (N : ℕ) (γ β : ℝ → ℝ) (V : ℝ → ℝ → ℝ) : ℝ :=
|
| 13 |
+
stepSize T N*∑ j : Fin N,(β (meshTime T N j)-γ (meshTime T N j))*
|
| 14 |
+
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j))
|
| 15 |
+
(euler T N γ (fun t ↦ deriv (V t)) z j))^2 ∂gaussianProduct (Fin (N+1)))
|
| 16 |
+
|
| 17 |
+
lemma crossMeshSource_half_form (T : ℝ) (N : ℕ) (γ β : ℝ → ℝ) (V U : ℝ → ℝ → ℝ) :
|
| 18 |
+
crossMeshSource T N γ β V U=stepSize T N*∑ j : Fin N,(β (meshTime T N j)-γ (meshTime T N j))*
|
| 19 |
+
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j))
|
| 20 |
+
(euler T N β (crossFeedback V U) z j))^2 ∂gaussianProduct (Fin (N+1))) := by
|
| 21 |
+
unfold crossMeshSource
|
| 22 |
+
rw [Fin.sum_univ_eq_sum_range (fun j : ℕ ↦ (β (meshTime T N j)-γ (meshTime T N j))*
|
| 23 |
+
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j))
|
| 24 |
+
(euler T N β (crossFeedback V U) z j))^2 ∂gaussianProduct (Fin (N+1))))]
|
| 25 |
+
simp only [integral_const_mul,Finset.mul_sum]
|
| 26 |
+
apply Finset.sum_congr rfl
|
| 27 |
+
intro j hj
|
| 28 |
+
ring
|
| 29 |
+
|
| 30 |
+
lemma crossMeshSource_difference_bound {T K L K' L' d R : ℝ}
|
| 31 |
+
{γ β : ℝ → ℝ} {V U : ℝ → ℝ → ℝ}
|
| 32 |
+
(hV : ValueStrip T γ V K L) (hU : ValueStrip T β U K' L')
|
| 33 |
+
(hT : 0≤T) {N : ℕ} (hN : 0<N) (hd : 0≤d) (hR : 0≤R)
|
| 34 |
+
(hc : ∀ t∈Icc (0 : ℝ) T,|β t-γ t|≤d)
|
| 35 |
+
(hY : ∀ z : Fin (N+1) → ℝ,∀ j≤N,
|
| 36 |
+
|euler T N β (crossFeedback V U) z j-euler T N γ (fun t ↦ deriv (V t)) z j|≤R) :
|
| 37 |
+
|crossMeshSource T N γ β V U-ordinaryMeshSource T N γ β V|≤T*d*L*R := by
|
| 38 |
+
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg _)
|
| 39 |
+
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT hN hj
|
| 40 |
+
have hfm (j : ℕ) (hj : j<N) : Measurable (crossFeedback V U (meshTime T N j)) :=
|
| 41 |
+
(((hU.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable.add
|
| 42 |
+
((hV.smooth _ (htime j hj.le)).continuous_deriv (by norm_num)).measurable).div_const 2
|
| 43 |
+
have hfb (j : ℕ) (hj : j<N) (x : ℝ) : |crossFeedback V U (meshTime T N j) x|≤1 :=
|
| 44 |
+
crossFeedback_bound (hV.bounded _ (htime j hj.le) x) (hU.bounded _ (htime j hj.le) x)
|
| 45 |
+
have hm (j : Fin N) :
|
| 46 |
+
|(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2
|
| 47 |
+
∂gaussianProduct (Fin (N+1)))-
|
| 48 |
+
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N γ (fun t ↦ deriv (V t)) z j))^2
|
| 49 |
+
∂gaussianProduct (Fin (N+1)))|≤L*R := by
|
| 50 |
+
have hLip := hV.product_lipschitzWith (htime j j.isLt.le)
|
| 51 |
+
have hM1 := lipschitz_comp_memLp_finite hLip (euler_memLp T N β (crossFeedback V U) hfm hfb j j.isLt.le)
|
| 52 |
+
have hM2 := lipschitz_comp_memLp_finite hLip (euler_memLp T N γ (fun t ↦ deriv (V t))
|
| 53 |
+
(fun k hk ↦ ((hV.smooth _ (htime k hk.le)).continuous_deriv (by norm_num)).measurable)
|
| 54 |
+
(fun k hk x ↦ hV.bounded _ (htime k hk.le) x) j j.isLt.le)
|
| 55 |
+
rw [←integral_sub (f := fun z ↦ (1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2)
|
| 56 |
+
(g := fun z ↦ (1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N γ (fun t ↦ deriv (V t)) z j))^2)
|
| 57 |
+
(hM1.integrable (by norm_num)) (hM2.integrable (by norm_num))]
|
| 58 |
+
apply (abs_integral_le_integral_abs).trans
|
| 59 |
+
calc
|
| 60 |
+
_ ≤ ∫ _ : Fin (N+1) → ℝ,|L*R| ∂gaussianProduct (Fin (N+1)) := by
|
| 61 |
+
apply integral_mono ((hM1.integrable (by norm_num)).sub (hM2.integrable (by norm_num))).norm (integrable_const _)
|
| 62 |
+
intro z
|
| 63 |
+
have hh := hLip.dist_le_mul (euler T N β (crossFeedback V U) z j) (euler T N γ (fun t ↦ deriv (V t)) z j)
|
| 64 |
+
rw [Real.dist_eq,Real.dist_eq,Real.coe_toNNReal _ hV.L_nonneg] at hh
|
| 65 |
+
exact (hh.trans (mul_le_mul_of_nonneg_left (hY z j j.isLt.le) hV.L_nonneg)).trans
|
| 66 |
+
(le_abs_self (L*R))
|
| 67 |
+
_=L*R := by simp [abs_of_nonneg (mul_nonneg hV.L_nonneg hR)]
|
| 68 |
+
rw [crossMeshSource_half_form,ordinaryMeshSource,←mul_sub,←Finset.sum_sub_distrib,
|
| 69 |
+
abs_mul,abs_of_nonneg hδ]
|
| 70 |
+
calc
|
| 71 |
+
_ ≤ stepSize T N*∑ j : Fin N,|(β (meshTime T N j)-γ (meshTime T N j))*
|
| 72 |
+
((∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N β (crossFeedback V U) z j))^2 ∂gaussianProduct (Fin (N+1)))-
|
| 73 |
+
(∫ z,(1/2 : ℝ)*(deriv (V (meshTime T N j)) (euler T N γ (fun t ↦ deriv (V t)) z j))^2 ∂gaussianProduct (Fin (N+1))))| := by
|
| 74 |
+
simp_rw [←mul_sub]
|
| 75 |
+
exact mul_le_mul_of_nonneg_left (Finset.abs_sum_le_sum_abs _ _) hδ
|
| 76 |
+
_ ≤ stepSize T N*∑ _ : Fin N,d*(L*R) := by
|
| 77 |
+
apply mul_le_mul_of_nonneg_left _ hδ
|
| 78 |
+
apply Finset.sum_le_sum
|
| 79 |
+
intro j hj
|
| 80 |
+
rw [abs_mul]
|
| 81 |
+
exact mul_le_mul (hc _ (htime j j.isLt.le)) (hm j) (abs_nonneg _) hd
|
| 82 |
+
_=T*d*L*R := by
|
| 83 |
+
simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,stepSize]
|
| 84 |
+
field_simp
|
| 85 |
+
|
| 86 |
+
end SKValue
|
| 87 |
+
|
| 88 |
+
end
|
| 89 |
+
|
| 90 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/CrossValueBound.lean
CHANGED
|
@@ -1,108 +1,108 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.CrossMeshComparison
|
| 3 |
-
import OAI.Probability.SKValue.Variation.WeightedMoments
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
-
namespace SKValue
|
| 12 |
-
|
| 13 |
-
lemma ordinaryMeshSource_eq (W : BrownianSpace) (γ β : OrderParameter) (T : ℝ) (N : ℕ) :
|
| 14 |
-
ordinaryMeshSource T N γ.coeff β.coeff (phi W γ)=
|
| 15 |
-
weightedEulerMoment W γ β T N-weightedEulerMoment W γ γ T N := by
|
| 16 |
-
have he : gradient W γ=(fun t ↦ deriv (phi W γ t)) := rfl
|
| 17 |
-
simp only [ordinaryMeshSource,weightedEulerMoment,he,←mul_sub,←Finset.sum_sub_distrib]
|
| 18 |
-
congr 1
|
| 19 |
-
apply Finset.sum_congr rfl
|
| 20 |
-
intro j hj
|
| 21 |
-
ring
|
| 22 |
-
|
| 23 |
-
lemma IsDiffusion.cross_value_bound {W : BrownianSpace} {γ : OrderParameter}
|
| 24 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (β : OrderParameter)
|
| 25 |
-
{T Kv Lv Lu d e : ℝ} (hT : 0<T) (hT1 : T<1)
|
| 26 |
-
(hV : ValueStrip T γ.coeff (phi W γ) Kv Lv)
|
| 27 |
-
(hLu : 0≤Lu) (hd : 0≤d) (he : 0≤e)
|
| 28 |
-
(hc : ∀ t∈Icc (0 : ℝ) T,|(β.coeff t)-(γ.coeff t)|≤d)
|
| 29 |
-
(hu : ∀ t∈Icc (0 : ℝ) T,∀ x y,|gradient W γ t x-gradient W γ t y|≤Lu*|x-y|)
|
| 30 |
-
(hs : ∀ t∈Icc (0 : ℝ) T,∀ x,|gradient W β t x-gradient W γ t x|≤e) :
|
| 31 |
-
phi W β 0 0-phi W γ 0 0≤
|
| 32 |
-
(3/2 : ℝ)*(∫ t in T..1,|β.cutoff t-γ.cutoff t|)+
|
| 33 |
-
((∫ t in (0 : ℝ)..T,β.coeff t*(∫ ω,(1/2 : ℝ)*(gradient W γ t (X t ω))^2 ∂W.μ))-
|
| 34 |
-
(∫ t in (0 : ℝ)..T,γ.coeff t*(∫ ω,(1/2 : ℝ)*(gradient W γ t (X t ω))^2 ∂W.μ)))+
|
| 35 |
-
T*d*Lv*(T*(d+γ.coeff T*e)*Real.exp (T*γ.coeff T*Lu)) := by
|
| 36 |
-
obtain ⟨Kv',Lv',K',L',D',Lu',La',hU,rest⟩ := sourceStripRegularity W β T ⟨hT.le,hT1⟩
|
| 37 |
-
let G := max (γ.coeff T) (β.coeff T)
|
| 38 |
-
let R := T*(d+γ.coeff T*e)*Real.exp (T*γ.coeff T*Lu)
|
| 39 |
-
let B := (3/2 : ℝ)*(∫ t in T..1,|β.cutoff t-γ.cutoff t|)
|
| 40 |
-
let err (N : ℕ) :=
|
| 41 |
-
T*Real.sqrt (stepSize T N)*(cubicEnvelopeMean G Kv ((1/2+G)*Lv)+
|
| 42 |
-
cubicEnvelopeMean G Kv' ((1/2+G)*Lv'))+
|
| 43 |
-
stepSize T N*Kv*(γ.coeff T-γ.coeff 0)+stepSize T N*Kv'*(β.coeff T-β.coeff 0)
|
| 44 |
-
have hγT : 0≤γ.coeff T := γ.nonneg T ⟨hT.le,hT1⟩
|
| 45 |
-
have hR : 0≤R := by dsimp [R]; positivity
|
| 46 |
-
have heN (N : ℕ) (hN : 0<N) : phi W β 0 0-phi W γ 0 0≤
|
| 47 |
-
B+(weightedEulerMoment W γ β T N-weightedEulerMoment W γ γ T N)+T*d*Lv*R+err N := by
|
| 48 |
-
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT.le hN hj
|
| 49 |
-
have hfb (t : ℝ) (ht : t∈Icc (0 : ℝ) T) (x : ℝ) :
|
| 50 |
-
|crossFeedback (phi W γ) (phi W β) t x|≤1 :=
|
| 51 |
-
crossFeedback_bound (hV.bounded t ht x) (hU.bounded t ht x)
|
| 52 |
-
have hfs (t : ℝ) (ht : t∈Icc (0 : ℝ) T) (x : ℝ) :
|
| 53 |
-
|crossFeedback (phi W γ) (phi W β) t x-gradient W γ t x|≤e := by
|
| 54 |
-
have hh := hs t ht x
|
| 55 |
-
have hh' : |crossFeedback (phi W γ) (phi W β) t x-gradient W γ t x|=
|
| 56 |
-
|gradient W β t x-gradient W γ t x|/2 := by
|
| 57 |
-
dsimp only [crossFeedback,gradient]
|
| 58 |
-
rw [show (deriv (phi W β t) x+deriv (phi W γ t) x)/2-deriv (phi W γ t) x=
|
| 59 |
-
(deriv (phi W β t) x-deriv (phi W γ t) x)/2 by ring,abs_div,abs_of_pos (by norm_num : (0 : ℝ)<2)]
|
| 60 |
-
rw [hh']
|
| 61 |
-
linarith
|
| 62 |
-
have hY (z : Fin (N+1) → ℝ) (j : ℕ) (hj : j≤N) :
|
| 63 |
-
|euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z j-
|
| 64 |
-
euler T N γ.coeff (gradient W γ) z j|≤R := by
|
| 65 |
-
apply euler_same_noise_bound hT.le hN hγT hLu hd he
|
| 66 |
-
· intro k hk
|
| 67 |
-
rw [abs_of_nonneg (γ.nonneg _ ⟨(htime k hk.le).1,(htime k hk.le).2.trans_lt hT1⟩)]
|
| 68 |
-
exact γ.monotone ⟨(htime k hk.le).1,(htime k hk.le).2.trans_lt hT1⟩ ⟨hT.le,hT1⟩ (htime k hk.le).2
|
| 69 |
-
· intro k hk; exact hc _ (htime k hk.le)
|
| 70 |
-
· intro k hk; exact hfb _ (htime k hk.le)
|
| 71 |
-
· intro k hk; exact hfs _ (htime k hk.le)
|
| 72 |
-
· intro k hk; exact hu _ (htime k hk.le)
|
| 73 |
-
· exact hj
|
| 74 |
-
have htelescope := cross_value_mesh_expectation hV hU hT hT1.le
|
| 75 |
-
(le_max_left _ _ : γ.coeff T≤G) (le_max_right _ _ : β.coeff T≤G) hN
|
| 76 |
-
have hcompare := crossMeshSource_difference_bound hV hU hT.le hN hd hR hc hY
|
| 77 |
-
rw [ordinaryMeshSource_eq] at hcompare
|
| 78 |
-
have hterminal : (∫ z,phi W β T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N)-
|
| 79 |
-
phi W γ T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N)
|
| 80 |
-
∂gaussianProduct (Fin (N+1)))≤B := by
|
| 81 |
-
apply (le_abs_self _).trans
|
| 82 |
-
simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using
|
| 83 |
-
(norm_integral_le_of_norm_le_const (μ := gaussianProduct (Fin (N+1))) (C := B)
|
| 84 |
-
(f := fun z ↦ phi W β T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N)-
|
| 85 |
-
phi W γ T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N))
|
| 86 |
-
(Eventually.of_forall (fun z ↦ phi_difference_bound W γ β ⟨hT.le,hT1.le⟩ _)))
|
| 87 |
-
have htlow := (abs_le.mp htelescope).1
|
| 88 |
-
have hcup := (abs_le.mp hcompare).2
|
| 89 |
-
dsimp only [err]
|
| 90 |
-
linarith
|
| 91 |
-
have hδ : Tendsto (fun N : ℕ ↦ stepSize T N) atTop (𝓝 (0 : ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 92 |
-
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 93 |
-
have herr : Tendsto err atTop (𝓝 0) := by
|
| 94 |
-
simpa only [err,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,zero_add] using
|
| 95 |
-
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean G Kv ((1/2+G)*Lv)+
|
| 96 |
-
cubicEnvelopeMean G Kv' ((1/2+G)*Lv'))).add
|
| 97 |
-
((hδ.mul_const Kv).mul_const (γ.coeff T-γ.coeff 0))).add
|
| 98 |
-
((hδ.mul_const Kv').mul_const (β.coeff T-β.coeff 0))
|
| 99 |
-
have hlim := (((((hX.weightedEulerMoment_tendsto β hT hT1).sub
|
| 100 |
-
(hX.weightedEulerMoment_tendsto γ hT hT1)).const_add B).add_const (T*d*Lv*R)).add herr)
|
| 101 |
-
have hh := ge_of_tendsto hlim (by filter_upwards [eventually_gt_atTop 0] with N hN using heN N hN)
|
| 102 |
-
simpa only [add_zero,B,R] using hh
|
| 103 |
-
|
| 104 |
-
end SKValue
|
| 105 |
-
|
| 106 |
-
end
|
| 107 |
-
|
| 108 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.CrossMeshComparison
|
| 3 |
+
import OAI.Probability.SKValue.Variation.WeightedMoments
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 11 |
+
namespace SKValue
|
| 12 |
+
|
| 13 |
+
lemma ordinaryMeshSource_eq (W : BrownianSpace) (γ β : OrderParameter) (T : ℝ) (N : ℕ) :
|
| 14 |
+
ordinaryMeshSource T N γ.coeff β.coeff (phi W γ)=
|
| 15 |
+
weightedEulerMoment W γ β T N-weightedEulerMoment W γ γ T N := by
|
| 16 |
+
have he : gradient W γ=(fun t ↦ deriv (phi W γ t)) := rfl
|
| 17 |
+
simp only [ordinaryMeshSource,weightedEulerMoment,he,←mul_sub,←Finset.sum_sub_distrib]
|
| 18 |
+
congr 1
|
| 19 |
+
apply Finset.sum_congr rfl
|
| 20 |
+
intro j hj
|
| 21 |
+
ring
|
| 22 |
+
|
| 23 |
+
lemma IsDiffusion.cross_value_bound {W : BrownianSpace} {γ : OrderParameter}
|
| 24 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (β : OrderParameter)
|
| 25 |
+
{T Kv Lv Lu d e : ℝ} (hT : 0<T) (hT1 : T<1)
|
| 26 |
+
(hV : ValueStrip T γ.coeff (phi W γ) Kv Lv)
|
| 27 |
+
(hLu : 0≤Lu) (hd : 0≤d) (he : 0≤e)
|
| 28 |
+
(hc : ∀ t∈Icc (0 : ℝ) T,|(β.coeff t)-(γ.coeff t)|≤d)
|
| 29 |
+
(hu : ∀ t∈Icc (0 : ℝ) T,∀ x y,|gradient W γ t x-gradient W γ t y|≤Lu*|x-y|)
|
| 30 |
+
(hs : ∀ t∈Icc (0 : ℝ) T,∀ x,|gradient W β t x-gradient W γ t x|≤e) :
|
| 31 |
+
phi W β 0 0-phi W γ 0 0≤
|
| 32 |
+
(3/2 : ℝ)*(∫ t in T..1,|β.cutoff t-γ.cutoff t|)+
|
| 33 |
+
((∫ t in (0 : ℝ)..T,β.coeff t*(∫ ω,(1/2 : ℝ)*(gradient W γ t (X t ω))^2 ∂W.μ))-
|
| 34 |
+
(∫ t in (0 : ℝ)..T,γ.coeff t*(∫ ω,(1/2 : ℝ)*(gradient W γ t (X t ω))^2 ∂W.μ)))+
|
| 35 |
+
T*d*Lv*(T*(d+γ.coeff T*e)*Real.exp (T*γ.coeff T*Lu)) := by
|
| 36 |
+
obtain ⟨Kv',Lv',K',L',D',Lu',La',hU,rest⟩ := sourceStripRegularity W β T ⟨hT.le,hT1⟩
|
| 37 |
+
let G := max (γ.coeff T) (β.coeff T)
|
| 38 |
+
let R := T*(d+γ.coeff T*e)*Real.exp (T*γ.coeff T*Lu)
|
| 39 |
+
let B := (3/2 : ℝ)*(∫ t in T..1,|β.cutoff t-γ.cutoff t|)
|
| 40 |
+
let err (N : ℕ) :=
|
| 41 |
+
T*Real.sqrt (stepSize T N)*(cubicEnvelopeMean G Kv ((1/2+G)*Lv)+
|
| 42 |
+
cubicEnvelopeMean G Kv' ((1/2+G)*Lv'))+
|
| 43 |
+
stepSize T N*Kv*(γ.coeff T-γ.coeff 0)+stepSize T N*Kv'*(β.coeff T-β.coeff 0)
|
| 44 |
+
have hγT : 0≤γ.coeff T := γ.nonneg T ⟨hT.le,hT1⟩
|
| 45 |
+
have hR : 0≤R := by dsimp [R]; positivity
|
| 46 |
+
have heN (N : ℕ) (hN : 0<N) : phi W β 0 0-phi W γ 0 0≤
|
| 47 |
+
B+(weightedEulerMoment W γ β T N-weightedEulerMoment W γ γ T N)+T*d*Lv*R+err N := by
|
| 48 |
+
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT.le hN hj
|
| 49 |
+
have hfb (t : ℝ) (ht : t∈Icc (0 : ℝ) T) (x : ℝ) :
|
| 50 |
+
|crossFeedback (phi W γ) (phi W β) t x|≤1 :=
|
| 51 |
+
crossFeedback_bound (hV.bounded t ht x) (hU.bounded t ht x)
|
| 52 |
+
have hfs (t : ℝ) (ht : t∈Icc (0 : ℝ) T) (x : ℝ) :
|
| 53 |
+
|crossFeedback (phi W γ) (phi W β) t x-gradient W γ t x|≤e := by
|
| 54 |
+
have hh := hs t ht x
|
| 55 |
+
have hh' : |crossFeedback (phi W γ) (phi W β) t x-gradient W γ t x|=
|
| 56 |
+
|gradient W β t x-gradient W γ t x|/2 := by
|
| 57 |
+
dsimp only [crossFeedback,gradient]
|
| 58 |
+
rw [show (deriv (phi W β t) x+deriv (phi W γ t) x)/2-deriv (phi W γ t) x=
|
| 59 |
+
(deriv (phi W β t) x-deriv (phi W γ t) x)/2 by ring,abs_div,abs_of_pos (by norm_num : (0 : ℝ)<2)]
|
| 60 |
+
rw [hh']
|
| 61 |
+
linarith
|
| 62 |
+
have hY (z : Fin (N+1) → ℝ) (j : ℕ) (hj : j≤N) :
|
| 63 |
+
|euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z j-
|
| 64 |
+
euler T N γ.coeff (gradient W γ) z j|≤R := by
|
| 65 |
+
apply euler_same_noise_bound hT.le hN hγT hLu hd he
|
| 66 |
+
· intro k hk
|
| 67 |
+
rw [abs_of_nonneg (γ.nonneg _ ⟨(htime k hk.le).1,(htime k hk.le).2.trans_lt hT1⟩)]
|
| 68 |
+
exact γ.monotone ⟨(htime k hk.le).1,(htime k hk.le).2.trans_lt hT1⟩ ⟨hT.le,hT1⟩ (htime k hk.le).2
|
| 69 |
+
· intro k hk; exact hc _ (htime k hk.le)
|
| 70 |
+
· intro k hk; exact hfb _ (htime k hk.le)
|
| 71 |
+
· intro k hk; exact hfs _ (htime k hk.le)
|
| 72 |
+
· intro k hk; exact hu _ (htime k hk.le)
|
| 73 |
+
· exact hj
|
| 74 |
+
have htelescope := cross_value_mesh_expectation hV hU hT hT1.le
|
| 75 |
+
(le_max_left _ _ : γ.coeff T≤G) (le_max_right _ _ : β.coeff T≤G) hN
|
| 76 |
+
have hcompare := crossMeshSource_difference_bound hV hU hT.le hN hd hR hc hY
|
| 77 |
+
rw [ordinaryMeshSource_eq] at hcompare
|
| 78 |
+
have hterminal : (∫ z,phi W β T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N)-
|
| 79 |
+
phi W γ T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N)
|
| 80 |
+
∂gaussianProduct (Fin (N+1)))≤B := by
|
| 81 |
+
apply (le_abs_self _).trans
|
| 82 |
+
simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using
|
| 83 |
+
(norm_integral_le_of_norm_le_const (μ := gaussianProduct (Fin (N+1))) (C := B)
|
| 84 |
+
(f := fun z ↦ phi W β T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N)-
|
| 85 |
+
phi W γ T (euler T N β.coeff (crossFeedback (phi W γ) (phi W β)) z N))
|
| 86 |
+
(Eventually.of_forall (fun z ↦ phi_difference_bound W γ β ⟨hT.le,hT1.le⟩ _)))
|
| 87 |
+
have htlow := (abs_le.mp htelescope).1
|
| 88 |
+
have hcup := (abs_le.mp hcompare).2
|
| 89 |
+
dsimp only [err]
|
| 90 |
+
linarith
|
| 91 |
+
have hδ : Tendsto (fun N : ℕ ↦ stepSize T N) atTop (𝓝 (0 : ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 92 |
+
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 93 |
+
have herr : Tendsto err atTop (𝓝 0) := by
|
| 94 |
+
simpa only [err,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,zero_add] using
|
| 95 |
+
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean G Kv ((1/2+G)*Lv)+
|
| 96 |
+
cubicEnvelopeMean G Kv' ((1/2+G)*Lv'))).add
|
| 97 |
+
((hδ.mul_const Kv).mul_const (γ.coeff T-γ.coeff 0))).add
|
| 98 |
+
((hδ.mul_const Kv').mul_const (β.coeff T-β.coeff 0))
|
| 99 |
+
have hlim := (((((hX.weightedEulerMoment_tendsto β hT hT1).sub
|
| 100 |
+
(hX.weightedEulerMoment_tendsto γ hT hT1)).const_add B).add_const (T*d*Lv*R)).add herr)
|
| 101 |
+
have hh := ge_of_tendsto hlim (by filter_upwards [eventually_gt_atTop 0] with N hN using heN N hN)
|
| 102 |
+
simpa only [add_zero,B,R] using hh
|
| 103 |
+
|
| 104 |
+
end SKValue
|
| 105 |
+
|
| 106 |
+
end
|
| 107 |
+
|
| 108 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/CurvatureNonneg.lean
CHANGED
|
@@ -1,43 +1,43 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Coercivity.LiteralCoercivity
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 8 |
-
open scoped Topology NNReal
|
| 9 |
-
namespace SKValue
|
| 10 |
-
lemma IsDiffusion.curvature_generator_nonneg {W:BrownianSpace} {γ:OrderParameter} {X:ℝ → W.Ω → ℝ}
|
| 11 |
-
(hX:IsDiffusion W γ X) {t:ℝ} (ht:t∈Ioo (0:ℝ) 1):
|
| 12 |
-
0≤∫ z,(iteratedDeriv 3 (deriv (phi W γ t)) (X t z))^2-
|
| 13 |
-
12*γ.coeff t*iteratedDeriv 1 (deriv (phi W γ t)) (X t z)*(iteratedDeriv 2 (deriv (phi W γ t)) (X t z))^2+
|
| 14 |
-
6*(γ.coeff t)^2*(iteratedDeriv 1 (deriv (phi W γ t)) (X t z))^4 ∂W.μ := by
|
| 15 |
-
have hc:=γ.nonneg t ⟨ht.1.le,ht.2⟩
|
| 16 |
-
rcases hc.eq_or_lt with hc|hc
|
| 17 |
-
· rw [←hc]
|
| 18 |
-
simp only [mul_zero,zero_mul,sub_zero,zero_pow (by norm_num: (2:ℕ)≠0),add_zero]
|
| 19 |
-
exact integral_nonneg (fun z ↦ sq_nonneg _)
|
| 20 |
-
· have h:=hX.literal_coercivity ⟨t,ht⟩
|
| 21 |
-
have hn:0≤(1/1000:ℝ)*(∫ z,(spatialJet (γ.coeff t) (phi W γ t) 1 (X t z))^4 ∂W.μ) := by
|
| 22 |
-
apply mul_nonneg (by norm_num)
|
| 23 |
-
exact integral_nonneg (fun z ↦ by positivity)
|
| 24 |
-
have hn:=hn.trans h
|
| 25 |
-
have he:(fun z ↦ (spatialJet (γ.coeff t) (phi W γ t) 3 (X t z))^2-
|
| 26 |
-
12*spatialJet (γ.coeff t) (phi W γ t) 1 (X t z)*(spatialJet (γ.coeff t) (phi W γ t) 2 (X t z))^2+
|
| 27 |
-
6*(spatialJet (γ.coeff t) (phi W γ t) 1 (X t z))^4)=
|
| 28 |
-
(fun z ↦ (γ.coeff t)^2*((iteratedDeriv 3 (deriv (phi W γ t)) (X t z))^2-
|
| 29 |
-
12*γ.coeff t*iteratedDeriv 1 (deriv (phi W γ t)) (X t z)*(iteratedDeriv 2 (deriv (phi W γ t)) (X t z))^2+
|
| 30 |
-
6*(γ.coeff t)^2*(iteratedDeriv 1 (deriv (phi W γ t)) (X t z))^4)) := by
|
| 31 |
-
funext z
|
| 32 |
-
simp only [spatialJet]
|
| 33 |
-
ring
|
| 34 |
-
change 0≤∫ z,(spatialJet (γ.coeff t) (phi W γ t) 3 (X t z))^2-
|
| 35 |
-
12*spatialJet (γ.coeff t) (phi W γ t) 1 (X t z)*(spatialJet (γ.coeff t) (phi W γ t) 2 (X t z))^2+
|
| 36 |
-
6*(spatialJet (γ.coeff t) (phi W γ t) 1 (X t z))^4 ∂W.μ at hn
|
| 37 |
-
rw [he,integral_const_mul] at hn
|
| 38 |
-
exact nonneg_of_mul_nonneg_right hn (sq_pos_of_pos hc)
|
| 39 |
-
end SKValue
|
| 40 |
-
|
| 41 |
-
end
|
| 42 |
-
|
| 43 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Coercivity.LiteralCoercivity
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 8 |
+
open scoped Topology NNReal
|
| 9 |
+
namespace SKValue
|
| 10 |
+
lemma IsDiffusion.curvature_generator_nonneg {W:BrownianSpace} {γ:OrderParameter} {X:ℝ → W.Ω → ℝ}
|
| 11 |
+
(hX:IsDiffusion W γ X) {t:ℝ} (ht:t∈Ioo (0:ℝ) 1):
|
| 12 |
+
0≤∫ z,(iteratedDeriv 3 (deriv (phi W γ t)) (X t z))^2-
|
| 13 |
+
12*γ.coeff t*iteratedDeriv 1 (deriv (phi W γ t)) (X t z)*(iteratedDeriv 2 (deriv (phi W γ t)) (X t z))^2+
|
| 14 |
+
6*(γ.coeff t)^2*(iteratedDeriv 1 (deriv (phi W γ t)) (X t z))^4 ∂W.μ := by
|
| 15 |
+
have hc:=γ.nonneg t ⟨ht.1.le,ht.2⟩
|
| 16 |
+
rcases hc.eq_or_lt with hc|hc
|
| 17 |
+
· rw [←hc]
|
| 18 |
+
simp only [mul_zero,zero_mul,sub_zero,zero_pow (by norm_num: (2:ℕ)≠0),add_zero]
|
| 19 |
+
exact integral_nonneg (fun z ↦ sq_nonneg _)
|
| 20 |
+
· have h:=hX.literal_coercivity ⟨t,ht⟩
|
| 21 |
+
have hn:0≤(1/1000:ℝ)*(∫ z,(spatialJet (γ.coeff t) (phi W γ t) 1 (X t z))^4 ∂W.μ) := by
|
| 22 |
+
apply mul_nonneg (by norm_num)
|
| 23 |
+
exact integral_nonneg (fun z ↦ by positivity)
|
| 24 |
+
have hn:=hn.trans h
|
| 25 |
+
have he:(fun z ↦ (spatialJet (γ.coeff t) (phi W γ t) 3 (X t z))^2-
|
| 26 |
+
12*spatialJet (γ.coeff t) (phi W γ t) 1 (X t z)*(spatialJet (γ.coeff t) (phi W γ t) 2 (X t z))^2+
|
| 27 |
+
6*(spatialJet (γ.coeff t) (phi W γ t) 1 (X t z))^4)=
|
| 28 |
+
(fun z ↦ (γ.coeff t)^2*((iteratedDeriv 3 (deriv (phi W γ t)) (X t z))^2-
|
| 29 |
+
12*γ.coeff t*iteratedDeriv 1 (deriv (phi W γ t)) (X t z)*(iteratedDeriv 2 (deriv (phi W γ t)) (X t z))^2+
|
| 30 |
+
6*(γ.coeff t)^2*(iteratedDeriv 1 (deriv (phi W γ t)) (X t z))^4)) := by
|
| 31 |
+
funext z
|
| 32 |
+
simp only [spatialJet]
|
| 33 |
+
ring
|
| 34 |
+
change 0≤∫ z,(spatialJet (γ.coeff t) (phi W γ t) 3 (X t z))^2-
|
| 35 |
+
12*spatialJet (γ.coeff t) (phi W γ t) 1 (X t z)*(spatialJet (γ.coeff t) (phi W γ t) 2 (X t z))^2+
|
| 36 |
+
6*(spatialJet (γ.coeff t) (phi W γ t) 1 (X t z))^4 ∂W.μ at hn
|
| 37 |
+
rw [he,integral_const_mul] at hn
|
| 38 |
+
exact nonneg_of_mul_nonneg_right hn (sq_pos_of_pos hc)
|
| 39 |
+
end SKValue
|
| 40 |
+
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/DiffusionExistence.lean
CHANGED
|
@@ -1,84 +1,84 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.EulerLimitProcess
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 8 |
-
open scoped Topology NNReal
|
| 9 |
-
namespace SKValue
|
| 10 |
-
noncomputable def terminalEulerProcess (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω):ℝ :=
|
| 11 |
-
limsup (fun n:ℕ ↦ eulerLimitProcess W γ (terminalTime n) z) atTop
|
| 12 |
-
noncomputable def diffusionProcess (W:BrownianSpace) (γ:OrderParameter) (t:ℝ) (z:W.Ω):ℝ :=
|
| 13 |
-
if t<1 then eulerLimitProcess W γ t z else terminalEulerProcess W γ z
|
| 14 |
-
lemma terminalEulerProcess_measurable (W:BrownianSpace) (γ:OrderParameter):
|
| 15 |
-
StronglyMeasurable[W.filtration 1] (terminalEulerProcess W γ) :=by
|
| 16 |
-
apply Measurable.stronglyMeasurable
|
| 17 |
-
apply Measurable.limsup
|
| 18 |
-
intro n
|
| 19 |
-
apply ((eulerLimitProcess_measurable W γ (terminalTime n)).mono ?_).measurable
|
| 20 |
-
apply W.filtration.mono
|
| 21 |
-
exact Real.toNNReal_le_iff_le_coe.mpr (terminalTime_mem n).2.le
|
| 22 |
-
lemma diffusionProcess_measurable (W:BrownianSpace) (γ:OrderParameter) {t:ℝ}:
|
| 23 |
-
StronglyMeasurable[W.filtration t.toNNReal] (diffusionProcess W γ t) :=by
|
| 24 |
-
change StronglyMeasurable[W.filtration t.toNNReal] (fun z ↦ if t<1 then eulerLimitProcess W γ t z else terminalEulerProcess W γ z)
|
| 25 |
-
by_cases ht:t<1
|
| 26 |
-
· simp only [ite_eq_left ht]
|
| 27 |
-
exact eulerLimitProcess_measurable W γ t
|
| 28 |
-
· simp only [ite_eq_right ht]
|
| 29 |
-
apply (terminalEulerProcess_measurable W γ).mono (W.filtration.mono ?_)
|
| 30 |
-
exact (Real.le_toNNReal_iff_coe_le (zero_le_one.trans (not_lt.mp ht))).mpr (not_lt.mp ht)
|
| 31 |
-
lemma diffusionProcess_adapted (W:BrownianSpace) (γ:OrderParameter):
|
| 32 |
-
Adapted W.filtration (fun t z ↦ diffusionProcess W γ (min (t:ℝ) 1) z) :=by
|
| 33 |
-
intro t
|
| 34 |
-
apply ((diffusionProcess_measurable W γ (t:=min (t:ℝ) 1)).mono ?_).measurable
|
| 35 |
-
apply W.filtration.mono
|
| 36 |
-
exact Real.toNNReal_le_iff_le_coe.mpr (min_le_left _ _)
|
| 37 |
-
lemma diffusionProcess_path (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 38 |
-
(hb:Continuous (fun t:ℝ ↦ W.B t.toNNReal z)) (h0:W.B 0 z=0):
|
| 39 |
-
ContinuousOn (fun t ↦ diffusionProcess W γ t z) (Icc (0:ℝ) 1) ∧
|
| 40 |
-
∀t∈Icc (0:ℝ) 1,diffusionProcess W γ t z=W.B t.toNNReal z+
|
| 41 |
-
∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (diffusionProcess W γ s z) :=by
|
| 42 |
-
let f:=fun s ↦ γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z)
|
| 43 |
-
let F:=fun t ↦ W.B t.toNNReal z+∫s in (0:ℝ)..t,f s
|
| 44 |
-
have hi:IntervalIntegrable f volume 0 1:=eulerLimitProcess_drift_integrable W γ z hb h0
|
| 45 |
-
have hc:ContinuousOn F (Icc (0:ℝ) 1):=by
|
| 46 |
-
apply hb.continuousOn.add
|
| 47 |
-
simpa only [uIcc_of_le (by norm_num:(0:ℝ)≤1)] using
|
| 48 |
-
intervalIntegral.continuousOn_primitive_interval' hi left_mem_uIcc
|
| 49 |
-
have he:∀t∈Ico (0:ℝ) 1,eulerLimitProcess W γ t z=F t:=by
|
| 50 |
-
intro t ht
|
| 51 |
-
exact (eulerLimitProcess_local_path W γ z hb h0 ht).2.2 t ⟨ht.1,le_rfl⟩
|
| 52 |
-
have hl:Tendsto (fun n ↦ eulerLimitProcess W γ (terminalTime n) z) atTop (𝓝 (F 1)):=by
|
| 53 |
-
have htime:Tendsto terminalTime atTop (𝓝[Icc (0:ℝ) 1] (1:ℝ)):=
|
| 54 |
-
tendsto_nhdsWithin_iff.mpr ⟨(tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1,
|
| 55 |
-
Eventually.of_forall (fun n ↦ ⟨(terminalTime_mem n).1,(terminalTime_mem n).2.le⟩)⟩
|
| 56 |
-
apply ((hc 1 ⟨by norm_num,le_rfl⟩).tendsto.comp htime).congr
|
| 57 |
-
intro n
|
| 58 |
-
exact (he _ (terminalTime_mem n)).symm
|
| 59 |
-
have hU:terminalEulerProcess W γ z=F 1:=hl.limsup_eq
|
| 60 |
-
have hEq (t:ℝ) (ht:t∈Icc (0:ℝ) 1):diffusionProcess W γ t z=F t:=by
|
| 61 |
-
by_cases ht1:t<1
|
| 62 |
-
· simpa only [diffusionProcess,ite_eq_left ht1] using he t ⟨ht.1,ht1⟩
|
| 63 |
-
· have ht':t=1:=le_antisymm ht.2 (not_lt.mp ht1)
|
| 64 |
-
subst t
|
| 65 |
-
simpa only [diffusionProcess,lt_self_iff_false,ite_false] using hU
|
| 66 |
-
refine ⟨hc.congr hEq,?_⟩
|
| 67 |
-
intro t ht
|
| 68 |
-
rw [hEq t ht]
|
| 69 |
-
change W.B t.toNNReal z+(∫s in (0:ℝ)..t,f s)=_
|
| 70 |
-
congr 1
|
| 71 |
-
apply intervalIntegral.integral_congr_Ioo_of_le ht.1
|
| 72 |
-
intro s hs
|
| 73 |
-
simp only [f,diffusionProcess,ite_eq_left (hs.2.trans_le ht.2)]
|
| 74 |
-
theorem diffusionProcess_isDiffusion (W:BrownianSpace) (γ:OrderParameter):IsDiffusion W γ (diffusionProcess W γ) :=by
|
| 75 |
-
refine ⟨diffusionProcess_adapted W γ,?_⟩
|
| 76 |
-
filter_upwards [W.brownian.cont,W.brownian.toIsPreBrownianReal.eval_zero_ae_eq_zero] with z hz h0
|
| 77 |
-
exact diffusionProcess_path W γ z (hz.comp (by fun_prop:Continuous (fun t:ℝ ↦ t.toNNReal))) h0
|
| 78 |
-
lemma exists_diffusion (W:BrownianSpace) (γ:OrderParameter):∃X:ℝ → W.Ω → ℝ,IsDiffusion W γ X:=
|
| 79 |
-
⟨diffusionProcess W γ,diffusionProcess_isDiffusion W γ⟩
|
| 80 |
-
end SKValue
|
| 81 |
-
|
| 82 |
-
end
|
| 83 |
-
|
| 84 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.EulerLimitProcess
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 8 |
+
open scoped Topology NNReal
|
| 9 |
+
namespace SKValue
|
| 10 |
+
noncomputable def terminalEulerProcess (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω):ℝ :=
|
| 11 |
+
limsup (fun n:ℕ ↦ eulerLimitProcess W γ (terminalTime n) z) atTop
|
| 12 |
+
noncomputable def diffusionProcess (W:BrownianSpace) (γ:OrderParameter) (t:ℝ) (z:W.Ω):ℝ :=
|
| 13 |
+
if t<1 then eulerLimitProcess W γ t z else terminalEulerProcess W γ z
|
| 14 |
+
lemma terminalEulerProcess_measurable (W:BrownianSpace) (γ:OrderParameter):
|
| 15 |
+
StronglyMeasurable[W.filtration 1] (terminalEulerProcess W γ) :=by
|
| 16 |
+
apply Measurable.stronglyMeasurable
|
| 17 |
+
apply Measurable.limsup
|
| 18 |
+
intro n
|
| 19 |
+
apply ((eulerLimitProcess_measurable W γ (terminalTime n)).mono ?_).measurable
|
| 20 |
+
apply W.filtration.mono
|
| 21 |
+
exact Real.toNNReal_le_iff_le_coe.mpr (terminalTime_mem n).2.le
|
| 22 |
+
lemma diffusionProcess_measurable (W:BrownianSpace) (γ:OrderParameter) {t:ℝ}:
|
| 23 |
+
StronglyMeasurable[W.filtration t.toNNReal] (diffusionProcess W γ t) :=by
|
| 24 |
+
change StronglyMeasurable[W.filtration t.toNNReal] (fun z ↦ if t<1 then eulerLimitProcess W γ t z else terminalEulerProcess W γ z)
|
| 25 |
+
by_cases ht:t<1
|
| 26 |
+
· simp only [ite_eq_left ht]
|
| 27 |
+
exact eulerLimitProcess_measurable W γ t
|
| 28 |
+
· simp only [ite_eq_right ht]
|
| 29 |
+
apply (terminalEulerProcess_measurable W γ).mono (W.filtration.mono ?_)
|
| 30 |
+
exact (Real.le_toNNReal_iff_coe_le (zero_le_one.trans (not_lt.mp ht))).mpr (not_lt.mp ht)
|
| 31 |
+
lemma diffusionProcess_adapted (W:BrownianSpace) (γ:OrderParameter):
|
| 32 |
+
Adapted W.filtration (fun t z ↦ diffusionProcess W γ (min (t:ℝ) 1) z) :=by
|
| 33 |
+
intro t
|
| 34 |
+
apply ((diffusionProcess_measurable W γ (t:=min (t:ℝ) 1)).mono ?_).measurable
|
| 35 |
+
apply W.filtration.mono
|
| 36 |
+
exact Real.toNNReal_le_iff_le_coe.mpr (min_le_left _ _)
|
| 37 |
+
lemma diffusionProcess_path (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 38 |
+
(hb:Continuous (fun t:ℝ ↦ W.B t.toNNReal z)) (h0:W.B 0 z=0):
|
| 39 |
+
ContinuousOn (fun t ↦ diffusionProcess W γ t z) (Icc (0:ℝ) 1) ∧
|
| 40 |
+
∀t∈Icc (0:ℝ) 1,diffusionProcess W γ t z=W.B t.toNNReal z+
|
| 41 |
+
∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (diffusionProcess W γ s z) :=by
|
| 42 |
+
let f:=fun s ↦ γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z)
|
| 43 |
+
let F:=fun t ↦ W.B t.toNNReal z+∫s in (0:ℝ)..t,f s
|
| 44 |
+
have hi:IntervalIntegrable f volume 0 1:=eulerLimitProcess_drift_integrable W γ z hb h0
|
| 45 |
+
have hc:ContinuousOn F (Icc (0:ℝ) 1):=by
|
| 46 |
+
apply hb.continuousOn.add
|
| 47 |
+
simpa only [uIcc_of_le (by norm_num:(0:ℝ)≤1)] using
|
| 48 |
+
intervalIntegral.continuousOn_primitive_interval' hi left_mem_uIcc
|
| 49 |
+
have he:∀t∈Ico (0:ℝ) 1,eulerLimitProcess W γ t z=F t:=by
|
| 50 |
+
intro t ht
|
| 51 |
+
exact (eulerLimitProcess_local_path W γ z hb h0 ht).2.2 t ⟨ht.1,le_rfl⟩
|
| 52 |
+
have hl:Tendsto (fun n ↦ eulerLimitProcess W γ (terminalTime n) z) atTop (𝓝 (F 1)):=by
|
| 53 |
+
have htime:Tendsto terminalTime atTop (𝓝[Icc (0:ℝ) 1] (1:ℝ)):=
|
| 54 |
+
tendsto_nhdsWithin_iff.mpr ⟨(tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1,
|
| 55 |
+
Eventually.of_forall (fun n ↦ ⟨(terminalTime_mem n).1,(terminalTime_mem n).2.le⟩)⟩
|
| 56 |
+
apply ((hc 1 ⟨by norm_num,le_rfl⟩).tendsto.comp htime).congr
|
| 57 |
+
intro n
|
| 58 |
+
exact (he _ (terminalTime_mem n)).symm
|
| 59 |
+
have hU:terminalEulerProcess W γ z=F 1:=hl.limsup_eq
|
| 60 |
+
have hEq (t:ℝ) (ht:t∈Icc (0:ℝ) 1):diffusionProcess W γ t z=F t:=by
|
| 61 |
+
by_cases ht1:t<1
|
| 62 |
+
· simpa only [diffusionProcess,ite_eq_left ht1] using he t ⟨ht.1,ht1⟩
|
| 63 |
+
· have ht':t=1:=le_antisymm ht.2 (not_lt.mp ht1)
|
| 64 |
+
subst t
|
| 65 |
+
simpa only [diffusionProcess,lt_self_iff_false,ite_false] using hU
|
| 66 |
+
refine ⟨hc.congr hEq,?_⟩
|
| 67 |
+
intro t ht
|
| 68 |
+
rw [hEq t ht]
|
| 69 |
+
change W.B t.toNNReal z+(∫s in (0:ℝ)..t,f s)=_
|
| 70 |
+
congr 1
|
| 71 |
+
apply intervalIntegral.integral_congr_Ioo_of_le ht.1
|
| 72 |
+
intro s hs
|
| 73 |
+
simp only [f,diffusionProcess,ite_eq_left (hs.2.trans_le ht.2)]
|
| 74 |
+
theorem diffusionProcess_isDiffusion (W:BrownianSpace) (γ:OrderParameter):IsDiffusion W γ (diffusionProcess W γ) :=by
|
| 75 |
+
refine ⟨diffusionProcess_adapted W γ,?_⟩
|
| 76 |
+
filter_upwards [W.brownian.cont,W.brownian.toIsPreBrownianReal.eval_zero_ae_eq_zero] with z hz h0
|
| 77 |
+
exact diffusionProcess_path W γ z (hz.comp (by fun_prop:Continuous (fun t:ℝ ↦ t.toNNReal))) h0
|
| 78 |
+
lemma exists_diffusion (W:BrownianSpace) (γ:OrderParameter):∃X:ℝ → W.Ω → ℝ,IsDiffusion W γ X:=
|
| 79 |
+
⟨diffusionProcess W γ,diffusionProcess_isDiffusion W γ⟩
|
| 80 |
+
end SKValue
|
| 81 |
+
|
| 82 |
+
end
|
| 83 |
+
|
| 84 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/DiffusionGradientCondExp.lean
CHANGED
|
@@ -1,143 +1,143 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.Shift
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 25 |
-
open scoped Topology NNReal BigOperators
|
| 26 |
-
|
| 27 |
-
lemma diffusion_gradient_condExp
|
| 28 |
-
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 29 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 30 |
-
(hBm : ∀ t, StronglyMeasurable (B t))
|
| 31 |
-
{T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {X : ℝ → Ω → ℝ}
|
| 32 |
-
(hT1 : T≤1) (hLu : 0≤Lu) (h : GradientStripCore T γ u K L)
|
| 33 |
-
(hLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 34 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 35 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T,
|
| 36 |
-
StronglyMeasurable[Filtration.natural B hBm t.toNNReal] (X t))
|
| 37 |
-
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 38 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 39 |
-
∀ t∈Icc (0 : ℝ) T, X t ω=B t.toNNReal ω+∫ s in (0 : ℝ)..t, γ s*u s (X s ω))
|
| 40 |
-
{a b : ℝ} (ha : a∈Icc (0 : ℝ) T) (hb : b∈Icc (0 : ℝ) T) (hab : a≤b) :
|
| 41 |
-
μ[(fun ω ↦ u b (X b ω)) | Filtration.natural B hBm a.toNNReal]=ᵐ[μ](fun ω ↦ u a (X a ω)) := by
|
| 42 |
-
let ℱ := Filtration.natural B hBm
|
| 43 |
-
by_cases heq : a=b
|
| 44 |
-
· subst b
|
| 45 |
-
have hh := (h.smooth a ha).continuous.comp_stronglyMeasurable (hXM a ha)
|
| 46 |
-
apply condExp_of_aestronglyMeasurable' (ℱ.le _) hh.aestronglyMeasurable
|
| 47 |
-
exact Integrable.of_bound (hh.mono (ℱ.le _)).aestronglyMeasurable 1
|
| 48 |
-
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le (h.bounded a ha _)))
|
| 49 |
-
have hlt : a<b := lt_of_le_of_ne hab heq
|
| 50 |
-
have hba : 0<b-a := sub_pos.mpr hlt
|
| 51 |
-
have hba1 : b-a≤1 := by linarith [hb.2,ha.1]
|
| 52 |
-
let Y := fun t : ℝ ↦ X (a+t)
|
| 53 |
-
let W := fun t : ℝ ↦ fun ω ↦ X a ω+B (a.toNNReal+t.toNNReal) ω-B a.toNNReal ω
|
| 54 |
-
have hmem (t : ℝ) (ht : t∈Icc (0 : ℝ) (b-a)) : a+t∈Icc (0 : ℝ) T := by
|
| 55 |
-
constructor <;> linarith [ha.1,hb.2,ht.1,ht.2]
|
| 56 |
-
have hLip' : ∀ s∈Icc (0 : ℝ) (b-a), ∀ t∈Icc (0 : ℝ) (b-a), ∀ x y,
|
| 57 |
-
|u (a+s) x-u (a+t) y|≤Lu*(|s-t|+|x-y|) := by
|
| 58 |
-
intro s hs t ht x y
|
| 59 |
-
simpa only [add_sub_add_left_eq_sub] using hLip _ (hmem s hs) _ (hmem t ht) x y
|
| 60 |
-
have hYM (t : ℝ) (ht : t∈Icc (0 : ℝ) (b-a)) :
|
| 61 |
-
StronglyMeasurable[ℱ (a.toNNReal+t.toNNReal)] (Y t) := by
|
| 62 |
-
have hh := hXM _ (hmem t ht)
|
| 63 |
-
rw [Real.toNNReal_add ha.1 ht.1] at hh
|
| 64 |
-
exact hh
|
| 65 |
-
have hWM (t : ℝ) (_ht : t∈Icc (0 : ℝ) (b-a)) : AEStronglyMeasurable (W t) μ :=
|
| 66 |
-
((((hXM a ha).mono (ℱ.le _)).add (hBm _)).sub (hBm _)).aestronglyMeasurable
|
| 67 |
-
have hW : ∀ s∈Icc (0 : ℝ) (b-a), ∀ t∈Icc (0 : ℝ) (b-a), ∀ ω,
|
| 68 |
-
W t ω-W s ω=B (a.toNNReal+t.toNNReal) ω-B (a.toNNReal+s.toNNReal) ω := by
|
| 69 |
-
intro s _ t _ ω
|
| 70 |
-
dsimp [W]
|
| 71 |
-
ring
|
| 72 |
-
have hpaths' : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ Y t ω) (Icc (0 : ℝ) (b-a)) ∧
|
| 73 |
-
IntervalIntegrable (fun s ↦ γ (a+s)*u (a+s) (Y s ω)) volume 0 (b-a) ∧
|
| 74 |
-
∀ t∈Icc (0 : ℝ) (b-a), Y t ω=W t ω+∫ s in (0 : ℝ)..t, γ (a+s)*u (a+s) (Y s ω) := by
|
| 75 |
-
filter_upwards [hpaths] with ω hω
|
| 76 |
-
have hT : 0≤T := ha.1.trans ha.2
|
| 77 |
-
have hi := intervalIntegrable_substrip hT hω.2.1 ha hb
|
| 78 |
-
refine ⟨hω.1.comp (continuous_const.add continuous_id).continuousOn hmem,?_,?_⟩
|
| 79 |
-
· simpa only [sub_self,Y] using hi.comp_add_left a
|
| 80 |
-
· intro t ht
|
| 81 |
-
have hhalf := intervalIntegrable_substrip hT hω.2.1 ha (hmem t ht)
|
| 82 |
-
have hleft := intervalIntegrable_substrip hT hω.2.1 ⟨le_rfl,hT⟩ ha
|
| 83 |
-
have hsum := intervalIntegral.integral_add_adjacent_intervals hleft hhalf
|
| 84 |
-
dsimp only [Y,W]
|
| 85 |
-
rw [intervalIntegral.integral_comp_add_left (fun s ↦ γ s*u s (X s ω)) a,add_zero]
|
| 86 |
-
rw [hω.2.2 _ (hmem t ht),hω.2.2 _ ha,Real.toNNReal_add ha.1 ht.1]
|
| 87 |
-
linarith
|
| 88 |
-
have hh := diffusion_gradient_condExp_local hB hBm a.toNNReal hba hba1 hLu
|
| 89 |
-
(h.shift ha.1 hab hb.2) hLip' hYM hWM hW hpaths'
|
| 90 |
-
simpa only [Y,add_sub_cancel,add_zero] using hh
|
| 91 |
-
|
| 92 |
-
end SKValue
|
| 93 |
-
|
| 94 |
-
namespace SKValue
|
| 95 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 96 |
-
open scoped Topology NNReal BigOperators
|
| 97 |
-
|
| 98 |
-
lemma diffusion_gradient_stopped_martingale
|
| 99 |
-
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 100 |
-
{B : ℝ≥0 → Ω
|
| 101 |
-
(hBm : ∀ t, StronglyMeasurable (B t))
|
| 102 |
-
{T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {X : ℝ → Ω → ℝ}
|
| 103 |
-
(hT : 0≤T) (hT1 : T≤1) (hLu : 0≤Lu) (h : GradientStripCore T γ u K L)
|
| 104 |
-
(hLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 105 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 106 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T,
|
| 107 |
-
StronglyMeasurable[Filtration.natural B hBm t.toNNReal] (X t))
|
| 108 |
-
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 109 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 110 |
-
∀ t∈Icc (0 : ℝ) T, X t ω=B t.toNNReal ω+∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) :
|
| 111 |
-
Martingale (fun t : ℝ≥0 ↦ fun ω ↦ u (min (t : ℝ) T) (X (min (t : ℝ) T) ω))
|
| 112 |
-
(Filtration.natural B hBm) μ := by
|
| 113 |
-
let ℱ := Filtration.natural B hBm
|
| 114 |
-
have hmem (t : ℝ≥0) : min (t : ℝ) T∈Icc (0 : ℝ) T :=
|
| 115 |
-
⟨le_min t.coe_nonneg hT,min_le_right _ _⟩
|
| 116 |
-
have htime (t : ℝ≥0) : (min (t : ℝ) T).toNNReal≤t := by
|
| 117 |
-
have hh := Real.toNNReal_mono (min_le_left (t : ℝ) T)
|
| 118 |
-
rw [Real.toNNReal_coe] at hh
|
| 119 |
-
exact hh
|
| 120 |
-
have hm (t : ℝ≥0) : StronglyMeasurable[ℱ t]
|
| 121 |
-
(fun ω ↦ u (min (t : ℝ) T) (X (min (t : ℝ) T) ω)) :=
|
| 122 |
-
((h.smooth _ (hmem t)).continuous.comp_stronglyMeasurable (hXM _ (hmem t))).mono (ℱ.mono (htime t))
|
| 123 |
-
have hi (t : ℝ≥0) : Integrable (fun ω ↦ u (min (t : ℝ) T) (X (min (t : ℝ) T) ω)) μ :=
|
| 124 |
-
Integrable.of_bound ((hm t).mono (ℱ.le _)).aestronglyMeasurable 1
|
| 125 |
-
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le (h.bounded _ (hmem t) _)))
|
| 126 |
-
refine ⟨hm,?_⟩
|
| 127 |
-
intro s t hst
|
| 128 |
-
by_cases hs : (s : ℝ)≤T
|
| 129 |
-
· have ha : (s : ℝ)∈Icc (0 : ℝ) T := ⟨s.coe_nonneg,hs⟩
|
| 130 |
-
have hh := diffusion_gradient_condExp hB hBm hT1 hLu h hLip hXM hpaths ha (hmem t)
|
| 131 |
-
(le_min (by exact_mod_cast hst) hs)
|
| 132 |
-
rw [Real.toNNReal_coe] at hh
|
| 133 |
-
simpa only [min_eq_left hs] using hh
|
| 134 |
-
· have hs' : T≤(s : ℝ) := (lt_of_not_ge hs).le
|
| 135 |
-
have ht : T≤(t : ℝ) := hs'.trans (by exact_mod_cast hst)
|
| 136 |
-
have hh := condExp_of_aestronglyMeasurable' (ℱ.le s) (hm s).aestronglyMeasurable (hi s)
|
| 137 |
-
simpa only [min_eq_right hs',min_eq_right ht] using hh
|
| 138 |
-
|
| 139 |
-
end SKValue
|
| 140 |
-
|
| 141 |
-
end
|
| 142 |
-
|
| 143 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.Shift
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 25 |
+
open scoped Topology NNReal BigOperators
|
| 26 |
+
|
| 27 |
+
lemma diffusion_gradient_condExp
|
| 28 |
+
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 29 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 30 |
+
(hBm : ∀ t, StronglyMeasurable (B t))
|
| 31 |
+
{T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {X : ℝ → Ω → ℝ}
|
| 32 |
+
(hT1 : T≤1) (hLu : 0≤Lu) (h : GradientStripCore T γ u K L)
|
| 33 |
+
(hLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 34 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 35 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T,
|
| 36 |
+
StronglyMeasurable[Filtration.natural B hBm t.toNNReal] (X t))
|
| 37 |
+
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 38 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 39 |
+
∀ t∈Icc (0 : ℝ) T, X t ω=B t.toNNReal ω+∫ s in (0 : ℝ)..t, γ s*u s (X s ω))
|
| 40 |
+
{a b : ℝ} (ha : a∈Icc (0 : ℝ) T) (hb : b∈Icc (0 : ℝ) T) (hab : a≤b) :
|
| 41 |
+
μ[(fun ω ↦ u b (X b ω)) | Filtration.natural B hBm a.toNNReal]=ᵐ[μ](fun ω ↦ u a (X a ω)) := by
|
| 42 |
+
let ℱ := Filtration.natural B hBm
|
| 43 |
+
by_cases heq : a=b
|
| 44 |
+
· subst b
|
| 45 |
+
have hh := (h.smooth a ha).continuous.comp_stronglyMeasurable (hXM a ha)
|
| 46 |
+
apply condExp_of_aestronglyMeasurable' (ℱ.le _) hh.aestronglyMeasurable
|
| 47 |
+
exact Integrable.of_bound (hh.mono (ℱ.le _)).aestronglyMeasurable 1
|
| 48 |
+
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le (h.bounded a ha _)))
|
| 49 |
+
have hlt : a<b := lt_of_le_of_ne hab heq
|
| 50 |
+
have hba : 0<b-a := sub_pos.mpr hlt
|
| 51 |
+
have hba1 : b-a≤1 := by linarith [hb.2,ha.1]
|
| 52 |
+
let Y := fun t : ℝ ↦ X (a+t)
|
| 53 |
+
let W := fun t : ℝ ↦ fun ω ↦ X a ω+B (a.toNNReal+t.toNNReal) ω-B a.toNNReal ω
|
| 54 |
+
have hmem (t : ℝ) (ht : t∈Icc (0 : ℝ) (b-a)) : a+t∈Icc (0 : ℝ) T := by
|
| 55 |
+
constructor <;> linarith [ha.1,hb.2,ht.1,ht.2]
|
| 56 |
+
have hLip' : ∀ s∈Icc (0 : ℝ) (b-a), ∀ t∈Icc (0 : ℝ) (b-a), ∀ x y,
|
| 57 |
+
|u (a+s) x-u (a+t) y|≤Lu*(|s-t|+|x-y|) := by
|
| 58 |
+
intro s hs t ht x y
|
| 59 |
+
simpa only [add_sub_add_left_eq_sub] using hLip _ (hmem s hs) _ (hmem t ht) x y
|
| 60 |
+
have hYM (t : ℝ) (ht : t∈Icc (0 : ℝ) (b-a)) :
|
| 61 |
+
StronglyMeasurable[ℱ (a.toNNReal+t.toNNReal)] (Y t) := by
|
| 62 |
+
have hh := hXM _ (hmem t ht)
|
| 63 |
+
rw [Real.toNNReal_add ha.1 ht.1] at hh
|
| 64 |
+
exact hh
|
| 65 |
+
have hWM (t : ℝ) (_ht : t∈Icc (0 : ℝ) (b-a)) : AEStronglyMeasurable (W t) μ :=
|
| 66 |
+
((((hXM a ha).mono (ℱ.le _)).add (hBm _)).sub (hBm _)).aestronglyMeasurable
|
| 67 |
+
have hW : ∀ s∈Icc (0 : ℝ) (b-a), ∀ t∈Icc (0 : ℝ) (b-a), ∀ ω,
|
| 68 |
+
W t ω-W s ω=B (a.toNNReal+t.toNNReal) ω-B (a.toNNReal+s.toNNReal) ω := by
|
| 69 |
+
intro s _ t _ ω
|
| 70 |
+
dsimp [W]
|
| 71 |
+
ring
|
| 72 |
+
have hpaths' : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ Y t ω) (Icc (0 : ℝ) (b-a)) ∧
|
| 73 |
+
IntervalIntegrable (fun s ↦ γ (a+s)*u (a+s) (Y s ω)) volume 0 (b-a) ∧
|
| 74 |
+
∀ t∈Icc (0 : ℝ) (b-a), Y t ω=W t ω+∫ s in (0 : ℝ)..t, γ (a+s)*u (a+s) (Y s ω) := by
|
| 75 |
+
filter_upwards [hpaths] with ω hω
|
| 76 |
+
have hT : 0≤T := ha.1.trans ha.2
|
| 77 |
+
have hi := intervalIntegrable_substrip hT hω.2.1 ha hb
|
| 78 |
+
refine ⟨hω.1.comp (continuous_const.add continuous_id).continuousOn hmem,?_,?_⟩
|
| 79 |
+
· simpa only [sub_self,Y] using hi.comp_add_left a
|
| 80 |
+
· intro t ht
|
| 81 |
+
have hhalf := intervalIntegrable_substrip hT hω.2.1 ha (hmem t ht)
|
| 82 |
+
have hleft := intervalIntegrable_substrip hT hω.2.1 ⟨le_rfl,hT⟩ ha
|
| 83 |
+
have hsum := intervalIntegral.integral_add_adjacent_intervals hleft hhalf
|
| 84 |
+
dsimp only [Y,W]
|
| 85 |
+
rw [intervalIntegral.integral_comp_add_left (fun s ↦ γ s*u s (X s ω)) a,add_zero]
|
| 86 |
+
rw [hω.2.2 _ (hmem t ht),hω.2.2 _ ha,Real.toNNReal_add ha.1 ht.1]
|
| 87 |
+
linarith
|
| 88 |
+
have hh := diffusion_gradient_condExp_local hB hBm a.toNNReal hba hba1 hLu
|
| 89 |
+
(h.shift ha.1 hab hb.2) hLip' hYM hWM hW hpaths'
|
| 90 |
+
simpa only [Y,add_sub_cancel,add_zero] using hh
|
| 91 |
+
|
| 92 |
+
end SKValue
|
| 93 |
+
|
| 94 |
+
namespace SKValue
|
| 95 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 96 |
+
open scoped Topology NNReal BigOperators
|
| 97 |
+
|
| 98 |
+
lemma diffusion_gradient_stopped_martingale
|
| 99 |
+
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 100 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 101 |
+
(hBm : ∀ t, StronglyMeasurable (B t))
|
| 102 |
+
{T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {X : ℝ → Ω → ℝ}
|
| 103 |
+
(hT : 0≤T) (hT1 : T≤1) (hLu : 0≤Lu) (h : GradientStripCore T γ u K L)
|
| 104 |
+
(hLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 105 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 106 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T,
|
| 107 |
+
StronglyMeasurable[Filtration.natural B hBm t.toNNReal] (X t))
|
| 108 |
+
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 109 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 110 |
+
∀ t∈Icc (0 : ℝ) T, X t ω=B t.toNNReal ω+∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) :
|
| 111 |
+
Martingale (fun t : ℝ≥0 ↦ fun ω ↦ u (min (t : ℝ) T) (X (min (t : ℝ) T) ω))
|
| 112 |
+
(Filtration.natural B hBm) μ := by
|
| 113 |
+
let ℱ := Filtration.natural B hBm
|
| 114 |
+
have hmem (t : ℝ≥0) : min (t : ℝ) T∈Icc (0 : ℝ) T :=
|
| 115 |
+
⟨le_min t.coe_nonneg hT,min_le_right _ _⟩
|
| 116 |
+
have htime (t : ℝ≥0) : (min (t : ℝ) T).toNNReal≤t := by
|
| 117 |
+
have hh := Real.toNNReal_mono (min_le_left (t : ℝ) T)
|
| 118 |
+
rw [Real.toNNReal_coe] at hh
|
| 119 |
+
exact hh
|
| 120 |
+
have hm (t : ℝ≥0) : StronglyMeasurable[ℱ t]
|
| 121 |
+
(fun ω ↦ u (min (t : ℝ) T) (X (min (t : ℝ) T) ω)) :=
|
| 122 |
+
((h.smooth _ (hmem t)).continuous.comp_stronglyMeasurable (hXM _ (hmem t))).mono (ℱ.mono (htime t))
|
| 123 |
+
have hi (t : ℝ≥0) : Integrable (fun ω ↦ u (min (t : ℝ) T) (X (min (t : ℝ) T) ω)) μ :=
|
| 124 |
+
Integrable.of_bound ((hm t).mono (ℱ.le _)).aestronglyMeasurable 1
|
| 125 |
+
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le (h.bounded _ (hmem t) _)))
|
| 126 |
+
refine ⟨hm,?_⟩
|
| 127 |
+
intro s t hst
|
| 128 |
+
by_cases hs : (s : ℝ)≤T
|
| 129 |
+
· have ha : (s : ℝ)∈Icc (0 : ℝ) T := ⟨s.coe_nonneg,hs⟩
|
| 130 |
+
have hh := diffusion_gradient_condExp hB hBm hT1 hLu h hLip hXM hpaths ha (hmem t)
|
| 131 |
+
(le_min (by exact_mod_cast hst) hs)
|
| 132 |
+
rw [Real.toNNReal_coe] at hh
|
| 133 |
+
simpa only [min_eq_left hs] using hh
|
| 134 |
+
· have hs' : T≤(s : ℝ) := (lt_of_not_ge hs).le
|
| 135 |
+
have ht : T≤(t : ℝ) := hs'.trans (by exact_mod_cast hst)
|
| 136 |
+
have hh := condExp_of_aestronglyMeasurable' (ℱ.le s) (hm s).aestronglyMeasurable (hi s)
|
| 137 |
+
simpa only [min_eq_right hs',min_eq_right ht] using hh
|
| 138 |
+
|
| 139 |
+
end SKValue
|
| 140 |
+
|
| 141 |
+
end
|
| 142 |
+
|
| 143 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/DiffusionGradientWeakMartingaleLocal.lean
CHANGED
|
@@ -1,131 +1,131 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.CubicEnvelopeMean
|
| 3 |
-
import OAI.Probability.SKValue.Gaussian.ShiftedBrownianCoordinates
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
open MeasureTheory ProbabilityTheory Set
|
| 9 |
-
open scoped ENNReal NNReal BigOperators
|
| 10 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
-
open scoped BigOperators Topology
|
| 12 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
-
open scoped Topology BigOperators
|
| 14 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 15 |
-
open scoped Topology ENNReal NNReal
|
| 16 |
-
open Filter Set
|
| 17 |
-
open scoped Topology BigOperators
|
| 18 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 19 |
-
open scoped Topology
|
| 20 |
-
open MeasureTheory Set Filter
|
| 21 |
-
open scoped Topology BigOperators
|
| 22 |
-
open MeasureTheory Set Filter Finset
|
| 23 |
-
open scoped Topology BigOperators
|
| 24 |
-
namespace SKValue
|
| 25 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 26 |
-
open scoped Topology NNReal BigOperators
|
| 27 |
-
|
| 28 |
-
lemma diffusion_gradient_weak_martingale_local
|
| 29 |
-
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 30 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 31 |
-
(hBm : ∀ t, StronglyMeasurable (B t)) (a : ℝ≥0)
|
| 32 |
-
{T K L Lu H : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {X W : ℝ → Ω → ℝ}
|
| 33 |
-
{F : Ω → ℝ} (hT : 0<T) (hT1 : T≤1) (hLu : 0≤Lu) (hH : 0≤H)
|
| 34 |
-
(h : GradientStripCore T γ u K L)
|
| 35 |
-
(hLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 36 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 37 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T,
|
| 38 |
-
StronglyMeasurable[Filtration.natural B hBm (a+t.toNNReal)] (X t))
|
| 39 |
-
(hWM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (W t) μ)
|
| 40 |
-
(hW : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ ω,
|
| 41 |
-
W t ω-W s ω=B (a+t.toNNReal) ω-B (a+s.toNNReal) ω)
|
| 42 |
-
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 43 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 44 |
-
∀ t∈Icc (0 : ℝ) T, X t ω=W t ω+∫ s in (0 : ℝ)..t, γ s*u s (X s ω))
|
| 45 |
-
(hFm : StronglyMeasurable[Filtration.natural B hBm a] F) (hFb : ∀ ω, |F ω|≤H) :
|
| 46 |
-
(∫ ω, F ω*u T (X T ω) ∂μ)=(∫ ω, F ω*u 0 (X 0 ω) ∂μ) := by
|
| 47 |
-
let ℱ := Filtration.natural B hBm
|
| 48 |
-
have hFM : AEStronglyMeasurable F μ := (hFm.mono (ℱ.le a)).aestronglyMeasurable
|
| 49 |
-
have hXM' (t : ℝ) (ht : t∈Icc (0 : ℝ) T) : AEStronglyMeasurable (X t) μ :=
|
| 50 |
-
((hXM t ht).mono (ℱ.le _)).aestronglyMeasurable
|
| 51 |
-
have hsp (t : ℝ) (ht : t∈Icc (0 : ℝ) T) (x y : ℝ) :
|
| 52 |
-
|u t x-u t y|≤Lu*|x-y| := by
|
| 53 |
-
simpa only [sub_self,abs_zero,zero_add] using hLip t ht t ht x y
|
| 54 |
-
have hVi (t : ℝ) (ht : t∈Icc (0 : ℝ) T) : Integrable (fun ω ↦ F ω*u t (X t ω)) μ := by
|
| 55 |
-
apply Integrable.of_bound (hFM.mul ((h.smooth t ht).continuous.comp_aestronglyMeasurable (hXM' t ht))) H
|
| 56 |
-
filter_upwards [] with ω
|
| 57 |
-
simp only [Pi.mul_apply, Real.norm_eq_abs, abs_mul]
|
| 58 |
-
exact (mul_le_mul (hFb ω) (h.bounded t ht _) (abs_nonneg _) hH).trans_eq (mul_one H)
|
| 59 |
-
have hlim := weighted_pathGradientResidual_tendsto (Z:=shiftedBrownianCoordinates B a T)
|
| 60 |
-
hT hT1 hLu hH h hLip hXM' hWM
|
| 61 |
-
(fun N hN i ↦ shiftedBrownianCoordinates_hasLaw hB a hT hN i)
|
| 62 |
-
(fun N hN i ω ↦ shiftedBrownianCoordinates_exact hT hN hW i ω) hpaths hFM hFb
|
| 63 |
-
have hmean (N : ℕ) : (∫ ω, F ω*pathGradientResidual T N u (fun t ↦ X t ω)
|
| 64 |
-
(fun t ↦ W t ω) ∂μ)=(∫ ω, F ω*u T (X T ω) ∂μ)-(∫ ω, F ω*u 0 (X 0 ω) ∂μ) := by
|
| 65 |
-
have hδ : 0≤ stepSize T N := div_nonneg hT.le (Nat.cast_nonneg N)
|
| 66 |
-
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem_total hT.le hj
|
| 67 |
-
let τ := fun j : ℕ ↦ a+(meshTime T N j).toNNReal
|
| 68 |
-
have hτ (i : Fin N) : τ i≤τ (i+1) := by
|
| 69 |
-
dsimp [τ]
|
| 70 |
-
apply add_le_add le_rfl
|
| 71 |
-
apply Real.toNNReal_mono
|
| 72 |
-
dsimp [meshTime]
|
| 73 |
-
push_cast
|
| 74 |
-
nlinarith
|
| 75 |
-
have hτdiff (i : Fin N) : (τ (i+1) : ℝ)-(τ i : ℝ)=stepSize T N := by
|
| 76 |
-
dsimp only [τ]
|
| 77 |
-
rw [NNReal.coe_add,NNReal.coe_add,Real.coe_toNNReal _ (htime (i+1) i.isLt).1,
|
| 78 |
-
Real.coe_toNNReal _ (htime i i.isLt.le).1]
|
| 79 |
-
dsimp [meshTime]
|
| 80 |
-
push_cast
|
| 81 |
-
ring
|
| 82 |
-
have hWeq (i : Fin N) (ω : Ω) :
|
| 83 |
-
W (meshTime T N (i+1)) ω-W (meshTime T N i) ω=B (τ (i+1)) ω-B (τ i) ω :=
|
| 84 |
-
hW _ (htime i i.isLt.le) _ (htime (i+1) i.isLt) ω
|
| 85 |
-
have hFm' (i : Fin N) : StronglyMeasurable[ℱ (τ i)] F :=
|
| 86 |
-
hFm.mono (ℱ.mono (le_add_of_nonneg_right (by positivity)))
|
| 87 |
-
have hDm (i : Fin N) : StronglyMeasurable[ℱ (τ i)]
|
| 88 |
-
(fun ω ↦ F ω*deriv (u (meshTime T N i)) (X (meshTime T N i) ω)) :=
|
| 89 |
-
(hFm' i).mul ((h.continuous_deriv (htime i i.isLt.le)).comp_stronglyMeasurable
|
| 90 |
-
(hXM _ (htime i i.isLt.le)))
|
| 91 |
-
have hD2m (i : Fin N) : StronglyMeasurable[ℱ (τ i)]
|
| 92 |
-
(fun ω ↦ F ω*deriv (deriv (u (meshTime T N i))) (X (meshTime T N i) ω)) :=
|
| 93 |
-
(hFm' i).mul ((h.continuous_second (htime i i.isLt.le)).comp_stronglyMeasurable
|
| 94 |
-
(hXM _ (htime i i.isLt.le)))
|
| 95 |
-
have hDi (i : Fin N) : Integrable
|
| 96 |
-
(fun ω ↦ F ω*deriv (u (meshTime T N i)) (X (meshTime T N i) ω)) μ := by
|
| 97 |
-
apply Integrable.of_bound ((hDm i).mono (ℱ.le _)).aestronglyMeasurable (H*Lu)
|
| 98 |
-
filter_upwards [] with ω
|
| 99 |
-
rw [Real.norm_eq_abs,abs_mul]
|
| 100 |
-
exact mul_le_mul (hFb ω) (GradientStripCore.deriv_bound hLu hsp (htime i i.isLt.le) _)
|
| 101 |
-
(abs_nonneg _) hH
|
| 102 |
-
have hD2i (i : Fin N) : Integrable
|
| 103 |
-
(fun ω ↦ F ω*deriv (deriv (u (meshTime T N i))) (X (meshTime T N i) ω)) μ := by
|
| 104 |
-
apply Integrable.of_bound ((hD2m i).mono (ℱ.le _)).aestronglyMeasurable (H*K)
|
| 105 |
-
filter_upwards [] with ω
|
| 106 |
-
rw [Real.norm_eq_abs,abs_mul]
|
| 107 |
-
exact mul_le_mul (hFb ω) (h.second_bound _ (htime i i.isLt.le) _) (abs_nonneg _) hH
|
| 108 |
-
apply weighted_pathGradientResidual_integral (hVi T ⟨hT.le,le_rfl⟩) (hVi 0 ⟨le_rfl,hT.le⟩)
|
| 109 |
-
· intro i
|
| 110 |
-
simpa only [hWeq,mul_assoc] using
|
| 111 |
-
brownian_predictable_increment_integrable hB hBm (hτ i) (hDm i) (hDi i)
|
| 112 |
-
· intro i
|
| 113 |
-
simpa only [hWeq,hτdiff,mul_assoc] using
|
| 114 |
-
brownian_predictable_quadratic_integrable hB hBm (hτ i) (hD2m i) (hD2i i)
|
| 115 |
-
· intro i
|
| 116 |
-
simpa only [hWeq,mul_assoc] using brownian_predictable_increment_mean hB hBm (hτ i) (hDm i)
|
| 117 |
-
· intro i
|
| 118 |
-
simpa only [hWeq,hτdiff,mul_assoc] using
|
| 119 |
-
brownian_predictable_quadratic_mean hB hBm (hτ i) (hD2m i)
|
| 120 |
-
have hh : (∫ ω, F ω*u T (X T ω) ∂μ)-(∫ ω, F ω*u 0 (X 0 ω) ∂μ)=0 := by
|
| 121 |
-
have hc : Tendsto (fun _ : ℕ ↦ (∫ ω, F ω*u T (X T ω) ∂μ)-
|
| 122 |
-
(∫ ω, F ω*u 0 (X 0 ω) ∂μ)) atTop (𝓝 (0 : ℝ)) := by
|
| 123 |
-
simpa only [hmean] using hlim
|
| 124 |
-
exact tendsto_nhds_unique tendsto_const_nhds hc
|
| 125 |
-
exact sub_eq_zero.mp hh
|
| 126 |
-
|
| 127 |
-
end SKValue
|
| 128 |
-
|
| 129 |
-
end
|
| 130 |
-
|
| 131 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.CubicEnvelopeMean
|
| 3 |
+
import OAI.Probability.SKValue.Gaussian.ShiftedBrownianCoordinates
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
open MeasureTheory ProbabilityTheory Set
|
| 9 |
+
open scoped ENNReal NNReal BigOperators
|
| 10 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
+
open scoped BigOperators Topology
|
| 12 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
+
open scoped Topology BigOperators
|
| 14 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 15 |
+
open scoped Topology ENNReal NNReal
|
| 16 |
+
open Filter Set
|
| 17 |
+
open scoped Topology BigOperators
|
| 18 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 19 |
+
open scoped Topology
|
| 20 |
+
open MeasureTheory Set Filter
|
| 21 |
+
open scoped Topology BigOperators
|
| 22 |
+
open MeasureTheory Set Filter Finset
|
| 23 |
+
open scoped Topology BigOperators
|
| 24 |
+
namespace SKValue
|
| 25 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 26 |
+
open scoped Topology NNReal BigOperators
|
| 27 |
+
|
| 28 |
+
lemma diffusion_gradient_weak_martingale_local
|
| 29 |
+
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 30 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 31 |
+
(hBm : ∀ t, StronglyMeasurable (B t)) (a : ℝ≥0)
|
| 32 |
+
{T K L Lu H : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {X W : ℝ → Ω → ℝ}
|
| 33 |
+
{F : Ω → ℝ} (hT : 0<T) (hT1 : T≤1) (hLu : 0≤Lu) (hH : 0≤H)
|
| 34 |
+
(h : GradientStripCore T γ u K L)
|
| 35 |
+
(hLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 36 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 37 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T,
|
| 38 |
+
StronglyMeasurable[Filtration.natural B hBm (a+t.toNNReal)] (X t))
|
| 39 |
+
(hWM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (W t) μ)
|
| 40 |
+
(hW : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ ω,
|
| 41 |
+
W t ω-W s ω=B (a+t.toNNReal) ω-B (a+s.toNNReal) ω)
|
| 42 |
+
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 43 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 44 |
+
∀ t∈Icc (0 : ℝ) T, X t ω=W t ω+∫ s in (0 : ℝ)..t, γ s*u s (X s ω))
|
| 45 |
+
(hFm : StronglyMeasurable[Filtration.natural B hBm a] F) (hFb : ∀ ω, |F ω|≤H) :
|
| 46 |
+
(∫ ω, F ω*u T (X T ω) ∂μ)=(∫ ω, F ω*u 0 (X 0 ω) ∂μ) := by
|
| 47 |
+
let ℱ := Filtration.natural B hBm
|
| 48 |
+
have hFM : AEStronglyMeasurable F μ := (hFm.mono (ℱ.le a)).aestronglyMeasurable
|
| 49 |
+
have hXM' (t : ℝ) (ht : t∈Icc (0 : ℝ) T) : AEStronglyMeasurable (X t) μ :=
|
| 50 |
+
((hXM t ht).mono (ℱ.le _)).aestronglyMeasurable
|
| 51 |
+
have hsp (t : ℝ) (ht : t∈Icc (0 : ℝ) T) (x y : ℝ) :
|
| 52 |
+
|u t x-u t y|≤Lu*|x-y| := by
|
| 53 |
+
simpa only [sub_self,abs_zero,zero_add] using hLip t ht t ht x y
|
| 54 |
+
have hVi (t : ℝ) (ht : t∈Icc (0 : ℝ) T) : Integrable (fun ω ↦ F ω*u t (X t ω)) μ := by
|
| 55 |
+
apply Integrable.of_bound (hFM.mul ((h.smooth t ht).continuous.comp_aestronglyMeasurable (hXM' t ht))) H
|
| 56 |
+
filter_upwards [] with ω
|
| 57 |
+
simp only [Pi.mul_apply, Real.norm_eq_abs, abs_mul]
|
| 58 |
+
exact (mul_le_mul (hFb ω) (h.bounded t ht _) (abs_nonneg _) hH).trans_eq (mul_one H)
|
| 59 |
+
have hlim := weighted_pathGradientResidual_tendsto (Z:=shiftedBrownianCoordinates B a T)
|
| 60 |
+
hT hT1 hLu hH h hLip hXM' hWM
|
| 61 |
+
(fun N hN i ↦ shiftedBrownianCoordinates_hasLaw hB a hT hN i)
|
| 62 |
+
(fun N hN i ω ↦ shiftedBrownianCoordinates_exact hT hN hW i ω) hpaths hFM hFb
|
| 63 |
+
have hmean (N : ℕ) : (∫ ω, F ω*pathGradientResidual T N u (fun t ↦ X t ω)
|
| 64 |
+
(fun t ↦ W t ω) ∂μ)=(∫ ω, F ω*u T (X T ω) ∂μ)-(∫ ω, F ω*u 0 (X 0 ω) ∂μ) := by
|
| 65 |
+
have hδ : 0≤ stepSize T N := div_nonneg hT.le (Nat.cast_nonneg N)
|
| 66 |
+
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem_total hT.le hj
|
| 67 |
+
let τ := fun j : ℕ ↦ a+(meshTime T N j).toNNReal
|
| 68 |
+
have hτ (i : Fin N) : τ i≤τ (i+1) := by
|
| 69 |
+
dsimp [τ]
|
| 70 |
+
apply add_le_add le_rfl
|
| 71 |
+
apply Real.toNNReal_mono
|
| 72 |
+
dsimp [meshTime]
|
| 73 |
+
push_cast
|
| 74 |
+
nlinarith
|
| 75 |
+
have hτdiff (i : Fin N) : (τ (i+1) : ℝ)-(τ i : ℝ)=stepSize T N := by
|
| 76 |
+
dsimp only [τ]
|
| 77 |
+
rw [NNReal.coe_add,NNReal.coe_add,Real.coe_toNNReal _ (htime (i+1) i.isLt).1,
|
| 78 |
+
Real.coe_toNNReal _ (htime i i.isLt.le).1]
|
| 79 |
+
dsimp [meshTime]
|
| 80 |
+
push_cast
|
| 81 |
+
ring
|
| 82 |
+
have hWeq (i : Fin N) (ω : Ω) :
|
| 83 |
+
W (meshTime T N (i+1)) ω-W (meshTime T N i) ω=B (τ (i+1)) ω-B (τ i) ω :=
|
| 84 |
+
hW _ (htime i i.isLt.le) _ (htime (i+1) i.isLt) ω
|
| 85 |
+
have hFm' (i : Fin N) : StronglyMeasurable[ℱ (τ i)] F :=
|
| 86 |
+
hFm.mono (ℱ.mono (le_add_of_nonneg_right (by positivity)))
|
| 87 |
+
have hDm (i : Fin N) : StronglyMeasurable[ℱ (τ i)]
|
| 88 |
+
(fun ω ↦ F ω*deriv (u (meshTime T N i)) (X (meshTime T N i) ω)) :=
|
| 89 |
+
(hFm' i).mul ((h.continuous_deriv (htime i i.isLt.le)).comp_stronglyMeasurable
|
| 90 |
+
(hXM _ (htime i i.isLt.le)))
|
| 91 |
+
have hD2m (i : Fin N) : StronglyMeasurable[ℱ (τ i)]
|
| 92 |
+
(fun ω ↦ F ω*deriv (deriv (u (meshTime T N i))) (X (meshTime T N i) ω)) :=
|
| 93 |
+
(hFm' i).mul ((h.continuous_second (htime i i.isLt.le)).comp_stronglyMeasurable
|
| 94 |
+
(hXM _ (htime i i.isLt.le)))
|
| 95 |
+
have hDi (i : Fin N) : Integrable
|
| 96 |
+
(fun ω ↦ F ω*deriv (u (meshTime T N i)) (X (meshTime T N i) ω)) μ := by
|
| 97 |
+
apply Integrable.of_bound ((hDm i).mono (ℱ.le _)).aestronglyMeasurable (H*Lu)
|
| 98 |
+
filter_upwards [] with ω
|
| 99 |
+
rw [Real.norm_eq_abs,abs_mul]
|
| 100 |
+
exact mul_le_mul (hFb ω) (GradientStripCore.deriv_bound hLu hsp (htime i i.isLt.le) _)
|
| 101 |
+
(abs_nonneg _) hH
|
| 102 |
+
have hD2i (i : Fin N) : Integrable
|
| 103 |
+
(fun ω ↦ F ω*deriv (deriv (u (meshTime T N i))) (X (meshTime T N i) ω)) μ := by
|
| 104 |
+
apply Integrable.of_bound ((hD2m i).mono (ℱ.le _)).aestronglyMeasurable (H*K)
|
| 105 |
+
filter_upwards [] with ω
|
| 106 |
+
rw [Real.norm_eq_abs,abs_mul]
|
| 107 |
+
exact mul_le_mul (hFb ω) (h.second_bound _ (htime i i.isLt.le) _) (abs_nonneg _) hH
|
| 108 |
+
apply weighted_pathGradientResidual_integral (hVi T ⟨hT.le,le_rfl⟩) (hVi 0 ⟨le_rfl,hT.le⟩)
|
| 109 |
+
· intro i
|
| 110 |
+
simpa only [hWeq,mul_assoc] using
|
| 111 |
+
brownian_predictable_increment_integrable hB hBm (hτ i) (hDm i) (hDi i)
|
| 112 |
+
· intro i
|
| 113 |
+
simpa only [hWeq,hτdiff,mul_assoc] using
|
| 114 |
+
brownian_predictable_quadratic_integrable hB hBm (hτ i) (hD2m i) (hD2i i)
|
| 115 |
+
· intro i
|
| 116 |
+
simpa only [hWeq,mul_assoc] using brownian_predictable_increment_mean hB hBm (hτ i) (hDm i)
|
| 117 |
+
· intro i
|
| 118 |
+
simpa only [hWeq,hτdiff,mul_assoc] using
|
| 119 |
+
brownian_predictable_quadratic_mean hB hBm (hτ i) (hD2m i)
|
| 120 |
+
have hh : (∫ ω, F ω*u T (X T ω) ∂μ)-(∫ ω, F ω*u 0 (X 0 ω) ∂μ)=0 := by
|
| 121 |
+
have hc : Tendsto (fun _ : ℕ ↦ (∫ ω, F ω*u T (X T ω) ∂μ)-
|
| 122 |
+
(∫ ω, F ω*u 0 (X 0 ω) ∂μ)) atTop (𝓝 (0 : ℝ)) := by
|
| 123 |
+
simpa only [hmean] using hlim
|
| 124 |
+
exact tendsto_nhds_unique tendsto_const_nhds hc
|
| 125 |
+
exact sub_eq_zero.mp hh
|
| 126 |
+
|
| 127 |
+
end SKValue
|
| 128 |
+
|
| 129 |
+
end
|
| 130 |
+
|
| 131 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/EulerL1.lean
CHANGED
|
@@ -1,202 +1,202 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.LipschitzCompMemLpFinite
|
| 3 |
-
import OAI.Probability.SKValue.Evolution.BoundedSmooth
|
| 4 |
-
import OAI.Probability.SKValue.Equations.TestGenerator
|
| 5 |
-
import OAI.Probability.SKValue.Processes.TestExpectation
|
| 6 |
-
|
| 7 |
-
namespace OAI
|
| 8 |
-
|
| 9 |
-
section
|
| 10 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 11 |
-
open scoped Topology NNReal BigOperators
|
| 12 |
-
namespace SKValue
|
| 13 |
-
lemma euler_same_noise_sum_bound {T G L e : ℝ} {d : ℕ → ℝ} {N : ℕ} {γ β : ℝ → ℝ}
|
| 14 |
-
{u v : ℝ → ℝ → ℝ} (hT : 0≤T) (hN : 0<N)
|
| 15 |
-
(hG : 0≤G) (hL : 0≤L) (hd : ∀ k<N,0≤d k) (he : 0≤e)
|
| 16 |
-
(hg : ∀ j<N,|γ (meshTime T N j)|≤G)
|
| 17 |
-
(hc : ∀ j<N,|β (meshTime T N j)-γ (meshTime T N j)|≤d j)
|
| 18 |
-
(hv : ∀ j<N,∀ x,|v (meshTime T N j) x|≤1)
|
| 19 |
-
(hs : ∀ j<N,∀ x,|v (meshTime T N j) x-u (meshTime T N j) x|≤e)
|
| 20 |
-
(hu : ∀ j<N,∀ x y,|u (meshTime T N j) x-u (meshTime T N j) y|≤L*|x-y|)
|
| 21 |
-
(z : Fin (N+1) → ℝ) {j : ℕ} (hj : j≤N) :
|
| 22 |
-
|euler T N β v z j-euler T N γ u z j|≤(∑ k∈Finset.range j,stepSize T N*(d k+G*e))*Real.exp (T*G*L) := by
|
| 23 |
-
let δ := stepSize T N
|
| 24 |
-
have hδ : 0≤δ := div_nonneg hT (Nat.cast_nonneg _)
|
| 25 |
-
have hNd : (N : ℝ)*δ=T := by dsimp [δ,stepSize]; field_simp
|
| 26 |
-
have hrec (k : ℕ) (hk : k<N) :
|
| 27 |
-
|euler T N β v z (k+1)-euler T N γ u z (k+1)|≤
|
| 28 |
-
(1+δ*G*L)*|euler T N β v z k-euler T N γ u z k|+δ*(d k+G*e) := by
|
| 29 |
-
let y := euler T N β v z k
|
| 30 |
-
let x := euler T N γ u z k
|
| 31 |
-
let t := meshTime T N k
|
| 32 |
-
have hb : |β t*v t y-γ t*u t x|≤d k+G*e+G*L*|y-x| := by
|
| 33 |
-
calc
|
| 34 |
-
|β t*v t y-γ t*u t x| = |(β t-γ t)*v t y+γ t*(v t y-u t y)+γ t*(u t y-u t x)| := by congr 1; ring
|
| 35 |
-
_ ≤ |(β t-γ t)*v t y|+|γ t*(v t y-u t y)|+|γ t*(u t y-u t x)| := (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl)
|
| 36 |
-
_ ≤ d k*1+G*e+G*(L*|y-x|) := by
|
| 37 |
-
simp only [abs_mul]
|
| 38 |
-
gcongr
|
| 39 |
-
· exact hd k hk
|
| 40 |
-
· exact hc k hk
|
| 41 |
-
· exact hv k hk y
|
| 42 |
-
· exact hg k hk
|
| 43 |
-
· exact hs k hk y
|
| 44 |
-
· exact hg k hk
|
| 45 |
-
· exact hu k hk y x
|
| 46 |
-
_ = _ := by ring
|
| 47 |
-
change |y+Real.sqrt δ*coordinate N k z+δ*β t*v t y-
|
| 48 |
-
(x+Real.sqrt δ*coordinate N k z+δ*γ t*u t x)|≤_
|
| 49 |
-
calc
|
| 50 |
-
_ = |(y-x)+δ*(β t*v t y-γ t*u t x)| := by congr 1; ring
|
| 51 |
-
_ ≤ |y-x|+δ*|β t*v t y-γ t*u t x| := by simpa only [abs_mul,abs_of_nonneg hδ] using abs_add_le (y-x) (δ*(β t*v t y-γ t*u t x))
|
| 52 |
-
_ ≤ |y-x|+δ*(d k+G*e+G*L*|y-x|) := add_le_add_right (mul_le_mul_of_nonneg_left hb hδ) _
|
| 53 |
-
_ = _ := by ring
|
| 54 |
-
have h := finite_discrete_gronwall (e := fun k ↦ |euler T N β v z k-euler T N γ u z k|) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 55 |
-
(show |euler T N β v z 0-euler T N γ u z 0|=0 by simp [euler])
|
| 56 |
-
(fun k hk ↦ mul_nonneg hδ (add_nonneg (hd k hk) (mul_nonneg hG he))) hrec j hj
|
| 57 |
-
apply h.trans
|
| 58 |
-
apply mul_le_mul le_rfl
|
| 59 |
-
· apply Real.exp_le_exp.mpr
|
| 60 |
-
calc
|
| 61 |
-
(j : ℝ)*(δ*G*L)≤(N : ℝ)*(δ*G*L) := mul_le_mul_of_nonneg_right (by exact_mod_cast hj) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 62 |
-
_=T*G*L := by rw [←hNd]; ring
|
| 63 |
-
· positivity
|
| 64 |
-
· exact Finset.sum_nonneg (fun k hk ↦ mul_nonneg hδ (add_nonneg (hd k ((Finset.mem_range.mp hk).trans_le hj)) (mul_nonneg hG he)))
|
| 65 |
-
|
| 66 |
-
end SKValue
|
| 67 |
-
|
| 68 |
-
end
|
| 69 |
-
|
| 70 |
-
section
|
| 71 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 72 |
-
open scoped Topology NNReal BigOperators
|
| 73 |
-
namespace SKValue
|
| 74 |
-
lemma monotone_grid_sum_tendsto {γ:ℝ → ℝ} {T:ℝ} (hT:0<T)
|
| 75 |
-
(hm:MonotoneOn γ (Icc (0:ℝ) T)) (h0:0≤γ 0) :
|
| 76 |
-
Tendsto (fun N:ℕ ↦ stepSize T N*∑ j∈Finset.range N,γ (meshTime T N j)) atTop
|
| 77 |
-
(𝓝 (∫ t in (0:ℝ)..T,γ t)) := by
|
| 78 |
-
simpa only [mul_one,stepSize,meshTime] using
|
| 79 |
-
monotone_weighted_grid_tendsto (γ:=γ) (f:=fun _ ↦ (1:ℝ)) (K:=1) hT (by norm_num) hm h0
|
| 80 |
-
continuousOn_const (fun _ _ ↦ by norm_num)
|
| 81 |
-
lemma euler_ordered_coeff_bound {T G L a b:ℝ} {β γ:ℝ → ℝ} {u v:ℝ → ℝ → ℝ}
|
| 82 |
-
{N:ℕ} (hT:0≤T) (hN:0<N) (hG:0≤G) (hL:0≤L) (ha:0≤a) (hb:0≤b)
|
| 83 |
-
(hg:∀ j<N,|γ (meshTime T N j)|≤G)
|
| 84 |
-
(hc:∀ j<N,β (meshTime T N j)≤γ (meshTime T N j)+a)
|
| 85 |
-
(hv:∀ j<N,∀ x,|v (meshTime T N j) x|≤1)
|
| 86 |
-
(hs:∀ j<N,∀ x,|v (meshTime T N j) x-u (meshTime T N j) x|≤b)
|
| 87 |
-
(hu:∀ j<N,∀ x y,|u (meshTime T N j) x-u (meshTime T N j) y|≤L*|x-y|)
|
| 88 |
-
(z:Fin (N+1) → ℝ) :
|
| 89 |
-
|euler T N β v z N-euler T N γ u z N|≤
|
| 90 |
-
(stepSize T N*(∑ j∈Finset.range N,γ (meshTime T N j))-
|
| 91 |
-
stepSize T N*(∑ j∈Finset.range N,β (meshTime T N j))+T*(2*a+G*b))*Real.exp (T*G*L) := by
|
| 92 |
-
have hd (j:ℕ) (hj:j<N) : 0≤γ (meshTime T N j)-β (meshTime T N j)+2*a := by linarith [hc j hj]
|
| 93 |
-
have h:=euler_same_noise_sum_bound (β:=β) (γ:=γ) (u:=u) (v:=v) hT hN hG hL hd hb hg
|
| 94 |
-
(fun j hj ↦ by apply abs_le.mpr;constructor <;> linarith [hc j hj]) hv hs hu z le_rfl
|
| 95 |
-
have he:(∑ j∈Finset.range N,stepSize T N*(γ (meshTime T N j)-β (meshTime T N j)+2*a+G*b))=
|
| 96 |
-
stepSize T N*(∑ j∈Finset.range N,γ (meshTime T N j))-
|
| 97 |
-
stepSize T N*(∑ j∈Finset.range N,β (meshTime T N j))+T*(2*a+G*b) := by
|
| 98 |
-
simp only [mul_add,mul_sub,Finset.sum_add_distrib,Finset.sum_sub_distrib,←Finset.mul_sum,
|
| 99 |
-
Finset.sum_const,Finset.card_range,nsmul_eq_mul]
|
| 100 |
-
have hNd:(N:ℝ)*stepSize T N=T := by dsimp [stepSize];field_simp
|
| 101 |
-
nlinarith only [congrArg (fun x:ℝ ↦ x*(2*a+G*b)) hNd]
|
| 102 |
-
rwa [he] at h
|
| 103 |
-
end SKValue
|
| 104 |
-
|
| 105 |
-
end
|
| 106 |
-
|
| 107 |
-
section
|
| 108 |
-
|
| 109 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 110 |
-
open scoped Topology NNReal BigOperators
|
| 111 |
-
namespace SKValue
|
| 112 |
-
lemma BackwardTest.diffusion_comparison {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 113 |
-
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 114 |
-
{X:ℝ → Ω → ℝ} {T K L K' L' Lu a b H:ℝ} {γ β:ℝ → ℝ} {u v V:ℝ → ℝ → ℝ}
|
| 115 |
-
(hT:0<T) (hT1:T≤1) (hu:GradientStrip T γ u K L) (h:BackwardTest T β v V K' L')
|
| 116 |
-
(hLu:0≤Lu) (hLip:∀ s∈Icc (0:ℝ) T,∀ t∈Icc (0:ℝ) T,∀ x y,
|
| 117 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 118 |
-
(ha:0≤a) (hb:0≤b) (hH:0≤H)
|
| 119 |
-
(hc:∀ t∈Icc (0:ℝ) T,β t≤γ t+a)
|
| 120 |
-
(hs:∀ t∈Icc (0:ℝ) T,∀ x,|v t x-u t x|≤b)
|
| 121 |
-
(hf:∀ x y,|V T x-V T y|≤H*|x-y|)
|
| 122 |
-
(hXM:∀ t∈Icc (0:ℝ) T,MemLp (X t) 2 μ)
|
| 123 |
-
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) T) ∧
|
| 124 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 125 |
-
(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 126 |
-
|(∫ ω,V T (X T ω) ∂μ)-V 0 0|≤
|
| 127 |
-
H*((∫ t in (0:ℝ)..T,γ t)-(∫ t in (0:ℝ)..T,β t)+T*(2*a+γ T*b))*Real.exp (T*γ T*Lu) := by
|
| 128 |
-
let D:=fun N:ℕ ↦ stepSize T N*(∑ j∈Finset.range N,γ (meshTime T N j))-
|
| 129 |
-
stepSize T N*(∑ j∈Finset.range N,β (meshTime T N j))+T*(2*a+γ T*b)
|
| 130 |
-
let E:=fun N:ℕ ↦ T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (β T) K' ((1/2+β T)*L')+
|
| 131 |
-
stepSize T N*K'*(β T-β 0)
|
| 132 |
-
let F:=fun N:ℕ ↦ H*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)
|
| 133 |
-
have hG:0≤γ T := hu.gamma_nonneg T ⟨hT.le,le_rfl⟩
|
| 134 |
-
have hD:Tendsto D atTop (𝓝 ((∫ t in (0:ℝ)..T,γ t)-(∫ t in (0:ℝ)..T,β t)+T*(2*a+γ T*b))) :=
|
| 135 |
-
((monotone_grid_sum_tendsto hT hu.gamma_mono (hu.gamma_nonneg 0 ⟨le_rfl,hT.le⟩)).sub
|
| 136 |
-
(monotone_grid_sum_tendsto hT h.gamma_mono (h.gamma_nonneg 0 ⟨le_rfl,hT.le⟩))).add_const _
|
| 137 |
-
have hδ:Tendsto (fun N:ℕ ↦ stepSize T N) atTop (𝓝 (0:ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 138 |
-
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 139 |
-
have hE:Tendsto E atTop (𝓝 0) := by
|
| 140 |
-
simpa only [E,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,add_zero] using
|
| 141 |
-
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean (β T) K' ((1/2+β T)*L'))).add
|
| 142 |
-
((hδ.mul_const K').mul_const (β T-β 0)))
|
| 143 |
-
have hF:Tendsto F atTop (𝓝 0) := by
|
| 144 |
-
simpa only [F,Function.comp_def,Real.sqrt_zero,mul_zero] using
|
| 145 |
-
(((Real.continuous_sqrt.tendsto 0).comp
|
| 146 |
-
(coupled_euler_L2_convergence hB hT hu hLu hLip (fun t ht ↦ (hXM t ht).aestronglyMeasurable) hpaths)).const_mul H)
|
| 147 |
-
have hlip:LipschitzWith ⟨H,hH⟩ (V T) := by
|
| 148 |
-
apply LipschitzWith.of_dist_le_mul
|
| 149 |
-
intro x y
|
| 150 |
-
exact hf x y
|
| 151 |
-
have hbound:∀ᶠ N in atTop,|(∫ ω,V T (X T ω) ∂μ)-V 0 0|≤E N+H*D N*Real.exp (T*γ T*Lu)+F N := by
|
| 152 |
-
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 153 |
-
let P:=fun z:Fin (N+1) → ℝ ↦ V T (euler T N β v z N)
|
| 154 |
-
let Q:=fun z:Fin (N+1) → ℝ ↦ V T (euler T N γ u z N)
|
| 155 |
-
have htime (j:ℕ) (hj:j≤N):meshTime T N j∈Icc (0:ℝ) T := mesh_time_mem hT.le hN hj
|
| 156 |
-
have hp:Integrable P (gaussianProduct (Fin (N+1))) := by
|
| 157 |
-
apply Integrable.of_bound ((hlip.continuous.measurable.comp
|
| 158 |
-
(measurable_euler T N β v (fun j hj ↦ h.drift_measurable _ (htime j hj.le)) N le_rfl)).aestronglyMeasurable) K'
|
| 159 |
-
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_apply] using h.bound T ⟨hT.le,le_rfl⟩ _)
|
| 160 |
-
have hq:Integrable Q (gaussianProduct (Fin (N+1))) := by
|
| 161 |
-
apply Integrable.of_bound ((hlip.continuous.measurable.comp
|
| 162 |
-
(measurable_euler T N γ u (fun j hj ↦ (hu.smooth _ (htime j hj.le)).continuous.measurable) N le_rfl)).aestronglyMeasurable) K'
|
| 163 |
-
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_apply] using h.bound T ⟨hT.le,le_rfl⟩ _)
|
| 164 |
-
have hpq:|(∫ z,P z ∂gaussianProduct (Fin (N+1)))-(∫ z,Q z ∂gaussianProduct (Fin (N+1)))|≤H*D N*Real.exp (T*γ T*Lu) := by
|
| 165 |
-
rw [←integral_sub hp hq]
|
| 166 |
-
apply (show |∫ z,P z-Q z ∂gaussianProduct (Fin (N+1))|≤H*D N*Real.exp (T*γ T*Lu) from ?_)
|
| 167 |
-
have hnorm:=norm_integral_le_of_norm_le_const (μ:=gaussianProduct (Fin (N+1)))
|
| 168 |
-
(C:=H*D N*Real.exp (T*γ T*Lu)) (f:=fun z ↦ P z-Q z) (Eventually.of_forall (fun z ↦ by
|
| 169 |
-
rw [Real.norm_eq_abs]
|
| 170 |
-
apply (hf _ _).trans
|
| 171 |
-
have he:=euler_ordered_coeff_bound (β:=β) (γ:=γ) (u:=u) (v:=v) hT.le hN hG hLu ha hb
|
| 172 |
-
(fun j hj ↦ by rw [abs_of_nonneg (hu.gamma_nonneg _ (htime j hj.le))]; exact hu.gamma_mono (htime j hj.le) ⟨hT.le,le_rfl⟩ (htime j hj.le).2)
|
| 173 |
-
(fun j hj ↦ hc _ (htime j hj.le)) (fun j hj ↦ h.drift_bound _ (htime j hj.le))
|
| 174 |
-
(fun j hj ↦ hs _ (htime j hj.le))
|
| 175 |
-
(fun j hj x y ↦ by simpa only [sub_self,abs_zero,zero_add] using hLip _ (htime j hj.le) _ (htime j hj.le) x y) z
|
| 176 |
-
simpa only [D,mul_assoc] using mul_le_mul_of_nonneg_left he hH))
|
| 177 |
-
simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hnorm
|
| 178 |
-
have he:=h.mesh_expectation hT hT1 hN
|
| 179 |
-
have hqX:=coupled_lipschitz_expectation_bound hB hT hu hXM
|
| 180 |
-
(hpaths.mono (fun _ hω ↦ hω.2.2)) hN le_rfl hlip
|
| 181 |
-
have hend:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 182 |
-
rw [hend] at hqX
|
| 183 |
-
change |(∫ z,Q z ∂gaussianProduct (Fin (N+1)))-(∫ ω,V T (X T ω) ∂μ)|≤F N at hqX
|
| 184 |
-
change |(∫ z,P z ∂gaussianProduct (Fin (N+1)))-V 0 0|≤E N at he
|
| 185 |
-
calc
|
| 186 |
-
|(∫ ω,V T (X T ω) ∂μ)-V 0 0| ≤
|
| 187 |
-
|(∫ ω,V T (X T ω) ∂μ)-(∫ z,Q z ∂gaussianProduct (Fin (N+1)))|+
|
| 188 |
-
|(∫ z,Q z ∂gaussianProduct (Fin (N+1)))-V 0 0| := abs_sub_le _ _ _
|
| 189 |
-
_ ≤ F N+(H*D N*Real.exp (T*γ T*Lu)+E N) := by
|
| 190 |
-
apply add_le_add
|
| 191 |
-
· rw [abs_sub_comm]; exact hqX
|
| 192 |
-
· exact (abs_sub_le _ (∫ z,P z ∂gaussianProduct (Fin (N+1))) _).trans
|
| 193 |
-
(add_le_add (by rw [abs_sub_comm]; exact hpq) he)
|
| 194 |
-
_ = E N+H*D N*Real.exp (T*γ T*Lu)+F N := by ring
|
| 195 |
-
have he:=le_of_tendsto_of_tendsto tendsto_const_nhds
|
| 196 |
-
((hE.add ((hD.const_mul H).mul_const (Real.exp (T*γ T*Lu)))).add hF) hbound
|
| 197 |
-
simpa only [zero_add,add_zero] using he
|
| 198 |
-
end SKValue
|
| 199 |
-
|
| 200 |
-
end
|
| 201 |
-
|
| 202 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.LipschitzCompMemLpFinite
|
| 3 |
+
import OAI.Probability.SKValue.Evolution.BoundedSmooth
|
| 4 |
+
import OAI.Probability.SKValue.Equations.TestGenerator
|
| 5 |
+
import OAI.Probability.SKValue.Processes.TestExpectation
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
section
|
| 10 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 11 |
+
open scoped Topology NNReal BigOperators
|
| 12 |
+
namespace SKValue
|
| 13 |
+
lemma euler_same_noise_sum_bound {T G L e : ℝ} {d : ℕ → ℝ} {N : ℕ} {γ β : ℝ → ℝ}
|
| 14 |
+
{u v : ℝ → ℝ → ℝ} (hT : 0≤T) (hN : 0<N)
|
| 15 |
+
(hG : 0≤G) (hL : 0≤L) (hd : ∀ k<N,0≤d k) (he : 0≤e)
|
| 16 |
+
(hg : ∀ j<N,|γ (meshTime T N j)|≤G)
|
| 17 |
+
(hc : ∀ j<N,|β (meshTime T N j)-γ (meshTime T N j)|≤d j)
|
| 18 |
+
(hv : ∀ j<N,∀ x,|v (meshTime T N j) x|≤1)
|
| 19 |
+
(hs : ∀ j<N,∀ x,|v (meshTime T N j) x-u (meshTime T N j) x|≤e)
|
| 20 |
+
(hu : ∀ j<N,∀ x y,|u (meshTime T N j) x-u (meshTime T N j) y|≤L*|x-y|)
|
| 21 |
+
(z : Fin (N+1) → ℝ) {j : ℕ} (hj : j≤N) :
|
| 22 |
+
|euler T N β v z j-euler T N γ u z j|≤(∑ k∈Finset.range j,stepSize T N*(d k+G*e))*Real.exp (T*G*L) := by
|
| 23 |
+
let δ := stepSize T N
|
| 24 |
+
have hδ : 0≤δ := div_nonneg hT (Nat.cast_nonneg _)
|
| 25 |
+
have hNd : (N : ℝ)*δ=T := by dsimp [δ,stepSize]; field_simp
|
| 26 |
+
have hrec (k : ℕ) (hk : k<N) :
|
| 27 |
+
|euler T N β v z (k+1)-euler T N γ u z (k+1)|≤
|
| 28 |
+
(1+δ*G*L)*|euler T N β v z k-euler T N γ u z k|+δ*(d k+G*e) := by
|
| 29 |
+
let y := euler T N β v z k
|
| 30 |
+
let x := euler T N γ u z k
|
| 31 |
+
let t := meshTime T N k
|
| 32 |
+
have hb : |β t*v t y-γ t*u t x|≤d k+G*e+G*L*|y-x| := by
|
| 33 |
+
calc
|
| 34 |
+
|β t*v t y-γ t*u t x| = |(β t-γ t)*v t y+γ t*(v t y-u t y)+γ t*(u t y-u t x)| := by congr 1; ring
|
| 35 |
+
_ ≤ |(β t-γ t)*v t y|+|γ t*(v t y-u t y)|+|γ t*(u t y-u t x)| := (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl)
|
| 36 |
+
_ ≤ d k*1+G*e+G*(L*|y-x|) := by
|
| 37 |
+
simp only [abs_mul]
|
| 38 |
+
gcongr
|
| 39 |
+
· exact hd k hk
|
| 40 |
+
· exact hc k hk
|
| 41 |
+
· exact hv k hk y
|
| 42 |
+
· exact hg k hk
|
| 43 |
+
· exact hs k hk y
|
| 44 |
+
· exact hg k hk
|
| 45 |
+
· exact hu k hk y x
|
| 46 |
+
_ = _ := by ring
|
| 47 |
+
change |y+Real.sqrt δ*coordinate N k z+δ*β t*v t y-
|
| 48 |
+
(x+Real.sqrt δ*coordinate N k z+δ*γ t*u t x)|≤_
|
| 49 |
+
calc
|
| 50 |
+
_ = |(y-x)+δ*(β t*v t y-γ t*u t x)| := by congr 1; ring
|
| 51 |
+
_ ≤ |y-x|+δ*|β t*v t y-γ t*u t x| := by simpa only [abs_mul,abs_of_nonneg hδ] using abs_add_le (y-x) (δ*(β t*v t y-γ t*u t x))
|
| 52 |
+
_ ≤ |y-x|+δ*(d k+G*e+G*L*|y-x|) := add_le_add_right (mul_le_mul_of_nonneg_left hb hδ) _
|
| 53 |
+
_ = _ := by ring
|
| 54 |
+
have h := finite_discrete_gronwall (e := fun k ↦ |euler T N β v z k-euler T N γ u z k|) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 55 |
+
(show |euler T N β v z 0-euler T N γ u z 0|=0 by simp [euler])
|
| 56 |
+
(fun k hk ↦ mul_nonneg hδ (add_nonneg (hd k hk) (mul_nonneg hG he))) hrec j hj
|
| 57 |
+
apply h.trans
|
| 58 |
+
apply mul_le_mul le_rfl
|
| 59 |
+
· apply Real.exp_le_exp.mpr
|
| 60 |
+
calc
|
| 61 |
+
(j : ℝ)*(δ*G*L)≤(N : ℝ)*(δ*G*L) := mul_le_mul_of_nonneg_right (by exact_mod_cast hj) (mul_nonneg (mul_nonneg hδ hG) hL)
|
| 62 |
+
_=T*G*L := by rw [←hNd]; ring
|
| 63 |
+
· positivity
|
| 64 |
+
· exact Finset.sum_nonneg (fun k hk ↦ mul_nonneg hδ (add_nonneg (hd k ((Finset.mem_range.mp hk).trans_le hj)) (mul_nonneg hG he)))
|
| 65 |
+
|
| 66 |
+
end SKValue
|
| 67 |
+
|
| 68 |
+
end
|
| 69 |
+
|
| 70 |
+
section
|
| 71 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 72 |
+
open scoped Topology NNReal BigOperators
|
| 73 |
+
namespace SKValue
|
| 74 |
+
lemma monotone_grid_sum_tendsto {γ:ℝ → ℝ} {T:ℝ} (hT:0<T)
|
| 75 |
+
(hm:MonotoneOn γ (Icc (0:ℝ) T)) (h0:0≤γ 0) :
|
| 76 |
+
Tendsto (fun N:ℕ ↦ stepSize T N*∑ j∈Finset.range N,γ (meshTime T N j)) atTop
|
| 77 |
+
(𝓝 (∫ t in (0:ℝ)..T,γ t)) := by
|
| 78 |
+
simpa only [mul_one,stepSize,meshTime] using
|
| 79 |
+
monotone_weighted_grid_tendsto (γ:=γ) (f:=fun _ ↦ (1:ℝ)) (K:=1) hT (by norm_num) hm h0
|
| 80 |
+
continuousOn_const (fun _ _ ↦ by norm_num)
|
| 81 |
+
lemma euler_ordered_coeff_bound {T G L a b:ℝ} {β γ:ℝ → ℝ} {u v:ℝ → ℝ → ℝ}
|
| 82 |
+
{N:ℕ} (hT:0≤T) (hN:0<N) (hG:0≤G) (hL:0≤L) (ha:0≤a) (hb:0≤b)
|
| 83 |
+
(hg:∀ j<N,|γ (meshTime T N j)|≤G)
|
| 84 |
+
(hc:∀ j<N,β (meshTime T N j)≤γ (meshTime T N j)+a)
|
| 85 |
+
(hv:∀ j<N,∀ x,|v (meshTime T N j) x|≤1)
|
| 86 |
+
(hs:∀ j<N,∀ x,|v (meshTime T N j) x-u (meshTime T N j) x|≤b)
|
| 87 |
+
(hu:∀ j<N,∀ x y,|u (meshTime T N j) x-u (meshTime T N j) y|≤L*|x-y|)
|
| 88 |
+
(z:Fin (N+1) → ℝ) :
|
| 89 |
+
|euler T N β v z N-euler T N γ u z N|≤
|
| 90 |
+
(stepSize T N*(∑ j∈Finset.range N,γ (meshTime T N j))-
|
| 91 |
+
stepSize T N*(∑ j∈Finset.range N,β (meshTime T N j))+T*(2*a+G*b))*Real.exp (T*G*L) := by
|
| 92 |
+
have hd (j:ℕ) (hj:j<N) : 0≤γ (meshTime T N j)-β (meshTime T N j)+2*a := by linarith [hc j hj]
|
| 93 |
+
have h:=euler_same_noise_sum_bound (β:=β) (γ:=γ) (u:=u) (v:=v) hT hN hG hL hd hb hg
|
| 94 |
+
(fun j hj ↦ by apply abs_le.mpr;constructor <;> linarith [hc j hj]) hv hs hu z le_rfl
|
| 95 |
+
have he:(∑ j∈Finset.range N,stepSize T N*(γ (meshTime T N j)-β (meshTime T N j)+2*a+G*b))=
|
| 96 |
+
stepSize T N*(∑ j∈Finset.range N,γ (meshTime T N j))-
|
| 97 |
+
stepSize T N*(∑ j∈Finset.range N,β (meshTime T N j))+T*(2*a+G*b) := by
|
| 98 |
+
simp only [mul_add,mul_sub,Finset.sum_add_distrib,Finset.sum_sub_distrib,←Finset.mul_sum,
|
| 99 |
+
Finset.sum_const,Finset.card_range,nsmul_eq_mul]
|
| 100 |
+
have hNd:(N:ℝ)*stepSize T N=T := by dsimp [stepSize];field_simp
|
| 101 |
+
nlinarith only [congrArg (fun x:ℝ ↦ x*(2*a+G*b)) hNd]
|
| 102 |
+
rwa [he] at h
|
| 103 |
+
end SKValue
|
| 104 |
+
|
| 105 |
+
end
|
| 106 |
+
|
| 107 |
+
section
|
| 108 |
+
|
| 109 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 110 |
+
open scoped Topology NNReal BigOperators
|
| 111 |
+
namespace SKValue
|
| 112 |
+
lemma BackwardTest.diffusion_comparison {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 113 |
+
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 114 |
+
{X:ℝ → Ω → ℝ} {T K L K' L' Lu a b H:ℝ} {γ β:ℝ → ℝ} {u v V:ℝ → ℝ → ℝ}
|
| 115 |
+
(hT:0<T) (hT1:T≤1) (hu:GradientStrip T γ u K L) (h:BackwardTest T β v V K' L')
|
| 116 |
+
(hLu:0≤Lu) (hLip:∀ s∈Icc (0:ℝ) T,∀ t∈Icc (0:ℝ) T,∀ x y,
|
| 117 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 118 |
+
(ha:0≤a) (hb:0≤b) (hH:0≤H)
|
| 119 |
+
(hc:∀ t∈Icc (0:ℝ) T,β t≤γ t+a)
|
| 120 |
+
(hs:∀ t∈Icc (0:ℝ) T,∀ x,|v t x-u t x|≤b)
|
| 121 |
+
(hf:∀ x y,|V T x-V T y|≤H*|x-y|)
|
| 122 |
+
(hXM:∀ t∈Icc (0:ℝ) T,MemLp (X t) 2 μ)
|
| 123 |
+
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) T) ∧
|
| 124 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 125 |
+
(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 126 |
+
|(∫ ω,V T (X T ω) ∂μ)-V 0 0|≤
|
| 127 |
+
H*((∫ t in (0:ℝ)..T,γ t)-(∫ t in (0:ℝ)..T,β t)+T*(2*a+γ T*b))*Real.exp (T*γ T*Lu) := by
|
| 128 |
+
let D:=fun N:ℕ ↦ stepSize T N*(∑ j∈Finset.range N,γ (meshTime T N j))-
|
| 129 |
+
stepSize T N*(∑ j∈Finset.range N,β (meshTime T N j))+T*(2*a+γ T*b)
|
| 130 |
+
let E:=fun N:ℕ ↦ T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (β T) K' ((1/2+β T)*L')+
|
| 131 |
+
stepSize T N*K'*(β T-β 0)
|
| 132 |
+
let F:=fun N:ℕ ↦ H*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)
|
| 133 |
+
have hG:0≤γ T := hu.gamma_nonneg T ⟨hT.le,le_rfl⟩
|
| 134 |
+
have hD:Tendsto D atTop (𝓝 ((∫ t in (0:ℝ)..T,γ t)-(∫ t in (0:ℝ)..T,β t)+T*(2*a+γ T*b))) :=
|
| 135 |
+
((monotone_grid_sum_tendsto hT hu.gamma_mono (hu.gamma_nonneg 0 ⟨le_rfl,hT.le⟩)).sub
|
| 136 |
+
(monotone_grid_sum_tendsto hT h.gamma_mono (h.gamma_nonneg 0 ⟨le_rfl,hT.le⟩))).add_const _
|
| 137 |
+
have hδ:Tendsto (fun N:ℕ ↦ stepSize T N) atTop (𝓝 (0:ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 138 |
+
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 139 |
+
have hE:Tendsto E atTop (𝓝 0) := by
|
| 140 |
+
simpa only [E,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,add_zero] using
|
| 141 |
+
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean (β T) K' ((1/2+β T)*L'))).add
|
| 142 |
+
((hδ.mul_const K').mul_const (β T-β 0)))
|
| 143 |
+
have hF:Tendsto F atTop (𝓝 0) := by
|
| 144 |
+
simpa only [F,Function.comp_def,Real.sqrt_zero,mul_zero] using
|
| 145 |
+
(((Real.continuous_sqrt.tendsto 0).comp
|
| 146 |
+
(coupled_euler_L2_convergence hB hT hu hLu hLip (fun t ht ↦ (hXM t ht).aestronglyMeasurable) hpaths)).const_mul H)
|
| 147 |
+
have hlip:LipschitzWith ⟨H,hH⟩ (V T) := by
|
| 148 |
+
apply LipschitzWith.of_dist_le_mul
|
| 149 |
+
intro x y
|
| 150 |
+
exact hf x y
|
| 151 |
+
have hbound:∀ᶠ N in atTop,|(∫ ω,V T (X T ω) ∂μ)-V 0 0|≤E N+H*D N*Real.exp (T*γ T*Lu)+F N := by
|
| 152 |
+
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 153 |
+
let P:=fun z:Fin (N+1) → ℝ ↦ V T (euler T N β v z N)
|
| 154 |
+
let Q:=fun z:Fin (N+1) → ℝ ↦ V T (euler T N γ u z N)
|
| 155 |
+
have htime (j:ℕ) (hj:j≤N):meshTime T N j∈Icc (0:ℝ) T := mesh_time_mem hT.le hN hj
|
| 156 |
+
have hp:Integrable P (gaussianProduct (Fin (N+1))) := by
|
| 157 |
+
apply Integrable.of_bound ((hlip.continuous.measurable.comp
|
| 158 |
+
(measurable_euler T N β v (fun j hj ↦ h.drift_measurable _ (htime j hj.le)) N le_rfl)).aestronglyMeasurable) K'
|
| 159 |
+
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_apply] using h.bound T ⟨hT.le,le_rfl⟩ _)
|
| 160 |
+
have hq:Integrable Q (gaussianProduct (Fin (N+1))) := by
|
| 161 |
+
apply Integrable.of_bound ((hlip.continuous.measurable.comp
|
| 162 |
+
(measurable_euler T N γ u (fun j hj ↦ (hu.smooth _ (htime j hj.le)).continuous.measurable) N le_rfl)).aestronglyMeasurable) K'
|
| 163 |
+
exact Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs,Function.comp_apply] using h.bound T ⟨hT.le,le_rfl⟩ _)
|
| 164 |
+
have hpq:|(∫ z,P z ∂gaussianProduct (Fin (N+1)))-(∫ z,Q z ∂gaussianProduct (Fin (N+1)))|≤H*D N*Real.exp (T*γ T*Lu) := by
|
| 165 |
+
rw [←integral_sub hp hq]
|
| 166 |
+
apply (show |∫ z,P z-Q z ∂gaussianProduct (Fin (N+1))|≤H*D N*Real.exp (T*γ T*Lu) from ?_)
|
| 167 |
+
have hnorm:=norm_integral_le_of_norm_le_const (μ:=gaussianProduct (Fin (N+1)))
|
| 168 |
+
(C:=H*D N*Real.exp (T*γ T*Lu)) (f:=fun z ↦ P z-Q z) (Eventually.of_forall (fun z ↦ by
|
| 169 |
+
rw [Real.norm_eq_abs]
|
| 170 |
+
apply (hf _ _).trans
|
| 171 |
+
have he:=euler_ordered_coeff_bound (β:=β) (γ:=γ) (u:=u) (v:=v) hT.le hN hG hLu ha hb
|
| 172 |
+
(fun j hj ↦ by rw [abs_of_nonneg (hu.gamma_nonneg _ (htime j hj.le))]; exact hu.gamma_mono (htime j hj.le) ⟨hT.le,le_rfl⟩ (htime j hj.le).2)
|
| 173 |
+
(fun j hj ↦ hc _ (htime j hj.le)) (fun j hj ↦ h.drift_bound _ (htime j hj.le))
|
| 174 |
+
(fun j hj ↦ hs _ (htime j hj.le))
|
| 175 |
+
(fun j hj x y ↦ by simpa only [sub_self,abs_zero,zero_add] using hLip _ (htime j hj.le) _ (htime j hj.le) x y) z
|
| 176 |
+
simpa only [D,mul_assoc] using mul_le_mul_of_nonneg_left he hH))
|
| 177 |
+
simpa only [Real.norm_eq_abs,probReal_univ,mul_one] using hnorm
|
| 178 |
+
have he:=h.mesh_expectation hT hT1 hN
|
| 179 |
+
have hqX:=coupled_lipschitz_expectation_bound hB hT hu hXM
|
| 180 |
+
(hpaths.mono (fun _ hω ↦ hω.2.2)) hN le_rfl hlip
|
| 181 |
+
have hend:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 182 |
+
rw [hend] at hqX
|
| 183 |
+
change |(∫ z,Q z ∂gaussianProduct (Fin (N+1)))-(∫ ω,V T (X T ω) ∂μ)|≤F N at hqX
|
| 184 |
+
change |(∫ z,P z ∂gaussianProduct (Fin (N+1)))-V 0 0|≤E N at he
|
| 185 |
+
calc
|
| 186 |
+
|(∫ ω,V T (X T ω) ∂μ)-V 0 0| ≤
|
| 187 |
+
|(∫ ω,V T (X T ω) ∂μ)-(∫ z,Q z ∂gaussianProduct (Fin (N+1)))|+
|
| 188 |
+
|(∫ z,Q z ∂gaussianProduct (Fin (N+1)))-V 0 0| := abs_sub_le _ _ _
|
| 189 |
+
_ ≤ F N+(H*D N*Real.exp (T*γ T*Lu)+E N) := by
|
| 190 |
+
apply add_le_add
|
| 191 |
+
· rw [abs_sub_comm]; exact hqX
|
| 192 |
+
· exact (abs_sub_le _ (∫ z,P z ∂gaussianProduct (Fin (N+1))) _).trans
|
| 193 |
+
(add_le_add (by rw [abs_sub_comm]; exact hpq) he)
|
| 194 |
+
_ = E N+H*D N*Real.exp (T*γ T*Lu)+F N := by ring
|
| 195 |
+
have he:=le_of_tendsto_of_tendsto tendsto_const_nhds
|
| 196 |
+
((hE.add ((hD.const_mul H).mul_const (Real.exp (T*γ T*Lu)))).add hF) hbound
|
| 197 |
+
simpa only [zero_add,add_zero] using he
|
| 198 |
+
end SKValue
|
| 199 |
+
|
| 200 |
+
end
|
| 201 |
+
|
| 202 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/EulerLimitProcess.lean
CHANGED
|
@@ -1,128 +1,128 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.Volterra
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 8 |
-
open scoped Topology NNReal
|
| 9 |
-
namespace SKValue
|
| 10 |
-
noncomputable def eulerLimitProcess (W:BrownianSpace) (γ:OrderParameter) (t:ℝ) (z:W.Ω):ℝ :=
|
| 11 |
-
if 0<t ∧ t<1 then limsup (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop else 0
|
| 12 |
-
lemma eulerLimitProcess_zero (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω):eulerLimitProcess W γ 0 z=0 :=by
|
| 13 |
-
simp [eulerLimitProcess]
|
| 14 |
-
lemma eulerLimitProcess_measurable (W:BrownianSpace) (γ:OrderParameter) (t:ℝ):
|
| 15 |
-
StronglyMeasurable[W.filtration t.toNNReal] (eulerLimitProcess W γ t) := by
|
| 16 |
-
by_cases ht:0<t ∧ t<1
|
| 17 |
-
· change StronglyMeasurable[W.filtration t.toNNReal] (fun z ↦ if 0<t ∧ t<1 then limsup (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop else 0)
|
| 18 |
-
simp only [ite_eq_left ht]
|
| 19 |
-
apply Measurable.stronglyMeasurable
|
| 20 |
-
apply Measurable.limsup
|
| 21 |
-
intro N
|
| 22 |
-
by_cases hN:N=0
|
| 23 |
-
· subst N
|
| 24 |
-
exact measurable_const
|
| 25 |
-
have hN':0<N:=Nat.pos_of_ne_zero hN
|
| 26 |
-
have hh:=coupled_euler_past_measurable W.measurable ht.1 hN' γ.coeff (gradient W γ)
|
| 27 |
-
(fun j hj ↦ ((phi_evolution W γ ⟨ht.1.le,ht.2⟩).slices _ (mesh_time_mem ht.1.le hN' hj.le)).jets.smooth.continuous.measurable) N le_rfl
|
| 28 |
-
have he:meshTime t N N=t:=by dsimp [meshTime,stepSize];field_simp
|
| 29 |
-
rw [he] at hh
|
| 30 |
-
exact hh.measurable
|
| 31 |
-
· change StronglyMeasurable[W.filtration t.toNNReal] (fun z ↦ if 0<t ∧ t<1 then limsup (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop else 0)
|
| 32 |
-
simp only [ite_eq_right ht]
|
| 33 |
-
exact stronglyMeasurable_const
|
| 34 |
-
lemma eulerLimitProcess_eq_path (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 35 |
-
{T:ℝ} (hT:T∈Ico (0:ℝ) 1) {X:ℝ → ℝ}
|
| 36 |
-
(hc:ContinuousOn X (Icc (0:ℝ) T))
|
| 37 |
-
(hi:IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s)) volume 0 T)
|
| 38 |
-
(he:∀t∈Icc (0:ℝ) T,X t=W.B t.toNNReal z+∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (X s))
|
| 39 |
-
(h0:X 0=0) {t:ℝ} (ht:t∈Icc (0:ℝ) T):eulerLimitProcess W γ t z=X t := by
|
| 40 |
-
rcases ht.1.eq_or_lt with htz|htz
|
| 41 |
-
· subst t
|
| 42 |
-
rw [eulerLimitProcess_zero,h0]
|
| 43 |
-
have ht1:t<1:=ht.2.trans_lt hT.2
|
| 44 |
-
obtain ⟨K,L,Lu,hLu,hG,hu⟩:=(sourceStripRegularity W γ).core t ⟨htz.le,ht1⟩
|
| 45 |
-
have hsub:Icc (0:ℝ) t⊆Icc (0:ℝ) T:=Icc_subset_Icc le_rfl ht.2
|
| 46 |
-
have hi':IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s)) volume 0 t:=hi.mono_set (by
|
| 47 |
-
rw [uIcc_of_le htz.le,uIcc_of_le hT.1];exact hsub)
|
| 48 |
-
have hv:=driven_euler_uniform_convergence
|
| 49 |
-
(Y:=fun N j ↦ coupledEuler t γ.coeff (gradient W γ) W.B N j z) htz.le hLu
|
| 50 |
-
(γ.monotone.mono (fun s hs ↦ ⟨hs.1,hs.2.trans_lt ht1⟩))
|
| 51 |
-
(γ.nonneg 0 (by norm_num)) (fun s hs x ↦ gradient_bound W γ ⟨hs.1,hs.2.trans ht1.le⟩ x)
|
| 52 |
-
hu (hc.mono hsub) hi' (fun s hs ↦ he s (hsub hs)) h0
|
| 53 |
-
(fun N ↦ coupled_euler_zero t γ.coeff (gradient W γ) W.B N z)
|
| 54 |
-
(fun N hN j hj ↦ coupled_euler_step W.B htz γ.coeff (gradient W γ) hN hj z)
|
| 55 |
-
have hl:Tendsto (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop (𝓝 (X t)) :=by
|
| 56 |
-
apply Metric.tendsto_atTop.mpr
|
| 57 |
-
intro ε hε
|
| 58 |
-
obtain ⟨N,hN⟩:=eventually_atTop.mp (hv ε hε)
|
| 59 |
-
refine ⟨max N 1,?_⟩
|
| 60 |
-
intro n hn
|
| 61 |
-
have hnpos:0<n:= lt_of_lt_of_le (by norm_num:(0:ℕ)<1) ((le_max_right N 1).trans hn)
|
| 62 |
-
have hh:=hN n ((le_max_left N 1).trans hn) n le_rfl
|
| 63 |
-
have hnt:(n:ℝ)*(t/n)=t:=by field_simp
|
| 64 |
-
simpa only [hnt,Real.dist_eq] using hh
|
| 65 |
-
simpa only [eulerLimitProcess,ite_eq_left (show 0<t ∧ t<1 from ⟨htz,ht1⟩)] using hl.limsup_eq
|
| 66 |
-
end SKValue
|
| 67 |
-
|
| 68 |
-
end
|
| 69 |
-
|
| 70 |
-
section
|
| 71 |
-
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 72 |
-
open scoped Topology NNReal
|
| 73 |
-
namespace SKValue
|
| 74 |
-
lemma eulerLimitProcess_local_path (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 75 |
-
(hb:Continuous (fun t:ℝ ↦ W.B t.toNNReal z)) (h0:W.B 0 z=0)
|
| 76 |
-
{T:ℝ} (hT:T∈Ico (0:ℝ) 1):
|
| 77 |
-
ContinuousOn (fun t ↦ eulerLimitProcess W γ t z) (Icc (0:ℝ) T) ∧
|
| 78 |
-
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z)) volume 0 T ∧
|
| 79 |
-
∀t∈Icc (0:ℝ) T,eulerLimitProcess W γ t z=W.B t.toNNReal z+
|
| 80 |
-
∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z) :=by
|
| 81 |
-
obtain ⟨X,hc,hi,he⟩:=exists_local_diffusion_path W γ hT _ hb.continuousOn
|
| 82 |
-
have hz:X 0=0:=by simpa only [Real.toNNReal_zero,h0,intervalIntegral.integral_same,add_zero] using he 0 ⟨le_rfl,hT.1⟩
|
| 83 |
-
have heq (t:ℝ) (ht:t∈Icc (0:ℝ) T):eulerLimitProcess W γ t z=X t:=
|
| 84 |
-
eulerLimitProcess_eq_path W γ z hT hc hi he hz ht
|
| 85 |
-
refine ⟨hc.congr heq,hi.congr (fun s hs ↦ ?_),?_⟩
|
| 86 |
-
· rw [uIoc_of_le hT.1] at hs
|
| 87 |
-
rw [heq s ⟨hs.1.le,hs.2⟩]
|
| 88 |
-
intro t ht
|
| 89 |
-
rw [heq t ht,he t ht]
|
| 90 |
-
congr 1
|
| 91 |
-
apply intervalIntegral.integral_congr
|
| 92 |
-
intro s hs
|
| 93 |
-
rw [uIcc_of_le ht.1] at hs
|
| 94 |
-
dsimp only
|
| 95 |
-
rw [heq s ⟨hs.1,hs.2.trans ht.2⟩]
|
| 96 |
-
lemma continuousOn_preterminal_of_strips {f:ℝ → ℝ}
|
| 97 |
-
(h:∀T∈Ico (0:ℝ) 1,ContinuousOn f (Icc (0:ℝ) T)):
|
| 98 |
-
ContinuousOn f (Ico (0:ℝ) 1) :=by
|
| 99 |
-
intro t ht
|
| 100 |
-
obtain ⟨T,htT,hT⟩:=exists_between ht.2
|
| 101 |
-
apply (h T ⟨ht.1.trans htT.le,hT⟩ t ⟨ht.1,htT.le⟩).mono_of_mem_nhdsWithin
|
| 102 |
-
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds htT)] with s hs hsT
|
| 103 |
-
exact ⟨hs.1,hsT.le⟩
|
| 104 |
-
lemma eulerLimitProcess_drift_integrable (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 105 |
-
(hb:Continuous (fun t:ℝ ↦ W.B t.toNNReal z)) (h0:W.B 0 z=0):
|
| 106 |
-
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z)) volume 0 1 :=by
|
| 107 |
-
have hu:ContinuousOn (fun s ↦ gradient W γ s (eulerLimitProcess W γ s z)) (Ico (0:ℝ) 1):=by
|
| 108 |
-
apply continuousOn_preterminal_of_strips
|
| 109 |
-
intro T hT
|
| 110 |
-
obtain ⟨K,L,Lu,hLu,hG,hLip⟩:=(sourceStripRegularity W γ).core T hT
|
| 111 |
-
have hj:ContinuousOn (fun p:ℝ×ℝ ↦ gradient W γ p.1 p.2) {p | p.1∈Icc (0:ℝ) T}:=
|
| 112 |
-
derivative_joint_continuous hLu hLip
|
| 113 |
-
have hp:ContinuousOn (fun s ↦ (s,eulerLimitProcess W γ s z)) (Icc (0:ℝ) T):=
|
| 114 |
-
continuousOn_id.prodMk (eulerLimitProcess_local_path W γ z hb h0 hT).1
|
| 115 |
-
exact ContinuousOn.comp (g:=fun p:ℝ×ℝ ↦ gradient W γ p.1 p.2)
|
| 116 |
-
(f:=fun s ↦ (s,eulerLimitProcess W γ s z)) hj hp (fun s hs ↦ hs)
|
| 117 |
-
apply (intervalIntegrable_iff_integrableOn_Ioc_of_le (by norm_num:(0:ℝ)≤1)).mpr
|
| 118 |
-
have hm:AEStronglyMeasurable (fun s ↦ gradient W γ s (eulerLimitProcess W γ s z)) (volume.restrict (Ioc (0:ℝ) 1)) :=by
|
| 119 |
-
rw [←Measure.restrict_congr_set Ioo_ae_eq_Ioc]
|
| 120 |
-
exact (hu.mono Ioo_subset_Ico_self).aestronglyMeasurable measurableSet_Ioo
|
| 121 |
-
apply γ.integrable.mul_bdd hm (c:=(1:ℝ))
|
| 122 |
-
filter_upwards [ae_restrict_mem measurableSet_Ioc] with s hs
|
| 123 |
-
simpa only [Real.norm_eq_abs] using gradient_bound W γ ⟨hs.1.le,hs.2⟩ (eulerLimitProcess W γ s z)
|
| 124 |
-
end SKValue
|
| 125 |
-
|
| 126 |
-
end
|
| 127 |
-
|
| 128 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.Volterra
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 8 |
+
open scoped Topology NNReal
|
| 9 |
+
namespace SKValue
|
| 10 |
+
noncomputable def eulerLimitProcess (W:BrownianSpace) (γ:OrderParameter) (t:ℝ) (z:W.Ω):ℝ :=
|
| 11 |
+
if 0<t ∧ t<1 then limsup (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop else 0
|
| 12 |
+
lemma eulerLimitProcess_zero (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω):eulerLimitProcess W γ 0 z=0 :=by
|
| 13 |
+
simp [eulerLimitProcess]
|
| 14 |
+
lemma eulerLimitProcess_measurable (W:BrownianSpace) (γ:OrderParameter) (t:ℝ):
|
| 15 |
+
StronglyMeasurable[W.filtration t.toNNReal] (eulerLimitProcess W γ t) := by
|
| 16 |
+
by_cases ht:0<t ∧ t<1
|
| 17 |
+
· change StronglyMeasurable[W.filtration t.toNNReal] (fun z ↦ if 0<t ∧ t<1 then limsup (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop else 0)
|
| 18 |
+
simp only [ite_eq_left ht]
|
| 19 |
+
apply Measurable.stronglyMeasurable
|
| 20 |
+
apply Measurable.limsup
|
| 21 |
+
intro N
|
| 22 |
+
by_cases hN:N=0
|
| 23 |
+
· subst N
|
| 24 |
+
exact measurable_const
|
| 25 |
+
have hN':0<N:=Nat.pos_of_ne_zero hN
|
| 26 |
+
have hh:=coupled_euler_past_measurable W.measurable ht.1 hN' γ.coeff (gradient W γ)
|
| 27 |
+
(fun j hj ↦ ((phi_evolution W γ ⟨ht.1.le,ht.2⟩).slices _ (mesh_time_mem ht.1.le hN' hj.le)).jets.smooth.continuous.measurable) N le_rfl
|
| 28 |
+
have he:meshTime t N N=t:=by dsimp [meshTime,stepSize];field_simp
|
| 29 |
+
rw [he] at hh
|
| 30 |
+
exact hh.measurable
|
| 31 |
+
· change StronglyMeasurable[W.filtration t.toNNReal] (fun z ↦ if 0<t ∧ t<1 then limsup (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop else 0)
|
| 32 |
+
simp only [ite_eq_right ht]
|
| 33 |
+
exact stronglyMeasurable_const
|
| 34 |
+
lemma eulerLimitProcess_eq_path (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 35 |
+
{T:ℝ} (hT:T∈Ico (0:ℝ) 1) {X:ℝ → ℝ}
|
| 36 |
+
(hc:ContinuousOn X (Icc (0:ℝ) T))
|
| 37 |
+
(hi:IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s)) volume 0 T)
|
| 38 |
+
(he:∀t∈Icc (0:ℝ) T,X t=W.B t.toNNReal z+∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (X s))
|
| 39 |
+
(h0:X 0=0) {t:ℝ} (ht:t∈Icc (0:ℝ) T):eulerLimitProcess W γ t z=X t := by
|
| 40 |
+
rcases ht.1.eq_or_lt with htz|htz
|
| 41 |
+
· subst t
|
| 42 |
+
rw [eulerLimitProcess_zero,h0]
|
| 43 |
+
have ht1:t<1:=ht.2.trans_lt hT.2
|
| 44 |
+
obtain ⟨K,L,Lu,hLu,hG,hu⟩:=(sourceStripRegularity W γ).core t ⟨htz.le,ht1⟩
|
| 45 |
+
have hsub:Icc (0:ℝ) t⊆Icc (0:ℝ) T:=Icc_subset_Icc le_rfl ht.2
|
| 46 |
+
have hi':IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s)) volume 0 t:=hi.mono_set (by
|
| 47 |
+
rw [uIcc_of_le htz.le,uIcc_of_le hT.1];exact hsub)
|
| 48 |
+
have hv:=driven_euler_uniform_convergence
|
| 49 |
+
(Y:=fun N j ↦ coupledEuler t γ.coeff (gradient W γ) W.B N j z) htz.le hLu
|
| 50 |
+
(γ.monotone.mono (fun s hs ↦ ⟨hs.1,hs.2.trans_lt ht1⟩))
|
| 51 |
+
(γ.nonneg 0 (by norm_num)) (fun s hs x ↦ gradient_bound W γ ⟨hs.1,hs.2.trans ht1.le⟩ x)
|
| 52 |
+
hu (hc.mono hsub) hi' (fun s hs ↦ he s (hsub hs)) h0
|
| 53 |
+
(fun N ↦ coupled_euler_zero t γ.coeff (gradient W γ) W.B N z)
|
| 54 |
+
(fun N hN j hj ↦ coupled_euler_step W.B htz γ.coeff (gradient W γ) hN hj z)
|
| 55 |
+
have hl:Tendsto (fun N:ℕ ↦ coupledEuler t γ.coeff (gradient W γ) W.B N N z) atTop (𝓝 (X t)) :=by
|
| 56 |
+
apply Metric.tendsto_atTop.mpr
|
| 57 |
+
intro ε hε
|
| 58 |
+
obtain ⟨N,hN⟩:=eventually_atTop.mp (hv ε hε)
|
| 59 |
+
refine ⟨max N 1,?_⟩
|
| 60 |
+
intro n hn
|
| 61 |
+
have hnpos:0<n:= lt_of_lt_of_le (by norm_num:(0:ℕ)<1) ((le_max_right N 1).trans hn)
|
| 62 |
+
have hh:=hN n ((le_max_left N 1).trans hn) n le_rfl
|
| 63 |
+
have hnt:(n:ℝ)*(t/n)=t:=by field_simp
|
| 64 |
+
simpa only [hnt,Real.dist_eq] using hh
|
| 65 |
+
simpa only [eulerLimitProcess,ite_eq_left (show 0<t ∧ t<1 from ⟨htz,ht1⟩)] using hl.limsup_eq
|
| 66 |
+
end SKValue
|
| 67 |
+
|
| 68 |
+
end
|
| 69 |
+
|
| 70 |
+
section
|
| 71 |
+
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 72 |
+
open scoped Topology NNReal
|
| 73 |
+
namespace SKValue
|
| 74 |
+
lemma eulerLimitProcess_local_path (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 75 |
+
(hb:Continuous (fun t:ℝ ↦ W.B t.toNNReal z)) (h0:W.B 0 z=0)
|
| 76 |
+
{T:ℝ} (hT:T∈Ico (0:ℝ) 1):
|
| 77 |
+
ContinuousOn (fun t ↦ eulerLimitProcess W γ t z) (Icc (0:ℝ) T) ∧
|
| 78 |
+
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z)) volume 0 T ∧
|
| 79 |
+
∀t∈Icc (0:ℝ) T,eulerLimitProcess W γ t z=W.B t.toNNReal z+
|
| 80 |
+
∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z) :=by
|
| 81 |
+
obtain ⟨X,hc,hi,he⟩:=exists_local_diffusion_path W γ hT _ hb.continuousOn
|
| 82 |
+
have hz:X 0=0:=by simpa only [Real.toNNReal_zero,h0,intervalIntegral.integral_same,add_zero] using he 0 ⟨le_rfl,hT.1⟩
|
| 83 |
+
have heq (t:ℝ) (ht:t∈Icc (0:ℝ) T):eulerLimitProcess W γ t z=X t:=
|
| 84 |
+
eulerLimitProcess_eq_path W γ z hT hc hi he hz ht
|
| 85 |
+
refine ⟨hc.congr heq,hi.congr (fun s hs ↦ ?_),?_⟩
|
| 86 |
+
· rw [uIoc_of_le hT.1] at hs
|
| 87 |
+
rw [heq s ⟨hs.1.le,hs.2⟩]
|
| 88 |
+
intro t ht
|
| 89 |
+
rw [heq t ht,he t ht]
|
| 90 |
+
congr 1
|
| 91 |
+
apply intervalIntegral.integral_congr
|
| 92 |
+
intro s hs
|
| 93 |
+
rw [uIcc_of_le ht.1] at hs
|
| 94 |
+
dsimp only
|
| 95 |
+
rw [heq s ⟨hs.1,hs.2.trans ht.2⟩]
|
| 96 |
+
lemma continuousOn_preterminal_of_strips {f:ℝ → ℝ}
|
| 97 |
+
(h:∀T∈Ico (0:ℝ) 1,ContinuousOn f (Icc (0:ℝ) T)):
|
| 98 |
+
ContinuousOn f (Ico (0:ℝ) 1) :=by
|
| 99 |
+
intro t ht
|
| 100 |
+
obtain ⟨T,htT,hT⟩:=exists_between ht.2
|
| 101 |
+
apply (h T ⟨ht.1.trans htT.le,hT⟩ t ⟨ht.1,htT.le⟩).mono_of_mem_nhdsWithin
|
| 102 |
+
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds htT)] with s hs hsT
|
| 103 |
+
exact ⟨hs.1,hsT.le⟩
|
| 104 |
+
lemma eulerLimitProcess_drift_integrable (W:BrownianSpace) (γ:OrderParameter) (z:W.Ω)
|
| 105 |
+
(hb:Continuous (fun t:ℝ ↦ W.B t.toNNReal z)) (h0:W.B 0 z=0):
|
| 106 |
+
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (eulerLimitProcess W γ s z)) volume 0 1 :=by
|
| 107 |
+
have hu:ContinuousOn (fun s ↦ gradient W γ s (eulerLimitProcess W γ s z)) (Ico (0:ℝ) 1):=by
|
| 108 |
+
apply continuousOn_preterminal_of_strips
|
| 109 |
+
intro T hT
|
| 110 |
+
obtain ⟨K,L,Lu,hLu,hG,hLip⟩:=(sourceStripRegularity W γ).core T hT
|
| 111 |
+
have hj:ContinuousOn (fun p:ℝ×ℝ ↦ gradient W γ p.1 p.2) {p | p.1∈Icc (0:ℝ) T}:=
|
| 112 |
+
derivative_joint_continuous hLu hLip
|
| 113 |
+
have hp:ContinuousOn (fun s ↦ (s,eulerLimitProcess W γ s z)) (Icc (0:ℝ) T):=
|
| 114 |
+
continuousOn_id.prodMk (eulerLimitProcess_local_path W γ z hb h0 hT).1
|
| 115 |
+
exact ContinuousOn.comp (g:=fun p:ℝ×ℝ ↦ gradient W γ p.1 p.2)
|
| 116 |
+
(f:=fun s ↦ (s,eulerLimitProcess W γ s z)) hj hp (fun s hs ↦ hs)
|
| 117 |
+
apply (intervalIntegrable_iff_integrableOn_Ioc_of_le (by norm_num:(0:ℝ)≤1)).mpr
|
| 118 |
+
have hm:AEStronglyMeasurable (fun s ↦ gradient W γ s (eulerLimitProcess W γ s z)) (volume.restrict (Ioc (0:ℝ) 1)) :=by
|
| 119 |
+
rw [←Measure.restrict_congr_set Ioo_ae_eq_Ioc]
|
| 120 |
+
exact (hu.mono Ioo_subset_Ico_self).aestronglyMeasurable measurableSet_Ioo
|
| 121 |
+
apply γ.integrable.mul_bdd hm (c:=(1:ℝ))
|
| 122 |
+
filter_upwards [ae_restrict_mem measurableSet_Ioc] with s hs
|
| 123 |
+
simpa only [Real.norm_eq_abs] using gradient_bound W γ ⟨hs.1.le,hs.2⟩ (eulerLimitProcess W γ s z)
|
| 124 |
+
end SKValue
|
| 125 |
+
|
| 126 |
+
end
|
| 127 |
+
|
| 128 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/EulerMemLp.lean
CHANGED
|
@@ -1,151 +1,151 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.RawIncrement
|
| 3 |
-
import OAI.Probability.SKValue.Equations.ValueStrip
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
open MeasureTheory ProbabilityTheory Set
|
| 9 |
-
open scoped ENNReal NNReal BigOperators
|
| 10 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
-
open scoped BigOperators Topology
|
| 12 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
-
open scoped Topology BigOperators
|
| 14 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 15 |
-
open scoped Topology ENNReal NNReal
|
| 16 |
-
open Filter Set
|
| 17 |
-
open scoped Topology BigOperators
|
| 18 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 19 |
-
open scoped Topology
|
| 20 |
-
open MeasureTheory Set Filter
|
| 21 |
-
open scoped Topology BigOperators
|
| 22 |
-
open MeasureTheory Set Filter Finset
|
| 23 |
-
open scoped Topology BigOperators
|
| 24 |
-
namespace SKValue
|
| 25 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 26 |
-
open scoped Topology BigOperators
|
| 27 |
-
|
| 28 |
-
lemma euler_memLp (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 29 |
-
(huM : ∀ j<N, Measurable (u (meshTime T N j)))
|
| 30 |
-
(huB : ∀ j<N, ∀ x, |u (meshTime T N j) x|≤1) :
|
| 31 |
-
∀ j≤N, MemLp (fun z ↦ euler T N γ u z j) 2 (gaussianProduct (Fin (N+1))) := by
|
| 32 |
-
intro j
|
| 33 |
-
induction j with
|
| 34 |
-
| zero => intro _; exact memLp_const (0 : ℝ)
|
| 35 |
-
| succ j ih =>
|
| 36 |
-
intro hj
|
| 37 |
-
have hlt : j<N := by omega
|
| 38 |
-
have hU : MemLp (fun z ↦ u (meshTime T N j) (euler T N γ u z j)) 2
|
| 39 |
-
(gaussianProduct (Fin (N+1))) :=
|
| 40 |
-
MemLp.of_bound ((huM j hlt).comp (measurable_euler T N γ u huM j hlt.le)).aestronglyMeasurable 1
|
| 41 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using huB j hlt _))
|
| 42 |
-
exact ((ih hlt.le).add ((gaussian_memLp (coordinate_hasLaw N j) 2 (by norm_num)).const_mul _)).add
|
| 43 |
-
(hU.const_mul (stepSize T N*γ (meshTime T N j)))
|
| 44 |
-
|
| 45 |
-
lemma ValueStrip.value_lipschitz {T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 46 |
-
(h : ValueStrip T γ V K L) {t : ℝ} (ht : t∈Icc (0 : ℝ) T) :
|
| 47 |
-
LipschitzWith 1 (V t) := by
|
| 48 |
-
apply lipschitzWith_of_nnnorm_deriv_le ((h.smooth t ht).differentiable (by norm_num))
|
| 49 |
-
intro x
|
| 50 |
-
exact_mod_cast (show ‖deriv (V t) x‖≤(1 : ℝ) by simpa only [Real.norm_eq_abs] using h.bounded t ht x)
|
| 51 |
-
|
| 52 |
-
lemma ValueStrip.value_memLp {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsFiniteMeasure μ]
|
| 53 |
-
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ} (h : ValueStrip T γ V K L)
|
| 54 |
-
{t : ℝ} (ht : t∈Icc (0 : ℝ) T) {Y : Ω → ℝ} (hY : MemLp Y 2 μ) :
|
| 55 |
-
MemLp (fun ω ↦ V t (Y ω)) 2 μ := by
|
| 56 |
-
have hl : LipschitzWith 1 (fun x ↦ V t x - V t 0) := by
|
| 57 |
-
rw [lipschitzWith_iff_dist_le_mul]
|
| 58 |
-
intro x y
|
| 59 |
-
simpa only [dist_sub_right] using (h.value_lipschitz ht).dist_le_mul x y
|
| 60 |
-
have hh := hl.comp_memLp (by simp) hY
|
| 61 |
-
convert hh.add (memLp_const (V t 0)) using 1
|
| 62 |
-
funext ω
|
| 63 |
-
simp
|
| 64 |
-
|
| 65 |
-
lemma value_mesh_expectation_error {T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 66 |
-
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N) :
|
| 67 |
-
|(∫ z, V T (euler T N γ (fun t ↦ deriv (V t)) z N) ∂gaussianProduct (Fin (N+1)))-V 0 0-
|
| 68 |
-
(∫ z, valueMeshEnergy T N γ V N z ∂gaussianProduct (Fin (N+1)))| ≤
|
| 69 |
-
Real.sqrt (valueMeshError T N γ V) := by
|
| 70 |
-
let u := fun t ↦ deriv (V t)
|
| 71 |
-
let Y := euler T N γ u
|
| 72 |
-
let μ := gaussianProduct (Fin (N+1))
|
| 73 |
-
let A (i : Fin N) (z : Fin (N+1) → ℝ) := u (meshTime T N i) (Y z i)
|
| 74 |
-
let M (z : Fin (N+1) → ℝ) := ∑ i : Fin N, Real.sqrt (stepSize T N)*A i z*coordinate N i z
|
| 75 |
-
let R (z : Fin (N+1) → ℝ) := valueMeshCompensated T N γ V N z-V 0 0-M z
|
| 76 |
-
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT.le hN hj
|
| 77 |
-
have huc (j : ℕ) (hj : j≤N) : Continuous (u (meshTime T N j)) :=
|
| 78 |
-
(h.smooth _ (htime j hj)).continuous_deriv (by norm_num)
|
| 79 |
-
have hY (j : ℕ) (hj : j≤N) : Measurable (fun z ↦ Y z j) :=
|
| 80 |
-
measurable_euler T N γ u (fun i hi ↦ (huc i hi.le).measurable) j hj
|
| 81 |
-
have hAm (i : Fin N) : Measurable (A i) := (huc i i.isLt.le).measurable.comp (hY i i.isLt.le)
|
| 82 |
-
have hAb (i : Fin N) z : |A i z|≤1 := h.bounded _ (htime i i.isLt.le) _
|
| 83 |
-
have hAp (i : Fin N) : DependsBefore i (A i) := eulerCoefficient_dependsBefore T i.isLt.le γ u u
|
| 84 |
-
have hAM (i : Fin N) : MemLp (A i) 2 μ :=
|
| 85 |
-
MemLp.of_bound (hAm i).aestronglyMeasurable 1
|
| 86 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using hAb i z))
|
| 87 |
-
have hMm : MemLp M 2 μ := finiteRaw_memLp hAm hAp hAM
|
| 88 |
-
have hMv : (∫ z, M z ∂μ)=0 := by
|
| 89 |
-
have hMi (i : Fin N) : Integrable (fun z ↦ Real.sqrt (stepSize T N)*A i z*coordinate N i z) μ :=
|
| 90 |
-
((rawIncrement_memLp (by omega : (i : ℕ)<N+1) (hAm i) (hAp i) (hAM i)).const_mul
|
| 91 |
-
(Real.sqrt (stepSize T N))).integrable (by norm_num) |>.congr (by
|
| 92 |
-
filter_upwards [] with z; simp only [rawIncrement]; ring)
|
| 93 |
-
rw [show (∫ z, M z ∂μ)=∑ i : Fin N, ∫ z, Real.sqrt (stepSize T N)*A i z*coordinate N i z ∂μ from
|
| 94 |
-
integral_finsetSum _ (fun i _ ↦ hMi i)]
|
| 95 |
-
have he (i : Fin N) : (∫ z, Real.sqrt (stepSize T N)*A i z*coordinate N i z ∂μ)=0 := by
|
| 96 |
-
simp only [mul_assoc]
|
| 97 |
-
rw [integral_const_mul]
|
| 98 |
-
change Real.sqrt (stepSize T N)*(∫ z, rawIncrement (A i) i z ∂μ)=0
|
| 99 |
-
rw [rawIncrement_mean (by omega) (hAm i) (hAp i),mul_zero]
|
| 100 |
-
simp only [he, Finset.sum_const_zero]
|
| 101 |
-
have hEm : MemLp (valueMeshEnergy T N γ V N) 2 μ := by
|
| 102 |
-
apply memLp_finsetSum
|
| 103 |
-
intro j hj
|
| 104 |
-
have hjN : j<N := Finset.mem_range.mp hj
|
| 105 |
-
apply MemLp.const_mul
|
| 106 |
-
apply MemLp.of_bound (((huc j hjN.le).measurable.comp (hY j hjN.le)).pow_const 2).aestronglyMeasurable 1
|
| 107 |
-
filter_upwards [] with z
|
| 108 |
-
rw [Real.norm_eq_abs, abs_pow, sq_le_one_iff_abs_le_one]
|
| 109 |
-
simpa only [abs_abs, u, Function.comp_apply] using h.bounded _ (htime j hjN.le) (Y z j)
|
| 110 |
-
have hYM : MemLp (fun z ↦ Y z N) 2 μ :=
|
| 111 |
-
euler_memLp T N γ u (fun i hi ↦ (huc i hi.le).measurable)
|
| 112 |
-
(fun i hi x ↦ h.bounded _ (htime i hi.le) x) N le_rfl
|
| 113 |
-
have hVM := h.value_memLp (t := T) ⟨hT.le,le_rfl⟩ hYM
|
| 114 |
-
have hlast : meshTime T N N=T := by
|
| 115 |
-
dsimp only [meshTime, stepSize]
|
| 116 |
-
have hn : (N : ℝ)≠0 := by exact_mod_cast Nat.ne_of_gt hN
|
| 117 |
-
field_simp
|
| 118 |
-
have hRM : MemLp R 2 μ := by
|
| 119 |
-
dsimp only [R,valueMeshCompensated]
|
| 120 |
-
rw [hlast]
|
| 121 |
-
exact ((hVM.sub hEm).sub (memLp_const (V 0 0))).sub hMm
|
| 122 |
-
have hRint : (∫ z, R z ∂μ)=
|
| 123 |
-
(∫ z, V T (Y z N) ∂μ)-V 0 0-(∫ z, valueMeshEnergy T N γ V N z ∂μ) := by
|
| 124 |
-
dsimp only [R,valueMeshCompensated]
|
| 125 |
-
rw [hlast]
|
| 126 |
-
have hi₁ := integral_sub (((hVM.sub hEm).sub (memLp_const (V 0 0))).integrable (by norm_num)) (hMm.integrable (by norm_num))
|
| 127 |
-
have hi₂ := integral_sub ((hVM.sub hEm).integrable (by norm_num)) (integrable_const (V 0 0))
|
| 128 |
-
simp only [Pi.sub_apply] at hi₁ hi₂
|
| 129 |
-
change (∫ z, V T (Y z N)-valueMeshEnergy T N γ V N z-V 0 0-M z ∂μ)=_
|
| 130 |
-
rw [hi₁, hi₂]
|
| 131 |
-
rw [integral_sub (hVM.integrable (by norm_num)) (hEm.integrable (by norm_num)),hMv,integral_const]
|
| 132 |
-
simp only [probReal_univ, smul_eq_mul, sub_zero]
|
| 133 |
-
ring
|
| 134 |
-
rw [←hRint]
|
| 135 |
-
exact abs_integral_le_integral_abs.trans (integral_abs_le_sqrt_integral_sq hRM)
|
| 136 |
-
|
| 137 |
-
lemma value_mesh_expectation_error_tendsto {T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 138 |
-
(hT : 0<T) (hT1 : T≤1) (h : ValueStrip T γ V K L) :
|
| 139 |
-
Tendsto (fun N ↦ (∫ z, V T (euler T N γ (fun t ↦ deriv (V t)) z N)
|
| 140 |
-
∂gaussianProduct (Fin (N+1)))-V 0 0-
|
| 141 |
-
(∫ z, valueMeshEnergy T N γ V N z ∂gaussianProduct (Fin (N+1)))) atTop (𝓝 0) := by
|
| 142 |
-
apply squeeze_zero_norm' (a := fun N ↦ Real.sqrt (valueMeshError T N γ V))
|
| 143 |
-
· filter_upwards [eventually_gt_atTop 0] with N hN
|
| 144 |
-
simpa only [Real.norm_eq_abs] using value_mesh_expectation_error hT h hN
|
| 145 |
-
· simpa only [Real.sqrt_zero, Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp (valueMeshError_tendsto_zero hT hT1 h)
|
| 146 |
-
|
| 147 |
-
end SKValue
|
| 148 |
-
|
| 149 |
-
end
|
| 150 |
-
|
| 151 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.RawIncrement
|
| 3 |
+
import OAI.Probability.SKValue.Equations.ValueStrip
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
open MeasureTheory ProbabilityTheory Set
|
| 9 |
+
open scoped ENNReal NNReal BigOperators
|
| 10 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
+
open scoped BigOperators Topology
|
| 12 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
+
open scoped Topology BigOperators
|
| 14 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 15 |
+
open scoped Topology ENNReal NNReal
|
| 16 |
+
open Filter Set
|
| 17 |
+
open scoped Topology BigOperators
|
| 18 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 19 |
+
open scoped Topology
|
| 20 |
+
open MeasureTheory Set Filter
|
| 21 |
+
open scoped Topology BigOperators
|
| 22 |
+
open MeasureTheory Set Filter Finset
|
| 23 |
+
open scoped Topology BigOperators
|
| 24 |
+
namespace SKValue
|
| 25 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 26 |
+
open scoped Topology BigOperators
|
| 27 |
+
|
| 28 |
+
lemma euler_memLp (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 29 |
+
(huM : ∀ j<N, Measurable (u (meshTime T N j)))
|
| 30 |
+
(huB : ∀ j<N, ∀ x, |u (meshTime T N j) x|≤1) :
|
| 31 |
+
∀ j≤N, MemLp (fun z ↦ euler T N γ u z j) 2 (gaussianProduct (Fin (N+1))) := by
|
| 32 |
+
intro j
|
| 33 |
+
induction j with
|
| 34 |
+
| zero => intro _; exact memLp_const (0 : ℝ)
|
| 35 |
+
| succ j ih =>
|
| 36 |
+
intro hj
|
| 37 |
+
have hlt : j<N := by omega
|
| 38 |
+
have hU : MemLp (fun z ↦ u (meshTime T N j) (euler T N γ u z j)) 2
|
| 39 |
+
(gaussianProduct (Fin (N+1))) :=
|
| 40 |
+
MemLp.of_bound ((huM j hlt).comp (measurable_euler T N γ u huM j hlt.le)).aestronglyMeasurable 1
|
| 41 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using huB j hlt _))
|
| 42 |
+
exact ((ih hlt.le).add ((gaussian_memLp (coordinate_hasLaw N j) 2 (by norm_num)).const_mul _)).add
|
| 43 |
+
(hU.const_mul (stepSize T N*γ (meshTime T N j)))
|
| 44 |
+
|
| 45 |
+
lemma ValueStrip.value_lipschitz {T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 46 |
+
(h : ValueStrip T γ V K L) {t : ℝ} (ht : t∈Icc (0 : ℝ) T) :
|
| 47 |
+
LipschitzWith 1 (V t) := by
|
| 48 |
+
apply lipschitzWith_of_nnnorm_deriv_le ((h.smooth t ht).differentiable (by norm_num))
|
| 49 |
+
intro x
|
| 50 |
+
exact_mod_cast (show ‖deriv (V t) x‖≤(1 : ℝ) by simpa only [Real.norm_eq_abs] using h.bounded t ht x)
|
| 51 |
+
|
| 52 |
+
lemma ValueStrip.value_memLp {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsFiniteMeasure μ]
|
| 53 |
+
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ} (h : ValueStrip T γ V K L)
|
| 54 |
+
{t : ℝ} (ht : t∈Icc (0 : ℝ) T) {Y : Ω → ℝ} (hY : MemLp Y 2 μ) :
|
| 55 |
+
MemLp (fun ω ↦ V t (Y ω)) 2 μ := by
|
| 56 |
+
have hl : LipschitzWith 1 (fun x ↦ V t x - V t 0) := by
|
| 57 |
+
rw [lipschitzWith_iff_dist_le_mul]
|
| 58 |
+
intro x y
|
| 59 |
+
simpa only [dist_sub_right] using (h.value_lipschitz ht).dist_le_mul x y
|
| 60 |
+
have hh := hl.comp_memLp (by simp) hY
|
| 61 |
+
convert hh.add (memLp_const (V t 0)) using 1
|
| 62 |
+
funext ω
|
| 63 |
+
simp
|
| 64 |
+
|
| 65 |
+
lemma value_mesh_expectation_error {T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 66 |
+
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N) :
|
| 67 |
+
|(∫ z, V T (euler T N γ (fun t ↦ deriv (V t)) z N) ∂gaussianProduct (Fin (N+1)))-V 0 0-
|
| 68 |
+
(∫ z, valueMeshEnergy T N γ V N z ∂gaussianProduct (Fin (N+1)))| ≤
|
| 69 |
+
Real.sqrt (valueMeshError T N γ V) := by
|
| 70 |
+
let u := fun t ↦ deriv (V t)
|
| 71 |
+
let Y := euler T N γ u
|
| 72 |
+
let μ := gaussianProduct (Fin (N+1))
|
| 73 |
+
let A (i : Fin N) (z : Fin (N+1) → ℝ) := u (meshTime T N i) (Y z i)
|
| 74 |
+
let M (z : Fin (N+1) → ℝ) := ∑ i : Fin N, Real.sqrt (stepSize T N)*A i z*coordinate N i z
|
| 75 |
+
let R (z : Fin (N+1) → ℝ) := valueMeshCompensated T N γ V N z-V 0 0-M z
|
| 76 |
+
have htime (j : ℕ) (hj : j≤N) := mesh_time_mem hT.le hN hj
|
| 77 |
+
have huc (j : ℕ) (hj : j≤N) : Continuous (u (meshTime T N j)) :=
|
| 78 |
+
(h.smooth _ (htime j hj)).continuous_deriv (by norm_num)
|
| 79 |
+
have hY (j : ℕ) (hj : j≤N) : Measurable (fun z ↦ Y z j) :=
|
| 80 |
+
measurable_euler T N γ u (fun i hi ↦ (huc i hi.le).measurable) j hj
|
| 81 |
+
have hAm (i : Fin N) : Measurable (A i) := (huc i i.isLt.le).measurable.comp (hY i i.isLt.le)
|
| 82 |
+
have hAb (i : Fin N) z : |A i z|≤1 := h.bounded _ (htime i i.isLt.le) _
|
| 83 |
+
have hAp (i : Fin N) : DependsBefore i (A i) := eulerCoefficient_dependsBefore T i.isLt.le γ u u
|
| 84 |
+
have hAM (i : Fin N) : MemLp (A i) 2 μ :=
|
| 85 |
+
MemLp.of_bound (hAm i).aestronglyMeasurable 1
|
| 86 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using hAb i z))
|
| 87 |
+
have hMm : MemLp M 2 μ := finiteRaw_memLp hAm hAp hAM
|
| 88 |
+
have hMv : (∫ z, M z ∂μ)=0 := by
|
| 89 |
+
have hMi (i : Fin N) : Integrable (fun z ↦ Real.sqrt (stepSize T N)*A i z*coordinate N i z) μ :=
|
| 90 |
+
((rawIncrement_memLp (by omega : (i : ℕ)<N+1) (hAm i) (hAp i) (hAM i)).const_mul
|
| 91 |
+
(Real.sqrt (stepSize T N))).integrable (by norm_num) |>.congr (by
|
| 92 |
+
filter_upwards [] with z; simp only [rawIncrement]; ring)
|
| 93 |
+
rw [show (∫ z, M z ∂μ)=∑ i : Fin N, ∫ z, Real.sqrt (stepSize T N)*A i z*coordinate N i z ∂μ from
|
| 94 |
+
integral_finsetSum _ (fun i _ ↦ hMi i)]
|
| 95 |
+
have he (i : Fin N) : (∫ z, Real.sqrt (stepSize T N)*A i z*coordinate N i z ∂μ)=0 := by
|
| 96 |
+
simp only [mul_assoc]
|
| 97 |
+
rw [integral_const_mul]
|
| 98 |
+
change Real.sqrt (stepSize T N)*(∫ z, rawIncrement (A i) i z ∂μ)=0
|
| 99 |
+
rw [rawIncrement_mean (by omega) (hAm i) (hAp i),mul_zero]
|
| 100 |
+
simp only [he, Finset.sum_const_zero]
|
| 101 |
+
have hEm : MemLp (valueMeshEnergy T N γ V N) 2 μ := by
|
| 102 |
+
apply memLp_finsetSum
|
| 103 |
+
intro j hj
|
| 104 |
+
have hjN : j<N := Finset.mem_range.mp hj
|
| 105 |
+
apply MemLp.const_mul
|
| 106 |
+
apply MemLp.of_bound (((huc j hjN.le).measurable.comp (hY j hjN.le)).pow_const 2).aestronglyMeasurable 1
|
| 107 |
+
filter_upwards [] with z
|
| 108 |
+
rw [Real.norm_eq_abs, abs_pow, sq_le_one_iff_abs_le_one]
|
| 109 |
+
simpa only [abs_abs, u, Function.comp_apply] using h.bounded _ (htime j hjN.le) (Y z j)
|
| 110 |
+
have hYM : MemLp (fun z ↦ Y z N) 2 μ :=
|
| 111 |
+
euler_memLp T N γ u (fun i hi ↦ (huc i hi.le).measurable)
|
| 112 |
+
(fun i hi x ↦ h.bounded _ (htime i hi.le) x) N le_rfl
|
| 113 |
+
have hVM := h.value_memLp (t := T) ⟨hT.le,le_rfl⟩ hYM
|
| 114 |
+
have hlast : meshTime T N N=T := by
|
| 115 |
+
dsimp only [meshTime, stepSize]
|
| 116 |
+
have hn : (N : ℝ)≠0 := by exact_mod_cast Nat.ne_of_gt hN
|
| 117 |
+
field_simp
|
| 118 |
+
have hRM : MemLp R 2 μ := by
|
| 119 |
+
dsimp only [R,valueMeshCompensated]
|
| 120 |
+
rw [hlast]
|
| 121 |
+
exact ((hVM.sub hEm).sub (memLp_const (V 0 0))).sub hMm
|
| 122 |
+
have hRint : (∫ z, R z ∂μ)=
|
| 123 |
+
(∫ z, V T (Y z N) ∂μ)-V 0 0-(∫ z, valueMeshEnergy T N γ V N z ∂μ) := by
|
| 124 |
+
dsimp only [R,valueMeshCompensated]
|
| 125 |
+
rw [hlast]
|
| 126 |
+
have hi₁ := integral_sub (((hVM.sub hEm).sub (memLp_const (V 0 0))).integrable (by norm_num)) (hMm.integrable (by norm_num))
|
| 127 |
+
have hi₂ := integral_sub ((hVM.sub hEm).integrable (by norm_num)) (integrable_const (V 0 0))
|
| 128 |
+
simp only [Pi.sub_apply] at hi₁ hi₂
|
| 129 |
+
change (∫ z, V T (Y z N)-valueMeshEnergy T N γ V N z-V 0 0-M z ∂μ)=_
|
| 130 |
+
rw [hi₁, hi₂]
|
| 131 |
+
rw [integral_sub (hVM.integrable (by norm_num)) (hEm.integrable (by norm_num)),hMv,integral_const]
|
| 132 |
+
simp only [probReal_univ, smul_eq_mul, sub_zero]
|
| 133 |
+
ring
|
| 134 |
+
rw [←hRint]
|
| 135 |
+
exact abs_integral_le_integral_abs.trans (integral_abs_le_sqrt_integral_sq hRM)
|
| 136 |
+
|
| 137 |
+
lemma value_mesh_expectation_error_tendsto {T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 138 |
+
(hT : 0<T) (hT1 : T≤1) (h : ValueStrip T γ V K L) :
|
| 139 |
+
Tendsto (fun N ↦ (∫ z, V T (euler T N γ (fun t ↦ deriv (V t)) z N)
|
| 140 |
+
∂gaussianProduct (Fin (N+1)))-V 0 0-
|
| 141 |
+
(∫ z, valueMeshEnergy T N γ V N z ∂gaussianProduct (Fin (N+1)))) atTop (𝓝 0) := by
|
| 142 |
+
apply squeeze_zero_norm' (a := fun N ↦ Real.sqrt (valueMeshError T N γ V))
|
| 143 |
+
· filter_upwards [eventually_gt_atTop 0] with N hN
|
| 144 |
+
simpa only [Real.norm_eq_abs] using value_mesh_expectation_error hT h hN
|
| 145 |
+
· simpa only [Real.sqrt_zero, Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp (valueMeshError_tendsto_zero hT hT1 h)
|
| 146 |
+
|
| 147 |
+
end SKValue
|
| 148 |
+
|
| 149 |
+
end
|
| 150 |
+
|
| 151 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/Feedback.lean
CHANGED
|
@@ -1,299 +1,299 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Gaussian.CoupledCoordinates
|
| 3 |
-
import OAI.Probability.SKValue.Equations.ValueStrip
|
| 4 |
-
import OAI.Probability.SKValue.Equations.CubicEnvelopeMean
|
| 5 |
-
import OAI.Probability.SKValue.Control.Controls
|
| 6 |
-
|
| 7 |
-
namespace OAI
|
| 8 |
-
|
| 9 |
-
section
|
| 10 |
-
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 13 |
-
namespace SKValue
|
| 14 |
-
|
| 15 |
-
noncomputable def meshControl {Ω : Type*} (T : ℝ) (N : ℕ) (H : Fin N → Ω → ℝ)
|
| 16 |
-
(t : ℝ≥0) (ω : Ω) : ℝ :=
|
| 17 |
-
∑ j : Fin N, if meshTime T N j < t ∧ (t : ℝ) ≤ meshTime T N (j+1) then H j ω else 0
|
| 18 |
-
|
| 19 |
-
lemma progressive_interval {Ω : Type*} [m : MeasurableSpace Ω]
|
| 20 |
-
{f : Filtration ℝ≥0 m} {a b : ℝ} {H : Ω → ℝ} (_ : 0 ≤ a)
|
| 21 |
-
(hH : Measurable[f (Real.toNNReal a)] H) :
|
| 22 |
-
IsProgressive f (fun t ω ↦ if a < (t : ℝ) ∧ (t : ℝ) ≤ b then H ω else 0) := by
|
| 23 |
-
intro t
|
| 24 |
-
by_cases hat : Real.toNNReal a ≤ t
|
| 25 |
-
· let : MeasurableSpace Ω := f t
|
| 26 |
-
have hHm : Measurable H := hH.mono (f.mono hat) le_rfl
|
| 27 |
-
exact (hHm.comp measurable_snd).ite
|
| 28 |
-
((measurableSet_lt measurable_const (measurable_coe_nnreal_real.comp
|
| 29 |
-
(measurable_subtype_coe.comp measurable_fst))).inter
|
| 30 |
-
(measurableSet_le (measurable_coe_nnreal_real.comp
|
| 31 |
-
(measurable_subtype_coe.comp measurable_fst)) measurable_const)) measurable_const
|
| 32 |
-
· have he : (fun p : Iic t × Ω ↦ if a < (p.1 : ℝ≥0) ∧ ((p.1 : ℝ≥0) : ℝ) ≤ b then H p.2 else 0) =
|
| 33 |
-
fun _ ↦ (0 : ℝ) := by
|
| 34 |
-
funext p
|
| 35 |
-
apply ite_eq_right
|
| 36 |
-
intro hp
|
| 37 |
-
exact hat ((Real.toNNReal_le_iff_le_coe).2 (hp.1.le.trans (by exact_mod_cast p.1.2)))
|
| 38 |
-
rw [he]
|
| 39 |
-
exact measurable_const
|
| 40 |
-
|
| 41 |
-
lemma meshControl_progressive {Ω : Type*} [m : MeasurableSpace Ω]
|
| 42 |
-
{f : Filtration ℝ≥0 m} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} {H : Fin N → Ω → ℝ}
|
| 43 |
-
(hH : ∀ j : Fin N, Measurable[f (Real.toNNReal (meshTime T N j))] (H j)) :
|
| 44 |
-
IsProgressive f (meshControl T N H) := by
|
| 45 |
-
apply IsProgressive.finsetSum
|
| 46 |
-
intro j _
|
| 47 |
-
exact progressive_interval (mesh_time_mem_total hT j.isLt.le).1 (hH j)
|
| 48 |
-
|
| 49 |
-
lemma mesh_intervals_disjoint {T : ℝ} (hT : 0 ≤ T) {N : ℕ} {i j : Fin N} {t : ℝ}
|
| 50 |
-
(hi : meshTime T N i < t ∧ t ≤ meshTime T N (i+1))
|
| 51 |
-
(hj : meshTime T N j < t ∧ t ≤ meshTime T N (j+1)) : i=j := by
|
| 52 |
-
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 53 |
-
have hlt : ∀ a b : ℕ, a+1 ≤ b → meshTime T N (a+1) ≤ meshTime T N b := by
|
| 54 |
-
intro a b hab
|
| 55 |
-
exact mul_le_mul_of_nonneg_right (by exact_mod_cast hab) hδ
|
| 56 |
-
apply Fin.ext
|
| 57 |
-
by_contra he
|
| 58 |
-
rcases lt_or_gt_of_ne he with hij | hji
|
| 59 |
-
· have hh := hlt i j hij
|
| 60 |
-
linarith [hi.2,hj.1]
|
| 61 |
-
· have hh := hlt j i hji
|
| 62 |
-
linarith [hi.1,hj.2]
|
| 63 |
-
|
| 64 |
-
lemma meshControl_eq {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (H : Fin N → Ω → ℝ)
|
| 65 |
-
{j : Fin N} {t : ℝ≥0} (ht : meshTime T N j < t ∧ (t : ℝ) ≤ meshTime T N (j+1)) (ω : Ω) :
|
| 66 |
-
meshControl T N H t ω=H j ω := by
|
| 67 |
-
unfold meshControl
|
| 68 |
-
rw [Finset.sum_eq_single j]
|
| 69 |
-
· simp only [ite_eq_left ht]
|
| 70 |
-
· intro i _ hij
|
| 71 |
-
exact ite_eq_right (fun hi ↦ hij (mesh_intervals_disjoint hT hi ht))
|
| 72 |
-
· simp
|
| 73 |
-
|
| 74 |
-
lemma meshControl_bound {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (H : Fin N → Ω → ℝ)
|
| 75 |
-
(hH : ∀ j ω, |H j ω| ≤ 1) (t : ℝ≥0) (ω : Ω) : |meshControl T N H t ω| ≤ 1 := by
|
| 76 |
-
by_cases he : ∃ j : Fin N, meshTime T N j < t ∧ (t : ℝ) ≤ meshTime T N (j+1)
|
| 77 |
-
· obtain ⟨j,hj⟩ := he
|
| 78 |
-
rw [meshControl_eq hT H hj]
|
| 79 |
-
exact hH j ω
|
| 80 |
-
· have hh : meshControl T N H t ω=0 := by
|
| 81 |
-
unfold meshControl
|
| 82 |
-
apply Finset.sum_eq_zero
|
| 83 |
-
intro j _
|
| 84 |
-
exact ite_eq_right (fun hj ↦ he ⟨j,hj⟩)
|
| 85 |
-
rw [hh]
|
| 86 |
-
norm_num
|
| 87 |
-
|
| 88 |
-
lemma meshControl_momentIntegral {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (hN : 0<N)
|
| 89 |
-
(H : Fin N → Ω → ℝ) {γ : ℝ → ℝ} (hγ : IntervalIntegrable γ volume 0 T)
|
| 90 |
-
(k : ℕ) (ω : Ω) :
|
| 91 |
-
controlAccum γ (meshControl T N H) k T ω =
|
| 92 |
-
∑ j : Fin N, (∫ s in meshTime T N j..meshTime T N (j+1), γ s)*(H j ω)^k := by
|
| 93 |
-
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 94 |
-
have htime (j : ℕ) (hj : j ≤ N) := mesh_time_mem_total hT hj
|
| 95 |
-
have horder (j : ℕ) : meshTime T N j ≤ meshTime T N (j+1) := by
|
| 96 |
-
dsimp [meshTime]
|
| 97 |
-
exact mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.le_succ j) hδ
|
| 98 |
-
have hlast : meshTime T N N=T := by
|
| 99 |
-
dsimp [meshTime,stepSize]
|
| 100 |
-
field_simp
|
| 101 |
-
have he (j : Fin N) :
|
| 102 |
-
(fun s ↦ γ s*(meshControl T N H (Real.toNNReal s) ω)^k) =ᵐ[
|
| 103 |
-
volume.restrict (uIoc (meshTime T N j) (meshTime T N (j+1)))]
|
| 104 |
-
(fun s ↦ γ s*(H j ω)^k) := by
|
| 105 |
-
filter_upwards [ae_restrict_mem measurableSet_uIoc] with s hs
|
| 106 |
-
rw [uIoc_of_le (horder j)] at hs
|
| 107 |
-
have hs0 : 0 ≤ s := (htime j j.isLt.le).1.trans hs.1.le
|
| 108 |
-
rw [meshControl_eq hT H (by simpa only [Real.coe_toNNReal _ hs0,Set.mem_Ioc] using hs)]
|
| 109 |
-
have hi (j : ℕ) (hj : j<N) : IntervalIntegrable
|
| 110 |
-
(fun s ↦ γ s*(meshControl T N H (Real.toNNReal s) ω)^k) volume
|
| 111 |
-
(meshTime T N j) (meshTime T N (j+1)) := by
|
| 112 |
-
apply ((intervalIntegrable_substrip hT hγ (htime j hj.le)
|
| 113 |
-
(htime (j+1) hj)).mul_const ((H ⟨j,hj⟩ ω)^k)).congr_ae
|
| 114 |
-
exact (he ⟨j,hj⟩).symm
|
| 115 |
-
have hs := intervalIntegral.sum_integral_adjacent_intervals hi
|
| 116 |
-
rw [hlast,show meshTime T N 0=0 by simp [meshTime]] at hs
|
| 117 |
-
rw [controlAccum,←hs,←Fin.sum_univ_eq_sum_range]
|
| 118 |
-
apply Finset.sum_congr rfl
|
| 119 |
-
intro j _
|
| 120 |
-
rw [intervalIntegral.integral_congr_ae_restrict (he j),intervalIntegral.integral_mul_const]
|
| 121 |
-
|
| 122 |
-
lemma monotone_interval_quadrature {γ : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b)
|
| 123 |
-
(hγ : MonotoneOn γ (Icc a b)) :
|
| 124 |
-
|(∫ s in a..b, γ s)-(b-a)*γ a| ≤ (b-a)*(γ b-γ a) := by
|
| 125 |
-
have hi : IntervalIntegrable γ volume a b := by
|
| 126 |
-
apply MonotoneOn.intervalIntegrable
|
| 127 |
-
simpa only [uIcc_of_le hab] using hγ
|
| 128 |
-
have hdiff : (∫ s in a..b, γ s)-(b-a)*γ a =∫ s in a..b, γ s-γ a := by
|
| 129 |
-
rw [intervalIntegral.integral_sub hi intervalIntegrable_const]
|
| 130 |
-
simp only [intervalIntegral.integral_const,smul_eq_mul]
|
| 131 |
-
rw [hdiff]
|
| 132 |
-
have hh := intervalIntegral.norm_integral_le_of_norm_le_const
|
| 133 |
-
(a := a) (b := b) (f := fun s ↦ γ s-γ a) (C := γ b-γ a) (fun s hs ↦ by
|
| 134 |
-
rw [uIoc_of_le hab] at hs
|
| 135 |
-
have hs' : s∈Icc a b := ⟨hs.1.le,hs.2⟩
|
| 136 |
-
rw [Real.norm_eq_abs,abs_of_nonneg (sub_nonneg.mpr (hγ ⟨le_rfl,hab⟩ hs' hs.1.le))]
|
| 137 |
-
exact sub_le_sub_right (hγ hs' ⟨hab,le_rfl⟩ hs.2) _)
|
| 138 |
-
simpa only [Real.norm_eq_abs,abs_of_nonneg (sub_nonneg.mpr hab),mul_comm] using hh
|
| 139 |
-
|
| 140 |
-
lemma meshControl_quadrature {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (hN : 0<N)
|
| 141 |
-
(H : Fin N → Ω → ℝ) (hH : ∀ j ω, |H j ω| ≤ 1)
|
| 142 |
-
{γ : ℝ → ℝ} (hγ : MonotoneOn γ (Icc (0 : ℝ) T)) (k : ℕ) (ω : Ω) :
|
| 143 |
-
|controlAccum γ (meshControl T N H) k T ω-
|
| 144 |
-
∑ j : Fin N, stepSize T N*γ (meshTime T N j)*(H j ω)^k| ≤
|
| 145 |
-
stepSize T N*(γ T-γ 0) := by
|
| 146 |
-
have hi : IntervalIntegrable γ volume 0 T := by
|
| 147 |
-
apply MonotoneOn.intervalIntegrable
|
| 148 |
-
simpa only [uIcc_of_le hT] using hγ
|
| 149 |
-
rw [meshControl_momentIntegral hT hN H hi, ←Finset.sum_sub_distrib]
|
| 150 |
-
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 151 |
-
have htime (j : ℕ) (hj : j ≤ N) := mesh_time_mem_total hT hj
|
| 152 |
-
have hgap (j : ℕ) : meshTime T N (j+1)-meshTime T N j=stepSize T N := by
|
| 153 |
-
dsimp [meshTime]
|
| 154 |
-
push_cast
|
| 155 |
-
ring
|
| 156 |
-
have horder (j : ℕ) : meshTime T N j ≤ meshTime T N (j+1) := by
|
| 157 |
-
linarith [hgap j]
|
| 158 |
-
have hloc (j : Fin N) :
|
| 159 |
-
|(∫ s in meshTime T N j..meshTime T N (j+1), γ s)*(H j ω)^k-
|
| 160 |
-
stepSize T N*γ (meshTime T N j)*(H j ω)^k| ≤
|
| 161 |
-
stepSize T N*(γ (meshTime T N (j+1))-γ (meshTime T N j)) := by
|
| 162 |
-
rw [←sub_mul,abs_mul]
|
| 163 |
-
have hh := monotone_interval_quadrature (horder j)
|
| 164 |
-
(hγ.mono (Icc_subset_Icc (htime j j.isLt.le).1 (htime (j+1) j.isLt).2))
|
| 165 |
-
rw [hgap] at hh
|
| 166 |
-
have hp : |(H j ω)^k| ≤ 1 := by
|
| 167 |
-
rw [abs_pow]
|
| 168 |
-
exact pow_le_one₀ (abs_nonneg _) (hH j ω)
|
| 169 |
-
exact (mul_le_mul_of_nonneg_left hp (abs_nonneg _)).trans (by simpa only [mul_one] using hh)
|
| 170 |
-
calc
|
| 171 |
-
_ ≤ ∑ j : Fin N, |(∫ s in meshTime T N j..meshTime T N (j+1), γ s)*(H j ω)^k-
|
| 172 |
-
stepSize T N*γ (meshTime T N j)*(H j ω)^k| := Finset.abs_sum_le_sum_abs _ _
|
| 173 |
-
_ ≤ ∑ j : Fin N, stepSize T N*(γ (meshTime T N (j+1))-γ (meshTime T N j)) :=
|
| 174 |
-
Finset.sum_le_sum (fun j _ ↦ hloc j)
|
| 175 |
-
_ = _ := by
|
| 176 |
-
rw [←Finset.mul_sum, sum_steps_sub (fun j ↦ γ (meshTime T N j))]
|
| 177 |
-
have hlast : meshTime T N N=T := by
|
| 178 |
-
dsimp [meshTime,stepSize]
|
| 179 |
-
field_simp
|
| 180 |
-
change stepSize T N*(γ (meshTime T N N)-γ (meshTime T N 0)) = _
|
| 181 |
-
rw [hlast]
|
| 182 |
-
simp only [meshTime,Nat.cast_zero,zero_mul]
|
| 183 |
-
|
| 184 |
-
lemma coupled_euler_past_measurable {Ω : Type*} [m : MeasurableSpace Ω]
|
| 185 |
-
{B : ℝ≥0 → Ω → ℝ} (hBm : ∀ t, StronglyMeasurable (B t))
|
| 186 |
-
{T : ℝ} (hT : 0<T) {N : ℕ} (hN : 0<N) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 187 |
-
(hu : ∀ j<N, Measurable (u (meshTime T N j))) :
|
| 188 |
-
∀ j ≤ N, StronglyMeasurable[Filtration.natural B hBm (Real.toNNReal (meshTime T N j))]
|
| 189 |
-
(coupledEuler T γ u B N j) := by
|
| 190 |
-
let f := Filtration.natural B hBm
|
| 191 |
-
intro j
|
| 192 |
-
induction j with
|
| 193 |
-
| zero =>
|
| 194 |
-
intro _
|
| 195 |
-
convert (stronglyMeasurable_const : StronglyMeasurable[f (Real.toNNReal (meshTime T N 0))] (fun _ : Ω ↦ (0 : ℝ))) using 1
|
| 196 |
-
funext ω
|
| 197 |
-
exact coupled_euler_zero T γ u B N ω
|
| 198 |
-
| succ j ih =>
|
| 199 |
-
intro hjN
|
| 200 |
-
have hj : j<N := hjN
|
| 201 |
-
have hδ : 0 ≤ stepSize T N := div_nonneg hT.le (Nat.cast_nonneg N)
|
| 202 |
-
have ht : Real.toNNReal (meshTime T N j) ≤ Real.toNNReal (meshTime T N (j+1)) := by
|
| 203 |
-
apply Real.toNNReal_mono
|
| 204 |
-
apply mul_le_mul_of_nonneg_right _ hδ
|
| 205 |
-
exact_mod_cast Nat.le_succ j
|
| 206 |
-
have hY := (ih hj.le).mono (f.mono ht)
|
| 207 |
-
have hB0 := (Filtration.stronglyAdapted_natural hBm (Real.toNNReal (meshTime T N j))).mono (f.mono ht)
|
| 208 |
-
have hB1 := Filtration.stronglyAdapted_natural hBm (Real.toNNReal (meshTime T N (j+1)))
|
| 209 |
-
have hU := ((hu j hj).comp hY.measurable).stronglyMeasurable.const_mul
|
| 210 |
-
(stepSize T N*γ (meshTime T N j))
|
| 211 |
-
convert ((hY.add hB1).sub hB0).add hU using 1
|
| 212 |
-
funext ω
|
| 213 |
-
rw [coupled_euler_step B hT γ u hN hj ω]
|
| 214 |
-
rfl
|
| 215 |
-
|
| 216 |
-
lemma coupled_euler_drift_sum {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 217 |
-
{T : ℝ} (hT : 0<T) {N : ℕ} (hN : 0<N) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) (ω : Ω) :
|
| 218 |
-
coupledEuler T γ u B N N ω = B (Real.toNNReal T) ω-B 0 ω+
|
| 219 |
-
∑ j : Fin N, stepSize T N*γ (meshTime T N j)*u (meshTime T N j) (coupledEuler T γ u B N j ω) := by
|
| 220 |
-
have he (j : Fin N) :
|
| 221 |
-
coupledEuler T γ u B N (j+1) ω-coupledEuler T γ u B N j ω =
|
| 222 |
-
(B (Real.toNNReal (meshTime T N (j+1))) ω-B (Real.toNNReal (meshTime T N j)) ω)+
|
| 223 |
-
stepSize T N*γ (meshTime T N j)*u (meshTime T N j) (coupledEuler T γ u B N j ω) := by
|
| 224 |
-
rw [coupled_euler_step B hT γ u hN j.isLt ω]
|
| 225 |
-
dsimp [meshTime,stepSize]
|
| 226 |
-
ring
|
| 227 |
-
have hh := Finset.sum_congr (rfl : (Finset.univ : Finset (Fin N))=Finset.univ) (fun j _ ↦ he j)
|
| 228 |
-
rw [sum_steps_sub (fun j ↦ coupledEuler T γ u B N j ω),Finset.sum_add_distrib,
|
| 229 |
-
sum_steps_sub (fun j ↦ B (Real.toNNReal (meshTime T N j)) ω),coupled_euler_zero] at hh
|
| 230 |
-
have hlast : meshTime T N N=T := by dsimp [meshTime,stepSize]; field_simp
|
| 231 |
-
simpa only [sub_zero,hlast,show meshTime T N 0=0 by simp [meshTime],Real.toNNReal_zero] using hh
|
| 232 |
-
|
| 233 |
-
noncomputable def feedbackControl {Ω : Type*} (B : ℝ≥0 → Ω → ℝ) (γ : ℝ → ℝ)
|
| 234 |
-
(V : ℝ → ℝ → ℝ) (T : ℝ) (N : ℕ) : ℝ≥0 → Ω → ℝ :=
|
| 235 |
-
meshControl T N (fun j ω ↦ deriv (V (meshTime T N j))
|
| 236 |
-
(coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))
|
| 237 |
-
|
| 238 |
-
lemma ValueStrip.feedback_progressive {Ω : Type*} [m : MeasurableSpace Ω]
|
| 239 |
-
{B : ℝ≥0 → Ω → ℝ} (hBm : ∀ t, StronglyMeasurable (B t))
|
| 240 |
-
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 241 |
-
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N) :
|
| 242 |
-
IsProgressive (Filtration.natural B hBm) (feedbackControl B γ V T N) := by
|
| 243 |
-
apply meshControl_progressive hT.le
|
| 244 |
-
intro j
|
| 245 |
-
have hu (i : ℕ) (hi : i ≤ N) : Continuous (deriv (V (meshTime T N i))) :=
|
| 246 |
-
(h.smooth _ (mesh_time_mem_total hT.le hi)).continuous_deriv (by norm_num)
|
| 247 |
-
exact (hu j j.isLt.le).measurable.comp
|
| 248 |
-
(coupled_euler_past_measurable hBm hT hN γ (fun t ↦ deriv (V t))
|
| 249 |
-
(fun i hi ↦ (hu i hi.le).measurable) j j.isLt.le).measurable
|
| 250 |
-
|
| 251 |
-
lemma ValueStrip.feedback_bound {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 252 |
-
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 253 |
-
(hT : 0 ≤ T) (h : ValueStrip T γ V K L) (N : ℕ) (s : ℝ≥0) (ω : Ω) :
|
| 254 |
-
|feedbackControl B γ V T N s ω| ≤ 1 :=
|
| 255 |
-
meshControl_bound hT _ (fun j _ ↦ h.bounded _ (mesh_time_mem_total hT j.isLt.le) _) s ω
|
| 256 |
-
|
| 257 |
-
lemma ValueStrip.feedback_state_error {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 258 |
-
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 259 |
-
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N)
|
| 260 |
-
(ω : Ω) (hB0 : B 0 ω=0) :
|
| 261 |
-
|controlState B γ (feedbackControl B γ V T N) 0 T ω-
|
| 262 |
-
coupledEuler T γ (fun t ↦ deriv (V t)) B N N ω| ≤ stepSize T N*(γ T-γ 0) := by
|
| 263 |
-
have hh := meshControl_quadrature hT.le hN
|
| 264 |
-
(fun (j : Fin N) ω ↦ deriv (V (meshTime T N j))
|
| 265 |
-
(coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))
|
| 266 |
-
(fun j ω ↦ h.bounded _ (mesh_time_mem_total hT.le j.isLt.le) _)
|
| 267 |
-
h.gamma_mono 1 ω
|
| 268 |
-
rw [controlState,coupled_euler_drift_sum B hT hN,hB0]
|
| 269 |
-
simpa only [pow_one,zero_add,sub_zero,add_sub_add_left_eq_sub,feedbackControl] using hh
|
| 270 |
-
|
| 271 |
-
lemma ValueStrip.feedback_energy_error {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 272 |
-
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 273 |
-
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N) (ω : Ω) :
|
| 274 |
-
|(1/2 : ℝ)*controlAccum γ (feedbackControl B γ V T N) 2 T ω-
|
| 275 |
-
valueMeshEnergy T N γ V N (coupledCoordinates T N B ω)| ≤
|
| 276 |
-
(1/2 : ℝ)*stepSize T N*(γ T-γ 0) := by
|
| 277 |
-
have hh := meshControl_quadrature hT.le hN
|
| 278 |
-
(fun (j : Fin N) ω ↦ deriv (V (meshTime T N j))
|
| 279 |
-
(coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))
|
| 280 |
-
(fun j ω ↦ h.bounded _ (mesh_time_mem_total hT.le j.isLt.le) _)
|
| 281 |
-
h.gamma_mono 2 ω
|
| 282 |
-
have he : valueMeshEnergy T N γ V N (coupledCoordinates T N B ω) = (1/2 : ℝ)*
|
| 283 |
-
∑ j : Fin N, stepSize T N*γ (meshTime T N j)*
|
| 284 |
-
(deriv (V (meshTime T N j)) (coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))^2 := by
|
| 285 |
-
rw [Fin.sum_univ_eq_sum_range (fun j ↦ stepSize T N*γ (meshTime T N j)*
|
| 286 |
-
(deriv (V (meshTime T N j)) (coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))^2)]
|
| 287 |
-
dsimp only [valueMeshEnergy,coupledEuler]
|
| 288 |
-
simp only [ite_eq_right hN.ne',Finset.mul_sum]
|
| 289 |
-
apply Finset.sum_congr rfl
|
| 290 |
-
intro j _
|
| 291 |
-
ring
|
| 292 |
-
rw [he,←mul_sub,abs_mul,abs_of_nonneg (by norm_num : 0 ≤ (1/2 : ℝ))]
|
| 293 |
-
exact (mul_le_mul_of_nonneg_left hh (by norm_num)).trans_eq (by ring)
|
| 294 |
-
|
| 295 |
-
end SKValue
|
| 296 |
-
|
| 297 |
-
end
|
| 298 |
-
|
| 299 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Gaussian.CoupledCoordinates
|
| 3 |
+
import OAI.Probability.SKValue.Equations.ValueStrip
|
| 4 |
+
import OAI.Probability.SKValue.Equations.CubicEnvelopeMean
|
| 5 |
+
import OAI.Probability.SKValue.Control.Controls
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
section
|
| 10 |
+
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 13 |
+
namespace SKValue
|
| 14 |
+
|
| 15 |
+
noncomputable def meshControl {Ω : Type*} (T : ℝ) (N : ℕ) (H : Fin N → Ω → ℝ)
|
| 16 |
+
(t : ℝ≥0) (ω : Ω) : ℝ :=
|
| 17 |
+
∑ j : Fin N, if meshTime T N j < t ∧ (t : ℝ) ≤ meshTime T N (j+1) then H j ω else 0
|
| 18 |
+
|
| 19 |
+
lemma progressive_interval {Ω : Type*} [m : MeasurableSpace Ω]
|
| 20 |
+
{f : Filtration ℝ≥0 m} {a b : ℝ} {H : Ω → ℝ} (_ : 0 ≤ a)
|
| 21 |
+
(hH : Measurable[f (Real.toNNReal a)] H) :
|
| 22 |
+
IsProgressive f (fun t ω ↦ if a < (t : ℝ) ∧ (t : ℝ) ≤ b then H ω else 0) := by
|
| 23 |
+
intro t
|
| 24 |
+
by_cases hat : Real.toNNReal a ≤ t
|
| 25 |
+
· let : MeasurableSpace Ω := f t
|
| 26 |
+
have hHm : Measurable H := hH.mono (f.mono hat) le_rfl
|
| 27 |
+
exact (hHm.comp measurable_snd).ite
|
| 28 |
+
((measurableSet_lt measurable_const (measurable_coe_nnreal_real.comp
|
| 29 |
+
(measurable_subtype_coe.comp measurable_fst))).inter
|
| 30 |
+
(measurableSet_le (measurable_coe_nnreal_real.comp
|
| 31 |
+
(measurable_subtype_coe.comp measurable_fst)) measurable_const)) measurable_const
|
| 32 |
+
· have he : (fun p : Iic t × Ω ↦ if a < (p.1 : ℝ≥0) ∧ ((p.1 : ℝ≥0) : ℝ) ≤ b then H p.2 else 0) =
|
| 33 |
+
fun _ ↦ (0 : ℝ) := by
|
| 34 |
+
funext p
|
| 35 |
+
apply ite_eq_right
|
| 36 |
+
intro hp
|
| 37 |
+
exact hat ((Real.toNNReal_le_iff_le_coe).2 (hp.1.le.trans (by exact_mod_cast p.1.2)))
|
| 38 |
+
rw [he]
|
| 39 |
+
exact measurable_const
|
| 40 |
+
|
| 41 |
+
lemma meshControl_progressive {Ω : Type*} [m : MeasurableSpace Ω]
|
| 42 |
+
{f : Filtration ℝ≥0 m} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} {H : Fin N → Ω → ℝ}
|
| 43 |
+
(hH : ∀ j : Fin N, Measurable[f (Real.toNNReal (meshTime T N j))] (H j)) :
|
| 44 |
+
IsProgressive f (meshControl T N H) := by
|
| 45 |
+
apply IsProgressive.finsetSum
|
| 46 |
+
intro j _
|
| 47 |
+
exact progressive_interval (mesh_time_mem_total hT j.isLt.le).1 (hH j)
|
| 48 |
+
|
| 49 |
+
lemma mesh_intervals_disjoint {T : ℝ} (hT : 0 ≤ T) {N : ℕ} {i j : Fin N} {t : ℝ}
|
| 50 |
+
(hi : meshTime T N i < t ∧ t ≤ meshTime T N (i+1))
|
| 51 |
+
(hj : meshTime T N j < t ∧ t ≤ meshTime T N (j+1)) : i=j := by
|
| 52 |
+
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 53 |
+
have hlt : ∀ a b : ℕ, a+1 ≤ b → meshTime T N (a+1) ≤ meshTime T N b := by
|
| 54 |
+
intro a b hab
|
| 55 |
+
exact mul_le_mul_of_nonneg_right (by exact_mod_cast hab) hδ
|
| 56 |
+
apply Fin.ext
|
| 57 |
+
by_contra he
|
| 58 |
+
rcases lt_or_gt_of_ne he with hij | hji
|
| 59 |
+
· have hh := hlt i j hij
|
| 60 |
+
linarith [hi.2,hj.1]
|
| 61 |
+
· have hh := hlt j i hji
|
| 62 |
+
linarith [hi.1,hj.2]
|
| 63 |
+
|
| 64 |
+
lemma meshControl_eq {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (H : Fin N → Ω → ℝ)
|
| 65 |
+
{j : Fin N} {t : ℝ≥0} (ht : meshTime T N j < t ∧ (t : ℝ) ≤ meshTime T N (j+1)) (ω : Ω) :
|
| 66 |
+
meshControl T N H t ω=H j ω := by
|
| 67 |
+
unfold meshControl
|
| 68 |
+
rw [Finset.sum_eq_single j]
|
| 69 |
+
· simp only [ite_eq_left ht]
|
| 70 |
+
· intro i _ hij
|
| 71 |
+
exact ite_eq_right (fun hi ↦ hij (mesh_intervals_disjoint hT hi ht))
|
| 72 |
+
· simp
|
| 73 |
+
|
| 74 |
+
lemma meshControl_bound {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (H : Fin N → Ω → ℝ)
|
| 75 |
+
(hH : ∀ j ω, |H j ω| ≤ 1) (t : ℝ≥0) (ω : Ω) : |meshControl T N H t ω| ≤ 1 := by
|
| 76 |
+
by_cases he : ∃ j : Fin N, meshTime T N j < t ∧ (t : ℝ) ≤ meshTime T N (j+1)
|
| 77 |
+
· obtain ⟨j,hj⟩ := he
|
| 78 |
+
rw [meshControl_eq hT H hj]
|
| 79 |
+
exact hH j ω
|
| 80 |
+
· have hh : meshControl T N H t ω=0 := by
|
| 81 |
+
unfold meshControl
|
| 82 |
+
apply Finset.sum_eq_zero
|
| 83 |
+
intro j _
|
| 84 |
+
exact ite_eq_right (fun hj ↦ he ⟨j,hj⟩)
|
| 85 |
+
rw [hh]
|
| 86 |
+
norm_num
|
| 87 |
+
|
| 88 |
+
lemma meshControl_momentIntegral {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (hN : 0<N)
|
| 89 |
+
(H : Fin N → Ω → ℝ) {γ : ℝ → ℝ} (hγ : IntervalIntegrable γ volume 0 T)
|
| 90 |
+
(k : ℕ) (ω : Ω) :
|
| 91 |
+
controlAccum γ (meshControl T N H) k T ω =
|
| 92 |
+
∑ j : Fin N, (∫ s in meshTime T N j..meshTime T N (j+1), γ s)*(H j ω)^k := by
|
| 93 |
+
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 94 |
+
have htime (j : ℕ) (hj : j ≤ N) := mesh_time_mem_total hT hj
|
| 95 |
+
have horder (j : ℕ) : meshTime T N j ≤ meshTime T N (j+1) := by
|
| 96 |
+
dsimp [meshTime]
|
| 97 |
+
exact mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.le_succ j) hδ
|
| 98 |
+
have hlast : meshTime T N N=T := by
|
| 99 |
+
dsimp [meshTime,stepSize]
|
| 100 |
+
field_simp
|
| 101 |
+
have he (j : Fin N) :
|
| 102 |
+
(fun s ↦ γ s*(meshControl T N H (Real.toNNReal s) ω)^k) =ᵐ[
|
| 103 |
+
volume.restrict (uIoc (meshTime T N j) (meshTime T N (j+1)))]
|
| 104 |
+
(fun s ↦ γ s*(H j ω)^k) := by
|
| 105 |
+
filter_upwards [ae_restrict_mem measurableSet_uIoc] with s hs
|
| 106 |
+
rw [uIoc_of_le (horder j)] at hs
|
| 107 |
+
have hs0 : 0 ≤ s := (htime j j.isLt.le).1.trans hs.1.le
|
| 108 |
+
rw [meshControl_eq hT H (by simpa only [Real.coe_toNNReal _ hs0,Set.mem_Ioc] using hs)]
|
| 109 |
+
have hi (j : ℕ) (hj : j<N) : IntervalIntegrable
|
| 110 |
+
(fun s ↦ γ s*(meshControl T N H (Real.toNNReal s) ω)^k) volume
|
| 111 |
+
(meshTime T N j) (meshTime T N (j+1)) := by
|
| 112 |
+
apply ((intervalIntegrable_substrip hT hγ (htime j hj.le)
|
| 113 |
+
(htime (j+1) hj)).mul_const ((H ⟨j,hj⟩ ω)^k)).congr_ae
|
| 114 |
+
exact (he ⟨j,hj⟩).symm
|
| 115 |
+
have hs := intervalIntegral.sum_integral_adjacent_intervals hi
|
| 116 |
+
rw [hlast,show meshTime T N 0=0 by simp [meshTime]] at hs
|
| 117 |
+
rw [controlAccum,←hs,←Fin.sum_univ_eq_sum_range]
|
| 118 |
+
apply Finset.sum_congr rfl
|
| 119 |
+
intro j _
|
| 120 |
+
rw [intervalIntegral.integral_congr_ae_restrict (he j),intervalIntegral.integral_mul_const]
|
| 121 |
+
|
| 122 |
+
lemma monotone_interval_quadrature {γ : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b)
|
| 123 |
+
(hγ : MonotoneOn γ (Icc a b)) :
|
| 124 |
+
|(∫ s in a..b, γ s)-(b-a)*γ a| ≤ (b-a)*(γ b-γ a) := by
|
| 125 |
+
have hi : IntervalIntegrable γ volume a b := by
|
| 126 |
+
apply MonotoneOn.intervalIntegrable
|
| 127 |
+
simpa only [uIcc_of_le hab] using hγ
|
| 128 |
+
have hdiff : (∫ s in a..b, γ s)-(b-a)*γ a =∫ s in a..b, γ s-γ a := by
|
| 129 |
+
rw [intervalIntegral.integral_sub hi intervalIntegrable_const]
|
| 130 |
+
simp only [intervalIntegral.integral_const,smul_eq_mul]
|
| 131 |
+
rw [hdiff]
|
| 132 |
+
have hh := intervalIntegral.norm_integral_le_of_norm_le_const
|
| 133 |
+
(a := a) (b := b) (f := fun s ↦ γ s-γ a) (C := γ b-γ a) (fun s hs ↦ by
|
| 134 |
+
rw [uIoc_of_le hab] at hs
|
| 135 |
+
have hs' : s∈Icc a b := ⟨hs.1.le,hs.2⟩
|
| 136 |
+
rw [Real.norm_eq_abs,abs_of_nonneg (sub_nonneg.mpr (hγ ⟨le_rfl,hab⟩ hs' hs.1.le))]
|
| 137 |
+
exact sub_le_sub_right (hγ hs' ⟨hab,le_rfl⟩ hs.2) _)
|
| 138 |
+
simpa only [Real.norm_eq_abs,abs_of_nonneg (sub_nonneg.mpr hab),mul_comm] using hh
|
| 139 |
+
|
| 140 |
+
lemma meshControl_quadrature {Ω : Type*} {T : ℝ} (hT : 0 ≤ T) {N : ℕ} (hN : 0<N)
|
| 141 |
+
(H : Fin N → Ω → ℝ) (hH : ∀ j ω, |H j ω| ≤ 1)
|
| 142 |
+
{γ : ℝ → ℝ} (hγ : MonotoneOn γ (Icc (0 : ℝ) T)) (k : ℕ) (ω : Ω) :
|
| 143 |
+
|controlAccum γ (meshControl T N H) k T ω-
|
| 144 |
+
∑ j : Fin N, stepSize T N*γ (meshTime T N j)*(H j ω)^k| ≤
|
| 145 |
+
stepSize T N*(γ T-γ 0) := by
|
| 146 |
+
have hi : IntervalIntegrable γ volume 0 T := by
|
| 147 |
+
apply MonotoneOn.intervalIntegrable
|
| 148 |
+
simpa only [uIcc_of_le hT] using hγ
|
| 149 |
+
rw [meshControl_momentIntegral hT hN H hi, ←Finset.sum_sub_distrib]
|
| 150 |
+
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 151 |
+
have htime (j : ℕ) (hj : j ≤ N) := mesh_time_mem_total hT hj
|
| 152 |
+
have hgap (j : ℕ) : meshTime T N (j+1)-meshTime T N j=stepSize T N := by
|
| 153 |
+
dsimp [meshTime]
|
| 154 |
+
push_cast
|
| 155 |
+
ring
|
| 156 |
+
have horder (j : ℕ) : meshTime T N j ≤ meshTime T N (j+1) := by
|
| 157 |
+
linarith [hgap j]
|
| 158 |
+
have hloc (j : Fin N) :
|
| 159 |
+
|(∫ s in meshTime T N j..meshTime T N (j+1), γ s)*(H j ω)^k-
|
| 160 |
+
stepSize T N*γ (meshTime T N j)*(H j ω)^k| ≤
|
| 161 |
+
stepSize T N*(γ (meshTime T N (j+1))-γ (meshTime T N j)) := by
|
| 162 |
+
rw [←sub_mul,abs_mul]
|
| 163 |
+
have hh := monotone_interval_quadrature (horder j)
|
| 164 |
+
(hγ.mono (Icc_subset_Icc (htime j j.isLt.le).1 (htime (j+1) j.isLt).2))
|
| 165 |
+
rw [hgap] at hh
|
| 166 |
+
have hp : |(H j ω)^k| ≤ 1 := by
|
| 167 |
+
rw [abs_pow]
|
| 168 |
+
exact pow_le_one₀ (abs_nonneg _) (hH j ω)
|
| 169 |
+
exact (mul_le_mul_of_nonneg_left hp (abs_nonneg _)).trans (by simpa only [mul_one] using hh)
|
| 170 |
+
calc
|
| 171 |
+
_ ≤ ∑ j : Fin N, |(∫ s in meshTime T N j..meshTime T N (j+1), γ s)*(H j ω)^k-
|
| 172 |
+
stepSize T N*γ (meshTime T N j)*(H j ω)^k| := Finset.abs_sum_le_sum_abs _ _
|
| 173 |
+
_ ≤ ∑ j : Fin N, stepSize T N*(γ (meshTime T N (j+1))-γ (meshTime T N j)) :=
|
| 174 |
+
Finset.sum_le_sum (fun j _ ↦ hloc j)
|
| 175 |
+
_ = _ := by
|
| 176 |
+
rw [←Finset.mul_sum, sum_steps_sub (fun j ↦ γ (meshTime T N j))]
|
| 177 |
+
have hlast : meshTime T N N=T := by
|
| 178 |
+
dsimp [meshTime,stepSize]
|
| 179 |
+
field_simp
|
| 180 |
+
change stepSize T N*(γ (meshTime T N N)-γ (meshTime T N 0)) = _
|
| 181 |
+
rw [hlast]
|
| 182 |
+
simp only [meshTime,Nat.cast_zero,zero_mul]
|
| 183 |
+
|
| 184 |
+
lemma coupled_euler_past_measurable {Ω : Type*} [m : MeasurableSpace Ω]
|
| 185 |
+
{B : ℝ≥0 → Ω → ℝ} (hBm : ∀ t, StronglyMeasurable (B t))
|
| 186 |
+
{T : ℝ} (hT : 0<T) {N : ℕ} (hN : 0<N) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 187 |
+
(hu : ∀ j<N, Measurable (u (meshTime T N j))) :
|
| 188 |
+
∀ j ≤ N, StronglyMeasurable[Filtration.natural B hBm (Real.toNNReal (meshTime T N j))]
|
| 189 |
+
(coupledEuler T γ u B N j) := by
|
| 190 |
+
let f := Filtration.natural B hBm
|
| 191 |
+
intro j
|
| 192 |
+
induction j with
|
| 193 |
+
| zero =>
|
| 194 |
+
intro _
|
| 195 |
+
convert (stronglyMeasurable_const : StronglyMeasurable[f (Real.toNNReal (meshTime T N 0))] (fun _ : Ω ↦ (0 : ℝ))) using 1
|
| 196 |
+
funext ω
|
| 197 |
+
exact coupled_euler_zero T γ u B N ω
|
| 198 |
+
| succ j ih =>
|
| 199 |
+
intro hjN
|
| 200 |
+
have hj : j<N := hjN
|
| 201 |
+
have hδ : 0 ≤ stepSize T N := div_nonneg hT.le (Nat.cast_nonneg N)
|
| 202 |
+
have ht : Real.toNNReal (meshTime T N j) ≤ Real.toNNReal (meshTime T N (j+1)) := by
|
| 203 |
+
apply Real.toNNReal_mono
|
| 204 |
+
apply mul_le_mul_of_nonneg_right _ hδ
|
| 205 |
+
exact_mod_cast Nat.le_succ j
|
| 206 |
+
have hY := (ih hj.le).mono (f.mono ht)
|
| 207 |
+
have hB0 := (Filtration.stronglyAdapted_natural hBm (Real.toNNReal (meshTime T N j))).mono (f.mono ht)
|
| 208 |
+
have hB1 := Filtration.stronglyAdapted_natural hBm (Real.toNNReal (meshTime T N (j+1)))
|
| 209 |
+
have hU := ((hu j hj).comp hY.measurable).stronglyMeasurable.const_mul
|
| 210 |
+
(stepSize T N*γ (meshTime T N j))
|
| 211 |
+
convert ((hY.add hB1).sub hB0).add hU using 1
|
| 212 |
+
funext ω
|
| 213 |
+
rw [coupled_euler_step B hT γ u hN hj ω]
|
| 214 |
+
rfl
|
| 215 |
+
|
| 216 |
+
lemma coupled_euler_drift_sum {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 217 |
+
{T : ℝ} (hT : 0<T) {N : ℕ} (hN : 0<N) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) (ω : Ω) :
|
| 218 |
+
coupledEuler T γ u B N N ω = B (Real.toNNReal T) ω-B 0 ω+
|
| 219 |
+
∑ j : Fin N, stepSize T N*γ (meshTime T N j)*u (meshTime T N j) (coupledEuler T γ u B N j ω) := by
|
| 220 |
+
have he (j : Fin N) :
|
| 221 |
+
coupledEuler T γ u B N (j+1) ω-coupledEuler T γ u B N j ω =
|
| 222 |
+
(B (Real.toNNReal (meshTime T N (j+1))) ω-B (Real.toNNReal (meshTime T N j)) ω)+
|
| 223 |
+
stepSize T N*γ (meshTime T N j)*u (meshTime T N j) (coupledEuler T γ u B N j ω) := by
|
| 224 |
+
rw [coupled_euler_step B hT γ u hN j.isLt ω]
|
| 225 |
+
dsimp [meshTime,stepSize]
|
| 226 |
+
ring
|
| 227 |
+
have hh := Finset.sum_congr (rfl : (Finset.univ : Finset (Fin N))=Finset.univ) (fun j _ ↦ he j)
|
| 228 |
+
rw [sum_steps_sub (fun j ↦ coupledEuler T γ u B N j ω),Finset.sum_add_distrib,
|
| 229 |
+
sum_steps_sub (fun j ↦ B (Real.toNNReal (meshTime T N j)) ω),coupled_euler_zero] at hh
|
| 230 |
+
have hlast : meshTime T N N=T := by dsimp [meshTime,stepSize]; field_simp
|
| 231 |
+
simpa only [sub_zero,hlast,show meshTime T N 0=0 by simp [meshTime],Real.toNNReal_zero] using hh
|
| 232 |
+
|
| 233 |
+
noncomputable def feedbackControl {Ω : Type*} (B : ℝ≥0 → Ω → ℝ) (γ : ℝ → ℝ)
|
| 234 |
+
(V : ℝ → ℝ → ℝ) (T : ℝ) (N : ℕ) : ℝ≥0 → Ω → ℝ :=
|
| 235 |
+
meshControl T N (fun j ω ↦ deriv (V (meshTime T N j))
|
| 236 |
+
(coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))
|
| 237 |
+
|
| 238 |
+
lemma ValueStrip.feedback_progressive {Ω : Type*} [m : MeasurableSpace Ω]
|
| 239 |
+
{B : ℝ≥0 → Ω → ℝ} (hBm : ∀ t, StronglyMeasurable (B t))
|
| 240 |
+
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 241 |
+
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N) :
|
| 242 |
+
IsProgressive (Filtration.natural B hBm) (feedbackControl B γ V T N) := by
|
| 243 |
+
apply meshControl_progressive hT.le
|
| 244 |
+
intro j
|
| 245 |
+
have hu (i : ℕ) (hi : i ≤ N) : Continuous (deriv (V (meshTime T N i))) :=
|
| 246 |
+
(h.smooth _ (mesh_time_mem_total hT.le hi)).continuous_deriv (by norm_num)
|
| 247 |
+
exact (hu j j.isLt.le).measurable.comp
|
| 248 |
+
(coupled_euler_past_measurable hBm hT hN γ (fun t ↦ deriv (V t))
|
| 249 |
+
(fun i hi ↦ (hu i hi.le).measurable) j j.isLt.le).measurable
|
| 250 |
+
|
| 251 |
+
lemma ValueStrip.feedback_bound {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 252 |
+
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 253 |
+
(hT : 0 ≤ T) (h : ValueStrip T γ V K L) (N : ℕ) (s : ℝ≥0) (ω : Ω) :
|
| 254 |
+
|feedbackControl B γ V T N s ω| ≤ 1 :=
|
| 255 |
+
meshControl_bound hT _ (fun j _ ↦ h.bounded _ (mesh_time_mem_total hT j.isLt.le) _) s ω
|
| 256 |
+
|
| 257 |
+
lemma ValueStrip.feedback_state_error {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 258 |
+
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 259 |
+
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N)
|
| 260 |
+
(ω : Ω) (hB0 : B 0 ω=0) :
|
| 261 |
+
|controlState B γ (feedbackControl B γ V T N) 0 T ω-
|
| 262 |
+
coupledEuler T γ (fun t ↦ deriv (V t)) B N N ω| ≤ stepSize T N*(γ T-γ 0) := by
|
| 263 |
+
have hh := meshControl_quadrature hT.le hN
|
| 264 |
+
(fun (j : Fin N) ω ↦ deriv (V (meshTime T N j))
|
| 265 |
+
(coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))
|
| 266 |
+
(fun j ω ↦ h.bounded _ (mesh_time_mem_total hT.le j.isLt.le) _)
|
| 267 |
+
h.gamma_mono 1 ω
|
| 268 |
+
rw [controlState,coupled_euler_drift_sum B hT hN,hB0]
|
| 269 |
+
simpa only [pow_one,zero_add,sub_zero,add_sub_add_left_eq_sub,feedbackControl] using hh
|
| 270 |
+
|
| 271 |
+
lemma ValueStrip.feedback_energy_error {Ω : Type*} (B : ℝ≥0 → Ω → ℝ)
|
| 272 |
+
{T K L : ℝ} {γ : ℝ → ℝ} {V : ℝ → ℝ → ℝ}
|
| 273 |
+
(hT : 0<T) (h : ValueStrip T γ V K L) {N : ℕ} (hN : 0<N) (ω : Ω) :
|
| 274 |
+
|(1/2 : ℝ)*controlAccum γ (feedbackControl B γ V T N) 2 T ω-
|
| 275 |
+
valueMeshEnergy T N γ V N (coupledCoordinates T N B ω)| ≤
|
| 276 |
+
(1/2 : ℝ)*stepSize T N*(γ T-γ 0) := by
|
| 277 |
+
have hh := meshControl_quadrature hT.le hN
|
| 278 |
+
(fun (j : Fin N) ω ↦ deriv (V (meshTime T N j))
|
| 279 |
+
(coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))
|
| 280 |
+
(fun j ω ↦ h.bounded _ (mesh_time_mem_total hT.le j.isLt.le) _)
|
| 281 |
+
h.gamma_mono 2 ω
|
| 282 |
+
have he : valueMeshEnergy T N γ V N (coupledCoordinates T N B ω) = (1/2 : ℝ)*
|
| 283 |
+
∑ j : Fin N, stepSize T N*γ (meshTime T N j)*
|
| 284 |
+
(deriv (V (meshTime T N j)) (coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))^2 := by
|
| 285 |
+
rw [Fin.sum_univ_eq_sum_range (fun j ↦ stepSize T N*γ (meshTime T N j)*
|
| 286 |
+
(deriv (V (meshTime T N j)) (coupledEuler T γ (fun t ↦ deriv (V t)) B N j ω))^2)]
|
| 287 |
+
dsimp only [valueMeshEnergy,coupledEuler]
|
| 288 |
+
simp only [ite_eq_right hN.ne',Finset.mul_sum]
|
| 289 |
+
apply Finset.sum_congr rfl
|
| 290 |
+
intro j _
|
| 291 |
+
ring
|
| 292 |
+
rw [he,←mul_sub,abs_mul,abs_of_nonneg (by norm_num : 0 ≤ (1/2 : ℝ))]
|
| 293 |
+
exact (mul_le_mul_of_nonneg_left hh (by norm_num)).trans_eq (by ring)
|
| 294 |
+
|
| 295 |
+
end SKValue
|
| 296 |
+
|
| 297 |
+
end
|
| 298 |
+
|
| 299 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/FiniteGaussianFixedStrip.lean
CHANGED
|
@@ -1,55 +1,55 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Evolution.MeanDerivativeContinuous
|
| 3 |
-
import OAI.Probability.SKValue.Processes.StripPaths
|
| 4 |
-
import OAI.Probability.SKValue.Equations.LiteralNormalizer
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set
|
| 10 |
-
open scoped ENNReal NNReal BigOperators
|
| 11 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 12 |
-
open scoped BigOperators Topology
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology BigOperators
|
| 15 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 16 |
-
open scoped Topology ENNReal NNReal
|
| 17 |
-
open Filter Set
|
| 18 |
-
open scoped Topology BigOperators
|
| 19 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 20 |
-
open scoped Topology
|
| 21 |
-
open MeasureTheory Set Filter
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
open MeasureTheory Set Filter Finset
|
| 24 |
-
open scoped Topology BigOperators
|
| 25 |
-
namespace SKValue
|
| 26 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 27 |
-
open scoped Topology
|
| 28 |
-
|
| 29 |
-
lemma IsDiffusion.finite_gaussian_fixed_strip {W : BrownianSpace} {γ : OrderParameter}
|
| 30 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {T K L D Lu La : ℝ}
|
| 31 |
-
(hT : 0<T) (hT1 : T<1) (hg : GradientStrip T γ.coeff (gradient W γ) K L)
|
| 32 |
-
(hD : 0≤D) (hLu : 0≤Lu) (hLa : 0≤La)
|
| 33 |
-
(ha : ∀ t∈Icc (0 : ℝ) T, ∀ x, |curvature W γ t x|≤D)
|
| 34 |
-
(huLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 35 |
-
|gradient W γ s x-gradient W γ t y|≤Lu*(|s-t|+|x-y|))
|
| 36 |
-
(haLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 37 |
-
|curvature W γ s x-curvature W γ t y|≤La*(|s-t|+|x-y|))
|
| 38 |
-
(hmom : ∀ t∈Icc (0 : ℝ) T, (∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ)=1) :
|
| 39 |
-
(∀ᶠ N in atTop, ∀ j<N, 0<normalizer W γ T N j) ∧
|
| 40 |
-
Tendsto (shiftedCoefficientSum W γ T) atTop
|
| 41 |
-
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, curvature W γ t (X t ω) ∂W.μ)) := by
|
| 42 |
-
have hh := finiteGaussian_from_diffusion W.brownian.toIsPreBrownianReal hT hT1.le hg
|
| 43 |
-
hD hLu hLa ha huLip haLip
|
| 44 |
-
(fun t ht ↦ (hX.measurable ⟨ht.1,ht.2.trans hT1.le⟩).aestronglyMeasurable)
|
| 45 |
-
(hX.strip_paths hT.le hT1 hLu (fun t ht s hs x y ↦ huLip s hs t ht y x)) hmom
|
| 46 |
-
constructor
|
| 47 |
-
· simpa only [literal_normalizer] using hh.1
|
| 48 |
-
· apply hh.2.congr'
|
| 49 |
-
exact Eventually.of_forall (fun N ↦ (literal_shiftedCoefficientSum W γ T N).symm)
|
| 50 |
-
|
| 51 |
-
end SKValue
|
| 52 |
-
|
| 53 |
-
end
|
| 54 |
-
|
| 55 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Evolution.MeanDerivativeContinuous
|
| 3 |
+
import OAI.Probability.SKValue.Processes.StripPaths
|
| 4 |
+
import OAI.Probability.SKValue.Equations.LiteralNormalizer
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set
|
| 10 |
+
open scoped ENNReal NNReal BigOperators
|
| 11 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 12 |
+
open scoped BigOperators Topology
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology BigOperators
|
| 15 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 16 |
+
open scoped Topology ENNReal NNReal
|
| 17 |
+
open Filter Set
|
| 18 |
+
open scoped Topology BigOperators
|
| 19 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 20 |
+
open scoped Topology
|
| 21 |
+
open MeasureTheory Set Filter
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
open MeasureTheory Set Filter Finset
|
| 24 |
+
open scoped Topology BigOperators
|
| 25 |
+
namespace SKValue
|
| 26 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 27 |
+
open scoped Topology
|
| 28 |
+
|
| 29 |
+
lemma IsDiffusion.finite_gaussian_fixed_strip {W : BrownianSpace} {γ : OrderParameter}
|
| 30 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {T K L D Lu La : ℝ}
|
| 31 |
+
(hT : 0<T) (hT1 : T<1) (hg : GradientStrip T γ.coeff (gradient W γ) K L)
|
| 32 |
+
(hD : 0≤D) (hLu : 0≤Lu) (hLa : 0≤La)
|
| 33 |
+
(ha : ∀ t∈Icc (0 : ℝ) T, ∀ x, |curvature W γ t x|≤D)
|
| 34 |
+
(huLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 35 |
+
|gradient W γ s x-gradient W γ t y|≤Lu*(|s-t|+|x-y|))
|
| 36 |
+
(haLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 37 |
+
|curvature W γ s x-curvature W γ t y|≤La*(|s-t|+|x-y|))
|
| 38 |
+
(hmom : ∀ t∈Icc (0 : ℝ) T, (∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ)=1) :
|
| 39 |
+
(∀ᶠ N in atTop, ∀ j<N, 0<normalizer W γ T N j) ∧
|
| 40 |
+
Tendsto (shiftedCoefficientSum W γ T) atTop
|
| 41 |
+
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, curvature W γ t (X t ω) ∂W.μ)) := by
|
| 42 |
+
have hh := finiteGaussian_from_diffusion W.brownian.toIsPreBrownianReal hT hT1.le hg
|
| 43 |
+
hD hLu hLa ha huLip haLip
|
| 44 |
+
(fun t ht ↦ (hX.measurable ⟨ht.1,ht.2.trans hT1.le⟩).aestronglyMeasurable)
|
| 45 |
+
(hX.strip_paths hT.le hT1 hLu (fun t ht s hs x y ↦ huLip s hs t ht y x)) hmom
|
| 46 |
+
constructor
|
| 47 |
+
· simpa only [literal_normalizer] using hh.1
|
| 48 |
+
· apply hh.2.congr'
|
| 49 |
+
exact Eventually.of_forall (fun N ↦ (literal_shiftedCoefficientSum W γ T N).symm)
|
| 50 |
+
|
| 51 |
+
end SKValue
|
| 52 |
+
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/FiniteProfileLaw.lean
CHANGED
|
@@ -1,40 +1,40 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.TestDiffusion
|
| 3 |
-
import OAI.Probability.SKValue.Equations.TestPatch
|
| 4 |
-
import OAI.Probability.SKValue.Evolution.TestStrip
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
|
| 10 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 11 |
-
open scoped Topology NNReal
|
| 12 |
-
namespace SKValue
|
| 13 |
-
lemma SmoothTerminal.profile_diffusion_test {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 14 |
-
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 15 |
-
{X:ℝ → Ω → ℝ} {ψ f:ℝ → ℝ} (hψ:SmoothTerminal ψ) (heven:∀ x,ψ (-x)=ψ x)
|
| 16 |
-
(hf:BoundedSmooth f) {l:HeatProfile} (hl:l.Pairwise (fun p q ↦ p.2≤q.2))
|
| 17 |
-
(hT:0<profileTime l) (hT1:profileTime l≤1)
|
| 18 |
-
(hXM:∀ t∈Icc (0:ℝ) (profileTime l),AEStronglyMeasurable (X t) μ)
|
| 19 |
-
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) (profileTime l)) ∧
|
| 20 |
-
IntervalIntegrable (fun s ↦ profileCoeff l s*deriv (profileValue ψ l s) (X s ω)) volume 0 (profileTime l) ∧
|
| 21 |
-
(∀ t∈Icc (0:ℝ) (profileTime l),X t ω=B t.toNNReal ω+
|
| 22 |
-
∫ s in (0:ℝ)..t,profileCoeff l s*deriv (profileValue ψ l s) (X s ω)) ∧ X 0 ω=0) :
|
| 23 |
-
(∫ ω,f (X (profileTime l) ω) ∂μ)=profileResponse ψ f l 0 0 := by
|
| 24 |
-
have hA := hψ.profile_evolution l
|
| 25 |
-
have hV := hψ.linear_profile hf l
|
| 26 |
-
obtain ⟨K,L,hu⟩ := hψ.profile_gradient_strip heven hl
|
| 27 |
-
obtain ⟨K',L',hv⟩ := hV.toBackwardTest (profileTime_nonneg l) hA
|
| 28 |
-
(fun t _ ↦ profileCoeff_nonneg l t) (profileCoeff_mono hl)
|
| 29 |
-
obtain ⟨Lu,hLu,hLip⟩ := hA.jet_joint 0
|
| 30 |
-
have hLip' : ∀ s∈Icc (0:ℝ) (profileTime l),∀ t∈Icc (0:ℝ) (profileTime l),∀ x y,
|
| 31 |
-
|deriv (profileValue ψ l s) x-deriv (profileValue ψ l t) y|≤Lu*(|s-t|+|x-y|) := by
|
| 32 |
-
intro s hs t ht x y
|
| 33 |
-
simpa only [iteratedDeriv_zero] using hLip s hs t ht y x
|
| 34 |
-
have he := hv.diffusion_expectation hB hT hT1 hu hLu hLip' hXM hpaths
|
| 35 |
-
rwa [profileResponse_terminal] at he
|
| 36 |
-
end SKValue
|
| 37 |
-
|
| 38 |
-
end
|
| 39 |
-
|
| 40 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.TestDiffusion
|
| 3 |
+
import OAI.Probability.SKValue.Equations.TestPatch
|
| 4 |
+
import OAI.Probability.SKValue.Evolution.TestStrip
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
|
| 10 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 11 |
+
open scoped Topology NNReal
|
| 12 |
+
namespace SKValue
|
| 13 |
+
lemma SmoothTerminal.profile_diffusion_test {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 14 |
+
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 15 |
+
{X:ℝ → Ω → ℝ} {ψ f:ℝ → ℝ} (hψ:SmoothTerminal ψ) (heven:∀ x,ψ (-x)=ψ x)
|
| 16 |
+
(hf:BoundedSmooth f) {l:HeatProfile} (hl:l.Pairwise (fun p q ↦ p.2≤q.2))
|
| 17 |
+
(hT:0<profileTime l) (hT1:profileTime l≤1)
|
| 18 |
+
(hXM:∀ t∈Icc (0:ℝ) (profileTime l),AEStronglyMeasurable (X t) μ)
|
| 19 |
+
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) (profileTime l)) ∧
|
| 20 |
+
IntervalIntegrable (fun s ↦ profileCoeff l s*deriv (profileValue ψ l s) (X s ω)) volume 0 (profileTime l) ∧
|
| 21 |
+
(∀ t∈Icc (0:ℝ) (profileTime l),X t ω=B t.toNNReal ω+
|
| 22 |
+
∫ s in (0:ℝ)..t,profileCoeff l s*deriv (profileValue ψ l s) (X s ω)) ∧ X 0 ω=0) :
|
| 23 |
+
(∫ ω,f (X (profileTime l) ω) ∂μ)=profileResponse ψ f l 0 0 := by
|
| 24 |
+
have hA := hψ.profile_evolution l
|
| 25 |
+
have hV := hψ.linear_profile hf l
|
| 26 |
+
obtain ⟨K,L,hu⟩ := hψ.profile_gradient_strip heven hl
|
| 27 |
+
obtain ⟨K',L',hv⟩ := hV.toBackwardTest (profileTime_nonneg l) hA
|
| 28 |
+
(fun t _ ↦ profileCoeff_nonneg l t) (profileCoeff_mono hl)
|
| 29 |
+
obtain ⟨Lu,hLu,hLip⟩ := hA.jet_joint 0
|
| 30 |
+
have hLip' : ∀ s∈Icc (0:ℝ) (profileTime l),∀ t∈Icc (0:ℝ) (profileTime l),∀ x y,
|
| 31 |
+
|deriv (profileValue ψ l s) x-deriv (profileValue ψ l t) y|≤Lu*(|s-t|+|x-y|) := by
|
| 32 |
+
intro s hs t ht x y
|
| 33 |
+
simpa only [iteratedDeriv_zero] using hLip s hs t ht y x
|
| 34 |
+
have he := hv.diffusion_expectation hB hT hT1 hu hLu hLip' hXM hpaths
|
| 35 |
+
rwa [profileResponse_terminal] at he
|
| 36 |
+
end SKValue
|
| 37 |
+
|
| 38 |
+
end
|
| 39 |
+
|
| 40 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/ForcedDiffusion.lean
CHANGED
|
@@ -1,66 +1,66 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.ForcedGenerator
|
| 3 |
-
import OAI.Probability.SKValue.Processes.ForcedExpectation
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
-
open scoped Topology NNReal BigOperators
|
| 11 |
-
namespace SKValue
|
| 12 |
-
lemma ForcedTest.diffusion_generator_of_source_limit {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 13 |
-
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 14 |
-
{X:ℝ → Ω → ℝ} {T K L K' L' Lu:ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 15 |
-
(hT:0<T) (hT1:T≤1) (hu:GradientStrip T γ u K L) (h:ForcedTest T γ u V b p K' L')
|
| 16 |
-
(hLu:0≤Lu) (hLip:∀ s∈Icc (0:ℝ) T,∀ t∈Icc (0:ℝ) T,∀ x y,
|
| 17 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 18 |
-
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 19 |
-
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) T) ∧
|
| 20 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 21 |
-
(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0)
|
| 22 |
-
{I:ℝ} (hsource:Tendsto (fun N ↦ stepSize T N*∑ j∈Finset.range N,
|
| 23 |
-
(∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))))
|
| 24 |
-
atTop (𝓝 I)) :
|
| 25 |
-
(∫ ω,V T (X T ω) ∂μ)=V 0 0+I := by
|
| 26 |
-
let S := fun N ↦ stepSize T N*∑ j∈Finset.range N,
|
| 27 |
-
(∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1)))
|
| 28 |
-
let A := fun N ↦ ∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))
|
| 29 |
-
let E := fun N ↦ T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L')+
|
| 30 |
-
stepSize T N*K'*(γ T-γ 0)
|
| 31 |
-
let F := fun N ↦ K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)
|
| 32 |
-
have hδ:Tendsto (fun N:ℕ ↦ stepSize T N) atTop (𝓝 (0:ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 33 |
-
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 34 |
-
have hE:Tendsto E atTop (𝓝 0) := by
|
| 35 |
-
simpa only [E,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,add_zero] using
|
| 36 |
-
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L'))).add
|
| 37 |
-
((hδ.mul_const K').mul_const (γ T-γ 0)))
|
| 38 |
-
have hF:Tendsto F atTop (𝓝 0) := by
|
| 39 |
-
simpa only [F,Function.comp_def,Real.sqrt_zero,mul_zero] using
|
| 40 |
-
(((Real.continuous_sqrt.tendsto 0).comp
|
| 41 |
-
(coupled_euler_L2_convergence hB hT hu hLu hLip hXM hpaths)).const_mul K')
|
| 42 |
-
have hbound:∀ᶠ N in atTop,|(∫ ω,V T (X T ω) ∂μ)-V 0 0-S N|≤E N+F N := by
|
| 43 |
-
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 44 |
-
have he := h.mesh_expectation hT hT1 hN
|
| 45 |
-
have hf := h.coupled_terminal_error hB hT hu hXM
|
| 46 |
-
(by filter_upwards [hpaths] with ω hω using hω.2.2) hN
|
| 47 |
-
have ht := abs_sub_le ((∫ ω,V T (X T ω) ∂μ)-V 0 0-S N) (A N-V 0 0-S N) 0
|
| 48 |
-
change |A N-V 0 0-S N|≤E N at he
|
| 49 |
-
change |A N-(∫ ω,V T (X T ω) ∂μ)|≤F N at hf
|
| 50 |
-
have hf' : |(∫ ω,V T (X T ω) ∂μ)-A N|≤F N := by
|
| 51 |
-
rw [abs_sub_comm];exact hf
|
| 52 |
-
have hid:((∫ ω,V T (X T ω) ∂μ)-V 0 0-S N)-(A N-V 0 0-S N)=
|
| 53 |
-
(∫ ω,V T (X T ω) ∂μ)-A N := by ring
|
| 54 |
-
rw [hid,sub_zero,sub_zero] at ht
|
| 55 |
-
linarith
|
| 56 |
-
have hleft:Tendsto (fun N ↦ |(∫ ω,V T (X T ω) ∂μ)-V 0 0-S N|) atTop
|
| 57 |
-
(𝓝 |(∫ ω,V T (X T ω) ∂μ)-V 0 0-I|) := (tendsto_const_nhds.sub hsource).abs
|
| 58 |
-
have hz := le_of_tendsto_of_tendsto hleft (hE.add hF) hbound
|
| 59 |
-
have habs:|(∫ ω,V T (X T ω) ∂μ)-V 0 0-I|=0 := le_antisymm (by simpa using hz) (abs_nonneg _)
|
| 60 |
-
have he := abs_eq_zero.mp habs
|
| 61 |
-
linarith
|
| 62 |
-
end SKValue
|
| 63 |
-
|
| 64 |
-
end
|
| 65 |
-
|
| 66 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.ForcedGenerator
|
| 3 |
+
import OAI.Probability.SKValue.Processes.ForcedExpectation
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
+
open scoped Topology NNReal BigOperators
|
| 11 |
+
namespace SKValue
|
| 12 |
+
lemma ForcedTest.diffusion_generator_of_source_limit {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 13 |
+
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 14 |
+
{X:ℝ → Ω → ℝ} {T K L K' L' Lu:ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 15 |
+
(hT:0<T) (hT1:T≤1) (hu:GradientStrip T γ u K L) (h:ForcedTest T γ u V b p K' L')
|
| 16 |
+
(hLu:0≤Lu) (hLip:∀ s∈Icc (0:ℝ) T,∀ t∈Icc (0:ℝ) T,∀ x y,
|
| 17 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 18 |
+
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 19 |
+
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) T) ∧
|
| 20 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 21 |
+
(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0)
|
| 22 |
+
{I:ℝ} (hsource:Tendsto (fun N ↦ stepSize T N*∑ j∈Finset.range N,
|
| 23 |
+
(∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))))
|
| 24 |
+
atTop (𝓝 I)) :
|
| 25 |
+
(∫ ω,V T (X T ω) ∂μ)=V 0 0+I := by
|
| 26 |
+
let S := fun N ↦ stepSize T N*∑ j∈Finset.range N,
|
| 27 |
+
(∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1)))
|
| 28 |
+
let A := fun N ↦ ∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))
|
| 29 |
+
let E := fun N ↦ T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L')+
|
| 30 |
+
stepSize T N*K'*(γ T-γ 0)
|
| 31 |
+
let F := fun N ↦ K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)
|
| 32 |
+
have hδ:Tendsto (fun N:ℕ ↦ stepSize T N) atTop (𝓝 (0:ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 33 |
+
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 34 |
+
have hE:Tendsto E atTop (𝓝 0) := by
|
| 35 |
+
simpa only [E,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,add_zero] using
|
| 36 |
+
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L'))).add
|
| 37 |
+
((hδ.mul_const K').mul_const (γ T-γ 0)))
|
| 38 |
+
have hF:Tendsto F atTop (𝓝 0) := by
|
| 39 |
+
simpa only [F,Function.comp_def,Real.sqrt_zero,mul_zero] using
|
| 40 |
+
(((Real.continuous_sqrt.tendsto 0).comp
|
| 41 |
+
(coupled_euler_L2_convergence hB hT hu hLu hLip hXM hpaths)).const_mul K')
|
| 42 |
+
have hbound:∀ᶠ N in atTop,|(∫ ω,V T (X T ω) ∂μ)-V 0 0-S N|≤E N+F N := by
|
| 43 |
+
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 44 |
+
have he := h.mesh_expectation hT hT1 hN
|
| 45 |
+
have hf := h.coupled_terminal_error hB hT hu hXM
|
| 46 |
+
(by filter_upwards [hpaths] with ω hω using hω.2.2) hN
|
| 47 |
+
have ht := abs_sub_le ((∫ ω,V T (X T ω) ∂μ)-V 0 0-S N) (A N-V 0 0-S N) 0
|
| 48 |
+
change |A N-V 0 0-S N|≤E N at he
|
| 49 |
+
change |A N-(∫ ω,V T (X T ω) ∂μ)|≤F N at hf
|
| 50 |
+
have hf' : |(∫ ω,V T (X T ω) ∂μ)-A N|≤F N := by
|
| 51 |
+
rw [abs_sub_comm];exact hf
|
| 52 |
+
have hid:((∫ ω,V T (X T ω) ∂μ)-V 0 0-S N)-(A N-V 0 0-S N)=
|
| 53 |
+
(∫ ω,V T (X T ω) ∂μ)-A N := by ring
|
| 54 |
+
rw [hid,sub_zero,sub_zero] at ht
|
| 55 |
+
linarith
|
| 56 |
+
have hleft:Tendsto (fun N ↦ |(∫ ω,V T (X T ω) ∂μ)-V 0 0-S N|) atTop
|
| 57 |
+
(𝓝 |(∫ ω,V T (X T ω) ∂μ)-V 0 0-I|) := (tendsto_const_nhds.sub hsource).abs
|
| 58 |
+
have hz := le_of_tendsto_of_tendsto hleft (hE.add hF) hbound
|
| 59 |
+
have habs:|(∫ ω,V T (X T ω) ∂μ)-V 0 0-I|=0 := le_antisymm (by simpa using hz) (abs_nonneg _)
|
| 60 |
+
have he := abs_eq_zero.mp habs
|
| 61 |
+
linarith
|
| 62 |
+
end SKValue
|
| 63 |
+
|
| 64 |
+
end
|
| 65 |
+
|
| 66 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/ForcedExpectation.lean
CHANGED
|
@@ -1,202 +1,202 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.CrossMesh
|
| 3 |
-
import OAI.Probability.SKValue.Control.Forced
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
-
open scoped Topology BigOperators NNReal
|
| 11 |
-
namespace SKValue
|
| 12 |
-
lemma ForcedTest.expectation_step {T K L t δ:ℝ} {γ:ℝ → ℝ} {u V b₀ p₀:ℝ → ℝ → ℝ}
|
| 13 |
-
(h:ForcedTest T γ u V b₀ p₀ K L) (ht:0≤t) (hδ:0≤δ) (hδ1:δ≤1) (htδ:t+δ≤T)
|
| 14 |
-
{N j:ℕ} (hj:j<N+1) {Y:(Fin (N+1) → ℝ) → ℝ}
|
| 15 |
-
(hYm:Measurable Y) (hYp:DependsBefore j Y) :
|
| 16 |
-
let μ := gaussianProduct (Fin (N+1))
|
| 17 |
-
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 18 |
-
|(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)-δ*(∫ z,forcedSource γ u V b₀ p₀ t (Y z) ∂μ)|≤
|
| 19 |
-
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 20 |
-
let μ := gaussianProduct (Fin (N+1))
|
| 21 |
-
let p := fun z ↦ deriv (V t) (Y z)
|
| 22 |
-
let a := fun z ↦ deriv (deriv (V t)) (Y z)
|
| 23 |
-
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 24 |
-
let P := fun z ↦ Real.sqrt δ*rawIncrement p j z
|
| 25 |
-
let Q := fun z ↦ (δ/2)*(a z*((coordinate N j z)^2-1))
|
| 26 |
-
let S := fun z ↦ forcedSource γ u V b₀ p₀ t (Y z)
|
| 27 |
-
let D := fun z ↦ V (t+δ) (Y' z)-V t (Y z)-δ*S z
|
| 28 |
-
let R := fun z ↦ D z-P z-Q z
|
| 29 |
-
let E := fun z ↦ δ*Real.sqrt δ*cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z)+δ*K*(γ (t+δ)-γ t)
|
| 30 |
-
have htT:t≤T := (le_add_of_nonneg_right hδ).trans htδ
|
| 31 |
-
have htm:t∈Icc (0:ℝ) T := ⟨ht,htT⟩
|
| 32 |
-
have hem:t+δ∈Icc (0:ℝ) T := ⟨by linarith,htδ⟩
|
| 33 |
-
have hpm:Measurable p := ((h.smooth t htm).continuous_deriv (by norm_num)).measurable.comp hYm
|
| 34 |
-
have ham:Measurable a := by
|
| 35 |
-
have hh := (h.smooth t htm).continuous_iteratedDeriv 2 (by norm_num)
|
| 36 |
-
simp only [show (2:ℕ)=1+1 from rfl,iteratedDeriv_succ] at hh
|
| 37 |
-
exact hh.measurable.comp hYm
|
| 38 |
-
have hpM:MemLp p 2 μ := MemLp.of_bound hpm.aestronglyMeasurable K
|
| 39 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound t htm (Y z)))
|
| 40 |
-
have haM:MemLp a 2 μ := MemLp.of_bound ham.aestronglyMeasurable K
|
| 41 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.second_bound t htm (Y z)))
|
| 42 |
-
have hpp:DependsBefore j p := fun z z' hz ↦ by dsimp only [p];rw [hYp z z' hz]
|
| 43 |
-
have hap:DependsBefore j a := fun z z' hz ↦ by dsimp only [a];rw [hYp z z' hz]
|
| 44 |
-
have hPi:Integrable P μ := (((rawIncrement_memLp hj hpm hpp hpM).const_mul _).integrable (by norm_num))
|
| 45 |
-
have hQi:Integrable Q μ := (((predictableCenteredSquare_memLp ham (fun z ↦ h.second_bound t htm (Y z))).const_mul _).integrable (by norm_num))
|
| 46 |
-
have hP0:(∫ z,P z ∂μ)=0 := by
|
| 47 |
-
dsimp only [P]
|
| 48 |
-
rw [integral_const_mul,rawIncrement_mean hj hpm hpp,mul_zero]
|
| 49 |
-
have hQ0:(∫ z,Q z ∂μ)=0 := by
|
| 50 |
-
dsimp only [Q]
|
| 51 |
-
rw [integral_const_mul,predictableCenteredSquare_mean hj ham hap,mul_zero]
|
| 52 |
-
have hY'm:Measurable Y' := (hYm.add ((measurable_coordinate N j).const_mul _)).add
|
| 53 |
-
(((h.drift_measurable t htm).comp hYm).const_mul _)
|
| 54 |
-
have hcur:Integrable (fun z ↦ V t (Y z)) μ :=
|
| 55 |
-
(MemLp.of_bound ((h.smooth t htm).continuous.measurable.comp hYm).aestronglyMeasurable K
|
| 56 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound t htm (Y z))) :
|
| 57 |
-
MemLp (fun z ↦ V t (Y z)) 2 μ).integrable (by norm_num)
|
| 58 |
-
have hnext:Integrable (fun z ↦ V (t+δ) (Y' z)) μ :=
|
| 59 |
-
(MemLp.of_bound ((h.smooth (t+δ) hem).continuous.measurable.comp hY'm).aestronglyMeasurable K
|
| 60 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound (t+δ) hem (Y' z))) :
|
| 61 |
-
MemLp (fun z ↦ V (t+δ) (Y' z)) 2 μ).integrable (by norm_num)
|
| 62 |
-
have hSi:Integrable S μ :=
|
| 63 |
-
(MemLp.of_bound ((h.source_measurable htm).comp hYm).aestronglyMeasurable ((1+2*γ T)*K)
|
| 64 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.source_bound htm (Y z))) :
|
| 65 |
-
MemLp S 2 μ).integrable (by norm_num)
|
| 66 |
-
have hDi:Integrable D μ := (hnext.sub hcur).sub (hSi.const_mul δ)
|
| 67 |
-
have hRi:Integrable R μ := (hDi.sub hPi).sub hQi
|
| 68 |
-
have hEi0 := (cubicEnvelope_memLp_two (coordinate_hasLaw N j)
|
| 69 |
-
(h.gamma_nonneg T ⟨ht.trans htT,le_rfl⟩) K ((1/2+γ T)*L)).integrable (by norm_num)
|
| 70 |
-
have hEi:Integrable E μ := (hEi0.const_mul _).add (integrable_const _)
|
| 71 |
-
have hRE (z) : |R z|≤E z := by
|
| 72 |
-
have hh := h.euler_one_step ht hδ hδ1 htδ (x:=Y z) (z:=coordinate N j z)
|
| 73 |
-
convert! hh using 1
|
| 74 |
-
dsimp only [R,D,P,Q,p,a,Y',S,E,rawIncrement]
|
| 75 |
-
congr 1
|
| 76 |
-
ring_nf
|
| 77 |
-
have hRmean:(∫ z,R z ∂μ)=(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)-δ*(∫ z,S z ∂μ) := by
|
| 78 |
-
have hs := integral_sub (hDi.sub hPi) hQi
|
| 79 |
-
change (∫ z,D z-P z-Q z ∂μ)=(∫ z,D z-P z ∂μ)-(∫ z,Q z ∂μ) at hs
|
| 80 |
-
have hs1 := integral_sub hDi hPi
|
| 81 |
-
change (∫ z,D z-P z ∂μ)=(∫ z,D z ∂μ)-(∫ z,P z ∂μ) at hs1
|
| 82 |
-
change (∫ z,D z-P z-Q z ∂μ)=_
|
| 83 |
-
rw [hs,hs1,hP0,hQ0,sub_zero,sub_zero]
|
| 84 |
-
have hs2 := integral_sub (hnext.sub hcur) (hSi.const_mul δ)
|
| 85 |
-
change (∫ z,V (t+δ) (Y' z)-V t (Y z)-δ*S z ∂μ)=
|
| 86 |
-
(∫ z,V (t+δ) (Y' z)-V t (Y z) ∂μ)-(∫ z,δ*S z ∂μ) at hs2
|
| 87 |
-
dsimp only [D]
|
| 88 |
-
rw [hs2,integral_sub hnext hcur,integral_const_mul]
|
| 89 |
-
have hEmean:(∫ z,E z ∂μ)=
|
| 90 |
-
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 91 |
-
dsimp only [E]
|
| 92 |
-
rw [integral_add (hEi0.const_mul _) (integrable_const _),integral_const_mul]
|
| 93 |
-
simp only [integral_const,probReal_univ,smul_eq_mul,one_mul]
|
| 94 |
-
have he:(∫ z,cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z) ∂μ)=
|
| 95 |
-
cubicEnvelopeMean (γ T) K ((1/2+γ T)*L) := by
|
| 96 |
-
simpa only [Function.comp_def,cubicEnvelopeMean,standardGaussian] using
|
| 97 |
-
(coordinate_hasLaw N j).integral_comp (measurable_cubicEnvelope (γ T) K ((1/2+γ T)*L)).aestronglyMeasurable
|
| 98 |
-
rw [he]
|
| 99 |
-
change |(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)-δ*(∫ z,forcedSource γ u V b₀ p₀ t (Y z) ∂μ)|≤_
|
| 100 |
-
rw [←hRmean,←hEmean]
|
| 101 |
-
exact abs_integral_le_integral_abs.trans (integral_mono hRi.norm hEi hRE)
|
| 102 |
-
end SKValue
|
| 103 |
-
|
| 104 |
-
end
|
| 105 |
-
|
| 106 |
-
section
|
| 107 |
-
|
| 108 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 109 |
-
open scoped Topology BigOperators NNReal
|
| 110 |
-
namespace SKValue
|
| 111 |
-
lemma ForcedTest.mesh_expectation {T K L:ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 112 |
-
(h:ForcedTest T γ u V b p K L) (hT:0<T) (hT1:T≤1) {N:ℕ} (hN:0<N) :
|
| 113 |
-
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-V 0 0-stepSize T N*∑ j∈Finset.range N,
|
| 114 |
-
(∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1)))|≤
|
| 115 |
-
T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 116 |
-
stepSize T N*K*(γ T-γ 0) := by
|
| 117 |
-
let δ := stepSize T N
|
| 118 |
-
let A := fun j ↦ ∫ z,V (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))
|
| 119 |
-
let S := fun j ↦ ∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))
|
| 120 |
-
have hNr:0<(N:ℝ) := by exact_mod_cast hN
|
| 121 |
-
have hδ:0≤δ := div_nonneg hT.le hNr.le
|
| 122 |
-
have hδ1:δ≤1 := by
|
| 123 |
-
apply (div_le_iff₀ hNr).mpr
|
| 124 |
-
have hn:(1:ℝ)≤N := by exact_mod_cast hN
|
| 125 |
-
simpa only [one_mul] using hT1.trans hn
|
| 126 |
-
have htime (j:ℕ) (hj:j≤N) := mesh_time_mem hT.le hN hj
|
| 127 |
-
have hs (j:ℕ) : meshTime T N j+δ=meshTime T N (j+1) := by dsimp [meshTime];push_cast;ring
|
| 128 |
-
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 129 |
-
have hzero:meshTime T N 0=0 := by simp [meshTime]
|
| 130 |
-
have hum (j:ℕ) (hj:j<N) : Measurable (u (meshTime T N j)) := h.drift_measurable _ (htime j hj.le)
|
| 131 |
-
have hstep (j:ℕ) (hj:j<N) : |A (j+1)-A j+(-δ*S j)|≤
|
| 132 |
-
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 133 |
-
δ*K*(γ (meshTime T N (j+1))-γ (meshTime T N j))+0*((0:ℝ)-0) := by
|
| 134 |
-
have hYp:DependsBefore j (fun z ↦ euler T N γ u z j) :=
|
| 135 |
-
eulerCoefficient_dependsBefore T hj.le γ u (fun _ y ↦ y)
|
| 136 |
-
have he := h.expectation_step (htime j hj.le).1 hδ hδ1
|
| 137 |
-
(by rw [hs];exact (htime (j+1) (by omega)).2) (by omega:j<N+1)
|
| 138 |
-
(measurable_euler T N γ u hum j hj.le) hYp
|
| 139 |
-
dsimp only at he
|
| 140 |
-
rw [hs] at he
|
| 141 |
-
simpa only [A,S,euler,δ,mul_assoc,add_zero,sub_self,mul_zero,sub_eq_add_neg,neg_mul] using he
|
| 142 |
-
have hh := abs_telescope_source (A:=A) (b:=fun j ↦ -δ*S j) (Γ:=fun j ↦ γ (meshTime T N j))
|
| 143 |
-
(Δ:=fun _ ↦ 0) (e:=0) hstep
|
| 144 |
-
have hA0:A 0=V 0 0 := by simp [A,meshTime,euler]
|
| 145 |
-
rw [hA0,show A N=(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))) by
|
| 146 |
-
dsimp only [A];rw [hlast],hlast,hzero] at hh
|
| 147 |
-
have hNd:(N:ℝ)*δ=T := by dsimp [δ,stepSize];field_simp
|
| 148 |
-
simpa only [neg_mul,Finset.sum_neg_distrib,←Finset.mul_sum,sub_self,mul_zero,add_zero,←mul_assoc,hNd,←sub_eq_add_neg,S] using hh
|
| 149 |
-
|
| 150 |
-
lemma ForcedTest.terminal_lipschitz {T K L:ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 151 |
-
(h:ForcedTest T γ u V b p K L) (hT:0≤T) (x y:ℝ) : |V T x-V T y|≤K*|x-y| := by
|
| 152 |
-
have hd := (h.smooth T ⟨hT,le_rfl⟩).differentiable (by norm_num)
|
| 153 |
-
have hb:∀ z,‖deriv (V T) z‖≤K := fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound T ⟨hT,le_rfl⟩ z
|
| 154 |
-
have hl : LipschitzWith ⟨K,h.K_nonneg⟩ (V T) := by
|
| 155 |
-
apply lipschitzWith_of_nnnorm_deriv_le hd
|
| 156 |
-
intro z
|
| 157 |
-
exact_mod_cast hb z
|
| 158 |
-
have hh := hl.dist_le_mul x y
|
| 159 |
-
change |V T x-V T y|≤K*|x-y| at hh
|
| 160 |
-
exact hh
|
| 161 |
-
|
| 162 |
-
lemma ForcedTest.coupled_terminal_error {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 163 |
-
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 164 |
-
{X:ℝ → Ω → ℝ} {T K L K' L':ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 165 |
-
(hT:0<T) (hu:GradientStrip T γ u K L) (h:ForcedTest T γ u V b p K' L')
|
| 166 |
-
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 167 |
-
(hpaths:∀ᵐ ω ∂μ,(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+
|
| 168 |
-
∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) {N:ℕ} (hN:0<N) :
|
| 169 |
-
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-
|
| 170 |
-
(∫ ω,V T (X T ω) ∂μ)|≤K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ) := by
|
| 171 |
-
let F := fun ω ↦ V T (coupledEuler T γ u B N N ω)
|
| 172 |
-
let G := fun ω ↦ V T (X T ω)
|
| 173 |
-
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 174 |
-
have ht:T∈Icc (0:ℝ) T := ⟨hT.le,le_rfl⟩
|
| 175 |
-
have hm:Continuous (V T) := (h.smooth T ht).continuous
|
| 176 |
-
have hFM:MemLp F 2 μ := MemLp.of_bound
|
| 177 |
-
(hm.measurable.comp_aemeasurable (coupled_euler_measurable hB hT hu N N le_rfl).aemeasurable).aestronglyMeasurable K'
|
| 178 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,F] using h.bound T ht _))
|
| 179 |
-
have hGM:MemLp G 2 μ := MemLp.of_bound
|
| 180 |
-
(hm.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable K'
|
| 181 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,G] using h.bound T ht _))
|
| 182 |
-
have hEM:MemLp E 2 μ := coupled_mesh_error_memLp hB hT hu hXM hpaths hN
|
| 183 |
-
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 184 |
-
have hFG (ω:Ω) : |F ω-G ω|≤K'*|E ω| := by
|
| 185 |
-
have he:|coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 186 |
-
have hh := le_initialMax (f:=fun k ↦
|
| 187 |
-
|coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 188 |
-
change |coupledEuler T γ u B N N ω-X (meshTime T N N) ω|≤E ω at hh
|
| 189 |
-
rwa [hlast] at hh
|
| 190 |
-
exact (h.terminal_lipschitz hT.le _ _).trans
|
| 191 |
-
(mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) h.K_nonneg)
|
| 192 |
-
have heq:(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))=(∫ ω,F ω ∂μ) := by
|
| 193 |
-
have heum := measurable_euler T N γ u (fun j hj ↦ (hu.smooth _ (mesh_time_mem hT.le hN hj.le)).continuous.measurable) N le_rfl
|
| 194 |
-
have hh := (coupledCoordinates_hasLaw hB hT hN).integral_comp (hm.measurable.comp heum).aestronglyMeasurable
|
| 195 |
-
simpa only [Function.comp_apply,F,coupledEuler,ite_eq_right (Nat.ne_of_gt hN)] using hh.symm
|
| 196 |
-
rw [heq]
|
| 197 |
-
exact first_moment_perturbation hFM hGM hEM h.K_nonneg (Eventually.of_forall hFG)
|
| 198 |
-
end SKValue
|
| 199 |
-
|
| 200 |
-
end
|
| 201 |
-
|
| 202 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.CrossMesh
|
| 3 |
+
import OAI.Probability.SKValue.Control.Forced
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
+
open scoped Topology BigOperators NNReal
|
| 11 |
+
namespace SKValue
|
| 12 |
+
lemma ForcedTest.expectation_step {T K L t δ:ℝ} {γ:ℝ → ℝ} {u V b₀ p₀:ℝ → ℝ → ℝ}
|
| 13 |
+
(h:ForcedTest T γ u V b₀ p₀ K L) (ht:0≤t) (hδ:0≤δ) (hδ1:δ≤1) (htδ:t+δ≤T)
|
| 14 |
+
{N j:ℕ} (hj:j<N+1) {Y:(Fin (N+1) → ℝ) → ℝ}
|
| 15 |
+
(hYm:Measurable Y) (hYp:DependsBefore j Y) :
|
| 16 |
+
let μ := gaussianProduct (Fin (N+1))
|
| 17 |
+
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 18 |
+
|(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)-δ*(∫ z,forcedSource γ u V b₀ p₀ t (Y z) ∂μ)|≤
|
| 19 |
+
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 20 |
+
let μ := gaussianProduct (Fin (N+1))
|
| 21 |
+
let p := fun z ↦ deriv (V t) (Y z)
|
| 22 |
+
let a := fun z ↦ deriv (deriv (V t)) (Y z)
|
| 23 |
+
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 24 |
+
let P := fun z ↦ Real.sqrt δ*rawIncrement p j z
|
| 25 |
+
let Q := fun z ↦ (δ/2)*(a z*((coordinate N j z)^2-1))
|
| 26 |
+
let S := fun z ↦ forcedSource γ u V b₀ p₀ t (Y z)
|
| 27 |
+
let D := fun z ↦ V (t+δ) (Y' z)-V t (Y z)-δ*S z
|
| 28 |
+
let R := fun z ↦ D z-P z-Q z
|
| 29 |
+
let E := fun z ↦ δ*Real.sqrt δ*cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z)+δ*K*(γ (t+δ)-γ t)
|
| 30 |
+
have htT:t≤T := (le_add_of_nonneg_right hδ).trans htδ
|
| 31 |
+
have htm:t∈Icc (0:ℝ) T := ⟨ht,htT⟩
|
| 32 |
+
have hem:t+δ∈Icc (0:ℝ) T := ⟨by linarith,htδ⟩
|
| 33 |
+
have hpm:Measurable p := ((h.smooth t htm).continuous_deriv (by norm_num)).measurable.comp hYm
|
| 34 |
+
have ham:Measurable a := by
|
| 35 |
+
have hh := (h.smooth t htm).continuous_iteratedDeriv 2 (by norm_num)
|
| 36 |
+
simp only [show (2:ℕ)=1+1 from rfl,iteratedDeriv_succ] at hh
|
| 37 |
+
exact hh.measurable.comp hYm
|
| 38 |
+
have hpM:MemLp p 2 μ := MemLp.of_bound hpm.aestronglyMeasurable K
|
| 39 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound t htm (Y z)))
|
| 40 |
+
have haM:MemLp a 2 μ := MemLp.of_bound ham.aestronglyMeasurable K
|
| 41 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.second_bound t htm (Y z)))
|
| 42 |
+
have hpp:DependsBefore j p := fun z z' hz ↦ by dsimp only [p];rw [hYp z z' hz]
|
| 43 |
+
have hap:DependsBefore j a := fun z z' hz ↦ by dsimp only [a];rw [hYp z z' hz]
|
| 44 |
+
have hPi:Integrable P μ := (((rawIncrement_memLp hj hpm hpp hpM).const_mul _).integrable (by norm_num))
|
| 45 |
+
have hQi:Integrable Q μ := (((predictableCenteredSquare_memLp ham (fun z ↦ h.second_bound t htm (Y z))).const_mul _).integrable (by norm_num))
|
| 46 |
+
have hP0:(∫ z,P z ∂μ)=0 := by
|
| 47 |
+
dsimp only [P]
|
| 48 |
+
rw [integral_const_mul,rawIncrement_mean hj hpm hpp,mul_zero]
|
| 49 |
+
have hQ0:(∫ z,Q z ∂μ)=0 := by
|
| 50 |
+
dsimp only [Q]
|
| 51 |
+
rw [integral_const_mul,predictableCenteredSquare_mean hj ham hap,mul_zero]
|
| 52 |
+
have hY'm:Measurable Y' := (hYm.add ((measurable_coordinate N j).const_mul _)).add
|
| 53 |
+
(((h.drift_measurable t htm).comp hYm).const_mul _)
|
| 54 |
+
have hcur:Integrable (fun z ↦ V t (Y z)) μ :=
|
| 55 |
+
(MemLp.of_bound ((h.smooth t htm).continuous.measurable.comp hYm).aestronglyMeasurable K
|
| 56 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound t htm (Y z))) :
|
| 57 |
+
MemLp (fun z ↦ V t (Y z)) 2 μ).integrable (by norm_num)
|
| 58 |
+
have hnext:Integrable (fun z ↦ V (t+δ) (Y' z)) μ :=
|
| 59 |
+
(MemLp.of_bound ((h.smooth (t+δ) hem).continuous.measurable.comp hY'm).aestronglyMeasurable K
|
| 60 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound (t+δ) hem (Y' z))) :
|
| 61 |
+
MemLp (fun z ↦ V (t+δ) (Y' z)) 2 μ).integrable (by norm_num)
|
| 62 |
+
have hSi:Integrable S μ :=
|
| 63 |
+
(MemLp.of_bound ((h.source_measurable htm).comp hYm).aestronglyMeasurable ((1+2*γ T)*K)
|
| 64 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.source_bound htm (Y z))) :
|
| 65 |
+
MemLp S 2 μ).integrable (by norm_num)
|
| 66 |
+
have hDi:Integrable D μ := (hnext.sub hcur).sub (hSi.const_mul δ)
|
| 67 |
+
have hRi:Integrable R μ := (hDi.sub hPi).sub hQi
|
| 68 |
+
have hEi0 := (cubicEnvelope_memLp_two (coordinate_hasLaw N j)
|
| 69 |
+
(h.gamma_nonneg T ⟨ht.trans htT,le_rfl⟩) K ((1/2+γ T)*L)).integrable (by norm_num)
|
| 70 |
+
have hEi:Integrable E μ := (hEi0.const_mul _).add (integrable_const _)
|
| 71 |
+
have hRE (z) : |R z|≤E z := by
|
| 72 |
+
have hh := h.euler_one_step ht hδ hδ1 htδ (x:=Y z) (z:=coordinate N j z)
|
| 73 |
+
convert! hh using 1
|
| 74 |
+
dsimp only [R,D,P,Q,p,a,Y',S,E,rawIncrement]
|
| 75 |
+
congr 1
|
| 76 |
+
ring_nf
|
| 77 |
+
have hRmean:(∫ z,R z ∂μ)=(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)-δ*(∫ z,S z ∂μ) := by
|
| 78 |
+
have hs := integral_sub (hDi.sub hPi) hQi
|
| 79 |
+
change (∫ z,D z-P z-Q z ∂μ)=(∫ z,D z-P z ∂μ)-(∫ z,Q z ∂μ) at hs
|
| 80 |
+
have hs1 := integral_sub hDi hPi
|
| 81 |
+
change (∫ z,D z-P z ∂μ)=(∫ z,D z ∂μ)-(∫ z,P z ∂μ) at hs1
|
| 82 |
+
change (∫ z,D z-P z-Q z ∂μ)=_
|
| 83 |
+
rw [hs,hs1,hP0,hQ0,sub_zero,sub_zero]
|
| 84 |
+
have hs2 := integral_sub (hnext.sub hcur) (hSi.const_mul δ)
|
| 85 |
+
change (∫ z,V (t+δ) (Y' z)-V t (Y z)-δ*S z ∂μ)=
|
| 86 |
+
(∫ z,V (t+δ) (Y' z)-V t (Y z) ∂μ)-(∫ z,δ*S z ∂μ) at hs2
|
| 87 |
+
dsimp only [D]
|
| 88 |
+
rw [hs2,integral_sub hnext hcur,integral_const_mul]
|
| 89 |
+
have hEmean:(∫ z,E z ∂μ)=
|
| 90 |
+
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 91 |
+
dsimp only [E]
|
| 92 |
+
rw [integral_add (hEi0.const_mul _) (integrable_const _),integral_const_mul]
|
| 93 |
+
simp only [integral_const,probReal_univ,smul_eq_mul,one_mul]
|
| 94 |
+
have he:(∫ z,cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z) ∂μ)=
|
| 95 |
+
cubicEnvelopeMean (γ T) K ((1/2+γ T)*L) := by
|
| 96 |
+
simpa only [Function.comp_def,cubicEnvelopeMean,standardGaussian] using
|
| 97 |
+
(coordinate_hasLaw N j).integral_comp (measurable_cubicEnvelope (γ T) K ((1/2+γ T)*L)).aestronglyMeasurable
|
| 98 |
+
rw [he]
|
| 99 |
+
change |(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)-δ*(∫ z,forcedSource γ u V b₀ p₀ t (Y z) ∂μ)|≤_
|
| 100 |
+
rw [←hRmean,←hEmean]
|
| 101 |
+
exact abs_integral_le_integral_abs.trans (integral_mono hRi.norm hEi hRE)
|
| 102 |
+
end SKValue
|
| 103 |
+
|
| 104 |
+
end
|
| 105 |
+
|
| 106 |
+
section
|
| 107 |
+
|
| 108 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 109 |
+
open scoped Topology BigOperators NNReal
|
| 110 |
+
namespace SKValue
|
| 111 |
+
lemma ForcedTest.mesh_expectation {T K L:ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 112 |
+
(h:ForcedTest T γ u V b p K L) (hT:0<T) (hT1:T≤1) {N:ℕ} (hN:0<N) :
|
| 113 |
+
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-V 0 0-stepSize T N*∑ j∈Finset.range N,
|
| 114 |
+
(∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1)))|≤
|
| 115 |
+
T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 116 |
+
stepSize T N*K*(γ T-γ 0) := by
|
| 117 |
+
let δ := stepSize T N
|
| 118 |
+
let A := fun j ↦ ∫ z,V (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))
|
| 119 |
+
let S := fun j ↦ ∫ z,forcedSource γ u V b p (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))
|
| 120 |
+
have hNr:0<(N:ℝ) := by exact_mod_cast hN
|
| 121 |
+
have hδ:0≤δ := div_nonneg hT.le hNr.le
|
| 122 |
+
have hδ1:δ≤1 := by
|
| 123 |
+
apply (div_le_iff₀ hNr).mpr
|
| 124 |
+
have hn:(1:ℝ)≤N := by exact_mod_cast hN
|
| 125 |
+
simpa only [one_mul] using hT1.trans hn
|
| 126 |
+
have htime (j:ℕ) (hj:j≤N) := mesh_time_mem hT.le hN hj
|
| 127 |
+
have hs (j:ℕ) : meshTime T N j+δ=meshTime T N (j+1) := by dsimp [meshTime];push_cast;ring
|
| 128 |
+
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 129 |
+
have hzero:meshTime T N 0=0 := by simp [meshTime]
|
| 130 |
+
have hum (j:ℕ) (hj:j<N) : Measurable (u (meshTime T N j)) := h.drift_measurable _ (htime j hj.le)
|
| 131 |
+
have hstep (j:ℕ) (hj:j<N) : |A (j+1)-A j+(-δ*S j)|≤
|
| 132 |
+
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 133 |
+
δ*K*(γ (meshTime T N (j+1))-γ (meshTime T N j))+0*((0:ℝ)-0) := by
|
| 134 |
+
have hYp:DependsBefore j (fun z ↦ euler T N γ u z j) :=
|
| 135 |
+
eulerCoefficient_dependsBefore T hj.le γ u (fun _ y ↦ y)
|
| 136 |
+
have he := h.expectation_step (htime j hj.le).1 hδ hδ1
|
| 137 |
+
(by rw [hs];exact (htime (j+1) (by omega)).2) (by omega:j<N+1)
|
| 138 |
+
(measurable_euler T N γ u hum j hj.le) hYp
|
| 139 |
+
dsimp only at he
|
| 140 |
+
rw [hs] at he
|
| 141 |
+
simpa only [A,S,euler,δ,mul_assoc,add_zero,sub_self,mul_zero,sub_eq_add_neg,neg_mul] using he
|
| 142 |
+
have hh := abs_telescope_source (A:=A) (b:=fun j ↦ -δ*S j) (Γ:=fun j ↦ γ (meshTime T N j))
|
| 143 |
+
(Δ:=fun _ ↦ 0) (e:=0) hstep
|
| 144 |
+
have hA0:A 0=V 0 0 := by simp [A,meshTime,euler]
|
| 145 |
+
rw [hA0,show A N=(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))) by
|
| 146 |
+
dsimp only [A];rw [hlast],hlast,hzero] at hh
|
| 147 |
+
have hNd:(N:ℝ)*δ=T := by dsimp [δ,stepSize];field_simp
|
| 148 |
+
simpa only [neg_mul,Finset.sum_neg_distrib,←Finset.mul_sum,sub_self,mul_zero,add_zero,←mul_assoc,hNd,←sub_eq_add_neg,S] using hh
|
| 149 |
+
|
| 150 |
+
lemma ForcedTest.terminal_lipschitz {T K L:ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 151 |
+
(h:ForcedTest T γ u V b p K L) (hT:0≤T) (x y:ℝ) : |V T x-V T y|≤K*|x-y| := by
|
| 152 |
+
have hd := (h.smooth T ⟨hT,le_rfl⟩).differentiable (by norm_num)
|
| 153 |
+
have hb:∀ z,‖deriv (V T) z‖≤K := fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound T ⟨hT,le_rfl⟩ z
|
| 154 |
+
have hl : LipschitzWith ⟨K,h.K_nonneg⟩ (V T) := by
|
| 155 |
+
apply lipschitzWith_of_nnnorm_deriv_le hd
|
| 156 |
+
intro z
|
| 157 |
+
exact_mod_cast hb z
|
| 158 |
+
have hh := hl.dist_le_mul x y
|
| 159 |
+
change |V T x-V T y|≤K*|x-y| at hh
|
| 160 |
+
exact hh
|
| 161 |
+
|
| 162 |
+
lemma ForcedTest.coupled_terminal_error {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 163 |
+
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 164 |
+
{X:ℝ → Ω → ℝ} {T K L K' L':ℝ} {γ:ℝ → ℝ} {u V b p:ℝ → ℝ → ℝ}
|
| 165 |
+
(hT:0<T) (hu:GradientStrip T γ u K L) (h:ForcedTest T γ u V b p K' L')
|
| 166 |
+
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 167 |
+
(hpaths:∀ᵐ ω ∂μ,(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+
|
| 168 |
+
∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) {N:ℕ} (hN:0<N) :
|
| 169 |
+
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-
|
| 170 |
+
(∫ ω,V T (X T ω) ∂μ)|≤K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ) := by
|
| 171 |
+
let F := fun ω ↦ V T (coupledEuler T γ u B N N ω)
|
| 172 |
+
let G := fun ω ↦ V T (X T ω)
|
| 173 |
+
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 174 |
+
have ht:T∈Icc (0:ℝ) T := ⟨hT.le,le_rfl⟩
|
| 175 |
+
have hm:Continuous (V T) := (h.smooth T ht).continuous
|
| 176 |
+
have hFM:MemLp F 2 μ := MemLp.of_bound
|
| 177 |
+
(hm.measurable.comp_aemeasurable (coupled_euler_measurable hB hT hu N N le_rfl).aemeasurable).aestronglyMeasurable K'
|
| 178 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,F] using h.bound T ht _))
|
| 179 |
+
have hGM:MemLp G 2 μ := MemLp.of_bound
|
| 180 |
+
(hm.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable K'
|
| 181 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,G] using h.bound T ht _))
|
| 182 |
+
have hEM:MemLp E 2 μ := coupled_mesh_error_memLp hB hT hu hXM hpaths hN
|
| 183 |
+
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 184 |
+
have hFG (ω:Ω) : |F ω-G ω|≤K'*|E ω| := by
|
| 185 |
+
have he:|coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 186 |
+
have hh := le_initialMax (f:=fun k ↦
|
| 187 |
+
|coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 188 |
+
change |coupledEuler T γ u B N N ω-X (meshTime T N N) ω|≤E ω at hh
|
| 189 |
+
rwa [hlast] at hh
|
| 190 |
+
exact (h.terminal_lipschitz hT.le _ _).trans
|
| 191 |
+
(mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) h.K_nonneg)
|
| 192 |
+
have heq:(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))=(∫ ω,F ω ∂μ) := by
|
| 193 |
+
have heum := measurable_euler T N γ u (fun j hj ↦ (hu.smooth _ (mesh_time_mem hT.le hN hj.le)).continuous.measurable) N le_rfl
|
| 194 |
+
have hh := (coupledCoordinates_hasLaw hB hT hN).integral_comp (hm.measurable.comp heum).aestronglyMeasurable
|
| 195 |
+
simpa only [Function.comp_apply,F,coupledEuler,ite_eq_right (Nat.ne_of_gt hN)] using hh.symm
|
| 196 |
+
rw [heq]
|
| 197 |
+
exact first_moment_perturbation hFM hGM hEM h.K_nonneg (Eventually.of_forall hFG)
|
| 198 |
+
end SKValue
|
| 199 |
+
|
| 200 |
+
end
|
| 201 |
+
|
| 202 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/GradientSquareIntegral.lean
CHANGED
|
@@ -1,96 +1,96 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Control.StripRegularity
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 25 |
-
open scoped Topology NNReal
|
| 26 |
-
|
| 27 |
-
lemma IsDiffusion.gradient_square_integral {W : BrownianSpace} {γ : OrderParameter}
|
| 28 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (hreg : SourceStripRegularity W γ)
|
| 29 |
-
{T : ℝ} (hT : 0<T) (hT1 : T<1) :
|
| 30 |
-
(∫ ω, (gradient W γ T (X T ω))^2 ∂W.μ)=
|
| 31 |
-
∫ t in (0 : ℝ)..T, ∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ := by
|
| 32 |
-
obtain ⟨Kv,Lv,K,L,D,Lu,La,hV,hG,hD,hLu,hLa,hDb,hu,ha⟩ := hreg T ⟨hT.le,hT1⟩
|
| 33 |
-
exact diffusion_gradient_isometry W.brownian.toIsPreBrownianReal hT hT1.le hG
|
| 34 |
-
hD hLu hLa hDb hu ha
|
| 35 |
-
(fun t ht ↦ (hX.measurable ⟨ht.1,ht.2.trans hT1.le⟩).aestronglyMeasurable)
|
| 36 |
-
(hX.strip_paths hT.le hT1 hLu (fun t ht s hs x y ↦ hu s hs t ht y x))
|
| 37 |
-
|
| 38 |
-
lemma IsDiffusion.curvature_square_mean_continuous {W : BrownianSpace} {γ : OrderParameter}
|
| 39 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (hreg : SourceStripRegularity W γ) :
|
| 40 |
-
ContinuousOn (fun t ↦ ∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ) (Ico (0 : ℝ) 1) := by
|
| 41 |
-
intro t ht
|
| 42 |
-
obtain ⟨T,htT,hT1⟩ := exists_between ht.2
|
| 43 |
-
obtain ⟨Kv,Lv,K,L,D,Lu,La,hV,hG,hD,hLu,hLa,hDb,hu,ha⟩ := hreg T ⟨ht.1.trans htT.le,hT1⟩
|
| 44 |
-
have hc := mean_derivative_square_continuous hD hLa
|
| 45 |
-
(fun s hs ↦ (hG.smooth s hs).continuous_deriv (by norm_num)) hDb ha
|
| 46 |
-
(fun s hs ↦ (hX.measurable ⟨hs.1,hs.2.trans hT1.le⟩).aestronglyMeasurable)
|
| 47 |
-
(hX.2.mono (fun _ hω ↦ hω.1.mono (Icc_subset_Icc le_rfl hT1.le)))
|
| 48 |
-
apply (hc t ⟨ht.1,htT.le⟩).mono_of_mem_nhdsWithin
|
| 49 |
-
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds htT)] with s hs hsT
|
| 50 |
-
exact ⟨hs.1,hsT.le⟩
|
| 51 |
-
|
| 52 |
-
lemma continuous_eq_one_of_primitive {f : ℝ → ℝ}
|
| 53 |
-
(hc : ContinuousOn f (Ico (0 : ℝ) 1))
|
| 54 |
-
(hi : ∀ t∈Ioo (0 : ℝ) 1, (∫ s in (0 : ℝ)..t, f s)=t) :
|
| 55 |
-
∀ t∈Ico (0 : ℝ) 1, f t=1 := by
|
| 56 |
-
have hint (t : ℝ) (ht : t∈Ioo (0 : ℝ) 1) : f t=1 := by
|
| 57 |
-
have hf : IntervalIntegrable f volume 0 t := by
|
| 58 |
-
apply ContinuousOn.intervalIntegrable
|
| 59 |
-
rw [uIcc_of_le ht.1.le]
|
| 60 |
-
exact hc.mono (fun s hs ↦ ⟨hs.1,hs.2.trans_lt ht.2⟩)
|
| 61 |
-
have hs : Ico (0 : ℝ) 1∈𝓝 t := Ico_mem_nhds ht.1 ht.2
|
| 62 |
-
have hd := intervalIntegral.integral_hasDerivAt_right hf
|
| 63 |
-
⟨Ico (0 : ℝ) 1,hs,hc.aestronglyMeasurable measurableSet_Ico⟩
|
| 64 |
-
((hc t ⟨ht.1.le,ht.2⟩).continuousAt hs)
|
| 65 |
-
have he : (fun t ↦ ∫ s in (0 : ℝ)..t, f s)=ᶠ[𝓝 t] (id : ℝ → ℝ) := by
|
| 66 |
-
filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs
|
| 67 |
-
exact hi s hs
|
| 68 |
-
exact hd.unique ((hasDerivAt_id t).congr_of_eventuallyEq he)
|
| 69 |
-
intro t ht
|
| 70 |
-
obtain h0|h0 := ht.1.eq_or_lt
|
| 71 |
-
· subst t
|
| 72 |
-
have hlim : Tendsto f (𝓝[>] (0 : ℝ)) (𝓝 (f 0)) := by
|
| 73 |
-
apply (hc 0 (by norm_num)).mono_left
|
| 74 |
-
apply le_inf nhdsWithin_le_nhds
|
| 75 |
-
apply le_principal_iff.mpr
|
| 76 |
-
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ)<1))] with s hs hs1
|
| 77 |
-
exact ⟨hs.le,hs1⟩
|
| 78 |
-
apply tendsto_nhds_unique hlim
|
| 79 |
-
apply tendsto_const_nhds.congr'
|
| 80 |
-
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ)<1))] with s hs hs1
|
| 81 |
-
exact (hint s ⟨hs,hs1⟩).symm
|
| 82 |
-
· exact hint t ⟨h0,ht.2⟩
|
| 83 |
-
|
| 84 |
-
lemma IsDiffusion.curvature_unit_moment_of_contact {W : BrownianSpace} {γ : OrderParameter}
|
| 85 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (hreg : SourceStripRegularity W γ)
|
| 86 |
-
(hmom : ∀ t∈Ico (0 : ℝ) 1, (∫ ω, (gradient W γ t (X t ω))^2 ∂W.μ)=t) :
|
| 87 |
-
∀ t∈Ico (0 : ℝ) 1, (∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ)=1 := by
|
| 88 |
-
apply continuous_eq_one_of_primitive (hX.curvature_square_mean_continuous hreg)
|
| 89 |
-
intro t ht
|
| 90 |
-
rw [←hX.gradient_square_integral hreg ht.1 ht.2,hmom t ⟨ht.1.le,ht.2⟩]
|
| 91 |
-
|
| 92 |
-
end SKValue
|
| 93 |
-
|
| 94 |
-
end
|
| 95 |
-
|
| 96 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Control.StripRegularity
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 25 |
+
open scoped Topology NNReal
|
| 26 |
+
|
| 27 |
+
lemma IsDiffusion.gradient_square_integral {W : BrownianSpace} {γ : OrderParameter}
|
| 28 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (hreg : SourceStripRegularity W γ)
|
| 29 |
+
{T : ℝ} (hT : 0<T) (hT1 : T<1) :
|
| 30 |
+
(∫ ω, (gradient W γ T (X T ω))^2 ∂W.μ)=
|
| 31 |
+
∫ t in (0 : ℝ)..T, ∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ := by
|
| 32 |
+
obtain ⟨Kv,Lv,K,L,D,Lu,La,hV,hG,hD,hLu,hLa,hDb,hu,ha⟩ := hreg T ⟨hT.le,hT1⟩
|
| 33 |
+
exact diffusion_gradient_isometry W.brownian.toIsPreBrownianReal hT hT1.le hG
|
| 34 |
+
hD hLu hLa hDb hu ha
|
| 35 |
+
(fun t ht ↦ (hX.measurable ⟨ht.1,ht.2.trans hT1.le⟩).aestronglyMeasurable)
|
| 36 |
+
(hX.strip_paths hT.le hT1 hLu (fun t ht s hs x y ↦ hu s hs t ht y x))
|
| 37 |
+
|
| 38 |
+
lemma IsDiffusion.curvature_square_mean_continuous {W : BrownianSpace} {γ : OrderParameter}
|
| 39 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (hreg : SourceStripRegularity W γ) :
|
| 40 |
+
ContinuousOn (fun t ↦ ∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ) (Ico (0 : ℝ) 1) := by
|
| 41 |
+
intro t ht
|
| 42 |
+
obtain ⟨T,htT,hT1⟩ := exists_between ht.2
|
| 43 |
+
obtain ⟨Kv,Lv,K,L,D,Lu,La,hV,hG,hD,hLu,hLa,hDb,hu,ha⟩ := hreg T ⟨ht.1.trans htT.le,hT1⟩
|
| 44 |
+
have hc := mean_derivative_square_continuous hD hLa
|
| 45 |
+
(fun s hs ↦ (hG.smooth s hs).continuous_deriv (by norm_num)) hDb ha
|
| 46 |
+
(fun s hs ↦ (hX.measurable ⟨hs.1,hs.2.trans hT1.le⟩).aestronglyMeasurable)
|
| 47 |
+
(hX.2.mono (fun _ hω ↦ hω.1.mono (Icc_subset_Icc le_rfl hT1.le)))
|
| 48 |
+
apply (hc t ⟨ht.1,htT.le⟩).mono_of_mem_nhdsWithin
|
| 49 |
+
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds htT)] with s hs hsT
|
| 50 |
+
exact ⟨hs.1,hsT.le⟩
|
| 51 |
+
|
| 52 |
+
lemma continuous_eq_one_of_primitive {f : ℝ → ℝ}
|
| 53 |
+
(hc : ContinuousOn f (Ico (0 : ℝ) 1))
|
| 54 |
+
(hi : ∀ t∈Ioo (0 : ℝ) 1, (∫ s in (0 : ℝ)..t, f s)=t) :
|
| 55 |
+
∀ t∈Ico (0 : ℝ) 1, f t=1 := by
|
| 56 |
+
have hint (t : ℝ) (ht : t∈Ioo (0 : ℝ) 1) : f t=1 := by
|
| 57 |
+
have hf : IntervalIntegrable f volume 0 t := by
|
| 58 |
+
apply ContinuousOn.intervalIntegrable
|
| 59 |
+
rw [uIcc_of_le ht.1.le]
|
| 60 |
+
exact hc.mono (fun s hs ↦ ⟨hs.1,hs.2.trans_lt ht.2⟩)
|
| 61 |
+
have hs : Ico (0 : ℝ) 1∈𝓝 t := Ico_mem_nhds ht.1 ht.2
|
| 62 |
+
have hd := intervalIntegral.integral_hasDerivAt_right hf
|
| 63 |
+
⟨Ico (0 : ℝ) 1,hs,hc.aestronglyMeasurable measurableSet_Ico⟩
|
| 64 |
+
((hc t ⟨ht.1.le,ht.2⟩).continuousAt hs)
|
| 65 |
+
have he : (fun t ↦ ∫ s in (0 : ℝ)..t, f s)=ᶠ[𝓝 t] (id : ℝ → ℝ) := by
|
| 66 |
+
filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs
|
| 67 |
+
exact hi s hs
|
| 68 |
+
exact hd.unique ((hasDerivAt_id t).congr_of_eventuallyEq he)
|
| 69 |
+
intro t ht
|
| 70 |
+
obtain h0|h0 := ht.1.eq_or_lt
|
| 71 |
+
· subst t
|
| 72 |
+
have hlim : Tendsto f (𝓝[>] (0 : ℝ)) (𝓝 (f 0)) := by
|
| 73 |
+
apply (hc 0 (by norm_num)).mono_left
|
| 74 |
+
apply le_inf nhdsWithin_le_nhds
|
| 75 |
+
apply le_principal_iff.mpr
|
| 76 |
+
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ)<1))] with s hs hs1
|
| 77 |
+
exact ⟨hs.le,hs1⟩
|
| 78 |
+
apply tendsto_nhds_unique hlim
|
| 79 |
+
apply tendsto_const_nhds.congr'
|
| 80 |
+
filter_upwards [self_mem_nhdsWithin,mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds (by norm_num : (0 : ℝ)<1))] with s hs hs1
|
| 81 |
+
exact (hint s ⟨hs,hs1⟩).symm
|
| 82 |
+
· exact hint t ⟨h0,ht.2⟩
|
| 83 |
+
|
| 84 |
+
lemma IsDiffusion.curvature_unit_moment_of_contact {W : BrownianSpace} {γ : OrderParameter}
|
| 85 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) (hreg : SourceStripRegularity W γ)
|
| 86 |
+
(hmom : ∀ t∈Ico (0 : ℝ) 1, (∫ ω, (gradient W γ t (X t ω))^2 ∂W.μ)=t) :
|
| 87 |
+
∀ t∈Ico (0 : ℝ) 1, (∫ ω, (curvature W γ t (X t ω))^2 ∂W.μ)=1 := by
|
| 88 |
+
apply continuous_eq_one_of_primitive (hX.curvature_square_mean_continuous hreg)
|
| 89 |
+
intro t ht
|
| 90 |
+
rw [←hX.gradient_square_integral hreg ht.1 ht.2,hmom t ⟨ht.1.le,ht.2⟩]
|
| 91 |
+
|
| 92 |
+
end SKValue
|
| 93 |
+
|
| 94 |
+
end
|
| 95 |
+
|
| 96 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/Measurable.lean
CHANGED
|
@@ -1,147 +1,147 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Evolution.TerminalError
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 25 |
-
open scoped Topology NNReal ENNReal BigOperators
|
| 26 |
-
|
| 27 |
-
lemma IsDiffusion.measurable {W : BrownianSpace} {γ : OrderParameter}
|
| 28 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {t : ℝ} (ht : t∈Icc (0 : ℝ) 1) :
|
| 29 |
-
Measurable (X t) := by
|
| 30 |
-
simpa only [Real.coe_toNNReal t ht.1, min_eq_left ht.2] using
|
| 31 |
-
(hX.1 t.toNNReal).mono (W.filtration.le t.toNNReal) le_rfl
|
| 32 |
-
|
| 33 |
-
lemma drift_integral_bound (W : BrownianSpace) (γ : OrderParameter) {t : ℝ}
|
| 34 |
-
(ht : t∈Icc (0 : ℝ) 1) (x : ℝ → ℝ) :
|
| 35 |
-
|∫ s in (0 : ℝ)..t, γ.coeff s*gradient W γ s (x s)|≤∫ s in (0 : ℝ)..1, γ.cutoff s := by
|
| 36 |
-
have he : (∫ s in (0 : ℝ)..t, γ.coeff s*gradient W γ s (x s)) =
|
| 37 |
-
∫ s in (0 : ℝ)..t, γ.cutoff s*gradient W γ s (x s) := by
|
| 38 |
-
apply intervalIntegral.integral_congr_Ioo_of_le ht.1
|
| 39 |
-
intro s hs
|
| 40 |
-
change γ.coeff s*gradient W γ s (x s)=γ.cutoff s*gradient W γ s (x s)
|
| 41 |
-
have hs' : s∈Ico (0 : ℝ) 1 := ⟨hs.1.le,hs.2.trans_le ht.2⟩
|
| 42 |
-
rw [OrderParameter.cutoff, Set.indicator_of_mem hs']
|
| 43 |
-
rw [he]
|
| 44 |
-
have hb := intervalIntegral.norm_integral_le_of_norm_le ht.1
|
| 45 |
-
(f := fun s ↦ γ.cutoff s*gradient W γ s (x s))
|
| 46 |
-
(Eventually.of_forall (fun s hs ↦ by
|
| 47 |
-
rw [Real.norm_eq_abs,abs_mul,abs_of_nonneg (γ.cutoff_nonneg s)]
|
| 48 |
-
exact (mul_le_mul_of_nonneg_left (gradient_bound W γ ⟨hs.1.le,hs.2.trans ht.2⟩ (x s))
|
| 49 |
-
(γ.cutoff_nonneg s)).trans_eq (mul_one _)))
|
| 50 |
-
(γ.cutoff_integrable.intervalIntegrable (a := 0) (b := t))
|
| 51 |
-
have hm := intervalIntegral.integral_mono_interval (c := (0 : ℝ)) (d := 1) le_rfl ht.1 ht.2
|
| 52 |
-
(Eventually.of_forall (fun s ↦ γ.cutoff_nonneg s)) γ.cutoff_integrable.intervalIntegrable
|
| 53 |
-
rw [Real.norm_eq_abs] at hb
|
| 54 |
-
exact hb.trans hm
|
| 55 |
-
|
| 56 |
-
lemma IsDiffusion.drift_bound {W : BrownianSpace} {γ : OrderParameter}
|
| 57 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) :
|
| 58 |
-
∀ᵐ ω ∂W.μ, ∀ t∈Icc (0 : ℝ) 1,
|
| 59 |
-
|X t ω-W.B t.toNNReal ω|≤∫ s in (0 : ℝ)..1, γ.cutoff s := by
|
| 60 |
-
filter_upwards [hX.2] with ω hω t ht
|
| 61 |
-
rw [hω.2 t ht, add_sub_cancel_left]
|
| 62 |
-
exact drift_integral_bound W γ ht (fun s ↦ X s ω)
|
| 63 |
-
|
| 64 |
-
lemma IsDiffusion.memLp {W : BrownianSpace} {γ : OrderParameter}
|
| 65 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {t : ℝ} (ht : t∈Icc (0 : ℝ) 1)
|
| 66 |
-
{p : ℝ≥0∞} (hp : p≠∞) : MemLp (X t) p W.μ := by
|
| 67 |
-
have hd : MemLp (fun ω ↦ X t ω-W.B t.toNNReal ω) p W.μ :=
|
| 68 |
-
MemLp.of_bound ((hX.measurable ht).sub (W.measurable _).measurable).aestronglyMeasurable
|
| 69 |
-
(∫ s in (0 : ℝ)..1, γ.cutoff s) (hX.drift_bound.mono (fun ω hω ↦ by
|
| 70 |
-
simpa only [Real.norm_eq_abs] using hω t ht))
|
| 71 |
-
have hb := (W.brownian.hasLaw_eval t.toNNReal).hasGaussianLaw.memLp hp
|
| 72 |
-
convert hd.add hb using 1
|
| 73 |
-
funext ω
|
| 74 |
-
simp only [Pi.add_apply, sub_add_cancel]
|
| 75 |
-
|
| 76 |
-
lemma eventually_time_mem : ∀ᶠ t : ℝ in 𝓝[<] 1, t∈Icc (0 : ℝ) 1 := by
|
| 77 |
-
filter_upwards [Ico_mem_nhdsLT (by norm_num : (0 : ℝ)<1)] with t ht
|
| 78 |
-
exact ⟨ht.1,ht.2.le⟩
|
| 79 |
-
|
| 80 |
-
lemma IsDiffusion.ae_tendsto {W : BrownianSpace} {γ : OrderParameter}
|
| 81 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) :
|
| 82 |
-
∀ᵐ ω ∂W.μ, Tendsto (fun t ↦ X t ω) (𝓝[<] (1 : ℝ)) (𝓝 (X 1 ω)) := by
|
| 83 |
-
have ht : Tendsto (id : ℝ → ℝ) (𝓝[<] 1) (𝓝[Icc (0 : ℝ) 1] 1) :=
|
| 84 |
-
tendsto_nhdsWithin_iff.mpr ⟨nhdsWithin_le_nhds,eventually_time_mem⟩
|
| 85 |
-
filter_upwards [hX.2] with ω hω
|
| 86 |
-
exact Tendsto.comp (hω.1 1 (by norm_num : (1 : ℝ)∈Icc (0 : ℝ) 1)) ht
|
| 87 |
-
|
| 88 |
-
lemma IsDiffusion.L2_terminal {W : BrownianSpace} {γ : OrderParameter}
|
| 89 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) :
|
| 90 |
-
Tendsto (fun t ↦ ∫ ω, (X t ω-X 1 ω)^2 ∂W.μ) (𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 91 |
-
let D (t : ℝ) (ω : W.Ω) := X t ω-W.B t.toNNReal ω
|
| 92 |
-
let G := ∫ s in (0 : ℝ)..1, γ.cutoff s
|
| 93 |
-
have hG : 0≤G := intervalIntegral.integral_nonneg_of_forall (by norm_num)
|
| 94 |
-
(fun s ↦ γ.cutoff_nonneg s)
|
| 95 |
-
have hD (t : ℝ) (ht : t∈Icc (0 : ℝ) 1) : MemLp (D t) 2 W.μ :=
|
| 96 |
-
(hX.memLp ht (by norm_num)).sub ((W.brownian.hasLaw_eval t.toNNReal).hasGaussianLaw.memLp_two)
|
| 97 |
-
have hD1 := hD 1 (by norm_num)
|
| 98 |
-
have hDb : ∀ᵐ ω ∂W.μ, ∀ t
|
| 99 |
-
have hDC : ∀ᵐ ω ∂W.μ, Tendsto (fun t ↦ D t ω) (𝓝[<] (1 : ℝ)) (𝓝 (D 1 ω)) := by
|
| 100 |
-
filter_upwards [hX.ae_tendsto,W.brownian.cont] with ω hω hBω
|
| 101 |
-
exact hω.sub ((hBω.comp continuous_real_toNNReal).continuousAt.tendsto.mono_left nhdsWithin_le_nhds)
|
| 102 |
-
have hDL : Tendsto (fun t ↦ ∫ ω, (D t ω-D 1 ω)^2 ∂W.μ)
|
| 103 |
-
(𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 104 |
-
have h := tendsto_integral_filter_of_dominated_convergence
|
| 105 |
-
(μ := W.μ) (l := 𝓝[<] (1 : ℝ)) (F := fun t ω ↦ (D t ω-D 1 ω)^2) (f := fun _ ↦ (0 : ℝ))
|
| 106 |
-
(fun _ ↦ 4*G^2) ?_ ?_ (integrable_const (4*G^2)) ?_
|
| 107 |
-
· simpa only [integral_zero] using h
|
| 108 |
-
· filter_upwards [eventually_time_mem] with t ht
|
| 109 |
-
exact ((hD t ht).sub hD1).aestronglyMeasurable.aemeasurable.pow_const 2 |>.aestronglyMeasurable
|
| 110 |
-
· filter_upwards [eventually_time_mem] with t ht
|
| 111 |
-
filter_upwards [hDb] with ω hω
|
| 112 |
-
rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)]
|
| 113 |
-
have h0 := abs_le.mp (hω t ht)
|
| 114 |
-
have h1 := abs_le.mp (hω 1 (by norm_num))
|
| 115 |
-
nlinarith [sq_nonneg (D t ω-D 1 ω), sq_nonneg (G-(D t ω-D 1 ω)/2),
|
| 116 |
-
sq_nonneg (G+(D t ω-D 1 ω)/2), mul_nonneg (show 0≤2*G-(D t ω-D 1 ω) by linarith)
|
| 117 |
-
(show 0≤2*G+(D t ω-D 1 ω) by linarith)]
|
| 118 |
-
· filter_upwards [hDC] with ω hω
|
| 119 |
-
simpa only [sub_self, zero_pow (by norm_num : (2 : ℕ)≠0)] using (hω.sub (tendsto_const_nhds (x := D 1 ω))).pow 2
|
| 120 |
-
have hb : ∀ t∈Icc (0 : ℝ) 1,
|
| 121 |
-
(∫ ω, (X t ω-X 1 ω)^2 ∂W.μ) ≤
|
| 122 |
-
2*(∫ ω, (D t ω-D 1 ω)^2 ∂W.μ)+2*(1-t) := by
|
| 123 |
-
intro t ht
|
| 124 |
-
have hxint := ((hX.memLp ht (by norm_num : (2 : ℝ≥0∞)≠∞)).sub
|
| 125 |
-
(hX.memLp (by norm_num : (1 : ℝ)∈Icc (0 : ℝ) 1) (by norm_num))).integrable_sq
|
| 126 |
-
have hdint : Integrable (fun ω ↦ (D t ω-D 1 ω)^2) W.μ := ((hD t ht).sub hD1).integrable_sq
|
| 127 |
-
have hbint := (brownian_increment_memLp W t).integrable_sq
|
| 128 |
-
calc
|
| 129 |
-
_ ≤ ∫ ω, 2*(D t ω-D 1 ω)^2+2*(W.B 1 ω-W.B t.toNNReal ω)^2 ∂W.μ := by
|
| 130 |
-
apply integral_mono hxint ((hdint.const_mul 2).add (hbint.const_mul 2))
|
| 131 |
-
intro ω
|
| 132 |
-
dsimp only [D,Pi.add_apply,Pi.sub_apply]
|
| 133 |
-
simp only [Real.toNNReal_one]
|
| 134 |
-
nlinarith [sq_nonneg (X t ω-W.B t.toNNReal ω-(X 1 ω-W.B 1 ω)+(W.B 1 ω-W.B t.toNNReal ω))]
|
| 135 |
-
_ = _ := by
|
| 136 |
-
rw [integral_add (hdint.const_mul 2) (hbint.const_mul 2), integral_const_mul,
|
| 137 |
-
integral_const_mul, brownian_increment_second W ht]
|
| 138 |
-
apply squeeze_zero' (Eventually.of_forall (fun t ↦ integral_nonneg (fun ω ↦ sq_nonneg _)))
|
| 139 |
-
(eventually_time_mem.mono (fun t ht ↦ hb t ht))
|
| 140 |
-
simpa only [sub_self, mul_zero, add_zero,id_eq] using
|
| 141 |
-
(hDL.const_mul 2).add (((tendsto_const_nhds (x := (1 : ℝ))).sub (tendsto_id.mono_left nhdsWithin_le_nhds : Tendsto (id : ℝ → ℝ) (𝓝[<] 1) (𝓝 1))).const_mul 2)
|
| 142 |
-
|
| 143 |
-
end SKValue
|
| 144 |
-
|
| 145 |
-
end
|
| 146 |
-
|
| 147 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Evolution.TerminalError
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 25 |
+
open scoped Topology NNReal ENNReal BigOperators
|
| 26 |
+
|
| 27 |
+
lemma IsDiffusion.measurable {W : BrownianSpace} {γ : OrderParameter}
|
| 28 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {t : ℝ} (ht : t∈Icc (0 : ℝ) 1) :
|
| 29 |
+
Measurable (X t) := by
|
| 30 |
+
simpa only [Real.coe_toNNReal t ht.1, min_eq_left ht.2] using
|
| 31 |
+
(hX.1 t.toNNReal).mono (W.filtration.le t.toNNReal) le_rfl
|
| 32 |
+
|
| 33 |
+
lemma drift_integral_bound (W : BrownianSpace) (γ : OrderParameter) {t : ℝ}
|
| 34 |
+
(ht : t∈Icc (0 : ℝ) 1) (x : ℝ → ℝ) :
|
| 35 |
+
|∫ s in (0 : ℝ)..t, γ.coeff s*gradient W γ s (x s)|≤∫ s in (0 : ℝ)..1, γ.cutoff s := by
|
| 36 |
+
have he : (∫ s in (0 : ℝ)..t, γ.coeff s*gradient W γ s (x s)) =
|
| 37 |
+
∫ s in (0 : ℝ)..t, γ.cutoff s*gradient W γ s (x s) := by
|
| 38 |
+
apply intervalIntegral.integral_congr_Ioo_of_le ht.1
|
| 39 |
+
intro s hs
|
| 40 |
+
change γ.coeff s*gradient W γ s (x s)=γ.cutoff s*gradient W γ s (x s)
|
| 41 |
+
have hs' : s∈Ico (0 : ℝ) 1 := ⟨hs.1.le,hs.2.trans_le ht.2⟩
|
| 42 |
+
rw [OrderParameter.cutoff, Set.indicator_of_mem hs']
|
| 43 |
+
rw [he]
|
| 44 |
+
have hb := intervalIntegral.norm_integral_le_of_norm_le ht.1
|
| 45 |
+
(f := fun s ↦ γ.cutoff s*gradient W γ s (x s))
|
| 46 |
+
(Eventually.of_forall (fun s hs ↦ by
|
| 47 |
+
rw [Real.norm_eq_abs,abs_mul,abs_of_nonneg (γ.cutoff_nonneg s)]
|
| 48 |
+
exact (mul_le_mul_of_nonneg_left (gradient_bound W γ ⟨hs.1.le,hs.2.trans ht.2⟩ (x s))
|
| 49 |
+
(γ.cutoff_nonneg s)).trans_eq (mul_one _)))
|
| 50 |
+
(γ.cutoff_integrable.intervalIntegrable (a := 0) (b := t))
|
| 51 |
+
have hm := intervalIntegral.integral_mono_interval (c := (0 : ℝ)) (d := 1) le_rfl ht.1 ht.2
|
| 52 |
+
(Eventually.of_forall (fun s ↦ γ.cutoff_nonneg s)) γ.cutoff_integrable.intervalIntegrable
|
| 53 |
+
rw [Real.norm_eq_abs] at hb
|
| 54 |
+
exact hb.trans hm
|
| 55 |
+
|
| 56 |
+
lemma IsDiffusion.drift_bound {W : BrownianSpace} {γ : OrderParameter}
|
| 57 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) :
|
| 58 |
+
∀ᵐ ω ∂W.μ, ∀ t∈Icc (0 : ℝ) 1,
|
| 59 |
+
|X t ω-W.B t.toNNReal ω|≤∫ s in (0 : ℝ)..1, γ.cutoff s := by
|
| 60 |
+
filter_upwards [hX.2] with ω hω t ht
|
| 61 |
+
rw [hω.2 t ht, add_sub_cancel_left]
|
| 62 |
+
exact drift_integral_bound W γ ht (fun s ↦ X s ω)
|
| 63 |
+
|
| 64 |
+
lemma IsDiffusion.memLp {W : BrownianSpace} {γ : OrderParameter}
|
| 65 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {t : ℝ} (ht : t∈Icc (0 : ℝ) 1)
|
| 66 |
+
{p : ℝ≥0∞} (hp : p≠∞) : MemLp (X t) p W.μ := by
|
| 67 |
+
have hd : MemLp (fun ω ↦ X t ω-W.B t.toNNReal ω) p W.μ :=
|
| 68 |
+
MemLp.of_bound ((hX.measurable ht).sub (W.measurable _).measurable).aestronglyMeasurable
|
| 69 |
+
(∫ s in (0 : ℝ)..1, γ.cutoff s) (hX.drift_bound.mono (fun ω hω ↦ by
|
| 70 |
+
simpa only [Real.norm_eq_abs] using hω t ht))
|
| 71 |
+
have hb := (W.brownian.hasLaw_eval t.toNNReal).hasGaussianLaw.memLp hp
|
| 72 |
+
convert hd.add hb using 1
|
| 73 |
+
funext ω
|
| 74 |
+
simp only [Pi.add_apply, sub_add_cancel]
|
| 75 |
+
|
| 76 |
+
lemma eventually_time_mem : ∀ᶠ t : ℝ in 𝓝[<] 1, t∈Icc (0 : ℝ) 1 := by
|
| 77 |
+
filter_upwards [Ico_mem_nhdsLT (by norm_num : (0 : ℝ)<1)] with t ht
|
| 78 |
+
exact ⟨ht.1,ht.2.le⟩
|
| 79 |
+
|
| 80 |
+
lemma IsDiffusion.ae_tendsto {W : BrownianSpace} {γ : OrderParameter}
|
| 81 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) :
|
| 82 |
+
∀ᵐ ω ∂W.μ, Tendsto (fun t ↦ X t ω) (𝓝[<] (1 : ℝ)) (𝓝 (X 1 ω)) := by
|
| 83 |
+
have ht : Tendsto (id : ℝ → ℝ) (𝓝[<] 1) (𝓝[Icc (0 : ℝ) 1] 1) :=
|
| 84 |
+
tendsto_nhdsWithin_iff.mpr ⟨nhdsWithin_le_nhds,eventually_time_mem⟩
|
| 85 |
+
filter_upwards [hX.2] with ω hω
|
| 86 |
+
exact Tendsto.comp (hω.1 1 (by norm_num : (1 : ℝ)∈Icc (0 : ℝ) 1)) ht
|
| 87 |
+
|
| 88 |
+
lemma IsDiffusion.L2_terminal {W : BrownianSpace} {γ : OrderParameter}
|
| 89 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) :
|
| 90 |
+
Tendsto (fun t ↦ ∫ ω, (X t ω-X 1 ω)^2 ∂W.μ) (𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 91 |
+
let D (t : ℝ) (ω : W.Ω) := X t ω-W.B t.toNNReal ω
|
| 92 |
+
let G := ∫ s in (0 : ℝ)..1, γ.cutoff s
|
| 93 |
+
have hG : 0≤G := intervalIntegral.integral_nonneg_of_forall (by norm_num)
|
| 94 |
+
(fun s ↦ γ.cutoff_nonneg s)
|
| 95 |
+
have hD (t : ℝ) (ht : t∈Icc (0 : ℝ) 1) : MemLp (D t) 2 W.μ :=
|
| 96 |
+
(hX.memLp ht (by norm_num)).sub ((W.brownian.hasLaw_eval t.toNNReal).hasGaussianLaw.memLp_two)
|
| 97 |
+
have hD1 := hD 1 (by norm_num)
|
| 98 |
+
have hDb : ∀ᵐ ω ∂W.μ, ∀ t∈Icc (0 : ℝ) 1, |D t ω|≤G := hX.drift_bound
|
| 99 |
+
have hDC : ∀ᵐ ω ∂W.μ, Tendsto (fun t ↦ D t ω) (𝓝[<] (1 : ℝ)) (𝓝 (D 1 ω)) := by
|
| 100 |
+
filter_upwards [hX.ae_tendsto,W.brownian.cont] with ω hω hBω
|
| 101 |
+
exact hω.sub ((hBω.comp continuous_real_toNNReal).continuousAt.tendsto.mono_left nhdsWithin_le_nhds)
|
| 102 |
+
have hDL : Tendsto (fun t ↦ ∫ ω, (D t ω-D 1 ω)^2 ∂W.μ)
|
| 103 |
+
(𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 104 |
+
have h := tendsto_integral_filter_of_dominated_convergence
|
| 105 |
+
(μ := W.μ) (l := 𝓝[<] (1 : ℝ)) (F := fun t ω ↦ (D t ω-D 1 ω)^2) (f := fun _ ↦ (0 : ℝ))
|
| 106 |
+
(fun _ ↦ 4*G^2) ?_ ?_ (integrable_const (4*G^2)) ?_
|
| 107 |
+
· simpa only [integral_zero] using h
|
| 108 |
+
· filter_upwards [eventually_time_mem] with t ht
|
| 109 |
+
exact ((hD t ht).sub hD1).aestronglyMeasurable.aemeasurable.pow_const 2 |>.aestronglyMeasurable
|
| 110 |
+
· filter_upwards [eventually_time_mem] with t ht
|
| 111 |
+
filter_upwards [hDb] with ω hω
|
| 112 |
+
rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)]
|
| 113 |
+
have h0 := abs_le.mp (hω t ht)
|
| 114 |
+
have h1 := abs_le.mp (hω 1 (by norm_num))
|
| 115 |
+
nlinarith [sq_nonneg (D t ω-D 1 ω), sq_nonneg (G-(D t ω-D 1 ω)/2),
|
| 116 |
+
sq_nonneg (G+(D t ω-D 1 ω)/2), mul_nonneg (show 0≤2*G-(D t ω-D 1 ω) by linarith)
|
| 117 |
+
(show 0≤2*G+(D t ω-D 1 ω) by linarith)]
|
| 118 |
+
· filter_upwards [hDC] with ω hω
|
| 119 |
+
simpa only [sub_self, zero_pow (by norm_num : (2 : ℕ)≠0)] using (hω.sub (tendsto_const_nhds (x := D 1 ω))).pow 2
|
| 120 |
+
have hb : ∀ t∈Icc (0 : ℝ) 1,
|
| 121 |
+
(∫ ω, (X t ω-X 1 ω)^2 ∂W.μ) ≤
|
| 122 |
+
2*(∫ ω, (D t ω-D 1 ω)^2 ∂W.μ)+2*(1-t) := by
|
| 123 |
+
intro t ht
|
| 124 |
+
have hxint := ((hX.memLp ht (by norm_num : (2 : ℝ≥0∞)≠∞)).sub
|
| 125 |
+
(hX.memLp (by norm_num : (1 : ℝ)∈Icc (0 : ℝ) 1) (by norm_num))).integrable_sq
|
| 126 |
+
have hdint : Integrable (fun ω ↦ (D t ω-D 1 ω)^2) W.μ := ((hD t ht).sub hD1).integrable_sq
|
| 127 |
+
have hbint := (brownian_increment_memLp W t).integrable_sq
|
| 128 |
+
calc
|
| 129 |
+
_ ≤ ∫ ω, 2*(D t ω-D 1 ω)^2+2*(W.B 1 ω-W.B t.toNNReal ω)^2 ∂W.μ := by
|
| 130 |
+
apply integral_mono hxint ((hdint.const_mul 2).add (hbint.const_mul 2))
|
| 131 |
+
intro ω
|
| 132 |
+
dsimp only [D,Pi.add_apply,Pi.sub_apply]
|
| 133 |
+
simp only [Real.toNNReal_one]
|
| 134 |
+
nlinarith [sq_nonneg (X t ω-W.B t.toNNReal ω-(X 1 ω-W.B 1 ω)+(W.B 1 ω-W.B t.toNNReal ω))]
|
| 135 |
+
_ = _ := by
|
| 136 |
+
rw [integral_add (hdint.const_mul 2) (hbint.const_mul 2), integral_const_mul,
|
| 137 |
+
integral_const_mul, brownian_increment_second W ht]
|
| 138 |
+
apply squeeze_zero' (Eventually.of_forall (fun t ↦ integral_nonneg (fun ω ↦ sq_nonneg _)))
|
| 139 |
+
(eventually_time_mem.mono (fun t ht ↦ hb t ht))
|
| 140 |
+
simpa only [sub_self, mul_zero, add_zero,id_eq] using
|
| 141 |
+
(hDL.const_mul 2).add (((tendsto_const_nhds (x := (1 : ℝ))).sub (tendsto_id.mono_left nhdsWithin_le_nhds : Tendsto (id : ℝ → ℝ) (𝓝[<] 1) (𝓝 1))).const_mul 2)
|
| 142 |
+
|
| 143 |
+
end SKValue
|
| 144 |
+
|
| 145 |
+
end
|
| 146 |
+
|
| 147 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/MeshBrownian.lean
CHANGED
|
@@ -1,343 +1,343 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Evolution.MeanDerivativeContinuous
|
| 3 |
-
import OAI.Probability.SKValue.Equations.RawIncrement
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
open MeasureTheory ProbabilityTheory Set
|
| 9 |
-
open scoped ENNReal NNReal BigOperators
|
| 10 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
-
open scoped BigOperators Topology
|
| 12 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
-
open scoped Topology BigOperators
|
| 14 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 15 |
-
open scoped Topology ENNReal NNReal
|
| 16 |
-
open Filter Set
|
| 17 |
-
open scoped Topology BigOperators
|
| 18 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 19 |
-
open scoped Topology
|
| 20 |
-
open MeasureTheory Set Filter
|
| 21 |
-
open scoped Topology BigOperators
|
| 22 |
-
open MeasureTheory Set Filter Finset
|
| 23 |
-
open scoped Topology BigOperators
|
| 24 |
-
namespace SKValue
|
| 25 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 26 |
-
open scoped Topology BigOperators
|
| 27 |
-
|
| 28 |
-
lemma coupled_terminal_second_moment_bound {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 29 |
-
[IsProbabilityMeasure μ] {B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 30 |
-
{X : ℝ → Ω → ℝ} {T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 31 |
-
(hT : 0<T) (h : GradientStrip T γ u K L) (hLu : 0≤Lu)
|
| 32 |
-
(huLip : ∀ x y, |u T x-u T y|≤Lu*|x-y|)
|
| 33 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 34 |
-
(hpaths : ∀ᵐ ω ∂μ,
|
| 35 |
-
(∀ t∈Icc (0 : ℝ) T, X t ω=B (Real.toNNReal t) ω+
|
| 36 |
-
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0)
|
| 37 |
-
{N : ℕ} (hN : 0<N) :
|
| 38 |
-
|(∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))-
|
| 39 |
-
(∫ ω, (u T (X T ω))^2 ∂μ)| ≤
|
| 40 |
-
(2*Lu)*Real.sqrt (∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ) := by
|
| 41 |
-
let F (ω : Ω) := u T (coupledEuler T γ u B N N ω)
|
| 42 |
-
let G (ω : Ω) := u T (X T ω)
|
| 43 |
-
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 44 |
-
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 45 |
-
have hd := (h.smooth T ht).continuous
|
| 46 |
-
have hFM : MemLp F 2 μ := MemLp.of_bound
|
| 47 |
-
(hd.measurable.comp_aemeasurable (coupled_euler_measurable hB hT h N N le_rfl).aemeasurable).aestronglyMeasurable 1
|
| 48 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs, F] using h.bounded T ht _))
|
| 49 |
-
have hGM : MemLp G 2 μ := MemLp.of_bound
|
| 50 |
-
(hd.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable 1
|
| 51 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs, G] using h.bounded T ht _))
|
| 52 |
-
have hEM : MemLp E 2 μ := coupled_mesh_error_memLp hB hT h hXM hpaths hN
|
| 53 |
-
have hlast : meshTime T N N = T := by dsimp [meshTime, stepSize]; field_simp
|
| 54 |
-
have hFG (ω : Ω) : |F ω-G ω|≤Lu*|E ω| := by
|
| 55 |
-
have he : |coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 56 |
-
change |coupledEuler T γ u B N N ω-X T ω| ≤ initialMax _ N
|
| 57 |
-
have hm := le_initialMax (f := fun k ↦ |coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 58 |
-
change |coupledEuler T γ u B N N ω-X (meshTime T N N) ω| ≤ initialMax _ N at hm
|
| 59 |
-
rw [hlast] at hm
|
| 60 |
-
exact hm
|
| 61 |
-
|
| 62 |
-
exact (huLip _ _).trans (mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) hLu)
|
| 63 |
-
have hlaw := coupledCoordinates_hasLaw hB hT hN
|
| 64 |
-
have heq : (∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))=∫ ω, (F ω)^2 ∂μ := by
|
| 65 |
-
rw [←hlaw.integral_comp ((mesh_terminal_measurable hT.le h hN).pow_const 2).aestronglyMeasurable]
|
| 66 |
-
simp only [Function.comp_apply, F, meshTerminal, coupledEuler, ite_eq_right (Nat.ne_of_gt hN)]
|
| 67 |
-
rw [heq]
|
| 68 |
-
simpa only [mul_one] using second_moment_perturbation hFM hGM hEM (by norm_num : (0 : ℝ)≤1) hLu
|
| 69 |
-
(Eventually.of_forall (fun ω ↦ ⟨h.bounded T ht _, h.bounded T ht _, hFG ω⟩))
|
| 70 |
-
|
| 71 |
-
theorem diffusion_gradient_isometry
|
| 72 |
-
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 73 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 74 |
-
{X : ℝ → Ω → ℝ} {T K L D Lu La : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 75 |
-
(hT : 0<T) (hT1 : T≤1) (h : GradientStrip T γ u K L)
|
| 76 |
-
(hD0 : 0≤D) (hLu : 0≤Lu) (hLa : 0≤La)
|
| 77 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 78 |
-
(huLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 79 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 80 |
-
(haLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 81 |
-
|deriv (u s) x-deriv (u t) y|≤La*(|s-t|+|x-y|))
|
| 82 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 83 |
-
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 :
|
| 84 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 85 |
-
(∀ t∈Icc (0 : ℝ) T, X t ω = B (Real.toNNReal t) ω+
|
| 86 |
-
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 87 |
-
(∫ ω, (u T (X T ω))^2 ∂μ) =
|
| 88 |
-
∫ t in (0 : ℝ)..T, ∫ ω, (deriv (u t) (X t ω))^2 ∂μ := by
|
| 89 |
-
let E (N : ℕ) := ∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ
|
| 90 |
-
have hE : Tendsto E atTop (𝓝 0) := coupled_euler_L2_convergence hB hT h hLu huLip hXM hpaths
|
| 91 |
-
have hEs : Tendsto (fun N ↦ Real.sqrt (E N)) atTop (𝓝 0) := by
|
| 92 |
-
simpa only [Real.sqrt_zero, Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp hE
|
| 93 |
-
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 94 |
-
have hmoment : Tendsto (fun N ↦ ∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))
|
| 95 |
-
atTop (𝓝 (∫ ω, (u T (X T ω))^2 ∂μ)) := by
|
| 96 |
-
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 97 |
-
apply squeeze_zero' (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_
|
| 98 |
-
(by simpa only [mul_zero] using hEs.const_mul (2*Lu))
|
| 99 |
-
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 100 |
-
rw [Real.norm_eq_abs]
|
| 101 |
-
exact coupled_terminal_second_moment_bound hB hT h hLu
|
| 102 |
-
(fun x y ↦ by simpa only [sub_self, abs_zero, zero_add] using huLip T ht T ht x y)
|
| 103 |
-
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN
|
| 104 |
-
have hmean := mean_derivative_square_continuous hD0 hLa
|
| 105 |
-
(fun t ht ↦ (h.smooth t ht).continuous_deriv (by norm_num)) hD haLip hXM
|
| 106 |
-
(hpaths.mono (fun _ hω ↦ hω.1))
|
| 107 |
-
have hquadrature : Tendsto (fun N ↦ stepSize T N * ∑ i : Fin N,
|
| 108 |
-
∫ z, (meshRaw T N γ u i z)^2 ∂gaussianProduct (Fin (N+1))) atTop
|
| 109 |
-
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, (deriv (u t) (X t ω))^2 ∂μ)) := by
|
| 110 |
-
apply perturbed_grid_riemann_tendsto (r := fun N ↦ (2*D*La)*Real.sqrt (E N)) hT hmean
|
| 111 |
-
(by simpa only [mul_zero] using hEs.const_mul (2*D*La))
|
| 112 |
-
filter_upwards [eventually_gt_atTop 0] with N hN i
|
| 113 |
-
exact (coupled_mesh_general_moment_bounds hB hT h hD0 hLa hD
|
| 114 |
-
(fun t ht x y ↦ by simpa only [sub_self, abs_zero, zero_add] using haLip t ht t ht x y)
|
| 115 |
-
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN i).1
|
| 116 |
-
have herror : Tendsto (fun N ↦
|
| 117 |
-
(∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))-
|
| 118 |
-
stepSize T N * ∑ i : Fin N, ∫ z, (meshRaw T N γ u i z)^2 ∂gaussianProduct (Fin (N+1)))
|
| 119 |
-
atTop (𝓝 0) := by
|
| 120 |
-
apply squeeze_zero_norm' (a := fun N ↦
|
| 121 |
-
Real.sqrt (gradientMeshError T N γ u) * Real.sqrt (2*(1+T*D^2)))
|
| 122 |
-
· filter_upwards [eventually_gt_atTop 0] with N hN
|
| 123 |
-
rw [Real.norm_eq_abs]
|
| 124 |
-
exact mesh_terminal_stochastic_second_moment_error hT h hD0 hD hN
|
| 125 |
-
· simpa only [Real.sqrt_zero, zero_mul, Function.comp_def] using
|
| 126 |
-
((Real.continuous_sqrt.tendsto 0).comp (gradientMeshError_tendsto_zero hT hT1 h)).mul_const
|
| 127 |
-
(Real.sqrt (2*(1+T*D^2)))
|
| 128 |
-
have hlimit := herror.add hquadrature
|
| 129 |
-
simp only [sub_add_cancel, zero_add] at hlimit
|
| 130 |
-
exact tendsto_nhds_unique hmoment hlimit
|
| 131 |
-
|
| 132 |
-
lemma weighted_first_moment_perturbation {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 133 |
-
{f g e b : Ω → ℝ} {L : ℝ} (hf : MemLp f 2 μ) (hg : MemLp g 2 μ)
|
| 134 |
-
(he : MemLp e 2 μ) (hb : MemLp b 2 μ) (hL : 0≤L)
|
| 135 |
-
(hfg : ∀ᵐ ω ∂μ, |f ω-g ω|≤L*|e ω|) :
|
| 136 |
-
|(∫ ω, f ω*b ω ∂μ)-(∫ ω, g ω*b ω ∂μ)| ≤
|
| 137 |
-
L*Real.sqrt (∫ ω, (e ω)^2 ∂μ)*Real.sqrt (∫ ω, (b ω)^2 ∂μ) := by
|
| 138 |
-
rw [←integral_sub (f := fun ω ↦ f ω*b ω) (g := fun ω ↦ g ω*b ω) (hf.integrable_mul hb) (hg.integrable_mul hb)]
|
| 139 |
-
have heq : (fun ω ↦ f ω*b ω-g ω*b ω)=(fun ω ↦ (f ω-g ω)*b ω) := by funext ω; ring
|
| 140 |
-
rw [heq]
|
| 141 |
-
calc
|
| 142 |
-
_ ≤ ∫ ω, |(f ω-g ω)*b ω| ∂μ := abs_integral_le_integral_abs
|
| 143 |
-
_ ≤ ∫ ω, L*(|e ω| * |b ω|) ∂μ := by
|
| 144 |
-
apply integral_mono_ae ((hf.sub hg).integrable_mul hb).abs ((he.abs.integrable_mul hb.abs).const_mul L)
|
| 145 |
-
filter_upwards [hfg] with ω hω
|
| 146 |
-
change |(f ω-g ω)*b ω| ≤ L*(|e ω| * |b ω|)
|
| 147 |
-
rw [abs_mul]
|
| 148 |
-
exact (mul_le_mul_of_nonneg_right hω (abs_nonneg _)).trans_eq (mul_assoc _ _ _)
|
| 149 |
-
_ = L*(∫ ω, |e ω| * |b ω| ∂μ) := integral_const_mul _ _
|
| 150 |
-
_ ≤ L*(Real.sqrt (∫ ω, (e ω)^2 ∂μ)*Real.sqrt (∫ ω, (b ω)^2 ∂μ)) := by
|
| 151 |
-
have hcs := integral_product_CS he.abs hb.abs
|
| 152 |
-
change |∫ ω, |e ω| * |b ω| ∂μ|≤Real.sqrt (∫ ω, |e ω|^2 ∂μ)*Real.sqrt (∫ ω, |b ω|^2 ∂μ) at hcs
|
| 153 |
-
simp only [sq_abs] at hcs
|
| 154 |
-
exact mul_le_mul_of_nonneg_left ((le_abs_self _).trans hcs) hL
|
| 155 |
-
_ = _ := by ring
|
| 156 |
-
|
| 157 |
-
lemma brownian_eval_second_moment {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 158 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ) (t : ℝ≥0) :
|
| 159 |
-
(∫ ω, (B t ω)^2 ∂μ)=(t : ℝ) := by
|
| 160 |
-
have hv := (hB.hasLaw_eval t).variance_eq
|
| 161 |
-
rw [variance_eq_integral (hB.aemeasurable t), hB.integral_eval t] at hv
|
| 162 |
-
simpa using hv
|
| 163 |
-
|
| 164 |
-
noncomputable def meshBrownian (T : ℝ) (N : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 165 |
-
∑ j : Fin N, Real.sqrt (stepSize T N)*coordinate N j z
|
| 166 |
-
|
| 167 |
-
lemma meshBrownian_measurable (T : ℝ) (N : ℕ) : Measurable (meshBrownian T N) := by
|
| 168 |
-
apply Finset.measurable_sum
|
| 169 |
-
intro i _
|
| 170 |
-
exact measurable_const.mul (measurable_coordinate N i)
|
| 171 |
-
|
| 172 |
-
lemma meshBrownian_memLp (T : ℝ) (N : ℕ) :
|
| 173 |
-
MemLp (meshBrownian T N) 2 (gaussianProduct (Fin (N+1))) := by
|
| 174 |
-
convert memLp_finsetSum' Finset.univ (fun i : Fin N ↦ fun _ ↦
|
| 175 |
-
(gaussian_memLp (coordinate_hasLaw N i) 2 (by norm_num)).const_mul (Real.sqrt (stepSize T N))) using 1
|
| 176 |
-
funext z
|
| 177 |
-
simp only [meshBrownian, Finset.sum_apply]
|
| 178 |
-
|
| 179 |
-
lemma coupled_meshBrownian {Ω : Type*} (B : ℝ≥0 → Ω → ℝ) {T : ℝ} (hT : 0<T)
|
| 180 |
-
{N : ℕ} (hN : 0<N) (ω : Ω) :
|
| 181 |
-
meshBrownian T N (coupledCoordinates T N B ω)=B (Real.toNNReal T) ω-B 0 ω := by
|
| 182 |
-
have hlast : (N : ℝ)*(T/N)=T := by field_simp
|
| 183 |
-
unfold meshBrownian
|
| 184 |
-
have heq (j : Fin N) := coupled_coordinate_exact B hT hN (show (j : ℕ)<N+1 by omega) ω
|
| 185 |
-
simp_rw [stepSize, heq]
|
| 186 |
-
rw [Fin.sum_univ_eq_sum_range (fun j ↦ B (Real.toNNReal (((j+1 : ℕ) : ℝ)*(T/N))) ω-
|
| 187 |
-
B (Real.toNNReal ((j : ℝ)*(T/N))) ω), Finset.sum_range_sub (fun j : ℕ ↦ B (Real.toNNReal ((j : ℝ)*(T/N))) ω) N]
|
| 188 |
-
simp only [Nat.cast_zero, zero_mul, Real.toNNReal_zero, hlast]
|
| 189 |
-
|
| 190 |
-
lemma meshBrownian_second_moment {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 191 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ) {T : ℝ} (hT : 0<T)
|
| 192 |
-
{N : ℕ} (hN : 0<N) :
|
| 193 |
-
(∫ z, (meshBrownian T N z)^2 ∂gaussianProduct (Fin (N+1)))=T := by
|
| 194 |
-
rw [←(coupledCoordinates_hasLaw hB hT hN).integral_comp
|
| 195 |
-
((meshBrownian_measurable T N).pow_const 2).aestronglyMeasurable]
|
| 196 |
-
have heq : (fun ω ↦ (meshBrownian T N (coupledCoordinates T N B ω))^2)=ᵐ[μ]
|
| 197 |
-
(fun ω ↦ (B (Real.toNNReal T) ω)^2) := by
|
| 198 |
-
filter_upwards [hB.eval_zero_ae_eq_zero] with ω hω
|
| 199 |
-
simp only [coupled_meshBrownian B hT hN ω, hω, sub_zero]
|
| 200 |
-
exact (integral_congr_ae heq).trans ((brownian_eval_second_moment hB _).trans
|
| 201 |
-
(Real.coe_toNNReal _ hT.le))
|
| 202 |
-
|
| 203 |
-
lemma mesh_terminal_brownian_error {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 204 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 205 |
-
{T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 206 |
-
(hT : 0<T) (h : GradientStrip T γ u K L)
|
| 207 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D) {N : ℕ} (hN : 0<N) :
|
| 208 |
-
|(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 209 |
-
stepSize T N * ∑ i : Fin N, ∫ z, meshRaw T N γ u i z ∂gaussianProduct (Fin (N+1))| ≤
|
| 210 |
-
Real.sqrt (gradientMeshError T N γ u)*Real.sqrt T := by
|
| 211 |
-
have hm (i : Fin N) := mesh_raw_measurable hT.le h hN i.isLt.le
|
| 212 |
-
have hp (i : Fin N) := mesh_raw_depends T i.isLt.le γ u
|
| 213 |
-
have hH (i : Fin N) := mesh_raw_memLp hT.le h hD hN i.isLt.le
|
| 214 |
-
have hu := mesh_terminal_memLp hT.le h hN
|
| 215 |
-
have hr := finiteRaw_memLp (δ := stepSize T N) hm hp hH
|
| 216 |
-
have hb := meshBrownian_memLp T N
|
| 217 |
-
rw [←finiteRaw_brownian_covariance (δ := stepSize T N) (div_nonneg hT.le (Nat.cast_nonneg N)) hm hp hH]
|
| 218 |
-
change |(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 219 |
-
(∫ z, finiteRawMartingale (stepSize T N) (fun i : Fin N ↦ meshRaw T N γ u i) z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))|≤_
|
| 220 |
-
rw [←integral_sub (f := fun z ↦ meshTerminal T N γ u z * meshBrownian T N z)
|
| 221 |
-
(g := fun z ↦ finiteRawMartingale (stepSize T N) (fun i : Fin N ↦ meshRaw T N γ u i) z * meshBrownian T N z)
|
| 222 |
-
(hu.integrable_mul hb) (hr.integrable_mul hb)]
|
| 223 |
-
simp_rw [←sub_mul]
|
| 224 |
-
have hcs := integral_product_CS (hu.sub hr) hb
|
| 225 |
-
rw [meshBrownian_second_moment hB hT hN] at hcs
|
| 226 |
-
exact hcs
|
| 227 |
-
|
| 228 |
-
lemma coupled_terminal_brownian_error {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 229 |
-
[IsProbabilityMeasure μ] {B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 230 |
-
{X : ℝ → Ω → ℝ} {T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 231 |
-
(hT : 0<T) (h : GradientStrip T γ u K L) (hLu : 0≤Lu)
|
| 232 |
-
(huLip : ∀ x y, |u T x-u T y|≤Lu*|x-y|)
|
| 233 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 234 |
-
(hpaths : ∀ᵐ ω ∂μ,
|
| 235 |
-
(∀ t∈Icc (0 : ℝ) T, X t ω=B (Real.toNNReal t) ω+
|
| 236 |
-
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0)
|
| 237 |
-
{N : ℕ} (hN : 0<N) :
|
| 238 |
-
|(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 239 |
-
(∫ ω, u T (X T ω)*B (Real.toNNReal T) ω ∂μ)| ≤
|
| 240 |
-
Lu*Real.sqrt (∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)*Real.sqrt T := by
|
| 241 |
-
let F (ω : Ω) := u T (coupledEuler T γ u B N N ω)
|
| 242 |
-
let G (ω : Ω) := u T (X T ω)
|
| 243 |
-
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 244 |
-
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 245 |
-
have hd := (h.smooth T ht).continuous
|
| 246 |
-
have hFM : MemLp F 2 μ := MemLp.of_bound
|
| 247 |
-
(hd.measurable.comp_aemeasurable (coupled_euler_measurable hB hT h N N le_rfl).aemeasurable).aestronglyMeasurable 1
|
| 248 |
-
(Eventually.of_forall (fun
|
| 249 |
-
have hGM : MemLp G 2 μ := MemLp.of_bound
|
| 250 |
-
(hd.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable 1
|
| 251 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs, G] using h.bounded T ht _))
|
| 252 |
-
have hEM : MemLp E 2 μ := coupled_mesh_error_memLp hB hT h hXM hpaths hN
|
| 253 |
-
have hlast : meshTime T N N = T := by dsimp [meshTime, stepSize]; field_simp
|
| 254 |
-
have hFG (ω : Ω) : |F ω-G ω|≤Lu*|E ω| := by
|
| 255 |
-
have he : |coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 256 |
-
change |coupledEuler T γ u B N N ω-X T ω| ≤ initialMax _ N
|
| 257 |
-
have hm := le_initialMax (f := fun k ↦ |coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 258 |
-
rw [hlast] at hm
|
| 259 |
-
exact hm
|
| 260 |
-
exact (huLip _ _).trans (mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) hLu)
|
| 261 |
-
have hlaw := coupledCoordinates_hasLaw hB hT hN
|
| 262 |
-
have heq : (∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))=
|
| 263 |
-
∫ ω, F ω*B (Real.toNNReal T) ω ∂μ := by
|
| 264 |
-
have hm : AEStronglyMeasurable (fun z ↦ meshTerminal T N γ u z * meshBrownian T N z) (gaussianProduct (Fin (N+1))) :=
|
| 265 |
-
((mesh_terminal_measurable hT.le h hN).mul (meshBrownian_measurable T N)).aestronglyMeasurable
|
| 266 |
-
rw [←hlaw.integral_comp hm]
|
| 267 |
-
apply integral_congr_ae
|
| 268 |
-
filter_upwards [hB.eval_zero_ae_eq_zero] with ω hω
|
| 269 |
-
simp only [Function.comp_apply, F, meshTerminal, coupledEuler, ite_eq_right (Nat.ne_of_gt hN),
|
| 270 |
-
coupled_meshBrownian B hT hN ω, hω, sub_zero]
|
| 271 |
-
rw [heq]
|
| 272 |
-
have hh := weighted_first_moment_perturbation hFM hGM hEM (hB.hasLaw_eval T.toNNReal).hasGaussianLaw.memLp_two hLu
|
| 273 |
-
(Eventually.of_forall hFG)
|
| 274 |
-
rw [brownian_eval_second_moment hB,Real.coe_toNNReal _ hT.le] at hh
|
| 275 |
-
exact hh
|
| 276 |
-
|
| 277 |
-
theorem diffusion_gradient_brownian_covariance
|
| 278 |
-
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 279 |
-
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 280 |
-
{X : ℝ → Ω → ℝ} {T K L D Lu La : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 281 |
-
(hT : 0<T) (hT1 : T≤1) (h : GradientStrip T γ u K L)
|
| 282 |
-
(hD0 : 0≤D) (hLu : 0≤Lu) (hLa : 0≤La)
|
| 283 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 284 |
-
(huLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 285 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 286 |
-
(haLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 287 |
-
|deriv (u s) x-deriv (u t) y|≤La*(|s-t|+|x-y|))
|
| 288 |
-
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 289 |
-
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 290 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 291 |
-
(∀ t∈Icc (0 : ℝ) T, X t ω = B (Real.toNNReal t) ω+
|
| 292 |
-
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 293 |
-
(∫ ω, u T (X T ω)*B (Real.toNNReal T) ω ∂μ) =
|
| 294 |
-
∫ t in (0 : ℝ)..T, ∫ ω, deriv (u t) (X t ω) ∂μ := by
|
| 295 |
-
let E (N : ℕ) := ∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ
|
| 296 |
-
have hE : Tendsto E atTop (𝓝 0) := coupled_euler_L2_convergence hB hT h hLu huLip hXM hpaths
|
| 297 |
-
have hEs : Tendsto (fun N ↦ Real.sqrt (E N)) atTop (𝓝 0) := by
|
| 298 |
-
simpa only [Real.sqrt_zero, Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp hE
|
| 299 |
-
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 300 |
-
have hcovariance : Tendsto (fun N ↦ ∫ z, meshTerminal T N γ u z * meshBrownian T N z
|
| 301 |
-
∂gaussianProduct (Fin (N+1))) atTop
|
| 302 |
-
(𝓝 (∫ ω, u T (X T ω)*B T.toNNReal ω ∂μ)) := by
|
| 303 |
-
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 304 |
-
apply squeeze_zero' (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_
|
| 305 |
-
(by simpa only [mul_zero, zero_mul] using (hEs.const_mul Lu).mul_const (Real.sqrt T))
|
| 306 |
-
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 307 |
-
rw [Real.norm_eq_abs]
|
| 308 |
-
exact coupled_terminal_brownian_error hB hT h hLu
|
| 309 |
-
(fun x y ↦ by simpa only [sub_self, abs_zero, zero_add] using huLip T ht T ht x y)
|
| 310 |
-
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN
|
| 311 |
-
have hmean := mean_derivative_continuous hLa
|
| 312 |
-
(fun t ht ↦ (h.smooth t ht).continuous_deriv (by norm_num)) hD haLip hXM
|
| 313 |
-
(hpaths.mono (fun _ hω ↦ hω.1))
|
| 314 |
-
have hquadrature : Tendsto (fun N ↦ stepSize T N * ∑ i : Fin N,
|
| 315 |
-
∫ z, meshRaw T N γ u i z ∂gaussianProduct (Fin (N+1))) atTop
|
| 316 |
-
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, deriv (u t) (X t ω) ∂μ)) := by
|
| 317 |
-
apply perturbed_grid_riemann_tendsto (r := fun N ↦ La*Real.sqrt (E N)) hT hmean
|
| 318 |
-
(by simpa only [mul_zero] using hEs.const_mul La)
|
| 319 |
-
filter_upwards [eventually_gt_atTop 0] with N hN i
|
| 320 |
-
exact (coupled_mesh_general_moment_bounds hB hT h hD0 hLa hD
|
| 321 |
-
(fun t ht x y ↦ by simpa only [sub_self, abs_zero, zero_add] using haLip t ht t ht x y)
|
| 322 |
-
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN i).2
|
| 323 |
-
have herror : Tendsto (fun N ↦
|
| 324 |
-
(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 325 |
-
stepSize T N * ∑ i : Fin N, ∫ z, meshRaw T N γ u i z ∂gaussianProduct (Fin (N+1)))
|
| 326 |
-
atTop (𝓝 0) := by
|
| 327 |
-
apply squeeze_zero_norm' (a := fun N ↦
|
| 328 |
-
Real.sqrt (gradientMeshError T N γ u) * Real.sqrt T)
|
| 329 |
-
· filter_upwards [eventually_gt_atTop 0] with N hN
|
| 330 |
-
rw [Real.norm_eq_abs]
|
| 331 |
-
exact mesh_terminal_brownian_error hB hT h hD hN
|
| 332 |
-
· simpa only [Real.sqrt_zero, zero_mul, Function.comp_def] using
|
| 333 |
-
((Real.continuous_sqrt.tendsto 0).comp (gradientMeshError_tendsto_zero hT hT1 h)).mul_const
|
| 334 |
-
(Real.sqrt T)
|
| 335 |
-
have hlimit := herror.add hquadrature
|
| 336 |
-
simp only [sub_add_cancel, zero_add] at hlimit
|
| 337 |
-
exact tendsto_nhds_unique hcovariance hlimit
|
| 338 |
-
|
| 339 |
-
end SKValue
|
| 340 |
-
|
| 341 |
-
end
|
| 342 |
-
|
| 343 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Evolution.MeanDerivativeContinuous
|
| 3 |
+
import OAI.Probability.SKValue.Equations.RawIncrement
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
open MeasureTheory ProbabilityTheory Set
|
| 9 |
+
open scoped ENNReal NNReal BigOperators
|
| 10 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 11 |
+
open scoped BigOperators Topology
|
| 12 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
+
open scoped Topology BigOperators
|
| 14 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 15 |
+
open scoped Topology ENNReal NNReal
|
| 16 |
+
open Filter Set
|
| 17 |
+
open scoped Topology BigOperators
|
| 18 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 19 |
+
open scoped Topology
|
| 20 |
+
open MeasureTheory Set Filter
|
| 21 |
+
open scoped Topology BigOperators
|
| 22 |
+
open MeasureTheory Set Filter Finset
|
| 23 |
+
open scoped Topology BigOperators
|
| 24 |
+
namespace SKValue
|
| 25 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 26 |
+
open scoped Topology BigOperators
|
| 27 |
+
|
| 28 |
+
lemma coupled_terminal_second_moment_bound {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 29 |
+
[IsProbabilityMeasure μ] {B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 30 |
+
{X : ℝ → Ω → ℝ} {T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 31 |
+
(hT : 0<T) (h : GradientStrip T γ u K L) (hLu : 0≤Lu)
|
| 32 |
+
(huLip : ∀ x y, |u T x-u T y|≤Lu*|x-y|)
|
| 33 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 34 |
+
(hpaths : ∀ᵐ ω ∂μ,
|
| 35 |
+
(∀ t∈Icc (0 : ℝ) T, X t ω=B (Real.toNNReal t) ω+
|
| 36 |
+
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0)
|
| 37 |
+
{N : ℕ} (hN : 0<N) :
|
| 38 |
+
|(∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))-
|
| 39 |
+
(∫ ω, (u T (X T ω))^2 ∂μ)| ≤
|
| 40 |
+
(2*Lu)*Real.sqrt (∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ) := by
|
| 41 |
+
let F (ω : Ω) := u T (coupledEuler T γ u B N N ω)
|
| 42 |
+
let G (ω : Ω) := u T (X T ω)
|
| 43 |
+
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 44 |
+
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 45 |
+
have hd := (h.smooth T ht).continuous
|
| 46 |
+
have hFM : MemLp F 2 μ := MemLp.of_bound
|
| 47 |
+
(hd.measurable.comp_aemeasurable (coupled_euler_measurable hB hT h N N le_rfl).aemeasurable).aestronglyMeasurable 1
|
| 48 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs, F] using h.bounded T ht _))
|
| 49 |
+
have hGM : MemLp G 2 μ := MemLp.of_bound
|
| 50 |
+
(hd.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable 1
|
| 51 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs, G] using h.bounded T ht _))
|
| 52 |
+
have hEM : MemLp E 2 μ := coupled_mesh_error_memLp hB hT h hXM hpaths hN
|
| 53 |
+
have hlast : meshTime T N N = T := by dsimp [meshTime, stepSize]; field_simp
|
| 54 |
+
have hFG (ω : Ω) : |F ω-G ω|≤Lu*|E ω| := by
|
| 55 |
+
have he : |coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 56 |
+
change |coupledEuler T γ u B N N ω-X T ω| ≤ initialMax _ N
|
| 57 |
+
have hm := le_initialMax (f := fun k ↦ |coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 58 |
+
change |coupledEuler T γ u B N N ω-X (meshTime T N N) ω| ≤ initialMax _ N at hm
|
| 59 |
+
rw [hlast] at hm
|
| 60 |
+
exact hm
|
| 61 |
+
|
| 62 |
+
exact (huLip _ _).trans (mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) hLu)
|
| 63 |
+
have hlaw := coupledCoordinates_hasLaw hB hT hN
|
| 64 |
+
have heq : (∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))=∫ ω, (F ω)^2 ∂μ := by
|
| 65 |
+
rw [←hlaw.integral_comp ((mesh_terminal_measurable hT.le h hN).pow_const 2).aestronglyMeasurable]
|
| 66 |
+
simp only [Function.comp_apply, F, meshTerminal, coupledEuler, ite_eq_right (Nat.ne_of_gt hN)]
|
| 67 |
+
rw [heq]
|
| 68 |
+
simpa only [mul_one] using second_moment_perturbation hFM hGM hEM (by norm_num : (0 : ℝ)≤1) hLu
|
| 69 |
+
(Eventually.of_forall (fun ω ↦ ⟨h.bounded T ht _, h.bounded T ht _, hFG ω⟩))
|
| 70 |
+
|
| 71 |
+
theorem diffusion_gradient_isometry
|
| 72 |
+
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 73 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 74 |
+
{X : ℝ → Ω → ℝ} {T K L D Lu La : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 75 |
+
(hT : 0<T) (hT1 : T≤1) (h : GradientStrip T γ u K L)
|
| 76 |
+
(hD0 : 0≤D) (hLu : 0≤Lu) (hLa : 0≤La)
|
| 77 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 78 |
+
(huLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 79 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 80 |
+
(haLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 81 |
+
|deriv (u s) x-deriv (u t) y|≤La*(|s-t|+|x-y|))
|
| 82 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 83 |
+
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ��) T) ∧
|
| 84 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 85 |
+
(∀ t∈Icc (0 : ℝ) T, X t ω = B (Real.toNNReal t) ω+
|
| 86 |
+
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 87 |
+
(∫ ω, (u T (X T ω))^2 ∂μ) =
|
| 88 |
+
∫ t in (0 : ℝ)..T, ∫ ω, (deriv (u t) (X t ω))^2 ∂μ := by
|
| 89 |
+
let E (N : ℕ) := ∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ
|
| 90 |
+
have hE : Tendsto E atTop (𝓝 0) := coupled_euler_L2_convergence hB hT h hLu huLip hXM hpaths
|
| 91 |
+
have hEs : Tendsto (fun N ↦ Real.sqrt (E N)) atTop (𝓝 0) := by
|
| 92 |
+
simpa only [Real.sqrt_zero, Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp hE
|
| 93 |
+
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 94 |
+
have hmoment : Tendsto (fun N ↦ ∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))
|
| 95 |
+
atTop (𝓝 (∫ ω, (u T (X T ω))^2 ∂μ)) := by
|
| 96 |
+
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 97 |
+
apply squeeze_zero' (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_
|
| 98 |
+
(by simpa only [mul_zero] using hEs.const_mul (2*Lu))
|
| 99 |
+
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 100 |
+
rw [Real.norm_eq_abs]
|
| 101 |
+
exact coupled_terminal_second_moment_bound hB hT h hLu
|
| 102 |
+
(fun x y ↦ by simpa only [sub_self, abs_zero, zero_add] using huLip T ht T ht x y)
|
| 103 |
+
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN
|
| 104 |
+
have hmean := mean_derivative_square_continuous hD0 hLa
|
| 105 |
+
(fun t ht ↦ (h.smooth t ht).continuous_deriv (by norm_num)) hD haLip hXM
|
| 106 |
+
(hpaths.mono (fun _ hω ↦ hω.1))
|
| 107 |
+
have hquadrature : Tendsto (fun N ↦ stepSize T N * ∑ i : Fin N,
|
| 108 |
+
∫ z, (meshRaw T N γ u i z)^2 ∂gaussianProduct (Fin (N+1))) atTop
|
| 109 |
+
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, (deriv (u t) (X t ω))^2 ∂μ)) := by
|
| 110 |
+
apply perturbed_grid_riemann_tendsto (r := fun N ↦ (2*D*La)*Real.sqrt (E N)) hT hmean
|
| 111 |
+
(by simpa only [mul_zero] using hEs.const_mul (2*D*La))
|
| 112 |
+
filter_upwards [eventually_gt_atTop 0] with N hN i
|
| 113 |
+
exact (coupled_mesh_general_moment_bounds hB hT h hD0 hLa hD
|
| 114 |
+
(fun t ht x y ↦ by simpa only [sub_self, abs_zero, zero_add] using haLip t ht t ht x y)
|
| 115 |
+
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN i).1
|
| 116 |
+
have herror : Tendsto (fun N ↦
|
| 117 |
+
(∫ z, (meshTerminal T N γ u z)^2 ∂gaussianProduct (Fin (N+1)))-
|
| 118 |
+
stepSize T N * ∑ i : Fin N, ∫ z, (meshRaw T N γ u i z)^2 ∂gaussianProduct (Fin (N+1)))
|
| 119 |
+
atTop (𝓝 0) := by
|
| 120 |
+
apply squeeze_zero_norm' (a := fun N ↦
|
| 121 |
+
Real.sqrt (gradientMeshError T N γ u) * Real.sqrt (2*(1+T*D^2)))
|
| 122 |
+
· filter_upwards [eventually_gt_atTop 0] with N hN
|
| 123 |
+
rw [Real.norm_eq_abs]
|
| 124 |
+
exact mesh_terminal_stochastic_second_moment_error hT h hD0 hD hN
|
| 125 |
+
· simpa only [Real.sqrt_zero, zero_mul, Function.comp_def] using
|
| 126 |
+
((Real.continuous_sqrt.tendsto 0).comp (gradientMeshError_tendsto_zero hT hT1 h)).mul_const
|
| 127 |
+
(Real.sqrt (2*(1+T*D^2)))
|
| 128 |
+
have hlimit := herror.add hquadrature
|
| 129 |
+
simp only [sub_add_cancel, zero_add] at hlimit
|
| 130 |
+
exact tendsto_nhds_unique hmoment hlimit
|
| 131 |
+
|
| 132 |
+
lemma weighted_first_moment_perturbation {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 133 |
+
{f g e b : Ω → ℝ} {L : ℝ} (hf : MemLp f 2 μ) (hg : MemLp g 2 μ)
|
| 134 |
+
(he : MemLp e 2 μ) (hb : MemLp b 2 μ) (hL : 0≤L)
|
| 135 |
+
(hfg : ∀ᵐ ω ∂μ, |f ω-g ω|≤L*|e ω|) :
|
| 136 |
+
|(∫ ω, f ω*b ω ∂μ)-(∫ ω, g ω*b ω ∂μ)| ≤
|
| 137 |
+
L*Real.sqrt (∫ ω, (e ω)^2 ∂μ)*Real.sqrt (∫ ω, (b ω)^2 ∂μ) := by
|
| 138 |
+
rw [←integral_sub (f := fun ω ↦ f ω*b ω) (g := fun ω ↦ g ω*b ω) (hf.integrable_mul hb) (hg.integrable_mul hb)]
|
| 139 |
+
have heq : (fun ω ↦ f ω*b ω-g ω*b ω)=(fun ω ↦ (f ω-g ω)*b ω) := by funext ω; ring
|
| 140 |
+
rw [heq]
|
| 141 |
+
calc
|
| 142 |
+
_ ≤ ∫ ω, |(f ω-g ω)*b ω| ∂μ := abs_integral_le_integral_abs
|
| 143 |
+
_ ≤ ∫ ω, L*(|e ω| * |b ω|) ∂μ := by
|
| 144 |
+
apply integral_mono_ae ((hf.sub hg).integrable_mul hb).abs ((he.abs.integrable_mul hb.abs).const_mul L)
|
| 145 |
+
filter_upwards [hfg] with ω hω
|
| 146 |
+
change |(f ω-g ω)*b ω| ≤ L*(|e ω| * |b ω|)
|
| 147 |
+
rw [abs_mul]
|
| 148 |
+
exact (mul_le_mul_of_nonneg_right hω (abs_nonneg _)).trans_eq (mul_assoc _ _ _)
|
| 149 |
+
_ = L*(∫ ω, |e ω| * |b ω| ∂μ) := integral_const_mul _ _
|
| 150 |
+
_ ≤ L*(Real.sqrt (∫ ω, (e ω)^2 ∂μ)*Real.sqrt (∫ ω, (b ω)^2 ∂μ)) := by
|
| 151 |
+
have hcs := integral_product_CS he.abs hb.abs
|
| 152 |
+
change |∫ ω, |e ω| * |b ω| ∂μ|≤Real.sqrt (∫ ω, |e ω|^2 ∂μ)*Real.sqrt (∫ ω, |b ω|^2 ∂μ) at hcs
|
| 153 |
+
simp only [sq_abs] at hcs
|
| 154 |
+
exact mul_le_mul_of_nonneg_left ((le_abs_self _).trans hcs) hL
|
| 155 |
+
_ = _ := by ring
|
| 156 |
+
|
| 157 |
+
lemma brownian_eval_second_moment {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 158 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ) (t : ℝ≥0) :
|
| 159 |
+
(∫ ω, (B t ω)^2 ∂μ)=(t : ℝ) := by
|
| 160 |
+
have hv := (hB.hasLaw_eval t).variance_eq
|
| 161 |
+
rw [variance_eq_integral (hB.aemeasurable t), hB.integral_eval t] at hv
|
| 162 |
+
simpa using hv
|
| 163 |
+
|
| 164 |
+
noncomputable def meshBrownian (T : ℝ) (N : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 165 |
+
∑ j : Fin N, Real.sqrt (stepSize T N)*coordinate N j z
|
| 166 |
+
|
| 167 |
+
lemma meshBrownian_measurable (T : ℝ) (N : ℕ) : Measurable (meshBrownian T N) := by
|
| 168 |
+
apply Finset.measurable_sum
|
| 169 |
+
intro i _
|
| 170 |
+
exact measurable_const.mul (measurable_coordinate N i)
|
| 171 |
+
|
| 172 |
+
lemma meshBrownian_memLp (T : ℝ) (N : ℕ) :
|
| 173 |
+
MemLp (meshBrownian T N) 2 (gaussianProduct (Fin (N+1))) := by
|
| 174 |
+
convert memLp_finsetSum' Finset.univ (fun i : Fin N ↦ fun _ ↦
|
| 175 |
+
(gaussian_memLp (coordinate_hasLaw N i) 2 (by norm_num)).const_mul (Real.sqrt (stepSize T N))) using 1
|
| 176 |
+
funext z
|
| 177 |
+
simp only [meshBrownian, Finset.sum_apply]
|
| 178 |
+
|
| 179 |
+
lemma coupled_meshBrownian {Ω : Type*} (B : ℝ≥0 → Ω → ℝ) {T : ℝ} (hT : 0<T)
|
| 180 |
+
{N : ℕ} (hN : 0<N) (ω : Ω) :
|
| 181 |
+
meshBrownian T N (coupledCoordinates T N B ω)=B (Real.toNNReal T) ω-B 0 ω := by
|
| 182 |
+
have hlast : (N : ℝ)*(T/N)=T := by field_simp
|
| 183 |
+
unfold meshBrownian
|
| 184 |
+
have heq (j : Fin N) := coupled_coordinate_exact B hT hN (show (j : ℕ)<N+1 by omega) ω
|
| 185 |
+
simp_rw [stepSize, heq]
|
| 186 |
+
rw [Fin.sum_univ_eq_sum_range (fun j ↦ B (Real.toNNReal (((j+1 : ℕ) : ℝ)*(T/N))) ω-
|
| 187 |
+
B (Real.toNNReal ((j : ℝ)*(T/N))) ω), Finset.sum_range_sub (fun j : ℕ ↦ B (Real.toNNReal ((j : ℝ)*(T/N))) ω) N]
|
| 188 |
+
simp only [Nat.cast_zero, zero_mul, Real.toNNReal_zero, hlast]
|
| 189 |
+
|
| 190 |
+
lemma meshBrownian_second_moment {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 191 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ) {T : ℝ} (hT : 0<T)
|
| 192 |
+
{N : ℕ} (hN : 0<N) :
|
| 193 |
+
(∫ z, (meshBrownian T N z)^2 ∂gaussianProduct (Fin (N+1)))=T := by
|
| 194 |
+
rw [←(coupledCoordinates_hasLaw hB hT hN).integral_comp
|
| 195 |
+
((meshBrownian_measurable T N).pow_const 2).aestronglyMeasurable]
|
| 196 |
+
have heq : (fun ω ↦ (meshBrownian T N (coupledCoordinates T N B ω))^2)=ᵐ[μ]
|
| 197 |
+
(fun ω ↦ (B (Real.toNNReal T) ω)^2) := by
|
| 198 |
+
filter_upwards [hB.eval_zero_ae_eq_zero] with ω hω
|
| 199 |
+
simp only [coupled_meshBrownian B hT hN ω, hω, sub_zero]
|
| 200 |
+
exact (integral_congr_ae heq).trans ((brownian_eval_second_moment hB _).trans
|
| 201 |
+
(Real.coe_toNNReal _ hT.le))
|
| 202 |
+
|
| 203 |
+
lemma mesh_terminal_brownian_error {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 204 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 205 |
+
{T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 206 |
+
(hT : 0<T) (h : GradientStrip T γ u K L)
|
| 207 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D) {N : ℕ} (hN : 0<N) :
|
| 208 |
+
|(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 209 |
+
stepSize T N * ∑ i : Fin N, ∫ z, meshRaw T N γ u i z ∂gaussianProduct (Fin (N+1))| ≤
|
| 210 |
+
Real.sqrt (gradientMeshError T N γ u)*Real.sqrt T := by
|
| 211 |
+
have hm (i : Fin N) := mesh_raw_measurable hT.le h hN i.isLt.le
|
| 212 |
+
have hp (i : Fin N) := mesh_raw_depends T i.isLt.le γ u
|
| 213 |
+
have hH (i : Fin N) := mesh_raw_memLp hT.le h hD hN i.isLt.le
|
| 214 |
+
have hu := mesh_terminal_memLp hT.le h hN
|
| 215 |
+
have hr := finiteRaw_memLp (δ := stepSize T N) hm hp hH
|
| 216 |
+
have hb := meshBrownian_memLp T N
|
| 217 |
+
rw [←finiteRaw_brownian_covariance (δ := stepSize T N) (div_nonneg hT.le (Nat.cast_nonneg N)) hm hp hH]
|
| 218 |
+
change |(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 219 |
+
(∫ z, finiteRawMartingale (stepSize T N) (fun i : Fin N ↦ meshRaw T N γ u i) z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))|≤_
|
| 220 |
+
rw [←integral_sub (f := fun z ↦ meshTerminal T N γ u z * meshBrownian T N z)
|
| 221 |
+
(g := fun z ↦ finiteRawMartingale (stepSize T N) (fun i : Fin N ↦ meshRaw T N γ u i) z * meshBrownian T N z)
|
| 222 |
+
(hu.integrable_mul hb) (hr.integrable_mul hb)]
|
| 223 |
+
simp_rw [←sub_mul]
|
| 224 |
+
have hcs := integral_product_CS (hu.sub hr) hb
|
| 225 |
+
rw [meshBrownian_second_moment hB hT hN] at hcs
|
| 226 |
+
exact hcs
|
| 227 |
+
|
| 228 |
+
lemma coupled_terminal_brownian_error {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 229 |
+
[IsProbabilityMeasure μ] {B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 230 |
+
{X : ℝ → Ω → ℝ} {T K L Lu : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 231 |
+
(hT : 0<T) (h : GradientStrip T γ u K L) (hLu : 0≤Lu)
|
| 232 |
+
(huLip : ∀ x y, |u T x-u T y|≤Lu*|x-y|)
|
| 233 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 234 |
+
(hpaths : ∀ᵐ ω ∂μ,
|
| 235 |
+
(∀ t∈Icc (0 : ℝ) T, X t ω=B (Real.toNNReal t) ω+
|
| 236 |
+
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0)
|
| 237 |
+
{N : ℕ} (hN : 0<N) :
|
| 238 |
+
|(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 239 |
+
(∫ ω, u T (X T ω)*B (Real.toNNReal T) ω ∂μ)| ≤
|
| 240 |
+
Lu*Real.sqrt (∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)*Real.sqrt T := by
|
| 241 |
+
let F (ω : Ω) := u T (coupledEuler T γ u B N N ω)
|
| 242 |
+
let G (ω : Ω) := u T (X T ω)
|
| 243 |
+
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 244 |
+
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 245 |
+
have hd := (h.smooth T ht).continuous
|
| 246 |
+
have hFM : MemLp F 2 μ := MemLp.of_bound
|
| 247 |
+
(hd.measurable.comp_aemeasurable (coupled_euler_measurable hB hT h N N le_rfl).aemeasurable).aestronglyMeasurable 1
|
| 248 |
+
(Eventually.of_forall (fun �� ↦ by simpa only [Real.norm_eq_abs, F] using h.bounded T ht _))
|
| 249 |
+
have hGM : MemLp G 2 μ := MemLp.of_bound
|
| 250 |
+
(hd.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable 1
|
| 251 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs, G] using h.bounded T ht _))
|
| 252 |
+
have hEM : MemLp E 2 μ := coupled_mesh_error_memLp hB hT h hXM hpaths hN
|
| 253 |
+
have hlast : meshTime T N N = T := by dsimp [meshTime, stepSize]; field_simp
|
| 254 |
+
have hFG (ω : Ω) : |F ω-G ω|≤Lu*|E ω| := by
|
| 255 |
+
have he : |coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 256 |
+
change |coupledEuler T γ u B N N ω-X T ω| ≤ initialMax _ N
|
| 257 |
+
have hm := le_initialMax (f := fun k ↦ |coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 258 |
+
rw [hlast] at hm
|
| 259 |
+
exact hm
|
| 260 |
+
exact (huLip _ _).trans (mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) hLu)
|
| 261 |
+
have hlaw := coupledCoordinates_hasLaw hB hT hN
|
| 262 |
+
have heq : (∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))=
|
| 263 |
+
∫ ω, F ω*B (Real.toNNReal T) ω ∂μ := by
|
| 264 |
+
have hm : AEStronglyMeasurable (fun z ↦ meshTerminal T N γ u z * meshBrownian T N z) (gaussianProduct (Fin (N+1))) :=
|
| 265 |
+
((mesh_terminal_measurable hT.le h hN).mul (meshBrownian_measurable T N)).aestronglyMeasurable
|
| 266 |
+
rw [←hlaw.integral_comp hm]
|
| 267 |
+
apply integral_congr_ae
|
| 268 |
+
filter_upwards [hB.eval_zero_ae_eq_zero] with ω hω
|
| 269 |
+
simp only [Function.comp_apply, F, meshTerminal, coupledEuler, ite_eq_right (Nat.ne_of_gt hN),
|
| 270 |
+
coupled_meshBrownian B hT hN ω, hω, sub_zero]
|
| 271 |
+
rw [heq]
|
| 272 |
+
have hh := weighted_first_moment_perturbation hFM hGM hEM (hB.hasLaw_eval T.toNNReal).hasGaussianLaw.memLp_two hLu
|
| 273 |
+
(Eventually.of_forall hFG)
|
| 274 |
+
rw [brownian_eval_second_moment hB,Real.coe_toNNReal _ hT.le] at hh
|
| 275 |
+
exact hh
|
| 276 |
+
|
| 277 |
+
theorem diffusion_gradient_brownian_covariance
|
| 278 |
+
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 279 |
+
{B : ℝ≥0 → Ω → ℝ} (hB : IsPreBrownianReal B μ)
|
| 280 |
+
{X : ℝ → Ω → ℝ} {T K L D Lu La : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 281 |
+
(hT : 0<T) (hT1 : T≤1) (h : GradientStrip T γ u K L)
|
| 282 |
+
(hD0 : 0≤D) (hLu : 0≤Lu) (hLa : 0≤La)
|
| 283 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 284 |
+
(huLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 285 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 286 |
+
(haLip : ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x y,
|
| 287 |
+
|deriv (u s) x-deriv (u t) y|≤La*(|s-t|+|x-y|))
|
| 288 |
+
(hXM : ∀ t∈Icc (0 : ℝ) T, AEStronglyMeasurable (X t) μ)
|
| 289 |
+
(hpaths : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 290 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 291 |
+
(∀ t∈Icc (0 : ℝ) T, X t ω = B (Real.toNNReal t) ω+
|
| 292 |
+
∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 293 |
+
(∫ ω, u T (X T ω)*B (Real.toNNReal T) ω ∂μ) =
|
| 294 |
+
∫ t in (0 : ℝ)..T, ∫ ω, deriv (u t) (X t ω) ∂μ := by
|
| 295 |
+
let E (N : ℕ) := ∫ ω, (meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ
|
| 296 |
+
have hE : Tendsto E atTop (𝓝 0) := coupled_euler_L2_convergence hB hT h hLu huLip hXM hpaths
|
| 297 |
+
have hEs : Tendsto (fun N ↦ Real.sqrt (E N)) atTop (𝓝 0) := by
|
| 298 |
+
simpa only [Real.sqrt_zero, Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp hE
|
| 299 |
+
have ht : T∈Icc (0 : ℝ) T := ⟨hT.le,le_rfl⟩
|
| 300 |
+
have hcovariance : Tendsto (fun N ↦ ∫ z, meshTerminal T N γ u z * meshBrownian T N z
|
| 301 |
+
∂gaussianProduct (Fin (N+1))) atTop
|
| 302 |
+
(𝓝 (∫ ω, u T (X T ω)*B T.toNNReal ω ∂μ)) := by
|
| 303 |
+
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 304 |
+
apply squeeze_zero' (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_
|
| 305 |
+
(by simpa only [mul_zero, zero_mul] using (hEs.const_mul Lu).mul_const (Real.sqrt T))
|
| 306 |
+
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 307 |
+
rw [Real.norm_eq_abs]
|
| 308 |
+
exact coupled_terminal_brownian_error hB hT h hLu
|
| 309 |
+
(fun x y ↦ by simpa only [sub_self, abs_zero, zero_add] using huLip T ht T ht x y)
|
| 310 |
+
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN
|
| 311 |
+
have hmean := mean_derivative_continuous hLa
|
| 312 |
+
(fun t ht ↦ (h.smooth t ht).continuous_deriv (by norm_num)) hD haLip hXM
|
| 313 |
+
(hpaths.mono (fun _ hω ↦ hω.1))
|
| 314 |
+
have hquadrature : Tendsto (fun N ↦ stepSize T N * ∑ i : Fin N,
|
| 315 |
+
∫ z, meshRaw T N γ u i z ∂gaussianProduct (Fin (N+1))) atTop
|
| 316 |
+
(𝓝 (∫ t in (0 : ℝ)..T, ∫ ω, deriv (u t) (X t ω) ∂μ)) := by
|
| 317 |
+
apply perturbed_grid_riemann_tendsto (r := fun N ↦ La*Real.sqrt (E N)) hT hmean
|
| 318 |
+
(by simpa only [mul_zero] using hEs.const_mul La)
|
| 319 |
+
filter_upwards [eventually_gt_atTop 0] with N hN i
|
| 320 |
+
exact (coupled_mesh_general_moment_bounds hB hT h hD0 hLa hD
|
| 321 |
+
(fun t ht x y ↦ by simpa only [sub_self, abs_zero, zero_add] using haLip t ht t ht x y)
|
| 322 |
+
hXM (hpaths.mono (fun _ hω ↦ hω.2.2)) hN i).2
|
| 323 |
+
have herror : Tendsto (fun N ↦
|
| 324 |
+
(∫ z, meshTerminal T N γ u z * meshBrownian T N z ∂gaussianProduct (Fin (N+1)))-
|
| 325 |
+
stepSize T N * ∑ i : Fin N, ∫ z, meshRaw T N γ u i z ∂gaussianProduct (Fin (N+1)))
|
| 326 |
+
atTop (𝓝 0) := by
|
| 327 |
+
apply squeeze_zero_norm' (a := fun N ↦
|
| 328 |
+
Real.sqrt (gradientMeshError T N γ u) * Real.sqrt T)
|
| 329 |
+
· filter_upwards [eventually_gt_atTop 0] with N hN
|
| 330 |
+
rw [Real.norm_eq_abs]
|
| 331 |
+
exact mesh_terminal_brownian_error hB hT h hD hN
|
| 332 |
+
· simpa only [Real.sqrt_zero, zero_mul, Function.comp_def] using
|
| 333 |
+
((Real.continuous_sqrt.tendsto 0).comp (gradientMeshError_tendsto_zero hT hT1 h)).mul_const
|
| 334 |
+
(Real.sqrt T)
|
| 335 |
+
have hlimit := herror.add hquadrature
|
| 336 |
+
simp only [sub_add_cancel, zero_add] at hlimit
|
| 337 |
+
exact tendsto_nhds_unique hcovariance hlimit
|
| 338 |
+
|
| 339 |
+
end SKValue
|
| 340 |
+
|
| 341 |
+
end
|
| 342 |
+
|
| 343 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/MeshMaxError.lean
CHANGED
|
@@ -1,87 +1,87 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.InitialMax
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
|
| 25 |
-
noncomputable def meshMaxError {Ω : Type*} (T :
|
| 26 |
-
(Y : ℕ → ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) : ℝ :=
|
| 27 |
-
initialMax (fun j ↦ |Y N j ω-X ((j : ℝ)*(T/N)) ω|) N
|
| 28 |
-
|
| 29 |
-
lemma meshMaxError_nonneg {Ω : Type*} (T : ℝ) (X : ℝ → Ω → ℝ)
|
| 30 |
-
(Y : ℕ → ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) : 0 ≤ meshMaxError T X Y N ω :=
|
| 31 |
-
(abs_nonneg _).trans (le_initialMax
|
| 32 |
-
(f := fun j ↦ |Y N j ω-X ((j : ℝ)*(T/N)) ω|) (Nat.zero_le N))
|
| 33 |
-
|
| 34 |
-
lemma driven_euler_L2_convergence {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 35 |
-
[IsFiniteMeasure μ] {T L : ℝ} {u : ℝ → ℝ → ℝ} {γ : ℝ → ℝ}
|
| 36 |
-
{W X : ℝ → Ω → ℝ} {Y : ℕ → ℕ → Ω → ℝ}
|
| 37 |
-
(hT : 0 ≤ T) (hL : 0 ≤ L)
|
| 38 |
-
(hγ : MonotoneOn γ (Icc (0 : ℝ) T)) (hγ0 : 0 ≤ γ 0)
|
| 39 |
-
(hu : ∀ t ∈ Icc (0 : ℝ) T, ∀ x, |u t x| ≤ 1)
|
| 40 |
-
(hLip : ∀ s ∈ Icc (0 : ℝ) T, ∀ t ∈ Icc (0 : ℝ) T, ∀ x y,
|
| 41 |
-
|u s x-u t y| ≤ L*(|s-t|+|x-y|))
|
| 42 |
-
(hXM : ∀ t, AEStronglyMeasurable (X t) μ)
|
| 43 |
-
(hYM : ∀ N j, AEStronglyMeasurable (Y N j) μ)
|
| 44 |
-
(hpaths : ∀ᵐ ω ∂μ,
|
| 45 |
-
ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 46 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 47 |
-
(∀ t ∈ Icc (0 : ℝ) T,
|
| 48 |
-
X t ω = W t ω + ∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω = 0)
|
| 49 |
-
(hY0 : ∀ N ω, Y N 0 ω = 0)
|
| 50 |
-
(hY : ∀ N > 0, ∀ j < N, ∀ ω,
|
| 51 |
-
Y N (j+1) ω = Y N j ω + W (((j+1 : ℕ) : ℝ)*(T/N)) ω-W ((j : ℝ)*(T/N)) ω +
|
| 52 |
-
(T/N)*γ ((j : ℝ)*(T/N))*u ((j : ℝ)*(T/N)) (Y N j ω)) :
|
| 53 |
-
Tendsto (fun N ↦ ∫ ω, (meshMaxError T X Y N ω)^2 ∂μ) atTop (𝓝 (0 : ℝ)) := by
|
| 54 |
-
have hmeas : ∀ N, AEStronglyMeasurable (fun ω ↦ (meshMaxError T X Y N ω)^2) μ := by
|
| 55 |
-
intro N
|
| 56 |
-
exact (aestronglyMeasurable_initialMax (fun j ↦ ((hYM N j).sub (hXM _)).norm) N).fun_pow 2
|
| 57 |
-
have hbound : ∀ᶠ N in atTop, ∀ᵐ ω ∂μ,
|
| 58 |
-
‖(meshMaxError T X Y N ω)^2‖ ≤ (2*T*γ T)^2 := by
|
| 59 |
-
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 60 |
-
filter_upwards [hpaths] with ω hω
|
| 61 |
-
have hδ : 0 ≤ T/(N : ℝ) := div_nonneg hT (Nat.cast_nonneg _)
|
| 62 |
-
have horizon : (N : ℝ)*(T/N) = T := by field_simp
|
| 63 |
-
have H := driven_euler_uniform_bound (Y := fun j ↦ Y N j ω) hδ hT horizon hγ hγ0 hu hω.2.2.1 hω.2.2.2
|
| 64 |
-
(hY0 N ω) (fun j hj ↦ hY N hN j hj ω)
|
| 65 |
-
have he : meshMaxError T X Y N ω ≤ 2*T*γ T := initialMax_le_iff.mpr H
|
| 66 |
-
rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)]
|
| 67 |
-
exact pow_le_pow_left₀ (meshMaxError_nonneg T X Y N ω) he 2
|
| 68 |
-
have hlim : ∀ᵐ ω ∂μ, Tendsto (fun N ↦ (meshMaxError T X Y N ω)^2) atTop (𝓝 (0 : ℝ)) := by
|
| 69 |
-
filter_upwards [hpaths] with ω hω
|
| 70 |
-
have H := driven_euler_uniform_convergence (Y := fun N j ↦ Y N j ω) hT hL hγ hγ0 hu hLip hω.1 hω.2.1 hω.2.2.1
|
| 71 |
-
hω.2.2.2 (fun N ↦ hY0 N ω) (fun N hN j hj ↦ hY N hN j hj ω)
|
| 72 |
-
have hzero : Tendsto (fun N ↦ meshMaxError T X Y N ω) atTop (𝓝 (0 : ℝ)) := by
|
| 73 |
-
rw [Metric.tendsto_nhds]
|
| 74 |
-
intro ε hε
|
| 75 |
-
filter_upwards [H ε hε] with N hN
|
| 76 |
-
rw [Real.dist_eq,sub_zero,abs_of_nonneg (meshMaxError_nonneg T X Y N ω)]
|
| 77 |
-
exact initialMax_lt_iff.mpr hN
|
| 78 |
-
simpa using hzero.pow 2
|
| 79 |
-
have H := tendsto_integral_filter_of_dominated_convergence (fun _ : Ω ↦ (2*T*γ T)^2)
|
| 80 |
-
(Eventually.of_forall hmeas) hbound (integrable_const _) hlim
|
| 81 |
-
simpa using H
|
| 82 |
-
|
| 83 |
-
end SKValue
|
| 84 |
-
|
| 85 |
-
end
|
| 86 |
-
|
| 87 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.InitialMax
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
|
| 25 |
+
noncomputable def meshMaxError {Ω : Type*} (T : ���) (X : ℝ → Ω → ℝ)
|
| 26 |
+
(Y : ℕ → ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) : ℝ :=
|
| 27 |
+
initialMax (fun j ↦ |Y N j ω-X ((j : ℝ)*(T/N)) ω|) N
|
| 28 |
+
|
| 29 |
+
lemma meshMaxError_nonneg {Ω : Type*} (T : ℝ) (X : ℝ → Ω → ℝ)
|
| 30 |
+
(Y : ℕ → ℕ → Ω → ℝ) (N : ℕ) (ω : Ω) : 0 ≤ meshMaxError T X Y N ω :=
|
| 31 |
+
(abs_nonneg _).trans (le_initialMax
|
| 32 |
+
(f := fun j ↦ |Y N j ω-X ((j : ℝ)*(T/N)) ω|) (Nat.zero_le N))
|
| 33 |
+
|
| 34 |
+
lemma driven_euler_L2_convergence {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω}
|
| 35 |
+
[IsFiniteMeasure μ] {T L : ℝ} {u : ℝ → ℝ → ℝ} {γ : ℝ → ℝ}
|
| 36 |
+
{W X : ℝ → Ω → ℝ} {Y : ℕ → ℕ → Ω → ℝ}
|
| 37 |
+
(hT : 0 ≤ T) (hL : 0 ≤ L)
|
| 38 |
+
(hγ : MonotoneOn γ (Icc (0 : ℝ) T)) (hγ0 : 0 ≤ γ 0)
|
| 39 |
+
(hu : ∀ t ∈ Icc (0 : ℝ) T, ∀ x, |u t x| ≤ 1)
|
| 40 |
+
(hLip : ∀ s ∈ Icc (0 : ℝ) T, ∀ t ∈ Icc (0 : ℝ) T, ∀ x y,
|
| 41 |
+
|u s x-u t y| ≤ L*(|s-t|+|x-y|))
|
| 42 |
+
(hXM : ∀ t, AEStronglyMeasurable (X t) μ)
|
| 43 |
+
(hYM : ∀ N j, AEStronglyMeasurable (Y N j) μ)
|
| 44 |
+
(hpaths : ∀ᵐ ω ∂μ,
|
| 45 |
+
ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 46 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 47 |
+
(∀ t ∈ Icc (0 : ℝ) T,
|
| 48 |
+
X t ω = W t ω + ∫ s in (0 : ℝ)..t, γ s*u s (X s ω)) ∧ X 0 ω = 0)
|
| 49 |
+
(hY0 : ∀ N ω, Y N 0 ω = 0)
|
| 50 |
+
(hY : ∀ N > 0, ∀ j < N, ∀ ω,
|
| 51 |
+
Y N (j+1) ω = Y N j ω + W (((j+1 : ℕ) : ℝ)*(T/N)) ω-W ((j : ℝ)*(T/N)) ω +
|
| 52 |
+
(T/N)*γ ((j : ℝ)*(T/N))*u ((j : ℝ)*(T/N)) (Y N j ω)) :
|
| 53 |
+
Tendsto (fun N ↦ ∫ ω, (meshMaxError T X Y N ω)^2 ∂μ) atTop (𝓝 (0 : ℝ)) := by
|
| 54 |
+
have hmeas : ∀ N, AEStronglyMeasurable (fun ω ↦ (meshMaxError T X Y N ω)^2) μ := by
|
| 55 |
+
intro N
|
| 56 |
+
exact (aestronglyMeasurable_initialMax (fun j ↦ ((hYM N j).sub (hXM _)).norm) N).fun_pow 2
|
| 57 |
+
have hbound : ∀ᶠ N in atTop, ∀ᵐ ω ∂μ,
|
| 58 |
+
‖(meshMaxError T X Y N ω)^2‖ ≤ (2*T*γ T)^2 := by
|
| 59 |
+
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 60 |
+
filter_upwards [hpaths] with ω hω
|
| 61 |
+
have hδ : 0 ≤ T/(N : ℝ) := div_nonneg hT (Nat.cast_nonneg _)
|
| 62 |
+
have horizon : (N : ℝ)*(T/N) = T := by field_simp
|
| 63 |
+
have H := driven_euler_uniform_bound (Y := fun j ↦ Y N j ω) hδ hT horizon hγ hγ0 hu hω.2.2.1 hω.2.2.2
|
| 64 |
+
(hY0 N ω) (fun j hj ↦ hY N hN j hj ω)
|
| 65 |
+
have he : meshMaxError T X Y N ω ≤ 2*T*γ T := initialMax_le_iff.mpr H
|
| 66 |
+
rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)]
|
| 67 |
+
exact pow_le_pow_left₀ (meshMaxError_nonneg T X Y N ω) he 2
|
| 68 |
+
have hlim : ∀ᵐ ω ∂μ, Tendsto (fun N ↦ (meshMaxError T X Y N ω)^2) atTop (𝓝 (0 : ℝ)) := by
|
| 69 |
+
filter_upwards [hpaths] with ω hω
|
| 70 |
+
have H := driven_euler_uniform_convergence (Y := fun N j ↦ Y N j ω) hT hL hγ hγ0 hu hLip hω.1 hω.2.1 hω.2.2.1
|
| 71 |
+
hω.2.2.2 (fun N ↦ hY0 N ω) (fun N hN j hj ↦ hY N hN j hj ω)
|
| 72 |
+
have hzero : Tendsto (fun N ↦ meshMaxError T X Y N ω) atTop (𝓝 (0 : ℝ)) := by
|
| 73 |
+
rw [Metric.tendsto_nhds]
|
| 74 |
+
intro ε hε
|
| 75 |
+
filter_upwards [H ε hε] with N hN
|
| 76 |
+
rw [Real.dist_eq,sub_zero,abs_of_nonneg (meshMaxError_nonneg T X Y N ω)]
|
| 77 |
+
exact initialMax_lt_iff.mpr hN
|
| 78 |
+
simpa using hzero.pow 2
|
| 79 |
+
have H := tendsto_integral_filter_of_dominated_convergence (fun _ : Ω ↦ (2*T*γ T)^2)
|
| 80 |
+
(Eventually.of_forall hmeas) hbound (integrable_const _) hlim
|
| 81 |
+
simpa using H
|
| 82 |
+
|
| 83 |
+
end SKValue
|
| 84 |
+
|
| 85 |
+
end
|
| 86 |
+
|
| 87 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/MeshMeanBound.lean
CHANGED
|
@@ -1,145 +1,145 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.ShiftedPairing
|
| 3 |
-
import OAI.Probability.SKValue.Evolution.UniformGridRiemannBound
|
| 4 |
-
import OAI.Probability.SKValue.Processes.MeshRaw
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set
|
| 10 |
-
open scoped ENNReal NNReal BigOperators
|
| 11 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 12 |
-
open scoped BigOperators Topology
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology BigOperators
|
| 15 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 16 |
-
open scoped Topology ENNReal NNReal
|
| 17 |
-
open Filter Set
|
| 18 |
-
open scoped Topology BigOperators
|
| 19 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 20 |
-
open scoped Topology
|
| 21 |
-
open MeasureTheory Set Filter
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 25 |
-
open scoped Topology BigOperators
|
| 26 |
-
|
| 27 |
-
lemma mesh_mean_bound {T D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 28 |
-
(hT : 0≤T) (hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 29 |
-
{N : ℕ} (hN : 0<N) {j : ℕ} (hj : j≤N) :
|
| 30 |
-
|∫ z, meshRaw T N γ u j z ∂gaussianProduct (Fin (N+1))|≤D := by
|
| 31 |
-
have := gaussianProduct_probability (Fin (N+1))
|
| 32 |
-
simpa [Real.norm_eq_abs] using
|
| 33 |
-
(norm_integral_le_of_norm_le_const (μ := gaussianProduct (Fin (N+1)))
|
| 34 |
-
(Eventually.of_forall (fun z ↦ show ‖meshRaw T N γ u j z‖≤D from by
|
| 35 |
-
simpa only [Real.norm_eq_abs, meshRaw] using hD _ (mesh_time_mem hT hN hj) _)))
|
| 36 |
-
|
| 37 |
-
lemma product_perturbation_bound {a b f D r : ℝ} (hD : 0≤D) (_ : 0≤r)
|
| 38 |
-
(ha : |a|≤D) (hb : |b-1|≤r) (hf : |a-f|≤r) : |a*b-f|≤(D+1)*r := by
|
| 39 |
-
calc
|
| 40 |
-
|a*b-f| = |a*(b-1)+(a-f)| := by congr 1; ring
|
| 41 |
-
_ ≤ |a*(b-1)|+|a-f| := abs_add_le _ _
|
| 42 |
-
_ ≤ D*r+r := by
|
| 43 |
-
rw [abs_mul]
|
| 44 |
-
exact add_le_add (mul_le_mul ha hb (abs_nonneg _) hD) hf
|
| 45 |
-
_ = _ := by ring
|
| 46 |
-
|
| 47 |
-
theorem finiteGaussian_from_strip_and_moments
|
| 48 |
-
{T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {f : ℝ → ℝ} {r : ℕ → ℝ}
|
| 49 |
-
(hT : 0<T) (hT1 : T≤1) (h : GradientStrip T γ u K L) (hD0 : 0≤D)
|
| 50 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 51 |
-
(hf : ContinuousOn f (Icc (0 : ℝ) T)) (hr : ∀ N, 0≤r N)
|
| 52 |
-
(hr0 : Tendsto r atTop (𝓝 0))
|
| 53 |
-
(hq : ∀ N, 0<N → ∀ j : Fin N,
|
| 54 |
-
|(∫ z, (meshRaw T N γ u j z)^2 ∂gaussianProduct (Fin (N+1)))-1|≤r N)
|
| 55 |
-
(hm : ∀ N, 0<N → ∀ j : Fin N,
|
| 56 |
-
|(∫ z, meshRaw T N γ u j z ∂gaussianProduct (Fin (N+1)))-f (meshTime T N j)|≤r N) :
|
| 57 |
-
(∀ᶠ N in atTop, ∀ j<N, 0<predictableNormalizer (meshRaw T N γ u j)
|
| 58 |
-
(gaussianProduct (Fin (N+1)))) ∧
|
| 59 |
-
Tendsto (fun N ↦ finiteShiftedValue T N γ u) atTop (𝓝 (∫ t in (0 : ℝ)..T, f t)) := by
|
| 60 |
-
let q (N j : ℕ) := ∫ z, (meshRaw T N γ u j z)^2 ∂gaussianProduct (Fin (N+1))
|
| 61 |
-
have hqpos : ∀ᶠ N in atTop, ∀ j<N, 0<q N j :=
|
| 62 |
-
uniform_moment_positive hr0 (fun N j hj ↦ hq N (by omega) ⟨j,hj⟩)
|
| 63 |
-
constructor
|
| 64 |
-
· filter_upwards [hqpos] with N hN j hj
|
| 65 |
-
exact predictableNormalizer_pos (hN j hj)
|
| 66 |
-
· let A (N : ℕ) (i : Fin (N+1)) := meshA T (N+1) γ u i
|
| 67 |
-
let B (N : ℕ) (i : Fin (N+1)) := meshB T (N+1) γ u i
|
| 68 |
-
let α (N : ℕ) (i : Fin (N+1)) := Real.sqrt (stepSize T (N+1))/
|
| 69 |
-
predictableNormalizer (meshRaw T (N+1) γ u i) (gaussianProduct (Fin ((N+1)+1)))
|
| 70 |
-
let β (N : ℕ) (i : Fin (N+1)) := Real.sqrt (stepSize T (N+1))*
|
| 71 |
-
∫ z, meshRaw T (N+1) γ u i z ∂gaussianProduct (Fin ((N+1)+1))
|
| 72 |
-
let bstar (N : ℕ) := meshB T (N+1) γ u (N+1)
|
| 73 |
-
let e (N : ℕ) := gradientMeshError T (N+1) γ u
|
| 74 |
-
let rend (N : ℕ) := Real.sqrt (stepSize T (N+1))*D
|
| 75 |
-
have hproj : ∀ᶠ N in atTop,
|
| 76 |
-
(∑ i, (A N i-α N i)^2)≤e N ∧ (∑ i, (B N i-β N i)^2)≤e N := by
|
| 77 |
-
filter_upwards [(tendsto_add_atTop_nat 1).eventually hqpos] with N hN
|
| 78 |
-
exact mesh_coefficient_errors hT.le h hD (Nat.succ_pos N) (fun i ↦ hN i i.isLt)
|
| 79 |
-
have hnorm (N : ℕ) : (∑ i, (B N i)^2)≤1 ∧ |bstar N|≤1 :=
|
| 80 |
-
mesh_coefficients_norms hT.le h (Nat.succ_pos N)
|
| 81 |
-
have hαnorm (N : ℕ) : (∑ i, (α N i)^2)≤(Real.sqrt T*D)^2 :=
|
| 82 |
-
mesh_leading_norm hT.le h hD0 hD (Nat.succ_pos N)
|
| 83 |
-
have hend (N : ℕ) : |α N (Fin.last N)|≤rend N := by
|
| 84 |
-
have := gaussianProduct_probability (Fin ((N+1)+1))
|
| 85 |
-
exact sqrt_div_normalizer_bound
|
| 86 |
-
(mesh_raw_memLp hT.le h hD (Nat.succ_pos N) (Nat.le_succ N)) hD0
|
| 87 |
-
(Eventually.of_forall (fun z ↦ hD _ (mesh_time_mem hT.le (Nat.succ_pos N) (Nat.le_succ N)) _))
|
| 88 |
-
have he0 : Tendsto e atTop (𝓝 0) :=
|
| 89 |
-
(gradientMeshError_tendsto_zero hT hT1 h).comp (tendsto_add_atTop_nat 1)
|
| 90 |
-
have hδ0 : Tendsto (fun N : ℕ ↦ stepSize T (N+1)) atTop (𝓝 0) :=
|
| 91 |
-
(tendsto_const_div_atTop_nhds_zero_nat T).comp (tendsto_add_atTop_nat 1)
|
| 92 |
-
have hrend0 : Tendsto rend atTop (𝓝 0) := by
|
| 93 |
-
simpa only [rend, Function.comp_def, Real.sqrt_zero, zero_mul] using
|
| 94 |
-
((Real.continuous_sqrt.tendsto 0).comp hδ0).mul_const D
|
| 95 |
-
have herr := shiftedPairing_tendsto_error_zero
|
| 96 |
-
(fun N ↦ gradientMeshError_nonneg T (N+1) γ u) (mul_nonneg (Real.sqrt_nonneg T) hD0)
|
| 97 |
-
(hproj.mono (fun _ hN ↦ hN.1)) (hproj.mono (fun _ hN ↦ hN.2))
|
| 98 |
-
(Eventually.of_forall (fun N ↦ (hnorm N).1)) (Eventually.of_forall hαnorm)
|
| 99 |
-
(Eventually.of_forall (fun N ↦ (hnorm N).2)) (Eventually.of_forall hend) he0 hrend0
|
| 100 |
-
let v (N : ℕ) (i : Fin N) :=
|
| 101 |
-
(∫ z, meshRaw T (N+1) γ u (i+1) z ∂gaussianProduct (Fin ((N+1)+1)))*Real.sqrt (q (N+1) i)
|
| 102 |
-
have hv (N : ℕ) (i : Fin N) :
|
| 103 |
-
|v N i-f ((i+1 : ℕ)*(T/(N+1)))|≤(D+1)*r (N+1) := by
|
| 104 |
-
apply product_perturbation_bound hD0 (hr (N+1))
|
| 105 |
-
· exact mesh_mean_bound hT.le hD (Nat.succ_pos N) (by omega)
|
| 106 |
-
· exact (abs_sqrt_sub_one_le (integral_nonneg (fun z ↦ sq_nonneg _))).trans
|
| 107 |
-
(hq (N+1) (Nat.succ_pos N) i.castSucc)
|
| 108 |
-
· simpa only [meshTime, stepSize, Fin.val_succ, Nat.cast_add, Nat.cast_one] using
|
| 109 |
-
hm (N+1) (Nat.succ_pos N) i.succ
|
| 110 |
-
have hv0 : Tendsto (fun N ↦ (D+1)*r (N+1)) atTop (𝓝 0) := by
|
| 111 |
-
simpa only [mul_zero, Function.comp_def] using (hr0.comp (tendsto_add_atTop_nat 1)).const_mul (D+1)
|
| 112 |
-
have hvlim := perturbed_shifted_grid_tendsto hT hf
|
| 113 |
-
(fun N ↦ mul_nonneg (by positivity : 0≤D+1) (hr (N+1))) hv0 (Eventually.of_forall hv)
|
| 114 |
-
have hsum (N : ℕ) : (∑ i : Fin N, α N i.castSucc*β N i.succ)=
|
| 115 |
-
(T/(N+1))*∑ i : Fin N, v N i := by
|
| 116 |
-
rw [Finset.mul_sum]
|
| 117 |
-
apply Finset.sum_congr rfl
|
| 118 |
-
intro i _
|
| 119 |
-
have hδ : 0 ≤ stepSize T (N+1) := div_nonneg hT.le (Nat.cast_nonneg _)
|
| 120 |
-
dsimp only [α, β, v, q, predictableNormalizer]
|
| 121 |
-
rw [div_inv_eq_mul]
|
| 122 |
-
calc
|
| 123 |
-
_ = (Real.sqrt (stepSize T (N+1)))^2 *
|
| 124 |
-
((∫ z, meshRaw T (N+1) γ u (i+1) z ∂gaussianProduct (Fin ((N+1)+1)))*
|
| 125 |
-
Real.sqrt (∫ z, (meshRaw T (N+1) γ u i z)^2 ∂gaussianProduct (Fin ((N+1)+1)))) := by
|
| 126 |
-
simp only [Fin.val_castSucc, Fin.val_succ]
|
| 127 |
-
ring
|
| 128 |
-
_ = _ := by rw [Real.sq_sqrt hδ]; simp only [stepSize, Nat.cast_add, Nat.cast_one]
|
| 129 |
-
have hp (N : ℕ) : shiftedPairing (A N) (B N) (bstar N)=finiteShiftedValue T (N+1) γ u := by
|
| 130 |
-
simp only [shiftedPairing, finiteShiftedValue, A, B, bstar]
|
| 131 |
-
rw [Fin.sum_univ_castSucc]
|
| 132 |
-
simp only [Fin.val_castSucc, Fin.val_succ, Fin.val_last]
|
| 133 |
-
simp_rw [hp, hsum] at herr
|
| 134 |
-
have hlim := herr.add hvlim
|
| 135 |
-
simp only [sub_add_cancel, zero_add] at hlim
|
| 136 |
-
exact (tendsto_add_atTop_iff_nat 1).mp hlim
|
| 137 |
-
|
| 138 |
-
end SKValue
|
| 139 |
-
|
| 140 |
-
open MeasureTheory Set Filter Finset
|
| 141 |
-
open scoped Topology BigOperators
|
| 142 |
-
|
| 143 |
-
end
|
| 144 |
-
|
| 145 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.ShiftedPairing
|
| 3 |
+
import OAI.Probability.SKValue.Evolution.UniformGridRiemannBound
|
| 4 |
+
import OAI.Probability.SKValue.Processes.MeshRaw
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set
|
| 10 |
+
open scoped ENNReal NNReal BigOperators
|
| 11 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 12 |
+
open scoped BigOperators Topology
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology BigOperators
|
| 15 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 16 |
+
open scoped Topology ENNReal NNReal
|
| 17 |
+
open Filter Set
|
| 18 |
+
open scoped Topology BigOperators
|
| 19 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 20 |
+
open scoped Topology
|
| 21 |
+
open MeasureTheory Set Filter
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 25 |
+
open scoped Topology BigOperators
|
| 26 |
+
|
| 27 |
+
lemma mesh_mean_bound {T D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 28 |
+
(hT : 0≤T) (hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 29 |
+
{N : ℕ} (hN : 0<N) {j : ℕ} (hj : j≤N) :
|
| 30 |
+
|∫ z, meshRaw T N γ u j z ∂gaussianProduct (Fin (N+1))|≤D := by
|
| 31 |
+
have := gaussianProduct_probability (Fin (N+1))
|
| 32 |
+
simpa [Real.norm_eq_abs] using
|
| 33 |
+
(norm_integral_le_of_norm_le_const (μ := gaussianProduct (Fin (N+1)))
|
| 34 |
+
(Eventually.of_forall (fun z ↦ show ‖meshRaw T N γ u j z‖≤D from by
|
| 35 |
+
simpa only [Real.norm_eq_abs, meshRaw] using hD _ (mesh_time_mem hT hN hj) _)))
|
| 36 |
+
|
| 37 |
+
lemma product_perturbation_bound {a b f D r : ℝ} (hD : 0≤D) (_ : 0≤r)
|
| 38 |
+
(ha : |a|≤D) (hb : |b-1|≤r) (hf : |a-f|≤r) : |a*b-f|≤(D+1)*r := by
|
| 39 |
+
calc
|
| 40 |
+
|a*b-f| = |a*(b-1)+(a-f)| := by congr 1; ring
|
| 41 |
+
_ ≤ |a*(b-1)|+|a-f| := abs_add_le _ _
|
| 42 |
+
_ ≤ D*r+r := by
|
| 43 |
+
rw [abs_mul]
|
| 44 |
+
exact add_le_add (mul_le_mul ha hb (abs_nonneg _) hD) hf
|
| 45 |
+
_ = _ := by ring
|
| 46 |
+
|
| 47 |
+
theorem finiteGaussian_from_strip_and_moments
|
| 48 |
+
{T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ} {f : ℝ → ℝ} {r : ℕ → ℝ}
|
| 49 |
+
(hT : 0<T) (hT1 : T≤1) (h : GradientStrip T γ u K L) (hD0 : 0≤D)
|
| 50 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 51 |
+
(hf : ContinuousOn f (Icc (0 : ℝ) T)) (hr : ∀ N, 0≤r N)
|
| 52 |
+
(hr0 : Tendsto r atTop (𝓝 0))
|
| 53 |
+
(hq : ∀ N, 0<N → ∀ j : Fin N,
|
| 54 |
+
|(∫ z, (meshRaw T N γ u j z)^2 ∂gaussianProduct (Fin (N+1)))-1|≤r N)
|
| 55 |
+
(hm : ∀ N, 0<N → ∀ j : Fin N,
|
| 56 |
+
|(∫ z, meshRaw T N γ u j z ∂gaussianProduct (Fin (N+1)))-f (meshTime T N j)|≤r N) :
|
| 57 |
+
(∀ᶠ N in atTop, ∀ j<N, 0<predictableNormalizer (meshRaw T N γ u j)
|
| 58 |
+
(gaussianProduct (Fin (N+1)))) ∧
|
| 59 |
+
Tendsto (fun N ↦ finiteShiftedValue T N γ u) atTop (𝓝 (∫ t in (0 : ℝ)..T, f t)) := by
|
| 60 |
+
let q (N j : ℕ) := ∫ z, (meshRaw T N γ u j z)^2 ∂gaussianProduct (Fin (N+1))
|
| 61 |
+
have hqpos : ∀ᶠ N in atTop, ∀ j<N, 0<q N j :=
|
| 62 |
+
uniform_moment_positive hr0 (fun N j hj ↦ hq N (by omega) ⟨j,hj⟩)
|
| 63 |
+
constructor
|
| 64 |
+
· filter_upwards [hqpos] with N hN j hj
|
| 65 |
+
exact predictableNormalizer_pos (hN j hj)
|
| 66 |
+
· let A (N : ℕ) (i : Fin (N+1)) := meshA T (N+1) γ u i
|
| 67 |
+
let B (N : ℕ) (i : Fin (N+1)) := meshB T (N+1) γ u i
|
| 68 |
+
let α (N : ℕ) (i : Fin (N+1)) := Real.sqrt (stepSize T (N+1))/
|
| 69 |
+
predictableNormalizer (meshRaw T (N+1) γ u i) (gaussianProduct (Fin ((N+1)+1)))
|
| 70 |
+
let β (N : ℕ) (i : Fin (N+1)) := Real.sqrt (stepSize T (N+1))*
|
| 71 |
+
∫ z, meshRaw T (N+1) γ u i z ∂gaussianProduct (Fin ((N+1)+1))
|
| 72 |
+
let bstar (N : ℕ) := meshB T (N+1) γ u (N+1)
|
| 73 |
+
let e (N : ℕ) := gradientMeshError T (N+1) γ u
|
| 74 |
+
let rend (N : ℕ) := Real.sqrt (stepSize T (N+1))*D
|
| 75 |
+
have hproj : ∀ᶠ N in atTop,
|
| 76 |
+
(∑ i, (A N i-α N i)^2)≤e N ∧ (∑ i, (B N i-β N i)^2)≤e N := by
|
| 77 |
+
filter_upwards [(tendsto_add_atTop_nat 1).eventually hqpos] with N hN
|
| 78 |
+
exact mesh_coefficient_errors hT.le h hD (Nat.succ_pos N) (fun i ↦ hN i i.isLt)
|
| 79 |
+
have hnorm (N : ℕ) : (∑ i, (B N i)^2)≤1 ∧ |bstar N|≤1 :=
|
| 80 |
+
mesh_coefficients_norms hT.le h (Nat.succ_pos N)
|
| 81 |
+
have hαnorm (N : ℕ) : (∑ i, (α N i)^2)≤(Real.sqrt T*D)^2 :=
|
| 82 |
+
mesh_leading_norm hT.le h hD0 hD (Nat.succ_pos N)
|
| 83 |
+
have hend (N : ℕ) : |α N (Fin.last N)|≤rend N := by
|
| 84 |
+
have := gaussianProduct_probability (Fin ((N+1)+1))
|
| 85 |
+
exact sqrt_div_normalizer_bound
|
| 86 |
+
(mesh_raw_memLp hT.le h hD (Nat.succ_pos N) (Nat.le_succ N)) hD0
|
| 87 |
+
(Eventually.of_forall (fun z ↦ hD _ (mesh_time_mem hT.le (Nat.succ_pos N) (Nat.le_succ N)) _))
|
| 88 |
+
have he0 : Tendsto e atTop (𝓝 0) :=
|
| 89 |
+
(gradientMeshError_tendsto_zero hT hT1 h).comp (tendsto_add_atTop_nat 1)
|
| 90 |
+
have hδ0 : Tendsto (fun N : ℕ ↦ stepSize T (N+1)) atTop (𝓝 0) :=
|
| 91 |
+
(tendsto_const_div_atTop_nhds_zero_nat T).comp (tendsto_add_atTop_nat 1)
|
| 92 |
+
have hrend0 : Tendsto rend atTop (𝓝 0) := by
|
| 93 |
+
simpa only [rend, Function.comp_def, Real.sqrt_zero, zero_mul] using
|
| 94 |
+
((Real.continuous_sqrt.tendsto 0).comp hδ0).mul_const D
|
| 95 |
+
have herr := shiftedPairing_tendsto_error_zero
|
| 96 |
+
(fun N ↦ gradientMeshError_nonneg T (N+1) γ u) (mul_nonneg (Real.sqrt_nonneg T) hD0)
|
| 97 |
+
(hproj.mono (fun _ hN ↦ hN.1)) (hproj.mono (fun _ hN ↦ hN.2))
|
| 98 |
+
(Eventually.of_forall (fun N ↦ (hnorm N).1)) (Eventually.of_forall hαnorm)
|
| 99 |
+
(Eventually.of_forall (fun N ↦ (hnorm N).2)) (Eventually.of_forall hend) he0 hrend0
|
| 100 |
+
let v (N : ℕ) (i : Fin N) :=
|
| 101 |
+
(∫ z, meshRaw T (N+1) γ u (i+1) z ∂gaussianProduct (Fin ((N+1)+1)))*Real.sqrt (q (N+1) i)
|
| 102 |
+
have hv (N : ℕ) (i : Fin N) :
|
| 103 |
+
|v N i-f ((i+1 : ℕ)*(T/(N+1)))|≤(D+1)*r (N+1) := by
|
| 104 |
+
apply product_perturbation_bound hD0 (hr (N+1))
|
| 105 |
+
· exact mesh_mean_bound hT.le hD (Nat.succ_pos N) (by omega)
|
| 106 |
+
· exact (abs_sqrt_sub_one_le (integral_nonneg (fun z ↦ sq_nonneg _))).trans
|
| 107 |
+
(hq (N+1) (Nat.succ_pos N) i.castSucc)
|
| 108 |
+
· simpa only [meshTime, stepSize, Fin.val_succ, Nat.cast_add, Nat.cast_one] using
|
| 109 |
+
hm (N+1) (Nat.succ_pos N) i.succ
|
| 110 |
+
have hv0 : Tendsto (fun N ↦ (D+1)*r (N+1)) atTop (𝓝 0) := by
|
| 111 |
+
simpa only [mul_zero, Function.comp_def] using (hr0.comp (tendsto_add_atTop_nat 1)).const_mul (D+1)
|
| 112 |
+
have hvlim := perturbed_shifted_grid_tendsto hT hf
|
| 113 |
+
(fun N ↦ mul_nonneg (by positivity : 0≤D+1) (hr (N+1))) hv0 (Eventually.of_forall hv)
|
| 114 |
+
have hsum (N : ℕ) : (∑ i : Fin N, α N i.castSucc*β N i.succ)=
|
| 115 |
+
(T/(N+1))*∑ i : Fin N, v N i := by
|
| 116 |
+
rw [Finset.mul_sum]
|
| 117 |
+
apply Finset.sum_congr rfl
|
| 118 |
+
intro i _
|
| 119 |
+
have hδ : 0 ≤ stepSize T (N+1) := div_nonneg hT.le (Nat.cast_nonneg _)
|
| 120 |
+
dsimp only [α, β, v, q, predictableNormalizer]
|
| 121 |
+
rw [div_inv_eq_mul]
|
| 122 |
+
calc
|
| 123 |
+
_ = (Real.sqrt (stepSize T (N+1)))^2 *
|
| 124 |
+
((∫ z, meshRaw T (N+1) γ u (i+1) z ∂gaussianProduct (Fin ((N+1)+1)))*
|
| 125 |
+
Real.sqrt (∫ z, (meshRaw T (N+1) γ u i z)^2 ∂gaussianProduct (Fin ((N+1)+1)))) := by
|
| 126 |
+
simp only [Fin.val_castSucc, Fin.val_succ]
|
| 127 |
+
ring
|
| 128 |
+
_ = _ := by rw [Real.sq_sqrt hδ]; simp only [stepSize, Nat.cast_add, Nat.cast_one]
|
| 129 |
+
have hp (N : ℕ) : shiftedPairing (A N) (B N) (bstar N)=finiteShiftedValue T (N+1) γ u := by
|
| 130 |
+
simp only [shiftedPairing, finiteShiftedValue, A, B, bstar]
|
| 131 |
+
rw [Fin.sum_univ_castSucc]
|
| 132 |
+
simp only [Fin.val_castSucc, Fin.val_succ, Fin.val_last]
|
| 133 |
+
simp_rw [hp, hsum] at herr
|
| 134 |
+
have hlim := herr.add hvlim
|
| 135 |
+
simp only [sub_add_cancel, zero_add] at hlim
|
| 136 |
+
exact (tendsto_add_atTop_iff_nat 1).mp hlim
|
| 137 |
+
|
| 138 |
+
end SKValue
|
| 139 |
+
|
| 140 |
+
open MeasureTheory Set Filter Finset
|
| 141 |
+
open scoped Topology BigOperators
|
| 142 |
+
|
| 143 |
+
end
|
| 144 |
+
|
| 145 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/MeshRaw.lean
CHANGED
|
@@ -1,143 +1,143 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.FiniteRounded
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
namespace SKValue
|
| 22 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 23 |
-
open scoped Topology BigOperators
|
| 24 |
-
|
| 25 |
-
noncomputable def meshRaw (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 26 |
-
(j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 27 |
-
deriv (u (meshTime T N j)) (euler T N γ u z j)
|
| 28 |
-
|
| 29 |
-
noncomputable def meshTerminal (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 30 |
-
(z : Fin (N+1) → ℝ) : ℝ := u T (euler T N γ u z N)
|
| 31 |
-
|
| 32 |
-
noncomputable def meshA (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 33 |
-
(j : ℕ) : ℝ :=
|
| 34 |
-
∫ z, finiteRounded (meshTerminal T N γ u) z *
|
| 35 |
-
normalizedIncrement (meshRaw T N γ u j) (coordinate N j) (gaussianProduct (Fin (N+1))) z
|
| 36 |
-
∂gaussianProduct (Fin (N+1))
|
| 37 |
-
|
| 38 |
-
noncomputable def meshB (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 39 |
-
(j : ℕ) : ℝ :=
|
| 40 |
-
∫ z, finiteRounded (meshTerminal T N γ u) z * coordinate N j z ∂gaussianProduct (Fin (N+1))
|
| 41 |
-
|
| 42 |
-
noncomputable def finiteShiftedValue (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) : ℝ :=
|
| 43 |
-
∑ i : Fin N, meshA T N γ u i * meshB T N γ u (i+1)
|
| 44 |
-
|
| 45 |
-
lemma mesh_time_mem {T : ℝ} (hT : 0≤T) {N j : ℕ} (hN : 0<N) (hj : j≤N) :
|
| 46 |
-
meshTime T N j∈Icc (0 : ℝ) T := by
|
| 47 |
-
apply mesh_mem_strip_ito (δ := stepSize T N) (div_nonneg hT (Nat.cast_nonneg N)) _ hj
|
| 48 |
-
have hNr : (N : ℝ)≠0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hN)
|
| 49 |
-
unfold stepSize
|
| 50 |
-
field_simp
|
| 51 |
-
|
| 52 |
-
lemma mesh_terminal_measurable {T K L : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 53 |
-
(hT : 0≤T) (h : GradientStrip T γ u K L) {N : ℕ} (hN : 0<N) :
|
| 54 |
-
Measurable (meshTerminal T N γ u) :=
|
| 55 |
-
(h.smooth T ⟨hT,le_rfl⟩).continuous.measurable.comp
|
| 56 |
-
(measurable_euler T N γ u (fun _ hj ↦
|
| 57 |
-
(h.smooth _ (mesh_time_mem hT hN hj.le)).continuous.measurable) N le_rfl)
|
| 58 |
-
|
| 59 |
-
lemma mesh_raw_measurable {T K L : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 60 |
-
(hT : 0≤T) (h : GradientStrip T γ u K L) {N : ℕ} (hN : 0<N) {j : ℕ} (hj : j≤N) :
|
| 61 |
-
Measurable (meshRaw T N γ u j) :=
|
| 62 |
-
((h.smooth _ (mesh_time_mem hT hN hj)).continuous_deriv (by norm_num)).measurable.comp
|
| 63 |
-
(measurable_euler T N γ u (fun k hk ↦
|
| 64 |
-
(h.smooth _ (mesh_time_mem hT hN hk.le)).continuous.measurable) j hj)
|
| 65 |
-
|
| 66 |
-
lemma mesh_raw_depends (T : ℝ) {N j : ℕ} (hj : j≤N) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) :
|
| 67 |
-
DependsBefore j (meshRaw T N γ u j) :=
|
| 68 |
-
eulerCoefficient_dependsBefore T hj γ u (fun t ↦ deriv (u t))
|
| 69 |
-
|
| 70 |
-
lemma mesh_terminal_depends (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) :
|
| 71 |
-
DependsBefore N (meshTerminal T N γ u) :=
|
| 72 |
-
eulerCoefficient_dependsBefore T le_rfl γ u (fun _ ↦ u T)
|
| 73 |
-
|
| 74 |
-
lemma mesh_raw_memLp {T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 75 |
-
(hT : 0≤T) (h : GradientStrip T γ u K L)
|
| 76 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 77 |
-
{N : ℕ} (hN : 0<N) {j : ℕ} (hj : j≤N) :
|
| 78 |
-
MemLp (meshRaw T N γ u j) 2 (gaussianProduct (Fin (N+1))) := by
|
| 79 |
-
have := gaussianProduct_probability (Fin (N+1))
|
| 80 |
-
apply MemLp.of_bound (mesh_raw_measurable hT h hN hj).aestronglyMeasurable D
|
| 81 |
-
exact Eventually.of_forall (fun z ↦ by
|
| 82 |
-
simpa only [meshRaw, Real.norm_eq_abs] using hD _ (mesh_time_mem hT hN hj) (euler T N γ u z j))
|
| 83 |
-
|
| 84 |
-
lemma mesh_coefficient_errors {T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 85 |
-
(hT : 0≤T) (h : GradientStrip T γ u K L)
|
| 86 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 87 |
-
{N : ℕ} (hN : 0<N)
|
| 88 |
-
(hpos : ∀ j : Fin N, 0<∫ z, (meshRaw T N γ u j z)^2 ∂gaussianProduct (Fin (N+1))) :
|
| 89 |
-
(∑ j : Fin N, (meshA T N γ u j-Real.sqrt (stepSize T N)/
|
| 90 |
-
predictableNormalizer (meshRaw T N γ u j) (gaussianProduct (Fin (N+1))))^2)≤
|
| 91 |
-
gradientMeshError T N γ u ∧
|
| 92 |
-
(∑ j : Fin N, (meshB T N γ u j-Real.sqrt (stepSize T N)*
|
| 93 |
-
∫ z, meshRaw T N γ u j z ∂gaussianProduct (Fin (N+1)))^2)≤
|
| 94 |
-
gradientMeshError T N γ u := by
|
| 95 |
-
exact finite_coefficient_L2_errors
|
| 96 |
-
(fun j ↦ mesh_raw_measurable hT h hN j.isLt.le)
|
| 97 |
-
(fun j ↦ mesh_raw_depends T j.isLt.le γ u)
|
| 98 |
-
(fun j ↦ mesh_raw_memLp hT h hD hN j.isLt.le) hpos
|
| 99 |
-
(mesh_terminal_measurable hT h hN) (mesh_terminal_depends T N γ u)
|
| 100 |
-
(fun z ↦ h.bounded T ⟨hT,le_rfl⟩ _)
|
| 101 |
-
|
| 102 |
-
lemma mesh_coefficients_norms {T K L : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 103 |
-
(hT : 0≤T) (h : GradientStrip T γ u K L) {N : ℕ} (hN : 0<N) :
|
| 104 |
-
(∑ j : Fin N, (meshB T N γ u j)^2)≤1 ∧ |meshB T N γ u N|≤1 :=
|
| 105 |
-
finiteRounded_coordinate_norms (mesh_terminal_measurable hT h hN)
|
| 106 |
-
|
| 107 |
-
lemma mesh_leading_norm {T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 108 |
-
(hT : 0≤T) (h : GradientStrip T γ u K L) (hD0 : 0≤D)
|
| 109 |
-
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 110 |
-
{N : ℕ} (hN : 0<N) :
|
| 111 |
-
(∑ j : Fin N, (Real.sqrt (stepSize T N)/
|
| 112 |
-
predictableNormalizer (meshRaw T N γ u j) (gaussianProduct (Fin (N+1))))^2)≤
|
| 113 |
-
(Real.sqrt T*D)^2 := by
|
| 114 |
-
have := gaussianProduct_probability (Fin (N+1))
|
| 115 |
-
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 116 |
-
calc
|
| 117 |
-
_ ≤ ∑ j : Fin N, (Real.sqrt (stepSize T N)*D)^2 := by
|
| 118 |
-
apply Finset.sum_le_sum
|
| 119 |
-
intro j _
|
| 120 |
-
rw [←sq_abs (Real.sqrt _ / _)]
|
| 121 |
-
apply (sq_le_sq₀ (abs_nonneg _) (mul_nonneg (Real.sqrt_nonneg _) hD0)).2
|
| 122 |
-
exact sqrt_div_normalizer_bound (mesh_raw_memLp hT h hD hN j.isLt.le) hD0
|
| 123 |
-
(Eventually.of_forall (fun z ↦ hD _ (mesh_time_mem hT hN j.isLt.le) _))
|
| 124 |
-
_ = (Real.sqrt T*D)^2 := by
|
| 125 |
-
simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_pow]
|
| 126 |
-
rw [Real.sq_sqrt hδ, Real.sq_sqrt hT]
|
| 127 |
-
unfold stepSize
|
| 128 |
-
have hNr : (N : ℝ)≠0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hN)
|
| 129 |
-
field_simp
|
| 130 |
-
|
| 131 |
-
lemma abs_sqrt_sub_one_le {q : ℝ} (hq : 0≤q) : |Real.sqrt q-1|≤|q-1| := by
|
| 132 |
-
have heq : |q-1|=|Real.sqrt q-1| * (Real.sqrt q+1) := by
|
| 133 |
-
rw [←abs_of_nonneg (by positivity : 0≤Real.sqrt q+1), ←abs_mul]
|
| 134 |
-
congr 1
|
| 135 |
-
nlinarith [Real.sq_sqrt hq]
|
| 136 |
-
rw [heq]
|
| 137 |
-
nlinarith [Real.sqrt_nonneg q, abs_nonneg (Real.sqrt q-1)]
|
| 138 |
-
|
| 139 |
-
end SKValue
|
| 140 |
-
|
| 141 |
-
end
|
| 142 |
-
|
| 143 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.FiniteRounded
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
namespace SKValue
|
| 22 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 23 |
+
open scoped Topology BigOperators
|
| 24 |
+
|
| 25 |
+
noncomputable def meshRaw (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 26 |
+
(j : ℕ) (z : Fin (N+1) → ℝ) : ℝ :=
|
| 27 |
+
deriv (u (meshTime T N j)) (euler T N γ u z j)
|
| 28 |
+
|
| 29 |
+
noncomputable def meshTerminal (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 30 |
+
(z : Fin (N+1) → ℝ) : ℝ := u T (euler T N γ u z N)
|
| 31 |
+
|
| 32 |
+
noncomputable def meshA (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 33 |
+
(j : ℕ) : ℝ :=
|
| 34 |
+
∫ z, finiteRounded (meshTerminal T N γ u) z *
|
| 35 |
+
normalizedIncrement (meshRaw T N γ u j) (coordinate N j) (gaussianProduct (Fin (N+1))) z
|
| 36 |
+
∂gaussianProduct (Fin (N+1))
|
| 37 |
+
|
| 38 |
+
noncomputable def meshB (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ)
|
| 39 |
+
(j : ℕ) : ℝ :=
|
| 40 |
+
∫ z, finiteRounded (meshTerminal T N γ u) z * coordinate N j z ∂gaussianProduct (Fin (N+1))
|
| 41 |
+
|
| 42 |
+
noncomputable def finiteShiftedValue (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) : ℝ :=
|
| 43 |
+
∑ i : Fin N, meshA T N γ u i * meshB T N γ u (i+1)
|
| 44 |
+
|
| 45 |
+
lemma mesh_time_mem {T : ℝ} (hT : 0≤T) {N j : ℕ} (hN : 0<N) (hj : j≤N) :
|
| 46 |
+
meshTime T N j∈Icc (0 : ℝ) T := by
|
| 47 |
+
apply mesh_mem_strip_ito (δ := stepSize T N) (div_nonneg hT (Nat.cast_nonneg N)) _ hj
|
| 48 |
+
have hNr : (N : ℝ)≠0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hN)
|
| 49 |
+
unfold stepSize
|
| 50 |
+
field_simp
|
| 51 |
+
|
| 52 |
+
lemma mesh_terminal_measurable {T K L : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 53 |
+
(hT : 0≤T) (h : GradientStrip T γ u K L) {N : ℕ} (hN : 0<N) :
|
| 54 |
+
Measurable (meshTerminal T N γ u) :=
|
| 55 |
+
(h.smooth T ⟨hT,le_rfl⟩).continuous.measurable.comp
|
| 56 |
+
(measurable_euler T N γ u (fun _ hj ↦
|
| 57 |
+
(h.smooth _ (mesh_time_mem hT hN hj.le)).continuous.measurable) N le_rfl)
|
| 58 |
+
|
| 59 |
+
lemma mesh_raw_measurable {T K L : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 60 |
+
(hT : 0≤T) (h : GradientStrip T γ u K L) {N : ℕ} (hN : 0<N) {j : ℕ} (hj : j≤N) :
|
| 61 |
+
Measurable (meshRaw T N γ u j) :=
|
| 62 |
+
((h.smooth _ (mesh_time_mem hT hN hj)).continuous_deriv (by norm_num)).measurable.comp
|
| 63 |
+
(measurable_euler T N γ u (fun k hk ↦
|
| 64 |
+
(h.smooth _ (mesh_time_mem hT hN hk.le)).continuous.measurable) j hj)
|
| 65 |
+
|
| 66 |
+
lemma mesh_raw_depends (T : ℝ) {N j : ℕ} (hj : j≤N) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) :
|
| 67 |
+
DependsBefore j (meshRaw T N γ u j) :=
|
| 68 |
+
eulerCoefficient_dependsBefore T hj γ u (fun t ↦ deriv (u t))
|
| 69 |
+
|
| 70 |
+
lemma mesh_terminal_depends (T : ℝ) (N : ℕ) (γ : ℝ → ℝ) (u : ℝ → ℝ → ℝ) :
|
| 71 |
+
DependsBefore N (meshTerminal T N γ u) :=
|
| 72 |
+
eulerCoefficient_dependsBefore T le_rfl γ u (fun _ ↦ u T)
|
| 73 |
+
|
| 74 |
+
lemma mesh_raw_memLp {T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 75 |
+
(hT : 0≤T) (h : GradientStrip T γ u K L)
|
| 76 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 77 |
+
{N : ℕ} (hN : 0<N) {j : ℕ} (hj : j≤N) :
|
| 78 |
+
MemLp (meshRaw T N γ u j) 2 (gaussianProduct (Fin (N+1))) := by
|
| 79 |
+
have := gaussianProduct_probability (Fin (N+1))
|
| 80 |
+
apply MemLp.of_bound (mesh_raw_measurable hT h hN hj).aestronglyMeasurable D
|
| 81 |
+
exact Eventually.of_forall (fun z ↦ by
|
| 82 |
+
simpa only [meshRaw, Real.norm_eq_abs] using hD _ (mesh_time_mem hT hN hj) (euler T N γ u z j))
|
| 83 |
+
|
| 84 |
+
lemma mesh_coefficient_errors {T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 85 |
+
(hT : 0≤T) (h : GradientStrip T γ u K L)
|
| 86 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 87 |
+
{N : ℕ} (hN : 0<N)
|
| 88 |
+
(hpos : ∀ j : Fin N, 0<∫ z, (meshRaw T N γ u j z)^2 ∂gaussianProduct (Fin (N+1))) :
|
| 89 |
+
(∑ j : Fin N, (meshA T N γ u j-Real.sqrt (stepSize T N)/
|
| 90 |
+
predictableNormalizer (meshRaw T N γ u j) (gaussianProduct (Fin (N+1))))^2)≤
|
| 91 |
+
gradientMeshError T N γ u ∧
|
| 92 |
+
(∑ j : Fin N, (meshB T N γ u j-Real.sqrt (stepSize T N)*
|
| 93 |
+
∫ z, meshRaw T N γ u j z ∂gaussianProduct (Fin (N+1)))^2)≤
|
| 94 |
+
gradientMeshError T N γ u := by
|
| 95 |
+
exact finite_coefficient_L2_errors
|
| 96 |
+
(fun j ↦ mesh_raw_measurable hT h hN j.isLt.le)
|
| 97 |
+
(fun j ↦ mesh_raw_depends T j.isLt.le γ u)
|
| 98 |
+
(fun j ↦ mesh_raw_memLp hT h hD hN j.isLt.le) hpos
|
| 99 |
+
(mesh_terminal_measurable hT h hN) (mesh_terminal_depends T N γ u)
|
| 100 |
+
(fun z ↦ h.bounded T ⟨hT,le_rfl⟩ _)
|
| 101 |
+
|
| 102 |
+
lemma mesh_coefficients_norms {T K L : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 103 |
+
(hT : 0≤T) (h : GradientStrip T γ u K L) {N : ℕ} (hN : 0<N) :
|
| 104 |
+
(∑ j : Fin N, (meshB T N γ u j)^2)≤1 ∧ |meshB T N γ u N|≤1 :=
|
| 105 |
+
finiteRounded_coordinate_norms (mesh_terminal_measurable hT h hN)
|
| 106 |
+
|
| 107 |
+
lemma mesh_leading_norm {T K L D : ℝ} {γ : ℝ → ℝ} {u : ℝ → ℝ → ℝ}
|
| 108 |
+
(hT : 0≤T) (h : GradientStrip T γ u K L) (hD0 : 0≤D)
|
| 109 |
+
(hD : ∀ t∈Icc (0 : ℝ) T, ∀ x, |deriv (u t) x|≤D)
|
| 110 |
+
{N : ℕ} (hN : 0<N) :
|
| 111 |
+
(∑ j : Fin N, (Real.sqrt (stepSize T N)/
|
| 112 |
+
predictableNormalizer (meshRaw T N γ u j) (gaussianProduct (Fin (N+1))))^2)≤
|
| 113 |
+
(Real.sqrt T*D)^2 := by
|
| 114 |
+
have := gaussianProduct_probability (Fin (N+1))
|
| 115 |
+
have hδ : 0 ≤ stepSize T N := div_nonneg hT (Nat.cast_nonneg N)
|
| 116 |
+
calc
|
| 117 |
+
_ ≤ ∑ j : Fin N, (Real.sqrt (stepSize T N)*D)^2 := by
|
| 118 |
+
apply Finset.sum_le_sum
|
| 119 |
+
intro j _
|
| 120 |
+
rw [←sq_abs (Real.sqrt _ / _)]
|
| 121 |
+
apply (sq_le_sq₀ (abs_nonneg _) (mul_nonneg (Real.sqrt_nonneg _) hD0)).2
|
| 122 |
+
exact sqrt_div_normalizer_bound (mesh_raw_memLp hT h hD hN j.isLt.le) hD0
|
| 123 |
+
(Eventually.of_forall (fun z ↦ hD _ (mesh_time_mem hT hN j.isLt.le) _))
|
| 124 |
+
_ = (Real.sqrt T*D)^2 := by
|
| 125 |
+
simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_pow]
|
| 126 |
+
rw [Real.sq_sqrt hδ, Real.sq_sqrt hT]
|
| 127 |
+
unfold stepSize
|
| 128 |
+
have hNr : (N : ℝ)≠0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hN)
|
| 129 |
+
field_simp
|
| 130 |
+
|
| 131 |
+
lemma abs_sqrt_sub_one_le {q : ℝ} (hq : 0≤q) : |Real.sqrt q-1|≤|q-1| := by
|
| 132 |
+
have heq : |q-1|=|Real.sqrt q-1| * (Real.sqrt q+1) := by
|
| 133 |
+
rw [←abs_of_nonneg (by positivity : 0≤Real.sqrt q+1), ←abs_mul]
|
| 134 |
+
congr 1
|
| 135 |
+
nlinarith [Real.sq_sqrt hq]
|
| 136 |
+
rw [heq]
|
| 137 |
+
nlinarith [Real.sqrt_nonneg q, abs_nonneg (Real.sqrt q-1)]
|
| 138 |
+
|
| 139 |
+
end SKValue
|
| 140 |
+
|
| 141 |
+
end
|
| 142 |
+
|
| 143 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/StripPaths.lean
CHANGED
|
@@ -1,78 +1,78 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.Cutoff
|
| 3 |
-
import OAI.Probability.SKValue.Equations.LipschitzCompMemLpFinite
|
| 4 |
-
import OAI.Probability.SKValue.Processes.Measurable
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set
|
| 10 |
-
open scoped ENNReal NNReal BigOperators
|
| 11 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 12 |
-
open scoped BigOperators Topology
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology BigOperators
|
| 15 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 16 |
-
open scoped Topology ENNReal NNReal
|
| 17 |
-
open Filter Set
|
| 18 |
-
open scoped Topology BigOperators
|
| 19 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 20 |
-
open scoped Topology
|
| 21 |
-
open MeasureTheory Set Filter
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
open MeasureTheory Set Filter Finset
|
| 24 |
-
open scoped Topology BigOperators
|
| 25 |
-
namespace SKValue
|
| 26 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 27 |
-
open scoped Topology BigOperators
|
| 28 |
-
|
| 29 |
-
lemma IsDiffusion.strip_paths {W : BrownianSpace} {γ : OrderParameter}
|
| 30 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {T Lu : ℝ}
|
| 31 |
-
(hT : 0≤T) (hT1 : T<1) (hLu : 0≤Lu)
|
| 32 |
-
(huLip : ∀ t∈Icc (0 : ℝ) T, ∀ s∈Icc (0 : ℝ) T, ∀ x y,
|
| 33 |
-
|gradient W γ s y-gradient W γ t x|≤Lu*(|s-t|+|y-x|)) :
|
| 34 |
-
∀ᵐ ω ∂W.μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 35 |
-
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s ω)) volume 0 T ∧
|
| 36 |
-
(∀ t∈Icc (0 : ℝ) T, X t ω = W.B (Real.toNNReal t) ω+
|
| 37 |
-
∫ s in (0 : ℝ)..t, γ.coeff s*gradient W γ s (X s ω)) ∧ X 0 ω=0 := by
|
| 38 |
-
filter_upwards [hX.2, W.brownian.toIsPreBrownianReal.eval_zero_ae_eq_zero] with ω hω h0
|
| 39 |
-
have hsub : Icc (0 : ℝ) T ⊆ Icc (0 : ℝ) 1 := Icc_subset_Icc le_rfl hT1.le
|
| 40 |
-
refine ⟨hω.1.mono hsub, ?_, fun t ht ↦ hω.2 t (hsub ht), ?_⟩
|
| 41 |
-
· have hj : ContinuousOn (fun p : ℝ×ℝ ↦ gradient W γ p.1 p.2)
|
| 42 |
-
{p | p.1∈Icc (0 : ℝ) T} :=
|
| 43 |
-
derivative_joint_continuous hLu (fun s hs t ht x y ↦ huLip t ht s hs y x)
|
| 44 |
-
have hp : ContinuousOn (fun t : ℝ ↦ (t, X t ω)) (Icc (0 : ℝ) T) :=
|
| 45 |
-
continuousOn_id.prodMk (hω.1.mono hsub)
|
| 46 |
-
have hc : ContinuousOn (fun t ↦ gradient W γ t (X t ω)) (Icc (0 : ℝ) T) := by
|
| 47 |
-
exact ContinuousOn.comp (g := fun p : ℝ×ℝ ↦ gradient W γ p.1 p.2)
|
| 48 |
-
(f := fun t : ℝ ↦ (t, X t ω)) hj hp (fun t ht ↦ ht)
|
| 49 |
-
have hgi : IntervalIntegrable γ.coeff volume 0 T :=
|
| 50 |
-
γ.intervalIntegrable.mono_set (by
|
| 51 |
-
simpa only [uIcc_of_le hT, uIcc_of_le (by norm_num : (0 : ℝ)≤1)] using
|
| 52 |
-
(Icc_subset_Icc le_rfl hT1.le))
|
| 53 |
-
exact hgi.mul_continuousOn (by simpa only [uIcc_of_le hT] using hc)
|
| 54 |
-
· simpa only [intervalIntegral.integral_same, add_zero, Real.toNNReal_zero, h0]
|
| 55 |
-
using hω.2 0 (by norm_num)
|
| 56 |
-
|
| 57 |
-
lemma IsDiffusion.value_expectation {W : BrownianSpace} {γ : OrderParameter}
|
| 58 |
-
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {T K L Kg Lg Lu : ℝ}
|
| 59 |
-
(hT : 0<T) (hT1 : T<1)
|
| 60 |
-
(h : ValueStrip T γ.coeff (phi W γ) K L)
|
| 61 |
-
(hg : GradientStrip T γ.coeff (gradient W γ) Kg Lg)
|
| 62 |
-
(hLu : 0≤Lu)
|
| 63 |
-
(huLip : ∀ t∈Icc (0 : ℝ) T, ∀ s∈Icc (0 : ℝ) T, ∀ x y,
|
| 64 |
-
|gradient W γ s y-gradient W γ t x|≤Lu*(|s-t|+|y-x|)) :
|
| 65 |
-
(∫ ω, phi W γ T (X T ω) ∂W.μ) = phi W γ 0 0+
|
| 66 |
-
(1/2 : ℝ)*(∫ t in (0 : ℝ)..T, γ.coeff t*(∫ ω, (gradient W γ t (X t ω))^2 ∂W.μ)) := by
|
| 67 |
-
apply diffusion_value_expectation (μ := W.μ) (B := W.B) (X := X)
|
| 68 |
-
W.brownian.toIsPreBrownianReal hT hT1.le h hg hLu
|
| 69 |
-
(fun s hs t ht x y ↦ huLip t ht s hs y x)
|
| 70 |
-
· intro t ht
|
| 71 |
-
exact hX.memLp ⟨ht.1,ht.2.trans hT1.le⟩ (by norm_num)
|
| 72 |
-
· exact hX.strip_paths hT.le hT1 hLu huLip
|
| 73 |
-
|
| 74 |
-
end SKValue
|
| 75 |
-
|
| 76 |
-
end
|
| 77 |
-
|
| 78 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.Cutoff
|
| 3 |
+
import OAI.Probability.SKValue.Equations.LipschitzCompMemLpFinite
|
| 4 |
+
import OAI.Probability.SKValue.Processes.Measurable
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set
|
| 10 |
+
open scoped ENNReal NNReal BigOperators
|
| 11 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 12 |
+
open scoped BigOperators Topology
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology BigOperators
|
| 15 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 16 |
+
open scoped Topology ENNReal NNReal
|
| 17 |
+
open Filter Set
|
| 18 |
+
open scoped Topology BigOperators
|
| 19 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 20 |
+
open scoped Topology
|
| 21 |
+
open MeasureTheory Set Filter
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
open MeasureTheory Set Filter Finset
|
| 24 |
+
open scoped Topology BigOperators
|
| 25 |
+
namespace SKValue
|
| 26 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 27 |
+
open scoped Topology BigOperators
|
| 28 |
+
|
| 29 |
+
lemma IsDiffusion.strip_paths {W : BrownianSpace} {γ : OrderParameter}
|
| 30 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {T Lu : ℝ}
|
| 31 |
+
(hT : 0≤T) (hT1 : T<1) (hLu : 0≤Lu)
|
| 32 |
+
(huLip : ∀ t∈Icc (0 : ℝ) T, ∀ s∈Icc (0 : ℝ) T, ∀ x y,
|
| 33 |
+
|gradient W γ s y-gradient W γ t x|≤Lu*(|s-t|+|y-x|)) :
|
| 34 |
+
∀ᵐ ω ∂W.μ, ContinuousOn (fun t ↦ X t ω) (Icc (0 : ℝ) T) ∧
|
| 35 |
+
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s ω)) volume 0 T ∧
|
| 36 |
+
(∀ t∈Icc (0 : ℝ) T, X t ω = W.B (Real.toNNReal t) ω+
|
| 37 |
+
∫ s in (0 : ℝ)..t, γ.coeff s*gradient W γ s (X s ω)) ∧ X 0 ω=0 := by
|
| 38 |
+
filter_upwards [hX.2, W.brownian.toIsPreBrownianReal.eval_zero_ae_eq_zero] with ω hω h0
|
| 39 |
+
have hsub : Icc (0 : ℝ) T ⊆ Icc (0 : ℝ) 1 := Icc_subset_Icc le_rfl hT1.le
|
| 40 |
+
refine ⟨hω.1.mono hsub, ?_, fun t ht ↦ hω.2 t (hsub ht), ?_⟩
|
| 41 |
+
· have hj : ContinuousOn (fun p : ℝ×ℝ ↦ gradient W γ p.1 p.2)
|
| 42 |
+
{p | p.1∈Icc (0 : ℝ) T} :=
|
| 43 |
+
derivative_joint_continuous hLu (fun s hs t ht x y ↦ huLip t ht s hs y x)
|
| 44 |
+
have hp : ContinuousOn (fun t : ℝ ↦ (t, X t ω)) (Icc (0 : ℝ) T) :=
|
| 45 |
+
continuousOn_id.prodMk (hω.1.mono hsub)
|
| 46 |
+
have hc : ContinuousOn (fun t ↦ gradient W γ t (X t ω)) (Icc (0 : ℝ) T) := by
|
| 47 |
+
exact ContinuousOn.comp (g := fun p : ℝ×ℝ ↦ gradient W γ p.1 p.2)
|
| 48 |
+
(f := fun t : ℝ ↦ (t, X t ω)) hj hp (fun t ht ↦ ht)
|
| 49 |
+
have hgi : IntervalIntegrable γ.coeff volume 0 T :=
|
| 50 |
+
γ.intervalIntegrable.mono_set (by
|
| 51 |
+
simpa only [uIcc_of_le hT, uIcc_of_le (by norm_num : (0 : ℝ)≤1)] using
|
| 52 |
+
(Icc_subset_Icc le_rfl hT1.le))
|
| 53 |
+
exact hgi.mul_continuousOn (by simpa only [uIcc_of_le hT] using hc)
|
| 54 |
+
· simpa only [intervalIntegral.integral_same, add_zero, Real.toNNReal_zero, h0]
|
| 55 |
+
using hω.2 0 (by norm_num)
|
| 56 |
+
|
| 57 |
+
lemma IsDiffusion.value_expectation {W : BrownianSpace} {γ : OrderParameter}
|
| 58 |
+
{X : ℝ → W.Ω → ℝ} (hX : IsDiffusion W γ X) {T K L Kg Lg Lu : ℝ}
|
| 59 |
+
(hT : 0<T) (hT1 : T<1)
|
| 60 |
+
(h : ValueStrip T γ.coeff (phi W γ) K L)
|
| 61 |
+
(hg : GradientStrip T γ.coeff (gradient W γ) Kg Lg)
|
| 62 |
+
(hLu : 0≤Lu)
|
| 63 |
+
(huLip : ∀ t∈Icc (0 : ℝ) T, ∀ s∈Icc (0 : ℝ) T, ∀ x y,
|
| 64 |
+
|gradient W γ s y-gradient W γ t x|≤Lu*(|s-t|+|y-x|)) :
|
| 65 |
+
(∫ ω, phi W γ T (X T ω) ∂W.μ) = phi W γ 0 0+
|
| 66 |
+
(1/2 : ℝ)*(∫ t in (0 : ℝ)..T, γ.coeff t*(∫ ω, (gradient W γ t (X t ω))^2 ∂W.μ)) := by
|
| 67 |
+
apply diffusion_value_expectation (μ := W.μ) (B := W.B) (X := X)
|
| 68 |
+
W.brownian.toIsPreBrownianReal hT hT1.le h hg hLu
|
| 69 |
+
(fun s hs t ht x y ↦ huLip t ht s hs y x)
|
| 70 |
+
· intro t ht
|
| 71 |
+
exact hX.memLp ⟨ht.1,ht.2.trans hT1.le⟩ (by norm_num)
|
| 72 |
+
· exact hX.strip_paths hT.le hT1 hLu huLip
|
| 73 |
+
|
| 74 |
+
end SKValue
|
| 75 |
+
|
| 76 |
+
end
|
| 77 |
+
|
| 78 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/TerminalCondExp.lean
CHANGED
|
@@ -1,105 +1,105 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.UnitMomentMartingale
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
variable {Ω : Type*} {m : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 25 |
-
variable {ℱ : Filtration ℝ m} {f : ℝ → Ω → ℝ}
|
| 26 |
-
|
| 27 |
-
lemma UnitMomentMartingale.terminal_condExp
|
| 28 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 29 |
-
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 30 |
-
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 31 |
-
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω)))
|
| 32 |
-
{s : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) : μ[U | ℱ s] =ᵐ[μ] f s := by
|
| 33 |
-
have hUi : Integrable U μ := Integrable.of_bound (hUm.mono (ℱ.le _)).aestronglyMeasurable 1
|
| 34 |
-
(hU.mono (fun ω hω ↦ (Real.norm_eq_abs _).trans_le hω.1))
|
| 35 |
-
apply Filter.EventuallyEq.symm
|
| 36 |
-
apply ae_eq_condExp_of_forall_setIntegral_eq (ℱ.le s) hUi
|
| 37 |
-
(fun S _ _ ↦ (h.integrable hs).integrableOn) _ (h.measurable s hs).aestronglyMeasurable
|
| 38 |
-
intro S hS _
|
| 39 |
-
have hlim : Tendsto (fun n ↦ ∫ ω in S, f (terminalTime n) ω ∂μ) atTop (𝓝 (∫ ω in S, U ω ∂μ)) :=
|
| 40 |
-
tendsto_integral_of_dominated_convergence (fun _ : Ω ↦ (1 : ℝ))
|
| 41 |
-
(fun n ↦ ((h.measurable _ (terminalTime_mem n)).mono (ℱ.le _)).aestronglyMeasurable.restrict)
|
| 42 |
-
(integrable_const 1)
|
| 43 |
-
(fun n ↦ Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le
|
| 44 |
-
(h.bounded _ (terminalTime_mem n) ω)))
|
| 45 |
-
(ae_restrict_of_ae (hU.mono (fun _ hω ↦ hω.2)))
|
| 46 |
-
have he : ∀ᶠ n in atTop, (∫ ω in S, f (terminalTime n) ω ∂μ) = ∫ ω in S, f s ω ∂μ := by
|
| 47 |
-
have hsn : ∀ᶠ n in atTop, s ≤ terminalTime n :=
|
| 48 |
-
((tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1.eventually (Ioi_mem_nhds hs.2)).mono
|
| 49 |
-
(fun _ hn ↦ hn.le)
|
| 50 |
-
filter_upwards [hsn] with n hn
|
| 51 |
-
calc
|
| 52 |
-
_ = ∫ ω in S, μ[f (terminalTime n) | ℱ s] ω ∂μ :=
|
| 53 |
-
(setIntegral_condExp (ℱ.le s) (h.integrable (terminalTime_mem n)) hS).symm
|
| 54 |
-
_ = _ := integral_congr_ae (ae_restrict_of_ae (h.condExp s hs _ (terminalTime_mem n) hn))
|
| 55 |
-
exact tendsto_nhds_unique (tendsto_const_nhds.congr' (Filter.EventuallyEq.symm he)) hlim
|
| 56 |
-
|
| 57 |
-
lemma UnitMomentMartingale.terminal_stopped_martingale
|
| 58 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 59 |
-
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 60 |
-
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 61 |
-
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω))) :
|
| 62 |
-
Martingale (fun t : ℝ≥0 ↦ fun ω ↦ if (t : ℝ)<1 then f t ω else U ω)
|
| 63 |
-
(⟨fun t : ℝ≥0 ↦ ℱ t,fun _ _ hij ↦ ℱ.mono hij,fun t ↦ ℱ.le t⟩ :
|
| 64 |
-
Filtration ℝ≥0 m) μ := by
|
| 65 |
-
have hUi : Integrable U μ := Integrable.of_bound (hUm.mono (ℱ.le _)).aestronglyMeasurable 1
|
| 66 |
-
(hU.mono (fun ω hω ↦ (Real.norm_eq_abs _).trans_le hω.1))
|
| 67 |
-
constructor
|
| 68 |
-
· intro t
|
| 69 |
-
by_cases ht : (t : ℝ)<1
|
| 70 |
-
· simpa only [ht,ite_true,ite_false] using h.measurable t ⟨t.coe_nonneg,ht⟩
|
| 71 |
-
· simpa only [ht,ite_true,ite_false] using hUm.mono (ℱ.mono (not_lt.mp ht))
|
| 72 |
-
· intro s t hst
|
| 73 |
-
by_cases hs : (s : ℝ)<1
|
| 74 |
-
· by_cases ht : (t : ℝ)<1
|
| 75 |
-
· simpa only [hs,ht,ite_true,ite_false] using
|
| 76 |
-
h.condExp s ⟨s.coe_nonneg,hs⟩ t ⟨t.coe_nonneg,ht⟩ hst
|
| 77 |
-
· simpa only [hs,ht,ite_true,ite_false] using h.terminal_condExp hUm hU ⟨s.coe_nonneg,hs⟩
|
| 78 |
-
· have ht : ¬(t : ℝ)<1 := not_lt.mpr ((not_lt.mp hs).trans hst)
|
| 79 |
-
have he := condExp_of_stronglyMeasurable (ℱ.le s)
|
| 80 |
-
(hUm.mono (ℱ.mono (not_lt.mp hs))) hUi
|
| 81 |
-
simpa only [hs,ht,ite_true,ite_false] using Filter.EventuallyEq.of_eq he
|
| 82 |
-
|
| 83 |
-
lemma UnitMomentMartingale.exists_terminal
|
| 84 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 85 |
-
(hc : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ f t ω) (Ico (0 : ℝ) 1)) :
|
| 86 |
-
∃ U : Ω → ℝ, StronglyMeasurable[ℱ 1] U ∧
|
| 87 |
-
Martingale (fun t : ℝ≥0 ↦ fun ω ↦ if (t : ℝ)<1 then f t ω else U ω)
|
| 88 |
-
(⟨fun t : ℝ≥0 ↦ ℱ t,fun _ _ hij ↦ ℱ.mono hij,fun t ↦ ℱ.le t⟩ :
|
| 89 |
-
Filtration ℝ≥0 m) μ ∧
|
| 90 |
-
(∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧ (U ω)^2=1 ∧
|
| 91 |
-
Tendsto (fun t ↦ f t ω) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) ∧
|
| 92 |
-
Tendsto (fun t ↦ ∫ ω, (f t ω-U ω)^2 ∂μ) (𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 93 |
-
obtain ⟨U,hUm,hU⟩ := h.exists_continuous_terminal hc
|
| 94 |
-
have hseq : ∀ᵐ ω ∂μ, |U ω|≤1 ∧
|
| 95 |
-
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω)) :=
|
| 96 |
-
hU.mono (fun ω hω ↦ ⟨hω.1,hω.2.comp terminalTime_tendsto⟩)
|
| 97 |
-
refine ⟨U,hUm,h.terminal_stopped_martingale hUm hseq,?_,h.terminal_mean_square hUm hU⟩
|
| 98 |
-
filter_upwards [hU,h.terminal_square hUm hseq] with ω hω hsq
|
| 99 |
-
exact ⟨hω.1,hsq,hω.2⟩
|
| 100 |
-
|
| 101 |
-
end SKValue
|
| 102 |
-
|
| 103 |
-
end
|
| 104 |
-
|
| 105 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.UnitMomentMartingale
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
variable {Ω : Type*} {m : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 25 |
+
variable {ℱ : Filtration ℝ m} {f : ℝ → Ω → ℝ}
|
| 26 |
+
|
| 27 |
+
lemma UnitMomentMartingale.terminal_condExp
|
| 28 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 29 |
+
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 30 |
+
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 31 |
+
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω)))
|
| 32 |
+
{s : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) : μ[U | ℱ s] =ᵐ[μ] f s := by
|
| 33 |
+
have hUi : Integrable U μ := Integrable.of_bound (hUm.mono (ℱ.le _)).aestronglyMeasurable 1
|
| 34 |
+
(hU.mono (fun ω hω ↦ (Real.norm_eq_abs _).trans_le hω.1))
|
| 35 |
+
apply Filter.EventuallyEq.symm
|
| 36 |
+
apply ae_eq_condExp_of_forall_setIntegral_eq (ℱ.le s) hUi
|
| 37 |
+
(fun S _ _ ↦ (h.integrable hs).integrableOn) _ (h.measurable s hs).aestronglyMeasurable
|
| 38 |
+
intro S hS _
|
| 39 |
+
have hlim : Tendsto (fun n ↦ ∫ ω in S, f (terminalTime n) ω ∂μ) atTop (𝓝 (∫ ω in S, U ω ∂μ)) :=
|
| 40 |
+
tendsto_integral_of_dominated_convergence (fun _ : Ω ↦ (1 : ℝ))
|
| 41 |
+
(fun n ↦ ((h.measurable _ (terminalTime_mem n)).mono (ℱ.le _)).aestronglyMeasurable.restrict)
|
| 42 |
+
(integrable_const 1)
|
| 43 |
+
(fun n ↦ Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le
|
| 44 |
+
(h.bounded _ (terminalTime_mem n) ω)))
|
| 45 |
+
(ae_restrict_of_ae (hU.mono (fun _ hω ↦ hω.2)))
|
| 46 |
+
have he : ∀ᶠ n in atTop, (∫ ω in S, f (terminalTime n) ω ∂μ) = ∫ ω in S, f s ω ∂μ := by
|
| 47 |
+
have hsn : ∀ᶠ n in atTop, s ≤ terminalTime n :=
|
| 48 |
+
((tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1.eventually (Ioi_mem_nhds hs.2)).mono
|
| 49 |
+
(fun _ hn ↦ hn.le)
|
| 50 |
+
filter_upwards [hsn] with n hn
|
| 51 |
+
calc
|
| 52 |
+
_ = ∫ ω in S, μ[f (terminalTime n) | ℱ s] ω ∂μ :=
|
| 53 |
+
(setIntegral_condExp (ℱ.le s) (h.integrable (terminalTime_mem n)) hS).symm
|
| 54 |
+
_ = _ := integral_congr_ae (ae_restrict_of_ae (h.condExp s hs _ (terminalTime_mem n) hn))
|
| 55 |
+
exact tendsto_nhds_unique (tendsto_const_nhds.congr' (Filter.EventuallyEq.symm he)) hlim
|
| 56 |
+
|
| 57 |
+
lemma UnitMomentMartingale.terminal_stopped_martingale
|
| 58 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 59 |
+
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 60 |
+
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 61 |
+
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω))) :
|
| 62 |
+
Martingale (fun t : ℝ≥0 ↦ fun ω ↦ if (t : ℝ)<1 then f t ω else U ω)
|
| 63 |
+
(⟨fun t : ℝ≥0 ↦ ℱ t,fun _ _ hij ↦ ℱ.mono hij,fun t ↦ ℱ.le t⟩ :
|
| 64 |
+
Filtration ℝ≥0 m) μ := by
|
| 65 |
+
have hUi : Integrable U μ := Integrable.of_bound (hUm.mono (ℱ.le _)).aestronglyMeasurable 1
|
| 66 |
+
(hU.mono (fun ω hω ↦ (Real.norm_eq_abs _).trans_le hω.1))
|
| 67 |
+
constructor
|
| 68 |
+
· intro t
|
| 69 |
+
by_cases ht : (t : ℝ)<1
|
| 70 |
+
· simpa only [ht,ite_true,ite_false] using h.measurable t ⟨t.coe_nonneg,ht⟩
|
| 71 |
+
· simpa only [ht,ite_true,ite_false] using hUm.mono (ℱ.mono (not_lt.mp ht))
|
| 72 |
+
· intro s t hst
|
| 73 |
+
by_cases hs : (s : ℝ)<1
|
| 74 |
+
· by_cases ht : (t : ℝ)<1
|
| 75 |
+
· simpa only [hs,ht,ite_true,ite_false] using
|
| 76 |
+
h.condExp s ⟨s.coe_nonneg,hs⟩ t ⟨t.coe_nonneg,ht⟩ hst
|
| 77 |
+
· simpa only [hs,ht,ite_true,ite_false] using h.terminal_condExp hUm hU ⟨s.coe_nonneg,hs⟩
|
| 78 |
+
· have ht : ¬(t : ℝ)<1 := not_lt.mpr ((not_lt.mp hs).trans hst)
|
| 79 |
+
have he := condExp_of_stronglyMeasurable (ℱ.le s)
|
| 80 |
+
(hUm.mono (ℱ.mono (not_lt.mp hs))) hUi
|
| 81 |
+
simpa only [hs,ht,ite_true,ite_false] using Filter.EventuallyEq.of_eq he
|
| 82 |
+
|
| 83 |
+
lemma UnitMomentMartingale.exists_terminal
|
| 84 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 85 |
+
(hc : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ f t ω) (Ico (0 : ℝ) 1)) :
|
| 86 |
+
∃ U : Ω → ℝ, StronglyMeasurable[ℱ 1] U ∧
|
| 87 |
+
Martingale (fun t : ℝ≥0 ↦ fun ω ↦ if (t : ℝ)<1 then f t ω else U ω)
|
| 88 |
+
(⟨fun t : ℝ≥0 ↦ ℱ t,fun _ _ hij ↦ ℱ.mono hij,fun t ↦ ℱ.le t⟩ :
|
| 89 |
+
Filtration ℝ≥0 m) μ ∧
|
| 90 |
+
(∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧ (U ω)^2=1 ∧
|
| 91 |
+
Tendsto (fun t ↦ f t ω) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) ∧
|
| 92 |
+
Tendsto (fun t ↦ ∫ ω, (f t ω-U ω)^2 ∂μ) (𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 93 |
+
obtain ⟨U,hUm,hU⟩ := h.exists_continuous_terminal hc
|
| 94 |
+
have hseq : ∀ᵐ ω ∂μ, |U ω|≤1 ∧
|
| 95 |
+
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω)) :=
|
| 96 |
+
hU.mono (fun ω hω ↦ ⟨hω.1,hω.2.comp terminalTime_tendsto⟩)
|
| 97 |
+
refine ⟨U,hUm,h.terminal_stopped_martingale hUm hseq,?_,h.terminal_mean_square hUm hU⟩
|
| 98 |
+
filter_upwards [hU,h.terminal_square hUm hseq] with ω hω hsq
|
| 99 |
+
exact ⟨hω.1,hsq,hω.2⟩
|
| 100 |
+
|
| 101 |
+
end SKValue
|
| 102 |
+
|
| 103 |
+
end
|
| 104 |
+
|
| 105 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/TestDiffusion.lean
CHANGED
|
@@ -1,57 +1,57 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Gaussian.CoupledCoordinates
|
| 3 |
-
import OAI.Probability.SKValue.Evolution.BoundedSmooth
|
| 4 |
-
import OAI.Probability.SKValue.Equations.TestGenerator
|
| 5 |
-
import OAI.Probability.SKValue.Processes.TestExpectation
|
| 6 |
-
|
| 7 |
-
namespace OAI
|
| 8 |
-
|
| 9 |
-
section
|
| 10 |
-
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology NNReal
|
| 13 |
-
namespace SKValue
|
| 14 |
-
lemma BackwardTest.diffusion_expectation {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 15 |
-
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 16 |
-
{X:ℝ → Ω → ℝ} {T K L K' L' Lu:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 17 |
-
(hT:0<T) (hT1:T≤1) (hu:GradientStrip T γ u K L) (h:BackwardTest T γ u V K' L')
|
| 18 |
-
(hLu:0≤Lu) (hLip:∀ s∈Icc (0:ℝ) T,∀ t∈Icc (0:ℝ) T,∀ x y,
|
| 19 |
-
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 20 |
-
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 21 |
-
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) T) ∧
|
| 22 |
-
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 23 |
-
(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 24 |
-
(∫ ω,V T (X T ω) ∂μ)=V 0 0 := by
|
| 25 |
-
let A := fun N ↦ ∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))
|
| 26 |
-
let E := fun N ↦ T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L')+
|
| 27 |
-
stepSize T N*K'*(γ T-γ 0)
|
| 28 |
-
let F := fun N ↦ K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)
|
| 29 |
-
have hδ:Tendsto (fun N:ℕ ↦ stepSize T N) atTop (𝓝 (0:ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 30 |
-
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 31 |
-
have hE:Tendsto E atTop (𝓝 0) := by
|
| 32 |
-
simpa only [E,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,add_zero] using
|
| 33 |
-
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L'))).add
|
| 34 |
-
((hδ.mul_const K').mul_const (γ T-γ 0)))
|
| 35 |
-
have hF:Tendsto F atTop (𝓝 0) := by
|
| 36 |
-
simpa only [F,Function.comp_def,Real.sqrt_zero,mul_zero] using
|
| 37 |
-
(((Real.continuous_sqrt.tendsto 0).comp
|
| 38 |
-
(coupled_euler_L2_convergence hB hT hu hLu hLip hXM hpaths)).const_mul K')
|
| 39 |
-
have hbound:∀ᶠ N in atTop,|(∫ ω,V T (X T ω) ∂μ)-V 0 0|≤E N+F N := by
|
| 40 |
-
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 41 |
-
have he := h.mesh_expectation hT hT1 hN
|
| 42 |
-
have hf := h.coupled_terminal_error hB hT hu hXM
|
| 43 |
-
(by filter_upwards [hpaths] with ω hω using hω.2.2) hN
|
| 44 |
-
have ht := abs_sub_le (∫ ω,V T (X T ω) ∂μ) (A N) (V 0 0)
|
| 45 |
-
change |A N-V 0 0|≤E N at he
|
| 46 |
-
change |A N-(∫ ω,V T (X T ω) ∂μ)|≤F N at hf
|
| 47 |
-
have hf' : |(∫ ω,V T (X T ω) ∂μ)-A N|≤F N := by
|
| 48 |
-
rw [abs_sub_comm];exact hf
|
| 49 |
-
linarith
|
| 50 |
-
have hz := le_of_tendsto_of_tendsto tendsto_const_nhds (hE.add hF) hbound
|
| 51 |
-
have habs:|(∫ ω,V T (X T ω) ∂μ)-V 0 0|=0 := le_antisymm (by simpa using hz) (abs_nonneg _)
|
| 52 |
-
exact sub_eq_zero.mp (abs_eq_zero.mp habs)
|
| 53 |
-
end SKValue
|
| 54 |
-
|
| 55 |
-
end
|
| 56 |
-
|
| 57 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Gaussian.CoupledCoordinates
|
| 3 |
+
import OAI.Probability.SKValue.Evolution.BoundedSmooth
|
| 4 |
+
import OAI.Probability.SKValue.Equations.TestGenerator
|
| 5 |
+
import OAI.Probability.SKValue.Processes.TestExpectation
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
section
|
| 10 |
+
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology NNReal
|
| 13 |
+
namespace SKValue
|
| 14 |
+
lemma BackwardTest.diffusion_expectation {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 15 |
+
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 16 |
+
{X:ℝ → Ω → ℝ} {T K L K' L' Lu:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 17 |
+
(hT:0<T) (hT1:T≤1) (hu:GradientStrip T γ u K L) (h:BackwardTest T γ u V K' L')
|
| 18 |
+
(hLu:0≤Lu) (hLip:∀ s∈Icc (0:ℝ) T,∀ t∈Icc (0:ℝ) T,∀ x y,
|
| 19 |
+
|u s x-u t y|≤Lu*(|s-t|+|x-y|))
|
| 20 |
+
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 21 |
+
(hpaths:∀ᵐ ω ∂μ,ContinuousOn (fun t ↦ X t ω) (Icc (0:ℝ) T) ∧
|
| 22 |
+
IntervalIntegrable (fun s ↦ γ s*u s (X s ω)) volume 0 T ∧
|
| 23 |
+
(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) :
|
| 24 |
+
(∫ ω,V T (X T ω) ∂μ)=V 0 0 := by
|
| 25 |
+
let A := fun N ↦ ∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))
|
| 26 |
+
let E := fun N ↦ T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L')+
|
| 27 |
+
stepSize T N*K'*(γ T-γ 0)
|
| 28 |
+
let F := fun N ↦ K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ)
|
| 29 |
+
have hδ:Tendsto (fun N:ℕ ↦ stepSize T N) atTop (𝓝 (0:ℝ)) := tendsto_const_div_atTop_nhds_zero_nat T
|
| 30 |
+
have hsqrt := (Real.continuous_sqrt.tendsto 0).comp hδ
|
| 31 |
+
have hE:Tendsto E atTop (𝓝 0) := by
|
| 32 |
+
simpa only [E,Function.comp_def,Real.sqrt_zero,mul_zero,zero_mul,add_zero] using
|
| 33 |
+
(((hsqrt.const_mul T).mul_const (cubicEnvelopeMean (γ T) K' ((1/2+γ T)*L'))).add
|
| 34 |
+
((hδ.mul_const K').mul_const (γ T-γ 0)))
|
| 35 |
+
have hF:Tendsto F atTop (𝓝 0) := by
|
| 36 |
+
simpa only [F,Function.comp_def,Real.sqrt_zero,mul_zero] using
|
| 37 |
+
(((Real.continuous_sqrt.tendsto 0).comp
|
| 38 |
+
(coupled_euler_L2_convergence hB hT hu hLu hLip hXM hpaths)).const_mul K')
|
| 39 |
+
have hbound:∀ᶠ N in atTop,|(∫ ω,V T (X T ω) ∂μ)-V 0 0|≤E N+F N := by
|
| 40 |
+
filter_upwards [eventually_gt_atTop 0] with N hN
|
| 41 |
+
have he := h.mesh_expectation hT hT1 hN
|
| 42 |
+
have hf := h.coupled_terminal_error hB hT hu hXM
|
| 43 |
+
(by filter_upwards [hpaths] with ω hω using hω.2.2) hN
|
| 44 |
+
have ht := abs_sub_le (∫ ω,V T (X T ω) ∂μ) (A N) (V 0 0)
|
| 45 |
+
change |A N-V 0 0|≤E N at he
|
| 46 |
+
change |A N-(∫ ω,V T (X T ω) ∂μ)|≤F N at hf
|
| 47 |
+
have hf' : |(∫ ω,V T (X T ω) ∂μ)-A N|≤F N := by
|
| 48 |
+
rw [abs_sub_comm];exact hf
|
| 49 |
+
linarith
|
| 50 |
+
have hz := le_of_tendsto_of_tendsto tendsto_const_nhds (hE.add hF) hbound
|
| 51 |
+
have habs:|(∫ ω,V T (X T ω) ∂μ)-V 0 0|=0 := le_antisymm (by simpa using hz) (abs_nonneg _)
|
| 52 |
+
exact sub_eq_zero.mp (abs_eq_zero.mp habs)
|
| 53 |
+
end SKValue
|
| 54 |
+
|
| 55 |
+
end
|
| 56 |
+
|
| 57 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/TestExpectation.lean
CHANGED
|
@@ -1,191 +1,191 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Processes.CrossMesh
|
| 3 |
-
import OAI.Probability.SKValue.Equations.TestGenerator
|
| 4 |
-
|
| 5 |
-
namespace OAI
|
| 6 |
-
|
| 7 |
-
section
|
| 8 |
-
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
-
open scoped Topology BigOperators NNReal
|
| 11 |
-
namespace SKValue
|
| 12 |
-
lemma BackwardTest.expectation_step {T K L t δ:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 13 |
-
(h:BackwardTest T γ u V K L) (ht:0≤t) (hδ:0≤δ) (hδ1:δ≤1) (htδ:t+δ≤T)
|
| 14 |
-
{N j:ℕ} (hj:j<N+1) {Y:(Fin (N+1) → ℝ) → ℝ}
|
| 15 |
-
(hYm:Measurable Y) (hYp:DependsBefore j Y) :
|
| 16 |
-
let μ := gaussianProduct (Fin (N+1))
|
| 17 |
-
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 18 |
-
|(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)|≤
|
| 19 |
-
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 20 |
-
let μ := gaussianProduct (Fin (N+1))
|
| 21 |
-
let p := fun z ↦ deriv (V t) (Y z)
|
| 22 |
-
let a := fun z ↦ deriv (deriv (V t)) (Y z)
|
| 23 |
-
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 24 |
-
let P := fun z ↦ Real.sqrt δ*rawIncrement p j z
|
| 25 |
-
let Q := fun z ↦ (δ/2)*(a z*((coordinate N j z)^2-1))
|
| 26 |
-
let D := fun z ↦ V (t+δ) (Y' z)-V t (Y z)
|
| 27 |
-
let R := fun z ↦ D z-P z-Q z
|
| 28 |
-
let E := fun z ↦ δ*Real.sqrt δ*cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z)+δ*K*(γ (t+δ)-γ t)
|
| 29 |
-
have htT:t≤T := (le_add_of_nonneg_right hδ).trans htδ
|
| 30 |
-
have htm:t∈Icc (0:ℝ) T := ⟨ht,htT⟩
|
| 31 |
-
have hem:t+δ∈Icc (0:ℝ) T := ⟨by linarith,htδ⟩
|
| 32 |
-
have hpm:Measurable p := ((h.smooth t htm).continuous_deriv (by norm_num)).measurable.comp hYm
|
| 33 |
-
have ham:Measurable a := by
|
| 34 |
-
have hh := (h.smooth t htm).continuous_iteratedDeriv 2 (by norm_num)
|
| 35 |
-
simp only [show (2:ℕ)=1+1 from rfl,iteratedDeriv_succ] at hh
|
| 36 |
-
exact hh.measurable.comp hYm
|
| 37 |
-
have hpM:MemLp p 2 μ := MemLp.of_bound hpm.aestronglyMeasurable K
|
| 38 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound t htm (Y z)))
|
| 39 |
-
have haM:MemLp a 2 μ := MemLp.of_bound ham.aestronglyMeasurable K
|
| 40 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.second_bound t htm (Y z)))
|
| 41 |
-
have hpp:DependsBefore j p := fun z z' hz ↦ by dsimp only [p];rw [hYp z z' hz]
|
| 42 |
-
have hap:DependsBefore j a := fun z z' hz ↦ by dsimp only [a];rw [hYp z z' hz]
|
| 43 |
-
have hPi:Integrable P μ := (((rawIncrement_memLp hj hpm hpp hpM).const_mul _).integrable (by norm_num))
|
| 44 |
-
have hQi:Integrable Q μ := (((predictableCenteredSquare_memLp ham (fun z ↦ h.second_bound t htm (Y z))).const_mul _).integrable (by norm_num))
|
| 45 |
-
have hP0:(∫ z,P z ∂μ)=0 := by
|
| 46 |
-
dsimp only [P]
|
| 47 |
-
rw [integral_const_mul,rawIncrement_mean hj hpm hpp,mul_zero]
|
| 48 |
-
have hQ0:(∫ z,Q z ∂μ)=0 := by
|
| 49 |
-
dsimp only [Q]
|
| 50 |
-
rw [integral_const_mul,predictableCenteredSquare_mean hj ham hap,mul_zero]
|
| 51 |
-
have hY'm:Measurable Y' := (hYm.add ((measurable_coordinate N j).const_mul _)).add
|
| 52 |
-
(((h.drift_measurable t htm).comp hYm).const_mul _)
|
| 53 |
-
have hcur:Integrable (fun z ↦ V t (Y z)) μ :=
|
| 54 |
-
(MemLp.of_bound ((h.smooth t htm).continuous.measurable.comp hYm).aestronglyMeasurable K
|
| 55 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound t htm (Y z))) :
|
| 56 |
-
MemLp (fun z ↦ V t (Y z)) 2 μ).integrable (by norm_num)
|
| 57 |
-
have hnext:Integrable (fun z ↦ V (t+δ) (Y' z)) μ :=
|
| 58 |
-
(MemLp.of_bound ((h.smooth (t+δ) hem).continuous.measurable.comp hY'm).aestronglyMeasurable K
|
| 59 |
-
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound (t+δ) hem (Y' z))) :
|
| 60 |
-
MemLp (fun z ↦ V (t+δ) (Y' z)) 2 μ).integrable (by norm_num)
|
| 61 |
-
have hDi:Integrable D μ := hnext.sub hcur
|
| 62 |
-
have hRi:Integrable R μ := (hDi.sub hPi).sub hQi
|
| 63 |
-
have hEi0 := (cubicEnvelope_memLp_two (coordinate_hasLaw N j)
|
| 64 |
-
(h.gamma_nonneg T ⟨ht.trans htT,le_rfl⟩) K ((1/2+γ T)*L)).integrable (by norm_num)
|
| 65 |
-
have hEi:Integrable E μ := (hEi0.const_mul _).add (integrable_const _)
|
| 66 |
-
have hRE (z) : |R z|≤E z := by
|
| 67 |
-
have hh := h.euler_one_step ht hδ hδ1 htδ (x:=Y z) (z:=coordinate N j z)
|
| 68 |
-
convert! hh using 1
|
| 69 |
-
dsimp only [R,D,P,Q,p,a,Y',E,rawIncrement]
|
| 70 |
-
congr 1
|
| 71 |
-
ring_nf
|
| 72 |
-
have hRmean:(∫ z,R z ∂μ)=(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ) := by
|
| 73 |
-
have hs := integral_sub (hDi.sub hPi) hQi
|
| 74 |
-
change (∫ z,D z-P z-Q z ∂μ)=(∫ z,D z-P z ∂μ)-(∫ z,Q z ∂μ) at hs
|
| 75 |
-
have hs1 := integral_sub hDi hPi
|
| 76 |
-
change (∫ z,D z-P z ∂μ)=(∫ z,D z ∂μ)-(∫ z,P z ∂μ) at hs1
|
| 77 |
-
change (∫ z,D z-P z-Q z ∂μ)=_
|
| 78 |
-
rw [hs,hs1,hP0,hQ0,sub_zero,sub_zero]
|
| 79 |
-
exact integral_sub hnext hcur
|
| 80 |
-
have hEmean:(∫ z,E z ∂μ)=
|
| 81 |
-
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 82 |
-
dsimp only [E]
|
| 83 |
-
rw [integral_add (hEi0.const_mul _) (integrable_const _),integral_const_mul]
|
| 84 |
-
simp only [integral_const,probReal_univ,smul_eq_mul,one_mul]
|
| 85 |
-
have he:(∫ z,cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z) ∂μ)=
|
| 86 |
-
cubicEnvelopeMean (γ T) K ((1/2+γ T)*L) := by
|
| 87 |
-
simpa only [Function.comp_def,cubicEnvelopeMean,standardGaussian] using
|
| 88 |
-
(coordinate_hasLaw N j).integral_comp (measurable_cubicEnvelope (γ T) K ((1/2+γ T)*L)).aestronglyMeasurable
|
| 89 |
-
rw [he]
|
| 90 |
-
change |(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)|≤_
|
| 91 |
-
rw [←hRmean,←hEmean]
|
| 92 |
-
exact abs_integral_le_integral_abs.trans (integral_mono hRi.norm hEi hRE)
|
| 93 |
-
end SKValue
|
| 94 |
-
|
| 95 |
-
end
|
| 96 |
-
|
| 97 |
-
section
|
| 98 |
-
|
| 99 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 100 |
-
open scoped Topology BigOperators NNReal
|
| 101 |
-
namespace SKValue
|
| 102 |
-
lemma BackwardTest.mesh_expectation {T K L:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 103 |
-
(h:BackwardTest T γ u V K L) (hT:0<T) (hT1:T≤1) {N:ℕ} (hN:0<N) :
|
| 104 |
-
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-V 0 0|≤
|
| 105 |
-
T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 106 |
-
stepSize T N*K*(γ T-γ 0) := by
|
| 107 |
-
let δ := stepSize T N
|
| 108 |
-
let A := fun j ↦ ∫ z,V (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))
|
| 109 |
-
have hNr:0<(N:ℝ) := by exact_mod_cast hN
|
| 110 |
-
have hδ:0≤δ := div_nonneg hT.le hNr.le
|
| 111 |
-
have hδ1:δ≤1 := by
|
| 112 |
-
apply (div_le_iff₀ hNr).mpr
|
| 113 |
-
have hn:(1:ℝ)≤N := by exact_mod_cast hN
|
| 114 |
-
simpa only [one_mul] using hT1.trans hn
|
| 115 |
-
have htime (j:ℕ) (hj:j≤N) := mesh_time_mem hT.le hN hj
|
| 116 |
-
have hs (j:ℕ) : meshTime T N j+δ=meshTime T N (j+1) := by dsimp [meshTime];push_cast;ring
|
| 117 |
-
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 118 |
-
have hzero:meshTime T N 0=0 := by simp [meshTime]
|
| 119 |
-
have hum (j:ℕ) (hj:j<N) : Measurable (u (meshTime T N j)) := h.drift_measurable _ (htime j hj.le)
|
| 120 |
-
have hstep (j:ℕ) (hj:j<N) : |A (j+1)-A j+0|≤
|
| 121 |
-
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 122 |
-
δ*K*(γ (meshTime T N (j+1))-γ (meshTime T N j))+0*((0:ℝ)-0) := by
|
| 123 |
-
have hYp:DependsBefore j (fun z ↦ euler T N γ u z j) :=
|
| 124 |
-
eulerCoefficient_dependsBefore T hj.le γ u (fun _ y ↦ y)
|
| 125 |
-
have he := h.expectation_step (htime j hj.le).1 hδ hδ1
|
| 126 |
-
(by rw [hs];exact (htime (j+1) (by omega)).2) (by omega:j<N+1)
|
| 127 |
-
(measurable_euler T N γ u hum j hj.le) hYp
|
| 128 |
-
dsimp only at he
|
| 129 |
-
rw [hs] at he
|
| 130 |
-
simpa only [A,euler,δ,mul_assoc,add_zero,sub_self,mul_zero] using he
|
| 131 |
-
have hh := abs_telescope_source (A:=A) (b:=fun _ ↦ 0) (Γ:=fun j ↦ γ (meshTime T N j))
|
| 132 |
-
(Δ:=fun _ ↦ 0) (e:=0) hstep
|
| 133 |
-
have hA0:A 0=V 0 0 := by simp [A,meshTime,euler]
|
| 134 |
-
rw [hA0,show A N=(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))) by
|
| 135 |
-
dsimp only [A];rw [hlast],hlast,hzero] at hh
|
| 136 |
-
have hNd:(N:ℝ)*δ=T := by dsimp [δ,stepSize];field_simp
|
| 137 |
-
simpa only [Finset.sum_const_zero,add_zero,sub_self,mul_zero,←mul_assoc,hNd] using hh
|
| 138 |
-
|
| 139 |
-
lemma BackwardTest.terminal_lipschitz {T K L:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 140 |
-
(h:BackwardTest T γ u V K L) (hT:0≤T) (x y:ℝ) : |V T x-V T y|≤K*|x-y| := by
|
| 141 |
-
have hd := (h.smooth T ⟨hT,le_rfl⟩).differentiable (by norm_num)
|
| 142 |
-
have hb:∀ z,‖deriv (V T) z‖≤K := fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound T ⟨hT,le_rfl⟩ z
|
| 143 |
-
have hl : LipschitzWith ⟨K,h.K_nonneg⟩ (V T) := by
|
| 144 |
-
apply lipschitzWith_of_nnnorm_deriv_le hd
|
| 145 |
-
intro z
|
| 146 |
-
exact_mod_cast hb z
|
| 147 |
-
have hh := hl.dist_le_mul x y
|
| 148 |
-
change |V T x-V T y|≤K*|x-y| at hh
|
| 149 |
-
exact hh
|
| 150 |
-
|
| 151 |
-
lemma BackwardTest.coupled_terminal_error {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 152 |
-
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 153 |
-
{X:ℝ → Ω → ℝ} {T K L K' L':ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 154 |
-
(hT:0<T) (hu:GradientStrip T γ u K L) (h:BackwardTest T γ u V K' L')
|
| 155 |
-
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 156 |
-
(hpaths:∀ᵐ ω ∂μ,(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+
|
| 157 |
-
∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) {N:ℕ} (hN:0<N) :
|
| 158 |
-
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-
|
| 159 |
-
(∫ ω,V T (X T ω) ∂μ)|≤K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ) := by
|
| 160 |
-
let F := fun ω ↦ V T (coupledEuler T γ u B N N ω)
|
| 161 |
-
let G := fun ω ↦ V T (X T ω)
|
| 162 |
-
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 163 |
-
have ht:T∈Icc (0:ℝ) T := ⟨hT.le,le_rfl⟩
|
| 164 |
-
have hm:Continuous (V T) := (h.smooth T ht).continuous
|
| 165 |
-
have hFM:MemLp F 2 μ := MemLp.of_bound
|
| 166 |
-
(hm.measurable.comp_aemeasurable (coupled_euler_measurable hB hT hu N N le_rfl).aemeasurable).aestronglyMeasurable K'
|
| 167 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,F] using h.bound T ht _))
|
| 168 |
-
have hGM:MemLp G 2 μ := MemLp.of_bound
|
| 169 |
-
(hm.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable K'
|
| 170 |
-
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,G] using h.bound T ht _))
|
| 171 |
-
have hEM:MemLp E 2 μ := coupled_mesh_error_memLp hB hT hu hXM hpaths hN
|
| 172 |
-
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 173 |
-
have hFG (ω:Ω) : |F ω-G ω|≤K'*|E ω| := by
|
| 174 |
-
have he:|coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 175 |
-
have hh := le_initialMax (f:=fun k ↦
|
| 176 |
-
|coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 177 |
-
change |coupledEuler T γ u B N N ω-X (meshTime T N N) ω|≤E ω at hh
|
| 178 |
-
rwa [hlast] at hh
|
| 179 |
-
exact (h.terminal_lipschitz hT.le _ _).trans
|
| 180 |
-
(mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) h.K_nonneg)
|
| 181 |
-
have heq:(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))=(∫ ω,F ω ∂μ) := by
|
| 182 |
-
have heum := measurable_euler T N γ u (fun j hj ↦ (hu.smooth _ (mesh_time_mem hT.le hN hj.le)).continuous.measurable) N le_rfl
|
| 183 |
-
have hh := (coupledCoordinates_hasLaw hB hT hN).integral_comp (hm.measurable.comp heum).aestronglyMeasurable
|
| 184 |
-
simpa only [Function.comp_apply,F,coupledEuler,ite_eq_right (Nat.ne_of_gt hN)] using hh.symm
|
| 185 |
-
rw [heq]
|
| 186 |
-
exact first_moment_perturbation hFM hGM hEM h.K_nonneg (Eventually.of_forall hFG)
|
| 187 |
-
end SKValue
|
| 188 |
-
|
| 189 |
-
end
|
| 190 |
-
|
| 191 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Processes.CrossMesh
|
| 3 |
+
import OAI.Probability.SKValue.Equations.TestGenerator
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
+
open scoped Topology BigOperators NNReal
|
| 11 |
+
namespace SKValue
|
| 12 |
+
lemma BackwardTest.expectation_step {T K L t δ:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 13 |
+
(h:BackwardTest T γ u V K L) (ht:0≤t) (hδ:0≤δ) (hδ1:δ≤1) (htδ:t+δ≤T)
|
| 14 |
+
{N j:ℕ} (hj:j<N+1) {Y:(Fin (N+1) → ℝ) → ℝ}
|
| 15 |
+
(hYm:Measurable Y) (hYp:DependsBefore j Y) :
|
| 16 |
+
let μ := gaussianProduct (Fin (N+1))
|
| 17 |
+
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 18 |
+
|(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)|≤
|
| 19 |
+
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 20 |
+
let μ := gaussianProduct (Fin (N+1))
|
| 21 |
+
let p := fun z ↦ deriv (V t) (Y z)
|
| 22 |
+
let a := fun z ↦ deriv (deriv (V t)) (Y z)
|
| 23 |
+
let Y' := fun z ↦ Y z+Real.sqrt δ*coordinate N j z+δ*γ t*u t (Y z)
|
| 24 |
+
let P := fun z ↦ Real.sqrt δ*rawIncrement p j z
|
| 25 |
+
let Q := fun z ↦ (δ/2)*(a z*((coordinate N j z)^2-1))
|
| 26 |
+
let D := fun z ↦ V (t+δ) (Y' z)-V t (Y z)
|
| 27 |
+
let R := fun z ↦ D z-P z-Q z
|
| 28 |
+
let E := fun z ↦ δ*Real.sqrt δ*cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z)+δ*K*(γ (t+δ)-γ t)
|
| 29 |
+
have htT:t≤T := (le_add_of_nonneg_right hδ).trans htδ
|
| 30 |
+
have htm:t∈Icc (0:ℝ) T := ⟨ht,htT⟩
|
| 31 |
+
have hem:t+δ∈Icc (0:ℝ) T := ⟨by linarith,htδ⟩
|
| 32 |
+
have hpm:Measurable p := ((h.smooth t htm).continuous_deriv (by norm_num)).measurable.comp hYm
|
| 33 |
+
have ham:Measurable a := by
|
| 34 |
+
have hh := (h.smooth t htm).continuous_iteratedDeriv 2 (by norm_num)
|
| 35 |
+
simp only [show (2:ℕ)=1+1 from rfl,iteratedDeriv_succ] at hh
|
| 36 |
+
exact hh.measurable.comp hYm
|
| 37 |
+
have hpM:MemLp p 2 μ := MemLp.of_bound hpm.aestronglyMeasurable K
|
| 38 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound t htm (Y z)))
|
| 39 |
+
have haM:MemLp a 2 μ := MemLp.of_bound ham.aestronglyMeasurable K
|
| 40 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.second_bound t htm (Y z)))
|
| 41 |
+
have hpp:DependsBefore j p := fun z z' hz ↦ by dsimp only [p];rw [hYp z z' hz]
|
| 42 |
+
have hap:DependsBefore j a := fun z z' hz ↦ by dsimp only [a];rw [hYp z z' hz]
|
| 43 |
+
have hPi:Integrable P μ := (((rawIncrement_memLp hj hpm hpp hpM).const_mul _).integrable (by norm_num))
|
| 44 |
+
have hQi:Integrable Q μ := (((predictableCenteredSquare_memLp ham (fun z ↦ h.second_bound t htm (Y z))).const_mul _).integrable (by norm_num))
|
| 45 |
+
have hP0:(∫ z,P z ∂μ)=0 := by
|
| 46 |
+
dsimp only [P]
|
| 47 |
+
rw [integral_const_mul,rawIncrement_mean hj hpm hpp,mul_zero]
|
| 48 |
+
have hQ0:(∫ z,Q z ∂μ)=0 := by
|
| 49 |
+
dsimp only [Q]
|
| 50 |
+
rw [integral_const_mul,predictableCenteredSquare_mean hj ham hap,mul_zero]
|
| 51 |
+
have hY'm:Measurable Y' := (hYm.add ((measurable_coordinate N j).const_mul _)).add
|
| 52 |
+
(((h.drift_measurable t htm).comp hYm).const_mul _)
|
| 53 |
+
have hcur:Integrable (fun z ↦ V t (Y z)) μ :=
|
| 54 |
+
(MemLp.of_bound ((h.smooth t htm).continuous.measurable.comp hYm).aestronglyMeasurable K
|
| 55 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound t htm (Y z))) :
|
| 56 |
+
MemLp (fun z ↦ V t (Y z)) 2 μ).integrable (by norm_num)
|
| 57 |
+
have hnext:Integrable (fun z ↦ V (t+δ) (Y' z)) μ :=
|
| 58 |
+
(MemLp.of_bound ((h.smooth (t+δ) hem).continuous.measurable.comp hY'm).aestronglyMeasurable K
|
| 59 |
+
(Eventually.of_forall (fun z ↦ by simpa only [Real.norm_eq_abs] using h.bound (t+δ) hem (Y' z))) :
|
| 60 |
+
MemLp (fun z ↦ V (t+δ) (Y' z)) 2 μ).integrable (by norm_num)
|
| 61 |
+
have hDi:Integrable D μ := hnext.sub hcur
|
| 62 |
+
have hRi:Integrable R μ := (hDi.sub hPi).sub hQi
|
| 63 |
+
have hEi0 := (cubicEnvelope_memLp_two (coordinate_hasLaw N j)
|
| 64 |
+
(h.gamma_nonneg T ⟨ht.trans htT,le_rfl⟩) K ((1/2+γ T)*L)).integrable (by norm_num)
|
| 65 |
+
have hEi:Integrable E μ := (hEi0.const_mul _).add (integrable_const _)
|
| 66 |
+
have hRE (z) : |R z|≤E z := by
|
| 67 |
+
have hh := h.euler_one_step ht hδ hδ1 htδ (x:=Y z) (z:=coordinate N j z)
|
| 68 |
+
convert! hh using 1
|
| 69 |
+
dsimp only [R,D,P,Q,p,a,Y',E,rawIncrement]
|
| 70 |
+
congr 1
|
| 71 |
+
ring_nf
|
| 72 |
+
have hRmean:(∫ z,R z ∂μ)=(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ) := by
|
| 73 |
+
have hs := integral_sub (hDi.sub hPi) hQi
|
| 74 |
+
change (∫ z,D z-P z-Q z ∂μ)=(∫ z,D z-P z ∂μ)-(∫ z,Q z ∂μ) at hs
|
| 75 |
+
have hs1 := integral_sub hDi hPi
|
| 76 |
+
change (∫ z,D z-P z ∂μ)=(∫ z,D z ∂μ)-(∫ z,P z ∂μ) at hs1
|
| 77 |
+
change (∫ z,D z-P z-Q z ∂μ)=_
|
| 78 |
+
rw [hs,hs1,hP0,hQ0,sub_zero,sub_zero]
|
| 79 |
+
exact integral_sub hnext hcur
|
| 80 |
+
have hEmean:(∫ z,E z ∂μ)=
|
| 81 |
+
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+δ*K*(γ (t+δ)-γ t) := by
|
| 82 |
+
dsimp only [E]
|
| 83 |
+
rw [integral_add (hEi0.const_mul _) (integrable_const _),integral_const_mul]
|
| 84 |
+
simp only [integral_const,probReal_univ,smul_eq_mul,one_mul]
|
| 85 |
+
have he:(∫ z,cubicEnvelope (γ T) K ((1/2+γ T)*L) (coordinate N j z) ∂μ)=
|
| 86 |
+
cubicEnvelopeMean (γ T) K ((1/2+γ T)*L) := by
|
| 87 |
+
simpa only [Function.comp_def,cubicEnvelopeMean,standardGaussian] using
|
| 88 |
+
(coordinate_hasLaw N j).integral_comp (measurable_cubicEnvelope (γ T) K ((1/2+γ T)*L)).aestronglyMeasurable
|
| 89 |
+
rw [he]
|
| 90 |
+
change |(∫ z,V (t+δ) (Y' z) ∂μ)-(∫ z,V t (Y z) ∂μ)|≤_
|
| 91 |
+
rw [←hRmean,←hEmean]
|
| 92 |
+
exact abs_integral_le_integral_abs.trans (integral_mono hRi.norm hEi hRE)
|
| 93 |
+
end SKValue
|
| 94 |
+
|
| 95 |
+
end
|
| 96 |
+
|
| 97 |
+
section
|
| 98 |
+
|
| 99 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 100 |
+
open scoped Topology BigOperators NNReal
|
| 101 |
+
namespace SKValue
|
| 102 |
+
lemma BackwardTest.mesh_expectation {T K L:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 103 |
+
(h:BackwardTest T γ u V K L) (hT:0<T) (hT1:T≤1) {N:ℕ} (hN:0<N) :
|
| 104 |
+
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-V 0 0|≤
|
| 105 |
+
T*Real.sqrt (stepSize T N)*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 106 |
+
stepSize T N*K*(γ T-γ 0) := by
|
| 107 |
+
let δ := stepSize T N
|
| 108 |
+
let A := fun j ↦ ∫ z,V (meshTime T N j) (euler T N γ u z j) ∂gaussianProduct (Fin (N+1))
|
| 109 |
+
have hNr:0<(N:ℝ) := by exact_mod_cast hN
|
| 110 |
+
have hδ:0≤δ := div_nonneg hT.le hNr.le
|
| 111 |
+
have hδ1:δ≤1 := by
|
| 112 |
+
apply (div_le_iff₀ hNr).mpr
|
| 113 |
+
have hn:(1:ℝ)≤N := by exact_mod_cast hN
|
| 114 |
+
simpa only [one_mul] using hT1.trans hn
|
| 115 |
+
have htime (j:ℕ) (hj:j≤N) := mesh_time_mem hT.le hN hj
|
| 116 |
+
have hs (j:ℕ) : meshTime T N j+δ=meshTime T N (j+1) := by dsimp [meshTime];push_cast;ring
|
| 117 |
+
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 118 |
+
have hzero:meshTime T N 0=0 := by simp [meshTime]
|
| 119 |
+
have hum (j:ℕ) (hj:j<N) : Measurable (u (meshTime T N j)) := h.drift_measurable _ (htime j hj.le)
|
| 120 |
+
have hstep (j:ℕ) (hj:j<N) : |A (j+1)-A j+0|≤
|
| 121 |
+
δ*Real.sqrt δ*cubicEnvelopeMean (γ T) K ((1/2+γ T)*L)+
|
| 122 |
+
δ*K*(γ (meshTime T N (j+1))-γ (meshTime T N j))+0*((0:ℝ)-0) := by
|
| 123 |
+
have hYp:DependsBefore j (fun z ↦ euler T N γ u z j) :=
|
| 124 |
+
eulerCoefficient_dependsBefore T hj.le γ u (fun _ y ↦ y)
|
| 125 |
+
have he := h.expectation_step (htime j hj.le).1 hδ hδ1
|
| 126 |
+
(by rw [hs];exact (htime (j+1) (by omega)).2) (by omega:j<N+1)
|
| 127 |
+
(measurable_euler T N γ u hum j hj.le) hYp
|
| 128 |
+
dsimp only at he
|
| 129 |
+
rw [hs] at he
|
| 130 |
+
simpa only [A,euler,δ,mul_assoc,add_zero,sub_self,mul_zero] using he
|
| 131 |
+
have hh := abs_telescope_source (A:=A) (b:=fun _ ↦ 0) (Γ:=fun j ↦ γ (meshTime T N j))
|
| 132 |
+
(Δ:=fun _ ↦ 0) (e:=0) hstep
|
| 133 |
+
have hA0:A 0=V 0 0 := by simp [A,meshTime,euler]
|
| 134 |
+
rw [hA0,show A N=(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1))) by
|
| 135 |
+
dsimp only [A];rw [hlast],hlast,hzero] at hh
|
| 136 |
+
have hNd:(N:ℝ)*δ=T := by dsimp [δ,stepSize];field_simp
|
| 137 |
+
simpa only [Finset.sum_const_zero,add_zero,sub_self,mul_zero,←mul_assoc,hNd] using hh
|
| 138 |
+
|
| 139 |
+
lemma BackwardTest.terminal_lipschitz {T K L:ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 140 |
+
(h:BackwardTest T γ u V K L) (hT:0≤T) (x y:ℝ) : |V T x-V T y|≤K*|x-y| := by
|
| 141 |
+
have hd := (h.smooth T ⟨hT,le_rfl⟩).differentiable (by norm_num)
|
| 142 |
+
have hb:∀ z,‖deriv (V T) z‖≤K := fun z ↦ by simpa only [Real.norm_eq_abs] using h.first_bound T ⟨hT,le_rfl⟩ z
|
| 143 |
+
have hl : LipschitzWith ⟨K,h.K_nonneg⟩ (V T) := by
|
| 144 |
+
apply lipschitzWith_of_nnnorm_deriv_le hd
|
| 145 |
+
intro z
|
| 146 |
+
exact_mod_cast hb z
|
| 147 |
+
have hh := hl.dist_le_mul x y
|
| 148 |
+
change |V T x-V T y|≤K*|x-y| at hh
|
| 149 |
+
exact hh
|
| 150 |
+
|
| 151 |
+
lemma BackwardTest.coupled_terminal_error {Ω:Type*} [MeasurableSpace Ω] {μ:Measure Ω}
|
| 152 |
+
[IsProbabilityMeasure μ] {B:ℝ≥0 → Ω → ℝ} (hB:IsPreBrownianReal B μ)
|
| 153 |
+
{X:ℝ → Ω → ℝ} {T K L K' L':ℝ} {γ:ℝ → ℝ} {u V:ℝ → ℝ → ℝ}
|
| 154 |
+
(hT:0<T) (hu:GradientStrip T γ u K L) (h:BackwardTest T γ u V K' L')
|
| 155 |
+
(hXM:∀ t∈Icc (0:ℝ) T,AEStronglyMeasurable (X t) μ)
|
| 156 |
+
(hpaths:∀ᵐ ω ∂μ,(∀ t∈Icc (0:ℝ) T,X t ω=B t.toNNReal ω+
|
| 157 |
+
∫ s in (0:ℝ)..t,γ s*u s (X s ω)) ∧ X 0 ω=0) {N:ℕ} (hN:0<N) :
|
| 158 |
+
|(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))-
|
| 159 |
+
(∫ ω,V T (X T ω) ∂μ)|≤K'*Real.sqrt (∫ ω,(meshMaxError T X (coupledEuler T γ u B) N ω)^2 ∂μ) := by
|
| 160 |
+
let F := fun ω ↦ V T (coupledEuler T γ u B N N ω)
|
| 161 |
+
let G := fun ω ↦ V T (X T ω)
|
| 162 |
+
let E := meshMaxError T X (coupledEuler T γ u B) N
|
| 163 |
+
have ht:T∈Icc (0:ℝ) T := ⟨hT.le,le_rfl⟩
|
| 164 |
+
have hm:Continuous (V T) := (h.smooth T ht).continuous
|
| 165 |
+
have hFM:MemLp F 2 μ := MemLp.of_bound
|
| 166 |
+
(hm.measurable.comp_aemeasurable (coupled_euler_measurable hB hT hu N N le_rfl).aemeasurable).aestronglyMeasurable K'
|
| 167 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,F] using h.bound T ht _))
|
| 168 |
+
have hGM:MemLp G 2 μ := MemLp.of_bound
|
| 169 |
+
(hm.measurable.comp_aemeasurable (hXM T ht).aemeasurable).aestronglyMeasurable K'
|
| 170 |
+
(Eventually.of_forall (fun ω ↦ by simpa only [Real.norm_eq_abs,G] using h.bound T ht _))
|
| 171 |
+
have hEM:MemLp E 2 μ := coupled_mesh_error_memLp hB hT hu hXM hpaths hN
|
| 172 |
+
have hlast:meshTime T N N=T := by dsimp [meshTime,stepSize];field_simp
|
| 173 |
+
have hFG (ω:Ω) : |F ω-G ω|≤K'*|E ω| := by
|
| 174 |
+
have he:|coupledEuler T γ u B N N ω-X T ω|≤E ω := by
|
| 175 |
+
have hh := le_initialMax (f:=fun k ↦
|
| 176 |
+
|coupledEuler T γ u B N k ω-X (meshTime T N k) ω|) (le_refl N)
|
| 177 |
+
change |coupledEuler T γ u B N N ω-X (meshTime T N N) ω|≤E ω at hh
|
| 178 |
+
rwa [hlast] at hh
|
| 179 |
+
exact (h.terminal_lipschitz hT.le _ _).trans
|
| 180 |
+
(mul_le_mul_of_nonneg_left (he.trans (le_abs_self _)) h.K_nonneg)
|
| 181 |
+
have heq:(∫ z,V T (euler T N γ u z N) ∂gaussianProduct (Fin (N+1)))=(∫ ω,F ω ∂μ) := by
|
| 182 |
+
have heum := measurable_euler T N γ u (fun j hj ↦ (hu.smooth _ (mesh_time_mem hT.le hN hj.le)).continuous.measurable) N le_rfl
|
| 183 |
+
have hh := (coupledCoordinates_hasLaw hB hT hN).integral_comp (hm.measurable.comp heum).aestronglyMeasurable
|
| 184 |
+
simpa only [Function.comp_apply,F,coupledEuler,ite_eq_right (Nat.ne_of_gt hN)] using hh.symm
|
| 185 |
+
rw [heq]
|
| 186 |
+
exact first_moment_perturbation hFM hGM hEM h.K_nonneg (Eventually.of_forall hFG)
|
| 187 |
+
end SKValue
|
| 188 |
+
|
| 189 |
+
end
|
| 190 |
+
|
| 191 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/UnitMomentMartingale.lean
CHANGED
|
@@ -1,396 +1,396 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
|
| 3 |
-
namespace OAI
|
| 4 |
-
|
| 5 |
-
section
|
| 6 |
-
open MeasureTheory ProbabilityTheory Set
|
| 7 |
-
open scoped ENNReal NNReal BigOperators
|
| 8 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
-
open scoped BigOperators Topology
|
| 10 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 11 |
-
open scoped Topology BigOperators
|
| 12 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
-
open scoped Topology ENNReal NNReal
|
| 14 |
-
open Filter Set
|
| 15 |
-
open scoped Topology BigOperators
|
| 16 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 17 |
-
open scoped Topology
|
| 18 |
-
open MeasureTheory Set Filter
|
| 19 |
-
open scoped Topology BigOperators
|
| 20 |
-
open MeasureTheory Set Filter Finset
|
| 21 |
-
open scoped Topology BigOperators
|
| 22 |
-
namespace SKValue
|
| 23 |
-
|
| 24 |
-
variable {Ω : Type*} {m : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 25 |
-
|
| 26 |
-
structure UnitMomentMartingale (ℱ : Filtration ℝ m) (f : ℝ → Ω → ℝ) : Prop where
|
| 27 |
-
measurable : ∀ t ∈ Ico (0 : ℝ) 1, StronglyMeasurable[ℱ t] (f t)
|
| 28 |
-
bounded : ∀ t ∈ Ico (0 : ℝ) 1, ∀ ω, |f t ω| ≤ 1
|
| 29 |
-
condExp : ∀ s ∈ Ico (0 : ℝ) 1, ∀ t ∈ Ico (0 : ℝ) 1, s ≤ t →
|
| 30 |
-
μ[f t | ℱ s] =ᵐ[μ] f s
|
| 31 |
-
secondMoment : ∀ t ∈ Ico (0 : ℝ) 1, ∫ ω, (f t ω)^2 ∂μ = t
|
| 32 |
-
|
| 33 |
-
variable {ℱ : Filtration ℝ m} {f : ℝ → Ω → ℝ}
|
| 34 |
-
|
| 35 |
-
lemma UnitMomentMartingale.integrable (h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 36 |
-
{t : ℝ} (ht : t ∈ Ico (0 : ℝ) 1) : Integrable (f t) μ :=
|
| 37 |
-
Integrable.of_bound ((h.measurable t ht).mono (ℱ.le t)).aestronglyMeasurable 1
|
| 38 |
-
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le (h.bounded t ht ω)))
|
| 39 |
-
|
| 40 |
-
lemma UnitMomentMartingale.integrable_mul (h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 41 |
-
{s t : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) :
|
| 42 |
-
Integrable (fun ω ↦ f s ω * f t ω) μ :=
|
| 43 |
-
Integrable.of_bound (((h.measurable s hs).mono (ℱ.le s)).mul
|
| 44 |
-
((h.measurable t ht).mono (ℱ.le t))).aestronglyMeasurable 1
|
| 45 |
-
(Eventually.of_forall (fun ω ↦ by
|
| 46 |
-
rw [Real.norm_eq_abs,abs_mul]
|
| 47 |
-
nlinarith [h.bounded s hs ω,h.bounded t ht ω,abs_nonneg (f s ω),abs_nonneg (f t ω)]))
|
| 48 |
-
|
| 49 |
-
lemma UnitMomentMartingale.integral_past_mul (h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 50 |
-
{s t : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) (hst : s ≤ t) :
|
| 51 |
-
∫ ω, f s ω * f t ω ∂μ = s := by
|
| 52 |
-
have hc := condExp_mul_of_stronglyMeasurable_left (h.measurable s hs)
|
| 53 |
-
(h.integrable_mul hs ht) (h.integrable ht)
|
| 54 |
-
have he : μ[(f s) * (f t) | ℱ s] =ᵐ[μ] fun ω ↦ (f s ω)^2 := by
|
| 55 |
-
filter_upwards [hc,h.condExp s hs t ht hst] with ω hω hω'
|
| 56 |
-
simpa only [Pi.mul_apply,hω',pow_two] using hω
|
| 57 |
-
calc
|
| 58 |
-
_ = ∫ ω, μ[(f s) * (f t) | ℱ s] ω ∂μ := (integral_condExp (ℱ.le s)).symm
|
| 59 |
-
_ = ∫ ω, (f s ω)^2 ∂μ := integral_congr_ae he
|
| 60 |
-
_ = s := h.secondMoment s hs
|
| 61 |
-
|
| 62 |
-
lemma UnitMomentMartingale.sampled_gap_martingale
|
| 63 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {s : ℝ}
|
| 64 |
-
(hs : s ∈ Ico (0 : ℝ) 1) (r : ℕ → ℝ) (hr : Monotone r)
|
| 65 |
-
(hrmem : ∀ n, r n ∈ Ico s 1) :
|
| 66 |
-
Martingale (fun n ω ↦ 1-f s ω*f (r n) ω)
|
| 67 |
-
(⟨fun n ↦ ℱ (r n),fun _ _ hij ↦ ℱ.mono (hr hij),fun n ↦ ℱ.le (r n)⟩ :
|
| 68 |
-
Filtration ℕ m) μ := by
|
| 69 |
-
have ht (n : ℕ) : r n ∈ Ico (0 : ℝ) 1 := ⟨hs.1.trans (hrmem n).1,(hrmem n).2⟩
|
| 70 |
-
refine ⟨fun n ↦ stronglyMeasurable_const.sub
|
| 71 |
-
(((h.measurable s hs).mono (ℱ.mono (hrmem n).1)).mul (h.measurable (r n) (ht n))),?_⟩
|
| 72 |
-
intro i j hij
|
| 73 |
-
have hc := condExp_mul_of_stronglyMeasurable_left
|
| 74 |
-
((h.measurable s hs).mono (ℱ.mono (hrmem i).1))
|
| 75 |
-
(h.integrable_mul hs (ht j)) (h.integrable (ht j))
|
| 76 |
-
have hc1 := condExp_of_stronglyMeasurable (ℱ.le (r i))
|
| 77 |
-
(stronglyMeasurable_const (b := (1 : ℝ))) (integrable_const (μ := μ) 1)
|
| 78 |
-
filter_upwards [condExp_sub (integrable_const (1 : ℝ))
|
| 79 |
-
(h.integrable_mul hs (ht j)) (ℱ (r i)),hc,
|
| 80 |
-
h.condExp (r i) (ht i) (r j) (ht j) (hr hij)] with ω hsub hmul he
|
| 81 |
-
simp only [Pi.sub_apply] at hsub
|
| 82 |
-
change μ[(fun ω ↦ f s ω*f (r j) ω) | ℱ (r i)] ω =
|
| 83 |
-
f s ω*μ[f (r j) | ℱ (r i)] ω at hmul
|
| 84 |
-
rw [hc1,hmul] at hsub
|
| 85 |
-
simpa only [Pi.sub_def,Pi.mul_def,Pi.mul_apply,he] using hsub
|
| 86 |
-
|
| 87 |
-
omit [IsProbabilityMeasure μ] in
|
| 88 |
-
lemma UnitMomentMartingale.sampled_gap_nonneg
|
| 89 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {s t : ℝ}
|
| 90 |
-
(hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) (ω : Ω) :
|
| 91 |
-
0 ≤ 1-f s ω*f t ω := by
|
| 92 |
-
have hh : f s ω*f t ω ≤ 1 := calc
|
| 93 |
-
_ ≤ |f s ω*f t ω| := le_abs_self _
|
| 94 |
-
_ = |f s ω| * |f t ω| := abs_mul _ _
|
| 95 |
-
_ ≤ 1 := by nlinarith [h.bounded s hs ω,h.bounded t ht ω,
|
| 96 |
-
abs_nonneg (f s ω),abs_nonneg (f t ω)]
|
| 97 |
-
linarith
|
| 98 |
-
|
| 99 |
-
lemma UnitMomentMartingale.sampled_gap_integral
|
| 100 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {s t : ℝ}
|
| 101 |
-
(hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) (hst : s ≤ t) :
|
| 102 |
-
∫ ω, 1-f s ω*f t ω ∂μ = 1-s := by
|
| 103 |
-
rw [integral_sub (integrable_const 1) (h.integrable_mul hs ht),
|
| 104 |
-
h.integral_past_mul hs ht hst]
|
| 105 |
-
simp
|
| 106 |
-
|
| 107 |
-
lemma UnitMomentMartingale.finite_gap_maximal
|
| 108 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {s : ℝ}
|
| 109 |
-
(hs : s ∈ Ico (0 : ℝ) 1) (S : Finset ℝ)
|
| 110 |
-
(hS : ∀ t ∈ S, t ∈ Ico s 1) (ε : ℝ≥0) :
|
| 111 |
-
(ε : ℝ≥0∞) * μ {ω | ∃ t ∈ S, (ε : ℝ) ≤ 1-f s ω*f t ω} ≤
|
| 112 |
-
ENNReal.ofReal (1-s) := by
|
| 113 |
-
classical
|
| 114 |
-
by_cases hne : S.Nonempty
|
| 115 |
-
· have hcard : 0 < S.card := Finset.card_pos.mpr hne
|
| 116 |
-
let e := S.orderEmbOfFin rfl
|
| 117 |
-
let r : ℕ → ℝ := fun n ↦ e ⟨min n (S.card-1),by omega⟩
|
| 118 |
-
have hr : Monotone r := by
|
| 119 |
-
intro i j hij
|
| 120 |
-
exact e.monotone (show min i (S.card-1) ≤ min j (S.card-1) from min_le_min_right _ hij)
|
| 121 |
-
have hrmem (n : ℕ) : r n ∈ Ico s 1 := hS _ (S.orderEmbOfFin_mem rfl _)
|
| 122 |
-
have hm := h.sampled_gap_martingale hs r hr hrmem
|
| 123 |
-
have hn : 0 ≤ (fun n ω ↦ 1-f s ω*f (r n) ω) :=
|
| 124 |
-
fun n ω ↦ h.sampled_gap_nonneg hs ⟨hs.1.trans (hrmem n).1,(hrmem n).2⟩ ω
|
| 125 |
-
have hb := maximal_ineq hm.submartingale hn (ε := ε) (S.card-1)
|
| 126 |
-
have hset : {ω | ∃ t ∈ S, (ε : ℝ) ≤ 1-f s ω*f t ω} ⊆
|
| 127 |
-
{ω | (ε : ℝ) ≤ (Finset.range ((S.card-1)+1)).sup' Finset.nonempty_range_add_one
|
| 128 |
-
(fun k ↦ 1-f s ω*f (r k) ω)} := by
|
| 129 |
-
rintro ω ⟨t,ht,heps⟩
|
| 130 |
-
let i := (S.orderIsoOfFin rfl).symm ⟨t,ht⟩
|
| 131 |
-
have her : r i.val = t := by
|
| 132 |
-
dsimp only [r]
|
| 133 |
-
have hh : (⟨min i.val (S.card-1),by omega⟩ : Fin S.card) = i :=
|
| 134 |
-
Fin.ext (min_eq_left (by omega))
|
| 135 |
-
rw [hh]
|
| 136 |
-
change ((S.orderIsoOfFin rfl) i).val = t
|
| 137 |
-
simp [i]
|
| 138 |
-
refine heps.trans ?_
|
| 139 |
-
rw [← her]
|
| 140 |
-
exact Finset.le_sup' (f := fun k ↦ 1-f s ω*f (r k) ω)
|
| 141 |
-
(Finset.mem_range.mpr (by omega : i.val < (S.card-1)+1))
|
| 142 |
-
calc
|
| 143 |
-
_ ≤ (ε : ℝ≥0∞) * μ {ω | (ε : ℝ) ≤
|
| 144 |
-
(Finset.range ((S.card-1)+1)).sup' Finset.nonempty_range_add_one
|
| 145 |
-
(fun k ↦ 1-f s ω*f (r k) ω)} := by gcongr
|
| 146 |
-
_ ≤ _ := hb
|
| 147 |
-
_ ≤ ENNReal.ofReal (∫ ω, 1-f s ω*f (r (S.card-1)) ω ∂μ) := by
|
| 148 |
-
apply ENNReal.ofReal_le_ofReal
|
| 149 |
-
exact setIntegral_le_integral (integrable_const 1 |>.sub
|
| 150 |
-
(h.integrable_mul hs ⟨hs.1.trans (hrmem _).1,(hrmem _).2⟩))
|
| 151 |
-
(Eventually.of_forall (hn (S.card-1)))
|
| 152 |
-
_ = _ := congrArg ENNReal.ofReal (h.sampled_gap_integral hs
|
| 153 |
-
⟨hs.1.trans (hrmem _).1,(hrmem _).2⟩ (hrmem _).1)
|
| 154 |
-
· simp [Finset.not_nonempty_iff_eq_empty.mp hne]
|
| 155 |
-
|
| 156 |
-
lemma UnitMomentMartingale.rational_gap_maximal
|
| 157 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {s : ℝ}
|
| 158 |
-
(hs : s ∈ Ico (0 : ℝ) 1) (ε : ℝ≥0) :
|
| 159 |
-
(ε : ℝ≥0∞) * μ {ω | ∃ q : ℚ, (q : ℝ) ∈ Ico s 1 ∧
|
| 160 |
-
(ε : ℝ) ≤ 1-f s ω*f q ω} ≤ ENNReal.ofReal (1-s) := by
|
| 161 |
-
classical
|
| 162 |
-
let E : Finset ℚ → Set Ω := fun S ↦ {ω | ∃ q ∈ S, (q : ℝ) ∈ Ico s 1 ∧
|
| 163 |
-
(ε : ℝ) ≤ 1-f s ω*f q ω}
|
| 164 |
-
have hd : Directed (· ⊆ ·) E := by
|
| 165 |
-
intro S T
|
| 166 |
-
refine ⟨S∪T, ?_, ?_⟩
|
| 167 |
-
· rintro ω ⟨q,hq,hmem,he⟩
|
| 168 |
-
exact ⟨q,Finset.mem_union_left _ hq,hmem,he⟩
|
| 169 |
-
· rintro ω ⟨q,hq,hmem,he⟩
|
| 170 |
-
exact ⟨q,Finset.mem_union_right _ hq,hmem,he⟩
|
| 171 |
-
have heq : {ω | ∃ q : ℚ, (q : ℝ) ∈ Ico s 1 ∧ (ε : ℝ) ≤ 1-f s ω*f q ω} =
|
| 172 |
-
⋃ S : Finset ℚ, E S := by
|
| 173 |
-
ext ω
|
| 174 |
-
constructor
|
| 175 |
-
· rintro ⟨q,hmem,he⟩
|
| 176 |
-
exact mem_iUnion.mpr ⟨{q},q,Finset.mem_singleton_self _,hmem,he⟩
|
| 177 |
-
· intro hω
|
| 178 |
-
obtain ⟨S,q,hq,hmem,he⟩ := mem_iUnion.mp hω
|
| 179 |
-
exact ⟨q,hmem,he⟩
|
| 180 |
-
rw [heq,hd.measure_iUnion,ENNReal.mul_iSup]
|
| 181 |
-
refine iSup_le fun S ↦ ?_
|
| 182 |
-
let R : Finset ℝ := (S.filter (fun q : ℚ ↦ (q : ℝ) ∈ Ico s 1)).image (fun q : ℚ ↦ (q : ℝ))
|
| 183 |
-
have hR : ∀ t ∈ R, t ∈ Ico s 1 := by
|
| 184 |
-
intro t ht
|
| 185 |
-
obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp ht
|
| 186 |
-
exact (Finset.mem_filter.mp hq).2
|
| 187 |
-
have hE : E S ⊆ {ω | ∃ t ∈ R, (ε : ℝ) ≤ 1-f s ω*f t ω} := by
|
| 188 |
-
rintro ω ⟨q,hq,hmem,he⟩
|
| 189 |
-
exact ⟨(q : ℝ),Finset.mem_image.mpr ⟨q,Finset.mem_filter.mpr ⟨hq,hmem⟩,rfl⟩,he⟩
|
| 190 |
-
calc
|
| 191 |
-
_ ≤ (ε : ℝ≥0∞) * μ {ω | ∃ t ∈ R, (ε : ℝ) ≤ 1-f s ω*f t ω} := by gcongr
|
| 192 |
-
_ ≤ _ := h.finite_gap_maximal hs R hR ε
|
| 193 |
-
|
| 194 |
-
noncomputable def terminalTime (n : ℕ) : ℝ := 1-1/(n+1)
|
| 195 |
-
|
| 196 |
-
lemma terminalTime_mem (n : ℕ) : terminalTime n ∈ Ico (0 : ℝ) 1 := by
|
| 197 |
-
have hn : (1 : ℝ) ≤ n+1 := by linarith [Nat.cast_nonneg (α := ℝ) n]
|
| 198 |
-
have hp : (0 : ℝ) < n+1 := by positivity
|
| 199 |
-
simp only [terminalTime]
|
| 200 |
-
constructor
|
| 201 |
-
· have hh : (1 : ℝ)/(n+1) ≤ 1 := (div_le_one hp).mpr hn
|
| 202 |
-
linarith
|
| 203 |
-
· have hh : (0 : ℝ) < 1/(n+1) := by positivity
|
| 204 |
-
linarith
|
| 205 |
-
|
| 206 |
-
lemma terminalTime_monotone : Monotone terminalTime := by
|
| 207 |
-
intro i j hij
|
| 208 |
-
simp only [terminalTime]
|
| 209 |
-
have hh : (1 : ℝ)/(j+1) ≤ 1/(i+1) := one_div_le_one_div_of_le
|
| 210 |
-
(by positivity) (by exact_mod_cast Nat.add_le_add_right hij 1)
|
| 211 |
-
linarith
|
| 212 |
-
|
| 213 |
-
lemma terminalTime_tendsto : Tendsto terminalTime atTop (𝓝[<] (1 : ℝ)) := by
|
| 214 |
-
refine tendsto_nhdsWithin_iff.mpr ⟨?_,Eventually.of_forall (fun n ↦ (terminalTime_mem n).2)⟩
|
| 215 |
-
change Tendsto (fun n : ℕ ↦ (1 : ℝ)-1/((n : ℝ)+1)) atTop (𝓝 (1 : ℝ))
|
| 216 |
-
simpa only [sub_zero] using (tendsto_const_nhds (x := (1 : ℝ))).sub
|
| 217 |
-
(tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ))
|
| 218 |
-
|
| 219 |
-
lemma UnitMomentMartingale.ae_exists_rational_gap_bound
|
| 220 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {ε : ℝ} (hε : 0 < ε) :
|
| 221 |
-
∀ᵐ ω ∂μ, ∃ n, ∀ q : ℚ, (q : ℝ) ∈ Ico (terminalTime n) 1 →
|
| 222 |
-
1-f (terminalTime n) ω*f q ω < ε := by
|
| 223 |
-
let E : ℕ → Set Ω := fun n ↦ {ω | ∃ q : ℚ, (q : ℝ) ∈ Ico (terminalTime n) 1 ∧
|
| 224 |
-
ε ≤ 1-f (terminalTime n) ω*f q ω}
|
| 225 |
-
have hbound (n : ℕ) : ENNReal.ofReal ε * μ (⋂ n, E n) ≤
|
| 226 |
-
ENNReal.ofReal (1-terminalTime n) := calc
|
| 227 |
-
_ ≤ ENNReal.ofReal ε * μ (E n) := by gcongr; exact iInter_subset E n
|
| 228 |
-
_ ≤ _ := by
|
| 229 |
-
have hh := h.rational_gap_maximal (terminalTime_mem n) (NNReal.mk ε hε.le)
|
| 230 |
-
simpa only [E,NNReal.coe_mk,ENNReal.coe_nnreal_eq] using hh
|
| 231 |
-
have hzero : ENNReal.ofReal ε * μ (⋂ n, E n) = 0 := by
|
| 232 |
-
apply le_antisymm _ bot_le
|
| 233 |
-
have hlim : Tendsto (fun n ↦ ENNReal.ofReal (1-terminalTime n)) atTop (𝓝 0) := by
|
| 234 |
-
have hh : Tendsto (fun n ↦ 1-terminalTime n) atTop (𝓝 (0 : ℝ)) := by
|
| 235 |
-
simpa only [sub_self] using ((tendsto_const_nhds (x := (1 : ℝ))).sub
|
| 236 |
-
(tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1)
|
| 237 |
-
simpa only [ENNReal.ofReal_zero,Function.comp_def] using
|
| 238 |
-
ENNReal.continuous_ofReal.continuousAt.tendsto.comp hh
|
| 239 |
-
exact ge_of_tendsto' hlim hbound
|
| 240 |
-
have hn : μ (⋂ n, E n) = 0 := (mul_eq_zero.mp hzero).resolve_left
|
| 241 |
-
(ne_of_gt (ENNReal.ofReal_pos.mpr hε))
|
| 242 |
-
have ha : ∀ᵐ ω ∂μ, ω ∉ ⋂ n, E n := by
|
| 243 |
-
rw [ae_iff]
|
| 244 |
-
convert hn using 1
|
| 245 |
-
simp only [not_not,Set.ofPred_mem_eq]
|
| 246 |
-
filter_upwards [ha] with ω hω
|
| 247 |
-
simp only [mem_iInter,E,mem_ofPred_eq,not_forall,not_exists,not_and,not_le] at hω
|
| 248 |
-
exact hω
|
| 249 |
-
|
| 250 |
-
lemma continuous_gap_bound_of_rat {v : ℝ → ℝ}
|
| 251 |
-
(hv : ContinuousOn v (Ico (0 : ℝ) 1)) {s ε : ℝ}
|
| 252 |
-
(hs : s ∈ Ico (0 : ℝ) 1)
|
| 253 |
-
(hq : ∀ q : ℚ, (q : ℝ) ∈ Ico s 1 → 1-v s*v q < ε) :
|
| 254 |
-
∀ t ∈ Ioo s 1, 1-v s*v t ≤ ε := by
|
| 255 |
-
intro t ht
|
| 256 |
-
by_contra! he
|
| 257 |
-
have hvt : ContinuousAt v t := (hv t ⟨hs.1.trans ht.1.le,ht.2⟩).continuousAt
|
| 258 |
-
(Ico_mem_nhds_iff.mpr ⟨hs.1.trans_lt ht.1,ht.2⟩)
|
| 259 |
-
have hgt : ContinuousAt (fun r ↦ 1-v s*v r) t := continuousAt_const.sub
|
| 260 |
-
(continuousAt_const.mul hvt)
|
| 261 |
-
have hevent : {r | ε < 1-v s*v r} ∈ 𝓝 t := hgt (Ioi_mem_nhds he)
|
| 262 |
-
obtain ⟨q,hq'⟩ := Rat.denseRange_cast.mem_nhds (inter_mem hevent (Ioo_mem_nhds ht.1 ht.2))
|
| 263 |
-
exact (hq q ⟨hq'.2.1.le,hq'.2.2⟩).not_gt hq'.1
|
| 264 |
-
|
| 265 |
-
lemma UnitMomentMartingale.exists_sequence_terminal
|
| 266 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) :
|
| 267 |
-
∃ U : Ω → ℝ, StronglyMeasurable[ℱ 1] U ∧
|
| 268 |
-
(∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 269 |
-
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω))) := by
|
| 270 |
-
let 𝒢 : Filtration ℕ m := ⟨fun n ↦ ℱ (terminalTime n),
|
| 271 |
-
fun _ _ hij ↦ ℱ.mono (terminalTime_monotone hij),fun n ↦ ℱ.le _⟩
|
| 272 |
-
have hm : Martingale (fun n ↦ f (terminalTime n)) 𝒢 μ :=
|
| 273 |
-
⟨fun n ↦ h.measurable _ (terminalTime_mem n),fun i j hij ↦
|
| 274 |
-
h.condExp _ (terminalTime_mem i) _ (terminalTime_mem j) (terminalTime_monotone hij)⟩
|
| 275 |
-
have hb (n : ℕ) : eLpNorm (f (terminalTime n)) 1 μ ≤ (1 : ℝ≥0) := by
|
| 276 |
-
have hh := eLpNorm_le_of_ae_bound (μ := μ) (p := (1 : ℝ≥0∞))
|
| 277 |
-
(h.integrable (terminalTime_mem n)).aestronglyMeasurable
|
| 278 |
-
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le
|
| 279 |
-
(h.bounded _ (terminalTime_mem n) ω)))
|
| 280 |
-
simpa using hh
|
| 281 |
-
let U := 𝒢.limitProcess (fun n ↦ f (terminalTime n)) μ
|
| 282 |
-
have hU : StronglyMeasurable[ℱ 1] U :=
|
| 283 |
-
Filtration.stronglyMeasurable_limitProcess.mono (iSup_le fun n ↦ ℱ.mono (terminalTime_mem n).2.le)
|
| 284 |
-
refine ⟨U,hU,?_⟩
|
| 285 |
-
filter_upwards [hm.submartingale.ae_tendsto_limitProcess hb] with ω hω
|
| 286 |
-
exact ⟨le_of_tendsto' hω.abs (fun n ↦ h.bounded _ (terminalTime_mem n) ω),hω⟩
|
| 287 |
-
|
| 288 |
-
lemma UnitMomentMartingale.exists_continuous_terminal
|
| 289 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 290 |
-
(hc : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ f t ω) (Ico (0 : ℝ) 1)) :
|
| 291 |
-
∃ U : Ω → ℝ, StronglyMeasurable[ℱ 1] U ∧
|
| 292 |
-
(∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 293 |
-
Tendsto (fun t ↦ f t ω) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) := by
|
| 294 |
-
obtain ⟨U,hU,hseq⟩ := h.exists_sequence_terminal
|
| 295 |
-
have hg : ∀ᵐ ω ∂μ, ∀ k : ℕ, ∃ n, ∀ q : ℚ,
|
| 296 |
-
(q : ℝ) ∈ Ico (terminalTime n) 1 →
|
| 297 |
-
1-f (terminalTime n) ω*f q ω < 1/(k+1) := by
|
| 298 |
-
apply ae_all_iff.mpr
|
| 299 |
-
intro k
|
| 300 |
-
exact h.ae_exists_rational_gap_bound (by positivity)
|
| 301 |
-
refine ⟨U,hU,?_⟩
|
| 302 |
-
filter_upwards [hc,hseq,hg] with ω hcont hseqω hgap
|
| 303 |
-
refine ⟨hseqω.1,Metric.tendsto_nhds.mpr (fun δ hδ ↦ ?_)⟩
|
| 304 |
-
obtain ⟨k,hk⟩ : ∃ k : ℕ, (1 : ℝ)/(k+1) < δ^2/32 := by
|
| 305 |
-
have hh := (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).eventually
|
| 306 |
-
(Iio_mem_nhds (show (0 : ℝ) < δ^2/32 by positivity))
|
| 307 |
-
exact hh.exists
|
| 308 |
-
obtain ⟨n,hn⟩ := hgap k
|
| 309 |
-
have hreal := continuous_gap_bound_of_rat hcont (terminalTime_mem n) hn
|
| 310 |
-
have hbound (t : ℝ) (ht : t ∈ Ioo (terminalTime n) 1) :
|
| 311 |
-
|f t ω-f (terminalTime n) ω| ≤ δ/4 := by
|
| 312 |
-
have hbt := h.bounded t ⟨(terminalTime_mem n).1.trans ht.1.le,ht.2⟩ ω
|
| 313 |
-
have hbs := h.bounded _ (terminalTime_mem n) ω
|
| 314 |
-
have he := hreal t ht
|
| 315 |
-
have hsq1 : (f t ω)^2 ≤ 1 := by nlinarith [abs_le.mp hbt]
|
| 316 |
-
have hsq2 : (f (terminalTime n) ω)^2 ≤ 1 := by nlinarith [abs_le.mp hbs]
|
| 317 |
-
have habs : |f t ω-f (terminalTime n) ω|^2 < (δ/4)^2 := by
|
| 318 |
-
rw [sq_abs]
|
| 319 |
-
nlinarith
|
| 320 |
-
nlinarith [abs_nonneg (f t ω-f (terminalTime n) ω)]
|
| 321 |
-
have hUb : |U ω-f (terminalTime n) ω| ≤ δ/4 := by
|
| 322 |
-
apply le_of_tendsto ((hseqω.2.sub_const _).abs)
|
| 323 |
-
have hev : ∀ᶠ k in atTop, terminalTime k ∈ Ioo (terminalTime n) 1 :=
|
| 324 |
-
terminalTime_tendsto.eventually (Ioo_mem_nhdsLT (terminalTime_mem n).2)
|
| 325 |
-
exact hev.mono (fun k hk ↦ hbound _ hk)
|
| 326 |
-
filter_upwards [Ioo_mem_nhdsLT (terminalTime_mem n).2] with t ht
|
| 327 |
-
rw [Real.dist_eq]
|
| 328 |
-
have hh := abs_add_le (f t ω-f (terminalTime n) ω) (f (terminalTime n) ω-U ω)
|
| 329 |
-
have hh' := hbound t ht
|
| 330 |
-
have hUb' : |f (terminalTime n) ω-U ω| ≤ δ/4 := by simpa only [abs_sub_comm] using hUb
|
| 331 |
-
have heq : f t ω-U ω = (f t ω-f (terminalTime n) ω)+(f (terminalTime n) ω-U ω) := by ring
|
| 332 |
-
rw [heq]
|
| 333 |
-
linarith
|
| 334 |
-
|
| 335 |
-
lemma UnitMomentMartingale.terminal_square
|
| 336 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 337 |
-
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 338 |
-
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 339 |
-
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω))) :
|
| 340 |
-
∀ᵐ ω ∂μ, (U ω)^2 = 1 := by
|
| 341 |
-
have hU2i : Integrable (fun ω ↦ (U ω)^2) μ :=
|
| 342 |
-
Integrable.of_bound ((hUm.mono (ℱ.le 1)).pow 2).aestronglyMeasurable 1
|
| 343 |
-
(hU.mono (fun ω hω ↦ by
|
| 344 |
-
rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)]
|
| 345 |
-
nlinarith [abs_le.mp hω.1]))
|
| 346 |
-
have ht := tendsto_integral_of_dominated_convergence (μ := μ)
|
| 347 |
-
(F := fun n ω ↦ (f (terminalTime n) ω)^2) (fun _ : Ω ↦ (1 : ℝ))
|
| 348 |
-
(fun n ↦ (((h.measurable _ (terminalTime_mem n)).mono (ℱ.le _)).pow 2).aestronglyMeasurable)
|
| 349 |
-
(integrable_const 1)
|
| 350 |
-
(fun n ↦ Eventually.of_forall (fun ω ↦ by
|
| 351 |
-
rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)]
|
| 352 |
-
nlinarith [abs_le.mp (h.bounded _ (terminalTime_mem n) ω)]))
|
| 353 |
-
(hU.mono (fun ω hω ↦ hω.2.pow 2))
|
| 354 |
-
have hi : ∫ ω, (U ω)^2 ∂μ = 1 := by
|
| 355 |
-
have hh : (fun n ↦ ∫ ω, (f (terminalTime n) ω)^2 ∂μ) = terminalTime :=
|
| 356 |
-
funext (fun n ↦ h.secondMoment _ (terminalTime_mem n))
|
| 357 |
-
rw [hh] at ht
|
| 358 |
-
exact tendsto_nhds_unique ht (tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1
|
| 359 |
-
have hnonneg : 0 ≤ᵐ[μ] (fun ω ↦ 1-(U ω)^2) := hU.mono (fun ω hω ↦ by
|
| 360 |
-
dsimp
|
| 361 |
-
nlinarith [abs_le.mp hω.1])
|
| 362 |
-
have hzero : ∫ ω, 1-(U ω)^2 ∂μ = 0 := by
|
| 363 |
-
rw [integral_sub (integrable_const 1) hU2i,hi]
|
| 364 |
-
simp
|
| 365 |
-
have he := (integral_eq_zero_iff_of_nonneg_ae hnonneg ((integrable_const 1).sub hU2i)).mp hzero
|
| 366 |
-
filter_upwards [he] with ω hω
|
| 367 |
-
change 1-(U ω)^2=0 at hω
|
| 368 |
-
linarith
|
| 369 |
-
|
| 370 |
-
lemma UnitMomentMartingale.terminal_mean_square
|
| 371 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 372 |
-
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 373 |
-
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 374 |
-
Tendsto (fun t ↦ f t ω) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) :
|
| 375 |
-
Tendsto (fun t ↦ ∫ ω, (f t ω-U ω)^2 ∂μ) (𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 376 |
-
have hev : ∀ᶠ t in 𝓝[<] (1 : ℝ), t ∈ Ico (0 : ℝ) 1 := by
|
| 377 |
-
filter_upwards [Ioo_mem_nhdsLT (show (0 : ℝ)<1 by norm_num)] with t ht
|
| 378 |
-
exact ⟨ht.1.le,ht.2⟩
|
| 379 |
-
have ht := tendsto_integral_filter_of_dominated_convergence (μ := μ)
|
| 380 |
-
(F := fun t ω ↦ (f t ω-U ω)^2) (f := fun _ ↦ (0 : ℝ)) (fun _ : Ω ↦ (4 : ℝ))
|
| 381 |
-
(hev.mono (fun t ht ↦ ((((h.measurable t ht).mono (ℱ.le t)).sub
|
| 382 |
-
(hUm.mono (ℱ.le 1))).pow 2).aestronglyMeasurable))
|
| 383 |
-
(hev.mono (fun t ht ↦ hU.mono (fun ω hω ↦ by
|
| 384 |
-
rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)]
|
| 385 |
-
have hb := h.bounded t ht ω
|
| 386 |
-
have hd : |f t ω-U ω| ≤ 2 := (abs_sub _ _).trans (by linarith [hω.1])
|
| 387 |
-
nlinarith [sq_abs (f t ω-U ω),abs_nonneg (f t ω-U ω)])))
|
| 388 |
-
(integrable_const 4)
|
| 389 |
-
(hU.mono (fun ω hω ↦ by
|
| 390 |
-
simpa only [sub_self,zero_pow (by decide : (2 : ℕ) ≠ 0)] using (hω.2.sub_const (U ω)).pow 2))
|
| 391 |
-
simpa only [integral_zero] using ht
|
| 392 |
-
|
| 393 |
-
end SKValue
|
| 394 |
-
end
|
| 395 |
-
|
| 396 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
section
|
| 6 |
+
open MeasureTheory ProbabilityTheory Set
|
| 7 |
+
open scoped ENNReal NNReal BigOperators
|
| 8 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 9 |
+
open scoped BigOperators Topology
|
| 10 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 11 |
+
open scoped Topology BigOperators
|
| 12 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 13 |
+
open scoped Topology ENNReal NNReal
|
| 14 |
+
open Filter Set
|
| 15 |
+
open scoped Topology BigOperators
|
| 16 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 17 |
+
open scoped Topology
|
| 18 |
+
open MeasureTheory Set Filter
|
| 19 |
+
open scoped Topology BigOperators
|
| 20 |
+
open MeasureTheory Set Filter Finset
|
| 21 |
+
open scoped Topology BigOperators
|
| 22 |
+
namespace SKValue
|
| 23 |
+
|
| 24 |
+
variable {Ω : Type*} {m : MeasurableSpace Ω} {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 25 |
+
|
| 26 |
+
structure UnitMomentMartingale (ℱ : Filtration ℝ m) (f : ℝ → Ω → ℝ) : Prop where
|
| 27 |
+
measurable : ∀ t ∈ Ico (0 : ℝ) 1, StronglyMeasurable[ℱ t] (f t)
|
| 28 |
+
bounded : ∀ t ∈ Ico (0 : ℝ) 1, ∀ ω, |f t ω| ≤ 1
|
| 29 |
+
condExp : ∀ s ∈ Ico (0 : ℝ) 1, ∀ t ∈ Ico (0 : ℝ) 1, s ≤ t →
|
| 30 |
+
μ[f t | ℱ s] =ᵐ[μ] f s
|
| 31 |
+
secondMoment : ∀ t ∈ Ico (0 : ℝ) 1, ∫ ω, (f t ω)^2 ∂μ = t
|
| 32 |
+
|
| 33 |
+
variable {ℱ : Filtration ℝ m} {f : ℝ → Ω → ℝ}
|
| 34 |
+
|
| 35 |
+
lemma UnitMomentMartingale.integrable (h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 36 |
+
{t : ℝ} (ht : t ∈ Ico (0 : ℝ) 1) : Integrable (f t) μ :=
|
| 37 |
+
Integrable.of_bound ((h.measurable t ht).mono (ℱ.le t)).aestronglyMeasurable 1
|
| 38 |
+
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le (h.bounded t ht ω)))
|
| 39 |
+
|
| 40 |
+
lemma UnitMomentMartingale.integrable_mul (h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 41 |
+
{s t : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) :
|
| 42 |
+
Integrable (fun ω ↦ f s ω * f t ω) μ :=
|
| 43 |
+
Integrable.of_bound (((h.measurable s hs).mono (ℱ.le s)).mul
|
| 44 |
+
((h.measurable t ht).mono (ℱ.le t))).aestronglyMeasurable 1
|
| 45 |
+
(Eventually.of_forall (fun ω ↦ by
|
| 46 |
+
rw [Real.norm_eq_abs,abs_mul]
|
| 47 |
+
nlinarith [h.bounded s hs ω,h.bounded t ht ω,abs_nonneg (f s ω),abs_nonneg (f t ω)]))
|
| 48 |
+
|
| 49 |
+
lemma UnitMomentMartingale.integral_past_mul (h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 50 |
+
{s t : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) (hst : s ≤ t) :
|
| 51 |
+
∫ ω, f s ω * f t ω ∂μ = s := by
|
| 52 |
+
have hc := condExp_mul_of_stronglyMeasurable_left (h.measurable s hs)
|
| 53 |
+
(h.integrable_mul hs ht) (h.integrable ht)
|
| 54 |
+
have he : μ[(f s) * (f t) | ℱ s] =ᵐ[μ] fun ω ↦ (f s ω)^2 := by
|
| 55 |
+
filter_upwards [hc,h.condExp s hs t ht hst] with ω hω hω'
|
| 56 |
+
simpa only [Pi.mul_apply,hω',pow_two] using hω
|
| 57 |
+
calc
|
| 58 |
+
_ = ∫ ω, μ[(f s) * (f t) | ℱ s] ω ∂μ := (integral_condExp (ℱ.le s)).symm
|
| 59 |
+
_ = ∫ ω, (f s ω)^2 ∂μ := integral_congr_ae he
|
| 60 |
+
_ = s := h.secondMoment s hs
|
| 61 |
+
|
| 62 |
+
lemma UnitMomentMartingale.sampled_gap_martingale
|
| 63 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {s : ℝ}
|
| 64 |
+
(hs : s ∈ Ico (0 : ℝ) 1) (r : ℕ → ℝ) (hr : Monotone r)
|
| 65 |
+
(hrmem : ∀ n, r n ∈ Ico s 1) :
|
| 66 |
+
Martingale (fun n ω ↦ 1-f s ω*f (r n) ω)
|
| 67 |
+
(⟨fun n ↦ ℱ (r n),fun _ _ hij ↦ ℱ.mono (hr hij),fun n ↦ ℱ.le (r n)⟩ :
|
| 68 |
+
Filtration ℕ m) μ := by
|
| 69 |
+
have ht (n : ℕ) : r n ∈ Ico (0 : ℝ) 1 := ⟨hs.1.trans (hrmem n).1,(hrmem n).2⟩
|
| 70 |
+
refine ⟨fun n ↦ stronglyMeasurable_const.sub
|
| 71 |
+
(((h.measurable s hs).mono (ℱ.mono (hrmem n).1)).mul (h.measurable (r n) (ht n))),?_⟩
|
| 72 |
+
intro i j hij
|
| 73 |
+
have hc := condExp_mul_of_stronglyMeasurable_left
|
| 74 |
+
((h.measurable s hs).mono (ℱ.mono (hrmem i).1))
|
| 75 |
+
(h.integrable_mul hs (ht j)) (h.integrable (ht j))
|
| 76 |
+
have hc1 := condExp_of_stronglyMeasurable (ℱ.le (r i))
|
| 77 |
+
(stronglyMeasurable_const (b := (1 : ℝ))) (integrable_const (μ := μ) 1)
|
| 78 |
+
filter_upwards [condExp_sub (integrable_const (1 : ℝ))
|
| 79 |
+
(h.integrable_mul hs (ht j)) (ℱ (r i)),hc,
|
| 80 |
+
h.condExp (r i) (ht i) (r j) (ht j) (hr hij)] with ω hsub hmul he
|
| 81 |
+
simp only [Pi.sub_apply] at hsub
|
| 82 |
+
change μ[(fun ω ↦ f s ω*f (r j) ω) | ℱ (r i)] ω =
|
| 83 |
+
f s ω*μ[f (r j) | ℱ (r i)] ω at hmul
|
| 84 |
+
rw [hc1,hmul] at hsub
|
| 85 |
+
simpa only [Pi.sub_def,Pi.mul_def,Pi.mul_apply,he] using hsub
|
| 86 |
+
|
| 87 |
+
omit [IsProbabilityMeasure μ] in
|
| 88 |
+
lemma UnitMomentMartingale.sampled_gap_nonneg
|
| 89 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {s t : ℝ}
|
| 90 |
+
(hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) (ω : Ω) :
|
| 91 |
+
0 ≤ 1-f s ω*f t ω := by
|
| 92 |
+
have hh : f s ω*f t ω ≤ 1 := calc
|
| 93 |
+
_ ≤ |f s ω*f t ω| := le_abs_self _
|
| 94 |
+
_ = |f s ω| * |f t ω| := abs_mul _ _
|
| 95 |
+
_ ≤ 1 := by nlinarith [h.bounded s hs ω,h.bounded t ht ω,
|
| 96 |
+
abs_nonneg (f s ω),abs_nonneg (f t ω)]
|
| 97 |
+
linarith
|
| 98 |
+
|
| 99 |
+
lemma UnitMomentMartingale.sampled_gap_integral
|
| 100 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {s t : ℝ}
|
| 101 |
+
(hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico (0 : ℝ) 1) (hst : s ≤ t) :
|
| 102 |
+
∫ ω, 1-f s ω*f t ω ∂μ = 1-s := by
|
| 103 |
+
rw [integral_sub (integrable_const 1) (h.integrable_mul hs ht),
|
| 104 |
+
h.integral_past_mul hs ht hst]
|
| 105 |
+
simp
|
| 106 |
+
|
| 107 |
+
lemma UnitMomentMartingale.finite_gap_maximal
|
| 108 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {s : ℝ}
|
| 109 |
+
(hs : s ∈ Ico (0 : ℝ) 1) (S : Finset ℝ)
|
| 110 |
+
(hS : ∀ t ∈ S, t ∈ Ico s 1) (ε : ℝ≥0) :
|
| 111 |
+
(ε : ℝ≥0∞) * μ {ω | ∃ t ∈ S, (ε : ℝ) ≤ 1-f s ω*f t ω} ≤
|
| 112 |
+
ENNReal.ofReal (1-s) := by
|
| 113 |
+
classical
|
| 114 |
+
by_cases hne : S.Nonempty
|
| 115 |
+
· have hcard : 0 < S.card := Finset.card_pos.mpr hne
|
| 116 |
+
let e := S.orderEmbOfFin rfl
|
| 117 |
+
let r : ℕ → ℝ := fun n ↦ e ⟨min n (S.card-1),by omega⟩
|
| 118 |
+
have hr : Monotone r := by
|
| 119 |
+
intro i j hij
|
| 120 |
+
exact e.monotone (show min i (S.card-1) ≤ min j (S.card-1) from min_le_min_right _ hij)
|
| 121 |
+
have hrmem (n : ℕ) : r n ∈ Ico s 1 := hS _ (S.orderEmbOfFin_mem rfl _)
|
| 122 |
+
have hm := h.sampled_gap_martingale hs r hr hrmem
|
| 123 |
+
have hn : 0 ≤ (fun n ω ↦ 1-f s ω*f (r n) ω) :=
|
| 124 |
+
fun n ω ↦ h.sampled_gap_nonneg hs ⟨hs.1.trans (hrmem n).1,(hrmem n).2⟩ ω
|
| 125 |
+
have hb := maximal_ineq hm.submartingale hn (ε := ε) (S.card-1)
|
| 126 |
+
have hset : {ω | ∃ t ∈ S, (ε : ℝ) ≤ 1-f s ω*f t ω} ⊆
|
| 127 |
+
{ω | (ε : ℝ) ≤ (Finset.range ((S.card-1)+1)).sup' Finset.nonempty_range_add_one
|
| 128 |
+
(fun k ↦ 1-f s ω*f (r k) ω)} := by
|
| 129 |
+
rintro ω ⟨t,ht,heps⟩
|
| 130 |
+
let i := (S.orderIsoOfFin rfl).symm ⟨t,ht⟩
|
| 131 |
+
have her : r i.val = t := by
|
| 132 |
+
dsimp only [r]
|
| 133 |
+
have hh : (⟨min i.val (S.card-1),by omega⟩ : Fin S.card) = i :=
|
| 134 |
+
Fin.ext (min_eq_left (by omega))
|
| 135 |
+
rw [hh]
|
| 136 |
+
change ((S.orderIsoOfFin rfl) i).val = t
|
| 137 |
+
simp [i]
|
| 138 |
+
refine heps.trans ?_
|
| 139 |
+
rw [← her]
|
| 140 |
+
exact Finset.le_sup' (f := fun k ↦ 1-f s ω*f (r k) ω)
|
| 141 |
+
(Finset.mem_range.mpr (by omega : i.val < (S.card-1)+1))
|
| 142 |
+
calc
|
| 143 |
+
_ ≤ (ε : ℝ≥0∞) * μ {ω | (ε : ℝ) ≤
|
| 144 |
+
(Finset.range ((S.card-1)+1)).sup' Finset.nonempty_range_add_one
|
| 145 |
+
(fun k ↦ 1-f s ω*f (r k) ω)} := by gcongr
|
| 146 |
+
_ ≤ _ := hb
|
| 147 |
+
_ ≤ ENNReal.ofReal (∫ ω, 1-f s ω*f (r (S.card-1)) ω ∂μ) := by
|
| 148 |
+
apply ENNReal.ofReal_le_ofReal
|
| 149 |
+
exact setIntegral_le_integral (integrable_const 1 |>.sub
|
| 150 |
+
(h.integrable_mul hs ⟨hs.1.trans (hrmem _).1,(hrmem _).2⟩))
|
| 151 |
+
(Eventually.of_forall (hn (S.card-1)))
|
| 152 |
+
_ = _ := congrArg ENNReal.ofReal (h.sampled_gap_integral hs
|
| 153 |
+
⟨hs.1.trans (hrmem _).1,(hrmem _).2⟩ (hrmem _).1)
|
| 154 |
+
· simp [Finset.not_nonempty_iff_eq_empty.mp hne]
|
| 155 |
+
|
| 156 |
+
lemma UnitMomentMartingale.rational_gap_maximal
|
| 157 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {s : ℝ}
|
| 158 |
+
(hs : s ∈ Ico (0 : ℝ) 1) (ε : ℝ≥0) :
|
| 159 |
+
(ε : ℝ≥0∞) * μ {ω | ∃ q : ℚ, (q : ℝ) ∈ Ico s 1 ∧
|
| 160 |
+
(ε : ℝ) ≤ 1-f s ω*f q ω} ≤ ENNReal.ofReal (1-s) := by
|
| 161 |
+
classical
|
| 162 |
+
let E : Finset ℚ → Set Ω := fun S ↦ {ω | ∃ q ∈ S, (q : ℝ) ∈ Ico s 1 ∧
|
| 163 |
+
(ε : ℝ) ≤ 1-f s ω*f q ω}
|
| 164 |
+
have hd : Directed (· ⊆ ·) E := by
|
| 165 |
+
intro S T
|
| 166 |
+
refine ⟨S∪T, ?_, ?_⟩
|
| 167 |
+
· rintro ω ⟨q,hq,hmem,he⟩
|
| 168 |
+
exact ⟨q,Finset.mem_union_left _ hq,hmem,he⟩
|
| 169 |
+
· rintro ω ⟨q,hq,hmem,he⟩
|
| 170 |
+
exact ⟨q,Finset.mem_union_right _ hq,hmem,he⟩
|
| 171 |
+
have heq : {ω | ∃ q : ℚ, (q : ℝ) ∈ Ico s 1 ∧ (ε : ℝ) ≤ 1-f s ω*f q ω} =
|
| 172 |
+
⋃ S : Finset ℚ, E S := by
|
| 173 |
+
ext ω
|
| 174 |
+
constructor
|
| 175 |
+
· rintro ⟨q,hmem,he⟩
|
| 176 |
+
exact mem_iUnion.mpr ⟨{q},q,Finset.mem_singleton_self _,hmem,he⟩
|
| 177 |
+
· intro hω
|
| 178 |
+
obtain ⟨S,q,hq,hmem,he⟩ := mem_iUnion.mp hω
|
| 179 |
+
exact ⟨q,hmem,he⟩
|
| 180 |
+
rw [heq,hd.measure_iUnion,ENNReal.mul_iSup]
|
| 181 |
+
refine iSup_le fun S ↦ ?_
|
| 182 |
+
let R : Finset ℝ := (S.filter (fun q : ℚ ↦ (q : ℝ) ∈ Ico s 1)).image (fun q : ℚ ↦ (q : ℝ))
|
| 183 |
+
have hR : ∀ t ∈ R, t ∈ Ico s 1 := by
|
| 184 |
+
intro t ht
|
| 185 |
+
obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp ht
|
| 186 |
+
exact (Finset.mem_filter.mp hq).2
|
| 187 |
+
have hE : E S ⊆ {ω | ∃ t ∈ R, (ε : ℝ) ≤ 1-f s ω*f t ω} := by
|
| 188 |
+
rintro ω ⟨q,hq,hmem,he⟩
|
| 189 |
+
exact ⟨(q : ℝ),Finset.mem_image.mpr ⟨q,Finset.mem_filter.mpr ⟨hq,hmem⟩,rfl⟩,he⟩
|
| 190 |
+
calc
|
| 191 |
+
_ ≤ (ε : ℝ≥0∞) * μ {ω | ∃ t ∈ R, (ε : ℝ) ≤ 1-f s ω*f t ω} := by gcongr
|
| 192 |
+
_ ≤ _ := h.finite_gap_maximal hs R hR ε
|
| 193 |
+
|
| 194 |
+
noncomputable def terminalTime (n : ℕ) : ℝ := 1-1/(n+1)
|
| 195 |
+
|
| 196 |
+
lemma terminalTime_mem (n : ℕ) : terminalTime n ∈ Ico (0 : ℝ) 1 := by
|
| 197 |
+
have hn : (1 : ℝ) ≤ n+1 := by linarith [Nat.cast_nonneg (α := ℝ) n]
|
| 198 |
+
have hp : (0 : ℝ) < n+1 := by positivity
|
| 199 |
+
simp only [terminalTime]
|
| 200 |
+
constructor
|
| 201 |
+
· have hh : (1 : ℝ)/(n+1) ≤ 1 := (div_le_one hp).mpr hn
|
| 202 |
+
linarith
|
| 203 |
+
· have hh : (0 : ℝ) < 1/(n+1) := by positivity
|
| 204 |
+
linarith
|
| 205 |
+
|
| 206 |
+
lemma terminalTime_monotone : Monotone terminalTime := by
|
| 207 |
+
intro i j hij
|
| 208 |
+
simp only [terminalTime]
|
| 209 |
+
have hh : (1 : ℝ)/(j+1) ≤ 1/(i+1) := one_div_le_one_div_of_le
|
| 210 |
+
(by positivity) (by exact_mod_cast Nat.add_le_add_right hij 1)
|
| 211 |
+
linarith
|
| 212 |
+
|
| 213 |
+
lemma terminalTime_tendsto : Tendsto terminalTime atTop (𝓝[<] (1 : ℝ)) := by
|
| 214 |
+
refine tendsto_nhdsWithin_iff.mpr ⟨?_,Eventually.of_forall (fun n ↦ (terminalTime_mem n).2)⟩
|
| 215 |
+
change Tendsto (fun n : ℕ ↦ (1 : ℝ)-1/((n : ℝ)+1)) atTop (𝓝 (1 : ℝ))
|
| 216 |
+
simpa only [sub_zero] using (tendsto_const_nhds (x := (1 : ℝ))).sub
|
| 217 |
+
(tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ))
|
| 218 |
+
|
| 219 |
+
lemma UnitMomentMartingale.ae_exists_rational_gap_bound
|
| 220 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {ε : ℝ} (hε : 0 < ε) :
|
| 221 |
+
∀ᵐ ω ∂μ, ∃ n, ∀ q : ℚ, (q : ℝ) ∈ Ico (terminalTime n) 1 →
|
| 222 |
+
1-f (terminalTime n) ω*f q ω < ε := by
|
| 223 |
+
let E : ℕ → Set Ω := fun n ↦ {ω | ∃ q : ℚ, (q : ℝ) ∈ Ico (terminalTime n) 1 ∧
|
| 224 |
+
ε ≤ 1-f (terminalTime n) ω*f q ω}
|
| 225 |
+
have hbound (n : ℕ) : ENNReal.ofReal ε * μ (⋂ n, E n) ≤
|
| 226 |
+
ENNReal.ofReal (1-terminalTime n) := calc
|
| 227 |
+
_ ≤ ENNReal.ofReal ε * μ (E n) := by gcongr; exact iInter_subset E n
|
| 228 |
+
_ ≤ _ := by
|
| 229 |
+
have hh := h.rational_gap_maximal (terminalTime_mem n) (NNReal.mk ε hε.le)
|
| 230 |
+
simpa only [E,NNReal.coe_mk,ENNReal.coe_nnreal_eq] using hh
|
| 231 |
+
have hzero : ENNReal.ofReal ε * μ (⋂ n, E n) = 0 := by
|
| 232 |
+
apply le_antisymm _ bot_le
|
| 233 |
+
have hlim : Tendsto (fun n ↦ ENNReal.ofReal (1-terminalTime n)) atTop (𝓝 0) := by
|
| 234 |
+
have hh : Tendsto (fun n ↦ 1-terminalTime n) atTop (𝓝 (0 : ℝ)) := by
|
| 235 |
+
simpa only [sub_self] using ((tendsto_const_nhds (x := (1 : ℝ))).sub
|
| 236 |
+
(tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1)
|
| 237 |
+
simpa only [ENNReal.ofReal_zero,Function.comp_def] using
|
| 238 |
+
ENNReal.continuous_ofReal.continuousAt.tendsto.comp hh
|
| 239 |
+
exact ge_of_tendsto' hlim hbound
|
| 240 |
+
have hn : μ (⋂ n, E n) = 0 := (mul_eq_zero.mp hzero).resolve_left
|
| 241 |
+
(ne_of_gt (ENNReal.ofReal_pos.mpr hε))
|
| 242 |
+
have ha : ∀ᵐ ω ∂μ, ω ∉ ⋂ n, E n := by
|
| 243 |
+
rw [ae_iff]
|
| 244 |
+
convert hn using 1
|
| 245 |
+
simp only [not_not,Set.ofPred_mem_eq]
|
| 246 |
+
filter_upwards [ha] with ω hω
|
| 247 |
+
simp only [mem_iInter,E,mem_ofPred_eq,not_forall,not_exists,not_and,not_le] at hω
|
| 248 |
+
exact hω
|
| 249 |
+
|
| 250 |
+
lemma continuous_gap_bound_of_rat {v : ℝ → ℝ}
|
| 251 |
+
(hv : ContinuousOn v (Ico (0 : ℝ) 1)) {s ε : ℝ}
|
| 252 |
+
(hs : s ∈ Ico (0 : ℝ) 1)
|
| 253 |
+
(hq : ∀ q : ℚ, (q : ℝ) ∈ Ico s 1 → 1-v s*v q < ε) :
|
| 254 |
+
∀ t ∈ Ioo s 1, 1-v s*v t ≤ ε := by
|
| 255 |
+
intro t ht
|
| 256 |
+
by_contra! he
|
| 257 |
+
have hvt : ContinuousAt v t := (hv t ⟨hs.1.trans ht.1.le,ht.2⟩).continuousAt
|
| 258 |
+
(Ico_mem_nhds_iff.mpr ⟨hs.1.trans_lt ht.1,ht.2⟩)
|
| 259 |
+
have hgt : ContinuousAt (fun r ↦ 1-v s*v r) t := continuousAt_const.sub
|
| 260 |
+
(continuousAt_const.mul hvt)
|
| 261 |
+
have hevent : {r | ε < 1-v s*v r} ∈ 𝓝 t := hgt (Ioi_mem_nhds he)
|
| 262 |
+
obtain ⟨q,hq'⟩ := Rat.denseRange_cast.mem_nhds (inter_mem hevent (Ioo_mem_nhds ht.1 ht.2))
|
| 263 |
+
exact (hq q ⟨hq'.2.1.le,hq'.2.2⟩).not_gt hq'.1
|
| 264 |
+
|
| 265 |
+
lemma UnitMomentMartingale.exists_sequence_terminal
|
| 266 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) :
|
| 267 |
+
∃ U : Ω → ℝ, StronglyMeasurable[ℱ 1] U ∧
|
| 268 |
+
(∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 269 |
+
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω))) := by
|
| 270 |
+
let 𝒢 : Filtration ℕ m := ⟨fun n ↦ ℱ (terminalTime n),
|
| 271 |
+
fun _ _ hij ↦ ℱ.mono (terminalTime_monotone hij),fun n ↦ ℱ.le _⟩
|
| 272 |
+
have hm : Martingale (fun n ↦ f (terminalTime n)) 𝒢 μ :=
|
| 273 |
+
⟨fun n ↦ h.measurable _ (terminalTime_mem n),fun i j hij ↦
|
| 274 |
+
h.condExp _ (terminalTime_mem i) _ (terminalTime_mem j) (terminalTime_monotone hij)⟩
|
| 275 |
+
have hb (n : ℕ) : eLpNorm (f (terminalTime n)) 1 μ ≤ (1 : ℝ≥0) := by
|
| 276 |
+
have hh := eLpNorm_le_of_ae_bound (μ := μ) (p := (1 : ℝ≥0∞))
|
| 277 |
+
(h.integrable (terminalTime_mem n)).aestronglyMeasurable
|
| 278 |
+
(Eventually.of_forall (fun ω ↦ (Real.norm_eq_abs _).trans_le
|
| 279 |
+
(h.bounded _ (terminalTime_mem n) ω)))
|
| 280 |
+
simpa using hh
|
| 281 |
+
let U := 𝒢.limitProcess (fun n ↦ f (terminalTime n)) μ
|
| 282 |
+
have hU : StronglyMeasurable[ℱ 1] U :=
|
| 283 |
+
Filtration.stronglyMeasurable_limitProcess.mono (iSup_le fun n ↦ ℱ.mono (terminalTime_mem n).2.le)
|
| 284 |
+
refine ⟨U,hU,?_⟩
|
| 285 |
+
filter_upwards [hm.submartingale.ae_tendsto_limitProcess hb] with ω hω
|
| 286 |
+
exact ⟨le_of_tendsto' hω.abs (fun n ↦ h.bounded _ (terminalTime_mem n) ω),hω⟩
|
| 287 |
+
|
| 288 |
+
lemma UnitMomentMartingale.exists_continuous_terminal
|
| 289 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f)
|
| 290 |
+
(hc : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ f t ω) (Ico (0 : ℝ) 1)) :
|
| 291 |
+
∃ U : Ω → ℝ, StronglyMeasurable[ℱ 1] U ∧
|
| 292 |
+
(∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 293 |
+
Tendsto (fun t ↦ f t ω) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) := by
|
| 294 |
+
obtain ⟨U,hU,hseq⟩ := h.exists_sequence_terminal
|
| 295 |
+
have hg : ∀ᵐ ω ∂μ, ∀ k : ℕ, ∃ n, ∀ q : ℚ,
|
| 296 |
+
(q : ℝ) ∈ Ico (terminalTime n) 1 →
|
| 297 |
+
1-f (terminalTime n) ω*f q ω < 1/(k+1) := by
|
| 298 |
+
apply ae_all_iff.mpr
|
| 299 |
+
intro k
|
| 300 |
+
exact h.ae_exists_rational_gap_bound (by positivity)
|
| 301 |
+
refine ⟨U,hU,?_⟩
|
| 302 |
+
filter_upwards [hc,hseq,hg] with ω hcont hseqω hgap
|
| 303 |
+
refine ⟨hseqω.1,Metric.tendsto_nhds.mpr (fun δ hδ ↦ ?_)⟩
|
| 304 |
+
obtain ⟨k,hk⟩ : ∃ k : ℕ, (1 : ℝ)/(k+1) < δ^2/32 := by
|
| 305 |
+
have hh := (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).eventually
|
| 306 |
+
(Iio_mem_nhds (show (0 : ℝ) < δ^2/32 by positivity))
|
| 307 |
+
exact hh.exists
|
| 308 |
+
obtain ⟨n,hn⟩ := hgap k
|
| 309 |
+
have hreal := continuous_gap_bound_of_rat hcont (terminalTime_mem n) hn
|
| 310 |
+
have hbound (t : ℝ) (ht : t ∈ Ioo (terminalTime n) 1) :
|
| 311 |
+
|f t ω-f (terminalTime n) ω| ≤ δ/4 := by
|
| 312 |
+
have hbt := h.bounded t ⟨(terminalTime_mem n).1.trans ht.1.le,ht.2⟩ ω
|
| 313 |
+
have hbs := h.bounded _ (terminalTime_mem n) ω
|
| 314 |
+
have he := hreal t ht
|
| 315 |
+
have hsq1 : (f t ω)^2 ≤ 1 := by nlinarith [abs_le.mp hbt]
|
| 316 |
+
have hsq2 : (f (terminalTime n) ω)^2 ≤ 1 := by nlinarith [abs_le.mp hbs]
|
| 317 |
+
have habs : |f t ω-f (terminalTime n) ω|^2 < (δ/4)^2 := by
|
| 318 |
+
rw [sq_abs]
|
| 319 |
+
nlinarith
|
| 320 |
+
nlinarith [abs_nonneg (f t ω-f (terminalTime n) ω)]
|
| 321 |
+
have hUb : |U ω-f (terminalTime n) ω| ≤ δ/4 := by
|
| 322 |
+
apply le_of_tendsto ((hseqω.2.sub_const _).abs)
|
| 323 |
+
have hev : ∀ᶠ k in atTop, terminalTime k ∈ Ioo (terminalTime n) 1 :=
|
| 324 |
+
terminalTime_tendsto.eventually (Ioo_mem_nhdsLT (terminalTime_mem n).2)
|
| 325 |
+
exact hev.mono (fun k hk ↦ hbound _ hk)
|
| 326 |
+
filter_upwards [Ioo_mem_nhdsLT (terminalTime_mem n).2] with t ht
|
| 327 |
+
rw [Real.dist_eq]
|
| 328 |
+
have hh := abs_add_le (f t ω-f (terminalTime n) ω) (f (terminalTime n) ω-U ω)
|
| 329 |
+
have hh' := hbound t ht
|
| 330 |
+
have hUb' : |f (terminalTime n) ω-U ω| ≤ δ/4 := by simpa only [abs_sub_comm] using hUb
|
| 331 |
+
have heq : f t ω-U ω = (f t ω-f (terminalTime n) ω)+(f (terminalTime n) ω-U ω) := by ring
|
| 332 |
+
rw [heq]
|
| 333 |
+
linarith
|
| 334 |
+
|
| 335 |
+
lemma UnitMomentMartingale.terminal_square
|
| 336 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 337 |
+
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 338 |
+
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 339 |
+
Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω))) :
|
| 340 |
+
∀ᵐ ω ∂μ, (U ω)^2 = 1 := by
|
| 341 |
+
have hU2i : Integrable (fun ω ↦ (U ω)^2) μ :=
|
| 342 |
+
Integrable.of_bound ((hUm.mono (ℱ.le 1)).pow 2).aestronglyMeasurable 1
|
| 343 |
+
(hU.mono (fun ω hω ↦ by
|
| 344 |
+
rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)]
|
| 345 |
+
nlinarith [abs_le.mp hω.1]))
|
| 346 |
+
have ht := tendsto_integral_of_dominated_convergence (μ := μ)
|
| 347 |
+
(F := fun n ω ↦ (f (terminalTime n) ω)^2) (fun _ : Ω ↦ (1 : ℝ))
|
| 348 |
+
(fun n ↦ (((h.measurable _ (terminalTime_mem n)).mono (ℱ.le _)).pow 2).aestronglyMeasurable)
|
| 349 |
+
(integrable_const 1)
|
| 350 |
+
(fun n ↦ Eventually.of_forall (fun ω ↦ by
|
| 351 |
+
rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)]
|
| 352 |
+
nlinarith [abs_le.mp (h.bounded _ (terminalTime_mem n) ω)]))
|
| 353 |
+
(hU.mono (fun ω hω ↦ hω.2.pow 2))
|
| 354 |
+
have hi : ∫ ω, (U ω)^2 ∂μ = 1 := by
|
| 355 |
+
have hh : (fun n ↦ ∫ ω, (f (terminalTime n) ω)^2 ∂μ) = terminalTime :=
|
| 356 |
+
funext (fun n ↦ h.secondMoment _ (terminalTime_mem n))
|
| 357 |
+
rw [hh] at ht
|
| 358 |
+
exact tendsto_nhds_unique ht (tendsto_nhdsWithin_iff.mp terminalTime_tendsto).1
|
| 359 |
+
have hnonneg : 0 ≤ᵐ[μ] (fun ω ↦ 1-(U ω)^2) := hU.mono (fun ω hω ↦ by
|
| 360 |
+
dsimp
|
| 361 |
+
nlinarith [abs_le.mp hω.1])
|
| 362 |
+
have hzero : ∫ ω, 1-(U ω)^2 ∂μ = 0 := by
|
| 363 |
+
rw [integral_sub (integrable_const 1) hU2i,hi]
|
| 364 |
+
simp
|
| 365 |
+
have he := (integral_eq_zero_iff_of_nonneg_ae hnonneg ((integrable_const 1).sub hU2i)).mp hzero
|
| 366 |
+
filter_upwards [he] with ω hω
|
| 367 |
+
change 1-(U ω)^2=0 at hω
|
| 368 |
+
linarith
|
| 369 |
+
|
| 370 |
+
lemma UnitMomentMartingale.terminal_mean_square
|
| 371 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 372 |
+
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 373 |
+
(hU : ∀ᵐ ω ∂μ, |U ω| ≤ 1 ∧
|
| 374 |
+
Tendsto (fun t ↦ f t ω) (𝓝[<] (1 : ℝ)) (𝓝 (U ω))) :
|
| 375 |
+
Tendsto (fun t ↦ ∫ ω, (f t ω-U ω)^2 ∂μ) (𝓝[<] (1 : ℝ)) (𝓝 (0 : ℝ)) := by
|
| 376 |
+
have hev : ∀ᶠ t in 𝓝[<] (1 : ℝ), t ∈ Ico (0 : ℝ) 1 := by
|
| 377 |
+
filter_upwards [Ioo_mem_nhdsLT (show (0 : ℝ)<1 by norm_num)] with t ht
|
| 378 |
+
exact ⟨ht.1.le,ht.2⟩
|
| 379 |
+
have ht := tendsto_integral_filter_of_dominated_convergence (μ := μ)
|
| 380 |
+
(F := fun t ω ↦ (f t ω-U ω)^2) (f := fun _ ↦ (0 : ℝ)) (fun _ : Ω ↦ (4 : ℝ))
|
| 381 |
+
(hev.mono (fun t ht ↦ ((((h.measurable t ht).mono (ℱ.le t)).sub
|
| 382 |
+
(hUm.mono (ℱ.le 1))).pow 2).aestronglyMeasurable))
|
| 383 |
+
(hev.mono (fun t ht ↦ hU.mono (fun ω hω ↦ by
|
| 384 |
+
rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)]
|
| 385 |
+
have hb := h.bounded t ht ω
|
| 386 |
+
have hd : |f t ω-U ω| ≤ 2 := (abs_sub _ _).trans (by linarith [hω.1])
|
| 387 |
+
nlinarith [sq_abs (f t ω-U ω),abs_nonneg (f t ω-U ω)])))
|
| 388 |
+
(integrable_const 4)
|
| 389 |
+
(hU.mono (fun ω hω ↦ by
|
| 390 |
+
simpa only [sub_self,zero_pow (by decide : (2 : ℕ) ≠ 0)] using (hω.2.sub_const (U ω)).pow 2))
|
| 391 |
+
simpa only [integral_zero] using ht
|
| 392 |
+
|
| 393 |
+
end SKValue
|
| 394 |
+
end
|
| 395 |
+
|
| 396 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/ValueEulerOneStep.lean
CHANGED
|
@@ -1,91 +1,91 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.ThirdOrderRemainderBound
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 25 |
-
open scoped Topology BigOperators
|
| 26 |
-
|
| 27 |
-
lemma value_euler_one_step {V : ℝ → ℝ → ℝ} {γ : ℝ → ℝ}
|
| 28 |
-
{t δ x z G K L : ℝ} (hδ : 0≤δ) (hδ1 : δ≤1)
|
| 29 |
-
(hG : 0≤G) (hK : 0≤K) (hL : 0≤L)
|
| 30 |
-
(hγ : MonotoneOn γ (Icc t (t+δ))) (hγ0 : 0≤γ t) (hγG : γ t≤G)
|
| 31 |
-
(hu : |deriv (V t) x|≤1) (hsmooth : ContDiff ℝ 3 (V t))
|
| 32 |
-
(ha : |deriv (deriv (V t)) x|≤K)
|
| 33 |
-
(hthird : ∀ y, |iteratedDeriv 3 (V t) y|≤K)
|
| 34 |
-
(hp : ∀ s ∈ Icc t (t+δ), ∀ y, |(1/2 : ℝ)*(deriv (V s) y)^2|≤K)
|
| 35 |
-
(haLip : ∀ s ∈ Icc t (t+δ), ∀ y,
|
| 36 |
-
|deriv (deriv (V s)) y-deriv (deriv (V t)) x|≤L*(|s-t|+|y-x|))
|
| 37 |
-
(hpLip : ∀ s ∈ Icc t (t+δ), ∀ y,
|
| 38 |
-
|(1/2 : ℝ)*(deriv (V s) y)^2-(1/2 : ℝ)*(deriv (V t) x)^2|≤L*(|s-t|+|y-x|))
|
| 39 |
-
(haint : ∀ y, IntervalIntegrable (fun s ↦ deriv (deriv (V s)) y) volume t (t+δ))
|
| 40 |
-
(hpint : ∀ y, IntervalIntegrable (fun s ↦ γ s*((1/2 : ℝ)*(deriv (V s) y)^2)) volume t (t+δ))
|
| 41 |
-
(hPDE : ∀ y, V (t+δ) y-V t y =
|
| 42 |
-
-(∫ s in t..(t+δ), (1/2 : ℝ)*deriv (deriv (V s)) y+γ s*((1/2 : ℝ)*(deriv (V s) y)^2))) :
|
| 43 |
-
let d := Real.sqrt δ*z+δ*γ t*deriv (V t) x
|
| 44 |
-
|V (t+δ) (x+d)-V t x-deriv (V t) x*Real.sqrt δ*z-
|
| 45 |
-
(1/2 : ℝ)*δ*deriv (deriv (V t)) x*(z^2-1)-
|
| 46 |
-
(1/2 : ℝ)*δ*γ t*(deriv (V t) x)^2| ≤
|
| 47 |
-
δ*Real.sqrt δ*(K*(|z|+G)^3+(1/2+G)*L*(1+|z|+G)+K*G*(|z|+G/2))+
|
| 48 |
-
δ*K*(γ (t+δ)-γ t) := by
|
| 49 |
-
dsimp only
|
| 50 |
-
let d := Real.sqrt δ*z+δ*γ t*deriv (V t) x
|
| 51 |
-
have htm := gradient_generator_quadrature
|
| 52 |
-
(b := fun s y ↦ deriv (deriv (V s)) y)
|
| 53 |
-
(p := fun s y ↦ (1/2 : ℝ)*(deriv (V s) y)^2) (y := x+d)
|
| 54 |
-
hδ hG hK hL hγ hγ0 hγG
|
| 55 |
-
(fun s hs ↦ hp s hs _) (fun s hs ↦ haLip s hs _) (fun s hs ↦ hpLip s hs _)
|
| 56 |
-
(haint _) (hpint _)
|
| 57 |
-
have ht : |(V (t+δ) (x+d)-V t x+deriv (V t) x-
|
| 58 |
-
(1/2 : ℝ)*δ*γ t*(deriv (V t) x)^2)-
|
| 59 |
-
(V t (x+d)-V t x+deriv (V t) x)+
|
| 60 |
-
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*deriv (V t) x*deriv (V t) x)| ≤
|
| 61 |
-
δ*(((1/2 : ℝ)+G)*L*(δ+|d|)+K*(γ (t+δ)-γ t)) := by
|
| 62 |
-
have heq : (V (t+δ) (x+d)-V t x+deriv (V t) x-
|
| 63 |
-
(1/2 : ℝ)*δ*γ t*(deriv (V t) x)^2)-
|
| 64 |
-
(V t (x+d)-V t x+deriv (V t) x)+
|
| 65 |
-
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*deriv (V t) x*deriv (V t) x) =
|
| 66 |
-
(V (t+δ) (x+d)-V t (x+d))+
|
| 67 |
-
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*((1/2 : ℝ)*(deriv (V t) x)^2)) := by ring
|
| 68 |
-
rw [heq,hPDE]
|
| 69 |
-
rw [show -(∫ s in t..(t+δ), (1/2 : ℝ)*deriv (deriv (V s)) (x+d)+
|
| 70 |
-
γ s*((1/2 : ℝ)*(deriv (V s) (x+d))^2))+
|
| 71 |
-
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*((1/2 : ℝ)*(deriv (V t) x)^2)) =
|
| 72 |
-
-((∫ s in t..(t+δ), (1/2 : ℝ)*deriv (deriv (V s)) (x+d)+
|
| 73 |
-
γ s*((1/2 : ℝ)*(deriv (V s) (x+d))^2))-
|
| 74 |
-
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*((1/2 : ℝ)*(deriv (V t) x)^2))) by ring,
|
| 75 |
-
abs_neg]
|
| 76 |
-
simpa only [add_sub_cancel_left] using htm
|
| 77 |
-
have hs : |(V t (x+d)-V t x+deriv (V t) x)-deriv (V t) x-
|
| 78 |
-
deriv (V t) x*d-(1/2 : ℝ)*deriv (deriv (V t)) x*d^2| ≤ K*|d|^3 := by
|
| 79 |
-
simpa only [add_sub_cancel_right] using third_order_remainder_bound hsmooth hK hthird x d
|
| 80 |
-
have hh := euler_cubic_remainder hδ hδ1 hG hK (by positivity : 0≤(1/2+G)*L)
|
| 81 |
-
(by rwa [abs_of_nonneg hγ0]) hu ha hs ht
|
| 82 |
-
convert hh using 1
|
| 83 |
-
congr 1
|
| 84 |
-
dsimp only [d]
|
| 85 |
-
ring
|
| 86 |
-
|
| 87 |
-
end SKValue
|
| 88 |
-
|
| 89 |
-
end
|
| 90 |
-
|
| 91 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.ThirdOrderRemainderBound
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 25 |
+
open scoped Topology BigOperators
|
| 26 |
+
|
| 27 |
+
lemma value_euler_one_step {V : ℝ → ℝ → ℝ} {γ : ℝ → ℝ}
|
| 28 |
+
{t δ x z G K L : ℝ} (hδ : 0≤δ) (hδ1 : δ≤1)
|
| 29 |
+
(hG : 0≤G) (hK : 0≤K) (hL : 0≤L)
|
| 30 |
+
(hγ : MonotoneOn γ (Icc t (t+δ))) (hγ0 : 0≤γ t) (hγG : γ t≤G)
|
| 31 |
+
(hu : |deriv (V t) x|≤1) (hsmooth : ContDiff ℝ 3 (V t))
|
| 32 |
+
(ha : |deriv (deriv (V t)) x|≤K)
|
| 33 |
+
(hthird : ∀ y, |iteratedDeriv 3 (V t) y|≤K)
|
| 34 |
+
(hp : ∀ s ∈ Icc t (t+δ), ∀ y, |(1/2 : ℝ)*(deriv (V s) y)^2|≤K)
|
| 35 |
+
(haLip : ∀ s ∈ Icc t (t+δ), ∀ y,
|
| 36 |
+
|deriv (deriv (V s)) y-deriv (deriv (V t)) x|≤L*(|s-t|+|y-x|))
|
| 37 |
+
(hpLip : ∀ s ∈ Icc t (t+δ), ∀ y,
|
| 38 |
+
|(1/2 : ℝ)*(deriv (V s) y)^2-(1/2 : ℝ)*(deriv (V t) x)^2|≤L*(|s-t|+|y-x|))
|
| 39 |
+
(haint : ∀ y, IntervalIntegrable (fun s ↦ deriv (deriv (V s)) y) volume t (t+δ))
|
| 40 |
+
(hpint : ∀ y, IntervalIntegrable (fun s ↦ γ s*((1/2 : ℝ)*(deriv (V s) y)^2)) volume t (t+δ))
|
| 41 |
+
(hPDE : ∀ y, V (t+δ) y-V t y =
|
| 42 |
+
-(∫ s in t..(t+δ), (1/2 : ℝ)*deriv (deriv (V s)) y+γ s*((1/2 : ℝ)*(deriv (V s) y)^2))) :
|
| 43 |
+
let d := Real.sqrt δ*z+δ*γ t*deriv (V t) x
|
| 44 |
+
|V (t+δ) (x+d)-V t x-deriv (V t) x*Real.sqrt δ*z-
|
| 45 |
+
(1/2 : ℝ)*δ*deriv (deriv (V t)) x*(z^2-1)-
|
| 46 |
+
(1/2 : ℝ)*δ*γ t*(deriv (V t) x)^2| ≤
|
| 47 |
+
δ*Real.sqrt δ*(K*(|z|+G)^3+(1/2+G)*L*(1+|z|+G)+K*G*(|z|+G/2))+
|
| 48 |
+
δ*K*(γ (t+δ)-γ t) := by
|
| 49 |
+
dsimp only
|
| 50 |
+
let d := Real.sqrt δ*z+δ*γ t*deriv (V t) x
|
| 51 |
+
have htm := gradient_generator_quadrature
|
| 52 |
+
(b := fun s y ↦ deriv (deriv (V s)) y)
|
| 53 |
+
(p := fun s y ↦ (1/2 : ℝ)*(deriv (V s) y)^2) (y := x+d)
|
| 54 |
+
hδ hG hK hL hγ hγ0 hγG
|
| 55 |
+
(fun s hs ↦ hp s hs _) (fun s hs ↦ haLip s hs _) (fun s hs ↦ hpLip s hs _)
|
| 56 |
+
(haint _) (hpint _)
|
| 57 |
+
have ht : |(V (t+δ) (x+d)-V t x+deriv (V t) x-
|
| 58 |
+
(1/2 : ℝ)*δ*γ t*(deriv (V t) x)^2)-
|
| 59 |
+
(V t (x+d)-V t x+deriv (V t) x)+
|
| 60 |
+
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*deriv (V t) x*deriv (V t) x)| ≤
|
| 61 |
+
δ*(((1/2 : ℝ)+G)*L*(δ+|d|)+K*(γ (t+δ)-γ t)) := by
|
| 62 |
+
have heq : (V (t+δ) (x+d)-V t x+deriv (V t) x-
|
| 63 |
+
(1/2 : ℝ)*δ*γ t*(deriv (V t) x)^2)-
|
| 64 |
+
(V t (x+d)-V t x+deriv (V t) x)+
|
| 65 |
+
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*deriv (V t) x*deriv (V t) x) =
|
| 66 |
+
(V (t+δ) (x+d)-V t (x+d))+
|
| 67 |
+
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*((1/2 : ℝ)*(deriv (V t) x)^2)) := by ring
|
| 68 |
+
rw [heq,hPDE]
|
| 69 |
+
rw [show -(∫ s in t..(t+δ), (1/2 : ℝ)*deriv (deriv (V s)) (x+d)+
|
| 70 |
+
γ s*((1/2 : ℝ)*(deriv (V s) (x+d))^2))+
|
| 71 |
+
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*((1/2 : ℝ)*(deriv (V t) x)^2)) =
|
| 72 |
+
-((∫ s in t..(t+δ), (1/2 : ℝ)*deriv (deriv (V s)) (x+d)+
|
| 73 |
+
γ s*((1/2 : ℝ)*(deriv (V s) (x+d))^2))-
|
| 74 |
+
δ*((1/2 : ℝ)*deriv (deriv (V t)) x+γ t*((1/2 : ℝ)*(deriv (V t) x)^2))) by ring,
|
| 75 |
+
abs_neg]
|
| 76 |
+
simpa only [add_sub_cancel_left] using htm
|
| 77 |
+
have hs : |(V t (x+d)-V t x+deriv (V t) x)-deriv (V t) x-
|
| 78 |
+
deriv (V t) x*d-(1/2 : ℝ)*deriv (deriv (V t)) x*d^2| ≤ K*|d|^3 := by
|
| 79 |
+
simpa only [add_sub_cancel_right] using third_order_remainder_bound hsmooth hK hthird x d
|
| 80 |
+
have hh := euler_cubic_remainder hδ hδ1 hG hK (by positivity : 0≤(1/2+G)*L)
|
| 81 |
+
(by rwa [abs_of_nonneg hγ0]) hu ha hs ht
|
| 82 |
+
convert hh using 1
|
| 83 |
+
congr 1
|
| 84 |
+
dsimp only [d]
|
| 85 |
+
ring
|
| 86 |
+
|
| 87 |
+
end SKValue
|
| 88 |
+
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/VariableTestLaw.lean
CHANGED
|
@@ -1,32 +1,32 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.ResponseContraction
|
| 3 |
-
import OAI.Probability.SKValue.Gaussian.UniformError
|
| 4 |
-
import OAI.Probability.SKValue.Equations.UniformPolynomial
|
| 5 |
-
|
| 6 |
-
namespace OAI
|
| 7 |
-
|
| 8 |
-
section
|
| 9 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
-
open scoped Topology NNReal
|
| 11 |
-
namespace SKValue
|
| 12 |
-
lemma IsDiffusion.splitResponse_varying {W:BrownianSpace} {γ:OrderParameter} {X:ℝ → W.Ω → ℝ}
|
| 13 |
-
(hX:IsDiffusion W γ X) (t:Ioo (0:ℝ) 1) {F:ℕ → ℝ → ℝ} {f:ℝ → ℝ}
|
| 14 |
-
(hF:∀ n,BoundedSmooth (F n)) (hf:BoundedSmooth f) (hl:BoundedUniformLimit F f) :
|
| 15 |
-
Tendsto (fun n ↦ profileResponse (splitTerminal γ t n) (F n) (γ.splitSegment 0 t t.property.1.le n) 0 0)
|
| 16 |
-
atTop (𝓝 (∫ z, f (X t z) ∂W.μ)) := by
|
| 17 |
-
obtain ⟨C,hC,hb,hfb⟩:=hl.bound
|
| 18 |
-
have he:∀ n,∃ D:ℝ,∀ x,|F n x-f x| ≤ D :=
|
| 19 |
-
fun n ↦ ⟨C+C,fun x ↦ (abs_sub _ _).trans (add_le_add (hb n x) (hfb x))⟩
|
| 20 |
-
have hel:=uniformDistance_tendsto hl.tendsto he
|
| 21 |
-
have hd:Tendsto (fun n ↦ profileResponse (splitTerminal γ t n) (F n) (γ.splitSegment 0 t t.property.1.le n) 0 0-
|
| 22 |
-
profileResponse (splitTerminal γ t n) f (γ.splitSegment 0 t t.property.1.le n) 0 0) atTop (𝓝 0) := by
|
| 23 |
-
apply squeeze_zero_norm (fun n ↦ ?_) hel
|
| 24 |
-
rw [Real.norm_eq_abs]
|
| 25 |
-
exact (splitTerminal_smooth γ t n).profile_response_contraction (hF n) hf (le_uniformDistance (he n)) _ _ _
|
| 26 |
-
have ht:=hd.add (hX.splitResponse_tendsto t hf)
|
| 27 |
-
simpa only [sub_add_cancel,zero_add] using ht
|
| 28 |
-
end SKValue
|
| 29 |
-
|
| 30 |
-
end
|
| 31 |
-
|
| 32 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.ResponseContraction
|
| 3 |
+
import OAI.Probability.SKValue.Gaussian.UniformError
|
| 4 |
+
import OAI.Probability.SKValue.Equations.UniformPolynomial
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 10 |
+
open scoped Topology NNReal
|
| 11 |
+
namespace SKValue
|
| 12 |
+
lemma IsDiffusion.splitResponse_varying {W:BrownianSpace} {γ:OrderParameter} {X:ℝ → W.Ω → ℝ}
|
| 13 |
+
(hX:IsDiffusion W γ X) (t:Ioo (0:ℝ) 1) {F:ℕ → ℝ → ℝ} {f:ℝ → ℝ}
|
| 14 |
+
(hF:∀ n,BoundedSmooth (F n)) (hf:BoundedSmooth f) (hl:BoundedUniformLimit F f) :
|
| 15 |
+
Tendsto (fun n ↦ profileResponse (splitTerminal γ t n) (F n) (γ.splitSegment 0 t t.property.1.le n) 0 0)
|
| 16 |
+
atTop (𝓝 (∫ z, f (X t z) ∂W.μ)) := by
|
| 17 |
+
obtain ⟨C,hC,hb,hfb⟩:=hl.bound
|
| 18 |
+
have he:∀ n,∃ D:ℝ,∀ x,|F n x-f x| ≤ D :=
|
| 19 |
+
fun n ↦ ⟨C+C,fun x ↦ (abs_sub _ _).trans (add_le_add (hb n x) (hfb x))⟩
|
| 20 |
+
have hel:=uniformDistance_tendsto hl.tendsto he
|
| 21 |
+
have hd:Tendsto (fun n ↦ profileResponse (splitTerminal γ t n) (F n) (γ.splitSegment 0 t t.property.1.le n) 0 0-
|
| 22 |
+
profileResponse (splitTerminal γ t n) f (γ.splitSegment 0 t t.property.1.le n) 0 0) atTop (𝓝 0) := by
|
| 23 |
+
apply squeeze_zero_norm (fun n ↦ ?_) hel
|
| 24 |
+
rw [Real.norm_eq_abs]
|
| 25 |
+
exact (splitTerminal_smooth γ t n).profile_response_contraction (hF n) hf (le_uniformDistance (he n)) _ _ _
|
| 26 |
+
have ht:=hd.add (hX.splitResponse_tendsto t hf)
|
| 27 |
+
simpa only [sub_add_cancel,zero_add] using ht
|
| 28 |
+
end SKValue
|
| 29 |
+
|
| 30 |
+
end
|
| 31 |
+
|
| 32 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/Volterra.lean
CHANGED
|
@@ -1,131 +1,131 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Control.Regularity
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory Set Filter Function
|
| 8 |
-
open scoped Topology NNReal Nat
|
| 9 |
-
namespace SKValue
|
| 10 |
-
structure VolterraData (T:ℝ) (hT:0≤T) where
|
| 11 |
-
field:ℝ → ℝ → ℝ
|
| 12 |
-
lip:ℝ≥0
|
| 13 |
-
bound:∀t∈Icc (0:ℝ) T,∀x y,dist (field t x) (field t y)≤lip*dist x y
|
| 14 |
-
integ:∀Y:C(Icc (0:ℝ) T,ℝ),IntervalIntegrable (fun s ↦ field s (Y (projIcc 0 T hT s))) volume 0 T
|
| 15 |
-
namespace VolterraData
|
| 16 |
-
variable {T:ℝ} {hT:0≤T} (D:VolterraData T hT)
|
| 17 |
-
noncomputable def next (Y:C(Icc (0:ℝ) T,ℝ)):C(Icc (0:ℝ) T,ℝ) where
|
| 18 |
-
toFun t:=∫s in (0:ℝ)..(t:ℝ),D.field s (Y (projIcc 0 T hT s))
|
| 19 |
-
continuous_toFun:=by
|
| 20 |
-
have hc:=intervalIntegral.continuousOn_primitive_interval' (D.integ Y) left_mem_uIcc
|
| 21 |
-
rw [uIcc_of_le hT] at hc
|
| 22 |
-
exact hc.domRestrict
|
| 23 |
-
lemma next_apply (Y:C(Icc (0:ℝ) T,ℝ)) (t:Icc (0:ℝ) T):
|
| 24 |
-
D.next Y t=∫s in (0:ℝ)..(t:ℝ),D.field s (Y (projIcc 0 T hT s)) :=rfl
|
| 25 |
-
lemma integ_to (Y:C(Icc (0:ℝ) T,ℝ)) (t:Icc (0:ℝ) T):
|
| 26 |
-
IntervalIntegrable (fun s ↦ D.field s (Y (projIcc 0 T hT s))) volume 0 t := by
|
| 27 |
-
apply (D.integ Y).mono_set
|
| 28 |
-
rw [uIcc_of_le t.2.1,uIcc_of_le hT]
|
| 29 |
-
exact Icc_subset_Icc le_rfl t.2.2
|
| 30 |
-
lemma iterate_bound (Y Z:C(Icc (0:ℝ) T,ℝ)) (n:ℕ) (t:Icc (0:ℝ) T):
|
| 31 |
-
dist ((D.next)^[n] Y t) ((D.next)^[n] Z t)≤
|
| 32 |
-
(D.lip*|((t:ℝ)-0)|)^n/n.factorial*dist Y Z := by
|
| 33 |
-
induction n generalizing t with
|
| 34 |
-
| zero=>simpa using ContinuousMap.dist_apply_le_dist (f:=Y) (g:=Z) t
|
| 35 |
-
| succ n hn=>
|
| 36 |
-
rw [iterate_succ_apply',iterate_succ_apply',dist_eq_norm,next_apply,next_apply,
|
| 37 |
-
←intervalIntegral.integral_sub (D.integ_to _ t) (D.integ_to _ t)]
|
| 38 |
-
calc
|
| 39 |
-
_≤∫s in uIoc (0:ℝ) (t:ℝ),(D.lip:ℝ)^(n+1)*|s-0|^n/n.factorial*dist Y Z := by
|
| 40 |
-
rw [intervalIntegral.norm_intervalIntegral_eq]
|
| 41 |
-
apply norm_integral_le_of_norm_le ((by fun_prop:Continuous (fun s:ℝ ↦
|
| 42 |
-
(D.lip:ℝ)^(n+1)*|s-0|^n/n.factorial*dist Y Z)).integrableOn_uIoc)
|
| 43 |
-
filter_upwards [ae_restrict_mem measurableSet_uIoc] with s hs
|
| 44 |
-
rw [uIoc_of_le t.2.1] at hs
|
| 45 |
-
have hsT:s∈Icc (0:ℝ) T:=⟨hs.1.le,hs.2.trans t.2.2⟩
|
| 46 |
-
rw [←dist_eq_norm]
|
| 47 |
-
have hp:=D.bound s hsT ((D.next)^[n] Y (projIcc 0 T hT s)) ((D.next)^[n] Z (projIcc 0 T hT s))
|
| 48 |
-
have hh:=hn (⟨s,hsT⟩:Icc (0:ℝ) T)
|
| 49 |
-
have he:projIcc 0 T hT s=(⟨s,hsT⟩:Icc (0:ℝ) T):=projIcc_of_mem hT hsT
|
| 50 |
-
rw [he] at hp ⊢
|
| 51 |
-
apply hp.trans
|
| 52 |
-
calc
|
| 53 |
-
_≤(D.lip:ℝ)*((D.lip*|s-0|)^n/n.factorial*dist Y Z):=mul_le_mul_of_nonneg_left hh D.lip.coe_nonneg
|
| 54 |
-
_=_:=by rw [mul_pow,pow_succ];ring
|
| 55 |
-
_≤_:=by
|
| 56 |
-
apply le_of_abs_le
|
| 57 |
-
rw [←intervalIntegral.abs_intervalIntegral_eq,intervalIntegral.integral_mul_const,
|
| 58 |
-
intervalIntegral.integral_div,intervalIntegral.integral_const_mul,abs_mul,abs_div,
|
| 59 |
-
abs_mul,intervalIntegral.abs_intervalIntegral_eq,integral_pow_abs_sub_uIoc,abs_div,
|
| 60 |
-
abs_pow,abs_pow,abs_dist,NNReal.abs_eq,abs_abs,mul_div,div_div,←abs_mul,
|
| 61 |
-
←Nat.cast_succ,←Nat.cast_mul,←Nat.factorial_succ,Nat.abs_cast,←mul_pow]
|
| 62 |
-
lemma exists_fixedPoint:∃Y:C(Icc (0:ℝ) T,ℝ),D.next Y=Y := by
|
| 63 |
-
obtain ⟨n,hn⟩:= (FloorSemiring.tendsto_pow_div_factorial_atTop ((D.lip:ℝ)*T)).eventually
|
| 64 |
-
(gt_mem_nhds zero_lt_one) |>.exists
|
| 65 |
-
have hn0:0≤((D.lip:ℝ)*T)^n/n.factorial:=by positivity
|
| 66 |
-
have hc:ContractingWith ⟨((D.lip:ℝ)*T)^n/n.factorial,hn0⟩ (D.next)^[n] := by
|
| 67 |
-
refine ⟨hn,LipschitzWith.of_dist_le_mul (fun Y Z ↦ ?_)⟩
|
| 68 |
-
rw [ContinuousMap.dist_le]
|
| 69 |
-
· intro t
|
| 70 |
-
apply (D.iterate_bound Y Z n t).trans
|
| 71 |
-
simp only [sub_zero,abs_of_nonneg t.2.1]
|
| 72 |
-
change (D.lip*↑t)^n/n.factorial*dist Y Z ≤ ((D.lip:ℝ)*T)^n/n.factorial*dist Y Z
|
| 73 |
-
gcongr
|
| 74 |
-
· exact mul_nonneg D.lip.coe_nonneg t.2.1
|
| 75 |
-
· exact t.2.2
|
| 76 |
-
· positivity
|
| 77 |
-
exact ⟨_,hc.isFixedPt_fixedPoint_iterate⟩
|
| 78 |
-
end VolterraData
|
| 79 |
-
end SKValue
|
| 80 |
-
|
| 81 |
-
end
|
| 82 |
-
|
| 83 |
-
section
|
| 84 |
-
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 85 |
-
open scoped Topology NNReal
|
| 86 |
-
namespace SKValue
|
| 87 |
-
lemma exists_local_diffusion_path (W:BrownianSpace) (γ:OrderParameter) {T:ℝ}
|
| 88 |
-
(hT:T∈Ico (0:ℝ) 1) (b:ℝ → ℝ) (hb:ContinuousOn b (Icc (0:ℝ) T)):
|
| 89 |
-
∃X:ℝ → ℝ,ContinuousOn X (Icc (0:ℝ) T) ∧
|
| 90 |
-
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s)) volume 0 T ∧
|
| 91 |
-
∀t∈Icc (0:ℝ) T,X t=b t+∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (X s) := by
|
| 92 |
-
obtain ⟨K,L,Lu,hLu,hG,hu⟩:=(sourceStripRegularity W γ).core T hT
|
| 93 |
-
have hg0:0≤γ.coeff T:=γ.nonneg T hT
|
| 94 |
-
have hi:IntervalIntegrable γ.coeff volume 0 T:=γ.intervalIntegrable.mono_set (by
|
| 95 |
-
rw [uIcc_of_le hT.1,uIcc_of_le (by norm_num:(0:ℝ)≤1)];exact Icc_subset_Icc le_rfl hT.2.le)
|
| 96 |
-
have hj:=derivative_joint_continuous hLu hu
|
| 97 |
-
let D:VolterraData T hT.1:={
|
| 98 |
-
field:=fun t y ↦ γ.coeff t*gradient W γ t (b t+y)
|
| 99 |
-
lip:=⟨γ.coeff T*Lu,mul_nonneg hg0 hLu⟩
|
| 100 |
-
bound:=by
|
| 101 |
-
intro t ht x y
|
| 102 |
-
have hg:0≤γ.coeff t:=γ.nonneg t ⟨ht.1,ht.2.trans_lt hT.2⟩
|
| 103 |
-
have hgt:γ.coeff t≤γ.coeff T:=γ.monotone ⟨ht.1,ht.2.trans_lt hT.2⟩ hT ht.2
|
| 104 |
-
simp only [Real.dist_eq,←mul_sub,abs_mul,abs_of_nonneg hg]
|
| 105 |
-
have hh:=hu t ht t ht (b t+x) (b t+y)
|
| 106 |
-
simp only [sub_self,abs_zero,zero_add,add_sub_add_left_eq_sub] at hh
|
| 107 |
-
change _≤(γ.coeff T*Lu)*|x-y|
|
| 108 |
-
calc
|
| 109 |
-
_≤γ.coeff t*(Lu*|x-y|):=mul_le_mul_of_nonneg_left hh hg
|
| 110 |
-
_≤γ.coeff T*(Lu*|x-y|):=mul_le_mul_of_nonneg_right hgt (by positivity)
|
| 111 |
-
_=_:=by ring
|
| 112 |
-
integ:=by
|
| 113 |
-
intro Y
|
| 114 |
-
apply hi.mul_continuousOn
|
| 115 |
-
rw [uIcc_of_le hT.1]
|
| 116 |
-
apply hj.comp (continuousOn_id.prodMk (hb.add ((Y.continuous.comp continuous_projIcc).continuousOn)))
|
| 117 |
-
exact fun t ht ↦ ht }
|
| 118 |
-
obtain ⟨Y,hY⟩:=D.exists_fixedPoint
|
| 119 |
-
let X:=fun t ↦ b t+Y (projIcc 0 T hT.1 t)
|
| 120 |
-
have hXcont:ContinuousOn X (Icc (0:ℝ) T):=hb.add ((Y.continuous.comp continuous_projIcc).continuousOn)
|
| 121 |
-
refine ⟨X,hXcont,D.integ Y,?_⟩
|
| 122 |
-
intro t ht
|
| 123 |
-
have he:=congrArg (fun f:C(Icc (0:ℝ) T,ℝ) ↦ f ⟨t,ht⟩) hY
|
| 124 |
-
change (∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (X s))=Y ⟨t,ht⟩ at he
|
| 125 |
-
dsimp only [X]
|
| 126 |
-
rw [projIcc_of_mem hT.1 ht,he]
|
| 127 |
-
end SKValue
|
| 128 |
-
|
| 129 |
-
end
|
| 130 |
-
|
| 131 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Control.Regularity
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory Set Filter Function
|
| 8 |
+
open scoped Topology NNReal Nat
|
| 9 |
+
namespace SKValue
|
| 10 |
+
structure VolterraData (T:ℝ) (hT:0≤T) where
|
| 11 |
+
field:ℝ → ℝ → ℝ
|
| 12 |
+
lip:ℝ≥0
|
| 13 |
+
bound:∀t∈Icc (0:ℝ) T,∀x y,dist (field t x) (field t y)≤lip*dist x y
|
| 14 |
+
integ:∀Y:C(Icc (0:ℝ) T,ℝ),IntervalIntegrable (fun s ↦ field s (Y (projIcc 0 T hT s))) volume 0 T
|
| 15 |
+
namespace VolterraData
|
| 16 |
+
variable {T:ℝ} {hT:0≤T} (D:VolterraData T hT)
|
| 17 |
+
noncomputable def next (Y:C(Icc (0:ℝ) T,ℝ)):C(Icc (0:ℝ) T,ℝ) where
|
| 18 |
+
toFun t:=∫s in (0:ℝ)..(t:ℝ),D.field s (Y (projIcc 0 T hT s))
|
| 19 |
+
continuous_toFun:=by
|
| 20 |
+
have hc:=intervalIntegral.continuousOn_primitive_interval' (D.integ Y) left_mem_uIcc
|
| 21 |
+
rw [uIcc_of_le hT] at hc
|
| 22 |
+
exact hc.domRestrict
|
| 23 |
+
lemma next_apply (Y:C(Icc (0:ℝ) T,ℝ)) (t:Icc (0:ℝ) T):
|
| 24 |
+
D.next Y t=∫s in (0:ℝ)..(t:ℝ),D.field s (Y (projIcc 0 T hT s)) :=rfl
|
| 25 |
+
lemma integ_to (Y:C(Icc (0:ℝ) T,ℝ)) (t:Icc (0:ℝ) T):
|
| 26 |
+
IntervalIntegrable (fun s ↦ D.field s (Y (projIcc 0 T hT s))) volume 0 t := by
|
| 27 |
+
apply (D.integ Y).mono_set
|
| 28 |
+
rw [uIcc_of_le t.2.1,uIcc_of_le hT]
|
| 29 |
+
exact Icc_subset_Icc le_rfl t.2.2
|
| 30 |
+
lemma iterate_bound (Y Z:C(Icc (0:ℝ) T,ℝ)) (n:ℕ) (t:Icc (0:ℝ) T):
|
| 31 |
+
dist ((D.next)^[n] Y t) ((D.next)^[n] Z t)≤
|
| 32 |
+
(D.lip*|((t:ℝ)-0)|)^n/n.factorial*dist Y Z := by
|
| 33 |
+
induction n generalizing t with
|
| 34 |
+
| zero=>simpa using ContinuousMap.dist_apply_le_dist (f:=Y) (g:=Z) t
|
| 35 |
+
| succ n hn=>
|
| 36 |
+
rw [iterate_succ_apply',iterate_succ_apply',dist_eq_norm,next_apply,next_apply,
|
| 37 |
+
←intervalIntegral.integral_sub (D.integ_to _ t) (D.integ_to _ t)]
|
| 38 |
+
calc
|
| 39 |
+
_≤∫s in uIoc (0:ℝ) (t:ℝ),(D.lip:ℝ)^(n+1)*|s-0|^n/n.factorial*dist Y Z := by
|
| 40 |
+
rw [intervalIntegral.norm_intervalIntegral_eq]
|
| 41 |
+
apply norm_integral_le_of_norm_le ((by fun_prop:Continuous (fun s:ℝ ↦
|
| 42 |
+
(D.lip:ℝ)^(n+1)*|s-0|^n/n.factorial*dist Y Z)).integrableOn_uIoc)
|
| 43 |
+
filter_upwards [ae_restrict_mem measurableSet_uIoc] with s hs
|
| 44 |
+
rw [uIoc_of_le t.2.1] at hs
|
| 45 |
+
have hsT:s∈Icc (0:ℝ) T:=⟨hs.1.le,hs.2.trans t.2.2⟩
|
| 46 |
+
rw [←dist_eq_norm]
|
| 47 |
+
have hp:=D.bound s hsT ((D.next)^[n] Y (projIcc 0 T hT s)) ((D.next)^[n] Z (projIcc 0 T hT s))
|
| 48 |
+
have hh:=hn (⟨s,hsT⟩:Icc (0:ℝ) T)
|
| 49 |
+
have he:projIcc 0 T hT s=(⟨s,hsT⟩:Icc (0:ℝ) T):=projIcc_of_mem hT hsT
|
| 50 |
+
rw [he] at hp ⊢
|
| 51 |
+
apply hp.trans
|
| 52 |
+
calc
|
| 53 |
+
_≤(D.lip:ℝ)*((D.lip*|s-0|)^n/n.factorial*dist Y Z):=mul_le_mul_of_nonneg_left hh D.lip.coe_nonneg
|
| 54 |
+
_=_:=by rw [mul_pow,pow_succ];ring
|
| 55 |
+
_≤_:=by
|
| 56 |
+
apply le_of_abs_le
|
| 57 |
+
rw [←intervalIntegral.abs_intervalIntegral_eq,intervalIntegral.integral_mul_const,
|
| 58 |
+
intervalIntegral.integral_div,intervalIntegral.integral_const_mul,abs_mul,abs_div,
|
| 59 |
+
abs_mul,intervalIntegral.abs_intervalIntegral_eq,integral_pow_abs_sub_uIoc,abs_div,
|
| 60 |
+
abs_pow,abs_pow,abs_dist,NNReal.abs_eq,abs_abs,mul_div,div_div,←abs_mul,
|
| 61 |
+
←Nat.cast_succ,←Nat.cast_mul,←Nat.factorial_succ,Nat.abs_cast,←mul_pow]
|
| 62 |
+
lemma exists_fixedPoint:∃Y:C(Icc (0:ℝ) T,ℝ),D.next Y=Y := by
|
| 63 |
+
obtain ⟨n,hn⟩:= (FloorSemiring.tendsto_pow_div_factorial_atTop ((D.lip:ℝ)*T)).eventually
|
| 64 |
+
(gt_mem_nhds zero_lt_one) |>.exists
|
| 65 |
+
have hn0:0≤((D.lip:ℝ)*T)^n/n.factorial:=by positivity
|
| 66 |
+
have hc:ContractingWith ⟨((D.lip:ℝ)*T)^n/n.factorial,hn0⟩ (D.next)^[n] := by
|
| 67 |
+
refine ⟨hn,LipschitzWith.of_dist_le_mul (fun Y Z ↦ ?_)⟩
|
| 68 |
+
rw [ContinuousMap.dist_le]
|
| 69 |
+
· intro t
|
| 70 |
+
apply (D.iterate_bound Y Z n t).trans
|
| 71 |
+
simp only [sub_zero,abs_of_nonneg t.2.1]
|
| 72 |
+
change (D.lip*↑t)^n/n.factorial*dist Y Z ≤ ((D.lip:ℝ)*T)^n/n.factorial*dist Y Z
|
| 73 |
+
gcongr
|
| 74 |
+
· exact mul_nonneg D.lip.coe_nonneg t.2.1
|
| 75 |
+
· exact t.2.2
|
| 76 |
+
· positivity
|
| 77 |
+
exact ⟨_,hc.isFixedPt_fixedPoint_iterate⟩
|
| 78 |
+
end VolterraData
|
| 79 |
+
end SKValue
|
| 80 |
+
|
| 81 |
+
end
|
| 82 |
+
|
| 83 |
+
section
|
| 84 |
+
open MeasureTheory ProbabilityTheory Set Filter Function
|
| 85 |
+
open scoped Topology NNReal
|
| 86 |
+
namespace SKValue
|
| 87 |
+
lemma exists_local_diffusion_path (W:BrownianSpace) (γ:OrderParameter) {T:ℝ}
|
| 88 |
+
(hT:T∈Ico (0:ℝ) 1) (b:ℝ → ℝ) (hb:ContinuousOn b (Icc (0:ℝ) T)):
|
| 89 |
+
∃X:ℝ → ℝ,ContinuousOn X (Icc (0:ℝ) T) ∧
|
| 90 |
+
IntervalIntegrable (fun s ↦ γ.coeff s*gradient W γ s (X s)) volume 0 T ∧
|
| 91 |
+
∀t∈Icc (0:ℝ) T,X t=b t+∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (X s) := by
|
| 92 |
+
obtain ⟨K,L,Lu,hLu,hG,hu⟩:=(sourceStripRegularity W γ).core T hT
|
| 93 |
+
have hg0:0≤γ.coeff T:=γ.nonneg T hT
|
| 94 |
+
have hi:IntervalIntegrable γ.coeff volume 0 T:=γ.intervalIntegrable.mono_set (by
|
| 95 |
+
rw [uIcc_of_le hT.1,uIcc_of_le (by norm_num:(0:ℝ)≤1)];exact Icc_subset_Icc le_rfl hT.2.le)
|
| 96 |
+
have hj:=derivative_joint_continuous hLu hu
|
| 97 |
+
let D:VolterraData T hT.1:={
|
| 98 |
+
field:=fun t y ↦ γ.coeff t*gradient W γ t (b t+y)
|
| 99 |
+
lip:=⟨γ.coeff T*Lu,mul_nonneg hg0 hLu⟩
|
| 100 |
+
bound:=by
|
| 101 |
+
intro t ht x y
|
| 102 |
+
have hg:0≤γ.coeff t:=γ.nonneg t ⟨ht.1,ht.2.trans_lt hT.2⟩
|
| 103 |
+
have hgt:γ.coeff t≤γ.coeff T:=γ.monotone ⟨ht.1,ht.2.trans_lt hT.2⟩ hT ht.2
|
| 104 |
+
simp only [Real.dist_eq,←mul_sub,abs_mul,abs_of_nonneg hg]
|
| 105 |
+
have hh:=hu t ht t ht (b t+x) (b t+y)
|
| 106 |
+
simp only [sub_self,abs_zero,zero_add,add_sub_add_left_eq_sub] at hh
|
| 107 |
+
change _≤(γ.coeff T*Lu)*|x-y|
|
| 108 |
+
calc
|
| 109 |
+
_≤γ.coeff t*(Lu*|x-y|):=mul_le_mul_of_nonneg_left hh hg
|
| 110 |
+
_≤γ.coeff T*(Lu*|x-y|):=mul_le_mul_of_nonneg_right hgt (by positivity)
|
| 111 |
+
_=_:=by ring
|
| 112 |
+
integ:=by
|
| 113 |
+
intro Y
|
| 114 |
+
apply hi.mul_continuousOn
|
| 115 |
+
rw [uIcc_of_le hT.1]
|
| 116 |
+
apply hj.comp (continuousOn_id.prodMk (hb.add ((Y.continuous.comp continuous_projIcc).continuousOn)))
|
| 117 |
+
exact fun t ht ↦ ht }
|
| 118 |
+
obtain ⟨Y,hY⟩:=D.exists_fixedPoint
|
| 119 |
+
let X:=fun t ↦ b t+Y (projIcc 0 T hT.1 t)
|
| 120 |
+
have hXcont:ContinuousOn X (Icc (0:ℝ) T):=hb.add ((Y.continuous.comp continuous_projIcc).continuousOn)
|
| 121 |
+
refine ⟨X,hXcont,D.integ Y,?_⟩
|
| 122 |
+
intro t ht
|
| 123 |
+
have he:=congrArg (fun f:C(Icc (0:ℝ) T,ℝ) ↦ f ⟨t,ht⟩) hY
|
| 124 |
+
change (∫s in (0:ℝ)..t,γ.coeff s*gradient W γ s (X s))=Y ⟨t,ht⟩ at he
|
| 125 |
+
dsimp only [X]
|
| 126 |
+
rw [projIcc_of_mem hT.1 ht,he]
|
| 127 |
+
end SKValue
|
| 128 |
+
|
| 129 |
+
end
|
| 130 |
+
|
| 131 |
+
end OAI
|
lean/OAI/Probability/SKValue/Processes/WeightedTerminalExpectation.lean
CHANGED
|
@@ -1,78 +1,78 @@
|
|
| 1 |
-
import Mathlib
|
| 2 |
-
import OAI.Probability.SKValue.Equations.RealFiltration
|
| 3 |
-
|
| 4 |
-
namespace OAI
|
| 5 |
-
|
| 6 |
-
section
|
| 7 |
-
open MeasureTheory ProbabilityTheory Set
|
| 8 |
-
open scoped ENNReal NNReal BigOperators
|
| 9 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
-
open scoped BigOperators Topology
|
| 11 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
-
open scoped Topology BigOperators
|
| 13 |
-
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
-
open scoped Topology ENNReal NNReal
|
| 15 |
-
open Filter Set
|
| 16 |
-
open scoped Topology BigOperators
|
| 17 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
-
open scoped Topology
|
| 19 |
-
open MeasureTheory Set Filter
|
| 20 |
-
open scoped Topology BigOperators
|
| 21 |
-
open MeasureTheory Set Filter Finset
|
| 22 |
-
open scoped Topology BigOperators
|
| 23 |
-
namespace SKValue
|
| 24 |
-
open MeasureTheory ProbabilityTheory Filter Set
|
| 25 |
-
open scoped Topology
|
| 26 |
-
|
| 27 |
-
lemma UnitMomentMartingale.weighted_terminal_expectation
|
| 28 |
-
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 29 |
-
{ℱ : Filtration ℝ ‹MeasurableSpace Ω›} {f : ℝ → Ω → ℝ}
|
| 30 |
-
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 31 |
-
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 32 |
-
(hU : ∀ᵐ ω ∂μ, |U ω|≤1 ∧ Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω)))
|
| 33 |
-
{γ : ℝ → ℝ} {T : ℝ} (hT : 0≤T) (hT1 : T<1)
|
| 34 |
-
(hc : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ f t ω) (Icc (0 : ℝ) T))
|
| 35 |
-
(hγ : IntervalIntegrable γ volume 0 T) :
|
| 36 |
-
(∫ ω, U ω*(∫ t in (0 : ℝ)..T, γ t*f t ω) ∂μ)=∫ t in (0 : ℝ)..T, t*γ t := by
|
| 37 |
-
have hm (t : ℝ) (ht : t∈Icc (0 : ℝ) T) : t∈Ico (0 : ℝ) 1 := ⟨ht.1,ht.2.trans_lt hT1⟩
|
| 38 |
-
rw [compact_weighted_fubini hT (fun t ht ↦ (h.measurable t (hm t ht)).mono (ℱ.le t))
|
| 39 |
-
hc (fun t ht ↦ h.bounded t (hm t ht)) (hUm.mono (ℱ.le 1)).aestronglyMeasurable
|
| 40 |
-
(hU.mono (fun _ hω ↦ hω.1)) hγ]
|
| 41 |
-
apply intervalIntegral.integral_congr
|
| 42 |
-
intro t ht
|
| 43 |
-
rw [uIcc_of_le hT] at ht
|
| 44 |
-
change γ t * (∫ ω, U ω * f t ω ∂μ) = t * γ t
|
| 45 |
-
rw [h.terminal_past_product hUm hU (hm t ht),mul_comm]
|
| 46 |
-
|
| 47 |
-
lemma bounded_multiplier_integral_difference {Ω : Type*} [MeasurableSpace Ω]
|
| 48 |
-
{μ : Measure Ω} {U X Y : Ω → ℝ}
|
| 49 |
-
(hU : AEStronglyMeasurable U μ) (hb : ∀ᵐ ω ∂μ, |U ω|≤1)
|
| 50 |
-
(hX : Integrable X μ) (hY : Integrable Y μ) :
|
| 51 |
-
|(∫ ω, U ω*X ω ∂μ)-(∫ ω, U ω*Y ω ∂μ)|≤∫ ω, |X ω-Y ω| ∂μ := by
|
| 52 |
-
have hUb : ∀ᵐ ω ∂μ, ‖U ω‖≤1 := hb.mono (fun ω hω ↦ by simpa only [Real.norm_eq_abs] using hω)
|
| 53 |
-
have hUX := hX.bdd_mul hU hUb
|
| 54 |
-
have hUY := hY.bdd_mul hU hUb
|
| 55 |
-
rw [←integral_sub hUX hUY]
|
| 56 |
-
apply abs_integral_le_integral_abs.trans
|
| 57 |
-
apply integral_mono_ae (hUX.sub hUY).abs (hX.sub hY).abs
|
| 58 |
-
filter_upwards [hb] with ω hω
|
| 59 |
-
dsimp only [Pi.sub_apply]
|
| 60 |
-
rw [←mul_sub,abs_mul]
|
| 61 |
-
exact (mul_le_mul_of_nonneg_right hω (abs_nonneg _)).trans_eq (one_mul _)
|
| 62 |
-
|
| 63 |
-
lemma bounded_multiplier_integral_tendsto {Ω I : Type*} [MeasurableSpace Ω]
|
| 64 |
-
{μ : Measure Ω} {l : Filter I} {U : Ω → ℝ} {X : I → Ω → ℝ} {Y : Ω → ℝ}
|
| 65 |
-
(hU : AEStronglyMeasurable U μ) (hb : ∀ᵐ ω ∂μ, |U ω|≤1)
|
| 66 |
-
(hX : ∀ᶠ t in l, Integrable (X t) μ) (hY : Integrable Y μ)
|
| 67 |
-
(hL1 : Tendsto (fun t ↦ ∫ ω, |X t ω-Y ω| ∂μ) l (𝓝 (0 : ℝ))) :
|
| 68 |
-
Tendsto (fun t ↦ ∫ ω, U ω*X t ω ∂μ) l (𝓝 (∫ ω, U ω*Y ω ∂μ)) := by
|
| 69 |
-
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 70 |
-
apply squeeze_zero' (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_ hL1
|
| 71 |
-
filter_upwards [hX] with t ht
|
| 72 |
-
simpa only [Real.norm_eq_abs] using bounded_multiplier_integral_difference hU hb ht hY
|
| 73 |
-
|
| 74 |
-
end SKValue
|
| 75 |
-
|
| 76 |
-
end
|
| 77 |
-
|
| 78 |
-
end OAI
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Probability.SKValue.Equations.RealFiltration
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
open MeasureTheory ProbabilityTheory Set
|
| 8 |
+
open scoped ENNReal NNReal BigOperators
|
| 9 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 10 |
+
open scoped BigOperators Topology
|
| 11 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open MeasureTheory ProbabilityTheory Set Filter
|
| 14 |
+
open scoped Topology ENNReal NNReal
|
| 15 |
+
open Filter Set
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 18 |
+
open scoped Topology
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
open scoped Topology BigOperators
|
| 21 |
+
open MeasureTheory Set Filter Finset
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
namespace SKValue
|
| 24 |
+
open MeasureTheory ProbabilityTheory Filter Set
|
| 25 |
+
open scoped Topology
|
| 26 |
+
|
| 27 |
+
lemma UnitMomentMartingale.weighted_terminal_expectation
|
| 28 |
+
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
|
| 29 |
+
{ℱ : Filtration ℝ ‹MeasurableSpace Ω›} {f : ℝ → Ω → ℝ}
|
| 30 |
+
(h : UnitMomentMartingale (μ := μ) ℱ f) {U : Ω → ℝ}
|
| 31 |
+
(hUm : StronglyMeasurable[ℱ 1] U)
|
| 32 |
+
(hU : ∀ᵐ ω ∂μ, |U ω|≤1 ∧ Tendsto (fun n ↦ f (terminalTime n) ω) atTop (𝓝 (U ω)))
|
| 33 |
+
{γ : ℝ → ℝ} {T : ℝ} (hT : 0≤T) (hT1 : T<1)
|
| 34 |
+
(hc : ∀ᵐ ω ∂μ, ContinuousOn (fun t ↦ f t ω) (Icc (0 : ℝ) T))
|
| 35 |
+
(hγ : IntervalIntegrable γ volume 0 T) :
|
| 36 |
+
(∫ ω, U ω*(∫ t in (0 : ℝ)..T, γ t*f t ω) ∂μ)=∫ t in (0 : ℝ)..T, t*γ t := by
|
| 37 |
+
have hm (t : ℝ) (ht : t∈Icc (0 : ℝ) T) : t∈Ico (0 : ℝ) 1 := ⟨ht.1,ht.2.trans_lt hT1⟩
|
| 38 |
+
rw [compact_weighted_fubini hT (fun t ht ↦ (h.measurable t (hm t ht)).mono (ℱ.le t))
|
| 39 |
+
hc (fun t ht ↦ h.bounded t (hm t ht)) (hUm.mono (ℱ.le 1)).aestronglyMeasurable
|
| 40 |
+
(hU.mono (fun _ hω ↦ hω.1)) hγ]
|
| 41 |
+
apply intervalIntegral.integral_congr
|
| 42 |
+
intro t ht
|
| 43 |
+
rw [uIcc_of_le hT] at ht
|
| 44 |
+
change γ t * (∫ ω, U ω * f t ω ∂μ) = t * γ t
|
| 45 |
+
rw [h.terminal_past_product hUm hU (hm t ht),mul_comm]
|
| 46 |
+
|
| 47 |
+
lemma bounded_multiplier_integral_difference {Ω : Type*} [MeasurableSpace Ω]
|
| 48 |
+
{μ : Measure Ω} {U X Y : Ω → ℝ}
|
| 49 |
+
(hU : AEStronglyMeasurable U μ) (hb : ∀ᵐ ω ∂μ, |U ω|≤1)
|
| 50 |
+
(hX : Integrable X μ) (hY : Integrable Y μ) :
|
| 51 |
+
|(∫ ω, U ω*X ω ∂μ)-(∫ ω, U ω*Y ω ∂μ)|≤∫ ω, |X ω-Y ω| ∂μ := by
|
| 52 |
+
have hUb : ∀ᵐ ω ∂μ, ‖U ω‖≤1 := hb.mono (fun ω hω ↦ by simpa only [Real.norm_eq_abs] using hω)
|
| 53 |
+
have hUX := hX.bdd_mul hU hUb
|
| 54 |
+
have hUY := hY.bdd_mul hU hUb
|
| 55 |
+
rw [←integral_sub hUX hUY]
|
| 56 |
+
apply abs_integral_le_integral_abs.trans
|
| 57 |
+
apply integral_mono_ae (hUX.sub hUY).abs (hX.sub hY).abs
|
| 58 |
+
filter_upwards [hb] with ω hω
|
| 59 |
+
dsimp only [Pi.sub_apply]
|
| 60 |
+
rw [←mul_sub,abs_mul]
|
| 61 |
+
exact (mul_le_mul_of_nonneg_right hω (abs_nonneg _)).trans_eq (one_mul _)
|
| 62 |
+
|
| 63 |
+
lemma bounded_multiplier_integral_tendsto {Ω I : Type*} [MeasurableSpace Ω]
|
| 64 |
+
{μ : Measure Ω} {l : Filter I} {U : Ω → ℝ} {X : I → Ω → ℝ} {Y : Ω → ℝ}
|
| 65 |
+
(hU : AEStronglyMeasurable U μ) (hb : ∀ᵐ ω ∂μ, |U ω|≤1)
|
| 66 |
+
(hX : ∀ᶠ t in l, Integrable (X t) μ) (hY : Integrable Y μ)
|
| 67 |
+
(hL1 : Tendsto (fun t ↦ ∫ ω, |X t ω-Y ω| ∂μ) l (𝓝 (0 : ℝ))) :
|
| 68 |
+
Tendsto (fun t ↦ ∫ ω, U ω*X t ω ∂μ) l (𝓝 (∫ ω, U ω*Y ω ∂μ)) := by
|
| 69 |
+
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 70 |
+
apply squeeze_zero' (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_ hL1
|
| 71 |
+
filter_upwards [hX] with t ht
|
| 72 |
+
simpa only [Real.norm_eq_abs] using bounded_multiplier_integral_difference hU hb ht hY
|
| 73 |
+
|
| 74 |
+
end SKValue
|
| 75 |
+
|
| 76 |
+
end
|
| 77 |
+
|
| 78 |
+
end OAI
|