Lattice Surgery and Defect Braiding

A single surface-code patch is a superb quantum memory and an almost useless quantum computer: it stores a logical qubit in the homology of a two-dimensional lattice, protected from any local error, but it cannot by itself entangle that qubit with a neighbour. Scalable fault-tolerant computation therefore needs a way to couple logical qubits that respects the one hard constraint of real hardware — every operation must be a pattern of nearest-neighbour stabilizer measurements on a fixed planar grid. Lattice surgery and defect braiding are the two canonical answers, both purely topological: nothing quantum ever physically crosses the chip, only the classical description of which stabilizers are switched on. Lattice surgery, introduced by Horsman, Fowler, Devitt and Van Meter in 2012, treats a logical gate as a controlled edit of the boundary between patches. Two patches separated by a gap are merged by turning on the gap stabilizers; individually those new stabilizers fail to commute with the old logical operators, and measuring them collectively realizes a destructive joint Pauli measurement MˉXX\bar M_{XX} or MˉZZ\bar M_{ZZ}. A split reverses the merge at the cost of a byproduct operator fixed by the parity of the gap outcomes. From merge and split alone one builds logical CNOT, state injection, and the whole Clifford group. Defect braiding, the older lineage of Kitaev, Bravyi–Kitaev, Raussendorf and Fowler, instead encodes a logical qubit in a pair of holes and enacts a CNOT by dragging one hole in a full loop around another — the computational embodiment of the −1-1 mutual statistics of the toric code. Both methods are strictly Clifford; universality is imported as magic states. This article builds both machines, proves they realize the gates they claim, and shows why the same ±1\pm1 outcome that makes them work must be tracked in a classical Pauli frame.

Key takeaways
  • Lattice surgery couples surface-code patches by merging and splitting them along their boundaries, realizing joint logical Pauli measurements MˉXX\bar M_{XX} and MˉZZ\bar M_{ZZ} with only nearest-neighbour stabilizer measurements.
  • A rough merge measures Xˉ1Xˉ2\bar X_1\bar X_2 (new star stabilizers), a smooth merge Zˉ1Zˉ2\bar Z_1\bar Z_2 (new plaquettes); the random ±1\pm1 outcome is the logical result and must be tracked in the Pauli frame.
  • Defect braiding encodes a logical qubit in a pair of holes and enacts a CNOT by dragging one defect in a full loop around another — the homology that protects the code now performs the gate.
  • Both are Clifford-only: they permute Paulis, so by Gottesman–Knill they generate just the Clifford group; a non-Clifford TT is injected as a distilled magic state and teleported in by surgery.
  • Each merge or split runs ∼d\sim d rounds so its own errors inherit the code's exponential suppression pL∼(p/pth)⌊d/2⌋p_L\sim(p/p_{\mathrm{th}})^{\lfloor d/2\rfloor} below threshold pth≈1%p_{\mathrm{th}}\approx1\%.
  • Surgery displaced braiding because a CNOT costs one ancilla patch, not a large braiding region; braiding survives as the bridge to non-Abelian computation, where braids alone become universal.
  • Key idea: logical gates on surface codes are performed topologically — lattice surgery realizes joint Pauli measurements MˉXX,MˉZZ\bar M_{XX},\bar M_{ZZ} by merging and splitting patch boundaries, and defect braiding realizes CNOT by moving one defect's logical loop around another — both relying only on local stabilizer measurements and classical tracking of measurement-dependent byproduct operators.
The core insight

Logical gates on surface codes are implemented topologically: lattice surgery realizes joint Pauli measurements MˉXX,MˉZZ\bar M_{XX},\bar M_{ZZ} by merging and splitting patch boundaries, and defect braiding realizes CNOT by moving one defect's logical loop around another — both relying only on local stabilizer measurements and classical tracking of measurement-dependent byproduct operators.

Where this lives today

Lattice surgery is now the compilation target of essentially every serious fault-tolerant architecture. Litinski's "Game of Surface Codes" represents a whole computation as a schedule of joint Pauli measurements MˉP\bar M_P on a 2D floorplan of patches, reducing gate scheduling to a tiling problem and backing the estimates that quote millions of physical qubits for factoring or chemistry — estimates dominated not by the free Cliffords but by the magic-state factories feeding in TT gates, so surgery and distillation are engineered as one pipeline. The hardware has caught up. In 2024 Google demonstrated below-threshold surface-code memory, logical error falling as distance grew d=3→5→7d=3\to5\to7 — the exponential suppression this article assumes, made fact. Neutral-atom processors (QuEra) have run surgery-style logical operations on dozens of logical qubits via mid-circuit atom rearrangement, and trapped ions (Quantinuum) real-time decoding. The defect picture lives on as the language of twist defects — dislocations behaving as Ising-like Majorana anyons — braided for extra Cliffords, the bridge to non-Abelian computation where braiding alone is universal.

