Definitions for Schur-Weyl Duality for the Clifford Group with Applications: Property Testing, a Robust Hudson Theorem, and de Finetti Representations
DefinitionQAlgorithms_Papers_Independent_Extend50_P30The objects the formalized statements of Schur-Weyl Duality for the Clifford Group with Applications: Property Testing, a Robust Hudson Theorem, and de Finetti Representations (arXiv:1712.08628) are stated in. Each was checked against the paper by a blind read-back and a moderator.
ResidueRegister: PDF p.14: n qudits in the specified cyclic-residue computational basis.DiscretePhaseSpace: PDF p.15: momentum and position labels over ZMod d, also for composite d.QuditOperator: PDF p.14: operators indexed by the cyclic computational register.QuditCopies: Specialize the accepted copy register to the source cyclic-qudit basis.phaseModulus: PDF p.14: the order of weylPhase.weylRoot: PDF p.14: omega, with the stray q removed as fixed by the action of Z.weylPhase: PDF p.14: weylPhase includes the parity-dependent sign.cyclicWeyl: PDF pp.14--15, (2.1): canonical lifts and output-row convention for Z^p X^q.symplecticBracket: PDF p.15, (2.3), with the source sign.cyclicPauliGroup: PDF pp.14--17: the finite Pauli group, including all powers of weylPhase.IsCyclicStabilizerGroup: PDF p.16: finite Pauli subgroup with no nonidentity scalar.pauliAverageProjector: PDF p.16, (2.14): code projection before trace normalization.mixedStabilizers: PDF p.58 footnote 8: maximally mixed code states, not their convex hull.stabilizers: PDF p.17: phase-free pure stabilizer density matrices.IsStabilizer: Pure stabilizer predicate; vector phases are immaterial.stabilizerOverlap: Fidelity with a pure state specified by its density matrix.FarFromStabilizers: Source maximum upper bound, pointwise on exactly the finite stabilizer set.IsClifford: PDF p.14: full unitary normalizer, retaining scalar representatives.characteristicDistribution: PDF p.18, (3.2): characteristic distribution.weylBellVector: PDF p.19: normalized Bell vector (W_x tensor I)|Phi+>.bellDifference: PDF p.19: two Bell measurements and XOR of the labels, on four copies.qubitTest: PDF p.22, (3.11): Algorithm 1, four sampling copies and two verification copies.realQubitTest: PDF p.22, Remark 3.5: two Bell-sampling and two verification copies.quditInvolution: PDF p.23, (3.15): alternating W and W dagger, with normalization d^{-n}.quditTest: PDF p.24: accepting effect on exactly 2s copies.soundnessConstant: PDF p.25: exact soundness coefficient.CopyTest: Binary POVM on k physical copies, fixed independently of the input.CopyTest.prob: Born probability from the carried effect and copy count.residueQuadratic: PDF p.27: q, with canonical lifts, including reduction modulo 4 at d=2.IsStochasticLagrangian: PDF p.27: at prime d, cardinality d^t is exactly dimension t.LagrangianrelationOperator: PDF p.27: incidence matrix of the actual subspace.tensorRelation: PDF p.27: r(T) tensor n, regrouped into t blocks of n qudits.cliffordCommutant: Concrete commutant of all Clifford tensor powers.commutantCount: The t-1 factors give an empty product at t=1.IsStochasticOrthogonal: PDF p.34, Definition 4.11.StochasticOrthogonalgraphRelation: Graph of a computed linear map.perpendicular: PDF p.36: dot-product annihilator.IsDefect: PDF p.36: isotropy and co-stochasticity are both required.leftDefect: PDF p.37: left kernel.rightDefect: PDF p.37: right kernel.defectQuotient: PDF p.36: N-perp/N as a submodule of the ambient quotient.defectClass: Quotient class of an admissible representative.defectRepresentative: Canonical representative for the phase-independent coset vector.DefectIsomorphism: PDF p.36: invertible linear quotient map preserving q on all representatives and the ones class.defectRelationSet: PDF p.36, (4.17): the actual relation, with quotient direction right to left.defectRelation: Linear span construction, accompanied by exact relation-set equality in the theorem.cosetState: PDF p.39: uniform normalized coset ket.cssRelation: PDF p.39, (4.21): CSS relation with equal defects and identity quotient map.cssProjector: PDF p.39, (4.22): independent Pauli definition of the CSS projector.composeRelation: PDF pp.40--41: relational composition with an existential intermediate vector.actedRelation: PDF p.36: left/right action; the right coordinate uses transpose.SameDoubleOrbit: PDF p.38: concrete double orbit predicate.antiPermutation: PDF p.44: binary anti-permutation matrix.phasePointOperator: PDF p.16, (2.11): phase-space point operator.discreteWigner: PDF p.16, (2.10), real for odd d on pure-state inputs.sumNegativity: PDF p.58: negative mass, not the full l1 norm.threeCopyInvolution: PDF p.61, (8.3): the concrete three-copy involution.threeCopyTest: PDF p.62: accepting effect on three copies.stabilizerMoment: PDF p.45: uniform moment without counting state phases repeatedly.momentNormalization: PDF p.46: Z_{n,d,t}.minimalTest: PDF p.48, (5.11): group-average test independent of the stabilizer span.IsOrthogonalProjectionOnto: Orthogonal projection onto a specified concrete vector subspace.stabilizerSpan: PDF p.48: actual span of stabilizer tensor powers.repeatEffect: Tensor product of r copies of a k-copy effect, flattened to k*r physical copies.embeddedLocal: A constant-size block acting on the k corresponding qudits at physical site j.copyPrefixReduction: Copy-prefix partial trace, reusing the accepted construction with reordered arguments. Its n=0 and s=0 values are scalar traces, not junk defaults.compressZero: Zero-ancilla compression in the physical-qudit coordinates.permutationOperator: Computational permutation of the t blocks.IsPermutationSymmetric: The symmetric-subspace condition is vector invariance.embeddedAntiIdentity: Anti-identity on a specified set of six distinct blocks.IsDistributionOn: Finite probability weights on precisely a named finite set.stabilizerMixture: Convex mixture of s-copy density tensors.stabilizerVector: A representative vector for each phase-free pure stabilizer, with a harmless default off the set.stabilizerGram: PDF p.53: source Gram matrix, built from the canonical state representatives.stabilizerFrame: PDF p.53: the frame operator Q, constructed independently of a Gram bound.positivePseudoInverse: Moore--Penrose inverse of a PSD matrix, with zero inverse defined as zero by cfc.rowVectorize: Source row-stacking vectorization; unlike Matrix.vec it indexes the row first.unitaryChoiVector: Normalized Choi ket, ordered as the output register then the reference register.haarMoment: Finite normalized Haar moment, using the exact permutation formula (5.7), PDF p.47. This is a formula for the Haar integral, not a new distributional hypothesis.PauliAction: One scalar-free Clifford is specified by its conjugation action on the finite Pauli group.RealizesAction: The faithful finite image of the Clifford group modulo scalar phases.cliffordActions: The actual finite normalizer quotient; only realized actions are counted.cliffordRepresentative: Choice of scalar representative has no effect on any density-matrix twirl.cliffordMoment: PDF pp.49--50: uniform Clifford-orbit moment, counted once modulo phases.residuePermutation: PDF p.50: permutation matrix over the residue field.transposeRelation: Transposed relation.SameDesignClass: Definition 6.1: permutation double action plus transposition, not O-double-orbits.designClasses: Distinct equivalence classes are represented as finite subsets, avoiding a chosen enumeration.designClassOf: PDF pp.51--52: actual class containing a specified subspace.qutritDefect: All-ones defect of the qutrit example.qutritFourThird: Third representative printed on PDF p.52, with eight coordinates grouped as left/right.qutritFourAnti: Qutrit anti-identity of (4.35) for t=4; entries 1 on diagonal and 2 elsewhere.canonicalDefectMap: PDF p.37: canonical right-to-left quotient function obtained from the relation itself.doubleClasses: Finite collection of actual double orbits.unitaryDistance: Source average-case distance for unitary testing.choiMonomial: Degree-six Choi tensor monomial, without an irrelevant common normalization.cliffordPolynomial: PDF p.8: actual degree-six anti-identity invariance equations in the entries of U.qubitVerificationUnitary: PDF p.22, (3.11): the source six-copy verification unitary, not the anti-identity surrogate.designClassSum: Class sums R_i from Definition 6.1, independent of a state or its twirl.designCoefficients: The coefficients of the concrete Clifford moment, set to zero off the actual class set. The source stable-range theorem guarantees the expansion; no such guarantee is a hypothesis.qutritSymmetricProjector: Physical symmetric projector on three qutrit blocks.qutritAlternatingProjector: Physical alternating projector on three qutrit blocks.qutritCSSProjector: PDF p.42, (4.29): independent CSS Pauli projector, tensorized over physical sites.qutritPieceProjector: PDF pp.42--43: the four compressed pieces, and one physical standard-S3 multiplicity slice. P_minus is defined by alternating compression, which fixes the printed plus-sign error.qutritPiece: Source physical irreducible carriers, constructed from the five projections.IsCliffordInvariant: Invariance under the actual Clifford tensor-power action.IsCliffordIrreducible: Nonzero irreducible physical Clifford module.CliffordModulesEquivalent: Equivalence means an actual linear bijection intertwining the physical action on the two carriers.pieceIndex: Four one-fold constituents and two copies of the (2,1) constituent.QutritDecompositionstandardS3: The standard S3 representation in the basis e0-e2,e1-e2 of the zero-sum plane.
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Information
import Definitions.Def_QAlgorithms_Defs_MatrixDistances
import Definitions.Def_QAlgorithms_Defs_Ensemble
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P63
import Definitions.Def_QAlgorithms_Papers_Independent_Advance50_P30
import Definitions.Def_QAlgorithms_Papers_Independent_Gap20_P06
/-! Concrete models for arXiv:1712.08628v3. Computational indices are copy-first.
Accepted tensor powers, copy carriers and prefix partial trace are imported.
Cyclic-residue phases and finite quadratic geometry use paper-specific names;
the similarly named frozen continuous-variable objects have different domains. -/
noncomputable section
open scoped BigOperators ComplexConjugate Matrix
namespace QAlgorithms.Papers.Independent.Extend50.P30
open QAlgorithms.Papers.Independent.Information100.P63 (tensorPower)
open QAlgorithms.Papers.Independent.Gap20.P06 (ketBra)
attribute [local instance] Classical.propDecidable
/-- PDF p.14: n qudits in the specified cyclic-residue computational basis. -/
abbrev ResidueRegister (d n : ℕ) := Fin n → ZMod d
/-- PDF p.15: momentum and position labels over ZMod d, also for composite d. -/
abbrev DiscretePhaseSpace (d n : ℕ) := ResidueRegister d n × ResidueRegister d n
/-- PDF p.14: operators indexed by the cyclic computational register. -/
abbrev QuditOperator (d n : ℕ) := Matrix (ResidueRegister d n) (ResidueRegister d n) ℂ
/-- Specialize the accepted copy register to the source cyclic-qudit basis. -/
abbrev QuditCopies (d n t : ℕ) :=
QAlgorithms.Papers.Independent.Gap48.P20.Copies (ResidueRegister d n) t
/-- PDF p.14: the order of weylPhase. -/
def phaseModulus (d : ℕ) : ℕ := if Even d then 2 * d else d
/-- PDF p.14: omega, with the stray q removed as fixed by the action of Z. -/
def weylRoot (d : ℕ) : ℂ := Complex.exp (2 * Real.pi * Complex.I / (d : ℂ))
/-- PDF p.14: weylPhase includes the parity-dependent sign. -/
def weylPhase (d : ℕ) : ℂ := (-1 : ℂ) ^ d * Complex.exp (Real.pi * Complex.I / (d : ℂ))
/-- PDF pp.14--15, (2.1): canonical lifts and output-row convention for Z^p X^q. -/
def cyclicWeyl (d n : ℕ) [NeZero d] (x : DiscretePhaseSpace d n) : QuditOperator d n :=
fun a b => if a = b + x.2 then
(weylPhase d) ^ (-((∑ j, (x.1 j).val * (x.2 j).val : ℕ) : ℤ)) *
(weylRoot d) ^ (∑ j, (x.1 j).val * (a j).val) else 0
/-- PDF p.15, (2.3), with the source sign. -/
def symplecticBracket {d n : ℕ} (x y : DiscretePhaseSpace d n) : ZMod d :=
∑ j, (x.1 j * y.2 j - x.2 j * y.1 j)
/-- PDF pp.14--17: the finite Pauli group, including all powers of weylPhase. -/
def cyclicPauliGroup (d n : ℕ) [NeZero d] : Finset (QuditOperator d n) :=
((Finset.range (phaseModulus d)).product (Finset.univ : Finset (DiscretePhaseSpace d n))).image
(fun a => (weylPhase d) ^ a.1 • cyclicWeyl d n a.2)
/-- PDF p.16: finite Pauli subgroup with no nonidentity scalar. -/
def IsCyclicStabilizerGroup {d n : ℕ} [NeZero d] (G : Finset (QuditOperator d n)) : Prop :=
G ⊆ cyclicPauliGroup d n ∧ 1 ∈ G ∧
(∀ A ∈ G, ∀ B ∈ G, A * B ∈ G) ∧ (∀ A ∈ G, Aᴴ ∈ G) ∧
(∀ A ∈ G, ∀ c : ℂ, A = c • (1 : QuditOperator d n) → c = 1)
/-- PDF p.16, (2.14): code projection before trace normalization. -/
def pauliAverageProjector {d n : ℕ} [NeZero d] (G : Finset (QuditOperator d n)) : QuditOperator d n :=
(G.card : ℂ)⁻¹ • ∑ P ∈ G, P
/-- PDF p.58 footnote 8: maximally mixed code states, not their convex hull. -/
def mixedStabilizers (d n : ℕ) [NeZero d] : Finset (QuditOperator d n) :=
(((cyclicPauliGroup d n).powerset.filter IsCyclicStabilizerGroup).image fun G =>
((pauliAverageProjector G).trace)⁻¹ • pauliAverageProjector G)
/-- PDF p.17: phase-free pure stabilizer density matrices. -/
def stabilizers (d n : ℕ) [NeZero d] : Finset (QuditOperator d n) :=
(mixedStabilizers d n).filter fun A => ∃ v : EuclideanSpace ℂ (ResidueRegister d n),
‖v‖ = 1 ∧ A = QAlgorithms.pureDensity v
/-- Pure stabilizer predicate; vector phases are immaterial. -/
def IsStabilizer {d n : ℕ} [NeZero d] (v : EuclideanSpace ℂ (ResidueRegister d n)) : Prop :=
‖v‖ = 1 ∧ QAlgorithms.pureDensity v ∈ stabilizers d n
/-- Fidelity with a pure state specified by its density matrix. -/
def stabilizerOverlap {d n : ℕ} [NeZero d] (S : QuditOperator d n)
(v : EuclideanSpace ℂ (ResidueRegister d n)) : ℝ := QAlgorithms.effectProb S (QAlgorithms.pureDensity v)
/-- Source maximum upper bound, pointwise on exactly the finite stabilizer set. -/
def FarFromStabilizers {d n : ℕ} [NeZero d]
(v : EuclideanSpace ℂ (ResidueRegister d n)) (epsilon : ℝ) : Prop :=
∀ S ∈ stabilizers d n, stabilizerOverlap S v ≤ 1 - epsilon ^ 2
/-- PDF p.14: full unitary normalizer, retaining scalar representatives. -/
def IsClifford {d n : ℕ} [NeZero d] (U : QuditOperator d n) : Prop :=
U ∈ Matrix.unitaryGroup (ResidueRegister d n) ℂ ∧
(cyclicPauliGroup d n).image (fun P => U * P * Uᴴ) = cyclicPauliGroup d n
/-- PDF p.18, (3.2): characteristic distribution. -/
def characteristicDistribution {d n : ℕ} [NeZero d]
(v : EuclideanSpace ℂ (ResidueRegister d n)) (x : DiscretePhaseSpace d n) : ℝ :=
((d : ℝ) ^ n)⁻¹ * Complex.normSq (inner ℂ v (QAlgorithms.act (cyclicWeyl d n x) v))
/-- PDF p.19: normalized Bell vector (W_x tensor I)|Phi+>. -/
def weylBellVector (n : ℕ) (x : DiscretePhaseSpace 2 n) :
EuclideanSpace ℂ (ResidueRegister 2 n × ResidueRegister 2 n) :=
WithLp.toLp 2 (fun a => ((Real.sqrt ((2 : ℝ) ^ n))⁻¹ : ℂ) * cyclicWeyl 2 n x a.1 a.2)
/-- PDF p.19: two Bell measurements and XOR of the labels, on four copies. -/
def bellDifference (n : ℕ) (a : DiscretePhaseSpace 2 n) :
Matrix (QuditCopies 2 n 4) (QuditCopies 2 n 4) ℂ :=
fun u v => ∑ x : DiscretePhaseSpace 2 n,
QAlgorithms.pureDensity (weylBellVector n x) (u 0, u 1) (v 0, v 1) *
QAlgorithms.pureDensity (weylBellVector n (x + a)) (u 2, u 3) (v 2, v 3)
/-- PDF p.22, (3.11): Algorithm 1, four sampling copies and two verification copies. -/
def qubitTest (n : ℕ) : Matrix (QuditCopies 2 n 6) (QuditCopies 2 n 6) ℂ :=
fun u v => ∑ a : DiscretePhaseSpace 2 n,
bellDifference n a (fun i => u ⟨i.val, by omega⟩) (fun i => v ⟨i.val, by omega⟩) *
(2⁻¹ : ℂ) * ((if (u 4, u 5) = (v 4, v 5) then 1 else 0) +
cyclicWeyl 2 n a (u 4) (v 4) * (cyclicWeyl 2 n a)ᴴ (u 5) (v 5))
/-- PDF p.22, Remark 3.5: two Bell-sampling and two verification copies. -/
def realQubitTest (n : ℕ) : Matrix (QuditCopies 2 n 4) (QuditCopies 2 n 4) ℂ :=
fun u v => ∑ a : DiscretePhaseSpace 2 n,
QAlgorithms.pureDensity (weylBellVector n a) (u 0, u 1) (v 0, v 1) * (2⁻¹ : ℂ) *
((if (u 2, u 3) = (v 2, v 3) then 1 else 0) +
cyclicWeyl 2 n a (u 2) (v 2) * (cyclicWeyl 2 n a)ᴴ (u 3) (v 3))
/-- PDF p.23, (3.15): alternating W and W dagger, with normalization d^{-n}. -/
def quditInvolution (d n s : ℕ) [NeZero d] :
Matrix (QuditCopies d n (2 * s)) (QuditCopies d n (2 * s)) ℂ :=
fun u v => ((d : ℂ) ^ n)⁻¹ * ∑ x : DiscretePhaseSpace d n,
∏ j : Fin (2 * s), if Even j.val then cyclicWeyl d n x (u j) (v j)
else (cyclicWeyl d n x)ᴴ (u j) (v j)
/-- PDF p.24: accepting effect on exactly 2s copies. -/
def quditTest (d n s : ℕ) [NeZero d] :
Matrix (QuditCopies d n (2 * s)) (QuditCopies d n (2 * s)) ℂ :=
(2⁻¹ : ℂ) • (1 + quditInvolution d n s)
/-- PDF p.25: exact soundness coefficient. -/
def soundnessConstant (d s : ℕ) : ℝ :=
(1 - (1 - 1 / (4 * (d : ℝ) ^ 2)) ^ (s - 1)) / 2
/-- Binary POVM on k physical copies, fixed independently of the input. -/
structure CopyTest (d n : ℕ) [NeZero d] where
copies : ℕ
accept : Matrix (QuditCopies d n copies) (QuditCopies d n copies) ℂ
effect : QAlgorithms.IsEffect accept
/-- Born probability from the carried effect and copy count. -/
def CopyTest.prob {d n : ℕ} [NeZero d] (A : CopyTest d n)
(v : EuclideanSpace ℂ (ResidueRegister d n)) : ℝ :=
QAlgorithms.effectProb A.accept (tensorPower A.copies (QAlgorithms.pureDensity v))
/-- PDF p.27: q, with canonical lifts, including reduction modulo 4 at d=2. -/
def residueQuadratic {d t : ℕ} [NeZero d] (x : ResidueRegister d t) : ZMod (phaseModulus d) :=
∑ j, ((x j).val : ZMod (phaseModulus d)) ^ 2
/-- PDF p.27: at prime d, cardinality d^t is exactly dimension t. -/
def IsStochasticLagrangian {d t : ℕ} [NeZero d]
(T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) : Prop :=
(∀ z ∈ T, residueQuadratic z.1 = residueQuadratic z.2) ∧ Nat.card T = d ^ t ∧
((fun _ => 1), (fun _ => 1)) ∈ T
abbrev Lagrangian (d t : ℕ) [NeZero d] :=
{T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) // IsStochasticLagrangian T}
/-- Finite enumeration of source Sigma; no mathematical assumptions added. -/
instance instFintypeLagrangian (d t : ℕ) [NeZero d] : Fintype (Lagrangian d t) := Fintype.ofFinite _
/-- PDF p.27: incidence matrix of the actual subspace. -/
def relationOperator {d t : ℕ} [NeZero d]
(T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) : QuditOperator d t :=
fun x y => if (x, y) ∈ T then 1 else 0
/-- PDF p.27: r(T) tensor n, regrouped into t blocks of n qudits. -/
def tensorRelation {d t : ℕ} [NeZero d] (n : ℕ)
(T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) :
Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
fun x y => ∏ j : Fin n, relationOperator T (fun i => x i j) (fun i => y i j)
/-- Concrete commutant of all Clifford tensor powers. -/
def cliffordCommutant (d n t : ℕ) [NeZero d] :
Submodule ℂ (Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ) where
carrier := {A | ∀ U : QuditOperator d n, IsClifford U →
A * tensorPower t U = tensorPower t U * A}
zero_mem' := by simp
add_mem' := by intro A B hA hB U hU; simp [Matrix.add_mul, Matrix.mul_add, hA U hU, hB U hU]
smul_mem' := by intro c A hA U hU; simp [Matrix.smul_mul, Matrix.mul_smul, hA U hU]
/-- The t-1 factors give an empty product at t=1. -/
def commutantCount (d t : ℕ) : ℕ := ∏ k ∈ Finset.range (t - 1), (d ^ k + 1)
/-- PDF p.34, Definition 4.11. -/
def IsStochasticOrthogonal {d t : ℕ} [NeZero d]
(O : Matrix (Fin t) (Fin t) (ZMod d)) : Prop :=
(∀ x, residueQuadratic (O.mulVec x) = residueQuadratic x) ∧ O.mulVec (fun _ => 1) = (fun _ => 1)
abbrev StochasticOrthogonal (d t : ℕ) [NeZero d] :=
{O : Matrix (Fin t) (Fin t) (ZMod d) // IsStochasticOrthogonal O}
/-- Finite enumeration of source stochastic isometries. -/
instance instFintypeStochasticOrthogonal (d t : ℕ) [NeZero d] : Fintype (StochasticOrthogonal d t) := Fintype.ofFinite _
/-- Graph of a computed linear map. -/
def graphRelation {d t : ℕ} [NeZero d] (O : Matrix (Fin t) (Fin t) (ZMod d)) :
Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) where
carrier := {z | z.1 = O.mulVec z.2}
zero_mem' := by simp
add_mem' := by
intro a b ha hb
change a.1 = O.mulVec a.2 at ha
change b.1 = O.mulVec b.2 at hb
change a.1 + b.1 = O.mulVec (a.2 + b.2)
rw [Matrix.mulVec_add, ha, hb]
smul_mem' := by
intro c b hb
change b.1 = O.mulVec b.2 at hb
change c • b.1 = O.mulVec (c • b.2)
rw [Matrix.mulVec_smul, hb]
/-- PDF p.36: dot-product annihilator. -/
def perpendicular {d t : ℕ} (N : Submodule (ZMod d) (ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t) where
carrier := {x | ∀ y ∈ N, dotProduct x y = 0}
zero_mem' := by simp [dotProduct]
add_mem' := by
intro a b ha hb y hy
change (∑ i, (a i + b i) * y i) = 0
simp only [add_mul, Finset.sum_add_distrib]
change dotProduct a y + dotProduct b y = 0
rw [ha y hy, hb y hy, add_zero]
smul_mem' := by
intro c x hx y hy
change (∑ i, (c * x i) * y i) = 0
simp only [mul_assoc, ← Finset.mul_sum]
change c * dotProduct x y = 0
rw [hx y hy, mul_zero]
/-- PDF p.36: isotropy and co-stochasticity are both required. -/
def IsDefect {d t : ℕ} [NeZero d] (N : Submodule (ZMod d) (ResidueRegister d t)) : Prop :=
(∀ x ∈ N, residueQuadratic x = 0) ∧ (fun _ => 1) ∈ perpendicular N
/-- PDF p.37: left kernel. -/
def leftDefect {d t : ℕ} (T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t) := T.comap (LinearMap.inl (ZMod d) _ _)
/-- PDF p.37: right kernel. -/
def rightDefect {d t : ℕ} (T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t) := T.comap (LinearMap.inr (ZMod d) _ _)
/-- PDF p.36: N-perp/N as a submodule of the ambient quotient. -/
def defectQuotient {d t : ℕ} (N : Submodule (ZMod d) (ResidueRegister d t)) :=
(perpendicular N).map N.mkQ
/-- Quotient class of an admissible representative. -/
def defectClass {d t : ℕ} (N : Submodule (ZMod d) (ResidueRegister d t))
(x : ResidueRegister d t) (hx : x ∈ perpendicular N) : defectQuotient N :=
⟨N.mkQ x, ⟨x, hx, rfl⟩⟩
/-- Canonical representative for the phase-independent coset vector. -/
def defectRepresentative {d t : ℕ} (N : Submodule (ZMod d) (ResidueRegister d t))
(x : defectQuotient N) : ResidueRegister d t := Classical.choose x.property
/-- PDF p.36: invertible linear quotient map preserving q on all representatives and the ones class. -/
structure DefectIsomorphism {d t : ℕ} [NeZero d]
(N M : Submodule (ZMod d) (ResidueRegister d t)) where
linearEquiv : defectQuotient N ≃ₗ[ZMod d] defectQuotient M
residueQuadratic : ∀ x hx y hy, linearEquiv (defectClass N x hx) = defectClass M y hy →
P30.residueQuadratic x = P30.residueQuadratic y
stochastic : ∀ hx hy,
linearEquiv (defectClass N (fun _ => 1) hx) = defectClass M (fun _ => 1) hy
/-- PDF p.36, (4.17): the actual relation, with quotient direction right to left. -/
def defectRelationSet {d t : ℕ} [NeZero d] (N M : Submodule (ZMod d) (ResidueRegister d t))
(J : DefectIsomorphism M N) : Set (ResidueRegister d t × ResidueRegister d t) :=
{z | ∃ hx : z.1 ∈ perpendicular N, ∃ hy : z.2 ∈ perpendicular M,
J.linearEquiv (defectClass M z.2 hy) = defectClass N z.1 hx}
/-- Linear span construction, accompanied by exact relation-set equality in the theorem. -/
def defectRelation {d t : ℕ} [NeZero d] (N M : Submodule (ZMod d) (ResidueRegister d t))
(J : DefectIsomorphism M N) : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) :=
Submodule.span (ZMod d) (defectRelationSet N M J)
/-- PDF p.39: uniform normalized coset ket. -/
def cosetState {d t : ℕ} [NeZero d] (N : Submodule (ZMod d) (ResidueRegister d t))
(q : defectQuotient N) : EuclideanSpace ℂ (ResidueRegister d t) :=
WithLp.toLp 2 (fun x => if x - defectRepresentative N q ∈ N then
((Real.sqrt (Nat.card N : ℝ))⁻¹ : ℂ) else 0)
/-- PDF p.39, (4.21): CSS relation with equal defects and identity quotient map. -/
def cssRelation {d t : ℕ} (N : Submodule (ZMod d) (ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) where
carrier := {z | z.1 ∈ perpendicular N ∧ z.2 ∈ perpendicular N ∧ z.1 - z.2 ∈ N}
zero_mem' := by simp
add_mem' := by
rintro a b ⟨ha, hb, hc⟩ ⟨hd, he, hf⟩
exact ⟨(perpendicular N).add_mem ha hd, (perpendicular N).add_mem hb he,
by simpa [add_sub_add_comm] using N.add_mem hc hf⟩
smul_mem' := by
rintro c a ⟨ha, hb, hc⟩
exact ⟨(perpendicular N).smul_mem c ha, (perpendicular N).smul_mem c hb,
by simpa [smul_sub] using N.smul_mem c hc⟩
/-- PDF p.39, (4.22): independent Pauli definition of the CSS projector. -/
def cssProjector {d t : ℕ} [NeZero d] (N : Submodule (ZMod d) (ResidueRegister d t)) : QuditOperator d t :=
((Nat.card N : ℂ) ^ 2)⁻¹ • ∑ p : N, ∑ q : N,
cyclicWeyl d t (p.val, 0) * cyclicWeyl d t (0, q.val)
/-- PDF pp.40--41: relational composition with an existential intermediate vector. -/
def composeRelation {d t : ℕ}
(A B : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) :=
Submodule.span (ZMod d) {z | ∃ y, (z.1, y) ∈ A ∧ (y, z.2) ∈ B}
/-- PDF p.36: left/right action; the right coordinate uses transpose. -/
def actedRelation {d t : ℕ} (O P : Matrix (Fin t) (Fin t) (ZMod d))
(T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) :=
Submodule.span (ZMod d) {z | ∃ w ∈ T, z = (O.mulVec w.1, P.transpose.mulVec w.2)}
/-- PDF p.38: concrete double orbit predicate. -/
def SameDoubleOrbit {d t : ℕ} [NeZero d] (T S : Lagrangian d t) : Prop :=
∃ O P : StochasticOrthogonal d t, S.val = actedRelation O.val P.val T.val
/-- PDF p.44: binary anti-permutation matrix. -/
def antiPermutation {t : ℕ} (p : Equiv.Perm (Fin t)) : Matrix (Fin t) (Fin t) (ZMod 2) :=
fun i j => 1 - if i = p j then 1 else 0
/-- PDF p.16, (2.11): phase-space point operator. -/
def phasePointOperator (d n : ℕ) [NeZero d] (x : DiscretePhaseSpace d n) : QuditOperator d n :=
((d : ℂ) ^ n)⁻¹ • ∑ y : DiscretePhaseSpace d n,
(weylRoot d) ^ (-((symplecticBracket x y).val : ℤ)) • (cyclicWeyl d n y)ᴴ
/-- PDF p.16, (2.10), real for odd d on pure-state inputs. -/
def discreteWigner {d n : ℕ} [NeZero d] (v : EuclideanSpace ℂ (ResidueRegister d n))
(x : DiscretePhaseSpace d n) : ℝ :=
((d : ℝ) ^ n)⁻¹ * QAlgorithms.effectProb (phasePointOperator d n x) (QAlgorithms.pureDensity v)
/-- PDF p.58: negative mass, not the full l1 norm. -/
def sumNegativity {d n : ℕ} [NeZero d] (v : EuclideanSpace ℂ (ResidueRegister d n)) : ℝ :=
∑ x : DiscretePhaseSpace d n, max 0 (-discreteWigner v x)
/-- PDF p.61, (8.3): the concrete three-copy involution. -/
def threeCopyInvolution (d n : ℕ) [NeZero d] : Matrix (QuditCopies d n 3) (QuditCopies d n 3) ℂ :=
((d : ℂ) ^ n)⁻¹ • ∑ x : DiscretePhaseSpace d n, tensorPower 3 (phasePointOperator d n x)
/-- PDF p.62: accepting effect on three copies. -/
def threeCopyTest (d n : ℕ) [NeZero d] : Matrix (QuditCopies d n 3) (QuditCopies d n 3) ℂ :=
(2⁻¹ : ℂ) • (1 + threeCopyInvolution d n)
/-- PDF p.45: uniform moment without counting state phases repeatedly. -/
def stabilizerMoment (d n t : ℕ) [NeZero d] : Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
((stabilizers d n).card : ℂ)⁻¹ • ∑ S ∈ stabilizers d n, tensorPower t S
/-- PDF p.46: Z_{n,d,t}. -/
def momentNormalization (d n t : ℕ) : ℕ :=
d ^ n * ∏ k ∈ Finset.range (t - 1), (d ^ k + d ^ n)
/-- PDF p.48, (5.11): group-average test independent of the stabilizer span. -/
def minimalTest (d n t : ℕ) [NeZero d] : Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
(Nat.card (StochasticOrthogonal d t) : ℂ)⁻¹ •
∑ O : StochasticOrthogonal d t, tensorRelation n (graphRelation O.val)
/-- Orthogonal projection onto a specified concrete vector subspace. -/
def IsOrthogonalProjectionOnto {I : Type*} [Fintype I] [DecidableEq I]
(P : Matrix I I ℂ) (V : Submodule ℂ (I → ℂ)) : Prop :=
Pᴴ = P ∧ P * P = P ∧ LinearMap.range (Matrix.toLin' P) = V
/-- PDF p.48: actual span of stabilizer tensor powers. -/
def stabilizerSpan (d n t : ℕ) [NeZero d] : Submodule ℂ (QuditCopies d n t → ℂ) :=
Submodule.span ℂ {w | ∃ v : EuclideanSpace ℂ (ResidueRegister d n), IsStabilizer v ∧
w = fun x => QAlgorithms.tensorPow t v x}
/-- Empty tensors are scalars, including the zero-qudit corner. -/
example {I : Type*} (A : Matrix I I ℂ) (x y : Fin 0 → I) : tensorPower 0 A x y = 1 := by
simp [tensorPower]
/-- Graph incidence agrees with the computational permutation matrix. -/
example {d t : ℕ} [NeZero d] (O : Matrix (Fin t) (Fin t) (ZMod d)) (x y : ResidueRegister d t) :
relationOperator (graphRelation O) x y = (if x = O.mulVec y then 1 else 0) := by
simp [relationOperator, graphRelation]
/-- The t=1 product is empty. -/
example (d : ℕ) : commutantCount d 1 = 1 := by simp [commutantCount]
/-- Qubit q takes values modulo four. -/
example : phaseModulus 2 = 4 := by norm_num [phaseModulus]
/-- Tensor product of r copies of a k-copy effect, flattened to k*r physical copies. -/
def repeatEffect {d n k : ℕ} [NeZero d] (r : ℕ)
(A : Matrix (QuditCopies d n k) (QuditCopies d n k) ℂ) :
Matrix (QuditCopies d n (k * r)) (QuditCopies d n (k * r)) ℂ :=
fun x y => ∏ j : Fin r, A
(fun i => x ⟨j.val * k + i.val, by nlinarith [j.isLt, i.isLt, Nat.mul_le_mul_right k (Nat.succ_le_of_lt j.isLt)]⟩)
(fun i => y ⟨j.val * k + i.val, by nlinarith [j.isLt, i.isLt, Nat.mul_le_mul_right k (Nat.succ_le_of_lt j.isLt)]⟩)
/-- A constant-size block acting on the k corresponding qudits at physical site j. -/
def embeddedLocal {d n k : ℕ} [NeZero d] (j : Fin n)
(L : Matrix (QuditCopies d 1 k) (QuditCopies d 1 k) ℂ) :
Matrix (QuditCopies d n k) (QuditCopies d n k) ℂ :=
fun x y => if ∀ i l, l ≠ j → x i l = y i l then
L (fun i _ => x i j) (fun i _ => y i j) else 0
/-- Copy-prefix partial trace, reusing the accepted construction with reordered arguments.
Its n=0 and s=0 values are scalar traces, not junk defaults. -/
def copyPrefixReduction {d n t : ℕ} [NeZero d] (s : ℕ) (hs : s ≤ t)
(A : Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ) :
Matrix (QuditCopies d n s) (QuditCopies d n s) ℂ :=
QAlgorithms.Papers.Independent.Advance50.P30.reduceCopies A s hs
/-- Zero-ancilla compression in the physical-qudit coordinates. -/
def compressZero {d N n t : ℕ} [NeZero d] (hn : n ≤ N)
(A : Matrix (QuditCopies d N t) (QuditCopies d N t) ℂ) :
Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
fun x y => A
(fun i j => if h : j.val < n then x i ⟨j.val, h⟩ else 0)
(fun i j => if h : j.val < n then y i ⟨j.val, h⟩ else 0)
/-- Computational permutation of the t blocks. -/
def permutationOperator (d n t : ℕ) [NeZero d] (p : Equiv.Perm (Fin t)) :
Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
fun x y => if x = fun i => y (p.symm i) then 1 else 0
/-- The symmetric-subspace condition is vector invariance. -/
def IsPermutationSymmetric {d n t : ℕ} [NeZero d] (v : EuclideanSpace ℂ (QuditCopies d n t)) : Prop :=
∀ p : Equiv.Perm (Fin t), QAlgorithms.act (permutationOperator d n t p) v = v
/-- Anti-identity on a specified set of six distinct blocks. -/
def embeddedAntiIdentity {n t : ℕ} (e : Fin 6 ↪ Fin t) :
Matrix (QuditCopies 2 n t) (QuditCopies 2 n t) ℂ :=
fun x y => if ∀ i, i ∉ Set.range e → x i = y i then
quditInvolution 2 n 3 (fun i => x (e i)) (fun i => y (e i)) else 0
/-- Finite probability weights on precisely a named finite set. -/
def IsDistributionOn {I : Type*} (F : Finset I) (p : I → ℝ) : Prop :=
(∀ i ∈ F, 0 ≤ p i) ∧ ∑ i ∈ F, p i = 1
/-- Convex mixture of s-copy density tensors. -/
def stabilizerMixture {d n : ℕ} [NeZero d] (s : ℕ) (F : Finset (QuditOperator d n))
(p : QuditOperator d n → ℝ) : Matrix (QuditCopies d n s) (QuditCopies d n s) ℂ :=
∑ S ∈ F, (p S : ℂ) • tensorPower s S
/-- A representative vector for each phase-free pure stabilizer, with a harmless default off the set. -/
def stabilizerVector {d n : ℕ} [NeZero d] (S : QuditOperator d n) :
EuclideanSpace ℂ (ResidueRegister d n) :=
if h : ∃ v : EuclideanSpace ℂ (ResidueRegister d n), ‖v‖ = 1 ∧ S = QAlgorithms.pureDensity v
then Classical.choose h else 0
/-- PDF p.53: source Gram matrix, built from the canonical state representatives. -/
def stabilizerGram (d n t : ℕ) [NeZero d] :
Matrix {S // S ∈ stabilizers d n} {S // S ∈ stabilizers d n} ℂ :=
fun S T => (inner ℂ (stabilizerVector S.val) (stabilizerVector T.val)) ^ t
/-- PDF p.53: the frame operator Q, constructed independently of a Gram bound. -/
def stabilizerFrame (d n t : ℕ) [NeZero d] : Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
∑ S ∈ stabilizers d n, tensorPower t S
/-- Moore--Penrose inverse of a PSD matrix, with zero inverse defined as zero by cfc. -/
def positivePseudoInverse {I : Type*} [Fintype I] [DecidableEq I]
(A : Matrix I I ℂ) : Matrix I I ℂ := cfc (fun x : ℝ => x⁻¹) A
/-- Source row-stacking vectorization; unlike Matrix.vec it indexes the row first. -/
def rowVectorize {I : Type*} (A : Matrix I I ℂ) : EuclideanSpace ℂ (I × I) :=
WithLp.toLp 2 (fun x => A x.1 x.2)
/-- Normalized Choi ket, ordered as the output register then the reference register. -/
def unitaryChoiVector (n : ℕ) (U : QuditOperator 2 n) : EuclideanSpace ℂ (ResidueRegister 2 (n + n)) :=
WithLp.toLp 2 (fun x => ((Real.sqrt ((2 : ℝ) ^ n))⁻¹ : ℂ) *
U (fun i => x (Fin.castAdd n i)) (fun i => x (Fin.natAdd n i)))
/-- Finite normalized Haar moment, using the exact permutation formula (5.7), PDF p.47.
This is a formula for the Haar integral, not a new distributional hypothesis. -/
def haarMoment (d n t : ℕ) [NeZero d] : Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
(∏ k ∈ Finset.range t, ((d : ℂ) ^ n + k))⁻¹ •
∑ p : Equiv.Perm (Fin t), permutationOperator d n t p
/-- One scalar-free Clifford is specified by its conjugation action on the finite Pauli group. -/
abbrev PauliAction (d n : ℕ) [NeZero d] :=
{P // P ∈ cyclicPauliGroup d n} → {P // P ∈ cyclicPauliGroup d n}
/-- The faithful finite image of the Clifford group modulo scalar phases. -/
def RealizesAction {d n : ℕ} [NeZero d] (a : PauliAction d n) (U : QuditOperator d n) : Prop :=
IsClifford U ∧ ∀ P, U * P.val * Uᴴ = (a P).val
/-- The actual finite normalizer quotient; only realized actions are counted. -/
def cliffordActions (d n : ℕ) [NeZero d] : Finset (PauliAction d n) :=
Finset.univ.filter fun a => ∃ U, RealizesAction a U
/-- Choice of scalar representative has no effect on any density-matrix twirl. -/
def cliffordRepresentative {d n : ℕ} [NeZero d] (a : PauliAction d n) : QuditOperator d n :=
if h : ∃ U, RealizesAction a U then Classical.choose h else 1
/-- PDF pp.49--50: uniform Clifford-orbit moment, counted once modulo phases. -/
def cliffordMoment {d n : ℕ} [NeZero d] (t : ℕ)
(v : EuclideanSpace ℂ (ResidueRegister d n)) : Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ :=
((cliffordActions d n).card : ℂ)⁻¹ • ∑ a ∈ cliffordActions d n,
tensorPower t (QAlgorithms.pureDensity (QAlgorithms.act (cliffordRepresentative a) v))
/-- PDF p.50: permutation matrix over the residue field. -/
def residuePermutation {d t : ℕ} (p : Equiv.Perm (Fin t)) : Matrix (Fin t) (Fin t) (ZMod d) :=
fun i j => if i = p j then 1 else 0
/-- Transposed relation. -/
def transposeRelation {d t : ℕ} (T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) :
Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t) :=
T.comap (LinearEquiv.prodComm (ZMod d) (ResidueRegister d t) (ResidueRegister d t)).toLinearMap
/-- Definition 6.1: permutation double action plus transposition, not O-double-orbits. -/
def SameDesignClass {d t : ℕ} [NeZero d] (T S : Lagrangian d t) : Prop :=
∃ p q : Equiv.Perm (Fin t),
S.val = actedRelation (residuePermutation p) (residuePermutation q) T.val ∨
S.val = actedRelation (residuePermutation p) (residuePermutation q) (transposeRelation T.val)
/-- Distinct equivalence classes are represented as finite subsets, avoiding a chosen enumeration. -/
def designClasses (d t : ℕ) [NeZero d] : Finset (Finset (Lagrangian d t)) :=
Finset.univ.image fun T => Finset.univ.filter (SameDesignClass T)
/-- PDF pp.51--52: actual class containing a specified subspace. -/
def designClassOf {d t : ℕ} [NeZero d]
(T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t)) : Finset (Lagrangian d t) :=
Finset.univ.filter fun S => ∃ p q : Equiv.Perm (Fin t),
S.val = actedRelation (residuePermutation p) (residuePermutation q) T ∨
S.val = actedRelation (residuePermutation p) (residuePermutation q) (transposeRelation T)
/-- All-ones defect of the qutrit example. -/
def qutritDefect : Submodule (ZMod 3) (ResidueRegister 3 3) :=
Submodule.span (ZMod 3) {(fun _ => 1)}
/-- Third representative printed on PDF p.52, with eight coordinates grouped as left/right. -/
def qutritFourThird : Submodule (ZMod 3) (ResidueRegister 3 4 × ResidueRegister 3 4) :=
Submodule.span (ZMod 3) (Set.range (fun i : Fin 4 =>
let A : Matrix (Fin 4) (Fin 8) (ZMod 3) :=
![![1,1,1,1,1,1,1,1], ![0,1,2,0,0,2,1,0],
![0,0,0,0,1,1,1,0], ![1,1,1,0,0,0,0,0]]
((fun j => A i (Fin.castAdd 4 j)), (fun j => A i (Fin.natAdd 4 j)))))
/-- Qutrit anti-identity of (4.35) for t=4; entries 1 on diagonal and 2 elsewhere. -/
def qutritFourAnti : Matrix (Fin 4) (Fin 4) (ZMod 3) :=
fun i j => if i = j then 1 else 2
/-- Sanity: a zero vector has zero characteristic mass, hence normalization cannot be omitted. -/
example {d n : ℕ} [NeZero d] (x : DiscretePhaseSpace d n) :
characteristicDistribution (0 : EuclideanSpace ℂ (ResidueRegister d n)) x = 0 := by
simp [characteristicDistribution, QAlgorithms.act]
/-- Sanity: zero independent repetitions accept as the scalar identity. -/
example {d n k : ℕ} [NeZero d] (A : Matrix (QuditCopies d n k) (QuditCopies d n k) ℂ)
(x y : QuditCopies d n (k * 0)) : repeatEffect 0 A x y = 1 := by simp [repeatEffect]
/-- Finite enumeration of the concrete defect quotient. -/
instance instFintypeDefectQuotient {d t : ℕ} [NeZero d] (N : Submodule (ZMod d) (ResidueRegister d t)) :
Fintype (defectQuotient N) := Fintype.ofFinite _
/-- PDF p.37: canonical right-to-left quotient function obtained from the relation itself. -/
def canonicalDefectMap {d t : ℕ} [NeZero d]
(T : Submodule (ZMod d) (ResidueRegister d t × ResidueRegister d t))
(q : defectQuotient (rightDefect T)) : defectQuotient (leftDefect T) :=
let y := defectRepresentative (rightDefect T) q
if h : ∃ x : ResidueRegister d t, x ∈ perpendicular (leftDefect T) ∧ (x, y) ∈ T then
defectClass (leftDefect T) (Classical.choose h) (Classical.choose_spec h).1
else 0
/-- Finite collection of actual double orbits. -/
def doubleClasses (d t : ℕ) [NeZero d] : Finset (Finset (Lagrangian d t)) :=
Finset.univ.image fun T => Finset.univ.filter (SameDoubleOrbit T)
/-- Source average-case distance for unitary testing. -/
def unitaryDistance {n : ℕ} (U V : QuditOperator 2 n) : ℝ :=
Real.sqrt (1 - Complex.normSq ((Uᴴ * V).trace / (2 : ℂ) ^ n))
/-- Degree-six Choi tensor monomial, without an irrelevant common normalization. -/
def choiMonomial (n : ℕ) (x : QuditCopies 2 (n + n) 6) :
MvPolynomial (ResidueRegister 2 n × ResidueRegister 2 n) ℂ :=
∏ i : Fin 6, MvPolynomial.X
((fun j => x i (Fin.castAdd n j)), (fun j => x i (Fin.natAdd n j)))
/-- PDF p.8: actual degree-six anti-identity invariance equations in the entries of U. -/
def cliffordPolynomial (n : ℕ) (x : QuditCopies 2 (n + n) 6) :
MvPolynomial (ResidueRegister 2 n × ResidueRegister 2 n) ℂ :=
(∑ y : QuditCopies 2 (n + n) 6,
MvPolynomial.C (quditInvolution 2 (n + n) 3 x y) * choiMonomial n y) - choiMonomial n x
/-- PDF p.22, (3.11): the source six-copy verification unitary, not the anti-identity surrogate. -/
def qubitVerificationUnitary (n : ℕ) : Matrix (QuditCopies 2 n 6) (QuditCopies 2 n 6) ℂ :=
(2 : ℂ) • qubitTest n - 1
/-- Class sums R_i from Definition 6.1, independent of a state or its twirl. -/
def designClassSum {d t : ℕ} [NeZero d] (n : ℕ) (F : Finset (Lagrangian d t)) :
Matrix (QuditCopies d n t) (QuditCopies d n t) ℂ := ∑ T ∈ F, tensorRelation n T.val
/-- The coefficients of the concrete Clifford moment, set to zero off the actual class set.
The source stable-range theorem guarantees the expansion; no such guarantee is a hypothesis. -/
def designCoefficients {d n t : ℕ} [NeZero d]
(v : EuclideanSpace ℂ (ResidueRegister d n)) : Finset (Lagrangian d t) → ℝ :=
if h : ∃ a : Finset (Lagrangian d t) → ℝ,
(∀ F, F ∉ designClasses d t → a F = 0) ∧
cliffordMoment t v = ∑ F ∈ designClasses d t, (a F : ℂ) • designClassSum n F
then Classical.choose h else fun _ => 0
/-- Physical symmetric projector on three qutrit blocks. -/
def qutritSymmetricProjector (n : ℕ) : Matrix (QuditCopies 3 n 3) (QuditCopies 3 n 3) ℂ :=
(6⁻¹ : ℂ) • ∑ p : Equiv.Perm (Fin 3), permutationOperator 3 n 3 p
/-- Physical alternating projector on three qutrit blocks. -/
def qutritAlternatingProjector (n : ℕ) : Matrix (QuditCopies 3 n 3) (QuditCopies 3 n 3) ℂ :=
(6⁻¹ : ℂ) • ∑ p : Equiv.Perm (Fin 3),
(if Equiv.Perm.sign p = 1 then (1 : ℂ) else -1) • permutationOperator 3 n 3 p
/-- PDF p.42, (4.29): independent CSS Pauli projector, tensorized over physical sites. -/
def qutritCSSProjector (n : ℕ) : Matrix (QuditCopies 3 n 3) (QuditCopies 3 n 3) ℂ :=
fun x y => ∏ j : Fin n, cssProjector qutritDefect (fun i => x i j) (fun i => y i j)
/-- PDF pp.42--43: the four compressed pieces, and one physical standard-S3 multiplicity slice.
P_minus is defined by alternating compression, which fixes the printed plus-sign error. -/
def qutritPieceProjector (n : ℕ) : Fin 5 → Matrix (QuditCopies 3 n 3) (QuditCopies 3 n 3) ℂ :=
let S := qutritSymmetricProjector n
let A := qutritAlternatingProjector n
let P := qutritCSSProjector n
let plus := S * P * S
let minus := A * P * A
![plus, S - plus, minus, A - minus,
(2⁻¹ : ℂ) • (1 + permutationOperator 3 n 3 (Equiv.swap 0 1)) - S]
/-- Source physical irreducible carriers, constructed from the five projections. -/
def qutritPiece (n : ℕ) (i : Fin 5) : Submodule ℂ (QuditCopies 3 n 3 → ℂ) :=
LinearMap.range (Matrix.toLin' (qutritPieceProjector n i))
/-- Invariance under the actual Clifford tensor-power action. -/
def IsCliffordInvariant {d n t : ℕ} [NeZero d] (V : Submodule ℂ (QuditCopies d n t → ℂ)) : Prop :=
∀ U : QuditOperator d n, IsClifford U → ∀ v ∈ V, (tensorPower t U).mulVec v ∈ V
/-- Nonzero irreducible physical Clifford module. -/
def IsCliffordIrreducible {d n t : ℕ} [NeZero d] (V : Submodule ℂ (QuditCopies d n t → ℂ)) : Prop :=
V ≠ ⊥ ∧ IsCliffordInvariant V ∧ ∀ W : Submodule ℂ (QuditCopies d n t → ℂ),
W ≤ V → IsCliffordInvariant W → W = ⊥ ∨ W = V
/-- Equivalence means an actual linear bijection intertwining the physical action on the two carriers. -/
def CliffordModulesEquivalent {d n t : ℕ} [NeZero d]
(V W : Submodule ℂ (QuditCopies d n t → ℂ)) : Prop :=
∃ L : (QuditCopies d n t → ℂ) →ₗ[ℂ] (QuditCopies d n t → ℂ),
Set.BijOn L (V : Set _) (W : Set _) ∧
∀ U : QuditOperator d n, IsClifford U → ∀ v ∈ V,
L ((tensorPower t U).mulVec v) = (tensorPower t U).mulVec (L v)
/-- Four one-fold constituents and two copies of the (2,1) constituent. -/
def pieceIndex (i : Fin 6) : Fin 5 := ⟨if i.val < 4 then i.val else 4, by split_ifs <;> omega⟩
abbrev QutritDecomposition (n : ℕ) := (i : Fin 6) → qutritPiece n (pieceIndex i)
/-- The standard S3 representation in the basis e0-e2,e1-e2 of the zero-sum plane. -/
def standardS3 (p : Equiv.Perm (Fin 3)) : Matrix (Fin 2) (Fin 2) ℂ :=
fun i j => if p.symm ⟨i.val, by omega⟩ = ⟨j.val, by omega⟩ then 1
else if p.symm ⟨i.val, by omega⟩ = 2 then -1 else 0
end QAlgorithms.Papers.Independent.Extend50.P30
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Extend50.P30.CliffordModulesEquivalent
For any natural numbers with , and any complex linear subspaces , where , this predicate asserts the existence of a complex linear map whose restriction maps bijectively onto , and such that for every and every unitary with . Here
with , , for even and otherwise, and bars denoting natural-number residue representatives; also . The definition does not separately require either subspace to be invariant, nor does it require to be invertible on the whole ambient space. Zero subspaces and or are included, with empty products equal to .
QAlgorithms.Papers.Independent.Extend50.P30.CopyTest
For natural numbers with , this structure consists of a natural number , called its number of copies, and a complex matrix indexed by -tuples of elements of , together with the requirements that both and are positive semidefinite. The values and are allowed; in either case the matrix index set is a singleton.
QAlgorithms.Papers.Independent.Extend50.P30.CopyTest.prob
For natural numbers with , a copy test with copy count and acceptance matrix , where and are positive semidefinite, and any vector equipped with the Euclidean norm, this defines
where are -tuples of residue-register elements. No unit-norm assumption is imposed on . When , the index set is a singleton and has its sole entry equal to , independently of ; is also included.
QAlgorithms.Papers.Independent.Extend50.P30.DefectIsomorphism
For natural numbers and arbitrary submodules of , this structure consists of a -linear bijection , together with two requirements: for every and , if , then ; and for every proof that and every proof that , one has . Here , similarly for , is the all-ones vector, and sums the squares of the least nonnegative coordinate representatives modulo for even and modulo otherwise. Membership of in either perpendicular submodule is not itself required, so the second requirement is vacuous if either membership fails. The cases and are included.
QAlgorithms.Papers.Independent.Extend50.P30.DiscretePhaseSpace
For natural numbers , this denotes the set of ordered pairs of functions . For , these are integer-valued functions; for , the phase space has exactly one element, the pair of empty functions.
QAlgorithms.Papers.Independent.Extend50.P30.FarFromStabilizers
For natural numbers with , an arbitrary vector , , and any real number , this predicate requires
for every matrix in the following finite set. Put , , and for even , otherwise; define when , and otherwise, with standard residue representatives and modular addition. For each subset of that contains the identity, is closed under multiplication and conjugate transpose, and satisfies , form . The tested set consists of those trace normalizations that equal for some Euclidean unit vector . Here , and complex inversion has . No unit-norm hypothesis on or sign restriction on is imposed; the bound depends only on . The cases and are included, with empty exponent sums for .
QAlgorithms.Papers.Independent.Extend50.P30.IsClifford
For natural numbers with and a complex matrix indexed by , this predicate says that is unitary and
Here , where , , for even and otherwise, and
The bars are standard nonnegative residue representatives, and addition is coordinatewise modulo . The displayed condition is equality of finite sets, including every phase multiple in . The definition includes and , with a singleton register and empty exponent sums when .
QAlgorithms.Papers.Independent.Extend50.P30.IsCliffordInvariant
For any natural numbers with , and any complex linear subspace , where and , this predicate requires that for every and every matrix satisfying the following explicit Clifford condition. Write , , and if is even and otherwise; for , with bars denoting representatives in , set
The condition on is that it is unitary on and . Here , acting by matrix multiplication. No primality assumption on , positivity assumption on , or nonzero assumption on is imposed; when , the displayed product is .
QAlgorithms.Papers.Independent.Extend50.P30.IsCliffordIrreducible
For any natural numbers with , and any complex linear subspace , where , this predicate requires three things: ; every described below maps into itself; and every complex linear subspace also mapped into itself by all these matrices satisfies or . The matrices in question are precisely the unitary matrices on whose conjugation preserves the finite set
where , , for even and otherwise, and bars denote natural-number residue representatives. Preservation means , and . The quantifiers include , , and ; empty products equal , while the zero subspace is explicitly excluded.
QAlgorithms.Papers.Independent.Extend50.P30.IsCyclicStabilizerGroup
For natural numbers with , and a finite set of complex matrices indexed by , this predicate requires all of the following: every element of has the form , where , , for even and otherwise, , and
here denotes the natural representative of a residue; the identity matrix belongs to ; for every , their matrix product belongs to ; for every , its conjugate transpose belongs to ; and for every and every , the equality implies . The cases and are included, and the identity-membership requirement excludes .
QAlgorithms.Papers.Independent.Extend50.P30.IsDefect
For natural numbers and , and a submodule of , this predicate requires that for every and that in for every . Here is the sum of the squares of the least nonnegative representatives of the coordinates of , evaluated modulo if is even and modulo otherwise; the second requirement is precisely that the all-ones vector belongs to for the bilinear pairing . The cases and are included, and both requirements hold for every available submodule in either case.
QAlgorithms.Papers.Independent.Extend50.P30.IsDistributionOn
For any type , finite subset , and function , this predicate means that for every and . Values outside are unrestricted. When is empty, the predicate is false because its sum condition becomes .
QAlgorithms.Papers.Independent.Extend50.P30.IsOrthogonalProjectionOnto
For any finite type equipped with decidable equality, a complex matrix indexed by , and a complex linear subspace , this predicate means exactly
The empty index type is allowed; then is the zero vector space and the range condition requires .
QAlgorithms.Papers.Independent.Extend50.P30.IsPermutationSymmetric
For natural numbers with , put , so a coordinate of is indexed by a tuple . The predicate holds precisely when every permutation of the copies fixes under multiplication by the matrix whose -entry is if for every , and otherwise; equivalently, for every and . No normalization of is required. This includes , , and ; for , the condition holds for every .
QAlgorithms.Papers.Independent.Extend50.P30.IsStabilizer
For natural numbers with and a vector , where carries the Euclidean norm, this predicate requires and membership of , whose -entry is , in the following finite set: take , , for even and otherwise, and
The bars denote standard nonnegative residue representatives and addition is modulo . For every subset of containing the identity, closed under multiplication and conjugate transpose, and satisfying , form and its trace normalization ; retain such a normalized matrix exactly when it equals for some Euclidean unit vector . Complex inversion uses . The predicate also applies when or , with empty exponent sums when .
QAlgorithms.Papers.Independent.Extend50.P30.IsStochasticLagrangian
For natural numbers with , this predicate on a -submodule requires all three conditions
where for even and otherwise, bars denote canonical representatives modulo , and is the vector with every coordinate equal to modulo . No primality assumption on is imposed. For , the ambient module has one element, and its unique submodule satisfies these conditions.
QAlgorithms.Papers.Independent.Extend50.P30.IsStochasticOrthogonal
For natural numbers and , and a matrix over , this predicate requires both for every and , where is the vector whose coordinates are all . Here is evaluated modulo if is even and modulo otherwise, with the least nonnegative representative of ; the coordinates of are first computed modulo before their representatives are used in . The definition includes and ; when , both requirements hold for the unique empty matrix.
QAlgorithms.Papers.Independent.Extend50.P30.Lagrangian
For natural numbers with , this is the type of -submodules satisfying
Here when is even and otherwise, each bar denotes the canonical representative modulo , and is the all-ones residue vector. The type includes the case , when it has exactly one element, the unique submodule of the singleton ambient module; need not be prime.
QAlgorithms.Papers.Independent.Extend50.P30.PauliAction
For natural numbers with , put , when is even and otherwise, , and . For , define a matrix by
where bars denote representatives in . Let be the finite set of distinct matrices for and . This abbreviation denotes the type of all functions , with membership in included in the domain and codomain. No bijectivity, multiplication-preservation, or realization by conjugation is required. The parameters include and .
QAlgorithms.Papers.Independent.Extend50.P30.QuditCopies
For natural numbers , this denotes functions assigning to each a function , equivalently arrays of residues with rows and columns. For , the entries are integers. If or , there is exactly one such array.
QAlgorithms.Papers.Independent.Extend50.P30.QuditOperator
For natural numbers , this denotes complex matrices whose rows and columns are both indexed by functions . No nonzero assumption on is imposed: for , the indexing functions are integer-valued and, when , the index set is infinite. For , these are matrices.
QAlgorithms.Papers.Independent.Extend50.P30.QutritDecomposition
For every natural number , this abbreviates the complex vector space of six-tuples with for and , where the two occurrences of are independently chosen. To define these spaces, put , , , and , summing over permutations of three positions. With and bars denoting representatives in , put
Then is the matrix range of the -th member of , acting on . This abbreviation itself asserts no isomorphism with and imposes no normalization on the tuple entries. It includes , with empty products equal to .
QAlgorithms.Papers.Independent.Extend50.P30.RealizesAction
For natural numbers and , let , , , and if is even and otherwise. For , define the matrix
where bars denote the natural-number representatives of residues and the negative exponent is an integer exponent. Let , regarded as a set of distinct matrices. Given any function and any complex matrix indexed by , this predicate means that is unitary, , and for every . No primality assumption on is imposed, and is included, with empty sums equal to zero.
QAlgorithms.Papers.Independent.Extend50.P30.ResidueRegister
For natural numbers , this denotes the set of functions . The case is included, with the residue type interpreted as . When , there is exactly one such function, the empty function.
QAlgorithms.Papers.Independent.Extend50.P30.SameDesignClass
For natural numbers and , let , let if is even and otherwise, and define in , using natural-number representatives of residues. Let be -submodules, each having cardinality , containing , and satisfying for every member . This predicate means that there exist permutations of the coordinates such that either
The disjunction is inclusive. The definition includes and , and does not require to be prime.
QAlgorithms.Papers.Independent.Extend50.P30.SameDoubleOrbit
For natural numbers and , put , let be the all-ones vector, and define modulo for even and modulo otherwise. Let each satisfy for every in that submodule, have cardinality , and contain . The defined proposition says that there exist matrices over such that , for every , , and . These are the literal conditions on ; invertibility is not an additional hypothesis. The parameters allow and .
QAlgorithms.Papers.Independent.Extend50.P30.StochasticOrthogonal
For natural numbers and , this is the type of matrices over equipped with proofs that and for every . Here has every coordinate equal to , and is the sum of the squares of the least nonnegative representatives of its coordinates, taken modulo for even and modulo for odd . Both and are allowed; for , the unique empty matrix satisfies these conditions.
QAlgorithms.Papers.Independent.Extend50.P30.actedRelation
For arbitrary natural numbers , let , let be arbitrary matrices over , and let be a submodule. The definition gives the linear span of over . Thus the first component is multiplied by , and the second by the transpose of ; neither matrix is required to be invertible or to preserve any form. The parameters include and , with .
QAlgorithms.Papers.Independent.Extend50.P30.antiPermutation
For any natural number and permutation of , the definition gives the matrix over whose -entry is if and otherwise. For this is the empty matrix, and for it is the zero matrix.
QAlgorithms.Papers.Independent.Extend50.P30.bellDifference
For every natural number and every , where , the declaration defines a complex matrix on four ordered copies of by
where addition of phase-space pairs is coordinatewise modulo , and
For , the entries used here are if , and otherwise; barred residues are or . Thus each is explicitly the matrix of products of coordinates and conjugate coordinates of the vector with entries . The case is included; all register sets are singletons and the resulting matrix has sole entry .
QAlgorithms.Papers.Independent.Extend50.P30.canonicalDefectMap
For natural numbers with , let and let be any -submodule of . Set and . For any submodule , write and . Given , choose the representative supplied by the definition of a representative, so that . The defined map returns
where in the first case is selected by classical choice. No additional condition on , independence from representative choices, or linearity of this map is asserted. The definition also applies when or .
QAlgorithms.Papers.Independent.Extend50.P30.characteristicDistribution
For natural numbers with , any Euclidean vector , , and a pair , the declaration defines
where matrix action is ordinary matrix multiplication and
Bars denote standard nonnegative residue representatives, and addition is modulo . No normalization of , or assertion that these values sum to , is part of this definition. It includes and ; the exponent sums are empty when .
QAlgorithms.Papers.Independent.Extend50.P30.choiMonomial
For every natural number and every six-tuple of elements of , split each into its first coordinates and its last coordinates . In the commutative polynomial ring over with variables indexed by , this defines
Repeated index pairs give repeated factors. For , there is a single index pair and the result is the sixth power of its variable.
QAlgorithms.Papers.Independent.Extend50.P30.cliffordActions
For natural numbers and , put , , , and for even , otherwise . Define to be zero unless , and otherwise to be , using natural-number residue representatives and an integer negative exponent. Let , with duplicate matrices removed. The defined finite set consists of exactly those functions for which there exists a complex matrix indexed by such that is unitary, , and for every . This includes and ; need not be prime.
QAlgorithms.Papers.Independent.Extend50.P30.cliffordCommutant
For natural numbers with , put . This defines the complex vector subspace of matrices indexed by satisfying
for every unitary matrix on for which , where . The finite set is
with , , and
using canonical representatives modulo and coordinatewise residue addition. No primality assumption is imposed. Both and are included; in either case the matrix space defining this subspace has a singleton index set, and every matrix in that space satisfies the commutation condition.
QAlgorithms.Papers.Independent.Extend50.P30.cliffordMoment
For natural numbers , , and , and any vector , where , define , , and for even , otherwise . Let be a set of distinct matrices, where unless , and otherwise equals , using natural-number residue representatives and integer negative powers. Let consist of all functions admitting a unitary with and for every ; for each such function choose one realizing matrix arbitrarily. The defined matrix, indexed by , has entries
The vector is not required to have norm one. The parameters and are allowed; for the products are empty products equal to one. The scalar inverse is the total complex inverse, which is zero at zero.
QAlgorithms.Papers.Independent.Extend50.P30.cliffordPolynomial
For every , put , , and define matrices indexed by , for , by
For six-tuples , set
For a six-tuple , let be the first and last coordinates of , and let . Given any , the declaration defines the polynomial
over , with variables indexed by pairs in . No matrix or state is an argument to this definition. For , the defined polynomial is zero.
QAlgorithms.Papers.Independent.Extend50.P30.cliffordRepresentative
For natural numbers and , put , , , and for even , otherwise . Let be the set of distinct matrices , where , , and
with natural-number residue representatives and integer negative powers. For any function , the defined matrix is an arbitrarily chosen matrix satisfying unitarity, , and for all , if such a matrix exists; if none exists, it is the identity matrix indexed by . No uniqueness or prescribed choice among realizing matrices is asserted. The definition includes and .
QAlgorithms.Papers.Independent.Extend50.P30.commutantCount
For arbitrary natural numbers , this defines the natural number
The subtraction is truncated at zero, so the product is empty and equals when or . There is no assumption that ; when , the convention gives for every .
QAlgorithms.Papers.Independent.Extend50.P30.composeRelation
For arbitrary natural numbers , put and let be submodules. The definition gives the -linear span of , so its elements are all finite linear combinations of pairs admitting such an intermediate vector . There are no further hypotheses on or . Zero values of and are allowed, with .
QAlgorithms.Papers.Independent.Extend50.P30.compressZero
For natural numbers , a hypothesis , and any complex matrix on copies of , this defines a matrix on copies of by
and likewise for . Thus every copy is extended by zero residues in its last sites. There is no positivity or normalization hypothesis on . If , this leaves the entries unchanged; if , the result is the single entry of whose row and column have every site zero. The case is included.
QAlgorithms.Papers.Independent.Extend50.P30.copyPrefixReduction
For natural numbers , a hypothesis , and any complex matrix on , where , this defines the matrix on
Here concatenation places or in positions and places in the remaining positions, using index there. This is defined without any density or positivity hypothesis on . If , the suffix has length zero and the result is ; if , the result is the scalar . Zero sites are allowed.
QAlgorithms.Papers.Independent.Extend50.P30.cosetState
For natural numbers and , put , let be any submodule, and define . Let belong to the image of under the quotient map , and let be the classically chosen representative satisfying . The definition gives the complex Euclidean vector with coordinates when , and otherwise. Thus its nonzero coordinates are precisely those on . The finite submodule contains zero, so ; no assumption is made. The cases or give a singleton coordinate set and coordinate value .
QAlgorithms.Papers.Independent.Extend50.P30.cssProjector
For natural numbers and , let , let be any submodule, and put . The definition gives a complex matrix indexed by , with entries
where each representative lies in . This is the entrywise expansion of the specified average of products of the two Weyl matrices. No isotropy or other condition on is assumed, and the definition itself imposes no Hermitian or idempotence condition on . Since contains zero, its finite cardinality is positive. The cases and are included.
QAlgorithms.Papers.Independent.Extend50.P30.cssRelation
For arbitrary natural numbers and a submodule , define . The definition gives the submodule of whose elements are exactly the pairs satisfying , , and . There is no assumption . Both and are allowed; for , the coefficient ring here is .
QAlgorithms.Papers.Independent.Extend50.P30.cyclicPauliGroup
For natural numbers with , let , , , and if is even, otherwise . This defines the finite set of complex matrices indexed by consisting of all matrices , for and , with entries
where brackets denote representatives in , and the condition uses coordinatewise residue addition. Equal matrices produced by different choices occur only once in this finite set. Both and are included, with empty exponent sums equal to zero.
QAlgorithms.Papers.Independent.Extend50.P30.cyclicWeyl
For natural numbers with , and an ordered pair of functions from to , this defines a complex matrix indexed by such functions. Write for the natural-number representative of a residue , and put and . Its row-, column- entry is
The equality and addition in the condition are coordinatewise modulo ; the sums in the exponents use ordinary natural-number representatives, and the negative exponent is an integer exponent. The cases and are allowed; for , both sums are empty and the resulting matrix has entry .
QAlgorithms.Papers.Independent.Extend50.P30.defectClass
For natural numbers , a submodule of , and a vector together with a proof that for every , this returns the quotient class , regarded as an element of the image , where is defined by that same bilinear orthogonality condition. The supplied orthogonality proof certifies membership in this image. Neither nor is assumed; uses the coefficient ring , and is allowed.
QAlgorithms.Papers.Independent.Extend50.P30.defectQuotient
For natural numbers and a submodule of , this defines the image of under the quotient map , where . Thus it is the submodule of ; no assumption is required. The definition allows , when the coefficient ring is , and .
QAlgorithms.Papers.Independent.Extend50.P30.defectRelation
For natural numbers and , let and let be arbitrary submodules. Write , , and . Let be a linear equivalence that preserves , computed modulo for even and modulo for odd , whenever classes of perpendicular representatives correspond under ; it must also send the class of the all-ones vector to that class whenever both requisite perpendicular memberships hold. The definition gives the -linear span of inside , namely all finite linear combinations of such pairs. There is no assumption that either submodule is contained in its perpendicular submodule; and are included.
QAlgorithms.Papers.Independent.Extend50.P30.defectRelationSet
For natural numbers and , put , and let be arbitrary submodules of . For any submodule , define , let be the quotient map, and put . The argument consists of a -linear equivalence with these additional properties: whenever , , and , their quadratic residues agree; and whenever the all-ones vector belongs to both perpendicular submodules, sends its class to its class. Here the quadratic residue of is modulo if is even and modulo otherwise, with . The definition gives the set . Neither nor is assumed; the condition about the all-ones vector imposes no requirement when its requisite memberships do not hold. The parameters allow and .
QAlgorithms.Papers.Independent.Extend50.P30.defectRepresentative
For natural numbers , a submodule of , and an element of the image , this noncomputably chooses a vector whose quotient class is , where . No particular representative is specified beyond these properties. The definition permits , with coefficient ring , and , and requires no inclusion .
QAlgorithms.Papers.Independent.Extend50.P30.designClassOf
For natural numbers and , put , and let be any -submodule of , with no additional condition on . Set for even , otherwise , and , using natural-number residue representatives. This defines the finite set of all submodules that have cardinality , contain , satisfy for all , and admit coordinate permutations such that
The definition permits and .
QAlgorithms.Papers.Independent.Extend50.P30.designClassSum
For natural numbers with , and any finite subset of the following collection , this definition returns a complex matrix indexed by -tuples of elements of . To define the collection, put for even and otherwise, and in , where hats denote least nonnegative representatives. The members of are exactly the submodules with , , and for every . The returned matrix has entries
There is no primality assumption, no positivity requirement on or , and no requirement that be one of the particular subsets called design classes. If is empty the matrix is zero; if , its index set is a singleton and each summand has sole entry .
QAlgorithms.Papers.Independent.Extend50.P30.designClasses
For natural numbers and , put , for even and otherwise, and , using natural-number residue representatives. Let be the finite collection of -submodules of having cardinality , containing , and satisfying on every member . For each , form the finite set of all for which some coordinate permutations satisfy
The definition returns the finite set of these finite sets as ranges over , removing repeated finite sets. The parameters and are included.
QAlgorithms.Papers.Independent.Extend50.P30.designCoefficients
For natural numbers with , and any vector , this definition returns a real-valued function on all finite subsets of , without assuming that is prime or that is normalized. Here, writing and for even , otherwise, consists of submodules with , , and modulo for every . For coordinate permutation matrices , let contain exactly the members of equal to the span of , or the analogous span for the transposed relation , for some ; set . Define and . To define the matrix being expanded, put , , let if , and otherwise, and form . Let be the finite set of functions realized by conjugation by a unitary normalizing , select a realizing unitary for each , and set , where tensor-power entries are products over copies. If there exists a function on finite subsets of such that whenever and
the returned function is one unspecified choice of such an ; otherwise it is identically zero. The definition imposes no uniqueness, nonnegativity, or normalization condition on these coefficients. All natural parameters may be zero except , and empty products and sums retain their usual values.
QAlgorithms.Papers.Independent.Extend50.P30.discreteWigner
For natural numbers and , let , let be any complex Euclidean vector, and let . Put , , and define to be zero unless , in which case it equals . With , the definition gives the real number
All representatives are the least nonnegative residues, and negative exponents are integer powers. There is no normalization assumption on , nor any primality or oddness assumption on . For , the value is the squared modulus of the vector’s sole coordinate.
QAlgorithms.Papers.Independent.Extend50.P30.doubleClasses
For every with , put , let when is even and otherwise, and define in , using the representatives . Let consist of the submodules satisfying for every , , and . Let consist of the matrices over satisfying for every and ; these conditions do not explicitly require invertibility. The defined finite set is
Repeated identical subsets are included only once. The definition includes and , and does not separately assert that these subsets form a partition.
QAlgorithms.Papers.Independent.Extend50.P30.embeddedAntiIdentity
For natural numbers and an injection , this defines a complex matrix indexed by -tuples of elements of . For , define unless , and otherwise define
where bars denote representatives in , and denotes the conjugate transpose. The matrix entry at is zero unless at every position outside the image of ; when those equalities hold, it is
The injection requires ; is allowed, with empty coordinate sums equal to zero.
QAlgorithms.Papers.Independent.Extend50.P30.embeddedLocal
For natural numbers , a site , and any complex matrix on copies of the one-site register , this defines a matrix on copies of by
The one-site arguments of are understood as functions on a singleton site index. The choice of requires , so there are no such inputs when . If , the agreement condition is vacuous and the result is the sole entry of . No additional assumption on is imposed.
QAlgorithms.Papers.Independent.Extend50.P30.graphRelation
For natural numbers and , and any matrix over , this defines the -submodule
No quadratic-preservation or all-ones-preservation condition is imposed on . The definition includes and ; for , the relation consists of the unique pair of empty vectors.
QAlgorithms.Papers.Independent.Extend50.P30.haarMoment
For natural numbers with , put . This defines a complex matrix indexed by , whose entries are
Thus the numerator counts permutations satisfying the indicated coordinate equalities. The denominator is nonzero since . The definition includes , , and ; for , the empty product is , there is one permutation, and the matrix has sole entry .
QAlgorithms.Papers.Independent.Extend50.P30.instFintypeDefectQuotient
For every pair of natural numbers with , and every -submodule of , this declaration equips the set
with a finite enumeration, using its existing finiteness. Here is the image of in ; no assumption is imposed. The declaration includes composite , , and .
QAlgorithms.Papers.Independent.Extend50.P30.instFintypeLagrangian
For every pair of natural numbers with , this supplies a finite enumeration of all -submodules having cardinality , containing the pair of all-ones vectors, and satisfying in for every , where for even and otherwise and bars denote canonical representatives modulo . This includes , for which the enumeration has one element; it does not specify a numerical cardinality formula in general.
QAlgorithms.Papers.Independent.Extend50.P30.instFintypeStochasticOrthogonal
For every pair of natural numbers and , this instance supplies a finite enumeration of the type of matrices over satisfying and for every . Here is the all-ones vector, and sums the squares of the least nonnegative coordinate representatives modulo when is even and modulo otherwise. The enumeration is obtained from the finiteness of this type; no particular ordering is specified. The cases and are included.
QAlgorithms.Papers.Independent.Extend50.P30.leftDefect
For natural numbers , put . For any submodule of , this defines the submodule , namely the inverse image of under the linear map . No nonzero-modulus assumption is imposed, so , with coefficient ring , is included; is also included.
QAlgorithms.Papers.Independent.Extend50.P30.minimalTest
For natural numbers , let , and let be the finite set of matrices over such that and for every , where
Here each is the least nonnegative representative, mapped into . The definition gives the matrix on
Thus each summand uses the relation , separately at every site. The normalization is a complex inverse. The identity matrix belongs to , so this finite set is nonempty. Empty products are , and or gives the scalar matrix . No assertion that this matrix is a test or projection accompanies the definition.
QAlgorithms.Papers.Independent.Extend50.P30.mixedStabilizers
For natural numbers with , let , put , , and let when is even and otherwise. For , define the matrix
where bars denote representatives in , addition in is coordinatewise modulo , and the exponent of is an integer. Form the finite set . The declaration defines the finite set of matrices , where , as ranges over all subsets of that contain the identity, are closed under multiplication and conjugate transpose, and satisfy: whenever and for a complex number , then . All inverses in these matrix scalings are complex inverses, with ; duplicate resulting matrices occur only once in the finite set. The parameters include and ; when , is a singleton and the sums defining the exponents are empty.
QAlgorithms.Papers.Independent.Extend50.P30.momentNormalization
For arbitrary natural numbers , including , this defines the natural number
The index set is empty when or , so in either case the value is . All powers are natural number powers, including the convention .
QAlgorithms.Papers.Independent.Extend50.P30.pauliAverageProjector
For natural numbers with , and any finite set of complex matrices indexed by functions , this defines
where the inverse of is taken in . No group or stabilizer condition on is assumed. If is empty, the sum and the inverse of its cardinality are both zero, so the result is the zero matrix. The cases and are allowed.
QAlgorithms.Papers.Independent.Extend50.P30.permutationOperator
For natural numbers and a permutation of , this defines a complex matrix on , where , by
In particular, its action on the basis vector indexed by produces the basis vector indexed by . Both and are allowed; in either case the configuration set is a singleton and the matrix is the scalar .
QAlgorithms.Papers.Independent.Extend50.P30.perpendicular
For natural numbers and a submodule of , this defines the submodule
There is no assumption that ; when , the coefficient ring is . When , the sum is empty and .
QAlgorithms.Papers.Independent.Extend50.P30.phaseModulus
For every natural number , this defines the natural number when is even, and when is odd. In particular, its value at is .
QAlgorithms.Papers.Independent.Extend50.P30.phasePointOperator
For natural numbers and , put , , and . For , define the matrix by
For , the definition gives the matrix , where the bracket is computed in , its representative lies in , and denotes conjugate transpose. Negative exponents are integer powers. No primality or oddness assumption on is made; and are included.
QAlgorithms.Papers.Independent.Extend50.P30.pieceIndex
This defines a function from to , sending to themselves and sending both and to .
QAlgorithms.Papers.Independent.Extend50.P30.positivePseudoInverse
For any finite type equipped with decidable equality and any complex matrix indexed by , this defines through the real continuous functional calculus, where and . For Hermitian , this replaces each nonzero eigenvalue by its reciprocal and leaves zero eigenvalues at zero. The definition imposes no Hermitian, positivity, or invertibility hypothesis on . The index type may be empty.
QAlgorithms.Papers.Independent.Extend50.P30.qubitTest
For every natural number , let . The declaration defines a complex matrix on six ordered copies of , with entries
Here is when its condition holds and otherwise, , and, for , when , and otherwise. Bars denote representatives , and all register and phase-space addition is modulo . In particular, the conjugated entry in brackets is the -entry of . This definition itself imposes no additional matrix property. It includes , where the matrix has sole entry .
QAlgorithms.Papers.Independent.Extend50.P30.qubitVerificationUnitary
For every , put and . For , define if , and zero otherwise. Let , let , and define
Here acts on the first four copies and the parenthesized factor on the last two copies of . The declaration defines the matrix on . Its name does not itself impose or assert unitarity. For , all registers are singletons and the defined matrix is .
QAlgorithms.Papers.Independent.Extend50.P30.quditInvolution
For natural numbers with , let , , and . The declaration defines a complex matrix on ordered copies of by
where, for ,
Bars denote standard nonnegative residue representatives and addition is modulo . The scalar is interpreted in , and the odd-indexed factor is an entry of . No assertion that is part of the definition. It includes , , and ; when , the product is empty and the matrix is a singleton matrix with entry , while gives a singleton matrix with entry .
QAlgorithms.Papers.Independent.Extend50.P30.quditTest
For natural numbers with , put . This defines the complex matrix , indexed by -tuples , by
Here , , and, writing for a residue’s canonical representative,
Addition in is coordinatewise modulo , and means conjugate transpose. Both and are included: empty products equal , and the corresponding tuple spaces are singletons; in particular, for , is the one-entry matrix with entry .
QAlgorithms.Papers.Independent.Extend50.P30.qutritAlternatingProjector
For every natural number , put . This defines a complex matrix indexed by triples by
where the coefficient is when the permutation has sign , and otherwise. The definition includes , when every permutation matrix is the scalar matrix and the resulting matrix is zero.
QAlgorithms.Papers.Independent.Extend50.P30.qutritCSSProjector
For every natural number , put , let be the linear span of the all-ones vector, and let . For , define and , with bars denoting representatives in , and set . This defines a complex matrix indexed by triples through
Thus the local matrix uses the sum over all pairs of vectors in the span , which has three elements. For , the product is empty and every entry is , giving a one-dimensional scalar matrix.
QAlgorithms.Papers.Independent.Extend50.P30.qutritDefect
This defines the -submodule of spanned by the constant vector , namely .
QAlgorithms.Papers.Independent.Extend50.P30.qutritFourAnti
This defines the matrix over with every diagonal entry equal to and every off-diagonal entry equal to :
QAlgorithms.Papers.Independent.Extend50.P30.qutritFourThird
This defines the -submodule of spanned by the four pairs
Thus its elements are all linear combinations of these pairs with coefficients in .
QAlgorithms.Papers.Independent.Extend50.P30.qutritPiece
For every natural number and every , this defines a complex linear subspace of all functions , where . Define for permutations of three positions, , and . With and bars denoting representatives in , define
Let , , , , and . The defined subspace is exactly , where ; vectors in this range need not have norm . The definition includes , with empty products equal to .
QAlgorithms.Papers.Independent.Extend50.P30.qutritPieceProjector
For every natural number , let , the set indexing three copies of an -qutrit register. For a permutation of , define the matrix by when for all , and otherwise. Put and . To specify the third matrix, write , let denote the natural-number representative of , and, for , put
The declaration defines a five-entry family of complex matrices on , indexed starting at , whose entries are respectively , , , , and . This is a definition of matrices; it imposes no additional projector or irreducibility condition. It includes , with the product defining interpreted as the empty product .
QAlgorithms.Papers.Independent.Extend50.P30.qutritSymmetricProjector
For every natural number , put . This defines a complex matrix indexed by triples by averaging the six permutations of the three copies:
The definition includes , when has one element and the resulting matrix is the scalar matrix .
QAlgorithms.Papers.Independent.Extend50.P30.realQubitTest
For every natural number , let . The declaration defines a complex matrix on four ordered copies of by
where . For , if , and otherwise, using residues and addition modulo . The indicator is exactly when the two ordered pairs agree, and the conjugated entry is the corresponding entry of . No restriction to real vectors or real matrices is imposed by this declaration. The case is included and gives a matrix with sole entry .
QAlgorithms.Papers.Independent.Extend50.P30.relationOperator
For natural numbers with and any -submodule , this defines the complex matrix indexed by with entries
No additional quadratic, cardinality, or all-ones condition is required of . For , this is the one-entry matrix with entry .
QAlgorithms.Papers.Independent.Extend50.P30.repeatEffect
For natural numbers and any complex matrix on , where , this defines a complex matrix on by
Thus is evaluated on each consecutive block of copies, and the resulting entries are multiplied. There is no positivity or effect hypothesis on . If , the result is the scalar ; if , writing for the sole entry of , the result is the scalar . The case is permitted.
QAlgorithms.Papers.Independent.Extend50.P30.residuePermutation
For any natural numbers and any permutation of , this defines the matrix over whose entry in row , column , is if and otherwise. No nonzero-modulus hypothesis is imposed: , for which the coefficient ring is , and , for which , are included. For this is the empty matrix.
QAlgorithms.Papers.Independent.Extend50.P30.residueQuadratic
For natural numbers with and a vector , let if is even and otherwise. This defines the element
where each is the canonical integer representative in , first mapped into and then squared. For , this is the empty sum, equal to zero.
QAlgorithms.Papers.Independent.Extend50.P30.rightDefect
For natural numbers , put . For any submodule of , this defines the submodule , namely the inverse image of under the linear map . No nonzero-modulus assumption is imposed, so , with coefficient ring , is included; is also included.
QAlgorithms.Papers.Independent.Extend50.P30.rowVectorize
For any type and any complex matrix indexed by , this defines a complex coordinate vector indexed by , whose coordinate at is exactly . No finiteness assumption on , normalization factor, conjugation, or condition on is included.
QAlgorithms.Papers.Independent.Extend50.P30.soundnessConstant
For arbitrary natural numbers , this defines the real number
The subtraction in the exponent is truncated natural-number subtraction, so . There is no assumption that ; real division by zero is defined as zero here, giving for every .
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerFrame
For natural numbers with , put , when is even and otherwise, , and . Define unless , and otherwise define , using representatives in , and set . For every subset containing the identity, closed under multiplication and conjugate transpose, and satisfying , form and , using zero for the inverse of zero. Let be the set of distinct resulting that equal for some unit vector . The defined matrix, indexed by , has entries
There is no division by . For , its sole entry is ; and are included.
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerGram
For natural numbers with , put , when is even and otherwise, , and . For , let be zero unless , and otherwise let it equal , using representatives . Form the finite set . Consider every subset containing the identity, closed under multiplication and conjugate transpose, and satisfying . For each such , set and , with the complex inverse of zero defined as zero, and retain those expressible as for a unit vector . The resulting finite set , with duplicates removed, indexes both rows and columns of the defined matrix. For each , choose a unit vector with ; the -entry is , with the complex inner product conjugate-linear in its first argument. These choices specify no particular phases. When , every entry is , including when the inner product is zero; and are allowed.
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerMixture
For natural numbers with , any natural number , any finite set of complex matrices indexed by , and any real function on all such matrices, this defines the matrix indexed by with entries
There is no requirement that the matrices in be stabilizer matrices or density matrices, or that the weights be nonnegative or sum to one. An empty gives the zero matrix; for , the indexing set is a singleton and its sole matrix entry is .
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerMoment
For natural numbers , let . This defines a matrix on by
where is the following finite set of distinct matrices. Put , , and if is even, otherwise . Define
using least nonnegative residue representatives. For every subset that contains the identity, is closed under matrix multiplication and conjugate transpose, and satisfies , form
The set consists of those resulting expressible as with . Repeated occurrences of the same matrix are counted once. Inverses are complex inverses, with , so the displayed average would be zero if were empty. When , each product in the sum is ; when , is a singleton.
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerOverlap
For natural numbers with , any complex matrix indexed by , and any vector with the Euclidean norm, the declaration defines the real number
There is no requirement that belong to any designated finite set, be positive, or be an effect, and there is no normalization requirement on . The parameters include and ; in the latter case is a singleton.
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerSpan
For natural numbers , let . This defines the complex linear span in of the functions
where has Euclidean norm and belongs to the following finite set . Set , , and for even , otherwise . With least nonnegative residue representatives, define
For each subset containing the identity, closed under multiplication and conjugate transpose, and satisfying , form . The set consists of the distinct matrices that equal for some unit vector ; complex inversion sends zero to zero. For , each generating function has the single value ; if there are no eligible vectors, the span is the zero subspace. The case is also included.
QAlgorithms.Papers.Independent.Extend50.P30.stabilizerVector
For natural numbers with and any complex matrix indexed by , this returns a classically chosen vector satisfying and for every , if such a vector exists. If none exists, it returns the zero vector. The choice specifies no particular global phase, and is not required to belong to any stabilizer set. The definition includes and , when is a singleton.
QAlgorithms.Papers.Independent.Extend50.P30.stabilizers
For natural numbers with , let , , , and if is even and otherwise. Define matrices on by
using the standard nonnegative residue representatives and coordinatewise modular addition, and put . The declaration defines the finite set consisting of those matrices , with , for which there exists a vector of Euclidean norm satisfying for every . Here ranges over subsets of containing the identity, closed under multiplication and conjugate transpose, and containing no scalar matrix with . The construction uses complex inverses with , and repeated matrices are identified. Both and are included; for , is a singleton and the exponent sums are empty.
QAlgorithms.Papers.Independent.Extend50.P30.standardS3
For every permutation of , this defines a complex matrix , with row and column indices , by
Thus a row is , , or according as is , , or .
QAlgorithms.Papers.Independent.Extend50.P30.sumNegativity
For natural numbers and , let and let be any complex Euclidean vector. Put , , and define when , and otherwise . For , put , using least nonnegative residues and integer powers. The definition gives
the finite sum of the negative parts of these real values. No normalization of , primality of , or oddness of is required. The cases and are included and give zero.
QAlgorithms.Papers.Independent.Extend50.P30.symplecticBracket
For arbitrary natural numbers and pairs , of functions , this defines the residue
All operations occur in the residue ring. No nonzero assumption on is required; at , the operations are integer operations. For , the empty sum is zero.
QAlgorithms.Papers.Independent.Extend50.P30.tensorRelation
For natural numbers with and any -submodule , this defines a complex matrix indexed by arrays through
Thus an entry is exactly when the indicated pair of -coordinate columns belongs to at every site , and is otherwise. No further condition on is imposed. If , the product is empty and the sole matrix entry is ; if , the sole entry is also .
QAlgorithms.Papers.Independent.Extend50.P30.threeCopyInvolution
For natural numbers and , let . This defines a complex matrix on by
Here, writing , , and for a residue’s representative, define
and
where the exponent uses the representative of the bracket, negated as an integer. All matrix scalars are interpreted in . The case is included: all registers and phase spaces are singletons, empty products equal , and the resulting matrix is the scalar . The definition itself imposes no equation asserting that is an involution.
QAlgorithms.Papers.Independent.Extend50.P30.threeCopyTest
For natural numbers and , put . This defines the complex matrix on
To specify the matrices , let , , and let denote a residue’s representative in . For , set
The bracketed exponent is the representative modulo , negated as an integer. This includes , when the matrix is the scalar . No positivity or upper bound by the identity is part of this definition.
QAlgorithms.Papers.Independent.Extend50.P30.transposeRelation
For any natural numbers and any -submodule , where , this defines the submodule
There is no nonzero-modulus hypothesis: , interpreted using , is permitted, as is .
QAlgorithms.Papers.Independent.Extend50.P30.unitaryChoiVector
For any natural number and any complex matrix indexed by , this defines a vector indexed by with coordinate
No unitarity or other condition on is assumed. For , both register indexing sets are singletons, and the resulting vector's sole coordinate is 's sole entry.
QAlgorithms.Papers.Independent.Extend50.P30.unitaryDistance
For every natural number and arbitrary complex matrices indexed by , this defines the real number
There is no hypothesis that either matrix is unitary. The real square root used here equals zero when its argument is negative, so the definition also covers matrices for which the squared modulus exceeds one. It includes , when is a singleton and the denominator is .
QAlgorithms.Papers.Independent.Extend50.P30.weylBellVector
For every natural number and every pair , where , the declaration defines a Euclidean vector by
Each barred coordinate is its representative or , addition in is modulo , and the exponent of is an integer. The factor means . The definition includes : both and the phase space are singletons, the exponent sums are empty, and the vector’s sole coordinate is .
QAlgorithms.Papers.Independent.Extend50.P30.weylPhase
For every natural number , this defines the complex number , with complex division. The definition includes , where division by zero gives zero and the resulting value is .
QAlgorithms.Papers.Independent.Extend50.P30.weylRoot
For every natural number , this defines the complex number , with regarded as a complex number in the division. The definition includes : division by zero is defined to be zero, so the value there is .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.