A Rust/PyO3 (maturin) Quantum Simulation Backend for Tequila: Complex Grassmannians \(\mathrm{Gr}_{\mathbb{C}}(k, n)\), Layer-Coded Plabic Vector-Relation Configurations (VRC), Madelung/DDF Hydrodynamics, and Quantum Causal Inference (QCI) in Lean 4, Rust, and Python¶
Authors: Wes Turner
Subjects:
Quantum Physics (
quant-ph); Chemical Physics (physics.chem-ph); Mathematical Physics (math-ph); Programming Languages & Compilers (cs.PL); Logic in Computer Science (cs.LO)
Primary Implementation & Formal Verification Artifacts:
Rust + PyO3 (
maturin) Extension Crate:…/src/signals/numerical_adapter/src/tequila_simulator.rs (
RustFastCircuit,RustFastHamiltonianSet,CompiledPauliString,FastCompiledHamiltonian,simulate_circuit_msb,expectation_pauli_hamiltonian_msb,simulate_grassmann_plucker_hcb_sector,simulate_noisy_density_msb,mcweeny_purify_density_matrix,analyze_grassmann_qci_state,sample_statevector_msb)…/src/signals/numerical_adapter/src/lib.rs (
#[pymodule] fn signals_numerical_adapter)…/src/signals/numerical_adapter/Cargo.toml & …/src/signals/numerical_adapter/pyproject.toml (
pyo3 = "0.24.1",rayon = "1.11.0",maturinbuild backend)
TequilaPython Backend & Workspace Integration:…/src/tequila/src/tequila/simulators/simulator_signals.py (
BackendCircuitSignals,BackendExpectationValueSignals,BackendBraKetSignals,benchmark_dense_expectation_scaling,benchmark_dense_memory_wall_limit,benchmark_plucker_hcb_chemistry_scaling,benchmark_vqe_optimization_and_wavefunction,benchmark_grassmann_plucker_permanent_vs_determinant,run_all_benchmarks,format_benchmark_markdown_tables,build_arg_parser,main)…/src/tequila/src/tequila/simulators/benchmark_signals.py & …/src/tequila/src/tequila/main.py (
python -m tequila.simulators.benchmark_signals,python -m tequila.simulators.simulator_signals, andpython -m tequilaCLI entry points)…/src/tequila/src/tequila/simulators/simulator_api.py (registration of
"signals"and"grassmann"inSUPPORTED_BACKENDS,INSTALLED_SIMULATORS,INSTALLED_SAMPLERS,INSTALLED_NOISE_SAMPLERS, andSUPPORTED_DENSITY_BACKENDS)…/sustainablefactory/tequila_signals_backend.py, …/tests/test_tequila_signals_backend.py, & …/src/tequila/tests/test_simulator_signals.py
SignalsLean 4 Formal Verification Library (leanprover/lean4:v4.35.0-rc3):…/src/signals/Signals/DFT.lean (Section 22 & Section 22.1:
tequilaFullHilbertDim,tequilaGrassmannPluckerSectorDim,tequilaHilbertToPluckerCompressionRatio,tequilaShiftRuleTwoTermGradient,tequilaVqeBellModelEnergy,tequilaDenseStatevectorBytes,tequilaSparsePluckerHcbSupportDim,tequilaSparsePluckerHcbBytes,tequilaHermitianButterflyPairOps,tequilaNaivePauliStringOps,tequila_rust_pyo3_grassmannian_vrc_qci_simulator_identities,tequila_high_n_butterfly_plucker_128bit_and_memory_ceiling_identities)…/src/signals/Signals/Pending.lean, …/src/signals/SignalsPending.lean, …/src/signals/SignalsTests.lean, & …/src/signals/SignalsPendingTests.lean
Companion Papers:
Abstract¶
In variational quantum eigensolvers (VQE), Hard-Core Boson (HCB) Separable Pair Ansätze (SPA-UpCCD), and MADNESS multiwavelet Pair Natural Orbital (MRA-PNO) workflows in Tequila ([Kottmann et al., 2021]; [Kottmann et al., 2021]), simulation performance and physical expressiveness are governed by the underlying BackendCircuit and BackendExpectationValue engine (…/src/tequila/src/tequila/simulators/simulator_base.py). Existing Tequila backends either:
Allocate unconstrained \(2^{n_{\mathrm{orb}}}\) dense statevectors in C++/Python (
qulacs,qiskit,cirq) without exploiting the Complex Grassmannian \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) Plücker subspace geometry of particle-number-conserving electronic andHCBcircuits;Lack native support for Homogeneous Complex Plabic Vector-Relation Configurations (
VRC) \((V, K)\) with \(V K^\top = 0\), Madelung / Dilatant Dark Fluid (DDF) / Turner Plücker \(\mathcal{Q}_4\) quantum-pressure diagnostics, and McWeeny cubic idempotency purification (\(\rho \leftarrow 3\rho^2 - 2\rho^3\)) under hardware noise; orLack native Quantum Causal Inference (
QCI) primitives—including Pearl \(\operatorname{do}(q = b)\) causal interventions, Quantum Jeffrey Plücker probability kinematics (quantumJeffreyPluckerKinematicUpdate), and Diaconis–Zabell log-odds updates (diaconisZabellLogOddsUpdate)—for mid-circuit soft syndrome evidence and deconfounded expectation evaluation.
In this paper, we design, implement, and formally verify a native Rust + PyO3 (maturin) and Python Quantum Simulation Backend for Tequila (backend="signals" and backend="grassmann"), uniting the mechanics and causal inference frameworks across our 43 companion papers:
Native Rust + PyO3 (
maturin) Statevector,ExpPauli, &Rayon-Parallelized Hamiltonian Engine (tequila_simulator.rs,simulator_signals.py): Compiled as a nativecdylibPython extension (signals_numerical_adapter) viaPyO3 0.24andmaturin,BackendCircuitSignals,BackendExpectationValueSignals, andBackendBraKetSignalsexecute arbitrary single- and multi-controlled gates (X,Y,Z,H,S,T,SWAP,Rx,Ry,Rz,Phase,Exp-Pauli\(e^{-i\frac{\theta}{2}P}\), andQubitExcitation), evaluate multi-term Pauli Hamiltonians \(\langle \Psi_{\mathrm{bra}} \mid H \mid \Psi_{\mathrm{ket}} \rangle\) in parallel across CPU cores viaRayon, and achieve exact machine-precision agreement (\(|\Delta E| < 10^{-14}\), \(|\langle \Psi_{\mathrm{signals}} \mid \Psi_{\mathrm{symbolic}}\rangle|^2 = 1.0\)) with Tequila’s reference symbolic simulator.Particle-Number-Conserving Complex Grassmannian \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) Plücker Sector Simulation (
simulate_grassmann_plucker_hcb_sector): For \(n_{\mathrm{occ}}\)-pairHCB-SPAandPlabic-VRCquantum chemistry circuits on \(n_{\mathrm{orb}}\) orbitals, evolving the \(n_{\mathrm{occ}} \times n_{\mathrm{orb}}\) generator matrix \(C \in \mathbb{C}^{n_{\mathrm{occ}} \times n_{\mathrm{orb}}}\) and projecting onto the \(\binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}\) Cauchy–Binet Plücker coordinates \(\Delta_I^{\mathbb{C}}(C) = \det C[:, I]\) compresses the state space by \(2^{n_{\mathrm{orb}}} / \binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}} = \mathbf{8/3\times}\) on \(\mathrm{Gr}_{\mathbb{C}}(2,4)\), \(> 4.26\times\) on \(\mathrm{Gr}_{\mathbb{C}}(2,6)\) (LiH/BeH2), \(> 22.75\times\) on \(\mathrm{Gr}_{\mathbb{C}}(2,10)\), and \(> 62.06\times\) for 12-orbital \(\mathrm{H}_2\mathrm{O}\) (tequilaHilbertToPluckerCompressionRatio).Madelung / DDF / Turner Plücker \(\mathcal{Q}_4\) Diagnostics, Noisy Kraus Density-Matrix Evolution, & McWeeny Cubic Purification (
simulate_noisy_density_msb): Supports Tequila’sNoiseModel(bit flip,phase flip,phase damp,amplitude damp,depolarizing) in Rust and applies optional McWeeny cubic purification \(\rho \leftarrow \frac{3\rho^2 - 2\rho^3}{\operatorname{Tr}(3\rho^2 - 2\rho^3)}\) (mcweenyPurificationPoly), contracting a \(5\%\) depolarizing eigenvalue error (\(\lambda = 19/20 = 0.95\)) down to \(1 - 3971/4000 = 29/4000 = 0.00725 < 1\%\) in a single pass.Quantum Causal Inference (
QCI), Pearl \(\operatorname{do}\)-Interventions, & Quantum Jeffrey Plücker Kinematics (analyze_grassmann_qci_state): Integrates nativeTequilaGateOp::CausalDointerventions, QCI spin-channel mutual information \(I_{\mathrm{QCI}}(\alpha:\beta)\), andquantumJeffreyPluckerKinematicUpdateunder soft mid-circuit syndrome evidence \(q_E \in [0, 1]\) without projective collapse.
1. Architecture of the Rust/PyO3 (maturin) & Python Tequila Simulation Backend¶
flowchart TB
subgraph TequilaPy["Tequila Python Frontend (src/tequila/ & sustainablefactory/)"]
T1["tq.simulate(U | E | BraKet, backend='signals' | 'grassmann')\ntq.minimize(E, backend='signals') • tq.grad(E, var)"]
T2["BackendCircuitSignals • BackendExpectationValueSignals • BackendBraKetSignals\n(src/tequila/src/tequila/simulators/simulator_signals.py)"]
T1 --> T2
end
subgraph PyO3Bridge["PyO3 0.24 + maturin Zero-Copy ABI Bridge (src/signals/numerical_adapter/)"]
B1["#[pymodule] fn signals_numerical_adapter\n• py_simulate_circuit_msb\n• py_expectation_pauli_hamiltonian_msb\n• py_simulate_grassmann_plucker_hcb\n• py_simulate_noisy_density_msb\n• py_mcweeny_purify_density_matrix\n• py_analyze_grassmann_qci_state\n• py_sample_statevector_msb"]
end
subgraph RustCore["Rust Native Physics, Grassmannian, & QCI Core (tequila_simulator.rs)"]
R1["1. Statevector & ExpPauli Engine:\n • Exact MSB unitary & multi-controlled gates\n • Exp(-i θ/2 P) involution P² = I\n • Rayon-parallelized <bra|H|ket> Pauli contraction"]
R2["2. Grassmannian Gr_C(k,n) & Plabic VRC Engine:\n • Evolves C ∈ C^(k × n) in O(k n) per pair rotation\n • Extracts C(n,k) Cauchy–Binet Plücker minors Δ_I(C)\n • Pole-free Complex VRC (V K^T = 0) at x_X = -1"]
R3["3. Madelung/DDF, QCI, Jeffrey & McWeeny Engine:\n • Fubini–Study Kähler det(I_2 + W W†) ≥ 1\n • Quantum Jeffrey Plücker update Q_QJE(q_1, q_2, γ_coh)\n • Pearl do(q = b) intervention & Kraus + McWeeny 3ρ² - 2ρ³"]
end
T2 --> B1
B1 --> R1
B1 --> R2
B1 --> R3
1.1 Compiler Flags and Direct Gate Execution (BackendCircuitSignals)¶
In Tequila’s base compiler (…/src/tequila/src/tequila/simulators/simulator_base.py), backends that lack native multi-qubit Pauli exponentials or controlled gates must set compiler_arguments flags to True, forcing CircuitCompiler to decompose every Exp-Pauli, SWAP, Toffoli, and controlled rotation into deep cascades of single-qubit rotations and CNOT ladders before simulation.
Because our Rust engine (…/src/signals/numerical_adapter/src/tequila_simulator.rs) natively executes arbitrary multi-controlled unitaries and multi-qubit Pauli exponentials \(\exp(-i\frac{\theta}{2}P)\), BackendCircuitSignals (…/src/tequila/src/tequila/simulators/simulator_signals.py) disables unnecessary circuit expansions:
Tequila Compiler Flag |
Default |
|
Computational Advantage in |
|---|---|---|---|
|
|
|
Evaluates \(\bigl(\cos(\theta/2)I - i\sin(\theta/2)P\bigr)|\Psi\rangle\) in \(O(2^n)\) via the involution \(P^2 = I\) ( |
|
|
|
Applies control-bit mask |
|
|
|
Applies \(R_x, R_y, R_z\) with arbitrary control lists in a single pass ( |
|
|
|
Executes \(k\)-controlled \(X, Y, Z, H\) gates in 1 pass instead of \(6\text{–}16\) CNOTs + \(T/\text{T}^\dagger\) gates |
|
|
|
In-place bit-pair amplitude swap ( |
|
|
|
Direct diagonal phase multiplication \(\operatorname{diag}(1, e^{i\phi})\) |
2. Mechanics & Inference Integrated into the Simulator Backend¶
2.1 Involutive Multi-Qubit Exponential Pauli Evolution (apply_exp_pauli_msb)¶
In Tequila, fermionic UCC excitations (make_upccgsd_ansatz) and Hard-Core Boson pair excitations (make_hardcore_boson_pno_upccd_ansatz in …/src/tequila/src/tequila/quantumchemistry/madness_interface.py) compile to products of exponential Pauli gates:
where \(\sigma_q^{(P)} \in \{X, Y, Z\}\) satisfies \(P^\dagger = P\) and \(P^2 = I\). For any MSB computational basis state \(|x\rangle \in \{0, 1\}^n\), apply_pauli_string_to_basis_msb (…/src/signals/numerical_adapter/src/tequila_simulator.rs) computes the unique partner index \(x' = x \oplus \mathrm{mask}_{XY}(P)\) and phase \(\omega_P(x) \in \{\pm 1, \pm i\}\) such that \(P|x\rangle = \omega_P(x)|x'\rangle\). Because \(P^2 |x\rangle = |x\rangle\), we have \(P|x'\rangle = \overline{\omega_P(x)}|x\rangle\), yielding the exact branchless update in apply_exp_pauli_msb:
2.2 Particle-Number-Conserving Complex Grassmannian \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) Plücker Subspace Evolution (simulate_grassmann_plucker_hcb_sector)¶
For an \(n_{\mathrm{occ}}\)-electron (or \(n_{\mathrm{occ}}\)-pair HCB) state in \(n_{\mathrm{orb}}\) spatial/spin orbitals, particle-number conservation restricts the wavefunction to the \(\binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}\)-dimensional exterior power \(\Lambda^{n_{\mathrm{occ}}}(\mathbb{C}^{n_{\mathrm{orb}}})\). Under the Plücker embedding \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}}) \hookrightarrow \mathbb{P}\bigl(\Lambda^{n_{\mathrm{occ}}}(\mathbb{C}^{n_{\mathrm{orb}}})\bigr) \cong \mathbb{P}^{\binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}-1}(\mathbb{C})\), an orbital/pair rotation circuit acting on the reference Slater/HCB state \(|1\dots 1 0\dots 0\rangle\) evolves the \(n_{\mathrm{occ}} \times n_{\mathrm{orb}}\) generator matrix \(C \in \mathbb{C}^{n_{\mathrm{occ}} \times n_{\mathrm{orb}}}\) in \(O(n_{\mathrm{occ}})\) operations per gate (simulate_grassmann_plucker_hcb_sector in …/src/signals/numerical_adapter/src/tequila_simulator.rs):
The amplitude of each Hamming-weight-\(n_{\mathrm{occ}}\) basis state \(|I\rangle\) (\(I = \{j_1 < \dots < j_{n_{\mathrm{occ}}}\} \subset \{0, \dots, n_{\mathrm{orb}}-1\}\)) in Tequila’s QubitWaveFunction is governed by simulate_grassmann_plucker_sector_with_statistics(n_occ, n_orb, rotations, fermionic_jw_sign) (…/src/signals/numerical_adapter/src/tequila_simulator.rs):
Fermionic Jordan–Wigner (
JW) Slater Determinants (fermionic_jw_sign = true): Evaluates the \(n_{\mathrm{occ}} \times n_{\mathrm{occ}}\) Cauchy–Binet Plücker minor \(\Psi_{\mathrm{JW}}[I] = \Delta_I^{\mathbb{C}}(C) = \det C[:, I]\), which automatically includes the antisymmetric Koszul sign \((-1)^{\mathrm{inv}}\) when an orbital hop crosses an occupied spin-orbital;Bosonic Hard-Core Boson (
HCB) Pair States (fermionic_jw_sign = false): Evaluates Ryser’s \(n_{\mathrm{occ}} \times n_{\mathrm{occ}}\) matrix permanent \(\Psi_{\mathrm{HCB}}[I] = \operatorname{perm} C[:, I]\), matching sign-freeHCB-SPApair excitations without Jordan–Wigner \(Z\)-strings:
In Signals.DFT Section 22 (…/src/signals/Signals/DFT.lean, tequila_rust_pyo3_grassmannian_vrc_qci_simulator_identities), we machine-check the state-space compression ratio (tequilaHilbertToPluckerCompressionRatio):
Active Space \((n_{\mathrm{occ}}, n_{\mathrm{orb}})\) |
Lower Grassmannian Manifold |
Full Qubit Hilbert Dim \(2^{n_{\mathrm{orb}}}\) |
Plücker Sector Dim \(\binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}\) |
Generator Matrix Entries \(n_{\mathrm{occ}} \times n_{\mathrm{orb}}\) |
State-Vector Compression Ratio \(2^{n_{\mathrm{orb}}} / \binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}\) |
|---|---|---|---|---|---|
\((2, 4)\) |
\(\mathrm{Gr}_{\mathbb{C}}(2,4) \cong \mathcal{Q}_4\) ( |
\(16\) |
\(6\) |
\(8\) |
\(8 / 3 \approx 2.67\times\) |
\((2, 6)\) |
\(\mathrm{Gr}_{\mathbb{C}}(2,6)\) ( |
\(64\) |
\(15\) |
\(12\) |
\(64 / 15 \approx 4.27\times > 4\times\) |
\((3, 6)\) |
\(\mathrm{Gr}_{\mathbb{C}}(3,6)\) (6-electron \(\pi\)-system) |
\(64\) |
\(20\) |
\(18\) |
\(16 / 5 = 3.20\times\) |
\((2, 10)\) |
\(\mathrm{Gr}_{\mathbb{C}}(2,10)\) ( |
\(1{,}024\) |
\(45\) |
\(20\) |
\(1024 / 45 \approx 22.76\times > 22\times\) |
\((2, 12)\) |
\(\mathrm{Gr}_{\mathbb{C}}(2,12)\) (\(\mathrm{H}_2\mathrm{O}\) 12-orbital MRA-PNO pair sector) |
\(4{,}096\) |
\(66\) |
\(24\) |
\(2048 / 33 \approx 62.06\times > 62\times\) |
2.3 Two-Term Parameter-Shift Gradients & Exact VQE Variational Cauchy–Schwarz Bound (tequilaVqeBellModelEnergy)¶
When tq.grad(E, var) or tq.minimize(E, backend="signals") is invoked, Tequila differentiates each gate of eigenvalue magnitude \(r = 1/2\) using the two-term parameter-shift rule with shift \(s = \frac{\pi}{4r} = \frac{\pi}{2}\) (tequilaShiftRuleTwoTermGradient in …/src/signals/Signals/DFT.lean):
For the canonical two-qubit VQE Bell-rotation benchmark \(U(a) = \mathrm{CNOT}_{0\to 1} R_y(a)_0\) and \(H = -Z_0 - \frac{1}{2}X_0 X_1\), the expectation value is \(E_{\mathrm{VQE}}(\cos a, \sin a) = -\cos a - \frac{1}{2}\sin a\) (tequilaVqeBellModelEnergy). In tequila_rust_pyo3_grassmannian_vrc_qci_simulator_identities, we prove the exact Lagrange/Cauchy–Schwarz identity for all \(\cos^2 a + \sin^2 a = 1\):
certifying the global VQE minimum \(E_{\mathrm{VQE}}(a^*) = -\frac{\sqrt{5}}{2} \approx -1.118033988749895\) at \(\tan a^* = 1/2\) (\(a^* \approx 0.46364761\text{ rad}\)), which tq.minimize(E, backend="signals") reproduces to \(< 10^{-6}\text{ Ha}\).
2.4 Quantum Causal Inference (QCI), Pearl \(\operatorname{do}\)-Interventions, Quantum Jeffrey Plücker Kinematics, & McWeeny Density Purification¶
Our Rust backend extends Tequila beyond standard unitary simulation with three inference and error-mitigation capabilities (…/src/signals/numerical_adapter/src/tequila_simulator.rs):
Pearl Causal \(\operatorname{do}(q = b)\) Intervention (
TequilaGateOp::CausalDo): Severs incoming entanglement edges to qubit \(q\) by clamping \(q \leftarrow b \in \{0, 1\}\) and renormalizing the post-intervention state, enabling direct evaluation of causal \(\operatorname{do}\)-calculus expected utility (cevCausalDoExpectedUtility) vs. confounded evidential utility (jevEvidentialExpectedUtility).Quantum Jeffrey Plücker Kinematic Engine (
quantum_jeffrey_plucker_kinematic_update): Given soft syndrome / weak-measurement evidence weights \((q_1, q_2) = (q_E, 1 - q_E)\) and coherence \(\gamma_{\mathrm{coh}} \in [0, 1]\), updates expectation values via the coherent Plücker law:\[ Q_{\mathrm{QJE}}(q_1, q_2, c_1, c_2, \gamma_{\mathrm{coh}}, w_A, w_B) = q_1 c_1 + q_2 c_2 + 2\gamma_{\mathrm{coh}}\,\operatorname{Re}\!\left(w_A \overline{w_B}\right), \]which reduces identically to classical Jeffrey probability kinematics (
jeffreyKinematicUpdate) when \(\gamma_{\mathrm{coh}} = 0\).Noisy Kraus Density-Matrix Simulation + McWeeny Cubic Idempotency Purification (
simulate_noisy_density_msb,mcweeny_purify_density_matrix): Indo_simulate_density, Kraus channels (bit flip,phase flip,phase damp,amplitude damp,depolarizing) evolve \(\rho \in \mathbb{C}^{2^n \times 2^n}\), followed bymcweeny_passesof \(\rho \leftarrow \frac{3\rho^2 - 2\rho^3}{\operatorname{Tr}(3\rho^2 - 2\rho^3)}\). As proved intequila_rust_pyo3_grassmannian_vrc_qci_simulator_identities, a \(5\%\) depolarizing error (\(\lambda = 19/20 = 0.95\)) is contracted in a single pass to:\[ \operatorname{mcweenyPurificationPoly}\!\left(\frac{19}{20}\right) = \frac{3971}{4000} = 0.99275 \implies 1 - \frac{3971}{4000} = \frac{29}{4000} < \frac{1}{100}. \]
3. High-Performance Systems Engineering & High-\(n\) Scaling Architecture (n = 4 .. 126 Qubits)¶
To achieve order-of-magnitude speedups over existing C++ and Python Tequila backends (qulacs, cirq, qiskit, symbolic) across both full dense \(2^n\) statevectors (\(n = 4\dots 28\), up to \(4.00\text{ GiB}\) per statevector) and particle-number-conserving Grassmannian Plücker chemistry circuits (\(n = 4\dots 126\) qubits, up to FeMoco nitrogenase active-space width), we implemented six low-level algorithmic optimizations in …/src/signals/numerical_adapter/src/tequila_simulator.rs and …/src/tequila/src/tequila/simulators/simulator_signals.py:
Dual 64-Bit / 128-Bit Bitwise Pauli String Compilation (
CompiledPauliString): Instead of iterating over character tuples(qubit, 'X'|'Y'|'Z')for each basis state in \(O(w \cdot 2^n)\),CompiledPauliString::from_ops(…/src/signals/numerical_adapter/src/tequila_simulator.rs) precomputes 64-bit (xy_mask: usize, z_mask: usize) and 128-bit (xy_mask_128: u128, z_mask_128: u128) bitmasks alongside \(i^{N_Y} \in \{\pm 1, \pm i\}\). Applying any weight-\(w\) Pauli string \(P\) to a basis state \(|x\rangle\) executes in 3 branchless CPU instructions (XOR,AND,POPCNT):\[ P|x\rangle = (-1)^{\operatorname{popcnt}(x \,\&\, z_{\mathrm{mask}})}\,i^{N_Y}\,\bigl|x \oplus \mathrm{xy}_{\mathrm{mask}}\bigr\rangle. \]Lowest-Set-Bit Hermitian Butterfly Pair Folding (
tequilaHermitianButterflyPairOps): For any off-diagonal Pauli string (\(\mathrm{xy}_{\mathrm{mask}} \neq 0\)), let \(\mathrm{low} = \mathrm{xy}_{\mathrm{mask}} \ \& \ (-\mathrm{xy}_{\mathrm{mask}})\) be its lowest set bit. Because \(P\) is Hermitian and involutive (\(P^\dagger = P, P^2 = I\)), every basis state \(x\) with \((x \ \& \ \mathrm{low}) = 0\) pairs uniquely with \(x' = x \oplus \mathrm{xy}_{\mathrm{mask}}\) where \((x' \ \& \ \mathrm{low}) \neq 0\). Bothapply_compiled_exp_pauli_msbandFastCompiledHamiltonianevaluate only the \(2^{n-1}\) half-pairs \((x \ \& \ \mathrm{low}) = 0\):\[ \langle \Psi \mid c_m P_m \mid \Psi \rangle = c_m \sum_{(x \,\&\, \mathrm{low}_m) = 0} 2\,\operatorname{Re}\!\left(\Psi_{x \oplus \mathrm{xy}_m}^* (\pm i^{N_{Y,m}}) \Psi_x\right), \]reducing operation count by an exact factor of \(2w\times\) (
tequilaNaivePauliStringOps (k + 1) m w = 2 * w * tequilaHermitianButterflyPairOps (k + 1) m).\(8192\)-Element (\(128\text{ KiB}\)) Cache-Blocked Multi-Threaded
RayonButterfly Kernels (\(n \ge 15\)): On multi-core CPUs (20-thread Intel Core i9-13900H), naive parallelizationstate.par_chunks_mut(block)on fine-stride gates (\(t \to n-1, \mathrm{block} = 2\)) spawns millions of 32-byte tasks that thrash the work-stealing scheduler and induce 64-byte cache-line false sharing. Our dense kernels (…/src/signals/numerical_adapter/src/tequila_simulator.rs) enforce a minimum parallel grain ofchunk_size = block.max(8192)(\(128\text{ KiB} = 2{,}048\) cache lines per task) when \(\mathrm{block} \le 2^{n-4}\), and useblock_slice.split_at_mut(step)with zippedpar_chunks_mut(8192)when \(\mathrm{block} > 2^{n-4}\) (top qubits \(t \in \{0, 1, 2, 3\}\)). Similarly,FastCompiledHamiltonian::expectation_dense(…/src/signals/numerical_adapter/src/tequila_simulator.rs) fuses all diagonal and off-diagonal terms inside \(4096\)-element (\(64\text{ KiB}\)) L1/L2-cache-resident Rayon blocks with zero heap allocations.Persistent Pre-Mapped
scratch_stateBuffer & Zero-Copy PyO3RustFastCircuit/RustFastHamiltonianSet: On Linuxglibc, allocating and dropping aVec<C64>larger thanMMAP_THRESHOLD(\(n \ge 14\)) on everyc_E(variables)call triggers repeatedmmap/munmapsystem calls and thousands of kernel minor page faults (clear_page_erms).RustFastCircuit(…/src/signals/numerical_adapter/src/tequila_simulator.rs) retains a persistentscratch_state: Vec<C64>across evaluations, compiles the gate list andRustFastHamiltonianSetonce duringtq.compile(), updates only the flat angle arrayself._current_anglesinupdate_variables, and computes all expectation values inside Rust without copying the \(2^n\) statevector across the Python FFI boundary.Hybrid 128-Bit Sparse-Plücker (
u128) to Dense-Rayon Handoff & Gosper’s Combinatorial Bit-Hack (n <= 126Qubits): Every circuit initialized from a computational basis state \(|x_0\rangle\) begins execution in a sorted 128-bit sparse Plücker vectorscratch_sparse: Vec<(u128, C64)>(…/src/signals/numerical_adapter/src/tequila_simulator.rs):Particle-Conserving & Sparse Regime (\(n = 4\dots 126\) Qubits): For
HCB-SPA,MRA-PNO, Givens, GHZ, and Clifford+\(R_z\) circuits whose active Slater-determinant support remains within \(\tau_{\mathrm{sparse}}\), diagonal and permutation gates (X,CNOT,Z,S,T,Rz,Phase,SWAP) execute in-place without increasing support size, andexpectation_sparseevaluates \(\langle \Psi \mid H \mid \Psi \rangle\) directly onscratch_sparsein \(O(M \cdot |\mathrm{supp}| \log |\mathrm{supp}|)\) with zero \(2^n\) memory allocation, scaling seamlessly past 64 qubits up to \(n = 126\) qubits (\(2^{126} \approx 8.51 \times 10^{37}\) Hilbert dimension, covering the 108–120 orbital FeMoco active space!). In parallel,simulate_grassmann_plucker_hcb_sectoruses Gosper’s combinatorial bit-hack (u = x & -x; v = x + u; x = v + (((v ^ x) / u) >> 2)) to enumerate \(\binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}\) Plücker coordinates in \(O\bigl(\binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}}\bigr)\) without \(2^{n_{\mathrm{orb}}}\) iteration.Full Dense \(2^n\) Handoff (\(n = 12\dots 28\) Qubits): When a dense circuit’s active support crosses \(\tau_{\mathrm{sparse}} = \min(2^{n-3}, 16{,}384)\) at instruction
handoff_idx,materialize_sparse_into_densescatters the already-computed amplitudes intoscratch_stateand executes only the remaining sliceinstructions[handoff_idx..]on the 20-thread Rayon butterfly engine—skipping the first ~13 full-statevector sweeps of Layer 0!
4. Head-to-Head Comparative Benchmarks & Qubit Limit Analysis Across Tequila Backends¶
All benchmarks were executed on the same Linux container workstation (13th Gen Intel Core i9-13900H, 14 cores / 20 hardware threads, 54 GiB physical RAM with 24 GiB available, Python 3.12.3, rustc --release optimization) comparing Tequila’s installed backends:
signals/grassmann(Ours): Native Rust + PyO3 (maturin) hybrid 128-bit sparse-Plücker / 20-thread Rayon dense butterfly simulator (…/src/tequila/src/tequila/simulators/simulator_signals.py);qulacs: C++ SIMD statevector simulator (qulacsviaBackendCircuitQulacs/BackendExpectationValueQulacs);cirq: Google Cirq NumPy/vectorized simulator (cirq-coreviaBackendCircuitCirq);qiskit: Qiskit Aer C++StatevectorSimulator(qiskit-aerviaBackendCircuitQiskit);symbolic: Tequila’s pure-Python/SymPy reference simulator (BackendCircuitSymbolic).
4.1 Table 1: Full Dense \(2^n\) Parametrized Circuit + Pauli Hamiltonian Scaling (\(n = 4 \dots 28\) Qubits)¶
Each circuit applies \(L\) layers of dense single-qubit \(R_y(\theta_{l,q})\) rotations on every qubit \(q \in \{0, \dots, n-1\}\) (populating all \(2^n\) computational basis states), a linear CNOT entangling chain across all \(n-1\) adjacent pairs, and a 4-qubit native ExpPauli rotation \(\exp(-i\frac{\phi_l}{2}X_0 X_1 X_2 X_3)\), followed by evaluating an \(M\)-term Pauli Hamiltonian (\(50\%\) diagonal \(Z_i Z_{i+1}\) + \(50\%\) off-diagonal \(X_i Y_{i+1}\)):
Qubits \(n\) |
Hilbert Dim \(2^n\) (Dense RAM) |
Circuit & Hamiltonian \((L, M)\) |
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|---|
\(4\) |
\(16\) (\(256\text{ B}\)) |
\(L=2, M=16\) |
\(0.065\text{ ms}\) |
\(3.994\text{ ms}\) |
\(3.984\text{ ms}\) |
\(63.879\text{ ms}\) |
\(390.688\text{ ms}\) |
\(61.7\times\) / \(61.5\times\) / \(986\times\) (\(6{,}033\times\) vs. |
\(6\) |
\(64\) (\(1\text{ KiB}\)) |
\(L=3, M=30\) |
\(0.138\text{ ms}\) |
\(8.453\text{ ms}\) |
\(9.857\text{ ms}\) |
\(67.560\text{ ms}\) |
\(38{,}833.5\text{ ms}\) |
\(61.3\times\) / \(71.4\times\) / \(490\times\) (\(281{,}394\times\) vs. |
\(8\) |
\(256\) (\(4\text{ KiB}\)) |
\(L=3, M=40\) |
\(0.223\text{ ms}\) |
\(3.994\text{ ms}\) |
\(28.178\text{ ms}\) |
\(86.988\text{ ms}\) |
\(> 600\text{ s}\) (TLE) |
\(17.9\times\) / \(126.3\times\) / \(390\times\) |
\(10\) |
\(1{,}024\) (\(16\text{ KiB}\)) |
\(L=4, M=60\) |
\(0.438\text{ ms}\) |
\(7.363\text{ ms}\) |
\(130.837\text{ ms}\) |
\(203.008\text{ ms}\) |
TLE |
\(16.8\times\) / \(298.7\times\) / \(464\times\) |
\(12\) |
\(4{,}096\) (\(64\text{ KiB}\)) |
\(L=4, M=100\) |
\(1.192\text{ ms}\) |
\(15.770\text{ ms}\) |
\(621.619\text{ ms}\) |
\(768.692\text{ ms}\) |
TLE |
\(13.2\times\) / \(521.6\times\) / \(645\times\) |
\(14\) |
\(16{,}384\) (\(256\text{ KiB}\)) |
\(L=4, M=120\) |
\(3.161\text{ ms}\) |
\(21.418\text{ ms}\) |
|
\(3{,}452.14\text{ ms}\) |
TLE |
\(6.8\times\) / \(\infty\) / \(1{,}092\times\) |
\(16\) |
\(65{,}536\) (\(1\text{ MiB}\)) |
\(L=4, M=120\) |
\(11.718\text{ ms}\) |
\(25.957\text{ ms}\) |
\(14{,}217.3\text{ ms}\)* |
\(16{,}198.4\text{ ms}\) |
TLE |
\(2.2\times\) / \(1{,}213\times\) / \(1{,}382\times\) |
\(18\) |
\(262{,}144\) (\(4\text{ MiB}\)) |
\(L=4, M=120\) |
\(22.113\text{ ms}\) |
\(217.741\text{ ms}\) |
|
\(> 65{,}000\text{ ms}\) |
TLE |
\(9.85\times\) vs. |
\(20\) |
\(1{,}048{,}576\) (\(16\text{ MiB}\)) |
\(L=4, M=120\) |
\(53.817\text{ ms}\) |
\(615.566\text{ ms}\) |
|
TLE |
TLE |
\(11.44\times\) vs. |
\(22\) |
\(4{,}194{,}304\) (\(64\text{ MiB}\)) |
\(L=4, M=120\) |
\(462.083\text{ ms}\) |
\(1{,}585.72\text{ ms}\) |
|
TLE |
TLE |
\(3.43\times\) vs. |
\(24\) |
\(16{,}777{,}216\) (\(256\text{ MiB}\)) |
\(L=4, M=120\) |
\(2{,}459.68\text{ ms}\) |
\(5{,}593.02\text{ ms}\) |
|
TLE |
TLE |
\(2.27\times\) vs. |
\(26\) |
\(67{,}108{,}864\) (\(1.00\text{ GiB}\)) |
\(L=1, M=32\) |
\(1{,}978.88\text{ ms}\) |
\(5{,}623.18\text{ ms}\) |
OOM / TLE |
OOM / TLE |
TLE |
\(2.84\times\) vs. |
\(27\) |
\(134{,}217{,}728\) (\(2.00\text{ GiB}\)) |
\(L=1, M=32\) |
\(4{,}150.77\text{ ms}\) |
\(11{,}929.3\text{ ms}\) |
OOM / TLE |
OOM / TLE |
TLE |
\(2.87\times\) vs. |
\(28\) |
\(268{,}435{,}456\) (\(4.00\text{ GiB}\)) |
\(L=1, M=32\) |
\(9{,}443.78\text{ ms}\) |
\(25{,}673.1\text{ ms}\) |
OOM / TLE |
OOM / TLE |
TLE |
\(2.72\times\) vs. |
* Note on cirq failure at \(n \ge 14\): cirq defaults to single-precision np.complex64 (float32), causing Hermitian Pauli expectation sums at \(n \ge 14\) to accumulate spurious imaginary components \(\operatorname{Im}\langle H\rangle \approx 1.38 \times 10^{-6} \text{–} 3.29 \times 10^{-5} > 10^{-6}\), which raises TypeError: imaginary part detected inside Tequila’s Objective conversion (to_float). Our signals backend uses exact IEEE-754 double precision (C64 / f64) everywhere and matches qulacs and qiskit to \(10^{-14}\) across all qubit counts.
4.2 Table 2: Particle-Number-Conserving HCB-SPA / MRA-PNO Chemistry Scaling (\(n = 4 \dots 126\) Qubits — FeMoco Scale!)¶
For full-width \(n_{\mathrm{orb}}\)-qubit particle-number-conserving HCB-SPA / MRA-PNO chemistry circuits on \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) with \(M = 240\) Hamiltonian terms (\(70\%\) diagonal \(Z_i Z_{i+1}\) Coulomb/exchange terms + \(30\%\) off-diagonal \(X_i X_{i+1} + Y_i Y_{i+1}\) hopping terms), conventional backends (qulacs, cirq, qiskit) still allocate a dense \(2^{n_{\mathrm{orb}}}\) statevector and hit the exponential RAM wall at \(n = 28\text{–}30\), whereas signals / grassmann executes in the 128-bit sparse Plücker subspace (\(|\mathrm{supp}(\Psi)| = 2^{n_{\mathrm{occ}}} \le \binom{n_{\mathrm{orb}}}{n_{\mathrm{occ}}} \ll 2^{n_{\mathrm{orb}}}\)) all the way to \(n = 126\) qubits:
Active Space \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) |
Qubits \(n = n_{\mathrm{orb}}\) |
Full Hilbert Dim \(2^n\) |
Active Plücker Support \(|\mathrm{supp}(\Psi)|\) |
|
|
|
|
|
|---|---|---|---|---|---|---|---|---|
\(\mathrm{Gr}_{\mathbb{C}}(4, 14)\) |
\(14\) |
\(16{,}384\) |
\(16\) (\(512\text{ B}\)) |
\(0.044\text{ ms}\) |
\(67.301\text{ ms}\) |
|
\(191.191\text{ ms}\) |
\(1{,}522\times\) / \(4{,}325\times\) |
\(\mathrm{Gr}_{\mathbb{C}}(4, 18)\) |
\(18\) |
\(262{,}144\) |
\(16\) (\(512\text{ B}\)) |
\(0.053\text{ ms}\) |
\(24.282\text{ ms}\) |
|
\(2{,}378.23\text{ ms}\) |
\(460\times\) / \(45{,}028\times\) |
\(\mathrm{Gr}_{\mathbb{C}}(5, 22)\) |
\(22\) |
\(4{,}194{,}304\) |
\(32\) (\(1\text{ KiB}\)) |
\(0.067\text{ ms}\) |
\(538.192\text{ ms}\) |
|
\(> 30{,}000\text{ ms}\) |
\(8{,}046\times\) vs. |
\(\mathrm{Gr}_{\mathbb{C}}(5, 24)\) |
\(24\) |
\(16{,}777{,}216\) |
\(32\) (\(1\text{ KiB}\)) |
\(0.079\text{ ms}\) |
\(1{,}841.05\text{ ms}\) |
|
OOM / TLE |
\(23{,}281\times\) vs. |
\(\mathrm{Gr}_{\mathbb{C}}(6, 26)\) |
\(26\) |
\(67{,}108{,}864\) |
\(64\) (\(2\text{ KiB}\)) |
\(0.101\text{ ms}\) |
\(6{,}893.55\text{ ms}\) |
OOM |
OOM |
\(68{,}253\times\) vs. |
\(\mathrm{Gr}_{\mathbb{C}}(6, 28)\) |
\(28\) |
\(2.68 \times 10^8\) |
\(64\) (\(2\text{ KiB}\)) |
\(0.117\text{ ms}\) |
\(\sim 26{,}000\text{ ms}\) (\(4\text{ GiB}\)) |
OOM |
OOM |
\(> 220{,}000\times\) vs. |
\(\mathrm{Gr}_{\mathbb{C}}(6, 30)\) |
\(30\) |
\(1.07 \times 10^9\) |
\(64\) (\(2\text{ KiB}\)) |
\(0.119\text{ ms}\) |
OOM (\(16\text{ GiB}\) wall) |
OOM |
OOM |
\(\infty\) (Beyond Dense RAM Wall) |
\(\mathrm{Gr}_{\mathbb{C}}(6, 40)\) |
\(40\) |
\(1.10 \times 10^{12}\) |
\(64\) (\(2\text{ KiB}\)) |
\(0.210\text{ ms}\) |
OOM (\(16\text{ TiB}\)) |
OOM |
OOM |
\(\infty\) (Sub-Millisecond at \(40\) Qubits) |
\(\mathrm{Gr}_{\mathbb{C}}(6, 60)\) |
\(60\) |
\(1.15 \times 10^{18}\) |
\(64\) (\(2\text{ KiB}\)) |
\(0.317\text{ ms}\) |
OOM (\(16\text{ EiB}\)) |
OOM |
OOM |
\(\infty\) (Sub-Millisecond at \(60\) Qubits) |
\(\mathrm{Gr}_{\mathbb{C}}(6, 64)\) |
\(64\) |
\(1.84 \times 10^{19}\) |
\(64\) (\(2\text{ KiB}\)) |
\(0.342\text{ ms}\) |
OOM (\(256\text{ EiB}\)) |
OOM |
OOM |
\(\infty\) (Crosses 64-Bit Boundary) |
\(\mathrm{Gr}_{\mathbb{C}}(8, 80)\) |
\(80\) |
\(1.21 \times 10^{24}\) |
\(256\) (\(8\text{ KiB}\)) |
\(0.867\text{ ms}\) |
OOM |
OOM |
OOM |
\(\infty\) (Sub-Millisecond at \(80\) Qubits) |
\(\mathrm{Gr}_{\mathbb{C}}(8, 100)\) |
\(100\) |
\(1.27 \times 10^{30}\) |
\(256\) (\(8\text{ KiB}\)) |
\(1.344\text{ ms}\) |
OOM |
OOM |
OOM |
\(\infty\) (\(1.34\text{ ms}\) at \(100\) Qubits) |
\(\mathrm{Gr}_{\mathbb{C}}(8, 120)\) |
\(120\) |
\(1.33 \times 10^{36}\) |
\(256\) (\(8\text{ KiB}\)) |
\(1.826\text{ ms}\) |
OOM |
OOM |
OOM |
\(\infty\) (Full FeMoco Active-Space Width) |
\(\mathrm{Gr}_{\mathbb{C}}(8, 126)\) |
\(126\) |
\(8.51 \times 10^{37}\) |
\(256\) (\(8\text{ KiB}\)) |
\(1.819\text{ ms}\) |
OOM |
OOM |
OOM |
\(\infty\) (128-Bit |
4.3 Table 3: Full VQE BFGS Optimization (tq.minimize) & Backend Qubit Ceiling Summary¶
For a complete multi-parameter VQE optimization trajectory (tq.minimize(objective=E_vqe, method="BFGS") with analytical two-term parameter-shift gradients tq.grad on a 4-qubit, 9-term chemistry Hamiltonian, converging to \(E_{\mathrm{opt}} = -1.40998396\text{ Ha}\)) and across the empirical scaling limits discovered in Tables 1–2:
Tequila Backend |
Full VQE |
Relative VQE Speedup ( |
Converged VQE Energy \(E_{\mathrm{opt}}\) (\(\text{Ha}\)) |
Practical Dense \(2^n\) Qubit Limit |
Particle-Conserving / Sparse Plücker Qubit Limit |
Primary Limiting Bottleneck |
|---|---|---|---|---|---|---|
|
\(18.519\text{ ms}\) |
\(1.00\times\) (Fastest) |
\(-1.40998396\) |
\(n = 28\) (\(4.00\text{ GiB}\)) |
\(n = 126\) ( |
Physical RAM (\(>4\text{ GiB}\) at \(n \ge 29\)) for dense; 128-bit |
|
\(182.265\text{ ms}\) |
\(9.84\times\) slower |
\(-1.40998396\) |
\(n = 28\) (\(4.00\text{ GiB}\)) |
\(n = 28\) (no subspace engine) |
Rebuilds Python/C++ objects per step; always allocates full \(2^n\) statevector |
|
\(341.897\text{ ms}\) |
\(18.46\times\) slower |
\(-1.40998411\) (drift) |
\(n = 13\) ( |
\(n = 13\) ( |
|
|
\(774.230\text{ ms}\) |
\(41.81\times\) slower |
\(-1.40998396\) |
\(n = 6\) (\(38.8\text{ s}\)) |
\(n = 6\) |
Pure-Python loop & |
|
\(11{,}434.44\text{ ms}\) |
\(617.43\times\) slower |
\(-1.40998396\) |
\(n = 16\) (\(16.2\text{ s}\)) |
\(n = 18\) (\(2.38\text{ s}\)) |
Per-evaluation QuantumCircuit transpilation & job-submission overhead |
4.4 Table 4: Feature & Physics Capability Matrix Across Tequila Backends¶
Capability / Physical Primitive |
|
|
|
|
|
|---|---|---|---|---|---|
Native Multi-Qubit |
Yes (3-op Bitwise + Rayon) |
Yes |
Decomposed |
Decomposed |
Decomposed |
Zero-Copy Rust FFI Compiled Expectation ( |
Yes |
No (per-call C++ wrap) |
No |
No |
No |
IEEE-754 Double Precision ( |
Yes (\(< 10^{-14}\) error) |
Yes |
No ( |
Yes |
Yes |
128-Bit Sparse Plücker Subspace Execution up to \(n = 126\) Qubits |
Yes ( |
No (\(2^n\) dense only) |
No |
No |
No |
Cauchy–Binet \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) Generator Evolution ( |
Yes |
No |
No |
No |
No |
Complex Plabic VRC Orthogonality (\(V K^\top = 0\)) & Kähler \(\det(I + W W^\dagger)\) Diagnostics |
Yes ( |
No |
No |
No |
No |
Noisy Kraus Density Evolution + McWeeny \(3\rho^2 - 2\rho^3\) Idempotency Healing |
Yes ( |
Kraus only |
Kraus only |
Kraus only |
No |
Pearl Causal \(\operatorname{do}(q = b)\) Intervention & Quantum Jeffrey Plücker Kinematics |
Yes ( |
No |
No |
No |
No |
Machine-Checked Lean 4 Formal Proofs ( |
Yes ( |
No |
No |
No |
No |
4.5 Reproducible Command-Line & Programmatic Benchmark Runner (python -m tequila.simulators.simulator_signals)¶
All five benchmark suites—benchmark_dense_expectation_scaling, benchmark_dense_memory_wall_limit, benchmark_plucker_hcb_chemistry_scaling, benchmark_vqe_optimization_and_wavefunction, and benchmark_grassmann_plucker_permanent_vs_determinant—are integrated directly into tequila (…/src/tequila/src/tequila/simulators/simulator_signals.py and …/src/tequila/src/tequila/simulators/benchmark_signals.py) with structured stdout INFO/DEBUG logging (configure_logging), sympy.lambdify-accelerated symbolic evaluation (evaluate_sympy_with_lambdify, get_lambdified_gate_factors), and a testable argparse main(argv) entry point supporting -v/--verbose, -q/--quiet, --log-level={DEBUG,INFO,WARNING,ERROR,CRITICAL}, and --lambdify-backend={numpy,math,cmath,mpmath,scipy}:
# Run the fast CI/verification benchmark suite with verbose DEBUG/INFO stdout logging:
python -m tequila.simulators.simulator_signals -v --lambdify-backend=numpy --quick
python -m tequila.simulators.benchmark_signals --log-level=DEBUG --lambdify-backend=math --quick
python -m tequila -q --json-out .tmp/tequila_benchmarks.json
# Run specific suites with custom qubit counts, chemistry manifolds, and JSON/Markdown export:
python -m tequila.simulators.simulator_signals \
--log-level=INFO \
--lambdify-backend=numpy \
--suite chemistry \
--chemistry-configs 2:6:60,4:14:120,6:64:240,8:126:240 \
--backends signals,qulacs \
--repeats 5 \
--json-out .tmp/tequila_benchmarks.json \
--markdown-out .tmp/tequila_benchmarks.md
5. Machine-Checked Lean 4 Verification (Signals.DFT Sections 22 & 22.1)¶
Theorems tequila_rust_pyo3_grassmannian_vrc_qci_simulator_identities and tequila_high_n_butterfly_plucker_128bit_and_memory_ceiling_identities are machine-checked in …/src/signals/Signals/DFT.lean (and tested in …/src/signals/SignalsTests.lean and …/src/signals/SignalsPendingTests.lean):
import Signals
namespace TequilaRustPyO3SimulatorVerification
open Signals.DFT
example (f0 g1 q1 q2 c1 c2 wa_re wa_im wb_re wb_im : ℝ)
(k m w : ℕ) (ar ai br bi wr wi a b c d : ℝ) :
tequilaGrassmannPluckerSectorDim 2 4 = 6 ∧
tequilaFullHilbertDim 4 = 16 ∧
tequilaHilbertToPluckerCompressionRatio 2 4 = 8 / 3 ∧
tequilaGrassmannPluckerSectorDim 2 6 = 15 ∧
tequilaFullHilbertDim 6 = 64 ∧
(4 : ℝ) < tequilaHilbertToPluckerCompressionRatio 2 6 ∧
tequilaGrassmannPluckerSectorDim 3 6 = 20 ∧
tequilaGrassmannPluckerSectorDim 2 10 = 45 ∧
tequilaFullHilbertDim 10 = 1024 ∧
(22 : ℝ) < tequilaHilbertToPluckerCompressionRatio 2 10 ∧
tequilaGrassmannPluckerSectorDim 2 12 = 66 ∧
tequilaFullHilbertDim 12 = 4096 ∧
(62 : ℝ) < tequilaHilbertToPluckerCompressionRatio 2 12 ∧
tequilaShiftRuleTwoTermGradient (1 / 2) (f0 + g1) (f0 - g1) = g1 ∧
(tequilaVqeBellModelEnergy (3 / 5) (4 / 5)) ^ 2 +
((1 / 2) * (3 / 5) - (4 / 5)) ^ 2 = 5 / 4 ∧
(tequilaVqeBellModelEnergy (3 / 5) (4 / 5)) ^ 2 ≤ 5 / 4 ∧
Signals.QuantumCausalInference.quantumJeffreyPluckerKinematicUpdate
q1 q2 c1 c2 0 wa_re wa_im wb_re wb_im =
Signals.QuantumCausalInference.jeffreyKinematicUpdate q1 q2 c1 c2 ∧
mcweenyPurificationPoly (19 / 20) = 3971 / 4000 ∧
1 - mcweenyPurificationPoly (19 / 20) < 1 / 100 ∧
tequilaNaivePauliStringOps (k + 1) m w =
2 * w * tequilaHermitianButterflyPairOps (k + 1) m ∧
tequilaHermitianPairImaginaryResidual ar ai br bi wr wi = 0 ∧
tequilaBosonicPermanent2x2 a b c d -
tequilaFermionicDeterminant2x2 a b c d = 2 * b * c ∧
tequilaBosonicPermanent2x2 a 0 0 d =
tequilaFermionicDeterminant2x2 a 0 0 d ∧
tequilaBosonicPermanent2x2 0 b c 0 =
-tequilaFermionicDeterminant2x2 0 b c 0 ∧
tequilaDenseStatevectorBytes 20 = 16777216 ∧
tequilaDenseStatevectorBytes 24 = 268435456 ∧
tequilaDenseStatevectorBytes 26 = 1073741824 ∧
tequilaDenseStatevectorBytes 27 = 2147483648 ∧
tequilaDenseStatevectorBytes 28 = 4294967296 ∧
tequilaGrassmannPluckerSectorDim 4 16 = 1820 ∧
(36 : ℝ) < tequilaHilbertToPluckerCompressionRatio 4 16 ∧
tequilaSparsePluckerHcbBytes 6 * 2097152 = tequilaDenseStatevectorBytes 28 ∧
tequilaSparsePluckerHcbSupportDim 8 < tequilaFullHilbertDim 126 := by
have h1 :=
tequila_rust_pyo3_grassmannian_vrc_qci_simulator_identities
f0 g1 (3 / 5) (4 / 5) q1 q2 c1 c2 wa_re wa_im wb_re wb_im (by norm_num)
have h2 :=
tequila_high_n_butterfly_plucker_128bit_and_memory_ceiling_identities
k m w ar ai br bi wr wi a b c d
exact ⟨h1.1, h1.2.1, h1.2.2.1, h1.2.2.2.1, h1.2.2.2.2.1, h1.2.2.2.2.2.1,
h1.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.2.1,
h1.2.2.2.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.2.2.2.1,
h1.2.2.2.2.2.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.2.2.2.2.2.1,
h1.2.2.2.2.2.2.2.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.2.2.2.2.2.2.2.1,
h1.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.1,
h1.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.1, h1.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2,
h2.1, h2.2.1, h2.2.2.1, h2.2.2.2.1, h2.2.2.2.2.1,
h2.2.2.2.2.2.1, h2.2.2.2.2.2.2.1, h2.2.2.2.2.2.2.2.1,
h2.2.2.2.2.2.2.2.2.1, h2.2.2.2.2.2.2.2.2.2.1,
h2.2.2.2.2.2.2.2.2.2.2.1, h2.2.2.2.2.2.2.2.2.2.2.2.2.1,
h2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.1,
h2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2⟩
end TequilaRustPyO3SimulatorVerification
References¶
Niklas Affolter, Max Glick, Pavlo Pylyavskyy, and Sanjay Ramassamy. Vector-relation configurations and plabic graphs. Selecta Mathematica, 30:9, 2024. URL: https://doi.org/10.1007/s00029-023-00898-z, doi:10.1007/s00029-023-00898-z.
J. S. Kottmann, S. Alperin-Lea, T. Tamayo-Mendoza, A. Cervera-Lierta, C. Lavigne, T.-C. Yen, V. Verteletskyi, P. Schleich, A. Anand, M. Degroote, S. Chaney, M. Kesibi, N. G. Curnow, B. Solo, G. Tsilimigkounakis, C. Zendejas-Morales, A. F. Izmaylov, and A Aspuru-Guzik. Tequila: a platform for rapid development of quantum algorithms. 2021. Citation metadata transcribed from docs/grassmannian-madness-tequila-quantum-chemistry-plabic-vrc-paper.md.; Citation metadata transcribed from docs/grassmannian-tequila-rust-pyo3-quantum-simulator-paper.md. URL: https://arxiv.org/abs/2011.03057, arXiv:2011.03057.
J. S. Kottmann, P. Schleich, T. Tamayo-Mendoza, and A Aspuru-Guzik. Reducing qubit requirements while maintaining numerical precision for molecular simulations. 2021. Citation metadata transcribed from docs/grassmannian-madness-tequila-quantum-chemistry-plabic-vrc-paper.md.; Citation metadata transcribed from docs/grassmannian-tequila-rust-pyo3-quantum-simulator-paper.md. URL: https://arxiv.org/abs/2008.02819, arXiv:2008.02819.
Schema.org Metadata (JSON-LD)¶
{
"@context": "https://schema.org",
"@type": "ScholarlyArticle",
"headline": "A Rust/PyO3 (maturin) Quantum Simulation Backend for Tequila: Complex Grassmannians Gr_C(k,n), Layer-Coded Plabic Vector-Relation Configurations (VRC), Madelung/DDF Hydrodynamics, and Quantum Causal Inference (QCI) in Lean 4, Rust, and Python",
"author": {
"@type": "Person",
"name": "Wes Turner"
},
"dateModified": "2026-11-10",
"about": [
"Tequila Quantum Simulator Backend in Rust and PyO3/maturin",
"Complex Grassmannian Plücker Subspace Simulation",
"Vector-Relation Configurations (VRC)",
"Quantum Causal Inference and Jeffrey Kinematics",
"McWeeny Cubic Idempotency Purification",
"Lean 4 Formal Verification"
]
}