The physical picture

Think of a surface-code patch as a rectangle of cloth whose two logical threads run between opposite edges: Xˉ\bar X stitches one pair of boundaries, Zˉ\bar Z the other, and because the threads cross once they anticommute — that single crossing is the whole logical algebra. Lattice surgery sews two rectangles along a shared edge; the seam is a fresh row of stabilizers, and it can be sewn consistently only if it measures the combined thread Xˉ1Xˉ2\bar X_1\bar X_2 — the joint Pauli measurement. Unpicking the seam (the split) returns two rectangles, but the stitching injected a random ±\pm sign you must remember. Every step is local. A merge just switches on a column of stabilizers and measures them for ∼d\sim d rounds (the code distance), so faults during the operation are matched and corrected exactly as in the static memory. No quantum amplitude is transported; only the boundary — a classical record of which stabilizers are active — moves. The first figure shows the merge and the joint operator it measures, on real distance-3 patches.

Figure
A rough merge of two distance-3 surface-code patches: switching on the gap column of star stabilizers A_v measures the joint logical X̄₁X̄₂ with outcome m = ⊕ of the new star results, repeated d = 3 rounds to stay fault-tolerant
Merge: turning on the gap stabilizers measures X̄₁X̄₂ patch 1 patch 2 gap: new A_v X̄₁ X̄₂ ∏ A_v ∝ X̄₁ X̄₂ = (−1)ᵐ , m = ⊕ (new star outcomes) rough (X-type) boundaries face the gap → joint X measurement repeat d = 3 rounds so faults are matched in space and time merged patch (X̄₁=X̄₂)

Defects tell the dual story. Punch two holes and switch off the stabilizers inside them; a logical qubit now lives on the pair, with Zˉ\bar Z a thread joining them and Xˉ\bar X a loop encircling one. Dragging one hole (by measuring stabilizers along its path) in a full loop around a hole of the opposite type wraps one logical loop irreversibly through the other, forcing the two threads to be re-expressed in terms of each other — precisely the algebra of a CNOT. Microscopically it is the toric code's ee charge carried once around its mm flux, collecting the tell-tale −1-1. The second figure shows the braid and the gate it produces.

Figure
Braiding a primal e-defect once around a dual m-defect enacts a CNOT: X̄_e → X̄_e X̄_m and Z̄_m → Z̄_e Z̄_m, the computational face of the toric code mutual statistics ⟨e around m⟩ = e^(iπ) = −1
Braiding e around m realizes CNOT (control e, target m) m dual (X-cut) e primal (Z-cut) ⟨e around m⟩ = e^(iπ) = −1 X̄_e → X̄_e X̄_m Z̄_m → Z̄_e Z̄_m X̄_m , Z̄_e unchanged = Heisenberg action of CNOT only the opposite cut type gives a gate; same-type loops are contractible and act trivially

Because the surface code is CSS and both operations merely permute Paulis, everything they build lies inside the Clifford group. The expensive resource is the non-Clifford TT: it cannot be woven or sewn, but must arrive as a distilled magic state teleported in by a surgery measurement — the seam to magic-state distillation.

The core equations

The stage is the surface code: qubits on the edges of a lattice, one stabilizer per vertex and one per face. Every construction below edits this stabilizer group, and the two check types commute because a vertex and a face share an even number of edges.

Av=∏e∋vXe,Bp=∏e∈∂pZe,[Av,Bp]=0(1)A_v=\prod_{e\ni v} X_e,\qquad B_p=\prod_{e\in\partial p} Z_e,\qquad [A_v,B_p]=0 \qquad (1)

where: AvA_v — vertex (star) stabilizer, a product of XX on the edges meeting vertex vv; BpB_p — plaquette (face) stabilizer, a product of ZZ on the edges bounding face pp; Xe,ZeX_e,Z_e — Paulis on the qubit on edge ee. Reading: the code space is the joint +1+1 eigenspace of every check, and any Av,BpA_v,B_p overlap on 00 or 22 edges. Logical operators are what the stabilizers cannot detect: non-contractible chains that commute with every check but not with each other. They anticommute because one runs on the lattice, the other on its dual, and the two chains cross an odd number of times.

Zˉ=∏e∈γZe,Xˉ=∏e∈γ∗Xe,{Xˉ,Zˉ}=0(2)\bar Z = \prod_{e\in\gamma} Z_e,\qquad \bar X = \prod_{e\in\gamma^*} X_e,\qquad \{\bar X,\bar Z\}=0 \qquad (2)

