Download lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 4.88 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean
-
curl -L -o SpinModel.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean
4.88 kB
Lean 4 · 35
declarations statementsfull
abbrev Spin (n : ℕ) := Fin n → Bool abbrev Edge (n : ℕ) := {p : Fin n × Fin n // p.1 < p.2} abbrev Disorder (n : ℕ) := Edge n → ℝ def spinValue (b : Bool) : ℝ := if b then 1 else -1 def hamiltonian {n : ℕ} (W : Disorder n) (x : Spin n) : ℝ := body · 1 line
∑ e : Edge n, W e * spinValue (x e.val.1) * spinValue (x e.val.2)def partition {n : ℕ} (W : Disorder n) : ℝ := body · 1 line
∑ x : Spin n, Real.exp (hamiltonian W x)def gibbs {n : ℕ} (W : Disorder n) (x : Spin n) : ℝ := body · 1 line
Real.exp (hamiltonian W x) / partition Wdef disorderLaw (n : ℕ) : Measure (Disorder n) := body · 1 line
Measure.pi fun _ : Edge n => gaussianReal 0 (n : ℝ≥0)⁻¹def sameExcept {n : ℕ} (i : Fin n) (x y : Spin n) : Prop := body · 1 line
∀ j, j ≠ i → y j = x jinstance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := body · 1 line
Classical.propDecidable _def siteKernel {n : ℕ} (W : Disorder n) (i : Fin n) : Matrix (Spin n) (Spin n) ℝ := body · 3 lines
fun x y => if sameExcept i x y then
gibbs W y / (∑ z : Spin n, if sameExcept i x z then gibbs W z else 0)
else 0def discreteKernel {n : ℕ} (W : Disorder n) : Matrix (Spin n) (Spin n) ℝ := body · 1 line
(n : ℝ)⁻¹ • ∑ i : Fin n, siteKernel W idef generator {n : ℕ} (W : Disorder n) : Matrix (Spin n) (Spin n) ℝ := body · 1 line
∑ i : Fin n, (siteKernel W i - 1)def continuousKernel {n : ℕ} (W : Disorder n) (t : ℝ) :
Matrix (Spin n) (Spin n) ℝ := body · 1 line
NormedSpace.exp (t • generator W)def totalVariation {n : ℕ} (W : Disorder n) (p : Spin n → ℝ) : ℝ := body · 1 line
(1 / 2 : ℝ) * ∑ y : Spin n, |p y - gibbs W y|def continuousDistance {n : ℕ} (W : Disorder n) (t : ℝ) (x : Spin n) : ℝ := body · 1 line
totalVariation W (continuousKernel W t x)def discreteDistance {n : ℕ} (W : Disorder n) (k : ℕ) (x : Spin n) : ℝ := body · 1 line
totalVariation W ((discreteKernel W ^ k) x)def continuousMixingTime {n : ℕ} (W : Disorder n) : ℝ := body · 1 line
sInf {t : ℝ | 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ 1 / 4}def discreteMixingTime {n : ℕ} (W : Disorder n) : ℕ := body · 1 line
sInf {k : ℕ | ∀ x, discreteDistance W k x ≤ 1 / 4}def mean {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : ℝ := body · 1 line
∑ x : Spin n, gibbs W x * f xdef variance {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : ℝ := body · 1 line
mean W (fun x => (f x - mean W f) ^ 2)def dirichlet {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : ℝ := body · 1 line
∑ i : Fin n, mean W (fun x => (f x - ∑ y : Spin n, siteKernel W i x y * f y) ^ 2)def linearObservable {n : ℕ} (a : Fin n → ℝ) (x : Spin n) : ℝ := body · 1 line
∑ i : Fin n, a i * spinValue (x i)def covariance {n : ℕ} (W : Disorder n) : Matrix (Fin n) (Fin n) ℝ := body · 3 lines
fun i j => mean W (fun x =>
(spinValue (x i) - mean W (fun y => spinValue (y i))) *
(spinValue (x j) - mean W (fun y => spinValue (y j))))def covarianceNorm {n : ℕ} (W : Disorder n) : ℝ := body · 1 line
‖(covariance W).toEuclideanLin.toContinuousLinearMap‖def linearRayleigh {n : ℕ} (W : Disorder n) : ℝ := body · 2 lines
sSup {r : ℝ | ∃ a : Fin n → ℝ, a ≠ 0 ∧
r = variance W (linearObservable a) / dirichlet W (linearObservable a)}def continuousGoodMass {n : ℕ} (W : Disorder n) (t : ℝ) : ℝ := body · 1 line
∑ x : Spin n, if 1 / 4 < continuousDistance W t x then gibbs W x else 0def discreteGoodMass {n : ℕ} (W : Disorder n) (k : ℕ) : ℝ := body · 1 line
∑ x : Spin n, if 1 / 4 < discreteDistance W k x then gibbs W x else 0@[simp] lemma spinValue_sq (b : Bool) : spinValue b ^ 2 = 1 := by proof · 1 line
cases b <;> norm_num [spinValue]
def cubeVector {n : ℕ} (x : Spin n) : EuclideanSpace ℝ (Fin n) := body · 1 line
WithLp.toLp 2 (fun i => spinValue (x i))def cubeOverlap {n : ℕ} (x y : Spin n) : ℝ := inner ℝ (cubeVector x) (cubeVector y) / n instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := body · 1 line
Classical.propDecidable _instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := body · 1 line
Classical.propDecidable _def gibbsOverlap {n : ℕ} (W : Disorder n) : ℝ := body · 1 line
∑ x : Spin n, ∑ y : Spin n, gibbs W x*gibbs W y*(cubeOverlap x y)^2instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := body · 1 line
Classical.propDecidable _Outline
- abbrev
Spin26 - abbrev
Edge28 - abbrev
Disorder30 - def
spinValue32 - def
hamiltonian34 - def
partition37 - def
gibbs40 - def
disorderLaw43 - def
sameExcept46 - instance
49 - def
siteKernel52 - def
discreteKernel57 - def
generator60 - def
continuousKernel63 - def
totalVariation67 - def
continuousDistance70 - def
discreteDistance73 - def
continuousMixingTime76 - def
discreteMixingTime79 - def
mean82 - def
variance85 - def
dirichlet88 - def
linearObservable91 - def
covariance94 - def
covarianceNorm99 - def
linearRayleigh102 - def
continuousGoodMass106 - def
discreteGoodMass109 - lemma
spinValue_sq114 - def
cubeVector121 - def
cubeOverlap124 - instance
126 - instance
129 - def
gibbsOverlap134 - instance
139