Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Charge-conserving unitaries typically generate optimal covariant quantum error-correcting codes

Definition
QAlgorithms_Papers_Independent_Extend50_P03

by Gohan · Oct 29, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

The objects the formalized statements of Charge-conserving unitaries typically generate optimal covariant quantum error-correcting codes (arXiv:2102.11835) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • hammingCharge: PDF p.7: Hamming-weight charge.
  • chargeRotation: PDF p.7: exp(+i theta Q).
  • Conserves: PDF p.7: full centralizer, including all sector phases.
  • ChargeHaar: PDF pp.6–7: Haar characterized by probability, support and full left invariance.
  • SpecialHaar: PDF p.12: full SU(2^n) Haar, inside the ambient unitary group.
  • splitBits: Definition 1, PDF p.7: split the first k wires.
  • Ancilla: Definition 1, PDF p.7: fixed normalized charge eigenvector, independent of U.
  • pureEncoder: PDF p.7: append a fixed pure vector and apply U, on all matrix units.
  • chargeEncoder: Definition 1's encoding channel.
  • U1ChargeCovariant: PDF p.5: channel covariance, with the ancilla scalar phase cancelled.
  • BitsOn
  • joinBits: Join assignments on disjoint complementary physical wire sets.
  • retain: PDF p.8: partial trace retaining exactly S.
  • PatternLaw: PDF p.12: classical distribution of t-wire erasure locations.
  • flaggedPatternErasure: PDF p.12: direct-sum flagged erasure, padded with zeros on erased output wires.
  • purified: PDF p.3: purified distance from root fidelity.
  • optimizedChoiFidelity: PDF pp.3–4: optimal Choi fidelity. On channels, the feasible set is nonempty and bounded in [0,1]; the reference is normalized k EPR pairs, not a Haar average.
  • worstFidelity: PDF p.4: one decoder precedes all positive finite reference dimensions and all normalized joint states. On channels both optimization sets are bounded/nonempty.
  • optimizedCodeError: PDF pp.3–4: optimized error, with worst=true or Choi=false.
  • siteError: Decoder receives the complement of the erased set S.
  • mixtureError: Optimized error with the erasure location flag.
  • ChargeCodeParameters
  • AdmissibleCodeSizes: PDF pp.7–8: nontrivial asymptotic parameters. Finite formulas also allow k,t=0.
  • LinearSequence: PDF pp.8,11: exact integer alpha=a*n; no rounding or floor.
  • relativeRemainder: Distinct relative remainders in Theorems 1 and 2.
  • leadingError: PDF pp.8,11: preserve every radical and factor.
  • ZeroErrorGuarantee: Trivial regimes excluded from relative asymptotics: a zero logical register needs no recovery, and a zero erased register permits exact recovery. PDF pp.3–8.
  • AsymptoticGuarantee: Theorem 1 or 2 with uniform C,c before sequences, ancillas, laws, and patterns. Integrability is a conclusion; exponential probability is an upper bound only.
  • endpointEntropy: Entropy at the two charge interval endpoints.
  • ChargeInterior: Compact interior charge endpoints for the linear-charge entropy estimate. Unlike Appendix C, this imposes no small-erasure condition.
  • Interior: PDF p.24: compact interior and valid-sector conditions used in Appendix C.
  • chooseZ: Negative/too-large signed binomial lower indices give zero, never Nat truncation.
  • weightSectorProjector: PDF p.7: Hamming-weight sector projector. Invalid sectors vanish.
  • averageChoi: PDF p.20: constructed joint averaged Choi state, reference first.
  • reducedAverage: PDF p.21: constructed first-t-wire marginal of averageChoi.
  • averageSectorWeight: Eq.(27), PDF p.21.
  • averageZeta: PDF pp.21,25: computed environment marginal, not an arbitrary state.
  • comparisonChoi: PDF p.21: I_R/2^k tensor zeta.
  • averageBasis: PDF p.25: computed averaged environment output of a basis input.
  • averageEncodedUnit: PDF p.25: the actual full physical average, before taking any marginal.
  • averageMatrixUnit: PDF p.25: averaged environment matrix unit.
  • averageWorst: PDF p.25: finite maximum auxiliary averaged-basis error.
  • ConcentrationGuarantee: Lemma 2, PDF pp.10–11: uniform polynomial prefactors, with n/4 and n/2. No entropy conclusion is inserted as an assumption.
  • PatternGuarantee: PDF p.12: one exceptional set for all sites and all flagged classical mixtures.
  • unitaryEntryMoment: PDF p.14: matrix-entry (r,r) moments, including cross-sector correlations.
  • ExactDesign: PDF pp.14–15: exact full symmetric second twirl and its first twirl.
  • minSdp: PDF p.18, Eq.(24): feasible for all PSD rho on finite nonempty registers, with traces bounded below. Block inputs may be subnormalized or zero.
  • decouplingFactor: PDF p.17: diagonal F on equal-charge A,Abar pairs. Its unused orthogonal complement adds only zero rows on the unconditioned side.
  • erasureChoi: PDF p.18: normalized Choi matrix of tracing out the last n-t wires.
  • lambdaState: Lemma 3, PDF p.17: F(Psi tensor tau)F†; P=(A,Abar), Q=(R,E).
  • ancillaChoiInput: PDF p.17: pre-U Choi input with the fixed ancilla.
  • choiEntropy: Appendix A's entropy of the constructed Lambda state.
  • basisInput: Appendix C: normalized logical v appended with the ancilla, trivial reference.
  • decouplingInputEntropy: PDF pp.23–24: entropy for a basis or two-basis input.
  • choiSectorKappa: PDF p.20, Eq.(26): all actual residual sectors, signed binomial indices, positive denominator sectors under alpha≤n-k.
  • basisKappa: PDF p.24: sum of squares over valid residual sectors.
  • twoBasis: PDF p.23: four superpositions; x≠y ensures norm one.
  • orthogonalBlockOperator: Lemma 4, PDF p.19: construct the orthogonal-block operator in order (P1,P2),Q.
  • singleErasureLaw: PDF p.13: uniformly random single erasure with known location.
  • choiLowerCoefficient: Eq.(21), PDF p.13: ceil(k/2)=(k+1)/2; lower coefficient cited from [11].
  • chargeCoefficient: PDF p.12: common charge-dependent leading factor.
  • joinFirst: Join the first t wires and last n-t wires with the exact size equality.
  • firstTrace: The actual first-t-wire marginal, used to identify the constructed averages.
  • ChoiEntropyGrowth: Appendix A, PDF p.20: alpha=a*n with fixed 0<a<1. The source permits all legal k,t, including alpha+k=n; no compact upper-endpoint margin is assumed.
  • ChoiEntropyLinear: Appendix A, PDF p.20: the explicit Omega(n) corollary with k^2t^2=O(n). The exponent constant depends only on a; the threshold may depend on the sequence and its eventual O(n) constant. Ancilla choices remain uniform.
  • AverageWorstExpansion: Appendix D, PDF p.25: equality to leading order, not a finite exact correction.
  • OptimalSingleLimit: PDF p.13: ratios for mean flagged single-erasure errors. The sequence may have growing k in the worst metric; the Choi equality is only claimed at k=1.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Basic
import Definitions.Def_QAlgorithms_Defs_Information
import Definitions.Def_QAlgorithms_Defs_Measurement
import Definitions.Def_QAlgorithms_Defs_QuantumInformation
import Definitions.Def_QAlgorithms_Defs_Channel
import Definitions.Def_QAlgorithms_Papers_Independent_Support50_P23

/-! Kong–Liu, arXiv:2102.11835v1. Root fidelity; binary logarithms.
Local constructions preserve the fixed physical wire ordering. Matrix integrals use the
finite-dimensional entrywise norm; conditional min-entropy reuses the accepted library.
Compilation pending the batch handoff. -/

noncomputable section

open MeasureTheory Filter
open scoped Matrix ComplexConjugate ComplexOrder ENNReal Matrix.Norms.Elementwise

namespace QAlgorithms.Papers.Independent.Extend50.P03

open QAlgorithms.Papers.Independent.Support50.P23 (minEntropy)

attribute [local instance] Classical.propDecidable

/-- PDF pp.20–21,25: matrix expectations use the continuous extended norm of
finite entrywise function spaces, with the existing product topology. -/
local instance matrixContinuousENorm {I J : Type*} [Fintype I] [Fintype J] :
    ContinuousENorm (Matrix I J ℂ) :=
  inferInstanceAs (ContinuousENorm (I → J → ℂ))

/-- The local continuity instance preserves the entrywise extended norm exactly. -/
example {I J : Type*} [Fintype I] [Fintype J] (M : Matrix I J ℂ) :
    ‖M‖ₑ = ‖(fun i j => M i j)‖ₑ := rfl

/-- Borel ensemble outcomes, PDF pp.6–7. -/
instance unitaryMeasurable (n : ℕ) : MeasurableSpace ((Matrix.unitaryGroup (Qubits n) ℂ)) := borel _

/-- PDF p.7: Hamming-weight charge. -/
def hammingCharge (n : ℕ) : (Matrix (Qubits n) (Qubits n) ℂ) := Matrix.diagonal fun x => (hammingWeight x : ℂ)

/-- PDF p.7: exp(+i theta Q). -/
def chargeRotation (n : ℕ) (theta : ℝ) : (Matrix (Qubits n) (Qubits n) ℂ) :=
  Matrix.diagonal fun x => Complex.exp (Complex.I * (theta : ℂ) * (hammingWeight x : ℂ))

/-- PDF p.7: full centralizer, including all sector phases. -/
def Conserves {n : ℕ} (U : (Matrix.unitaryGroup (Qubits n) ℂ)) : Prop :=
  (U : (Matrix (Qubits n) (Qubits n) ℂ)) * hammingCharge n = hammingCharge n * (U : (Matrix (Qubits n) (Qubits n) ℂ))

/-- PDF pp.6–7: Haar characterized by probability, support and full left invariance. -/
def ChargeHaar (n : ℕ) (mu : Measure ((Matrix.unitaryGroup (Qubits n) ℂ))) : Prop :=
  IsProbabilityMeasure mu ∧ (∀ᵐ (U : Matrix.unitaryGroup (Qubits n) ℂ) ∂mu, Conserves U) ∧
    ∀ V : (Matrix.unitaryGroup (Qubits n) ℂ), Conserves V → Measure.map (fun U => V * U) mu = mu

/-- PDF p.12: full SU(2^n) Haar, inside the ambient unitary group. -/
def SpecialHaar (n : ℕ) (mu : Measure ((Matrix.unitaryGroup (Qubits n) ℂ))) : Prop :=
  IsProbabilityMeasure mu ∧ (∀ᵐ (U : Matrix.unitaryGroup (Qubits n) ℂ) ∂mu, Matrix.det (U : (Matrix (Qubits n) (Qubits n) ℂ)) = 1) ∧
    ∀ V : (Matrix.unitaryGroup (Qubits n) ℂ), Matrix.det (V : (Matrix (Qubits n) (Qubits n) ℂ)) = 1 → Measure.map (fun U => V * U) mu = mu

/-- Definition 1, PDF p.7: split the first k wires. -/
def splitBits (n k : ℕ) (h : k ≤ n) (z : Qubits n) : Qubits k × Qubits (n-k) :=
  qubitsAppendEquiv k (n-k) (fun i => z (Fin.cast (Nat.add_sub_of_le h) i))

/-- Definition 1, PDF p.7: fixed normalized charge eigenvector, independent of U. -/
structure Ancilla (n k alpha : ℕ) where
  logical_le : k ≤ n
  charge_le : alpha ≤ n-k
  vector : EuclideanSpace ℂ (Qubits (n-k))
  normalized : IsState vector
  eigen : act (hammingCharge (n-k)) vector = (alpha : ℂ) • vector

/-- PDF p.7: append a fixed pure vector and apply U, on all matrix units. -/
def pureEncoder {n k : ℕ} (h : k ≤ n) (psi : EuclideanSpace ℂ (Qubits (n-k)))
    (U : (Matrix.unitaryGroup (Qubits n) ℂ)) : Superop (Qubits k) (Qubits n) := fun rho =>
  (U : (Matrix (Qubits n) (Qubits n) ℂ)) * (Matrix.of fun z w => rho (splitBits n k h z).1 (splitBits n k h w).1 *
    psi (splitBits n k h z).2 * conj (psi (splitBits n k h w).2)) * (U : (Matrix (Qubits n) (Qubits n) ℂ))ᴴ

/-- Definition 1's encoding channel. -/
def chargeEncoder {n k alpha : ℕ} (A : Ancilla n k alpha) (U : (Matrix.unitaryGroup (Qubits n) ℂ)) :
    Superop (Qubits k) (Qubits n) := pureEncoder A.logical_le A.vector U

/-- PDF p.5: channel covariance, with the ancilla scalar phase cancelled. -/
def U1ChargeCovariant {n k : ℕ} (E : Superop (Qubits k) (Qubits n)) : Prop :=
  ∀ theta : ℝ, ∀ rho : (Matrix (Qubits k) (Qubits k) ℂ), IsDensityMatrix rho →
    E (chargeRotation k theta * rho * (chargeRotation k theta)ᴴ) =
      chargeRotation n theta * E rho * (chargeRotation n theta)ᴴ

