Download data/lean/OAI/Probability/Perceptron/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/Perceptron/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/Perceptron/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/Perceptron/Model.lean
3.8 kB
| import Mathlib | |
| namespace OAI | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped ENNReal NNReal Topology BigOperators BoundedContinuousFunction | |
| namespace SphericalPerceptronFreeEnergy | |
| abbrev Time := unitInterval | |
| abbrev BrownianPath := C(ββ₯0, β) | |
| instance : MeasurableSpace BrownianPath := borel BrownianPath | |
| instance : BorelSpace BrownianPath := β¨rflβ© | |
| abbrev Spin (N : β) := EuclideanSpace β (Fin N) | |
| def patternCount (Ξ± : β) (N : β) : β := βΞ± * (N : β)ββ | |
| abbrev Patterns (Ξ± : β) (N : β) := Fin (patternCount Ξ± N) β Fin N β β | |
| def patternLaw (Ξ± : β) (N : β) : Measure (Patterns Ξ± N) := | |
| Measure.pi fun _ => Measure.pi fun _ => gaussianReal 0 1 | |
| def unitSphereLaw (N : β) : Measure (Metric.sphere (0 : Spin N) 1) := | |
| let s := (volume : Measure (Spin N)).toSphere | |
| (s Set.univ)β»ΒΉ β’ s | |
| def sphereLaw (N : β) : Measure (Spin N) := | |
| (unitSphereLaw N).map fun x => Real.sqrt (N : β) β’ x.val | |
| def patternField {Ξ± : β} {N : β} (g : Patterns Ξ± N) | |
| (a : Fin (patternCount Ξ± N)) (x : Spin N) : β := | |
| (β i : Fin N, g a i * x i) / Real.sqrt (N : β) | |
| def hamiltonian (Ξ± : β) (Ο : β βα΅ β) (N : β) (g : Patterns Ξ± N) | |
| (x : Spin N) : β := | |
| β a : Fin (patternCount Ξ± N), Ο (patternField g a x) | |
| def pressure (Ξ± Ξ² : β) (Ο : β βα΅ β) (N : β) (g : Patterns Ξ± N) : β := | |
| Real.log (β« x, Real.exp (Ξ² * hamiltonian Ξ± Ο N g x) βsphereLaw N) / (N : β) | |
| def expectedPressure (Ξ± Ξ² : β) (Ο : β βα΅ β) (N : β) : β := | |
| β« g, pressure Ξ± Ξ² Ο N g βpatternLaw Ξ± N | |
| structure Trial where | |
| toFun : Time β β | |
| monotone : Monotone toFun | |
| measurable : Measurable toFun | |
| nonneg : β t, 0 β€ toFun t | |
| le_one : β t, toFun t β€ 1 | |
| instance : CoeFun Trial (fun _ => Time β β) := β¨Trial.toFunβ© | |
| def timeLaw : Measure Time := Measure.comap Subtype.val volume | |
| def tailIntegral (m : Trial) (t : Time) : β := | |
| β« s in Set.Ici t, m s βtimeLaw | |
| def entropy (m : Trial) : ββ₯0β := | |
| (β«β» t, (ENNReal.ofReal (tailIntegral m t))β»ΒΉ - | |
| (ENNReal.ofReal (1 - (t : β)))β»ΒΉ βtimeLaw) / 2 | |
| def brownianEval (t : ββ₯0) (Ο : BrownianPath) : β := Ο t | |
| @[instance_reducible] def nullSigma (P : Measure BrownianPath) : MeasurableSpace BrownianPath := | |
| MeasurableSpace.generateFrom {s | P s = 0} | |
| @[instance_reducible] def usualBrownianSigma (P : Measure BrownianPath) (t : Time) : | |
| MeasurableSpace BrownianPath := | |
| β¨ s : {s : ββ₯0 // (t : β) < s}, | |
| (β¨ r : {r : ββ₯0 // r β€ s.val}, | |
| MeasurableSpace.comap (brownianEval r.val) (borel β)) β nullSigma P | |
| def Progressive (P : Measure BrownianPath) (v : Time β BrownianPath β β) : Prop := | |
| β t : Time, | |
| @Measurable (Set.Iic t Γ BrownianPath) β | |
| (MeasurableSpace.prod inferInstance (usualBrownianSigma P t)) (borel β) | |
| (fun p => v p.1.val p.2) | |
| def controlCost (P : Measure BrownianPath) (m : Trial) | |
| (v : Time β BrownianPath β β) : ββ₯0β := | |
| β«β» Ο, β«β» t, ENNReal.ofReal (m t * v t Ο ^ 2) βtimeLaw βP | |
| def controlPayoff (P : Measure BrownianPath) (f : β βα΅ β) (m : Trial) | |
| (v : Time β BrownianPath β β) : β := | |
| (β« Ο, f (brownianEval 1 Ο + β« t, m t * v t Ο βtimeLaw) βP) - | |
| (controlCost P m v).toReal / 2 | |
| def controlValue (P : Measure BrownianPath) (f : β βα΅ β) (m : Trial) : β := | |
| sSup {a | β v : Time β BrownianPath β β, | |
| Progressive P v β§ controlCost P m v < β β§ a = controlPayoff P f m v} | |
| def variationalValue (P : Measure BrownianPath) (Ξ± Ξ² : β) (Ο : β βα΅ β) : EReal := | |
| β¨ m : Trial, ((Ξ± * controlValue P (Ξ² β’ Ο) m : β) : EReal) + (entropy m).toEReal | |
| end SphericalPerceptronFreeEnergy | |
| end | |
| end OAI | |