Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Group-Invariant Quantum Machine Learning

Definition
QAlgorithms_Papers_Independent_Advance50_P50

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

prove2quantum

The objects the formalized statements of Group-Invariant Quantum Machine Learning (arXiv:2205.02261) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • tensorFactors: PDF p.5: independent tensor factors, in the displayed order.
  • ExpectationModel: PDF p.3, Hypothesis Class 1: fixed input-independent unitary and Hermitian observable. A parameter value theta is fixed by choosing this model.
  • ExpectationModel.effective: PDF p.5, Eq.(6): effective observable, computed from the model.
  • ExpectationModel.response: PDF p.3, Eq.(2): the real exact expectation of the fixed model.
  • groupMatrices: PDF pp.2–3: matrices of a specified subgroup of the unitary group.
  • DomainInvariant: PDF p.3, Definition 1: invariance is relative to a declared data domain.
  • DatasetSymmetry: PDF pp.2–3: all data are density matrices; the group preserves the data and their labels. The label map is only constrained on the data domain.
  • tensorCommutant: PDF p.5, Definition 5: complex matrices commuting with every tensor power. The accepted ordinary matrix commutant is applied to the tensor-power image; no Hermiticity restriction is imposed.
  • tangentAtIdentity: PDF p.5: the actual tangent space at identity, described by derivatives of curves in the represented group, rather than the false rule exp(g)=G.
  • MatrixLieData: PDF p.5 and Appendix B: a matrix Lie group with its actual real tangent Lie algebra. The tangent identification prevents an unrelated algebra from being supplied. Skew-Hermiticity is the unitary Lie algebra convention.
  • lieComplement: PDF p.5, Definition 6: Hilbert–Schmidt orthogonal complement inside u(d), which is a real vector space and need not be a Lie algebra.
  • timesI: PDF p.5: multiplication by i identifies skew-Hermitian and Hermitian spaces.
  • slotFactor: PDF pp.5,23–24: place A on copy j, B on the remaining copies in their original order. The subtype of all indices except j is the explicit reindexing.
  • separatedSpan: PDF p.5, Proposition 2: the span of the specified k separated terms, with one prescribed A_j and complementary-copy operator B_j for each j.
  • inputLieSpace: PDF pp.5–6: select the algebra or its complement for an input domain. This implements the explicitly stated interchangeable cases in Propositions 2,4.
  • purityDomain: PDF p.6, Eq.(8): the full pure versus fixed-b mixed data domain.
  • SeparatesPurity: PDF p.4, Definition 4: exact expectations separate every opposite-label pair.
  • copySwap: PDF p.8: swap the two complete registers.
  • printedBell: PDF p.10, literal Eq.(22): this is an unnormalized vector, with amplitude 1/d, not 1/sqrt(d). It is never used as a unit quantum state.
  • orthogonalMatrices: PDF pp.9–10: orthogonal matrices in the fixed basis, represented as real unitaries.
  • localUnitaryMatrices: PDF pp.12–14: the local unitary action, with the same local gate applied across copies only when its tensor power is subsequently taken.
  • localPermutation: PDF p.14, Eq.(39): physical copy permutations independently at each site. This formula performs the copy/site shuffle explicitly and retains all kernels.
  • pairedSiteProduct: PDF pp.13–14: tensor product of two-copy site operators, returned to copy-major order by the explicit coordinate map (c,j) ↦ (j,c).
  • subsystemSwap: PDF pp.13–14: swap just the sites in Q, and identity on its complement.
  • FullyProduct: PDF pp.12–14: full separability for a pure state, rather than separability across just one bipartition.
  • EntanglementMeasure: PDF p.12, Eq.(29): the stated local-unitary-invariant entanglement measure.
  • entanglementDomain: PDF p.12, Eq.(29): pure states in the zero or fixed-positive-E class.
  • globalImpurityObservable: PDF p.13, Eq.(35): the averaged single-site impurity observable.
  • concentratableObservable: PDF p.14, Eq.(37): literal tensor product of I+SWAP on Q, identity elsewhere.
  • sitePermutation: PDF p.15: the physical permutation of site registers.
  • sitePermutationMatrices: PDF p.15: all site permutations as a represented group action.
  • collectiveSpan: PDF p.15, Eq.(43): span of the full set of collective one-qubit unitaries.
  • siteEmbedding: PDF p.15, Eq.(41), and Appendix G p.29: embed a one-qubit operator on a specified site and identity on every other site. Reuse the accepted Fin-indexed site operator through the frozen bitstring/index equivalence.
  • graphHamiltonian: PDF pp.14–15, Eq.(41): unordered edges occur once, via i<j.
  • graphEvolution: PDF pp.14–15, Eqs.(40)–(41): the actual Ising graph evolution, sign -itH.
  • graphEncoding: PDF p.14, Eq.(40): encode a graph by conjugating the fixed fiduciary density.
  • composeLayers: PDF p.16, Eq.(44): the constructed composition of consecutive maps.
  • AncillaModel: PDF p.25, Hypothesis Class 3: only an ancilla observable is measured.
  • AncillaModel.effective: PDF p.25, Eq.(D1): the effective ancilla-only measurement.
  • AncillaModel.response: PDF p.25, Eq.(D1): ancilla |0>, followed by two identical data copies.
  • swapTestMatrix: PDF p.25: the constructed controlled-SWAP test H-CSWAP-H.
  • cnot3: PDF p.26, Fig.1: a CNOT on named wires; wire 0 is the ancilla.
  • runGates: PDF p.26, Fig.1: evaluate the printed gate list in chronological order.
  • circuit1: PDF p.26, Fig.1(a): the complete printed native-gate SWAP-test circuit. Simultaneous gates on different wires are ordered ancilla first.
  • circuitW: PDF p.26, Fig.1(b): W=T†H as specified in the caption.
  • circuit2: PDF p.26, Fig.1(b): the complete printed circuit from Ref.[61].
  • targetObservable3: PDF p.26, Eq.(D4): Z on the ancilla times SWAP on the two data qubits.
  • ancillaRealignment: PDF p.26: realignment across the ancilla/data operator bipartition. Rows index ancilla output/input; columns index data output/input. The accepted realignment is transported through Fin.cons with each paired index reversed.
  • operatorSchmidtRank: PDF p.26: operator Schmidt rank is the rank of the realigned matrix, not the rank of U or the Schmidt rank of an output state.
  • LocallyEquivalent: PDF p.26: left and right local unitary equivalence across ancilla/data.
  • posteriorAt: PDF pp.26–27, Lemma 2: posterior class-0 probability at the atom X=c, with equal class priors. Each measure is the conditional sampling law in its class. The factors 1/2 cancel; no density at a point is used.
  • haarOutput: PDF p.28, Eq.(F2): finite-index Haar unitary transported to the frozen bitstring basis using the accepted most-significant-bit convention.
  • qgcnnGenerator: PDF p.29, Eq.(G3), adapted from Ref.[32]: tied real parameters and the same Hermitian one-site operators at every site. Each unordered edge is counted once.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Measurement
import Definitions.Def_QAlgorithms_Defs_SchurUnitaryEnsembles
import Definitions.Def_QAlgorithms_Defs_Channel
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P63
import Definitions.Def_QAlgorithms_Papers_Independent_Gap48_P20
import Definitions.Def_QAlgorithms_Papers_Independent_Gap48_P38
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P32
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P08
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P03
import Definitions.Def_QAlgorithms_Papers_Independent_Renew46_P24
import Definitions.Def_QAlgorithms_Papers_Independent_Next46_P23

/-!
Statements from Larocca et al., arXiv:2205.02261v2 (2022).
All page numbers are PDF pages. New definitions are confined to this paper.
Copy-major basis: `Fin k → Qubits n`; a site's k bits are obtained by transposing
these two finite indices, without changing their order. Predictions are exact
expectations, not individual measurement outcomes. See HARD.md for deferred claims.
-/

noncomputable section

namespace QAlgorithms.Papers.Independent.Advance50.P50

open MeasureTheory ProbabilityTheory
open scoped ComplexConjugate ENNReal

-- Exact accepted primitives; no paper-local redeclarations.
open QAlgorithms.Papers.Independent.Information100.P63 (Mat tensorPower)
open QAlgorithms.Papers.Independent.Gap48.P20 (Copies)
open QAlgorithms.Papers.Independent.Gap48.P38 (subsystemReduction)
open QAlgorithms.Papers.Independent.Information100.P32 (purity)
open QAlgorithms.Papers.Independent.Information100.P08 (IsPure)

-- Matrices carry the associative commutator bracket X*Y-Y*X.
attribute [local instance 100] LieRing.ofAssociativeRing

/-- PDF p.5: independent tensor factors, in the displayed order. -/
def tensorFactors {I : Type*} {k : ℕ} (A : Fin k → Mat I) : Mat (Copies I k) :=
  fun x y => ∏ c, A c (x c) (y c)

/-- PDF p.3, Hypothesis Class 1: fixed input-independent unitary and Hermitian
observable. A parameter value theta is fixed by choosing this model. -/
structure ExpectationModel (I : Type*) [Fintype I] [DecidableEq I] (k : ℕ) where
  unitary : Matrix.unitaryGroup (Copies I k) ℂ
  observable : Mat (Copies I k)
  hermitian : observable.IsHermitian

/-- PDF p.5, Eq.(6): effective observable, computed from the model. -/
def ExpectationModel.effective {I : Type*} [Fintype I] [DecidableEq I] {k : ℕ}
    (M : ExpectationModel I k) : Mat (Copies I k) :=
  (M.unitary : Mat (Copies I k)).conjTranspose * M.observable * M.unitary

/-- PDF p.3, Eq.(2): the real exact expectation of the fixed model. -/
def ExpectationModel.response {I : Type*} [Fintype I] [DecidableEq I] {k : ℕ}
    (M : ExpectationModel I k) (rho : Mat I) : ℝ :=
  ((M.unitary : Mat (Copies I k)) * tensorPower k rho *
    (M.unitary : Mat (Copies I k)).conjTranspose * M.observable).trace.re

/-- PDF pp.2–3: matrices of a specified subgroup of the unitary group. -/
def groupMatrices {I : Type*} [Fintype I] [DecidableEq I]
    (G : Subgroup (Matrix.unitaryGroup I ℂ)) : Set (Mat I) :=
  {V | ∃ u : Matrix.unitaryGroup I ℂ, u ∈ G ∧ (u : Mat I) = V}

/-- PDF p.3, Definition 1: invariance is relative to a declared data domain. -/
def DomainInvariant {I : Type*} [Fintype I] (G R : Set (Mat I)) (h : Mat I → ℝ) : Prop :=
  ∀ V ∈ G, ∀ rho ∈ R, h (conjSuperop V rho) = h rho

