# ZH-calculus **ZH-calculus** extends [[zx-calculus]] with a third generator, the H-box, which represents a Hadamard-like node whose entries can be arbitrary complex numbers rather than just $\pm 1$. This lets ZH-calculus directly express non-linear boolean functions (AND, Toffoli-style multi-controlled gates) as a single diagram element, something ZX-calculus can only build out of several spiders. An H-box with all-1 entries except a single $-1$ recovers the ordinary Hadamard gate, but more general H-boxes can represent an AND gate on any number of inputs in one node. This is useful because many practical circuits, especially arithmetic and oracle circuits used in Grover-style algorithms, are built almost entirely out of multi-controlled gates. ``` H-box (n-input AND-like node): | | | \ | / [H] --- arbitrary tensor entries | ``` ## Rewrite rules ZH-calculus keeps ZX-calculus's spider fusion rules and adds H-box-specific rules: two H-boxes connected in sequence multiply their tensors together, and an H-box with a single leg of value 1 is the identity. Like ZX-calculus, ZH-calculus is complete for all of quantum mechanics, not just the Clifford fragment, once general H-boxes are allowed. ## Where it's used ZH-calculus is the natural graphical language for reasoning about Toffoli-based circuits and other multi-controlled gate constructions common in arithmetic circuits and Grover's algorithm oracles. It's typically used alongside [[zx-calculus]] and [[zw-calculus]], with a given diagram translated into whichever of the three calculi makes the structure being studied easiest to manipulate.