Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Probabilistic exact universal quantum circuits for transforming unitary operations

Definition
QAlgorithms_Papers_Independent_Intake100_P12

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

prove2quantum

The objects the formalized statements of Probabilistic exact universal quantum circuits for transforming unitary operations (arXiv:1909.01366) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • taskOutputChoi: PDF p.2, Eq. (1): transport the accepted input-first Choi matrix to output-first order, preserving the unnormalized convention.
  • taskFromOutputChoi: PDF p.2, Eq. (2): reconstruct using the accepted Choi inverse after explicitly swapping the output-first coordinates back to input-first order.
  • gateChoi: PDF p.2: Choi matrix of a single-Kraus operation, in the chosen basis.
  • OracleWireDimensions: PDF pp.4–6: dimensions of every physical wire; positivity is PositiveWires.
  • PositiveWires: PDF pp.2–6: no zero-dimensional physical wires.
  • Inputs: PDF p.4: tensor product input computational basis.
  • Outputs: PDF p.4: tensor product output computational basis.
  • ProcessBasis: PDF pp.5–7: the source's explicitly reordered I0,I,O,O0 basis.
  • uniformWires: PDF p.4: homogeneous d-dimensional wires in the universal transformation tasks.
  • slotTensor: PDF pp.4–6: Choi matrix of a tensor product of independently supplied slots.
  • evaluateOracleSlots: PDF p.7, Eq. (16): full transpose on contracted IO factors, expanded entrywise. The same row/column indices in S and J are the effect of that transpose; no adjoint occurs.
  • ParallelRealizes: PDF p.5: one simultaneous tensor batch with fixed CPTP encoder and decoder. Memory is first in both tensor products. Equality is on every combined slot map and every operator, rather than just the repeated-unitary inputs.
  • DelayedRealizes: PDF pp.8–9, Eq. (32): the encoder prepares a normalized resource, before the input state exists. The decoder gets input,state in that explicit tensor order.
  • sequentialRun: PDF p.5, Eq. (11): evaluation of k ordered oracle slots. Each fold entry contains exactly one oracle application, followed by a fixed channel E_i.
  • SequentialRealizes: PDF p.5, Eq. (11): fixed-order sequential circuit; all memory and channels are quantified before the independent slot maps. At k=0 the oracle fold is empty.
  • GeneralDeterministic: PDF pp.4–6: completely CP preserving general process in Choi coordinates. Positivity is precisely complete CP preservation; normalization is required on arbitrary independent slot channels, not merely equal unitary slots. Eq. (14) is deliberately not used.
  • ProtocolClass: PDF pp.4–7: the three protocol classes are distinct.
  • ClassRealizable: PDF pp.4–7: deterministic physical implementation in the named class. Sequential means Eq. (11), with k actual oracle calls, never General.
  • WireLabel: PDF pp.5–6: labels for the homogeneous physical wires.
  • wireCoordinate: PDF p.5: computational-basis coordinate on a labelled wire.
  • replaceCoordinates: PDF p.5: replace exactly the selected coordinates by coordinates of z.
  • traceReplace: PDF pp.5–6: trace-and-replace, R_A C = (Tr_A C) tensor I_A/d_A, in the ORIGINAL wire order. Summing over a full dummy register duplicates the unselected coordinates d^(2k+2-|A|) times; the denominator d^(2k+2) cancels that multiplicity and gives exactly the source's 1/d_A normalization.
  • outputWires: PDF p.5: all oracle output wires plus the final external output.
  • futureWires: PDF p.5: all wires except the external input.
  • ParallelNormalized: PDF p.5, Eq. (10): explicit finite affine parallel normalization equations.
  • laterWires: PDF p.5, Eq. (12): wires strictly later than slot i, plus the final output.
  • SequentialNormalized: PDF p.5, Eq. (12): finite sequential comb normalization, in fixed slot order. The recursive partial traces are expressed as trace-and-replace in the full space.
  • ChannelFamily: PDF pp.4–6: an actual family of independent CPTP slot-channel Choi matrices.
  • channelAffineSpan: PDF pp.5–7: augmented span encodes the affine, rather than homogeneous, normalization constraints. Its generators are actual independent channel tuples.
  • IsNormalizationBasis: PDF pp.5–7: finite exact normalization tests from a basis of the actual augmented independent-channel span. No assertion about a numerical rank is used.
  • GeneralFiniteNormalized: PDF pp.4–7: finite general-process normalization on independent slot channels. Each output partial trace is an affine linear equality in C; C>=0 supplies complete CP preservation. This replaces no printed Eq. (14) by fiat.
  • FiniteClassNormalized: PDF pp.5–7: the three explicit finite normalization systems.
  • HeraldedRealizable: PDF pp.6–7: both CP branches are retained and normalized jointly.
  • DelayedInstrument: PDF pp.9–10: a delayed parallel superinstrument, including its failure branch.
  • repeatedChoi: PDF pp.6–7: identical uses of the unknown unitary channel.
  • UnitaryTask: PDF pp.7,10,12,18: the unitary task, with channel equality removing global phases.
  • targetChoi: PDF pp.7,10,12,18: transpose, entrywise conjugation, and inverse are different.
  • ExactUnitarySuccess: PDF pp.6–7: exact success as an equality of unnormalized channel Choi matrices. This is equality on all inputs, including entangled references, with constant p.
  • Attainable: PDF pp.6–7: a single physical protocol precedes the universal unknown input.
  • DelayedAttainable: PDF pp.9,14–16: constant-success delayed-input protocols.
  • unitarySpan: PDF p.7, Eq. (19): the actual repeated-unitary Choi span, not the ambient space.
  • IsUnitaryBasis: PDF p.7, Eq. (19): a finite basis consisting of actual unitary operations.
  • UnitaryLinearTarget: PDF pp.6–7, footnote 7: Section III assumes a linear channel target.
  • TestedFeasible: PDF p.7: finitely tested SDP feasibility, with both branches and a physical class.
  • DelayedNormalized: PDF p.9, Eq. (34): all identities are explicitly placed on I0 and O. The remaining marginal is on I, with its source normalization preserved.
  • totalDimension: PDF p.10, Lemma 1: product of all wire dimensions, including both external wires.
  • bellZeroKraus: PDF pp.12–13: the zero-Bell-outcome Kraus contraction, including the two normalized maximally entangled amplitudes. Its matrix entries are U_(b,a)/d.
  • storageWires: PDF p.14, footnote 14: a storage process has no external input and a finite memory output; its k oracle slots may use any allowed causal ordering.
  • storedProgram: PDF pp.14–16: the stored program is the memory state after all oracle uses. The input to storage is the unique scalar state on the one-dimensional wire.
  • LearningAttainable: PDF pp.14–16 and footnote 14: exact probabilistic learning, allowing the most general storage process before the target input arrives. Its one-dimensional past and common future are fixed; this introduces no undefined delayed-input indefinite-order class. Retrieval has no oracle access, and both linear CP retrieval branches sum to a CPTP channel. Ref. [24] permits parallel storage without loss for attainable success; Lemma 3 supplies the task equivalence.
  • switchMatrix: PDF p.17: coherent control of permutations of k slots. The controlled product acts on the system and leaves each order label untouched.
  • parallelTransposeProbability: PDF pp.13,16: parallel transposition success; positive denominator when d,k>0.
  • adaptiveTransposeProbability: PDF p.17: ceil(k/d) attempts, each successful with probability 1/d^2.
  • adaptiveInverseProbability: PDF pp.18–19: floor((k+1)/d) inversion attempts.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Channel
import Definitions.Def_QAlgorithms_Defs_SchurUnitaryEnsembles
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P21
import Definitions.Def_QAlgorithms_Papers_Independent_Dependency50_P26

/-!
Statements from arXiv:1909.01366v2. All Choi matrices are unnormalized.
Channel indices are (output,input). Process indices are I0,I,O,O0.
The printed three-slot Eq. (14) and uncertified numerical tables are deferred.
The paper-local operational definitions below never use that equation.
Accepted matrix/channel primitives are imported; Choi adapters explicitly swap legs.
-/

noncomputable section

open QAlgorithms
open scoped Matrix ComplexConjugate ComplexOrder Kronecker

namespace QAlgorithms.Papers.Independent.Intake100.P12

attribute [local instance] Classical.propDecidable Classical.decEq

open QAlgorithms.Papers.Independent.Information100.P21 (Op)
open QAlgorithms.Papers.Independent.Dependency50.P26 (ChannelChoi)

/-- PDF p.2, Eq. (1): transport the accepted input-first Choi matrix to
output-first order, preserving the unnormalized convention. -/
def taskOutputChoi {I O : Type} [Fintype I] [DecidableEq I]
    (Phi : Superop I O) : Op (O × I) :=
  (QAlgorithms.Papers.Independent.Information100.P34.choi Phi).submatrix
    Prod.swap Prod.swap

/-- PDF p.2, Eq. (2): reconstruct using the accepted Choi inverse after
explicitly swapping the output-first coordinates back to input-first order. -/
def taskFromOutputChoi {I O : Type} [Fintype I]
    (J : Op (O × I)) : Superop I O :=
  QAlgorithms.Papers.Independent.Information100.P34.fromChoi
    (J.submatrix Prod.swap Prod.swap)

/-- The accepted Choi adapter puts output coordinates first without scaling. -/
example {I O : Type} [Fintype I] [DecidableEq I]
    (Phi : Superop I O) (a b : O × I) :
    taskOutputChoi Phi a b = Phi (Matrix.single a.2 b.2 1) a.1 b.1 := rfl

/-- Reconstruction keeps every off-diagonal input coefficient. -/
example {I O : Type} [Fintype I] (J : Op (O × I)) (X : Op I) (a b : O) :
    taskFromOutputChoi J X a b = ∑ i, ∑ j, X i j * J (a,i) (b,j) := rfl

/-- PDF p.2: Choi matrix of a single-Kraus operation, in the chosen basis. -/
def gateChoi {I O : Type} (V : Matrix O I ℂ) : Op (O × I) :=
  fun a b => V a.1 a.2 * conj (V b.1 b.2)

/-- PDF pp.4–6: dimensions of every physical wire; positivity is PositiveWires. -/
structure OracleWireDimensions (k : ℕ) where
  inputExternal : ℕ
  outputExternal : ℕ
  inputSlot : Fin k → ℕ
  outputSlot : Fin k → ℕ

/-- PDF pp.2–6: no zero-dimensional physical wires. -/
def PositiveWires {k : ℕ} (w : OracleWireDimensions k) : Prop :=
  0 < w.inputExternal ∧ 0 < w.outputExternal ∧
    (∀ i, 0 < w.inputSlot i) ∧ (∀ i, 0 < w.outputSlot i)

/-- PDF p.4: tensor product input computational basis. -/
abbrev Inputs {k : ℕ} (w : OracleWireDimensions k) := (i : Fin k) → Fin (w.inputSlot i)

/-- PDF p.4: tensor product output computational basis. -/
abbrev Outputs {k : ℕ} (w : OracleWireDimensions k) := (i : Fin k) → Fin (w.outputSlot i)

/-- PDF pp.5–7: the source's explicitly reordered I0,I,O,O0 basis. -/
abbrev ProcessBasis {k : ℕ} (w : OracleWireDimensions k) :=
  Fin w.inputExternal × (Inputs w × (Outputs w × Fin w.outputExternal))

/-- PDF p.4: homogeneous d-dimensional wires in the universal transformation tasks. -/
def uniformWires (d k : ℕ) : OracleWireDimensions k := ⟨d,d,fun _ => d,fun _ => d⟩

/-- PDF pp.4–6: Choi matrix of a tensor product of independently supplied slots. -/
def slotTensor {k : ℕ} {w : OracleWireDimensions k}
    (J : (i : Fin k) → Op (Fin (w.outputSlot i) × Fin (w.inputSlot i))) :
    Op (Outputs w × Inputs w) :=
  fun a b => ∏ i, J i (a.1 i,a.2 i) (b.1 i,b.2 i)

/-- PDF p.7, Eq. (16): full transpose on contracted IO factors, expanded entrywise.
The same row/column indices in S and J are the effect of that transpose; no adjoint occurs. -/
def evaluateOracleSlots {k : ℕ} {w : OracleWireDimensions k} (S : Op (ProcessBasis w))
    (J : Op (Outputs w × Inputs w)) :
    Op (Fin w.outputExternal × Fin w.inputExternal) :=
  fun a b => ∑ x : Inputs w, ∑ y : Inputs w,
    ∑ u : Outputs w, ∑ v : Outputs w,
      S (a.2,x,u,a.1) (b.2,y,v,b.1) * J (u,x) (v,y)

/-- PDF p.5: one simultaneous tensor batch with fixed CPTP encoder and decoder.
Memory is first in both tensor products. Equality is on every combined slot map
and every operator, rather than just the repeated-unitary inputs. -/
def ParallelRealizes {k : ℕ} (w : OracleWireDimensions k) (C : Op (ProcessBasis w)) : Prop :=
  ∃ m : ℕ, 0 < m ∧
  ∃ E : Superop (Fin w.inputExternal) (Fin m × Inputs w),
  ∃ D : Superop (Fin m × Outputs w) (Fin w.outputExternal),
    IsChannel E ∧ IsChannel D ∧
    ∀ (J : Op (Outputs w × Inputs w)) X,
      taskFromOutputChoi (evaluateOracleSlots C J) X = D (idTensorSuperop (R := Fin m) (taskFromOutputChoi J) (E X))

/-- PDF pp.8–9, Eq. (32): the encoder prepares a normalized resource, before the
input state exists. The decoder gets input,state in that explicit tensor order. -/
def DelayedRealizes {k : ℕ} (w : OracleWireDimensions k) (C : Op (ProcessBasis w)) : Prop :=
  ∃ m : ℕ, 0 < m ∧
  ∃ sigma : Op (Fin m × Inputs w), IsDensityMatrix sigma ∧
  ∃ D : Superop (Fin w.inputExternal × (Fin m × Outputs w)) (Fin w.outputExternal),
    IsChannel D ∧ ∀ (J : Op (Outputs w × Inputs w)) X,
      taskFromOutputChoi (evaluateOracleSlots C J) X =
        D (X ⊗ₖ idTensorSuperop (R := Fin m) (taskFromOutputChoi J) sigma)

/-- PDF p.5, Eq. (11): evaluation of k ordered oracle slots. Each fold entry
contains exactly one oracle application, followed by a fixed channel E_i. -/
def sequentialRun {d k m : ℕ}
    (E : Fin k → Superop (Fin m × Fin d) (Fin m × Fin d))
    (J : Fin k → Op (Fin d × Fin d)) (X : Op (Fin m × Fin d)) :
    Op (Fin m × Fin d) :=
  (List.finRange k).foldl
    (fun Y i => E i (idTensorSuperop (R := Fin m) (taskFromOutputChoi (J i)) Y)) X

/-- PDF p.5, Eq. (11): fixed-order sequential circuit; all memory and channels
are quantified before the independent slot maps. At k=0 the oracle fold is empty. -/
def SequentialRealizes (d k : ℕ) (C : Op (ProcessBasis (uniformWires d k))) : Prop :=
  ∃ m : ℕ, 0 < m ∧
  ∃ E0 : Superop (Fin d) (Fin m × Fin d),
  ∃ E : Fin k → Superop (Fin m × Fin d) (Fin m × Fin d),
  ∃ D : Superop (Fin m × Fin d) (Fin d),
    IsChannel E0 ∧ (∀ i, IsChannel (E i)) ∧ IsChannel D ∧
    ∀ (J : Fin k → Op (Fin d × Fin d)) X,
      taskFromOutputChoi (evaluateOracleSlots C (slotTensor (w := uniformWires d k) J)) X =
        D (sequentialRun E J (E0 X))

/-- PDF pp.4–6: completely CP preserving general process in Choi coordinates.
Positivity is precisely complete CP preservation; normalization is required on
arbitrary independent slot channels, not merely equal unitary slots. Eq. (14)
is deliberately not used. -/
def GeneralDeterministic {k : ℕ} (w : OracleWireDimensions k) (C : Op (ProcessBasis w)) : Prop :=
  PositiveWires w ∧ C.PosSemidef ∧
    ∀ J : (i : Fin k) → Op (Fin (w.outputSlot i) × Fin (w.inputSlot i)),
      (∀ i, ChannelChoi (J i)) → ChannelChoi (evaluateOracleSlots C (slotTensor J))

/-- PDF pp.4–7: the three protocol classes are distinct. -/
inductive ProtocolClass where
  | parallel
  | adaptive
  | general
  deriving DecidableEq

/-- PDF pp.4–7: deterministic physical implementation in the named class.
Sequential means Eq. (11), with k actual oracle calls, never General. -/
def ClassRealizable (c : ProtocolClass) (d k : ℕ)
    (C : Op (ProcessBasis (uniformWires d k))) : Prop :=
  0 < d ∧ C.PosSemidef ∧ match c with
    | .parallel => ParallelRealizes (uniformWires d k) C
    | .adaptive => SequentialRealizes d k C
    | .general => GeneralDeterministic (uniformWires d k) C

