Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Definitions for On rounds in quantum communication

Definition
QAlgorithms_Papers_Independent_Intakethird100_P81

by Gohan · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

The objects the formalized statements of On rounds in quantum communication (arXiv:quant-ph/0004100) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • jointMutualInfoBits: Definition 8, p.8: mutual information in bits, with both marginals computed from rho.
  • jointMarginalProduct: P.11: the product of the actual marginals, never an unrelated state parameter.
  • informationalDistance: P.11: informational distance is the FULL trace norm, without a half factor.
  • swapState: P.11, Lemma 2.1: exchange the named tensor factors.
  • classicalWeight: Pp.11–12: probability of a classical A outcome.
  • firstRegisterConditionalBlock: Pp.11–12: the normalized conditional B state; the zero-probability branch is set to zero and is always multiplied by its zero probability in Lemma 3.2.
  • agreement: P.11, Lemma 3.1: jointly measure a Boolean POVM on A and the standard basis on B.
  • PointerMap: Definition 11, PDF p.12: unrestricted two-sided functional graph. Both input tables have n entries, each in Fin n; the two copies are separately owned.
  • Vertex: The disjoint labelled vertex sets, with standard labels 0,...,n-1 and n,...,2n-1.
  • successor: Definition 11, PDF p.12: no injectivity or acyclicity promise.
  • endpoint: Definition 11, PDF p.12: the endpoint follows k+1 pointers from the fixed Alice vertex.
  • vertexLabel: Definition 11, PDF p.12: standard binary code of the disjoint vertex labels.
  • pointerParity: Definition 11, PDF p.12: XOR of ALL binary bits, independent of leading zero padding.
  • nonDisjoint: Section 6, PDF p.19: the source's DISJ accepts intersecting sets.
  • iteratedLog: P.13: saturated real iterated binary logarithm; the zeroth iterate is n.
  • logStar: P.13: least iteration reaching one. For positive finite integer n this set is nonempty; all resource statements exclude n<2.
  • ClassicalTree: Definition 4, pp.5–6: a finite deterministic binary protocol with local output.
  • ClassicalTree.run: Definition 4, pp.5–6: execution follows the local input at each transcript node.
  • ClassicalTree.cost: Definition 4, pp.5–6: worst-case transmitted bits; local announcements cost nothing. Unused branches can be pruned, so this presents every finite worst-case protocol.
  • ClassicalTree.changes: P.6: number of subsequent speaker changes along the worst branch.
  • ClassicalTree.rounds: P.6: at most k messages with the specified starter, allowing empty padding.
  • PublicProtocol: Definition 4: the public randomness is independent of both inputs. Finite input/cost protocols have only finitely many distinct deterministic trees, so grouping seeds loses nothing.
  • PublicProtocol.bounded: Definition 4: worst-case communication and rounds on every public seed of positive weight.
  • PublicProtocol.computes: Definition 4: correctness for EVERY input, with the protocol fixed before the input.
  • QuantumRound: Definition 5, p.6: one round's fixed speaker/wires and local-input-controlled unitaries.
  • QuantumRound.matrix: Definition 5: the unitary can inspect only its speaker's classical input.
  • QuantumRound.update: Definition 5: transferring a fixed set of owned wires changes ownership, not the state.
  • owned: Owned wire set, used to enforce physical locality, p.6.
  • roundsLegal: Definition 5: all operations and transfers act only on the speaker's owned wires.
  • speakerAt: Alternating messages, p.6; t is zero-based.
  • QuantumProtocol: Definition 5 and Definition 6, pp.6–7: arbitrary finite private and shared workspace. Final announcements are a local measurement and are not charged transmissions.
  • QuantumProtocol.ownerAt: Ownership at the cut after t messages (before message t+1), pp.14–15.
  • QuantumProtocol.measurement: Input-local final POVM, Definition 5.
  • QuantumProtocol.valid: Definition 5: all registers normalized, all transfers legal, exactly k alternating messages (possibly empty), and a local output POVM.
  • QuantumProtocol.cost: Definition 5: structural count of transmitted qubits, never a free cost label.
  • QuantumProtocol.stateAt: Definition 5: actual execution, with all round unitaries fixed before either input.
  • QuantumProtocol.probability: Definition 5: the final local measurement's output distribution.
  • QuantumProtocol.computes: Definition 5: bounded error is a worst-case, per-input guarantee.
  • coherentInitial: P.14, coherent execution for Lemma 7: input registers are explicitly retained, and measurements pinch only actual local computational registers. No remote path access occurs. Uniform coherent input, tensor the normalized input-independent work state. For PointerMap n the normalization factor is exactly 1/n^n.
  • controlledRound: Pp.6,14: input controls are block diagonal and leave BOTH input registers unchanged.
  • MeasurementPattern: Pp.14,18: optional standard-basis measurements of specified physical registers. The X and Y registers belong to Alice and Bob respectively; each work wire has its current owner.
  • dephaseSelectedRegisters: Pp.14,18: nonselective local measurements, keeping all classical values in their registers. This is the product of the owners' local dephasings, with no communicated outcome for free.
  • coherentExecutionStateAt: Pp.14,18: constructed state after t messages, with any chosen local register measurements at each cut. The all-empty pattern is the unmeasured run.
  • AliceConfig: Alice's actual owned work configurations at a cut, pp.14,18.
  • BobConfig: Complementary work configurations; with two parties these are exactly Bob's wires.
  • mergeWork: Recombine local work configurations on the same physical wires.
  • aliceInputJoint: Lemma 7, p.18: the actual (F_A M_A):F_B reduction, tracing out only Bob's WORK wires. Input registers remain in the state and are not replaced by arbitrary marginals.
  • LocalChannel: Definition 2 and the model paragraph p.6: a CPTP operation local to S. The finite normalized Kraus family gives complete positivity, complex linearity and trace preservation.
  • ChannelRound: P.6: a round in the local CPTP model, with fixed sender, transfers and boundaries.
  • ChannelRound.operation: P.6: local classical input control for a general local quantum operation.
  • ChannelRound.update: P.6: changing the owner of exactly the specified sent wires.
  • channelRoundsLegal: P.6: legality ensures there are no remote operations or undeclared transmissions.
  • ChannelProtocol: P.6: the same fixed communication model with local CPTP maps in place of unitaries.
  • ChannelProtocol.finalOwner: P.6: final ownership after all fixed transfers.
  • ChannelProtocol.measurement: P.6: the announcing player's own-input-controlled measurement.
  • ChannelProtocol.valid: P.6: complete validity conditions, including normalization and a local output.
  • ChannelProtocol.finalState: P.6: the actual output density matrix after all local channels and ownership transfers.
  • ChannelProtocol.cost: P.6: the structural communication cost.
  • ChannelProtocol.probability: P.6: the full measured output law to be preserved by simulation.
  • BlankExtension: P.6: additional PRIVATE blank ancillas, rather than stronger prior entanglement or advice. The injection preserves the original ownership and embeds exactly the original initial vector.
  • preparationRound: P.7: Alice prepares the input-independent shared vector on local wires, then sends exactly the wires intended for Bob; the preparation phase is uncharged.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_ExtendedQuantumEntropy
import Definitions.Def_QAlgorithms_Defs_Channel
import Definitions.Def_QAlgorithms_Defs_QuantumInformation
import Definitions.Def_QAlgorithms_Defs_Ensemble
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P54
import Definitions.Def_QAlgorithms_Papers_Independent_Bridge50_P44

noncomputable section

open scoped Matrix ComplexConjugate ENNReal

attribute [local instance] Classical.propDecidable

namespace QAlgorithms.Papers.Independent.Intakethird100.P81

open QAlgorithms.Papers.Independent.Information100.P54 (relativeEntropyBits)
open QAlgorithms.Papers.Independent.Bridge50.P44 (ClassicalFirst)

/-! Paper-local interfaces for Klauck, arXiv:quant-ph/0004100v5.
All page numbers below are PDF page numbers. No frozen definition is modified.
-/

/-- Definition 8, p.8: mutual information in bits, with both marginals computed from rho. -/
def jointMutualInfoBits {A B : Type*} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B]
    (rho : Matrix (A × B) (A × B) ℂ) : ℝ :=
  vnEntropy (traceRight rho) + vnEntropy (traceLeft rho) - vnEntropy rho

/-- P.11: the product of the actual marginals, never an unrelated state parameter. -/
def jointMarginalProduct {A B : Type*} [Fintype A] [Fintype B]
    (rho : Matrix (A × B) (A × B) ℂ) : Matrix (A × B) (A × B) ℂ :=
  Matrix.kronecker (traceRight rho) (traceLeft rho)

/-- P.11: informational distance is the FULL trace norm, without a half factor. -/
def informationalDistance {A B : Type*} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B]
    (rho : Matrix (A × B) (A × B) ℂ) : ℝ :=
  traceNorm (rho - jointMarginalProduct rho)

/-- P.11, Lemma 2.1: exchange the named tensor factors. -/
def swapState {A B : Type*} (rho : Matrix (A × B) (A × B) ℂ) :
    Matrix (B × A) (B × A) ℂ :=
  fun p q => rho (p.2, p.1) (q.2, q.1)

/-- Pp.11–12: probability of a classical A outcome. -/
def classicalWeight {A B : Type*} [Fintype B]
    (rho : Matrix (A × B) (A × B) ℂ) (a : A) : ℝ :=
  (∑ b, rho (a, b) (a, b)).re

/-- Pp.11–12: the normalized conditional B state; the zero-probability branch is set to zero
and is always multiplied by its zero probability in Lemma 3.2. -/
def firstRegisterConditionalBlock {A B : Type*} [Fintype B]
    (rho : Matrix (A × B) (A × B) ℂ) (a : A) : Matrix B B ℂ :=
  fun b b' => (classicalWeight rho a : ℂ)⁻¹ * rho (a, b) (a, b')

