v + constant.
0, 1/2, -1/4, pi/2, 3*pi/4, decimals, and variables: a (= aπ), 2a − b, a + pi/4What it is for. A ZX diagram of an error-detecting circuit — checks, ancillas post-selected on their expected outcomes — contains redundancy. Attack mode asks: if a Pauli error hits a wire somewhere, does the diagram notice? And what is the fewest faults an adversary needs to change the result without being noticed?
Right-click any edge (with attack mode on) to inject an X, Z or Y fault — a bit flip, a phase flip, or both. A fault sits on one end of its edge (a quarter of the way from the edge's source), which matters on Hadamard edges, where X and Z swap. Faults are saved with the diagram and undone like any edit; the rewrite engine and the oracle ignore them.
A Pauli web is a way of colouring edges with X, Z or Y that every spider accepts: at a Z spider the Z's must meet in pairs (even parity) and the X's must be on all its legs or none; at an X spider the same with X and Z swapped; a Hadamard edge turns an X into a Z along the way. Each web is a Pauli that the diagram carries from its inputs to its outputs unchanged — a stabiliser, or a logical operator. The panel counts them (webs).
A detecting region is a web that is zero on every input and output: it lives entirely inside the diagram, like a stabiliser measurement repeated twice, or a check post-selected on a known outcome. Hover a region in the panel to see it drawn on the diagram (green Z, red X, dashed Y).
A set of faults fires a region when it anticommutes with it — an odd number of faults that do not commute with the region's Pauli on their edge. A fired region is exactly the check that would report an unexpected outcome: the post-selected diagram becomes the zero map.
distance searches for the smallest number of faulty edges that is undetected and logical — the diagram's distance. It runs in the background, trying 1 fault, then 2, up to 4; search deeper goes further. Two refinements make the numbers meaningful for a code:
place these faults puts the minimal fault set on the diagram so you can see which checks it slips past.
Load examples ▸ Bit-flip code with syndrome checks. Put an X on one data wire between the encoder and the checks: a region fires. Select those three wires, choose X only and press distance: 3 — the code needs three bit flips before it is fooled. Now try the same after the last check: 1.
Attack mode works on diagrams whose spiders all have phase 0 or π. A π phase changes the sign a check reports, which is not tracked yet: detection and distance are exact, but "fires" means "fires up to a sign". Symbolic and non-Clifford phases are not supported.