Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Upper Bounds for the Security of two Distributed-Phase Reference Protocols of Quantum Cryptography (Coherent-One-Way and Differential-Phase-Shift)

Definition
QAlgorithms_Papers_Independent_Intake100_P92

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

prove2quantum

The objects the formalized statements of Upper Bounds for the Security of two Distributed-Phase Reference Protocols of Quantum Cryptography (Coherent-One-Way and Differential-Phase-Shift) (arXiv:0710.4884) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • splitter: PDF p.3: the channel beam splitter; detector loss is not given to Eve.
  • clickWeight: PDF pp.2–3: threshold detection with trusted efficiency and no dark counts.
  • eventWeight: PDF p.2: exactly one selected detector clicks in a two-mode time bin.
  • thresholdEventProbability: PDF pp.2–3: Born probability for the specified threshold-detector event, on full Fock space. Reuse assessment: Unlike the accepted finite classical CQ event sum in Gap48.P11, this is an infinite photon-occupation Born sum with trusted detector efficiency.
  • visibility: PDF p.2: the observed interferometric visibility; used conditionally only when the sum of the port probabilities is positive.
  • ancillaGram: PDF p.3, (1): Gram matrix of a finite list of already weighted vectors. Its nonzero spectrum is that of the sum of their rank-one operators, also when the vectors lie in the infinite- dimensional Fock Hilbert space. Reuse assessment: Unlike Claimed50.P48.gram, this uses the source order <x_i|x_j> and supports arbitrary Hilbert vectors, including full Fock space; MitigationTomography.gram is a real calibration matrix.
  • ensembleEntropyBits: PDF p.3, (1): spectral von Neumann entropy, in bits, of a finite ensemble. The real function has the continuous zero-eigenvalue value 0 log 0 = 0. Reuse assessment: The indexed entropy declarations take operators or classical laws (several in nats), not weighted vectors in an arbitrary Hilbert space. This interface constructs its finite Gram operator in bits.
  • equiprobableEnsemble: Equal mixture, retaining its full ensemble rather than substituting an overlap. Reuse assessment: The indexed average declarations mix matrices or structured ensembles; here a tagged list of Hilbert vectors is scaled by sqrt(1/2).
  • binaryHolevoBits: PDF p.3, (1): binary, equiprobable Holevo information of actual ensembles. Reuse assessment: The indexed chi declarations are a degree-six matrix invariant (Information100.P60) or a reference-output state (Information100.P76), not binary ensemble Holevo information.
  • weightedAncillaTrace: Trace of the positive ensemble operator, including subnormalized ensembles. Reuse assessment: Information100.P19.mass takes a finite bipartite operator, not an ensemble of arbitrary Hilbert vectors.
  • ensembleDensityCoefficients: Actual density-operator coefficients, with no photon-number cutoff. Reuse assessment: Dependency50.P19.Spectrum.density constructs an operator from a finite normalized spectral decomposition; this sum constructs coordinate coefficients from weighted vectors, allowing infinite output indices.
  • HasUnitaryGramSpectrum: Spectral assertion includes multiplicities and zero eigenvalues of the Gram matrix. Reuse assessment: Gap20.P17.HasSpectrum is a characteristic-polynomial predicate with a Fin k eigenvalue list; this predicate records an actual unitary diagonalization with the same arbitrary finite index type.
  • dw: PDF p.3, (2): signed ideal direct/reverse reconciliation expression. A nonnegative operational yield may abort at zero; it is not defined here.
  • dpsPhaseSign: PDF pp.2–3: true is phase minus, false is phase plus. Reuse assessment: Renew46.P14.sign is real-valued and uses true for plus; this complex-valued DPS convention uses true for minus.
  • eveAmplitude: PDF p.3, (3): Eve's retained amplitude, using channel loss only.
  • gammaE: PDF p.3, (3): gamma_E; mu is computed from alpha rather than assumed separately.
  • click: PDF p.2: exact coherent pulse click probability.
  • cowE: PDF p.3, (4): actual pure COW conditional state, including its vacuum factor.
  • dpsE: PDF p.3, (6): actual DPS conditional mixture over its unknown absolute phase.
  • cowBob: PDF p.2: COW Bob state before detection.
  • dpsBob: PDF pp.2–3: the two output modes at one DPS interference time. Each neighbor contributes half its amplitude after the delay interferometer; other times are traced out. This accounts for the source's per-time-slot prefactor.
  • herald: Full diagonal-event partial trace on a Bob–Eve product coefficient array. This definition computes the postselected operator rather than assuming it.
  • cowHerald: PDF p.3: COW detected-bit conditional operator, before dividing by its trace.
  • dpsHerald: PDF p.3: DPS detected-bit operator, averaging the equiprobable absolute signs.
  • cowRate: PDF pp.3–4, (5),(7): BSA signed rate, calculated from constructed Eve ensembles. The same COW function applies to both modifications with Alice's pairings.
  • dpsRate: PDF p.4, (7): DPS BSA rate from its two mixed conditional operators.
  • PulsePair: Occupancy pair: true is a nonempty pulse. Photon-slot false means 10.
  • PairData: PDF pp.5–8: vacuum and photon ancilla data for one repeated disjoint-pair attack.
  • pairDistance: Number of differing pulse occupancies/signs.
  • pulseWeight: PDF p.5: imperfect-modulator photon weight for an empty/occupied input slot.
  • cowOutput: PDF pp.5–6, (9),(17): the three retained Bob sectors, with the source's uncorrected vacuum coefficient. This is a leading-order coefficient array only.
  • CowValid: PDF pp.5–6, (10)–(14),(18): normalized leading-order COW Gram constraints. The Boolean flag enables the additional vacuum-input constraints for COWm1. Every separately monitored nonempty boundary is checked, not an average visibility.
  • keyPair: Source key bit: 0 is mu,0 and 1 is 0,mu.
  • errorSlot: PDF pp.5–6: the four unconstrained error flags, including vacuum input.
  • errorIndex: Distinct labels for those four error vectors.
  • liftVec: Coordinate isometric embedding used to add independent orthogonal flags.
  • flaggedPair: PDF pp.5–6: maximizing orthogonal error flags are constructed in extra coordinates. They are not a hypothesis imposed on every attack.
  • cowA: PDF p.5: Eve's actual Alice-conditioned COW ensemble.
  • cowB: PDF p.5: Eve's Bob-conditioned ensemble, summing over Alice's bit.
  • cowLeak: PDF p.6, (15): source expression evaluated on the actual correct-state overlap.
  • cowCoefficient: PDF p.6, (16): first-order COW coefficient, computed from flagged ensembles.
  • crossCow: PDF pp.6–7, (19)–(25): crossing-pair conditional ensemble. The source relation j_prime = 1-k = a is built into both copies; the outer bits j,k_prime are averaged.
  • crossCowB: PDF p.7, (23): the Bob marginal sums over a, with b held fixed.
  • crossCorrect: PDF p.7, (24),(25): correct crossing states rho_4^(a,a).
  • cowm1Info: PDF p.7, (42 analogue): the public alignment flag is retained by Eve.
  • cowm1Leak: PDF p.7, (26): same-pair pure-state information plus crossing-pair Holevo.
  • OneData: PDF p.7, (28): a repeated one-pulse ancilla assignment.
  • CowOneValid: PDF p.7, (29),(30): all one-pulse COWm2 Gram constraints.
  • flaggedOne: PDF p.7: construct the free p_0 as an orthogonal error flag.
  • oneToPair: PDF p.8, (31): product vectors for the two key pulses, from the same 1PA.
  • DpsValid: PDF p.8, (34)–(39): all DPS 2PA vacuum/photon norms and monitored Gram data. Here pulse-pair Booleans label signs, not occupancies.
  • dpsOutput: PDF p.8, (34): normalized-ancilla, first-order Bob-sector array only.
  • dps2Psi: PDF p.9, Case 1: unnormalized interferometer ancilla vector.
  • dps4Psi: PDF p.9, Case 2: crossing interference uses slots two and three.
  • dps2Joint: PDF p.9: joint conditional block for Alice a, Bob b, same attacked pair.
  • dps2A: PDF p.9: same-pair Alice marginal, retaining the factor 1/8.
  • dps2B: PDF p.9: same-pair Bob marginal.
  • dps4Joint: PDF p.9: crossing-pair joint block with the factor 1/32.
  • dps4A: PDF p.9: crossing Alice marginal; bit a is the relative sign of slots 2,3.
  • dps4B: PDF p.9: crossing Bob marginal.
  • dpsInfo: PDF p.9, (42): Eve keeps the public same-pair/crossing-pair alignment flag.
  • bobPairLaw: PDF pp.9,12: balanced independent companion choice after a click. This is exactly the source's one-half acceptance model, not an arbitrary schedule.
  • zLaw: Appendix A p.11: actual Z-channel joint law, q = nonempty fraction, x = click probability conditional on a nonempty pulse.
  • zInfo: Appendix A p.11: ideal mutual information from the actual channel law.
  • zCoefficient: Appendix A p.11: coefficient of the small-click-probability information.
  • idealSiftingCoefficient: Appendix A pp.11–12: original COW, COWm1, COWm2, random consecutive pairing, and Bob pairing, in that order. Nonempty fraction is one half; the last two choices accept only mixed pairs.
  • idealBitLaw: Ideal sifted uniform bits are perfectly correlated; no security is asserted.
  • announcedLaw: Appendix A p.11: joint on/off law restricted to announced slots. Every click is kept, and the same fraction of no-click slots is selected independently of Alice's input. f0 is the unconditional selected no-click fraction.
  • rvec: Real coordinate vector, used only for the paper's explicit appendix families.
  • basis: Coordinate basis vector; added flag dimensions are kept separate.
  • cowMinimum: Appendix B p.13, (B8): positive-regime correct-state overlap.
  • cowPositive: Appendix B pp.12–13, (B4),(B5),(B8),(B9): explicit minimizing key vectors and decoy completion. Error vectors will be added by flaggedPair.
  • cowZero: Appendix B p.13: a feasible zero-overlap construction, including V=0 and V=1/2. The printed illustrative angle quotient is not used. The low-V branch uses extra orthogonal residuals. The high-V branch solves the overlap equation for its actual cosine; its denominator is positive in that branch. Decoy photon residuals are independent of the key-vector residuals.
  • cowm1Family: Appendix C p.14, (C2)–(C10): the displayed four-dimensional participating vectors. The four unconstrained error states live in separately added dimensions. The printed parenthetical identifying decoy photon vectors as orthogonal error flags is corrected to the vacuum-input vectors specified in Section IV B.
  • cowm2Minimum: Appendix D pp.14–15: minimum single-pulse overlap, including the zero regime.
  • cowm2Optimum: Appendix D p.15, (D3),(D4): piecewise witness without singular endpoint angle quotients. p_0 is a fourth, independent coordinate outside the three participating vectors. The V=0 branch is treated before the cosine quotient.
  • DpsOneValid: Appendix E p.16, (E1)–(E3): normalized leading-order DPS one-pulse data. All sign-conditioned visibilities are checked separately.
  • dps1Psi: Appendix E p.16: actual product ancilla after the DPS interferometer.
  • dps1Joint: Appendix E p.16: subnormalized block rho^(a,b), with the source's factor 1/8.
  • dps1A: Appendix E p.16: Alice marginal, summing Bob's outcome.
  • dps1B: Appendix E p.16: Bob marginal, correctly summing Alice's bit a. Printed: a sum over b while b remains free. Changed: sum over a, as required by conditional marginalization and the matching construction on p.9.
  • dpsOneFamily: Appendix E pp.16–17, (E5)–(E8): the complete six-parameter family. The half-angle phases and the relative minus sign in w_minus are retained.
  • oneFamilyVectors: All four one-pulse vectors, with a common photon phase gauge.
  • SameSpanGeometry: Equality of finite vector geometry, explicitly witnessed by an isometry of their spans. This preserves every constructed conditional operator spectrum.
  • dpsRestrictedVacuum: Appendix E p.17, (E11): exact symmetric vacuum vectors, embedded in six real coordinates. The third/fourth coordinates are sqrt((1-gamma^2)/2).
  • dpsRestricted: Appendix E p.17, (E13),(E14): actual photon vectors are constructed from unit auxiliary data; their normalization and visibility are conclusions below.
  • cowIdealLeak: Section IV E p.9: the long-distance COW BSA information.
  • dpsIdealLeak: Section IV E p.9 and Appendix E pp.17–18: long-distance DPS BSA information.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Information
import Definitions.Def_QAlgorithms_Defs_QuantumInformation
import Definitions.Def_QAlgorithms_Papers_Independent_Frontier18_P14
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P21
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P75

/-!
Branciard–Gisin–Scarani, arXiv:0710.4884v2. Exact BSA results use full Fock
states. Noisy attacks below are normalized ancilla Gram models at leading
order only; they are not asserted to be finite-loss isometries. Rates are signed
Devetak–Winter expressions per emitted time slot, with ideal error correction,
balanced key bits, trusted detectors, no dark counts/dead times, negligible
unused/decoy fraction, and the apparatus prefactors omitted by the paper.
The finite-ensemble Gram entropy is the von Neumann entropy of the actual
finite-rank ensemble operator; it uses every vector and its weight.
-/

noncomputable section

open scoped Matrix ComplexConjugate
open Filter

namespace QAlgorithms.Papers.Independent.Intake100.P92

open QAlgorithms.Papers.Independent.Information100.P21 (Vec tensor)
open QAlgorithms.Papers.Independent.Information100.P75 (phase)

namespace Optics

open QAlgorithms.Papers.Independent.Frontier18.P14

/-- PDF p.3: the channel beam splitter; detector loss is not given to Eve. -/
def splitter (t : ℝ) : Matrix (Fin 2) (Fin 2) ℂ :=
  !![(Real.sqrt t : ℂ), -(Real.sqrt (1-t) : ℂ);
     (Real.sqrt (1-t) : ℂ), (Real.sqrt t : ℂ)]

/-- PDF pp.2–3: threshold detection with trusted efficiency and no dark counts. -/
def clickWeight (eta : ℝ) (n : ℕ) : ℝ := 1 - (1-eta)^n

/-- PDF p.2: exactly one selected detector clicks in a two-mode time bin. -/
def eventWeight (eta : ℝ) (b : Bool) (n : ℕ × ℕ) : ℝ :=
  if b then (1-eta)^n.1 * clickWeight eta n.2
  else clickWeight eta n.1 * (1-eta)^n.2

/-- PDF pp.2–3: Born probability for the specified threshold-detector event, on full Fock space.

Reuse assessment: Unlike the accepted finite classical CQ event sum in Gap48.P11, this is an
infinite photon-occupation Born sum with trusted detector efficiency.
-/
def thresholdEventProbability (eta : ℝ) (b : Bool) (psi : Fock) : ℝ :=
  ∑' n : ℕ × ℕ, eventWeight eta b n * Complex.normSq (psi n)

/-- PDF p.2: the observed interferometric visibility; used conditionally only
when the sum of the port probabilities is positive. -/
def visibility (eta : ℝ) (psi : Fock) : ℝ :=
  (thresholdEventProbability eta false psi - thresholdEventProbability eta true psi) /
    (thresholdEventProbability eta false psi + thresholdEventProbability eta true psi)

example (eta : ℝ) : clickWeight eta 0 = 0 := by simp [clickWeight]

end Optics

open QAlgorithms.Papers.Independent.Frontier18.P14
  (Fock coherentPair coherentPairCoefficients passiveApply passiveCoefficients
   fockReducedFirst reducedSecond coherentCoefficient)

/-- PDF p.3, (1): Gram matrix of a finite list of already weighted vectors. Its nonzero spectrum is
that of the sum of their rank-one operators, also when the vectors lie in the infinite-
dimensional Fock Hilbert space.

Reuse assessment: Unlike Claimed50.P48.gram, this uses the source order <x_i|x_j> and supports
arbitrary Hilbert vectors, including full Fock space; MitigationTomography.gram is a real
calibration matrix.
-/
def ancillaGram {I H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] (x : I → H) : Matrix I I ℂ :=
  fun i j => inner ℂ (x i) (x j)

/-- PDF p.3, (1): spectral von Neumann entropy, in bits, of a finite ensemble. The real function has
the continuous zero-eigenvalue value 0 log 0 = 0.

Reuse assessment: The indexed entropy declarations take operators or classical laws (several in
nats), not weighted vectors in an arbitrary Hilbert space. This interface constructs its finite
Gram operator in bits.
-/
def ensembleEntropyBits {I H : Type*} [Fintype I] [DecidableEq I]
    [NormedAddCommGroup H] [InnerProductSpace ℂ H] (x : I → H) : ℝ :=
  (Matrix.trace (cfc (fun z : ℝ => -z * Real.log z / Real.log 2) (ancillaGram x))).re

/-- Equal mixture, retaining its full ensemble rather than substituting an overlap.

Reuse assessment: The indexed average declarations mix matrices or structured ensembles; here a
tagged list of Hilbert vectors is scaled by sqrt(1/2).
-/
def equiprobableEnsemble {I H : Type*} [SMul ℂ H] (x y : I → H) : Bool × I → H :=
  fun z => (Real.sqrt (1/2) : ℂ) • (if z.1 then y z.2 else x z.2)

/-- PDF p.3, (1): binary, equiprobable Holevo information of actual ensembles.

Reuse assessment: The indexed chi declarations are a degree-six matrix invariant
(Information100.P60) or a reference-output state (Information100.P76), not binary ensemble
Holevo information.
-/
def binaryHolevoBits {I H : Type*} [Fintype I] [DecidableEq I]
    [NormedAddCommGroup H] [InnerProductSpace ℂ H] (x y : I → H) : ℝ :=
  ensembleEntropyBits (equiprobableEnsemble x y) - ensembleEntropyBits x / 2 - ensembleEntropyBits y / 2

/-- Trace of the positive ensemble operator, including subnormalized ensembles.

Reuse assessment: Information100.P19.mass takes a finite bipartite operator, not an ensemble of
arbitrary Hilbert vectors.
-/
def weightedAncillaTrace {I H : Type*} [Fintype I] [NormedAddCommGroup H] (x : I → H) : ℝ :=
  ∑ i, ‖x i‖^2

/-- Actual density-operator coefficients, with no photon-number cutoff.

Reuse assessment: Dependency50.P19.Spectrum.density constructs an operator from a finite
normalized spectral decomposition; this sum constructs coordinate coefficients from weighted
vectors, allowing infinite output indices.
-/
def ensembleDensityCoefficients {I J : Type*} [Fintype I] (x : I → J → ℂ) : Matrix J J ℂ :=
  fun j k => ∑ i, x i j * star (x i k)

/-- Spectral assertion includes multiplicities and zero eigenvalues of the Gram matrix.

Reuse assessment: Gap20.P17.HasSpectrum is a characteristic-polynomial predicate with a Fin k
eigenvalue list; this predicate records an actual unitary diagonalization with the same
arbitrary finite index type.
-/
def HasUnitaryGramSpectrum {I : Type*} [Fintype I] [DecidableEq I]
    (G : Matrix I I ℂ) (e : I → ℝ) : Prop :=
  ∃ U : Matrix I I ℂ, U ∈ Matrix.unitaryGroup I ℂ ∧
    G = U * Matrix.diagonal (fun i => (e i : ℂ)) * U.conjTranspose

/-- PDF p.3, (2): signed ideal direct/reverse reconciliation expression.
A nonnegative operational yield may abort at zero; it is not defined here. -/
def dw (sift Q chiA chiB : ℝ) : ℝ :=
  sift * (1 - QAlgorithms.binEntropy2 Q - min chiA chiB)

/-- PDF pp.2–3: true is phase minus, false is phase plus.

Reuse assessment: Renew46.P14.sign is real-valued and uses true for plus; this complex-valued
DPS convention uses true for minus.
-/
def dpsPhaseSign (b : Bool) : ℂ := if b then -1 else 1

/-- PDF p.3, (3): Eve's retained amplitude, using channel loss only. -/
def eveAmplitude (alpha : ℂ) (t : ℝ) : ℂ := (Real.sqrt (1-t) : ℂ) * alpha

/-- PDF p.3, (3): gamma_E; mu is computed from alpha rather than assumed separately. -/
def gammaE (alpha : ℂ) (t : ℝ) : ℝ := Real.exp (-Complex.normSq alpha * (1-t))

/-- PDF p.2: exact coherent pulse click probability. -/
def click (mu t eta : ℝ) : ℝ := 1 - Real.exp (-mu*t*eta)

/-- PDF p.3, (4): actual pure COW conditional state, including its vacuum factor. -/
def cowE (alpha : ℂ) (t : ℝ) (a : Bool) : Unit → Fock :=
  fun _ => if a then coherentPair 0 (eveAmplitude alpha t)
    else coherentPair (eveAmplitude alpha t) 0

/-- PDF p.3, (6): actual DPS conditional mixture over its unknown absolute phase. -/
def dpsE (alpha : ℂ) (t : ℝ) (a : Bool) : Bool → Fock :=
  fun s => (Real.sqrt (1/2) : ℂ) •
    coherentPair (dpsPhaseSign s * eveAmplitude alpha t)
      (dpsPhaseSign (Bool.xor s a) * eveAmplitude alpha t)

/-- PDF p.2: COW Bob state before detection. -/
def cowBob (alpha : ℂ) (t : ℝ) (a : Bool) : Fock :=
  if a then coherentPair 0 ((Real.sqrt t : ℂ)*alpha)
  else coherentPair ((Real.sqrt t : ℂ)*alpha) 0

