Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Learning Quantum Processes and Hamiltonians via the Pauli Transfer Matrix

Definition
QAlgorithms_Papers_Independent_Extend50_P46

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

prove2quantum

The objects the formalized statements of Learning Quantum Processes and Hamiltonians via the Pauli Transfer Matrix (arXiv:2212.04471) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • normalizedChoiMatrix: PDF p.11, Eq.(2.1): normalized reference-first Choi operator of an arbitrary complex-linear superoperator, in the fixed computational bases. The input maximally entangled density has entries delta_(i,j) delta_(k,l) / din.
  • ptm: PDF p.12, Eq.(2.5): the accepted real PTM coordinates.
  • HermitianBasis: PDF p.12, Definition 2.4: a complete Hermitian Hilbert-Schmidt ONB. There are exactly 4^n basis elements; completeness comes from Module.Basis.
  • coeff: PDF p.15: real expansion coefficients of a Hermitian operator.
  • tm: PDF p.12, Eq.(2.2): transfer coordinates, output index first.
  • basisNorm: PDF p.16, Eq.(3.10): the maximum operator norm; a nonempty finite range.
  • supportCount: PDF pp.16-19: number of nonzero coefficients, including the identity coefficient.
  • predict: PDF p.16, Eq.(3.3): the estimator computed from the supplied table.
  • predictOn: PDF p.19, Eq.(3.16): estimator using only the supplied known support.
  • predictPauli: PDF p.22: prediction in the source's unnormalized Pauli coefficient lists.
  • ChoiLearner: PDF pp.10,15, Definition 2.10: an actual finite-outcome joint POVM on exactly copies fresh normalized Choi states, with a classical report decoder. The unknown channel is absent from every field.
  • choiReportEventProbability: PDF pp.10-11,14-15: the finite Born sum for the preimage of a report event on the actual tensor-power input, without renormalization. Every preimage is a subset of the finite physical outcome space, so no measurability default occurs.
  • tableGood: PDF p.21: the simultaneous absolute-error event on a table of estimates.
  • sparseListGood: PDF pp.23-24: all four guarantees for the finite list computed by thresholding.
  • softFactor: PDF pp.39-41: soft-O suppresses fixed powers of logarithms of the listed parameters. The exponent is quantified uniformly before every instance.
  • generalCost: PDF pp.39-41: the common general-basis sample bound before task-specific factors.
  • eigenspaceState: PDF p.18: (I plus or minus sigma_A)/2^n; minus chooses the minus sign.
  • hamiltonianCoeff: PDF p.28: the unnormalized Hamiltonian expansion coefficient.
  • singleSite: PDF p.29: the single-site witness B_j=b and B_k=I for k different from j.
  • pauliCoefficientProbe: PDF p.29, Lemma 6.1: the constructed input state, with +i[Pauli_A,Pauli_B]/2.
  • hamiltonianDensityFlow: PDF p.28, Eq.(6.1): exp(-itH) rho exp(+itH), defined on all real times.
  • fullEnsemble: PDF p.44: all distinct positive Paulis whose output half is nonidentity.
  • sparseEnsemble: PDF p.45: all distinct positive Paulis nonidentity on both halves.
  • signedPauli: PDF pp.44-45: positive and negative halves, paired by the same label.
  • shadowValues: PDF p.43, Eq.(D.2): values averaged over the whole positive half, without repetition, on normalized pure states only.
  • shadowParameter: PDF p.43: the real supremum; its nonempty bounded domain is a conclusion of each theorem that uses it, rather than an implicit default-value assumption.
  • choiInputContraction: PDF pp.46-49: the response tr_input[(rho^T_input tensor I)(I tensor O)], written entrywise with ancilla first. This formula contracts matrix units of rho against the reference/input indices of O.
  • likelihoodValues: PDF pp.46-49: the operational likelihood-ratio values. Only positive baseline-probability branches are included, so no 0/0 convention enters.
  • likelihoodParameter: PDF p.49, Eq.(D.50): Delta, with positive-denominator operational semantics. Nonemptiness and boundedness are explicitly asserted where its bounds are stated.
  • choiEnsembleValid: PDF pp.43-45: the signed enumeration satisfies (i)-(iii). Tensor-product form is already part of signedPauli, and its negative half is paired canonically.
  • sparseEnsembleValid: PDF p.45: additional zero input marginal, giving conditions (i)-(v) for this explicitly Pauli-product, hence one-sparse, enumeration.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_MitigationPauliCoordinates
import Definitions.Def_QAlgorithms_Defs_TomographyOutcomes
import Definitions.Def_QAlgorithms_Defs_MatrixDistances

/-!
Statements from Caro, arXiv:2212.04471v2. All pages are PDF pages.
Local definitions implement source-specific operator coordinates and experiments.
No runtime, storage, adaptive-query, or Hamiltonian-oracle claim is hidden in a field.
The omitted nodes and their precise outstanding interfaces are in the unit's HARD.md.
-/

noncomputable section

open MeasureTheory
open scoped Matrix ComplexConjugate ComplexOrder

namespace QAlgorithms.Papers.Independent.Extend50.P46

attribute [local instance] Classical.propDecidable Classical.decEq

/-- PDF p.11, Eq.(2.1): normalized reference-first Choi operator of an arbitrary
complex-linear superoperator, in the fixed computational bases. The input
maximally entangled density has entries delta_(i,j) delta_(k,l) / din. -/
def normalizedChoiMatrix {din dout : ℕ}
    (N : Matrix (Fin din) (Fin din) ℂ →ₗ[ℂ] Matrix (Fin dout) (Fin dout) ℂ) :
    Matrix (Fin din × Fin dout) (Fin din × Fin dout) ℂ :=
  idTensorSuperop (R := Fin din) N
    (Matrix.of fun p q : Fin din × Fin din =>
      if p.1 = p.2 ∧ q.1 = q.2 then (din : ℂ)⁻¹ else 0)

/-- Sanity check for Eq.(2.1): the zero superoperator has zero Choi operator. -/
example (din dout : ℕ) :
    normalizedChoiMatrix (0 : Matrix (Fin din) (Fin din) ℂ →ₗ[ℂ]
      Matrix (Fin dout) (Fin dout) ℂ) = 0 := by
  ext p q
  simp [normalizedChoiMatrix, idTensorSuperop]

