Pratik Patil

MixedQubitDistance.lean

1module23public import SubentropyCertificates.QubitTraceDistance45/-! Separation of the two CQ records, allowing distinct label distributions. -/6@[expose] public section7noncomputable section8set_option autoImplicit false9set_option backward.isDefEq.respectTransparency false10open Matrix11open scoped BigOperators MatrixOrder ComplexOrder Kronecker12namespace SubentropyCertificates.MixedQubit13open D5.S3.Quantum.Foundation.FiniteStateChannel14open D5.S3.Quantum.Information.PartialTraceMutualInformation15open D5.S3.Quantum.Information.OrthogonalRecordEntropy16open SubentropyCertificates.Discrimination17open SubentropyCertificates.BinarySpectra (densityMatrix)18variable {X : Type*} [Fintype X] [DecidableEq X]1920private def weights (p : X → ℝ) := diagonal (fun x => (p x:ℂ))2122private theorem weights_trace (p : X → ℝ) (hs : ∑ x,p x=1) : (weights p).trace=1 := by23  rw [weights,Matrix.trace_diagonal,← Complex.ofReal_sum,hs,Complex.ofReal_one]2425/-- Testing the signal register against the orthogonal complement of the26common pure signal separates the joint records by at least one half, even27when the comparison ensemble has a different prior. -/28theorem mixed_pure_record_lower (p q : X → ℝ) (hp : ∀ x,0 ≤ p x) (hs : ∑ x,p x=1)29    (hq : ∀ x,0 ≤ q x) (ht : ∑ x,q x=1) (v : Fin 2 → ℂ) (hv : ∑ i,star (v i)*v i=1) :30    1/2 ≤ traceDistance (recordState p hp hs (fun _ => mixed))31      (recordState q hq ht (fun _ => pureSignal v hv)) := by32  let A := recordState p hp hs (fun _ => mixed)33  let B := recordState q hq ht (fun _ => pureSignal v hv)34  let P := densityMatrix (pureSignal v hv)35  let C := 1-P36  let Iₓ := (1 : Matrix X X ℂ)37  let F := Iₓ ⊗ₖ C38  obtain ⟨_,hC,htrace,hCP⟩ := pure_projector_complement v hv39  have hF : F.PosSemidef := Matrix.PosSemidef.one.kronecker hC40  have hc : 1-F=Iₓ ⊗ₖ P := by41    apply sub_eq_of_eq_add42    rw [show F = Iₓ ⊗ₖ C from rfl,← Matrix.kronecker_add,show P+C=1 by dsimp [C]; abel]43    exact Matrix.one_kronecker_one.symm44  have hF' : (1-F).PosSemidef := hc ▸ Matrix.PosSemidef.one.kronecker (density_posSemidef (pureSignal v hv))45  have hA : (F*densityMatrix A).trace = (1/2:ℂ) := by46    rw [show densityMatrix A = weights p ⊗ₖ ((1/2:ℝ) • (1 : Matrix (Fin 2) (Fin 2) ℂ)) from47      constant_record_matrix p hp hs mixed]48    change (((1 : Matrix X X ℂ) ⊗ₖ C) * _).trace = _49    rw [← Matrix.mul_kronecker_mul,Matrix.one_mul,Matrix.mul_smul,Matrix.mul_one,50      Matrix.trace_kronecker,weights_trace p hs,one_mul,Matrix.trace_smul]51    change (1/2:ℝ) • (1-P).trace = _52    rw [htrace]; norm_num [Complex.real_smul]53  have hB : (F*densityMatrix B).trace=0 := by54    rw [show densityMatrix B = weights q ⊗ₖ P from constant_record_matrix q hq ht _]55    change (((1 : Matrix X X ℂ) ⊗ₖ (1-P)) * _).trace = _56    rw [← Matrix.mul_kronecker_mul,hCP,Matrix.kronecker_zero,Matrix.trace_zero]57  obtain ⟨E,_,_,hE,hmax⟩ := traceDistance_test A B58  have h := hmax F hF hF'59  rw [Matrix.mul_sub,Matrix.trace_sub,hA,hB,sub_zero,hE] at h60  change (1/2:ℝ) ≤ traceDistance A B61  convert h using 162  norm_num6364/-- With matching priors the complementary test achieves the trace distance.65The mixed record is the half-and-half mixture of the pure record and its66orthogonal complement, which supplies the opposite inequality. -/67theorem mixed_pure_record_exact (p : X → ℝ) (hp : ∀ x,0 ≤ p x) (hs : ∑ x,p x=1)68    (v : Fin 2 → ℂ) (hv : ∑ i,star (v i)*v i=1) :69    traceDistance (recordState p hp hs (fun _ => mixed)) (recordState p hp hs (fun _ => pureSignal v hv)) =70      1/2 := by71  refine le_antisymm ?_ (mixed_pure_record_lower p p hp hs hp hs v hv)72  let A := recordState p hp hs (fun _ => mixed)73  let B := recordState p hp hs (fun _ => pureSignal v hv)74  let P := densityMatrix (pureSignal v hv)75  let R := weights p ⊗ₖ (1-P)76  obtain ⟨_,hC,htrace,_⟩ := pure_projector_complement v hv77  have hw : (weights p).PosSemidef := Matrix.PosSemidef.diagonal (fun x => by78    simpa [Complex.le_def] using hp x)79  have hR : R.PosSemidef := hw.kronecker hC80  have htr : R.trace=1 := by81    change (weights p ⊗ₖ (1-P)).trace=182    rw [Matrix.trace_kronecker,weights_trace p hs,htrace,mul_one]83  have hmix : (2:ℝ) • densityMatrix A = R + densityMatrix B := by84    rw [show densityMatrix A = weights p ⊗ₖ ((1/2:ℝ) • (1 : Matrix (Fin 2) (Fin 2) ℂ)) from85      constant_record_matrix p hp hs mixed,show densityMatrix B = weights p ⊗ₖ P from constant_record_matrix p hp hs _]86    change _ = (weights p ⊗ₖ (1-P)) + (weights p ⊗ₖ P)87    rw [← Matrix.kronecker_add,sub_add_cancel,Matrix.kronecker_smul,smul_smul]88    norm_num89  obtain ⟨E,hE,hEC,he,_⟩ := traceDistance_test A B90  have h₁ : 0 ≤ (E*densityMatrix B).trace.re := RHLinalg.trace_mul_nonneg_of_posSemidef hE (density_posSemidef B)91  have h₂ : 0 ≤ ((1-E)*R).trace.re := RHLinalg.trace_mul_nonneg_of_posSemidef hEC hR92  rw [Matrix.sub_mul,Matrix.one_mul,Matrix.trace_sub,Complex.sub_re,htr,Complex.one_re] at h₂93  have ht := congrArg (fun M : Matrix (X × Fin 2) (X × Fin 2) ℂ => (E*M).trace.re) hmix94  simp only [Matrix.mul_smul,Matrix.trace_smul,Complex.smul_re,smul_eq_mul,Matrix.mul_add,95    Matrix.trace_add,Complex.add_re] at ht96  change traceDistance A B ≤ _97  rw [← he,Matrix.mul_sub,Matrix.trace_sub,Complex.sub_re]98  linarith99100end SubentropyCertificates.MixedQubit

Axioms used

Choose a statement to see which axioms its proof uses.