QuantumEquality.lean
1module23public import SubentropyCertificates.IdenticalPureSignals45/-!6# Equality in the comparison with measurement posteriors78The posterior average ranges only over positive-probability outcomes. The9point-mass criterion follows from strict concavity of classical subentropy10on the closed simplex; it applies to arbitrary finite signal and outcome sets.11-/1213@[expose] public section14noncomputable section15set_option autoImplicit false16set_option backward.isDefEq.respectTransparency false17open Matrix Set18open scoped BigOperators ComplexOrder MatrixOrder1920namespace SubentropyCertificates.QuantumEquality21open D5.S3.Quantum.Foundation.FiniteStateChannel22open D5.S3.Quantum.Information.PartialTraceMutualInformation23open D5.S3.Quantum.Information.OrthogonalRecordEntropy24open D5.S3.Quantum.Subentropy.Basic25open D5.S3.Quantum.Subentropy.ClassicalQuantumGram26open SubentropyCertificates.ClassicalCurve27open SubentropyCertificates.MeasurementPosterior28open SubentropyCertificates.Discrimination2930variable {X : Type*} [Fintype X] [DecidableEq X]3132def pointMass (i : X) : X → ℝ := fun j => if j = i then 1 else 03334theorem pointMass_probability (i : X) : pointMass i ∈ probabilitySimplex X := by35 exact ⟨fun j => by by_cases h : j = i <;> simp [pointMass, h], by simp [pointMass]⟩3637theorem pointMass_subentropy (i : X) : classicalSubentropy (pointMass i) = 0 := by38 let v (j : X) : ℂ := if j = i then 1 else 039 have hv : ∑ j, star (v j) * v j = 1 := by simp [v]40 have hd : diagonal (fun j => (pointMass i j : ℂ)) = vecMulVec v (star v) := by41 apply Matrix.ext42 intro a b43 by_cases ha : a = i44 · subst a45 by_cases hb : b = i46 · subst b; simp [pointMass, v, vecMulVec]47 · simp [pointMass, v, vecMulVec, Matrix.diagonal, hb, Ne.symm hb]48 · simp [pointMass, v, vecMulVec, Matrix.diagonal, ha]49 exact (congrArg matrixSubentropy hd).trans (matrixSubentropy_pure v hv)5051theorem pointMass_barycenter (p : X → ℝ) : ∑ i, p i • pointMass i = p := by52 funext j53 simp [Finset.sum_apply, pointMass, Pi.smul_apply, mul_ite]5455theorem classical_subentropy_nonneg (p : X → ℝ) (hp : p ∈ probabilitySimplex X) :56 0 ≤ classicalSubentropy p := by57 have h := classical_subentropy_strictConcave.concaveOn.le_map_sum58 (t := Finset.univ) (w := p) (p := pointMass) (fun i _ => hp.1 i) hp.259 (fun i _ => pointMass_probability i)60 simpa only [pointMass_barycenter, pointMass_subentropy, smul_zero, Finset.sum_const_zero] using h6162theorem classical_zero_iff_pointMass (p : X → ℝ) (hp : p ∈ probabilitySimplex X) :63 classicalSubentropy p = 0 ↔ ∃ i, p = pointMass i := by64 constructor65 · intro hz66 have h := classical_subentropy_strictConcave.map_sum_eq_iff'67 (t := Finset.univ) (w := p) (p := pointMass) (fun i _ => hp.1 i) hp.268 (fun i _ => pointMass_probability i)69 simp only [pointMass_barycenter, pointMass_subentropy, smul_zero, Finset.sum_const_zero] at h70 obtain ⟨i, hi⟩ : ∃ i, p i ≠ 0 := by71 by_contra! hzero72 have hs := hp.273 simp [hzero] at hs74 exact ⟨i, (h.mp hz i (Finset.mem_univ _) hi).symm⟩75 · rintro ⟨i, rfl⟩76 exact pointMass_subentropy i7778variable {Y B : Type*} [Fintype Y] [Fintype B] [DecidableEq B]7980def posteriorAverage (p : X → ℝ) (ρ : X → DensityState B) (F : Y → Matrix B B ℂ) : ℝ :=81 ∑ y ∈ Finset.univ.filter (fun y => 0 < outcomeProbability p ρ (F y)),82 outcomeProbability p ρ (F y) * classicalSubentropy (posterior p ρ (F y))8384theorem posteriorAverage_zero_iff (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)85 (ρ : X → DensityState B) (F : Y → Matrix B B ℂ) (hF : ∀ y, (F y).PosSemidef) :86 posteriorAverage p ρ F = 0 ↔87 ∀ y, 0 < outcomeProbability p ρ (F y) → ∃ x, posterior p ρ (F y) = pointMass x := by88 let S := Finset.univ.filter (fun y => 0 < outcomeProbability p ρ (F y))89 have hpos {y : Y} (hy : y ∈ S) : 0 < outcomeProbability p ρ (F y) := (Finset.mem_filter.mp hy).290 have hb {y : Y} (hy : y ∈ S) : posterior p ρ (F y) ∈ probabilitySimplex X :=91 posterior_probability p hp ρ (F y) (hF y) (hpos hy)92 have hterm (y : Y) (hy : y ∈ S) :93 0 ≤ outcomeProbability p ρ (F y) * classicalSubentropy (posterior p ρ (F y)) :=94 mul_nonneg (hpos hy).le (classical_subentropy_nonneg _ (hb hy))95 constructor96 · intro hz y hy97 have hmem : y ∈ S := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hy⟩98 have heq := (Finset.sum_eq_zero_iff_of_nonneg hterm).mp hz y hmem99 exact (classical_zero_iff_pointMass _ (hb hmem)).mp ((mul_eq_zero.mp heq).resolve_left hy.ne')100 · intro h101 apply Finset.sum_eq_zero102 intro y hy103 exact mul_eq_zero_of_right _ ((classical_zero_iff_pointMass _ (hb hy)).mpr (h y (hpos hy)))104105/-- Under the zero hypothesis, this is the upper equality in the paper's106measurement comparison. A complete POVM is covered, and the equivalence107itself only uses positivity of its effects. -/108theorem zero_conditional_posterior_equality_iff (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)109 (hs : ∑ x, p x = 1) (ρ : X → DensityState B) (F : Y → Matrix B B ℂ)110 (hF : ∀ y, (F y).PosSemidef) (hz : conditionalSubentropy p hp hs ρ = 0) :111 conditionalSubentropy p hp hs ρ = posteriorAverage p ρ F ↔112 ∀ y, 0 < outcomeProbability p ρ (F y) → ∃ x, posterior p ρ (F y) = pointMass x := by113 rw [hz, eq_comm]114 exact posteriorAverage_zero_iff p hp ρ F hF115116theorem zero_and_posterior_equality_iff (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)117 (hs : ∑ x, p x = 1) (ρ : X → DensityState B) (F : Y → Matrix B B ℂ)118 (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) :119 (conditionalSubentropy p hp hs ρ = 0 ∧120 conditionalSubentropy p hp hs ρ = posteriorAverage p ρ F) ↔121 ∀ y, 0 < outcomeProbability p ρ (F y) → ∃ x, posterior p ρ (F y) = pointMass x := by122 constructor123 · rintro ⟨hz, he⟩124 exact (zero_conditional_posterior_equality_iff p hp hs ρ F hF hz).mp he125 · intro h126 have ha := (posteriorAverage_zero_iff p hp ρ F hF).mpr h127 obtain ⟨hlo, hhi⟩ := measurement_posterior_comparison p hp hs ρ F hF hsF128 change conditionalSubentropy p hp hs ρ ≤ posteriorAverage p ρ F at hhi129 exact ⟨le_antisymm (hhi.trans_eq ha) hlo, le_antisymm hhi (ha.trans_le hlo)⟩130131theorem eq_pointMass_iff_probability_one (p : X → ℝ) (hp : p ∈ probabilitySimplex X) (i : X) :132 p = pointMass i ↔ p i = 1 := by133 constructor134 · rintro rfl135 simp [pointMass]136 · intro hi137 have hsum := Finset.sum_erase_add Finset.univ p (Finset.mem_univ i)138 rw [hp.2, hi] at hsum139 have hzero : ∑ j ∈ Finset.univ.erase i, p j = 0 := by linarith140 have hoff := (Finset.sum_eq_zero_iff_of_nonneg (fun j _ => hp.1 j)).mp hzero141 funext j142 by_cases hji : j = i143 · subst j; simpa [pointMass] using hi144 · simpa [pointMass, hji] using hoff j (Finset.mem_erase.mpr ⟨hji, Finset.mem_univ _⟩)145146/-- A decision rule succeeds with probability one exactly when it selects147the atom of every positive-probability posterior. -/148theorem perfect_decision_iff (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1)149 (ρ : X → DensityState B) (F : Y → Matrix B B ℂ)150 (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) (selected : Y → X) :151 decisionSuccess p ρ F selected = 1 ↔ ∀ y, 0 < outcomeProbability p ρ (F y) →152 posterior p ρ (F y) = pointMass (selected y) := by153 let q := fun y => outcomeProbability p ρ (F y)154 let b := fun y => posterior p ρ (F y)155 let S := Finset.univ.filter (fun y => 0 < q y)156 have hpos {y : Y} (hy : y ∈ S) : 0 < q y := (Finset.mem_filter.mp hy).2157 have hb (y : Y) (hy : 0 < q y) : b y ∈ probabilitySimplex X :=158 posterior_probability p hp ρ (F y) (hF y) hy159 have hterm (y : Y) (hy : y ∈ S) : 0 ≤ q y * (1 - b y (selected y)) := by160 apply mul_nonneg (hpos hy).le161 apply sub_nonneg.mpr162 rw [← (hb y (hpos hy)).2]163 exact Finset.single_le_sum (fun j _ => (hb y (hpos hy)).1 j) (Finset.mem_univ _)164 have herr := posterior_average_error p hp hs ρ F hF hsF selected165 change (∑ y ∈ S, q y * (1 - b y (selected y))) = 1 - decisionSuccess p ρ F selected at herr166 constructor167 · intro h y hy168 have hmem : y ∈ S := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hy⟩169 rw [h, sub_self] at herr170 have hz := (Finset.sum_eq_zero_iff_of_nonneg hterm).mp herr y hmem171 have hone := (mul_eq_zero.mp hz).resolve_left (hpos hmem).ne'172 exact (eq_pointMass_iff_probability_one _ (hb y hy) _).mpr (sub_eq_zero.mp hone).symm173 · intro h174 have hz : ∑ y ∈ S, q y * (1 - b y (selected y)) = 0 := by175 apply Finset.sum_eq_zero176 intro y hy177 have hone := (eq_pointMass_iff_probability_one _ (hb y (hpos hy)) _).mp (h y (hpos hy))178 rw [hone, sub_self, mul_zero]179 linarith180181theorem zero_equality_iff_perfect_decision (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)182 (hs : ∑ x, p x = 1) (ρ : X → DensityState B) (F : Y → Matrix B B ℂ)183 (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) (hz : conditionalSubentropy p hp hs ρ = 0) :184 conditionalSubentropy p hp hs ρ = posteriorAverage p ρ F ↔185 ∃ selected : Y → X, decisionSuccess p ρ F selected = 1 := by186 classical187 rw [zero_conditional_posterior_equality_iff p hp hs ρ F hF hz]188 constructor189 · intro h190 have hX : Nonempty X := by191 by_contra hnone192 have : IsEmpty X := not_nonempty_iff.mp hnone193 simp at hs194 let selected (y : Y) : X := if hy : 0 < outcomeProbability p ρ (F y)195 then Classical.choose (h y hy) else Classical.choice hX196 refine ⟨selected, (perfect_decision_iff p hp hs ρ F hF hsF selected).mpr ?_⟩197 intro y hy198 simpa only [selected, dite_eq_left hy] using Classical.choose_spec (h y hy)199 · rintro ⟨selected, hsel⟩ y hy200 exact ⟨selected y, (perfect_decision_iff p hp hs ρ F hF hsF selected).mp hsel y hy⟩201202omit [DecidableEq X] in203theorem mixture_congr_on_support (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1)204 (ρ σ : X → DensityState B) (h : ∀ x, 0 < p x → ρ x = σ x) :205 mixtureState p hp hs ρ = mixtureState p hp hs σ := by206 apply Subtype.ext207 change ∑ x, p x • (ρ x).1 = ∑ x, p x • (σ x).1208 apply Finset.sum_congr rfl209 intro x _210 by_cases hx : p x = 0211 · simp only [hx, zero_smul]212 · rw [h x (lt_of_le_of_ne (hp x) (Ne.symm hx))]213214theorem conditional_congr_on_support (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1)215 (ρ σ : X → DensityState B) (h : ∀ x, 0 < p x → ρ x = σ x) :216 conditionalSubentropy p hp hs ρ = conditionalSubentropy p hp hs σ := by217 have hr : recordState p hp hs ρ = recordState p hp hs σ := by218 apply mixture_congr_on_support219 intro x hx220 rw [h x hx]221 unfold conditionalSubentropy222 rw [hr, mixture_congr_on_support p hp hs ρ σ h]223224omit [DecidableEq X] in225/-- Identical signals on the prior support leave the prior unchanged after226conditioning on any outcome of positive probability. -/227theorem posterior_of_identical_on_support (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)228 (hs : ∑ x, p x = 1) (ρ : X → DensityState B) (σ : DensityState B)229 (h : ∀ x, 0 < p x → ρ x = σ) (E : Matrix B B ℂ) (hpos : 0 < outcomeProbability p ρ E) :230 posterior p ρ E = p := by231 classical232 let r := (trace (E * CStarMatrix.ofMatrix.symm σ.1)).re233 have hj (x : X) : jointProbability p ρ E x = p x * r := by234 unfold jointProbability235 by_cases hx : p x = 0236 · simp only [hx, zero_mul]237 · rw [h x (lt_of_le_of_ne (hp x) (Ne.symm hx))]238 have hq : outcomeProbability p ρ E = r := by239 calc240 _ = ∑ x, jointProbability p ρ E x := (sum_jointProbability p hp ρ E).symm241 _ = ∑ x, p x * r := Finset.sum_congr rfl (fun x _ => hj x)242 _ = r := by rw [← Finset.sum_mul, hs, one_mul]243 funext x244 unfold posterior245 rw [hj, ← hq, mul_div_cancel_right₀ _ hpos.ne']246247theorem posterior_equality_of_identical_pure_on_support (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)248 (hs : ∑ x, p x = 1) (ρ : X → DensityState B)249 (v : B → ℂ) (hv : ∑ j, star (v j) * v j = 1)250 (h : ∀ x, 0 < p x → ρ x = pureSignal v hv) (F : Y → Matrix B B ℂ)251 (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) :252 conditionalSubentropy p hp hs ρ = posteriorAverage p ρ F := by253 let q := fun y => outcomeProbability p ρ (F y)254 let S := Finset.univ.filter (fun y => 0 < q y)255 have hqs : ∑ y ∈ S, q y = 1 :=256 (sum_over_positive q (fun y => outcomeProbability_nonneg p hp ρ (F y) (hF y))257 q (fun _ hz => hz)).trans (sum_outcomeProbability p hp hs ρ F hsF)258 calc259 _ = conditionalSubentropy p hp hs (fun _ => pureSignal v hv) :=260 conditional_congr_on_support p hp hs ρ _ h261 _ = classicalSubentropy p := conditional_identical_pure p hp hs v hv262 _ = ∑ y ∈ S, q y * classicalSubentropy p := by rw [← Finset.sum_mul, hqs, one_mul]263 _ = _ := by264 apply Finset.sum_congr rfl265 intro y hy266 rw [posterior_of_identical_on_support p hp hs ρ _ h (F y) (Finset.mem_filter.mp hy).2]267268end SubentropyCertificates.QuantumEquality
Axioms used
Choose a statement to see which axioms its proof uses.
pointMass_probabilitypointMass_subentropypointMass_barycenterclassical_subentropy_nonnegclassical_zero_iff_pointMassposteriorAverage_zero_iffzero_conditional_posterior_equality_iffzero_and_posterior_equality_iffeq_pointMass_iff_probability_oneperfect_decision_iffzero_equality_iff_perfect_decisionmixture_congr_on_supportconditional_congr_on_supportposterior_of_identical_on_supportposterior_equality_of_identical_pure_on_support