Lattice Surgery

A surface-code logical qubit is a square patch of physical qubits stabilized by weight-four XX-type star checks and ZZ-type plaquette checks, with two logical operators Xˉ\bar X and Zˉ\bar Z carried as strings of Paulis that span the patch between opposite edges. Those edges come in two flavours — smooth, where Zˉ\bar Z-strings terminate, and rough, where Xˉ\bar X-strings terminate — and the entire logic of surface-code computation turns out to hang on that distinction. Lattice surgery is the discovery that you can compute simply by editing the stabilizer group at the boundary: bring two patches edge to edge, switch on a row of new checks that bridge the seam, and the two codes fuse into one; stop measuring those checks, and the fused code splits back into two. The move that makes this powerful is that a merge is not passive gluing. When two patches meet along boundaries of the same type, the new seam checks are individually independent, but their product equals a joint logical operator Pˉ1Pˉ2\bar P_1\bar P_2 of the two patches. Turning them on and reading their syndromes therefore performs a genuine fault-tolerant measurement of Pˉ1Pˉ2\bar P_1\bar P_2, whose ±1\pm1 outcome is nothing but the product of the fresh seam syndrome bits. A parity measurement of two logical operators is exactly the primitive that measurement-based circuit identities need to synthesize a CNOT, so all of Clifford computation collapses into a choreography of gluing and ungluing tiles, tracked in a classical Pauli frame and completed by injected magic states for the non-Clifford TT gate. Because the patches tile a plane edge to edge instead of threading defects through a thicker three-dimensional spacetime, lattice surgery roughly halves the qubit overhead of braiding while preserving the same code distance and threshold — which is why it is the native logic of essentially every planar surface-code architecture built today.

Key takeaways
  • Lattice surgery does logic on surface-code patches by merging their boundaries (switching on new seam checks) and later splitting them (switching those checks off), never by transversal gates or braiding.
  • A merge along boundaries of the same type measures a joint logical Pauli: smooth boundaries give Zˉ1Zˉ2\bar Z_1\bar Z_2, rough boundaries give Xˉ1Xˉ2\bar X_1\bar X_2, because the product of the seam checks equals that joint operator, ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2.
  • The measurement outcome is the product of the freshly measured seam syndrome bits, m=∏pmp=±1m=\prod_p m_p=\pm1, and it is recorded in the software Pauli frame, never physically applied.
  • A merge then a split realizes a joint logical measurement up to a deterministic Pauli byproduct; two merges plus one ancilla patch build a fault-tolerant CNOT, and with injected magic states this closes a universal Clifford+TT set in strictly 2D nearest-neighbour hardware.
  • Distance is preserved only at the fault-tolerant operating point — seam width w≥dw\ge d and Nrounds∼dN_{\text{rounds}}\sim d rounds of syndrome extraction — giving deff=min⁡(w,Nrounds,d)=dd_{\text{eff}}=\min(w,N_{\text{rounds}},d)=d and pL∼(p/pth)⌊d/2⌋+1p_L\sim(p/p_{\text{th}})^{\lfloor d/2\rfloor+1}.
  • Key idea: merging two surface-code patches along a shared boundary turns on new stabilizers whose product equals a joint logical operator Pˉ1Pˉ2\bar P_1\bar P_2, so the merge measures that operator fault-tolerantly and the split restores two patches up to a recorded Pauli byproduct — converting every logical Clifford gate into a sequence of two-patch parity measurements.
The core insight

Merging two surface-code patches along a shared boundary turns on new stabilizers whose product equals a joint logical operator Pˉ1Pˉ2\bar P_1\bar P_2; the merge thus measures that operator fault-tolerantly, and the subsequent split restores two patches up to a recorded Pauli byproduct — converting all logical Clifford gates into sequences of two-patch parity measurements.

Where this lives today

Lattice surgery has moved from proposal to the default operating model of fault-tolerant hardware. On the theory-and-compilation side, Litinski's Pauli-based-computation framing has become the common language of surface-code resource estimation: an algorithm is compiled into a stream of multi-qubit Pauli-product measurements, each realized by a multi-patch merge–split, and open-source lattice-surgery schedulers optimize the resulting spacetime layout as a tiling problem, feeding magic states from distillation factories into ZˉZˉ\bar Z\bar Z merges to supply the non-Clifford TT gates. On the hardware side, the ingredients surgery is built from — repeated stabilizer rounds and boundary manipulation — are now demonstrated below threshold: Google's Willow processor showed in 2024 that a surface-code logical qubit's error falls as the distance grows from 33 to 55 to 77, the scaling surgery relies on, and superconducting and trapped-ion groups have begun running merge–split operations and logical two-qubit gates directly. Neutral-atom platforms, with their movable qubits and long-range reconfigurability, are a particularly natural home: they can shuttle patches into adjacency and perform merges without a fixed 2D wiring constraint, and 2024 logical-processor demonstrations executed transversal and lattice-surgery-style operations on dozens of logical qubits. Across every roadmap, the same accounting recurs — logical qubits are patches, gates are merges, and the dominant cost is the magic-state factories that keep the surgery fed — which is exactly the architecture Horsman and colleagues sketched in 2012.