/-- PDF p.12, Eq.(2.5): the accepted real PTM coordinates. -/
def ptm {n : ℕ} (N : {F : (Matrix (Qubits n) (Qubits n) ℂ) →ₗ[ℂ] (Matrix (Qubits n) (Qubits n) ℂ) // IsChannel F}) : Matrix (ErrorMitigation.PauliIndex n) (ErrorMitigation.PauliIndex n) ℝ :=
  ErrorMitigation.pauliTransferMatrix N.val

/-- PDF p.12, Definition 2.4: a complete Hermitian Hilbert-Schmidt ONB.
There are exactly 4^n basis elements; completeness comes from `Module.Basis`. -/
structure HermitianBasis (n : ℕ) where
  basis : Module.Basis (Fin (4 ^ n)) ℂ (Matrix (Qubits n) (Qubits n) ℂ)
  hermitian : ∀ i, (basis i).IsHermitian
  orthogonal : ∀ i j, ((basis i) * (basis j)).trace = if i = j then 1 else 0

/-- PDF p.15: real expansion coefficients of a Hermitian operator. -/
def coeff {n : ℕ} (Q : HermitianBasis n) (X : (Matrix (Qubits n) (Qubits n) ℂ)) (i : Fin (4 ^ n)) : ℝ :=
  ((Q.basis i) * X).trace.re

/-- PDF p.12, Eq.(2.2): transfer coordinates, output index first. -/
def tm {n : ℕ} (Q : HermitianBasis n) (N : {F : (Matrix (Qubits n) (Qubits n) ℂ) →ₗ[ℂ] (Matrix (Qubits n) (Qubits n) ℂ) // IsChannel F}) :
    Matrix (Fin (4 ^ n)) (Fin (4 ^ n)) ℝ :=
  fun i j => ((Q.basis i) * N.val (Q.basis j)).trace.re

/-- PDF p.16, Eq.(3.10): the maximum operator norm; a nonempty finite range. -/
def basisNorm {n : ℕ} (Q : HermitianBasis n) : ℝ :=
  sSup (Set.range fun i : Fin (4 ^ n) => specNorm (Q.basis i))

/-- PDF pp.16-19: number of nonzero coefficients, including the identity coefficient. -/
def supportCount {I : Type*} [Fintype I] (f : I → ℝ) : ℕ :=
  (Finset.univ.filter fun i => f i ≠ 0).card

/-- PDF p.16, Eq.(3.3): the estimator computed from the supplied table. -/
def predict {n : ℕ} (Q : HermitianBasis n)
    (r : Matrix (Fin (4 ^ n)) (Fin (4 ^ n)) ℝ) (rho O : (Matrix (Qubits n) (Qubits n) ℂ)) : ℝ :=
  ∑ i, ∑ j, coeff Q O i * r i j * coeff Q rho j

/-- PDF p.19, Eq.(3.16): estimator using only the supplied known support. -/
def predictOn {n : ℕ} (Q : HermitianBasis n)
    (S : Finset (Fin (4 ^ n) × Fin (4 ^ n)))
    (r : Matrix (Fin (4 ^ n)) (Fin (4 ^ n)) ℝ) (rho O : (Matrix (Qubits n) (Qubits n) ℂ)) : ℝ :=
  ∑ p ∈ S, coeff Q O p.1 * r p.1 p.2 * coeff Q rho p.2

/-- PDF p.22: prediction in the source's unnormalized Pauli coefficient lists. -/
def predictPauli {n : ℕ} (r : Matrix (ErrorMitigation.PauliIndex n) (ErrorMitigation.PauliIndex n) ℝ) (rho O : (Matrix (Qubits n) (Qubits n) ℂ)) : ℝ :=
  ∑ A, ∑ B, ErrorMitigation.pauliObservableRow O A * r A B *
    ErrorMitigation.pauliStateVector rho B

/-- PDF pp.10,15, Definition 2.10: an actual finite-outcome joint POVM on
exactly `copies` fresh normalized Choi states, with a classical report decoder.
The unknown channel is absent from every field. -/
structure ChoiLearner (n : ℕ) (Out : Type*) where
  copies : ℕ
  outcomes : ℕ
  measurement : Fin outcomes →
    Matrix (Fin copies → (Qubits n × Qubits n))
      (Fin copies → (Qubits n × Qubits n)) ℂ
  valid : IsPOVM measurement
  decode : Fin outcomes → Out

/-- PDF pp.10-11,14-15: the finite Born sum for the preimage of a report
event on the actual tensor-power input, without renormalization. Every preimage
is a subset of the finite physical outcome space, so no measurability default occurs. -/
def choiReportEventProbability {n : ℕ} {Out : Type*}
    (P : ChoiLearner n Out) (N : {F : (Matrix (Qubits n) (Qubits n) ℂ) →ₗ[ℂ] (Matrix (Qubits n) (Qubits n) ℂ) // IsChannel F}) (E : Set Out) : ℝ :=
  povmEventProb P.measurement (piKron P.copies (idTensorSuperop (R := Qubits n) N.val (pureDensity (maxEntangled n)))) (fun o => P.decode o ∈ E)

/-- PDF p.21: the simultaneous absolute-error event on a table of estimates. -/
def tableGood {I : Type*} (r t : Matrix I I ℝ) (eps : ℝ) : Prop :=
  ∀ i j, |r i j - t i j| ≤ eps

/-- PDF pp.23-24: all four guarantees for the finite list computed by thresholding. -/
def sparseListGood {I : Type*} [Fintype I] (r t : Matrix I I ℝ)
    (eps : ℝ) (s : ℕ) : Prop :=
  (∀ i j, (i,j) ∉ (Finset.univ.filter fun p : I × I => eps / 2 < |r p.1 p.2|) → |t i j| ≤ eps) ∧
  (∀ i j, (i,j) ∈ (Finset.univ.filter fun p : I × I => eps / 2 < |r p.1 p.2|) → eps / 6 < |t i j|) ∧
  (Finset.univ.filter fun p : I × I => eps / 2 < |r p.1 p.2|).card ≤ s ∧
  (∀ i j, (i,j) ∈ (Finset.univ.filter fun p : I × I => eps / 2 < |r p.1 p.2|) → |r i j - t i j| ≤ eps)

/-- PDF pp.39-41: soft-O suppresses fixed powers of logarithms of the
listed parameters. The exponent is quantified uniformly before every instance. -/
def softFactor (p n : ℕ) (eps delta scale : ℝ) : ℝ :=
  (1 + Real.log (n + 2) + |Real.log eps| + |Real.log delta| + Real.log (max 1 scale)) ^ p

/-- PDF pp.39-41: the common general-basis sample bound before task-specific factors. -/
def generalCost {n : ℕ} (Q : HermitianBasis n) (eps delta : ℝ) : ℝ :=
  ((n : ℝ)^3 + n * Real.log delta⁻¹) / eps^4 *
    ((2 : ℝ)^n * basisNorm Q ^ 2)^4

/-- PDF p.18: (I plus or minus sigma_A)/2^n; `minus` chooses the minus sign. -/
def eigenspaceState {n : ℕ} (A : ErrorMitigation.PauliIndex n) (minus : Bool) : (Matrix (Qubits n) (Qubits n) ℂ) :=
  (((2 : ℝ)^n)⁻¹ : ℂ) •
    (1 + (if minus then (-1 : ℂ) else 1) • pauliOps A)

/-- PDF p.28: the unnormalized Hamiltonian expansion coefficient. -/
def hamiltonianCoeff {n : ℕ} (H : (Matrix (Qubits n) (Qubits n) ℂ)) (A : ErrorMitigation.PauliIndex n) : ℝ :=
  ((2 : ℝ)^n)⁻¹ * (H * pauliOps A).trace.re

/-- PDF p.29: the single-site witness B_j=b and B_k=I for k different from j. -/
def singleSite {n : ℕ} (j : Fin n) (b : Stabilizer.Pauli) : ErrorMitigation.PauliIndex n :=
  fun k => if k = j then b else .I

/-- PDF p.29, Lemma 6.1: the constructed input state, with +i[Pauli_A,Pauli_B]/2. -/
def pauliCoefficientProbe {n : ℕ} (A B : ErrorMitigation.PauliIndex n) : (Matrix (Qubits n) (Qubits n) ℂ) :=
  (((2 : ℝ)^n)⁻¹ : ℂ) •
    (1 + (Complex.I / 2) • (pauliOps A * pauliOps B - pauliOps B * pauliOps A))

/-- PDF p.28, Eq.(6.1): exp(-itH) rho exp(+itH), defined on all real times. -/
def hamiltonianDensityFlow {n : ℕ} (H : (Matrix (Qubits n) (Qubits n) ℂ)) (t : ℝ) (rho : (Matrix (Qubits n) (Qubits n) ℂ)) : (Matrix (Qubits n) (Qubits n) ℂ) :=
  NormedSpace.exp ((((-t : ℝ) : ℂ) * Complex.I) • H) * rho *
    NormedSpace.exp (((t : ℂ) * Complex.I) • H)

/-- PDF p.44: all distinct positive Paulis whose output half is nonidentity. -/
def fullEnsemble (n : ℕ) : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n) :=
  Finset.univ.filter fun p => p.2 ≠ (fun _ => .I)

/-- PDF p.45: all distinct positive Paulis nonidentity on both halves. -/
def sparseEnsemble (n : ℕ) : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n) :=
  Finset.univ.filter fun p => p.1 ≠ (fun _ => .I) ∧ p.2 ≠ (fun _ => .I)

/-- PDF pp.44-45: positive and negative halves, paired by the same label. -/
def signedPauli {n : ℕ} (minus : Bool) (p : ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n) :
    Matrix (Qubits n × Qubits n) (Qubits n × Qubits n) ℂ :=
  (if minus then (-1 : ℂ) else 1) • Matrix.kronecker (pauliOps p.1) (pauliOps p.2)

/-- PDF p.43, Eq.(D.2): values averaged over the whole positive half,
without repetition, on normalized pure states only. -/
def shadowValues {n : ℕ} (S : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n)) : Set ℝ :=
  {v | ∃ psi : EuclideanSpace ℂ (Qubits n × Qubits n), IsState psi ∧
    v = (S.card : ℝ)⁻¹ * ∑ p ∈ S,
      (inner ℂ psi (act (signedPauli false p) psi)).re ^ 2}

/-- PDF p.43: the real supremum; its nonempty bounded domain is a conclusion
of each theorem that uses it, rather than an implicit default-value assumption. -/
def shadowParameter {n : ℕ} (S : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n)) : ℝ :=
  sSup (shadowValues S)

/-- PDF pp.46-49: the response tr_input[(rho^T_input tensor I)(I tensor O)],
written entrywise with ancilla first. This formula contracts matrix units of rho
against the reference/input indices of O. -/
def choiInputContraction {n a : ℕ}
    (rho : Matrix (Qubits a × Qubits n) (Qubits a × Qubits n) ℂ)
    (O : Matrix (Qubits n × Qubits n) (Qubits n × Qubits n) ℂ) :
    Matrix (Qubits a × Qubits n) (Qubits a × Qubits n) ℂ :=
  fun x y => ∑ i, ∑ j, rho (x.1,i) (y.1,j) * O (i,x.2) (j,y.2)

/-- PDF pp.46-49: the operational likelihood-ratio values. Only positive
baseline-probability branches are included, so no 0/0 convention enters. -/
def likelihoodValues {n : ℕ} (S : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n)) : Set ℝ :=
  {v | ∃ a : ℕ,
    ∃ rho : Matrix (Qubits a × Qubits n) (Qubits a × Qubits n) ℂ,
    ∃ psi : EuclideanSpace ℂ (Qubits a × Qubits n),
      IsDensityMatrix rho ∧ IsState psi ∧
      0 < (inner ℂ psi (act (Matrix.kronecker (traceRight rho)
        (1 : (Matrix (Qubits n) (Qubits n) ℂ))) psi)).re ∧
      v = (S.card : ℝ)⁻¹ * ∑ p ∈ S,
        ((inner ℂ psi (act (choiInputContraction rho (signedPauli false p)) psi)).re /
          (inner ℂ psi (act (Matrix.kronecker (traceRight rho)
            (1 : (Matrix (Qubits n) (Qubits n) ℂ))) psi)).re)^2}

/-- PDF p.49, Eq.(D.50): Delta, with positive-denominator operational semantics.
Nonemptiness and boundedness are explicitly asserted where its bounds are stated. -/
def likelihoodParameter {n : ℕ} (S : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n)) : ℝ :=
  sSup (likelihoodValues S)

