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


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:

  1. 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 and HCB circuits;

  2. 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; or

  3. Lack 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:

  1. Native Rust + PyO3 (maturin) Statevector, ExpPauli, & Rayon-Parallelized Hamiltonian Engine (tequila_simulator.rs, simulator_signals.py): Compiled as a native cdylib Python extension (signals_numerical_adapter) via PyO3 0.24 and maturin, BackendCircuitSignals, BackendExpectationValueSignals, and BackendBraKetSignals execute 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}\), and QubitExcitation), evaluate multi-term Pauli Hamiltonians \(\langle \Psi_{\mathrm{bra}} \mid H \mid \Psi_{\mathrm{ket}} \rangle\) in parallel across CPU cores via Rayon, 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.

  2. 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}}\)-pair HCB-SPA and Plabic-VRC quantum 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).

  3. Madelung / DDF / Turner Plücker \(\mathcal{Q}_4\) Diagnostics, Noisy Kraus Density-Matrix Evolution, & McWeeny Cubic Purification (simulate_noisy_density_msb): Supports Tequila’s NoiseModel (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.

  4. Quantum Causal Inference (QCI), Pearl \(\operatorname{do}\)-Interventions, & Quantum Jeffrey Plücker Kinematics (analyze_grassmann_qci_state): Integrates native TequilaGateOp::CausalDo interventions, QCI spin-channel mutual information \(I_{\mathrm{QCI}}(\alpha:\beta)\), and quantumJeffreyPluckerKinematicUpdate under 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 BackendCircuit

BackendCircuitSignals (Rust/PyO3)

Computational Advantage in tequila_simulator.rs

exponential_pauli

True (decomposed)

False (native)

Evaluates \(\bigl(\cos(\theta/2)I - i\sin(\theta/2)P\bigr)|\Psi\rangle\) in \(O(2^n)\) via the involution \(P^2 = I\) (apply_exp_pauli_msb) without CNOT staircases

controlled_exponential_pauli

True (decomposed)

False (native)

Applies control-bit mask controls_satisfied_msb directly during apply_exp_pauli_msb

controlled_rotation

True (decomposed)

False (native)

Applies \(R_x, R_y, R_z\) with arbitrary control lists in a single pass (apply_single_qubit_unitary_msb)

toffoli / cc_max

True (decomposed)

False (native)

Executes \(k\)-controlled \(X, Y, Z, H\) gates in 1 pass instead of \(6\text{–}16\) CNOTs + \(T/\text{T}^\dagger\) gates

swap

True (3 CNOTs)

False (native)

In-place bit-pair amplitude swap (TequilaGateOp::Swap) in 1 pass

phase / controlled_phase

True (decomposed)

False (native)

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:

\[ U_{\mathrm{ExpPauli}}(\theta, P) = \exp\!\left(-i\,\frac{\theta}{2}\,P\right) = \cos\!\left(\frac{\theta}{2}\right) I - i\sin\!\left(\frac{\theta}{2}\right) P, \qquad P = \bigotimes_{q \in \mathrm{support}(P)} \sigma_q^{(P)}, \]

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:

\[ \psi_{\mathrm{new}}[x] = \cos\!\left(\frac{\theta}{2}\right)\psi[x] - i\sin\!\left(\frac{\theta}{2}\right)\overline{\omega_P(x)}\,\psi[x']. \]

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):

\[ C_{:, p}' = \cos\!\left(\frac{\theta}{2}\right) C_{:, p} - \sin\!\left(\frac{\theta}{2}\right) C_{:, q}, \qquad C_{:, q}' = \sin\!\left(\frac{\theta}{2}\right) C_{:, p} + \cos\!\left(\frac{\theta}{2}\right) C_{:, q}. \]

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-free HCB-SPA pair excitations without Jordan–Wigner \(Z\)-strings:

\[\begin{split} \Psi_{\mathrm{JW}}[I] = \Delta_I^{\mathbb{C}}(C) = \det C[:, I], \qquad \Psi_{\mathrm{HCB}}[I] = \operatorname{perm} C[:, I], \qquad \operatorname{perm}_{2\times 2}\!\begin{pmatrix} a & b \\ c & d \end{pmatrix} - \det_{2\times 2}\!\begin{pmatrix} a & b \\ c & d \end{pmatrix} = 2bc. \end{split}\]

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\) (H2 / 2-pair HCB)

\(16\)

\(6\)

\(8\)

\(8 / 3 \approx 2.67\times\)

\((2, 6)\)

\(\mathrm{Gr}_{\mathbb{C}}(2,6)\) (GrC(2,6), LiH / BeH2 MRA-PNO)

\(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)\) (maxrank=9 PNO pair space)

\(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):

