从 Toric Code 到 Surface CodeFrom Toric Code to Surface Code ← 条目总览← Entry overview
互动教程 · Surface CodeInteractive tutorial · Surface Code

从 Toric Code
到 Surface Code
From the Toric Code
to the Surface Code

环面码优雅,但没人能把芯片烤成甜甜圈。这份教程把环面剪开、铺平到真实的平面芯片上:两种边界如何分工、错误链如何贴着边界溜走、一轮完整的纠错如何运转,最后在你的浏览器里现场测出量子纠错最著名的那条曲线——阈值。 The toric code is elegant, but nobody bakes chips into donuts. This tutorial cuts the torus open and lays it flat on a real planar chip: how the two kinds of boundary divide the work, how error chains slip out through them, how a full correction cycle runs — and finally, measured live in your browser, the most famous curve in quantum error correction: the threshold.

前置:《从 1+1 到 Toric Code》。第 0 章备有快速回顾。 Prerequisite: “From 1+1 to the Toric Code”. Chapter 0 offers an express recap.
开始 ↓Begin ↓ 全程约 40–60 分钟 · 含译码游戏与实时阈值实验About 40–60 minutes · with the decoding game and a live threshold experiment
目录Contents
第 0 章Chapter 0

行李检查:五件必带品Luggage check: five essentials

本教程假定你走过《从 1+1 到 Toric Code》。这里把旅途要用的五件行李逐件过检——每件都配公式和一个可动手的复习台。若某件感到陌生,别硬撑:那份教程的对应小节(每件行李都附了链接)会把它一步不跳地铺出来。另外,正文里引用本教程定义的橙色虚线点一下就会原地弹出该定义的小卡片,引用《从 1+1 到 Toric Code》的地方则直接链接到对应小节;希腊字母与新符号(浅灰点线)点一下会告诉你它怎么读,页尾附符号读音表。打开《从 1+1 到 Toric Code》 → This tutorial assumes “From 1+1 to the Toric Code”. Here we pass its five essentials through security — each with its formula and a hands-on refresher. If any feels unfamiliar, don't push through: the matching section of that tutorial (linked in every item) derives it without skipping a step. Also, amber dashed citations to this tutorial's own definitions pop up a small in-place card restating them, while references to “From 1+1 to the Toric Code” link straight to the relevant section; Greek letters and novel symbols (faint grey dotted) click to reveal how they are read, with a full table at the end. Open “From 1+1 to the Toric Code” →

0.1行李一:量子比特与「平方=概率」Item 1: the qubit and “square = probability”

一个量子比特的状态(《从 1+1 到 Toric Code》3.1 节)是一对配比数字(振幅),可正可负;测量得 0 或 1 的概率是各自振幅的平方;测量后状态跳到所得答案上(坍缩)。未知的量子状态既不能复印(不可克隆),也经不起直接阅读。

A qubit's state (“From 1+1 to the Toric Code”, §3.1) is a pair of blend-numbers (amplitudes), possibly negative; measuring yields 0 or 1 with probability each amplitude squared; afterwards the state jumps onto the answer (collapse). Unknown quantum states can be neither photocopied (no-cloning) nor read without damage.

状态state = a·|0⟩ + b·|1⟩ · P(0) = a² · P(1) = b² · a² + b² = 1

0.2行李二:两种错误,两副眼镜Item 2: two errors, two lenses

噪声有两种基本手法(《从 1+1 到 Toric Code》3.3–3.5 节):X(交换两个振幅——0/1 眼镜里的翻转)与 Z(给 1-成分变号——它在 0/1 眼镜里隐形,却是 +/− 眼镜里的翻转,其中 |±⟩ = (|0⟩±|1⟩)/√2)。同一比特上 X 与 Z 反对易:交换先后顺序,差一个整体 −1。在复习台上戴两副眼镜各看一遍:

Noise has two elementary moves (“From 1+1 to the Toric Code”, §3.3–3.5): X (swap the amplitudes — a flip in the 0/1 lens) and Z (re-sign the 1-part — invisible in the 0/1 lens, yet a genuine flip in the +/− lens, where |±⟩ = (|0⟩±|1⟩)/√2). On one qubit X and Z anticommute: swapping their order costs one overall −1. Watch through both lenses:

X(a,b) = (b,a) · Z(a,b) = (a,−b) · XZ = −ZX

0.3行李三:不偷看的检查与碰撞规则Item 3: no-peek checks and the collision rule

多比特检查如 Z₁Z₂ 只问「这两个比特一样吗」(+1/−1),绝不问「各是什么」——它不破坏合法的叠加。编码状态被要求对清单上的每条检查都「必然 +1」;清单的学名是稳定子(《从 1+1 到 Toric Code》4.4 节)。计数规则有三个前提:检查两两对易(同时测不会互相打扰);它们独立(没有一条是其他几条的乘积);任何几条相乘都不等于 −I(否则「全部通过」要求 |ψ⟩ = −|ψ⟩,没有态能做到,例如 XZZ、ZXZ、ZZX、XXX 两两对易,四条之积却是 −I)。本页的检查每条要么全是 X、要么全是 Z,第三条自动成立:同一个比特上 X·X = I、Z·Z = I,纯 X 检查相乘不会冒出负号,纯 Z 同理,而一个纯 X 串乘一个纯 Z 串要等于 ±I,两者必须各自就是 I。满足这三条时,n 个比特配 r 条检查,每加一条检查编码空间砍半,一共砍 r 次,剩下 k = n − r 个逻辑量子比特;k 数逻辑比特,和编码论的写法 [[n, k, d]] 一致(同一节的记号说明)。错误 E 触发检查 S 报警,当且仅当 E 与 S 反对易;判据是数格子:

Multi-qubit checks like Z₁Z₂ ask only “are these two equal?” (+1/−1), never “what are they?” — legal superpositions survive. Encoded states must answer “+1 surely” to every check on the list (formally, the stabilizers; “From 1+1 to the Toric Code”, §4.4). The counting rule has three conditions: the checks commute pairwise (measuring one does not disturb another); they are independent (none is a product of the others); and no product of them equals −I (otherwise “pass them all” demands |ψ⟩ = −|ψ⟩, which no state satisfies: XZZ, ZXZ, ZZX, XXX commute pairwise, yet the product of all four is −I). On this page every check is all-X or all-Z, and then the third condition holds by itself: on one qubit X·X = I and Z·Z = I, so a product of all-X checks never picks up a minus sign, likewise for all-Z, and an all-X string times an all-Z string can equal ±I only if each is I on its own. Under these three conditions, n qubits with r checks: each check halves the code space, r halvings in all, leaving k = n − r logical qubits; k counts logical qubits, as in the coding-theory label [[n, k, d]] (see the notation note in that same section). An error E trips a check S exactly when E and S anticommute; the test is cell-counting:

警报 ⇔ 反对易 ⇔ X 撞 Z 的格数为奇数alarm ⇔ anticommute ⇔ odd number of X-meets-Z cells · k = n − r (检查对易、独立、乘积不出 −Ichecks commute, are independent, no product equals −I)

0.4行李四:toric code 全图Item 4: the toric code at a glance

L×L 的绕回网格(环面;《从 1+1 到 Toric Code》5.1–5.3 节):每条边一个量子比特(共 2L²);每个顶点一条星形检查 Av(4 条边上的 X),每块面一条面检查 Bp(4 条边上的 Z)。星与面永远共享 0 或 2 条边(角连两边),所以全体检查对易。两条「乘积=I」的恒等式让独立检查只有 2L²−2 条——环面恰好存 2 个逻辑量子比特。

An L×L wrap-around grid (a torus; “From 1+1 to the Toric Code”, §5.1–5.3): one qubit per edge (2L² total); at each vertex a star check Av (X on its 4 edges), on each face a face check Bp (Z on its 4 edges). A star and a face always share 0 or 2 edges (corners touch two sides), so all checks commute. Two “product = I” identities leave 2L²−2 independent checks — the torus stores exactly 2 logical qubits.

Av = XXXX · Bp = ZZZZ · ∏Av = ∏Bp = I (∏ = 全部乘起来multiply them all) · k = 2L² − (2L²−2) = 2

0.5行李五:链、警报、圈Item 5: chains, alarms, loops

错误连成链,警报只亮在链的端点(《从 1+1 到 Toric Code》5.4–5.8 节;链中间偶数次相撞,抵消)。闭合且可收缩的圈 = 若干检查的乘积 = 对编码信息什么也不做;缠绕环面一整圈的圈通过所有检查却改写逻辑信息——它就是逻辑算符 Z̄ / X̄,最短长度 L 即码距 d。纠错 = 给警报配对、连线修复;「错误 ⊕ 修复」(⊕:合并两批边、成对相消)可收缩则完胜、缠绕则败。到沙盘里活动一下手脚:

Errors form chains; alarms light only at endpoints (“From 1+1 to the Toric Code”, §5.4–5.8; interiors are struck an even number of times and cancel). A closed contractible loop = a product of checks = does nothing to the data; a loop winding the torus passes every check yet rewrites logical data — it is the logical operator Z̄ / X̄, of minimum length L, the distance d. Correcting = pairing alarms and joining them; “error ⊕ repair” (⊕: merge the two edge sets with pairwise cancellation) contractible = win, winding = loss. Stretch your legs in the sandbox:

五件行李齐了All five items packed

量子比特与平方规则 ✓ 两种错误 ✓ 警报=反对易 ✓ 星与面 ✓ 链与圈 ✓。出发。

Qubit & square rule ✓ two errors ✓ alarm = anticommute ✓ stars & faces ✓ chains & loops ✓. Off we go.

第 1 章Chapter 1

为什么要剪开环面Why cut the torus open

环面码的一切优点都依赖「绕回去」的连线。可常见的超导量子芯片是一块平板,比特只和身边的邻居直接耦合。这一章直面代价:剪开会破坏什么、又必须保留什么。 Every virtue of the toric code leans on wrap-around wiring. But a common superconducting chip is a flat slab whose qubits couple directly only to their nearest neighbours. This chapter faces the price: what cutting destroys, and what must survive.

先看清「绕回去」在硬件上意味着什么:最右一列的比特要和最左一列做同一条检查——两端相隔整块芯片的导线,要么飞跨芯片(工艺噩梦),要么把整个平面卷成圆筒再接成环(更是噩梦)。本页设想的是一种常见的超导芯片版图:比特固定在平面上,每个比特只和隔壁的比特直接耦合,排成只连邻居的方形阵列。这是这种版图的限制,不是物理定律:超导比特也可以借助一条共享的微波波导与较远的比特相互作用(例如 Zanner 等人 2022 年在 Nature Physics 上的实验,arXiv 2106.05623,四个比特经同一条波导耦合),离子阱和中性原子则可以搬运比特,只是搬得越远越慢、越容易出错。在这种近邻方阵上,每条检查最好只碰近邻,这就是剪开环面的动机。

