Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Secure Identification and QKD in the Bounded-Quantum-Storage Model

Definition
QAlgorithms_Papers_Independent_Intakenext100_P14

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

prove2quantum

The objects the formalized statements of Secure Identification and QKD in the Bounded-Quantum-Storage Model (arXiv:0708.2557) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • pushMass: PDF p.6: push forward a possibly subnormalized classical law.
  • guessingMass: PDF p.6: average guessing probability, the sum of maxima of JOINT masses. The finite, nonempty maximum has no empty/unbounded-supremum default.
  • IsRetained: PDF p.6: retained event mass, with fractional conditional event probabilities allowed. The event is deleted without renormalizing.
  • smoothGuess: PDF p.6: minimum retained guessing probability. For epsilon >= 0 and normalized p the feasible set is nonempty and compact, so its infimum is attained. For epsilon >= 1 zero retention is feasible and the value is zero (entropy +infinity).
  • conditionMass: PDF p.6: conditioning an actual probability law on an event. The zero-event branch is zero and is used only in identities with zero weight; all entropy uses below have positive conditioning probability.
  • blockMass: PDF p.5: the classical probability of a CQ block.
  • cqPush: PDF p.5: relabel classical registers and take their marginal.
  • markov: PDF pp.5-6: Markov reconstruction, keeping the actual classical joint law. Zero-mass fibers contribute zero, including for subnormalized event blocks.
  • cqCondition: PDF p.5: event conditioning with an arbitrary original-state version at mass zero.
  • andPassword: PDF p.3: prescribed private-input maps for the passive AND reduction.
  • PassiveExecution: PDF p.3: an honest identification execution's local views, including its common publicly announced decision. This is an execution kernel, not a security assumption on an arbitrary replacement functionality.
  • PassiveEqualitySecurity: PDF p.3: passive equality identification correctness and statistical privacy. Privacy compares unequal passwords for the other party at a fixed own input; accept/reject is retained in both views.
  • packedRestriction: PDF p.10: pack a restriction in increasing coordinate order, then right-pad with zeros.
  • xorTag: PDF p.10: xor of the two ell-bit tags.
  • StrongUniversal: PDF p.7: strong universal-2, with an independent uniform seed.
  • QIDParameters: PDF p.10: public Q-ID parameters. Code distance is a guaranteed minimum; seed alphabets are finite nonempty types supplied at use sites.
  • qidTag: PDF p.10, steps 3-6: the exact tag computed from the packed restriction.
  • bb84Probability: PDF pp.4,10: Born probability for measuring an encoded product state.
  • honestAcceptance: PDF p.10, complete honest execution of steps 1-6. Uniform independent x,theta,f,g are averaged; xprime is drawn using the Born measurement law.
  • ServerAttack: PDF p.10, Prop.3.4: arbitrary password-independent server strategy. Only the checkpoint quantum register is bounded. Classical Y, final E, and all computation are unrestricted; the post-revelation map chooses g adaptively.
  • serverOutput: PDF pp.10-11: actual Q-ID output against this server, retaining the full classical history (theta,f,y,g,z). No map has the unknown password as an input.
  • markovRight: PDF pp.5-6,8: Markov reconstruction with the transcript H in the quantum observer's side of the partition. The transcript is NOT discarded.
  • IsGuessExtension: PDF p.8: a classical guess extension of the actual output, with independence of the password; every register and quantum block is preserved when the extra guess is discarded.
  • GuessSecrecy: PDF p.8, Definitions 3.2/3.3: compare the conditioned actual state to its OWN Markov reconstruction, retaining the final announced decision.
  • HasIndependentGuess: PDF p.8, Definition 3.2: the existential independent-guess witness is an extension of the actual protocol output, not a new assumed output law.
  • qidUncertaintyExponent: PDF p.7: the corrected, PDF-verified uncertainty exponent. Only the source's security range 0 < lambda < 1/4 is used below.
  • UserAttack: PDF pp.10-12: all operations before receiving g can be represented by a password-independent CQ ensemble of the transmitted register and retained R. The response instrument chooses an arbitrary tag or abort (none), after seeing g. A final channel may depend on the announced decision. There is no quantum-storage bound on R or E.
  • measuredResidual: PDF p.10 step 2: unnormalized residual state on R after the honest server's actual measurement in the password code basis.
  • UserHistory: PDF p.10: user attack transcript includes the final announced decision. The optional tag none is an abort and is always rejected.
  • userOutput: PDF pp.10-12: complete original Q-ID execution against an arbitrary user. The honest server measures in c(w) before theta,f are revealed, and chooses g uniformly and independently. The user can process its state after receiving the announced decision. All attack operations are password independent.
  • ServerSecurity: PDF p.8, Definition 3.3: the same independent guess supplies exact acceptance on equality, bounded acceptance on mismatch, and postdecision secrecy. The acceptance conditions use weighted events, so a zero-mass equality event adds no positivity assumption. Mismatch has mass at least 1/2 in Prop.3.5.
  • affineTag: PDF p.15: the fixed binary coordinates of GF(2^N), followed by projection onto the first ell coordinates; the tag alphabet's additive group is GF(2^ell). Only its addition is used, so binary coordinate vectors give exactly that group.
  • keyMass: PDF p.15: uniform independent key, with exactly field-degree N rather than the unrelated transmitted-qubit count.
  • classicalTagLaw: PDF p.15: actual classical tag/key/side-information distribution.
  • classicalIdealTagLaw: PDF p.15: ideal independent uniform tag, preserving the same key and Z law.
  • quantumTagLaw: PDF p.15: the actual CQ tag/key/Z/E state. E depends only on X,Z, while the key is independent and uniform.
  • quantumIdealTagLaw: PDF p.15: I/2^ell tensor rho_K tensor rho_ZE, with actual marginals.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Channel
import Definitions.Def_QAlgorithms_Defs_Measurement
import Definitions.Def_QAlgorithms_Defs_Gates
import Definitions.Def_QAlgorithms_Defs_QuantumOutputMetrics
import Definitions.Def_QAlgorithms_Papers_Independent_Dependency50_P47
import Definitions.Def_QAlgorithms_Papers_Independent_Gap48_P11
import Definitions.Def_QAlgorithms_Papers_Independent_Claimed50_P31
import Definitions.Def_QAlgorithms_Papers_Independent_Advance50_P05

/-!
Damgard, Fehr, Salvail and Schaffner, arXiv:0708.2557v3.
Accepted primitives supply finite classical laws, CQ blocks, BB84 vectors, and
rectangular instruments. Local definitions implement event-deletion smoothing,
CQ Markov reconstruction, and the six-step ideal-channel Q-ID execution.
All basis strings use false = computational, true = Hadamard.
-/

noncomputable section

namespace QAlgorithms.Papers.Independent.Intakenext100.P14

open scoped Matrix ComplexConjugate

open QAlgorithms.Papers.Independent.Dependency50.P47 (Law)
open QAlgorithms.Papers.Independent.Gap48.P11 (blockMatrix cqDistance)
open QAlgorithms.Papers.Independent.Claimed50.P31 (bb84Vector)
open QAlgorithms.Papers.Independent.Advance50.P05 (RectangularInstrument)

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

/-- PDF p.6: push forward a possibly subnormalized classical law. -/
def pushMass {S A : Type*} [Fintype S] (p : S → ℝ) (X : S → A) (a : A) : ℝ :=
  ∑ s, if X s = a then p s else 0

/-- PDF p.6: average guessing probability, the sum of maxima of JOINT masses.
The finite, nonempty maximum has no empty/unbounded-supremum default. -/
def guessingMass {S A B : Type*} [Fintype S] [Fintype A] [Nonempty A]
    [Fintype B] (p : S → ℝ) (X : S → A) (Y : S → B) : ℝ :=
  ∑ b, Finset.univ.sup' Finset.univ_nonempty
    (fun a => pushMass p (fun s => (X s, Y s)) (a, b))

/-- PDF p.6: retained event mass, with fractional conditional event probabilities
allowed. The event is deleted without renormalizing. -/
def IsRetained {S : Type*} [Fintype S] (p r : S → ℝ) (epsilon : ℝ) : Prop :=
  (∀ s, 0 ≤ r s ∧ r s ≤ p s) ∧ 1 - epsilon ≤ ∑ s, r s

/-- PDF p.6: minimum retained guessing probability. For epsilon >= 0 and
normalized p the feasible set is nonempty and compact, so its infimum is attained.
For epsilon >= 1 zero retention is feasible and the value is zero (entropy +infinity). -/
def smoothGuess {S A B : Type*} [Fintype S] [Fintype A] [Nonempty A]
    [Fintype B] (p : S → ℝ) (X : S → A) (Y : S → B) (epsilon : ℝ) : ℝ :=
  sInf {g : ℝ | ∃ r : S → ℝ, IsRetained p r epsilon ∧ g = guessingMass r X Y}

/-- PDF p.6: conditioning an actual probability law on an event.
The zero-event branch is zero and is used only in identities with zero weight;
all entropy uses below have positive conditioning probability. -/
def conditionMass {S : Type*} [Fintype S] (p : S → ℝ) (event : S → Prop) : S → ℝ :=
  fun s => if event s then p s / (∑ t, if event t then p t else 0) else 0

/-- PDF p.5: the classical probability of a CQ block. -/
def blockMass {C E : Type*} [Fintype E] (r : C → Matrix E E ℂ) (c : C) : ℝ :=
  (r c).trace.re

/-- PDF p.5: relabel classical registers and take their marginal. -/
def cqPush {C D E : Type*} [Fintype C] (r : C → Matrix E E ℂ) (f : C → D) :
    D → Matrix E E ℂ :=
  fun d => ∑ c, if f c = d then r c else 0

/-- PDF pp.5-6: Markov reconstruction, keeping the actual classical joint law.
Zero-mass fibers contribute zero, including for subnormalized event blocks. -/
def markov {X Y E : Type*} [Fintype X] [Fintype Y] [Fintype E]
    (r : (X × Y) → Matrix E E ℂ) : (X × Y) → Matrix E E ℂ :=
  fun xy => ((blockMass r xy / blockMass (cqPush r Prod.snd) xy.2 : ℝ) : ℂ) •
    cqPush r Prod.snd xy.2

/-- PDF p.5: event conditioning with an arbitrary original-state version at mass zero. -/
def cqCondition {C E : Type*} [Fintype C] [Fintype E]
    (r : C → Matrix E E ℂ) (event : C → Prop) : C → Matrix E E ℂ :=
  let p := ∑ c, if event c then blockMass r c else 0
  if 0 < p then fun c => if event c then ((p⁻¹ : ℝ) : ℂ) • r c else 0 else r

/-- Positive list length and inhabited fibers supply the tagged union's inhabitant.
This derived instance adds no hypothesis to Lemma 2.2. -/
local instance {m : ℕ} [NeZero m] {A : Fin m → Type*}
    [∀ i, Nonempty (A i)] : Nonempty (Sigma A) :=
  ⟨⟨0, Classical.choice (inferInstance : Nonempty (A 0))⟩⟩

/-- PDF p.3: prescribed private-input maps for the passive AND reduction. -/
def andPassword {W : Type*} (wzero wone : W) (b : Bool) : W :=
  if b then wone else wzero

/-- PDF p.3: an honest identification execution's local views, including
its common publicly announced decision. This is an execution kernel, not a
security assumption on an arbitrary replacement functionality. -/
structure PassiveExecution (W EA EB : Type*) where
  alice : W → W → (Bool → Matrix EA EA ℂ)
  bob : W → W → (Bool → Matrix EB EB ℂ)

/-- PDF p.3: passive equality identification correctness and statistical privacy.
Privacy compares unequal passwords for the other party at a fixed own input;
accept/reject is retained in both views. -/
def PassiveEqualitySecurity {W EA EB : Type*} [Fintype EA] [Fintype EB]
    (P : PassiveExecution W EA EB) (delta epsilon : ℝ) : Prop :=
  0 ≤ delta ∧ 0 ≤ epsilon ∧
  (∀ a b, QAlgorithms.IsDensityMatrix (blockMatrix (P.alice a b)) ∧
    QAlgorithms.IsDensityMatrix (blockMatrix (P.bob a b)) ∧
    (∀ t, blockMass (P.alice a b) t = blockMass (P.bob a b) t) ∧
    blockMass (P.bob a b) (decide (a = b)) ≥ 1 - delta) ∧
  (∀ a b c, b ≠ a → c ≠ a → cqDistance (P.alice a b) (P.alice a c) ≤ epsilon) ∧
  (∀ b a c, a ≠ b → c ≠ b → cqDistance (P.bob a b) (P.bob c b) ≤ epsilon)

