Offline · exact source
Exact Lean source

PCTPurityFidelity

formalization/Cloning/PCTPurityFidelity.lean

Source hash: 5cb9a9e63b6eadb5283b776bfc4adcbbc229c2936b6b41b0b3878cb5f31db772

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.MatrixFidelityEmbedding
2import Cloning.MatrixFidelityScaling
3import Mathlib.Analysis.Matrix.Spectrum
4 
5/-! A dimension-explicit purity bound for the actual finite matrix root
6fidelity against the maximally mixed state. -/
7noncomputable section
8open scoped BigOperators Matrix MatrixOrder ComplexOrder
9namespace Cloning.PCTPurity
10open Cloning.MatrixFidelity
11set_option backward.isDefEq.respectTransparency false
12set_option maxHeartbeats 800000
13 
14lemma sqrt_polynomial_lower (t : ℝ) (ht : 0≤t) : 3*t-t^2≤2*Real.sqrt t := by
15  have hs := Real.sqrt_nonneg t
16  have hp := mul_nonneg (mul_nonneg hs (sq_nonneg (Real.sqrt t-1)))
17    (by linarith : 0≤Real.sqrt t+2)
18  have he := Real.sq_sqrt ht
19  nlinarith [sq_nonneg (Real.sqrt t)]
20 
21variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι]
22 
23theorem classical_purity_bound (p : ι→ℝ) (hp : ∀i,0≤p i) (hs : ∑i,p i=1) :
24    1-(Cloning.BlockFidelity.classicalAffinity p (fun _ => (Fintype.card ι : ℝ)⁻¹))^2
25      ≤ (Fintype.card ι : ℝ)*(∑i,(p i)^2)-1 := by
26  let D : ℝ := Fintype.card ι
27  have hD : 0<D := by
28    change (0:ℝ)<(Fintype.card ι:ℝ)
29    exact_mod_cast (Fintype.card_pos : 0<Fintype.card ι)
30  let F := Cloning.BlockFidelity.classicalAffinity p (fun _ => D⁻¹)
31  have hpoint (i : ι) := sqrt_polynomial_lower (D*p i) (mul_nonneg hD.le (hp i))
32  have hsum := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hpoint i)
33  have hroot : ∑i,Real.sqrt (D*p i)=D*F := by
34    simp only [Real.sqrt_mul hD.le,←Finset.mul_sum,F,Cloning.BlockFidelity.classicalAffinity,
35      Real.sqrt_inv,←Finset.sum_mul]
36    have hsd : Real.sqrt D≠0 := (Real.sqrt_pos.2 hD).ne'
37    have hsq := Real.sq_sqrt hD.le
38    field_simp
39    rw [hsq]
40    ring
41  have he : (∑i,(3*(D*p i)-(D*p i)^2))=3*D-D^2*(∑i,(p i)^2) := by
42    simp_rw [mul_pow]
43    rw [Finset.sum_sub_distrib,←Finset.mul_sum,←Finset.mul_sum,←Finset.mul_sum,hs]
44    ring
45  rw [he,←Finset.mul_sum,hroot] at hsum
46  have hb : 3-D*(∑i,(p i)^2)≤2*F := by nlinarith
47  change 1-F^2≤D*(∑i,(p i)^2)-1
48  nlinarith [sq_nonneg (F-1)]
49 
50/-- The actual normalized identity matrix. -/
51def maximallyMixed : Matrix ι ι ℂ := (Fintype.card ι : ℝ)⁻¹ • (1 : Matrix ι ι ℂ)
52 
53theorem maximallyMixed_diagonal : maximallyMixed (ι := ι)=
54    Matrix.diagonal (fun _ => ((Fintype.card ι : ℝ)⁻¹ : ℂ)) := by
55  ext i j
56  simp [maximallyMixed,Matrix.one_apply,Matrix.diagonal_apply]
57 
58theorem fidelity_purity_bound (ρ : State ι) :
59    1-(fidelity ρ.matrix (maximallyMixed (ι := ι)))^2 ≤
60      (Fintype.card ι : ℝ)*(Matrix.trace (ρ.matrix*ρ.matrix)).re-1 := by
61  let p : ι→ℝ := ρ.positive.isHermitian.eigenvalues
62  let U : Matrix ι ι ℂ := ρ.positive.isHermitian.eigenvectorUnitary
63  let P : Matrix ι ι ℂ := Matrix.diagonal (fun i => (p i : ℂ))
64  have hp : ∀i,0≤p i := ρ.positive.eigenvalues_nonneg
65  have hs : ∑i,p i=1 := by
66    have h := congrArg Complex.re ρ.positive.isHermitian.trace_eq_sum_eigenvalues
67    rw [ρ.trace_one] at h
68    simpa only [Complex.one_re,Complex.re_sum,Complex.ofReal_re] using h.symm
69  have hU : Uᴴ*U=1 := Unitary.star_mul_self_of_mem ρ.positive.isHermitian.eigenvectorUnitary.property
70  have hU' : U*Uᴴ=1 := Unitary.mul_star_self_of_mem ρ.positive.isHermitian.eigenvectorUnitary.property
71  have hρ : ρ.matrix=U*P*Uᴴ := ρ.positive.isHermitian.spectral_theorem
72  have hP : P.PosSemidef := Matrix.PosSemidef.diagonal (fun i => Complex.nonneg_iff.mpr ⟨hp i,rfl⟩)
73  have hM : (maximallyMixed (ι := ι)).PosSemidef := Matrix.PosSemidef.one.smul (inv_nonneg.mpr (Nat.cast_nonneg _))
74  have hUM : U*maximallyMixed*Uᴴ=maximallyMixed (ι := ι) := by
75    simp only [maximallyMixed,mul_smul_comm,smul_mul_assoc,Matrix.mul_one,hU']
76  have hF : fidelity ρ.matrix maximallyMixed=Cloning.BlockFidelity.classicalAffinity p
77      (fun _ => (Fintype.card ι : ℝ)⁻¹) := by
78    rw [hρ,←hUM,fidelity_unitary_conjugation U hU hP hM,maximallyMixed_diagonal]
79    change fidelity (Matrix.diagonal (fun i => (p i : ℂ)))
80      (Matrix.diagonal (fun _ : ι => ((Fintype.card ι : ℝ)⁻¹ : ℂ))) = _
81    simpa only [Complex.ofReal_inv] using
82      fidelity_diagonal_real p (fun _ : ι => (Fintype.card ι : ℝ)⁻¹) hp
83        (fun _ => inv_nonneg.mpr (Nat.cast_nonneg (Fintype.card ι)))
84  have ht : (Matrix.trace (ρ.matrix*ρ.matrix)).re=∑i,(p i)^2 := by
85    have he : ρ.matrix*ρ.matrix=U*(P*P)*Uᴴ := by
86      rw [hρ]
87      simp only [Matrix.mul_assoc]
88      rw [←Matrix.mul_assoc Uᴴ,hU,Matrix.one_mul]
89    rw [he,Matrix.trace_mul_comm,←Matrix.mul_assoc,hU,Matrix.one_mul]
90    simp only [P,Matrix.diagonal_mul_diagonal,Matrix.trace_diagonal,Complex.re_sum,
91      ←Complex.ofReal_mul,Complex.ofReal_re,pow_two]
92  rw [hF,ht]
93  exact classical_purity_bound p hp hs
94 
95end Cloning.PCTPurity