module public import SubentropyCertificates.DiagonalDeterminant import all D5.S3.Quantum.Subentropy.EigenbasisBlocks import all SubentropyCertificates.MarginalEigenbasisTable /-! The joint density matrix in a product of marginal eigenbases. Keep the matrix itself and its shifted determinants at every parameter. -/ @[expose] public section noncomputable section set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Matrix open scoped BigOperators ComplexOrder MatrixOrder Kronecker namespace SubentropyCertificates.DeterminantComparison open D5.S3.Quantum.Foundation.FiniteStateChannel open D5.S3.Quantum.Information.PartialTraceMutualInformation open D5.S3.Quantum.Subentropy.Basic open D5.S3.Quantum.Subentropy.EigenbasisBlocks open SubentropyCertificates.QubitDeficit variable {D F : Type*} [Fintype D] [DecidableEq D] [Fintype F] [DecidableEq F] private theorem reciprocal_reindex (M : Matrix D D ℂ) (e : F ≃ D) (t : ℝ) : reciprocalDet t (M.submatrix e e) = reciprocalDet t M := by have h : 1 + t • M.submatrix e e = (1 + t • M).submatrix e e := by simp [Matrix.submatrix_add, Matrix.submatrix_smul, Matrix.submatrix_one_equiv] unfold reciprocalDet rw [h, Matrix.det_submatrix_equiv_self] private theorem reciprocal_local (M : Matrix (D × F) (D × F) ℂ) (U : Matrix D D ℂ) (hu : U * U.conjTranspose = 1) (t : ℝ) : reciprocalDet t (localConjugate U M) = reciprocalDet t M := by let J := U.conjTranspose ⊗ₖ (1 : Matrix F F ℂ) have hJ : J.conjTranspose * J = 1 := by simp only [J, Matrix.conjTranspose_kronecker, Matrix.conjTranspose_conjTranspose, Matrix.conjTranspose_one, ← Matrix.mul_kronecker_mul, Matrix.one_mul, hu, Matrix.one_kronecker_one] have hd := Matrix.det_one_add_mul_comm (t • (J*M)) J.conjTranspose simp only [Matrix.smul_mul, Matrix.mul_smul, ← Matrix.mul_assoc J.conjTranspose J M, hJ, Matrix.one_mul] at hd apply congrArg (fun z : ℂ => z.re⁻¹) simpa only [J, localConjugate, Matrix.conjTranspose_kronecker, Matrix.conjTranspose_conjTranspose, Matrix.conjTranspose_one] using hd /-- Both marginal matrices are diagonal in these coordinates. The same coordinate change preserves the reciprocal determinant for every t. -/ theorem marginal_eigenbasis_determinants (ρ : DensityState (D × F)) : let M := CStarMatrix.ofMatrix.symm ρ.1 let hA := (partialTraceRight_posSemidef (density_posSemidef ρ)).isHermitian let hB := (partialTraceLeft_posSemidef (density_posSemidef ρ)).isHermitian ∃ K : Matrix (D × F) (D × F) ℂ, K.PosSemidef ∧ K.trace = 1 ∧ partialTraceRight K = diagonal (fun i => (hA.eigenvalues i : ℂ)) ∧ partialTraceLeft K = diagonal (fun j => (hB.eigenvalues j : ℂ)) ∧ ∀ t, reciprocalDet t K = reciprocalDet t M := by let M := CStarMatrix.ofMatrix.symm ρ.1 have hM := density_posSemidef ρ let hA := (partialTraceRight_posSemidef hM).isHermitian let hB := (partialTraceLeft_posSemidef hM).isHermitian let U : Matrix D D ℂ := hA.eigenvectorUnitary let V : Matrix F F ℂ := hB.eigenvectorUnitary have hU : U * U.conjTranspose = 1 := Unitary.coe_mul_star_self hA.eigenvectorUnitary have hV : V * V.conjTranspose = 1 := Unitary.coe_mul_star_self hB.eigenvectorUnitary let e := Equiv.prodComm F D let N := M.submatrix e e let L := localConjugate V N let P := L.submatrix e.symm e.symm let K := localConjugate U P have hL := local_density V hV N (hM.submatrix e) have hK := local_density U hU P (hL.1.submatrix e.symm) have ht : K.trace = 1 := hK.2.trans ((reindex_trace L e.symm).trans (hL.2.trans ((reindex_trace M e).trans ρ.2.2))) have hright : partialTraceRight K = diagonal (fun i => (hA.eigenvalues i : ℂ)) := by rw [show partialTraceRight K = _ from local_right U P, show partialTraceRight P = partialTraceLeft L from rfl, local_left V hV N] exact eigenbasis_diagonal hA have hleft : partialTraceLeft K = diagonal (fun j => (hB.eigenvalues j : ℂ)) := by rw [show partialTraceLeft K = _ from local_left U hU P, show partialTraceLeft P = partialTraceRight L from rfl, local_right V N] exact eigenbasis_diagonal hB refine ⟨K,hK.1,ht,hright,hleft,fun t => ?_⟩ exact (reciprocal_local P U hU t).trans ((reciprocal_reindex L e.symm t).trans ((reciprocal_local N V hV t).trans (reciprocal_reindex M e t))) end SubentropyCertificates.DeterminantComparison