Repository navigation
Expand file tree
/
Copy pathChallenge.lean
More file actions
94 lines (63 loc) · 2.87 KB
/
Copy pathChallenge.lean
File metadata and controls
94 lines (63 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import Mathlib
namespace OAI
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators Topology ENNReal
noncomputable section
namespace IsingPerceptron
def gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ :=
if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1
else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z))
∂gaussianReal 0 1)) / d
structure Partition where
levels : ℕ
positive : 0 < levels
cut : Fin (levels + 1) → ℝ
ordered : StrictMono cut
first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0
last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1
structure FieldStep where
partition : Partition
value : Fin partition.levels → ℝ
nonneg : ∀ i, 0 ≤ value i
ordered : Monotone value
def stepAt (h : FieldStep) (i : ℕ) : ℝ :=
if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0
def stepFunction (h : FieldStep) (u : ℝ) : ℝ :=
∑ i : Fin h.partition.levels,
if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0
def fieldRecursion (h : FieldStep) : ℝ :=
let k := h.partition.levels
let increments := List.ofFn (fun i : Fin k =>
(stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)),
h.partition.cut i.castSucc))
increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U)
(fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0
def pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1)
structure OverlapPath where
val : ℝ →ₘ[pathMeasure] ℝ
admissible : ∃ q : ℝ → ℝ,
(q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧
∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1
def cellAverage (q : OverlapPath) (k i : ℕ) : ℝ :=
(k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k),
q.val u ∂pathMeasure
def uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ :=
let k := n + 1
let levelVal := fun i => if i < k then cellAverage q k i else 1
let increments := List.ofFn (fun i : Fin (k + 1) =>
(levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k))
increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0
def patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ :=
Filter.limUnder atTop (uniformPattern f q)
def isingEntropy (q : OverlapPath) : EReal :=
⨆ h : FieldStep,
((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal)
def variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal :=
⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q
theorem variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α)
{f : ℝ → ℝ} (hf : Continuous f) (hbounded : ∃ K : ℝ, ∀ x, |f x| ≤ K) :
∃ p : ℝ, variationalValue α f = (p : EReal) := by
sorry
end IsingPerceptron
end
end OAI