/-- PDF pp.5–6: labels for the homogeneous physical wires. -/
inductive WireLabel (k : ℕ) where
  | inputExternal
  | inputSlot (i : Fin k)
  | outputSlot (i : Fin k)
  | outputExternal
  deriving DecidableEq, Fintype

/-- PDF p.5: computational-basis coordinate on a labelled wire. -/
def wireCoordinate {d k : ℕ} (x : ProcessBasis (uniformWires d k)) :
    WireLabel k → Fin d
  | .inputExternal => x.1
  | .inputSlot i => x.2.1 i
  | .outputSlot i => x.2.2.1 i
  | .outputExternal => x.2.2.2

/-- PDF p.5: replace exactly the selected coordinates by coordinates of z. -/
def replaceCoordinates {d k : ℕ} (A : Finset (WireLabel k))
    (x z : ProcessBasis (uniformWires d k)) : ProcessBasis (uniformWires d k) :=
  (if WireLabel.inputExternal ∈ A then z.1 else x.1,
    (fun i => if WireLabel.inputSlot i ∈ A then z.2.1 i else x.2.1 i),
    (fun i => if WireLabel.outputSlot i ∈ A then z.2.2.1 i else x.2.2.1 i),
    if WireLabel.outputExternal ∈ A then z.2.2.2 else x.2.2.2)

/-- PDF pp.5–6: trace-and-replace, R_A C = (Tr_A C) tensor I_A/d_A,
in the ORIGINAL wire order. Summing over a full dummy register duplicates the
unselected coordinates d^(2k+2-|A|) times; the denominator d^(2k+2) cancels
that multiplicity and gives exactly the source's 1/d_A normalization. -/
def traceReplace {d k : ℕ} (A : Finset (WireLabel k))
    (C : Op (ProcessBasis (uniformWires d k))) : Op (ProcessBasis (uniformWires d k)) :=
  fun x y => if ∀ a ∈ A, wireCoordinate x a = wireCoordinate y a then
    ((d : ℂ)^(2*k+2))⁻¹ * ∑ z : ProcessBasis (uniformWires d k),
      C (replaceCoordinates A x z) (replaceCoordinates A y z)
    else 0

/-- PDF p.5: all oracle output wires plus the final external output. -/
def outputWires (k : ℕ) : Finset (WireLabel k) :=
  insert .outputExternal (Finset.univ.image WireLabel.outputSlot)

/-- PDF p.5: all wires except the external input. -/
def futureWires (k : ℕ) : Finset (WireLabel k) :=
  (Finset.univ : Finset (WireLabel k)).erase .inputExternal

/-- PDF p.5, Eq. (10): explicit finite affine parallel normalization equations. -/
def ParallelNormalized (d k : ℕ) (C : Op (ProcessBasis (uniformWires d k))) : Prop :=
  C.PosSemidef ∧
    traceReplace {WireLabel.outputExternal} C = traceReplace (outputWires k) C ∧
    traceReplace (futureWires k) C = traceReplace Finset.univ C ∧
    C.trace = (d : ℂ)^(k+1)

/-- PDF p.5, Eq. (12): wires strictly later than slot i, plus the final output. -/
def laterWires {k : ℕ} (i : Fin k) : Finset (WireLabel k) :=
  insert .outputExternal
    (((Finset.univ.filter (fun j : Fin k => i < j)).image WireLabel.inputSlot) ∪
     ((Finset.univ.filter (fun j : Fin k => i < j)).image WireLabel.outputSlot))

/-- PDF p.5, Eq. (12): finite sequential comb normalization, in fixed slot order.
The recursive partial traces are expressed as trace-and-replace in the full space. -/
def SequentialNormalized (d k : ℕ) (C : Op (ProcessBasis (uniformWires d k))) : Prop :=
  C.PosSemidef ∧
    (∀ i : Fin k, traceReplace (laterWires i) C =
      traceReplace (insert (WireLabel.outputSlot i) (laterWires i)) C) ∧
    traceReplace (futureWires k) C = traceReplace Finset.univ C ∧
    C.trace = (d : ℂ)^(k+1)

/-- PDF pp.4–6: an actual family of independent CPTP slot-channel Choi matrices. -/
abbrev ChannelFamily {k : ℕ} (w : OracleWireDimensions k) :=
  {J : (i : Fin k) → Op (Fin (w.outputSlot i) × Fin (w.inputSlot i)) //
    ∀ i, ChannelChoi (J i)}

/-- PDF pp.5–7: augmented span encodes the affine, rather than homogeneous,
normalization constraints. Its generators are actual independent channel tuples. -/
def channelAffineSpan {k : ℕ} (w : OracleWireDimensions k) :=
  Submodule.span ℝ (Set.range (fun J : ChannelFamily w => (slotTensor J.val, (1 : ℝ))))

/-- PDF pp.5–7: finite exact normalization tests from a basis of the actual
augmented independent-channel span. No assertion about a numerical rank is used. -/
def IsNormalizationBasis {k : ℕ} (w : OracleWireDimensions k) (n : ℕ)
    (B : Fin n → ChannelFamily w) : Prop :=
  LinearIndependent ℝ (fun i => (slotTensor (B i).val, (1 : ℝ))) ∧
    Submodule.span ℝ (Set.range (fun i => (slotTensor (B i).val, (1 : ℝ)))) =
      channelAffineSpan w

/-- PDF pp.4–7: finite general-process normalization on independent slot
channels. Each output partial trace is an affine linear equality in C; C>=0
supplies complete CP preservation. This replaces no printed Eq. (14) by fiat. -/
def GeneralFiniteNormalized {k n : ℕ} (w : OracleWireDimensions k)
    (B : Fin n → ChannelFamily w) (C : Op (ProcessBasis w)) : Prop :=
  C.PosSemidef ∧ ∀ i, ChannelChoi (evaluateOracleSlots C (slotTensor (B i).val))

/-- PDF pp.5–7: the three explicit finite normalization systems. -/
def FiniteClassNormalized {d k n : ℕ} (c : ProtocolClass)
    (B : Fin n → ChannelFamily (uniformWires d k))
    (C : Op (ProcessBasis (uniformWires d k))) : Prop :=
  match c with
  | .parallel => ParallelNormalized d k C
  | .adaptive => SequentialNormalized d k C
  | .general => GeneralFiniteNormalized (uniformWires d k) B C

/-- PDF pp.6–7: both CP branches are retained and normalized jointly. -/
def HeraldedRealizable (c : ProtocolClass) (d k : ℕ)
    (S F : Op (ProcessBasis (uniformWires d k))) : Prop :=
  S.PosSemidef ∧ F.PosSemidef ∧ ClassRealizable c d k (S + F)

/-- PDF pp.9–10: a delayed parallel superinstrument, including its failure branch. -/
def DelayedInstrument {k : ℕ} (w : OracleWireDimensions k)
    (S F : Op (ProcessBasis w)) : Prop :=
  PositiveWires w ∧ S.PosSemidef ∧ F.PosSemidef ∧ DelayedRealizes w (S + F)

/-- PDF pp.6–7: identical uses of the unknown unitary channel. -/
def repeatedChoi {d : ℕ} (k : ℕ) (U : Matrix.unitaryGroup (Fin d) ℂ) :
    Op (Outputs (uniformWires d k) × Inputs (uniformWires d k)) :=
  slotTensor (w := uniformWires d k) (fun _ => gateChoi (U : Op (Fin d)))

/-- PDF pp.7,10,12,18: the unitary task, with channel equality removing global phases. -/
inductive UnitaryTask where
  | identity
  | transpose
  | conjugate
  | inverse
  deriving DecidableEq

/-- PDF pp.7,10,12,18: transpose, entrywise conjugation, and inverse are different. -/
def targetChoi {d : ℕ} (task : UnitaryTask)
    (U : Matrix.unitaryGroup (Fin d) ℂ) : Op (Fin d × Fin d) :=
  match task with
  | .identity => gateChoi (U : Op (Fin d))
  | .transpose => gateChoi ((U : Op (Fin d)).transpose)
  | .conjugate => gateChoi (fun i j => conj ((U : Op (Fin d)) i j))
  | .inverse => gateChoi ((U : Op (Fin d))ᴴ)

/-- PDF pp.6–7: exact success as an equality of unnormalized channel Choi matrices.
This is equality on all inputs, including entangled references, with constant p. -/
def ExactUnitarySuccess {d k : ℕ} (S : Op (ProcessBasis (uniformWires d k)))
    (target : Matrix.unitaryGroup (Fin d) ℂ → Op (Fin d × Fin d)) (p : ℝ) : Prop :=
  ∀ U, evaluateOracleSlots S (repeatedChoi k U) = (p : ℂ) • target U

/-- PDF pp.6–7: a single physical protocol precedes the universal unknown input. -/
def Attainable (c : ProtocolClass) (d k : ℕ)
    (target : Matrix.unitaryGroup (Fin d) ℂ → Op (Fin d × Fin d)) (p : ℝ) : Prop :=
  0 ≤ p ∧ p ≤ 1 ∧ ∃ S F, HeraldedRealizable c d k S F ∧ ExactUnitarySuccess S target p

/-- PDF pp.9,14–16: constant-success delayed-input protocols. -/
def DelayedAttainable (d k : ℕ)
    (target : Matrix.unitaryGroup (Fin d) ℂ → Op (Fin d × Fin d)) (p : ℝ) : Prop :=
  0 ≤ p ∧ p ≤ 1 ∧ ∃ S F,
    DelayedInstrument (uniformWires d k) S F ∧ ExactUnitarySuccess S target p

/-- PDF p.7, Eq. (19): the actual repeated-unitary Choi span, not the ambient space. -/
def unitarySpan (d k : ℕ) :=
  Submodule.span ℂ (Set.range (repeatedChoi (d := d) k))

/-- PDF p.7, Eq. (19): a finite basis consisting of actual unitary operations. -/
def IsUnitaryBasis (d k n : ℕ) (B : Fin n → Matrix.unitaryGroup (Fin d) ℂ) : Prop :=
  LinearIndependent ℂ (fun i => repeatedChoi k (B i)) ∧
    Submodule.span ℂ (Set.range (fun i => repeatedChoi k (B i))) = unitarySpan d k

/-- PDF pp.6–7, footnote 7: Section III assumes a linear channel target. -/
def UnitaryLinearTarget {d : ℕ}
    (f : Op (Fin d × Fin d) →ₗ[ℂ] Op (Fin d × Fin d)) : Prop :=
  ∀ U : Matrix.unitaryGroup (Fin d) ℂ,
    ∃ V : Matrix.unitaryGroup (Fin d) ℂ, f (gateChoi (U : Op (Fin d))) = gateChoi (V : Op (Fin d))

/-- PDF p.7: finitely tested SDP feasibility, with both branches and a physical class. -/
def TestedFeasible {d k n : ℕ} (c : ProtocolClass)
    (f : Op (Fin d × Fin d) →ₗ[ℂ] Op (Fin d × Fin d))
    (B : Fin n → Matrix.unitaryGroup (Fin d) ℂ) (p : ℝ)
    (S F : Op (ProcessBasis (uniformWires d k))) : Prop :=
  0 ≤ p ∧ p ≤ 1 ∧ HeraldedRealizable c d k S F ∧
    ∀ i, evaluateOracleSlots S (repeatedChoi k (B i)) = (p : ℂ) • f (gateChoi (B i : Op (Fin d)))

/-- PDF p.9, Eq. (34): all identities are explicitly placed on I0 and O.
The remaining marginal is on I, with its source normalization preserved. -/
def DelayedNormalized {k : ℕ} (w : OracleWireDimensions k) (C : Op (ProcessBasis w)) : Prop :=
  C.PosSemidef ∧
  (∀ (i j : Fin w.inputExternal) (a b : Inputs w) (u v : Outputs w),
    (∑ o, C (i,a,u,o) (j,b,v,o)) =
      ((1 : Op (Fin w.inputExternal)) i j / (w.inputExternal : ℂ)) *
      (∑ t : Fin w.inputExternal, ∑ z : Outputs w, ∑ o : Fin w.outputExternal,
        C (t,a,z,o) (t,b,z,o)) *
      ((1 : Op (Outputs w)) u v / (Fintype.card (Outputs w) : ℂ))) ∧
  C.trace = ((w.inputExternal * Fintype.card (Outputs w) : ℕ) : ℂ)

/-- PDF p.10, Lemma 1: product of all wire dimensions, including both external wires. -/
def totalDimension {k : ℕ} (w : OracleWireDimensions k) : ℕ :=
  w.inputExternal * w.outputExternal *
    (∏ i, w.inputSlot i) * (∏ i, w.outputSlot i)

/-- PDF pp.12–13: the zero-Bell-outcome Kraus contraction, including the two
normalized maximally entangled amplitudes. Its matrix entries are U_(b,a)/d. -/
def bellZeroKraus {d : ℕ} (U : Op (Fin d)) : Op (Fin d) :=
  fun a b => ∑ x, (if x = b then (d : ℂ)⁻¹ else 0) * U x a

/-- PDF p.14, footnote 14: a storage process has no external input and a
finite memory output; its k oracle slots may use any allowed causal ordering. -/
def storageWires (d k m : ℕ) : OracleWireDimensions k := ⟨1,m,fun _ => d,fun _ => d⟩

/-- PDF pp.14–16: the stored program is the memory state after all oracle uses.
The input to storage is the unique scalar state on the one-dimensional wire. -/
def storedProgram {d k m : ℕ} (C : Op (ProcessBasis (storageWires d k m)))
    (U : Matrix.unitaryGroup (Fin d) ℂ) : Op (Fin m) :=
  let J := slotTensor (w := storageWires d k m) (fun _ => gateChoi (U : Op (Fin d)))
  fun a b => evaluateOracleSlots C J (a, (⟨0, by decide⟩ : Fin 1))
    (b, (⟨0, by decide⟩ : Fin 1))

/-- PDF pp.14–16 and footnote 14: exact probabilistic learning, allowing the
most general storage process before the target input arrives. Its one-dimensional
past and common future are fixed; this introduces no undefined delayed-input
indefinite-order class. Retrieval has no oracle access, and both linear CP
retrieval branches sum to a CPTP channel. Ref. [24] permits parallel storage
without loss for attainable success; Lemma 3 supplies the task equivalence. -/
def LearningAttainable (d k : ℕ) (p : ℝ) : Prop :=
  0 < d ∧ 0 ≤ p ∧ p ≤ 1 ∧
  ∃ m : ℕ, 0 < m ∧ ∃ C : Op (ProcessBasis (storageWires d k m)),
    GeneralDeterministic (storageWires d k m) C ∧
    ∃ DS DF : Op (Fin d × Fin m) →ₗ[ℂ] Op (Fin d),
      (taskOutputChoi DS).PosSemidef ∧ (taskOutputChoi DF).PosSemidef ∧
      IsChannel (fun X => DS X + DF X) ∧
      ∀ (U : Matrix.unitaryGroup (Fin d) ℂ) X,
        DS (X ⊗ₖ storedProgram C U) = (p : ℂ) • conjSuperop (U : Op (Fin d)) X

/-- PDF p.17: coherent control of permutations of k slots. The controlled product
acts on the system and leaves each order label untouched. -/
def switchMatrix {d k : ℕ} (U : Fin k → Op (Fin d)) :
    Op ((Equiv.Perm (Fin k)) × Fin d) :=
  fun a b => if a.1 = b.1 then
    (((List.finRange k).map (fun i => U (a.1 i))).foldl (fun V W => W * V) (1 : Op (Fin d))) a.2 b.2
    else 0

/-- PDF pp.13,16: parallel transposition success; positive denominator when d,k>0. -/
def parallelTransposeProbability (d k : ℕ) : ℝ :=
  1 - ((d : ℝ)^2 - 1) / ((k : ℝ) + (d : ℝ)^2 - 1)

/-- PDF p.17: ceil(k/d) attempts, each successful with probability 1/d^2. -/
def adaptiveTransposeProbability (d k : ℕ) : ℝ :=
  1 - (1 - 1 / (d : ℝ)^2)^((k + d - 1) / d)

/-- PDF pp.18–19: floor((k+1)/d) inversion attempts. -/
def adaptiveInverseProbability (d k : ℕ) : ℝ :=
  1 - (1 - 1 / (d : ℝ)^2)^((k + 1) / d)

/-- PDF p.2: gate Choi trace normalization is d for the identity gate. -/
example (d : ℕ) : (gateChoi (1 : Op (Fin d))).trace = (d : ℂ) := by
  simp [gateChoi, Matrix.trace, Fintype.sum_prod_type, Matrix.one_apply]

/-- PDF p.5: replacing no coordinates leaves the basis tuple unchanged. -/
example {d k : ℕ} (x z : ProcessBasis (uniformWires d k)) :
    replaceCoordinates ∅ x z = x := by
  rcases x with ⟨i,a,u,o⟩
  simp [replaceCoordinates]