where: γ\gamma — a non-contractible primal path (between smooth boundaries, or wrapping the torus); γ∗\gamma^* — a non-contractible dual path crossing γ\gamma an odd number of times; {⋅,⋅}\{\cdot,\cdot\} — the anticommutator. Reading: a single crossing is one shared qubit on which X,ZX,Z anticommute, so {Xˉ,Zˉ}=0\{\bar X,\bar Z\}=0 — one logical qubit per handle. A rough merge turns on a column of star operators in the gap and measures them; their seam-product equals the joint logical Xˉ1Xˉ2\bar X_1\bar X_2, so the merge is a projective measurement of that observable with a random outcome.

MˉXX: ρ↦Pm ρ PmTr(Pmρ),Pm=12(1+(−1)m Xˉ1Xˉ2)(3)\bar M_{XX}:\ \rho \mapsto \frac{P_m\,\rho\,P_m}{\mathrm{Tr}(P_m\rho)},\qquad P_m=\tfrac12\big(\mathbb{1}+(-1)^m\,\bar X_1\bar X_2\big) \qquad (3)

where: PmP_m — projector onto the (−1)m(-1)^m eigenspace of Xˉ1Xˉ2\bar X_1\bar X_2; m∈{0,1}m\in\{0,1\} — the random outcome, the parity of the new gap star stabilizers; Xˉi\bar X_i — logical XX of patch ii. Reading: the merge is not unitary — it collapses the patches onto a definite joint XX-parity and hands you a classical bit mm. The complementary merge runs along smooth (ZZ-type) boundaries, where the gap operators are plaquettes and the measured observable is Zˉ1Zˉ2\bar Z_1\bar Z_2; the boundary flavour facing the gap picks the measured Pauli.

MˉZZ:Pm=12(1+(−1)m Zˉ1Zˉ2)(smooth merge, Z-type boundaries)(4)\bar M_{ZZ}:\quad P_m=\tfrac12\big(\mathbb{1}+(-1)^m\,\bar Z_1\bar Z_2\big)\quad(\text{smooth merge, } Z\text{-type boundaries}) \qquad (4)

where: Zˉi\bar Z_i — logical ZZ of patch ii; mm — parity of the new gap plaquette stabilizers BpB_p. Reading: MˉXX\bar M_{XX} and MˉZZ\bar M_{ZZ} with single-patch Cliffords generate the full Clifford group — the joint measurement is the entangling ingredient. Splitting restores two independent patches, but re-imposing the removed stabilizers does not commute with the random gap outcomes, so a logical byproduct appears — a parity of the recorded outcomes, corrected in software.

Xˉ1Xˉ2 → split  Xˉ1, Xˉ2with byproduct Zˉ s,s=⨁pmp(5)\bar X_1\bar X_2\ \xrightarrow{\ \text{split}\ }\ \bar X_1,\ \bar X_2\quad\text{with byproduct }\bar Z^{\,s},\qquad s=\bigoplus_p m_p \qquad (5)

where: ss — parity of the relevant gap-stabilizer outcomes; Zˉ s\bar Z^{\,s} — the conditional logical-ZZ byproduct applied classically (tracked, not physically). Reading: without ss the split is a random logical flip; with ss it is deterministic — the art is the bookkeeping. Defect braiding gives the same Clifford power geometrically: dragging a primal defect once around a dual defect maps the logicals by the Heisenberg action of a CNOT, primal the control, dual the target.

Ubraid Xˉe Ubraid†=XˉeXˉm,Ubraid Zˉm Ubraid†=ZˉeZˉm(6)U_{\text{braid}}\,\bar X_e\,U_{\text{braid}}^\dagger=\bar X_e\bar X_m,\qquad U_{\text{braid}}\,\bar Z_m\,U_{\text{braid}}^\dagger=\bar Z_e\bar Z_m \qquad (6)

where: e,me,m — primal (ZZ-cut) and dual (XX-cut) defect qubits, control and target; UbraidU_{\text{braid}} — the unitary of moving ee's loop fully around mm. Reading: Xˉm,Zˉe\bar X_m,\bar Z_e are invariant, so the four maps are exactly CNOTe→m\mathrm{CNOT}_{e\to m}. The braid works for one microscopic reason: carrying a toric-code charge ee once around a flux mm multiplies the state by −1-1, and this Z2\mathbb{Z}_2 monodromy, lifted to logical loops, entangles the defect qubits.