/-- PDF pp.43-45: the signed enumeration satisfies (i)-(iii). Tensor-product
form is already part of `signedPauli`, and its negative half is paired canonically. -/
def choiEnsembleValid {n : ℕ} (S : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n)) : Prop :=
  ∀ p ∈ S, ∀ minus : Bool,
    (signedPauli minus p).IsHermitian ∧
    signedPauli minus p * signedPauli minus p = 1 ∧
    (signedPauli minus p).trace = 0 ∧ traceRight (signedPauli minus p) = 0 ∧
    signedPauli (!minus) p = - signedPauli minus p

/-- PDF p.45: additional zero input marginal, giving conditions (i)-(v) for
this explicitly Pauli-product, hence one-sparse, enumeration. -/
def sparseEnsembleValid {n : ℕ} (S : Finset (ErrorMitigation.PauliIndex n × ErrorMitigation.PauliIndex n)) : Prop :=
  choiEnsembleValid S ∧ ∀ p ∈ S, ∀ minus : Bool,
    (Matrix.of fun y z => ∑ x : Qubits n, signedPauli minus p (x,y) (x,z)) =
      (0 : (Matrix (Qubits n) (Qubits n) ℂ))

/-- Sanity check (PDF p.16): zero supplied table gives the zero estimator. -/
example {n : ℕ} (Q : HermitianBasis n) (rho O : (Matrix (Qubits n) (Qubits n) ℂ)) :
    predict Q 0 rho O = 0 := by simp [predict]

/-- Sanity check (PDF p.23): no estimated zero entry passes a positive cutoff. -/
example {I : Type*} [Fintype I] {eps : ℝ} (h : 0 < eps) :
    (Finset.univ.filter fun p : I × I => eps / 2 < |(0 : Matrix I I ℝ) p.1 p.2|) = ∅ := by
  ext p
  simp [show ¬ eps / 2 < 0 by linarith]

