Offline · exact source
Exact Lean source

ThermalWitness

formalization/Cloning/ThermalWitness.lean

Source hash: 62f24f8373ac0987200e844ab3bd47489754148fdf6a397fe85c1444ec076cff

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
theorem Cloning.ThermalWitness.witness_summabledefinition Cloning.ThermalWitness.witnessTraceClassdefinition Cloning.ThermalWitness.witnessOperatortheorem Cloning.ThermalWitness.witnessOperator_apply_basistheorem Cloning.ThermalWitness.witnessOperator_nonnegtheorem Cloning.ThermalWitness.compact_rankOnetheorem Cloning.ThermalWitness.compact_vectorMixturetheorem Cloning.ThermalWitness.witnessOperator_compacttheorem Cloning.ThermalWitness.trace_hasSum_basistheorem Cloning.ThermalWitness.tracePairing_re_eq_number_momenttheorem Cloning.ThermalWitness.diagonalMixture_tracePairingtheorem Cloning.ThermalWitness.amplified_thermal_witness_momenttheorem Cloning.ThermalWitness.inverse_apply_eigenvectortheorem Cloning.ThermalWitness.regularized_witness_apply_basistheorem Cloning.ThermalWitness.regularized_inverse_witness_apply_basistheorem Cloning.ThermalWitness.thermal_regularized_inverse_momenttheorem Cloning.ThermalWitness.fidelity_sq_le_thermal_witnesstheorem Cloning.ThermalWitness.diagonal_regularized_inverse_momentdefinition Cloning.ThermalWitness.productWitnessdefinition Cloning.ThermalWitness.productGeometrictheorem Cloning.ThermalWitness.productWitness_postheorem Cloning.ThermalWitness.productWitness_summabledefinition Cloning.ThermalWitness.productWitnessOperatortheorem Cloning.ThermalWitness.productWitnessOperator_apply_basistheorem Cloning.ThermalWitness.productWitnessOperator_nonnegtheorem Cloning.ThermalWitness.productWitnessOperator_compacttheorem Cloning.ThermalWitness.productGeometric_hasSumtheorem Cloning.ThermalWitness.productGeometric_nonnegtheorem Cloning.ThermalWitness.product_inverse_moment_hasSumtheorem Cloning.ThermalWitness.product_thermal_regularized_inverse_momenttheorem Cloning.ThermalWitness.fidelity_sq_le_product_thermal_witnesstheorem Cloning.ThermalWitness.positive_diagonal_injectivetheorem Cloning.ThermalWitness.witnessOperator_injectivetheorem Cloning.ThermalWitness.productWitnessOperator_injectivetheorem Cloning.ThermalWitness.product_thermal_witness_momenttheorem Cloning.ThermalWitness.number_law_witness_moment_letheorem Cloning.ThermalWitness.fidelity_sq_le_of_number_lawtheorem Cloning.ThermalWitness.trace_real_hasSum_basistheorem Cloning.ThermalWitness.single_mixture_witness_moment_letheorem Cloning.ThermalWitness.single_number_law_witness_moment_letheorem Cloning.ThermalWitness.fidelity_sq_le_of_single_number_law
1import Cloning.BosonicNumberLaw
2import Cloning.InfiniteDiagonalFidelity
3import Cloning.InfiniteTraceClassPairing
4import Cloning.InfiniteFidelityRegularized
5import Mathlib.Analysis.Normed.Operator.Compact
6 
7/-! The thermal fidelity witness as a genuine positive compact operator. Its moments are
8analytic trace pairings, evaluated by convergent number-basis series. -/
9 
10namespace Cloning.ThermalWitness
11 
12noncomputable section
13set_option backward.isDefEq.respectTransparency false
14open scoped ComplexOrder InnerProductSpace Topology BigOperators
15open Filter Cloning Cloning.InfiniteTraceClass Cloning.InfiniteFidelity
16open Cloning.InfiniteOccupationStates
17 
18variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
19 
20lemma witness_summable {q x : ℝ} (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) :
21    Summable (Thermal.witness q x) := by
22  have hx0 : 0 < x := hq0.trans hqx
23  have hr : ‖Real.sqrt (q / x)‖ < 1 := by
24    rw [Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _),
25      Real.sqrt_lt' (by norm_num : (0 : ℝ) < 1)]
26    simpa using (div_lt_one hx0).mpr hqx
27  have hs := (summable_geometric_of_norm_lt_one hr).mul_left
28    (Real.sqrt ((1 - q) / (1 - x)))
29  exact hs.congr (fun n => (Thermal.witness_closed hq0.le (hqx.trans hx1) hx0.le hx1 n).symm)
30 
31def witnessTraceClass (b : HilbertBasis ℕ ℂ H) (q x : ℝ) : TraceClass H :=
32  vectorMixture b (Thermal.witness q x)
33 
34def witnessOperator (b : HilbertBasis ℕ ℂ H) (q x : ℝ) : H →L[ℂ] H :=
35  (witnessTraceClass b q x).1
36 
37lemma witnessOperator_apply_basis (b : HilbertBasis ℕ ℂ H) {q x : ℝ}
38    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) (n : ℕ) :
39    witnessOperator b q x (b n) = (Thermal.witness q x n : ℂ) • b n :=
40  vectorMixture_apply_basis b _ (witness_summable hq0 hqx hx1) n
41 
42lemma witnessOperator_nonneg (b : HilbertBasis ℕ ℂ H) {q x : ℝ}
43    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) : 0 ≤ witnessOperator b q x :=
44  vectorMixture_nonneg b b.orthonormal.norm_eq_one _ (witness_summable hq0 hqx hx1)
45    (fun n => (Thermal.witness_pos hq0 (hqx.trans hx1) (hq0.trans hqx) hx1 n).le)
46 
47omit [CompleteSpace H] in
48lemma compact_rankOne (x y : H) : IsCompactOperator (InnerProductSpace.rankOne ℂ x y) := by
49  rw [InnerProductSpace.rankOne_def']
50  exact (isCompactOperator_of_locallyCompactSpace_rng
51    (ContinuousLinearMap.toSpanSingleton ℂ x)).comp_clm (innerSL ℂ y)
52 
53lemma compact_vectorMixture {ι : Type*} (b : HilbertBasis ι ℂ H)
54    (p : ι → ℝ) (hp : Summable p) : IsCompactOperator (vectorMixture b p).1 := by
55  have hs := summable_weighted_projectors b b.orthonormal.norm_eq_one p hp
56  have hlim := hs.hasSum.mapL inclusionCLM
57  apply isCompactOperator_of_tendsto hlim
58  apply Eventually.of_forall
59  intro s
60  classical
61  induction s using Finset.induction_on with
62  | empty => simpa only [Finset.sum_empty] using (isCompactOperator_zero (M₁ := H) (M₂ := H))
63  | @insert i s hi hs =>
64    rw [Finset.sum_insert hi]
65    apply IsCompactOperator.add _ hs
66    simpa only [map_smul, inclusionCLM_apply, vectorProjector, TraceClass.ofOperator_coe] using
67      (compact_rankOne (b i) (b i)).smul (p i : ℂ)
68 
69lemma witnessOperator_compact (b : HilbertBasis ℕ ℂ H) {q x : ℝ}
70    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) : IsCompactOperator (witnessOperator b q x) :=
71  compact_vectorMixture b _ (witness_summable hq0 hqx hx1)
72 
73/-- Trace evaluation for arbitrary index types, obtained by reindexing the basis by its range. -/
74lemma trace_hasSum_basis {ι : Type*} (b : HilbertBasis ι ℂ H)
75    {T : H →L[ℂ] H} (hT : IsTraceClass T) :
76    HasSum (fun i => ⟪b i, T (b i)⟫_ℂ) (trace T hT) := by
77  let e : ι ≃ Set.range b := Equiv.ofInjective b b.orthonormal.linearIndependent.injective
78  have horth : Orthonormal ℂ (fun i : Set.range b => b (e.symm i)) :=
79    b.orthonormal.comp e.symm e.symm.injective
80  have hrange : Set.range (fun i : Set.range b => b (e.symm i)) = Set.range b := by
81    exact e.symm.surjective.range_comp b
82  let c : HilbertBasis (Set.range b) ℂ H := HilbertBasis.mk horth (by
83    rw [hrange, b.dense_span])
84  have hc : ∀ i, c i = b (e.symm i) := fun i => congrFun (HilbertBasis.coe_mk horth _) i
85  have hs := (summable_trace_diagonal_of_isTraceClass hT c).hasSum
86  rw [← trace_eq_of_hilbertBasis hT c] at hs
87  have hs' := e.hasSum_iff.mpr hs
88  exact hs'.congr (fun i => by simp only [Function.comp_apply, hc, e.symm_apply_apply])
89 
90/-- Every diagonal bounded observable tests only the actual number probabilities of an arbitrary
91trace-class input; the input itself need not be diagonal. -/
92lemma tracePairing_re_eq_number_moment {ι : Type*} (b : HilbertBasis ι ℂ H)
93    (A : TraceClass H) (W : H →L[ℂ] H) (w : ι → ℝ)
94    (hW : ∀ i, W (b i) = (w i : ℂ) • b i) :
95    (tracePairing A W).re = ∑' i, (⟪b i, A.1 (b i)⟫_ℂ).re * w i := by
96  let hTC : IsTraceClass (A.1 * W) := isTraceClass_mul_mul (A := 1) (B := W) A.2
97  change (trace (A.1 * W) hTC).re = _
98  rw [← (trace_hasSum_basis b hTC).tsum_eq,
99    Complex.re_tsum (trace_hasSum_basis b hTC).summable]
100  apply tsum_congr
101  intro i
102  simp only [ContinuousLinearMap.mul_apply, hW i, map_smul, inner_smul_right,
103    Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, mul_comm]
104 
105lemma diagonalMixture_tracePairing {ι : Type*} (b : HilbertBasis ι ℂ H)
106    (p : ι → ℝ) (hp : Summable p) (W : H →L[ℂ] H) (w : ι → ℝ)
107    (hW : ∀ i, W (b i) = (w i : ℂ) • b i) :
108    (tracePairing (vectorMixture b p) W).re = ∑' i, p i * w i := by
109  rw [tracePairing_re_eq_number_moment b _ W w hW]
110  apply tsum_congr
111  intro i
112  rw [vectorMixture_apply_basis b p hp i, inner_smul_right,
113    inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one i]
114  simp
115 
116lemma amplified_thermal_witness_moment (b : HilbertBasis ℕ ℂ H) {q x : ℝ}
117    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) :
118    (tracePairing (vectorMixture b (Thermal.geometric x)) (witnessOperator b q x)).re =
119      Thermal.fidelity q x := by
120  rw [diagonalMixture_tracePairing b _ (Thermal.geometric_hasSum (hq0.trans hqx).le hx1).summable
121    _ _ (witnessOperator_apply_basis b hq0 hqx hx1)]
122  exact (Thermal.witness_moment_hasSum hq0 (hqx.trans hx1) (hq0.trans hqx) hx1).tsum_eq
123 
124lemma inverse_apply_eigenvector {W : H →L[ℂ] H} (hW : IsStrictlyPositive W)
125    {v : H} {a : ℝ} (ha : 0 < a) (hv : W v = (a : ℂ) • v) :
126    CFC.rpow W (-1) v = (a⁻¹ : ℂ) • v := by
127  have hprod : CFC.rpow W (-1) * W = 1 := by
128    simpa only [CFC.rpow_one W hW.nonneg] using
129      CFC.rpow_neg_mul_rpow (1 : ℝ) hW.isUnit hW.nonneg
130  have hv' := congrArg (fun S : H →L[ℂ] H => S v) hprod
131  simp only [ContinuousLinearMap.mul_apply, hv, map_smul, ContinuousLinearMap.one_apply] at hv'
132  have haC : (a : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr ha.ne'
133  have h := congrArg (fun z : H => (a : ℂ)⁻¹ • z) hv'
134  simpa only [smul_smul, inv_mul_cancel₀ haC, one_smul, Complex.ofReal_inv] using h
135 
136lemma regularized_witness_apply_basis (b : HilbertBasis ℕ ℂ H) {q x : ℝ}
137    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) (ε : ℝ) (n : ℕ) :
138    regularizedWeight (witnessOperator b q x) ε (b n) =
139      ((Thermal.witness q x n + ε : ℝ) : ℂ) • b n := by
140  simp only [regularizedWeight, ContinuousLinearMap.add_apply,
141    ContinuousLinearMap.smul_apply, ContinuousLinearMap.one_apply,
142    witnessOperator_apply_basis b hq0 hqx hx1 n, Complex.ofReal_add, add_smul,
143    Complex.coe_smul]
144 
145lemma regularized_inverse_witness_apply_basis (b : HilbertBasis ℕ ℂ H) {q x ε : ℝ}
146    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) (hε : 0 < ε) (n : ℕ) :
147    CFC.rpow (regularizedWeight (witnessOperator b q x) ε) (-1) (b n) =
148      (((Thermal.witness q x n + ε)⁻¹ : ℝ) : ℂ) • b n :=
149  by
150  simpa only [Complex.ofReal_inv] using inverse_apply_eigenvector
151    (regularizedWeight_strictlyPositive (witnessOperator_nonneg b hq0 hqx hx1) hε)
152    (add_pos (Thermal.witness_pos hq0 (hqx.trans hx1) (hq0.trans hqx) hx1 n) hε)
153    (regularized_witness_apply_basis b hq0 hqx hx1 ε n)
154 
155/-- The inverse witness is handled through actual bounded inverses of positive
156regularizations. Their moments are uniformly bounded by the exact thermal affinity. -/
157lemma thermal_regularized_inverse_moment (b : HilbertBasis ℕ ℂ H) {q x ε : ℝ}
158    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) (hε : 0 < ε) :
159    (tracePairing (vectorMixture b (Thermal.geometric q))
160      (CFC.rpow (regularizedWeight (witnessOperator b q x) ε) (-1))).re ≤
161        Thermal.fidelity q x := by
162  rw [diagonalMixture_tracePairing b _ (Thermal.geometric_hasSum hq0.le (hqx.trans hx1)).summable
163    _ _ (regularized_inverse_witness_apply_basis b hq0 hqx hx1 hε)]
164  have hs := Thermal.witness_inverse_moment_hasSum hq0 (hqx.trans hx1) (hq0.trans hqx) hx1
165  have hbound (n : ℕ) : Thermal.geometric q n * (Thermal.witness q x n + ε)⁻¹ ≤
166      Thermal.geometric q n / Thermal.witness q x n := by
167    rw [← div_eq_mul_inv]
168    exact div_le_div_of_nonneg_left (Thermal.geometric_nonneg hq0.le (hqx.trans hx1).le n)
169      (Thermal.witness_pos hq0 (hqx.trans hx1) (hq0.trans hqx) hx1 n)
170      (le_add_of_nonneg_right hε.le)
171  have hn (n : ℕ) : 0 ≤ Thermal.geometric q n * (Thermal.witness q x n + ε)⁻¹ :=
172    mul_nonneg (Thermal.geometric_nonneg hq0.le (hqx.trans hx1).le n)
173      (inv_nonneg.mpr (add_nonneg
174        (Thermal.witness_pos hq0 (hqx.trans hx1) (hq0.trans hqx) hx1 n).le hε.le))
175  have hs' := hs.summable.of_nonneg_of_le hn hbound
176  exact (hs'.tsum_le_tsum hbound hs.summable).trans_eq hs.tsum_eq
177 
178/-- Concrete thermal witness inequality for every actual positive trace-class input.
179The regularized inverse moment is proved from its geometric series, not assumed. -/
180lemma fidelity_sq_le_thermal_witness (b : HilbertBasis ℕ ℂ H) (A : TraceClass H)
181    (hA : 0 ≤ A.1) {q x : ℝ} (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) :
182    fidelity A.1 (vectorMixture b (Thermal.geometric q)).1 hA
183      (vectorMixture_nonneg b b.orthonormal.norm_eq_one _
184        (Thermal.geometric_hasSum hq0.le (hqx.trans hx1)).summable
185        (Thermal.geometric_nonneg hq0.le (hqx.trans hx1).le))
186      A.2 (vectorMixture b (Thermal.geometric q)).2 ^ 2 ≤
187      (tracePairing A (witnessOperator b q x)).re * Thermal.fidelity q x := by
188  apply fidelity_sq_le_of_regularized_inverse_moment hA _
189    (witnessOperator_nonneg b hq0 hqx hx1) A.2 _
190    (Thermal.fidelity_pos hq0.le (hqx.trans hx1) (hq0.trans hqx).le hx1).le
191  intro ε hε
192  exact thermal_regularized_inverse_moment b hq0 hqx hx1 hε
193 
194/-- Uniform inverse moment for any positive diagonal bounded witness, with its
195possibly unbounded inverse represented only by a convergent scalar moment. -/
196lemma diagonal_regularized_inverse_moment {ι : Type*} (b : HilbertBasis ι ℂ H)
197    (p w : ι → ℝ) (hp : Summable p) (hp0 : ∀ i, 0 ≤ p i) (hw0 : ∀ i, 0 < w i)
198    (W : H →L[ℂ] H) (hW0 : 0 ≤ W) (hW : ∀ i, W (b i) = (w i : ℂ) • b i)
199    {M ε : ℝ} (hs : HasSum (fun i => p i / w i) M) (hε : 0 < ε) :
200    (tracePairing (vectorMixture b p) (CFC.rpow (regularizedWeight W ε) (-1))).re ≤ M := by
201  have hreg (i : ι) : regularizedWeight W ε (b i) = ((w i + ε : ℝ) : ℂ) • b i := by
202    simp only [regularizedWeight, ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply,
203      ContinuousLinearMap.one_apply, hW i, Complex.ofReal_add, add_smul, Complex.coe_smul]
204  have hinv (i : ι) : CFC.rpow (regularizedWeight W ε) (-1) (b i) =
205      (((w i + ε)⁻¹ : ℝ) : ℂ) • b i := by
206    simpa only [Complex.ofReal_inv] using inverse_apply_eigenvector
207      (regularizedWeight_strictlyPositive hW0 hε) (add_pos (hw0 i) hε) (hreg i)
208  rw [diagonalMixture_tracePairing b p hp _ _ hinv]
209  have hb (i : ι) : p i * (w i + ε)⁻¹ ≤ p i / w i := by
210    rw [← div_eq_mul_inv]
211    exact div_le_div_of_nonneg_left (hp0 i) (hw0 i) (le_add_of_nonneg_right hε.le)
212  have hn (i : ι) : 0 ≤ p i * (w i + ε)⁻¹ :=
213    mul_nonneg (hp0 i) (inv_nonneg.mpr (add_pos (hw0 i) hε).le)
214  exact ((hs.summable.of_nonneg_of_le hn hb).tsum_le_tsum hb hs.summable).trans_eq hs.tsum_eq
215 
216def productWitness {s : ℕ} (q x : Fin s → ℝ) (k : Fin s → ℕ) : ℝ :=
217  ∏ i, Thermal.witness (q i) (x i) (k i)
218 
219def productGeometric {s : ℕ} (q : Fin s → ℝ) (k : Fin s → ℕ) : ℝ :=
220  ∏ i, Thermal.geometric (q i) (k i)
221 
222lemma productWitness_pos {s : ℕ} {q x : Fin s → ℝ}
223    (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i) (hx1 : ∀ i, x i < 1)
224    (k : Fin s → ℕ) : 0 < productWitness q x k :=
225  Finset.prod_pos (fun i _ => Thermal.witness_pos (hq0 i) ((hqx i).trans (hx1 i))
226    ((hq0 i).trans (hqx i)) (hx1 i) (k i))
227 
228lemma productWitness_summable {s : ℕ} {q x : Fin s → ℝ}
229    (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i) (hx1 : ∀ i, x i < 1) :
230    Summable (productWitness q x) :=
231  (Thermal.hasSum_fin_product s (fun i => Thermal.witness (q i) (x i))
232    (fun i => ∑' n, Thermal.witness (q i) (x i) n)
233    (fun i n => (Thermal.witness_pos (hq0 i) ((hqx i).trans (hx1 i))
234      ((hq0 i).trans (hqx i)) (hx1 i) n).le)
235    (fun i => (witness_summable (hq0 i) (hqx i) (hx1 i)).hasSum)).summable
236 
237def productWitnessOperator {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
238    (q x : Fin s → ℝ) : H →L[ℂ] H := (vectorMixture b (productWitness q x)).1
239 
240lemma productWitnessOperator_apply_basis {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
241    {q x : Fin s → ℝ} (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i)
242    (hx1 : ∀ i, x i < 1) (k : Fin s → ℕ) :
243    productWitnessOperator b q x (b k) = (productWitness q x k : ℂ) • b k :=
244  vectorMixture_apply_basis b _ (productWitness_summable hq0 hqx hx1) k
245 
246lemma productWitnessOperator_nonneg {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
247    {q x : Fin s → ℝ} (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i)
248    (hx1 : ∀ i, x i < 1) : 0 ≤ productWitnessOperator b q x :=
249  vectorMixture_nonneg b b.orthonormal.norm_eq_one _ (productWitness_summable hq0 hqx hx1)
250    (fun k => (productWitness_pos hq0 hqx hx1 k).le)
251 
252lemma productWitnessOperator_compact {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
253    {q x : Fin s → ℝ} (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i)
254    (hx1 : ∀ i, x i < 1) : IsCompactOperator (productWitnessOperator b q x) :=
255  compact_vectorMixture b _ (productWitness_summable hq0 hqx hx1)
256 
257lemma productGeometric_hasSum {s : ℕ} {q : Fin s → ℝ}
258    (hq0 : ∀ i, 0 ≤ q i) (hq1 : ∀ i, q i < 1) : HasSum (productGeometric q) 1 :=
259  Thermal.multimode_geometric_hasSum hq0 hq1
260 
261lemma productGeometric_nonneg {s : ℕ} {q : Fin s → ℝ}
262    (hq0 : ∀ i, 0 ≤ q i) (hq1 : ∀ i, q i < 1) (k : Fin s → ℕ) :
263    0 ≤ productGeometric q k :=
264  Finset.prod_nonneg (fun i _ => Thermal.geometric_nonneg (hq0 i) (hq1 i).le (k i))
265 
266lemma product_inverse_moment_hasSum {s : ℕ} {q x : Fin s → ℝ}
267    (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i) (hx1 : ∀ i, x i < 1) :
268    HasSum (fun k => productGeometric q k / productWitness q x k)
269      (∏ i, Thermal.fidelity (q i) (x i)) := by
270  simpa only [productGeometric, productWitness, ← Finset.prod_div_distrib] using
271    Thermal.hasSum_fin_product s
272      (fun i n => Thermal.geometric (q i) n / Thermal.witness (q i) (x i) n)
273      (fun i => Thermal.fidelity (q i) (x i))
274      (fun i n => div_nonneg (Thermal.geometric_nonneg (hq0 i).le ((hqx i).trans (hx1 i)).le n)
275        (Thermal.witness_pos (hq0 i) ((hqx i).trans (hx1 i))
276          ((hq0 i).trans (hqx i)) (hx1 i) n).le)
277      (fun i => Thermal.witness_inverse_moment_hasSum (hq0 i) ((hqx i).trans (hx1 i))
278        ((hq0 i).trans (hqx i)) (hx1 i))
279 
280lemma product_thermal_regularized_inverse_moment {s : ℕ}
281    (b : HilbertBasis (Fin s → ℕ) ℂ H) {q x : Fin s → ℝ}
282    (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i) (hx1 : ∀ i, x i < 1)
283    {ε : ℝ} (hε : 0 < ε) :
284    (tracePairing (vectorMixture b (productGeometric q))
285      (CFC.rpow (regularizedWeight (productWitnessOperator b q x) ε) (-1))).re ≤
286        ∏ i, Thermal.fidelity (q i) (x i) :=
287  diagonal_regularized_inverse_moment b _ _
288    (productGeometric_hasSum (fun i => (hq0 i).le) (fun i => (hqx i).trans (hx1 i))).summable
289    (productGeometric_nonneg (fun i => (hq0 i).le) (fun i => (hqx i).trans (hx1 i)))
290    (productWitness_pos hq0 hqx hx1) _ (productWitnessOperator_nonneg b hq0 hqx hx1)
291    (productWitnessOperator_apply_basis b hq0 hqx hx1)
292    (product_inverse_moment_hasSum hq0 hqx hx1) hε
293 
294/-- Actual multimode compact-witness fidelity bound, including a correlated or
295coherent arbitrary input operator. -/
296lemma fidelity_sq_le_product_thermal_witness {s : ℕ}
297    (b : HilbertBasis (Fin s → ℕ) ℂ H) (A : TraceClass H) (hA : 0 ≤ A.1)
298    {q x : Fin s → ℝ} (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i)
299    (hx1 : ∀ i, x i < 1) :
300    fidelity A.1 (vectorMixture b (productGeometric q)).1 hA
301      (vectorMixture_nonneg b b.orthonormal.norm_eq_one _
302        (productGeometric_hasSum (fun i => (hq0 i).le) (fun i => (hqx i).trans (hx1 i))).summable
303        (productGeometric_nonneg (fun i => (hq0 i).le) (fun i => (hqx i).trans (hx1 i))))
304      A.2 (vectorMixture b (productGeometric q)).2 ^ 2 ≤
305      (tracePairing A (productWitnessOperator b q x)).re * ∏ i, Thermal.fidelity (q i) (x i) := by
306  apply fidelity_sq_le_of_regularized_inverse_moment hA _
307    (productWitnessOperator_nonneg b hq0 hqx hx1) A.2 _
308    (Finset.prod_nonneg (fun i _ =>
309      (Thermal.fidelity_pos (hq0 i).le ((hqx i).trans (hx1 i))
310        ((hq0 i).trans (hqx i)).le (hx1 i)).le))
311  intro ε hε
312  exact product_thermal_regularized_inverse_moment b hq0 hqx hx1 hε
313 
314lemma positive_diagonal_injective {ι : Type*} (b : HilbertBasis ι ℂ H)
315    {W : H →L[ℂ] H} (hW : 0 ≤ W) (w : ι → ℝ) (hw : ∀ i, 0 < w i)
316    (heig : ∀ i, W (b i) = (w i : ℂ) • b i) : Function.Injective W := by
317  have hstar : W.adjoint = W := by
318    simpa only [ContinuousLinearMap.star_eq_adjoint] using (IsSelfAdjoint.of_nonneg hW).star_eq
319  have hker (v : H) (hv : W v = 0) : v = 0 := by
320    apply b.repr.injective
321    ext i
322    rw [map_zero]
323    change b.repr v i = 0
324    rw [b.repr_apply_apply]
325    have h := ContinuousLinearMap.adjoint_inner_left W v (b i)
326    rw [hstar, heig i, inner_smul_left, hv, inner_zero_right] at h
327    simp only [Complex.conj_ofReal] at h
328    exact (mul_eq_zero.mp h).resolve_left (Complex.ofReal_ne_zero.mpr (hw i).ne')
329  intro u v huv
330  apply sub_eq_zero.mp
331  exact hker (u - v) (by rw [map_sub, huv, sub_self])
332 
333lemma witnessOperator_injective (b : HilbertBasis ℕ ℂ H) {q x : ℝ}
334    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) :
335    Function.Injective (witnessOperator b q x) :=
336  positive_diagonal_injective b (witnessOperator_nonneg b hq0 hqx hx1) _
337    (fun n => Thermal.witness_pos hq0 (hqx.trans hx1) (hq0.trans hqx) hx1 n)
338    (witnessOperator_apply_basis b hq0 hqx hx1)
339 
340lemma productWitnessOperator_injective {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
341    {q x : Fin s → ℝ} (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i)
342    (hx1 : ∀ i, x i < 1) : Function.Injective (productWitnessOperator b q x) :=
343  positive_diagonal_injective b (productWitnessOperator_nonneg b hq0 hqx hx1) _
344    (productWitness_pos hq0 hqx hx1) (productWitnessOperator_apply_basis b hq0 hqx hx1)
345 
346lemma product_thermal_witness_moment {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
347    {q x : Fin s → ℝ} (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i)
348    (hx1 : ∀ i, x i < 1) :
349    (tracePairing (vectorMixture b (productGeometric x)) (productWitnessOperator b q x)).re =
350      ∏ i, Thermal.fidelity (q i) (x i) := by
351  rw [diagonalMixture_tracePairing b _
352    (productGeometric_hasSum (fun i => ((hq0 i).trans (hqx i)).le) hx1).summable
353    _ _ (productWitnessOperator_apply_basis b hq0 hqx hx1)]
354  simpa only [productGeometric, productWitness, ← Finset.prod_mul_distrib] using
355    (Thermal.multimode_witness_moment_hasSum hq0 (fun i => (hqx i).trans (hx1 i))
356      (fun i => (hq0 i).trans (hqx i)) hx1).tsum_eq
357 
358/-- The least-noise witness bound follows from the explicit seeded number law,
359even when the actual output operator has nonzero off-diagonal entries. -/
360lemma number_law_witness_moment_le {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
361    (A : TraceClass H) {q x : Fin s → ℝ} {a : (Fin s → ℕ) → ℝ} {c : ℝ}
362    (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i) (hx1 : ∀ i, x i < 1)
363    (ha0 : ∀ l, 0 ≤ a l) (ha : HasSum a c)
364    (hdiag : ∀ k, (⟪b k, A.1 (b k)⟫_ℂ).re = BosonicNumberLaw.mixtureLaw x a k) :
365    (tracePairing A (productWitnessOperator b q x)).re ≤
366      c * ∏ i, Thermal.fidelity (q i) (x i) := by
367  rw [tracePairing_re_eq_number_moment b A _ _
368    (productWitnessOperator_apply_basis b hq0 hqx hx1)]
369  simp_rw [hdiag]
370  exact BosonicNumberLaw.mixtureLaw_witness_moment_le hq0 hqx hx1 ha0 ha
371 
372/-- The actual fidelity bound for an arbitrary correlated seeded output law.
373No abstract moment or fidelity inequality is part of the hypotheses. -/
374lemma fidelity_sq_le_of_number_law {s : ℕ} (b : HilbertBasis (Fin s → ℕ) ℂ H)
375    (A : TraceClass H) (hA : 0 ≤ A.1) {q x : Fin s → ℝ}
376    {a : (Fin s → ℕ) → ℝ} {c : ℝ}
377    (hq0 : ∀ i, 0 < q i) (hqx : ∀ i, q i < x i) (hx1 : ∀ i, x i < 1)
378    (ha0 : ∀ l, 0 ≤ a l) (ha : HasSum a c)
379    (hdiag : ∀ k, (⟪b k, A.1 (b k)⟫_ℂ).re = BosonicNumberLaw.mixtureLaw x a k) :
380    fidelity A.1 (vectorMixture b (productGeometric q)).1 hA
381      (vectorMixture_nonneg b b.orthonormal.norm_eq_one _
382        (productGeometric_hasSum (fun i => (hq0 i).le) (fun i => (hqx i).trans (hx1 i))).summable
383        (productGeometric_nonneg (fun i => (hq0 i).le) (fun i => (hqx i).trans (hx1 i))))
384      A.2 (vectorMixture b (productGeometric q)).2 ^ 2 ≤
385      c * (∏ i, Thermal.fidelity (q i) (x i)) ^ 2 := by
386  have hf0 : 0 ≤ ∏ i, Thermal.fidelity (q i) (x i) := Finset.prod_nonneg (fun i _ =>
387    (Thermal.fidelity_pos (hq0 i).le ((hqx i).trans (hx1 i))
388      ((hq0 i).trans (hqx i)).le (hx1 i)).le)
389  calc
390    _ ≤ _ := fidelity_sq_le_product_thermal_witness b A hA hq0 hqx hx1
391    _ ≤ (c * ∏ i, Thermal.fidelity (q i) (x i)) * ∏ i, Thermal.fidelity (q i) (x i) :=
392      mul_le_mul_of_nonneg_right (number_law_witness_moment_le b A hq0 hqx hx1 ha0 ha hdiag) hf0
393    _ = _ := by ring
394 
395lemma trace_real_hasSum_basis {ι : Type*} (b : HilbertBasis ι ℂ H) (A : TraceClass H) :
396    HasSum (fun i => (⟪b i, A.1 (b i)⟫_ℂ).re) (trace A.1 A.2).re :=
397  (trace_hasSum_basis b A.2).map Complex.reCLM.toAddMonoidHom Complex.reCLM.continuous
398 
399lemma single_mixture_witness_moment_le {q x c : ℝ} {a : ℕ → ℝ}
400    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1)
401    (ha0 : ∀ l, 0 ≤ a l) (ha : HasSum a c) :
402    (∑' k, (∑' l, a l * BosonicNumberLaw.seededLaw x l k) * Thermal.witness q x k) ≤
403      c * Thermal.fidelity q x := by
404  let e : (Fin 1 → ℕ) ≃ ℕ := Equiv.funUnique (Fin 1) ℕ
405  have he (l : Fin 1 → ℕ) : e l = l 0 := rfl
406  have ha' : HasSum (fun l : Fin 1 → ℕ => a (l 0)) c := by
407    simpa only [Function.comp_apply, he] using e.hasSum_iff.mpr ha
408  have h := BosonicNumberLaw.mixtureLaw_witness_moment_le
409    (q := fun _ : Fin 1 => q) (x := fun _ => x) (a := fun l => a (l 0))
410    (fun _ => hq0) (fun _ => hqx) (fun _ => hx1) (fun l => ha0 (l 0)) ha'
411  simp only [BosonicNumberLaw.mixtureLaw, BosonicNumberLaw.productLaw, Fin.prod_univ_one] at h
412  have hinner (k : ℕ) : (∑' l : Fin 1 → ℕ, a (l 0) * BosonicNumberLaw.seededLaw x (l 0) k) =
413      ∑' l, a l * BosonicNumberLaw.seededLaw x l k :=
414    e.tsum_eq (fun l => a l * BosonicNumberLaw.seededLaw x l k)
415  simp_rw [hinner] at h
416  have houter := e.tsum_eq (fun k =>
417    (∑' l, a l * BosonicNumberLaw.seededLaw x l k) * Thermal.witness q x k)
418  rw [show (∑' k : Fin 1 → ℕ,
419      (∑' l, a l * BosonicNumberLaw.seededLaw x l (k 0)) * Thermal.witness q x (k 0)) =
420      (∑' k, (∑' l, a l * BosonicNumberLaw.seededLaw x l k) * Thermal.witness q x k)
421    from houter] at h
422  exact h
423 
424lemma single_number_law_witness_moment_le (b : HilbertBasis ℕ ℂ H) (A : TraceClass H)
425    {q x c : ℝ} {a : ℕ → ℝ} (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1)
426    (ha0 : ∀ l, 0 ≤ a l) (ha : HasSum a c)
427    (hdiag : ∀ k, (⟪b k, A.1 (b k)⟫_ℂ).re =
428      ∑' l, a l * BosonicNumberLaw.seededLaw x l k) :
429    (tracePairing A (witnessOperator b q x)).re ≤ c * Thermal.fidelity q x := by
430  rw [tracePairing_re_eq_number_moment b A _ _ (witnessOperator_apply_basis b hq0 hqx hx1)]
431  simp_rw [hdiag]
432  exact single_mixture_witness_moment_le hq0 hqx hx1 ha0 ha
433 
434lemma fidelity_sq_le_of_single_number_law (b : HilbertBasis ℕ ℂ H)
435    (A : TraceClass H) (hA : 0 ≤ A.1) {q x c : ℝ} {a : ℕ → ℝ}
436    (hq0 : 0 < q) (hqx : q < x) (hx1 : x < 1) (ha0 : ∀ l, 0 ≤ a l) (ha : HasSum a c)
437    (hdiag : ∀ k, (⟪b k, A.1 (b k)⟫_ℂ).re =
438      ∑' l, a l * BosonicNumberLaw.seededLaw x l k) :
439    fidelity A.1 (vectorMixture b (Thermal.geometric q)).1 hA
440      (vectorMixture_nonneg b b.orthonormal.norm_eq_one _
441        (Thermal.geometric_hasSum hq0.le (hqx.trans hx1)).summable
442        (Thermal.geometric_nonneg hq0.le (hqx.trans hx1).le))
443      A.2 (vectorMixture b (Thermal.geometric q)).2 ^ 2 ≤
444      c * Thermal.fidelity q x ^ 2 := by
445  have hf0 := (Thermal.fidelity_pos hq0.le (hqx.trans hx1) (hq0.trans hqx).le hx1).le
446  calc
447    _ ≤ _ := fidelity_sq_le_thermal_witness b A hA hq0 hqx hx1
448    _ ≤ (c * Thermal.fidelity q x) * Thermal.fidelity q x :=
449      mul_le_mul_of_nonneg_right
450        (single_number_law_witness_moment_le b A hq0 hqx hx1 ha0 ha hdiag) hf0
451    _ = _ := by ring
452 
453end
454end Cloning.ThermalWitness