⟨ e around m ⟩=eiπ=−1(mutual Z2 statistics)(7)\langle\, e\ \text{around}\ m\,\rangle=e^{i\pi}=-1\qquad(\text{mutual }\mathbb{Z}_2\text{ statistics}) \qquad (7)

where: ee — electric charge, a violated star Av=−1A_v=-1; mm — magnetic flux, a violated plaquette Bp=−1B_p=-1. Reading: a full braid is topological — its value depends only on whether the loop encircles the other defect, not on the path's shape or speed. Finally, universality: neither surgery nor Abelian braiding can make a TT, so it is imported as a distilled magic state and teleported into a data patch by a surgery measurement with a Clifford correction.

∣T⟩=12(∣0⟩+eiπ/4∣1⟩),T via MˉZZ(∣T⟩,data)+Clifford correction(8)|T\rangle=\tfrac{1}{\sqrt2}\big(|0\rangle+e^{i\pi/4}|1\rangle\big),\qquad T\ \text{via}\ \bar M_{ZZ}(|T\rangle,\text{data})+\text{Clifford correction} \qquad (8)

where: ∣T⟩|T\rangle — the distilled magic state carrying the phase π/4\pi/4; MˉZZ\bar M_{ZZ} — the joint surgery measurement teleporting the gate. Reading: this is the doorway through which the cost of universality — the magic-state factories — enters the floorplan.

Derivation AWhy a rough merge measures the joint operator XX

The goal is to prove the central claim of lattice surgery — that switching on a column of star stabilizers in the gap between two rough-boundary patches realizes a projective measurement of the joint logical Xˉ1Xˉ2\bar X_1\bar X_2 and nothing else logical — by tracking which operators enter and leave the stabilizer group as each new check destroys the individual logicals while sparing their product.

Step 1. Turn on and measure the gap star stabilizers {Av}gap\{A_v\}_{\text{gap}}, each a product of XX on the edges around a vertex bridging the two patches. Their seam-product telescopes — interior edges shared by adjacent stars cancel — leaving the boundary XX-chains, so ∏vAv∝Xˉ1Xˉ2\prod_v A_v \propto \bar X_1\bar X_2 up to pre-existing stabilizers. Why: measuring all the gap stars is equivalent to measuring the joint logical Xˉ1Xˉ2\bar X_1\bar X_2.

Step 2. Each gap AvA_v overlaps Zˉ1\bar Z_1 (and Zˉ2\bar Z_2) on a single edge, so it anticommutes with each individually. Once the AvA_v join the stabilizer group, Zˉ1,Zˉ2\bar Z_1,\bar Z_2 are no longer separately logical — only their product Zˉ1Zˉ2\bar Z_1\bar Z_2, crossing each AvA_v on two edges, commutes and survives. Why: the merge fuses the two ZZ-logicals into one, so the patch pair is now a single logical qubit — the space collapse a joint measurement must cause.

Step 3. Each AvA_v returns a random ±1\pm1; the joint eigenvalue (−1)m(-1)^m is the product m=⨁v(outcome of Av)m=\bigoplus_v(\text{outcome of }A_v), and on the code space Xˉ1\bar X_1 and Xˉ2\bar X_2 are identified. Why: the logical bit is the global parity, not any single check — which is why it is fault-tolerant only after ∼d\sim d rounds. *Together, the three steps confirm: the telescoping product gives ∏vAv∝Xˉ1Xˉ2\prod_v A_v\propto\bar X_1\bar X_2; each gap AvA_v anticommutes with Zˉ1,Zˉ2\bar Z_1,\bar Z_2 individually but commutes with Zˉ1Zˉ2\bar Z_1\bar Z_2; and the merged patch carries exactly one logical qubit with Xˉ1=Xˉ2\bar X_1=\bar X_2.*

Go deeper · Derivation B · 1 minLogical CNOT from two lattice-surgery measurements
Derivation BLogical CNOT from two lattice-surgery measurements

The goal is to assemble a fault-tolerant logical CNOT between a control patch 11 and a target patch 22 from nothing but joint Pauli measurements and single-qubit readout on one ancilla patch, and to show the random outcomes assemble into a deterministic CNOT once their Pauli-frame corrections are applied. We prepare an ancilla in ∣+⟩|+\rangle, do MˉZZ\bar M_{ZZ} with the control then MˉXX\bar M_{XX} with the target, read the ancilla out, and check the surviving map.

Step 1. Prepare the ancilla aa in ∣+⟩a|+\rangle_a, the +1+1 eigenstate of Xˉa\bar X_a; the initial state is ∣ψ⟩1∣ϕ⟩2∣+⟩a|\psi\rangle_1|\phi\rangle_2|+\rangle_a. Why: a fresh ancilla in a stabilizer eigenstate is the reservoir into which the joint measurements spread correlations without disturbing the data.