The physical picture

Picture each logical qubit as a square tile. Two opposite edges are smooth — the places where a Zˉ\bar Z-string is allowed to end — and the other two are rough, where a Xˉ\bar X-string ends. Set two tiles side by side and they are two independent logical qubits: their stabilizer groups do not talk to each other, and Xˉ1,Zˉ1,Xˉ2,Zˉ2\bar X_1,\bar Z_1,\bar X_2,\bar Z_2 are four separate logical operators. Now glue the touching edges by switching on a fresh row of parity checks that straddle the seam. Those checks are ordinary weight-four plaquettes — the same kind the hardware already measures for memory — but their collective product is not ordinary at all: it equals the joint logical operator of the two tiles. Reading the seam is therefore reading a logical parity, and that is the whole trick. The first figure shows the two tiles, the seam, and the identity ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2 that makes a merge a measurement.

Figure
Two surface-code patches merged along their facing smooth boundaries: the new seam checks Mₚ (green) are weight-four Z plaquettes bridging the gap, and their product telescopes to the joint logical Z̄₁Z̄₂, so the merge measures joint ZZ parity with outcome m = ∏ₚ mₚ = ±1
A merge measures a logical parity: ∏ₚ Mₚ = Z̄₁ Z̄₂ rough (X̄ ends) rough (X̄ ends) patch 1 patch 2 Z̄₁ Z̄₂ seam checks Mₚ (Z-type) merge → ← split smooth edges (Z̄ ends) face across the seam; width w ≥ d

Why is the merge measurement fault-tolerant, and why does it leave half the information untouched? Because the seam is itself a strip of code. The product ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2 is a ZZ-type object, so it commutes with the conjugate joint operator Xˉ1Xˉ2\bar X_1\bar X_2: the information stored in the XXXX basis sails through the merge unmeasured, exactly as a non-destructive measurement of ZZZZ must leave it. Meanwhile the individual Xˉ1\bar X_1 and Xˉ2\bar X_2 each anticommute with some seam check and so cease to be independent logical operators — the merged tile is a single logical qubit with Zˉ=Zˉ1(≡Zˉ2)\bar Z=\bar Z_1(\equiv\bar Z_2) and Xˉ=Xˉ1Xˉ2\bar X=\bar X_1\bar X_2. And the whole thing inherits the code's threshold: no error string of weight below the seam width ww can cross from one patch's logical operator to the other, and no run of measurement faults shorter than ∼d\sim d rounds can fake the joint outcome. The second figure shows how these merges compose into the workhorse gate — a logical CNOT — and quotes the logical error a single merge costs at distance d=11d=11.

Figure
A logical CNOT by lattice surgery: an ancilla patch in the plus state is joined to the control by a smooth merge measuring Z̄_c Z̄_a, then to the target by a rough merge measuring X̄_a X̄_t, then read out in X̄_a — at distance d = 11 each merge fails with probability p_L ~ (p/p_th) to the sixth power = 10⁻⁶ for p = 10⁻³, p_th = 10⁻²
CNOT = two merges + one ancilla, time flowing downward control c ancilla a |+⟩ target t smooth merge: measure Z̄_c Z̄_a rough merge: measure X̄_a X̄_t measure X̄_a (disentangle) → CNOT_{c→t} up to Pauli frame at d = 11: ⌊d/2⌋+1 = 6 p_L ~ (10⁻³/10⁻²)⁶ = (0.1)⁶ = 10⁻⁶ per merge; N_rounds ≈ d = 11

The core equations

A surface-code patch is defined by its stabilizer group: two commuting families of local parity checks whose common +1+1 eigenspace is the code space. The XX-type checks live on vertices (stars) and the ZZ-type on plaquettes; every physical qubit is touched by both kinds, and the checks all mutually commute because any star and plaquette overlap on an even number of qubits.

S=⟨ {Av=∏j∈vXj}, {Bp=∏j∈pZj} ⟩(1)\mathcal{S}=\big\langle\, \{A_v=\textstyle\prod_{j\in v}X_j\},\ \{B_p=\textstyle\prod_{j\in p}Z_j\}\,\big\rangle \qquad (1)

where: AvA_v — XX-type star check, weight 4 in the bulk and weight 3 at a boundary; BpB_p — ZZ-type plaquette check, weight 4 in the bulk, weight 3 at a boundary; Xj,ZjX_j,Z_j — Pauli operators on physical qubit jj; v,pv,p — the vertices and plaquettes of the lattice. Reading: the code is fixed entirely by which local parities are pinned to +1+1; computation will amount to changing that list at the boundary. The single encoded qubit is carried by two logical operators, each a string of single-qubit Paulis that crosses the patch between a matching pair of boundaries. A Xˉ\bar X-string runs rough-to-rough; a Zˉ\bar Z-string runs smooth-to-smooth. They anticommute, which is what certifies that the patch stores exactly one qubit rather than zero or two.

