module public import SubentropyCertificates.CounterexampleState /-! The original qubit ensemble, its isometric encoding into BC, and its computational basis dephasing obtained by taking the partial trace. -/ @[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.PartialTraceMutualInformation variable {D : Type*} [Fintype D] [DecidableEq D] local notation "conjTwo" => (map_ofNat (starRingEnd ℂ) 2) def signalMatrix {I : Type*} (v : I → ℂ) : Matrix I I ℂ := (1/5 : ℝ) • vecMulVec v (star v) def normalizedSignal (v : D → ℂ) (ht : (signalMatrix v).trace = 1) : DensityState D := ⟨CStarMatrix.ofMatrix (signalMatrix v), map_nonneg CStarMatrix.ofMatrixStarAlgEquiv ((Matrix.posSemidef_vecMulVec_self_star v).smul (by norm_num : (0 : ℝ) ≤ 1/5)).nonneg, ht⟩ def inputSignal (a : Bit) : DensityState Bit := normalizedSignal (fun b => signals (b,b) a) (by fin_cases a <;> norm_num [signalMatrix, Matrix.trace, Fin.sum_univ_two, signals, Matrix.vecMulVec_apply, Complex.real_smul, conjTwo]) def encodedSignal (a : Bit) : DensityState (Bit × Bit) := normalizedSignal (fun u => signals u a) (by fin_cases a <;> norm_num [signalMatrix, Matrix.trace, Fintype.sum_prod_type, Fin.sum_univ_two, signals, Matrix.vecMulVec_apply, Complex.real_smul, conjTwo]) def outputSignal (a : Bit) := marginalRight (encodedSignal a) theorem encoded_entries (a b c j k : Bit) : (encodedSignal a).1 (b,c) (j,k) = if c=b ∧ k=j then (inputSignal a).1 b j else 0 := by change signalMatrix _ (b,c) (j,k) = if _ then signalMatrix _ b j else 0 by_cases h : c=b <;> by_cases g : k=j <;> simp_all [signalMatrix, signals, Matrix.vecMulVec_apply, eq_comm] /-- Tracing out C is precisely the unread computational basis measurement: the output has the same diagonal entries as the input and zero coherences. -/ theorem output_is_dephasing (a : Bit) : CStarMatrix.ofMatrix.symm (outputSignal a).1 = diagonal (fun i => (inputSignal a).1 i i) := by ext b j change (∑ c : Bit, (encodedSignal a).1 (b,c) (j,c)) = _ simp only [encoded_entries] by_cases h : b=j · subst j; simp · have hz (c : Bit) : ¬(c=b ∧ c=j) := fun hc => h (hc.1.symm.trans hc.2) simp [hz,h] /-- The output puts probability 4/5 on the coordinate equal to the label. -/ theorem output_weights (a : Bit) : CStarMatrix.ofMatrix.symm (outputSignal a).1 = diagonal (fun i => if i=a then (4/5 : ℂ) else 1/5) := by rw [output_is_dephasing] apply congrArg diagonal funext i change signalMatrix _ i i = _ by_cases h : i=a <;> norm_num [signalMatrix,signals,h,Matrix.vecMulVec_apply, Complex.real_smul,conjTwo] /-- The diagonal label blocks of the v19 joint state are the encoded signals weighted by the equal priors; off-label blocks vanish. -/ theorem state_encoded_blocks (a d : Bit) (u v : Bit × Bit) : state.1 ((a,u.1),u.2) ((d,v.1),v.2) = if a=d then (1/2 : ℂ)*(encodedSignal a).1 u v else 0 := by rw [state_entries] by_cases h : a=d · simp only [h,ite_true] change _ = (1/2 : ℂ)*signalMatrix _ u v simp [signalMatrix, Matrix.vecMulVec_apply, Complex.real_smul] ring · simp [h] end SubentropyCertificates.QuantumCounterexample