module public import SubentropyCertificates.CyclicSpectra public import SubentropyCertificates.CyclicGuessing public import SubentropyCertificates.CurveInverse /-! The one-parameter family of Table A1 and its exact endpoint values. -/ @[expose] public section noncomputable section set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set open scoped BigOperators namespace SubentropyCertificates.Cyclic open SubentropyCertificates.ClassicalCurve SubentropyCertificates.Discrimination open D5.S3.Quantum.Subentropy.ClassicalQuantumGram D5.S3.Quantum.Subentropy.GuessingProbability def tableWeights (r : ℝ) (j : Three) : ℝ := if j = 0 then 1-2*r else r theorem table_probability {r : ℝ} (hr : r ∈ Icc 0 (1/3)) : tableWeights r ∈ probabilitySimplex Three := by refine ⟨fun j ↦ ?_, ?_⟩ · unfold tableWeights split <;> linarith [hr.1,hr.2] · change (∑ j : Fin 3, tableWeights r j) = 1 rw [Fin.sum_univ_three] norm_num [tableWeights, show (2 : Three) ≠ 0 by decide] ring theorem table_weights_subentropy (r : ℝ) : classicalSubentropy (tableWeights r) = phi 1 (2*r) := by let e : Three ≃ Option (Fin 2) := finSuccEquiv 2 have h : tableWeights r = extremalVector 1 (2*r) ∘ e := by funext i change (if (i : Fin 3) = 0 then 1-2*r else r) = _ refine Fin.cases ?_ (fun j ↦ ?_) i · change (if (0 : Fin 3)=0 then 1-2*r else r) = extremalVector 1 (2*r) (finSuccEquiv 2 0) rw [finSuccEquiv_zero] simp [extremalVector] · change (if j.succ=0 then 1-2*r else r) = extremalVector 1 (2*r) (finSuccEquiv 2 j.succ) rw [finSuccEquiv_succ] simp [extremalVector, Fin.succ_ne_zero j] exact (congrArg classicalSubentropy h).trans (classical_subentropy_reindex _ e) def tableQ (r : ℝ) := phi 1 (uniformError 1) - phi 1 (2*r) def tableError (r : ℝ) := 1 - (Real.sqrt (1-2*r) + 2 * Real.sqrt r)^2/3 /-- The linear bound and the optimal error for every parameter in Table A1. -/ theorem cyclic_table_values {r : ℝ} (hr : r ∈ Icc 0 (1/3)) : let p := tableWeights r let ρ := signalState p (table_probability hr).1 (table_probability hr).2 conditionalSubentropy prior prior_nonneg prior_sum ρ = tableQ r ∧ 1 - pGuess prior ρ = tableError r := by dsimp only rw [cyclic_conditional_subentropy, cyclic_guessing_probability, table_weights_subentropy] constructor · rw [tableQ, phi_uniform_endpoint] norm_num · change 1 - (∑ j : Fin 3, Real.sqrt (tableWeights r j))^2 / 3 = _ rw [Fin.sum_univ_three] norm_num [tableWeights, tableError, show (2 : Three) ≠ 0 by decide] ring /-- At r=0 the inverse is 2/3 and the optimal error is 2/3. At r=1/3 both are zero. -/ theorem cyclic_table_endpoints : tableError 0 = 2/3 ∧ tableError (1/3) = 0 ∧ tableQ 0 = Real.log 3 - 5/6 ∧ tableQ (1/3) = 0 ∧ (∀ h, phiInverse 1 (tableQ 0) h = 2/3) ∧ (∀ h, phiInverse 1 (tableQ (1/3)) h = 0) := by have hx : uniformError 1 = 2/3 := by norm_num [uniformError] have h0 : tableQ 0 = phi 1 (uniformError 1) := by simp [tableQ, phi_zero] have h1 : tableQ (1/3) = 0 := by rw [tableQ, hx]; norm_num refine ⟨by norm_num [tableError], ?_, ?_, h1, ?_, ?_⟩ · rw [tableError, show 1-2*(1/3:ℝ) = 1/3 by norm_num] nlinarith [Real.sq_sqrt (by norm_num : (0 : ℝ) ≤ 1/3)] · rw [h0, phi_uniform_endpoint] norm_num [harmonic_succ, harmonic_zero] ring · rw [h0] intro h exact (phiInverse_upper 1).trans hx · rw [h1] intro h exact phiInverse_zero 1 end SubentropyCertificates.Cyclic