/-- PDF p.10: pack a restriction in increasing coordinate order, then right-pad with zeros. -/
def packedRestriction {n : ℕ} (x theta c : QAlgorithms.Qubits n) : QAlgorithms.Qubits n :=
  fun j => (((List.finRange n).filter (fun i => theta i == c i)).map x).getD j.val false

/-- PDF p.10: xor of the two ell-bit tags. -/
def xorTag {ell : ℕ} (a b : QAlgorithms.Qubits ell) : QAlgorithms.Qubits ell :=
  fun i => xor (a i) (b i)

/-- PDF p.7: strong universal-2, with an independent uniform seed. -/
def StrongUniversal {I A B : Type*} [Fintype I] [Fintype B]
    (f : I → A → B) : Prop :=
  ∀ x y, x ≠ y → ∀ u v,
    ((Finset.univ.filter (fun i => f i x = u ∧ f i y = v)).card : ℝ) /
      Fintype.card I = ((Fintype.card B : ℝ) ^ 2)⁻¹

/-- PDF p.10: public Q-ID parameters. Code distance is a guaranteed minimum;
seed alphabets are finite nonempty types supplied at use sites. -/
structure QIDParameters (n ell m d : ℕ) (F G : Type*) [Fintype F] [Fintype G] where
  code : Fin m → QAlgorithms.Qubits n
  injective : Function.Injective code
  distance : ∀ a b, a ≠ b → d ≤ hammingDist (code a) (code b)
  hashF : F → QAlgorithms.Qubits n → QAlgorithms.Qubits ell
  hashG : G → Fin m → QAlgorithms.Qubits ell
  strongF : StrongUniversal hashF
  strongG : StrongUniversal hashG

/-- PDF p.10, steps 3-6: the exact tag computed from the packed restriction. -/
def qidTag {n ell m d : ℕ} {F G : Type*} [Fintype F] [Fintype G]
    (P : QIDParameters n ell m d F G) (w : Fin m)
    (x theta : QAlgorithms.Qubits n) (f : F) (g : G) : QAlgorithms.Qubits ell :=
  xorTag (P.hashF f (packedRestriction x theta (P.code w))) (P.hashG g w)

/-- PDF pp.4,10: Born probability for measuring an encoded product state. -/
def bb84Probability {n : ℕ} (x theta y c : QAlgorithms.Qubits n) : ℝ :=
  Complex.normSq (∑ t, conj (bb84Vector y c t) * bb84Vector x theta t)

/-- PDF p.10, complete honest execution of steps 1-6. Uniform independent
x,theta,f,g are averaged; xprime is drawn using the Born measurement law. -/
def honestAcceptance {n ell m d : ℕ} {F G : Type*} [Fintype F] [Fintype G]
    (P : QIDParameters n ell m d F G) (w : Fin m) : ℝ :=
  ((Fintype.card (QAlgorithms.Qubits n) : ℝ) ^ 2 * Fintype.card F * Fintype.card G)⁻¹ *
    ∑ x, ∑ theta, ∑ f, ∑ g, ∑ y,
      bb84Probability x theta y (P.code w) *
        (if qidTag P w x theta f g = qidTag P w y theta f g then 1 else 0)

/-- PDF p.10, Prop.3.4: arbitrary password-independent server strategy.
Only the checkpoint quantum register is bounded. Classical Y, final E, and
all computation are unrestricted; the post-revelation map chooses g adaptively. -/
structure ServerAttack (n ell q : ℕ) (F : Type*) (G Y E : Type)
    [Fintype F] [Fintype G] [Fintype Y] [Fintype E] where
  checkpoint : RectangularInstrument (QAlgorithms.Qubits n) (QAlgorithms.Qubits q) Y
  chooseG : QAlgorithms.Qubits n → F → Y → RectangularInstrument (QAlgorithms.Qubits q) E G
  finish : QAlgorithms.Qubits n → F → Y → G → QAlgorithms.Qubits ell →
    QAlgorithms.Superop E E
  finish_channel : ∀ theta f y g z, QAlgorithms.IsChannel (finish theta f y g z)

/-- PDF pp.10-11: actual Q-ID output against this server, retaining the full
classical history (theta,f,y,g,z). No map has the unknown password as an input. -/
def serverOutput {n ell m d q : ℕ} {F : Type*} {G Y E : Type}
    [Fintype F] [Fintype G] [Fintype Y] [Fintype E]
    (P : QIDParameters n ell m d F G) (W : Law (Fin m))
    (A : ServerAttack n ell q F G Y E) :
    (Fin m × (QAlgorithms.Qubits n × F × Y × G × QAlgorithms.Qubits ell)) → Matrix E E ℂ :=
  fun wh =>
    let w := wh.1
    let theta := wh.2.1
    let f := wh.2.2.1
    let y := wh.2.2.2.1
    let g := wh.2.2.2.2.1
    let z := wh.2.2.2.2.2
    ((W.prob w / ((Fintype.card (QAlgorithms.Qubits n) : ℝ) ^ 2 * Fintype.card F) : ℝ) : ℂ) •
      ∑ x, if z = qidTag P w x theta f g then
        A.finish theta f y g z
          (RectangularInstrument.branch (A.chooseG theta f y) g
            (RectangularInstrument.branch A.checkpoint y (QAlgorithms.pureDensity (bb84Vector x theta))))
      else 0

/-- PDF pp.5-6,8: Markov reconstruction with the transcript H in the
quantum observer's side of the partition. The transcript is NOT discarded. -/
def markovRight {W J H E : Type*} [Fintype W] [Fintype J]
    [Fintype H] [Fintype E] (r : ((W × J) × H) → Matrix E E ℂ) :
    ((W × J) × H) → Matrix E E ℂ :=
  fun c =>
    ((blockMass (cqPush r Prod.fst) c.1 /
      blockMass (cqPush r (fun c => c.1.2)) c.1.2 : ℝ) : ℂ) •
        cqPush r (fun c => (c.1.2, c.2)) (c.1.2, c.2)

/-- PDF p.8: a classical guess extension of the actual output, with
independence of the password; every register and quantum block is preserved
when the extra guess is discarded. -/
def IsGuessExtension {W J H E : Type*} [Fintype W] [Fintype J]
    [Fintype H] [Fintype E] (rho : (W × H) → Matrix E E ℂ)
    (ext : ((W × J) × H) → Matrix E E ℂ) : Prop :=
  QAlgorithms.IsDensityMatrix (blockMatrix ext) ∧
  cqPush ext (fun c => (c.1.1, c.2)) = rho ∧
  ∀ w j, blockMass (cqPush ext Prod.fst) (w, j) =
    blockMass (cqPush rho Prod.fst) w *
      blockMass (cqPush ext (fun c => c.1.2)) j

/-- PDF p.8, Definitions 3.2/3.3: compare the conditioned actual state
to its OWN Markov reconstruction, retaining the final announced decision. -/
def GuessSecrecy {W J H E : Type*} [Fintype W] [Fintype J]
    [Fintype H] [Fintype E] (ext : ((W × J) × H) → Matrix E E ℂ)
    (guessValue : J → Option W) (epsilon : ℝ) : Prop :=
  let r := cqCondition ext (fun c => some c.1.1 ≠ guessValue c.1.2)
  cqDistance r (markovRight r) ≤ epsilon

/-- PDF p.8, Definition 3.2: the existential independent-guess witness
is an extension of the actual protocol output, not a new assumed output law. -/
def HasIndependentGuess {W H E J : Type*} [Fintype W] [Fintype H]
    [Fintype E] [Fintype J] (rho : (W × H) → Matrix E E ℂ)
    (guessValue : J → Option W) (epsilon : ℝ) : Prop :=
  ∃ ext : ((W × J) × H) → Matrix E E ℂ,
    IsGuessExtension rho ext ∧ GuessSecrecy ext guessValue epsilon

/-- PDF p.7: the corrected, PDF-verified uncertainty exponent.
Only the source's security range 0 < lambda < 1/4 is used below. -/
def qidUncertaintyExponent (lambda : ℝ) : ℝ :=
  lambda ^ 2 * Real.logb 2 (Real.exp 1) / (32 * (2 - Real.logb 2 lambda) ^ 2)

/-- PDF pp.10-12: all operations before receiving g can be represented
by a password-independent CQ ensemble of the transmitted register and retained R.
The response instrument chooses an arbitrary tag or abort (none), after seeing g.
A final channel may depend on the announced decision. There is no
quantum-storage bound on R or E. -/
structure UserAttack (n ell : ℕ) (F G : Type*) (R E : Type)
    [Fintype F] [Fintype G] [Fintype R] [Fintype E] where
  prepared : (QAlgorithms.Qubits n × F) →
    Matrix (QAlgorithms.Qubits n × R) (QAlgorithms.Qubits n × R) ℂ
  normalized : QAlgorithms.IsDensityMatrix (blockMatrix prepared)
  respond : QAlgorithms.Qubits n → F → G →
    RectangularInstrument R E (Option (QAlgorithms.Qubits ell))
  finish : QAlgorithms.Qubits n → F → G → Option (QAlgorithms.Qubits ell) →
    Bool → QAlgorithms.Superop E E
  finish_channel : ∀ theta f g z accepted,
    QAlgorithms.IsChannel (finish theta f g z accepted)

/-- PDF p.10 step 2: unnormalized residual state on R after the honest
server's actual measurement in the password code basis. -/
def measuredResidual {n : ℕ} {R : Type*} (rho :
    Matrix (QAlgorithms.Qubits n × R) (QAlgorithms.Qubits n × R) ℂ)
    (y c : QAlgorithms.Qubits n) : Matrix R R ℂ :=
  fun r s => ∑ i, ∑ j,
    conj (bb84Vector y c i) * rho (i, r) (j, s) * bb84Vector y c j

/-- PDF p.10: user attack transcript includes the final announced decision.
The optional tag none is an abort and is always rejected. -/
abbrev UserHistory (n ell : ℕ) (F G : Type*) :=
  QAlgorithms.Qubits n × F × G × Option (QAlgorithms.Qubits ell) × Bool

/-- PDF pp.10-12: complete original Q-ID execution against an arbitrary user.
The honest server measures in c(w) before theta,f are revealed, and chooses g
uniformly and independently. The user can process its state after receiving the
announced decision. All attack operations are password independent. -/
def userOutput {n ell m d : ℕ} {F G : Type*} {R E : Type}
    [Fintype F] [Fintype G] [Fintype R] [Fintype E]
    (P : QIDParameters n ell m d F G) (W : Law (Fin m))
    (A : UserAttack n ell F G R E) :
    (Fin m × UserHistory n ell F G) → Matrix E E ℂ :=
  fun wh =>
    let w := wh.1
    let theta := wh.2.1
    let f := wh.2.2.1
    let g := wh.2.2.2.1
    let z := wh.2.2.2.2.1
    let accepted := wh.2.2.2.2.2
    ((W.prob w / Fintype.card G : ℝ) : ℂ) • ∑ y,
      if decide (z = some (qidTag P w y theta f g)) = accepted then
        A.finish theta f g z accepted
          (RectangularInstrument.branch (A.respond theta f g) z
            (measuredResidual (A.prepared (theta, f)) y (P.code w)))
      else 0

