Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Definitions for Matchgates and classical simulation of quantum circuits

Definition
QAlgorithms_Papers_Independent_Intakethird100_P77

by Gohan · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

The objects the formalized statements of Matchgates and classical simulation of quantum circuits (arXiv:0804.4050) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • tupleCode: PDF p.3 numerical convention: unambiguous tuple code; a unary field length precedes each field, including a possibly empty last field.
  • binaryNat: PDF p.3: binary, most significant digit first, with arbitrary leading zeroes.
  • dyadic: PDF p.3: signed dyadic output. The first bit is a sign, remaining bits are the numerator, and m specifies the denominator. Empty output decodes to zero.
  • EffectiveCode: PDF p.3: exact finite metadata must be produced by a genuine polynomial-time multi-stack Turing computation, with its polynomial uniform over all inputs.
  • EffectiveNumbers: PDF pp.3,9--10: finite continuous data are supplied to requested precision by one bit-machine. Both real and imaginary parts are charged; the item index and precision are unary and the instance description is a length-delimited field. No running-time claim is made for arbitrary uncomputable complex numbers.
  • StrongSimulation: PDF p.3: a single classical simulator computes either one-wire probability to m binary digits. Its machine and time polynomial are selected before the instance, precision, existing output wire and outcome bit.
  • SelectedStrongSimulation: PDF pp.3,10,13: strong simulation of the selected one-wire measurement. Only that observable needs a bounded-degree representation. The output wire is included in the family's effective metadata, before the precision request.
  • entries: PDF pp.2,9: finite list of entries of a one-qubit matrix, row order 0,1.
  • parityGate: PDF p.2 Eq.(1): even block is ordered 00,11 and odd block 01,10.
  • ParityApp: PDF p.2: a placed parity-preserving unitary; determinant equality is a separate predicate so that the dropped-constraint result uses the same object.
  • ParityApp.Allowable: PDF p.2: the defining determinant condition on an allowable matchgate.
  • ParityApp.toGateApp: PDF pp.2,4: actual placed gate in the accepted circuit model.
  • parityCircuit: PDF pp.2,4: list order is time order; the first matrix is rightmost.
  • RangeBound: PDF pp.2,4,6: a fixed ordered path, with each gate spanning at most r edges.
  • ParityFamily: PDF pp.2--3: a circuit family parameterized by finite classical instance descriptions. Polynomial-time metadata bounds both wire count and gate count.
  • ParityFamily.code: PDF p.3: complete finite structural description, using unary wire indices.
  • ParityFamily.data: PDF pp.2--3: all local gate entries, with no uncharged numerical oracle.
  • ParityFamily.Effective: PDF p.3 uniformity and numerical-description convention.
  • ProductInputs: PDF pp.2,9--10: normalized single-qubit factors; no parity constraint.
  • ProductInputs.data: PDF pp.3,10: all input amplitudes are part of the charged description.
  • singleWireProbability: PDF p.2: Born probability for one final computational-basis measurement.
  • productOperator: PDF p.10: tensor product of one-qubit operators with wire 0 leftmost.
  • zOperator: PDF pp.2,10: Pauli Z on an existing wire.
  • outputExpectation: PDF pp.2,9: the exact expectation in a circuit's final state.
  • quadraticHamiltonian: PDF p.8 Eq.(7): real skew coefficients; both ordered off-diagonal terms are summed, with no factor 1/2 and no additive scalar Hamiltonian.
  • gaussianOperation: PDF p.9: Gaussian operation with the paper's positive exponent sign.
  • Skew: PDF pp.8--9: antisymmetry is stated entrywise over the reals.
  • IsMajoranaRotation: PDF p.9: SO(2n) with both orthogonality and determinant one.
  • majoranaWord: PDF p.8 Eq.(6): ordered Majorana products, including the empty word.
  • CARPolynomial: PDF pp.8,10: a canonical square-free polynomial given by its nonzero or explicitly zero coefficients. Each word is strictly ordered and occurs once.
  • CARPolynomial.eval: PDF p.8: evaluation of the supplied canonical polynomial.
  • CARPolynomial.DegreeLE: PDF p.10: degree at most d, allowing a constant/empty monomial.
  • gaussianCircuit: PDF pp.9--10: circuit and its induced Heisenberg rotation.
  • circuitRotation: PDF pp.9--10: the Heisenberg rotations are composed in reverse list order.
  • expandedWord: PDF p.10 Eq.(9), general form: expansion indices may repeat; CAR reduction is performed after expansion, rather than deleting repeated tuples.
  • GaussianFamily: PDF pp.9--10: Gaussian circuit data for an effectively given product-operator representation. The factors of every generator are supplied, not inferred from an arbitrary matrix description. Only the selected measured Z is represented; other wires need not have bounded-degree or efficient polynomial descriptions.
  • GaussianFamily.code: PDF pp.3,8--10: all polynomial words and gate counts form finite metadata.
  • GaussianFamily.data: PDF pp.3,9--10: generator factors, Gaussian coefficients, and observable coefficients are all charged. Structural size is charged by the metadata.
  • GaussianFamily.Effective: PDF p.3: effective uniform Gaussian family with the full description cost.
  • jordanWigner: PDF p.10 Eq.(10): zero-based Majorana index 2k is ZX and 2k+1 is ZY. Initial Z's occupy exactly the wires strictly preceding k.
  • JWFamily: PDF pp.10--11: global Jordan--Wigner Gaussian gates, each specified by all quadratic coefficients rather than a dense exponential-size operator.
  • JWFamily.code: PDF pp.3,10: structural cost of a Jordan--Wigner Gaussian family.
  • JWFamily.data: PDF pp.3,10: all real Gaussian coefficients are supplied effectively.
  • JWFamily.Effective: PDF p.3 uniformity including Gaussian numerical descriptions.
  • SupportedOnPair: PDF p.11: only the four Majoranas on a specified existing adjacent pair may occur in its local quadratic Hamiltonian.
  • pairMajor: PDF p.12 Eq.(11) on a specified adjacent pair; a=0,1 indexes that pair.
  • modifiedSwap: PDF p.12 Eq.(11), copied as an exponential, including its scalar phase.
  • SourceStep: PDF pp.4--5: nearest-neighbour CZ and arbitrary one-qubit normal form; constant gate overhead is relative to this presentation.
  • SourceStep.toGateApp: PDF pp.4--5: exact denotation of the source presentation.
  • sourceCircuit: PDF p.4: source circuit matrix, with input-independent gates.
  • SourceFamily: PDF pp.4--5: a uniformly described normal-form family.
  • SourceFamily.code: PDF p.4: all source arities, tags and wire positions are charged.
  • SourceFamily.data: PDF pp.4--5: numerical source data are the one-qubit matrices.
  • SourceFamily.Effective: PDF pp.3--5: uniformity includes gate-parameter description costs.
  • encodeFourBits: PDF p.5: |0> maps to |0000> and |1> maps to |1001> in each block.
  • encodeTwoBits: PDF p.6: alternative pair encoding |0> maps to |00>, |1> to |11>.
  • encodeState: PDF pp.5--6: linear extension to every logical input, including entangled inputs. This is the actual constructed encoding, not an arbitrary isometry.
  • conjugatedGenerators: PDF pp.12--13: c'_mu=T† c_mu T, computed from the actual Clifford operation.
  • IntertwinedFamily: PDF pp.12--13: a Clifford-conjugated Gaussian family with available product factor and observable descriptions. Factors and polynomial identities describe source data; neither simulation nor Gaussian conjugation is assumed. Only the selected output observable is supplied or required to have bounded degree.
  • IntertwinedFamily.code: PDF pp.3,13: structural data for the bounded-degree transformed observable.
  • IntertwinedFamily.data: PDF pp.3,13: the effective description includes the actual transformed product factors, quadratic coefficients, and observable coefficients. Scalar phases of T need no description, since they cancel from every conjugation.
  • IntertwinedFamily.Effective: PDF pp.3,13: all information needed from T is effectively supplied by its conjugated product generators and polynomial observable; no dense T oracle.
  • permutationOperator: PDF p.14 Example 1: the actual operator permuting the fixed wire order.
  • EffectivePermutations: PDF p.14: one global relabeling, with an effective finite permutation list.
  • basisInput: PDF pp.3,16: computational-basis input followed by zero workspace. The decision-family type below requires enough wires to contain the input.
  • BasisDecisionFamily: PDF pp.3,16: one input-independent circuit and existing output wire for each input length, with the classical input followed by zero ancillas.
  • BasisDecisionFamily.Effective: PDF pp.3,16: the output wire description is charged along with all gates.
  • BasisDecisionFamily.Allowed: PDF pp.3,16: locality and determinant equality on every actual circuit.
  • BasisDecisionFamily.acceptance: PDF pp.3,16: output 1 denotes acceptance, for every classical input.
  • InP: PDF p.3: P as a characteristic function computed by the accepted polynomial-time finite Turing machine predicate (Cook/PvsNP provenance). This definition does not substitute an arbitrary language predicate for P.
  • InBoundedMatchgate: PDF p.3: the specified bounded-error matchgate language class, with worst-case success >=2/3 on every computational-basis input.
  • InPQPMatchgate: PDF p.16: V_r under the symmetric PQP majority-gap conditions. Polynomial padding is explicit: one polynomial exponent is chosen before all inputs, and is >=2 even at length zero. This avoids the impossible literal n=0 gap.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Circuit
import Definitions.Def_QAlgorithms_Defs_Measurement
import Definitions.Def_QAlgorithms_Defs_Complexity
import Definitions.Def_QAlgorithms_Defs_ProjectiveCliffords
import Definitions.Def_QAlgorithms_Papers_Independent_Advance50_P19
import Definitions.Def_QAlgorithms_Papers_Independent_Information100_P32

/-!
Jozsa--Miyake, arXiv:0804.4050v2. Page numbers below are PDF pages.
The accepted CARSystem is reused solely as a representation interface, and the
accepted generic Op is specialized to the qubit basis; no parity
restriction on states, Gaussian-channel theorem, or covariance predicate is used.
Paper-local numerical descriptions are polynomial-time binary transducers, not
exact-real primitives. Binary precision is equivalent to decimal digits with a
constant rescaling. Source corrections are recorded in HARD.md.
Compilation and independent moderation are pending the batch handoff.
-/

noncomputable section

namespace QAlgorithms.Papers.Independent.Intakethird100.P77

open QAlgorithms
open QAlgorithms.Complexity (Str)
open QAlgorithms.Papers.Independent.Advance50.P19 (Major CARSystem)
open QAlgorithms.Papers.Independent.Information100.P32 (Op)
open scoped BigOperators Matrix ComplexConjugate

attribute [local instance] Classical.propDecidable Classical.decEq

/-- PDF p.3 numerical convention: unambiguous tuple code; a unary field length
precedes each field, including a possibly empty last field. -/
def tupleCode (xs : List Str) : Str :=
  xs.flatMap fun x => QAlgorithms.Complexity.encNat x.length ++ x

/-- PDF p.3: binary, most significant digit first, with arbitrary leading zeroes. -/
def binaryNat (w : Str) : ℕ :=
  w.foldl (fun a b => 2 * a + if b then 1 else 0) 0

/-- PDF p.3: signed dyadic output. The first bit is a sign, remaining bits are
the numerator, and m specifies the denominator. Empty output decodes to zero. -/
def dyadic (w : Str) (m : ℕ) : ℝ :=
  (if w.headD false then -(binaryNat w.tail : ℝ) else (binaryNat w.tail : ℝ)) /
    (2 : ℝ) ^ m

/-- PDF p.3: exact finite metadata must be produced by a genuine polynomial-time
multi-stack Turing computation, with its polynomial uniform over all inputs. -/
def EffectiveCode (code : Str → Str) : Prop :=
  QAlgorithms.Complexity.PolyTimeComputable code

/-- PDF pp.3,9--10: finite continuous data are supplied to requested precision
by one bit-machine. Both real and imaginary parts are charged; the item index
and precision are unary and the instance description is a length-delimited field.
No running-time claim is made for arbitrary uncomputable complex numbers. -/
def EffectiveNumbers (data : Str → List ℂ) : Prop :=
  ∃ f : Str → Str, QAlgorithms.Complexity.PolyTimeComputable f ∧
    ∀ s (j : Fin (data s).length) m b,
      |dyadic (f (tupleCode [s, QAlgorithms.Complexity.unary j.val,
          QAlgorithms.Complexity.unary m, [b]])) m -
        (if b then ((data s).get j).im else ((data s).get j).re)| ≤ (2 : ℝ)⁻¹ ^ m

/-- PDF p.3: a single classical simulator computes either one-wire probability
to m binary digits. Its machine and time polynomial are selected before the
instance, precision, existing output wire and outcome bit. -/
def StrongSimulation (width : Str → ℕ)
    (p : (s : Str) → Fin (width s) → Bool → ℝ) : Prop :=
  ∃ f : Str → Str, QAlgorithms.Complexity.PolyTimeComputable f ∧
    ∀ s m (k : Fin (width s)) b,
      |dyadic (f (tupleCode [s, QAlgorithms.Complexity.unary m,
          QAlgorithms.Complexity.unary k.val, [b]])) m - p s k b| ≤ (2 : ℝ)⁻¹ ^ m

/-- PDF pp.3,10,13: strong simulation of the selected one-wire measurement.
Only that observable needs a bounded-degree representation. The output wire is
included in the family's effective metadata, before the precision request. -/
def SelectedStrongSimulation (p : Str → Bool → ℝ) : Prop :=
  ∃ f : Str → Str, QAlgorithms.Complexity.PolyTimeComputable f ∧
    ∀ s m b,
      |dyadic (f (tupleCode [s, QAlgorithms.Complexity.unary m, [b]])) m -
        p s b| ≤ (2 : ℝ)⁻¹ ^ m

/-- PDF pp.2,9: finite list of entries of a one-qubit matrix, row order 0,1. -/
def entries (A : Matrix Bool Bool ℂ) : List ℂ :=
  [A false false, A false true, A true false, A true true]

/-- PDF p.2 Eq.(1): even block is ordered 00,11 and odd block 01,10. -/
def parityGate (A B : Matrix Bool Bool ℂ) : Matrix (Qubits 2) (Qubits 2) ℂ :=
  fun x y =>
    if xor (x 0) (x 1) = xor (y 0) (y 1) then
      if xor (x 0) (x 1) then B (x 0) (y 0) else A (x 0) (y 0)
    else 0

/-- PDF p.2: a placed parity-preserving unitary; determinant equality is a
separate predicate so that the dropped-constraint result uses the same object. -/
structure ParityApp (n : ℕ) where
  A : Matrix.unitaryGroup Bool ℂ
  B : Matrix.unitaryGroup Bool ℂ
  wires : Fin 2 ↪ Fin n

/-- PDF p.2: the defining determinant condition on an allowable matchgate. -/
def ParityApp.Allowable {n : ℕ} (g : ParityApp n) : Prop :=
  Matrix.det (g.A : Matrix Bool Bool ℂ) = Matrix.det (g.B : Matrix Bool Bool ℂ)

/-- PDF pp.2,4: actual placed gate in the accepted circuit model. -/
def ParityApp.toGateApp {n : ℕ} (g : ParityApp n) : GateApp Set.univ n :=
  ⟨⟨2, parityGate g.A g.B⟩, Set.mem_univ _, g.wires⟩

/-- PDF pp.2,4: list order is time order; the first matrix is rightmost. -/
def parityCircuit {n : ℕ} (c : List (ParityApp n)) : Circuit Set.univ n :=
  c.map ParityApp.toGateApp

/-- PDF pp.2,4,6: a fixed ordered path, with each gate spanning at most r edges. -/
def RangeBound {n : ℕ} (r : ℕ) (c : List (ParityApp n)) : Prop :=
  ∀ g ∈ c, Nat.dist (g.wires 0).val (g.wires 1).val ≤ r