First, what wrap-around means in hardware: qubits in the rightmost column must share checks with the leftmost — wiring that leaps across the whole chip (a fabrication nightmare), or a plane rolled into a tube and closed into a ring (worse). This page assumes a common superconducting layout: qubits fixed in a plane, each coupled directly only to its neighbours, forming a square array wired only to neighbours. That is a limit of this layout, not a law of physics: superconducting qubits can also interact with more distant ones through a shared microwave waveguide (for example the 2022 Nature Physics experiment of Zanner et al., arXiv 2106.05623, with four qubits coupled through one waveguide), and ion traps and neutral atoms can move qubits around, though the farther they move, the slower and more error-prone it gets. On a nearest-neighbour square array each check should touch only neighbours, and that is the reason to cut the torus open.

那就拿起剪刀。但《从 1+1 到 Toric Code》5.3 节的记账立刻警告我们,这一刀不便宜。环面的账本是:

So pick up the scissors. But the ledger of “From 1+1 to the Toric Code”, §5.3 warns at once: this cut is not free. On the torus,

n = 2L² · 检查checks = 2L²,其中独立的of which independent 2L²−2 ⇒ k = 2

那两条「白送的恒等式」(∏Av = I,∏Bp = I)之所以成立,全靠「每条边恰好被两颗星、两块面分享」——这是绕回世界才有的完美均匀。剪开后边缘出现残缺检查,恒等式失效,k 会掉回 0?还是能抢救出 1 个逻辑比特?下面把整个手术分三步看完:

Those two “free identities” (∏Av = I, ∏Bp = I) held because every edge is shared by exactly two stars and two faces — the perfect uniformity only a wrap-around world provides. After the cut, mutilated checks appear along the rim, the identities die — does k crash to 0, or can one logical qubit be rescued? Watch the whole surgery in three steps:

第 ③ 步不是随手收拾,而是本教程的主角登场。上下两侧让星缺一条腿(三腿星是合法检查);左右两侧让面缺一条腿——并且额外保留悬在边缘的半截边(每条上仍住着一个量子比特)。这两种「收边方式」性质完全不同,是下一章的全部内容。

Step ③ is not casual tidying — it is this tutorial's protagonist entering. On the top/bottom sides the stars lose one leg (a three-leg star is a legal check); on the left/right the faces lose one leg — and the dangling half-edges are kept, each still housing a qubit. These two ways of hemming an edge behave utterly differently, and they are the whole of the next chapter.

第 2 章Chapter 2

两种边界:毛边与光边Two kinds of boundary: rough and smooth

剪开后的版图上,左右两侧和上下两侧长得不一样、职责也不一样。给它们起名、立规矩、再重新记账——账本将给出一个漂亮到可疑的答案:1。 On the cut-open layout, the left/right sides and the top/bottom sides look different and act differently. Name them, write their rules, redo the ledger — which returns an answer almost suspiciously pretty: 1.

看上一章第 ③ 步的成品。左右两侧参差地伸出半截边,像布料的毛边——叫它毛边界悬挂着半截边(每条半截边上仍有一个量子比特)的边界。这里的面检查缺一条腿(三腿 Z 检查)。通称「粗糙边界 rough boundary」。(术语:粗糙边界):这里的面检查只剩三条腿,Bp = ZZZ。上下两侧剪得干净利落,没有悬边——叫它光边界没有悬挂边、被顶点收束的边界。这里的星形检查缺一条腿(三腿 X 检查)。通称「光滑边界 smooth boundary」。(术语:光滑边界):这里的星检查只剩三条腿,Av = XXX。

Inspect step ③'s result. The left and right sides sprout ragged half-edges, like fabric's frayed hem — call it the rough boundaryA boundary with dangling half-edges (each still carrying a qubit). Face checks here lose a leg (three-leg Z checks).: here the face checks keep only three legs, Bp = ZZZ. The top and bottom are cut clean, no danglers — the smooth boundaryA boundary hemmed by vertices, no dangling edges. Star checks here lose a leg (three-leg X checks).: here the star checks keep three legs, Av = XXX.

内部bulk: Av=XXXX, Bp=ZZZZ · 光边界smooth: Av=XXX · 毛边界rough: Bp=ZZZ

先验收老规矩还在不在:任何星与任何面,共享边数仍然只能是 0 或 2(角连两边的几何论证只依赖局部形状,边界处照样成立——在下面的实验台上开「显示检查」自行核对)。所有检查依旧两两对易 ✓。

First re-inspect the old rule: any star and any face still share exactly 0 or 2 edges (the corner-touches-two-sides argument is purely local and survives at boundaries — verify on the bench below). All checks still commute pairwise ✓.

然后重新记账。设「距离参数」d既是版图的尺寸,也是码距:最短横跨串恰走 d 条边(第 3 章的补课 3.A 证明)。:版图有 d 行横边,每行 d 条(两端各一条悬边),顶点排成 d 行 d − 1 列(下面的蓝图是 d = 3,实验台可切换 d)。数出来的结果永远是:

Then redo the ledger. With the size parameter dBoth the layout size and the code distance: the shortest spanning string uses exactly d edges (proved in Catch-up 3.A).: the layout has d rows of horizontal edges, d per row (with a dangling one at each end), and its vertices form d rows and d − 1 columns (the blueprint below is d = 3; the bench lets you switch d). The counts always come out to:

n = d² + (d−1)² · 星stars = d(d−1) · 面faces = d(d−1) · 平面上没有恒等式,全体独立no identities on a plane — all independent

数一数 d = 3 的蓝图:横边 3 行 × 3 条 = 9,竖边 2 行 × 2 条 = 4,n = 13 = 3² + 2²;星 = 3 行 × 2 列 = 6,面 = 2 行 × 3 列 = 6。点上下两排的顶点,会看到三条腿的星(光边界);点最左、最右一列的方块,会看到三条腿的面(毛边界)。

Count the d = 3 blueprint: horizontal edges 3 rows × 3 = 9, vertical edges 2 rows × 2 = 4, n = 13 = 3² + 2²; stars = 3 rows × 2 columns = 6, faces = 2 rows × 3 columns = 6. Click a vertex in the top or bottom row to see a three-legged star (smooth boundary); click a square in the leftmost or rightmost column to see a three-legged face (rough boundary).

小灰点 = 边上的量子比特small grey dot = a qubit on an edge 橙圈 = 顶点上的星形检查orange ring = star check at a vertex 蓝方块 = 面检查blue square = face check 左右伸出的线头 = 悬边(毛边界);上下无悬边(光边界)stubs sticking out left and right = dangling edges (rough); none at top and bottom (smooth)

为什么恒等式没了?把全部星相乘:内部每条边仍被两颗星分享而抵消,但悬边只被一颗星碰到——乘积在每条悬边上都剩一个孤零零的 X,不等于 I。「白送的减 2」消失。这只说明「全部星的乘积」不是 I;别的挑法也不行,理由在下面的补课 2.A。于是独立检查 r = 2d(d − 1):

Why did the identities die? Multiply all the stars: interior edges still cancel (two stars each), but a dangling edge is touched by only one star — the product leaves a lone X on every dangler, ≠ I. The free “−2” is gone. That only shows the product of all stars is not I; no other selection works either, for the reason in Catch-up 2.A below. So there are r = 2d(d − 1) independent checks:

k = n − r = d² + (d−1)² − 2d(d−1) = (d − (d−1))² = 1² = 1 (d = 3: 13 − 12 = 1)
补课 · 为什么平面上一条依赖都没有Catch-up · Why the plane has no dependency at all

和环面上的论证(《从 1+1 到 Toric Code》补课 5.A)一样,问:挑出哪些星乘起来等于 I?边上 X 的个数 = 它的端点里被挑中的个数,乘积为 I 要求每条边的两端「同进同出」。区别在悬边:它只有一个顶点端点,另一头伸出芯片、没有星。所以悬边所连的那颗星不能被挑中;它的邻居因此也不能被挑中……一路扩散,一颗星也不能挑。面同理:光边界上的横边只挨着一块面,那块面不能挑,扩散后一块也不能挑。星和面混挑也不行(X 和 Z 不会互相抵消)。所以没有任何一条检查是其他检查的乘积,r = 全部检查数 = 2d(d − 1)。

As on the torus (Catch-up 5.A of “From 1+1 to the Toric Code”), ask: which selections of stars multiply to I? The number of X's on an edge is the number of its endpoints that were picked, and the product is I only if both ends of every edge are picked or neither. The difference is the dangling edge: it has only one vertex endpoint; its other end leaves the chip, where there is no star. So the star at a dangling edge cannot be picked; hence neither can its neighbours, and so on: no star can be picked at all. Faces likewise: a horizontal edge on a smooth boundary borders only one face, so that face cannot be picked, and the spreading rules out every face. Mixing stars and faces does not help (X and Z do not cancel each other). So no check is a product of other checks, and r = the total number of checks = 2d(d − 1).

用 d = 3 的蓝图走一遍:左上角的星(腿是 1、2、10)连着悬边 1,1 号比特只属于这一颗星,所以它不能挑;它的右邻、下邻依次被排除,6 颗星全被排除。

Walk it through on the d = 3 blueprint: the top-left star (legs 1, 2, 10) touches dangling edge 1, and qubit 1 belongs to that star alone, so it cannot be picked; its right and lower neighbours are then ruled out in turn, until all 6 stars are.

关键想法Key idea

代数在这里眨了下眼睛:d²+(d−1)²−2d(d−1) 恰是完全平方公式 (x−y)² = x²−2xy+y² 的右边,x=d、y=d−1,答案永远是 1。平面版图对任何尺寸 d 都恰好存 1 个逻辑量子比特。这就是 surface code(表面码),写成 [[d² + (d−1)², 1, d]],d = 3 时是 [[13, 1, 3]](码距 d 在第 3 章证明)。

The algebra winks at us: d²+(d−1)²−2d(d−1) is exactly the right side of (x−y)² = x²−2xy+y² with x=d, y=d−1 — always 1. The planar layout stores exactly one logical qubit at every size d. This is the surface code, written [[d² + (d−1)², 1, d]]; for d = 3 it is [[13, 1, 3]] (the distance d is proved in Chapter 3).

