cfahlgren1/math / lean /OAI /Probability /SKGap /Matrix /StaticCovarianceMatrix.lean
cfahlgren1's picture
download
raw
13 kB
import Mathlib
import OAI.Probability.SKGap.Stability.PlantedFieldArray
namespace OAI
section
open scoped BigOperators
open scoped BigOperators
open scoped BigOperators
open scoped BigOperators
open scoped BigOperators
open scoped BigOperators NNReal
open MeasureTheory ProbabilityTheory
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal
open MeasureTheory ProbabilityTheory
open scoped BigOperators NNReal ENNReal
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal ENNReal
open MeasureTheory ProbabilityTheory
open scoped BigOperators Matrix Matrix.Norms.Elementwise
open scoped BigOperators
open MeasureTheory ProbabilityTheory
open scoped BigOperators Matrix Matrix.Norms.Elementwise
open scoped BigOperators
open scoped BigOperators NNReal ENNReal
open MeasureTheory Metric Set
open scoped BigOperators NNReal ENNReal
open MeasureTheory ProbabilityTheory Filter Set
open scoped BigOperators NNReal ENNReal Matrix.Norms.L2Operator
open MeasureTheory ProbabilityTheory Filter Set
open scoped BigOperators Matrix.Norms.L2Operator
open MeasureTheory ProbabilityTheory Filter Set
open scoped BigOperators Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Set
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators ENNReal NNReal
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal ENNReal Matrix
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators ENNReal NNReal
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal ENNReal
open scoped BigOperators
open MeasureTheory ProbabilityTheory
open scoped BigOperators Matrix Matrix.Norms.Elementwise NNReal ENNReal
open scoped BigOperators
open Filter Topology
open MeasureTheory ProbabilityTheory Filter
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal ENNReal Topology
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal ENNReal Topology
open MeasureTheory ProbabilityTheory Filter
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal Topology
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal Topology BigOperators
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal Topology BigOperators
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal Topology BigOperators
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal NNReal Topology BigOperators
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Set Matrix
open scoped BigOperators NNReal ENNReal Matrix.Norms.L2Operator
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise
open Filter MeasureTheory ProbabilityTheory
open scoped Topology NNReal ENNReal
open Filter MeasureTheory ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter
open scoped Topology NNReal ENNReal
open MeasureTheory Filter ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter
open scoped Topology
open MeasureTheory Filter ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter ProbabilityTheory ContinuousLinearMap
open scoped Topology NNReal ENNReal
open Filter MeasureTheory ProbabilityTheory
open scoped Topology NNReal ENNReal
open MeasureTheory Filter
open scoped BigOperators Topology
open MeasureTheory Filter
open scoped BigOperators Topology
open MeasureTheory Filter
open scoped BigOperators Topology
open MeasureTheory Filter
open scoped BigOperators Topology
open MeasureTheory Filter
open scoped BigOperators Topology
open Filter Set Metric
open scoped Topology RealInnerProductSpace
open scoped BigOperators
open ContinuousLinearMap
open scoped BigOperators
open ContinuousLinearMap
open scoped Topology Interval
open MeasureTheory
open MeasureTheory
open scoped BigOperators Topology Interval
open MeasureTheory
open scoped BigOperators Topology Interval
open scoped Topology
open MeasureTheory
open scoped BigOperators Topology Interval
open scoped BigOperators Topology
open MeasureTheory
open scoped BigOperators Topology Interval RealInnerProductSpace
open MeasureTheory Filter
open scoped BigOperators Topology Interval
open MeasureTheory Filter
open scoped Topology
open MeasureTheory Filter
open scoped Topology
open MeasureTheory Filter
open scoped Topology
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators NNReal ENNReal Matrix.Norms.L2Operator
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped BigOperators ENNReal NNReal Topology Matrix.Norms.L2Operator
open MeasureTheory ProbabilityTheory Filter Matrix
open scoped BigOperators ENNReal Matrix.Norms.L2Operator
namespace SKGapCutoff
noncomputable def staticCovarianceMatrix {n : ℕ} (J : Interaction n) : Interaction n :=
fun i j => gibbsExpectation J (fun x => spin x i*spin x j)
lemma staticCovarianceMatrix_diag {n : ℕ} (J : Interaction n) (i : Fin n) :
staticCovarianceMatrix J i i=1 := by
simp only [staticCovarianceMatrix,← sq,spin_sq,gibbsExpectation_const]
lemma staticCovarianceMatrix_trace {n : ℕ} (J : Interaction n) :
Matrix.trace (staticCovarianceMatrix J)=(n:ℝ) := by
simp [Matrix.trace,staticCovarianceMatrix_diag]
lemma trace_mul_staticCovarianceMatrix {n : ℕ} (J A : Interaction n) :
Matrix.trace (A*staticCovarianceMatrix J) =
gibbsExpectation J (fun x => ∑ i, spin x i*(A *ᵥ spin x) i) := by
simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply,staticCovarianceMatrix,
Matrix.mulVec,dotProduct,Finset.mul_sum,gibbsExpectation_sum]
apply Finset.sum_congr rfl
intro i _
apply Finset.sum_congr rfl
intro j _
rw [← gibbsExpectation_mul_const]
congr 1
funext x
ring
noncomputable def normalizedStaticCovarianceTrace {n : ℕ} (J A : Interaction n) : ℝ :=
Matrix.trace (A*staticCovarianceMatrix J)/(n:ℝ)
lemma normalizedStaticCovarianceTrace_self {n : ℕ} (g : GaussianCoordinates n) :
normalizedStaticCovarianceTrace (sampledInteraction g) (sampledInteraction g) =
Regression.gibbsSpinEnergyAverage g := by
rw [normalizedStaticCovarianceTrace,trace_mul_staticCovarianceMatrix]
simp only [Regression.gibbsSpinEnergyAverage,Regression.spinEnergyAverage,
Regression.gaugedField,field,Matrix.mulVec,dotProduct,gibbsExpectation,Finset.sum_div,mul_div_assoc]
lemma normalizedStaticCovarianceTrace_square {n : ℕ} (g : GaussianCoordinates n) :
normalizedStaticCovarianceTrace (sampledInteraction g) ((sampledInteraction g)^2) =
Regression.gibbsSpinFieldSquareAverage g := by
rw [normalizedStaticCovarianceTrace,trace_mul_staticCovarianceMatrix]
have he (x : Spin n) : (∑ i, spin x i*((sampledInteraction g)^2 *ᵥ spin x) i) =
∑ i, Regression.gaugedField x g i^2 := by
have hgauge (i : Fin n) : Regression.gaugedField x g i^2 =
((sampledInteraction g) *ᵥ spin x) i^2 := by
simp only [Regression.gaugedField,mul_pow,spin_sq,one_mul]
rfl
simp_rw [hgauge]
rw [pow_two,← Matrix.mulVec_mulVec]
change dotProduct (spin x) ((sampledInteraction g) *ᵥ ((sampledInteraction g) *ᵥ spin x)) = _
rw [dotProduct_mulVec]
have hvec : spin x ᵥ* sampledInteraction g = sampledInteraction g *ᵥ spin x := by
ext i
simp only [Matrix.vecMul,Matrix.mulVec,dotProduct]
apply Finset.sum_congr rfl
intro j _
rw [sampledInteraction_symm g j i,mul_comm]
rw [hvec]
simp only [dotProduct,pow_two]
simp_rw [he]
simp only [Regression.gibbsSpinFieldSquareAverage,Regression.spinFieldSquareAverage,
gibbsExpectation,Finset.sum_div,mul_div_assoc]
lemma normalizedStaticCovarianceTrace_one {n : ℕ} (hn : 0<n) (J : Interaction n) :
normalizedStaticCovarianceTrace J 1=1 := by
rw [normalizedStaticCovarianceTrace,one_mul,staticCovarianceMatrix_trace]
exact div_self (Nat.cast_ne_zero.mpr hn.ne')
lemma normalizedStaticCovarianceTrace_smul {n : ℕ} (J A : Interaction n) (c : ℝ) :
normalizedStaticCovarianceTrace J (c • A)=c*normalizedStaticCovarianceTrace J A := by
simp [normalizedStaticCovarianceTrace,Matrix.trace_smul,mul_div_assoc]
lemma normalizedStaticCovarianceTrace_sub {n : ℕ} (J A B : Interaction n) :
normalizedStaticCovarianceTrace J (A-B)=
normalizedStaticCovarianceTrace J A-normalizedStaticCovarianceTrace J B := by
simp [normalizedStaticCovarianceTrace,Matrix.sub_mul,Matrix.trace_sub,sub_div]
theorem staticCovariance_P1_limit (β : ℝ) (hβ : 0<β) (hβ1 : β<1)
(ε : ℝ) (hε : 0<ε) :
Tendsto (fun n => disorderLaw β n {g | ε ≤ |normalizedStaticCovarianceTrace
(sampledInteraction g) (β⁻¹ • sampledInteraction g)-β|}) atTop (nhds 0) := by
have hh := Regression.gibbsSpinEnergyAverage_limit β hβ hβ1 (β*ε) (by positivity)
convert! hh using 1
funext n
congr 1
ext g
simp only [Set.mem_ofPred_eq]
rw [normalizedStaticCovarianceTrace_smul,normalizedStaticCovarianceTrace_self]
have he : β⁻¹*Regression.gibbsSpinEnergyAverage g-β =
(Regression.gibbsSpinEnergyAverage g-β^2)/β := by field_simp
simp only [he,abs_div,abs_of_pos hβ]
exact (le_div_iff₀ hβ).trans (by rw [mul_comm ε β])
theorem staticCovariance_P2_limit (β : ℝ) (hβ : 0<β) (hβ1 : β<1)
(ε : ℝ) (hε : 0<ε) :
Tendsto (fun n => disorderLaw β n {g | ε ≤ |normalizedStaticCovarianceTrace
(sampledInteraction g) ((β⁻¹ • sampledInteraction g)^2-1)-β^2|}) atTop (nhds 0) := by
have hh := Regression.gibbsSpinFieldSquareAverage_limit β hβ hβ1 (β^2*ε) (by positivity)
apply hh.congr'
filter_upwards [eventually_gt_atTop 0] with n hn
congr 1
ext g
simp only [Set.mem_ofPred_eq]
rw [normalizedStaticCovarianceTrace_sub,smul_pow,normalizedStaticCovarianceTrace_smul,
normalizedStaticCovarianceTrace_square,normalizedStaticCovarianceTrace_one hn]
have he : (β⁻¹)^2*Regression.gibbsSpinFieldSquareAverage g-1-β^2 =
(Regression.gibbsSpinFieldSquareAverage g-(β^2+β^4))/β^2 := by field_simp; ring
simp only [he,abs_div,abs_of_pos (sq_pos_of_pos hβ)]
exact ((le_div_iff₀ (sq_pos_of_pos hβ)).trans (by rw [mul_comm ε (β^2)])).symm
end SKGapCutoff
end
end OAI

Xet Storage Details

Size:
13 kB
·
Xet hash:
ceb124e7903cab9a3219c28144feb75d0093dd1e50d15977346e4b264a3cc486

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.