abbrev BitsOn {n : ℕ} (S : Finset (Fin n)) := {i : Fin n // i ∈ S} → Bool

/-- Join assignments on disjoint complementary physical wire sets. -/
def joinBits {n : ℕ} (S : Finset (Fin n)) (u : BitsOn S) (v : BitsOn Sᶜ) : Qubits n :=
  fun i => if h : i ∈ S then u ⟨i,h⟩ else v ⟨i, by simpa using h⟩

/-- PDF p.8: partial trace retaining exactly S. -/
def retain {n : ℕ} (S : Finset (Fin n)) : Superop (Qubits n) (BitsOn S) :=
  fun rho => Matrix.of fun u v => ∑ z : BitsOn Sᶜ, rho (joinBits S u z) (joinBits S v z)

/-- PDF p.12: classical distribution of t-wire erasure locations. -/
def PatternLaw (n t : ℕ) (p : Finset (Fin n) → ℝ) : Prop :=
  (∀ S, 0 ≤ p S) ∧ (∑ S, p S) = 1 ∧ ∀ S, S.card ≠ t → p S = 0

/-- PDF p.12: direct-sum flagged erasure, padded with zeros on erased output wires. -/
def flaggedPatternErasure {n : ℕ} (p : Finset (Fin n) → ℝ) :
    Superop (Qubits n) (Finset (Fin n) × Qubits n) :=
  fun rho => Matrix.of fun y z =>
    if y.1 = z.1 ∧ (∀ i ∈ y.1, y.2 i = false) ∧ (∀ i ∈ z.1, z.2 i = false) then
      (p y.1 : ℂ) * ∑ e : BitsOn y.1,
        rho (joinBits y.1 e (fun i => y.2 i)) (joinBits y.1 e (fun i => z.2 i))
    else 0

/-- PDF p.3: purified distance from root fidelity. -/
def purified {I : Type*} [Fintype I] [DecidableEq I] (rho sigma : Matrix I I ℂ) : ℝ :=
  Real.sqrt (1 - rootFidelity rho sigma ^ 2)

/-- PDF pp.3–4: optimal Choi fidelity. On channels, the feasible set is nonempty
and bounded in [0,1]; the reference is normalized k EPR pairs, not a Haar average. -/
def optimizedChoiFidelity {k : ℕ} {B : Type*} [Fintype B] [DecidableEq B]
    (N : Superop (Qubits k) B) : ℝ :=
  sSup {f : ℝ | ∃ D : Superop B (Qubits k), IsChannel D ∧
    f = rootFidelity (pureDensity (maxEntangled k))
      (idTensorSuperop (R := Qubits k) (D ∘ N) (pureDensity (maxEntangled k)))}

/-- PDF p.4: one decoder precedes all positive finite reference dimensions and
all normalized joint states. On channels both optimization sets are bounded/nonempty. -/
def worstFidelity {k : ℕ} {B : Type*} [Fintype B] [DecidableEq B]
    (N : Superop (Qubits k) B) : ℝ :=
  sSup {f : ℝ | ∃ D : Superop B (Qubits k), IsChannel D ∧
    f = sInf {g : ℝ | ∃ r : ℕ, ∃ rho : Matrix (Fin (r+1) × Qubits k)
        (Fin (r+1) × Qubits k) ℂ, IsDensityMatrix rho ∧
      g = rootFidelity rho (idTensorSuperop (R := Fin (r+1)) (D ∘ N) rho)}}

/-- PDF pp.3–4: optimized error, with worst=true or Choi=false. -/
def optimizedCodeError {k : ℕ} {B : Type*} [Fintype B] [DecidableEq B]
    (worst : Bool) (N : Superop (Qubits k) B) : ℝ :=
  Real.sqrt (1 - (if worst then worstFidelity N else optimizedChoiFidelity N) ^ 2)

/-- Decoder receives the complement of the erased set S. -/
def siteError {n k alpha : ℕ} (worst : Bool) (A : Ancilla n k alpha)
    (S : Finset (Fin n)) (U : (Matrix.unitaryGroup (Qubits n) ℂ)) : ℝ :=
  optimizedCodeError worst (retain Sᶜ ∘ chargeEncoder A U)

/-- Optimized error with the erasure location flag. -/
def mixtureError {n k alpha : ℕ} (worst : Bool) (A : Ancilla n k alpha)
    (p : Finset (Fin n) → ℝ) (U : (Matrix.unitaryGroup (Qubits n) ℂ)) : ℝ :=
  optimizedCodeError worst (flaggedPatternErasure p ∘ chargeEncoder A U)

structure ChargeCodeParameters where
  n : ℕ
  k : ℕ
  alpha : ℕ
  t : ℕ

/-- PDF pp.7–8: nontrivial asymptotic parameters. Finite formulas also allow k,t=0. -/
def AdmissibleCodeSizes (d : ChargeCodeParameters) : Prop :=
  1 ≤ d.n ∧ 1 ≤ d.k ∧ d.k ≤ d.n ∧ d.alpha ≤ d.n-d.k ∧ 1 ≤ d.t ∧ d.t ≤ d.n

/-- PDF pp.8,11: exact integer alpha=a*n; no rounding or floor. -/
def LinearSequence (a : ℝ) (d : ℕ → ChargeCodeParameters) : Prop :=
  Tendsto (fun i => (d i).n) atTop atTop ∧
    ∀ i, AdmissibleCodeSizes (d i) ∧ ((d i).alpha : ℝ) = a * (d i).n

/-- Distinct relative remainders in Theorems 1 and 2. -/
def relativeRemainder (worst : Bool) (d : ChargeCodeParameters) : ℝ :=
  if worst then (d.k : ℝ) * (d.t : ℝ)^2 / d.n
  else (d.k : ℝ)^2 * (d.t : ℝ)^2 / d.n

/-- PDF pp.8,11: preserve every radical and factor. -/
def leadingError (worst : Bool) (a : ℝ) (d : ChargeCodeParameters) : ℝ :=
  (if worst then (d.k : ℝ) * Real.sqrt d.t else Real.sqrt ((d.t : ℝ) * d.k)) /
    (4 * d.n * Real.sqrt (a * (1-a)))

/-- Trivial regimes excluded from relative asymptotics: a zero logical register
needs no recovery, and a zero erased register permits exact recovery. PDF pp.3–8. -/
def ZeroErrorGuarantee (worst : Bool) : Prop :=
  (∀ n alpha : ℕ, ∀ A : Ancilla n 0 alpha, ∀ S : Finset (Fin n),
    ∀ U : (Matrix.unitaryGroup (Qubits n) ℂ), siteError worst A S U = 0) ∧
  (∀ n k alpha : ℕ, ∀ A : Ancilla n k alpha, ∀ U : (Matrix.unitaryGroup (Qubits n) ℂ),
    siteError worst A ∅ U = 0)

/-- Theorem 1 or 2 with uniform C,c before sequences, ancillas, laws, and patterns.
Integrability is a conclusion; exponential probability is an upper bound only. -/
def AsymptoticGuarantee (L : (n : ℕ) → Measure ((Matrix.unitaryGroup (Qubits n) ℂ)) → Prop) (worst : Bool) : Prop :=
  ∀ a : ℝ, 0 < a → a < 1 → ∃ C : ℝ, 0 < C ∧ ∃ c : ℝ, 0 < c ∧
    ∀ d : ℕ → ChargeCodeParameters, LinearSequence a d →
      Tendsto (fun i => relativeRemainder worst (d i)) atTop (nhds 0) →
      ∃ N : ℕ, ∀ i ≥ N, ∀ A : Ancilla (d i).n (d i).k (d i).alpha,
      ∀ mu : Measure ((Matrix.unitaryGroup (Qubits (d i).n) ℂ)), L (d i).n mu →
      ∀ S : Finset (Fin (d i).n), S.card = (d i).t →
      let B := leadingError worst a (d i) * (1 + C * relativeRemainder worst (d i))
      Integrable (siteError worst A S) mu ∧ (∫ U, siteError worst A S U ∂mu) ≤ B ∧
      mu {U | B < siteError worst A S U} ≤ ENNReal.ofReal (Real.exp (-c * (d i).n))

/-- Entropy at the two charge interval endpoints. -/
def endpointEntropy (d : ChargeCodeParameters) : ℝ :=
  min (binEntropy2 ((d.alpha : ℝ) / d.n))
    (binEntropy2 (((d.alpha : ℝ) + d.k) / d.n))

/-- Compact interior charge endpoints for the linear-charge entropy estimate.
Unlike Appendix C, this imposes no small-erasure condition. -/
def ChargeInterior (b : ℝ) (d : ChargeCodeParameters) : Prop :=
  1 ≤ d.n ∧ d.k ≤ d.n ∧ d.alpha ≤ d.n-d.k ∧ d.t ≤ d.n ∧
    b ≤ (d.alpha : ℝ)/d.n ∧ ((d.alpha : ℝ)+d.k)/d.n ≤ 1-b

/-- PDF p.24: compact interior and valid-sector conditions used in Appendix C. -/
def Interior (b : ℝ) (d : ChargeCodeParameters) : Prop :=
  AdmissibleCodeSizes d ∧ b ≤ (d.alpha : ℝ)/d.n ∧ ((d.alpha : ℝ)+d.k)/d.n ≤ 1-b ∧
    d.t ≤ d.alpha ∧ d.alpha + d.k ≤ d.n-d.t

/-- Negative/too-large signed binomial lower indices give zero, never Nat truncation. -/
def chooseZ (n : ℕ) (q : ℤ) : ℝ :=
  if 0 ≤ q ∧ q ≤ (n : ℤ) then (n.choose q.toNat : ℝ) else 0

/-- PDF p.7: Hamming-weight sector projector. Invalid sectors vanish. -/
def weightSectorProjector (n : ℕ) (q : ℤ) : (Matrix (Qubits n) (Qubits n) ℂ) :=
  Matrix.diagonal fun x => if (hammingWeight x : ℤ) = q then 1 else 0

/-- PDF p.20: constructed joint averaged Choi state, reference first. -/
def averageChoi (n k alpha : ℕ) : Matrix (Qubits k × Qubits n) (Qubits k × Qubits n) ℂ :=
  ∑ j ∈ Finset.range (k+1), (((2 : ℝ)^k)⁻¹ / chooseZ n (j+alpha) : ℂ) •
    Matrix.kronecker (weightSectorProjector k j) (weightSectorProjector n (j+alpha))

/-- PDF p.21: constructed first-t-wire marginal of averageChoi. -/
def reducedAverage (n k alpha t : ℕ) :
    Matrix (Qubits k × Qubits t) (Qubits k × Qubits t) ℂ :=
  ∑ j ∈ Finset.range (k+1), ∑ i ∈ Finset.range (t+1),
    ((((2 : ℝ)^k)⁻¹ * chooseZ (n-t) ((j : ℤ)+alpha-i) /
      chooseZ n ((j : ℤ)+alpha) : ℝ) : ℂ) •
      Matrix.kronecker (weightSectorProjector k j) (weightSectorProjector t i)

/-- Eq.(27), PDF p.21. -/
def averageSectorWeight (n k alpha t i : ℕ) : ℝ :=
  ((2 : ℝ)^k)⁻¹ * ∑ j ∈ Finset.range (k+1),
    (k.choose j : ℝ) * chooseZ (n-t) ((j : ℤ)+alpha-i) / chooseZ n ((j : ℤ)+alpha)

/-- PDF pp.21,25: computed environment marginal, not an arbitrary state. -/
def averageZeta (n k alpha t : ℕ) : (Matrix (Qubits t) (Qubits t) ℂ) :=
  ∑ i ∈ Finset.range (t+1), (averageSectorWeight n k alpha t i : ℂ) • weightSectorProjector t i

/-- PDF p.21: I_R/2^k tensor zeta. -/
def comparisonChoi (n k alpha t : ℕ) :
    Matrix (Qubits k × Qubits t) (Qubits k × Qubits t) ℂ :=
  Matrix.kronecker (((((2 : ℝ)^k)⁻¹ : ℝ) : ℂ) • (1 : (Matrix (Qubits k) (Qubits k) ℂ))) (averageZeta n k alpha t)

/-- PDF p.25: computed averaged environment output of a basis input. -/
def averageBasis {k : ℕ} (n alpha t : ℕ) (x : Qubits k) : (Matrix (Qubits t) (Qubits t) ℂ) :=
  ∑ i ∈ Finset.range (t+1),
    ((chooseZ (n-t) ((hammingWeight x : ℤ)+alpha-i) /
      chooseZ n ((hammingWeight x : ℤ)+alpha) : ℝ) : ℂ) • weightSectorProjector t i

/-- PDF p.25: the actual full physical average, before taking any marginal. -/
def averageEncodedUnit {k : ℕ} (n alpha : ℕ) (x y : Qubits k) : (Matrix (Qubits n) (Qubits n) ℂ) :=
  if x = y then ((chooseZ n ((hammingWeight x : ℤ)+alpha))⁻¹ : ℂ) •
    weightSectorProjector n ((hammingWeight x : ℤ)+alpha) else 0

/-- PDF p.25: averaged environment matrix unit. -/
def averageMatrixUnit {k : ℕ} (n alpha t : ℕ) (x y : Qubits k) : (Matrix (Qubits t) (Qubits t) ℂ) :=
  if x = y then averageBasis n alpha t x else 0

/-- PDF p.25: finite maximum auxiliary averaged-basis error. -/
def averageWorst (n k alpha t : ℕ) : ℝ :=
  sSup {p : ℝ | ∃ x : Qubits k,
    p = purified (averageBasis n alpha t x) (averageZeta n k alpha t)}

/-- Lemma 2, PDF pp.10–11: uniform polynomial prefactors, with n/4 and n/2.
No entropy conclusion is inserted as an assumption. -/
def ConcentrationGuarantee (L : (n : ℕ) → Measure ((Matrix.unitaryGroup (Qubits n) ℂ)) → Prop) : Prop :=
  ∀ b : ℝ, 0 < b → b < 1/2 → ∃ C : ℝ, 0 < C ∧ ∃ D : ℕ,
    ∀ d : ℕ → ChargeCodeParameters, Tendsto (fun i => (d i).n) atTop atTop →
      (∀ᶠ i in atTop, Interior b (d i)) → ∃ N : ℕ, ∀ i ≥ N,
      ∀ A : Ancilla (d i).n (d i).k (d i).alpha,
      ∀ mu : Measure ((Matrix.unitaryGroup (Qubits (d i).n) ℂ)), L (d i).n mu →
      ∀ S : Finset (Fin (d i).n), S.card = (d i).t →
      ∀ epsilon delta deltaPrime : ℝ, 0 ≤ epsilon → 0 < delta → 0 < deltaPrime →
      ∀ zeta : (Matrix (Qubits (d i).t) (Qubits (d i).t) ℂ), IsDensityMatrix zeta →
      (∀ x : Qubits (d i).k, purified (averageBasis (d i).n (d i).alpha (d i).t x) zeta ≤ epsilon) →
      mu {U | epsilon + delta + (2 : ℝ)^(d i).k * Real.sqrt deltaPrime <
        siteError true A S U} ≤ ENNReal.ofReal
        (C * ((d i).n : ℝ)^D *
          ((2 : ℝ)^((d i).k - ((d i).n : ℝ)/4 * endpointEntropy (d i) + (d i).t/2) / delta +
           (2 : ℝ)^(2*(d i).k - ((d i).n : ℝ)/2 * endpointEntropy (d i) + (d i).t) / deltaPrime))

/-- PDF p.12: one exceptional set for all sites and all flagged classical mixtures. -/
def PatternGuarantee (L : (n : ℕ) → Measure ((Matrix.unitaryGroup (Qubits n) ℂ)) → Prop) : Prop :=
  ∀ worst : Bool, ∀ a : ℝ, 0 < a → a < 1 → ∃ C : ℝ, 0 < C ∧ ∃ c : ℝ, 0 < c ∧
    ∀ d : ℕ → ChargeCodeParameters, LinearSequence a d →
      Tendsto (fun i => relativeRemainder worst (d i)) atTop (nhds 0) →
      ∃ N : ℕ, ∀ i ≥ N, ∀ A : Ancilla (d i).n (d i).k (d i).alpha,
      ∀ mu : Measure ((Matrix.unitaryGroup (Qubits (d i).n) ℂ)), L (d i).n mu →
      let B := leadingError worst a (d i) * (1 + C * relativeRemainder worst (d i))
      (∀ p : Finset (Fin (d i).n) → ℝ, PatternLaw (d i).n (d i).t p →
        Integrable (mixtureError worst A p) mu ∧ (∫ U, mixtureError worst A p U ∂mu) ≤ B) ∧
      mu {U | (∃ S : Finset (Fin (d i).n), S.card = (d i).t ∧ B < siteError worst A S U) ∨
        (∃ p : Finset (Fin (d i).n) → ℝ, PatternLaw (d i).n (d i).t p ∧
          B < mixtureError worst A p U)} ≤ ENNReal.ofReal (Real.exp (-c * (d i).n))

/-- PDF p.14: matrix-entry (r,r) moments, including cross-sector correlations. -/
def unitaryEntryMoment {n : ℕ} (r : ℕ) (a b c d : Fin r → Qubits n) (U : (Matrix.unitaryGroup (Qubits n) ℂ)) : ℂ :=
  (∏ i, (U : (Matrix (Qubits n) (Qubits n) ℂ)) (a i) (b i)) * conj (∏ i, (U : (Matrix (Qubits n) (Qubits n) ℂ)) (c i) (d i))

/-- PDF pp.14–15: exact full symmetric second twirl and its first twirl. -/
def ExactDesign (n : ℕ) (mu : Measure ((Matrix.unitaryGroup (Qubits n) ℂ))) : Prop :=
  IsProbabilityMeasure mu ∧ (∀ᵐ (U : Matrix.unitaryGroup (Qubits n) ℂ) ∂mu, Conserves U) ∧
    ∃ nu : Measure ((Matrix.unitaryGroup (Qubits n) ℂ)), ChargeHaar n nu ∧
      ∀ r ∈ ({1,2} : Finset ℕ), ∀ a b c d : Fin r → Qubits n,
        Integrable (unitaryEntryMoment r a b c d) mu ∧ Integrable (unitaryEntryMoment r a b c d) nu ∧
        (∫ U, unitaryEntryMoment r a b c d U ∂mu) = ∫ U, unitaryEntryMoment r a b c d U ∂nu

/-- PDF p.18, Eq.(24): feasible for all PSD rho on finite nonempty registers,
with traces bounded below. Block inputs may be subnormalized or zero. -/
def minSdp {P Q : Type*} [Fintype P] [Fintype Q] [DecidableEq P] [DecidableEq Q]
    (rho : Matrix (P × Q) (P × Q) ℂ) : ℝ :=
  sInf {s : ℝ | ∃ sigma : Matrix Q Q ℂ, sigma.PosSemidef ∧
    (Matrix.kronecker (1 : Matrix P P ℂ) sigma - rho).PosSemidef ∧ s = sigma.trace.re}

/-- PDF p.17: diagonal F on equal-charge A,Abar pairs. Its unused orthogonal
complement adds only zero rows on the unconditioned side. -/
def decouplingFactor (n : ℕ) (a b : Qubits n) : ℝ :=
  if hammingWeight a = hammingWeight b then
    Real.sqrt ((2 : ℝ)^n / chooseZ n (hammingWeight a)) else 0

/-- PDF p.18: normalized Choi matrix of tracing out the last n-t wires. -/
def erasureChoi (n t : ℕ) : Matrix (Qubits n × Qubits t) (Qubits n × Qubits t) ℂ :=
  Matrix.of fun p q =>
    if (∀ i : Fin t, ∀ h : i.val < n, p.1 ⟨i.val,h⟩ = p.2 i ∧ q.1 ⟨i.val,h⟩ = q.2 i) ∧
      (∀ i : Fin n, t ≤ i.val → p.1 i = q.1 i) then (((2 : ℝ)^n)⁻¹ : ℂ) else 0

/-- Lemma 3, PDF p.17: F(Psi tensor tau)F†; P=(A,Abar), Q=(R,E). -/
def lambdaState {R : Type*} (n t : ℕ)
    (Psi : Matrix (R × Qubits n) (R × Qubits n) ℂ) :
    Matrix ((Qubits n × Qubits n) × (R × Qubits t))
      ((Qubits n × Qubits n) × (R × Qubits t)) ℂ :=
  Matrix.of fun p q =>
    (decouplingFactor n p.1.1 p.1.2 : ℂ) * (decouplingFactor n q.1.1 q.1.2 : ℂ) *
      Psi (p.2.1,p.1.1) (q.2.1,q.1.1) * erasureChoi n t (p.1.2,p.2.2) (q.1.2,q.2.2)

/-- PDF p.17: pre-U Choi input with the fixed ancilla. -/
def ancillaChoiInput {n k alpha : ℕ} (A : Ancilla n k alpha) :
    Matrix (Qubits k × Qubits n) (Qubits k × Qubits n) ℂ :=
  idTensorSuperop (R := Qubits k) (chargeEncoder A 1) (pureDensity (maxEntangled k))

/-- Appendix A's entropy of the constructed Lambda state. -/
def choiEntropy {n k alpha : ℕ} (A : Ancilla n k alpha) (t : ℕ) : EReal :=
  minEntropy (lambdaState n t (ancillaChoiInput A))

/-- Appendix C: normalized logical v appended with the ancilla, trivial reference. -/
def basisInput {n k alpha : ℕ} (A : Ancilla n k alpha)
    (v : EuclideanSpace ℂ (Qubits k)) : Matrix (Unit × Qubits n) (Unit × Qubits n) ℂ :=
  Matrix.of fun p q => chargeEncoder A 1 (pureDensity v) p.2 q.2

/-- PDF pp.23–24: entropy for a basis or two-basis input. -/
def decouplingInputEntropy {n k alpha : ℕ} (A : Ancilla n k alpha) (t : ℕ)
    (v : EuclideanSpace ℂ (Qubits k)) : EReal :=
  minEntropy (lambdaState n t (basisInput A v))

/-- PDF p.20, Eq.(26): all actual residual sectors, signed binomial indices,
positive denominator sectors under alpha≤n-k. -/
def choiSectorKappa (n k alpha t : ℕ) : ℝ :=
  ∑ i ∈ Finset.range (n-t+1), (∑ j ∈ Finset.range (k+1),
    chooseZ t ((j : ℤ)+alpha-i) * (k.choose j : ℝ) /
      Real.sqrt ((2 : ℝ)^k * chooseZ n ((j : ℤ)+alpha)))^2

/-- PDF p.24: sum of squares over valid residual sectors. -/
def basisKappa (n q t : ℕ) : ℝ :=
  (∑ i ∈ Finset.range (n-t+1), (chooseZ t ((q : ℤ)-i))^2) / chooseZ n q

/-- PDF p.23: four superpositions; x≠y ensures norm one. -/
def twoBasis {k : ℕ} (x y : Qubits k) (imaginary negative : Bool) :
    EuclideanSpace ℂ (Qubits k) :=
  ((Real.sqrt 2)⁻¹ : ℂ) • (ket x +
    ((if negative then -1 else 1) * (if imaginary then Complex.I else 1) : ℂ) • ket y)

/-- Lemma 4, PDF p.19: construct the orthogonal-block operator in order (P1,P2),Q. -/
def orthogonalBlockOperator {P1 P2 Q : Type*} {m : ℕ}
    (Pi : Fin m → Matrix P1 P1 ℂ) (rho : Fin m → Matrix (P2 × Q) (P2 × Q) ℂ) :
    Matrix ((P1 × P2) × Q) ((P1 × P2) × Q) ℂ :=
  Matrix.of fun p q => ∑ i, Pi i p.1.1 q.1.1 * rho i (p.1.2,p.2) (q.1.2,q.2)

/-- PDF p.13: uniformly random single erasure with known location. -/
def singleErasureLaw (n : ℕ) (S : Finset (Fin n)) : ℝ :=
  if S.card = 1 then (n : ℝ)⁻¹ else 0

/-- Eq.(21), PDF p.13: ceil(k/2)=(k+1)/2; lower coefficient cited from [11]. -/
def choiLowerCoefficient (k : ℕ) : ℝ :=
  ((k.choose ((k+1)/2) : ℝ) * (((k+1)/2 : ℕ) : ℝ)) / (2 : ℝ)^k

/-- PDF p.12: common charge-dependent leading factor. -/
def chargeCoefficient (a : ℝ) : ℝ := (4 * Real.sqrt (a*(1-a)))⁻¹

example : chooseZ 3 (-1) = 0 := by norm_num [chooseZ]

example : chooseZ 3 4 = 0 := by norm_num [chooseZ]

example : chooseZ 3 0 = 1 := by norm_num [chooseZ]

example : chargeCoefficient (1/2) = 1/2 := by norm_num [chargeCoefficient]

example : choiLowerCoefficient 1 = 1/2 := by norm_num [choiLowerCoefficient]

example : binEntropy2 0 = 0 := by simp [QAlgorithms.binEntropy2]

example {n : ℕ} (S : Finset (Fin n)) (rho : (Matrix (Qubits n) (Qubits n) ℂ)) (u v : BitsOn S) :
    retain S rho u v = ∑ z : BitsOn Sᶜ, rho (joinBits S u z) (joinBits S v z) := rfl

example {k : ℕ} (n alpha t : ℕ) (x y : Qubits k) (h : x ≠ y) :
    averageMatrixUnit n alpha t x y = 0 := by simp [averageMatrixUnit,h]

example (worst : Bool) (a : ℝ) (n alpha : ℕ) :
    leadingError worst a ⟨n,0,alpha,0⟩ = 0 := by cases worst <;> simp [leadingError]

/-- Sanity: the zero group angle acts as identity on every basis amplitude. -/
example (n : ℕ) (x : Qubits n) : chargeRotation n 0 x x = 1 := by simp [chargeRotation]

/-- Sanity: the physical charge has the source's eigenvalues on basis strings. -/
example (n : ℕ) (x : Qubits n) : hammingCharge n x x = (hammingWeight x : ℂ) := by simp [hammingCharge]

/-- Sanity: the trivial complementary-channel Choi state is normalized. -/
example : erasureChoi 0 0 (fun _ => false, fun _ => false)
    (fun _ => false, fun _ => false) = 1 := by simp [erasureChoi]

/-- Sanity: the scalar F on the zero-qubit charge sector is one. -/
example : decouplingFactor 0 (fun _ => false) (fun _ => false) = 1 := by
  norm_num [decouplingFactor, chooseZ, hammingWeight]

/-- Sanity: a zero moment order has no spurious sector-phase restriction. -/
example {n : ℕ} (a b c d : Fin 0 → Qubits n) (U : (Matrix.unitaryGroup (Qubits n) ℂ)) :
    unitaryEntryMoment 0 a b c d U = 1 := by simp [unitaryEntryMoment]

/-- Sanity: a distinct-input averaged physical coherence is zero. -/
example {k : ℕ} (n alpha : ℕ) (x y : Qubits k) (h : x ≠ y) :
    averageEncodedUnit n alpha x y = 0 := by simp [averageEncodedUnit,h]

/-- Join the first t wires and last n-t wires with the exact size equality. -/
def joinFirst (n t : ℕ) (h : t ≤ n) (u : Qubits t) (v : Qubits (n-t)) : Qubits n :=
  fun i => Fin.append u v (Fin.cast (Nat.add_sub_of_le h).symm i)

/-- The actual first-t-wire marginal, used to identify the constructed averages. -/
def firstTrace (n t : ℕ) (h : t ≤ n) : Superop (Qubits n) (Qubits t) :=
  fun rho => Matrix.of fun u v => ∑ z : Qubits (n-t),
    rho (joinFirst n t h u z) (joinFirst n t h v z)

/-- Appendix A, PDF p.20: alpha=a*n with fixed 0<a<1. The source permits
all legal k,t, including alpha+k=n; no compact upper-endpoint margin is assumed. -/
def ChoiEntropyGrowth : Prop :=
  ∀ a : ℝ, 0 < a → a < 1 → ∃ C : ℝ, 0 < C ∧ ∃ N : ℕ,
    ∀ d : ChargeCodeParameters, N ≤ d.n → 1 ≤ d.n → d.t ≤ d.n →
      (d.alpha : ℝ) = a * d.n → ∀ A : Ancilla d.n d.k d.alpha,
      ((d.n * endpointEntropy d - 2*d.t - d.k - C*Real.logb 2 (d.n+1) : ℝ) : EReal) ≤
        choiEntropy A d.t

/-- Appendix A, PDF p.20: the explicit Omega(n) corollary with k^2t^2=O(n).
The exponent constant depends only on a; the threshold may depend on the sequence
and its eventual O(n) constant. Ancilla choices remain uniform. -/
def ChoiEntropyLinear : Prop :=
  ∀ a : ℝ, 0 < a → a < 1 → ∃ c : ℝ, 0 < c ∧
    ∀ d : ℕ → ChargeCodeParameters, LinearSequence a d →
      (∃ K : ℝ, 0 < K ∧ ∀ᶠ i in atTop, relativeRemainder false (d i) ≤ K) →
      ∃ N : ℕ, ∀ i ≥ N, ∀ A : Ancilla (d i).n (d i).k (d i).alpha,
        ((c*(d i).n : ℝ) : EReal) ≤ choiEntropy A (d i).t

/-- Appendix D, PDF p.25: equality to leading order, not a finite exact correction. -/
def AverageWorstExpansion : Prop :=
  ∀ a : ℝ, 0 < a → a < 1 → ∃ C : ℝ, 0 < C ∧
    ∀ d : ℕ → ChargeCodeParameters, LinearSequence a d →
      Tendsto (fun i => relativeRemainder true (d i)) atTop (nhds 0) →
      ∃ N : ℕ, ∀ i ≥ N,
        |averageWorst (d i).n (d i).k (d i).alpha (d i).t /
          leadingError true a (d i) - 1| ≤ C * relativeRemainder true (d i)

/-- PDF p.13: ratios for mean flagged single-erasure errors. The sequence may
have growing k in the worst metric; the Choi equality is only claimed at k=1. -/
def OptimalSingleLimit (worst : Bool) : Prop :=
  ∀ d : ℕ → ChargeCodeParameters, LinearSequence (1/2) d →
    (∀ i, (d i).t = 1 ∧ Even (d i).n) →
    (if worst then Tendsto (fun i => ((d i).k : ℝ)/(d i).n) atTop (nhds 0)
     else ∀ i, (d i).k = 1) →
    ∀ A : (i : ℕ) → Ancilla (d i).n (d i).k (d i).alpha,
    ∀ mu : (i : ℕ) → Measure ((Matrix.unitaryGroup (Qubits (d i).n) ℂ)), (∀ i, ChargeHaar (d i).n (mu i)) →
      Tendsto (fun i => (∫ U, mixtureError worst (A i) (singleErasureLaw (d i).n) U ∂(mu i)) /
        leadingError worst (1/2) (d i)) atTop (nhds 1)

end QAlgorithms.Papers.Independent.Extend50.P03
Source
Charge-conserving unitaries typically generate optimal covariant quantum error-correcting codes, arXiv:2102.11835v1, https://arxiv.org/abs/2102.11835v1
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

QAlgorithms.Papers.Independent.Extend50.P03.AdmissibleCodeSizes

For any record ddd consisting of natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, this property means exactly 1≤n1\leq n1≤n, 1≤k1\leq k1≤k, k≤nk\leq nk≤n, α≤n−k\alpha\leq n-kα≤n−k, 1≤t1\leq t1≤t, and t≤nt\leq nt≤n. The subtraction n−kn-kn−k is natural-number subtraction, truncated at zero, although the accompanying condition k≤nk\leq nk≤n makes it ordinary subtraction here. Thus n,k,tn,k,tn,k,t must be positive, while α=0\alpha=0α=0 is allowed; in particular, k=nk=nk=n forces α=0\alpha=0α=0, and t=nt=nt=n is permitted.

QAlgorithms.Papers.Independent.Extend50.P03.Ancilla

For natural numbers n,k,αn,k,\alphan,k,α, an object of this structure consists of proofs that k≤nk\le nk≤n and α≤n−k\alpha\le n-kα≤n−k, together with a complex vector ψ\psiψ indexed by (n−k)(n-k)(n−k)-bit strings, satisfying ∥ψ∥2=1\|\psi\|_2=1∥ψ∥2​=1 and Hn−kψ=αψH_{n-k}\psi=\alpha\psiHn−k​ψ=αψ, where Hn−kH_{n-k}Hn−k​ is diagonal with entries counting true bits and its action is ordinary matrix-vector multiplication. Equivalently, ∣x∣ψx=αψx|x|\psi_x=\alpha\psi_x∣x∣ψx​=αψx​ at every such string xxx. If n=kn=kn=k, the requirements force α=0\alpha=0α=0, and ψ\psiψ has a single coordinate of modulus one; parameters violating either required inequality admit no object of this structure.

QAlgorithms.Papers.Independent.Extend50.P03.AsymptoticGuarantee

For an arbitrary predicate L(n,μ)L(n,\mu)L(n,μ) on natural numbers and measures on the unitary group of CQn\mathbb C^{Q_n}CQn​, where Qj={0,1}jQ_j=\{0,1\}^jQj​={0,1}j, and a fixed Boolean worst\mathrm{worst}worst, this property means the following: for every real 0<a<10<a<10<a<1, there exist constants C>0C>0C>0 and c>0c>0c>0 such that, for every sequence di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​) of natural-number quadruples with ni→+∞n_i\to+\inftyni​→+∞, 1≤ki≤ni1\le k_i\le n_i1≤ki​≤ni​, αi≤ni−ki\alpha_i\le n_i-k_iαi​≤ni​−ki​, 1≤ti≤ni1\le t_i\le n_i1≤ti​≤ni​, and αi=ani\alpha_i=a n_iαi​=ani​ at every index, if Ri→0R_i\to0Ri​→0, where Ri=kiti2/niR_i=k_it_i^2/n_iRi​=ki​ti2​/ni​ when worst=true\mathrm{worst}=\mathrm{true}worst=true and Ri=ki2ti2/niR_i=k_i^2t_i^2/n_iRi​=ki2​ti2​/ni​ otherwise, then there exists N0∈NN_0\in\mathbb NN0​∈N such that the following holds for every i≥N0i\ge N_0i≥N0​. For every norm-one ancilla ψ∈CQni−ki\psi\in\mathbb C^{Q_{n_i-k_i}}ψ∈CQni​−ki​​ satisfying Hψ=αiψH\psi=\alpha_i\psiHψ=αi​ψ, where Hxx=∣x∣H_{xx}=|x|Hxx​=∣x∣ counts the ones in xxx, every measure μ\muμ satisfying L(ni,μ)L(n_i,\mu)L(ni​,μ), and every coordinate subset SSS with ∣S∣=ti|S|=t_i∣S∣=ti​, the function e(U)e(U)e(U) described below is integrable and