Xˉ=∏j∈γXXj,Zˉ=∏j∈γZZj,XˉZˉ=−ZˉXˉ(2)\bar X=\prod_{j\in\gamma_X}X_j,\qquad \bar Z=\prod_{j\in\gamma_Z}Z_j,\qquad \bar X\bar Z=-\bar Z\bar X \qquad (2)

where: γX\gamma_X — a path of qubits joining the two rough boundaries; γZ\gamma_Z — a path joining the two smooth boundaries; the two paths cross on an odd number of qubits. Reading: logical information lives in non-local strings, so no local disturbance of weight below dd can read or corrupt it — the origin of the code's protection and of surgery's fault tolerance. To merge two patches, adjoin their stabilizer groups and add a new set of seam checks MpM_p that straddle the gap between the facing boundaries. For a smooth merge the seam checks are ZZ-type; for a rough merge they are XX-type. The enlarged group defines one bigger code on the union of the two patches plus the seam.

Smerge=⟨ S1, S2, {Mp}p∈seam ⟩(3)\mathcal{S}_{\text{merge}}=\big\langle\, \mathcal{S}_1,\ \mathcal{S}_2,\ \{M_p\}_{p\in\text{seam}}\,\big\rangle \qquad (3)

where: S1,S2\mathcal{S}_1,\mathcal{S}_2 — the stabilizer groups of the two original patches; MpM_p — the new weight-four seam checks (Z-type for a smooth merge) bridging one boundary qubit of patch 1 to the adjacent boundary qubit of patch 2. Reading: the merge is a purely local edit — a handful of new commuting checks — yet it changes the logical content globally, because their product is not local. That is the crucial identity. Telescoping the seam checks along the seam makes the interior gap qubits cancel in pairs, and the two surviving boundary rows are each a deformation of a logical Zˉ\bar Z. The product of every seam check therefore equals the joint logical ZZZZ.

∏p∈seamMp  =  Zˉ1 Zˉ2,m=∏p∈seammp∈{+1,−1},⟨Zˉ1Zˉ2⟩=m(4)\prod_{p\in\text{seam}} M_p \;=\; \bar Z_1\,\bar Z_2,\qquad m=\prod_{p\in\text{seam}} m_p\in\{+1,-1\},\qquad \langle \bar Z_1\bar Z_2\rangle=m \qquad (4)

where: mpm_p — the measured ±1\pm1 eigenvalue of seam check MpM_p; mm — the inferred joint-parity outcome. Reading: because Zˉ1Zˉ2\bar Z_1\bar Z_2 is literally a product of measured stabilizers, its eigenvalue is determined, not disturbed — the merge is a measurement, and its result is the product of the fresh syndrome bits, a random ±1\pm1 that must be fed into the Pauli frame. Splitting reverses the merge: stop measuring the seam checks and measure out the seam qubits in the single-qubit basis conjugate to the seam checks. Time-reversal of the stabilizer dynamics returns two clean patches, with the only residue a deterministic Pauli byproduct fixed by the seam-qubit outcomes.

split:Smerge→S1⊗S2,byproduct=Xˉ s,s=∏j∈cutxj(5)\text{split:}\quad \mathcal{S}_{\text{merge}}\to\mathcal{S}_1\otimes\mathcal{S}_2,\qquad \text{byproduct}=\bar X^{\,s},\quad s=\prod_{j\in\text{cut}} x_j \qquad (5)

where: xjx_j — the ±1\pm1 single-qubit XX-basis outcome on a seam qubit measured out during the split; s∈{0,1}s\in\{0,1\} — the byproduct exponent. Reading: the byproduct is known exactly from the measurement record and is recorded in software; nothing is physically applied to the qubits, which is why surgery adds no extra gate error. Provided the operation runs at its fault-tolerant operating point, a merge costs no distance: the logical error per surgery scales with the same exponent as static memory.

pL  ∼  A(ppth)⌊d/2⌋+1,deff=min⁡(w, Nrounds, d)(6)p_L\;\sim\;A\left(\frac{p}{p_{\text{th}}}\right)^{\lfloor d/2\rfloor+1},\qquad d_{\text{eff}}=\min(w,\,N_{\text{rounds}},\,d) \qquad (6)

where: pp — physical error rate per gate or measurement; pth≈1%p_{\text{th}}\approx1\% — the circuit-level surface-code threshold; dd — code distance; ww — seam width; NroundsN_{\text{rounds}} — number of repeated joint-measurement rounds; AA — an O(1)O(1) prefactor counting fault paths. Reading: choosing w≥dw\ge d and Nrounds∼dN_{\text{rounds}}\sim d pins deff=dd_{\text{eff}}=d, so surgery buys a logical gate at the price of O(d)O(d) rounds and no asymptotic loss of protection. Two merges and one ancilla assemble the fundamental entangling gate. An ancilla patch prepared in ∣+⟩L|+\rangle_L is joined to the control by a smooth (ZZZZ) merge–split and to the target by a rough (XXXX) merge–split, then read out; the gate-teleportation identity turns the three parity outcomes into a CNOT up to recorded Paulis.

