Offline · exact source
Exact Lean source

MatrixFidelityNormalization

formalization/Cloning/MatrixFidelityNormalization.lean

Source hash: dc09be5ad3a4b04b4c0a1a30932989e0fbcd4fa1b1e8f97c15db783e20a2c104

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.MatrixFidelityScaling
2 
3/-!
4# Canonical normalization of positive matrix blocks
5 
6The normalizing weight is the actual real trace of the block. A zero-trace
7positive block is zero, so reconstruction and fidelity factorization hold
8without a separate nonzero-block hypothesis or a nonempty index assumption.
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/-- A block normalized by its trace, with the zero block mapped to zero. -/
22def normalizedBlock (A : Matrix n n ℂ) : Matrix n n ℂ :=
23  ((Matrix.trace A).re)⁻¹ • A
24 
25omit [DecidableEq n] in
26/-- Positivity forces a block with zero real trace to be identically zero. -/
27theorem trace_re_eq_zero_iff {A : Matrix n n ℂ} (hA : A.PosSemidef) :
28    (Matrix.trace A).re = 0 ↔ A = 0 := by
29  constructor
30  · intro htrace
31    apply hA.trace_eq_zero_iff.mp
32    apply Complex.ext
33    · exact htrace
34    · exact trace_im_zero hA
35  · rintro rfl
36    simp
37 
38omit [DecidableEq n] in
39theorem normalizedBlock_posSemidef {A : Matrix n n ℂ} (hA : A.PosSemidef) :
40    (normalizedBlock A).PosSemidef :=
41  hA.smul (inv_nonneg.mpr (trace_re_nonneg hA))
42 
43omit [DecidableEq n] in
44theorem normalizedBlock_zero : normalizedBlock (0 : Matrix n n ℂ) = 0 := by
45  simp [normalizedBlock]
46 
47omit [DecidableEq n] in
48/-- Canonical normalization has real trace one whenever the original trace is positive. -/
49theorem normalizedBlock_trace_re {A : Matrix n n ℂ}
50    (htrace : 0 < (Matrix.trace A).re) :
51    (Matrix.trace (normalizedBlock A)).re = 1 := by
52  rw [normalizedBlock, Matrix.trace_smul, Complex.smul_re, smul_eq_mul]
53  exact inv_mul_cancel₀ htrace.ne'
54 
55omit [DecidableEq n] in
56/-- The full complex trace of a normalized positive nonzero block is one. -/
57theorem normalizedBlock_trace_one {A : Matrix n n ℂ} (hA : A.PosSemidef)
58    (htrace : 0 < (Matrix.trace A).re) :
59    Matrix.trace (normalizedBlock A) = 1 := by
60  apply Complex.ext
61  · exact normalizedBlock_trace_re htrace
62  · exact trace_im_zero (normalizedBlock_posSemidef hA)
63 
64omit [DecidableEq n] in
65/-- Reconstruction includes the zero-trace case, using positivity. -/
66theorem normalizedBlock_reconstruct {A : Matrix n n ℂ} (hA : A.PosSemidef) :
67    (Matrix.trace A).re • normalizedBlock A = A := by
68  by_cases ht : (Matrix.trace A).re = 0
69  · have hzero := (trace_re_eq_zero_iff hA).mp ht
70    rw [hzero]
71    simp [normalizedBlock]
72  · rw [normalizedBlock, smul_smul, mul_inv_cancel₀ ht, one_smul]
73 
74/-- Exact trace-weight factorization in the first fidelity argument. -/
75theorem fidelity_normalizedBlock_left {A : Matrix n n ℂ} (hA : A.PosSemidef)
76    (B : Matrix n n ℂ) :
77    fidelity A B = Real.sqrt (Matrix.trace A).re * fidelity (normalizedBlock A) B := by
78  calc
79    fidelity A B = fidelity ((Matrix.trace A).re • normalizedBlock A) B := by
80      rw [normalizedBlock_reconstruct hA]
81    _ = Real.sqrt (Matrix.trace A).re * fidelity (normalizedBlock A) B :=
82      fidelity_smul_left _ _ _ (trace_re_nonneg hA) (normalizedBlock_posSemidef hA)
83 
84/-- Exact trace-weight factorization in the second fidelity argument. -/
85theorem fidelity_normalizedBlock_right {A B : Matrix n n ℂ}
86    (hA : A.PosSemidef) (hB : B.PosSemidef) :
87    fidelity A B = Real.sqrt (Matrix.trace B).re * fidelity A (normalizedBlock B) := by
88  calc
89    fidelity A B = fidelity A ((Matrix.trace B).re • normalizedBlock B) := by
90      rw [normalizedBlock_reconstruct hB]
91    _ = Real.sqrt (Matrix.trace B).re * fidelity A (normalizedBlock B) :=
92      fidelity_smul_right _ _ _ (trace_re_nonneg hB) hA (normalizedBlock_posSemidef hB)
93 
94/-- Canonical block fidelity carries the Hellinger weight of its actual traces. -/
95theorem fidelity_normalizedBlocks {A B : Matrix n n ℂ}
96    (hA : A.PosSemidef) (hB : B.PosSemidef) :
97    fidelity A B = Real.sqrt (Matrix.trace A).re * Real.sqrt (Matrix.trace B).re *
98      fidelity (normalizedBlock A) (normalizedBlock B) := by
99  rw [fidelity_normalizedBlock_left hA B,
100    fidelity_normalizedBlock_right (normalizedBlock_posSemidef hA) hB]
101  ring
102 
103/-- The concrete maximally mixed state `I / dim`, for a nonempty finite index type. -/
104def maximallyMixed (n : Type*) [Fintype n] [DecidableEq n] [Nonempty n] : State n where
105  matrix := (Fintype.card n : ℝ)⁻¹ • (1 : Matrix n n ℂ)
106  positive := Matrix.PosSemidef.one.smul (inv_nonneg.mpr (Nat.cast_nonneg _))
107  trace_one := by
108    rw [Matrix.trace_smul, Matrix.trace_one]
109    apply Complex.ext
110    · simp
111    · simp
112 
113theorem maximallyMixed_matrix [Nonempty n] :
114    (maximallyMixed n).matrix = (Fintype.card n : ℝ)⁻¹ • (1 : Matrix n n ℂ) := rfl
115 
116/-- The spectator state is precisely the canonical normalization of the identity. -/
117theorem maximallyMixed_eq_normalized_one [Nonempty n] :
118    (maximallyMixed n).matrix = normalizedBlock (1 : Matrix n n ℂ) := by
119  simp [maximallyMixed, normalizedBlock, Matrix.trace_one]
120 
121end Cloning.MatrixFidelity