Definitions for Quantum majority vote
DefinitionQAlgorithms_Papers_Independent_Gap48_P23The objects the formalized statements of Quantum majority vote (arXiv:2211.11729) are stated in. Each was checked against the paper by a blind read-back and a moderator.
permuteWord: PDF p.10, (2.1): action on words, with the inverse permutation.wordPermutationMatrix: PDF p.10, (2.1): physical permutation matrix.encodedInput: PDF p.11, (2.8): input density for an unknown word and common basis.targetDensity: PDF p.11, (2.9): ideal single-qudit output density.WordSymmetric: PDF p.12, Definition 2.3: symmetry under every coordinate permutation.Equivariant: PDF p.12, Definition 2.3: equivariance under every alphabet permutation.inputFidelity: PDF p.11, (2.10): squared overlap with the normalized pure target.fidelityValues: PDF pp.11-12, Definition 2.2: all allowed squared overlaps. For a channel, a nonempty promise and d>=1 these values form a nonempty bounded subset of [0,1]. No averaging over x or U is used.functionFidelity: PDF p.11, (2.11): worst case, used only with lawful channels and nonempty promises.optimalFunctionFidelity: PDF p.12: channel chosen before every unknown x and U. Attainment is retained explicitly by the optimality statements rather than inferred from this supremum.IsFunctionOptimal: PDF p.12: the channel attains the maximal worst-case fidelity.booleanWordWeight: PDF p.12: number of ones in a Boolean word.weightRepresentative: PDF p.17: the representative 0^(n-h)1^h; uses h<=n in every statement.majority: PDF pp.12,37: majority, with odd positive n imposed by theorems.parity: PDF p.36: Boolean parity.majorityPromise: PDF pp.1,38: minority booleanWordWeight at most floor(n/q), q=3 for the abstract/proof, q=6 for the distinct stronger printed promise on pp.5,37.PermutationInvariant: PDF p.15, Definition 2.7: equality on every operator.WordUnitaryEquivariant: PDF p.15, Definition 2.8: covariance on every operator.permutationSymmetrization: PDF p.14, (2.26): exact finite permutation average.unitarySymmetrization: PDF p.14, (2.26): normalized Haar twirling, on every operator.functionOutputChoi: PDF p.10, (2.5): unnormalized Choi matrix, output tensor input.ofChoi: PDF p.10, (2.6): inverse Choi map, on every operator.idealNot: PDF p.14, (2.25): the ideal complex-linear NOT, not a quantum channel.CompletelyPositive: PDF p.11: CP positivity tested on every reference system. This unbundled predicate is used only for maps whose linearity follows from their explicit body.polynomialIrrep: PDF p.58, (C.9): literal normalized-monomial coefficients. The guards are exactly the factorial/exponent domain, so natural subtraction never clips a term.monomialKet: PDF p.60, (C.15): normalized monomial ket, also defined at ell=0 and psi=0.blockDiagonal: PDF pp.63-64: direct sum of matrices, including an empty first sector.ordinaryCG: PDF p.63, (C.44): ordinary CG with the source real phases; nonexistent boundary kets are omitted by equality guards.dualCG: PDF p.64, (C.49): dual CG, S acts on the first qubit only.lowerCGAction: PDF p.63, (C.41): the first CG sector is absent at ell=0, rather than T^0.lowerDualAction: PDF p.64, (C.51): first dual sector, with empty ell=0 sector.extremalChoi: PDF pp.27-28, (4.4): literal D-based endpoint Choi matrices.extremalChannel: PDF p.27, Lemma 4.1: source endpoints defined by inverse Choi, on all operators.symmetricEmbedding: PDF p.29, (4.16): the accepted real Dicke embedding, in physical Bool coordinates.dickeColumnProjector: PDF p.65, (D.2): projector constructed from the Dicke columns.symmetricEmbeddingChannel: PDF p.68, (D.26): embedding channel, on all operators.partialTraceChannel: PDF p.29, (4.18): trace all but the first qubit. The ell>=1 theorem guard makes site zero valid; the zero-copy total value is unused.universalNotChannel: PDF p.29, (4.19): measure coherent states and prepare their orthogonal state. The accepted definition uses the complex trace booleanWordWeight, preserving linearity.PolynomialCovariant: PDF p.27: covariance uses exactly T^ell(U) on input and U on output.traceKraus: PDF p.73, (E.10): partial-trace Kraus family, including both adjacent bras.notKraus: PDF p.73, (E.11): negative first amplitude; endpoints need no invalid bras.traceIsometry: PDF p.77, (E.51): exact source lower isometry. For ell>=1 the accepted Fin((ell-1)+1) environment is naturally the source ell-dimensional space.notIsometry: PDF p.77, (E.52): exact source phases, the negative of the accepted upper isometry.traceMatrixUnit: PDF p.74, (E.17): all matrix-unit branches, not just diagonal probabilities.notMatrixUnit: PDF p.74, (E.18): both negative off-diagonal amplitudes are preserved.TwoRowShape: PDF p.18: two-row shape (n-k,k), including k=0.degree: PDF p.18: degree and dimension of the unitary register.schurMultiplicity: PDF p.18, (3.5): schurMultiplicity; the binomial predecessor at k=0 is zero.SchurIndex: PDF p.20: total coordinate index, with dependent ranges for w and i.RealSchurCoefficients: PDF p.20: the source's fixed real coefficient family, reused at every booleanWordWeight.wordAt: Physical coordinate lookup used only to avoid ill-typed boundary indices. All indices in the source seed are in range for a valid shape.schurSeed: PDF p.20, (3.11): Dicke vector followed by k ordered normalized singlets. The source |01>-|10> phase is retained.schurVector: PDF p.20, (3.13): actual constructed vectors, never an arbitrary Schur isometry.LawfulCoefficients: PDF p.20, (3.14)-(3.15): the ONLY basis assumptions are at w=0. Neither orthogonality at other weights nor block covariance is assumed.schurTransform: PDF p.21, (3.19): rows of the source Schur transform.preprocessingBranch: PDF p.21, Algorithm 1: retain the unitary register and trace schurMultiplicity.ReducedIndex: PDF p.21, Algorithm 1: classical shape label and quantum unitary register.preprocessing: PDF p.21: measuring the label removes cross-sector coherences.schurRecovery: PDF pp.23-24: schurRecovery measures the shape, tensors I_d/d, and applies inverse Schur. It is constructed independently of its left-inverse property.permutationTwirl: PDF p.23, (3.31): the input permutation unitarySymmetrization.partitionIrrep: PDF p.63, (C.39): polynomial partition action, including singular M.reducedAction: PDF p.21: direct-sum output action.samplingProbability: PDF p.22, (3.22), corrected support: printed k<=h, CHANGED k<=h<=n-k. WHY: h-k must be a valid unitary-register coordinate; at n=3,h=3,k=1 the printed probability is 2. Independent moderation of this correction is required.predictedBranch: PDF p.22: unnormalized block, with branch ket formed only on its support.template: PDF p.30, Algorithm 2: interpolation parameters fixed before all unknown inputs.permutationBlock: PDF p.49: permutation block computed in the w=0 coordinates.unitarySubspace: PDF p.56, (3.16): actual unitary subspace at a fixed schurMultiplicity label.schurWeightProbability: PDF p.31, (4.25): signed binomial difference, choose(n,-1)=0.lpTraceCoefficient: PDF p.31, (4.26): every subtraction is real.lpNotCoefficient: PDF p.31, (4.27): every subtraction is real.FunctionLPFeasible: PDF p.31, (LP): exactly floor(n/2)+2 real variables, and one fidelity inequality plus two cube inequalities per lower-half booleanWordWeight, hence 3floor(n/2)+3 constraints. No division is in naturals.majorityWeightFidelity: PDF p.37, (5.6): all-partial-trace per-booleanWordWeight majority fidelity.recurrenceA: PDF p.80, (F.5): recurrence coefficients, only used at 1<=h<=floor(n/2).recurrenceB: PDF p.80, (F.5): the signed numerator must not use natural subtraction.majorityRecurrence: PDF pp.36,82, Lemma 5.1: g(0)=0 is an unused totalization; the outer factor multiplies the ENTIRE bracket including +1.tableFunction: PDF p.35: lower-half truth table read left to right as the binary digits of mask; the upper half is determined by equivariance. Used only for odd n.smallFidelities: PDF p.35: literal finite tables; no extrapolated suffix rule.parityFidelities: PDF p.36: twenty computed parity values, n=1,3,...,39, without conjectural extrapolation.schurDicke: PDF p.20, (3.12): Dicke ket; invalid weights give zero. Valid weights in theorems are always bounded by ell.pairDicke: PDF p.69, (D.31): (ell+1)-qubit symmetric vector in first-qubit/rest coordinates.primedDicke: PDF p.69, (D.32): the primed Dicke vectors, with the negative second term.physicalSymmetricSpace: PDF p.68, (D.28): C^2 tensor Sym(ell).traceSubspace: PDF p.69, (D.33): actual partial-trace sector.notSubspace: PDF p.68, (D.29): actual UNOT sector in the same ambient space.singletDicke: PDF p.69, (D.37): ordered normalized singlet followed by ell-1 symmetric qubits.symmetricCG: PDF p.71, (D.48): rectangular physical CG from its actual row bras.symmetricDualCG: PDF p.72, (D.55): S on the first qubit, identity on ALL ell remaining qubits.DiagramVertex: PDF pp.51-53: vertices are left (false) and right (true) qubit endpoints.singletEdge: PDF p.51: source ordered singlet pair edges on one side.diagramAdjacent: PDF pp.51-52, (B.22): connectivity comes only from pi wires and seed pairs.diagramFree: PDF p.51: free endpoints are precisely the unpaired symmetric-register sites.diagramConnected: PDF p.51: paths follow the actual graph, independently of Hamming weights.ProperMatching: PDF p.51: a proper matching joins every pair of distinct free endpoints in a connected path on opposite sides. Closed loops are allowed.diagramLoops: PDF p.53: closed connected components, counted once as finite vertex sets.ValidDiagramColoring: PDF pp.51-54: binary contraction labels: wires preserve bits, singlets flip bits, and free endpoints are fixed at 0. This is an independent graph coloring specification, not an assumption on the desired matrix element.diagramSign: PDF p.53, (B.35): product of oriented S-entry signs in a fixed admissible coloring. A closed loop may be colored either way; its even number of singlet edges makes this product independent of that choice. The unused noncolorable case is totalized by +1. All reversed ordered singlets contribute their minus.bilinearVectorize: PDF p.45, (A.2): unnormalized vectorization, row index first.vectorizedBra: PDF p.45, footnote 13: bilinear vectorized bra, NOT Hilbert conjugate transpose.vectorSwap: PDF p.45: the two-system swap in the same tensor coordinates.singleContraction: PDF pp.45-46, (A.9): literal tensor contraction of a vectorized ket and bra.networkChain: PDF p.46, (A.10)-(A.12): independent tensor-network coefficient sum. The path has L edges and L+1 vertex labels, with its two endpoints fixed. This definition is a sum over internal tensor indices, not a matrix product.alternatingFactors: PDF p.46: alternating factors, with k A/B pairs and optionally a final A.alternatingMatrixProduct: PDF p.46: ordered product A_1 B_1 ... A_k B_k.singletMatrix: PDF p.48, (A.24): real antisymmetric singlet matrix.normalizedSingletMatrix: PDF p.51: normalized singlet matrix, whose vectorization is |Psi^->.reversedKetFactors: PDF pp.48,51: replace selected vectorized KETS by their transposes. Only even-position factors are kets; odd-position factors remain the bras.reversalCount: Count reversed kets actually present (k in the even chain; k+1 otherwise).appendixMatrixLayout: PDF pp.83-85: literal shared row layout of the eight printed 16x16 matrices. Each named matrix below supplies all eight integer entries and its printed scale; no channel or optimality assumption enters this construction.optimalChoiID: PDF p.82, G.1: literal identity Choi matrix.optimalChoiNOT: PDF p.82, G.1: literal optimal NOT Choi matrix, scale 1/3.optimalChoiMAJ3: PDF p.83, G.1: literal MAJ3 Choi matrix, scale 1/9.optimalChoiPAR3: PDF p.83, G.1: literal PAR3 Choi matrix, scale 1/15.optimalChoiNPAR3: PDF p.83, G.1: literal NPAR3 Choi matrix, scale 1/5.optimalChoiNMAJ3: PDF p.84, G.1: literal NMAJ3 Choi matrix, scale 1/45.idealChoiID: PDF p.84, G.2: literal ideal identity matrix, scale 1.idealChoiNOT: PDF p.84, G.2: literal ideal NOT matrix, scale 1.idealChoiMAJ3: PDF p.84, G.2: literal ideal MAJ3 matrix, scale 1/6.idealChoiPAR3: PDF p.85, G.2: literal ideal PAR3 matrix, scale 1/3.idealChoiNPAR3: PDF p.85, G.2: literal ideal NPAR3 matrix, scale 1/3.idealChoiNMAJ3: PDF p.85, G.2: literal ideal NMAJ3 matrix, scale 1/6.flatOne: Output-first lexicographic one-input coordinate order, PDF pp.82,84.flatThree: Output-first lexicographic three-input coordinate order, PDF pp.83-85.appendixOneChannel: PDF pp.82-85: inverse Choi applied to the literal one-input matrices.appendixThreeChannel: PDF pp.83-85: inverse Choi applied to the literal three-input matrices.elementaryGateSet: PDF p.33: exactly arbitrary unitary one-qubit gates and CNOT, with named wires supplied by the accepted Circuit syntax. No coefficient oracle is a gate.OneOutputCircuit: PDF pp.11,33,78-79: initialize zero ancillas, apply a finite chronological list of the specified gates, retain a named output qubit and discard the rest.circuitOutput: PDF p.11: exact mixed-input channel semantics, after the specified binary embedding J. Equality is on all operators, including entangled-input extensions.wordBinaryEmbedding: PDF p.33: coordinate identification of the source Fin-2 word with Bool wires.controlledBinaryEmbedding: PDF pp.78-79: binary embedding of a qubit and a (ell+1)-dimensional label.controlledRotation: PDF p.78, (E.58)-(E.60): label-controlled real rotation, with no oracle.controlledDecrement: PDF p.78, (E.61): decrement label modulo ell+1 if qubit is one.controlledIncrement: PDF p.79, (E.64): increment label modulo ell+2 if qubit is zero.paddedRotation: PDF pp.78-79: binary padding is identity outside valid labels.paddedDecrement: PDF pp.78-79: decrement padding is identity outside valid labels.paddedIncrement: PDF p.79: increment padding is identity outside valid labels.
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Channel
import Definitions.Def_QAlgorithms_Defs_Circuit
import Definitions.Def_QAlgorithms_Defs_FiniteRegisters
import Definitions.Def_QAlgorithms_Defs_Measurement
import Definitions.Def_QAlgorithms_Defs_SchurUnitaryEnsembles
import Definitions.Def_QAlgorithms_Papers_Independent_Support21_P18
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P21
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P22
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P34
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P58
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P63
/-! Statements from Buhrman et al., Quantum majority vote, arXiv:2211.11729v1.
All page references are PDF pages. The finite alphabet is `Fin d`; thus Boolean
words use `Fin 2`, with the usual zero/one identification. All new definitions
are local to this paper; exact frozen helpers are imported and opened below. The accepted library is imported without modification.
Compilation is pending the external mechanical handoff. -/
noncomputable section
namespace QAlgorithms.Papers.Independent.Gap48.P23
open MeasureTheory
open scoped ComplexConjugate Matrix ComplexOrder
attribute [local instance] Classical.propDecidable
attribute [local instance] Classical.decEq
-- Exact frozen coordinate helpers; no paper-local redeclarations.
open QAlgorithms.Papers.Independent.Information100.P58 (Word)
open QAlgorithms.Papers.Independent.Information100.P21 (Op)
open QAlgorithms.Papers.Independent.Information100.P63 (tensorPower)
/-- PDF p.10, (2.1): action on words, with the inverse permutation. -/
def permuteWord {n d : ℕ} (p : Equiv.Perm (Fin n)) (x : Word n d) : Word n d :=
Equiv.arrowCongr p (Equiv.refl (Fin d)) x
/-- PDF p.10, (2.1): physical permutation matrix. -/
def wordPermutationMatrix (n d : ℕ) (p : Equiv.Perm (Fin n)) : Op (Word n d) :=
QAlgorithms.Papers.Independent.Information100.P34.permutationMatrix
(Equiv.arrowCongr p (Equiv.refl (Fin d)))
/-- PDF p.11, (2.8): input density for an unknown word and common basis. -/
def encodedInput {n d : ℕ} (U : Op (Fin d)) (x : Word n d) : Op (Word n d) :=
conjSuperop (tensorPower n U) (Matrix.single x x 1)
/-- PDF p.11, (2.9): ideal single-qudit output density. -/
def targetDensity {d : ℕ} (U : Op (Fin d)) (b : Fin d) : Op (Fin d) :=
conjSuperop U (Matrix.single b b 1)
/-- PDF p.12, Definition 2.3: symmetry under every coordinate permutation. -/
def WordSymmetric {n d : ℕ} (f : Word n d → Fin d) : Prop :=
∀ p x, f (permuteWord p x) = f x
/-- PDF p.12, Definition 2.3: equivariance under every alphabet permutation. -/
def Equivariant {n d : ℕ} (f : Word n d → Fin d) : Prop :=
∀ (p : Equiv.Perm (Fin d)) x, f (p ∘ x) = p (f x)
/-- PDF p.11, (2.10): squared overlap with the normalized pure target. -/
def inputFidelity {n d : ℕ} (f : Word n d → Fin d)
(Phi : Superop (Word n d) (Fin d))
(x : Word n d) (U : Matrix.unitaryGroup (Fin d) ℂ) : ℝ :=
effectProb (targetDensity U.val (f x)) (Phi (encodedInput U.val x))
/-- PDF pp.11-12, Definition 2.2: all allowed squared overlaps.
For a channel, a nonempty promise and d>=1 these values form a nonempty bounded
subset of [0,1]. No averaging over x or U is used. -/
def fidelityValues {n d : ℕ} (P : Word n d → Prop) (f : Word n d → Fin d)
(Phi : Superop (Word n d) (Fin d)) : Set ℝ :=
{r | ∃ x, P x ∧ ∃ U : Matrix.unitaryGroup (Fin d) ℂ, r = inputFidelity f Phi x U}
/-- PDF p.11, (2.11): worst case, used only with lawful channels and nonempty promises. -/
def functionFidelity {n d : ℕ} (P : Word n d → Prop) (f : Word n d → Fin d)
(Phi : Superop (Word n d) (Fin d)) : ℝ := sInf (fidelityValues P f Phi)
/-- PDF p.12: channel chosen before every unknown x and U. Attainment is retained
explicitly by the optimality statements rather than inferred from this supremum. -/
def optimalFunctionFidelity {n d : ℕ} (P : Word n d → Prop) (f : Word n d → Fin d) : ℝ :=
sSup {r | ∃ Phi : Superop (Word n d) (Fin d), IsChannel Phi ∧
r = functionFidelity P f Phi}
/-- PDF p.12: the channel attains the maximal worst-case fidelity. -/
def IsFunctionOptimal {n d : ℕ} (P : Word n d → Prop) (f : Word n d → Fin d)
(Phi : Superop (Word n d) (Fin d)) : Prop :=
IsChannel Phi ∧ functionFidelity P f Phi = optimalFunctionFidelity P f
/-- PDF p.12: number of ones in a Boolean word. -/
def booleanWordWeight {n : ℕ} (x : Word n 2) : ℕ := (Finset.univ.filter (fun i => x i = 1)).card
/-- PDF p.17: the representative 0^(n-h)1^h; uses h<=n in every statement. -/
def weightRepresentative (n h : ℕ) : Word n 2 := fun i => if i.val < n - h then 0 else 1
/-- PDF pp.12,37: majority, with odd positive n imposed by theorems. -/
def majority (n : ℕ) (x : Word n 2) : Fin 2 := if n < 2 * booleanWordWeight x then 1 else 0
/-- PDF p.36: Boolean parity. -/
def parity (n : ℕ) (x : Word n 2) : Fin 2 := ⟨booleanWordWeight x % 2, Nat.mod_lt _ (by omega)⟩
/-- PDF pp.1,38: minority booleanWordWeight at most floor(n/q), q=3 for the abstract/proof,
q=6 for the distinct stronger printed promise on pp.5,37. -/
def majorityPromise (n q : ℕ) (x : Word n 2) : Prop := min (booleanWordWeight x) (n - booleanWordWeight x) ≤ n / q
/-- PDF p.15, Definition 2.7: equality on every operator. -/
def PermutationInvariant {n d : ℕ} (Phi : Superop (Word n d) (Fin d)) : Prop :=
∀ p rho, Phi (conjSuperop (wordPermutationMatrix n d p) rho) = Phi rho
/-- PDF p.15, Definition 2.8: covariance on every operator. -/
def WordUnitaryEquivariant {n d : ℕ} (Phi : Superop (Word n d) (Fin d)) : Prop :=
∀ (U : Matrix.unitaryGroup (Fin d) ℂ) rho,
Phi (conjSuperop (tensorPower n U.val) rho) = conjSuperop U.val (Phi rho)
/-- PDF p.14, (2.26): exact finite permutation average. -/
def permutationSymmetrization {n d : ℕ} (Phi : Superop (Word n d) (Fin d)) : Superop (Word n d) (Fin d) :=
fun rho => (1 / (Nat.factorial n : ℂ)) •
∑ p : Equiv.Perm (Fin n), Phi (conjSuperop (wordPermutationMatrix n d p) rho)
/-- PDF p.14, (2.26): normalized Haar twirling, on every operator. -/
def unitarySymmetrization {n d : ℕ} (Phi : Superop (Word n d) (Fin d)) : Superop (Word n d) (Fin d) :=
fun rho a b => ∫ U : Matrix.unitaryGroup (Fin d) ℂ,
(conjSuperop U.valᴴ (Phi (conjSuperop (tensorPower n U.val) rho))) a b
∂Schur.unitaryHaar d
/-- PDF p.10, (2.5): unnormalized Choi matrix, output tensor input. -/
def functionOutputChoi {I O : Type*} [Fintype I] [DecidableEq I] (Phi : Superop I O) : Op (O × I) :=
fun a b => QAlgorithms.Papers.Independent.Information100.P34.choi Phi
(a.2, a.1) (b.2, b.1)
/-- PDF p.10, (2.6): inverse Choi map, on every operator. -/
def ofChoi {I O : Type*} [Fintype I] (J : Op (O × I)) : Superop I O :=
fun rho a b => ∑ i, ∑ j, J (a, i) (b, j) * rho i j
/-- PDF p.14, (2.25): the ideal complex-linear NOT, not a quantum channel. -/
def idealNot : Superop (Fin 2) (Fin 2) := fun rho => rho.trace • 1 - rho
/-- PDF p.11: CP positivity tested on every reference system. This unbundled
predicate is used only for maps whose linearity follows from their explicit body. -/
def CompletelyPositive {I O : Type*} (Phi : Superop I O) : Prop :=
∀ r : ℕ, ∀ X : Op (Fin r × I), X.PosSemidef → (idTensorSuperop Phi X).PosSemidef
example : weightRepresentative 1 0 0 = 0 := by rfl
example (d : ℕ) (M : Op (Fin d)) (x y : Word 0 d) : tensorPower 0 M x y = 1 := by
simp [tensorPower]
example : idealNot (0 : Op (Fin 2)) = 0 := by simp [idealNot]
example {I O : Type*} [Fintype I] [DecidableEq I] (Phi : Superop I O) (a b : O) (i j : I) :
functionOutputChoi Phi (a, i) (b, j) = Phi (Matrix.single i j 1) a b := by rfl
/-- PDF p.58, (C.9): literal normalized-monomial coefficients. The guards are
exactly the factorial/exponent domain, so natural subtraction never clips a term. -/
def polynomialIrrep (ell : ℕ) (M : Op (Fin 2)) : Op (Fin (ell + 1)) :=
fun j k => (Real.sqrt ((Nat.factorial j.val : ℝ) * Nat.factorial (ell - j.val) *
Nat.factorial k.val * Nat.factorial (ell - k.val)) : ℂ) *
∑ r ∈ Finset.range (ell + 1),
if r + j.val ≤ ell ∧ r + k.val ≤ ell ∧ ell ≤ j.val + k.val + r then
M 0 0 ^ r * M 0 1 ^ (ell - j.val - r) * M 1 0 ^ (ell - k.val - r) *
M 1 1 ^ (j.val + k.val + r - ell) /
((Nat.factorial r : ℂ) * Nat.factorial (ell - j.val - r) *
Nat.factorial (ell - k.val - r) * Nat.factorial (j.val + k.val + r - ell))
else 0
/-- PDF p.60, (C.15): normalized monomial ket, also defined at ell=0 and psi=0. -/
def monomialKet (ell : ℕ) (psi : EuclideanSpace ℂ (Fin 2)) :
EuclideanSpace ℂ (Fin (ell + 1)) :=
WithLp.toLp 2 fun k => (Real.sqrt (Nat.choose ell k.val : ℝ) : ℂ) *
psi 0 ^ (ell - k.val) * psi 1 ^ k.val
/-- PDF pp.63-64: direct sum of matrices, including an empty first sector. -/
def blockDiagonal {I J : Type*} (A : Op I) (B : Op J) : Op (I ⊕ J) :=
fun x y => match x, y with
| Sum.inl i, Sum.inl j => A i j
| Sum.inr i, Sum.inr j => B i j
| _, _ => 0
/-- PDF p.63, (C.44): ordinary CG with the source real phases; nonexistent
boundary kets are omitted by equality guards. -/
def ordinaryCG (ell : ℕ) : Matrix (Fin ell ⊕ Fin (ell + 2)) (Fin 2 × Fin (ell + 1)) ℂ :=
fun row col =>
let i := col.1.val
let k := col.2.val + i
match row with
| Sum.inl v => if v.val + 1 = k then
(if i = 0 then (Real.sqrt (k : ℝ) : ℂ)
else -(Real.sqrt ((ell : ℝ) + 1 - k) : ℂ)) / (Real.sqrt ((ell : ℝ) + 1) : ℂ)
else 0
| Sum.inr w => if w.val = k then
(if i = 0 then (Real.sqrt ((ell : ℝ) + 1 - k) : ℂ)
else (Real.sqrt (k : ℝ) : ℂ)) / (Real.sqrt ((ell : ℝ) + 1) : ℂ)
else 0
/-- PDF p.64, (C.49): dual CG, S acts on the first qubit only. -/
def dualCG (ell : ℕ) := ordinaryCG ell *
Matrix.kronecker (!![0, 1; -1, 0] : Op (Fin 2)) (1 : Op (Fin (ell + 1)))
/-- PDF p.63, (C.41): the first CG sector is absent at ell=0, rather than T^0. -/
def lowerCGAction (ell : ℕ) (M : Op (Fin 2)) : Op (Fin ell) :=
fun i j => M.det * polynomialIrrep (ell - 1) M
⟨i.val, by omega⟩ ⟨j.val, by omega⟩
/-- PDF p.64, (C.51): first dual sector, with empty ell=0 sector. -/
def lowerDualAction (ell : ℕ) (M : Op (Fin 2)) : Op (Fin ell) :=
fun i j => polynomialIrrep (ell - 1) M ⟨i.val, by omega⟩ ⟨j.val, by omega⟩
/-- PDF pp.27-28, (4.4): literal D-based endpoint Choi matrices. -/
def extremalChoi (ell : ℕ) (second : Bool) : Op (Fin 2 × Fin (ell + 1)) :=
(dualCG ell)ᴴ * blockDiagonal
(if second then 0 else (((ell : ℂ) + 1) / ell) • (1 : Op (Fin ell)))
(if second then (((ell : ℂ) + 1) / (ell + 2)) • (1 : Op (Fin (ell + 2))) else 0) * dualCG ell
/-- PDF p.27, Lemma 4.1: source endpoints defined by inverse Choi, on all operators. -/
def extremalChannel (ell : ℕ) (second : Bool) : Superop (Fin (ell + 1)) (Fin 2) :=
ofChoi (extremalChoi ell second)
/-- PDF p.29, (4.16): the accepted real Dicke embedding, in physical Bool coordinates. -/
abbrev symmetricEmbedding := QAlgorithms.Papers.Independent.Support21.P18.occupationEmbedding
/-- PDF p.65, (D.2): projector constructed from the Dicke columns. -/
def dickeColumnProjector (ell : ℕ) : Op (Qubits ell) :=
symmetricEmbedding ell * (symmetricEmbedding ell)ᴴ
/-- PDF p.68, (D.26): embedding channel, on all operators. -/
def symmetricEmbeddingChannel (ell : ℕ) : Superop (Fin (ell + 1)) (Qubits ell) :=
conjSuperop (symmetricEmbedding ell)
/-- PDF p.29, (4.18): trace all but the first qubit. The ell>=1 theorem guard
makes site zero valid; the zero-copy total value is unused. -/
def partialTraceChannel (ell : ℕ) : Superop (Fin (ell + 1)) (Fin 2) :=
fun rho => if h : 0 < ell then
QAlgorithms.Papers.Independent.Support21.P18.siteReduction
(symmetricEmbeddingChannel ell rho) ⟨0, h⟩ else 0
/-- PDF p.29, (4.19): measure coherent states and prepare their orthogonal state.
The accepted definition uses the complex trace booleanWordWeight, preserving linearity. -/
abbrev universalNotChannel := QAlgorithms.Papers.Independent.Support21.P18.measurementNot
/-- PDF p.27: covariance uses exactly T^ell(U) on input and U on output. -/
def PolynomialCovariant (ell : ℕ) (Phi : Superop (Fin (ell + 1)) (Fin 2)) : Prop :=
∀ (U : Matrix.unitaryGroup (Fin 2) ℂ) rho,
Phi (conjSuperop (polynomialIrrep ell U.val) rho) = conjSuperop U.val (Phi rho)
/-- PDF p.73, (E.10): partial-trace Kraus family, including both adjacent bras. -/
def traceKraus (ell : ℕ) (v : Fin ell) : Matrix (Fin 2) (Fin (ell + 1)) ℂ :=
fun i j => if i = 0 ∧ j.val = v.val then
(Real.sqrt (((ell : ℝ) - v.val) / ell) : ℂ)
else if i = 1 ∧ j.val = v.val + 1 then
(Real.sqrt (((v.val : ℝ) + 1) / ell) : ℂ) else 0
/-- PDF p.73, (E.11): negative first amplitude; endpoints need no invalid bras. -/
def notKraus (ell : ℕ) (w : Fin (ell + 2)) : Matrix (Fin 2) (Fin (ell + 1)) ℂ :=
fun i j => if i = 0 ∧ j.val + 1 = w.val then
-(Real.sqrt ((w.val : ℝ) / (ell + 2)) : ℂ)
else if i = 1 ∧ j.val = w.val then
(Real.sqrt (((ell : ℝ) + 1 - w.val) / (ell + 2)) : ℂ) else 0
/-- PDF p.77, (E.51): exact source lower isometry. For ell>=1 the accepted
Fin((ell-1)+1) environment is naturally the source ell-dimensional space. -/
abbrev traceIsometry := QAlgorithms.Papers.Independent.Support21.P18.lowerIsometry
/-- PDF p.77, (E.52): exact source phases, the negative of the accepted upper isometry. -/
def notIsometry (ell : ℕ) := -QAlgorithms.Papers.Independent.Support21.P18.upperIsometry ell
/-- PDF p.74, (E.17): all matrix-unit branches, not just diagonal probabilities. -/
def traceMatrixUnit (ell : ℕ) (w v : Fin (ell + 1)) : Op (Fin 2) :=
if w = v then Matrix.diagonal ![(((ell : ℝ) - w.val) / ell : ℂ), ((w.val : ℝ) / ell : ℂ)]
else if v.val = w.val + 1 then
(Real.sqrt (((ell : ℝ) - w.val) * v.val) / ell : ℂ) • Matrix.single 0 1 1
else if w.val = v.val + 1 then
(Real.sqrt (((ell : ℝ) - v.val) * w.val) / ell : ℂ) • Matrix.single 1 0 1
else 0
/-- PDF p.74, (E.18): both negative off-diagonal amplitudes are preserved. -/
def notMatrixUnit (ell : ℕ) (w v : Fin (ell + 1)) : Op (Fin 2) :=
if w = v then Matrix.diagonal ![(((w.val : ℝ) + 1) / (ell + 2) : ℂ),
(((ell : ℝ) + 1 - w.val) / (ell + 2) : ℂ)]
else if v.val = w.val + 1 then
(-(Real.sqrt (((ell : ℝ) + 1 - v.val) * (w.val + 1))) / (ell + 2) : ℂ) • Matrix.single 0 1 1
else if w.val = v.val + 1 then
(-(Real.sqrt (((ell : ℝ) + 1 - w.val) * (v.val + 1))) / (ell + 2) : ℂ) • Matrix.single 1 0 1
else 0
example : monomialKet 0 (0 : EuclideanSpace ℂ (Fin 2)) 0 = 1 := by simp [monomialKet]
example : ordinaryCG 0 (Sum.inr (0 : Fin 2)) (0, 0) = 1 := by
norm_num [ordinaryCG]
example (ell : ℕ) : lowerCGAction 0 (0 : Op (Fin 2)) = (0 : Op (Fin 0)) := by
funext i
exact Fin.elim0 i
example (ell : ℕ) : notKraus ell 0 0 0 = 0 := by simp [notKraus]
/-- PDF p.18: two-row shape (n-k,k), including k=0. -/
abbrev TwoRowShape (n : ℕ) := Fin (n / 2 + 1)
/-- PDF p.18: degree and dimension of the unitary register. -/
def degree (n : ℕ) (k : TwoRowShape n) : ℕ := n - 2 * k.val
/-- PDF p.18, (3.5): schurMultiplicity; the binomial predecessor at k=0 is zero. -/
def schurMultiplicity (n : ℕ) (k : TwoRowShape n) : ℕ :=
Nat.choose n k.val - if k.val = 0 then 0 else Nat.choose n (k.val - 1)
/-- PDF p.20: total coordinate index, with dependent ranges for w and i. -/
abbrev SchurIndex (n : ℕ) := Sigma fun k : TwoRowShape n => Fin (degree n k + 1) × Fin (schurMultiplicity n k)
/-- PDF p.20: the source's fixed real coefficient family, reused at every booleanWordWeight. -/
abbrev RealSchurCoefficients (n : ℕ) := (k : TwoRowShape n) → Fin (schurMultiplicity n k) → Equiv.Perm (Fin n) → ℝ
/-- Physical coordinate lookup used only to avoid ill-typed boundary indices.
All indices in the source seed are in range for a valid shape. -/
def wordAt {n : ℕ} (x : Word n 2) (j : ℕ) : Fin 2 := if h : j < n then x ⟨j, h⟩ else 0
/-- PDF p.20, (3.11): Dicke vector followed by k ordered normalized singlets.
The source |01>-|10> phase is retained. -/
def schurSeed (n : ℕ) (k : TwoRowShape n) (w : Fin (degree n k + 1)) :
EuclideanSpace ℂ (Word n 2) :=
WithLp.toLp 2 fun x =>
if (∑ j : Fin (degree n k), if wordAt x j.val = 1 then 1 else 0) = w.val then
((Real.sqrt (Nat.choose (degree n k) w.val : ℝ))⁻¹ : ℂ) *
∏ j : Fin k.val,
if wordAt x (degree n k + 2 * j.val) = 0 ∧
wordAt x (degree n k + 2 * j.val + 1) = 1 then
((Real.sqrt 2)⁻¹ : ℂ)
else if wordAt x (degree n k + 2 * j.val) = 1 ∧
wordAt x (degree n k + 2 * j.val + 1) = 0 then
-((Real.sqrt 2)⁻¹ : ℂ) else 0
else 0
/-- PDF p.20, (3.13): actual constructed vectors, never an arbitrary Schur isometry. -/
def schurVector {n : ℕ} (alpha : RealSchurCoefficients n) (a : SchurIndex n) :
EuclideanSpace ℂ (Word n 2) :=
if a.2.2.val = 0 then schurSeed n a.1 a.2.1 else
∑ p : Equiv.Perm (Fin n), (alpha a.1 a.2.2 p : ℂ) •
WithLp.toLp 2 ((wordPermutationMatrix n 2 p).mulVec (schurSeed n a.1 a.2.1))
/-- PDF p.20, (3.14)-(3.15): the ONLY basis assumptions are at w=0.
Neither orthogonality at other weights nor block covariance is assumed. -/
def LawfulCoefficients {n : ℕ} (alpha : RealSchurCoefficients n) : Prop :=
∀ k : TwoRowShape n,
(∀ i j : Fin (schurMultiplicity n k),
inner ℂ (schurVector alpha ⟨k, ⟨⟨0, by omega⟩, i⟩⟩)
(schurVector alpha ⟨k, ⟨⟨0, by omega⟩, j⟩⟩) = if i = j then 1 else 0) ∧
Submodule.span ℂ (Set.range (fun i : Fin (schurMultiplicity n k) =>
schurVector alpha ⟨k, ⟨⟨0, by omega⟩, i⟩⟩)) =
Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Fin n) =>
WithLp.toLp 2 ((wordPermutationMatrix n 2 p).mulVec (schurSeed n k ⟨0, by omega⟩))))
/-- PDF p.21, (3.19): rows of the source Schur transform. -/
def schurTransform {n : ℕ} (alpha : RealSchurCoefficients n) : Matrix (SchurIndex n) (Word n 2) ℂ :=
fun a x => conj (schurVector alpha a x)
/-- PDF p.21, Algorithm 1: retain the unitary register and trace schurMultiplicity. -/
def preprocessingBranch {n : ℕ} (alpha : RealSchurCoefficients n) (k : TwoRowShape n)
(rho : Op (Word n 2)) : Op (Fin (degree n k + 1)) :=
fun w v => ∑ i : Fin (schurMultiplicity n k),
(schurTransform alpha * rho * (schurTransform alpha)ᴴ) ⟨k, (w, i)⟩ ⟨k, (v, i)⟩
/-- PDF p.21, Algorithm 1: classical shape label and quantum unitary register. -/
abbrev ReducedIndex (n : ℕ) := Sigma fun k : TwoRowShape n => Fin (degree n k + 1)
/-- PDF p.21: measuring the label removes cross-sector coherences. -/
def preprocessing {n : ℕ} (alpha : RealSchurCoefficients n) : Superop (Word n 2) (ReducedIndex n) :=
fun rho a b => if h : a.1 = b.1 then
preprocessingBranch alpha a.1 rho a.2 (h.symm ▸ b.2) else 0
/-- PDF pp.23-24: schurRecovery measures the shape, tensors I_d/d, and applies
inverse Schur. It is constructed independently of its left-inverse property. -/
def schurRecovery {n : ℕ} (alpha : RealSchurCoefficients n) : Superop (ReducedIndex n) (Word n 2) :=
fun rho => (schurTransform alpha)ᴴ *
(Matrix.of fun (a b : SchurIndex n) => if h : a.1 = b.1 then
if a.2.2.val = b.2.2.val then rho ⟨a.1, a.2.1⟩ ⟨b.1, b.2.1⟩ /
(schurMultiplicity n a.1 : ℂ) else 0 else 0) * schurTransform alpha
/-- PDF p.23, (3.31): the input permutation unitarySymmetrization. -/
def permutationTwirl (n : ℕ) : Superop (Word n 2) (Word n 2) :=
fun rho => (1 / (Nat.factorial n : ℂ)) •
∑ p : Equiv.Perm (Fin n), conjSuperop (wordPermutationMatrix n 2 p) rho
/-- PDF p.63, (C.39): polynomial partition action, including singular M. -/
def partitionIrrep (n : ℕ) (k : TwoRowShape n) (M : Op (Fin 2)) :=
M.det ^ k.val • polynomialIrrep (degree n k) M
/-- PDF p.21: direct-sum output action. -/
def reducedAction (n : ℕ) (M : Op (Fin 2)) : Op (ReducedIndex n) :=
fun a b => if h : a.1 = b.1 then partitionIrrep n a.1 M a.2 (h.symm ▸ b.2) else 0
/-- PDF p.22, (3.22), corrected support: printed k<=h, CHANGED k<=h<=n-k.
WHY: h-k must be a valid unitary-register coordinate; at n=3,h=3,k=1 the
printed probability is 2. Independent moderation of this correction is required. -/
def samplingProbability (n h : ℕ) (k : TwoRowShape n) : ℝ :=
if k.val ≤ h ∧ h ≤ n - k.val then
((Nat.choose n k.val : ℝ) - (if k.val = 0 then 0 else (Nat.choose n (k.val - 1) : ℝ))) /
(Nat.choose n h : ℝ) else 0
/-- PDF p.22: unnormalized block, with branch ket formed only on its support. -/
def predictedBranch (n : ℕ) (k : TwoRowShape n) (h : ℕ) (U : Op (Fin 2)) : Op (Fin (degree n k + 1)) :=
if hsupport : k.val ≤ h ∧ h ≤ n - k.val then
if hvalid : h - k.val < degree n k + 1 then
(samplingProbability n h k : ℂ) • conjSuperop (partitionIrrep n k U)
(Matrix.single ⟨h - k.val, hvalid⟩ ⟨h - k.val, hvalid⟩ 1) else 0
else 0
/-- PDF p.30, Algorithm 2: interpolation parameters fixed before all unknown inputs. -/
def template {n : ℕ} (alpha : RealSchurCoefficients n) (t : TwoRowShape n → ℝ) :
Superop (Word n 2) (Fin 2) :=
fun rho => ∑ k : TwoRowShape n,
((t k : ℂ) • partialTraceChannel (degree n k) (preprocessingBranch alpha k rho) +
((1 - t k : ℝ) : ℂ) • universalNotChannel (degree n k) (preprocessingBranch alpha k rho))
/-- PDF p.49: permutation block computed in the w=0 coordinates. -/
def permutationBlock {n : ℕ} (alpha : RealSchurCoefficients n) (k : TwoRowShape n)
(p : Equiv.Perm (Fin n)) : Op (Fin (schurMultiplicity n k)) :=
fun i j => inner ℂ (schurVector alpha ⟨k, (⟨0, by omega⟩, i)⟩)
(WithLp.toLp 2 ((wordPermutationMatrix n 2 p).mulVec
(schurVector alpha ⟨k, (⟨0, by omega⟩, j)⟩)))
/-- PDF p.56, (3.16): actual unitary subspace at a fixed schurMultiplicity label. -/
def unitarySubspace {n : ℕ} (alpha : RealSchurCoefficients n) (k : TwoRowShape n) (i : Fin (schurMultiplicity n k)) :=
Submodule.span ℂ (Set.range (fun w : Fin (degree n k + 1) => schurVector alpha ⟨k, (w, i)⟩))
example : schurMultiplicity 1 0 = 1 := by norm_num [schurMultiplicity]
example : samplingProbability 3 3 ⟨1, by norm_num⟩ = 0 := by norm_num [samplingProbability]
example {n : ℕ} (alpha : RealSchurCoefficients n) (a : SchurIndex n) (hi : a.2.2.val = 0) :
schurVector alpha a = schurSeed n a.1 a.2.1 := by simp [schurVector, hi]
/-- PDF p.31, (4.25): signed binomial difference, choose(n,-1)=0. -/
def schurWeightProbability (n h k : ℕ) : ℝ :=
((Nat.choose n k : ℝ) - if k = 0 then 0 else (Nat.choose n (k - 1) : ℝ)) /
(Nat.choose n h : ℝ)
/-- PDF p.31, (4.26): every subtraction is real. -/
def lpTraceCoefficient {n : ℕ} (f : Word n 2 → Fin 2) (h k : ℕ) : ℝ :=
((n : ℝ) - h - k - (f (weightRepresentative n h)).val * ((n : ℝ) - 2 * h)) /
((n : ℝ) - 2 * k)
/-- PDF p.31, (4.27): every subtraction is real. -/
def lpNotCoefficient {n : ℕ} (f : Word n 2 → Fin 2) (h k : ℕ) : ℝ :=
((h : ℝ) - k + 1 + (f (weightRepresentative n h)).val * ((n : ℝ) - 2 * h)) /
((n : ℝ) - 2 * k + 2)
/-- PDF p.31, (LP): exactly floor(n/2)+2 real variables, and one fidelity
inequality plus two cube inequalities per lower-half booleanWordWeight, hence 3floor(n/2)+3
constraints. No division is in naturals. -/
def FunctionLPFeasible {n : ℕ} (f : Word n 2 → Fin 2) (c : ℝ) (t : TwoRowShape n → ℝ) : Prop :=
(∀ k, 0 ≤ t k ∧ t k ≤ 1) ∧
∀ h : TwoRowShape n, c ≤ ∑ k : TwoRowShape n, if k.val ≤ h.val then
schurWeightProbability n h.val k.val *
(t k * lpTraceCoefficient f h.val k.val + (1 - t k) * lpNotCoefficient f h.val k.val) else 0
/-- PDF p.37, (5.6): all-partial-trace per-booleanWordWeight majority fidelity. -/
def majorityWeightFidelity (n h : ℕ) : ℝ :=
∑ k ∈ Finset.range (h + 1), schurWeightProbability n h k *
(((n : ℝ) - h - k) / ((n : ℝ) - 2 * k))
/-- PDF p.80, (F.5): recurrence coefficients, only used at 1<=h<=floor(n/2). -/
def recurrenceA (n h : ℕ) : ℝ :=
(((n : ℝ) - 2 * h) * h) / (((n : ℝ) - 2 * h + 2) * ((n : ℝ) - h + 1))
/-- PDF p.80, (F.5): the signed numerator must not use natural subtraction. -/
def recurrenceB (n h : ℕ) : ℝ :=
(4 * (h : ℝ)^2 - (4 * (n : ℝ) + 5) * h + ((n : ℝ) + 1) * ((n : ℝ) + 2)) /
(((n : ℝ) - 2 * h + 2) * ((n : ℝ) - h + 1))
/-- PDF pp.36,82, Lemma 5.1: g(0)=0 is an unused totalization; the outer
factor multiplies the ENTIRE bracket including +1. -/
def majorityRecurrence : ℕ → ℝ
| 0 => 0
| 1 => 1
| 2 => 8 / 9
| m + 3 =>
let z : ℝ := m + 3
2 * z / ((2 * z - 1)^2 * (2 * z + 1)) *
((2 * z * (4 * z - 7) + 5) * majorityRecurrence (m + 2) -
4 * (z - 1) * (z - 2) * majorityRecurrence (m + 1) + 1)
/-- PDF p.35: lower-half truth table read left to right as the binary digits
of mask; the upper half is determined by equivariance. Used only for odd n. -/
def tableFunction (n mask : ℕ) (x : Word n 2) : Fin 2 :=
let h := booleanWordWeight x
let j := if h ≤ n / 2 then h else n - h
let b := (mask / 2 ^ (n / 2 - j)) % 2
if h ≤ n / 2 then ⟨b, Nat.mod_lt _ (by omega)⟩
else ⟨1 - b, by have : b < 2 := Nat.mod_lt _ (by omega); omega⟩
/-- PDF p.35: literal finite tables; no extrapolated suffix rule. -/
def smallFidelities (n : ℕ) : List ℝ := match n with
| 1 => [1, 2/3]
| 3 => [8/9, 3/5, 4/5, 29/45]
| 5 => [62/75, 4/7, 5/7, 95/153, 124/153, 4/7, 5/7, 331/525]
| 7 => [2888/3675, 5/9, 2/3, 47/78, 59/78, 5/9, 2/3, 1141/1845,
1444/1845, 5/9, 2/3, 47/78, 59/78, 5/9, 2/3, 6841/11025]
| _ => []
/-- PDF p.36: twenty computed parity values, n=1,3,...,39, without conjectural extrapolation. -/
def parityFidelities : List ℝ :=
[1, 3/5, 5/7, 5/9, 7/11, 7/13, 3/5, 9/17, 11/19, 11/21,
13/23, 13/25, 5/9, 15/29, 17/31, 17/33, 19/35, 19/37, 7/13, 21/41]
example : majorityRecurrence 2 = (8 / 9 : ℝ) := by rfl
example (n : ℕ) : schurWeightProbability n 0 0 = 1 := by simp [schurWeightProbability]
example : parityFidelities.length = 20 := by rfl
/-- PDF p.20, (3.12): Dicke ket; invalid weights give zero. Valid weights
in theorems are always bounded by ell. -/
def schurDicke (ell w : ℕ) : EuclideanSpace ℂ (Qubits ell) :=
QAlgorithms.Papers.Independent.Information100.P22.dicke (I := Fin ell) w
/-- PDF p.69, (D.31): (ell+1)-qubit symmetric vector in first-qubit/rest coordinates. -/
def pairDicke (ell w : ℕ) : EuclideanSpace ℂ (Fin 2 × Qubits ell) :=
WithLp.toLp 2 fun x => if x.1.val + hammingWeight x.2 = w then
((Real.sqrt (Nat.choose (ell+1) w : ℝ))⁻¹ : ℂ) else 0
/-- PDF p.69, (D.32): the primed Dicke vectors, with the negative second term. -/
def primedDicke (ell : ℕ) (w : Fin ell) : EuclideanSpace ℂ (Fin 2 × Qubits ell) :=
WithLp.toLp 2 fun x =>
if x.1 = 0 then (Real.sqrt (((w.val : ℝ)+1)/(ell+1)) : ℂ) * schurDicke ell (w.val+1) x.2
else -(Real.sqrt (((ell : ℝ)-w.val)/(ell+1)) : ℂ) * schurDicke ell w.val x.2
/-- PDF p.68, (D.28): C^2 tensor Sym(ell). -/
def physicalSymmetricSpace (ell : ℕ) : Submodule ℂ (EuclideanSpace ℂ (Fin 2 × Qubits ell)) :=
Submodule.span ℂ (Set.range (fun a : Fin 2 × Fin (ell+1) =>
WithLp.toLp 2 fun x : Fin 2 × Qubits ell => if x.1 = a.1 then schurDicke ell a.2.val x.2 else 0))
/-- PDF p.69, (D.33): actual partial-trace sector. -/
def traceSubspace (ell : ℕ) := Submodule.span ℂ (Set.range (primedDicke ell))
/-- PDF p.68, (D.29): actual UNOT sector in the same ambient space. -/
def notSubspace (ell : ℕ) := Submodule.span ℂ (Set.range (fun w : Fin (ell+2) => pairDicke ell w.val))
/-- PDF p.69, (D.37): ordered normalized singlet followed by ell-1 symmetric qubits. -/
def singletDicke (ell : ℕ) (w : Fin ell) : EuclideanSpace ℂ (Fin 2 × Qubits ell) :=
WithLp.toLp 2 fun x => if h : 0 < ell then
(if x.1 = 0 ∧ x.2 ⟨0,h⟩ = true then ((Real.sqrt 2)⁻¹ : ℂ)
else if x.1 = 1 ∧ x.2 ⟨0,h⟩ = false then -((Real.sqrt 2)⁻¹ : ℂ) else 0) *
schurDicke (ell-1) w.val (fun j => x.2 ⟨j.val+1, by omega⟩)
else 0
/-- PDF p.71, (D.48): rectangular physical CG from its actual row bras. -/
def symmetricCG (ell : ℕ) : Matrix (Fin ell ⊕ Fin (ell+2)) (Fin 2 × Qubits ell) ℂ :=
fun row x => match row with
| Sum.inl v => conj (primedDicke ell v x)
| Sum.inr w => conj (pairDicke ell w.val x)
/-- PDF p.72, (D.55): S on the first qubit, identity on ALL ell remaining qubits. -/
def symmetricDualCG (ell : ℕ) := symmetricCG ell *
Matrix.kronecker (!![0,1;-1,0] : Op (Fin 2)) (1 : Op (Qubits ell))
example (x : Qubits 0) : schurDicke 0 0 x = 1 := by
simp [schurDicke, QAlgorithms.Papers.Independent.Information100.P22.dicke, hammingWeight]
/-- PDF pp.51-53: vertices are left (false) and right (true) qubit endpoints. -/
abbrev DiagramVertex (n : ℕ) := Bool × Fin n
/-- PDF p.51: source ordered singlet pair edges on one side. -/
def singletEdge {n : ℕ} (k : TwoRowShape n) (a b : Fin n) : Prop :=
∃ j : Fin k.val, (a.val = degree n k + 2*j.val ∧ b.val = degree n k + 2*j.val+1) ∨
(b.val = degree n k + 2*j.val ∧ a.val = degree n k + 2*j.val+1)
/-- PDF pp.51-52, (B.22): connectivity comes only from pi wires and seed pairs. -/
def diagramAdjacent {n : ℕ} (k l : TwoRowShape n) (p : Equiv.Perm (Fin n))
(a b : DiagramVertex n) : Prop :=
if a.1 = b.1 then singletEdge (if a.1 then l else k) a.2 b.2
else if a.1 then b.2 = p a.2 else a.2 = p b.2
/-- PDF p.51: free endpoints are precisely the unpaired symmetric-register sites. -/
def diagramFree {n : ℕ} (k l : TwoRowShape n) (a : DiagramVertex n) : Prop :=
a.2.val < degree n (if a.1 then l else k)
/-- PDF p.51: paths follow the actual graph, independently of Hamming weights. -/
def diagramConnected {n : ℕ} (k l : TwoRowShape n) (p : Equiv.Perm (Fin n))
(a b : DiagramVertex n) : Prop := Relation.ReflTransGen (diagramAdjacent k l p) a b
/-- PDF p.51: a proper matching joins every pair of distinct free endpoints
in a connected path on opposite sides. Closed loops are allowed. -/
def ProperMatching {n : ℕ} (k l : TwoRowShape n) (p : Equiv.Perm (Fin n)) : Prop :=
∀ a b, diagramFree k l a → diagramFree k l b → a ≠ b →
diagramConnected k l p a b → a.1 ≠ b.1
/-- PDF p.53: closed connected components, counted once as finite vertex sets. -/
def diagramLoops {n : ℕ} (k : TwoRowShape n) (p : Equiv.Perm (Fin n)) : ℕ :=
((Finset.univ.image (fun a : DiagramVertex n =>
Finset.univ.filter (fun b => diagramConnected k k p a b))).filter
(fun component => ∀ a ∈ component, ¬ diagramFree k k a)).card
/-- PDF pp.51-54: binary contraction labels: wires preserve bits, singlets
flip bits, and free endpoints are fixed at 0. This is an independent graph
coloring specification, not an assumption on the desired matrix element. -/
def ValidDiagramColoring {n : ℕ} (k : TwoRowShape n) (p : Equiv.Perm (Fin n))
(z : DiagramVertex n → Bool) : Prop :=
(∀ j : Fin n, z (false,p j) = z (true,j)) ∧
(∀ side : Bool, ∀ a b : Fin n, singletEdge k a b → z (side,a) ≠ z (side,b)) ∧
(∀ a, diagramFree k k a → z a = false)
/-- PDF p.53, (B.35): product of oriented S-entry signs in a fixed admissible
coloring. A closed loop may be colored either way; its even number of singlet
edges makes this product independent of that choice. The unused noncolorable
case is totalized by +1. All reversed ordered singlets contribute their minus. -/
def diagramSign {n : ℕ} (k : TwoRowShape n) (p : Equiv.Perm (Fin n)) : ℝ :=
if h : ∃ z, ValidDiagramColoring k p z then
let z := h.choose
∏ side : Bool, ∏ j : Fin k.val,
if z (side, ⟨degree n k + 2*j.val, by
have hk := k.isLt
have hj := j.isLt
unfold degree
omega⟩) then (-1:ℝ) else 1
else 1
/-- PDF p.45, (A.2): unnormalized vectorization, row index first. -/
def bilinearVectorize {d : ℕ} (A : Op (Fin d)) : Fin d × Fin d → ℂ := fun p => A p.1 p.2
/-- PDF p.45, footnote 13: bilinear vectorized bra, NOT Hilbert conjugate transpose. -/
def vectorizedBra {d : ℕ} (B : Op (Fin d)) (v : Fin d × Fin d → ℂ) : ℂ :=
∑ p, bilinearVectorize B p * v p
/-- PDF p.45: the two-system swap in the same tensor coordinates. -/
def vectorSwap (d : ℕ) : Op (Fin d × Fin d) := fun x y => if x = (y.2,y.1) then 1 else 0
/-- PDF pp.45-46, (A.9): literal tensor contraction of a vectorized ket and bra. -/
def singleContraction {d : ℕ} (A B : Op (Fin d)) : Op (Fin d) :=
fun a b => ∑ i, A a i * B i b
/-- PDF p.46, (A.10)-(A.12): independent tensor-network coefficient sum.
The path has L edges and L+1 vertex labels, with its two endpoints fixed.
This definition is a sum over internal tensor indices, not a matrix product. -/
def networkChain {d : ℕ} (L : ℕ) (M : Fin L → Op (Fin d)) : Op (Fin d) :=
fun a b => ∑ z : Fin (L+1) → Fin d,
if z 0 = a ∧ z ⟨L, by omega⟩ = b then
∏ j : Fin L, M j (z ⟨j.val, by omega⟩) (z ⟨j.val+1, by omega⟩)
else 0
/-- PDF p.46: alternating factors, with k A/B pairs and optionally a final A. -/
def alternatingFactors {d : ℕ} (k extra : ℕ)
(A : Fin (k+1) → Op (Fin d)) (B : Fin (k+1) → Op (Fin d))
(j : Fin (2*k+extra)) : Op (Fin d) :=
if h : j.val / 2 < k+1 then
if j.val % 2 = 0 then A ⟨j.val/2,h⟩ else B ⟨j.val/2,h⟩
else 0
/-- PDF p.46: ordered product A_1 B_1 ... A_k B_k. -/
def alternatingMatrixProduct {d : ℕ} (k : ℕ) (A B : Fin (k+1) → Op (Fin d)) : Op (Fin d) :=
(List.ofFn (fun j : Fin k => A ⟨j.val,by omega⟩ * B ⟨j.val,by omega⟩)).prod
/-- PDF p.48, (A.24): real antisymmetric singlet matrix. -/
def singletMatrix : Op (Fin 2) := !![0,1;-1,0]
/-- PDF p.51: normalized singlet matrix, whose vectorization is |Psi^->. -/
def normalizedSingletMatrix : Op (Fin 2) := ((Real.sqrt 2)⁻¹ : ℂ) • singletMatrix
/-- PDF pp.48,51: replace selected vectorized KETS by their transposes.
Only even-position factors are kets; odd-position factors remain the bras. -/
def reversedKetFactors (k extra : ℕ) (M : Op (Fin 2))
(reverse : Fin (k+1) → Bool) (j : Fin (2*k+extra)) : Op (Fin 2) :=
if h : j.val/2 < k+1 then
if j.val%2 = 0 ∧ reverse ⟨j.val/2,h⟩ = true then M.transpose else M
else 0
/-- Count reversed kets actually present (k in the even chain; k+1 otherwise). -/
def reversalCount (k extra : ℕ) (reverse : Fin (k+1) → Bool) : ℕ :=
((Finset.univ : Finset (Fin (2*k+extra))).filter (fun j =>
if h : j.val/2 < k+1 then j.val%2 = 0 ∧ reverse ⟨j.val/2,h⟩ = true else False)).card
example {d : ℕ} (A : Op (Fin d)) (i j : Fin d) : bilinearVectorize A (i,j) = A i j := by rfl
example : vectorizedBra (!![Complex.I,0;0,0] : Op (Fin 2))
(bilinearVectorize (!![Complex.I,0;0,0] : Op (Fin 2))) = -1 := by
norm_num [vectorizedBra, bilinearVectorize, Fintype.sum_prod_type, Fin.sum_univ_two]
/-- PDF pp.83-85: literal shared row layout of the eight printed 16x16
matrices. Each named matrix below supplies all eight integer entries and its
printed scale; no channel or optimality assumption enters this construction. -/
def appendixMatrixLayout (a b c d e f g q : ℂ) : Op (Fin 16) :=
!![a,0,0,0,0,0,0,0,0,b,b,0,b,0,0,0;
0,c,q,0,q,0,0,0,0,0,0,d,0,d,e,0;
0,q,c,0,q,0,0,0,0,0,0,d,0,e,d,0;
0,0,0,f,0,-q,-q,0,0,0,0,0,0,0,0,b;
0,q,q,0,c,0,0,0,0,0,0,e,0,d,d,0;
0,0,0,-q,0,f,-q,0,0,0,0,0,0,0,0,b;
0,0,0,-q,0,-q,f,0,0,0,0,0,0,0,0,b;
0,0,0,0,0,0,0,g,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,g,0,0,0,0,0,0,0;
b,0,0,0,0,0,0,0,0,f,-q,0,-q,0,0,0;
b,0,0,0,0,0,0,0,0,-q,f,0,-q,0,0,0;
0,d,d,0,e,0,0,0,0,0,0,c,0,q,q,0;
b,0,0,0,0,0,0,0,0,-q,-q,0,f,0,0,0;
0,d,e,0,d,0,0,0,0,0,0,q,0,c,q,0;
0,e,d,0,d,0,0,0,0,0,0,q,0,q,c,0;
0,0,0,b,0,b,b,0,0,0,0,0,0,0,0,a]
/-- PDF p.82, G.1: literal identity Choi matrix. -/
def optimalChoiID : Op (Fin 4) := !![1,0,0,1;0,0,0,0;0,0,0,0;1,0,0,1]
/-- PDF p.82, G.1: literal optimal NOT Choi matrix, scale 1/3. -/
def optimalChoiNOT : Op (Fin 4) := (1/3:ℂ) • !![1,0,0,-1;0,2,0,0;0,0,2,0;-1,0,0,1]
/-- PDF p.83, G.1: literal MAJ3 Choi matrix, scale 1/9. -/
def optimalChoiMAJ3 := (1/9:ℂ) • appendixMatrixLayout 9 3 8 5 (-4) 1 0 (-1)
/-- PDF p.83, G.1: literal PAR3 Choi matrix, scale 1/15. -/
def optimalChoiPAR3 := (1/15:ℂ) • appendixMatrixLayout 9 1 6 (-1) 4 9 6 1
/-- PDF p.83, G.1: literal NPAR3 Choi matrix, scale 1/5. -/
def optimalChoiNPAR3 := (1/5:ℂ) • appendixMatrixLayout 1 (-1) 4 1 (-4) 1 4 (-1)
/-- PDF p.84, G.1: literal NMAJ3 Choi matrix, scale 1/45. -/
def optimalChoiNMAJ3 := (1/45:ℂ) • appendixMatrixLayout 9 (-9) 16 (-11) 4 29 36 1
/-- PDF p.84, G.2: literal ideal identity matrix, scale 1. -/
def idealChoiID := optimalChoiID
/-- PDF p.84, G.2: literal ideal NOT matrix, scale 1. -/
def idealChoiNOT : Op (Fin 4) := !![0,0,0,-1;0,1,0,0;0,0,1,0;-1,0,0,0]
/-- PDF p.84, G.2: literal ideal MAJ3 matrix, scale 1/6. -/
def idealChoiMAJ3 := (1/6:ℂ) • appendixMatrixLayout 6 2 6 4 (-4) 0 0 (-1)
/-- PDF p.85, G.2: literal ideal PAR3 matrix, scale 1/3. -/
def idealChoiPAR3 := (1/3:ℂ) • appendixMatrixLayout 3 1 0 (-1) 4 3 0 1
/-- PDF p.85, G.2: literal ideal NPAR3 matrix, scale 1/3. -/
def idealChoiNPAR3 := (1/3:ℂ) • appendixMatrixLayout 0 (-1) 3 1 (-4) 0 3 (-1)
/-- PDF p.85, G.2: literal ideal NMAJ3 matrix, scale 1/6. -/
def idealChoiNMAJ3 := (1/6:ℂ) • appendixMatrixLayout 0 (-2) 0 (-4) 4 6 6 1
/-- Output-first lexicographic one-input coordinate order, PDF pp.82,84. -/
def flatOne (a : Fin 2 × Word 1 2) : Fin 4 :=
⟨2*a.1.val+(a.2 0).val, by have := a.1.isLt; have := (a.2 0).isLt; omega⟩
/-- Output-first lexicographic three-input coordinate order, PDF pp.83-85. -/
def flatThree (a : Fin 2 × Word 3 2) : Fin 16 :=
⟨8*a.1.val+4*(a.2 0).val+2*(a.2 1).val+(a.2 2).val, by
have := a.1.isLt; have := (a.2 0).isLt; have := (a.2 1).isLt; have := (a.2 2).isLt; omega⟩
/-- PDF pp.82-85: inverse Choi applied to the literal one-input matrices. -/
def appendixOneChannel (ideal : Bool) (mask : Fin 2) : Superop (Word 1 2) (Fin 2) :=
ofChoi ((if ideal then ![idealChoiID, idealChoiNOT] mask
else ![optimalChoiID, optimalChoiNOT] mask).submatrix flatOne flatOne)
/-- PDF pp.83-85: inverse Choi applied to the literal three-input matrices. -/
def appendixThreeChannel (ideal : Bool) (mask : Fin 4) : Superop (Word 3 2) (Fin 2) :=
ofChoi ((if ideal then ![idealChoiMAJ3, idealChoiPAR3, idealChoiNPAR3, idealChoiNMAJ3] mask
else ![optimalChoiMAJ3, optimalChoiPAR3, optimalChoiNPAR3, optimalChoiNMAJ3] mask).submatrix flatThree flatThree)
example : idealChoiNOT 0 3 = -1 := by rfl
example : optimalChoiNMAJ3 7 7 = (4/5:ℂ) := by
change (1 / 45 : ℂ) * 36 = (4 / 5 : ℂ)
norm_num
/-- PDF p.33: exactly arbitrary unitary one-qubit gates and CNOT, with named
wires supplied by the accepted Circuit syntax. No coefficient oracle is a gate. -/
def elementaryGateSet : Set Gate :=
{g | ∃ M : Matrix Bool Bool ℂ, M ∈ Matrix.unitaryGroup Bool ℂ ∧ g = Gate.ofMatrix1 M} ∪
{Gate.ofMatrix2 cnot}
/-- PDF pp.11,33,78-79: initialize zero ancillas, apply a finite chronological
list of the specified gates, retain a named output qubit and discard the rest. -/
structure OneOutputCircuit (inputWires : ℕ) where
added : ℕ
circuit : Circuit elementaryGateSet (inputWires + added)
output : Fin (inputWires + added)
/-- PDF p.11: exact mixed-input channel semantics, after the specified binary
embedding J. Equality is on all operators, including entangled-input extensions. -/
def circuitOutput {n : ℕ} {I : Type*} [Fintype I]
(C : OneOutputCircuit n) (J : Matrix (Qubits n) I ℂ) : Superop I (Fin 2) :=
fun rho => QAlgorithms.Papers.Independent.Support21.P18.siteReduction
(conjSuperop C.circuit.unitary (withZeroAncillas (J * rho * Jᴴ) C.added)) C.output
/-- PDF p.33: coordinate identification of the source Fin-2 word with Bool wires. -/
def wordBinaryEmbedding (n : ℕ) : Matrix (Qubits n) (Word n 2) ℂ :=
fun z x => if (fun i => QAlgorithms.Papers.Independent.Support21.P18.bitIndex (z i)) = x then 1 else 0
/-- PDF pp.78-79: binary embedding of a qubit and a (ell+1)-dimensional label. -/
def controlledBinaryEmbedding (ell : ℕ) :
Matrix (Qubits (1+Nat.clog 2 (ell+1))) (Fin 2 × Fin (ell+1)) ℂ :=
fun z a => if (QAlgorithms.Papers.Independent.Support21.P18.bitIndex ((qubitsAppendEquiv 1 (Nat.clog 2 (ell+1)) z).1 0)) = a.1 then
finiteRegisterEmbedding (ell+1) (qubitsAppendEquiv 1 (Nat.clog 2 (ell+1)) z).2 a.2 else 0
/-- PDF p.78, (E.58)-(E.60): label-controlled real rotation, with no oracle. -/
def controlledRotation (ell : ℕ) : Op (Fin 2 × Fin (ell+1)) :=
fun a b => if a.2 = b.2 then
((!![(Real.sqrt (((ell:ℝ)-b.2.val)/ell) : ℂ), -(Real.sqrt ((b.2.val:ℝ)/ell) : ℂ);
(Real.sqrt ((b.2.val:ℝ)/ell) : ℂ), (Real.sqrt (((ell:ℝ)-b.2.val)/ell) : ℂ)] : Op (Fin 2)) a.1 b.1)
else 0
/-- PDF p.78, (E.61): decrement label modulo ell+1 if qubit is one. -/
def controlledDecrement (ell : ℕ) : Op (Fin 2 × Fin (ell+1)) :=
fun a b => if a.1 = b.1 ∧ a.2.val = (b.2.val + (ell+1) - b.1.val) % (ell+1) then 1 else 0
/-- PDF p.79, (E.64): increment label modulo ell+2 if qubit is zero. -/
def controlledIncrement (ell : ℕ) : Op (Fin 2 × Fin (ell+2)) :=
fun a b => if a.1 = b.1 ∧ a.2.val = (b.2.val + 1 - b.1.val) % (ell+2) then 1 else 0
/-- PDF pp.78-79: binary padding is identity outside valid labels. -/
def paddedRotation (ell : ℕ) := extendEncodedUnitary (controlledBinaryEmbedding ell) (controlledRotation ell)
/-- PDF pp.78-79: decrement padding is identity outside valid labels. -/
def paddedDecrement (ell : ℕ) := extendEncodedUnitary (controlledBinaryEmbedding ell) (controlledDecrement ell)
/-- PDF p.79: increment padding is identity outside valid labels. -/
def paddedIncrement (ell : ℕ) := extendEncodedUnitary (controlledBinaryEmbedding (ell+1)) (controlledIncrement ell)
example : Gate.ofMatrix2 cnot ∈ elementaryGateSet := Set.mem_union_right _ rfl
example (ell : ℕ) (z : Qubits (1+Nat.clog 2 (ell+1)))
(hz : ∀ a, controlledBinaryEmbedding ell z a = 0) (y : Qubits (1+Nat.clog 2 (ell+1))) :
paddedRotation ell z y = (1 : Op (Qubits (1+Nat.clog 2 (ell+1)))) z y := by
simp [paddedRotation, extendEncodedUnitary, Matrix.mul_apply, hz]
end QAlgorithms.Papers.Independent.Gap48.P23
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Gap48.P23.CompletelyPositive
For any types and any function from complex matrices indexed by to complex matrices indexed by , this defines the proposition that, for every natural number and every positive semidefinite complex matrix indexed by , the matrix indexed by is positive semidefinite, where
Neither type is assumed finite, and no linearity or trace-preservation assumption is imposed on . The quantifier includes , where the indexed matrices are empty.
QAlgorithms.Papers.Independent.Gap48.P23.DiagramVertex
For every natural number , this abbreviates the type of pairs , where is a Boolean and . Thus there are vertices, with two Boolean-labelled copies of the positions; for , the vertex type is empty.
QAlgorithms.Papers.Independent.Gap48.P23.Equivariant
For natural numbers and a function from length- words over to , this predicate means that for every permutation of the alphabet and every word ,
When , this requires the output on the unique empty word to be fixed by every alphabet permutation; it is therefore impossible when . When , the condition holds for the unique possible . When , it is vacuous on the empty word domain; when , no such exists.
QAlgorithms.Papers.Independent.Gap48.P23.FunctionLPFeasible
For every natural number , function , real number , and real function on , this predicate means that for every , and that for every ,
where is the numerical value of , and for and otherwise. The binomial subtraction and all arithmetic in the displayed inequality are real arithmetic. No symmetry assumption is imposed on , and there is no separate bound on . Division by zero gives zero, so for even , the trace fraction at is zero. The case is included: the predicate then says and .
QAlgorithms.Papers.Independent.Gap48.P23.IsFunctionOptimal
For natural numbers , a predicate on length- words over , a function from those words to alphabet symbols, and a matrix function from matrices on words to complex matrices, this predicate requires that admit a finite Kraus representation for every , with , each having alphabet-indexed rows and word-indexed columns, and ; it further requires
where the supremum ranges over all admitting the same kind of finite Kraus representation, , and . The real extrema use value for empty sets and for sets unbounded in the relevant direction. Zero parameters are included whenever the data exist, with empty products equal to ; if no word satisfies , the equality holds for every satisfying the Kraus requirement.
QAlgorithms.Papers.Independent.Gap48.P23.LawfulCoefficients
For every natural number and every real array , this defines the following predicate. For each , put and , using natural-number subtraction truncated at zero, and define vectors on binary words of length by
where , , and . The predicate requires both
These requirements concern only the vectors whose weight index is zero. Empty products equal one; is included, and then these conditions hold for every coefficient array.
QAlgorithms.Papers.Independent.Gap48.P23.OneOutputCircuit
For each natural number of input wires, this structure consists of a natural number of added wires, a finite ordered list of gate applications on wires, and a selected output wire . Each gate application specifies a gate from the set consisting of all arbitrary one qubit unitaries and the two qubit controlled bit flip, together with an injective placement of its ordered wires among the wires. The list may be empty and may be zero, but the selected output wire requires ; thus when , at least one added wire is required. No other fields or conditions are imposed.
QAlgorithms.Papers.Independent.Gap48.P23.PermutationInvariant
For any natural numbers , put , and let be any function from complex matrices indexed by to complex matrices. This defines the proposition that, for every permutation of the positions and every complex matrix indexed by , , where if and is zero otherwise, and denotes conjugate transpose. No linearity or channel assumption is imposed on , and need not be a density matrix. Zero values of or are included; when , the condition is automatic.
QAlgorithms.Papers.Independent.Gap48.P23.PolynomialCovariant
For every natural number and every function from complex matrices to complex matrices, this predicate means that for every unitary matrix and every complex matrix ,
The matrix used here is defined, for , by
All factorial arguments and exponents are natural numbers; the restrictions on the sum ensure that the displayed subtractions do not underflow. The quantifier includes , all unitary regardless of determinant, and all without positivity or normalization assumptions. The predicate imposes no separate linearity or channel assumption on .
QAlgorithms.Papers.Independent.Gap48.P23.ProperMatching
For every natural number , integers , and permutation of , this predicate requires that any two distinct free vertices connected by a finite adjacency chain have different Boolean labels. Here a false-side vertex is free exactly when , and a true-side vertex is free exactly when ; adjacency within each side joins the pairs , , using on the false side and on the true side, while adjacency across sides requires the false-side position to equal of the true-side position. A chain may have length zero, but the endpoints in this requirement must be distinct. The condition is vacuous when there are no two distinct connected free vertices, including when .
QAlgorithms.Papers.Independent.Gap48.P23.RealSchurCoefficients
For every natural number , this defines the type of all real-valued arrays , indexed by integers , integers , and permutations of , where
using natural-number subtraction truncated at zero. No equations, normalization conditions, or other restrictions are imposed on these real coefficients. For , there is one coefficient, indexed by and the unique permutation of the empty set.
QAlgorithms.Papers.Independent.Gap48.P23.ReducedIndex
For every natural number , this defines the index set of pairs satisfying
The range of depends on . The case is included and gives the single pair .
QAlgorithms.Papers.Independent.Gap48.P23.SchurIndex
For every natural number , this defines the index set consisting of triples , where , , and , with
The subtraction defining is natural-number subtraction, truncated at zero. The ranges of and depend on . The definition includes , when the index set consists of the single triple .
QAlgorithms.Papers.Independent.Gap48.P23.TwoRowShape
For every natural number , this abbreviates the finite type of integer indices satisfying , equivalently , where the division is natural-number division. In particular, for this type has the single index .
QAlgorithms.Papers.Independent.Gap48.P23.ValidDiagramColoring
For every natural number , every integer with , every permutation of , and every Boolean coloring of the vertices , this predicate holds precisely when all three conditions hold: for every ; on each side, the vertices and have different colors for every ; and every vertex whose index is less than has color . The definition includes , when and all conditions are vacuous.
QAlgorithms.Papers.Independent.Gap48.P23.WordSymmetric
For natural numbers and a function from length- words over to , this predicate means that for every permutation of the positions and every word ,
When , this condition holds for every such . When , the word domain is empty and the condition is vacuous; when , no such function exists because the word domain is a singleton and the output set is empty.
QAlgorithms.Papers.Independent.Gap48.P23.WordUnitaryEquivariant
For any natural numbers , put , and let be any function from complex matrices indexed by to complex matrices. This defines the proposition that, for every unitary complex matrix and every complex matrix indexed by ,
No linearity or channel assumption is imposed on , and is unrestricted. The definition includes and ; for , the product is empty and equals one on the unique empty word.
QAlgorithms.Papers.Independent.Gap48.P23.alternatingFactors
For every natural number , natural numbers and , families and of complex matrices, and index , this defines the matrix
Thus any permitted indices beyond return the zero matrix. When , there is no index ; is also included.
QAlgorithms.Papers.Independent.Gap48.P23.alternatingMatrixProduct
For every natural number , every natural number , and families and of complex matrices, this defines the matrix product
in the displayed order. The matrices and do not occur in the product. For , it is the identity matrix; the definition includes .
QAlgorithms.Papers.Independent.Gap48.P23.appendixMatrixLayout
For arbitrary complex numbers , this defines a complex matrix , indexed by , whose diagonal is
For distinct indices , its entries are symmetric, , and are specified by the following unordered pairs: the value is on ; whenever both indices belong to or both belong to ; whenever both belong to or both belong to ; on ; and on . Every remaining off-diagonal entry is zero.
QAlgorithms.Papers.Independent.Gap48.P23.appendixOneChannel
For a Boolean parameter and an index , this defines a function from complex matrices indexed by binary words of length one to complex matrices indexed by . For every such input matrix , its output entries are
where, for either value of , selects
while selects
The input is unrestricted; the definition itself imposes no positivity or trace condition.
QAlgorithms.Papers.Independent.Gap48.P23.appendixThreeChannel
For a Boolean parameter and an index , this defines a function from complex matrices indexed by binary words of length three to complex matrices indexed by . For every input matrix ,
Here , with parameters selected by
and is the symmetric complex matrix whose diagonal is
and whose entries above the diagonal are
The input is unrestricted; the definition itself imposes no positivity or trace condition.
QAlgorithms.Papers.Independent.Gap48.P23.bilinearVectorize
For every natural number and every complex matrix , this defines the complex-valued function on ordered pairs of indices by for . When , its domain is empty.
QAlgorithms.Papers.Independent.Gap48.P23.blockDiagonal
For arbitrary types , with no finiteness or nonemptiness assumptions, and complex matrices indexed by and indexed by , this defines a matrix indexed by the disjoint union : its entry at two indices from the component is the corresponding entry of , its entry at two indices from the component is the corresponding entry of , and every entry between different components is zero. Either component may be empty.
QAlgorithms.Papers.Independent.Gap48.P23.booleanWordWeight
For every natural number and every word , this defines the natural number
the number of positions carrying the symbol . When , the word is empty and this number is .
QAlgorithms.Papers.Independent.Gap48.P23.circuitOutput
For every natural number , every finite type with a specified finite enumeration, every one output circuit consisting of added wires, an ordered circuit of arbitrary one qubit unitaries and controlled bit flips on wires, and an output wire , and every complex matrix with rows indexed by Boolean strings of length and columns indexed by , this defines a map from complex matrices to complex matrices. For an arbitrary input matrix , first form ; define , indexed by strings of length , by if the two -bit strings are both all zero, and by otherwise. Let be the circuit matrix, obtained by embedding each gate on its specified wires, leaving all other bits equal between row and column, and multiplying the embedded matrices in reverse list order; an empty circuit gives . Put . The output matrix has entries
where and . No isometry condition on or density matrix condition on is assumed; may be empty and may be zero, provided the circuit has an output wire.
QAlgorithms.Papers.Independent.Gap48.P23.controlledBinaryEmbedding
For every natural number , let , equivalently the least natural number satisfying . This defines a complex matrix with rows indexed by Boolean strings of length and columns indexed by . Its entry is precisely when the first bit of , identified by and , is , and its remaining bits are the binary representation of with the most significant bit first; otherwise its entry is . Explicitly,
The underlying integer to bits conversion reduces its input modulo ; here , so no reduction changes . When , , the binary register is empty, and the matrix identifies the single Boolean control bit with .
QAlgorithms.Papers.Independent.Gap48.P23.controlledDecrement
For every natural number , this defines a complex square matrix indexed by , with entry
The addition and subtraction inside the remainder are natural number operations, with subtraction truncated at zero; the displayed subtraction cannot underflow for these indices. Thus the first coordinate is preserved, the second coordinate is unchanged when , and it is decremented modulo when . This includes , when the second register has one value and the matrix is the identity on the two possible first coordinates.
QAlgorithms.Papers.Independent.Gap48.P23.controlledIncrement
For every natural number , this defines a complex square matrix indexed by , with entry
The arithmetic inside the remainder uses natural numbers and truncated subtraction, which cannot underflow because . Consequently the first coordinate is preserved, the second coordinate is incremented modulo when , and it is unchanged when . The definition includes , for which the second register has two values.
QAlgorithms.Papers.Independent.Gap48.P23.controlledRotation
For every natural number , this defines a complex square matrix indexed by pairs . Its entry from column to row is zero if , and otherwise is the entry of
with all quotients and the subtraction taken in , and the displayed real entries embedded in . There is no assumption that : when , the only register value is , real division by zero equals zero, and the resulting matrix is zero.
QAlgorithms.Papers.Independent.Gap48.P23.degree
For every natural number and every index satisfying , this defines the natural number . The subtraction is natural-number subtraction, which in general truncates at zero; the stated index bound ensures , so no truncation occurs here. In particular, the value is when , and also when is even and .
QAlgorithms.Papers.Independent.Gap48.P23.diagramAdjacent
For every natural number , integers , permutation of , and vertices , with Boolean labels, this defines adjacency as follows: if , the unordered pair of positions must be for some ; if , it must instead be for some ; if and , the condition is ; and if and , the condition is . A side with parameter zero has no adjacency within that side, and for there are no vertices.
QAlgorithms.Papers.Independent.Gap48.P23.diagramConnected
For every natural number , integers , permutation of , and vertices , this predicate means there is a finite sequence of vertices , with , whose consecutive vertices satisfy the following adjacency rule: within the false side, positions form one of the pairs , ; within the true side, they form one of the pairs , ; across sides, the false-side position is applied to the true-side position. Length-zero sequences are allowed, so each vertex is connected to itself. For , there are no possible endpoint vertices.
QAlgorithms.Papers.Independent.Gap48.P23.diagramFree
For every natural number , integers , and vertex , this predicate means when , and when . These are natural-number subtractions, with . In particular, parameter zero makes every position on that side free, while a side with , or respectively , has no free positions; for , there are no vertices.
QAlgorithms.Papers.Independent.Gap48.P23.diagramLoops
For every natural number , integer , and permutation of , form, for each vertex , the set of vertices reachable from by a finite chain, allowing length zero. On both Boolean sides, adjacency within the side joins precisely the pairs , , and adjacency across sides requires the false-side position to equal of the true-side position. This definition counts the distinct sets for which every vertex has position at least ; equivalently, none of their vertices satisfies the free-position condition . Identical reachable sets arising from different starting vertices are counted once. For , there are no starting vertices and the count is ; for , every vertex is free and the count is also .
QAlgorithms.Papers.Independent.Gap48.P23.diagramSign
For every natural number , every integer with , and every permutation of , this defines a real number as follows. A valid coloring assigns Boolean colors to two copies of , gives the same color to and , gives opposite colors to the endpoints of each pair on each side, and colors every vertex of index less than false. If at least one valid coloring exists, choose one such coloring and return
If no valid coloring exists, return . For , including , the products are empty and the value is .
QAlgorithms.Papers.Independent.Gap48.P23.dickeColumnProjector
For every natural number , this defines a complex matrix on the set of -bit strings as , where is when the number of true bits in equals , and zero otherwise, for . Equivalently, if denotes the number of true bits in , then
For , the matrix on the single empty bit string has entry .
QAlgorithms.Papers.Independent.Gap48.P23.dualCG
For every natural number , this defines the matrix , where and has rows in and columns , with and . Explicitly, writing for a row in the first component and for a row in the second,
Here denotes the indicator of the stated equality, all square roots are nonnegative real square roots, and entries are regarded as complex. For , the first row component is empty and .
QAlgorithms.Papers.Independent.Gap48.P23.elementaryGateSet
This defines a set of gates, where a gate consists of a natural number arity and a complex matrix indexed by Boolean strings of that length. Its members are exactly all one qubit gates obtained from an arbitrary complex unitary matrix indexed by , with entries , together with the two qubit controlled bit flip gate, whose entry at Boolean strings is when and , and is otherwise.
QAlgorithms.Papers.Independent.Gap48.P23.encodedInput
For natural numbers , an arbitrary complex matrix , and a word , this defines the matrix , where has its sole nonzero entry, equal to , at , and is the matrix on words with . Equivalently, the resulting entry at is
No unitarity or normalization assumption on is imposed. When , the empty product gives the one-by-one matrix with entry ; when , no input word exists.
QAlgorithms.Papers.Independent.Gap48.P23.extremalChannel
For every natural number and Boolean , this defines a function from complex matrices to complex matrices by
where , the two row components are distinct, and
Square roots are nonnegative real square roots embedded in , and complex division by zero is zero. The definition accepts arbitrary , without positivity or trace assumptions, and does not itself assert a channel property. At , the false branch sends every input to zero, while the true branch sends the scalar input to .
QAlgorithms.Papers.Independent.Gap48.P23.extremalChoi
For every natural number and Boolean , this defines a complex matrix indexed by pairs , where and , through
The and rows are separate components, and their entries are
Thus the construction is , with block diagonal: for false, its first block is times the identity and its second block is zero; for true, its first block is zero and its second block is times the identity. Scalars are interpreted in , where division by zero gives zero. In particular, and .
QAlgorithms.Papers.Independent.Gap48.P23.fidelityValues
For natural numbers , a predicate on length- words over , a function from those words to alphabet symbols, and an arbitrary function from matrices on words to complex matrices, this defines the set of real numbers
where and . Membership requires the existence of both a word satisfying and such a unitary . There is no channel assumption on . If no word satisfies , the set is empty; this includes . Empty words are allowed when , and the product then equals .
QAlgorithms.Papers.Independent.Gap48.P23.flatOne
For a pair , where and is a binary word of length one, this defines the index
QAlgorithms.Papers.Independent.Gap48.P23.flatThree
For a pair , where and is a binary word of length three, this defines the index
QAlgorithms.Papers.Independent.Gap48.P23.functionFidelity
For natural numbers , a predicate on length- words over , a function from those words to alphabet symbols, and an arbitrary function from matrices on words to complex matrices, this defines the real infimum
where and . No channel or boundedness assumption on is made. The real infimum used here is if the set is empty or unbounded below; in particular, the value is when no word satisfies . The case is included, with the empty product equal to .
QAlgorithms.Papers.Independent.Gap48.P23.functionOutputChoi
For every finite type equipped with decidable equality, every type , and every function from complex matrices indexed by to complex matrices indexed by , this defines a complex matrix indexed by through
where has entry one at and zero elsewhere. No linearity or channel assumption is imposed on , and need not be finite. The finite type may be empty, in which case has an empty index set.
QAlgorithms.Papers.Independent.Gap48.P23.idealChoiID
This defines the complex matrix, indexed in row and column order , to be
QAlgorithms.Papers.Independent.Gap48.P23.idealChoiMAJ3
This defines the complex matrix , with rows and columns indexed by . The matrix is symmetric, its diagonal is
and its nonzero entries above the diagonal are
All other entries above the diagonal are zero, and .
QAlgorithms.Papers.Independent.Gap48.P23.idealChoiNMAJ3
This defines the complex matrix , with rows and columns indexed by . The matrix is symmetric, its diagonal is
and its nonzero entries above the diagonal are
All other entries above the diagonal are zero, and .
QAlgorithms.Papers.Independent.Gap48.P23.idealChoiNOT
This defines the complex matrix, indexed in row and column order , to be
QAlgorithms.Papers.Independent.Gap48.P23.idealChoiNPAR3
This defines the complex matrix , with rows and columns indexed by . The matrix is symmetric, its diagonal is
and its nonzero entries above the diagonal are
All other entries above the diagonal are zero, and .
QAlgorithms.Papers.Independent.Gap48.P23.idealChoiPAR3
This defines the complex matrix , with rows and columns indexed by . The matrix is symmetric, its diagonal is
and its nonzero entries above the diagonal are
All other entries above the diagonal are zero, and .
QAlgorithms.Papers.Independent.Gap48.P23.idealNot
This defines a function on all complex matrices by , where is the identity matrix. The input is not required to be positive semidefinite or to have trace one.
QAlgorithms.Papers.Independent.Gap48.P23.inputFidelity
For natural numbers , let map length- words over to alphabet symbols, let be any function from complex matrices on those words to complex matrices, let be a word, and let be a unitary matrix. This defines the real number
No channel, linearity, or positivity assumption is imposed on , so this definition alone does not restrict the value to . The case is included, with the one-by-one matrix ; the supplied and together require .
QAlgorithms.Papers.Independent.Gap48.P23.lowerCGAction
For every natural number and arbitrary complex matrix , this defines a complex matrix. Set , using natural-number subtraction, so when . For , the entry is
The square root is real and then embedded in ; the summation restrictions ensure nonnegative exponents and factorial arguments. No hypothesis is imposed on . When , the matrix has no entries; when , its sole entry is .
QAlgorithms.Papers.Independent.Gap48.P23.lowerDualAction
For every natural number and arbitrary complex matrix , this defines a complex matrix. Set , with subtraction truncated at zero. For , its entry is
The square root is the nonnegative real square root, regarded as complex, and the summation restrictions ensure nonnegative factorial arguments and exponents. No hypothesis is imposed on . For there are no entries; for the sole entry is , including when is zero.
QAlgorithms.Papers.Independent.Gap48.P23.lpNotCoefficient
For every natural number , every function from binary words of length to , and all natural numbers , let be the word whose entry at is zero if and one otherwise, with truncated natural subtraction in . This defines
All arithmetic in the fraction is real arithmetic, and is read as or . Neither nor the function is subject to additional conditions. For , the representative is the all-one word; for , it is the unique empty word. If , division by zero makes the value zero.
QAlgorithms.Papers.Independent.Gap48.P23.lpTraceCoefficient
For every natural number , every function from binary words to , and all natural numbers , define the word by when and otherwise, where is truncated natural subtraction. This defines the real number
where every quantity in this displayed fraction is interpreted in , and is its numerical value or . There are no bounds on and no symmetry assumption on . If , the representative is the all-one word, including the unique empty word when ; if , the fraction is zero by the convention for real division by zero.
QAlgorithms.Papers.Independent.Gap48.P23.majority
For every natural number and word , let . This defines the value to be if , and otherwise. In particular, a tie gives , and the empty word at gives .
QAlgorithms.Papers.Independent.Gap48.P23.majorityPromise
For every pair of natural numbers and word , let . This defines the proposition , where subtraction and division are natural-number operations: subtraction is truncated at zero, division for is rounded down, and . Since , the left side is the smaller of the numbers of ones and zeros. For , the condition requires this smaller number to be zero; for , it holds for every .
QAlgorithms.Papers.Independent.Gap48.P23.majorityRecurrence
This defines a real sequence for every natural number , starting with , , and , and satisfying, for every natural number , with regarded as a real number,
The recurrence applies to every index at least three, including both even and odd indices.
QAlgorithms.Papers.Independent.Gap48.P23.majorityWeightFidelity
For all natural numbers , this defines the real number
The binomial coefficients are converted to real numbers before subtraction, and all arithmetic in the fractions is real arithmetic. There is no assumption that or , and the sum includes every integer from through . A fraction with zero denominator equals zero; this applies to the second fraction when , and makes every summand zero when . In particular, the value at is zero.
QAlgorithms.Papers.Independent.Gap48.P23.monomialKet
For every natural number and arbitrary vector , this defines a vector by
The square root is the nonnegative real square root, embedded in . There is no normalization hypothesis on . Zeroth powers are one even when their base is zero, so for the resulting vector has its single coordinate equal to .
QAlgorithms.Papers.Independent.Gap48.P23.networkChain
For every natural number , every natural number , and every family of complex matrices, this defines a complex matrix by
For , the product is empty and equals , giving when and otherwise. The definition also includes , when the matrix has no entries.
QAlgorithms.Papers.Independent.Gap48.P23.normalizedSingletMatrix
This defines the complex matrix
with rows and columns indexed by .
QAlgorithms.Papers.Independent.Gap48.P23.notIsometry
For every natural number , this defines a complex matrix with columns and rows where and , by negating the specified upper matrix. Explicitly,
The subtraction is natural-number subtraction before conversion to a real number; since , it does not underflow. All square-root coefficients are real numbers embedded in . The definition includes , when the two nonzero entries are at row and at row .
QAlgorithms.Papers.Independent.Gap48.P23.notKraus
For every natural number and every integer index with , this defines a complex matrix by
The coefficients are real numbers embedded in , and the denominator is always positive. The endpoint has only the second displayed nonzero entry, while has only the first. The definition also applies when .
QAlgorithms.Papers.Independent.Gap48.P23.notMatrixUnit
For every natural number and every pair of integer indices with , this defines the complex matrix
Here has a single entry at row , column , and zero elsewhere. All coefficient arithmetic is real before embedding in , and the cases are tested in the displayed order. The denominator is always positive. For , the only pair is , and the output is .
QAlgorithms.Papers.Independent.Gap48.P23.notSubspace
For every natural number , this defines the complex linear span, in the space of vectors indexed by , of the vectors , indexed by , with
Here counts true entries in the Boolean string . The subspace consists of all finite complex linear combinations of these vectors. For , these are the two coordinate vectors indexed by , so their span is the entire ambient two-dimensional space.
QAlgorithms.Papers.Independent.Gap48.P23.ofChoi
For every finite type , every type , and every complex matrix indexed by , this defines a function from complex matrices indexed by to complex matrices indexed by by
There are no positivity or normalization conditions on or , and need not be finite. If is empty, both sums are empty and the output is the zero matrix.
QAlgorithms.Papers.Independent.Gap48.P23.optimalChoiID
This defines the complex matrix, with rows and columns indexed by ,
QAlgorithms.Papers.Independent.Gap48.P23.optimalChoiMAJ3
This defines the complex matrix , indexed by , where
For distinct indices, : its value is on the unordered pairs ; whenever both indices belong to or both belong to ; whenever both belong to or both belong to ; on ; and on . Every remaining off-diagonal entry of is zero.
QAlgorithms.Papers.Independent.Gap48.P23.optimalChoiNMAJ3
This defines the complex matrix , with rows and columns indexed by . The matrix is symmetric, its diagonal is
and its nonzero entries above the diagonal are
All other entries above the diagonal are zero, and .
QAlgorithms.Papers.Independent.Gap48.P23.optimalChoiNOT
This defines the complex matrix, with rows and columns indexed by ,
QAlgorithms.Papers.Independent.Gap48.P23.optimalChoiNPAR3
This defines the complex matrix , with rows and columns indexed by . The matrix is symmetric, its diagonal is
and its nonzero entries above the diagonal are
All other entries above the diagonal are zero, and .
QAlgorithms.Papers.Independent.Gap48.P23.optimalChoiPAR3
This defines the complex matrix , indexed by , where
For distinct indices, : its value is on the unordered pairs , and also whenever both indices belong to or both belong to ; whenever both belong to or both belong to , and also on ; and on . Every remaining off-diagonal entry of is zero.
QAlgorithms.Papers.Independent.Gap48.P23.optimalFunctionFidelity
For natural numbers , a predicate on length- words over , and a function from those words to alphabet symbols, this defines
where , , and the supremum ranges over precisely those matrix functions admitting a finite Kraus representation: there exist a natural number and matrices , with rows indexed by alphabet symbols and columns by words, such that and for every complex matrix on words. Both extrema are real extrema, with the empty-set value ; an unbounded-below inner set or unbounded-above outer set likewise has value . No attainment is asserted. Zero values of are allowed whenever the supplied data exist; empty products equal , and if no word satisfies , the defined value is .
QAlgorithms.Papers.Independent.Gap48.P23.ordinaryCG
For every natural number , this defines a complex matrix whose rows are indexed by the disjoint union and whose columns are indexed by pairs with and . Put . For a row in the first component and a row in the second component, respectively,
All square roots and the subtraction inside them are real, and the resulting numbers are regarded as complex. Here and the denominator is positive. When , the first row component is empty and the remaining matrix is the identity under the indicated indexing.
QAlgorithms.Papers.Independent.Gap48.P23.paddedDecrement
For every natural number , put , and define to have a at row and column exactly when consists of the Boolean encoding of followed by the -bit binary encoding of , with most significant bit first, and zero elsewhere. Let have entry from column to row exactly when and , and zero otherwise; the arithmetic inside the remainder is natural number arithmetic with truncated subtraction. This defines the matrix on Boolean strings of length by
On encoded register values, preserves the first coordinate and decrements the second coordinate modulo when the first coordinate is , leaving it unchanged when that coordinate is ; the displayed formula also specifies the padded matrix on all remaining binary register values. The definition includes , when and the padded matrix is the identity.
QAlgorithms.Papers.Independent.Gap48.P23.paddedIncrement
For every natural number , including , let be the least natural number such that . Define the matrix , with rows indexed by Boolean strings of length and columns indexed by , by setting precisely when the first bit of represents and its remaining bits are the length-, most-significant-bit-first binary representation of , and setting it to zero otherwise. Define on these column indices by
Here the subtraction is natural-number subtraction, truncated at zero; since , the displayed numerator is nonnegative. The declaration defines the matrix
on Boolean strings of length . Thus increments the second index modulo when the first index is zero and leaves it unchanged when that index is one; the padding is exactly the displayed matrix expression.
QAlgorithms.Papers.Independent.Gap48.P23.paddedRotation
For every natural number , put . Let be the matrix whose column is the basis vector of the -bit string consisting of the Boolean encoding of followed by the -bit binary encoding of , with most significant bit first. Let be the matrix on these pairs that preserves and on the first coordinate has the block
where the arithmetic is real and entries are embedded in . This defines the matrix on all Boolean strings of length by
Thus the formula also specifies its action on binary register values outside . No positivity assumption on is made: at , real division by zero gives zero, , and the resulting padded matrix is the zero matrix.
QAlgorithms.Papers.Independent.Gap48.P23.pairDicke
For any natural numbers , this defines a complex vector indexed by pairs , where and is a Boolean string of length , by
where counts true entries. No bound on is assumed; for , this is the zero vector, and reciprocals use . When , the string is empty, so gives the coordinate vector supported at , gives the coordinate vector supported at , and larger give zero.
QAlgorithms.Papers.Independent.Gap48.P23.parity
For every natural number and word , this defines the value in to be . Thus it is exactly when the number of entries equal to one is odd, and is otherwise, including for the empty word.
QAlgorithms.Papers.Independent.Gap48.P23.parityFidelities
This defines the following fixed ordered list of twenty real numbers, with no arguments:
QAlgorithms.Papers.Independent.Gap48.P23.partialTraceChannel
For every natural number , this defines a map from complex matrices to complex matrices. Write for the matrix with rows indexed by Boolean strings of length and columns indexed by , whose entry is when has exactly true bits, and otherwise. If , put ; then the output has entries
where , , and the updated string replaces its zeroth bit by the truth value of . If , the output is the zero matrix for every . The input is arbitrary; no positivity or normalization is required.
QAlgorithms.Papers.Independent.Gap48.P23.partitionIrrep
For every natural number , index , and complex matrix , this defines the matrix , where . Here is defined explicitly, for , by
The real square root and factorials are regarded as complex scalars. An empty sum is zero. No unitarity or invertibility assumption is imposed on ; when , the determinant factor is , including when . The definition includes , when and the resulting matrix is .
QAlgorithms.Papers.Independent.Gap48.P23.permutationBlock
For every natural number , put , , and , where this subtraction is truncated natural subtraction. Given arbitrary real coefficients for , , and position permutations , a chosen , and a position permutation , this defines the matrix
Here , , and for , with
The inner product is conjugate linear in its first argument. No lawfulness or orthonormality condition is assumed on the coefficients or vectors. Empty products equal ; for , the defined matrix is .
QAlgorithms.Papers.Independent.Gap48.P23.permutationSymmetrization
For any natural numbers , put . Given any function from complex matrices indexed by to complex matrices, this defines another such function by
where is the set of permutations of the positions and is one when and zero otherwise. The input is any complex matrix, and no linearity or channel assumption is imposed on . Zero dimensions are allowed; when , there is one permutation and , so the resulting function is .
QAlgorithms.Papers.Independent.Gap48.P23.permutationTwirl
For every natural number , this defines a function on complex matrices indexed by binary words of length by averaging conjugation over every permutation of the positions:
Here is the conjugate transpose, and is any complex matrix, with no positivity or normalization assumption. Equivalently, . The case is included: the empty set has one permutation and , so the function preserves the sole matrix entry.
QAlgorithms.Papers.Independent.Gap48.P23.permuteWord
For natural numbers , a permutation of the positions , and a word , this defines the word obtained by permuting positions according to : its value at position is . Thus the symbol originally at position moves to position . Zero values of and are allowed: when , the unique empty word is unchanged; when , there is no word to supply.
QAlgorithms.Papers.Independent.Gap48.P23.physicalSymmetricSpace
For every natural number , this defines a complex linear subspace of the vectors indexed by : it is the complex linear span of the vectors , for all and , whose coordinates are
Here counts true entries. Thus the definition includes every finite complex linear combination of these explicitly given generators. For , the Boolean string register has one empty string, and the two generators span the entire two-dimensional ambient space.
QAlgorithms.Papers.Independent.Gap48.P23.polynomialIrrep
For every natural number and arbitrary complex matrix , this defines a complex matrix . For indices , its entry is
The square root is the nonnegative real square root, regarded as a complex scalar. Natural-number subtraction is truncated at zero, although the restrictions on the summation ensure the displayed factorial arguments and exponents are nonnegative in ordinary integer arithmetic. An empty sum is zero, and a zeroth power, including , is one. No unitarity assumption is imposed on ; when , the result is the matrix with entry .
QAlgorithms.Papers.Independent.Gap48.P23.predictedBranch
For every natural number , index , natural number , and complex matrix , put . This defines a matrix on indices to be zero unless both and ; if both tests hold, it is
where has its only nonzero entry, equal to , at , and
Real scalars in these formulas are embedded into . Natural subtraction is truncated at zero, although the support test ensures is ordinary nonnegative subtraction on the selected branch. No unitarity hypothesis is imposed on . For , the result is when and zero otherwise.
QAlgorithms.Papers.Independent.Gap48.P23.preprocessing
For every natural number and every unrestricted real array , this defines a function taking any complex matrix indexed by binary words of length to a complex matrix indexed by pairs , where and . Its entries are
Here , with natural-number subtraction truncated at zero. With , the vectors in this formula are
where ranges over position permutations, , , and on equal arguments. Empty products equal one. No lawfulness, positivity, or normalization hypothesis is imposed. When , the function preserves the sole matrix entry.
QAlgorithms.Papers.Independent.Gap48.P23.preprocessingBranch
For every natural number , every unrestricted real array , every , and every complex matrix indexed by binary words of length , this defines a complex matrix indexed by , with entries
Here , using subtraction truncated at zero, and
where consists of all position permutations, , , and on equal arguments. Empty products equal one. Neither a lawfulness condition on nor positivity or normalization of is assumed. For , the output is the same single matrix entry as the input.
QAlgorithms.Papers.Independent.Gap48.P23.primedDicke
For every natural number and index , this defines a complex vector indexed by and Boolean strings of length , with coordinates
where is the number of true entries and denotes an indicator. The formulas expand the referenced string vectors directly. If , there is no permissible index , so this definition supplies an empty family of vectors.
QAlgorithms.Papers.Independent.Gap48.P23.recurrenceA
For any natural numbers , including zero and with no restriction relating them, this defines the real number
where all arithmetic in the fraction is real arithmetic. Division by zero is defined to give zero, so whenever or .
QAlgorithms.Papers.Independent.Gap48.P23.recurrenceB
For any natural numbers , including zero and with no restriction relating them, this defines the real number
where all arithmetic in the fraction is real arithmetic. Division by zero is defined to give zero, so whenever or .
QAlgorithms.Papers.Independent.Gap48.P23.reducedAction
For every natural number and complex matrix , this defines a matrix indexed by pairs with and . Its entry at is zero if , and is if , where, for every natural number and ,
All real factors are embedded into , and empty sums are zero. Thus the definition specifies a block diagonal matrix without requiring to be unitary or invertible. For , it gives the matrix .
QAlgorithms.Papers.Independent.Gap48.P23.reversalCount
For arbitrary natural numbers and any Boolean function on , this defines the natural number
Indices with contribute nothing, even when , and an empty index set gives count zero.
QAlgorithms.Papers.Independent.Gap48.P23.reversedKetFactors
For arbitrary natural numbers , a complex matrix , a Boolean function on , and an index , this defines a complex matrix by
Here is the ordinary transpose, without complex conjugation. The parameter is unrestricted, so indices , when present, give the zero matrix; when , there is no permissible .
QAlgorithms.Papers.Independent.Gap48.P23.samplingProbability
For natural numbers and an index , this defines the real number
The binomial coefficients are converted to real numbers before the subtraction and division. The parameter is unrestricted; in particular, gives zero through the support condition. On the nonzero branch, , so the denominator is positive. The case is included: its only index is , giving value when and zero otherwise.
QAlgorithms.Papers.Independent.Gap48.P23.schurDicke
For any natural numbers , this defines a complex vector indexed by Boolean strings of length , with coordinates
where is the number of true entries in . There is no assumption that ; if , the vector is zero. For , there is one empty string, and its coordinate is when and otherwise. The reciprocal is the total real reciprocal, with , and the displayed real coordinates are regarded as complex numbers.
QAlgorithms.Papers.Independent.Gap48.P23.schurMultiplicity
For every natural number and every index satisfying , this defines the natural number
The outer subtraction is natural-number subtraction and therefore truncates at zero if its second operand exceeds its first. In the second branch , so the natural-number subtraction does not underflow. At the value is , including when .
QAlgorithms.Papers.Independent.Gap48.P23.schurRecovery
For every natural number and every unrestricted real array , this defines a function from complex matrices indexed by pairs , with and , to complex matrices indexed by binary words of length . Its entries are
where , using subtraction truncated at zero. For ,
with all position permutations , , , and on equal arguments. Equivalently, before multiplication by the matrices formed from these vectors, the construction retains only equal and equal multiplicity indices, dividing each retained entry by the corresponding multiplicity. Entries of between different are unused. Empty products equal one, and division uses complex arithmetic. No lawfulness condition on or density-matrix condition on is assumed. For , this preserves the sole matrix entry.
QAlgorithms.Papers.Independent.Gap48.P23.schurSeed
For every natural number , every integer , and every integer , where , this defines a vector in the complex Euclidean space indexed by words . Its coordinates are
All displayed real values are regarded as complex coordinates. The code reads word coordinates through the extension that returns zero outside ; the indices used here lie within that range under the stated bounds. Empty sums are zero and empty products are one. In particular, gives the constant value on words of weight , and gives the single coordinate .
QAlgorithms.Papers.Independent.Gap48.P23.schurTransform
For every natural number and every unrestricted real array , this defines a complex matrix whose columns are indexed by binary words of length and whose rows are indexed by triples , with , , and . Here , with subtraction truncated at zero. Its entries are
where
and , , with on equal arguments. The sum over ranges over all permutations of the positions. Empty products equal one. No lawfulness condition on the coefficients is required; for , this is the matrix with entry one.
QAlgorithms.Papers.Independent.Gap48.P23.schurVector
For every natural number , every unrestricted real array , and every triple with , , and , this defines a complex Euclidean vector indexed by binary words of length , where , with subtraction truncated at zero. Explicitly,
where
Here is the set of permutations of the positions; its appearance comes from the permutation matrix sending a word to . Empty sums and products have values zero and one, respectively. The coefficients with are ignored. No condition on is assumed; for , the sole vector has its sole coordinate equal to one.
QAlgorithms.Papers.Independent.Gap48.P23.schurWeightProbability
For all natural numbers , this defines the real number
The subtraction in the numerator takes place in , after converting the binomial coefficients to real numbers. There are no restrictions such as , , or , and no nonnegativity condition is asserted. Binomial coefficients outside their usual range are zero, and real division by zero is defined to be zero; consequently the value is zero whenever . This includes .
QAlgorithms.Papers.Independent.Gap48.P23.singleContraction
For every natural number and every pair of complex matrices , this defines the complex matrix with entries
No conjugation is applied. The definition includes , when there are no entries.
QAlgorithms.Papers.Independent.Gap48.P23.singletDicke
For every natural number and index , this defines a complex vector indexed by and Boolean strings of length . When , write for the first bit and for the remaining bits; its coordinates are
where counts true entries. The defining expression has a zero branch when , but there is no index in its required index set in that case.
QAlgorithms.Papers.Independent.Gap48.P23.singletEdge
For every natural number , every , and positions , this predicate holds exactly when there is an integer with such that
The subtraction is natural-number subtraction, which is nontruncated here because . When , the predicate is false for every pair of positions.
QAlgorithms.Papers.Independent.Gap48.P23.singletMatrix
This defines the complex matrix indexed by as
QAlgorithms.Papers.Independent.Gap48.P23.smallFidelities
For every natural number , this defines an ordered list of real numbers by
Thus the list is empty for and for every natural number other than ; repeated entries and their positions are retained.
QAlgorithms.Papers.Independent.Gap48.P23.symmetricCG
For every natural number , this defines a complex matrix whose columns are indexed by pairs , with and a Boolean string of length , and whose rows form the disjoint union of left indices and right indices . Its entries are
Here counts true entries and is an indicator. These entries are the complex conjugates of the coordinates of the explicitly defined primed and pair vectors; those coordinates are real, so conjugation leaves the displayed formulas unchanged. For , there are no left rows, and the two right rows give the identity matrix under the identification of a column with its first index , since the string register then contains only the empty string.
QAlgorithms.Papers.Independent.Gap48.P23.symmetricDualCG
For every natural number , including , this defines the matrix
whose rows are indexed by and columns by . To specify , let when the binary string has Hamming weight , and otherwise. For , define and ; for , define when , and otherwise. Then and . All binomial coefficients are interpreted as real numbers before taking square roots and inverses. When , the first row-index summand is empty and the binary-string register consists of the unique empty string.
QAlgorithms.Papers.Independent.Gap48.P23.symmetricEmbedding
This is an abbreviation for the following family of complex matrices: for every natural number , rows are indexed by bit strings , columns by integers , and the entry is
The square root is real and its reciprocal is regarded as complex. For , there is one empty bit string and the matrix has its sole entry equal to .
QAlgorithms.Papers.Independent.Gap48.P23.symmetricEmbeddingChannel
For every natural number , this defines a function from arbitrary complex matrices to matrices indexed by -bit strings by , where if has exactly true bits, and is zero otherwise. Explicitly, with denoting the number of true bits in ,
No positivity or normalization hypothesis is required on . At , this sends the single input entry to the same entry indexed by the empty bit string.
QAlgorithms.Papers.Independent.Gap48.P23.tableFunction
For any natural numbers and any binary word , let be the number of positions where equals , let if and otherwise, and set
The function returns when , and otherwise, as an element of . The divisions, remainder, and exponent subtraction here are operations on natural numbers; subtraction is truncated at zero, although for these inputs. There is no bound on , and even are included, with the tie taking the first branch. For , the unique empty word is mapped to .
QAlgorithms.Papers.Independent.Gap48.P23.targetDensity
For a natural number , an arbitrary complex matrix , and an index , this defines , where is the matrix with entry at and zero elsewhere. Its entry at is . No unitarity assumption on is required, so the definition does not require this matrix to have trace . Supplying requires .
QAlgorithms.Papers.Independent.Gap48.P23.template
For every natural number , let , , and , with this last subtraction performed in the natural numbers. Given arbitrary real coefficients , indexed by , , and permutations of the positions, and an arbitrary real function , this defines a function from complex matrices on words to complex matrices by
Here the seed vector is
the permutation operator satisfies , and , while for . The matrix , indexed by , has entries
To define , let when the Boolean word has true entries, and otherwise. For , set and
for , set . The other map is
where is the pushforward of normalized Haar measure on under , and . Empty products are and empty sums are zero. No orthogonality or lawfulness condition on , no bounds on , and no positivity or normalization condition on are assumed; the definition includes .
QAlgorithms.Papers.Independent.Gap48.P23.traceIsometry
This abbreviates the family of complex matrices indexed by every natural number , with columns and rows where and , with both subtractions and additions in this row bound performed in the natural numbers. Its entries are
Here in the numerator is natural-number subtraction before conversion to a real number, and the coefficients are embedded in . For , the row index satisfies . For , natural-number subtraction gives , so there are two rows and one column; all entries are zero because real division by zero is defined to be zero.
QAlgorithms.Papers.Independent.Gap48.P23.traceKraus
For every natural number and every integer index with , this defines a complex matrix by
The square roots and divisions are real, with their results regarded as complex numbers. When , there is no admissible index , so this family has no matrices at that value.
QAlgorithms.Papers.Independent.Gap48.P23.traceMatrixUnit
For every natural number and every pair of integer indices with , this defines the complex matrix
Here is the matrix with entry at row , column , and zero elsewhere. The arithmetic in the coefficients is real arithmetic, followed by embedding in , and the cases are tested in the displayed order. When , the only indices are , and the output is zero because division by zero is defined to be zero.
QAlgorithms.Papers.Independent.Gap48.P23.traceSubspace
For every natural number , this defines the complex linear span, in the space of vectors indexed by , of the vectors for all , where
Here is a Boolean string of length , counts true entries, and is an indicator. The span consists of all finite complex linear combinations of these generators; for , the generating family is empty and the subspace is .
QAlgorithms.Papers.Independent.Gap48.P23.unitarySubspace
For every natural number , let , , and , with truncated natural subtraction. Given arbitrary real coefficients indexed by , , and position permutations , together with a chosen and , this defines the complex linear span of the vectors for in the Euclidean space of complex functions on binary words of length . These vectors are , and, for , , where and
Empty products are . No lawfulness, nonvanishing, independence, or invariance hypothesis is imposed on the spanning vectors; in particular, a nonzero multiplicity index with all its coefficients zero yields the zero subspace. The case is included.
QAlgorithms.Papers.Independent.Gap48.P23.unitarySymmetrization
For any natural numbers , put . Given any function from complex matrices indexed by to complex matrices, this defines a function whose output on any complex matrix has, for every , entry
where is Haar measure on the unitary group normalized to have total mass one. No linearity, channel, measurability, or integrability assumption is imposed on ; the integral uses the totalized convention that a nonintegrable integrand has integral zero. Both and are included, and an empty product equals one.
QAlgorithms.Papers.Independent.Gap48.P23.universalNotChannel
This abbreviates the following family of maps, indexed by every natural number , from complex matrices to complex matrices:
Here is the probability measure obtained by choosing a unitary matrix according to normalized Haar measure and applying it to the coordinate vector ; a vector outer product has entries . The trace supplies a complex scalar multiplying the matrix inside the integral. The definition includes and arbitrary matrix inputs .
QAlgorithms.Papers.Independent.Gap48.P23.vectorSwap
For every natural number , this defines the complex matrix indexed by ordered pairs from whose entry at row and column is if and otherwise. For , this is a matrix with no rows or columns.
QAlgorithms.Papers.Independent.Gap48.P23.vectorizedBra
For every natural number , every complex matrix , and every complex-valued function on pairs of indices in , this defines
There is no complex conjugation in this expression. For , the empty sum is .
QAlgorithms.Papers.Independent.Gap48.P23.weightRepresentative
For every pair of natural numbers , this defines a word by when , and otherwise, where natural-number subtraction is truncated at zero. Thus, when , the word consists of zeros followed by ones; when , every entry is one. For , it is the unique empty word.
QAlgorithms.Papers.Independent.Gap48.P23.wordAt
For every natural number , every word , and every natural number , this defines
Thus the word is extended by zero at every index outside its original range; when , the value is zero for every .
QAlgorithms.Papers.Independent.Gap48.P23.wordBinaryEmbedding
For every natural number , this defines a complex matrix with rows indexed by Boolean strings of length and columns indexed by functions . Its entry is exactly when every coordinate agrees under the identification , , and is otherwise:
For , both index sets contain just the empty string, and the sole entry is .
QAlgorithms.Papers.Independent.Gap48.P23.wordPermutationMatrix
For all natural numbers and every permutation of , this defines a complex matrix whose rows and columns are indexed by words , with entries
When , this is the one-by-one matrix with entry , including when ; when , it is a matrix with an empty index set.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.