CNOTc→t ≡ MZˉcZˉa ; MXˉaXˉt ; MXˉa ;  Xt aZc b(7)\mathrm{CNOT}_{c\to t}\ \equiv\ M_{\bar Z_c\bar Z_a}\,;\ M_{\bar X_a\bar X_t}\,;\ M_{\bar X_a}\,;\ \ X_t^{\,a}Z_c^{\,b} \qquad (7)

where: aa — ancilla patch in ∣+⟩L|+\rangle_L (Xˉa=+1\bar X_a=+1); MZˉcZˉaM_{\bar Z_c\bar Z_a} — smooth merge–split measuring the control–ancilla parity; MXˉaXˉtM_{\bar X_a\bar X_t} — rough merge–split measuring the ancilla–target parity; MXˉaM_{\bar X_a} — destructive Xˉ\bar X readout of the ancilla; Xt aZc bX_t^{\,a}Z_c^{\,b} — Pauli byproduct with exponents a,ba,b linear in the outcomes. Reading: every ingredient is a boundary edit or a single-patch readout, so a fault-tolerant CNOT needs nothing beyond the two-body parity checks the hardware already runs.

Derivation AThe smooth merge measures the joint ZZ parity

The goal is to show, operator by operator, that switching on the seam ZZ-checks projects the two-patch state onto a definite eigenspace of Zˉ1Zˉ2\bar Z_1\bar Z_2 whose eigenvalue is the product of the measured seam syndromes, while leaving the conjugate XXXX information completely untouched — the defining property of a non-destructive joint measurement. We track exactly which operators enter and leave the stabilizer and logical groups, establish the telescoping identity that makes the product of local checks equal a global logical operator, and count the logical degrees of freedom before and after so that "one measurement removes one qubit" becomes explicit.

Step 1. Before the merge the two patches are independent: the logical group is generated by Xˉ1,Zˉ1,Xˉ2,Zˉ2\bar X_1,\bar Z_1,\bar X_2,\bar Z_2 with XˉiZˉi=−ZˉiXˉi\bar X_i\bar Z_i=-\bar Z_i\bar X_i and operators on different patches commuting, so the pair encodes two logical qubits. Why: this is the clean starting inventory against which every later change is measured — two qubits, four logical operators.

Step 2. Adjoin the seam ZZ-checks, S→⟨S1,S2,{Mp}⟩\mathcal{S}\to\langle\mathcal{S}_1,\mathcal{S}_2,\{M_p\}\rangle. Each MpM_p commutes with every original stabilizer of both patches, and — because it is ZZ-type — it commutes with Zˉ1\bar Z_1 and Zˉ2\bar Z_2, but it anticommutes with Xˉ1\bar X_1 and with Xˉ2\bar X_2 individually, since a ZZ-check overlaps those XX-strings on an odd number of seam qubits. Measuring the MpM_p is a projective measurement that fixes their random ±1\pm1 values mpm_p. Why: the anticommutation with the individual Xˉi\bar X_i is precisely what will demote them from logical operators — it is the seam checks eating one logical qubit.

Step 3. Telescope the product. Each MpM_p is a ZZ-string bridging one qubit of patch 1's seam boundary to the adjacent qubit of patch 2's; multiplying all of them, every interior gap qubit appears in two neighbouring checks and cancels as Z2=IZ^2=I, leaving ∏pMp=(∏j∈∂1Zj)(∏k∈∂2Zk)\prod_p M_p=\big(\prod_{j\in\partial_1}Z_j\big)\big(\prod_{k\in\partial_2}Z_k\big). Each surviving boundary product is a boundary-parallel ZZ-string, deformable through bulk plaquettes to the logical Zˉ\bar Z, so ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2. Why: this is the heart of the matter — a product of purely local, individually random checks equals a single global logical operator, so measuring the checks measures the logical.

Step 4. Read off the outcome and count the survivors. Since Zˉ1Zˉ2\bar Z_1\bar Z_2 is a product of measured stabilizers, its eigenvalue is fixed: ⟨Zˉ1Zˉ2⟩=∏pmp=m\langle\bar Z_1\bar Z_2\rangle=\prod_p m_p=m. The conjugate Xˉ1Xˉ2\bar X_1\bar X_2 commutes with every MpM_p (each XX-anomaly cancels in the pair) and survives as the merged patch's logical Xˉ\bar X; Zˉ1≡Zˉ2\bar Z_1\equiv\bar Z_2 survives as its logical Zˉ\bar Z. One logical qubit remains, exactly as a non-destructive ZZZZ measurement demands. Why: preserving Xˉ1Xˉ2\bar X_1\bar X_2 while fixing Zˉ1Zˉ2\bar Z_1\bar Z_2 is the operational signature that this is a measurement of the parity and not a destruction of the qubits. *The three key checks: the interior seam qubits cancel by telescoping, leaving ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2; this product commutes with Xˉ1Xˉ2\bar X_1\bar X_2; and the individual Xˉi\bar X_i (not Zˉi\bar Z_i) anticommute with the ZZ-type seam checks, so only the joint operators survive as logical operators of the merged patch.*

Go deeper · Derivation B · 2 minA merge and a split compose into a teleported CNOT
Derivation BA merge and a split compose into a teleported CNOT

