  A leading choice of error correction for scalable quantum computing is the
surface code with lattice surgery. The basic lattice surgery operations, the
merging and splitting of logical qubits, act non-unitarily on the logical
states and are not easily captured by standard circuit notation. This raises
the question of how best to design, verify, and optimise protocols that use
lattice surgery, in particular in architectures with complex resource
management issues. In this paper we demonstrate that the operations of the ZX
calculus -- a form of quantum diagrammatic reasoning based on bialgebras --
match exactly the operations of lattice surgery. Red and green "spider" nodes
match rough and smooth merges and splits, and follow the axioms of a dagger
special associative Frobenius algebra. Some lattice surgery operations require
non-trivial correction operations, which are captured natively in the use of
the ZX calculus in the form of ensembles of diagrams. We give a first taste of
the power of the calculus as a language for lattice surgery by considering two
operations (T gates and producing a CNOT ) and show how ZX diagram re-write
rules give lattice surgery procedures for these operations that are novel,
efficient, and highly configurable.
