Definitions for Renormalization algorithm with graph enhancement
DefinitionQAlgorithms_Papers_Independent_Intakethird100_P57The objects the formalized statements of Renormalization algorithm with graph enhancement (arXiv:0802.1211) are stated in. Each was checked against the paper by a blind read-back and a moderator.
Tensors: Eq.(1), PDF pp.1–2: two arbitrary complex D-by-D site matrices.traceMPS: Eq.(1), PDF p.1: the periodic trace MPS, with matrices multiplied in chain order.PhaseGraph: PDF p.2: symmetric, zero-diagonal graph weights in [0,2π).emptyPhaseGraph: The absent graph (PDF p.2, following Eq.(2)).productOp: PDF p.2: tensor product of local matrices, on arbitrary finite sets of wires.graphAngle: PDF p.2: each unordered edge acts once, with the positive controlled phase.graphOp: PDF p.2: diagonal product of all controlled-phase gates.enhance: Eq.(2), PDF p.2: graph enhancement followed by the local rotations.rage: Eq.(2), PDF p.2: the RAGE raw vector.normalizeRageVector: PDF pp.2–4: normalize a raw nonzero vector before physical uses. At zero this total helper is zero; all physical theorems exclude that input.productVec: PDF p.2, Eq.(3), second line: an arbitrary product vector.plusFactors: PDF p.2: normalized plus factors.productTensors: PDF p.2: bond-one matrices for product vectors.diagonalTensors: Eq.(3), second line, PDF p.2: diagonal tensors for a finite sum of products. The coefficient is placed only at site zero; N≥1 is needed for this construction.etaAmplitude: Eq.(3), PDF p.2: η(d)=|0⟩+exp(d)|1⟩; there is no extra i in this exponent.RageParameters: PDF p.2: all admissible numerical input data; constraints do not remove stored entries.DescriptionIndex: PDF p.2: stored real coordinates: real/imaginary tensor entries, one weight per unordered pair, and real/imaginary entries of each 2-by-2 unitary.describe: PDF p.2: the explicit coordinate description, with the last Boolean selecting Im.joinBits: PDF p.2: glue retained and traced-out bit strings, including empty supports.rawMarginal: PDF p.2: actual partial trace of |v⟩⟨v|, without normalization.rageMarginal: PDF pp.2–4: normalized reduced density matrix, used only for nonzero v.zMean: PDF pp.1,3–4: Z expectation on a unit vector.connectedZ: PDF pp.1,3–4: connected two-point Z correlation on a unit vector.firstBlock: PDF p.2: the first L sites (meaningful also for L=0 and L=N).nextSite: PDF p.2: one cyclic increment. An existing index supplies positivity of N.CyclicInvariant: PDF p.2: exact cyclic invariance of a vector, without a global-phase quotient.transferE: PDF pp.2–3: E[k,a,b]=A[k,a] ⊗ conjugate(A[k,b]); conjugation is entrywise.bitReal: PDF pp.2–3: real bit indicator, to keep a-b signed.transferT: PDF pp.2–3: corrected transfer matrices. The outside phase uses the summed physical index t, not the unbound label in the printed B formula.crossMarginal: PDF pp.2–3: the cross-edge reduced kernel, contracted in chain order.retainedOp: PDF p.2: internal graph gates followed by the rotations on retained sites.rayleighEnergy: PDF p.3, Eq.(4): energy of a raw nonzero vector.SiteCoordinates: PDF p.3: both physical tensors at one site supply 2D² complex coordinates.replaceSite: PDF p.3: replace one site's two tensors, freezing every other entry.siteMap: PDF p.3: the constructed one-site physical linear map, by its coordinate columns.rageSiteQuadratic: PDF p.3: x†Mx, with a complex value until its real part is taken.siteVector: PDF p.3: physical vector from the constructed one-site map.controlledPhaseAction: PDF pp.3–4: apply a phase gate to a distinct pair, using an arbitrary complex label.edgeBackground: PDF p.3: undo one edge from the graph-enhanced vector before the final V layer.edgePart: PDF p.3: the P11 or complementary component of the frozen edge background.edgeTrial: PDF p.3: edge-coordinate trial vector, retaining the entire two-site phase gate.edgeCoefficients: PDF p.3: single-edge energy coefficients, with V undone from H as printed.minimizingPhase: PDF p.3: a minimizing unit-modulus phase for c0+2Re(c1 z).SingleEdgeEnergyLaw: PDF p.3: the single-edge energy form and its constrained minimum. This is not a minimization over unconstrained complex z, and gives no joint global phase optimum.wrapAngle: PDF p.4: reduce any real angle to [0,2π), including negative angles.updatedWeights: PDF p.4: update both symmetric entries, leaving every other pair fixed.overlapObjective: PDF p.4, Eq.(5): normalized squared overlap with a normalized target.localGate: PDF p.4: put one single-qubit unitary at the selected wire.overlapCoefficients: PDF p.4: squared overlap coefficients for the incident-edge coordinate.oppositeWeights: PDF p.2, (i)–(ii): weights of a circulant opposite-site matching on 2L sites.cyclicBlock: PDF p.2, (ii): contiguous blocks on a cyclic chain, including wrapping blocks.mpsTangent: PDF p.3: derivative of the trace product, obtained by inserting one tensor derivative.localTangent: PDF p.3: derivative of the tensor product of local matrices.rawTangent: PDF p.3: explicit differentiated finite tensor/phase product. The ambient formula extends the unitary charts smoothly; no defective unrestricted real-Pauli chart is used.ScalarInstruction: PDF pp.2–3 and p.4 Extensions: ideal scalar instructions, with no matrix-operation primitive. A productCall is reserved for the explicitly supplied base contraction evaluator.ScalarInstruction.eval: PDF pp.2–3: one instruction's exact semantics. Division has a checked denominator.ScalarProgram: PDF pp.2–3: a straight-line scalar program. All registers initially contain zero; each instruction writes the next register. Work includes reads and output-factor formation.ScalarProgram.execute: PDF pp.2–3: execute the instruction list; undefined division fails explicitly.ScalarProgram.calls: PDF p.4: number of calls to the base product-operator evaluator.ScalarProgram.work: PDF pp.2–4: scalar work, charging an oracle call for formation of all 4N factors, in addition to a supplied per-call base-evaluation budget B.ContractionInput: PDF pp.2–3: typed scalar inputs for local contraction. O may be non-Hermitian.contractionData: PDF pp.2–3: numerical input values; no oracle supplies any desired marginal.MarginalProgram: PDF pp.2–3: program outputs include every partial transfer product, so the theorem requires the transfer construction itself, not just an unrelated scalar output.MarginalProgram.Correct: PDF pp.2–3: a program's full transfer-contraction specification. Partial products are in chain order. Both norm division and the final local conjugation must be executed.supportedOp: PDF p.4: embed an operator supported on S, with the identity on its complement.QubitCliffordGate: PDF p.4: a unitary Clifford circuit, with no measurements or postselection. H, S and controlled-X generate the qubit Clifford circuits.hadamardMatrix: PDF p.4: the elementary Hadamard matrix in Boolean basis order 0,1.QubitCliffordGate.matrix: PDF p.4: exact gate action of the three Clifford generators.cliffordMatrix: PDF p.4: circuit order is chronological, so the first gate acts first.EnhancementInput: PDF p.4 Extensions: enhancement inputs, excluding the base state's product evaluator.enhancementData: PDF p.4 Extensions: input data read by the conditional reduction.EnhancementProgram: PDF p.4 Extensions: output register of a product-evaluator reduction.ExactProductEvaluator: PDF p.4 Extensions: exact product expectations, for all complex local matrices. This interface deliberately includes non-Hermitian factors and is uniform in those factors.localTermHamiltonian: PDF pp.2–3: a supplied sum of local Hamiltonian terms. Supports may be long-range.EdgeInput: PDF p.3: scalar inputs for evaluating one-edge energy coefficients term by term.edgeData: PDF p.3: edge coefficient input values, with no precomputed coefficient oracle.EdgeProgram: PDF p.3: executable output registers for c0,c1,Z and the supplied total energy.
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Basic
import Definitions.Def_QAlgorithms_Defs_Ensemble
/-!
Statements from Hübener et al., arXiv:0802.1211v1, PDF pp.1–4.
Paper-local definitions use the periodic trace convention of Eq.(1), not open-boundary MPS.
All algebraic vectors are raw; every physical expectation, marginal and entropy is normalized.
Compilation is pending the batch mechanical handoff.
-/
noncomputable section
open scoped ComplexConjugate Matrix
namespace QAlgorithms.Papers.Independent.Intakethird100.P57
attribute [local instance] Classical.propDecidable
/-- Eq.(1), PDF pp.1–2: two arbitrary complex D-by-D site matrices. -/
abbrev Tensors (N D : ℕ) := Fin N → Bool → Matrix (Fin D) (Fin D) ℂ
/-- Eq.(1), PDF p.1: the periodic trace MPS, with matrices multiplied in chain order. -/
def traceMPS {N D : ℕ} (A : Tensors N D) : EuclideanSpace ℂ (Qubits N) :=
WithLp.toLp 2 fun b => ((List.ofFn fun k => A k (b k)).prod).trace
/-- PDF p.2: symmetric, zero-diagonal graph weights in [0,2π). -/
structure PhaseGraph (N : ℕ) where
weight : Fin N → Fin N → ℝ
symmetric : ∀ i j, weight i j = weight j i
diagonal : ∀ i, weight i i = 0
nonnegative : ∀ i j, 0 ≤ weight i j
bounded : ∀ i j, weight i j < 2 * Real.pi
/-- The absent graph (PDF p.2, following Eq.(2)). -/
def emptyPhaseGraph (N : ℕ) : PhaseGraph N where
weight := fun _ _ => 0
symmetric := by intros; rfl
diagonal := by intros; rfl
nonnegative := by intros; exact le_refl 0
bounded := by intros; positivity
/-- PDF p.2: tensor product of local matrices, on arbitrary finite sets of wires. -/
def productOp {ι : Type*} [Fintype ι] (V : ι → Matrix Bool Bool ℂ) :
Matrix (ι → Bool) (ι → Bool) ℂ :=
Matrix.of fun a b => ∏ k, V k (a k) (b k)
/-- PDF p.2: each unordered edge acts once, with the positive controlled phase. -/
def graphAngle {ι : Type*} [Fintype ι] [LinearOrder ι]
(w : ι → ι → ℝ) (b : ι → Bool) : ℝ :=
∑ i, ∑ j, if i < j ∧ b i = true ∧ b j = true then w i j else 0
/-- PDF p.2: diagonal product of all controlled-phase gates. -/
def graphOp {ι : Type*} [Fintype ι] [LinearOrder ι] (w : ι → ι → ℝ) :
Matrix (ι → Bool) (ι → Bool) ℂ :=
Matrix.diagonal fun b => Complex.exp (Complex.I * (graphAngle w b : ℂ))
/-- Eq.(2), PDF p.2: graph enhancement followed by the local rotations. -/
def enhance {N : ℕ} (G : PhaseGraph N) (V : Fin N → Matrix.unitaryGroup Bool ℂ)
(v : EuclideanSpace ℂ (Qubits N)) : EuclideanSpace ℂ (Qubits N) :=
act (productOp fun k => (V k : Matrix Bool Bool ℂ)) (act (graphOp G.weight) v)
/-- Eq.(2), PDF p.2: the RAGE raw vector. -/
def rage {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N)
(V : Fin N → Matrix.unitaryGroup Bool ℂ) : EuclideanSpace ℂ (Qubits N) :=
enhance G V (traceMPS A)
/-- PDF pp.2–4: normalize a raw nonzero vector before physical uses.
At zero this total helper is zero; all physical theorems exclude that input. -/
def normalizeRageVector {ι : Type*} [Fintype ι] (v : EuclideanSpace ℂ ι) : EuclideanSpace ℂ ι :=
((‖v‖ : ℂ)⁻¹) • v
/-- PDF p.2, Eq.(3), second line: an arbitrary product vector. -/
def productVec {N : ℕ} (r : Fin N → Bool → ℂ) : EuclideanSpace ℂ (Qubits N) :=
WithLp.toLp 2 fun b => ∏ k, r k (b k)
/-- PDF p.2: normalized plus factors. -/
def plusFactors (N : ℕ) : Fin N → Bool → ℂ :=
fun _ _ => (Real.sqrt 2 : ℂ)⁻¹
/-- PDF p.2: bond-one matrices for product vectors. -/
def productTensors {N : ℕ} (r : Fin N → Bool → ℂ) : Tensors N 1 :=
fun k b => Matrix.of fun _ _ => r k b
/-- Eq.(3), second line, PDF p.2: diagonal tensors for a finite sum of products.
The coefficient is placed only at site zero; N≥1 is needed for this construction. -/
def diagonalTensors {N m : ℕ} (c : Fin m → ℂ)
(r : Fin m → Fin N → Bool → ℂ) : Tensors N m :=
fun k b => Matrix.diagonal fun t => (if k.val = 0 then c t else 1) * r t k b
/-- Eq.(3), PDF p.2: η(d)=|0⟩+exp(d)|1⟩; there is no extra i in this exponent. -/
def etaAmplitude (d : ℂ) (b : Bool) : ℂ := if b then Complex.exp d else 1
/-- Sanity: no spurious phase on a basis string with no occupied pair. -/
example (G : PhaseGraph 1) (b : Qubits 1) : graphAngle G.weight b = 0 := by
simp [graphAngle]
/-- Sanity: the zero raw vector is not accidentally turned into a physical state. -/
example {ι : Type*} [Fintype ι] : normalizeRageVector (0 : EuclideanSpace ℂ ι) = 0 := by
simp [normalizeRageVector]
/-- Sanity: the product factors in Eq.(3) have the stated amplitudes. -/
example (d : ℂ) : etaAmplitude d false = 1 ∧ etaAmplitude d true = Complex.exp d := ⟨rfl, rfl⟩
/-- PDF p.2: all admissible numerical input data; constraints do not remove stored entries. -/
structure RageParameters (N D : ℕ) where
tensors : Tensors N D
graph : PhaseGraph N
rotations : Fin N → Matrix.unitaryGroup Bool ℂ
/-- PDF p.2: stored real coordinates: real/imaginary tensor entries, one weight per
unordered pair, and real/imaginary entries of each 2-by-2 unitary. -/
abbrev DescriptionIndex (N D : ℕ) :=
(Fin N × Bool × Fin D × Fin D × Bool) ⊕
({p : Fin N × Fin N // p.1 < p.2} ⊕ (Fin N × Bool × Bool × Bool))
/-- PDF p.2: the explicit coordinate description, with the last Boolean selecting Im. -/
def describe {N D : ℕ} (p : RageParameters N D) : DescriptionIndex N D → ℝ
| .inl (k,b,i,j,part) => if part then (p.tensors k b i j).im else (p.tensors k b i j).re
| .inr (.inl e) => p.graph.weight e.val.1 e.val.2
| .inr (.inr (k,b,c,part)) =>
if part then ((p.rotations k : Matrix Bool Bool ℂ) b c).im
else ((p.rotations k : Matrix Bool Bool ℂ) b c).re
/-- PDF p.2: glue retained and traced-out bit strings, including empty supports. -/
def joinBits {N : ℕ} (S : Finset (Fin N)) (a : S → Bool)
(e : {k : Fin N // k ∉ S} → Bool) : Qubits N :=
fun k => if h : k ∈ S then a ⟨k,h⟩ else e ⟨k,h⟩
/-- PDF p.2: actual partial trace of |v⟩⟨v|, without normalization. -/
def rawMarginal {N : ℕ} (v : EuclideanSpace ℂ (Qubits N)) (S : Finset (Fin N)) :
Matrix (S → Bool) (S → Bool) ℂ :=
Matrix.of fun a b => ∑ e : {k : Fin N // k ∉ S} → Bool,
v (joinBits S a e) * conj (v (joinBits S b e))
/-- PDF pp.2–4: normalized reduced density matrix, used only for nonzero v. -/
def rageMarginal {N : ℕ} (v : EuclideanSpace ℂ (Qubits N)) (S : Finset (Fin N)) :
Matrix (S → Bool) (S → Bool) ℂ :=
(((‖v‖ ^ 2 : ℝ) : ℂ)⁻¹) • rawMarginal v S
/-- PDF pp.1,3–4: Z expectation on a unit vector. -/
def zMean {N : ℕ} (v : EuclideanSpace ℂ (Qubits N)) (i : Fin N) : ℝ :=
∑ b, (if b i then -1 else 1) * Complex.normSq (v b)
/-- PDF pp.1,3–4: connected two-point Z correlation on a unit vector. -/
def connectedZ {N : ℕ} (v : EuclideanSpace ℂ (Qubits N)) (i j : Fin N) : ℝ :=
(∑ b, (if b i then -1 else 1) * (if b j then -1 else 1) * Complex.normSq (v b)) -
zMean v i * zMean v j
/-- PDF p.2: the first L sites (meaningful also for L=0 and L=N). -/
def firstBlock (N L : ℕ) : Finset (Fin N) := Finset.univ.filter fun i => i.val < L
/-- PDF p.2: one cyclic increment. An existing index supplies positivity of N. -/
def nextSite {N : ℕ} (i : Fin N) : Fin N :=
⟨(i.val + 1) % N, Nat.mod_lt _ (Nat.zero_lt_of_lt i.isLt)⟩
/-- PDF p.2: exact cyclic invariance of a vector, without a global-phase quotient. -/
def CyclicInvariant {N : ℕ} (v : EuclideanSpace ℂ (Qubits N)) : Prop :=
∀ b, v (fun k => b (nextSite k)) = v b
/-- PDF pp.2–3: E[k,a,b]=A[k,a] ⊗ conjugate(A[k,b]); conjugation is entrywise. -/
def transferE {N D : ℕ} (A : Tensors N D) (k : Fin N) (a b : Bool) :
Matrix (Fin D × Fin D) (Fin D × Fin D) ℂ :=
Matrix.kronecker (A k a) (Matrix.of fun i j => conj (A k b i j))
/-- PDF pp.2–3: real bit indicator, to keep a-b signed. -/
def bitReal (b : Bool) : ℝ := if b then 1 else 0
/-- PDF pp.2–3: corrected transfer matrices. The outside phase uses the summed physical
index t, not the unbound label in the printed B formula. -/
def transferT {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N) (S : Finset (Fin N))
(a b : S → Bool) (k : Fin N) : Matrix (Fin D × Fin D) (Fin D × Fin D) ℂ :=
if hk : k ∈ S then transferE A k (a ⟨k,hk⟩) (b ⟨k,hk⟩)
else ∑ t : Bool,
Complex.exp (Complex.I * ((bitReal t *
∑ j : S, G.weight j.val k * (bitReal (a j) - bitReal (b j))) : ℂ)) •
transferE A k t t
/-- PDF pp.2–3: the cross-edge reduced kernel, contracted in chain order. -/
def crossMarginal {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N) (S : Finset (Fin N)) :
Matrix (S → Bool) (S → Bool) ℂ :=
Matrix.of fun a b => ((List.ofFn fun k => transferT A G S a b k).prod).trace
/-- PDF p.2: internal graph gates followed by the rotations on retained sites. -/
def retainedOp {N : ℕ} (G : PhaseGraph N) (V : Fin N → Matrix.unitaryGroup Bool ℂ)
(S : Finset (Fin N)) : Matrix (S → Bool) (S → Bool) ℂ :=
productOp (fun k : S => (V k.val : Matrix Bool Bool ℂ)) *
graphOp (fun i j : S => G.weight i.val j.val)
/-- Sanity: no natural-number subtraction enters the phase difference. -/
example : bitReal false - bitReal true = -1 := by norm_num [bitReal]
/-- PDF p.3, Eq.(4): energy of a raw nonzero vector. -/
def rayleighEnergy {N : ℕ} (H : Matrix (Qubits N) (Qubits N) ℂ)
(v : EuclideanSpace ℂ (Qubits N)) : ℝ :=
(inner ℂ v (act H v)).re / ‖v‖ ^ 2
/-- PDF p.3: both physical tensors at one site supply 2D² complex coordinates. -/
abbrev SiteCoordinates (D : ℕ) := Bool × Fin D × Fin D
/-- PDF p.3: replace one site's two tensors, freezing every other entry. -/
def replaceSite {N D : ℕ} (A : Tensors N D) (k : Fin N)
(x : SiteCoordinates D → ℂ) : Tensors N D :=
fun j b => if j = k then Matrix.of fun i l => x (b,i,l) else A j b
/-- PDF p.3: the constructed one-site physical linear map, by its coordinate columns. -/
def siteMap {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N)
(V : Fin N → Matrix.unitaryGroup Bool ℂ) (k : Fin N) :
Matrix (Qubits N) (SiteCoordinates D) ℂ :=
Matrix.of fun b c => rage (replaceSite A k (fun e => if e = c then 1 else 0)) G V b
/-- PDF p.3: x†Mx, with a complex value until its real part is taken. -/
def rageSiteQuadratic {ι : Type*} [Fintype ι] (M : Matrix ι ι ℂ) (x : ι → ℂ) : ℂ :=
∑ i, ∑ j, conj (x i) * M i j * x j
/-- PDF p.3: physical vector from the constructed one-site map. -/
def siteVector {N D : ℕ} (L : Matrix (Qubits N) (SiteCoordinates D) ℂ)
(x : SiteCoordinates D → ℂ) : EuclideanSpace ℂ (Qubits N) :=
WithLp.toLp 2 (L.mulVec x)
/-- PDF pp.3–4: apply a phase gate to a distinct pair, using an arbitrary complex label. -/
def controlledPhaseAction {N : ℕ} (j k : Fin N) (z : ℂ)
(v : EuclideanSpace ℂ (Qubits N)) : EuclideanSpace ℂ (Qubits N) :=
WithLp.toLp 2 fun b => (if b j = true ∧ b k = true then z else 1) * v b
/-- PDF p.3: undo one edge from the graph-enhanced vector before the final V layer. -/
def edgeBackground {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N) (j k : Fin N) :
EuclideanSpace ℂ (Qubits N) :=
controlledPhaseAction j k (Complex.exp (-Complex.I * (G.weight j k : ℂ)))
(act (graphOp G.weight) (traceMPS A))
/-- PDF p.3: the P11 or complementary component of the frozen edge background. -/
def edgePart {N : ℕ} (v : EuclideanSpace ℂ (Qubits N)) (j k : Fin N) (on : Bool) :
EuclideanSpace ℂ (Qubits N) :=
WithLp.toLp 2 fun b => if (b j && b k) = on then v b else 0
/-- PDF p.3: edge-coordinate trial vector, retaining the entire two-site phase gate. -/
def edgeTrial {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N)
(V : Fin N → Matrix.unitaryGroup Bool ℂ) (j k : Fin N) (z : ℂ) :
EuclideanSpace ℂ (Qubits N) :=
act (productOp fun q => (V q : Matrix Bool Bool ℂ))
(controlledPhaseAction j k z (edgeBackground A G j k))
/-- PDF p.3: single-edge energy coefficients, with V undone from H as printed. -/
def edgeCoefficients {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N)
(V : Fin N → Matrix.unitaryGroup Bool ℂ) (j k : Fin N)
(H : Matrix (Qubits N) (Qubits N) ℂ) : ℝ × ℂ :=
let W := productOp fun q => (V q : Matrix Bool Bool ℂ)
let HV := W.conjTranspose * H * W
let u := edgePart (edgeBackground A G j k) j k false
let v := edgePart (edgeBackground A G j k) j k true
((inner ℂ u (act HV u)).re + (inner ℂ v (act HV v)).re,
inner ℂ u (act HV v))
/-- PDF p.3: a minimizing unit-modulus phase for c0+2Re(c1 z). -/
def minimizingPhase (c : ℂ) : ℂ := if c = 0 then 1 else -conj c / (‖c‖ : ℂ)
/-- PDF p.3: the single-edge energy form and its constrained minimum. This is not a
minimization over unconstrained complex z, and gives no joint global phase optimum. -/
def SingleEdgeEnergyLaw {N D : ℕ} (hN : 1 ≤ N) (hD : 1 ≤ D)
(A : Tensors N D) (G : PhaseGraph N) (V : Fin N → Matrix.unitaryGroup Bool ℂ)
(hv : traceMPS A ≠ 0) (j k : Fin N) (hjk : j ≠ k)
(H : Matrix (Qubits N) (Qubits N) ℂ) (hH : H.IsHermitian) : Prop :=
let c := edgeCoefficients A G V j k H
let Z := ‖traceMPS A‖ ^ 2
(∀ z : ℂ, ‖z‖ = 1 → ‖edgeTrial A G V j k z‖ ^ 2 = Z ∧
rayleighEnergy H (edgeTrial A G V j k z) = (c.1 + 2 * (c.2 * z).re) / Z) ∧
‖minimizingPhase c.2‖ = 1 ∧
(∀ z : ℂ, ‖z‖ = 1 → rayleighEnergy H (edgeTrial A G V j k (minimizingPhase c.2)) ≤
rayleighEnergy H (edgeTrial A G V j k z)) ∧
(c.2 = 0 → ∀ z : ℂ, ‖z‖ = 1 → rayleighEnergy H (edgeTrial A G V j k z) = c.1 / Z)
/-- PDF p.4: reduce any real angle to [0,2π), including negative angles. -/
def wrapAngle (theta : ℝ) : ℝ :=
theta - (2 * Real.pi) * (Int.floor (theta / (2 * Real.pi)) : ℝ)
/-- PDF p.4: update both symmetric entries, leaving every other pair fixed. -/
def updatedWeights {N : ℕ} (G : PhaseGraph N) (j k : Fin N) (theta : ℝ) : Fin N → Fin N → ℝ :=
fun a b => if (a = j ∧ b = k) ∨ (a = k ∧ b = j)
then wrapAngle (G.weight j k + theta) else G.weight a b
/-- PDF p.4, Eq.(5): normalized squared overlap with a normalized target. -/
def overlapObjective {N : ℕ} (v chi : EuclideanSpace ℂ (Qubits N)) : ℝ :=
Complex.normSq (inner ℂ v chi) / ‖v‖ ^ 2
/-- PDF p.4: put one single-qubit unitary at the selected wire. -/
def localGate {N : ℕ} (q : Fin N) (U : Matrix.unitaryGroup Bool ℂ) :
Matrix (Qubits N) (Qubits N) ℂ :=
productOp fun k => if k = q then (U : Matrix Bool Bool ℂ) else 1
/-- PDF p.4: squared overlap coefficients for the incident-edge coordinate. -/
def overlapCoefficients {N D : ℕ} (A : Tensors N D) (G : PhaseGraph N) (j k : Fin N)
(chi : EuclideanSpace ℂ (Qubits N)) : ℝ × ℂ :=
let u := edgePart (edgeBackground A G j k) j k false
let v := edgePart (edgeBackground A G j k) j k true
let a := inner ℂ u chi
let b := inner ℂ v chi
(Complex.normSq a + Complex.normSq b, a * conj b)
/-- PDF p.2, (i)–(ii): weights of a circulant opposite-site matching on 2L sites. -/
def oppositeWeights (L : ℕ) : Fin (2 * L) → Fin (2 * L) → ℝ :=
fun i j => if i ≠ j ∧ (i.val + L) % (2 * L) = j.val then Real.pi else 0
/-- PDF p.2, (ii): contiguous blocks on a cyclic chain, including wrapping blocks. -/
def cyclicBlock (N : ℕ) (start : Fin N) (ell : ℕ) : Finset (Fin N) :=
Finset.univ.filter fun i => ∃ t : ℕ, t < ell ∧ i.val = (start.val + t) % N
/-- PDF p.3: derivative of the trace product, obtained by inserting one tensor derivative. -/
def mpsTangent {N D : ℕ} (A Adot : Tensors N D) : EuclideanSpace ℂ (Qubits N) :=
WithLp.toLp 2 fun b => ∑ k : Fin N,
((List.ofFn fun l => if l = k then Adot l (b l) else A l (b l)).prod).trace
/-- PDF p.3: derivative of the tensor product of local matrices. -/
def localTangent {N : ℕ} (V Vdot : Fin N → Matrix Bool Bool ℂ) :
Matrix (Qubits N) (Qubits N) ℂ :=
Matrix.of fun a b => ∑ k : Fin N,
∏ l : Fin N, if l = k then Vdot l (a l) (b l) else V l (a l) (b l)
/-- PDF p.3: explicit differentiated finite tensor/phase product. The ambient formula
extends the unitary charts smoothly; no defective unrestricted real-Pauli chart is used. -/
def rawTangent {N D : ℕ} (A Adot : Tensors N D)
(w wdot : Fin N → Fin N → ℝ) (V Vdot : Fin N → Matrix Bool Bool ℂ) :
EuclideanSpace ℂ (Qubits N) :=
act (localTangent V Vdot) (act (graphOp w) (traceMPS A)) +
act (productOp V) (WithLp.toLp 2 fun b =>
Complex.exp (Complex.I * (graphAngle w b : ℂ)) *
(mpsTangent A Adot b + Complex.I * (graphAngle wdot b : ℂ) * traceMPS A b))
/-- PDF pp.2–3 and p.4 Extensions: ideal scalar instructions, with no matrix-operation
primitive. A productCall is reserved for the explicitly supplied base contraction evaluator. -/
inductive ScalarInstruction (N : ℕ) (Input : Type*) where
| constant (c : ℂ)
| read (i : Input)
| add (a b : ℕ)
| mul (a b : ℕ)
| divide (a b : ℕ)
| conjugate (a : ℕ)
| phase (a : ℕ)
| productCall (factors : Fin N → Bool → Bool → ℕ)
/-- PDF pp.2–3: one instruction's exact semantics. Division has a checked denominator. -/
def ScalarInstruction.eval {N : ℕ} {Input : Type*}
(data : Input → ℂ) (base : (Fin N → Matrix Bool Bool ℂ) → ℂ)
(mem : ℕ → ℂ) : ScalarInstruction N Input → Option ℂ
| .constant c => some c
| .read i => some (data i)
| .add a b => some (mem a + mem b)
| .mul a b => some (mem a * mem b)
| .divide a b => if mem b = 0 then none else some (mem a / mem b)
| .conjugate a => some (conj (mem a))
| .phase a => some (Complex.exp (Complex.I * (mem a).re))
| .productCall factors => some (base (fun k => Matrix.of fun a b => mem (factors k a b)))
/-- PDF pp.2–3: a straight-line scalar program. All registers initially contain zero;
each instruction writes the next register. Work includes reads and output-factor formation. -/
structure ScalarProgram (N : ℕ) (Input : Type*) where
code : List (ScalarInstruction N Input)
/-- PDF pp.2–3: execute the instruction list; undefined division fails explicitly. -/
def ScalarProgram.execute {N : ℕ} {Input : Type*} (p : ScalarProgram N Input)
(data : Input → ℂ) (base : (Fin N → Matrix Bool Bool ℂ) → ℂ) : Option (ℕ → ℂ) :=
((p.code.foldl (fun (st : Option (ℕ × (ℕ → ℂ))) op =>
st.bind fun s => (op.eval data base s.2).map fun v =>
(s.1 + 1, Function.update s.2 s.1 v)) (some (0,fun _ => 0))).map Prod.snd)
/-- PDF p.4: number of calls to the base product-operator evaluator. -/
def ScalarProgram.calls {N : ℕ} {Input : Type*} (p : ScalarProgram N Input) : ℕ :=
p.code.countP fun op => match op with | .productCall _ => true | _ => false
/-- PDF pp.2–4: scalar work, charging an oracle call for formation of all 4N factors,
in addition to a supplied per-call base-evaluation budget B. -/
def ScalarProgram.work {N : ℕ} {Input : Type*} (p : ScalarProgram N Input) (B : ℕ := 0) : ℕ :=
(p.code.map fun op => match op with
| .productCall _ => 4 * N + 1 + B
| _ => 1).sum
/-- Sanity: a real zero denominator is never silently assigned a scalar answer. -/
example {N : ℕ} {Input : Type*} (data : Input → ℂ)
(base : (Fin N → Matrix Bool Bool ℂ) → ℂ) :
(ScalarInstruction.divide 0 0 : ScalarInstruction N Input).eval data base (fun _ => 0) = none := by
simp [ScalarInstruction.eval]
/-- Sanity: the instruction list is charged, including an input read. -/
example {N : ℕ} {Input : Type*} (i : Input) :
(ScalarProgram.mk [.read i] : ScalarProgram N Input).work 0 = 1 := rfl
/-- PDF pp.2–3: typed scalar inputs for local contraction. O may be non-Hermitian. -/
inductive ContractionInput (N D : ℕ) (S : Finset (Fin N)) where
| tensor (k : Fin N) (b : Bool) (i j : Fin D)
| phase (i j : Fin N)
| rotation (k : Fin N) (a b : Bool)
| observable (a b : S → Bool)
/-- PDF pp.2–3: numerical input values; no oracle supplies any desired marginal. -/
def contractionData {N D : ℕ} {S : Finset (Fin N)} (A : Tensors N D) (G : PhaseGraph N)
(V : Fin N → Matrix.unitaryGroup Bool ℂ) (O : Matrix (S → Bool) (S → Bool) ℂ) :
ContractionInput N D S → ℂ
| .tensor k b i j => A k b i j
| .phase i j => (G.weight i j : ℂ)
| .rotation k a b => (V k : Matrix Bool Bool ℂ) a b
| .observable a b => O a b
/-- PDF pp.2–3: program outputs include every partial transfer product, so the theorem
requires the transfer construction itself, not just an unrelated scalar output. -/
structure MarginalProgram (N D : ℕ) (S : Finset (Fin N)) where
scalar : ScalarProgram N (ContractionInput N D S)
stage : (S → Bool) → (S → Bool) → Fin (N + 1) →
(Fin D × Fin D) → (Fin D × Fin D) → ℕ
cross : (S → Bool) → (S → Bool) → ℕ
norm : ℕ
entry : (S → Bool) → (S → Bool) → ℕ
expectation : ℕ
/-- PDF pp.2–3: a program's full transfer-contraction specification. Partial products
are in chain order. Both norm division and the final local conjugation must be executed. -/
def MarginalProgram.Correct {N D : ℕ} {S : Finset (Fin N)} (p : MarginalProgram N D S)
(A : Tensors N D) (G : PhaseGraph N) (V : Fin N → Matrix.unitaryGroup Bool ℂ)
(O : Matrix (S → Bool) (S → Bool) ℂ) : Prop :=
∃ mem : ℕ → ℂ,
p.scalar.execute (contractionData A G V O) (fun _ => 0) = some mem ∧
mem p.norm = (‖traceMPS A‖ ^ 2 : ℝ) ∧
(∀ a b t i j, p.stage a b t i j < p.scalar.code.length ∧
mem (p.stage a b t i j) =
(((List.ofFn fun k => transferT A G S a b k).take t.val).prod) i j) ∧
(∀ a b, p.cross a b < p.scalar.code.length ∧
mem (p.cross a b) = crossMarginal A G S a b) ∧
(∀ a b, p.entry a b < p.scalar.code.length ∧
mem (p.entry a b) = rageMarginal (rage A G V) S a b) ∧
p.norm < p.scalar.code.length ∧ p.expectation < p.scalar.code.length ∧
mem p.expectation = (O * rageMarginal (rage A G V) S).trace
/-- PDF p.4: embed an operator supported on S, with the identity on its complement. -/
def supportedOp {N : ℕ} (S : Finset (Fin N)) (O : Matrix (S → Bool) (S → Bool) ℂ) :
Matrix (Qubits N) (Qubits N) ℂ :=
Matrix.of fun a b => if ∀ k : Fin N, k ∉ S → a k = b k
then O (fun k => a k.val) (fun k => b k.val) else 0
/-- PDF p.4: a unitary Clifford circuit, with no measurements or postselection.
H, S and controlled-X generate the qubit Clifford circuits. -/
inductive QubitCliffordGate (N : ℕ) where
| hadamard (q : Fin N)
| phase (q : Fin N)
| controlledX (control target : Fin N) (distinct : control ≠ target)
/-- PDF p.4: the elementary Hadamard matrix in Boolean basis order 0,1. -/
def hadamardMatrix : Matrix Bool Bool ℂ :=
Matrix.of fun a b => if a = true ∧ b = true
then -(Real.sqrt 2 : ℂ)⁻¹ else (Real.sqrt 2 : ℂ)⁻¹
/-- PDF p.4: exact gate action of the three Clifford generators. -/
def QubitCliffordGate.matrix {N : ℕ} : QubitCliffordGate N → Matrix (Qubits N) (Qubits N) ℂ
| .hadamard q => productOp fun k => if k = q then hadamardMatrix else 1
| .phase q => productOp fun k => if k = q then
Matrix.diagonal (fun b : Bool => if b then Complex.I else 1) else 1
| .controlledX j k _ => Matrix.of fun a b =>
if a = (fun q => if q = k then Bool.xor (b k) (b j) else b q) then 1 else 0
/-- PDF p.4: circuit order is chronological, so the first gate acts first. -/
def cliffordMatrix {N : ℕ} (circuit : List (QubitCliffordGate N)) : Matrix (Qubits N) (Qubits N) ℂ :=
(circuit.map QubitCliffordGate.matrix).reverse.prod
/-- Sanity: the empty Clifford circuit acts as the identity. -/
example (N : ℕ) : cliffordMatrix ([] : List (QubitCliffordGate N)) = 1 := rfl
/-- PDF p.4 Extensions: enhancement inputs, excluding the base state's product evaluator. -/
inductive EnhancementInput (N : ℕ) (S : Finset (Fin N)) where
| phase (i j : Fin N)
| rotation (k : Fin N) (a b : Bool)
| observable (a b : S → Bool)
/-- PDF p.4 Extensions: input data read by the conditional reduction. -/
def enhancementData {N : ℕ} {S : Finset (Fin N)} (G : PhaseGraph N)
(V : Fin N → Matrix.unitaryGroup Bool ℂ) (O : Matrix (S → Bool) (S → Bool) ℂ) :
EnhancementInput N S → ℂ
| .phase i j => (G.weight i j : ℂ)
| .rotation k a b => (V k : Matrix Bool Bool ℂ) a b
| .observable a b => O a b
/-- PDF p.4 Extensions: output register of a product-evaluator reduction. -/
structure EnhancementProgram (N : ℕ) (S : Finset (Fin N)) where
scalar : ScalarProgram N (EnhancementInput N S)
output : ℕ
/-- PDF p.4 Extensions: exact product expectations, for all complex local matrices.
This interface deliberately includes non-Hermitian factors and is uniform in those factors. -/
def ExactProductEvaluator {N : ℕ} (psi : EuclideanSpace ℂ (Qubits N))
(base : (Fin N → Matrix Bool Bool ℂ) → ℂ) : Prop :=
∀ factors, base factors = inner ℂ psi (act (productOp factors) psi)
/-- PDF pp.2–3: a supplied sum of local Hamiltonian terms. Supports may be long-range. -/
def localTermHamiltonian {N m : ℕ} (supports : Fin m → Finset (Fin N))
(terms : (r : Fin m) → Matrix (supports r → Bool) (supports r → Bool) ℂ) :
Matrix (Qubits N) (Qubits N) ℂ :=
∑ r, supportedOp (supports r) (terms r)
/-- PDF p.3: scalar inputs for evaluating one-edge energy coefficients term by term. -/
inductive EdgeInput (N D m : ℕ) (supports : Fin m → Finset (Fin N)) where
| tensor (k : Fin N) (b : Bool) (i j : Fin D)
| phase (i j : Fin N)
| rotation (k : Fin N) (a b : Bool)
| term (r : Fin m) (a b : supports r → Bool)
/-- PDF p.3: edge coefficient input values, with no precomputed coefficient oracle. -/
def edgeData {N D m : ℕ} {supports : Fin m → Finset (Fin N)}
(A : Tensors N D) (G : PhaseGraph N) (V : Fin N → Matrix.unitaryGroup Bool ℂ)
(terms : (r : Fin m) → Matrix (supports r → Bool) (supports r → Bool) ℂ) :
EdgeInput N D m supports → ℂ
| .tensor k b i j => A k b i j
| .phase i j => (G.weight i j : ℂ)
| .rotation k a b => (V k : Matrix Bool Bool ℂ) a b
| .term r a b => terms r a b
/-- PDF p.3: executable output registers for c0,c1,Z and the supplied total energy. -/
structure EdgeProgram (N D m : ℕ) (supports : Fin m → Finset (Fin N)) where
scalar : ScalarProgram N (EdgeInput N D m supports)
constantCoefficient : ℕ
phaseCoefficient : ℕ
norm : ℕ
totalEnergy : ℕ
end QAlgorithms.Papers.Independent.Intakethird100.P57
Read-back
What the Lean code literally says, in plain math · gpt-6.1-sol
QAlgorithms.Papers.Independent.Intakethird100.P57.ContractionInput
For any natural numbers , including zero, and any subset , this defines a type of input labels with four distinct forms: a tensor label , where , is Boolean, and ; a phase label , where ; a rotation label , where and are Boolean; and an observable label , where . Phase labels allow equal indices and both orders of each pair. If , only observable labels exist, and there is exactly one such label because is empty; if , no tensor labels exist.
QAlgorithms.Papers.Independent.Intakethird100.P57.CyclicInvariant
For every natural number and every complex vector indexed by , define cyclic invariance to mean that, for every bit string ,
No normalization is required. For , the shifted string is the unique empty string, so the condition holds for every such vector; for , it also holds for every vector because the shift fixes the sole site.
QAlgorithms.Papers.Independent.Intakethird100.P57.DescriptionIndex
For any natural numbers , this abbreviates a disjoint union of three kinds of indices: tuples , where , are Booleans, and ; pairs of sites satisfying ; and tuples , where and are Booleans. The three kinds remain distinct even if some of their components coincide. When , this index set is empty; when , the first kind is empty.
QAlgorithms.Papers.Independent.Intakethird100.P57.EdgeInput
For every triple of natural numbers and every family of finite supports indexed by , this defines a type of input labels with four distinct kinds: a tensor label with site , Boolean value , and indices ; a phase label with ; a rotation label with and Boolean values ; and a term label with and Boolean assignments . Phase labels include ordered pairs and diagonal pairs without restriction. Zero values of are allowed and remove whichever labels require an index in the corresponding empty range; an empty support still has one Boolean assignment.
QAlgorithms.Papers.Independent.Intakethird100.P57.EdgeProgram
For every triple of natural numbers and family of finite supports for , an edge program consists of a scalar program together with four arbitrary natural-number addresses named the constant coefficient, phase coefficient, norm, and total energy addresses. The scalar program is a finite list with input labels for tensor entries , ordered phase pairs , rotation entries , and term entries , where site indices are below , tensor matrix indices are below , Boolean values are arbitrary, and term assignments are Boolean functions on . Its instructions may introduce complex constants, read inputs, add, multiply, divide, conjugate, form , or call a supplied function on a family of complex matrices assembled from memory. Execution begins with all addresses zero and writes successive results at successive addresses starting at zero; unwritten addresses read as zero, and division by zero fails. The structure alone gives no equations for its four designated addresses, no bounds placing them within the instruction list, and no guarantee of successful execution. Zero size parameters and empty supports are permitted.
QAlgorithms.Papers.Independent.Intakethird100.P57.EnhancementInput
For every natural number , including zero, and every subset , this defines a type of input labels with three distinct forms: a phase label for any ; a rotation label for any and Boolean ; and an observable label for any Boolean assignments on . Phase labels include equal indices and both orders of each pair. If , is empty and the type consists of the single observable label given by the two empty assignments.
QAlgorithms.Papers.Independent.Intakethird100.P57.EnhancementProgram
For every natural number and finite subset , an enhancement program consists of a scalar program and a natural-number output address. Its scalar program is a finite list of instructions whose input labels are either an ordered pair of sites for a phase, a site and two Boolean values for a rotation entry, or two Boolean assignments on for an observable entry. Instructions may introduce an arbitrary complex constant, read an input, add, multiply, divide, conjugate, form , or call a supplied function on a family of complex matrices whose entries are taken from memory. Execution starts with every memory address equal to zero and writes successive results at addresses ; division by zero makes execution fail. Operand addresses are unrestricted, so an address not yet written reads as zero. The structure imposes no condition that the output address lies within the instruction list or that execution succeeds. Both and are permitted.
QAlgorithms.Papers.Independent.Intakethird100.P57.ExactProductEvaluator
For every natural number , every complex vector indexed by Boolean strings of length , and every function from families of complex matrices to , the predicate says that, for every such family , , where matrix action is ordinary matrix–vector multiplication and for Boolean strings . There is no normalization assumption on and no restriction on the matrices . For , the product is empty and equals , so the required value is the squared modulus of the sole coordinate of .
QAlgorithms.Papers.Independent.Intakethird100.P57.MarginalProgram.Correct
For any natural numbers , subset , program record with scalar code and addresses , arbitrary complex matrices , real weights satisfying symmetry, zero diagonal, and , unitary complex matrices , and arbitrary complex matrix indexed by Boolean assignments on , this defines the following predicate. Write , let and , and define
For assignments on , let denote the full assignment equal to on and to on its complement, and set
Define matrices indexed by by
where the bar on a matrix means entrywise conjugation, and put , with the identity. The predicate holds exactly when there exists a memory function obtained by successfully executing all scalar instructions, starting with every address zero and writing the result of instruction number to address , such that, writing for the code length,
and, for every , every , and every ,
while, for every ,
Execution reads tensor entries, complex embeddings of , entries of , and entries of ; constants, addition, multiplication, conjugation, and the operation have their usual meanings; division fails if its denominator is zero; and every external product call returns zero. Operand addresses need not refer to earlier instructions, so an address not yet written still contains zero. No nonzero-vector hypothesis is part of this predicate: the inverse in is defined to be zero when its denominator is zero. Zero dimensions and empty are allowed; empty products are identities, and empty sums are zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.MarginalProgram
For natural numbers , including zero, and a subset , this defines a record containing a scalar program and several natural-number addresses. The scalar program is a finite list of instructions that may supply a complex constant, read a tensor, phase, rotation, or observable input label, add or multiply values at two natural-number addresses, divide values at two addresses, conjugate a value, form from a value , or call an external function on a family of complex matrices whose entries are specified by addresses indexed by . Tensor input labels have indices ; phase labels have two indices in ; rotation labels have one site index and two Boolean indices; observable labels have two Boolean assignments on . The record additionally supplies an address for every two Boolean assignments on , every integer , and every ; addresses and ; and addresses and . The record itself imposes no bounds or semantic requirements on these addresses or on instruction operands.
QAlgorithms.Papers.Independent.Intakethird100.P57.PhaseGraph
For any natural number , this defines a structure consisting of real weights for , together with the requirements that, for every such pair, , , and, for every , . Zero weights are permitted. When , there are no weights and all these requirements are vacuous.
QAlgorithms.Papers.Independent.Intakethird100.P57.QubitCliffordGate.matrix
For every natural number , this maps each gate description—Hadamard at a site, phase at a site, or controlled- on distinct control and target sites—to a complex matrix indexed by Boolean assignments . Writing when and otherwise, a Hadamard description at has entry
a phase description at has entry
in the Boolean ordering false, true; and a controlled- description with control and distinct target has entry exactly when and for every , and entry otherwise. The definition covers , although there are then no gate descriptions to which it can be applied.
QAlgorithms.Papers.Independent.Intakethird100.P57.QubitCliffordGate
For every natural number , this defines a type of gate descriptions with three forms: a Hadamard description carrying a site ; a phase description carrying a site ; and a controlled- description carrying control and target sites in , together with a proof that they are distinct. Thus the controlled- form cannot use the same site twice. For there are no gate descriptions, and for there are no controlled- descriptions.
QAlgorithms.Papers.Independent.Intakethird100.P57.RageParameters
For any natural numbers , this defines a parameter record consisting of three fields: a family of arbitrary complex matrices indexed by and Boolean ; a real weight function on pairs of sites satisfying symmetry , zero diagonal , and ; and a unitary complex matrix , with Boolean row and column indices, for every site . No normalization or nonzero condition is imposed on the matrix family. Zero values of and are permitted: when , all three fields have empty site index sets, and when , the tensor matrices have empty row and column index sets.
QAlgorithms.Papers.Independent.Intakethird100.P57.ScalarInstruction.eval
For every natural number , arbitrary input-label type , input-data function , arbitrary function from families of complex matrices to , and total memory function , this defines instruction evaluation with an optional complex result. A constant returns its specified value; an input read at returns ; addition and multiplication at addresses return and ; division returns no result if , and otherwise returns ; conjugation at returns ; phase formation at returns ; and a product call with address function returns , where . Every form except division by zero returns a value. Addresses are unrestricted natural numbers, and no property of is assumed; when , a product call applies to the empty matrix family.
QAlgorithms.Papers.Independent.Intakethird100.P57.ScalarInstruction
For every natural number and arbitrary type of input labels , this defines a type of instructions with nine forms: a complex constant ; a read of an input label ; addition, multiplication, or division specified by two natural-number memory addresses; conjugation or phase formation specified by one natural-number memory address; and a product call specified by a function assigning a natural-number memory address to each triple , where and are Boolean values. These constructors impose no bounds on memory addresses or requirement that referenced addresses have already been written. The definition allows and allows the input-label type to be empty.
QAlgorithms.Papers.Independent.Intakethird100.P57.ScalarProgram.calls
For every natural number , arbitrary input-label type , and scalar program , this defines the number of entries in its instruction list that are product-call instructions, each carrying an address function on triples consisting of a site and two Boolean values. All other instruction forms contribute zero. This counts occurrences in the list without executing the program, including occurrences after an instruction that would fail; an empty program has count zero, and is allowed.
QAlgorithms.Papers.Independent.Intakethird100.P57.ScalarProgram.execute
For every natural number , arbitrary input-label type , program containing a finite list of scalar instructions, data function , and arbitrary function from families of complex matrices to , this defines execution returning either no result or a total memory function . Execution starts with instruction counter and every memory address equal to zero, and processes the list in order. At each instruction, using the current memory , constants and input reads yield their specified constant and ; addition, multiplication, division, and conjugation yield the corresponding operations on the addressed values; phase formation at address yields ; and a product call with address function yields , where . Division fails precisely when its denominator memory value is zero. A successful instruction stores its result at the current counter address and increments the counter; a failure makes the entire execution return no result. On success, only the final memory function is returned. Memory references need not point to earlier instructions: addresses not yet written read as zero. An empty program succeeds with the all-zero memory, and after a successful program of length , every address at least remains zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.ScalarProgram
For every natural number and arbitrary input-label type , this defines a program as a structure containing a single field: a finite list of scalar instructions. Each instruction is a complex constant, an input read, addition, multiplication, division, conjugation, phase formation, or a call carrying memory addresses for the entries of complex matrices. The structure imposes no validity conditions, memory-address bounds, designated output address, or requirement that operands refer to earlier instructions. An empty instruction list is permitted, including when or is empty.
QAlgorithms.Papers.Independent.Intakethird100.P57.ScalarProgram.work
For every natural number , arbitrary input-label type , scalar program , and natural number , whose default value is , this defines work by summing a cost of for every product-call instruction and a cost of for every other instruction. Equivalently, if the instruction list has length and contains product-call instructions, the result is . The definition counts the entire list without executing it or checking whether execution succeeds. An empty program has work zero; when and , every instruction has cost .
QAlgorithms.Papers.Independent.Intakethird100.P57.SingleEdgeEnergyLaw
For natural numbers supplied with and , choose complex matrices , a graph with real weights , , and , unitary complex matrices , distinct sites , and a Hermitian matrix indexed by -bit strings, and assume the vector , with increasing site order, is nonzero. Put
Let equal on strings for which the two selected bits are not both , and zero elsewhere, and let equal on the complementary strings and zero elsewhere. Define
and write and if , otherwise . The definition is the proposition consisting of the following conjunction:
Here follows from the supplied nonzero assumption. This declaration defines a proposition; it does not itself assert that the proposition holds. Although the dimension hypothesis states only , the required distinct sites cannot be supplied when .
QAlgorithms.Papers.Independent.Intakethird100.P57.SiteCoordinates
For every natural number , the abbreviation denotes the set of triples , where is Boolean and . It has elements and is empty when .
QAlgorithms.Papers.Independent.Intakethird100.P57.Tensors
For any natural numbers , including zero, this abbreviates the type of families , where , , and each is a complex matrix. No conditions are imposed on these matrices. When , the family has no sites; when , each matrix has no entries.
QAlgorithms.Papers.Independent.Intakethird100.P57.bitReal
For every Boolean value , define its real-valued representative by
QAlgorithms.Papers.Independent.Intakethird100.P57.cliffordMatrix
For every natural number and finite list of gate descriptions , this defines the complex matrix on Boolean assignments to to be
Here a Hadamard gate at applies at and identities elsewhere; a phase gate at applies at and identities elsewhere; and a controlled- gate on distinct control and target is the permutation matrix sending an input assignment to the assignment with target bit and all other bits unchanged. Boolean matrix indices are ordered false, true. An empty list gives the identity matrix, including when , when the assignment space has one element and every such list is empty.
QAlgorithms.Papers.Independent.Intakethird100.P57.connectedZ
For every natural number , every complex vector indexed by bit strings , and any sites , define
There is no normalization assumption on , and and may coincide; when , this expression is . For , there are no choices of or .
QAlgorithms.Papers.Independent.Intakethird100.P57.contractionData
For natural numbers , a subset , arbitrary complex matrices for each site and Boolean , a real weight function satisfying , , and , a unitary complex matrix at each site, and an arbitrary complex matrix indexed by Boolean assignments on , this defines a complex-valued function on four kinds of input labels: a tensor label returns ; a phase label returns the real number , regarded as complex; a rotation label returns ; and an observable label returns . No normalization of the tensors or Hermiticity of is required, and may be zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.controlledPhaseAction
For every natural number , any two sites , any complex number , and any complex Euclidean vector indexed by Boolean assignments on the sites, the definition gives a vector with amplitudes
There is no requirement that , that , or that be normalized or nonzero. When , the condition is simply ; when , no sites can be supplied.
QAlgorithms.Papers.Independent.Intakethird100.P57.crossMarginal
For any natural numbers , complex matrices indexed by sites and bits, real weights satisfying symmetry, zero diagonal, and , and a finite subset , define a complex matrix whose rows and columns are bit assignments by
Bits in the exponential mean or , conjugation is entrywise, , and the product is taken in increasing site order. This definition includes , when there is one row and one column. For , the product is the identity on the pair indices, so that sole entry is ; for , every entry is .
QAlgorithms.Papers.Independent.Intakethird100.P57.cyclicBlock
For natural numbers and a starting index , this defines the finite set
Repeated visits contribute only one element. In particular, the set is empty when , and it contains all indices when . Supplying a starting index requires ; there is no starting index when .
QAlgorithms.Papers.Independent.Intakethird100.P57.describe
For any natural numbers and any parameter record , where are complex matrices, is a symmetric real weight function with zero diagonal and , and each is a unitary Boolean-indexed complex matrix, this defines a real-valued function on a disjoint union of tensor-entry indices, strictly ordered site pairs, and rotation-entry indices. At a tensor-entry index , its value is if , and if . At a site-pair index with , its value is . At a rotation-entry index , its value is if , and if . All sites lie below , tensor row and column indices lie below , and the remaining indices are Booleans. Zero dimensions are allowed; the function has an empty domain when , and has no tensor-entry coordinates when .
QAlgorithms.Papers.Independent.Intakethird100.P57.diagonalTensors
For arbitrary natural numbers , coefficients indexed by , and complex numbers indexed by , , and Boolean , this defines a family of matrices whose entries are
No positivity or normalization is required. When , there are no site matrices; when , every site matrix has an empty row and column index set.
QAlgorithms.Papers.Independent.Intakethird100.P57.edgeBackground
For all natural numbers , let be arbitrary complex matrices indexed by sites and Boolean values, and let specify real weights satisfying , , and . Given any sites , the definition gives the complex Euclidean vector , indexed by Boolean assignments on all sites, with amplitudes
where Boolean values are identified with . No local rotation matrices, normalization, or nonzero hypothesis occur. The sites need not be distinct; when , , so the subtracted term is zero. The definition permits , in which case the traces and vector are zero; when , no sites exist.
QAlgorithms.Papers.Independent.Intakethird100.P57.edgeCoefficients
For natural numbers , choose complex matrices for every site and bit , real graph weights with and , unitary complex matrices , sites , and an arbitrary complex matrix indexed by -bit strings. Set
where the matrix product is in increasing site order. Define , , and vectors by when are not both , and otherwise, while when both bits are , and otherwise. The definition returns the real–complex pair
No Hermitian assumption on , distinctness assumption on , or normalization or nonzero assumption on is imposed; is included, whereas supplies no required sites.
QAlgorithms.Papers.Independent.Intakethird100.P57.edgeData
For arbitrary natural numbers , finite supports for , a family of complex matrices for sites and Boolean values , a real weight array satisfying , , and , a family of unitary complex matrices , and arbitrary complex matrices indexed by Boolean assignments on , this defines a complex-valued function on the four kinds of edge-input labels: a tensor label returns ; a phase label returns viewed as a complex number; a rotation label returns ; and a term label returns . No nonzero or normalization condition is imposed on , and no Hermitian condition is imposed on the terms. All three size parameters may be zero, with labels requiring an unavailable index absent.
QAlgorithms.Papers.Independent.Intakethird100.P57.edgePart
For every natural number , any complex Euclidean vector indexed by Boolean assignments on sites, any sites , and any Boolean value , the definition gives the vector with amplitudes
Thus retains precisely assignments with both selected bits equal to , while retains precisely assignments where at least one selected bit is . No normalization or nonzero assumption is imposed, and the retained vector is not rescaled. The sites may coincide, in which case the retained condition is ; for , no sites can be supplied.
QAlgorithms.Papers.Independent.Intakethird100.P57.edgeTrial
For natural numbers , let be a complex matrix for each site and bit ; let have real weights satisfying , , and ; and let be a unitary complex matrix at every site. For sites and any , define
The defined vector, indexed by bit strings , has amplitudes
There is no requirement that , that , or that be normalized or nonzero. The dimension is allowed; admits no choices of the required sites .
QAlgorithms.Papers.Independent.Intakethird100.P57.emptyPhaseGraph
For every natural number , including zero, this defines real weights for all , together with proofs that the weights are symmetric, have zero diagonal, and satisfy . When , the weight function has no arguments and these requirements are vacuous.
QAlgorithms.Papers.Independent.Intakethird100.P57.enhance
For any natural number , real weights on the sites satisfying , , and , any family of unitary complex Boolean-indexed matrices , and any vector in the complex Euclidean space indexed by -bit strings, this defines a vector with coordinates
No normalization or nonzero condition is imposed on . For , the sole coordinate is unchanged.
QAlgorithms.Papers.Independent.Intakethird100.P57.enhancementData
For any natural number , subset , real weight function satisfying , , and , unitary complex matrices for , and arbitrary complex matrix indexed by Boolean assignments on , this defines a complex-valued function on input labels: a phase label returns , regarded as a complex number; a rotation label returns ; and an observable label returns . No Hermiticity or positivity of is assumed. Empty and are allowed; when , the function has only the single observable input label.
QAlgorithms.Papers.Independent.Intakethird100.P57.etaAmplitude
For every complex number and Boolean , this defines the complex number
There is no restriction on .
QAlgorithms.Papers.Independent.Intakethird100.P57.firstBlock
For any natural numbers , define the finite set
Thus it contains the first sites; it is empty if or , and it contains every site if .
QAlgorithms.Papers.Independent.Intakethird100.P57.graphAngle
For any type equipped with a finite enumeration and a linear order, any real function , and any Boolean assignment , this defines the real number
Only strictly ordered pairs contribute; no symmetry, sign, diagonal, or boundedness conditions are imposed on . If there are no contributing pairs, including when is empty, the value is zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.graphOp
For any type equipped with a finite enumeration and a linear order, and any real function , this defines the complex diagonal matrix indexed by Boolean assignments , whose entries are
No symmetry, sign, or boundedness condition is required of . If is empty, this is the one-entry matrix with entry .
QAlgorithms.Papers.Independent.Intakethird100.P57.hadamardMatrix
This defines a complex matrix with rows and columns indexed by Booleans whose -entry is if both and are true, and otherwise. In the ordering false, true, it is
QAlgorithms.Papers.Independent.Intakethird100.P57.joinBits
For every natural number , every finite set , every Boolean assignment on , and every Boolean assignment on its complement, this defines the full -bit string by
The empty set and the full site set are allowed: in those cases the result uses only or only , respectively. When , the result is the unique empty bit string.
QAlgorithms.Papers.Independent.Intakethird100.P57.localGate
For a natural number , a site , and a unitary complex matrix , this defines the matrix indexed by -bit strings with entries
Thus it is the product of the matrix at site and identity matrices at every other site. The required site cannot be supplied when .
QAlgorithms.Papers.Independent.Intakethird100.P57.localTangent
For every natural number and arbitrary families of complex matrices indexed by sites , this defines a matrix indexed by bit strings , with entries
Neither unitarity nor a derivative relation between the two families is assumed. When , the sum is empty, so this is the zero matrix on the singleton set of empty bit strings.
QAlgorithms.Papers.Independent.Intakethird100.P57.localTermHamiltonian
For arbitrary natural numbers , a family of finite site sets indexed by , and arbitrary complex matrices indexed by pairs of Boolean assignments on , this definition gives the complex matrix indexed by Boolean strings of length whose entries are , where if and agree at every site outside , and otherwise. There are no Hermitian, positivity, normalization, or support-size assumptions. When , the sum is the zero matrix; when , its matrix has one entry and its extension is that entry times the identity. The definition also permits .
QAlgorithms.Papers.Independent.Intakethird100.P57.minimizingPhase
For every complex number , this defines the complex number
where the real modulus in the denominator is regarded as a complex number. The zero case is explicitly assigned the value .
QAlgorithms.Papers.Independent.Intakethird100.P57.mpsTangent
For arbitrary natural numbers and two families assigning a complex matrix to each site and Boolean value, this defines a vector indexed by bit strings , with amplitudes
where matrix factors occur in increasing site order. No relation between and , such as being values and derivatives of a path, is required. For the sum is empty and the vector is zero; for every trace is zero, so the vector is also zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.nextSite
For every natural number and every site , define to be the site whose index is
The existence of ensures , so the remainder is a valid site. This sends to ; for , it fixes the sole site, and for , there are no inputs.
QAlgorithms.Papers.Independent.Intakethird100.P57.normalizeRageVector
For any type equipped with a finite enumeration and any vector with its Euclidean norm, this defines
There is no assumption that . For nonzero , the expression divides by its norm; for , it is zero because the inverse of zero is defined to be zero. In particular, an empty index type yields the zero vector.
QAlgorithms.Papers.Independent.Intakethird100.P57.oppositeWeights
For every natural number , this defines a real-valued function on ordered pairs by
In particular, diagonal entries receive . The case is included as a function on an empty set of pairs, so there are no entries at which the remainder expression is evaluated.
QAlgorithms.Papers.Independent.Intakethird100.P57.overlapCoefficients
For natural numbers , choose complex matrices , a graph with real weights , , and , sites , and an arbitrary complex vector indexed by -bit strings. Set
using increasing site order in the matrix product. Let when are not both , and otherwise, and let when both bits are , and otherwise. Writing and , the definition returns
There is no distinctness requirement on , no normalization or nonzero requirement on either vector, and no positivity requirement on ; admits no choices of the required sites.
QAlgorithms.Papers.Independent.Intakethird100.P57.overlapObjective
For every natural number and arbitrary complex vectors indexed by bit strings in , this defines the real number
Neither vector is assumed normalized or nonzero. In particular, the value is when , because division by zero in the real numbers is assigned the value . The case is included, with a single empty bit string indexing the vectors.
QAlgorithms.Papers.Independent.Intakethird100.P57.plusFactors
For every natural number , this defines the complex-valued function on a site and a Boolean value by
The value is independent of both arguments. When , the function has no site arguments.
QAlgorithms.Papers.Independent.Intakethird100.P57.productOp
For any type equipped with a finite enumeration, and any family of complex matrices whose rows and columns are indexed by Boolean values, this defines a complex matrix indexed by Boolean assignments , with entries
No unitarity or other condition is imposed on . If is empty, there is one Boolean assignment and the sole matrix entry is the empty product .
QAlgorithms.Papers.Independent.Intakethird100.P57.productTensors
For every natural number and every function , this defines a family of complex matrices , one for each site and Boolean , by
There is no normalization condition on . When , the family has no sites.
QAlgorithms.Papers.Independent.Intakethird100.P57.productVec
For any natural number and any complex values , indexed by and Boolean , this defines a vector in the complex Euclidean space indexed by -bit strings, with coordinates
No normalization or nonzero condition is imposed on the factors. When , there is one bit string and its coordinate is the empty product .
QAlgorithms.Papers.Independent.Intakethird100.P57.rage
For any natural numbers , any family of complex matrices indexed by and Boolean , any real weights satisfying symmetry, zero diagonal, and , and any family of unitary complex Boolean-indexed matrices , this defines a vector indexed by -bit strings with coordinates
The matrix product inside the trace follows increasing site order. No normalization or nonzero condition is imposed. For , the sole coordinate is ; for , the vector is zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.rageMarginal
For every natural number , every complex vector indexed by -bit strings, and every finite site set , this defines a matrix indexed by Boolean assignments on , with entries
where equals on and outside , and the real number is regarded as complex before taking its inverse. There is no assumption that is nonzero or normalized; the inverse of zero is defined to be zero, so produces the zero matrix. Empty and full site sets, including , are allowed, with a sum over an empty assignment domain containing its single empty assignment.
QAlgorithms.Papers.Independent.Intakethird100.P57.rageSiteQuadratic
For any type equipped with a finite enumeration of all its elements, any complex matrix with rows and columns indexed by , and any function , the definition gives the complex number
There is no Hermitian or positivity assumption on , and no normalization requirement on . If is empty, the value is .
QAlgorithms.Papers.Independent.Intakethird100.P57.rawMarginal
For every natural number , every complex vector indexed by -bit strings, and every finite site set , this defines a complex matrix indexed by Boolean assignments on , with entries
where is the full bit string equal to on and to outside . No normalization or nonzero condition is required on . If is empty, this is a matrix with entry ; if contains all sites, the complement has one empty assignment and the entries are . These conventions also apply when .
QAlgorithms.Papers.Independent.Intakethird100.P57.rawTangent
For arbitrary natural numbers , complex matrix families indexed by a site and a Boolean value, real arrays indexed by two sites, and arbitrary complex matrix families , define
with matrix products in increasing site order, and define
The definition returns the vector whose amplitude at (a\in{0,1}^N$ is
No symmetry or bounds on , unitarity of , or derivative relationships between any of the paired inputs are required. The resulting vector is zero if or .
QAlgorithms.Papers.Independent.Intakethird100.P57.rayleighEnergy
For every natural number , every complex matrix indexed by Boolean assignments on sites, and every complex Euclidean vector with the same index set, the definition assigns the real number
No Hermitian assumption on or normalization or nonzero assumption on is imposed. Division is total, so . The definition also includes , when the index set consists of the unique empty Boolean assignment.
QAlgorithms.Papers.Independent.Intakethird100.P57.replaceSite
For all natural numbers , let be arbitrary complex matrices indexed by a site and a Boolean value . Given a site and any complex-valued function on triples with Boolean and , the definition gives a new family with entries
There are no normalization or nonzero requirements. When , the matrices and the coordinate domain are empty; when , no site can be supplied.
QAlgorithms.Papers.Independent.Intakethird100.P57.retainedOp
For every natural number , let specify real weights on the sites , with , , and ; let be a unitary complex matrix for each site; and let be any finite subset of the sites. Identifying Boolean values with , the definition gives a complex matrix , indexed by assignments , whose entries are
Thus the diagonal phase matrix on the retained sites acts first, followed by the product of their individual unitary matrices. The definition includes and ; for empty , there is one assignment and is the matrix with entry .
QAlgorithms.Papers.Independent.Intakethird100.P57.siteMap
For all natural numbers , let be arbitrary complex matrices for sites and Boolean values ; let be real weights satisfying , , and ; let each be a unitary complex matrix; and choose a site . For each coordinate , where is Boolean and , define matrices by retaining when and setting
The definition gives the matrix , with rows indexed by Boolean assignments on all sites and columns indexed by these coordinates , whose entries are
No nonzero or normalization assumption is required. For , this matrix has no columns; for , no site exists.
QAlgorithms.Papers.Independent.Intakethird100.P57.siteVector
For all natural numbers , let be the set of triples with Boolean and . Given any complex matrix whose rows are indexed by Boolean assignments on sites and whose columns are indexed by , and any function , the definition gives the complex Euclidean vector with amplitudes
There are no normalization or nonzero requirements. For , the sum is empty and the vector is zero; for , there is a single row indexed by the empty assignment.
QAlgorithms.Papers.Independent.Intakethird100.P57.supportedOp
For any natural number , subset , and arbitrary complex matrix indexed by Boolean assignments on , this defines a complex matrix indexed by full Boolean assignments , with entries
No Hermiticity or positivity of is assumed. Empty is allowed: then has one entry and is that scalar times the identity. If , the agreement condition outside is vacuous. For , the resulting matrix has one row and one column.
QAlgorithms.Papers.Independent.Intakethird100.P57.traceMPS
For any natural numbers and any family of complex matrices , indexed by sites and Boolean values , this defines a vector in the complex Euclidean space indexed by Boolean strings , with coordinates
The factors occur in increasing site order. No normalization is required. For , the product is the identity, so the sole coordinate is , regarded as a complex number; for , every coordinate is zero.
QAlgorithms.Papers.Independent.Intakethird100.P57.transferE
For any natural numbers , any collection of complex matrices indexed by sites and bits , any site , and any bits , define
where and the bar denotes entrywise complex conjugation. This is a matrix indexed by pairs of bond indices. If , it is the empty matrix; if , no site can be supplied.
QAlgorithms.Papers.Independent.Intakethird100.P57.transferT
For any natural numbers , complex matrices indexed by sites and bits , real weights satisfying , , and , a finite set of sites , bit assignments , and a site , define the matrix
Here bits in the exponential are interpreted as real numbers or , conjugation is entrywise, and the tensor product has entries . If is empty, every site uses the second branch with exponential factor . If , the resulting matrix is empty; if , no site can be supplied.
QAlgorithms.Papers.Independent.Intakethird100.P57.updatedWeights
For a natural number , a graph with real weights , , and , sites , and any real , this defines a real-valued function on ordered pairs of sites by
The sites are not required to be distinct: if , the selected entry is the diagonal entry . The output is a weight function, without an accompanying assertion that it satisfies the graph conditions. For , the required sites cannot be supplied.
QAlgorithms.Papers.Independent.Intakethird100.P57.wrapAngle
For every real number , this defines
where the floor is an integer regarded as a real number in the product. The definition applies to all real inputs, including negative values and exact integer multiples of .
QAlgorithms.Papers.Independent.Intakethird100.P57.zMean
For every natural number , every complex vector indexed by -bit strings, and every site , this defines the real number
Here is the complex squared modulus. No normalization or nonzero condition is imposed on , and there is no division by its squared norm; the zero vector gives zero. Although ranges over all natural numbers, no site exists when .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.