The goal is to show that a control–ancilla ZˉZˉ\bar Z\bar Z measurement, an ancilla–target XˉXˉ\bar X\bar X measurement, and a destructive Xˉ\bar X readout of an ancilla prepared in ∣+⟩L|+\rangle_L reproduce a logical CNOT from control to target, with all randomness absorbed into a Pauli byproduct that is tracked classically rather than physically applied. The strategy is to feed each joint measurement, supplied by a merge–split, into the standard measurement-based CNOT identity and follow the stabilizer generators through each projection, so that the surviving logical action is unambiguously CNOTc→t\mathrm{CNOT}_{c\to t}.

Step 1. Prepare the ancilla. Initialize a fresh patch in ∣+⟩L,a|+\rangle_{L,a}, i.e. Xˉa=+1\bar X_a=+1, by preparing all its data qubits in ∣+⟩|+\rangle and running one round of ZZ-checks to project into the code space. Why: the Xˉa=+1\bar X_a=+1 stabilizer is the seed the two subsequent parity measurements will convert into control–target entanglement.

Step 2. First merge, control to ancilla. A smooth merge–split measures ZˉcZˉa\bar Z_c\bar Z_a with outcome m1m_1; this entangles control and ancilla in the ZZ basis, replacing the independent Zˉc,Zˉa\bar Z_c,\bar Z_a by their fixed product and the surviving generator Zˉc(≡Zˉa)\bar Z_c(\equiv\bar Z_a). Why: measuring ZˉcZˉa\bar Z_c\bar Z_a is exactly the "copy the control's ZZ eigenvalue onto the ancilla" step of a teleported CNOT.

Step 3. Second merge, ancilla to target. A rough merge–split measures XˉaXˉt\bar X_a\bar X_t with outcome m2m_2; combined with the ancilla's Xˉa=+1\bar X_a=+1 seed, this couples the target's Xˉ\bar X to the control through the ancilla. Why: the XXXX measurement is the conjugate half of the identity, propagating the control's action onto the target's amplitude.

Step 4. Disentangle and correct. A destructive Xˉa\bar X_a readout with outcome m3m_3 removes the ancilla, and the three outcomes fix a Pauli byproduct Xt aZc bX_t^{\,a}Z_c^{\,b} with a=f(m2,m3)a=f(m_2,m_3), b=g(m1,m3)b=g(m_1,m_3) linear in the measurement record. Tracking, not applying, this byproduct leaves precisely CNOTc→t\mathrm{CNOT}_{c\to t}. Why: the byproduct is deterministic given the outcomes, so it costs only classical bookkeeping in the Pauli frame — the logical gate itself is exact. *The ZZZZ-then-XXXX measurement sequence plus ancilla Xˉ\bar X readout is the gate-teleportation form of CNOT up to Paulis; the ancilla is required because two conjugate bases (ZZZZ then XXXX) must both be measured, which a single two-patch merge cannot supply.*

Go deeper · Derivation C · 2 minWhy the merge needs width d and about d rounds
Derivation CWhy the merge needs width d and about d rounds

The goal is to bound the smallest logical fault that can occur during a merge and to show it equals the static code distance only when the seam is at least dd qubits wide and the joint measurement is repeated for order dd rounds. The merge is a genuinely (2+1)(2+1)-dimensional code region, so a logical fault can be either a spacelike error string that crosses the seam or a timelike run of measurement errors that fakes the parity; we bound each separately and combine them into an effective distance.

Step 1. Spacelike failure. A chain of data errors that crosses the merge region can connect one patch's logical operator to the other's, producing an undetected logical error. The shortest such crossing chain has weight equal to the seam width ww, so demanding w≥dw\ge d forbids any sub-distance spacelike crossing. Why: the seam is the one place the two logical operators come near each other, so it must be at least as hard to cross as the patch is to break.

Step 2. Timelike failure. The inferred parity is the product of the seam syndrome bits over time; a run of measurement errors can flip that product and hand the decoder a wrong outcome mm. Repeating the joint measurement NroundsN_{\text{rounds}} times and resolving by matching over the (2+1)(2+1)-D syndrome graph requires Nrounds≳dN_{\text{rounds}}\gtrsim d to suppress this timelike error to the same order as the spacelike one. Why: a single round of a parity measurement is not fault-tolerant against measurement error; only repetition builds a timelike distance.

Step 3. Combine. The merge region's minimal logical fault is the smallest of the spacelike width, the timelike depth, and the patches' intrinsic distance: deff=min⁡(w,Nrounds,d)d_{\text{eff}}=\min(w,N_{\text{rounds}},d). Choosing w≥dw\ge d and Nrounds∼dN_{\text{rounds}}\sim d yields deff=dd_{\text{eff}}=d, so the merge costs O(d)O(d) rounds of syndrome extraction and leaves the logical-error scaling at pL∼(p/pth)⌊d/2⌋+1p_L\sim(p/p_{\text{th}})^{\lfloor d/2\rfloor+1} — the same exponent as idle memory. Why: this is the operating point that makes surgery "free" in distance, a constant multiple of dd rounds per logical operation with no asymptotic penalty. *The shortest seam-crossing ZZ (or XX) error string has weight ww, the matching-graph timelike separation is NroundsN_{\text{rounds}}, and together these give deff=min⁡(w,Nrounds,d)d_{\text{eff}}=\min(w,N_{\text{rounds}},d).*

