QuadraticStatistic.lean
1module23public import SubentropyCertificates.QuadraticGram4import all D5.S3.Quantum.Subentropy.ClassicalQuantumGram56/-! Identify the overlap statistic with the two state purities and with7the off-block squared norm of the ensemble Gram matrix. -/8@[expose] public section9noncomputable section10set_option backward.isDefEq.respectTransparency false11open Matrix12open scoped ComplexOrder MatrixOrder BigOperators13namespace SubentropyCertificates.Quadratic14open D5.S3.Quantum.Foundation.FiniteStateChannel15open D5.S3.Quantum.Information.OrthogonalRecordEntropy16open D5.S3.Quantum.Subentropy.ClassicalQuantumGram17variable {X B : Type*} [Fintype X] [DecidableEq X] [Fintype B] [DecidableEq B]1819def purity {D : Type*} [Fintype D] [DecidableEq D] (σ : DensityState D) : ℝ :=20 let R := CStarMatrix.ofMatrix.symm σ.121 (R*R).trace.re2223def statistic (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1) (ρ : X → DensityState B) :=24 (purity (mixtureState p hp hs ρ) - purity (recordState p hp hs ρ))/22526def weighted (p : X → ℝ) (ρ : X → DensityState B) (x : X) : Matrix B B ℂ :=27 p x • CStarMatrix.ofMatrix.symm (ρ x).12829def overlap (p : X → ℝ) (ρ : X → DensityState B) (x z : X) :=30 ((weighted p ρ x * weighted p ρ z).trace).re3132theorem statistic_eq_overlaps (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1)33 (ρ : X → DensityState B) :34 statistic p hp hs ρ = (∑ z ∈ distinctPairs X, overlap p ρ z.1 z.2)/2 := by35 have hmix : purity (mixtureState p hp hs ρ) = ∑ x, ∑ z, overlap p ρ x z := by36 change (((∑ x, weighted p ρ x) * ∑ x, weighted p ρ x).trace).re = _37 rw [Matrix.sum_mul]38 simp only [Matrix.mul_sum,Matrix.trace_sum,Complex.re_sum,overlap]39 let R := CStarMatrix.ofMatrix.symm (recordState p hp hs ρ).140 have hentry (x z : X) (b d : B) : R (x,b) (z,d) = if x=z then weighted p ρ x b d else 0 := by41 simpa only [weighted,Matrix.smul_apply,Complex.real_smul] using42 record_entries p hp hs ρ (x,b) (z,d)43 have hrec : purity (recordState p hp hs ρ) = ∑ x, overlap p ρ x x := by44 change (R*R).trace.re = _45 simp only [overlap,Matrix.trace,Matrix.diag_apply,Matrix.mul_apply,Fintype.sum_prod_type,46 hentry,Complex.re_sum]47 congr 148 funext x49 apply Finset.sum_congr rfl50 intro b _51 rw [Finset.sum_eq_single x]52 · simp53 · intro z _ hz54 simp [hz,Ne.symm hz]55 · simp56 rw [statistic,hmix,hrec,distinct_sum]5758theorem statistic_eq_gram (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1)59 (ρ : X → DensityState B) :60 statistic p hp hs ρ = offSquare ((cqRowSqrt p ρ).conjTranspose * cqRowSqrt p ρ)/2 := by61 rw [statistic_eq_overlaps]62 congr 163 apply Finset.sum_congr rfl64 intro xz _65 let U := weightedRoot p ρ xz.166 let V := weightedRoot p ρ xz.267 let W := U.conjTranspose * V68 have hU : U.conjTranspose = U := root_adjoint p ρ _69 have hV : V.conjTranspose = V := root_adjoint p ρ _70 have hUU : U*U = weighted p ρ xz.1 := root_square p hp ρ _71 have hVV : V*V = weighted p ρ xz.2 := root_square p hp ρ _72 have htrace : (W*W.conjTranspose).trace = (weighted p ρ xz.1 * weighted p ρ xz.2).trace := by73 simp only [W,Matrix.conjTranspose_mul,hU,hV]74 rw [show (U*V)*(V*U) = (U*(V*V))*U by simp only [Matrix.mul_assoc],75 Matrix.trace_mul_comm (U*(V*V)) U, ← Matrix.mul_assoc, hUU,hVV]76 change (weighted p ρ xz.1 * weighted p ρ xz.2).trace.re =77 ∑ k : B × B, Complex.normSq (W k.1 k.2)78 rw [← htrace]79 have hc (v : ℂ) : v * star v = (Complex.normSq v : ℂ) := Complex.mul_conj v80 simp only [Matrix.trace,Matrix.diag_apply,Matrix.mul_apply,Matrix.conjTranspose_apply,81 Complex.re_sum,hc,Complex.ofReal_re,Fintype.sum_prod_type]8283/-- With an ordering of the labels the statistic sums each distinct pair once. -/84theorem statistic_eq_unordered {L : Type*} [Fintype L] [LinearOrder L]85 (p : L → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1) (ρ : L → DensityState B) :86 statistic p hp hs ρ = ∑ x, ∑ z, if x<z then overlap p ρ x z else 0 := by87 rw [statistic_eq_overlaps]88 let f (x z : L) := if x<z then overlap p ρ x z else 089 have split (x z : L) : (if x≠z then overlap p ρ x z else 0) = f x z + f z x := by90 rcases lt_trichotomy x z with h|h|h91 · simp [f,h,h.ne,not_lt_of_ge h.le]92 · simp [f,h]93 · simp [f,h,h.ne',not_lt_of_ge h.le,overlap,Matrix.trace_mul_comm (weighted p ρ x) (weighted p ρ z)]94 simp only [distinctPairs,Finset.sum_filter,Fintype.sum_prod_type,split,Finset.sum_add_distrib]95 change ((∑ x, ∑ z, f x z) + (∑ x, ∑ z, f z x))/2 = ∑ x, ∑ z, f x z96 rw [Finset.sum_comm (f := fun x z => f z x)]97 ring9899end SubentropyCertificates.Quadratic
Axioms used
Choose a statement to see which axioms its proof uses.