Definitions for Universal Quantum Emulator
DefinitionQAlgorithms_Papers_Independent_Intakethird100_P67The objects the formalized statements of Universal Quantum Emulator (arXiv:1606.02734) are stated in. Each was checked against the paper by a blind read-back and a moderator.
densityConjugation: PDF p.2: unitary conjugation, also for subnormalized branches.sampleAlgebra: PDF p.2: complex span of all nonempty sample words (supported nonunital algebra).samplePi: PDF p.2: the support projector of the sum of PSD sample densities is the projector onto the span of their supports. CFC is evaluated on a finite spectrum.Generates: PDF p.2, Eq.(6): equality with the full supported matrix algebra.InSampleSupport: PDF p.2: density support contained in the input span.sampleDimension: PDF p.2, Eq.(2): dimension of the sample support.pureSamples: PDF p.2: pure sample density records.sampleReflection: PDF p.3, Eq.(9): the sample reflection sign is I-2P.systemControlled: PDF p.3, Eq.(10): frozen control-first gate reindexed into system-first order.erasureGate: PDF p.3, Eq.(11), R(k) H R(anchor), with the rightmost gate first.minusRegister: PDF p.4: |minus> tensor T, including the empty tensor.minusVector: PDF p.3: the normalized one-qubit |minus>.onAncilla: PDF p.4: a system/one-qubit operator placed on ancilla j.historyUnitary: PDF p.13: ordered forward history, recalled unchanged in the reverse circuit.historyWeight: PDF p.14: iid history weight.coherentErasureChannel: PDF p.14, A5: the generalized averaged erasure channel.nonanchorProbability: PDF pp.4–5: fixed anchor excluded from the uniform random indices.jointBranchHistory: PDF pp.13–16: a Fig.5 branch, including measurement, replacement of the system by the output anchor, then reverse output history. False means b=0.jointBranch: PDF p.14: averaged subnormalized joint branch.jointEmulator: PDF p.14, A10: nonselective joint output in the Appendix A convention.transportedGate: PDF pp.6,15, Eq.(18)/A12: covariance has U-dagger on the right, correcting printed A1's U. This does not impose U squared equal to the identity.eraseProbability: PDF p.6, Eq.(20): actual erasure success probability.emulate: PDF p.6: pure-sample main-system emulator, Appendix A output convention.compressedReflection: PDF p.7, Eq.(25): compression to H_in intersect anchor-perp.compressedReflectionChannel: PDF p.7, Eq.(24): compressed sampleReflection channel.lambdaPerp: PDF p.7, Eq.(26): norm of the vectorized compressed channel.residual: PDF p.8, Eq.(35): exact, unnormalized residual.unaryWord: PDF p.8: unary address, including residual t=T.coordinateExpansion: PDF p.8, Eq.(34): the full expansion retains its residual term.meanSampleDensity: PDF p.32, H3: average sample density.projectionBranch: PDF pp.31–32: actual Fig.7 branch. Same history is used forward and backward; false is span detection, true is the all-minus outcome.projectionChannel: PDF p.32: channel discarding the Fig.7 label.gentleChannel: PDF p.33, H19: randomized conjugated projective measurement.gentleProbability: PDF p.34, H21: actual expected outcome probability.ProjectiveFamily: PDF p.33: complete orthogonal projectors; zero projectors are allowed.positivePhaseEvolution: PDF p.20: positive-sign matrix exponential, e^(i theta H).pureFisherInformation: PDF pp.7–8, Eq.(31): quantum Fisher information of a differentiable normalized pure-state family. The theorem uses the actual analytic exp(i alpha P) family, so no nondifferentiability default of deriv is involved.referenceVector: PDF p.24: n independently prepared pure reference registers.swapReference: PDF p.24, E1: SWAP of system with reference j, identity on other references.swapHamiltonian: PDF p.24, E1: full continuous interaction.swapJoint: PDF p.24, E2: actual joint positivePhaseEvolution.effectiveHamiltonian: PDF p.24, E3: effective Hamiltonian with the n+1 coefficient.wireBranch: PDF p.4, Fig.2: unsuccessful output is the old system wire from the SWAP. The successful wire is reconstructed. These differ from Appendix A on failure.mixedGate: PDF p.28, G1: systemControlled density-matrix translations.mixedSampleErasureChannel: PDF p.28: entrywise Lebesgue integration of the continuous one-round body. For density samples the matrix exponential body is continuous on the compact interval.mixedHistory: PDF p.28: history unitary for fixed mixed-sample indices and real times.mixedHistoryOutput: PDF p.28: fixed mixed-history output after system replacement and reconstruction.mixedEmulate: PDF p.28: actual mixed-sample emulator, with independent uniform times and indices. Entrywise integrals are over a compact cube of a continuous finite-matrix body.bridgeSamples: PDF p.28, G2: tagged sample densities plus a pure bridge (none).conjugateBasis: PDF p.29, G3: positive-sign Fourier-densityConjugation basis.uniformAddress: PDF pp.29–30: normalized uniform address state.negativeFourier: PDF p.30, G7: negative-sign normalized DFT. This corrects G7's missing normalization and ket index; G6 and G11 determine this sign.basisPhase: PDF pp.29–30, G4/G8: full spectral exponential, hence identity on H_in-perp.increment: PDF p.22, D5: cyclic increment on the binary address.binaryMeasure: PDF p.22, D6: Fig.6 effective operation on system/address, with the helper returned to |minus>. The address is initialized at zero, correcting D8's printed |t>.addressedReflection: PDF p.23, D7: address-selective sampleReflection; t is a natural address.binaryHistory: PDF pp.22–23: actual binary history F(t+1,k) V, using addresses 1 through T.encodeUnary: PDF pp.22–23: linear reencoding of the unary subspace, extended by zero elsewhere.registerSwap: PDF p.11: SWAP between two equal-dimensional registers.doubleControlledSwap: PDF p.11: double-systemControlled full-register SWAP, with both controls ancillary.ElementaryGate: PDF pp.19–21: source elementary gate set, one-qubit unitaries and two-control SWAPs acting on four distinct qubit wires.elementaryMatrix: PDF pp.19–21: complete matrix semantics of the counted elementary gates.SampleCircuit: PDF pp.19–21: a circuit using supplied indexed density copies and fixed ancillary bits. Ports are disjoint by one injection; gates do not receive the unknown U or samples. The output is the main system and all other wires are traced out.SampleCircuit.initial: PDF pp.19–21: product input with actual independent supplied sample copies.SampleCircuit.output: PDF pp.19–21: source circuit channel; gate cost is literally gates.length.inputOutputRecords: PDF p.19: actual supplied input/output records, with no coherent phase reference.EmulatorFamily: PDF pp.19–21: one uniform family of sample circuits, fixed before the unknown sample vectors, U, and the new input. T and m are precision controls; history is classical.precisionRounds: PDF p.19: fixed ideal-error allocation eps/2 and at most eps/2 for all DME calls. For rank one no erasure rounds are needed. This corrects the printed allocation after B21, whose substitution into B19 gives more than eps. Constants only are rescaled.slowFactor: PDF pp.7,19: explicit polylogarithmic multiplier used to spell out O-tilde.BinaryEmulatorFamily: PDF p.22: binary circuits also accept the number of address qubits q.
import Mathlib
import Definitions.Def_QAlgorithms_Defs_QuantumOutputMetrics
import Definitions.Def_QAlgorithms_Defs_Measurement
import Definitions.Def_QAlgorithms_Defs_Gates
import Definitions.Def_QAlgorithms_Defs_Learning
/-! Universal Quantum Emulator, arXiv:1606.02734v2. Page numbers are PDF pages.
All new constructions are paper-local. Tensor factors put the system first.
Generated algebras use nonempty words: the ambient identity is not silently adjoined. -/
noncomputable section
open scoped ComplexConjugate Matrix Matrix.Norms.L2Operator
attribute [local instance] Classical.propDecidable
open MeasureTheory Filter
namespace QAlgorithms.Papers.Independent.Intakethird100.P67
variable {I J K L A : Type*} [Fintype I] [DecidableEq I]
[Fintype J] [DecidableEq J] [Fintype K] [DecidableEq K]
[Fintype L] [DecidableEq L] [Fintype A] [DecidableEq A]
/-- PDF p.2: unitary conjugation, also for subnormalized branches. -/
def densityConjugation (V : Matrix I I ℂ) (rho : Matrix I I ℂ) : Matrix I I ℂ := V * rho * Vᴴ
/-- PDF p.2: complex span of all nonempty sample words (supported nonunital algebra). -/
def sampleAlgebra (S : K → Matrix I I ℂ) : Submodule ℂ (Matrix I I ℂ) :=
Submodule.span ℂ {X | ∃ w : List K, w ≠ [] ∧ X = (w.map S).prod}
/-- PDF p.2: the support projector of the sum of PSD sample densities is the projector
onto the span of their supports. CFC is evaluated on a finite spectrum. -/
def samplePi (S : K → Matrix I I ℂ) : Matrix I I ℂ :=
cfc (fun x : ℝ => if x = 0 then 0 else 1) (∑ k, S k)
/-- PDF p.2, Eq.(6): equality with the full supported matrix algebra. -/
def Generates (S : K → Matrix I I ℂ) : Prop :=
∀ X : Matrix I I ℂ, X ∈ sampleAlgebra S ↔ samplePi S * X * samplePi S = X
/-- PDF p.2: density support contained in the input span. -/
def InSampleSupport (S : K → Matrix I I ℂ) (rho : Matrix I I ℂ) : Prop :=
samplePi S * rho * samplePi S = rho
/-- PDF p.2, Eq.(2): dimension of the sample support. -/
def sampleDimension (S : K → Matrix I I ℂ) : ℕ :=
Module.finrank ℂ (LinearMap.range (Matrix.toEuclideanLin (samplePi S)))
/-- PDF p.2: pure sample density records. -/
def pureSamples (phi : K → EuclideanSpace ℂ I) : K → Matrix I I ℂ := fun k => pureDensity (phi k)
/-- PDF p.3, Eq.(9): the sample reflection sign is I-2P. -/
def sampleReflection (phi : EuclideanSpace ℂ I) : Matrix I I ℂ := 1 - 2 • pureDensity phi
/-- PDF p.3, Eq.(10): frozen control-first gate reindexed into system-first order. -/
def systemControlled (V : Matrix I I ℂ) : Matrix (I × Bool) (I × Bool) ℂ :=
(QAlgorithms.controlled V).submatrix Prod.swap Prod.swap
/-- PDF p.3, Eq.(11), R(k) H R(anchor), with the rightmost gate first. -/
def erasureGate (phi : K → EuclideanSpace ℂ I) (a k : K) : Matrix (I × Bool) (I × Bool) ℂ :=
systemControlled (sampleReflection (phi k)) * Matrix.kronecker (1 : Matrix I I ℂ) hadamard *
systemControlled (sampleReflection (phi a))
/-- PDF p.4: |minus> tensor T, including the empty tensor. -/
def minusRegister (T : ℕ) : EuclideanSpace ℂ (Qubits T) :=
WithLp.toLp 2 fun z => ∏ j : Fin T,
if z j then -((Real.sqrt 2)⁻¹ : ℂ) else ((Real.sqrt 2)⁻¹ : ℂ)
/-- PDF p.3: the normalized one-qubit |minus>. -/
def minusVector : EuclideanSpace ℂ Bool :=
WithLp.toLp 2 fun b => if b then -((Real.sqrt 2)⁻¹ : ℂ) else ((Real.sqrt 2)⁻¹ : ℂ)
/-- PDF p.4: a system/one-qubit operator placed on ancilla j. -/
def onAncilla {T : ℕ} (V : Matrix (I × Bool) (I × Bool) ℂ) (j : Fin T) : Matrix (I × Qubits T) (I × Qubits T) ℂ :=
fun x y => if ∀ l, l ≠ j → x.2 l = y.2 l then V (x.1,x.2 j) (y.1,y.2 j) else 0
/-- PDF p.13: ordered forward history, recalled unchanged in the reverse circuit. -/
def historyUnitary {T : ℕ} (W : L → Matrix (I × Bool) (I × Bool) ℂ) (h : Fin T → L) : Matrix (I × Qubits T) (I × Qubits T) ℂ :=
(List.ofFn fun j : Fin T => onAncilla (W (h j)) j).foldl (fun V G => G * V) 1
/-- PDF p.14: iid history weight. -/
def historyWeight {T : ℕ} (p : L → ℝ) (h : Fin T → L) : ℝ := ∏ j, p (h j)
/-- PDF p.14, A5: the generalized averaged erasure channel. -/
def coherentErasureChannel (p : L → ℝ) (W : L → Matrix (I × Bool) (I × Bool) ℂ) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
∑ l, (p l : ℂ) • traceRight (densityConjugation (W l) (Matrix.kronecker rho (pureDensity minusVector)))
/-- PDF pp.4–5: fixed anchor excluded from the uniform random indices. -/
def nonanchorProbability (a k : K) : ℝ :=
if k = a then 0 else ((Fintype.card K - 1 : ℕ) : ℝ)⁻¹
/-- PDF pp.13–16: a Fig.5 branch, including measurement, replacement of the system
by the output anchor, then reverse output history. False means b=0. -/
def jointBranchHistory {T : ℕ} (Win : L → Matrix (I × Bool) (I × Bool) ℂ)
(Wout : L → Matrix (J × Bool) (J × Bool) ℂ) (phi : EuclideanSpace ℂ I) (phiout : EuclideanSpace ℂ J)
(h : Fin T → L) (b : Bool) (rho : Matrix I I ℂ) : Matrix (J × Qubits T) (J × Qubits T) ℂ :=
let X := densityConjugation (historyUnitary Win h) (Matrix.kronecker rho (pureDensity (minusRegister T)))
let P := if b then 1 - pureDensity phi else pureDensity phi
let measured := densityConjugation (Matrix.kronecker P (1 : Matrix (Qubits T) (Qubits T) ℂ)) X
densityConjugation (historyUnitary Wout h)ᴴ
(Matrix.kronecker (pureDensity phiout) (traceLeft measured))
/-- PDF p.14: averaged subnormalized joint branch. -/
def jointBranch (p : L → ℝ) (Win : L → Matrix (I × Bool) (I × Bool) ℂ)
(Wout : L → Matrix (J × Bool) (J × Bool) ℂ) (phi : EuclideanSpace ℂ I) (phiout : EuclideanSpace ℂ J)
(T : ℕ) (b : Bool) (rho : Matrix I I ℂ) : Matrix (J × Qubits T) (J × Qubits T) ℂ :=
∑ h : Fin T → L, (historyWeight p h : ℂ) • jointBranchHistory Win Wout phi phiout h b rho
/-- PDF p.14, A10: nonselective joint output in the Appendix A convention. -/
def jointEmulator (p : L → ℝ) (Win : L → Matrix (I × Bool) (I × Bool) ℂ)
(Wout : L → Matrix (J × Bool) (J × Bool) ℂ) (phi : EuclideanSpace ℂ I) (phiout : EuclideanSpace ℂ J)
(T : ℕ) (rho : Matrix I I ℂ) : Matrix (J × Qubits T) (J × Qubits T) ℂ :=
jointBranch p Win Wout phi phiout T false rho + jointBranch p Win Wout phi phiout T true rho
/-- PDF pp.6,15, Eq.(18)/A12: covariance has U-dagger on the right, correcting
printed A1's U. This does not impose U squared equal to the identity. -/
def transportedGate (U : Matrix I I ℂ) (W : L → Matrix (I × Bool) (I × Bool) ℂ) : L → Matrix (I × Bool) (I × Bool) ℂ :=
fun l => densityConjugation (Matrix.kronecker U (1 : Matrix Bool Bool ℂ)) (W l)
/-- PDF p.6, Eq.(20): actual erasure success probability. -/
def eraseProbability (p : L → ℝ) (W : L → Matrix (I × Bool) (I × Bool) ℂ)
(phi : EuclideanSpace ℂ I) (T : ℕ) (rho : Matrix I I ℂ) : ℝ :=
effectProb (pureDensity phi) ((coherentErasureChannel p W)^[T] rho)
/-- PDF p.6: pure-sample main-system emulator, Appendix A output convention. -/
def emulate (phi : K → EuclideanSpace ℂ I) (a : K) (U : Matrix I I ℂ) (T : ℕ) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
traceRight (jointEmulator (nonanchorProbability a) (erasureGate phi a)
(transportedGate U (erasureGate phi a)) (phi a) (act U (phi a)) T rho)
/-- PDF p.7, Eq.(25): compression to H_in intersect anchor-perp. -/
def compressedReflection (phi : K → EuclideanSpace ℂ I) (a k : K) : Matrix I I ℂ :=
let Q := samplePi (pureSamples phi) - pureDensity (phi a)
Q * sampleReflection (phi k) * Q
/-- PDF p.7, Eq.(24): compressed sampleReflection channel. -/
def compressedReflectionChannel (phi : K → EuclideanSpace ℂ I) (a : K) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
∑ k, (nonanchorProbability a k : ℂ) •
(compressedReflection phi a k * rho * compressedReflection phi a k)
/-- PDF p.7, Eq.(26): norm of the vectorized compressed channel. -/
def lambdaPerp (phi : K → EuclideanSpace ℂ I) (a : K) : ℝ :=
QAlgorithms.specNorm (∑ k, (nonanchorProbability a k : ℂ) • Matrix.kronecker
(compressedReflection phi a k) (fun i j => conj (compressedReflection phi a k i j)))
/-- PDF p.8, Eq.(35): exact, unnormalized residual. -/
def residual (phi : K → EuclideanSpace ℂ I) (a : K) (psi : EuclideanSpace ℂ I) (h : List K) : EuclideanSpace ℂ I :=
h.foldl (fun v k => act (sampleReflection (phi k) * (1 - pureDensity (phi a))) v) psi
/-- PDF p.8: unary address, including residual t=T. -/
def unaryWord (T t : ℕ) : Qubits T := fun j => decide ((j : ℕ) < t)
/-- PDF p.8, Eq.(34): the full expansion retains its residual term. -/
def coordinateExpansion {T : ℕ} (phi : K → EuclideanSpace ℂ I) (a : K)
(h : Fin T → K) (psi : EuclideanSpace ℂ I) : EuclideanSpace ℂ (I × Qubits T) :=
(∑ t : Fin T, (inner ℂ (phi a) (residual phi a psi ((List.ofFn h).take t.val))) •
tensorVec (phi a) (ket (unaryWord T t.val))) +
tensorVec (residual phi a psi (List.ofFn h)) (ket (unaryWord T T))
/-- PDF p.32, H3: average sample density. -/
def meanSampleDensity (phi : K → EuclideanSpace ℂ I) : Matrix I I ℂ := (Fintype.card K : ℂ)⁻¹ • ∑ k, pureDensity (phi k)
/-- PDF pp.31–32: actual Fig.7 branch. Same history is used forward and backward;
false is span detection, true is the all-minus outcome. -/
def projectionBranch (phi : K → EuclideanSpace ℂ I) (T : ℕ) (b : Bool) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
((Fintype.card K : ℂ) ^ T)⁻¹ • ∑ h : Fin T → K,
let V := historyUnitary (fun k => systemControlled (sampleReflection (phi k))) h
let P := Matrix.kronecker (1 : Matrix I I ℂ) (pureDensity (minusRegister T))
let Q := if b then P else 1 - P
traceRight (densityConjugation Vᴴ (densityConjugation Q
(densityConjugation V (Matrix.kronecker rho (pureDensity (minusRegister T))))))
/-- PDF p.32: channel discarding the Fig.7 label. -/
def projectionChannel (phi : K → EuclideanSpace ℂ I) (T : ℕ) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
projectionBranch phi T false rho + projectionBranch phi T true rho
/-- PDF p.33, H19: randomized conjugated projective measurement. -/
def gentleChannel (p : L → ℝ) (V : L → Matrix I I ℂ) (P : A → Matrix I I ℂ) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
∑ l, (p l : ℂ) • ∑ a, densityConjugation ((V l)ᴴ * P a * V l) rho
/-- PDF p.34, H21: actual expected outcome probability. -/
def gentleProbability (p : L → ℝ) (V : L → Matrix I I ℂ) (P : A → Matrix I I ℂ)
(rho : Matrix I I ℂ) (a : A) : ℝ := ∑ l, p l * effectProb (P a) (densityConjugation (V l) rho)
/-- PDF p.33: complete orthogonal projectors; zero projectors are allowed. -/
def ProjectiveFamily (P : A → Matrix I I ℂ) : Prop :=
(∀ a, (P a).IsHermitian ∧ P a * P a = P a) ∧
(∀ a b, a ≠ b → P a * P b = 0) ∧ ∑ a, P a = 1
/-- PDF p.20: positive-sign matrix exponential, e^(i theta H). -/
def positivePhaseEvolution (H : Matrix I I ℂ) (theta : ℝ) : Matrix I I ℂ := NormedSpace.exp ((Complex.I * theta) • H)
/-- PDF pp.7–8, Eq.(31): quantum Fisher information of a differentiable normalized
pure-state family. The theorem uses the actual analytic exp(i alpha P) family, so no
nondifferentiability default of deriv is involved. -/
def pureFisherInformation (v : ℝ → EuclideanSpace ℂ I) (alpha : ℝ) : ℝ :=
4 * (‖deriv v alpha‖ ^ 2 - ‖inner ℂ (v alpha) (deriv v alpha)‖ ^ 2)
/-- PDF p.24: n independently prepared pure reference registers. -/
def referenceVector (phi : EuclideanSpace ℂ I) (n : ℕ) : EuclideanSpace ℂ (Fin n → I) :=
WithLp.toLp 2 fun x => ∏ j, phi (x j)
/-- PDF p.24, E1: SWAP of system with reference j, identity on other references. -/
def swapReference {n : ℕ} (j : Fin n) : Matrix (I × (Fin n → I)) (I × (Fin n → I)) ℂ :=
fun x y => if x.1 = y.2 j ∧ x.2 = Function.update y.2 j y.1 then 1 else 0
/-- PDF p.24, E1: full continuous interaction. -/
def swapHamiltonian (n : ℕ) (coupling : ℝ) : Matrix (I × (Fin n → I)) (I × (Fin n → I)) ℂ :=
(coupling : ℂ) • ∑ j : Fin n, swapReference j
/-- PDF p.24, E2: actual joint positivePhaseEvolution. -/
def swapJoint (phi : EuclideanSpace ℂ I) (n : ℕ) (coupling t : ℝ) (rho : Matrix I I ℂ) : Matrix (I × (Fin n → I)) (I × (Fin n → I)) ℂ :=
densityConjugation (positivePhaseEvolution (swapHamiltonian n coupling) (-t))
(Matrix.kronecker rho (pureDensity (referenceVector phi n)))
/-- PDF p.24, E3: effective Hamiltonian with the n+1 coefficient. -/
def effectiveHamiltonian (phi : EuclideanSpace ℂ I) (n : ℕ) (coupling : ℝ) : Matrix I I ℂ :=
((coupling * (n + 1) : ℝ) : ℂ) • pureDensity phi
/-! Construction sanity checks. -/
example (v : EuclideanSpace ℂ I) (alpha : ℝ) : pureFisherInformation (fun _ : ℝ => v) alpha = 0 := by
simp [pureFisherInformation]
example (phi : K → EuclideanSpace ℂ I) (a : K) (psi : EuclideanSpace ℂ I) : residual phi a psi [] = psi := rfl
example (W : L → Matrix (I × Bool) (I × Bool) ℂ) (h : Fin 0 → L) : historyUnitary W h = 1 := by
simp [historyUnitary]
example (x : Qubits 0) : minusRegister 0 x = 1 := by simp [minusRegister]
example (T : ℕ) (j : Fin T) : unaryWord T 0 j = false := by simp [unaryWord]
example (T : ℕ) (j : Fin T) : unaryWord T T j = true := by simp [unaryWord, j.isLt]
example (V : Matrix I I ℂ) (i j : I) : systemControlled V (i,false) (j,true) = 0 := rfl
example (phi : K → EuclideanSpace ℂ I) (a : K) : nonanchorProbability a a = 0 := by simp [nonanchorProbability]
example (phi : EuclideanSpace ℂ I) (n : ℕ) (t : ℝ) (rho : Matrix I I ℂ) :
swapJoint phi n 0 t rho = Matrix.kronecker rho (pureDensity (referenceVector phi n)) := by
simp [swapJoint, swapHamiltonian, positivePhaseEvolution, densityConjugation]
/-- PDF p.4, Fig.2: unsuccessful output is the old system wire from the SWAP.
The successful wire is reconstructed. These differ from Appendix A on failure. -/
def wireBranch (phi : K → EuclideanSpace ℂ I) (a : K) (U : Matrix I I ℂ) (T : ℕ) (b : Bool) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
if b then
∑ h : Fin T → K, (historyWeight (nonanchorProbability a) h : ℂ) •
traceRight (densityConjugation (Matrix.kronecker (1 - pureDensity (phi a)) (1 : Matrix (Qubits T) (Qubits T) ℂ))
(densityConjugation (historyUnitary (erasureGate phi a) h)
(Matrix.kronecker rho (pureDensity (minusRegister T)))))
else traceRight (jointBranch (nonanchorProbability a) (erasureGate phi a)
(transportedGate U (erasureGate phi a)) (phi a) (act U (phi a)) T false rho)
/-- PDF p.28, G1: systemControlled density-matrix translations. -/
def mixedGate (S : K → Matrix I I ℂ) (a k : K) (t : ℝ) : Matrix (I × Bool) (I × Bool) ℂ :=
systemControlled (positivePhaseEvolution (S k) (-t)) * Matrix.kronecker (1 : Matrix I I ℂ) hadamard *
systemControlled (positivePhaseEvolution (S a) (-Real.pi))
/-- PDF p.28: entrywise Lebesgue integration of the continuous one-round body.
For density samples the matrix exponential body is continuous on the compact interval. -/
def mixedSampleErasureChannel (S : K → Matrix I I ℂ) (a : K) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
(Fintype.card K : ℂ)⁻¹ • ∑ k,
fun i j => ∫ t in Set.Icc (0 : ℝ) 1,
traceRight (densityConjugation (mixedGate S a k t) (Matrix.kronecker rho (pureDensity minusVector))) i j
/-- PDF p.28: history unitary for fixed mixed-sample indices and real times. -/
def mixedHistory {T : ℕ} (S : K → Matrix I I ℂ) (a : K) (h : Fin T → K) (ts : Fin T → ℝ) :
Matrix (I × Qubits T) (I × Qubits T) ℂ :=
(List.ofFn fun j : Fin T => onAncilla (mixedGate S a (h j) (ts j)) j).foldl (fun V G => G * V) 1
/-- PDF p.28: fixed mixed-history output after system replacement and reconstruction. -/
def mixedHistoryOutput {T : ℕ} (S : K → Matrix I I ℂ) (a : K) (phi : EuclideanSpace ℂ I)
(U : Matrix I I ℂ) (rho : Matrix I I ℂ) (h : Fin T → K) (ts : Fin T → ℝ) : Matrix I I ℂ :=
let Vin := mixedHistory S a h ts
let Vout := Matrix.kronecker U (1 : Matrix (Qubits T) (Qubits T) ℂ) * Vin *
Matrix.kronecker Uᴴ (1 : Matrix (Qubits T) (Qubits T) ℂ)
traceRight (densityConjugation Voutᴴ (Matrix.kronecker (pureDensity (act U phi))
(traceLeft (densityConjugation Vin (Matrix.kronecker rho (pureDensity (minusRegister T)))))))
/-- PDF p.28: actual mixed-sample emulator, with independent uniform times and indices.
Entrywise integrals are over a compact cube of a continuous finite-matrix body. -/
def mixedEmulate (S : K → Matrix I I ℂ) (a : K) (phi : EuclideanSpace ℂ I) (U : Matrix I I ℂ)
(T : ℕ) (rho : Matrix I I ℂ) : Matrix I I ℂ :=
((Fintype.card K : ℂ) ^ T)⁻¹ • ∑ h : Fin T → K,
fun i j => ∫ ts in Set.pi Set.univ (fun _ : Fin T => Set.Icc (0 : ℝ) 1),
mixedHistoryOutput S a phi U rho h ts i j
/-- PDF p.28, G2: tagged sample densities plus a pure bridge (none). -/
def bridgeSamples (S : K → Matrix I I ℂ) (phi : EuclideanSpace ℂ I) (alpha beta : ℂ) : Option (Bool × K) → Matrix (I × Bool) (I × Bool) ℂ
| none => pureDensity (tensorVec phi (WithLp.toLp 2 fun b => if b then beta else alpha))
| some (b,k) => Matrix.kronecker (S k) (pureDensity (ket b))
/-- PDF p.29, G3: positive-sign Fourier-densityConjugation basis. -/
def conjugateBasis {d : ℕ} (theta : Fin d → EuclideanSpace ℂ I) (j : Fin d) : EuclideanSpace ℂ I :=
∑ k, ((((Real.sqrt d)⁻¹ : ℝ) : ℂ) *
Complex.exp (Complex.I * (2 * Real.pi * k.val * j.val / d : ℝ))) • theta k
/-- PDF pp.29–30: normalized uniform address state. -/
def uniformAddress (d : ℕ) : EuclideanSpace ℂ (Fin d) := WithLp.toLp 2 fun _ => ((Real.sqrt d)⁻¹ : ℂ)
/-- PDF p.30, G7: negative-sign normalized DFT. This corrects G7's missing
normalization and ket index; G6 and G11 determine this sign. -/
def negativeFourier (d : ℕ) : Matrix (Fin d) (Fin d) ℂ :=
fun j k => ((Real.sqrt d)⁻¹ : ℂ) *
Complex.exp (-Complex.I * (2 * Real.pi * j.val * k.val / d : ℝ))
/-- PDF pp.29–30, G4/G8: full spectral exponential, hence identity on H_in-perp. -/
def basisPhase {d : ℕ} (theta : Fin d → EuclideanSpace ℂ I) : Matrix (I × Fin d) (I × Fin d) ℂ :=
fun x y => if x.2 = y.2 then
positivePhaseEvolution (∑ k : Fin d, (k.val : ℂ) • pureDensity (theta k))
(2 * Real.pi * x.2.val / d) x.1 y.1 else 0
/-- PDF p.22, D5: cyclic increment on the binary address. -/
def increment (q : ℕ) : Matrix (Fin (2 ^ q)) (Fin (2 ^ q)) ℂ :=
fun x y => if x.val = (y.val + 1) % (2 ^ q) then 1 else 0
/-- PDF p.22, D6: Fig.6 effective operation on system/address, with the helper
returned to |minus>. The address is initialized at zero, correcting D8's printed |t>. -/
def binaryMeasure (phi : EuclideanSpace ℂ I) (q : ℕ) : Matrix (I × Fin (2 ^ q)) (I × Fin (2 ^ q)) ℂ :=
Matrix.kronecker (pureDensity phi) 1 + Matrix.kronecker (1 - pureDensity phi) (increment q)
/-- PDF p.23, D7: address-selective sampleReflection; t is a natural address. -/
def addressedReflection (phi : EuclideanSpace ℂ I) (q t : ℕ) : Matrix (I × Fin (2 ^ q)) (I × Fin (2 ^ q)) ℂ :=
fun x y => if x.2 = y.2 then
(if x.2.val = t then sampleReflection phi else 1) x.1 y.1 else 0
/-- PDF pp.22–23: actual binary history F(t+1,k) V, using addresses 1 through T. -/
def binaryHistory {T : ℕ} (phi : K → EuclideanSpace ℂ I) (a : K) (q : ℕ) (h : Fin T → K) :
Matrix (I × Fin (2 ^ q)) (I × Fin (2 ^ q)) ℂ :=
(List.ofFn fun j : Fin T => addressedReflection (phi (h j)) q (j.val+1) * binaryMeasure (phi a) q).foldl (fun V G => G * V) 1
/-- PDF pp.22–23: linear reencoding of the unary subspace, extended by zero elsewhere. -/
def encodeUnary (q T : ℕ) (v : EuclideanSpace ℂ (I × Qubits T)) : EuclideanSpace ℂ (I × Fin (2 ^ q)) :=
WithLp.toLp 2 fun x => ∑ t : Fin (T+1),
if x.2.val = t.val then v (x.1, unaryWord T t.val) else 0
/-- PDF p.11: SWAP between two equal-dimensional registers. -/
def registerSwap : Matrix (I × I) (I × I) ℂ := fun x y => if x.1 = y.2 ∧ x.2 = y.1 then 1 else 0
/-- PDF p.11: double-systemControlled full-register SWAP, with both controls ancillary. -/
def doubleControlledSwap : Matrix ((I × I) × (Bool × Bool)) ((I × I) × (Bool × Bool)) ℂ :=
fun x y => if x.2 = y.2 then
(if x.2.1 && x.2.2 then registerSwap else 1) x.1 y.1 else 0
/-- PDF pp.19–21: source elementary gate set, one-qubit unitaries and two-control
SWAPs acting on four distinct qubit wires. -/
inductive ElementaryGate (N : ℕ) where
| one (wire : Fin N) (U : Matrix.unitaryGroup Bool ℂ)
| ccswap (wires : Fin 4 ↪ Fin N)
/-- PDF pp.19–21: complete matrix semantics of the counted elementary gates. -/
def elementaryMatrix {N : ℕ} : ElementaryGate N → Matrix (Qubits N) (Qubits N) ℂ
| .one q U => fun x y =>
if ∀ l, l ≠ q → x l = y l then (U : Matrix Bool Bool ℂ) (x q) (y q) else 0
| .ccswap w => fun x y =>
if x = (if y (w 0) && y (w 1) then
Function.update (Function.update y (w 2) (y (w 3))) (w 3) (y (w 2)) else y)
then 1 else 0
/-- PDF pp.19–21: a circuit using supplied indexed density copies and fixed ancillary
bits. Ports are disjoint by one injection; gates do not receive the unknown U or samples.
The output is the main system and all other wires are traced out. -/
structure SampleCircuit (n : ℕ) (K : Type*) where
N : ℕ
copies : ℕ
ports : (Fin n ⊕ (Fin copies × Fin n)) ↪ Fin N
labels : Fin copies → Bool × K
auxiliaryBits : Qubits N
gates : List (ElementaryGate N)
/-- PDF pp.19–21: product input with actual independent supplied sample copies. -/
def SampleCircuit.initial {n : ℕ} (C : SampleCircuit n K)
(records : Bool × K → Matrix (Qubits n) (Qubits n) ℂ) (rho : Matrix (Qubits n) (Qubits n) ℂ) : Matrix (Qubits C.N) (Qubits C.N) ℂ :=
fun x y => rho (fun j => x (C.ports (.inl j))) (fun j => y (C.ports (.inl j))) *
(∏ r, records (C.labels r)
(fun j => x (C.ports (.inr (r,j)))) (fun j => y (C.ports (.inr (r,j))))) *
(if ∀ q, q ∉ Set.range C.ports → x q = C.auxiliaryBits q ∧ y q = C.auxiliaryBits q then 1 else 0)
/-- PDF pp.19–21: source circuit channel; gate cost is literally gates.length. -/
def SampleCircuit.output {n : ℕ} (C : SampleCircuit n K)
(records : Bool × K → Matrix (Qubits n) (Qubits n) ℂ) (rho : Matrix (Qubits n) (Qubits n) ℂ) : Matrix (Qubits n) (Qubits n) ℂ :=
let V := (C.gates.map elementaryMatrix).foldl (fun V G => G * V) 1
let X := densityConjugation V (C.initial records rho)
fun i j => ∑ x : Qubits C.N, ∑ y : Qubits C.N,
if (∀ l, x (C.ports (.inl l)) = i l ∧ y (C.ports (.inl l)) = j l) ∧
(∀ q, q ∉ Set.range (fun l => C.ports (.inl l)) → x q = y q) then X x y else 0
/-- PDF p.19: actual supplied input/output records, with no coherent phase reference. -/
def inputOutputRecords (phi : K → EuclideanSpace ℂ I) (U : Matrix I I ℂ) : Bool × K → Matrix I I ℂ :=
fun bk => if bk.1 then densityConjugation U (pureDensity (phi bk.2)) else pureDensity (phi bk.2)
/-- PDF pp.19–21: one uniform family of sample circuits, fixed before the unknown
sample vectors, U, and the new input. T and m are precision controls; history is classical. -/
abbrev EmulatorFamily := ∀ n k : ℕ, Fin k → (T m : ℕ) → (Fin T → Fin k) → SampleCircuit n (Fin k)
example (phi : EuclideanSpace ℂ I) (x : Fin 0 → I) : referenceVector phi 0 x = 1 := by
simp [referenceVector]
/-- PDF p.19: fixed ideal-error allocation eps/2 and at most eps/2 for all DME calls.
For rank one no erasure rounds are needed. This corrects the printed allocation after B21,
whose substitution into B19 gives more than eps. Constants only are rescaled. -/
def precisionRounds (d : ℕ) (lam eps : ℝ) : ℕ :=
if d ≤ 1 then 0 else max 1 ⌈Real.log (8 * eps⁻¹ ^ 2 * (d - 1 : ℝ)) / (1-lam)⌉₊
/-- PDF pp.7,19: explicit polylogarithmic multiplier used to spell out O-tilde. -/
def slowFactor (d : ℕ) (eps : ℝ) (power : ℕ) : ℝ :=
(1 + Real.log (d+1) + Real.log (1+eps⁻¹)) ^ power
/-- PDF p.22: binary circuits also accept the number of address qubits q. -/
abbrev BinaryEmulatorFamily := ∀ n k : ℕ, Fin k → (q T m : ℕ) →
(Fin T → Fin k) → SampleCircuit n (Fin k)
end QAlgorithms.Papers.Independent.Intakethird100.P67
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Intakethird100.P67.BinaryEmulatorFamily
This abbreviates the type of all families that, for every pair of natural numbers , every anchor , every three natural numbers , and every history , return a sample circuit on -qubit registers with sample labels in . Such a circuit consists of a natural number of physical qubits, a natural number of sample copies, an injective map placing the input wires and the sample wires into the physical wires, a Boolean-and-index label for each sample copy, a fixed Boolean value for every physical wire, and a list of elementary gates. An elementary gate is either an arbitrary one-qubit unitary or a gate on four distinct wires that swaps the last two wires exactly when the first two are both true. Given input and sample matrices, initialization places them on their respective ports and puts all remaining wires in their designated computational-basis states; the output applies the gates in list order and traces out every wire except the input ports. This abbreviation imposes no resource, correctness, or computability condition. All natural parameters may be zero; when , there is no anchor argument to supply.
QAlgorithms.Papers.Independent.Intakethird100.P67.ElementaryGate
For every natural number , an elementary gate on wires is one of two kinds: a choice of a wire together with a unitary complex matrix indexed by the two Boolean values, or an injective assignment of four distinct wires. The second kind carries no additional matrix parameter. The definition permits , when there are no elementary gates; the four-wire kind is available only when .
QAlgorithms.Papers.Independent.Intakethird100.P67.EmulatorFamily
An emulator family is a function that, for every pair of natural numbers , every anchor , every pair of natural numbers , and every sequence , returns a sample circuit on -wire registers whose labels belong to . Such a circuit specifies its own physical wire count, number of record registers, injective allocation of the input and record ports, Boolean-label pairs for its records, auxiliary Boolean assignment, and finite list of one-wire unitary or four-wire controlled-swap gates. There are no resource bounds or correctness conditions and no required relationship between and the returned circuit. The case uses the unique empty sequence; and are allowed. When , there is no anchor argument, so no circuit is required for that value of .
QAlgorithms.Papers.Independent.Intakethird100.P67.Generates
For a finite index type with decidable equality, a finite label type , and arbitrary complex matrices , let be the complex linear span of all nonempty finite ordered products of the , allowing repeated labels, and let in real continuous functional calculus, with and for . This defines the assertion that, for every complex matrix , if and only if . For a Hermitian sum, projects onto its nonzero eigenspaces; for a non-Hermitian sum it is zero, so the assertion then requires . An empty label type satisfies this assertion.
QAlgorithms.Papers.Independent.Intakethird100.P67.InSampleSupport
For a finite index type with decidable equality, a finite label type , arbitrary complex matrices , and an arbitrary complex matrix , this defines the assertion , where in real continuous functional calculus, with and for nonzero real . If the sum is Hermitian, projects onto its nonzero eigenspaces; if it is not Hermitian, . No positivity or trace condition is imposed on . In particular, when is empty or the sum is non-Hermitian, the assertion is equivalent to .
QAlgorithms.Papers.Independent.Intakethird100.P67.ProjectiveFamily
For finite index types , with decidable equality on , and any family , this predicate means that every is Hermitian and satisfies , every two distinct labels satisfy , and
Zero projectors are allowed. If is empty, the individual and pairwise conditions are vacuous and the final condition is , which holds precisely when is empty.
QAlgorithms.Papers.Independent.Intakethird100.P67.SampleCircuit.initial
For any natural number , label type , sample circuit with physical wires and additional registers, arbitrary matrices and on -bit strings, this definition constructs a matrix on -bit strings as follows. Write for the restriction of to the distinguished input ports and for its restriction to additional register , and similarly for ; write for the circuit’s specified auxiliary Boolean assignment. Then
No positivity or trace assumptions are imposed on the supplied matrices. The auxiliary assignment on port wires does not enter this expression, and when the product is ; when , the supplied register matrices are matrices.
QAlgorithms.Papers.Independent.Intakethird100.P67.SampleCircuit
For a natural number and an arbitrary label type , a sample circuit consists of natural numbers and , an injection from the disjoint union into the physical wires, a label for each , a Boolean assignment to all wires, and a finite ordered list of elementary gates on those wires. The injection allocates mutually distinct wires to one distinguished -wire register and to each of the additional -wire registers, so . Labels may repeat. Zero values of , , or , and an empty gate list, are allowed whenever the specified injection and labels exist; no normalization or correctness conditions are included.
QAlgorithms.Papers.Independent.Intakethird100.P67.SampleCircuit.output
For any natural number , label type , sample circuit , arbitrary record matrices , and arbitrary input matrix , let be the matrices of its elementary gates in list order: a one-wire gate applies its specified unitary on that wire and preserves every other bit, while a four-wire gate swaps its last two specified wires exactly when its first two specified bits are true. Set , with for an empty list, and set , where
when both and equal the prescribed auxiliary assignment outside all ports, and otherwise. Here the restrictions refer to the distinguished input ports and the additional register ports of . The output entry at -bit strings is
Thus the definition traces out every physical wire outside the distinguished input register, including the record registers. It requires no positivity or normalization of the supplied matrices and includes zero-sized registers and empty gate lists.
QAlgorithms.Papers.Independent.Intakethird100.P67.addressedReflection
For an index type with decidable equality, any vector , and natural numbers , put . This defines a matrix on with zero entries between different address values; its block at address is if , and otherwise, where . No normalization of is required. If , the whole matrix is the identity; for , its sole address block is when , and the identity otherwise.
QAlgorithms.Papers.Independent.Intakethird100.P67.basisPhase
For a finite index type with decidable equality, a natural number , and any family indexed by , put . This defines the matrix on whose entry at row and column is when , and zero otherwise, where the exponential is the matrix exponential. No normalization or orthogonality of the is assumed. When , the matrix has an empty index set.
QAlgorithms.Papers.Independent.Intakethird100.P67.binaryHistory
For a finite index type with decidable equality, an index type , natural numbers , any family , an anchor , and a sequence , put , , and let be the address shift with entries . Set , and let be block diagonal in the address, with block at address and identity blocks elsewhere. This defines , with the empty product equal to the identity when . No vectors are required to be normalized, and no relation between and is imposed: when , is the identity while the factor remains.
QAlgorithms.Papers.Independent.Intakethird100.P67.binaryMeasure
For an index type with decidable equality, any vector , and any natural number , put and . This defines the complex matrix on with entry at row and column , where is the Kronecker delta. No normalization of is assumed. When , this matrix is the identity.
QAlgorithms.Papers.Independent.Intakethird100.P67.bridgeSamples
For index types and , any family of complex matrices indexed by , any vector , and any , this defines a matrix-valued function on an optional pair consisting of a Boolean and an element of . Put and . At the absent value, its entry from column to row is . At a present value , that entry is if , and zero otherwise. No normalization of , or positivity or trace condition on , is required.
QAlgorithms.Papers.Independent.Intakethird100.P67.coherentErasureChannel
For finite index types and , arbitrary real weights , arbitrary complex matrices indexed by , and an arbitrary complex matrix indexed by , this defines
where denotes conjugate transpose and the partial trace means . The real weights are regarded as complex scalars in this matrix sum. No normalization or positivity of or , and no unitarity of , is required. If is empty, the result is the zero matrix.
QAlgorithms.Papers.Independent.Intakethird100.P67.compressedReflection
For finite index types , with decidable equality on , an arbitrary family , and elements , this defines
Here , and is applied to the matrix by the real continuous functional calculus, so is the spectral projection onto the nonzero eigenspaces of the positive semidefinite sum. The vectors need not be normalized or linearly independent, and and may coincide. If every is zero, the defined matrix is zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.compressedReflectionChannel
For finite index types with decidable equality, any family , an anchor , and any complex matrix indexed by , define by , and let , using matrix functional calculus with and for . Put , , and when , otherwise . The definition returns
The vectors need not be normalized, and need not be a density matrix. The anchor makes nonempty; if has one element, the result is zero. The subtraction in is natural-number subtraction, and division uses the convention .
QAlgorithms.Papers.Independent.Intakethird100.P67.conjugateBasis
For an index type , a natural number , any family , and an index , this defines the vector . The vectors are not required to be normalized, orthogonal, or a basis. The parameter is included, but then there is no index at which to evaluate this definition.
QAlgorithms.Papers.Independent.Intakethird100.P67.coordinateExpansion
For a finite index type with decidable equality, an index type , any natural number , family , anchor , history , and vector , define , , and . Let be the length- Boolean word whose bit is true exactly when . The definition returns the vector indexed by pairs , with and a length- Boolean word, given by
Here is the indicated equality indicator. No vectors are required to be normalized. For , the sum is empty and for the unique empty word .
QAlgorithms.Papers.Independent.Intakethird100.P67.densityConjugation
For a finite index type and arbitrary complex matrices indexed by , this defines their density conjugation to be , where is the conjugate transpose. Neither unitarity of nor positivity or normalization of is assumed; the definition also applies when is empty.
QAlgorithms.Papers.Independent.Intakethird100.P67.doubleControlledSwap
For an index type with decidable equality, this defines a complex matrix indexed by . Its entry at row and column is zero unless ; when the Boolean pairs agree, the entry is if both and are true, and otherwise. Thus the two -registers are swapped exactly in the block where both Boolean values are true. If is empty, the matrix is empty.
QAlgorithms.Papers.Independent.Intakethird100.P67.effectiveHamiltonian
For a coordinate index type , any vector , natural number , and real coupling , this defines the complex matrix
No normalization of or sign restriction on is imposed. In particular, gives , and gives the zero matrix.
QAlgorithms.Papers.Independent.Intakethird100.P67.elementaryMatrix
For every natural number , this definition assigns a complex matrix, with rows and columns indexed by Boolean strings , to each elementary gate on wires. For a one-wire gate specified by and a unitary matrix , its entry is if for every , and is zero otherwise. For a four-wire gate specified by an injection , its entry is precisely when is obtained from by swapping the values on wires and if both and are true, and by leaving unchanged otherwise; every other entry is zero. In the swap case, the two replacement values are both taken from the original string .
QAlgorithms.Papers.Independent.Intakethird100.P67.emulate
For finite index types with decidable equality, an arbitrary vector family , an anchor , a complex matrix on , a natural number , and a matrix on , this defines the matrix
Here and for , with natural-number subtraction and reciprocal zero equal to zero; , , and . Outer products have entries . To specify the history matrices, put and let have entry when both Boolean indices are true, when both are false, and zero when they differ; set
Then and are the reverse-order products of and , respectively, each embedded on the system and bit by retaining its entries when all other bits agree and using zero otherwise. The inner partial trace sums equal indices, and the outer partial trace sums equal length- ancillary bitstrings. At the history products and weight are identities and , respectively. If is a singleton and , all history weights vanish. No normalization of or , positivity of , or unitarity of is assumed.
QAlgorithms.Papers.Independent.Intakethird100.P67.encodeUnary
For an index type , natural numbers , and any vector indexed by , define to be the length- bit string whose coordinate is true exactly when . This defines a vector indexed by by ; equivalently, if , and zero otherwise. No condition is required: values associated with have no output address, and values of on bit strings other than the are unused. When , only address zero can have a nonzero coordinate.
QAlgorithms.Papers.Independent.Intakethird100.P67.eraseProbability
For finite index types , arbitrary real weights , complex matrices on , a vector , a natural number , and a matrix on , this defines
Here , in Boolean order , and the partial trace has entries . The exponent on means successive applications of this function, with the identity function. Thus at the value is . No hypotheses ensure that this real number is a probability: the weights, vector, matrices, and input are unrestricted.
QAlgorithms.Papers.Independent.Intakethird100.P67.erasureGate
For a finite index type with decidable equality, an arbitrary label type , a family , and labels , this defines the matrix on . Here , with ; preserves the Boolean coordinate and acts by on its true block and by the identity on its false block; and, in Boolean order , . The rightmost factor acts first. The labels may coincide, and no normalization of the vectors is assumed.
QAlgorithms.Papers.Independent.Intakethird100.P67.gentleChannel
For finite index types , with decidable equality on , any real-valued function , complex matrix families and , and complex matrix indexed by , set . The definition returns
Real weights are regarded as complex scalars. The definition imposes no positivity or normalization on , no unitarity on , no projector conditions on , and no density-matrix conditions on . If either summation index type is empty, the result is zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.gentleProbability
For finite index types , with decidable equality on , an index type , any function , complex matrix families and , complex matrix indexed by , and selected label , the definition returns the real number
There are no distribution, unitarity, effect, projector, or density-matrix hypotheses on these arguments, so the definition itself does not require this number to lie in . If is empty, it is zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.historyUnitary
For a finite system index type with decidable equality, a label type , a natural number , a family of complex matrices indexed by , and a history , this defines the matrix
where are bitstrings of length . Thus the factor with index acts first under matrix multiplication on column vectors. For , the result is the identity matrix. No unitarity assumption is imposed on the matrices .
QAlgorithms.Papers.Independent.Intakethird100.P67.historyWeight
For a label type , a natural number , an arbitrary real-valued function , and a history , this defines the real number
The function need not be nonnegative or sum to one. For , the product is , including when is empty.
QAlgorithms.Papers.Independent.Intakethird100.P67.increment
For every natural number , put . This defines the complex matrix whose entry at row and column is one if , and zero otherwise, for . Thus it shifts each coordinate basis vector forward by one modulo . In particular, gives the identity matrix.
QAlgorithms.Papers.Independent.Intakethird100.P67.inputOutputRecords
For a label type , a finite coordinate type , any family of complex vectors , and any complex matrix on , this definition assigns to each Boolean-label pair the matrix
Neither normalization of the vectors nor unitarity of is assumed; an empty label type or empty coordinate type is allowed.
QAlgorithms.Papers.Independent.Intakethird100.P67.jointBranch
For finite index types , with decidable equality on the system indices, arbitrary weights , matrix families on and on , vectors and , a natural number , a Boolean , and a matrix on , this defines
Here , , outer products have entries , and . Each is , with if the bitstrings agree outside , and zero otherwise; sums equal system indices. No positivity, normalization, or unitarity hypotheses are imposed. At there is one empty history of weight , even if is empty, and both history products are identities; if is empty and , the sum is zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.jointBranchHistory
For finite system index types with decidable equality, a label type , a natural number , arbitrary matrix families on and on , vectors and , a history , a Boolean , and an arbitrary matrix on , this defines
Here , , , and for each length- bitstring . Each is the product , where has entry when agree outside , and zero otherwise. The partial trace is . For , both history products are identities and the ancillary space has one coordinate with . No vector normalization, matrix positivity, or unitarity is assumed.
QAlgorithms.Papers.Independent.Intakethird100.P67.jointEmulator
For finite index types , with decidable equality on the system indices, arbitrary real weights , matrix families on and on , vectors and , a natural number , and a matrix on , this defines
Here , , , and . Each , where acts through on the system and bit : its entry is when all other bits agree, and zero otherwise. The partial trace sums equal system indices. No normalization, positivity, or unitarity is required. For , the sole history has weight and identity history matrices; for empty and positive , the result is zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.lambdaPerp
For finite index types with decidable equality, any family , and an anchor , set , by matrix functional calculus with and for , and . With and for , the definition returns the Euclidean operator norm
where the bar means entrywise complex conjugation and is the Kronecker product. No normalization of the vectors is required. If consists only of , this value is zero; the reciprocal convention is .
QAlgorithms.Papers.Independent.Intakethird100.P67.meanSampleDensity
For any index type , finite index type , and family , the definition returns the complex matrix
The vectors are arbitrary and need not have norm one. If is empty, the sum and the resulting matrix are zero, with the reciprocal of zero interpreted as zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.minusRegister
For every natural number , including , this defines a complex vector indexed by Boolean strings , with coordinate , where and . Equivalently, its coordinate is . When , there is one empty string and its coordinate is the empty product .
QAlgorithms.Papers.Independent.Intakethird100.P67.minusVector
This defines the complex vector indexed by the two Boolean values whose false coordinate is and whose true coordinate is , namely in Boolean order .
QAlgorithms.Papers.Independent.Intakethird100.P67.mixedEmulate
For finite index types , any family , anchor , vector , arbitrary matrices , and natural number , this defines the matrix whose entries are
For each history and parameter tuple, , where acts on the system and Boolean register by and preserves the other registers; applies in the false sector and in the true sector, and . Further,
The partial traces sum matching indices of the indicated register, and the integral is entrywise with respect to product Lebesgue measure. The histories include occurrences of the anchor. No normalization, positivity, Hermitian, or unitarity hypotheses are imposed. The anchor requires ; is allowed, with one empty history, normalization factor , and integration over the singleton empty tuple.
QAlgorithms.Papers.Independent.Intakethird100.P67.mixedGate
For a finite coordinate index type , any family , indices , and real number , this defines
on the system and a Boolean register ordered false, true. Here preserves the Boolean register, applies the identity to the system when that register is false, and applies when it is true; the rightmost factor acts first. The matrices need not be Hermitian, and is unrestricted, so unitarity is not an input hypothesis.
QAlgorithms.Papers.Independent.Intakethird100.P67.mixedHistory
For a finite coordinate index type , any index type , family , anchor , natural number , history , and real parameters , this defines
where acts on the system and Boolean register by
and preserves all other Boolean registers. Explicitly, when for every , and is zero otherwise; applies in the false sector and in the true sector. No Hermitian assumptions or bounds on the real parameters are imposed. For , the product is the identity.
QAlgorithms.Papers.Independent.Intakethird100.P67.mixedHistoryOutput
For a finite coordinate index type , any index type , family , anchor , vector , arbitrary matrices , natural number , history , and real parameters , let , where acts on the system and Boolean register by and preserves the other registers; here applies in the false sector and in the true sector, and . With
the definition returns
The partial traces sum matching indices of the indicated register. No normalization, positivity, Hermitian, or unitarity hypotheses are imposed. The case is included: , , and under the empty-register identification.
QAlgorithms.Papers.Independent.Intakethird100.P67.mixedSampleErasureChannel
For finite index types , any family , anchor , and arbitrary matrix , this defines the matrix with entries
where , , and
The controlled matrix applies on the false Boolean sector and on the true sector, and the partial trace sums the two matching Boolean indices. The integral is taken entry by entry with respect to Lebesgue measure. The sum includes ; the existence of requires to be nonempty. No Hermitian condition on or density-matrix condition on is imposed.
QAlgorithms.Papers.Independent.Intakethird100.P67.negativeFourier
For every natural number , this defines the complex matrix with rows and columns indexed by and entries . For , this is the empty matrix, so there are no entries at which the division by is evaluated.
QAlgorithms.Papers.Independent.Intakethird100.P67.nonanchorProbability
For a finite type with decidable equality and elements , this defines
where the subtraction is performed in the natural numbers before conversion to a real number, and the reciprocal of zero is defined to be zero. In particular, when , the function is identically zero. If is empty, there are no elements to which the definition can be applied.
QAlgorithms.Papers.Independent.Intakethird100.P67.onAncilla
For an index type , a natural number , a complex matrix indexed by , and an index , this defines a matrix indexed by . For system indices and bitstrings of length , its entry is
There is no assumption that is unitary. When , there is no admissible index .
QAlgorithms.Papers.Independent.Intakethird100.P67.positivePhaseEvolution
For a finite index type with decidable equality, any complex matrix indexed by , and any real number , the definition returns the matrix exponential
There is no Hermitian hypothesis on or restriction on ; in particular, returns the identity matrix.
QAlgorithms.Papers.Independent.Intakethird100.P67.precisionRounds
For every natural number , including , and arbitrary real numbers , this defines the natural number
Here inside the logarithm is real subtraction, and is the least natural number at least , giving for . There are no restrictions on or : inverses and division are total, with and division by zero equal to zero, while the real logarithm has and . Consequently, for , either or gives the value .
QAlgorithms.Papers.Independent.Intakethird100.P67.projectionBranch
For finite index types with decidable equality, any family , natural number , Boolean , and complex matrix indexed by , put and . Let be the vector on length- Boolean words with , and set . For each history , let apply to the system when ancilla bit is true and apply the identity when it is false, leaving every other ancilla bit unchanged, and set , with the empty product equal to the identity. Taking if is true and otherwise, the definition returns
where . No normalization, positivity, or unitarity hypotheses are imposed on , or the resulting matrices . For , the true branch returns and the false branch returns zero; if is empty and , both return zero. Reciprocals use , and .
QAlgorithms.Papers.Independent.Intakethird100.P67.projectionChannel
For finite index types with decidable equality, any family , natural number , and complex matrix indexed by , define by , let on length- Boolean words, and put . For each history , form , where applies to the system conditional on ancilla bit being true and leaves the other ancillas unchanged. The definition returns
where the inner sum means the two displayed choices, and partial trace sums equal ancilla indices. There are no normalization or positivity assumptions on the inputs. For it returns ; for empty and it returns zero, using and .
QAlgorithms.Papers.Independent.Intakethird100.P67.pureFisherInformation
For a coordinate index type , a function in complex Euclidean space, and any , this defines the real number
The complex inner product conjugates its first argument. No normalization or differentiability hypothesis is imposed on ; the derivative is the total derivative operation, which returns zero when is not differentiable at .
QAlgorithms.Papers.Independent.Intakethird100.P67.pureSamples
For arbitrary index and label types and a family of complex vectors , this defines the matrix family by . No normalization or nonzero condition is imposed on the vectors; in particular, a zero vector gives the zero matrix.
QAlgorithms.Papers.Independent.Intakethird100.P67.referenceVector
For any coordinate index type , vector , and natural number , this defines a vector indexed by functions , whose coordinate at is
No normalization is required of . The case is included: there is one empty indexing function, and its coordinate is the empty product .
QAlgorithms.Papers.Independent.Intakethird100.P67.registerSwap
For an index type with decidable equality, this defines the complex matrix on whose entry at row and column is one exactly when and , and zero otherwise. Thus it sends the coordinate basis vector indexed by to that indexed by . The type is not required to be nonempty; if it is empty, the matrix is empty.
QAlgorithms.Papers.Independent.Intakethird100.P67.residual
For a finite index type with decidable equality, an index type , any family , anchor , vector , and finite list of elements of , let . Starting with , successively form
The definition returns , with matrix action given by ordinary matrix-vector multiplication. An empty list returns ; repeated labels and unnormalized vectors are allowed.
QAlgorithms.Papers.Independent.Intakethird100.P67.sampleAlgebra
For a finite index type with decidable equality, an arbitrary label type , and a family of complex matrices, this defines the complex linear subspace spanned by all products with . Labels may repeat, and the factors retain their listed order. Thus its elements are finite complex linear combinations of nonempty products; the empty product is excluded from the generating set. If is empty, this subspace is .
QAlgorithms.Papers.Independent.Intakethird100.P67.sampleDimension
For a finite index type with decidable equality, a finite label type , and arbitrary complex matrices , this defines the natural number , viewing as a complex linear map on . Here is obtained by real continuous functional calculus with and for nonzero real . For a Hermitian sum, this counts its nonzero eigenvalues with multiplicity; for a non-Hermitian sum, it is zero. It is also zero when or is empty.
QAlgorithms.Papers.Independent.Intakethird100.P67.samplePi
For a finite index type with decidable equality, a finite label type , and arbitrary complex matrices , put . This defines using real continuous functional calculus, where and for every nonzero real . When is Hermitian, is the orthogonal projection onto the sum of its nonzero eigenspaces, including eigenspaces with negative eigenvalues. When is not Hermitian, the totalized real functional calculus returns the zero matrix. No positivity assumption is imposed on the samples or their sum; an empty label type gives .
QAlgorithms.Papers.Independent.Intakethird100.P67.sampleReflection
For an index type with decidable equality and an arbitrary complex vector , this defines the matrix , whose -entry is . No normalization is assumed. In particular, gives the identity matrix.
QAlgorithms.Papers.Independent.Intakethird100.P67.slowFactor
For every natural number , every real , and every natural number , this defines
where the additions involving are real arithmetic. No positivity or nonzero assumption is imposed on ; the inverse is total with , and the real logarithm is total with and . In particular, gives , and gives , including when the base is zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.swapHamiltonian
For a coordinate index type , any natural number , and any real coupling , this defines the complex matrix
on indices , where has entry from column to row exactly when and equals with coordinate replaced by , and has entry otherwise. The coupling may be negative or zero. For , the sum is empty and .
QAlgorithms.Papers.Independent.Intakethird100.P67.swapJoint
For a finite coordinate index type , any vector , natural number , real numbers , and arbitrary complex matrix indexed by , this defines
where exchanges the distinguished -coordinate with reference coordinate , and has entries . No normalization of , positivity or trace condition on , or sign restriction on is imposed. The case uses the one-dimensional empty reference register, , and , so the resulting matrix has entries under the natural identification with the distinguished register.
QAlgorithms.Papers.Independent.Intakethird100.P67.swapReference
For a coordinate index type , a natural number , and an index , this defines a complex matrix indexed by pairs , where and . Its entry in row and column is exactly when and is obtained from by replacing its -th coordinate with ; otherwise the entry is . Thus its action exchanges the distinguished coordinate with reference coordinate . When , there is no admissible choice of .
QAlgorithms.Papers.Independent.Intakethird100.P67.systemControlled
For an index type with decidable equality and an arbitrary complex matrix , this defines a matrix indexed by . Its entry from to is zero when , is when , and is when . Thus the Boolean coordinate controls whether or the identity acts on the -coordinate. No unitarity assumption is imposed on .
QAlgorithms.Papers.Independent.Intakethird100.P67.transportedGate
For a finite system index type , a label type , an arbitrary complex matrix on , and an arbitrary family of complex matrices on , this defines the family
where is the identity matrix on the Boolean index and denotes conjugate transpose. Neither nor the matrices are assumed unitary.
QAlgorithms.Papers.Independent.Intakethird100.P67.unaryWord
For all natural numbers , the definition returns the Boolean word of length whose bit at position is true exactly when . Thus its first bits are true and its remaining bits are false. In particular, gives the all-false word, gives the all-true word, and gives the unique empty word.
QAlgorithms.Papers.Independent.Intakethird100.P67.uniformAddress
For every natural number , this defines the vector in whose every coordinate equals . When , the coordinate set is empty and the result is the unique vector in the zero-dimensional space; the real inverse of zero is defined to be zero.
QAlgorithms.Papers.Independent.Intakethird100.P67.wireBranch
For finite index types , any family of vectors in , anchor , arbitrary complex matrices indexed by , natural number , and Boolean , this defines the following matrix. Write , , if and otherwise, where the subtraction is natural-number subtraction and the real inverse of zero is zero. For any system matrix , let preserve a Boolean register and apply when that register is false and when it is true; let in the order false, true, and put . For a history , let apply to the system and Boolean register , in increasing order of , and let be the corresponding product with each replaced by . Set
If is true, the result is
If is false, the result is
Here each partial trace sums matching row and column indices of the indicated register. No normalization, positivity, or unitarity hypotheses are imposed on the inputs. For , there is one empty history, its weight is , and both history products are identities; if is a singleton and , all history weights are zero.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.