Step 2. Merge control and ancilla: MˉZZ(1,a)\bar M_{ZZ}^{(1,a)} projects onto a definite parity of Zˉ1Zˉa\bar Z_1\bar Z_a with outcome mZZm_{ZZ}, PmZZ∝1+(−1)mZZZˉ1ZˉaP_{m_{ZZ}}\propto\mathbb{1}+(-1)^{m_{ZZ}}\bar Z_1\bar Z_a, entangling control and ancilla in the ZZ basis. Why: this is the first of two non-commuting joint measurements — the only way a measurement sequence builds an entangling gate.

Step 3. Merge ancilla and target: MˉXX(a,2)\bar M_{XX}^{(a,2)} projects onto a definite parity of XˉaXˉ2\bar X_a\bar X_2 with outcome mXXm_{XX}, PmXX∝1+(−1)mXXXˉaXˉ2P_{m_{XX}}\propto\mathbb{1}+(-1)^{m_{XX}}\bar X_a\bar X_2, coupling ancilla and target in the XX basis. Why: a ZZ-type then an XX-type correlation on the ancilla is the skeleton of one-bit gate teleportation.

Step 4. Measure the ancilla in ZZ, MˉZa\bar M_{Z_a} with outcome mZm_{Z}, which removes aa and leaves a CNOT up to byproducts. Absorb the outcomes as a Pauli-frame correction — apply Xˉ2 mZZ⊕mZ\bar X_2^{\,m_{ZZ}\oplus m_{Z}} on the target and Zˉ1 mXX\bar Z_1^{\,m_{XX}} on the control, tracked classically. Why: Zˉa\bar Z_a anticommutes with the XˉaXˉ2\bar X_a\bar X_2 stabilizer just created, so it disentangles the ancilla while revealing nothing about the data — measuring Xˉa\bar X_a instead would combine with XˉaXˉ2\bar X_a\bar X_2 to read out Xˉ2\bar X_2 and collapse the target; the byproducts are then deterministic functions of measured bits, so a classical frame update makes the net channel exactly CNOT1→2\mathrm{CNOT}_{1\to2}. *Propagating the three projectors and frame corrections gives Xˉ1 ⁣→ ⁣Xˉ1Xˉ2\bar X_1\!\to\!\bar X_1\bar X_2, Zˉ2 ⁣→ ⁣Zˉ1Zˉ2\bar Z_2\!\to\!\bar Z_1\bar Z_2, with Xˉ2,Zˉ1\bar X_2,\bar Z_1 fixed — precisely the Heisenberg action of CNOT1→2\mathrm{CNOT}_{1\to2}.*

Go deeper · Derivation C · 1 minHow braiding one defect around another realizes a CNOT
Derivation CHow braiding one defect around another realizes a CNOT

The goal is to show that dragging a primal defect once around a dual defect performs the identical logical operation as the surgery CNOT above, by tracking how the four logical loops deform under the braid, and to tie this to the −1-1 mutual statistics of the toric code so the gate's fault tolerance is manifestly topological — identifying each defect's logicals, transporting the primal loop through a full circuit, and reading off the induced map.

Step 1. Fix the logicals: the primal (ee) pair carries Zˉe\bar Z_e (a chain joining its holes) and Xˉe\bar X_e (a loop around one hole), the dual (mm) pair carries Zˉm,Xˉm\bar Z_m,\bar X_m on the dual lattice. Dragging a defect by measuring stabilizers along its path transports its loop rigidly. Why: the qubit lives in the loops' homology, so moving a defect is acting with its logicals — the gate uses the same measurements as error correction.

Step 2. Braid ee once around mm. The encircling Xˉe\bar X_e loop sweeps a tube that, after the full circuit, also links mm; homologically the swept loop is Xˉe\bar X_e times a loop around mm, so Xˉe→XˉeXˉm\bar X_e\to\bar X_e\bar X_m. Why: the loop cannot unlink from mm without crossing it, so the braid permanently multiplies Xˉe\bar X_e by Xˉm\bar X_m — the control-to-target coupling.

