Offline · exact source
Exact Lean source

PCTJointGaussianReal

formalization/Cloning/PCTJointGaussianReal.lean

Source hash: f29b972056dd94e2e33e0e1de5bb56e51af79bf03da6d08af8fc46a7255e3aa4

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.PCTJointGaussianLaw
2import Cloning.GaussianWitness
3import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform
4 
5/-! Real product Gaussian laws in the precision convention used by the hybrid
6fields, and their exact Fourier characterization. -/
7noncomputable section
8open MeasureTheory
9open scoped Topology BigOperators
10namespace Cloning.PCTJointGaussianReal
11open Cloning.GaussianAffinity Cloning.PCTJointGaussianLaw
12set_option backward.isDefEq.respectTransparency false
13set_option maxHeartbeats 1000000
14variable {k : ℕ}
15 
16lemma continuous_productDensity (a : Fin k → ℝ) : Continuous (productDensity a) := by
17  unfold productDensity density
18  fun_prop
19 
20def realProductMeasure (a : Fin k → ℝ) : Measure (Fin k → ℝ) :=
21  volume.withDensity (fun x => ENNReal.ofReal (productDensity a x))
22 
23lemma realProductMeasure_probability {a : Fin k → ℝ} (ha : ∀ i, 0 < a i) :
24    IsProbabilityMeasure (realProductMeasure a) := by
25  constructor
26  rw [realProductMeasure, withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ]
27  rw [← ofReal_integral_eq_lintegral_ofReal (integrable_productDensity a ha)
28    (Filter.Eventually.of_forall (productDensity_nonneg a)), integral_productDensity a ha]
29  exact ENNReal.ofReal_one
30 
31lemma integral_realProductMeasure {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
32    (a : Fin k → ℝ) (f : (Fin k → ℝ) → E) :
33    (∫ x, f x ∂realProductMeasure a) = ∫ x, productDensity a x • f x := by
34  rw [realProductMeasure, integral_withDensity_eq_integral_toReal_smul
35    (continuous_productDensity a).measurable.ennreal_ofReal
36    (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))]
37  simp_rw [ENNReal.toReal_ofReal (productDensity_nonneg a _)]
38 
39lemma density_characteristic {a : ℝ} (ha : 0 < a) (t : ℝ) :
40    (∫ x : ℝ, (density a x : ℂ) * Complex.exp (Complex.I * (t * x : ℝ))) =
41      Complex.exp (-((t ^ 2 / (4 * a) : ℝ) : ℂ)) := by
42  have hn : ((Real.sqrt a / Real.sqrt Real.pi : ℝ) : ℂ) *
43      ((Real.pi : ℂ) / (a : ℂ)) ^ (1 / 2 : ℂ) = 1 := by
44    rw [← integral_gaussian_complex (by simpa using ha), ← integral_const_mul]
45    have he (x : ℝ) : ((Real.sqrt a / Real.sqrt Real.pi : ℝ) : ℂ) *
46        Complex.exp (-(a : ℂ) * (x : ℂ) ^ 2) = (density a x : ℂ) := by
47      simp only [density, Complex.ofReal_mul, Complex.ofReal_exp, Complex.ofReal_neg,
48        Complex.ofReal_pow]
49    simp_rw [he]
50    rw [integral_complex_ofReal, integral_density ha, Complex.ofReal_one]
51  have he (x : ℝ) : (density a x : ℂ) * Complex.exp (Complex.I * (t * x : ℝ)) =
52      ((Real.sqrt a / Real.sqrt Real.pi : ℝ) : ℂ) *
53        (Complex.exp (Complex.I * (t : ℂ) * (x : ℂ)) *
54          Complex.exp (-(a : ℂ) * (x : ℂ) ^ 2)) := by
55    simp only [density, Complex.ofReal_mul, Complex.ofReal_exp, Complex.ofReal_neg,
56      Complex.ofReal_pow]
57    ring
58  simp_rw [he]
59  rw [integral_const_mul, fourierIntegral_gaussian (by simpa using ha), ← mul_assoc, hn, one_mul]
60  congr 1
61  push_cast
62  ring
63 
64lemma realProductMeasure_characteristic {a : Fin k → ℝ} (ha : ∀ i, 0 < a i)
65    (t : Fin k → ℝ) :
66    (∫ x, Complex.exp (Complex.I * ((∑ i, t i * x i : ℝ) : ℂ)) ∂realProductMeasure a) =
67      Complex.exp (-((∑ i, (t i) ^ 2 / (4 * a i) : ℝ) : ℂ)) := by
68  rw [integral_realProductMeasure]
69  simp only [Complex.real_smul, productDensity, Complex.ofReal_prod, Complex.ofReal_sum,
70    Finset.mul_sum, Complex.exp_sum, ← Finset.prod_mul_distrib]
71  rw [integral_fintype_prod_volume_eq_prod (fun i (x : ℝ) =>
72    (density (a i) x : ℂ) * Complex.exp (Complex.I * ((t i * x : ℝ) : ℂ)))]
73  simp_rw [density_characteristic (ha _)]
74  rw [← Complex.exp_sum]
75  congr 1
76  simp [Complex.ofReal_sum]
77 
78lemma realProductMeasure_charFunDual {a : Fin k → ℝ} (ha : ∀ i, 0 < a i)
79    (L : StrongDual ℝ (Fin k → ℝ)) :
80    charFunDual (realProductMeasure a) L =
81      Complex.exp (-((∑ i, (L (Pi.single i 1)) ^ 2 / (4 * a i) : ℝ) : ℂ)) := by
82  rw [charFunDual_apply]
83  convert realProductMeasure_characteristic ha (fun i => L (Pi.single i 1)) using 1
84  apply integral_congr_ae
85  filter_upwards [] with x
86  rw [classical_dual_eq, mul_comm _ Complex.I]
87 
88lemma realProductMeasure_characteristic_const {v : ℝ} (hv : 0 < v) (t : Fin k → ℝ) :
89    (∫ x, Complex.exp (Complex.I * ((∑ i, t i * x i : ℝ) : ℂ))
90      ∂realProductMeasure (fun _ : Fin k => 1 / (4 * v))) =
91      Complex.exp (-((v * ∑ i, (t i) ^ 2 : ℝ) : ℂ)) := by
92  rw [realProductMeasure_characteristic (fun _ => by positivity)]
93  congr 3
94  rw [Finset.mul_sum]
95  apply Finset.sum_congr rfl
96  intro i _
97  field_simp
98 
99/-- Fourier identification of a probability law in the variance `2v`
100convention. This is useful after whitening a singular multinomial law. -/
101theorem eq_realProductMeasure_of_characteristic {μ : Measure (Fin k → ℝ)}
102    [IsFiniteMeasure μ] {v : ℝ} (hv : 0 < v)
103    (h : ∀ t : Fin k → ℝ,
104      (∫ x, Complex.exp (Complex.I * ((∑ i, t i * x i : ℝ) : ℂ)) ∂μ) =
105        Complex.exp (-((v * ∑ i, (t i) ^ 2 : ℝ) : ℂ))) :
106    μ = realProductMeasure (fun _ : Fin k => 1 / (4 * v)) := by
107  letI := realProductMeasure_probability (fun _ : Fin k => by positivity :
108    ∀ _ : Fin k, 0 < 1 / (4 * v))
109  apply Measure.ext_of_charFunDual
110  funext L
111  rw [charFunDual_apply, charFunDual_apply]
112  have he (x : Fin k → ℝ) : Complex.exp ((L x : ℂ) * Complex.I) =
113      Complex.exp (Complex.I * ((∑ i, L (Pi.single i 1) * x i : ℝ) : ℂ)) := by
114    rw [classical_dual_eq, mul_comm _ Complex.I]
115  simp_rw [he, h, realProductMeasure_characteristic_const hv]
116 
117end Cloning.PCTJointGaussianReal