/-- PDF pp.2--3: a circuit family parameterized by finite classical instance
descriptions. Polynomial-time metadata bounds both wire count and gate count. -/
structure ParityFamily where
  width : Str → ℕ
  gates : (s : Str) → List (ParityApp (width s))

/-- PDF p.3: complete finite structural description, using unary wire indices. -/
def ParityFamily.code (F : ParityFamily) (s : Str) : Str :=
  tupleCode ([QAlgorithms.Complexity.unary (F.width s),
    QAlgorithms.Complexity.unary (F.gates s).length] ++
    (F.gates s).map fun g => tupleCode
      [QAlgorithms.Complexity.unary (g.wires 0).val,
       QAlgorithms.Complexity.unary (g.wires 1).val])

/-- PDF pp.2--3: all local gate entries, with no uncharged numerical oracle. -/
def ParityFamily.data (F : ParityFamily) (s : Str) : List ℂ :=
  (F.gates s).flatMap fun g => entries g.A ++ entries g.B

/-- PDF p.3 uniformity and numerical-description convention. -/
def ParityFamily.Effective (F : ParityFamily) : Prop :=
  EffectiveCode F.code ∧ EffectiveNumbers F.data

/-- PDF pp.2,9--10: normalized single-qubit factors; no parity constraint. -/
structure ProductInputs (width : Str → ℕ) where
  factor : (s : Str) → Fin (width s) → EuclideanSpace ℂ Bool
  normalized : ∀ s i, IsState (factor s i)

/-- PDF pp.3,10: all input amplitudes are part of the charged description. -/
def ProductInputs.data {width : Str → ℕ} (I : ProductInputs width) (s : Str) : List ℂ :=
  (List.ofFn fun i : Fin (width s) => [I.factor s i false, I.factor s i true]).flatten

/-- PDF p.2: Born probability for one final computational-basis measurement. -/
def singleWireProbability {n : ℕ} (U : Op (Qubits n)) (psi : EuclideanSpace ℂ (Qubits n))
    (k : Fin n) (b : Bool) : ℝ :=
  probEvent (act U psi) (fun x => x k = b)

/-- PDF p.10: tensor product of one-qubit operators with wire 0 leftmost. -/
def productOperator {n : ℕ} (P : Fin n → Matrix Bool Bool ℂ) : Op (Qubits n) :=
  fun x y => ∏ i, P i (x i) (y i)

/-- PDF pp.2,10: Pauli Z on an existing wire. -/
def zOperator {n : ℕ} (k : Fin n) : Op (Qubits n) :=
  productOperator fun i => if i = k then pauliZ else 1

/-- PDF pp.2,9: the exact expectation in a circuit's final state. -/
def outputExpectation {n : ℕ} (U : Op (Qubits n)) (psi : EuclideanSpace ℂ (Qubits n))
    (A : Op (Qubits n)) : ℂ :=
  inner ℂ (act U psi) (act A (act U psi))

/-- PDF p.8 Eq.(7): real skew coefficients; both ordered off-diagonal terms
are summed, with no factor 1/2 and no additive scalar Hamiltonian. -/
def quadraticHamiltonian {n : ℕ} (c : Major n → Op (Qubits n))
    (h : Matrix (Major n) (Major n) ℝ) : Op (Qubits n) :=
  Complex.I • ∑ i, ∑ j, if i = j then 0 else (h i j : ℂ) • (c i * c j)

/-- PDF p.9: Gaussian operation with the paper's positive exponent sign. -/
def gaussianOperation {n : ℕ} (c : Major n → Op (Qubits n))
    (h : Matrix (Major n) (Major n) ℝ) : Op (Qubits n) :=
  NormedSpace.exp (Complex.I • quadraticHamiltonian c h)

/-- PDF pp.8--9: antisymmetry is stated entrywise over the reals. -/
def Skew {n : ℕ} (h : Matrix (Major n) (Major n) ℝ) : Prop :=
  ∀ i j, h i j = -h j i

/-- PDF p.9: SO(2n) with both orthogonality and determinant one. -/
def IsMajoranaRotation {n : ℕ} (R : Matrix (Major n) (Major n) ℝ) : Prop :=
  R.transpose * R = 1 ∧ Matrix.det R = 1

/-- PDF p.8 Eq.(6): ordered Majorana products, including the empty word. -/
def majoranaWord {n : ℕ} (c : Major n → Op (Qubits n)) (l : List (Major n)) : Op (Qubits n) :=
  (l.map c).prod

/-- PDF pp.8,10: a canonical square-free polynomial given by its nonzero or
explicitly zero coefficients. Each word is strictly ordered and occurs once. -/
structure CARPolynomial (n : ℕ) where
  terms : List (List (Major n) × ℂ)
  ordered : ∀ t ∈ terms, t.1.Pairwise (fun i j => i.val < j.val)
  unique : (terms.map Prod.fst).Nodup

/-- PDF p.8: evaluation of the supplied canonical polynomial. -/
def CARPolynomial.eval {n : ℕ} (P : CARPolynomial n) (c : Major n → Op (Qubits n)) : Op (Qubits n) :=
  (P.terms.map fun t => t.2 • majoranaWord c t.1).sum

/-- PDF p.10: degree at most d, allowing a constant/empty monomial. -/
def CARPolynomial.DegreeLE {n : ℕ} (P : CARPolynomial n) (d : ℕ) : Prop :=
  ∀ t ∈ P.terms, t.1.length ≤ d

/-- PDF pp.9--10: circuit and its induced Heisenberg rotation. -/
def gaussianCircuit {n : ℕ} (c : Major n → Op (Qubits n))
    (hs : List (Matrix (Major n) (Major n) ℝ)) : Op (Qubits n) :=
  (hs.map (gaussianOperation c)).reverse.prod

/-- PDF pp.9--10: the Heisenberg rotations are composed in reverse list order. -/
def circuitRotation {n : ℕ} (hs : List (Matrix (Major n) (Major n) ℝ)) :
    Matrix (Major n) (Major n) ℝ :=
  (hs.map fun h => NormedSpace.exp ((-4 : ℝ) • h)).reverse.prod

/-- PDF p.10 Eq.(9), general form: expansion indices may repeat; CAR reduction
is performed after expansion, rather than deleting repeated tuples. -/
def expandedWord {n : ℕ} (c : Major n → Op (Qubits n))
    (R : Matrix (Major n) (Major n) ℝ) (l : List (Major n)) : Op (Qubits n) :=
  ∑ j : Fin l.length → Major n,
    ((∏ i : Fin l.length, R (l.get i) (j i) : ℝ) : ℂ) •
      majoranaWord c (List.ofFn j)

/-- PDF pp.9--10: Gaussian circuit data for an effectively given product-operator
representation. The factors of every generator are supplied, not inferred from
an arbitrary matrix description. Only the selected measured Z is represented;
other wires need not have bounded-degree or efficient polynomial descriptions. -/
structure GaussianFamily where
  width : Str → ℕ
  system : (s : Str) → CARSystem (width s)
  factors : (s : Str) → Major (width s) → Fin (width s) → Matrix Bool Bool ℂ
  factorization : ∀ s i, (system s).majorana i = productOperator (factors s i)
  gates : (s : Str) → List (Matrix (Major (width s)) (Major (width s)) ℝ)
  skew : ∀ s h, h ∈ gates s → Skew h
  measured : (s : Str) → Fin (width s)
  observable : (s : Str) → CARPolynomial (width s)
  representsZ : ∀ s, (observable s).eval (system s).majorana = zOperator (measured s)

/-- PDF pp.3,8--10: all polynomial words and gate counts form finite metadata. -/
def GaussianFamily.code (F : GaussianFamily) (s : Str) : Str :=
  tupleCode [QAlgorithms.Complexity.unary (F.width s),
    QAlgorithms.Complexity.unary (F.gates s).length,
    QAlgorithms.Complexity.unary (F.measured s).val,
    tupleCode ((F.observable s).terms.map fun t =>
      tupleCode (t.1.map fun i => QAlgorithms.Complexity.unary i.val))]

/-- PDF pp.3,9--10: generator factors, Gaussian coefficients, and observable
coefficients are all charged. Structural size is charged by the metadata. -/
def GaussianFamily.data (F : GaussianFamily) (s : Str) : List ℂ :=
  (List.ofFn fun i : Major (F.width s) =>
    (List.ofFn fun k : Fin (F.width s) => entries (F.factors s i k)).flatten).flatten ++
  (F.gates s).flatMap (fun h =>
    (List.ofFn fun i : Major (F.width s) =>
      List.ofFn fun j : Major (F.width s) => (h i j : ℂ)).flatten) ++
  (F.observable s).terms.map Prod.snd

/-- PDF p.3: effective uniform Gaussian family with the full description cost. -/
def GaussianFamily.Effective (F : GaussianFamily) : Prop :=
  EffectiveCode F.code ∧ EffectiveNumbers F.data

/-- PDF p.10 Eq.(10): zero-based Majorana index 2k is ZX and 2k+1 is ZY.
Initial Z's occupy exactly the wires strictly preceding k. -/
def jordanWigner (n : ℕ) (i : Major n) : Op (Qubits n) :=
  productOperator fun k =>
    if k.val < i.val / 2 then pauliZ
    else if k.val = i.val / 2 then (if i.val % 2 = 0 then pauliX else pauliY)
    else 1

/-- PDF pp.10--11: global Jordan--Wigner Gaussian gates, each specified by all
quadratic coefficients rather than a dense exponential-size operator. -/
structure JWFamily where
  width : Str → ℕ
  gates : (s : Str) → List (Matrix (Major (width s)) (Major (width s)) ℝ)
  skew : ∀ s h, h ∈ gates s → Skew h

/-- PDF pp.3,10: structural cost of a Jordan--Wigner Gaussian family. -/
def JWFamily.code (F : JWFamily) (s : Str) : Str :=
  tupleCode [QAlgorithms.Complexity.unary (F.width s),
    QAlgorithms.Complexity.unary (F.gates s).length]

/-- PDF pp.3,10: all real Gaussian coefficients are supplied effectively. -/
def JWFamily.data (F : JWFamily) (s : Str) : List ℂ :=
  (F.gates s).flatMap fun h =>
    (List.ofFn fun i : Major (F.width s) =>
      List.ofFn fun j : Major (F.width s) => (h i j : ℂ)).flatten

/-- PDF p.3 uniformity including Gaussian numerical descriptions. -/
def JWFamily.Effective (F : JWFamily) : Prop :=
  EffectiveCode F.code ∧ EffectiveNumbers F.data

/-- PDF p.11: only the four Majoranas on a specified existing adjacent pair
may occur in its local quadratic Hamiltonian. -/
def SupportedOnPair {n : ℕ} (w : Fin 2 ↪ Fin n)
    (h : Matrix (Major n) (Major n) ℝ) : Prop :=
  ∀ i j, (i.val / 2 ∉ Set.range (fun a => (w a).val) ∨
    j.val / 2 ∉ Set.range (fun a => (w a).val)) → h i j = 0

/-- PDF p.12 Eq.(11) on a specified adjacent pair; a=0,1 indexes that pair. -/
def pairMajor {n : ℕ} (w : Fin 2 ↪ Fin n) (a : Fin 2) (b : Bool) : Major n :=
  ⟨2 * (w a).val + if b then 1 else 0, by have := (w a).isLt; split_ifs <;> omega⟩

/-- PDF p.12 Eq.(11), copied as an exponential, including its scalar phase. -/
def modifiedSwap {n : ℕ} (c : Major n → Op (Qubits n)) (w : Fin 2 ↪ Fin n) : Op (Qubits n) :=
  NormedSpace.exp (((-Real.pi / 4 : ℝ) : ℂ) •
    (-c (pairMajor w 0 false) * c (pairMajor w 1 true) +
      c (pairMajor w 0 true) * c (pairMajor w 1 false) +
      c (pairMajor w 0 false) * c (pairMajor w 0 true) +
      c (pairMajor w 1 false) * c (pairMajor w 1 true)))

/-- PDF pp.4--5: nearest-neighbour CZ and arbitrary one-qubit normal form;
constant gate overhead is relative to this presentation. -/
inductive SourceStep (n : ℕ) where
  | one (A : Matrix.unitaryGroup Bool ℂ) (k : Fin n)
  | cz (w : Fin 2 ↪ Fin n) (adjacent : (w 0).val + 1 = (w 1).val)

/-- PDF pp.4--5: exact denotation of the source presentation. -/
def SourceStep.toGateApp {n : ℕ} : SourceStep n → GateApp Set.univ n
  | .one A k =>
      ⟨Gate.ofMatrix1 A, Set.mem_univ _,
        ⟨fun _ => k, by
          change Function.Injective (fun _ : Fin 1 => k)
          intro a b _
          exact Subsingleton.elim a b⟩⟩
  | .cz w _ => ⟨Gate.ofMatrix2 (controlled pauliZ), Set.mem_univ _, w⟩

/-- PDF p.4: source circuit matrix, with input-independent gates. -/
def sourceCircuit {n : ℕ} (c : List (SourceStep n)) : Circuit Set.univ n :=
  c.map SourceStep.toGateApp

/-- PDF pp.4--5: a uniformly described normal-form family. -/
structure SourceFamily where
  width : Str → ℕ
  gates : (s : Str) → List (SourceStep (width s))

/-- PDF p.4: all source arities, tags and wire positions are charged. -/
def SourceFamily.code (F : SourceFamily) (s : Str) : Str :=
  tupleCode ([QAlgorithms.Complexity.unary (F.width s),
    QAlgorithms.Complexity.unary (F.gates s).length] ++
    (F.gates s).map fun g => match g with
      | .one _ k => tupleCode [[false], QAlgorithms.Complexity.unary k.val]
      | .cz w _ => tupleCode [[true], QAlgorithms.Complexity.unary (w 0).val,
          QAlgorithms.Complexity.unary (w 1).val])

/-- PDF pp.4--5: numerical source data are the one-qubit matrices. -/
def SourceFamily.data (F : SourceFamily) (s : Str) : List ℂ :=
  (F.gates s).flatMap fun g => match g with
    | .one A _ => entries A
    | .cz _ _ => []

/-- PDF pp.3--5: uniformity includes gate-parameter description costs. -/
def SourceFamily.Effective (F : SourceFamily) : Prop :=
  EffectiveCode F.code ∧ EffectiveNumbers F.data

/-- PDF p.5: |0> maps to |0000> and |1> maps to |1001> in each block. -/
def encodeFourBits {n : ℕ} (x : Qubits n) : Qubits (4 * n) :=
  fun i => if i.val % 4 = 0 ∨ i.val % 4 = 3 then
    x ⟨i.val / 4, by have := i.isLt; omega⟩ else false

/-- PDF p.6: alternative pair encoding |0> maps to |00>, |1> to |11>. -/
def encodeTwoBits {n : ℕ} (x : Qubits n) : Qubits (2 * n) :=
  fun i => x ⟨i.val / 2, by have := i.isLt; omega⟩

/-- PDF pp.5--6: linear extension to every logical input, including entangled
inputs. This is the actual constructed encoding, not an arbitrary isometry. -/
def encodeState {n m : ℕ} (e : Qubits n → Qubits m)
    (psi : EuclideanSpace ℂ (Qubits n)) : EuclideanSpace ℂ (Qubits m) :=
  ∑ x : Qubits n, psi x • ket (e x)

/-- PDF pp.12--13: c'_mu=T† c_mu T, computed from the actual Clifford operation. -/
def conjugatedGenerators {n : ℕ} (T : Matrix.unitaryGroup (Qubits n) ℂ)
    (c : Major n → Op (Qubits n)) (i : Major n) : Op (Qubits n) :=
  star (T : Op (Qubits n)) * c i * (T : Op (Qubits n))

