Offline · exact source
Exact Lean source

UniversalLeastNoiseKernel

formalization/Cloning/UniversalLeastNoiseKernel.lean

Source hash: c5f7da796f6aff7df6ae7100e1e5a76ba7d5ead792c225b8003eb5707b4c3c96

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.WeylQuantumPositiveBounds
2import Mathlib.Analysis.InnerProductSpace.Completion
3import Mathlib.MeasureTheory.Function.L2Space
4 
5/-! A normalized continuous positive kernel has a genuine Hilbert-space feature
6map. Its Bochner integrals obey Cauchy--Schwarz. This turns the finite quantum
7positivity tests into integral inequalities without an idler representation. -/
8 
9noncomputable section
10open scoped ComplexOrder InnerProductSpace Topology BigOperators
11open MeasureTheory Filter
12 
13namespace Cloning.PositiveKernel
14set_option backward.isDefEq.respectTransparency false
15set_option maxHeartbeats 1200000
16 
17variable {X : Type*}
18 
19structure IsNormalizedPositive (K : X → X → ℂ) : Prop where
20  hermitian : ∀ x y, star (K y x) = K x y
21  diagonal : ∀ x, K x x = 1
22  positive : ∀ (s : Finset X) (c : X → ℂ),
23    0 ≤ (∑ x ∈ s, ∑ y ∈ s, star (c x) * c y * K x y).re
24 
25set_option linter.unusedVariables false in
26/-- Finitely supported formal linear combinations of kernel vectors. -/
27def PreSpace (K : X → X → ℂ) := X →₀ ℂ
28 
29instance (K : X → X → ℂ) : AddCommGroup (PreSpace K) :=
30  inferInstanceAs (AddCommGroup (X →₀ ℂ))
31instance (K : X → X → ℂ) : Module ℂ (PreSpace K) :=
32  inferInstanceAs (Module ℂ (X →₀ ℂ))
33 
34variable (K : X → X → ℂ) [hK : Fact (IsNormalizedPositive K)]
35 
36instance : PreInnerProductSpace.Core ℂ (PreSpace K) where
37  inner f g := (f : X →₀ ℂ).sum fun x a => (g : X →₀ ℂ).sum fun y b => star a * b * K x y
38  conj_inner_symm f g := by
39    simp only [map_finsuppSum, map_mul]
40    rw [Finsupp.sum_comm]
41    apply Finsupp.sum_congr
42    intro x a
43    apply Finsupp.sum_congr
44    intro y b
45    change star (star ((show X →₀ ℂ from g) y)) * star ((show X →₀ ℂ from f) x) * star (K y x) = _
46    rw [star_star, hK.out.hermitian]
47    ring
48  re_inner_nonneg f := by
49    exact hK.out.positive (f : X →₀ ℂ).support (fun x => (show X →₀ ℂ from f) x)
50  add_left f g h := by
51    rw [Finsupp.sum_add_index'] <;>
52      simp [← Finsupp.sum_add, add_mul]
53  smul_left f g c := by
54    rw [Finsupp.sum_smul_index] <;>
55      simp [Finsupp.mul_sum, ← mul_assoc]
56 
57instance : SeminormedAddCommGroup (PreSpace K) :=
58  InnerProductSpace.Core.toSeminormedAddCommGroup (𝕜 := ℂ)
59instance : InnerProductSpace ℂ (PreSpace K) := .ofCore _
60 
61abbrev Space := UniformSpace.Completion (PreSpace K)
62 
63def feature (x : X) : Space K :=
64  UniformSpace.Completion.coe' (show PreSpace K from Finsupp.single x 1)
65 
66lemma inner_feature (x y : X) : ⟪feature K x, feature K y⟫_ℂ = K x y := by
67  unfold feature
68  rw [UniformSpace.Completion.inner_coe]
69  change ((Finsupp.single x 1 : X →₀ ℂ).sum fun a u =>
70    (Finsupp.single y 1 : X →₀ ℂ).sum fun b v => star u * v * K a b) = _
71  simp
72 
73lemma norm_feature (x : X) : ‖feature K x‖ = 1 := by
74  have h := congrArg Complex.re (inner_feature K x x)
75  rw [hK.out.diagonal, inner_self_eq_norm_sq_to_K] at h
76  norm_cast at h
77  change ‖feature K x‖ ^ 2 = 1 at h
78  nlinarith [norm_nonneg (feature K x)]
79 
80lemma norm_feature_sub (x y : X) :
81    ‖feature K x - feature K y‖ = Real.sqrt (2 - 2 * (K x y).re) := by
82  rw [← Real.sqrt_sq (norm_nonneg _), @norm_sub_sq ℂ,
83    norm_feature, norm_feature, inner_feature]
84  change Real.sqrt (1 ^ 2 - 2 * (K x y).re + 1 ^ 2) = _
85  congr 1
86  ring
87 
88lemma continuous_feature [TopologicalSpace X]
89    (hc : Continuous (fun p : X × X => K p.1 p.2)) : Continuous (feature K) := by
90  rw [continuous_iff_continuousAt]
91  intro x
92  rw [ContinuousAt, tendsto_iff_norm_sub_tendsto_zero]
93  simp_rw [norm_feature_sub]
94  have hc' : Continuous (fun y => Real.sqrt (2 - 2 * (K y x).re)) := by
95    exact Real.continuous_sqrt.comp
96      (continuous_const.sub (continuous_const.mul
97        (Complex.continuous_re.comp (hc.comp (continuous_id.prodMk continuous_const)))))
98  have h := hc'.continuousAt (x := x)
99  simpa only [hK.out.diagonal, Complex.one_re, mul_one, sub_self, Real.sqrt_zero] using h.tendsto
100 
101section Integral
102variable [TopologicalSpace X] [SecondCountableTopology X]
103  [MeasurableSpace X] [BorelSpace X] {μ : Measure X}
104 
105lemma integrable_weighted_feature (hc : Continuous (fun p : X × X => K p.1 p.2))
106    {w : X → ℝ} (hw : Integrable w μ) :
107    Integrable (fun x => (w x : ℂ) • feature K x) μ := by
108  apply hw.norm.mono'
109    ((Complex.continuous_ofReal.comp_aestronglyMeasurable hw.aestronglyMeasurable).smul
110      (continuous_feature K hc).aestronglyMeasurable)
111  exact Eventually.of_forall (fun x => by
112    simp only [norm_smul, norm_feature, mul_one, Complex.norm_real]
113    exact le_rfl)
114 
115/-- Finite positivity has become positivity and Cauchy--Schwarz for actual
116Bochner integrals. The weight may be signed and the measure need not be finite. -/
117theorem integral_cauchySchwarz
118    (hc : Continuous (fun p : X × X => K p.1 p.2))
119    {w : X → ℝ} (hw : Integrable w μ) (x₀ : X) :
120    ‖∫ x, (w x : ℂ) * K x₀ x ∂μ‖ ^ 2 ≤
121      (∫ x, ∫ y, (w x : ℂ) * (w y : ℂ) * K x y ∂μ ∂μ).re := by
122  let v : X → Space K := fun x => (w x : ℂ) • feature K x
123  have hv : Integrable v μ := integrable_weighted_feature K hc hw
124  have hfirst : (∫ x, (w x : ℂ) * K x₀ x ∂μ) =
125      ⟪feature K x₀, ∫ x, v x ∂μ⟫_ℂ := by
126    convert integral_inner hv (feature K x₀) using 1
127    congr 1
128    funext x
129    simp only [v, inner_smul_right, inner_feature]
130  have hdouble : (∫ x, ∫ y, (w x : ℂ) * (w y : ℂ) * K x y ∂μ ∂μ) =
131      ⟪∫ x, v x ∂μ, ∫ x, v x ∂μ⟫_ℂ := by
132    calc
133      _ = ∫ x, ∫ y, ⟪v x, v y⟫_ℂ ∂μ ∂μ := by
134        congr 1
135        funext x
136        congr 1
137        funext y
138        simp only [v, inner_smul_left, inner_smul_right, inner_feature,
139          Complex.conj_ofReal]
140        ring
141      _ = ∫ x, ⟪v x, ∫ y, v y ∂μ⟫_ℂ ∂μ := by
142        congr 1
143        funext x
144        exact integral_inner hv (v x)
145      _ = star (∫ x, ⟪∫ y, v y ∂μ, v x⟫_ℂ ∂μ) := by
146        simp_rw [← inner_conj_symm (v _) (∫ y, v y ∂μ)]
147        exact integral_conj
148      _ = _ := by rw [integral_inner hv]; exact inner_conj_symm _ _
149  rw [hfirst, hdouble]
150  have h := norm_inner_le_norm (𝕜 := ℂ) (feature K x₀) (∫ x, v x ∂μ)
151  rw [norm_feature, one_mul] at h
152  have hs := pow_le_pow_left₀ (norm_nonneg _) h 2
153  rw [inner_self_eq_norm_sq_to_K]
154  change _ ≤ ((‖∫ x, v x ∂μ‖ : ℂ) ^ 2).re
155  rw [← Complex.ofReal_pow, Complex.ofReal_re]
156  exact hs
157 
158end Integral
159 
160end Cloning.PositiveKernel