Exact Lean source
MatrixFidelityWitness
formalization/Cloning/MatrixFidelityWitness.lean
Source hash: 6ec8a5fc1fe6f722f872ce8db0c8cb04678659c4e92d9ec7254a661709736f50
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.fidelityWitnesstheorem Cloning.MatrixFidelity.fidelityWitness_middle_posDeftheorem Cloning.MatrixFidelity.fidelityWitness_posDeftheorem Cloning.MatrixFidelity.fidelityWitness_equationtheorem Cloning.MatrixFidelity.fidelityWitness_tracetheorem Cloning.MatrixFidelity.exists_fidelity_witnesstheorem Cloning.MatrixFidelity.riccati_block_posSemideftheorem Cloning.MatrixFidelity.exists_fidelity_block_witness1import Cloning.MatrixFidelitySymmetry
2import Cloning.MatrixRegularization
3import Mathlib.Data.Matrix.ColumnRowPartitioned
4
5/-!
6# Optimal positive-definite witnesses for matrix fidelity
7
8The geometric-mean witness is constructed explicitly. Its Riccati identity,
9positive definiteness, trace objective, and positive block-matrix realization
10are all proved from concrete matrix algebra.
11-/
12
13noncomputable section
14open scoped BigOperators MatrixOrder ComplexOrder
15open Matrix Cloning.MatrixRegularization
16namespace Cloning.MatrixFidelity
17
18set_option backward.isDefEq.respectTransparency false
19
20variable {n : Type*} [Fintype n] [DecidableEq n]
21
22/-- The geometric-mean witness solving `H A H = B` for positive definite inputs. -/
23def fidelityWitness (A B : Matrix n n ℂ) : Matrix n n ℂ :=
24 (CFC.sqrt A)⁻¹ * CFC.sqrt (CFC.sqrt A * B * CFC.sqrt A) * (CFC.sqrt A)⁻¹
25
26/-- Congruence by the invertible positive square root preserves positive
27 definiteness. -/
28lemma fidelityWitness_middle_posDef {A B : Matrix n n ℂ}
29 (hA : A.PosDef) (hB : B.PosDef) :
30 (CFC.sqrt A * B * CFC.sqrt A).PosDef := by
31 simpa only [sqrt_conjTranspose] using
32 hB.conjTranspose_mul_mul_same (Matrix.mulVec_injective_of_isUnit (sqrt_isUnit hA))
33
34/-- The geometric-mean witness is positive definite. -/
35theorem fidelityWitness_posDef {A B : Matrix n n ℂ}
36 (hA : A.PosDef) (hB : B.PosDef) : (fidelityWitness A B).PosDef := by
37 have hM := fidelityWitness_middle_posDef hA hB
38 have hR : (CFC.sqrt (CFC.sqrt A * B * CFC.sqrt A)).PosDef :=
39 hM.isStrictlyPositive.sqrt.posDef
40 simpa only [fidelityWitness, sqrt_inv_conjTranspose] using
41 hR.conjTranspose_mul_mul_same
42 (Matrix.mulVec_injective_of_isUnit (sqrt_inv_posDef hA).isUnit)
43
44/-- The witness exactly solves the positive matrix Riccati equation. -/
45theorem fidelityWitness_equation {A B : Matrix n n ℂ}
46 (hA : A.PosDef) (hB : B.PosDef) :
47 fidelityWitness A B * A * fidelityWitness A B = B := by
48 let S := CFC.sqrt A
49 let R := CFC.sqrt (S * B * S)
50 let K := S⁻¹
51 have hKA : K * A * K = 1 := sqrt_inv_sandwich hA
52 have hRS : R * R = S * B * S :=
53 sqrt_mul_self (fidelityWitness_middle_posDef hA hB).posSemidef
54 have hKS : K * S = 1 := sqrt_inv_mul hA
55 have hSK : S * K = 1 := sqrt_mul_inv hA
56 change (K * R * K) * A * (K * R * K) = B
57 calc
58 _ = K * R * (K * A * K) * R * K := by simp only [Matrix.mul_assoc]
59 _ = K * (R * R) * K := by rw [hKA]; simp only [Matrix.mul_one, Matrix.mul_assoc]
60 _ = K * (S * B * S) * K := by rw [hRS]
61 _ = (K * S) * B * (S * K) := by simp only [Matrix.mul_assoc]
62 _ = B := by rw [hKS, hSK, Matrix.one_mul, Matrix.mul_one]
63
64/-- The trace pairing with the geometric-mean witness is exactly root fidelity. -/
65theorem fidelityWitness_trace {A B : Matrix n n ℂ}
66 (hA : A.PosDef) (hB : B.PosDef) :
67 (Matrix.trace (A * fidelityWitness A B)).re = fidelity A B := by
68 have hcyc : Matrix.trace (A * fidelityWitness A B) =
69 Matrix.trace (CFC.sqrt (CFC.sqrt A * B * CFC.sqrt A)) := by
70 unfold fidelityWitness
71 rw [← Matrix.mul_assoc, Matrix.trace_mul_cycle]
72 rw [← Matrix.mul_assoc, sqrt_inv_sandwich hA, Matrix.one_mul]
73 rw [hcyc, fidelity_symm hA.posSemidef hB.posSemidef]
74 rfl
75
76/-- An optimal positive definite witness, with its exact objective and equation. -/
77theorem exists_fidelity_witness {A B : Matrix n n ℂ}
78 (hA : A.PosDef) (hB : B.PosDef) :
79 ∃ H : Matrix n n ℂ, H.PosDef ∧ H * A * H = B ∧
80 (Matrix.trace (A * H)).re = fidelity A B :=
81 ⟨fidelityWitness A B, fidelityWitness_posDef hA hB,
82 fidelityWitness_equation hA hB, fidelityWitness_trace hA hB⟩
83
84/-- A Hermitian Riccati solution gives a positive block matrix by rectangular
85congruence of `A` with the vertical matrix `[I;H]`. -/
86lemma riccati_block_posSemidef {A B H : Matrix n n ℂ}
87 (hA : A.PosSemidef) (hH : H.IsHermitian) (hHAH : H * A * H = B) :
88 (Matrix.fromBlocks A (A * H) (A * H).conjTranspose B).PosSemidef := by
89 have hp := hA.mul_mul_conjTranspose_same (Matrix.fromRows (1 : Matrix n n ℂ) H)
90 simpa only [Matrix.conjTranspose_fromRows_eq_fromCols_conjTranspose,
91 Matrix.conjTranspose_one, Matrix.fromRows_mul, Matrix.mul_fromCols,
92 Matrix.fromRows_fromCols_eq_fromBlocks, Matrix.fromCols_fromRows_eq_fromBlocks,
93 Matrix.one_mul, Matrix.mul_one, hH.eq, hHAH, Matrix.conjTranspose_mul,
94 hA.isHermitian.eq] using hp
95
96/-- A feasible fidelity SDP block attaining the exact trace objective, for
97positive definite input matrices. -/
98theorem exists_fidelity_block_witness {A B : Matrix n n ℂ}
99 (hA : A.PosDef) (hB : B.PosDef) :
100 ∃ X : Matrix n n ℂ, (Matrix.fromBlocks A X X.conjTranspose B).PosSemidef ∧
101 (Matrix.trace X).re = fidelity A B := by
102 obtain ⟨H, hH, hHAH, htrace⟩ := exists_fidelity_witness hA hB
103 exact ⟨A * H, riccati_block_posSemidef hA.posSemidef hH.isHermitian hHAH, htrace⟩
104
105end Cloning.MatrixFidelity