Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Quantum teleportation scheme by selecting one of multiple output ports

Definition
QAlgorithms_Papers_Independent_Intake100_P67

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

prove2quantum

The objects the formalized statements of Quantum teleportation scheme by selecting one of multiple output ports (arXiv:0901.2975) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • AC: PDF pp.1–3: the ordered Alice register and the extra input/reference qubit.
  • singletAmp: PDF p.2: the normalized singlet amplitude, with |0> = spin down.
  • resource: PDF p.2: normalized resource (O tensor I)|singlet>^N, allowing rectangular O.
  • ResourceNormalized: PDF p.3, Eq.(5): exactly the normalization required of O, including singular O.
  • transformed: PDF p.3, Eq.(3): transformed effects, with C relabelled B.
  • portSignal: PDF p.2, Eq.(2): signal sigma(i), including the maximally mixed unused A qubits.
  • portRho: PDF p.3, Eq.(6): the sum of the physical signal matrices.
  • entFidelity: PDF p.3, Eq.(3): singlet entanglement fidelity of the recovered qubit.
  • portAverageFidelity: PDF pp.2–3: normalized Haar average, f=(2F+1)/3, for deterministic protocols.
  • IsDeterministicPortProtocol: PDF pp.2–3: input-independent resource and a full N-outcome Alice POVM. Bob's only operation is selection of the reported port.
  • portRetainedOutput: PDF p.2, Eq.(1): one retained-port branch, written in matrix entries. Tracing out Alice makes the square-root instrument equal to contraction with its effect. No operation on the output qudit occurs.
  • SubPOVM: PDF p.7: a sub-POVM with the positive omitted effect as failure outcome 0.
  • IsFaithfulPortProtocol: PDF p.7: every successful branch returns every normalized unknown pure input exactly. Zero-probability branches are allowed; failure is unconstrained.
  • IsProbabilisticPortProtocol: PDF pp.7–8: physical faithful probabilistic protocols with an input-independent resource.
  • portSuccessProbability: PDF p.7, Eq.(44): success averaged over normalized Haar inputs, not conditional fidelity.
  • Other: PDF pp.3–5: the actual residual wires; no fictitious negative-spin subsystem.
  • embedTheta: PDF p.7, Eq.(45): P^-_{AiC} tensor Theta_i on the remaining A wires.
  • PortSuccessFeasible: PDF p.7, Eqs.(5),(46): the complete success SDP feasibility constraints.
  • successObjective: PDF p.7, Eq.(47): the success SDP objective.
  • spins: PDF pp.3–5: legal doubled spins k=2j. Factorial arguments below are integers.
  • spinSquare: PDF p.3: Casimir J^2 of spin-half wires, from S_i.S_j=(Swap_ij-I/2)/2. The scalar arithmetic is real, so n=0 never causes natural subtraction underflow.
  • qubitSpinProjector: PDF pp.3–5: the spin-j projector, defined intrinsically by spectral calculus of J^2. This is the identity 11(j) on the span of all source |Phi(j,m,alpha)> vectors. Finite spectra make the indicator continuous on the spectrum. Illegal sectors are zero.
  • totalProjector: PDF p.4: the total-spin projector on AC, the extra qubit indexed by none.
  • lambdaMinus: PDF p.3, Eq.(7): lambda^-_j with j=k/2. Real subtraction is intentional.
  • lambdaPlus: PDF p.3, Eq.(7): lambda^+_j with j=k/2.
  • minusSector: PDF pp.3–4, Eqs.(8),(17): the whole eigenspace obtained by coupling j to j+1/2.
  • plusSector: PDF pp.3–4, Eqs.(8),(17): coupling j to j-1/2; absent when j=0.
  • rhoBlock: PDF p.4: rho(s), on the full space with zero on other total-spin sectors.
  • xiProjector: PDF p.5, Eq.(24): projector onto singlet_{AiC} tensor the residual spin-s sector.
  • signalBlock: PDF p.5: sigma(i)(s), including the normalization 2^{-(N-1)}.
  • compressedScalar: PDF p.5, Eq.(26): scalar compressed moment; k=2s and y is nonzero. At s=0 the nonexistent j=-1/2 term is omitted.
  • completedSRM: PDF p.5, Eqs.(27),(28): SRM completed uniformly on its kernel.
  • fixedFidelity: PDF p.5, Eq.(29): exact fixed-resource entanglement fidelity.
  • deterministicOptimumFidelity: PDF p.7, Eq.(41): the optimum singlet entanglement fidelity.
  • deterministicOptimumAverage: PDF p.7, Eq.(42): the optimum Haar average recovered-qubit fidelity.
  • deterministicGamma: PDF p.6, Eq.(35): gamma(j) on the legal doubled-spin range.
  • deterministicX: PDF p.6, Eq.(34): the explicitly optimized deterministic resource X.
  • generalizedFilter: PDF p.6, Eqs.(32)–(37): sqrt(z)rho(s)^(-1/y), after cancellation. Its branch factors are sqrt(gamma(j)/lambda_j). This agrees with the generalized SRM on nonzero sectors and defines its nonsingular s=0 endpoint without inventing y(0).
  • generalizedCore: PDF p.6, Eq.(32): transformed generalized SRM before the excess term.
  • generalizedEffects: PDF p.6, Eqs.(32),(39): transformed effects, including the uniform positive remainder.
  • resourceOperator: PDF pp.3,6–8: O=sqrt(X), the positive representative of the pure resource.
  • physicalEffects: PDF pp.3,6–8: physical measurement on the range of O, completed on its complement. For sub-POVMs use complete=false so the omitted complement is part of failure.
  • deterministicMeasurement: PDF pp.6–7: the actual optimized deterministic POVM.
  • fixedSuccess: PDF p.8, Eq.(50): the exact fixed-resource success probability, k=2s.
  • probabilisticOptimumSuccess: PDF p.8, Eq.(56): fully optimized faithful qubit success probability.
  • fixedTheta: PDF pp.7–8, Eq.(48): fixed-resource attaining Theta_i.
  • optimalTheta: PDF p.8, Eqs.(52),(53): optimized attaining Theta_i.
  • probabilisticX: PDF p.8, Eq.(54): optimized probabilistic resource X.
  • probabilisticMeasurement: PDF pp.8–9: optimized physical successful effects; failure is I minus their sum.
  • quditResource: PDF pp.5–6: the normalized positive maximally entangled qudit resource.
  • quditSignal: PDF p.5: qudit sigma(i), with the positive maximally entangled reference.
  • quditChannel: PDF pp.5–6: the completed qudit SRM channel, applied to arbitrary operators.
  • bobDensity: PDF p.9: Bob's full reduced density of a pure resource.
  • bobPortDensity: PDF p.9: Bob's one-port marginal, tracing all A and all other ports.
  • restorePort: PDF pp.9–10: insert the selected port into a configuration of the remaining ports.
  • postAmplitude: PDF p.2, Eq.(1), pp.9–10: the single-Kraus square-root postmeasurement vector. All Alice registers, including C, are retained.
  • postBranchProbability: PDF pp.9–10: branch probability, the squared norm of the unnormalized postmeasurement vector.
  • residualDensity: PDF pp.9–10: normalized density of the unused Bob ports on a successful branch. Its entropy is that of the pure residual state in the (all Alice):(unused Bob) cut. Theorems ensure a positive branch probability before using this quotient.
  • plusAmp: PDF p.9: the two-qubit |psi^+> amplitude.
  • twoPortResource: PDF p.9, Eq.(57): the explicit optimized two-port pure resource.
  • xAmplitude: PDF p.9: x^+ and x^-; these are Alice states, not the unknown input.
  • twoPortEta: PDF p.9, Eq.(58): the two orthogonal unit vectors eta^- and eta^+.
  • swapTwo: PDF p.9: A1 <-> A2.
  • twoPortMeasurement: PDF p.9, Eq.(58) and its exchanged branch: the two projective successful effects.
  • twoPortResidual: PDF p.9, Eq.(59): the normalized residual vector for port 1; t labels the unused port.
  • twoPortResidualExpanded: PDF p.9, Eq.(59), second line: the same residual expanded in Bell states.
  • twoPortInitialEntropy: PDF pp.9–10: the exact entropy of Eq.(57), replacing the rounded printed 1.90.
  • klmCurve: PDF p.8: the KLM success curve quoted from [17], only for the numerical comparison.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Ensemble
import Definitions.Def_QAlgorithms_Defs_QuditChannelFidelities
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P71
import Definitions.Def_QAlgorithms_Papers_Independent_Advance50_P49

noncomputable section

open scoped Matrix Kronecker ComplexConjugate ComplexOrder Matrix.Norms.L2Operator

attribute [local instance] Classical.propDecidable
attribute [local instance] Classical.decEq

namespace QAlgorithms.Papers.Independent.Intake100.P67

open QAlgorithms.Papers.Independent.Information100.P71 (supportPower)
open QAlgorithms.Papers.Independent.Advance50.P49 (spinMultiplicity)

/-- PDF pp.1–3: the ordered Alice register and the extra input/reference qubit. -/
abbrev AC (N : ℕ) := Qubits N × Bool

/-- PDF p.2: the normalized singlet amplitude, with |0> = spin down. -/
def singletAmp (a b : Bool) : ℂ :=
  if a = false ∧ b = true then (Real.sqrt 2 : ℂ)⁻¹
  else if a = true ∧ b = false then -(Real.sqrt 2 : ℂ)⁻¹ else 0