∫e(U) dμ(U)≤Bi,μ{U:Bi<e(U)}≤e−cni,Bi={kiti,worst=true,tiki,worst=false4nia(1−a)(1+CRi).\int e(U)\,d\mu(U)\le B_i,\qquad \mu\{U:B_i<e(U)\}\le e^{-cn_i}, \quad B_i=\frac{\begin{cases}k_i\sqrt{t_i},&\mathrm{worst}=\mathrm{true},\\ \sqrt{t_ik_i},&\mathrm{worst}=\mathrm{false}\end{cases}} {4n_i\sqrt{a(1-a)}}(1+CR_i).∫e(U)dμ(U)≤Bi​,μ{U:Bi​<e(U)}≤e−cni​,Bi​=4ni​a(1−a)​{ki​ti​​,ti​ki​​,​worst=true,worst=false​​(1+CRi​).

The measure inequality is in the extended nonnegative reals. To define e(U)e(U)e(U), let NUN_UNU​ encode ρ\rhoρ as U(ρ⊗ψψ∗)U∗U(\rho\otimes\psi\psi^*)U^*U(ρ⊗ψψ∗)U∗ and then trace out SSS, and put F(X,Y)=Re⁡tr⁡X YXF(X,Y)=\operatorname{Re}\operatorname{tr}\sqrt{\sqrt X\,Y\sqrt X}F(X,Y)=RetrX​YX​​, using continuous functional calculus for square roots. For worst=false\mathrm{worst}=\mathrm{false}worst=false, e(U)=1−fU2e(U)=\sqrt{1-f_U^2}e(U)=1−fU2​​, where fU=sup⁡DF(Φki,(id⊗(D∘NU))(Φki))f_U=\sup_D F(\Phi_{k_i},(\mathrm{id}\otimes(D\circ N_U))(\Phi_{k_i}))fU​=supD​F(Φki​​,(id⊗(D∘NU​))(Φki​​)), Φk=ϕkϕk∗\Phi_k=\phi_k\phi_k^*Φk​=ϕk​ϕk∗​, and ϕk=2−k/2∑x∈Qk∣x,x⟩\phi_k=2^{-k/2}\sum_{x\in Q_k}|x,x\rangleϕk​=2−k/2∑x∈Qk​​∣x,x⟩. For worst=true\mathrm{worst}=\mathrm{true}worst=true, fUf_UfU​ is instead sup⁡Dinf⁡r,ρF(ρ,(idr+1⊗(D∘NU))(ρ))\sup_D\inf_{r,\rho}F(\rho,(\mathrm{id}_{r+1}\otimes(D\circ N_U))(\rho))supD​infr,ρ​F(ρ,(idr+1​⊗(D∘NU​))(ρ)), with r∈Nr\in\mathbb Nr∈N and ρ\rhoρ ranging over positive semidefinite, trace-one matrices on Cr+1⊗CQki\mathbb C^{r+1}\otimes\mathbb C^{Q_{k_i}}Cr+1⊗CQki​​. Each decoder DDD is a finite Kraus map X↦∑jKjXKj∗X\mapsto\sum_jK_jXK_j^*X↦∑j​Kj​XKj∗​ with ∑jKj∗Kj=I\sum_jK_j^*K_j=I∑j​Kj∗​Kj​=I. The constants precede the sequence quantifier, and N0N_0N0​ precedes the ancilla, measure, and subset quantifiers. No probability, invariance, or support condition on μ\muμ is imposed separately from LLL; if no sequence satisfies the exact charge equalities, the requirement for that aaa is vacuous.

QAlgorithms.Papers.Independent.Extend50.P03.AverageWorstExpansion

This proposition says that for every real a∈(0,1)a\in(0,1)a∈(0,1), there exists a real C>0C>0C>0 such that, for every sequence of natural-number tuples di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​) satisfying ni→∞n_i\to\inftyni​→∞,

1≤ni,1≤ki≤ni,αi≤ni−ki,1≤ti≤ni,αi=ani1\leq n_i,\quad 1\leq k_i\leq n_i,\quad \alpha_i\leq n_i-k_i,\quad 1\leq t_i\leq n_i,\quad \alpha_i=a n_i1≤ni​,1≤ki​≤ni​,αi​≤ni​−ki​,1≤ti​≤ni​,αi​=ani​

at every index, and satisfying kiti2/ni→0k_i t_i^2/n_i\to0ki​ti2​/ni​→0, there is a natural number NNN such that for all i≥Ni\geq Ni≥N,

∣W(ni,ki,αi,ti)kiti/(4nia(1−a))−1∣≤C kiti2ni.\left| \frac{W(n_i,k_i,\alpha_i,t_i)} {k_i\sqrt{t_i}/\bigl(4n_i\sqrt{a(1-a)}\bigr)} -1\right| \leq C\,\frac{k_i t_i^2}{n_i}.​ki​ti​​/(4ni​a(1−a)​)W(ni​,ki​,αi​,ti​)​−1​≤Cni​ki​ti2​​.

To define WWW, let Qs={0,1}sQ_s=\{0,1\}^sQs​={0,1}s, let Πs,ℓ\Pi_{s,\ell}Πs,ℓ​ be the diagonal projector onto strings of Hamming weight ℓ\ellℓ, and use the convention (Nq)=0\binom Nq=0(qN​)=0 for integers q∉[0,N]q\notin[0,N]q∈/[0,N]. Set

σx=∑ℓ=0t(n−t∣x∣+α−ℓ)(n∣x∣+α)Πt,ℓ,ζ=2−k∑j=0k(kj)∑ℓ=0t(n−tj+α−ℓ)(nj+α)Πt,ℓ,\sigma_x=\sum_{\ell=0}^{t} \frac{\binom{n-t}{|x|+\alpha-\ell}}{\binom n{|x|+\alpha}}\Pi_{t,\ell}, \qquad \zeta=2^{-k}\sum_{j=0}^{k}\binom kj \sum_{\ell=0}^{t} \frac{\binom{n-t}{j+\alpha-\ell}}{\binom n{j+\alpha}}\Pi_{t,\ell},σx​=ℓ=0∑t​(∣x∣+αn​)(∣x∣+α−ℓn−t​)​Πt,ℓ​,ζ=2−kj=0∑k​(jk​)ℓ=0∑t​(j+αn​)(j+α−ℓn−t​)​Πt,ℓ​,

and

W(n,k,α,t)=sup⁡x∈Qk1−f(σx,ζ)2,f(X,Y)=Re⁡Tr⁡X Y X.W(n,k,\alpha,t)= \sup_{x\in Q_k}\sqrt{1-f(\sigma_x,\zeta)^2}, \qquad f(X,Y)=\operatorname{Re}\operatorname{Tr} \sqrt{\sqrt X\,Y\,\sqrt X}.W(n,k,α,t)=x∈Qk​sup​1−f(σx​,ζ)2​,f(X,Y)=ReTrX​YX​​.

The matrix square roots here are given by continuous functional calculus. The displayed denominator is positive under the sequence hypotheses. The exact integer relation αi=ani\alpha_i=a n_iαi​=ani​ is part of the hypotheses, so the implication is vacuous when no such sequence exists.

QAlgorithms.Papers.Independent.Extend50.P03.BitsOn

For every natural number nnn and finite subset S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1}, this abbreviation denotes the type of all Boolean-valued functions on the elements of SSS, namely assignments of one bit to each index belonging to SSS. If SSS is empty, including necessarily when n=0n=0n=0, there is exactly one such assignment: the empty function.

QAlgorithms.Papers.Independent.Extend50.P03.ChargeCodeParameters

This structure consists of four natural numbers nnn, kkk, α\alphaα, and ttt. It imposes no additional conditions or relations among them: each may be 000, and inequalities such as k≤nk\leq nk≤n, α≤n−k\alpha\leq n-kα≤n−k, or t≤nt\leq nt≤n are not required by the structure.

QAlgorithms.Papers.Independent.Extend50.P03.ChargeHaar

For every natural number nnn and measure μ\muμ on the unitary group indexed by nnn-bit strings, with its Borel measurable structure, this predicate requires that μ\muμ have total mass one, that UHn=HnUUH_n=H_nUUHn​=Hn​U for μ\muμ-almost every UUU, and that for every unitary VVV satisfying VHn=HnVVH_n=H_nVVHn​=Hn​V, the pushforward of μ\muμ under U↦VUU\mapsto VUU↦VU equal μ\muμ. Here HnH_nHn​ is diagonal with entries equal to the number of true bits in each string. The definition includes n=0n=0n=0, when the commutation conditions hold for every unitary.

QAlgorithms.Papers.Independent.Extend50.P03.ChargeInterior

For a real number bbb and a quadruple d=(n,k,α,t)d=(n,k,\alpha,t)d=(n,k,α,t) of natural numbers, this property is exactly

1≤n,k≤n,α≤n−k,t≤n,b≤αn,α+kn≤1−b.1\le n,\qquad k\le n,\qquad \alpha\le n-k,\qquad t\le n,\qquad b\le\frac{\alpha}{n},\qquad \frac{\alpha+k}{n}\le1-b.1≤n,k≤n,α≤n−k,t≤n,b≤nα​,nα+k​≤1−b.

Natural-number subtraction is truncated at zero, though k≤nk\le nk≤n prevents truncation here. Neither kkk nor ttt is required to be positive, and no separate restriction is imposed on bbb.

QAlgorithms.Papers.Independent.Extend50.P03.ChoiEntropyGrowth

This proposition states that, for every real aaa with 0<a<10<a<10<a<1, there exist a real C>0C>0C>0 and a natural number NNN such that the following holds uniformly over natural parameters d=(n,k,α,t)d=(n,k,\alpha,t)d=(n,k,α,t): if N≤nN\le nN≤n, 1≤n1\le n1≤n, t≤nt\le nt≤n, and α=an\alpha=anα=an exactly, then every ancilla AAA satisfying k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, ∥ψA∥=1\|\psi_A\|=1∥ψA​∥=1, and Qn−kψA=αψAQ_{n-k}\psi_A=\alpha\psi_AQn−k​ψA​=αψA​, where QjQ_jQj​ is diagonal with entry ∣z∣|z|∣z∣, the number of ones in z∈{0,1}jz\in\{0,1\}^jz∈{0,1}j, satisfies

nmin⁡ ⁣{H2 ⁣(αn),H2 ⁣(α+kn)}−2t−k−Clog⁡2(n+1) ≤ Hmin⁡(ΛA).n\min\!\left\{H_2\!\left(\frac{\alpha}{n}\right),H_2\!\left(\frac{\alpha+k}{n}\right)\right\} -2t-k-C\log_2(n+1)\ \le\ H_{\min}(\Lambda_A).nmin{H2​(nα​),H2​(nα+k​)}−2t−k−Clog2​(n+1) ≤ Hmin​(ΛA​).

Here H2(u)=binEntropy⁡(u)/log⁡2H_2(u)=\operatorname{binEntropy}(u)/\log 2H2​(u)=binEntropy(u)/log2. To specify the right-hand side, write z=(zL,zA)z=(z_L,z_A)z=(zL​,zA​) for the first kkk and last n−kn-kn−k bits of an nnn-bit string, and define

ΨA((r,z),(s,w))=2−k1{zL=r}1{wL=s}ψA(zA)ψA(wA)‾(r,s∈{0,1}k).\Psi_A((r,z),(s,w)) =2^{-k}\mathbf1_{\{z_L=r\}}\mathbf1_{\{w_L=s\}} \psi_A(z_A)\overline{\psi_A(w_A)} \quad(r,s\in\{0,1\}^k).ΨA​((r,z),(s,w))=2−k1{zL​=r}​1{wL​=s}​ψA​(zA​)ψA​(wA​)​(r,s∈{0,1}k).

For u,v∈{0,1}nu,v\in\{0,1\}^nu,v∈{0,1}n, put fn(u,v)=2n/(n∣u∣)f_n(u,v)=\sqrt{2^n/\binom n{|u|}}fn​(u,v)=2n/(∣u∣n​)​ when ∣u∣=∣v∣|u|=|v|∣u∣=∣v∣, and fn(u,v)=0f_n(u,v)=0fn​(u,v)=0 otherwise. For z,z′∈{0,1}tz,z'\in\{0,1\}^tz,z′∈{0,1}t, let

