In Weyl's verification architecture, Exact Diagonalization (ED) is not an informal sanity check—it is an independent numerical oracle completely decoupled from the symbolic derivation under test. weyl-oracle builds its matrix-free MatVec operator directly from the raw HIR microscopic Hamiltonian and performs stabilizer reduction independently, never reusing the pCUT pipeline's syndrome map or effective Ising mapping. Even a systematic bug in the symbolic front-end or pCUT transformation cannot hide from the oracle.
What the ED oracle shows
The ED oracle returns only Pass, Fail(OracleDiag) or Inconclusive. It produces no tagged value and does not change the error tag of the result it checks. Passing shows numerical agreement at size , not a proof of the symbolic derivation. ED is used only to decide compare assertions and to locate first_bad_order.
Independent Stabilizer Reduction & Symmetry Sectors
On a rough–smooth cylinder of circumference and height , the microscopic qubit count is:
At (), a single real f64 state vector already consumes ; at (), unreduced enumeration is physically impossible. Accordingly, weyl-oracle restricts unreduced full-space cross-checks to small cylinders () and applies a self-contained three-stage Clifford/stabilizer reduction for larger geometries.
First, working directly from the raw HIR microscopic Hamiltonian, the oracle identifies all conserved star and bulk plaquette operators commuting with every perturbation term (for instance, deep stars and bulk at ). Using symplectic Gaussian elimination, it independently constructs a Clifford frame that eliminates these integrals of motion and leaves effective qubits; off-diagonal star operators are never handled by naive bit-filtering in the raw computational basis. Next, in the reduced Hamiltonian Reduced, every word commuting with all -type bit-flip terms—such as the top Wilson loop , parity, or charge—defines a linear constraint over , so weyl-oracle computes the row-reduced nullspace of the flip-mask matrix over and splits the basis into affine subspaces indexed compactly by their free bits. Finally, because single-cell translation acts as a permutation of the sector's basis states, block-diagonalizing into momentum eigenstates (and point-group parity sectors when present) cuts the active dimension by another factor of nearly .
// crates/weyl-oracle/src/ed.rs — Symmetry sector and diagnostic report types
pub struct Sector {
pub nf: usize, // Number of free bits; sector dim = 2^nf
pub symmetries: Vec<u64>, // F2 nullspace basis (each with a private pivot bit)
pub free: Vec<u32>, // Bit positions of free bits in n_eff
pub pivots: Vec<(u32, u64, bool)>,// (pivot_bit, compact_mask, eigenvalue == -1)
pub symmetry_values: Vec<i8>, // Eigenvalues (±1) on the unperturbed reference state
}
pub struct SectorReport {
pub reference: Reference, // Vacuum or Particle { template }
pub momentum: Momentum, // k = 0 or k = π
pub symmetry_values: Vec<i8>,
pub dimension: usize, // Dimension of the momentum block
pub loops: Vec<(String, Option<i8>)>, // Named Wilson loops (e.g. W_e^top)
}Matrix-Free MatVec & Cross-Sector Observables
Inside each momentum block, BlockHamiltonian<R> never materializes a sparse matrix. Instead, it evaluates on bit-packed Fock/spin states: diagonal words accumulate real energies per basis state, while off-diagonal words jump directly to ket ^ flip_mask, applying the sign parity and orbit normalization factor on the fly.
To uphold Weyl's cross-thread determinism invariant, all parallel reductions and inner products partition vectors into fixed chunks of CHUNK = 1 << 14 (16,384 elements) and reduce partial sums in strict chunk-index order. Whether run on 1 thread or 64 threads, floating-point summation trees are identical and outputs match bit for bit.
On the rough–smooth cylinder, ground-state energy density and single-particle dispersion are strictly defined across Wilson-loop sectors:
The lowest state in the odd sector () must lie on an isolated single-particle branch; when approaching a multi-particle continuum, the lowest eigenvalue cannot blindly be identified with that branch. Substituting an intra-sector excitation gap for is forbidden, and every oracle report preserves both endpoint sectors and eigenstate labels.
Double-Double Arithmetic & Lanczos Tridiagonalization
For high-order perturbative series () evaluated at , the true residual scales as —ten orders of magnitude below IEEE 754 f64 machine epsilon (). Subtracting energies and series in f64 destroys all significant digits by .
weyl-oracle therefore parameterizes the entire solver over a Real trait supporting both f64 (for low-order probes) and Dd (double-double, an unevaluated pair (hi, lo): (f64, f64) giving ~106 bits of significand, ). Precision::DoubleDouble is applied uniformly across MatVec, Lanczos recurrence, reorthogonalization, inner products, tridiagonal Ritz solves (Jacobi diagonalization), and cross-sector energy subtraction.
Two-Pass Full Reorthogonalization & Ghost Elimination
Standard three-term Lanczos loses orthogonality rapidly in finite precision, spawning spurious duplicate Ritz values ("ghost eigenvalues"). weyl-oracle seeds the Krylov subspace with the unperturbed eigenstate (the exact stabilizer state of in that sector)—so each step captures roughly one order of perturbation theory and a few dozen iterations hit the roundoff floor—and applies two-pass classical Gram–Schmidt (CGS2) full reorthogonalization at every step, reprojecting onto the momentum sector every reproject_every steps:
// crates/weyl-oracle/src/ed.rs — Lanczos loop with two-pass full reorthogonalization
pub struct LanczosOpts {
pub max_iterations: usize, // Default: 200
pub max_vectors: usize, // Memory-bounded Krylov basis cap
pub reproject_every: usize, // Default: reproject momentum every 4 steps
}
// At step m: w = H * v_m, alpha_m = <w, v_m>
for _ in 0..2 {
for b in &basis {
let c = dot(&w, b); // Fixed-CHUNK deterministic inner product
axpy_sub(&mut w, c, b); // w <- w - c * b
}
}Rigorous Ritz Residual Bounds
Let be the lowest Ritz pair of the real symmetric tridiagonal matrix , with Ritz vector . From the Lanczos identity , the residual norm is computed without an extra MatVec:
With spectral gap and spectral spread , combining the standard Krylov bound with the quadratic Temple/Davis–Kahan bound yields the rigorous eigenvalue error estimate:
Convergence triggers when the bound drops to the roundoff floor or . Crucially, Weyl never hardcodes an assumed accuracy or cost for double-double; actual error, residual, gap, and iteration counts are measured per solve and emitted in Eigenvalue<R> and telemetry.
| Precision Mode | Significand | Machine Epsilon | Reliable Verification Orders () | Memory per Vector |
|---|---|---|---|---|
Precision::F64 | 53 bits | (fast low-order probes) | B | |
Precision::DoubleDouble | ~106 bits | (high-order residual slopes) | B |
Finite-Size Scaling & Memory Budget
On a rough–smooth cylinder (), independent stabilizer reduction combined with symmetry sectors and momentum blocking brings an exponentially intractable Hilbert space within single-node RAM (assuming reorthogonalized Lanczos basis vectors):
| Cylinder | Raw Qubits | Raw Vector (f64) | Effective Qubits | Momentum Block | 40-Step Lanczos Basis (Dd) |
|---|---|---|---|---|---|
| 24 | 128 MiB | 8 | |||
| 36 | 512 GiB | 12 | |||
| 48 | 2 PiB | 16 | |||
| 72 | TiB | 24 | |||
| 96 | infeasible | 32 |
When the target order approaches (for instance, with symmetry forcing the first omitted nonzero order to ), an cylinder inevitably mixes in winding linked clusters. The protocol therefore requires enlarging to () or subtracting exact winding terms from an independent finite-size expansion; otherwise it returns Inconclusive.
Ray Sweep & Log-Log Residual Slope Protocol
To validate a Stage B multivariate series truncated at total degree , sweeping at fixed nonzero cannot test the total-degree truncation. weyl-oracle instead sweeps fixed rays through the origin:
using seven default ascending samples . If all terms through degree are exact, the residual vanishes asymptotically as:
where is the first omitted order that does not vanish along the ray.
The protocol enforces four strict gates before issuing a verdict. Because linked clusters wrapping around the cylinder enter at order , comparisons are conclusive only under the finite-size winding guard ; note that alone does not guarantee , since symmetry can force , and whenever the user must increase or subtract exact winding contributions from an independent finite-size expansion. To keep numerical roundoff floors from flattening the fitted slope, only sample points satisfying the signal-to-noise gate enter the log-log fit. Linear regression then starts from an adaptive window of the smallest valid values, dropping larger- points bent by higher orders: a fitted slope yields Pass (permitting when happens to vanish on that ray), whereas yields Fail. Finally, first_bad_order = Some(k) is reported conservatively—only when the fitted slope lies within of an integer and the regression window contains enough points to discriminate; otherwise the oracle returns Inconclusive or leaves the bad order unspecified.
// crates/weyl-oracle/src/protocol.rs — Structured ray-sweep verification record
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RayOutcome {
pub observable: String,
pub ray: Vec<String>, // Rational ray direction (α, β₁, β₂)
pub known_order: u32, // Highest total degree n of the series
pub expected_slope: f64, // Expected first omitted nonzero order r
pub fitted_slope: Option<f64>, // Log-log regression slope over valid window
pub window: Option<(f64, f64)>, // Active [t_min, t_max] regression window
pub residuals: Vec<(f64, f64, f64)>,// Per-point (t, exact - series, num_err)
pub first_bad_order: Option<u32>, // Set only when cleanly discriminable
}Zero-Tolerance Free-Fermion Oracle for Stage A
For Stage A non-interacting boundary models (exact free-fermion mapping), weyl-oracle provides a closed-form analytic oracle:
It compares every hopping amplitude and term-by-term over with zero tolerance across all 14 orders, eliminating any need for small- ED slope fitting on Stage A.
Invoking ED Checks in .weyl and weylc
In surface Weyl code, compare binds the cylinder geometry, precision, rays, and cross-sector observables; the verdict decides whether downstream results may be published:
compare gap_series against ed(
geometry = cylinder(L = 12, W = 2),
precision = double_double,
rays = [(1, 0, 0), (1, 1/2, 0), (1, 1/3, 1/4)],
sectors = { vacuum: (k = 0, W_e_top = +1), exc: (k = pi, W_e_top = -1) },
slope_tol = 0.3,
)Running weylc run executes the full pipeline, including the ED oracle verdicts for every compare assertion, and produces a structured residual trace ready for human audit or MCP telemetry ingestion:
$ weylc run examples/toric_boundary.weyl
[oracle.ed] L=12 W=2 | n_eff=24 | sectors: vac(k=0, W=+1, dim=352), exc(k=pi, W=-1, dim=348)
[oracle.ed] ray=(1, 1/2, 0) | precision=double-double (eps=4.93e-32)
t=0.01000 |exact - series|=1.428e-26 err_bound=3.11e-30 snr=4.59e+03 [used]
t=0.01563 |exact - series|=4.912e-24 err_bound=3.14e-30 snr=1.56e+06 [used]
t=0.02500 |exact - series|=2.194e-21 err_bound=3.19e-30 snr=6.88e+08 [used]
t=0.04000 |exact - series|=1.012e-18 err_bound=3.25e-30 snr=3.11e+11 [used]
[oracle.ed] fitted_slope = 13.04 (expected = 13.0, tol = 0.3) -> PASSTo cross-check the reduced effective Hamiltonian with an external solver (NumPy/SciPy, QuSpin, or XDiag), weylc export-ed emits a self-contained weyl.ed-model JSON payload alongside a standalone solve_ed.py runner.