/-- PDF pp.2–3: all data are density matrices; the group preserves the data
and their labels. The label map is only constrained on the data domain. -/
def DatasetSymmetry {I : Type*} [Fintype I] (G R : Set (Mat I))
    (label : Mat I → Bool) : Prop :=
  (∀ rho ∈ R, IsDensityMatrix rho) ∧
  ∀ V ∈ G, ∀ rho ∈ R, conjSuperop V rho ∈ R ∧ label (conjSuperop V rho) = label rho

/-- PDF p.5, Definition 5: complex matrices commuting with every tensor power.
The accepted ordinary matrix commutant is applied to the tensor-power image;
no Hermiticity restriction is imposed. -/
def tensorCommutant {I : Type} [Fintype I] (k : ℕ) (G : Set (Mat I)) :
    Set (Mat (Copies I k)) :=
  by
    classical
    exact QAlgorithms.Papers.Independent.Next46.P23.matrixCommutant ((tensorPower k) '' G)

/-- PDF p.5: the actual tangent space at identity, described by derivatives
of curves in the represented group, rather than the false rule exp(g)=G. -/
def tangentAtIdentity {I : Type*} [Fintype I] [DecidableEq I]
    (G : Subgroup (Matrix.unitaryGroup I ℂ)) : Set (Mat I) :=
  {X | ∃ c : ℝ → Mat I, c 0 = 1 ∧
    (∀ t, c t ∈ groupMatrices G) ∧ HasDerivAt c X 0}

/-- PDF p.5 and Appendix B: a matrix Lie group with its actual real tangent
Lie algebra. The tangent identification prevents an unrelated algebra from
being supplied. Skew-Hermiticity is the unitary Lie algebra convention. -/
structure MatrixLieData (I : Type*) [Fintype I] [DecidableEq I] where
  group : Subgroup (Matrix.unitaryGroup I ℂ)
  algebra : LieSubalgebra ℝ (Mat I)
  actualTangent : (algebra : Set (Mat I)) = tangentAtIdentity group
  skew : ∀ X : Mat I, X ∈ algebra → X.conjTranspose = -X

/-- PDF p.5, Definition 6: Hilbert–Schmidt orthogonal complement inside u(d),
which is a real vector space and need not be a Lie algebra. -/
def lieComplement {I : Type*} [Fintype I] [DecidableEq I]
    (L : MatrixLieData I) : Set (Mat I) :=
  {X | X.conjTranspose = -X ∧ ∀ Y ∈ L.algebra, (X.conjTranspose * Y).trace = 0}

/-- PDF p.5: multiplication by i identifies skew-Hermitian and Hermitian spaces. -/
def timesI {I : Type*} (S : Set (Mat I)) : Set (Mat I) :=
  (fun X => Complex.I • X) '' S