Limiting cases

Lattice surgery degenerates to, or reproduces, familiar primitives in special regimes of seam width, rounds, and prepared state:

CaseResultMeaning
Bare d=1d=1, one roundZZZZ or XXXX on two physical qubitsreduces to an unencoded two-qubit parity measurement — no fault tolerance; the primitive surgery generalizes
Deterministic-outcome mergePˉ1Pˉ2\bar P_1\bar P_2 already stabilizedif the joint operator is already +1+1 (e.g. an ancilla in its Xˉ=+1\bar X=+1 eigenstate), the outcome is forced and the merge is a pure entangling step with only known corrections
Fault-tolerant pointw≥d, Nrounds∼dw\ge d,\ N_{\text{rounds}}\sim ddeff=dd_{\text{eff}}=d and pL∼(p/pth)⌊d/2⌋+1p_L\sim(p/p_{\text{th}})^{\lfloor d/2\rfloor+1}, identical to static memory — surgery adds no asymptotic distance penalty
Multi-patch merge∏pMp=Pˉ1Pˉ2⋯Pˉn\prod_p M_p=\bar P_1\bar P_2\cdots\bar P_none merge spanning nn patches measures an nn-body logical Pauli product in a single shot
Braiding equivalencemerge–split ≅\cong defect braida CNOT by surgery and by braiding two defects are the same logical operation; surgery uses planar patches and roughly halves the qubits

Worked examples

1 · Reading the telescoping identity on distance-3 patches (confidence builder)

Two distance-3 patches sit side by side, facing along their smooth boundaries with a single seam column of new ZZ-checks. Show concretely that the product of the seam checks is the joint logical Zˉ1Zˉ2\bar Z_1\bar Z_2, and say what the merge outcome is.

Step 1. Count the seam. A distance-3 patch has three rows, so the seam carries three new weight-four ZZ-checks M1,M2,M3M_1,M_2,M_3, each bridging a qubit on patch 1's right smooth boundary to the neighbouring qubit on patch 2's left smooth boundary. Each is an ordinary ZZ-plaquette — nothing the hardware has not measured before.

Step 2. Multiply and cancel. Form M1M2M3M_1M_2M_3. Every qubit that sits interior to the seam belongs to two vertically adjacent checks, so it appears twice and cancels as Z2=IZ^2=I. What survives is one column of ZZ on patch 1's boundary and one column of ZZ on patch 2's boundary: M1M2M3=(∏j∈∂1Zj)(∏k∈∂2Zk)M_1M_2M_3=\big(\prod_{j\in\partial_1}Z_j\big)\big(\prod_{k\in\partial_2}Z_k\big).

Step 3. Recognize the logicals. Each surviving boundary column is a ZZ-string parallel to the seam, which slides through the bulk plaquettes to the standard logical Zˉ\bar Z of its patch. Hence M1M2M3=Zˉ1Zˉ2M_1M_2M_3=\bar Z_1\bar Z_2, and the joint parity is fixed by the three measured bits: m=m1m2m3m=m_1m_2m_3. The three seam checks multiply to the joint logical operator, so measuring them measures Zˉ1Zˉ2\bar Z_1\bar Z_2, with outcome the product m=m1m2m3=±1m=m_1m_2m_3=\pm1 — random, and recorded in the Pauli frame. The conjugate Xˉ1Xˉ2\bar X_1\bar X_2 commutes with all three checks and survives untouched, confirming the merge is a non-destructive measurement.

2 · Costing a distance-11 lattice-surgery CNOT (fully worked, with numbers)

A planar architecture runs rotated surface-code patches at distance d=11d=11, with physical error rate p=10−3p=10^{-3} and threshold pth=10−2p_{\text{th}}=10^{-2}. Estimate the qubits, the time, and the logical error of a CNOT built from two merges and one ancilla.

Step 1. Qubits per patch. A rotated distance-dd surface code uses d2d^2 data qubits and d2−1d^2-1 measurement qubits, so 2d2−12d^2-1 physical qubits per patch. At d=11d=11 that is 2(121)−1=2412(121)-1=\mathbf{241} physical qubits per logical patch.

Step 2. Qubits for the gate. The CNOT needs the control patch, the target patch, and one ancilla patch, plus a merge corridor of comparable footprint. Three patches alone cost 3×241=7233\times241=\mathbf{723} physical qubits, and allotting roughly one patch-area of routing space brings the working total near 10310^3 physical qubits for one logical CNOT.

Step 3. Time. Each merge must repeat its joint measurement for Nrounds∼d=11N_{\text{rounds}}\sim d=11 rounds of syndrome extraction to build timelike distance. The two merges (control–ancilla, then ancilla–target) run in sequence, so the gate takes on the order of 2d≈222d\approx\mathbf{22} syndrome-extraction cycles of logical time — the constant-times-dd overhead that keeps deff=dd_{\text{eff}}=d.