/-- PDF p.5: a zero-slot sequential computation is independent of its slot argument. -/
example {d m : ℕ} (E : Fin 0 → Superop (Fin m × Fin d) (Fin m × Fin d))
    (J : Fin 0 → Op (Fin d × Fin d)) (X : Op (Fin m × Fin d)) :
    sequentialRun E J X = X := by
  simp [sequentialRun]

/-- PDF pp.12–13: the contraction has the transpose orientation and factor 1/d. -/
example {d : ℕ} (U : Op (Fin d)) (a b : Fin d) :
    bellZeroKraus U a b = (d : ℂ)⁻¹ * U b a := by
  simp [bellZeroKraus]

/-- PDF p.16: the one-qubit one-use optimum is 1/4. -/
example : parallelTransposeProbability 2 1 = 1/4 := by
  norm_num [parallelTransposeProbability]

/-- PDF p.17: k=3,d=2 gives two transpose attempts; inversion gives two as well. -/
example : adaptiveTransposeProbability 2 3 = 7/16 ∧
    adaptiveInverseProbability 2 3 = 7/16 := by
  norm_num [adaptiveTransposeProbability, adaptiveInverseProbability]

end QAlgorithms.Papers.Independent.Intake100.P12
Source
Probabilistic exact universal quantum circuits for transforming unitary operations, arXiv:1909.01366v2, https://arxiv.org/abs/1909.01366v2
Read-back

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

QAlgorithms.Papers.Independent.Intake100.P12.Attainable

For any protocol class ccc chosen from parallel, adaptive, and general, natural numbers d,kd,kd,k, arbitrary function TTT from d×dd\times dd×d unitary matrices to complex matrices indexed by D×DD\times DD×D, where D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, and real number ppp, this predicate holds exactly under the following conditions. One has 0≤p≤10\le p\le10≤p≤1, and there exist positive semidefinite complex matrices S,FS,FS,F indexed by P=D×A×A×DP=D\times A\times A\times DP=D×A×A×D, where A=D{0,…,k−1}A=D^{\{0,\ldots,k-1\}}A=D{0,…,k−1}, such that d>0d>0d>0, C=S+FC=S+FC=S+F is positive semidefinite, and CCC satisfies the selected realization condition described below. For a matrix JJJ indexed by A×AA\times AA×A, define the external matrix and its associated map by

EC(J)(o,i),(o′,j)=∑x,y,u,v∈AC(i,x,u,o),(j,y,v,o′)J(u,x),(v,y),TJ(X)u,v=∑x,y∈AXx,yJ(u,x),(v,y).\mathcal E_C(J)_{(o,i),(o',j)} =\sum_{x,y,u,v\in A}C_{(i,x,u,o),(j,y,v,o')}J_{(u,x),(v,y)}, \qquad \mathcal T_J(X)_{u,v} =\sum_{x,y\in A}X_{x,y}J_{(u,x),(v,y)}.EC​(J)(o,i),(o′,j)​=x,y,u,v∈A∑​C(i,x,u,o),(j,y,v,o′)​J(u,x),(v,y)​,TJ​(X)u,v​=x,y∈A∑​Xx,y​J(u,x),(v,y)​.

The same convention associates a map to an external matrix indexed by D×DD\times DD×D, and to a single-slot matrix indexed by D×DD\times DD×D. A channel here means a map having a finite Kraus representation X↦∑aKaXKa†X\mapsto\sum_a K_aXK_a^\daggerX↦∑a​Ka​XKa†​ with ∑aKa†Ka=I\sum_aK_a^\dagger K_a=I∑a​Ka†​Ka​=I. For the parallel class, there must exist a positive integer mmm, a channel EEE from matrices on DDD to matrices on {0,…,m−1}×A\{0,\ldots,m-1\}\times A{0,…,m−1}×A, and a channel DpostD_{\mathrm{post}}Dpost​ in the reverse direction, such that, for every complex matrix JJJ on A×AA\times AA×A and every complex matrix XXX on DDD,

TEC(J)(X)=Dpost((id⁡m⊗TJ)(E(X))).\mathcal T_{\mathcal E_C(J)}(X) =D_{\mathrm{post}}\bigl((\operatorname{id}_m\otimes\mathcal T_J)(E(X))\bigr).TEC​(J)​(X)=Dpost​((idm​⊗TJ​)(E(X))).

The tensor extension acts separately on each block indexed by a pair of memory indices. For the adaptive class, there must exist a positive integer mmm, channels EpreE_{\mathrm{pre}}Epre​ from DDD to {0,…,m−1}×D\{0,\ldots,m-1\}\times D{0,…,m−1}×D, EℓE_\ellEℓ​ on that latter system for each 0≤ℓ<k0\le\ell<k0≤ℓ<k, and DpostD_{\mathrm{post}}Dpost​ back to DDD. For every family of arbitrary complex single-slot matrices JℓJ_\ellJℓ​ and every XXX, set Y0=Epre(X)Y_0=E_{\mathrm{pre}}(X)Y0​=Epre​(X) and Yℓ+1=Eℓ((id⁡m⊗TJℓ)(Yℓ))Y_{\ell+1}=E_\ell((\operatorname{id}_m\otimes\mathcal T_{J_\ell})(Y_\ell))Yℓ+1​=Eℓ​((idm​⊗TJℓ​​)(Yℓ​)); the required equality is TEC(Jall)(X)=Dpost(Yk)\mathcal T_{\mathcal E_C(J_{\mathrm{all}})}(X)=D_{\mathrm{post}}(Y_k)TEC​(Jall​)​(X)=Dpost​(Yk​), where

(Jall)(u,x),(v,y)=∏ℓ=0k−1(Jℓ)(uℓ,xℓ),(vℓ,yℓ).(J_{\mathrm{all}})_{(u,x),(v,y)} =\prod_{\ell=0}^{k-1}(J_\ell)_{(u_\ell,x_\ell),(v_\ell,y_\ell)}.(Jall​)(u,x),(v,y)​=ℓ=0∏k−1​(Jℓ​)(uℓ​,xℓ​),(vℓ​,yℓ​)​.

For the general class, for every family JℓJ_\ellJℓ​ of positive semidefinite single-slot matrices satisfying ∑o(Jℓ)(o,a),(o,b)=δab\sum_o(J_\ell)_{(o,a),(o,b)}=\delta_{ab}∑o​(Jℓ​)(o,a),(o,b)​=δab​, the external matrix EC(Jall)\mathcal E_C(J_{\mathrm{all}})EC​(Jall​) must be positive semidefinite and satisfy ∑oEC(Jall)(o,i),(o,j)=δij\sum_o\mathcal E_C(J_{\mathrm{all}})_{(o,i),(o,j)}=\delta_{ij}∑o​EC​(Jall​)(o,i),(o,j)​=δij​. Finally, for every unitary UUU, one requires ES(JU)=pT(U)\mathcal E_S(J_U)=pT(U)ES​(JU​)=pT(U), where (JU)(u,x),(v,y)=∏ℓ=0k−1UuℓxℓUvℓyℓ‾(J_U)_{(u,x),(v,y)}=\prod_{\ell=0}^{k-1}U_{u_\ell x_\ell}\overline{U_{v_\ell y_\ell}}(JU​)(u,x),(v,y)​=∏ℓ=0k−1​Uuℓ​xℓ​​Uvℓ​yℓ​​​. These conditions exclude d=0d=0d=0, allow p=0p=0p=0, and include k=0k=0k=0, when AAA is a singleton, every slot product is 111, and the adaptive recurrence has no iterations.

QAlgorithms.Papers.Independent.Intake100.P12.ChannelFamily

For any natural number kkk and any collection www of natural-number wire dimensions—an external input dimension, an external output dimension, and input and output dimensions for every slot i<ki<ki<k—this is the type of families J=(Ji)i<kJ=(J_i)_{i<k}J=(Ji​)i<k​ of complex matrices, where JiJ_iJi​ is indexed by output–input pairs for slot iii, such that each JiJ_iJi​ is positive semidefinite and

∑o=0wiout−1(Ji)(o,a),(o,b)=δa,bfor every a,b<wiin.\sum_{o=0}^{w_i^{\mathrm{out}}-1} (J_i)_{(o,a),(o,b)}=\delta_{a,b} \quad\text{for every }a,b<w_i^{\mathrm{in}}.o=0∑wiout​−1​(Ji​)(o,a),(o,b)​=δa,b​for every a,b<wiin​.

The external dimensions impose no conditions on this type. Zero dimensions are permitted: a slot with positive input dimension and zero output dimension makes the type empty, whereas a zero input dimension gives a unique empty matrix satisfying its slot conditions. At k=0k=0k=0, there is exactly one empty family.

QAlgorithms.Papers.Independent.Intake100.P12.ClassRealizable

For a value ccc among parallel,adaptive,general\mathrm{parallel},\mathrm{adaptive},\mathrm{general}parallel,adaptive,general, natural numbers d,kd,kd,k, and a complex matrix CCC indexed by Fin⁡(d)×I×I×Fin⁡(d)\operatorname{Fin}(d)\times I\times I\times\operatorname{Fin}(d)Fin(d)×I×I×Fin(d), where I=Fin⁡(d)kI=\operatorname{Fin}(d)^kI=Fin(d)k, this predicate requires d>0d>0d>0, C⪰0C\succeq0C⪰0, and the condition corresponding to ccc below. Define, for any matrix JJJ on I×II\times II×I and matrix XXX on Fin⁡(d)\operatorname{Fin}(d)Fin(d),

[TJ(Y)]u,v=∑x,y∈IYx,yJ(u,x),(v,y),[LC,J(X)]r,s=∑p,q<d∑x,y,u,v∈IXp,qC(p,x,u,r),(q,y,v,s)J(u,x),(v,y).[\mathcal T_J(Y)]_{u,v}=\sum_{x,y\in I}Y_{x,y}J_{(u,x),(v,y)},\qquad [\mathcal L_{C,J}(X)]_{r,s} =\sum_{p,q<d}\sum_{x,y,u,v\in I} X_{p,q}C_{(p,x,u,r),(q,y,v,s)}J_{(u,x),(v,y)}.[TJ​(Y)]u,v​=x,y∈I∑​Yx,y​J(u,x),(v,y)​,[LC,J​(X)]r,s​=p,q<d∑​x,y,u,v∈I∑​Xp,q​C(p,x,u,r),(q,y,v,s)​J(u,x),(v,y)​.

For c=parallelc=\mathrm{parallel}c=parallel, there must exist a positive memory dimension mmm and channels EEE from matrices on Fin⁡(d)\operatorname{Fin}(d)Fin(d) to matrices on Fin⁡(m)×I\operatorname{Fin}(m)\times IFin(m)×I, and DDD from matrices on Fin⁡(m)×I\operatorname{Fin}(m)\times IFin(m)×I to matrices on Fin⁡(d)\operatorname{Fin}(d)Fin(d), such that

LC,J(X)=D((id⁡m⊗TJ)(E(X)))\mathcal L_{C,J}(X) =D\bigl((\operatorname{id}_m\otimes\mathcal T_J)(E(X))\bigr)LC,J​(X)=D((idm​⊗TJ​)(E(X)))

for every arbitrary J,XJ,XJ,X, with the identity acting on memory matrix blocks. For c=adaptivec=\mathrm{adaptive}c=adaptive, there must exist a positive mmm and channels E0:Mat⁡d(C)→Mat⁡md(C)E_0:\operatorname{Mat}_d(\mathbb C)\to\operatorname{Mat}_{md}(\mathbb C)E0​:Matd​(C)→Matmd​(C), Ei:Mat⁡md(C)→Mat⁡md(C)E_i:\operatorname{Mat}_{md}(\mathbb C)\to\operatorname{Mat}_{md}(\mathbb C)Ei​:Matmd​(C)→Matmd​(C) for every i<ki<ki<k, and D:Mat⁡md(C)→Mat⁡d(C)D:\operatorname{Mat}_{md}(\mathbb C)\to\operatorname{Mat}_d(\mathbb C)D:Matmd​(C)→Matd​(C), such that LC,J⊗(X)=D(Yk)\mathcal L_{C,J^\otimes}(X)=D(Y_k)LC,J⊗​(X)=D(Yk​) for all arbitrary matrices X,J0,…,Jk−1X,J_0,\ldots,J_{k-1}X,J0​,…,Jk−1​, where

(J⊗)(u,x),(v,y)=∏i<k(Ji)(ui,xi),(vi,yi),Y0=E0(X),Yi+1=Ei(Zi),(Zi)(α,u),(β,v)=∑x,y<d(Yi)(α,x),(β,y)(Ji)(u,x),(v,y).(J^\otimes)_{(u,x),(v,y)} =\prod_{i<k}(J_i)_{(u_i,x_i),(v_i,y_i)},\quad Y_0=E_0(X),\quad Y_{i+1}=E_i(Z_i),\quad (Z_i)_{(\alpha,u),(\beta,v)} =\sum_{x,y<d}(Y_i)_{(\alpha,x),(\beta,y)}(J_i)_{(u,x),(v,y)}.(J⊗)(u,x),(v,y)​=i<k∏​(Ji​)(ui​,xi​),(vi​,yi​)​,Y0​=E0​(X),Yi+1​=Ei​(Zi​),(Zi​)(α,u),(β,v)​=x,y<d∑​(Yi​)(α,x),(β,y)​(Ji​)(u,x),(v,y)​.

Every channel just mentioned must have a finite Kraus representation Φ(Y)=∑ℓ<hKℓYKℓ†\Phi(Y)=\sum_{\ell<h}K_\ell YK_\ell^\daggerΦ(Y)=∑ℓ<h​Kℓ​YKℓ†​ with ∑ℓ<hKℓ†Kℓ=1\sum_{\ell<h}K_\ell^\dagger K_\ell=1∑ℓ<h​Kℓ†​Kℓ​=1. For c=generalc=\mathrm{general}c=general, every family Ji⪰0J_i\succeq0Ji​⪰0 with ∑u<d(Ji)(u,x),(u,y)=δx,y\sum_{u<d}(J_i)_{(u,x),(u,y)}=\delta_{x,y}∑u<d​(Ji​)(u,x),(u,y)​=δx,y​ must produce a positive semidefinite matrix

H(r,p),(s,q)=∑x,y,u,v∈IC(p,x,u,r),(q,y,v,s)∏i<k(Ji)(ui,xi),(vi,yi)H_{(r,p),(s,q)} =\sum_{x,y,u,v\in I}C_{(p,x,u,r),(q,y,v,s)} \prod_{i<k}(J_i)_{(u_i,x_i),(v_i,y_i)}H(r,p),(s,q)​=x,y,u,v∈I∑​C(p,x,u,r),(q,y,v,s)​i<k∏​(Ji​)(ui​,xi​),(vi​,yi​)​

satisfying ∑r<dH(r,p),(r,q)=δp,q\sum_{r<d}H_{(r,p),(r,q)}=\delta_{p,q}∑r<d​H(r,p),(r,q)​=δp,q​. The definition permits k=0k=0k=0, using singleton tuple index sets and empty products equal to 111; it is false when d=0d=0d=0.

QAlgorithms.Papers.Independent.Intake100.P12.DelayedAttainable

For arbitrary natural numbers d,kd,kd,k, an arbitrary function TTT from d×dd\times dd×d unitary matrices to complex matrices indexed by D×DD\times DD×D, where D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, and a real number ppp, this predicate means that 0≤p≤10\le p\le10≤p≤1 and there exist positive semidefinite matrices S,FS,FS,F on P=D×A×A×DP=D\times A\times A\times DP=D×A×A×D, with A=D{0,…,k−1}A=D^{\{0,\ldots,k-1\}}A=D{0,…,k−1}, satisfying the following requirements. The external input and output dimensions and every slot input and output dimension are positive, which here requires d>0d>0d>0. There exist a positive integer mmm, a positive semidefinite matrix σ\sigmaσ of trace 111 on {0,…,m−1}×A\{0,\ldots,m-1\}\times A{0,…,m−1}×A, and a channel DpostD_{\mathrm{post}}Dpost​ from matrices on D×({0,…,m−1}×A)D\times(\{0,\ldots,m-1\}\times A)D×({0,…,m−1}×A) to matrices on DDD. A channel means a map Y↦∑aKaYKa†Y\mapsto\sum_aK_aYK_a^\daggerY↦∑a​Ka​YKa†​ for some finite family with ∑aKa†Ka=I\sum_aK_a^\dagger K_a=I∑a​Ka†​Ka​=I. Define

EC(J)(o,i),(o′,j)=∑x,y,u,v∈AC(i,x,u,o),(j,y,v,o′)J(u,x),(v,y),TJ(X)u,v=∑x,y∈AXx,yJ(u,x),(v,y),\mathcal E_C(J)_{(o,i),(o',j)} =\sum_{x,y,u,v\in A}C_{(i,x,u,o),(j,y,v,o')}J_{(u,x),(v,y)}, \qquad \mathcal T_J(X)_{u,v} =\sum_{x,y\in A}X_{x,y}J_{(u,x),(v,y)},EC​(J)(o,i),(o′,j)​=x,y,u,v∈A∑​C(i,x,u,o),(j,y,v,o′)​J(u,x),(v,y)​,TJ​(X)u,v​=x,y∈A∑​Xx,y​J(u,x),(v,y)​,