/-- PDF pp.12--13: a Clifford-conjugated Gaussian family with available product
factor and observable descriptions. Factors and polynomial identities describe
source data; neither simulation nor Gaussian conjugation is assumed. Only the
selected output observable is supplied or required to have bounded degree. -/
structure IntertwinedFamily where
  base : JWFamily
  T : (s : Str) → Matrix.unitaryGroup (Qubits (base.width s)) ℂ
  clifford : ∀ s, T s ∈ QAlgorithms.Clifford.normalizer (base.width s)
  factors : (s : Str) → Major (base.width s) → Fin (base.width s) → Matrix Bool Bool ℂ
  factorization : ∀ s i, conjugatedGenerators (T s) (jordanWigner (base.width s)) i =
    productOperator (factors s i)
  measured : (s : Str) → Fin (base.width s)
  observable : (s : Str) → CARPolynomial (base.width s)
  representsZ : ∀ s,
    (observable s).eval (conjugatedGenerators (T s) (jordanWigner (base.width s))) =
      zOperator (measured s)

/-- PDF pp.3,13: structural data for the bounded-degree transformed observable. -/
def IntertwinedFamily.code (F : IntertwinedFamily) (s : Str) : Str :=
  tupleCode [F.base.code s, QAlgorithms.Complexity.unary (F.measured s).val,
    tupleCode ((F.observable s).terms.map fun t =>
      tupleCode (t.1.map fun i => QAlgorithms.Complexity.unary i.val))]

/-- PDF pp.3,13: the effective description includes the actual transformed
product factors, quadratic coefficients, and observable coefficients. Scalar
phases of T need no description, since they cancel from every conjugation. -/
def IntertwinedFamily.data (F : IntertwinedFamily) (s : Str) : List ℂ :=
  F.base.data s ++
  (List.ofFn fun i : Major (F.base.width s) =>
    (List.ofFn fun k : Fin (F.base.width s) => entries (F.factors s i k)).flatten).flatten ++
  (F.observable s).terms.map Prod.snd

/-- PDF pp.3,13: all information needed from T is effectively supplied by its
conjugated product generators and polynomial observable; no dense T oracle. -/
def IntertwinedFamily.Effective (F : IntertwinedFamily) : Prop :=
  EffectiveCode F.code ∧ EffectiveNumbers F.data

/-- PDF p.14 Example 1: the actual operator permuting the fixed wire order. -/
def permutationOperator {n : ℕ} (p : Equiv.Perm (Fin n)) : Op (Qubits n) :=
  fun x y => if x = y ∘ p then 1 else 0

/-- PDF p.14: one global relabeling, with an effective finite permutation list. -/
def EffectivePermutations (width : Str → ℕ)
    (p : (s : Str) → Equiv.Perm (Fin (width s))) : Prop :=
  EffectiveCode (fun s => tupleCode (List.ofFn fun i : Fin (width s) =>
    QAlgorithms.Complexity.unary (p s i).val))

example : encodeFourBits (![true] : Qubits 1) = ![true, false, false, true] := by
  ext i; fin_cases i <;> rfl

example : encodeTwoBits (![true] : Qubits 1) = ![true, true] := by
  ext i; fin_cases i <;> rfl

example {n : ℕ} (c : Major n → Op (Qubits n)) :
    conjugatedGenerators (1 : Matrix.unitaryGroup (Qubits n) ℂ) c = c := by
  funext i; simp [conjugatedGenerators]

/-- PDF pp.3,16: computational-basis input followed by zero workspace.
The decision-family type below requires enough wires to contain the input. -/
def basisInput (n : ℕ) (x : Str) : EuclideanSpace ℂ (Qubits n) :=
  ket (fun i => (x[i.val]?).getD false)

/-- PDF pp.3,16: one input-independent circuit and existing output wire for
each input length, with the classical input followed by zero ancillas. -/
structure BasisDecisionFamily where
  family : ParityFamily
  output : (n : ℕ) → Fin (family.width (QAlgorithms.Complexity.unary n))
  enoughWires : ∀ n, n ≤ family.width (QAlgorithms.Complexity.unary n)

/-- PDF pp.3,16: the output wire description is charged along with all gates. -/
def BasisDecisionFamily.Effective (F : BasisDecisionFamily) : Prop :=
  F.family.Effective ∧ EffectiveCode
    (fun x => QAlgorithms.Complexity.unary (F.output x.length).val)

/-- PDF pp.3,16: locality and determinant equality on every actual circuit. -/
def BasisDecisionFamily.Allowed (F : BasisDecisionFamily) (r : ℕ) : Prop :=
  ∀ n, RangeBound r (F.family.gates (QAlgorithms.Complexity.unary n)) ∧
    ∀ g ∈ F.family.gates (QAlgorithms.Complexity.unary n), g.Allowable

/-- PDF pp.3,16: output 1 denotes acceptance, for every classical input. -/
def BasisDecisionFamily.acceptance (F : BasisDecisionFamily) (x : Str) : ℝ :=
  singleWireProbability
    (parityCircuit (F.family.gates (QAlgorithms.Complexity.unary x.length))).unitary
    (basisInput (F.family.width (QAlgorithms.Complexity.unary x.length)) x)
    (F.output x.length) true

/-- PDF p.3: P as a characteristic function computed by the accepted
polynomial-time finite Turing machine predicate (Cook/PvsNP provenance).
This definition does not substitute an arbitrary language predicate for P. -/
def InP (L : Set Str) : Prop :=
  ∃ f : Str → Str, QAlgorithms.Complexity.PolyTimeComputable f ∧
    ∀ x, f x = if x ∈ L then [true] else [false]

/-- PDF p.3: the specified bounded-error matchgate language class, with
worst-case success >=2/3 on every computational-basis input. -/
def InBoundedMatchgate (r : ℕ) (L : Set Str) : Prop :=
  ∃ F : BasisDecisionFamily, F.Effective ∧ F.Allowed r ∧
    ∀ x, (x ∈ L → (2 / 3 : ℝ) ≤ F.acceptance x) ∧
      (x ∉ L → F.acceptance x ≤ (1 / 3 : ℝ))

/-- PDF p.16: V_r under the symmetric PQP majority-gap conditions. Polynomial
padding is explicit: one polynomial exponent is chosen before all inputs, and
is >=2 even at length zero. This avoids the impossible literal n=0 gap. -/
def InPQPMatchgate (r : ℕ) (L : Set Str) : Prop :=
  ∃ F : BasisDecisionFamily, F.Effective ∧ F.Allowed r ∧
    ∃ p : Polynomial ℕ, (∀ n, 2 ≤ p.eval n) ∧
      ∀ x, (x ∈ L → (1 / 2 : ℝ) + (2 : ℝ)⁻¹ ^ p.eval x.length ≤ F.acceptance x) ∧
        (x ∉ L → F.acceptance x ≤ (1 / 2 : ℝ) - (2 : ℝ)⁻¹ ^ p.eval x.length)

example : basisInput 1 [true] = ket (![true] : Qubits 1) := by
  unfold basisInput
  apply congrArg (fun x : Qubits 1 => ket x)
  ext i
  fin_cases i
  rfl

example : basisInput 2 [true] = ket (![true, false] : Qubits 2) := by
  unfold basisInput
  apply congrArg (fun x : Qubits 2 => ket x)
  ext i
  fin_cases i <;> rfl

/-! Small definition sanity examples; no source theorem is proved here. -/

example : tupleCode [[]] = [false] := rfl

example : binaryNat [true, false, true] = 5 := rfl

example : dyadic [true, true] 1 = -(1 / 2 : ℝ) := by norm_num [dyadic, binaryNat]

example (A B : Matrix Bool Bool ℂ) :
    parityGate A B ![false, false] ![true, true] = A false true := rfl

example (A B : Matrix Bool Bool ℂ) :
    parityGate A B ![false, true] ![true, false] = B false true := rfl

example : parityGate (1 : Matrix Bool Bool ℂ) 1 = 1 := by
  ext x y
  have hx : x = ![x 0, x 1] := by ext i; fin_cases i <;> rfl
  have hy : y = ![y 0, y 1] := by ext i; fin_cases i <;> rfl
  rw [hx, hy]
  cases x 0 <;> cases x 1 <;> cases y 0 <;> cases y 1 <;>
    simp [parityGate, Matrix.one_apply]

example {n : ℕ} (c : Major n → Op (Qubits n)) : majoranaWord c [] = 1 := rfl

example {n : ℕ} (c : Major n → Op (Qubits n)) : gaussianCircuit c [] = 1 := rfl

example {n : ℕ} (c : Major n → Op (Qubits n)) : gaussianOperation c 0 = 1 := by
  simp [gaussianOperation, quadraticHamiltonian, NormedSpace.exp_zero]

example (A : Matrix Bool Bool ℂ) : (entries A).length = 4 := rfl

example {n : ℕ} (w : Fin 2 ↪ Fin n) : (ParityApp.mk 1 1 w).Allowable := rfl

example (n r : ℕ) : RangeBound r ([] : List (ParityApp n)) := by
  simp [RangeBound]

example (n : ℕ) : Skew (0 : Matrix (Major n) (Major n) ℝ) := by
  simp [Skew]

example (n : ℕ) : IsMajoranaRotation (1 : Matrix (Major n) (Major n) ℝ) := by
  simp [IsMajoranaRotation]

example (x y : Qubits 1) : jordanWigner 1 ⟨0, by decide⟩ x y = pauliX (x 0) (y 0) := by
  simp [jordanWigner, productOperator, Fin.prod_univ_one]

example (x y : Qubits 1) : jordanWigner 1 ⟨1, by decide⟩ x y = pauliY (x 0) (y 0) := by
  simp [jordanWigner, productOperator, Fin.prod_univ_one]

end QAlgorithms.Papers.Independent.Intakethird100.P77
Source
Matchgates and classical simulation of quantum circuits, arXiv:0804.4050v2, https://arxiv.org/abs/0804.4050v2
Read-back

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

QAlgorithms.Papers.Independent.Intakethird100.P77.BasisDecisionFamily.Allowed

For a basis decision family FFF, with a width w(s)w(s)w(s) and a finite gate list for every Boolean string sss, and output wires o(n)<w(true n)o(n)<w(\mathrm{true}^{\,n})o(n)<w(truen) with n≤w(true n)n\le w(\mathrm{true}^{\,n})n≤w(truen), and for a natural number rrr, this property says that for every n∈Nn\in\mathbb Nn∈N, every gate ggg in the list at s=true ns=\mathrm{true}^{\,n}s=truen has two unitary Boolean-indexed complex 2×22\times22×2 matrices Ag,BgA_g,B_gAg​,Bg​ and an injective wire assignment vg:{0,1}↪{0,…,w(s)−1}v_g:\{0,1\}\hookrightarrow\{0,\ldots,w(s)-1\}vg​:{0,1}↪{0,…,w(s)−1} satisfying both ∣vg(0)−vg(1)∣≤r|v_g(0)-v_g(1)|\le r∣vg​(0)−vg​(1)∣≤r and det⁡Ag=det⁡Bg\det A_g=\det B_gdetAg​=detBg​. This quantifies over n=0n=0n=0 as well. Empty gate lists satisfy these conditions vacuously; when r=0r=0r=0, injectivity prevents any gate from satisfying the distance bound, so all lists at unary strings must be empty. The condition concerns the gate lists at unary strings only.

QAlgorithms.Papers.Independent.Intakethird100.P77.BasisDecisionFamily.Effective

For a basis decision family FFF, consisting of widths w(s)w(s)w(s), lists of two-wire gates with unitary Boolean-indexed matrices Ag,BgA_g,B_gAg​,Bg​ and injective wire assignments vgv_gvg​, and output wires o(n)<w(true n)o(n)<w(\mathrm{true}^{\,n})o(n)<w(truen) satisfying n≤w(true n)n\le w(\mathrm{true}^{\,n})n≤w(truen), this property requires three polynomial-time Boolean-string computations. Write u(j)=true ju(j)=\mathrm{true}^{\,j}u(j)=truej and T([a1,…,ak])=∥j(u(∣aj∣) false aj)T([a_1,\ldots,a_k])=\big\Vert_j(u(|a_j|)\,\mathrm{false}\,a_j)T([a1​,…,ak​])=​j​(u(∣aj​∣)falseaj​). First, the function

s⟼T ⁣([u(w(s)),u(number of gates)]+ ⁣ ⁣+[T([u(vg(0)),u(vg(1))]):g in list order])s\longmapsto T\!\left([u(w(s)),u(\text{number of gates})]\mathbin{+\!\!+} [T([u(v_g(0)),u(v_g(1))]):g\text{ in list order}]\right)s⟼T([u(w(s)),u(number of gates)]++[T([u(vg​(0)),u(vg​(1))]):g in list order])

must be polynomial-time computable. Second, form the complex-entry list by taking, for each gate in order, the four entries of AgA_gAg​ and then those of BgB_gBg​, each in order (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1). There must be a polynomial-time function which, on T([s,u(j),u(m),[b]])T([s,u(j),u(m),[b]])T([s,u(j),u(m),[b]]), approximates entry jjj's real part if b=falseb=\mathrm{false}b=false, or imaginary part if b=trueb=\mathrm{true}b=true, within 2−m2^{-m}2−m, for every valid jjj, every m∈Nm\in\mathbb Nm∈N, and both bbb. Its output denotes the binary integer in its tail divided by 2m2^m2m, negated when its first bit is true; empty or missing bits contribute zero. Third, x↦u(o(∣x∣))x\mapsto u(o(|x|))x↦u(o(∣x∣)) must be polynomial-time computable for every Boolean string xxx. Polynomial time means computability by a TM2 Turing machine using identity input and output encodings. These requirements include empty input strings and precision m=0m=0m=0.

QAlgorithms.Papers.Independent.Intakethird100.P77.BasisDecisionFamily.acceptance

For a basis decision family FFF, with widths w(s)w(s)w(s), gate lists, and output wires o(n)<w(true n)o(n)<w(\mathrm{true}^{\,n})o(n)<w(truen) satisfying n≤w(true n)n\le w(\mathrm{true}^{\,n})n≤w(truen), and a finite Boolean string xxx, put n=∣x∣n=|x|n=∣x∣, s=true ns=\mathrm{true}^{\,n}s=truen, and w=w(s)w=w(s)w=w(s). Each gate in the list at sss has unitary Boolean-indexed matrices Ag,BgA_g,B_gAg​,Bg​ and an injective ordered pair of wires; on those wires, its entry from y∈{0,1}2y\in\{0,1\}^2y∈{0,1}2 to z∈{0,1}2z\in\{0,1\}^2z∈{0,1}2 is zero if their parities differ, is (Ag)z0,y0(A_g)_{z_0,y_0}(Ag​)z0​,y0​​ if both parities are even, and is (Bg)z0,y0(B_g)_{z_0,y_0}(Bg​)z0​,y0​​ if both are odd, with every other wire unchanged. Let UsU_sUs​ be the product of these embedded matrices in reverse list order, the empty product being the identity, and let a∈{0,1}wa\in\{0,1\}^wa∈{0,1}w contain xxx in its first nnn positions and false in its remaining positions. The defined acceptance value is

∑z∈{0,1}wzo(n)=true∣(Us)z,a∣2.\sum_{\substack{z\in\{0,1\}^{w}\\z_{o(n)}=\mathrm{true}}}|(U_s)_{z,a}|^2.z∈{0,1}wzo(n)​=true​∑​∣(Us​)z,a​∣2.

The definition includes the empty input xxx; even then the family supplies an output wire and therefore at least one wire.

QAlgorithms.Papers.Independent.Intakethird100.P77.BasisDecisionFamily

An object of this structure consists of a family assigning to every finite Boolean string sss a width w(s)∈Nw(s)\in\mathbb Nw(s)∈N and a finite ordered list of gates, each carrying two unitary complex 2×22\times22×2 matrices A,BA,BA,B, indexed by Boolean values, and an injection of its two wire positions into {0,…,w(s)−1}\{0,\ldots,w(s)-1\}{0,…,w(s)−1}; an output wire o(n)∈{0,…,w(true n)−1}o(n)\in\{0,\ldots,w(\mathrm{true}^{\,n})-1\}o(n)∈{0,…,w(truen)−1} for every n∈Nn\in\mathbb Nn∈N; and a proof that n≤w(true n)n\le w(\mathrm{true}^{\,n})n≤w(truen) for every nnn. The presence of an output wire also requires w(true n)>0w(\mathrm{true}^{\,n})>0w(truen)>0, including at n=0n=0n=0. The gate matrices are required here only to be unitary, and their wire assignments to be injective; the structure itself imposes no determinant-equality or wire-distance requirement.