\[ \frac{\partial E(\theta)}{\partial \theta} = r\,\Bigl(E\!\left(\theta + \frac{\pi}{4r}\right) - E\!\left(\theta - \frac{\pi}{4r}\right)\Bigr) = \frac{1}{2}\bigl((f_0 + g_1) - (f_0 - g_1)\bigr) = g_1. \]

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\):

\[ \bigl(E_{\mathrm{VQE}}(\cos a, \sin a)\bigr)^2 + \left(\frac{1}{2}\cos a - \sin a\right)^2 = \frac{5}{4}(\cos^2 a + \sin^2 a) = \frac{5}{4} \implies \bigl(E_{\mathrm{VQE}}(\cos a, \sin a)\bigr)^2 \le \frac{5}{4}, \]

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):

  1. 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).

  2. 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\).

  3. Noisy Kraus Density-Matrix Simulation + McWeeny Cubic Idempotency Purification (simulate_noisy_density_msb, mcweeny_purify_density_matrix): In do_simulate_density, Kraus channels (bit flip, phase flip, phase damp, amplitude damp, depolarizing) evolve \(\rho \in \mathbb{C}^{2^n \times 2^n}\), followed by mcweeny_passes of \(\rho \leftarrow \frac{3\rho^2 - 2\rho^3}{\operatorname{Tr}(3\rho^2 - 2\rho^3)}\). As proved in tequila_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:

  1. 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. \]
  2. 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\). Both apply_compiled_exp_pauli_msb and FastCompiledHamiltonian evaluate 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).

  3. \(8192\)-Element (\(128\text{ KiB}\)) Cache-Blocked Multi-Threaded Rayon Butterfly Kernels (\(n \ge 15\)): On multi-core CPUs (20-thread Intel Core i9-13900H), naive parallelization state.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 of chunk_size = block.max(8192) (\(128\text{ KiB} = 2{,}048\) cache lines per task) when \(\mathrm{block} \le 2^{n-4}\), and use block_slice.split_at_mut(step) with zipped par_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.

  4. Persistent Pre-Mapped scratch_state Buffer & Zero-Copy PyO3 RustFastCircuit / RustFastHamiltonianSet: On Linux glibc, allocating and dropping a Vec<C64> larger than MMAP_THRESHOLD (\(n \ge 14\)) on every c_E(variables) call triggers repeated mmap/munmap system calls and thousands of kernel minor page faults (clear_page_erms). RustFastCircuit (…/src/signals/numerical_adapter/src/tequila_simulator.rs) retains a persistent scratch_state: Vec<C64> across evaluations, compiles the gate list and RustFastHamiltonianSet once during tq.compile(), updates only the flat angle array self._current_angles in update_variables, and computes all expectation values inside Rust without copying the \(2^n\) statevector across the Python FFI boundary.

  5. Hybrid 128-Bit Sparse-Plücker (u128) to Dense-Rayon Handoff & Gosper’s Combinatorial Bit-Hack (n <= 126 Qubits): Every circuit initialized from a computational basis state \(|x_0\rangle\) begins execution in a sorted 128-bit sparse Plücker vector scratch_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, and expectation_sparse evaluates \(\langle \Psi \mid H \mid \Psi \rangle\) directly on scratch_sparse in \(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_sector uses 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_dense scatters the already-computed amplitudes into scratch_state and executes only the remaining slice instructions[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 (qulacs via BackendCircuitQulacs / BackendExpectationValueQulacs);

  • cirq: Google Cirq NumPy/vectorized simulator (cirq-core via BackendCircuitCirq);

  • qiskit: Qiskit Aer C++ StatevectorSimulator (qiskit-aer via BackendCircuitQiskit);

  • 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)\)

signals (Rust/PyO3, Ours)

qulacs (C++)

cirq

qiskit (Aer)

symbolic

signals Speedup vs. qulacs / cirq / qiskit

\(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. symbolic)

\(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. symbolic)

\(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}\)

FAILED (float32 drift)*

\(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}\)

FAILED / \(>60\text{ s}\)

\(> 65{,}000\text{ ms}\)

TLE

\(9.85\times\) vs. qulacs

\(20\)

\(1{,}048{,}576\) (\(16\text{ MiB}\))

\(L=4, M=120\)

\(53.817\text{ ms}\)

\(615.566\text{ ms}\)

FAILED / TLE

TLE

TLE

\(11.44\times\) vs. qulacs

\(22\)

\(4{,}194{,}304\) (\(64\text{ MiB}\))

\(L=4, M=120\)

\(462.083\text{ ms}\)

\(1{,}585.72\text{ ms}\)

FAILED / TLE

TLE

TLE

\(3.43\times\) vs. qulacs