/-- PDF p.8, Definition 3.3: the same independent guess supplies exact
acceptance on equality, bounded acceptance on mismatch, and postdecision secrecy.
The acceptance conditions use weighted events, so a zero-mass equality event
adds no positivity assumption. Mismatch has mass at least 1/2 in Prop.3.5. -/
def ServerSecurity {n ell m : ℕ} {F G E : Type*}
    [Fintype F] [Fintype G] [Fintype E]
    (rho : (Fin m × UserHistory n ell F G) → Matrix E E ℂ) (epsilon : ℝ) : Prop :=
  ∃ ext : (((Fin m) × Option (Fin m)) × UserHistory n ell F G) → Matrix E E ℂ,
    IsGuessExtension rho ext ∧ GuessSecrecy ext id epsilon ∧
    (∑ c, if some c.1.1 = c.1.2 ∧ c.2.2.2.2.2 = false
      then blockMass ext c else 0) = 0 ∧
    (∑ c, if some c.1.1 ≠ c.1.2 ∧ c.2.2.2.2.2 = true
      then blockMass ext c else 0) ≤
      epsilon * (∑ c, if some c.1.1 ≠ c.1.2 then blockMass ext c else 0)

/-- PDF p.15: the fixed binary coordinates of GF(2^N), followed by projection
onto the first ell coordinates; the tag alphabet's additive group is GF(2^ell).
Only its addition is used, so binary coordinate vectors give exactly that group. -/
def affineTag {K : Type*} [Field K] [Algebra (ZMod 2) K] {N ell : ℕ}
    (coordinates : K ≃ₗ[ZMod 2] (Fin N → ZMod 2)) (hell : ell ≤ N)
    (key : K × (Fin ell → ZMod 2)) (x : K) : Fin ell → ZMod 2 :=
  fun i => coordinates (key.1 * x) (Fin.castLE hell i) + key.2 i

/-- PDF p.15: uniform independent key, with exactly field-degree N rather
than the unrelated transmitted-qubit count. -/
def keyMass {K : Type*} [Fintype K] (ell : ℕ) : ℝ :=
  ((Fintype.card K : ℝ) * (2 : ℝ) ^ ell)⁻¹

/-- PDF p.15: actual classical tag/key/side-information distribution. -/
def classicalTagLaw {K : Type*} {S : Type} {Z : Type*} [Field K] [Fintype K] [Algebra (ZMod 2) K]
    [Fintype S] {N ell : ℕ}
    (coordinates : K ≃ₗ[ZMod 2] (Fin N → ZMod 2)) (hell : ell ≤ N)
    (p : Law S) (X : S → K) (z : S → Z) :
    ((Fin ell → ZMod 2) × (K × (Fin ell → ZMod 2)) × Z) → ℝ :=
  fun t => keyMass (K := K) ell * ∑ s,
    if t.1 = affineTag coordinates hell t.2.1 (X s) ∧ t.2.2 = z s then p.prob s else 0

/-- PDF p.15: ideal independent uniform tag, preserving the same key and Z law. -/
def classicalIdealTagLaw {K : Type*} {S : Type} {Z : Type*} [Fintype K] [Fintype S] (ell : ℕ)
    (p : Law S) (z : S → Z) :
    ((Fin ell → ZMod 2) × (K × (Fin ell → ZMod 2)) × Z) → ℝ :=
  fun t => ((2 : ℝ) ^ ell)⁻¹ * keyMass (K := K) ell * pushMass p.prob z t.2.2

/-- PDF p.15: the actual CQ tag/key/Z/E state. E depends only on X,Z,
while the key is independent and uniform. -/
def quantumTagLaw {K : Type*} {S : Type} {Z : Type*} [Field K] [Fintype K] [Algebra (ZMod 2) K]
    [Fintype S] {N ell q : ℕ}
    (coordinates : K ≃ₗ[ZMod 2] (Fin N → ZMod 2)) (hell : ell ≤ N)
    (p : Law S) (X : S → K) (z : S → Z)
    (rho : K → Z → Matrix (QAlgorithms.Qubits q) (QAlgorithms.Qubits q) ℂ) :
    ((Fin ell → ZMod 2) × (K × (Fin ell → ZMod 2)) × Z) →
      Matrix (QAlgorithms.Qubits q) (QAlgorithms.Qubits q) ℂ :=
  fun t => ((keyMass (K := K) ell : ℝ) : ℂ) • ∑ s,
    if t.1 = affineTag coordinates hell t.2.1 (X s) ∧ t.2.2 = z s
    then (p.prob s : ℂ) • rho (X s) (z s) else 0

/-- PDF p.15: I/2^ell tensor rho_K tensor rho_ZE, with actual marginals. -/
def quantumIdealTagLaw {K : Type*} {S : Type} {Z : Type*} [Fintype K] [Fintype S] (ell : ℕ) {q : ℕ}
    (p : Law S) (X : S → K) (z : S → Z)
    (rho : K → Z → Matrix (QAlgorithms.Qubits q) (QAlgorithms.Qubits q) ℂ) :
    ((Fin ell → ZMod 2) × (K × (Fin ell → ZMod 2)) × Z) →
      Matrix (QAlgorithms.Qubits q) (QAlgorithms.Qubits q) ℂ :=
  fun t => ((((2 : ℝ) ^ ell)⁻¹ * keyMass (K := K) ell : ℝ) : ℂ) • ∑ s,
    if z s = t.2.2 then (p.prob s : ℂ) • rho (X s) (z s) else 0

example (a b : Bool) : andPassword a b true = b := rfl

/-- Retaining the full event is feasible at every nonnegative smoothing level. -/
example {S : Type} [Fintype S] (p : Law S)
    (epsilon : ℝ) (hepsilon : 0 ≤ epsilon) : IsRetained p.prob p.prob epsilon := by
  constructor
  · intro s
    exact ⟨p.nonneg s, le_rfl⟩
  · rw [p.total]
    linarith

/-- A zero event block has zero weighted Markov reconstruction. -/
example {X Y E : Type*} [Fintype X] [Fintype Y] [Fintype E] :
    markov (0 : (X × Y) → Matrix E E ℂ) = 0 := by
  funext xy
  simp [markov, blockMass, cqPush]

example {C E : Type*} (r : C → Matrix E E ℂ) (c : C) (i j : E) :
    blockMatrix r (c, i) (c, j) = r c i j := by simp [blockMatrix]

example {S : Type*} [Fintype S] (p : S → ℝ) :
    conditionMass p (fun _ => False) = 0 := by
  funext s
  simp [conditionMass]

example (x theta : QAlgorithms.Qubits 0) : bb84Vector x theta (fun i => Fin.elim0 i) = 1 := by
  simp [bb84Vector]

example {K : Type*} [Field K] [Algebra (ZMod 2) K] {N ell : ℕ}
    (coordinates : K ≃ₗ[ZMod 2] (Fin N → ZMod 2)) (hell : ell ≤ N)
    (a : K) (b : Fin ell → ZMod 2) : affineTag coordinates hell (a, b) 0 = b := by
  funext i
  simp [affineTag]

example : Law Unit where
  prob := fun _ => 1
  nonneg := by intro a; norm_num
  total := by simp

example {I O J : Type} [Fintype I] [Fintype O] [Fintype J]
    (M : RectangularInstrument I J O) (o : O) : RectangularInstrument.branch M o 0 = 0 := by
  simp [RectangularInstrument.branch, QAlgorithms.krausApply]

example (x theta y : QAlgorithms.Qubits 1) :
    bb84Vector x theta y =
      if theta 0 then QAlgorithms.hadamard (y 0) (x 0)
      else if y 0 = x 0 then 1 else 0 := by
  simp [bb84Vector]

example {n : ℕ} (x theta c : QAlgorithms.Qubits n)
    (hnomatch : ∀ i, theta i ≠ c i) : packedRestriction x theta c = fun _ => false := by
  funext j
  have hempty : (List.finRange n).filter (fun i => theta i == c i) = [] := by
    apply List.filter_eq_nil_iff.mpr
    intro i hi
    simp [hnomatch i]
  simp [packedRestriction, hempty]

end QAlgorithms.Papers.Independent.Intakenext100.P14
Source
Secure Identification and QKD in the Bounded-Quantum-Storage Model, arXiv:0708.2557v3, https://arxiv.org/abs/0708.2557v3
Read-back

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

QAlgorithms.Papers.Independent.Intakenext100.P14.GuessSecrecy

For finite types W,J,H,EW,J,H,EW,J,H,E, any matrix family ηw,j,h∈CE×E\eta_{w,j,h}\in\mathbb C^{E\times E}ηw,j,h​∈CE×E, a function v:J→W∪{none}v:J\to W\cup\{\mathrm{none}\}v:J→W∪{none}, and any real ϵ\epsilonϵ, let B(w,j,h)B(w,j,h)B(w,j,h) mean some(w)≠v(j)\mathrm{some}(w)\ne v(j)some(w)=v(j), so that v(j)=nonev(j)=\mathrm{none}v(j)=none always satisfies BBB. Set pB=∑B(w,j,h)Re⁡Tr⁡ηw,j,hp_B=\sum_{B(w,j,h)}\operatorname{Re}\operatorname{Tr}\eta_{w,j,h}pB​=∑B(w,j,h)​ReTrηw,j,h​. If pB>0p_B>0pB​>0, define rw,j,h=ηw,j,h/pBr_{w,j,h}=\eta_{w,j,h}/p_Brw,j,h​=ηw,j,h​/pB​ on BBB and zero elsewhere; if pB≤0p_B\le0pB​≤0, define r=ηr=\etar=η. Define

Mw,j,h=Re⁡Tr⁡∑h′rw,j,h′Re⁡Tr⁡∑w′,h′rw′,j,h′∑w′rw′,j,h.M_{w,j,h} =\frac{\operatorname{Re}\operatorname{Tr}\sum_{h'}r_{w,j,h'}} {\operatorname{Re}\operatorname{Tr}\sum_{w',h'}r_{w',j,h'}} \sum_{w'}r_{w',j,h}.Mw,j,h​=ReTr∑w′,h′​rw′,j,h′​ReTr∑h′​rw,j,h′​​w′∑​rw′,j,h​.

The proposition is 12Re⁡Tr⁡D†D≤ϵ\frac12\operatorname{Re}\operatorname{Tr}\sqrt{D^\dagger D}\le\epsilon21​ReTrD†D​≤ϵ, where DDD is the block-diagonal matrix whose (w,j,h)(w,j,h)(w,j,h) block is rw,j,h−Mw,j,hr_{w,j,h}-M_{w,j,h}rw,j,h​−Mw,j,h​. Zero denominators in MMM give zero scalars. No positivity, normalization, nonemptiness, or nonnegativity assumption on ϵ\epsilonϵ is included.

QAlgorithms.Papers.Independent.Intakenext100.P14.HasIndependentGuess

For finite types W,H,E,JW,H,E,JW,H,E,J, a family ρw,h∈CE×E\rho_{w,h}\in\mathbb C^{E\times E}ρw,h​∈CE×E, a function v:J→W∪{none}v:J\to W\cup\{\mathrm{none}\}v:J→W∪{none}, and a real ϵ\epsilonϵ, this asserts the existence of matrices ηw,j,h\eta_{w,j,h}ηw,j,h​ such that their block-diagonal matrix is positive semidefinite with trace 111, ∑jηw,j,h=ρw,h\sum_j\eta_{w,j,h}=\rho_{w,h}∑j​ηw,j,h​=ρw,h​, and their classical masses satisfy

Re⁡Tr⁡∑hηw,j,h=(Re⁡Tr⁡∑hρw,h)(Re⁡Tr⁡∑w′,hηw′,j,h).\operatorname{Re}\operatorname{Tr}\sum_h\eta_{w,j,h} = \left(\operatorname{Re}\operatorname{Tr}\sum_h\rho_{w,h}\right) \left(\operatorname{Re}\operatorname{Tr}\sum_{w',h}\eta_{w',j,h}\right).ReTrh∑​ηw,j,h​=(ReTrh∑​ρw,h​)​ReTrw′,h∑​ηw′,j,h​​.

In addition, restrict η\etaη to the event some(w)≠v(j)\mathrm{some}(w)\ne v(j)some(w)=v(j) and divide by its total trace mass when that mass is positive, obtaining rrr; if that mass is nonpositive, use r=ηr=\etar=η. The trace distance between the block-diagonal matrix of rrr and that of

