# Techniques: Engineering CSS surgery: compiling any CNOT in any code

## What the paper contributes (one paragraph)
The paper introduces a framework for implementing logical operations in any CSS quantum error correction code by generalising lattice surgery. Building on Cowtan and Burton's CSS surgery, it reformulates code merges and splits as a quotient of a CSS code by a "subcode", an object that encapsulates the data needed to perform surgery at the physical level. Using homological algebra, it derives a long exact sequence that simultaneously characterises the logical operators of the merged code and the logical operation induced by any merge, with no assumption on the structure or irreducibility of the logical operator basis. As a proof of concept, it compiles a logical CNOT between any two logical qubits of any CSS code with fault-tolerance guarantees, and shows the same formalism designs code-switching protocols (for example between the Reed-Muller and Steane codes).

## Techniques offered
- **CSS surgery (merges and splits via subcodes)** - Reformulates code surgery as a quotient of a CSS code by a subcode, giving a systematic way to design and analyse merge and split protocols that realise arbitrary phase-free ZX (CSS) operations on any CSS code.
  - guarantee: static proof that merges correspond to subcode quotients (every Z-merge equals a quotient Z-merge up to an isomorphic chain map, i.e. an array of CNOTs); no statistical or fault-tolerance bound on its own.
  - quote: "At the physical level, we introduce the concept of subcodes, which encapsulate all the necessary data for performing surgery."
- **Logical compilation via the long exact sequence (logical operator tracking)** - Computes the logical operators of a merged code and the induced logical operation directly from homological algebra, agnostic to whether the logical operators are irreducible, so logic can be compiled without first finding a special basis.
  - guarantee: static proof, an exact-sequence characterisation valid for any logical operator basis; certifies which logical operation a surgery induces.
  - quote: "More precisely, we obtain a \emph{long exact sequence} that simultaneously characterises the logical operators of the merged code and the logical operation induced by the merge."
- **Fault-tolerant logical CNOT compilation in any CSS code** - Compiles a logical CNOT between any pair of logical qubits of an arbitrary CSS code by a chosen sequence of merges and splits, while leaving all other logical qubits untouched.
  - guarantee: fault-tolerance guarantee that pre-existing Pauli errors do not propagate (every Pauli error commutes with the Z-merge/X-split and X-merge/Z-split); full fault-tolerance of the physical implementation is not guaranteed and is left open.
  - quote: "As a proof of concept, we develop a surgery protocol inspired by lattice surgery that implements a logical CNOT gate between any two logical qubits of any CSS code, with fault-tolerance guarantees."
- **Code-switching design via CSS surgery** - Realises code-switching between two CSS codes as an instance of subcode surgery, using the long exact sequence to track the logical operation through the switch.
  - guarantee: static proof that tracks the induced logical operation through the switch (replicating an existing protocol, the switch reduces to the identity); no new fault-tolerance bound.
  - quote: "Our framework can also be used to design code-switching operations between CSS codes as instances of CSS surgery."

## Where it could apply
- Target primitive(s): none (logical gate and code-surgery compilation, not a VQE/QAOA/QPE/sampling/Trotter primitive)
- Target application group(s): error_correction, platforms_tooling
- Code family / hardware assumptions: any CSS code, including qLDPC and surface codes; hardware-agnostic, with physical implementations chosen via ZX-calculus to suit a given device; limited to CSS (phase-free ZX) operations, so it cannot supply Hadamard, S, or T gates.

## Caveats
Full source available; nothing paywalled. The framework supplies fault-tolerance guarantees only in the limited sense that pre-existing Pauli errors do not propagate; it does not guarantee that an arbitrary physical implementation of a surgery protocol is fault-tolerant, and identifying constraints that ensure this is left as an open question. It also cannot express non-CSS operations (Hadamard, S, T).
