Definitions for Matchgates and classical simulation of quantum circuits
DefinitionQAlgorithms_Papers_Independent_Intakethird100_P77The 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.
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
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 , with a width and a finite gate list for every Boolean string , and output wires with , and for a natural number , this property says that for every , every gate in the list at has two unitary Boolean-indexed complex matrices and an injective wire assignment satisfying both and . This quantifies over as well. Empty gate lists satisfy these conditions vacuously; when , 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 , consisting of widths , lists of two-wire gates with unitary Boolean-indexed matrices and injective wire assignments , and output wires satisfying , this property requires three polynomial-time Boolean-string computations. Write and . First, the function
must be polynomial-time computable. Second, form the complex-entry list by taking, for each gate in order, the four entries of and then those of , each in order . There must be a polynomial-time function which, on , approximates entry 's real part if , or imaginary part if , within , for every valid , every , and both . Its output denotes the binary integer in its tail divided by , negated when its first bit is true; empty or missing bits contribute zero. Third, must be polynomial-time computable for every Boolean string . Polynomial time means computability by a TM2 Turing machine using identity input and output encodings. These requirements include empty input strings and precision .
QAlgorithms.Papers.Independent.Intakethird100.P77.BasisDecisionFamily.acceptance
For a basis decision family , with widths , gate lists, and output wires satisfying , and a finite Boolean string , put , , and . Each gate in the list at has unitary Boolean-indexed matrices and an injective ordered pair of wires; on those wires, its entry from to is zero if their parities differ, is if both parities are even, and is if both are odd, with every other wire unchanged. Let be the product of these embedded matrices in reverse list order, the empty product being the identity, and let contain in its first positions and false in its remaining positions. The defined acceptance value is
The definition includes the empty input ; 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 a width and a finite ordered list of gates, each carrying two unitary complex matrices , indexed by Boolean values, and an injection of its two wire positions into ; an output wire for every ; and a proof that for every . The presence of an output wire also requires , including at . 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 and any finite list of complex-coefficient terms whose index lists are strictly increasing in and do not repeat, this predicate means that every stored term has an index list of length at most . This requirement applies even to terms with coefficient zero. It holds vacuously for an empty list of terms. For , every stored index list must be empty; for , it holds for every .
QAlgorithms.Papers.Independent.Intakethird100.P77.CARPolynomial.eval
For any natural number , let be a finite list of terms with complex coefficients, where each index list is strictly increasing in and distinct terms have distinct index lists. For any arbitrary family of complex matrices indexed by , this defines
An empty index list contributes , while an empty list of terms evaluates to zero. No Hermiticity or anticommutation assumptions are imposed on . When , the result is zero or a scalar multiple of the identity.
QAlgorithms.Papers.Independent.Intakethird100.P77.CARPolynomial
For any natural number , this structure consists of a finite list of pairs , where and is a finite list of indices in , together with the requirements that the indices in each stored list 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 , it is either empty or consists of a single term with an empty index list.
QAlgorithms.Papers.Independent.Intakethird100.P77.EffectiveCode
For any function from finite Boolean strings to finite Boolean strings, this predicate means that there exists a polynomial-time TM2 computation of 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 assigning a finite list of complex numbers to each finite Boolean string, this predicate means that there exists one function 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 , every index , every natural number , and every Boolean , the following approximation holds: form the four component strings , , , and , prefix each component by , concatenate them in that order, and apply ; interpret its output as a signed binary integer divided by , 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 from the imaginary part of the th entry of if is true, and from its real part if is false. An empty output or an output of length one is interpreted as . The case is included and requires error at most ; if is empty, there are no approximation requirements for that .
QAlgorithms.Papers.Independent.Intakethird100.P77.EffectivePermutations
For a function assigning a natural number to every finite Boolean string , and a permutation of for every , 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 in order, encode each number as 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 , where 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 , this property is the conjunction of polynomial-time computability of its structural encoding and polynomial-time approximability of its numerical data. More precisely, let denote true bits and let concatenate the strings in order. At input , the structural encoding is , where is the width, is the gate-list length, and encodes the observable’s ordered index-word list by applying to the encodings of its words. The numerical list 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 , ordered by gate, row and column; and all observable coefficients, ordered by wire and term. The structural encoding, as a function of , must have a polynomial-time Turing-machine realization with identity string encodings. There must also exist a polynomial-time Boolean-string function such that, for every , valid index , natural precision , and Boolean ,
Here 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 ; 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 and finite Boolean string , let be its width, the length of its ordered list of real skew-symmetric gate matrices, its measured-wire index, and the generator-index words in its observable’s term list, in their stored order. Its code is the Boolean string
Here is true bits, and concatenates each constituent string after prefixing it with its length in unary followed by a false bit. Generator indices are their natural values in . 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 and finite Boolean string , write for its width, for the complex factor of generator on wire , for its ordered list of real skew-symmetric gate matrices, and for its observable terms. Its data is a single list of complex numbers formed by concatenating three lists: first, for increasing and then increasing , the four entries
second, for gates in their stored order, all entries , embedded from into , with increasing first as the outer index and increasing as the inner index; and third, the coefficients 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 . It has a natural width , with basis labels , and complex matrices on this basis satisfying
For each generator and wire , it supplies a complex matrix , with the required factorization
It also supplies a finite ordered list of real matrices , each satisfying , a measured wire , and a finite list of pairs , where and is a list of generator indices. Each word has strictly increasing indices, and no word occurs twice in this list. These pairs must satisfy
where , 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 for every .
QAlgorithms.Papers.Independent.Intakethird100.P77.InBoundedMatchgate
For a natural number and a language of finite Boolean strings, this property asserts the existence of widths , finite gate lists at every string , and output wires , with for all , satisfying the following requirements. Each gate has two unitary Boolean-indexed complex matrices and an injective wire assignment . Put and . The functions encoding each family member as , and sending to , must be polynomial-time computable. There must also be a polynomial-time function which, queried on , approximates the real or imaginary part, selected respectively by or true, of entry of the gate-data list within , for every valid and every ; that list contains then for each gate, with entries ordered , and a returned string denotes its binary tail divided by , 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 , each gate must satisfy and . Its two-wire matrix uses on even-parity rows and columns, 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 be the reverse-order product of the embedded gate list at , with the empty product the identity, and let be followed by false bits to width . For every string , including the empty string, the quantity
must satisfy if , and if . When , the injectivity and distance requirements force all gate lists at unary strings to be empty.
QAlgorithms.Papers.Independent.Intakethird100.P77.InP
For a set of finite Boolean strings, this property says that there exists a function 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 , and exactly [false] on every . This requirement applies to every input string, including the empty string.
QAlgorithms.Papers.Independent.Intakethird100.P77.InPQPMatchgate
For a natural number and a language of finite Boolean strings, this property asserts the existence of widths , finite gate lists for every string , output wires with , and a polynomial with natural-number coefficients such that for every . Each gate carries unitary Boolean-indexed complex matrices and an injective ordered pair of wires . Write and . The encoding and the function must be polynomial-time computable. The gate-data list, consisting of then for each gate and entries in order , must admit a polynomial-time approximation function: at input , it approximates entry 's real part for , or imaginary part for , within , for all valid and all . The returned string represents its binary tail divided by , 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 , all gates must satisfy and . The local gate matrix has entries from on the even-parity block, from on the odd-parity block, each indexed by the first bit, and zero between blocks; other wires are unchanged. Let be the reverse-order product of these embedded gates, and let be padded with false to the width at . Then for every string ,
The conditions include length zero; output-wire existence requires positive width there. Empty gate lists are allowed, and forces all unary-indexed gate lists to be empty.
QAlgorithms.Papers.Independent.Intakethird100.P77.IntertwinedFamily.Effective
For an intertwined family , this predicate requires two polynomial-time computability properties. To state them explicitly, let be true bits, and let concatenate , a false bit, and for every . At parameter string , write for the base width, for the number of base skew-symmetric real gate matrices, and for the ordered index word of term in the observable at wire ; these words are strictly increasing and distinct within each observable. The first requirement is that a polynomial-time function compute exactly
from . The second requirement concerns the numerical list obtained by concatenating the gate matrices’ entries in gate, row, and column order, then the four entries 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 , and the observable words evaluated on these matrices give the single-wire operators. There must exist a polynomial-time function such that, for every , every , every , and every Boolean , interpreting as a signed binary integer divided by gives an approximation within of if is false and if 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 , 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 and finite Boolean string , let be its base width, its base gate-list length, its measured-wire index, and the distinct, strictly increasing generator-index words in its observable’s stored term list. Its code is
Here denotes true bits, and tuple encoding concatenates each constituent string after prefixing it with its length in unary followed by a false bit. The inner is the base-family code. Generator indices are their natural values below . 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 and finite Boolean string , let be its base width, its ordered list of real skew-symmetric base gate matrices, its complex factors satisfying , and its observable terms. Its data is the concatenation of: all entries of , embedded into , in gate order and then increasing row and column order; all factor entries, for increasing generator index , then increasing wire , in the order
and finally the coefficients in stored term order. The are the tensor products with preceding factors, an or factor at wire according to the parity of , 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 , giving a natural width and an ordered finite list of real matrices satisfying , together with the following additional data and requirements. For each , it supplies a unitary matrix on the basis which normalizes the subgroup generated by all matrices
where , , and . Thus conjugation by preserves that subgroup. Define the matrices , , as tensor products with on wires , with at wire when is even and there when is odd, and identity on later wires. The family supplies complex matrices satisfying
It also supplies a measured wire and a finite list of pairs , with , whose words have strictly increasing indices in and do not repeat. These must represent the measured matrix:
where is on wire 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 and any real matrix , this predicate means
When , the unique empty matrix satisfies both conditions, with empty determinant equal to .
QAlgorithms.Papers.Independent.Intakethird100.P77.JWFamily.Effective
For a JW family , assigning each finite Boolean string a natural width and an ordered list of real skew-symmetric matrices, this property requires both of the following. First, the string function has a polynomial-time Turing-machine realization with identity string encodings, where denotes true bits and concatenates . Second, if is the list of gate entries embedded into , in gate order and then increasing row and column order, there exists a polynomial-time Boolean-string function satisfying, for every , valid index , natural , and Boolean ,
Here 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 ; the empty string represents zero. Precision zero is included, and the numerical condition is vacuous whenever is empty.
QAlgorithms.Papers.Independent.Intakethird100.P77.JWFamily.code
For every JW family , which assigns each finite Boolean string a width and a finite ordered list of real skew-symmetric matrices, the definition returns , where is the gate-list length, is the string of true bits, and concatenates , one false bit and for each argument in order. Thus the returned string is . 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 and finite Boolean string , let be its width and let be its ordered list of real skew-symmetric matrices. The definition returns the complex-number list of all entries of , then all entries of , 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 . It retains zero and repeated entries and has length . 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 for every finite Boolean string , together with a finite ordered list of real matrices for each , and a requirement that every matrix appearing in that list satisfies for all indices . 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 and every application consisting of two Boolean-indexed complex unitary matrices and an injection of two ordered wires into wires, this predicate means exactly . It adds no condition on the wire positions beyond their already required distinctness. For or , there is no such application .
QAlgorithms.Papers.Independent.Intakethird100.P77.ParityApp
For each natural number , an object of this structure consists of two complex unitary matrices and , each with Boolean row and column indices, together with an injective map specifying two ordered, distinct wires. No equality of and is required by the structure. Such an object cannot exist when or , because the required injection then cannot exist.
QAlgorithms.Papers.Independent.Intakethird100.P77.ParityApp.toGateApp
For every natural number and every application consisting of Boolean-indexed complex unitary matrices and an injective two-wire map , this function constructs an application of a gate from the set of all gates on the same wires. The constructed gate has arity and matrix entries indexed by two-bit strings : the entry is when their exclusive-or parities differ, when both parities are false, and when both are true. Its wire map is exactly . No hypothesis is imposed; for there is no input application .
QAlgorithms.Papers.Independent.Intakethird100.P77.ParityFamily.Effective
For every family 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 be true bits, and let encode a list of strings by prefixing each constituent string with followed by a false bit. If has width and applications at , with ordered wires , there must be a polynomial-time computable string function returning exactly . Separately, form by listing, for each application in order, the entries of its first unitary matrix and then those of its second. There must be a polynomial-time computable string function such that, for every , index , natural number , and Boolean , the string , interpreted as a signed binary integer divided by , differs by at most from when is false and from when 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 is included, and an empty data list imposes no entry-approximation conditions.
QAlgorithms.Papers.Independent.Intakethird100.P77.ParityFamily.code
For every family assigning a width and a list of two-wire applications to each finite Boolean string , this function returns the following Boolean string. Write for consecutive true bits, and define by concatenating , one false bit, and , for each in order. If the application list at is , with ordered wire indices , the returned string is
Each application also contains two unitary 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 assigning a width and a finite ordered list of two-wire applications to each finite Boolean string , this function returns a list of complex numbers obtained by traversing the applications in order. For each application, whose two unitary matrices are and , it appends
where means false and means true. Thus a list of applications gives 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 to every finite Boolean string , and, for each such , a finite ordered list of applications on wires. Each application contains two unitary complex matrices indexed by , together with an injection from into , 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 on finite Boolean strings, any assignment of unit-norm complex two-component vectors for , and any string , this function returns the complex list
The factors are listed in increasing wire order, with the false component before the true component. The list has length and is empty when .
QAlgorithms.Papers.Independent.Intakethird100.P77.ProductInputs
For any function from finite Boolean strings to natural numbers, a value of this structure assigns to every string and every index a complex vector indexed by the two Boolean values, and includes the requirement
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 , natural number , and finite list of gate applications on wires, each application consisting of two unitary complex matrices and an ordered pair of distinct wire indices, this predicate means that every application in has wire indices satisfying . The condition holds vacuously for an empty list; because the two indices are distinct, permits only an empty list.
QAlgorithms.Papers.Independent.Intakethird100.P77.SelectedStrongSimulation
For any function assigning a real number to each finite Boolean string and each Boolean , this property means that there exists a polynomial-time computable function from finite Boolean strings to finite Boolean strings such that, for every , every natural number , and both values of ,
Here is the string of true bits; concatenates, for each , the string , a false bit, and then itself. To obtain , interpret the tail of as a binary natural number, reading from left to right by the update , negate this number exactly when the first bit is true, and divide by . 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 , where the permitted error is ; no probability or range restriction on is imposed.
QAlgorithms.Papers.Independent.Intakethird100.P77.Skew
For any natural number and any real matrix indexed by , this predicate means
In particular, every diagonal entry must be zero. When , there are no indices and the condition holds vacuously.
QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily.Effective
For a family assigning a width and an instruction list to each finite Boolean string , this property is the conjunction of two requirements. Define to be true bits and define by concatenating true bits, one false bit, and for each component in order. First, the function sending to is computable by a polynomial-time Turing machine on Boolean strings with identity input and output encodings; a one-wire instruction on has record , and an adjacent controlled- instruction on has record . Second, there exists a polynomial-time computable Boolean-string function such that, for every , every index of the list obtained by concatenating the four entries of each one-wire unitary in row order false, true while omitting controlled- instructions, every natural precision , and every Boolean , the string satisfies . Here 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 ; missing bits default to false, so the empty string represents zero. Precision is included, and when is empty there are no entry-index requirements for that .
QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily.code
For every family assigning a width and a finite instruction list to each finite Boolean string, and every input string , this definition produces the following Boolean encoding. Let be the string of true bits, and let concatenate, for each in order, true bits, one false bit, and then itself. The result is applied to the list beginning with and , followed by one record for each instruction in its list order. A one-wire instruction on wire contributes , while a controlled- instruction on ordered adjacent wires contributes . The one-wire unitary matrices are not included in this encoding.
QAlgorithms.Papers.Independent.Intakethird100.P77.SourceFamily.data
For every family assigning a width and a finite instruction list to each finite Boolean string, and every input string , this definition forms a list of complex numbers by traversing in order and concatenating the contributions of its instructions. A one-wire instruction with unitary matrix contributes the four entries in exactly that order; a controlled- 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 , together with a finite list of instructions on that many wires for each . Each instruction is either an arbitrary unitary complex matrix on one specified wire or a controlled- instruction on an injectively selected ordered pair satisfying . 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 , this defines a type of instructions with two constructors: a one-wire instruction specified by an arbitrary Boolean-indexed unitary complex matrix and a wire ; or a controlled- instruction specified by an injection together with the condition . There are no instructions when , and the second constructor is unavailable when .
QAlgorithms.Papers.Independent.Intakethird100.P77.SourceStep.toGateApp
For every natural number , this maps an instruction on wires to a gate application whose allowed gate set consists of all gates. A one-wire instruction with unitary matrix and wire becomes an arity-one gate with matrix entry for one-bit strings , applied through the injection sending its sole wire to . A controlled- instruction with injection becomes an arity-two gate applied through , whose matrix entry on two-bit strings is if and both bits are true, if and they are not both true, and if . The adjacency proof carried by the controlled- instruction does not contribute any additional data to the resulting gate application.
QAlgorithms.Papers.Independent.Intakethird100.P77.StrongSimulation
For any function from finite Boolean strings to natural numbers and any family of real numbers indexed by a string , an integer , and a Boolean , this predicate means that there exists one function 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 , every natural number , every such , and both values of : prefix each of the four strings , , , and by its unary length followed by false, concatenate them in that order, and apply ; the output, interpreted as a signed binary integer divided by , differs from by at most . 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 . Precision is included. When , there are no requirements for that . No probability bounds or normalization conditions on , and no computability condition on itself, are part of this predicate.
QAlgorithms.Papers.Independent.Intakethird100.P77.SupportedOnPair
For every natural number , every injection , and every real matrix indexed in both coordinates by , this property means that, for all indices ,
Equivalently, entries may be nonzero only when both indices belong to . 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 exists when .
QAlgorithms.Papers.Independent.Intakethird100.P77.basisInput
For every natural number and finite Boolean string , this defines the vector in whose amplitude is one at the bit string given by when position exists in , and otherwise, and whose other amplitudes are zero. Consequently, positions of beyond the first are unused, and missing positions among the first are filled with false. When , the vector has amplitude one at the unique empty bit string, for every .
QAlgorithms.Papers.Independent.Intakethird100.P77.binaryNat
For every finite Boolean string , this function returns the natural number obtained by starting at and, reading the string from left to right, replacing by when the next bit is true and by when it is false. Equivalently, identifying false with and true with , its value is . The empty string has value , and leading false bits are allowed.
QAlgorithms.Papers.Independent.Intakethird100.P77.circuitRotation
For any natural number and any finite list of arbitrary real matrices, this defines the real matrix
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 ; when , the result is the unique empty identity matrix.
QAlgorithms.Papers.Independent.Intakethird100.P77.conjugatedGenerators
For any natural number , any unitary matrix indexed by length- bit strings, any family of complex matrices indexed by those strings, and any index , this defines the matrix
where is the conjugate transpose. No algebraic relations on the matrices are assumed. The parameter is permitted, but there is then no index at which to evaluate this family.
QAlgorithms.Papers.Independent.Intakethird100.P77.dyadic
For every finite Boolean string and every natural number , this function returns , where is the first bit of , interpreted as for false and for true, and is the natural number represented in binary by the remaining bits, read from left to right with the most significant bit first. If is empty, the first bit defaults to false and the remaining string is empty, whose binary value is . Consequently, empty strings and strings of length one both give . The parameter may be , in which case the denominator is ; no relationship between and the length of is required.
QAlgorithms.Papers.Independent.Intakethird100.P77.encodeFourBits
For every natural number and every Boolean string indexed by , this definition produces a Boolean string of length by replacing each input bit with the four-bit block . Equivalently, its bit at index is when is or , and is false otherwise. For , it returns the unique empty indexed Boolean string.
QAlgorithms.Papers.Independent.Intakethird100.P77.encodeState
For any natural numbers , any function from length- bit strings to length- bit strings, and any complex Euclidean vector indexed by length- bit strings, this defines the vector
where has coordinate at and elsewhere. Equivalently, its coordinate at is . No injectivity assumption on or normalization assumption on is imposed: amplitudes with the same image are added, and a coordinate with no preimage is zero. Both and are included; a zero-length bit-string space has one element.
QAlgorithms.Papers.Independent.Intakethird100.P77.encodeTwoBits
For every natural number and every bit string , this defines a bit string of length whose coordinate is . Thus each input bit appears twice, consecutively:
The definition includes , when both strings are empty.
QAlgorithms.Papers.Independent.Intakethird100.P77.entries
For every complex matrix whose rows and columns are indexed by the two Boolean values, this function returns the four-entry list . There are no assumptions on , such as unitarity or Hermitian symmetry.
QAlgorithms.Papers.Independent.Intakethird100.P77.expandedWord
For any natural number , any arbitrary family , , of complex matrices indexed by , any arbitrary real matrix , and any finite index list , this defines
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 , relations among the , or orthogonality condition on are imposed. For an empty list, there is one empty choice of indices, the scalar product is , and the result is the identity matrix; this also covers the only possible list when .
QAlgorithms.Papers.Independent.Intakethird100.P77.gaussianCircuit
For any natural number , any arbitrary family , , of complex matrices indexed by , and any finite list of real matrices, this defines
Thus the factors occur in reverse list order. Neither skew-symmetry of the matrices nor any relations among the matrices are required. An empty list gives the identity matrix; when , every factor and hence the resulting product is the identity.
QAlgorithms.Papers.Independent.Intakethird100.P77.gaussianOperation
For any natural number , any family of complex matrices indexed by , with , and any real matrix , this defines
where is the matrix exponential and multiplication inside the sum is matrix multiplication. No relations on the matrices or skew-symmetry of are required. When , this is the identity matrix.
QAlgorithms.Papers.Independent.Intakethird100.P77.jordanWigner
For every natural number and every index , write . The definition gives the complex matrix on Boolean strings of length whose entry is
where, in the Boolean order ,
The case is included in the natural-number parameter, but then there is no permissible index .
QAlgorithms.Papers.Independent.Intakethird100.P77.majoranaWord
For any natural number , any family , , of arbitrary complex matrices indexed by , and any finite list of these indices, this defines the ordered matrix product
Repeated indices and arbitrary index order are allowed, and no relations among the matrices are assumed. The empty list gives the identity matrix; when , the empty list is the only possible list.
QAlgorithms.Papers.Independent.Intakethird100.P77.modifiedSwap
For every natural number , every family of arbitrary complex matrices indexed by -bit strings, and every injection , write for . This definition is the matrix , where products are matrix products in the displayed order. The matrices need not satisfy any anticommutation or Hermiticity conditions, and the two selected wires need not be adjacent; their injection requires .
QAlgorithms.Papers.Independent.Intakethird100.P77.outputExpectation
For every natural number , arbitrary complex matrices indexed by Boolean strings of length , and arbitrary complex vector on those strings, this function returns the complex number
No unitarity, normalization, or Hermitian assumptions are imposed, and the result is not required to be real. The definition includes , where the indexing set contains the single empty string.
QAlgorithms.Papers.Independent.Intakethird100.P77.pairMajor
For every natural number , every injection , every , and every Boolean , this definition returns the index in , interpreting false as and true as . Thus it selects the even or odd index associated with the chosen wire. The injection requires ; no adjacency condition is imposed.
QAlgorithms.Papers.Independent.Intakethird100.P77.parityCircuit
For every natural number and every finite list of applications, each consisting of two Boolean-indexed complex unitary matrices and an injection specifying two ordered, distinct wires among wires, this function returns a circuit over the set of all gates by replacing each application, in the same list order, with the arity- gate on those wires whose entry is for differing two-bit exclusive-or parities, for common parity false, and for common parity true. The resulting circuit is a list of the same length as ; no determinant-equality or wire-distance condition is required. An empty input list gives an empty circuit, and when the input list must be empty.
QAlgorithms.Papers.Independent.Intakethird100.P77.parityGate
For any two complex matrices and indexed by Boolean rows and columns, this function defines a matrix indexed by two-bit strings and . Its entry is if , is if both parities are false, and is if both parities are true, where is exclusive-or. Thus, in the order , the resulting matrix is
Here the subscripts on and denote false,true; no assumptions on either matrix are required.
QAlgorithms.Papers.Independent.Intakethird100.P77.permutationOperator
For every natural number and every permutation of the indices , this defines the complex matrix indexed by length- bit strings whose entry in row and column is
Thus it sends the coordinate vector to . The case is included, giving the matrix with entry .
QAlgorithms.Papers.Independent.Intakethird100.P77.productOperator
For every natural number and every family of arbitrary complex matrices indexed by the Boolean values, this function defines a matrix on Boolean strings of length by
No normalization, Hermitian, or unitarity conditions are imposed. When , the empty product is , giving the matrix with entry .
QAlgorithms.Papers.Independent.Intakethird100.P77.quadraticHamiltonian
For any natural number , let , let be arbitrary complex matrices indexed by , and let be an arbitrary real matrix. This defines the complex matrix
The sum includes all ordered pairs of distinct indices and ignores every diagonal entry of . No Hermiticity, anticommutation, or skew-symmetry assumption is imposed. When , the sum is empty and the result is the zero matrix on the singleton set .
QAlgorithms.Papers.Independent.Intakethird100.P77.singleWireProbability
For every natural number , arbitrary complex matrix indexed by Boolean strings of length , arbitrary complex vector on those strings, wire , and Boolean , this function returns
No unitarity of or normalization of is assumed, so the definition itself does not require this number to lie in . Although ranges over all natural numbers, supplying is impossible when .
QAlgorithms.Papers.Independent.Intakethird100.P77.sourceCircuit
For every natural number and every finite list of instructions on 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- instruction becomes the arity-two diagonal gate with diagonal entries 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 of finite Boolean strings, this function returns the concatenation , where denotes copies of true, denotes false, and is the length of . 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 and wire , this function defines the matrix on Boolean strings of length obtained by taking the product of single-wire matrix entries, using on wire and the identity on every other wire. Equivalently, its entries are
There is no possible wire argument when .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.