Step 3. By the crossing algebra, the conjugate Zˉm\bar Z_m picks up Zˉe\bar Z_e: Zˉm→ZˉeZˉm\bar Z_m\to\bar Z_e\bar Z_m, while Zˉe,Xˉm\bar Z_e,\bar X_m stay invariant (their loops are unlinked). These four maps are exactly CNOTe→m\mathrm{CNOT}_{e\to m}, and underneath sits the single passage phase ⟨e around m⟩=−1\langle e\ \text{around}\ m\rangle=-1. Why: the same Z2\mathbb{Z}_2 monodromy that gives the toric code its topological order makes the braid an entangling gate, not a relabelling. *The induced map Xˉe ⁣→ ⁣XˉeXˉm\bar X_e\!\to\!\bar X_e\bar X_m, Zˉm ⁣→ ⁣ZˉeZˉm\bar Z_m\!\to\!\bar Z_e\bar Z_m, Xˉm,Zˉe\bar X_m,\bar Z_e fixed, is the Heisenberg action of CNOT; it descends directly from the mutual statistics eiπ=−1e^{i\pi}=-1.*

Limiting cases

The reach and cost of these primitives are set by the code distance, the boundary type, and — most sharply — the Clifford versus non-Clifford divide no amount of surgery or Abelian braiding can bridge.

CaseResultMeaning
Large distance ddpL∼A (p/pth)⌊d/2⌋p_L \sim A\,(p/p_{\mathrm{th}})^{\lfloor d/2\rfloor}Logical error per operation falls exponentially in dd below pth≈1%p_{\mathrm{th}}\approx1\%; each merge or split runs ∼d\sim d rounds to build the space–time syndrome history that inherits this protection.
Clifford-only ceiling⟨MˉXX,MˉZZ,braid⟩=Cn⊊U(2n)\langle \bar M_{XX},\bar M_{ZZ},\mathrm{braid}\rangle=\mathcal{C}_n\subsetneq U(2^n)Surgery and Abelian braiding generate only the Clifford group; universality needs injected TT / magic states — a theorem, not an engineering gap.
Space cost of a CNOTsurgery ∼1\sim1 ancilla patch; braiding ∼\sim a full loop regionSurgery couples two patches through one intermediate patch; braiding needs room for one defect to orbit another, costing more qubits and time — the reason surgery won.
Abelian vs non-AbelianRabRba=eiθ1R_{ab}R_{ba}=e^{i\theta}\mathbb{1} (Abelian); [Rab,Rba]≠0[R_{ab},R_{ba}]\neq0 (non-Abelian)Toric-code braiding yields only Abelian Z2\mathbb{Z}_2 phases (Cliffords); braiding-alone universality needs non-Abelian anyons (Ising, Fibonacci).

Worked examples

1 · Code distance and qubit budget for a fault-tolerant surgery CNOT (fully worked)

A superconducting processor has physical error rate p=10−3p=10^{-3} and threshold pth≈10−2p_{\mathrm{th}}\approx10^{-2}. Each logical CNOT must fail with probability at most pL=10−15p_L=10^{-15}. Using rotated planar patches (qubit count 2d2−12d^2-1) and a 1 μs1\ \mu s syndrome round, find the code distance dd, the physical qubits per patch, and the time of one surgery CNOT.

Step 1. Set the suppression. Below threshold pL∼A (p/pth)⌊d/2⌋p_L\sim A\,(p/p_{\mathrm{th}})^{\lfloor d/2\rfloor} with A=O(0.1)A=O(0.1) and p/pth=0.1p/p_{\mathrm{th}}=0.1. Requiring (0.1)⌊d/2⌋≲10−15(0.1)^{\lfloor d/2\rfloor}\lesssim10^{-15} gives ⌊d/2⌋≥15\lfloor d/2\rfloor\ge15, so the smallest odd distance is d=31d=\mathbf{31} (⌊31/2⌋=15\lfloor31/2\rfloor=15, giving pL∼10−16p_L\sim10^{-16}, under budget).

Step 2. Qubits per patch. A rotated planar code of distance dd uses 2d2−12d^2-1 physical qubits: 2(31)2−1=19212(31)^2-1=\mathbf{1921} per logical patch. A surgery CNOT occupies control, target, and one ancilla bus patch, so ≈3×1921≈5.8×103\approx3\times1921\approx\mathbf{5.8\times10^{3}} physical qubits are live during the gate.

Step 3. Wall-clock time. Each merge or split runs ∼d\sim d rounds; a CNOT is a short merge–split sequence, so ∼2d\sim2d rounds end to end. At 1 μs1\ \mu s per round, 2d=622d=62 rounds is 62 μs\mathbf{62\ \mu s} per logical CNOT. Result: d = 31, about 1900 physical qubits per patch (≈ 5.8 thousand for the CNOT), ≈ 62 μs per gate — the arithmetic behind million-qubit surface-code resource estimates.

2 · Braiding a CNOT turns a product state into a Bell pair

Take defect qubits ee (control) in ∣+⟩e|+\rangle_e and mm (target) in ∣0⟩m|0\rangle_m. Braid ee once around mm and identify the output state, using only the Heisenberg map of equation (6).

