qector-two-stage-csslisted
Install: claude install-skill GuillaumeLessard/qector-claude-plugin
# QECTOR Two-Stage CSS Decoding
Source of authority: v1.0.0 reference manual, chapter 12.
## The problem with independent X/Z decoders
A CSS code splits stabilizers into X-type and Z-type. Independent X
and Z decoders assume
P(X, Z) = P(X) P(Z)
Depolarising noise violates this: a `Y` error flips both sectors, so
the X and Z syndromes share information. The standard
single-stage correction is a residual logical failure that a
two-stage pass can avoid.
## The feedforward construction (manual 12.1)
```
c_X <- DecodeX(s_X)
s'_Z = s_Z xor H_{Z,X} c_X (mod 2)
c_Z <- DecodeZ(s'_Z)
c = c_X xor c_Z
```
The X correction `c_X` induces a syndrome on the Z sector through
the cross-coupling `H_{Z,X}`; subtracting it before the Z decode
removes the cross-talk. Both stages may use any faithful decoder
(Blossom, Sparse Blossom, Union-Find, BP-OSD).
## Theorem 13 (joint faithfulness, manual 12.1)
> If `DecodeX` and `DecodeZ` are syndrome-faithful on their
> respective inputs, then the combined correction satisfies
> `H c = s` for the joint CSS code.
The proof uses the fact that the full parity-check matrix of the
CSS code applies `H_X` to the X sector and `H_Z` to the Z sector
with the cross-coupling accounted by the update:
H c = (H_X c_X, H_Z (c_X xor c_Z))
= (s_X, H_{Z,X} c_X xor s_Z xor H_{Z,X} c_X)
= (s_X, s_Z) = s
## Worked example (manual 12, appendix E.4)
```
H_X = [[1, 1, 0], [0, 1, 1]]
H_Z = [[0, 1, 1], [1,