检查站Checkpoint第 2 章Chapter 2
把全部面检查(Z 型)相乘,会剩下什么?Multiply all the face (Z-type) checks together. What survives?

对,镜像于正文里星的论证:光边界上的横边只属于一块面(它的另一侧已经出了芯片),所以乘积在那里剩下一个 Z。注意缺腿的是另一回事:面在毛边界缺腿,星在光边界缺腿。两族的「独立性」都由各自的边界保证——两种边界各司其职的第一个迹象。

Right — the mirror of the stars argument: a horizontal edge on the smooth boundary belongs to only one face (its other side is off the chip), so the product leaves a Z there. Missing legs are a separate matter: faces lose a leg at the rough boundary, stars at the smooth one. Each family's independence is guaranteed by its own boundary — the first sign of the two boundaries' division of labour.

哪些边只被一块面碰到?悬边是「面的三条腿」之一吗?画个 d=2 的小图数一数。

Which edges are touched by only one face? Is a dangling edge one of a face's three legs? Sketch d=2 and count.

第 3 章Chapter 3

终止在边界上的链Chains that end on boundaries

环面上,警报永远成双成对。平面上不再如此:链可以把一端(甚至两端)搭在边界上,让警报凭空少一个。这既是新的麻烦,也是逻辑比特的新藏身处。 On the torus, alarms always came in pairs. Not on the plane: a chain may rest one end (or both) on a boundary, making an alarm simply vanish. A fresh nuisance — and the logical qubit's new hiding place.

3.1毛边界吃掉 Z-链的警报The rough boundary swallows Z-chain alarms

回想警报的机理(《从 1+1 到 Toric Code》5.4 节):Z-链的端点处,有一颗星被链奇数次撞到,于是报 −1。现在让一条 Z-链一路画到左侧的悬边上。悬边朝外的那一头,本该有下一颗星——但那里根本没有星(芯片到头了)。没有检查,就没有警报。链的这一端就这样无声地「死」在了毛边界上:

Recall the alarm mechanism (“From 1+1 to the Toric Code”, §5.4): at a Z-chain's endpoint some star is struck an odd number of times and reads −1. Now draw a Z-chain out onto a dangling edge at the left. Beyond the dangler's outer tip there ought to be a next star — but no star exists there (the chip has ended). No check, no alarm. That end of the chain quietly “dies” on the rough boundary:

警报数 = 不在边界上的端点数#alarms = #endpoints not resting on a boundary (Z-链 ↔ 毛边界;X-链 ↔ 光边界Z-chains ↔ rough; X-chains ↔ smooth)

分工是严格的。Z-链若把端点搭在上下(光)边界的边上,那里的三腿星照样看得见它——照样报警(去下面验证)。同理,X-链只能死在光边界;毛边界对它绝不留情。一种边界赦免一种链,恰好和「面在毛边界缺腿、星在光边界缺腿」一一对应。

The division of labour is strict. Rest a Z-chain's end on a top/bottom (smooth) edge and the three-leg star there still sees it — still alarms (verify below). Likewise X-chains may die only on the smooth boundary; the rough one shows them no mercy. Each boundary pardons one kind of chain — matching exactly “faces truncated at rough, stars truncated at smooth”.

3.2横跨两条毛边界 = 逻辑 Z̄Spanning rough to rough = the logical Z̄

把 3.1 推到极致:一条 Z-链两端都搭在毛边界上——从最左的悬边一路画到最右的悬边。零警报!它通过了全部检查。它是无害的「检查乘积」吗?不是:面检查无论怎样相乘,都造不出横穿整块芯片的串(下一个折叠盒用一次碰撞计数证明)。通过一切检查、又不是检查的乘积——按《从 1+1 到 Toric Code》5.6 节的定义,这是一条逻辑算符:

Push §3.1 to the limit: a Z-chain resting both ends on the rough boundary — drawn from a leftmost dangler clean across to a rightmost one. Zero alarms! It passes every check. Is it a harmless product of checks? No: however you multiply face checks, you can never manufacture a string crossing the whole chip (the fold-out below proves it with one collision count). Passing all checks yet not a product of them — by the definition of “From 1+1 to the Toric Code”, §5.6, a logical operator:

Z̄ = Z-串:毛边界 → 毛边界(左 ↔ 右)-string: rough → rough (left ↔ right) · X̄ = X-串:光边界 → 光边界(上 ↔ 下)-string: smooth → smooth (top ↔ bottom) (→:串从一条边界连到另一条;↔:这一对边界→: the string runs from one boundary to the other; ↔: which pair of boundaries)
为什么横跨的串一定不是面检查的乘积?Why can a spanning string never be a product of face checks?

用对易性替我们查账。横跨的 Z̄ 与竖跨的 X̄ 恰好交叉一次——按碰撞规则,二者反对易。可任何「面检查的乘积」都必须与 X̄ 对易:X̄ 与每条单独的面检查都对易(X̄ 竖直穿行时,与任何面共享 0 或 2 条边),与它们的乘积自然也对易。一个反对易、一个必须对易——矛盾。所以 Z̄ 不在乘积清单上。这个论证同时送我们最后一块拼图:Z̄ 与 X̄ 反对易,正是一对合格逻辑比特算符的签名(同一教程 5.6 节)。

Let commutation audit the books. The spanning Z̄ and the vertical X̄ cross exactly once — by the collision rule they anticommute. But any product of face checks must commute with X̄: X̄ commutes with each individual face check (running vertically it shares 0 or 2 edges with any face), hence with any product. Anticommuting versus must-commute — contradiction. So Z̄ is not on the product list. The same argument hands us the final puzzle piece: Z̄ and X̄ anticommute — precisely the signature of a proper logical pair (§5.6 there).

最短的横跨串要走 d 条边,所以码距是 d——和第 2 章账本里的 1 个逻辑比特配成一套。「最短恰好 d 条、没有更短的逻辑算符」的理由在下面的补课 3.A。

The shortest spanning string uses d edges, so the distance is d — completing the set with Chapter 2's single logical qubit. The reason why the shortest has exactly d edges, with no shorter logical operator, is in Catch-up 3.A below.

补课 · 为什么码距恰好是 d:没有比 d 条边更短的逻辑算符Catch-up · Why the distance is exactly d: no logical operator shorter than d edges

这里的「逻辑算符」都指非平凡的:通过全部检查,却不是检查的乘积(检查的乘积对编码态什么都不做,不算数)。先看纯 Z 的串。没有星报警,意味着每个顶点碰到的串边数都是偶数。所以串边连成若干段:要么是闭合的圈,要么是两端都停在没有顶点的地方,也就是毛边界上悬边的外端。每一段只有三种:

“Logical operator” here always means a nontrivial one: it passes every check but is not a product of checks (a product of checks does nothing to encoded states and does not count). Start with pure Z strings. No star fires, so every vertex touches an even number of string edges. The string edges therefore form pieces that are either closed loops or paths ending where there is no vertex, that is, at the outer ends of dangling edges on a rough boundary. Each piece is one of three kinds:

① 闭合的圈;② 两端落在同一侧毛边界上的路;③ 从左侧毛边界走到右侧毛边界的路。①、② 各自和边界一起围出一块面,把这块面里的面检查全部相乘,内部边成对抵消,剩下的正好是这一段(贴毛边界的面在那一侧本来就没有腿,不会多出东西)。所以 ①、② 都是面检查的乘积,对编码态什么都不做。一条串若没有 ③ 型的段,它整条就是面检查的乘积;所以非平凡的 Z 型逻辑算符至少含一条 ③ 型的段。(③ 型的段有偶数条时,整条串仍是面检查的乘积,见 3.2 节正文的两条串例子;这里的下界只用到「至少一条」。)

① a closed loop; ② a path with both ends on the same rough side; ③ a path from the left rough boundary to the right one. Pieces ① and ②, together with the boundary, enclose a patch of faces; multiply all the face checks of that patch, the interior edges cancel in pairs, and what remains is exactly the piece (faces against a rough boundary have no leg on that side, so nothing extra appears). So ① and ② are products of face checks and do nothing to encoded states. A string with no piece of kind ③ is, as a whole, a product of face checks; so a nontrivial Z-type logical operator contains at least one piece of kind ③. (With an even number of kind-③ pieces the string is still a product of face checks, as the two-string example in the main text of §3.2 shows; the lower bound here needs only “at least one”.)

③ 型的路从 x = 0(左侧悬边的外端)走到 x = d(右侧悬边的外端),横向每走一格都要用一条横边,所以至少 d 条边。第 2 行的直线串恰好 d 条,于是 Z 型逻辑算符最短 d 条。

A path of kind ③ travels from x = 0 (the outer end of a left dangler) to x = d (the outer end of a right dangler), and every unit step sideways uses one horizontal edge, so it has at least d edges. The straight string along row 2 has exactly d, so the shortest Z-type logical operator has d edges.

X 型要换一副眼镜看。一条 X 串不触发面警报,只说明每块面被它碰到偶数次,并不要求它横穿芯片:单独一颗星就是反例,比如蓝图里中间那颗星的 X4X5X10X12 通过所有面检查,可它本身就是一条检查。为了看清形状,把每条 X 边换成一小段对偶线:横穿这条边、连接它两侧的两块面(边在最上一行或最下一行时,一侧是芯片外)。「每块面被碰偶数次」就是「每块面连出偶数段对偶线」,于是对偶线也拼成三种段:① 闭合的小圈,例如一颗星对应绕它的顶点一圈;② 两端都在同一条光边界之外的路;③ 从上光边界之外穿到下光边界之外的路。①、② 圈住一些顶点,把这些顶点的星相乘,圈内的边成对抵消,剩下的正好是这一段,所以它们无害。非平凡的 X 型逻辑算符因此至少含一条 ③ 型的对偶路:它从第 1 行横边的上方走到第 d 行横边的下方,每一行横边至少穿过一条,所以至少 d 条边。中间一列的 X̄ 恰好 d 条。

The X side needs a different pair of glasses. An X string that sets off no face alarm only touches every face an even number of times; nothing forces it across the chip. A single star is a counterexample: in the blueprint, the middle star X4X5X10X12 passes every face check, and it is itself a check. To see the shapes, replace every X edge by a short dual segment that crosses the edge and joins the two faces on either side of it (for an edge in the top or bottom row, one side is off the chip). “Every face touched an even number of times” becomes “every face has an even number of dual segments”, so the dual segments also form three kinds of piece: ① a small closed loop, e.g. a star is a loop around its vertex; ② a path with both ends off the same smooth boundary; ③ a path from off the top smooth boundary to off the bottom one. Pieces ① and ② enclose some vertices; multiply the stars of those vertices, the edges inside cancel in pairs, and what remains is exactly the piece, so they are harmless. A nontrivial X-type logical operator therefore contains a dual path of kind ③; it goes from above the first row of horizontal edges to below the d-th row and crosses at least one horizontal edge in every row, so it has at least d edges. The X̄ down the middle column has exactly d.

