Skip to content
Condensed Matter Physics · Stabilizer & Quantum Info

Stabilizer Reduction & Wilson Loops

Symplectic Pauli and qudit stabilizer representations, Gram–Schmidt destabilizer transformations, non-contractible Wilson/'t Hooft loops, CSS/fracton codes, and static gauge-invariance diagnostics in Weyl.

Exact commuting-projector Hamiltonians—from the 2D Toric Code and general CSS quantum error-correcting codes to 3D fracton models like X-cube—share an algebraic backbone: every local check operator is a Pauli (or generalized qudit Weyl–Heisenberg) string. Instead of building exponentially large dense matrices, Weyl compiles stabilizer models directly in symplectic vector spaces over F2\mathbb{F}_2 (and Fd\mathbb{F}_d for qudits), reducing both static type verification and finite-size exact diagonalization to bit-level linear algebra.

Symplectic Representation over F2\mathbb{F}_2 and Fd\mathbb{F}_d ​

For NN qubits, every Pauli string P=iϕ⨂q=0N−1XqxqZqzqP = i^\phi \bigotimes_{q=0}^{N-1} X_q^{x_q} Z_q^{z_q} is represented in weyl-canonical by a phase ϕ∈Z4\phi \in \mathbb{Z}_4 and a binary symplectic vector v=(x∣z)∈F22Nv = (x \mid z) \in \mathbb{F}_2^{2N}. Multiplication merges sparse sorted u32 site words (site << 2) | code in O(∣S1∣+∣S2∣)O(|S_1| + |S_2|) time, and commutation reduces to the symplectic inner product:

P1P2=(−1)ω(v1,v2)P2P1,ω(v1,v2)=x1⋅z2+z1⋅x2(mod2).P_1 P_2 = (-1)^{\omega(v_1, v_2)} P_2 P_1, \qquad \omega(v_1, v_2) = x_1 \cdot z_2 + z_1 \cdot x_2 \pmod 2.

For dd-level qudits (Qudit<d>, prime or prime-power dd), generalized Pauli operators X∣j⟩=∣j+1 mod d⟩X |j\rangle = |j + 1 \bmod d\rangle and Z∣j⟩=ζdj∣j⟩Z |j\rangle = \zeta_d^j |j\rangle (ζd=e2πi/d\zeta_d = e^{2\pi i / d}) satisfy ZX=ζdXZZ X = \zeta_d X Z. Strings map to vectors v=(x∣z)∈Fd2Nv = (x \mid z) \in \mathbb{F}_d^{2N} with commutation factor

P1P2=ζd ωd(v1,v2)P2P1,ωd(v1,v2)=x1⋅z2−z1⋅x2(modd).P_1 P_2 = \zeta_d^{\,\omega_d(v_1, v_2)} P_2 P_1, \qquad \omega_d(v_1, v_2) = x_1 \cdot z_2 - z_1 \cdot x_2 \pmod d.

A stabilizer group S=⟨S1,…,Sm⟩\mathcal{S} = \langle S_1, \dots, S_m \rangle is an isotropic subspace (ω(Si,Sj)=0\omega(S_i, S_j) = 0 for all i,ji, j) that excludes −I-I. For a CSS code with separate XX-type and ZZ-type parity-check matrices HX∈F2mX×NH_X \in \mathbb{F}_2^{m_X \times N} and HZ∈F2mZ×NH_Z \in \mathbb{F}_2^{m_Z \times N}, mutual commutation is the matrix orthogonality condition

HXHZT=0(mod2),k=N−rank⁡(HX)−rank⁡(HZ),H_X H_Z^T = 0 \pmod 2, \qquad k = N - \operatorname{rank}(H_X) - \operatorname{rank}(H_Z),

where kk is the number of encoded logical qubits (ground-state degeneracy GSD=2k\mathrm{GSD} = 2^k).

Stabilizer Coordinate Transformations (weyl-topo + weyl-canonical) ​