QAlgorithms.Papers.Independent.Intakethird100.P77.CARPolynomial.DegreeLE

For any natural numbers n,dn,dn,d and any finite list PPP of complex-coefficient terms whose index lists are strictly increasing in {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1} and do not repeat, this predicate means that every stored term has an index list of length at most ddd. This requirement applies even to terms with coefficient zero. It holds vacuously for an empty list of terms. For d=0d=0d=0, every stored index list must be empty; for n=0n=0n=0, it holds for every ddd.

QAlgorithms.Papers.Independent.Intakethird100.P77.CARPolynomial.eval

For any natural number nnn, let PPP be a finite list of terms (l,a)(l,a)(l,a) with complex coefficients, where each index list lll is strictly increasing in {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1} and distinct terms have distinct index lists. For any arbitrary family cic_ici​ of complex matrices indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, this defines

P(c)=∑([i1,…,ir],a) in Pa ci1⋯cir.P(c)=\sum_{([i_1,\ldots,i_r],a)\,\text{in }P}a\,c_{i_1}\cdots c_{i_r}.P(c)=([i1​,…,ir​],a)in P∑​aci1​​⋯cir​​.

An empty index list contributes aIaIaI, while an empty list of terms evaluates to zero. No Hermiticity or anticommutation assumptions are imposed on cic_ici​. When n=0n=0n=0, the result is zero or a scalar multiple of the identity.

QAlgorithms.Papers.Independent.Intakethird100.P77.CARPolynomial

For any natural number nnn, this structure consists of a finite list of pairs (l,a)(l,a)(l,a), where a∈Ca\in\mathbb Ca∈C and lll is a finite list of indices in {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1}, together with the requirements that the indices in each stored list lll are strictly increasing and that no two entries have the same index list. There is no prescribed ordering of the terms themselves, and zero coefficients are allowed. Empty index lists are allowed, but at most one can occur. The list of terms may be empty; when n=0n=0n=0, it is either empty or consists of a single term with an empty index list.

QAlgorithms.Papers.Independent.Intakethird100.P77.EffectiveCode

For any function code\mathrm{code}code from finite Boolean strings to finite Boolean strings, this predicate means that there exists a polynomial-time TM2 computation of code\mathrm{code}code using the identity encoding for both input and output strings. It imposes no additional condition that the output be a valid encoding of any particular kind of object.

QAlgorithms.Papers.Independent.Intakethird100.P77.EffectiveNumbers

For any function data\mathrm{data}data assigning a finite list of complex numbers to each finite Boolean string, this predicate means that there exists one function fff from Boolean strings to Boolean strings, computable in polynomial time by a TM2 machine with identity input and output encodings, such that for every string sss, every index 0≤j<∣data(s)∣0\le j<|\mathrm{data}(s)|0≤j<∣data(s)∣, every natural number mmm, and every Boolean bbb, the following approximation holds: form the four component strings sss, 1j1^j1j, 1m1^m1m, and [b][b][b], prefix each component xxx by 1∣x∣01^{|x|}01∣x∣0, concatenate them in that order, and apply fff; interpret its output as a signed binary integer divided by 2m2^m2m, with a first bit of true indicating a negative sign and the remaining bits giving the unsigned binary magnitude. This interpreted value differs by at most 2−m2^{-m}2−m from the imaginary part of the jjjth entry of data(s)\mathrm{data}(s)data(s) if bbb is true, and from its real part if bbb is false. An empty output or an output of length one is interpreted as 000. The case m=0m=0m=0 is included and requires error at most 111; if data(s)\mathrm{data}(s)data(s) is empty, there are no approximation requirements for that sss.

QAlgorithms.Papers.Independent.Intakethird100.P77.EffectivePermutations

For a function www assigning a natural number to every finite Boolean string sss, and a permutation psp_sps​ of {0,…,w(s)−1}\{0,\ldots,w(s)-1\}{0,…,w(s)−1} for every sss, this property says that the following Boolean-string function is computable in polynomial time by a TM2 Turing machine, with identity input and output encodings: list the numbers ps(0),…,ps(w(s)−1)p_s(0),\ldots,p_s(w(s)-1)ps​(0),…,ps​(w(s)−1) in order, encode each number jjj as jjj copies of true, and prefix each resulting string by its length encoded as that many copies of true followed by false; concatenate these prefixed strings. Thus the output is ∥i=0w(s)−1(true ps(i) false true ps(i))\big\Vert_{i=0}^{w(s)-1}(\mathrm{true}^{\,p_s(i)}\,\mathrm{false}\,\mathrm{true}^{\,p_s(i)})​i=0w(s)−1​(trueps​(i)falsetrueps​(i)), where ∥\Vert∥ denotes concatenation. Width zero is permitted, in which case the permutation is the unique permutation of the empty set and the output is the empty string.

QAlgorithms.Papers.Independent.Intakethird100.P77.GaussianFamily.Effective

For a Gaussian family FFF, this property is the conjunction of polynomial-time computability of its structural encoding and polynomial-time approximability of its numerical data. More precisely, let 1j1^j1j denote jjj true bits and let T(w1,…,wq)\mathcal T(w_1,\ldots,w_q)T(w1​,…,wq​) concatenate the strings 1∣wr∣0wr1^{|w_r|}0w_r1∣wr​∣0wr​ in order. At input sss, the structural encoding is T(1n,1L,O0,…,On−1)\mathcal T(1^n,1^L,O_0,\ldots,O_{n-1})T(1n,1L,O0​,…,On−1​), where nnn is the width, LLL is the gate-list length, and OkO_kOk​ encodes the observable’s ordered index-word list by applying T\mathcal TT to the encodings T(1i1,…,1ip)\mathcal T(1^{i_1},\ldots,1^{i_p})T(1i1​,…,1ip​) of its words. The numerical list DsD_sDs​ consists, in order, of all four entries of every generator factor matrix, ordered by generator, wire, row and column; all real gate-matrix entries embedded into C\mathbb CC, ordered by gate, row and column; and all observable coefficients, ordered by wire and term. The structural encoding, as a function of sss, must have a polynomial-time Turing-machine realization with identity string encodings. There must also exist a polynomial-time Boolean-string function fff such that, for every sss, valid index 0≤j<∣Ds∣0\le j<|D_s|0≤j<∣Ds​∣, natural precision mmm, and Boolean bbb,