最后,逻辑算符也可以 X、Z 混着用(某个比特上可以是 Y,Y = iXZ,就是 X 和 Z 同时作用,差一个相位)。把它拆成「X 部分」和「Z 部分」。星检查是纯 X,它和算符对不对易,只看算符的 Z 部分和它碰撞几格;面检查是纯 Z,只看 X 部分。所以两部分各自通过全部检查。如果两部分都是检查的乘积,整个算符也是检查的乘积(差一个整体相位),是平凡的。所以非平凡的混合算符至少有一部分是非平凡的纯 X 或纯 Z 逻辑算符,那一部分至少碰 d 个比特;整个算符碰到的比特是两部分的并集(一个 Y 同时出现在两部分,但只占一个比特),不会更少。所以码距 dX = dZ = d,混合算符也短不过 d。本页的核对脚本对 d = 2、3、4 枚举了所有更短的 Z 串,又对 d = 2、3 枚举了所有少于 d 个比特的 X/Y/Z 组合,确认没有一个是非平凡的逻辑算符。

Finally, a logical operator may mix X and Z (on some qubit it may be a Y; Y = iXZ, i.e. X and Z acting together, up to a phase). Split it into its “X part” and its “Z part”. Star checks are pure X, so whether one commutes with the operator depends only on how many cells it shares with the Z part; face checks are pure Z and see only the X part. So each part passes every check on its own. If both parts are products of checks, so is the whole operator (up to an overall phase), and it is trivial. So a nontrivial mixed operator has at least one part that is a nontrivial pure-X or pure-Z logical operator, touching at least d qubits; the whole operator touches the union of the two parts (a Y appears in both parts but occupies one qubit), which is no smaller. Hence dX = dZ = d, and no mixed operator is shorter. The page's check script enumerated every shorter Z string for d = 2, 3, 4, and every X/Y/Z combination on fewer than d qubits for d = 2, 3, and found no nontrivial logical operator among them.

还有一处要小心:错误里「有一条横跨串」,不等于信息被改写。看蓝图最上面两行横边:串 ① = Z1Z2Z3,串 ② = Z4Z5Z6。每条单独拿出来都从左毛边界走到右毛边界,都是一个 Z̄。可两条合起来,正好是夹在它们中间那一排 3 块面检查的乘积:Z1Z4Z10 · Z2Z5Z10Z11 · Z3Z6Z11,10、11 号各出现两次、互相抵消(Z·Z = I),剩下的正是 Z1…Z6。所以两条平行的横跨串合起来对编码态什么也不做:Z̄ 做了两次,等于没做。真正的判据是奇偶。拿 X̄ 当测试线(中间一列,比特 2、5、8),数一条不报警的 Z 串和它交叉几次,也就是共享几个比特:奇数次 = 净做了一次 Z̄,逻辑错误;偶数次 = 检查的乘积,无害。串 ①、② 合起来交叉 2 次(比特 2 和 5)。理由很短:不报警的 Z 串都是「若干面检查」或「若干面检查乘一个 Z̄」,每块面和 X̄ 共享 0 或 2 个比特,Z̄ 和 X̄ 共享 1 个,所以交叉次数的奇偶正好告诉你里面有没有那个 Z̄。

One more point needs care: an error that “contains a spanning string” has not necessarily rewritten the data. Look at the top two rows of horizontal edges in the blueprint: string ① = Z1Z2Z3, string ② = Z4Z5Z6. Each on its own runs from the left rough boundary to the right one and is a Z̄. But together they are exactly the product of the row of 3 face checks between them: Z1Z4Z10 · Z2Z5Z10Z11 · Z3Z6Z11; qubits 10 and 11 appear twice and cancel (Z·Z = I), leaving exactly Z1…Z6. So two parallel spanning strings together do nothing to encoded states: Z̄ applied twice is no change at all. The real criterion is a parity. Use X̄ as a test line (the middle column, qubits 2, 5, 8) and count how often an alarm-free Z string crosses it, i.e. how many qubits they share: odd = one net Z̄, a logical error; even = a product of checks, harmless. Strings ① and ② together cross it twice (qubits 2 and 5). The reason is short: an alarm-free Z string is either a product of face checks or such a product times one Z̄; every face shares 0 or 2 qubits with X̄ and Z̄ shares 1, so the parity of the crossing count tells you whether that Z̄ is there.

回到第 2 章的蓝图,按「显示 Z̄」「显示 X̄」可以看到这一对串和它们唯一的共享比特。再在实验台里亲手画一条(也试试画不满全程、看警报怎么揭发你):

Back in Chapter 2's blueprint, the “Show Z̄” and “Show X̄” buttons display this pair of strings and the single qubit they share. Now draw one by hand on the bench (and try stopping short, to see the alarms rat you out):

关键想法Key idea

环面上,逻辑信息藏在「绕不绕得回来」里;平面上,它藏在「横不横得过去」里。缠绕圈换成了边界到边界的横跨串,其余一切——警报=端点、可收缩=无害、交叉一次=反对易——原封不动。失败的判据也照旧是奇偶:和 X̄ 交叉奇数次才是逻辑错误,两条平行的横跨串合起来无害。

On the torus, logical data hid in “does it wind around?”; on the plane, in “does it span across?”. Winding loops became boundary-to-boundary spanning strings; everything else — alarms = endpoints, contractible = harmless, one crossing = anticommute — carries over untouched. The failure criterion is still a parity: only an odd number of crossings with X̄ is a logical error, and two parallel spanning strings together are harmless.

检查站Checkpoint第 3 章Chapter 3
一条 Z-链,一端搭在左侧毛边界,另一端停在芯片内部。几个警报?A Z-chain with one end on the left rough boundary and the other stopped mid-chip. How many alarms?

对。单个警报在环面上不可能出现(那里警报必成对),在平面上却是家常便饭——译码器因此多了一种选择:把警报「配给边界」。这正是第 5 章游戏的新按钮。

Right. A lone alarm is impossible on the torus (alarms pair up there) but routine on the plane — giving the decoder a new option: match an alarm “to the boundary”. Exactly the new button in Chapter 5's game.

分端计数(3.1 的公式):不在边界上的端点,每个点亮一颗星。这条链只有一个这样的端点。