Jn,t((v,z),(v′,z′))=2−n1{v<t=z, v<t′=z′, v≥t=v≥t′},J_{n,t}((v,z),(v',z')) =2^{-n}\mathbf1_{\{v_{<t}=z,\ v'_{<t}=z',\ v_{\ge t}=v'_{\ge t}\}},Jn,t​((v,z),(v′,z′))=2−n1{v<t​=z, v<t′​=z′, v≥t​=v≥t′​}​,

and define the matrix ΛA\Lambda_AΛA​, whose two grouped registers are indexed by (u,v)(u,v)(u,v) and (r,z)(r,z)(r,z), by

ΛA(((u,v),(r,z)),((u′,v′),(s,z′)))=fn(u,v)fn(u′,v′)ΨA((r,u),(s,u′))Jn,t((v,z),(v′,z′)).\Lambda_A\bigl(((u,v),(r,z)),((u',v'),(s,z'))\bigr) =f_n(u,v)f_n(u',v')\Psi_A((r,u),(s,u')) J_{n,t}((v,z),(v',z')).ΛA​(((u,v),(r,z)),((u′,v′),(s,z′)))=fn​(u,v)fn​(u′,v′)ΨA​((r,u),(s,u′))Jn,t​((v,z),(v′,z′)).

The quantity Hmin⁡(ΛA)H_{\min}(\Lambda_A)Hmin​(ΛA​) is the supremum in the extended real numbers of all real hhh for which there exists a positive semidefinite matrix σ\sigmaσ of trace one on the (r,z)(r,z)(r,z) register such that 2−hI⊗σ−ΛA2^{-h}I\otimes\sigma-\Lambda_A2−hI⊗σ−ΛA​ is positive semidefinite. Neither kkk nor ttt is required to be positive; a zero-length bit register has one element. The equality α=an\alpha=anα=an is an exact restriction on integer parameters, so no parameter choice in this assertion exists when aaa is irrational.

QAlgorithms.Papers.Independent.Extend50.P03.ChoiEntropyLinear

This proposition says that for every real aaa with 0<a<10<a<10<a<1, there exists a real c>0c>0c>0 such that the following holds for every sequence of natural-number tuples di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​): assume ni→∞n_i\to\inftyni​→∞, and for every iii,

1≤ni,1≤ki≤ni,αi≤ni−ki,1≤ti≤ni,αi=ani;1\leq n_i,\quad 1\leq k_i\leq n_i,\quad \alpha_i\leq n_i-k_i,\quad 1\leq t_i\leq n_i,\quad \alpha_i=a n_i;1≤ni​,1≤ki​≤ni​,αi​≤ni​−ki​,1≤ti​≤ni​,αi​=ani​;

also assume there exists a real K>0K>0K>0 such that eventually ki2ti2/ni≤Kk_i^2t_i^2/n_i\leq Kki2​ti2​/ni​≤K. Then there exists a natural number NNN such that for every i≥Ni\geq Ni≥N and every unit vector ψ∈CQni−ki\psi\in\mathbb C^{Q_{n_i-k_i}}ψ∈CQni​−ki​​ supported on strings of Hamming weight αi\alpha_iαi​, one has cni≤Hmin⁡(Λi)c n_i\leq H_{\min}(\Lambda_i)cni​≤Hmin​(Λi​), as an inequality of extended real numbers. Here Qs={0,1}sQ_s=\{0,1\}^sQs​={0,1}s, and the matrix and entropy in this assertion are defined, writing n=ni,k=ki,α=αi,t=tin=n_i,k=k_i,\alpha=\alpha_i,t=t_in=ni​,k=ki​,α=αi​,t=ti​, by

J(x,z),(y,w)=2−k1{zfirst k=x,  wfirst k=y}ψ(zlast n−k)ψ(wlast n−k)‾,Dn(u,v)=1{∣u∣=∣v∣}2n(n∣u∣),J_{(x,z),(y,w)} =2^{-k}\mathbf1_{\{z_{\mathrm{first}\ k}=x,\;w_{\mathrm{first}\ k}=y\}} \psi(z_{\mathrm{last}\ n-k})\overline{\psi(w_{\mathrm{last}\ n-k})}, \qquad D_n(u,v)=\mathbf1_{\{|u|=|v|\}}\sqrt{\frac{2^n}{\binom n{|u|}}},J(x,z),(y,w)​=2−k1{zfirst k​=x,wfirst k​=y}​ψ(zlast n−k​)ψ(wlast n−k​)​,Dn​(u,v)=1{∣u∣=∣v∣}​(∣u∣n​)2n​​, Λ((u,v),(x,s)),((u′,v′),(y,s′))=Dn(u,v)Dn(u′,v′)J(x,u),(y,u′) 2−n1{vfirst t=s,  vfirst t′=s′,  vlast n−t=vlast n−t′},\Lambda_{((u,v),(x,s)),((u',v'),(y,s'))} =D_n(u,v)D_n(u',v')J_{(x,u),(y,u')}\,2^{-n} \mathbf1_{\{v_{\mathrm{first}\ t}=s,\;v'_{\mathrm{first}\ t}=s',\; v_{\mathrm{last}\ n-t}=v'_{\mathrm{last}\ n-t}\}},Λ((u,v),(x,s)),((u′,v′),(y,s′))​=Dn​(u,v)Dn​(u′,v′)J(x,u),(y,u′)​2−n1{vfirst t​=s,vfirst t′​=s′,vlast n−t​=vlast n−t′​}​, Hmin⁡(Λ)=sup⁡{h∈R:∃σ⪰0, Tr⁡σ=1, 2−hIQn×Qn⊗σ−Λ⪰0},H_{\min}(\Lambda)= \sup\left\{h\in\mathbb R:\exists \sigma\succeq0,\ \operatorname{Tr}\sigma=1,\ 2^{-h}I_{Q_n\times Q_n}\otimes\sigma-\Lambda\succeq0\right\},Hmin​(Λ)=sup{h∈R:∃σ⪰0, Trσ=1, 2−hIQn​×Qn​​⊗σ−Λ⪰0},

where σ\sigmaσ is indexed by Qk×QtQ_k\times Q_tQk​×Qt​. The bounded-remainder hypothesis requires eventual boundedness, not convergence to zero. The exact equalities αi=ani\alpha_i=a n_iαi​=ani​ are required at every index; if no integer-valued sequence satisfies them, the corresponding conditional assertion is vacuous.

QAlgorithms.Papers.Independent.Extend50.P03.ConcentrationGuarantee

For an arbitrary predicate L(n,μ)L(n,\mu)L(n,μ) on natural numbers nnn and measures on the unitary matrices of nnn qubits, this property means the following. For every real bbb with 0<b<1/20<b<1/20<b<1/2, there exist C>0C>0C>0 and a natural number DDD such that, for every sequence di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​) of natural-number quadruples with ni→∞n_i\to\inftyni​→∞ and eventually

1≤ni,1≤ki≤ni,αi≤ni−ki,1≤ti≤ni,b≤αini,αi+kini≤1−b,ti≤αi,αi+ki≤ni−ti,1\le n_i,\quad 1\le k_i\le n_i,\quad \alpha_i\le n_i-k_i,\quad 1\le t_i\le n_i,\quad b\le\frac{\alpha_i}{n_i},\quad \frac{\alpha_i+k_i}{n_i}\le1-b,\quad t_i\le\alpha_i,\quad \alpha_i+k_i\le n_i-t_i,1≤ni​,1≤ki​≤ni​,αi​≤ni​−ki​,1≤ti​≤ni​,b≤ni​αi​​,ni​αi​+ki​​≤1−b,ti​≤αi​,αi​+ki​≤ni​−ti​,

there is N∈NN\in\mathbb NN∈N such that the following holds for every i≥Ni\ge Ni≥N. Put n=ni,k=ki,α=αi,t=tin=n_i,k=k_i,\alpha=\alpha_i,t=t_in=ni​,k=ki​,α=αi​,t=ti​. Take any ancilla vector ψ\psiψ on n−kn-kn−k qubits with norm one and Hn−kψ=αψH_{n-k}\psi=\alpha\psiHn−k​ψ=αψ, where HsH_sHs​ is diagonal with the Hamming weights of sss-bit strings; the ancilla data also include k≤nk\le nk≤n and α≤n−k\alpha\le n-kα≤n−k. Take any measure μ\muμ satisfying L(n,μ)L(n,\mu)L(n,μ), any set S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1} with ∣S∣=t|S|=t∣S∣=t, any reals ϵ≥0,δ>0,δ′>0\epsilon\ge0,\delta>0,\delta'>0ϵ≥0,δ>0,δ′>0, and any positive semidefinite trace-one matrix ζ\zetaζ on ttt qubits. Define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) for integers 0≤q≤m0\le q\le m0≤q≤m, and zero otherwise, and let AxA_xAx​ be diagonal with Ax(u,u)=Bn−t(∣x∣+α−∣u∣)/Bn(∣x∣+α)A_x(u,u)=B_{n-t}(|x|+\alpha-|u|)/B_n(|x|+\alpha)Ax​(u,u)=Bn−t​(∣x∣+α−∣u∣)/Bn​(∣x∣+α). Suppose that, for every kkk-bit string xxx,

1−Fr(Ax,ζ)2≤ϵ,Fr(X,Y)=Re⁡tr⁡X Y X.\sqrt{1-F_{\rm r}(A_x,\zeta)^2}\le\epsilon, \qquad F_{\rm r}(X,Y)=\operatorname{Re}\operatorname{tr} \sqrt{\sqrt X\,Y\,\sqrt X}.1−Fr​(Ax​,ζ)2​≤ϵ,Fr​(X,Y)=RetrX​YX​​.

For a unitary UUU, let NU(ρ)=Tr⁡S[U(ρ⊗∣ψ⟩⟨ψ∣)U†]\mathcal N_U(\rho)=\operatorname{Tr}_{S}[U(\rho\otimes|\psi\rangle\langle\psi|)U^\dagger]NU​(ρ)=TrS​[U(ρ⊗∣ψ⟩⟨ψ∣)U†], using the first kkk wires for ρ\rhoρ, and define

e(U)=1−[sup⁡Dinf⁡r∈Nω≥0, tr⁡ω=1ω on Cr+1⊗C2kFr ⁣(ω,(idr+1⊗(D∘NU))(ω))]2.e(U)=\sqrt{1-\left[ \sup_{\mathcal D} \inf_{\substack{r\in\mathbb N\\ \omega\ge0,\ \operatorname{tr}\omega=1\\ \omega\text{ on }\mathbb C^{r+1}\otimes\mathbb C^{2^k}}} F_{\rm r}\!\left(\omega, (\mathrm{id}_{r+1}\otimes(\mathcal D\circ\mathcal N_U))(\omega)\right) \right]^2}.e(U)=1−​Dsup​r∈Nω≥0, trω=1ω on Cr+1⊗C2k​inf​Fr​(ω,(idr+1​⊗(D∘NU​))(ω))​2​.

Here D\mathcal DD ranges over recovery channels from the retained register to kkk qubits; a channel means a map X↦∑jKjXKj†X\mapsto\sum_jK_jXK_j^\daggerX↦∑j​Kj​XKj†​ with finitely many Kraus matrices and ∑jKj†Kj=I\sum_jK_j^\dagger K_j=I∑j​Kj†​Kj​=I. Writing h2(s)=[−slog⁡s−(1−s)log⁡(1−s)]/log⁡2h_2(s)=[-s\log s-(1-s)\log(1-s)]/\log2h2​(s)=[−slogs−(1−s)log(1−s)]/log2 and h=min⁡{h2(α/n),h2((α+k)/n)}h=\min\{h_2(\alpha/n),h_2((\alpha+k)/n)\}h=min{h2​(α/n),h2​((α+k)/n)}, the required bound is

μ{U:ϵ+δ+2kδ′<e(U)}≤max⁡ ⁣{0, CnD(2 k−nh/4+t/2δ+2 2k−nh/2+tδ′)},\mu\{U:\epsilon+\delta+2^k\sqrt{\delta'}<e(U)\} \le \max\!\left\{0,\, Cn^D\left( \frac{2^{\,k-nh/4+t/2}}{\delta} +\frac{2^{\,2k-nh/2+t}}{\delta'} \right)\right\},μ{U:ϵ+δ+2kδ′​<e(U)}≤max{0,CnD(δ2k−nh/4+t/2​+δ′22k−nh/2+t​)},

with the right side embedded in the extended nonnegative reals. The constants C,DC,DC,D precede the sequence, while NNN may depend on it; μ\muμ has no separate probability or invariance assumption beyond L(n,μ)L(n,\mu)L(n,μ), and the property imposes nothing on sequences that fail its hypotheses.

QAlgorithms.Papers.Independent.Extend50.P03.Conserves

For every natural number nnn and unitary complex matrix UUU indexed by nnn-bit strings, the predicate means that UHn=HnUUH_n=H_nUUHn​=Hn​U, where HnH_nHn​ is diagonal with entry ∣x∣|x|∣x∣ at the bit string xxx, and ∣x∣|x|∣x∣ counts its true bits. For n=0n=0n=0, Hn=0H_n=0Hn​=0, so every such UUU satisfies this predicate.

QAlgorithms.Papers.Independent.Extend50.P03.ExactDesign

For any natural number nnn and measure μ\muμ on the complex unitary matrices indexed by {0,1}n\{0,1\}^{n}{0,1}n, this property says that μ\muμ is a probability measure, that UHn=HnUUH_n=H_nUUHn​=Hn​U for μ\muμ-almost every UUU, and that there exists another measure ν\nuν on the same unitary matrices with the following properties: ν\nuν is a probability measure, UHn=HnUUH_n=H_nUUHn​=Hn​U for ν\nuν-almost every UUU, and for every unitary VVV commuting with HnH_nHn​, the pushforward of ν\nuν under U↦VUU\mapsto VUU↦VU equals ν\nuν. Here HnH_nHn​ is diagonal with entry ∣x∣|x|∣x∣, the number of true bits of xxx. For each r∈{1,2}r\in\{1,2\}r∈{1,2} and every four lists a,b,c,da,b,c,da,b,c,d of rrr nnn-bit strings, the complex-valued function

U⟼(∏i=0r−1Uai,bi)(∏i=0r−1Uci,di)‾U\longmapsto \left(\prod_{i=0}^{r-1}U_{a_i,b_i}\right) \overline{\left(\prod_{i=0}^{r-1}U_{c_i,d_i}\right)}U⟼(i=0∏r−1​Uai​,bi​​)(i=0∏r−1​Uci​,di​​)​

must be integrable with respect to both μ\muμ and ν\nuν, and its two integrals must agree. This includes repeated indices and n=0n=0n=0; the matching requirement is only for r=1,2r=1,2r=1,2.

QAlgorithms.Papers.Independent.Extend50.P03.Interior

For a real number bbb and a quadruple d=(n,k,α,t)d=(n,k,\alpha,t)d=(n,k,α,t) of natural numbers, this property is exactly

1≤n,1≤k≤n,α≤n−k,1≤t≤n,b≤αn,α+kn≤1−b,t≤α,α+k≤n−t.1\le n,\qquad 1\le k\le n,\qquad \alpha\le n-k,\qquad 1\le t\le n,\qquad b\le\frac{\alpha}{n},\qquad \frac{\alpha+k}{n}\le1-b,\qquad t\le\alpha,\qquad \alpha+k\le n-t.1≤n,1≤k≤n,α≤n−k,1≤t≤n,b≤nα​,nα+k​≤1−b,t≤α,α+k≤n−t.

Subtractions are natural-number subtractions truncated at zero, with the displayed bounds preventing truncation. There is no separate hypothesis on bbb; the conditions themselves exclude, for example, n=0n=0n=0, k=0k=0k=0, or t=0t=0t=0.

QAlgorithms.Papers.Independent.Extend50.P03.LinearSequence

For a real number aaa and a sequence di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​) of quadruples of natural numbers, this property means that ni→+∞n_i\to+\inftyni​→+∞ and, for every natural index iii, 1≤ni1\le n_i1≤ni​, 1≤ki≤ni1\le k_i\le n_i1≤ki​≤ni​, αi≤ni−ki\alpha_i\le n_i-k_iαi​≤ni​−ki​, 1≤ti≤ni1\le t_i\le n_i1≤ti​≤ni​, and αi=ani\alpha_i=a n_iαi​=ani​, with the last equality interpreted in R\mathbb RR. Natural-number subtraction is truncated at zero, although ki≤nik_i\le n_iki​≤ni​ prevents truncation here. The equality is exact at every index; in particular, this property cannot hold unless aaa is rational and 0≤a<10\le a<10≤a<1.

QAlgorithms.Papers.Independent.Extend50.P03.OptimalSingleLimit

For either Boolean value worst\mathrm{worst}worst, this proposition has the following meaning. Consider any sequence of natural-number tuples di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​) with ni→∞n_i\to\inftyni​→∞, satisfying at every index

1≤ni,1≤ki≤ni,αi≤ni−ki,1≤ti≤ni,αi=ni/2,ti=1,ni even.1\leq n_i,\quad 1\leq k_i\leq n_i,\quad \alpha_i\leq n_i-k_i,\quad 1\leq t_i\leq n_i,\quad \alpha_i=n_i/2,\quad t_i=1,\quad n_i\text{ even}.1≤ni​,1≤ki​≤ni​,αi​≤ni​−ki​,1≤ti​≤ni​,αi​=ni​/2,ti​=1,ni​ even.

If worst\mathrm{worst}worst is true, require ki/ni→0k_i/n_i\to0ki​/ni​→0; if it is false, require ki=1k_i=1ki​=1 for every iii. For every choice of unit ancilla vectors ψi∈CQni−ki\psi_i\in\mathbb C^{Q_{n_i-k_i}}ψi​∈CQni​−ki​​ supported on strings of Hamming weight αi\alpha_iαi​, and every sequence of probability measures μi\mu_iμi​ on the unitary group of CQni\mathbb C^{Q_{n_i}}CQni​​ that are almost surely supported on unitaries commuting with the diagonal Hamming-weight operator and are invariant under left multiplication by every such commuting unitary, the proposition requires

