Offline · exact source
Exact Lean source

MatrixFidelityScaling

formalization/Cloning/MatrixFidelityScaling.lean

Source hash: 2d0eeb3209a2edbf1f071bf1ddad43f09ff99c84f13bec81c86644d66ada89f4

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.MatrixFidelity
2import Cloning.BlockFidelity
3 
4/-!
5# Scaling and diagonal specialization of matrix root fidelity
6 
7All square roots below are the continuous-functional-calculus square roots
8of actual complex matrices. No abstract fidelity laws are assumed.
9-/
10 
11noncomputable section
12open scoped BigOperators MatrixOrder ComplexOrder
13open Matrix
14 
15namespace Cloning.MatrixFidelity
16 
17set_option backward.isDefEq.respectTransparency false
18 
19variable {n : Type*} [Fintype n] [DecidableEq n]
20 
21/-- The positive matrix square root scales by the scalar square root. -/
22theorem sqrt_smul_real (a : ℝ) (A : Matrix n n ℂ)
23    (ha : 0 ≤ a) (hA : A.PosSemidef) :
24    CFC.sqrt (a • A) = Real.sqrt a • CFC.sqrt A := by
25  apply CFC.sqrt_unique
26  · rw [smul_mul_assoc, mul_smul_comm, smul_smul,
27      Real.mul_self_sqrt ha, sqrt_mul_self hA]
28  · exact ((sqrt_posSemidef A).smul (Real.sqrt_nonneg a)).nonneg
29 
30/-- Positive scalar homogeneity in the first matrix argument. -/
31theorem fidelity_smul_left (a : ℝ) (A B : Matrix n n ℂ)
32    (ha : 0 ≤ a) (hA : A.PosSemidef) :
33    fidelity (a • A) B = Real.sqrt a * fidelity A B := by
34  unfold fidelity
35  rw [mul_smul_comm, smul_mul_assoc,
36    sqrt_smul_real a _ ha (sandwich_posSemidef hA B), Matrix.trace_smul]
37  simp only [Complex.smul_re, smul_eq_mul]
38 
39/-- Positive scalar homogeneity in the second matrix argument. -/
40theorem fidelity_smul_right (b : ℝ) (A B : Matrix n n ℂ)
41    (hb : 0 ≤ b) (hA : A.PosSemidef) (hB : B.PosSemidef) :
42    fidelity A (b • B) = Real.sqrt b * fidelity A B := by
43  unfold fidelity
44  rw [sqrt_smul_real b B hb hB]
45  rw [smul_mul_assoc, mul_smul_comm, smul_mul_assoc, smul_smul, Real.mul_self_sqrt hb,
46    sqrt_smul_real b _ hb (sandwich_posSemidef hA B), Matrix.trace_smul]
47  simp only [Complex.smul_re, smul_eq_mul]
48 
49/-- Matrix root fidelity is homogeneous of degree one-half in each argument. -/
50theorem fidelity_smul (a b : ℝ) (A B : Matrix n n ℂ)
51    (ha : 0 ≤ a) (hb : 0 ≤ b) (hA : A.PosSemidef) (hB : B.PosSemidef) :
52    fidelity (a • A) (b • B) = Real.sqrt a * Real.sqrt b * fidelity A B := by
53  rw [fidelity_smul_left a A (b • B) ha hA, fidelity_smul_right b A B hb hA hB]
54  ring
55 
56/-- Square roots of nonnegative real diagonal matrices are entrywise square roots. -/
57theorem sqrt_diagonal_real (p : n → ℝ) (hp : ∀ i, 0 ≤ p i) :
58    CFC.sqrt (Matrix.diagonal fun i ↦ (p i : ℂ)) =
59      Matrix.diagonal fun i ↦ (Real.sqrt (p i) : ℂ) := by
60  apply CFC.sqrt_unique
61  · rw [Matrix.diagonal_mul_diagonal]
62    congr 1
63    funext i
64    rw [← Complex.ofReal_mul, Real.mul_self_sqrt (hp i)]
65  · apply Matrix.PosSemidef.nonneg
66    apply Matrix.PosSemidef.diagonal
67    intro i
68    exact Complex.nonneg_iff.mpr ⟨Real.sqrt_nonneg (p i), rfl⟩
69 
70/-- For diagonal density matrices, quantum root fidelity is the classical
71Hellinger affinity. The statement also holds for unnormalized nonnegative weights. -/
72theorem fidelity_diagonal_real (p q : n → ℝ)
73    (hp : ∀ i, 0 ≤ p i) (hq : ∀ i, 0 ≤ q i) :
74    fidelity (Matrix.diagonal fun i ↦ (p i : ℂ))
75      (Matrix.diagonal fun i ↦ (q i : ℂ)) =
76      Cloning.BlockFidelity.classicalAffinity p q := by
77  unfold fidelity
78  rw [sqrt_diagonal_real q hq]
79  simp only [Matrix.diagonal_mul_diagonal]
80  have hdiag : (Matrix.diagonal fun i ↦
81      (Real.sqrt (q i) : ℂ) * (p i : ℂ) * (Real.sqrt (q i) : ℂ)) =
82      Matrix.diagonal fun i ↦ ((p i * q i : ℝ) : ℂ) := by
83    congr 1
84    funext i
85    calc
86      (Real.sqrt (q i) : ℂ) * (p i : ℂ) * (Real.sqrt (q i) : ℂ) =
87          (p i : ℂ) * ((Real.sqrt (q i) : ℂ) * (Real.sqrt (q i) : ℂ)) := by ring
88      _ = ((p i * q i : ℝ) : ℂ) := by
89        rw [← Complex.ofReal_mul, Real.mul_self_sqrt (hq i), Complex.ofReal_mul]
90  rw [hdiag, sqrt_diagonal_real (fun i ↦ p i * q i) (fun i ↦ mul_nonneg (hp i) (hq i)),
91    Matrix.trace_diagonal]
92  simp only [Complex.re_sum, Complex.ofReal_re, Cloning.BlockFidelity.classicalAffinity]
93  apply Finset.sum_congr rfl
94  intro i _
95  exact Real.sqrt_mul (hp i) (q i)
96 
97end Cloning.MatrixFidelity