When compiling an unperturbed stabilizer Hamiltonian H0=−∑αJαSαH_0 = -\sum_\alpha J_\alpha S_\alpha, some checks may satisfy global product relations (e.g. ∏vAv=1\prod_v A_v = 1 on a torus). weyl-topo extracts a maximal independent stabilizer subset {S1,…,Sr}\{S_1, \dots, S_r\}, records all dependent product relations, and runs symplectic Gram–Schmidt to complete a canonical Clifford basis consisting of destabilizers {D1,…,Dr}\{D_1, \dots, D_r\} satisfying Dj2=1D_j^2 = 1, [Di,Dj]=0[D_i, D_j] = 0, and DiSj=(−1)δijSjDiD_i S_j = (-1)^{\delta_{ij}} S_j D_i, together with logical symplectic pairs {(Xˉ1,Zˉ1),…,(Xˉk,Zˉk)}\{(\bar{X}_1, \bar{Z}_1), \dots, (\bar{X}_k, \bar{Z}_k)\} that commute with all Sj,DjS_j, D_j and obey XˉrZˉr′=(−1)δrr′Zˉr′Xˉr\bar{X}_r \bar{Z}_{r'} = (-1)^{\delta_{rr'}} \bar{Z}_{r'} \bar{X}_r.

Fixing a canonical product ordering uniquely decomposes any Pauli operator PP and gives its bit-level action on syndrome-logical basis states ∣s,ℓ⟩|s, \ell\rangle (s∈F2rs \in \mathbb{F}_2^r, ℓ∈F2k\ell \in \mathbb{F}_2^k):

P=iϕ∏j=1rDjaj∏j=1rSjbj∏r=1kXˉrurZˉrvr,P∣s,ℓ⟩=iϕ(−1)b⋅s+v⋅ℓ∣s⊕a, ℓ⊕u⟩.P = i^\phi \prod_{j=1}^r D_j^{a_j} \prod_{j=1}^r S_j^{b_j} \prod_{r=1}^k \bar{X}_r^{u_r} \bar{Z}_r^{v_r}, \qquad P |s, \ell\rangle = i^\phi (-1)^{b \cdot s + v \cdot \ell} |s \oplus a,\, \ell \oplus u\rangle.

Why SIR Never Expands 2r2^r Projectors ​

A naive perturbative lowering of a Pauli perturbation PP into TnT_n operators would expand 2r2^r syndrome projectors onto fixed ΔQ=n\Delta Q = n sectors. Instead, Weyl's SIR stores only the flip mask (a,u)(a, u) and phase mask (b,v,ϕ)(b, v, \phi); KIR evaluates the exact energy jump dynamically on each active syndrome state ∣s,ℓ⟩|s, \ell\rangle:

n=Q(s⊕a, ℓ⊕u)−Q(s,ℓ).n = Q(s \oplus a,\, \ell \oplus u) - Q(s, \ell).

When all H0H_0 terms are independent with weights wjw_j, this simplifies to n=∑j:aj=1(1−2sj)wjn = \sum_{j : a_j = 1} (1 - 2 s_j) w_j; when product relations exist (like ∏iPi=Webot\prod_i P_i = W_e^{\mathrm{bot}}), KIR evaluates QQ from the full H0H_0 energy table.

In weyl-canonical and weyl-topo, the compiled operator action is stored in compact bit-packed Rust structs:

rust
/// Canonical sparse Pauli word: each u32 packs `(site << 2) | pauli_code` (X=1, Y=2, Z=3)
pub struct PauliWord {
    pub phase: u8,         // i^phase, phase in {0, 1, 2, 3}
    pub ops: Vec<u32>,     // strictly ascending by site; big-endian memcmp = lex order
}

/// Stabilizer-basis action on syndrome-logical states |s, l>
pub struct StabilizerAction {
    pub flip_syndrome: BitVec,   // a: bitmask of destabilizers D_j flipped
    pub phase_syndrome: BitVec,  // b: bitmask of stabilizers S_j contributing (-1)^{b·s}
    pub flip_logical: u64,       // u: logical X_r mask
    pub phase_logical: u64,      // v: logical Z_r mask
    pub phase: u8,               // overall i^phi
}

Logical Operators as Wilson & 't Hooft Loops ​

The centralizer C(S)/SC(\mathcal{S}) / \mathcal{S} of the stabilizer group is generated by non-contractible Wilson loops (ZZ-strings carrying electric flux) and 't Hooft loops (XX-strings carrying magnetic flux). Their algebra encodes the topology of Λ\Lambda:

Geometry Λ\LambdaBoundary TypesIndependent Logical Pairs kkNon-Contractible Loop Generators
Torus T2T^2Periodic ×\times Periodic22 (GSD=4\mathrm{GSD} = 4)We(x),Wm(y)W_e^{(x)}, W_m^{(y)} and We(y),Wm(x)W_e^{(y)}, W_m^{(x)}
Cylinder S1×IS^1 \times IRough (ee) – Rough (ee)11 (GSD=2\mathrm{GSD} = 2)Horizontal WmW_m, vertical open ee-string
Cylinder S1×IS^1 \times ISmooth (mm) – Smooth (mm)11 (GSD=2\mathrm{GSD} = 2)Horizontal WeW_e, vertical open mm-string
Cylinder S1×IS^1 \times IRough (ee) – Smooth (mm)00 (GSD=1\mathrm{GSD} = 1)None (unique vacuum; WetopW_e^{\mathrm{top}} labels parity)

Cross-Sector One-Particle States on the Rough–Smooth Cylinder ​

On the rough–smooth cylinder of examples/toric_boundary.weyl (N=(2W+2)LN = (2W + 2)L qubits), define the bottom and top horizontal electric Wilson loops:

Webot=∏i=0L−1σhi,0z,Wetop=∏i=0L−1σhi,Wz.W_e^{\mathrm{bot}} = \prod_{i=0}^{L-1} \sigma^z_{h_{i,0}}, \qquad W_e^{\mathrm{top}} = \prod_{i=0}^{L-1} \sigma^z_{h_{i,W}}.

Two exact operator identities hold on the lattice:

∏i=0L−1Pi=Webot,∏p∈bulkBp=WebotWetop.\prod_{i=0}^{L-1} P_i = W_e^{\mathrm{bot}}, \qquad \prod_{p \in \mathrm{bulk}} B_p = W_e^{\mathrm{bot}} W_e^{\mathrm{top}}.

In the conserved bulk sector where every Bp=+1B_p = +1, the boundary mm-anyon parity (−1)Nm=∏iPi(-1)^{N_m} = \prod_i P_i is locked to the top Wilson loop: (−1)Nm=Wetop(-1)^{N_m} = W_e^{\mathrm{top}}. Consequently, the vacuum (Nm=0N_m = 0) lies in Wetop=+1W_e^{\mathrm{top}} = +1, while the single boundary mm-particle state (Nm=1N_m = 1) lies in Wetop=−1W_e^{\mathrm{top}} = -1. The one-particle dispersion must therefore be extracted across Wilson sectors:

ωL(k)=Emin⁡ ⁣(k, Wetop=−1)−Emin⁡ ⁣(0, Wetop=+1).\omega_L(k) = E_{\min}\!\big(k,\, W_e^{\mathrm{top}} = -1\big) - E_{\min}\!\big(0,\, W_e^{\mathrm{top}} = +1\big).

Common Pitfall: Same-Sector Excitations

Taking the first excited state within the Wetop=+1W_e^{\mathrm{top}} = +1 sector yields a two-particle continuum state (Nm=2N_m = 2), not the single-particle gap Δ=ω(0)\Delta = \omega(0). Weyl's compare clause explicitly binds both sectors so the ED oracle never conflates them.

CSS Codes & 3D Fracton Stabilizer Models (X-Cube) Draft ​

Weyl's template-based symplectic engine generalizes seamlessly beyond 2D surface codes to 3D type-I fracton CSS models such as the X-cube model on a 3D cubic lattice Λ3\Lambda_3:

weyl
model  X-cube fracton stabilizer code on a 3-torus

given  Λ : cubic lattice on a 3-torus (Lx, Ly, Lz)
given  σ : qubit on edges(Λ)

define A_c    ≔ ∏_{l ∈ cube(c)} σˣ_l            for c ∈ cubes(Λ)
define B_v^xy ≔ ∏_{l ∋ v, l ⊥ z} σᶻ_l           for v ∈ vertices(Λ)
define B_v^yz ≔ ∏_{l ∋ v, l ⊥ x} σᶻ_l           for v ∈ vertices(Λ)
define B_v^zx ≔ ∏_{l ∋ v, l ⊥ y} σᶻ_l           for v ∈ vertices(Λ)

define H_xcube ≔ − Σ_c A_c − Σ_v (B_v^xy + B_v^yz + B_v^zx)

claim  H_xcube : Hermitian, local
claim  [A_c, B_v^xy] = 0  and  [B_v^xy, B_v^yz] = 0
claim  B_v^xy · B_v^yz · B_v^zx = 1

Because every cube AcA_c shares either 00 or 22 edges with each planar cross BvμνB_v^{\mu\nu}, T-Comm proves mutual commutation in O(R3)O(R^3) time independent of (Lx,Ly,Lz)(L_x, L_y, L_z). The planar product relations ∏c∈planeAc=1\prod_{c \in \text{plane}} A_c = 1 give sub-extensive topological degeneracy log⁡2GSD=2Lx+2Ly+2Lz−3\log_2 \mathrm{GSD} = 2 L_x + 2 L_y + 2 L_z - 3, while syndrome analysis immediately shows that a single σlz\sigma^z_l flips four adjacent cubes (creating immobile fractons at membrane corners) whereas σlx\sigma^x_l flips two crosses along an axis (creating 1D lineons).

Static Commutation, Gauge Invariance & weylc Diagnostics ​

Every operator expression synthesizes an internal 5-tuple type Op<Space, Charge, Herm, Grade, Support> (weyl-types). For the rough–smooth Toric Code benchmark, the type checker synthesizes exact symplectic charges on unit-cell representatives without instantiating LL:

Operator TemplateSymplectic OverlapSynthesized ChargeEffect on Cons(H)\mathrm{Cons}(H)
Pi=σdizσhizσdi+1zP_i = \sigma^z_{d_i}\sigma^z_{h_i}\sigma^z_{d_{i+1}}Even overlap (ω=0\omega = 0) with all Av,BpA_v, B_p11 (vacuum)Retained in H0H_0
σdix\sigma^x_{d_i} (xx term)ω=1\omega = 1 with Pi−1,PiP_{i-1}, P_im[ci−1]⊕m[ci]m[c_{i-1}] \oplus m[c_i] (net 11)Breaks PiP_i; preserves all Av,BpA_v, B_p
σhiz\sigma^z_{h_i} (κ2\kappa_2 term)ω=1\omega = 1 with Ai,0,Ai+1,0A_{i,0}, A_{i+1,0}e[vi,0]⊕e[vi+1,0]e[v_{i,0}] \oplus e[v_{i+1,0}] (net 11)Removes y=0y = 0 stars from Cons(H)\mathrm{Cons}(H)
σdiz\sigma^z_{d_i} (κ1\kappa_1 term)ω=1\omega = 1 with Ai,0A_{i,0} onlye[vi,0]e[v_{i,0}] (absorbed by rough ∂Λ\partial \Lambda)Removes y=0y = 0 stars; anticommutes with σdix\sigma^x_{d_i}

For any Hamiltonian HH, the type checker computes the maximal conserved stabilizer set Cons(H)={Sα∣[Sα,h]=0  ∀h∈H}\mathrm{Cons}(H) = \{S_\alpha \mid [S_\alpha, h] = 0 \;\forall h \in H\} and checks locality (support diameter ≤Rmax⁡\le R_{\max}), Hermiticity, and explicit conservation claims (H conserves C).

When a perturbation violates locality, Hermiticity, or gauge invariance, weylc check reports exact symplectic witnesses before any numerical solver runs:

bash
error[E0301]: `H` is claimed Hermitian but is not
  --> toric_boundary.weyl:17:22
   |  define V ≔ − x Σ_i σˣ_{d_i} σᶻ_{d_i} − κ₁ Σ_i σᶻ_{d_i} − κ₂ Σ_i σᶻ_{h_i}
   |  σˣ_{d_i} and σᶻ_{d_i} anticommute (ε = −1), so their product is anti-Hermitian (T-Mul)
   = help: use σʸ_{d_i}, or multiply by i

error[E0320]: term violates declared gauge symmetry `A_v`
  --> bad_gauge.weyl:14:18
   |  define V ≔ − h Σ_{l ∈ bulk} σᶻ_l
   |  σᶻ_l anticommutes with bulk stars A_{v₁}, A_{v₂} (ω = 1 on edge l),
   |  violating `claim H conserves A_v for v ∈ bulk`
   = help: dress σᶻ_l with matter charges, or restrict the sum to boundary dangling edges d_i

error[E0201]: operator support exceeds locality bound or crosses open boundary
  --> bad_local.weyl:11:25
   |  define W ≔ ∏_{i=0}^{L-1} σᶻ_{h_{i,0}}
   |  support diameter grows with symbolic size L (exceeds R_max = 4 unit cells)
   = help: global Wilson loops cannot enter local `H`; bind W as a sector observable instead

Cylinder Reduction & External ED Export ​

For the L=12,W=2L = 12, W = 2 rough–smooth cylinder (N=72N = 72 qubits, where a single dense f64 state vector would require 272×8 B≈3.8×1013 GiB2^{72} \times 8\text{ B} \approx 3.8 \times 10^{13}\text{ GiB}), weyl-oracle independently constructs a Clifford stabilizer basis, fixes the 4848 conserved deep stars and bulk plaquettes BpB_p, and blocks the remaining 2424 effective qubits by lattice translation momentum kk and Wetop=±1W_e^{\mathrm{top}} = \pm 1.

To audit the reduced Hamiltonian externally with NumPy/SciPy, weylc export-ed emits a self-contained JSON specification and standalone solver script:

bash
$ weylc export-ed examples/toric_boundary.weyl \
    --size-l 8 --height-w 2 \
    --at J=1,x=1/10,κ₁=1/20,κ₂=-1/20 \
    --out ./ed_out
wrote ./ed_out/ed_model.json   (N=48 qubits -> 16 active qubits after 32 conserved stabilizers)
wrote ./ed_out/solve_ed.py     (sectors: k=0 W_e^top=+1, k=0 W_e^top=-1)

The exported ed_model.json records the reduced active-qubit Hamiltonian terms, exact E_bulk constant, and Wilson-sector projector masks so external Lanczos runs reproduce weyl-oracle to full double-double or f64 precision:

json
{
  "schema": "weyl.ed-model",
  "geometry": { "L": 8, "W": 2, "total_qubits": 48, "active_qubits": 16 },
  "fixed_stabilizers": 32,
  "e_bulk": -40.0,
  "couplings": { "J": 1, "x": "1/10", "kappa_1": "1/20", "kappa_2": "-1/20" },
  "sectors": [
    { "name": "vacuum", "momentum_k": 0, "wilson_top": 1 },
    { "name": "one_particle", "momentum_k": 0, "wilson_top": -1 }
  ],
  "terms": [
    { "coeff": "-1", "pauli": "Z0 Z1", "label": "P_0" },
    { "coeff": "-1/10", "pauli": "X0", "label": "x*X(d_0)" }
  ]
}

Symplectic Gram–Schmidt Independence

To prevent shared bugs between weyl-series and weyl-oracle, weyl-oracle builds its Clifford basis independently from the HIR microscopic Hamiltonian: it selects pivots among {Sj}\{S_j\}, finds a single-qubit or minimal-weight anticommuting partner DjD_j, clears overlaps with all previously fixed pairs via Dk←DkSjω(Dk,Dj)Djω(Dk,Sj)D_k \leftarrow D_k S_j^{\omega(D_k, D_j)} D_j^{\omega(D_k, S_j)}, and extracts the remaining 2k2k-dimensional symplectic complement as (Xˉr,Zˉr)(\bar{X}_r, \bar{Z}_r).

Weyl v0.1 · MIT License