从 1+1 到 Toric CodeFrom 1+1 to the Toric Code
互动教程 · 零基础版 · Toric CodeInteractive tutorial · Zero-basis edition · Toric code

从 1 + 1 = 2
一路走到 Toric Code
From 1 + 1 = 2
all the way to the Toric Code

Toric code(环面码)是人类迄今想出的保护量子信息最优雅的办法之一,也是今天各大量子计算机团队真正在造的「表面码」的源头。这份教程把它从零开始、一步不跳地推导出来:每引入一个新概念之前,都先把它需要的一切铺好。 The toric code is one of the most elegant ideas humanity has found for protecting quantum information — and the ancestor of the “surface codes” real quantum-computer teams are building today. This tutorial derives it from zero, skipping nothing: every new concept is prepared for before it appears.

唯一的前提:你相信The only prerequisite: you believe 1 + 1 = 2 。其余全部现场推导。. Everything else is derived on the spot.
开始 ↓Begin ↓ 全程约 60–90 分钟 · 20 个可动手的实验 · 读完接姊妹篇《从 Toric Code 到 Surface Code》About 60–90 minutes · 20 hands-on experiments · continues in “From Toric Code to Surface Code”
目录Contents
第 0 章Chapter 0

怎么读这份教程How to read this tutorial

两条规则、三种盒子。一分钟看完就出发。 Two rules, three kinds of boxes. One minute, then we go.

规则一:不跳步。每一个新概念出现前,它需要的所有零件都已经在前文备好。如果你在某处感到「这一步哪来的?」,那是我们的失误——但更可能的是,答案就在上一段。

Rule one: no skipped steps. Before any new idea appears, every part it needs has already been laid out. If you ever feel “where did that come from?”, that's our failure — but more likely, the answer is in the previous paragraph.

规则二:动手。正文里嵌着许多带 试一试 标签的实验台。它们不是插图,而是真的在你的浏览器里运行的小型模拟器。每个结论都可以亲手验证。

Rule two: touch things. The panels labeled Try it are not illustrations — they are small simulators running live in your browser. Every claim can be checked with your own hands.

你还会遇到三种盒子:

You will meet three kinds of boxes:

关键想法Key idea

蓝边的盒子存放全教程最重要的几句话。忘了别的都行,别忘它们。

Blue-edged boxes hold the few sentences that matter most. Forget everything else, keep these.

诚实说明Honesty box

橙边的盒子交代我们在哪里做了简化、完整版是什么样。简化不是欺骗——前提是明说。

Amber-edged boxes admit where we simplified and what the full story is. Simplifying is fair — as long as it's declared.

这种可展开的「为什么?」盒子,装的是选读的深挖Fold-out “why?” boxes like this hold optional deeper dives

跳过它们不影响主线;打开它们会更过瘾。

Skipping them never breaks the main path; opening them is more fun.

还有一种标着「补课」的橙色折叠盒。正文有时会用到一个值得细看的步骤(为什么恰好砍掉一半、为什么某个圈不是检查的乘积……),补课盒把这一步从零讲一遍,并配一个能手算核对的小例子。它们默认收起,主线不看它们也读得通;哪一步让你停下来了,就打开旁边那个。

There is one more kind: orange fold-outs labelled “Catch-up”. Sometimes the main text uses a step that deserves a closer look (why exactly half is cut, why some loop is not a product of checks, …); a catch-up box teaches that step from zero, with a small example you can check by hand. They start closed, and the main path reads fine without them; if a step makes you stop, open the box next to it.

最后:正文尽量说人话。专业名词第一次出现时会带蓝色点线下划线,把鼠标放上去(手机上点一下)能看到它的定义;而每当正文引用前面的结论(如「按 4.3 的规则」这种橙色虚线),点一下就会原地弹出那条定义的小卡片——不必翻回去找。遇到陌生的希腊字母或新符号(ψ、∏、⊕ 这类带浅灰点线的),点一下就会告诉你它怎么读、什么意思;页尾另附完整的符号读音表和词汇表。公式不会凭空出现:每个符号在使用前都会被介绍。

Lastly: we speak plainly. Technical names carry a blue dotted underline on first appearance — hover (or tap) for the definition; and whenever the text cites an earlier result (amber dashed underlines like “by the rule of §4.3”), one click pops up a small card restating that definition in place — no scrolling back. Unfamiliar Greek letters and novel symbols (ψ, ∏, ⊕ — anything with a faint grey dotted underline) tell you how to read them when clicked; a full pronunciation table and glossary wait at the end. No formula appears from thin air: every symbol is introduced before use.

第 1 章Chapter 1

只需要一点点数学Just a little math

整份教程用到的数学,只有四样:负数、平方、概率、数个数的奇偶。这一章把它们一次备齐。已经会的读者快速滑过即可——但至少看一眼 1.4,那是后面一切的钥匙。 This entire tutorial uses exactly four pieces of math: negative numbers, squares, probability, and counting even-vs-odd. This chapter stocks them all. If you know them, skim — but glance at 1.4, which is the key to everything later.

1.1负数:带方向的数Negative numbers: numbers with a direction

从 1+1=2 出发,我们会数数和加法。减法是「往回走」:3 − 5 走过了 0,落在 0 左边 2 步的地方,我们把那里记作 −2。每个数 x 都有一个镜像 −x:它们相加正好回到 0,即 x + (−x) = 0。

Starting from 1+1=2 we can count and add. Subtraction means “walking backwards”: 3 − 5 walks past 0 and lands two steps to its left, a place we call −2. Every number x has a mirror −x, and together they cancel: x + (−x) = 0.

乘法是「连加」:3 × 2 = 2+2+2。那么乘一个负数呢?3 × (−1) = (−1)+(−1)+(−1) = −3,没问题。可 (−1) × (−1) 是什么——「负一次」加法没法直接想象。别背口诀,让规律替我们决定:

Multiplication is repeated addition: 3 × 2 = 2+2+2. So 3 × (−1) = (−1)+(−1)+(−1) = −3, fine. But what is (−1) × (−1)? You cannot “add something minus-one times”. Don't memorize a slogan — let the pattern decide:

3×(−1) = −3 → 2×(−1) = −2 → 1×(−1) = −1 → 0×(−1) = 0 → (−1)×(−1) = +1

左边每次少乘一个 1,右边每次增加 1。要让规律不断裂,(−1)×(−1) 只能等于 +1。由此立刻得到一个我们要用几十次的推论:

Each line drops one “1” on the left and climbs by one on the right. For the pattern to survive, (−1)×(−1) must be +1. This gives a corollary we will use dozens of times:

关键想法Key idea

一串 (−1) 连乘,结果只看个数的奇偶:偶数个 (−1) 相乘 = +1,奇数个 = −1。例如 (−1)×(−1)×(−1) = (+1)×(−1) = −1。

A chain of (−1)s multiplied together depends only on whether their count is even or odd: an even number of (−1)s gives +1, an odd number gives −1. E.g. (−1)×(−1)×(−1) = (+1)×(−1) = −1.

(−1) × (−1) × ⋯ × (−1)(共 k 个k copies)= (−1)k = { k 为偶数:+1 ;k 为奇数:−1 }{ k even: +1 ; k odd: −1 }

1.2平方:面积的语言Squares: the language of area

一个数乘自己叫平方,记作 x² = x × x。它有个看得见的意思:边长为 x 的正方形,面积就是 x²。反过来,「面积是 A 的正方形,边长是多少」的答案记作 √A(读「根号 A」),所以 (√A)² = A。拖动下面的边长,盯住面积:

A number times itself is its square, written x² = x × x. It has a visible meaning: a square of side x has area x². Going backwards, “which side gives area A?” has the answer √A (“root A”), so (√A)² = A. Drag the side below and watch the area:

x² = x·x (· 即乘号 ×is the times sign ×) · (√A)² = A · 0.71² ≈ ½ (即i.e. 1/√2 ≈ 0.71) · (−x)² = (−1)²·x² = x²

注意最后一条:负数的平方也是正的,因为两个 (−1) 相乘抵消了。「平方会抹掉正负号」这件小事,后面会变成量子世界的一根顶梁柱。还有一组值得现在记住的数:0.6² + 0.8² = 0.36 + 0.64 = 1。

Note the last line: squares of negative numbers are positive — the two (−1)s cancel. “Squaring erases the sign” looks small now and becomes a pillar of the quantum world later. One more pair worth memorizing: 0.6² + 0.8² = 0.36 + 0.64 = 1.

工具箱里还要放进一件借来的古董。两千多年前的几何学家证明了:直角三角形两条直角边 a、b 与最长边(斜边)c 之间,永远有 a² + b² = c²——勾股定理。我们不重演它的证明(那是几何课的乐趣),只领走一个直接推论:到原点距离恰好为 1 的所有点 (a, b),正是满足 a² + b² = 1 的点,它们连成的曲线就是半径为 1 的圆。记住这幅画面:「a² + b² = 1 ⇔ 点 (a, b) 躺在单位圆上」。第 3 章它将成为主角的舞台。

One borrowed antique goes into the toolbox too. Over two millennia ago geometers proved that a right triangle's two legs a, b and its longest side (hypotenuse) c always satisfy a² + b² = c² — the Pythagorean theorem. We won't replay its proof (that's geometry class's treat), only collect a direct consequence: the points (a, b) at distance exactly 1 from the origin are precisely those with a² + b² = 1, and together they trace the circle of radius 1. Keep the picture “a² + b² = 1 ⇔ the point (a, b) lies on the unit circle” — in Chapter 3 it becomes the protagonist's stage.

a² + b² = c²(勾股定理Pythagoras) ⇒ a² + b² = 1 ⇔ (a, b) 在半径 1 的圆上lies on the radius-1 circle

1.3概率:反复做,看占比Probability: repeat, and watch the fraction

说「抛硬币正面的概率是 ½」,操作上的含义是:抛得次数越多,正面次数占总次数的比例就越贴近 ½。概率是介于 0(绝不发生)和 1(必然发生)之间的数,而且一次实验所有可能结果的概率加起来必须等于 1——因为总得发生点什么。亲手验证一下:

Saying “the probability of heads is ½” means, operationally: the more you flip, the closer the fraction of heads gets to ½. A probability lives between 0 (never) and 1 (certain), and the probabilities of all possible outcomes of an experiment must add up to 1 — something has to happen. Verify by hand:

P(正面heads) + P(反面tails) = ½ + ½ = 1 (P(…) 读「……的概率」reads “the probability of …”)

1.4奇偶:只数「有几个」,不问「是哪几个」Parity: count how many, never ask which

一个数是偶数还是奇数——这个属性叫奇偶性一个整数属于偶数还是奇数的属性。英文 parity。本教程的一切检查最终都只在问某个数量的奇偶。。它粗糙得可爱:把 17 个东西藏起来只告诉你「奇数个」,你几乎什么都不知道——但恰恰是这种「几乎什么都不知道」,将来能让我们在不偷看量子信息的前提下体检它。

Whether a count is even or odd is called its parityThe even-or-odd property of a whole number. Every check in this tutorial ultimately asks only about some parity.. It is adorably crude: hide 17 objects and reveal only “an odd number”, and one learns almost nothing — but exactly this “almost nothing” will later let us health-check quantum information without peeking at it.

把 1.1 和这里合并成一句话,就是全教程使用频率最高的公式:

Merging 1.1 with this gives the single most-used formula of the tutorial:

(−1)k = +1 ⇔ k 是偶数is even · (−1)k = −1 ⇔ k 是奇数is odd
检查站Checkpoint第 1 章Chapter 1
五个 (−1) 连乘,再乘 0.6² + 0.8²,结果是多少?Multiply five (−1)s together, then multiply by 0.6² + 0.8². The result?

正是。奇数个 −1 → 总负号;而 0.36+0.64=1 什么也不改变。这两个小事实撑起了后面的一切。

Exactly. An odd count of −1s → an overall minus; and 0.36+0.64=1 changes nothing. These two small facts will carry everything ahead.

再想想 1.1 的关键想法框:连乘的 (−1) 只看个数的奇偶;再用 1.2 结尾那组数。

Revisit the key-idea box of §1.1 — chains of (−1)s care only about even vs odd — then the numbers at the end of §1.2.

第 2 章Chapter 2

比特、噪声与三倍保险Bits, noise, and triple insurance

量子纠错的每一个套路,都是普通(经典)纠错套路的升级版。所以先在没有量子的世界里,把「出错—发现—修复」这套完整动作练一遍。 Every move in quantum error correction is an upgraded version of an ordinary (classical) move. So let's first rehearse the full routine — fail, detect, repair — in a world with no quantum in it.

2.1比特:一切信息的原子The bit: the atom of information

一个比特最小的信息单位:一个只能处于 0 或 1 两种状态之一的东西。bit = binary digit(二进制数字)。就是一个只有两种可能的答案:0 或 1、否或是、灭或亮。任何承载它的东西都行——开关的通断、电压的高低、硬币的正反。你此刻屏幕上的一切,本质上是几十亿个比特。

A bitThe smallest unit of information: something that is in exactly one of two states, 0 or 1. Short for “binary digit”. is an answer with only two options: 0 or 1, no or yes, off or on. Anything can carry one — a switch, a voltage, a coin lying heads or tails. Everything on your screen right now is a few billion bits.

2.2噪声:世界会拨动你的开关Noise: the world flips your switches

存储和传输都不完美:宇宙射线、发热、元件老化,都可能把 0 变成 1、1 变成 0。我们把这种意外称为翻转,并用一个数 p 表示「每个比特被翻转的概率」。体验一下 p 的威力:

Storage and transmission are imperfect: cosmic rays, heat, ageing parts can turn a 0 into a 1 and vice versa. Call this accident a flip, and let the number p be “the probability that any given bit gets flipped”. Feel what p does:

P(某个比特被翻转a given bit flips) = p · P(安然无恙survives) = 1 − p

2.3三倍保险:把 0 说三遍Triple insurance: say 0 three times

对策古老而直白:重复。想发 0,就发 000;想发 1,就发 111。这一步叫编码把 1 个「逻辑」比特(真正想保护的信息)写进多个「物理」比特(实际存在的载体)的动作。。接收方数一数哪个多——两票以上算数——这一步叫多数表决解码。于是,1 个错误能被纠正;只有 2 个及以上同时出错才会翻车。

The ancient, blunt fix: repetition. To send 0, send 000; to send 1, send 111. This step is called encodingWriting one “logical” bit (the information you actually care about) into several “physical” bits (the actual carriers).. The receiver counts votes — two or more wins — which is majority-vote decoding. Now one flip gets corrected; only 2 or more simultaneous flips cause disaster.

这里出现了本教程最重要的一对词:真正想保护的那个比特叫逻辑比特;实际用到的三个载体叫物理比特。用 3 个物理的,换 1 个更结实的逻辑的。

Here appears the most important word-pair of the tutorial: the bit we actually protect is the logical bit; the three carriers are physical bits. We spend 3 physical bits to buy 1 sturdier logical bit.

「三倍保险」到底好多少?先把假设说清楚,因为下面的乘法全靠它们:三个比特各自以同一个概率 p 被翻;它们互不影响,一个比特翻不翻,不改变另一个被翻的概率(这叫独立一件事发生与否,不改变另一件事发生的概率。这时「两件都发生」的概率等于两个概率相乘。);编码和最后的读取本身不出错,错误只在传输途中出现。独立的事件同时发生,概率相乘:两枚硬币都正面,是「一半里的一半」,½ × ½ = ¼。有了这些,把所有翻车的情形列出来:三个比特里恰好某两个被翻,有且只有 3 种选法——(1和2)、(1和3)、(2和3)——每种的概率是 p·p·(1−p)(两个被翻、一个没翻);三个全翻是 1 种,概率 p³。加起来:

How much better is triple insurance? First the assumptions, because the multiplication below rests on them: each of the three bits flips with the same probability p; the bits do not influence one another, so whether one flips does not change the chance that another flips (this is called independenceWhether one event happens does not change the probability of another. Then the probability that both happen is the product of the two probabilities.); and encoding and the final read-out make no mistakes, so errors happen only in transit. When independent events happen together, their probabilities multiply: two coins both landing heads is “half of a half”, ½ × ½ = ¼. With that, list every disaster. “Exactly two of the three flip” happens in exactly 3 ways — (1&2), (1&3), (2&3) — each with probability p·p·(1−p) (two flipped, one not); “all three flip” is 1 way, probability p³. Sum:

P(翻车disaster) = 3·p²·(1−p) + p³ ≈ 3p² (当 p 很小for small p)

当 p = 1% 时:裸比特出错 1%,重复码只有约 0.03%(3 × 0.0001 × 0.99 + 0.000001 = 0.000298)——好了三十多倍。而且 p² 是「面积级的小」:p 越小,优势越悬殊。这个「用数量换质量,错误率从 p 降到 ~p²」的交易,是后面所有纠错码的共同思路。但这笔账只在上面的假设下成立。换一种噪声试试:每次出事都是一个事件同时翻掉两个比特,概率 1%。那么一出事就有两票被改,多数表决必输,重复码照样 1% 的时候翻车,一点也没变好。所以评估任何纠错码时都要单独问一句:真实的错误是不是一个一个、互不相干地发生的?

At p = 1%: a bare bit fails 1% of the time, the repetition code about 0.03% (3 × 0.0001 × 0.99 + 0.000001 = 0.000298) — thirty-odd times better. And p² is “area-level small”: the smaller p, the more lopsided the win. This trade — spend quantity, gain quality, error rate p → ~p² — is the common idea behind every code that follows. But the sum holds only under the assumptions above. Try a different noise: every mishap is a single event that flips two bits at once, with probability 1%. Then every mishap changes two votes, majority vote always loses, and the repetition code still fails 1% of the time: no gain at all. So for any code one has to ask separately whether real errors really arrive one at a time and independently.

2.4不看信件的体检:奇偶检查Health-checks that never read the letter: parity checks

多数表决有个隐藏动作:它读了三个比特。经典世界里读一读无妨;但我们即将进入的量子世界,「读」这个动作本身就会毁掉信息(第 3 章见)。所以现在就练习一种不读内容的检修法。

Majority vote hides a step: it reads all three bits. Reading is harmless classically; but in the quantum world we're heading to, the act of reading destroys the information (see Chapter 3). So let's practise a repair method that never reads the content.

把三个比特记作 b₁、b₂、b₃(脚标就是编号)。不问「b₁ 是几?」,只问两个更客气的问题:「b₁ 和 b₂ 一样吗?」「b₂ 和 b₃ 一样吗?」——每个问题只回答「一样 / 不一样」,也就是只报告一对比特之差的奇偶。试试:

Call the three bits b₁, b₂, b₃ (the subscript is just the bit's number). Never ask “what is b₁?” Ask two politer questions instead: “are b₁ and b₂ equal?” and “are b₂ and b₃ equal?” — each answers only equal / different, i.e. reports only a parity. Try it:

两盏灯的读数合起来叫症状全部检查结果拼成的清单(如「不同、相同」)。医学式的名字:syndrome。它指认错误,但不泄露信息内容。——像体检报告:它不告诉你这个人是谁,只告诉你哪里不对劲。对照下表即可锁定嫌疑比特:

The two lamp readings together are called the syndromeThe list of all check outcomes (e.g. “differ, equal”). A medical-flavoured name: it points at the error without revealing the message. — like a medical report: it never says who the patient is, only what is off. A lookup table pins the suspect:

(=, =) → 没事all clear · (≠, =) → 翻的是 b₁b₁ flipped · (≠, ≠) → b₂ · (=, ≠) → b₃
关键想法Key idea

检查报告只指认错误,绝不泄露内容:无论存的是 000 还是 111,两盏灯都全灭。「知错而不知情」——这正是量子世界允许的唯一一种体检。整个 toric code 就是这个想法的宏伟放大。

The report identifies the error, never the content: whether 000 or 111 is stored, both lamps stay dark. “Know the fault, not the secret” — the only kind of check-up the quantum world will allow. The toric code is this idea, magnificently scaled up.

检查站Checkpoint第 2 章Chapter 2
存入 111 后,第 3 个比特被噪声翻成了 110。两个检查「b₁=b₂?」「b₂=b₃?」会亮出什么?You stored 111 and noise turned it into 110. What do the checks “b₁=b₂?” and “b₂=b₃?” show?

对。并且注意:这套读数和「存入 000、b₃ 被翻」时一模一样——检查确实对内容一无所知。

Right. And note: the reading is identical to the case “000 stored, b₃ flipped” — the checks truly know nothing about the content.

逐对比较 110:b₁=1 和 b₂=1 一样;b₂=1 和 b₃=0 不一样。

Compare 110 pair by pair: b₁=1 vs b₂=1 equal; b₂=1 vs b₃=0 differ.

第 3 章Chapter 3

量子比特:会叠加的比特The qubit: a bit that superposes

量子比特只在三件事上不同于普通比特:状态是「配比」而非「取舍」、读取会破坏、错误有两种。这一章把三件事全部讲清,而且只用第 1 章的数学。 A qubit differs from a bit in exactly three ways: its state is a blend rather than a choice, reading it damages it, and it has two kinds of errors. This chapter covers all three using nothing beyond Chapter 1.

3.1状态 = 两个配比数字A state = two blend-numbers

普通比特要么 0 要么 1。量子比特一个遵循量子力学的两状态系统(一个原子的两个能级、一段超导电路……)。英文 qubit。(比如一个原子、一段超导电路)则同时携带「0 的成分」和「1 的成分」,各配一个数字——两种成分同时在场,这就是大名鼎鼎的叠加。我们把状态写成一对数 (a, b):a 是 0-成分的配比,b 是 1-成分的配比。物理学家爱用一种带尖角的括号来记这两种纯状态:|0⟩ 与 |1⟩(读作「ket 0」「ket 1」,就是给标签加了个礼盒),于是整个状态写作:

An ordinary bit is 0 or 1. A qubitAny two-state system obeying quantum mechanics (two energy levels of an atom, a superconducting circuit…). (an atom, a superconducting circuit) carries a “0-part” and a “1-part” simultaneously, each with a number attached — both parts present at once: the famous superposition. Write the state as a pair (a, b): a is the blend-number of the 0-part, b of the 1-part. Physicists dress the two pure states in angular brackets — |0⟩ and |1⟩ (read “ket zero”, “ket one”; it's just gift-wrap for labels) — so the whole state reads:

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

这两个数字叫振幅状态中每个成分所配的数字(可正可负)。测量得到该成分的概率 = 振幅的平方。英文 amplitude。。规则只有两条。规则一(读取规则):如果你去测量,会随机得到 0 或 1,概率分别是 a² 和 b²——概率是振幅的平方,正如面积是边长的平方。规则二(守恒规则):两块概率必须加起来是 1(第 1.3 节),所以 a² + b² = 1——按 1.2 节从勾股定理领来的推论,这意味着每个合法状态都是单位圆上的一个箭头。拖一拖:

These numbers are called amplitudesThe number attached to each component of a state (may be negative). The probability of measuring that component = the amplitude squared.. There are only two rules. Rule one (readout): measuring returns 0 or 1 at random, with probabilities a² and b² — probability is the amplitude squared, as area is side squared. Rule two (conservation): the probabilities must total 1 (§1.3), so a² + b² = 1 — which, by the consequence of Pythagoras collected in §1.2, means every legal state is an arrow on the unit circle. Drag it:

P(0) = a² · P(1) = b² · a² + b² = 1

实验台还演示了第三个事实:测量之后,箭头跳到了你得到的那个答案上并停在那里——原来的配比被清空了。这个不可逆的跳变叫坍缩测量后,状态被替换为「与测量结果一致」的状态,原有叠加信息丢失。英文 collapse。。读取会破坏:这是量子比特的第二个不同。

The panel also demonstrated a third fact: after a measurement the arrow jumps onto the answer you got and stays — the original blend is wiped. This irreversible jump is called collapseAfter measurement the state is replaced by one consistent with the outcome; the original superposition is lost.. Reading damages: the qubit's second difference.

3.2负号是真实的The minus sign is real

振幅可以是负数(圆的左半边和下半边),而平方抹掉负号(1.2 节),所以概率永远合法。但这引出一个尖锐的问题:状态 (0.71, 0.71) 和 (0.71, −0.71) 的测量概率一模一样(都是 50% / 50%),它们是同一个状态吗?

Amplitudes may be negative (the circle's left and lower halves), and squaring erases signs (§1.2), so probabilities stay legal. But that raises a sharp question: (0.71, 0.71) and (0.71, −0.71) give identical outcome probabilities (50/50). Are they the same state?

不是。它们重要到各自有名字:

No. They matter enough to have names of their own:

|+⟩ = (0.71, 0.71) = (|0⟩+|1⟩)/√2 · |−⟩ = (0.71, −0.71) = (|0⟩−|1⟩)/√2

凭什么说它们不同?因为存在一种操作能把它们区分开——下一节就造出这种操作。(另一个常见疑问:整体负号呢?(−a, −b) 与 (a, b) 算不算不同?答案:任何实验都区分不了它们,所以视为同一个状态。差别只在相对符号:a 与 b 之间的符号关系才是真实的。)

Why insist they differ? Because an operation exists that tells them apart — we build it in the next section. (A related worry: what about an overall minus, (−a, −b) vs (a, b)? No experiment can distinguish those, so they count as the same state. Only the relative sign — between a and b — is real.)

3.3两个基本操作:X 与 ZTwo elementary operations: X and Z

对一个量子比特,我们只需要两种「拨动」。X(交换):把两个配比数字对调——它是量子版的「比特翻转」。Z(变号):给 1-成分的配比换个符号,0-成分不动。写成公式:

We need only two ways of “nudging” a qubit. X (swap): exchange the two blend-numbers — the quantum bit-flip. Z (re-sign): flip the sign of the 1-part, leave the 0-part alone. As formulas:

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

检查一下它们对四个招牌状态做了什么(每一行都能用上面的公式手算验证):

Check what they do to the four flagship states (each line follows from the formulas by hand):

X|0⟩=|1⟩ X|1⟩=|0⟩ X|+⟩=|+⟩ X|−⟩=−|−⟩
Z|0⟩=|0⟩ Z|1⟩=−|1⟩ Z|+⟩=|−⟩ Z|−⟩=|+⟩

读出两个对称的事实:X 交换 0/1,却把 |+⟩、|−⟩ 各自留在原地(|−⟩ 只多了个无关紧要的整体负号);Z 交换 +/−,却把 |0⟩、|1⟩ 留在原地。Z 能把 |+⟩ 变成 |−⟩——这就是 3.2 节承诺的「能区分它们的操作」的种子:+ 和 − 确实是两个不同的、可以被操作互换的状态。

Two symmetric facts: X swaps 0/1 yet leaves |+⟩ and |−⟩ in place (|−⟩ merely picks up an irrelevant overall minus); Z swaps +/− yet leaves |0⟩ and |1⟩ in place. Z turns |+⟩ into |−⟩ — the seed of the promised “operation that tells them apart”: + and − really are two distinct, swappable states.

3.4两副眼镜:0/1 视角与 +/− 视角Two lenses: the 0/1 view and the +/− view

既然 |+⟩ 和 |−⟩ 是一对堂堂正正的状态,我们同样可以问:任意状态 (a, b) 里含有多少 |+⟩ 成分、多少 |−⟩ 成分?答案有公式(它从哪来、为什么两个平方加起来仍是 1,都在下面的折叠盒里):

Since |+⟩ and |−⟩ are perfectly legitimate states, we may equally ask: how much |+⟩-part and |−⟩-part does a state (a, b) contain? There is a formula (where it comes from, and why its two squares still add up to 1, is in the fold-out below):

c₊ = (a + b)/√2 · c₋ = (a − b)/√2 · c₊² + c₋² = a² + b² = 1
c₊、c₋ 的公式从哪来?为什么 c₊² + c₋² 还是 1?Where do the formulas for c₊, c₋ come from? Why is c₊² + c₋² still 1?

公式从哪来。状态写成一对数,两个状态相加就是对应位置的数相加,乘一个数就是两个位置都乘它。先把 |0⟩、|1⟩ 用 |+⟩、|−⟩ 表示出来。|+⟩ = (1/√2, 1/√2),|−⟩ = (1/√2, −1/√2)。两者相加:(2/√2, 0) = (√2, 0) = √2·|0⟩,所以 |0⟩ = (|+⟩ + |−⟩)/√2。两者相减:(0, 2/√2) = √2·|1⟩,所以 |1⟩ = (|+⟩ − |−⟩)/√2。代进任意状态:

Where the formulas come from. A state is a pair of numbers; adding two states adds the numbers position by position, and multiplying by a number multiplies both positions. First express |0⟩ and |1⟩ through |+⟩ and |−⟩. |+⟩ = (1/√2, 1/√2) and |−⟩ = (1/√2, −1/√2). Their sum is (2/√2, 0) = (√2, 0) = √2·|0⟩, so |0⟩ = (|+⟩ + |−⟩)/√2. Their difference is (0, 2/√2) = √2·|1⟩, so |1⟩ = (|+⟩ − |−⟩)/√2. Substitute into any state:

a|0⟩ + b|1⟩ = a·(|+⟩ + |−⟩)/√2 + b·(|+⟩ − |−⟩)/√2 = (a + b)/√2·|+⟩ + (a − b)/√2·|−⟩

|+⟩ 前面的数就是 c₊,|−⟩ 前面的数就是 c₋。拿 (0.6, 0.8) 验一下:c₊ = 1.4/1.414 ≈ 0.99,c₋ = −0.2/1.414 ≈ −0.14;平方是 0.98 和 0.02,加起来还是 1。

The number in front of |+⟩ is c₊ and the number in front of |−⟩ is c₋. Check with (0.6, 0.8): c₊ = 1.4/1.414 ≈ 0.99 and c₋ = −0.2/1.414 ≈ −0.14; their squares are 0.98 and 0.02, which again add up to 1.

为什么平方和还是 1。

Why the squares still add up to 1.

先手算一个通用小工具:(a+b)² 是边长为 a+b 的正方形面积。把这个正方形沿两边各切一刀(切在 a 与 b 的分界处),得到四块:一块 a×a、一块 b×b、两块 a×b。所以 (a+b)² = a² + 2ab + b²。同理 (a−b)² = a² − 2ab + b²。相加时 +2ab 和 −2ab 抵消:(a+b)² + (a−b)² = 2a² + 2b²。除以 2(即除以 (√2)²):c₊² + c₋² = a² + b² = 1。负号的账目全部自动平衡。

First a hand tool: (a+b)² is the area of a square of side a+b. Cut it once each way at the a/b boundary: four pieces — one a×a, one b×b, two a×b. Hence (a+b)² = a² + 2ab + b², and likewise (a−b)² = a² − 2ab + b². Adding, the +2ab and −2ab cancel: (a+b)² + (a−b)² = 2a² + 2b². Divide by 2 (that is, by (√2)²): c₊² + c₋² = a² + b² = 1. The minus-sign bookkeeping balances itself.

于是同一个状态可以戴两副眼镜看:0/1 眼镜读出 (a, b),+/− 眼镜读出 (c₊, c₋)。测量也有两种问法:问「0 还是 1」,概率是 a²、b²;问「+ 还是 −」,概率是 c₊²、c₋²。3.3 的表里已经看到:X 把 |+⟩、|−⟩ 各自留在原地(|−⟩ 最多多一个整体负号),Z 把 |0⟩、|1⟩ 各自留在原地。所以文献里常把 +/− 眼镜叫「X 眼镜」(它的两个状态被 X 保持不动),0/1 眼镜叫「Z 眼镜」(它的两个状态被 Z 保持不动)。亲手对照:

So one state supports two lenses: the 0/1 lens reads (a, b), the +/− lens reads (c₊, c₋). Measurement comes in two flavours too: asking “0 or 1?” has probabilities a², b²; asking “+ or −?” has c₊², c₋². The table in §3.3 already showed that X leaves |+⟩ and |−⟩ each in place (|−⟩ picks up at most an overall minus sign), and Z leaves |0⟩ and |1⟩ each in place. That is why the +/− lens is often called the “X lens” (X keeps its two states fixed) and the 0/1 lens the “Z lens” (Z keeps its two states fixed). Compare live:

关键想法Key idea

量子比特有两种错误。噪声若施加 X:0/1 眼镜里是翻转,+/− 眼镜里没事。噪声若施加 Z:0/1 眼镜里毫无动静,+/− 眼镜里却是实打实的翻转!经典世界只有一种翻转,量子世界有两种,而且互相隐身——必须两副眼镜同时设防。

A qubit has two kinds of errors. If noise applies X: a flip in the 0/1 lens, invisible in +/−. If noise applies Z: nothing in the 0/1 lens, but a genuine flip in +/−! The classical world had one flip; the quantum world has two, each hiding from the other lens — so we must guard both lenses at once.

X 错误:翻转 0/1,放过 +/−error: flips 0/1, spares +/− · Z 错误:翻转 +/−,放过 0/1error: flips +/−, spares 0/1

3.5顺序之争:XZ = −ZXThe order feud: XZ = −ZX

整座大厦最关键的一块砖,是一个三行就能算完的小事实:对同一个量子比特先做 X 再做 Z,和先做 Z 再做 X,结果差一个整体负号。先约定写法:一串操作从右往左读,紧挨着状态的那个先做。ZX(a, b) 的意思是先做 X、再做 Z:X 把 (a, b) 变成 (b, a),Z 再给第二个数变号,得 (b, −a)。XZ(a, b) 是先 Z 后 X:Z 给出 (a, −b),X 再对调,得 (−b, a)。用 3.3 的公式在实验台上一步步走:

The single most important brick of the whole building is a three-line calculation: on the same qubit, X-then-Z versus Z-then-X differ by one overall minus sign. First a convention: a string of operations is read from right to left; the one next to the state acts first. ZX(a, b) means X first, then Z: X turns (a, b) into (b, a), then Z flips the sign of the second number, giving (b, −a). XZ(a, b) is Z first, then X: Z gives (a, −b), then X swaps, giving (−b, a). Step through it on the bench with §3.3's formulas:

ZX(a,b) = (b, −a) · XZ(a,b) = (−b, a) = −(b, −a) ⇒ XZ = −ZX

给这两种关系起名(这是本教程最后一批「行话」之一):两个操作若交换顺序结果完全相同,称它们对易PQ = QP:先后顺序无关紧要。英文 commute。;若交换顺序会多出一个整体负号,称它们反对易PQ = −QP:交换顺序付出一个整体 −1。英文 anticommute。同一比特上的 X 与 Z 反对易。。同一个比特上的 X 与 Z 反对易;而作用在不同比特上的操作互不打扰,永远对易。

Name the two relationships (among the last “jargon” in this tutorial): if swapping the order changes nothing, the operations commutePQ = QP: order irrelevant.; if swapping costs one overall minus, they anticommutePQ = −QP: swapping the order costs a global −1. X and Z on the same qubit anticommute.. X and Z on the same qubit anticommute; operations on different qubits never interfere and always commute.

3.6复制不行,偷看也不行:危机No copying, no peeking: the crisis

现在把第 2 章的三倍保险搬过来——立刻碰壁两次。壁一:重复码的第一步是「把要存的比特复印三份」。存 0 时这没问题,可量子比特存的是一个未知的状态 (a, b),而未知的量子状态无法复印。这条规律叫不可克隆定理。直觉:若能复印,就能把许多副本分成两堆,一堆戴 0/1 眼镜测、一堆戴 +/− 眼镜测(3.4 节)。第一堆里 0 的占比约是 a²,只给出 a、b 的大小,不给符号:(0.6, 0.8) 和 (0.6, −0.8) 都是 36% 读到 0、64% 读到 1。第二堆补上符号:读到 + 的占比是 c₊² = (a + b)²/2,前者约 98%,后者约 2%。两堆合起来就把 (a, b) 读了出来,最多差一个整体负号,而 (a, b) 和 (−a, −b) 在任何测量里概率都一样(概率是平方),这个整体负号本来就测不出、也不影响任何结果。这等于绕过了坍缩。它的证明只有几行,放在 4.5 的补课 4.D 里,同一处还会说明量子码怎样绕开它。壁二:就算绕过复印,多数表决还得「读取」三个比特,而 3.1 节说了,读取即坍缩。

Now carry Chapter 2's triple insurance over — and hit two walls at once. Wall one: repetition starts by “photocopy the bit three times”. For a stored 0 that is harmless, but a qubit holds an unknown state (a, b), and unknown quantum states cannot be copied. The rule is called the no-cloning theorem. Intuition: a copier would let you split many copies into two piles, measure one pile through the 0/1 lens and the other through the +/− lens (§3.4). In the first pile the share of 0s is about a², which gives the sizes of a and b but not their signs: (0.6, 0.8) and (0.6, −0.8) both read 0 36% of the time and 1 64% of the time. The second pile supplies the sign: the share of + is c₊² = (a + b)²/2, about 98% for the first state and 2% for the second. Together the two piles read off (a, b) up to an overall minus sign, and (a, b) and (−a, −b) give the same probabilities in every measurement (probabilities are squares), so that overall sign cannot be detected and affects nothing. That would dodge collapse. Its proof takes a few lines and sits in Catch-up 4.D of §4.5, which also shows how a quantum code gets around it. Wall two: even granting copies, majority vote must read three qubits, and §3.1 said reading collapses.

但 2.4 节埋好的伏笔现在亮出来了:奇偶检查从头到尾没读过内容。如果存在「量子版的奇偶检查」——只问「一样吗」,不问「是什么」——那么两面墙同时绕开。它存在。这就是下一章。

But §2.4's foreshadowing now pays off: parity checks never read the content at all. If a “quantum parity check” exists — asking only “equal?”, never “which?” — both walls are bypassed at once. It exists. That is the next chapter.

检查站Checkpoint第 3 章Chapter 3
噪声对状态 (0.6, 0.8) 施加了一个 Z。哪句话是对的?Noise applies a Z to the state (0.6, 0.8). Which statement is true?

对。用公式算:c₊ 从 (0.6+0.8)/√2 ≈ 0.99 变成 (0.6−0.8)/√2 ≈ −0.14,c₋ 反之。0/1 概率纹丝不动(0.36 / 0.64),+/− 概率却从 98%/2% 变成了 2%/98%——这就是「第二种错误」的真面目。

Right. Compute: c₊ goes from (0.6+0.8)/√2 ≈ 0.99 to (0.6−0.8)/√2 ≈ −0.14, and c₋ the reverse. The 0/1 probabilities hold at 0.36/0.64, but the +/− probabilities swing from 98%/2% to 2%/98% — the true face of the “second error”.

回看 3.3 的公式表:Z(a,b) = (a, −b),交换两个数的是 X。再回看 3.4:Z 的动静只在 +/− 眼镜里现形。

Check §3.3: Z(a,b) = (a, −b); swapping numbers is X's job. And §3.4: Z's mischief shows only in the +/− lens.

第 4 章Chapter 4

不看答案的检查:量子版奇偶体检Checks that don't peek: quantum parity exams

这一章交付整座大厦的承重墙:一种只问「一样吗」而绝不问「是什么」的量子测量。有了它,我们建成第一个量子纠错码,并亲眼看着它在 Z 错误面前轰然倒塌——倒塌的姿势会告诉我们 toric code 该长什么样。 This chapter delivers the load-bearing wall: a quantum measurement that asks only “equal?” and never “which?”. With it we build our first quantum code — and watch it collapse against Z errors, in exactly the way that tells us what the toric code must look like.

4.1两个量子比特 = 四个配比数字Two qubits = four blend-numbers

两个普通比特合起来有四种可能:00、01、10、11。两个量子比特就同时携带这四种成分,每种配一个振幅:

Two ordinary bits have four possible readings: 00, 01, 10, 11. Two qubits carry all four components at once, one amplitude each:

状态state = a₀₀|00⟩ + a₀₁|01⟩ + a₁₀|10⟩ + a₁₁|11⟩ · a₀₀²+a₀₁²+a₁₀²+a₁₁² = 1

读取规则照旧:同时测量两个比特,得到「00」的概率是 a₀₀²,以此类推。操作也照旧,只是要注明作用在谁身上:X₁ 表示「对 1 号比特做 X」——它交换所有「1 号位为 0」和「1 号位为 1」的成分对(|00⟩↔|10⟩,|01⟩↔|11⟩);Z₂ 表示「对 2 号比特做 Z」——它给所有「2 号位为 1」的成分变号。

Readout works as before: measuring both qubits yields “00” with probability a₀₀², and so on. Operations too, now with an address: X₁ means “apply X to qubit 1” — it swaps every pair of components differing in slot 1 (|00⟩↔|10⟩, |01⟩↔|11⟩); Z₂ means “apply Z to qubit 2” — it re-signs every component whose slot 2 reads 1.

4.2量子版的「一样吗?」The quantum “are they equal?”

第 2.4 节的检查问的是「b₁ 和 b₂ 一样吗」。量子版本记作「测量 Z₁Z₂」,规矩如下。四个成分按「两位一样 / 两位不一样」分成两组:{00, 11} 一组,{01, 10} 一组。测量给出 +1(一样)或 −1(不一样),概率各是本组振幅的平方和;然后状态只删掉落选组的成分(并把留下的整体放大回总概率 1)——落选组之外,谁也没被读、谁也没坍缩:

Section 2.4's check asked “are b₁ and b₂ equal?”. The quantum version, written “measure Z₁Z₂”, works so: sort the four components into “slots equal” {00, 11} and “slots differ” {01, 10}. The measurement returns +1 (equal) or −1 (differ), with probability the sum of squared amplitudes in that group; then the state merely deletes the losing group (rescaling the rest back to total probability 1) — nothing else is read, nothing else collapses:

P(+1) = a₀₀² + a₁₁² · P(−1) = a₀₁² + a₁₀² · 测后:只留答案组,再整体归一after: keep the answer's group, renormalize

「整体归一」是一个具体的动作:留下的振幅平方和不再是 1,就把它们同乘一个数,让平方和回到 1,彼此的比例不变。例:|++⟩ 的四个振幅都是 ½。P(+1) = ¼ + ¼ = ½。若得 +1,删掉 01、10 两项,剩 (½, 0, 0, ½),平方和只有 ½;两个数同乘 √2 ≈ 1.41,得 (0.71, 0, 0, 0.71),平方和回到 0.5 + 0.5 = 1。

“Renormalize” is a concrete step: the surviving amplitudes no longer have squares summing to 1, so multiply them all by one number that brings the sum back to 1 without changing their ratios. Example: |++⟩ has four amplitudes of ½. P(+1) = ¼ + ¼ = ½. If the answer is +1, delete the 01 and 10 terms, leaving (½, 0, 0, ½), whose squares add up to only ½; multiply both by √2 ≈ 1.41 to get (0.71, 0, 0, 0.71), whose squares add up to 0.5 + 0.5 = 1.

Z₁Z₂ 这个名字也是一个操作:对 1 号比特做 Z、再对 2 号比特做 Z。每个 Z 给「本位为 1」的成分乘 −1,所以 Z₁Z₂ 给 |00⟩ 乘 (−1)⁰ = +1、给 |11⟩ 乘 (−1)² = +1、给 |01⟩ 和 |10⟩ 各乘 −1。「一样」组正是被乘 +1 的那组。由此得到后面反复要用的一句话:测 Z₁Z₂ 必然得 +1 ⇔ 状态只在 {00, 11} 上有成分 ⇔ 对状态施加操作 Z₁Z₂ 后它原样不变。例:Z₁Z₂ 把贝尔态 (0.71, 0, 0, 0.71) 送到 (0.71, 0, 0, 0.71)(两个 0 乘 −1 仍是 0),还是它自己;把 |++⟩ 送到 (½, −½, −½, ½),变了,所以测 |++⟩ 没有必然的答案。

The name Z₁Z₂ is also an operation: Z on qubit 1, then Z on qubit 2. Each Z multiplies the components whose own slot reads 1 by −1, so Z₁Z₂ multiplies |00⟩ by (−1)⁰ = +1, |11⟩ by (−1)² = +1, and |01⟩ and |10⟩ by −1 each. The “equal” group is exactly the group multiplied by +1. This gives a sentence we will use again and again: measuring Z₁Z₂ surely gives +1 ⇔ the state has components only on {00, 11} ⇔ applying the operation Z₁Z₂ leaves the state unchanged. Example: Z₁Z₂ sends the Bell state (0.71, 0, 0, 0.71) to (0.71, 0, 0, 0.71) (the two zeros stay zero when multiplied by −1), itself again; it sends |++⟩ to (½, −½, −½, ½), a different state, so measuring |++⟩ has no certain answer.

「测量 X₁X₂」问的是「两个比特在 +/− 眼镜下一样吗」。规则镜像照搬:把状态换成 +/− 眼镜下的四个成分 |++⟩、|+−⟩、|−+⟩、|−−⟩,「一样」组是 {++, −−}(答 +1),「不一样」组是 {+−, −+}(答 −1)。和 Z₁Z₂ 一样,测 X₁X₂ 必然 +1 ⇔ 施加 X₁X₂ 后状态不变:实验台后面的「看法二」会说明「状态不变 ⇒ 必然 +1」,其余由补课 4.A 逐项验证。

“Measure X₁X₂” asks “are the two qubits equal in the +/− lens?”. The rules are mirrored: write the state with its four +/−-lens components |++⟩, |+−⟩, |−+⟩, |−−⟩; the “equal” group is {++, −−} (answer +1), the “differ” group is {+−, −+} (answer −1). As with Z₁Z₂, measuring X₁X₂ surely gives +1 ⇔ applying X₁X₂ leaves the state unchanged: “view two” after the bench shows “state unchanged ⇒ surely +1”, and Catch-up 4.A checks the rest term by term.

在下面的实验台亲手确认三件事。第一件:制备「贝尔态(|00⟩+|11⟩)/√2 —— 两个量子比特最著名的纠缠状态:各自单看完全随机,合起来却完美相关。」(|00⟩+|11⟩)/√2,测 Z₁Z₂——答案必然 +1,而且状态原封不动:一次没有任何破坏的测量!第二件:制备 |++⟩(四个成分各 ½),测 Z₁Z₂——这回答案五五开,若得 +1,剩下的恰好是贝尔态:检查不仅温柔,还会亲手织出纠缠。第三件:还是贝尔态,这回按「测 X₁X₂」——答案同样必然 +1,状态同样原封不动。这一件没法从柱子上看出来,实验台下面专门讲为什么。

Confirm three facts on the bench below. First: prepare the “Bell state(|00⟩+|11⟩)/√2 — the most famous entangled state of two qubits: each alone is perfectly random, together perfectly correlated.” (|00⟩+|11⟩)/√2 and measure Z₁Z₂ — the answer is +1 with certainty, and the state is untouched: a measurement with zero damage! Second: prepare |++⟩ (four components of ½) and measure Z₁Z₂ — now the answer is 50/50, and if you get +1 what remains is exactly the Bell state: the check is not only gentle, it weaves entanglement with its own hands. Third: back to the Bell state, but press “Measure X₁X₂” this time — again +1 for sure, and again the state stays put. You can't read this one off the bars, so the reason comes right after the bench.

第三件凭什么成立?柱状图帮不上忙:它画的是 0/1 眼镜下的四个振幅,而 X₁X₂ 的两组是 +/− 眼镜下的成分。有两种看法,结论一样。

Why does the third fact hold? The bars can't help: they show the four amplitudes in the 0/1 lens, while the two groups of X₁X₂ are components in the +/− lens. There are two ways to see it, and they agree.

看法一:换副眼镜重写。用 3.4 节的公式,|0⟩ 在 +/− 眼镜下读出 c₊ = c₋ = 1/√2,|1⟩ 读出 c₊ = 1/√2、c₋ = −1/√2,也就是 |0⟩ = (|+⟩+|−⟩)/√2,|1⟩ = (|+⟩−|−⟩)/√2。把它们代进贝尔态乘开:|00⟩ 和 |11⟩ 各贡献四项,其中 |+−⟩ 和 |−+⟩ 一个带正号、一个带负号,正好抵消,剩下的是:

View one: rewrite it in the other lens. By §3.4's formula, |0⟩ reads c₊ = c₋ = 1/√2 in the +/− lens, and |1⟩ reads c₊ = 1/√2, c₋ = −1/√2. In other words |0⟩ = (|+⟩+|−⟩)/√2 and |1⟩ = (|+⟩−|−⟩)/√2. Put these into the Bell state and multiply out: |00⟩ and |11⟩ each give four terms, and the |+−⟩ and |−+⟩ terms come once with a plus sign and once with a minus sign, so they cancel. What is left:

(|00⟩ + |11⟩)/√2 = (|++⟩ + |−−⟩)/√2

戴上 +/− 眼镜,贝尔态也只含「两位一样」的两个成分,落选组 {+−, −+} 的振幅是 0。这和第一件是同一个道理,只是换了副眼镜:答案必然 +1,也没有什么可删的。

Through the +/− lens, the Bell state again holds only the two “equal” components; the losing group {+−, −+} has amplitude 0. It is the first fact all over again, seen through the other lens: the answer is surely +1, and there is nothing to delete.

看法二:看操作本身。X₁X₂ 把两个比特同时翻转,也就是把成分成对交换:|00⟩↔|11⟩,|01⟩↔|10⟩。贝尔态里 |00⟩ 和 |11⟩ 的振幅都是 1/√2,换完还是一模一样:X₁X₂ 作用后,状态纹丝不动。这为什么就意味着「必然 +1」?因为在 +/− 眼镜下,X₁X₂ 放过「一样」的成分(|++⟩、|−−⟩),却给「不一样」的成分变号(|+−⟩ → −|+−⟩),正像 Z₁Z₂ 给 01、10 变号。一个状态被它作用后毫无变化,里面就不可能藏着「不一样」的成分。

View two: look at the operation itself. X₁X₂ flips both qubits at once, which swaps the components in pairs: |00⟩↔|11⟩ and |01⟩↔|10⟩. In the Bell state, |00⟩ and |11⟩ both have amplitude 1/√2, so after the swap nothing has changed: X₁X₂ leaves the state exactly as it was. Why does that mean “surely +1”? In the +/− lens, X₁X₂ leaves the “equal” components (|++⟩, |−−⟩) alone and flips the sign of the “unequal” ones (|+−⟩ → −|+−⟩), just as Z₁Z₂ flips the sign of 01 and 10. If a state comes through X₁X₂ unchanged, it can't be hiding any “unequal” part.

两组结果正好互为镜像,可以在实验台上逐个验证:|00⟩ 测 Z₁Z₂ 必然 +1,测 X₁X₂ 却五五开;|++⟩ 反过来,测 X₁X₂ 必然 +1,测 Z₁Z₂ 五五开。贝尔态是两副眼镜下同时「一样」的那一个,4.4 节还会倒过来证明:只有它是。我们的工具箱就此配齐:Z-型检查守 0/1 眼镜,X-型检查守 +/− 眼镜。

The results mirror each other, and you can check each one on the bench: |00⟩ gives Z₁Z₂ = +1 for sure but X₁X₂ is 50/50; |++⟩ is the other way round, X₁X₂ = +1 for sure and Z₁Z₂ 50/50. The Bell state is “equal” in both lenses at once, and §4.4 will run the argument backwards to show it is the only such state. Our toolbox is complete: Z-type checks guard the 0/1 lens, X-type checks guard the +/− lens.

补课 · 「测 X₁X₂ 必然 +1」为什么就是「X₁X₂ 作用后状态不变」Catch-up · Why “measuring X₁X₂ surely gives +1” means “X₁X₂ leaves the state unchanged”

对 Z₁Z₂,这句话一眼可见:它的两个组就是 0/1 眼镜下的成分。对 X₁X₂,组是 +/− 眼镜下的成分,要先把状态换算过去。每个比特按 3.4 的换算 |0⟩ = (|+⟩ + |−⟩)/√2、|1⟩ = (|+⟩ − |−⟩)/√2 拆开,再像 (a + b)(c − d) 那样逐项展开。以 |01⟩(第 1 位 0、第 2 位 1)为例:

For Z₁Z₂ the sentence is visible at a glance: its two groups are components in the 0/1 lens. For X₁X₂ the groups are components in the +/− lens, so first convert the state. Split each qubit with §3.4's conversion |0⟩ = (|+⟩ + |−⟩)/√2, |1⟩ = (|+⟩ − |−⟩)/√2, then multiply out term by term, as with (a + b)(c − d). Take |01⟩ (slot 1 is 0, slot 2 is 1):

|01⟩ = (|+⟩ + |−⟩)(|+⟩ − |−⟩)/2 = ( |++⟩ − |+−⟩ + |−+⟩ − |−−⟩ )/2

四个基本成分都这样换算后合并同类项,一般状态 (a₀₀, a₀₁, a₁₀, a₁₁) 在 +/− 眼镜下的四个振幅是:

Converting all four basic components this way and collecting terms, a general state (a₀₀, a₀₁, a₁₀, a₁₁) has these four amplitudes in the +/− lens:

c₊₊ = (a₀₀ + a₀₁ + a₁₀ + a₁₁)/2 · c₊₋ = (a₀₀ − a₀₁ + a₁₀ − a₁₁)/2
c₋₊ = (a₀₀ + a₀₁ − a₁₀ − a₁₁)/2 · c₋₋ = (a₀₀ − a₀₁ − a₁₀ + a₁₁)/2

「测 X₁X₂ 必然 +1」= 「不一样」组 {+−, −+} 没有成分 = c₊₋ = 0 且 c₋₊ = 0。把这两个等式相加:2a₀₀ − 2a₁₁ = 0,即 a₀₀ = a₁₁;相减:2a₁₀ − 2a₀₁ = 0,即 a₀₁ = a₁₀。而 X₁X₂ 作为操作恰好对调 a₀₀ ↔ a₁₁、a₀₁ ↔ a₁₀,对调后不变的条件也正是 a₀₀ = a₁₁、a₀₁ = a₁₀。两个条件是同一个条件。

“Measuring X₁X₂ surely gives +1” = the “differ” group {+−, −+} is empty = c₊₋ = 0 and c₋₊ = 0. Add the two equations: 2a₀₀ − 2a₁₁ = 0, so a₀₀ = a₁₁; subtract them: 2a₁₀ − 2a₀₁ = 0, so a₀₁ = a₁₀. And X₁X₂, as an operation, swaps a₀₀ ↔ a₁₁ and a₀₁ ↔ a₁₀; the state survives that swap unchanged under exactly the same condition a₀₀ = a₁₁, a₀₁ = a₁₀. The two conditions are one and the same.

用数字核对两例。贝尔态 (0.71, 0, 0, 0.71):c₊₋ = (0.71 − 0 + 0 − 0.71)/2 = 0,c₋₊ = 0,测 X₁X₂ 必得 +1;它也确实满足 a₀₀ = a₁₁、a₀₁ = a₁₀。|01⟩ = (0, 1, 0, 0):c₊₋ = −½,c₋₊ = ½,P(−1) = ¼ + ¼ = ½,没有必然的答案;X₁X₂ 把它变成 |10⟩,确实变了。

Check two cases with numbers. The Bell state (0.71, 0, 0, 0.71): c₊₋ = (0.71 − 0 + 0 − 0.71)/2 = 0 and c₋₊ = 0, so measuring X₁X₂ surely gives +1; and it does satisfy a₀₀ = a₁₁, a₀₁ = a₁₀. |01⟩ = (0, 1, 0, 0): c₊₋ = −½ and c₋₊ = ½, so P(−1) = ¼ + ¼ = ½ and there is no certain answer; X₁X₂ turns it into |10⟩, a different state.

这条规则对本教程里的每一条检查都成立:测检查 S 必然得 +1 ⇔ 施加 S 后状态不变;必然得 −1 ⇔ 施加 S 后状态恰好变成自己的 −1 倍。后面写成 Sψ = ψ 与 Sψ = −ψ(ψ 读「普西」,只是状态的名字)。

The rule holds for every check in this tutorial: measuring a check S surely gives +1 ⇔ applying S leaves the state unchanged; surely gives −1 ⇔ applying S turns the state into exactly −1 times itself. Later we write this as Sψ = ψ and Sψ = −ψ (ψ, read “psy”, is just the state's name).

4.3哪些检查能同时进行?数碰撞Which checks can coexist? Count collisions

一套体检要同时问很多问题,问题之间必须互不拆台:先问甲再问乙,和先乙后甲,结论得一样——用 3.5 节的话说,两组操作必须对易。判断规则简单得出奇。把两个多比特操作各写成一排字母(每个比特一格,格里是 I「不动」、X 或 Z;这样的一排有个学名叫泡利串形如 X·I·Z·… 的多比特操作,每格是 I、X、Z 之一(完整版还有 Y)。以物理学家泡利命名。英文 Pauli string。)。逐格对照:只有「一格里 X 撞上 Z」才会按 3.5 节产生一个 −1。所以:

A physical exam asks many questions at once, and they must not undermine each other: asking A then B must agree with B then A — in §3.5's language, the operations must commute. The test is astonishingly simple. Write each multi-qubit operation as a row of letters (one cell per qubit: I “leave alone”, X, or Z; such a row is called a Pauli stringA multi-qubit operation like X·I·Z·…, one of I, X, Z per cell (the full story adds Y). Named after physicist Pauli.). Compare cell by cell: only a cell where X meets Z contributes a −1, by §3.5. Hence:

交换两串的顺序,代价为swapping the two strings costs (−1)#(X↔Z 碰撞格collision cells) (# = 「……的个数」“the number of …”) ⇒ 碰撞数为偶 ⇔ 对易even collisions ⇔ commute
关键想法Key idea

两串检查能否和平共处,只取决于一个数的奇偶:X 与 Z 撞在同一格的次数。偶数次 → 对易,可以同时问;奇数次 → 反对易,互相拆台。第 1.4 节备好的钥匙,在这里开锁。

Whether two checks coexist depends on the parity of one number: how many cells have X colliding with Z. Even → commute, ask both freely; odd → anticommute, they sabotage each other. The key forged in §1.4 turns here.

补课 · 碰撞规则是怎么算出来的,检查为什么必须两两对易Catch-up · Where the collision rule comes from, and why checks must commute
第一步:不同比特上的操作互不干扰Step 1: operations on different qubits do not interfere

拿两比特状态 (a₀₀, a₀₁, a₁₀, a₁₁) 试 X₁ 和 Z₂。X₁ 把第 1 位不同的成分两两对调,得 (a₁₀, a₁₁, a₀₀, a₀₁);Z₂ 给第 2 位为 1 的成分(01 和 11)变号。

Try X₁ and Z₂ on a two-qubit state (a₀₀, a₀₁, a₁₀, a₁₁). X₁ swaps the components that differ in slot 1, giving (a₁₀, a₁₁, a₀₀, a₀₁); Z₂ flips the sign of the components whose slot 2 is 1 (01 and 11).

先 X₁ 后 Z₂X₁ then Z₂:(a₁₀, a₁₁, a₀₀, a₀₁) → (a₁₀, −a₁₁, a₀₀, −a₀₁)
先 Z₂ 后 X₁Z₂ then X₁:(a₀₀, −a₀₁, a₁₀, −a₁₁) → (a₁₀, −a₁₁, a₀₀, −a₀₁)

两条路线结果相同:Z₂X₁ = X₁Z₂。原因是 X₁ 只改第 1 位,而 Z₂ 的正负号只看第 2 位,谁也不改对方关心的那一位。任何两个作用在不同比特上的操作都是这样。

Both routes give the same result: Z₂X₁ = X₁Z₂. The reason is that X₁ changes only slot 1, while Z₂ decides its sign by slot 2 alone; neither touches the slot the other one reads. The same holds for any two operations on different qubits.

第二步:一格一格地挪Step 2: move one cell at a time

要把两串的顺序对调,就把一串的字母一个一个挪过另一串。挪过不同比特上的字母免费(第一步),挪过同一比特上的字母时,只有 X 遇 Z 付一个 −1(3.5);X 遇 X、Z 遇 Z、遇到 I 都免费。例:X₁X₂ 与 Z₁Z₂ 在第 1、2 格各碰撞一次。

To swap two strings, move the letters of one string past the other one at a time. Passing a letter on a different qubit is free (step 1); passing a letter on the same qubit costs a −1 only when X meets Z (§3.5); X meeting X, Z meeting Z, or anything meeting I is free. Example: X₁X₂ and Z₁Z₂ collide once in cell 1 and once in cell 2.

X₁X₂·Z₁Z₂ = (X₁Z₁)(X₂Z₂) = (−Z₁X₁)(−Z₂X₂) = (−1)²·Z₁Z₂·X₁X₂ = +Z₁Z₂·X₁X₂

第一个等号把 Z₁ 挪过 X₂(不同比特,免费),第二个等号在两格各用一次 XZ = −ZX,第三个等号再把 X₁ 挪过 Z₂(免费)。两次碰撞、两个 −1,乘起来是 +1:对易。换成 X₁ 与 Z₁Z₂,只有第 1 格碰撞:X₁·Z₁Z₂ = −Z₁X₁Z₂ = −Z₁Z₂·X₁,一个 −1:反对易。

The first equals sign moves Z₁ past X₂ (different qubits, free); the second uses XZ = −ZX once in each cell; the third moves X₁ past Z₂ (free). Two collisions, two factors of −1, product +1: they commute. With X₁ and Z₁Z₂ instead, only cell 1 collides: X₁·Z₁Z₂ = −Z₁X₁Z₂ = −Z₁Z₂·X₁, one −1: they anticommute.

为什么一套检查必须两两对易Why a set of checks must commute pairwise

Z₁ 与 X₁ 在同一格碰撞一次,反对易。试着找一个单比特状态 (a, b),让两条检查都必然给 +1。测 Z₁ 就是问「是 0(答 +1)还是 1(答 −1)」,按 3.1 的读取规则,必然 +1 要求 b = 0(状态是 |0⟩)。测 X₁ 就是问「是 +(答 +1)还是 −(答 −1)」,按 3.4 的公式,必然 +1 要求 c₋ = (a − b)/√2 = 0,即 a = b(状态是 |+⟩)。a = b = 0 违反 a² + b² = 1,这样的状态不存在。一般地,若 S 与 T 反对易,而某个状态同时满足 Sψ = ψ、Tψ = ψ,那么

Z₁ and X₁ collide once in the same cell and anticommute. Try to find a one-qubit state (a, b) for which both checks surely give +1. Measuring Z₁ asks “0 (answer +1) or 1 (answer −1)?”; by §3.1's readout rule, a sure +1 requires b = 0 (the state |0⟩). Measuring X₁ asks “+ (answer +1) or − (answer −1)?”; by the formulas of §3.4, a sure +1 requires c₋ = (a − b)/√2 = 0, i.e. a = b (the state |+⟩). a = b = 0 violates a² + b² = 1, so no such state exists. In general, if S and T anticommute and some state satisfies both Sψ = ψ and Tψ = ψ, then

ψ = S(Tψ) = −T(Sψ) = −ψ

一个状态等于自己的 −1 倍,只能每个振幅都是 0,不是合法状态。所以一旦清单里有一对反对易的检查,没有任何状态能通过全部检查,码里一个信息也存不进去。对易的检查则没有这个矛盾:4.4 会看到 Z₁Z₂ 与 X₁X₂(碰撞 2 次)有一个共同通过者。

A state equal to −1 times itself must have every amplitude equal to 0, which is not a legal state. So as soon as a checklist contains one anticommuting pair, no state passes all the checks, and the code cannot store anything. Commuting checks have no such contradiction: §4.4 shows that Z₁Z₂ and X₁X₂ (2 collisions) have a common passer.

4.4用检查清单钉住一个状态Pinning a state with a checklist

检查还有第二种用法:不只体检,还能定义状态。问:哪些两比特状态能让 Z₁Z₂ 和 X₁X₂ 都必然给出 +1?一步步算。「Z₁Z₂ 必然 +1」意味着落选组不能有任何成分:a₀₁ = a₁₀ = 0,剩 (a₀₀, 0, 0, a₁₁)。「X₁X₂ 必然 +1」意味着状态被 X₁X₂(同时翻两个比特,即对调 a₀₀ ↔ a₁₁、a₀₁ ↔ a₁₀)作用后必须原样不变(4.2 的规则,补课 4.A 有逐项验证):剩下的两个数只能相等,a₀₀ = a₁₁。再让平方和等于 1:两数只能都是 1/√2。答案唯一——贝尔态。两条检查,像两根钉子,把 4 个自由数字钉得只剩一个状态。

Checks have a second use: not just examining states but defining them. Ask: which two-qubit states make both Z₁Z₂ and X₁X₂ answer +1 with certainty? Step by step. “Z₁Z₂ surely +1” forbids any amplitude in the losing group: a₀₁ = a₁₀ = 0, leaving (a₀₀, 0, 0, a₁₁). “X₁X₂ surely +1” demands that the state survive X₁X₂ (flip both qubits, i.e. swap a₀₀ ↔ a₁₁ and a₀₁ ↔ a₁₀) unchanged (§4.2's rule, checked term by term in Catch-up 4.A): the two remaining numbers must be equal, a₀₀ = a₁₁. Normalizing, both must be 1/√2. The answer is unique — the Bell state. Two checks, like two nails, pin 4 free numbers down to a single state.

一般的账目如下。n 个量子比特共有 2ⁿ 个基本成分(2ⁿ = n 个 2 连乘:1 个比特 2 种,2 个比特 4 种),也就是 2ⁿ 个可以自由选择的配比数字。每加一条检查并要求它「必然 +1」,能自由选择的配比数字就砍掉一半,前提有三条:这条检查与已有的检查都对易(补课 4.B);它独立,即不是已有检查的乘积,所以它的答案不能从已有的答案推出来;整份清单不自相矛盾,即没有哪几条检查乘起来等于 −I(「什么都不做,再乘一个 −1」)。第三条若不满足,通过全部检查的状态一个也没有。刚才的例子里,Z₁Z₂ 把 4 个数砍成 2 个(a₀₀、a₁₁),X₁X₂ 再砍成 1 个。「独立」的准确含义、「为什么恰好一半」和一份自相矛盾的清单,见下面的补课 4.C。这样的检查清单有个学名:稳定子一组彼此对易的泡利串检查,编码状态被要求让它们全部必然给出 +1。英文 stabilizer——「让状态稳定下来的东西」。。记 r = 独立检查的条数。r 条检查砍 r 次半,剩 2ⁿ⁻ʳ 个自由的配比数字;而 k 个量子比特的状态恰好需要 2ᵏ 个配比数字(3.1、4.1:1 个比特 2 个,2 个比特 4 个)。所以剩下的空间正好装得下 n − r 个逻辑量子比特被码保护、由许多物理比特共同保管的那个量子比特;它的 0 和 1 记作 0̄、1̄。:

The general ledger: n qubits have 2ⁿ basic components (2ⁿ = n twos multiplied together: 2 for one qubit, 4 for two), that is, 2ⁿ mixing numbers we may choose freely. Each check we add and demand to read “+1 surely” cuts the freely choosable numbers in half, under three conditions: it commutes with the checks already there (Catch-up 4.B); it is independent, meaning it is not a product of the existing checks, so its answer cannot be deduced from theirs; and the list does not contradict itself, meaning no selection of checks multiplies to −I (“do nothing, then multiply by −1”). If the third condition fails, no state at all passes every check. In the example above, Z₁Z₂ cut 4 numbers down to 2 (a₀₀, a₁₁) and X₁X₂ cut them to 1. Catch-up 4.C below gives the precise meaning of “independent”, the reason for “exactly half”, and a list that contradicts itself. Such a checklist has a formal name: the stabilizersA set of mutually commuting Pauli-string checks; encoded states must answer +1 to all of them. “That which holds the state steady.”. Write r = the number of independent checks. r checks halve r times, leaving 2ⁿ⁻ʳ free mixing numbers; and a state of k qubits needs exactly 2ᵏ mixing numbers (§3.1, §4.1: 2 for one qubit, 4 for two). So the remaining space holds exactly n − r logical qubitsThe qubit the code protects, held jointly by many physical qubits; its 0 and 1 are written 0̄ and 1̄.:

n 个比特qubits,r 条独立检查(两两对易,没有哪几条乘起来是 −I)independent checks (pairwise commuting, no product equal to −I) ⇒ 2n−r 个自由配比数字free mixing numbers ⇒ k = n − r 个逻辑量子比特logical qubits

记号说明:k 数的是逻辑量子比特,r 数的是独立检查。这与编码论的通用写法 [[n, k, d]] 一致(d 在 4.6 出场),本系列后面各篇也都这样用。

A note on notation: k counts logical qubits and r counts independent checks. This matches the standard coding-theory label [[n, k, d]] (d appears in §4.6), and every later tutorial in this series uses it the same way.

检验一下:刚才 n = 2、r = 2,剩 2⁰ = 1 个配比数字(它还被「平方和 = 1」定死),k = 0 个逻辑比特,全钉死。若只用 r = n − 1 条检查,就剩 2 个配比数字,k = 1,恰好是一个受保护的逻辑量子比特的容身之处。这就是纠错码的配方。

Check it: above, n = 2 and r = 2 leave 2⁰ = 1 mixing number (and “squares add up to 1” fixes it), so k = 0 logical qubits: fully pinned. With only r = n − 1 checks, 2 mixing numbers remain and k = 1, exactly room for one protected logical qubit. That is the recipe for a code.

补课 · 什么叫「独立」的检查,为什么每条检查恰好砍掉一半,什么叫清单「自相矛盾」Catch-up · What an “independent” check is, why each check cuts exactly half, and when a list contradicts itself
三个比特、三条 Z 检查,逐个列出来Three qubits, three Z checks, listed one by one

三个比特有 8 个基本成分 000 到 111。Z-型检查只看 0/1,所以每个基本成分对它都有确定的答案:Z₁Z₂ 在 b₁ = b₂ 时答 +1,否则答 −1,另两条同理。

Three qubits have 8 basic components, 000 to 111. A Z-type check looks only at 0/1, so each basic component gives it a definite answer: Z₁Z₂ answers +1 when b₁ = b₂ and −1 otherwise, and likewise for the other two.

b₁b₂b₃Z₁Z₂Z₂Z₃Z₁Z₃
000+1+1+1
001+1−1−1
010−1−1+1
011−1+1−1
100−1+1−1
101−1−1+1
110+1−1−1
111+1+1+1

数一数:通过 Z₁Z₂ 的有 4 个(000、001、110、111),8 砍成 4;再要求 Z₂Z₃ 也通过,剩 2 个(000、111,表中着色),又砍一半。再加 Z₁Z₃:000 和 111 本来就通过,一个也没砍掉。看表的最后一列:每一行里 Z₁Z₃ 的答案都等于前两列答案的乘积。原因是 Z₁Z₃ = (Z₁Z₂)(Z₂Z₃),中间的 Z₂Z₂ 是「做两次变号」,等于什么都不做。

Count: 4 components pass Z₁Z₂ (000, 001, 110, 111), so 8 is cut to 4; also requiring Z₂Z₃ leaves 2 (000 and 111, shaded in the table), another half. Now add Z₁Z₃: 000 and 111 already pass it, so nothing is cut. Look at the last column: in every row, Z₁Z₃'s answer is the product of the first two answers. The reason is Z₁Z₃ = (Z₁Z₂)(Z₂Z₃); the Z₂Z₂ in the middle means “flip the sign twice”, which does nothing.

定义:一条检查若等于清单里另外几条检查的乘积,它就不独立于它们:它的答案总能从它们的答案算出来,测它得不到新信息,也不砍任何东西。去掉所有这样的检查后剩下的条数,就是 r。上例 n = 3、r = 2(写三条也只算两条),k = 3 − 2 = 1;若按条数算 3 − 3 = 0 就错了。环面码在 5.3 会遇到同样的情形。

Definition: a check that equals the product of some other checks on the list is not independent of them: its answer can always be computed from theirs, measuring it brings no new information, and it cuts nothing. The number left after removing every such check is r. Above, n = 3 and r = 2 (three checks written, two counted), so k = 3 − 2 = 1; counting the checks as written would give the wrong 3 − 3 = 0. The toric code meets the same situation in §5.3.

为什么恰好一半Why exactly half

Z-型检查:挑一个它碰到的比特,把这一位翻过来。每个基本成分都这样配上一个伙伴(000 ↔ 100、001 ↔ 101……),而翻一位恰好改变这条检查的答案,所以 +1 组和 −1 组一一配对,一样多。X-型检查:它不删成分,而是把成分两两对调(X₁X₂ 对调 a₀₀ ↔ a₁₁、a₀₁ ↔ a₁₀),每个成分恰有一个伙伴、没有谁和自己配对。「对调后不变」要求每一对的两个数相等,于是自由的数字从 4 个变成 2 个,也是一半。

A Z-type check: pick one qubit it touches and flip that slot. This gives every basic component a partner (000 ↔ 100, 001 ↔ 101, …), and flipping that slot always changes the check's answer, so the +1 group and the −1 group pair off one to one and are equally large. An X-type check: it deletes no component but swaps components in pairs (X₁X₂ swaps a₀₀ ↔ a₁₁ and a₀₁ ↔ a₁₀); each component has exactly one partner, and none is paired with itself. “Unchanged by the swap” requires the two numbers in each pair to be equal, so the free numbers drop from 4 to 2, again one half.

第二条、第三条检查也各砍一半,需要的恰好是「独立」。先看新旧检查全是 Z-型的情形:新检查不是旧检查的乘积,就一定能找到一种翻法,只改变新检查的答案而不改变旧检查的答案(上例中翻第 3 位只改变 Z₂Z₃),于是通过旧检查的成分又被一一配对。

A second and third check halve again exactly when they are independent. Start with the case where the old and new checks are all Z-type: if the new check is not a product of the old ones, there is a set of slots to flip that changes the new check's answer and none of the old ones (above, flipping slot 3 changes only Z₂Z₃), so the components passing the old checks pair off one to one again.

新检查是 X-型时,翻位不管用。翻位就是施加 X,而 X 和 X 从不碰撞,所以任何翻法都不改变 X₁X₂ 的答案。这时换一种「拨动」:给某一位加负号,也就是施加 Z。例:清单上已有 Z₁Z₂,通过它的状态是 (a₀₀, 0, 0, a₁₁),新检查是 X₁X₂。拨动用 Z₁,它给第 1 位是 1 的成分乘 −1:(s, 0, 0, t) ↦ (s, 0, 0, −t)。Z₁ 与 Z₁Z₂ 不碰撞(对易),所以它把通过 Z₁Z₂ 的状态仍送到通过者里(两个 0 乘 −1 还是 0)。Z₁ 与 X₁X₂ 在第 1 格碰撞 1 次(反对易),所以它把 X₁X₂ 的答案翻面:X₁X₂ 必然答 +1 的状态是 (s, 0, 0, s),Z₁ 把它变成 (s, 0, 0, −s),再施加 X₁X₂(对调 a₀₀ ↔ a₁₁)得 (−s, 0, 0, s),恰好是它的 −1 倍,必然答 −1。于是在通过 Z₁Z₂ 的状态里,X₁X₂ 答 +1 的(a₀₀ = a₁₁)和答 −1 的(a₀₀ = −a₁₁)被 Z₁ 一一配对,各有 1 个自由数字,还是一半。

When the new check is X-type, flipping slots does not work. Flipping a slot means applying X, and X never collides with X, so no set of flips changes X₁X₂'s answer. Use a different toggle instead: put a minus sign on one slot, that is, apply Z. Example: the list already holds Z₁Z₂, whose passing states are (a₀₀, 0, 0, a₁₁), and the new check is X₁X₂. Toggle with Z₁, which multiplies the components with slot 1 equal to 1 by −1: (s, 0, 0, t) ↦ (s, 0, 0, −t). Z₁ does not collide with Z₁Z₂ (they commute), so it keeps the states passing Z₁Z₂ among the passers (the two 0s stay 0). Z₁ collides once with X₁X₂, in cell 1 (they anticommute), so it turns X₁X₂'s answer over: the state (s, 0, 0, s) answers X₁X₂ with +1 surely, Z₁ sends it to (s, 0, 0, −s), and applying X₁X₂ (swap a₀₀ ↔ a₁₁) to that gives (−s, 0, 0, s), exactly −1 times it, so it answers −1 surely. Among the states passing Z₁Z₂, then, those answering X₁X₂ with +1 (a₀₀ = a₁₁) and those answering −1 (a₀₀ = −a₁₁) are paired one to one by Z₁, with 1 free number each: half again.

两种情形合起来:拨动可以是任何一个泡利串,只要它与所有旧检查对易(留在通过者里)、与新检查反对易(翻新检查的答案)。新检查独立(它不是旧检查的乘积),并且加进来以后清单里没有哪几条的乘积等于 −I 时,这样的拨动总是存在。第二个条件不能省:XZZ、ZXZ、ZZX 三条再加上 XXX。前三条的乘积恰好是 −XXX,所以 XXX 不等于任何几条旧检查的乘积(差一个负号);可是凡是通过前三条的状态,XXX 都只能读出 −1,四条全通过的状态根本不存在,也就找不到拨动,因为与前三条都对易的串必然与它们的乘积 −XXX、也就是与 XXX 对易。这时四条检查的乘积正是 −I。对任意多条检查,证明这一点要用线性代数的高斯消元,本页不展开;《BB 码》的补课 0.D 用矩阵的秩把它完整做了一遍。

Both cases together: the toggle can be any Pauli string that commutes with every old check (so it stays among the passers) and anticommutes with the new one (so it turns the new check's answer over). When the new check is independent (it is not a product of old checks) and adding it leaves no product of checks equal to −I, such a toggle always exists. The second condition cannot be dropped: take XZZ, ZXZ, ZZX and add XXX. The first three multiply to exactly −XXX, so XXX is not a product of old checks (it differs by a sign); yet every state passing the first three reads −1 on XXX, so no state passes all four and no toggle exists, since a string commuting with the first three commutes with their product −XXX, that is, with XXX. Here the four checks multiply to −I. proving that for any number of checks takes Gaussian elimination from linear algebra, which this page does not cover; Catch-up 0.D of the BB-code tutorial does it completely with the rank of a matrix.

第三个条件:清单不能自相矛盾The third condition: the list must not contradict itself

对易、独立还不够。看三个比特上的四条检查 XZZ、ZXZ、ZZX、XXX(XZZ 是 X₁Z₂Z₃ 的简写:第几个字母就作用在第几个比特上)。按 4.3 的碰撞规则两两数:XZZ 与 ZXZ 在第 1、2 格碰撞,XZZ 与 XXX 在第 2、3 格碰撞,其余四对也都恰好碰撞 2 次。全部对易。现在按 XZZ、ZXZ、ZZX、XXX 的顺序把四条逐格乘起来:

Commuting and independent is not enough. Take four checks on three qubits: XZZ, ZXZ, ZZX, XXX (XZZ is short for X₁Z₂Z₃: the k-th letter acts on qubit k). Count collisions pair by pair with §4.3's rule: XZZ and ZXZ collide in cells 1 and 2, XZZ and XXX in cells 2 and 3, and each of the other four pairs also collides exactly twice. All commute. Now multiply the four cell by cell, in the order XZZ, ZXZ, ZZX, XXX:

第 1 格cell 1: X·Z·Z·X = X·X = I · 第 3 格cell 3: Z·Z·X·X = I · 第 2 格cell 2: Z·X·Z·X = Z·(−Z·X)·X = −Z·Z·X·X = −I

第 2 格里用了 3.5 的 XZ = −ZX 把中间两个换位。所以四条的乘积是 −I。假如某个状态 ψ 通过全部四条,依次施加四条检查时它每一步都原样不变,于是 ψ = (−I)ψ = −ψ,只能是全零,而全零不是状态(平方和不是 1)。这份清单一个通过者也没有,「每条砍一半」的账也就不能照算(照算会得出 k = 3 − 4 = −1,毫无意义)。换个角度看:前三条的乘积是 −XXX,所以前三条一旦都答 +1,XXX 就必然答 −1,再要求它答 +1 就是自相矛盾。

In cell 2, §3.5's XZ = −ZX swapped the middle pair. So the product of the four is −I. If some state ψ passed all four, it would stay unchanged at every step as we apply the four checks one after another, so ψ = (−I)ψ = −ψ, which forces all zeros, and all zeros is not a state (its squares do not add to 1). This list has no passing state at all, and the “each check halves” count cannot be applied (it would give k = 3 − 4 = −1, which means nothing). Seen another way: the first three multiply to −XXX, so once they all answer +1, XXX must answer −1, and demanding +1 from it contradicts them.

什么时候不必担心?每条检查若只含 X 或只含 Z,就不会出现这种矛盾,本页的所有检查(三比特码、环面码)都是这样。理由:检查两两对易,乘积里可以随意调换顺序,于是把只含 X 的检查排在前面、只含 Z 的排在后面。几条只含 X 的串相乘,每一格只是若干个 X 相乘,X·X = I,不会冒出负号;只含 Z 的同理。乘积要等于 ±I,这两半都只能是 I 本身,所以乘积是 +I,不会是 −I。

When is there nothing to worry about? If every check contains only X's or only Z's, this contradiction cannot happen, and every check on this page (the three-qubit code, the toric code) is of that kind. The reason: the checks commute pairwise, so the factors of a product may be reordered freely; put the X-only checks first and the Z-only checks after them. Multiplying X-only strings just multiplies X's within each cell, and X·X = I produces no minus sign; likewise for Z-only strings. For the product to be ±I, each half must be I itself, so the product is +I, never −I.

4.5第一个量子纠错码Our first quantum code

配方开动:取 n = 3 个量子比特,清单上放 r = 2 条独立检查——正是 2.4 节两盏灯的量子化身:

Run the recipe: take n = 3 qubits and a checklist of r = 2 independent checks — the quantum incarnation of §2.4's two lamps:

检查 ①check ①: Z₁Z₂ · 检查 ②check ②: Z₂Z₃ ⇒ 通过者passing states: α|000⟩ + β|111⟩
(k = 3 − 2 = 1 个逻辑比特logical qubit)

通过两条检查的状态,只能在 |000⟩ 和 |111⟩ 上有成分(其余六个成分都会让某条检查有概率报 −1)。所以逻辑比特这样存放:逻辑 0̄ = |000⟩,逻辑 1̄ = |111⟩(头上的一横读「bar」:标记「逻辑版」——0̄、1̄ 是被保护的逻辑比特的 0 和 1,不是任何单个物理比特的。),一般状态 α|000⟩+β|111⟩(α、β 读「阿尔法」「贝塔」,是两个待定的配比数字)把这两个宝贝数字存进三个比特的共同点里。两条检查只问「相邻两位一样吗」,|000⟩ 和 |111⟩ 都答 +1,所以反复测检查既读不到 α、β,也不会搅乱它们。这份保护有它的限度:单独去读 1 号比特,仍会以 α² 的概率读到 0,并让整个状态坍缩成 |000⟩。原因是 Z₁ 作用在 |000⟩ 上得 +|000⟩、作用在 |111⟩ 上得 −|111⟩,对编码状态来说它就是「逻辑版的 Z」;拿它当测量,读出的是逻辑比特;它作为错误出现,就是 4.6 的致命弱点。至于这样存放为什么不算 3.6 禁止的「复印」,见下面的补课 4.D。

A state passing both checks may only have components on |000⟩ and |111⟩ (any of the other six makes some check answer −1 with nonzero probability). So the logical qubit lives as: logical 0̄ = |000⟩, logical 1̄ = |111⟩ (the overbarRead “bar”: it marks the “logical edition” — 0̄ and 1̄ are the protected logical qubit's 0 and 1, not any single physical qubit's.), with a general α|000⟩+β|111⟩ (α, β — “AL-fa”, “BAY-ta” — two blend-numbers to be chosen) storing those precious numbers in what the three qubits share. The two checks only ask “are neighbouring slots equal?”, and |000⟩ and |111⟩ both answer +1, so measuring the checks again and again neither reads α, β nor disturbs them. The protection has a limit: reading qubit 1 on its own still gives 0 with probability α² and collapses the whole state to |000⟩. The reason is that Z₁ turns |000⟩ into +|000⟩ and |111⟩ into −|111⟩, so on encoded states it is the “logical Z”: used as a measurement it reads the logical bit, and when it occurs as an error it is the fatal flaw of §4.6. Why storing the numbers this way is not the “copying” that §3.6 forbids is the subject of Catch-up 4.D below.

补课 · 编码不是复印:α|0⟩ + β|1⟩ 怎样变成 α|000⟩ + β|111⟩Catch-up · Encoding is not copying: how α|0⟩ + β|1⟩ becomes α|000⟩ + β|111⟩

量子力学的线性规则。X、Z 和下面要用的 CNOT 这类操作(只改变状态、不读取结果,文献里叫门对量子比特施加的、不读取结果的操作,如 X、Z、CNOT。英文 gate。门都遵守线性规则;测量不是门。)分别作用在每个基本成分上,再按原来的配比数字加起来。3.3 的 X 就是这样:X(a|0⟩ + b|1⟩) = a·X|0⟩ + b·X|1⟩ = a|1⟩ + b|0⟩,正是 (b, a)。这条规则是量子力学的基本假设之一,本页的所有门都遵守它。测量不遵守它。4.2 的测量规则要按概率挑出一个答案、删掉落选组的成分、再把剩下的整体放大(「整体归一」),这不是「逐项作用再加回去」。例:测 Z₁Z₂ 时,|00⟩ 原样留下,|01⟩ 也原样留下;若测量是线性的,(|00⟩ + |01⟩)/√2 也该原样留下,实际上它会随机变成 |00⟩ 或 |01⟩ 之一。下面的编码只用门、不做测量;不可克隆的证明讨论的也是一个「复印门」,所以线性规则都适用。(把测量也算进复印机里,结论仍然成立,但那个证明超出本页。)

The linearity rule of quantum mechanics. Operations such as X, Z and the CNOT used below (they change the state without reading any result; the literature calls them gatesOperations applied to qubits without reading a result, such as X, Z, CNOT. Gates obey the linearity rule; a measurement is not a gate.) act on each basic component separately, and the results are added back with the original mixing numbers. §3.3's X works this way: X(a|0⟩ + b|1⟩) = a·X|0⟩ + b·X|1⟩ = a|1⟩ + b|0⟩, which is exactly (b, a). This rule is one of the basic postulates of quantum mechanics, and every gate on this page obeys it. Measurement does not. §4.2's measurement rule picks one answer at random, deletes the components of the losing group, and scales the rest back up (“renormalizing”), which is not “act on each term and add back”. Example: measuring Z₁Z₂ leaves |00⟩ as it is and leaves |01⟩ as it is; if measurement were linear, (|00⟩ + |01⟩)/√2 would also be left as it is, but in fact it turns at random into |00⟩ or into |01⟩. The encoding below uses gates only, no measurement, and the no-cloning proof is about a “copying gate”, so the linearity rule applies to both. (The conclusion still holds if the copier may also measure, but that proof is beyond this page.)

编码只抄标签。先把两个新比特准备成 0,状态是 (α|0⟩ + β|1⟩)|00⟩ = α|000⟩ + β|100⟩。再用一种两比特操作「受控翻转」(英文 CNOT:第 1 位是 1 时翻第 2 位,是 0 时不动),分别对第 2、3 位各做一次。按线性规则逐项作用:

Encoding copies the label only. Prepare two fresh qubits in 0; the state is (α|0⟩ + β|1⟩)|00⟩ = α|000⟩ + β|100⟩. Then apply a two-qubit operation, the “controlled flip” (CNOT: flip slot 2 if slot 1 is 1, do nothing if it is 0), once onto slot 2 and once onto slot 3. By the linearity rule, term by term:

α|000⟩ + β|100⟩ → α|000⟩ + β|110⟩ → α|000⟩ + β|111⟩

第 1 位上的标签 0 或 1 被抄到了后两位,配比数字 α、β 却只出现一次,没有被复制。

The label 0 or 1 of slot 1 has been copied onto the other two slots, but the mixing numbers α, β still appear only once; they were not duplicated.

真复印会是什么样。三份独立的副本是 (α|0⟩ + β|1⟩)(α|0⟩ + β|1⟩)(α|0⟩ + β|1⟩),逐项展开 8 项都在:

What a true copy would look like. Three independent copies are (α|0⟩ + β|1⟩)(α|0⟩ + β|1⟩)(α|0⟩ + β|1⟩); multiplied out, all 8 terms are present:

α³|000⟩ + α²β|001⟩ + α²β|010⟩ + αβ²|011⟩ + α²β|100⟩ + αβ²|101⟩ + αβ²|110⟩ + β³|111⟩

取 α = 0.8、β = 0.6:副本里 |000⟩ 的振幅是 0.8³ = 0.512,|001⟩ 的是 0.8² × 0.6 = 0.384;编码态里 |000⟩ 的振幅是 0.8,|001⟩ 的是 0。两个状态完全不同。

Take α = 0.8, β = 0.6: in the copies the amplitude of |000⟩ is 0.8³ = 0.512 and that of |001⟩ is 0.8² × 0.6 = 0.384; in the encoded state they are 0.8 and 0. The two states are entirely different.

这也就是不可克隆定理的证明。假设某个门能复印任意状态。它必须把 |0⟩ 复成 |00⟩、把 |1⟩ 复成 |11⟩,按线性规则它就把 α|0⟩ + β|1⟩ 送到 α|00⟩ + β|11⟩;而真正的两份副本是 α²|00⟩ + αβ|01⟩ + αβ|10⟩ + β²|11⟩。两者只在 αβ = 0,也就是状态本来就是 |0⟩ 或 |1⟩ 时才相等。所以不存在能复印未知状态的门,能做的只有上面这种抄标签的编码。

This is also the proof of the no-cloning theorem. Suppose some gate could copy any state. It must copy |0⟩ to |00⟩ and |1⟩ to |11⟩, so by linearity it sends α|0⟩ + β|1⟩ to α|00⟩ + β|11⟩; but two genuine copies are α²|00⟩ + αβ|01⟩ + αβ|10⟩ + β²|11⟩. The two agree only when αβ = 0, that is, when the state was |0⟩ or |1⟩ to begin with. So no gate copies an unknown state; all one can do is label-copying encoding like the one above.

出错了怎么办?假设噪声施加 X₂(翻转 2 号比特)。用 4.3 的碰撞规则算它和两条检查的关系:X₂ 与 Z₁Z₂ 在第 2 格碰撞 1 次——奇数,反对易;与 Z₂Z₃ 同样碰撞 1 次。反对易的后果(值得慢读一遍):原本必然 +1 的检查,在出错后的状态上会必然给出 −1。检查读数直接翻面,警报拉响,而且两条检查的 (−1, −1) 组合唯一指认了 2 号比特。修复:再施加一次 X₂,负负得正,一切如初。

What if noise applies X₂ (flip qubit 2)? By §4.3, X₂ collides once with Z₁Z₂ (cell 2) — odd, anticommute — and once with Z₂Z₃. The consequence of anticommuting (worth a slow read): a check that used to answer +1 surely now answers −1 surely on the corrupted state. The reading flips outright, the alarm sounds, and the pair (−1, −1) uniquely names qubit 2. Repair: apply X₂ once more; minus times minus, all restored.

为什么反对易会让读数从 +1 变成 −1?Why does anticommuting flip the reading from +1 to −1?

先备好记号:给我们的状态起个名字叫 ψ(希腊字母,读「普西」——就是个名字,像「小明」)。设检查 S 在状态 ψ 上必然 +1,即 Sψ = ψ(4.2 节的规则:「必然 +1」就是 S 作用后状态原样,补课 4.A)。出错后状态是 Eψ。计算 S(Eψ):因为 SE = −ES(反对易),所以 S(Eψ) = −E(Sψ) = −Eψ。即出错后的状态被 S 作用会得到自身的 −1 倍——按测量规则这正是「必然给出 −1」。若 E 与 S 对易,同样的推演给 +1:错误隐身。一句话:警报 = 反对易,隐身 = 对易。

First, notation: name our state ψ (a Greek letter, read “psy” — just a name, like “Alice”). Let check S answer +1 surely on ψ, i.e. Sψ = ψ (§4.2's rule: “surely +1” means S leaves the state as it is; Catch-up 4.A). After the error the state is Eψ. Compute S(Eψ): since SE = −ES (anticommute), S(Eψ) = −E(Sψ) = −Eψ. The corrupted state is an exact “−1 answerer”. If E commutes with S the same steps give +1: the error is invisible. In one line: alarm = anticommute; invisibility = commute.

在实验台上把整套流程走一遍。柱状图画的是八个成分的振幅,那是只有我们这些旁观者才看得到的完整状态;芯片上的检查读数只有 ±1 两种,从头到尾不会透露 α=0.8、β=0.6:

Run the whole routine on the bench. The bars show the amplitudes of the eight components, the full state that only we as onlookers can see; the checks on a chip read out only ±1 and never reveal α=0.8, β=0.6:

4.6它的致命弱点Its fatal flaw

现在按下实验台里的 Z₂。碰撞清单:Z₂ 对 Z₁Z₂ 碰撞 0 次(Z 遇 Z 不算碰撞——3.5 节里只有 X 遇 Z 才付负号),对 Z₂Z₃ 也是 0 次。全对易,两盏灯毫无反应。可状态已经变了:α|000⟩+β|111⟩ 变成 α|000⟩−β|111⟩——被藏起来的宝贝符号被悄悄拧了。这比「没查出来」更糟。先给两个名字:逻辑 Z̄ 是把 α0̄ + β1̄ 变成 α0̄ − β1̄ 的操作,逻辑 X̄ 是把它变成 β0̄ + α1̄ 的操作,也就是作用在被保护的那个逻辑比特上的 Z 和 X。对编码状态,Z₂ 的效果与 Z̄ 完全相同(Z₁、Z₃ 也一样),X₁X₂X₃ 的效果与 X̄ 完全相同。所以一个 Z₂ 就是一次无声的逻辑错误:信息被改写,而且没有任何警报。

Now press Z₂ on the bench. Collision audit: Z₂ vs Z₁Z₂ — 0 collisions (Z meeting Z is no collision; only X-meets-Z costs a sign, §3.5); vs Z₂Z₃ — 0 again. All commuting, both lamps stay dark. Yet the state changed: α|000⟩+β|111⟩ became α|000⟩−β|111⟩ — the hidden sign was twisted in silence. This is worse than a missed detection. Two names first: logical Z̄ is the operation taking α0̄ + β1̄ to α0̄ − β1̄, and logical X̄ takes it to β0̄ + α1̄; they are the Z and X of the protected logical qubit. On encoded states Z₂ acts exactly like Z̄ (so do Z₁ and Z₃), and X₁X₂X₃ acts exactly like X̄. So a single Z₂ is a silent logical error: the information is rewritten and no alarm sounds.

诊断很清楚:清单上全是 Z-型检查,按碰撞规则它们天生看不见 Z-型错误。反过来组一套 X-型清单(X₁X₂ 与 X₂X₃)?那就轮到 X 错误隐身。用「距离」的语言总结(码距能悄悄改写逻辑信息的最短错误串的长度,记作 d。d 越大,需要越多错误合谋才能骗过所有检查。 d = 既骗过全部检查、又真的改写了逻辑信息所需的最少单比特错误数):

The diagnosis is clean: an all-Z checklist is constitutionally blind to Z-type errors, by the collision rule. Flip to an all-X checklist (X₁X₂, X₂X₃)? Then X errors go invisible instead. In the language of code distanceThe length of the shortest error string that rewrites logical information while evading every check; written d. Larger d forces more errors to conspire. (d = the fewest single-qubit errors that fool every check and really rewrite the logical information):

三比特码:对 X 错误 d = 3 · 对 Z 错误 d = 1(一个就沦陷)3-qubit code: against X errors d = 3 · against Z errors d = 1 (one is enough to fall)

对 X 错误 d = 3:X₁X₂X₃ 正是逻辑 X̄,要把 |000⟩ 变成 |111⟩ 必须三位全翻;一个或两个 X 错误都会让某条检查报警。d = 3 为什么只保证纠正 1 个错误?修复程序看到警报后,按「离哪个码字更近」来修:一个错误后,状态离原码字 1 步、离另一个码字 2 步,修对了;两个错误后,离原码字 2 步、离另一个码字只剩 1 步,修复反而补完了第三步(本章检查站里的 X₁X₃ 就是这样)。一般地,码距 d 的码能保证纠正 (d − 1)/2 个错误(d 为偶数时取整数部分)。

Against X errors d = 3: X₁X₂X₃ is exactly the logical X̄, and turning |000⟩ into |111⟩ takes flipping all three slots; one or two X errors always set off some check. Why does d = 3 guarantee correcting only 1 error? After an alarm the repair routine fixes towards the nearer code word: after one error the state is 1 step from the original code word and 2 steps from the other, so the repair is right; after two errors it is 2 steps from the original and only 1 step from the other, so the “repair” completes the third step (the X₁X₃ in this chapter's checkpoint does exactly this). In general a code of distance d is guaranteed to correct (d − 1)/2 errors (the whole-number part when d is even).

编码论把一个量子码的三项指标并排写成 [[n, k, d]]:n 个物理比特、k 个逻辑比特、码距 d(取各种错误里最小的那个)。三比特码是 [[3, 1, 1]]:对 X 再结实,一个 Z 就能击穿它。

Coding theory writes a quantum code's three key numbers side by side as [[n, k, d]]: n physical qubits, k logical qubits, distance d (the smallest over all kinds of error). The 3-qubit code is [[3, 1, 1]]: however sturdy against X, a single Z breaks it.

4.7设计任务书The design brief

于是任务明确了。我们要的码必须同时携带两族检查,并满足四条硬指标:

The brief writes itself. The code we want carries both families of checks and meets four hard requirements:

① 有一批 Z-型检查捉 X 错误,也有一批 X-型检查捉 Z 错误;② 所有检查两两对易——即任何一条 X-串与任何一条 Z-串的碰撞格数都是偶数(4.3 节);③ 两族天平对称,两种错误的码距一样大,而且想要多大就能造多大;④ 每条检查只牵涉相邻的少数几个比特(真实硬件够得着)。

① Some Z-type checks to catch X errors and some X-type checks to catch Z errors; ② every pair of checks commutes — i.e. every X-string meets every Z-string in an even number of cells (§4.3); ③ the two families are symmetric, with equal — and freely growable — distance for both error types; ④ each check touches only a few neighbouring qubits (real hardware has short arms).

要求②看起来是苛刻的簿记难题:成百上千条检查,两两验证偶数碰撞?1997 年,Alexei Kitaev 给出了一个让所有人拍案的回答:别记账,画图。把比特放上网格,让「偶数」由几何自动保证。

Requirement ② looks like a bookkeeping nightmare — hundreds of checks, every pair needing an even overlap? In 1997 Alexei Kitaev gave the answer that made everyone slap the table: don't bookkeep — draw. Put the qubits on a grid and let geometry guarantee “even” automatically.

检查站Checkpoint第 4 章Chapter 4
对三比特码(检查 Z₁Z₂ 与 Z₂Z₃)施加错误 X₁X₃(同时翻 1、3 号)。两条检查各读出什么?Hit the 3-qubit code (checks Z₁Z₂, Z₂Z₃) with the error X₁X₃ (flip qubits 1 and 3). What do the checks read?

碰撞账算对了!X₁ 撞 Z₁Z₂ 一次,X₃ 撞 Z₂Z₃ 一次 → (−1, −1)。修复程序会误以为是 X₂ 并「修复」它——结果三个比特全翻,恰好等于一次逻辑翻转 X̄。两个物理错误就能压垮它:这与「对 X 的 d = 3」一致(d=3 只保证纠正 1 个)。

Collision audit correct! X₁ hits Z₁Z₂ once, X₃ hits Z₂Z₃ once → (−1, −1). The repair routine will guess X₂ and “fix” it — flipping all three qubits, which is exactly a logical flip X̄. Two physical errors overwhelm it, consistent with d = 3 (which only guarantees correcting 1).

用 4.3 的规则逐条数:X₁X₃ 写成串是 X·I·X。它与 Z·Z·I 在第 1 格碰撞,与 I·Z·Z 在第 3 格碰撞——每条各奇数次。

Count with §4.3: X₁X₃ is the string X·I·X. It collides with Z·Z·I in cell 1 and with I·Z·Z in cell 3 — once (odd) each.

第 5 章Chapter 5

Toric Code:把检查画在网格上The toric code: checks drawn on a grid

第 4 章的任务书有四条硬指标。这一章用一张方格网、一次「吃豆人式」的绕接,把四条全部兑现——顺便收获一件谁也没预订的礼物:错误会变成看得见的「链」,警报会亮在链的端点。 Chapter 4's brief had four hard requirements. This chapter meets all four with one square grid and a pac-man wrap-around — and collects an unordered bonus: errors become visible “chains”, with alarms lighting at their endpoints.

5.1蓝图:比特住在边上The blueprint: qubits live on edges

画一张方格网。它有三种部件:顶点(线的交叉点)、边(连接相邻顶点的线段)、面(被围出来的小方块)。Kitaev 的分配方案是:

Draw a square grid. It has three kinds of parts: vertices (crossings), edges (segments joining neighbouring vertices), and faces (the little enclosed squares). Kitaev's assignment:

每条边上住一个量子比特。每个顶点 v 配一条 X-型检查:对碰到 v 的 4 条边同时问「在 +/− 眼镜下的联合奇偶」,也就是「这 4 个比特里读成 − 的个数是不是偶数」(和 4.2 的 X₁X₂ 同一个道理,只是换成 4 个比特)。它记作 Av,因为四条边像星芒,也叫星形检查。每个面 p 配一条 Z-型检查:对围住 p 的 4 条边问「在 0/1 眼镜下的联合奇偶」,即「读成 1 的个数是不是偶数」,记作 Bp,叫面检查。按 4.5 的「警报 = 反对易」,X-型的星形检查抓 Z 错误,Z-型的面检查抓 X 错误:4.6 要求的两族检查都有了。

One qubit on every edge. At every vertex v, an X-type check asking the 4 edges touching v for their joint parity in the +/− lens , that is, “is the number of these 4 qubits reading − even?” (the same idea as §4.2's X₁X₂, now on 4 qubits). It is written Av and called the star check (the four edges splay like a star). On every face p, a Z-type check asking the 4 edges around p for their joint parity in the 0/1 lens, “is the number reading 1 even?”, written Bp, the face check. By §4.5's “alarm = anticommute”, the X-type star checks catch Z errors and the Z-type face checks catch X errors: both families that §4.6 asked for are present.

Av = X·X·X·X(碰到顶点 v 的 4 条边the 4 edges touching vertex v) · Bp = Z·Z·Z·Z(围住面 p 的 4 条边the 4 edges around face p)

现在验收任务书第②条:任何一条星形检查(X-串)与任何一条面检查(Z-串),碰撞格数是偶数吗?碰撞只可能发生在两者共享的边上。盯着图想一想:一个顶点和一个方块,要么互不相干(共享 0 条边),要么顶点恰好是方块的一个角——而一个角总是连着方块的两条边:一条横的、一条竖的。永远 0 或 2,不多不少。别信文字,自己去数:

Now audit requirement ②: does every star (an X-string) meet every face check (a Z-string) in an even number of cells? Collisions can only happen on shared edges. Stare at the grid: a vertex and a square either ignore each other (0 shared edges), or the vertex is a corner of the square — and a corner always touches exactly two of its sides: one horizontal, one vertical. Always 0 or 2, never anything else. Don't trust prose — count:

边中点的小灰点 = 住在这条边上的量子比特small grey dot at an edge's midpoint = the qubit living on that edge 橙 = 所选星形检查的 4 条边orange = the 4 edges of the chosen star 蓝 = 所选面检查的 4 条边blue = the 4 edges of the chosen face 品红 = 两者共享的边magenta = edges shared by both 右侧和下方伸出的短线 = 绕回另一侧的边(5.2)stubs sticking out right and below = edges that wrap to the other side (§5.2)
关键想法Key idea

「所有检查两两对易」不再需要逐对记账——它变成了一条几何定理:角连两边。把代数难题外包给图形,这就是 toric code 的第一重优雅。

“All checks pairwise commute” no longer needs bookkeeping — it became a theorem of geometry: a corner touches two sides. Outsourcing algebra to shape is the toric code's first elegance.

5.2让世界绕回来Let the world wrap around

还剩一个瑕疵:普通网格有「边缘」。边缘上的顶点凑不齐 4 条边,规则会变得七零八落。最干净的补救是干脆取消边缘:规定从右边出去就从左边回来、从上边出去就从下边回来——老式街机游戏的世界观。走两步感受一下:

One blemish remains: an ordinary grid has edges of the map. Vertices there can't gather 4 edges and the rules fray. The cleanest cure: abolish the boundary — leaving on the right re-enters on the left, leaving the top re-enters at the bottom, arcade-game style. Take a walk:

这样的「绕回」世界在几何上就是环面左右边缘粘合、上下边缘粘合后得到的曲面,即甜甜圈的表面。英文 torus,形容词 toric。——把纸的左右边粘起来成纸筒,再把纸筒两端粘起来,就是一个甜甜圈的表面。「toric code」的名字来源于此:环面上的码。在环面网格上,每个顶点都规规矩矩连 4 条边,每个面都被 4 条边围住,没有例外,没有特殊情况。

甜甜圈画在纸上不方便,所以通常把它摊平成一张 L × L 的方格图来画,再约定右边缘和左边缘是同一条线、下边缘和上边缘是同一条线。下面是 L = 3 的完整蓝图,18 个比特全部编了号;为了让绕回看得见,最右一列和最下一行的边用虚线再画一遍,编号和它们真正所在的左列、上行相同。点一个顶点,看它的星形检查碰哪 4 个比特;点角上的顶点,会看到它的腿伸到图的对侧。

Such a wrap-around world is geometrically a torusThe surface obtained by gluing the left/right edges and then the top/bottom edges — a donut's surface. Adjective: toric. — glue the paper's left and right edges into a tube, then the tube's two ends together: a donut's surface. Hence the name: the code on the torus. On the torus grid every vertex owns exactly 4 edges and every face is rimmed by exactly 4, no exceptions anywhere.

A donut is awkward to draw on paper, so one usually draws it flattened into an L × L grid, with the agreement that the right rim and the left rim are the same line, and the bottom rim and the top rim are the same line. Below is the complete blueprint for L = 3, with all 18 qubits numbered; to make the wrap-around visible, the edges of the rightmost column and bottom row are drawn a second time, dashed, carrying the numbers of the left column and top row where they really live. Click a vertex to see which 4 qubits its star check touches; click a corner vertex and its legs reach to the opposite side of the picture.

5.3记账:它存了几个量子比特?The ledger: how many qubits does it store?

取 L×L 的环面网格(下面可切换 L)。数数:横边 L² 条、竖边 L² 条,共 2L² 个量子比特;星形检查 L² 条、面检查 L² 条。套 4.4 节的公式 k = n − r:若 2L² 条检查全都独立,k = 2L² − 2L² = 0,一个逻辑比特也不剩?

Take an L×L torus grid (switch L below). Count: L² horizontal edges plus L² vertical, so 2L² qubits; L² star checks and L² face checks. Apply §4.4's k = n − r: if all 2L² checks were independent, k = 2L² − 2L² = 0. No logical qubit left at all?

公式没错,但它要求检查独立——而这里藏着两条「白送的」恒等式。把全部星形检查乘起来看看:每条边恰好连着两个顶点,于是每个比特恰好被两个 X 光顾,X·X = 什么都不做。乘积竟然是「全体安静」。看动画:

The formula is fine, but it demands independent checks — and two identities come free here. Multiply all star checks together: every edge touches exactly two vertices, so every qubit receives exactly two X's, and X·X = do nothing. The grand product is silence. Watch:

∏v Av = I · ∏p Bp = I (∏ 读「派」,意为「把后面的东西全部乘起来」;— read “pie” — means “multiply them all”; I = 「什么都不做」“do nothing”) ⇒ r = 2L² − 2

「最后一条星形检查」的读数总能由其余 L²−1 条推出(它们的乘积必须是 I),所以它不提供新信息,是 4.4 补课里说的「不独立」的检查;面检查同理。除了这两条,还有没有别的依赖关系?没有,理由在下面的补课 5.A。所以独立检查恰好 r = 2L² − 2 条,于是:

The “last” star check's reading is always determined by the other L²−1 (their product must be I), so it adds no information: it is a “dependent” check in the sense of Catch-up 4.C. Faces likewise. Are there any other dependencies besides these two? No; the reason is in Catch-up 5.A below. So exactly r = 2L² − 2 checks are independent, and:

k = n − r = 2L² − (2L² − 2) = 2 (例:L = 3 时 n = 18、r = 16、k = 2e.g. L = 3: n = 18, r = 16, k = 2)

不管 L 是 3 还是 1000,环面永远恰好存 2 个逻辑量子比特。上面的计数只用到「每条边连两个顶点、挨两个面」和网格连成一片,所以对每个 L 都一样。这个「2」和环面的形状有关:5.6 节会亲手验证,两个逻辑比特正好对应环面上两个本质不同的绕圈方向(水平绕、竖直绕)。「逻辑比特数 = 独立的绕圈方向数」在拓扑学里叫同调,本页不展开;高中数学版 5.6 节的折叠盒给出了它的正式名字。

Whether L is 3 or 1000, the torus stores exactly 2 logical qubits. The count above used only “every edge joins two vertices and borders two faces” and the fact that the grid is all in one piece, so it is the same for every L. That “2” reflects the shape of the torus: in §5.6 we verify by hand that the two logical qubits match the two essentially different directions of looping around the torus (horizontally and vertically). “Number of logical qubits = number of independent winding directions” is what topologists call homology; this page does not develop it, and the fold-out in §5.6 of the high-school edition gives its formal name.

补课 · 为什么只有两条依赖关系,r 恰好是 2L² − 2Catch-up · Why there are only two dependencies, so r is exactly 2L² − 2

要问的是:挑出哪些检查乘起来会等于 I(什么都不做)?每找到一种挑法,就有一条检查可以用其余的推出来。

The question is: which selections of checks multiply to I (do nothing)? Each such selection lets one check be deduced from the rest.

只挑星形检查Stars only

设挑出了一批顶点,把它们的星形检查乘起来。一条边上的 X 出现几次,取决于它的两个端点里有几个被挑中:0 个或 2 个时 X 成对抵消,1 个时留下一个 X。乘积要是 I,就得每条边的两个端点要么都被挑中、要么都没被挑中。于是只要挑中了一个顶点,它的 4 个邻居也必须挑中,邻居的邻居也必须挑中……网格连成一片,这样一路扩散到所有顶点。结论:乘积为 I 的挑法只有两种,一个都不挑(平凡)和全部挑(就是 ∏Av = I)。面检查同理:两个相邻的面共享一条边,所以挑中一个面就得挑中它的四个邻居,最后是全部或全不。

Suppose we pick some vertices and multiply their star checks. How many X's land on an edge depends on how many of its two endpoints were picked: with 0 or 2 the X's cancel in pairs, with 1 an X is left over. For the product to be I, every edge must have both endpoints picked or neither. So once one vertex is picked, its 4 neighbours must be picked, then their neighbours, and so on; the grid is all in one piece, so this spreads to every vertex. Conclusion: only two selections give I, none at all (trivial) and all of them (that is ∏Av = I). Faces work the same way: two neighbouring faces share an edge, so picking one face forces its four neighbours, and in the end it is all or none.

星和面混着挑Stars and faces mixed

星形检查的乘积只含 X,面检查的乘积只含 Z。一条边上若同时剩下一个 X 和一个 Z,它们不会抵消(X·Z 既不是 I,也不是单纯的负号)。所以混合乘积要等于 I,X 那一半和 Z 那一半必须各自等于 I,又回到上面两种情形。星和面之间不会产生新的依赖。

A product of stars contains only X's, and a product of faces only Z's. If an edge is left with one X and one Z, they do not cancel (X·Z is neither I nor a mere minus sign). So for a mixed product to be I, its X half and its Z half must each be I, which brings us back to the two cases above. Stars and faces create no new dependency.

记账The tally

L² 条星形检查里恰好一条多余,L² 条面检查里也恰好一条多余,r = (L² − 1) + (L² − 1) = 2L² − 2,k = 2L² − r = 2。L = 3 时:n = 18,r = 8 + 8 = 16,k = 2。

Exactly one of the L² star checks is redundant and exactly one of the L² face checks, so r = (L² − 1) + (L² − 1) = 2L² − 2 and k = 2L² − r = 2. For L = 3: n = 18, r = 8 + 8 = 16, k = 2.

5.4错误是链,警报在端点Errors are chains; alarms sit at endpoints

设噪声对某条边 e 的比特施加了 Z。哪些检查会报警?按 4.5 节的定律「警报 = 反对易」,数碰撞就行。Ze 与面检查全是 Z 遇 Z,永不碰撞。与星形检查 Av 呢:当且仅当 e 是 v 的星芒之一时,X 与 Z 恰好撞在这一格——奇数,报警!每条边连着两个顶点,所以:

Say noise applies Z to the qubit on edge e. Which checks alarm? By §4.5's law “alarm = anticommute”, count collisions. Ze against face checks: Z meets Z, never a collision. Against a star Av: exactly when e is one of v's four rays, X hits Z in that one cell — odd, alarm! Every edge touches two vertices, so:

一个one Ze ⇒ 恰好 2 个警报:e 的两个端点exactly 2 alarms: the two endpoints of e

连续几条边都出 Z 错呢?把出错的边涂成蓝色,它们连成一条链。链中间的顶点被链上的两条边各撞一次——合计偶数,安静;只有链的两个端头是奇数次——报警。于是一整条错误链,无论多长多曲折,都只点亮两盏灯。X 错误的故事在「另一副眼镜」里镜像上演,只是警报换成了面:边 e 上的一个 X 与挨着 e 的两个面检查各碰撞一次,所以亮起的是 e 两侧的两个面。于是 X 链最好画成横跨边的路径:从一个面的中心出发,每跨过一条出错的边就走进隔壁的面,报警的是链两端的面。去沙盘上画:

And several Z-errors on consecutive edges? Paint the erring edges blue: they form a chain. A vertex inside the chain is struck by two chain-edges — even total, silent; only the chain's two endpoints are odd — alarmed. A whole chain, however long and winding, lights exactly two lamps. The X-error story mirrors in the other lens, with faces as the alarms: an X on edge e collides once with each of the two face checks beside e, so the two faces on either side of e light up. So an X chain is best drawn as a path across edges: start at a face centre, and each erring edge you cross takes you into the neighbouring face; the alarms are the faces at the chain's two ends. Go paint:

关键想法Key idea

警报不告诉你「哪些边错了」,只告诉你「错误链的端点在哪」。同一对端点可以由许多条不同的链造成——这份「模糊」不是缺陷,下一节它将变成整个方案的灵魂。

Alarms never say “which edges erred”, only “where the chain's endpoints are”. Many different chains share the same endpoints — and this ambiguity is not a bug; next section it becomes the soul of the scheme.

5.5闭合的圈 = 什么都没发生A closed loop = nothing happened

沙盘里你也许已经撞见一个怪现象:把 Z 链画成一个闭合的圈(例如绕一个方块一周),警报会全部熄灭——链没有端点了。可比特明明被动过手脚,却没有任何检查察觉。这是漏网之鱼吗?

In the sandbox you may have met something odd: draw the Z-chain as a closed loop (say, around one square) and every alarm dies — the chain has no endpoints. The qubits were tampered with, yet no check noticed. Did something slip the net?

不是:这条「鱼」对编码状态什么都没做。绕单个方块 p 一周的 Z 圈,恰好就是检查 Bp 自己。而编码状态对每条检查都「必然 +1」,即 Bpψ = ψ(4.2 节的规则,补课 4.A;也见 4.5 节的折叠盒):对编码状态施加一条检查,等于什么都不做。更大的圈也一样:把相邻几个面的检查相乘,共享的内边被 Z·Z 抵消,只剩外圈——所以任何「可以收缩成一点的圈」都等于圈内所有面检查的乘积,对编码状态什么都不做。用示范按钮验证:

No: this “fish” did nothing to the encoded state. The Z-loop around a single square p is precisely the check Bp itself. And encoded states answer +1 surely to every check, i.e. Bpψ = ψ (§4.2's rule, Catch-up 4.A; see also §4.5's fold-out): applying a check to an encoded state does nothing at all. Bigger loops too: multiply the checks of adjacent faces and the shared inner edges cancel by Z·Z, leaving only the outer rim — so any loop that can be shrunk to a point equals the product of the face checks inside it, and does nothing to encoded states. Verify with the demo buttons:

∏p∈区域region Bp = Z(区域的外圈)(the region's rim) ⇒ 可收缩的圈对编码信息 ≡读「恒等于」:两边的作用效果完全相同。 什么都不做contractible loops ≡Read “is identically equal to”: the two sides act exactly the same. do nothing to the encoded data

5.6绕不回来的圈 = 逻辑算符Loops that can't shrink = logical operators

但环面上存在第二种圈。横着走一整排、从右边绕回左边接上自己——它闭合(无端点、无警报),却不围住任何区域:它绕的是整个环面,像套在甜甜圈上的橡皮筋,收缩不成一个点。上面实验台的第二个示范按钮画的正是它。它通过所有体检:圈上每个顶点都恰好占用圈的两条边(一进一出),与每颗星碰撞 0 或 2 次。但这种圈无法写成面检查的乘积,所以 5.5 的「等于什么都不做」论证对它失效,它对编码状态做了某件真实的事。这两句话的理由都在下面的补课 5.B。

But a torus hosts a second kind of loop. March straight across a whole row, wrap from the right edge back to the left, and close on yourself — closed (no endpoints, no alarms), yet enclosing no region: it loops around the torus itself, like a rubber band around a donut, unshrinkable to a point. The second demo button above draws exactly this. It passes every exam: each vertex on the loop uses exactly two of its edges (one in, one out), so it collides 0 or 2 times with every star. But such a loop cannot be written as a product of face checks, so §5.5's “does nothing” argument fails, and it does something real to the encoded state. The reasons for both statements are in Catch-up 5.B below.

「通过所有检查、对编码状态又不是什么都不做的操作」,这正是逻辑算符的定义:它改写的不是某个物理比特,而是被全体比特共同保管的逻辑信息。环面上有两个本质不同的绕法(水平圈、竖直圈),给出两个独立的逻辑 Z:

“Passes every check, yet does not act as do-nothing on encoded states”: that is the definition of a logical operator: it rewrites not any physical qubit but the logical information kept jointly by all of them. The torus has two essentially different windings (horizontal, vertical), giving two independent logical Z's:

Z̄₁ = Z-圈,水平缠绕-loop winding horizontally · Z̄₂ = Z-圈,竖直缠绕-loop winding vertically

X 这边同样有两条:沿「横跨边」方向的 X-圈(在面心间穿行的虚线路径),水平、竖直各一。一对 (X̄, Z̄) 要配成一个真正的逻辑量子比特,还差最后一项验收:逻辑 X̄ 与逻辑 Z̄ 必须反对易(真量子比特的 X 和 Z 就该如此,3.5 节)。数碰撞:一条竖直的 X̄-圈与一条水平的 Z̄₁-圈,在环面上恰好交叉一次——1 是奇数,反对易 ✓。而它与竖直的 Z̄₂ 走的是平行线,交叉 0 次——对易 ✓。两对搭档各就各位。下面把四条圈画在同一个 4 × 4 环面上,比特编号的规则和 5.2 的蓝图相同:

The X side has two as well: X-loops running in the “across-edges” direction (the dashed paths through face centres), one horizontal, one vertical. For a pair (X̄, Z̄) to form a genuine logical qubit, one final inspection: logical X̄ must anticommute with logical Z̄ (that's what X and Z of any true qubit do, §3.5). Count collisions: a vertical X̄-loop and a horizontal Z̄₁-loop cross on a torus exactly once — odd, anticommute ✓. With the vertical Z̄₂ it runs parallel, crossing 0 times — commute ✓. Two matched pairs, each in place. Below, the four loops are drawn on one 4 × 4 torus, with qubits numbered by the same rule as the blueprint of §5.2:

X̄₁Z̄₁ = −Z̄₁X̄₁ · X̄₁Z̄₂ = +Z̄₂X̄₁ (交叉数 1 与 0crossing numbers 1 and 0) 
⇒ 恰好 2 个逻辑量子比特,与 5.3 的账目吻合exactly 2 logical qubits, matching §5.3's ledger
(a) Z̄₁、Z̄₂:沿边走的 Z-圈(a) Z̄₁, Z̄₂: Z-loops along edges Z̄₁ Z̄₂ (b) X̄₁、X̄₂:穿过面心的 X-圈(b) X̄₁, X̄₂: X-loops through faces X̄₁ X̄₂ (c) 数交叉:X̄₁ 对 Z̄₁、Z̄₂(c) Count crossings: X̄₁ vs Z̄₁, Z̄₂ X̄₁ 与 Z̄₁ 共用 1 条边X̄₁ and Z̄₁ share 1 edge 交叉 1 → 反对易1 crossing → anticommute Z̄₁ Z̄₂ X̄₁ X̄₁ 与 Z̄₂ 平行X̄₁ runs beside Z̄₂ 交叉 0 → 对易0 crossings → commute (d) 甜甜圈上的两根橡皮筋(d) Two rubber bands on a donut 绕着洞转一圈once around the hole 绕着管子转一圈once around the tube 哪根都收不成一个点neither can shrink to a point
图 5.1Fig. 5.1 4×4 的环面,把四条逻辑圈摊开来看;(a)–(c) 是正上方「四条缠绕圈」实验台的静态版本。方格边上标着相同箭头的两条边界是黏在一起的:左边就是右边,上边就是下边,所以每条线走出一侧,就从对侧走回来。(a) 两条 Z̄ 沿边走(实线);(b) 两条 X̄ 从面心到面心穿行(虚线),每一步横穿一条边;(c) 把 X̄₁ 和两条 Z̄ 叠在一起数共用的边:和 Z̄₁ 恰好共用 1 条(粉圈),和 Z̄₂ 一条也不共用。这就是上面那行 X̄₁Z̄₁ = −Z̄₁X̄₁ · X̄₁Z̄₂ = +Z̄₂X̄₁ 里的「1」和「0」。(d) 同样两种绕法,搬到甜甜圈上就是两根怎么也收不紧的橡皮筋。 The four logical loops on a 4×4 torus, laid flat; panels (a)–(c) are a static version of the “four winding loops” bench right above. Borders marked with the same arrows are glued together: the left edge is the right edge, the top is the bottom, so a line leaving one side comes back in on the other. (a) The two Z̄ loops run along edges (solid). (b) The two X̄ loops hop from face centre to face centre (dashed), crossing one edge per hop. (c) Lay X̄₁ over both Z̄ loops and count shared edges: exactly 1 with Z̄₁ (pink ring), none with Z̄₂. Those are the “1” and “0” in the line above, X̄₁Z̄₁ = −Z̄₁X̄₁ · X̄₁Z̄₂ = +Z̄₂X̄₁. (d) The same two windings on a donut: two rubber bands you can never pull tight.
补课 · 缠绕圈为什么通过全部检查、为什么不是面检查的乘积、为什么不是「什么都不做」Catch-up · Why a winding loop passes every check, why it is not a product of faces, and why it is not “do nothing”
① 通过全部检查① It passes every check

以水平的 Z̄₁ 为例(一整行横边上各放一个 Z)。它是 Z 串,和面检查(也是 Z 串)不会碰撞。和星形检查:不在这一行上的顶点与它不共享边;这一行上的每个顶点恰好有两条横边属于它(左边一条、右边一条),碰撞 2 次,偶数。所以它与每一条检查都对易,按 4.5 的「警报 = 反对易」,不会拉响任何警报。X̄₁、X̄₂ 同理:一条穿过面心的路径对途经的每个面进出各一次,与途经的面共享两条边,其余面共享零条边。

Take the horizontal Z̄₁ (a Z on every horizontal edge of one row). It is a Z string, so it never collides with the face checks, which are Z strings too. As for the stars: a vertex off this row shares no edge with it, and every vertex on the row owns exactly two of its horizontal edges (one on the left, one on the right): 2 collisions, even. So it commutes with every check and, by §4.5's “alarm = anticommute”, sets off no alarm. X̄₁ and X̄₂ work the same way: a path through face centres enters and leaves each face it visits once, sharing 2 edges with each visited face and 0 with every other face.

② 不是面检查的乘积② It is not a product of face checks

任选一批面,记作区域 R,把它们的面检查乘起来。一条边若挨着 R 里的两个面,Z 出现两次、抵消;若只挨着一个,留下一个 Z。所以乘积 = 「R 的边框」上的 Z:正好一侧在 R 里、另一侧不在的那些边(5.5 的「外圈」就是这个)。现在沿一列面竖直往下走,一直绕环面一周回到出发的面。每走一步跨过一条横边:跨过的边在边框上时,从 R 里走到 R 外(或反过来);不在边框上时,留在原来那一侧。走完一周回到起点,「在不在 R 里」必须和出发时一样,所以一路上跨过边框的次数一定是偶数。可是这条竖直的路只跨过 Z̄₁ 那一行一次。所以 Z̄₁ 不可能是任何区域的边框,也就不是任何一批面检查的乘积。

Pick any set of faces, call the region R, and multiply their face checks. An edge bordering two faces of R gets two Z's, which cancel; an edge bordering just one keeps one Z. So the product is Z on “the rim of R”: exactly the edges with R on one side and not on the other (§5.5's “outer loop” is this rim). Now walk straight down one column of faces, all the way around the torus and back to the face you started in. Each step crosses one horizontal edge: crossing a rim edge takes you from inside R to outside (or back); crossing any other edge keeps you on the same side. Back at the start, “inside R or not” must be what it was at the beginning, so the walk crosses the rim an even number of times. But this vertical walk crosses the row of Z̄₁ exactly once. So Z̄₁ cannot be the rim of any region, and it is not a product of any set of face checks.

③ 对编码状态不是「什么都不做」③ It does not act as “do nothing” on encoded states

X̄₁ 也通过全部检查,所以对任何编码状态 ψ,X̄₁ψ 仍是编码状态:对每条检查 S,S(X̄₁ψ) = X̄₁(Sψ) = X̄₁ψ。假如 Z̄₁ 对所有编码状态都什么都不做,就有 Z̄₁(X̄₁ψ) = X̄₁ψ。但 X̄₁ 与 Z̄₁ 只共享一个比特、反对易,于是

X̄₁ passes every check too, so for any encoded state ψ, X̄₁ψ is still an encoded state: for every check S, S(X̄₁ψ) = X̄₁(Sψ) = X̄₁ψ. If Z̄₁ did nothing to every encoded state, we would have Z̄₁(X̄₁ψ) = X̄₁ψ. But X̄₁ and Z̄₁ share exactly one qubit and anticommute, so

X̄₁ψ = Z̄₁(X̄₁ψ) = −X̄₁(Z̄₁ψ) = −X̄₁ψ

一个状态等于自己的 −1 倍,只能是全零,矛盾(和补课 4.B 的论证一样)。所以 Z̄₁ 一定改变了某些编码状态:它改写的是逻辑信息。这一步用到的只是「存在一个与它反对易、又通过全部检查的串」;可收缩的圈找不到这样的搭档,因为它是面检查的乘积,而面检查与所有检查都对易。

A state equal to −1 times itself must be all zeros, a contradiction (the same argument as in Catch-up 4.B). So Z̄₁ must change some encoded states: what it rewrites is logical information. The only ingredient was “there is a string that anticommutes with it and passes every check”; a shrinkable loop has no such partner, because it is a product of face checks, and face checks commute with every check.

诚实说明Honesty box

「可收缩 / 缠绕」这类性质叫做拓扑性质:随便揉捏变形都不改变。逻辑信息存在「圈绕不绕」里。噪声每次只拨动零散的几个比特,造出的是短小的局部链;要改写逻辑信息,许多错误必须恰好连成一条绕环面一整圈的链(至少 L 条边,5.8 节),或者多到让译码器把链补错成一整圈(5.7 节)。这并非不可能:局部的小错误若没人修,会越积越多、连成缠绕链。能做的是让它很难发生:只要每个比特出错的概率 p 足够小(低于 5.8 末尾提到的阈值),并且反复测量检查、及时修复,逻辑错误的概率就随 L 增大而变小。这就是「拓扑保护」的含义:它压低逻辑错误的概率,并不禁止逻辑错误。顺带一提:那些成对出现、沿链端移动的警报点,物理学家叫它们任意子(anyon)——在我们的故事里,你已经与它们玩了一整章。

Properties like “shrinkable vs winding” are topological: arbitrary kneading and stretching never change them. The logical data lives in “does the loop wind?”. Noise nudges a few scattered qubits at a time and builds short local chains; to rewrite logical data, many errors must line up into a chain that winds all the way around the torus (at least L edges, §5.8), or become numerous enough that the decoder completes a chain into a full winding (§5.7). That is not impossible: small local errors left unrepaired pile up and can join into a winding chain. What the code achieves is making it hard: as long as each qubit's error probability p is small enough (below the threshold mentioned at the end of §5.8) and the checks are measured and repaired again and again, the chance of a logical error shrinks as L grows. That is what “topological protection” means: it suppresses logical errors; it does not forbid them. By the way: those paired alarm dots gliding at chain-ends are what physicists call anyons — you have been playing with them all chapter.

5.7纠错 = 给警报配对Correcting = pairing up the alarms

现在可以设计修理程序(专名:译码器读取全部警报、推断该施加什么修复操作的算法。英文 decoder。)了。测量所有检查后,我们看到的只是一撮亮着的警报点。策略:把警报两两配对,沿任意路径把每对连起来,沿路径施加 Z 作为修复。修复链与真实错误链首尾相接,合成一个或几个闭合圈(没有端点,所以没有警报)。剩下只有一个问题:这些圈合起来,是不是若干面检查的乘积(5.5:是,就什么都没发生;5.6:不是,就是逻辑算符)?判据是数缠绕数一条绕环面一周的测试路径跨过残留边的次数。竖直、水平各数一次;只有奇偶有意义。:沿竖直方向绕环面一周走一条测试路径(例如 5.6 里 X̄₁ 那条,穿过一列方块的中心),数它跨过几条残留的 Z 边;再沿水平方向(X̄₂ 那条)数一次。只看奇偶:

Now we can design the repair routine (proper name: the decoderThe algorithm that reads all alarms and infers what repair to apply.). After measuring every check we see only a scatter of lit alarms. Strategy: pair them up, connect each pair along any path, and apply Z along it as the repair. Repair chain plus true error chain join end-to-end into one or more closed loops (no endpoints, hence no alarms). One question remains: are these loops, taken together, a product of face checks (§5.5: if so, nothing happened; §5.6: if not, they form a logical operator)? The test is to count winding numbersHow many times a test path going once around the torus crosses the leftover edges. Count once vertically and once horizontally; only even or odd matters.: walk a test path once around the torus vertically (for instance the X̄₁ path of §5.6, through the centres of one column of squares) and count how many leftover Z edges it crosses; then count again along a horizontal path (the X̄₂ path). Only even or odd matters:

错误 ⊕ 修复:两个方向的缠绕数都是偶数 ⇒ 完美复原 · 任一方向是奇数 ⇒ 无声的逻辑错误error ⊕ repair: both winding numbers even ⇒ perfect recovery · either one odd ⇒ silent logical error
(⊕ = 把两批边合并、且成对相消:同一条边出现两次即 Z·Z = I,相当于没动它merge the two edge sets with pairwise cancellation: an edge appearing twice means Z·Z = I, as if untouched)

为什么数奇偶,而不是看「有没有缠绕圈」?下面的实验台画了三种残留,全在 4 × 4 环面上,比特编号同 5.2 的规则。一条水平缠绕圈就是 Z̄₁:竖直测试路径跨过它 1 次,奇数,逻辑错误。两条平行的水平缠绕圈,每一条单独都是 Z̄₁,合起来却夹出一条带子(图中着色的 8 块面)。把带子里的 8 条面检查乘起来:带子内部的每条边都挨着带子里的两块面(左右两端绕回相接,那里的竖边也一样),Z·Z 抵消;只剩带子上下两条边框,正好是这两条圈(5.5 的外圈规则)。所以两条圈合起来是面检查的乘积,对编码状态什么都不做;换个说法,Z̄₁ 做了两次,Z̄₁·Z̄₁ = I。竖直测试路径跨过它们 2 次,偶数。一条水平、一条竖直:两个方向各跨 1 次,残留是 Z̄₁Z̄₂,两个逻辑比特都被改写。

Why count even or odd, instead of asking “is there a winding loop”? The bench below draws three leftovers, all on a 4 × 4 torus with qubits numbered by the rule of §5.2. One horizontal winding loop is Z̄₁: the vertical test path crosses it once, odd, a logical error. Two parallel horizontal winding loops: each one alone is Z̄₁, but together they enclose a strip (the 8 shaded squares). Multiply the 8 face checks of the strip: every edge inside the strip borders two squares of the strip (the two ends wrap around and meet, and the vertical edges there behave the same way), so Z·Z cancels; only the strip's top and bottom rims remain, and they are exactly the two loops (§5.5's rim rule). So the two loops together are a product of face checks and do nothing to encoded states; put differently, Z̄₁ was applied twice, and Z̄₁·Z̄₁ = I. The vertical test path crosses them twice, even. One horizontal and one vertical: each direction is crossed once, the leftover is Z̄₁Z̄₂, and both logical qubits are rewritten.

为什么两个方向都要数、而且只看奇偶?理由分两半。奇数 ⇒ 逻辑错误:补课 5.B ② 的走路论证说明,任何一批面检查的乘积,都被绕环面一周的路跨过偶数次,所以跨奇数次的残留不是面检查的乘积;它还与那条测试路径上的 X̄ 共享奇数个比特、反对易,于是补课 5.B ③ 的论证原样适用:它改写了逻辑信息。偶数 ⇒ 无害:两个方向都跨偶数次的闭合圈,一定是面检查的乘积。这一半的一般证明要用拓扑学里的同调,超出本页(高中数学版 5.6 节的折叠盒给出它的名字);上面的两条平行圈是它最简单的例子。X 错误的残留同理,只是测试路径换成沿边走的 Z̄₁、Z̄₂。

Why count both directions, and why only even or odd? The reason has two halves. Odd ⇒ logical error: the walking argument of Catch-up 5.B ② shows that any product of face checks is crossed an even number of times by a path going once around the torus, so a leftover crossed an odd number of times is not a product of face checks; it also shares an odd number of qubits with the X̄ on that test path, so they anticommute, and the argument of Catch-up 5.B ③ applies word for word: it rewrites logical information. Even ⇒ harmless: a set of closed loops crossed an even number of times in both directions is always a product of face checks. The general proof of this half uses homology from topology and is beyond this page (the fold-out in §5.6 of the high-school edition gives its name); the two parallel loops above are its simplest example. Leftovers of X errors work the same way, with the test paths replaced by the along-edge loops Z̄₁ and Z̄₂.

妙处:修复不必猜中真实错误——差之毫厘也无妨,只要合成的圈两个方向的缠绕数都是偶数就全胜;最常见的情形是它们根本不绕,只是可收缩的小圈。这正是 5.4 节那份「模糊」的回报。风险也清楚了:把该配的两对配串了,修复链可能与错误链合成绕环面奇数次的圈——满盘皆输还毫无警报。怎样配才好?错误越少越常见,所以最常用的规则是:在所有配对方式里,挑修复链总长度最短的一种。下面实验台的「自动译码」就这样做:警报不超过 14 个时,它把所有配法逐一比较;更多时退而求其次,每次先把最近的两个配成一对。每回合结束时,游戏按上面的判据判胜负:它数残留(蓝 ⊕ 绿)被竖直、水平两条测试路径各跨过几次,结果写在读数里。亲自当一回译码器(失败几回更有收获):

The beauty: the repair need not guess the actual error — near misses are fine, as long as the combined loops have even winding numbers in both directions; most often they do not wind at all and are small contractible loops. That is the payoff of §5.4's ambiguity. The risk is equally clear: mis-pair the alarms and repair-plus-error may close into loops that wind around the torus an odd number of times — total loss, zero alarms. How should one pair? Fewer errors are more likely than more, so the most common rule is: among all ways of pairing, choose the one whose repair chains have the shortest total length. The bench's “auto-decode” does exactly this: with at most 14 alarms it compares every possible pairing; with more it settles for less, repeatedly pairing the two closest alarms. At the end of each round the game judges by the rule above: it counts how many times the vertical and the horizontal test path cross the leftover (blue ⊕ green) and shows the counts in the readout. Serve as the decoder yourself (losing a few rounds teaches the most):

5.8尺寸红利:越大越安全The size dividend: bigger is safer

要酿成一次无声的逻辑错误,错误串必须缠绕整个环面。一条水平缠绕的圈要从最左一列走到最右一列再接回来,每经过一列至少走一条横边,所以至少有 L 条边;竖直缠绕、X 型的圈同理。5.6 的直线圈恰好是 L 条,所以最短的逻辑算符长 L。按 4.6 节的定义:

To brew a silent logical error, the error string must wind the whole torus. A horizontally winding loop has to travel from the leftmost column to the rightmost and join up again, using at least one horizontal edge per column, so it has at least L edges; vertical and X-type loops likewise. The straight loops of §5.6 have exactly L, so the shortest logical operator has length L. By §4.6's definition:

码距distance d = L · 对两种错误对称成立symmetrically for both error types · 扩大网格 ⇒ d 任意增长grow the grid ⇒ d grows without bound

用 4.6 的记号,L × L 的环面码是 [[2L², 2, L]],例如 L = 3 时是 [[18, 2, 3]]。按 4.6 的规则,它保证纠正任意 (L − 1)/2 个错误。反过来,要骗过「按最短配对」的译码器(5.7),大约只需要一半长度,也就是约 L/2 个错误恰好排在同一条缠绕线上:剩下的一半会被「修复」补齐。

In §4.6's notation the L × L toric code is [[2L², 2, L]]; for L = 3 that is [[18, 2, 3]]. By §4.6's rule it is guaranteed to correct any (L − 1)/2 errors. Conversely, fooling a shortest-pairing decoder (§5.7) takes only about half the length, roughly L/2 errors lined up on one winding line: the “repair” completes the other half.

任务书四条指标——两族检查 ✓(星与面)、全体对易 ✓(角连两边)、两种错误对称且码距可放大 ✓(d = L)、每条检查只碰 4 个近邻 ✓——全部兑现。至于「L/2 个错误连成一线的概率随 L 缩得多快」「p 小到多少之后越大越好」,这些定量问题的答案是一条震撼的曲线,叫阈值——它属于姊妹篇《从 Toric Code 到 Surface Code》第 6 章的压轴实验。

All four requirements of the brief — two check families ✓ (stars & faces), all commuting ✓ (corners touch two sides), symmetric and growable distance ✓ (d = L), each check touching only 4 neighbours ✓ — delivered. As for “how fast does the chance of L/2 aligned errors shrink with L” and “below what p does bigger become better”, the quantitative answer is one stunning curve called the threshold — the finale experiment of “From Toric Code to Surface Code”, Chapter 6.

检查站Checkpoint第 5 章 · 之一Chapter 5 · part 1
一条由 7 个 Z 错误连成的开链(不闭合、不缠绕)。多少个警报亮起?An open chain of 7 Z errors (not closed, not winding). How many alarms light up?

对。链内部的每个顶点被相邻两条错误边各撞一次,(−1)² = +1,安静。信息藏在端点里——这也是为什么译码器的全部工作就是「给端点配对」。

Right. Each interior vertex is struck once by each of its two adjacent error edges: (−1)² = +1, silent. All information lives at the endpoints — which is why decoding is exactly “pair the endpoints”.

回看 5.4:链中间的顶点被撞偶数次,两个 −1 相乘抵消。数「奇数次」的位置。

Revisit §5.4: interior vertices are struck an even number of times; two −1s cancel. Count the odd-struck spots.

检查站Checkpoint第 5 章 · 之二Chapter 5 · part 2
译码后残留的「错误⊕修复」是一个绕竖直方向一整圈的 Z-圈。它对两个逻辑比特做了什么?After decoding, the residual “error ⊕ repair” is a Z-loop winding once vertically. What did it do to the two logical qubits?

对。「闭合」不够,要看缠绕数的奇偶:水平测试路径跨过这条圈 1 次,奇数;竖直测试路径跨 0 次。所以它是 Z̄₂,静悄悄地拧了第二个逻辑比特的符号。(若是两条平行的竖直圈,跨 2 次,偶数,合起来无害。)

Correct. “Closed” is not enough; what counts is the winding number mod 2: the horizontal test path crosses this loop once, odd, and the vertical one crosses it zero times. So it is Z̄₂, silently twisting logical qubit 2's sign. (Two parallel vertical loops would be crossed twice, even, and together be harmless.)

回看 5.7 的判据:数两条测试路径各跨过残留几次,只看奇偶。一条竖直圈被水平测试路径跨 1 次,奇数,是逻辑算符;按方向,它是 Z̄₂。

Revisit §5.7's test: count how often each test path crosses the leftover, and look only at even or odd. A single vertical loop is crossed once by the horizontal test path, odd, so it is a logical operator; by direction, it is Z̄₂.

尾声Epilogue

你已经走完的路,和前方的一小段The road behind you, and the short stretch ahead

盘点一下行囊。你从 1+1=2 出发,亲手建立了:负负得正与奇偶(第 1 章);「出错—检查—修复」与不读内容的奇偶体检(第 2 章);量子比特、两副眼镜、两种错误、XZ = −ZX(第 3 章);不破坏叠加的联合测量、碰撞规则、检查清单计数法,以及第一个量子码和它的致命弱点(第 4 章);最后,把一切装上网格:角连两边保证对易、错误链的端点就是警报、可收缩圈无害、缠绕圈即逻辑算符、纠错即配对(第 5 章)。这不是一份「关于 toric code 的介绍」——这就是 toric code 本身,你把每一块砖都摸过了。

Inventory time. Starting from 1+1=2 you built, with your own hands: minus-times-minus and parity (Ch. 1); fail–check–repair and content-blind parity exams (Ch. 2); the qubit, two lenses, two error types, XZ = −ZX (Ch. 3); joint measurements that spare superpositions, the collision rule, checklist-counting, and a first quantum code with its fatal flaw (Ch. 4); finally, everything mounted on a grid: corners-touch-two-sides for commuting, chain-endpoints as alarms, contractible loops harmless, winding loops logical, decoding as pairing (Ch. 5). This was not “an introduction to the toric code” — it was the toric code itself, every brick handled personally.

只剩一个现实问题:真实的芯片是平的,没人能把量子处理器烤成甜甜圈。把环面剪开、铺平,边界上会发生一系列既麻烦又美妙的事——码变成今天 Google、IBM 等团队真正在制造的 surface code(表面码)。这正是姊妹篇《从 Toric Code 到 Surface Code》的内容:两种边界、贴着边界溜走的错误链、平面上的译码游戏,以及压轴的「阈值」现场实验。

One practical problem remains: real chips are flat — nobody bakes a quantum processor into a donut. Cutting the torus open and laying it flat triggers a cascade of awkward-and-beautiful boundary effects — and the code becomes the surface code that Google, IBM and others are actually building. That is the companion tutorial, “From Toric Code to Surface Code”: two kinds of boundary, error chains slipping out through them, the planar decoding game, and the grand-finale live threshold experiment.

接着读Read next

《从 Toric Code 到 Surface Code》——本页的一切都会用上。打开 →

“From Toric Code to Surface Code” — everything on this page gets used. Open →

符号与读法Symbols & how to read them

符号Symbol名称与读法Name & how to read it在本教程中的含义Meaning in this tutorial
ψ希腊字母,读「普西」(psai)Greek letter, read “psy” (rhymes with “sigh”)物理学的百年老习惯:用 ψ 给一个量子状态起名。|ψ⟩ 就是「名叫 ψ 的那个状态」——它不是未知数,只是个名字,相当于「小明」。A century-old physics habit: ψ names a quantum state. |ψ⟩ is “the state called ψ” — not an unknown, just a name.
α希腊字母,读「阿尔法」(alpha)Greek letter, read “AL-fa”希腊字母表的第一个,惯用作第一个系数。本教程中:逻辑 0̄ 成分的振幅。First letter of the Greek alphabet, customary for a first coefficient. Here: the amplitude of the logical-0̄ part.
β希腊字母,读「贝塔」(beta)Greek letter, read “BAY-ta”希腊字母表的第二个,惯用作第二个系数。本教程中:逻辑 1̄ 成分的振幅。注意 α²+β²=1。Second Greek letter, customary for a second coefficient. Here: the amplitude of the logical-1̄ part, with α²+β²=1.
∏大写希腊字母 π,读「派」(pi)Capital Greek π, read “pie”连乘记号:把后面的东西全部乘起来——求和号 ∑ 的乘法版。∏v Av 即「所有星形检查的乘积」。The product sign: multiply everything that follows — the multiplicative sibling of the summation sign ∑. ∏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.
∈ ∋读「属于」Read “belongs to / element of”e ∈ S:e 是集合 S 的一员。反着写的 e ∋ v 用在 ∏e∋v 里:「所有碰到顶点 v 的边 e」。e ∈ S: e is a member of the set S. The mirrored e ∋ v in ∏e∋v reads “all edges e touching vertex v”.
∎实心小方块,读「证毕」(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 in this tutorial 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.
·居中的小圆点,读「乘」A raised dot, read “times”x·x = x × x。公式里项与项之间的「 · 」只是分隔符。x·x = x × x. Between items of a formula, “ · ” is merely a separator.
P(…)读「……的概率」Read “the probability of …”P(正面) = 抛出正面的概率;介于 0 和 1 之间,所有结果的 P 加起来是 1。P(heads) = the probability of heads; between 0 and 1, and the P of all outcomes sum to 1.
b₁ X₂脚标,读「b 一」「X 二」Subscripts, read “b one”, “X two”脚标是编号:b₁ 是第 1 个比特,X₂ 是作用在 2 号比特上的 X。The subscript is an address: b₁ is bit 1, X₂ is an X applied to qubit 2.
2ⁿ上标,读「2 的 n 次方」Superscript, read “two to the n”n 个 2 连乘;n 个比特共有 2ⁿ 个基本成分。n twos multiplied together; n qubits have 2ⁿ basic components.
#井号,读「……的个数」Read “the number of …”#(X↔Z 碰撞格) = X 撞上 Z 的格子有几个。#(X↔Z cells) = how many cells have X meeting Z.
≡三横线,读「恒等于」Three bars, read “identically equal”两边的作用效果完全相同:可收缩圈 ≡ 什么都不做。The two sides act exactly the same: contractible loop ≡ do nothing.
≈读「约等于」Read “approximately equals”两边近似相等。The two sides are nearly equal.
≠读「不等于」Read “not equal”两边不相等。The two sides differ.
n k r三个字母Three lettersn = 物理比特数;r = 独立检查的条数;k = n − r = 逻辑比特数(4.4)。n = number of physical qubits; r = number of independent checks; k = n − r = number of logical qubits (§4.4).
[[n, k, d]]读「n k d 码」(双层方括号)Read “n, k, d code” (double brackets)量子码的三项指标:物理比特数、逻辑比特数、码距。三比特码 [[3, 1, 1]];L × L 环面码 [[2L², 2, L]]。A quantum code's three key numbers: physical qubits, logical qubits, distance. The 3-qubit code is [[3, 1, 1]]; the L × L toric code is [[2L², 2, L]].

词汇表Glossary

术语Term白话定义Plain definition
比特 / 量子比特bit / qubit两个状态选其一的系统 / 两种成分按 (a, b) 配比共存的系统,a²+b²=1。A system in one of two states / one blending both with numbers (a, b), a²+b²=1.
振幅amplitude每种成分的配比数字,可为负;平方即概率。The blend-number of a component, possibly negative; its square is the probability.
坍缩collapse测量后状态跳到与结果一致的样子,原配比丢失。After measurement the state jumps to match the outcome; the old blend is lost.
X, Z两种基本操作:X 交换 (a,b)→(b,a);Z 变号 (a,b)→(a,−b)。也是两种错误的名字。The two elementary operations: X swaps (a,b)→(b,a); Z re-signs (a,b)→(a,−b). Also the names of the two error types.
对易 / 反对易commute / anticommute交换先后顺序:结果不变 / 多出一个整体 −1。判据:X 撞 Z 的格数为偶 / 奇。Swapping order: no change / one overall −1. Test: even / odd count of X-meets-Z cells.
泡利串Pauli string每个比特一格、格里填 I/X/Z 的多比特操作,如 X·I·Z。A multi-qubit operation with one cell (I/X/Z) per qubit, e.g. X·I·Z.
稳定子(检查)stabilizer (check)清单上的一条泡利串检查;编码状态须对全部检查「必然 +1」。One Pauli-string check on the list; encoded states must answer “+1 surely” to all.
症状syndrome全部检查读数拼成的报告;指认错误、不泄露内容。The report of all check readings; names the error, betrays no content.
星形 / 面检查star / face checkAv:顶点 v 的 4 条边上的 X·X·X·X;Bp:面 p 的 4 条边上的 Z·Z·Z·Z。Av: X·X·X·X on the 4 edges at vertex v; Bp: Z·Z·Z·Z on the 4 edges around face p.
环面torus左右相接、上下相接的绕回世界;甜甜圈的表面。The wrap-around world (left↔right, top↔bottom); a donut's surface.
逻辑比特logical qubit码保护的那个量子比特,由许多物理比特共同保管;它的 0、1 记作 0̄、1̄。The qubit the code protects, held jointly by many physical qubits; its 0 and 1 are written 0̄, 1̄.
独立检查independent check不是清单上其他检查的乘积的检查;每条独立检查把自由的配比数字砍掉一半。独立检查的条数记作 r,k = n − r。A check that is not a product of other checks on the list; each one halves the free mixing numbers. Their number is r, and k = n − r.
逻辑算符 Z̄, X̄logical operators Z̄, X̄作用在逻辑比特上的 Z、X:通过全部检查、对编码状态又不是什么都不做。三比特码里是 Z₂、X₁X₂X₃;环面上是缠绕圈。The Z and X of the logical qubit: they pass every check yet do not act as do-nothing on encoded states. In the 3-qubit code: Z₂, X₁X₂X₃; on the torus: winding loops.
码距 ddistance d最短逻辑算符的长度;toric code 中 d = L。码距 d 保证纠正 (d − 1)/2 个错误。The length of the shortest logical operator; d = L for the toric code. Distance d guarantees correcting (d − 1)/2 errors.
[[n, k, d]]量子码的三项指标并排写:n 个物理比特、k 个逻辑比特、码距 d。A quantum code's three numbers side by side: n physical qubits, k logical qubits, distance d.
不可克隆定理no-cloning theorem没有任何操作能复印一个未知的量子状态;编码只抄标签、不复制配比数字(补课 4.D)。No operation copies an unknown quantum state; encoding copies labels, not mixing numbers (Catch-up 4.D).
受控翻转(CNOT)controlled flip (CNOT)两比特操作:第一个比特是 1 时翻转第二个,是 0 时不动。A two-qubit operation: flip the second qubit if the first is 1, do nothing if it is 0.
译码器decoder读警报、配端点、开修复处方的算法。The algorithm that reads alarms, pairs endpoints, prescribes repairs.
缠绕数winding number绕环面一周的测试路径跨过一批边的次数,竖直、水平各数一次。译码后的残留两个方向都是偶数则无害,任一为奇数则是逻辑错误(5.7)。How many times a test path going once around the torus crosses a set of edges, counted vertically and horizontally. A leftover after decoding is harmless if both counts are even and a logical error if either is odd (§5.7).
任意子anyon对警报点(链端点)的物理学称呼;可成对产生、移动、湮灭。The physicist's name for the alarm dots (chain endpoints); created, moved, annihilated in pairs.

延伸阅读Further reading

  • A. Kitaev, “Fault-tolerant quantum computation by anyons” (1997/2003)
    toric code 的出生证明。前几节以本教程的水平已经可以试读。arXiv: quant-ph/9707021The toric code's birth certificate. Its opening sections are approachable at this tutorial's level. arXiv: quant-ph/9707021
  • E. Dennis, A. Kitaev, A. Landahl, J. Preskill, “Topological quantum memory” (2002)
    错误链、配对译码与阈值的系统分析;本教程第 5 章的学术版。arXiv: quant-ph/0110143The systematic study of error chains, matching decoders and thresholds; the scholarly edition of our Chapter 5. arXiv: quant-ph/0110143
  • A. Fowler, M. Mariantoni, J. Martinis, A. Cleland, “Surface codes: Towards practical large-scale quantum computation” (2012)
    工程视角的表面码百科全书;读完《从 Toric Code 到 Surface Code》后翻开正合适。arXiv: 1208.0928The engineer's encyclopedia of surface codes; perfect right after “From Toric Code to Surface Code”. arXiv: 1208.0928
  • M. Nielsen, I. Chuang, “Quantum Computation and Quantum Information”
    量子计算的标准教科书:完整的复数版量子力学与稳定子理论(第 10 章)。The standard textbook: the full complex-number quantum mechanics and stabilizer theory (Chapter 10).
诚实总账The honesty ledger

本教程做过的简化,在此一次性结清:① 我们全程只用实数振幅。完整的量子力学使用复数,多一种操作 Y(= 同时来一下 X 和 Z);好消息是 Y 错误会同时触发两族检查,toric code 顺手就把它捉了,所以主线结论一条不改。② 我们假设测量本身不出错。真实设备的检查读数也会错,解法是反复测多轮、在时间方向上也做配对——《从 Toric Code 到 Surface Code》4.3 节会正面讨论。③ 实验台的自动译码在警报不超过 14 个时做的就是最小重量完美匹配(总长度最短的配对),警报更多时改用每次先配最近两个的贪心配对,那样会差一些。真实实验用的匹配译码器还会按各处的出错概率给路径加权,思想相同。

All simplifications, settled in one bill: ① We used real amplitudes throughout. Full quantum mechanics uses complex numbers and one more operation, Y (= an X and a Z at once); happily a Y error trips both check families and the toric code catches it in stride, so no headline conclusion changes. ② We assumed measurements themselves are perfect. Real readouts also err; the cure is repeating rounds and pairing across time as well — faced squarely in “From Toric Code to Surface Code”, §4.3. ③ With at most 14 alarms the bench's auto-decoder performs minimum-weight perfect matching (the pairing of shortest total length); with more alarms it switches to greedy closest-pair matching, which does somewhat worse. Matching decoders used in real experiments also weight each path by how likely errors are along it; the idea is the same.