module public import SubentropyCertificates.CalibratedCoordinate public import SubentropyCertificates.CalibratedPosterior public import SubentropyCertificates.PosteriorStability /-! The calibrated bound in Proposition 25, from each measurement to the optimal error. -/ @[expose] public section noncomputable section set_option autoImplicit false open Matrix Set open scoped BigOperators MatrixOrder ComplexOrder namespace SubentropyCertificates.AncillaCalibration open D5.S3.Quantum.Foundation.FiniteStateChannel (DensityState) open D5.S3.Quantum.Information.PartialTraceMutualInformation (productState) open D5.S3.Quantum.Subentropy.ClassicalQuantumGram (conditionalSubentropy) open D5.S3.Quantum.Subentropy.GuessingProbability (pGuess) open SubentropyCertificates.ClassicalCurve open SubentropyCertificates.MeasurementPosterior open SubentropyCertificates.Discrimination open SubentropyCertificates.PosteriorStability (measurementError) variable {X B C Y : Type*} [Fintype X] [DecidableEq X] [Fintype B] [DecidableEq B] [Fintype C] [DecidableEq C] /-- Jensen's inequality for calibrated posteriors, with any reported label at each outcome. -/ theorem calibrated_posterior_bound_finset (ν : DensityState C) (m : ℕ) (hn : Fintype.card X = m + 2) (S : Finset Y) (q : Y → ℝ) (hq : ∀ y ∈ S, 0 ≤ q y) (hs : ∑ y ∈ S, q y = 1) (b : Y → X → ℝ) (hb : ∀ y ∈ S, b y ∈ probabilitySimplex X) (selected : Y → X) : (∑ y ∈ S, q y * calibratedSubentropy ν (b y)) ≤ calibratedPhi ν m (∑ y ∈ S, q y * (1 - b y (selected y))) := by have herr y (hy : y ∈ S) : 1 - b y (selected y) ∈ Icc (0 : ℝ) 1 := by have hle : b y (selected y) ≤ 1 := by rw [← (hb y hy).2] exact Finset.single_le_sum (fun i _ ↦ (hb y hy).1 i) (Finset.mem_univ _) exact ⟨sub_nonneg.mpr hle, by linarith [(hb y hy).1 (selected y)]⟩ calc _ ≤ ∑ y ∈ S, q y * calibratedPhi ν m (1 - b y (selected y)) := Finset.sum_le_sum fun y hy ↦ mul_le_mul_of_nonneg_left (calibrated_coordinate_bound_finite ν m hn (b y) (hb y hy) (selected y)) (hq y hy) _ ≤ _ := (calibratedPhi_concave ν m).le_map_sum hq hs herr variable [Fintype Y] private theorem measurement_average_le_curve (ν : DensityState C) (m : ℕ) (hn : Fintype.card X = m + 2) (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1) (ρ : X → DensityState B) (F : Y → Matrix B B ℂ) (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) (selected : Y → X) : (∑ y ∈ Finset.univ.filter (fun y ↦ 0 < outcomeProbability p ρ (F y)), outcomeProbability p ρ (F y) * calibratedSubentropy ν (posterior p ρ (F y))) ≤ calibratedPhi ν m (measurementError p ρ F selected) := by let q y := outcomeProbability p ρ (F y) let S := Finset.univ.filter (fun y ↦ 0 < q y) have hq y : 0 ≤ q y := outcomeProbability_nonneg p hp ρ (F y) (hF y) have hsum : ∑ y ∈ S, q y = 1 := by rw [sum_over_positive q hq q (fun _ hz ↦ hz)] exact sum_outcomeProbability p hp hs ρ F hsF exact calibrated_posterior_bound_finset ν m hn S q (fun y _ ↦ hq y) hsum (fun y ↦ posterior p ρ (F y)) (fun y hy ↦ posterior_probability p hp ρ (F y) (hF y) (Finset.mem_filter.mp hy).2) selected /-- Equation (ancilla-posterior) for every finite POVM. The MAP error uses the maximum posterior mass on each positive-probability outcome and is independent of tie breaking. -/ theorem ancilla_measurement_curve_bound (ν : DensityState C) (m : ℕ) (hn : Fintype.card X = m + 2) (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1) (ρ : X → DensityState B) (F : Y → Matrix B B ℂ) (hF : ∀ y, (F y).PosSemidef) (hsF : ∑ y, F y = 1) : let q y := outcomeProbability p ρ (F y) let b y := posterior p ρ (F y) let S := Finset.univ.filter (fun y ↦ 0 < q y) let avg := ∑ y ∈ S, q y * calibratedSubentropy ν (b y) let e := ∑ y ∈ S, q y * (1 - sSup (Set.range (b y))) let c := conditionalSubentropy p hp hs (fun x ↦ productState (ρ x) ν) 0 ≤ c ∧ c ≤ avg ∧ avg ≤ calibratedPhi ν m e := by classical have : Nonempty X := Fintype.card_pos_iff.mp (by omega) have hmax (y : Y) : ∃ i, posterior p ρ (F y) i = sSup (Set.range (posterior p ρ (F y))) := by obtain ⟨i, _, hi⟩ := Finset.exists_max_image Finset.univ (posterior p ρ (F y)) Finset.univ_nonempty refine ⟨i, Eq.symm (IsGreatest.csSup_eq ⟨⟨i, rfl⟩, ?_⟩)⟩ rintro _ ⟨x, rfl⟩ exact hi x (Finset.mem_univ x) choose selected hsel using hmax have h := measurement_average_le_curve ν m hn p hp hs ρ F hF hsF selected simp only [measurementError, hsel] at h obtain ⟨hzero, hcomp⟩ := ancilla_measurement_posterior_comparison p hp hs ρ ν F hF hsF exact ⟨hzero, hcomp, h⟩ /-- At an optimal guessing POVM the calibrated curve bounds the extended conditional subentropy at the original ensemble's minimum attainable error. -/ theorem ancilla_optimal_curve_bound (ν : DensityState C) (m : ℕ) (hn : Fintype.card X = m + 2) (p : X → ℝ) (hp : ∀ x, 0 ≤ p x) (hs : ∑ x, p x = 1) (ρ : X → DensityState B) : conditionalSubentropy p hp hs (fun x ↦ productState (ρ x) ν) ≤ calibratedPhi ν m (1 - pGuess p ρ) := by obtain ⟨M, hM, hsM, hopt⟩ := exists_optimal_povm p hp hs ρ have he : measurementError p ρ M id = 1 - pGuess p ρ := (posterior_average_error p hp hs ρ M hM hsM id).trans (congrArg (fun s : ℝ ↦ 1 - s) hopt) rw [← he] exact (ancilla_measurement_posterior_comparison p hp hs ρ ν M hM hsM).2.trans (measurement_average_le_curve ν m hn p hp hs ρ M hM hsM id) end SubentropyCertificates.AncillaCalibration