module public import SubentropyCertificates.EqualPriorSubentropy public import SubentropyCertificates.QubitTraceDistance import all SubentropyCertificates.EqualPriorSubentropy /-! The two-qubit example immediately following Corollary 16. The first column is the unnormalized vector 2|00⟩+|11⟩, and the second is |10⟩. -/ @[expose] public section noncomputable section set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Matrix Set open scoped BigOperators ComplexOrder MatrixOrder namespace SubentropyCertificates.NonCQ open D5.S3.Quantum.Foundation.FiniteStateChannel open D5.S3.Quantum.Information.PartialTraceMutualInformation open D5.S3.Quantum.Information.InputInformationBalance open D5.S3.Quantum.Subentropy.Basic open SubentropyCertificates.BinarySpectra SubentropyCertificates.ClassicalCurve open SubentropyCertificates.MixedQubit (traceDistance) abbrev Bit := Fin 2 def columns : Matrix (Bit × Bit) Bit ℂ := fun i j ↦ if j=0 then (if i=(0,0) then 2 else if i=(1,1) then 1 else 0) else if i=(1,0) then 1 else 0 def pair (a b : ℝ) : Matrix Bit Bit ℂ := diagonal ![(a : ℂ),(b : ℂ)] def sandwich (a b : ℝ) : Matrix (Bit × Bit) (Bit × Bit) ℂ := columns * pair (a/5) b * (columns : Matrix _ _ ℂ).conjTranspose private theorem gram : (columns : Matrix _ _ ℂ).conjTranspose * columns = pair 5 1 := by ext i j fin_cases i <;> fin_cases j <;> norm_num [Matrix.mul_apply, Matrix.conjTranspose_apply, Fintype.sum_prod_type, Fin.sum_univ_two, columns, pair, Matrix.diagonal_apply, map_ofNat (starRingEnd ℂ) 2] private theorem gram_pair (a b : ℝ) : pair 5 1 * pair (a/5) b = pair a b := by unfold pair rw [diagonal_mul_diagonal] congr 1 ext i fin_cases i <;> simp ring theorem trace_sandwich (a b : ℝ) : (sandwich a b).trace = ((a+b : ℝ) : ℂ) := by rw [sandwich, Matrix.trace_mul_comm, ← Matrix.mul_assoc, gram, gram_pair] simp [pair, Matrix.trace, Fin.sum_univ_two] def state (t : ℝ) (ht : t ∈ Icc 0 1) : DensityState (Bit × Bit) := by refine ⟨CStarMatrix.ofMatrix (sandwich (1-t) t), ?_, ?_⟩ · apply map_nonneg CStarMatrix.ofMatrixStarAlgEquiv apply Matrix.PosSemidef.nonneg unfold sandwich apply Matrix.PosSemidef.mul_mul_conjTranspose_same apply Matrix.PosSemidef.diagonal intro i fin_cases i · change (0 : ℂ) ≤ (((1-t)/5 : ℝ) : ℂ) exact Complex.zero_le_real.mpr (by linarith [ht.2]) · change (0 : ℂ) ≤ (t:ℂ) exact Complex.zero_le_real.mpr ht.1 · change (sandwich (1-t) t).trace = 1 simp [trace_sandwich] /-- The genuine second marginal has eigenvalues (4+t)/5 and (1-t)/5. -/ theorem marginal_matrix (t : ℝ) (ht : t ∈ Icc 0 1) : densityMatrix (marginalLeft (state t ht)) = pair (1-(1-t)/5) ((1-t)/5) := by change partialTraceLeft (sandwich (1-t) t) = _ ext i j fin_cases i <;> fin_cases j <;> norm_num [partialTraceLeft, sandwich, pair, Fin.sum_univ_two, Matrix.mul_apply, Matrix.conjTranspose_apply, columns, Matrix.diagonal_apply, map_ofNat (starRingEnd ℂ) 2] ring private theorem spectrum_sandwich (a b : ℝ) : nonzeroSpectrum (sandwich a b) = nonzeroSpectrum (pair a b) := by rw [sandwich, nonzeroSpectrum_mul_comm, ← Matrix.mul_assoc, gram, gram_pair] /-- Both physical spectra, with multiplicities and all endpoint degeneracies. -/ theorem spectra (t : ℝ) (ht : t ∈ Icc 0 1) : nonzeroSpectrum (densityMatrix (state t ht)) = ({((1-t : ℝ):ℂ),(t:ℂ)} : Multiset ℂ).filter (· ≠ 0) ∧ nonzeroSpectrum (densityMatrix (marginalLeft (state t ht))) = ({((1-(1-t)/5 : ℝ):ℂ),(((1-t)/5 : ℝ):ℂ)} : Multiset ℂ).filter (· ≠ 0) := by exact ⟨(spectrum_sandwich _ _).trans (diagonal_pair_spectrum _ _), (congrArg nonzeroSpectrum (marginal_matrix _ _)).trans (diagonal_pair_spectrum _ _)⟩ private theorem difference (t : ℝ) : sandwich (1-0) 0 - sandwich (1-t) t = sandwich t (-t) := by unfold sandwich rw [← Matrix.sub_mul, ← Matrix.mul_sub] congr 2 ext i j fin_cases i <;> fin_cases j <;> norm_num [pair, Matrix.diagonal_apply] ring private theorem abs_filter (m : Multiset ℂ) : ((m.filter (· ≠ 0)).map (fun z ↦ |z.re|)).sum = (m.map (fun z ↦ |z.re|)).sum := by induction m using Multiset.induction with | empty => simp | cons a s ih => by_cases h : a=0 <;> simp [h,ih] /-- The trace distance of the two joint density matrices is exactly t. -/ theorem distance (t : ℝ) (ht : t ∈ Icc 0 1) : traceDistance (state 0 (by norm_num)) (state t ht) = t := by let h := (density_posSemidef (state 0 (by norm_num))).isHermitian.sub (density_posSemidef (state t ht)).isHermitian have hd : nonzeroSpectrum (densityMatrix (state 0 (by norm_num))-densityMatrix (state t ht)) = nonzeroSpectrum (pair t (-t)) := by change nonzeroSpectrum (sandwich (1-0) 0 - sandwich (1-t) t) = _ rw [difference, spectrum_sandwich] have he := congrArg (fun m : Multiset ℂ ↦ (m.map (fun z ↦ |z.re|)).sum) hd change (∑ i, |h.eigenvalues i|)/2 = t unfold nonzeroSpectrum at he simp only [abs_filter, h.roots_charpoly_eq_eigenvalues, Multiset.map_map, Finset.sum_map_val, Function.comp_apply, RCLike.ofReal_eq_complex_ofReal, Complex.ofReal_re] at he have hr (a b : ℝ) : (pair a b).charpoly.roots = {(a:ℂ),(b:ℂ)} := by rw [pair, Matrix.charpoly_diagonal, Fin.prod_univ_two] rw [Polynomial.roots_mul (mul_ne_zero (Polynomial.X_sub_C_ne_zero _) (Polynomial.X_sub_C_ne_zero _))] simp rw [he,hr] simp [abs_of_nonneg ht.1, Multiset.insert_eq_cons] def conditional (t : ℝ) (ht : t ∈ Icc 0 1) := subentropy (state t ht) - subentropy (marginalLeft (state t ht)) theorem conditional_value (t : ℝ) (ht : t ∈ Icc 0 1) : conditional t ht = phi 0 t - phi 0 ((1-t)/5) := by have h := subentropy_eq_of_nonzeroSpectrum (density_posSemidef (state t ht)).isHermitian (diagonal_hermitian (1-t) t) (spectrum_sandwich (1-t) t) change matrixSubentropy (densityMatrix (state t ht)) = _ at h change matrixSubentropy (densityMatrix (state t ht)) - matrixSubentropy (densityMatrix (marginalLeft (state t ht))) = _ rw [h,marginal_matrix,pair,pair_subentropy,pair_subentropy] def changeValue (t : ℝ) := phi 0 t + phi 0 (1/5) - phi 0 ((1-t)/5) /-- Equation for the increase of conditional subentropy along the joint state segment. -/ theorem conditional_change (t : ℝ) (ht : t ∈ Icc 0 1) : conditional t ht - conditional 0 (by norm_num) = changeValue t := by simp only [conditional_value, phi_zero, sub_zero] unfold changeValue ring end SubentropyCertificates.NonCQ