/-- PDF p.2: normalized resource (O tensor I)|singlet>^N, allowing rectangular O. -/
def resource {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (a : Qubits NA) (b : Qubits N) : ℂ :=
  ∑ x : Qubits N, O a x * ∏ i, singletAmp (x i) (b i)

/-- PDF p.3, Eq.(5): exactly the normalization required of O, including singular O. -/
def ResourceNormalized {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ) : Prop :=
  (Oᴴ * O).trace = (2 : ℂ) ^ N

/-- PDF p.3, Eq.(3): transformed effects, with C relabelled B. -/
def transformed {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Matrix (AC NA) (AC NA) ℂ) : Matrix (AC N) (AC N) ℂ :=
  (Oᴴ ⊗ₖ (1 : Matrix Bool Bool ℂ)) * M * (O ⊗ₖ (1 : Matrix Bool Bool ℂ))

/-- PDF p.2, Eq.(2): signal sigma(i), including the maximally mixed unused A qubits. -/
def portSignal (N : ℕ) (i : Fin N) : Matrix (AC N) (AC N) ℂ :=
  fun p q => if ∀ k, k ≠ i → p.1 k = q.1 k then
    singletAmp (p.1 i) p.2 * conj (singletAmp (q.1 i) q.2) / (2 : ℂ) ^ (N - 1)
  else 0

/-- PDF p.3, Eq.(6): the sum of the physical signal matrices. -/
def portRho (N : ℕ) : Matrix (AC N) (AC N) ℂ := ∑ i, portSignal N i

/-- PDF p.3, Eq.(3): singlet entanglement fidelity of the recovered qubit. -/
def entFidelity {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : ℝ :=
  (∑ i, (transformed O (M i) * portSignal N i).trace.re) / 4

/-- PDF pp.2–3: normalized Haar average, f=(2F+1)/3, for deterministic protocols. -/
def portAverageFidelity {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : ℝ := (2 * entFidelity O M + 1) / 3

/-- PDF pp.2–3: input-independent resource and a full N-outcome Alice POVM.
Bob's only operation is selection of the reported port. -/
def IsDeterministicPortProtocol {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : Prop :=
  ResourceNormalized O ∧ (∀ i, (M i).PosSemidef) ∧ ∑ i, M i = 1

/-- PDF p.2, Eq.(1): one retained-port branch, written in matrix entries.
Tracing out Alice makes the square-root instrument equal to contraction with its effect.
No operation on the output qudit occurs. -/
def portRetainedOutput {K A : Type*} [Fintype K] [Fintype A] {N : ℕ}
    (R : A → (Fin N → K) → ℂ) (M : Matrix (A × K) (A × K) ℂ)
    (i : Fin N) (T : Matrix K K ℂ) : Matrix K K ℂ :=
  fun u v => ∑ b : Fin N → K, ∑ b' : Fin N → K,
    if b i = u ∧ b' i = v ∧ (∀ k, k ≠ i → b k = b' k) then
      ∑ a : A, ∑ a' : A, ∑ c : K, ∑ c' : K,
        R a b * conj (R a' b') * T c c' * M (a', c') (a, c)
    else 0

/-- PDF p.7: a sub-POVM with the positive omitted effect as failure outcome 0. -/
def SubPOVM {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : Prop :=
  ResourceNormalized O ∧ (∀ i, (M i).PosSemidef) ∧ (1 - ∑ i, M i).PosSemidef

/-- PDF p.7: every successful branch returns every normalized unknown pure input exactly.
Zero-probability branches are allowed; failure is unconstrained. -/
def IsFaithfulPortProtocol {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : Prop :=
  ∀ (v : EuclideanSpace ℂ Bool), IsState v → ∀ i,
    ∃ q : ℝ, 0 ≤ q ∧ portRetainedOutput (resource O) (M i) i (pureDensity v) =
      (q : ℂ) • pureDensity v

/-- PDF pp.7–8: physical faithful probabilistic protocols with an input-independent resource. -/
def IsProbabilisticPortProtocol {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : Prop := SubPOVM O M ∧ IsFaithfulPortProtocol O M

/-- PDF p.7, Eq.(44): success averaged over normalized Haar inputs, not conditional fidelity. -/
def portSuccessProbability {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Fin N → Matrix (AC NA) (AC NA) ℂ) : ℝ :=
  (∑ i, (transformed O (M i)).trace.re) / (2 : ℝ) ^ (N + 1)

/-- PDF pp.3–5: the actual residual wires; no fictitious negative-spin subsystem. -/
abbrev Other (N : ℕ) (i : Fin N) := {k : Fin N // k ≠ i}

/-- PDF p.7, Eq.(45): P^-_{AiC} tensor Theta_i on the remaining A wires. -/
def embedTheta {N : ℕ} (i : Fin N)
    (T : Matrix (Other N i → Bool) (Other N i → Bool) ℂ) : Matrix (AC N) (AC N) ℂ :=
  fun p q => singletAmp (p.1 i) p.2 * conj (singletAmp (q.1 i) q.2) *
    T (fun k => p.1 k.1) (fun k => q.1 k.1)

/-- PDF p.7, Eqs.(5),(46): the complete success SDP feasibility constraints. -/
def PortSuccessFeasible (N : ℕ) (X : Matrix (Qubits N) (Qubits N) ℂ)
    (T : (i : Fin N) → Matrix (Other N i → Bool) (Other N i → Bool) ℂ) : Prop :=
  X.PosSemidef ∧ X.trace = (2 : ℂ) ^ N ∧ (∀ i, (T i).PosSemidef) ∧
    (X ⊗ₖ (1 : Matrix Bool Bool ℂ) - ∑ i, embedTheta i (T i)).PosSemidef

/-- PDF p.7, Eq.(47): the success SDP objective. -/
def successObjective {N : ℕ}
    (T : (i : Fin N) → Matrix (Other N i → Bool) (Other N i → Bool) ℂ) : ℝ :=
  (∑ i, (T i).trace.re) / (2 : ℝ) ^ (N + 1)

/-- PDF pp.3–5: legal doubled spins k=2j. Factorial arguments below are integers. -/
def spins (n : ℕ) : Finset ℕ := (Finset.range (n + 1)).filter fun k => k % 2 = n % 2

/-- PDF p.3: Casimir J^2 of spin-half wires, from S_i.S_j=(Swap_ij-I/2)/2.
The scalar arithmetic is real, so n=0 never causes natural subtraction underflow. -/
def spinSquare (W : Type*) [Fintype W] : Matrix (W → Bool) (W → Bool) ℂ :=
  (((Fintype.card W : ℝ) * (4 - Fintype.card W) / 4 : ℝ) : ℂ) • 1 +
    (1 / 2 : ℂ) • ∑ i : W, ∑ j : W,
      if i = j then 0 else
        (fun a b => if a = b ∘ Equiv.swap i j then (1 : ℂ) else 0)

/-- PDF pp.3–5: the spin-j projector, defined intrinsically by spectral calculus of J^2.
This is the identity 11(j) on the span of all source |Phi(j,m,alpha)> vectors.
Finite spectra make the indicator continuous on the spectrum. Illegal sectors are zero. -/
def qubitSpinProjector (W : Type*) [Fintype W] (k : ℕ) : Matrix (W → Bool) (W → Bool) ℂ :=
  if k ∈ spins (Fintype.card W) then
    cfc (fun x : ℝ => if x = (k : ℝ) * (k + 2) / 4 then (1 : ℝ) else 0) (spinSquare W)
  else 0

/-- PDF p.4: the total-spin projector on AC, the extra qubit indexed by none. -/
def totalProjector (N k : ℕ) : Matrix (AC N) (AC N) ℂ :=
  fun p q => qubitSpinProjector (Option (Fin N)) k (fun w => w.elim p.2 p.1)
    (fun w => w.elim q.2 q.1)

/-- PDF p.3, Eq.(7): lambda^-_j with j=k/2. Real subtraction is intentional. -/
def lambdaMinus (N k : ℕ) : ℝ := ((N : ℝ) / 2 - (k : ℝ) / 2) / (2 : ℝ) ^ N

/-- PDF p.3, Eq.(7): lambda^+_j with j=k/2. -/
def lambdaPlus (N k : ℕ) : ℝ := ((N : ℝ) / 2 + (k : ℝ) / 2 + 1) / (2 : ℝ) ^ N

/-- PDF pp.3–4, Eqs.(8),(17): the whole eigenspace obtained by coupling j to j+1/2. -/
def minusSector (N k : ℕ) : Matrix (AC N) (AC N) ℂ :=
  (qubitSpinProjector (Fin N) k ⊗ₖ (1 : Matrix Bool Bool ℂ)) * totalProjector N (k + 1)

/-- PDF pp.3–4, Eqs.(8),(17): coupling j to j-1/2; absent when j=0. -/
def plusSector (N k : ℕ) : Matrix (AC N) (AC N) ℂ :=
  if k = 0 then 0 else
    (qubitSpinProjector (Fin N) k ⊗ₖ (1 : Matrix Bool Bool ℂ)) * totalProjector N (k - 1)

/-- PDF p.4: rho(s), on the full space with zero on other total-spin sectors. -/
def rhoBlock (N k : ℕ) : Matrix (AC N) (AC N) ℂ := totalProjector N k * portRho N

/-- PDF p.5, Eq.(24): projector onto singlet_{AiC} tensor the residual spin-s sector. -/
def xiProjector {N : ℕ} (i : Fin N) (k : ℕ) : Matrix (AC N) (AC N) ℂ :=
  embedTheta i (qubitSpinProjector (Other N i) k)

/-- PDF p.5: sigma(i)(s), including the normalization 2^{-(N-1)}. -/
def signalBlock {N : ℕ} (i : Fin N) (k : ℕ) : Matrix (AC N) (AC N) ℂ :=
  ((2 : ℂ) ^ (N - 1))⁻¹ • xiProjector i k

/-- PDF p.5, Eq.(26): scalar compressed moment; k=2s and y is nonzero.
At s=0 the nonexistent j=-1/2 term is omitted. -/
def compressedScalar (N k : ℕ) (y : ℝ) : ℝ :=
  (if k = 0 then 0 else (k : ℝ) / (2 * (k + 1)) *
    Real.rpow (lambdaMinus N (k - 1)) (-1 / y)) +
  ((k : ℝ) + 2) / (2 * (k + 1)) * Real.rpow (lambdaPlus N (k + 1)) (-1 / y)

/-- PDF p.5, Eqs.(27),(28): SRM completed uniformly on its kernel. -/
def completedSRM {I : Type} [Fintype I] [DecidableEq I] {N : ℕ}
    (S : Fin N → Matrix I I ℂ) (i : Fin N) : Matrix I I ℂ :=
  let H := supportPower (∑ j, S j) (-1 / 2)
  H * S i * H + (N : ℂ)⁻¹ • (1 - ∑ j, H * S j * H)

/-- PDF p.5, Eq.(29): exact fixed-resource entanglement fidelity. -/
def fixedFidelity (N : ℕ) : ℝ :=
  (∑ k ∈ Finset.range (N + 1),
    (((N : ℝ) - 2 * k - 1) / Real.sqrt (k + 1) +
      ((N : ℝ) - 2 * k + 1) / Real.sqrt ((N : ℝ) - k + 1)) ^ 2 *
      (N.choose k : ℝ)) / (2 : ℝ) ^ (N + 3)

/-- PDF p.7, Eq.(41): the optimum singlet entanglement fidelity. -/
def deterministicOptimumFidelity (N : ℕ) : ℝ := Real.cos (Real.pi / (N + 2)) ^ 2

/-- PDF p.7, Eq.(42): the optimum Haar average recovered-qubit fidelity. -/
def deterministicOptimumAverage (N : ℕ) : ℝ := 2 / 3 + Real.cos (2 * Real.pi / (N + 2)) / 3

/-- PDF p.6, Eq.(35): gamma(j) on the legal doubled-spin range. -/
def deterministicGamma (N k : ℕ) : ℝ :=
  (2 : ℝ) ^ (N + 2) / ((N + 2) * (k + 1) * spinMultiplicity N k) *
    Real.sin (Real.pi * (k + 1) / (N + 2)) ^ 2

/-- PDF p.6, Eq.(34): the explicitly optimized deterministic resource X. -/
def deterministicX (N : ℕ) : Matrix (Qubits N) (Qubits N) ℂ :=
  ∑ k ∈ spins N, (deterministicGamma N k : ℂ) • qubitSpinProjector (Fin N) k

/-- PDF p.6, Eqs.(32)–(37): sqrt(z)rho(s)^(-1/y), after cancellation.
Its branch factors are sqrt(gamma(j)/lambda_j). This agrees with the generalized SRM
on nonzero sectors and defines its nonsingular s=0 endpoint without inventing y(0). -/
def generalizedFilter (N k : ℕ) : Matrix (AC N) (AC N) ℂ :=
  (if k = 0 then 0 else
    (Real.sqrt (deterministicGamma N (k - 1) / lambdaMinus N (k - 1)) : ℂ) • minusSector N (k - 1)) +
  (Real.sqrt (deterministicGamma N (k + 1) / lambdaPlus N (k + 1)) : ℂ) • plusSector N (k + 1)

/-- PDF p.6, Eq.(32): transformed generalized SRM before the excess term. -/
def generalizedCore (N : ℕ) (i : Fin N) : Matrix (AC N) (AC N) ℂ :=
  ∑ k ∈ spins (N - 1), generalizedFilter N k * signalBlock i k * generalizedFilter N k

/-- PDF p.6, Eqs.(32),(39): transformed effects, including the uniform positive remainder. -/
def generalizedEffects (N : ℕ) (i : Fin N) : Matrix (AC N) (AC N) ℂ :=
  generalizedCore N i + (N : ℂ)⁻¹ •
    (deterministicX N ⊗ₖ (1 : Matrix Bool Bool ℂ) - ∑ j, generalizedCore N j)

/-- PDF pp.3,6–8: O=sqrt(X), the positive representative of the pure resource. -/
def resourceOperator {I : Type*} [Fintype I] [DecidableEq I]
    (X : Matrix I I ℂ) : Matrix I I ℂ := cfc Real.sqrt X

/-- PDF pp.3,6–8: physical measurement on the range of O, completed on its complement.
For sub-POVMs use complete=false so the omitted complement is part of failure. -/
def physicalEffects {N : ℕ} (X : Matrix (Qubits N) (Qubits N) ℂ)
    (E : Fin N → Matrix (AC N) (AC N) ℂ) (complete : Bool) (i : Fin N) :
    Matrix (AC N) (AC N) ℂ :=
  let H := supportPower X (-1 / 2) ⊗ₖ (1 : Matrix Bool Bool ℂ)
  H * E i * H + if complete then
    (N : ℂ)⁻¹ • (1 - (supportPower X 0 ⊗ₖ (1 : Matrix Bool Bool ℂ))) else 0

/-- PDF pp.6–7: the actual optimized deterministic POVM. -/
def deterministicMeasurement (N : ℕ) : Fin N → Matrix (AC N) (AC N) ℂ :=
  physicalEffects (deterministicX N) (generalizedEffects N) true

/-- PDF p.8, Eq.(50): the exact fixed-resource success probability, k=2s. -/
def fixedSuccess (N : ℕ) : ℝ :=
  (∑ k ∈ spins (N - 1), ((k + 1 : ℕ) : ℝ) ^ 2 * (N.factorial : ℝ) /
    ((((N - 1 - k) / 2).factorial : ℝ) * (((N + 3 + k) / 2).factorial : ℝ))) /
      (2 : ℝ) ^ N

/-- PDF p.8, Eq.(56): fully optimized faithful qubit success probability. -/
def probabilisticOptimumSuccess (N : ℕ) : ℝ := (N : ℝ) / (N + 3)

/-- PDF pp.7–8, Eq.(48): fixed-resource attaining Theta_i. -/
def fixedTheta (N : ℕ) (i : Fin N) :
    Matrix (Other N i → Bool) (Other N i → Bool) ℂ :=
  ∑ k ∈ spins (N - 1),
    (((2 : ℝ) ^ (N - 1) * lambdaPlus N (k + 1))⁻¹ : ℂ) • qubitSpinProjector (Other N i) k

/-- PDF p.8, Eqs.(52),(53): optimized attaining Theta_i. -/
def optimalTheta (N : ℕ) (i : Fin N) :
    Matrix (Other N i → Bool) (Other N i → Bool) ℂ :=
  ∑ k ∈ spins (N - 1),
    ((2 ^ (N + 1) * (6 / ((N + 1) * (N + 2) * (N + 3))) * (k + 1) /
      ((N : ℝ) * spinMultiplicity (N - 1) k) : ℝ) : ℂ) • qubitSpinProjector (Other N i) k

/-- PDF p.8, Eq.(54): optimized probabilistic resource X. -/
def probabilisticX (N : ℕ) : Matrix (Qubits N) (Qubits N) ℂ :=
  ∑ k ∈ spins N,
    ((2 ^ N * (6 / ((N + 1) * (N + 2) * (N + 3))) * (k + 1) /
      (spinMultiplicity N k : ℝ) : ℝ) : ℂ) • qubitSpinProjector (Fin N) k

/-- PDF pp.8–9: optimized physical successful effects; failure is I minus their sum. -/
def probabilisticMeasurement (N : ℕ) : Fin N → Matrix (AC N) (AC N) ℂ :=
  physicalEffects (probabilisticX N) (fun i => embedTheta i (optimalTheta N i)) false

/-- Sanity: the two nonzero singlet amplitudes have opposite signs (PDF p.2). -/
example : singletAmp true false = -singletAmp false true := by
  simp [singletAmp]

/-- Sanity: the only legal spin of zero residual wires is zero (PDF pp.3–5). -/
example : spins 0 = {0} := by
  ext k
  simp [spins]
  omega

/-- Sanity: support powers kill the zero operator, including the support projector r=0. -/
example (r : ℝ) : supportPower (0 : Matrix Bool Bool ℂ) r = 0 := by
  simp [supportPower, cfc_zero]

/-- PDF pp.5–6: the normalized positive maximally entangled qudit resource. -/
def quditResource (N d : ℕ) (a b : Fin N → Fin d) : ℂ :=
  if a = b then (Real.sqrt ((d : ℝ) ^ N) : ℂ)⁻¹ else 0

/-- PDF p.5: qudit sigma(i), with the positive maximally entangled reference. -/
def quditSignal (N d : ℕ) (i : Fin N) :
    Matrix ((Fin N → Fin d) × Fin d) ((Fin N → Fin d) × Fin d) ℂ :=
  fun p q => if p.1 i = p.2 ∧ q.1 i = q.2 ∧
    (∀ k, k ≠ i → p.1 k = q.1 k) then ((d : ℂ) ^ N)⁻¹ else 0

/-- PDF pp.5–6: the completed qudit SRM channel, applied to arbitrary operators. -/
def quditChannel (N d : ℕ) : Superop (Fin d) (Fin d) :=
  fun T => ∑ i, portRetainedOutput (quditResource N d) (completedSRM (quditSignal N d) i) i T

/-- PDF p.9: Bob's full reduced density of a pure resource. -/
def bobDensity {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ) :
    Matrix (Qubits N) (Qubits N) ℂ :=
  fun b b' => ∑ a, resource O a b * conj (resource O a b')

/-- PDF p.9: Bob's one-port marginal, tracing all A and all other ports. -/
def bobPortDensity {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (i : Fin N) : Matrix Bool Bool ℂ :=
  fun u v => ∑ b : Qubits N, ∑ b' : Qubits N,
    if b i = u ∧ b' i = v ∧ (∀ k, k ≠ i → b k = b' k) then bobDensity O b b' else 0

/-- PDF pp.9–10: insert the selected port into a configuration of the remaining ports. -/
def restorePort {N : ℕ} (i : Fin N) (r : Other N i → Bool) (t : Bool) : Qubits N :=
  fun k => if h : k = i then t else r ⟨k, h⟩

/-- PDF p.2, Eq.(1), pp.9–10: the single-Kraus square-root postmeasurement vector.
All Alice registers, including C, are retained. -/
def postAmplitude {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Matrix (AC NA) (AC NA) ℂ) (v : EuclideanSpace ℂ Bool)
    (a : Qubits NA) (c : Bool) (b : Qubits N) : ℂ :=
  ∑ a', ∑ c', resourceOperator M (a, c) (a', c') * resource O a' b * v c'

/-- PDF pp.9–10: branch probability, the squared norm of the unnormalized postmeasurement vector. -/
def postBranchProbability {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Matrix (AC NA) (AC NA) ℂ) (v : EuclideanSpace ℂ Bool) : ℝ :=
  ∑ a, ∑ c, ∑ b, Complex.normSq (postAmplitude O M v a c b)

/-- PDF pp.9–10: normalized density of the unused Bob ports on a successful branch.
Its entropy is that of the pure residual state in the (all Alice):(unused Bob) cut.
Theorems ensure a positive branch probability before using this quotient. -/
def residualDensity {N NA : ℕ} (O : Matrix (Qubits NA) (Qubits N) ℂ)
    (M : Matrix (AC NA) (AC NA) ℂ) (v : EuclideanSpace ℂ Bool) (i : Fin N) :
    Matrix (Other N i → Bool) (Other N i → Bool) ℂ :=
  fun r r' => (∑ a, ∑ c, ∑ t : Bool,
    postAmplitude O M v a c (restorePort i r t) *
      conj (postAmplitude O M v a c (restorePort i r' t))) /
    (postBranchProbability O M v : ℂ)

/-- PDF p.9: the two-qubit |psi^+> amplitude. -/
def plusAmp (a b : Bool) : ℂ := if a ≠ b then (Real.sqrt 2 : ℂ)⁻¹ else 0

/-- PDF p.9, Eq.(57): the explicit optimized two-port pure resource. -/
def twoPortResource (a b : Qubits 2) : ℂ :=
  (Real.sqrt (1 / 10) : ℂ) * singletAmp (a 0) (a 1) * singletAmp (b 0) (b 1) +
  (Real.sqrt (3 / 10) : ℂ) *
    ((if a 0 = false ∧ a 1 = false ∧ b 0 = true ∧ b 1 = true then 1 else 0) +
     (if a 0 = true ∧ a 1 = true ∧ b 0 = false ∧ b 1 = false then 1 else 0) -
     plusAmp (a 0) (a 1) * plusAmp (b 0) (b 1))

/-- PDF p.9: x^+ and x^-; these are Alice states, not the unknown input. -/
def xAmplitude (plus : Bool) (a : Qubits 2) : ℂ :=
  ((if plus then 1 else -1) * plusAmp (a 0) (a 1) +
    (Real.sqrt 3 : ℂ) * singletAmp (a 0) (a 1)) / 2

/-- PDF p.9, Eq.(58): the two orthogonal unit vectors eta^- and eta^+. -/
def twoPortEta (plus : Bool) : EuclideanSpace ℂ (AC 2) :=
  WithLp.toLp 2 fun p => if plus then
    (Real.sqrt (2 / 3) : ℂ) * xAmplitude true p.1 * (if p.2 then 1 else 0) -
      (Real.sqrt (1 / 3) : ℂ) *
        (if p.1 0 = true ∧ p.1 1 = true ∧ p.2 = false then 1 else 0)
  else
    (Real.sqrt (2 / 3) : ℂ) * xAmplitude false p.1 * (if p.2 then 0 else 1) +
      (Real.sqrt (1 / 3) : ℂ) *
        (if p.1 0 = false ∧ p.1 1 = false ∧ p.2 = true then 1 else 0)

/-- PDF p.9: A1 <-> A2. -/
def swapTwo (a : Qubits 2) : Qubits 2 := a ∘ Equiv.swap 0 1

/-- PDF p.9, Eq.(58) and its exchanged branch: the two projective successful effects. -/
def twoPortMeasurement (i : Fin 2) : Matrix (AC 2) (AC 2) ℂ :=
  let P := pureDensity (twoPortEta false) + pureDensity (twoPortEta true)
  if i = 0 then P else fun p q => P (swapTwo p.1, p.2) (swapTwo q.1, q.2)

/-- PDF p.9, Eq.(59): the normalized residual vector for port 1; t labels the unused port. -/
def twoPortResidual (a : Qubits 2) (c t : Bool) : ℂ :=
  ((twoPortEta false (a, c)) * (if t then 1 else 0) -
    (twoPortEta true (a, c)) * (if t then 0 else 1)) / (Real.sqrt 2 : ℂ)

/-- PDF p.9, Eq.(59), second line: the same residual expanded in Bell states. -/
def twoPortResidualExpanded (a : Qubits 2) (c t : Bool) : ℂ :=
  (Real.sqrt 2 : ℂ)⁻¹ * singletAmp (a 0) (a 1) * singletAmp c t +
  (Real.sqrt 6 : ℂ)⁻¹ *
    ((if a 0 = false ∧ a 1 = false ∧ c = true ∧ t = true then 1 else 0) +
     (if a 0 = true ∧ a 1 = true ∧ c = false ∧ t = false then 1 else 0) -
     plusAmp (a 0) (a 1) * plusAmp c t)

/-- PDF pp.9–10: the exact entropy of Eq.(57), replacing the rounded printed 1.90. -/
def twoPortInitialEntropy : ℝ :=
  -(1 / 10 : ℝ) * Real.logb 2 (1 / 10) - (9 / 10 : ℝ) * Real.logb 2 (3 / 10)

/-- PDF p.8: the KLM success curve quoted from [17], only for the numerical comparison. -/
def klmCurve (m : ℕ) : ℝ := 1 - 1 / ((m : ℝ) + 1)

/-- Sanity: N=1 is postselected singlet teleportation with success 1/4 (PDF p.8). -/
example : probabilisticOptimumSuccess 1 = 1 / 4 := by norm_num [probabilisticOptimumSuccess]

/-- Sanity: restoring a port puts the specified bit in that port. -/
example {N : ℕ} (i : Fin N) (r : Other N i → Bool) (t : Bool) :
    restorePort i r t i = t := by simp [restorePort]

end QAlgorithms.Papers.Independent.Intake100.P67
Source
Quantum teleportation scheme by selecting one of multiple output ports, arXiv:0901.2975v2, https://arxiv.org/abs/0901.2975v2
Read-back

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

QAlgorithms.Papers.Independent.Intake100.P67.AC

For every natural number NNN, AC(N)\mathrm{AC}(N)AC(N) is the set {0,1}N×{0,1}\{0,1\}^{N}\times\{0,1\}{0,1}N×{0,1}: its elements consist of a Boolean string indexed by 0,…,N−10,\ldots,N-10,…,N−1, together with one additional Boolean. When N=0N=0N=0, the string is the unique empty string, so this set has two elements.

QAlgorithms.Papers.Independent.Intake100.P67.IsDeterministicPortProtocol

For any natural numbers N,NAN,N_AN,NA​, any complex matrix OOO with rows indexed by NAN_ANA​-bit Boolean strings and columns by NNN-bit Boolean strings, and any family MiM_iMi​, 0≤i<N0\le i<N0≤i<N, of complex square matrices indexed by an NAN_ANA​-bit Boolean string and a Boolean, this predicate is the conjunction

tr⁡(O†O)=2N,Mi⪰0 for every i,∑i=0N−1Mi=I.\operatorname{tr}(O^\dagger O)=2^N,\qquad M_i\succeq0\ \text{for every }i,\qquad \sum_{i=0}^{N-1}M_i=I.tr(O†O)=2N,Mi​⪰0 for every i,i=0∑N−1​Mi​=I.

The identity acts on the space indexed by those string–Boolean pairs. The case NA=0N_A=0NA​=0 is included. When N=0N=0N=0, positivity of the empty family is vacuous, but its sum is zero, so the required equality to the identity is impossible.

QAlgorithms.Papers.Independent.Intake100.P67.IsFaithfulPortProtocol

For arbitrary natural numbers N,NAN,N_AN,NA​, let Bm={false,true}{0,…,m−1}B_m=\{\mathrm{false},\mathrm{true}\}^{\{0,\ldots,m-1\}}Bm​={false,true}{0,…,m−1}, let OOO be a complex matrix with rows indexed by BNAB_{N_A}BNA​​ and columns by BNB_NBN​, and let MiM_iMi​ be a complex matrix on BNA×{false,true}B_{N_A}\times\{\mathrm{false},\mathrm{true}\}BNA​​×{false,true} for each 0≤i<N0\le i<N0≤i<N. Define s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and s=0s=0s=0 on the other two pairs, and put R(a,b)=∑x∈BNOa,x∏j=0N−1s(xj,bj)R(a,b)=\sum_{x\in B_N}O_{a,x}\prod_{j=0}^{N-1}s(x_j,b_j)R(a,b)=∑x∈BN​​Oa,x​∏j=0N−1​s(xj​,bj​). The predicate holds exactly when, for every complex vector vvv on {false,true}\{\mathrm{false},\mathrm{true}\}{false,true} with ∥v∥=1\|v\|=1∥v∥=1, and every 0≤i<N0\le i<N0≤i<N, there exists a real number q≥0q\ge0q≥0 such that, for all Boolean u,wu,wu,w,

∑b,b′∈BNbi=u, bi′=wbj=bj′ for every j≠i ∑a,a′∈BNAc,c′∈{false,true}R(a,b)R(a′,b′)‾ vcvc′‾ (Mi)(a′,c′),(a,c)=q vuvw‾.\sum_{\substack{b,b'\in B_N\\ b_i=u,\ b'_i=w\\ b_j=b'_j\ \text{for every }j\ne i}} \ \sum_{\substack{a,a'\in B_{N_A}\\ c,c'\in\{\mathrm{false},\mathrm{true}\}}} R(a,b)\overline{R(a',b')}\, v_c\overline{v_{c'}}\, (M_i)_{(a',c'),(a,c)} =q\,v_u\overline{v_w}.b,b′∈BN​bi​=u, bi′​=wbj​=bj′​ for every j=i​∑​ a,a′∈BNA​​c,c′∈{false,true}​∑​R(a,b)R(a′,b′)​vc​vc′​​(Mi​)(a′,c′),(a,c)​=qvu​vw​​.

The number qqq may depend on vvv and iii, and may be zero; no upper bound on qqq, normalization of OOO, or positivity condition on MiM_iMi​ is included. When N=0N=0N=0, there is no index iii, so the predicate holds vacuously.

QAlgorithms.Papers.Independent.Intake100.P67.IsProbabilisticPortProtocol

For arbitrary natural numbers N,NAN,N_AN,NA​, write Bm={false,true}{0,…,m−1}B_m=\{\mathrm{false},\mathrm{true}\}^{\{0,\ldots,m-1\}}Bm​={false,true}{0,…,m−1}, let OOO be a complex BNAB_{N_A}BNA​​-by-BNB_NBN​ matrix, and let MiM_iMi​ be complex matrices on BNA×{false,true}B_{N_A}\times\{\mathrm{false},\mathrm{true}\}BNA​​×{false,true}, indexed by 0≤i<N0\le i<N0≤i<N. The predicate holds exactly when

tr⁡(O†O)=2N,Mi⪰0 for every i,I−∑i=0N−1Mi⪰0,\operatorname{tr}(O^\dagger O)=2^N,\qquad M_i\succeq0\ \text{for every }i,\qquad I-\sum_{i=0}^{N-1}M_i\succeq0,tr(O†O)=2N,Mi​⪰0 for every i,I−i=0∑N−1​Mi​⪰0,

and the following condition also holds: define s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and s=0s=0s=0 otherwise, and set R(a,b)=∑x∈BNOa,x∏j=0N−1s(xj,bj)R(a,b)=\sum_{x\in B_N}O_{a,x}\prod_{j=0}^{N-1}s(x_j,b_j)R(a,b)=∑x∈BN​​Oa,x​∏j=0N−1​s(xj​,bj​); then for every unit complex vector vvv on the two Boolean values and every i<Ni<Ni<N, there is a real q≥0q\ge0q≥0 such that, for all Boolean u,wu,wu,w,

∑b,b′∈BNbi=u, bi′=wbj=bj′ for every j≠i ∑a,a′∈BNAc,c′∈{false,true}R(a,b)R(a′,b′)‾ vcvc′‾ (Mi)(a′,c′),(a,c)=q vuvw‾.\sum_{\substack{b,b'\in B_N\\ b_i=u,\ b'_i=w\\ b_j=b'_j\ \text{for every }j\ne i}} \ \sum_{\substack{a,a'\in B_{N_A}\\ c,c'\in\{\mathrm{false},\mathrm{true}\}}} R(a,b)\overline{R(a',b')}\, v_c\overline{v_{c'}}\, (M_i)_{(a',c'),(a,c)} =q\,v_u\overline{v_w}.b,b′∈BN​bi​=u, bi′​=wbj​=bj′​ for every j=i​∑​ a,a′∈BNA​​c,c′∈{false,true}​∑​R(a,b)R(a′,b′)​vc​vc′​​(Mi​)(a′,c′),(a,c)​=qvu​vw​​.

Here ⪰0\succeq0⪰0 means positive semidefinite, qqq may depend on v,iv,iv,i, and q=0q=0q=0 is permitted. The effects need only sum to at most the identity in this order. For N=0N=0N=0, the indexed conditions are vacuous and the predicate reduces to tr⁡(O†O)=1\operatorname{tr}(O^\dagger O)=1tr(O†O)=1.

QAlgorithms.Papers.Independent.Intake100.P67.Other

For every natural number NNN and every index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, this abbreviates the type of indices k∈{0,…,N−1}k\in\{0,\ldots,N-1\}k∈{0,…,N−1} satisfying k≠ik\ne ik=i. For N=1N=1N=1, this type is empty. For N=0N=0N=0, no index iii exists with which to form it.

QAlgorithms.Papers.Independent.Intake100.P67.PortSuccessFeasible

For any natural number NNN, let BNB_NBN​ be the set of Boolean NNN-bit strings, let XXX be a complex matrix on BNB_NBN​, and, for each i<Ni<Ni<N, let TiT_iTi​ be a complex matrix on Boolean assignments to {j<N:j≠i}\{j<N:j\ne i\}{j<N:j=i}. Define matrices EiE_iEi​ on BN×{false,true}B_N\times\{\mathrm{false},\mathrm{true}\}BN​×{false,true} by

(Ei)(b,c),(b′,c′)=s(bi,c)s(bi′,c′)‾ (Ti) b∣{j≠i}, b′∣{j≠i},(E_i)_{(b,c),(b',c')} =s(b_i,c)\overline{s(b'_i,c')}\, (T_i)_{\,b|_{\{j\ne i\}},\,b'|_{\{j\ne i\}}},(Ei​)(b,c),(b′,c′)​=s(bi​,c)s(bi′​,c′)​(Ti​)b∣{j=i}​,b′∣{j=i}​​,

where s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and s=0s=0s=0 otherwise. The predicate holds exactly when

X⪰0,tr⁡X=2N,Ti⪰0 for every i<N,X⊗I2−∑i=0N−1Ei⪰0.X\succeq0,\qquad \operatorname{tr}X=2^N,\qquad T_i\succeq0\ \text{for every }i<N,\qquad X\otimes I_2-\sum_{i=0}^{N-1}E_i\succeq0.X⪰0,trX=2N,Ti​⪰0 for every i<N,X⊗I2​−i=0∑N−1​Ei​⪰0.

All traces here are complex traces, and the displayed trace equality is a complex equality. For N=0N=0N=0, XXX is one-by-one, the family TiT_iTi​ is empty, and these conditions reduce to X=[1]X=[1]X=[1].

QAlgorithms.Papers.Independent.Intake100.P67.ResourceNormalized

For any natural numbers N,NAN,N_AN,NA​ and any complex matrix OOO with rows indexed by NAN_ANA​-bit Boolean strings and columns by NNN-bit Boolean strings, this predicate means exactly

tr⁡(O†O)=2N,\operatorname{tr}(O^\dagger O)=2^N,tr(O†O)=2N,

where O†O^\daggerO† is the conjugate transpose and the equality is in C\mathbb CC. Equivalently, the sum of the squared absolute values of all entries of OOO is 2N2^N2N. Both N=0N=0N=0 and NA=0N_A=0NA​=0 are included; for N=0N=0N=0, the required value is 111.

QAlgorithms.Papers.Independent.Intake100.P67.SubPOVM

For any natural numbers N,NAN,N_AN,NA​, any complex matrix OOO with rows indexed by NAN_ANA​-bit Boolean strings and columns by NNN-bit Boolean strings, and any family MiM_iMi​, 0≤i<N0\le i<N0≤i<N, of complex square matrices indexed by an NAN_ANA​-bit Boolean string and a Boolean, this predicate means

tr⁡(O†O)=2N,Mi⪰0 for every i,I−∑i=0N−1Mi⪰0.\operatorname{tr}(O^\dagger O)=2^N,\qquad M_i\succeq0\ \text{for every }i,\qquad I-\sum_{i=0}^{N-1}M_i\succeq0.tr(O†O)=2N,Mi​⪰0 for every i,I−i=0∑N−1​Mi​⪰0.

Here III is the identity on the space indexed by those string–Boolean pairs. Both natural numbers may be zero. When N=0N=0N=0, the family is empty, its positivity requirement is vacuous, and the last condition is positivity of the identity, leaving exactly the condition tr⁡(O†O)=1\operatorname{tr}(O^\dagger O)=1tr(O†O)=1.

QAlgorithms.Papers.Independent.Intake100.P67.bobDensity

For arbitrary natural numbers N,NAN,N_AN,NA​ and an arbitrary complex matrix OOO with rows indexed by Boolean strings of length NAN_ANA​ and columns indexed by Boolean strings of length NNN, this defines a matrix BBB on length-NNN Boolean strings by

Bbb′=∑a∈{0,1}NARO(a,b)RO(a,b′)‾,RO(a,b)=∑x∈{0,1}NOax∏j=0N−1s(xj,bj),B_{bb'}=\sum_{a\in\{0,1\}^{N_A}}R_O(a,b)\overline{R_O(a,b')}, \qquad R_O(a,b)=\sum_{x\in\{0,1\}^N}O_{ax}\prod_{j=0}^{N-1}s(x_j,b_j),Bbb′​=a∈{0,1}NA​∑​RO​(a,b)RO​(a,b′)​,RO​(a,b)=x∈{0,1}N∑​Oax​j=0∏N−1​s(xj​,bj​),

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0. No normalization hypothesis on OOO is required. Zero-length registers are included: their string sets are singletons, and products over their coordinates equal 111.

QAlgorithms.Papers.Independent.Intake100.P67.bobPortDensity

For arbitrary natural numbers N,NAN,N_AN,NA​, an arbitrary complex matrix OOO from length-NNN Boolean strings to length-NAN_ANA​ Boolean strings, and an index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, this defines a 2×22\times22×2 complex matrix B(i)B^{(i)}B(i), indexed by Booleans u,vu,vu,v, by

Buv(i)=∑b,b′∈{0,1}Nbi=u, bi′=vbk=bk′ ∀k≠i∑a∈{0,1}NARO(a,b)RO(a,b′)‾,RO(a,b)=∑x∈{0,1}NOax∏j=0N−1s(xj,bj),B^{(i)}_{uv} =\sum_{\substack{b,b'\in\{0,1\}^N\\b_i=u,\ b'_i=v\\b_k=b'_k\ \forall k\ne i}} \sum_{a\in\{0,1\}^{N_A}} R_O(a,b)\overline{R_O(a,b')}, \qquad R_O(a,b)=\sum_{x\in\{0,1\}^N}O_{ax}\prod_{j=0}^{N-1}s(x_j,b_j),Buv(i)​=b,b′∈{0,1}Nbi​=u, bi′​=vbk​=bk′​ ∀k=i​∑​a∈{0,1}NA​∑​RO​(a,b)RO​(a,b′)​,RO​(a,b)=x∈{0,1}N∑​Oax​j=0∏N−1​s(xj​,bj​),

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and the other two values of sss are zero. There is no normalization assumption on OOO. The index iii requires N>0N>0N>0, while NA=0N_A=0NA​=0 is allowed.

QAlgorithms.Papers.Independent.Intake100.P67.completedSRM

For any finite type III equipped with decidable equality, any natural number NNN, any family of complex matrices S0,…,SN−1S_0,\ldots,S_{N-1}S0​,…,SN−1​ indexed by III, and any i<Ni<Ni<N, this defines

HSiH+1N(II−∑j=0N−1HSjH),H=f ⁣(∑j=0N−1Sj),f(x)={0,x=0,x−1/2,x≠0.H S_i H+\frac1N\left(I_I-\sum_{j=0}^{N-1}H S_j H\right), \qquad H=f\!\left(\sum_{j=0}^{N-1}S_j\right), \quad f(x)= \begin{cases} 0,&x=0,\\ x^{-1/2},&x\ne0. \end{cases}HSi​H+N1​(II​−j=0∑N−1​HSj​H),H=f(j=0∑N−1​Sj​),f(x)={0,x−1/2,​x=0,x=0.​

Here fff is applied using the total real continuous functional calculus, with the total real-power operation in its nonzero branch, and III_III​ is the identity matrix on III. No Hermiticity, positivity, or normalization of the matrices SjS_jSj​ is assumed. The index iii requires N>0N>0N>0, while the finite type III itself may be empty.

QAlgorithms.Papers.Independent.Intake100.P67.compressedScalar

For all natural numbers N,kN,kN,k and every real number yyy, this defines

{0,k=0,k2(k+1)(N/2−(k−1)/22N)−1/y,k>0  +  k+22(k+1)(N/2+(k+1)/2+12N)−1/y.\begin{cases} 0,&k=0,\\[1mm] \displaystyle\frac{k}{2(k+1)} \left(\frac{N/2-(k-1)/2}{2^N}\right)^{-1/y},&k>0 \end{cases} \;+\; \frac{k+2}{2(k+1)} \left(\frac{N/2+(k+1)/2+1}{2^N}\right)^{-1/y}.⎩⎨⎧​0,2(k+1)k​(2NN/2−(k−1)/2​)−1/y,​k=0,k>0​+2(k+1)k+2​(2NN/2+(k+1)/2+1​)−1/y.

All displayed quotients are real quotients, and powers use the total real-power operation, including at zero or negative bases; no positivity assumption on the first base is imposed. In the positive-kkk branch, k−1k-1k−1 is natural subtraction and equals ordinary subtraction. The value y=0y=0y=0 is included: division by zero gives exponent 000, both real powers then equal 111, and the whole expression equals 111.

QAlgorithms.Papers.Independent.Intake100.P67.deterministicGamma

For all natural numbers N,kN,kN,k, including zero and with no restriction k≤Nk\le Nk≤N, this defines

Γ(N,k)=2N+2(N+2)(k+1)m(N,k)sin⁡2 ⁣(π(k+1)N+2),\Gamma(N,k)= \frac{2^{N+2}}{(N+2)(k+1)m(N,k)} \sin^2\!\left(\frac{\pi(k+1)}{N+2}\right),Γ(N,k)=(N+2)(k+1)m(N,k)2N+2​sin2(N+2π(k+1)​),

where the natural number m(N,k)m(N,k)m(N,k) is zero unless k≤Nk\le Nk≤N and N−kN-kN−k is even; when those conditions hold, it is

m(N,k)=⌊(N⌊(N−k)/2⌋)(k+1)⌊(N+k)/2⌋+1⌋.m(N,k)= \left\lfloor \frac{\displaystyle\binom{N}{\lfloor(N-k)/2\rfloor}(k+1)} {\displaystyle\lfloor(N+k)/2\rfloor+1} \right\rfloor.m(N,k)=​⌊(N+k)/2⌋+1(⌊(N−k)/2⌋N​)(k+1)​​.

The floors describe the natural-number divisions used to define this multiplicity; the divisions in Γ(N,k)\Gamma(N,k)Γ(N,k) are real divisions. Real division by zero is defined to give zero, so Γ(N,k)=0\Gamma(N,k)=0Γ(N,k)=0 whenever m(N,k)=0m(N,k)=0m(N,k)=0, including when k>Nk>Nk>N or N−kN-kN−k is odd.

QAlgorithms.Papers.Independent.Intake100.P67.deterministicMeasurement

For every natural number NNN, this defines a family (MN,i)i<N(M_{N,i})_{i<N}(MN,i​)i<N​ of complex matrices on BN×{0,1}\mathcal B_N\times\{0,1\}BN​×{0,1}, where BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N, by

MN,i=HNEN,iHN+1N(I−D0(XN)⊗I2),HN=D−1/2(XN)⊗I2.M_{N,i}=H_NE_{N,i}H_N+ \frac1N\left(I-D_0(X_N)\otimes I_2\right), \qquad H_N=D_{-1/2}(X_N)\otimes I_2.MN,i​=HN​EN,i​HN​+N1​(I−D0​(XN​)⊗I2​),HN​=D−1/2​(XN​)⊗I2​.

Here Dt(X)D_t(X)Dt​(X) means real continuous functional calculus with the function equal to zero at x=0x=0x=0 and to the total real power xtx^txt otherwise. The matrices substituted into this expression are

XN=∑r∈JNγN,rPN(r),EN,i=CN,i+1N(XN⊗I2−∑j<NCN,j),CN,i=∑k∈JN−1FN,kΞi,k2N−1FN,k,X_N=\sum_{r\in J_N}\gamma_{N,r}P_N(r),\qquad E_{N,i}=C_{N,i}+\frac1N \left(X_N\otimes I_2-\sum_{j<N}C_{N,j}\right),\qquad C_{N,i}=\sum_{k\in J_{N-1}}F_{N,k}\frac{\Xi_{i,k}}{2^{N-1}}F_{N,k},XN​=r∈JN​∑​γN,r​PN​(r),EN,i​=CN,i​+N1​​XN​⊗I2​−j<N∑​CN,j​​,CN,i​=k∈JN−1​∑​FN,k​2N−1Ξi,k​​FN,k​,

where Js={r≤s:r mod 2=s mod 2}J_s=\{r\le s:r\bmod2=s\bmod2\}Js​={r≤s:rmod2=smod2}, and

γN,r=2N+2sin⁡2(π(r+1)/(N+2))(N+2)(r+1)mN(r),λN,r−=N−r2N+1,λN,r+=N+r+22N+1,\gamma_{N,r}= \frac{2^{N+2}\sin^2(\pi(r+1)/(N+2))} {(N+2)(r+1)m_N(r)},\qquad \lambda^-_{N,r}=\frac{N-r}{2^{N+1}},\qquad \lambda^+_{N,r}=\frac{N+r+2}{2^{N+1}},γN,r​=(N+2)(r+1)mN​(r)2N+2sin2(π(r+1)/(N+2))​,λN,r−​=2N+1N−r​,λN,r+​=2N+1N+r+2​,

with real subtraction in λ−\lambda^-λ−. The natural number mn(r)m_n(r)mn​(r) is zero unless r≤nr\le nr≤n and n−rn-rn−r is even, and otherwise equals (n⌊(n−r)/2⌋)(r+1)div(⌊(n+r)/2⌋+1)\binom n{\lfloor(n-r)/2\rfloor}(r+1)\mathbin{\mathrm{div}}(\lfloor(n+r)/2\rfloor+1)(⌊(n−r)/2⌋n​)(r+1)div(⌊(n+r)/2⌋+1). The filter and middle matrix are

FN,k={0,k=0,γN,k−1/λN,k−1− (PN(k−1)⊗I2)QN(k),k>0+γN,k+1/λN,k+1+ (PN(k+1)⊗I2)QN(k),F_{N,k}= \begin{cases} 0,&k=0,\\ \sqrt{\gamma_{N,k-1}/\lambda^-_{N,k-1}}\, (P_N(k-1)\otimes I_2)Q_N(k),&k>0 \end{cases} + \sqrt{\gamma_{N,k+1}/\lambda^+_{N,k+1}}\, (P_N(k+1)\otimes I_2)Q_N(k),FN,k​={0,γN,k−1​/λN,k−1−​​(PN​(k−1)⊗I2​)QN​(k),​k=0,k>0​+γN,k+1​/λN,k+1+​​(PN​(k+1)⊗I2​)QN​(k), (Ξi,k)(x,c),(y,d)=s(xi,c)s(yi,d)‾PWi(k)x∣Wi,y∣Wi,Wi={j<N:j≠i},(\Xi_{i,k})_{(x,c),(y,d)} =s(x_i,c)\overline{s(y_i,d)} P_{W_i}(k)_{x|_{W_i},y|_{W_i}}, \quad W_i=\{j<N:j\ne i\},(Ξi,k​)(x,c),(y,d)​=s(xi​,c)s(yi​,d)​PWi​​(k)x∣Wi​​,y∣Wi​​​,Wi​={j<N:j=i},

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and the other two values of sss are zero. For any finite set WWW, PW(r)=0P_W(r)=0PW​(r)=0 outside J∣W∣J_{|W|}J∣W∣​; otherwise it is the real functional calculus with the indicator of r(r+2)/4r(r+2)/4r(r+2)/4 applied to

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y=1{x=y∘(a b)},S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}=\mathbf1_{\{x=y\circ(a\ b)\}},SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​=1{x=y∘(a b)}​,

with an ordered pair sum. The notation PNP_NPN​ uses W={0,…,N−1}W=\{0,\ldots,N-1\}W={0,…,N−1}; QN(r)Q_N(r)QN​(r) uses W={∗}⊔{0,…,N−1}W=\{\ast\}\sqcup\{0,\ldots,N-1\}W={∗}⊔{0,…,N−1}, identifying (x,c)(x,c)(x,c) with the function equal to ccc at ∗\ast∗ and to xjx_jxj​ at jjj. All scalar coefficients are embedded into C\mathbb CC; natural subtraction is truncated, zero inverses are zero, and real square roots of negative arguments are zero. When N=0N=0N=0, this is the empty family.

QAlgorithms.Papers.Independent.Intake100.P67.deterministicOptimumAverage

For every natural number NNN, including zero, this defines the real number

23+13cos⁡ ⁣(2πN+2).\frac23+\frac13\cos\!\left(\frac{2\pi}{N+2}\right).32​+31​cos(N+22π​).

All divisions are real divisions, and N+2N+2N+2 is always positive. Its value at N=0N=0N=0 is 1/31/31/3; the declaration itself asserts no averaging or optimization property.

QAlgorithms.Papers.Independent.Intake100.P67.deterministicOptimumFidelity

For every natural number NNN, including zero, this defines the real number

cos⁡2 ⁣(πN+2).\cos^2\!\left(\frac{\pi}{N+2}\right).cos2(N+2π​).

The denominator is positive for every allowed NNN, and the value at N=0N=0N=0 is 000. The declaration itself makes no assertion that this number is an optimum.

QAlgorithms.Papers.Independent.Intake100.P67.deterministicX

For every natural number NNN, including N=0N=0N=0, this defines a complex matrix indexed by the bit strings BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N:

XN=∑k∈JNγN,kP{0,…,N−1}(k),Jn={k∈N:k≤n, k mod 2=n mod 2}.X_N=\sum_{k\in J_N}\gamma_{N,k}P_{\{0,\ldots,N-1\}}(k), \qquad J_n=\{k\in\mathbb N: k\le n,\ k\bmod2=n\bmod2\}.XN​=k∈JN​∑​γN,k​P{0,…,N−1}​(k),Jn​={k∈N:k≤n, kmod2=nmod2}.

Here

γN,k=2N+2(N+2)(k+1)mN(k)sin⁡2 ⁣(π(k+1)N+2),mn(k)={⌊(n⌊(n−k)/2⌋)(k+1)⌊(n+k)/2⌋+1⌋,k≤n and (n−k) mod 2=0,0,otherwise.\gamma_{N,k} =\frac{2^{N+2}}{(N+2)(k+1)m_N(k)} \sin^2\!\left(\frac{\pi(k+1)}{N+2}\right), \quad m_n(k)= \begin{cases} \displaystyle \left\lfloor \frac{\binom n{\lfloor(n-k)/2\rfloor}(k+1)} {\lfloor(n+k)/2\rfloor+1} \right\rfloor, &k\le n\text{ and }(n-k)\bmod2=0,\\ 0,&\text{otherwise}. \end{cases}γN,k​=(N+2)(k+1)mN​(k)2N+2​sin2(N+2π(k+1)​),mn​(k)=⎩⎨⎧​⌊⌊(n+k)/2⌋+1(⌊(n−k)/2⌋n​)(k+1)​⌋,0,​k≤n and (n−k)mod2=0,otherwise.​

For any finite set WWW, the matrix PW(k)P_W(k)PW​(k), indexed by functions W→{0,1}W\to\{0,1\}W→{0,1}, is zero when k∉J∣W∣k\notin J_{|W|}k∈/J∣W∣​; otherwise it is the real continuous functional calculus of

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y={1,x=y∘(a b),0,otherwise,S_W=\frac{|W|(4-|W|)}4I+\frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}= \begin{cases}1,&x=y\circ(a\ b),\\0,&\text{otherwise},\end{cases}SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​={1,0,​x=y∘(a b),otherwise,​

with the function that is 111 at k(k+2)/4k(k+2)/4k(k+2)/4 and 000 elsewhere. The pair sum is ordered. The divisions defining mn(k)m_n(k)mn​(k) are natural-number divisions; the other displayed divisions are real divisions. In the zero-qubit case the index set has one element, and the definition gives X0=2IX_0=2IX0​=2I.

QAlgorithms.Papers.Independent.Intake100.P67.embedTheta

For a natural number NNN, an index i<Ni<Ni<N, and an arbitrary complex matrix TTT indexed by Boolean assignments to {j<N:j≠i}\{j<N:j\ne i\}{j<N:j=i}, this defines a matrix EEE indexed by pairs (b,c)(b,c)(b,c), where bbb is an NNN-bit string and ccc is Boolean, by

E(b,c),(b′,c′)=s(bi,c) s(bi′,c′)‾ T b∣{j≠i}, b′∣{j≠i},E_{(b,c),(b',c')} =s(b_i,c)\,\overline{s(b'_i,c')}\, T_{\,b|_{\{j\ne i\}},\,b'|_{\{j\ne i\}}},E(b,c),(b′,c′)​=s(bi​,c)s(bi′​,c′)​Tb∣{j=i}​,b′∣{j=i}​​,

where s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and s=0s=0s=0 otherwise. No positivity or normalization of TTT is required. When N=1N=1N=1, the remaining index set is empty, so TTT is a one-by-one matrix indexed by the unique empty assignment; when N=0N=0N=0, no iii is available.

QAlgorithms.Papers.Independent.Intake100.P67.entFidelity

For any natural numbers N,NAN,N_AN,NA​, any complex matrix OOO with rows indexed by NAN_ANA​-bit Boolean strings and columns by NNN-bit Boolean strings, and any family MiM_iMi​, 0≤i<N0\le i<N0≤i<N, of complex square matrices indexed by an NAN_ANA​-bit Boolean string and a Boolean, this declaration defines the real number

F(O,M)=14∑i=0N−1Re⁡tr⁡ ⁣[(O†⊗I2)Mi(O⊗I2)Si].F(O,M)=\frac14\sum_{i=0}^{N-1} \operatorname{Re}\operatorname{tr}\!\left[ (O^\dagger\otimes I_2)M_i(O\otimes I_2)S_i \right].F(O,M)=41​i=0∑N−1​Retr[(O†⊗I2​)Mi​(O⊗I2​)Si​].

The matrix SiS_iSi​, indexed by (x,c),(y,d)∈{0,1}N×{0,1}(x,c),(y,d)\in\{0,1\}^{N}\times\{0,1\}(x,c),(y,d)∈{0,1}N×{0,1}, has entry s(xi,c)s(yi,d)‾/2N−1s(x_i,c)\overline{s(y_i,d)}/2^{N-1}s(xi​,c)s(yi​,d)​/2N−1 when xk=ykx_k=y_kxk​=yk​ for every k≠ik\ne ik=i, and zero otherwise, where s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and the other values are zero. No normalization or positivity assumptions are imposed on OOO or MiM_iMi​. The case NA=0N_A=0NA​=0 is allowed, and when N=0N=0N=0, the sum is empty and F(O,M)=0F(O,M)=0F(O,M)=0.

QAlgorithms.Papers.Independent.Intake100.P67.fixedFidelity

For every natural number NNN, this defines the real number

12N+3∑k=0N(Nk)(N−2k−1k+1+N−2k+1N−k+1)2.\frac1{2^{N+3}} \sum_{k=0}^{N} \binom Nk \left( \frac{N-2k-1}{\sqrt{k+1}} + \frac{N-2k+1}{\sqrt{N-k+1}} \right)^2.2N+31​k=0∑N​(kN​)(k+1​N−2k−1​+N−k+1​N−2k+1​)2.

The arithmetic inside the summand is real arithmetic, including both subtractions in the numerators and the subtraction under the second square root. Because 0≤k≤N0\le k\le N0≤k≤N, both square-root denominators are positive. The definition includes N=0N=0N=0, for which its value is 000; it asserts no optimization or probabilistic property.

QAlgorithms.Papers.Independent.Intake100.P67.fixedSuccess

For every natural number NNN, this defines the real number

12N∑0≤k≤N\dotminus1kmod2=(N\dotminus1)mod2(k+1)2N!⌊(N\dotminus1)\dotminusk2⌋!⌊N+3+k2⌋!.\frac1{2^N} \sum_{\substack{0\le k\le N\dotminus1\\ k\bmod2=(N\dotminus1)\bmod2}} \frac{(k+1)^2N!} {\left\lfloor\frac{(N\dotminus1)\dotminus k}{2}\right\rfloor! \left\lfloor\frac{N+3+k}{2}\right\rfloor!}.2N1​0≤k≤N\dotminus1kmod2=(N\dotminus1)mod2​∑​⌊2(N\dotminus1)\dotminusk​⌋!⌊2N+3+k​⌋!(k+1)2N!​.

Here a\dotminusb=max⁡(a−b,0)a\dotminus b=\max(a-b,0)a\dotminusb=max(a−b,0) is natural-number subtraction, both divisions inside the factorial arguments are natural-number divisions, and all factorials and natural-number factors are converted to real numbers for the displayed arithmetic. The definition includes N=0N=0N=0: its sum then contains k=0k=0k=0, and its value is 111.

QAlgorithms.Papers.Independent.Intake100.P67.fixedTheta

For every natural number NNN and every i<Ni<Ni<N, let Wi={j<N:j≠i}W_i=\{j<N:j\ne i\}Wi​={j<N:j=i}. This defines a complex matrix indexed by bit assignments Wi→{0,1}W_i\to\{0,1\}Wi​→{0,1}:

ΘN,i=∑k∈JN−1(2N−1N/2+(k+1)/2+12N)−1PWi(k),Js={k≤s:k mod 2=s mod 2}.\Theta_{N,i} =\sum_{k\in J_{N-1}} \left(2^{N-1}\frac{N/2+(k+1)/2+1}{2^N}\right)^{-1}P_{W_i}(k), \qquad J_s=\{k\le s:k\bmod2=s\bmod2\}.ΘN,i​=k∈JN−1​∑​(2N−12NN/2+(k+1)/2+1​)−1PWi​​(k),Js​={k≤s:kmod2=smod2}.

Each real coefficient is embedded into C\mathbb CC. For any finite set WWW, PW(k)P_W(k)PW​(k) is zero if k∉J∣W∣k\notin J_{|W|}k∈/J∣W∣​; otherwise it is obtained by applying, through real continuous functional calculus, the function equal to 111 at k(k+2)/4k(k+2)/4k(k+2)/4 and 000 elsewhere to

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y={1,x=y∘(a b),0,otherwise,S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}= \begin{cases}1,&x=y\circ(a\ b),\\0,&\text{otherwise},\end{cases}SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​={1,0,​x=y∘(a b),otherwise,​

where the sum uses ordered pairs. The parameter iii requires N≥1N\ge1N≥1, so N−1N-1N−1 is ordinary subtraction here; there is no such matrix to evaluate at N=0N=0N=0. For N=1N=1N=1, WiW_iWi​ is empty and the matrix is indexed by its unique empty bit assignment.

QAlgorithms.Papers.Independent.Intake100.P67.generalizedCore

For every natural number NNN and every i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, this defines a complex matrix on BN×{0,1}\mathcal B_N\times\{0,1\}BN​×{0,1}, with BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N, by

CN,i=∑k∈JN−1FN,k (2N−1)−1Ξi,k FN,k,Js={k≤s:k mod 2=s mod 2}.C_{N,i}=\sum_{k\in J_{N-1}}F_{N,k}\, \bigl(2^{N-1}\bigr)^{-1}\Xi_{i,k}\,F_{N,k}, \qquad J_s=\{k\le s:k\bmod2=s\bmod2\}.CN,i​=k∈JN−1​∑​FN,k​(2N−1)−1Ξi,k​FN,k​,Js​={k≤s:kmod2=smod2}.

The index iii requires N≥1N\ge1N≥1. Writing Wi={j<N:j≠i}W_i=\{j<N:j\ne i\}Wi​={j<N:j=i}, the middle matrix has entries

(Ξi,k)(x,c),(y,d)=s(xi,c)s(yi,d)‾ PWi(k)x∣Wi,y∣Wi,(\Xi_{i,k})_{(x,c),(y,d)} =s(x_i,c)\overline{s(y_i,d)}\, P_{W_i}(k)_{x|_{W_i},y|_{W_i}},(Ξi,k​)(x,c),(y,d)​=s(xi​,c)s(yi​,d)​PWi​​(k)x∣Wi​​,y∣Wi​​​,

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0. The filter is

FN,k={0,k=0,γN,k−1/λN,k−1− (PN(k−1)⊗I2)QN(k),k>0+γN,k+1/λN,k+1+ (PN(k+1)⊗I2)QN(k),F_{N,k}= \begin{cases} 0,&k=0,\\ \sqrt{\gamma_{N,k-1}/\lambda^-_{N,k-1}}\, (P_N(k-1)\otimes I_2)Q_N(k),&k>0 \end{cases} + \sqrt{\gamma_{N,k+1}/\lambda^+_{N,k+1}}\, (P_N(k+1)\otimes I_2)Q_N(k),FN,k​={0,γN,k−1​/λN,k−1−​​(PN​(k−1)⊗I2​)QN​(k),​k=0,k>0​+γN,k+1​/λN,k+1+​​(PN​(k+1)⊗I2​)QN​(k),

with

λN,r±={(N/2−r/2)/2N,for −,(N/2+r/2+1)/2N,for +,γN,r=2N+2sin⁡2(π(r+1)/(N+2))(N+2)(r+1)mN(r).\lambda^\pm_{N,r}= \begin{cases}(N/2-r/2)/2^N,&\text{for }-,\\ (N/2+r/2+1)/2^N,&\text{for }+, \end{cases} \qquad \gamma_{N,r}= \frac{2^{N+2}\sin^2(\pi(r+1)/(N+2))} {(N+2)(r+1)m_N(r)}.λN,r±​={(N/2−r/2)/2N,(N/2+r/2+1)/2N,​for −,for +,​γN,r​=(N+2)(r+1)mN​(r)2N+2sin2(π(r+1)/(N+2))​.

Here mn(r)=0m_n(r)=0mn​(r)=0 unless r≤nr\le nr≤n and n−rn-rn−r is even, and otherwise mn(r)=(n⌊(n−r)/2⌋)(r+1)div(⌊(n+r)/2⌋+1)m_n(r)=\binom n{\lfloor(n-r)/2\rfloor}(r+1)\mathbin{\mathrm{div}}(\lfloor(n+r)/2\rfloor+1)mn​(r)=(⌊(n−r)/2⌋n​)(r+1)div(⌊(n+r)/2⌋+1), using natural-number division. For any finite set WWW, define

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y=1{x=y∘(a b)},S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}=\mathbf1_{\{x=y\circ(a\ b)\}},SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​=1{x=y∘(a b)}​,

where the sum is over ordered pairs; PW(r)P_W(r)PW​(r) is zero outside J∣W∣J_{|W|}J∣W∣​, and otherwise is the real functional calculus of SWS_WSW​ with the indicator of r(r+2)/4r(r+2)/4r(r+2)/4. The notation PNP_NPN​ uses W={0,…,N−1}W=\{0,\ldots,N-1\}W={0,…,N−1}, while QN(r)Q_N(r)QN​(r) uses W={∗}⊔{0,…,N−1}W=\{\ast\}\sqcup\{0,\ldots,N-1\}W={∗}⊔{0,…,N−1}, identifying (x,c)(x,c)(x,c) with the function taking value ccc at ∗\ast∗ and xjx_jxj​ at jjj. All scalar coefficients are regarded as complex scalars; inverses at zero are zero and real square roots of negative arguments are zero.

QAlgorithms.Papers.Independent.Intake100.P67.generalizedEffects

For every natural number NNN and every i<Ni<Ni<N, this defines a complex matrix on BN×{0,1}\mathcal B_N\times\{0,1\}BN​×{0,1}, where BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N, by

EN,i=CN,i+1N(XN⊗I2−∑j<NCN,j),XN=∑r∈JNγN,rPN(r),CN,i=∑k∈JN−1FN,k Ξi,k2N−1 FN,k,E_{N,i}=C_{N,i}+\frac1N \left(X_N\otimes I_2-\sum_{j<N}C_{N,j}\right), \quad X_N=\sum_{r\in J_N}\gamma_{N,r}P_N(r), \quad C_{N,i}=\sum_{k\in J_{N-1}}F_{N,k}\, \frac{\Xi_{i,k}}{2^{N-1}}\,F_{N,k},EN,i​=CN,i​+N1​​XN​⊗I2​−j<N∑​CN,j​​,XN​=r∈JN​∑​γN,r​PN​(r),CN,i​=k∈JN−1​∑​FN,k​2N−1Ξi,k​​FN,k​,

where Js={r≤s:r mod 2=s mod 2}J_s=\{r\le s:r\bmod2=s\bmod2\}Js​={r≤s:rmod2=smod2}. In these formulas

γN,r=2N+2sin⁡2(π(r+1)/(N+2))(N+2)(r+1)mN(r),λN,r−=N−r2N+1,λN,r+=N+r+22N+1,\gamma_{N,r}= \frac{2^{N+2}\sin^2(\pi(r+1)/(N+2))} {(N+2)(r+1)m_N(r)},\qquad \lambda^-_{N,r}=\frac{N-r}{2^{N+1}},\qquad \lambda^+_{N,r}=\frac{N+r+2}{2^{N+1}},γN,r​=(N+2)(r+1)mN​(r)2N+2sin2(π(r+1)/(N+2))​,λN,r−​=2N+1N−r​,λN,r+​=2N+1N+r+2​,

where the subtraction in λ−\lambda^-λ− is real, and mn(r)m_n(r)mn​(r) is zero unless r≤nr\le nr≤n and n−rn-rn−r is even, and otherwise equals the natural-number quotient (n⌊(n−r)/2⌋)(r+1)div(⌊(n+r)/2⌋+1)\binom n{\lfloor(n-r)/2\rfloor}(r+1)\mathbin{\mathrm{div}}(\lfloor(n+r)/2\rfloor+1)(⌊(n−r)/2⌋n​)(r+1)div(⌊(n+r)/2⌋+1). The filter is

FN,k={0,k=0,γN,k−1/λN,k−1− (PN(k−1)⊗I2)QN(k),k>0+γN,k+1/λN,k+1+ (PN(k+1)⊗I2)QN(k),F_{N,k}= \begin{cases} 0,&k=0,\\ \sqrt{\gamma_{N,k-1}/\lambda^-_{N,k-1}}\, (P_N(k-1)\otimes I_2)Q_N(k),&k>0 \end{cases} + \sqrt{\gamma_{N,k+1}/\lambda^+_{N,k+1}}\, (P_N(k+1)\otimes I_2)Q_N(k),FN,k​={0,γN,k−1​/λN,k−1−​​(PN​(k−1)⊗I2​)QN​(k),​k=0,k>0​+γN,k+1​/λN,k+1+​​(PN​(k+1)⊗I2​)QN​(k),

and, for Wi={j<N:j≠i}W_i=\{j<N:j\ne i\}Wi​={j<N:j=i},

(Ξi,k)(x,c),(y,d)=s(xi,c)s(yi,d)‾PWi(k)x∣Wi,y∣Wi,s(0,1)=12,s(1,0)=−12,s(0,0)=s(1,1)=0.(\Xi_{i,k})_{(x,c),(y,d)} =s(x_i,c)\overline{s(y_i,d)} P_{W_i}(k)_{x|_{W_i},y|_{W_i}}, \quad s(0,1)=\frac1{\sqrt2},\quad s(1,0)=-\frac1{\sqrt2}, \quad s(0,0)=s(1,1)=0.(Ξi,k​)(x,c),(y,d)​=s(xi​,c)s(yi​,d)​PWi​​(k)x∣Wi​​,y∣Wi​​​,s(0,1)=2​1​,s(1,0)=−2​1​,s(0,0)=s(1,1)=0.

For each finite set WWW, PW(r)P_W(r)PW​(r) is zero outside J∣W∣J_{|W|}J∣W∣​; inside that set it is the real functional calculus, with the indicator of r(r+2)/4r(r+2)/4r(r+2)/4, of

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y=1{x=y∘(a b)},S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}=\mathbf1_{\{x=y\circ(a\ b)\}},SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​=1{x=y∘(a b)}​,

using ordered pairs. Here PN=P{0,…,N−1}P_N=P_{\{0,\ldots,N-1\}}PN​=P{0,…,N−1}​, and QN(r)Q_N(r)QN​(r) is P{∗}⊔{0,…,N−1}(r)P_{\{\ast\}\sqcup\{0,\ldots,N-1\}}(r)P{∗}⊔{0,…,N−1}​(r) written in coordinates (x,c)(x,c)(x,c), with ccc at ∗\ast∗. The index iii forces N≥1N\ge1N≥1; at N=0N=0N=0 the resulting family has no entries. Scalar coefficients are embedded into C\mathbb CC, zero inverses are zero, and real square roots of negative arguments are zero.

QAlgorithms.Papers.Independent.Intake100.P67.generalizedFilter

For arbitrary natural numbers N,kN,kN,k, this defines a complex matrix on BN×{0,1}\mathcal B_N\times\{0,1\}BN​×{0,1}, where BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N, by

FN,k={0,k=0,γN,k−1λN,k−1− (PN(k−1)⊗I2)QN(k),k>0+γN,k+1λN,k+1+ (PN(k+1)⊗I2)QN(k),F_{N,k}= \begin{cases} 0,&k=0,\\ \displaystyle \sqrt{\frac{\gamma_{N,k-1}}{\lambda^-_{N,k-1}}}\, (P_N(k-1)\otimes I_2)Q_N(k),&k>0 \end{cases} + \sqrt{\frac{\gamma_{N,k+1}}{\lambda^+_{N,k+1}}}\, (P_N(k+1)\otimes I_2)Q_N(k),FN,k​=⎩⎨⎧​0,λN,k−1−​γN,k−1​​​(PN​(k−1)⊗I2​)QN​(k),​k=0,k>0​+λN,k+1+​γN,k+1​​​(PN​(k+1)⊗I2​)QN​(k),

where

λN,r−=N/2−r/22N,λN,r+=N/2+r/2+12N,γN,r=2N+2sin⁡2(π(r+1)/(N+2))(N+2)(r+1)mN(r).\lambda^-_{N,r}=\frac{N/2-r/2}{2^N},\qquad \lambda^+_{N,r}=\frac{N/2+r/2+1}{2^N},\qquad \gamma_{N,r}= \frac{2^{N+2}\sin^2(\pi(r+1)/(N+2))} {(N+2)(r+1)m_N(r)}.λN,r−​=2NN/2−r/2​,λN,r+​=2NN/2+r/2+1​,γN,r​=(N+2)(r+1)mN​(r)2N+2sin2(π(r+1)/(N+2))​.

The natural number mn(r)m_n(r)mn​(r) is zero unless r≤nr\le nr≤n and n−rn-rn−r is even; in that case it is the natural-number quotient

mn(r)=(n⌊(n−r)/2⌋)(r+1)div(⌊(n+r)/2⌋+1).m_n(r)= \binom n{\lfloor(n-r)/2\rfloor}(r+1) \mathbin{\mathrm{div}}\bigl(\lfloor(n+r)/2\rfloor+1\bigr).mn​(r)=(⌊(n−r)/2⌋n​)(r+1)div(⌊(n+r)/2⌋+1).

To define the matrices used here, put Js={r≤s:r mod 2=s mod 2}J_s=\{r\le s:r\bmod2=s\bmod2\}Js​={r≤s:rmod2=smod2}. For a finite set WWW, let

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y=1{x=y∘(a b)},S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \quad (R_{ab})_{x,y}=\mathbf1_{\{x=y\circ(a\ b)\}},SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​=1{x=y∘(a b)}​,

with an ordered pair sum, and let PW(r)=0P_W(r)=0PW​(r)=0 for r∉J∣W∣r\notin J_{|W|}r∈/J∣W∣​, while otherwise PW(r)P_W(r)PW​(r) is the real functional calculus of SWS_WSW​ with the indicator of the single value r(r+2)/4r(r+2)/4r(r+2)/4. Then PN(r)=P{0,…,N−1}(r)P_N(r)=P_{\{0,\ldots,N-1\}}(r)PN​(r)=P{0,…,N−1}​(r), and

QN(r)(x,c),(y,d)=P{∗}⊔{0,…,N−1}(r)x~,y~,x~(∗)=c,x~(j)=xj,Q_N(r)_{(x,c),(y,d)} =P_{\{\ast\}\sqcup\{0,\ldots,N-1\}}(r)_{\tilde x,\tilde y}, \quad \tilde x(\ast)=c,\quad \tilde x(j)=x_j,QN​(r)(x,c),(y,d)​=P{∗}⊔{0,…,N−1}​(r)x~,y~​​,x~(∗)=c,x~(j)=xj​,

and similarly for y~\tilde yy~​. There are no parity, range, or positivity assumptions on N,kN,kN,k. All natural subtraction is truncated at zero, real division by zero is zero, and the real square root of a negative number is zero.

QAlgorithms.Papers.Independent.Intake100.P67.klmCurve

For every natural number mmm, including m=0m=0m=0, this defines the real number

klmCurve⁡(m)=1−1m+1,\operatorname{klmCurve}(m)=1-\frac1{m+1},klmCurve(m)=1−m+11​,

with mmm converted to a real number in the formula; in particular, its value at 000 is 000.

QAlgorithms.Papers.Independent.Intake100.P67.lambdaMinus

For arbitrary natural numbers N,kN,kN,k, this defines the real number

N/2−k/22N=N−k2N+1,\frac{N/2-k/2}{2^N} =\frac{N-k}{2^{N+1}},2NN/2−k/2​=2N+1N−k​,

where both NNN and kkk are converted to real numbers before subtraction. There is no restriction k≤Nk\le Nk≤N: the value is positive for k<Nk<Nk<N, zero for k=Nk=Nk=N, and negative for k>Nk>Nk>N. In particular, for N=0N=0N=0 it equals −k/2-k/2−k/2.

QAlgorithms.Papers.Independent.Intake100.P67.lambdaPlus

For every pair of natural numbers N,kN,kN,k, including zero, this defines the real number

λ+(N,k)=N/2+k/2+12N,\lambda_+(N,k)=\frac{N/2+k/2+1}{2^N},λ+​(N,k)=2NN/2+k/2+1​,

where the divisions in the numerator are real divisions. The denominator is always positive; in particular, λ+(0,k)=k/2+1\lambda_+(0,k)=k/2+1λ+​(0,k)=k/2+1.

QAlgorithms.Papers.Independent.Intake100.P67.minusSector

For all natural numbers N,kN,kN,k, this defines a complex matrix on pairs (x,c)(x,c)(x,c), where x:{0,…,N−1}→{false,true}x:\{0,\ldots,N-1\}\to\{\mathrm{false},\mathrm{true}\}x:{0,…,N−1}→{false,true} and ccc is Boolean, by

(QFin N(k)⊗IBool) Q~N(k+1).\bigl(Q_{\mathrm{Fin}\,N}(k)\otimes I_{\mathrm{Bool}}\bigr)\,\widetilde Q_{N}(k+1).(QFinN​(k)⊗IBool​)Q​N​(k+1).

Here, for any finite index set WWW of cardinality ddd, define

JW=d(4−d)4I+12∑a,b∈Wa≠bPab,Pab(x,z)={1x=z∘(a b),0otherwise,J_W=\frac{d(4-d)}4 I+\frac12\sum_{\substack{a,b\in W\\a\ne b}}P_{ab}, \qquad P_{ab}(x,z)= \begin{cases}1&x=z\circ(a\,b),\\0&\text{otherwise},\end{cases}JW​=4d(4−d)​I+21​a,b∈Wa=b​∑​Pab​,Pab​(x,z)={10​x=z∘(ab),otherwise,​

with the sum over ordered pairs. The matrix QW(r)Q_W(r)QW​(r) is zero unless 0≤r≤d0\le r\le d0≤r≤d and r≡d(mod2)r\equiv d\pmod2r≡d(mod2); otherwise it is the real functional calculus of JWJ_WJW​ for the function that equals 111 at r(r+2)/4r(r+2)/4r(r+2)/4 and 000 elsewhere. The matrix Q~N(r)\widetilde Q_N(r)Q​N​(r) is QOption(Fin N)(r)Q_{\mathrm{Option}(\mathrm{Fin}\,N)}(r)QOption(FinN)​(r) relabeled by assigning ccc to the extra index and x(i)x(i)x(i) to index iii. The displayed multiplication has the stated order. There are no restrictions on N,kN,kN,k; in particular, an inadmissible kkk makes the first factor zero.

QAlgorithms.Papers.Independent.Intake100.P67.optimalTheta

For every natural number NNN and every i<Ni<Ni<N, let Wi={j<N:j≠i}W_i=\{j<N:j\ne i\}Wi​={j<N:j=i}. This defines a complex matrix on the bit assignments Wi→{0,1}W_i\to\{0,1\}Wi​→{0,1} by

ΘN,iopt=∑k∈JN−12N+1 6(N+1)(N+2)(N+3)(k+1)N mN−1(k) PWi(k),Js={k≤s:k mod 2=s mod 2}.\Theta^{\mathrm{opt}}_{N,i} =\sum_{k\in J_{N-1}} \frac{2^{N+1}\,\dfrac6{(N+1)(N+2)(N+3)}(k+1)} {N\,m_{N-1}(k)}\,P_{W_i}(k), \qquad J_s=\{k\le s:k\bmod2=s\bmod2\}.ΘN,iopt​=k∈JN−1​∑​NmN−1​(k)2N+1(N+1)(N+2)(N+3)6​(k+1)​PWi​​(k),Js​={k≤s:kmod2=smod2}.

The coefficient arithmetic is real and the coefficients are then embedded into C\mathbb CC. Here mn(k)=0m_n(k)=0mn​(k)=0 unless k≤nk\le nk≤n and n−kn-kn−k is even, and otherwise

mn(k)=(n⌊(n−k)/2⌋)(k+1)div(⌊(n+k)/2⌋+1),m_n(k)= \binom n{\lfloor(n-k)/2\rfloor}(k+1) \mathbin{\mathrm{div}}\bigl(\lfloor(n+k)/2\rfloor+1\bigr),mn​(k)=(⌊(n−k)/2⌋n​)(k+1)div(⌊(n+k)/2⌋+1),

using natural-number division. For a finite set WWW, PW(k)=0P_W(k)=0PW​(k)=0 outside J∣W∣J_{|W|}J∣W∣​; otherwise it is the real functional calculus with the indicator of k(k+2)/4k(k+2)/4k(k+2)/4 applied to

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y=1{x=y∘(a b)},S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}=\mathbf1_{\{x=y\circ(a\ b)\}},SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​=1{x=y∘(a b)}​,

where the sum is over ordered pairs. The index iii forces N≥1N\ge1N≥1, so no value with N=0N=0N=0 and an index iii occurs; when N=1N=1N=1, the matrix has the single empty bit assignment as its index.

QAlgorithms.Papers.Independent.Intake100.P67.physicalEffects

For every natural number NNN, every complex matrix XXX on BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N, every family E=(Ei)i<NE=(E_i)_{i<N}E=(Ei​)i<N​ of complex matrices on BN×{0,1}\mathcal B_N\times\{0,1\}BN​×{0,1}, every Boolean flag ccc, and every i<Ni<Ni<N, this defines

HEiH+{1N(I−D0(X)⊗I2),c=true,0,c=false,H=D−1/2(X)⊗I2.H E_i H+ \begin{cases} \displaystyle\frac1N\left(I-D_0(X)\otimes I_2\right),&c=\mathrm{true},\\ 0,&c=\mathrm{false}, \end{cases} \qquad H=D_{-1/2}(X)\otimes I_2.HEi​H+⎩⎨⎧​N1​(I−D0​(X)⊗I2​),0,​c=true,c=false,​H=D−1/2​(X)⊗I2​.

Here Dt(X)D_t(X)Dt​(X) is the real continuous functional calculus of XXX with the function

ft(x)={0,x=0,xt,x≠0,f_t(x)= \begin{cases} 0,&x=0,\\ x^t,&x\ne0, \end{cases}ft​(x)={0,xt,​x=0,x=0,​

where xtx^txt is the total real power function. In particular, for Hermitian XXX, D0(X)D_0(X)D0​(X) replaces zero eigenvalues by zero and nonzero eigenvalues by one. No positivity, Hermitian, normalization, or completeness assumptions are imposed on XXX or the EiE_iEi​; the real functional calculus is total and returns zero when its self-adjointness or spectral continuity conditions fail. The index iii entails N≥1N\ge1N≥1; for N=0N=0N=0 there are no members of this family.

QAlgorithms.Papers.Independent.Intake100.P67.plusAmp

For every pair of Booleans a,ba,ba,b, this defines the complex number

p(a,b)={1/2,a≠b,0,a=b.p(a,b)= \begin{cases} 1/\sqrt2,&a\ne b,\\ 0,&a=b. \end{cases}p(a,b)={1/2​,0,​a=b,a=b.​

QAlgorithms.Papers.Independent.Intake100.P67.plusSector

For all natural numbers N,kN,kN,k, this defines a complex matrix indexed by pairs (x,c)(x,c)(x,c) of an NNN-bit string and a Boolean. Its value is zero when k=0k=0k=0; when k>0k>0k>0, it is

(QFin N(k)⊗IBool) Q~N(k−1).\bigl(Q_{\mathrm{Fin}\,N}(k)\otimes I_{\mathrm{Bool}}\bigr)\,\widetilde Q_N(k-1).(QFinN​(k)⊗IBool​)Q​N​(k−1).

For a finite set WWW of cardinality ddd, let

JW=d(4−d)4I+12∑a,b∈Wa≠bPab,Pab(x,z)=1{x=z∘(a b)},J_W=\frac{d(4-d)}4 I+\frac12\sum_{\substack{a,b\in W\\a\ne b}}P_{ab}, \qquad P_{ab}(x,z)=\mathbf1_{\{x=z\circ(a\,b)\}},JW​=4d(4−d)​I+21​a,b∈Wa=b​∑​Pab​,Pab​(x,z)=1{x=z∘(ab)}​,

where the sum uses ordered pairs and (a b)(a\,b)(ab) swaps the two indices. Then QW(r)=0Q_W(r)=0QW​(r)=0 unless r≤dr\le dr≤d and r≡d(mod2)r\equiv d\pmod2r≡d(mod2); for an admissible rrr, it is the real functional calculus of JWJ_WJW​ for the indicator of the value r(r+2)/4r(r+2)/4r(r+2)/4. The matrix Q~N(r)\widetilde Q_N(r)Q​N​(r) is QOption(Fin N)(r)Q_{\mathrm{Option}(\mathrm{Fin}\,N)}(r)QOption(FinN)​(r) with its extra Boolean coordinate identified with ccc. Thus k−1k-1k−1 is used only in the positive-kkk branch, and inadmissible kkk also gives zero. The definition includes N=0N=0N=0.

QAlgorithms.Papers.Independent.Intake100.P67.portAverageFidelity

For any natural numbers N,NAN,N_AN,NA​, any complex matrix OOO with rows indexed by NAN_ANA​-bit Boolean strings and columns by NNN-bit Boolean strings, and any family MiM_iMi​, 0≤i<N0\le i<N0≤i<N, of complex square matrices indexed by an NAN_ANA​-bit Boolean string and a Boolean, this declaration defines

 2(14∑i=0N−1Re⁡tr⁡ ⁣[(O†⊗I2)Mi(O⊗I2)Si])+1 3.\frac{\,2\left(\frac14\sum_{i=0}^{N-1} \operatorname{Re}\operatorname{tr}\!\left[ (O^\dagger\otimes I_2)M_i(O\otimes I_2)S_i \right]\right)+1\,}{3}.32(41​∑i=0N−1​Retr[(O†⊗I2​)Mi​(O⊗I2​)Si​])+1​.

Here I2I_2I2​ is the Boolean-indexed identity, and SiS_iSi​ has entry s(xi,c)s(yi,d)‾/2N−1s(x_i,c)\overline{s(y_i,d)}/2^{N-1}s(xi​,c)s(yi​,d)​/2N−1 at ((x,c),(y,d))((x,c),(y,d))((x,c),(y,d)) if the NNN-bit strings x,yx,yx,y agree at every position other than iii, and zero otherwise; s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and its other values are zero. No normalization or positivity is assumed. Either natural number may be zero; when N=0N=0N=0, the defined value is 1/31/31/3.

QAlgorithms.Papers.Independent.Intake100.P67.portRetainedOutput

For any finite types K,AK,AK,A, with specified finite enumerations and with no nonemptiness assumptions, any natural number NNN, any function R:A×KN→CR:A\times K^N\to\mathbb CR:A×KN→C, any complex square matrix MMM indexed by A×KA\times KA×K, any index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, and any complex square matrix TTT indexed by KKK, this declaration defines the matrix YYY indexed by KKK through

Yu,v=∑b,b′∈KNbi=u, bi′=vbk=bk′ for every k≠i ∑a,a′∈A ∑c,c′∈KR(a,b) R(a′,b′)‾ Tc,c′ M(a′,c′),(a,c)(u,v∈K).Y_{u,v} = \sum_{\substack{b,b'\in K^N\\ b_i=u,\ b'_i=v\\ b_k=b'_k\ \text{for every }k\ne i}} \ \sum_{a,a'\in A}\ \sum_{c,c'\in K} R(a,b)\,\overline{R(a',b')}\,T_{c,c'}\,M_{(a',c'),(a,c)} \qquad(u,v\in K).Yu,v​=b,b′∈KNbi​=u, bi′​=vbk​=bk′​ for every k=i​∑​ a,a′∈A∑​ c,c′∈K∑​R(a,b)R(a′,b′)​Tc,c′​M(a′,c′),(a,c)​(u,v∈K).

No normalization, positivity, or other conditions on R,M,TR,M,TR,M,T are assumed. The index iii can exist only when N≥1N\ge1N≥1; for N=1N=1N=1, the agreement condition outside iii is vacuous. If AAA is empty, the result is zero, and if KKK is empty, the result is the unique matrix on an empty index set.

QAlgorithms.Papers.Independent.Intake100.P67.portRho

For every natural number NNN, this declaration defines the complex matrix

ρN=∑i=0N−1Si\rho_N=\sum_{i=0}^{N-1}S_iρN​=i=0∑N−1​Si​

on pairs consisting of an NNN-bit Boolean string and a Boolean, where, for p=(x,c)p=(x,c)p=(x,c) and q=(y,d)q=(y,d)q=(y,d), the entry (Si)p,q(S_i)_{p,q}(Si​)p,q​ is s(xi,c)s(yi,d)‾/2N−1s(x_i,c)\overline{s(y_i,d)}/2^{N-1}s(xi​,c)s(yi​,d)​/2N−1 if xk=ykx_k=y_kxk​=yk​ for every k≠ik\ne ik=i, and is zero otherwise; here s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and the remaining values of sss are zero. When N=0N=0N=0, this is an empty sum and ρ0\rho_0ρ0​ is the zero matrix on the two-element index set consisting of an empty string and a Boolean.

QAlgorithms.Papers.Independent.Intake100.P67.portSignal

For every natural number NNN and index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, this declaration defines a complex matrix SiS_iSi​ indexed by pairs p=(x,c)p=(x,c)p=(x,c), q=(y,d)q=(y,d)q=(y,d), where x,yx,yx,y are NNN-bit Boolean strings and c,dc,dc,d are Booleans, by

(Si)(x,c),(y,d)={s(xi,c) s(yi,d)‾2N−1,xk=yk for every k≠i,0,otherwise,(S_i)_{(x,c),(y,d)} = \begin{cases} \dfrac{s(x_i,c)\,\overline{s(y_i,d)}}{2^{N-1}}, &x_k=y_k\text{ for every }k\ne i,\\ 0,&\text{otherwise}, \end{cases}(Si​)(x,c),(y,d)​=⎩⎨⎧​2N−1s(xi​,c)s(yi​,d)​​,0,​xk​=yk​ for every k=i,otherwise,​

where s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and s=0s=0s=0 on the other Boolean pairs. The subtraction in N−1N-1N−1 is natural-number subtraction, but the existence of iii already requires N≥1N\ge1N≥1; there is no such index when N=0N=0N=0. For N=1N=1N=1, the agreement condition outside iii is vacuous and the denominator is 111.

QAlgorithms.Papers.Independent.Intake100.P67.portSuccessProbability

For arbitrary natural numbers N,NAN,N_AN,NA​, a complex matrix OOO from NNN-bit strings to NAN_ANA​-bit strings, and complex matrices MiM_iMi​ on pairs consisting of an NAN_ANA​-bit string and a Boolean value, indexed by 0≤i<N0\le i<N0≤i<N, this defines the real number

12N+1∑i=0N−1Re⁡tr⁡ ⁣[(O†⊗I2) Mi (O⊗I2)],\frac{1}{2^{N+1}} \sum_{i=0}^{N-1} \operatorname{Re}\operatorname{tr} \!\left[(O^\dagger\otimes I_2)\,M_i\,(O\otimes I_2)\right],2N+11​i=0∑N−1​Retr[(O†⊗I2​)Mi​(O⊗I2​)],

where O†O^\daggerO† is the conjugate transpose and I2I_2I2​ is the identity on the two Boolean values. No normalization, positivity, or protocol condition is assumed, so the definition itself imposes no probability bounds on this number. The denominator is always positive; when N=0N=0N=0, the sum is empty and the value is zero.

QAlgorithms.Papers.Independent.Intake100.P67.postAmplitude

For arbitrary natural numbers N,NAN,N_AN,NA​, an arbitrary complex matrix OOO from length-NNN to length-NAN_ANA​ Boolean strings, an arbitrary complex matrix MMM on {0,1}NA×{0,1}\{0,1\}^{N_A}\times\{0,1\}{0,1}NA​×{0,1}, an arbitrary vector v∈C{0,1}v\in\mathbb C^{\{0,1\}}v∈C{0,1}, and indices a∈{0,1}NAa\in\{0,1\}^{N_A}a∈{0,1}NA​, c∈{0,1}c\in\{0,1\}c∈{0,1}, b∈{0,1}Nb\in\{0,1\}^Nb∈{0,1}N, this defines

AO,M,v(a,c,b)=∑a′∈{0,1}NA∑c′∈{0,1}[cfc⁡(⋅,M)](a,c),(a′,c′)(∑x∈{0,1}NOa′x∏j=0N−1s(xj,bj))vc′,A_{O,M,v}(a,c,b) =\sum_{a'\in\{0,1\}^{N_A}}\sum_{c'\in\{0,1\}} \bigl[\operatorname{cfc}(\sqrt{\cdot},M)\bigr]_{(a,c),(a',c')} \left(\sum_{x\in\{0,1\}^N}O_{a'x}\prod_{j=0}^{N-1}s(x_j,b_j)\right)v_{c'},AO,M,v​(a,c,b)=a′∈{0,1}NA​∑​c′∈{0,1}∑​[cfc(⋅​,M)](a,c),(a′,c′)​​x∈{0,1}N∑​Oa′x​j=0∏N−1​s(xj​,bj​)​vc′​,

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and its other values are zero. Here cfc⁡(⋅,M)\operatorname{cfc}(\sqrt{\cdot},M)cfc(⋅​,M) is the total real functional-calculus expression used in the definition; no Hermitian or positivity hypothesis on MMM, or normalization hypothesis on OOO or vvv, is imposed. Either register length may be zero, with empty coordinate products equal to 111.

QAlgorithms.Papers.Independent.Intake100.P67.postBranchProbability

For arbitrary natural numbers N,NAN,N_AN,NA​, an arbitrary complex matrix OOO from length-NNN to length-NAN_ANA​ Boolean strings, an arbitrary complex matrix MMM on {0,1}NA×{0,1}\{0,1\}^{N_A}\times\{0,1\}{0,1}NA​×{0,1}, and an arbitrary vector v∈C{0,1}v\in\mathbb C^{\{0,1\}}v∈C{0,1}, this defines the real number

PO,M,v=∑a∈{0,1}NA∑c∈{0,1}∑b∈{0,1}N∣∑a′∈{0,1}NA∑c′∈{0,1}[cfc⁡(⋅,M)](a,c),(a′,c′)(∑x∈{0,1}NOa′x∏j=0N−1s(xj,bj))vc′∣2,P_{O,M,v}= \sum_{a\in\{0,1\}^{N_A}}\sum_{c\in\{0,1\}}\sum_{b\in\{0,1\}^N} \left| \sum_{a'\in\{0,1\}^{N_A}}\sum_{c'\in\{0,1\}} \bigl[\operatorname{cfc}(\sqrt{\cdot},M)\bigr]_{(a,c),(a',c')} \left(\sum_{x\in\{0,1\}^N}O_{a'x}\prod_{j=0}^{N-1}s(x_j,b_j)\right)v_{c'} \right|^2,PO,M,v​=a∈{0,1}NA​∑​c∈{0,1}∑​b∈{0,1}N∑​​a′∈{0,1}NA​∑​c′∈{0,1}∑​[cfc(⋅​,M)](a,c),(a′,c′)​​x∈{0,1}N∑​Oa′x​j=0∏N−1​s(xj​,bj​)​vc′​​2,

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and the other values are zero. The functional calculus is used without assumptions on MMM; neither OOO nor vvv is required to be normalized. Thus the definition is a sum of squared complex moduli without an imposed upper bound of 111. Zero register lengths are permitted, with empty coordinate products equal to 111.

QAlgorithms.Papers.Independent.Intake100.P67.probabilisticMeasurement

For every natural number NNN, this defines a family of complex matrices MiM_iMi​, indexed by i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, on pairs (b,c)∈{0,1}N×{0,1}(b,c)\in\{0,1\}^N\times\{0,1\}(b,c)∈{0,1}N×{0,1}, as follows. For a finite set WWW, let FuvF_{uv}Fuv​ be the matrix that swaps coordinates u,vu,vu,v of a Boolean string on WWW, and define

JW=∣W∣(4−∣W∣)4I+12∑u,v∈Wu≠vFuv.J_W=\frac{|W|(4-|W|)}4I+\frac12\sum_{\substack{u,v\in W\\u\ne v}}F_{uv}.JW​=4∣W∣(4−∣W∣)​I+21​u,v∈Wu=v​∑​Fuv​.

Let PW,kP_{W,k}PW,k​ be zero unless 0≤k≤∣W∣0\le k\le |W|0≤k≤∣W∣ and k≡∣W∣(mod2)k\equiv |W|\pmod2k≡∣W∣(mod2); otherwise let it be the real functional calculus of JWJ_WJW​ for the function equal to 111 at k(k+2)/4k(k+2)/4k(k+2)/4 and 000 elsewhere. Write Sn={k:0≤k≤n, k≡n(mod2)}\mathcal S_n=\{k:0\le k\le n,\ k\equiv n\pmod2\}Sn​={k:0≤k≤n, k≡n(mod2)}, and let

m(n,k)={⌊(n(n−k)/2)(k+1)(n+k)/2+1⌋,k≤n and n−k is even,0,otherwise.m(n,k)= \begin{cases} \displaystyle\left\lfloor \frac{\binom n{(n-k)/2}(k+1)}{(n+k)/2+1} \right\rfloor,&k\le n\text{ and }n-k\text{ is even},\\ 0,&\text{otherwise}. \end{cases}m(n,k)=⎩⎨⎧​⌊(n+k)/2+1((n−k)/2n​)(k+1)​⌋,0,​k≤n and n−k is even,otherwise.​

Here the divisions in the natural-number arguments are integer divisions. Set

X=∑k∈SN2N 6(k+1)(N+1)(N+2)(N+3)m(N,k)P{0,…,N−1},k,Ti=∑k∈SN−12N+1 6(k+1)(N+1)(N+2)(N+3)N m(N−1,k)P{j:j≠i},k.X=\sum_{k\in\mathcal S_N} \frac{2^N\,6(k+1)}{(N+1)(N+2)(N+3)m(N,k)}P_{\{0,\ldots,N-1\},k}, \qquad T_i=\sum_{k\in\mathcal S_{N-1}} \frac{2^{N+1}\,6(k+1)} {(N+1)(N+2)(N+3)N\,m(N-1,k)}P_{\{j:j\ne i\},k}.X=k∈SN​∑​(N+1)(N+2)(N+3)m(N,k)2N6(k+1)​P{0,…,N−1},k​,Ti​=k∈SN−1​∑​(N+1)(N+2)(N+3)Nm(N−1,k)2N+16(k+1)​P{j:j=i},k​.

Define s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, and s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0, and define

Ei((b,c),(b′,c′))=s(bi,c)s(bi′,c′)‾ Ti(b∣{j:j≠i},b′∣{j:j≠i}).E_i((b,c),(b',c'))= s(b_i,c)\overline{s(b'_i,c')}\, T_i(b|_{\{j:j\ne i\}},b'|_{\{j:j\ne i\}}).Ei​((b,c),(b′,c′))=s(bi​,c)s(bi′​,c′)​Ti​(b∣{j:j=i}​,b′∣{j:j=i}​).

If X[−1/2]X^{[-1/2]}X[−1/2] denotes the real functional calculus of XXX for x↦0x\mapsto0x↦0 at x=0x=0x=0 and x↦x−1/2x\mapsto x^{-1/2}x↦x−1/2 otherwise, the resulting matrix is

Mi=(X[−1/2]⊗I2)Ei(X[−1/2]⊗I2).M_i=(X^{[-1/2]}\otimes I_2)E_i(X^{[-1/2]}\otimes I_2).Mi​=(X[−1/2]⊗I2​)Ei​(X[−1/2]⊗I2​).

All real and complex divisions use the total convention 0−1=00^{-1}=00−1=0, and N−1N-1N−1 is truncated natural subtraction. For N=0N=0N=0, the family has no members.

QAlgorithms.Papers.Independent.Intake100.P67.probabilisticOptimumSuccess

For every natural number NNN, including N=0N=0N=0, this defines the real number

NN+3,\frac{N}{N+3},N+3N​,

with NNN converted to a real number before division. In particular, its value at N=0N=0N=0 is zero.

QAlgorithms.Papers.Independent.Intake100.P67.probabilisticX

For every natural number NNN, including zero, this defines a complex matrix on BN={0,1}N\mathcal B_N=\{0,1\}^NBN​={0,1}N:

XNprob=∑k∈JN2N 6(N+1)(N+2)(N+3)(k+1)mN(k) P{0,…,N−1}(k),Jn={k≤n:k mod 2=n mod 2}.X^{\mathrm{prob}}_N =\sum_{k\in J_N} \frac{2^N\,\dfrac6{(N+1)(N+2)(N+3)}(k+1)} {m_N(k)}\,P_{\{0,\ldots,N-1\}}(k), \qquad J_n=\{k\le n:k\bmod2=n\bmod2\}.XNprob​=k∈JN​∑​mN​(k)2N(N+1)(N+2)(N+3)6​(k+1)​P{0,…,N−1}​(k),Jn​={k≤n:kmod2=nmod2}.

All coefficient arithmetic is real before embedding the coefficient into C\mathbb CC. The natural number mn(k)m_n(k)mn​(k) is zero unless k≤nk\le nk≤n and n−kn-kn−k is even, and otherwise equals

(n⌊(n−k)/2⌋)(k+1)div(⌊(n+k)/2⌋+1).\binom n{\lfloor(n-k)/2\rfloor}(k+1) \mathbin{\mathrm{div}}\bigl(\lfloor(n+k)/2\rfloor+1\bigr).(⌊(n−k)/2⌋n​)(k+1)div(⌊(n+k)/2⌋+1).

For any finite set WWW, PW(k)P_W(k)PW​(k) is zero outside J∣W∣J_{|W|}J∣W∣​; otherwise it is the real continuous functional calculus with the indicator of k(k+2)/4k(k+2)/4k(k+2)/4 applied to

SW=∣W∣(4−∣W∣)4I+12∑a,b∈Wa≠bRab,(Rab)x,y=1{x=y∘(a b)},S_W=\frac{|W|(4-|W|)}4I+ \frac12\sum_{\substack{a,b\in W\\a\ne b}}R_{ab}, \qquad (R_{ab})_{x,y}=\mathbf1_{\{x=y\circ(a\ b)\}},SW​=4∣W∣(4−∣W∣)​I+21​a,b∈Wa=b​∑​Rab​,(Rab​)x,y​=1{x=y∘(a b)}​,

using ordered pairs in the sum. At N=0N=0N=0, the bit-string index set has one element and this definition gives X0prob=IX^{\mathrm{prob}}_0=IX0prob​=I.

QAlgorithms.Papers.Independent.Intake100.P67.qubitSpinProjector

For any type WWW equipped with a finite enumeration and any natural number kkk, write m=∣W∣m=|W|m=∣W∣ and define

SW=m(4−m)4 I+12∑i,j∈Wi≠jSij,(Sij)a,b={1,a=b∘τij,0,otherwise,S_W=\frac{m(4-m)}4\,I+ \frac12\sum_{\substack{i,j\in W\\i\ne j}}S_{ij}, \qquad (S_{ij})_{a,b}= \begin{cases} 1,&a=b\circ\tau_{ij},\\ 0,&\text{otherwise}, \end{cases}SW​=4m(4−m)​I+21​i,j∈Wi=j​∑​Sij​,(Sij​)a,b​={1,0,​a=b∘τij​,otherwise,​

on Boolean assignments to WWW, where τij\tau_{ij}τij​ exchanges i,ji,ji,j. If k≤mk\le mk≤m and k≡m(mod2)k\equiv m\pmod2k≡m(mod2), the definition applies the real spectral functional calculus to SWS_WSW​ with the function equal to 111 at k(k+2)/4k(k+2)/4k(k+2)/4 and 000 at every other real number; otherwise it returns the zero matrix. The test at k(k+2)/4k(k+2)/4k(k+2)/4 uses exact equality. When WWW is empty, the result is the one-by-one identity for k=0k=0k=0 and zero for every k>0k>0k>0.

QAlgorithms.Papers.Independent.Intake100.P67.quditChannel

For every pair of natural numbers N,dN,dN,d, this defines a function ΦN,d\Phi_{N,d}ΦN,d​ from complex d×dd\times dd×d matrices to complex d×dd\times dd×d matrices. Put D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, let R(a,b)=1/dNR(a,b)=1/\sqrt{d^N}R(a,b)=1/dN​ when a=b∈DNa=b\in D^Na=b∈DN and 000 otherwise, and define matrices on DN×DD^N\times DDN×D by

Si((a,c),(b,e))=(dN)−11{ai=c, bi=e, ak=bk ∀k≠i}.S_i((a,c),(b,e)) =(d^N)^{-1}\mathbf1_{\{a_i=c,\ b_i=e,\ a_k=b_k\ \forall k\ne i\}}.Si​((a,c),(b,e))=(dN)−11{ai​=c, bi​=e, ak​=bk​ ∀k=i}​.

Let HHH be the real functional calculus of ∑jSj\sum_jS_j∑j​Sj​ for the function x↦0x\mapsto0x↦0 at zero and x↦x−1/2x\mapsto x^{-1/2}x↦x−1/2 otherwise, and put

Ei=HSiH+1N(I−∑jHSjH).E_i=HS_iH+\frac1N\left(I-\sum_jHS_jH\right).Ei​=HSi​H+N1​(I−j∑​HSj​H).

For every input matrix TTT and u,v∈Du,v\in Du,v∈D, the output is

ΦN,d(T)uv=∑i=0N−1∑b,b′∈DNbi=u, bi′=vbk=bk′ ∀k≠i ∑a,a′∈DN∑c,c′∈DR(a,b)R(a′,b′)‾ Tcc′ Ei((a′,c′),(a,c)).\Phi_{N,d}(T)_{uv} =\sum_{i=0}^{N-1} \sum_{\substack{b,b'\in D^N\\b_i=u,\ b'_i=v\\b_k=b'_k\ \forall k\ne i}} \ \sum_{a,a'\in D^N}\sum_{c,c'\in D} R(a,b)\overline{R(a',b')}\,T_{cc'}\, E_i((a',c'),(a,c)).ΦN,d​(T)uv​=i=0∑N−1​b,b′∈DNbi​=u, bi′​=vbk​=bk′​ ∀k=i​∑​ a,a′∈DN∑​c,c′∈D∑​R(a,b)R(a′,b′)​Tcc′​Ei​((a′,c′),(a,c)).

Every inverse is total, with inverse zero equal to zero. For N=0N=0N=0, the outer sum is empty and the function is the zero map; for d=0d=0d=0, its input and output matrices have empty index sets. The definition itself imposes no channel axioms.

QAlgorithms.Papers.Independent.Intake100.P67.quditResource

For arbitrary natural numbers N,dN,dN,d and strings a,b:{0,…,N−1}→{0,…,d−1}a,b:\{0,\ldots,N-1\}\to\{0,\ldots,d-1\}a,b:{0,…,N−1}→{0,…,d−1}, this defines the complex number

RN,d(a,b)={1dN,a=b,0,a≠b.R_{N,d}(a,b)= \begin{cases} \displaystyle\frac1{\sqrt{d^N}},&a=b,\\ 0,&a\ne b. \end{cases}RN,d​(a,b)=⎩⎨⎧​dN​1​,0,​a=b,a=b.​

The square root is the real square root, embedded into C\mathbb CC, and its inverse is the complex inverse. No positivity assumptions on N,dN,dN,d are imposed: when N=0N=0N=0, both strings are the unique empty string and the value is 111, including when d=0d=0d=0; when d=0<Nd=0<Nd=0<N, there are no such strings a,ba,ba,b.

QAlgorithms.Papers.Independent.Intake100.P67.quditSignal

For arbitrary natural numbers N,dN,dN,d and an index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, this defines a complex matrix SiS_iSi​ whose row and column indices are pairs (a,c)(a,c)(a,c), where aaa is a length-NNN string with entries in {0,…,d−1}\{0,\ldots,d-1\}{0,…,d−1} and c∈{0,…,d−1}c\in\{0,\ldots,d-1\}c∈{0,…,d−1}, by

Si((a,c),(b,e))={(dN)−1,ai=c, bi=e, and ak=bk for every k≠i,0,otherwise.S_i((a,c),(b,e))= \begin{cases} (d^N)^{-1},& a_i=c,\ b_i=e,\ \text{and }a_k=b_k\text{ for every }k\ne i,\\ 0,&\text{otherwise}. \end{cases}Si​((a,c),(b,e))={(dN)−1,0,​ai​=c, bi​=e, and ak​=bk​ for every k=i,otherwise.​

The nonzero value uses inversion in C\mathbb CC, where 0−1=00^{-1}=00−1=0. Supplying iii requires N>0N>0N>0; d=0d=0d=0 is permitted, in which case the matrix has an empty index set.

QAlgorithms.Papers.Independent.Intake100.P67.residualDensity

For arbitrary natural numbers N,NAN,N_AN,NA​, an arbitrary complex matrix OOO from length-NNN to length-NAN_ANA​ Boolean strings, an arbitrary complex matrix MMM on {0,1}NA×{0,1}\{0,1\}^{N_A}\times\{0,1\}{0,1}NA​×{0,1}, an arbitrary vector v∈C{0,1}v\in\mathbb C^{\{0,1\}}v∈C{0,1}, and an index i<Ni<Ni<N, this defines a complex matrix DDD on Boolean assignments to the indices other than iii. Define

A(a,c,b)=∑a′,c′[cfc⁡(⋅,M)](a,c),(a′,c′)(∑x∈{0,1}NOa′x∏j=0N−1s(xj,bj))vc′,P=∑a,c,b∣A(a,c,b)∣2,A(a,c,b)= \sum_{a',c'} \bigl[\operatorname{cfc}(\sqrt{\cdot},M)\bigr]_{(a,c),(a',c')} \left(\sum_{x\in\{0,1\}^N}O_{a'x}\prod_{j=0}^{N-1}s(x_j,b_j)\right)v_{c'}, \qquad P=\sum_{a,c,b}|A(a,c,b)|^2,A(a,c,b)=a′,c′∑​[cfc(⋅​,M)](a,c),(a′,c′)​​x∈{0,1}N∑​Oa′x​j=0∏N−1​s(xj​,bj​)​vc′​,P=a,c,b∑​∣A(a,c,b)∣2,

where a,a′∈{0,1}NAa,a'\in\{0,1\}^{N_A}a,a′∈{0,1}NA​, c,c′∈{0,1}c,c'\in\{0,1\}c,c′∈{0,1}, b∈{0,1}Nb\in\{0,1\}^Nb∈{0,1}N, and s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, with its other values zero. If b(r,t)b(r,t)b(r,t) is the string equal to ttt at iii and to rrr elsewhere, then

Drr′=∑a∈{0,1}NA∑c,t∈{0,1}A(a,c,b(r,t)) A(a,c,b(r′,t))‾P.D_{rr'}= \frac{\displaystyle\sum_{a\in\{0,1\}^{N_A}}\sum_{c,t\in\{0,1\}} A(a,c,b(r,t))\,\overline{A(a,c,b(r',t))}}{P}.Drr′​=Pa∈{0,1}NA​∑​c,t∈{0,1}∑​A(a,c,b(r,t))A(a,c,b(r′,t))​​.

The denominator is embedded into C\mathbb CC. No positivity or normalization hypotheses are imposed on the inputs, and no hypothesis requires P>0P>0P>0; when P=0P=0P=0, total complex division makes every entry zero. The index iii requires N>0N>0N>0, and for N=1N=1N=1 the matrix has a singleton index set.

QAlgorithms.Papers.Independent.Intake100.P67.resource

For any natural numbers N,NAN,N_AN,NA​, any complex matrix OOO whose rows are indexed by NAN_ANA​-bit Boolean strings and columns by NNN-bit Boolean strings, and any such strings aaa and bbb, respectively, this declaration defines the complex number

RO(a,b)=∑x∈{0,1}NOa,x∏i=0N−1s(xi,bi),R_O(a,b)=\sum_{x\in\{0,1\}^{N}}O_{a,x}\prod_{i=0}^{N-1}s(x_i,b_i),RO​(a,b)=x∈{0,1}N∑​Oa,x​i=0∏N−1​s(xi​,bi​),

where s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and sss is zero on the other two Boolean pairs. No normalization or other condition on OOO is assumed. When N=0N=0N=0, the product is 111, the sum has one term, and RO(a,b)=Oa,∅R_O(a,b)=O_{a,\varnothing}RO​(a,b)=Oa,∅​; NA=0N_A=0NA​=0 is also allowed.

QAlgorithms.Papers.Independent.Intake100.P67.resourceOperator

For any finite type III, supplied with decidable equality, and any complex matrix XXX indexed by I×II\times II×I, this defines the matrix obtained by applying the real function x↦xx\mapsto\sqrt{x}x↦x​ to XXX through the real continuous functional calculus. If XXX is Hermitian, this replaces every real eigenvalue λ\lambdaλ by λ\sqrt{\lambda}λ​, with negative eigenvalues replaced by zero. No Hermitian or positive-semidefinite hypothesis is required; the functional calculus returns zero for a non-Hermitian matrix. The index type may be empty, in which case the result is the unique empty matrix.

QAlgorithms.Papers.Independent.Intake100.P67.restorePort

For every natural number NNN, index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, Boolean assignment rrr on the indices other than iii, and Boolean ttt, this defines a length-NNN Boolean string bbb by

bk={t,k=i,rk,k≠i.b_k= \begin{cases} t,&k=i,\\ r_k,&k\ne i. \end{cases}bk​={t,rk​,​k=i,k=i.​

The argument iii requires N>0N>0N>0; when N=1N=1N=1, rrr is the unique assignment on the empty set.

QAlgorithms.Papers.Independent.Intake100.P67.rhoBlock

For all natural numbers N,kN,kN,k, this defines the complex matrix Q~N(k)RN\widetilde Q_N(k)R_NQ​N​(k)RN​, in that order, on pairs (x,c)(x,c)(x,c) of an NNN-bit string and a Boolean. To define Q~N(k)\widetilde Q_N(k)Q​N​(k), take W=Option(Fin N)W=\mathrm{Option}(\mathrm{Fin}\,N)W=Option(FinN), of cardinality d=N+1d=N+1d=N+1, and

JW=d(4−d)4I+12∑a,b∈Wa≠bPab,Pab(u,v)=1{u=v∘(a b)}.J_W=\frac{d(4-d)}4I+\frac12\sum_{\substack{a,b\in W\\a\ne b}}P_{ab}, \qquad P_{ab}(u,v)=\mathbf1_{\{u=v\circ(a\,b)\}}.JW​=4d(4−d)​I+21​a,b∈Wa=b​∑​Pab​,Pab​(u,v)=1{u=v∘(ab)}​.

The sum is over ordered pairs; Q~N(k)\widetilde Q_N(k)Q​N​(k) is zero unless k≤dk\le dk≤d and k≡d(mod2)k\equiv d\pmod2k≡d(mod2), and otherwise is the functional calculus of JWJ_WJW​ for the indicator of k(k+2)/4k(k+2)/4k(k+2)/4, relabeled so that the extra coordinate is ccc and the remaining coordinates are xxx. The other factor is RN=∑i=0N−1SiR_N=\sum_{i=0}^{N-1}S_iRN​=∑i=0N−1​Si​, where

Si((x,c),(z,e))={s(xi,c) s(zi,e)‾/2N−1,xj=zj for every j≠i,0,otherwise,S_i((x,c),(z,e))= \begin{cases} s(x_i,c)\,\overline{s(z_i,e)}/2^{N-1}, &x_j=z_j\text{ for every }j\ne i,\\ 0,&\text{otherwise}, \end{cases}Si​((x,c),(z,e))={s(xi​,c)s(zi​,e)​/2N−1,0,​xj​=zj​ for every j=i,otherwise,​

and s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, with s=0s=0s=0 on the other Boolean pairs. The exponent N−1N-1N−1 uses natural subtraction, which gives zero when N=0N=0N=0; in that case the sum defining RNR_NRN​ is empty and the resulting matrix is zero.

QAlgorithms.Papers.Independent.Intake100.P67.signalBlock

For every natural number NNN, every i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, and every natural number kkk, this defines the complex matrix

Si,k((x,c),(z,e))=2−(N−1)s(xi,c) s(zi,e)‾ QW(k)(x∣W,z∣W),W={j<N:j≠i},S_{i,k}((x,c),(z,e)) =2^{-(N-1)}s(x_i,c)\,\overline{s(z_i,e)} \,Q_W(k)(x|_W,z|_W), \qquad W=\{j<N:j\ne i\},Si,k​((x,c),(z,e))=2−(N−1)s(xi​,c)s(zi​,e)​QW​(k)(x∣W​,z∣W​),W={j<N:j=i},

on pairs of an NNN-bit string and a Boolean. Here s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and its other values are zero. For d=∣W∣d=|W|d=∣W∣, define

JW=d(4−d)4I+12∑a,b∈Wa≠bPab,Pab(u,v)=1{u=v∘(a b)},J_W=\frac{d(4-d)}4I+\frac12\sum_{\substack{a,b\in W\\a\ne b}}P_{ab}, \qquad P_{ab}(u,v)=\mathbf1_{\{u=v\circ(a\,b)\}},JW​=4d(4−d)​I+21​a,b∈Wa=b​∑​Pab​,Pab​(u,v)=1{u=v∘(ab)}​,

where the sum is over ordered pairs. The factor QW(k)Q_W(k)QW​(k) is zero unless k≤dk\le dk≤d and k≡d(mod2)k\equiv d\pmod2k≡d(mod2); otherwise it is the functional calculus of JWJ_WJW​ for the indicator of k(k+2)/4k(k+2)/4k(k+2)/4. The index iii ensures N>0N>0N>0, so the natural subtraction N−1N-1N−1 in the normalization is ordinary subtraction; WWW is allowed to be empty.

QAlgorithms.Papers.Independent.Intake100.P67.singletAmp

For any Booleans a,ba,ba,b, the complex number s(a,b)s(a,b)s(a,b) defined by this declaration is

s(a,b)={1/2,a=false, b=true,−1/2,a=true, b=false,0,otherwise.s(a,b)= \begin{cases} 1/\sqrt2,&a=\mathrm{false},\ b=\mathrm{true},\\ -1/\sqrt2,&a=\mathrm{true},\ b=\mathrm{false},\\ 0,&\text{otherwise}. \end{cases}s(a,b)=⎩⎨⎧​1/2​,−1/2​,0,​a=false, b=true,a=true, b=false,otherwise.​

QAlgorithms.Papers.Independent.Intake100.P67.spinSquare

For any type WWW equipped with a finite enumeration, write m=∣W∣m=|W|m=∣W∣ and let III be the identity matrix on the Boolean assignments W→{false,true}W\to\{\mathrm{false},\mathrm{true}\}W→{false,true}. For distinct i,j∈Wi,j\in Wi,j∈W, define SijS_{ij}Sij​ by (Sij)a,b=1(S_{ij})_{a,b}=1(Sij​)a,b​=1 if a=b∘τija=b\circ\tau_{ij}a=b∘τij​, and zero otherwise, where τij\tau_{ij}τij​ exchanges i,ji,ji,j and fixes every other element. This defines the complex matrix

m(4−m)4 I+12∑i,j∈Wi≠jSij.\frac{m(4-m)}4\,I +\frac12\sum_{\substack{i,j\in W\\i\ne j}}S_{ij}.4m(4−m)​I+21​i,j∈Wi=j​∑​Sij​.

The sum is over ordered pairs, so both (i,j)(i,j)(i,j) and (j,i)(j,i)(j,i) occur. The subtraction 4−m4-m4−m is in the real numbers and may be negative. The type WWW may be empty; in that case the matrix is the zero one-by-one matrix on the unique empty assignment.

QAlgorithms.Papers.Independent.Intake100.P67.spins

For every natural number nnn, this defines the finite set

{k∈N:0≤k≤n, k≡n(mod2)}.\{k\in\mathbb N:0\le k\le n,\ k\equiv n\pmod2\}.{k∈N:0≤k≤n, k≡n(mod2)}.

Thus it includes zero exactly when nnn is even, always includes nnn, and for n=0n=0n=0 equals {0}\{0\}{0}.

QAlgorithms.Papers.Independent.Intake100.P67.successObjective

For any natural number NNN and any family of complex matrices TiT_iTi​, indexed by i<Ni<Ni<N, where TiT_iTi​ has rows and columns indexed by Boolean assignments to {j<N:j≠i}\{j<N:j\ne i\}{j<N:j=i}, this defines

∑i=0N−1Re⁡tr⁡Ti2N+1.\frac{\displaystyle\sum_{i=0}^{N-1} \operatorname{Re}\operatorname{tr}T_i} {2^{N+1}}.2N+1i=0∑N−1​RetrTi​​.

No positivity or feasibility conditions are assumed. The denominator is positive for every NNN; when N=0N=0N=0, the family and sum are empty and the value is zero.

QAlgorithms.Papers.Independent.Intake100.P67.swapTwo

For every two-bit string a=(a0,a1)a=(a_0,a_1)a=(a0​,a1​), this defines the two-bit string obtained by exchanging its coordinates:

swapTwo⁡(a)=(a1,a0).\operatorname{swapTwo}(a)=(a_1,a_0).swapTwo(a)=(a1​,a0​).

This includes strings with equal bits, which are unchanged.

QAlgorithms.Papers.Independent.Intake100.P67.totalProjector

For natural numbers N,kN,kN,k, let WWW consist of the indices 0,…,N−10,\ldots,N-10,…,N−1 together with one additional distinguished element, and identify a pair (b,c)(b,c)(b,c), consisting of an NNN-bit string and a Boolean value, with the Boolean assignment (b,c)^\widehat{(b,c)}(b,c)​ on WWW that takes value bib_ibi​ at index iii and value ccc at the distinguished element. Put

SW=(N+1)(4−(N+1))4 I+12∑u,v∈Wu≠vSuv,S_W=\frac{(N+1)(4-(N+1))}{4}\,I+ \frac12\sum_{\substack{u,v\in W\\u\ne v}}S_{uv},SW​=4(N+1)(4−(N+1))​I+21​u,v∈Wu=v​∑​Suv​,

where (Suv)a,a′=1(S_{uv})_{a,a'}=1(Suv​)a,a′​=1 exactly when a=a′∘τuva=a'\circ\tau_{uv}a=a′∘τuv​, and is zero otherwise, with τuv\tau_{uv}τuv​ exchanging u,vu,vu,v. If k≤N+1k\le N+1k≤N+1 and k≡N+1(mod2)k\equiv N+1\pmod2k≡N+1(mod2), let PPP be the spectral functional calculus of SWS_WSW​ for the function equal to 111 at k(k+2)/4k(k+2)/4k(k+2)/4 and zero elsewhere; otherwise let P=0P=0P=0. The defined matrix has entries

P(b,c)^, (b′,c′)^.P_{\widehat{(b,c)},\,\widehat{(b',c')}}.P(b,c)​,(b′,c′)​​.

This includes N=0N=0N=0, when the resulting matrix on Boolean values is I2I_2I2​ for k=1k=1k=1 and zero for every other kkk.

QAlgorithms.Papers.Independent.Intake100.P67.transformed

For any natural numbers N,NAN,N_AN,NA​, any complex matrix OOO from the space indexed by NNN-bit Boolean strings to that indexed by NAN_ANA​-bit Boolean strings, and any complex square matrix MMM indexed by pairs consisting of an NAN_ANA​-bit Boolean string and a Boolean, this declaration defines the matrix indexed by pairs consisting of an NNN-bit Boolean string and a Boolean as

M~O=(O†⊗I2) M (O⊗I2).\widetilde M_O=(O^\dagger\otimes I_2)\,M\,(O\otimes I_2).MO​=(O†⊗I2​)M(O⊗I2​).

Here ⊗\otimes⊗ is the Kronecker product and I2I_2I2​ is the identity matrix indexed by Booleans. No normalization, positivity, or unitarity is assumed, and either natural number may be zero.

QAlgorithms.Papers.Independent.Intake100.P67.twoPortEta

For each Boolean value +++, this defines a vector η+\eta_+η+​ in the complex Euclidean space indexed by pairs (a,c)(a,c)(a,c), where a=(a0,a1)a=(a_0,a_1)a=(a0​,a1​) is a two-bit string and ccc is a Boolean value. Writing ∣a0a1c⟩\lvert a_0a_1c\rangle∣a0​a1​c⟩ for the coordinate vector with value 111 at (a,c)(a,c)(a,c) and 000 elsewhere, its two possible values are

ηtrue=3+123∣011⟩+1−323∣101⟩−13∣110⟩,ηfalse=3−123∣010⟩−3+123∣100⟩+13∣001⟩.\eta_{\mathrm{true}} =\frac{\sqrt3+1}{2\sqrt3}\lvert011\rangle +\frac{1-\sqrt3}{2\sqrt3}\lvert101\rangle -\frac1{\sqrt3}\lvert110\rangle, \qquad \eta_{\mathrm{false}} =\frac{\sqrt3-1}{2\sqrt3}\lvert010\rangle -\frac{\sqrt3+1}{2\sqrt3}\lvert100\rangle +\frac1{\sqrt3}\lvert001\rangle.ηtrue​=23​3​+1​∣011⟩+23​1−3​​∣101⟩−3​1​∣110⟩,ηfalse​=23​3​−1​∣010⟩−23​3​+1​∣100⟩+3​1​∣001⟩.

Every coordinate not displayed is zero; all displayed real coefficients are regarded as complex numbers.

QAlgorithms.Papers.Independent.Intake100.P67.twoPortInitialEntropy

This defines the real constant

−110log⁡2 ⁣(110)−910log⁡2 ⁣(310),-\frac1{10}\log_2\!\left(\frac1{10}\right) -\frac9{10}\log_2\!\left(\frac3{10}\right),−101​log2​(101​)−109​log2​(103​),

where log⁡2x=log⁡x/log⁡2\log_2 x=\log x/\log2log2​x=logx/log2.

QAlgorithms.Papers.Independent.Intake100.P67.twoPortMeasurement

For i∈{0,1}i\in\{0,1\}i∈{0,1}, this defines a complex matrix MiM_iMi​ indexed by triples of bits p=(a0,a1,c)p=(a_0,a_1,c)p=(a0​,a1​,c). Let ∣abc⟩\lvert abc\rangle∣abc⟩ denote the coordinate vector at the bit triple (a,b,c)(a,b,c)(a,b,c), and define

e−=3−123∣010⟩−3+123∣100⟩+13∣001⟩,e+=3+123∣011⟩+1−323∣101⟩−13∣110⟩.e_-=\frac{\sqrt3-1}{2\sqrt3}\lvert010\rangle -\frac{\sqrt3+1}{2\sqrt3}\lvert100\rangle +\frac1{\sqrt3}\lvert001\rangle, \qquad e_+=\frac{\sqrt3+1}{2\sqrt3}\lvert011\rangle +\frac{1-\sqrt3}{2\sqrt3}\lvert101\rangle -\frac1{\sqrt3}\lvert110\rangle.e−​=23​3​−1​∣010⟩−23​3​+1​∣100⟩+3​1​∣001⟩,e+​=23​3​+1​∣011⟩+23​1−3​​∣101⟩−3​1​∣110⟩.

With Pp,q=e−(p)e−(q)‾+e+(p)e+(q)‾P_{p,q}=e_-(p)\overline{e_-(q)}+e_+(p)\overline{e_+(q)}Pp,q​=e−​(p)e−​(q)​+e+​(p)e+​(q)​ and τ(a0,a1,c)=(a1,a0,c)\tau(a_0,a_1,c)=(a_1,a_0,c)τ(a0​,a1​,c)=(a1​,a0​,c), the matrix is

(Mi)p,q={Pp,q,i=0,Pτ(p),τ(q),i=1.(M_i)_{p,q}= \begin{cases} P_{p,q},&i=0,\\ P_{\tau(p),\tau(q)},&i=1. \end{cases}(Mi​)p,q​={Pp,q​,Pτ(p),τ(q)​,​i=0,i=1.​

QAlgorithms.Papers.Independent.Intake100.P67.twoPortResidual

For a two-bit string aaa and Boolean values c,tc,tc,t, this defines a complex number R(a,c,t)R(a,c,t)R(a,c,t). Using 0,10,10,1 for false,true, its coordinates are

R(a,c,t)={3−126,(a,c,t)=((0,1),0,1),−3+126,(a,c,t)=((1,0),0,1),16,(a,c,t)=((0,0),1,1),−3+126,(a,c,t)=((0,1),1,0),3−126,(a,c,t)=((1,0),1,0),16,(a,c,t)=((1,1),0,0),0,otherwise.R(a,c,t)= \begin{cases} \dfrac{\sqrt3-1}{2\sqrt6},&(a,c,t)=((0,1),0,1),\\[3pt] -\dfrac{\sqrt3+1}{2\sqrt6},&(a,c,t)=((1,0),0,1),\\[3pt] \dfrac1{\sqrt6},&(a,c,t)=((0,0),1,1),\\[3pt] -\dfrac{\sqrt3+1}{2\sqrt6},&(a,c,t)=((0,1),1,0),\\[3pt] \dfrac{\sqrt3-1}{2\sqrt6},&(a,c,t)=((1,0),1,0),\\[3pt] \dfrac1{\sqrt6},&(a,c,t)=((1,1),0,0),\\[3pt] 0,&\text{otherwise}. \end{cases}R(a,c,t)=⎩⎨⎧​26​3​−1​,−26​3​+1​,6​1​,−26​3​+1​,26​3​−1​,6​1​,0,​(a,c,t)=((0,1),0,1),(a,c,t)=((1,0),0,1),(a,c,t)=((0,0),1,1),(a,c,t)=((0,1),1,0),(a,c,t)=((1,0),1,0),(a,c,t)=((1,1),0,0),otherwise.​

QAlgorithms.Papers.Independent.Intake100.P67.twoPortResidualExpanded

For a two-bit string a=(a0,a1)a=(a_0,a_1)a=(a0​,a1​) and Boolean values c,tc,tc,t, this defines

Rexp(a,c,t)=s(a0,a1)s(c,t)2+1{a=(0,0), c=1, t=1}+1{a=(1,1), c=0, t=0}−p(a0,a1)p(c,t)6,R_{\mathrm{exp}}(a,c,t) =\frac{s(a_0,a_1)s(c,t)}{\sqrt2} +\frac{ \mathbf1_{\{a=(0,0),\,c=1,\,t=1\}} +\mathbf1_{\{a=(1,1),\,c=0,\,t=0\}} -p(a_0,a_1)p(c,t)}{\sqrt6},Rexp​(a,c,t)=2​s(a0​,a1​)s(c,t)​+6​1{a=(0,0),c=1,t=1}​+1{a=(1,1),c=0,t=0}​−p(a0​,a1​)p(c,t)​,

where 1\mathbf11 is 111 when its condition holds and 000 otherwise, and the two functions on Boolean pairs are explicitly

s(u,v)={1/2,(u,v)=(0,1),−1/2,(u,v)=(1,0),0,u=v,p(u,v)={1/2,u≠v,0,u=v.s(u,v)= \begin{cases} 1/\sqrt2,&(u,v)=(0,1),\\ -1/\sqrt2,&(u,v)=(1,0),\\ 0,&u=v, \end{cases} \qquad p(u,v)= \begin{cases} 1/\sqrt2,&u\ne v,\\ 0,&u=v. \end{cases}s(u,v)=⎩⎨⎧​1/2​,−1/2​,0,​(u,v)=(0,1),(u,v)=(1,0),u=v,​p(u,v)={1/2​,0,​u=v,u=v.​

The result and all coefficients are interpreted in C\mathbb CC.

QAlgorithms.Papers.Independent.Intake100.P67.twoPortResource

For arbitrary two-bit Boolean strings a=(a0,a1)a=(a_0,a_1)a=(a0​,a1​) and b=(b0,b1)b=(b_0,b_1)b=(b0​,b1​), this defines the complex amplitude

R(a,b)=110 s(a0,a1)s(b0,b1)+310(1{a=(0,0), b=(1,1)}+1{a=(1,1), b=(0,0)}−p(a0,a1)p(b0,b1)),R(a,b)= \sqrt{\frac1{10}}\,s(a_0,a_1)s(b_0,b_1) +\sqrt{\frac3{10}} \left( \mathbf1_{\{a=(0,0),\,b=(1,1)\}} +\mathbf1_{\{a=(1,1),\,b=(0,0)\}} -p(a_0,a_1)p(b_0,b_1) \right),R(a,b)=101​​s(a0​,a1​)s(b0​,b1​)+103​​(1{a=(0,0),b=(1,1)}​+1{a=(1,1),b=(0,0)}​−p(a0​,a1​)p(b0​,b1​)),

where s(0,1)=1/2s(0,1)=1/\sqrt2s(0,1)=1/2​, s(1,0)=−1/2s(1,0)=-1/\sqrt2s(1,0)=−1/2​, s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0s(0,0)=s(1,1)=0, and p(x,y)=1/2p(x,y)=1/\sqrt2p(x,y)=1/2​ for unequal Booleans and 000 for equal Booleans. Here 000 and 111 denote false and true, all square roots are real square roots embedded into C\mathbb CC, and each indicator equals 111 exactly when its stated condition holds and 000 otherwise.

QAlgorithms.Papers.Independent.Intake100.P67.xAmplitude

For a Boolean value +++ and a two-bit string a=(a0,a1)a=(a_0,a_1)a=(a0​,a1​), this defines the complex number

x+(a)={ε+322,a=(0,1),ε−322,a=(1,0),0,a=(0,0) or (1,1),ε={1,+=true,−1,+=false.x_+(a)= \begin{cases} \dfrac{\varepsilon+\sqrt3}{2\sqrt2},&a=(0,1),\\[4pt] \dfrac{\varepsilon-\sqrt3}{2\sqrt2},&a=(1,0),\\[4pt] 0,&a=(0,0)\text{ or }(1,1), \end{cases} \qquad \varepsilon= \begin{cases} 1,&+=\mathrm{true},\\ -1,&+=\mathrm{false}. \end{cases}x+​(a)=⎩⎨⎧​22​ε+3​​,22​ε−3​​,0,​a=(0,1),a=(1,0),a=(0,0) or (1,1),​ε={1,−1,​+=true,+=false.​

Here and below, 000 and 111 in bit strings mean false and true, respectively.

QAlgorithms.Papers.Independent.Intake100.P67.xiProjector

For every natural number NNN, every index i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1}, and every natural number kkk, this defines a complex matrix on pairs (x,c)(x,c)(x,c) of an NNN-bit string and a Boolean by

Ξi,k((x,c),(z,e))=s(xi,c) s(zi,e)‾ QW(k)(x∣W,z∣W),W={j<N:j≠i},\Xi_{i,k}((x,c),(z,e)) =s(x_i,c)\,\overline{s(z_i,e)}\, Q_W(k)(x|_W,z|_W), \qquad W=\{j<N:j\ne i\},Ξi,k​((x,c),(z,e))=s(xi​,c)s(zi​,e)​QW​(k)(x∣W​,z∣W​),W={j<N:j=i},

where s(false,true)=1/2s(\mathrm{false},\mathrm{true})=1/\sqrt2s(false,true)=1/2​, s(true,false)=−1/2s(\mathrm{true},\mathrm{false})=-1/\sqrt2s(true,false)=−1/2​, and s=0s=0s=0 otherwise. For d=∣W∣d=|W|d=∣W∣, set

JW=d(4−d)4I+12∑a,b∈Wa≠bPab,Pab(u,v)=1{u=v∘(a b)},J_W=\frac{d(4-d)}4I+\frac12\sum_{\substack{a,b\in W\\a\ne b}}P_{ab}, \qquad P_{ab}(u,v)=\mathbf1_{\{u=v\circ(a\,b)\}},JW​=4d(4−d)​I+21​a,b∈Wa=b​∑​Pab​,Pab​(u,v)=1{u=v∘(ab)}​,

with ordered pairs in the sum. The matrix QW(k)Q_W(k)QW​(k) is zero unless k≤dk\le dk≤d and k≡d(mod2)k\equiv d\pmod2k≡d(mod2); otherwise it is the functional calculus of JWJ_WJW​ for the function equal to 111 at k(k+2)/4k(k+2)/4k(k+2)/4 and 000 elsewhere. The supplied index iii requires N>0N>0N>0, but WWW may be empty when N=1N=1N=1.

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

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 30, 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