Count per endpoint (§3.1's formula): each endpoint not on a boundary lights one star. This chain has exactly one such endpoint.

第 4 章Chapter 4

一轮完整的纠错One full correction cycle

把所有零件装配成一台会运转的机器:出错、测量、配对、修复,循环往复。这一章还会打开一个此前一直合着的黑盒——「测量一条检查」在真实芯片上到底是怎么做到的。 Assemble every part into a running machine: err, measure, match, repair, repeat. This chapter also opens a box kept shut so far — how “measuring a check” is actually done on a real chip.

4.1机器的四拍The machine's four beats

表面码存储器的一生就是同一支四拍舞:噪声悄悄放下几条链 → 测量全部检查、警报点亮链的端点 → 译码器读取全部警报、决定修复方案的(经典)算法。平面版可以把警报配给另一个警报,也可以配给最近的同类边界。把警报两两配对或配给边界 → 沿配对路径施加修复。修复后「错误⊕修复」不再触发任何警报,这时数它和 X̄ 的测试线交叉几次(3.2 节):偶数次(只有小圈、贴边的弧,或成对的横跨串)——无害;奇数次——逻辑错误。看它自动运转:

A surface-code memory's life is one four-beat dance: noise quietly lays down chains → all checks are measured, alarms lighting the chains' endpoints → the decoderThe (classical) algorithm that reads all alarms and decides the repair. On the plane it may match an alarm to another alarm or to the nearest boundary of the right kind. pairs alarms with each other or with a boundary → repairs are applied along the pairing paths. After the repair, “error ⊕ repair” sets off no alarm; now count how often it crosses X̄'s test line (§3.2): an even number (only small loops, boundary-hugging arcs, or spanning strings in pairs) — harmless; an odd number — a logical error. Watch it run:

每一轮each round: 噪声noise → 测检查measure checks → 配对(含边界)match (incl. boundary) → 修复repair · 失败 ⇔ 错误⊕修复 与 X̄ 交叉奇数次failure ⇔ error ⊕ repair crosses X̄ an odd number of times

4.2打开黑盒:谁去问「四条边的奇偶」?Opening the box: who asks the four-edge parity?

「测量 Bp」说来轻巧,可没有任何仪器能一口气「读四个量子比特的联合奇偶」。真实的做法是给每条检查配一个专职的帮手量子比特(术语:辅助比特不存储数据、专职收集一条检查的奇偶并被读出的量子比特。英文 ancilla。真实芯片上数据比特与辅助比特约各占一半。,ancilla):让它挨个「碰」一遍那 4 个数据比特——每次接触都是一个两比特小操作,把一份奇偶信息叠进帮手——最后只测量帮手。数据比特从头到尾没被直接读过,四拍问询的净效果恰好就是我们从《从 1+1 到 Toric Code》一路用到这里的那句问话:「你们四个的联合奇偶是 +1 还是 −1?」

“Measure Bp” is easy to say, but no instrument reads “the joint parity of four qubits” in one gulp. The real recipe assigns each check its own dedicated helper qubit (term: the ancillaA qubit that stores no data; its job is to collect one check's parity and be read out. On real chips data and ancilla qubits are roughly half and half.): it “touches” the 4 data qubits one at a time — each touch a small two-qubit operation folding one parity's worth of information into the helper — and then only the helper is measured. The data qubits are never read directly, and the four-touch routine asks precisely the question “From 1+1 to the Toric Code” and this tutorial have leaned on: “is your joint parity +1 or −1?”

q1 q2 q3 q4 帮手helper ①②③④ ±1 只读帮手read helper
图 4.1Figure 4.1 一次面检查的实测流程:中央的帮手比特按 ①②③④ 依次与四个数据比特(蓝点)作用,然后单独被读出,给出 ±1。帮手事先准备成 0;数据比特全程未被直接测量。星形检查问的是 ± 眼镜下的奇偶,帮手放在顶点上,做法略有不同(见下面的折叠盒)。 Measuring one face check: the central helper interacts with the four data qubits (blue dots) in order ①②③④, then is read out alone, yielding ±1. The helper starts in 0; no data qubit is ever measured directly. Star checks ask for the parity in the ± lens, with the helper at a vertex, and differ slightly (see the fold-out below).
那个「碰一下」具体是什么操作?What exactly is one “touch”?

它是一种叫「受控翻转」(CNOT)的两比特操作:控制比特是 1 时翻转目标比特,是 0 时不动。测面检查(Z 型)时,帮手先准备成 0,再以四个数据比特依次为控制、帮手为目标各做一次。按线性规则(《从 1+1 到 Toric Code》补课 4.D)逐个成分算:成分 |b₁b₂b₃b₄⟩ 做完四次后,帮手变成 b₁⊕b₂⊕b₃⊕b₄,即这四位里 1 的个数的奇偶。

It is a two-qubit operation called the controlled flip (CNOT): flip the target if the control is 1, do nothing if it is 0. To measure a face check (Z type), the helper starts in 0, and each of the four data qubits in turn acts as control with the helper as target. By the linearity rule (Catch-up 4.D of “From 1+1 to the Toric Code”), component by component: after the four steps, the component |b₁b₂b₃b₄⟩ has its helper set to b₁⊕b₂⊕b₃⊕b₄, the parity of the number of 1s among the four.

用两个数据比特的小例子看它为什么不破坏叠加。数据 α|00⟩ + β|11⟩、帮手 0:两次 CNOT 后是 α|00⟩|0⟩ + β|11⟩|0⟩,两个成分里帮手都是 0,读出 0(记作 +1),数据仍是 α|00⟩ + β|11⟩。数据 α|01⟩ + β|10⟩:两个成分里帮手都是 1,读出 1(记作 −1),数据同样不动。只有两种奇偶混在一起时才有变化:α|00⟩ + β|01⟩ 变成 α|00⟩|0⟩ + β|01⟩|1⟩,读帮手以 α² 的概率得 0、数据随之变成 |00⟩,这正是那份教程 4.2 节「只删掉落选组」的规则。帮手读出的只有奇偶,同一奇偶的成分之间的叠加完好无损。

A two-data-qubit example shows why no superposition is destroyed. Data α|00⟩ + β|11⟩ with the helper in 0: after two CNOTs we have α|00⟩|0⟩ + β|11⟩|0⟩; the helper is 0 in both components, reads 0 (recorded as +1), and the data is still α|00⟩ + β|11⟩. Data α|01⟩ + β|10⟩: the helper is 1 in both components, reads 1 (recorded as −1), and again the data is untouched. Only when both parities are mixed does anything change: α|00⟩ + β|01⟩ becomes α|00⟩|0⟩ + β|01⟩|1⟩; reading the helper gives 0 with probability α², and the data becomes |00⟩, which is exactly the “delete the losing group” rule of §4.2 of that tutorial. The helper reads out the parity and nothing else; superpositions among components of equal parity survive intact.

星形检查(X 型)要问的是 ± 眼镜下的奇偶。做法是两副眼镜互换:帮手先准备成 |+⟩,改由帮手当控制、四个数据比特依次当目标,最后在 ± 眼镜下读帮手。门电路的其余细节(例如四次接触的先后顺序怎样排)超出本教程。

A star check (X type) asks for the parity in the ± lens. The recipe swaps the two lenses: the helper starts in |+⟩, the helper is now the control and each data qubit in turn the target, and at the end the helper is read in the ± lens. The remaining circuit details (such as how to order the four touches) are beyond this tutorial.

4.3诚实时间:测量自己也会错Honesty hour: measurements themselves fail

诚实说明Honesty box

本教程一直假设检查读数完美。真实芯片上,帮手比特会出错、读出仪器会看走眼,一次 −1 可能是假警报。解药是把测量反复做(常见做法是连测 d 轮),并且不再看读数本身,而看读数的变化:一条检查这一轮的读数和上一轮不同,就记一个检测事件某条检查本轮读数与上一轮不同的地方(第 1 轮和「开始时全是 +1」比)。读错和数据出错留下的检测事件排列不同。英文 detection event。。图 4.2 对比两种情况。(a) 读错是暂时的:c₁ 在第 2 轮读成 −1,第 3 轮又回到 +1,于是在同一条检查上留下前后相邻的两个事件。(b) 数据错误是持久的:q 翻了之后,共享它的 c₁、c₂ 从第 2 轮起一直读 −1,只在变化的那一刻、在相邻两条检查上各留一个事件。

把所有检测事件画进一张「空间 × 时间」的三维图(两维是芯片,一维是轮数),配对规则和前面一样:事件两两配对,也可以配给边界。在时间方向配成一对的,解释为读错,不动数据;在空间方向配成一对的,解释为数据错误,沿路径修复;斜着的一对两者都有。这也是为什么真实设备会一轮接一轮地不停测量全部检查,而不是只测一次。

This tutorial has assumed perfect check readings. On real chips helpers err and readout squints, so a −1 can itself be a false alarm. The cure is to repeat the measurements (a common choice is d rounds in a row) and to stop looking at the readings themselves and look at their changes: whenever a check's reading this round differs from its reading last round, record a detection eventA place where a check's reading differs from its previous round's (round 1 is compared with “all +1 at the start”). A misreading and a data error leave different patterns of detection events.. Figure 4.2 compares two cases. (a) A misreading is temporary: c₁ reads −1 in round 2 and +1 again in round 3, leaving two consecutive events on the same check. (b) A data error persists: once q has flipped, the two checks c₁, c₂ that share it read −1 from round 2 on, leaving one event on each neighbouring check at the moment of the change, and none after.

Draw all detection events in a 3-D “space × time” picture (two dimensions for the chip, one for the round number), and the matching rule is the same as before: pair events up, or pair one with a boundary. A pair joined along time is read as a misreading and the data are left alone; a pair joined in space is read as a data error and repaired along the path; a slanted pair is some of both. This is why real devices measure all the checks round after round, not just once.

(a) c₁ 在第 2 轮读错一次(a) c₁ misread once, in round 2 开始start 第 1 轮round 1 第 2 轮round 2 第 3 轮round 3 第 4 轮round 4 c₁ +1 +1 −1 +1 +1 c₂ +1 +1 +1 +1 +1 时间 →time → 读数 +1 −1 +1 +1:两个事件readings +1 −1 +1 +1: two events 同一条检查、前后相邻 → 时间方向的一对:不修数据same check, consecutive rounds→ a pair in time: no data repair (b) 第 1、2 轮之间 q 出了错(b) qubit q errs between rounds 1 and 2 开始start 第 1 轮round 1 第 2 轮round 2 第 3 轮round 3 第 4 轮round 4 c₁ +1 +1 −1 −1 −1 c₂ +1 +1 −1 −1 −1 时间 →time → 从第 2 轮起一直 −1:每条只一个事件−1 from round 2 on: one event per check 同一时刻、相邻两条检查 → 空间方向的一对:修 qsame moment, neighbouring checks→ a pair in space: repair q
图 4.2Figure 4.2 两条相邻的检查 c₁、c₂(共享数据比特 q)连测 4 轮。方格里是每轮读数,品红底 = −1;品红圆点 = 检测事件:这一轮读数和上一轮不同(第 1 轮和「开始」的 +1 比),圆点画在两轮之间。(a) 一次读错:c₁ 上前后两个事件。(b) q 上的数据错误:c₁、c₂ 上同一时刻各一个事件,之后读数一直是 −1,却不再产生事件。 Two neighbouring checks c₁, c₂ (sharing data qubit q) measured for 4 rounds. Each box holds that round's reading, magenta fill = −1; magenta dot = a detection event: the reading differs from the previous round's (round 1 is compared with the +1 at “start”), drawn between the two rounds. (a) One misreading: two events on c₁, one after the other. (b) A data error on q: one event on each of c₁ and c₂ at the same moment; the readings stay −1 afterwards but make no further events.
第 5 章Chapter 5

译码游戏 · 平面版The decoding game, planar edition

规则升级一条:警报除了两两配对,还可以「配给边界」。策略感立刻变了——靠边的警报常常推出去更便宜,但推错方向就会亲手拼出一条横跨串。 One rule upgrade: besides pairing with each other, alarms may be “matched to a boundary”. Strategy shifts at once — an alarm near the rim is often cheaper to push out, but pushing the wrong way hand-builds a spanning string.

你看到的只有警报。点击两个警报即可自动沿最短路径连线修复;点选一个警报后按「连到最近边界」则把它推出边界。全部警报清零时立即判定:错误⊕修复和 X̄ 交叉奇数次就输,偶数次就赢(游戏正是按这个奇偶判的;即使合起来有两条平行的横跨串,它们也是一片面检查的乘积,照样算你赢)。规则回顾:Z-链只在左右(毛)边界免警报,所以只有推向左右才可能「无声」;游戏里的按钮已替你选择最近的合法边界。

You see only alarms. Click two alarms to auto-join them along a shortest repair path; select one and press “pair to nearest boundary” to push it out. The verdict lands the instant all alarms clear: if error ⊕ repair crosses X̄ an odd number of times you lose, an even number you win (the game judges exactly this parity; even if the combination contains two parallel spanning strings, they are a product of face checks and you still win). Rules recap: Z-chains are pardoned only at the left/right (rough) boundary, so only pushes toward left or right can be “silent”; the button already picks the nearest legal side for you.

几盘之后,你大概会自己摸到一条经验:近的配近的,靠边的推出去。但「近」要整体地看,而且「近」本身也还不是最终目标。这里有三个层次(图 5.1)。

① 贪心配对:每次先连当前最近的两个警报,连完再找下一对。它快,却会被骗:图 (a) 里四个警报在一条线上的 0、2、3、5 处,贪心先连最近的 B–C(长 1),剩下的 A–D 只好连成长 5,共 6;而 A–B 加 C–D 只要 2 + 2 = 4。② 最小总长度配对(学名最小重量完美匹配把所有警报(可以配给边界)一次性两两配好,使全部连线的总长度最小的算法;英文 minimum-weight perfect matching,简称 MWPM。「重量」指修复链碰到的比特数。):把所有配法(包括配给边界)放在一起比较,挑总长度最小的一整套。每多一个错误,概率就多乘一个约 p 的小因子,所以 p 小时,它挑的就是「最可能发生的那一条错误链」。

③ 可我们其实不必猜中错误链本身。3.2 节说过,只要错误⊕修复和 X̄ 交叉偶数次就赢。所以和警报相符的所有错误链,按「和我的修复合起来交叉奇数次还是偶数次」分成两类;同一类里的链只差若干面检查,修哪一条效果都一样。最好的译码器(最大似然译码把每一类里所有错误链的概率加起来,选总概率最大的那一类,再从这一类里任取一条当修复。它的成功率在给定噪声模型下是最高的,但一般比配对难算得多。)把每一类里所有链的概率加起来,选总概率大的那一类。图 (b) 是 d = 3 蓝图上的一个例子:星 (2, 0)(腿 2、3、11)和星 (1, 1)(腿 4、5、10、12)报警。直接把两个警报连起来要 2 条边,有两种走法;各自推向最近的毛边界也要 2 条边,却只有一种走法,而且属于另一类。长度打平,最小总长度配对分不出高下;把所有链都算上,p 很小时「直接相连」这一类约是另一类的 2 倍可能。p = 5% 时核对脚本枚举了全部 213 种错误,精确比例是 64% 对 36%。

p 很小时,这三种译码器多数时候选的一样。4.1 节的动画和下一章的实验台用的是 ②,警报太多时退回 ①;本章游戏里配对由你自己来,它的「自动译码(示范)」按钮用的也是 ②。也试试拉高错误率滑杆:警报一多,「看起来近」的配法开始频繁酿成逻辑错误。这个「p 一大就救不回来」的体感,就是下一章的主角。

A few rounds in, you'll likely discover a rule of thumb yourself: pair near with near, push edge-huggers out. But “near” has to be judged for the whole set at once, and being near is not even the final goal. There are three levels (Figure 5.1).

① Greedy pairing: join the two closest alarms, then look for the next closest pair, and so on. It is fast but can be fooled: in panel (a) four alarms sit on a line at 0, 2, 3, 5; greedy first joins the closest pair B–C (length 1) and is left with A–D (length 5), 6 in all, whereas A–B plus C–D costs only 2 + 2 = 4. ② Minimum total length pairing (formally minimum-weight perfect matchingAn algorithm that pairs up all alarms at once (an alarm may be paired with a boundary) so that the total length of the joining paths is as small as possible; MWPM for short. “Weight” is the number of qubits a repair chain touches.): compare all pairings (including pairings to boundaries) together and pick the complete set with the smallest total length. Every extra error multiplies the probability by a small factor of about p, so for small p this picks “the single most likely error chain”.

③ But we never needed to guess the error chain itself. As §3.2 showed, we win whenever error ⊕ repair crosses X̄ an even number of times. So all error chains consistent with the alarms fall into two classes, according to whether they cross X̄ an odd or even number of times together with my repair; chains in the same class differ only by face checks, and repairing along any of them has the same effect. The best decoder (maximum-likelihood decodingAdd up the probabilities of all error chains in each class, choose the class with the largest total, and repair along any chain of that class. For a given noise model it has the highest success rate, but it is generally much harder to compute than matching.) adds up the probabilities of all chains in each class and picks the class with the larger total. Panel (b) is an example on the d = 3 blueprint: stars (2, 0) (legs 2, 3, 11) and (1, 1) (legs 4, 5, 10, 12) alarm. Joining the two alarms directly takes 2 edges and can be done in two ways; pushing each to its nearest rough boundary also takes 2 edges, but in only one way, and it is in the other class. The lengths tie, so minimum total length pairing cannot tell them apart; counting every chain, for small p the “join directly” class is about twice as likely as the other. At p = 5% the check script enumerated all 213 error patterns: the exact split is 64% to 36%.

For small p the three decoders usually make the same choice. The animation in §4.1 and the next chapter's bench use ②, falling back to ① when there are too many alarms; in this chapter's game you do the pairing yourself, and its “Auto-decode (demo)” button also uses ②. Also try raising the error-rate slider: with many alarms, “looks close” pairings start producing logical errors more and more often. That felt sense of “past some p, it's unrescuable” is the next chapter's protagonist.

(a) 贪心 与 最小总长度(a) Greedy vs minimum total length 0 1 2 3 4 5 A B C D 贪心:先连最近的 B–C(1),再连 A–D(5),共 6greedy: closest B–C first (1), then A–D (5): total 6 最小总长度:A–B(2)+ C–D(2),共 4minimum total: A–B (2) + C–D (2): total 4 数轴上的数 = 位置(单位:边);A–D = 警报numbers = positions (in edges); A–D = alarms (b) 长度打平、走法不同的两类(b) Equal length, different numbers of ways 1 2 3 4 5 6 7 8 9 10 11 12 13 警报alarm 警报alarm 毛边界rough 毛边界rough 光边界smooth 光边界smooth 直接相连:Z₂Z₁₀ 或 Z₅Z₁₁(2 种)join them: Z₂Z₁₀ or Z₅Z₁₁ (2 ways) 各推向毛边界:Z₃Z₄(1 种)each to a rough boundary: Z₃Z₄ (1 way)
图 5.1Figure 5.1 (a) 四个警报 A、B、C、D 在一条直线上(远离边界)。橙色虚线 = 贪心配对:先连最近的一对,总长 6;绿色实线 = 最小总长度配对:整体比较所有配法,总长 4。(b) d = 3 蓝图(编号同第 2 章),品红大点 = 报警的两颗星。绿色 = 把两个警报直接相连的两种走法,它们合起来是面检查 Z₂Z₅Z₁₀Z₁₁,属于同一类;橙色虚线 = 各自推向最近毛边界的唯一走法,它和绿色的走法差一个 Z̄,属于另一类。三种走法都是 2 条边。 (a) Four alarms A, B, C, D on a line (far from any boundary). Orange dashed = greedy pairing: join the closest pair first, total 6; green solid = minimum total length pairing: compare all pairings at once, total 4. (b) The d = 3 blueprint (labels as in Chapter 2); large magenta dots = the two stars that alarm. Green = the two ways of joining the alarms directly; together they make the face check Z₂Z₅Z₁₀Z₁₁, so they are in the same class. Orange dashed = the only way of pushing each alarm to its nearest rough boundary; it differs from the green ways by a Z̄ and is in the other class. All three ways use 2 edges.
第 6 章Chapter 6

阈值:那条临界线The threshold: the critical line

「码做大就更安全」不是无条件的承诺。存在一个临界错误率:低于它,加大 d 让逻辑错误指数级消失;高于它,加大 d 反而更糟。这条线可以在你的浏览器里直接测出来。 “Bigger codes are safer” is not an unconditional promise. There is a critical error rate: below it, raising d makes logical errors vanish exponentially; above it, raising d makes things worse. And that line can be measured right in your browser.

6.1纸上先推一遍First, on paper

实验设定:每一轮里,每个量子比特独立地以概率 p 中一个 Z 错误;测量、译码、修复之后,检查「错误⊕修复」和 X̄ 交叉几次——奇数次即本轮失败。失败率随 d 怎么变?两股力量在掰手腕。力量一(保护):要凑出横跨串,至少约 d/2 个错误得排成一线(码距 d 保证纠正 (d − 1)/2 个错误,见《从 1+1 到 Toric Code》4.6 节;译码器会把不到一半的部分修回来),概率带着 p^(d/2) 这个「面积级的小」;d 每加 2,就多乘一个 p。力量二(暴露):芯片更大,可供失败的路线和起点也更多,数量随 d 增长。谁赢?取决于 p 的大小——两股力量恰好打平的那个 p,就叫阈值加大码距开始「有利可图」的临界物理错误率 p_th:p < p_th 时越大越好,p > p_th 时越大越糟。 pth:

The setup: each round, every qubit independently suffers a Z error with probability p; after measure–decode–repair we count how often error ⊕ repair crosses X̄ — an odd count means the round failed. How does failure depend on d? Two forces arm-wrestle. Force one (protection): a spanning string needs roughly d/2 errors in a row (distance d guarantees correcting (d − 1)/2 errors, see §4.6 of “From 1+1 to the Toric Code”; the decoder repairs anything under half), so the probability carries p^(d/2), that “area-level smallness” — every +2 in d multiplies by another p. Force two (exposure): a bigger chip offers more failure routes and starting points, growing with d. Who wins? It depends on p — and the p where the two forces exactly tie is called the thresholdThe critical physical error rate p_th at which growing the distance starts paying off: below it bigger is better, above it bigger is worse. pth:

PL(d, p) ≈ A · (p / pth)⌈d/2⌉ (经验规律,只在 p 远低于 pth 时适用;PL = 逻辑错误率(一轮失败的概率),A = 与 d 无关的常数;⌈·⌉ = 向上取整empirical rule, valid only for p well below pth; PL = logical error rate (probability one round fails), A = a constant independent of d; ⌈·⌉ = round up)

读这条公式:p 远低于 pth 时括号里远小于 1,指数 ⌈d/2⌉ 越大整体越小——d 每加 2,逻辑错误率乘一次同一个缩小因子,这就是指数压制。它是低噪声下的近似:推导时只数了最少的那几个错误,p 接近 pth 时更多错误的组合不能再忽略,公式不再可靠,也就不能拿它外推到阈值以上。阈值以上的情况要另外看:数值模拟显示(下一节的实验台上你也能看到),那里码越大越糟。所以不同尺寸的曲线在低 p 端按大小排好,在高 p 端次序颠倒,中间必然相交,交在 pth 附近——这就是我们要在实验里寻找的「交叉」签名。只用几个小尺寸时,曲线不一定严格交于一点,读出的交点是 pth 的有限尺寸估计。

Reading it: for p well below pth the bracket is far below 1, and a larger exponent ⌈d/2⌉ shrinks the whole thing — every +2 in d multiplies the logical error rate by the same reduction factor: exponential suppression. It is a low-noise approximation: it counts only the fewest errors that can cause failure, and as p approaches pth combinations of more errors can no longer be neglected, so the formula stops being reliable and cannot be extrapolated above threshold. What happens above threshold has to be seen separately: numerical simulations show (and the bench in the next section lets you see) that there, bigger codes do worse. So curves of different sizes are ordered by size at low p and in reverse order at high p, and must cross in between, near pth — the “crossing” signature our experiment will hunt for. With only a few small sizes the curves need not meet in exactly one point, and the crossing read off is a finite-size estimate of pth.

6.2现在,亲手测Now measure it yourself

下面的实验台会对 d = 3、5、7 三块表面码、十几个 p 值,各自跑成百上千轮「加噪→译码→判定」,实时画出失败率曲线。这不是预先存好的图——是你的浏览器现场做的蒙特卡洛实验(所以每次结果都带一点统计涨落):

The bench below runs hundreds to thousands of noise→decode→verdict rounds for surface codes of d = 3, 5, 7 across a dozen p values, drawing the failure-rate curves live. Nothing is pre-baked — your browser is doing the Monte-Carlo experiment right now (hence a little statistical shimmer between runs):

左端读图:p 很小时,三条曲线按 d=7 < d=5 < d=3 排列——大码稳赢,而且每加大一号,失败率大约按同一比例再打一次折(6.1 的公式只管这一端)。右端:次序整个翻转。三条曲线中间的交叉带,是这个实验设定下阈值的有限尺寸估计:只有 d = 3、5、7 三个尺寸,外加蒙特卡洛的统计涨落,所以读出的是一段范围,不是一个精确的数。设定要说清楚:只有数据比特出 Z 错误、测量完美(文献称「码容量噪声」);译码器在警报不超过 14 个时做精确的最小重量完美匹配(允许配到边界),警报更多时退为每次先配最近两个的贪心配对。p 较大时警报很多,贪心的比例上升,所以本页测出的交叉点会比下面文献里的数字偏低,通常落在百分之几到 10% 之间,每次运行略有涨落。

Read the left end: for small p the curves stack d=7 < d=5 < d=3 — big codes win, and each size step cuts failure by roughly the same factor (§6.1's formula covers only this end). At the right end the order fully inverts. The band where the three curves cross is a finite-size estimate of the threshold for this experimental setup: only three sizes, d = 3, 5, 7, plus Monte-Carlo scatter, so what you read off is a range, not a precise number. The setup must be stated: only data qubits suffer Z errors and measurements are perfect (the literature calls this “code-capacity noise”); the decoder performs exact minimum-weight perfect matching (boundaries allowed) when there are at most 14 alarms, and greedy closest-pair matching beyond. At larger p there are many alarms and more greedy rounds, so the crossing measured here sits below the literature figure below, typically somewhere between several percent and 10%, with some scatter from run to run.

诚实说明Honesty box

文献里的数字,各自带着设定:① 码容量噪声(独立翻转、测量完美)加最小重量完美匹配:10.3%(Wang、Harrington、Preskill,arXiv quant-ph/0207088,给出 0.1031 ± 0.0001)。② 同一篇论文:测量本身也以同样概率出错时(「现象学噪声」),2.9%(0.0293 ± 0.0002)。③ 把 4.3 节的帮手比特、门、读出错误全部算进去(「电路级噪声」):Raussendorf 与 Harrington(arXiv quant-ph/0610082)给出每种错误源 0.75%,Wang、Fowler、Hollenberg(arXiv 1009.3686)用按概率加权的最小重量完美匹配(每条可能的连线按「这对检测事件被一条错误链连起来的概率」取权重,而不是按格数),在三种噪声模型下分别得到:1.1%(标准模型:两比特门、空闲、测量的出错概率都等于 p)、1.2%(平衡模型:空闲出错 4p/5,测量出错 8p/15)、1.4%(离子阱模型:空闲出错 p/1000,测量出错 p/100);具体数值取决于噪声模型和译码器,量级是 1%。这就是为什么各硬件平台把「物理错误率压到千分之几」当作生死线。「一个好逻辑比特需要成百上千个物理比特」也从这里来:按 6.1 的经验公式(忽略常数 A),若 p = pth/10,要把逻辑错误率压到 10⁻¹⁰ 需要 ⌈d/2⌉ = 10,即 d = 19;实验室用的旋转版图(尾声)连帮手在内约 2d² ≈ 720 个物理比特。若 p 只有 pth 的一半,d 要到 67,比特数近九千(离阈值这么近,这条公式只算粗估)。

Literature numbers, each with its setting: ① code-capacity noise (independent flips, perfect measurement) with minimum-weight perfect matching: 10.3% (Wang, Harrington, Preskill, arXiv quant-ph/0207088, who give 0.1031 ± 0.0001). ② The same paper, when the measurements themselves also err at the same rate (“phenomenological noise”): 2.9% (0.0293 ± 0.0002). ③ Including the helper-qubit, gate and readout errors of §4.3 (“circuit-level noise”): Raussendorf and Harrington (arXiv quant-ph/0610082) give 0.75% per error source, and Wang, Fowler, Hollenberg (arXiv 1009.3686), using minimum-weight perfect matching with probability weights (each possible link weighted by the probability that an error chain joins that pair of detection events, instead of by its number of cells), obtain 1.1% for their standard model (two-qubit gates, idling and measurement all fail with probability p), 1.2% for their balanced model (idling fails with 4p/5, measurement with 8p/15) and 1.4% for their ion-trap model (idling p/1000, measurement p/100); the exact value depends on the noise model and the decoder, and the scale is 1%. This is why hardware platforms treat “physical error rates in the few-per-thousand” as the line of life and death. The familiar claim “one good logical qubit costs hundreds to thousands of physical qubits” comes from here too: by §6.1's empirical formula (ignoring the constant A), if p = pth/10, pushing the logical error rate to 10⁻¹⁰ needs ⌈d/2⌉ = 10, i.e. d = 19; the rotated layout used in labs (see the epilogue) then needs about 2d² ≈ 720 physical qubits including helpers. If p is only half of pth, d must reach 67, and the count approaches nine thousand (this close to threshold the formula gives only a rough estimate).

6.3现实中走到哪了Where reality has reached

这条曲线不再只属于纸面。截至本教程编写时:2023 年,Google 首次在真实芯片上演示 d=5 的表面码略优于 d=3(每轮纠错的逻辑错误率 2.914% 对 3.028%,arXiv 2207.06431;这两个数用张量网络译码器得到,那是一种近似的最大似然译码,见第 5 章的第 ③ 层;它们是 X、Z 两种基的平均,d = 3 的数又是芯片上四块 d = 3 子区的平均,每轮错误率从 25 轮数据拟合而来)——「加大真的更好」第一次在硬件上成立;2024 年底,其 Willow 芯片把演示推进到 d=7,每加大一号(d 加 2),逻辑错误率降为原来的 1/2.14(论文记作 Λ = 2.14 ± 0.02),d = 7 时每轮 0.143%(arXiv 2408.13687)。这两个数来自实验结束后离线运行的神经网络译码器,同样是 X、Z 两种基的平均;d = 3 和 d = 5 分别取 9 块和 4 块子区的平均,Λ 由 ln(逻辑错误率) 对 d 的直线拟合得到。同一篇论文里还有另一块 72 比特芯片上的 d = 5 实验,配合边测边译的实时译码器,得到 Λ = 2.0 ± 0.1。这些都是真实硬件的电路级噪声,和本页的玩具实验设定不同;同期多个平台(中性原子、离子阱、超导)都在各自路线上复现「低于阈值」的行为,也有团队探索比表面码更省比特的新型编码。数字仍在快速演进,但方向已经清楚:你在本章亲手测出的那种曲线,正在实验室里一条条变成现实。

The curve no longer lives only on paper. As of this tutorial's writing: in 2023 Google first demonstrated on real hardware that a d=5 surface code slightly beats d=3 (logical error per round of correction 2.914% versus 3.028%, arXiv 2207.06431; these come from a tensor-network decoder, an approximate maximum-likelihood decoder in the sense of level ③ of Chapter 5; they are averaged over the X and Z bases, the d = 3 figure is also averaged over four d = 3 sub-grids of the chip, and the per-round rate is fitted to data over 25 rounds) — “bigger is better” holding on a chip for the first time; in late 2024 their Willow chip pushed to d=7, with each size step (d up by 2) dividing the logical error rate by 2.14 (the paper's Λ = 2.14 ± 0.02), reaching 0.143% per round at d = 7 (arXiv 2408.13687). These two numbers come from a neural-network decoder run offline after the experiment, again averaged over the X and Z bases; the d = 3 and d = 5 figures are averages over 9 and 4 sub-grids, and Λ is a straight-line fit of ln(logical error rate) against d. The same paper also reports a d = 5 experiment on a separate 72-qubit chip with a real-time decoder that decodes while the experiment runs, giving Λ = 2.0 ± 0.1. All of these are circuit-level noise on real hardware, a different setting from this page's toy experiment; and platforms from neutral atoms to trapped ions to superconducting circuits have since reproduced below-threshold behaviour along their own routes, while other teams pursue newer codes thriftier in qubits than the surface code. The numbers keep moving fast, but the direction is set: the very curves you measured in this chapter are materializing, one by one, in laboratories.

检查站Checkpoint第 6 章Chapter 6
某芯片工作在 p = pth/2,d=9 时逻辑错误率为 q。按 6.1 的经验公式,换成 d=11 大约变成多少?A chip runs at p = pth/2, with logical error rate q at d=9. By §6.1's rule, what does d=11 give?

对。d 每 +2,就再乘一个 (p/pth)。在 p = pth/2 处即每次减半——d 从 9 一路加到 29,就能再压千倍。指数压制的威力全在这。

Right. Each +2 in d multiplies by another (p/pth) — a halving here. Walk d from 9 up to 29 and you gain another thousandfold. That is the whole power of exponential suppression.

盯住公式 (p/p_th)^⌈d/2⌉:d 从 9 到 11,指数 ⌈d/2⌉ 从 5 变 6——只多乘一次括号。

Watch (p/p_th)^⌈d/2⌉: from d=9 to 11 the exponent goes 5→6 — one extra factor of the bracket.

尾声Epilogue

旅程终点,与三条继续走的路Journey's end — and three roads onward

从 1+1=2 到此处,你完成了一条完整的推理链:奇偶与负号 → 不偷看的检查 → 两种量子错误 → 对易的几何化 → 环面上的链与圈 → 剪开后的两种边界 → 横跨串与配对译码 → 阈值与指数压制。今天任何一篇表面码论文的核心图景——警报的星空、配对的连线、往下俯冲的曲线——你都已亲手操作过。

From 1+1=2 to here, you completed one unbroken chain of reasoning: parity and minus signs → checks that don't peek → two quantum errors → commuting made geometric → chains and loops on a torus → two boundaries after the cut → spanning strings and matching decoders → threshold and exponential suppression. The core imagery of any surface-code paper today — the starfield of alarms, the matching lines, the diving curves — you have now operated with your own hands.

三条值得继续走的路。路一:更省的版图。把我们的方格斜转 45° 再裁边,就得到「旋转表面码」——同样的码距只用 d² 个数据比特(d=5 时 25 个而非 41 个),是实验室里实际部署的版本;思想与本教程的版图完全相同,只是裁剪更精。路二:让逻辑比特做事。存住只是第一步,还得对逻辑比特做门操作:把两块码拼在一起再分开(「格点手术」lattice surgery)、以及为某些关键操作准备特制状态(「魔法态」magic states)——这是当前工程化的主战场。路三:更省的码。表面码的千倍开销并非宿命,qLDPC 等新码型用更巧的检查图谱换取更高的编码率,是近年最活跃的方向。三条路的入口文献都在下方。

Three roads worth walking on. Road one: thriftier layouts. Tilt our grid 45° and trim — the “rotated surface code”, achieving the same distance with only d² data qubits (25 instead of 41 at d=5); it is the version actually deployed in labs, identical in ideas, tighter in tailoring. Road two: making the logical qubit work. Storage is step one; logical gates come next — merging and splitting code patches (“lattice surgery”) and preparing special resource states for the stubborn operations (“magic states”): today's main engineering front. Road three: thriftier codes. The surface code's thousandfold overhead is not destiny — qLDPC and friends trade cleverer check-graphs for higher encoding rates, the liveliest research direction of recent years. Entry points to all three are below.

前置教程The prerequisite tutorial

需要回炉任何一块地基(振幅、对易、稳定子、环面码本体),随时回到《从 1+1 到 Toric Code》。前往 →

To re-forge any foundation stone (amplitudes, commuting, stabilizers, the toric code itself), return anytime to “From 1+1 to the Toric Code”. Go →

符号与读法Symbols & how to read them

符号Symbol名称与读法Name & how to read it在本教程中的含义Meaning in this tutorial
∏大写希腊字母 π,读「派」(pi)Capital Greek π, read “pie”连乘记号:把后面的东西全部乘起来——∑ 的乘法版。∏v Av 即「所有星形检查的乘积」。The product sign: multiply everything that follows — the multiplicative sibling of ∑. ∏v Av = “the product of all star checks”.
⊕圆圈加,读「异或」或「圆圈加」A circled plus, read “X-OR” or “o-plus”合并两组东西、成对相消:同一条边出现两次就抵消(因为 Z·Z = I);对 0/1 就是「模 2 加法」。Merge two collections with pairwise cancellation: anything appearing twice cancels (since Z·Z = I); on 0/1 it is addition mod 2.
⌈ ⌉直角括号,读「向上取整」(ceiling)Square-cornered brackets, read “ceiling”⌈x⌉ = 不小于 x 的最小整数:⌈2.1⌉ = 3、⌈3⌉ = 3。⌈d/2⌉ 即「d 的一半,不足则进一」。⌈x⌉ = the smallest integer not below x: ⌈2.1⌉ = 3, ⌈3⌉ = 3. So ⌈d/2⌉ is “half of d, rounded up”.
∎实心小方块,读「证毕」(Q.E.D.)A filled square, read “Q.E.D.”数学家在证明末尾盖的小方章:到此证完,无需再言。The mathematician's end-of-proof stamp: done, nothing more to say.
⇒双线箭头,读「推出 / 则」A double arrow, read “implies”A ⇒ B:由 A 可以得出 B。A ⇒ B: from A one may conclude B.
⇔双向双线箭头,读「当且仅当」A two-way double arrow, read “if and only if”A ⇔ B:A 与 B 同真同假,互为充要条件——是一条双向的「推出」。A ⇔ B: A and B stand or fall together — an implication running both ways.
X̄ Z̄字母头上一横,读「X bar / Z bar」An overbar, read “X-bar / Z-bar”一横 = 「逻辑版」:X̄ 是作用在被保护的逻辑比特上的 X,由许多物理操作组成(这里 = 缠绕圈 / 横跨串)。The bar means “logical edition”: X̄ is the X acting on the protected logical qubit, built from many physical operations (here: winding loops / spanning strings).
±读「正负」Read “plus-minus”±1 = 「+1 或 −1」两个可能取值;这里每条检查的答案都是这两个之一。±1 = the two possible values “+1 or −1”; every check here answers with one of them.
√读「根号」Read “square root”√A = 面积为 A 的正方形的边长;(√A)² = A;常客:1/√2 ≈ 0.71。√A = the side of a square of area A; (√A)² = A; frequent guest: 1/√2 ≈ 0.71.
|·⟩竖线加右尖括号,读「刻特」(ket)A bar with a right angle bracket, read “ket”|0⟩ = 「贴着标签 0 的状态」:给量子状态套的礼盒括号,本质是基向量的名字。|0⟩ = “the state labelled 0”: gift-wrap for quantum states — really just a basis vector's name.
≈读「约等于」Read “approximately equals”两边近似相等。The two sides are nearly equal.
≠读「不等于」Read “not equal”两边不相等。The two sides differ.
d读「码距」或「距离参数」Read “distance” or “size parameter”最短逻辑算符(横跨串)所走的边数;这里同时是版图尺寸:n = d² + (d−1)²。The number of edges in the shortest logical operator (spanning string); here also the layout size: n = d² + (d−1)².
pth读「p 阈值」(p sub th)Read “p threshold” (p sub th)阈值:一个临界物理错误率,物理错误率低于它时加大 d 才有利;p 远低于 pth 时,d 每 +2,逻辑错误率约乘一次 p/pth。The threshold: the critical physical error rate below which growing d pays off; for p well below pth each +2 in d multiplies the logical error rate by about p/pth.
PL(d, p) A读「P L」「A」Read “P-L” and “A”PL = 逻辑错误率(一轮纠错失败的概率),是 d 与 p 的函数;A 是与 d 无关的常数。PL = the logical error rate (probability one correction round fails), a function of d and p; A is a constant independent of d.
→ ↔读「到」「与」Read “to” and “between”边界记法:「毛边界 → 毛边界」= 串从一条毛边界连到另一条;「(左 ↔ 右)」= 指哪一对边界。Boundary notation: “rough → rough” = the string runs from one rough boundary to the other; “(left ↔ right)” names the pair of boundaries.

本教程新增词汇New terms in this tutorial

术语Term白话定义Plain definition
表面码surface code剪开环面、配上两种边界的平面版 toric code;任意尺寸 d 恰存 1 个逻辑量子比特,码距 d。The planar toric code with two boundary types; stores exactly 1 logical qubit at any size d, with distance d.
毛(粗糙)边界rough boundary带悬挂半边的边界(本教程版图的左右两侧);面检查在此缺腿;Z-链可在此无声终止。The boundary with dangling half-edges (left/right here); face checks lose a leg; Z-chains may end here silently.
光(光滑)边界smooth boundary无悬边的边界(上下两侧);星形检查在此缺腿;X-链可在此无声终止。The boundary without danglers (top/bottom); star checks lose a leg; X-chains may end here silently.
横跨串spanning string两端搭在同类边界上的错误串;平面版的「缠绕圈」,即逻辑算符。A string with both ends on like boundaries; the planar heir of the winding loop — a logical operator.
辅助(帮手)比特ancilla替一条检查收集奇偶、然后被单独读出的量子比特。The qubit that collects one check's parity and is read out alone.
阈值 pththreshold pth「加大码开始有利」的临界物理错误率;之下 d 每 +2,逻辑错误率乘一次 (p/p_th)。The critical physical error rate where growing the code starts paying; below it each +2 in d multiplies logical errors by (p/p_th).
旋转表面码rotated surface code45° 斜裁的省料版图:码距 d 只用 d² 个数据比特。The 45°-trimmed thrifty layout: distance d from only d² data qubits.
[[n, k, d]]量子码三项指标:n 个物理比特、k 个逻辑比特、码距 d;k = n − r,r 是独立检查条数。本页平面码 [[d² + (d−1)², 1, d]]。A quantum code's three numbers: n physical qubits, k logical qubits, distance d; k = n − r with r the number of independent checks. This page's planar code: [[d² + (d−1)², 1, d]].
码容量 / 现象学 / 电路级噪声code-capacity / phenomenological / circuit-level noise三种噪声设定:只有数据比特出错、测量完美 / 测量读数也会出错 / 帮手比特、每个门、每次读出都会出错。阈值依次变小(约 10%、3%、1%)。Three noise settings: only data qubits err, measurement perfect / readouts err too / helper qubits, every gate and every readout err. Thresholds shrink in that order (about 10%, 3%, 1%).

延伸阅读Further reading

  • E. Dennis, A. Kitaev, A. Landahl, J. Preskill, “Topological quantum memory” (2002)
    边界、时空配对与阈值理论的奠基文。arXiv: quant-ph/0110143The founding paper for boundaries, spacetime matching and threshold theory. arXiv: quant-ph/0110143
  • A. Fowler, M. Mariantoni, J. Martinis, A. Cleland, “Surface codes: Towards practical large-scale quantum computation” (2012)
    工程全景:旋转版图、电路级噪声、开销估算。arXiv: 1208.0928The engineering panorama: rotated layouts, circuit-level noise, overhead estimates. arXiv: 1208.0928
  • Google Quantum AI, “Suppressing quantum errors by scaling a surface code logical qubit”, Nature (2023);“Quantum error correction below the surface code threshold”, Nature (2024)
    「加大更好」与「低于阈值」的两次硬件里程碑(后者即 Willow, d=7)。The two hardware milestones — “bigger is better” and “below threshold” (the latter is Willow, d=7).
  • D. Horsman, A. Fowler, S. Devitt, R. Van Meter, “Surface code quantum computing by lattice surgery” (2012)
    路二的入口:用拼接与切分对逻辑比特做门。arXiv: 1111.4022The entrance to Road two: logical gates by merging and splitting patches. arXiv: 1111.4022
  • N. Breuckmann, J. Eberhardt, “Quantum low-density parity-check codes” (2021)
    路三的综述起点。arXiv: 2103.06309The survey to start Road three. arXiv: 2103.06309
诚实总账The honesty ledger

《从 1+1 到 Toric Code》的三项简化在这里仍然有效:全程实数振幅(Y 错误 = X、Z 同时来,两族检查都会看见它);除 4.3 节的讨论外假设测量完美;自动译码只在警报不超过 14 个时做精确的最小重量完美匹配,更多时退为贪心配对(6.2)。此外这里新增一项:我们展示的是「未旋转」的原始版图,实验室部署的旋转版在同样的思想下更省比特。所有这些简化都不影响任何一条定性结论。

The three simplifications of “From 1+1 to the Toric Code” still stand: real amplitudes throughout (a Y error = X and Z at once — both check families see it); perfect measurements except for §4.3's discussion; an auto-decoder that performs exact minimum-weight perfect matching only up to 14 alarms and greedy matching beyond (§6.2). One addition here: we showed the original “unrotated” layout, while deployed rotated versions realize the same ideas with fewer qubits. None of these simplifications touches any qualitative conclusion.