using the analogous formula for the map associated to an external matrix on D×DD\times DD×D. For every arbitrary complex matrix JJJ on A×AA\times AA×A and every arbitrary complex matrix XXX on DDD, one requires

TES+F(J)(X)=Dpost ⁣(X⊗(id⁡m⊗TJ)(σ)),\mathcal T_{\mathcal E_{S+F}(J)}(X) = D_{\mathrm{post}}\!\left( X\otimes(\operatorname{id}_m\otimes\mathcal T_J)(\sigma) \right),TES+F​(J)​(X)=Dpost​(X⊗(idm​⊗TJ​)(σ)),

where the tensor extension applies TJ\mathcal T_JTJ​ separately to each memory-indexed block. In addition, for every d×dd\times dd×d unitary matrix UUU, one requires ES(JU)=pT(U)\mathcal E_S(J_U)=pT(U)ES​(JU​)=pT(U), with

(JU)(u,x),(v,y)=∏ℓ=0k−1UuℓxℓUvℓyℓ‾.(J_U)_{(u,x),(v,y)} =\prod_{\ell=0}^{k-1}U_{u_\ell x_\ell}\overline{U_{v_\ell y_\ell}}.(JU​)(u,x),(v,y)​=ℓ=0∏k−1​Uuℓ​xℓ​​Uvℓ​yℓ​​​.

The value p=0p=0p=0 is permitted. The case k=0k=0k=0 is included: AAA is then a singleton and the product defining JUJ_UJU​ is 111.

QAlgorithms.Papers.Independent.Intake100.P12.DelayedInstrument

For any natural number kkk, any wire dimensions www, and complex matrices S,FS,FS,F indexed by (r,a,u,o)(r,a,u,o)(r,a,u,o), with external input r<wext,inr<w^{\mathrm{ext,in}}r<wext,in, external output o<wext,outo<w^{\mathrm{ext,out}}o<wext,out, slot-input tuple a∈I=∏i<k{0,…,wiin−1}a\in\mathcal I=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{in}}-1\}a∈I=∏i<k​{0,…,wiin​−1}, and slot-output tuple u∈O=∏i<k{0,…,wiout−1}u\in\mathcal O=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{out}}-1\}u∈O=∏i<k​{0,…,wiout​−1}, this predicate requires all external and slot dimensions to be strictly positive and requires S,FS,FS,F positive semidefinite. Writing C=S+FC=S+FC=S+F, there must exist a positive integer mmm, a positive semidefinite matrix σ\sigmaσ of trace 111 on {0,…,m−1}×I\{0,\ldots,m-1\}\times\mathcal I{0,…,m−1}×I, and a channel D\mathcal DD from the external input together with {0,…,m−1}×O\{0,\ldots,m-1\}\times\mathcal O{0,…,m−1}×O to the external output, such that for every arbitrary complex matrix JJJ on O×I\mathcal O\times\mathcal IO×I and every arbitrary external input matrix XXX,

ΦC,J(X)=D ⁣(X⊗(id⁡m⊗ΦJ)(σ)),\Phi_{C,J}(X)= \mathcal D\!\left(X\otimes (\operatorname{id}_m\otimes\Phi_J)(\sigma)\right),ΦC,J​(X)=D(X⊗(idm​⊗ΦJ​)(σ)),

where

ΦJ(Y)u,v=∑a,b∈IYa,bJ(u,a),(v,b),ΦC,J(X)o,o′=∑r,r′∑a,b∈I∑u,v∈OXr,r′C(r,a,u,o),(r′,b,v,o′)J(u,a),(v,b).\Phi_J(Y)_{u,v}=\sum_{a,b\in\mathcal I}Y_{a,b}J_{(u,a),(v,b)}, \qquad \Phi_{C,J}(X)_{o,o'}= \sum_{r,r'}\sum_{a,b\in\mathcal I}\sum_{u,v\in\mathcal O} X_{r,r'}C_{(r,a,u,o),(r',b,v,o')}J_{(u,a),(v,b)}.ΦJ​(Y)u,v​=a,b∈I∑​Ya,b​J(u,a),(v,b)​,ΦC,J​(X)o,o′​=r,r′∑​a,b∈I∑​u,v∈O∑​Xr,r′​C(r,a,u,o),(r′,b,v,o′)​J(u,a),(v,b)​.

The memory extension applies ΦJ\Phi_JΦJ​ to each matrix block with fixed memory row and column indices. Being a channel means that D(Y)=∑ℓ<qKℓYKℓ†\mathcal D(Y)=\sum_{\ell<q}K_\ell YK_\ell^\daggerD(Y)=∑ℓ<q​Kℓ​YKℓ†​ for some natural number qqq and matrices satisfying ∑ℓ<qKℓ†Kℓ=I\sum_{\ell<q}K_\ell^\dagger K_\ell=I∑ℓ<q​Kℓ†​Kℓ​=I. The case k=0k=0k=0 is included, in which both tuple sets are singletons.

QAlgorithms.Papers.Independent.Intake100.P12.DelayedNormalized

For a natural number kkk, choose natural-number external dimensions r,tr,tr,t and slot dimensions aℓ,bℓa_\ell,b_\ellaℓ​,bℓ​ for 0≤ℓ<k0\le\ell<k0≤ℓ<k; these are respectively the external input, external output, slot input, and slot output fields of www. Put A=∏ℓ<k{0,…,aℓ−1}\mathcal A=\prod_{\ell<k}\{0,\ldots,a_\ell-1\}A=∏ℓ<k​{0,…,aℓ​−1}, B=∏ℓ<k{0,…,bℓ−1}\mathcal B=\prod_{\ell<k}\{0,\ldots,b_\ell-1\}B=∏ℓ<k​{0,…,bℓ​−1}, and q=∣B∣=∏ℓ<kbℓq=|\mathcal B|=\prod_{\ell<k}b_\ellq=∣B∣=∏ℓ<k​bℓ​. For a complex matrix CCC indexed by {0,…,r−1}×A×B×{0,…,t−1}\{0,\ldots,r-1\}\times\mathcal A\times\mathcal B\times\{0,\ldots,t-1\}{0,…,r−1}×A×B×{0,…,t−1}, the predicate means that CCC is positive semidefinite, its complex trace is rqrqrq, and, for every i,j<ri,j<ri,j<r, a,b∈Aa,b\in\mathcal Aa,b∈A, and u,v∈Bu,v\in\mathcal Bu,v∈B,

∑o=0t−1C(i,a,u,o),(j,b,v,o)=δijr(∑h=0r−1∑z∈B∑o=0t−1C(h,a,z,o),(h,b,z,o))δuvq.\sum_{o=0}^{t-1}C_{(i,a,u,o),(j,b,v,o)} = \frac{\delta_{ij}}{r} \left( \sum_{h=0}^{r-1}\sum_{z\in\mathcal B}\sum_{o=0}^{t-1} C_{(h,a,z,o),(h,b,z,o)} \right) \frac{\delta_{uv}}{q}.o=0∑t−1​C(i,a,u,o),(j,b,v,o)​=rδij​​(h=0∑r−1​z∈B∑​o=0∑t−1​C(h,a,z,o),(h,b,z,o)​)qδuv​​.

All scalars in this equality are interpreted in C\mathbb CC. No dimension is required to be positive. Division uses 0−1=00^{-1}=00−1=0, sums over empty index sets are zero, and when k=0k=0k=0 both product index sets are singletons and q=1q=1q=1. If the full matrix index set is empty, its trace is zero, so the trace requirement can hold only if rq=0rq=0rq=0.

QAlgorithms.Papers.Independent.Intake100.P12.DelayedRealizes

For any natural number kkk, let www specify natural dimensions a,ba,ba,b for the external input and output and dimensions ai,bia_i,b_iai​,bi​ for each slot i<ki<ki<k. Write I=∏i<kFin⁡(ai)I=\prod_{i<k}\operatorname{Fin}(a_i)I=∏i<k​Fin(ai​), O=∏i<kFin⁡(bi)O=\prod_{i<k}\operatorname{Fin}(b_i)O=∏i<k​Fin(bi​), and let CCC be a complex matrix indexed by Fin⁡(a)×I×O×Fin⁡(b)\operatorname{Fin}(a)\times I\times O\times\operatorname{Fin}(b)Fin(a)×I×O×Fin(b). This predicate holds exactly when there exist a positive natural number mmm, a positive semidefinite matrix σ\sigmaσ of trace 111 on Fin⁡(m)×I\operatorname{Fin}(m)\times IFin(m)×I, and a channel DDD from matrices on Fin⁡(a)×(Fin⁡(m)×O)\operatorname{Fin}(a)\times(\operatorname{Fin}(m)\times O)Fin(a)×(Fin(m)×O) to matrices on Fin⁡(b)\operatorname{Fin}(b)Fin(b), such that, for every complex matrix JJJ on O×IO\times IO×I and every complex matrix XXX on Fin⁡(a)\operatorname{Fin}(a)Fin(a),

LC,J(X)=D ⁣(X⊗(id⁡m⊗TJ)(σ)),\mathcal L_{C,J}(X) =D\!\left(X\otimes(\operatorname{id}_m\otimes\mathcal T_J)(\sigma)\right),LC,J​(X)=D(X⊗(idm​⊗TJ​)(σ)),

where

[TJ(Y)]u,v=∑x,y∈IYx,yJ(u,x),(v,y),[LC,J(X)]r,s=∑p,q∈Fin⁡(a)∑x,y∈I∑u,v∈OXp,qC(p,x,u,r),(q,y,v,s)J(u,x),(v,y).[\mathcal T_J(Y)]_{u,v}=\sum_{x,y\in I}Y_{x,y}J_{(u,x),(v,y)},\qquad [\mathcal L_{C,J}(X)]_{r,s} =\sum_{p,q\in\operatorname{Fin}(a)}\sum_{x,y\in I}\sum_{u,v\in O} X_{p,q}C_{(p,x,u,r),(q,y,v,s)}J_{(u,x),(v,y)}.[TJ​(Y)]u,v​=x,y∈I∑​Yx,y​J(u,x),(v,y)​,[LC,J​(X)]r,s​=p,q∈Fin(a)∑​x,y∈I∑​u,v∈O∑​Xp,q​C(p,x,u,r),(q,y,v,s)​J(u,x),(v,y)​.

Here id⁡m⊗TJ\operatorname{id}_m\otimes\mathcal T_Jidm​⊗TJ​ applies TJ\mathcal T_JTJ​ separately to each matrix block indexed by the memory coordinates, and “channel” means that D(Y)=∑ℓ<hKℓYKℓ†D(Y)=\sum_{\ell<h}K_\ell YK_\ell^\daggerD(Y)=∑ℓ<h​Kℓ​YKℓ†​ for some natural number hhh and matrices satisfying ∑ℓ<hKℓ†Kℓ=1\sum_{\ell<h}K_\ell^\dagger K_\ell=1∑ℓ<h​Kℓ†​Kℓ​=1. The equality is required for arbitrary J,XJ,XJ,X, without positivity or normalization restrictions. No positivity assumption on the dimensions in www, or on CCC, is separately imposed; k=0k=0k=0 is allowed, with empty products of index sets interpreted as singleton sets.

QAlgorithms.Papers.Independent.Intake100.P12.ExactUnitarySuccess

For arbitrary natural numbers d,kd,kd,k, put D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, A=D{0,…,k−1}A=D^{\{0,\ldots,k-1\}}A=D{0,…,k−1}, and P=D×A×A×DP=D\times A\times A\times DP=D×A×A×D. Given a complex matrix SSS indexed by PPP, an arbitrary function TTT assigning a complex matrix indexed by D×DD\times DD×D to each d×dd\times dd×d unitary matrix, and a real number ppp, this predicate holds exactly when, for every such unitary UUU, the following equality of matrices holds:

∑x,y,u,v∈AS(i,x,u,o),(j,y,v,o′)∏ℓ=0k−1UuℓxℓUvℓyℓ‾=p T(U)(o,i),(o′,j)(i,j,o,o′∈D).\sum_{x,y,u,v\in A} S_{(i,x,u,o),(j,y,v,o')} \prod_{\ell=0}^{k-1} U_{u_\ell x_\ell}\overline{U_{v_\ell y_\ell}} = p\,T(U)_{(o,i),(o',j)} \qquad(i,j,o,o'\in D).x,y,u,v∈A∑​S(i,x,u,o),(j,y,v,o′)​ℓ=0∏k−1​Uuℓ​xℓ​​Uvℓ​yℓ​​​=pT(U)(o,i),(o′,j)​(i,j,o,o′∈D).

Here ppp acts as a complex scalar. The predicate imposes no positivity or normalization condition on SSS or T(U)T(U)T(U), and no restriction on ppp. When k=0k=0k=0, AAA is a singleton and the product is 111, so the left side contains no dependence on UUU. When d=0d=0d=0, both sides are matrices with empty index sets, so the predicate holds for every real ppp.

QAlgorithms.Papers.Independent.Intake100.P12.FiniteClassNormalized

For natural numbers d,k,nd,k,nd,k,n, a choice ccc among the three labels parallel, adaptive, and general, a collection B=(Bt)t<nB=(B_t)_{t<n}B=(Bt​)t<n​ of kkk-slot families with all input and output dimensions equal to ddd, and a complex matrix CCC indexed by configurations (r,a,u,o)∈D×Dk×Dk×D(r,a,u,o)\in D\times D^k\times D^k\times D(r,a,u,o)∈D×Dk×Dk×D, where D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, every Bt,iB_{t,i}Bt,i​ is positive semidefinite and satisfies ∑s(Bt,i)(s,ai),(s,bi)=δai,bi\sum_s(B_{t,i})_{(s,a_i),(s,b_i)}=\delta_{a_i,b_i}∑s​(Bt,i​)(s,ai​),(s,bi​)​=δai​,bi​​. For a set AAA of the 2k+22k+22k+2 wire labels, define (TAC)x,y(\mathcal T_A C)_{x,y}(TA​C)x,y​ to be (d2k+2)−1∑zCx[A←z],y[A←z](d^{2k+2})^{-1}\sum_z C_{x[A\leftarrow z],y[A\leftarrow z]}(d2k+2)−1∑z​Cx[A←z],y[A←z]​ if x,yx,yx,y agree on every selected coordinate, and 000 otherwise; here zzz ranges over all configurations. Let OOO contain the external output and every slot output, let VVV contain every label except the external input, let WWW contain all labels, and let LiL_iLi​ contain the external output and both wires of every slot j>ij>ij>i. For the parallel label, the predicate requires CCC positive semidefinite, T{external output}C=TOC\mathcal T_{\{\mathrm{external\ output}\}}C=\mathcal T_O CT{external output}​C=TO​C, TVC=TWC\mathcal T_V C=\mathcal T_W CTV​C=TW​C, and tr⁡C=dk+1\operatorname{tr}C=d^{k+1}trC=dk+1. For the adaptive label, it requires CCC positive semidefinite, TLiC=TLi∪{slot output i}C\mathcal T_{L_i}C=\mathcal T_{L_i\cup\{\mathrm{slot\ output}\ i\}}CTLi​​C=TLi​∪{slot output i}​C for every i<ki<ki<k, TVC=TWC\mathcal T_V C=\mathcal T_W CTV​C=TW​C, and the same trace equality. For the general label, it requires CCC positive semidefinite and, for every t<nt<nt<n, the matrix

(Ht)(o,r),(o′,r′)=∑a,b,u,v∈DkC(r,a,u,o),(r′,b,v,o′)∏i<k(Bt,i)(ui,ai),(vi,bi)(H_t)_{(o,r),(o',r')}= \sum_{a,b,u,v\in D^k} C_{(r,a,u,o),(r',b,v,o')} \prod_{i<k}(B_{t,i})_{(u_i,a_i),(v_i,b_i)}(Ht​)(o,r),(o′,r′)​=a,b,u,v∈Dk∑​C(r,a,u,o),(r′,b,v,o′)​i<k∏​(Bt,i​)(ui​,ai​),(vi​,bi​)​

to be positive semidefinite with ∑o(Ht)(o,r),(o,r′)=δr,r′\sum_o(H_t)_{(o,r),(o,r')}=\delta_{r,r'}∑o​(Ht​)(o,r),(o,r′)​=δr,r′​. There is no independence or spanning requirement on BBB; its values do not enter the parallel or adaptive conditions. At k=0k=0k=0, the slot-indexed conditions are vacuous and products equal 111; at n=0n=0n=0, the general condition requires only CCC positive semidefinite. The value d=0d=0d=0 is allowed.

QAlgorithms.Papers.Independent.Intake100.P12.GeneralDeterministic

For any natural number kkk, dimensions w=(a,b,(ai),(bi))w=(a,b,(a_i),(b_i))w=(a,b,(ai​),(bi​)), and complex matrix CCC indexed by Fin⁡(a)×I×O×Fin⁡(b)\operatorname{Fin}(a)\times I\times O\times\operatorname{Fin}(b)Fin(a)×I×O×Fin(b), where I=∏i<kFin⁡(ai)I=\prod_{i<k}\operatorname{Fin}(a_i)I=∏i<k​Fin(ai​) and O=∏i<kFin⁡(bi)O=\prod_{i<k}\operatorname{Fin}(b_i)O=∏i<k​Fin(bi​), this predicate requires a,b,ai,bi>0a,b,a_i,b_i>0a,b,ai​,bi​>0 for every i<ki<ki<k, requires CCC to be positive semidefinite, and requires the following for every family JiJ_iJi​ of positive semidefinite matrices on Fin⁡(bi)×Fin⁡(ai)\operatorname{Fin}(b_i)\times\operatorname{Fin}(a_i)Fin(bi​)×Fin(ai​) satisfying

∑u<bi(Ji)(u,x),(u,y)=δx,y.\sum_{u<b_i}(J_i)_{(u,x),(u,y)}=\delta_{x,y}.u<bi​∑​(Ji​)(u,x),(u,y)​=δx,y​.

The matrix HHH on Fin⁡(b)×Fin⁡(a)\operatorname{Fin}(b)\times\operatorname{Fin}(a)Fin(b)×Fin(a) defined by

H(r,p),(s,q)=∑x,y∈I∑u,v∈OC(p,x,u,r),(q,y,v,s)∏i<k(Ji)(ui,xi),(vi,yi)H_{(r,p),(s,q)} =\sum_{x,y\in I}\sum_{u,v\in O} C_{(p,x,u,r),(q,y,v,s)} \prod_{i<k}(J_i)_{(u_i,x_i),(v_i,y_i)}H(r,p),(s,q)​=x,y∈I∑​u,v∈O∑​C(p,x,u,r),(q,y,v,s)​i<k∏​(Ji​)(ui​,xi​),(vi​,yi​)​

must be positive semidefinite and satisfy ∑r<bH(r,p),(r,q)=δp,q\sum_{r<b}H_{(r,p),(r,q)}=\delta_{p,q}∑r<b​H(r,p),(r,q)​=δp,q​. Here δ\deltaδ is the Kronecker delta. The case k=0k=0k=0 is included: the slot index sets are singletons and the empty product is 111. If any required dimension is zero, the predicate is false.

QAlgorithms.Papers.Independent.Intake100.P12.GeneralFiniteNormalized

For any natural numbers k,nk,nk,n, any wire dimensions www, any collection B=(Bt)t<nB=(B_t)_{t<n}B=(Bt​)t<n​ of slot families, and any complex matrix CCC indexed by (r,a,u,o)(r,a,u,o)(r,a,u,o), where r<wext,inr<w^{\mathrm{ext,in}}r<wext,in, o<wext,outo<w^{\mathrm{ext,out}}o<wext,out, a∈I=∏i<k{0,…,wiin−1}a\in\mathcal I=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{in}}-1\}a∈I=∏i<k​{0,…,wiin​−1}, and u∈O=∏i<k{0,…,wiout−1}u\in\mathcal O=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{out}}-1\}u∈O=∏i<k​{0,…,wiout​−1}, each slot matrix Bt,iB_{t,i}Bt,i​ is, by its prescribed type, positive semidefinite with ∑s(Bt,i)(s,ai),(s,bi)=δai,bi\sum_s(B_{t,i})_{(s,a_i),(s,b_i)}=\delta_{a_i,b_i}∑s​(Bt,i​)(s,ai​),(s,bi​)​=δai​,bi​​. Define