Step 4. Logical error. Each merge inherits the memory scaling with exponent ⌊d/2⌋+1=⌊11/2⌋+1=5+1=6\lfloor d/2\rfloor+1=\lfloor 11/2\rfloor+1=5+1=6, so per merge pL∼(p/pth)6=(10−3/10−2)6=(0.1)6=10−6p_L\sim(p/p_{\text{th}})^{6}=(10^{-3}/10^{-2})^{6}=(0.1)^{6}=\mathbf{10^{-6}}. Two merges plus readout give a CNOT failure of a few ×10−6\times10^{-6}. At d=11d=11 a lattice-surgery CNOT costs about 10310^3 physical qubits and ∼ ⁣22\sim\!22 cycles for a logical error near 10−610^{-6} — and because braiding the same CNOT would thread defects through a thicker spacetime, surgery reaches this at roughly half the qubit count. Pushing to d=13d=13 raises the exponent to 77 and the per-merge error to 10−710^{-7} for only ∼ ⁣30%\sim\!30\% more qubits — the steep return that makes distance the cheapest reliability knob.

Physics of the portrait

Lattice surgery is a young idea with a clear origin: it was named and worked out in a single 2012 paper that asked how to compute with surface-code patches without the qubit-hungry machinery of braided defects. The lead author of that paper is the physicist most identified with the technique.

Origins · 2 minDominic Horsman and how this was discovered
DH
Dominic Horsman
British physicist · surface-code architecture, 2012 · planar fault-tolerant quantum computing

Lattice surgery was introduced in 2012 in Surface code quantum computing by lattice surgery (New J. Phys. 14, 123011) by Dominic Horsman — who published the work under the name Clare Horsman — together with Austin Fowler, Simon Devitt, and Rodney Van Meter. The paper solved a concrete architectural problem. By 2012 the surface code was understood to be the most hardware-friendly quantum error-correcting code, but the accepted way to compute with it was to punch holes (defects) in the lattice and braid them around one another, a construction that is elegant on paper yet costly in qubits and demands a thick, genuinely three-dimensional spacetime of operations. Horsman and colleagues realized that the same logic could be done in the plane by editing the code at its boundaries: bring two patches together, turn on a strip of ordinary parity checks, and the product of those checks is a joint logical operator, so the merge measures it. A merge followed by a split is a fault-tolerant joint measurement, and joint measurements are all one needs to teleport a CNOT — reducing every Clifford gate to gluing and ungluing tiles on a two-dimensional grid. The insight roughly halved the qubit overhead per logical operation and turned quantum compilation into a tiling-and-scheduling problem, which is why lattice surgery underlies essentially every serious planar surface-code architecture and resource estimate today. The picture was sharpened by Austin Fowler's parallel work on the practical surface code, and by Daniel Litinski's 2019 A Game of Surface Codes, which recast whole algorithms as streams of multi-patch Pauli-product measurements fed by magic-state factories. Horsman went on to develop diagrammatic (ZX-calculus) methods for reasoning about exactly these surface-code operations, tightening the link between the algebra of stabilizers and the geometry of patches that lattice surgery first exposed.

History
1997
— Kitaev introduces the toric and surface codes and topological error correction
2003
— Kitaev's "Fault-tolerant quantum computation by anyons" is published
2012
— Fowler, Mariantoni, Martinis and Cleland lay out the practical surface-code architecture
2012
— Horsman, Fowler, Devitt and Van Meter introduce lattice surgery
2019
— Litinski's "A Game of Surface Codes" recasts computation as Pauli-product measurements

Going further

Texts. Nielsen & Chuang, Quantum Computation and Quantum Information (10th anniv. ed.), Ch. 10 (stabilizer and topological codes) · Preskill, Lecture Notes on Quantum Computation, Ch. 7 (topological quantum computation) · Kitaev, Fault-tolerant quantum computation by anyons, Ann. Phys. 303 (2003) · Horsman, Fowler, Devitt & Van Meter, Surface code quantum computing by lattice surgery, New J. Phys. 14, 123011 (2012) · Fowler, Mariantoni, Martinis & Cleland, Surface codes: towards practical large-scale quantum computation, Phys. Rev. A 86, 032324 (2012) · Litinski, A Game of Surface Codes, Quantum 3, 128 (2019) · Watrous, The Theory of Quantum Information (2018), stabilizer-code chapter. The telescoping identity ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2, the split byproduct, and the CNOT construction are the central results of this article. Key consistency checks: the anticommutator XˉZˉ=−ZˉXˉ\bar X\bar Z=-\bar Z\bar X follows from odd string crossing; the individual Xˉi\bar X_i (not Zˉi\bar Z_i) anticommute with the ZZ-type seam checks while Xˉ1Xˉ2\bar X_1\bar X_2 and ∏pMp\prod_p M_p commute; the threshold pth≈1%p_{\text{th}}\approx1\% and the scaling pL∼(p/pth)⌊d/2⌋+1p_L\sim(p/p_{\text{th}})^{\lfloor d/2\rfloor+1} are standard circuit-level surface-code results; the rotated-code count 2d2−12d^2-1 physical qubits per distance-dd patch and the worked (0.1)6=10−6(0.1)^6=10^{-6} are confirmed in the worked example above; and deff=min⁡(w,Nrounds,d)d_{\text{eff}}=\min(w,N_{\text{rounds}},d).

