Offline · exact source
Exact Lean source

MatrixWeightedFidelity

formalization/Cloning/MatrixWeightedFidelity.lean

Source hash: a6dd3099239fac3689ef8767bffaf08b6148ad6716d669f011f0d679dc3988ee

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.MatrixFidelityBlockBound
2import Mathlib.Algebra.QuadraticDiscriminant
3import Mathlib.Tactic.Linarith
4 
5/-!
6# Weighted root-fidelity bounds for finite complex matrices
7 
8For positive matrices `A`, `B` and a positive-definite matrix weight `W`,
9the squared root fidelity is bounded by `Re tr(A W) * Re tr(B W⁻¹)`.
10The weight need not commute with either input. All operators here are finite
11matrices; no statement about unbounded infinite-dimensional weights is made.
12-/
13 
14noncomputable section
15open scoped Matrix MatrixOrder ComplexOrder Topology
16open Matrix Filter
17 
18namespace Cloning.MatrixFidelity
19 
20set_option autoImplicit false
21set_option backward.isDefEq.respectTransparency false
22 
23variable {n : Type*} [Fintype n] [DecidableEq n]
24 
25/-- Pairing the positive block quadratic with the inverse weight gives a
26nonnegative real quadratic for every real scalar, including negative ones. -/
27theorem block_weighted_quadratic_nonneg {A B X W : Matrix n n ℂ}
28    (hblock : (Matrix.fromBlocks A X Xᴴ B).PosSemidef) (hW : W.PosDef)
29    (s : ℝ) :
30    0 ≤ (Matrix.trace (A * W)).re * (s * s) +
31      (-2 * (Matrix.trace X).re) * s + (Matrix.trace (B * W⁻¹)).re := by
32  have hsW : (s • W).IsHermitian := by
33    change (s • W)ᴴ = s • W
34    simp only [Matrix.conjTranspose_smul, hW.isHermitian.eq, star_trivial]
35  have hQ := block_quadratic_posSemidef hblock hsW
36  have hpair := trace_mul_re_nonneg hQ hW.inv.posSemidef
37  have hWi : IsUnit W.det := (Matrix.isUnit_iff_isUnit_det W).mp hW.isUnit
38  have hfirst : Matrix.trace (W * A * W * W⁻¹) = Matrix.trace (A * W) := by
39    rw [Matrix.mul_assoc (W * A) W W⁻¹, Matrix.mul_nonsing_inv W hWi,
40      Matrix.mul_one, Matrix.trace_mul_comm W A]
41  have hsecond : Matrix.trace (W * X * W⁻¹) = Matrix.trace X := by
42    rw [Matrix.trace_mul_cycle, Matrix.nonsing_inv_mul W hWi, Matrix.one_mul]
43  have hthird : Matrix.trace (Xᴴ * W * W⁻¹) = star (Matrix.trace X) := by
44    rw [Matrix.mul_assoc, Matrix.mul_nonsing_inv W hWi,
45      Matrix.mul_one, Matrix.trace_conjTranspose]
46  simp only [Matrix.add_mul, Matrix.sub_mul, smul_mul_assoc, mul_smul_comm,
47    smul_smul, Matrix.trace_add, Matrix.trace_sub, Matrix.trace_smul,
48    Complex.add_re, Complex.sub_re, Complex.smul_re, smul_eq_mul] at hpair
49  rw [hfirst, hsecond, hthird] at hpair
50  have hstar : (star (Matrix.trace X)).re = (Matrix.trace X).re := rfl
51  rw [hstar] at hpair
52  nlinarith only [hpair]
53 
54/-- The scalar discriminant controls the off-diagonal trace of every
55positive block matrix by the two weighted diagonal traces. -/
56theorem block_trace_sq_le_weighted_trace_product {A B X W : Matrix n n ℂ}
57    (hblock : (Matrix.fromBlocks A X Xᴴ B).PosSemidef) (hW : W.PosDef) :
58    (Matrix.trace X).re ^ 2 ≤
59      (Matrix.trace (A * W)).re * (Matrix.trace (B * W⁻¹)).re := by
60  have h := discrim_le_zero (block_weighted_quadratic_nonneg hblock hW)
61  unfold discrim at h
62  nlinarith only [h]
63 
64/-- The weighted inequality for positive-definite inputs follows from an
65explicit feasible block whose off-diagonal trace attains root fidelity. -/
66theorem fidelity_sq_le_weighted_trace_product_posDef {A B W : Matrix n n ℂ}
67    (hA : A.PosDef) (hB : B.PosDef) (hW : W.PosDef) :
68    fidelity A B ^ 2 ≤
69      (Matrix.trace (A * W)).re * (Matrix.trace (B * W⁻¹)).re := by
70  obtain ⟨X, hblock, htrace⟩ := exists_fidelity_block_witness hA hB
71  simpa only [htrace] using block_trace_sq_le_weighted_trace_product hblock hW
72 
73/-- The noncommutative weighted root-fidelity inequality for arbitrary
74positive finite matrices and any positive-definite finite matrix weight.
75The inputs may be singular and need not have unit trace. -/
76theorem fidelity_sq_le_weighted_trace_product {A B W : Matrix n n ℂ}
77    (hA : A.PosSemidef) (hB : B.PosSemidef) (hW : W.PosDef) :
78    fidelity A B ^ 2 ≤
79      (Matrix.trace (A * W)).re * (Matrix.trace (B * W⁻¹)).re := by
80  let ε : ℕ → ℝ := fun k => 1 / ((k : ℝ) + 1)
81  have hε (k : ℕ) : 0 < ε k := by
82    dsimp [ε]
83    positivity
84  let Aseq := fun k => Cloning.MatrixRegularization.regularize A (ε k)
85  let Bseq := fun k => Cloning.MatrixRegularization.regularize B (ε k)
86  have hAseq (k : ℕ) : (Aseq k).PosDef :=
87    Cloning.MatrixRegularization.regularize_posDef hA (hε k)
88  have hBseq (k : ℕ) : (Bseq k).PosDef :=
89    Cloning.MatrixRegularization.regularize_posDef hB (hε k)
90  have hAlim : Tendsto Aseq atTop (𝓝 A) :=
91    (Cloning.MatrixRegularization.tendsto_regularize_zero A).comp
92      tendsto_one_div_add_atTop_nhds_zero_nat
93  have hBlim : Tendsto Bseq atTop (𝓝 B) :=
94    (Cloning.MatrixRegularization.tendsto_regularize_zero B).comp
95      tendsto_one_div_add_atTop_nhds_zero_nat
96  have hleft := (tendsto_fidelity hA hB (fun k => (hAseq k).posSemidef)
97    (fun k => (hBseq k).posSemidef) hAlim hBlim).pow 2
98  have htrace (V : Matrix n n ℂ) :
99      Continuous (fun C : Matrix n n ℂ => (Matrix.trace (C * V)).re) := by
100    unfold Matrix.trace
101    fun_prop
102  have hright := ((htrace W).continuousAt.tendsto.comp hAlim).mul
103    ((htrace W⁻¹).continuousAt.tendsto.comp hBlim)
104  apply le_of_tendsto_of_tendsto hleft hright
105  exact Filter.Eventually.of_forall (fun k =>
106    fidelity_sq_le_weighted_trace_product_posDef (hAseq k) (hBseq k) hW)
107 
108end Cloning.MatrixFidelity