Pratik Patil

GuessingMeasurement.lean

1module23public import SubentropyCertificates.QuantumMeasurement4public import SubentropyCertificates.CurveMonotonicity56/-!7# The subentropy curve bound for each guessing measurement89Outcomes Y and labels X are independent finite types. A decision rule assigns10a label to each outcome. Zero outcome probabilities are omitted from the11posterior average, and are proved to contribute zero to success and error.12The classical parameter m represents n-2, as in the retained v4 certificates.13-/1415@[expose] public section16noncomputable section17set_option autoImplicit false18set_option backward.isDefEq.respectTransparency false19open Matrix MeasureTheory Set20open scoped BigOperators ComplexOrder MatrixOrder2122namespace SubentropyCertificates.Discrimination23open D5.S3.Quantum.Foundation.FiniteStateChannel24open D5.S3.Quantum.Subentropy.ClassicalQuantumGram25open SubentropyCertificates.ClassicalCurve26open SubentropyCertificates.MeasurementPosterior2728theorem classical_posterior_bound_finset {X Y : Type*}29    [Fintype X] [DecidableEq X] (m : ℕ) (hn : Fintype.card X = m + 2)30    (S : Finset Y) (q : Y → ℝ) (hq : ∀ y ∈ S, 0 ≤ q y)31    (hs : ∑ y ∈ S, q y = 1) (b : Y → X → ℝ)32    (hb : ∀ y ∈ S, b y ∈ probabilitySimplex X) (selected : Y → X) :33    (∑ y ∈ S, q y * classicalSubentropy (b y)) ≤34      phi m (∑ y ∈ S, q y * (1 - b y (selected y))) := by35  have herr (y : Y) (hy : y ∈ S) : 1 - b y (selected y) ∈ Icc (0 : ℝ) 1 := by36    have hle : b y (selected y) ≤ 1 := by37      rw [← (hb y hy).2]38      exact Finset.single_le_sum (fun i _ => (hb y hy).1 i) (Finset.mem_univ _)39    exact ⟨sub_nonneg.mpr hle, by linarith [(hb y hy).1 (selected y)]⟩40  calc41    _ ≤ ∑ y ∈ S, q y * phi m (1 - b y (selected y)) := by42      apply Finset.sum_le_sum43      intro y hy44      exact mul_le_mul_of_nonneg_left45        (classical_coordinate_bound_finite m hn (b y) (hb y hy) (selected y)) (hq y hy)46    _ ≤ _ := (phi_concave m).le_map_sum hq hs herr4748theorem sum_over_positive {Y : Type*} [Fintype Y] (q : Y → ℝ)49    (hq : ∀ y, 0 ≤ q y) (f : Y → ℝ) (hz : ∀ y, q y = 0 → f y = 0) :50    (∑ y ∈ Finset.univ.filter (fun y => 0 < q y), f y) = ∑ y, f y := by51  classical52  apply Finset.sum_subset (Finset.filter_subset _ _)53  intro y _ hy54  have hn : ¬0 < q y := by simpa only [Finset.mem_filter, Finset.mem_univ, true_and] using hy55  exact hz y (le_antisymm (le_of_not_gt hn) (hq y))5657variable {X B Y : Type*} [Fintype X] [DecidableEq X]58  [Fintype B] [DecidableEq B] [Fintype Y]5960def decisionSuccess (p : X → ℝ) (ρ : X → DensityState B)61    (F : Y → Matrix B B ℂ) (selected : Y → X) : ℝ :=62  ∑ y, jointProbability p ρ (F y) (selected y)6364theorem weighted_posterior (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)65    (ρ : X → DensityState B) (F : Matrix B B ℂ) (hF : F.PosSemidef) (x : X) :66    outcomeProbability p ρ F * posterior p ρ F x = jointProbability p ρ F x := by67  by_cases hz : outcomeProbability p ρ F = 068  · rw [hz, zero_mul, jointProbability_eq_zero_of_outcome_zero p hp ρ F hF hz x]69  · unfold posterior70    exact mul_div_cancel₀ _ hz7172theorem decision_success_bounds (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)73    (hs : ∑ x, p x = 1) (ρ : X → DensityState B)74    (F : Y → Matrix B B ℂ) (hF : ∀ y, (F y).PosSemidef)75    (hsF : ∑ y, F y = 1) (selected : Y → X) :76    0 ≤ decisionSuccess p ρ F selected ∧ decisionSuccess p ρ F selected ≤ 1 := by77  refine ⟨Finset.sum_nonneg (fun y _ => jointProbability_nonneg p hp ρ (F y) (hF y) _), ?_⟩78  calc79    _ ≤ ∑ y, outcomeProbability p ρ (F y) := by80      apply Finset.sum_le_sum81      intro y _82      rw [← sum_jointProbability p hp ρ (F y)]83      exact Finset.single_le_sum (fun x _ => jointProbability_nonneg p hp ρ (F y) (hF y) x)84        (Finset.mem_univ _)85    _ = 1 := sum_outcomeProbability p hp hs ρ F hsF8687theorem posterior_average_error (p : X → ℝ) (hp : ∀ x, 0 ≤ p x)88    (hs : ∑ x, p x = 1) (ρ : X → DensityState B)89    (F : Y → Matrix B B ℂ) (hF : ∀ y, (F y).PosSemidef)90    (hsF : ∑ y, F y = 1) (selected : Y → X) :91    (∑ y ∈ Finset.univ.filter (fun y => 0 < outcomeProbability p ρ (F y)),92      outcomeProbability p ρ (F y) * (1 - posterior p ρ (F y) (selected y))) =93      1 - decisionSuccess p ρ F selected := by94  rw [sum_over_positive (fun y => outcomeProbability p ρ (F y))95    (fun y => outcomeProbability_nonneg p hp ρ (F y) (hF y))96    (fun y => outcomeProbability p ρ (F y) * (1 - posterior p ρ (F y) (selected y)))97    (fun y hz => by rw [hz, zero_mul])]98  simp_rw [mul_sub, mul_one, weighted_posterior p hp ρ _ (hF _)]99  rw [Finset.sum_sub_distrib, sum_outcomeProbability p hp hs ρ F hsF]100  rfl101102theorem measurement_curve_bound (m : ℕ) (hn : Fintype.card X = m + 2)103    (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1)104    (ρ : X → DensityState B) (F : Y → Matrix B B ℂ)105    (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) (selected : Y → X) :106    0 ≤ conditionalSubentropy p hp hs ρ ∧107      conditionalSubentropy p hp hs ρ ≤ phi m (1 - decisionSuccess p ρ F selected) := by108  have hcomp := measurement_posterior_comparison p hp hs ρ F hF hsF109  let q : Y → ℝ := fun y => outcomeProbability p ρ (F y)110  let S : Finset Y := Finset.univ.filter (fun y => 0 < q y)111  have hq (y : Y) : 0 ≤ q y := outcomeProbability_nonneg p hp ρ (F y) (hF y)112  have hsum : ∑ y ∈ S, q y = 1 := by113    rw [sum_over_positive q hq q (fun _ hz => hz)]114    exact sum_outcomeProbability p hp hs ρ F hsF115  have hb (y : Y) (hy : y ∈ S) : posterior p ρ (F y) ∈ probabilitySimplex X :=116    posterior_probability p hp ρ (F y) (hF y) (Finset.mem_filter.mp hy).2117  have hclass := classical_posterior_bound_finset m hn S q (fun y _ => hq y) hsum118    (fun y => posterior p ρ (F y)) hb selected119  have he := posterior_average_error p hp hs ρ F hF hsF selected120  change (∑ y ∈ S, q y * (1 - posterior p ρ (F y) (selected y))) =121    1 - decisionSuccess p ρ F selected at he122  rw [he] at hclass123  exact ⟨hcomp.1, hcomp.2.trans hclass⟩124125end SubentropyCertificates.Discrimination

Axioms used

Choose a statement to see which axioms its proof uses.