/-- PDF pp.2–3: the two output modes at one DPS interference time. Each
neighbor contributes half its amplitude after the delay interferometer; other
times are traced out. This accounts for the source's per-time-slot prefactor. -/
def dpsBob (alpha : ℂ) (t : ℝ) (s a : Bool) : Fock :=
  let u := dpsPhaseSign s * (Real.sqrt t : ℂ) * alpha
  let v := dpsPhaseSign (Bool.xor s a) * (Real.sqrt t : ℂ) * alpha
  coherentPair ((u+v)/2) ((u-v)/2)

/-- Full diagonal-event partial trace on a Bob–Eve product coefficient array.
This definition computes the postselected operator rather than assuming it. -/
def herald (eta : ℝ) (b : Bool) (bob eve : Fock) :
    Matrix (ℕ × ℕ) (ℕ × ℕ) ℂ :=
  fun i j => ∑' n : ℕ × ℕ,
    (Optics.eventWeight eta b n : ℂ) * (bob n * eve i) * star (bob n * eve j)

/-- PDF p.3: COW detected-bit conditional operator, before dividing by its trace. -/
def cowHerald (alpha : ℂ) (t eta : ℝ) (a b : Bool) :=
  herald eta b (cowBob alpha t a) (cowE alpha t a ())

/-- PDF p.3: DPS detected-bit operator, averaging the equiprobable absolute signs. -/
def dpsHerald (alpha : ℂ) (t eta : ℝ) (a b : Bool) :
    Matrix (ℕ × ℕ) (ℕ × ℕ) ℂ :=
  (1/2 : ℂ) • ∑ s : Bool,
    herald eta b (dpsBob alpha t s a)
      (coherentPair (dpsPhaseSign s * eveAmplitude alpha t)
        (dpsPhaseSign (Bool.xor s a) * eveAmplitude alpha t))

/-- PDF pp.3–4, (5),(7): BSA signed rate, calculated from constructed Eve ensembles.
The same COW function applies to both modifications with Alice's pairings. -/
def cowRate (alpha : ℂ) (t eta : ℝ) : ℝ :=
  dw (click (Complex.normSq alpha) t eta / 2) 0
    (binaryHolevoBits (cowE alpha t false) (cowE alpha t true))
    (binaryHolevoBits (cowE alpha t false) (cowE alpha t true))

/-- PDF p.4, (7): DPS BSA rate from its two mixed conditional operators. -/
def dpsRate (alpha : ℂ) (t eta : ℝ) : ℝ :=
  dw (click (Complex.normSq alpha) t eta) 0
    (binaryHolevoBits (dpsE alpha t false) (dpsE alpha t true))
    (binaryHolevoBits (dpsE alpha t false) (dpsE alpha t true))

example (alpha : ℂ) (t : ℝ) : cowE alpha t false () =
    coherentPair (eveAmplitude alpha t) 0 := rfl

/-- Occupancy pair: true is a nonempty pulse. Photon-slot false means 10. -/
abbrev PulsePair := Bool × Bool

/-- PDF pp.5–8: vacuum and photon ancilla data for one repeated disjoint-pair attack. -/
structure PairData (I : Type*) where
  v : PulsePair → Vec I
  p : PulsePair → Bool → Vec I

/-- Number of differing pulse occupancies/signs. -/
def pairDistance (x y : PulsePair) : ℕ :=
  (if x.1 = y.1 then 0 else 1) + (if x.2 = y.2 then 0 else 1)

/-- PDF p.5: imperfect-modulator photon weight for an empty/occupied input slot. -/
def pulseWeight (Q : ℝ) (occupied : Bool) : ℝ := if occupied then 1-Q else Q

/-- PDF pp.5–6, (9),(17): the three retained Bob sectors, with the source's
uncorrected vacuum coefficient. This is a leading-order coefficient array only. -/
def cowOutput {I : Type*} (A : PairData I) (mu t Q : ℝ) (x : PulsePair) :
    Fin 3 → I → ℂ :=
  fun k i => if k = 0 then A.v x i else if k = 1 then
    (Real.sqrt (pulseWeight Q x.1 * mu*t) : ℂ) * A.p x false i else
    (Real.sqrt (pulseWeight Q x.2 * mu*t) : ℂ) * A.p x true i

/-- PDF pp.5–6, (10)–(14),(18): normalized leading-order COW Gram constraints.
The Boolean flag enables the additional vacuum-input constraints for COWm1.
Every separately monitored nonempty boundary is checked, not an average visibility. -/
def CowValid {I : Type*} [Fintype I] (A : PairData I) (mu V : ℝ)
    (modified : Bool) : Prop :=
  (∀ x, ‖A.v x‖ = 1) ∧ (∀ x b, ‖A.p x b‖ = 1) ∧
  (∀ x y, (modified = true ∨ (x ≠ (false,false) ∧ y ≠ (false,false))) →
    inner ℂ (A.v x) (A.v y) = (Real.exp (-mu*(pairDistance x y : ℝ)/2) : ℂ)) ∧
  (inner ℂ (A.p (true,true) true) (A.p (true,true) false)).re = V ∧
  (∀ (l r : Bool),
    (inner ℂ (A.v (l,true)) (A.p (l,true) true) *
      inner ℂ (A.p (true,r) false) (A.v (true,r))).re = V)

/-- Source key bit: 0 is mu,0 and 1 is 0,mu. -/
def keyPair (a : Bool) : PulsePair := (!a,a)

/-- PDF pp.5–6: the four unconstrained error flags, including vacuum input. -/
def errorSlot (x : PulsePair) (b : Bool) : Bool := !(if b then x.2 else x.1)

/-- Distinct labels for those four error vectors. -/
def errorIndex (x : PulsePair) (b : Bool) : Fin 4 :=
  if x = (false,false) then (if b then 1 else 0) else if x.1 then 2 else 3

/-- Coordinate isometric embedding used to add independent orthogonal flags. -/
def liftVec {I : Type*} (v : Vec I) : Vec (Sum I (Fin 4)) :=
  WithLp.toLp 2 (Sum.elim (fun i => v i) (fun _ => 0))

/-- PDF pp.5–6: maximizing orthogonal error flags are constructed in extra
coordinates. They are not a hypothesis imposed on every attack. -/
def flaggedPair {I : Type*} (A : PairData I) : PairData (Sum I (Fin 4)) where
  v := fun x => liftVec (A.v x)
  p := fun x b => if errorSlot x b then
    WithLp.toLp 2 (Sum.elim (fun _ => 0) (fun j => if j = errorIndex x b then 1 else 0))
    else liftVec (A.p x b)

/-- PDF p.5: Eve's actual Alice-conditioned COW ensemble. -/
def cowA {I : Type*} (A : PairData I) (Q : ℝ) (a : Bool) : Bool → Vec I :=
  fun b => (Real.sqrt (if a = b then 1-Q else Q) : ℂ) • A.p (keyPair a) b

/-- PDF p.5: Eve's Bob-conditioned ensemble, summing over Alice's bit. -/
def cowB {I : Type*} (A : PairData I) (Q : ℝ) (b : Bool) : Bool → Vec I :=
  fun a => (Real.sqrt (if a = b then 1-Q else Q) : ℂ) • A.p (keyPair a) b

/-- PDF p.6, (15): source expression evaluated on the actual correct-state overlap. -/
def cowLeak {I : Type*} [Fintype I] (A : PairData I) (Q : ℝ) : ℝ :=
  Q + (1-Q)*QAlgorithms.binEntropy2
    ((1+‖inner ℂ (A.p (true,false) false) (A.p (false,true) true)‖)/2)

/-- PDF p.6, (16): first-order COW coefficient, computed from flagged ensembles. -/
def cowCoefficient {I : Type*} [Fintype I] [DecidableEq I]
    (A : PairData I) (mu Q : ℝ) : ℝ :=
  dw (mu/2) Q (binaryHolevoBits (cowA (flaggedPair A) Q false) (cowA (flaggedPair A) Q true))
    (binaryHolevoBits (cowB (flaggedPair A) Q false) (cowB (flaggedPair A) Q true))

/-- PDF pp.6–7, (19)–(25): crossing-pair conditional ensemble. The source relation
j_prime = 1-k = a is built into both copies; the outer bits j,k_prime are averaged. -/
def crossCow {I : Type*} (A : PairData I) (Q : ℝ) (a : Bool) :
    Bool × Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt ((if a = z.2.2 then 1-Q else Q)/4) : ℂ) •
    (if z.2.2 then tensor (A.v (z.1,!a)) (A.p (a,z.2.1) false)
      else tensor (A.p (z.1,!a) true) (A.v (a,z.2.1)))

/-- PDF p.7, (23): the Bob marginal sums over a, with b held fixed. -/
def crossCowB {I : Type*} (A : PairData I) (Q : ℝ) (b : Bool) :
    Bool × Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt ((if z.2.2 = b then 1-Q else Q)/4) : ℂ) •
    (if b then tensor (A.v (z.1,!z.2.2)) (A.p (z.2.2,z.2.1) false)
      else tensor (A.p (z.1,!z.2.2) true) (A.v (z.2.2,z.2.1)))

/-- PDF p.7, (24),(25): correct crossing states rho_4^(a,a). -/
def crossCorrect {I : Type*} (A : PairData I) (a : Bool) : Bool × Bool → Vec (I × I) :=
  fun z => (1/2 : ℂ) •
    (if a then tensor (A.v (z.1,false)) (A.p (true,z.2) false)
      else tensor (A.p (z.1,true) true) (A.v (false,z.2)))

/-- PDF p.7, (42 analogue): the public alignment flag is retained by Eve. -/
def cowm1Info {I : Type*} [Fintype I] [DecidableEq I]
    (A : PairData I) (Q : ℝ) (bob : Bool) : ℝ :=
  if bob then (binaryHolevoBits (cowB A Q false) (cowB A Q true) +
    binaryHolevoBits (crossCowB A Q false) (crossCowB A Q true))/2
  else (binaryHolevoBits (cowA A Q false) (cowA A Q true) +
    binaryHolevoBits (crossCow A Q false) (crossCow A Q true))/2

/-- PDF p.7, (26): same-pair pure-state information plus crossing-pair Holevo. -/
def cowm1Leak {I : Type*} [Fintype I] [DecidableEq I]
    (A : PairData I) (Q : ℝ) : ℝ :=
  Q + (1-Q)/2 * (QAlgorithms.binEntropy2
    ((1+‖inner ℂ (A.p (true,false) false) (A.p (false,true) true)‖)/2) +
      binaryHolevoBits (crossCorrect A false) (crossCorrect A true))

/-- PDF p.7, (28): a repeated one-pulse ancilla assignment. -/
structure OneData (I : Type*) where
  v : Bool → Vec I
  p : Bool → Vec I

/-- PDF p.7, (29),(30): all one-pulse COWm2 Gram constraints. -/
def CowOneValid {I : Type*} [Fintype I] (A : OneData I) (mu V : ℝ) : Prop :=
  (∀ b, ‖A.v b‖ = 1 ∧ ‖A.p b‖ = 1) ∧
  inner ℂ (A.v false) (A.v true) = (Real.exp (-mu/2) : ℂ) ∧
  Complex.normSq (inner ℂ (A.v true) (A.p true)) = V

/-- PDF p.7: construct the free p_0 as an orthogonal error flag. -/
def flaggedOne {I : Type*} (A : OneData I) : OneData (Sum I (Fin 4)) where
  v := fun b => liftVec (A.v b)
  p := fun b => if b then liftVec (A.p true) else
    WithLp.toLp 2 (Sum.elim (fun _ => 0) (fun j => if j = 0 then 1 else 0))

/-- PDF p.8, (31): product vectors for the two key pulses, from the same 1PA. -/
def oneToPair {I : Type*} (A : OneData I) : PairData (I × I) where
  v := fun x => tensor (A.v x.1) (A.v x.2)
  p := fun x b => if b then tensor (A.v x.1) (A.p x.2)
    else tensor (A.p x.1) (A.v x.2)

/-- PDF p.8, (34)–(39): all DPS 2PA vacuum/photon norms and monitored Gram data.
Here pulse-pair Booleans label signs, not occupancies. -/
def DpsValid {I : Type*} [Fintype I] (A : PairData I) (mu V : ℝ) : Prop :=
  (∀ x, ‖A.v x‖ = 1) ∧ (∀ x b, ‖A.p x b‖ = 1) ∧
  (∀ x y, inner ℂ (A.v x) (A.v y) =
    (Real.exp (-2*mu*(pairDistance x y : ℝ)) : ℂ)) ∧
  (∀ x, (inner ℂ (A.p x true) (A.p x false)).re = V) ∧
  (∀ x y, (inner ℂ (A.v x) (A.p x true) *
    inner ℂ (A.p y false) (A.v y)).re = V)

/-- PDF p.8, (34): normalized-ancilla, first-order Bob-sector array only. -/
def dpsOutput {I : Type*} (A : PairData I) (mu t : ℝ) (x : PulsePair) :
    Fin 3 → I → ℂ :=
  fun k i => if k = 0 then A.v x i else if k = 1 then
    dpsPhaseSign x.1 * (Real.sqrt (mu*t) : ℂ) * A.p x false i else
    dpsPhaseSign x.2 * (Real.sqrt (mu*t) : ℂ) * A.p x true i

/-- PDF p.9, Case 1: unnormalized interferometer ancilla vector. -/
def dps2Psi {I : Type*} (A : PairData I) (s w b : Bool) : Vec I :=
  dpsPhaseSign s • A.p (s,w) false + (dpsPhaseSign b * dpsPhaseSign w) • A.p (s,w) true

/-- PDF p.9, Case 2: crossing interference uses slots two and three. -/
def dps4Psi {I : Type*} (A : PairData I) (s w u v b : Bool) : Vec (I × I) :=
  dpsPhaseSign w • tensor (A.p (s,w) true) (A.v (u,v)) +
    (dpsPhaseSign b * dpsPhaseSign u) • tensor (A.v (s,w)) (A.p (u,v) false)

/-- PDF p.9: joint conditional block for Alice a, Bob b, same attacked pair. -/
def dps2Joint {I : Type*} (A : PairData I) (a b : Bool) : Bool → Vec I :=
  fun s => (Real.sqrt (1/8) : ℂ) • dps2Psi A s (Bool.xor s a) b

/-- PDF p.9: same-pair Alice marginal, retaining the factor 1/8. -/
def dps2A {I : Type*} (A : PairData I) (a : Bool) : Bool × Bool → Vec I :=
  fun z => (Real.sqrt (1/8) : ℂ) • dps2Psi A z.1 (Bool.xor z.1 a) z.2

/-- PDF p.9: same-pair Bob marginal. -/
def dps2B {I : Type*} (A : PairData I) (b : Bool) : Bool × Bool → Vec I :=
  fun z => (Real.sqrt (1/8) : ℂ) • dps2Psi A z.1 z.2 b

/-- PDF p.9: crossing-pair joint block with the factor 1/32. -/
def dps4Joint {I : Type*} (A : PairData I) (a b : Bool) :
    Bool × Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt (1/32) : ℂ) •
    dps4Psi A z.1 z.2.1 (Bool.xor z.2.1 a) z.2.2 b

/-- PDF p.9: crossing Alice marginal; bit a is the relative sign of slots 2,3. -/
def dps4A {I : Type*} (A : PairData I) (a : Bool) :
    Bool × Bool × Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt (1/32) : ℂ) •
    dps4Psi A z.1 z.2.1 (Bool.xor z.2.1 a) z.2.2.1 z.2.2.2

/-- PDF p.9: crossing Bob marginal. -/
def dps4B {I : Type*} (A : PairData I) (b : Bool) :
    Bool × Bool × Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt (1/32) : ℂ) • dps4Psi A z.1 z.2.1 z.2.2.1 z.2.2.2 b

/-- PDF p.9, (42): Eve keeps the public same-pair/crossing-pair alignment flag. -/
def dpsInfo {I : Type*} [Fintype I] [DecidableEq I]
    (A : PairData I) (bob : Bool) : ℝ :=
  if bob then (binaryHolevoBits (dps2B A false) (dps2B A true) +
    binaryHolevoBits (dps4B A false) (dps4B A true))/2
  else (binaryHolevoBits (dps2A A false) (dps2A A true) +
    binaryHolevoBits (dps4A A false) (dps4A A true))/2

/-- PDF pp.9,12: balanced independent companion choice after a click. This is
exactly the source's one-half acceptance model, not an arbitrary schedule. -/
def bobPairLaw (P : Bool × Bool → ℝ) : (Bool × Bool) × Bool → ℝ :=
  fun z => P z.1 / 2

/-- Appendix A p.11: actual Z-channel joint law, q = nonempty fraction,
x = click probability conditional on a nonempty pulse. -/
def zLaw (q x : ℝ) : Bool × Bool → ℝ :=
  fun ab => if ab.1 then q*(if ab.2 then x else 1-x)
    else if ab.2 then 0 else 1-q

/-- Appendix A p.11: ideal mutual information from the actual channel law. -/
def zInfo (q x : ℝ) : ℝ := QAlgorithms.mutualInfoBits (zLaw q x)

/-- Appendix A p.11: coefficient of the small-click-probability information. -/
def zCoefficient (q : ℝ) : ℝ := -q*Real.log q / Real.log 2

/-- Appendix A pp.11–12: original COW, COWm1, COWm2, random consecutive
pairing, and Bob pairing, in that order. Nonempty fraction is one half; the
last two choices accept only mixed pairs. -/
def idealSiftingCoefficient (scheme : Fin 5) (mu : ℝ) : ℝ :=
  if scheme.val < 3 then mu/2 else
    mu/2 * (∑ x : Bool × Bool, if x.1 ≠ x.2 then (1/4:ℝ) else 0)

/-- Ideal sifted uniform bits are perfectly correlated; no security is asserted. -/
def idealBitLaw : Bool × Bool → ℝ := fun ab => if ab.1 = ab.2 then 1/2 else 0

/-- Appendix A p.11: joint on/off law restricted to announced slots. Every
click is kept, and the same fraction of no-click slots is selected independently
of Alice's input. f0 is the unconditional selected no-click fraction. -/
def announcedLaw (q x f0 : ℝ) : Bool × Bool → ℝ :=
  fun ab => zLaw q x ab * (if ab.2 then 1 else f0/(1-q*x))

example : keyPair false = (true,false) := rfl

example : errorIndex (false,false) true = 1 := rfl

/-- Real coordinate vector, used only for the paper's explicit appendix families. -/
def rvec {n : ℕ} (x : Fin n → ℝ) : Vec (Fin n) :=
  WithLp.toLp 2 (fun i => (x i : ℂ))

/-- Coordinate basis vector; added flag dimensions are kept separate. -/
def basis {n : ℕ} (i : Fin n) : Vec (Fin n) :=
  WithLp.toLp 2 (fun j => if j = i then 1 else 0)

/-- Appendix B p.13, (B8): positive-regime correct-state overlap. -/
def cowMinimum (mu V : ℝ) : ℝ :=
  (2*V-1)*Real.exp (-mu) -
    2*Real.sqrt (V*(1-V))*Real.sqrt (1-(Real.exp (-mu))^2)

/-- Appendix B pp.12–13, (B4),(B5),(B8),(B9): explicit minimizing key
vectors and decoy completion. Error vectors will be added by flaggedPair. -/
def cowPositive (mu V : ℝ) : PairData (Fin 3) :=
  let g := Real.exp (-mu)
  let a := Real.sqrt ((1+g)/2)
  let b := Real.sqrt ((1-g)/2)
  let u := Real.sqrt (2*g/(1+g))
  let z := Real.sqrt ((1-g)/(1+g))
  let c := Real.sqrt (2*V/(1+V))*u + Real.sqrt ((1-V)/(1+V))*z
  let s := Real.sqrt (2*V/(1+V))*z - Real.sqrt ((1-V)/(1+V))*u
  let vac : PulsePair → Vec (Fin 3) := fun x =>
    if x = (true,false) then rvec ![a,b,0]
    else if x = (false,true) then rvec ![a,-b,0]
    else if x = (true,true) then rvec ![u,0,z] else basis 0
  let phot : PulsePair → Bool → Vec (Fin 3) := fun x slot =>
    if x = (true,false) ∧ slot = false then
      (Real.sqrt V : ℂ) • vac x - (Real.sqrt (1-V) : ℂ) • rvec ![b,-a,0]
    else if x = (false,true) ∧ slot = true then
      (Real.sqrt V : ℂ) • vac x - (Real.sqrt (1-V) : ℂ) • rvec ![b,a,0]
    else if x = (true,true) then rvec ![Real.sqrt ((1+V)/2)*c,
      (if slot then -1 else 1)*Real.sqrt ((1-V)/2), Real.sqrt ((1+V)/2)*s]
    else basis 0
  ⟨vac,phot⟩