∫Eworst ⁣(Pni∘Cψi,U) dμi(U){ki/(2ni),worst=true,ki/(2ni),worst=false⟶1.\frac{\displaystyle\int \mathcal E_{\mathrm{worst}}\!\left(\mathcal P_{n_i}\circ\mathcal C_{\psi_i,U}\right) \,d\mu_i(U)} {\displaystyle \begin{cases} k_i/(2n_i),&\mathrm{worst}=\mathrm{true},\\ \sqrt{k_i}/(2n_i),&\mathrm{worst}=\mathrm{false} \end{cases}} \longrightarrow1.{ki​/(2ni​),ki​​/(2ni​),​worst=true,worst=false​∫Eworst​(Pni​​∘Cψi​,U​)dμi​(U)​⟶1.

Here Qs={0,1}sQ_s=\{0,1\}^sQs​={0,1}s, Cψ,U(X)=U(X⊗∣ψ⟩⟨ψ∣)U†\mathcal C_{\psi,U}(X)=U(X\otimes|\psi\rangle\langle\psi|)U^\daggerCψ,U​(X)=U(X⊗∣ψ⟩⟨ψ∣)U†, with the first kkk qubits carrying XXX. The map Pn\mathcal P_nPn​ chooses one erased site uniformly, records its singleton subset as a classical flag, traces out that site, and embeds the retained state into QnQ_nQn​ with the erased bit fixed to false; all other subset flags have zero blocks. For a map N\mathcal NN from kkk qubits, define

Eworst(N)=1−Fworst(N)2,f(X,Y)=Re⁡Tr⁡X Y X,\mathcal E_{\mathrm{worst}}(\mathcal N)=\sqrt{1-F_{\mathrm{worst}}(\mathcal N)^2}, \quad f(X,Y)=\operatorname{Re}\operatorname{Tr}\sqrt{\sqrt X\,Y\,\sqrt X},Eworst​(N)=1−Fworst​(N)2​,f(X,Y)=ReTrX​YX​​, Ffalse(N)=sup⁡Df ⁣(Φk,(id⊗D∘N)(Φk)),Φk=∣ϕk⟩⟨ϕk∣,∣ϕk⟩=2−k/2∑x∈Qk∣x,x⟩,F_{\mathrm{false}}(\mathcal N)= \sup_{\mathcal D} f\!\left(\Phi_k,(\mathrm{id}\otimes\mathcal D\circ\mathcal N)(\Phi_k)\right), \quad \Phi_k=|\phi_k\rangle\langle\phi_k|, \quad |\phi_k\rangle=2^{-k/2}\sum_{x\in Q_k}|x,x\rangle,Ffalse​(N)=Dsup​f(Φk​,(id⊗D∘N)(Φk​)),Φk​=∣ϕk​⟩⟨ϕk​∣,∣ϕk​⟩=2−k/2x∈Qk​∑​∣x,x⟩, Ftrue(N)=sup⁡D  inf⁡r∈Nρ⪰0, Tr⁡ρ=1f ⁣(ρ,(idr+1⊗D∘N)(ρ)),F_{\mathrm{true}}(\mathcal N)= \sup_{\mathcal D}\; \inf_{\substack{r\in\mathbb N\\ \rho\succeq0,\ \operatorname{Tr}\rho=1}} f\!\left(\rho,(\mathrm{id}_{r+1}\otimes\mathcal D\circ\mathcal N)(\rho)\right),Ftrue​(N)=Dsup​r∈Nρ⪰0, Trρ=1​inf​f(ρ,(idr+1​⊗D∘N)(ρ)),

where the inner matrices are indexed by {0,…,r}×Qk\{0,\ldots,r\}\times Q_k{0,…,r}×Qk​, and each decoder D\mathcal DD ranges over maps admitting finitely many Kraus operators KjK_jKj​ with D(X)=∑jKjXKj†\mathcal D(X)=\sum_jK_jXK_j^\daggerD(X)=∑j​Kj​XKj†​ and ∑jKj†Kj=I\sum_jK_j^\dagger K_j=I∑j​Kj†​Kj​=I. The proposition itself includes no integrability assertion for the displayed integrals.

QAlgorithms.Papers.Independent.Extend50.P03.PatternGuarantee

For an arbitrary predicate L(n,μ)L(n,\mu)L(n,μ) on natural numbers and measures on nnn-qubit unitary matrices, this property requires the following for each Boolean choice www and every real aaa with 0<a<10<a<10<a<1. There exist constants C>0,c>0C>0,c>0C>0,c>0 such that, for every sequence di=(ni,ki,αi,ti)d_i=(n_i,k_i,\alpha_i,t_i)di​=(ni​,ki​,αi​,ti​) of natural-number quadruples satisfying ni→∞n_i\to\inftyni​→∞, for every iii

1≤ni,1≤ki≤ni,αi≤ni−ki,1≤ti≤ni,αi=ani,1\le n_i,\quad1\le k_i\le n_i,\quad \alpha_i\le n_i-k_i,\quad1\le t_i\le n_i,\quad \alpha_i=a n_i,1≤ni​,1≤ki​≤ni​,αi​≤ni​−ki​,1≤ti​≤ni​,αi​=ani​,

and Rw(di)→0R_w(d_i)\to0Rw​(di​)→0, there is N∈NN\in\mathbb NN∈N for which the assertions below hold for every i≥Ni\ge Ni≥N. Here

Rw(n,k,α,t)={kt2/n,w=true,k2t2/n,w=false,B={kt4na(1−a)(1+CRw),w=true,tk4na(1−a)(1+CRw),w=false.R_w(n,k,\alpha,t)= \begin{cases} kt^2/n,&w=\mathrm{true},\\ k^2t^2/n,&w=\mathrm{false}, \end{cases} \qquad B= \begin{cases} \displaystyle\frac{k\sqrt t}{4n\sqrt{a(1-a)}}(1+CR_w),&w=\mathrm{true},\\[2mm] \displaystyle\frac{\sqrt{tk}}{4n\sqrt{a(1-a)}}(1+CR_w),&w=\mathrm{false}. \end{cases}Rw​(n,k,α,t)={kt2/n,k2t2/n,​w=true,w=false,​B=⎩⎨⎧​4na(1−a)​kt​​(1+CRw​),4na(1−a)​tk​​(1+CRw​),​w=true,w=false.​

Put (n,k,α,t)=di(n,k,\alpha,t)=d_i(n,k,α,t)=di​, take any norm-one ancilla ψ\psiψ on n−kn-kn−k qubits satisfying Hn−kψ=αψH_{n-k}\psi=\alpha\psiHn−k​ψ=αψ, where HsH_sHs​ is the diagonal Hamming-weight matrix, and take any measure μ\muμ satisfying L(n,μ)L(n,\mu)L(n,μ). Encode by EU(ρ)=U(ρ⊗∣ψ⟩⟨ψ∣)U†\mathcal E_U(\rho)=U(\rho\otimes|\psi\rangle\langle\psi|)U^\daggerEU​(ρ)=U(ρ⊗∣ψ⟩⟨ψ∣)U†, with the logical register first. For a channel N\mathcal NN from kkk qubits, define

Ffalse(N)=sup⁡DFr ⁣(∣Φk⟩⟨Φk∣,(id2k⊗(D∘N))(∣Φk⟩⟨Φk∣)),∣Φk⟩=2−k/2∑x∣x,x⟩,F_{\mathrm{false}}(\mathcal N)= \sup_{\mathcal D} F_{\rm r}\!\left(|\Phi_k\rangle\langle\Phi_k|, (\mathrm{id}_{2^k}\otimes(\mathcal D\circ\mathcal N)) (|\Phi_k\rangle\langle\Phi_k|)\right), \quad |\Phi_k\rangle=2^{-k/2}\sum_x|x,x\rangle,Ffalse​(N)=Dsup​Fr​(∣Φk​⟩⟨Φk​∣,(id2k​⊗(D∘N))(∣Φk​⟩⟨Φk​∣)),∣Φk​⟩=2−k/2x∑​∣x,x⟩,

and

Ftrue(N)=sup⁡Dinf⁡r∈Nω≥0, tr⁡ω=1ω on Cr+1⊗C2kFr ⁣(ω,(idr+1⊗(D∘N))(ω)),ew(N)=1−Fw(N)2,F_{\mathrm{true}}(\mathcal N)= \sup_{\mathcal D}\inf_{\substack{r\in\mathbb N\\ \omega\ge0,\ \operatorname{tr}\omega=1\\ \omega\text{ on }\mathbb C^{r+1}\otimes\mathbb C^{2^k}}} F_{\rm r}\!\left(\omega, (\mathrm{id}_{r+1}\otimes(\mathcal D\circ\mathcal N))(\omega)\right), \quad e_w(\mathcal N)=\sqrt{1-F_w(\mathcal N)^2},Ftrue​(N)=Dsup​r∈Nω≥0, trω=1ω on Cr+1⊗C2k​inf​Fr​(ω,(idr+1​⊗(D∘N))(ω)),ew​(N)=1−Fw​(N)2​,

where Fr(X,Y)=Re⁡tr⁡X Y XF_{\rm r}(X,Y)=\operatorname{Re}\operatorname{tr}\sqrt{\sqrt X\,Y\,\sqrt X}Fr​(X,Y)=RetrX​YX​​, and D\mathcal DD ranges over recovery channels to kkk qubits. Channels are precisely finite Kraus sums X↦∑jKjXKj†X\mapsto\sum_jK_jXK_j^\daggerX↦∑j​Kj​XKj†​ satisfying ∑jKj†Kj=I\sum_jK_j^\dagger K_j=I∑j​Kj†​Kj​=I. Write ew,S(U)=ew(Tr⁡S∘EU)e_{w,S}(U)=e_w(\operatorname{Tr}_S\circ\mathcal E_U)ew,S​(U)=ew​(TrS​∘EU​). For any real function ppp on subsets of the nnn wires satisfying p(S)≥0p(S)\ge0p(S)≥0, ∑Sp(S)=1\sum_Sp(S)=1∑S​p(S)=1, and p(S)=0p(S)=0p(S)=0 whenever ∣S∣≠t|S|\ne t∣S∣=t, let Fp\mathcal F_pFp​ output the classical flag SSS, trace out the wires in SSS, and put those erased wires in the all-false state, with weight p(S)p(S)p(S); explicitly its SSS-block at bit strings y,zy,zy,z is zero unless both vanish on SSS, and otherwise is p(S)∑e:S→{0,1}ρ(e∪y∣Sc,e∪z∣Sc)p(S)\sum_{e:S\to\{0,1\}}\rho(e\cup y|_{S^c},e\cup z|_{S^c})p(S)∑e:S→{0,1}​ρ(e∪y∣Sc​,e∪z∣Sc​). Put ew,p(U)=ew(Fp∘EU)e_{w,p}(U)=e_w(\mathcal F_p\circ\mathcal E_U)ew,p​(U)=ew​(Fp​∘EU​). Every such ppp must satisfy integrability of ew,pe_{w,p}ew,p​ under μ\muμ and ∫ew,p dμ≤B\int e_{w,p}\,d\mu\le B∫ew,p​dμ≤B, and simultaneously

μ ⁣{U:(∃S, ∣S∣=t, B<ew,S(U)) ∨ (∃p as above, B<ew,p(U))}≤e−cn.\mu\!\left\{U: \bigl(\exists S,\ |S|=t,\ B<e_{w,S}(U)\bigr) \ \lor\ \bigl(\exists p\text{ as above},\ B<e_{w,p}(U)\bigr) \right\} \le e^{-cn}.μ{U:(∃S, ∣S∣=t, B<ew,S​(U)) ∨ (∃p as above, B<ew,p​(U))}≤e−cn.

Thus the same event bound covers all eligible subsets and all eligible pattern laws. The constants precede the sequence, NNN may depend on it, and no probability or invariance condition on μ\muμ is imposed separately from LLL. The equality αi=ani\alpha_i=a n_iαi​=ani​ is exact; if no sequence satisfies the hypotheses, that instance of the requirement is vacuous.

QAlgorithms.Papers.Independent.Extend50.P03.PatternLaw

For natural numbers n,tn,tn,t and a real-valued function ppp on all subsets of {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}, this property means that p(S)≥0p(S)\geq0p(S)≥0 for every subset SSS, that ∑S⊆{0,…,n−1}p(S)=1\sum_{S\subseteq\{0,\ldots,n-1\}}p(S)=1∑S⊆{0,…,n−1}​p(S)=1, and that p(S)=0p(S)=0p(S)=0 whenever ∣S∣≠t|S|\neq t∣S∣=t. Thus all mass is supported on subsets of exactly ttt positions. The parameters include t=0t=0t=0 and n=0n=0n=0: for t=0t=0t=0 the conditions force mass 111 on the empty subset, while for t>nt>nt>n they cannot be satisfied.

QAlgorithms.Papers.Independent.Extend50.P03.SpecialHaar

For every natural number nnn and measure μ\muμ on the unitary group indexed by nnn-bit strings, with its Borel measurable structure, this predicate requires that μ\muμ have total mass one, that det⁡U=1\det U=1detU=1 for μ\muμ-almost every UUU, and that for every unitary VVV with det⁡V=1\det V=1detV=1, the pushforward of μ\muμ under U↦VUU\mapsto VUU↦VU equal μ\muμ. This includes n=0n=0n=0, when the matrices have size 1×11\times11×1 and determinant one forces the matrix to be the identity.

QAlgorithms.Papers.Independent.Extend50.P03.U1ChargeCovariant

For natural numbers n,kn,kn,k and any function EEE from complex matrices on kkk-bit strings to complex matrices on nnn-bit strings, this predicate means that for every real θ\thetaθ and every positive semidefinite matrix ρ\rhoρ of trace one on kkk-bit strings, E(Rk(θ)ρRk(θ)†)=Rn(θ)E(ρ)Rn(θ)†E(R_k(\theta)\rho R_k(\theta)^\dagger)=R_n(\theta)E(\rho)R_n(\theta)^\daggerE(Rk​(θ)ρRk​(θ)†)=Rn​(θ)E(ρ)Rn​(θ)†, where Rj(θ)R_j(\theta)Rj​(θ) is diagonal with entry exp⁡(iθ∣x∣)\exp(i\theta|x|)exp(iθ∣x∣) at each jjj-bit string xxx, and ∣x∣|x|∣x∣ counts true bits. No linearity or channel assumption on EEE is included. Both n=0n=0n=0 and k=0k=0k=0 are permitted.

QAlgorithms.Papers.Independent.Extend50.P03.ZeroErrorGuarantee

For a fixed Boolean worst\mathrm{worst}worst, this property asserts both that the error defined below is zero for every n,α∈Nn,\alpha\in\mathbb Nn,α∈N, every admissible ancilla for k=0k=0k=0, every subset S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1}, and every unitary UUU on nnn bits, and that the error is zero for every n,k,α∈Nn,k,\alpha\in\mathbb Nn,k,α∈N, every admissible ancilla, and every such UUU when S=∅S=\varnothingS=∅. Here Qj={0,1}jQ_j=\{0,1\}^jQj​={0,1}j; an admissible ancilla consists of k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, and a vector ψ∈CQn−k\psi\in\mathbb C^{Q_{n-k}}ψ∈CQn−k​ of norm one satisfying Hψ=αψH\psi=\alpha\psiHψ=αψ, where HHH is diagonal with entry ∣x∣|x|∣x∣, the number of ones in xxx. The encoder sends ρ\rhoρ to U(ρ⊗ψψ∗)U∗U(\rho\otimes\psi\psi^*)U^*U(ρ⊗ψψ∗)U∗, using the first kkk coordinates for ρ\rhoρ; the channel NNN whose error is measured then traces out the coordinates in SSS. Write F(X,Y)=Re⁡tr⁡X YXF(X,Y)=\operatorname{Re}\operatorname{tr}\sqrt{\sqrt X\,Y\sqrt X}F(X,Y)=RetrX​YX​​, with matrix square roots given by continuous functional calculus. If worst=false\mathrm{worst}=\mathrm{false}worst=false, the error is 1−f2\sqrt{1-f^2}1−f2​, where fff is the supremum, over decoding channels DDD, of F(Φk,(id⊗(D∘N))(Φk))F(\Phi_k,(\mathrm{id}\otimes(D\circ N))(\Phi_k))F(Φk​,(id⊗(D∘N))(Φk​)), with Φk=ϕkϕk∗\Phi_k=\phi_k\phi_k^*Φk​=ϕk​ϕk∗​ and ϕk=2−k/2∑x∈Qk∣x,x⟩\phi_k=2^{-k/2}\sum_{x\in Q_k}|x,x\rangleϕk​=2−k/2∑x∈Qk​​∣x,x⟩. If worst=true\mathrm{worst}=\mathrm{true}worst=true, the same error formula uses instead the supremum over DDD of the infimum of F(ρ,(idr+1⊗(D∘N))(ρ))F(\rho,(\mathrm{id}_{r+1}\otimes(D\circ N))(\rho))F(ρ,(idr+1​⊗(D∘N))(ρ)) over all r∈Nr\in\mathbb Nr∈N and all positive semidefinite, trace-one matrices ρ\rhoρ on Cr+1⊗CQk\mathbb C^{r+1}\otimes\mathbb C^{Q_k}Cr+1⊗CQk​. A channel here is a map X↦∑jKjXKj∗X\mapsto\sum_j K_jXK_j^*X↦∑j​Kj​XKj∗​ for a finite family satisfying ∑jKj∗Kj=I\sum_jK_j^*K_j=I∑j​Kj∗​Kj​=I. These assertions include n=0n=0n=0 and k=0k=0k=0; no charge-conservation assumption is imposed on UUU.

QAlgorithms.Papers.Independent.Extend50.P03.ancillaChoiInput

For natural numbers n,k,αn,k,\alphan,k,α, let AAA consist of k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, and a complex Euclidean vector η\etaη on the Boolean strings of length n−kn-kn−k, with ∥η∥=1\|\eta\|=1∥η∥=1, satisfying the charge eigenvector equation ∣z∣ηz=αηz|z|\eta_z=\alpha\eta_z∣z∣ηz​=αηz​ for every such string zzz, where ∣z∣|z|∣z∣ counts true bits. Split each length-nnn string zzz into its first kkk bits zLz_LzL​ and its remaining n−kn-kn−k bits zAz_AzA​. This definition returns the complex matrix JAJ_AJA​ indexed by pairs consisting of a length-kkk string and a length-nnn string, with entries

(JA)(x,z),(y,w)=2−k 1{zL=x, wL=y} ηzAηwA‾.(J_A)_{(x,z),(y,w)} = 2^{-k}\, \mathbf1_{\{z_L=x,\ w_L=y\}}\, \eta_{z_A}\overline{\eta_{w_A}}.(JA​)(x,z),(y,w)​=2−k1{zL​=x, wL​=y}​ηzA​​ηwA​​​.

Equivalently, it applies the identity to the first register and the map adjoining ηη†\eta\eta^\daggerηη†, with the identity unitary on the resulting nnn bits, to the projector onto 2−k/2∑x∣x,x⟩2^{-k/2}\sum_x|x,x\rangle2−k/2∑x​∣x,x⟩; each ∣x,x⟩|x,x\rangle∣x,x⟩ is the coordinate vector equal to 111 at (x,x)(x,x)(x,x) and 000 elsewhere. Zero-length registers, including k=0k=0k=0 and n=kn=kn=k, are included.

QAlgorithms.Papers.Independent.Extend50.P03.averageBasis

For every natural number kkk, arbitrary natural numbers n,α,tn,\alpha,tn,α,t, and every bit string x∈{0,1}kx\in\{0,1\}^{k}x∈{0,1}k, let h=∣x∣h=|x|h=∣x∣ be its number of true bits. Define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) when the integer qqq lies in [0,m][0,m][0,m], and zero otherwise. The defined complex matrix on {0,1}t\{0,1\}^{t}{0,1}t is diagonal, with

Ax(u,v)={Bmax⁡(n−t,0)(h+α−∣u∣)Bn(h+α),u=v,0,u≠v.A_x(u,v)= \begin{cases} \displaystyle\frac{B_{\max(n-t,0)}(h+\alpha-|u|)}{B_n(h+\alpha)},&u=v,\\[2mm] 0,&u\ne v. \end{cases}Ax​(u,v)=⎩⎨⎧​Bn​(h+α)Bmax(n−t,0)​(h+α−∣u∣)​,0,​u=v,u=v.​

Equivalently, the coefficient of the projector onto strings of weight iii, for 0≤i≤t0\le i\le t0≤i≤t, is Bmax⁡(n−t,0)(h+α−i)/Bn(h+α)B_{\max(n-t,0)}(h+\alpha-i)/B_n(h+\alpha)Bmax(n−t,0)​(h+α−i)/Bn​(h+α). The subtraction inside BBB's argument is integer subtraction; n−tn-tn−t is truncated at zero. No parameter restrictions are imposed, and if Bn(h+α)=0B_n(h+\alpha)=0Bn​(h+α)=0, the entire matrix is zero.

QAlgorithms.Papers.Independent.Extend50.P03.averageChoi

For arbitrary natural numbers n,k,αn,k,\alphan,k,α, this defines the complex matrix indexed by Qk×QnQ_k\times Q_nQk​×Qn​, where Qs={0,1}sQ_s=\{0,1\}^sQs​={0,1}s, by

∑j=0k2−kCn(j+α)(Pk,j⊗Pn,j+α).\sum_{j=0}^{k}\frac{2^{-k}}{C_n(j+\alpha)} \bigl(P_{k,j}\otimes P_{n,j+\alpha}\bigr).j=0∑k​Cn​(j+α)2−k​(Pk,j​⊗Pn,j+α​).

Here Cs(q)=(sq)C_s(q)=\binom sqCs​(q)=(qs​), interpreted as a real number when the integer qqq satisfies 0≤q≤s0\le q\le s0≤q≤s, and Cs(q)=0C_s(q)=0Cs​(q)=0 otherwise; Ps,qP_{s,q}Ps,q​ is the diagonal complex matrix whose entry at a bit string xxx is one exactly when xxx has qqq ones, and zero otherwise. The coefficients are cast to complex scalars. There are no size or charge assumptions, including no requirement that k≤nk\le nk≤n or α≤n−k\alpha\le n-kα≤n−k; a zero denominator gives coefficient zero. Zero values of any parameter are included, and every out-of-range weight projector is zero.

QAlgorithms.Papers.Independent.Extend50.P03.averageEncodedUnit

For every natural number kkk, arbitrary natural numbers n,αn,\alphan,α, and bit strings x,y∈{0,1}kx,y\in\{0,1\}^{k}x,y∈{0,1}k, define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) for integers 0≤q≤m0\le q\le m0≤q≤m, and zero otherwise. The defined complex matrix on {0,1}n\{0,1\}^{n}{0,1}n has entries

Ex,y(u,v)={Bn(∣x∣+α)−1,x=y, u=v, and ∣u∣=∣x∣+α,0,otherwise,E_{x,y}(u,v)= \begin{cases} B_n(|x|+\alpha)^{-1},&x=y,\ u=v,\ \text{and }|u|=|x|+\alpha,\\ 0,&\text{otherwise}, \end{cases}Ex,y​(u,v)={Bn​(∣x∣+α)−1,0,​x=y, u=v, and ∣u∣=∣x∣+α,otherwise,​

where ∣x∣|x|∣x∣ and ∣u∣|u|∣u∣ count true bits. In particular, unequal x,yx,yx,y give the zero matrix. No restrictions relate k,n,αk,n,\alphak,n,α; inverse zero is zero, so an out-of-range weight also gives the zero matrix. Empty bit strings are included when a register size is zero.

QAlgorithms.Papers.Independent.Extend50.P03.averageMatrixUnit

For every natural number kkk, arbitrary natural numbers n,α,tn,\alpha,tn,α,t, and bit strings x,y∈{0,1}kx,y\in\{0,1\}^{k}x,y∈{0,1}k, define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) for integers 0≤q≤m0\le q\le m0≤q≤m, and zero otherwise. The defined complex matrix on {0,1}t\{0,1\}^{t}{0,1}t is

Mx,y(u,v)={Bmax⁡(n−t,0)(∣x∣+α−∣u∣)Bn(∣x∣+α),x=y and u=v,0,otherwise,M_{x,y}(u,v)= \begin{cases} \displaystyle\frac{B_{\max(n-t,0)}(|x|+\alpha-|u|)}{B_n(|x|+\alpha)}, &x=y\ \text{and }u=v,\\[2mm] 0,&\text{otherwise}, \end{cases}Mx,y​(u,v)=⎩⎨⎧​Bn​(∣x∣+α)Bmax(n−t,0)​(∣x∣+α−∣u∣)​,0,​x=y and u=v,otherwise,​

where Hamming weight counts true bits. All parameters may be zero, and no size restrictions are assumed. The numerator's weight argument uses integer subtraction, n−tn-tn−t is truncated at zero, and every quotient with zero denominator is zero.

QAlgorithms.Papers.Independent.Extend50.P03.averageSectorWeight

For arbitrary natural numbers n,k,α,t,in,k,\alpha,t,in,k,α,t,i, including zero, define Bm(q)=(mq)B_m(q)=\binom{m}{q}Bm​(q)=(qm​) when the integer qqq satisfies 0≤q≤m0\le q\le m0≤q≤m, and Bm(q)=0B_m(q)=0Bm​(q)=0 otherwise. The defined real number is

2−k∑j=0k(kj)B n−˙t(j+α−i)Bn(j+α),2^{-k}\sum_{j=0}^{k}\binom{k}{j} \frac{B_{\,n\mathbin{\dot-}t}(j+\alpha-i)}{B_n(j+\alpha)},2−kj=0∑k​(jk​)Bn​(j+α)Bn−˙​t​(j+α−i)​,

where n−˙t=max⁡(n−t,0)n\mathbin{\dot-}t=\max(n-t,0)n−˙​t=max(n−t,0), while j+α−ij+\alpha-ij+α−i is integer subtraction. No bounds relating the parameters are assumed. A summand with zero denominator is zero, using the total real division convention a/0=0a/0=0a/0=0.

QAlgorithms.Papers.Independent.Extend50.P03.averageWorst

For arbitrary natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) for integers 0≤q≤m0\le q\le m0≤q≤m, and zero otherwise. For each x∈{0,1}kx\in\{0,1\}^{k}x∈{0,1}k, let AxA_xAx​ be the diagonal matrix on {0,1}t\{0,1\}^{t}{0,1}t with entry Bmax⁡(n−t,0)(∣x∣+α−∣u∣)/Bn(∣x∣+α)B_{\max(n-t,0)}(|x|+\alpha-|u|)/B_n(|x|+\alpha)Bmax(n−t,0)​(∣x∣+α−∣u∣)/Bn​(∣x∣+α) at uuu, and let ZZZ be the diagonal matrix with entry

2−k∑j=0k(kj)Bmax⁡(n−t,0)(j+α−∣u∣)Bn(j+α)2^{-k}\sum_{j=0}^{k}\binom{k}{j} \frac{B_{\max(n-t,0)}(j+\alpha-|u|)}{B_n(j+\alpha)}2−kj=0∑k​(jk​)Bn​(j+α)Bmax(n−t,0)​(j+α−∣u∣)​

at uuu. The defined real number is

sup⁡x∈{0,1}k1−(Re⁡tr⁡Ax Z Ax)2,\sup_{x\in\{0,1\}^{k}} \sqrt{1- \left(\operatorname{Re}\operatorname{tr} \sqrt{\sqrt{A_x}\,Z\,\sqrt{A_x}}\right)^2},x∈{0,1}ksup​1−(RetrAx​​ZAx​​​)2​,

where matrix square roots mean the continuous functional calculus of the real square-root function. The supremum ranges over a finite nonempty set, including the single empty string when k=0k=0k=0. There are no density-matrix or parameter-bound hypotheses; zero denominators are interpreted as zero, and the real square root of a nonpositive argument is zero.

QAlgorithms.Papers.Independent.Extend50.P03.averageZeta

For arbitrary natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, let Bt={0,1}t\mathcal B_t=\{0,1\}^{t}Bt​={0,1}t, and let ∣u∣|u|∣u∣ denote the number of true bits of u∈Btu\in\mathcal B_tu∈Bt​. Define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) for integers 0≤q≤m0\le q\le m0≤q≤m, and zero otherwise, and set

wi=2−k∑j=0k(kj)Bmax⁡(n−t,0)(j+α−i)Bn(j+α).w_i=2^{-k}\sum_{j=0}^{k}\binom{k}{j} \frac{B_{\max(n-t,0)}(j+\alpha-i)}{B_n(j+\alpha)}.wi​=2−kj=0∑k​(jk​)Bn​(j+α)Bmax(n−t,0)​(j+α−i)​.

The defined complex matrix ZZZ, indexed by Bt\mathcal B_tBt​, is diagonal, with

Zu,v={w∣u∣,u=v,0,u≠v.Z_{u,v}= \begin{cases} w_{|u|},&u=v,\\ 0,&u\ne v. \end{cases}Zu,v​={w∣u∣​,0,​u=v,u=v.​

Thus it is the sum, over i=0,…,ti=0,\ldots,ti=0,…,t, of wiw_iwi​ times the diagonal projector onto strings of weight iii. All parameters may be zero, and no normalization or parameter bounds are hypotheses; zero denominators in the coefficients contribute zero.

QAlgorithms.Papers.Independent.Extend50.P03.basisInput

For natural numbers n,k,αn,k,\alphan,k,α, let AAA comprise k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, and a norm-one complex vector η\etaη on length-(n−k)(n-k)(n−k) Boolean strings satisfying ∣z∣ηz=αηz|z|\eta_z=\alpha\eta_z∣z∣ηz​=αηz​, with ∣z∣|z|∣z∣ the number of true bits. For any complex Euclidean vector vvv on length-kkk Boolean strings, split each length-nnn string zzz into its first kkk bits zLz_LzL​ and remaining bits zAz_AzA​. This definition returns a complex matrix indexed by {∗}×Qn\{\ast\}\times Q_n{∗}×Qn​, where {∗}\{\ast\}{∗} is a singleton and QnQ_nQn​ is the set of length-nnn Boolean strings, with entries

B(∗,z),(∗,w)=vzLvwL‾ ηzAηwA‾.B_{(\ast,z),(\ast,w)} = v_{z_L}\overline{v_{w_L}}\, \eta_{z_A}\overline{\eta_{w_A}}.B(∗,z),(∗,w)​=vzL​​vwL​​​ηzA​​ηwA​​​.

Thus it is the matrix whose entries are fzfw‾f_z\overline{f_w}fz​fw​​, with fz=vzLηzAf_z=v_{z_L}\eta_{z_A}fz​=vzL​​ηzA​​, carrying an additional singleton index. There is no assumption that vvv has norm 111 or is a coordinate basis vector; v=0v=0v=0 and all zero-length registers are allowed.

QAlgorithms.Papers.Independent.Extend50.P03.basisKappa

For any natural numbers n,q,tn,q,tn,q,t, define CN(s)=(Ns)C_N(s)=\binom NsCN​(s)=(sN​) for integers 0≤s≤N0\le s\le N0≤s≤N, and CN(s)=0C_N(s)=0CN​(s)=0 otherwise. This definition returns the real number

∑i=0max⁡(n−t,0)Ct(q−i)2Cn(q),\frac{\displaystyle\sum_{i=0}^{\max(n-t,0)} C_t(q-i)^2}{C_n(q)},Cn​(q)i=0∑max(n−t,0)​Ct​(q−i)2​,

where q−iq-iq−i is integer subtraction, while max⁡(n−t,0)\max(n-t,0)max(n−t,0) reflects truncated natural-number subtraction in the summation bound. There are no assumptions q≤nq\le nq≤n or t≤nt\le nt≤n. Real division by zero is defined to be 000, so the value is 000 whenever q>nq>nq>n; when t>nt>nt>n, the numerator has just the term i=0i=0i=0. All zero values of the parameters are included.

QAlgorithms.Papers.Independent.Extend50.P03.chargeCoefficient

For every real number aaa, this defines

14a(1−a).\frac{1}{4\sqrt{a(1-a)}}.4a(1−a)​1​.

The square root and reciprocal are total real operations: the square root of a nonpositive number is 000, and the reciprocal of 000 is 000. Consequently, the value is 000 whenever a≤0a\leq0a≤0 or a≥1a\geq1a≥1; no hypothesis restricting aaa to (0,1)(0,1)(0,1) is imposed.

QAlgorithms.Papers.Independent.Extend50.P03.chargeEncoder

For natural numbers n,k,αn,k,\alphan,k,α, an object AAA supplying k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, and a vector ψ\psiψ on (n−k)(n-k)(n−k)-bit strings with ∥ψ∥2=1\|\psi\|_2=1∥ψ∥2​=1 and Hn−kψ=αψH_{n-k}\psi=\alpha\psiHn−k​ψ=αψ, and any unitary matrix UUU on nnn-bit strings, define the matrix-valued function ρ↦UMρU†\rho\mapsto U M_\rho U^\daggerρ↦UMρ​U†, where (Mρ)z,w=ρzL,wLψzAψwA‾(M_\rho)_{z,w}=\rho_{z_L,w_L}\psi_{z_A}\overline{\psi_{w_A}}(Mρ​)z,w​=ρzL​,wL​​ψzA​​ψwA​​​. Here Hn−kH_{n-k}Hn−k​ is diagonal with entries counting true bits, and the subscripts L,AL,AL,A select the first kkk and last n−kn-kn−k bits. The input ρ\rhoρ is any complex matrix on kkk-bit strings, and no commutation condition is imposed on UUU. The definition includes k=0k=0k=0 and k=nk=nk=n.

QAlgorithms.Papers.Independent.Extend50.P03.chargeRotation

For every natural number nnn and real number θ\thetaθ, define the diagonal complex matrix Rn(θ)R_n(\theta)Rn​(θ) indexed by nnn-bit strings by (Rn(θ))x,x=exp⁡(iθ∣x∣)(R_n(\theta))_{x,x}=\exp(i\theta |x|)(Rn​(θ))x,x​=exp(iθ∣x∣), where ∣x∣|x|∣x∣ is the number of true bits in xxx; all off-diagonal entries are zero. For n=0n=0n=0, this is the 1×11\times11×1 identity matrix.

QAlgorithms.Papers.Independent.Extend50.P03.choiEntropy

For arbitrary natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, take ancilla data AAA comprising k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, and a norm-one vector η\etaη on Qn−kQ_{n-k}Qn−k​ satisfying ∣z∣ηz=αηz|z|\eta_z=\alpha\eta_z∣z∣ηz​=αηz​, where QjQ_jQj​ denotes length-jjj Boolean strings and ∣z∣|z|∣z∣ their numbers of true bits. Split z∈Qnz\in Q_nz∈Qn​ as (zL,zA)∈Qk×Qn−k(z_L,z_A)\in Q_k\times Q_{n-k}(zL​,zA​)∈Qk​×Qn−k​, and define a matrix Λ\LambdaΛ on (Qn×Qn)×(Qk×Qt)(Q_n\times Q_n)\times(Q_k\times Q_t)(Qn​×Qn​)×(Qk​×Qt​) by

Λ((a,b),(x,u)),((c,d),(y,v))=2−(n+k)Dn(a,b)Dn(c,d) 1{aL=x, cL=y} ηaAηcA‾ 1En,t(b,u;d,v).\Lambda_{((a,b),(x,u)),((c,d),(y,v))} = 2^{-(n+k)}D_n(a,b)D_n(c,d)\, \mathbf1_{\{a_L=x,\ c_L=y\}}\, \eta_{a_A}\overline{\eta_{c_A}}\, \mathbf1_{\mathcal E_{n,t}(b,u;d,v)}.Λ((a,b),(x,u)),((c,d),(y,v))​=2−(n+k)Dn​(a,b)Dn​(c,d)1{aL​=x, cL​=y}​ηaA​​ηcA​​​1En,t​(b,u;d,v)​.

Here Dn(a,b)D_n(a,b)Dn​(a,b) is 2n/(n∣a∣)\sqrt{2^n/\binom n{|a|}}2n/(∣a∣n​)​ when ∣a∣=∣b∣|a|=|b|∣a∣=∣b∣, and 000 otherwise; En,t(b,u;d,v)\mathcal E_{n,t}(b,u;d,v)En,t​(b,u;d,v) requires bi=ui,di=vib_i=u_i,d_i=v_ibi​=ui​,di​=vi​ for i<min⁡(n,t)i<\min(n,t)i<min(n,t) and bi=dib_i=d_ibi​=di​ for t≤i<nt\le i<nt≤i<n; each indicator is 111 or 000. The definition returns the supremum in the extended real numbers [−∞,+∞][-\infty,+\infty][−∞,+∞] of all real hhh for which there exists a positive semidefinite matrix σ\sigmaσ on Qk×QtQ_k\times Q_tQk​×Qt​, with complex trace 111, such that

2−hIQn×Qn⊗σ−Λis positive semidefinite.2^{-h}I_{Q_n\times Q_n}\otimes\sigma-\Lambda \quad\text{is positive semidefinite}.2−hIQn​×Qn​​⊗σ−Λis positive semidefinite.

The supremum is −∞-\infty−∞ if there are no such hhh, and +∞+\infty+∞ if they are unbounded above. There is no restriction t≤nt\le nt≤n, and all zero-length registers are included.

QAlgorithms.Papers.Independent.Extend50.P03.choiLowerCoefficient

For every natural number kkk, this defines the real number

(k⌊(k+1)/2⌋) ⌊(k+1)/2⌋2k,\frac{\binom{k}{\lfloor(k+1)/2\rfloor}\,\lfloor(k+1)/2\rfloor}{2^k},2k(⌊(k+1)/2⌋k​)⌊(k+1)/2⌋​,

where the divisions by 222 inside the binomial coefficient and its multiplier are natural-number division. In particular, the definition includes k=0k=0k=0, for which its value is 000.

QAlgorithms.Papers.Independent.Extend50.P03.choiSectorKappa

For every four natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, with no size or positivity restrictions, define CN(s)=(Ns)C_N(s)=\binom NsCN​(s)=(sN​) when the integer sss satisfies 0≤s≤N0\le s\le N0≤s≤N, and CN(s)=0C_N(s)=0CN​(s)=0 otherwise. This definition returns

∑i=0max⁡(n−t,0)(∑j=0kCt(j+α−i)(kj)2kCn(j+α))2.\sum_{i=0}^{\max(n-t,0)} \left( \sum_{j=0}^{k} \frac{C_t(j+\alpha-i)\binom kj} {\sqrt{2^k C_n(j+\alpha)}} \right)^2.i=0∑max(n−t,0)​(j=0∑k​2kCn​(j+α)​Ct​(j+α−i)(jk​)​)2.

The arguments j+α−ij+\alpha-ij+α−i are computed as integers, so they can be negative; the outer upper limit comes from natural-number subtraction, which truncates n−tn-tn−t at 000. All divisions are real divisions with x/0=0x/0=0x/0=0, so a summand with zero denominator contributes 000. In particular, when t>nt>nt>n the outer sum still contains the single term i=0i=0i=0, and n=0n=0n=0 and k=0k=0k=0 are included.

QAlgorithms.Papers.Independent.Extend50.P03.chooseZ

For every natural number nnn and integer qqq, this defines the real number (nq)\binom nq(qn​) when 0≤q≤n0\le q\le n0≤q≤n, and zero otherwise. In the first case qqq is converted to a natural number before taking the binomial coefficient. Thus negative qqq and q>nq>nq>n give zero, while n=q=0n=q=0n=q=0 gives one.

QAlgorithms.Papers.Independent.Extend50.P03.comparisonChoi

For arbitrary natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, write Bs={0,1}s\mathcal B_s=\{0,1\}^{s}Bs​={0,1}s and ∣v∣|v|∣v∣ for Hamming weight, and define Bm(q)=(mq)B_m(q)=\binom m qBm​(q)=(qm​) for integers 0≤q≤m0\le q\le m0≤q≤m, and zero otherwise. The defined complex matrix on Bk×Bt\mathcal B_k\times\mathcal B_tBk​×Bt​ is diagonal and has entries

C(x,u),(y,v)={2−2k∑j=0k(kj)Bmax⁡(n−t,0)(j+α−∣u∣)Bn(j+α),x=y and u=v,0,otherwise.C_{(x,u),(y,v)} = \begin{cases} \displaystyle 2^{-2k}\sum_{j=0}^{k}\binom{k}{j} \frac{B_{\max(n-t,0)}(j+\alpha-|u|)}{B_n(j+\alpha)}, &x=y\ \text{and }u=v,\\[2mm] 0,&\text{otherwise}. \end{cases}C(x,u),(y,v)​=⎩⎨⎧​2−2kj=0∑k​(jk​)Bn​(j+α)Bmax(n−t,0)​(j+α−∣u∣)​,0,​x=y and u=v,otherwise.​

Equivalently, it is 2−kIBk2^{-k}I_{\mathcal B_k}2−kIBk​​ tensored with the diagonal matrix whose weight-iii entry is 2−k∑j=0k(kj)Bmax⁡(n−t,0)(j+α−i)/Bn(j+α)2^{-k}\sum_{j=0}^{k}\binom{k}{j}B_{\max(n-t,0)}(j+\alpha-i)/B_n(j+\alpha)2−k∑j=0k​(jk​)Bmax(n−t,0)​(j+α−i)/Bn​(j+α). There are no positivity, normalization, or size hypotheses. Zero denominators give zero, and when k=0k=0k=0 or t=0t=0t=0, the corresponding bit-string set consists of the single empty string.

QAlgorithms.Papers.Independent.Extend50.P03.decouplingFactor

For every natural number nnn, including 000, and every pair of Boolean strings a,ba,ba,b of length nnn, let ∣a∣|a|∣a∣ and ∣b∣|b|∣b∣ denote their numbers of true bits. This definition returns the real number

Dn(a,b)={2n(n∣a∣),∣a∣=∣b∣,0,∣a∣≠∣b∣.D_n(a,b)= \begin{cases} \displaystyle\sqrt{\frac{2^n}{\binom n{|a|}}},&|a|=|b|,\\ 0,&|a|\ne|b|. \end{cases}Dn​(a,b)=⎩⎨⎧​(∣a∣n​)2n​​,0,​∣a∣=∣b∣,∣a∣=∣b∣.​

Here the integer-indexed binomial function used in the code returns (ns)\binom ns(sn​) for an integer sss with 0≤s≤n0\le s\le n0≤s≤n, and 000 otherwise; in this definition its argument is always the valid weight ∣a∣|a|∣a∣, so the denominator is positive. When n=0n=0n=0, there is one empty string and the returned value is 111.

QAlgorithms.Papers.Independent.Extend50.P03.decouplingInputEntropy

For arbitrary natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, let AAA comprise k≤nk\le nk≤n, α≤n−k\alpha\le n-kα≤n−k, and a norm-one vector η\etaη on Qn−kQ_{n-k}Qn−k​ satisfying ∣z∣ηz=αηz|z|\eta_z=\alpha\eta_z∣z∣ηz​=αηz​, where QjQ_jQj​ denotes length-jjj Boolean strings and ∣z∣|z|∣z∣ counts true bits. Given any complex Euclidean vector vvv on QkQ_kQk​, split z∈Qnz\in Q_nz∈Qn​ into zL∈Qkz_L\in Q_kzL​∈Qk​ and zA∈Qn−kz_A\in Q_{n-k}zA​∈Qn−k​, and put fz=vzLηzAf_z=v_{z_L}\eta_{z_A}fz​=vzL​​ηzA​​. Define a matrix Λ\LambdaΛ on (Qn×Qn)×({∗}×Qt)(Q_n\times Q_n)\times(\{\ast\}\times Q_t)(Qn​×Qn​)×({∗}×Qt​) by

Λ((a,b),(∗,u)),((c,d),(∗,w))=2−nDn(a,b)Dn(c,d) fafc‾ 1En,t(b,u;d,w),\Lambda_{((a,b),(\ast,u)),((c,d),(\ast,w))} = 2^{-n}D_n(a,b)D_n(c,d)\, f_a\overline{f_c}\, \mathbf1_{\mathcal E_{n,t}(b,u;d,w)},Λ((a,b),(∗,u)),((c,d),(∗,w))​=2−nDn​(a,b)Dn​(c,d)fa​fc​​1En,t​(b,u;d,w)​,

where Dn(a,b)=2n/(n∣a∣)D_n(a,b)=\sqrt{2^n/\binom n{|a|}}Dn​(a,b)=2n/(∣a∣n​)​ if ∣a∣=∣b∣|a|=|b|∣a∣=∣b∣, and 000 otherwise, and En,t(b,u;d,w)\mathcal E_{n,t}(b,u;d,w)En,t​(b,u;d,w) requires bi=ui,di=wib_i=u_i,d_i=w_ibi​=ui​,di​=wi​ for i<min⁡(n,t)i<\min(n,t)i<min(n,t) and bi=dib_i=d_ibi​=di​ for t≤i<nt\le i<nt≤i<n. The definition returns the extended-real supremum of all real hhh for which some positive semidefinite matrix σ\sigmaσ on {∗}×Qt\{\ast\}\times Q_t{∗}×Qt​, with trace 111, satisfies

2−hIQn×Qn⊗σ−Λis positive semidefinite.2^{-h}I_{Q_n\times Q_n}\otimes\sigma-\Lambda \quad\text{is positive semidefinite}.2−hIQn​×Qn​​⊗σ−Λis positive semidefinite.

An empty feasible set has supremum −∞-\infty−∞, and an unbounded one has supremum +∞+\infty+∞. No normalization or basis-vector condition is imposed on vvv, no assumption t≤nt\le nt≤n is made, and zero-length registers are allowed; in particular, v=0v=0v=0 gives Λ=0\Lambda=0Λ=0 and the returned value +∞+\infty+∞.

QAlgorithms.Papers.Independent.Extend50.P03.endpointEntropy

For any quadruple d=(n,k,α,t)d=(n,k,\alpha,t)d=(n,k,α,t) of natural numbers, this defines

min⁡{h2 ⁣(αn),h2 ⁣(α+kn)},h2(x)=−xlog⁡x−(1−x)log⁡(1−x)log⁡2.\min\left\{ h_2\!\left(\frac{\alpha}{n}\right), h_2\!\left(\frac{\alpha+k}{n}\right) \right\}, \qquad h_2(x)=\frac{-x\log x-(1-x)\log(1-x)}{\log2}.min{h2​(nα​),h2​(nα+k​)},h2​(x)=log2−xlogx−(1−x)log(1−x)​.

There are no admissibility assumptions, and ttt does not affect the result. The real logarithm and division are total, with log⁡0=0\log0=0log0=0 and division by zero equal to zero; in particular the result is zero when n=0n=0n=0. The arguments of h2h_2h2​ are not required to lie in [0,1][0,1][0,1].

QAlgorithms.Papers.Independent.Extend50.P03.erasureChoi

For arbitrary natural numbers n,tn,tn,t, let QjQ_jQj​ be the set of Boolean strings of length jjj. This definition gives a complex matrix En,tE_{n,t}En,t​ indexed by Qn×QtQ_n\times Q_tQn​×Qt​, whose entry at row (a,u)(a,u)(a,u) and column (b,v)(b,v)(b,v) is

En,t((a,u),(b,v))={2−n,ai=ui and bi=vifor every 0≤i<min⁡(n,t),ai=bifor every t≤i<n,0,otherwise.E_{n,t}((a,u),(b,v))= \begin{cases} 2^{-n},& \begin{aligned} &a_i=u_i\ \text{and}\ b_i=v_i &&\text{for every }0\le i<\min(n,t),\\ &a_i=b_i&&\text{for every }t\le i<n, \end{aligned}\\ 0,&\text{otherwise}. \end{cases}En,t​((a,u),(b,v))=⎩⎨⎧​2−n,0,​​ai​=ui​ and bi​=vi​ai​=bi​​​for every 0≤i<min(n,t),for every t≤i<n,​otherwise.​

The nonzero value is regarded as a complex number. There is no assumption t≤nt\le nt≤n: if t>nt>nt>n, the bits of u,vu,vu,v at positions at least nnn are unconstrained. If t=0t=0t=0, the matrix is 2−n2^{-n}2−n times the identity on QnQ_nQn​; if n=0n=0n=0, every entry is 111, for every ttt.

QAlgorithms.Papers.Independent.Extend50.P03.firstTrace

For natural numbers n,tn,tn,t with t≤nt\leq nt≤n, this defines a map from arbitrary complex matrices indexed by length-nnn Boolean strings to complex matrices indexed by length-ttt Boolean strings by

(firstTrace⁡n,t(ρ))u,v=∑z∈{0,1}n−tρu∥z,  v∥z,\bigl(\operatorname{firstTrace}_{n,t}(\rho)\bigr)_{u,v} =\sum_{z\in\{0,1\}^{n-t}}\rho_{u\mathbin{\|}z,\;v\mathbin{\|}z},(firstTracen,t​(ρ))u,v​=z∈{0,1}n−t∑​ρu∥z,v∥z​,

where u∥zu\mathbin{\|}zu∥z denotes concatenation. No positivity or normalization assumption is placed on ρ\rhoρ. For t=0t=0t=0, the result is the one-entry matrix containing Tr⁡ρ\operatorname{Tr}\rhoTrρ; for t=nt=nt=n, the sum has the unique empty string as its sole index and returns ρ\rhoρ.

QAlgorithms.Papers.Independent.Extend50.P03.flaggedPatternErasure

For every natural number nnn and arbitrary real-valued function ppp on subsets of the nnn positions, this defines a function taking any complex matrix ρ\rhoρ indexed by length-nnn Boolean strings to a complex matrix indexed by pairs (S,y)(S,y)(S,y) consisting of a subset and a full length-nnn string. Its entry at row (S,y)(S,y)(S,y) and column (T,z)(T,z)(T,z) is zero unless S=TS=TS=T and both yyy and zzz are false at every position in SSS; when those conditions hold, the entry is p(S)∑e:S→{false,true}ρe∪(y∣Sc), e∪(z∣Sc)\displaystyle p(S)\sum_{e:S\to\{\mathrm{false},\mathrm{true}\}}\rho_{e\cup(y|_{S^c}),\,e\cup(z|_{S^c})}p(S)e:S→{false,true}∑​ρe∪(y∣Sc​),e∪(z∣Sc​)​, where each union combines assignments on complementary sets of positions and p(S)p(S)p(S) is regarded as a complex scalar. There is no requirement that ppp be nonnegative, normalized, or supported on subsets of any fixed size, and no requirement that ρ\rhoρ be a density matrix. Empty and full subsets are included: their diagonal flag blocks are respectively p(∅)ρp(\varnothing)\rhop(∅)ρ and a matrix supported only at the all-false string with value p({0,…,n−1})Tr⁡ρp(\{0,\ldots,n-1\})\operatorname{Tr}\rhop({0,…,n−1})Trρ. For n=0n=0n=0, the sole output entry is p(∅)p(\varnothing)p(∅) times the sole input entry.

QAlgorithms.Papers.Independent.Extend50.P03.hammingCharge

For every natural number nnn, define the complex matrix HnH_nHn​ indexed by nnn-bit strings by (Hn)x,y=0(H_n)_{x,y}=0(Hn​)x,y​=0 when x≠yx\ne yx=y and (Hn)x,x=∣{j∈{0,…,n−1}:xj=true}∣(H_n)_{x,x}=|\{j\in\{0,\ldots,n-1\}:x_j=\mathrm{true}\}|(Hn​)x,x​=∣{j∈{0,…,n−1}:xj​=true}∣. Thus its diagonal entries count the true bits of each string. For n=0n=0n=0, this is the 1×11\times11×1 zero matrix.

QAlgorithms.Papers.Independent.Extend50.P03.joinBits

For every natural number nnn, including 000, every subset S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1}, and Boolean assignments u:S→{false,true}u:S\to\{\mathrm{false},\mathrm{true}\}u:S→{false,true} and v:Sc→{false,true}v:S^c\to\{\mathrm{false},\mathrm{true}\}v:Sc→{false,true}, this defines the Boolean string www of length nnn by wi=uiw_i=u_iwi​=ui​ for i∈Si\in Si∈S and wi=viw_i=v_iwi​=vi​ for i∉Si\notin Si∈/S, where the complement is taken among the nnn positions. Empty subsets and empty complements are allowed; for n=0n=0n=0, the result is the unique empty string.

QAlgorithms.Papers.Independent.Extend50.P03.joinFirst

For natural numbers n,tn,tn,t, a hypothesis t≤nt\leq nt≤n, a Boolean string uuu of length ttt, and a Boolean string vvv of length n−tn-tn−t, this defines their concatenation as a Boolean string of length nnn:

(joinFirst⁡(u,v))i={ui,0≤i<t,vi−t,t≤i<n.(\operatorname{joinFirst}(u,v))_i= \begin{cases} u_i,&0\leq i<t,\\ v_{i-t},&t\leq i<n. \end{cases}(joinFirst(u,v))i​={ui​,vi−t​,​0≤i<t,t≤i<n.​

Here n−tn-tn−t is natural-number subtraction, and the hypothesis ensures that the two lengths add to nnn. The cases t=0t=0t=0, t=nt=nt=n, and n=t=0n=t=0n=t=0 are included, with the corresponding empty strings.

QAlgorithms.Papers.Independent.Extend50.P03.lambdaState

For any type RRR, with no finiteness or nonemptiness assumption, any natural numbers n,tn,tn,t, and any complex matrix Ψ\PsiΨ indexed by R×QnR\times Q_nR×Qn​, where QjQ_jQj​ denotes the Boolean strings of length jjj, this definition constructs a complex matrix Λ\LambdaΛ indexed by (Qn×Qn)×(R×Qt)(Q_n\times Q_n)\times(R\times Q_t)(Qn​×Qn​)×(R×Qt​). For strings a,b,c,d∈Qna,b,c,d\in Q_na,b,c,d∈Qn​, u,v∈Qtu,v\in Q_tu,v∈Qt​, and r,s∈Rr,s\in Rr,s∈R, its entries are

Λ((a,b),(r,u)),((c,d),(s,v))=Dn(a,b)Dn(c,d) Ψ(r,a),(s,c) 2−n 1En,t(b,u;d,v),\Lambda_{((a,b),(r,u)),((c,d),(s,v))} = D_n(a,b)D_n(c,d)\, \Psi_{(r,a),(s,c)}\,2^{-n}\, \mathbf1_{\mathcal E_{n,t}(b,u;d,v)},Λ((a,b),(r,u)),((c,d),(s,v))​=Dn​(a,b)Dn​(c,d)Ψ(r,a),(s,c)​2−n1En,t​(b,u;d,v)​,

where 1\mathbf11 is 111 when its condition holds and 000 otherwise,

Dn(a,b)={2n/(n∣a∣),∣a∣=∣b∣,0,∣a∣≠∣b∣,D_n(a,b)= \begin{cases} \sqrt{2^n/\binom n{|a|}},&|a|=|b|,\\ 0,&|a|\ne|b|, \end{cases}Dn​(a,b)={2n/(∣a∣n​)​,0,​∣a∣=∣b∣,∣a∣=∣b∣,​

∣a∣|a|∣a∣ counts true bits, and En,t(b,u;d,v)\mathcal E_{n,t}(b,u;d,v)En,t​(b,u;d,v) means that bi=uib_i=u_ibi​=ui​ and di=vid_i=v_idi​=vi​ for all i<min⁡(n,t)i<\min(n,t)i<min(n,t), and bi=dib_i=d_ibi​=di​ for all t≤i<nt\le i<nt≤i<n. The real factors are embedded into C\mathbb CC. No positivity, trace, or normalization condition is imposed on Ψ\PsiΨ, and all n,tn,tn,t, including 000 and t>nt>nt>n, are allowed; in the latter case the bits of u,vu,vu,v beyond position n−1n-1n−1 are unconstrained.

QAlgorithms.Papers.Independent.Extend50.P03.leadingError

For either Boolean value worst\mathrm{worst}worst, any real number aaa, and any quadruple d=(n,k,α,t)d=(n,k,\alpha,t)d=(n,k,α,t) of natural numbers, this defines

{kt,worst=true,tk,worst=false4na(1−a).\frac{\begin{cases} k\sqrt t,&\mathrm{worst}=\mathrm{true},\\ \sqrt{tk},&\mathrm{worst}=\mathrm{false} \end{cases}} {4n\sqrt{a(1-a)}}.4na(1−a)​{kt​,tk​,​worst=true,worst=false​​.

No admissibility assumptions or restrictions on aaa are imposed, and α\alphaα does not affect the value. Real square roots of nonpositive numbers are zero, and division by zero is zero; consequently the value is zero if n=0n=0n=0 or a∉(0,1)a\notin(0,1)a∈/(0,1).

QAlgorithms.Papers.Independent.Extend50.P03.minSdp

For arbitrary finite types P,QP,QP,Q, each equipped with decidable equality and either of which may be empty, and any complex matrix ρ\rhoρ indexed by P×QP\times QP×Q, the defined real number is

inf⁡{Re⁡tr⁡σ:σ is a complex matrix on Q,σ≥0,IP⊗σ−ρ≥0},\inf\left\{ \operatorname{Re}\operatorname{tr}\sigma: \sigma\text{ is a complex matrix on }Q,\quad \sigma\ge0,\quad I_P\otimes\sigma-\rho\ge0 \right\},inf{Retrσ:σ is a complex matrix on Q,σ≥0,IP​⊗σ−ρ≥0},

where each inequality means positive semidefiniteness. There is no hypothesis that ρ\rhoρ is Hermitian, positive, or normalized, and the definition asserts neither feasibility nor attainment. If the feasible set is empty, the real infimum used here is 000. If either indexing type is empty, the value is also 000.

QAlgorithms.Papers.Independent.Extend50.P03.mixtureError

For natural numbers n,k,αn,k,\alphan,k,α, a Boolean worst\mathrm{worst}worst, an ancilla datum AAA, any real-valued function ppp on subsets of the nnn positions, and any unitary matrix UUU on length-nnn Boolean strings, this defines an error as follows. The datum AAA provides k≤nk\leq nk≤n, α≤n−k\alpha\leq n-kα≤n−k, and a unit vector ψ\psiψ on length-(n−k)(n-k)(n−k) strings satisfying Hψ=αψH\psi=\alpha\psiHψ=αψ, where HHH is diagonal with the number of true bits as its entries. Set E(X)=U(X⊗ψψ†)U†E(X)=U(X\otimes\psi\psi^\dagger)U^\daggerE(X)=U(X⊗ψψ†)U†, with logical positions first. Define N(X)N(X)N(X) on pairs (S,y)(S,y)(S,y) of a subset and a full string by setting its entry at (S,y),(T,z)(S,y),(T,z)(S,y),(T,z) to zero unless S=TS=TS=T and y,zy,zy,z are both false on SSS; otherwise set that entry to p(S)∑e:S→{false,true}E(X)e∪(y∣Sc), e∪(z∣Sc)\displaystyle p(S)\sum_{e:S\to\{\mathrm{false},\mathrm{true}\}}E(X)_{e\cup(y|_{S^c}),\,e\cup(z|_{S^c})}p(S)e:S→{false,true}∑​E(X)e∪(y∣Sc​),e∪(z∣Sc​)​. The result is 1−f2\sqrt{1-f^2}1−f2​: for worst=true\mathrm{worst}=\mathrm{true}worst=true, f=sup⁡Dinf⁡r∈N, ρ≥0, Tr⁡ρ=1F∗(ρ,(id⁡r+1⊗(D∘N))(ρ))\displaystyle f=\sup_D\inf_{r\in\mathbb N,\ \rho\geq0,\ \operatorname{Tr}\rho=1}F_*(\rho,(\operatorname{id}_{r+1}\otimes(D\circ N))(\rho))f=Dsup​r∈N, ρ≥0, Trρ=1inf​F∗​(ρ,(idr+1​⊗(D∘N))(ρ)), and for worst=false\mathrm{worst}=\mathrm{false}worst=false, f=sup⁡DF∗(PΦ,(id⁡⊗(D∘N))(PΦ))\displaystyle f=\sup_DF_*(P_\Phi,(\operatorname{id}\otimes(D\circ N))(P_\Phi))f=Dsup​F∗​(PΦ​,(id⊗(D∘N))(PΦ​)). Here F∗(R,T)=Re⁡Tr⁡R T R\displaystyle F_*(R,T)=\operatorname{Re}\operatorname{Tr}\sqrt{\sqrt R\,T\,\sqrt R}F∗​(R,T)=ReTrR​TR​​ uses continuous functional calculus, Φx,y=2−k/2\Phi_{x,y}=2^{-k/2}Φx,y​=2−k/2 for equal logical strings and 000 otherwise, and PΦ=ΦΦ†P_\Phi=\Phi\Phi^\daggerPΦ​=ΦΦ†. The inner infimum ranges over all density matrices on the logical space with any reference dimension r+1r+1r+1; tensor extensions act blockwise. Decoders map the entire flagged output space back to the logical space and have finite Kraus representations D(Y)=∑jKjYKj†D(Y)=\sum_jK_jYK_j^\daggerD(Y)=∑j​Kj​YKj†​ with ∑jKj†Kj=I\sum_jK_j^\dagger K_j=I∑j​Kj†​Kj​=I. The extrema are real-valued, and the outer real square root gives 000 for a negative argument. There is no probability-law assumption on ppp, no charge-conservation assumption on UUU, and zero sizes are allowed whenever AAA exists.

QAlgorithms.Papers.Independent.Extend50.P03.optimizedChoiFidelity

For every natural number kkk, including 000, every finite type BBB equipped with decidable equality, and every function NNN from complex matrices on length-kkk Boolean strings to complex matrices on BBB, this defines the real supremum sup⁡DF∗ ⁣(PΦ,(id⁡⊗(D∘N))(PΦ))\displaystyle \sup_D F_*\!\left(P_\Phi,(\operatorname{id}\otimes(D\circ N))(P_\Phi)\right)Dsup​F∗​(PΦ​,(id⊗(D∘N))(PΦ​)). Here Φx,y=2−k/2\Phi_{x,y}=2^{-k/2}Φx,y​=2−k/2 if x=yx=yx=y and 000 otherwise, PΦ=ΦΦ†P_\Phi=\Phi\Phi^\daggerPΦ​=ΦΦ†, and F∗(R,S)=Re⁡Tr⁡R S R\displaystyle F_*(R,S)=\operatorname{Re}\operatorname{Tr}\sqrt{\sqrt R\,S\,\sqrt R}F∗​(R,S)=ReTrR​SR​​, with matrix square roots defined by continuous functional calculus. The supremum ranges over precisely those functions DDD for which there are a natural number mmm and matrices KjK_jKj​ from BBB to the length-kkk string space satisfying ∑j=0m−1Kj†Kj=IB\sum_{j=0}^{m-1}K_j^\dagger K_j=I_B∑j=0m−1​Kj†​Kj​=IB​ and D(X)=∑j=0m−1KjXKj†D(X)=\sum_{j=0}^{m-1}K_jXK_j^\daggerD(X)=∑j=0m−1​Kj​XKj†​ for every complex matrix XXX. The operation id⁡⊗(D∘N)\operatorname{id}\otimes(D\circ N)id⊗(D∘N) applies D∘ND\circ ND∘N separately to every matrix block determined by the two reference indices. No channel, linearity, positivity, or normalization condition is imposed on NNN, and BBB may be empty. This uses the real-valued supremum operation, without asserting that a maximizing decoder exists or that the values form a nonempty bounded set.

QAlgorithms.Papers.Independent.Extend50.P03.optimizedCodeError

For every natural number kkk, finite type BBB equipped with decidable equality, Boolean value worst\mathrm{worst}worst, and arbitrary function NNN from complex matrices on length-kkk Boolean strings to complex matrices on BBB, this defines 1−f2\sqrt{1-f^2}1−f2​ as follows. Write F∗(R,S)=Re⁡Tr⁡R S R\displaystyle F_*(R,S)=\operatorname{Re}\operatorname{Tr}\sqrt{\sqrt R\,S\,\sqrt R}F∗​(R,S)=ReTrR​SR​​ using continuous functional calculus, and let decoders DDD range over functions admitting finite Kraus representations D(X)=∑jKjXKj†D(X)=\sum_jK_jXK_j^\daggerD(X)=∑j​Kj​XKj†​ with ∑jKj†Kj=IB\sum_jK_j^\dagger K_j=I_B∑j​Kj†​Kj​=IB​. If worst\mathrm{worst}worst is true, then f=sup⁡Dinf⁡r∈N, ρ≥0, Tr⁡ρ=1F∗(ρ,(id⁡r+1⊗(D∘N))(ρ))\displaystyle f=\sup_D\inf_{r\in\mathbb N,\ \rho\geq0,\ \operatorname{Tr}\rho=1}F_*(\rho,(\operatorname{id}_{r+1}\otimes(D\circ N))(\rho))f=Dsup​r∈N, ρ≥0, Trρ=1inf​F∗​(ρ,(idr+1​⊗(D∘N))(ρ)), with ρ\rhoρ on a reference space of dimension r+1r+1r+1 and the length-kkk string space; if it is false, then f=sup⁡DF∗(PΦ,(id⁡⊗(D∘N))(PΦ))\displaystyle f=\sup_DF_*(P_\Phi,(\operatorname{id}\otimes(D\circ N))(P_\Phi))f=Dsup​F∗​(PΦ​,(id⊗(D∘N))(PΦ​)), where Φx,y=2−k/2\Phi_{x,y}=2^{-k/2}Φx,y​=2−k/2 for x=yx=yx=y and 000 otherwise, and PΦ=ΦΦ†P_\Phi=\Phi\Phi^\daggerPΦ​=ΦΦ†. Each tensor extension acts separately on reference-indexed blocks. The extrema are real-valued supremum and infimum operations, with no attainment asserted. The definition permits k=0k=0k=0 and empty BBB, imposes no channel condition on NNN, and uses the total real square root, so a negative outer radicand gives 000.

QAlgorithms.Papers.Independent.Extend50.P03.orthogonalBlockOperator

For arbitrary types P1,P2,QP_1,P_2,QP1​,P2​,Q, any natural number mmm, a family of complex matrices Πi\Pi_iΠi​ indexed by P1P_1P1​, and a family of complex matrices ρi\rho_iρi​ indexed by P2×QP_2\times QP2​×Q, for 0≤i<m0\le i<m0≤i<m, this definition returns the complex matrix XXX indexed by (P1×P2)×Q(P_1\times P_2)\times Q(P1​×P2​)×Q with entries

X((a,b),c),((a′,b′),c′)=∑i=0m−1(Πi)a,a′ (ρi)(b,c),(b′,c′).X_{((a,b),c),((a',b'),c')} = \sum_{i=0}^{m-1} (\Pi_i)_{a,a'}\,(\rho_i)_{(b,c),(b',c')}.X((a,b),c),((a′,b′),c′)​=i=0∑m−1​(Πi​)a,a′​(ρi​)(b,c),(b′,c′)​.

No finiteness or nonemptiness assumptions are imposed on P1,P2,QP_1,P_2,QP1​,P2​,Q, and no projection, orthogonality, positivity, or normalization assumptions are imposed on either matrix family. If m=0m=0m=0, the sum is empty and the resulting matrix is zero.

QAlgorithms.Papers.Independent.Extend50.P03.pureEncoder

For natural numbers n,kn,kn,k, a supplied proof that k≤nk\le nk≤n, an arbitrary complex vector ψ\psiψ indexed by (n−k)(n-k)(n−k)-bit strings, and a unitary matrix UUU indexed by nnn-bit strings, define a function from complex matrices ρ\rhoρ indexed by kkk-bit strings to matrices indexed by nnn-bit strings by ρ↦UMρU†\rho\mapsto U M_\rho U^\daggerρ↦UMρ​U†, where (Mρ)z,w=ρzL,wLψzAψwA‾(M_\rho)_{z,w}=\rho_{z_L,w_L}\psi_{z_A}\overline{\psi_{w_A}}(Mρ​)z,w​=ρzL​,wL​​ψzA​​ψwA​​​, and zL,zAz_L,z_AzL​,zA​ denote the first kkk and last n−kn-kn−k bits of zzz, respectively, with the same convention for www. No normalization of ψ\psiψ or density-matrix condition on ρ\rhoρ is required. Empty logical or ancillary strings are allowed.

QAlgorithms.Papers.Independent.Extend50.P03.purified

For every finite index type III equipped with decidable equality and any complex square matrices ρ,σ\rho,\sigmaρ,σ indexed by III, this defines 1−F∗(ρ,σ)2\displaystyle \sqrt{1-F_*(\rho,\sigma)^2}1−F∗​(ρ,σ)2​, where F∗(ρ,σ)=Re⁡Tr⁡ ⁣(ρ σ ρ)\displaystyle F_*(\rho,\sigma)=\operatorname{Re}\operatorname{Tr}\!\left(\sqrt{\sqrt{\rho}\,\sigma\,\sqrt{\rho}}\right)F∗​(ρ,σ)=ReTr(ρ​σρ​​) and each matrix square root is defined by continuous functional calculus applied to the real square-root function. Neither matrix is assumed positive semidefinite or normalized, and III may be empty. The outer square root is the total real square-root function, which returns 000 for a negative argument; consequently the formula is defined even when F∗(ρ,σ)2>1F_*(\rho,\sigma)^2>1F∗​(ρ,σ)2>1.

QAlgorithms.Papers.Independent.Extend50.P03.reducedAverage

For arbitrary natural numbers n,k,α,tn,k,\alpha,tn,k,α,t, this defines the complex matrix indexed by Qk×QtQ_k\times Q_tQk​×Qt​, where Qs={0,1}sQ_s=\{0,1\}^sQs​={0,1}s, by

∑j=0k∑i=0t2−kCmax⁡(n−t,0)(j+α−i)Cn(j+α)(Pk,j⊗Pt,i).\sum_{j=0}^{k}\sum_{i=0}^{t} \frac{2^{-k}C_{\max(n-t,0)}(j+\alpha-i)} {C_n(j+\alpha)} \bigl(P_{k,j}\otimes P_{t,i}\bigr).j=0∑k​i=0∑t​Cn​(j+α)2−kCmax(n−t,0)​(j+α−i)​(Pk,j​⊗Pt,i​).

Here the argument j+α−ij+\alpha-ij+α−i of CCC is computed in the integers; Cs(q)=(sq)C_s(q)=\binom sqCs​(q)=(qs​) as a real number for 0≤q≤s0\le q\le s0≤q≤s, and zero otherwise. The matrix Ps,qP_{s,q}Ps,q​ is diagonal with entry one at precisely those sss-bit strings having qqq ones, and zero elsewhere, and the displayed real coefficients are cast to complex scalars. No admissibility assumptions are imposed: t>nt>nt>n is allowed and makes the first binomial parameter zero through truncated natural subtraction; negative or oversized binomial arguments give zero, and division by a zero denominator is zero. The definition also includes zero values of all parameters.

QAlgorithms.Papers.Independent.Extend50.P03.relativeRemainder

For either Boolean value worst\mathrm{worst}worst and any quadruple d=(n,k,α,t)d=(n,k,\alpha,t)d=(n,k,α,t) of natural numbers, this defines the real number

{kt2/n,worst=true,k2t2/n,worst=false.\begin{cases} kt^2/n,&\mathrm{worst}=\mathrm{true},\\ k^2t^2/n,&\mathrm{worst}=\mathrm{false}. \end{cases}{kt2/n,k2t2/n,​worst=true,worst=false.​

There are no admissibility or positivity assumptions, and α\alphaα does not affect the value. Division by zero is defined to be zero, so the result is zero when n=0n=0n=0.

QAlgorithms.Papers.Independent.Extend50.P03.retain

For every natural number nnn and subset S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1}, this defines a function from complex matrices indexed by length-nnn Boolean strings to complex matrices indexed by Boolean assignments on SSS. For any input matrix ρ\rhoρ, its output has entries (retain⁡S(ρ))u,v=∑z:Sc→{false,true}ρu∪z, v∪z\displaystyle (\operatorname{retain}_S(\rho))_{u,v}=\sum_{z:S^c\to\{\mathrm{false},\mathrm{true}\}}\rho_{u\cup z,\,v\cup z}(retainS​(ρ))u,v​=z:Sc→{false,true}∑​ρu∪z,v∪z​, where u∪zu\cup zu∪z is the full string equal to uuu on SSS and zzz on its complement. No positivity or normalization is required of ρ\rhoρ. When SSS is empty, the output is the one-by-one matrix containing Tr⁡ρ\operatorname{Tr}\rhoTrρ; when SSS contains every position, the sum has one term and retains all entries, under the corresponding identification of indices. The definition also includes n=0n=0n=0.

QAlgorithms.Papers.Independent.Extend50.P03.singleErasureLaw

For every natural number nnn and every finite subset S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1}, this definition returns the real number 1/n1/n1/n if ∣S∣=1|S|=1∣S∣=1, and 000 otherwise. It is defined for n=0n=0n=0 as well: the only possible subset is empty, so its value is 000. For positive nnn, every singleton has value 1/n1/n1/n, and every other subset has value 000.

QAlgorithms.Papers.Independent.Extend50.P03.siteError

For natural numbers n,k,αn,k,\alphan,k,α, a Boolean worst\mathrm{worst}worst, an ancilla datum AAA, a subset SSS of the nnn positions, and any unitary matrix UUU on length-nnn Boolean strings, this defines the following error. The datum AAA supplies k≤nk\leq nk≤n, α≤n−k\alpha\leq n-kα≤n−k, and a vector ψ\psiψ on length-(n−k)(n-k)(n−k) strings with ∥ψ∥=1\|\psi\|=1∥ψ∥=1 and Hψ=αψH\psi=\alpha\psiHψ=αψ, where HHH is diagonal with entry equal to the number of true bits. Define the encoding E(X)=U(X⊗ψψ†)U†E(X)=U(X\otimes\psi\psi^\dagger)U^\daggerE(X)=U(X⊗ψψ†)U†, placing the kkk input positions first and the n−kn-kn−k ancilla positions last, and define N(X)N(X)N(X) on assignments u,vu,vu,v to ScS^cSc by N(X)u,v=∑e:S→{false,true}E(X)u∪e, v∪e\displaystyle N(X)_{u,v}=\sum_{e:S\to\{\mathrm{false},\mathrm{true}\}}E(X)_{u\cup e,\,v\cup e}N(X)u,v​=e:S→{false,true}∑​E(X)u∪e,v∪e​. Write F∗(R,T)=Re⁡Tr⁡R T R\displaystyle F_*(R,T)=\operatorname{Re}\operatorname{Tr}\sqrt{\sqrt R\,T\,\sqrt R}F∗​(R,T)=ReTrR​TR​​ using continuous functional calculus. The result is 1−f2\sqrt{1-f^2}1−f2​, where, if worst\mathrm{worst}worst is true, f=sup⁡Dinf⁡r∈N, ρ≥0, Tr⁡ρ=1F∗(ρ,(id⁡r+1⊗(D∘N))(ρ))\displaystyle f=\sup_D\inf_{r\in\mathbb N,\ \rho\geq0,\ \operatorname{Tr}\rho=1}F_*(\rho,(\operatorname{id}_{r+1}\otimes(D\circ N))(\rho))f=Dsup​r∈N, ρ≥0, Trρ=1inf​F∗​(ρ,(idr+1​⊗(D∘N))(ρ)), and otherwise f=sup⁡DF∗(PΦ,(id⁡⊗(D∘N))(PΦ))\displaystyle f=\sup_DF_*(P_\Phi,(\operatorname{id}\otimes(D\circ N))(P_\Phi))f=Dsup​F∗​(PΦ​,(id⊗(D∘N))(PΦ​)), with Φx,y=2−k/2\Phi_{x,y}=2^{-k/2}Φx,y​=2−k/2 for equal length-kkk strings and 000 otherwise and PΦ=ΦΦ†P_\Phi=\Phi\Phi^\daggerPΦ​=ΦΦ†. In the first case ρ\rhoρ ranges over matrices on the reference space of dimension r+1r+1r+1 and the logical string space; each tensor extension acts blockwise. Decoders DDD map matrices on assignments to ScS^cSc back to logical matrices and admit finite Kraus representations D(Y)=∑jKjYKj†D(Y)=\sum_jK_jYK_j^\daggerD(Y)=∑j​Kj​YKj†​ with ∑jKj†Kj=I\sum_jK_j^\dagger K_j=I∑j​Kj†​Kj​=I. The extrema are real-valued, and the outer square root returns 000 for a negative argument. No charge-conservation condition is imposed on UUU, no size restriction is imposed on SSS, and zero sizes are included whenever the ancilla datum exists.

QAlgorithms.Papers.Independent.Extend50.P03.splitBits

For natural numbers n,kn,kn,k, a supplied proof that k≤nk\le nk≤n, and an nnn-bit string zzz, this function returns the pair (u,v)(u,v)(u,v) consisting of its first kkk bits and its remaining n−kn-kn−k bits: ui=ziu_i=z_iui​=zi​ for 0≤i<k0\le i<k0≤i<k and vj=zk+jv_j=z_{k+j}vj​=zk+j​ for 0≤j<n−k0\le j<n-k0≤j<n−k. When k=0k=0k=0 the first string is empty; when k=nk=nk=n the second is empty.

QAlgorithms.Papers.Independent.Extend50.P03.twoBasis

For every natural number kkk, any two length-kkk Boolean strings x,yx,yx,y, and two Boolean flags called imaginary and negative, this definition returns the complex Euclidean vector

12(∣x⟩+s ζ ∣y⟩),s={−1,negative is true,1,negative is false,ζ={i,imaginary is true,1,imaginary is false.\frac{1}{\sqrt2}\bigl(|x\rangle+s\,\zeta\,|y\rangle\bigr), \qquad s= \begin{cases}-1,&\text{negative is true},\\1,&\text{negative is false},\end{cases} \quad \zeta= \begin{cases}\mathrm i,&\text{imaginary is true},\\1,&\text{imaginary is false}.\end{cases}2​1​(∣x⟩+sζ∣y⟩),s={−1,1,​negative is true,negative is false,​ζ={i,1,​imaginary is true,imaginary is false.​

Here ∣x⟩|x\rangle∣x⟩ is the coordinate vector equal to 111 at xxx and 000 at every other string, and likewise for ∣y⟩|y\rangle∣y⟩. No assumption x≠yx\ne yx=y is made: if x=yx=yx=y, the result is (1+sζ)∣x⟩/2(1+s\zeta)|x\rangle/\sqrt2(1+sζ)∣x⟩/2​, which is zero when imaginary is false and negative is true, and has norm 2\sqrt22​ when both flags are false. The case k=0k=0k=0, where necessarily x=yx=yx=y, is included.

QAlgorithms.Papers.Independent.Extend50.P03.unitaryEntryMoment

For any natural numbers n,rn,rn,r, any four lists a,b,c,da,b,c,da,b,c,d of rrr bit strings of length nnn, and any complex unitary matrix UUU indexed by those nnn-bit strings, the defined complex number is

(∏i=0r−1Uai,bi)(∏i=0r−1Uci,di)‾.\left(\prod_{i=0}^{r-1}U_{a_i,b_i}\right) \overline{\left(\prod_{i=0}^{r-1}U_{c_i,d_i}\right)}.(i=0∏r−1​Uai​,bi​​)(i=0∏r−1​Uci​,di​​)​.

Repeated indices are permitted. When r=0r=0r=0, both products are empty and the value is 111; when n=0n=0n=0, the matrix is indexed by the single empty bit string.

QAlgorithms.Papers.Independent.Extend50.P03.unitaryMeasurable

For every natural number nnn, equip the group of unitary complex matrices indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n with the Borel σ\sigmaσ-algebra generated by its topology. This includes n=0n=0n=0, when Q0Q_0Q0​ contains the single empty bit string and these matrices have size 1×11\times11×1.

QAlgorithms.Papers.Independent.Extend50.P03.weightSectorProjector

For every natural number nnn and integer qqq, this defines a complex matrix indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, whose entry at (x,y)(x,y)(x,y) is one if x=yx=yx=y and xxx has exactly qqq ones, and zero otherwise. It is therefore the diagonal matrix selecting bit strings of weight qqq. It is zero for q<0q<0q<0 or q>nq>nq>n; for n=0n=0n=0, its sole entry is one when q=0q=0q=0 and zero otherwise.

QAlgorithms.Papers.Independent.Extend50.P03.worstFidelity

For every natural number kkk, every finite type BBB equipped with decidable equality, and every function NNN from complex matrices on length-kkk Boolean strings to complex matrices on BBB, this defines sup⁡Dinf⁡r∈Nρ≥0, Tr⁡ρ=1F∗ ⁣(ρ,(id⁡r+1⊗(D∘N))(ρ))\displaystyle \sup_D\inf_{\substack{r\in\mathbb N\\ \rho\geq0,\ \operatorname{Tr}\rho=1}}F_*\!\left(\rho,(\operatorname{id}_{r+1}\otimes(D\circ N))(\rho)\right)Dsup​r∈Nρ≥0, Trρ=1​inf​F∗​(ρ,(idr+1​⊗(D∘N))(ρ)), where ρ\rhoρ is indexed by {0,…,r}×{false,true}k\{0,\ldots,r\}\times\{\mathrm{false},\mathrm{true}\}^k{0,…,r}×{false,true}k. Here F∗(R,S)=Re⁡Tr⁡R S R\displaystyle F_*(R,S)=\operatorname{Re}\operatorname{Tr}\sqrt{\sqrt R\,S\,\sqrt R}F∗​(R,S)=ReTrR​SR​​ uses continuous functional calculus, and the tensor extension applies the function separately to the blocks determined by the reference indices. The outer supremum ranges over functions DDD admitting a finite representation D(X)=∑j=0m−1KjXKj†D(X)=\sum_{j=0}^{m-1}K_jXK_j^\daggerD(X)=∑j=0m−1​Kj​XKj†​ on every matrix XXX, with ∑jKj†Kj=IB\sum_jK_j^\dagger K_j=I_B∑j​Kj†​Kj​=IB​; the same decoder is used throughout its inner infimum. All positive finite reference dimensions occur, since rrr may be 000, and k=0k=0k=0 is allowed. No channel or linearity assumption is imposed on NNN, and BBB may be empty. Both extrema are the real-valued supremum and infimum operations; no attainment or boundedness condition is part of the definition.

Human review
  • Endorsed by Shuze Chen · Oct 29, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 29, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me