Exact Lean source
MatrixFidelityBounds
formalization/Cloning/MatrixFidelityBounds.lean
Source hash: d64495a84e7a323b0dcf162124e19028e77dfaafed545c0cb5daa2c361bb5408
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
definition
Cloning.MatrixFidelity.hilbertSchmidtVectortheorem Cloning.MatrixFidelity.inner_hilbertSchmidtVectortheorem Cloning.MatrixFidelity.norm_hilbertSchmidtVector_sqtheorem Cloning.MatrixFidelity.trace_cauchy_schwarz_sqtheorem Cloning.MatrixFidelity.re_trace_cauchy_schwarz_sqtheorem Cloning.MatrixFidelity.sqrt_trace_sq_le_card_mul_tracetheorem Cloning.MatrixFidelity.sqrt_trace_le_sqrt_card_mul_tracetheorem Cloning.MatrixFidelity.continuousOn_matrix_sqrttheorem Cloning.MatrixFidelity.continuousOn_fidelity1import Cloning.MatrixFidelity
2import Mathlib.Analysis.CStarAlgebra.Matrix
3import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Basic
4import Mathlib.Analysis.InnerProductSpace.PiL2
5import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Rpow.Isometric
6import Mathlib.Tactic.Linarith
7import Mathlib.Tactic.FunProp
8
9/-! # Concrete matrix trace estimates
10
11These estimates concern complex matrices and their positive square roots.
12They do not assume a fidelity-continuity axiom or an abstract fidelity law.
13-/
14
15noncomputable section
16open scoped BigOperators Matrix MatrixOrder ComplexOrder
17
18namespace Cloning.MatrixFidelity
19
20set_option backward.isDefEq.respectTransparency false
21
22variable {m n : Type*} [Fintype m] [Fintype n]
23
24/-- Flattening a complex matrix into its Hilbert--Schmidt vector. -/
25def hilbertSchmidtVector (A : Matrix m n ℂ) : EuclideanSpace ℂ (m × n) :=
26 WithLp.toLp 2 (fun p => A p.1 p.2)
27
28lemma inner_hilbertSchmidtVector (A B : Matrix m n ℂ) :
29 inner ℂ (hilbertSchmidtVector A) (hilbertSchmidtVector B) =
30 (A.conjTranspose * B).trace := by
31 simp only [hilbertSchmidtVector, EuclideanSpace.inner_toLp_toLp,
32 dotProduct, Pi.star_apply, Matrix.trace,
33 Fintype.sum_prod_type]
34 rw [Finset.sum_comm]
35 apply Finset.sum_congr rfl
36 intro i hi
37 apply Finset.sum_congr rfl
38 intro j hj
39 exact mul_comm _ _
40
41/-- The squared Hilbert--Schmidt norm is the trace of the Gram matrix. -/
42lemma norm_hilbertSchmidtVector_sq (A : Matrix m n ℂ) :
43 ‖hilbertSchmidtVector A‖ ^ 2 = (A.conjTranspose * A).trace.re := by
44 rw [norm_sq_eq_re_inner (𝕜 := ℂ), inner_hilbertSchmidtVector]
45 rfl
46
47/-- Cauchy--Schwarz for matrix traces, with no positivity assumptions. -/
48theorem trace_cauchy_schwarz_sq (A B : Matrix m n ℂ) :
49 ‖(A.conjTranspose * B).trace‖ ^ 2 ≤
50 (A.conjTranspose * A).trace.re * (B.conjTranspose * B).trace.re := by
51 have h := norm_inner_le_norm (𝕜 := ℂ) (hilbertSchmidtVector A) (hilbertSchmidtVector B)
52 have hsq := mul_self_le_mul_self (norm_nonneg _) h
53 rw [inner_hilbertSchmidtVector] at hsq
54 rw [← norm_hilbertSchmidtVector_sq A, ← norm_hilbertSchmidtVector_sq B]
55 nlinarith
56
57/-- The real trace version of Hilbert--Schmidt Cauchy--Schwarz. -/
58theorem re_trace_cauchy_schwarz_sq (A B : Matrix m n ℂ) :
59 (A.conjTranspose * B).trace.re ^ 2 ≤
60 (A.conjTranspose * A).trace.re * (B.conjTranspose * B).trace.re := by
61 have h := trace_cauchy_schwarz_sq A B
62 have he := Complex.sq_norm_sub_sq_re ((A.conjTranspose * B).trace)
63 nlinarith [sq_nonneg ((A.conjTranspose * B).trace.im)]
64
65variable [DecidableEq n]
66
67/-- A dimension-dependent square-root trace bound, derived directly from
68matrix Cauchy--Schwarz and the positive-square-root identity. -/
69theorem sqrt_trace_sq_le_card_mul_trace (A : Matrix n n ℂ)
70 (hA : A.PosSemidef) :
71 (CFC.sqrt A).trace.re ^ 2 ≤ (Fintype.card n : ℝ) * A.trace.re := by
72 have h := re_trace_cauchy_schwarz_sq (1 : Matrix n n ℂ) (CFC.sqrt A)
73 have hS : (CFC.sqrt A).PosSemidef :=
74 Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg A)
75 have hs : (CFC.sqrt A).conjTranspose * CFC.sqrt A = A := by
76 rw [hS.isHermitian.eq]
77 exact CFC.sqrt_mul_sqrt_self A hA.nonneg
78 simpa only [Matrix.conjTranspose_one, one_mul, hs, Matrix.trace_one,
79 Complex.natCast_re] using h
80
81/-- The unsquared dimension-dependent bound. -/
82theorem sqrt_trace_le_sqrt_card_mul_trace (A : Matrix n n ℂ)
83 (hA : A.PosSemidef) :
84 (CFC.sqrt A).trace.re ≤ Real.sqrt ((Fintype.card n : ℝ) * A.trace.re) := by
85 have h := sqrt_trace_sq_le_card_mul_trace A hA
86 have hn : 0 ≤ (Fintype.card n : ℝ) * A.trace.re :=
87 mul_nonneg (Nat.cast_nonneg _) hA.trace_nonneg.1
88 have hs := Real.sq_sqrt hn
89 have hs0 := Real.sqrt_nonneg ((Fintype.card n : ℝ) * A.trace.re)
90 nlinarith
91
92section Continuity
93
94open scoped Matrix.Norms.L2Operator
95
96local instance : CStarAlgebra (Matrix n n ℂ) where
97
98/-- Positive matrix square roots depend continuously on the matrix within
99the positive cone, for each fixed finite matrix dimension. -/
100theorem continuousOn_matrix_sqrt :
101 ContinuousOn (CFC.sqrt : Matrix n n ℂ → Matrix n n ℂ)
102 {A | A.PosSemidef} := by
103 simpa only [Matrix.nonneg_iff_posSemidef] using
104 (CFC.continuousOn_sqrt (A := Matrix n n ℂ))
105
106/-- Actual finite-dimensional root fidelity is jointly continuous on the
107positive cone. This is qualitative fixed-dimension continuity, not the
108dimension-independent trace-norm modulus needed for LAN. -/
109theorem continuousOn_fidelity :
110 ContinuousOn (fun p : Matrix n n ℂ × Matrix n n ℂ => fidelity p.1 p.2)
111 {p | p.1.PosSemidef ∧ p.2.PosSemidef} := by
112 have hB : ContinuousOn
113 (fun p : Matrix n n ℂ × Matrix n n ℂ => CFC.sqrt p.2)
114 {p | p.1.PosSemidef ∧ p.2.PosSemidef} :=
115 continuousOn_matrix_sqrt.comp continuous_snd.continuousOn (fun _ hp => hp.2)
116 have hinside := (hB.mul continuous_fst.continuousOn).mul hB
117 have hout := continuousOn_matrix_sqrt.comp hinside
118 (fun p hp => sandwich_posSemidef hp.1 p.2)
119 have htrace : Continuous (fun A : Matrix n n ℂ => A.trace.re) := by
120 unfold Matrix.trace
121 fun_prop
122 exact htrace.comp_continuousOn hout
123
124end Continuity
125
126end Cloning.MatrixFidelity