module public import SubentropyCertificates.BinaryBasisGuessing public import SubentropyCertificates.DephasingEnsemble public import SubentropyCertificates.QuantumSSACounterexample public import D5.S3.Quantum.Subentropy.ClassicalQuantumGram import all D5.S3.Quantum.Subentropy.ClassicalQuantumGram /-! Identify the conditional subentropies of the input and unread measurement output with the v19 joint state and its marginals. -/ @[expose] public section noncomputable section set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Matrix open scoped ComplexOrder MatrixOrder BigOperators namespace SubentropyCertificates.QuantumCounterexample open D5.S3.Quantum.Foundation.FiniteStateChannel open D5.S3.Quantum.Information.OrthogonalRecordEntropy open D5.S3.Quantum.Subentropy.Basic open D5.S3.Quantum.Subentropy.ClassicalQuantumGram theorem fair_nonneg (a : Bit) : 0 ≤ fair a := by norm_num [fair] theorem fair_sum : ∑ a, fair a = 1 := by norm_num [fair,Fin.sum_univ_two] variable {D : Type*} [Fintype D] [DecidableEq D] private def copyMap (f : D → Bit) : Matrix (D × Bit) D ℂ := fun u j => if u=(j,f j) then 1 else 0 private theorem copy_isometry (f : D → Bit) : (copyMap f).conjTranspose * copyMap f = 1 := by ext i j by_cases h : i=j · subst j; simp [Matrix.mul_apply, Matrix.conjTranspose_apply, copyMap] · simp [Matrix.mul_apply, Matrix.conjTranspose_apply, copyMap, h, Ne.symm h] private theorem copy_entries (f : D → Bit) (R : Matrix D D ℂ) (i j : D) (c k : Bit) : (copyMap f * R * (copyMap f).conjTranspose) (i,c) (j,k) = if c=f i ∧ k=f j then R i j else 0 := by have row (l : D) : (copyMap f * R) (i,c) l = if c=f i then R i l else 0 := by simp [Matrix.mul_apply,copyMap,Prod.mk.injEq,ite_and,ite_mul] have col (l : D) : (copyMap f).conjTranspose l (j,k) = if l=j then (if k=f j then 1 else 0) else 0 := by by_cases hl : l=j · subst l; by_cases hk : k=f j <;> simp [Matrix.conjTranspose_apply,copyMap,hk] · simp [Matrix.conjTranspose_apply,copyMap,hl,Ne.symm hl] rw [Matrix.mul_apply] simp only [row,col] by_cases h : c=f i <;> by_cases g : k=f j <;> simp [h,g,mul_ite] private abbrev recMat (ρ : Bit → DensityState D) : Matrix (Bit × D) (Bit × D) ℂ := mat (recordState fair fair_nonneg fair_sum ρ) private abbrev avgMat (ρ : Bit → DensityState D) : Matrix D D ℂ := mat (mixtureState fair fair_nonneg fair_sum ρ) private theorem avg_entries (ρ : Bit → DensityState D) (u v : D) : avgMat ρ u v = ∑ a, (1/2 : ℂ)*(ρ a).1 u v := by change (∑ a, fair a • mat (ρ a)) u v = _ simp [fair,Matrix.sum_apply,Complex.real_smul] private theorem input_record : mat state = copyMap (@Prod.snd Bit Bit) * recMat inputSignal * (copyMap (@Prod.snd Bit Bit)).conjTranspose := by ext ⟨⟨a,b⟩,c⟩ ⟨⟨d,j⟩,k⟩ change state.1 ((a,b),c) ((d,j),k) = _ rw [state_encoded_blocks a d (b,c) (j,k), encoded_entries, copy_entries] rw [show recMat inputSignal (a,b) (d,j) = _ from record_entries fair fair_nonneg fair_sum inputSignal (a,b) (d,j)] by_cases h : a=d <;> by_cases g : c=b ∧ k=j <;> simp [h,g,fair] private theorem input_average : mat stateBC = copyMap id * avgMat inputSignal * (copyMap id).conjTranspose := by ext ⟨b,c⟩ ⟨j,k⟩ change (∑ a : Bit, state.1 ((a,b),c) ((a,j),k)) = _ rw [copy_entries, avg_entries] have hblock (a : Bit) := state_encoded_blocks a a (b,c) (j,k) simp only [ite_true,encoded_entries] at hblock simp only [hblock,id_eq] by_cases h : c=b ∧ k=j <;> simp [h] private theorem output_record : recMat outputSignal = mat stateAB := by rw [show mat stateAB = _ from marginal_matrices.1] ext ⟨a,b⟩ ⟨d,j⟩ rw [show recMat outputSignal (a,b) (d,j) = _ from record_entries fair fair_nonneg fair_sum outputSignal (a,b) (d,j)] simp only [output_weights] fin_cases a <;> fin_cases b <;> fin_cases d <;> fin_cases j <;> norm_num [fair,abWeight,Matrix.diagonal_apply] private theorem output_average : avgMat outputSignal = mat stateB := by rw [show mat stateB = _ from marginal_matrices.2.1] ext b j rw [avg_entries, Fin.sum_univ_two] change (1/2:ℂ)*mat (outputSignal 0) b j + (1/2:ℂ)*mat (outputSignal 1) b j = _ rw [show mat (outputSignal 0) = _ from output_weights 0, show mat (outputSignal 1) = _ from output_weights 1] fin_cases b <;> fin_cases j <;> norm_num [Matrix.diagonal_apply] /-- The conditional subentropies on the very ensembles used for guessing have the same difference as the three-qubit SSA deficit. -/ theorem conditional_difference_eq_deficit : conditionalSubentropy fair fair_nonneg fair_sum outputSignal - conditionalSubentropy fair fair_nonneg fair_sum inputSignal = deficit := by have hrecord : matrixSubentropy (mat state) = matrixSubentropy (recMat inputSignal) := by rw [input_record, matrixSubentropy_isometric_embedding _ _ (copy_isometry _)] have havg : matrixSubentropy (mat stateBC) = matrixSubentropy (avgMat inputSignal) := by rw [input_average, matrixSubentropy_isometric_embedding _ _ (copy_isometry _)] change matrixSubentropy (recMat outputSignal) - matrixSubentropy (avgMat outputSignal) - (matrixSubentropy (recMat inputSignal) - matrixSubentropy (avgMat inputSignal)) = _ rw [output_record,output_average,← hrecord,← havg] unfold deficit subentropy ring end SubentropyCertificates.QuantumCounterexample