Surface Code · 推导与指南Surface Code · Derivations & Guides
QEC-Bank 条目导读 · Surface Code · 推导与指南QEC-Bank entry guide · Surface code · Derivations & Guides

把五个「为什么」
算到底
Five “whys”,
worked to the bottom

直觉教程告诉你表面码长什么样、为什么能工作。这一页回答的是 QEC-Bank「推导与指南」侧面的问题:那些结论里,哪些能在纸上证出来,哪些是机器当场重算过的,哪些只是引用了文献?我们把五条推导一步不跳地做完:它是一个超图乘积、码距恰好等于家族变量 L、症状是错误链的边界、缝合线测的是逻辑奇偶、阈值数字各归各的账。页面上的每一个数字,都对应 QEC-Bank 脚本 reproduce.py 里的一条断言。 The intuition guide told you what the surface code looks like and why it works. This page answers the question the QEC-Bank “Derivations & guides” facet asks: of those conclusions, which are proved on paper, which are recomputed by the machine on the spot, and which are merely cited? We carry out five derivations without skipping a step: it is a hypergraph product, the distance equals the family variable L exactly, the syndrome is the boundary of an error chain, a seam measures logical parity, and each threshold number belongs to its own ledger row. Every number on this page matches one assertion in the QEC-Bank script reproduce.py.

前置:《从 Toric Code 到 Surface Code》的第 2 章(两种边界、记账 k=1)与3.2 节(横跨串)。这里新增的是证明本身和它们的出处标签;矩阵运算只用到 0/1 的模 2 加法。 Prerequisite: Chapter 2 of “From Toric Code to Surface Code” (two boundaries, the ledger k=1) and its §3.2 (spanning strings). New here: the proofs themselves and their provenance labels; the only matrix arithmetic is 0/1 addition mod 2.
开始 ↓Begin ↓ 全程约 60–80 分钟 · 含平面沙盘、逻辑串绘制、译码游戏与一次阈值实验 · 在 QEC-Bank 中查看此条目 →About 60–80 minutes · with a planar sandbox, logical-string drawing, the decoding game and one threshold experiment · Open in the QEC-Bank →
目录Contents
第 0 章Chapter 0

什么叫「Level-2」,以及复现契约What “Level-2” means, and the reproduction contract

QEC-Bank 给每个码写两层文字。第一层是直觉短文:图画、比喻、边界怎么分工。第二层是「推导页」:每页只回答一个问题,把证明做完,并逐条说明哪句话是代数、哪句是机器重算、哪句是文献。本教程就是把表面码的五张推导页讲成一门课。 The QEC-Bank writes two layers of text for every code. Layer one is the intuition essay: pictures, analogies, how the boundaries divide the work. Layer two is the “derivation pages”: each answers one question completely and says, statement by statement, which sentence is algebra, which is a machine recomputation, and which is literature. This tutorial teaches the surface code's five derivation pages as one course.

0.1五个问题Five questions

你在直觉教程里已经看见了这五件事(下表第二列逐条给出位置),这里要把它们证出来:

You have already seen these five things in the intuition guide (the table's second column links each place); here they get proved:

全页通用的四个字母:L = 家族变量(贴片一边的比特数,同时是码距);n = 物理比特数(环面码教程对 n 的定义);k = 逻辑比特数 = n − 独立检查数(环面码教程的记账);d = 码距 = 能悄悄改写逻辑信息的最短错误串长度(环面码教程对码距的定义)。记号 [[n, k, d]] 把三者并列。Four letters used throughout: L = the family variable (qubits along one side of the patch, and also the distance); n = number of physical qubits (the toric guide's definition of n); k = number of logical qubits = n − independent checks (the toric guide's ledger); d = distance = the length of the shortest error string that silently rewrites logical data (the toric guide's definition of distance). The notation [[n, k, d]] lists the three together.

问题Question直觉教程里的版本Its form in the intuition guide本教程要做的事What this tutorial does
1 · 为什么它是 HGP(repL, repL)1 · Why it is HGP(repL, repL)「剪开环面、两种边界、账本得 1」“Cut the torus, two boundaries, the ledger gives 1”写出检查矩阵,证明它们对易、局域,且 k=1Write the check matrices; prove they commute, are local, and k=1
2 · 为什么码距恰好是 L2 · Why the distance is exactly L「最短横跨串走 d 条边」“The shortest spanning string uses d edges”上界一条串、下界 L 条不相交代表元,再让机器枚举One string for the upper bound, L disjoint representatives for the lower, then machine enumeration
3 · 为什么症状是错误链的边界3 · Why the syndrome is the boundary of a chain「警报亮在端点,边界吃掉一端」“Alarms light at endpoints; a boundary swallows one end”用 HZ·e 逐步算出一条 L=3 的走位Compute an L=3 walk step by step with HZ·e
4 · 为什么缝合线测的是逻辑奇偶4 · Why a seam measures logical parity格点手术教程的合并章The merge chapter of the lattice-surgery guide写出三条缝合检查的连乘,重算 n=28、k=1、d=3Write the product of the three seam checks; recompute n=28, k=1, d=3
5 · 一个阈值数字指的是哪个模型5 · Which model a threshold number refers to「约 10.3%;电路级约 0.5–1%」“About 10.3%; circuit-level roughly 0.5–1%”五行账,每行带完整限定项与出处A five-row ledger, each row with full qualifiers and provenance

0.2复现契约:每个数字都能重跑The reproduction contract: every number reruns

QEC-Bank 对这些页面立了一条规矩:凡是「算出来」的陈述,都必须能在仓库里重跑。脚本 codes/surface/pedagogy/reproduce.py 导入随 QEC-Bank 一起发布的构造器,逐条断言本教程用到的每个计算结果:检查矩阵、局域性、秩、逻辑代表元、症状走位、两个精确码距、L=5 的带种子上界、资源计数、以及 L=3 的矩形合并。任何一条不符,脚本立刻以非零状态退出。另有独立的验证器重跑 instances.yaml 里的参数。

The QEC-Bank imposes one rule on these pages: every statement that was “computed” must rerun inside the repository. The script codes/surface/pedagogy/reproduce.py imports the constructor shipped with the QEC-Bank and asserts every computed result this tutorial uses: check matrices, locality, ranks, logical representatives, the syndrome walk, the two exact distances, the seeded L=5 upper bound, resource counts, and the L=3 rectangular merge. On the first disagreement it exits nonzero. An independent verifier reruns the parameters in instances.yaml.

source .venv/bin/activate python codes/surface/pedagogy/reproduce.py make verify-entry E=codes/surface

E=codes/surface = 要验证的条目路径;三行依次是:进入虚拟环境、重跑全部断言、独立验证器重跑 instances.yaml。E=codes/surface = the entry path to verify; the three lines: enter the virtual environment, rerun every assertion, let the independent verifier rerun instances.yaml.

出处的划分是刻意的,本教程每一章都会沿用这套标签:

The provenance split is deliberate, and every chapter below reuses these labels:

陈述Statement谁保证它What guarantees itQEC-Bank 标签QEC-Bank label
n = 2L²−2L+1、k = 1、CSS 结构;L=3 与 L=4 的精确码距n = 2L²−2L+1, k = 1, CSS structure; exact distances at L=3 and L=4机器重算(reproduce.py + 验证器)Machine recomputation (reproduce.py + verifier)verified
L=5 的码距Distance at L=5下界来自定理与文献;上界是带种子、可重跑的机器见证Lower bound from theorem and literature; upper bound a seeded, rerunnable machine witnessbounded
格点手术「合并 = 测 ZL⊗ZL」Lattice surgery “merge = measure ZL⊗ZL”合并后矩形的 n、k、d 由机器重算;操作的语义是文献主张The merged rectangle's n, k, d are recomputed; the operation's semantics is a literature claimclaimed
阈值与硬件数字Thresholds and hardware numbers不是检查矩阵的性质;文献主张,噪声模型与译码器写在数字旁边Not properties of a bare check matrix; literature claims with the noise model and decoder written beside each number文献(每行带限定项)literature (qualified per row)
范围Scope

本教程与 QEC-Bank 的构造器都只描述未旋转平面族 [[2L²−2L+1, 1, L]]。旋转版、XZZX、带缺陷(twist)或三维的变体不在这些参数与证书的覆盖范围内;它们的关系在「关系」侧面。

This tutorial and the QEC-Bank constructor describe only the unrotated planar family [[2L²−2L+1, 1, L]]. Rotated, XZZX, twist-defect or three-dimensional variants are not covered by these parameters and certificates; their relationships live in the Relations facet.

第 1 章Chapter 1

HGP(repL, repL) 就是未旋转的平面贴片HGP(repL, repL) is the unrotated planar patch

直觉教程用剪刀造出表面码;QEC-Bank 的构造器用一条乘法。本章证明两者是同一个对象:从一条 (L−1)×L 的经典矩阵出发,乘出两块量子比特、两张检查矩阵,验证它们对易、只连邻居,并算出 k=1。 The intuition guide built the surface code with scissors; the QEC-Bank constructor builds it with one multiplication. This chapter proves they are the same object: starting from one (L−1)×L classical matrix, multiply out two qubit blocks and two check matrices, verify they commute and touch only neighbours, and compute k=1.

1.1经典因子:一条开链的奇偶矩阵The classical factor: the parity matrix of an open chain

令 H = rep_parity(L)长度 L 的重复码的奇偶检查矩阵:L−1 行、L 列,第 i 行只在第 i、i+1 列为 1,即「相邻两位相等」的检查。,一张 (L−1)×L 的 0/1 矩阵,每行是「相邻两位相等吗」:

Let H = rep_parity(L)The parity-check matrix of the length-L repetition code: L−1 rows, L columns, row i has 1s only in columns i and i+1, i.e. the check “are two neighbouring bits equal?”., an (L−1)×L binary matrix whose rows each ask “are two neighbouring bits equal?”:

H = rep_parity(L) = 1 1 0 0 … 0 1 1 0 … … … 0 1 1 ((L−1) 行rows × L 列columns)

H = 重复码的校验矩阵(每行一条「相邻两位相等」的检查);L = 家族变量 = 重复码的长度;行数 L−1 = 检查数,列数 L = 经典比特数。H = the repetition code's parity-check matrix (each row one “two neighbours equal” check); L = the family variable = the repetition code's length; L−1 rows = checks, L columns = classical bits.

三个事实。行独立:第 0 列只在第 0 行出现,所以任何「加起来为零」的行组合必须不含第 0 行;去掉它后第 1 列只剩第 1 行,同理……逐列推进,每个系数都被迫为零。于是 rank秩:矩阵里线性独立的行数(= 独立的列数)。这里在模 2 意义下计算。(H) = L−1。核是一维的:ker核(kernel):使 H·v = 0 的全部向量 v 组成的空间。dim ker H = 列数 − rank(H)。(H) 只有两个元素:零向量与全 1 向量(每对相邻位都相等,只能全 0 或全 1);全 1 向量是它唯一的基向量,dim ker H = L − (L−1) = 1。转置的核是零维的:Hᵀ 有 L 行、L−1 列且列独立,所以 dim ker Hᵀ = (L−1) − (L−1) = 0。

Three facts. The rows are independent: column 0 appears only in row 0, so any combination of rows summing to zero cannot contain row 0; remove it and column 1 survives only in row 1, and so on, column by column, every coefficient is forced to zero. Hence rankThe number of linearly independent rows (= independent columns) of a matrix, computed here mod 2.(H) = L−1. The kernel is one-dimensional: kerThe kernel: the space of all vectors v with H·v = 0. dim ker H = number of columns − rank(H).(H) has exactly two elements, the zero vector and the all-ones vector (every neighbouring pair equal forces all bits equal, so all 0 or all 1); the all-ones vector is its single basis vector, and dim ker H = L − (L−1) = 1. The transpose kernel is zero-dimensional: Hᵀ has L rows, L−1 independent columns, so dim ker Hᵀ = (L−1) − (L−1) = 0.

rank(H) = L−1 · dim ker(H) = 1 · dim ker(Hᵀ) = 0 (最后一条 = 「链是开的」的代数签名the last one = the algebraic signature of an open chain)

rank = 独立行数;ker = 核,即 H·v = 0 的解空间;dim = 维数;ᵀ = 转置;H、L 同上。rank = number of independent rows; ker = kernel, the solution space of H·v = 0; dim = dimension; ᵀ = transpose; H, L as above.

最后那个 0 值得记住。若把链首尾相接成 L 条边的圈,就要多加一行「第 L−1 位与第 0 位相等」——但这一行是前面各行之和,依赖。普通核仍是一维,转置核却变成一维。这一个数字的差别,正是平面与环面的差别(1.4 节)。

Remember that final 0. Close the chain into an L-edge cycle and you add one row, “bit L−1 equals bit 0” — but that row is the sum of all the others: dependent. The ordinary kernel stays one-dimensional while the transpose kernel becomes one-dimensional. That single digit is the whole difference between plane and torus (§1.4).

1.2量子乘积:两块比特、两张矩阵、一次抵消The quantum product: two qubit blocks, two matrices, one cancellation

超图乘积Hypergraph product (HGP):Tillich–Zémor 的构造,把两条经典检查矩阵 H₁、H₂ 组合成一对对易的量子 CSS 检查矩阵。这里两条都取 H。(HGP,tillich2009quantum)拿两份 H,把量子比特放进两块:比特×比特块,L×L = L² 个;检查×检查块,(L−1)×(L−1) = (L−1)² 个。合计 n = L² + (L−1)² = 2L²−2L+1,正是直觉教程账本里的 d² + (d−1)²。两张检查矩阵各有 L(L−1) 行,用⊗(张量积:A⊗B 把 B 整份复制进 A 的每个 1 所在位置)写成:

The hypergraph productHGP: the Tillich–Zémor construction combining two classical check matrices H₁, H₂ into a commuting pair of quantum CSS check matrices. Here both are H. (HGP, tillich2009quantum) takes two copies of H and places qubits in two blocks: the bit×bit block, L×L = L² qubits; the check×check block, (L−1)×(L−1) = (L−1)² qubits. In total n = L² + (L−1)² = 2L²−2L+1, exactly the d² + (d−1)² of the intuition guide's ledger. The two check matrices, each with L(L−1) rows, are written with ⊗ (the tensor product: A⊗B copies all of B into the position of each 1 in A):

HX = [ H ⊗ IL | IL−1 ⊗ Hᵀ ] · HZ = [ IL ⊗ H | Hᵀ ⊗ IL−1 ]

HX = X 检查矩阵(每行一条 X 检查,每列一个量子比特);HZ = Z 检查矩阵;H = 重复码校验矩阵;Im = m×m 单位矩阵;⊗ = 张量积;ᵀ = 转置;竖线左边作用于比特×比特块,右边作用于检查×检查块。HX = the X check matrix (one row per X-check, one column per qubit); HZ = the Z check matrix; H = the repetition parity matrix; Im = the m×m identity; ⊗ = tensor product; ᵀ = transpose; left of the bar acts on the bit×bit block, right of it on the check×check block.

CSS 码要求每条 X 检查与每条 Z 检查对易,即重叠格数为偶数;写成矩阵就是 HXHZᵀ = 0(模 2)。要算这个乘积,需要张量积的三条规则(A、B、C、D 是任意矩阵):

A CSS code needs every X-check to commute with every Z-check, i.e. an even number of overlapping cells; in matrix form, HXHZᵀ = 0 (mod 2). Computing this product takes three rules of the tensor product (A, B, C, D are any matrices):

  1. 尺寸:A 是 p×q、B 是 r×s,则 A⊗B 是 pr × qs(p×q 个格子,每格放一份 r×s 的 B,乘上 A 在该格的数)。
  2. 转置:(A⊗B)ᵀ = Aᵀ⊗Bᵀ(块的位置互换,每块自己也转置)。
  3. 混合乘积:(A⊗B)(C⊗D) = (AC)⊗(BD),只要 AC 与 BD 本身能乘(A 的列数 = C 的行数,B 的列数 = D 的行数)。理由:乘积的第 (r,t) 块 = Σu (aruB)(cutD) = (Σu arucut)·BD = (AC)rt·BD。
  1. Size: if A is p×q and B is r×s, then A⊗B is pr × qs (p×q cells, each holding a copy of the r×s matrix B times A's entry in that cell).
  2. Transpose: (A⊗B)ᵀ = Aᵀ⊗Bᵀ (the blocks swap places and each block is transposed).
  3. Mixed product: (A⊗B)(C⊗D) = (AC)⊗(BD), provided AC and BD are defined (columns of A = rows of C, columns of B = rows of D). Reason: block (r,t) of the product is Σu (aruB)(cutD) = (Σu arucut)·BD = (AC)rt·BD.

第一块:(H⊗IL)(IL⊗H)ᵀ = (H⊗IL)(IL⊗Hᵀ) = (H·IL)⊗(IL·Hᵀ) = H⊗Hᵀ。尺寸对得上:H 是 (L−1)×L、IL 是 L×L,可乘;IL 是 L×L、Hᵀ 是 L×(L−1),可乘。结果是 (L−1)L × L(L−1) 的方阵,每个元素对应一对(X 检查, Z 检查);L=3 时是 6×6。第二块同理:(IL−1⊗Hᵀ)(Hᵀ⊗IL−1)ᵀ = (IL−1⊗Hᵀ)(H⊗IL−1) = (IL−1·H)⊗(Hᵀ·IL−1) = H⊗Hᵀ。汇总成一行:

Block one: (H⊗IL)(IL⊗H)ᵀ = (H⊗IL)(IL⊗Hᵀ) = (H·IL)⊗(IL·Hᵀ) = H⊗Hᵀ. The sizes fit: H is (L−1)×L and IL is L×L, so they multiply; IL is L×L and Hᵀ is L×(L−1), so they multiply. The result is an (L−1)L × L(L−1) square matrix with one entry per (X-check, Z-check) pair; at L=3 it is 6×6. Block two works the same way: (IL−1⊗Hᵀ)(Hᵀ⊗IL−1)ᵀ = (IL−1⊗Hᵀ)(H⊗IL−1) = (IL−1·H)⊗(Hᵀ·IL−1) = H⊗Hᵀ. In one line:

(H⊗I)(I⊗H)ᵀ = H⊗Hᵀ · (I⊗Hᵀ)(Hᵀ⊗I)ᵀ = H⊗Hᵀ ⇒ HXHZᵀ = 2·(H⊗Hᵀ) = 0 (mod 2)

H、I、⊗、ᵀ 同上;HXHZᵀ 的第 (i,j) 个元素 = X 检查 i 与 Z 检查 j 重叠的格数;「= 0 (mod 2)」= 每对检查的重叠都是偶数,即全部对易。H, I, ⊗, ᵀ as above; entry (i,j) of HXHZᵀ = the number of cells where X-check i and Z-check j overlap; “= 0 (mod 2)” = every overlap is even, i.e. all pairs commute.

用 L=3 算一个元素。H⊗I3 的行按(H 的行 i, I3 的行 j)排成第 3i+j 行,所以 X1 = (i=0, j=1);I3⊗H 的行按(k, l)排成第 2k+l 行,所以 Z2 = (k=1, l=0)。H⊗Hᵀ 在这一格的值是 H[i,k]·Hᵀ[j,l] = H[0,1]·H[0,1] = 1·1 = 1(H 的第 0 行是 1 1 0)。对照下面的表:比特×比特块里 X1 = {q1, q4}、Z2 = {q3, q4},共享 q4,一格;检查×检查块里 X1 = {q9, q10}、Z2 = {q9, q11},共享 q9,又一格。两块各 1,合计 2,偶数。

Compute one entry at L=3. The rows of H⊗I3 are ordered by (row i of H, row j of I3) as row 3i+j, so X1 = (i=0, j=1); the rows of I3⊗H are ordered by (k, l) as row 2k+l, so Z2 = (k=1, l=0). H⊗Hᵀ has the value H[i,k]·Hᵀ[j,l] = H[0,1]·H[0,1] = 1·1 = 1 there (row 0 of H is 1 1 0). Compare the tables below: in the bit×bit block X1 = {q1, q4} and Z2 = {q3, q4} share q4, one cell; in the check×check block X1 = {q9, q10} and Z2 = {q9, q11} share q9, one more. One from each block, 2 in total, even.

两项相同,相加为零。所以第二块不是装饰:它提供了对易缺陷的第二份拷贝,让缺陷成对相消。在整数意义下(先不取模),HXHZᵀ 的每个元素只能是 0 或 2,reproduce.py 对 L=3,4,5 都断言了这一点。L=3 时,构造器给出的两张矩阵是(竖线左边 9 列对应 q0…q8,右边 4 列对应 q9…q12):

The two terms are identical, so they sum to zero. Block two is therefore not decorative: it supplies the second copy of the would-be commutation defect, so the defects cancel in pairs. Over the integers (before reducing), every entry of HXHZᵀ is 0 or 2; reproduce.py asserts this for L=3,4,5. At L=3 the constructor gives (the 9 columns left of the bar are q0…q8, the 4 on the right are q9…q12):

HXq0q1q2q3q4q5q6q7q8q9q10q11q12
X01001000001000
X10100100001100
X20010010000100
X30001001000010
X40000100100011
X50000010010001
HZq0q1q2q3q4q5q6q7q8q9q10q11q12
Z01100000001000
Z10110000000100
Z20001100001010
Z30000110000101
Z40000001100010
Z50000000110001

行 = 检查(上表 X0–X5 是 HX 的行,下表 Z0–Z5 是 HZ 的行);列 = 量子比特(竖线左 q0–q8 为比特×比特块,右 q9–q12 为检查×检查块);1 = 该检查作用于该比特。Rows = checks (upper table: X0–X5, the rows of HX; lower table: Z0–Z5, the rows of HZ); columns = qubits (left of the bar q0–q8, the bit×bit block; right q9–q12, the check×check block); a 1 = this check acts on this qubit.

动手核对一次:X1 的支撑是 {q1, q4, q9, q10},Z2 的支撑是 {q3, q4, q9, q11},重叠 {q4, q9} 两格,偶数,对易。X0 = {q0, q3, q9} 与 Z0 = {q0, q1, q9} 重叠也是两格。每行的 1 的个数只有 3 或 4,这将在下一节得到几何解释。

Check one by hand: X1 has support {q1, q4, q9, q10}, Z2 has {q3, q4, q9, q11}, overlapping in {q4, q9}, two cells, even, so they commute. X0 = {q0, q3, q9} and Z0 = {q0, q1, q9} also overlap in two. Every row has 3 or 4 ones, which the next section explains geometrically.

1.3为什么每条检查只连邻居Why every check touches only neighbours

矩阵没有几何;几何来自构造器给每个下标分配的坐标。比特×比特块的比特 (a,b) 放在 (2b, 2a);检查×检查块的比特 (a,b) 放在 (2b+1, 2a+1);X 检查 (a,b) 放在 (2b, 2a+1);Z 检查 (a,b) 放在 (2b+1, 2a)。这样每条检查行里的每个 1 都连到曼哈顿距离两点在格点上的距离 |Δx| + |Δy|,只沿横竖方向走。恰为 1 的位置。内部检查有四个邻居;到了左右或上下边缘,一个邻居不存在,检查降为三腿。reproduce.py 对每个发布尺寸的每一行都核对了「距离集合 = {1}」,不只对画出来的 L=3。

A matrix has no geometry; the geometry comes from the coordinates the constructor assigns to each index. A bit×bit qubit (a,b) sits at (2b, 2a); a check×check qubit (a,b) at (2b+1, 2a+1); an X-check (a,b) at (2b, 2a+1); a Z-check (a,b) at (2b+1, 2a). Then every 1 in a check row joins a site at Manhattan distanceThe distance |Δx| + |Δy| between two lattice points, walking only horizontally and vertically. exactly one. Interior checks have four neighbours; at a left/right or top/bottom edge one neighbour is missing and the check drops to three legs. reproduce.py checks “distance set = {1}” for every row of every shipped size, not only the drawn L=3.

q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 X0 X1 X2 X3 X4 X5 Z0 Z1 Z2 Z3 Z4 Z5 y=0 y=1 y=2 y=3 y=4 x=0 x=1 x=2 x=3 x=4 比特×比特块 q0–q8(L²=9)bit×bit block q0–q8 (L²=9) 检查×检查块 q9–q12((L−1)²=4)check×check block q9–q12 ((L−1)²=4) X 检查 X0–X5(H_X 的六行)X-checks X0–X5 (rows of H_X) Z 检查 Z0–Z5(H_Z 的行)Z-checks Z0–Z5 (rows of H_Z) 每条线 = 矩阵里的一个 1,each line = one 1 in the matrix, 曼哈顿距离恰为 1Manhattan distance exactly 1 y=0, y=4:三腿 Z 检查(毛边界)y=0, y=4: three-leg Z-checks (rough) x=0, x=4:三腿 X 检查(光边界)x=0, x=4: three-leg X-checks (smooth)
图 1.1 L=3 的交错格点。实心点是比特×比特块 q0–q8,空心点是检查×检查块 q9–q12;橙方块是 X 检查(HX 的六行),蓝方块是 Z 检查(HZ 的六行)。每条线对应矩阵里的一个 1。你可以逐行核对 1.2 节的矩阵:X1 位于 (2,1),连 q1 (2,0)、q4 (2,2)、q9 (1,1)、q10 (3,1)。 The L=3 interleaved lattice. Filled dots are the bit×bit block q0–q8, hollow dots the check×check block q9–q12; amber squares are X-checks (the six rows of HX), blue squares Z-checks (the six rows of HZ). Each line is one 1 in the matrix. Check §1.2's matrices row by row: X1 sits at (2,1) and joins q1 (2,0), q4 (2,2), q9 (1,1), q10 (3,1).
方向约定Orientation convention

在 QEC-Bank 的坐标里,三腿 Z 检查在上下两边(y=0 与 y=4),三腿 X 检查在左右两边(x=0 与 x=4)。按直觉教程对边界的定义,Z 检查缺腿的边是毛边界、X 检查缺腿的边是光边界,所以这里毛边界在上下、光边界在左右——与直觉教程的图恰好转了 90°。读坐标时请以「哪种检查缺腿」为准,不要以「左右/上下」为准。

In the QEC-Bank coordinates the three-leg Z-checks lie on the top and bottom edges (y=0 and y=4) and the three-leg X-checks on the left and right (x=0 and x=4). By the intuition guide's definition of the boundaries, the edge where Z-checks lose a leg is rough and where X-checks lose a leg is smooth, so here rough is top/bottom and smooth is left/right — rotated 90° relative to the intuition guide's pictures. Read coordinates by “which check is truncated”, not by “left/right versus top/bottom”.

1.4为什么 k = 1Why k = 1

每张量子检查矩阵有 L(L−1) 行。它们独立吗?用 1.1 节证 H 行独立的同一招,逐列推进。看 HX 的比特×比特块:X 检查 (a,b) 在这一块里只碰 (a,b) 与 (a+1,b) 两个比特。取 a = 0 的那些比特 (0,b):每个只被 X 检查 (0,b) 碰到,所以任何「加起来为零」的行组合都不含 a = 0 的检查;去掉它们后,比特 (1,b) 只剩 X 检查 (1,b) 碰得到,于是它们也不在;一路推到 a = L−2。所以 HX 的 L(L−1) 行全部独立,HZ 换成沿 b 方向推进,同理。L = 3 时可以在 1.2 节的表里直接看:q0、q1、q2 三列各自只在 X0、X1、X2 有 1,去掉这三行后 q3、q4、q5 三列各自只在 X3、X4、X5 有 1。于是:

Each quantum check matrix has L(L−1) rows. Are they independent? Use the same trick that proved H's rows independent in §1.1, advancing column by column. Look at the bit×bit block of HX: within it, X check (a,b) touches only the qubits (a,b) and (a+1,b). Take the qubits (0,b) with a = 0: each is touched only by X check (0,b), so no combination of rows adding up to zero contains a check with a = 0; with those gone, qubit (1,b) can only be touched by X check (1,b), so those are out too; continue up to a = L−2. So all L(L−1) rows of HX are independent, and HZ likewise, advancing along b. For L = 3 you can see it in the tables of §1.2: columns q0, q1, q2 have their only 1 in X0, X1, X2, and once those rows are removed, columns q3, q4, q5 have their only 1 in X3, X4, X5. Hence:

rank(HX) = rank(HZ) = L(L−1)(等于行数) (the row count) ⇒ k = [L² + (L−1)²] − 2L(L−1) = 1

HX, HZ = 两张量子检查矩阵;rank = 独立行数 = 独立检查数;L = 家族变量;L² + (L−1)² = n = 物理比特数;k = 逻辑比特数 = n − 独立检查总数。HX, HZ = the two quantum check matrices; rank = independent rows = independent checks; L = the family variable; L² + (L−1)² = n = physical qubits; k = logical qubits = n − total independent checks.

所以每一行都独立,没有一条白送的恒等式,与直觉教程「平面上没有恒等式」的论证一致。同一个结果还能从 HGP 的维数公式直接读出,这个写法把 1.1 节那个 0 的意义说得最清楚:

So every row is independent, no identity comes free, matching the intuition guide's “no identities on a plane” argument. The same result also reads off the HGP dimension formula, which makes the meaning of §1.1's 0 clearest:

kQ = k₁k₂ + k₁ᵀk₂ᵀ = 1·1 + 0·0 = 1 (ki = dim ker Hi,kiᵀ = dim ker Hiᵀ) · 闭链closed chains: 1·1 + 1·1 = 2 = 环面码toric code

kQ = 量子码的逻辑比特数;ki = dim ker Hi = 第 i 条经典码的维数(这里 k₁ = k₂ = 1);kiᵀ = dim ker Hiᵀ(开链为 0,闭链为 1)。kQ = the quantum code's logical qubit count; ki = dim ker Hi = the dimension of classical code i (here k₁ = k₂ = 1); kiᵀ = dim ker Hiᵀ (0 for an open chain, 1 for a closed one).

把两条开链都闭合成 L 条边的圈,转置核从 0 变成 1,公式给 2——正是环面码存 2 个逻辑比特的账。平面与环面之间只差这一个数字。下面的沙盘就是 L=3 的这块贴片(13 个比特、12 条检查):点击比特放错误,观察哪些检查报警,并对照图 1.1 的坐标。注意沙盘沿用直觉教程的画法(比特画在边上,毛边界在左右),与图 1.1 的坐标差 90°:沙盘的一行横边对应图 1.1 的一列实心点。

Close both open chains into L-edge cycles: the transpose kernel goes from 0 to 1 and the formula gives 2 — exactly the ledger of the toric code's two logical qubits. Plane and torus differ by that one digit. The sandbox below is this very L=3 patch (13 qubits, 12 checks): click qubits to place errors, watch which checks fire, and compare with the coordinates of Fig. 1.1. Note that the sandbox keeps the intuition guide's drawing (qubits on edges, rough boundaries left and right), turned 90° from Fig. 1.1: one row of horizontal edges in the sandbox corresponds to one column of filled dots in Fig. 1.1.

关键想法Key idea

表面码 = 两份「开链的奇偶矩阵」的超图乘积。开链的转置核为零,所以乘出来恰好 1 个逻辑比特;两块比特让对易缺陷成对相消;坐标分配让每个 1 都只连到距离 1 的邻居。三件事都是矩阵陈述,都被 reproduce.py 对 L=3,4,5 断言为 verified。

Surface code = the hypergraph product of two copies of “the parity matrix of an open chain”. The open chain's transpose kernel is zero, so the product stores exactly 1 logical qubit; the two qubit blocks make the commutation defects cancel in pairs; the coordinate assignment joins every 1 only to a neighbour at distance 1. All three are matrix statements, asserted by reproduce.py for L=3,4,5 as verified.

第 2 章Chapter 2

码距恰好是 L:一条串、L 条切口、一次枚举The distance is exactly L: one string, L cuts, one enumeration

「最短横跨串走 L 条边」是一张图,不是一个证明:它只说明码距不超过 L。真正的定理有两半。本章先给上界,再用 L 条互不相交的等价代表元证下界,最后看机器对 L=3、4 枚举、对 L=5 只敢说 bounded。 “The shortest spanning string uses L edges” is a picture, not a proof: it only shows the distance is at most L. The real theorem has two halves. This chapter gives the upper bound first, then proves the lower bound with L pairwise-disjoint equivalent representatives, and finally watches the machine enumerate L=3, 4 and say only “bounded” at L=5.

定理Theorem

对 L ≥ 2 的 HGP(repL, repL),每个非平凡的逻辑 Pauli 算符的重量weight,记 wt(P):算符 P 非平凡作用(X、Y 或 Z)的量子比特个数。至少为 L,且存在重量为 L 的 X 逻辑与 Z 逻辑。即 d = L。

For HGP(repL, repL) with L ≥ 2, every nontrivial logical Pauli has weightwt(P): the number of qubits on which the operator P acts as X, Y or Z rather than the identity. at least L, and weight-L X and Z logicals exist. That is, d = L.

2.1上界:一行 X 与一列 ZUpper bound: one X row and one Z column

给比特×比特块编号 (a,b),0 ≤ a,b < L。固定 a,在全部 (a,b) 上放 X,得一条横穿的「X 行」(图 1.1 里就是同一条 y=2a 水平线上的实心点)。每条 Z 检查位于 (2b'+1, 2a'),只有 a'=a 时才碰到这一行,而且恰碰两个比特 (a,b') 与 (a,b'+1)——0 或 2 次,永远对易。固定 b,在全部 (a,b) 上放 Z,得一条竖穿的「Z 列」,同理与每条 X 检查相遇 0 或 2 次。

Index the bit×bit block by (a,b), 0 ≤ a,b < L. Fix a and put X on every (a,b): a horizontal “X row” (in Fig. 1.1, the filled dots on one line y=2a). A Z-check at (2b'+1, 2a') meets this row only when a'=a, and then in exactly two qubits (a,b') and (a,b'+1) — zero or two times, always commuting. Fix b and put Z on every (a,b): a vertical “Z column”, likewise meeting every X-check zero or two times.

一行与一列恰好相交一次(在 (a,b)),所以按碰撞规则两者反对易。与某个通过全部检查的算符反对易的东西,不可能是稳定子(稳定子与一切通过检查的算符对易);反过来亦然。所以两条串都不是稳定子,都是逻辑算符,重量都是 L。于是 d ≤ L。

A row and a column intersect exactly once (at (a,b)), so by the collision rule they anticommute. Anything anticommuting with an operator that passes every check cannot be a stabilizer (stabilizers commute with everything that passes the checks), and vice versa. So neither string is a stabilizer; both are logicals of weight L. Hence d ≤ L.

XL = X-行-row {(a,b): b = 0…L−1} · ZL = Z-列-column {(a,b): a = 0…L−1} · |行∩列row∩column| = 1 ⇒ 反对易anticommute · wt = L ⇒ d ≤ L

XL / ZL = 逻辑 X / 逻辑 Z;(a,b) = 比特×比特块的行、列下标;|·| = 集合的元素个数;wt = 重量(非平凡作用的比特数);d = 码距;L = 家族变量。XL / ZL = logical X / logical Z; (a,b) = row and column index in the bit×bit block; |·| = number of elements of a set; wt = weight (qubits on which the operator is not the identity); d = distance; L = the family variable.

2.2L 条互不相交的等价代表元L pairwise-disjoint equivalent representatives

共有 L 条 X 行(a = 0…L−1)与 L 条 Z 列。它们代表同一个逻辑算符吗?看相邻两行 a 与 a+1 之间的那条「带」:X 检查 (a, b') 位于 (2b', 2a+1),b' = 0…L−1,各连着上下两个比特×比特比特 (a,b')、(a+1,b') 和左右两个检查×检查比特。把带里全部 L 条 X 检查乘起来:每个检查×检查比特 (a,b'') 被左右两条检查各碰一次,成对抵消;剩下的恰好是整条第 a 行加整条第 a+1 行。所以「行 a」×「行 a+1」= 稳定子,两行等价。逐带推进,全部 L 条 X 行都在同一个逻辑类里。对 Z 列,用 Z 检查组成的竖直带做同样的事。

There are L X-rows (a = 0…L−1) and L Z-columns. Do they represent the same logical? Look at the “strip” between adjacent rows a and a+1: the X-checks (a, b') at (2b', 2a+1), b' = 0…L−1, each join the two bit×bit qubits (a,b'), (a+1,b') above and below and the check×check qubits to their left and right. Multiply all L X-checks in the strip: every check×check qubit (a,b'') is touched once by the check on its left and once by the one on its right, cancelling in pairs; what remains is exactly row a plus row a+1. So “row a” × “row a+1” = a stabilizer, and the two rows are equivalent. Strip by strip, all L X-rows lie in one logical class. For Z-columns, do the same with vertical strips of Z-checks.

∏b' X-check(a,b') = X-行-row(a) · X-行-row(a+1) ⇒ 全部 L 行等价all L rows equivalent · 同一族内支撑两两不交supports within a family pairwise disjoint

∏ = 连乘;X-check(a,b') = 位于 (2b', 2a+1) 的 X 检查;X-行(a) = 第 a 行全部比特×比特比特上的 X;L = 行数。∏ = product; X-check(a,b') = the X-check at (2b', 2a+1); X-row(a) = X on every bit×bit qubit of row a; L = number of rows.

同时,同一族内各条代表元的支撑两两不相交:行 a 与行 a' 没有公共比特。这两点合起来(等价 + 不交)就是下界的全部弹药;图 2.1 把两者在 L=3 上画了出来。

At the same time, the representatives within one family have pairwise disjoint supports: row a and row a' share no qubit. These two facts together (equivalent + disjoint) are all the ammunition the lower bound needs; Figure 2.1 draws both at L=3.

(a) 一条带:X0·X1·X2 = 行 0 · 行 1(a) One strip: X0·X1·X2 = row 0 · row 1 X 行 a=0X row a=0 X 行 a=1X row a=1 X0 X1 X2 X3 X4 X5 q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 ×2 q10 ×2 q11 q12 X0、X1、X2(y=1 的实心橙方块)连乘:Multiply X0, X1, X2 (solid amber, y=1): q9、q10 各被碰两次,X·X = I,抵消(×);q9 and q10 are hit twice, X·X = I, cancel (×); 剩下 q0–q5 = 行 0 与行 1 → 两行等价left: q0–q5 = row 0 and row 1 → equivalent (b) L=3 条互不相交的 Z 列(b) L=3 disjoint Z columns Z 列 b=0Z col b=0 Z 列 b=1Z col b=1 Z 列 b=2Z col b=2 q0 q1 q2 q3 q4 q5 q6 q7 q8 三列:{q0,q3,q6} {q1,q4,q7} {q2,q5,q8},Columns: {q0,q3,q6} {q1,q4,q7} {q2,q5,q8}, 两两无公共比特。与 ZL 反对易的 Pno shared qubit. A P anticommuting with 必须在每列放一个 X 或 Y → 至少 3 比特。ZL needs an X or Y in every column 橙圈:P = X 行 a=1 的例子,→ at least 3 qubits. Rings: P = X row 每列恰碰一次,重量 3 = La=1, one per column, weight 3 = L
图 2.1 L=3 时 2.2 与 2.3 节的两个事实,坐标与图 1.1 相同(实心点 = 比特×比特块,空心点 = 检查×检查块,橙方块 = X 检查,蓝方块 = Z 检查)。(a) 带 a=0 位于 y=1,里面是 X0、X1、X2。三条检查连乘时,q9 被 X0 与 X1 各碰一次,q10 被 X1 与 X2 各碰一次,X·X = I,所以它们消失;剩下的 q0–q5 恰是行 0 与行 1(橙色底纹)。于是行 0 · 行 1 是稳定子,两行代表同一个逻辑 X。(b) 三条 Z 列(蓝色虚线框)两两没有公共比特,而且都代表 ZL。一个与 ZL 反对易的算符 P 与每一条列都反对易,所以每条列里都得有它的一个 X 或 Y;三条列不重叠,P 至少占 3 个比特。橙圈是 P = X 行 a=1 的例子,恰好每列一个。 The two facts of §2.2 and §2.3 at L=3, in the coordinates of Figure 1.1 (filled dots = bit×bit block, hollow dots = check×check block, amber squares = X-checks, blue squares = Z-checks). (a) Strip a=0 sits at y=1 and holds X0, X1, X2. When the three checks are multiplied, q9 is hit once by X0 and once by X1, q10 once by X1 and once by X2; X·X = I, so both drop out, and what is left, q0–q5, is exactly row 0 plus row 1 (amber shading). So row 0 · row 1 is a stabilizer, and the two rows represent the same logical X. (b) The three Z columns (blue dashed boxes) share no qubit, and each represents ZL. An operator P that anticommutes with ZL anticommutes with every column, so each column must contain one of its X or Y factors; the columns do not overlap, so P occupies at least 3 qubits. The rings show the example P = X row a=1, exactly one per column.

2.3下界:每条切口都得碰到Lower bound: every cut must be met

因为 k = 1,每个非平凡逻辑类都能写成 XLaZLb,其中指数 a、b 各取 0 或 1(「用不用这个生成元」的开关位,与 2.1 节的坐标下标 (a,b) 无关),且 (a,b) ≠ (0,0):三种取法给出 XL、ZL、YL = XLZL。设 P 是任意一个非平凡逻辑算符。它至少与 XL、ZL 之一反对易(若两者都对易,它就与全部逻辑算符对易,只能是稳定子,平凡)。

Since k = 1, every nontrivial logical class is XLaZLb, where the exponents a, b are bits, each 0 or 1 (an on/off switch for that generator, unrelated to the coordinate indices (a,b) of §2.1), with (a,b) ≠ (0,0): the three choices give XL, ZL, YL = XLZL. Let P be any nontrivial logical. It anticommutes with at least one of XL, ZL (commuting with both would mean commuting with every logical, hence a stabilizer, hence trivial).

设 P 与 Z 类反对易。关键一步:与类反对易 = 与类中每个代表元反对易,因为给一个代表元乘上稳定子,不会改变它与逻辑算符的对易性(稳定子与 P 对易)。于是 P 与全部 L 条 Z 列都反对易(图 2.1b)。要与一条纯 Z 的列反对易,P 必须在这条列上某处有 X 或 Y 支撑。L 条列互不相交,所以 P 至少在 L 个不同的比特上非平凡:wt(P) ≥ L。若 P 与 X 类反对易,换成 L 条不相交的 X 行,同理。

Suppose P anticommutes with the Z class. The key step: anticommuting with a class = anticommuting with every representative of it, because multiplying a representative by a stabilizer cannot change its commutator with a logical (stabilizers commute with P). So P anticommutes with all L Z-columns (Figure 2.1b). To anticommute with a pure-Z column, P must have X or Y support somewhere on that column. The L columns are disjoint, so P is nontrivial on at least L distinct qubits: wt(P) ≥ L. If instead P anticommutes with the X class, use the L disjoint X-rows, and the same argument runs.

每个非平凡逻辑 P 与 XL 或 ZL 反对易every nontrivial logical P anticommutes with XL or ZL ⇒ 与 L 条不交代表元都反对易anticommutes with L disjoint representatives ⇒ wt(P) ≥ L · 合上界with the upper bound: d = L ∎

P = 任意非平凡逻辑算符;XL, ZL = 逻辑 X、Z;wt(P) = P 的重量;d = 码距;L = 家族变量;∎ = 证毕。P = any nontrivial logical operator; XL, ZL = logical X, Z; wt(P) = the weight of P; d = distance; L = the family variable; ∎ = end of proof.

这个论证的「学名」:有限贴片版的收缩系论证The argument's formal name: a finite-patch systolic argument

L 条不相交的代表元构成 L 道彼此独立的「切口」,任何与该类共轭的算符都必须穿过每一道。在拓扑码的语言里,这是「同调类的最短代表元长度」(收缩系,systole)的有限版本:不用画图、不靠小尺寸枚举,只用等价性与不相交性两个可机器核对的事实。reproduce.py 恰好断言了这两个事实(对 L=3,4,5)。

The L disjoint representatives form L independent “cuts”, and any operator conjugate to the class must cross every one. In the language of topological codes this is the finite version of “the shortest representative of a homology class” (the systole): no drawing, no small-size enumeration, only two machine-checkable facts, equivalence and disjointness. reproduce.py asserts precisely those two facts (for L=3,4,5).

到实验台上画一条:一条横跨的串通过全部检查就是逻辑算符;试着少画一格,看警报如何揭发它;再画两条平行的、试着用检查的乘积把一条变成另一条,体会「等价」。

Draw one on the bench: a spanning string that passes every check is a logical; stop one cell short and watch the alarms expose it; then draw two parallel ones and try turning one into the other with a product of checks, to feel “equivalence”.

2.4机器见证:L=3、4 枚举,L=5 只说 boundedMachine witnesses: enumerate L=3, 4; say only “bounded” at L=5

定理已经对所有 L 成立,为什么还要机器?因为 QEC-Bank 的证书不信任论证本身,只信任重跑。reproduce.py 在 L=3 断言:X 行都是逻辑、彼此等价、两两不交(True);Z 列同理;逻辑 X 支撑 [0, 1, 2](a=0 那一行,即 q0 q1 q2);逻辑 Z 支撑 [0, 3, 6](b=0 那一列,即 q0 q3 q6);精确码距 3,方法 exact-css-enum。L=4 的穷举 CSS 逻辑枚举返回 4。这两条在 instances.yaml 里是 verified。

The theorem already holds for every L, so why a machine? Because QEC-Bank certificates trust reruns, not arguments. At L=3, reproduce.py asserts: the X-rows are logical, mutually equivalent and pairwise disjoint (True); likewise the Z-columns; logical X support [0, 1, 2] (the a=0 row, i.e. q0 q1 q2); logical Z support [0, 3, 6] (the b=0 column, i.e. q0 q3 q6); exact distance 3 by exact-css-enum. At L=4, exhaustive CSS logical enumeration returns 4. Both are verified in instances.yaml.

L=5 时穷举不在验证器里。下界 d ≥ 5 来自上面的定理与 dennis2002topological(Dennis, Kitaev, Landahl, Preskill, “Topological quantum memory”, 2002);上界来自一次确定性的低重量搜索,method=rand-lowweight-v1, seed=0, iters=2000,找到了一个重量 5 的逻辑算符。所以条目写的是 lower 5、upper 5、origin: bounded。「bounded」这个词是刻意的:定理给下界,验证器能重跑上界见证,但流水线不称这个结果为穷举。

At L=5, exhaustive enumeration is not part of the verifier. The lower bound d ≥ 5 comes from the theorem above and dennis2002topological (Dennis, Kitaev, Landahl, Preskill, “Topological quantum memory”, 2002); the upper bound from a deterministic low-weight search, method=rand-lowweight-v1, seed=0, iters=2000, which finds a weight-5 logical. So the entry records lower 5, upper 5, origin: bounded. The word “bounded” is intentional: the theorem supplies the lower bound and the verifier reruns the upper-bound witness, but the pipeline does not call the result exhaustive.

Ln = 2L²−2L+1机器重算的 dMachine-recomputed d方法Method定理 / 文献的 dTheorem / literature dQEC-Bank 标签QEC-Bank label
3133exact-css-enumL = 3verified
4254exact-css-enumL = 4verified
5415 ≤ d ≤ 5(上界为见证)5 ≤ d ≤ 5 (upper is a witness)rand-lowweight-v1, seed 0, iters 2000L = 5(定理 + dennis2002topological)L = 5 (theorem + dennis2002topological)bounded
检查站Checkpoint第 2 章Chapter 2
有人在 L=7 的贴片上画出一条重量 7 的横跨 X 串,并宣称「所以 d = 7」。这张图证明了什么?Someone draws a weight-7 spanning X string on an L=7 patch and declares “so d = 7”. What does the picture prove?

对。一条串给上界;下界要的是 2.2 与 2.3 节的「等价 + 不交」论证:任何非平凡逻辑都得碰到每一条切口。这也是为什么 QEC-Bank 对 L=5 只写 bounded:机器重跑了上界见证,下界靠定理,两者恰好相等却不算穷举。

Right. One string gives the upper bound; the lower bound needs §2.2–2.3's “equivalent + disjoint” argument: every nontrivial logical must meet every cut. This is also why the QEC-Bank writes only bounded at L=5: the machine reruns an upper-bound witness, the lower bound rests on the theorem, and the two coincide without counting as exhaustive.

一条通过全部检查、重量为 7 的逻辑算符,说明「存在重量 7 的逻辑算符」。这是关于 d 的哪一侧的信息?更轻的逻辑算符被排除了吗?

A weight-7 logical that passes every check shows “a weight-7 logical exists”. Which side of d does that inform? Has a lighter logical been ruled out?

第 3 章Chapter 3

症状是错误链的边界The syndrome is the boundary of an error chain

一句话解释缺陷对、边界节点、配对与逻辑失败:报警的检查 = 错误链的边界。本章先把这句话写成矩阵乘法,再用 L=3 的矩阵逐步算出一条错误从光边界进入、穿过贴片、消失在对面的完整走位,最后说清译码器到底在决定什么。 One sentence explains defect pairs, boundary nodes, matching and logical failure: the fired checks = the boundary of the error chain. This chapter writes that sentence as a matrix product, then uses the L=3 matrices to compute step by step a full walk of an error entering at a smooth boundary, crossing the patch and vanishing on the far side, and finally states what a decoder is actually deciding.

3.1代数:s = H·eAlgebra: s = H·e

把一个 X 错误的支撑写成 0/1 向量 eX(长 n,出错的比特处为 1)。报警的 Z 检查就是向量 HZeX(模 2):第 j 个分量是「Z 检查 j 的支撑与错误支撑重叠的格数」的奇偶,正是碰撞规则。沿着一条链,每个内部检查被两段相邻的错误各碰一次,模 2 抵消,只有端点留下来。这就是∂E(读「E 的边界」,一条链的端点集合):

Write the support of an X error as a 0/1 vector eX (length n, a 1 on each faulty qubit). The fired Z-checks are the vector HZeX (mod 2): component j is the parity of “how many cells Z-check j's support overlaps the error's”, which is the collision rule. Along a chain, each interior check is touched once by each of two adjacent error segments, cancelling mod 2; only the endpoints remain. This is ∂E (read “the boundary of E”, the set of a chain's endpoints):

报警的 Z 检查fired Z-checks = HZeX · 报警的 X 检查fired X-checks = HXeZ · 症状syndrome s = ∂E (链的端点the chain's endpoints)

HZ, HX = Z / X 检查矩阵;eX, eZ = X / Z 错误的 0/1 支撑向量;s = 症状,报警检查的 0/1 向量;E = 错误链;∂ = 边界(端点集合)。HZ, HX = the Z / X check matrices; eX, eZ = 0/1 support vectors of the X / Z error; s = the syndrome, the 0/1 vector of fired checks; E = the error chain; ∂ = boundary (set of endpoints).

在凝聚边界condensing boundary:能让某一类错误链的端点无声消失的边界。X 链在光边界(三腿 X 检查所在边)凝聚,Z 链在毛边界凝聚。上,链可以终止而没有第二个物理检查报警——这就是直觉教程「边界吃掉警报」的代数版本。在译码器的图里,这件事表示为把剩下的那个缺陷配到一个「边界节点」上。

At a condensing boundaryA boundary where the endpoint of one type of error chain vanishes silently. X-chains condense at the smooth boundary (where the three-leg X-checks sit), Z-chains at the rough boundary. a chain can end without a second physical check firing — the algebraic version of the intuition guide's “the boundary swallows the alarm”. In a decoder graph this is represented by pairing the leftover defect with a “boundary node”.

3.2算出来的 L=3 走位The computed L=3 walk

用 1.2 节的矩阵直接相乘。构造器把中央比特叫 q4,中间一行是 q3、q4、q5(图 1.1 里 y=2 那条线)。五次乘法给出五个症状:

Multiply with §1.2's matrices directly. The constructor calls the central qubit q4, and the middle row is q3, q4, q5 (the line y=2 in Fig. 1.1). Five products give five syndromes:

错误Error报警的 Z 检查(HZeX)Fired Z-checks (HZeX)报警的 X 检查(HXeZ)Fired X-checks (HXeZ)读法Reading
X 在on q4{Z2, Z3}—内部单个错误:一对缺陷,位于 (1,2) 与 (3,2)One bulk error: a defect pair at (1,2) and (3,2)
Z 在on q4—{X1, X4}对偶:同一比特的 Z 错误点亮上下两颗 X 检查 (2,1)、(2,3)The dual: a Z error on the same qubit lights the X-checks above and below, (2,1), (2,3)
X 在左侧on left q3{Z2}—贴着光边界:只有一个缺陷,另一端凝聚在 x=0 的边界Hugging the smooth boundary: a single defect, the other end condensed at the x=0 boundary
X 在on {q3, q4}{Z3}—链长 2:Z2 被碰两次而熄灭,缺陷向右走到 Z3Chain of length 2: Z2 is struck twice and goes dark; the defect walks right to Z3
X 在on {q3, q4, q5}无none—缺陷消失在 x=4 的光边界;零症状,但它不在 HX 的行空间里 → 逻辑 XThe defect vanishes at the x=4 smooth boundary; zero syndrome, yet not in the row space of HX → a logical X

核对第一行:q4 是第 4 列,在 HZ 里第 4 列为 1 的行是 Z2(000110000)与 Z3(000011000),正是 {Z2, Z3}。最后一行最重要:{q3, q4, q5} 是 2.4 节那条 a=1 的 X 行,「没有症状」不等于「没有错误」——它是一个逻辑 X,reproduce.py 用 _is_logical_x 断言它通过全部 Z 检查且不在 X 稳定子的行空间里。整个序列就是一个缺陷从光边界进入、走过贴片、消失在对面光边界的过程。

Verify the first row: q4 is column 4, and the rows of HZ with a 1 in column 4 are Z2 (000110000) and Z3 (000011000), exactly {Z2, Z3}. The last row matters most: {q3, q4, q5} is §2.4's a=1 X-row, and “no syndrome” is not “no error” — it is a logical X, which reproduce.py asserts with _is_logical_x: it passes every Z-check and is not in the row space of the X stabilizers. The whole sequence is one defect entering at a smooth boundary, walking across the patch, and disappearing at the opposite smooth boundary.

3.3译码器在决定什么What the decoder decides

给定症状 s,任何候选修复 C 都满足 ∂C = s。若真实错误是 E,则 ∂(E+C) = s + s = 0:E+C 是一个圈(相对于凝聚边界,允许端点落在边界上)。修复成功,当且仅当这个圈是稳定子的乘积;失败,当且仅当它落在非平凡的相对同调类relative homology class:把「差一个稳定子」的圈视为相同后剩下的类别。这里 k=1:单看 X 型(或 Z 型)的圈,只有两个类,平凡(稳定子的乘积)与非平凡(横跨串条数为奇,即 XL 或 ZL 乘稳定子);把两种类型合起来,逻辑 Pauli 共四类:I、XL、ZL 与乘积 YL = XLZL。里。怎么判断落在哪类?X 部分与 Z 部分分开数。E⊕C 的 X 部分通过全部 Z 检查;k=1 时这样的 X 型算符只有两种:X 稳定子(与每条 Z 列重叠偶数格,因为稳定子与 ZL 对易),或 X 稳定子乘 XL(重叠奇数格)。所以只要数它与任意一条 Z 列(2.1 节的 ZL)重叠几格:偶数则 X 部分无害,奇数则留下一个逻辑 X 错误。Z 部分同理,数它与一条 X 行的重叠。在图上,这个奇偶就是 E⊕C 里横跨串条数的奇偶:一条横跨串是逻辑算符,两条平行的横跨串合起来是一条带里检查的乘积(图 2.1a),无害。判据是「奇数条」,不是「出现了横跨串」。图 3.1 用同一个症状的两种修复把这件事算了一遍;直觉教程的译码游戏用的也是这个判据。

Given a syndrome s, every candidate correction C satisfies ∂C = s. If the actual error is E, then ∂(E+C) = s + s = 0: E+C is a cycle (relative to the condensing boundaries, so endpoints may rest on them). Recovery succeeds exactly when that cycle is a product of stabilizers, and fails exactly when it lies in a nontrivial relative homology classThe classes left after identifying cycles that differ by a stabilizer. Here k=1: looking at X-type (or Z-type) cycles alone there are just two classes, trivial (a product of stabilizers) and nontrivial (an odd number of spanning strings, i.e. XL or ZL times stabilizers); combining both types, the logical Paulis form four classes: I, XL, ZL and the product YL = XLZL.. Which class is it? Count the X part and the Z part separately. The X part of E⊕C passes every Z-check, and at k=1 such an X-type operator is one of two kinds: an X stabilizer (it overlaps every Z column in an even number of cells, because stabilizers commute with ZL), or an X stabilizer times XL (an odd number of cells). So count its overlap with any one Z column (§2.1's ZL): even means the X part is harmless, odd means a logical X error remains. The Z part works the same way, counting overlap with an X row. On the picture, this parity is the parity of the number of spanning strings in E⊕C: one spanning string is a logical, while two parallel spanning strings together are the product of the checks in one strip (Figure 2.1a) and do no harm. The criterion is “an odd number”, not “a spanning string is present”. Figure 3.1 works this out for two repairs of the same syndrome; the intuition guide's decoding game uses the same criterion.

∂C = s ⇒ ∂(E⊕C) = 0 · 成功success ⇔ E⊕C ∈ 稳定子stabilizers · 失败failure ⇔ X 部分与一条 Z 列、或 Z 部分与一条 X 行重叠奇数格the X part overlaps a Z column, or the Z part overlaps an X row, in an odd number of cells

s = 症状;C = 候选修复;E = 真实错误;∂ = 边界;⊕ = 模 2 合并(相同比特成对相消);∈ = 属于;奇数格 = 横跨串条数为奇。s = syndrome; C = candidate correction; E = the actual error; ∂ = boundary; ⊕ = merge mod 2 (shared qubits cancel in pairs); ∈ = belongs to; an odd overlap = an odd number of spanning strings.

(a) C₁ = X{q2}(a) C₁ = X{q2} Z 列 b=0Z col b=0 行 0row 0 Z1 报警Z1 alarm q0 q1 q2 q3 q4 q5 q6 q7 q8 E⊕C₁ = 行 0:1 条横跨串E⊕C₁ = row 0: 1 spanning string 与 Z 列 b=0 重叠 1 格(奇)overlaps Z col b=0 in 1 cell (odd) → 逻辑 X 错误,修复失败→ logical X error, repair fails (b) C₂ = X{q2,q3,q4,q5}(b) C₂ = X{q2,q3,q4,q5} Z 列 b=0Z col b=0 行 0row 0 行 1row 1 Z1 报警Z1 alarm q0 q1 q2 q3 q4 q5 q6 q7 q8 E⊕C₂ = 行 0 · 行 1:2 条横跨串E⊕C₂ = row 0 · row 1: 2 strings 与 Z 列 b=0 重叠 2 格(偶)overlaps Z col b=0 in 2 cells (even) = X0·X1·X2(图 2.1a)→ 成功= X0·X1·X2 (Fig. 2.1a) → success 真实错误 E = X{q0,q1}(两图相同)actual error E = X{q0,q1} (same in both) 修复 C(两者都只点亮 Z1)repair C (each lights only Z1)
图 3.1 L=3,坐标同图 1.1(实心点 = 比特×比特块,空心小点 = 检查×检查块,蓝方块 = Z 检查)。真实错误 E = X{q0, q1}(橙色实心)只点亮 Z1:q0 碰 Z0,q1 碰 Z0 与 Z1,Z0 被碰两次而熄灭。两种修复(橙色虚线圈)都只点亮 Z1,所以译码器单看症状分不出它们。(a) C₁ = X{q2}:E⊕C₁ = 行 0,一条横跨串,与 Z 列 b=0 重叠 1 格,奇数,结果是逻辑 X 错误。(b) C₂ = X{q2, q3, q4, q5}:E⊕C₂ = 行 0 · 行 1,两条横跨串,与 Z 列 b=0 重叠 2 格,偶数;它等于 X0·X1·X2,是稳定子,修复成功,尽管 C₂ 比 C₁ 重了三格。 L=3, coordinates as in Figure 1.1 (filled dots = bit×bit block, small hollow dots = check×check block, blue squares = Z-checks). The actual error E = X{q0, q1} (solid amber) lights only Z1: q0 hits Z0, q1 hits Z0 and Z1, and Z0, hit twice, stays dark. Both repairs (dashed amber rings) also light only Z1, so the syndrome alone cannot tell them apart. (a) C₁ = X{q2}: E⊕C₁ = row 0, one spanning string, overlapping Z column b=0 in 1 cell, odd, so a logical X error remains. (b) C₂ = X{q2, q3, q4, q5}: E⊕C₂ = row 0 · row 1, two spanning strings, overlapping Z column b=0 in 2 cells, even; it equals X0·X1·X2, a stabilizer, so the repair succeeds even though C₂ is three cells heavier than C₁.

于是「译码」不是猜出 E 本身,而是在类之间二选一。最小重量匹配挑代价最低的端点配对(一条最短链);最大似然译码则对每一类里所有链的概率求和。两者的差别叫路径退化,它能把匹配与最优两种码容量阈值分开——具体数字在第 5 章的账本里。译码器教程把这两种策略讲成了一门课:从症状到类、最优译码 = 押概率最大的类、最小重量完美匹配、退化:一类里有多少条链。

So “decoding” is not guessing E itself; it is choosing between classes. Minimum-weight matching picks the cheapest pairing of endpoints (one shortest chain); maximum-likelihood decoding instead sums the probabilities of all chains in each class. The difference is path degeneracy, and it can separate the matching and optimal code-capacity thresholds — the exact numbers live in Chapter 5's ledger. The decoders guide teaches both strategies as a course: from syndrome to class, optimal decoding = bet on the most probable class, minimum-weight perfect matching, degeneracy: how many chains in a class.

3.4重复测量:探测器、钩子、两种码距Repeated measurements: detectors, hooks, two distances

测量本身会错时,改用探测器detector:比较同一条检查在相邻两轮的读数,只有「变了」才算事件。数据错误产生空间上分离的一对事件,测量错误产生时间上分离的一对事件。:比较同一条检查在相继两轮的结果。数据错误造出空间上分离的事件对;测量错误造出时间上分离的事件对;电路传播还会造出相关的小图案。于是译码在一个 2+1 维的探测器图里进行——详见译码器教程假警报与只报「变化」的探测器和两种指纹,一张时空图。

When measurements themselves err, switch to detectorsA detector compares the same check's outcome in two consecutive rounds; only a “change” counts as an event. Data errors make spacelike-separated event pairs, measurement errors timelike-separated pairs.: compare the same check's outcome in successive rounds. Data faults create spacelike-separated event pairs; measurement faults create timelike-separated pairs; circuit propagation can create correlated small patterns. Decoding then happens in a 2+1-dimensional detector graph — see the decoders guide on false alarms and change-only detectors and two fingerprints, one spacetime graph.

两点诚实提醒。第一,不是每个物理故障都必须点亮探测器:太晚发生的故障与下一轮的故障观测等价,无害的 Pauli 会抵消,有些故障只影响被追踪的观测量。正确的不变量是:探测器错误模型列出每种故障机制的可观测「探测器/逻辑」签名。第二,辅助比特的故障:在一次四邻居检查测量中,一个辅助比特上的 Pauli 可以通过后续 CNOT 传播成两个数据比特上的钩子错误hook error:一个辅助比特故障经 CNOT 传播后落在两个数据比特上的相关错误。若它的方向与最短逻辑方向一致,电路码距会低于静态码距。。若调度顺序让钩子与最短逻辑方向对齐,电路码距会下降,即使静态检查矩阵的码距仍是 d。静态码距与故障码距是两个不同的主张,必须分别验证——本教程第 2 章证明的只是前者。

Two honest reminders. First, not every physical fault must light a detector: a late fault is observationally equivalent to one in the next round, a harmless Pauli can cancel, and some faults affect only a tracked observable. The correct invariant is that the detector error model lists the observable detector/logic signature of every fault mechanism. Second, ancilla faults: during a four-neighbour check measurement, one Pauli on the ancilla can propagate through later CNOTs into a hook errorA correlated error on two data qubits produced when one ancilla fault propagates through CNOTs. If its direction aligns with the shortest logical, the circuit distance falls below the static distance. on two data qubits. A schedule that aligns hooks with a shortest logical direction reduces the circuit distance even though the static check matrix still has distance d. Static-code distance and fault distance are different claims and must be verified separately — Chapter 2 of this tutorial proved only the former.

检查站Checkpoint第 3 章Chapter 3
L=3 贴片上,X 错误落在 {q3, q4, q5},所有检查都读 +1。这意味着什么?On the L=3 patch an X error lands on {q3, q4, q5} and every check reads +1. What does that mean?

对。{q3, q4, q5} 是 a=1 那条 X 行,是 2.1 节的上界串。零症状只说明 ∂E = 0(E 是圈);圈是稳定子还是逻辑,要看它在不在行空间里,reproduce.py 恰好断言了「不在」。

Right. {q3, q4, q5} is the a=1 X-row, §2.1's upper-bound string. A zero syndrome only says ∂E = 0 (E is a cycle); whether the cycle is a stabilizer or a logical depends on membership in the row space, and reproduce.py asserts precisely “not a member”.

回到 3.2 节表格的最后一行:零症状对应的是哪个集合?它与 2.4 节里「逻辑 X 支撑」的坐标是什么关系?

Return to the last row of §3.2's table: which set gives the zero syndrome? How does it relate to the “logical X support” of §2.4?

第 4 章Chapter 4

一排局域检查测出逻辑奇偶A row of local checks measures logical parity

格点手术的核心主张:光边界合并测的是 ZL⊗ZL,因为缝合线上新增的局域 Z 检查连乘之后望远镜式地缩成那个逻辑算符。本章在 L=3 的具体坐标上写出这个连乘,重算合并后的 n、k、d,并说明为什么要维持 d 轮。格点手术教程把它讲成了完整的一门课;这里只做推导。 Lattice surgery's central claim: a smooth merge measures ZL⊗ZL, because the new local Z-checks along the seam telescope, once multiplied, into that logical operator. This chapter writes the product out on concrete L=3 coordinates, recomputes the merged n, k, d, and explains why d rounds are needed. The lattice-surgery guide teaches it as a full course; here we only do the derivation.

4.1L=3 的几何The L=3 geometry

把两块未旋转的 L=3 贴片并排放置:贴片 A 占 x = 0…4,贴片 B 占 x = 6…10,中间缺的一列 x = 5 是缝合线。按 1.3 节的坐标,x=4 与 x=6 是两块贴片的光边界(三腿 X 检查所在)。加入两个水平方向的缝合数据比特 (5,1) 与 (5,3),制备在 |+⟩(X 值确定为 +1)。原来在边界上的三腿 X 星向缝合线延伸成四腿,其新增的 X 支撑落在 |+⟩ 的缝合比特上,贡献已知的 +1。然后测量三条新的 Z 面检查,中心在 (5,0)、(5,2)、(5,4):

Place two unrotated L=3 patches side by side: patch A occupies x = 0…4, patch B occupies x = 6…10, and the missing column x = 5 is the seam. In §1.3's coordinates, x=4 and x=6 are the two patches' smooth boundaries (where the three-leg X-checks sit). Add two horizontal seam data qubits at (5,1) and (5,3), prepared in |+⟩ (X value fixed at +1). The old boundary three-leg X-stars extend across the seam to four legs; their new X support lands on the |+⟩ seam qubits and contributes a known +1. Then measure three new Z-plaquettes centred at (5,0), (5,2), (5,4):

贴片 A(x = 0…4)patch A (x = 0…4) 贴片 B(x = 6…10)patch B (x = 6…10) 缝合线 x = 5seam x = 5 y=0 y=1 y=2 y=3 y=4 (5,1) (5,3) Z(4,0) Z(6,0) Z(4,2) Z(6,2) Z(4,4) Z(6,4)
图 4.1 两块 L=3 贴片与 x=5 的缝合线。品红点是制备在 |+⟩ 的缝合比特 (5,1)、(5,3);带品红边的三个蓝方块是新测的 Z 面检查 (5,0)、(5,2)、(5,4),实线是它们的支撑,虚线是延伸过缝合线的老 X 星新增的腿。蓝圈标出三条检查连乘后剩下的六个 Z:A 的右列 x=4 与 B 的左列 x=6。 Two L=3 patches and the seam at x=5. Magenta dots are the seam qubits (5,1), (5,3) prepared in |+⟩; the three magenta-edged blue squares are the newly measured Z-plaquettes (5,0), (5,2), (5,4), solid lines their supports, dashed lines the new legs of the old X-stars now reaching across the seam. Blue rings mark the six Z's left after multiplying the three checks: A's right column x=4 and B's left column x=6.

4.2连乘:缝合比特成对抵消The product: seam qubits cancel in pairs

写出三条缝合检查的支撑:(5,0) 连 (4,0)、(6,0)、(5,1),三腿(下毛边界);(5,2) 连 (4,2)、(6,2)、(5,1)、(5,3),四腿;(5,4) 连 (4,4)、(6,4)、(5,3),三腿。把三个测量结果相乘:缝合比特 (5,1) 出现在 (5,0) 与 (5,2) 两条里,(5,3) 出现在 (5,2) 与 (5,4) 两条里——各被 Z 碰两次,Z·Z = I,抵消。剩下的是:

Write out the three seam checks' supports: (5,0) joins (4,0), (6,0), (5,1), three legs (bottom rough boundary); (5,2) joins (4,2), (6,2), (5,1), (5,3), four legs; (5,4) joins (4,4), (6,4), (5,3), three legs. Multiply the three outcomes: seam qubit (5,1) appears in both (5,0) and (5,2), and (5,3) in both (5,2) and (5,4) — each is hit by Z twice, Z·Z = I, and cancels. What remains is:

∏y=0,2,4 Zplaq(5,y) = Z(4,0)Z(4,2)Z(4,4) · Z(6,0)Z(6,2)Z(6,4) = ZLA ⊗ ZLB

Zplaq(5,y) = 中心在 (5,y) 的缝合 Z 面检查;Z(x,y) = 坐标 (x,y) 上那个比特的 Z;ZLA, ZLB = 贴片 A、B 的逻辑 Z;⊗ = 两者同时作用;∏ = 连乘。Zplaq(5,y) = the seam Z-plaquette centred at (5,y); Z(x,y) = Z on the qubit at coordinate (x,y); ZLA, ZLB = the logical Z of patch A, B; ⊗ = both acting together; ∏ = product.

左边三个 Z 是贴片 A 的 ZL 的右列代表元(2.2 节:任何一列都等价),右边三个是贴片 B 的 ZL 的左列代表元。所以三条局域检查读数的乘积,就是两个逻辑比特的联合 Z 奇偶。这就是格点手术的全部内容:拓扑把一个非局域的观测量变成一组可同时测量的局域检查的乘积(horsman2012surface,Horsman, Fowler, Devitt, Van Meter, “Surface code quantum computing by lattice surgery”, 2012)。对偶地,把毛边界贴在一起、缝合比特置 |0⟩、缝合检查用 X 星,测的就是 XL⊗XL。格点手术教程用同一个连乘讲了「测到奇偶、学不到内容」的含义,并在对偶一节做了毛边版本。

The three Z's on the left are the right-column representative of patch A's ZL (§2.2: any column is equivalent), the three on the right the left-column representative of patch B's ZL. So the product of three local check outcomes is the joint Z parity of two logical qubits. That is the whole content of lattice surgery: topology turns a nonlocal observable into a product of simultaneously measurable local checks (horsman2012surface, Horsman, Fowler, Devitt, Van Meter, “Surface code quantum computing by lattice surgery”, 2012). Dually, glue rough boundaries, prepare the seam qubits in |0⟩ and use X-stars as seam checks, and you measure XL⊗XL. The lattice-surgery guide uses the same product to explain “learn the parity, not the content”, and does the rough version in its duality section.

4.3重新记账:n=28、k=1、d=3(不是 6)Redo the ledger: n=28, k=1, d=3 (not 6)

合并前,两块贴片共 13+13 = 26 个数据比特,各存一个逻辑比特,k=2。加两个缝合比特,n = 28。合并后独立检查有 12+12+3 = 27 条,所以 k = 28 − 27 = 1:测一次联合逻辑奇偶,恰好抹去一个逻辑自由度。合并后的整体不是别的,正是矩形超图乘积 HGP(rep3, rep6):比特×比特块 3×6 = 18,检查×检查块 2×5 = 10,合计 28;HX 有 2×6 = 12 行,HZ 有 3×5 = 15 行,合计 27。reproduce.py 把这个矩形交给引擎精确求参,得到:

Before the merge, the two patches have 13+13 = 26 data qubits and store one logical qubit each, k=2. Add two seam qubits: n = 28. After the merge there are 12+12+3 = 27 independent checks, so k = 28 − 27 = 1: measuring one joint logical parity removes exactly one logical degree of freedom. The merged object is nothing but the rectangular hypergraph product HGP(rep3, rep6): bit×bit block 3×6 = 18, check×check block 2×5 = 10, total 28; HX has 2×6 = 12 rows, HZ has 3×5 = 15 rows, total 27. reproduce.py hands this rectangle to the engine for exact parameters and obtains:

HGP(rep3, rep6): n = 28 · k = 1 · 独立检查independent checks = 27 · d = 3 (exact-css-enum)

HGP(rep3, rep6) = 用长 3 与长 6 的重复码校验矩阵做的超图乘积;n = 物理比特数;k = 逻辑比特数;d = 码距;exact-css-enum = 穷举枚举方法。HGP(rep3, rep6) = the hypergraph product of the length-3 and length-6 repetition parity matrices; n = physical qubits; k = logical qubits; d = distance; exact-css-enum = the exhaustive enumeration method.

注意 d = 3 而不是 6。水平方向的逻辑串变长了(要横跨 x = 0…10),竖直方向的逻辑串仍然只有 3 格(y = 0…4)。合并保持原来的空间码距,不会魔法般地把矩形变成距离 6。格点手术教程的重新记账一节对一般 d 做了同一笔账。

Note d = 3, not 6. The horizontal logical string grew (it must span x = 0…10), but the vertical one is still only 3 cells long (y = 0…4). The merge preserves the original spacelike distance; it does not magically turn the rectangle into distance six. The lattice-surgery guide's ledger section does the same accounting for general d.

诚实说明Honesty box

机器重算的是矩形本身的 n、k、独立检查数与 d。「合并实现了 ZL⊗ZL 的测量、分裂后 Pauli 帐能还原两块贴片、两次合并构成 CNOT」是操作层面的语义,QEC-Bank 对每一条逻辑操作都标 claimed(文献主张,horsman2012surface),没有机器证书。

What the machine recomputes is the rectangle itself: n, k, the number of independent checks and d. “The merge implements a ZL⊗ZL measurement, the Pauli frame after splitting restores two patches, two merges make a CNOT” are operation-level semantics; the QEC-Bank labels every logical operation claimed (a literature claim, horsman2012surface) with no machine certificate.

4.4为什么要 d 轮,而且不是简单表决Why d rounds, and why not a bare majority vote

如果唯一可能的故障是「每轮独立地翻转一次推断出的缝合奇偶」,那么重复测量再表决,就是一条时间方向的一维重复码,d 轮给出时间方向的码距 d。这个玩具约化不是完整的容错论证。真实的提取电路还有数据错误、辅助比特传播、以及跨越合并起点或终点的故障;它们在空间与时间上造出相关的探测事件,还可能改变「正在追踪的是联合逻辑观测量的哪个代表元」。所以合并期间的症状必须作为一段时空历史整体译码:跑 d 轮提供时间方向的码距,而把缝合探测器与体内探测器合起来推断逻辑奇偶的,是译码器,不是裸表决。格点手术教程在一次读错就够了与真相:不是表决,是时空译码两节里把这件事讲透了。

If the only possible fault were an independent flip of the inferred seam parity in each round, repeating the measurement and voting would be a one-dimensional repetition code in time, and d rounds would supply timelike distance d. That toy reduction is not the full fault-tolerance argument. Real extraction circuits also contain data faults, ancilla propagation, and faults crossing the start or end of the merge; they create correlated detection events in space and time, and can change which representative of the joint logical observable is being tracked. The merge syndrome must therefore be decoded as one spacetime history: running d rounds supplies timelike distance, and it is the decoder, not a bare majority rule, that combines seam and bulk detectors to infer the logical parity. The lattice-surgery guide covers this thoroughly in one misread is enough and the truth: not a vote but spacetime decoding.

分裂与 CNOT(推导之外的两步,给出链接)Split and CNOT (two steps beyond the derivation, with links)

分裂:停止缝合检查,把缝合数据比特在 X 基下测量;读数更新 Pauli 帐,两块编码贴片恢复。逻辑 CNOT 用一块制备在 |+⟩ 的辅助贴片(下面用上标标记算符所在的贴片:C = 控制贴片,A = 辅助贴片,T = 目标贴片;ZLC 就是控制贴片的逻辑 Z):① 测 ZLCZLA;② 测 XLAXLT;③ 测辅助贴片的逻辑 Z;④ 经典地追踪依赖读数的 Pauli 修正。每次联合测量都是上面的望远镜连乘(X 与 Z 互换即对偶合并)。整个操作是 Clifford 的,始终停留在稳定子形式体系之内。完整推导见格点手术教程的分裂与 Pauli 帐和两次合并做一个 CNOT。

Split: stop the seam checks and measure the seam data qubits in X; the outcomes update the Pauli frame and restore two encoded patches. A logical CNOT uses an ancilla patch prepared in |+⟩ (superscripts below name the patch an operator lives on: C = control patch, A = ancilla patch, T = target patch; ZLC is the control patch's logical Z): ① measure ZLCZLA; ② measure XLAXLT; ③ measure the ancilla's logical Z; ④ classically track the outcome-dependent Pauli corrections. Each joint measurement is the telescoping product above (with X and Z exchanged for the dual merge). The operation is Clifford and stays inside the stabilizer formalism throughout. The full derivation is in the lattice-surgery guide's split and Pauli frame and two merges make one CNOT.

关键想法Key idea

缝合比特各被两条相邻缝合检查碰到,所以连乘时成对消失;活下来的恰是两块贴片各自 ZL 的相邻列代表元。数字:26 → 28 个比特,24 → 27 条检查,k 从 2 到 1,d 保持 3。

Each seam qubit is touched by two neighbouring seam checks, so it vanishes in the product; what survives is exactly the adjacent-column representative of each patch's ZL. Numbers: 26 → 28 qubits, 24 → 27 checks, k from 2 to 1, d stays 3.

第 5 章Chapter 5

阈值账本:一个数字指的是哪个模型The threshold ledger: which model a number refers to

规则只有一条:没有基本故障模型、症状模型、译码器与归一化,阈值数字没有意义。QEC-Bank 把表面码的阈值记成五行,刻意不合并成「表面码的阈值」。本章逐行读账,解释相邻两行为什么不同,最后用一次浏览器实验体会第一、二行所在的「码容量」世界。 There is one rule: a threshold number is meaningless without its elementary fault model, syndrome model, decoder and normalization. The QEC-Bank records surface-code thresholds as five rows and deliberately refuses to merge them into “the surface-code threshold”. This chapter reads the ledger row by row, explains why neighbouring rows differ, and ends with a browser experiment to feel the “code-capacity” world of rows one and two.

5.1五行账The five rows

行Row噪声与症状模型Noise & syndrome model译码器Decoder报告值与归一化Reported value & normalization出处Provenance
码容量,最优Code capacity, optimal独立的 X 或 Z 数据错误,完美症状Independent X or Z data errors, perfect syndrome类概率 / 最大似然Class-probability / maximum likelihood约 10.9%(每比特每轮)About 10.9% (per qubit, per round)dennis2002topological
码容量,最小能量Code capacity, minimum energy同上(完美症状)Same perfect-syndrome setting匹配所对应的零温 / 最短链近似Zero-temperature / minimum-chain approximation associated with matching0.1031 ± 0.0001wang2003confinement
现象学时空Phenomenological spacetime数据错误与症状错误逐轮重复;随机面规范 / 匹配模型Repeated data and syndrome errors in the random-plaquette gauge / matching model时空匹配Spacetime matching0.0293 ± 0.0002(所引的对称约定)0.0293 ± 0.0002 (in the quoted symmetric convention)wang2003confinement
调度电路Scheduled circuitFowler 指定的八步症状电路,逐步的随机故障模型Fowler's specified eight-step syndrome circuit and per-step stochastic fault model匹配Matchingpth = 0.57% 每步;约 4% 每个完整的八步周期pth = 0.57% per step; roughly 4% per full eight-step cyclefowler2012surface
硬件拟合Hardware fitGoogle Willow 旋转版存储器,器件实测的非均匀噪声Google Willow rotated memories with the device's measured heterogeneous noise摘要未写明 d=7 数据用的译码器;实时译码器是在另一个 d=5 存储器上演示的The abstract does not name the decoder behind the d=7 numbers; the real-time decoder was demonstrated on a separate d=5 memoryΛ大写希腊字母 lambda,读「拉姆达」。压制因子:码距 d 加 2 时逻辑错误率缩小的倍数,由整套器件与译码器拟合得到。它不是阈值。 = 2.14 ± 0.02(每 d→d+2);d=7 时每周期 0.143% ± 0.003%ΛCapital Greek lambda. The suppression factor: how much the logical error rate shrinks when d grows by 2, fitted from the whole device-plus-decoder stack. It is not a threshold. = 2.14 ± 0.02 (per d→d+2); distance seven at 0.143% ± 0.003% per cyclegoogle2024below

出处的全名:dennis2002topological = Dennis, Kitaev, Landahl, Preskill, “Topological quantum memory” (2002);wang2003confinement = Wang, Harrington, Preskill, “Confinement-Higgs transition in a disordered gauge theory and the accuracy threshold for quantum memory” (2003);fowler2012surface = Fowler, Mariantoni, Martinis, Cleland, “Surface codes: Towards practical large-scale quantum computation” (2012);google2024below = Google Quantum AI, “Quantum error correction below the surface code threshold” (2024)。

The provenance keys in full: dennis2002topological = Dennis, Kitaev, Landahl, Preskill, “Topological quantum memory” (2002); wang2003confinement = Wang, Harrington, Preskill, “Confinement-Higgs transition in a disordered gauge theory and the accuracy threshold for quantum memory” (2003); fowler2012surface = Fowler, Mariantoni, Martinis, Cleland, “Surface codes: Towards practical large-scale quantum computation” (2012); google2024below = Google Quantum AI, “Quantum error correction below the surface code threshold” (2024).

绝不跨行比较Never compare across rows

10.9%、10.3%、2.9%、0.57%、Λ=2.14 是五个不同实验的读数,不是同一个量的五次测量。同一行内比较才有意义;跨行必须先换算模型,而多数情况下根本换算不了。尤其是最后一行:Λ 不是阈值,也不能等同于 pth/p。译码器教程的账本与「Λ 不是 pth/p」两节用同一套规则读同一本账。

10.9%, 10.3%, 2.9%, 0.57% and Λ=2.14 are readings from five different experiments, not five measurements of one quantity. Comparison is meaningful only within a row; across rows you must first convert the models, and usually you cannot. The last row especially: Λ is not a threshold and must not be identified with pth/p. The decoders guide's ledger and “Λ is not pth/p” sections read the same ledger with the same rules.

5.2为什么 10.9% 与 10.3% 不同Why 10.9% and 10.3% differ

固定一个症状,某个逻辑类的概率是该类中全部错误链的概率之和。在随机键 Ising 模型的映射里,这个和是一个配分函数;最优译码在 Nishimori 线上比较各类的自由能。最小链译码器只比较能量(最短链的长度),丢掉了近乎退化的众多路径贡献的熵。所以这 0.6 个百分点的差距是同一个完美症状模型内部「译码器 / 统计力学」的区别,不是同一个数字的实验误差。这正是 3.3 节路径退化的数字后果,译码器教程在退化一节算过一个可以数出来的例子。

Fix a syndrome; the probability of a logical class is the sum over all error chains in that class. In the random-bond Ising mapping this sum is a partition function, and optimal decoding compares free energies on the Nishimori line. A minimum-chain decoder compares only energies (the length of the shortest chain) and discards the entropy contributed by the many nearly degenerate paths. So the 0.6-percentage-point gap is a decoder/statistical-mechanics distinction inside one perfect-syndrome model, not experimental uncertainty on one number. It is the numerical consequence of §3.3's path degeneracy; the decoders guide works a countable example in its degeneracy section.

5.3为什么 2.9% 不是门阈值Why 2.9% is not a gate threshold

加入带噪的症状比特,就多了一个时间方向,配对问题变成三维的匹配 / 规范问题(译码器教程第 5 章)。但现象学模型里的「每轮数据错误率」与「每轮测量比特翻转率」没有指定任何物理位置:没有制备、CNOT、空闲、泄漏、复位、读出。这个阈值对译码器物理很有价值,却不能与一个电路位置阈值直接比较。

Adding noisy syndrome bits creates a time direction and turns matching into a three-dimensional matching/gauge problem (Chapter 5 of the decoders guide). But the phenomenological “data error per round” and “measurement-bit flip per round” specify no physical locations: no preparation, CNOT, idle, leakage, reset or readout. The threshold is valuable for decoder physics yet cannot be compared directly with a circuit-location threshold.

5.4为什么 0.57% 的换算用八步Why the 0.57% conversion uses eight steps

Fowler 等人的模拟把 p 定义为每步的故障率,并明确使用每周期八步;文中「约 4% 每周期」是那个模型的换算。另一种六层电路也可以是合法的表面码调度,但不能把 Fowler 的八步换算直接贴到它身上——必须重建噪声账。归一化(每位置、每步、每轮、每周期、每单位时间)是账本的必填字段。

Fowler et al.'s simulation defines p per step and explicitly uses eight steps per cycle; the quoted “roughly four percent per cycle” is the conversion for that model. A different six-layer circuit may also be a valid surface-code schedule, but Fowler's eight-step conversion cannot be attached to it without rebuilding the noise accounting. Normalization (per location, step, round, cycle, or unit time) is a required field of the ledger.

5.5阈值以下的标度,以及 ΛScaling below threshold, and Λ

对简单的独立噪声模型,低 p 时主导的逻辑失败机制需要 ⌈d/2⌉ 个故障,于是有经验公式(直觉教程曾在纸上推过):

For simple independent models, the leading low-p logical failure mechanism needs ⌈d/2⌉ faults, motivating the empirical form (the intuition guide derived it on paper):

pL ≈ A · (p / pth)⌈d/2⌉ (奇数 d 加 2 ≈ 再乘一个 p/pth,未计前因子、退化、关联与有限尺寸效应odd d + 2 ≈ one more factor of p/pth, before prefactors, degeneracy, correlations and finite-size effects)

pL = 逻辑错误率;p = 物理错误率;pth = 阈值;A = 前因子(常数);d = 码距;⌈d/2⌉ = d/2 向上取整。pL = logical error rate; p = physical error rate; pth = threshold; A = a constant prefactor; d = distance; ⌈d/2⌉ = d/2 rounded up.

硬件的 Λ 是从完整的「器件 + 译码器」整体拟合出来的:Willow 报告 Λ = 2.14 ± 0.02,d=7 时每周期 0.143% ± 0.003%。它不应被等同于 pth/p——前因子、关联噪声与非均匀性都混在里面。

Hardware Λ is fitted from the complete device-and-decoder stack: Willow reports Λ = 2.14 ± 0.02 and, at d=7, 0.143% ± 0.003% per cycle. It should not be identified with pth/p — prefactors, correlated noise and heterogeneity are all folded in.

5.6引用纪律:五个必填字段Citation discipline: five required fields

向 QEC-Bank 新增一个阈值时必须记录:① 数据错误信道;② 症状是完美、现象学还是由电路导出;③ 若适用,完整的电路位置约定;④ 译码器,以及它是否利用关联 / 退化;⑤ 归一化——每位置、每步、每轮、每周期或每单位时间。五个字段缺任何一个,数字只能留在文献扫描里,不得升格为面向读者的内容。译码器教程的「一个数字,五个限定项」用同一张清单。

When a new threshold is added to the QEC-Bank, record: ① the data-error channel; ② whether the syndrome is perfect, phenomenological or circuit-derived; ③ the complete circuit-location convention, if applicable; ④ the decoder, and whether it uses correlations/degeneracy; ⑤ the normalization — per location, step, round, cycle or unit time. Missing any of the five, the number stays in the literature sweep and is not promoted into reader-facing content. The decoders guide's “one number, five qualifiers” uses the same checklist.

5.7亲手跑一次第一、二行的世界Run rows one and two's world yourself

下面的实验台就是「码容量」玩具:每轮每个比特独立地以概率 p 中一个错误,症状完美,用一个简单的匹配类译码器,对 d = 3、5、7 各跑成百上千轮,画出失败率曲线。它属于账本的前两行那个世界(完美症状),不属于后三行;而且它的译码器比最优差、也未必和文献里的最小重量匹配完全一样,所以交叉点只会落在「百分之几到 10%」这个带子里,不该被当成 10.9% 或 10.3% 的复现。看的是形状:低 p 时大码更好,高 p 时次序翻转。

The bench below is the “code-capacity” toy: each round every qubit independently suffers an error with probability p, the syndrome is perfect, a simple matching-type decoder runs, and d = 3, 5, 7 are each simulated for hundreds to thousands of rounds to draw the failure-rate curves. It lives in the world of the ledger's first two rows (perfect syndrome), not the last three; and its decoder is worse than optimal and not necessarily identical to the literature's minimum-weight matching, so the crossing lands somewhere in the “several percent to 10%” band and must not be read as a reproduction of 10.9% or 10.3%. Watch the shape: at low p bigger codes win, at high p the order flips.

关键想法Key idea

阈值不是检查矩阵的性质,是「码 + 噪声模型 + 症状模型 + 译码器 + 归一化」五元组的性质。QEC-Bank 因此不给表面码一个阈值,而给一本账;页面上凡出现两个阈值数字,都必须说明它们来自不同的行。

A threshold is not a property of a check matrix; it is a property of the five-tuple “code + noise model + syndrome model + decoder + normalization”. The QEC-Bank therefore gives the surface code not one threshold but one ledger, and wherever two threshold numbers appear on a page they must be declared as coming from different rows.

尾声Epilogue

五条推导的回放、八道自测题与符号表Replay of the five derivations, eight self-test questions, and the symbol table

回放整条推理链:开链奇偶矩阵的转置核为零 → 超图乘积给两块比特、两张对易且局域的检查矩阵、k=1(第 1 章)→ 一行一列给 d ≤ L,L 条不交的等价代表元给 d ≥ L,机器对 L=3、4 枚举、对 L=5 说 bounded(第 2 章)→ 症状 = H·e = 链的边界,零症状的横跨串是逻辑而非稳定子,译码在类之间二选一(第 3 章)→ 缝合检查连乘望远镜式地缩成 ZL⊗ZL,n=28、k=1、d=3,d 轮由时空译码而非表决消化(第 4 章)→ 五行阈值账,绝不跨行比较(第 5 章)。每一步都在 QEC-Bank 的「推导与指南」侧面有对应的页面:HGP 构造、码距证明、症状与译码、格点手术、阈值账本。

Replay the whole chain: the open chain's parity matrix has a zero transpose kernel → the hypergraph product gives two qubit blocks, two commuting local check matrices, and k=1 (Chapter 1) → a row and a column give d ≤ L, L disjoint equivalent representatives give d ≥ L, the machine enumerates L=3, 4 and says “bounded” at L=5 (Chapter 2) → syndrome = H·e = the chain's boundary, the zero-syndrome spanning string is a logical rather than a stabilizer, and decoding chooses between classes (Chapter 3) → seam checks telescope into ZL⊗ZL, n=28, k=1, d=3, and d rounds are digested by spacetime decoding rather than voting (Chapter 4) → a five-row threshold ledger, never compared across rows (Chapter 5). Each step has its page in the QEC-Bank “Derivations & guides” facet: HGP construction, distance proof, syndrome & decoding, lattice surgery, threshold ledger.

自测:QEC-Bank 的八道「试金石」问题Self-test: the QEC-Bank's eight “litmus” questions

QEC-Bank 的直觉短文以八道问题收尾,用来检验读者是否真的掌握了这个条目。先自己答,再展开对照。Q3、Q7、Q8 涉及本教程未展开的内容(XZZX 变体、逻辑 H 与 T 门),答案给出链接。

The QEC-Bank intuition essay closes with eight questions meant to test whether a reader has really mastered this entry. Answer first, then unfold and compare. Q3, Q7 and Q8 touch material this tutorial did not develop (the XZZX variant, logical H and T); their answers link onward.

Q1 · 哪一个秩的事实把这个平面码与环面码区分开?Q1 · What single rank fact distinguishes this planar code from the toric code?

开链的重复码矩阵是 (L−1)×L 且行满秩,所以它的转置码维数为零。闭合成圈会多出一条行关系,让转置维数变成一。在 HGP 公式里,这把 1·1 + 0·0 = 1 变成 1·1 + 1·1 = 2(1.4 节)。

The open-chain repetition matrix is (L−1)×L with full row rank, so its transpose code has dimension zero. Closing the chain creates one row relation, making the transpose dimension one. In the HGP formula this turns 1·1 + 0·0 = 1 into 1·1 + 1·1 = 2 (§1.4).

Q2 · 为什么 d = L 是一个证明,而不是一张长度 L 的串的图?Q2 · Why is d = L a proof rather than a picture of one length-L string?

一行与一列只证上界。下界用每个逻辑类的 L 条不相交代表元:任何与该类反对易的算符必须碰到每一条代表元,因而至少占 L 个比特。代表元的等价性与不交性由 reproduce.py 核对(2.2–2.3 节)。

A length-L row and column prove only the upper bound. The lower bound uses L disjoint representatives of each logical class: anything anticommuting with the class must touch every representative, hence at least L qubits. Representative equivalence and disjointness are checked by reproduce.py (§2.2–§2.3).

Q3 · 为什么 XZZX 在纯退相位噪声下能达到 50%,而 CSS 表面码不能?Q3 · Why does XZZX reach 50% under pure dephasing while the CSS surface code does not?

纯 Z 错误在两种描述里都只激活一种症状。XZZX 额外带来对角线上的奇偶守恒,把二维问题拆成互相独立的重复码;CSS 没有这种一维分解,保持约 10.9% 的最优码容量阈值(账本第一行)。XZZX 不在本教程范围内,见「关系」侧面与 bonilla2021xzzx。

Pure Z errors activate only one syndrome type in either description. XZZX adds a diagonal parity conservation law that splits the two-dimensional problem into independent repetition codes; CSS lacks that one-dimensional decomposition and retains its roughly 10.9% optimal code-capacity threshold (ledger row one). XZZX is outside this tutorial's scope; see the Relations facet and bonilla2021xzzx.

Q4 · 可以把 10.9%、2.9%、0.57% 当作同一个阈值的三个估计来比较吗?Q4 · May one compare 10.9%, 2.9% and 0.57% as three estimates of the same threshold?

不可以。它们分别指完美症状的码容量噪声、逐轮重复的现象学数据 / 测量噪声、一个特定的调度电路级模型。基本故障位置与译码器都不同(5.1 节的账本)。

No. They refer respectively to perfect-syndrome code-capacity noise, repeated phenomenological data/measurement noise, and a particular scheduled circuit-level model. Their elementary fault locations and decoders differ (the ledger of §5.1).

Q5 · 为什么 d 轮手术不只是「时间上的多数表决」?Q5 · Why are d surgery rounds not simply “majority vote in time”?

若只有缝合读数的独立翻转,重复采样确实约化为一条重复码。真实的症状电路还含数据故障与传播故障,造出相关的时空探测事件;逻辑奇偶要由时空译码器与这些事件一并推断(4.4 节)。

If only independent seam-outcome flips occurred, repeated parity samples would reduce to a repetition code. Real syndrome circuits also contain data and propagated faults, which create correlated spacetime detection events; the logical parity is inferred jointly with those events by a spacetime decoder (§4.4).

Q6 · 算上辅助比特,未旋转贴片一共用多少比特?Q6 · How many qubits does the unrotated patch consume when ancillas are counted?

数据比特 2d²−2d+1,独立检查比它少一条,每条检查配一个专用辅助比特,总数 4d²−4d+1。旋转版是 d² 个数据加 d²−1 个辅助,共 2d²−1。reproduce.py 对 d=3 与 d=12 断言了这两条公式:d=3 时未旋转 13/25、旋转 9/17;d=12 时未旋转 265/529、旋转 144/287(数据 / 总数)。

2d²−2d+1 data qubits and one fewer independent checks, so one dedicated ancilla per check gives 4d²−4d+1 in total. The rotated totals are d² data plus d²−1 ancillas, or 2d²−1. reproduce.py asserts both formulas at d=3 and d=12: unrotated 13/25 and rotated 9/17 at d=3; unrotated 265/529 and rotated 144/287 at d=12 (data / total).

Q7 · 对每个比特做物理 H,就已经是逻辑 H 了吗?Q7 · Is physical H on every qubit already a logical H?

不是。它把码换成了它的对偶。逻辑门是横向 H 加上 90° 的几何重标记;要恢复固定的平面版图需要码形变。S 门只有在镜像对偶的折叠版图可用时才是常数深度。这些操作对应 QEC-Bank 本条目「逻辑操作」侧面里的「H / S · fold-transversal」记录(出处 J. E. Moussa「Transversal Clifford gates on folded surface codes」,2016,moussa2016transversal;代价:常数深度门加一次折叠或等价的比特置换),QEC-Bank 对它标 claimed。

No. It exchanges the code with its dual. The logical gate is transversal H plus the 90-degree geometry relabelling; restoring a fixed planar footprint requires code deformation. An S gate is constant depth only once the mirror-dual folded layout is available. These operations correspond to the “H / S · fold-transversal” record in this entry's QEC-Bank Logical operations facet (source: J. E. Moussa, “Transversal Clifford gates on folded surface codes”, 2016, moussa2016transversal; cost: constant-depth gates plus a fold or an equivalent qubit permutation), which the QEC-Bank labels claimed.

Q8 · 究竟是什么禁止了逻辑 T?Q8 · What precisely forbids logical T?

在码距不断增长的二维拓扑 Pauli 稳定子码上,任何有界深度、有界作用范围的电路只能诱导 Clifford 层级第二层的操作;T 在第三层。(Clifford 层级:第一层是 Pauli 算符;第二层是把 Pauli 变成 Pauli 的门,即 Clifford 门;第三层是把 Pauli 变成 Clifford 门的门,T 属于这一层。)注入与码切换之所以可行,是因为它们添加了资源,或者离开了这条定理的某个假设。见格点手术教程「一条天花板:Bravyi–König」。

A bounded-depth, bounded-range circuit on a growing-distance two-dimensional topological Pauli stabilizer code induces a level-two Clifford-hierarchy operation; T is level three. (The Clifford hierarchy: level one is the Pauli operators; level two the gates that map Paulis to Paulis, i.e. Clifford gates; level three the gates that map Paulis to Clifford gates, which includes T.) Injection and code switching work because they add a resource or leave an assumption of that theorem. See the lattice-surgery guide's “a ceiling: Bravyi–König”.

符号与读法Symbols & how to read them

符号Symbol名称与读法Name & how to read it在本教程中的含义Meaning in this tutorial
⊗圆圈乘,读「张量积」Circled times, read “tensor product”矩阵的张量(Kronecker)积:A⊗B 把整份 B 复制到 A 的每个 1 所在的位置。HX = [H⊗I | I⊗Hᵀ]。在 ZL⊗ZL 里表示两块贴片各自的逻辑 Z 同时作用。The tensor (Kronecker) product of matrices: A⊗B copies all of B into the position of every 1 in A. HX = [H⊗I | I⊗Hᵀ]. In ZL⊗ZL it means the two patches' logical Z's acting together.
ᵀ上标 T,读「转置」Superscript T, read “transpose”把矩阵的行与列互换。Hᵀ 是 L×(L−1);dim ker Hᵀ = 0 是「开链」的签名。Swap a matrix's rows and columns. Hᵀ is L×(L−1); dim ker Hᵀ = 0 is the signature of an open chain.
∂弯体 d,读「边界」(boundary)Curly d, read “boundary”∂E = 错误链 E 的端点集合 = 报警的检查。矩阵形式 HZeX。∂(E⊕C) = 0 表示 E⊕C 是圈。∂E = the set of endpoints of the error chain E = the fired checks. In matrix form HZeX. ∂(E⊕C) = 0 says E⊕C is a cycle.
ker读「核」(kernel)Read “kernel”ker H = 使 H·v = 0 的全部向量 v。dim ker H = 列数 − rank(H)。ker H 是重复码的码字空间。ker H = all vectors v with H·v = 0. dim ker H = number of columns − rank(H). ker H is the repetition code's codeword space.
rank读「秩」Read “rank”矩阵里线性独立的行数(模 2)。rank(H) = L−1;rank(HX) = rank(HZ) = L(L−1)。The number of linearly independent rows of a matrix (mod 2). rank(H) = L−1; rank(HX) = rank(HZ) = L(L−1).
Im读「m 阶单位矩阵」Read “the m-by-m identity”对角线全 1、其余全 0 的 m×m 矩阵。IL 与 IL−1 出现在 HX、HZ 的四个块里。The m×m matrix with 1s on the diagonal and 0s elsewhere. IL and IL−1 appear in the four blocks of HX, HZ.
wt(P)读「P 的重量」(weight)Read “the weight of P”算符 P 非平凡作用的比特个数。码距 d = 非平凡逻辑算符的最小重量。The number of qubits on which P is not the identity. The distance d = the minimum weight of a nontrivial logical.
XL ZL下标 L,读「逻辑 X / 逻辑 Z」Subscript L, read “logical X / logical Z”与直觉教程的 X̄、Z̄同义:作用在被保护的逻辑比特上的 X、Z。这里 XL = 一条 X 行,ZL = 一条 Z 列。Synonymous with the intuition guide's X̄, Z̄: the X and Z acting on the protected logical qubit. Here XL = an X-row, ZL = a Z-column.
XLaZLb上标 a、b,读「X 逻辑的 a 次方乘 Z 逻辑的 b 次方」Superscripts a, b, read “X-logical to the a times Z-logical to the b”a、b 各取 0 或 1,是「用不用这个生成元」的开关位;(1,0)、(0,1)、(1,1) 分别给出 XL、ZL、YL = XLZL,(0,0) 是恒等。与 2.1 节的坐标下标 (a,b) 无关。a, b are bits, each 0 or 1, on/off switches for the generators; (1,0), (0,1), (1,1) give XL, ZL, YL = XLZL, and (0,0) is the identity. Unrelated to the coordinate indices (a,b) of §2.1.
ZLA XLC上标大写字母,读「贴片 A 的逻辑 Z」Capital superscript, read “the logical Z of patch A”上标标记算符所在的贴片:A、B = 4.2 节合并的两块贴片;C、A、T = CNOT 里的控制、辅助、目标贴片。The superscript names the patch an operator lives on: A, B = the two patches merged in §4.2; C, A, T = the control, ancilla and target patches of the CNOT.
∏大写希腊字母 π,读「派」Capital Greek π, read “pie”连乘记号。∏b' X-check(a,b') = 一条带里全部 X 检查的乘积;∏ 缝合检查 = ZL⊗ZL。The product sign. ∏b' X-check(a,b') = the product of all X-checks in a strip; ∏ seam checks = ZL⊗ZL.
⊕圆圈加,读「异或」Circled plus, read “X-OR”合并两组比特、成对相消(模 2 加法)。E⊕C = 错误加修复。Merge two sets of qubits with pairwise cancellation (addition mod 2). E⊕C = error plus repair.
⌈ ⌉直角括号,读「向上取整」Square-cornered brackets, read “ceiling”⌈d/2⌉ = d 的一半,不足则进一:凑出一次逻辑失败至少需要的故障数。⌈d/2⌉ = half of d, rounded up: the minimum number of faults for one logical failure.
Λ大写希腊字母 lambda,读「拉姆达」Capital Greek lambda, read “LAM-da”压制因子:d 加 2 时逻辑错误率缩小的倍数,由整套器件与译码器拟合。Willow 报告 2.14 ± 0.02。不是阈值,不等于 pth/p。The suppression factor: how much the logical error rate shrinks per d→d+2, fitted from the whole device-and-decoder stack. Willow reports 2.14 ± 0.02. Not a threshold; not pth/p.
≤ ≥ ≠ ≈ ±读「小于等于 / 大于等于 / 不等于 / 约等于 / 正负」Read “at most / at least / not equal / approximately / plus-minus”d ≤ L 与 d ≥ L 合起来是 d = L;0.1031 ± 0.0001 表示报告值与其不确定度。d ≤ L and d ≥ L together give d = L; 0.1031 ± 0.0001 is a reported value with its uncertainty.
⇒ ⇔ ∈ ∎读「推出 / 当且仅当 / 属于 / 证毕」Read “implies / if and only if / belongs to / Q.E.D.”逻辑记号:A ⇒ B 由 A 得 B;A ⇔ B 互为充要;x ∈ S 表示 x 是集合 S 的成员;∎ 标记证明结束。Logic marks: A ⇒ B derives B from A; A ⇔ B are equivalent; x ∈ S says x is a member of the set S; ∎ marks the end of a proof.
|+⟩读「加态」(plus ket)Read “plus ket”(|0⟩+|1⟩)/√2,X 值确定为 +1 的单比特状态;缝合比特的初态。(|0⟩+|1⟩)/√2, the single-qubit state with X value fixed at +1; the seam qubits' initial state.

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

术语Term白话定义Plain definition
Level-2 / 推导页Level-2 / derivation pageQEC-Bank 里只回答一个问题、把证明做完、并标注每句话出处的页面;与直觉短文(Level-1)相对。A QEC-Bank page that answers one question completely, carries out the proof, and labels each statement's provenance; contrasted with the intuition essay (Level-1).
复现契约reproduction contract每个「算出来」的数字都能用 reproduce.py 与验证器重跑,不符即报错。Every “computed” number reruns with reproduce.py and the verifier; any disagreement fails.
rep_parity(L)rep_parity(L)长度 L 重复码的 (L−1)×L 奇偶矩阵,每行「相邻两位相等」。The (L−1)×L parity matrix of the length-L repetition code, each row “two neighbours equal”.
超图乘积 HGPhypergraph product (HGP)把两条经典矩阵组合成一对对易的 CSS 量子检查矩阵的构造;比特分两块,k = k₁k₂ + k₁ᵀk₂ᵀ。A construction combining two classical matrices into a commuting pair of CSS quantum check matrices; qubits in two blocks, k = k₁k₂ + k₁ᵀk₂ᵀ.
比特×比特块 / 检查×检查块bit×bit / check×check blockHGP 的两块量子比特:L² 个与 (L−1)² 个;后者提供对易缺陷的第二份拷贝。The two HGP qubit blocks: L² and (L−1)² qubits; the latter supplies the second copy of the commutation defect.
CSS 码CSS code检查分成纯 X 与纯 Z 两族的稳定子码;条件 HXHZᵀ = 0(模 2)。A stabilizer code whose checks split into pure-X and pure-Z families; condition HXHZᵀ = 0 (mod 2).
等价代表元equivalent representatives相差一个稳定子乘积的两个逻辑算符;L 条 X 行互为等价代表元。Two logicals differing by a product of stabilizers; the L X-rows are equivalent representatives.
exact-css-enum / rand-lowweight-v1exact-css-enum / rand-lowweight-v1QEC-Bank 的两种码距方法:穷举 CSS 逻辑枚举(给精确值),与带种子的随机低重量搜索(只给上界见证)。The QEC-Bank's two distance methods: exhaustive CSS logical enumeration (exact value) and seeded random low-weight search (upper-bound witness only).
verified / bounded / claimedverified / bounded / claimedQEC-Bank 出处标签:机器精确重算;下界靠定理、上界靠可重跑见证;仅文献主张。QEC-Bank provenance labels: machine-recomputed exactly; lower bound by theorem plus rerunnable upper witness; literature claim only.
凝聚边界condensing boundary让某一类错误链的端点无声消失的边界;译码图里用「边界节点」表示。A boundary where one type of chain endpoint vanishes silently; drawn as a “boundary node” in the decoder graph.
相对同调类relative homology class把差一个稳定子边界的圈视为相同后剩下的类别;X 串与 Z 串分开数:某一种的横跨串有奇数条,就是非平凡类;同一种的两条横跨串合起来是稳定子,但一条 X 横跨串加一条 Z 横跨串合起来是逻辑 Y,不是稳定子。The classes left after identifying cycles that differ by a stabilizer boundary; count X strings and Z strings separately: an odd number of spanning strings of one type is a nontrivial class; two spanning strings of the same type together are a stabilizer, but one X and one Z spanning string together make a logical Y, not a stabilizer.
探测器 / 钩子错误detector / hook error比较相邻两轮同一检查读数的「变化」事件;辅助比特故障经 CNOT 传播成两个数据比特上的相关错误。A “change” event comparing one check across consecutive rounds; an ancilla fault propagated by CNOTs into a correlated two-data-qubit error.
静态码距 / 故障码距static distance / fault distance检查矩阵的最小逻辑重量,与完整电路下造成逻辑失败的最少故障数;两个不同的主张。The minimum logical weight of the check matrix, versus the fewest faults causing logical failure in the full circuit; two different claims.
缝合线 / 望远镜连乘seam / telescoping product两块贴片之间新增的一列检查;它们的乘积因缝合比特成对抵消而缩成 ZL⊗ZL。The new column of checks between two patches; their product collapses to ZL⊗ZL because seam qubits cancel in pairs.
码容量 / 现象学 / 电路级code capacity / phenomenological / circuit-level三种噪声模型:完美症状;数据与症状逐轮出错但无电路位置;指定电路每个位置的故障。Three noise models: perfect syndrome; data and syndrome errors per round without circuit locations; faults at every location of a specified circuit.
Nishimori 线Nishimori line随机键 Ising 映射里与真实错误率相匹配的温度线;最优译码在此比较自由能。In the random-bond Ising mapping, the temperature line matched to the true error rate; optimal decoding compares free energies there.

延伸阅读Further reading

  • J.-P. Tillich, G. Zémor, “Quantum LDPC codes with positive rate and minimum distance proportional to the square root of the blocklength” (2009)
    超图乘积的原始构造;第 1 章的 HX、HZ 与维数公式出自此处。tillich2009quantumThe original hypergraph-product construction; Chapter 1's HX, HZ and dimension formula come from here. tillich2009quantum
  • S. B. Bravyi, A. Yu. Kitaev, “Quantum codes on a lattice with boundary” (1998)
    带边界的平面码的起点:两种边界与 k=1。bravyi1998quantumWhere the planar code with boundaries begins: two boundary types and k=1. bravyi1998quantum
  • E. Dennis, A. Kitaev, A. Landahl, J. Preskill, “Topological quantum memory” (2002)
    码距下界的文献支撑、症状 = 边界的同调语言、账本第一行的 10.9%。dennis2002topologicalLiterature backing for the distance lower bound, the homological language of syndrome = boundary, and the ledger's first-row 10.9%. dennis2002topological
  • C. Wang, J. Harrington, J. Preskill, “Confinement-Higgs transition in a disordered gauge theory and the accuracy threshold for quantum memory” (2003)
    账本第二、三行:0.1031 ± 0.0001 与 0.0293 ± 0.0002。wang2003confinementLedger rows two and three: 0.1031 ± 0.0001 and 0.0293 ± 0.0002. wang2003confinement
  • A. G. Fowler, M. Mariantoni, J. M. Martinis, A. N. Cleland, “Surface codes: Towards practical large-scale quantum computation” (2012)
    账本第四行:八步电路、0.57% 每步、约 4% 每周期。fowler2012surfaceLedger row four: the eight-step circuit, 0.57% per step, roughly 4% per cycle. fowler2012surface
  • C. Horsman, A. G. Fowler, S. Devitt, R. Van Meter, “Surface code quantum computing by lattice surgery” (2012)
    第 4 章的望远镜连乘、分裂与 CNOT 协议的出处。horsman2012surfaceSource of Chapter 4's telescoping product, split and CNOT protocol. horsman2012surface
  • Google Quantum AI, “Quantum error correction below the surface code threshold” (2024)
    账本第五行:Λ = 2.14 ± 0.02,d=7 每周期 0.143% ± 0.003%。google2024belowLedger row five: Λ = 2.14 ± 0.02, distance seven at 0.143% ± 0.003% per cycle. google2024below
诚实总账The honesty ledger

本教程里「算出来」的每个数字(矩阵、秩、n=13/25/41、d=3/4、L=5 的见证、q4 走位、n=28/k=1/27/d=3、4d²−4d+1 与 2d²−1 的计数)都对应 reproduce.py 的一条断言,本教程没有重新运行它,而是逐字抄录 QEC-Bank 页面的断言值。L=5 的码距是 bounded 而非 verified。第 4 章的操作语义全部是 claimed。第 5 章的五个数字来自五个不同的模型,本页任何地方都没有把它们当作同一个量。第 5 章的浏览器实验是玩具译码器,其交叉点不是任何账本行的复现。本教程只覆盖未旋转平面族;第 2 章证的是静态码距,不是电路 / 故障码距。

Every “computed” number in this tutorial (the matrices, ranks, n=13/25/41, d=3/4, the L=5 witness, the q4 walk, n=28/k=1/27 checks/d=3, the 4d²−4d+1 and 2d²−1 counts) corresponds to one assertion in reproduce.py; this tutorial did not rerun it but transcribed the asserted values verbatim from the QEC-Bank pages. The L=5 distance is bounded, not verified. Chapter 4's operation semantics are all claimed. Chapter 5's five numbers come from five different models and are nowhere on this page treated as one quantity. Chapter 5's browser experiment uses a toy decoder whose crossing reproduces no ledger row. This tutorial covers only the unrotated planar family; Chapter 2 proves the static distance, not the circuit/fault distance.