/-- PDF pp.5,23–24: place A on copy j, B on the remaining copies in their
original order. The subtype of all indices except j is the explicit reindexing. -/
def slotFactor {I : Type*} {k : ℕ} (j : Fin k) (A : Mat I)
    (B : Mat ({c : Fin k // c ≠ j} → I)) : Mat (Copies I k) :=
  fun x y => A (x j) (y j) * B (fun c => x c.1) (fun c => y c.1)

/-- PDF p.5, Proposition 2: the span of the specified k separated terms,
with one prescribed A_j and complementary-copy operator B_j for each j. -/
def separatedSpan {I : Type*} {k : ℕ} (A : Fin k → Mat I)
    (B : (j : Fin k) → Mat ({c : Fin k // c ≠ j} → I)) :
    Submodule ℂ (Mat (Copies I k)) :=
  Submodule.span ℂ (Set.range (fun j => slotFactor j (A j) (B j)))

/-- PDF pp.5–6: select the algebra or its complement for an input domain.
This implements the explicitly stated interchangeable cases in Propositions 2,4. -/
def inputLieSpace {I : Type*} [Fintype I] [DecidableEq I]
    (L : MatrixLieData I) (complementary : Bool) : Set (Mat I) :=
  if complementary then lieComplement L else (L.algebra : Set (Mat I))

/-- PDF p.6, Eq.(8): the full pure versus fixed-b mixed data domain. -/
def purityDomain {I : Type*} [Fintype I] (b : ℝ) : Set (Mat I) :=
  {rho | IsDensityMatrix rho ∧ (purity rho = 1 ∨ purity rho = b)}

/-- PDF p.4, Definition 4: exact expectations separate every opposite-label pair. -/
def SeparatesPurity {I : Type*} [Fintype I] (b : ℝ) (h : Mat I → ℝ) : Prop :=
  ∀ rho sigma : Mat I, IsDensityMatrix rho → IsDensityMatrix sigma →
    purity rho = 1 → purity sigma = b → h rho ≠ h sigma

/-- PDF p.8: swap the two complete registers. -/
def copySwap (I : Type*) [DecidableEq I] : Mat (Copies I 2) :=
  fun y x => if y 0 = x 1 ∧ y 1 = x 0 then 1 else 0

/-- PDF p.10, literal Eq.(22): this is an unnormalized vector, with amplitude
1/d, not 1/sqrt(d). It is never used as a unit quantum state. -/
def printedBell (n : ℕ) : EuclideanSpace ℂ (Copies (Qubits n) 2) :=
  WithLp.toLp 2 fun x => if x 0 = x 1 then ((2 : ℂ) ^ n)⁻¹ else 0

/-- PDF pp.9–10: orthogonal matrices in the fixed basis, represented as real unitaries. -/
def orthogonalMatrices (n : ℕ) : Set (Mat (Qubits n)) :=
  {V | V ∈ Matrix.unitaryGroup (Qubits n) ℂ ∧ ∀ x y, (V x y).im = 0}

/-- PDF pp.12–14: the local unitary action, with the same local gate applied
across copies only when its tensor power is subsequently taken. -/
def localUnitaryMatrices (n : ℕ) : Set (Mat (Qubits n)) :=
  {V | ∃ u : Fin n → Matrix.unitaryGroup Bool ℂ,
    V = fun x y => ∏ j, (u j : Mat Bool) (x j) (y j)}

/-- PDF p.14, Eq.(39): physical copy permutations independently at each site.
This formula performs the copy/site shuffle explicitly and retains all kernels. -/
def localPermutation (n k : ℕ) (p : Fin n → Equiv.Perm (Fin k)) :
    Mat (Copies (Qubits n) k) :=
  fun y x => if y = (fun c j => x ((p j).symm c) j) then 1 else 0

/-- PDF pp.13–14: tensor product of two-copy site operators, returned to
copy-major order by the explicit coordinate map (c,j) ↦ (j,c). -/
def pairedSiteProduct {n : ℕ} (F : Fin n → Mat (Copies Bool 2)) :
    Mat (Copies (Qubits n) 2) :=
  fun x y => ∏ j, F j (fun c => x c j) (fun c => y c j)

/-- PDF pp.13–14: swap just the sites in Q, and identity on its complement. -/
def subsystemSwap {n : ℕ} (Q : Finset (Fin n)) : Mat (Copies (Qubits n) 2) :=
  pairedSiteProduct fun j => if j ∈ Q then copySwap Bool else 1

/-- PDF pp.12–14: full separability for a pure state, rather than separability
across just one bipartition. -/
def FullyProduct {n : ℕ} (rho : Mat (Qubits n)) : Prop :=
  ∃ psi : Fin n → EuclideanSpace ℂ Bool,
    (∀ j, IsState (psi j)) ∧ rho = pureDensity (prodState psi)

/-- PDF p.12, Eq.(29): the stated local-unitary-invariant entanglement measure. -/
structure EntanglementMeasure (n : ℕ) where
  value : Mat (Qubits n) → ℝ
  range : ∀ rho, IsPure rho → value rho ∈ Set.Icc 0 1
  invariant : DomainInvariant (localUnitaryMatrices n) {rho | IsPure rho} value
  zero : ∀ rho, IsPure rho → (value rho = 0 ↔ FullyProduct rho)

/-- PDF p.12, Eq.(29): pure states in the zero or fixed-positive-E class. -/
def entanglementDomain {n : ℕ} (E : EntanglementMeasure n) (b : ℝ) :
    Set (Mat (Qubits n)) :=
  {rho | IsPure rho ∧ (E.value rho = 0 ∨ E.value rho = b)}

/-- PDF p.13, Eq.(35): the averaged single-site impurity observable. -/
def globalImpurityObservable (n : ℕ) : Mat (Copies (Qubits n) 2) :=
  ((2 : ℂ) / n) • ∑ j : Fin n, (1 - subsystemSwap {j})

/-- PDF p.14, Eq.(37): literal tensor product of I+SWAP on Q, identity elsewhere. -/
def concentratableObservable {n : ℕ} (Q : Finset (Fin n)) :
    Mat (Copies (Qubits n) 2) :=
  1 - ((2 : ℂ) ^ Q.card)⁻¹ •
    pairedSiteProduct (fun j => if j ∈ Q then 1 + copySwap Bool else 1)

/-- PDF p.15: the physical permutation of site registers. -/
def sitePermutation {n : ℕ} (p : Equiv.Perm (Fin n)) : Mat (Qubits n) :=
  fun y x => if y = x ∘ p.symm then 1 else 0

/-- PDF p.15: all site permutations as a represented group action. -/
def sitePermutationMatrices (n : ℕ) : Set (Mat (Qubits n)) :=
  Set.range (sitePermutation (n := n))

/-- PDF p.15, Eq.(43): span of the full set of collective one-qubit unitaries. -/
def collectiveSpan (n : ℕ) : Submodule ℂ (Mat (Qubits n)) :=
  Submodule.span ℂ {T | ∃ A : Matrix.unitaryGroup Bool ℂ,
    T = fun x y => ∏ j : Fin n, (A : Mat Bool) (x j) (y j)}

/-- PDF p.5: the 0-copy power is the scalar identity, not a zero-dimensional register. -/
example {I : Type*} (A : Mat I) (x y : Copies I 0) : tensorPower 0 A x y = 1 := by
  simp [tensorPower]

/-- PDF p.3: one copy reproduces the original matrix entries. -/
example {I : Type*} (A : Mat I) (x y : Copies I 1) :
    tensorPower 1 A x y = A (x 0) (y 0) := by
  simp [tensorPower]

/-- PDF p.5: the zero observable belongs to the tensorCommutant. -/
example {I : Type} [Fintype I] (k : ℕ) (G : Set (Mat I)) :
    (0 : Mat (Copies I k)) ∈ tensorCommutant k G := by
  intro V hV
  simp

/-- PDF p.8: two copies of |0> are fixed by the swap. -/
example : copySwap Bool (fun _ => false) (fun _ => false) = 1 := by
  simp [copySwap]

/-- PDF p.13: subsystem coordinates retain the actual site, not the first site. -/
example {n : ℕ} (F : Fin n → Mat (Copies Bool 2))
    (x y : Copies (Qubits n) 2) :
    pairedSiteProduct F x y = ∏ j, F j (fun c => x c j) (fun c => y c j) := rfl

/-- PDF p.15, Eq.(41), and Appendix G p.29: embed a one-qubit operator on a
specified site and identity on every other site. Reuse the accepted Fin-indexed
site operator through the frozen bitstring/index equivalence. -/
def siteEmbedding {n : ℕ} (j : Fin n) (A : Mat Bool) : Mat (Qubits n) :=
  fun x y => QAlgorithms.Papers.Independent.Renew46.P24.siteOperator n A j
    (bitsEquivFin n x) (bitsEquivFin n y)

/-- PDF pp.14–15, Eq.(41): unordered edges occur once, via i<j. -/
def graphHamiltonian {n : ℕ} (G : SimpleGraph (Fin n)) : Mat (Qubits n) := by
  classical
  exact (∑ i : Fin n, ∑ j : Fin n,
    if i < j ∧ G.Adj i j then siteEmbedding i pauliZ * siteEmbedding j pauliZ else 0) +
    ∑ i : Fin n, siteEmbedding i pauliX

/-- PDF pp.14–15, Eqs.(40)–(41): the actual Ising graph evolution, sign -itH. -/
def graphEvolution {n : ℕ} (G : SimpleGraph (Fin n)) (t : ℝ) : Mat (Qubits n) :=
  NormedSpace.exp (-(Complex.I * (t : ℂ)) • graphHamiltonian G)

/-- PDF p.14, Eq.(40): encode a graph by conjugating the fixed fiduciary density. -/
def graphEncoding {n : ℕ} (G : SimpleGraph (Fin n)) (t : ℝ)
    (rho : Mat (Qubits n)) : Mat (Qubits n) := conjSuperop (graphEvolution G t) rho

/-- PDF p.16, Eq.(44): the constructed composition of consecutive maps. -/
def composeLayers {A : ℕ → Type*} (f : ∀ j, A j → A (j+1)) :
    (m : ℕ) → A 0 → A m
  | 0 => id
  | m+1 => f m ∘ composeLayers f m

/-- PDF p.25, Hypothesis Class 3: only an ancilla observable is measured. -/
structure AncillaModel (I : Type*) [Fintype I] [DecidableEq I] where
  unitary : Matrix.unitaryGroup (Bool × Copies I 2) ℂ
  observable : Mat Bool
  hermitian : observable.IsHermitian

/-- PDF p.25, Eq.(D1): the effective ancilla-only measurement. -/
def AncillaModel.effective {I : Type*} [Fintype I] [DecidableEq I]
    (M : AncillaModel I) : Mat (Bool × Copies I 2) :=
  (M.unitary : Mat (Bool × Copies I 2)).conjTranspose *
    Matrix.kronecker M.observable (1 : Mat (Copies I 2)) * M.unitary

/-- PDF p.25, Eq.(D1): ancilla |0>, followed by two identical data copies. -/
def AncillaModel.response {I : Type*} [Fintype I] [DecidableEq I]
    (M : AncillaModel I) (rho : Mat I) : ℝ :=
  ((M.unitary : Mat (Bool × Copies I 2)) *
    Matrix.kronecker (pureDensity (ket false)) (tensorPower 2 rho) *
    (M.unitary : Mat (Bool × Copies I 2)).conjTranspose *
    Matrix.kronecker M.observable (1 : Mat (Copies I 2))).trace.re

/-- PDF p.25: the constructed controlled-SWAP test H-CSWAP-H. -/
def swapTestMatrix (I : Type*) [Fintype I] [DecidableEq I] :
    Mat (Bool × Copies I 2) :=
  Matrix.kronecker hadamard (1 : Mat (Copies I 2)) * controlled (copySwap I) *
    Matrix.kronecker hadamard (1 : Mat (Copies I 2))

/-- PDF p.26, Fig.1: a CNOT on named wires; wire 0 is the ancilla. -/
def cnot3 (control target : Fin 3) : Mat (Qubits 3) :=
  fun y x => if y = Function.update x target (xor (x target) (x control)) then 1 else 0

/-- PDF p.26, Fig.1: evaluate the printed gate list in chronological order. -/
def runGates : List (Mat (Qubits 3)) → Mat (Qubits 3)
  | [] => 1
  | g :: gs => runGates gs * g

/-- PDF p.26, Fig.1(a): the complete printed native-gate SWAP-test circuit.
Simultaneous gates on different wires are ordered ancilla first. -/
def circuit1 : Mat (Qubits 3) :=
  runGates [siteEmbedding 0 hadamard, cnot3 1 2, siteEmbedding 1 hadamard,
    cnot3 1 2, siteEmbedding 2 gateT.conjTranspose, cnot3 0 2,
    siteEmbedding 2 gateT, cnot3 1 2, siteEmbedding 2 gateT.conjTranspose,
    cnot3 0 2, siteEmbedding 1 gateT, cnot3 0 1, siteEmbedding 0 gateT,
    siteEmbedding 1 gateT.conjTranspose, cnot3 0 1, siteEmbedding 0 hadamard]

/-- PDF p.26, Fig.1(b): W=T†H as specified in the caption. -/
def circuitW : Mat Bool := gateT.conjTranspose * hadamard

/-- PDF p.26, Fig.1(b): the complete printed circuit from Ref.[61]. -/
def circuit2 : Mat (Qubits 3) :=
  runGates [siteEmbedding 0 circuitW, cnot3 1 2, cnot3 2 0,
    siteEmbedding 0 circuitW.conjTranspose, cnot3 0 1,
    siteEmbedding 0 circuitW, cnot3 2 0, siteEmbedding 0 circuitW.conjTranspose]

/-- PDF p.26, Eq.(D4): Z on the ancilla times SWAP on the two data qubits. -/
def targetObservable3 : Mat (Qubits 3) :=
  fun y x => pauliZ (y 0) (x 0) *
    (if y 1 = x 2 ∧ y 2 = x 1 then 1 else 0)

/-- PDF p.26: realignment across the ancilla/data operator bipartition.
Rows index ancilla output/input; columns index data output/input. The accepted
realignment is transported through Fin.cons with each paired index reversed. -/
def ancillaRealignment (U : Mat (Qubits 3)) :
    Matrix (Bool × Bool) (Qubits 2 × Qubits 2) ℂ :=
  let bipartite : Mat (Bool × Qubits 2) :=
    fun x y => U (Fin.cons x.1 x.2) (Fin.cons y.1 y.2)
  fun a b => QAlgorithms.Papers.Independent.Information100.P03.realignment bipartite
    (a.2, a.1) (b.2, b.1)

/-- PDF p.26: operator Schmidt rank is the rank of the realigned matrix,
not the rank of U or the Schmidt rank of an output state. -/
def operatorSchmidtRank (U : Mat (Qubits 3)) : ℕ :=
  Module.finrank ℂ (LinearMap.range (Matrix.toLin' (ancillaRealignment U)))

/-- PDF p.26: left and right local unitary equivalence across ancilla/data. -/
def LocallyEquivalent (U V : Mat (Qubits 3)) : Prop :=
  ∃ (A C : Matrix.unitaryGroup Bool ℂ) (B D : Matrix.unitaryGroup (Qubits 2) ℂ),
    V = Mul.mul (α := Mat (Qubits 3))
      (Mul.mul (α := Mat (Qubits 3))
        (fun (x y : Qubits 3) => Matrix.kronecker (A : Mat Bool) (B : Mat (Qubits 2))
          (x 0, fun i => x i.succ) (y 0, fun i => y i.succ)) U)
      (fun (x y : Qubits 3) => Matrix.kronecker (C : Mat Bool) (D : Mat (Qubits 2))
        (x 0, fun i => x i.succ) (y 0, fun i => y i.succ))

/-- PDF p.26: a CNOT flips its target when its control is one. -/
example : cnot3 0 1 ![true,true,false] ![true,false,false] = 1 := by
  have h : (![true,true,false] : Qubits 3) =
      Function.update (![true,false,false] : Qubits 3) 1 true := by
    funext i
    fin_cases i <;> simp [Function.update]
  simp [cnot3, h]

/-- PDF p.26: no gates means identity. -/
example : runGates [] = 1 := rfl

/-- PDF pp.26–27, Lemma 2: posterior class-0 probability at the atom X=c,
with equal class priors. Each measure is the conditional sampling law in its
class. The factors 1/2 cancel; no density at a point is used. -/
def posteriorAt {Omega : Type*} [MeasurableSpace Omega]
    (mu0 mu1 : Measure Omega) (X : Omega → ℝ) (c : ℝ) : ℝ :=
  (mu0 {w | X w = c}).toReal /
    ((mu0 {w | X w = c}).toReal + (mu1 {w | X w = c}).toReal)

/-- PDF p.28, Eq.(F2): finite-index Haar unitary transported to the frozen
bitstring basis using the accepted most-significant-bit convention. -/
def haarOutput (n : ℕ) (rho O : Mat (Qubits n))
    (u : Matrix.unitaryGroup (Fin (2 ^ n)) ℂ) : ℝ :=
  let V : Mat (Qubits n) := fun x y => (u : Mat (Fin (2^n))) (bitsEquivFin n x) (bitsEquivFin n y)
  (O * conjSuperop V rho).trace.re

/-- PDF p.29, Eq.(G3), adapted from Ref.[32]: tied real parameters and the
same Hermitian one-site operators at every site. Each unordered edge is counted once. -/
def qgcnnGenerator {n a b : ℕ} (G : SimpleGraph (Fin n))
    (W : Fin a → ℝ) (B : Fin b → ℝ) (O : Fin a → Mat Bool) (R : Fin b → Mat Bool) :
    Mat (Qubits n) := by
  classical
  exact (∑ i : Fin n, ∑ j : Fin n, if i < j ∧ G.Adj i j then
    ∑ r : Fin a, (W r : ℂ) • (siteEmbedding i (O r) * siteEmbedding j (O r)) else 0) +
    ∑ v : Fin n, ∑ r : Fin b, (B r : ℂ) • siteEmbedding v (R r)

/-- PDF p.5: a separated term really acts on the requested copy j. -/
example {I : Type*} {k : ℕ} (j : Fin k) (A : Mat I)
    (B : Mat ({c : Fin k // c ≠ j} → I)) (x y : Copies I k) :
    slotFactor j A B x y = A (x j) (y j) *
      B (fun c => x c.1) (fun c => y c.1) := rfl

/-- PDF p.5: multiplying the zero matrix by i does not create a nonzero operator. -/
example {I : Type*} : (0 : Mat I) ∈ timesI ({0} : Set (Mat I)) := by
  exact ⟨0, by simp, by simp⟩

/-- PDF p.15: the identity site permutation is the identity matrix. -/
example (n : ℕ) : sitePermutation (1 : Equiv.Perm (Fin n)) = 1 := by
  ext x y
  rfl

/-- PDF p.16: no intermediate layer leaves the input intact. -/
example {A : ℕ → Type*} (f : ∀ j, A j → A (j+1)) (x : A 0) :
    composeLayers f 0 x = x := rfl

/-- PDF pp.26–27: zero class-0 atom gives zero misclassification posterior. -/
example {Omega : Type*} [MeasurableSpace Omega] (mu0 mu1 : Measure Omega)
    (X : Omega → ℝ) (c : ℝ) (hzero : mu0 {w | X w = c} = 0) :
    posteriorAt mu0 mu1 X c = 0 := by
  simp [posteriorAt, hzero]

end QAlgorithms.Papers.Independent.Advance50.P50
Source
Group-Invariant Quantum Machine Learning, arXiv:2205.02261v2, https://arxiv.org/abs/2205.02261v2
Read-back

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

QAlgorithms.Papers.Independent.Advance50.P50.AncillaModel.effective

For any finite type III with decidable equality and any model consisting of a unitary matrix UUU on {0,1}×I{0,1}\{0,1\}\times I^{\{0,1\}}{0,1}×I{0,1} and a Hermitian Boolean-indexed matrix OOO, this defines its effective matrix by

U†(O⊗id⁡I{0,1})U.U^\dagger\bigl(O\otimes \operatorname{id}_{I^{\{0,1\}}}\bigr)U.U†(O⊗idI{0,1}​)U.

The middle matrix has entry O(b,c)1{x=y}O(b,c)\mathbf 1_{\{x=y\}}O(b,c)1{x=y}​ between indices (b,x)(b,x)(b,x) and (c,y)(c,y)(c,y). No nonemptiness assumption is imposed on III.

QAlgorithms.Papers.Independent.Advance50.P50.AncillaModel

For any finite type III equipped with decidable equality, this structure consists of a unitary complex matrix UUU indexed by {0,1}×I{0,1}\{0,1\}\times I^{\{0,1\}}{0,1}×I{0,1}, together with a complex 2×22\times22×2 matrix OOO indexed by Boolean values and a requirement that OOO be Hermitian. Here I{0,1}I^{\{0,1\}}I{0,1} is the type of ordered pairs of elements of III. There is no bound on OOO, and III is permitted to be empty.

QAlgorithms.Papers.Independent.Advance50.P50.AncillaModel.response

For any finite type III with decidable equality, let MMM consist of a unitary matrix UUU on C{false,true}×I2\mathbb C^{\{\mathrm{false},\mathrm{true}\}\times I^2}C{false,true}×I2 and a Hermitian matrix OOO on C2\mathbb C^2C2, where I2I^2I2 denotes the functions from {0,1}\{0,1\}{0,1} to III. For every complex matrix ρ\rhoρ indexed by III, its response is defined by

M.response(ρ)=Re⁡Tr⁡ ⁣[U(∣false⟩⟨false∣⊗ρ⊗2)U†(O⊗II2)],(ρ⊗2)x,y=ρx(0),y(0)ρx(1),y(1).M.\mathrm{response}(\rho) =\operatorname{Re}\operatorname{Tr}\!\left[ U\bigl(|\mathrm{false}\rangle\langle\mathrm{false}|\otimes\rho^{\otimes2}\bigr) U^\dagger(O\otimes I_{I^2})\right], \qquad (\rho^{\otimes2})_{x,y}=\rho_{x(0),y(0)}\rho_{x(1),y(1)}.M.response(ρ)=ReTr[U(∣false⟩⟨false∣⊗ρ⊗2)U†(O⊗II2​)],(ρ⊗2)x,y​=ρx(0),y(0)​ρx(1),y(1)​.

Here ∣false⟩|\mathrm{false}\rangle∣false⟩ is the corresponding coordinate unit vector. The argument ρ\rhoρ need not be positive or have trace one; the definition also includes empty III, for which the trace is zero.

QAlgorithms.Papers.Independent.Advance50.P50.DatasetSymmetry

For any finite index type III, any sets G,RG,RG,R of complex matrices indexed by I×II\times II×I, and any Boolean-valued function ℓ\ellℓ on such matrices, this defines the proposition that every ρ∈R\rho\in Rρ∈R is positive semidefinite with complex trace equal to 111, and that

∀V∈G, ∀ρ∈R,VρV†∈Randℓ(VρV†)=ℓ(ρ).\forall V\in G,\ \forall \rho\in R,\qquad V\rho V^\dagger\in R \quad\text{and}\quad \ell(V\rho V^\dagger)=\ell(\rho).∀V∈G, ∀ρ∈R,VρV†∈Randℓ(VρV†)=ℓ(ρ).

No separate unitarity assumption is imposed on GGG. If RRR is empty, the whole proposition is vacuous; if III is empty, the trace requirement forces RRR to be empty.

QAlgorithms.Papers.Independent.Advance50.P50.DomainInvariant

For any finite index type III, any sets G,RG,RG,R of complex matrices indexed by I×II\times II×I, and any function hhh from such matrices to R\mathbb RR, this defines the proposition

∀V∈G, ∀ρ∈R,h(VρV†)=h(ρ).\forall V\in G,\ \forall \rho\in R,\qquad h(V\rho V^\dagger)=h(\rho).∀V∈G, ∀ρ∈R,h(VρV†)=h(ρ).

The sets GGG and RRR are arbitrary: their elements need not be unitary matrices or density matrices, respectively. This proposition imposes no requirement that VρV†V\rho V^\daggerVρV† belong to RRR, and is vacuously true if either set is empty.

QAlgorithms.Papers.Independent.Advance50.P50.EntanglementMeasure

For any natural number nnn, an entanglement measure consists of a real-valued function EEE on all complex matrices indexed by nnn-bit strings, together with these requirements: whenever ρ=vv†\rho=vv^\daggerρ=vv† for a Euclidean unit vector vvv, one has 0≤E(ρ)≤10\le E(\rho)\le10≤E(ρ)≤1; for every such ρ\rhoρ and every matrix VVV whose entries have the form Vy,z=∏j=0n−1(Uj)yj,zjV_{y,z}=\prod_{j=0}^{n-1}(U_j)_{y_j,z_j}Vy,z​=∏j=0n−1​(Uj​)yj​,zj​​ for independently chosen two-by-two unitary matrices UjU_jUj​, one has E(VρV†)=E(ρ)E(V\rho V^\dagger)=E(\rho)E(VρV†)=E(ρ); and, for every such ρ\rhoρ, E(ρ)=0E(\rho)=0E(ρ)=0 if and only if there are unit vectors ψj∈C2\psi_j\in\mathbb C^2ψj​∈C2 with ρy,z=∏jψj(yj) ∏jψj(zj)‾\rho_{y,z}=\prod_j\psi_j(y_j)\,\overline{\prod_j\psi_j(z_j)}ρy,z​=∏j​ψj​(yj​)∏j​ψj​(zj​)​. These conditions impose no requirements on the function at matrices that are not unit-vector outer products. The definition includes n=0n=0n=0, when the sole unit-vector outer product is the one-by-one matrix [1][1][1], whose value must be 000.

QAlgorithms.Papers.Independent.Advance50.P50.ExpectationModel.effective

For any finite index type III with decidable equality, any natural number kkk, and any expectation model MMM consisting of a unitary matrix UUU and a Hermitian matrix OOO, both indexed by functions {0,…,k−1}→I\{0,\ldots,k-1\}\to I{0,…,k−1}→I, this defines its effective matrix as

Meff=U†OU.M_{\mathrm{eff}}=U^\dagger O U.Meff​=U†OU.

Here †\dagger† denotes conjugate transpose; k=0k=0k=0 and an empty III are permitted.

QAlgorithms.Papers.Independent.Advance50.P50.ExpectationModel

For any finite index type III with decidable equality and any natural number kkk, an expectation model consists of a unitary complex matrix UUU indexed by functions {0,…,k−1}→I\{0,\ldots,k-1\}\to I{0,…,k−1}→I, a complex matrix OOO on the same indexing set, and the requirement that OOO is Hermitian, meaning O†=OO^\dagger=OO†=O. There is no bound imposed on OOO. The parameters include k=0k=0k=0, when these matrices are 1×11\times11×1, and III is allowed to be empty.

QAlgorithms.Papers.Independent.Advance50.P50.ExpectationModel.response

For any finite index type III with decidable equality, any natural number kkk, any expectation model MMM consisting of a unitary matrix UUU and a Hermitian matrix OOO indexed by functions {0,…,k−1}→I\{0,\ldots,k-1\}\to I{0,…,k−1}→I, and any complex matrix ρ\rhoρ indexed by I×II\times II×I, this defines the real response

Mresponse(ρ)=Re⁡tr⁡ ⁣(UTU†O),Tx,y=∏c=0k−1ρx(c),y(c).M_{\mathrm{response}}(\rho) =\operatorname{Re}\operatorname{tr}\!\left(U T U^\dagger O\right), \qquad T_{x,y}=\prod_{c=0}^{k-1}\rho_{x(c),y(c)}.Mresponse​(ρ)=Retr(UTU†O),Tx,y​=c=0∏k−1​ρx(c),y(c)​.

No positivity or trace condition is imposed on ρ\rhoρ. When k=0k=0k=0, T=[1]T=[1]T=[1], independently of ρ\rhoρ; an empty III is also allowed.

QAlgorithms.Papers.Independent.Advance50.P50.FullyProduct

For any natural number nnn and any complex matrix ρ\rhoρ indexed by nnn-bit strings, ρ\rhoρ is fully product precisely when there exist vectors ψj∈C{false,true}\psi_j\in\mathbb C^{\{\mathrm{false},\mathrm{true}\}}ψj​∈C{false,true}, one for every 0≤j<n0\le j<n0≤j<n, each of Euclidean norm 111, such that

ρy,z=(∏j=0n−1ψj(yj))(∏j=0n−1ψj(zj))‾\rho_{y,z}=\left(\prod_{j=0}^{n-1}\psi_j(y_j)\right) \overline{\left(\prod_{j=0}^{n-1}\psi_j(z_j)\right)}ρy,z​=(j=0∏n−1​ψj​(yj​))(j=0∏n−1​ψj​(zj​))​

for all nnn-bit strings y,zy,zy,z. This includes n=0n=0n=0: the empty products equal 111, so the sole matrix entry must be 111.

QAlgorithms.Papers.Independent.Advance50.P50.LocallyEquivalent

For arbitrary complex matrices U,VU,VU,V indexed by three-bit strings, this predicate means that there exist unitary 2×22\times22×2 matrices A,CA,CA,C and unitary 4×44\times44×4 matrices B,DB,DB,D such that

V=(A⊗B) U (C⊗D),V=(A\otimes B)\,U\,(C\otimes D),V=(A⊗B)U(C⊗D),

where each three-bit string is identified with its first bit and its remaining two bits, so that, explicitly, (A⊗B)x,y=Ax0,y0B(x1,x2),(y1,y2)(A\otimes B)_{x,y}=A_{x_0,y_0}B_{(x_1,x_2),(y_1,y_2)}(A⊗B)x,y​=Ax0​,y0​​B(x1​,x2​),(y1​,y2​)​, and similarly for C⊗DC\otimes DC⊗D. No unitarity assumption is imposed on UUU or VVV.

QAlgorithms.Papers.Independent.Advance50.P50.MatrixLieData

For any finite index type III with decidable equality, matrix Lie data consist of a subgroup GGG of the unitary complex matrices indexed by I×II\times II×I, a real Lie subalgebra g\mathfrak gg of those complex matrices, and two requirements: first, the underlying set of g\mathfrak gg equals the set of all derivatives c′(0)c'(0)c′(0) of curves c:R→CI×Ic:\mathbb R\to\mathbb C^{I\times I}c:R→CI×I with c(0)=1c(0)=1c(0)=1 whose value at every real parameter is the underlying matrix of an element of GGG; second, every X∈gX\in\mathfrak gX∈g satisfies X†=−XX^\dagger=-XX†=−X. Here a real Lie subalgebra is a real vector subspace closed under the commutator [X,Y]=XY−YX[X,Y]=XY-YX[X,Y]=XY−YX. An empty III is allowed.

QAlgorithms.Papers.Independent.Advance50.P50.SeparatesPurity

For any finite type III, real number bbb, and function h:CI×I→Rh:\mathbb C^{I\times I}\to\mathbb Rh:CI×I→R, this is the proposition that every pair of positive semidefinite, trace-one matrices ρ,σ\rho,\sigmaρ,σ satisfying

Re⁡tr⁡(ρ2)=1,Re⁡tr⁡(σ2)=b\operatorname{Re}\operatorname{tr}(\rho^2)=1, \qquad \operatorname{Re}\operatorname{tr}(\sigma^2)=bRetr(ρ2)=1,Retr(σ2)=b

has h(ρ)≠h(σ)h(\rho)\ne h(\sigma)h(ρ)=h(σ). No ordering or quantitative gap between these values is required. The proposition is vacuous if either required class of matrices is empty, including when III is empty; if III is nonempty and b=1b=1b=1, choosing the same pure density matrix for both variables makes the proposition impossible.

QAlgorithms.Papers.Independent.Advance50.P50.ancillaRealignment

For every complex matrix UUU indexed by three-bit strings, define a rectangular matrix R(U)R(U)R(U) with rows indexed by Boolean pairs (a0,a1)(a_0,a_1)(a0​,a1​) and columns indexed by pairs (u,v)(u,v)(u,v) of two-bit strings by

R(U)(a0,a1),(u,v)=U(a0,u(0),u(1)), (a1,v(0),v(1)).R(U)_{(a_0,a_1),(u,v)} =U_{(a_0,u(0),u(1)),\,(a_1,v(0),v(1))}.R(U)(a0​,a1​),(u,v)​=U(a0​,u(0),u(1)),(a1​,v(0),v(1))​.

Thus the definition rearranges the entries of UUU, putting its first row and column bits together in the row index, and its remaining row and column bits together in the column index.

QAlgorithms.Papers.Independent.Advance50.P50.circuit1

Let H=12(111−1)H=\frac1{\sqrt2}\left(\begin{smallmatrix}1&1\\1&-1\end{smallmatrix}\right)H=2​1​(11​1−1​) and T=diag⁡(1,eiπ/4)T=\operatorname{diag}(1,e^{i\pi/4})T=diag(1,eiπ/4), with Boolean coordinates ordered false, true. For any Boolean-indexed matrix AAA, write AjA_jAj​ for the three-bit matrix whose (y,x)(y,x)(y,x) entry is Ay(j),x(j)A_{y(j),x(j)}Ay(j),x(j)​ if yyy and xxx agree at every other bit, and zero otherwise; write Cc,tC_{c,t}Cc,t​ for the matrix with entry one precisely when yyy is obtained from xxx by replacing bit ttt with x(t)⊕x(c)x(t)\oplus x(c)x(t)⊕x(c), and zero otherwise. The defined matrix is the product of the following list in reverse order, so its first listed factor acts first:

[H0,C1,2,H1,C1,2,(T†)2,C0,2,T2,C1,2,(T†)2,C0,2,T1,C0,1,T0,(T†)1,C0,1,H0].[H_0,C_{1,2},H_1,C_{1,2},(T^\dagger)_2,C_{0,2}, T_2,C_{1,2},(T^\dagger)_2,C_{0,2},T_1,C_{0,1}, T_0,(T^\dagger)_1,C_{0,1},H_0].[H0​,C1,2​,H1​,C1,2​,(T†)2​,C0,2​,T2​,C1,2​,(T†)2​,C0,2​,T1​,C0,1​,T0​,(T†)1​,C0,1​,H0​].

QAlgorithms.Papers.Independent.Advance50.P50.circuit2

Let H=12(111−1)H=\frac1{\sqrt2}\left(\begin{smallmatrix}1&1\\1&-1\end{smallmatrix}\right)H=2​1​(11​1−1​), T=diag⁡(1,eiπ/4)T=\operatorname{diag}(1,e^{i\pi/4})T=diag(1,eiπ/4), and W=T†HW=T^\dagger HW=T†H, using Boolean order false, true. For a Boolean-indexed matrix AAA, let (Aj)y,x=Ay(j),x(j)(A_j)_{y,x}=A_{y(j),x(j)}(Aj​)y,x​=Ay(j),x(j)​ when the three-bit strings y,xy,xy,x agree away from jjj, and zero otherwise. Let (Cc,t)y,x=1(C_{c,t})_{y,x}=1(Cc,t​)y,x​=1 exactly when yyy is xxx with bit ttt replaced by x(t)⊕x(c)x(t)\oplus x(c)x(t)⊕x(c), and zero otherwise. The defined matrix is the product of the following list in reverse order, with the first listed matrix acting first:

[W0,C1,2,C2,0,(W†)0,C0,1,W0,C2,0,(W†)0].[W_0,C_{1,2},C_{2,0},(W^\dagger)_0,C_{0,1}, W_0,C_{2,0},(W^\dagger)_0].[W0​,C1,2​,C2,0​,(W†)0​,C0,1​,W0​,C2,0​,(W†)0​].

QAlgorithms.Papers.Independent.Advance50.P50.circuitW

With Boolean coordinates ordered false, true, this definition sets

W=T†H,T=(100eiπ/4),H=12(111−1).W=T^\dagger H,\qquad T=\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}, \qquad H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}.W=T†H,T=(10​0eiπ/4​),H=2​1​(11​1−1​).

Thus WWW is the matrix product with HHH on the right and the conjugate transpose of TTT on the left.

QAlgorithms.Papers.Independent.Advance50.P50.cnot3

For any two indices c,t∈{0,1,2}c,t\in\{0,1,2\}c,t∈{0,1,2}, define a complex matrix indexed by three-bit strings by

(Cc,t)y,x={1,y(j)=x(j) for every j≠t, and y(t)=x(t)⊕x(c),0,otherwise,(C_{c,t})_{y,x}= \begin{cases} 1,&y(j)=x(j)\text{ for every }j\ne t,\ \text{and }y(t)=x(t)\mathbin{\oplus}x(c),\\ 0,&\text{otherwise}, \end{cases}(Cc,t​)y,x​={1,0,​y(j)=x(j) for every j=t, and y(t)=x(t)⊕x(c),otherwise,​

where ⊕\oplus⊕ is Boolean exclusive-or. The indices c,tc,tc,t are allowed to coincide; in that case the designated output bit is always false.

QAlgorithms.Papers.Independent.Advance50.P50.collectiveSpan

For every natural number nnn, this is the complex linear span of the matrices obtained by applying the same two-by-two unitary matrix at every site. Explicitly, it consists of all finite complex linear combinations of matrices TTT of the form

Tx,y=∏j=0n−1Axj,yj,A∈U(2),T_{x,y}=\prod_{j=0}^{n-1}A_{x_j,y_j}, \qquad A\in U(2),Tx,y​=j=0∏n−1​Axj​,yj​​,A∈U(2),

with x,yx,yx,y ranging over nnn-bit strings; each summand may use a different unitary AAA. When n=0n=0n=0, every generating matrix is [1][1][1], so the span is the entire space of one-by-one complex matrices.

QAlgorithms.Papers.Independent.Advance50.P50.composeLayers

For any sequence of types A0,A1,…A_0,A_1,\ldotsA0​,A1​,… and functions fj:Aj→Aj+1f_j:A_j\to A_{j+1}fj​:Aj​→Aj+1​ for every natural number jjj, this defines functions Cm:A0→AmC_m:A_0\to A_mCm​:A0​→Am​ recursively by C0=id⁡A0C_0=\operatorname{id}_{A_0}C0​=idA0​​ and Cm+1=fm∘CmC_{m+1}=f_m\circ C_mCm+1​=fm​∘Cm​. Thus Cm=fm−1∘⋯∘f0C_m=f_{m-1}\circ\cdots\circ f_0Cm​=fm−1​∘⋯∘f0​ for m>0m>0m>0, while zero layers give the identity.

QAlgorithms.Papers.Independent.Advance50.P50.concentratableObservable

For any natural number nnn and any finite set Q⊆{0,…,n−1}Q\subseteq\{0,\ldots,n-1\}Q⊆{0,…,n−1}, this defines the matrix

CQ=I−2−∣Q∣∏j∈Q(I+Sj)C_Q=I-2^{-|Q|}\prod_{j\in Q}(I+S_j)CQ​=I−2−∣Q∣j∈Q∏​(I+Sj​)

on two copies of the space indexed by nnn-bit strings, where SjS_jSj​ exchanges the two copies’ bits at site jjj and fixes all other bits. More explicitly, for two-copy strings x,yx,yx,y, its entry is

(CQ)y,x=1y=x−2−∣Q∣∏j=0n−1{1yj(0)=xj(0)1yj(1)=xj(1)+1yj(0)=xj(1)1yj(1)=xj(0),j∈Q,1yj(0)=xj(0)1yj(1)=xj(1),j∉Q.(C_Q)_{y,x} =\mathbf1_{y=x}-2^{-|Q|} \prod_{j=0}^{n-1} \begin{cases} \mathbf1_{y^{(0)}_j=x^{(0)}_j}\mathbf1_{y^{(1)}_j=x^{(1)}_j} +\mathbf1_{y^{(0)}_j=x^{(1)}_j}\mathbf1_{y^{(1)}_j=x^{(0)}_j},&j\in Q,\\ \mathbf1_{y^{(0)}_j=x^{(0)}_j}\mathbf1_{y^{(1)}_j=x^{(1)}_j},&j\notin Q. \end{cases}(CQ​)y,x​=1y=x​−2−∣Q∣j=0∏n−1​⎩⎨⎧​1yj(0)​=xj(0)​​1yj(1)​=xj(1)​​+1yj(0)​=xj(1)​​1yj(1)​=xj(0)​​,1yj(0)​=xj(0)​​1yj(1)​=xj(1)​​,​j∈Q,j∈/Q.​

Here 1\mathbf11 denotes a 000–111 indicator. The empty set is allowed and gives C∅=0C_\varnothing=0C∅​=0, including when n=0n=0n=0.

QAlgorithms.Papers.Independent.Advance50.P50.copySwap

For any type III with decidable equality, this defines a complex matrix indexed by pairs x,y∈I2x,y\in I^2x,y∈I2, with row yyy and column xxx, whose entry is

Sy,x={1,y0=x1 and y1=x0,0,otherwise.S_{y,x}= \begin{cases} 1,&y_0=x_1\ \text{and}\ y_1=x_0,\\ 0,&\text{otherwise}. \end{cases}Sy,x​={1,0,​y0​=x1​ and y1​=x0​,otherwise.​

No finiteness or nonemptiness assumption on III is required; if III is empty, the matrix has an empty index set.

QAlgorithms.Papers.Independent.Advance50.P50.entanglementDomain

For any natural number nnn, any entanglement measure EEE on matrices indexed by nnn-bit strings, and any real number bbb, this domain is

{ρ: ρ=vv† for some ∥v∥2=1,E(ρ)=0 or E(ρ)=b}.\{\rho:\ \rho=vv^\dagger\text{ for some }\|v\|_2=1,\quad E(\rho)=0\ \text{or}\ E(\rho)=b\}.{ρ: ρ=vv† for some ∥v∥2​=1,E(ρ)=0 or E(ρ)=b}.

Here the assumed measure takes values in [0,1][0,1][0,1] on such unit-vector outer products, is invariant under conjugation by matrices with entries ∏j(Uj)yj,zj\prod_j(U_j)_{y_j,z_j}∏j​(Uj​)yj​,zj​​ for arbitrary two-by-two unitaries UjU_jUj​, and vanishes on these outer products exactly when vvv can be replaced by a vector with amplitudes ∏jψj(yj)\prod_j\psi_j(y_j)∏j​ψj​(yj​) for unit vectors ψj∈C2\psi_j\in\mathbb C^2ψj​∈C2. There is no restriction on bbb: if b=0b=0b=0 or b∉[0,1]b\notin[0,1]b∈/[0,1], the domain consists exactly of these product outer products. For n=0n=0n=0, the domain is {[1]}\{[1]\}{[1]} for every bbb.

QAlgorithms.Papers.Independent.Advance50.P50.globalImpurityObservable

For every natural number nnn, this defines a matrix on two copies of the space indexed by nnn-bit strings by

On=2n∑j=0n−1(I−Sj),O_n=\frac{2}{n}\sum_{j=0}^{n-1}(I-S_j),On​=n2​j=0∑n−1​(I−Sj​),

where SjS_jSj​ exchanges the bits at site jjj between the two copies and leaves every other bit unchanged: its entry from (x(0),x(1))(x^{(0)},x^{(1)})(x(0),x(1)) to (y(0),y(1))(y^{(0)},y^{(1)})(y(0),y(1)) is 111 exactly when yj(0)=xj(1)y^{(0)}_j=x^{(1)}_jyj(0)​=xj(1)​, yj(1)=xj(0)y^{(1)}_j=x^{(0)}_jyj(1)​=xj(0)​, and yℓ(c)=xℓ(c)y^{(c)}_\ell=x^{(c)}_\ellyℓ(c)​=xℓ(c)​ for both copies ccc and all ℓ≠j\ell\ne jℓ=j, and is 000 otherwise. The scalar division is complex division. In particular, n=0n=0n=0 is allowed; division by zero and the empty sum both evaluate to zero, so O0=0O_0=0O0​=0.

QAlgorithms.Papers.Independent.Advance50.P50.graphEncoding

For every natural number nnn, simple graph GGG on nnn sites, real number ttt, and arbitrary complex matrix ρ\rhoρ indexed by nnn-bit configurations, this defines

EG,t(ρ)=e−itHGρ(e−itHG)†,HG=∑i<jG has edge {i,j}ZiZj+∑iXi,\mathcal E_{G,t}(\rho)=e^{-itH_G}\rho\bigl(e^{-itH_G}\bigr)^\dagger,\qquad H_G=\sum_{\substack{i<j\\G\text{ has edge }\{i,j\}}}Z_iZ_j+\sum_iX_i,EG,t​(ρ)=e−itHG​ρ(e−itHG​)†,HG​=i<jG has edge {i,j}​∑​Zi​Zj​+i∑​Xi​,

where Z=diag⁡(1,−1)Z=\operatorname{diag}(1,-1)Z=diag(1,−1), X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), and Mi(x,y)=M(xi,yi)∏ℓ≠i1{xℓ=yℓ}M_i(x,y)=M(x_i,y_i)\prod_{\ell\ne i}\mathbf 1_{\{x_\ell=y_\ell\}}Mi​(x,y)=M(xi​,yi​)∏ℓ=i​1{xℓ​=yℓ​}​. No density-matrix assumption is imposed on ρ\rhoρ, and ttt may be any real number. For n=0n=0n=0, this map returns ρ\rhoρ.

QAlgorithms.Papers.Independent.Advance50.P50.graphEvolution

For every natural number nnn, simple graph GGG on nnn sites, and real number ttt, this defines

UG(t)=exp⁡ ⁣(−it[∑i<jG has edge {i,j}ZiZj+∑iXi]),U_G(t)=\exp\!\left(-it\left[\sum_{\substack{i<j\\G\text{ has edge }\{i,j\}}}Z_iZ_j+\sum_iX_i\right]\right),UG​(t)=exp​−it​i<jG has edge {i,j}​∑​Zi​Zj​+i∑​Xi​​​,

where the exponential is the matrix exponential, Z=diag⁡(1,−1)Z=\operatorname{diag}(1,-1)Z=diag(1,−1), X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), and Mi(x,y)=M(xi,yi)∏ℓ≠i1{xℓ=yℓ}M_i(x,y)=M(x_i,y_i)\prod_{\ell\ne i}\mathbf 1_{\{x_\ell=y_\ell\}}Mi​(x,y)=M(xi​,yi​)∏ℓ=i​1{xℓ​=yℓ​}​ on nnn-bit configurations. There is no restriction on ttt; for n=0n=0n=0, the exponent is zero and the result is the identity matrix.

QAlgorithms.Papers.Independent.Advance50.P50.graphHamiltonian

For every natural number nnn, including 000, and every simple graph GGG on {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}, this defines the complex matrix

HG=∑i<jG has edge {i,j}ZiZj+∑i=0n−1XiH_G=\sum_{\substack{i<j\\G\text{ has edge }\{i,j\}}}Z_iZ_j+\sum_{i=0}^{n-1}X_iHG​=i<jG has edge {i,j}​∑​Zi​Zj​+i=0∑n−1​Xi​

on nnn-bit configurations, where Z=diag⁡(1,−1)Z=\operatorname{diag}(1,-1)Z=diag(1,−1), X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), and Mi(x,y)=M(xi,yi)∏ℓ≠i1{xℓ=yℓ}M_i(x,y)=M(x_i,y_i)\prod_{\ell\ne i}\mathbf 1_{\{x_\ell=y_\ell\}}Mi​(x,y)=M(xi​,yi​)∏ℓ=i​1{xℓ​=yℓ​}​ for either local matrix MMM. Each edge is included once, using i<ji<ji<j. When n=0n=0n=0, both sums are empty and HG=0H_G=0HG​=0.

QAlgorithms.Papers.Independent.Advance50.P50.groupMatrices

For any finite index type III with decidable equality and any subgroup GGG of the group of unitary complex matrices indexed by I×II\times II×I, this defines the set of complex matrices

{V:∃u∈G, the underlying matrix of u equals V}.\{V:\exists u\in G,\ \text{the underlying matrix of }u\text{ equals }V\}.{V:∃u∈G, the underlying matrix of u equals V}.

Thus membership records precisely that the matrix arises from an element of the specified subgroup. The index type III may be empty.

QAlgorithms.Papers.Independent.Advance50.P50.haarOutput

For every natural number nnn, arbitrary complex matrices ρ,O\rho,Oρ,O indexed by nnn-bit strings, and unitary matrix uuu indexed by {0,…,2n−1}\{0,\ldots,2^n-1\}{0,…,2n−1}, encode a bit string xxx as

b(x)=∑j=0n−11{xj=true} 2n−1−j,Vx,y=ub(x),b(y).b(x)=\sum_{j=0}^{n-1}\mathbf1_{\{x_j=\mathrm{true}\}}\,2^{n-1-j}, \qquad V_{x,y}=u_{b(x),b(y)}.b(x)=j=0∑n−1​1{xj​=true}​2n−1−j,Vx,y​=ub(x),b(y)​.

The definition returns

Re⁡tr⁡(O VρV†).\operatorname{Re}\operatorname{tr}(O\,V\rho V^\dagger).Retr(OVρV†).

No positivity, normalization, or Hermiticity assumptions are imposed on ρ\rhoρ or OOO. The case n=0n=0n=0 is included: there is one empty bit string, its encoding is 000, and the matrices have size 1×11\times11×1.

QAlgorithms.Papers.Independent.Advance50.P50.inputLieSpace

For any finite type III with decidable equality, matrix Lie data LLL, and Boolean parameter bbb, this defines a set of complex matrices indexed by III. The data LLL consist of a subgroup GGG of the unitary matrices and a real Lie subalgebra g\mathfrak gg whose underlying set is exactly the derivatives c′(0)c'(0)c′(0) of differentiable-at-zero curves c:R→CI×Ic:\mathbb R\to\mathbb C^{I\times I}c:R→CI×I satisfying c(0)=1c(0)=1c(0)=1 and c(t)∈Gc(t)\in Gc(t)∈G for every real ttt, together with the requirement X†=−XX^\dagger=-XX†=−X for every X∈gX\in\mathfrak gX∈g. If bbb is false, the defined set is g\mathfrak gg; if bbb is true, it is

{X:X†=−X and tr⁡(X†Y)=0 for every Y∈g},\left\{X:X^\dagger=-X\ \text{and}\ \operatorname{tr}(X^\dagger Y)=0\ \text{for every }Y\in\mathfrak g\right\},{X:X†=−X and tr(X†Y)=0 for every Y∈g},

where the trace equality is an equality of complex numbers.

QAlgorithms.Papers.Independent.Advance50.P50.lieComplement

For any finite index type III with decidable equality and matrix Lie data LLL, write GGG for its unitary subgroup and g\mathfrak gg for its real Lie subalgebra: its underlying set is exactly the derivatives at 000 of real curves through the identity taking values in GGG for every real parameter, and each of its elements is skew-Hermitian. This defines the set

{X∈CI×I:X†=−X and ∀Y∈g, tr⁡(X†Y)=0}.\left\{X\in\mathbb C^{I\times I}: X^\dagger=-X \ \text{and}\ \forall Y\in\mathfrak g,\ \operatorname{tr}(X^\dagger Y)=0 \right\}.{X∈CI×I:X†=−X and ∀Y∈g, tr(X†Y)=0}.

The trace equality is an equality in C\mathbb CC. An empty III is permitted.

QAlgorithms.Papers.Independent.Advance50.P50.localPermutation

For natural numbers n,kn,kn,k and a family of permutations pjp_jpj​ of {0,…,k−1}\{0,\ldots,k-1\}{0,…,k−1}, one for each site 0≤j<n0\le j<n0≤j<n, this defines a complex matrix indexed by kkk-tuples of nnn-bit strings. Its row-yyy, column-xxx entry is 111 precisely when

yc(j)=xpj−1(c)(j)for every copy c and site j,y_c(j)=x_{p_j^{-1}(c)}(j) \quad\text{for every copy }c\text{ and site }j,yc​(j)=xpj−1​(c)​(j)for every copy c and site j,

and is 000 otherwise. Both n=0n=0n=0 and k=0k=0k=0 are allowed; in either case the matrix index set has one element and the matrix is the identity.

QAlgorithms.Papers.Independent.Advance50.P50.localUnitaryMatrices

For every natural number nnn, this defines the set of complex matrices VVV indexed by nnn-bit strings for which there exists a family of 2×22\times22×2 unitary matrices uju_juj​, indexed by sites 0≤j<n0\le j<n0≤j<n, such that

Vx,y=∏j=0n−1(uj)xj,yjfor all x,y∈{0,1}n.V_{x,y}=\prod_{j=0}^{n-1}(u_j)_{x_j,y_j} \quad\text{for all }x,y\in\{0,1\}^n.Vx,y​=j=0∏n−1​(uj​)xj​,yj​​for all x,y∈{0,1}n.

For n=0n=0n=0, the product is empty and equals 111, so the set contains exactly the identity matrix on the single empty bit string.

QAlgorithms.Papers.Independent.Advance50.P50.operatorSchmidtRank

For every complex matrix UUU indexed by three-bit strings, form the 4×164\times164×16 matrix

R(U)(a0,a1),(u,v)=U(a0,u(0),u(1)), (a1,v(0),v(1)),R(U)_{(a_0,a_1),(u,v)} =U_{(a_0,u(0),u(1)),\,(a_1,v(0),v(1))},R(U)(a0​,a1​),(u,v)​=U(a0​,u(0),u(1)),(a1​,v(0),v(1))​,

where a0,a1a_0,a_1a0​,a1​ are Boolean values and u,vu,vu,v are two-bit strings. The defined natural number is the complex dimension of the range of the linear map represented by R(U)R(U)R(U), equivalently its matrix rank. This definition applies to arbitrary UUU, including the zero matrix, whose defined rank is zero.

QAlgorithms.Papers.Independent.Advance50.P50.orthogonalMatrices

For every natural number nnn, this defines the set of complex matrices VVV indexed by nnn-bit strings that are unitary and have entirely real entries:

V†V=VV†=1,Im⁡Vx,y=0for every x,y∈{0,1}n.V^\dagger V=VV^\dagger=1, \qquad \operatorname{Im}V_{x,y}=0 \quad\text{for every }x,y\in\{0,1\}^n.V†V=VV†=1,ImVx,y​=0for every x,y∈{0,1}n.

For n=0n=0n=0, there is one empty bit string, and the set consists of the one-entry matrices 111 and −1-1−1.

QAlgorithms.Papers.Independent.Advance50.P50.pairedSiteProduct

For any natural number nnn and family FjF_jFj​ of complex matrices indexed by pairs of Boolean values, this defines a complex matrix indexed by pairs x=(x0,x1)x=(x_0,x_1)x=(x0​,x1​), y=(y0,y1)y=(y_0,y_1)y=(y0​,y1​) of nnn-bit strings, with entries

∏j=0n−1(Fj)(x0(j),x1(j)), (y0(j),y1(j)).\prod_{j=0}^{n-1} (F_j)_{(x_0(j),x_1(j)),\,(y_0(j),y_1(j))}.j=0∏n−1​(Fj​)(x0​(j),x1​(j)),(y0​(j),y1​(j))​.

No Hermitian, positivity, or unitarity condition is imposed on the factors. For n=0n=0n=0, the empty product is 111, giving the identity on the single pair of empty bit strings.

QAlgorithms.Papers.Independent.Advance50.P50.posteriorAt

For any measurable space Ω\OmegaΩ, any measures μ0,μ1\mu_0,\mu_1μ0​,μ1​ on it, any function X:Ω→RX:\Omega\to\mathbb RX:Ω→R, and any c∈Rc\in\mathbb Rc∈R, this definition assigns the real number

(μ0{w:X(w)=c})R(μ0{w:X(w)=c})R+(μ1{w:X(w)=c})R,\frac{\bigl(\mu_0\{w:X(w)=c\}\bigr)_{\mathbb R}} {\bigl(\mu_0\{w:X(w)=c\}\bigr)_{\mathbb R} +\bigl(\mu_1\{w:X(w)=c\}\bigr)_{\mathbb R}},(μ0​{w:X(w)=c})R​+(μ1​{w:X(w)=c})R​(μ0​{w:X(w)=c})R​​,

where the subscript denotes conversion from an extended nonnegative real to a real, sending +∞+\infty+∞ to 000. Neither probability normalization nor measurability of XXX is required by the definition; the measures are evaluated on the indicated set even if it is not measurable. Real division by zero is defined to give 000, so the displayed expression also specifies the value when its denominator vanishes.

QAlgorithms.Papers.Independent.Advance50.P50.printedBell

For every natural number nnn, let Qn={0,1}{0,…,n−1}Q_n=\{0,1\}^{\{0,\ldots,n-1\}}Qn​={0,1}{0,…,n−1}. This defines a vector in the complex Euclidean space indexed by two copies of QnQ_nQn​, with amplitude

ψ(x0,x1)={2−n,x0=x1,0,x0≠x1.\psi(x_0,x_1)= \begin{cases} 2^{-n},&x_0=x_1,\\ 0,&x_0\ne x_1. \end{cases}ψ(x0​,x1​)={2−n,0,​x0​=x1​,x0​=x1​.​

There are 2n2^n2n nonzero amplitudes, so its squared norm is 2−n2^{-n}2−n. For n=0n=0n=0, the index set has one element and its amplitude is 111.

QAlgorithms.Papers.Independent.Advance50.P50.purityDomain

For any finite type III and arbitrary real number bbb, this defines the set of complex matrices ρ\rhoρ indexed by III that are positive semidefinite, have complex trace 111, and satisfy

Re⁡tr⁡(ρ2)=1orRe⁡tr⁡(ρ2)=b.\operatorname{Re}\operatorname{tr}(\rho^2)=1 \quad\text{or}\quad \operatorname{Re}\operatorname{tr}(\rho^2)=b.Retr(ρ2)=1orRetr(ρ2)=b.

There is no restriction on bbb; for b=1b=1b=1 the two alternatives coincide. If III is empty, the trace-one requirement makes the set empty.

QAlgorithms.Papers.Independent.Advance50.P50.qgcnnGenerator

For arbitrary natural numbers n,a,bn,a,bn,a,b, a simple graph GGG on vertices {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}, real coefficients WrW_rWr​ for 0≤r<a0\le r<a0≤r<a and BrB_rBr​ for 0≤r<b0\le r<b0≤r<b, and arbitrary complex 2×22\times22×2 matrices Or,RrO_r,R_rOr​,Rr​ indexed by Boolean values, define the matrix M(i)M^{(i)}M(i) indexed by nnn-bit strings by

Mx,y(i)=Mxi,yi∏0≤j<nj≠i1{xj=yj}.M^{(i)}_{x,y}=M_{x_i,y_i}\prod_{\substack{0\le j<n\\j\ne i}}\mathbf1_{\{x_j=y_j\}}.Mx,y(i)​=Mxi​,yi​​0≤j<nj=i​∏​1{xj​=yj​}​.

The declared generator is the complex matrix

∑0≤i<j<nG has edge {i,j} ∑r=0a−1Wr Or(i)Or(j)+∑v=0n−1∑r=0b−1Br Rr(v).\sum_{\substack{0\le i<j<n\\G\text{ has edge }\{i,j\}}} \ \sum_{r=0}^{a-1}W_r\,O_r^{(i)}O_r^{(j)} + \sum_{v=0}^{n-1}\sum_{r=0}^{b-1}B_r\,R_r^{(v)}.0≤i<j<nG has edge {i,j}​∑​ r=0∑a−1​Wr​Or(i)​Or(j)​+v=0∑n−1​r=0∑b−1​Br​Rr(v)​.

No Hermiticity assumptions are part of this definition. Empty sums are zero, so a=0a=0a=0 or b=0b=0b=0 removes the corresponding contribution, and n=0n=0n=0 gives the zero 1×11\times11×1 matrix.

QAlgorithms.Papers.Independent.Advance50.P50.runGates

For every finite list of complex matrices indexed by three-bit strings, define its result recursively: the empty list gives the identity matrix, and a list with first matrix ggg and remaining list LLL gives runGates(L)g\mathrm{runGates}(L)grunGates(L)g. Thus a list [g1,…,gℓ][g_1,\ldots,g_\ell][g1​,…,gℓ​] gives gℓ⋯g1g_\ell\cdots g_1gℓ​⋯g1​, including the identity when ℓ=0\ell=0ℓ=0. No unitarity hypothesis is imposed on the matrices.

QAlgorithms.Papers.Independent.Advance50.P50.separatedSpan

For any type III, natural number kkk, family of complex matrices AjA_jAj​ indexed by III, and family of complex matrices BjB_jBj​ indexed by tuples in I{0,…,k−1}∖{j}I^{\{0,\ldots,k-1\}\setminus\{j\}}I{0,…,k−1}∖{j}, this defines the complex linear span, inside the space of complex matrices indexed by IkI^kIk, of the matrices

(x,y)⟼Aj(xj,yj) Bj ⁣(x∣{j}c,y∣{j}c),0≤j<k.(x,y)\longmapsto A_j(x_j,y_j)\, B_j\!\left(x|_{\{j\}^{c}},y|_{\{j\}^{c}}\right), \qquad 0\le j<k.(x,y)⟼Aj​(xj​,yj​)Bj​(x∣{j}c​,y∣{j}c​),0≤j<k.

Thus its elements are finite complex linear combinations of these specified matrices. No finiteness assumption on III is required, and for k=0k=0k=0 the span is the zero subspace.

QAlgorithms.Papers.Independent.Advance50.P50.siteEmbedding

For every natural number nnn, site j∈{0,…,n−1}j\in\{0,\ldots,n-1\}j∈{0,…,n−1}, and arbitrary complex 2×22\times22×2 matrix AAA indexed by Boolean values, this defines the matrix AjA_jAj​ indexed by nnn-bit configurations by

Aj(x,y)=A(xj,yj)∏ℓ=0ℓ≠jn−11{xℓ=yℓ}.A_j(x,y)=A(x_j,y_j)\prod_{\substack{\ell=0\\\ell\ne j}}^{n-1}\mathbf 1_{\{x_\ell=y_\ell\}}.Aj​(x,y)=A(xj​,yj​)ℓ=0ℓ=j​∏n−1​1{xℓ​=yℓ​}​.

Thus its entry is A(xj,yj)A(x_j,y_j)A(xj​,yj​) when the configurations agree at every other site, and 000 otherwise; no Hermiticity or unitarity assumption is imposed on AAA. When n=0n=0n=0, there is no possible site jjj.

QAlgorithms.Papers.Independent.Advance50.P50.sitePermutation

For any natural number nnn and any permutation ppp of {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}, this defines a complex matrix indexed by nnn-bit strings by

(Pp)y,x={1,yj=xp−1(j) for every j,0,otherwise.(P_p)_{y,x}= \begin{cases} 1,&y_j=x_{p^{-1}(j)}\text{ for every }j,\\ 0,&\text{otherwise}. \end{cases}(Pp​)y,x​={1,0,​yj​=xp−1(j)​ for every j,otherwise.​

Thus the column indexed by xxx has its 111 in the row indexed by x∘p−1x\circ p^{-1}x∘p−1. For n=0n=0n=0, the unique permutation produces the one-by-one matrix [1][1][1].

QAlgorithms.Papers.Independent.Advance50.P50.sitePermutationMatrices

For every natural number nnn, this is the set of all complex matrices PPP indexed by nnn-bit strings for which there exists a permutation ppp of {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} such that Py,x=1P_{y,x}=1Py,x​=1 when yj=xp−1(j)y_j=x_{p^{-1}(j)}yj​=xp−1(j)​ for every site jjj, and Py,x=0P_{y,x}=0Py,x​=0 otherwise. For n=0n=0n=0, this set contains exactly the one-by-one matrix [1][1][1].

QAlgorithms.Papers.Independent.Advance50.P50.slotFactor

For any type III, natural number kkk, index j∈{0,…,k−1}j\in\{0,\ldots,k-1\}j∈{0,…,k−1}, complex matrix AAA indexed by III, and complex matrix BBB indexed by functions from {0,…,k−1}∖{j}\{0,\ldots,k-1\}\setminus\{j\}{0,…,k−1}∖{j} to III, this defines a matrix indexed by kkk-tuples x,y∈Ikx,y\in I^kx,y∈Ik, with entries

Axj,yj Bx∣{j}c, y∣{j}c.A_{x_j,y_j}\,B_{x|_{\{j\}^{c}},\,y|_{\{j\}^{c}}}.Axj​,yj​​Bx∣{j}c​,y∣{j}c​​.

No finiteness or positivity assumption is imposed on I,A,BI,A,BI,A,B. The supplied index jjj excludes k=0k=0k=0; when k=1k=1k=1, BBB has a single entry indexed by the unique empty tuple.

QAlgorithms.Papers.Independent.Advance50.P50.subsystemSwap

For any natural number nnn and finite subset Q⊆{0,…,n−1}Q\subseteq\{0,\ldots,n-1\}Q⊆{0,…,n−1}, this defines a complex matrix indexed by pairs of nnn-bit strings. Its entry at x=(x0,x1)x=(x_0,x_1)x=(x0​,x1​), y=(y0,y1)y=(y_0,y_1)y=(y0​,y1​) is 111 exactly when, at every site j∈Qj\in Qj∈Q, x0(j)=y1(j)x_0(j)=y_1(j)x0​(j)=y1​(j) and x1(j)=y0(j)x_1(j)=y_0(j)x1​(j)=y0​(j), and at every site j∉Qj\notin Qj∈/Q, x0(j)=y0(j)x_0(j)=y_0(j)x0​(j)=y0​(j) and x1(j)=y1(j)x_1(j)=y_1(j)x1​(j)=y1​(j); all other entries are 000. Thus the definition multiplies a two-copy swap factor at each site in QQQ and an identity factor elsewhere. For Q=∅Q=\varnothingQ=∅ it is the identity, including when n=0n=0n=0.

QAlgorithms.Papers.Independent.Advance50.P50.swapTestMatrix

For every finite type III with decidable equality, define SSS, indexed by functions x,y:{0,1}→Ix,y:\{0,1\}\to Ix,y:{0,1}→I, by Sy,x=1S_{y,x}=1Sy,x​=1 when y(0)=x(1)y(0)=x(1)y(0)=x(1) and y(1)=x(0)y(1)=x(0)y(1)=x(0), and Sy,x=0S_{y,x}=0Sy,x​=0 otherwise. The defined matrix on C{false,true}×I2\mathbb C^{\{\mathrm{false},\mathrm{true}\}\times I^2}C{false,true}×I2 is

(H⊗II2)(II200S)(H⊗II2),H=12(111−1),(H\otimes I_{I^2}) \begin{pmatrix}I_{I^2}&0\\0&S\end{pmatrix} (H\otimes I_{I^2}), \qquad H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix},(H⊗II2​)(II2​0​0S​)(H⊗II2​),H=2​1​(11​1−1​),

where the block order is false,true\mathrm{false},\mathrm{true}false,true. This includes empty III, when the indexing type is empty.

QAlgorithms.Papers.Independent.Advance50.P50.tangentAtIdentity

For any finite index type III with decidable equality and any subgroup GGG of the unitary group on III, this defines the set of complex matrices XXX for which there exists a curve c:R→CI×Ic:\mathbb R\to\mathbb C^{I\times I}c:R→CI×I satisfying

c(0)=1,∀t∈R, c(t) is the underlying matrix of an element of G,c′(0)=X.c(0)=1,\qquad \forall t\in\mathbb R,\ c(t)\text{ is the underlying matrix of an element of }G, \qquad c'(0)=X.c(0)=1,∀t∈R, c(t) is the underlying matrix of an element of G,c′(0)=X.

The derivative is with respect to the real parameter and is required only at 000; the curve is defined and takes values in the subgroup for every real ttt. An empty III is permitted.

QAlgorithms.Papers.Independent.Advance50.P50.targetObservable3

This definition gives the complex matrix indexed by three-bit strings whose entries are

Oy,x={(−1)x(0),y(0)=x(0), y(1)=x(2), y(2)=x(1),0,otherwise,O_{y,x}= \begin{cases} (-1)^{x(0)},&y(0)=x(0),\ y(1)=x(2),\ y(2)=x(1),\\ 0,&\text{otherwise}, \end{cases}Oy,x​={(−1)x(0),0,​y(0)=x(0), y(1)=x(2), y(2)=x(1),otherwise,​

where false and true are identified with 000 and 111 in the exponent. Equivalently, it is ZZZ on bit 000, with Z=diag⁡(1,−1)Z=\operatorname{diag}(1,-1)Z=diag(1,−1), together with interchange of bits 111 and 222.

QAlgorithms.Papers.Independent.Advance50.P50.tensorCommutant

For any finite index type III, any natural number kkk, and any set GGG of complex matrices indexed by I×II\times II×I, this defines the set of all complex matrices AAA indexed by functions {0,…,k−1}→I\{0,\ldots,k-1\}\to I{0,…,k−1}→I such that

∀V∈G,ATV=TVA,(TV)x,y=∏c=0k−1Vx(c),y(c).\forall V\in G,\qquad AT_V=T_VA, \qquad (T_V)_{x,y}=\prod_{c=0}^{k-1}V_{x(c),y(c)}.∀V∈G,ATV​=TV​A,(TV​)x,y​=c=0∏k−1​Vx(c),y(c)​.

The set GGG need not be a group or consist of unitary matrices. If GGG is empty, every matrix of the indicated size qualifies. When k=0k=0k=0, each TV=[1]T_V=[1]TV​=[1], so every 1×11\times11×1 complex matrix qualifies.

QAlgorithms.Papers.Independent.Advance50.P50.tensorFactors

For any index type III, any natural number kkk, and any family A0,…,Ak−1A_0,\ldots,A_{k-1}A0​,…,Ak−1​ of complex matrices indexed by I×II\times II×I, this defines a complex matrix indexed by pairs of functions x,y:{0,…,k−1}→Ix,y:\{0,\ldots,k-1\}\to Ix,y:{0,…,k−1}→I, with entries

Tx,y=∏c=0k−1(Ac)x(c),y(c).T_{x,y}=\prod_{c=0}^{k-1}(A_c)_{x(c),y(c)}.Tx,y​=c=0∏k−1​(Ac​)x(c),y(c)​.

No finiteness assumption on III is required. When k=0k=0k=0, the indexing set contains the unique empty function and the empty product is 111, so the resulting matrix is the 1×11\times11×1 matrix [1][1][1].

QAlgorithms.Papers.Independent.Advance50.P50.timesI

For any index type III and any set SSS of complex matrices indexed by I×II\times II×I, this defines its image under multiplication by the imaginary unit:

{Y:∃X∈S, Y=iX}.\{Y:\exists X\in S,\ Y=\mathrm{i}X\}.{Y:∃X∈S, Y=iX}.

No finiteness assumption on III or algebraic condition on SSS is required; the image of the empty set is empty.

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

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 29, 2026

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

View graph

Get started

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

About Prove2Me

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

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me