/-- Sanity check (PDF p.15): zero-copy inputs are independent of the channel. -/
example {n : ℕ} (N M : {F : (Matrix (Qubits n) (Qubits n) ℂ) →ₗ[ℂ] (Matrix (Qubits n) (Qubits n) ℂ) // IsChannel F}) : piKron 0 (idTensorSuperop (R := Qubits n) N.val (pureDensity (maxEntangled n))) = piKron 0 (idTensorSuperop (R := Qubits n) M.val (pureDensity (maxEntangled n))) := by
  ext x y
  simp [piKron]

/-- Sanity check (PDF pp.46-49): the entrywise response is linear in a zero observable. -/
example {n a : ℕ}
    (rho : Matrix (Qubits a × Qubits n) (Qubits a × Qubits n) ℂ) :
    choiInputContraction rho 0 = 0 := by ext x y; simp [choiInputContraction]

/-- Sanity check (PDF p.18): the plus-state normalization is explicit. -/
example {n : ℕ} (A : ErrorMitigation.PauliIndex n) :
    eigenspaceState A false = (((2 : ℝ)^n)⁻¹ : ℂ) • (1 + pauliOps A) := by
  simp [eigenspaceState]

/-- Sanity check (PDF p.28): zero evolution time is the identity channel. -/
example {n : ℕ} (H rho : (Matrix (Qubits n) (Qubits n) ℂ)) : hamiltonianDensityFlow H 0 rho = rho := by
  simp [hamiltonianDensityFlow]

/-- Sanity check (PDF pp.16-19): a zero coefficient vector has empty support. -/
example {I : Type*} [Fintype I] : supportCount (fun _ : I => (0 : ℝ)) = 0 := by
  simp [supportCount]

end QAlgorithms.Papers.Independent.Extend50.P46
Source
Learning Quantum Processes and Hamiltonians via the Pauli Transfer Matrix, arXiv:2212.04471v2, https://arxiv.org/abs/2212.04471v2
Read-back

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

QAlgorithms.Papers.Independent.Extend50.P46.ChoiLearner

For each natural number nnn and arbitrary type Out\mathrm{Out}Out, this structure consists of natural numbers ccc and ooo, called its numbers of copies and outcomes; complex matrices MaM_aMa​, one for each 0≤a<o0\le a<o0≤a<o, whose rows and columns are indexed by functions from {0,…,c−1}\{0,\ldots,c-1\}{0,…,c−1} to pairs of nnn-bit strings; proofs that every MaM_aMa​ is positive semidefinite and ∑a=0o−1Ma=I\sum_{a=0}^{o-1}M_a=I∑a=0o−1​Ma​=I; and a decoding function d:{0,…,o−1}→Outd:\{0,\ldots,o-1\}\to\mathrm{Out}d:{0,…,o−1}→Out. The value c=0c=0c=0 is allowed, in which case the matrix indexing set consists of the unique empty function and the matrices are 1×11\times11×1. The value n=0n=0n=0 is also allowed. Although ooo is specified as an arbitrary natural number, o=0o=0o=0 cannot satisfy the required sum-to-identity condition on this nonempty matrix indexing set.

QAlgorithms.Papers.Independent.Extend50.P46.HermitianBasis

For each natural number nnn, this structure consists of a complex vector-space basis (Qi)0≤i<4n(Q_i)_{0\le i<4^n}(Qi​)0≤i<4n​ of all complex matrices indexed by the nnn-bit strings, together with proofs that every QiQ_iQi​ is Hermitian and that, as an equality of complex numbers,

tr⁡(QiQj)={1,i=j,0,i≠j(0≤i,j<4n).\operatorname{tr}(Q_iQ_j)= \begin{cases} 1,&i=j,\\ 0,&i\ne j \end{cases} \qquad(0\le i,j<4^n).tr(Qi​Qj​)={1,0,​i=j,i=j​(0≤i,j<4n).

The value n=0n=0n=0 is included: the matrices are then 1×11\times11×1, and the basis has one element.

QAlgorithms.Papers.Independent.Extend50.P46.basisNorm

For every natural number nnn and every complex vector-space basis Q=(Qi)0≤i<4nQ=(Q_i)_{0\le i<4^n}Q=(Qi​)0≤i<4n​ of the complex matrices indexed by nnn-bit strings, equipped with Hermiticity of every QiQ_iQi​ and the identities tr⁡(QiQj)=δij\operatorname{tr}(Q_iQ_j)=\delta_{ij}tr(Qi​Qj​)=δij​, this definition returns

basisNorm⁡(Q)=sup⁡{∥Qi∥2→2:0≤i<4n},\operatorname{basisNorm}(Q)=\sup\{\|Q_i\|_{2\to2}:0\le i<4^n\},basisNorm(Q)=sup{∥Qi​∥2→2​:0≤i<4n},

where ∥⋅∥2→2\|\cdot\|_{2\to2}∥⋅∥2→2​ is the operator norm induced by the Euclidean norm on complex vectors. The indexing set is finite and nonempty, so this is its maximum, including when n=0n=0n=0, when there is one basis element.

QAlgorithms.Papers.Independent.Extend50.P46.choiEnsembleValid

For every natural number nnn, including 000, and finite set SSS of pairs of Pauli assignments on nnn sites, this defines a proposition. Write PA=⨂qA(q)P_A=\bigotimes_q A(q)PA​=⨂q​A(q) for an assignment A(q)∈{I,X,Y,Z}A(q)\in\{I,X,Y,Z\}A(q)∈{I,X,Y,Z}, and, for each Boolean bbb, put Hb,(A,B)=(−1)b(PA⊗PB)H_{b,(A,B)}=(-1)^b(P_A\otimes P_B)Hb,(A,B)​=(−1)b(PA​⊗PB​), interpreting false as 000 and true as 111. The proposition requires, for every p∈Sp\in Sp∈S and both values of bbb,

Hb,p∗=Hb,p,Hb,p 2=I,Tr⁡Hb,p=0,∑h∈{0,1}n(Hb,p)(j,h),(k,h)=0for all j,k,H¬b,p=−Hb,p.H_{b,p}^{*}=H_{b,p},\qquad H_{b,p}^{\,2}=I,\qquad \operatorname{Tr}H_{b,p}=0,\qquad \sum_{h\in\{0,1\}^n}(H_{b,p})_{(j,h),(k,h)}=0 \quad\text{for all }j,k, \qquad H_{\neg b,p}=-H_{b,p}.Hb,p∗​=Hb,p​,Hb,p2​=I,TrHb,p​=0,h∈{0,1}n∑​(Hb,p​)(j,h),(k,h)​=0for all j,k,H¬b,p​=−Hb,p​.

Thus the fourth condition sets the partial trace over the second register equal to the zero matrix. These requirements are vacuous when SSS is empty. When n=0n=0n=0, empty tensor products are scalar identities, so the trace-zero condition prevents any element from belonging to a valid SSS.

QAlgorithms.Papers.Independent.Extend50.P46.choiInputContraction

For all natural numbers n,an,an,a, including 000, every complex matrix ρ\rhoρ indexed by pairs in {0,1}a×{0,1}n\{0,1\}^a\times\{0,1\}^n{0,1}a×{0,1}n, and every complex matrix OOO indexed by pairs in {0,1}n×{0,1}n\{0,1\}^n\times\{0,1\}^n{0,1}n×{0,1}n, this defines a complex matrix Kρ(O)K_\rho(O)Kρ​(O) on {0,1}a×{0,1}n\{0,1\}^a\times\{0,1\}^n{0,1}a×{0,1}n by

Kρ(O)(u,v),(u′,v′)=∑i,j∈{0,1}nρ(u,i),(u′,j) O(i,v),(j,v′).K_\rho(O)_{(u,v),(u',v')} =\sum_{i,j\in\{0,1\}^n}\rho_{(u,i),(u',j)}\,O_{(i,v),(j,v')}.Kρ​(O)(u,v),(u′,v′)​=i,j∈{0,1}n∑​ρ(u,i),(u′,j)​O(i,v),(j,v′)​.

No positivity, trace, Hermiticity, or normalization assumptions are imposed on either input matrix, and the displayed products contain no complex conjugation. A register of zero bits has one possible bit string, so the corresponding sums still have one index value.

QAlgorithms.Papers.Independent.Extend50.P46.choiReportEventProbability

For every natural number nnn, arbitrary type Out\mathrm{Out}Out, learner PPP consisting of natural numbers c,oc,oc,o, positive semidefinite matrices (Ma)a<o(M_a)_{a<o}(Ma​)a<o​ indexed by ccc-tuples of pairs of nnn-bit strings with ∑a<oMa=I\sum_{a<o}M_a=I∑a<o​Ma​=I, and a decoding function d:{0,…,o−1}→Outd:\{0,\ldots,o-1\}\to\mathrm{Out}d:{0,…,o−1}→Out, let NNN be a complex linear map on matrices indexed by Hn={0,1}nH_n=\{0,1\}^nHn​={0,1}n, equipped with matrices EℓE_\ellEℓ​ for some natural number mmm satisfying ∑ℓ<mEℓ†Eℓ=I\sum_{\ell<m}E_\ell^\dagger E_\ell=I∑ℓ<m​Eℓ†​Eℓ​=I and N(X)=∑ℓ<mEℓXEℓ†N(X)=\sum_{\ell<m}E_\ell X E_\ell^\daggerN(X)=∑ℓ<m​Eℓ​XEℓ†​ for every XXX, and let E⊆OutE\subseteq\mathrm{Out}E⊆Out be any set. Define ϕ(x,y)=2−n/2\phi(x,y)=2^{-n/2}ϕ(x,y)=2−n/2 when x=yx=yx=y and 000 otherwise, define D(x,y),(x′,y′)=ϕ(x,y)ϕ(x′,y′)‾D_{(x,y),(x',y')}=\phi(x,y)\overline{\phi(x',y')}D(x,y),(x′,y′)​=ϕ(x,y)ϕ(x′,y′)​, and define JJJ by

J(x,y),(x′,y′)=[N ⁣((D(x,u),(x′,v))u,v∈Hn)]y,y′.J_{(x,y),(x',y')}= \left[N\!\left((D_{(x,u),(x',v)})_{u,v\in H_n}\right)\right]_{y,y'}.J(x,y),(x′,y′)​=[N((D(x,u),(x′,v)​)u,v∈Hn​​)]y,y′​.

Writing Jz,z′(c)=∏t=0c−1Jz(t),z′(t)J^{(c)}_{z,z'}=\prod_{t=0}^{c-1}J_{z(t),z'(t)}Jz,z′(c)​=∏t=0c−1​Jz(t),z′(t)​ for ccc-tuples z,z′z,z'z,z′ of pairs in Hn×HnH_n\times H_nHn​×Hn​, the definition returns

choiReportEventProbability⁡(P,N,E)=∑0≤a<od(a)∈ERe⁡tr⁡(MaJ(c)).\operatorname{choiReportEventProbability}(P,N,E) =\sum_{\substack{0\le a<o\\d(a)\in E}} \operatorname{Re}\operatorname{tr}(M_aJ^{(c)}).choiReportEventProbability(P,N,E)=0≤a<od(a)∈E​∑​Retr(Ma​J(c)).

No measurability condition on EEE or finiteness condition on Out\mathrm{Out}Out is imposed. If c=0c=0c=0, the product defining J(c)J^{(c)}J(c) is 111, so J(c)J^{(c)}J(c) is the 1×11\times11×1 identity; n=0n=0n=0 is allowed as well.

QAlgorithms.Papers.Independent.Extend50.P46.coeff

For every natural number nnn, every complex vector-space basis Q=(Qi)0≤i<4nQ=(Q_i)_{0\le i<4^n}Q=(Qi​)0≤i<4n​ of the complex matrices indexed by nnn-bit strings satisfying Qi†=QiQ_i^\dagger=Q_iQi†​=Qi​ and tr⁡(QiQj)=δij\operatorname{tr}(Q_iQ_j)=\delta_{ij}tr(Qi​Qj​)=δij​, every complex matrix XXX on those strings, and every index 0≤i<4n0\le i<4^n0≤i<4n, this definition returns the real number

coeff⁡(Q,X,i)=Re⁡tr⁡(QiX).\operatorname{coeff}(Q,X,i)=\operatorname{Re}\operatorname{tr}(Q_iX).coeff(Q,X,i)=Retr(Qi​X).

There is no Hermiticity or positivity hypothesis on XXX, and n=0n=0n=0 is allowed.

QAlgorithms.Papers.Independent.Extend50.P46.eigenspaceState

For every natural number nnn, every assignment A:{0,…,n−1}→{I,X,Y,Z}A:\{0,\ldots,n-1\}\to\{I,X,Y,Z\}A:{0,…,n−1}→{I,X,Y,Z}, and every Boolean bbb, let PA=⨂q=0n−1AqP_A=\bigotimes_{q=0}^{n-1}A_qPA​=⨂q=0n−1​Aq​, using the matrices I2I_2I2​, X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), Y=(0−ii0)Y=\begin{pmatrix}0&-\mathrm i\\ \mathrm i&0\end{pmatrix}Y=(0i​−i0​), and Z=(100−1)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}Z=(10​0−1​) in the order (false,true)(\mathrm{false},\mathrm{true})(false,true). The function returns the complex matrix on nnn-bit strings

2−n(I2n+σbPA),σb={−1b=true,1b=false.2^{-n}\bigl(I_{2^n}+\sigma_bP_A\bigr), \qquad \sigma_b=\begin{cases}-1&b=\mathrm{true},\\1&b=\mathrm{false}.\end{cases}2−n(I2n​+σb​PA​),σb​={−11​b=true,b=false.​

All assignments are allowed, including the all-identity assignment, for which the result is zero when bbb is true and 21−nI2n2^{1-n}I_{2^n}21−nI2n​ when bbb is false. For n=0n=0n=0, the empty tensor product is the scalar 111.

QAlgorithms.Papers.Independent.Extend50.P46.fullEnsemble

For every natural number nnn, the function returns the finite set of all ordered pairs (A,B)(A,B)(A,B) of assignments from {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} to the four symbols {I,X,Y,Z}\{I,X,Y,Z\}{I,X,Y,Z} such that BBB is not the all-identity assignment. Equivalently, Bq≠IB_q\ne IBq​=I for at least one index qqq, while AAA is unrestricted. For n=0n=0n=0, the set is empty.

QAlgorithms.Papers.Independent.Extend50.P46.generalCost

For every natural number nnn, let Bn={0,1}n\mathcal B_n=\{0,1\}^nBn​={0,1}n, and let Q=(Qi)i=04n−1Q=(Q_i)_{i=0}^{4^n-1}Q=(Qi​)i=04n−1​ be a complex vector-space basis of all complex matrices indexed by Bn\mathcal B_nBn​, with every QiQ_iQi​ Hermitian and tr⁡(QiQj)=1\operatorname{tr}(Q_iQ_j)=1tr(Qi​Qj​)=1 when i=ji=ji=j and 000 otherwise. Set BQ=sup⁡i∥Qi∥opB_Q=\sup_i\|Q_i\|_{\mathrm{op}}BQ​=supi​∥Qi​∥op​, where ∥⋅∥op\|\cdot\|_{\mathrm{op}}∥⋅∥op​ is the operator norm for Euclidean vector norms. For arbitrary real ε,δ\varepsilon,\deltaε,δ, the function returns

n3+nlog⁡(δ−1)ε4(2nBQ2)4.\frac{n^3+n\log(\delta^{-1})}{\varepsilon^4} \left(2^nB_Q^2\right)^4.ε4n3+nlog(δ−1)​(2nBQ2​)4.

Real inversion sends 000 to 000, and the real logarithm satisfies log⁡0=0\log0=0log0=0 and log⁡x=ln⁡∣x∣\log x=\ln|x|logx=ln∣x∣ for nonzero xxx. In particular, the value is 000 when ε=0\varepsilon=0ε=0, and also when n=0n=0n=0.

QAlgorithms.Papers.Independent.Extend50.P46.hamiltonianCoeff

For every natural number nnn, arbitrary complex matrix HHH indexed by nnn-bit strings, and assignment A:{0,…,n−1}→{I,X,Y,Z}A:\{0,\ldots,n-1\}\to\{I,X,Y,Z\}A:{0,…,n−1}→{I,X,Y,Z}, the function returns

2−nRe⁡tr⁡(HPA).2^{-n}\operatorname{Re}\operatorname{tr}(HP_A).2−nRetr(HPA​).

Here PAP_APA​ is the tensor product of the assigned single-qubit matrices I2I_2I2​, X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), Y=(0−ii0)Y=\begin{pmatrix}0&-\mathrm i\\\mathrm i&0\end{pmatrix}Y=(0i​−i0​), and Z=(100−1)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}Z=(10​0−1​). There is no Hermiticity assumption on HHH. When n=0n=0n=0, PAP_APA​ is the scalar identity, and the result is the real part of the sole entry of HHH.

QAlgorithms.Papers.Independent.Extend50.P46.hamiltonianDensityFlow

For every natural number nnn, arbitrary complex matrices H,ρH,\rhoH,ρ indexed by nnn-bit strings, and real number ttt, the function returns

exp⁡(−itH) ρ exp⁡(itH),\exp(-\mathrm i tH)\,\rho\,\exp(\mathrm i tH),exp(−itH)ρexp(itH),

with exp⁡\expexp denoting the matrix exponential. No Hermiticity, positivity, or trace condition is imposed on either matrix, and ttt may be zero or negative. At t=0t=0t=0 the result is ρ\rhoρ; when n=0n=0n=0, the matrices are scalars and the result is also ρ\rhoρ.

QAlgorithms.Papers.Independent.Extend50.P46.likelihoodParameter

For every natural number nnn, including 000, and every finite set SSS of pairs of Pauli assignments on nnn sites, this defines the real supremum of all values

1∣S∣∑p∈S(Re⁡⟨ψ,Kρ(Hp)ψ⟩Re⁡⟨ψ,(R⊗I)ψ⟩)2.\frac1{|S|}\sum_{p\in S} \left( \frac{\operatorname{Re}\langle\psi,K_\rho(H_p)\psi\rangle} {\operatorname{Re}\langle\psi,(R\otimes I)\psi\rangle} \right)^2.∣S∣1​p∈S∑​(Re⟨ψ,(R⊗I)ψ⟩Re⟨ψ,Kρ​(Hp​)ψ⟩​)2.

Here PA=⨂qA(q)P_A=\bigotimes_q A(q)PA​=⨂q​A(q) and H(A,B)=PA⊗PBH_{(A,B)}=P_A\otimes P_BH(A,B)​=PA​⊗PB​, where each A(q),B(q)A(q),B(q)A(q),B(q) belongs to {I,X,Y,Z}\{I,X,Y,Z\}{I,X,Y,Z}; the values range over every natural number aaa, every positive semidefinite trace-one matrix ρ\rhoρ on {0,1}a×{0,1}n\{0,1\}^a\times\{0,1\}^n{0,1}a×{0,1}n, and every unit vector ψ\psiψ in that space for which the denominator is strictly positive. The matrices in the formula are defined by Ru,u′=∑zρ(u,z),(u′,z)R_{u,u'}=\sum_z\rho_{(u,z),(u',z)}Ru,u′​=∑z​ρ(u,z),(u′,z)​ and

Kρ(O)(u,w),(u′,w′)=∑i,jρ(u,i),(u′,j)O(i,w),(j,w′).K_\rho(O)_{(u,w),(u',w')} =\sum_{i,j}\rho_{(u,i),(u',j)}O_{(i,w),(j,w')}.Kρ​(O)(u,w),(u′,w′)​=i,j∑​ρ(u,i),(u′,j)​O(i,w),(j,w′)​.

All bit-string sums range over strings of the indicated lengths, including the unique empty string for a zero-bit register. The real supremum operation returns 000 for an empty or unbounded-above set, and the reciprocal of 000 is defined as 000; in particular, an empty SSS gives parameter 000.

QAlgorithms.Papers.Independent.Extend50.P46.likelihoodValues

For every natural number nnn, including 000, and every finite set SSS of pairs of Pauli assignments A,B:{0,…,n−1}→{I,X,Y,Z}A,B:\{0,\ldots,n-1\}\to\{I,X,Y,Z\}A,B:{0,…,n−1}→{I,X,Y,Z}, this defines the set of real numbers vvv for which there exist a natural number aaa, a positive semidefinite complex matrix ρ\rhoρ of trace 111 on {0,1}a×{0,1}n\{0,1\}^a\times\{0,1\}^n{0,1}a×{0,1}n, and a vector ψ\psiψ in the same space with ∥ψ∥2=1\|\psi\|_2=1∥ψ∥2​=1, satisfying the following formula. Write PA=⨂qA(q)P_A=\bigotimes_q A(q)PA​=⨂q​A(q), H(A,B)=PA⊗PBH_{(A,B)}=P_A\otimes P_BH(A,B)​=PA​⊗PB​, define Ru,u′=∑zρ(u,z),(u′,z)R_{u,u'}=\sum_z\rho_{(u,z),(u',z)}Ru,u′​=∑z​ρ(u,z),(u′,z)​, and define

Kρ(O)(u,w),(u′,w′)=∑i,j∈{0,1}nρ(u,i),(u′,j)O(i,w),(j,w′).K_\rho(O)_{(u,w),(u',w')} =\sum_{i,j\in\{0,1\}^n}\rho_{(u,i),(u',j)}O_{(i,w),(j,w')}.Kρ​(O)(u,w),(u′,w′)​=i,j∈{0,1}n∑​ρ(u,i),(u′,j)​O(i,w),(j,w′)​.

Then the witnesses must satisfy

D=Re⁡⟨ψ,(R⊗I)ψ⟩>0,v=1∣S∣∑p∈S(Re⁡⟨ψ,Kρ(Hp)ψ⟩D)2.D=\operatorname{Re}\langle\psi,(R\otimes I)\psi\rangle>0, \qquad v=\frac1{|S|}\sum_{p\in S} \left(\frac{\operatorname{Re}\langle\psi,K_\rho(H_p)\psi\rangle}{D}\right)^2.D=Re⟨ψ,(R⊗I)ψ⟩>0,v=∣S∣1​p∈S∑​(DRe⟨ψ,Kρ​(Hp​)ψ⟩​)2.

The integer aaa has no upper bound and may be 000; zero-bit registers have one basis element and empty Pauli tensor products are identities. The strict condition D>0D>0D>0 excludes zero denominators in these ratios. When SSS is empty, the sum and the defined reciprocal of ∣S∣|S|∣S∣ are both 000, and the resulting set is {0}\{0\}{0}.

QAlgorithms.Papers.Independent.Extend50.P46.normalizedChoiMatrix

For any natural numbers din,doutd_{\mathrm{in}},d_{\mathrm{out}}din​,dout​, including zero, and any complex-linear map N:Mdin(C)→Mdout(C)N:M_{d_{\mathrm{in}}}(\mathbb C)\to M_{d_{\mathrm{out}}}(\mathbb C)N:Mdin​​(C)→Mdout​​(C), define a matrix JNJ_NJN​ whose rows and columns are indexed by pairs in {0,…,din−1}×{0,…,dout−1}\{0,\ldots,d_{\mathrm{in}}-1\}\times\{0,\ldots,d_{\mathrm{out}}-1\}{0,…,din​−1}×{0,…,dout​−1} as follows: start with the matrix indexed by pairs of input indices whose (p,q)(p,q)(p,q)-entry is din−1d_{\mathrm{in}}^{-1}din−1​ if both coordinates of ppp coincide and both coordinates of qqq coincide, and is zero otherwise; apply NNN to each block obtained by fixing the first row and column coordinates. Equivalently, writing EijE_{ij}Eij​ for the input matrix with a single 111 in position (i,j)(i,j)(i,j),

JN((i,x),(j,y))=1din(N(Eij))xy.J_N\bigl((i,x),(j,y)\bigr) =\frac{1}{d_{\mathrm{in}}}\bigl(N(E_{ij})\bigr)_{xy}.JN​((i,x),(j,y))=din​1​(N(Eij​))xy​.

No channel or positivity assumption is imposed on NNN. If either dimension is zero, JNJ_NJN​ has an empty index set; the inverse of zero used in the definition is zero.

QAlgorithms.Papers.Independent.Extend50.P46.pauliCoefficientProbe

For every natural number nnn and assignments A,B:{0,…,n−1}→{I,X,Y,Z}A,B:\{0,\ldots,n-1\}\to\{I,X,Y,Z\}A,B:{0,…,n−1}→{I,X,Y,Z}, the function returns the complex matrix on nnn-bit strings

2−n(I2n+i2(PAPB−PBPA)),2^{-n}\left(I_{2^n}+\frac{\mathrm i}{2}(P_AP_B-P_BP_A)\right),2−n(I2n​+2i​(PA​PB​−PB​PA​)),

where PAP_APA​ and PBP_BPB​ are the respective tensor products of I2I_2I2​, X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), Y=(0−ii0)Y=\begin{pmatrix}0&-\mathrm i\\\mathrm i&0\end{pmatrix}Y=(0i​−i0​), and Z=(100−1)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}Z=(10​0−1​). The assignments may coincide or contain only identity symbols. If their matrices commute, the result is 2−nI2n2^{-n}I_{2^n}2−nI2n​; for n=0n=0n=0, it is the scalar 111.

QAlgorithms.Papers.Independent.Extend50.P46.predict

For every natural number nnn, every complex vector-space basis Q=(Qi)0≤i<4nQ=(Q_i)_{0\le i<4^n}Q=(Qi​)0≤i<4n​ of the complex matrices indexed by nnn-bit strings satisfying Qi†=QiQ_i^\dagger=Q_iQi†​=Qi​ and tr⁡(QiQj)=δij\operatorname{tr}(Q_iQ_j)=\delta_{ij}tr(Qi​Qj​)=δij​, every real 4n×4n4^n\times4^n4n×4n matrix rrr, and every pair of complex matrices ρ,O\rho,Oρ,O indexed by those strings, this definition returns

predict⁡(Q,r,ρ,O)=∑i=04n−1∑j=04n−1Re⁡tr⁡(QiO)  rij  Re⁡tr⁡(Qjρ).\operatorname{predict}(Q,r,\rho,O)= \sum_{i=0}^{4^n-1}\sum_{j=0}^{4^n-1} \operatorname{Re}\operatorname{tr}(Q_iO)\;r_{ij}\; \operatorname{Re}\operatorname{tr}(Q_j\rho).predict(Q,r,ρ,O)=i=0∑4n−1​j=0∑4n−1​Retr(Qi​O)rij​Retr(Qj​ρ).

There are no additional conditions on r,ρ,Or,\rho,Or,ρ,O; in particular, ρ\rhoρ need not be a density matrix. The value n=0n=0n=0 is included, with one summand.

QAlgorithms.Papers.Independent.Extend50.P46.predictOn

For every natural number nnn, every complex vector-space basis Q=(Qi)0≤i<4nQ=(Q_i)_{0\le i<4^n}Q=(Qi​)0≤i<4n​ of the complex matrices indexed by nnn-bit strings satisfying Qi†=QiQ_i^\dagger=Q_iQi†​=Qi​ and tr⁡(QiQj)=δij\operatorname{tr}(Q_iQ_j)=\delta_{ij}tr(Qi​Qj​)=δij​, every finite set S⊆{0,…,4n−1}2S\subseteq\{0,\ldots,4^n-1\}^2S⊆{0,…,4n−1}2, every real 4n×4n4^n\times4^n4n×4n matrix rrr, and every pair of complex matrices ρ,O\rho,Oρ,O indexed by those strings, this definition returns

predictOn⁡(Q,S,r,ρ,O)=∑(i,j)∈SRe⁡tr⁡(QiO)  rij  Re⁡tr⁡(Qjρ).\operatorname{predictOn}(Q,S,r,\rho,O)= \sum_{(i,j)\in S} \operatorname{Re}\operatorname{tr}(Q_iO)\;r_{ij}\; \operatorname{Re}\operatorname{tr}(Q_j\rho).predictOn(Q,S,r,ρ,O)=(i,j)∈S∑​Retr(Qi​O)rij​Retr(Qj​ρ).

No further conditions are imposed on S,r,ρ,OS,r,\rho,OS,r,ρ,O. The sum is 000 when SSS is empty, and n=0n=0n=0 is allowed.

QAlgorithms.Papers.Independent.Extend50.P46.predictPauli

For every natural number nnn, every real matrix rrr indexed by pairs of Pauli strings A,B∈{I,X,Y,Z}nA,B\in\{I,X,Y,Z\}^nA,B∈{I,X,Y,Z}n, and every pair of complex matrices ρ,O\rho,Oρ,O indexed by nnn-bit strings, this definition returns

predictPauli⁡(r,ρ,O)=∑A∈{I,X,Y,Z}n∑B∈{I,X,Y,Z}n(2−nRe⁡tr⁡(PAO))rA,BRe⁡tr⁡(PBρ),\operatorname{predictPauli}(r,\rho,O)= \sum_{A\in\{I,X,Y,Z\}^n}\sum_{B\in\{I,X,Y,Z\}^n} \left(2^{-n}\operatorname{Re}\operatorname{tr}(P_AO)\right) r_{A,B}\operatorname{Re}\operatorname{tr}(P_B\rho),predictPauli(r,ρ,O)=A∈{I,X,Y,Z}n∑​B∈{I,X,Y,Z}n∑​(2−nRetr(PA​O))rA,B​Retr(PB​ρ),

where PA=⨂q=0n−1AqP_A=\bigotimes_{q=0}^{n-1}A_qPA​=⨂q=0n−1​Aq​ and PB=⨂q=0n−1BqP_B=\bigotimes_{q=0}^{n-1}B_qPB​=⨂q=0n−1​Bq​, using the usual single-qubit Pauli matrices without additional phases. No Hermiticity, positivity, normalization, or channel condition is required of the inputs. When n=0n=0n=0, each Pauli indexing set is a singleton and its tensor product is the 1×11\times11×1 identity.

QAlgorithms.Papers.Independent.Extend50.P46.ptm

For every natural number nnn, let Hn={0,1}nH_n=\{0,1\}^nHn​={0,1}n, including the singleton consisting of the empty bit string when n=0n=0n=0, and let NNN be a complex linear map on the complex matrices indexed by HnH_nHn​, equipped with the following channel property: there exist a natural number mmm and matrices E0,…,Em−1E_0,\ldots,E_{m-1}E0​,…,Em−1​ such that ∑ℓ=0m−1Eℓ†Eℓ=I\sum_{\ell=0}^{m-1}E_\ell^\dagger E_\ell=I∑ℓ=0m−1​Eℓ†​Eℓ​=I and N(X)=∑ℓ=0m−1EℓXEℓ†N(X)=\sum_{\ell=0}^{m-1}E_\ell X E_\ell^\daggerN(X)=∑ℓ=0m−1​Eℓ​XEℓ†​ for every matrix XXX. The definition returns the real matrix indexed by strings A,B∈{I,X,Y,Z}nA,B\in\{I,X,Y,Z\}^nA,B∈{I,X,Y,Z}n whose entries are

ptm⁡(N)A,B=2−nRe⁡tr⁡ ⁣(PAN(PB)),\operatorname{ptm}(N)_{A,B}=2^{-n}\operatorname{Re}\operatorname{tr}\!\bigl(P_A N(P_B)\bigr),ptm(N)A,B​=2−nRetr(PA​N(PB​)),

where PA=⨂q=0n−1AqP_A=\bigotimes_{q=0}^{n-1}A_qPA​=⨂q=0n−1​Aq​, using the usual single-qubit Pauli matrices and no additional phase. For n=0n=0n=0, the tensor product is the 1×11\times11×1 identity and there is one Pauli index.

QAlgorithms.Papers.Independent.Extend50.P46.shadowParameter

For every natural number nnn, including 000, and every finite set SSS of pairs of functions from {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} to the Pauli matrices {I,X,Y,Z}\{I,X,Y,Z\}{I,X,Y,Z}, this defines a real number as follows. For such a function AAA, write PA=⨂q=0n−1A(q)P_A=\bigotimes_{q=0}^{n-1}A(q)PA​=⨂q=0n−1​A(q), with no additional phase, and put H(A,B)=PA⊗PBH_{(A,B)}=P_A\otimes P_BH(A,B)​=PA​⊗PB​. The defined number is

sup⁡{1∣S∣∑p∈S(Re⁡⟨ψ,Hpψ⟩)2:ψ∈C{0,1}n×{0,1}n, ∥ψ∥2=1}.\sup\left\{\frac1{|S|}\sum_{p\in S} \left(\operatorname{Re}\langle\psi,H_p\psi\rangle\right)^2: \psi\in\mathbb C^{\{0,1\}^n\times\{0,1\}^n},\ \|\psi\|_2=1\right\}.sup⎩⎨⎧​∣S∣1​p∈S∑​(Re⟨ψ,Hp​ψ⟩)2:ψ∈C{0,1}n×{0,1}n, ∥ψ∥2​=1⎭⎬⎫​.

Here the supremum is the real-valued supremum operation, whose value is 000 for an empty or unbounded-above set; division by zero is also defined to give 000. In particular, when SSS is empty, the defined number is 000. When n=0n=0n=0, each bit-string register has one basis element and each empty tensor product PAP_APA​ is the scalar identity.

QAlgorithms.Papers.Independent.Extend50.P46.shadowValues

For every natural number nnn and finite set SSS of ordered pairs (A,B)(A,B)(A,B) of assignments from {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} to {I,X,Y,Z}\{I,X,Y,Z\}{I,X,Y,Z}, the function returns the set of real numbers

{1∣S∣∑(A,B)∈S(Re⁡⟨ψ,(PA⊗PB)ψ⟩)2: ψ∈CBn×Bn, ∥ψ∥2=1},Bn={0,1}n.\left\{ \frac{1}{|S|} \sum_{(A,B)\in S} \left(\operatorname{Re}\langle\psi,(P_A\otimes P_B)\psi\rangle\right)^2 :\ \psi\in\mathbb C^{\mathcal B_n\times\mathcal B_n},\ \|\psi\|_2=1 \right\}, \qquad \mathcal B_n=\{0,1\}^n.⎩⎨⎧​∣S∣1​(A,B)∈S∑​(Re⟨ψ,(PA​⊗PB​)ψ⟩)2: ψ∈CBn​×Bn​, ∥ψ∥2​=1⎭⎬⎫​,Bn​={0,1}n.

The inner product is conjugate-linear in its first argument, and matrix action is ordinary matrix-vector multiplication. Each PAP_APA​ is the tensor product of the assigned matrices I2I_2I2​, X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), Y=(0−ii0)Y=\begin{pmatrix}0&-\mathrm i\\\mathrm i&0\end{pmatrix}Y=(0i​−i0​), and Z=(100−1)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}Z=(10​0−1​). No restriction excludes all-identity assignments from SSS. The reciprocal of zero is defined as zero, so S=∅S=\varnothingS=∅ gives the set {0}\{0\}{0}. The case n=0n=0n=0 is included, with empty tensor products equal to 111.