/-- P.11, Lemma 3.1: jointly measure a Boolean POVM on A and the standard basis on B. -/
def agreement {A : Type*} [Fintype A]
    (M : Bool → Matrix A A ℂ) (rho : Matrix (A × Bool) (A × Bool) ℂ) : ℝ :=
  ∑ b : Bool, (∑ a, ∑ a', M b a a' * rho (a', b) (a, b)).re

example {A B : Type*} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B]
    (rho : Matrix (A × B) (A × B) ℂ) (h : rho = jointMarginalProduct rho) :
    informationalDistance rho = 0 := by
  unfold informationalDistance
  rw [sub_eq_zero.mpr h]
  simp [traceNorm, cfc_zero]

example {A B : Type*} (rho : Matrix (A × B) (A × B) ℂ) :
    swapState (swapState rho) = rho := rfl

example {A B : Type*} [Fintype B] (rho : Matrix (A × B) (A × B) ℂ)
    (a : A) (h : classicalWeight rho a = 0) : firstRegisterConditionalBlock rho a = 0 := by
  ext b b'
  simp [firstRegisterConditionalBlock, h]

example (h : IsDensityMatrix (1 : Matrix (Fin 1) (Fin 1) ℂ)) :
    relativeEntropyBits (I := Fin 1) 1 1 = 0 := by
  simp [relativeEntropyBits, h, QuantumLoss.umegakiEntropy, cfc_one]

/-- Definition 11, PDF p.12: unrestricted two-sided functional graph.
Both input tables have n entries, each in Fin n; the two copies are separately owned. -/
abbrev PointerMap (n : ℕ) := Fin n → Fin n

/-- The disjoint labelled vertex sets, with standard labels 0,...,n-1 and n,...,2n-1. -/
abbrev Vertex (n : ℕ) := Sum (Fin n) (Fin n)

/-- Definition 11, PDF p.12: no injectivity or acyclicity promise. -/
def successor {n : ℕ} (a b : PointerMap n) : Vertex n → Vertex n
  | .inl v => .inr (a v)
  | .inr v => .inl (b v)

/-- Definition 11, PDF p.12: the endpoint follows k+1 pointers from the fixed Alice vertex. -/
def endpoint {n : ℕ} (k : ℕ) (v1 : Fin n) (a b : PointerMap n) : Vertex n :=
  (successor a b)^[k + 1] (.inl v1)

/-- Definition 11, PDF p.12: standard binary code of the disjoint vertex labels. -/
def vertexLabel {n : ℕ} : Vertex n → ℕ
  | .inl v => v.val
  | .inr v => n + v.val

/-- Definition 11, PDF p.12: XOR of ALL binary bits, independent of leading zero padding. -/
def pointerParity {n : ℕ} (k : ℕ) (v1 : Fin n) (a b : PointerMap n) : Bool :=
  decide ((Nat.digits 2 (vertexLabel (endpoint k v1 a b))).sum % 2 = 1)

/-- Section 6, PDF p.19: the source's DISJ accepts intersecting sets. -/
def nonDisjoint {n : ℕ} (x y : Fin n → Bool) : Bool :=
  decide (∃ i, x i = true ∧ y i = true)

example {n : ℕ} (v : Fin n) (a b : PointerMap n) :
    endpoint 0 v a b = .inr (a v) := rfl

example {n : ℕ} (a b : PointerMap n) (v : Fin n) :
    successor a b (.inr v) = .inl (b v) := rfl

example : nonDisjoint (n := 0) (fun i => Fin.elim0 i) (fun i => Fin.elim0 i) = false := by
  simp [nonDisjoint]

/-- P.13: saturated real iterated binary logarithm; the zeroth iterate is n. -/
def iteratedLog : ℕ → ℝ → ℝ
  | 0, n => max 1 n
  | j + 1, n => max 1 (Real.logb 2 (iteratedLog j n))

/-- P.13: least iteration reaching one. For positive finite integer n this set is nonempty;
all resource statements exclude n<2. -/
def logStar (n : ℕ) : ℕ := sInf {j : ℕ | iteratedLog j n ≤ 1}

example : iteratedLog 0 1 = 1 := by norm_num [iteratedLog]

/-! Classical protocols: finite public mixtures of finite binary communication trees.
Each bit is selected using only its speaker's input and the public transcript. A change
of speaker starts a new message. An initial empty message is charged as a round.
-/

/-- Definition 4, pp.5–6: a finite deterministic binary protocol with local output. -/
inductive ClassicalTree (X Y O : Type) where
  | outputAlice (f : X → O)
  | outputBob (f : Y → O)
  | alice (bit : X → Bool) (zero one : ClassicalTree X Y O)
  | bob (bit : Y → Bool) (zero one : ClassicalTree X Y O)

/-- Definition 4, pp.5–6: execution follows the local input at each transcript node. -/
def ClassicalTree.run {X Y O : Type} : ClassicalTree X Y O → X → Y → O
  | .outputAlice f, x, _ => f x
  | .outputBob f, _, y => f y
  | .alice bit zero one, x, y => if bit x then one.run x y else zero.run x y
  | .bob bit zero one, x, y => if bit y then one.run x y else zero.run x y

/-- Definition 4, pp.5–6: worst-case transmitted bits; local announcements cost nothing.
Unused branches can be pruned, so this presents every finite worst-case protocol. -/
def ClassicalTree.cost {X Y O : Type} : ClassicalTree X Y O → ℕ
  | .outputAlice _ => 0
  | .outputBob _ => 0
  | .alice _ zero one => 1 + max zero.cost one.cost
  | .bob _ zero one => 1 + max zero.cost one.cost

/-- P.6: number of subsequent speaker changes along the worst branch. -/
def ClassicalTree.changes {X Y O : Type} : ClassicalTree X Y O → Party → ℕ
  | .outputAlice _, _ => 0
  | .outputBob _, _ => 0
  | .alice _ zero one, prev => (if prev = .alice then 0 else 1) +
      max (zero.changes .alice) (one.changes .alice)
  | .bob _ zero one, prev => (if prev = .bob then 0 else 1) +
      max (zero.changes .bob) (one.changes .bob)

/-- P.6: at most k messages with the specified starter, allowing empty padding. -/
def ClassicalTree.rounds {X Y O : Type} (T : ClassicalTree X Y O) (start : Party) : ℕ :=
  match T with
  | .outputAlice _ => 0
  | .outputBob _ => 0
  | .alice _ zero one => (if start = .alice then 1 else 2) +
      max (zero.changes .alice) (one.changes .alice)
  | .bob _ zero one => (if start = .bob then 1 else 2) +
      max (zero.changes .bob) (one.changes .bob)

/-- Definition 4: the public randomness is independent of both inputs. Finite input/cost
protocols have only finitely many distinct deterministic trees, so grouping seeds loses nothing. -/
structure PublicProtocol (X Y O : Type) where
  seeds : ℕ
  weight : Fin seeds → ℝ
  nonnegative : ∀ s, 0 ≤ weight s
  normalized : ∑ s, weight s = 1
  tree : Fin seeds → ClassicalTree X Y O

/-- Definition 4: worst-case communication and rounds on every public seed of positive weight. -/
def PublicProtocol.bounded {X Y O : Type} (P : PublicProtocol X Y O)
    (start : Party) (k c : ℕ) : Prop :=
  ∀ s, 0 < P.weight s → (P.tree s).rounds start ≤ k ∧ (P.tree s).cost ≤ c

/-- Definition 4: correctness for EVERY input, with the protocol fixed before the input. -/
def PublicProtocol.computes {X Y O : Type} [DecidableEq O]
    (P : PublicProtocol X Y O) (f : X → Y → O) (eps : ℝ) : Prop :=
  ∀ x y, 1 - eps ≤ ∑ s, P.weight s * (if (P.tree s).run x y = f x y then 1 else 0)

example {X Y O : Type} (f : X → O) :
    (ClassicalTree.outputAlice (Y := Y) f).cost = 0 := rfl

example {X Y O : Type} (f : Y → O) (x : X) (y : Y) :
    (ClassicalTree.outputBob (X := X) f).run x y = f y := rfl

example (f : Unit → Bool) :
    (ClassicalTree.alice (Y := Unit) (fun _ : Unit => false)
      (.outputAlice f) (.outputAlice f)).rounds .bob = 2 := rfl

/-! Quantum protocols: fixed finite wire ownership, input-local unitaries, fixed transfers,
and a final local POVM. Prior assistance is a single normalized input-independent vector.
-/

/-- Definition 5, p.6: one round's fixed speaker/wires and local-input-controlled unitaries. -/
structure QuantumRound (X Y : Type) (N : ℕ) where
  speaker : Party
  sent : Finset (Fin N)
  alice : X → Matrix.unitaryGroup (Qubits N) ℂ
  bob : Y → Matrix.unitaryGroup (Qubits N) ℂ

/-- Definition 5: the unitary can inspect only its speaker's classical input. -/
def QuantumRound.matrix {X Y : Type} {N : ℕ} (r : QuantumRound X Y N)
    (x : X) (y : Y) : Matrix (Qubits N) (Qubits N) ℂ :=
  if r.speaker = .alice then r.alice x else r.bob y

/-- Definition 5: transferring a fixed set of owned wires changes ownership, not the state. -/
def QuantumRound.update {X Y : Type} {N : ℕ} (r : QuantumRound X Y N)
    (own : Fin N → Party) : Fin N → Party :=
  fun q => if q ∈ r.sent then r.speaker.other else own q

/-- Owned wire set, used to enforce physical locality, p.6. -/
def owned {N : ℕ} (own : Fin N → Party) (p : Party) : Finset (Fin N) :=
  Finset.univ.filter fun q => own q = p

/-- Definition 5: all operations and transfers act only on the speaker's owned wires. -/
def roundsLegal {X Y : Type} {N : ℕ} :
    (Fin N → Party) → List (QuantumRound X Y N) → Prop
  | _, [] => True
  | own, r :: rs => (∀ q ∈ r.sent, own q = r.speaker) ∧
      (∀ x y, ActsWithin (owned own r.speaker) (r.matrix x y)) ∧
      roundsLegal (r.update own) rs

/-- Alternating messages, p.6; t is zero-based. -/
def speakerAt (start : Party) (t : ℕ) : Party :=
  if t % 2 = 0 then start else start.other

/-- Definition 5 and Definition 6, pp.6–7: arbitrary finite private and shared workspace.
Final announcements are a local measurement and are not charged transmissions. -/
structure QuantumProtocol (X Y O : Type) where
  N : ℕ
  initial : EuclideanSpace ℂ (Qubits N)
  owner : Fin N → Party
  rounds : List (QuantumRound X Y N)
  outputParty : Party
  measureAlice : X → O → Matrix (Qubits N) (Qubits N) ℂ
  measureBob : Y → O → Matrix (Qubits N) (Qubits N) ℂ

/-- Ownership at the cut after t messages (before message t+1), pp.14–15. -/
def QuantumProtocol.ownerAt {X Y O : Type} (P : QuantumProtocol X Y O) (t : ℕ) :
    Fin P.N → Party :=
  (P.rounds.take t).foldl (fun own r => r.update own) P.owner

/-- Input-local final POVM, Definition 5. -/
def QuantumProtocol.measurement {X Y O : Type} (P : QuantumProtocol X Y O)
    (x : X) (y : Y) : O → Matrix (Qubits P.N) (Qubits P.N) ℂ :=
  if P.outputParty = .alice then P.measureAlice x else P.measureBob y

/-- Definition 5: all registers normalized, all transfers legal, exactly k alternating
messages (possibly empty), and a local output POVM. -/
def QuantumProtocol.valid {X Y O : Type} [Fintype O]
    (P : QuantumProtocol X Y O) (start : Party) (k : ℕ) : Prop :=
  ‖P.initial‖ = 1 ∧ P.rounds.length = k ∧ roundsLegal P.owner P.rounds ∧
  (∀ i : Fin P.rounds.length, (P.rounds.get i).speaker = speakerAt start i.val) ∧
  ∀ x y, IsPOVM (P.measurement x y) ∧ ∀ o,
    ActsWithin (owned (P.ownerAt P.rounds.length) P.outputParty) (P.measurement x y o)

/-- Definition 5: structural count of transmitted qubits, never a free cost label. -/
def QuantumProtocol.cost {X Y O : Type} (P : QuantumProtocol X Y O) : ℕ :=
  (P.rounds.map fun r => r.sent.card).sum

/-- Definition 5: actual execution, with all round unitaries fixed before either input. -/
def QuantumProtocol.stateAt {X Y O : Type} (P : QuantumProtocol X Y O)
    (x : X) (y : Y) (t : ℕ) : EuclideanSpace ℂ (Qubits P.N) :=
  (P.rounds.take t).foldl (fun psi r => act (r.matrix x y) psi) P.initial

/-- Definition 5: the final local measurement's output distribution. -/
def QuantumProtocol.probability {X Y O : Type} (P : QuantumProtocol X Y O)
    (x : X) (y : Y) (o : O) : ℝ :=
  effectProb (P.measurement x y o) (pureDensity (P.stateAt x y P.rounds.length))

/-- Definition 5: bounded error is a worst-case, per-input guarantee. -/
def QuantumProtocol.computes {X Y O : Type} (P : QuantumProtocol X Y O)
    (f : X → Y → O) (eps : ℝ) : Prop :=
  ∀ x y, 1 - eps ≤ P.probability x y (f x y)

example {X Y O : Type} (P : QuantumProtocol X Y O) (x : X) (y : Y) :
    P.stateAt x y 0 = P.initial := rfl

example {X Y O : Type} (P : QuantumProtocol X Y O) (h : P.rounds = []) : P.cost = 0 := by
  simp [QuantumProtocol.cost, h]

/-- P.14, coherent execution for Lemma 7: input registers are explicitly retained, and
measurements pinch only actual local computational registers. No remote path access occurs.
Uniform coherent input, tensor the normalized input-independent work state.
For PointerMap n the normalization factor is exactly 1/n^n. -/
def coherentInitial {X Y O : Type} [Fintype X] [Fintype Y]
    (P : QuantumProtocol X Y O) : EuclideanSpace ℂ ((X × Y) × Qubits P.N) :=
  WithLp.toLp 2 fun z =>
    (((Real.sqrt ((Fintype.card X : ℝ) * Fintype.card Y))⁻¹ : ℝ) : ℂ) * P.initial z.2

/-- Pp.6,14: input controls are block diagonal and leave BOTH input registers unchanged. -/
def controlledRound {X Y : Type} [DecidableEq X] [DecidableEq Y] {N : ℕ}
    (r : QuantumRound X Y N) : Matrix ((X × Y) × Qubits N) ((X × Y) × Qubits N) ℂ :=
  fun p q => if p.1 = q.1 then r.matrix p.1.1 p.1.2 p.2 q.2 else 0

/-- Pp.14,18: optional standard-basis measurements of specified physical registers.
The X and Y registers belong to Alice and Bob respectively; each work wire has its current owner. -/
structure MeasurementPattern (N : ℕ) where
  aliceInput : Bool
  bobInput : Bool
  wires : Finset (Fin N)

/-- Pp.14,18: nonselective local measurements, keeping all classical values in their registers.
This is the product of the owners' local dephasings, with no communicated outcome for free. -/
def dephaseSelectedRegisters {X Y : Type} [DecidableEq X] [DecidableEq Y] {N : ℕ}
    (m : MeasurementPattern N)
    (rho : Matrix ((X × Y) × Qubits N) ((X × Y) × Qubits N) ℂ) :
    Matrix ((X × Y) × Qubits N) ((X × Y) × Qubits N) ℂ :=
  fun p q => if (m.aliceInput = false ∨ p.1.1 = q.1.1) ∧
    (m.bobInput = false ∨ p.1.2 = q.1.2) ∧ (∀ w ∈ m.wires, p.2 w = q.2 w)
    then rho p q else 0

/-- Pp.14,18: constructed state after t messages, with any chosen local register measurements
at each cut. The all-empty pattern is the unmeasured run. -/
def coherentExecutionStateAt {X Y O : Type} [Fintype X] [Fintype Y] [DecidableEq X] [DecidableEq Y]
    (P : QuantumProtocol X Y O) (m : ℕ → MeasurementPattern P.N) :
    ℕ → Matrix ((X × Y) × Qubits P.N) ((X × Y) × Qubits P.N) ℂ
  | 0 => dephaseSelectedRegisters (m 0) (pureDensity (coherentInitial P))
  | t + 1 => match P.rounds[t]? with
      | none => coherentExecutionStateAt P m t
      | some r => dephaseSelectedRegisters (m (t + 1))
          (controlledRound r * coherentExecutionStateAt P m t * (controlledRound r)ᴴ)

/-- Alice's actual owned work configurations at a cut, pp.14,18. -/
abbrev AliceConfig {N : ℕ} (own : Fin N → Party) := {q : Fin N // own q = .alice} → Bool

/-- Complementary work configurations; with two parties these are exactly Bob's wires. -/
abbrev BobConfig {N : ℕ} (own : Fin N → Party) := {q : Fin N // own q ≠ .alice} → Bool

/-- Recombine local work configurations on the same physical wires. -/
def mergeWork {N : ℕ} (own : Fin N → Party) (a : AliceConfig own) (b : BobConfig own) :
    Qubits N :=
  fun q => if h : own q = .alice then a ⟨q, h⟩ else b ⟨q, h⟩

/-- Lemma 7, p.18: the actual (F_A M_A):F_B reduction, tracing out only Bob's WORK wires.
Input registers remain in the state and are not replaced by arbitrary marginals. -/
def aliceInputJoint {X Y : Type} {N : ℕ} (own : Fin N → Party)
    (rho : Matrix ((X × Y) × Qubits N) ((X × Y) × Qubits N) ℂ) :
    Matrix ((X × AliceConfig own) × Y) ((X × AliceConfig own) × Y) ℂ :=
  fun p q => ∑ b : BobConfig own,
    rho ((p.1.1, p.2), mergeWork own p.1.2 b)
      ((q.1.1, q.2), mergeWork own q.1.2 b)

example {X Y : Type} [DecidableEq X] [DecidableEq Y] {N : ℕ}
    (rho : Matrix ((X × Y) × Qubits N) ((X × Y) × Qubits N) ℂ) :
    dephaseSelectedRegisters ⟨false, false, ∅⟩ rho = rho := by
  ext p q
  simp [dephaseSelectedRegisters]

example {X Y : Type} [DecidableEq X] [DecidableEq Y] {N : ℕ}
    (r : QuantumRound X Y N) (x : X) (y : Y) (z z' : Qubits N) :
    controlledRound r ((x,y),z) ((x,y),z') = r.matrix x y z z' := by
  simp [controlledRound]

/- Lemma 7 is intentionally not asserted. The coherent execution above makes its
prior-entanglement counterexample precise; see this unit's HARD.md and MODERATION_NOTES.md.
A classical input reference would change the printed unmeasured-input claim. -/

/-! Local CPTP protocols, pp.6–7. Private environments may be preallocated to any finite size;
the simulation theorem puts no erroneous dimension bound on the new ancillas.
-/

/-- Definition 2 and the model paragraph p.6: a CPTP operation local to S.
The finite normalized Kraus family gives complete positivity, complex linearity and trace preservation. -/
def LocalChannel {N : ℕ} (S : Finset (Fin N)) (F : Superop (Qubits N) (Qubits N)) : Prop :=
  ∃ (d : ℕ) (E : Fin d → Matrix (Qubits N) (Qubits N) ℂ),
    IsKrausFamily E ∧ (∀ j, ActsWithin S (E j)) ∧ ∀ rho, F rho = krausApply E rho

/-- P.6: a round in the local CPTP model, with fixed sender, transfers and boundaries. -/
structure ChannelRound (X Y : Type) (N : ℕ) where
  speaker : Party
  sent : Finset (Fin N)
  alice : X → Superop (Qubits N) (Qubits N)
  bob : Y → Superop (Qubits N) (Qubits N)

/-- P.6: local classical input control for a general local quantum operation. -/
def ChannelRound.operation {X Y : Type} {N : ℕ} (r : ChannelRound X Y N)
    (x : X) (y : Y) : Superop (Qubits N) (Qubits N) :=
  if r.speaker = .alice then r.alice x else r.bob y

/-- P.6: changing the owner of exactly the specified sent wires. -/
def ChannelRound.update {X Y : Type} {N : ℕ} (r : ChannelRound X Y N)
    (own : Fin N → Party) : Fin N → Party :=
  fun q => if q ∈ r.sent then r.speaker.other else own q

/-- P.6: legality ensures there are no remote operations or undeclared transmissions. -/
def channelRoundsLegal {X Y : Type} {N : ℕ} :
    (Fin N → Party) → List (ChannelRound X Y N) → Prop
  | _, [] => True
  | own, r :: rs => (∀ q ∈ r.sent, own q = r.speaker) ∧
      (∀ x y, LocalChannel (owned own r.speaker) (r.operation x y)) ∧
      channelRoundsLegal (r.update own) rs

/-- P.6: the same fixed communication model with local CPTP maps in place of unitaries. -/
structure ChannelProtocol (X Y O : Type) where
  N : ℕ
  initial : EuclideanSpace ℂ (Qubits N)
  owner : Fin N → Party
  rounds : List (ChannelRound X Y N)
  outputParty : Party
  measureAlice : X → O → Matrix (Qubits N) (Qubits N) ℂ
  measureBob : Y → O → Matrix (Qubits N) (Qubits N) ℂ

/-- P.6: final ownership after all fixed transfers. -/
def ChannelProtocol.finalOwner {X Y O : Type} (P : ChannelProtocol X Y O) : Fin P.N → Party :=
  P.rounds.foldl (fun own r => r.update own) P.owner

/-- P.6: the announcing player's own-input-controlled measurement. -/
def ChannelProtocol.measurement {X Y O : Type} (P : ChannelProtocol X Y O)
    (x : X) (y : Y) : O → Matrix (Qubits P.N) (Qubits P.N) ℂ :=
  if P.outputParty = .alice then P.measureAlice x else P.measureBob y

/-- P.6: complete validity conditions, including normalization and a local output. -/
def ChannelProtocol.valid {X Y O : Type} [Fintype O]
    (P : ChannelProtocol X Y O) (start : Party) (k : ℕ) : Prop :=
  ‖P.initial‖ = 1 ∧ P.rounds.length = k ∧ channelRoundsLegal P.owner P.rounds ∧
  (∀ i : Fin P.rounds.length, (P.rounds.get i).speaker = speakerAt start i.val) ∧
  ∀ x y, IsPOVM (P.measurement x y) ∧ ∀ o,
    ActsWithin (owned P.finalOwner P.outputParty) (P.measurement x y o)

/-- P.6: the actual output density matrix after all local channels and ownership transfers. -/
def ChannelProtocol.finalState {X Y O : Type} (P : ChannelProtocol X Y O)
    (x : X) (y : Y) : Matrix (Qubits P.N) (Qubits P.N) ℂ :=
  P.rounds.foldl (fun rho r => r.operation x y rho) (pureDensity P.initial)

/-- P.6: the structural communication cost. -/
def ChannelProtocol.cost {X Y O : Type} (P : ChannelProtocol X Y O) : ℕ :=
  (P.rounds.map fun r => r.sent.card).sum

/-- P.6: the full measured output law to be preserved by simulation. -/
def ChannelProtocol.probability {X Y O : Type} (P : ChannelProtocol X Y O)
    (x : X) (y : Y) (o : O) : ℝ :=
  effectProb (P.measurement x y o) (P.finalState x y)

/-- P.6: additional PRIVATE blank ancillas, rather than stronger prior entanglement or advice.
The injection preserves the original ownership and embeds exactly the original initial vector. -/
def BlankExtension {X Y O : Type} (P : ChannelProtocol X Y O)
    (Q : QuantumProtocol X Y O) : Prop :=
  ∃ e : Fin P.N ↪ Fin Q.N, (∀ q, Q.owner (e q) = P.owner q) ∧
    ∀ z : Qubits Q.N, Q.initial z =
      if ∀ q, q ∉ Set.range e → z q = false then P.initial (z ∘ e) else 0

example {X Y O : Type} (P : ChannelProtocol X Y O) (h : P.rounds = []) (x : X) (y : Y) :
    P.finalState x y = pureDensity P.initial := by
  simp [ChannelProtocol.finalState, h]

example {X Y O : Type} (P : ChannelProtocol X Y O) (h : P.rounds = []) : P.cost = 0 := by
  simp [ChannelProtocol.cost, h]

/-- P.7: Alice prepares the input-independent shared vector on local wires, then sends
exactly the wires intended for Bob; the preparation phase is uncharged. -/
def preparationRound {N : ℕ} (own : Fin N → Party)
    (U : Matrix.unitaryGroup (Qubits N) ℂ) : QuantumRound Unit Unit N where
  speaker := .alice
  sent := owned own .bob
  alice := fun _ => U
  bob := fun _ => 1

example {N : ℕ} (own : Fin N → Party) (U : Matrix.unitaryGroup (Qubits N) ℂ) :
    (preparationRound own U).sent = owned own .bob := rfl

end QAlgorithms.Papers.Independent.Intakethird100.P81
Source
On rounds in quantum communication, arXiv:quant-ph/0004100v5, https://arxiv.org/abs/quant-ph/0004100v5
Read-back

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

QAlgorithms.Papers.Independent.Intakethird100.P81.AliceConfig

For any natural number NNN and any ownership assignment own:{0,…,N−1}→{Alice,Bob}\mathrm{own}:\{0,\ldots,N-1\}\to\{\mathrm{Alice},\mathrm{Bob}\}own:{0,…,N−1}→{Alice,Bob}, an Alice configuration is a Boolean-valued function on the subset of wires qqq satisfying own(q)=Alice\mathrm{own}(q)=\mathrm{Alice}own(q)=Alice. It assigns one bit to each such wire, with no further conditions. If Alice owns no wires, including when N=0N=0N=0, there is exactly one Alice configuration: the empty function.

QAlgorithms.Papers.Independent.Intakethird100.P81.BlankExtension

For arbitrary types X,Y,OX,Y,OX,Y,O, a channel protocol PPP, and a quantum protocol QQQ with the same input and outcome types, the blank-extension property means that there exists an injection eee from PPP's wires into QQQ's wires preserving their initial owners, such that for every bit string zzz on QQQ's wires,

Q.initial(z)={P.initial(z∘e),z(q)=false for every q∉im⁡e,0,otherwise.Q.\mathrm{initial}(z)= \begin{cases} P.\mathrm{initial}(z\circ e),& z(q)=\mathrm{false}\text{ for every }q\notin\operatorname{im}e,\\ 0,&\text{otherwise}. \end{cases}Q.initial(z)={P.initial(z∘e),0,​z(q)=false for every q∈/ime,otherwise.​

Thus the initial vector is PPP's initial vector placed on the embedded wires with all additional wires fixed to false. Owners of additional wires are unrestricted. This property places no conditions on either protocol's rounds, measurements, output party, or validity. Either wire count may be zero whenever such an injection exists, and if there are no additional wires the condition outside the image is vacuous.

QAlgorithms.Papers.Independent.Intakethird100.P81.BobConfig

For any natural number NNN and any ownership assignment own:{0,…,N−1}→{Alice,Bob}\mathrm{own}:\{0,\ldots,N-1\}\to\{\mathrm{Alice},\mathrm{Bob}\}own:{0,…,N−1}→{Alice,Bob}, a Bob configuration is a Boolean-valued function on the subset of wires qqq satisfying own(q)≠Alice\mathrm{own}(q)\ne\mathrm{Alice}own(q)=Alice, which here is exactly the subset owned by Bob. It assigns one bit to each such wire, with no further conditions. If this subset is empty, including when N=0N=0N=0, there is exactly one Bob configuration: the empty function.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol.cost

For arbitrary types X,Y,OX,Y,OX,Y,O and a channel protocol PPP, its cost is the natural number ∑r∈P.rounds∣Sr∣\sum_{r\in P.\mathrm{rounds}}|S_r|∑r∈P.rounds​∣Sr​∣, where SrS_rSr​ is the finite set of wires marked as sent in round rrr, and the sum follows the round list with repetitions of rounds counted separately. A wire sent in several rounds contributes once in each such round. Empty sent sets contribute zero, and an empty round list has cost zero. This definition requires no legality or validity assumption and includes protocols with zero wires.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol.finalOwner

For arbitrary types X,Y,OX,Y,OX,Y,O and a channel protocol PPP, its final ownership assignment is obtained by starting with its initial assignment and processing its round list in order: at each round, every wire in that round's sent set is assigned to the other party from its speaker, and all remaining owners are retained. This calculation does not require the round list to be legal and does not depend on either input or the round operations. For an empty round list the final ownership equals the initial ownership; zero wires are allowed.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol.finalState

For arbitrary types X,Y,OX,Y,OX,Y,O, a channel protocol PPP, and inputs x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, form the initial matrix ρ0\rho_0ρ0​ with entries (ρ0)u,v=ψ(u)ψ(v)‾(\rho_0)_{u,v}=\psi(u)\overline{\psi(v)}(ρ0​)u,v​=ψ(u)ψ(v)​, where ψ\psiψ is PPP's initial vector and u,vu,vu,v range over its NNN-bit strings. The final matrix is obtained by processing the rounds in list order, replacing the current matrix by rA(x)r_{\mathrm A}(x)rA​(x) applied to it for an Alice round and by rB(y)r_{\mathrm B}(y)rB​(y) applied to it for a Bob round. Ownership updates and sent-wire sets play no role in this calculation. With no rounds the result is ρ0\rho_0ρ0​; zero wires are allowed. No validity assumption is required, so the definition does not assert that the resulting matrix is a density matrix.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol

For arbitrary types X,Y,OX,Y,OX,Y,O, a channel protocol is a record containing a natural number NNN; a complex vector indexed by all NNN-bit strings, called its initial vector; an initial assignment of Alice or Bob to each wire; a finite list of rounds, each specifying a speaker, a finite sent-wire set, and maps on complex matrices indexed separately by Alice's input in XXX and Bob's input in YYY; an output party; and two families of complex matrices, one indexed by X×OX\times OX×O and one by Y×OY\times OY×O, each matrix indexed by NNN-bit strings. The record imposes no normalization on the initial vector, no channel or locality conditions on round maps, no scheduling conditions, and no measurement conditions on the matrix families. The types may be empty, NNN may be zero, and the round list may be empty.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol.measurement

For arbitrary types X,Y,OX,Y,OX,Y,O, a channel protocol PPP, and inputs x∈Xx\in Xx∈X, y∈Yy\in Yy∈Y, the selected outcome-indexed matrix family is PPP's Alice family at xxx if its output party is Alice, and its Bob family at yyy if its output party is Bob. Each matrix is indexed by the NNN-bit strings, where NNN is PPP's wire count. This selection alone asserts no positivity, completeness, or locality of the matrices, and applies also to zero wires or an empty outcome type.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol.probability

For arbitrary types X,Y,OX,Y,OX,Y,O, a channel protocol PPP, inputs x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, and an outcome o∈Oo\in Oo∈O, the defined real number is

Re⁡tr⁡(Moρfinal).\operatorname{Re}\operatorname{tr}(M_o\rho_{\mathrm{final}}).Retr(Mo​ρfinal​).

Here MoM_oMo​ is the outcome-ooo matrix from Alice's family at xxx if Alice is the output party, and from Bob's family at yyy otherwise; ρfinal\rho_{\mathrm{final}}ρfinal​ starts with entries ψ(u)ψ(v)‾\psi(u)\overline{\psi(v)}ψ(u)ψ(v)​ from the initial vector and is transformed through the round list in order, using each speaker's input-indexed map. The definition requires no validity assumption and therefore does not itself assert that this number lies in [0,1][0,1][0,1] or that the outcome values sum to one. Zero wires and an empty round list are allowed.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelProtocol.valid

For arbitrary types X,YX,YX,Y, a finite type OOO with a specified finite enumeration, a channel protocol PPP, a starting party sss, and a natural number kkk, validity means the conjunction of the following conditions: its initial vector has Euclidean norm one; its round list has exactly kkk entries; that list is legal from its initial ownership; its round at every index iii has speaker sss when iii is even and the other party when iii is odd; and, for every x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, its selected outcome matrices MoM_oMo​ are positive semidefinite, satisfy ∑o∈OMo=I\sum_{o\in O}M_o=I∑o∈O​Mo​=I, and each act within the wires finally owned by its output party. The selected round operation uses the speaker's own input, and the selected measurement uses the output party's own input. Legality requires, successively, that each sent wire belongs to the current speaker, that every selected operation has a finite Kraus representation F(ρ)=∑jEjρEj†F(\rho)=\sum_jE_j\rho E_j^\daggerF(ρ)=∑j​Ej​ρEj†​ with ∑jEj†Ej=I\sum_jE_j^\dagger E_j=I∑j​Ej†​Ej​=I and every EjE_jEj​ acting within that speaker's currently owned wires, and that ownership is then updated by assigning sent wires to the other party. A matrix acts within a wire set SSS when it is the extension of some matrix AAA on an injectively selected list www of wires contained in SSS: its entry at strings u,vu,vu,v is Au∘w,v∘wA_{u\circ w,v\circ w}Au∘w,v∘w​ if they agree outside those wires, and zero otherwise. Final ownership is obtained by all these updates. Zero rounds and zero wires are allowed, and sent sets need not be nonempty. If either input type is empty, the universally quantified operation and measurement conditions have no instances; if both have elements and OOO is empty, measurement completeness is impossible.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelRound

For arbitrary input types X,YX,YX,Y and any natural number NNN, a channel round is a record containing a speaker chosen from Alice and Bob, a finite set of sent wires contained in {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}, a function assigning to every x∈Xx\in Xx∈X a map from complex matrices on NNN-bit strings to matrices of the same size, and another such function indexed by y∈Yy\in Yy∈Y. These two families are called the Alice and Bob operations. The structure itself imposes no linearity, positivity, trace preservation, locality, ownership, or compatibility conditions on these maps or on the sent wires. Empty input types, an empty sent set, and N=0N=0N=0 are allowed.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelRound.operation

For arbitrary types X,YX,YX,Y, a natural number NNN, a round rrr consisting of a speaker (Alice or Bob), a finite set of sent wires, and input-indexed maps rA(x)r_{\mathrm A}(x)rA​(x) and rB(y)r_{\mathrm B}(y)rB​(y) on complex matrices indexed by NNN-bit strings, and inputs x∈Xx\in Xx∈X, y∈Yy\in Yy∈Y, the selected operation is rA(x)r_{\mathrm A}(x)rA​(x) if Alice speaks and rB(y)r_{\mathrm B}(y)rB​(y) if Bob speaks. The result is simply a function from such matrices to such matrices; this definition imposes no linearity, positivity, normalization, or locality condition. The sent wires do not affect this selection, and N=0N=0N=0 is allowed.

QAlgorithms.Papers.Independent.Intakethird100.P81.ChannelRound.update

For arbitrary types X,YX,YX,Y, a natural number NNN, a round rrr with speaker Alice or Bob and sent-wire set Sr⊆{0,…,N−1}S_r\subseteq\{0,\ldots,N-1\}Sr​⊆{0,…,N−1}, and an ownership assignment own⁡\operatorname{own}own assigning Alice or Bob to every wire, the updated owner of wire qqq is the other party from rrr's speaker if q∈Srq\in S_rq∈Sr​, and is own⁡(q)\operatorname{own}(q)own(q) otherwise. Thus every listed sent wire is assigned to the speaker's other party, regardless of its previous owner; the definition itself does not require the speaker to own it. An empty sent set leaves ownership unchanged, including when N=0N=0N=0.

QAlgorithms.Papers.Independent.Intakethird100.P81.ClassicalTree.changes

For arbitrary types X,Y,OX,Y,OX,Y,O, a classical tree has output leaves carrying a function X→OX\to OX→O or Y→OY\to OY→O, and internal nodes labelled Alice or Bob, each carrying a Boolean function of that party’s input and two subtrees. Given such a tree TTT and a previous party p∈{Alice,Bob}p\in\{\mathrm{Alice},\mathrm{Bob}\}p∈{Alice,Bob}, changes⁡(T,p)\operatorname{changes}(T,p)changes(T,p) is defined recursively: either kind of output leaf has value 000; an Alice node with subtrees T0,T1T_0,T_1T0​,T1​ has value 1p≠Alice+max⁡{changes⁡(T0,Alice),changes⁡(T1,Alice)}\mathbf 1_{p\ne\mathrm{Alice}}+\max\{\operatorname{changes}(T_0,\mathrm{Alice}),\operatorname{changes}(T_1,\mathrm{Alice})\}1p=Alice​+max{changes(T0​,Alice),changes(T1​,Alice)}; and a Bob node has the corresponding value with Bob in place of Alice. Thus it is the maximum number of party changes along a structural path of internal nodes, counting a change from the supplied previous party to the first node when they differ. Both branches enter the maximum even if their Boolean tests make a path impossible for any input; the party named by an output leaf contributes no change.

QAlgorithms.Papers.Independent.Intakethird100.P81.ClassicalTree.cost

For arbitrary types X,Y,OX,Y,OX,Y,O, assign a natural-number cost to each finite binary tree whose Alice and Bob leaves carry functions X→OX\to OX→O and Y→OY\to OY→O, respectively, and whose internal nodes carry Boolean functions on the corresponding input type. Either kind of output leaf has cost 000, and either kind of internal node with children T0,T1T_0,T_1T0​,T1​ has cost 1+max⁡{cost⁡(T0),cost⁡(T1)}1+\max\{\operatorname{cost}(T_0),\operatorname{cost}(T_1)\}1+max{cost(T0​),cost(T1​)}. This counts the maximum number of internal nodes on a structural path to a leaf, including branches that no input can follow; it requires no finiteness or nonemptiness assumption on X,Y,OX,Y,OX,Y,O.

QAlgorithms.Papers.Independent.Intakethird100.P81.ClassicalTree

For arbitrary types XXX, YYY, and OOO, with no finiteness or nonemptiness assumptions, a classical tree is a finite inductively constructed binary tree of four possible forms: an Alice output leaf carrying a function f:X→Of:X\to Of:X→O; a Bob output leaf carrying a function f:Y→Of:Y\to Of:Y→O; an Alice internal node carrying a Boolean function β:X→{false,true}\beta:X\to\{\mathrm{false},\mathrm{true}\}β:X→{false,true} and two child trees called zero and one; or a Bob internal node carrying a Boolean function β:Y→{false,true}\beta:Y\to\{\mathrm{false},\mathrm{true}\}β:Y→{false,true} and two such child trees.

QAlgorithms.Papers.Independent.Intakethird100.P81.ClassicalTree.rounds

For arbitrary types X,Y,OX,Y,OX,Y,O, a classical tree TTT whose internal nodes test Boolean functions of Alice’s input in XXX or Bob’s input in YYY, and a designated starting party ppp, rounds⁡(T,p)\operatorname{rounds}(T,p)rounds(T,p) is 000 for either kind of output leaf. If the root belongs to party aaa and has subtrees T0,T1T_0,T_1T0​,T1​, its value is 111 when p=ap=ap=a, or 222 when p≠ap\ne ap=a, plus the maximum number of subsequent party changes in either subtree, taking aaa as the previous party. Here subsequent changes are counted recursively by adding 111 whenever an internal node’s party differs from the preceding party and taking the maximum over both branches; output leaves add nothing. All structural branches enter these maxima, including paths unrealizable by any input.

QAlgorithms.Papers.Independent.Intakethird100.P81.ClassicalTree.run

For arbitrary types X,Y,OX,Y,OX,Y,O, a finite binary tree whose leaves carry output functions on XXX or YYY and whose internal nodes carry Boolean functions on XXX or YYY, and inputs x∈Xx\in Xx∈X and y∈Yy\in Yy∈Y, execution is defined recursively as follows: an Alice output leaf carrying f:X→Of:X\to Of:X→O returns f(x)f(x)f(x); a Bob output leaf carrying f:Y→Of:Y\to Of:Y→O returns f(y)f(y)f(y); an Alice internal node evaluates its Boolean function at xxx and executes its one child if true and its zero child if false; a Bob internal node does the same using yyy. Every recursive execution uses the same inputs x,yx,yx,y. No finiteness or nonemptiness assumption is imposed on the types.

QAlgorithms.Papers.Independent.Intakethird100.P81.LocalChannel

For any natural number NNN, finite wire subset S⊆{0,…,N−1}S\subseteq\{0,\ldots,N-1\}S⊆{0,…,N−1}, and function FFF from complex matrices on NNN-bit strings to matrices of the same size, this predicate means that there exist a natural number ddd and matrices E0,…,Ed−1E_0,\ldots,E_{d-1}E0​,…,Ed−1​ such that

∑j=0d−1Ej†Ej=I,F(ρ)=∑j=0d−1EjρEj†for every complex matrix ρ,\sum_{j=0}^{d-1}E_j^\dagger E_j=I, \qquad F(\rho)=\sum_{j=0}^{d-1}E_j\rho E_j^\dagger \quad\text{for every complex matrix }\rho,j=0∑d−1​Ej†​Ej​=I,F(ρ)=j=0∑d−1​Ej​ρEj†​for every complex matrix ρ,

and each EjE_jEj​ acts within SSS in the following precise sense: there exist a natural number hjh_jhj​, an injection wj:{0,…,hj−1}↪{0,…,N−1}w_j:\{0,\ldots,h_j-1\}\hookrightarrow\{0,\ldots,N-1\}wj​:{0,…,hj​−1}↪{0,…,N−1} with image contained in SSS, and a complex matrix MjM_jMj​ on hjh_jhj​-bit strings, such that Ej(y,z)=Mj(y∘wj,z∘wj)E_j(y,z)=M_j(y\circ w_j,z\circ w_j)Ej​(y,z)=Mj​(y∘wj​,z∘wj​) when y,zy,zy,z agree on all wires outside that image, and Ej(y,z)=0E_j(y,z)=0Ej​(y,z)=0 otherwise. The quantification over ρ\rhoρ is not restricted to density matrices. Zero-wire embeddings, empty SSS, and N=0N=0N=0 are included; a zero-wire embedding is a scalar multiple of the identity. Although ddd ranges over all natural numbers, d=0d=0d=0 cannot satisfy the completeness equation because the NNN-bit-string space is nonempty.

QAlgorithms.Papers.Independent.Intakethird100.P81.MeasurementPattern

For each natural number NNN, a measurement pattern is a record containing two Booleans, called aliceInput\mathrm{aliceInput}aliceInput and bobInput\mathrm{bobInput}bobInput, and a finite subset wires⊆{0,…,N−1}\mathrm{wires}\subseteq\{0,\ldots,N-1\}wires⊆{0,…,N−1}. These fields have no additional constraints. In particular, the wire subset may be empty, and when N=0N=0N=0 it must be empty.

QAlgorithms.Papers.Independent.Intakethird100.P81.PointerMap

For each natural number nnn, a pointer map is an arbitrary function {0,…,n−1}→{0,…,n−1}\{0,\ldots,n-1\}\to\{0,\ldots,n-1\}{0,…,n−1}→{0,…,n−1}, with no injectivity or surjectivity requirement. When n=0n=0n=0, this is the unique function from the empty set to itself.

QAlgorithms.Papers.Independent.Intakethird100.P81.PublicProtocol.bounded

For arbitrary types X,Y,OX,Y,OX,Y,O, a public protocol PPP with finitely many nonnegative seed weights summing to 111 and associated classical trees, a starting party ppp, and natural numbers k,ck,ck,c, the boundedness predicate means that every seed of strictly positive weight has a tree with at most kkk rounds from ppp and cost at most ccc. Cost is 000 at an output leaf and 111 plus the maximum child cost at a test node, so it counts the maximum number of test nodes on a structural path. Rounds are 000 at an output leaf; otherwise they count 111 for the first test node, an additional 111 if its party differs from ppp, and all subsequent changes of testing party, maximized over structural paths. Unrealizable branches still enter these maxima, output-leaf parties add nothing, and seeds of weight 000 impose no bounds. Both k=0k=0k=0 and c=0c=0c=0 are allowed.

QAlgorithms.Papers.Independent.Intakethird100.P81.PublicProtocol.computes

For arbitrary types X,Y,OX,Y,OX,Y,O with decidable equality on OOO, a public protocol PPP with seed weights wi≥0w_i\ge0wi​≥0 summing to 111 and classical trees TiT_iTi​, a function f:X×Y→Of:X\times Y\to Of:X×Y→O, and any real number ε\varepsilonε, the computation predicate means that for every x∈Xx\in Xx∈X and y∈Yy\in Yy∈Y,

1−ε≤∑iwi 1run⁡(Ti,x,y)=f(x,y).1-\varepsilon\le \sum_i w_i\,\mathbf 1_{\operatorname{run}(T_i,x,y)=f(x,y)}.1−ε≤i∑​wi​1run(Ti​,x,y)=f(x,y)​.

Running a tree follows the false or true subtree according to the current party’s Boolean test on its own input; an Alice output leaf returns its function evaluated at xxx, and a Bob output leaf returns its function evaluated at yyy. There is no separate restriction on ε\varepsilonε: if ε≥1\varepsilon\ge1ε≥1, the inequality is automatic; if ε<0\varepsilon<0ε<0 and both input types are nonempty, it cannot hold. If either input type is empty, the condition on input pairs is vacuous.

QAlgorithms.Papers.Independent.Intakethird100.P81.PublicProtocol

For arbitrary types X,Y,OX,Y,OX,Y,O, a public protocol consists of a natural number sss of seeds, a real weight wiw_iwi​ for each 0≤i<s0\le i<s0≤i<s, proofs that every wi≥0w_i\ge0wi​≥0 and ∑i=0s−1wi=1\sum_{i=0}^{s-1}w_i=1∑i=0s−1​wi​=1, and one classical tree TiT_iTi​ for each seed. Each tree has Alice nodes testing functions X→{false,true}X\to\{\mathrm{false},\mathrm{true}\}X→{false,true}, Bob nodes testing functions Y→{false,true}Y\to\{\mathrm{false},\mathrm{true}\}Y→{false,true}, two subtrees at every test node, and output leaves carrying either a function X→OX\to OX→O or a function Y→OY\to OY→O. Zero weights are permitted. Although the seed count is specified as a natural number, s=0s=0s=0 cannot satisfy the normalization requirement.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.computes

For arbitrary types X,Y,OX,Y,OX,Y,O, a quantum protocol PPP, a function f:X×Y→Of:X\times Y\to Of:X×Y→O, and a real number ε\varepsilonε, this predicate means that for every x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y,

1−ε≤Re⁡Tr⁡ ⁣(Mx,y,f(x,y) ψx,yψx,y†).1-\varepsilon\leq \operatorname{Re}\operatorname{Tr}\!\left( M_{x,y,f(x,y)}\,\psi_{x,y}\psi_{x,y}^{\dagger} \right).1−ε≤ReTr(Mx,y,f(x,y)​ψx,y​ψx,y†​).

The vector ψx,y\psi_{x,y}ψx,y​ is the initial vector after all round unitaries have been applied in order, with each round using its speaker's input-dependent unitary. The outcome matrix is taken from Alice's xxx-dependent family if Alice is the designated output party and from Bob's yyy-dependent family otherwise. This predicate does not itself require the protocol to be valid or ε\varepsilonε to lie in any specified interval; it is vacuous if either input type is empty.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.cost

For arbitrary types X,Y,OX,Y,OX,Y,O and a quantum protocol PPP, this defines its cost to be the natural number

∑r in the round list of P∣r.sent∣.\sum_{r\text{ in the round list of }P}|r.\mathrm{sent}|.r in the round list of P∑​∣r.sent∣.

Thus each round contributes the cardinality of its designated sent-wire set; a wire designated as sent in several rounds is counted once in each such round. An empty round list has cost 000. No validity assumption is required.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol

For arbitrary types X,Y,OX,Y,OX,Y,O, a quantum protocol consists of a natural number NNN; an initial complex vector indexed by the NNN-bit strings {0,1}N\{0,1\}^N{0,1}N, equipped with the Euclidean norm; an initial assignment of each of the NNN wires to Alice or Bob; a list of quantum rounds; an output party; and two matrix families, one assigning a complex matrix on {0,1}N\{0,1\}^N{0,1}N to each pair (x,o)∈X×O(x,o)\in X\times O(x,o)∈X×O, and the other assigning such a matrix to each (y,o)∈Y×O(y,o)\in Y\times O(y,o)∈Y×O. Each round contains a speaker, a finite set of wires, and Alice and Bob input-indexed families of unitary matrices on the full NNN-bit space. The structure imposes no normalization on the initial vector, no legality or alternation condition on the rounds, and no positivity, completeness, or ownership-support condition on the output matrix families. Both output families are included regardless of the output party; N=0N=0N=0 and an empty round list are permitted.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.measurement

For arbitrary types X,Y,OX,Y,OX,Y,O, a quantum protocol PPP with N=P.NN=P.NN=P.N qubits, and inputs x∈Xx\in Xx∈X, y∈Yy\in Yy∈Y, this defines an OOO-indexed family of complex matrices on the basis of NNN-bit strings. If PPP's designated output party is Alice, the family is P.measureAlice(x)P.\mathrm{measureAlice}(x)P.measureAlice(x); otherwise it is P.measureBob(y)P.\mathrm{measureBob}(y)P.measureBob(y). The definition itself requires neither positivity nor that these matrices sum to the identity, and imposes no restriction on which wires they act on.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.ownerAt

For arbitrary types X,Y,OX,Y,OX,Y,O, a quantum protocol PPP with N=P.NN=P.NN=P.N qubits, and any natural number ttt, this defines an ownership assignment on the wires {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}. Start with PPP's initial ownership assignment and process the first min⁡(t,ℓ)\min(t,\ell)min(t,ℓ) rounds in order, where ℓ\ellℓ is the length of its round list. In each processed round, assign every wire in that round's designated sent set to the party other than the round's speaker, and leave every other wire's ownership unchanged. Thus t=0t=0t=0 gives the initial assignment, and t≥ℓt\geq\ellt≥ℓ gives the assignment after all listed rounds. This definition imposes no legality condition: a designated sent wire is reassigned in this way even if the speaker did not previously own it.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.probability

For arbitrary types X,Y,OX,Y,OX,Y,O, a quantum protocol PPP on N=P.NN=P.NN=P.N qubits, inputs x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, and an outcome o∈Oo\in Oo∈O, this defines the real number

Re⁡Tr⁡ ⁣(Mx,y,o ψx,yψx,y†).\operatorname{Re}\operatorname{Tr}\!\left(M_{x,y,o}\,\psi_{x,y}\psi_{x,y}^{\dagger}\right).ReTr(Mx,y,o​ψx,y​ψx,y†​).

Here ψx,y\psi_{x,y}ψx,y​ is obtained from the initial vector by applying every listed round's unitary in order, using the round's Alice unitary at xxx when Alice speaks and its Bob unitary at yyy otherwise; Mx,y,oM_{x,y,o}Mx,y,o​ is Alice's outcome matrix at xxx if Alice is the output party and Bob's outcome matrix at yyy otherwise. The matrix ψx,yψx,y†\psi_{x,y}\psi_{x,y}^{\dagger}ψx,y​ψx,y†​ has entry ψx,y(u)ψx,y(v)‾\psi_{x,y}(u)\overline{\psi_{x,y}(v)}ψx,y​(u)ψx,y​(v)​. No validity, normalization, positivity, or measurement-completeness assumption is part of this definition.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.stateAt

For arbitrary types X,Y,OX,Y,OX,Y,O, a quantum protocol PPP on N=P.NN=P.NN=P.N qubits, inputs x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, and a natural number ttt, this defines a complex vector indexed by NNN-bit strings by starting with PPP's initial vector and applying, in list order, the unitary matrices from the first min⁡(t,ℓ)\min(t,\ell)min(t,ℓ) rounds, where ℓ\ellℓ is the round-list length. A round uses its Alice unitary evaluated at xxx if its speaker is Alice, and its Bob unitary evaluated at yyy otherwise. Explicitly, writing these matrices as U0(x,y),…,Uℓ−1(x,y)U_0(x,y),\ldots,U_{\ell-1}(x,y)U0​(x,y),…,Uℓ−1​(x,y) and r=min⁡(t,ℓ)r=\min(t,\ell)r=min(t,ℓ), the vector is

Ur−1(x,y)⋯U0(x,y) ψinitial,U_{r-1}(x,y)\cdots U_0(x,y)\,\psi_{\mathrm{initial}},Ur−1​(x,y)⋯U0​(x,y)ψinitial​,

with the empty product giving ψinitial\psi_{\mathrm{initial}}ψinitial​. Sending wires has no separate effect on this vector. No validity or normalization assumption is imposed, t=0t=0t=0 returns the initial vector, and t≥ℓt\geq\ellt≥ℓ applies all listed rounds.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumProtocol.valid

For arbitrary input types X,YX,YX,Y, a finite outcome type OOO, a quantum protocol PPP on N=P.NN=P.NN=P.N qubits, a starting party start∈{Alice,Bob}\mathrm{start}\in\{\mathrm{Alice},\mathrm{Bob}\}start∈{Alice,Bob}, and a natural number kkk, this predicate means the conjunction of the following conditions. The initial vector, indexed by NNN-bit strings, has Euclidean norm 111, and the round list has length exactly kkk. Starting from the initial ownership assignment and processing rounds in order, every wire designated as sent must currently belong to the speaker, and, for every input pair x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, the round's unitary must act within the speaker's currently owned wires; after the round, all sent wires are assigned to the other party and the remaining ownership assignments stay unchanged. Here the round's unitary is its Alice unitary at xxx when Alice speaks and its Bob unitary at yyy when Bob speaks. The speaker of round iii, numbered from 000, must be start\mathrm{start}start for even iii and the other party for odd iii. Finally, for every x,yx,yx,y, select Alice's xxx-dependent measurement family if Alice is the output party and Bob's yyy-dependent family otherwise: every outcome matrix must be positive semidefinite, their sum over OOO must equal the identity, and every outcome matrix must act within the output party's wires after all rounds. Precisely, “acts within” a wire set FFF means that there exist a natural number hhh, an injection w:{0,…,h−1}↪{0,…,N−1}w:\{0,\ldots,h-1\}\hookrightarrow\{0,\ldots,N-1\}w:{0,…,h−1}↪{0,…,N−1} with image contained in FFF, and a complex matrix MMM on hhh-bit strings such that the full matrix has entry M(u∘w,v∘w)M(u\circ w,v\circ w)M(u∘w,v∘w) when uuu and vvv agree outside the image of www, and entry 000 otherwise. The value h=0h=0h=0 is allowed. The definition also allows k=0k=0k=0 and empty sent sets; requirements quantified over input pairs are vacuous if either input type is empty.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumRound.matrix

For arbitrary types X,YX,YX,Y, any natural number NNN, a quantum round rrr containing a speaker, a selected wire set, an Alice input-indexed family of unitary matrices, and a Bob input-indexed family of unitary matrices on {0,1}N\{0,1\}^N{0,1}N, and inputs x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y, the selected matrix is Alice’s matrix at xxx if the speaker is Alice, and Bob’s matrix at yyy otherwise. It is returned as a complex matrix indexed by NNN-bit strings. The wire set does not enter this selection, and N=0N=0N=0 is included.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumRound

For arbitrary types X,YX,YX,Y and any natural number NNN, a quantum round consists of a speaker, either Alice or Bob; a finite set of wire indices from {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}; a function assigning to every x∈Xx\in Xx∈X a complex unitary matrix indexed by the NNN-bit strings {0,1}N\{0,1\}^N{0,1}N; and another such function assigning a unitary matrix to every y∈Yy\in Yy∈Y. Both families are included regardless of the speaker. This structure places no ownership or support conditions on the matrices or the selected wires. For N=0N=0N=0, the wire set is empty and the matrices are indexed by the single empty bit string.

QAlgorithms.Papers.Independent.Intakethird100.P81.QuantumRound.update

For arbitrary types X,YX,YX,Y, any natural number NNN, a quantum round rrr, and an ownership assignment o:{0,…,N−1}→{Alice,Bob}o:\{0,\ldots,N-1\}\to\{\mathrm{Alice},\mathrm{Bob}\}o:{0,…,N−1}→{Alice,Bob}, the updated assignment gives every wire in rrr’s selected set to the party opposite rrr’s speaker and leaves every other wire’s owner equal to o(q)o(q)o(q). The opposite of Alice is Bob and the opposite of Bob is Alice. This rule applies regardless of who previously owned a selected wire; an empty selected set leaves the assignment unchanged, including when N=0N=0N=0.

QAlgorithms.Papers.Independent.Intakethird100.P81.Vertex

For each natural number nnn, the vertex type is the disjoint union of two copies of {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}. Write their elements as L(v)L(v)L(v) and R(v)R(v)R(v); these are distinct even when their indices agree. When n=0n=0n=0, there are no vertices.

QAlgorithms.Papers.Independent.Intakethird100.P81.agreement

For any finite type AAA, any pair of complex matrices Mfalse,MtrueM_{\mathrm{false}},M_{\mathrm{true}}Mfalse​,Mtrue​ on AAA, and any complex matrix ρ\rhoρ on A×{false,true}A\times\{\mathrm{false},\mathrm{true}\}A×{false,true}, this defines the real number

∑b∈{false,true}Re⁡(∑a∈A∑a′∈A(Mb)a,a′ ρ(a′,b),(a,b)).\sum_{b\in\{\mathrm{false},\mathrm{true}\}} \operatorname{Re}\left( \sum_{a\in A}\sum_{a'\in A} (M_b)_{a,a'}\,\rho_{(a',b),(a,b)} \right).b∈{false,true}∑​Re(a∈A∑​a′∈A∑​(Mb​)a,a′​ρ(a′,b),(a,b)​).

There is no assumption that the matrices MbM_bMb​ form a measurement or that ρ\rhoρ is a density matrix. If AAA is empty, the value is zero.

QAlgorithms.Papers.Independent.Intakethird100.P81.aliceInputJoint

For arbitrary types X,YX,YX,Y, any natural number NNN, ownership assignment own:{0,…,N−1}→{Alice,Bob}\mathrm{own}:\{0,\ldots,N-1\}\to\{\mathrm{Alice},\mathrm{Bob}\}own:{0,…,N−1}→{Alice,Bob}, and any complex matrix ρ\rhoρ indexed by (X×Y)×{0,1}N(X\times Y)\times\{0,1\}^{N}(X×Y)×{0,1}N, this definition gives a matrix indexed by (X×Aown)×Y(X\times A_{\mathrm{own}})\times Y(X×Aown​)×Y, where AownA_{\mathrm{own}}Aown​ is the set of Boolean assignments to Alice’s wires. Writing BownB_{\mathrm{own}}Bown​ for the Boolean assignments to all remaining wires and merge⁡(a,b)\operatorname{merge}(a,b)merge(a,b) for the full string using aaa on Alice’s wires and bbb elsewhere, its entries are

J((x,a),y; (x′,a′),y′)=∑b∈Bownρ((x,y),merge⁡(a,b); (x′,y′),merge⁡(a′,b)).J((x,a),y;\,(x',a'),y') = \sum_{b\in B_{\mathrm{own}}} \rho((x,y),\operatorname{merge}(a,b);\,(x',y'),\operatorname{merge}(a',b)).J((x,a),y;(x′,a′),y′)=b∈Bown​∑​ρ((x,y),merge(a,b);(x′,y′),merge(a′,b)).

No finiteness assumption on X,YX,YX,Y, or positivity or normalization assumption on ρ\rhoρ, is imposed. The sum is finite because the work register has finitely many wires. If Bob has no wires, the sum has one term indexed by the empty assignment; this includes N=0N=0N=0.

QAlgorithms.Papers.Independent.Intakethird100.P81.channelRoundsLegal

For arbitrary types X,YX,YX,Y, a natural number NNN, an ownership assignment on the NNN wires, and a finite list of rounds, legality is defined recursively: the empty list is legal for every ownership assignment; a list beginning with round rrr is legal exactly when every wire in rrr's sent set is currently owned by its speaker, for every x∈Xx\in Xx∈X and y∈Yy\in Yy∈Y its selected matrix map is a local channel on that speaker's currently owned wires, and the remaining rounds are legal after assigning every sent wire to the other party. Here the selected map is rA(x)r_{\mathrm A}(x)rA​(x) for an Alice round and rB(y)r_{\mathrm B}(y)rB​(y) for a Bob round. A map FFF is a local channel on a wire set SSS precisely when there exist a natural number ddd and matrices E0,…,Ed−1E_0,\ldots,E_{d-1}E0​,…,Ed−1​, indexed by NNN-bit strings, such that

∑j=0d−1Ej†Ej=I,F(ρ)=∑j=0d−1EjρEj†for every complex matrix ρ,\sum_{j=0}^{d-1}E_j^\dagger E_j=I,\qquad F(\rho)=\sum_{j=0}^{d-1}E_j\rho E_j^\dagger \quad\text{for every complex matrix }\rho,j=0∑d−1​Ej†​Ej​=I,F(ρ)=j=0∑d−1​Ej​ρEj†​for every complex matrix ρ,

and each EjE_jEj​ acts within SSS. Acting within SSS means that for some natural number ttt, injection w:{0,…,t−1}↪{0,…,N−1}w:\{0,\ldots,t-1\}\hookrightarrow\{0,\ldots,N-1\}w:{0,…,t−1}↪{0,…,N−1} with image contained in SSS, and matrix MMM indexed by ttt-bit strings, its entry at strings u,vu,vu,v equals Mu∘w,v∘wM_{u\circ w,v\circ w}Mu∘w,v∘w​ when u,vu,vu,v agree outside the image of www, and equals zero otherwise. Zero wires, empty sent sets, and an empty round list are included; if XXX or YYY is empty, the condition on selected operations is vacuous. No alternating-speaker condition is part of this definition.

QAlgorithms.Papers.Independent.Intakethird100.P81.classicalWeight

For any type AAA, finite type BBB, complex matrix ρ\rhoρ indexed by A×BA\times BA×B, and element a∈Aa\in Aa∈A, this defines

Re⁡(∑b∈Bρ(a,b),(a,b)).\operatorname{Re}\left(\sum_{b\in B}\rho_{(a,b),(a,b)}\right).Re(b∈B∑​ρ(a,b),(a,b)​).

No positivity or normalization is required, so this real number is not assumed to be a probability. If BBB is empty, it is zero; if AAA is empty, there is no element aaa to supply.

QAlgorithms.Papers.Independent.Intakethird100.P81.coherentExecutionStateAt

For arbitrary types X,Y,OX,Y,OX,Y,O, with finite enumerations and decidable equality for X,YX,YX,Y, any quantum protocol record PPP with N=P.NN=P.NN=P.N work qubits, and any sequence of measurement patterns mtm_tmt​, this definition recursively produces complex matrices RtR_tRt​ indexed by (X×Y)×{0,1}N(X\times Y)\times\{0,1\}^{N}(X×Y)×{0,1}N. Set Ψ((x,y),z)=ψ(z)/∣X∣∣Y∣\Psi((x,y),z)=\psi(z)/\sqrt{|X||Y|}Ψ((x,y),z)=ψ(z)/∣X∣∣Y∣​, where ψ=P.initial\psi=P.\mathrm{initial}ψ=P.initial, and set R0=Dm0(ΨΨ†)R_0=D_{m_0}(\Psi\Psi^\dagger)R0​=Dm0​​(ΨΨ†), so (ΨΨ†)p,q=Ψ(p)Ψ(q)‾(\Psi\Psi^\dagger)_{p,q}=\Psi(p)\overline{\Psi(q)}(ΨΨ†)p,q​=Ψ(p)Ψ(q)​. Here DmD_mDm​ retains an entry exactly when its Alice input coordinates agree if the pattern’s Alice Boolean is true, its Bob input coordinates agree if the Bob Boolean is true, and its work strings agree on every selected wire; it sets all other entries to zero. If the protocol has a round rtr_trt​ at zero-based position ttt, then

Rt+1=Dmt+1(CrtRtCrt†),R_{t+1}=D_{m_{t+1}}(C_{r_t}R_tC_{r_t}^{\dagger}),Rt+1​=Dmt+1​​(Crt​​Rt​Crt​†​),

where CrtC_{r_t}Crt​​ is zero between unequal input pairs and, on the block for (x,y)(x,y)(x,y), equals Alice’s input-xxx unitary or Bob’s input-yyy unitary according to that round’s speaker. If position ttt is absent, then Rt+1=RtR_{t+1}=R_tRt+1​=Rt​, without applying the next pattern. Thus the sequence is constant after all listed rounds have been processed. No protocol validity or initial normalization is assumed; empty input types and N=0N=0N=0 are allowed, with inverse zero interpreted as zero.

QAlgorithms.Papers.Independent.Intakethird100.P81.coherentInitial

For arbitrary types X,Y,OX,Y,OX,Y,O, with specified finite enumerations of XXX and YYY, and any quantum protocol record PPP with input types X,YX,YX,Y, output type OOO, N=P.NN=P.NN=P.N work qubits, and initial amplitude vector ψ=P.initial\psi=P.\mathrm{initial}ψ=P.initial, this definition gives the complex Euclidean vector indexed by (X×Y)×{0,1}N(X\times Y)\times\{0,1\}^{N}(X×Y)×{0,1}N whose amplitudes are

Ψ((x,y),z)=ψ(z)∣X∣ ∣Y∣.\Psi((x,y),z)=\frac{\psi(z)}{\sqrt{|X|\,|Y|}}.Ψ((x,y),z)=∣X∣∣Y∣​ψ(z)​.

The protocol’s other fields do not affect this definition, and no validity or normalization hypothesis is imposed on PPP or ψ\psiψ. The types XXX and YYY may be empty; in that case the resulting vector has an empty coordinate index set, and the scalar inverse of zero is defined to be zero. The case N=0N=0N=0, with its single empty bit string, is also included.

QAlgorithms.Papers.Independent.Intakethird100.P81.controlledRound

For arbitrary types X,YX,YX,Y with decidable equality, any natural number NNN, and any quantum round record rrr, let Ux,yU_{x,y}Ux,y​ be Alice’s specified unitary matrix at input xxx when rrr’s speaker is Alice, and Bob’s specified unitary matrix at input yyy when its speaker is Bob. This definition gives a complex matrix indexed by (X×Y)×{0,1}N(X\times Y)\times\{0,1\}^{N}(X×Y)×{0,1}N, with entries

Cr((x,y),z; (x′,y′),z′)={Ux,y(z,z′),(x,y)=(x′,y′),0,otherwise.C_r((x,y),z;\,(x',y'),z') = \begin{cases} U_{x,y}(z,z'),&(x,y)=(x',y'),\\ 0,&\text{otherwise}. \end{cases}Cr​((x,y),z;(x′,y′),z′)={Ux,y​(z,z′),0,​(x,y)=(x′,y′),otherwise.​

The round’s set of sent wires does not enter this formula, and no ownership or locality condition is assumed. Empty input types and N=0N=0N=0 are allowed.

QAlgorithms.Papers.Independent.Intakethird100.P81.dephaseSelectedRegisters

For arbitrary types X,YX,YX,Y with decidable equality, any natural number NNN, a pattern mmm consisting of two Booleans mA,mBm_A,m_BmA​,mB​ and a finite wire subset W⊆{0,…,N−1}W\subseteq\{0,\ldots,N-1\}W⊆{0,…,N−1}, and any complex matrix ρ\rhoρ indexed by (X×Y)×{0,1}N(X\times Y)\times\{0,1\}^{N}(X×Y)×{0,1}N, this definition returns the matrix

Dm(ρ)((x,y),z; (x′,y′),z′)={ρ((x,y),z; (x′,y′),z′),(mA=false ∨ x=x′)∧(mB=false ∨ y=y′)∧(∀w∈W, z(w)=z′(w)),0,otherwise.D_m(\rho)((x,y),z;\,(x',y'),z') = \begin{cases} \rho((x,y),z;\,(x',y'),z'),& (m_A=\mathrm{false}\ \lor\ x=x') \land(m_B=\mathrm{false}\ \lor\ y=y') \land(\forall w\in W,\ z(w)=z'(w)),\\ 0,&\text{otherwise}. \end{cases}Dm​(ρ)((x,y),z;(x′,y′),z′)={ρ((x,y),z;(x′,y′),z′),0,​(mA​=false ∨ x=x′)∧(mB​=false ∨ y=y′)∧(∀w∈W, z(w)=z′(w)),otherwise.​

No positivity, trace, or normalization condition is imposed on ρ\rhoρ. An empty wire subset imposes no work-register agreement condition; when both Booleans are false and the wire subset is empty, every entry is retained. Empty input types and N=0N=0N=0 are included.

QAlgorithms.Papers.Independent.Intakethird100.P81.endpoint

For every natural number nnn, natural number kkk, starting index v1∈{0,…,n−1}v_1\in\{0,\ldots,n-1\}v1​∈{0,…,n−1}, and arbitrary functions a,b:{0,…,n−1}→{0,…,n−1}a,b:\{0,\ldots,n-1\}\to\{0,\ldots,n-1\}a,b:{0,…,n−1}→{0,…,n−1}, the endpoint is obtained by applying the successor function exactly k+1k+1k+1 times to L(v1)L(v_1)L(v1​), where a successor step sends L(v)L(v)L(v) to R(a(v))R(a(v))R(a(v)) and R(v)R(v)R(v) to L(b(v))L(b(v))L(b(v)). In particular, when k=0k=0k=0 the endpoint is R(a(v1))R(a(v_1))R(a(v1​)). The required starting index cannot be supplied when n=0n=0n=0.

QAlgorithms.Papers.Independent.Intakethird100.P81.firstRegisterConditionalBlock

For any type AAA, finite type BBB, complex matrix ρ\rhoρ indexed by A×BA\times BA×B, and element a∈Aa\in Aa∈A, let wa=Re⁡∑c∈Bρ(a,c),(a,c)w_a=\operatorname{Re}\sum_{c\in B}\rho_{(a,c),(a,c)}wa​=Re∑c∈B​ρ(a,c),(a,c)​. This defines a matrix on BBB by

(Ca)b,b′=(wa:C)−1ρ(a,b),(a,b′).(C_a)_{b,b'}=(w_a:\mathbb C)^{-1}\rho_{(a,b),(a,b')}.(Ca​)b,b′​=(wa​:C)−1ρ(a,b),(a,b′)​.

No density or nonzero-weight hypothesis is imposed. In particular, when wa=0w_a=0wa​=0, the inverse is defined to be zero and CaC_aCa​ is the zero matrix. The type BBB may be empty.

QAlgorithms.Papers.Independent.Intakethird100.P81.informationalDistance

For any finite types A,BA,BA,B with decidable equality and any complex matrix ρ\rhoρ indexed by A×BA\times BA×B, let (ρA)a,a′=∑bρ(a,b),(a′,b)(\rho_A)_{a,a'}=\sum_b\rho_{(a,b),(a',b)}(ρA​)a,a′​=∑b​ρ(a,b),(a′,b)​, let (ρB)b,b′=∑aρ(a,b),(a,b′)(\rho_B)_{b,b'}=\sum_a\rho_{(a,b),(a,b')}(ρB​)b,b′​=∑a​ρ(a,b),(a,b′)​, and put X=ρ−ρA⊗ρBX=\rho-\rho_A\otimes\rho_BX=ρ−ρA​⊗ρB​. This defines the real number

Re⁡tr⁡X†X,\operatorname{Re}\operatorname{tr}\sqrt{X^\dagger X},RetrX†X​,

where the square root is defined by continuous functional calculus. There is no factor of 1/21/21/2. The definition applies without assuming that ρ\rhoρ is Hermitian, positive, or normalized, and it includes empty index types.

QAlgorithms.Papers.Independent.Intakethird100.P81.iteratedLog

For every real number xxx and natural number jjj, define L0(x)=max⁡{1,x}L_0(x)=\max\{1,x\}L0​(x)=max{1,x} and recursively define Lj+1(x)=max⁡{1,log⁡2(Lj(x))}L_{j+1}(x)=\max\{1,\log_2(L_j(x))\}Lj+1​(x)=max{1,log2​(Lj​(x))}. The declared function returns Lj(x)L_j(x)Lj​(x). Its real argument is unrestricted, including zero and negative values; all intermediate values are at least 111, and if x≤1x\le1x≤1, every value is 111.

QAlgorithms.Papers.Independent.Intakethird100.P81.jointMarginalProduct

For any finite types A,BA,BA,B and any complex matrix ρ\rhoρ indexed by A×BA\times BA×B, this defines the matrix whose entries are

(jointMarginalProduct⁡(ρ))(a,b),(a′,b′)=(∑c∈Bρ(a,c),(a′,c))(∑d∈Aρ(d,b),(d,b′)).\bigl(\operatorname{jointMarginalProduct}(\rho)\bigr)_{(a,b),(a',b')} = \left(\sum_{c\in B}\rho_{(a,c),(a',c)}\right) \left(\sum_{d\in A}\rho_{(d,b),(d,b')}\right).(jointMarginalProduct(ρ))(a,b),(a′,b′)​=(c∈B∑​ρ(a,c),(a′,c)​)(d∈A∑​ρ(d,b),(d,b′)​).

Thus it is the Kronecker product of the matrices obtained by summing over the second and first registers, respectively. No positivity or normalization assumption is imposed, and either index type may be empty.

QAlgorithms.Papers.Independent.Intakethird100.P81.jointMutualInfoBits

For any finite types A,BA,BA,B with decidable equality and any complex matrix ρ\rhoρ indexed by A×BA\times BA×B, define matrices ρA,ρB\rho_A,\rho_BρA​,ρB​ by (ρA)a,a′=∑b∈Bρ(a,b),(a′,b)(\rho_A)_{a,a'}=\sum_{b\in B}\rho_{(a,b),(a',b)}(ρA​)a,a′​=∑b∈B​ρ(a,b),(a′,b)​ and (ρB)b,b′=∑a∈Aρ(a,b),(a,b′)(\rho_B)_{b,b'}=\sum_{a\in A}\rho_{(a,b),(a,b')}(ρB​)b,b′​=∑a∈A​ρ(a,b),(a,b′)​. Writing f[X]f[X]f[X] for the continuous functional calculus of the real function fff at XXX, set H(X)=−Re⁡tr⁡((x↦xlog⁡2x)[X])H(X)=-\operatorname{Re}\operatorname{tr}((x\mapsto x\log_2x)[X])H(X)=−Retr((x↦xlog2​x)[X]). The defined real number is

H(ρA)+H(ρB)−H(ρ).H(\rho_A)+H(\rho_B)-H(\rho).H(ρA​)+H(ρB​)−H(ρ).

No positivity, Hermiticity, or trace normalization is required of ρ\rhoρ. Empty index types are allowed, with empty sums and traces equal to zero.

QAlgorithms.Papers.Independent.Intakethird100.P81.logStar

For every natural number nnn, regarded as a real number when used as an argument, define L0(n)=max⁡{1,n}L_0(n)=\max\{1,n\}L0​(n)=max{1,n} and Lj+1(n)=max⁡{1,log⁡2(Lj(n))}L_{j+1}(n)=\max\{1,\log_2(L_j(n))\}Lj+1​(n)=max{1,log2​(Lj​(n))}. The declared natural number is the infimum in N\mathbb NN of {j∈N:Lj(n)≤1}\{j\in\mathbb N:L_j(n)\le1\}{j∈N:Lj​(n)≤1}: the least such index when this set is nonempty, with the natural-number infimum convention giving 000 if it is empty. In particular, the result is 000 for n=0n=0n=0 and n=1n=1n=1.

QAlgorithms.Papers.Independent.Intakethird100.P81.mergeWork

For any natural number NNN, ownership assignment own:{0,…,N−1}→{Alice,Bob}\mathrm{own}:\{0,\ldots,N-1\}\to\{\mathrm{Alice},\mathrm{Bob}\}own:{0,…,N−1}→{Alice,Bob}, Boolean assignment aaa on Alice’s wires, and Boolean assignment bbb on the wires not owned by Alice, this definition gives the full NNN-bit string

merge⁡own(a,b)(q)={a(q),own(q)=Alice,b(q),own(q)≠Alice.\operatorname{merge}_{\mathrm{own}}(a,b)(q)= \begin{cases} a(q),&\mathrm{own}(q)=\mathrm{Alice},\\ b(q),&\mathrm{own}(q)\ne\mathrm{Alice}. \end{cases}mergeown​(a,b)(q)={a(q),b(q),​own(q)=Alice,own(q)=Alice.​

The arguments a(q)a(q)a(q) and b(q)b(q)b(q) are evaluated on their respective wire subsets. No wire is omitted, and N=0N=0N=0 gives the unique empty bit string.

QAlgorithms.Papers.Independent.Intakethird100.P81.nonDisjoint

For every natural number nnn and Boolean functions x,y:{0,…,n−1}→{false,true}x,y:\{0,\ldots,n-1\}\to\{\mathrm{false},\mathrm{true}\}x,y:{0,…,n−1}→{false,true}, the defined Boolean is true exactly when there exists an index iii for which both x(i)x(i)x(i) and y(i)y(i)y(i) are true, and false otherwise. When n=0n=0n=0, the existential condition is false, so the result is false.

QAlgorithms.Papers.Independent.Intakethird100.P81.owned

For any natural number NNN, ownership assignment o:{0,…,N−1}→{Alice,Bob}o:\{0,\ldots,N-1\}\to\{\mathrm{Alice},\mathrm{Bob}\}o:{0,…,N−1}→{Alice,Bob}, and party ppp, the defined finite set is exactly

{q∈{0,…,N−1}:o(q)=p}.\{q\in\{0,\ldots,N-1\}:o(q)=p\}.{q∈{0,…,N−1}:o(q)=p}.

It may be empty and is necessarily empty when N=0N=0N=0.

QAlgorithms.Papers.Independent.Intakethird100.P81.pointerParity

For every natural number nnn, natural number kkk, starting index v1∈{0,…,n−1}v_1\in\{0,\ldots,n-1\}v1​∈{0,…,n−1}, and arbitrary functions a,b:{0,…,n−1}→{0,…,n−1}a,b:\{0,\ldots,n-1\}\to\{0,\ldots,n-1\}a,b:{0,…,n−1}→{0,…,n−1}, start at L(v1)L(v_1)L(v1​) and take exactly k+1k+1k+1 steps, sending L(v)L(v)L(v) to R(a(v))R(a(v))R(a(v)) and R(v)R(v)R(v) to L(b(v))L(b(v))L(b(v)). Label the resulting vertex by vvv if it is L(v)L(v)L(v) and by n+vn+vn+v if it is R(v)R(v)R(v). The defined Boolean is true exactly when the sum of the binary digits of this natural-number label has remainder 111 upon division by 222, and false otherwise. A zero label has binary digit sum zero and therefore gives false; when n=0n=0n=0, no starting index exists.

QAlgorithms.Papers.Independent.Intakethird100.P81.preparationRound

For any natural number NNN, including N=0N=0N=0, any ownership assignment o:{0,…,N−1}→{Alice,Bob}o:\{0,\ldots,N-1\}\to\{\text{Alice},\text{Bob}\}o:{0,…,N−1}→{Alice,Bob}, and any unitary matrix UUU on the complex vector space indexed by NNN-bit strings, this defines a quantum round with singleton input sets for both parties. Alice is the speaker; the transmitted wires are exactly {q:o(q)=Bob}\{q:o(q)=\text{Bob}\}{q:o(q)=Bob}; Alice’s unitary is UUU for her unique input, and Bob’s unitary is the identity for his unique input.

QAlgorithms.Papers.Independent.Intakethird100.P81.roundsLegal

For arbitrary types X,YX,YX,Y and any natural number NNN, legality of a list of quantum rounds is defined recursively from an ownership assignment ooo. The empty list is legal. A list beginning with round rrr is legal precisely when every selected wire currently belongs to rrr’s speaker, every input pair x∈X,y∈Yx\in X,y\in Yx∈X,y∈Y gives a selected matrix acting within that speaker’s currently owned wires, and the remaining list is legal after assigning the selected wires to the opposite party and leaving other owners unchanged. The selected matrix is Alice’s matrix at xxx for an Alice speaker and Bob’s matrix at yyy for a Bob speaker. Explicitly, acting within the owned wires means that there exist a natural number hhh, an injection w:{0,…,h−1}↪{0,…,N−1}w:\{0,\ldots,h-1\}\hookrightarrow\{0,\ldots,N-1\}w:{0,…,h−1}↪{0,…,N−1} whose image consists of wires owned by the speaker, and a complex matrix MMM indexed by hhh-bit strings, such that the selected matrix has entries

Uu,v={Mu∘w,v∘w,u(q)=v(q) for every q∉range⁡(w),0,otherwise.U_{u,v}= \begin{cases} M_{u\circ w,v\circ w},&u(q)=v(q)\text{ for every }q\notin\operatorname{range}(w),\\ 0,&\text{otherwise}. \end{cases}Uu,v​={Mu∘w,v∘w​,0,​u(q)=v(q) for every q∈/range(w),otherwise.​

Here h=0h=0h=0 is permitted. The universal matrix condition is vacuous if either input type is empty; legality does not itself require speakers to alternate or selected wire sets to be nonempty.

QAlgorithms.Papers.Independent.Intakethird100.P81.speakerAt

For a starting party p∈{Alice,Bob}p\in\{\mathrm{Alice},\mathrm{Bob}\}p∈{Alice,Bob} and a natural number ttt, the designated speaker is ppp when ttt is even and the opposite party when ttt is odd, with Alice and Bob opposite to each other. In particular, the speaker at t=0t=0t=0 is ppp.

QAlgorithms.Papers.Independent.Intakethird100.P81.successor

For every natural number nnn and arbitrary functions a,b:{0,…,n−1}→{0,…,n−1}a,b:\{0,\ldots,n-1\}\to\{0,\ldots,n-1\}a,b:{0,…,n−1}→{0,…,n−1}, the successor function on the disjoint union of two copies of this index set is defined by succ⁡a,b(L(v))=R(a(v))\operatorname{succ}_{a,b}(L(v))=R(a(v))succa,b​(L(v))=R(a(v)) and succ⁡a,b(R(v))=L(b(v))\operatorname{succ}_{a,b}(R(v))=L(b(v))succa,b​(R(v))=L(b(v)). When n=0n=0n=0, it is the unique function on the empty vertex set.

QAlgorithms.Papers.Independent.Intakethird100.P81.swapState

For arbitrary types A,BA,BA,B and any complex matrix ρ\rhoρ indexed by A×BA\times BA×B, this defines a matrix on B×AB\times AB×A by

(swapState⁡(ρ))(b,a),(b′,a′)=ρ(a,b),(a′,b′).\bigl(\operatorname{swapState}(\rho)\bigr)_{(b,a),(b',a')} =\rho_{(a,b),(a',b')}.(swapState(ρ))(b,a),(b′,a′)​=ρ(a,b),(a′,b′)​.

Neither finiteness nor any state condition is assumed; empty types are included.

QAlgorithms.Papers.Independent.Intakethird100.P81.vertexLabel

For every natural number nnn, label the vertices in the disjoint union of two copies of {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} by label⁡(L(v))=v\operatorname{label}(L(v))=vlabel(L(v))=v and label⁡(R(v))=n+v\operatorname{label}(R(v))=n+vlabel(R(v))=n+v, as natural numbers. Thus the left labels run from 000 through n−1n-1n−1 and the right labels from nnn through 2n−12n-12n−1; when n=0n=0n=0, the labeling function has empty domain.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Nov 1, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me