Step 1. The input ∣+⟩e∣0⟩m|+\rangle_e|0\rangle_m is the unique state stabilized by {Xˉe, Zˉm}\{\bar X_e,\ \bar Z_m\} (the +1+1 eigenstates of Xˉe\bar X_e and Zˉm\bar Z_m).

Step 2. Conjugate each stabilizer by the braid: from equation (6), Xˉe→XˉeXˉm\bar X_e\to\bar X_e\bar X_m and Zˉm→ZˉeZˉm\bar Z_m\to\bar Z_e\bar Z_m, so the output is stabilized by {XˉeXˉm, ZˉeZˉm}\{\bar X_e\bar X_m,\ \bar Z_e\bar Z_m\} — exactly the stabilizers of a Bell pair.

Step 3. The joint +1+1 eigenstate of XˉeXˉm\bar X_e\bar X_m and ZˉeZˉm\bar Z_e\bar Z_m is 12(∣00⟩+∣11⟩)\tfrac{1}{\sqrt2}\big(|00\rangle+|11\rangle\big), so a single braid entangled two unentangled qubits. Result: braiding e around m maps ∣+⟩e∣0⟩m→12(∣00⟩+∣11⟩)|+\rangle_e|0\rangle_m \to \tfrac{1}{\sqrt2}(|00\rangle+|11\rangle), the fingerprint of a CNOT on ∣+⟩∣0⟩|+\rangle|0\rangle — entanglement created with no two-qubit gate touching a physical qubit, only a defect walked in a circle.

Physics of the portrait

Lattice surgery and defect braiding are two dialects of one language — the topological stabilizer code — and that language has a principal author. Before these gates could exist, someone had to see that a quantum memory could be built from the homology of a lattice.

Origins · 1 minAlexei Kitaev and how this was discovered
AK
Alexei Kitaev
born 1963 · topological codes and fault-tolerant quantum computation

Alexei Kitaev is a Russian–American theoretical physicist whose 1997 preprint "Fault-tolerant quantum computation by anyons" reframed the whole problem of protecting quantum information: rather than actively correcting errors on fragile qubits, encode the information in the global, topological degrees of freedom of a two-dimensional medium that local noise cannot reach. His toric code — qubits on the edges of a lattice, a stabilizer for every vertex and face — is the ancestor of every construction here; its ee and mm excitations are the charges and fluxes whose −1-1 mutual statistics are the defect-braiding CNOT. With Sergey Bravyi in 1998 he gave such codes boundaries, the rough and smooth edges that lattice surgery later learned to sew. Kitaev's reach runs far beyond codes — the honeycomb model, Majorana zero modes, the Sachdev–Ye–Kitaev model — but the surface-code lineage is where his ideas became hardware. The techniques here were then made practical by others: Raussendorf, Harrington and Goyal turned defect braiding into a concrete scheme, Fowler and collaborators into a blueprint, and Horsman, Fowler, Devitt and Van Meter invented lattice surgery in 2012 as the leaner successor. All of it is downstream of Kitaev's single move — that topology, not vigilance, is the natural home of a protected qubit.

History
1997
— Kitaev introduces the toric code and fault-tolerant computation by anyons
1998
— Bravyi and Kitaev define surface codes with rough and smooth boundaries
2007
— Raussendorf, Harrington and Goyal give a fault-tolerant defect-braiding scheme
2012
— Horsman, Fowler, Devitt and Van Meter introduce lattice surgery
2019
— Litinski recasts computation as a sequence of lattice-surgery Pauli measurements

Going further

Texts and papers. 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) · Bravyi & Kitaev, quant-ph/9811052 (1998) · Kitaev, "Fault-tolerant quantum computation by anyons," Ann. Phys. 303, 2 (2003) · Litinski, "A game of surface codes," Quantum 3, 128 (2019) · Raussendorf, Harrington & Goyal, New J. Phys. 9, 199 (2007) · Preskill, Lecture Notes on Quantum Computation, Ch. 9 · Nielsen & Chuang, Ch. 10. The threshold pth≈1%p_{\mathrm{th}}\approx1\% and scaling pL∼(p/pth)⌊d/2⌋p_L\sim(p/p_{\mathrm{th}})^{\lfloor d/2\rfloor} are standard results, and the rotated-planar qubit count 2d2−12d^2-1 is exact. Key checkpoints: [Av,Bp]=0[A_v,B_p]=0 and {Xˉ,Zˉ}=0\{\bar X,\bar Z\}=0 follow from shared-edge counts; the telescoping product gives ∏vAv∝Xˉ1Xˉ2\prod_v A_v\propto\bar X_1\bar X_2 with gap stars anticommuting with Zˉ1,Zˉ2\bar Z_1,\bar Z_2; the surgery-CNOT map is Xˉ1→Xˉ1Xˉ2\bar X_1\to\bar X_1\bar X_2, Zˉ2→Zˉ1Zˉ2\bar Z_2\to\bar Z_1\bar Z_2; the braiding map yields the Bell-pair output of Worked Example 2; and the worked arithmetic gives d=31d=31, 2d2−1=19212d^2-1=1921, ∼62 μs\sim62\ \mu s.