/-- Appendix B p.13: a feasible zero-overlap construction, including V=0 and
V=1/2. The printed illustrative angle quotient is not used. The low-V branch
uses extra orthogonal residuals. The high-V branch solves the overlap equation
for its actual cosine; its denominator is positive in that branch. Decoy photon
residuals are independent of the key-vector residuals. -/
def cowZero (mu V : ℝ) : PairData (Fin 7) :=
  let g := Real.exp (-mu)
  let a := Real.sqrt ((1+g)/2)
  let b := Real.sqrt ((1-g)/2)
  let vac : PulsePair → Vec (Fin 7) := fun x =>
    if x = (true,false) then rvec ![a,b,0,0,0,0,0]
    else if x = (false,true) then rvec ![a,-b,0,0,0,0,0]
    else if x = (true,true) then
      rvec ![Real.sqrt (2*g/(1+g)),0,0,0,Real.sqrt ((1-g)/(1+g)),0,0]
    else basis 0
  let r := V*g/(1-V)
  let h := Real.sqrt (V*(1-V))*Real.sqrt (1-g^2)
  let c := (V*g-h)/((1-V)*g+h)
  let p0 := if V ≤ 1/2 then
      (Real.sqrt V : ℂ) • vac (true,false) + (Real.sqrt (1-V) : ℂ) • basis 2
    else (Real.sqrt V : ℂ) • vac (true,false) -
      (Real.sqrt (1-V)*c : ℂ) • rvec ![b,-a,0,0,0,0,0] +
      (Real.sqrt (1-V)*Real.sqrt (1-c^2) : ℂ) • basis 2
  let p1 := if V ≤ 1/2 then
      (Real.sqrt V : ℂ) • vac (false,true) +
      (Real.sqrt (1-V) : ℂ) • rvec ![0,0,-r,Real.sqrt (1-r^2),0,0,0]
    else (Real.sqrt V : ℂ) • vac (false,true) -
      (Real.sqrt (1-V) : ℂ) • rvec ![b,a,0,0,0,0,0]
  ⟨vac, fun x slot => if x = (true,false) ∧ slot = false then p0
    else if x = (false,true) ∧ slot = true then p1
    else if x = (true,true) then
      (Real.sqrt V : ℂ) • vac x + (Real.sqrt (1-V) : ℂ) • (if slot then basis 6 else basis 5)
    else basis 0⟩

/-- Appendix C p.14, (C2)–(C10): the displayed four-dimensional participating
vectors. The four unconstrained error states live in separately added dimensions.
The printed parenthetical identifying decoy photon vectors as orthogonal error
flags is corrected to the vacuum-input vectors specified in Section IV B. -/
def cowm1Family (mu V theta0 theta1 phi : ℝ) : PairData (Fin 4) :=
  let g := Real.exp (-mu)
  let a := Real.sqrt ((1+g)/2)
  let b := Real.sqrt ((1-g)/2)
  let u := Real.sqrt (2*g/(1+g))
  let z := Real.sqrt ((1-g)/(1+g))
  let vac : PulsePair → Vec (Fin 4) := fun x =>
    if x = (true,false) then rvec ![a,b,0,0]
    else if x = (false,true) then rvec ![a,-b,0,0]
    else if x = (false,false) then rvec ![u,0,z,0]
    else rvec ![u,0,-g*z,1-g]
  let perp0 := rvec ![b,-a,0,0]
  let perp1 := rvec ![b,a,0,0]
  let perpD1 := rvec ![0,0,Real.sqrt (1-g^2),g]
  let perpD2 := rvec ![z,0,g*u,-Real.sqrt (2*g)*Real.sqrt (1-g)]
  let w : PulsePair → Bool → Vec (Fin 4) := fun x slot =>
    if x = (true,false) then (Real.cos theta0 : ℂ) • perp0 +
      (Real.sin theta0*Real.cos theta1 : ℂ) • basis 2 +
      (Real.sin theta0*Real.sin theta1 : ℂ) • basis 3
    else if x = (false,true) then (Real.cos theta0 : ℂ) • perp1 +
      (Real.sin theta0*Real.cos theta1 : ℂ) • basis 2 +
      (Real.sin theta0*Real.sin theta1 : ℂ) • basis 3
    else (1/Real.sqrt 2 : ℂ) •
      ((Real.cos phi : ℂ) • perpD1 + (Real.sin phi : ℂ) • perpD2) +
      ((if slot then 1 else -1)/Real.sqrt 2 : ℂ) • basis 1
  ⟨vac,fun x slot => if errorSlot x slot then basis 0 else
    (Real.sqrt V : ℂ) • vac x - (Real.sqrt (1-V) : ℂ) • w x slot⟩

/-- Appendix D pp.14–15: minimum single-pulse overlap, including the zero regime. -/
def cowm2Minimum (mu V : ℝ) : ℝ :=
  if Real.exp (-mu) ≤ 1-V then 0 else
    Real.exp (-mu/2)*Real.sqrt V - Real.sqrt (1-Real.exp (-mu))*Real.sqrt (1-V)

/-- Appendix D p.15, (D3),(D4): piecewise witness without singular endpoint
angle quotients. p_0 is a fourth, independent coordinate outside the three
participating vectors. The V=0 branch is treated before the cosine quotient. -/
def cowm2Optimum (mu V : ℝ) : OneData (Fin 4) :=
  let s := Real.exp (-mu)
  let c := if V = 0 then 0 else if s ≤ 1-V then
    Real.sqrt (s*V/((1-s)*(1-V))) else 1
  ⟨(fun b => if b then basis 0 else
      rvec ![Real.exp (-mu/2),Real.sqrt (1-s),0,0]),
   (fun b => if b then rvec ![Real.sqrt V,-Real.sqrt (1-V)*c,
      Real.sqrt (1-V)*Real.sqrt (1-c^2),0] else basis 3)⟩

/-- Appendix E p.16, (E1)–(E3): normalized leading-order DPS one-pulse data.
All sign-conditioned visibilities are checked separately. -/
def DpsOneValid {I : Type*} [Fintype I] (A : OneData I) (mu V : ℝ) : Prop :=
  (∀ s, ‖A.v s‖ = 1 ∧ ‖A.p s‖ = 1) ∧
  inner ℂ (A.v false) (A.v true) = (Real.exp (-2*mu) : ℂ) ∧
  (∀ s w, (inner ℂ (A.v s) (A.p s) * inner ℂ (A.p w) (A.v w)).re = V)

/-- Appendix E p.16: actual product ancilla after the DPS interferometer. -/
def dps1Psi {I : Type*} (A : OneData I) (s w b : Bool) : Vec (I × I) :=
  dpsPhaseSign s • tensor (A.p s) (A.v w) +
    (dpsPhaseSign b*dpsPhaseSign w) • tensor (A.v s) (A.p w)

/-- Appendix E p.16: subnormalized block rho^(a,b), with the source's factor 1/8. -/
def dps1Joint {I : Type*} (A : OneData I) (a b : Bool) : Bool → Vec (I × I) :=
  fun s => (Real.sqrt (1/8) : ℂ) • dps1Psi A s (Bool.xor s a) b

/-- Appendix E p.16: Alice marginal, summing Bob's outcome. -/
def dps1A {I : Type*} (A : OneData I) (a : Bool) : Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt (1/8) : ℂ) • dps1Psi A z.1 (Bool.xor z.1 a) z.2

/-- Appendix E p.16: Bob marginal, correctly summing Alice's bit a.
Printed: a sum over b while b remains free. Changed: sum over a, as required
by conditional marginalization and the matching construction on p.9. -/
def dps1B {I : Type*} (A : OneData I) (b : Bool) : Bool × Bool → Vec (I × I) :=
  fun z => (Real.sqrt (1/8) : ℂ) • dps1Psi A z.1 (Bool.xor z.1 z.2) b

/-- Appendix E pp.16–17, (E5)–(E8): the complete six-parameter family.
The half-angle phases and the relative minus sign in w_minus are retained. -/
def dpsOneFamily (mu V : ℝ) (thetaS phiS : Bool → ℝ) (theta phi : ℝ) :
    OneData (Fin 4) :=
  let g := Real.exp (-2*mu)
  let a := Real.sqrt ((1+g)/2)
  let b := Real.sqrt ((1-g)/2)
  let vac := fun s : Bool => rvec ![a,(if s then -1 else 1)*b,0,0]
  let perp := fun s : Bool => rvec ![b,-(if s then -1 else 1)*a,0,0]
  let w := fun s : Bool => WithLp.toLp 2
    ![(0:ℂ),0,(Real.cos (theta/2) : ℂ)*phase ((if s then -1 else 1)*phi/2),
      dpsPhaseSign s*(Real.sin (theta/2) : ℂ)*phase ((if s then -1 else 1)*phi/2)]
  ⟨vac,fun s => (Real.sqrt V : ℂ) • vac s -
    ((Real.sqrt (1-V)*Real.cos (thetaS s) : ℂ)*phase (phiS s)) • perp s -
    (Real.sqrt (1-V)*Real.sin (thetaS s) : ℂ) • w s⟩

/-- All four one-pulse vectors, with a common photon phase gauge. -/
def oneFamilyVectors {I : Type*} (A : OneData I) (z : ℂ) : Bool × Bool → Vec I :=
  fun x => if x.1 then z • A.p x.2 else A.v x.2

/-- Equality of finite vector geometry, explicitly witnessed by an isometry
of their spans. This preserves every constructed conditional operator spectrum. -/
def SameSpanGeometry {I H K : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H]
    [NormedAddCommGroup K] [InnerProductSpace ℂ K] (x : I → H) (y : I → K) : Prop :=
  ∃ U : Submodule.span ℂ (Set.range x) ≃ₗᵢ[ℂ] Submodule.span ℂ (Set.range y),
    ∀ i, U ⟨x i,Submodule.subset_span (Set.mem_range_self i)⟩ =
      ⟨y i,Submodule.subset_span (Set.mem_range_self i)⟩

/-- Appendix E p.17, (E11): exact symmetric vacuum vectors, embedded in six
real coordinates. The third/fourth coordinates are sqrt((1-gamma^2)/2). -/
def dpsRestrictedVacuum (mu : ℝ) (x : PulsePair) : Vec (Fin 6) :=
  let g := Real.exp (-2*mu)
  let c := Real.sqrt ((1-g^2)/2)
  rvec ![(1+g)/2,(if x.1 = x.2 then 1 else -1)*(1-g)/2,
    (if x.1 = x.2 then (if x.1 then -c else c) else 0),
    (if x.1 = x.2 then 0 else (if x.1 then -c else c)),0,0]

/-- Appendix E p.17, (E13),(E14): actual photon vectors are constructed from
unit auxiliary data; their normalization and visibility are conclusions below. -/
def dpsRestricted (mu V : ℝ) (w : PulsePair → Bool → Vec (Fin 6)) : PairData (Fin 6) :=
  ⟨dpsRestrictedVacuum mu,fun x b =>
    (Real.sqrt V : ℂ) • dpsRestrictedVacuum mu x - (Real.sqrt (1-V) : ℂ) • w x b⟩

/-- Section IV E p.9: the long-distance COW BSA information. -/
def cowIdealLeak (mu : ℝ) : ℝ := QAlgorithms.binEntropy2 ((1-Real.exp (-mu))/2)

/-- Section IV E p.9 and Appendix E pp.17–18: long-distance DPS BSA information. -/
def dpsIdealLeak (mu : ℝ) : ℝ :=
  2*QAlgorithms.binEntropy2 ((1-Real.exp (-2*mu))/2) -
    QAlgorithms.binEntropy2 ((1-Real.exp (-4*mu))/2)

example (mu V : ℝ) (w : PulsePair → Bool → Vec (Fin 6)) (x : PulsePair) (b : Bool) :
    (dpsRestricted mu V w).p x b = (Real.sqrt V : ℂ) • dpsRestrictedVacuum mu x -
      (Real.sqrt (1-V) : ℂ) • w x b := rfl

example : pairDistance (true,false) (false,true) = 2 := rfl

example {I : Type*} [Fintype I] (v w : Vec I) :
    ancillaGram (fun b : Bool => if b then w else v) false true = inner ℂ v w := rfl

example {I J : Type*} (v : Vec I) (w : Vec J) (i : I) (j : J) :
    tensor v w (i,j) = v i * w j := rfl

end QAlgorithms.Papers.Independent.Intake100.P92
Source
Upper Bounds for the Security of two Distributed-Phase Reference Protocols of Quantum Cryptography (Coherent-One-Way and Differential-Phase-Shift), arXiv:0710.4884v2, https://arxiv.org/abs/0710.4884v2
Read-back

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

QAlgorithms.Papers.Independent.Intake100.P92.CowOneValid

For any finite type III, any two Boolean-indexed vector families A=(vb,pb)A=(v_b,p_b)A=(vb​,pb​) in CI\mathbb C^ICI, and any real parameters μ,V\mu,Vμ,V, this predicate means precisely

∀b∈{0,1},∥vb∥=1 and ∥pb∥=1,⟨v0,v1⟩=e−μ/2,∣⟨v1,p1⟩∣2=V,\forall b\in\{0,1\},\quad \|v_b\|=1\ \text{and}\ \|p_b\|=1, \qquad \langle v_0,v_1\rangle=e^{-\mu/2}, \qquad |\langle v_1,p_1\rangle|^2=V,∀b∈{0,1},∥vb​∥=1 and ∥pb​∥=1,⟨v0​,v1​⟩=e−μ/2,∣⟨v1​,p1​⟩∣2=V,

where 0,10,10,1 denote false and true and the real exponential is viewed as a complex number in the inner-product equality. No bounds on μ\muμ or VVV are separately included in the predicate. For empty III, its unit-vector requirements are impossible.

QAlgorithms.Papers.Independent.Intake100.P92.CowValid

For any finite type III, data comprising vectors vx,px,b∈CIv_x,p_{x,b}\in\mathbb C^Ivx​,px,b​∈CI for Boolean pairs xxx and Boolean values bbb, real numbers μ,V\mu,Vμ,V, and a Boolean parameter mmm, this defines the conjunction of the following conditions: every vxv_xvx​ has Euclidean norm one; every px,bp_{x,b}px,b​ has Euclidean norm one; for all Boolean pairs x,yx,yx,y, whenever m=truem=\mathrm{true}m=true or both xxx and yyy differ from (false,false)(\mathrm{false},\mathrm{false})(false,false),

⟨vx,vy⟩=exp⁡ ⁣(−μ d(x,y)2),d(x,y)=1x1≠y1+1x2≠y2,\langle v_x,v_y\rangle =\exp\!\left(-\frac{\mu\,d(x,y)}2\right), \qquad d(x,y)=\mathbf1_{x_1\ne y_1}+\mathbf1_{x_2\ne y_2},⟨vx​,vy​⟩=exp(−2μd(x,y)​),d(x,y)=1x1​=y1​​+1x2​=y2​​,

where the real exponential is embedded in C\mathbb CC; additionally,

Re⁡⟨p(true,true),true,p(true,true),false⟩=V,\operatorname{Re}\langle p_{(\mathrm{true},\mathrm{true}),\mathrm{true}}, p_{(\mathrm{true},\mathrm{true}),\mathrm{false}}\rangle=V,Re⟨p(true,true),true​,p(true,true),false​⟩=V,

and, for every Boolean l,rl,rl,r,

Re⁡ ⁣(⟨v(l,true),p(l,true),true⟩⟨p(true,r),false,v(true,r)⟩)=V.\operatorname{Re}\!\left( \langle v_{(l,\mathrm{true})},p_{(l,\mathrm{true}),\mathrm{true}}\rangle \langle p_{(\mathrm{true},r),\mathrm{false}},v_{(\mathrm{true},r)}\rangle \right)=V.Re(⟨v(l,true)​,p(l,true),true​⟩⟨p(true,r),false​,v(true,r)​⟩)=V.

The inner product conjugates its first argument. When m=falsem=\mathrm{false}m=false, the exponential condition imposes no requirement on pairs involving (false,false)(\mathrm{false},\mathrm{false})(false,false); all norm and final inner-product conditions still apply. No separate bounds on μ\muμ or VVV are stipulated. Empty III is included among finite types, but then the norm-one conditions cannot hold.

QAlgorithms.Papers.Independent.Intake100.P92.DpsOneValid

For any finite index type III, two families of complex coordinate vectors v,p:{0,1}→CIv,p:\{0,1\}\to\mathbb C^Iv,p:{0,1}→CI, and real numbers μ,V\mu,Vμ,V, this predicate means precisely

∥vs∥=1 and ∥ps∥=1(s∈{0,1}),\|v_s\|=1\ \text{and}\ \|p_s\|=1\qquad(s\in\{0,1\}),∥vs​∥=1 and ∥ps​∥=1(s∈{0,1}), ⟨v0,v1⟩=e−2μ,Re⁡ ⁣(⟨vs,ps⟩⟨pw,vw⟩)=V(s,w∈{0,1}).\langle v_0,v_1\rangle=e^{-2\mu}, \qquad \operatorname{Re}\!\left(\langle v_s,p_s\rangle\langle p_w,v_w\rangle\right)=V \qquad(s,w\in\{0,1\}).⟨v0​,v1​⟩=e−2μ,Re(⟨vs​,ps​⟩⟨pw​,vw​⟩)=V(s,w∈{0,1}).

Here false and true are denoted 0,10,10,1, and the inner product is conjugate-linear in its first argument. No bounds on μ\muμ or VVV are included in the predicate. The finite type III may be empty, in which case the unit-norm requirements are impossible.

QAlgorithms.Papers.Independent.Intake100.P92.DpsValid

For any finite type III, any pair-indexed vector data A=(vx,px,b)A=(v_x,p_{x,b})A=(vx​,px,b​) in CI\mathbb C^ICI, and any real μ,V\mu,Vμ,V, write Booleans as 0,10,10,1 and let

d(x,y)=1x1≠y1+1x2≠y2d(x,y)=\mathbf1_{x_1\ne y_1}+\mathbf1_{x_2\ne y_2}d(x,y)=1x1​=y1​​+1x2​=y2​​

for Boolean pairs x,yx,yx,y. This predicate is the conjunction of the conditions

∥vx∥=1for every x,∥px,b∥=1for every x,b,\|v_x\|=1\quad\text{for every }x,\qquad \|p_{x,b}\|=1\quad\text{for every }x,b,∥vx​∥=1for every x,∥px,b​∥=1for every x,b, ⟨vx,vy⟩=e−2μd(x,y)for every x,y,\langle v_x,v_y\rangle=e^{-2\mu d(x,y)} \quad\text{for every }x,y,⟨vx​,vy​⟩=e−2μd(x,y)for every x,y, Re⁡⟨px,1,px,0⟩=Vfor every x,Re⁡ ⁣(⟨vx,px,1⟩⟨py,0,vy⟩)=Vfor every x,y.\operatorname{Re}\langle p_{x,1},p_{x,0}\rangle=V \quad\text{for every }x, \qquad \operatorname{Re}\!\left( \langle v_x,p_{x,1}\rangle \langle p_{y,0},v_y\rangle \right)=V \quad\text{for every }x,y.Re⟨px,1​,px,0​⟩=Vfor every x,Re(⟨vx​,px,1​⟩⟨py,0​,vy​⟩)=Vfor every x,y.

The real exponential in the complex equality is embedded in C\mathbb CC. No parameter bounds are separately required, and for empty III the normalization conditions cannot hold.

QAlgorithms.Papers.Independent.Intake100.P92.HasUnitaryGramSpectrum

For any finite type III with decidable equality, any complex matrix GGG indexed by I×II\times II×I, and any real family e:I→Re:I\to\mathbb Re:I→R, this property means that there exists a complex matrix UUU indexed by I×II\times II×I such that U†U=UU†=IdU^\dagger U=UU^\dagger=\mathrm{Id}U†U=UU†=Id and

G=U diag⁡(ei) U†.G=U\,\operatorname{diag}(e_i)\,U^\dagger.G=Udiag(ei​)U†.

The numbers eie_iei​ are embedded into C\mathbb CC; they need not be nonnegative, ordered, or distinct. The empty index type is included, in which case the property holds for its unique matrix and real family.

QAlgorithms.Papers.Independent.Intake100.P92.OneData

For any type III, this structure consists of two Boolean-indexed families of complex coordinate vectors, v:{0,1}→CIv:\{0,1\}\to\mathbb C^Iv:{0,1}→CI and p:{0,1}→CIp:\{0,1\}\to\mathbb C^Ip:{0,1}→CI, where 000 and 111 denote false and true. It imposes no finiteness assumption on III and no normalization, orthogonality, or other conditions on either family.

QAlgorithms.Papers.Independent.Intake100.P92.Optics.clickWeight

For every real number η\etaη and natural number nnn, this defines the real number 1−(1−η)n1-(1-\eta)^n1−(1−η)n. In particular, its value at n=0n=0n=0 is zero, including when η=1\eta=1η=1, since zeroth powers are one. No restriction on η\etaη is imposed.

QAlgorithms.Papers.Independent.Intake100.P92.Optics.eventWeight

For every real number η\etaη, Boolean bbb, and pair (n1,n2)(n_1,n_2)(n1​,n2​) of natural numbers, this defines