\(24\)

\(16{,}777{,}216\) (\(256\text{ MiB}\))

\(L=4, M=120\)

\(2{,}459.68\text{ ms}\)

\(5{,}593.02\text{ ms}\)

FAILED / TLE

TLE

TLE

\(2.27\times\) vs. qulacs

\(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. qulacs

\(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. qulacs

\(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. qulacs (Dense RAM Ceiling)

* 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)|\)

signals / grassmann (Ours)

qulacs (C++)

cirq

qiskit (Aer)

signals Speedup vs. qulacs / qiskit

\(\mathrm{Gr}_{\mathbb{C}}(4, 14)\)

\(14\)

\(16{,}384\)

\(16\) (\(512\text{ B}\))

\(0.044\text{ ms}\)

\(67.301\text{ ms}\)

FAILED (float32)

\(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}\)

FAILED (float32)

\(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}\)

FAILED

\(> 30{,}000\text{ ms}\)

\(8{,}046\times\) vs. qulacs

\(\mathrm{Gr}_{\mathbb{C}}(5, 24)\)

\(24\)

\(16{,}777{,}216\)

\(32\) (\(1\text{ KiB}\))

\(0.079\text{ ms}\)

\(1{,}841.05\text{ ms}\)

FAILED

OOM / TLE

\(23{,}281\times\) vs. qulacs

\(\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. qulacs

\(\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. qulacs

\(\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 u128 Plücker Limit)

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 tq.minimize Latency

Relative VQE Speedup (signals = 1.00x)

Converged VQE Energy \(E_{\mathrm{opt}}\) (\(\text{Ha}\))

Practical Dense \(2^n\) Qubit Limit

Particle-Conserving / Sparse Plücker Qubit Limit

Primary Limiting Bottleneck

signals / grassmann (Rust/PyO3, Ours)

\(18.519\text{ ms}\)

\(1.00\times\) (Fastest)

\(-1.40998396\)

\(n = 28\) (\(4.00\text{ GiB}\))

\(n = 126\) (u128 bitmask)

Physical RAM (\(>4\text{ GiB}\) at \(n \ge 29\)) for dense; 128-bit u128 word size at \(n > 126\)

qulacs (C++ SIMD)

\(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

cirq

\(341.897\text{ ms}\)

\(18.46\times\) slower

\(-1.40998411\) (drift)

\(n = 13\) (ExpectationValue) / \(n = 16\) (simulate)

\(n = 13\) (ExpectationValue)

float32 (complex64) imaginary drift raises TypeError in Tequila at \(n \ge 14\)

symbolic (Tequila Reference)

\(774.230\text{ ms}\)

\(41.81\times\) slower

\(-1.40998396\)

\(n = 6\) (\(38.8\text{ s}\))

\(n = 6\)

Pure-Python loop & ExpPauli CNOT ladder decomposition

qiskit (qiskit-aer)

\(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

signals / grassmann (Ours)

qulacs

cirq

qiskit

symbolic

Native Multi-Qubit ExpPauli (\(e^{-i\theta P/2}\) without CNOT Decomposition)

Yes (3-op Bitwise + Rayon)

Yes

Decomposed

Decomposed

Decomposed

Zero-Copy Rust FFI Compiled Expectation (RustFastCircuit)

Yes

No (per-call C++ wrap)

No

No

No

IEEE-754 Double Precision (f64 / complex128) at \(n \ge 14\)

Yes (\(< 10^{-14}\) error)

Yes

No (complex64 fails at \(n=14\))

Yes

Yes

128-Bit Sparse Plücker Subspace Execution up to \(n = 126\) Qubits

Yes (u128 + Gosper’s hack)

No (\(2^n\) dense only)

No

No

No

Cauchy–Binet \(\mathrm{Gr}_{\mathbb{C}}(n_{\mathrm{occ}}, n_{\mathrm{orb}})\) Generator Evolution (simulate_plucker_hcb)

Yes

No

No

No

No

Complex Plabic VRC Orthogonality (\(V K^\top = 0\)) & Kähler \(\det(I + W W^\dagger)\) Diagnostics

Yes (analyze_grassmann_qci)

No

No

No

No

Noisy Kraus Density Evolution + McWeeny \(3\rho^2 - 2\rho^3\) Idempotency Healing

Yes (mcweeny_passes)

Kraus only

Kraus only

Kraus only

No

Pearl Causal \(\operatorname{do}(q = b)\) Intervention & Quantum Jeffrey Plücker Kinematics

Yes (CausalDo / QJE)

No

No

No

No

Machine-Checked Lean 4 Formal Proofs (Signals.DFT Section 22 & 22.1)

Yes (3,628/3,628 jobs)

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"
  ]
}