Prerequisites. Toric Code and Topological Order · Anyons and Fractional Statistics · Topological Quantum Computation · Magic State Distillation. Leads to. Magic State Distillation · Non-Abelian Braiding and Fusion Rules · Measurement-Based Quantum Computation · Fibonacci and Ising Anyons.

Ask the tutor: Want to walk the surgery CNOT stabilizer-by-stabilizer, or see how a twist defect braids to a Hadamard? Ask and we will track every Pauli and outcome through the frame.

Is a merge the same as applying a two-qubit gate between the patches?

No, and the difference is the whole point. A two-qubit gate is a deterministic unitary; a merge is a projective measurement of a joint logical operator, with a random ±1\pm1 outcome that collapses the two qubits' joint parity rather than rotating them. The sequence behaves like a gate only because the outcomes are recorded and their byproducts corrected in the classical Pauli frame; ignore the outcome and you flip logical results at random. Surgery is measurement-based computation in code-patch clothing: measure the right joint observables in order, then fix up the frame.

Why does the boundary type decide whether a merge measures XX or ZZ?

Because the boundary sets which stabilizers you may turn on in the gap. A rough (X-type) boundary is where stars terminate, so bridging two rough boundaries switches on new stars AvA_v whose seam-product is Xˉ1Xˉ2\bar X_1\bar X_2 — a joint XX measurement. A smooth (Z-type) boundary terminates plaquettes, so two smooth boundaries give Zˉ1Zˉ2\bar Z_1\bar Z_2 — a joint ZZ measurement. The logical running into the merged boundary is measured jointly; the conjugate is fused. Choosing boundaries is choosing your measurement basis.

What exactly is the byproduct operator, and why is it never physically applied?

When you split a merged patch, re-imposing the removed stabilizers does not commute with the random gap outcomes recorded during the merge, so the split leaves a logical Pauli — the byproduct — whose type is fixed but whose presence (s=0s=0 or 11) is the parity of those outcomes. You do not apply it physically, since a real logical Pauli costs time and risks error; instead you update the Pauli frame, a classical record of pending corrections, and read every future outcome through it. That is how measurement randomness is tamed.

Why has lattice surgery largely replaced defect braiding?

Cost. A braided CNOT needs a code region big enough for one defect to loop fully around another, plus the time to walk it there and back — many qubits idle for many rounds. A surgery CNOT needs only one ancilla patch and a short merge–split sequence. For the same distance, surgery uses fewer qubits and less time per gate and maps cleanly onto a fixed patch tiling a compiler can schedule. Braiding is not wrong — it exposes the gate's topological origin beautifully — but on a scarce qubit budget the leaner primitive wins, which is why modern resource estimates are written in surgery.

If both are Clifford-only, where does the quantum advantage come from?

From magic states injected through surgery. Clifford circuits on stabilizer inputs are efficiently simulable classically (Gottesman–Knill), so surgery and Abelian braiding alone give no speed-up. The non-Clifford ingredient is the TT gate, which enters as a distilled ∣T⟩|T\rangle prepared in its own factory and teleported in by a joint surgery measurement plus an outcome-conditioned Clifford correction. The Cliffords are cheap and protected; the magic states are expensive and dominate the qubit budget. Lattice surgery is the delivery mechanism connecting the cheap protected part to the costly universal part.

Is defect braiding here the same thing as non-Abelian anyon braiding?

No — they share a picture but differ decisively. The surface code's defects are Abelian: braiding an ee around an mm multiplies the state by a Z2\mathbb{Z}_2 phase and, lifted to logical loops, gives a Clifford CNOT — but braiding never leaves the Clifford group. Genuine non-Abelian anyons (Ising, Fibonacci) carry a degenerate fusion space where braiding is a non-commuting unitary, and Fibonacci braids are dense in SU(2)SU(2), universal alone. Twist defects sit between: Ising-like Majorana anyons that braid to more Cliffords but still need magic states. The braiding here is the Abelian, Clifford-only cousin.

Before this

Where this leads