{(1−η)n1(1−(1−η)n2),b=true,(1−(1−η)n1)(1−η)n2,b=false.\begin{cases} (1-\eta)^{n_1}\bigl(1-(1-\eta)^{n_2}\bigr),&b=\mathrm{true},\\ \bigl(1-(1-\eta)^{n_1}\bigr)(1-\eta)^{n_2},&b=\mathrm{false}. \end{cases}{(1−η)n1​(1−(1−η)n2​),(1−(1−η)n1​)(1−η)n2​,​b=true,b=false.​

Both occupations may be zero; at (0,0)(0,0)(0,0) the value is zero. There is no assumption that η\etaη lies in [0,1][0,1][0,1].

QAlgorithms.Papers.Independent.Intake100.P92.Optics.splitter

For every real number ttt, this defines the complex matrix with rows and columns indexed by {0,1}\{0,1\}{0,1},

(t−1−t1−tt).\begin{pmatrix} \sqrt t&-\sqrt{1-t}\\ \sqrt{1-t}&\sqrt t \end{pmatrix}.(t​1−t​​−1−t​t​​).

The square roots are real square roots, embedded into C\mathbb CC; the real square root of a negative number is defined to be zero. There is no assumption that 0≤t≤10\le t\le10≤t≤1.

QAlgorithms.Papers.Independent.Intake100.P92.Optics.thresholdEventProbability

For every real number η\etaη, Boolean bbb, and square-summable complex family ψ=(ψn1,n2)(n1,n2)∈N2\psi=(\psi_{n_1,n_2})_{(n_1,n_2)\in\mathbb N^2}ψ=(ψn1​,n2​​)(n1​,n2​)∈N2​, this defines

∑(n1,n2)∈N2{(1−η)n1(1−(1−η)n2)∣ψn1,n2∣2,b=true,(1−(1−η)n1)(1−η)n2∣ψn1,n2∣2,b=false.\sum_{(n_1,n_2)\in\mathbb N^2} \begin{cases} (1-\eta)^{n_1}\bigl(1-(1-\eta)^{n_2}\bigr)|\psi_{n_1,n_2}|^2,&b=\mathrm{true},\\ \bigl(1-(1-\eta)^{n_1}\bigr)(1-\eta)^{n_2}|\psi_{n_1,n_2}|^2,&b=\mathrm{false}. \end{cases}(n1​,n2​)∈N2∑​{(1−η)n1​(1−(1−η)n2​)∣ψn1​,n2​​∣2,(1−(1−η)n1​)(1−η)n2​∣ψn1​,n2​​∣2,​b=true,b=false.​

The sum is the totalized infinite sum of real numbers, whose value is zero if the family of summands is not summable. Neither normalization of ψ\psiψ nor any restriction on η\etaη is required.

QAlgorithms.Papers.Independent.Intake100.P92.Optics.visibility

For every real number η\etaη and square-summable complex family ψ\psiψ indexed by N2\mathbb N^2N2, define the real numbers

F=∑n1,n2≥0(1−(1−η)n1)(1−η)n2∣ψn1,n2∣2,T=∑n1,n2≥0(1−η)n1(1−(1−η)n2)∣ψn1,n2∣2.F=\sum_{n_1,n_2\ge0}\bigl(1-(1-\eta)^{n_1}\bigr)(1-\eta)^{n_2}|\psi_{n_1,n_2}|^2,\qquad T=\sum_{n_1,n_2\ge0}(1-\eta)^{n_1}\bigl(1-(1-\eta)^{n_2}\bigr)|\psi_{n_1,n_2}|^2.F=n1​,n2​≥0∑​(1−(1−η)n1​)(1−η)n2​∣ψn1​,n2​​∣2,T=n1​,n2​≥0∑​(1−η)n1​(1−(1−η)n2​)∣ψn1​,n2​​∣2.

This defines the visibility to be (F−T)/(F+T)(F-T)/(F+T)(F−T)/(F+T). Each infinite sum is zero if its summands are not summable, and division by zero is defined to give zero. There is no normalization assumption on ψ\psiψ and no restriction on η\etaη.

QAlgorithms.Papers.Independent.Intake100.P92.PairData

For any type III, this structure consists of two families of complex coordinate vectors indexed by III: a vector vxv_xvx​ for every Boolean pair x∈Bool2x\in\mathrm{Bool}^2x∈Bool2, and a vector px,bp_{x,b}px,b​ for every Boolean pair xxx and Boolean value bbb. The vectors belong to EuclideanSpace⁡(C,I)\operatorname{EuclideanSpace}(\mathbb C,I)EuclideanSpace(C,I). No finiteness assumption on III, normalization condition, or relation among these vectors is part of the structure; empty III is allowed.

QAlgorithms.Papers.Independent.Intake100.P92.PulsePair

This abbreviates the type of ordered pairs of Boolean values, Bool×Bool\mathrm{Bool}\times\mathrm{Bool}Bool×Bool. Its four elements are (false,false)(\mathrm{false},\mathrm{false})(false,false), (false,true)(\mathrm{false},\mathrm{true})(false,true), (true,false)(\mathrm{true},\mathrm{false})(true,false), and (true,true)(\mathrm{true},\mathrm{true})(true,true).

QAlgorithms.Papers.Independent.Intake100.P92.SameSpanGeometry

For any index type III, any complex inner-product spaces H,KH,KH,K equipped with their normed additive-group structures, and arbitrary families x:I→Hx:I\to Hx:I→H and y:I→Ky:I\to Ky:I→K, this predicate means that there exists a bijective complex-linear isometry

U:span⁡C{xi:i∈I}⟶span⁡C{yi:i∈I}U:\operatorname{span}_{\mathbb C}\{x_i:i\in I\} \longrightarrow \operatorname{span}_{\mathbb C}\{y_i:i\in I\}U:spanC​{xi​:i∈I}⟶spanC​{yi​:i∈I}

such that U(xi)=yiU(x_i)=y_iU(xi​)=yi​ for every i∈Ii\in Ii∈I, with each vector viewed as an element of its indicated span. Neither finiteness of III nor completeness of the ambient spaces is assumed. The isometry is required only between these spans; if III is empty, both spans are zero.

QAlgorithms.Papers.Independent.Intake100.P92.ancillaGram

For any type III, any normed additive commutative group HHH equipped with a complex inner-product-space structure, and any family x:I→Hx:I\to Hx:I→H, this defines the complex matrix GGG indexed by I×II\times II×I through Gij=⟨xi,xj⟩G_{ij}=\langle x_i,x_j\rangleGij​=⟨xi​,xj​⟩, with the inner product conjugate-linear in its first argument. The index type need not be finite, and the vectors need not be normalized.

QAlgorithms.Papers.Independent.Intake100.P92.announcedLaw

For arbitrary real numbers q,x,f0q,x,f_0q,x,f0​, this defines a real-valued function on Boolean pairs whose table, with false indexed by 000 and true by 111, is

(announcedLaw(q,x,f0)(a,b))a,b=((1−q)f01−qx0q(1−x)f01−qxqx).\bigl(announcedLaw(q,x,f_0)(a,b)\bigr)_{a,b} = \begin{pmatrix} \displaystyle(1-q)\frac{f_0}{1-qx}&0\\[4pt] \displaystyle q(1-x)\frac{f_0}{1-qx}&qx \end{pmatrix}.(announcedLaw(q,x,f0​)(a,b))a,b​=​(1−q)1−qxf0​​q(1−x)1−qxf0​​​0qx​​.

There are no range or normalization hypotheses. Division by zero is defined as zero, so when qx=1qx=1qx=1 both entries in the first column are zero.

QAlgorithms.Papers.Independent.Intake100.P92.basis

For every natural number nnn and every index i∈{0,…,n−1}i\in\{0,\ldots,n-1\}i∈{0,…,n−1}, this defines the complex Euclidean vector

basis(i)j={1,j=i,0,j≠i.basis(i)_j= \begin{cases} 1,&j=i,\\ 0,&j\ne i. \end{cases}basis(i)j​={1,0,​j=i,j=i.​

For n=0n=0n=0 there is no permissible index iii.

QAlgorithms.Papers.Independent.Intake100.P92.binaryHolevoBits

For any finite type III with decidable equality, any normed additive commutative group HHH equipped with a complex inner-product-space structure, and any families x,y:I→Hx,y:I\to Hx,y:I→H, let zfalse,i=xi/2z_{\mathrm{false},i}=x_i/\sqrt2zfalse,i​=xi​/2​ and ztrue,i=yi/2z_{\mathrm{true},i}=y_i/\sqrt2ztrue,i​=yi​/2​. For a finite family www, write G(w)ij=⟨wi,wj⟩G(w)_{ij}=\langle w_i,w_j\rangleG(w)ij​=⟨wi​,wj​⟩ and S(w)=Re⁡tr⁡f(G(w))S(w)=\operatorname{Re}\operatorname{tr}f(G(w))S(w)=Retrf(G(w)), using continuous functional calculus with f(r)=−rlog⁡r/log⁡2f(r)=-r\log r/\log2f(r)=−rlogr/log2 and f(0)=0f(0)=0f(0)=0. This defines S(z)−S(x)/2−S(y)/2S(z)-S(x)/2-S(y)/2S(z)−S(x)/2−S(y)/2. Neither input family is required to be normalized; if III is empty, the value is zero.

QAlgorithms.Papers.Independent.Intake100.P92.bobPairLaw

For any real-valued function PPP on Boolean pairs, this defines a real-valued function on a Boolean pair xxx together with another Boolean ccc by

BP(x,c)=P(x)2.B_P(x,c)=\frac{P(x)}2.BP​(x,c)=2P(x)​.

Thus the value is the same for both values of ccc. No nonnegativity or normalization assumptions are imposed on PPP.

QAlgorithms.Papers.Independent.Intake100.P92.click

For arbitrary real numbers μ,t,η\mu,t,\etaμ,t,η, this defines

click(μ,t,η)=1−exp⁡(−μtη).\mathrm{click}(\mu,t,\eta)=1-\exp(-\mu t\eta).click(μ,t,η)=1−exp(−μtη).

There are no sign or interval assumptions on the arguments. The value is zero when μtη=0\mu t\eta=0μtη=0, and negative when μtη<0\mu t\eta<0μtη<0.

QAlgorithms.Papers.Independent.Intake100.P92.cowA

For any type III, any family AAA consisting of vectors vx,px,b∈CIv_x,p_{x,b}\in\mathbb C^Ivx​,px,b​∈CI indexed by Boolean pairs xxx and Booleans bbb, any real QQQ, and any Boolean aaa, this defines the Boolean-indexed vector family

b⟼{1−Q p(¬a,a),b,a=b,Q p(¬a,a),b,a≠b.b\longmapsto \begin{cases} \sqrt{1-Q}\,p_{(\neg a,a),b},&a=b,\\ \sqrt Q\,p_{(\neg a,a),b},&a\ne b. \end{cases}b⟼{1−Q​p(¬a,a),b​,Q​p(¬a,a),b​,​a=b,a=b.​

The real square roots are used as complex scalars. No normalization assumption or restriction on QQQ is imposed; the real square root is zero on negative arguments.

QAlgorithms.Papers.Independent.Intake100.P92.cowB

For any type III, any family AAA consisting of vectors vx,px,b∈CIv_x,p_{x,b}\in\mathbb C^Ivx​,px,b​∈CI indexed by Boolean pairs xxx and Booleans bbb, any real QQQ, and any Boolean bbb, this defines the Boolean-indexed vector family

a⟼{1−Q p(¬a,a),b,a=b,Q p(¬a,a),b,a≠b.a\longmapsto \begin{cases} \sqrt{1-Q}\,p_{(\neg a,a),b},&a=b,\\ \sqrt Q\,p_{(\neg a,a),b},&a\ne b. \end{cases}a⟼{1−Q​p(¬a,a),b​,Q​p(¬a,a),b​,​a=b,a=b.​

The real square roots are used as complex scalars. No normalization assumption or restriction on QQQ is imposed; the real square root is zero on negative arguments.

QAlgorithms.Papers.Independent.Intake100.P92.cowBob

For every α∈C\alpha\in\mathbb Cα∈C, t∈Rt\in\mathbb Rt∈R, and Boolean aaa, put β=t α\beta=\sqrt t\,\alphaβ=t​α, with the real square root embedded into C\mathbb CC. This defines a vector in ℓ2(N2;C)\ell^2(\mathbb N^2;\mathbb C)ℓ2(N2;C) equal to C(0,β)C(0,\beta)C(0,β) when aaa is true and C(β,0)C(\beta,0)C(β,0) when aaa is false, where

C(u,v)m,n=e−∣u∣2/2umm! e−∣v∣2/2vnn!(m,n∈N)C(u,v)_{m,n} =\frac{e^{-|u|^2/2}u^m}{\sqrt{m!}}\, \frac{e^{-|v|^2/2}v^n}{\sqrt{n!}} \quad(m,n\in\mathbb N)C(u,v)m,n​=m!​e−∣u∣2/2um​n!​e−∣v∣2/2vn​(m,n∈N)

if this coefficient array is square summable, and C(u,v)=0C(u,v)=0C(u,v)=0 otherwise. No restriction on ttt is assumed; for t≤0t\leq0t≤0, the real square root is zero and both branches give C(0,0)C(0,0)C(0,0).

QAlgorithms.Papers.Independent.Intake100.P92.cowCoefficient

For every finite type III with decidable equality, every family A=(vx,px,b)A=(v_x,p_{x,b})A=(vx​,px,b​) of complex vectors indexed by Boolean pairs xxx and Booleans bbb, and all real μ,Q\mu,Qμ,Q, first define vectors p^x,b\widehat p_{x,b}p​x,b​ on I⊔{0,1,2,3}I\sqcup\{0,1,2,3\}I⊔{0,1,2,3} as follows: extend px,bp_{x,b}px,b​ by zero when the coordinate of xxx selected by bbb is true; otherwise replace it by an added standard basis vector, using index 000 or 111 for x=(false,false)x=(\mathrm{false},\mathrm{false})x=(false,false) according as bbb is false or true, index 222 when x1x_1x1​ is true, and index 333 otherwise. Put wab=1−Qw_{ab}=\sqrt{1-Q}wab​=1−Q​ if a=ba=ba=b and wab=Qw_{ab}=\sqrt Qwab​=Q​ otherwise, and define Boolean-indexed families Xa(b)=wabp^(¬a,a),bX_a(b)=w_{ab}\widehat p_{(\neg a,a),b}Xa​(b)=wab​p​(¬a,a),b​ and Yb(a)=wabp^(¬a,a),bY_b(a)=w_{ab}\widehat p_{(\neg a,a),b}Yb​(a)=wab​p​(¬a,a),b​. For any finite vector family zzz, let G(z)ij=⟨zi,zj⟩G(z)_{ij}=\langle z_i,z_j\rangleG(z)ij​=⟨zi​,zj​⟩ and

S(z)=Re⁡tr⁡f(G(z)),f(t)=−tlog⁡tlog⁡2,χ(x,y)=S((x/2)⊔(y/2))−S(x)+S(y)2,S(z)=\operatorname{Re}\operatorname{tr} f(G(z)), \qquad f(t)=-\frac{t\log t}{\log2}, \qquad \chi(x,y)=S\bigl((x/\sqrt2)\sqcup(y/\sqrt2)\bigr)-\frac{S(x)+S(y)}2,S(z)=Retrf(G(z)),f(t)=−log2tlogt​,χ(x,y)=S((x/2​)⊔(y/2​))−2S(x)+S(y)​,

where f(G)f(G)f(G) is defined by continuous functional calculus and the disjoint union retains both families' indices. The coefficient is

μ2[1−h2(Q)−min⁡{χ(Xfalse,Xtrue),χ(Yfalse,Ytrue)}],h2(t)=−tlog⁡t−(1−t)log⁡(1−t)log⁡2.\frac{\mu}{2} \left[1-h_2(Q)-\min\{\chi(X_{\mathrm{false}},X_{\mathrm{true}}), \chi(Y_{\mathrm{false}},Y_{\mathrm{true}})\}\right], \quad h_2(t)=\frac{-t\log t-(1-t)\log(1-t)}{\log2}.2μ​[1−h2​(Q)−min{χ(Xfalse​,Xtrue​),χ(Yfalse​,Ytrue​)}],h2​(t)=log2−tlogt−(1−t)log(1−t)​.

No validity, normalization, nonemptiness, or parameter bounds are assumed; negative square-root arguments give zero and logarithms use the total real-logarithm convention.

QAlgorithms.Papers.Independent.Intake100.P92.cowE

For every α∈C\alpha\in\mathbb Cα∈C, t∈Rt\in\mathbb Rt∈R, and Boolean aaa, this defines a function from the singleton type to ℓ2(N×N;C)\ell^2(\mathbb N\times\mathbb N;\mathbb C)ℓ2(N×N;C), with the same value at its sole argument. Put β=1−t α\beta=\sqrt{1-t}\,\alphaβ=1−t​α, using the real square root embedded into C\mathbb CC, and let C(u,v)C(u,v)C(u,v) denote the vector whose coefficient at (m,n)∈N2(m,n)\in\mathbb N^2(m,n)∈N2 is

C(u,v)m,n=e−∣u∣2/2umm! e−∣v∣2/2vnn!,C(u,v)_{m,n} =\frac{e^{-|u|^2/2}u^m}{\sqrt{m!}}\, \frac{e^{-|v|^2/2}v^n}{\sqrt{n!}},C(u,v)m,n​=m!​e−∣u∣2/2um​n!​e−∣v∣2/2vn​,

provided this coefficient array is square summable, and the zero vector otherwise. The function's value is C(0,β)C(0,\beta)C(0,β) if aaa is true and C(β,0)C(\beta,0)C(β,0) if aaa is false. All natural occupations, including zero, are included, with 00=10^0=100=1. No restriction on ttt is assumed; for t≥1t\geq1t≥1, β=0\beta=0β=0 and either branch gives C(0,0)C(0,0)C(0,0).

QAlgorithms.Papers.Independent.Intake100.P92.cowHerald

For every α∈C\alpha\in\mathbb Cα∈C, t,η∈Rt,\eta\in\mathbb Rt,η∈R, and Booleans a,ba,ba,b, this defines a complex matrix indexed by N2×N2\mathbb N^2\times\mathbb N^2N2×N2 as follows. Let β=t α\beta=\sqrt t\,\alphaβ=t​α and ϵ=1−t α\epsilon=\sqrt{1-t}\,\alphaϵ=1−t​α, using real square roots, and define C(u,v)∈ℓ2(N2;C)C(u,v)\in\ell^2(\mathbb N^2;\mathbb C)C(u,v)∈ℓ2(N2;C) by coefficients

C(u,v)m,n=e−∣u∣2/2umm! e−∣v∣2/2vnn!C(u,v)_{m,n} =\frac{e^{-|u|^2/2}u^m}{\sqrt{m!}}\, \frac{e^{-|v|^2/2}v^n}{\sqrt{n!}}C(u,v)m,n​=m!​e−∣u∣2/2um​n!​e−∣v∣2/2vn​

when this array is square summable, and as zero otherwise. If aaa is true, set B=C(0,β)B=C(0,\beta)B=C(0,β) and E=C(0,ϵ)E=C(0,\epsilon)E=C(0,ϵ); if aaa is false, set B=C(β,0)B=C(\beta,0)B=C(β,0) and E=C(ϵ,0)E=C(\epsilon,0)E=C(ϵ,0). For n=(n1,n2)n=(n_1,n_2)n=(n1​,n2​), set wη,b(n)=(1−η)n1(1−(1−η)n2)w_{\eta,b}(n)=(1-\eta)^{n_1}(1-(1-\eta)^{n_2})wη,b​(n)=(1−η)n1​(1−(1−η)n2​) when bbb is true, and wη,b(n)=(1−(1−η)n1)(1−η)n2w_{\eta,b}(n)=(1-(1-\eta)^{n_1})(1-\eta)^{n_2}wη,b​(n)=(1−(1−η)n1​)(1−η)n2​ when bbb is false. The entry at arbitrary i,j∈N2i,j\in\mathbb N^2i,j∈N2 is

∑n∈N2wη,b(n)(BnEi)(BnEj)‾.\sum_{n\in\mathbb N^2}w_{\eta,b}(n)(B_nE_i)\overline{(B_nE_j)}.n∈N2∑​wη,b​(n)(Bn​Ei​)(Bn​Ej​)​.

A nonsummable complex summand family gives entry zero. No restrictions on ttt or η\etaη are imposed; the real square roots vanish for nonpositive arguments, and all zeroth powers equal 111.

QAlgorithms.Papers.Independent.Intake100.P92.cowIdealLeak

For every real μ\muμ, this definition gives the real number

LCOW(μ)=H2 ⁣(1−e−μ2),L_{\mathrm{COW}}(\mu)=H_2\!\left(\frac{1-e^{-\mu}}2\right),LCOW​(μ)=H2​(21−e−μ​),

where H2(p)=binEntropy⁡(p)/log⁡2H_2(p)=\operatorname{binEntropy}(p)/\log2H2​(p)=binEntropy(p)/log2 is real binary entropy in bits. There is no assumption that μ≥0\mu\ge0μ≥0; for negative μ\muμ, the argument is negative and the definition uses the total real entropy expression (−plog⁡p−(1−p)log⁡(1−p))/log⁡2\bigl(-p\log p-(1-p)\log(1-p)\bigr)/\log2(−plogp−(1−p)log(1−p))/log2, with real logarithm interpreted as log⁡∣x∣\log|x|log∣x∣ for x≠0x\ne0x=0 and as 000 at x=0x=0x=0.

QAlgorithms.Papers.Independent.Intake100.P92.cowLeak

For every finite type III, every family AAA consisting of vectors vx,px,b∈CIv_x,p_{x,b}\in\mathbb C^Ivx​,px,b​∈CI, and every real QQQ, this defines

Q+(1−Q) h2 ⁣(1+∣⟨p(true,false),false,p(false,true),true⟩∣2),h2(t)=−tlog⁡t−(1−t)log⁡(1−t)log⁡2.Q+(1-Q)\,h_2\!\left( \frac{1+\left|\left\langle p_{(\mathrm{true},\mathrm{false}),\mathrm{false}}, p_{(\mathrm{false},\mathrm{true}),\mathrm{true}} \right\rangle\right|}{2}\right), \qquad h_2(t)=\frac{-t\log t-(1-t)\log(1-t)}{\log 2}.Q+(1−Q)h2​(21+​⟨p(true,false),false​,p(false,true),true​⟩​​),h2​(t)=log2−tlogt−(1−t)log(1−t)​.

Here the inner product is the usual complex Euclidean inner product and ∣⋅∣|\cdot|∣⋅∣ is complex modulus. There are no normalization or parameter bounds, so the argument of h2h_2h2​ need not lie in [0,1][0,1][0,1]; the expression uses the total real logarithm, with log⁡0=0\log 0=0log0=0 and log⁡t=log⁡∣t∣\log t=\log|t|logt=log∣t∣ for negative ttt. The empty index type is included.

QAlgorithms.Papers.Independent.Intake100.P92.cowMinimum

For arbitrary real numbers μ,V\mu,Vμ,V, this defines

cowMinimum(μ,V)=(2V−1)e−μ−2V(1−V)1−e−2μ.cowMinimum(\mu,V) =(2V-1)e^{-\mu} -2\sqrt{V(1-V)}\sqrt{1-e^{-2\mu}}.cowMinimum(μ,V)=(2V−1)e−μ−2V(1−V)​1−e−2μ​.

No restrictions on μ,V\mu,Vμ,V are part of the definition. Each real square root is defined to be zero when its argument is negative.

QAlgorithms.Papers.Independent.Intake100.P92.cowOutput

For any type III, any data consisting of complex coordinate vectors vxv_xvx​ and px,bp_{x,b}px,b​ indexed by III for Boolean pairs xxx and Boolean values bbb, any real μ,t,Q\mu,t,Qμ,t,Q, and any Boolean pair x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​), this defines a complex-valued function on {0,1,2}×I\{0,1,2\}\times I{0,1,2}×I by

Ox(k,i)={vx(i),k=0,w(Q,x1)μt  px,false(i),k=1,w(Q,x2)μt  px,true(i),k=2,w(Q,o)={1−Q,o=true,Q,o=false.O_x(k,i)= \begin{cases} v_x(i),&k=0,\\ \sqrt{w(Q,x_1)\mu t}\;p_{x,\mathrm{false}}(i),&k=1,\\ \sqrt{w(Q,x_2)\mu t}\;p_{x,\mathrm{true}}(i),&k=2, \end{cases} \qquad w(Q,o)= \begin{cases}1-Q,&o=\mathrm{true},\\Q,&o=\mathrm{false}.\end{cases}Ox​(k,i)=⎩⎨⎧​vx​(i),w(Q,x1​)μt​px,false​(i),w(Q,x2​)μt​px,true​(i),​k=0,k=1,k=2,​w(Q,o)={1−Q,Q,​o=true,o=false.​

The real square-root factors are regarded as complex scalars. There are no finiteness or normalization assumptions on the data and no bounds on the three real parameters; a negative radicand has real square root zero. If III is empty, this is a function on an empty domain.

QAlgorithms.Papers.Independent.Intake100.P92.cowPositive

For arbitrary real numbers μ,V\mu,Vμ,V, this defines a pair of vector families v:{0,1}2→C3v:\{0,1\}^2\to\mathbb C^3v:{0,1}2→C3 and p:{0,1}2×{0,1}→C3p:\{0,1\}^2\times\{0,1\}\to\mathbb C^3p:{0,1}2×{0,1}→C3, where 000 means false and 111 means true. Put

g=e−μ,a=1+g2,b=1−g2,u=2g1+g,z=1−g1+g,c=2V1+V u+1−V1+V z,s=2V1+V z−1−V1+V u.\begin{gathered} g=e^{-\mu},\quad a=\sqrt{\frac{1+g}{2}},\quad b=\sqrt{\frac{1-g}{2}},\quad u=\sqrt{\frac{2g}{1+g}},\quad z=\sqrt{\frac{1-g}{1+g}},\\ c=\sqrt{\frac{2V}{1+V}}\,u+\sqrt{\frac{1-V}{1+V}}\,z,\qquad s=\sqrt{\frac{2V}{1+V}}\,z-\sqrt{\frac{1-V}{1+V}}\,u. \end{gathered}g=e−μ,a=21+g​​,b=21−g​​,u=1+g2g​​,z=1+g1−g​​,c=1+V2V​​u+1+V1−V​​z,s=1+V2V​​z−1+V1−V​​u.​

Writing real coordinate triples as complex Euclidean vectors and e0=(1,0,0)e_0=(1,0,0)e0​=(1,0,0), the families are

v10=(a,b,0),v01=(a,−b,0),v11=(u,0,z),v00=e0,v_{10}=(a,b,0),\quad v_{01}=(a,-b,0),\quad v_{11}=(u,0,z),\quad v_{00}=e_0,v10​=(a,b,0),v01​=(a,−b,0),v11​=(u,0,z),v00​=e0​,

and

px,σ={V v10−1−V (b,−a,0),x=(1,0), σ=0,V v01−1−V (b,a,0),x=(0,1), σ=1,(1+V2c, (1−2σ)1−V2, 1+V2s),x=(1,1),e0,otherwise.p_{x,\sigma}= \begin{cases} \sqrt V\,v_{10}-\sqrt{1-V}\,(b,-a,0),&x=(1,0),\ \sigma=0,\\ \sqrt V\,v_{01}-\sqrt{1-V}\,(b,a,0),&x=(0,1),\ \sigma=1,\\ \left(\sqrt{\frac{1+V}{2}}c,\ (1-2\sigma)\sqrt{\frac{1-V}{2}},\ \sqrt{\frac{1+V}{2}}s\right),&x=(1,1),\\ e_0,&\text{otherwise}. \end{cases}px,σ​=⎩⎨⎧​V​v10​−1−V​(b,−a,0),V​v01​−1−V​(b,a,0),(21+V​​c, (1−2σ)21−V​​, 21+V​​s),e0​,​x=(1,0), σ=0,x=(0,1), σ=1,x=(1,1),otherwise.​

The definition returns these two families without asserting that any vector is normalized. All real square roots are zero on negative inputs, and division by zero is zero, including in the formulas when V=−1V=-1V=−1.

QAlgorithms.Papers.Independent.Intake100.P92.cowRate

For every α∈C\alpha\in\mathbb Cα∈C and t,η∈Rt,\eta\in\mathbb Rt,η∈R, this defines the real number

RCOW(α,t,η)=1−e−∣α∣2tη2(1−χ(E0,E1)).R_{\mathrm{COW}}(\alpha,t,\eta) =\frac{1-e^{-|\alpha|^2t\eta}}2\bigl(1-\chi(E_0,E_1)\bigr).RCOW​(α,t,η)=21−e−∣α∣2tη​(1−χ(E0​,E1​)).

Here F=ℓ2(N2;C)F=\ell^2(\mathbb N^2;\mathbb C)F=ℓ2(N2;C),

ca(n)=e−∣a∣2/2ann!,c_a(n)=e^{-|a|^2/2}\frac{a^n}{\sqrt{n!}},ca​(n)=e−∣a∣2/2n!​an​,

and C(a,b)∈FC(a,b)\in FC(a,b)∈F is the vector with coefficients ca(m)cb(n)c_a(m)c_b(n)ca​(m)cb​(n) if this coefficient family is square summable, and is the zero vector otherwise. Set e=1−t αe=\sqrt{1-t}\,\alphae=1−t​α and define the families indexed by the singleton set {∗}\{*\}{∗} by E0(∗)=C(e,0)E_0(*)=C(e,0)E0​(∗)=C(e,0) and E1(∗)=C(0,e)E_1(*)=C(0,e)E1​(∗)=C(0,e). For any finite vector family x=(xi)x=(x_i)x=(xi​), let Gx=(⟨xi,xj⟩)i,jG_x=(\langle x_i,x_j\rangle)_{i,j}Gx​=(⟨xi​,xj​⟩)i,j​ and

H(x)=Re⁡tr⁡[f(Gx)],f(u)=−ulog⁡ulog⁡2,χ(x,y)=H ⁣((xi/2)i,(yi/2)i)−H(x)+H(y)2,H(x)=\operatorname{Re}\operatorname{tr} \left[f(G_x)\right], \qquad f(u)=-\frac{u\log u}{\log2}, \qquad \chi(x,y)=H\!\left((x_i/\sqrt2)_i,(y_i/\sqrt2)_i\right)-\frac{H(x)+H(y)}2,H(x)=Retr[f(Gx​)],f(u)=−log2ulogu​,χ(x,y)=H((xi​/2​)i​,(yi​/2​)i​)−2H(x)+H(y)​,

where f(Gx)f(G_x)f(Gx​) uses continuous functional calculus and the concatenated family is indexed by Bool×{∗}\mathrm{Bool}\times\{*\}Bool×{∗}. There are no restrictions on α,t,η\alpha,t,\etaα,t,η; real square roots of nonpositive numbers are zero, and the real logarithm has value zero at zero.

QAlgorithms.Papers.Independent.Intake100.P92.cowZero

For any real numbers μ,V\mu,Vμ,V, this defines two maps v:{0,1}2→C7v:\{0,1\}^2\to\mathbb C^7v:{0,1}2→C7 and p:{0,1}2×{0,1}→C7p:\{0,1\}^2\times\{0,1\}\to\mathbb C^7p:{0,1}2×{0,1}→C7, where 0,10,10,1 denote false and true, coordinates are numbered 0,…,60,\ldots,60,…,6, and eje_jej​ is the corresponding standard basis vector. Put

g=e−μ,a=1+g2,b=1−g2,r=Vg1−V,h=V(1−V)1−g2,c=Vg−h(1−V)g+h.g=e^{-\mu},\quad a=\sqrt{\frac{1+g}{2}},\quad b=\sqrt{\frac{1-g}{2}},\quad r=\frac{Vg}{1-V},\quad h=\sqrt{V(1-V)}\sqrt{1-g^2},\quad c=\frac{Vg-h}{(1-V)g+h}.g=e−μ,a=21+g​​,b=21−g​​,r=1−VVg​,h=V(1−V)​1−g2​,c=(1−V)g+hVg−h​.

The first map is

v10=(a,b,0,0,0,0,0),v01=(a,−b,0,0,0,0,0),v11=(2g1+g,0,0,0,1−g1+g,0,0),v00=e0.v_{10}=(a,b,0,0,0,0,0),\quad v_{01}=(a,-b,0,0,0,0,0),\quad v_{11}=\left(\sqrt{\frac{2g}{1+g}},0,0,0,\sqrt{\frac{1-g}{1+g}},0,0\right),\quad v_{00}=e_0.v10​=(a,b,0,0,0,0,0),v01​=(a,−b,0,0,0,0,0),v11​=(1+g2g​​,0,0,0,1+g1−g​​,0,0),v00​=e0​.

Define

p0={V v10+1−V e2,V≤12,V v10−1−V c(b,−a,0,0,0,0,0)+1−V1−c2 e2,V>12,p_0= \begin{cases} \sqrt V\,v_{10}+\sqrt{1-V}\,e_2,&V\le\frac12,\\ \sqrt V\,v_{10}-\sqrt{1-V}\,c(b,-a,0,0,0,0,0) +\sqrt{1-V}\sqrt{1-c^2}\,e_2,&V>\frac12, \end{cases}p0​={V​v10​+1−V​e2​,V​v10​−1−V​c(b,−a,0,0,0,0,0)+1−V​1−c2​e2​,​V≤21​,V>21​,​ p1={V v01+1−V(0,0,−r,1−r2,0,0,0),V≤12,V v01−1−V(b,a,0,0,0,0,0),V>12.p_1= \begin{cases} \sqrt V\,v_{01}+\sqrt{1-V}(0,0,-r,\sqrt{1-r^2},0,0,0),&V\le\frac12,\\ \sqrt V\,v_{01}-\sqrt{1-V}(b,a,0,0,0,0,0),&V>\frac12. \end{cases}p1​={V​v01​+1−V​(0,0,−r,1−r2​,0,0,0),V​v01​−1−V​(b,a,0,0,0,0,0),​V≤21​,V>21​.​

Then p10,0=p0p_{10,0}=p_0p10,0​=p0​, p01,1=p1p_{01,1}=p_1p01,1​=p1​, and

p11,s=V v11+1−V e5+s(s∈{0,1});p_{11,s}=\sqrt V\,v_{11}+\sqrt{1-V}\,e_{5+s}\qquad(s\in\{0,1\});p11,s​=V​v11​+1−V​e5+s​(s∈{0,1});

all other values of ppp are e0e_0e0​. Real coordinates are regarded as complex coordinates. There are no restrictions on μ,V\mu,Vμ,V and no normalization assertion; every real square root of a negative argument is 000, and division by zero is 000.

QAlgorithms.Papers.Independent.Intake100.P92.cowm1Family

For arbitrary real μ,V,θ0,θ1,ϕ\mu,V,\theta_0,\theta_1,\phiμ,V,θ0​,θ1​,ϕ, this defines maps v:{0,1}2→C4v:\{0,1\}^2\to\mathbb C^4v:{0,1}2→C4 and p:{0,1}2×{0,1}→C4p:\{0,1\}^2\times\{0,1\}\to\mathbb C^4p:{0,1}2×{0,1}→C4, with false and true denoted 0,10,10,1, standard basis vectors e0,…,e3e_0,\ldots,e_3e0​,…,e3​, and real coordinates embedded in C\mathbb CC. Put

g=e−μ,a=1+g2,b=1−g2,u=2g1+g,z=1−g1+g,g=e^{-\mu},\quad a=\sqrt{\frac{1+g}{2}},\quad b=\sqrt{\frac{1-g}{2}},\quad u=\sqrt{\frac{2g}{1+g}},\quad z=\sqrt{\frac{1-g}{1+g}},g=e−μ,a=21+g​​,b=21−g​​,u=1+g2g​​,z=1+g1−g​​, v10=(a,b,0,0),v01=(a,−b,0,0),v00=(u,0,z,0),v11=(u,0,−gz,1−g),v_{10}=(a,b,0,0),\quad v_{01}=(a,-b,0,0),\quad v_{00}=(u,0,z,0),\quad v_{11}=(u,0,-gz,1-g),v10​=(a,b,0,0),v01​=(a,−b,0,0),v00​=(u,0,z,0),v11​=(u,0,−gz,1−g),

and

d0=(b,−a,0,0),d1=(b,a,0,0),dD1=(0,0,1−g2,g),dD2=(z,0,gu,−2g1−g).d_0=(b,-a,0,0),\quad d_1=(b,a,0,0),\quad d_{D1}=(0,0,\sqrt{1-g^2},g),\quad d_{D2}=(z,0,gu,-\sqrt{2g}\sqrt{1-g}).d0​=(b,−a,0,0),d1​=(b,a,0,0),dD1​=(0,0,1−g2​,g),dD2​=(z,0,gu,−2g​1−g​).

Define

w10,s=cos⁡θ0 d0+sin⁡θ0cos⁡θ1 e2+sin⁡θ0sin⁡θ1 e3,w_{10,s}=\cos\theta_0\,d_0+\sin\theta_0\cos\theta_1\,e_2 +\sin\theta_0\sin\theta_1\,e_3,w10,s​=cosθ0​d0​+sinθ0​cosθ1​e2​+sinθ0​sinθ1​e3​, w01,s=cos⁡θ0 d1+sin⁡θ0cos⁡θ1 e2+sin⁡θ0sin⁡θ1 e3,w_{01,s}=\cos\theta_0\,d_1+\sin\theta_0\cos\theta_1\,e_2 +\sin\theta_0\sin\theta_1\,e_3,w01,s​=cosθ0​d1​+sinθ0​cosθ1​e2​+sinθ0​sinθ1​e3​,

and, for x=00x=00x=00 or 111111,

wx,s=cos⁡ϕ dD1+sin⁡ϕ dD22+2s−12e1.w_{x,s}=\frac{\cos\phi\,d_{D1}+\sin\phi\,d_{D2}}{\sqrt2} +\frac{2s-1}{\sqrt2}e_1.wx,s​=2​cosϕdD1​+sinϕdD2​​+2​2s−1​e1​.

Finally,

px,s={e0,the bit of x selected by slot s is 0,V vx−1−V wx,s,that bit is 1.p_{x,s}= \begin{cases} e_0,&\text{the bit of $x$ selected by slot $s$ is $0$},\\ \sqrt V\,v_x-\sqrt{1-V}\,w_{x,s},&\text{that bit is $1$}. \end{cases}px,s​={e0​,V​vx​−1−V​wx,s​,​the bit of x selected by slot s is 0,that bit is 1.​

Slot 000 selects the first bit and slot 111 the second. No parameter restrictions or normalization properties are asserted; square roots of negative real inputs and quotients with zero denominator are interpreted as 000.

QAlgorithms.Papers.Independent.Intake100.P92.cowm1Info

For any finite type III with decidable equality, any families vx,px,b∈CIv_x,p_{x,b}\in\mathbb C^Ivx​,px,b​∈CI indexed by Boolean pairs xxx and Booleans bbb, any real QQQ, and any Boolean bob\mathrm{bob}bob, this definition gives the following real number. Write Booleans as 0,10,10,1, put wab=1−Qw_{ab}=1-Qwab​=1−Q when a=ba=ba=b and wab=Qw_{ab}=Qwab​=Q otherwise, and define

EaA(b)=wab p(1−a,a),b,EbB(a)=wab p(1−a,a),b.E^A_a(b)=\sqrt{w_{ab}}\,p_{(1-a,a),b}, \qquad E^B_b(a)=\sqrt{w_{ab}}\,p_{(1-a,a),b}.EaA​(b)=wab​​p(1−a,a),b​,EbB​(a)=wab​​p(1−a,a),b​.

For s,r,a,b∈{0,1}s,r,a,b\in\{0,1\}s,r,a,b∈{0,1}, also put

Dab(s,r)={v(s,1−a)⊗p(a,r),0,b=1,p(s,1−a),1⊗v(a,r),b=0,D_{ab}(s,r)= \begin{cases} v_{(s,1-a)}\otimes p_{(a,r),0},&b=1,\\ p_{(s,1-a),1}\otimes v_{(a,r)},&b=0, \end{cases}Dab​(s,r)={v(s,1−a)​⊗p(a,r),0​,p(s,1−a),1​⊗v(a,r)​,​b=1,b=0,​

where (u⊗v)(i,j)=u(i)v(j)(u\otimes v)(i,j)=u(i)v(j)(u⊗v)(i,j)=u(i)v(j), and define

CaA(s,r,b)=wab/4 Dab(s,r),CbB(s,r,a)=wab/4 Dab(s,r).C^A_a(s,r,b)=\sqrt{w_{ab}/4}\,D_{ab}(s,r), \qquad C^B_b(s,r,a)=\sqrt{w_{ab}/4}\,D_{ab}(s,r).CaA​(s,r,b)=wab​/4​Dab​(s,r),CbB​(s,r,a)=wab​/4​Dab​(s,r).

For any finite vector family x=(xi)x=(x_i)x=(xi​), let G(x)ij=⟨xi,xj⟩G(x)_{ij}=\langle x_i,x_j\rangleG(x)ij​=⟨xi​,xj​⟩ and

H(x)=Re⁡tr⁡f(G(x)),f(t)=−tlog⁡tlog⁡2,H(x)=\operatorname{Re}\operatorname{tr} f(G(x)), \qquad f(t)=\frac{-t\log t}{\log 2},H(x)=Retrf(G(x)),f(t)=log2−tlogt​,

where f(G(x))f(G(x))f(G(x)) is defined by continuous functional calculus. Define

χ(x,y)=H(z)−H(x)+H(y)2,z(0,i)=xi2,z(1,i)=yi2.\chi(x,y)=H(z)-\frac{H(x)+H(y)}2, \qquad z_{(0,i)}=\frac{x_i}{\sqrt2},\quad z_{(1,i)}=\frac{y_i}{\sqrt2}.χ(x,y)=H(z)−2H(x)+H(y)​,z(0,i)​=2​xi​​,z(1,i)​=2​yi​​.

The defined value is

{χ(E0B,E1B)+χ(C0B,C1B)2,bob=1,χ(E0A,E1A)+χ(C0A,C1A)2,bob=0.\begin{cases} \displaystyle\frac{\chi(E^B_0,E^B_1)+\chi(C^B_0,C^B_1)}2, &\mathrm{bob}=1,\\[6pt] \displaystyle\frac{\chi(E^A_0,E^A_1)+\chi(C^A_0,C^A_1)}2, &\mathrm{bob}=0. \end{cases}⎩⎨⎧​2χ(E0B​,E1B​)+χ(C0B​,C1B​)​,2χ(E0A​,E1A​)+χ(C0A​,C1A​)​,​bob=1,bob=0.​

No normalization or validity conditions are imposed on AAA, and QQQ is unrestricted; real square roots of negative arguments are assigned the value zero.

QAlgorithms.Papers.Independent.Intake100.P92.cowm1Leak

For any finite type III with decidable equality, any families vx,px,b∈CIv_x,p_{x,b}\in\mathbb C^Ivx​,px,b​∈CI indexed by Boolean pairs xxx and Booleans bbb, and any real QQQ, write false and true as 0,10,10,1 and define

K0(s,r)=12 p(s,1),1⊗v(0,r),K1(s,r)=12 v(s,0)⊗p(1,r),0,K_0(s,r)=\frac12\,p_{(s,1),1}\otimes v_{(0,r)}, \qquad K_1(s,r)=\frac12\,v_{(s,0)}\otimes p_{(1,r),0},K0​(s,r)=21​p(s,1),1​⊗v(0,r)​,K1​(s,r)=21​v(s,0)​⊗p(1,r),0​,

with (u⊗v)(i,j)=u(i)v(j)(u\otimes v)(i,j)=u(i)v(j)(u⊗v)(i,j)=u(i)v(j). For a finite vector family xxx, set

G(x)ij=⟨xi,xj⟩,H(x)=Re⁡tr⁡f(G(x)),f(t)=−tlog⁡t/log⁡2,G(x)_{ij}=\langle x_i,x_j\rangle,\qquad H(x)=\operatorname{Re}\operatorname{tr} f(G(x)), \qquad f(t)=-t\log t/\log 2,G(x)ij​=⟨xi​,xj​⟩,H(x)=Retrf(G(x)),f(t)=−tlogt/log2,

using continuous functional calculus, and set

χ(x,y)=H(z)−H(x)+H(y)2,z(0,i)=xi/2,z(1,i)=yi/2.\chi(x,y)=H(z)-\frac{H(x)+H(y)}2, \qquad z_{(0,i)}=x_i/\sqrt2,\quad z_{(1,i)}=y_i/\sqrt2.χ(x,y)=H(z)−2H(x)+H(y)​,z(0,i)​=xi​/2​,z(1,i)​=yi​/2​.

Writing h2(p)=[−plog⁡p−(1−p)log⁡(1−p)]/log⁡2h_2(p)=[-p\log p-(1-p)\log(1-p)]/\log 2h2​(p)=[−plogp−(1−p)log(1−p)]/log2, this definition gives

Q+1−Q2[h2 ⁣(1+∣⟨p(1,0),0,p(0,1),1⟩∣2)+χ(K0,K1)].Q+\frac{1-Q}{2} \left[ h_2\!\left( \frac{1+\left|\langle p_{(1,0),0},p_{(0,1),1}\rangle\right|}{2} \right) +\chi(K_0,K_1) \right].Q+21−Q​[h2​(21+​⟨p(1,0),0​,p(0,1),1​⟩​​)+χ(K0​,K1​)].

There are no normalization hypotheses on the vectors and no restriction on QQQ; logarithms use the total real-logarithm convention, including log⁡0=0\log 0=0log0=0.

QAlgorithms.Papers.Independent.Intake100.P92.cowm2Minimum

For every real μ,V\mu,Vμ,V, this defines the real number

m(μ,V)={0,e−μ≤1−V,e−μ/2V−1−e−μ1−V,e−μ>1−V.m(\mu,V)= \begin{cases} 0,&e^{-\mu}\le1-V,\\ e^{-\mu/2}\sqrt V-\sqrt{1-e^{-\mu}}\sqrt{1-V},&e^{-\mu}>1-V. \end{cases}m(μ,V)={0,e−μ/2V​−1−e−μ​1−V​,​e−μ≤1−V,e−μ>1−V.​

Equality belongs to the first branch. There are no restrictions on μ,V\mu,Vμ,V; real square roots of negative arguments are 000, and the definition itself asserts neither nonnegativity nor any minimizing property.

QAlgorithms.Papers.Independent.Intake100.P92.cowm2Optimum

For arbitrary real μ,V\mu,Vμ,V, this defines two Boolean-indexed families v,p:{0,1}→C4v,p:\{0,1\}\to\mathbb C^4v,p:{0,1}→C4, where 0,10,10,1 mean false and true and e0,…,e3e_0,\ldots,e_3e0​,…,e3​ are standard basis vectors. Put s=e−μs=e^{-\mu}s=e−μ and

c={0,V=0,sV(1−s)(1−V),V≠0 and s≤1−V,1,V≠0 and s>1−V.c= \begin{cases} 0,&V=0,\\ \sqrt{\dfrac{sV}{(1-s)(1-V)}},&V\ne0\ \text{and}\ s\le1-V,\\ 1,&V\ne0\ \text{and}\ s>1-V. \end{cases}c=⎩⎨⎧​0,(1−s)(1−V)sV​​,1,​V=0,V=0 and s≤1−V,V=0 and s>1−V.​

The families are

v1=e0,v0=(e−μ/2,1−s,0,0),p0=e3,p1=(V,−1−V c,1−V1−c2,0).v_1=e_0,\qquad v_0=(e^{-\mu/2},\sqrt{1-s},0,0),\qquad p_0=e_3,\qquad p_1=(\sqrt V,-\sqrt{1-V}\,c,\sqrt{1-V}\sqrt{1-c^2},0).v1​=e0​,v0​=(e−μ/2,1−s​,0,0),p0​=e3​,p1​=(V​,−1−V​c,1−V​1−c2​,0).

Coordinates are embedded in C\mathbb CC. No restrictions or optimality assertions accompany this definition; negative real square-root arguments and division by zero give 000.

QAlgorithms.Papers.Independent.Intake100.P92.crossCorrect

For any type III, let AAA consist of vectors vx∈CIv_x\in\mathbb C^Ivx​∈CI and px,b∈CIp_{x,b}\in\mathbb C^Ipx,b​∈CI, indexed by Boolean pairs xxx and Booleans bbb. Writing false and true as 000 and 111, respectively, this definition assigns to each Boolean aaa a family KaK_aKa​ of vectors in CI×I\mathbb C^{I\times I}CI×I, indexed by Boolean pairs (s,r)(s,r)(s,r), by

Ka(s,r)={12 v(s,0)⊗p(1,r),0,a=1,12 p(s,1),1⊗v(0,r),a=0,(u⊗v)(i,j)=u(i)v(j).K_a(s,r)= \begin{cases} \frac12\,v_{(s,0)}\otimes p_{(1,r),0},&a=1,\\[2pt] \frac12\,p_{(s,1),1}\otimes v_{(0,r)},&a=0, \end{cases} \qquad (u\otimes v)(i,j)=u(i)v(j).Ka​(s,r)={21​v(s,0)​⊗p(1,r),0​,21​p(s,1),1​⊗v(0,r)​,​a=1,a=0,​(u⊗v)(i,j)=u(i)v(j).

There are no finiteness, normalization, or inner-product hypotheses on III or AAA.

QAlgorithms.Papers.Independent.Intake100.P92.crossCow

For any type III, any family A=(vx,px,b)A=(v_x,p_{x,b})A=(vx​,px,b​) of complex vectors indexed by Boolean pairs xxx and Booleans bbb, any real QQQ, and any Boolean aaa, this defines a family of vectors in CI×I\mathbb C^{I\times I}CI×I indexed by Boolean triples (ℓ,r,c)(\ell,r,c)(ℓ,r,c). At coordinate (i,j)(i,j)(i,j) its value is

{1−Q,a=c,Q,a≠c4{v(ℓ,¬a)(i) p(a,r),false(j),c=true,p(ℓ,¬a),true(i) v(a,r)(j),c=false.\sqrt{\frac{\begin{cases}1-Q,&a=c,\\Q,&a\ne c\end{cases}}4} \begin{cases} v_{(\ell,\neg a)}(i)\,p_{(a,r),\mathrm{false}}(j),&c=\mathrm{true},\\ p_{(\ell,\neg a),\mathrm{true}}(i)\,v_{(a,r)}(j),&c=\mathrm{false}. \end{cases}4{1−Q,Q,​a=c,a=c​​​{v(ℓ,¬a)​(i)p(a,r),false​(j),p(ℓ,¬a),true​(i)v(a,r)​(j),​c=true,c=false.​

Here ¬a\neg a¬a is Boolean negation, and the real square root is regarded as a complex scalar. No finiteness, normalization, or bounds on QQQ are imposed; negative square-root arguments give zero.

QAlgorithms.Papers.Independent.Intake100.P92.crossCowB

For any type III, any family A=(vx,px,b)A=(v_x,p_{x,b})A=(vx​,px,b​) of complex vectors indexed by Boolean pairs xxx and Booleans bbb, any real QQQ, and any Boolean bbb, this defines a family of vectors in CI×I\mathbb C^{I\times I}CI×I indexed by Boolean triples (ℓ,r,c)(\ell,r,c)(ℓ,r,c). At coordinate (i,j)(i,j)(i,j) its value is

{1−Q,c=b,Q,c≠b4{v(ℓ,¬c)(i) p(c,r),false(j),b=true,p(ℓ,¬c),true(i) v(c,r)(j),b=false.\sqrt{\frac{\begin{cases}1-Q,&c=b,\\Q,&c\ne b\end{cases}}4} \begin{cases} v_{(\ell,\neg c)}(i)\,p_{(c,r),\mathrm{false}}(j),&b=\mathrm{true},\\ p_{(\ell,\neg c),\mathrm{true}}(i)\,v_{(c,r)}(j),&b=\mathrm{false}. \end{cases}4{1−Q,Q,​c=b,c=b​​​{v(ℓ,¬c)​(i)p(c,r),false​(j),p(ℓ,¬c),true​(i)v(c,r)​(j),​b=true,b=false.​

Here ¬c\neg c¬c is Boolean negation, and the real square root is regarded as a complex scalar. No finiteness, normalization, or bounds on QQQ are imposed; negative square-root arguments give zero.

QAlgorithms.Papers.Independent.Intake100.P92.dps1A

For any index type III, any two Boolean-indexed families of complex coordinate vectors v,p:{0,1}→CIv,p:\{0,1\}\to\mathbb C^Iv,p:{0,1}→CI, and Boolean aaa, written as 0,10,10,1, this defines a family indexed by Boolean pairs:

Aa(s,b)=18((−1)sps⊗vs⊕a+(−1)b+(s⊕a)vs⊗ps⊕a)(s,b∈{0,1}).A_a(s,b)=\frac1{\sqrt8}\left( (-1)^s p_s\otimes v_{s\oplus a} +(-1)^{b+(s\oplus a)}v_s\otimes p_{s\oplus a} \right)\qquad(s,b\in\{0,1\}).Aa​(s,b)=8​1​((−1)sps​⊗vs⊕a​+(−1)b+(s⊕a)vs​⊗ps⊕a​)(s,b∈{0,1}).

The symbol ⊕\oplus⊕ denotes exclusive-or, and tensor products have coordinates (u⊗v)(i,j)=u(i)v(j)(u\otimes v)(i,j)=u(i)v(j)(u⊗v)(i,j)=u(i)v(j). There are no assumptions of finiteness, normalization, or validity.

QAlgorithms.Papers.Independent.Intake100.P92.dps1B

For any index type III, any two Boolean-indexed families of complex coordinate vectors v,p:{0,1}→CIv,p:\{0,1\}\to\mathbb C^Iv,p:{0,1}→CI, and Boolean bbb, written as 0,10,10,1, this defines a family indexed by Boolean pairs:

Bb(s,a)=18((−1)sps⊗vs⊕a+(−1)b+(s⊕a)vs⊗ps⊕a)(s,a∈{0,1}).B_b(s,a)=\frac1{\sqrt8}\left( (-1)^s p_s\otimes v_{s\oplus a} +(-1)^{b+(s\oplus a)}v_s\otimes p_{s\oplus a} \right)\qquad(s,a\in\{0,1\}).Bb​(s,a)=8​1​((−1)sps​⊗vs⊕a​+(−1)b+(s⊕a)vs​⊗ps⊕a​)(s,a∈{0,1}).

The symbol ⊕\oplus⊕ denotes exclusive-or, and tensor products have coordinates (u⊗v)(i,j)=u(i)v(j)(u\otimes v)(i,j)=u(i)v(j)(u⊗v)(i,j)=u(i)v(j). There are no assumptions of finiteness, normalization, or validity.

QAlgorithms.Papers.Independent.Intake100.P92.dps1Joint

For any index type III, any two Boolean-indexed families of complex coordinate vectors v,p:{0,1}→CIv,p:\{0,1\}\to\mathbb C^Iv,p:{0,1}→CI, and Boolean values a,ba,ba,b, written as 0,10,10,1, this defines a Boolean-indexed vector family Ja,bJ_{a,b}Ja,b​ by

Ja,b(s)=18((−1)sps⊗vs⊕a+(−1)b+(s⊕a)vs⊗ps⊕a)(s∈{0,1}).J_{a,b}(s)=\frac1{\sqrt8}\left( (-1)^s p_s\otimes v_{s\oplus a} +(-1)^{b+(s\oplus a)}v_s\otimes p_{s\oplus a} \right)\qquad(s\in\{0,1\}).Ja,b​(s)=8​1​((−1)sps​⊗vs⊕a​+(−1)b+(s⊕a)vs​⊗ps⊕a​)(s∈{0,1}).

Here ⊕\oplus⊕ is exclusive-or, and (u⊗v)(i,j)=u(i)v(j)(u\otimes v)(i,j)=u(i)v(j)(u⊗v)(i,j)=u(i)v(j). No finiteness, normalization, validity, or probability-distribution condition is imposed.

QAlgorithms.Papers.Independent.Intake100.P92.dps1Psi

For any index type III, any two Boolean-indexed families of complex coordinate vectors v,p:{0,1}→CIv,p:\{0,1\}\to\mathbb C^Iv,p:{0,1}→CI, and Boolean values s,w,bs,w,bs,w,b, written as 0,10,10,1, this defines the vector

Ψs,w,b=(−1)s ps⊗vw+(−1)b+w vs⊗pw.\Psi_{s,w,b}=(-1)^s\,p_s\otimes v_w+(-1)^{b+w}\,v_s\otimes p_w.Ψs,w,b​=(−1)sps​⊗vw​+(−1)b+wvs​⊗pw​.

Explicitly, its coordinate at (i,j)∈I×I(i,j)\in I\times I(i,j)∈I×I is

Ψs,w,b(i,j)=(−1)sps(i)vw(j)+(−1)b+wvs(i)pw(j).\Psi_{s,w,b}(i,j)=(-1)^s p_s(i)v_w(j)+(-1)^{b+w}v_s(i)p_w(j).Ψs,w,b​(i,j)=(−1)sps​(i)vw​(j)+(−1)b+wvs​(i)pw​(j).

There is no finiteness, normalization, or validity assumption on I,v,pI,v,pI,v,p.

QAlgorithms.Papers.Independent.Intake100.P92.dps2A

For any index type III, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, with Boolean-pair indices xxx and Boolean indices ccc, and a fixed Boolean aaa, this defines a family indexed by Boolean pairs (s,b)(s,b)(s,b). With σ(false)=1\sigma(\mathrm{false})=1σ(false)=1, σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, and ⊕\oplus⊕ denoting exclusive-or, its coordinate at i∈Ii\in Ii∈I is

18(σ(s) p(s,s⊕a),false(i)+σ(b)σ(s⊕a) p(s,s⊕a),true(i)).\frac{1}{\sqrt8}\left( \sigma(s)\,p_{(s,s\oplus a),\mathrm{false}}(i) +\sigma(b)\sigma(s\oplus a)\,p_{(s,s\oplus a),\mathrm{true}}(i) \right).8​1​(σ(s)p(s,s⊕a),false​(i)+σ(b)σ(s⊕a)p(s,s⊕a),true​(i)).

No finiteness, normalization, or overlap conditions are imposed, and III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dps2B

For any index type III, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, with Boolean-pair indices xxx and Boolean indices ccc, and a fixed Boolean bbb, this defines a family indexed by Boolean pairs (s,w)(s,w)(s,w). Writing σ(false)=1\sigma(\mathrm{false})=1σ(false)=1 and σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, its coordinate at i∈Ii\in Ii∈I is

18(σ(s) p(s,w),false(i)+σ(b)σ(w) p(s,w),true(i)).\frac{1}{\sqrt8}\left( \sigma(s)\,p_{(s,w),\mathrm{false}}(i) +\sigma(b)\sigma(w)\,p_{(s,w),\mathrm{true}}(i) \right).8​1​(σ(s)p(s,w),false​(i)+σ(b)σ(w)p(s,w),true​(i)).

No finiteness, normalization, or overlap conditions are imposed, and III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dps2Joint

For any index type III, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, with Boolean-pair indices xxx and Boolean indices ccc, and fixed Booleans a,ba,ba,b, this defines a Boolean-indexed family of vectors. Let σ(false)=1\sigma(\mathrm{false})=1σ(false)=1, σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, and let ⊕\oplus⊕ denote Boolean exclusive-or. For every Boolean sss and i∈Ii\in Ii∈I, the family has coordinate

18(σ(s) p(s,s⊕a),false(i)+σ(b)σ(s⊕a) p(s,s⊕a),true(i)).\frac{1}{\sqrt8}\left( \sigma(s)\,p_{(s,s\oplus a),\mathrm{false}}(i) +\sigma(b)\sigma(s\oplus a)\,p_{(s,s\oplus a),\mathrm{true}}(i) \right).8​1​(σ(s)p(s,s⊕a),false​(i)+σ(b)σ(s⊕a)p(s,s⊕a),true​(i)).

No finiteness, normalization, or overlap conditions are imposed, and III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dps2Psi

For any type III, any pair-indexed vector data A=(vx,px,b)A=(v_x,p_{x,b})A=(vx​,px,b​) in CI\mathbb C^ICI, and any Booleans s,w,bs,w,bs,w,b, this definition gives the vector

Ψs,w,b=σ(s) p(s,w),0+σ(b)σ(w) p(s,w),1,σ(0)=1,σ(1)=−1,\Psi_{s,w,b} =\sigma(s)\,p_{(s,w),0} +\sigma(b)\sigma(w)\,p_{(s,w),1}, \qquad \sigma(0)=1,\quad \sigma(1)=-1,Ψs,w,b​=σ(s)p(s,w),0​+σ(b)σ(w)p(s,w),1​,σ(0)=1,σ(1)=−1,

where 0,10,10,1 denote false and true. The vectors vxv_xvx​ are not used, and there are no finiteness, normalization, or validity assumptions.

QAlgorithms.Papers.Independent.Intake100.P92.dps4A

For any index type III, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, with Boolean-pair indices xxx and Boolean indices ccc, and a fixed Boolean aaa, this defines a family of vectors indexed by I×II\times II×I, with family indices the Boolean quadruples (s,w,v,b)(s,w,v,b)(s,w,v,b). Let σ(false)=1\sigma(\mathrm{false})=1σ(false)=1, σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, and let ⊕\oplus⊕ denote exclusive-or. Its coordinate at (i,j)(i,j)(i,j) is

132(σ(w) p(s,w),true(i) v(w⊕a,v)(j)+σ(b)σ(w⊕a) v(s,w)(i) p(w⊕a,v),false(j)).\frac{1}{\sqrt{32}}\left( \sigma(w)\,p_{(s,w),\mathrm{true}}(i)\,v_{(w\oplus a,v)}(j) +\sigma(b)\sigma(w\oplus a)\,v_{(s,w)}(i)\, p_{(w\oplus a,v),\mathrm{false}}(j) \right).32​1​(σ(w)p(s,w),true​(i)v(w⊕a,v)​(j)+σ(b)σ(w⊕a)v(s,w)​(i)p(w⊕a,v),false​(j)).

No finiteness, normalization, or overlap conditions are imposed, and III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dps4B

For any index type III, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, with Boolean-pair indices xxx and Boolean indices ccc, and a fixed Boolean bbb, this defines a family of vectors indexed by I×II\times II×I, with family indices the Boolean quadruples (s,w,u,v)(s,w,u,v)(s,w,u,v). Writing σ(false)=1\sigma(\mathrm{false})=1σ(false)=1 and σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, its coordinate at (i,j)(i,j)(i,j) is

132(σ(w) p(s,w),true(i) v(u,v)(j)+σ(b)σ(u) v(s,w)(i) p(u,v),false(j)).\frac{1}{\sqrt{32}}\left( \sigma(w)\,p_{(s,w),\mathrm{true}}(i)\,v_{(u,v)}(j) +\sigma(b)\sigma(u)\,v_{(s,w)}(i)\,p_{(u,v),\mathrm{false}}(j) \right).32​1​(σ(w)p(s,w),true​(i)v(u,v)​(j)+σ(b)σ(u)v(s,w)​(i)p(u,v),false​(j)).

No finiteness, normalization, or overlap conditions are imposed, and III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dps4Joint

For any index type III, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, with Boolean-pair indices xxx and Boolean indices ccc, and fixed Booleans a,ba,ba,b, this defines a family of vectors indexed by I×II\times II×I, with family indices the Boolean triples (s,w,v)(s,w,v)(s,w,v). Let σ(false)=1\sigma(\mathrm{false})=1σ(false)=1, σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, and let ⊕\oplus⊕ denote exclusive-or. The coordinate at (i,j)(i,j)(i,j) is

132(σ(w) p(s,w),true(i) v(w⊕a,v)(j)+σ(b)σ(w⊕a) v(s,w)(i) p(w⊕a,v),false(j)).\frac{1}{\sqrt{32}}\left( \sigma(w)\,p_{(s,w),\mathrm{true}}(i)\,v_{(w\oplus a,v)}(j) +\sigma(b)\sigma(w\oplus a)\,v_{(s,w)}(i)\, p_{(w\oplus a,v),\mathrm{false}}(j) \right).32​1​(σ(w)p(s,w),true​(i)v(w⊕a,v)​(j)+σ(b)σ(w⊕a)v(s,w)​(i)p(w⊕a,v),false​(j)).

No finiteness, normalization, or overlap conditions are imposed, and III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dps4Psi

For any index type III, data AAA consisting of complex vectors vxv_xvx​ and px,cp_{x,c}px,c​ indexed by III, where x∈{false,true}2x\in\{\mathrm{false},\mathrm{true}\}^2x∈{false,true}2 and ccc is Boolean, and Boolean values s,w,u,v,bs,w,u,v,bs,w,u,v,b, this defines a complex vector indexed by I×II\times II×I. Writing σ(false)=1\sigma(\mathrm{false})=1σ(false)=1 and σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, its coordinate at (i,j)(i,j)(i,j) is

σ(w) p(s,w),true(i) v(u,v)(j)+σ(b)σ(u) v(s,w)(i) p(u,v),false(j).\sigma(w)\,p_{(s,w),\mathrm{true}}(i)\,v_{(u,v)}(j) +\sigma(b)\sigma(u)\,v_{(s,w)}(i)\,p_{(u,v),\mathrm{false}}(j).σ(w)p(s,w),true​(i)v(u,v)​(j)+σ(b)σ(u)v(s,w)​(i)p(u,v),false​(j).

There are no finiteness, normalization, or overlap assumptions on III or AAA; III may be empty.

QAlgorithms.Papers.Independent.Intake100.P92.dpsBob

For every α∈C\alpha\in\mathbb Cα∈C, t∈Rt\in\mathbb Rt∈R, and Booleans s,as,as,a, define σ(b)=−1\sigma(b)=-1σ(b)=−1 for true bbb and 111 for false bbb, and set

u=σ(s)t α,v=σ(sxora)t α.u=\sigma(s)\sqrt t\,\alpha,\qquad v=\sigma(s\mathbin{\mathrm{xor}}a)\sqrt t\,\alpha.u=σ(s)t​α,v=σ(sxora)t​α.

This defines the vector C((u+v)/2,(u−v)/2)C((u+v)/2,(u-v)/2)C((u+v)/2,(u−v)/2) in ℓ2(N2;C)\ell^2(\mathbb N^2;\mathbb C)ℓ2(N2;C), where xor records whether its arguments differ and

C(x,y)m,n=e−∣x∣2/2xmm! e−∣y∣2/2ynn!C(x,y)_{m,n} =\frac{e^{-|x|^2/2}x^m}{\sqrt{m!}}\, \frac{e^{-|y|^2/2}y^n}{\sqrt{n!}}C(x,y)m,n​=m!​e−∣x∣2/2xm​n!​e−∣y∣2/2yn​

for all m,n∈Nm,n\in\mathbb Nm,n∈N if this coefficient array is square summable, with C(x,y)C(x,y)C(x,y) defined as zero otherwise. The square root of ttt is real, so for t≤0t\leq0t≤0, u=v=0u=v=0u=v=0 and the result is C(0,0)C(0,0)C(0,0); no interval restriction on ttt is imposed.

QAlgorithms.Papers.Independent.Intake100.P92.dpsE

For every α∈C\alpha\in\mathbb Cα∈C, t∈Rt\in\mathbb Rt∈R, and Boolean aaa, this defines a Boolean-indexed family of vectors in ℓ2(N2;C)\ell^2(\mathbb N^2;\mathbb C)ℓ2(N2;C). Write σ(b)=−1\sigma(b)=-1σ(b)=−1 for true bbb and σ(b)=1\sigma(b)=1σ(b)=1 for false bbb, and put β=1−t α\beta=\sqrt{1-t}\,\alphaβ=1−t​α, with a real square root. For each Boolean sss, the family has value

12 C ⁣(σ(s)β,σ(sxora)β),\frac{1}{\sqrt2}\,C\!\left(\sigma(s)\beta,\sigma(s\mathbin{\mathrm{xor}}a)\beta\right),2​1​C(σ(s)β,σ(sxora)β),

where xor is true exactly when its Boolean arguments differ, and C(u,v)C(u,v)C(u,v) is the vector with coefficients

C(u,v)m,n=e−∣u∣2/2umm! e−∣v∣2/2vnn!(m,n∈N)C(u,v)_{m,n} =\frac{e^{-|u|^2/2}u^m}{\sqrt{m!}}\, \frac{e^{-|v|^2/2}v^n}{\sqrt{n!}} \quad(m,n\in\mathbb N)C(u,v)m,n​=m!​e−∣u∣2/2um​n!​e−∣v∣2/2vn​(m,n∈N)

if this array is square summable, and zero otherwise. The factor 1/21/\sqrt21/2​ multiplies the whole vector. No restriction on ttt is imposed; when t≥1t\geq1t≥1, the value at either sss is C(0,0)/2C(0,0)/\sqrt2C(0,0)/2​.

QAlgorithms.Papers.Independent.Intake100.P92.dpsHerald

For every α∈C\alpha\in\mathbb Cα∈C, t,η∈Rt,\eta\in\mathbb Rt,η∈R, and Booleans a,ba,ba,b, this defines a complex matrix indexed by N2×N2\mathbb N^2\times\mathbb N^2N2×N2. Write σ(c)=−1\sigma(c)=-1σ(c)=−1 for true ccc and 111 for false ccc, and let C(u,v)C(u,v)C(u,v) be the vector with coefficients

C(u,v)m,n=e−∣u∣2/2umm! e−∣v∣2/2vnn!C(u,v)_{m,n} =\frac{e^{-|u|^2/2}u^m}{\sqrt{m!}}\, \frac{e^{-|v|^2/2}v^n}{\sqrt{n!}}C(u,v)m,n​=m!​e−∣u∣2/2um​n!​e−∣v∣2/2vn​

if this array is square summable, and zero otherwise. For each Boolean sss, put

us=σ(s)t α,vs=σ(sxora)t α,Bs=C ⁣(us+vs2,us−vs2),Es=C ⁣(σ(s)1−t α,σ(sxora)1−t α),u_s=\sigma(s)\sqrt t\,\alpha,\quad v_s=\sigma(s\mathbin{\mathrm{xor}}a)\sqrt t\,\alpha,\quad B_s=C\!\left(\frac{u_s+v_s}{2},\frac{u_s-v_s}{2}\right),\quad E_s=C\!\left(\sigma(s)\sqrt{1-t}\,\alpha,\sigma(s\mathbin{\mathrm{xor}}a)\sqrt{1-t}\,\alpha\right),us​=σ(s)t​α,vs​=σ(sxora)t​α,Bs​=C(2us​+vs​​,2us​−vs​​),Es​=C(σ(s)1−t​α,σ(sxora)1−t​α),

where xor is true exactly when its arguments differ. For n=(n1,n2)n=(n_1,n_2)n=(n1​,n2​), define wη,b(n)=(1−η)n1(1−(1−η)n2)w_{\eta,b}(n)=(1-\eta)^{n_1}(1-(1-\eta)^{n_2})wη,b​(n)=(1−η)n1​(1−(1−η)n2​) if bbb is true and wη,b(n)=(1−(1−η)n1)(1−η)n2w_{\eta,b}(n)=(1-(1-\eta)^{n_1})(1-\eta)^{n_2}wη,b​(n)=(1−(1−η)n1​)(1−η)n2​ otherwise. For all i,j∈N2i,j\in\mathbb N^2i,j∈N2, the entry is

12∑s∈{false,true}∑n∈N2wη,b(n)((Bs)n(Es)i)((Bs)n(Es)j)‾.\frac12\sum_{s\in\{\mathrm{false},\mathrm{true}\}} \sum_{n\in\mathbb N^2} w_{\eta,b}(n)\bigl((B_s)_n(E_s)_i\bigr) \overline{\bigl((B_s)_n(E_s)_j\bigr)}.21​s∈{false,true}∑​n∈N2∑​wη,b​(n)((Bs​)n​(Es​)i​)((Bs​)n​(Es​)j​)​.

Each infinite sum is zero if its complex summand family is not summable. Both square roots are real and vanish on nonpositive arguments; ttt and η\etaη are unrestricted, and zeroth powers, including 000^000, equal 111.

QAlgorithms.Papers.Independent.Intake100.P92.dpsIdealLeak

For every real μ\muμ, this definition gives

LDPS(μ)=2H2 ⁣(1−e−2μ2)−H2 ⁣(1−e−4μ2),L_{\mathrm{DPS}}(\mu) =2H_2\!\left(\frac{1-e^{-2\mu}}2\right) -H_2\!\left(\frac{1-e^{-4\mu}}2\right),LDPS​(μ)=2H2​(21−e−2μ​)−H2​(21−e−4μ​),

where H2(p)=binEntropy⁡(p)/log⁡2H_2(p)=\operatorname{binEntropy}(p)/\log2H2​(p)=binEntropy(p)/log2 is real binary entropy in bits. No restriction on μ\muμ is imposed. In particular, negative arguments arising when μ<0\mu<0μ<0 are evaluated using the total expression (−plog⁡p−(1−p)log⁡(1−p))/log⁡2\bigl(-p\log p-(1-p)\log(1-p)\bigr)/\log2(−plogp−(1−p)log(1−p))/log2, where the real logarithm is log⁡∣x∣\log|x|log∣x∣ away from zero and is 000 at zero.

QAlgorithms.Papers.Independent.Intake100.P92.dpsInfo

For any finite index type III with decidable equality, data A=(vx,px,c)A=(v_x,p_{x,c})A=(vx​,px,c​) of complex vectors indexed by III, and Boolean bob\mathrm{bob}bob, this defines the following real number. Put σ(false)=1\sigma(\mathrm{false})=1σ(false)=1, σ(true)=−1\sigma(\mathrm{true})=-1σ(true)=−1, let ⊕\oplus⊕ denote exclusive-or, and define vectors by their coordinates:

F2(s,w,b)(i)=σ(s)p(s,w),false(i)+σ(b)σ(w)p(s,w),true(i),F4(s,w,u,v,b)(i,j)=σ(w)p(s,w),true(i)v(u,v)(j)+σ(b)σ(u)v(s,w)(i)p(u,v),false(j).\begin{aligned} F_2(s,w,b)(i) &=\sigma(s)p_{(s,w),\mathrm{false}}(i) +\sigma(b)\sigma(w)p_{(s,w),\mathrm{true}}(i),\\ F_4(s,w,u,v,b)(i,j) &=\sigma(w)p_{(s,w),\mathrm{true}}(i)v_{(u,v)}(j) +\sigma(b)\sigma(u)v_{(s,w)}(i)p_{(u,v),\mathrm{false}}(j). \end{aligned}F2​(s,w,b)(i)F4​(s,w,u,v,b)(i,j)​=σ(s)p(s,w),false​(i)+σ(b)σ(w)p(s,w),true​(i),=σ(w)p(s,w),true​(i)v(u,v)​(j)+σ(b)σ(u)v(s,w)​(i)p(u,v),false​(j).​

Define the finite vector families

E2Aa(s,b)=F2(s,s⊕a,b)/8,E2Bb(s,w)=F2(s,w,b)/8,E4Aa(s,w,v,b)=F4(s,w,w⊕a,v,b)/32,E4Bb(s,w,u,v)=F4(s,w,u,v,b)/32.\begin{aligned} E_{2A}^{a}(s,b)&=F_2(s,s\oplus a,b)/\sqrt8,& E_{2B}^{b}(s,w)&=F_2(s,w,b)/\sqrt8,\\ E_{4A}^{a}(s,w,v,b)&=F_4(s,w,w\oplus a,v,b)/\sqrt{32},& E_{4B}^{b}(s,w,u,v)&=F_4(s,w,u,v,b)/\sqrt{32}. \end{aligned}E2Aa​(s,b)E4Aa​(s,w,v,b)​=F2​(s,s⊕a,b)/8​,=F4​(s,w,w⊕a,v,b)/32​,​E2Bb​(s,w)E4Bb​(s,w,u,v)​=F2​(s,w,b)/8​,=F4​(s,w,u,v,b)/32​.​

For any finite vector family x=(xr)x=(x_r)x=(xr​), let Gx(r,t)=⟨xr,xt⟩CG_x(r,t)=\langle x_r,x_t\rangle_{\mathbb C}Gx​(r,t)=⟨xr​,xt​⟩C​ and

H(x)=Re⁡tr⁡f(Gx),f(z)=−zlog⁡zlog⁡2,H(x)=\operatorname{Re}\operatorname{tr} f(G_x), \qquad f(z)=-\frac{z\log z}{\log2},H(x)=Retrf(Gx​),f(z)=−log2zlogz​,

where f(Gx)f(G_x)f(Gx​) is defined by continuous functional calculus, with f(0)=0f(0)=0f(0)=0. For two families with the same index set, set

χ(x,y)=H ⁣((xr/2)false,r,(yr/2)true,r)−H(x)2−H(y)2.\chi(x,y)=H\!\left((x_r/\sqrt2)_{\mathrm{false},r}, (y_r/\sqrt2)_{\mathrm{true},r}\right) -\frac{H(x)}2-\frac{H(y)}2.χ(x,y)=H((xr​/2​)false,r​,(yr​/2​)true,r​)−2H(x)​−2H(y)​.

The defined value is

{χ(E2Bfalse,E2Btrue)+χ(E4Bfalse,E4Btrue)2,bob=true,χ(E2Afalse,E2Atrue)+χ(E4Afalse,E4Atrue)2,bob=false.\begin{cases} \displaystyle\frac{\chi(E_{2B}^{\mathrm{false}},E_{2B}^{\mathrm{true}}) +\chi(E_{4B}^{\mathrm{false}},E_{4B}^{\mathrm{true}})}2, &\mathrm{bob}=\mathrm{true},\\[6pt] \displaystyle\frac{\chi(E_{2A}^{\mathrm{false}},E_{2A}^{\mathrm{true}}) +\chi(E_{4A}^{\mathrm{false}},E_{4A}^{\mathrm{true}})}2, &\mathrm{bob}=\mathrm{false}. \end{cases}⎩⎨⎧​2χ(E2Bfalse​,E2Btrue​)+χ(E4Bfalse​,E4Btrue​)​,2χ(E2Afalse​,E2Atrue​)+χ(E4Afalse​,E4Atrue​)​,​bob=true,bob=false.​

No normalization or overlap assumptions are imposed on AAA; the definition includes empty III.

QAlgorithms.Papers.Independent.Intake100.P92.dpsOneFamily

For arbitrary real numbers μ,V,θ,ϕ\mu,V,\theta,\phiμ,V,θ,ϕ and arbitrary bit-indexed real families θs,ϕs\theta_s,\phi_sθs​,ϕs​, this definition produces two bit-indexed families vs,ps∈C4v_s,p_s\in\mathbb C^4vs​,ps​∈C4. Set

g=e−2μ,a=1+g2,b=1−g2,ϵs=(−1)s,g=e^{-2\mu},\qquad a=\sqrt{\frac{1+g}{2}},\qquad b=\sqrt{\frac{1-g}{2}},\qquad \epsilon_s=(-1)^s,g=e−2μ,a=21+g​​,b=21−g​​,ϵs​=(−1)s, vs=(a,ϵsb,0,0),rs=(b,−ϵsa,0,0),ws=eiϵsϕ/2(0,0,cos⁡(θ/2),ϵssin⁡(θ/2)).v_s=(a,\epsilon_s b,0,0),\qquad r_s=(b,-\epsilon_s a,0,0),\qquad w_s=e^{i\epsilon_s\phi/2}(0,0,\cos(\theta/2),\epsilon_s\sin(\theta/2)).vs​=(a,ϵs​b,0,0),rs​=(b,−ϵs​a,0,0),ws​=eiϵs​ϕ/2(0,0,cos(θ/2),ϵs​sin(θ/2)).

The returned data have first family vsv_svs​ and second family

ps=V vs−1−Vcos⁡(θs)eiϕsrs−1−Vsin⁡(θs)ws.p_s=\sqrt V\,v_s-\sqrt{1-V}\cos(\theta_s)e^{i\phi_s}r_s -\sqrt{1-V}\sin(\theta_s)w_s.ps​=V​vs​−1−V​cos(θs​)eiϕs​rs​−1−V​sin(θs​)ws​.

All real coordinates and scalars are regarded as complex numbers where needed. There are no restrictions on these parameters and no normalization assertion in the definition; real square roots of negative arguments take the value 000.

QAlgorithms.Papers.Independent.Intake100.P92.dpsOutput

For any type III, any vector data A=(vx,px,b)A=(v_x,p_{x,b})A=(vx​,px,b​) in CI\mathbb C^ICI indexed by Boolean pairs x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​) and Booleans bbb, any real μ,t\mu,tμ,t, and any Boolean pair xxx, this definition returns a function on {0,1,2}×I\{0,1,2\}\times I{0,1,2}×I with complex values:

Ox(k,i)={vx(i),k=0,σ(x1)μt px,0(i),k=1,σ(x2)μt px,1(i),k=2,σ(0)=1,σ(1)=−1,O_x(k,i)= \begin{cases} v_x(i),&k=0,\\ \sigma(x_1)\sqrt{\mu t}\,p_{x,0}(i),&k=1,\\ \sigma(x_2)\sqrt{\mu t}\,p_{x,1}(i),&k=2, \end{cases} \qquad \sigma(0)=1,\quad \sigma(1)=-1,Ox​(k,i)=⎩⎨⎧​vx​(i),σ(x1​)μt​px,0​(i),σ(x2​)μt​px,1​(i),​k=0,k=1,k=2,​σ(0)=1,σ(1)=−1,

where 0,10,10,1 denote false and true and the square root is real, then embedded in C\mathbb CC. No finiteness, normalization, validity, or sign assumptions are imposed; if μt<0\mu t<0μt<0, the real square root used here is zero.

QAlgorithms.Papers.Independent.Intake100.P92.dpsPhaseSign

For every Boolean bbb, this defines a complex number equal to −1-1−1 when bbb is true and 111 when bbb is false.

QAlgorithms.Papers.Independent.Intake100.P92.dpsRate

For every α∈C\alpha\in\mathbb Cα∈C and t,η∈Rt,\eta\in\mathbb Rt,η∈R, this defines

RDPS(α,t,η)=(1−e−∣α∣2tη)(1−χ(E0,E1)).R_{\mathrm{DPS}}(\alpha,t,\eta) =\bigl(1-e^{-|\alpha|^2t\eta}\bigr)\bigl(1-\chi(E_0,E_1)\bigr).RDPS​(α,t,η)=(1−e−∣α∣2tη)(1−χ(E0​,E1​)).

Here F=ℓ2(N2;C)F=\ell^2(\mathbb N^2;\mathbb C)F=ℓ2(N2;C), ca(n)=e−∣a∣2/2an/n!c_a(n)=e^{-|a|^2/2}a^n/\sqrt{n!}ca​(n)=e−∣a∣2/2an/n!​, and C(a,b)C(a,b)C(a,b) is the vector with coefficients ca(m)cb(n)c_a(m)c_b(n)ca​(m)cb​(n) when these are square summable, and zero otherwise. Identifying Boolean values with 0,10,10,1, put σ(s)=(−1)s\sigma(s)=(-1)^sσ(s)=(−1)s and e=1−t αe=\sqrt{1-t}\,\alphae=1−t​α; the two families, each indexed by s∈{0,1}s\in\{0,1\}s∈{0,1}, are

Ea(s)=12C(σ(s)e,σ(sxora)e).E_a(s)=\frac1{\sqrt2}C\bigl(\sigma(s)e,\sigma(s\mathbin{\mathrm{xor}}a)e\bigr).Ea​(s)=2​1​C(σ(s)e,σ(sxora)e).

For a finite vector family xxx, define Gx=(⟨xi,xj⟩)i,jG_x=(\langle x_i,x_j\rangle)_{i,j}Gx​=(⟨xi​,xj​⟩)i,j​ and H(x)=Re⁡tr⁡f(Gx)H(x)=\operatorname{Re}\operatorname{tr}f(G_x)H(x)=Retrf(Gx​), where f(u)=−ulog⁡u/log⁡2f(u)=-u\log u/\log2f(u)=−ulogu/log2 is applied by continuous functional calculus; then χ(x,y)=H((xi/2)i,(yi/2)i)−(H(x)+H(y))/2\chi(x,y)=H((x_i/\sqrt2)_i,(y_i/\sqrt2)_i)-(H(x)+H(y))/2χ(x,y)=H((xi​/2​)i​,(yi​/2​)i​)−(H(x)+H(y))/2. The combined family is indexed by two Boolean coordinates. No bounds on ttt or η\etaη, and no nonzero condition on α\alphaα, are imposed; real square roots of nonpositive numbers and the real logarithm at zero have value zero.

QAlgorithms.Papers.Independent.Intake100.P92.dpsRestricted

For arbitrary real μ,V\mu,Vμ,V and arbitrary vectors wx,b∈C6w_{x,b}\in\mathbb C^6wx,b​∈C6, indexed by a bit pair x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​) and a bit bbb, set g=e−2μg=e^{-2\mu}g=e−2μ, c=(1−g2)/2c=\sqrt{(1-g^2)/2}c=(1−g2)/2​, and

vx=(1+g2,(−1)1x1≠x21−g2,1x1=x2(−1)x1c,1x1≠x2(−1)x1c,0,0).v_x=\left( \frac{1+g}{2}, (-1)^{\mathbf1_{x_1\ne x_2}}\frac{1-g}{2}, \mathbf1_{x_1=x_2}(-1)^{x_1}c, \mathbf1_{x_1\ne x_2}(-1)^{x_1}c, 0,0\right).vx​=(21+g​,(−1)1x1​=x2​​21−g​,1x1​=x2​​(−1)x1​c,1x1​=x2​​(−1)x1​c,0,0).

This definition returns data whose first family is vxv_xvx​ and whose second family is

px,b=V vx−1−V wx,b.p_{x,b}=\sqrt V\,v_x-\sqrt{1-V}\,w_{x,b}.px,b​=V​vx​−1−V​wx,b​.

The real entries and coefficients are embedded in C\mathbb CC. No normalization, orthogonality, reality, or parameter bounds are imposed by this definition, and real square roots of negative arguments are 000.

QAlgorithms.Papers.Independent.Intake100.P92.dpsRestrictedVacuum

For any real μ\muμ and any pair of bits x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​), put g=e−2μg=e^{-2\mu}g=e−2μ and c=(1−g2)/2c=\sqrt{(1-g^2)/2}c=(1−g2)/2​. This definition returns the vector in C6\mathbb C^6C6

vx=(1+g2,{(1−g)/2,x1=x2,−(1−g)/2,x1≠x2,{(−1)x1c,x1=x2,0,x1≠x2,{0,x1=x2,$−1)x1c,x1≠x2,0,0),v_x= \left( \frac{1+g}{2}, \begin{cases}(1-g)/2,&x_1=x_2,\\-(1-g)/2,&x_1\ne x_2,\end{cases} \begin{cases}(-1)^{x_1}c,&x_1=x_2,\\0,&x_1\ne x_2,\end{cases} \begin{cases}0,&x_1=x_2,\$-1)^{x_1}c,&x_1\ne x_2,\end{cases} 0,0 \right),vx​=(21+g​,{(1−g)/2,−(1−g)/2,​x1​=x2​,x1​=x2​,​{(−1)x1​c,0,​x1​=x2​,x1​=x2​,​{0,​x1​=x2​,$−1)x1​c,​x1​=x2​,​0,0),

with the displayed real coordinates embedded in (\mathbb C.Nosignrestrictionon. No sign restriction on .Nosignrestrictionon\muornormalizationassertionispartofthedefinition;therealsquarerootisor normalization assertion is part of the definition; the real square root isornormalizationassertionispartofthedefinition;therealsquarerootis0$ when its argument is negative.

QAlgorithms.Papers.Independent.Intake100.P92.dw

For arbitrary real numbers sift,Q,χA,χB\mathrm{sift},Q,\chi_A,\chi_Bsift,Q,χA​,χB​, this defines

dw(sift,Q,χA,χB)=sift(1−binEntropy⁡(Q)log⁡2−min⁡{χA,χB}),\mathrm{dw}(\mathrm{sift},Q,\chi_A,\chi_B) =\mathrm{sift}\left(1-\frac{\operatorname{binEntropy}(Q)}{\log 2}-\min\{\chi_A,\chi_B\}\right),dw(sift,Q,χA​,χB​)=sift(1−log2binEntropy(Q)​−min{χA​,χB​}),

where binEntropy⁡(Q)=−Qlog⁡Q−(1−Q)log⁡(1−Q)\operatorname{binEntropy}(Q)=-Q\log Q-(1-Q)\log(1-Q)binEntropy(Q)=−QlogQ−(1−Q)log(1−Q). The real logarithm is total: log⁡0=0\log 0=0log0=0, and log⁡x=log⁡∣x∣\log x=\log|x|logx=log∣x∣ for negative xxx. No range or sign restrictions are imposed on any of the four arguments, including QQQ.

QAlgorithms.Papers.Independent.Intake100.P92.ensembleDensityCoefficients

For any finite type III, any type JJJ, and any family of complex-valued functions x:I→(J→C)x:I\to(J\to\mathbb C)x:I→(J→C), this defines the complex matrix indexed by J×JJ\times JJ×J with entries

Djk=∑i∈Ixi(j) xi(k)‾.D_{jk}=\sum_{i\in I}x_i(j)\,\overline{x_i(k)}.Djk​=i∈I∑​xi​(j)xi​(k)​.

There is no finiteness assumption on JJJ, no summability or normalization assumption on the functions, and an empty III gives the zero matrix.

QAlgorithms.Papers.Independent.Intake100.P92.ensembleEntropyBits

For any finite type III with decidable equality, any normed additive commutative group HHH equipped with a complex inner-product-space structure, and any family x:I→Hx:I\to Hx:I→H, form Gij=⟨xi,xj⟩G_{ij}=\langle x_i,x_j\rangleGij​=⟨xi​,xj​⟩. This defines

Re⁡tr⁡(f(G)),f(z)=−zlog⁡zlog⁡2,\operatorname{Re}\operatorname{tr}\bigl(f(G)\bigr), \qquad f(z)=\frac{-z\log z}{\log2},Retr(f(G)),f(z)=log2−zlogz​,

where f(G)f(G)f(G) is given by the continuous functional calculus for the real function fff. Equivalently, it is ∑i−λilog⁡(λi)/log⁡2\sum_i-\lambda_i\log(\lambda_i)/\log2∑i​−λi​log(λi​)/log2, where the λi\lambda_iλi​ are the eigenvalues of GGG, counted with multiplicity; the contribution at zero is zero. No normalization of the family is required, and an empty index type gives zero.

QAlgorithms.Papers.Independent.Intake100.P92.equiprobableEnsemble

For any types I,HI,HI,H, any specified scalar-multiplication operation of C\mathbb CC on HHH, and any two families x,y:I→Hx,y:I\to Hx,y:I→H, this defines the family indexed by Bool×I\mathrm{Bool}\times IBool×I whose value at (false,i)(\mathrm{false},i)(false,i) is 1/2 xi\sqrt{1/2}\,x_i1/2​xi​ and whose value at (true,i)(\mathrm{true},i)(true,i) is 1/2 yi\sqrt{1/2}\,y_i1/2​yi​, using the real square root embedded into C\mathbb CC. No finiteness, norm, inner product, or scalar-action axioms are assumed.

QAlgorithms.Papers.Independent.Intake100.P92.errorIndex

For every Boolean pair x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​) and Boolean bbb, this defines an index in {0,1,2,3}\{0,1,2,3\}{0,1,2,3} by

{0,x=(false,false), b=false,1,x=(false,false), b=true,2,x1=true,3,x=(false,true).\begin{cases} 0,&x=(\mathrm{false},\mathrm{false}),\ b=\mathrm{false},\\ 1,&x=(\mathrm{false},\mathrm{false}),\ b=\mathrm{true},\\ 2,&x_1=\mathrm{true},\\ 3,&x=(\mathrm{false},\mathrm{true}). \end{cases}⎩⎨⎧​0,1,2,3,​x=(false,false), b=false,x=(false,false), b=true,x1​=true,x=(false,true).​

In the last two cases the index does not depend on bbb.

QAlgorithms.Papers.Independent.Intake100.P92.errorSlot

For every Boolean pair x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​) and Boolean bbb, this defines the negation of the selected coordinate: ¬x1\neg x_1¬x1​ if b=falseb=\mathrm{false}b=false, and ¬x2\neg x_2¬x2​ if b=trueb=\mathrm{true}b=true. Thus its value is true exactly when the selected coordinate is false.

QAlgorithms.Papers.Independent.Intake100.P92.eveAmplitude

For every complex number α\alphaα and real number ttt, this defines

eveAmplitude(α,t)=1−t α,\mathrm{eveAmplitude}(\alpha,t)=\sqrt{1-t}\,\alpha,eveAmplitude(α,t)=1−t​α,

with the square root taken in the reals and then embedded into the complex numbers. There is no restriction on ttt; the real square root is zero for nonpositive arguments, so the result is zero whenever t≥1t\geq1t≥1.

QAlgorithms.Papers.Independent.Intake100.P92.flaggedOne

For any type III and any Boolean-indexed vector families A=(vb,pb)A=(v_b,p_b)A=(vb​,pb​) in CI\mathbb C^ICI, this definition produces two families in CI⊔{0,1,2,3}\mathbb C^{I\sqcup\{0,1,2,3\}}CI⊔{0,1,2,3}. Let ι\iotaι extend an III-indexed vector by zero on the four new indices, and let e0e_0e0​ have value one at the new index 000 and zero everywhere else. Writing false and true as 0,10,10,1, the output is

v~b=ιvbfor both b,p~1=ιp1,p~0=e0.\widetilde v_b=\iota v_b\quad\text{for both }b,\qquad \widetilde p_1=\iota p_1,\qquad \widetilde p_0=e_0.vb​=ιvb​for both b,p​1​=ιp1​,p​0​=e0​.

Thus the original vector p0p_0p0​ is not used in the output. No finiteness or normalization assumptions are required.

QAlgorithms.Papers.Independent.Intake100.P92.flaggedPair

For any type III, let AAA consist of vectors vx∈CIv_x\in\mathbb C^Ivx​∈CI for Boolean pairs xxx and vectors px,b∈CIp_{x,b}\in\mathbb C^Ipx,b​∈CI for Boolean pairs xxx and Booleans bbb. This defines corresponding vectors on I⊔{0,1,2,3}I\sqcup\{0,1,2,3\}I⊔{0,1,2,3}. Every vxv_xvx​ is extended by four zero coordinates. Write xb=x1x_b=x_1xb​=x1​ when b=falseb=\mathrm{false}b=false and xb=x2x_b=x_2xb​=x2​ when b=trueb=\mathrm{true}b=true. If xb=truex_b=\mathrm{true}xb​=true, then px,bp_{x,b}px,b​ is also extended by four zero coordinates; if xb=falsex_b=\mathrm{false}xb​=false, it is replaced by the vector zero on III and equal to a standard basis vector in the added four coordinates. The basis index is 000 or 111 according as bbb is false or true when x=(false,false)x=(\mathrm{false},\mathrm{false})x=(false,false), is 222 when x1=truex_1=\mathrm{true}x1​=true, and is 333 otherwise. These replacements are defined without assumptions on the original vectors.

QAlgorithms.Papers.Independent.Intake100.P92.gammaE

For every complex number α\alphaα and real number ttt, this defines the real number

γE(α,t)=exp⁡ ⁣(−∣α∣2(1−t)),\gamma_E(\alpha,t)=\exp\!\left(-|\alpha|^2(1-t)\right),γE​(α,t)=exp(−∣α∣2(1−t)),

where ∣α∣2=(Re⁡α)2+(Im⁡α)2|\alpha|^2=(\operatorname{Re}\alpha)^2+(\operatorname{Im}\alpha)^2∣α∣2=(Reα)2+(Imα)2. No restriction on ttt or α\alphaα is imposed; in particular, the value is 111 if α=0\alpha=0α=0 or t=1t=1t=1.

QAlgorithms.Papers.Independent.Intake100.P92.herald

For every real η\etaη, Boolean bbb, and arbitrary vectors bob,eve∈ℓ2(N2;C)\mathrm{bob},\mathrm{eve}\in\ell^2(\mathbb N^2;\mathbb C)bob,eve∈ℓ2(N2;C), this defines a complex matrix indexed by N2×N2\mathbb N^2\times\mathbb N^2N2×N2. For n=(n1,n2)n=(n_1,n_2)n=(n1​,n2​), put

wη,b(n)={(1−η)n1(1−(1−η)n2),b=true,(1−(1−η)n1)(1−η)n2,b=false.w_{\eta,b}(n)= \begin{cases} (1-\eta)^{n_1}\bigl(1-(1-\eta)^{n_2}\bigr),&b=\mathrm{true},\\ \bigl(1-(1-\eta)^{n_1}\bigr)(1-\eta)^{n_2},&b=\mathrm{false}. \end{cases}wη,b​(n)={(1−η)n1​(1−(1−η)n2​),(1−(1−η)n1​)(1−η)n2​,​b=true,b=false.​

For every i,j∈N2i,j\in\mathbb N^2i,j∈N2, the matrix entry is

∑n∈N2wη,b(n) (bobn evei)(bobn evej)‾,\sum_{n\in\mathbb N^2} w_{\eta,b}(n)\, \bigl(\mathrm{bob}_n\,\mathrm{eve}_i\bigr) \overline{\bigl(\mathrm{bob}_n\,\mathrm{eve}_j\bigr)},n∈N2∑​wη,b​(n)(bobn​evei​)(bobn​evej​)​,

with the real weight embedded into C\mathbb CC. Neither vector is required to have unit norm, and η\etaη is unrestricted. The infinite sum is the total mathematical sum used by the code: if its complex summand family is not summable, that entry is zero; occupation zero uses the convention x0=1x^0=1x0=1, including 00=10^0=100=1.

QAlgorithms.Papers.Independent.Intake100.P92.idealBitLaw

This defines a real-valued function on ordered pairs of Boolean values by

idealBitLaw(a,b)={12,a=b,0,a≠b.idealBitLaw(a,b)= \begin{cases} \frac12,&a=b,\\ 0,&a\ne b. \end{cases}idealBitLaw(a,b)={21​,0,​a=b,a=b.​

Equivalently, with false indexed by 000 and true by 111, its table is (1/2001/2)\begin{pmatrix}1/2&0\\0&1/2\end{pmatrix}(1/20​01/2​).

QAlgorithms.Papers.Independent.Intake100.P92.idealSiftingCoefficient

For an index scheme∈{0,1,2,3,4}scheme\in\{0,1,2,3,4\}scheme∈{0,1,2,3,4} and any real μ\muμ, this defines

idealSiftingCoefficient(scheme,μ)={μ/2,scheme<3,μ2∑a,b∈{0,1}{14,a≠b,0,a=b,scheme≥3.idealSiftingCoefficient(scheme,\mu)= \begin{cases} \mu/2,&scheme<3,\\[2pt] \displaystyle\frac{\mu}{2}\sum_{a,b\in\{0,1\}} \begin{cases}\frac14,&a\ne b,\\0,&a=b,\end{cases} &scheme\ge3. \end{cases}idealSiftingCoefficient(scheme,μ)=⎩⎨⎧​μ/2,2μ​a,b∈{0,1}∑​{41​,0,​a=b,a=b,​​scheme<3,scheme≥3.​

Thus its value is μ/2\mu/2μ/2 for indices 0,1,20,1,20,1,2 and μ/4\mu/4μ/4 for indices 3,43,43,4. The definition imposes no sign restriction on μ\muμ.

QAlgorithms.Papers.Independent.Intake100.P92.keyPair

For every Boolean aaa, this defines the Boolean pair (¬a,a)(\neg a,a)(¬a,a), where ¬\neg¬ denotes Boolean negation. Its value is (true,false)(\mathrm{true},\mathrm{false})(true,false) when a=falsea=\mathrm{false}a=false and (false,true)(\mathrm{false},\mathrm{true})(false,true) when a=truea=\mathrm{true}a=true.

QAlgorithms.Papers.Independent.Intake100.P92.liftVec

For any type III and complex coordinate vector v∈CIv\in\mathbb C^Iv∈CI, this defines a vector on the disjoint union I⊔{0,1,2,3}I\sqcup\{0,1,2,3\}I⊔{0,1,2,3} whose coordinate at the copy of i∈Ii\in Ii∈I is v(i)v(i)v(i) and whose four added coordinates are all zero. No finiteness or normalization assumption on III or vvv is imposed.

QAlgorithms.Papers.Independent.Intake100.P92.oneFamilyVectors

For any type III, let AAA consist of bit-indexed vectors vs,ps∈CIv_s,p_s\in\mathbb C^Ivs​,ps​∈CI, with their Euclidean-space interpretation, and let z∈Cz\in\mathbb Cz∈C be arbitrary. This definition returns the family indexed by two bits (r,s)(r,s)(r,s) given by

xr,s={vs,r=0,z ps,r=1.x_{r,s}= \begin{cases} v_s,&r=0,\\ z\,p_s,&r=1. \end{cases}xr,s​={vs​,zps​,​r=0,r=1.​

No finiteness assumption on III, normalization condition on the vectors, or restriction on zzz is imposed; in particular, z=0z=0z=0 is allowed.

QAlgorithms.Papers.Independent.Intake100.P92.oneToPair

For any type III and any Boolean-indexed vector families A=(vb,pb)A=(v_b,p_b)A=(vb​,pb​) in CI\mathbb C^ICI, this definition produces pair-indexed vector data in CI×I\mathbb C^{I\times I}CI×I. Writing false and true as 0,10,10,1, its families are

v(s,r)′=vs⊗vr,p(s,r),b′={vs⊗pr,b=1,ps⊗vr,b=0,v'_{(s,r)}=v_s\otimes v_r,\qquad p'_{(s,r),b}= \begin{cases} v_s\otimes p_r,&b=1,\\ p_s\otimes v_r,&b=0, \end{cases}v(s,r)′​=vs​⊗vr​,p(s,r),b′​={vs​⊗pr​,ps​⊗vr​,​b=1,b=0,​

for all Boolean s,r,bs,r,bs,r,b, where (u⊗v)(i,j)=u(i)v(j)(u\otimes v)(i,j)=u(i)v(j)(u⊗v)(i,j)=u(i)v(j). No finiteness or normalization conditions are imposed.

QAlgorithms.Papers.Independent.Intake100.P92.pairDistance

For any Boolean pairs x=(x1,x2)x=(x_1,x_2)x=(x1​,x2​) and y=(y1,y2)y=(y_1,y_2)y=(y1​,y2​), this defines the natural number

d(x,y)=1x1≠y1+1x2≠y2.d(x,y)=\mathbf1_{x_1\ne y_1}+\mathbf1_{x_2\ne y_2}.d(x,y)=1x1​=y1​​+1x2​=y2​​.

Thus each differing coordinate contributes one, and the possible values are 0,1,20,1,20,1,2.

QAlgorithms.Papers.Independent.Intake100.P92.pulseWeight

For any real QQQ and Boolean value ooo, this defines

w(Q,o)={1−Q,o=true,Q,o=false.w(Q,o)= \begin{cases} 1-Q,&o=\mathrm{true},\\ Q,&o=\mathrm{false}. \end{cases}w(Q,o)={1−Q,Q,​o=true,o=false.​

There is no restriction on QQQ, so the resulting real number need not lie in [0,1][0,1][0,1].

QAlgorithms.Papers.Independent.Intake100.P92.rvec

For every natural number nnn and every real coordinate vector x:{0,…,n−1}→Rx:\{0,\ldots,n-1\}\to\mathbb Rx:{0,…,n−1}→R, this defines the vector rvec(x)rvec(x)rvec(x) in the complex Euclidean space Cn\mathbb C^nCn by

rvec(x)i=xi,rvec(x)_i=x_i,rvec(x)i​=xi​,

using the usual inclusion of real numbers into complex numbers. No normalization is imposed. When n=0n=0n=0, this is the unique vector in the zero-dimensional space.

QAlgorithms.Papers.Independent.Intake100.P92.weightedAncillaTrace

For any finite type III, any normed additive commutative group HHH, and any family x:I→Hx:I\to Hx:I→H, this defines the real number ∑i∈I∥xi∥2\sum_{i\in I}\|x_i\|^2∑i∈I​∥xi​∥2. No inner product or normalization is assumed, and the sum is zero when III is empty.

QAlgorithms.Papers.Independent.Intake100.P92.zCoefficient

For every real number qqq, this defines

zCoefficient(q)=−qlog⁡qlog⁡2.zCoefficient(q)=-\frac{q\log q}{\log 2}.zCoefficient(q)=−log2qlogq​.

No nonnegativity or upper bound is imposed on qqq. Here the real logarithm satisfies log⁡0=0\log 0=0log0=0 and log⁡q=log⁡∣q∣\log q=\log|q|logq=log∣q∣ for negative qqq; in particular, the defined value at q=0q=0q=0 is zero.

QAlgorithms.Papers.Independent.Intake100.P92.zInfo

For arbitrary real numbers q,xq,xq,x, this defines zInfo(q,x)zInfo(q,x)zInfo(q,x) by

zInfo(q,x)=∑a,b∈{0,1}Pablog⁡2 ⁣(Pab(∑b′Pab′)(∑a′Pa′b)),(Pab)a,b=(1−q0q(1−x)qx),zInfo(q,x)=\sum_{a,b\in\{0,1\}}P_{ab}\log_2\!\left(\frac{P_{ab}}{(\sum_{b'}P_{ab'})(\sum_{a'}P_{a'b})}\right), \qquad (P_{ab})_{a,b}= \begin{pmatrix} 1-q&0\\ q(1-x)&qx \end{pmatrix},zInfo(q,x)=a,b∈{0,1}∑​Pab​log2​((∑b′​Pab′​)(∑a′​Pa′b​)Pab​​),(Pab​)a,b​=(1−qq(1−x)​0qx​),

where 000 denotes false and 111 denotes true. There are no restrictions on q,xq,xq,x, so the entries need not form a probability distribution. All operations are total: division by zero is zero, and the real logarithm used to define log⁡2\log_2log2​ is zero at zero and equals the logarithm of the absolute value at a negative argument.

QAlgorithms.Papers.Independent.Intake100.P92.zLaw

For arbitrary real numbers q,xq,xq,x, this defines a real-valued function Zq,xZ_{q,x}Zq,x​ on Boolean pairs by

Zq,x(false,false)=1−q,Zq,x(false,true)=0,Zq,x(true,false)=q(1−x),Zq,x(true,true)=qx.\begin{aligned} Z_{q,x}(\mathrm{false},\mathrm{false})&=1-q,& Z_{q,x}(\mathrm{false},\mathrm{true})&=0,\\ Z_{q,x}(\mathrm{true},\mathrm{false})&=q(1-x),& Z_{q,x}(\mathrm{true},\mathrm{true})&=qx. \end{aligned}Zq,x​(false,false)Zq,x​(true,false)​=1−q,=q(1−x),​Zq,x​(false,true)Zq,x​(true,true)​=0,=qx.​

There are no bounds or nonnegativity assumptions on qqq or xxx, so the definition includes values for which some entries are negative.

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