QAlgorithms.Papers.Independent.Extend50.P46.signedPauli

For every natural number nnn, Boolean bbb, and ordered pair (A,B)(A,B)(A,B) of assignments from {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} to {I,X,Y,Z}\{I,X,Y,Z\}{I,X,Y,Z}, the function returns the matrix on pairs of nnn-bit strings

σb(PA⊗PB),σb={−1b=true,1b=false.\sigma_b(P_A\otimes P_B), \qquad \sigma_b=\begin{cases}-1&b=\mathrm{true},\\1&b=\mathrm{false}.\end{cases}σb​(PA​⊗PB​),σb​={−11​b=true,b=false.​

Here PAP_APA​ and PBP_BPB​ are tensor products of the assigned matrices I2I_2I2​, X=(0110)X=\begin{pmatrix}0&1\\1&0\end{pmatrix}X=(01​10​), Y=(0−ii0)Y=\begin{pmatrix}0&-\mathrm i\\\mathrm i&0\end{pmatrix}Y=(0i​−i0​), and Z=(100−1)Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}Z=(10​0−1​). Either assignment may be all identity. For n=0n=0n=0, both empty tensor products are 111, so the result is the scalar σb\sigma_bσb​.

QAlgorithms.Papers.Independent.Extend50.P46.singleSite

For every natural number nnn, index j∈{0,…,n−1}j\in\{0,\ldots,n-1\}j∈{0,…,n−1}, and symbol b∈{I,X,Y,Z}b\in\{I,X,Y,Z\}b∈{I,X,Y,Z}, the function returns the assignment A:{0,…,n−1}→{I,X,Y,Z}A:\{0,\ldots,n-1\}\to\{I,X,Y,Z\}A:{0,…,n−1}→{I,X,Y,Z} given by Aj=bA_j=bAj​=b and Ak=IA_k=IAk​=I for every k≠jk\ne jk=j. The choice b=Ib=Ib=I produces the all-identity assignment. When n=0n=0n=0, there is no admissible index jjj.

QAlgorithms.Papers.Independent.Extend50.P46.softFactor

For natural numbers p,np,np,n and arbitrary real numbers ε,δ,λ\varepsilon,\delta,\lambdaε,δ,λ, the function returns

(1+log⁡(n+2)+∣log⁡ε∣+∣log⁡δ∣+log⁡(max⁡{1,λ}))p.\left(1+\log(n+2)+|\log\varepsilon|+|\log\delta|+\log(\max\{1,\lambda\})\right)^p.(1+log(n+2)+∣logε∣+∣logδ∣+log(max{1,λ}))p.

Here λ\lambdaλ is the argument called scale. The real logarithm is defined at every real argument: log⁡0=0\log 0=0log0=0, and log⁡x=ln⁡∣x∣\log x=\ln|x|logx=ln∣x∣ for x≠0x\ne0x=0. Thus no positivity assumption is imposed on ε,δ\varepsilon,\deltaε,δ, or λ\lambdaλ; the scale contribution is zero whenever λ≤1\lambda\le1λ≤1. The definition includes n=0n=0n=0 and returns 111 whenever p=0p=0p=0.

QAlgorithms.Papers.Independent.Extend50.P46.sparseEnsemble

For every natural number nnn, the function returns the finite set of all ordered pairs (A,B)(A,B)(A,B) of assignments from {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1} to {I,X,Y,Z}\{I,X,Y,Z\}{I,X,Y,Z} such that neither assignment is the all-identity assignment. Thus some index has Aq≠IA_q\ne IAq​=I, and some index, possibly different, has Bq≠IB_q\ne IBq​=I. For n=0n=0n=0, the set is empty.

QAlgorithms.Papers.Independent.Extend50.P46.sparseEnsembleValid

For every natural number nnn, including 000, and finite set SSS of pairs of Pauli assignments on nnn sites, write PA=⨂qA(q)P_A=\bigotimes_q A(q)PA​=⨂q​A(q) with A(q)∈{I,X,Y,Z}A(q)\in\{I,X,Y,Z\}A(q)∈{I,X,Y,Z} and Hb,(A,B)=(−1)b(PA⊗PB)H_{b,(A,B)}=(-1)^b(P_A\otimes P_B)Hb,(A,B)​=(−1)b(PA​⊗PB​) for Boolean bbb. This defines the proposition that, for every p∈Sp\in Sp∈S and both values of bbb, Hb,pH_{b,p}Hb,p​ is Hermitian, Hb,p 2=IH_{b,p}^{\,2}=IHb,p2​=I, Tr⁡Hb,p=0\operatorname{Tr}H_{b,p}=0TrHb,p​=0, H¬b,p=−Hb,pH_{\neg b,p}=-H_{b,p}H¬b,p​=−Hb,p​, and both partial traces vanish:

∑h∈{0,1}n(Hb,p)(j,h),(k,h)=0for every j,k,∑x∈{0,1}n(Hb,p)(x,y),(x,z)=0for every y,z.\sum_{h\in\{0,1\}^n}(H_{b,p})_{(j,h),(k,h)}=0 \quad\text{for every }j,k, \qquad \sum_{x\in\{0,1\}^n}(H_{b,p})_{(x,y),(x,z)}=0 \quad\text{for every }y,z.h∈{0,1}n∑​(Hb,p​)(j,h),(k,h)​=0for every j,k,x∈{0,1}n∑​(Hb,p​)(x,y),(x,z)​=0for every y,z.

The first sum traces out the second register and the second sum traces out the first register. The proposition holds vacuously for empty SSS. For n=0n=0n=0, each register has one basis element and the trace-zero condition forces SSS to be empty.

QAlgorithms.Papers.Independent.Extend50.P46.sparseListGood

For any finite index type III, real matrices r,t∈RI×Ir,t\in\mathbb R^{I\times I}r,t∈RI×I, real number ε\varepsilonε, and natural number sss, define L={(i,j)∈I×I:ε/2<∣rij∣}L=\{(i,j)\in I\times I:\varepsilon/2<|r_{ij}|\}L={(i,j)∈I×I:ε/2<∣rij​∣}. The predicate holds exactly when all four conditions hold: ∣tij∣≤ε|t_{ij}|\le\varepsilon∣tij​∣≤ε for every (i,j)∉L(i,j)\notin L(i,j)∈/L; ε/6<∣tij∣\varepsilon/6<|t_{ij}|ε/6<∣tij​∣ for every (i,j)∈L(i,j)\in L(i,j)∈L; ∣L∣≤s|L|\le s∣L∣≤s; and ∣rij−tij∣≤ε|r_{ij}-t_{ij}|\le\varepsilon∣rij​−tij​∣≤ε for every (i,j)∈L(i,j)\in L(i,j)∈L. The threshold defining LLL is strict, so equality ∣rij∣=ε/2|r_{ij}|=\varepsilon/2∣rij​∣=ε/2 places the entry outside LLL. If III is empty, the predicate always holds; if III is nonempty and ε<0\varepsilon<0ε<0, it cannot hold.

QAlgorithms.Papers.Independent.Extend50.P46.supportCount

For every finite type III, equipped with a finite enumeration, and every function f:I→Rf:I\to\mathbb Rf:I→R, this definition returns the natural number

supportCount⁡(f)=∣{i∈I:f(i)≠0}∣.\operatorname{supportCount}(f)=|\{i\in I:f(i)\ne0\}|.supportCount(f)=∣{i∈I:f(i)=0}∣.

It counts indices with an exactly nonzero value; if III is empty, the result is 000.

QAlgorithms.Papers.Independent.Extend50.P46.tableGood

For every type III, every pair of real matrices r,tr,tr,t indexed by I×II\times II×I, and every real number ε\varepsilonε, this predicate means

∀i,j∈I,∣rij−tij∣≤ε.\forall i,j\in I,\qquad |r_{ij}-t_{ij}|\le\varepsilon.∀i,j∈I,∣rij​−tij​∣≤ε.

No finiteness assumption on III or nonnegativity assumption on ε\varepsilonε is included. If III is empty, the predicate holds vacuously for all inputs; if III is nonempty and ε<0\varepsilon<0ε<0, it cannot hold.

QAlgorithms.Papers.Independent.Extend50.P46.tm

For every natural number nnn, let Q=(Qi)0≤i<4nQ=(Q_i)_{0\le i<4^n}Q=(Qi​)0≤i<4n​ be a complex vector-space basis of the complex matrices indexed by nnn-bit strings, with every QiQ_iQi​ Hermitian and tr⁡(QiQj)=δij\operatorname{tr}(Q_iQ_j)=\delta_{ij}tr(Qi​Qj​)=δij​, and let NNN be a complex linear map on these matrices equipped with a finite Kraus representation: for some natural number mmm and matrices EℓE_\ellEℓ​, ∑ℓ<mEℓ†Eℓ=I\sum_{\ell<m}E_\ell^\dagger E_\ell=I∑ℓ<m​Eℓ†​Eℓ​=I and N(X)=∑ℓ<mEℓXEℓ†N(X)=\sum_{\ell<m}E_\ell X E_\ell^\daggerN(X)=∑ℓ<m​Eℓ​XEℓ†​ for every XXX. This definition returns the real 4n×4n4^n\times4^n4n×4n matrix

tm⁡(Q,N)ij=Re⁡tr⁡ ⁣(QiN(Qj)).\operatorname{tm}(Q,N)_{ij}=\operatorname{Re}\operatorname{tr}\!\bigl(Q_iN(Q_j)\bigr).tm(Q,N)ij​=Retr(Qi​N(Qj​)).

The definition includes n=0n=0n=0, when the returned matrix has one row and one column.

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

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 30, 2026

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

View graph

Get started

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

About Prove2Me

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

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me