MeasurementPosterior.lean
1module23public import SubentropyCertificates.PinchingUpper45/-!6# Comparison with measurement posteriors78The outcome type is independent of the signal-label type. Zero-probability9outcomes are excluded from posterior averages explicitly. The supporting10pinching lemmas retain their upstream attribution; the comparison is proved11here using normalized positive Gram pieces.12-/1314@[expose] public section15noncomputable section16set_option autoImplicit false17set_option backward.isDefEq.respectTransparency false18open Matrix19open scoped BigOperators ComplexOrder MatrixOrder CStarAlgebra2021namespace SubentropyCertificates.MeasurementPosterior2223open D5.S3.Quantum.Foundation.FiniteStateChannel24open D5.S3.Quantum.Information.PartialTraceMutualInformation25open D5.S3.Quantum.Subentropy.Basic26open D5.S3.Quantum.Subentropy.ClassicalQuantumGram27open D5.S3.Quantum.Subentropy.PinchingGap2829variable {X B Y : Type*} [Fintype X]30 [Fintype B] [Fintype Y]3132def mass (G : Matrix (X × B) (X × B) ℂ) : ℝ := G.trace.re3334def labelMass (G : Matrix (X × B) (X × B) ℂ) (x : X) : ℝ :=35 (∑ b, G (x,b) (x,b)).re3637def labelPosterior (G : Matrix (X × B) (X × B) ℂ) (x : X) : ℝ :=38 labelMass G x / mass G3940theorem psd_trace_eq_real_mass (G : Matrix (X × B) (X × B) ℂ)41 (hG : G.PosSemidef) : G.trace = (mass G : ℂ) := by42 apply Complex.ext43 · rfl44 · exact (RCLike.nonneg_iff.mp hG.trace_nonneg).24546theorem mass_nonneg (G : Matrix (X × B) (X × B) ℂ) (hG : G.PosSemidef) :47 0 ≤ mass G := (RCLike.nonneg_iff.mp hG.trace_nonneg).14849theorem psd_eq_zero_of_mass_zero (G : Matrix (X × B) (X × B) ℂ)50 (hG : G.PosSemidef) (hz : mass G = 0) : G = 0 := by51 apply hG.trace_eq_zero_iff.mp52 rw [psd_trace_eq_real_mass G hG, hz]53 rfl5455omit [Fintype X] in56theorem labelMass_nonneg (G : Matrix (X × B) (X × B) ℂ)57 (hG : G.PosSemidef) (x : X) : 0 ≤ labelMass G x := by58 unfold labelMass59 rw [Complex.re_sum]60 exact Finset.sum_nonneg fun b _ => (RCLike.nonneg_iff.mp (hG.diag_nonneg (i := (x,b)))).16162theorem sum_labelMass (G : Matrix (X × B) (X × B) ℂ) :63 ∑ x, labelMass G x = mass G := by64 simp only [labelMass, mass, Matrix.trace, Matrix.diag_apply,65 Fintype.sum_prod_type, Complex.re_sum]6667theorem labelPosterior_probability (G : Matrix (X × B) (X × B) ℂ)68 (hG : G.PosSemidef) (hpos : 0 < mass G) :69 (∀ x, 0 ≤ labelPosterior G x) ∧ ∑ x, labelPosterior G x = 1 := by70 refine ⟨fun x => div_nonneg (labelMass_nonneg G hG x) hpos.le, ?_⟩71 simp only [labelPosterior, ← Finset.sum_div, sum_labelMass, div_self (ne_of_gt hpos)]7273omit [Fintype X] in74theorem labelMass_smul (a : ℝ) (G : Matrix (X × B) (X × B) ℂ) (x : X) :75 labelMass (a • G) x = a * labelMass G x := by76 unfold labelMass77 simp only [Matrix.smul_apply, Complex.re_sum]78 simp only [Complex.smul_re, smul_eq_mul, Finset.mul_sum]7980variable [DecidableEq X] [DecidableEq B]8182/-- A finite positive Gram decomposition gives an average of classical posteriors. -/83theorem pinching_gap_le_outcome_average84 (G : Y → Matrix (X × B) (X × B) ℂ) (hG : ∀ y, (G y).PosSemidef)85 (htr : (∑ y, G y).trace = 1) (x₀ : X) (i₀ : X × B) :86 matrixSubentropy (blockPinch (∑ y, G y)) - matrixSubentropy (∑ y, G y) ≤87 ∑ y ∈ Finset.univ.filter (fun y => 0 < mass (G y)),88 mass (G y) * matrixSubentropy (diagonal (fun x => (labelPosterior (G y) x : ℂ))) := by89 let T := ∑ y, G y90 have hT : T.PosSemidef := by91 exact Matrix.posSemidef_sum Finset.univ (fun y _ => hG y)92 let r : Y → ℝ := fun y => mass (G y)93 have hr (y : Y) : 0 ≤ r y := mass_nonneg (G y) (hG y)94 have hrs : ∑ y, r y = 1 := by95 simp only [r, mass, ← Complex.re_sum, ← Matrix.trace_sum, htr, Complex.one_re]96 let H : Y → Matrix (X × B) (X × B) ℂ := fun y =>97 if r y = 0 then T else (r y)⁻¹ • G y98 have hH (y : Y) : (H y).PosSemidef ∧ (H y).trace = 1 := by99 by_cases hz : r y = 0100 · simpa only [H, ite_eq_left hz] using And.intro hT htr101 · simp only [H, ite_eq_right hz]102 refine ⟨(hG y).smul (inv_nonneg.mpr (hr y)), ?_⟩103 rw [Matrix.trace_smul, psd_trace_eq_real_mass (G y) (hG y)]104 change (r y)⁻¹ • (r y : ℂ) = 1105 simp [hz]106 have hpiece (y : Y) : r y • H y = G y := by107 by_cases hz : r y = 0108 · have hzero := psd_eq_zero_of_mass_zero (G y) (hG y) hz109 simp only [hz, zero_smul, hzero]110 · simp only [H, ite_eq_right hz, smul_smul, mul_inv_cancel₀ hz, one_smul]111 have htotal : (∑ y, r y • H y) = T := by112 exact Finset.sum_congr rfl (fun y _ => hpiece y)113 have hj := (actual_pinching_gap_laws i₀).1.map_sum_le114 (t := Finset.univ) (w := r) (p := H) (fun y _ => hr y) hrs (fun y _ => hH y)115 change matrixSubentropy (blockPinch (∑ y, r y • H y)) -116 matrixSubentropy (∑ y, r y • H y) ≤117 ∑ y, r y * (matrixSubentropy (blockPinch (H y)) - matrixSubentropy (H y)) at hj118 rw [htotal] at hj119 have hupper (y : Y) : r y * (matrixSubentropy (blockPinch (H y)) -120 matrixSubentropy (H y)) ≤ r y * matrixSubentropy121 (diagonal (fun x => (labelPosterior (G y) x : ℂ))) := by122 by_cases hz : r y = 0123 · simp only [hz, zero_mul, le_refl]124 · have hlabels (x : X) : labelMass (H y) x = labelPosterior (G y) x := by125 rw [show H y = (r y)⁻¹ • G y from ite_eq_right hz, labelMass_smul]126 simp only [labelPosterior, r, div_eq_mul_inv]127 ring128 have hu := pinching_gap_le_label_subentropy (H y) (hH y).1 (hH y).2 x₀ i₀129 change _ ≤ matrixSubentropy (diagonal (fun x => (labelMass (H y) x : ℂ))) at hu130 simp_rw [hlabels] at hu131 exact mul_le_mul_of_nonneg_left hu (hr y)132 have hfilter : (∑ y, r y * matrixSubentropy133 (diagonal (fun x => (labelPosterior (G y) x : ℂ)))) =134 ∑ y ∈ Finset.univ.filter (fun y => 0 < mass (G y)),135 mass (G y) * matrixSubentropy (diagonal (fun x => (labelPosterior (G y) x : ℂ))) := by136 rw [Finset.sum_filter]137 apply Finset.sum_congr rfl138 intro y _139 by_cases hpos : 0 < r y140 · simp only [r] at hpos ⊢141 simp only [hpos, ite_true]142 · have hz : r y = 0 := by linarith [hr y]143 simp only [show ¬ 0 < mass (G y) from hpos, ite_false, hz, zero_mul]144 calc145 _ ≤ ∑ y, r y * (matrixSubentropy (blockPinch (H y)) - matrixSubentropy (H y)) := hj146 _ ≤ ∑ y, r y * matrixSubentropy147 (diagonal (fun x => (labelPosterior (G y) x : ℂ))) :=148 Finset.sum_le_sum (fun y _ => hupper y)149 _ = _ := hfilter150151end SubentropyCertificates.MeasurementPosterior
Axioms used
Choose a statement to see which axioms its proof uses.