(Ht)(o,r),(o′,r′)=∑a,b∈I∑u,v∈OC(r,a,u,o),(r′,b,v,o′)∏i<k(Bt,i)(ui,ai),(vi,bi).(H_t)_{(o,r),(o',r')}= \sum_{a,b\in\mathcal I}\sum_{u,v\in\mathcal O} C_{(r,a,u,o),(r',b,v,o')} \prod_{i<k}(B_{t,i})_{(u_i,a_i),(v_i,b_i)}.(Ht​)(o,r),(o′,r′)​=a,b∈I∑​u,v∈O∑​C(r,a,u,o),(r′,b,v,o′)​i<k∏​(Bt,i​)(ui​,ai​),(vi​,bi​)​.

The predicate says precisely that CCC is positive semidefinite and, for every t<nt<nt<n, HtH_tHt​ is positive semidefinite and ∑o(Ht)(o,r),(o,r′)=δr,r′\sum_o(H_t)_{(o,r),(o,r')}=\delta_{r,r'}∑o​(Ht​)(o,r),(o,r′)​=δr,r′​. The collection BBB is not required to satisfy any independence or spanning condition. Zero dimensions and k=0k=0k=0 are permitted, with empty products equal to 111; when n=0n=0n=0, the predicate reduces to positive semidefiniteness of CCC.

QAlgorithms.Papers.Independent.Intake100.P12.HeraldedRealizable

For a label ccc among parallel, adaptive, and general, natural numbers d,kd,kd,k, and complex matrices S,FS,FS,F on configurations (r,a,u,o)∈D×Dk×Dk×D(r,a,u,o)\in D\times D^k\times D^k\times D(r,a,u,o)∈D×Dk×Dk×D, where D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, the predicate requires S,FS,FS,F positive semidefinite and requires the following conditions on C=S+FC=S+FC=S+F: d>0d>0d>0, CCC positive semidefinite, and the condition selected by ccc below. For any complex matrix JJJ on Dk×DkD^k\times D^kDk×Dk, define

HC(J)(o,r),(o′,r′)=∑a,b,u,v∈DkC(r,a,u,o),(r′,b,v,o′)J(u,a),(v,b),ΦC,J(X)o,o′=∑r,r′∈DXr,r′HC(J)(o,r),(o′,r′).H_C(J)_{(o,r),(o',r')}= \sum_{a,b,u,v\in D^k} C_{(r,a,u,o),(r',b,v,o')}J_{(u,a),(v,b)}, \qquad \Phi_{C,J}(X)_{o,o'}= \sum_{r,r'\in D}X_{r,r'}H_C(J)_{(o,r),(o',r')}.HC​(J)(o,r),(o′,r′)​=a,b,u,v∈Dk∑​C(r,a,u,o),(r′,b,v,o′)​J(u,a),(v,b)​,ΦC,J​(X)o,o′​=r,r′∈D∑​Xr,r′​HC​(J)(o,r),(o′,r′)​.

For any matrix JJJ on an output–input product, write ΦJ(X)u,v=∑a,bXa,bJ(u,a),(v,b)\Phi_J(X)_{u,v}=\sum_{a,b}X_{a,b}J_{(u,a),(v,b)}ΦJ​(X)u,v​=∑a,b​Xa,b​J(u,a),(v,b)​; extending a map Φ\PhiΦ by a memory set HHH means applying Φ\PhiΦ separately to each block Y(h,⋅),(h′,⋅)Y_{(h,\cdot),(h',\cdot)}Y(h,⋅),(h′,⋅)​. Every channel mentioned here means a map of the form X↦∑ℓ<qKℓXKℓ†X\mapsto\sum_{\ell<q}K_\ell X K_\ell^\daggerX↦∑ℓ<q​Kℓ​XKℓ†​, for some natural number qqq, with ∑ℓ<qKℓ†Kℓ=I\sum_{\ell<q}K_\ell^\dagger K_\ell=I∑ℓ<q​Kℓ†​Kℓ​=I. For the parallel label, there must exist a positive integer mmm, a channel E\mathcal EE from DDD to {0,…,m−1}×Dk\{0,\ldots,m-1\}\times D^k{0,…,m−1}×Dk, and a channel D\mathcal DD from {0,…,m−1}×Dk\{0,\ldots,m-1\}\times D^k{0,…,m−1}×Dk to DDD, such that, for every complex matrix JJJ on Dk×DkD^k\times D^kDk×Dk and every complex input matrix XXX,

ΦC,J(X)=D ⁣((id⁡m⊗ΦJ)(E(X))).\Phi_{C,J}(X)= \mathcal D\!\left((\operatorname{id}_m\otimes\Phi_J)(\mathcal E(X))\right).ΦC,J​(X)=D((idm​⊗ΦJ​)(E(X))).

For the adaptive label, there must exist a positive integer mmm, a channel E0\mathcal E_0E0​ from DDD to {0,…,m−1}×D\{0,\ldots,m-1\}\times D{0,…,m−1}×D, channels Ei\mathcal E_iEi​ on that latter space for every i<ki<ki<k, and a channel D\mathcal DD back to DDD, such that, for every family of arbitrary complex matrices JiJ_iJi​ on D×DD\times DD×D and every XXX, setting Y0=E0(X)Y_0=\mathcal E_0(X)Y0​=E0​(X), Yi+1=Ei((id⁡m⊗ΦJi)(Yi))Y_{i+1}=\mathcal E_i((\operatorname{id}_m\otimes\Phi_{J_i})(Y_i))Yi+1​=Ei​((idm​⊗ΦJi​​)(Yi​)), and J^(u,a),(v,b)=∏i<k(Ji)(ui,ai),(vi,bi)\widehat J_{(u,a),(v,b)}=\prod_{i<k}(J_i)_{(u_i,a_i),(v_i,b_i)}J(u,a),(v,b)​=∏i<k​(Ji​)(ui​,ai​),(vi​,bi​)​ gives ΦC,J^(X)=D(Yk)\Phi_{C,\widehat J}(X)=\mathcal D(Y_k)ΦC,J​(X)=D(Yk​). For the general label, every family of positive semidefinite JiJ_iJi​ satisfying ∑s(Ji)(s,ai),(s,bi)=δai,bi\sum_s(J_i)_{(s,a_i),(s,b_i)}=\delta_{a_i,b_i}∑s​(Ji​)(s,ai​),(s,bi​)​=δai​,bi​​ must give a positive semidefinite HC(J^)H_C(\widehat J)HC​(J) satisfying ∑oHC(J^)(o,r),(o,r′)=δr,r′\sum_oH_C(\widehat J)_{(o,r),(o,r')}=\delta_{r,r'}∑o​HC​(J)(o,r),(o,r′)​=δr,r′​. The value k=0k=0k=0 is included, with empty products equal to 111 and no sequential updates; d=0d=0d=0 cannot satisfy the predicate.

QAlgorithms.Papers.Independent.Intake100.P12.Inputs

For every natural number kkk and every wire-dimension record www whose slot input dimensions are aia_iai​, this abbreviates the configuration type

Aw=∏i=0k−1{0,…,ai−1}.\mathcal A_w=\prod_{i=0}^{k-1}\{0,\ldots,a_i-1\}.Aw​=i=0∏k−1​{0,…,ai​−1}.

Thus an element chooses one valid input index for each slot. For k=0k=0k=0, there is exactly one configuration, the empty assignment; if any slot input dimension is zero, there are no configurations. The other fields of www do not affect this type.

QAlgorithms.Papers.Independent.Intake100.P12.IsNormalizationBasis

For any natural numbers k,nk,nk,n, any wire dimensions www, and any indexed collection B=(Bt)t<nB=(B_t)_{t<n}B=(Bt​)t<n​ of slot families, assume as part of the type of each BtB_tBt​ that every slot matrix Bt,iB_{t,i}Bt,i​ is positive semidefinite and satisfies ∑o(Bt,i)(o,a),(o,b)=δa,b\sum_o(B_{t,i})_{(o,a),(o,b)}=\delta_{a,b}∑o​(Bt,i​)(o,a),(o,b)​=δa,b​. Write I=∏i<k{0,…,wiin−1}\mathcal I=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{in}}-1\}I=∏i<k​{0,…,wiin​−1}, O=∏i<k{0,…,wiout−1}\mathcal O=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{out}}-1\}O=∏i<k​{0,…,wiout​−1}, and

(B^t)(u,a),(v,b)=∏i<k(Bt,i)(ui,ai),(vi,bi).(\widehat B_t)_{(u,a),(v,b)} =\prod_{i<k}(B_{t,i})_{(u_i,a_i),(v_i,b_i)}.(Bt​)(u,a),(v,b)​=i<k∏​(Bt,i​)(ui​,ai​),(vi​,bi​)​.

The predicate says that the pairs (B^t,1)(\widehat B_t,1)(Bt​,1), regarded as vectors over R\mathbb RR in Mat⁡O×I(C)×R\operatorname{Mat}_{\mathcal O\times\mathcal I}(\mathbb C)\times\mathbb RMatO×I​(C)×R, are linearly independent and that their real linear span equals the real linear span of all pairs (J^,1)(\widehat J,1)(J,1) obtained from all slot families JJJ satisfying the same positivity and partial-trace conditions. No positivity of the dimensions or of nnn is assumed, and the external dimensions impose no conditions. When n=0n=0n=0, linear independence is vacuous, and the span equality holds exactly when there are no admissible slot families.

QAlgorithms.Papers.Independent.Intake100.P12.IsUnitaryBasis

For natural numbers d,k,nd,k,nd,k,n and an indexed family B0,…,Bn−1B_0,\ldots,B_{n-1}B0​,…,Bn−1​ of complex d×dd\times dd×d unitary matrices, put D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, A=D{0,…,k−1}A=D^{\{0,\ldots,k-1\}}A=D{0,…,k−1}, and define, for every unitary UUU, the matrix

(JU)(u,x),(v,y)=∏ℓ=0k−1UuℓxℓUvℓyℓ‾.(J_U)_{(u,x),(v,y)} =\prod_{\ell=0}^{k-1}U_{u_\ell x_\ell}\overline{U_{v_\ell y_\ell}}.(JU​)(u,x),(v,y)​=ℓ=0∏k−1​Uuℓ​xℓ​​Uvℓ​yℓ​​​.

The predicate means that the matrices JBiJ_{B_i}JBi​​, indexed by 0≤i<n0\le i<n0≤i<n, are linearly independent over C\mathbb CC, and that their complex linear span equals the complex linear span of all JUJ_UJU​ as UUU ranges over every d×dd\times dd×d unitary matrix. All three natural-number parameters may be zero. In particular, an empty indexed family is allowed, but satisfies the predicate only when the latter span is zero; when k=0k=0k=0, every JUJ_UJU​ is the scalar matrix 111, and the predicate requires n=1n=1n=1.

QAlgorithms.Papers.Independent.Intake100.P12.LearningAttainable

For natural numbers d,kd,kd,k and a real number ppp, this predicate says that d>0d>0d>0, 0≤p≤10\le p\le10≤p≤1, and there exist a positive natural number mmm, a positive semidefinite complex matrix CCC indexed by (0,x,u,a)(0,x,u,a)(0,x,u,a) with x,u∈[d]kx,u\in[d]^kx,u∈[d]k and a∈[m]a\in[m]a∈[m], and complex-linear maps DS,DF:Mdm(C)→Md(C)D_S,D_F:M_{dm}(\mathbb C)\to M_d(\mathbb C)DS​,DF​:Mdm​(C)→Md​(C), satisfying the following conditions. For every family of positive semidefinite matrices JiJ_iJi​ indexed by [d]×[d][d]\times[d][d]×[d] such that

∑u∈[d](Ji)(u,x),(u,y)=δxy,\sum_{u\in[d]}(J_i)_{(u,x),(u,y)}=\delta_{xy},u∈[d]∑​(Ji​)(u,x),(u,y)​=δxy​,

the matrix

σC(J)ab=∑x,y,u,v∈[d]kC(0,x,u,a),(0,y,v,b)∏i=0k−1(Ji)(ui,xi),(vi,yi)\sigma_C(J)_{ab} = \sum_{x,y,u,v\in[d]^k} C_{(0,x,u,a),(0,y,v,b)} \prod_{i=0}^{k-1}(J_i)_{(u_i,x_i),(v_i,y_i)}σC​(J)ab​=x,y,u,v∈[d]k∑​C(0,x,u,a),(0,y,v,b)​i=0∏k−1​(Ji​)(ui​,xi​),(vi​,yi​)​

is positive semidefinite and has trace 111. For each D∈{DS,DF}D\in\{D_S,D_F\}D∈{DS​,DF​}, its matrix with entries

JD(a,r),(b,s)=D(Ers)ab,r,s∈[d]×[m],\mathcal J_D{}_{(a,r),(b,s)}=D(E_{rs})_{ab}, \qquad r,s\in[d]\times[m],JD​(a,r),(b,s)​=D(Ers​)ab​,r,s∈[d]×[m],

is positive semidefinite, where ErsE_{rs}Ers​ is the matrix unit. The sum map DS+DFD_S+D_FDS​+DF​ is a channel, meaning that there exist a natural number qqq and matrices Kℓ:Cdm→CdK_\ell:\mathbb C^{dm}\to\mathbb C^dKℓ​:Cdm→Cd with ∑ℓ<qKℓ†Kℓ=Idm\sum_{\ell<q}K_\ell^\dagger K_\ell=I_{dm}∑ℓ<q​Kℓ†​Kℓ​=Idm​ such that (DS+DF)(Y)=∑ℓ<qKℓYKℓ†(D_S+D_F)(Y)=\sum_{\ell<q}K_\ell YK_\ell^\dagger(DS​+DF​)(Y)=∑ℓ<q​Kℓ​YKℓ†​ for every matrix YYY. Finally, for every d×dd\times dd×d unitary UUU and every complex d×dd\times dd×d matrix XXX,

DS ⁣(X⊗σC(U))=p UXU†,σC(U)ab=∑x,y,u,v∈[d]kC(0,x,u,a),(0,y,v,b)∏i<kUuixiUviyi‾.D_S\!\left(X\otimes\sigma_C(U)\right)=p\,UXU^\dagger, \qquad \sigma_C(U)_{ab} = \sum_{x,y,u,v\in[d]^k} C_{(0,x,u,a),(0,y,v,b)} \prod_{i<k}U_{u_i x_i}\overline{U_{v_i y_i}}.DS​(X⊗σC​(U))=pUXU†,σC​(U)ab​=x,y,u,v∈[d]k∑​C(0,x,u,a),(0,y,v,b)​i<k∏​Uui​xi​​Uvi​yi​​​.

The quantifier over XXX includes all matrices, without positivity or trace restrictions. The definition permits p=0p=0p=0 and k=0k=0k=0; for k=0k=0k=0, the tuple sums have one term and the products are empty products equal to 111.

QAlgorithms.Papers.Independent.Intake100.P12.OracleWireDimensions

For every natural number kkk, this defines a record consisting of two natural numbers aext,bexta_{\mathrm{ext}},b_{\mathrm{ext}}aext​,bext​, called the external input and output dimensions, and two functions a,b:{0,…,k−1}→Na,b:\{0,\ldots,k-1\}\to\mathbb Na,b:{0,…,k−1}→N, giving an input dimension aia_iai​ and an output dimension bib_ibi​ for each slot iii. All dimensions may be zero. The case k=0k=0k=0 is included and has no slot dimensions.

QAlgorithms.Papers.Independent.Intake100.P12.Outputs

For every natural number kkk and every wire-dimension record www whose slot output dimensions are bib_ibi​, this abbreviates the configuration type

Bw=∏i=0k−1{0,…,bi−1}.\mathcal B_w=\prod_{i=0}^{k-1}\{0,\ldots,b_i-1\}.Bw​=i=0∏k−1​{0,…,bi​−1}.

Thus an element chooses one valid output index for each slot. For k=0k=0k=0, there is exactly one configuration, the empty assignment; if any slot output dimension is zero, there are no configurations. The other fields of www do not affect this type.

QAlgorithms.Papers.Independent.Intake100.P12.ParallelNormalized

For natural numbers d,kd,kd,k, let D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, and let CCC be a complex matrix indexed by configurations x=(xin,(xiin)i<k,(xiout)i<k,xout)x=(x_{\mathrm{in}},(x_i^{\mathrm{in}})_{i<k},(x_i^{\mathrm{out}})_{i<k},x_{\mathrm{out}})x=(xin​,(xiin​)i<k​,(xiout​)i<k​,xout​), with every coordinate in DDD. The wire labels are the external input, the kkk slot inputs, the kkk slot outputs, and the external output. For any set AAA of these labels, define x[A←z]x[A\leftarrow z]x[A←z] by replacing the coordinates of xxx labelled by AAA with those of zzz, and define the matrix

(TAC)x,y={(d 2k+2)−1∑zCx[A←z], y[A←z],xa=ya for every a∈A,0,otherwise.(\mathcal T_A C)_{x,y}= \begin{cases} (d^{\,2k+2})^{-1}\displaystyle\sum_z C_{x[A\leftarrow z],\,y[A\leftarrow z]}, &x_a=y_a\text{ for every }a\in A,\\ 0,&\text{otherwise}. \end{cases}(TA​C)x,y​=⎩⎨⎧​(d2k+2)−1z∑​Cx[A←z],y[A←z]​,0,​xa​=ya​ for every a∈A,otherwise.​

The sum runs over all configurations zzz, and the inverse is taken in C\mathbb CC. The predicate holds precisely when CCC is positive semidefinite, T{external output}C=T{external output, all slot outputs}C\mathcal T_{\{\mathrm{external\ output}\}}C=\mathcal T_{\{\mathrm{external\ output},\,\mathrm{all\ slot\ outputs}\}}CT{external output}​C=T{external output,all slot outputs}​C, T{all labels except external input}C=T{all labels}C\mathcal T_{\{\mathrm{all\ labels\ except\ external\ input}\}}C=\mathcal T_{\{\mathrm{all\ labels}\}}CT{all labels except external input}​C=T{all labels}​C, and tr⁡C=dk+1\operatorname{tr}C=d^{k+1}trC=dk+1. Both d=0d=0d=0 and k=0k=0k=0 are allowed: for d=0d=0d=0, the configuration set is empty and the unique empty matrix satisfies these conditions; for k=0k=0k=0, the first matrix equality is automatic.

QAlgorithms.Papers.Independent.Intake100.P12.ParallelRealizes

For every natural number kkk, every wire-dimension record www with external dimensions aext,bexta_{\mathrm{ext}},b_{\mathrm{ext}}aext​,bext​, input configurations A=∏i<k{0,…,ai−1}\mathcal A=\prod_{i<k}\{0,\ldots,a_i-1\}A=∏i<k​{0,…,ai​−1}, and output configurations B=∏i<k{0,…,bi−1}\mathcal B=\prod_{i<k}\{0,\ldots,b_i-1\}B=∏i<k​{0,…,bi​−1}, and every complex matrix CCC indexed by tuples (i,x,u,o)(i,x,u,o)(i,x,u,o), this predicate means that there exist a positive natural number mmm and channels EEE from matrices on the external input indices to matrices on {0,…,m−1}×A\{0,\ldots,m-1\}\times\mathcal A{0,…,m−1}×A, and DDD from matrices on {0,…,m−1}×B\{0,\ldots,m-1\}\times\mathcal B{0,…,m−1}×B to matrices on the external output indices, satisfying the following identity for every complex matrix JJJ on B×A\mathcal B\times\mathcal AB×A and every complex external input matrix XXX:

D(Z)o,o′=∑i,i′∑x,y∈A∑u,v∈BXi,i′C(i,x,u,o),(i′,y,v,o′) J(u,x),(v,y),Z(r,u),(s,v)=∑x,y∈AJ(u,x),(v,y)(E(X))(r,x),(s,y).D(Z)_{o,o'} =\sum_{i,i'}\sum_{x,y\in\mathcal A}\sum_{u,v\in\mathcal B} X_{i,i'}C_{(i,x,u,o),(i',y,v,o')}\,J_{(u,x),(v,y)}, \qquad Z_{(r,u),(s,v)} =\sum_{x,y\in\mathcal A}J_{(u,x),(v,y)}(E(X))_{(r,x),(s,y)}.D(Z)o,o′​=i,i′∑​x,y∈A∑​u,v∈B∑​Xi,i′​C(i,x,u,o),(i′,y,v,o′)​J(u,x),(v,y)​,Z(r,u),(s,v)​=x,y∈A∑​J(u,x),(v,y)​(E(X))(r,x),(s,y)​.

Here a channel TTT means a function admitting some finite family of rectangular complex matrices KℓK_\ellKℓ​ such that T(Y)=∑ℓKℓYKℓ†T(Y)=\sum_\ell K_\ell YK_\ell^\daggerT(Y)=∑ℓ​Kℓ​YKℓ†​ for every matrix YYY and ∑ℓKℓ†Kℓ=I\sum_\ell K_\ell^\dagger K_\ell=I∑ℓ​Kℓ†​Kℓ​=I. No positivity condition on CCC, positivity of the dimensions in www, or restriction to channel matrices JJJ or density matrices XXX is imposed. Zero dimensions use empty sums and may make the channel requirements impossible; for example, EEE cannot exist if the external input dimension is positive and A\mathcal AA is empty. For k=0k=0k=0, both slot configuration sets are singletons.

QAlgorithms.Papers.Independent.Intake100.P12.PositiveWires

For every natural number kkk and every wire-dimension record www, with external dimensions aext,bexta_{\mathrm{ext}},b_{\mathrm{ext}}aext​,bext​ and slot dimensions ai,bia_i,b_iai​,bi​ for 0≤i<k0\le i<k0≤i<k, this predicate means exactly

aext>0,bext>0,∀i<k, ai>0,∀i<k, bi>0.a_{\mathrm{ext}}>0,\qquad b_{\mathrm{ext}}>0,\qquad \forall i<k,\ a_i>0,\qquad \forall i<k,\ b_i>0.aext​>0,bext​>0,∀i<k, ai​>0,∀i<k, bi​>0.

When k=0k=0k=0, both conditions on slot dimensions are vacuous, while the two external dimensions must still be positive.

QAlgorithms.Papers.Independent.Intake100.P12.ProcessBasis

For every natural number kkk and every wire-dimension record www, with external dimensions aext,bexta_{\mathrm{ext}},b_{\mathrm{ext}}aext​,bext​ and slot dimensions ai,bia_i,b_iai​,bi​, this abbreviates the type of tuples (i,x,u,o)(i,x,u,o)(i,x,u,o) where

0≤i<aext,x∈∏j<k{0,…,aj−1},u∈∏j<k{0,…,bj−1},0≤o<bext.0\le i<a_{\mathrm{ext}},\qquad x\in\prod_{j<k}\{0,\ldots,a_j-1\},\qquad u\in\prod_{j<k}\{0,\ldots,b_j-1\},\qquad 0\le o<b_{\mathrm{ext}}.0≤i<aext​,x∈j<k∏​{0,…,aj​−1},u∈j<k∏​{0,…,bj​−1},0≤o<bext​.

For k=0k=0k=0, the two slot assignments are uniquely empty. The type is empty if either external dimension or any slot dimension is zero.

QAlgorithms.Papers.Independent.Intake100.P12.ProtocolClass

This declaration defines a type with exactly three distinct values, named parallel\mathrm{parallel}parallel, adaptive\mathrm{adaptive}adaptive, and general\mathrm{general}general, and equips it with decidable equality. The constructors carry no additional data.

QAlgorithms.Papers.Independent.Intake100.P12.SequentialNormalized

For natural numbers d,kd,kd,k, let D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, and let CCC be a complex matrix indexed by configurations containing an external input, kkk slot inputs, kkk slot outputs, and an external output, all taking values in DDD. For a set AAA of wire labels, write x[A←z]x[A\leftarrow z]x[A←z] for replacement of the selected coordinates, and define

(TAC)x,y={(d 2k+2)−1∑zCx[A←z], y[A←z],xa=ya for every a∈A,0,otherwise,(\mathcal T_A C)_{x,y}= \begin{cases} (d^{\,2k+2})^{-1}\displaystyle\sum_z C_{x[A\leftarrow z],\,y[A\leftarrow z]}, &x_a=y_a\text{ for every }a\in A,\\ 0,&\text{otherwise}, \end{cases}(TA​C)x,y​=⎩⎨⎧​(d2k+2)−1z∑​Cx[A←z],y[A←z]​,0,​xa​=ya​ for every a∈A,otherwise,​

where zzz ranges over all configurations and the inverse is in C\mathbb CC. For each i<ki<ki<k, let LiL_iLi​ contain the external output and both wires of every slot j>ij>ij>i. The predicate holds precisely when CCC is positive semidefinite,

TLiC=TLi∪{slot output i}Cfor every i<k,T{all labels except external input}C=T{all labels}C,tr⁡C=dk+1.\mathcal T_{L_i}C=\mathcal T_{L_i\cup\{\mathrm{slot\ output}\ i\}}C \quad\text{for every }i<k, \qquad \mathcal T_{\{\mathrm{all\ labels\ except\ external\ input}\}}C =\mathcal T_{\{\mathrm{all\ labels}\}}C, \qquad \operatorname{tr}C=d^{k+1}.TLi​​C=TLi​∪{slot output i}​Cfor every i<k,T{all labels except external input}​C=T{all labels}​C,trC=dk+1.

There is no positivity assumption on ddd or kkk: at d=0d=0d=0 the unique empty matrix satisfies the predicate, and at k=0k=0k=0 the family of conditions indexed by iii is vacuous.

QAlgorithms.Papers.Independent.Intake100.P12.SequentialRealizes

For natural numbers d,kd,kd,k, let I=Fin⁡(d)kI=\operatorname{Fin}(d)^kI=Fin(d)k and let CCC be a complex matrix indexed by Fin⁡(d)×I×I×Fin⁡(d)\operatorname{Fin}(d)\times I\times I\times\operatorname{Fin}(d)Fin(d)×I×I×Fin(d). This predicate holds exactly when there exist a positive natural number mmm, channels E0E_0E0​ from matrices on Fin⁡(d)\operatorname{Fin}(d)Fin(d) to matrices on Fin⁡(m)×Fin⁡(d)\operatorname{Fin}(m)\times\operatorname{Fin}(d)Fin(m)×Fin(d), EiE_iEi​ on the latter matrix space for every i<ki<ki<k, and DDD from that space to matrices on Fin⁡(d)\operatorname{Fin}(d)Fin(d), such that for every family of arbitrary complex matrices JiJ_iJi​ on Fin⁡(d)×Fin⁡(d)\operatorname{Fin}(d)\times\operatorname{Fin}(d)Fin(d)×Fin(d) and every matrix XXX on Fin⁡(d)\operatorname{Fin}(d)Fin(d),

[D(Yk)]r,s=∑p,q<d∑x,y,u,v∈IXp,qC(p,x,u,r),(q,y,v,s)∏i<k(Ji)(ui,xi),(vi,yi),[D(Y_k)]_{r,s} =\sum_{p,q<d}\sum_{x,y,u,v\in I} X_{p,q}C_{(p,x,u,r),(q,y,v,s)} \prod_{i<k}(J_i)_{(u_i,x_i),(v_i,y_i)},[D(Yk​)]r,s​=p,q<d∑​x,y,u,v∈I∑​Xp,q​C(p,x,u,r),(q,y,v,s)​i<k∏​(Ji​)(ui​,xi​),(vi​,yi​)​,

where Y0=E0(X)Y_0=E_0(X)Y0​=E0​(X) and Yi+1=Ei(Zi)Y_{i+1}=E_i(Z_i)Yi+1​=Ei​(Zi​), with

(Zi)(α,u),(β,v)=∑x,y<d(Yi)(α,x),(β,y)(Ji)(u,x),(v,y).(Z_i)_{(\alpha,u),(\beta,v)} =\sum_{x,y<d}(Y_i)_{(\alpha,x),(\beta,y)} (J_i)_{(u,x),(v,y)}.(Zi​)(α,u),(β,v)​=x,y<d∑​(Yi​)(α,x),(β,y)​(Ji​)(u,x),(v,y)​.

Each channel is required to admit a finite representation Φ(Y)=∑ℓ<hKℓYKℓ†\Phi(Y)=\sum_{\ell<h}K_\ell YK_\ell^\daggerΦ(Y)=∑ℓ<h​Kℓ​YKℓ†​ with ∑ℓ<hKℓ†Kℓ=1\sum_{\ell<h}K_\ell^\dagger K_\ell=1∑ℓ<h​Kℓ†​Kℓ​=1. The definition separately assumes neither d>0d>0d>0 nor positivity of CCC, and the quantified Ji,XJ_i,XJi​,X need not be positive or normalized. When k=0k=0k=0, the product is 111, the tuple index set III is a singleton, and the right-hand implementation is D(E0(X))D(E_0(X))D(E0​(X)).

QAlgorithms.Papers.Independent.Intake100.P12.TestedFeasible

For arbitrary natural numbers d,k,nd,k,nd,k,n, a protocol class ccc chosen from parallel, adaptive, and general, a complex-linear map fff on matrices indexed by D×DD\times DD×D, a family B0,…,Bn−1B_0,\ldots,B_{n-1}B0​,…,Bn−1​ of d×dd\times dd×d unitary matrices, a real number ppp, and complex matrices S,FS,FS,F on P=D×A×A×DP=D\times A\times A\times DP=D×A×A×D, where D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1} and A=D{0,…,k−1}A=D^{\{0,\ldots,k-1\}}A=D{0,…,k−1}, this predicate means that 0≤p≤10\le p\le10≤p≤1, S,FS,FS,F are positive semidefinite, d>0d>0d>0, and C=S+FC=S+FC=S+F is positive semidefinite and has the selected realization described below. Define

EC(J)(o,i),(o′,j)=∑x,y,u,v∈AC(i,x,u,o),(j,y,v,o′)J(u,x),(v,y),TJ(X)u,v=∑x,y∈AXx,yJ(u,x),(v,y),\mathcal E_C(J)_{(o,i),(o',j)} =\sum_{x,y,u,v\in A}C_{(i,x,u,o),(j,y,v,o')}J_{(u,x),(v,y)}, \qquad \mathcal T_J(X)_{u,v} =\sum_{x,y\in A}X_{x,y}J_{(u,x),(v,y)},EC​(J)(o,i),(o′,j)​=x,y,u,v∈A∑​C(i,x,u,o),(j,y,v,o′)​J(u,x),(v,y)​,TJ​(X)u,v​=x,y∈A∑​Xx,y​J(u,x),(v,y)​,

with the same convention for maps associated to external or single-slot matrices on D×DD\times DD×D. A channel means a map X↦∑aKaXKa†X\mapsto\sum_aK_aXK_a^\daggerX↦∑a​Ka​XKa†​ for some finite Kraus family satisfying ∑aKa†Ka=I\sum_aK_a^\dagger K_a=I∑a​Ka†​Ka​=I. In the parallel class, there must exist a positive integer mmm, a channel EEE from DDD to {0,…,m−1}×A\{0,\ldots,m-1\}\times A{0,…,m−1}×A, and a channel DpostD_{\mathrm{post}}Dpost​ back to DDD, such that

TEC(J)(X)=Dpost((id⁡m⊗TJ)(E(X)))\mathcal T_{\mathcal E_C(J)}(X) =D_{\mathrm{post}}\bigl((\operatorname{id}_m\otimes\mathcal T_J)(E(X))\bigr)TEC​(J)​(X)=Dpost​((idm​⊗TJ​)(E(X)))

for all arbitrary complex matrices JJJ on A×AA\times AA×A and XXX on DDD, where the tensor extension acts separately on each memory-indexed block. In the adaptive class, there must exist a positive integer mmm, channels EpreE_{\mathrm{pre}}Epre​ from DDD to {0,…,m−1}×D\{0,\ldots,m-1\}\times D{0,…,m−1}×D, EℓE_\ellEℓ​ on that latter system for 0≤ℓ<k0\le\ell<k0≤ℓ<k, and DpostD_{\mathrm{post}}Dpost​ back to DDD. For every family of arbitrary single-slot matrices JℓJ_\ellJℓ​ and every XXX, let Y0=Epre(X)Y_0=E_{\mathrm{pre}}(X)Y0​=Epre​(X), Yℓ+1=Eℓ((id⁡m⊗TJℓ)(Yℓ))Y_{\ell+1}=E_\ell((\operatorname{id}_m\otimes\mathcal T_{J_\ell})(Y_\ell))Yℓ+1​=Eℓ​((idm​⊗TJℓ​​)(Yℓ​)), and

(Jall)(u,x),(v,y)=∏ℓ=0k−1(Jℓ)(uℓ,xℓ),(vℓ,yℓ).(J_{\mathrm{all}})_{(u,x),(v,y)} =\prod_{\ell=0}^{k-1}(J_\ell)_{(u_\ell,x_\ell),(v_\ell,y_\ell)}.(Jall​)(u,x),(v,y)​=ℓ=0∏k−1​(Jℓ​)(uℓ​,xℓ​),(vℓ​,yℓ​)​.

One requires TEC(Jall)(X)=Dpost(Yk)\mathcal T_{\mathcal E_C(J_{\mathrm{all}})}(X)=D_{\mathrm{post}}(Y_k)TEC​(Jall​)​(X)=Dpost​(Yk​). In the general class, for every family of positive semidefinite single-slot matrices JℓJ_\ellJℓ​ with ∑o(Jℓ)(o,a),(o,b)=δab\sum_o(J_\ell)_{(o,a),(o,b)}=\delta_{ab}∑o​(Jℓ​)(o,a),(o,b)​=δab​, one requires EC(Jall)\mathcal E_C(J_{\mathrm{all}})EC​(Jall​) to be positive semidefinite with ∑oEC(Jall)(o,i),(o,j)=δij\sum_o\mathcal E_C(J_{\mathrm{all}})_{(o,i),(o,j)}=\delta_{ij}∑o​EC​(Jall​)(o,i),(o,j)​=δij​. Finally, the tested equalities are

ES(JBi)=p f(G(Bi))(0≤i<n),G(U)(a,b),(c,e)=UabUce‾,(JU)(u,x),(v,y)=∏ℓ=0k−1UuℓxℓUvℓyℓ‾.\mathcal E_S(J_{B_i})=p\,f(G(B_i)) \quad(0\le i<n), \qquad G(U)_{(a,b),(c,e)}=U_{ab}\overline{U_{ce}}, \qquad (J_U)_{(u,x),(v,y)} =\prod_{\ell=0}^{k-1}U_{u_\ell x_\ell}\overline{U_{v_\ell y_\ell}}.ES​(JBi​​)=pf(G(Bi​))(0≤i<n),G(U)(a,b),(c,e)​=Uab​Uce​​,(JU​)(u,x),(v,y)​=ℓ=0∏k−1​Uuℓ​xℓ​​Uvℓ​yℓ​​​.

No basis or spanning assumption on BBB, and no requirement that fff map every unitary matrix’s G(U)G(U)G(U) to another such matrix, is part of this predicate. If n=0n=0n=0, the tested equalities are vacuous; if k=0k=0k=0, AAA is a singleton and all slot products equal 111.

QAlgorithms.Papers.Independent.Intake100.P12.UnitaryLinearTarget

For any natural number ddd and any complex-linear map fff from complex matrices indexed by {0,…,d−1}2\{0,\ldots,d-1\}^2{0,…,d−1}2 to matrices with that same index set, this predicate means that for every complex d×dd\times dd×d unitary matrix UUU, there exists a complex d×dd\times dd×d unitary matrix VVV such that

f(G(U))=G(V),G(W)(a,b),(c,e)=WabWce‾.f(G(U))=G(V), \qquad G(W)_{(a,b),(c,e)}=W_{ab}\overline{W_{ce}}.f(G(U))=G(V),G(W)(a,b),(c,e)​=Wab​Wce​​.

The existentially chosen VVV may depend on UUU, and its uniqueness is not asserted. The definition includes d=0d=0d=0, when these matrices have empty index sets.

QAlgorithms.Papers.Independent.Intake100.P12.UnitaryTask

This defines a type with exactly four distinct constructors, named identity, transpose, conjugate, and inverse, with no arguments or additional data attached to any constructor, and equips the type with decidable equality.

QAlgorithms.Papers.Independent.Intake100.P12.WireLabel

For every natural number kkk, this declaration defines a finite type consisting of an external input label, an external output label, an input slot label for each i∈Fin⁡(k)i\in\operatorname{Fin}(k)i∈Fin(k), and an output slot label for each i∈Fin⁡(k)i\in\operatorname{Fin}(k)i∈Fin(k). These 2k+22k+22k+2 labels are all distinct according to their constructors and indices, and the type has decidable equality and a finite enumeration. For k=0k=0k=0, only the two external labels remain.

QAlgorithms.Papers.Independent.Intake100.P12.adaptiveInverseProbability

For every pair of natural numbers d,kd,kd,k, this definition assigns

1−(1−1d2)q,q=(k+1)div⁡d,1-\left(1-\frac{1}{d^2}\right)^q, \qquad q=(k+1)\operatorname{div}d,1−(1−d21​)q,q=(k+1)divd,

where the base uses real arithmetic and the exponent uses natural-number division. For d>0d>0d>0, q=⌊(k+1)/d⌋q=\lfloor(k+1)/d\rfloorq=⌊(k+1)/d⌋. The definition also includes d=0d=0d=0, for which division by zero makes the exponent 000 and the value is 000. Whenever the exponent is zero, the value is 000; when d=1d=1d=1, the base is zero and the exponent is positive, so the value is 111 for every kkk, including k=0k=0k=0.

QAlgorithms.Papers.Independent.Intake100.P12.adaptiveTransposeProbability

For every pair of natural numbers d,kd,kd,k, this definition assigns

1−(1−1d2)q,q=((k+d)\dotminus1)div⁡d,1-\left(1-\frac{1}{d^2}\right)^q, \qquad q=\bigl((k+d)\mathbin{\dotminus}1\bigr)\operatorname{div}d,1−(1−d21​)q,q=((k+d)\dotminus1)divd,

where the base is computed in R\mathbb RR, \dotminus\dotminus\dotminus is natural-number subtraction truncated at zero, and div⁡\operatorname{div}div is natural-number division. Thus, when d>0d>0d>0, the exponent is ⌊(k+d−1)/d⌋\lfloor(k+d-1)/d\rfloor⌊(k+d−1)/d⌋. No restriction excludes d=0d=0d=0: natural-number division by zero gives exponent 000, and the defined value is then 000. An exponent of zero gives value 000, including when the base is zero, because 00=10^0=100=1; consequently, for d=1d=1d=1 the value is 000 at k=0k=0k=0 and 111 at every k>0k>0k>0.

QAlgorithms.Papers.Independent.Intake100.P12.bellZeroKraus

For every natural number ddd and every arbitrary complex d×dd\times dd×d matrix UUU, this defines the complex d×dd\times dd×d matrix KKK whose entries are

Kab=∑x=0d−1{d−1,x=b,0,x≠bUxa=d−1Uba.K_{ab} =\sum_{x=0}^{d-1} \begin{cases}d^{-1},&x=b,\\0,&x\ne b\end{cases} U_{xa} =d^{-1}U_{ba}.Kab​=x=0∑d−1​{d−1,0,​x=b,x=b​Uxa​=d−1Uba​.

Thus K=d−1UTK=d^{-1}U^{\mathsf T}K=d−1UT, with the scalar interpreted in C\mathbb CC. There is no unitarity assumption on UUU. The case d=0d=0d=0 is included: the matrix is empty, and the scalar inverse is defined using 0−1=00^{-1}=00−1=0.

QAlgorithms.Papers.Independent.Intake100.P12.channelAffineSpan

For any natural number kkk and any wire dimensions www, put I=∏i<k{0,…,wiin−1}\mathcal I=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{in}}-1\}I=∏i<k​{0,…,wiin​−1} and O=∏i<k{0,…,wiout−1}\mathcal O=\prod_{i<k}\{0,\ldots,w_i^{\mathrm{out}}-1\}O=∏i<k​{0,…,wiout​−1}. Consider every family J=(Ji)i<kJ=(J_i)_{i<k}J=(Ji​)i<k​ in which JiJ_iJi​ is a positive semidefinite complex matrix on the output–input pairs of slot iii and satisfies ∑o(Ji)(o,a),(o,b)=δa,b\sum_o(J_i)_{(o,a),(o,b)}=\delta_{a,b}∑o​(Ji​)(o,a),(o,b)​=δa,b​. Associate to it the matrix

(J^)(u,a),(v,b)=∏i<k(Ji)(ui,ai),(vi,bi)(u,v∈O, a,b∈I).(\widehat J)_{(u,a),(v,b)} =\prod_{i<k}(J_i)_{(u_i,a_i),(v_i,b_i)} \quad(u,v\in\mathcal O,\ a,b\in\mathcal I).(J)(u,a),(v,b)​=i<k∏​(Ji​)(ui​,ai​),(vi​,bi​)​(u,v∈O, a,b∈I).

The definition gives the real linear subspace of Mat⁡O×I(C)×R\operatorname{Mat}_{\mathcal O\times\mathcal I}(\mathbb C)\times\mathbb RMatO×I​(C)×R generated by all pairs (J^,1)(\widehat J,1)(J,1); explicitly, its elements are finite sums ∑ℓ=1rtℓ(J^(ℓ),1)\sum_{\ell=1}^{r}t_\ell(\widehat J^{(\ell)},1)∑ℓ=1r​tℓ​(J(ℓ),1) with arbitrary real coefficients tℓt_\elltℓ​, including the empty sum. The external wire dimensions play no role. If no such family exists, the subspace is {0}\{0\}{0}. At k=0k=0k=0, the matrix J^\widehat JJ is the one-by-one matrix with entry 111, so the subspace is generated by the single pair (1,1)(1,1)(1,1).

QAlgorithms.Papers.Independent.Intake100.P12.evaluateOracleSlots

For every natural number kkk, every wire-dimension record www with external dimensions aext,bexta_{\mathrm{ext}},b_{\mathrm{ext}}aext​,bext​, input configurations Aw=∏i<k{0,…,ai−1}\mathcal A_w=\prod_{i<k}\{0,\ldots,a_i-1\}Aw​=∏i<k​{0,…,ai​−1}, and output configurations Bw=∏i<k{0,…,bi−1}\mathcal B_w=\prod_{i<k}\{0,\ldots,b_i-1\}Bw​=∏i<k​{0,…,bi​−1}, let SSS be any complex matrix indexed by tuples (i,x,u,o)(i,x,u,o)(i,x,u,o) of these external and slot indices, and let JJJ be any complex matrix indexed by Bw×Aw\mathcal B_w\times\mathcal A_wBw​×Aw​. This defines a complex matrix indexed by external output–input pairs through

[evaluateOracleSlots⁡(S,J)](o,i),(o′,i′)=∑x,y∈Aw∑u,v∈BwS(i,x,u,o),(i′,y,v,o′) J(u,x),(v,y).[\operatorname{evaluateOracleSlots}(S,J)]_{(o,i),(o',i')} =\sum_{x,y\in\mathcal A_w}\sum_{u,v\in\mathcal B_w} S_{(i,x,u,o),(i',y,v,o')}\,J_{(u,x),(v,y)}.[evaluateOracleSlots(S,J)](o,i),(o′,i′)​=x,y∈Aw​∑​u,v∈Bw​∑​S(i,x,u,o),(i′,y,v,o′)​J(u,x),(v,y)​.

There are no positivity or normalization assumptions, and no entries are conjugated in this formula. Empty configuration sets give zero sums. For k=0k=0k=0, each configuration set is a singleton, so the formula multiplies the corresponding entry of SSS by the sole entry of JJJ.

QAlgorithms.Papers.Independent.Intake100.P12.futureWires

For every natural number kkk, this definition returns the finite set of all wire labels except the external input label: it contains every input slot label and every output slot label indexed by i∈Fin⁡(k)i\in\operatorname{Fin}(k)i∈Fin(k), together with the external output label. Thus it has 2k+12k+12k+1 elements; for k=0k=0k=0, it is the singleton containing the external output label.

QAlgorithms.Papers.Independent.Intake100.P12.gateChoi

For any types I,OI,OI,O and any complex matrix VVV with rows indexed by OOO and columns indexed by III, this defines a complex matrix indexed by O×IO\times IO×I with entries

[gateChoi⁡(V)](o,i),(o′,i′)=Vo,i Vo′,i′‾.[\operatorname{gateChoi}(V)]_{(o,i),(o',i')} =V_{o,i}\,\overline{V_{o',i'}}.[gateChoi(V)](o,i),(o′,i′)​=Vo,i​Vo′,i′​​.

Neither type is required to be finite, and no isometry or unitarity condition is imposed on VVV. If either type is empty, the resulting matrix has no entries.

QAlgorithms.Papers.Independent.Intake100.P12.laterWires

For any natural number kkk and any index i∈{0,…,k−1}i\in\{0,\ldots,k-1\}i∈{0,…,k−1}, this definition gives the finite set consisting of the external output wire together with the input and output wires of every slot whose index is strictly larger than iii:

Li={external output}∪{slot input j:i<j<k}∪{slot output j:i<j<k}.L_i=\{\mathrm{external\ output}\} \cup\{\mathrm{slot\ input}\ j:i<j<k\} \cup\{\mathrm{slot\ output}\ j:i<j<k\}.Li​={external output}∪{slot input j:i<j<k}∪{slot output j:i<j<k}.

Thus Lk−1L_{k-1}Lk−1​ consists only of the external output when k>0k>0k>0; when k=0k=0k=0, there is no permissible argument iii.

QAlgorithms.Papers.Independent.Intake100.P12.outputWires

For every natural number kkk, this definition returns the finite set containing the external output label together with every output slot label indexed by i∈Fin⁡(k)i\in\operatorname{Fin}(k)i∈Fin(k), among the labels consisting of the two external labels and the input and output label for each slot. This set has k+1k+1k+1 elements; for k=0k=0k=0, it is the singleton containing the external output label.

QAlgorithms.Papers.Independent.Intake100.P12.parallelTransposeProbability

For every pair of natural numbers d,kd,kd,k, this definition assigns the real number

1−d2−1k+d2−1,1-\frac{d^2-1}{k+d^2-1},1−k+d2−1d2−1​,

with ddd and kkk interpreted as real numbers in this expression. There are no positivity assumptions on either parameter and no accompanying assertion that the value lies in [0,1][0,1][0,1]. Real division by zero is defined to be zero, so the value is 111 when the denominator vanishes, namely at (d,k)=(1,0)(d,k)=(1,0)(d,k)=(1,0) or (0,1)(0,1)(0,1); in particular, the value is 111 for every kkk when d=1d=1d=1.

QAlgorithms.Papers.Independent.Intake100.P12.repeatedChoi

For any natural numbers d,kd,kd,k and any unitary complex d×dd\times dd×d matrix UUU, this definition gives the complex matrix RRR indexed by pairs consisting of a kkk-tuple of output indices and a kkk-tuple of input indices, all in D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1}, whose entries are

R(u,a),(v,b)=∏i<k(Uui,ai Uvi,bi‾).R_{(u,a),(v,b)} =\prod_{i<k}\left(U_{u_i,a_i}\, \overline{U_{v_i,b_i}}\right).R(u,a),(v,b)​=i<k∏​(Uui​,ai​​Uvi​,bi​​​).

Here unitarity means U†U=UU†=IU^\dagger U=UU^\dagger=IU†U=UU†=I. The case k=0k=0k=0 gives the one-by-one matrix with entry 111, including when d=0d=0d=0; if d=0d=0d=0 and k>0k>0k>0, the indexing set is empty and the result is the empty matrix.

QAlgorithms.Papers.Independent.Intake100.P12.replaceCoordinates

For natural numbers d,kd,kd,k, let Wk\mathcal W_kWk​ consist of the external input and output labels and the input and output slot labels for every i<ki<ki<k, and let AAA be any finite subset of these labels. For any two tuples x,zx,zx,z in

Bd,k=Fin⁡(d)×Fin⁡(d)k×Fin⁡(d)k×Fin⁡(d),B_{d,k}=\operatorname{Fin}(d)\times\operatorname{Fin}(d)^k \times\operatorname{Fin}(d)^k\times\operatorname{Fin}(d),Bd,k​=Fin(d)×Fin(d)k×Fin(d)k×Fin(d),

this definition returns the tuple whose coordinate at each label in AAA is the corresponding coordinate of zzz, and whose coordinate at every other label is the corresponding coordinate of xxx. The four tuple components correspond respectively to the external input, slot inputs, slot outputs, and external output. In particular, A=∅A=\varnothingA=∅ returns xxx, and taking all labels returns zzz. The case k=0k=0k=0 has only the two external coordinates; for d=0d=0d=0, no arguments x,zx,zx,z exist.

QAlgorithms.Papers.Independent.Intake100.P12.sequentialRun

For arbitrary natural numbers d,k,md,k,md,k,m, arbitrary functions EiE_iEi​ from complex matrices on Fin⁡(m)×Fin⁡(d)\operatorname{Fin}(m)\times\operatorname{Fin}(d)Fin(m)×Fin(d) to matrices on that same set for every i<ki<ki<k, arbitrary complex matrices JiJ_iJi​ on Fin⁡(d)×Fin⁡(d)\operatorname{Fin}(d)\times\operatorname{Fin}(d)Fin(d)×Fin(d), and an arbitrary initial matrix XXX on Fin⁡(m)×Fin⁡(d)\operatorname{Fin}(m)\times\operatorname{Fin}(d)Fin(m)×Fin(d), this definition returns YkY_kYk​, where Y0=XY_0=XY0​=X and, in increasing order i=0,…,k−1i=0,\ldots,k-1i=0,…,k−1,

Yi+1=Ei(Zi),(Zi)(r,u),(s,v)=∑x,y<d(Yi)(r,x),(s,y)(Ji)(u,x),(v,y).Y_{i+1}=E_i(Z_i),\qquad (Z_i)_{(r,u),(s,v)} =\sum_{x,y<d}(Y_i)_{(r,x),(s,y)} (J_i)_{(u,x),(v,y)}.Yi+1​=Ei​(Zi​),(Zi​)(r,u),(s,v)​=x,y<d∑​(Yi​)(r,x),(s,y)​(Ji​)(u,x),(v,y)​.

No linearity, channel, positivity, or normalization conditions are imposed on these functions or matrices. All three natural numbers may be zero; when k=0k=0k=0, the returned matrix is XXX.

QAlgorithms.Papers.Independent.Intake100.P12.slotTensor

For every natural number kkk, every wire-dimension record www with slot dimensions ai,bia_i,b_iai​,bi​, and every family of complex matrices JiJ_iJi​ indexed by {0,…,bi−1}×{0,…,ai−1}\{0,\ldots,b_i-1\}\times\{0,\ldots,a_i-1\}{0,…,bi​−1}×{0,…,ai​−1}, this defines a complex matrix on Bw×Aw\mathcal B_w\times\mathcal A_wBw​×Aw​, where Aw=∏i<k{0,…,ai−1}\mathcal A_w=\prod_{i<k}\{0,\ldots,a_i-1\}Aw​=∏i<k​{0,…,ai​−1} and Bw=∏i<k{0,…,bi−1}\mathcal B_w=\prod_{i<k}\{0,\ldots,b_i-1\}Bw​=∏i<k​{0,…,bi​−1}, by

[slotTensor⁡(J)](u,x),(v,y)=∏i<k(Ji)(ui,xi),(vi,yi).[\operatorname{slotTensor}(J)]_{(u,x),(v,y)} =\prod_{i<k}(J_i)_{(u_i,x_i),(v_i,y_i)}.[slotTensor(J)](u,x),(v,y)​=i<k∏​(Ji​)(ui​,xi​),(vi​,yi​)​.

No positivity or normalization is required. For k=0k=0k=0, the configuration sets are singletons and the empty product gives the 1×11\times11×1 matrix with entry 111; if any slot dimension is zero, the resulting matrix has an empty indexing type.

QAlgorithms.Papers.Independent.Intake100.P12.storageWires

For arbitrary natural numbers d,k,md,k,md,k,m, this defines a collection of wire dimensions with kkk slots: the external input dimension is 111, the external output dimension is mmm, and each slot i∈{0,…,k−1}i\in\{0,\ldots,k-1\}i∈{0,…,k−1} has input dimension ddd and output dimension ddd. Neither ddd nor mmm is required to be positive. When k=0k=0k=0, there are no slots, and the external dimensions remain 111 and mmm.

QAlgorithms.Papers.Independent.Intake100.P12.storedProgram

For arbitrary natural numbers d,k,md,k,md,k,m, write [d]={0,…,d−1}[d]=\{0,\ldots,d-1\}[d]={0,…,d−1}. Given any complex matrix CCC indexed by tuples (0,x,u,a)(0,x,u,a)(0,x,u,a), where x,u∈[d]kx,u\in[d]^kx,u∈[d]k and a∈[m]a\in[m]a∈[m], and any d×dd\times dd×d unitary matrix UUU, this definition returns the m×mm\times mm×m matrix

storedProgram⁡(C,U)ab=∑x,y∈[d]k∑u,v∈[d]kC(0,x,u,a),(0,y,v,b)∏i=0k−1Uuixi Uviyi‾.\operatorname{storedProgram}(C,U)_{ab} = \sum_{x,y\in[d]^k}\sum_{u,v\in[d]^k} C_{(0,x,u,a),(0,y,v,b)} \prod_{i=0}^{k-1}U_{u_i x_i}\,\overline{U_{v_i y_i}}.storedProgram(C,U)ab​=x,y∈[d]k∑​u,v∈[d]k∑​C(0,x,u,a),(0,y,v,b)​i=0∏k−1​Uui​xi​​Uvi​yi​​​.

Here 000 is the sole element of the external input index set [1][1][1]. No positivity or normalization condition is imposed on CCC, so the definition itself does not assert that the resulting matrix is a density matrix. All three natural numbers may be zero: when k=0k=0k=0, each tuple index set has one empty tuple and the product is 111; when m=0m=0m=0, the result is an empty matrix; and when d=0<kd=0<kd=0<k, the summation index sets are empty and the result is zero.

QAlgorithms.Papers.Independent.Intake100.P12.switchMatrix

For arbitrary natural numbers d,kd,kd,k and any family of complex d×dd\times dd×d matrices U0,…,Uk−1U_0,\ldots,U_{k-1}U0​,…,Uk−1​, this definition gives a matrix indexed by pairs (π,a)(\pi,a)(π,a), with π\piπ a permutation of [k]={0,…,k−1}[k]=\{0,\ldots,k-1\}[k]={0,…,k−1} and a∈[d]a\in[d]a∈[d], whose entries are

switchMatrix⁡(U)(π,a),(σ,b)={(Uπ(k−1)⋯Uπ(1)Uπ(0))ab,π=σ,0,π≠σ.\operatorname{switchMatrix}(U)_{(\pi,a),(\sigma,b)} = \begin{cases} \bigl(U_{\pi(k-1)}\cdots U_{\pi(1)}U_{\pi(0)}\bigr)_{ab}, &\pi=\sigma,\\ 0,&\pi\ne\sigma. \end{cases}switchMatrix(U)(π,a),(σ,b)​={(Uπ(k−1)​⋯Uπ(1)​Uπ(0)​)ab​,0,​π=σ,π=σ.​

The product starts from IdI_dId​ and successively multiplies each matrix on the left in increasing order of its position in the permuted list. No unitarity assumption is imposed on the UiU_iUi​. When k=0k=0k=0, the permutation set is a singleton and the empty product is IdI_dId​; when d=0d=0d=0, the matrix has an empty index set.

QAlgorithms.Papers.Independent.Intake100.P12.targetChoi

For every natural number ddd, every task chosen from identity, transpose, conjugate, and inverse, and every complex d×dd\times dd×d unitary matrix UUU, this defines a complex matrix indexed by pairs in {0,…,d−1}2\{0,\ldots,d-1\}^2{0,…,d−1}2. For any d×dd\times dd×d matrix VVV, write G(V)(a,b),(c,e)=VabVce‾G(V)_{(a,b),(c,e)}=V_{ab}\overline{V_{ce}}G(V)(a,b),(c,e)​=Vab​Vce​​. The defined matrix is respectively G(U)G(U)G(U), G(UT)G(U^{\mathsf T})G(UT), G(U‾)G(\overline U)G(U), or G(U†)G(U^\dagger)G(U†), where U‾\overline UU denotes entrywise conjugation and U†U^\daggerU† denotes conjugate transpose. There is no normalization factor in G(V)G(V)G(V). The definition includes d=0d=0d=0, when the resulting matrix has an empty index set.

QAlgorithms.Papers.Independent.Intake100.P12.taskFromOutputChoi

For any finite type III, any type OOO, and any complex matrix JJJ indexed by O×IO\times IO×I, this defines a function from complex I×II\times II×I matrices to complex O×OO\times OO×O matrices by

[taskFromOutputChoi⁡(J)(X)]o,o′=∑i∈I∑i′∈IXi,i′J(o,i),(o′,i′).\bigl[\operatorname{taskFromOutputChoi}(J)(X)\bigr]_{o,o'} =\sum_{i\in I}\sum_{i'\in I}X_{i,i'}J_{(o,i),(o',i')}.[taskFromOutputChoi(J)(X)]o,o′​=i∈I∑​i′∈I∑​Xi,i′​J(o,i),(o′,i′)​.

There are no positivity or normalization assumptions on JJJ or XXX, and OOO need not be finite. If III is empty, each displayed sum is zero, so the function returns the zero matrix.

QAlgorithms.Papers.Independent.Intake100.P12.taskOutputChoi

For any finite type III with decidable equality, any type OOO, and any function Φ\PhiΦ from complex I×II\times II×I matrices to complex O×OO\times OO×O matrices, this defines a complex matrix indexed by O×IO\times IO×I through

[taskOutputChoi⁡(Φ)](o,i),(o′,i′)=[Φ(Ei,i′)]o,o′,[\operatorname{taskOutputChoi}(\Phi)]_{(o,i),(o',i')} =\bigl[\Phi(E_{i,i'})\bigr]_{o,o'},[taskOutputChoi(Φ)](o,i),(o′,i′)​=[Φ(Ei,i′​)]o,o′​,

where Ei,i′E_{i,i'}Ei,i′​ has entry 111 at (i,i′)(i,i')(i,i′) and 000 elsewhere. No linearity, positivity, or trace preservation of Φ\PhiΦ is assumed, and OOO need not be finite. If either indexing type is empty, the resulting matrix has no entries.

QAlgorithms.Papers.Independent.Intake100.P12.totalDimension

For any natural number kkk and any collection www of natural-number dimensions consisting of external input dimension rrr, external output dimension ttt, slot input dimensions aia_iai​, and slot output dimensions bib_ibi​ for 0≤i<k0\le i<k0≤i<k, this defines the natural number

rt(∏i=0k−1ai)(∏i=0k−1bi).rt\left(\prod_{i=0}^{k-1}a_i\right) \left(\prod_{i=0}^{k-1}b_i\right).rt(i=0∏k−1​ai​)(i=0∏k−1​bi​).

No positivity assumptions are imposed. Each empty product is 111, so for k=0k=0k=0 the value is rtrtrt; any zero factor makes the value zero.

QAlgorithms.Papers.Independent.Intake100.P12.traceReplace

For natural numbers d,kd,kd,k, let Bd,k=Fin⁡(d)×Fin⁡(d)k×Fin⁡(d)k×Fin⁡(d)B_{d,k}=\operatorname{Fin}(d)\times\operatorname{Fin}(d)^k\times\operatorname{Fin}(d)^k\times\operatorname{Fin}(d)Bd,k​=Fin(d)×Fin(d)k×Fin(d)k×Fin(d), with coordinates labeled by the external input, the kkk slot inputs, the kkk slot outputs, and the external output. For any finite set AAA of these labels and any complex matrix CCC on Bd,kB_{d,k}Bd,k​, this definition returns the matrix

[RA(C)]x,y={(d 2k+2)−1∑z∈Bd,kCx[A←z], y[A←z],xa=ya for every a∈A,0,otherwise,[\mathcal R_A(C)]_{x,y} = \begin{cases} (d^{\,2k+2})^{-1} \displaystyle\sum_{z\in B_{d,k}}C_{x[A\leftarrow z],\,y[A\leftarrow z]}, & x_a=y_a\text{ for every }a\in A,\\ 0,&\text{otherwise}, \end{cases}[RA​(C)]x,y​=⎩⎨⎧​(d2k+2)−1z∈Bd,k​∑​Cx[A←z],y[A←z]​,0,​xa​=ya​ for every a∈A,otherwise,​

where x[A←z]x[A\leftarrow z]x[A←z] replaces exactly the coordinates of xxx labeled by AAA with those of zzz, and similarly for yyy; the inverse is taken in C\mathbb CC. There is no positivity or normalization assumption on CCC. For A=∅A=\varnothingA=∅, the coordinate condition is vacuous; when k=0k=0k=0, the same formula uses the two external coordinates and the factor d−2d^{-2}d−2. If d=0d=0d=0, the matrix index set is empty, the sum is empty, and the scalar inverse uses 0−1=00^{-1}=00−1=0.

QAlgorithms.Papers.Independent.Intake100.P12.uniformWires

For every pair of natural numbers d,kd,kd,k, this defines a wire-dimension record with kkk slots by setting both external dimensions and every slot input and output dimension equal to ddd. The value d=0d=0d=0 is allowed. When k=0k=0k=0, there are no slots, and both external dimensions are still ddd.

QAlgorithms.Papers.Independent.Intake100.P12.unitarySpan

For natural numbers d,kd,kd,k, let D={0,…,d−1}D=\{0,\ldots,d-1\}D={0,…,d−1} and A=D{0,…,k−1}A=D^{\{0,\ldots,k-1\}}A=D{0,…,k−1}. This defines the complex linear subspace of matrices indexed by A×AA\times AA×A generated by all matrices

(JU)(u,x),(v,y)=∏ℓ=0k−1UuℓxℓUvℓyℓ‾,(J_U)_{(u,x),(v,y)} =\prod_{\ell=0}^{k-1} U_{u_\ell x_\ell}\overline{U_{v_\ell y_\ell}},(JU​)(u,x),(v,y)​=ℓ=0∏k−1​Uuℓ​xℓ​​Uvℓ​yℓ​​​,

as UUU ranges over all complex d×dd\times dd×d unitary matrices. Thus its elements are precisely finite complex linear combinations of these matrices, including the zero combination. The parameters may be zero: when k=0k=0k=0, AAA is a singleton and every JUJ_UJU​ is the scalar matrix 111; when d=0d=0d=0 and k>0k>0k>0, AAA is empty and the defined subspace is the zero matrix space.

QAlgorithms.Papers.Independent.Intake100.P12.wireCoordinate

For any natural numbers d,kd,kd,k and tuple

x=(xin,(xiin)i<k,(xiout)i<k,xout)∈Fin⁡(d)×Fin⁡(d)k×Fin⁡(d)k×Fin⁡(d),x=(x_{\mathrm{in}},(x_i^{\mathrm{in}})_{i<k}, (x_i^{\mathrm{out}})_{i<k},x_{\mathrm{out}}) \in\operatorname{Fin}(d)\times\operatorname{Fin}(d)^k \times\operatorname{Fin}(d)^k\times\operatorname{Fin}(d),x=(xin​,(xiin​)i<k​,(xiout​)i<k​,xout​)∈Fin(d)×Fin(d)k×Fin(d)k×Fin(d),

this definition assigns a coordinate in Fin⁡(d)\operatorname{Fin}(d)Fin(d) to each wire label: the external input and output labels receive xinx_{\mathrm{in}}xin​ and xoutx_{\mathrm{out}}xout​, and the input and output slot labels indexed by iii receive xiinx_i^{\mathrm{in}}xiin​ and xioutx_i^{\mathrm{out}}xiout​. Here the labels are precisely those two external labels and the two slot labels for each i<ki<ki<k. When k=0k=0k=0, there are only external coordinates; when d=0d=0d=0, no tuple xxx exists.

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

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 30, 2026

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

View graph

Get started

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

About Prove2Me

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

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me