Exact Lean source
MatrixFidelity
formalization/Cloning/MatrixFidelity.lean
Source hash: 8a6c9ddad823b37223456803808d18982b4501585560b99395042e8cdbf850cd
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.matrixTraceNormdefinition Cloning.MatrixFidelity.fidelitytheorem Cloning.MatrixFidelity.sqrt_posSemideftheorem Cloning.MatrixFidelity.sqrt_mul_selftheorem Cloning.MatrixFidelity.sqrt_conjTransposetheorem Cloning.MatrixFidelity.trace_re_nonnegtheorem Cloning.MatrixFidelity.trace_im_zerotheorem Cloning.MatrixFidelity.sandwich_posSemideftheorem Cloning.MatrixFidelity.fidelity_nonnegtheorem Cloning.MatrixFidelity.matrixTraceNorm_nonnegtheorem Cloning.MatrixFidelity.matrixTraceNorm_of_posSemideftheorem Cloning.MatrixFidelity.fidelity_eq_traceNormtheorem Cloning.MatrixFidelity.fidelity_selftheorem Cloning.MatrixFidelity.fidelity_zero_lefttheorem Cloning.MatrixFidelity.fidelity_zero_rightinductive Cloning.MatrixFidelity.Statetheorem Cloning.MatrixFidelity.state_fidelity_self1import Mathlib.Analysis.Matrix.Order
2import Mathlib.LinearAlgebra.Matrix.Trace
3import Mathlib.Analysis.Complex.Basic
4import Mathlib.Analysis.Complex.Order
5
6/-!
7# Concrete finite-dimensional root fidelity
8
9The trace norm is defined by its spectral formula `Tr sqrt(X* X)`.
10Root fidelity uses the equivalent positive sandwich formula. All objects here
11are actual complex matrices; no fidelity laws are postulated.
12-/
13
14open scoped BigOperators MatrixOrder ComplexOrder
15open Matrix
16
17noncomputable section
18
19namespace Cloning.MatrixFidelity
20
21set_option autoImplicit false
22set_option backward.isDefEq.respectTransparency false
23
24variable {n : Type*} [Fintype n] [DecidableEq n]
25
26/-- Spectral definition of the finite-dimensional trace norm. -/
27def matrixTraceNorm (X : Matrix n n ℂ) : ℝ :=
28 (Matrix.trace (CFC.sqrt (Xᴴ * X))).re
29
30/-- Root fidelity, with the second positive matrix in the sandwich. -/
31def fidelity (A B : Matrix n n ℂ) : ℝ :=
32 (Matrix.trace (CFC.sqrt (CFC.sqrt B * A * CFC.sqrt B))).re
33
34theorem sqrt_posSemidef (A : Matrix n n ℂ) : (CFC.sqrt A).PosSemidef :=
35 (CFC.sqrt_nonneg A).posSemidef
36
37theorem sqrt_mul_self {A : Matrix n n ℂ} (hA : A.PosSemidef) :
38 CFC.sqrt A * CFC.sqrt A = A :=
39 CFC.sqrt_mul_sqrt_self A hA.nonneg
40
41theorem sqrt_conjTranspose (A : Matrix n n ℂ) :
42 (CFC.sqrt A)ᴴ = CFC.sqrt A :=
43 (sqrt_posSemidef A).isHermitian
44
45omit [DecidableEq n] in
46theorem trace_re_nonneg {A : Matrix n n ℂ} (hA : A.PosSemidef) :
47 0 ≤ (Matrix.trace A).re :=
48 hA.trace_nonneg.1
49
50omit [DecidableEq n] in
51theorem trace_im_zero {A : Matrix n n ℂ} (hA : A.PosSemidef) :
52 (Matrix.trace A).im = 0 :=
53 hA.trace_nonneg.2.symm
54
55theorem sandwich_posSemidef {A : Matrix n n ℂ} (hA : A.PosSemidef)
56 (B : Matrix n n ℂ) : (CFC.sqrt B * A * CFC.sqrt B).PosSemidef := by
57 simpa only [sqrt_conjTranspose] using
58 hA.conjTranspose_mul_mul_same (CFC.sqrt B)
59
60theorem fidelity_nonneg (A B : Matrix n n ℂ) : 0 ≤ fidelity A B :=
61 trace_re_nonneg (sqrt_posSemidef _)
62
63theorem matrixTraceNorm_nonneg (X : Matrix n n ℂ) : 0 ≤ matrixTraceNorm X :=
64 trace_re_nonneg (sqrt_posSemidef _)
65
66/-- The trace norm of a positive matrix is its trace. -/
67theorem matrixTraceNorm_of_posSemidef {A : Matrix n n ℂ} (hA : A.PosSemidef) :
68 matrixTraceNorm A = (Matrix.trace A).re := by
69 unfold matrixTraceNorm
70 rw [hA.isHermitian.eq, ← sq, CFC.sqrt_sq A hA.nonneg]
71
72/-- The sandwich and square-root-product definitions agree for positive matrices. -/
73theorem fidelity_eq_traceNorm {A B : Matrix n n ℂ}
74 (hA : A.PosSemidef) (_hB : B.PosSemidef) :
75 fidelity A B = matrixTraceNorm (CFC.sqrt A * CFC.sqrt B) := by
76 unfold fidelity matrixTraceNorm
77 congr 3
78 rw [Matrix.conjTranspose_mul, sqrt_conjTranspose, sqrt_conjTranspose]
79 rw [← Matrix.mul_assoc (CFC.sqrt B * CFC.sqrt A),
80 Matrix.mul_assoc (CFC.sqrt B) (CFC.sqrt A), sqrt_mul_self hA]
81
82theorem fidelity_self {A : Matrix n n ℂ} (hA : A.PosSemidef) :
83 fidelity A A = (Matrix.trace A).re := by
84 unfold fidelity
85 have hs : CFC.sqrt A * A * CFC.sqrt A = A * A := by
86 calc
87 CFC.sqrt A * A * CFC.sqrt A =
88 CFC.sqrt A * (CFC.sqrt A * CFC.sqrt A) * CFC.sqrt A := by
89 rw [sqrt_mul_self hA]
90 _ = (CFC.sqrt A * CFC.sqrt A) * (CFC.sqrt A * CFC.sqrt A) := by
91 simp only [Matrix.mul_assoc]
92 _ = A * A := by rw [sqrt_mul_self hA]
93 rw [hs, ← sq, CFC.sqrt_sq A hA.nonneg]
94
95theorem fidelity_zero_left (B : Matrix n n ℂ) : fidelity 0 B = 0 := by
96 simp [fidelity]
97
98theorem fidelity_zero_right (A : Matrix n n ℂ) : fidelity A 0 = 0 := by
99 simp [fidelity]
100
101/-- A finite-dimensional density matrix. -/
102structure State (n : Type*) [Fintype n] where
103 matrix : Matrix n n ℂ
104 positive : matrix.PosSemidef
105 trace_one : Matrix.trace matrix = 1
106
107theorem state_fidelity_self (ρ : State n) : fidelity ρ.matrix ρ.matrix = 1 := by
108 rw [fidelity_self ρ.positive, ρ.trace_one]
109 rfl
110
111end Cloning.MatrixFidelity