Pratik Patil

QubitTraceDistance.lean

1module23public import SubentropyCertificates.BinarySignalColumns45/-! The trace distance on density states and a test on the quantum register6of a classical record. All trace pairings below act on the full CQ matrix. -/7@[expose] public section8noncomputable section9set_option autoImplicit false10set_option backward.isDefEq.respectTransparency false11open Matrix Set12open scoped BigOperators ComplexOrder MatrixOrder Kronecker13namespace SubentropyCertificates.MixedQubit14open D5.S3.Quantum.Foundation.FiniteStateChannel15open D5.S3.Quantum.Information.PartialTraceMutualInformation16open D5.S3.Quantum.Information.OrthogonalRecordEntropy17open SubentropyCertificates.BinarySpectra (densityMatrix)18open SubentropyCertificates.Discrimination19open SubentropyCertificates.Helstrom (spectral_test)20variable {D X : Type*} [Fintype D] [DecidableEq D] [Fintype X] [DecidableEq X]2122/-- The trace distance, half the sum of the absolute eigenvalues of the23Hermitian difference. -/24def traceDistance (ρ σ : DensityState D) : ℝ :=25  let H := (density_posSemidef ρ).isHermitian.sub (density_posSemidef σ).isHermitian26  (∑ i, |H.eigenvalues i|)/22728/-- The trace distance is the largest probability difference over all effects. -/29theorem traceDistance_test (ρ σ : DensityState D) :30    let H := densityMatrix ρ - densityMatrix σ31    ∃ E : Matrix D D ℂ, E.PosSemidef ∧ (1-E).PosSemidef ∧32      (E*H).trace.re = traceDistance ρ σ ∧33      ∀ F : Matrix D D ℂ, F.PosSemidef → (1-F).PosSemidef →34        (F*H).trace.re ≤ (E*H).trace.re := by35  let H := densityMatrix ρ - densityMatrix σ36  have htr : H.trace.re = 0 := by37    change ((densityMatrix ρ - densityMatrix σ).trace).re = 038    rw [Matrix.trace_sub,show (densityMatrix ρ).trace=1 from ρ.2.2,39      show (densityMatrix σ).trace=1 from σ.2.2,sub_self,Complex.zero_re]40  obtain ⟨E,hE,hC,_,hval,hmax⟩ := spectral_test41    ((density_posSemidef ρ).isHermitian.sub (density_posSemidef σ).isHermitian)42  refine ⟨E,hE,hC,?_,hmax⟩43  change 2*(E*H).trace.re-H.trace.re = _ at hval44  unfold traceDistance45  linarith4647/-- The CQ density of a constant signal factors into its classical label48distribution and the signal density. -/49theorem constant_record_matrix (p : X → ℝ) (hp : ∀ x,0 ≤ p x) (hs : ∑ x,p x=1)50    (σ : DensityState D) :51    densityMatrix (recordState p hp hs (fun _ => σ)) =52      diagonal (fun x => (p x:ℂ)) ⊗ₖ densityMatrix σ := by53  ext ⟨x,i⟩ ⟨y,j⟩54  change (∑ z,p z • ((diagonal (fun k => if k=z then (1:ℂ) else 0)) ⊗ₖ55    densityMatrix σ)) (x,i) (y,j) = _56  by_cases h : x=y57  · subst y58    simp [Matrix.sum_apply,Matrix.smul_apply,Complex.real_smul,Matrix.kroneckerMap_apply,59      eq_comm]60  · simp [Matrix.sum_apply,Matrix.smul_apply,Matrix.kroneckerMap_apply,h]6162/-- The maximally mixed qubit. -/63def mixed : DensityState (Fin 2) := by64  let A := (1/2 : ℝ) • (1 : Matrix (Fin 2) (Fin 2) ℂ)65  refine ⟨CStarMatrix.ofMatrix A,map_nonneg CStarMatrix.ofMatrixStarAlgEquiv66    ((Matrix.PosSemidef.one.smul (by norm_num : (0:ℝ) ≤ 1/2)).nonneg),?_⟩67  change A.trace = 168  norm_num [A,Matrix.trace_smul,Complex.real_smul]6970theorem pure_projector_complement (v : Fin 2 → ℂ) (hv : ∑ i,star (v i)*v i=1) :71    let P := densityMatrix (pureSignal v hv)72    P*P=P ∧ (1-P).PosSemidef ∧ (1-P).trace=1 ∧ (1-P)*P=0 := by73  let P := densityMatrix (pureSignal v hv)74  have hid : P*P=P := by75    change vecMulVec v (star v)*vecMulVec v (star v) = _76    rw [Matrix.vecMulVec_mul_vecMulVec,show (star v ⬝ᵥ v)=1 from hv,one_smul]; rfl77  have hker : (1-P)*P=0 := by rw [Matrix.sub_mul,Matrix.one_mul,hid,sub_self]78  have hsame : (1-P).conjTranspose*(1-P)=1-P := by79    rw [(Matrix.isHermitian_one.sub (density_posSemidef (pureSignal v hv)).isHermitian).eq,80      Matrix.mul_sub,Matrix.mul_one,hker,sub_zero]81  refine ⟨hid,hsame ▸ Matrix.posSemidef_conjTranspose_mul_self (1-P),?_,hker⟩82  rw [Matrix.trace_sub,show P.trace=1 from (pureSignal v hv).2.2]83  norm_num8485theorem mixed_ne_pure (v : Fin 2 → ℂ) (hv : ∑ i,star (v i)*v i=1) : mixed ≠ pureSignal v hv := by86  intro he87  have h := (pure_projector_complement v hv).188  rw [← he] at h89  change ((1/2:ℝ) • (1 : Matrix (Fin 2) (Fin 2) ℂ))*((1/2:ℝ) • 1) = (1/2:ℝ) • 1 at h90  have entry := congrArg (fun M : Matrix (Fin 2) (Fin 2) ℂ => (M 0 0).re) h91  norm_num [Matrix.smul_mul,Matrix.mul_smul,Matrix.smul_apply,Complex.real_smul] at entry9293end SubentropyCertificates.MixedQubit

Axioms used

Choose a statement to see which axioms its proof uses.