File size: 2,691 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import Mathlib

namespace OAI

section

section

noncomputable section
open scoped BigOperators Topology
open MeasureTheory ProbabilityTheory Filter

namespace SK
abbrev Config (n : β„•) := Fin n β†’ Bool
abbrev Edge (n : β„•) := {p : Fin n Γ— Fin n // p.1 < p.2}
abbrev Disorder (n : β„•) := Edge n β†’ ℝ

def spin (b : Bool) : ℝ := if b then 1 else -1

def hamiltonian {n : β„•} (J : Disorder n) (x : Config n) : ℝ :=
  (βˆ‘ e : Edge n, J e * spin (x e.val.1) * spin (x e.val.2)) / Real.sqrt n

def partition {n : β„•} (Ξ² : ℝ) (J : Disorder n) : ℝ :=
  βˆ‘ x : Config n, Real.exp (Ξ² * hamiltonian J x)

def gibbs {n : β„•} (Ξ² : ℝ) (J : Disorder n) (x : Config n) : ℝ :=
  Real.exp (Ξ² * hamiltonian J x) / partition Ξ² J

def coupling {n : β„•} (J : Disorder n) (i j : Fin n) : ℝ :=
  if h : i < j then J ⟨(i, j), h⟩ else
    if h : j < i then J ⟨(j, i), h⟩ else 0

def localField {n : β„•} (J : Disorder n) (x : Config n) (i : Fin n) : ℝ :=
  (βˆ‘ j : Fin n, coupling J i j * spin (x j)) / Real.sqrt n

def heatBath {n : β„•} (Ξ² : ℝ) (J : Disorder n) (x y : Config n) : ℝ :=
  (βˆ‘ i : Fin n, if Function.update x i (y i) = y then
    Real.exp (Ξ² * spin (y i) * localField J x i) /
      (2 * Real.cosh (Ξ² * localField J x i)) else 0) / n

def discreteKernel {n : β„•} (Ξ² : ℝ) (J : Disorder n) : β„• β†’ Config n β†’ Config n β†’ ℝ
  | 0, x, y => if x = y then 1 else 0
  | k + 1, x, y => βˆ‘ z : Config n, heatBath Ξ² J x z * discreteKernel Ξ² J k z y

def continuousKernel {n : β„•} (Ξ² : ℝ) (J : Disorder n) (t : ℝ)
    (x y : Config n) : ℝ :=
  βˆ‘' k : β„•, (Real.exp (-(n : ℝ) * t) * ((n : ℝ) * t) ^ k /
    (Nat.factorial k : ℝ)) * discreteKernel Ξ² J k x y

def discreteDistance {n : β„•} (Ξ² : ℝ) (J : Disorder n)
    (x : Config n) (k : β„•) : ℝ :=
  (1 / 2 : ℝ) * βˆ‘ y : Config n, |discreteKernel Ξ² J k x y - gibbs Ξ² J y|

def continuousDistance {n : β„•} (Ξ² : ℝ) (J : Disorder n)
    (x : Config n) (t : ℝ) : ℝ :=
  (1 / 2 : ℝ) * βˆ‘ y : Config n, |continuousKernel Ξ² J t x y - gibbs Ξ² J y|

def disorderLaw (n : β„•) : Measure (Disorder n) :=
  Measure.pi (fun _ : Edge n => gaussianReal 0 1)

def kappa : ℝ := 1 / 10000

def timeScale (n : β„•) : ℝ := Real.exp ((n : ℝ) ^ kappa)

def continuousBadMass (Ξ² : ℝ) (n : β„•) : ℝ :=
  ∫ J : Disorder n, (βˆ‘ x : Config n, if 1 / 4 < continuousDistance Ξ² J x (timeScale n)
    then gibbs Ξ² J x else 0) βˆ‚disorderLaw n

def discreteBadMass (Ξ² : ℝ) (n : β„•) : ℝ :=
  ∫ J : Disorder n, (βˆ‘ x : Config n, if 1 / 4 < discreteDistance Ξ² J x ⌊timeScale nβŒ‹β‚Š
    then gibbs Ξ² J x else 0) βˆ‚disorderLaw n

end SK
end
end
end

end OAI