Mw,j,h=Re⁡Tr⁡∑h′rw,j,h′Re⁡Tr⁡∑w′,h′rw′,j,h′∑w′rw′,j,hM_{w,j,h} =\frac{\operatorname{Re}\operatorname{Tr}\sum_{h'}r_{w,j,h'}} {\operatorname{Re}\operatorname{Tr}\sum_{w',h'}r_{w',j,h'}} \sum_{w'}r_{w',j,h}Mw,j,h​=ReTr∑w′,h′​rw′,j,h′​ReTr∑h′​rw,j,h′​​w′∑​rw′,j,h​

must be at most ϵ\epsilonϵ, where trace distance means 12Re⁡Tr⁡(Br−BM)†(Br−BM)\frac12\operatorname{Re}\operatorname{Tr}\sqrt{(B_r-B_M)^\dagger(B_r-B_M)}21​ReTr(Br​−BM​)†(Br​−BM​)​ and division by zero gives zero. No sign restriction on ϵ\epsilonϵ is assumed; an empty W,J,HW,J,HW,J,H, or EEE makes the required normalized extension impossible.

QAlgorithms.Papers.Independent.Intakenext100.P14.IsGuessExtension

For finite types W,J,H,EW,J,H,EW,J,H,E, a matrix family ρw,h∈CE×E\rho_{w,h}\in\mathbb C^{E\times E}ρw,h​∈CE×E, and a proposed family ηw,j,h∈CE×E\eta_{w,j,h}\in\mathbb C^{E\times E}ηw,j,h​∈CE×E, this proposition requires all three of the following: the block-diagonal matrix with entries 1(w,j,h)=(w′,j′,h′)ηw,j,h(e,e′)\mathbf1_{(w,j,h)=(w',j',h')}\eta_{w,j,h}(e,e')1(w,j,h)=(w′,j′,h′)​ηw,j,h​(e,e′) is positive semidefinite and has complex trace 111; ∑jηw,j,h=ρw,h\sum_j\eta_{w,j,h}=\rho_{w,h}∑j​ηw,j,h​=ρw,h​ for every w,hw,hw,h; and, writing t(X)=Re⁡Tr⁡Xt(X)=\operatorname{Re}\operatorname{Tr}Xt(X)=ReTrX,

t ⁣(∑hηw,j,h)=t ⁣(∑hρw,h)t ⁣(∑w′,hηw′,j,h)for every w,j.t\!\left(\sum_h\eta_{w,j,h}\right) = t\!\left(\sum_h\rho_{w,h}\right) t\!\left(\sum_{w',h}\eta_{w',j,h}\right) \quad\text{for every }w,j.t(h∑​ηw,j,h​)=t(h∑​ρw,h​)t​w′,h∑​ηw′,j,h​​for every w,j.

The last equality is independence of the classical WWW and JJJ masses after summing out HHH and tracing out EEE. The finite types are not explicitly assumed nonempty, but the trace-one requirement is impossible if any of them is empty.

QAlgorithms.Papers.Independent.Intakenext100.P14.IsRetained

For any finite type SSS, real functions p,r:S→Rp,r:S\to\mathbb Rp,r:S→R, and real number ϵ\epsilonϵ, this predicate means

(∀s∈S, 0≤r(s)≤p(s))and1−ϵ≤∑s∈Sr(s).\bigl(\forall s\in S,\ 0\le r(s)\le p(s)\bigr) \quad\text{and}\quad 1-\epsilon\le\sum_{s\in S}r(s).(∀s∈S, 0≤r(s)≤p(s))and1−ϵ≤s∈S∑​r(s).

There is no separate assumption that ppp is a probability distribution or that ϵ≥0\epsilon\ge0ϵ≥0. A negative value of ppp makes the predicate impossible; when SSS is empty, it holds exactly when ϵ≥1\epsilon\ge1ϵ≥1.

QAlgorithms.Papers.Independent.Intakenext100.P14.PassiveEqualitySecurity

Let WWW be any type, let EA,EBE_A,E_BEA​,EB​ be finite types, let PPP supply matrix families Aa,btA_{a,b}^{t}Aa,bt​ and Ba,btB_{a,b}^{t}Ba,bt​ indexed by a,b∈Wa,b\in Wa,b∈W and Boolean ttt, and let δ,ϵ∈R\delta,\epsilon\in\mathbb Rδ,ϵ∈R. For a family R=(Rt)tR=(R^t)_tR=(Rt)t​, write R^(t,i),(u,j)=1t=uRi,jt\widehat R_{(t,i),(u,j)}=\mathbf1_{t=u}R^t_{i,j}R(t,i),(u,j)​=1t=u​Ri,jt​, write mR(t)=Re⁡tr⁡Rtm_R(t)=\operatorname{Re}\operatorname{tr}R^tmR​(t)=RetrRt, and define

D(R,S)=12Re⁡tr⁡(R^−S^)†(R^−S^).D(R,S)=\frac12\operatorname{Re}\operatorname{tr} \sqrt{(\widehat R-\widehat S)^\dagger(\widehat R-\widehat S)}.D(R,S)=21​Retr(R−S)†(R−S)​.

Passive equality security means that δ,ϵ≥0\delta,\epsilon\ge0δ,ϵ≥0; for every a,b∈Wa,b\in Wa,b∈W, both A^a,b\widehat A_{a,b}Aa,b​ and B^a,b\widehat B_{a,b}Ba,b​ are positive semidefinite with trace 111, their masses agree for each Boolean ttt, and mBa,b(1a=b)≥1−δm_{B_{a,b}}(\mathbf1_{a=b})\ge1-\deltamBa,b​​(1a=b​)≥1−δ; for every a,b,c∈Wa,b,c\in Wa,b,c∈W with b≠ab\ne ab=a and c≠ac\ne ac=a, D(Aa,b,Aa,c)≤ϵD(A_{a,b},A_{a,c})\le\epsilonD(Aa,b​,Aa,c​)≤ϵ; and for every b,a,c∈Wb,a,c\in Wb,a,c∈W with a≠ba\ne ba=b and c≠bc\ne bc=b, D(Ba,b,Bc,b)≤ϵD(B_{a,b},B_{c,b})\le\epsilonD(Ba,b​,Bc,b​)≤ϵ. Here 1a=b\mathbf1_{a=b}1a=b​ is the Boolean truth value of equality. No upper bounds on δ,ϵ\delta,\epsilonδ,ϵ are imposed, and WWW need not be finite or nonempty; if WWW is empty, all conditions involving its elements are vacuous.

QAlgorithms.Papers.Independent.Intakenext100.P14.PassiveExecution

For arbitrary types W,EA,EBW,E_A,E_BW,EA​,EB​, a passive execution consists of two families of complex square matrices,

Aa,bt∈CEA×EA,Ba,bt∈CEB×EB,a,b∈W,t∈{false,true}.A_{a,b}^{t}\in\mathbb C^{E_A\times E_A}, \qquad B_{a,b}^{t}\in\mathbb C^{E_B\times E_B}, \qquad a,b\in W,\quad t\in\{\mathrm{false},\mathrm{true}\}.Aa,bt​∈CEA​×EA​,Ba,bt​∈CEB​×EB​,a,b∈W,t∈{false,true}.

The families are named Alice’s and Bob’s, respectively. The structure imposes no positivity, normalization, agreement, or correctness conditions, and none of the three types is required to be finite or nonempty.

QAlgorithms.Papers.Independent.Intakenext100.P14.QIDParameters

For natural numbers n,ℓ,m,dn,\ell,m,dn,ℓ,m,d and finite types F,GF,GF,G, let Br\mathcal B_rBr​ denote the Boolean strings of length rrr. A parameter record consists of an injective function C:{0,…,m−1}→BnC:\{0,\ldots,m-1\}\to\mathcal B_nC:{0,…,m−1}→Bn​, satisfying

a≠b ⟹ d≤#{j:C(a)j≠C(b)j},a\ne b\ \Longrightarrow\ d\le\#\{j:C(a)_j\ne C(b)_j\},a=b ⟹ d≤#{j:C(a)j​=C(b)j​},

and functions HF:F→Bn→BℓH_F:F\to\mathcal B_n\to\mathcal B_\ellHF​:F→Bn​→Bℓ​ and HG:G→{0,…,m−1}→BℓH_G:G\to\{0,\ldots,m-1\}\to\mathcal B_\ellHG​:G→{0,…,m−1}→Bℓ​. They must satisfy, for all distinct x,y∈Bnx,y\in\mathcal B_nx,y∈Bn​ and all u,v∈Bℓu,v\in\mathcal B_\ellu,v∈Bℓ​,

#{f∈F:HF(f,x)=u, HF(f,y)=v}∣F∣=2−2ℓ,\frac{\#\{f\in F:H_F(f,x)=u,\ H_F(f,y)=v\}}{|F|}=2^{-2\ell},∣F∣#{f∈F:HF​(f,x)=u, HF​(f,y)=v}​=2−2ℓ,

and, for all distinct a,b<ma,b<ma,b<m and all u,v∈Bℓu,v\in\mathcal B_\ellu,v∈Bℓ​,

#{g∈G:HG(g,a)=u, HG(g,b)=v}∣G∣=2−2ℓ.\frac{\#\{g\in G:H_G(g,a)=u,\ H_G(g,b)=v\}}{|G|}=2^{-2\ell}.∣G∣#{g∈G:HG​(g,a)=u, HG​(g,b)=v}​=2−2ℓ.

All four natural parameters may be zero, and neither key type is explicitly required to be nonempty; quotients with zero denominator are zero. The distance and second hash conditions are vacuous when m≤1m\le1m≤1, and the first hash condition is vacuous when n=0n=0n=0. For m=0m=0m=0, the code has empty domain; for ℓ=0\ell=0ℓ=0, the tag space contains the single empty string.

QAlgorithms.Papers.Independent.Intakenext100.P14.ServerAttack

For natural numbers n,ℓ,qn,\ell,qn,ℓ,q and finite types F,G,Y,EF,G,Y,EF,G,Y,E, a server attack consists of a checkpoint instrument from the space indexed by length-nnn Boolean strings to that indexed by length-qqq Boolean strings, with outcomes YYY; a choice of another instrument from the latter space to the space indexed by EEE, with outcomes GGG, for every θ∈Bn,f∈F,y∈Y\theta\in\mathcal B_n,f\in F,y\in Yθ∈Bn​,f∈F,y∈Y; and a map Φθ,f,y,g,z\Phi_{\theta,f,y,g,z}Φθ,f,y,g,z​ from complex E×EE\times EE×E matrices to themselves for every additional g∈G,z∈Bℓg\in G,z\in\mathcal B_\ellg∈G,z∈Bℓ​. Explicitly, the checkpoint supplies a natural number rrr and matrices Ky,j∈CBq×BnK_{y,j}\in\mathbb C^{\mathcal B_q\times\mathcal B_n}Ky,j​∈CBq​×Bn​ with

∑y∈Y∑j<rKy,j†Ky,j=IBn;\sum_{y\in Y}\sum_{j<r}K_{y,j}^\dagger K_{y,j}=I_{\mathcal B_n};y∈Y∑​j<r∑​Ky,j†​Ky,j​=IBn​​;

each chosen instrument supplies a natural number rθ,f,yr_{\theta,f,y}rθ,f,y​ and matrices Lθ,f,y,g,j∈CE×BqL_{\theta,f,y,g,j}\in\mathbb C^{E\times\mathcal B_q}Lθ,f,y,g,j​∈CE×Bq​ with

∑g∈G∑j<rθ,f,yLθ,f,y,g,j†Lθ,f,y,g,j=IBq.\sum_{g\in G}\sum_{j<r_{\theta,f,y}} L_{\theta,f,y,g,j}^\dagger L_{\theta,f,y,g,j}=I_{\mathcal B_q}.g∈G∑​j<rθ,f,y​∑​Lθ,f,y,g,j†​Lθ,f,y,g,j​=IBq​​.

Every finishing map must admit a finite Kraus representation: there exist s∈Ns\in\mathbb Ns∈N and Mj∈CE×EM_j\in\mathbb C^{E\times E}Mj​∈CE×E such that ∑j<sMj†Mj=IE\sum_{j<s}M_j^\dagger M_j=I_E∑j<s​Mj†​Mj​=IE​ and Φθ,f,y,g,z(X)=∑j<sMjXMj†\Phi_{\theta,f,y,g,z}(X)=\sum_{j<s}M_jXM_j^\daggerΦθ,f,y,g,z​(X)=∑j<s​Mj​XMj†​ for every matrix XXX. The definition imposes no positivity requirements on n,ℓ,qn,\ell,qn,ℓ,q, no nonemptiness requirements on the finite types, and no additional relations between these choices; the completeness equations themselves can exclude choices with empty outcome sets.

QAlgorithms.Papers.Independent.Intakenext100.P14.ServerSecurity

For natural numbers n,ℓ,mn,\ell,mn,ℓ,m, finite types F,G,EF,G,EF,G,E, an arbitrary matrix family ρw,h∈CE×E\rho_{w,h}\in\mathbb C^{E\times E}ρw,h​∈CE×E, and a real ϵ\epsilonϵ, let histories be h=(θ,f,g,z,a)h=(\theta,f,g,z,a)h=(θ,f,g,z,a) with θ∈{0,1}n\theta\in\{0,1\}^nθ∈{0,1}n, f∈Ff\in Ff∈F, g∈Gg\in Gg∈G, optional tag z∈{0,1}ℓ∪{none}z\in\{0,1\}^\ell\cup\{\mathrm{none}\}z∈{0,1}ℓ∪{none}, and Boolean aaa. This proposition asserts the existence of matrices ηw,j,h\eta_{w,j,h}ηw,j,h​ with w<mw<mw<m and j∈{0,…,m−1}∪{none}j\in\{0,\ldots,m-1\}\cup\{\mathrm{none}\}j∈{0,…,m−1}∪{none} such that their block-diagonal matrix is positive semidefinite with trace 111, ∑jηw,j,h=ρw,h\sum_j\eta_{w,j,h}=\rho_{w,h}∑j​ηw,j,h​=ρw,h​, and, writing t(X)=Re⁡Tr⁡Xt(X)=\operatorname{Re}\operatorname{Tr}Xt(X)=ReTrX,

t ⁣(∑hηw,j,h)=t ⁣(∑hρw,h)t ⁣(∑w′,hηw′,j,h).t\!\left(\sum_h\eta_{w,j,h}\right) =t\!\left(\sum_h\rho_{w,h}\right) t\!\left(\sum_{w',h}\eta_{w',j,h}\right).t(h∑​ηw,j,h​)=t(h∑​ρw,h​)t​w′,h∑​ηw′,j,h​​.

For the event B={(w,j,h):some(w)≠j}B=\{(w,j,h):\mathrm{some}(w)\ne j\}B={(w,j,h):some(w)=j}, form rrr by restricting η\etaη to BBB and dividing by its trace mass pBp_BpB​ when pB>0p_B>0pB​>0; when pB≤0p_B\le0pB​≤0, use r=ηr=\etar=η. The block-diagonal matrices of rrr and

Mw,j,h=t(∑h′rw,j,h′)t(∑w′,h′rw′,j,h′)∑w′rw′,j,hM_{w,j,h} =\frac{t(\sum_{h'}r_{w,j,h'})}{t(\sum_{w',h'}r_{w',j,h'})} \sum_{w'}r_{w',j,h}Mw,j,h​=t(∑w′,h′​rw′,j,h′​)t(∑h′​rw,j,h′​)​w′∑​rw′,j,h​

must have trace distance at most ϵ\epsilonϵ, meaning 12Re⁡Tr⁡D†D≤ϵ\frac12\operatorname{Re}\operatorname{Tr}\sqrt{D^\dagger D}\le\epsilon21​ReTrD†D​≤ϵ for their difference DDD, with zero denominators giving zero. Finally, the extension must satisfy

∑w,j,hj=some(w), a=falset(ηw,j,h)=0,∑w,j,hj≠some(w), a=truet(ηw,j,h)≤ϵ∑w,j,hj≠some(w)t(ηw,j,h).\sum_{\substack{w,j,h\\j=\mathrm{some}(w),\ a=\mathrm{false}}} t(\eta_{w,j,h})=0, \qquad \sum_{\substack{w,j,h\\j\ne\mathrm{some}(w),\ a=\mathrm{true}}} t(\eta_{w,j,h}) \le \epsilon\sum_{\substack{w,j,h\\j\ne\mathrm{some}(w)}}t(\eta_{w,j,h}).w,j,hj=some(w), a=false​∑​t(ηw,j,h​)=0,w,j,hj=some(w), a=true​∑​t(ηw,j,h​)≤ϵw,j,hj=some(w)​∑​t(ηw,j,h​).

A missing guess belongs to the incorrect-guess event for every www. No nonnegativity assumption on ϵ\epsilonϵ is included; empty indexing spaces that make the block matrix zero cannot satisfy its trace-one requirement.

QAlgorithms.Papers.Independent.Intakenext100.P14.StrongUniversal

For arbitrary types I,A,BI,A,BI,A,B, with III and BBB finite, a function f:I→A→Bf:I\to A\to Bf:I→A→B is strongly universal precisely when, for every pair of distinct x,y∈Ax,y\in Ax,y∈A and every u,v∈Bu,v\in Bu,v∈B,

#{i∈I:f(i,x)=u and f(i,y)=v}∣I∣=1∣B∣2.\frac{\#\{i\in I:f(i,x)=u\ \text{and}\ f(i,y)=v\}}{|I|} =\frac1{|B|^2}.∣I∣#{i∈I:f(i,x)=u and f(i,y)=v}​=∣B∣21​.

No finiteness assumption on AAA, and no nonemptiness assumption on III or BBB, is included. Division by zero is defined to be zero. If AAA has no distinct pair, or if BBB is empty, the corresponding universal conditions are vacuous; if III is empty, BBB is nonempty, and AAA has a distinct pair, the displayed requirement cannot hold.

QAlgorithms.Papers.Independent.Intakenext100.P14.UserAttack

For natural numbers n,ℓn,\elln,ℓ, finite types F,G,R,EF,G,R,EF,G,R,E, and Qr={0,1}r\mathcal Q_r=\{0,1\}^rQr​={0,1}r, this structure consists of a family Sθ,f∈C(Qn×R)×(Qn×R)S_{\theta,f}\in\mathbb C^{(\mathcal Q_n\times R)\times(\mathcal Q_n\times R)}Sθ,f​∈C(Qn​×R)×(Qn​×R), indexed by (θ,f)∈Qn×F(\theta,f)\in\mathcal Q_n\times F(θ,f)∈Qn​×F, whose block-diagonal matrix is positive semidefinite and has trace 111; for every θ∈Qn\theta\in\mathcal Q_nθ∈Qn​, f∈Ff\in Ff∈F, and g∈Gg\in Gg∈G, an instrument from RRR to EEE with outcomes none\mathrm{none}none or some(z)\mathrm{some}(z)some(z) for z∈Qℓz\in\mathcal Q_\ellz∈Qℓ​; and, for every θ,f,g\theta,f,gθ,f,g, optional tag zzz, and Boolean aaa, a channel Fθ,f,g,z,a\mathcal F_{\theta,f,g,z,a}Fθ,f,g,z,a​ from EEE to itself. Each response instrument supplies a natural-number Kraus count and matrices Kz,j:E×R→CK_{z,j}:E\times R\to\mathbb CKz,j​:E×R→C with ∑z,jKz,j†Kz,j=IR\sum_{z,j}K_{z,j}^\dagger K_{z,j}=I_R∑z,j​Kz,j†​Kz,j​=IR​, and its branch sends XXX to ∑jKz,jXKz,j†\sum_jK_{z,j}XK_{z,j}^\dagger∑j​Kz,j​XKz,j†​. Each finishing map has a finite Kraus representation ∑jLjXLj†\sum_jL_jXL_j^\dagger∑j​Lj​XLj†​ with ∑jLj†Lj=IE\sum_jL_j^\dagger L_j=I_E∑j​Lj†​Lj​=IE​. The individual Sθ,fS_{\theta,f}Sθ,f​ are not required to have trace 111; normalization applies to their combined block matrix. Zero register lengths are allowed; the normalized preparation cannot exist if FFF or RRR is empty.

QAlgorithms.Papers.Independent.Intakenext100.P14.UserHistory

For natural numbers n,ℓn,\elln,ℓ and arbitrary types F,GF,GF,G, this is the type of tuples (θ,f,g,z,a)(\theta,f,g,z,a)(θ,f,g,z,a), where θ∈{0,1}n\theta\in\{0,1\}^nθ∈{0,1}n, f∈Ff\in Ff∈F, g∈Gg\in Gg∈G, zzz is either none\mathrm{none}none or some(u)\mathrm{some}(u)some(u) for u∈{0,1}ℓu\in\{0,1\}^\ellu∈{0,1}ℓ, and aaa is a Boolean. No consistency condition is imposed on these components. Length-zero bit strings are included, and the history type is empty if FFF or GGG is empty.

QAlgorithms.Papers.Independent.Intakenext100.P14.affineTag

Let KKK be a field equipped with an algebra structure over F2=Z/2Z\mathbb F_2=\mathbb Z/2\mathbb ZF2​=Z/2Z, let N,ℓN,\ellN,ℓ be natural numbers with ℓ≤N\ell\le Nℓ≤N, and let C:K→F2NC:K\to\mathbb F_2^NC:K→F2N​ be an F2\mathbb F_2F2​-linear equivalence. For every key (a,b)∈K×F2ℓ(a,b)\in K\times\mathbb F_2^\ell(a,b)∈K×F2ℓ​ and input x∈Kx\in Kx∈K, this definition returns the vector

Ha,b(x)i=C(ax)i+bi,0≤i<ℓ,H_{a,b}(x)_i=C(ax)_i+b_i,\qquad 0\le i<\ell,Ha,b​(x)i​=C(ax)i​+bi​,0≤i<ℓ,

where the coordinate iii is viewed as one of the first ℓ\ellℓ coordinates of F2N\mathbb F_2^NF2N​, and addition is in F2\mathbb F_2F2​. No finiteness assumption on KKK is separately supplied. The case ℓ=0\ell=0ℓ=0 returns the unique empty vector; N=0N=0N=0 cannot admit the stipulated linear equivalence from a field.

QAlgorithms.Papers.Independent.Intakenext100.P14.andPassword

For any type WWW, arbitrary elements wzero,wone∈Ww_{\mathrm{zero}},w_{\mathrm{one}}\in Wwzero​,wone​∈W, and Boolean bbb, this defines

andPassword⁡(wzero,wone,b)={wone,b=true,wzero,b=false.\operatorname{andPassword}(w_{\mathrm{zero}},w_{\mathrm{one}},b)= \begin{cases} w_{\mathrm{one}},&b=\mathrm{true},\\ w_{\mathrm{zero}},&b=\mathrm{false}. \end{cases}andPassword(wzero​,wone​,b)={wone​,wzero​,​b=true,b=false.​

The two supplied elements are not required to be distinct.

QAlgorithms.Papers.Independent.Intakenext100.P14.bb84Probability

For every natural number nnn and Boolean strings x,θ,y,c∈Bnx,\theta,y,c\in\mathcal B_nx,θ,y,c∈Bn​, define a vector ψx,θ∈CBn\psi_{x,\theta}\in\mathbb C^{\mathcal B_n}ψx,θ​∈CBn​ by

ψx,θ(t)=∏i=0n−1{(−1)tixi/2,θi=true,1ti=xi,θi=false,\psi_{x,\theta}(t)= \prod_{i=0}^{n-1} \begin{cases} (-1)^{t_i x_i}/\sqrt2,&\theta_i=\mathrm{true},\\ \mathbf1_{t_i=x_i},&\theta_i=\mathrm{false}, \end{cases}ψx,θ​(t)=i=0∏n−1​{(−1)ti​xi​/2​,1ti​=xi​​,​θi​=true,θi​=false,​

where bits in the exponent are interpreted as 000 or 111. The defined real number is the squared complex modulus

bb84Probability⁡(x,θ,y,c)=∣∑t∈Bnψy,c(t)‾ ψx,θ(t)∣2.\operatorname{bb84Probability}(x,\theta,y,c) =\left|\sum_{t\in\mathcal B_n} \overline{\psi_{y,c}(t)}\,\psi_{x,\theta}(t)\right|^2.bb84Probability(x,θ,y,c)=​t∈Bn​∑​ψy,c​(t)​ψx,θ​(t)​2.

When n=0n=0n=0, the products are empty products equal to 111, the sum has one term, and the value is 111.

QAlgorithms.Papers.Independent.Intakenext100.P14.blockMass

For any type CCC, finite type EEE, family r:C→Mat⁡E(C)r:C\to\operatorname{Mat}_{E}(\mathbb C)r:C→MatE​(C), and c∈Cc\in Cc∈C, this defines

blockMass⁡(r,c)=Re⁡tr⁡(r(c))=∑e∈ERe⁡(r(c)e,e).\operatorname{blockMass}(r,c) =\operatorname{Re}\operatorname{tr}(r(c)) =\sum_{e\in E}\operatorname{Re}(r(c)_{e,e}).blockMass(r,c)=Retr(r(c))=e∈E∑​Re(r(c)e,e​).

The matrices need not be positive, Hermitian, or normalized, so this value need not be nonnegative. It is zero when EEE is empty.

QAlgorithms.Papers.Independent.Intakenext100.P14.classicalIdealTagLaw

For any finite types K,SK,SK,S, arbitrary type ZZZ, natural number ℓ\ellℓ, probability weights p:S→Rp:S\to\mathbb Rp:S→R satisfying ps≥0p_s\ge0ps​≥0 and ∑sps=1\sum_sp_s=1∑s​ps​=1, and function z:S→Zz:S\to Zz:S→Z, this definition assigns to each (t,(a,b),ζ)∈F2ℓ×(K×F2ℓ)×Z(t,(a,b),\zeta)\in\mathbb F_2^\ell\times(K\times\mathbb F_2^\ell)\times Z(t,(a,b),ζ)∈F2ℓ​×(K×F2ℓ​)×Z the value

1∣K∣ 22ℓ∑s∈Sz(s)=ζps.\frac{1}{|K|\,2^{2\ell}} \sum_{\substack{s\in S\\z(s)=\zeta}}p_s.∣K∣22ℓ1​s∈Sz(s)=ζ​∑​ps​.

Thus the value does not depend on t,a,bt,a,bt,a,b. No field structure or nonemptiness assumption on KKK, and no finiteness assumption on ZZZ, is required. An empty KKK makes the coefficient zero under the convention 0−1=00^{-1}=00−1=0, and also makes the function’s domain empty. The existence of ppp excludes empty SSS; ℓ=0\ell=0ℓ=0 is included.

QAlgorithms.Papers.Independent.Intakenext100.P14.classicalTagLaw

Let KKK be a finite field equipped with an F2\mathbb F_2F2​-algebra structure, SSS a finite type, ZZZ an arbitrary type, N,ℓN,\ellN,ℓ natural numbers with ℓ≤N\ell\le Nℓ≤N, and C:K→F2NC:K\to\mathbb F_2^NC:K→F2N​ an F2\mathbb F_2F2​-linear equivalence. Let p:S→Rp:S\to\mathbb Rp:S→R satisfy ps≥0p_s\ge0ps​≥0 and ∑sps=1\sum_sp_s=1∑s​ps​=1, and let X:S→KX:S\to KX:S→K and z:S→Zz:S\to Zz:S→Z be arbitrary functions. This definition assigns to each (t,(a,b),ζ)∈F2ℓ×(K×F2ℓ)×Z(t,(a,b),\zeta)\in\mathbb F_2^\ell\times(K\times\mathbb F_2^\ell)\times Z(t,(a,b),ζ)∈F2ℓ​×(K×F2ℓ​)×Z the real value

1∣K∣ 2ℓ∑s∈Sti=C(aX(s))i+bi for all i<ℓζ=z(s)ps.\frac{1}{|K|\,2^\ell} \sum_{\substack{s\in S\\ t_i=C(aX(s))_i+b_i\ \text{for all }i<\ell\\ \zeta=z(s)}}p_s.∣K∣2ℓ1​s∈Sti​=C(aX(s))i​+bi​ for all i<ℓζ=z(s)​∑​ps​.

The coordinate arithmetic is in F2\mathbb F_2F2​. No finiteness assumption on ZZZ or strict positivity assumption on the individual psp_sps​ is imposed; the existence of ppp excludes empty SSS. For ℓ=0\ell=0ℓ=0, the tag condition is vacuous and the tag and offset vectors are empty.

QAlgorithms.Papers.Independent.Intakenext100.P14.conditionMass

For any finite type SSS, arbitrary p:S→Rp:S\to\mathbb Rp:S→R, and predicate EEE on SSS, this defines a function on SSS by

conditionMass⁡(p,E)(s)={p(s)∑t: E(t)p(t),E(s),0,¬E(s).\operatorname{conditionMass}(p,E)(s)= \begin{cases} \displaystyle\frac{p(s)}{\sum_{t:\,E(t)}p(t)},&E(s),\\ 0,&\neg E(s). \end{cases}conditionMass(p,E)(s)=⎩⎨⎧​∑t:E(t)​p(t)p(s)​,0,​E(s),¬E(s).​

There are no positivity or normalization assumptions. Division by zero is defined to be zero, so if the event has total mass zero, the resulting function is identically zero, even if that total vanishes through cancellation of signed masses.

QAlgorithms.Papers.Independent.Intakenext100.P14.cqCondition

For finite types C,EC,EC,E, any family r:C→Mat⁡E(C)r:C\to\operatorname{Mat}_{E}(\mathbb C)r:C→MatE​(C), and predicate FFF on CCC, let

p=∑c∈CF(c)Re⁡tr⁡(r(c)).p=\sum_{\substack{c\in C\\F(c)}}\operatorname{Re}\operatorname{tr}(r(c)).p=c∈CF(c)​∑​Retr(r(c)).

This defines

cqCondition⁡(r,F)(c)={p−1r(c),p>0 and F(c),0,p>0 and ¬F(c),r(c),p≤0.\operatorname{cqCondition}(r,F)(c)= \begin{cases} p^{-1}r(c),&p>0\text{ and }F(c),\\ 0,&p>0\text{ and }\neg F(c),\\ r(c),&p\le0. \end{cases}cqCondition(r,F)(c)=⎩⎨⎧​p−1r(c),0,r(c),​p>0 and F(c),p>0 and ¬F(c),p≤0.​

The real scaling factor is embedded in C\mathbb CC. No positivity or normalization is assumed; in particular, when the event mass is zero or negative, the entire original family is returned.

QAlgorithms.Papers.Independent.Intakenext100.P14.cqPush

For any finite type CCC, arbitrary types D,ED,ED,E, family r:C→Mat⁡E(C)r:C\to\operatorname{Mat}_{E}(\mathbb C)r:C→MatE​(C), and function f:C→Df:C\to Df:C→D, this defines the matrix family

cqPush⁡(r,f)(d)=∑c∈Cf(c)=dr(c)(d∈D).\operatorname{cqPush}(r,f)(d)=\sum_{\substack{c\in C\\f(c)=d}}r(c) \qquad(d\in D).cqPush(r,f)(d)=c∈Cf(c)=d​∑​r(c)(d∈D).

No positivity or normalization is assumed, and neither DDD nor EEE is required to be finite. Empty fibers give the zero matrix.

QAlgorithms.Papers.Independent.Intakenext100.P14.guessingMass

For finite types S,A,BS,A,BS,A,B, with AAA nonempty, arbitrary p:S→Rp:S\to\mathbb Rp:S→R, and functions X:S→AX:S\to AX:S→A and Y:S→BY:S\to BY:S→B, this defines

guessingMass⁡(p,X,Y)=∑b∈Bmax⁡a∈A∑s∈SX(s)=a, Y(s)=bp(s).\operatorname{guessingMass}(p,X,Y) =\sum_{b\in B}\max_{a\in A} \sum_{\substack{s\in S\\X(s)=a,\ Y(s)=b}}p(s).guessingMass(p,X,Y)=b∈B∑​a∈Amax​s∈SX(s)=a, Y(s)=b​∑​p(s).

The maximum is over every element of AAA, including values with empty fibers. No nonnegativity or normalization is assumed. If SSS or BBB is empty, the result is zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.honestAcceptance

Let n,ℓ,m,dn,\ell,m,dn,ℓ,m,d be natural numbers, F,GF,GF,G finite types, and PPP a record with an injective code C:{0,…,m−1}→BnC:\{0,\ldots,m-1\}\to\mathcal B_nC:{0,…,m−1}→Bn​ of minimum pairwise Hamming distance at least ddd, and hash families HF:F→Bn→BℓH_F:F\to\mathcal B_n\to\mathcal B_\ellHF​:F→Bn​→Bℓ​, HG:G→{0,…,m−1}→BℓH_G:G\to\{0,\ldots,m-1\}\to\mathcal B_\ellHG​:G→{0,…,m−1}→Bℓ​, each requiring the fraction of keys mapping any distinct input pair to any specified output pair to equal 2−2ℓ2^{-2\ell}2−2ℓ. Fix w<mw<mw<m. Define Rx,θ,wR_{x,\theta,w}Rx,θ,w​ by packing the bits xix_ixi​ with θi=C(w)i\theta_i=C(w)_iθi​=C(w)i​, in increasing index order, into the beginning of a length-nnn string and padding with false, and define Tw(x,θ,f,g)=HF(f,Rx,θ,w)⊕HG(g,w)T_w(x,\theta,f,g)=H_F(f,R_{x,\theta,w})\oplus H_G(g,w)Tw​(x,θ,f,g)=HF​(f,Rx,θ,w​)⊕HG​(g,w) coordinatewise. For t∈Bnt\in\mathcal B_nt∈Bn​, set ψx,θ(t)=∏ihi\psi_{x,\theta}(t)=\prod_i h_iψx,θ​(t)=∏i​hi​, where hi=(−1)tixi/2h_i=(-1)^{t_ix_i}/\sqrt2hi​=(−1)ti​xi​/2​ if θi\theta_iθi​ is true and hi=1ti=xih_i=\mathbf1_{t_i=x_i}hi​=1ti​=xi​​ otherwise. Honest acceptance is the real number

122n∣F∣∣G∣∑x,θ∈Bn∑f∈F∑g∈G∑y∈Bn∣∑t∈Bnψy,C(w)(t)‾ψx,θ(t)∣21Tw(x,θ,f,g)=Tw(y,θ,f,g).\frac1{2^{2n}|F||G|} \sum_{x,\theta\in\mathcal B_n}\sum_{f\in F}\sum_{g\in G}\sum_{y\in\mathcal B_n} \left|\sum_{t\in\mathcal B_n}\overline{\psi_{y,C(w)}(t)}\psi_{x,\theta}(t)\right|^2 \mathbf1_{T_w(x,\theta,f,g)=T_w(y,\theta,f,g)}.22n∣F∣∣G∣1​x,θ∈Bn​∑​f∈F∑​g∈G∑​y∈Bn​∑​​t∈Bn​∑​ψy,C(w)​(t)​ψx,θ​(t)​21Tw​(x,θ,f,g)=Tw​(y,θ,f,g)​.

Here all quotients with zero denominator are zero; in particular, if a key type is empty, this expression is zero. Zero string or tag lengths are permitted, with empty products equal to 111.

QAlgorithms.Papers.Independent.Intakenext100.P14.keyMass

For every finite type KKK and natural number ℓ\ellℓ, this definition returns the real number

1∣K∣ 2ℓ.\frac{1}{|K|\,2^\ell}.∣K∣2ℓ1​.

No nonemptiness assumption on KKK is required: if KKK is empty, the value is zero because the inverse of zero is defined to be zero. When ℓ=0\ell=0ℓ=0, the value is 1/∣K∣1/|K|1/∣K∣, with the same convention.

QAlgorithms.Papers.Independent.Intakenext100.P14.markov

For arbitrary finite types X,Y,EX,Y,EX,Y,E and any matrix family r:X×Y→Mat⁡E(C)r:X\times Y\to\operatorname{Mat}_{E}(\mathbb C)r:X×Y→MatE​(C), set Ry=∑x′∈Xr(x′,y)R_y=\sum_{x'\in X}r(x',y)Ry​=∑x′∈X​r(x′,y). This defines

markov⁡(r)(x,y)=Re⁡tr⁡(r(x,y))Re⁡tr⁡(Ry) Ry,\operatorname{markov}(r)(x,y) =\frac{\operatorname{Re}\operatorname{tr}(r(x,y))} {\operatorname{Re}\operatorname{tr}(R_y)}\,R_y,markov(r)(x,y)=Retr(Ry​)Retr(r(x,y))​Ry​,

where the real scalar is regarded as complex when multiplying the matrix. No positivity, normalization, or nonemptiness is assumed. A zero denominator gives the zero matrix at that (x,y)(x,y)(x,y).

QAlgorithms.Papers.Independent.Intakenext100.P14.markovRight

For arbitrary finite types W,J,H,EW,J,H,EW,J,H,E and any family of complex matrices rw,j,h∈CE×Er_{w,j,h}\in\mathbb C^{E\times E}rw,j,h​∈CE×E, with no positivity or normalization assumption, define t(X)=Re⁡Tr⁡Xt(X)=\operatorname{Re}\operatorname{Tr}Xt(X)=ReTrX. The resulting family is

M(r)w,j,h=t ⁣(∑h′rw,j,h′)t ⁣(∑w′,h′rw′,j,h′)∑w′rw′,j,h.\mathcal M(r)_{w,j,h} = \frac{t\!\left(\sum_{h'}r_{w,j,h'}\right)} {t\!\left(\sum_{w',h'}r_{w',j,h'}\right)} \sum_{w'}r_{w',j,h}.M(r)w,j,h​=t(∑w′,h′​rw′,j,h′​)t(∑h′​rw,j,h′​)​w′∑​rw′,j,h​.

Thus the scalar uses the trace masses of the (w,j)(w,j)(w,j) and jjj marginals, and multiplies the (j,h)(j,h)(j,h) matrix marginal. A zero denominator gives scalar zero, even if the numerator is nonzero; empty index types are permitted and their sums are zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.measuredResidual

For any natural number nnn, any type RRR without a finiteness assumption, an arbitrary complex matrix ρ\rhoρ indexed by Qn×R\mathcal Q_n\times RQn​×R, and strings y,c∈Qn={0,1}ny,c\in\mathcal Q_n=\{0,1\}^ny,c∈Qn​={0,1}n, this defines the RRR-indexed matrix

Sr,s=∑i,j∈Qnvy,c(i)‾ ρ(i,r),(j,s) vy,c(j),vy,c(i)=∏a=0n−1{(−1)iaya/2,ca=1,1ia=ya,ca=0.S_{r,s}=\sum_{i,j\in\mathcal Q_n} \overline{v_{y,c}(i)}\,\rho_{(i,r),(j,s)}\,v_{y,c}(j), \qquad v_{y,c}(i)=\prod_{a=0}^{n-1} \begin{cases} (-1)^{i_ay_a}/\sqrt2,&c_a=1,\\ \mathbf1_{i_a=y_a},&c_a=0. \end{cases}Sr,s​=i,j∈Qn​∑​vy,c​(i)​ρ(i,r),(j,s)​vy,c​(j),vy,c​(i)=a=0∏n−1​{(−1)ia​ya​/2​,1ia​=ya​​,​ca​=1,ca​=0.​

No positivity or normalization assumption is imposed on ρ\rhoρ. When n=0n=0n=0, the product is 111 and the sums have one term, so Sr,s=ρ(∅,r),(∅,s)S_{r,s}=\rho_{(\varnothing,r),(\varnothing,s)}Sr,s​=ρ(∅,r),(∅,s)​.

QAlgorithms.Papers.Independent.Intakenext100.P14.packedRestriction

For every natural number nnn and every three Boolean strings x,θ,c:{0,…,n−1}→{false,true}x,\theta,c:\{0,\ldots,n-1\}\to\{\mathrm{false},\mathrm{true}\}x,θ,c:{0,…,n−1}→{false,true}, form the increasing list i0,…,ir−1i_0,\ldots,i_{r-1}i0​,…,ir−1​ of all indices satisfying θi=ci\theta_i=c_iθi​=ci​. The packed restriction is the Boolean string of length nnn given by

packedRestriction⁡(x,θ,c)j={xij,j<r,false,r≤j<n.\operatorname{packedRestriction}(x,\theta,c)_j= \begin{cases} x_{i_j},&j<r,\\ \mathrm{false},&r\le j<n. \end{cases}packedRestriction(x,θ,c)j​={xij​​,false,​j<r,r≤j<n.​

Thus the selected bits are moved to the beginning in index order and the remaining positions are filled with false. When no indices match, the result is entirely false; when n=0n=0n=0, it is the unique empty string.

QAlgorithms.Papers.Independent.Intakenext100.P14.pushMass

For any finite type SSS, any type AAA, any real function p:S→Rp:S\to\mathbb Rp:S→R, any function X:S→AX:S\to AX:S→A, and any a∈Aa\in Aa∈A, this defines

pushMass⁡(p,X,a)=∑s∈SX(s)=ap(s).\operatorname{pushMass}(p,X,a)=\sum_{\substack{s\in S\\X(s)=a}}p(s).pushMass(p,X,a)=s∈SX(s)=a​∑​p(s).

No nonnegativity or normalization is required of ppp. An empty fiber, including when SSS is empty, contributes zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.qidTag

Let n,ℓ,m,dn,\ell,m,dn,ℓ,m,d be natural numbers and F,GF,GF,G finite types. Let PPP contain an injective code C:{0,…,m−1}→BnC:\{0,\ldots,m-1\}\to\mathcal B_nC:{0,…,m−1}→Bn​ whose distinct codewords have Hamming distance at least ddd, together with hash families HF:F→Bn→BℓH_F:F\to\mathcal B_n\to\mathcal B_\ellHF​:F→Bn​→Bℓ​ and HG:G→{0,…,m−1}→BℓH_G:G\to\{0,\ldots,m-1\}\to\mathcal B_\ellHG​:G→{0,…,m−1}→Bℓ​, each satisfying that the fraction of keys sending any two distinct inputs to any prescribed pair of outputs is 2−2ℓ2^{-2\ell}2−2ℓ, with division by zero interpreted as zero. For w<mw<mw<m, x,θ∈Bnx,\theta\in\mathcal B_nx,θ∈Bn​, f∈Ff\in Ff∈F, and g∈Gg\in Gg∈G, list in increasing order the indices where θi=C(w)i\theta_i=C(w)_iθi​=C(w)i​, copy the corresponding bits of xxx to the beginning of a length-nnn string, and fill its remaining positions with false; call this string RRR. The tag is

qidTag⁡(P,w,x,θ,f,g)j=HF(f,R)j⊕HG(g,w)j(0≤j<ℓ).\operatorname{qidTag}(P,w,x,\theta,f,g)_j =H_F(f,R)_j\oplus H_G(g,w)_j \qquad(0\le j<\ell).qidTag(P,w,x,θ,f,g)j​=HF​(f,R)j​⊕HG​(g,w)j​(0≤j<ℓ).

The arguments w,f,gw,f,gw,f,g must exist for an instance of this definition to be evaluated; n=0n=0n=0 and ℓ=0\ell=0ℓ=0 are allowed.

QAlgorithms.Papers.Independent.Intakenext100.P14.qidUncertaintyExponent

For every real λ\lambdaλ, this defines

ξ(λ)=λ2log⁡2(e)32(2−log⁡2λ)2.\xi(\lambda)= \frac{\lambda^2\log_2(e)} {32(2-\log_2\lambda)^2}.ξ(λ)=32(2−log2​λ)2λ2log2​(e)​.

There is no positivity or interval restriction on λ\lambdaλ. Here the real logarithm is total: log⁡20=0\log_2 0=0log2​0=0, and for negative arguments log⁡2λ=ln⁡∣λ∣/ln⁡2\log_2\lambda=\ln|\lambda|/\ln2log2​λ=ln∣λ∣/ln2; division by zero is zero. In particular, ξ(0)=0\xi(0)=0ξ(0)=0 and the vanishing denominators at λ=4\lambda=4λ=4 and λ=−4\lambda=-4λ=−4 also give value zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.quantumIdealTagLaw

For finite types K,SK,SK,S, an arbitrary type ZZZ, natural numbers ℓ,q\ell,qℓ,q, probability weights p:S→Rp:S\to\mathbb Rp:S→R satisfying ps≥0p_s\ge0ps​≥0 and ∑sps=1\sum_sp_s=1∑s​ps​=1, functions X:S→KX:S\to KX:S→K and z:S→Zz:S\to Zz:S→Z, and arbitrary complex matrices ρ(x,ζ)\rho(x,\zeta)ρ(x,ζ) indexed by Bq={0,1}q\mathcal B_q=\{0,1\}^qBq​={0,1}q, this definition returns

Rideal(t,(a,b),ζ)=1∣K∣ 22ℓ∑s∈Sz(s)=ζps ρ(X(s),z(s))R_{\mathrm{ideal}}(t,(a,b),\zeta)= \frac{1}{|K|\,2^{2\ell}} \sum_{\substack{s\in S\\z(s)=\zeta}} p_s\,\rho(X(s),z(s))Rideal​(t,(a,b),ζ)=∣K∣22ℓ1​s∈Sz(s)=ζ​∑​ps​ρ(X(s),z(s))

for (t,(a,b),ζ)∈F2ℓ×(K×F2ℓ)×Z(t,(a,b),\zeta)\in\mathbb F_2^\ell\times(K\times\mathbb F_2^\ell)\times Z(t,(a,b),ζ)∈F2ℓ​×(K×F2ℓ​)×Z. The value is independent of t,a,bt,a,bt,a,b. There is no field assumption on KKK, no finiteness assumption on ZZZ, and no density-matrix assumption on ρ\rhoρ. The existence of ppp and XXX forces SSS and KKK to be nonempty; the coefficient nevertheless uses the total inverse convention 0−1=00^{-1}=00−1=0. Both ℓ=0\ell=0ℓ=0 and q=0q=0q=0 are included, with empty tag vectors and 1×11\times11×1 matrices, respectively.

QAlgorithms.Papers.Independent.Intakenext100.P14.quantumTagLaw

Let KKK be a finite field equipped with an F2\mathbb F_2F2​-algebra structure, SSS a finite type, ZZZ an arbitrary type, N,ℓ,qN,\ell,qN,ℓ,q natural numbers with ℓ≤N\ell\le Nℓ≤N, and C:K→F2NC:K\to\mathbb F_2^NC:K→F2N​ an F2\mathbb F_2F2​-linear equivalence. Let p:S→Rp:S\to\mathbb Rp:S→R satisfy ps≥0p_s\ge0ps​≥0 and ∑sps=1\sum_sp_s=1∑s​ps​=1, let X:S→KX:S\to KX:S→K and z:S→Zz:S\to Zz:S→Z, and let ρ(x,ζ)\rho(x,\zeta)ρ(x,ζ) be arbitrary complex matrices indexed by the qqq-bit strings Bq={0,1}q\mathcal B_q=\{0,1\}^qBq​={0,1}q. This definition returns the matrix-valued function

R(t,(a,b),ζ)=1∣K∣ 2ℓ∑s∈Sti=C(aX(s))i+bi for all i<ℓζ=z(s)ps ρ(X(s),z(s))R(t,(a,b),\zeta)= \frac{1}{|K|\,2^\ell} \sum_{\substack{s\in S\\ t_i=C(aX(s))_i+b_i\ \text{for all }i<\ell\\ \zeta=z(s)}}p_s\,\rho(X(s),z(s))R(t,(a,b),ζ)=∣K∣2ℓ1​s∈Sti​=C(aX(s))i​+bi​ for all i<ℓζ=z(s)​∑​ps​ρ(X(s),z(s))

on F2ℓ×(K×F2ℓ)×Z\mathbb F_2^\ell\times(K\times\mathbb F_2^\ell)\times ZF2ℓ​×(K×F2ℓ​)×Z, with real coefficients acting as complex scalars. No positivity, trace, or normalization requirement is imposed on the matrices ρ(x,ζ)\rho(x,\zeta)ρ(x,ζ). The type ZZZ need not be finite, zero weights are allowed, and ppp cannot exist on empty SSS. When ℓ=0\ell=0ℓ=0, the tag condition is vacuous; when q=0q=0q=0, the matrices are 1×11\times11×1, since there is one empty bit string.

QAlgorithms.Papers.Independent.Intakenext100.P14.serverOutput

For natural numbers n,ℓ,m,d,qn,\ell,m,d,qn,ℓ,m,d,q, finite types F,G,Y,EF,G,Y,EF,G,Y,E, and Qr={0,1}r\mathcal Q_r=\{0,1\}^rQr​={0,1}r (including its single empty string when r=0r=0r=0), this defines an EEE-indexed complex matrix Rw,θ,f,y,g,zR_{w,\theta,f,y,g,z}Rw,θ,f,y,g,z​ for each (w,θ,f,y,g,z)∈{0,…,m−1}×Qn×F×Y×G×Qℓ(w,\theta,f,y,g,z)\in\{0,\ldots,m-1\}\times\mathcal Q_n\times F\times Y\times G\times\mathcal Q_\ell(w,θ,f,y,g,z)∈{0,…,m−1}×Qn​×F×Y×G×Qℓ​. The parameter WWW supplies probabilities Ww≥0W_w\ge0Ww​≥0 with ∑wWw=1\sum_wW_w=1∑w​Ww​=1. The parameter PPP supplies an injective map C:{0,…,m−1}→QnC:\{0,\ldots,m-1\}\to\mathcal Q_nC:{0,…,m−1}→Qn​, with Hamming distance at least ddd between distinct images, and hash families hf:Qn→Qℓh_f:\mathcal Q_n\to\mathcal Q_\ellhf​:Qn​→Qℓ​ and kg:{0,…,m−1}→Qℓk_g:\{0,\ldots,m-1\}\to\mathcal Q_\ellkg​:{0,…,m−1}→Qℓ​; for either family, every pair of distinct inputs and every pair of prescribed outputs occurs for a fraction 2−2ℓ2^{-2\ell}2−2ℓ of the keys. Write TP(w,x,θ,f,g)=hf(pack⁡θ,C(w)x)⊕kg(w)T_P(w,x,\theta,f,g)=h_f(\operatorname{pack}_{\theta,C(w)}x)\oplus k_g(w)TP​(w,x,θ,f,g)=hf​(packθ,C(w)​x)⊕kg​(w), where packing lists, in increasing coordinate order, the bits xix_ixi​ for which θi=C(w)i\theta_i=C(w)_iθi​=C(w)i​, then pads the list with false bits to length nnn, and ⊕\oplus⊕ is coordinatewise XOR. The parameter AAA supplies a checkpoint instrument from Qn\mathcal Q_nQn​ to Qq\mathcal Q_qQq​ with outcomes y∈Yy\in Yy∈Y, an instrument from Qq\mathcal Q_qQq​ to EEE with outcomes g∈Gg\in Gg∈G for each (θ,f,y)(\theta,f,y)(θ,f,y), and a channel Fθ,f,y,g,z\mathcal F_{\theta,f,y,g,z}Fθ,f,y,g,z​ on EEE for every transcript. An instrument branch is Bo(X)=∑jKo,jXKo,j†\mathcal B_o(X)=\sum_jK_{o,j}XK_{o,j}^\daggerBo​(X)=∑j​Ko,j​XKo,j†​, with a finite common Kraus count within each instrument and ∑o,jKo,j†Ko,j=I\sum_{o,j}K_{o,j}^\dagger K_{o,j}=I∑o,j​Ko,j†​Ko,j​=I; each finishing channel has a finite Kraus representation with the same completeness condition. With vx,θ(u)=∏iHui,xiv_{x,\theta}(u)=\prod_i H_{u_i,x_i}vx,θ​(u)=∏i​Hui​,xi​​ on coordinates where θi\theta_iθi​ is true and Kronecker-delta factors 1ui=xi\mathbf1_{u_i=x_i}1ui​=xi​​ on the other coordinates, where Ha,b=(−1)ab/2H_{a,b}=(-1)^{ab}/\sqrt2Ha,b​=(−1)ab/2​, the definition is

Rw,θ,f,y,g,z=Ww22n∣F∣∑x∈Qnz=TP(w,x,θ,f,g)Fθ,f,y,g,z ⁣(Bgθ,f,y(Bycheckpoint(vx,θvx,θ†))).R_{w,\theta,f,y,g,z} =\frac{W_w}{2^{2n}|F|} \sum_{\substack{x\in\mathcal Q_n\\z=T_P(w,x,\theta,f,g)}} \mathcal F_{\theta,f,y,g,z} \!\left(\mathcal B^{\theta,f,y}_g \left(\mathcal B^{\mathrm{checkpoint}}_y(v_{x,\theta}v_{x,\theta}^\dagger)\right)\right).Rw,θ,f,y,g,z​=22n∣F∣Ww​​x∈Qn​z=TP​(w,x,θ,f,g)​∑​Fθ,f,y,g,z​(Bgθ,f,y​(Bycheckpoint​(vx,θ​vx,θ†​))).

There are no separate positivity assumptions on the natural-number parameters; WWW cannot exist when m=0m=0m=0, and division by a zero denominator is defined to be zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.smoothGuess

For finite types S,A,BS,A,BS,A,B, with AAA nonempty, arbitrary p:S→Rp:S\to\mathbb Rp:S→R, functions X:S→AX:S\to AX:S→A and Y:S→BY:S\to BY:S→B, and arbitrary ϵ∈R\epsilon\in\mathbb Rϵ∈R, this defines the real infimum

smoothGuess⁡(p,X,Y,ϵ)=inf⁡{∑b∈Bmax⁡a∈A∑s∈SX(s)=a, Y(s)=br(s) | r:S→R, ∀s, 0≤r(s)≤p(s), 1−ϵ≤∑sr(s)}.\operatorname{smoothGuess}(p,X,Y,\epsilon) =\inf\left\{ \sum_{b\in B}\max_{a\in A} \sum_{\substack{s\in S\\X(s)=a,\ Y(s)=b}}r(s) \ \middle|\ r:S\to\mathbb R,\ \forall s,\ 0\le r(s)\le p(s),\ 1-\epsilon\le\sum_s r(s) \right\}.smoothGuess(p,X,Y,ϵ)=inf⎩⎨⎧​b∈B∑​a∈Amax​s∈SX(s)=a, Y(s)=b​∑​r(s) ​ r:S→R, ∀s, 0≤r(s)≤p(s), 1−ϵ≤s∑​r(s)⎭⎬⎫​.

Neither normalization nor nonnegativity of ppp, nor a range restriction on ϵ\epsilonϵ, is assumed. If there is no admissible rrr, the real infimum used here is zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.userOutput

For natural numbers n,ℓ,m,dn,\ell,m,dn,ℓ,m,d, finite types F,G,R,EF,G,R,EF,G,R,E, and Qr={0,1}r\mathcal Q_r=\{0,1\}^rQr​={0,1}r, this defines an EEE-indexed matrix for every password w<mw<mw<m and history (θ,f,g,z,a)∈Qn×F×G×(Qℓ∪{none})×{0,1}(\theta,f,g,z,a)\in\mathcal Q_n\times F\times G\times(\mathcal Q_\ell\cup\{\mathrm{none}\})\times\{0,1\}(θ,f,g,z,a)∈Qn​×F×G×(Qℓ​∪{none})×{0,1}. The parameter WWW gives nonnegative weights WwW_wWw​ summing to 111. The parameter PPP gives an injective code C:{0,…,m−1}→QnC:\{0,\ldots,m-1\}\to\mathcal Q_nC:{0,…,m−1}→Qn​ with pairwise Hamming distance at least ddd, and hash families hf:Qn→Qℓh_f:\mathcal Q_n\to\mathcal Q_\ellhf​:Qn​→Qℓ​ and kg:{0,…,m−1}→Qℓk_g:\{0,\ldots,m-1\}\to\mathcal Q_\ellkg​:{0,…,m−1}→Qℓ​ for which each prescribed output pair on distinct inputs occurs for a fraction 2−2ℓ2^{-2\ell}2−2ℓ of keys. Set TP(w,y,θ,f,g)=hf(pack⁡θ,C(w)y)⊕kg(w)T_P(w,y,\theta,f,g)=h_f(\operatorname{pack}_{\theta,C(w)}y)\oplus k_g(w)TP​(w,y,θ,f,g)=hf​(packθ,C(w)​y)⊕kg​(w), with packing retaining matching-basis bits in increasing order and padding with zeros. The attack AAA supplies preparation blocks Sθ,fS_{\theta,f}Sθ,f​ on Qn×R\mathcal Q_n\times RQn​×R whose combined block-diagonal matrix is positive semidefinite with trace 111, response branches Bzθ,f,g(X)=∑jKz,jXKz,j†\mathcal B^{\theta,f,g}_z(X)=\sum_jK_{z,j}XK_{z,j}^\daggerBzθ,f,g​(X)=∑j​Kz,j​XKz,j†​ with ∑z,jKz,j†Kz,j=IR\sum_{z,j}K_{z,j}^\dagger K_{z,j}=I_R∑z,j​Kz,j†​Kz,j​=IR​, and finishing channels Fθ,f,g,z,a\mathcal F_{\theta,f,g,z,a}Fθ,f,g,z,a​ on EEE, each having a finite complete Kraus representation. Let

Dθ,f;y,w(r,s)=∑i,j∈Qnvy,C(w)(i)‾ Sθ,f((i,r),(j,s)) vy,C(w)(j),D_{\theta,f;y,w}(r,s) =\sum_{i,j\in\mathcal Q_n} \overline{v_{y,C(w)}(i)}\,S_{\theta,f}((i,r),(j,s))\,v_{y,C(w)}(j),Dθ,f;y,w​(r,s)=i,j∈Qn​∑​vy,C(w)​(i)​Sθ,f​((i,r),(j,s))vy,C(w)​(j),

where vy,c(i)v_{y,c}(i)vy,c​(i) is the product of (−1)ibyb/2(-1)^{i_by_b}/\sqrt2(−1)ib​yb​/2​ when cb=1c_b=1cb​=1 and 1ib=yb\mathbf1_{i_b=y_b}1ib​=yb​​ otherwise. The output is

Ow,θ,f,g,z,a=Ww∣G∣∑y∈Qna=1z=some(TP(w,y,θ,f,g))Fθ,f,g,z,a(Bzθ,f,g(Dθ,f;y,w)).O_{w,\theta,f,g,z,a} =\frac{W_w}{|G|} \sum_{\substack{y\in\mathcal Q_n\\ a=\mathbf1_{z=\mathrm{some}(T_P(w,y,\theta,f,g))}}} \mathcal F_{\theta,f,g,z,a} \left(\mathcal B^{\theta,f,g}_z(D_{\theta,f;y,w})\right).Ow,θ,f,g,z,a​=∣G∣Ww​​y∈Qn​a=1z=some(TP​(w,y,θ,f,g))​​∑​Fθ,f,g,z,a​(Bzθ,f,g​(Dθ,f;y,w​)).

In particular, a missing tag contributes only to histories with a=falsea=\mathrm{false}a=false. Zero register lengths are allowed, WWW excludes m=0m=0m=0, and division by ∣G∣=0|G|=0∣G∣=0 is defined to be zero.

QAlgorithms.Papers.Independent.Intakenext100.P14.xorTag

For every natural number ℓ\ellℓ and Boolean strings a,ba,ba,b of length ℓ\ellℓ, their XOR tag is the length-ℓ\ellℓ string defined coordinatewise by

xorTag⁡(a,b)i=ai⊕bi(0≤i<ℓ),\operatorname{xorTag}(a,b)_i=a_i\oplus b_i \qquad(0\le i<\ell),xorTag(a,b)i​=ai​⊕bi​(0≤i<ℓ),

where the result is true exactly when the two bits differ. The definition includes ℓ=0\ell=0ℓ=0, in which case the result is the unique empty string.

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

    Confirmed by the moderator at approval.

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