PosteriorRefinement.lean
1module2public import SubentropyCertificates.QuantumEquality3public import SubentropyCertificates.PinchingGeometry4public import SubentropyCertificates.PinchingIntegral56/-! The spectral construction in the retained PinchingUpper module, originating7in the Omega Institute's pinching_upper (see provenance.json and LICENSE.upstream),8is exposed here with its eigenvectors and intermediate classical Jensen bound. -/9@[expose] public section10noncomputable section11set_option backward.isDefEq.respectTransparency false12open Matrix13open scoped BigOperators ComplexOrder MatrixOrder CStarAlgebra14namespace SubentropyCertificates.PinchingEquality15open D5.S3.Quantum.Foundation.FiniteStateChannel16open D5.S3.Quantum.Information.PartialTraceMutualInformation17open D5.S3.Quantum.Subentropy.Basic18open D5.S3.Quantum.Subentropy.DensityKernel19open D5.S3.Quantum.Subentropy.ClassicalQuantumGram20open D5.S3.Quantum.Subentropy.PinchingGap21open SubentropyCertificates.MeasurementPosterior22open SubentropyCertificates.ClassicalCurve23variable {X B : Type*} [Fintype X] [DecidableEq X] [Fintype B] [DecidableEq B]2425theorem spectral_refinement (G : Matrix (X × B) (X × B) ℂ) (hG : G.PosSemidef)26 (htr : G.trace = 1) (x₀ : X) :27 ∃ (w : X × B → ℝ), (∀ i, 0 ≤ w i) ∧ (∑ i, w i = 1) ∧28 ∃ v : X × B → X × B → ℂ, (∀ i, amplitude (v i) (v i) = 1) ∧29 G = ∑ i, w i • projector (v i) ∧30 (∑ i, w i * gain (projector (v i))) ≤ classicalSubentropy (labelMass G) := by31 let w := hG.isHermitian.eigenvalues32 let v : (X × B) → (X × B) → ℂ := fun j => ⇑(hG.isHermitian.eigenvectorBasis j)33 let R := fun j => Matrix.vecMulVec (v j) (star (v j))34 let r : (X × B) → X → ℝ := fun j x => ∑ b, Complex.normSq (v j (x,b))35 have hw := spectral_prob hG htr36 have hv (j : X × B) : ∑ i, star (v j i) * v j i = 1 := by37 change star (⇑(hG.isHermitian.eigenvectorBasis j)) ⬝ᵥ38 ⇑(hG.isHermitian.eigenvectorBasis j) = 139 rw [dotProduct_comm, ← EuclideanSpace.inner_eq_star_dotProduct,40 inner_self_eq_norm_sq_to_K, hG.isHermitian.eigenvectorBasis.orthonormal.1 j]41 norm_num42 have hdecomp : G = ∑ j, w j • R j := by43 ext a b44 conv_lhs => rw [hG.isHermitian.spectral_theorem,45 Unitary.conjStarAlgAut_apply, Matrix.mul_apply]46 simp only [Matrix.mul_diagonal, Matrix.star_eq_conjTranspose, Matrix.conjTranspose_apply,47 Matrix.IsHermitian.eigenvectorUnitary_apply, Function.comp_apply,48 RCLike.ofReal_eq_complex_ofReal, Matrix.sum_apply, Matrix.smul_apply,49 Matrix.vecMulVec_apply, Pi.star_apply, Complex.real_smul, w, v, R]50 apply Finset.sum_congr rfl51 intro j _52 ring53 have hr (j : X × B) : (∀ x, 0 ≤ r j x) ∧ ∑ x, r j x = 1 := by54 refine ⟨fun x => Finset.sum_nonneg fun b _ => Complex.normSq_nonneg _, ?_⟩55 have hC : ((∑ x, r j x : ℝ) : ℂ) = 1 := by56 simpa only [r, Complex.ofReal_sum, Fintype.sum_prod_type,57 Complex.normSq_eq_conj_mul_self, starRingEnd_apply] using hv j58 exact_mod_cast hC59 have hD (j : X × B) :60 (diagonal (fun x => (r j x : ℂ))).PosSemidef ∧61 (diagonal (fun x => (r j x : ℂ))).trace = 1 := by62 refine ⟨Matrix.PosSemidef.diagonal (fun x => by63 simpa [Complex.le_def] using (hr j).1 x), ?_⟩64 rw [Matrix.trace_diagonal, ← Complex.ofReal_sum, (hr j).2, Complex.ofReal_one]65 have hmass (x : X) : (∑ j, w j * r j x) = (∑ b, G (x,b) (x,b)).re := by66 rw [hdecomp]67 simp only [Matrix.sum_apply, Matrix.smul_apply, Complex.real_smul,68 R, Matrix.vecMulVec_apply, Pi.star_apply, Complex.star_def, Complex.mul_conj, Complex.mul_re,69 Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, Complex.re_sum, r]70 rw [Finset.sum_comm]71 simp only [Finset.mul_sum]72 have hDsum : (∑ j, w j • diagonal (fun x => (r j x : ℂ))) =73 diagonal (fun x => (((∑ b, G (x,b) (x,b)).re : ℝ) : ℂ)) := by74 ext x y75 by_cases hxy : x = y76 · subst y77 simp only [Matrix.sum_apply, Matrix.smul_apply, Matrix.diagonal_apply_eq,78 Complex.real_smul, ← Complex.ofReal_mul, ← Complex.ofReal_sum, hmass]79 · simp [Matrix.sum_apply, Matrix.smul_apply, Matrix.diagonal_apply_ne _ hxy]80 have hd := ConcaveOn.le_map_sum (matrix_subentropy_concave x₀)81 (t := Finset.univ) (w := w) (p := fun j => diagonal (fun x => (r j x : ℂ)))82 (fun j _ => hw.1 j) hw.2 (fun j _ => hD j)83 rw [hDsum] at hd84 refine ⟨w, hw.1, hw.2, v, hv, hdecomp, ?_⟩85 calc86 _ = ∑ j, w j * matrixSubentropy (diagonal (fun x => (r j x : ℂ))) := by87 apply Finset.sum_congr rfl88 intro j _89 exact congrArg (w j * ·) (pure_block_pinching (v j) (hv j)).190 _ ≤ _ := hd919293theorem refinement_of_gram_pieces {Y : Type*} [Fintype Y]94 (G : Y → Matrix (X × B) (X × B) ℂ) (hG : ∀ y, (G y).PosSemidef)95 (htr : (∑ y, G y).trace = 1) (x₀ : X) :96 ∃ w : Y × (X × B) → ℝ, (∀ k, 0 ≤ w k) ∧ (∑ k, w k = 1) ∧97 ∃ v : Y × (X × B) → X × B → ℂ, (∀ k, amplitude (v k) (v k) = 1) ∧98 (∑ y, G y) = ∑ k, w k • projector (v k) ∧99 (∑ k, w k * gain (projector (v k))) ≤100 ∑ y ∈ Finset.univ.filter (fun y => 0 < mass (G y)),101 mass (G y) * classicalSubentropy (labelPosterior (G y)) := by102 classical103 let T := ∑ y, G y104 let q y := mass (G y)105 have hq y : 0 ≤ q y := mass_nonneg _ (hG y)106 have hs : ∑ y, q y = 1 := by107 simp only [q, mass, ← Complex.re_sum, ← Matrix.trace_sum, htr, Complex.one_re]108 let H y := if q y = 0 then T else (q y)⁻¹ • G y109 have hH y : (H y).PosSemidef ∧ (H y).trace = 1 := by110 by_cases hz : q y = 0111 · simp only [H, hz, ite_true]112 exact ⟨Matrix.posSemidef_sum _ (fun i _ => hG i), htr⟩113 · simp only [H, ite_eq_right hz]114 refine ⟨(hG y).smul (inv_nonneg.mpr (hq y)), ?_⟩115 rw [Matrix.trace_smul, psd_trace_eq_real_mass _ (hG y)]116 change (q y)⁻¹ • (q y : ℂ) = 1117 simp [hz]118 have hpiece y : q y • H y = G y := by119 by_cases hz : q y = 0120 · rw [hz, zero_smul, psd_eq_zero_of_mass_zero _ (hG y) hz]121 · simp only [H, ite_eq_right hz, smul_smul, mul_inv_cancel₀ hz, one_smul]122 have spec y := spectral_refinement (H y) (hH y).1 (hH y).2 x₀123 let w y := (spec y).choose124 have ws y := (spec y).choose_spec125 let v y := (ws y).2.2.choose126 have vs y := (ws y).2.2.choose_spec127 refine ⟨fun k => q k.1 * w k.1 k.2, fun k => mul_nonneg (hq _) ((ws _).1 _), ?_,128 fun k => v k.1 k.2, fun k => (vs _).1 _, ?_, ?_⟩129 · rw [Fintype.sum_prod_type]130 simpa only [← Finset.mul_sum, w, fun y => (ws y).2.1, mul_one] using hs131 · rw [Fintype.sum_prod_type]132 apply Finset.sum_congr rfl133 intro y _134 calc135 G y = q y • H y := (hpiece y).symm136 _ = q y • ∑ k, w y k • projector (v y k) := congrArg (q y • ·) (vs y).2.1137 _ = _ := by simp only [Finset.smul_sum, smul_smul]138 · rw [Fintype.sum_prod_type, Finset.sum_filter]139 apply Finset.sum_le_sum140 intro y _141 change (∑ j, (q y * w y j) * gain (projector (v y j))) ≤142 if 0 < q y then q y * classicalSubentropy (labelPosterior (G y)) else 0143 by_cases hy : 0 < q y144 · have hlabels : labelMass (H y) = labelPosterior (G y) := by145 funext x146 rw [show H y = (q y)⁻¹ • G y from ite_eq_right hy.ne', labelMass_smul]147 simp only [labelPosterior, q, div_eq_mul_inv]148 ring149 simp only [hy, ite_true, mul_assoc, ← Finset.mul_sum]150 rw [← hlabels]151 exact mul_le_mul_of_nonneg_left (vs y).2.2 hy.le152 · have hz : q y = 0 := le_antisymm (le_of_not_gt hy) (hq y)153 simp [hz]154155end SubentropyCertificates.PinchingEquality
Axioms used
Choose a statement to see which axioms its proof uses.