Download data/lean/OAI/Probability/FreeIsing/Gaussian/Observation.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.55 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Gaussian/Observation.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Gaussian/Observation.lean
-
curl -L -o Observation.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Gaussian/Observation.lean
2.55 kB
| import OAI.Probability.FreeIsing.Posterior.FinitePosterior | |
| namespace OAI | |
| noncomputable section | |
| open ProbabilityTheory | |
| open scoped BigOperators NNReal | |
| namespace Problem367.GaussianObservation | |
| theorem gaussianPDFReal_spin_tilt (t : ββ₯0) (ht : t β 0) (spin x : β) | |
| (hspin : spin ^ 2 = 1) : | |
| gaussianPDFReal ((t : β) * spin) t x = | |
| gaussianPDFReal 0 t x * Real.exp (spin * x - (t : β) / 2) := by | |
| have ht' : (t : β) β 0 := by exact_mod_cast ht | |
| simp only [gaussianPDFReal, sub_zero, mul_assoc, β Real.exp_add] | |
| congr 2 | |
| field_simp | |
| nlinarith [show ((t : β) * spin) ^ 2 = (t : β) ^ 2 by | |
| rw [mul_pow, hspin, mul_one]] | |
| variable {V : Type*} [Fintype V] | |
| def likelihood (t : ββ₯0) (spin x : V β β) : β := | |
| β v, gaussianPDFReal ((t : β) * spin v) t (x v) | |
| def referenceDensity (t : ββ₯0) (x : V β β) : β := | |
| (β v, gaussianPDFReal 0 t (x v)) * | |
| Real.exp (-(Fintype.card V : β) * (t : β) / 2) | |
| lemma referenceDensity_pos (t : ββ₯0) (ht : t β 0) (x : V β β) : | |
| 0 < referenceDensity t x := by | |
| apply mul_pos | |
| Β· exact Finset.prod_pos (fun v _ => gaussianPDFReal_pos 0 t (x v) ht) | |
| Β· exact Real.exp_pos _ | |
| theorem likelihood_eq_referenceDensity (t : ββ₯0) (ht : t β 0) | |
| (spin x : V β β) (hspin : β v, (spin v) ^ 2 = 1) : | |
| likelihood t spin x = | |
| referenceDensity t x * Real.exp (β v, spin v * x v) := by | |
| unfold likelihood referenceDensity | |
| simp_rw [gaussianPDFReal_spin_tilt t ht _ _ (hspin _)] | |
| rw [Finset.prod_mul_distrib, β Real.exp_sum] | |
| rw [Finset.sum_sub_distrib] | |
| simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] | |
| rw [mul_assoc, β Real.exp_add] | |
| congr 2 | |
| ring | |
| variable {S : Type*} [Fintype S] | |
| theorem normalized_gaussian_likelihood (t : ββ₯0) (ht : t β 0) | |
| (energy : S β β) (spin : S β V β β) (x : V β β) | |
| (hspin : β s v, (spin s v) ^ 2 = 1) (s : S) : | |
| (Real.exp (energy s) * likelihood t (spin s) x) / | |
| (β r, Real.exp (energy r) * likelihood t (spin r) x) = | |
| Real.exp (energy s + β v, spin s v * x v) / | |
| (β r, Real.exp (energy r + β v, spin r v * x v)) := by | |
| have heq (r : S) : | |
| Real.exp (energy r) * likelihood t (spin r) x = | |
| referenceDensity t x * Real.exp (energy r + β v, spin r v * x v) := by | |
| rw [likelihood_eq_referenceDensity t ht _ _ (hspin r), Real.exp_add] | |
| ring | |
| simp_rw [heq] | |
| rw [β Finset.mul_sum] | |
| exact mul_div_mul_left _ _ (ne_of_gt (referenceDensity_pos t ht x)) | |
| end Problem367.GaussianObservation | |
| end | |
| end OAI | |