Prerequisites. Stabilizer Formalism · CSS Codes · Code Distance and Logical Operators · Syndrome Measurement and Decoding · Pauli Group and Clifford Group. Leads to. Magic State Distillation · Fault-Tolerant Quantum Computation · Pauli-Based Computation.

Ask the tutor: Ask me to walk the telescoping seam identity ∏pMp=Zˉ1Zˉ2\prod_p M_p=\bar Z_1\bar Z_2 on a patch of your chosen distance, or to cost a full CNOT or TT gate at your hardware's pp and dd.

Is a merge really a measurement, or does it just entangle the two patches?

It is a genuine projective measurement of the joint logical operator, not mere entanglement. Switching on the seam checks adds new independent stabilizers whose product equals Zˉ1Zˉ2\bar Z_1\bar Z_2 (smooth) or Xˉ1Xˉ2\bar X_1\bar X_2 (rough). Because a product of measured stabilizers has a determined eigenvalue, the joint parity is projected to a definite ±1\pm1 given by m=∏pmpm=\prod_p m_p. The conjugate joint operator commutes with every seam check and is left untouched, which is precisely what distinguishes a non-destructive measurement of the parity from a generic entangling operation that would disturb both bases.

What is the difference between a smooth merge and a rough merge?

It is which boundary type you glue, and therefore which joint operator you measure. Smooth boundaries are where Zˉ\bar Z-strings terminate; merging two patches along smooth boundaries with ZZ-type seam checks measures Zˉ1Zˉ2\bar Z_1\bar Z_2. Rough boundaries are where Xˉ\bar X-strings terminate; merging along rough boundaries with XX-type seam checks measures Xˉ1Xˉ2\bar X_1\bar X_2. The two are exact duals under the Hadamard exchange X↔ZX\leftrightarrow Z, and having both available — plus single-patch Xˉ\bar X and Zˉ\bar Z readouts and a fresh ancilla — is exactly enough to synthesize the full Clifford group.

Why does a CNOT need an ancilla patch instead of a single direct merge?

Because a CNOT teleported from measurements requires two conjugate joint measurements — a ZˉZˉ\bar Z\bar Z and a XˉXˉ\bar X\bar X — and a single two-patch merge can only supply one basis at a time. The ancilla, prepared in ∣+⟩L|+\rangle_L, is the intermediary that lets you first measure ZˉcZˉa\bar Z_c\bar Z_a (control to ancilla) and then XˉaXˉt\bar X_a\bar X_t (ancilla to target), before being read out in Xˉ\bar X to disentangle itself. The ancilla also solves a routing problem: control and target need never be adjacent, since the ancilla patch and its merge corridors carry the interaction across the chip.

What exactly is the Pauli frame, and why is nothing physically corrected?

The Pauli frame is a classical record of which Pauli operator would need to be applied to make the logical state "textbook," carried in software rather than enacted on the qubits. Every merge yields a random outcome mm, and every split yields a deterministic byproduct; both are Pauli operators. Rather than physically applying them — which would cost gate time and inject fresh error — you update the frame and reinterpret all future measurement outcomes accordingly. Because Cliffords map Paulis to Paulis, the frame can be pushed through the entire computation and resolved only at the final measurement, so surgery's randomness is free.

Does lattice surgery give a universal gate set by itself?

No — surgery alone yields only Clifford operations: CNOT from two merges, Hadamard by a 90∘90^\circ patch rotation, and the phase gate SS from an ancilla-mediated sequence. By the Gottesman–Knill theorem, Clifford circuits are efficiently classically simulable, so they cannot be universal. Universality arrives through magic-state injection: a patch holding a distilled ∣T⟩=(∣0⟩+eiπ/4∣1⟩)/2|T\rangle=(|0\rangle+e^{i\pi/4}|1\rangle)/\sqrt2 state is merged with a data patch by a ZˉZˉ\bar Z\bar Z merge, and a measurement-conditioned Clifford correction completes a TT gate. The magic-state distillation factories that feed these merges are the dominant resource cost of most fault-tolerant algorithms.

Why is lattice surgery preferred over braiding defects?

Both realize the same logical Clifford gates at the same code distance and threshold, so the choice is about overhead and geometry. Braiding moves logical defects around one another through a thicker, genuinely three-dimensional spacetime of operations, which is qubit-hungry and awkward to route. Surgery keeps everything in the plane: logical qubits are edge-to-edge patches, and a gate is a local boundary edit repeated for ∼d\sim d rounds. This typically halves the physical-qubit overhead per logical operation, reduces routing to two-dimensional tiling and scheduling, and integrates cleanly with magic-state injection — which is why planar architectures across superconducting, ion, and neutral-atom platforms adopt it.

Before this

Where this leads