∣dyad⁡m ⁣(f(T(s,1j,1m,[b])))−{Im⁡(Ds[j]),b=true,Re⁡(Ds[j]),b=false∣≤2−m.\left|\operatorname{dyad}_m\!\left(f\bigl(\mathcal T(s,1^j,1^m,[b])\bigr)\right) -\begin{cases}\operatorname{Im}(D_s[j]),&b=\mathrm{true},\\ \operatorname{Re}(D_s[j]),&b=\mathrm{false}\end{cases}\right|\le 2^{-m}.​dyadm​(f(T(s,1j,1m,[b])))−{Im(Ds​[j]),Re(Ds​[j]),​b=true,b=false​​≤2−m.

Here dyad⁡m(w)\operatorname{dyad}_m(w)dyadm​(w) interprets the first bit as a sign, negative when true, interprets the remaining bits as a binary natural number with the most significant bit first, and divides the signed result by 2m2^m2m; an empty string represents zero. Precision zero is included, and an empty numerical list imposes no numerical approximation conditions.

QAlgorithms.Papers.Independent.Intakethird100.P77.GaussianFamily.code

For any Gaussian family FFF and finite Boolean string sss, let nnn be its width, LLL the length of its ordered list of real skew-symmetric gate matrices, q<nq<nq<n its measured-wire index, and w1,…,wKw_1,\ldots,w_Kw1​,…,wK​ the generator-index words in its observable’s term list, in their stored order. Its code is the Boolean string

tuple⁡ ⁣[1n, 1L, 1q, tuple⁡ ⁣[tuple⁡[1i:i occurs in w1],…,tuple⁡[1i:i occurs in wK]]].\operatorname{tuple}\!\left[ 1^n,\ 1^L,\ 1^q,\ \operatorname{tuple}\!\left[ \operatorname{tuple}[1^{i}:i\text{ occurs in }w_1],\ldots, \operatorname{tuple}[1^{i}:i\text{ occurs in }w_K] \right]\right].tuple[1n, 1L, 1q, tuple[tuple[1i:i occurs in w1​],…,tuple[1i:i occurs in wK​]]].

Here 1a1^a1a is aaa true bits, and tuple⁡\operatorname{tuple}tuple concatenates each constituent string after prefixing it with its length in unary followed by a false bit. Generator indices are their natural values in {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1}. The words have strictly increasing indices and are distinct. An empty list has empty tuple encoding, and an empty word is encoded by the empty inner tuple. This code records the width, gate count, measured index, and ordered words; matrix entries and observable coefficients do not occur in it.

QAlgorithms.Papers.Independent.Intakethird100.P77.GaussianFamily.data

For any Gaussian family FFF and finite Boolean string sss, write nnn for its width, Fi,kF_{i,k}Fi,k​ for the complex 2×22\times22×2 factor of generator i<2ni<2ni<2n on wire k<nk<nk<n, h1,…,hLh_1,\ldots,h_Lh1​,…,hL​ for its ordered list of real skew-symmetric 2n×2n2n\times2n2n×2n gate matrices, and (w1,α1),…,(wK,αK)(w_1,\alpha_1),\ldots,(w_K,\alpha_K)(w1​,α1​),…,(wK​,αK​) for its observable terms. Its data is a single list of complex numbers formed by concatenating three lists: first, for increasing iii and then increasing kkk, the four entries

(Fi,k)false,false, (Fi,k)false,true, (Fi,k)true,false, (Fi,k)true,true;(F_{i,k})_{\mathrm{false},\mathrm{false}},\ (F_{i,k})_{\mathrm{false},\mathrm{true}},\ (F_{i,k})_{\mathrm{true},\mathrm{false}},\ (F_{i,k})_{\mathrm{true},\mathrm{true}};(Fi,k​)false,false​, (Fi,k​)false,true​, (Fi,k​)true,false​, (Fi,k​)true,true​;

second, for gates in their stored order, all entries (hℓ)ij(h_\ell)_{ij}(hℓ​)ij​, embedded from R\mathbb RR into C\mathbb CC, with iii increasing first as the outer index and jjj increasing as the inner index; and third, the coefficients α1,…,αK\alpha_1,\ldots,\alpha_Kα1​,…,αK​ in stored term order. Empty gate or term lists contribute no entries.

QAlgorithms.Papers.Independent.Intakethird100.P77.GaussianFamily

A Gaussian family consists of the following data and identities for every finite Boolean string sss. It has a natural width n=n(s)n=n(s)n=n(s), with basis labels {0,1}n\{0,1\}^n{0,1}n, and 2n2n2n complex matrices c0,…,c2n−1c_0,\ldots,c_{2n-1}c0​,…,c2n−1​ on this basis satisfying

ci†=ci,cicj+cjci=2δijI.c_i^\dagger=c_i,\qquad c_ic_j+c_jc_i=2\delta_{ij}I.ci†​=ci​,ci​cj​+cj​ci​=2δij​I.

For each generator iii and wire k<nk<nk<n, it supplies a complex 2×22\times22×2 matrix Fi,kF_{i,k}Fi,k​, with the required factorization

(ci)x,y=∏k<n(Fi,k)xk,yk(x,y∈{0,1}n).(c_i)_{x,y}=\prod_{k<n}(F_{i,k})_{x_k,y_k} \quad(x,y\in\{0,1\}^n).(ci​)x,y​=k<n∏​(Fi,k​)xk​,yk​​(x,y∈{0,1}n).

It also supplies a finite ordered list of real 2n×2n2n\times2n2n×2n matrices hhh, each satisfying hij=−hjih_{ij}=-h_{ji}hij​=−hji​, a measured wire q<nq<nq<n, and a finite list of pairs (w,α)(w,\alpha)(w,α), where α∈C\alpha\in\mathbb Cα∈C and www is a list of generator indices. Each word has strictly increasing indices, and no word occurs twice in this list. These pairs must satisfy

∑(w,α)α cw1⋯cw∣w∣=Zq,(Zq)x,y=∏k<n{Zxk,yk,k=q,δxk,yk,k≠q,\sum_{(w,\alpha)}\alpha\,c_{w_1}\cdots c_{w_{|w|}} =Z_q,\qquad (Z_q)_{x,y}=\prod_{k<n} \begin{cases} Z_{x_k,y_k},&k=q,\\ \delta_{x_k,y_k},&k\ne q, \end{cases}(w,α)∑​αcw1​​⋯cw∣w∣​​=Zq​,(Zq​)x,y​=k<n∏​{Zxk​,yk​​,δxk​,yk​​,​k=q,k=q,​

where Z=diag⁡(1,−1)Z=\operatorname{diag}(1,-1)Z=diag(1,−1), with false preceding true. Empty words contribute the identity, zero coefficients are allowed, and the gate list may be empty. There is no degree or effectiveness requirement in this structure. The measured-wire field requires n(s)>0n(s)>0n(s)>0 for every sss.

QAlgorithms.Papers.Independent.Intakethird100.P77.InBoundedMatchgate

For a natural number rrr and a language LLL of finite Boolean strings, this property asserts the existence of widths w(s)w(s)w(s), finite gate lists at every string sss, and output wires o(n)<w(true n)o(n)<w(\mathrm{true}^{\,n})o(n)<w(truen), with n≤w(true n)n\le w(\mathrm{true}^{\,n})n≤w(truen) for all n∈Nn\in\mathbb Nn∈N, satisfying the following requirements. Each gate has two unitary Boolean-indexed complex 2×22\times22×2 matrices Ag,BgA_g,B_gAg​,Bg​ and an injective wire assignment vgv_gvg​. Put u(j)=true ju(j)=\mathrm{true}^{\,j}u(j)=truej and T([a1,…,ak])=∥j(u(∣aj∣) false aj)T([a_1,\ldots,a_k])=\big\Vert_j(u(|a_j|)\,\mathrm{false}\,a_j)T([a1​,…,ak​])=​j​(u(∣aj​∣)falseaj​). The functions encoding each family member as T([u(w(s)),u(gate count)]+ ⁣ ⁣+[T([u(vg(0)),u(vg(1))]):g in order])T([u(w(s)),u(\text{gate count})]\mathbin{+\!\!+}[T([u(v_g(0)),u(v_g(1))]):g\text{ in order}])T([u(w(s)),u(gate count)]++[T([u(vg​(0)),u(vg​(1))]):g in order]), and sending xxx to u(o(∣x∣))u(o(|x|))u(o(∣x∣)), must be polynomial-time computable. There must also be a polynomial-time function which, queried on T([s,u(j),u(m),[b]])T([s,u(j),u(m),[b]])T([s,u(j),u(m),[b]]), approximates the real or imaginary part, selected respectively by b=falseb=\mathrm{false}b=false or true, of entry jjj of the gate-data list within 2−m2^{-m}2−m, for every valid jjj and every m∈Nm\in\mathbb Nm∈N; that list contains AgA_gAg​ then BgB_gBg​ for each gate, with entries ordered (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1), and a returned string denotes its binary tail divided by 2m2^m2m, negated if its first bit is true, with missing bits zero. All polynomial-time computations use TM2 machines with identity encodings. At every unary string true n\mathrm{true}^{\,n}truen, each gate must satisfy det⁡Ag=det⁡Bg\det A_g=\det B_gdetAg​=detBg​ and ∣vg(0)−vg(1)∣≤r|v_g(0)-v_g(1)|\le r∣vg​(0)−vg​(1)∣≤r. Its two-wire matrix uses AgA_gAg​ on even-parity rows and columns, BgB_gBg​ on odd-parity rows and columns, and zero between different parities, indexing each block by the first wire's bit; it leaves all other wires unchanged. Let UnU_nUn​ be the reverse-order product of the embedded gate list at true n\mathrm{true}^{\,n}truen, with the empty product the identity, and let axa_xax​ be xxx followed by false bits to width w(true ∣x∣)w(\mathrm{true}^{\,|x|})w(true∣x∣). For every string xxx, including the empty string, the quantity

a(x)=∑z: zo(∣x∣)=true∣(U∣x∣)z,ax∣2a(x)=\sum_{z:\,z_{o(|x|)}=\mathrm{true}}|(U_{|x|})_{z,a_x}|^2a(x)=z:zo(∣x∣)​=true∑​∣(U∣x∣​)z,ax​​∣2

must satisfy a(x)≥2/3a(x)\ge2/3a(x)≥2/3 if x∈Lx\in Lx∈L, and a(x)≤1/3a(x)\le1/3a(x)≤1/3 if x∉Lx\notin Lx∈/L. When r=0r=0r=0, the injectivity and distance requirements force all gate lists at unary strings to be empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.InP

For a set LLL of finite Boolean strings, this property says that there exists a function fff from finite Boolean strings to finite Boolean strings which is computable in polynomial time by a TM2 Turing machine, using identity input and output encodings, and which returns exactly the one-bit string [true] on every x∈Lx\in Lx∈L, and exactly [false] on every x∉Lx\notin Lx∈/L. This requirement applies to every input string, including the empty string.

QAlgorithms.Papers.Independent.Intakethird100.P77.InPQPMatchgate

For a natural number rrr and a language LLL of finite Boolean strings, this property asserts the existence of widths w(s)w(s)w(s), finite gate lists for every string sss, output wires o(n)<w(true n)o(n)<w(\mathrm{true}^{\,n})o(n)<w(truen) with n≤w(true n)n\le w(\mathrm{true}^{\,n})n≤w(truen), and a polynomial ppp with natural-number coefficients such that p(n)≥2p(n)\ge2p(n)≥2 for every n∈Nn\in\mathbb Nn∈N. Each gate carries unitary Boolean-indexed complex 2×22\times22×2 matrices Ag,BgA_g,B_gAg​,Bg​ and an injective ordered pair of wires vgv_gvg​. Write u(j)=true ju(j)=\mathrm{true}^{\,j}u(j)=truej and T([a1,…,ak])=∥j(u(∣aj∣) false aj)T([a_1,\ldots,a_k])=\big\Vert_j(u(|a_j|)\,\mathrm{false}\,a_j)T([a1​,…,ak​])=​j​(u(∣aj​∣)falseaj​). The encoding s↦T([u(w(s)),u(gate count)]+ ⁣ ⁣+[T([u(vg(0)),u(vg(1))]):g in order])s\mapsto T([u(w(s)),u(\text{gate count})]\mathbin{+\!\!+}[T([u(v_g(0)),u(v_g(1))]):g\text{ in order}])s↦T([u(w(s)),u(gate count)]++[T([u(vg​(0)),u(vg​(1))]):g in order]) and the function x↦u(o(∣x∣))x\mapsto u(o(|x|))x↦u(o(∣x∣)) must be polynomial-time computable. The gate-data list, consisting of AgA_gAg​ then BgB_gBg​ for each gate and entries in order (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1), must admit a polynomial-time approximation function: at input T([s,u(j),u(m),[b]])T([s,u(j),u(m),[b]])T([s,u(j),u(m),[b]]), it approximates entry jjj's real part for b=falseb=\mathrm{false}b=false, or imaginary part for b=trueb=\mathrm{true}b=true, within 2−m2^{-m}2−m, for all valid jjj and all m∈Nm\in\mathbb Nm∈N. The returned string represents its binary tail divided by 2m2^m2m, with a negative sign exactly when the first bit is true, and missing bits zero. Polynomial time uses TM2 machines with identity encodings. At each unary string true n\mathrm{true}^{\,n}truen, all gates must satisfy det⁡Ag=det⁡Bg\det A_g=\det B_gdetAg​=detBg​ and ∣vg(0)−vg(1)∣≤r|v_g(0)-v_g(1)|\le r∣vg​(0)−vg​(1)∣≤r. The local gate matrix has entries from AgA_gAg​ on the even-parity block, from BgB_gBg​ on the odd-parity block, each indexed by the first bit, and zero between blocks; other wires are unchanged. Let UnU_nUn​ be the reverse-order product of these embedded gates, and let axa_xax​ be xxx padded with false to the width at true ∣x∣\mathrm{true}^{\,|x|}true∣x∣. Then for every string xxx,

x∈L ⟹ 12+2−p(∣x∣)≤∑z: zo(∣x∣)=true∣(U∣x∣)z,ax∣2,x∉L ⟹ ∑z: zo(∣x∣)=true∣(U∣x∣)z,ax∣2≤12−2−p(∣x∣).\begin{aligned} x\in L&\ \Longrightarrow\ \frac12+2^{-p(|x|)} \le \sum_{z:\,z_{o(|x|)}=\mathrm{true}}|(U_{|x|})_{z,a_x}|^2,\\ x\notin L&\ \Longrightarrow\ \sum_{z:\,z_{o(|x|)}=\mathrm{true}}|(U_{|x|})_{z,a_x}|^2 \le\frac12-2^{-p(|x|)}. \end{aligned}x∈Lx∈/L​ ⟹ 21​+2−p(∣x∣)≤z:zo(∣x∣)​=true∑​∣(U∣x∣​)z,ax​​∣2, ⟹ z:zo(∣x∣)​=true∑​∣(U∣x∣​)z,ax​​∣2≤21​−2−p(∣x∣).​

The conditions include length zero; output-wire existence requires positive width there. Empty gate lists are allowed, and r=0r=0r=0 forces all unary-indexed gate lists to be empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.IntertwinedFamily.Effective

For an intertwined family FFF, this predicate requires two polynomial-time computability properties. To state them explicitly, let u(r)u(r)u(r) be rrr true bits, and let τ([v1,…,vℓ])\tau([v_1,\ldots,v_\ell])τ([v1​,…,vℓ​]) concatenate u(∣vj∣)u(|v_j|)u(∣vj​∣), a false bit, and vjv_jvj​ for every jjj. At parameter string sss, write nsn_sns​ for the base width, LsL_sLs​ for the number of base skew-symmetric real gate matrices, and ℓs,k,j\ell_{s,k,j}ℓs,k,j​ for the ordered index word of term jjj in the observable at wire kkk; these words are strictly increasing and distinct within each observable. The first requirement is that a polynomial-time function compute exactly

τ ⁣([τ([u(ns),u(Ls)])]+ ⁣ ⁣+[τ ⁣([τ([u(i):i∈ℓs,k,j]):j in term order]):k=0,…,ns−1])\tau\!\left( [\tau([u(n_s),u(L_s)])] \mathbin{+\!\!+} \left[ \tau\!\left([\tau([u(i):i\in\ell_{s,k,j}]):j\text{ in term order}]\right) :k=0,\ldots,n_s-1 \right]\right)τ([τ([u(ns​),u(Ls​)])]++[τ([τ([u(i):i∈ℓs,k,j​]):j in term order]):k=0,…,ns​−1])

from sss. The second requirement concerns the numerical list DsD_sDs​ obtained by concatenating the gate matrices’ entries in gate, row, and column order, then the four entries (00,01,10,11)(00,01,10,11)(00,01,10,11) of each supplied generator factor in generator and wire order, and then the observable coefficients in wire and term order. The supplied factors give the tensor factorizations of Ts†ciTsT_s^\dagger c_iT_sTs†​ci​Ts​, and the observable words evaluated on these matrices give the single-wire ZZZ operators. There must exist a polynomial-time function fff such that, for every sss, every j<∣Ds∣j<|D_s|j<∣Ds​∣, every r∈Nr\in\mathbb Nr∈N, and every Boolean bbb, interpreting f(τ([s,u(j),u(r),[b]]))f(\tau([s,u(j),u(r),[b]]))f(τ([s,u(j),u(r),[b]])) as a signed binary integer divided by 2r2^r2r gives an approximation within 2−r2^{-r}2−r of Re⁡(Ds)j\operatorname{Re}(D_s)_jRe(Ds​)j​ if bbb is false and Im⁡(Ds)j\operatorname{Im}(D_s)_jIm(Ds​)j​ if bbb is true. The output’s first bit specifies the sign, true meaning negative, and its tail is the binary magnitude; missing bits are false. Precision r=0r=0r=0, empty parameter strings, zero widths, and empty numerical lists are included; entry-approximation requirements are vacuous when the numerical list is empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.IntertwinedFamily.code

For any intertwined family FFF and finite Boolean string sss, let nnn be its base width, LLL its base gate-list length, q<nq<nq<n its measured-wire index, and w1,…,wKw_1,\ldots,w_Kw1​,…,wK​ the distinct, strictly increasing generator-index words in its observable’s stored term list. Its code is

tuple⁡ ⁣[tuple⁡[1n,1L], 1q, tuple⁡ ⁣[tuple⁡[1i:i occurs in w1],…,tuple⁡[1i:i occurs in wK]]].\operatorname{tuple}\!\left[ \operatorname{tuple}[1^n,1^L],\ 1^q,\ \operatorname{tuple}\!\left[ \operatorname{tuple}[1^i:i\text{ occurs in }w_1],\ldots, \operatorname{tuple}[1^i:i\text{ occurs in }w_K] \right]\right].tuple[tuple[1n,1L], 1q, tuple[tuple[1i:i occurs in w1​],…,tuple[1i:i occurs in wK​]]].

Here 1a1^a1a denotes aaa true bits, and tuple encoding concatenates each constituent string after prefixing it with its length in unary followed by a false bit. The inner tuple⁡[1n,1L]\operatorname{tuple}[1^n,1^L]tuple[1n,1L] is the base-family code. Generator indices are their natural values below 2n2n2n. Empty lists have empty tuple encodings, including empty observable words. This encoding contains the structural indices and counts displayed above; it contains neither matrix entries nor observable coefficients.

QAlgorithms.Papers.Independent.Intakethird100.P77.IntertwinedFamily.data

For any intertwined family FFF and finite Boolean string sss, let nnn be its base width, h1,…,hLh_1,\ldots,h_Lh1​,…,hL​ its ordered list of real skew-symmetric 2n×2n2n\times2n2n×2n base gate matrices, Fi,kF_{i,k}Fi,k​ its complex 2×22\times22×2 factors satisfying (Ts†ciTs)x,y=∏k<n(Fi,k)xk,yk(T_s^\dagger c_iT_s)_{x,y}=\prod_{k<n}(F_{i,k})_{x_k,y_k}(Ts†​ci​Ts​)x,y​=∏k<n​(Fi,k​)xk​,yk​​, and (w1,α1),…,(wK,αK)(w_1,\alpha_1),\ldots,(w_K,\alpha_K)(w1​,α1​),…,(wK​,αK​) its observable terms. Its data is the concatenation of: all entries of h1,…,hLh_1,\ldots,h_Lh1​,…,hL​, embedded into C\mathbb CC, in gate order and then increasing row and column order; all factor entries, for increasing generator index i<2ni<2ni<2n, then increasing wire k<nk<nk<n, in the order

(Fi,k)false,false, (Fi,k)false,true, (Fi,k)true,false, (Fi,k)true,true;(F_{i,k})_{\mathrm{false},\mathrm{false}},\ (F_{i,k})_{\mathrm{false},\mathrm{true}},\ (F_{i,k})_{\mathrm{true},\mathrm{false}},\ (F_{i,k})_{\mathrm{true},\mathrm{true}};(Fi,k​)false,false​, (Fi,k​)false,true​, (Fi,k​)true,false​, (Fi,k​)true,true​;

and finally the coefficients α1,…,αK\alpha_1,\ldots,\alpha_Kα1​,…,αK​ in stored term order. The cic_ici​ are the tensor products with preceding ZZZ factors, an XXX or YYY factor at wire ⌊i/2⌋\lfloor i/2\rfloor⌊i/2⌋ according to the parity of iii, and identity afterward. Empty gate and term lists contribute no entries.

QAlgorithms.Papers.Independent.Intakethird100.P77.IntertwinedFamily

An intertwined family consists of a base family indexed by finite Boolean strings sss, giving a natural width n=n(s)n=n(s)n=n(s) and an ordered finite list of real 2n×2n2n\times2n2n×2n matrices hhh satisfying hij=−hjih_{ij}=-h_{ji}hij​=−hji​, together with the following additional data and requirements. For each sss, it supplies a unitary matrix TsT_sTs​ on the basis {0,1}n\{0,1\}^n{0,1}n which normalizes the subgroup generated by all matrices

ia⨂k<nPk,a∈{0,1,2,3},Pk∈{I,X,Y,Z},\mathrm i^a\bigotimes_{k<n}P_k,\qquad a\in\{0,1,2,3\},\quad P_k\in\{I,X,Y,Z\},iak<n⨂​Pk​,a∈{0,1,2,3},Pk​∈{I,X,Y,Z},

where 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=diag⁡(1,−1)Z=\operatorname{diag}(1,-1)Z=diag(1,−1). Thus conjugation by TsT_sTs​ preserves that subgroup. Define the matrices cic_ici​, i<2ni<2ni<2n, as tensor products with ZZZ on wires k<⌊i/2⌋k<\lfloor i/2\rfloork<⌊i/2⌋, with XXX at wire ⌊i/2⌋\lfloor i/2\rfloor⌊i/2⌋ when iii is even and YYY there when iii is odd, and identity on later wires. The family supplies complex 2×22\times22×2 matrices Fi,kF_{i,k}Fi,k​ satisfying

(Ts†ciTs)x,y=∏k<n(Fi,k)xk,yk.(T_s^\dagger c_iT_s)_{x,y}=\prod_{k<n}(F_{i,k})_{x_k,y_k}.(Ts†​ci​Ts​)x,y​=k<n∏​(Fi,k​)xk​,yk​​.

It also supplies a measured wire q<nq<nq<n and a finite list of pairs (w,α)(w,\alpha)(w,α), with α∈C\alpha\in\mathbb Cα∈C, whose words www have strictly increasing indices in {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1} and do not repeat. These must represent the measured ZZZ matrix:

∑(w,α)α(Ts†cw1Ts)⋯(Ts†cw∣w∣Ts)=Zq,\sum_{(w,\alpha)}\alpha (T_s^\dagger c_{w_1}T_s)\cdots(T_s^\dagger c_{w_{|w|}}T_s)=Z_q,(w,α)∑​α(Ts†​cw1​​Ts​)⋯(Ts†​cw∣w∣​​Ts​)=Zq​,

where ZqZ_qZq​ is ZZZ on wire qqq and identity on all other wires. Empty words mean identity, zero coefficients and empty gate lists are allowed, and no degree or effectiveness condition is imposed here. The measured-wire field requires every width to be positive.

QAlgorithms.Papers.Independent.Intakethird100.P77.IsMajoranaRotation

For any natural number nnn and any real 2n×2n2n\times2n2n×2n matrix RRR, this predicate means

RTR=I2nanddet⁡R=1.R^{\mathsf T}R=I_{2n}\quad\text{and}\quad\det R=1.RTR=I2n​anddetR=1.

When n=0n=0n=0, the unique empty matrix satisfies both conditions, with empty determinant equal to 111.

QAlgorithms.Papers.Independent.Intakethird100.P77.JWFamily.Effective

For a JW family FFF, assigning each finite Boolean string sss a natural width nsn_sns​ and an ordered list of LsL_sLs​ real skew-symmetric 2ns×2ns2n_s\times2n_s2ns​×2ns​ matrices, this property requires both of the following. First, the string function s↦T(1ns,1Ls)s\mapsto\mathcal T(1^{n_s},1^{L_s})s↦T(1ns​,1Ls​) has a polynomial-time Turing-machine realization with identity string encodings, where 1j1^j1j denotes jjj true bits and T(w1,…,wq)\mathcal T(w_1,\ldots,w_q)T(w1​,…,wq​) concatenates 1∣wr∣0wr1^{|w_r|}0w_r1∣wr​∣0wr​. Second, if DsD_sDs​ is the list of gate entries embedded into C\mathbb CC, in gate order and then increasing row and column order, there exists a polynomial-time Boolean-string function fff satisfying, for every sss, valid index j<∣Ds∣j<|D_s|j<∣Ds​∣, natural mmm, and Boolean bbb,

∣dyad⁡m ⁣(f(T(s,1j,1m,[b])))−{Im⁡(Ds[j]),b=true,Re⁡(Ds[j]),b=false∣≤2−m.\left|\operatorname{dyad}_m\!\left(f(\mathcal T(s,1^j,1^m,[b]))\right) -\begin{cases}\operatorname{Im}(D_s[j]),&b=\mathrm{true},\\ \operatorname{Re}(D_s[j]),&b=\mathrm{false}\end{cases}\right|\le 2^{-m}.​dyadm​(f(T(s,1j,1m,[b])))−{Im(Ds​[j]),Re(Ds​[j]),​b=true,b=false​​≤2−m.

Here dyad⁡m\operatorname{dyad}_mdyadm​ takes a Boolean string’s first bit as a negative sign when true, reads the remaining bits as a most-significant-bit-first binary natural number, and divides the signed value by 2m2^m2m; the empty string represents zero. Precision zero is included, and the numerical condition is vacuous whenever DsD_sDs​ is empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.JWFamily.code

For every JW family FFF, which assigns each finite Boolean string sss a width nsn_sns​ and a finite ordered list of real skew-symmetric 2ns×2ns2n_s\times2n_s2ns​×2ns​ matrices, the definition returns T(1ns,1Ls)\mathcal T(1^{n_s},1^{L_s})T(1ns​,1Ls​), where LsL_sLs​ is the gate-list length, 1j1^j1j is the string of jjj true bits, and T(w1,…,wq)\mathcal T(w_1,\ldots,w_q)T(w1​,…,wq​) concatenates 1∣wr∣1^{|w_r|}1∣wr​∣, one false bit and wrw_rwr​ for each argument in order. Thus the returned string is 1ns0 1ns1Ls0 1Ls1^{n_s}0\,1^{n_s}1^{L_s}0\,1^{L_s}1ns​01ns​1Ls​01Ls​. Zero widths and empty gate lists are included; when both numbers are zero the result consists of two false bits.

QAlgorithms.Papers.Independent.Intakethird100.P77.JWFamily.data

For every JW family FFF and finite Boolean string sss, let nsn_sns​ be its width and let h0,…,hLs−1h_0,\ldots,h_{L_s-1}h0​,…,hLs​−1​ be its ordered list of real skew-symmetric 2ns×2ns2n_s\times2n_s2ns​×2ns​ matrices. The definition returns the complex-number list of all entries of h0h_0h0​, then all entries of h1h_1h1​, and so on, with each matrix traversed in increasing row-index order and then increasing column-index order, and with each real entry embedded into C\mathbb CC. It retains zero and repeated entries and has length Ls(2ns)2L_s(2n_s)^2Ls​(2ns​)2. It is empty if the gate list is empty or the width is zero.

QAlgorithms.Papers.Independent.Intakethird100.P77.JWFamily

A JW family consists of a natural-number width nsn_sns​ for every finite Boolean string sss, together with a finite ordered list of real 2ns×2ns2n_s\times2n_s2ns​×2ns​ matrices for each sss, and a requirement that every matrix hhh appearing in that list satisfies hij=−hjih_{ij}=-h_{ji}hij​=−hji​ for all indices i,j<2nsi,j<2n_si,j<2ns​. Width zero, empty input strings and empty gate lists are allowed; at width zero the matrix indices are empty and skew-symmetry is vacuous. No computability condition or bound on widths, gate-list lengths or matrix entries is part of this structure.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityApp.Allowable

For every natural number nnn and every application ggg consisting of two Boolean-indexed complex unitary matrices Ag,BgA_g,B_gAg​,Bg​ and an injection of two ordered wires into nnn wires, this predicate means exactly det⁡Ag=det⁡Bg\det A_g=\det B_gdetAg​=detBg​. It adds no condition on the wire positions beyond their already required distinctness. For n=0n=0n=0 or n=1n=1n=1, there is no such application ggg.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityApp

For each natural number nnn, an object of this structure consists of two complex unitary matrices AAA and BBB, each with Boolean row and column indices, together with an injective map w:{0,1}→{0,…,n−1}w:\{0,1\}\to\{0,\ldots,n-1\}w:{0,1}→{0,…,n−1} specifying two ordered, distinct wires. No equality of det⁡A\det AdetA and det⁡B\det BdetB is required by the structure. Such an object cannot exist when n=0n=0n=0 or n=1n=1n=1, because the required injection then cannot exist.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityApp.toGateApp

For every natural number nnn and every application ggg consisting of Boolean-indexed complex unitary matrices Ag,BgA_g,B_gAg​,Bg​ and an injective two-wire map wgw_gwg​, this function constructs an application of a gate from the set of all gates on the same nnn wires. The constructed gate has arity 222 and matrix entries indexed by two-bit strings x,yx,yx,y: the entry is 000 when their exclusive-or parities differ, Ag(x0,y0)A_g(x_0,y_0)Ag​(x0​,y0​) when both parities are false, and Bg(x0,y0)B_g(x_0,y_0)Bg​(x0​,y0​) when both are true. Its wire map is exactly wgw_gwg​. No hypothesis det⁡Ag=det⁡Bg\det A_g=\det B_gdetAg​=detBg​ is imposed; for n<2n<2n<2 there is no input application ggg.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityFamily.Effective

For every family FFF of finite lists of two-wire applications indexed by finite Boolean strings, this predicate requires both an exact polynomial-time computation of its structural encoding and polynomial-time approximations to its matrix entries. More precisely, let u(k)u(k)u(k) be kkk true bits, and let TTT encode a list of strings by prefixing each constituent string xxx with u(∣x∣)u(|x|)u(∣x∣) followed by a false bit. If FFF has width www and LLL applications at sss, with ordered wires (ij,jj)(i_j,j_j)(ij​,jj​), there must be a polynomial-time computable string function returning exactly T([u(w),u(L),T([u(i1),u(j1)]),…,T([u(iL),u(jL)])])T([u(w),u(L),T([u(i_1),u(j_1)]),\ldots,T([u(i_L),u(j_L)])])T([u(w),u(L),T([u(i1​),u(j1​)]),…,T([u(iL​),u(jL​)])]). Separately, form d(s)d(s)d(s) by listing, for each application in order, the entries 00,01,10,1100,01,10,1100,01,10,11 of its first unitary matrix and then those of its second. There must be a polynomial-time computable string function fff such that, for every sss, index 0≤j<∣d(s)∣0\le j<|d(s)|0≤j<∣d(s)∣, natural number mmm, and Boolean bbb, the string f(T([s,u(j),u(m),[b]]))f(T([s,u(j),u(m),[b]]))f(T([s,u(j),u(m),[b]])), interpreted as a signed binary integer divided by 2m2^m2m, differs by at most 2−m2^{-m}2−m from Re⁡d(s)j\operatorname{Re}d(s)_jRed(s)j​ when bbb is false and from Im⁡d(s)j\operatorname{Im}d(s)_jImd(s)j​ when bbb is true. In this interpretation, the first output bit is the sign, true meaning negative, and the remaining bits give the binary magnitude from most significant to least significant; missing bits contribute zero. Precision m=0m=0m=0 is included, and an empty data list imposes no entry-approximation conditions.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityFamily.code

For every family FFF assigning a width w(s)w(s)w(s) and a list of two-wire applications to each finite Boolean string sss, this function returns the following Boolean string. Write u(k)u(k)u(k) for kkk consecutive true bits, and define T([x1,…,xℓ])T([x_1,\ldots,x_\ell])T([x1​,…,xℓ​]) by concatenating u(∣xj∣)u(|x_j|)u(∣xj​∣), one false bit, and xjx_jxj​, for each jjj in order. If the application list at sss is [g1,…,gL][g_1,\ldots,g_L][g1​,…,gL​], with ordered wire indices ij,jji_j,j_jij​,jj​, the returned string is

T([u(w(s)),u(L),T([u(i1),u(j1)]),…,T([u(iL),u(jL)])]).T\bigl([u(w(s)),u(L),T([u(i_1),u(j_1)]),\ldots,T([u(i_L),u(j_L)])]\bigr).T([u(w(s)),u(L),T([u(i1​),u(j1​)]),…,T([u(iL​),u(jL​)])]).

Each application also contains two unitary 2×22\times22×2 complex matrices, but their entries do not occur in this string. Empty application lists and width zero are included.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityFamily.data

For every family FFF assigning a width and a finite ordered list of two-wire applications to each finite Boolean string sss, this function returns a list of complex numbers obtained by traversing the applications in order. For each application, whose two unitary 2×22\times22×2 matrices are AAA and BBB, it appends

[A00,A01,A10,A11,B00,B01,B10,B11],[A_{00},A_{01},A_{10},A_{11},B_{00},B_{01},B_{10},B_{11}],[A00​,A01​,A10​,A11​,B00​,B01​,B10​,B11​],

where 000 means false and 111 means true. Thus a list of LLL applications gives 8L8L8L entries, and an empty application list gives an empty data list.

QAlgorithms.Papers.Independent.Intakethird100.P77.ParityFamily

A value of this structure consists of a function assigning a natural number w(s)w(s)w(s) to every finite Boolean string sss, and, for each such sss, a finite ordered list of applications on w(s)w(s)w(s) wires. Each application contains two unitary complex matrices indexed by {false,true}\{\mathrm{false},\mathrm{true}\}{false,true}, together with an injection from {0,1}\{0,1\}{0,1} into {0,…,w(s)−1}\{0,\ldots,w(s)-1\}{0,…,w(s)−1}, specifying two distinct ordered wires. The structure imposes no determinant equality, distance bound, or computability requirement. Width zero is allowed; at widths zero and one the application list must be empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.ProductInputs.data

For any width function www on finite Boolean strings, any assignment III of unit-norm complex two-component vectors ϕs,i\phi_{s,i}ϕs,i​ for 0≤i<w(s)0\le i<w(s)0≤i<w(s), and any string sss, this function returns the complex list

[ϕs,0(false),ϕs,0(true),…,ϕs,w(s)−1(false),ϕs,w(s)−1(true)].[\phi_{s,0}(\mathrm{false}),\phi_{s,0}(\mathrm{true}),\ldots, \phi_{s,w(s)-1}(\mathrm{false}),\phi_{s,w(s)-1}(\mathrm{true})].[ϕs,0​(false),ϕs,0​(true),…,ϕs,w(s)−1​(false),ϕs,w(s)−1​(true)].

The factors are listed in increasing wire order, with the false component before the true component. The list has length 2w(s)2w(s)2w(s) and is empty when w(s)=0w(s)=0w(s)=0.

QAlgorithms.Papers.Independent.Intakethird100.P77.ProductInputs

For any function www from finite Boolean strings to natural numbers, a value of this structure assigns to every string sss and every index i∈{0,…,w(s)−1}i\in\{0,\ldots,w(s)-1\}i∈{0,…,w(s)−1} a complex vector ϕs,i\phi_{s,i}ϕs,i​ indexed by the two Boolean values, and includes the requirement

∣ϕs,i(false)∣2+∣ϕs,i(true)∣2=1.|\phi_{s,i}(\mathrm{false})|^2+|\phi_{s,i}(\mathrm{true})|^2=1.∣ϕs,i​(false)∣2+∣ϕs,i​(true)∣2=1.

There is no computability requirement. Width zero is allowed, in which case there are no factors or normalization conditions at that string.

QAlgorithms.Papers.Independent.Intakethird100.P77.RangeBound

For every natural number nnn, natural number rrr, and finite list ccc of gate applications on nnn wires, each application consisting of two unitary 2×22\times22×2 complex matrices and an ordered pair of distinct wire indices, this predicate means that every application ggg in ccc has wire indices ig,jg∈{0,…,n−1}i_g,j_g\in\{0,\ldots,n-1\}ig​,jg​∈{0,…,n−1} satisfying ∣ig−jg∣≤r|i_g-j_g|\le r∣ig​−jg​∣≤r. The condition holds vacuously for an empty list; because the two indices are distinct, r=0r=0r=0 permits only an empty list.

QAlgorithms.Papers.Independent.Intakethird100.P77.SelectedStrongSimulation

For any function ppp assigning a real number p(s,b)p(s,b)p(s,b) to each finite Boolean string sss and each Boolean bbb, this property means that there exists a polynomial-time computable function fff from finite Boolean strings to finite Boolean strings such that, for every sss, every natural number mmm, and both values of bbb,

∣dyad⁡m ⁣(f ⁣(tuple⁡[s,1m,[b]]))−p(s,b)∣≤2−m.\left|\operatorname{dyad}_m\!\left(f\!\left(\operatorname{tuple}[s,1^m,[b]]\right)\right)-p(s,b)\right|\le 2^{-m}.∣dyadm​(f(tuple[s,1m,[b]]))−p(s,b)∣≤2−m.

Here 1m1^m1m is the string of mmm true bits; tuple⁡[w1,…,wk]\operatorname{tuple}[w_1,\ldots,w_k]tuple[w1​,…,wk​] concatenates, for each wiw_iwi​, the string 1∣wi∣1^{|w_i|}1∣wi​∣, a false bit, and then wiw_iwi​ itself. To obtain dyad⁡m(w)\operatorname{dyad}_m(w)dyadm​(w), interpret the tail of www as a binary natural number, reading from left to right by the update a↦2a+ba\mapsto 2a+ba↦2a+b, negate this number exactly when the first bit is true, and divide by 2m2^m2m. An empty string has default first bit false and binary value zero. Polynomial-time computability uses the identity encodings of input and output Boolean strings. The quantifiers include the empty input string and m=0m=0m=0, where the permitted error is 111; no probability or range restriction on ppp is imposed.

QAlgorithms.Papers.Independent.Intakethird100.P77.Skew

For any natural number nnn and any real matrix hhh indexed by {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1}, this predicate means

hij=−hjifor every 0≤i,j<2n.h_{ij}=-h_{ji}\qquad\text{for every }0\le i,j<2n.hij​=−hji​for every 0≤i,j<2n.

In particular, every diagonal entry must be zero. When n=0n=0n=0, there are no indices and the condition holds vacuously.

QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily.Effective

For a family FFF assigning a width and an instruction list to each finite Boolean string sss, this property is the conjunction of two requirements. Define u(k)u(k)u(k) to be kkk true bits and define tuple⁡(x1,…,xr)\operatorname{tuple}(x_1,\ldots,x_r)tuple(x1​,…,xr​) by concatenating ∣xj∣|x_j|∣xj​∣ true bits, one false bit, and xjx_jxj​ for each component in order. First, the function sending sss to tuple⁡(u(F.width(s)),u(∣F.gates(s)∣),instruction records)\operatorname{tuple}(u(F.\mathrm{width}(s)),u(|F.\mathrm{gates}(s)|),\text{instruction records})tuple(u(F.width(s)),u(∣F.gates(s)∣),instruction records) is computable by a polynomial-time Turing machine on Boolean strings with identity input and output encodings; a one-wire instruction on kkk has record tuple⁡([false],u(k))\operatorname{tuple}([\mathrm{false}],u(k))tuple([false],u(k)), and an adjacent controlled-ZZZ instruction on w(0),w(1)w(0),w(1)w(0),w(1) has record tuple⁡([true],u(w(0)),u(w(1)))\operatorname{tuple}([\mathrm{true}],u(w(0)),u(w(1)))tuple([true],u(w(0)),u(w(1))). Second, there exists a polynomial-time computable Boolean-string function fff such that, for every sss, every index jjj of the list d(s)d(s)d(s) obtained by concatenating the four entries of each one-wire unitary in row order false, true while omitting controlled-ZZZ instructions, every natural precision mmm, and every Boolean bbb, the string v=f(tuple⁡(s,u(j),u(m),[b]))v=f(\operatorname{tuple}(s,u(j),u(m),[b]))v=f(tuple(s,u(j),u(m),[b])) satisfies ∣dyad⁡m(v)−(Im⁡d(s)j if b=true, otherwise Re⁡d(s)j)∣≤2−m\left|\operatorname{dyad}_m(v)-(\operatorname{Im}d(s)_j\text{ if }b=\mathrm{true},\text{ otherwise }\operatorname{Re}d(s)_j)\right|\le2^{-m}∣dyadm​(v)−(Imd(s)j​ if b=true, otherwise Red(s)j​)∣≤2−m. Here dyad⁡m(v)\operatorname{dyad}_m(v)dyadm​(v) reads the first bit as a sign, negative for true and positive for false, interprets the remaining bits as an unsigned binary integer in most-significant-first order, and divides that signed integer by 2m2^m2m; missing bits default to false, so the empty string represents zero. Precision m=0m=0m=0 is included, and when d(s)d(s)d(s) is empty there are no entry-index requirements for that sss.

QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily.code

For every family FFF assigning a width and a finite instruction list to each finite Boolean string, and every input string sss, this definition produces the following Boolean encoding. Let u(k)u(k)u(k) be the string of kkk true bits, and let tuple⁡(x1,…,xr)\operatorname{tuple}(x_1,\ldots,x_r)tuple(x1​,…,xr​) concatenate, for each xjx_jxj​ in order, ∣xj∣|x_j|∣xj​∣ true bits, one false bit, and then xjx_jxj​ itself. The result is tuple⁡\operatorname{tuple}tuple applied to the list beginning with u(F.width(s))u(F.\mathrm{width}(s))u(F.width(s)) and u(∣F.gates(s)∣)u(|F.\mathrm{gates}(s)|)u(∣F.gates(s)∣), followed by one record for each instruction in its list order. A one-wire instruction on wire kkk contributes tuple⁡([false],u(k))\operatorname{tuple}([\mathrm{false}],u(k))tuple([false],u(k)), while a controlled-ZZZ instruction on ordered adjacent wires w(0),w(1)w(0),w(1)w(0),w(1) contributes tuple⁡([true],u(w(0)),u(w(1)))\operatorname{tuple}([\mathrm{true}],u(w(0)),u(w(1)))tuple([true],u(w(0)),u(w(1))). The one-wire unitary matrices are not included in this encoding.

QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily.data

For every family FFF assigning a width and a finite instruction list to each finite Boolean string, and every input string sss, this definition forms a list of complex numbers by traversing F.gates(s)F.\mathrm{gates}(s)F.gates(s) in order and concatenating the contributions of its instructions. A one-wire instruction with unitary matrix AAA contributes the four entries [Afalse,false,Afalse,true,Atrue,false,Atrue,true][A_{\mathrm{false},\mathrm{false}},A_{\mathrm{false},\mathrm{true}},A_{\mathrm{true},\mathrm{false}},A_{\mathrm{true},\mathrm{true}}][Afalse,false​,Afalse,true​,Atrue,false​,Atrue,true​] in exactly that order; a controlled-ZZZ instruction contributes the empty list. Consequently, the resulting list is empty if there are no one-wire instructions.

QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily

This structure consists of a function assigning a natural-number width to every finite Boolean string sss, together with a finite list of instructions on that many wires for each sss. Each instruction is either an arbitrary unitary 2×22\times22×2 complex matrix on one specified wire or a controlled-ZZZ instruction on an injectively selected ordered pair w(0),w(1)w(0),w(1)w(0),w(1) satisfying w(1)=w(0)+1w(1)=w(0)+1w(1)=w(0)+1. No computability or size condition is part of this structure; a string assigned width zero necessarily has an empty instruction list.

QAlgorithms.Papers.Independent.Intakethird100.P77.SourceStep

For each natural number nnn, this defines a type of instructions with two constructors: a one-wire instruction specified by an arbitrary Boolean-indexed unitary 2×22\times22×2 complex matrix AAA and a wire k∈{0,…,n−1}k\in\{0,\ldots,n-1\}k∈{0,…,n−1}; or a controlled-ZZZ instruction specified by an injection w:{0,1}↪{0,…,n−1}w:\{0,1\}\hookrightarrow\{0,\ldots,n-1\}w:{0,1}↪{0,…,n−1} together with the condition w(1)=w(0)+1w(1)=w(0)+1w(1)=w(0)+1. There are no instructions when n=0n=0n=0, and the second constructor is unavailable when n<2n<2n<2.

QAlgorithms.Papers.Independent.Intakethird100.P77.SourceStep.toGateApp

For every natural number nnn, this maps an instruction on nnn wires to a gate application whose allowed gate set consists of all gates. A one-wire instruction with unitary matrix AAA and wire kkk becomes an arity-one gate with matrix entry Ax0,y0A_{x_0,y_0}Ax0​,y0​​ for one-bit strings x,yx,yx,y, applied through the injection sending its sole wire to kkk. A controlled-ZZZ instruction with injection www becomes an arity-two gate applied through www, whose matrix entry on two-bit strings x,yx,yx,y is −1-1−1 if x=yx=yx=y and both bits are true, 111 if x=yx=yx=y and they are not both true, and 000 if x≠yx\ne yx=y. The adjacency proof carried by the controlled-ZZZ instruction does not contribute any additional data to the resulting gate application.

QAlgorithms.Papers.Independent.Intakethird100.P77.StrongSimulation

For any function width\mathrm{width}width from finite Boolean strings to natural numbers and any family of real numbers p(s,k,b)p(s,k,b)p(s,k,b) indexed by a string sss, an integer 0≤k<width(s)0\le k<\mathrm{width}(s)0≤k<width(s), and a Boolean bbb, this predicate means that there exists one function fff from Boolean strings to Boolean strings, computable in polynomial time by a TM2 machine with identity input and output encodings, satisfying the following requirement for every sss, every natural number mmm, every such kkk, and both values of bbb: prefix each of the four strings sss, 1m1^m1m, 1k1^k1k, and [b][b][b] by its unary length followed by false, concatenate them in that order, and apply fff; the output, interpreted as a signed binary integer divided by 2m2^m2m, differs from p(s,k,b)p(s,k,b)p(s,k,b) by at most 2−m2^{-m}2−m. The output’s first bit supplies the sign, with true meaning negative, and its remaining bits supply the binary magnitude; empty outputs and outputs of length one represent 000. Precision m=0m=0m=0 is included. When width(s)=0\mathrm{width}(s)=0width(s)=0, there are no requirements for that sss. No probability bounds or normalization conditions on ppp, and no computability condition on width\mathrm{width}width itself, are part of this predicate.

QAlgorithms.Papers.Independent.Intakethird100.P77.SupportedOnPair

For every natural number nnn, every injection w:{0,1}↪{0,…,n−1}w:\{0,1\}\hookrightarrow\{0,\ldots,n-1\}w:{0,1}↪{0,…,n−1}, and every real matrix hhh indexed in both coordinates by {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1}, this property means that, for all indices i,j<2ni,j<2ni,j<2n,

(⌊i2⌋∉{w(0),w(1)} or ⌊j2⌋∉{w(0),w(1)}) ⟹ hij=0.\left(\left\lfloor\frac i2\right\rfloor\notin\{w(0),w(1)\} \ \text{or}\ \left\lfloor\frac j2\right\rfloor\notin\{w(0),w(1)\}\right) \ \Longrightarrow\ h_{ij}=0.(⌊2i​⌋∈/{w(0),w(1)} or ⌊2j​⌋∈/{w(0),w(1)}) ⟹ hij​=0.

Equivalently, entries may be nonzero only when both indices belong to {2w(0),2w(0)+1,2w(1),2w(1)+1}\{2w(0),2w(0)+1,2w(1),2w(1)+1\}{2w(0),2w(0)+1,2w(1),2w(1)+1}. There is no additional restriction on entries within that submatrix, and skew-symmetry is not required by this property. The injection requires two distinct wires, so no such www exists when n<2n<2n<2.

QAlgorithms.Papers.Independent.Intakethird100.P77.basisInput

For every natural number nnn and finite Boolean string xxx, this defines the vector in C{0,1}n\mathbb C^{\{0,1\}^n}C{0,1}n whose amplitude is one at the bit string zzz given by zi=xiz_i=x_izi​=xi​ when position iii exists in xxx, and zi=falsez_i=\mathrm{false}zi​=false otherwise, and whose other amplitudes are zero. Consequently, positions of xxx beyond the first nnn are unused, and missing positions among the first nnn are filled with false. When n=0n=0n=0, the vector has amplitude one at the unique empty bit string, for every xxx.

QAlgorithms.Papers.Independent.Intakethird100.P77.binaryNat

For every finite Boolean string w=[b1,…,br]w=[b_1,\ldots,b_r]w=[b1​,…,br​], this function returns the natural number obtained by starting at a=0a=0a=0 and, reading the string from left to right, replacing aaa by 2a+12a+12a+1 when the next bit is true and by 2a2a2a when it is false. Equivalently, identifying false with 000 and true with 111, its value is ∑i=1rbi2r−i\sum_{i=1}^r b_i2^{r-i}∑i=1r​bi​2r−i. The empty string has value 000, and leading false bits are allowed.

QAlgorithms.Papers.Independent.Intakethird100.P77.circuitRotation

For any natural number nnn and any finite list [h1,…,hr][h_1,\ldots,h_r][h1​,…,hr​] of arbitrary real 2n×2n2n\times2n2n×2n matrices, this defines the real matrix

exp⁡(−4hr)⋯exp⁡(−4h1).\exp(-4h_r)\cdots\exp(-4h_1).exp(−4hr​)⋯exp(−4h1​).

The exponentials are matrix exponentials, and the factors occur in reverse list order. There is no skew-symmetry assumption on the matrices in the list. An empty list gives I2nI_{2n}I2n​; when n=0n=0n=0, the result is the unique empty identity matrix.

QAlgorithms.Papers.Independent.Intakethird100.P77.conjugatedGenerators

For any natural number nnn, any unitary matrix TTT indexed by length-nnn bit strings, any family c0,…,c2n−1c_0,\ldots,c_{2n-1}c0​,…,c2n−1​ of complex matrices indexed by those strings, and any index i∈{0,…,2n−1}i\in\{0,\ldots,2n-1\}i∈{0,…,2n−1}, this defines the matrix

T†ciT,T^\dagger c_iT,T†ci​T,

where T†T^\daggerT† is the conjugate transpose. No algebraic relations on the matrices cic_ici​ are assumed. The parameter n=0n=0n=0 is permitted, but there is then no index iii at which to evaluate this family.

QAlgorithms.Papers.Independent.Intakethird100.P77.dyadic

For every finite Boolean string www and every natural number mmm, this function returns (−1)bN/2m(-1)^bN/2^m(−1)bN/2m, where bbb is the first bit of www, interpreted as 000 for false and 111 for true, and NNN is the natural number represented in binary by the remaining bits, read from left to right with the most significant bit first. If www is empty, the first bit defaults to false and the remaining string is empty, whose binary value is 000. Consequently, empty strings and strings of length one both give 000. The parameter mmm may be 000, in which case the denominator is 111; no relationship between mmm and the length of www is required.

QAlgorithms.Papers.Independent.Intakethird100.P77.encodeFourBits

For every natural number nnn and every Boolean string xxx indexed by {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}, this definition produces a Boolean string of length 4n4n4n by replacing each input bit xkx_kxk​ with the four-bit block (xk,false,false,xk)(x_k,\mathrm{false},\mathrm{false},x_k)(xk​,false,false,xk​). Equivalently, its bit at index i<4ni<4ni<4n is x⌊i/4⌋x_{\lfloor i/4\rfloor}x⌊i/4⌋​ when i mod 4i\bmod4imod4 is 000 or 333, and is false otherwise. For n=0n=0n=0, it returns the unique empty indexed Boolean string.

QAlgorithms.Papers.Independent.Intakethird100.P77.encodeState

For any natural numbers n,mn,mn,m, any function eee from length-nnn bit strings to length-mmm bit strings, and any complex Euclidean vector ψ\psiψ indexed by length-nnn bit strings, this defines the vector

∑x∈{0,1}nψx ∣e(x)⟩,\sum_{x\in\{0,1\}^n}\psi_x\,|e(x)\rangle,x∈{0,1}n∑​ψx​∣e(x)⟩,

where ∣y⟩|y\rangle∣y⟩ has coordinate 111 at yyy and 000 elsewhere. Equivalently, its coordinate at yyy is ∑x:e(x)=yψx\sum_{x:e(x)=y}\psi_x∑x:e(x)=y​ψx​. No injectivity assumption on eee or normalization assumption on ψ\psiψ is imposed: amplitudes with the same image are added, and a coordinate with no preimage is zero. Both n=0n=0n=0 and m=0m=0m=0 are included; a zero-length bit-string space has one element.

QAlgorithms.Papers.Independent.Intakethird100.P77.encodeTwoBits

For every natural number nnn and every bit string x:{0,…,n−1}→{false,true}x:\{0,\ldots,n-1\}\to\{\mathrm{false},\mathrm{true}\}x:{0,…,n−1}→{false,true}, this defines a bit string of length 2n2n2n whose coordinate iii is x⌊i/2⌋x_{\lfloor i/2\rfloor}x⌊i/2⌋​. Thus each input bit appears twice, consecutively:

(x0,x1,…,xn−1)⟼(x0,x0,x1,x1,…,xn−1,xn−1).(x_0,x_1,\ldots,x_{n-1})\longmapsto(x_0,x_0,x_1,x_1,\ldots,x_{n-1},x_{n-1}).(x0​,x1​,…,xn−1​)⟼(x0​,x0​,x1​,x1​,…,xn−1​,xn−1​).

The definition includes n=0n=0n=0, when both strings are empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.entries

For every complex matrix AAA whose rows and columns are indexed by the two Boolean values, this function returns the four-entry list [Afalse,false,Afalse,true,Atrue,false,Atrue,true][A_{\mathrm{false},\mathrm{false}},A_{\mathrm{false},\mathrm{true}},A_{\mathrm{true},\mathrm{false}},A_{\mathrm{true},\mathrm{true}}][Afalse,false​,Afalse,true​,Atrue,false​,Atrue,true​]. There are no assumptions on AAA, such as unitarity or Hermitian symmetry.

QAlgorithms.Papers.Independent.Intakethird100.P77.expandedWord

For any natural number nnn, any arbitrary family cic_ici​, 0≤i<2n0\le i<2n0≤i<2n, of complex matrices indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, any arbitrary real 2n×2n2n\times2n2n×2n matrix RRR, and any finite index list l=[i1,…,ir]l=[i_1,\ldots,i_r]l=[i1​,…,ir​], this defines

∑j1,…,jr∈{0,…,2n−1}(∏a=1rRiaja)cj1⋯cjr,\sum_{j_1,\ldots,j_r\in\{0,\ldots,2n-1\}} \left(\prod_{a=1}^{r}R_{i_a j_a}\right)c_{j_1}\cdots c_{j_r},j1​,…,jr​∈{0,…,2n−1}∑​(a=1∏r​Ria​ja​​)cj1​​⋯cjr​​,

with the real coefficient regarded as a complex scalar. The summation ranges over all choices of indices, including repeated choices, and the matrix factors retain their position order. No ordering condition on lll, relations among the cic_ici​, or orthogonality condition on RRR are imposed. For an empty list, there is one empty choice of indices, the scalar product is 111, and the result is the identity matrix; this also covers the only possible list when n=0n=0n=0.

QAlgorithms.Papers.Independent.Intakethird100.P77.gaussianCircuit

For any natural number nnn, any arbitrary family cic_ici​, 0≤i<2n0\le i<2n0≤i<2n, of complex matrices indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, and any finite list [h1,…,hr][h_1,\ldots,h_r][h1​,…,hr​] of real 2n×2n2n\times2n2n×2n matrices, this defines

G(c,hr)⋯G(c,h1),G(c,h)=exp⁡ ⁣(−∑0≤i,j<2ni≠jhijcicj).G(c,h_r)\cdots G(c,h_1), \qquad G(c,h)=\exp\!\left(-\sum_{\substack{0\le i,j<2n\\i\ne j}}h_{ij}c_i c_j\right).G(c,hr​)⋯G(c,h1​),G(c,h)=exp​−0≤i,j<2ni=j​∑​hij​ci​cj​​.

Thus the factors occur in reverse list order. Neither skew-symmetry of the matrices hkh_khk​ nor any relations among the matrices cic_ici​ are required. An empty list gives the identity matrix; when n=0n=0n=0, every factor and hence the resulting product is the identity.

QAlgorithms.Papers.Independent.Intakethird100.P77.gaussianOperation

For any natural number nnn, any family cic_ici​ of complex matrices indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, with 0≤i<2n0\le i<2n0≤i<2n, and any real 2n×2n2n\times2n2n×2n matrix hhh, this defines

G(c,h)=exp⁡ ⁣(i[i∑0≤i,j<2ni≠jhijcicj])=exp⁡ ⁣(−∑0≤i,j<2ni≠jhijcicj),G(c,h)=\exp\!\left(\mathrm{i}\left[\mathrm{i}\sum_{\substack{0\le i,j<2n\\i\ne j}}h_{ij}c_i c_j\right]\right) =\exp\!\left(-\sum_{\substack{0\le i,j<2n\\i\ne j}}h_{ij}c_i c_j\right),G(c,h)=exp​i​i0≤i,j<2ni=j​∑​hij​ci​cj​​​=exp​−0≤i,j<2ni=j​∑​hij​ci​cj​​,

where exp⁡\expexp is the matrix exponential and multiplication inside the sum is matrix multiplication. No relations on the matrices cic_ici​ or skew-symmetry of hhh are required. When n=0n=0n=0, this is the identity matrix.

QAlgorithms.Papers.Independent.Intakethird100.P77.jordanWigner

For every natural number nnn and every index i∈{0,…,2n−1}i\in\{0,\ldots,2n-1\}i∈{0,…,2n−1}, write q=⌊i/2⌋q=\lfloor i/2\rfloorq=⌊i/2⌋. The definition gives the complex matrix on Boolean strings x,yx,yx,y of length nnn whose entry is

∏k=0n−1Mk(xk,yk),Mk={Z,k<q,X,k=q and i is even,Y,k=q and i is odd,I,k>q,\prod_{k=0}^{n-1}M_k(x_k,y_k),\qquad M_k=\begin{cases} Z,&k<q,\\ X,&k=q\text{ and }i\text{ is even},\\ Y,&k=q\text{ and }i\text{ is odd},\\ I,&k>q, \end{cases}k=0∏n−1​Mk​(xk​,yk​),Mk​=⎩⎨⎧​Z,X,Y,I,​k<q,k=q and i is even,k=q and i is odd,k>q,​

where, in the Boolean order (false,true)(\mathrm{false},\mathrm{true})(false,true),

X=(0110),Y=(0−ii0),Z=(100−1).X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\qquad Y=\begin{pmatrix}0&-\mathrm i\\\mathrm i&0\end{pmatrix},\qquad Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.X=(01​10​),Y=(0i​−i0​),Z=(10​0−1​).

The case n=0n=0n=0 is included in the natural-number parameter, but then there is no permissible index iii.

QAlgorithms.Papers.Independent.Intakethird100.P77.majoranaWord

For any natural number nnn, any family cic_ici​, 0≤i<2n0\le i<2n0≤i<2n, of arbitrary complex matrices indexed by Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, and any finite list l=[i1,…,ir]l=[i_1,\ldots,i_r]l=[i1​,…,ir​] of these indices, this defines the ordered matrix product

ci1ci2⋯cir.c_{i_1}c_{i_2}\cdots c_{i_r}.ci1​​ci2​​⋯cir​​.

Repeated indices and arbitrary index order are allowed, and no relations among the matrices are assumed. The empty list gives the identity matrix; when n=0n=0n=0, the empty list is the only possible list.

QAlgorithms.Papers.Independent.Intakethird100.P77.modifiedSwap

For every natural number nnn, every family c0,…,c2n−1c_0,\ldots,c_{2n-1}c0​,…,c2n−1​ of arbitrary complex matrices indexed by nnn-bit strings, and every injection w:{0,1}↪{0,…,n−1}w:\{0,1\}\hookrightarrow\{0,\ldots,n-1\}w:{0,1}↪{0,…,n−1}, write ca,b=c2w(a)+bc_{a,b}=c_{2w(a)+b}ca,b​=c2w(a)+b​ for a,b∈{0,1}a,b\in\{0,1\}a,b∈{0,1}. This definition is the matrix exp⁡ ⁣(−π4[−c0,0c1,1+c0,1c1,0+c0,0c0,1+c1,0c1,1])\exp\!\left(-\frac{\pi}{4}\left[-c_{0,0}c_{1,1}+c_{0,1}c_{1,0}+c_{0,0}c_{0,1}+c_{1,0}c_{1,1}\right]\right)exp(−4π​[−c0,0​c1,1​+c0,1​c1,0​+c0,0​c0,1​+c1,0​c1,1​]), where products are matrix products in the displayed order. The matrices cjc_jcj​ need not satisfy any anticommutation or Hermiticity conditions, and the two selected wires need not be adjacent; their injection requires n≥2n\ge2n≥2.

QAlgorithms.Papers.Independent.Intakethird100.P77.outputExpectation

For every natural number nnn, arbitrary complex matrices U,AU,AU,A indexed by Boolean strings of length nnn, and arbitrary complex vector ψ\psiψ on those strings, this function returns the complex number

⟨Uψ,A(Uψ)⟩=∑x∈{0,1}n(Uψ)x‾∑y∈{0,1}nAxy(Uψ)y,(Uψ)x=∑yUxyψy.\langle U\psi,A(U\psi)\rangle =\sum_{x\in\{0,1\}^n} \overline{(U\psi)_x}\sum_{y\in\{0,1\}^n}A_{xy}(U\psi)_y, \qquad (U\psi)_x=\sum_yU_{xy}\psi_y.⟨Uψ,A(Uψ)⟩=x∈{0,1}n∑​(Uψ)x​​y∈{0,1}n∑​Axy​(Uψ)y​,(Uψ)x​=y∑​Uxy​ψy​.

No unitarity, normalization, or Hermitian assumptions are imposed, and the result is not required to be real. The definition includes n=0n=0n=0, where the indexing set contains the single empty string.

QAlgorithms.Papers.Independent.Intakethird100.P77.pairMajor

For every natural number nnn, every injection w:{0,1}↪{0,…,n−1}w:\{0,1\}\hookrightarrow\{0,\ldots,n-1\}w:{0,1}↪{0,…,n−1}, every a∈{0,1}a\in\{0,1\}a∈{0,1}, and every Boolean bbb, this definition returns the index 2w(a)+b2w(a)+b2w(a)+b in {0,…,2n−1}\{0,\ldots,2n-1\}{0,…,2n−1}, interpreting false as 000 and true as 111. Thus it selects the even or odd index associated with the chosen wire. The injection requires n≥2n\ge2n≥2; no adjacency condition is imposed.

QAlgorithms.Papers.Independent.Intakethird100.P77.parityCircuit

For every natural number nnn and every finite list ccc of applications, each consisting of two Boolean-indexed complex unitary matrices A,BA,BA,B and an injection specifying two ordered, distinct wires among nnn wires, this function returns a circuit over the set of all gates by replacing each application, in the same list order, with the arity-222 gate on those wires whose (x,y)(x,y)(x,y) entry is 000 for differing two-bit exclusive-or parities, A(x0,y0)A(x_0,y_0)A(x0​,y0​) for common parity false, and B(x0,y0)B(x_0,y_0)B(x0​,y0​) for common parity true. The resulting circuit is a list of the same length as ccc; no determinant-equality or wire-distance condition is required. An empty input list gives an empty circuit, and when n<2n<2n<2 the input list must be empty.

QAlgorithms.Papers.Independent.Intakethird100.P77.parityGate

For any two complex matrices AAA and BBB indexed by Boolean rows and columns, this function defines a matrix indexed by two-bit strings x=(x0,x1)x=(x_0,x_1)x=(x0​,x1​) and y=(y0,y1)y=(y_0,y_1)y=(y0​,y1​). Its (x,y)(x,y)(x,y) entry is 000 if x0⊕x1≠y0⊕y1x_0\mathbin{\oplus}x_1\ne y_0\mathbin{\oplus}y_1x0​⊕x1​=y0​⊕y1​, is Ax0,y0A_{x_0,y_0}Ax0​,y0​​ if both parities are false, and is Bx0,y0B_{x_0,y_0}Bx0​,y0​​ if both parities are true, where ⊕\oplus⊕ is exclusive-or. Thus, in the order 00,01,10,1100,01,10,1100,01,10,11, the resulting matrix is

(A0000A010B00B0100B10B110A1000A11).\begin{pmatrix} A_{00}&0&0&A_{01}\\ 0&B_{00}&B_{01}&0\\ 0&B_{10}&B_{11}&0\\ A_{10}&0&0&A_{11} \end{pmatrix}.​A00​00A10​​0B00​B10​0​0B01​B11​0​A01​00A11​​​.

Here the subscripts 0,10,10,1 on AAA and BBB denote false,true; no assumptions on either matrix are required.

QAlgorithms.Papers.Independent.Intakethird100.P77.permutationOperator

For every natural number nnn and every permutation ppp of the indices {0,…,n−1}\{0,\ldots,n-1\}{0,…,n−1}, this defines the complex matrix indexed by length-nnn bit strings whose entry in row xxx and column yyy is

(Pp)x,y={1,xi=yp(i) for every i,0,otherwise.(P_p)_{x,y}= \begin{cases} 1,&x_i=y_{p(i)}\text{ for every }i,\\ 0,&\text{otherwise}. \end{cases}(Pp​)x,y​={1,0,​xi​=yp(i)​ for every i,otherwise.​

Thus it sends the coordinate vector ∣y⟩|y\rangle∣y⟩ to ∣y∘p⟩|y\circ p\rangle∣y∘p⟩. The case n=0n=0n=0 is included, giving the 1×11\times11×1 matrix with entry 111.

QAlgorithms.Papers.Independent.Intakethird100.P77.productOperator

For every natural number nnn and every family P0,…,Pn−1P_0,\ldots,P_{n-1}P0​,…,Pn−1​ of arbitrary complex matrices indexed by the Boolean values, this function defines a matrix on Boolean strings of length nnn by

(productOperator⁡(P))xy=∏i=0n−1(Pi)xiyi.\bigl(\operatorname{productOperator}(P)\bigr)_{xy} =\prod_{i=0}^{n-1}(P_i)_{x_i y_i}.(productOperator(P))xy​=i=0∏n−1​(Pi​)xi​yi​​.

No normalization, Hermitian, or unitarity conditions are imposed. When n=0n=0n=0, the empty product is 111, giving the 1×11\times11×1 matrix with entry 111.

QAlgorithms.Papers.Independent.Intakethird100.P77.quadraticHamiltonian

For any natural number nnn, let Qn={0,1}nQ_n=\{0,1\}^nQn​={0,1}n, let c0,…,c2n−1c_0,\ldots,c_{2n-1}c0​,…,c2n−1​ be arbitrary complex matrices indexed by QnQ_nQn​, and let hhh be an arbitrary real 2n×2n2n\times2n2n×2n matrix. This defines the complex matrix

H(c,h)=i∑0≤i,j<2ni≠jhijcicj.H(c,h)=\mathrm{i}\sum_{\substack{0\le i,j<2n\\i\ne j}}h_{ij}c_i c_j.H(c,h)=i0≤i,j<2ni=j​∑​hij​ci​cj​.

The sum includes all ordered pairs of distinct indices and ignores every diagonal entry of hhh. No Hermiticity, anticommutation, or skew-symmetry assumption is imposed. When n=0n=0n=0, the sum is empty and the result is the zero matrix on the singleton set Q0Q_0Q0​.

QAlgorithms.Papers.Independent.Intakethird100.P77.singleWireProbability

For every natural number nnn, arbitrary complex matrix UUU indexed by Boolean strings of length nnn, arbitrary complex vector ψ\psiψ on those strings, wire k∈{0,…,n−1}k\in\{0,\ldots,n-1\}k∈{0,…,n−1}, and Boolean bbb, this function returns

∑x∈{0,1}nxk=b∣∑y∈{0,1}nUxyψy∣2.\sum_{\substack{x\in\{0,1\}^n\\x_k=b}} \left|\sum_{y\in\{0,1\}^n}U_{xy}\psi_y\right|^2.x∈{0,1}nxk​=b​∑​​y∈{0,1}n∑​Uxy​ψy​​2.

No unitarity of UUU or normalization of ψ\psiψ is assumed, so the definition itself does not require this number to lie in [0,1][0,1][0,1]. Although nnn ranges over all natural numbers, supplying kkk is impossible when n=0n=0n=0.

QAlgorithms.Papers.Independent.Intakethird100.P77.sourceCircuit

For every natural number nnn and every finite list ccc of instructions on nnn wires, this definition produces a circuit over the set of all gates by replacing each instruction, in the same list order, with its gate application: a unitary one-wire instruction becomes the corresponding arity-one gate on its specified wire, and a controlled-ZZZ instruction becomes the arity-two diagonal gate with diagonal entries 1,1,1,−11,1,1,-11,1,1,−1 on its specified ordered adjacent pair. A circuit here is simply a list of such gate applications, so the empty instruction list produces the empty circuit.

QAlgorithms.Papers.Independent.Intakethird100.P77.tupleCode

For every finite list [x1,…,xr][x_1,\ldots,x_r][x1​,…,xr​] of finite Boolean strings, this function returns the concatenation (1∣x1∣0)x1⋯(1∣xr∣0)xr(1^{|x_1|}0)x_1\cdots(1^{|x_r|}0)x_r(1∣x1​∣0)x1​⋯(1∣xr​∣0)xr​, where 1k1^k1k denotes kkk copies of true, 000 denotes false, and ∣xi∣|x_i|∣xi​∣ is the length of xix_ixi​. Thus each string is preceded by its length in unary followed by false; there is no separate prefix specifying the number of strings. The empty list produces the empty string, and an empty component contributes just one false.

QAlgorithms.Papers.Independent.Intakethird100.P77.zOperator

For every natural number nnn and wire k∈{0,…,n−1}k\in\{0,\ldots,n-1\}k∈{0,…,n−1}, this function defines the matrix on Boolean strings of length nnn obtained by taking the product of single-wire matrix entries, using diag⁡(1,−1)\operatorname{diag}(1,-1)diag(1,−1) on wire kkk and the identity on every other wire. Equivalently, its entries are

(Zk)xy={1,x=y and xk=false,−1,x=y and xk=true,0,x≠y.(Z_k)_{xy}= \begin{cases} 1,&x=y\text{ and }x_k=\mathrm{false},\\ -1,&x=y\text{ and }x_k=\mathrm{true},\\ 0,&x\ne y. \end{cases}(Zk​)xy​=⎩⎨⎧​1,−1,0,​x=y and xk​=false,x=y and xk​=true,x=y.​

There is no possible wire argument when n=0n=0n=0.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Nov 1, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me