WorksPhysics and Astronomy
Exact distances and measurement allocation for logical Pauli readout
Abstract
The minimum fault weight of a logical readout depends jointly on data-error persistence, check redundancy and time-boundary constraints. For any binary check matrix and nonzero parity support , we prove that a repeated-readout model with a zero-syndrome endpoint has exact distance for at least wrong readouts. This reduces the search over fault histories to one weighted spatial minimum and gives the minimum repetition count for each adjacent-column check in square Bacon–Shor and generalized Shor readouts. Combining those checks with redundant Gauss-check pair products yields an exact joint distance and an outcome-count optimum within the specified gauged-readout family. At target distance , one round uses outcomes, compared with for the repeated baseline in the same phenomenological model. For a one-epoch bare-ancilla CNOT implementation, we prove a schedule-dependent distance upper bound by constructing an accepted wrong readout from one gate fault and outcome flips. The bound identifies necessary timing conditions for retaining the target distance and gives matching upper bounds of three for the best tested schedules at both and .
Introduction
Quantum error correction protects encoded information by measuring checks that detect errors without measuring the logical state [1, 2]. Threshold theorems establish reliable computation at sufficiently small physical error rates [3], and quantum low-density parity-check codes offer favorable rates, distances and memory overheads [6] [4, 5]. Computation also needs reliable logical operations, including logical Pauli measurements. Topological and homological codes provide the code families on which these operations were first developed [7, 8]. Lattice surgery implements logical measurements by merging and splitting code patches [9]. Gauging gives a systematic construction using an auxiliary graph and local checks on data and edge ancillas [10]. The product of the Gauss-check outcomes is the logical result; Figure 1 illustrates the construction.

Figure 1. Gauging the weight-four logical operator . (a) Circles are support data; squares are edge ancillas initialized in . Dark markers show ; the outcome product of all four Gauss checks measures . (b) The dashed line separates the vertex set from its complement , cutting two edges. requires for every . (c) Displayed Gauss checks and the cycle check ; blank cells denote . Original checks, their deformed partners and other data qubits are omitted. (d) Four measurement-outcome flips on pass every adjacent-round comparison and reverse every logical readout. Here is the ideal logical outcome and is the observed outcome in round . Here marks a flipped check outcome and is its comparison detector. Fault weight is four in this measurement-only example. OpenAI Codex assisted the drawing code and layout; see Section VI.
A reliable readout must protect that result from both data errors and faulty measurement records. Repeating checks and measuring redundant products can provide this protection, but their costs depend on how data faults persist and on which records are compared. We ask how these choices set the exact minimum fault weight, and how to allocate measurements to reach a target distance.
Our main theorem reduces a multiround fault problem to one weighted spatial minimum. For any binary check matrix and nonzero parity support , the model defined in Section III has exact distance . Data errors persist, the checks and logical parity share a noisy record, and endpoint checks constrain the syndrome to zero. The formula replaces a search over fault histories by a search over parity-flipping vectors . It also yields a criterion for selecting endpoint checks and the minimum number of copies of each adjacent-column check in square Bacon–Shor and generalized Shor readouts.
For a gauged readout, we combine these checks with redundant pair products of the Gauss outcomes. The exact joint distance separates a measurement-record bottleneck from a persistent-data bottleneck. Within the family of fixed adjacent-column checks and Gauss pair products, we minimize the outcome count over allocations and round counts. At target distance , one round uses outcomes, compared with for the repeated baseline in the same phenomenological model. A separate circuit bound identifies low-weight accepted errors from the timing of the CNOTs and supplies a necessary condition for preserving distance with bare ancillas.
These results build on data-syndrome coding. Ashikhmin, Lai and Brun encode syndrome bits through redundant stabilizer products and include repeated measurements as a repetition-code special case [11]; Fujiwara also studies protection against data and syndrome errors [12]. Generalized data-syndrome codes represent accumulating data faults and noisy syndrome records across multiple rounds [13]. Here the quantity optimized is a selected logical parity under an explicit acceptance and readout predicate. The resulting contributions are the exact threshold-dependent spatial reduction, the minimum Shor-family check allocation, and the joint outcome-count optimum for the specified gauged-readout family. The CNOT bound then tests whether a chosen schedule can preserve that phenomenological distance.
Williamson and Yoder establish the gauging construction and its spatial, temporal and spacetime bounds under explicit construction and boundary assumptions [10]. The present readout and circuit results have direct proofs; the Supplemental Material also provides formalized algebraic results and code examples that separate graph, boundary and check-redundancy effects.
Section II proves the general distance formula and check allocation, Section III gives the joint gauged-readout distance and measurement count, and Section IV establishes the circuit scheduling bound. The Supplemental Material [14] gives the proofs, verification scope and reproduction commands.
Exact distances and check allocation
We first solve a repeated-readout problem for an arbitrary binary matrix. The same formula then determines which checks to repeat in a Shor-family readout.
Fault model and readout predicate
We call the model with accumulating data errors the persistent-fault readout model. Rounds are indexed by , with . For the general model, let be a binary check matrix with columns and let be a nonzero parity support. In each round, is a new data error, is a readout-record error, and is a check-result error; each nonzero bit is one independent fault location. The data errors persist, so . The checks and logical parity use the same noisy record , with independent check-result flips added afterward:
Here collects the check-result error bits, and means that the round readout differs from the ideal logical value. This shared record explains why enters both expressions. (1) defines a phenomenological model; a circuit realization must specify observables and fault propagation that produce these effects. With a boundary constraint, the detectors require and for . Without it, they impose only the adjacent comparisons. Let mean that a fault fires no detector. The distance for an undetected strict-majority error is
Ties are outside this predicate. To compute a decoder failure distance, one must specify the decoder’s observed inputs and its decision or rejection rule, including ties.
A spatial minimum for a multiround fault problem
The exact distance has a closed form for any threshold of wrong readouts. For , let minimize the number of fault locations over detector-free patterns with at least wrong readouts. With the model in (1) and the zero-syndrome endpoint constraint, we prove
Theorem 1 Exact repeated-readout distance. For every binary matrix , nonzero , positive , and ,
In particular, strict majority uses , so .
To see the lower bound, choose the wrong round with the fewest transient faults among the at least wrong rounds. If in that round, zero syndrome gives and a wrong readout gives . If , then is no greater than the total transient-fault cost in the wrong rounds. Also, and is at most the total data-fault cost. Together these inequalities give no greater than the total fault weight. For the upper bound, introduce one minimizing data error at the start of the final -round block and cancel with check-result faults in those rounds. The full proof is in the Supplemental Material, Supplemental Sec. S2.
The theorem removes the time history from the minimization. The vector specifies a parity-flipping error in one round, and is the cost of hiding its syndrome in wrong rounds. No longer history can give a cheaper undetected pattern. At , the expression is the parity-restricted binary data-and-syndrome minimum: the undetected pair is [11]. Equation (3) identifies when the multiround problem reduces exactly to that weighted spatial minimum.
Which endpoint checks are needed?
Removing the boundary syndrome constraint reduces the distance to one for every . One data fault in the logical support, introduced in the first round, persists through all later rounds. Every round then has the same syndrome, so adjacent-round comparisons detect nothing while every readout is flipped. More generally, let be any check matrix and let be a nonzero linear parity readout on the data. Choose a coordinate with and introduce the unit error in the first round. This weight-one fault is undetected by adjacent comparisons and flips every readout. Since a zero-weight fault cannot flip a linear readout, the distance is exactly one. Thus boundary collapse follows from error accumulation and comparison-only detection, for any original code distance.
The zero-syndrome constraint can be imposed at either endpoint. Adjacent comparisons make all syndromes equal, so requiring either the first or the last syndrome to vanish forces all of them to vanish. Requiring a zero syndrome at the second endpoint gives no further restriction on undetected faults in this model.
The endpoint constraint acts on the total syndrome, so fault contributions may cancel there. The source convention and its surrounding error correction are described under C3 in Supplemental Sec. S5.
The endpoint need not constrain every syndrome bit. Suppose adjacent comparisons still use the full syndrome , but an endpoint checks only for a binary linear map . Define and assume this set is nonempty. For strict majority, the resulting distance obeys
It equals when . Thus, for a target , the endpoint map must detect every parity-flipping vector below weight ; this condition is also sufficient once . The proof and the cases where the bound is not tight are given in Supplemental Sec. S2.
Minimum repetitions for Shor-family checks
For the square Bacon–Shor and generalized Shor families with , the exact formula also determines how often to measure each adjacent-column check. Let be the parity of the data error in column , so the logical readout is and check measures for . If check has independent copies per round, then
The copy counts are the componentwise minimum that gives distance within this fixed family of checks. They allocate more repetitions to checks closer to the selected readout column. The derivation appears in Supplemental Sec. S2.
Measurement allocation for gauged readout
Gauging measures a logical Pauli operator through the product of local Gauss-check outcomes [10]. We combine those outcomes with the repeated-check formula to protect both the data and the measurement records.
An -type gauging graph places a vertex on each data qubit in the measured logical support and an edge ancilla in on each edge. Its Gauss check is . Multiplying all Gauss checks cancels every edge factor, leaving the original logical operator. These are checks on the enlarged system; measuring the original stabilizers alone does not measure that logical operator. Figure 1 shows the check supports and a constant measurement-error history. The complete gauging construction also includes the deformed original checks and cycle checks [10]. For its spatial guarantee, the source uses the sufficient graph condition C1, for every vertex set , together with the check-completion hypotheses. The readout model below specifies the original-check and Gauss records explicitly; Supplemental Sec. S4 gives the full construction background.
Let be the commuting Gauss checks whose product is the logical operator . Use a separate simple graph to choose additional pair products for measurement. This graph is independent of the auxiliary graph used to construct the gauged code. If is the vector of original Gauss outcomes, the added records are the pair parities for edges . Same-round detectors check each pair result against its two original outcomes.
With independent outcome flips and fault-free data, an undetected logical flip is a set of original outcomes and the pair outcomes on its cut . Its weight is , and it changes the logical result exactly when is odd. The minimum measurement-only distance is
For repeated rounds with adjacent comparisons of the original Gauss outcomes, the distance is . Consequently, reaching single-round distance requires at least pair-product measurements; a simple graph attaining this count exists for every such and . The proof and graph constructions are in Supplemental Sec. S2.
We now combine these records with persistent data and auxiliary-edge errors. Let restrict the original data error to the qubits in the measured support, and let be the vertex-edge incidence matrix of the gauging graph . Thus and : the Gauss product reads the selected parity, and each edge ancilla touches two vertices. Let be the original -check matrix with the chosen repeated adjacent-column checks, and let encode the original Gauss outcomes and pair products. Here . and are the cumulative -type errors on the original data and edge ancillas through round . Each round also has independent result errors on original checks and independent result errors on the encoded Gauss records. Each new data or edge error bit and each result-error bit counts as one fault location. All syndrome and Gauss-record vectors in this model are flips relative to the fault-free measurement history.
Proposition 1 Exact joint gauged-readout distance. In the persistent-fault model above, let and use a zero-syndrome endpoint check, adjacent-round syndrome and Gauss-record comparisons, and same-round pair consistency. An accepted wrong readout has one fixed vector with in every round, and its exact minimum fault weight is
Here means the encoded Gauss records are mutually consistent and unchanged between rounds, and a wrong logical result has . The first term is the cost of repeating an odd-parity Gauss-result error; the second is the cost of hiding a persistent data error from the original checks in every round. The proof appears in Supplemental Sec. VII E.
For the square Shor-family instance, the exact distance gives a resource optimum within the family that repeats fixed adjacent-column checks and adds pair products.
Corollary 1 Minimum outcome count. For the square Shor-family readout with , use the joint model of Proposition 1 and the same measurement allocation in every round. Allow the Gauss checks, at least one independent copy of each fixed adjacent-column check, and pair products selected by a simple graph . At target distance and , the minimum total outcome count is
It is attained by and a pair graph with minimum degree and edges. Over all positive round counts, one round uniquely minimizes the total at outcomes.
For , the Gauss outcomes per round already cost . The proof of the minimum for , the attaining allocations and the bound in Eq. (8) appears in Supplemental Sec. VII F. The repeated baseline with measures the Gauss checks and all adjacent-column checks in every
round, for outcomes. For , these counts are 25 and 45 at the same phenomenological distance five. The quantity compared here is the number of measurement outcomes in the stated model; gate, ancilla, deformed-check and surrounding-round resources are outside this count. The next section gives a circuit scheduling bound for a bare-ancilla implementation of this measurement family.
A circuit scheduling bound
Figure 2 illustrates an accepted one-gate fault in a serial readout with three Gauss checks.

Figure 2. A consistent wrong record caused by one gate fault. (a) For three Gauss checks and their three pair products, the displayed vectors are flips relative to the ideal records, with pair order (01, 02, 12). The Gauss errors (1, 0, 0) and pair errors (1, 1, 0) satisfy every pair-consistency relation but flip the logical product; the three original-check records have zero error. (b) A serial schedule measures all original checks, then the Gauss checks, then the pair products. The drawing shows one Gauss-ancilla CNOT on the selected support qubit ; the blocks denote complete stages, with other interactions omitted. A on both CNOT qubits immediately after the gate flips and propagates to the later pair-product controls. There is no later original check and no earlier pair check on , so and the circuit distance is one by Proposition 2. For the distance-three Shor allocation, the same measured-check family has phenomenological distance three. OpenAI Codex assisted the drawing code and layout; see Section VI.
The outcome-count optimum treats data and result faults as independent locations. In a circuit, one gate fault can create both, and the order of the checks matters. We now give a bound for a specified one-epoch implementation of the same measurement family. The fault-free input is an original-code state with the gauging edge ancillas initialized in .
Each original check, Gauss check , and selected pair product is measured once using its own bare ancilla. Every ancilla starts in , controls one CNOT to each qubit in its check support, and is measured in after its last CNOT. The CNOTs may be interleaved in any order that uses each qubit at most once per time step; data and edge qubits are always targets, and no other gates or error-correction rounds are inserted. The detectors are the original-check results and the same-round pair-consistency relations. We count a Pauli fault after a CNOT as one location and each independent outcome flip as one location. The allowed gate faults include on the target and on both control and target. The numerical search also includes initial Pauli faults on original-data and edge qubits and preparation faults on extraction ancillas; each faulty input qubit or preparation counts as one location. An accepted wrong readout passes these detectors but reverses the product of the Gauss outcomes relative to the fault-free circuit.
For each support qubit , consider a CNOT on no later than its CNOT with the ancilla. Let count original-check CNOTs on strictly after , and let count pair-product CNOTs on strictly before . Independent copies of an original check are counted separately.
Proposition 2 Schedule-dependent circuit bound. For any valid schedule in the circuit family above, its accepted-wrong readout distance obeys
To construct the fault, insert target after ; also insert control at the same location if belongs to a Gauss or pair-product check. This flips the result and every later check on . If is a pair-product CNOT, the control also flips that pair result. Cancel the affected original-check results and flip the earlier pair results. The Gauss record now differs by the unit vector at , and every pair record agrees with it. All detectors vanish and the logical product is wrong, with the weight in Eq. (9). The Supplemental Material gives the full Pauli-propagation proof.
This bound gives a necessary condition on a distance- implementation: at every eligible gate. For example, a serial schedule that measures all original checks, then all Gauss checks, then all pair products has at a Gauss CNOT. Its distance is exactly one, even when the independent-outcome model has distance . Thus the measured-check family alone does not determine the circuit distance; the checks must also detect errors introduced during extraction.
Backward Pauli propagation gives exact distance three for the best tested and schedules among 1,024 schedules of each size. Equation (9) also gives three for both schedules, so explicit three-fault patterns attain the bound. At , flipping all three Gauss outcomes leaves every pair relation unchanged and reverses the logical product. This witness applies to every schedule in the circuit family, so the saved distance-three schedule is optimal within that family. At , one final-outcome flip and two target- gate faults give the accepted wrong readout listed in Supplemental Sec. VIII. The value three is the largest found in the finite test set, below the target distance five; the complete schedules and fault locations are given in Supplemental Sec. S3. Deformed checks, cycle checks, flagged ancillas and surrounding error-correction rounds require their own detector and fault analysis.
Examples and design implications
The general formulas distinguish the effects of the readout predicate, the check allocation and the auxiliary graph. We illustrate these effects with a nine-qubit readout, a distance-five allocation, and two gauged codes on the same measured support.
A nine-qubit readout with persistent faults
We specialize the persistent-fault model of Section II to the nine-qubit Bacon–Shor readout. The Bacon–Shor distance three refers to its protected subsystem; this readout tests the selected logical parity using two -type stabilizer checks. The nine-qubit Bacon–Shor instance used in Table I has , two check rows and qubit labels on a three-by-three grid. Its two rows of have supports and , and .
In the measurement-fault model, each fault flips an independent measurement outcome, and the detectors compare consecutive logical parities.
The persistent-fault model also permits ties at two rounds. At two rounds, a final-round data fault on qubit zero and a canceling check-result fault give with zero syndromes and weight two. A first-round readout fault and its canceling check-result fault instead give . Table I collects the four model choices and their independently reproduced values.
For the original two checks, Eq. (5) at gives . Strict majority therefore has distance two at and three for every . At one round, a data error on qubit zero changes the logical parity and one check; a check-result flip hides that syndrome, giving weight two. Duplicating the first check changes the allocation to and makes . An error on the readout column must then be hidden in both copies, while a weight-three logical data error gives the matching upper bound. This raises the one-round distance by adding one independent check-result location, without changing the static check row space.
Figure 3 compares this readout with two other models. The measurement-only model compares consecutive logical parities and requires a wrong answer in every round, giving distance . The persistent-fault model uses syndrome comparisons and the strict-majority predicate, so its relevant threshold is . Removing its endpoint constraint admits a constant nonzero syndrome and gives distance one. A second implementation recomputes the figure, and all twelve of its points are exactly the proved ones, four on each curve. The circuit and joint gauged-readout analyses use their separately stated record-consistency predicates; their distances should be evaluated with those predicates.

Figure 3. Exact distances for the three Bacon–Shor models in Table I. The blue circles show : two at one round and three for . Deleting the endpoint syndrome constraint gives the green triangles at one for every positive . Orange squares show the measurement-only distance . The dotted line is the static code distance ; shading spans the region down to the no-boundary curve. Independent enumeration reproduces all twelve values, each certified in Lean. OpenAI Codex assisted the drawing code and layout; see Section VI.
Allocating measurements at distance five
For , Table II makes the outcome-count optimum concrete. At , the original adjacent-column checks have copy counts , and the pair graph is complete. The ten original-check outcomes, ten pair outcomes and five Gauss outcomes give 25 in total. At , a five-cycle pair graph gives , while the original-check allocation is . This uses 16 outcomes per round and 32 overall. At , pair products are unnecessary and each original check is measured once per round, giving the repeated baseline of 45. Each entry reaches the same target distance five in the joint phenomenological model. The comparison counts these measured records; Proposition 2 separately tests the timing of a bare-ancilla implementation.
Spatial distance and readout distance
The auxiliary graph defines the deformed quantum code, whereas chooses the redundant Gauss-result measurements. Their distance statements concern differ… ent fault sets. The spatial distance tests all nontrivial logical operators of the deformed code; the readout distance tests faults that change the selected result while passing its detectors.
| Model | Fault locations | Detectors | Error criterion | Distances |
| Measurement only | Measurement outcomes | Logical comparisons | Constant logical flip | 1, 2, 3, 4 |
| Persistent faults | Data, check results, readout | Boundary and syndrome comparisons | Strict majority | 2, 3, 3, 3 |
| No boundary constraint | Data, check results, readout | Syndrome comparisons | Strict majority | 1, 1, 1, 1 |
| Last-round control | Data, check results, readout | Boundary and syndrome comparisons | Last readout wrong | 2, 2, 2, 2 |
Table 1. Readout models and exact distances at rounds. Data faults persist; check-result and readout faults act in their own round. The boundary constraint is ; syndrome comparisons impose . Logical comparisons instead require consecutive logical readouts to agree. The first three rows’ twelve values are certified in Lean; the last row is a numerical control.
| Pairs/round | ||||
| 1 | 5 | (4, 3, 2, 1) | 10 | 25 |
| 2 | 3 | (2, 2, 1, 1) | 5 | 32 |
| 3 | 2 | (2, 1, 1, 1) | 3 | 39 |
| 4 | 2 | (1, 1, 1, 1) | 3 | 48 |
| 5 | 1 | (1, 1, 1, 1) | 0 | 45 |
Table 2. Minimum outcome counts at target distance five within the fixed adjacent-column and Gauss-pair measurement family. is the round count, is the Gauss-record distance per round, lists the adjacent-column check copy counts, and is the total number of outcomes. The five Gauss outcomes per round are included in every total.
For a stabilizer code, denotes physical qubits, encoded qubits and distance . Two paths on the same weight-four logical support of the toric code illustrate the spatial distinction (Figure 4). Both paths violate C1, because a two-vertex set has only one outgoing edge. One path gives physical X-type distance one and physical Z-type distance five. The other has physical X-type distance two and no weight-one logical on either side, so its total distance is two. The source’s sufficient expansion condition does not determine the exact distance of each construction below its threshold. Supplemental Sec. S7 gives the check completions and finite census.

Figure 4. Two paths on the same weight-four support of the toric code give different deformed-code distances. Vertex numbers label data qubits; each edge adds one ancilla. Both paths fail C1 at a two-vertex cut with one outgoing edge. Braces show the physical X-type distances: one and two. The corresponding physical Z-type distances are five and at least two, so the total distances are one and two. For the left path, a zero Z-check column and the corresponding unit vector outside the X-check row space give the weight-one logical operator. OpenAI Codex assisted the drawing and layout; see Section VI.
For the distance-one path, a zero column of the deformed Z-check matrix and a unit vector outside the X-check row space identify the weight-one logical operator. The zero column means that no Z check detects it; the row-space condition means that it is not a product of X stabilizers. This matrix test concerns the deformed static code. The weighted formula and circuit bound additionally account for record faults and the order of extraction.
Verification and reproducibility
The general readout, allocation and circuit statements have direct proofs in the Supplemental Material. Independent dynamic programs check the readout formulas on finite instances, and backward Pauli propagation checks the circuit witnesses and saved schedules. Supplemental Sec. S3 specifies the circuit fault locations, complete schedules and minimum-weight witnesses. The separate Lean arithmetic project verifies five lemmas used in the resource count. The algebraic and finite code results in the supplement are supported by the main Lean development; Supplemental Sec. S7 reports its axiom audit. The general matrix theorems and circuit proposition are established by the direct proofs, rather than by that formal audit.
Conclusion
The weighted minimum gives the exact distance for a threshold of wrong readouts in the persistent-fault model. It turns measurement allocation into a spatial problem: an error costs its data weight plus the cost of hiding its syndrome in the required wrong rounds. The endpoint criterion and Shor-family allocation make this relation explicit.
For gauged readout, the joint distance separates persistent-data faults from measurement-record faults and gives the one-round outcome-count optimum within the stated measurement family. The circuit scheduling bound identifies how a gate fault can connect those two mechanisms during extraction. Together, the exact formula, allocation rule and explicit circuit witnesses give conditions for designing and auditing logical Pauli readouts at the model and circuit levels.
Acknowledgments
This work was supported by the National Natural Science Foundation of China under Grant No. 12674609 and by the Guangdong Provincial Key Laboratory of Computility Microelectronics under Grant No. 2024B1212010007. The authors declare no competing interests. The authors used DeepSeek-V4.1-Flash for text polishing, the Lean derivations, and the debugging of individual numerical values. They also used OpenAI Codex (GPT-6) for manuscript revision, literature checks, numerical cross-checks, formal-proof exploration and figure-code preparation. The authors are responsible for all of its content.
Author Contributions
All authors contributed equally to this work.
Data availability
The formal development and baseline numerical data are archived on Zenodo [15], together with a last-round-readout control and its regression tests. The readout-analysis scripts, selected CNOT schedules and fault witnesses are provided as Supplemental data and code. The Supplemental Material [14] identifies the formal statement supporting each claim and explains how to reproduce every numerical value. The formal layer beneath these results is released as a separate package [16].
References
Supplemental material: Exact distances and measurement allocation for logical Pauli readout
S1 How to read this supplement
All references cited here are listed in the bibliography of the main article.
The first proof section establishes the general readout formula, endpoint bounds, measurement allocations and circuit scheduling bound. The next section specifies the circuit fault model, full best-tested schedules and explicit accepted-error witnesses. The remaining sections identify the Lean statements supporting the algebraic and finite results, give the cosystolic-distance and surgery analysis, and present step-by-step protocol derivations. The final sections state the conventions, report the axiom audit and provide reproduction commands.
S2 Readout-distance and allocation proofs
This section proves the weighted repeated-readout formula, the selected-endpoint bound, the Shor-family check allocation and the pair-product results used in the main text. These statements concern the fault models defined there. The general matrix formulas are proved directly here; the separate Lean project certifies arithmetic lemmas used in the resource bound, not the full matrix theorems.
Exact distance for a threshold of wrong readouts
Let be the total persistent data-fault cost and let be the transient cost in round . Consider a detector-free fault pattern with at least wrong readouts. Among those rounds choose with minimum , so . Set . The zero-syndrome condition gives , and the wrong readout gives . Also, . Therefore, by the definition of , we have , where the penultimate inequality uses . This is the lower bound on total fault weight. For the matching upper bound, choose minimizing subject to , introduce one data error at the start of the final -round block, and set in those rounds. Set all other faults to zero. Then exactly those readouts are wrong, every syndrome is zero, and the fault weight is . This proves Eq. (3) for all binary , nonzero , and .
Selected endpoint checks
Suppose adjacent comparisons constrain the full syndrome, while one endpoint checks only . Since the comparisons make constant, the accepted syndrome lies in . Let be the minimum weight of a data vector satisfying and , and assume this set is nonempty. An initial data error attaining has a constant syndrome in and flips all readouts, so .
For the lower bound, suppose a detector-free fault has total weight and at least wrong readouts. If it contains a data fault, then every wrong round must also contain at least one transient fault. Indeed, a wrong round with would have , , and , a contradiction. The data fault and the required transient faults in distinct rounds would give , also a contradiction.
If there are no data faults, then a wrong round cannot be produced by a single check-result fault, since does not enter . A single readout fault would have to satisfy and , which would imply ; this is incompatible with for any nonzero fault. Thus every wrong round costs at least two transient faults. The wrong rounds then cost at least . This contradiction proves . The equality when follows by combining the two bounds. For a target , the condition is necessary; together with , it is sufficient.
The lower bound need not be tight. At , the Shor allocation with has and exact distance , whereas the bound is only two for . The exact value follows from the allocation formula proved next.
Adjacent-column check allocation
For the square Shor-family readout with , write for the parity of the data-error bits in column . The logical readout error is , and check has syndrome . If this check is measured in independent copies per round, its row appears times in , with an independent check-result fault bit for each copy.
Consider any data error with . If every , at least one data bit is needed in each of the columns, so its weight is at least . Otherwise, let be the first column with . The first column parities are odd, requiring at least data bits, and check has nonzero syndrome in all copies. To hide this syndrome in at least wrong readout sequences requires at least check-result faults. Hence the weighted cost is at least . Conversely, one data error in each of the first columns and none in later columns makes check the only nonzero adjacent-column syndrome; canceling its copies in the final rounds attains . Taking the least of these witnesses and the all-odd-column witness proves Eq. (5).
The condition that this distance be at least is exactly for every . Since must be a positive integer, the componentwise smallest allocation is . Summing over gives check-result locations per round. This is optimal only within the family that repeats these fixed adjacent-column checks.
Pair products and their distance
Let be a simple graph on the Gauss-check labels. For a set of original outcomes flipped in one round, consistency of the pair records forces exactly the outcomes on the cut to flip as well. The logical product is wrong if and only if is odd. Thus the one-round distance is the minimum of over odd sets.
Write and . The singleton consisting of a minimum-degree vertex has cost . For the converse, when , the sum of degrees in is at least , while at most of this sum can come from internal edges. Therefore and the same count gives , where the last inequality follows from . When , the original outcome flips already cost at least . This proves Eq. (6).
For target distance , the graph must have minimum degree at least , so the degree sum gives . This lower bound is attainable. Put . If is even, an -regular circulant graph exists: connect each vertex to its nearest neighbors on each side when is even, and add the antipodal matching when is odd and is even. If both and are odd, first form the -regular circulant graph on the odd cycle and remove a matching covering all but one vertex; the unmatched vertex has degree and all others have degree . The result has the required minimum degree and exactly edges.
Under repeated adjacent comparisons, a detector-free encoded outcome must be the same in every round. If , each round costs at least , and repeating a minimum-weight odd attains the bound. The measurement-only distance is therefore .
Joint gauged-readout distance
This subsection proves Proposition 1 of the main text. Write for the original-check matrix with its repeated rows.
Use for the total number of persistent data and edge-ancilla fault bits, and let be the result-fault cost in round . Consider a detector-free pattern with odd output vector . In a round with , the original-check constraint gives , so the repeated-readout formula implies .
In a round with , the vector has odd parity: , , and . Since , we have , and therefore . In either case, . Averaging over all rounds gives the lower bound by the total fault weight .
Both terms are attainable. For , repeat in every round an outcome-fault vector attaining for odd , with no data faults. For , introduce a minimizing data error in the first round, set in every round, and set the edge and encoded Gauss-result faults to zero. The output is then the constant odd vector . These witnesses prove Eq. (7).
Outcome-count optimum
This subsection proves Corollary 1 of the main text within the stated measurement family.
At , there is one Gauss check and no original or pair checks, so target distance one is reached at a cost of outcomes. We henceforth take .
For target distance and , the Gauss-result code must have . The graph bound above shows that the fewest pair outcomes are obtained with edges. The path formula shows that the fewest adjacent-column check outcomes per round are obtained with , whose sum is . Adding the original Gauss outcomes per round proves the exact count in Eq. (8).
For the lower bound on this count, , and . Thus . The value is attained at ; for the lower bound is strictly larger. At , the construction has no pair-product edges, one copy of each adjacent-column check, and total outcomes.
These outcome counts do not include every gate, ancilla, deformed check or surrounding error-correction round. A commuting -type check can be measured with a ancilla, controlled CNOTs to its support, and an measurement of the ancilla. Measuring a pair product adds a consistency result without changing the joint eigenspaces already fixed by the individual commuting Gauss checks. State-vector and projector comparisons verified this ideal measurement map for the tested four-cycle examples.
For , the required original Gauss outcomes per round give a count at least before any other checks are added. Together with the bound for , this proves the one-round optimum over all positive round counts within the specified family.
Circuit scheduling bound
We use exactly the one-epoch circuit family and detectors defined in main-text Section IV. All extraction ancillas are controls, all original and edge qubits are targets, and each check uses a distinct ancilla prepared in and measured in . There is one CNOT for each nontrivial check-support entry. For a readout-support qubit , its incident checks are , the pair products indexed by edges of incident to , and the original checks whose supports contain .
Fix an eligible CNOT on at or before its interaction. Insert on immediately after . If belongs to or a pair-product check, include on its control at the same gate-fault location; if belongs to an original check, leave the control unchanged. Under a later CNOT with control and target , conjugation maps to . The accumulated flips that ancilla’s final result, and it commutes with the ancilla’s other CNOTs. The fault therefore flips every subsequent check interaction on . If precedes the Gauss interaction, that later interaction flips ; if is the Gauss interaction itself, the control flips . No other original Gauss outcome flips.
For each pair product incident to , an interaction after flips its result through propagation. If is itself a pair interaction, the control flips that result. The only missing pair flips are thus the pair interactions strictly before . Insert an independent outcome flip at each of those measurements. The Gauss and pair record is then exactly , so every pair-consistency detector is zero and the logical product is wrong. The original checks strictly after are the only original-check results changed by propagation; cancel each by one outcome flip. An original check at itself has no control and remains correct. All original-check detectors now vanish as well. The pattern occupies one CNOT location and distinct measurement locations. Minimizing over eligible gates and support vertices proves Eq. (9).
This construction is valid for arbitrary interleavings in the stated family, because each original or edge qubit is a target and each check has its own control ancilla. It proves an upper bound, not a converse: satisfying its necessary timing inequalities does not guarantee the target distance. In the serial original-check/Gauss/pair schedule, a Gauss interaction has no later original check and no earlier pair check. The constructed one-location fault is accepted and wrong; with fault-free input, zero faults cannot change the ideal logical product, so the distance is exactly one.
We also searched one-epoch CNOT circuits for and , including the original checks, pair products, input Pauli faults, CNOT Pauli faults and outcome flips. The generated test set contains 1,024 schedules at each size. The largest accepted-wrong readout distance found was three at both sizes. The best schedule therefore retains its phenomenological target distance, while the best tested schedule has distance three rather than five. An independent backward Pauli calculation reproduced the fault signatures and minimum-weight witnesses for the best schedules. The witnesses from Eq. (9) attain weight three on both best schedules. The schedule bound applies to the entire defined circuit family, while the reported best distances refer to this finite test set. The tested fault model includes the original checks, pair products and listed Pauli and outcome faults; it leaves out the deformed checks, cycle checks and surrounding error-correction rounds.
Finite dynamic programs test the repeated-readout, partial-endpoint and joint gauged-model formulas on 29,232, 9,198 and 4,608 instances, respectively; the general statements follow from the proofs above. The separate Lean development verifies five arithmetic lemmas in the resource analysis. The matrix theorems and circuit scheduling bound have direct proofs above; the optimum over tested schedules refers to the stated finite search.
S3 Circuit fault model, schedules and witnesses
Fault locations and detector signatures
The numerical search uses the one-epoch circuit family in main-text Sec. IV, with complete graphs for both the gauging graph and the pair-product graph at . Original data qubits are indexed by for , and the readout support is column . Edge-ancilla indices start at and follow lexicographic order of the unordered pairs of row labels. Extraction-ancilla indices enumerate the measured checks: the Gauss checks first, the pair products in lexicographic order next, and then copies of adjacent-column check for . All tabulated indices are zero based; a layer index is one based.
Fault locations are initial original-data or edge-qubit Pauli errors, extraction-ancilla preparation errors, Pauli errors immediately after a CNOT, and independent flips of a final ancilla outcome. Each faulty preparation, input qubit, CNOT or outcome is one location; a two-qubit Pauli after a CNOT still counts as one location. No idle faults, deformed checks, cycle checks or surrounding error-correction rounds are included in this numerical model. For the final records, the components of a Pauli commute with the backward-propagated observables. The record signatures therefore depend only on the components. Control is equivalent to a single flip of that ancilla’s final outcome; target flips all later extraction controls acting on the target; their product gives the third nonzero gate signature. An extraction preparation error has the same relevant signature as an outcome flip or has zero signature. Thus the input-, outcome, target- and control-target- channels cover the record effects of all allowed Pauli faults.
The detector signature consists of all original-check reresult errors and the pair-relation errors . The logical signature is the parity of the original Gauss-result error vector. An accepted wrong record has zero detector signature and logical signature one. The minimum-weight search operates on these signatures; the general schedule bound is proved independently in Sec. VII G.
Explicit witnesses and exactness checks
For , the three outcome faults , , flip every Gauss record. Each pair parity remains unchanged, and the odd number of Gauss flips reverses the logical product. This weight-three outcome witness applies to every schedule in the defined family, so a schedule with exact distance three also maximizes the distance over that family. For , the target- fault flips the later record, its four pair records, and original-check records 15, 17 and 18. The target- fault flips original-check records 17 and 18, canceling those two errors. The outcome fault cancels the remaining original-check error. Both witnesses therefore have weight three and give a consistent odd Gauss record with no detector response.
Independent backward Pauli propagation checks every stored channel. For either saved schedule, neither one channel nor any pair of channels has the accepted-wrong signature. Together with the explicit witnesses, these tests establish the exact distances of the saved schedules in the stated fault model. The bound of Proposition 2 gives matching upper bounds on both schedules; satisfying its necessary inequalities alone would not establish either lower bound.
Complete best-tested schedules
The generated test set contains 1,024 valid schedules per size, obtained by decomposing the padded regular bipartite check-support incidence graph into perfect matchings. The search uses Julia 1.12.7 with MersenneTwister seeds 1 through 1,024 at each size. The largest exact distance within each set is three. The saved schedule (seed 145) uses 12 input qubits, 9 checks, 6 CNOT layers and 39 CNOTs. Its exact distance is three, attained by the outcome faults , , . The saved schedule (seed 2) uses 35 input qubits, 25 checks, 10 layers and 205 CNOTs. Its exact distance is also three, attained by and the two target- gate faults and . The schedules below list every CNOT as a target qubit with its execution layer, grouped by extraction ancilla. This grouping specifies the full schedule without relying on the seed or its random-number generator. The machine-readable check supports, layers and fault signatures are included in the Supplementary data and code at gate_schedule_m3.json and gate_schedule_m5.json. Table S1 and Table S2 give all CNOT layers for the two saved schedules.
| Measured check | Target qubit @ layer | |
| 0 | , , | |
| 1 | , , | |
| 2 | , , | |
| 3 | , , , | |
| 4 | , , , | |
| 5 | , , , | |
| 6 | , , , , , | |
| 7 | , , , , , | |
| 8 | , , , , , |
Table S1. Complete CNOT schedule for . For each extraction ancilla , means a CNOT with control and target in layer . Gauss labels are , pair labels are , and is copy of adjacent-column check .
| Measured check | Target qubit @ layer | |
| 0 | , , , , | |
| 1 | , , , , | |
| 2 | , , , , | |
| 3 | , , , , | |
| 4 | , , , , | |
| 5 | , , , , , , , | |
| 6 | , , , , , , , | |
| 7 | , , , , , , , | |
| 8 | , , , , , , , | |
| 9 | , , , , , , , | |
| 10 | , , , , , , , | |
| 11 | , , , , , , , | |
| 12 | , , , , , , , | |
| 13 | , , , , , , , | |
| 14 | , , , , , , , | |
| 15 | , , , , , , , , , | |
| 16 | , , , , , , , , , | |
| 17 | , , , , , , , , , | |
| 18 | , , , , , , , , , | |
| 19 | , , , , , , , , , | |
| 20 | , , , , , , , , , | |
| 21 | , , , , , , , , , | |
| 22 | , , , , , , , , , | |
| 23 | , , , , , , , , , | |
| 24 | , , , , , , , , , |
Table S2. Complete CNOT schedule for . For each extraction ancilla , means a CNOT with control and target in layer . Gauss labels are , pair labels are , and is copy of adjacent-column check .
S4 Setting: gauging a logical measurement
Related constructions and formal developments
Related constructions include auxiliary-graph surgery [42], homological measurement [43], adapters between code blocks [28], and auxiliary-hypergraph surgery [18]. Parallel measurements [27], parsimonious surgery [26] and lifted surgery [44] address concurrency, ancilla overhead and fast logical operations. Gauging also supports higher-form transversal gates [29] and magic-state preparation [35]; gauge measurements enable code switching [41]. Spacetime codes describe circuit faults and detectors [21, 30], and gauging has been applied directly to them [17]. QECCLean provides Lean formalizations of foundational quantum-error-correction constructions [24], while Lean-QEC formalizes stabilizer-code theory and machine-checked distance certificates [23]. Our development also treats repeated readouts, persistent faults and boundary detectors. The distance statements provide inputs to fault-tolerance analyses with specified noise models and decoders [6, 20, 32].
Check matrices and the two components
A logical measurement has two useful descriptions: an effective code on the original data qubits and an enlarged code containing the gauging ancillas. We write for a code with physical qubits, logical qubits and distance . For the effective description, take a CSS code with binary check matrices satisfying . We use physical Pauli labels and for the minimum weights in and , respectively. The formal library names these quantities and , indexing them by the kernel matrix; Section S13 records this conversion. An -type logical operator is a vector , meaning , that cannot be written as a binary sum of the rows of . Conditioning on the measured eigenvalue adds to the effective checks. The new check commutes with the checks and is independent of the original rows, so the resulting CSS code has one fewer logical qubit. For example, the length-three repetition code has two adjacent-pair checks and no check. Adding its all-ones logical vector as an check leaves no logical qubit.
The physical gauging construction realizes this measurement by adding ancilla qubits and local checks. Its auxiliary graph has one vertex per qubit in the support of and one ancilla per edge. Each vertex has a Gauss-law check , acting on that vertex and its incident edges. Every edge ancilla appears in two Gauss checks, so multiplying all Gauss checks cancels the edge factors and leaves . Completing the construction requires the deformed original checks, cycle checks and gauge initialization specified in the source. The spatial distance minimizes the weight of nontrivial logical Pauli operators of the full deformed code, including original and auxiliary qubits. Measuring one independent logical Pauli operator leaves logical qubits from an original . Our formalization starts from the resulting check matrices and proves their algebraic properties. Section S6 computes the enlarged codes including their ancillas; the single-row argument above explains the loss of one logical degree of freedom on the original qubit set.
To isolate the role of repeated measurements, the temporal model assigns one measurement-fault bit to each of rounds. Its fault class consists of independent measurement-outcome flips, detected by comparisons between adjacent rounds. A nonzero fault that passes every comparison must occupy every round, so its weight is exactly . If the chosen linear readout returns one on this constant pattern, the temporal fault distance is . This is the repetition mechanism behind Supplementary Lemma 3 of the gauging paper, whose round count is . Theorem 3 and Eq. (12) state this identity; Section S7 separately studies models with persistent data errors.
The spatial and temporal theorems
Theorem 2 spatial X-type component. Let the auxiliary graph be loop-free and have expansion at least one. Assume every vector in outside the row space of has weight at least . The weight of an operator is the number of qubits on which it acts. Assume the deformed code has the following check-matrix structure. The Gauss laws are checks, and the lifted original checks belong to the deformed check space. Each original check has a deformed partner that differs only on edge qubits. The deformed checks include a cycle basis of the auxiliary graph, and every Gauss law commutes with every deformed check. Let be an -type logical operator of the deformed code: it lies in the kernel of its checks and outside the row space of its checks. Write for its vertex support and for its support outside the auxiliary graph. Then its edge support is a cut for some vertex set with , and .
Theorem 2 bounds physical -type logical operators. A bound on the full static CSS distance also requires the -type component. The finite instances reported below check both components separately. The spatial proof identifies the edge support, removes it with Gauss checks, and bounds the remaining logical operator’s weight. First, an undetectable edge pattern has even overlap with every cycle check. Cut–cycle duality therefore makes its edge support a cut . We can choose no larger than its complement. Second, multiplying by the Gauss laws over removes this edge support: in binary support notation, their product is the mod-two sum of the vectors, with ones on and its crossing edges.
Multiplying by stabilizer checks changes the operator’s support while preserving its action on the encoded information. The cleaned operator has support on vertices and outside the graph, with no edge support. The construction hypotheses make it a nontrivial logical operator of the original code, so
Section S16 gives the coordinate proof of each step. Expansion is used only in the last inequality of Eq. (11). It bounds the number of vertex checks needed to remove the edge support by the number of edges already in that support.
Theorem 3 temporal component. Let one check be repeated over rounds, with a comparison between each pair of adjacent rounds. Every nonzero binary fault pattern that passes all comparisons is the all-ones pattern and has weight .
Write for the measurement-fault bit in round . Fault weight counts the independently flipped measurement bits. Each comparison checks , so passing all comparisons requires all bits to be equal. A nonzero binary pattern must then be one in every round. This pattern is a logical fault whenever the specified linear readout returns one on it, giving temporal fault distance . At there is no comparison, and the same identity holds:
Remark the assembly. Once both static CSS components have lower bound , a temporal distance places both the spatial and temporal distances at least . This final comparison uses the two component bounds. Applying it to the source protocol also requires the assumptions used to establish those bounds, including the relevant boundary and detector conventions. Section S14 gives the statement in the source’s notation.
S5 Checking the conditions
C1 and C2 can be checked directly from the auxiliary graph, round count and target distance. Section S6 gives exact values on two named codes, and Section S7 examines what changes when a condition fails. The two tests are
where is the set of edges leaving and is the duration of the deformation in rounds. C4 is also a finite predicate: it tests for linear dependencies among same-round checks. C3 instead specifies a boundary convention. We study its effect through related syndrome constraints in explicit fault models.
The conditions, item by item
We use C1–C4 to collect assumptions from different statements in the published supplement of Ref. [10]. Its item numbers differ from those in the arXiv version. These are separate from the source’s four requirements on the auxiliary graph. The two lists share the expansion requirement. The source also requires sparsity, constant-size matchings and a constant-weight cycle basis to keep the deformed code low-density. The resource comparison below minimizes edge ancillas subject to expansion alone.
C1: graph expansion. Every vertex set has at least outgoing edges. This is one of the two explicit hypotheses of the source’s spacetime-fault-distance theorem. Methods Remark 2 and Corollary 1 already preserve distance when the first layer has expansion at least one, even if cycle sparsification gives a final graph with expansion at most one half.
C2: enough rounds. The deformation lasts rounds. Supplementary Lemma 3 already proves that the source’s measurement-and-initialization fault distance is exactly . Supplementary Definition 3 defines spacetime fault distance, and Lemma 4 separates spatial and temporal contributions. The spacetime-distance theorem uses the smaller contribution. Theorem 3 verifies the round-count identity in our measurement-fault model. Our necessity statement allows any linear parity readout that evaluates to one on the all-ones pattern. This readout condition states explicitly when the source’s constant-pattern witness is a logical fault in our model.
C3: perfect boundary measurements. The source takes the first and last stabilizer-measurement rounds to be perfect. Supplementary Remark 3 explains this convention using the rounds of error correction before and after gauging. In that argument, a process involving both the gauging measurement and a boundary has distance greater than . Our protocol models impose an endpoint syndrome constraint: the syndrome at that endpoint must be zero. Endpoint faults are allowed when their contributions to the syndrome cancel. This defines a model without the source’s surrounding error correction, whose noisy-boundary behavior requires a separate analysis.
C4: no same-round detector. A local detector is a nonempty set of one round’s check rows whose sum is zero. C4 is an assumption used to generate the source’s detector set. Supplementary Remark 2 explains that local relations, also called meta-checks, can produce such detectors. The lemma can be extended to include them. C4 holds exactly when the check rows are linearly independent, so matrix rank decides it. A dependent set has a fixed combined ideal outcome; for example, two identical checks must have the same ideal outcome.
Expansion and ancilla count
Choosing a graph family with a proved expansion bound satisfies C1 for every family member. The complete graph is one example. If , any vertex in a nonempty has edges to the complement, which is at least . For a larger set, apply the same argument to its complement. Lean verifies this bound and supplies the expansion hypothesis of the spatial theorem.
With one ancilla per edge, uses ancillas for a measured support of size . C2 can likewise be satisfied by choosing deformation rounds. The schedule then meets C2 at the cost of measurement rounds. For the toric family, constructed from two repetition codes [31], the Künneth formula determines the code dimension from the homology of the factors [22]. Choosing a complete auxiliary graph and rounds then satisfies C1 and C2 throughout the family. C1 concerns the auxiliary graph, and C2 concerns the schedule; neither is an intrinsic property of the original code.
The minimum ancilla count for expansion alone is linear in the support size. A star on vertices satisfies C1 with edges, and this is the minimum possible edge count. Adding edges preserves C1, so a star with additional edges between its leaves uses ancillas. At four vertices and cycle rank three, this graph is , and both constructions use six ancillas. This is the auxiliary graph of the bivariate bicycle example in § 1.17. At seven vertices, a star with three chords uses nine ancillas, whereas uses twenty-one. Their cycle ranks are three and fifteen, respectively, so this is a comparison of two C1-satisfying graphs, not a comparison at fixed cycle rank. A star has unbounded maximum degree as grows. A low-density implementation additionally needs the source’s degree, matching-size and cycle-weight bounds.
The supplement reports an exhaustive finite census over edge multisets for the overall minimum and over simple graphs for specified cycle ranks. In the tested rows with a solution, the star-based witness uses fewer edges than the complete graph except when completeness is forced: three vertices with one cycle and four with three. The supplement specifies the search range and reproduction script, and Lean verifies the reported witnesses.
The lower bound follows from rank and nullity. Assign a bit to each vertex and map the assignment to the difference of the endpoint bits on every edge. A nonconstant assignment in the kernel would split the vertices into two nonempty sets with no edge between them, contradicting C1. The kernel therefore has dimension at most one, giving for edges. A connected graph with cycle rank has . For fixed cycle rank three, the complete graph has this edge count only at . Separately, the formalized toric family has for every cycle length , and measuring one independent logical operator reduces this to one logical qubit.
Instances
Two examples show how the spatial construction and the measurement model enter exact distance calculations. The bivariate bicycle example computes the static code after adding the gauging ancillas. The Bacon–Shor example isolates spatial and temporal behavior in two separately defined measurement models.
A gauged bivariate bicycle code
We use the bivariate bicycle code [[18, 4, 4]] at shift parameters [6]. These shift parameters are distinct from the auxiliary-graph support size denoted by above. Its check matrices come from the Lean-QEC development [23]. Gauging a weight-four logical operator with auxiliary graph adds six ancillas and gives a [[24, 3, 4]] code. The construction reduces the number of logical qubits by one and preserves both static distance components at four.
Lean constructs the Gauss-law, pairing and cycle checks from the data and verifies their matrix entries. The Gauss laws sum to the measured logical operator, placing it in the deformed check row space. The code dimension and both distances are computed exactly.
Expansion follows from the complete-graph theorem, and choosing four rounds satisfies C2. A Lean theorem combines C1 and C2 with the independently computed static distances to establish this instance’s spatial bound. The exact values are certified separately; Section S13 defines each label by the check matrix whose kernel is used. The temporal value is separately in the measurement-fault model with adjacent-round comparisons. The temporal value follows from the repetition identity for independent measurement faults.
A transversal measurement
The second example is the Bacon–Shor subsystem code [[9, 1, 3]] on a three-by-three grid [19, 20]. It protects one logical qubit and also contains unprotected gauge degrees of freedom. The distance three refers to the protected subsystem. Treating the gauge degrees of freedom as additional logical qubits instead gives the associated stabilizer code distance two. Thus the protected subsystem and the associated stabilizer code have different distance conventions.
In the static single-round model, every data qubit is measured in X, and two X-type stabilizers provide parity checks. A bare Z-type logical operator of weight three is one minimum-weight undetected readout error. Lean verifies this bare-logical witness and proves the lower bound over all undetected readout-flipping faults, including those that act on the gauge subsystem. The temporal value comes from a different model: independent faults in the repeated support readout, detected by comparisons between adjacent rounds. Its distance is , so three rounds give temporal distance three. The static value counts data-only readout errors, while the temporal value counts repeated measurement-outcome faults.
With only two rounds, the measurement-fault model has an explicit undetected readout error of weight two:
(14) makes the round requirement explicit: with independent measurement faults and fault-free data, is necessary. In the persistent-fault readout model of main-text Sec. II, data, check-result and readout faults are all allowed. Its strict-majority distance is three at two rounds, using the predicate defined there. The comparison changes the fault locations, detectors and readout criterion, as tbl:I makes explicit.
How each condition affects distance
Each condition controls a different part of the distance argument. C1 and C2 enter the assembled spatial and temporal statements. C1 is sufficient under the construction hypotheses but does not determine every instance’s distance. C2 is necessary in the measurement-fault model. C3 motivates the endpoint syndrome constraint in the persistent-fault readout model, and C4 tests for redundant same-round checks. For redundancy, we first prove static distance invariance and then analyze the additional measurement in the protocol model.
C1: distance below the expansion threshold depends on the construction. We gauge the same weight-four logical operator of the smallest toric code using two different four-vertex paths (main-text Figure 4). Both paths violate C1 because some two-vertex set has only one outgoing edge. Changing one edge changes the resulting code distance. For the distance-losing path, and . For the distance-preserving path, , and neither side has a weight-one logical operator, so . The total distances are therefore one and two, while the original code has distance two.
A zero column of the deformed Z-check matrix explains the weight-one logical operator in the first path. For any CSS matrix pair, a unit vector is such an operator exactly when the th -check column is zero and lies outside the -check row space. The zero column means that no check detects , and the row-space condition means that is not a product of stabilizers. Applying this criterion on both CSS sides decides whether distance one occurs; larger distances require searching higher-weight vectors.
Each deformed check is completed by an auxiliary-edge set whose mod-two boundary equals the check’s support on the auxiliary graph [10]. The number of selected edges incident to a vertex is odd on that support and even elsewhere. This allows three selected edges to meet at a support vertex, so it is more general than an ordinary perfect matching. An auxiliary-edge column is zero exactly when the edge appears in no completed check and no cycle check. For the distance-losing path, we verify the zero column directly in the deformed matrix.
A second implementation enumerates every measured logical of support at most six and every connected auxiliary graph on that support for the toric codes [[8, 2, 2]] and [[18, 2, 3]]. Each deformed check uses a minimum-weight edge completion that commutes with every Gauss law, following the source’s parity-based matching definition. All enumerated C1-satisfying instances preserve the original distance. Among the C1-violating instances, the distance ranges from one to the original distance. The path pair and finite census therefore exhibit both distance loss and distance preservation below the expansion threshold using graphs without dummy vertices. All enumerated instances have same-round detectors, placing this census in the regime where the source’s detector construction must include local check relations.
The same-round detectors come from dependencies in the original code. The four checks of the smallest toric code sum to zero, and their lifted checks retain this relation after gauging. The bivariate bicycle instance also has a local relation. Supplementary Remark 2 discusses precisely this case: the detector set must include the same-round relations. By contrast, the eight generators of the Shor [[9, 1, 3]] code are linearly independent and satisfy C4.
The construction also requires every deformed row to commute with every Gauss law. This is equivalent to requiring the row’s edge completion to have odd-degree vertices exactly on the relevant support, the source’s matching condition. This condition constrains the edge completion, whereas C1 constrains the graph. The construction must check the edge-completion condition and the graph-expansion condition separately.
C2 is necessary in the measurement-fault model. The Bacon–Shor example with has an undetected readout error of weight two, below . The general witness is the all-ones pattern: the same measurement bit is flipped in every round. Adjacent-round comparisons see no change, and the fault weight is . Any linear parity readout with reads this pattern as a logical error. For every positive , this gives a fault lighter than . Our result states the readout condition explicitly, while Supplementary Lemma 3 of the source gives the exact distance for its measurement-and-initialization fault class.
Throughout the protocol analysis, an undetectable logical fault fires no detector and satisfies the specified readout-error predicate. The protocol distance is the minimum weight among these faults; the static distance instead minimizes over nontrivial logical operators in the check kernel outside the stabilizer row space. Static distance tests all nontrivial logical operators, while protocol distance uses the selected logical readout and its decision rule.
C3: a boundary syndrome constraint detects constant nonzero syndromes. The persistent-fault readout model includes data, check-result and readout faults and requires the first syndrome to be zero. At , one data fault paired with a check-result fault that cancels its syndrome gives an undetected readout error of weight two. Lean proves that no weight-one fault satisfies both the detector and readout conditions. The one-round distance is therefore two, compared with three in the static data-only model and one in the measurement-fault model. The fault class and detector set therefore change the one-round distance even for the same code.
For every , . This statement uses the predicate of Eq. (2).
For , the lower bound follows from three observations. First, a weight-at-most-two fault occupies at most two rounds. Second, in a round with no new faults, the syndrome is times the accumulated data error. The boundary syndrome constraint and adjacent comparisons force every syndrome to zero. The accumulated error has weight at most two, so the single-round distance three prevents it from flipping that round’s readout. Third, only the at most two occupied rounds can have flipped readouts, which is not a strict majority when . Lean checks and by finite enumeration. A weight-three logical data fault in the first round gives the matching upper bound for all .
The general boundary-collapse construction is given in main-text Sec. II. Lean certifies its Bacon–Shor specialization.
The one-round formula is the case of Eq. (3); its Bacon–Shor value is also certified in Lean. Let be the merged data and readout error, let be the check matrix, and let be the logical parity support. An undetected fault must use check-result error to cancel the syndrome, while a readout error requires . Minimizing the total weight gives
For the Bacon–Shor model, the minimum is attained at : one data error and one check-result error that cancels its syndrome. The value is two. For other check matrices and readout supports, Eq. (15) gives the value directly. § 1.27 gives related lower bounds and endpoint variants. The paired data and check-result errors count as two independent fault locations.
Figure 3 of the main text compares the persistent-fault model, the measurement-fault model and the persistent-fault model without its boundary syndrome constraint. A second implementation recomputes the figure, and all twelve of its points are exactly the proved ones, four on each curve.
C4: check redundancy preserves static distance and can improve protocol distance. A same-round detector is a nonzero linear combination of check rows that sums to zero. Such a combination exists exactly when the row rank is smaller than the number of rows. A redundant row is a binary sum of existing check rows, so adding it leaves both the check row space and the check kernel unchanged. Both CSS distance components therefore remain unchanged. A code with redundant generators represents the same static code after those generators are removed.
Measuring an extra check has a separate protocol effect. In our persistent-fault readout model, duplicating the first check adds an independent check-result fault location. Deleting the extra check-result fault location leaves the readout unchanged, preserves the original detector constraints and can only reduce or preserve the fault weight. The duplicated-check distance is therefore at least the original distance for every round count. At , the distance rises from two to three: a single data fault that flips the logical parity must be hidden in both copies of the check using two independent check-result faults. The improvement uses one extra check measurement and one extra independent check-result fault location per round. The detector-generating lemma describes relations among measurement outcomes. These results show how same-round detectors can be retained alongside the spatial and temporal analysis.
Extensions to surgery and fault complexes
The same matrix-based approach yields further results for surgery, mapping cones and fault complexes. The gauging operation verified here acts on check matrices. The graph, ancillas, cycle checks and edge completions of Ref. [10] enter through explicit construction hypotheses. The named instances construct these data and verify the resulting matrix entries. Connecting these results to a gate-level circuit requires identifying that circuit’s checks, fault locations and error propagation with the specified matrices.
The check-matrix construction includes a useful commutation criterion. A deformed check commutes with every Gauss law exactly when its edge completion has odd-degree vertices exactly on the check’s relevant support. This is the source’s parity-based meaning of a matching. Such a completion exists on a connected graph without self-loops when the support has even cardinality. The parity condition ensures commutation, and expansion supplies the weight bound used in the spatial proof.
The verified graph regime. Lean verifies all three steps of Theorem 2. Cut–cycle duality identifies edge sets orthogonal to every cycle with cuts. The cycle space is the kernel of the edge-to-vertex incidence map and is spanned by graph cycles. The formalized auxiliary graph is on all original code qubits. Every vertex therefore carries a data qubit; adding the source’s dummy vertices would require extending this construction to vertices that carry checks without data. Thus the outside-graph term in the displayed counting argument is not instantiated by this formal construction. The verified -type spatial bound assumes loop-free graphs with ; self-loops and require additional arguments. Section S13 defines the Cheeger constant .
The C4 results concern check dependencies and static distances, together with the specified duplicated-check protocol model. The detector-generating statement uses a label model in which distinct labels can take arbitrary outcome values, while repeated occurrences of one label share an outcome. In this model, a parity combination vanishes for every allowed outcome assignment exactly when each label occurs an even number of times. Relations among dependent check operators must also be included when applying this model to their measurements. Within this label model, adjacent comparisons leave precisely the repeated-label fault patterns undetected. Initialization and readout contribute single-site detectors at the endpoints. These sites define the spacetime check set, to which a circuit-level fault model can be attached by specifying how gate faults change the outcomes.
Surgery and the coupling between complexes. We verify a -type specialization of the distance conclusion of Theorem 7.7 of Ref. [18] for the single-block model described below. Its second proof case compares a deformed-code logical operator with an auxiliary-hypergraph vertex set . An explicit coupling is needed to compare the logical operator and the vertex set because they belong to different spaces. We use the one-to-one data attachment of formula (2), together with the chain-map construction in §4 and §5 of Ref. [18].
In this specialization, the port covers all original data qubits. Lean proves that the kernel of the deformed -check matrix is contained in the row space of the deformed -check matrix . Thus every undetected physical -type operator in this specialization is a stabilizer; no logical operator remains on that side. For a free coupling in our own model, complete cycle checks make all legal couplings agree on admissible vectors. Cleaning removes the coupling contribution without requiring the coupling itself to vanish.
The source obtains its block-reading fault-distance guarantee from the gauging arguments in §3.1. A mapping cone puts the deformed-code complex, the auxiliary complex and the map connecting them into one complex, allowing us to analyze distance transfer in that combined object. The connecting map, called the port map, has three linear components , , . In the specific small-code and triangular-auxiliary assembly studied here, the commuting-square condition requires to have three equal columns. A second implementation enumerates the squares and confirms that these are exactly the admissible matrices. For every admissible port in this assembly, the cone distance equals the small code’s distance when the first column of is nonzero, and equals one when that column is zero. The column test is an exact distance criterion for this small-code and triangular-auxiliary assembly.
A separate theorem gives the general algebraic criterion. Let be the idle-volume complex and the auxiliary complex, and suppose is exact at the middle. Exactness means that every cycle at that term is a boundary. A pair is then an undetected nontrivial cone fault exactly when and . A nontrivial undetected fault must satisfy the linear equation and lie outside the specified image space. Once the chain-map conditions hold, this fault criterion is determined by and the two complex differentials. A weight-one cone fault exists exactly when a weight-one auxiliary vector lies outside and satisfies . The first-column test above is this criterion specialized to the triangular assembly.
The exactness condition concerns the idle-volume complex . For built as a tensor product of a two-term factor and a code complex, the supplement gives a complete criterion for middle exactness. Its criterion uses the homology of both factors. A code complex with vanishing and gives middle exactness with every partner.
Cosystolic distance and its assumptions. When is nonempty, the auxiliary quantity is the minimum weight of its vectors (Figure S1). A component is a vertex set that meets every hyperedge in an even number of vertices. The component family is a chosen collection of these sets. The vector must pass all component parity checks but cannot be generated by adding hyperedge vectors; over , both requirements are finite parity tests on its support. When the set is nonempty, a lower bound excludes all lighter admissible supports, and an upper bound supplies one admissible support. The characterization reduces distance calculation to a minimum-weight search subject to the two parity tests. The problem is to find the lightest vector in a linear code outside a specified subcode. The supplement gives a reduction from linear-code minimum distance, which is NP-hard [40]. The free-coupling problem has the same algebraic form: a linear system together with exclusion from a specified subspace.

Figure S1. The auxiliary four-term complex used in the surgery analysis of Ref. [18]. From left to right, the spaces are spanned by the chosen component family, vertices, hyperedges and cycles. The maps point left, and consecutive compositions vanish. Both and therefore lie in the vertex space. The shaded region represents . When this set is nonempty, is its minimum vector weight. The formal definition assigns zero when this set is empty. OpenAI Codex assisted the drawing code and layout; see main-text Sec. VI.
Cosystolic bounds for simplicial complexes suggest ways to construct auxiliary systems [36, 37, 38, 39]. Using a specific bound here requires identifying the corresponding cochain complex, relating its weight convention to ours, and verifying all hypotheses of that theorem. For three structured families, the supplement gives exact distance formulas. These families have one nonempty hyperedge, so their cycle space is zero. Applying them to sparse surgery requires bounds on incidence degrees and check weights as the family grows, together with the code and coupling hypotheses of the chosen surgery theorem. The supplement identifies the entries whose weights grow in these examples.
The graph specialization illustrates why nonemptiness matters. Each hyperedge is then an ordinary edge, and is the edge-to-vertex incidence map. On a connected graph, leaving a vertex out of the chosen component family gives distance one. Whether this occurs depends on the chosen component family. If the whole vertex set is the single chosen component, is empty. The formal definition assigns zero in this case because it uses the natural-number infimum, which equals zero for an empty set. Here zero records an empty admissible set, so it represents the absence of a cosystolic vector. Positive lower-bound criteria therefore require at least one admissible vector.
Two foliations give different distance laws. Foliation stacks a code complex along a time direction [33]. With repetition-code foliation, the matrix-indexed distance is whenever the code complex has nonzero zeroth homology . Here is the cokernel of the bottom map. With dual foliation, the corresponding distance equals the original code’s matrix-indexed distance for every positive , provided that the original code has a nontrivial logical operator on that side. For an empty logical set, the fault-complex infimum is zero, whereas the static finite-search function returns for an -qubit code. These values record the absence of candidates; neither is the weight of a logical operator. The Künneth formula describes the homology [18]; separate weight bounds and explicit faults attaining them give these distance laws. Selecting the distance law for a physical circuit therefore requires identifying which foliation models that circuit.
The supplement lists the formal declarations supporting these results and states the assumptions needed to connect them to the source constructions. It also verifies that each detector functional vanishes on the image of the fault-complex boundary map, as required by the complex condition. To use this identity in the source’s spacetime cleaning proof, one must identify the fault coordinates and establish the corresponding weight bound. Related work describes fault complexes as graph states [25] and extends the construction through spacetime lifting [34].
Proof verification and numerical calculations
Lean verifies the proof scripts, and separate numerical implementations check the reported finite instances. DeepSeek-V4.1-Flash assisted the Lean derivations and numerical debugging; OpenAI Codex (GPT-6) assisted literature checks, formal-proof exploration and numerical cross-checks. AI-generated proof code is checked by the Lean kernel, and numerical claims are checked against independently computed values. OpenAI Codex also assisted the four TikZ schematics and the plotting code; their supports, operator relations and plotted distances were checked against the definitions and numerical data.
column in Section S7 is checked in the full deformed -check matrix, including the cycle checks.
Formal statements supporting the results
The development is a single Lean project of 75 modules plus a root module. This repository contains 19 modules and imports 56 from QECCertificates, which provides the GF(2) and Pauli layers and part of the Codes layer. The project also depends on mathlib and the Lean-QEC formalization at QCL-SUAT/Lean-QEC; full revision hashes pin all three dependencies. Table S3 and Table S4 group the modules by layer and name the theorem or group of results supporting each claim.
| Layer | Module | Supporting statement |
| machine | GF2.Basic | spanL_map_addSmul_append, Matrix.rowSpace_eq_spanL_ofFn |
| machine | GF2.RowReduce | spanL_rowReduce, isReduced.rowReduce |
GF2.KernelBasis | kerL_rowReduce | |
GF2.Canonical | rowReduce_mem_iff_of_spanL_eq | |
GF2.RankCertificate | Matrix.rank_eq_length_rowReduce | |
GF2.RankEchelon | rankEchelon_eq_length_rowReduce | |
GF2.Witness | DualWitness.not_mem_rowSpace, eq_minWeight_of_bounds | |
GF2.Membership | inSpanB_iff, inKerB_iff | |
GF2.LowerBound | eq_minWeight_of_decide, lightCand_length_le | |
GF2.WeightEnum | mem_lightVecs | |
GF2.HGP, GF2.HGPCompression | hgp_orthogonal, hgpHX_mulVec_eq_zero_iff | |
GF2.HGPCleaning, GF2.HGPCleaningDual | cleaning lemmas, two-sided | |
GF2.KunnethCore, GF2.HGPKunneth | finrank_colsRows, hgp_kunneth | |
Pauli.Expr | operator tree to symplectic representation | |
| decision | Codes.Separation | separation judgment; C2’s necessity: exists_logicalFault_of_rounds_lt |
Codes.LocalDetector | C4 by row rank; redundant rows preserve static distance | |
Codes.MatchingCriterion | an obstruction for ordinary graph perfect matchings | |
Codes.BoundaryCollapse | comparison-only model: removing the constraint gives distance 1 | |
Codes.SeparationInstances | sepFail_lightLogical: C1 counterexamples | |
Codes.SeparationClosedForm | one_le_c1Witness | |
Codes.ToricFamilySpatial | toric_family_separation_closed_spatial | |
Codes.C1Census | C1’s ancilla cost: expansionOne_star_six, expansionOne_append | |
Codes.C1Optimal | is a lower bound: card_sub_one_le_length_of_hasExpansion | |
One | ||
Codes.C1CycleRank | the cycle-rank bound: card_ge_of_finrank_cycleSpace | |
| spatial | Codes.Gauging | deformX_k, the dimension drop; timeLike_weight_eq |
Homology.HypergraphSurgery | hypergraph Gauss law; starOp_graphOf, hypergraphSurgery_k | |
Homology.AuxComplex | four-term complex; 1-cosystolic distance for gauging | |
Homology.ModuleExpansion | modular expansion; thickening (7.8); Cor. 7.10; 7.7’s premise | |
Codes.SurgerySchedule | W-components; spatial expansion; round accounting | |
Codes.SurgeryProtocol, Codes.SurgeryFaultDistance | round accounting; timeline detector | |
Codes.SurgeryProtocolComplex | the cone over a chosen port; two readings; the transfer criterion, refuted on one port | |
Codes.ConeReduction | the cone reduction on a general assembly; the weight-one criterion | |
Homology.SubcodeLayer | the two subcode distances, with matrix convention and assumptions in Sec. S11 | |
Homology.SubcodeChainMap | the chain map of Def. 2.5, degree shift at p. 32; the p. 17 assembly | |
| port function and | ||
Homology.MappingCone | mapping cone over a 4-term cochain complex | |
Homology.MappingConeSnake | snake-lemma rank formula for the cone | |
Homology.FaultComplex | the fault complex of App. A.1, its Koszul realization, the conserved parity | |
Codes.CircuitFaultSlots | A.1’s blocks: entry faults give the check matrix, for any check matrix | |
Homology.BoundaryLinearCore | exactness by rank; legal couplings agree on cycles; the printed modulus, read on vectors | |
Homology.CosystolicCertificate | the certificate interface; the 1-cosystolic cells are the shared undetectable set |
Table S3. TABLE S3. Modules and the results they support, part I: the machine, decision and first spatial layers. Every module is in the default build; § 1.29 reports the axiom dependencies of its supporting statements. Codes are written , is the 1-cosystolic distance of the auxiliary hypergraph and is the port function.
| Layer | Module | Supporting statement |
| spatial | Codes.LegalCouplingInvariance | both coupling invariances on the deformed code |
Codes.DistancePreservation | distance bounds when checks are appended on the original qubit set | |
Codes.DeformedCode | Z-type bounds for the single-block model, Case 1 and legal couplings; the free coupling’s candidates are a linear system in the coupling matrix, and the coupling-to-vertex commutation identity holds whenever each deformed check commutes with the vertex rows, with its two corollaries; at distance three the drop criterion as a disjunction, couplingDrop_shape_three | |
Codes.CouplingRangeSeparation | an explicit Steane assembly with a purely auxiliary logical fault of weight two but no weight-two logical fault on one data and one auxiliary qubit, steane_m4_separates | |
Homology.FaultDistance | the fault predicate; both cases; Z-side distance on both standard foliations | |
Codes.VennPartition | seven-region count; relation (2) of the proof of Thm. 7.7 as an identity | |
Codes.TimeLikeInstance | , instance | |
Codes.BB24Separation | the bivariate bicycle : both components | |
Codes.BB24Gauged, Codes.BB18Anchor | the code and its base-code certificate; the gauging construction verified by the proof assistant | |
Homology.CosystolicLowerBound | weight-one/two criteria; two unbounded families | |
Codes.CosystolicBlockFamily | a third unbounded family: on one full hyperedge | |
Codes.FaultComplexGraphState | the graph-state reading: the biadjacency matrix and the detector rows | |
Homology.FaultComplexKunneth | the Künneth dimensions; the decoupling spanning in general | |
| temporal | Codes.MeasurementProtocol | spacetimeWeight_witness: the weight law |
Codes.BaconShor | : gauge and stabilizer ranks, , | |
Codes.BaconShorMeasurement | transversal: spatial 3, temporal 3 | |
Codes.FullProtocolFaults | universal recovery, boundary removal, duplicated checks, one-round form | |
| family | Codes.ToricFamilySpatial, Codes.HGPToricFamily | closed-form spatial bound on both families |
Codes.ToricFamilyGaugedK | toric_family_gauged_k: the family’s dimension drop, from the drop theorem | |
Codes.CutCycleDuality | cut space = the even subgraphs’ orthogonal complement; step 1 of the counting lemma | |
Homology.DetectorDecomposition | adjacent comparisons generate the window ones; both generating lemmas | |
Codes.SpacetimeChecks | the spacetime check set: a site is a (round, check) pair, its label round-free | |
Codes.GaussCleaning | step 2 of the counting lemma: cleaning, and the two hypotheses it derives | |
Codes.ToricFamilySpatial | step 3 of the counting lemma, space_fault_weight_ge_of_expansion | |
Codes.MatchingDeformation | the gauging paper’s Methods Lemma 1: Gauss law, cycle checks, matching deformation | |
Homology.CosystolicLowWeight | as a decidable low-weight criterion | |
Homology.CosystolicCharacterization | the parity criterion at every weight; bounds as sets; the hardness realization | |
| bookkeeping | Codes.DistanceLabel | X/Z labeling and the two-sided ledger |
Codes.CSSPair, Codes.CaseMatrix | CSS bridge; case matrix |
Table S4. TABLE S4. Modules and the results they support, part II: the remaining spatial layer, temporal results, code families and bookkeeping. The conventions and audit scope are those of Table S3; rows citing the gauging paper’s Methods use the numbering from that version.
The Künneth row summarizes several results, whose derivations are given below. The dimension identities cover all four Künneth degrees, including both a zero differential in the two-term factor and the general case. For repetition-code foliation, which stacks the code along time, the project also proves elementwise decoupling as described below.
Ordinary graph matching. The declaration no_pair_of_isolated concerns a matching that uses graph edges and pairs every support vertex with exactly one other support vertex. If deleting an edge’s two endpoints leaves an isolated support vertex, no such matching contains that edge. For the four-vertex path, path4_not_matched applies this obstruction to its middle edge. Gauging instead requires an edge set whose mod-two boundary equals the relevant support; it does not require degree one at every support vertex. For example, all three edges of a four-vertex star have odd boundary at all four vertices, although the graph has no ordinary perfect matching. The matching obstruction therefore does not determine which edges can occur in a gauging completion. The zero
Calculating the 1-cosystolic distance
The auxiliary 1-cosystolic distance is the minimum weight in when this set is nonempty. It enters the round requirement of the surgery paper. A component is a vertex set that meets every hyperedge in an even number of vertices. is a chosen family of these sets. Over , every vector is the indicator of its support. Membership can therefore be tested by two parity conditions. Here maps vertices to the chosen component family , and maps hyperedges to vertices:
the left factor by the row-wise reading of and the right by , is Cosystolic.indVec_iff. Both factors are finite checks. Provided at least one cosystolic vector exists, every lower bound on therefore rules out a small admissible set, le_cosystolicDistance_iff_isnet. An admissible set is one whose indicator vector is cosystolic. Every upper bound comes from one admissible set, cosystolicDistance_le_card_of_indVec. The formal distance is an infimum in the natural numbers, so an empty admissible set has value zero, not infinity. A claim that no small admissible set exists is then vacuous and gives no positive distance bound. All distance lower-bound criteria in this section assume nonemptiness; the membership criteria do not.
For weights one and two, Eq. (16) gives explicit membership criteria. When the component family covers the vertex set, no cosystolic vector has weight one on an even
hypergraph. The vectors of weight one and of weight two each have a complete criterion:
the first on an even hypergraph, one whose every hyperedge has even cardinality, isCosystolic_indVec_singleton_iff and the second on any hypergraph, isCosystolic_indVec_pair_iff_component. Here is the -th chosen component, and a separating has exactly when . Two distinct vertices are in the same -class when, for every , either both lie in it or neither does. On an even hypergraph, covering the vertex set rules out weight-one cosystolic vectors by two_le_hammingNorm_of_isCosystolic, giving when the candidate set is nonempty. On three structured families the distance is computed exactly, the first two in the display below and the third in the text that follows it,
The first formula holds on the pair family: the single hyperedge is with , and consists of all triples with , cosystolicDistance_pair_eq_card_sub_one. The second holds on the connected family: the single hyperedge is , both and have at least two vertices, and consists of all distinct vertex pairs within either set, cosystolicDistance_univEdge_splitPairW_eq. These formulas give exact distances for the specified auxiliary complexes. A third family generalizes the second along the number of blocks. Split the vertices into blocks of at least two each, take the whole vertex set as the single hyperedge and every pair inside a block as a component; the distance is then , the smallest single block. Both the lower and the upper bound are theorems, cosystolicDistance_univEdge_blockPairW_eq: equal blocks of size give distance for arbitrary , so the family is unbounded, cosystolicDistance_univEdge_blockPairW_const. It generalizes the connected family above rather than sitting beside it, since at two blocks its components are point-wise those of splitPairW, blockPairW_two_eq_splitPairW. Each family has one nonempty hyperedge, so the edge-to-vertex incidence map is injective and the cycle space is zero. The pair family has growing incidence degree at and . The whole-vertex hyperedge has weight , and the within-block pair checks give each vertex a number of incidences that grows with its block size. Using these distance formulas in sparse surgery therefore requires controlling incidence degrees and check weights, as well as satisfying the relevant code-distance and coupling conditions.
The parity characterization (S7) defines a minimum-weight search. The component-family parity checks impose the linear constraint , while odd overlap with some component requires exclusion from the subspace im , that is, , since . The admissible sets are therefore a linear code with one of its subcodes removed, with and , and the quantity is the least weight in a nonzero coset of . Both the closed-form question and the three-coupling question ask for the lightest vector in one matrix’s kernel outside another matrix’s row space. The admissible sets are that set by definition, is Cosystolic_iff_undetectable, and the free coupling’s candidates solve a linear system in the coupling matrix together with the cycle conditions, pairVec_mem_ker_iff_coupling, whose remaining condition is the same non-membership. The following construction shows that this minimum-weight problem includes arbitrary binary linear-code instances. For every binary linear code and every subcode of it, there is a hypergraph whose admissible sets are . Take the code’s coordinates as the vertices, its parity checks as the component family and a basis of as the hyperedges: then and , and the composite vanishes because . The construction is machine-checked, surgery_D2_matRowSupport and surgeryD1_hypergraphOfRows realizing the two maps and isCosystolic_hypergraphOfRows the membership. With no hyperedge at all the distance is exactly the code’s minimum nonzero weight, cosystolicDistance_eq_IsInf_ker_ne_zero. A general method for would therefore compute the minimum distance of a linear code, a problem cited in § 1.19 as NP-hard.
Two consequences of the parity criterion help evaluate the round-count requirement. Below weight three the question is settled outright when a cosystolic vector exists, since the criterion turns into a finite statement, three_le_cosystolicDistance_iff_no_small, the same criterion that Homology.CosystolicLowWeight states by enumerating weight-one and weight-two vectors. If one member of the component family is the whole vertex set, then every cosystolic vector has even weight, even_hammingNorm_of_isCosystolic_univ, so the value three never occurs there. For the single-hyperedge families, the empty cycle basis satisfies the cycle-space requirement. The growing incidence degrees and check weights are the conditions to address when seeking a low-density family.
Surgery and fault-complex results
This section lists the formal declarations behind the statements in § 1.19. It distinguishes our models from the constructions of Cowtan et al. and Williamson and Yoder.
Gauging subcode and distance transfer. Let the auxiliary graph be nonempty, connected and free of self-loops, and take the chosen component family to be . On its vertex space, use the chain-complex check matrices and . Following Section S13,
uses and uses . The side distances are then
by subcodeDistanceZ_eq_one and subcodeDistanceX_graphOf_eq_card, respectively. These declarations use the opposite names for the two check matrices; chainCodeX_eq_subcodeZChecks and chainCodeZ_eq_subcodeXChecks identify them with the pair above. Thus the weight-one logical operator is physical type, while the physical -type logical operator acts on every vertex. We make the matrix construction underlying the source’s subcode statement explicit. The source’s only explicit assembly for this operation is the edge-to-check map on pp. 17–18 with ; we construct this map and build the chain map of Definition 2.5 from it. The formal construction uses the following two specializations. The source’s edge-to-check bijection becomes two injections, and the nontrivial part of the chain map is taken at , which is where the surgery paper sets that term aside as well.
For distance transfer, distance_preservation_of_portData proves that appending the specified check rows preserves the lower bound. The deformation adds checks on the same qubits, so every vector passing the new checks also passes the old ones, and the distance bound transfers operator by operator. Kernel inclusion is the mechanism behind this transfer. This fixed-qubit argument uses only the original kernel and appended rows, leaving the port function, logical-support coverage and modular expansion as separate auxiliary-data conditions. The statement distance_preservation_of_portData_full carries all three as unused hypotheses.
The preceding fixed-qubit model leaves out the auxiliary qubits. With auxiliary qubits included, distance_preserved_originalForm_caseOne proves Case 1 of the source argument under its stated assumptions. In the specific small-code and triangular-auxiliary assembly, admissible ports have three equal columns in . The theorem coneDistance_generalF2 gives the cone distance for every such port: the small code’s distance when the first column of is nonzero, and one when it is zero. This exact distance formula is specific to that assembly.
The general cone criterion assumes that the idle-volume complex is exact at the middle. For an auxiliary complex and a valid port , cone_fault_iff_of_middleExact states that is an undetected nontrivial fault exactly when and . For a valid port, the criterion uses and the differentials of the two complexes. The weight-one specialization requires a unit auxiliary vector outside the image of and killed by . The theorem coneWeightOne_triAux evaluates this condition on the triangular assembly. Middle exactness is essential: middleExact_fails_koszul gives a counterexample with all factor and code differentials zero.
That condition also has a complete classification for the Koszul fault complex, the tensor product of the two-term factor complex with the three-term code complex. Over , where both factors are free and Künneth carries no Tor term, it is exact at the middle exactly when and both vanish, oszulFaultComplex_middleExact_iff. The criterion pairs the factor with the code, which the exhaustive probe over small factor–code pairs confirms. The homology of both factors must therefore enter an exactness test. A code complex whose and both vanish is exact at the middle against every factor, koszulFaultComplex_middleExact_of_codeCyclic. The assembly in Section S8 satisfies this exactness condition: both its factor map and the three-qubit code’s check map are surjective, as shown by idleVolume_middleExact_kunneth.
Machinery. The cone machinery of the surgery paper is formalized as a complex, a fault complex and a rank formula, Homology.MappingCone, Homology.FaultComplex and Homology.MappingConeSnake. Its mapping cone is defined in §2.2 and its rank formula is in Appendix A. The expansion machinery itself is formalized: modular expansion, the thickening theorem with its degree decomposition, and the constructive form of the distance-preservation corollary. Three further parts of the source argument are verified in their original form. First, its Theorem 7.7 in the first case of its proof, Case 1 here taken at the vertex set that the proof fixes rather than over every vertex set, distance_preserved_originalForm_caseOne. Second, venn_card_identity proves the seven-region counting step as an exact identity. Third, the round accounting of its intermediate-time theorem.
Ancilla counts for expansion alone. The census covers supports of three to eight vertices and cycle ranks up to three. It minimizes edges over edge multisets for the overall minimum and over simple graphs for fixed cycle ranks. Among the tested rows with a solution, the star-based witnesses use fewer edges than the complete graph except at with cycle rank one and with cycle rank three. Lean verifies the star and edge-addition constructions through expansionOne_star_six and expansionOne_append. At seven vertices, the three-chord star uses nine ancillas, while uses twenty-one. At eight vertices, the corresponding counts are ten and twenty-eight. The star-based graphs have cycle rank three, while the complete graphs have cycle ranks fifteen and twenty-one. These comparisons optimize the C1 edge count; cycle rank and the source’s additional low-density requirements are separate constraints. The archived Julia script reproduces the census. The theorems card_sub_one_length_of_hasExpansionOne and card_ge_of_finrank_cycleSpace prove the and cycle-rank lower bounds.
Case 1 of Theorem 7.7 depends on the scope of the vertex-set quantifier. For positive target distance, requiring its condition for every vertex set is impossible because the minimum includes the empty set, as proved by not caseOneAll of pos. For the fixed vertex set used in the proof, caseOneAt_holds gives a verified instance. The theorem caseOneAt_boundary verifies the counting lemma on that instance; this is the three-step argument used in the spatial theorem of Section S4.
The round accounting of the intermediate-time theorem is a round count per term,
as printed: rounds, under ,
taken tight: , (S11)
Here is the 1-cosystolic distance and is the parameter in the surgery theorem. For , least_rounds_eq_ceil proves that is the smallest integer round count satisfying . For the second proof case, hammingNorm_ge_of_connVanishes gives a bound when the coupling contribution vanishes on the fault. The theorem below treats every legal coupling under its construction hypotheses. The source construction uses the one-to-one attachment in formula (2) and the chain maps in its §4 and §5. For the related adapter construction, Eq. (9) of Swaroop, Jochym-O’Connor and Yoder extends each original check onto auxiliary paths pairing vertices in its port image. Its weight bound discards that auxiliary support, so it does not require the coupling contribution to vanish.
For the single-block model whose port covers every original data qubit, distance_preserved_of_blockReading proves the Z-type distance bound. The kernel of the deformed X checks is contained in the row space of the deformed Z checks, so this model has no nontrivial Z-type logical operator. Under the original-code distance bound and the stated construction and expansion assumptions, the free-coupling model gives a Z-type distance lower bound for every coupling satisfying the commutation conditions, including those with a nonzero contribution to the fault. This bound allows nontrivial logical operators; it does not require the port to cover all original data qubits. The deformed stabilizer space must contain the lifted original stabilizers and the vertex stabilizers, and the cycle checks must be complete. On the linear maps, once the cycle checks are complete, the admissible auxiliary vectors lie in the image of the boundary map. There a legal coupling is fixed by the requirement that the extended original rows commute with the vertex rows, so every legal coupling yields the same kernel and the same distance, legal_couplings_agree_on_cycles. Multiplying by vertex stabilizers removes the coupling contribution and leaves an operator whose original-data part is a nontrivial logical operator of the original code. The port’s weight condition keeps the correction no heavier than the boundary part it removes, so the bound holds without that contribution vanishing, distance_of_legal_coupling with expansion_cases. The port weight bound follows from injectivity on the disjoint union of the supports: each vertex carries at most one data qubit by portFiber_card_le_one, and summing these contributions gives the bound. The expansion bound starts from the source’s modular-expansion predicate evaluated on vector supports, expansionCriterion_of_modularExpansion; inf'_image_indOf_eq_modExpMin identifies its infimum with the source’s minimum, and expansion_cases gives the two-case bound when every representative is a cycle and the port weight bound holds. The search recorded by the free-coupling probe of the archived snapshot agrees with this. At distance three the criterion is settled as a disjunction: a valid kernel element lighter than the distance is a pair candidate or a purely auxiliary element, and conversely, couplingDrop_shape_three, the pure-data case being the one that is excluded, not_pureData_witness. The search witnesses couple some check to more than one auxiliary qubit and commute with every vertex check, so they satisfy the commutation conditions of our free-coupling matrix model; each fails the expansion condition required by the distance bound.
C4 and static distance. A same-round detector is a nonempty set of check rows summing to zero. The declarations hasLocalDetector_not_linearIndependent and hasLocalDetector_of_not_linearIndependent prove that such a detector exists exactly when the rows are dependent. The cosetopposite not hasLocalDetector_of_linearIndependent verifies C4 on independent check sets. Two versions of a two-qubit code, one full-rank and one with a repeated row, are decided directly in Lean. The bivariate decic instances also have dependent X checks, as recorded by the rank calculations supporting bb18_k and bb24_k.
Appending a redundant row preserves the kernel by ker_appendRow_of_mem_rowSpace and the row space by rowSpace_appendRow_of_mem_rowSpace. Both CSS distances are then unchanged, by min_weight_appendRow_of_mem_rowSpace and min_weight_not_mem_rowspace_of_appendRow. This invariance concerns the static code; measuring an extra check adds protocol resources. The duplicated-check protocol result below proves that adding an independent check-result fault location does not lower distance in the specified model.
The derivations below show that duplicating this check never lowers the specified protocol distance, at any round count. The detector-generating lemma uses a label model in which distinct labels can take arbitrary outcome values, while repeated occurrences of one label share an outcome. In this model, a parity combination vanishes for every allowed outcome assignment exactly when each label occurs an even number of times. Relations among dependent check operators must also be included when applying this model to their measurements. Within this label model, those combinations are generated by one operator across adjacent rounds, isDeterministic_iff_mem_span_pairForm; a comparison across a window of rounds is the sum of the adjacent ones, sum_adjPairVec_eq_windowVec. Dually, the faults no comparison can see are exactly the patterns constant on each measured operator, stabilizer_iff_const_on_labels, generated by the per-operator indicators, const_on_labels_iff_mem_span_classInd. At the two end rounds the operators are initialized and read out, and the deformation resets the state, so one operator need not repeat its outcome. An endpoint site with outcome fixed to zero imposes a constraint on its operator class, expressed by classSum_zero_of_isDetZ. The detector generators therefore include that single endpoint site, isDetZ.iff_mem_span. The spacetime check set SpacetimeChecks labels each site by a check and a round; the operator label identifies the check, and endpoint sites have fixed outcomes. The faults fire those sites through the differential of the fault complex, and a boundary fires none of them. Applying this check-set result to a circuit requires specifying how its elementary faults change the measurement outcomes.
The Künneth formula and the two foliations.
The Künneth formula the surgery paper applies to Eq. (5) is
with the two-term factor complex of the foliation and the code complex. It is machine-checked in all four degrees, both on the family where the two-term factor has zero differential and in general, together with the two premises it rests on at every round count: the coefficient field is and both factors are free. Instantiating the general formula at the repetition-code foliation and at its dual recovers the two closed forms the surgery paper prints, and with them the count of each logical fault type in terms of the code’s own homology dimensions.
For the general family, the differential has one block per factor, and dimension lemmas describe both blocks and the map sending a tensor product of cycles of and into the third homology. The formula is proved as a dimension identity, not as an isomorphism of the homology groups themselves. For repetition-code foliation, the other summand vanishes, and the decomposition is also proved for individual vectors. Every cycle of the fault complex is the sum of a vector constant along the timeline and a boundary, so every class admits a representative constant along time. This proves a normal form for the specified repetition foliation; identifying it with the source protocol’s decoupling requires a correspondence between the fault complexes. The dual foliation has a spacelike normal form obtained from injectivity of its foliation map. When , the repetition-foliation distance proof shows that every nontrivial fault has a nonzero entry in each time slice and constructs a constant unit-vector witness, faultComplexDistanceZ_koszul_repR. For dual foliation, summing along time cannot increase weight and preserves nontriviality; a single-slice logical operator attains the code distance when such operators exist, faultComplexDistanceZ_koszul_repRdual. For comparison with the static in Section S13, take the adjacent code-complex maps to be and . The code-side candidate set is then ker H_Z | rowSpace H_X. This theorem equates two natural-number infima, both of which are zero when their candidate sets are empty. The static function min_weight_ker_not_mem_rowspace instead returns for an empty candidate set on coordinates, as recorded by static_empty_divergence. The equality with the static distance therefore assumes a nonempty logical set. The same analysis also gives a reusable identity: over a vector lies in the column space of a matrix exactly when it is orthogonal to that matrix’s left kernel. When both summands are present, one decomposition theorem includes both normal forms as special cases. Write for the elements whose every -fiber lies in the kernel of the foliation map, being the degree-zero part of the code complex . Every cycle of the fault complex is then the sum of a boundary, a spacelike vector and an element of , for a general two-term factor rather than only where one of the two summands vanishes, ker_koszulD0_lesup_general. The proof constructs the decomposition directly using linear projections. The timeline part is projected onto the image of the code differential. That projection commutes with the foliation map and is the identity on the image, so the difference between a cycle and its projection lies in , and what is left has a zero timeline part and therefore lies in the spacelike subspace. The repetition and dual normal forms follow as special cases of this decomposition. When the foliation map is injective, vanishes, which recovers the dual-side statement above. For the repetition-code factor, its kernel is spanned by the all-ones vector, so consists of constant families, recovering the repetition-code normal form.
The bijection between the fault complex and a graph state is a matrix identity, not an isomorphism of maps, which is what the surgery paper’s use of it requires. The surgery paper cites Hillmann, Dauphinais, Tzitrin and Vasmer for that formalism. Their paper prints that is the biadjacency matrix of the bipartite fault-tolerant graph state it builds over the fault locations, its FTGS. The biadjacency matrix is the block of an adjacency matrix that joins a bipartite graph’s two sides. In this development’s column-vector convention
and both the formula and its round trip are formalized here. The half of the correspondence that names the detectors is the Hillmann et al. definition rather than a consequence of the other half. The consequence the surgery paper draws from it at p. 63, that a fault complex cannot describe protocols with input or output qubits, is not formalized.
The counting lemma’s own boundary. Its cycle space enters in algebraic form, the kernel of the transpose of the incidence map, here written inc with one row per edge and one column per vertex. The cycle space is also formalized in classical form. That space is spanned by the graph’s cycles, the minimal nonempty even subgraphs, venSubgraphSpace_eq_span_minCycle. Meeting every cycle evenly and meeting every even subgraph evenly are therefore one test:
the lemma’s first step is that equivalence, cut_iff_forall_dot_evenSubgraph; the cut’s size then follows, hammingNorm_mulVec_indVec_eq_cutSize. The remaining hypotheses of Theorem 2 are the structural facts of Lemma 1 of the gauging paper’s Methods, packaged as one object rather than constructed:
a deformed check commutes with every Gauss law exactly when its edge set has odd-degree vertices exactly at the check’s support. Cycle checks commute automatically, and such an edge set exists whenever the auxiliary graph is connected and loop-free and the support has even cardinality. The auxiliary graph is taken on all the code qubits of that instance, so the gauging paper’s dummy vertices, vertices carrying a check and no data qubit, are not modeled. The weights are read off one explicit check set, instance by instance. The lemma’s general case, an expansion factor below one, is not claimed. Section S10 records where the 1-cosystolic classification stops.
Three protocol derivations, step by step
Each round of the Bacon–Shor persistent-fault readout model has twenty independent fault locations: nine data, two check-result and nine readout positions. The check-result positions are called ancilla faults in the implementation. The numerical implementation uses this order; the formal implementation swaps the ancilla and readout blocks, preserving weight. Data errors persist, so round contains the cumulative error . Let and be the readout and check-result errors in that round. The check parities and logical parity use the same noisy data record ; independent check-result flips are then added. With in-round check matrix and logical parity support , the syndrome and readout-error bit are
The bit is one exactly when round ’s readout differs from the ideal logical value. The strict-majority distance requires , as defined in Eq. (2). At , a final-round data fault on qubit zero with a canceling check-result fault has weight two, zero syndromes and . A first-round readout fault with its canceling check-result fault instead gives . These weight-two ties lie outside the strict-majority predicate.
A decoder failure distance requires its observed inputs and a decision or rejection rule for ties.
The boundary detector imposes . Together with adjacent comparisons, it forces every syndrome to zero, making an additional terminal syndrome constraint redundant. Endpoint fault pairs are allowed when their syndrome contributions cancel. Deleting this detector studies the present accumulation model, without the surrounding error correction used in the source protocol.
The lower bound for every round count. Let be a fault of weight at most two that fires no detector. First, every syndrome vanishes: the boundary detector gives , each comparison propagates it forward, and that is bsDetectorsOK_syndrome_eq_zero. Second, on a round untouched by and the syndrome is alone, hence
where the weight bound holds because a sum of data errors weighs no more than their total. The data-only readout bound implies for every vector in the check kernel of weight below three, so . Third, a round with must therefore carry a nonzero or of its own. A fault pattern of weight at most two has nonzero fault bits in at most two rounds. At most two of the readouts can then be one, and a majority needs more than of them, so , that is . That is the whole proof of bsHook_no_light_of_four, the case of four rounds and up. The two counts below it are kernel enumerations, bsHook_T2_distance_eq_three and bsHook_T3_distance_eq_three, and bsHook_distance_eq_three_universal is the three cases together. The weight-three witness that matches it from above is the spatial logical operator held as a data error from round zero on, hookW3gen_witness, whose syndrome is zero in every round because kills it and whose every readout is one.
Duplicating a check. Duplicate the first check row and give the copy its own check-result fault location, so a round can have twenty-one locations and the syndrome has three components; the third uses the first check row but has an independent check-result fault bit. The projection deletes the new location and reads the original twenty. Data faults, readout faults and the original check-result faults retain their original locations, so every readout is unchanged. The projected fault weighs no more than the fault it came from, one location having been dropped. The new detector conditions include all the old ones, which are the first two syndrome components. A fault of weight at most that fires no detector in the twenty-one-location model would therefore project to one of weight at most in the twenty-location model, which is hookCandDup_no_light_of. The duplicated check never lowers the fault distance, at any round count. At one round the duplication raises the fault distance from two to three: concealing a single data fault that flips the logical parity requires two independent check-result faults, one for each copy of the first check, as verified by `hookCandDup_T1_n o_light_two and dupHook_T1 witness. The one-round closed form. At a single round the accumulation is the round’s own data error, and the boundary detector reads . The check-result error must cancel the syndrome of everything else. Merge the data and measurement errors into . The readout is , so a logical fault needs , and the fault’s weight is
because weights are subadditive, and equality is available by taking . The witness puts in the data locations and in the check-result locations, t1Wit, of weight exactly the right-hand side. The lower bound and this witness prove the equality in bsHook_T1_formula. On the code the minimum is two, attained at , one data fault and the check-result fault that cancels its syndrome, bsHook_T1_min and bsHook_T1_distance_eq_two_formula.
Conventions
Matrix-indexed distance conventions
We write for a code with physical qubits, logical qubits and distance . The formal development labels each CSS distance by the matrix used as its kernel. Thus minimizes weight in outside the row space of , and minimizes weight in outside the row space of . Consequently, describes physical -type logical operators, and describes physical -type logical operators. Some texts interchange these names; the numerical values should be compared using the defining matrix, not the subscript alone.
is the complete graph on vertices. The Cheeger constant is the minimum of over nonempty proper vertex sets. The formal indicator is one when C1 holds and zero otherwise, so exactly when in this setting. is the repeated-measurement round count, is the vertex set in Theorem 2, and is the number of rounds between deformation steps.
X and Z labels. and name the two side distances and are defined by which check matrix plays the role of the kernel,
In this convention, describes physical -type logical operators, and describes physical -type ones. Some texts swap the labels. The declarations libDX and textbookDX and their swap lemmas verify the relation. The distinction matters when the two components differ.
Two formal witnesses gauge logical operators of the smallest toric code on different supports. The losing graph has edges , , on four support qubits and produces an eleven-qubit code. Its distances are and , certified by sepFail_dx and sepFail_dz. The preserving graph has edges , , , , , on six support qubits and produces a fourteen-qubit code. Its distances are and , certified by sepKeep_dx and sepKeep_dz. Both graphs violate C1; the six-vertex graph fails at , which has only one outgoing edge. Weight-two support and weight-one support provide the respective witnesses, sepKeep_lightLogical_two and sepFail_lightLogical.
The main figure uses a different pair with the same logical support . Its losing path is the four-vertex graph above, while its preserving path has edges , , . The preserving path has and no weight-one logical operator on either side, giving . These claims are sepFail_summary and sepKeepPath_summary; an exact for the preserving path is not asserted. Relabeling the support in increasing order gives edge lists and . Both fail C1 at the two-vertex cut with one outgoing edge. Both inherit a same-round detector from the original X-check dependencies and therefore violate C4. The Shor code provides a contrasting C4-satisfying example with eight independent generators, shor-generators_independent. The other named instances with both distances computed have equal components, as recorded in the _dx_eq_dz ledger.
Distance. When nontrivial operators exist, each static CSS distance component is the minimum weight in one check kernel outside the other check row space; protocol distances use their specified detector and readout-error predicates. The finite static instances are computed from weight-limited enumeration, with a kernel-checked covering lemma, mem_lightVecs:
The equality length_lightVecs counts the generated weight list, and lightCand_length_le bounds the candidate list by this count. The polynomial bound follows term by term: each for , and there are terms. It is polynomial at fixed and supports the small-distance calculations reported here. If the threshold exceeds , the generated weight list contains all binary vectors.
Undetectable logical fault. In a protocol, a candidate must fire no detector and satisfy the specified readout-error predicate. A chosen linear parity and a strict-majority rule define different predicates. For the static specialization, flipsReadout_readoutsOff_iff equates non-membership in a check row space with flipping some readout in its orthogonal complement. A selected logical parity tests a subset of the faults relevant to the full static distance.
Supplements are cited by the numbering of the gauging paper’s published Supplementary Information: the time fault-distance identity is its Lemma 3, the boundary convention its Remark 3, and the no-local-detector assumption its Remark 2. The arXiv v2 numbers the same three statements Lemma 6, Remark 5 and Remark 4.
Symbols. is the number of checks of the repeated measurement in the temporal instance, and the number of rounds. In the expansion conditions is the size of the support the logical operator acts on, and the complete graph on it. In the bivariate bicycle instances is the second shift parameter, and in the toric family it is the cycle length. is the chosen component family of the auxiliary hypergraph, and is the port function defined in the surgery paper’s construction. That paper’s §7 re-uses for the subspace the port images generate, so a reader following the symbol there meets the second reading. The two-term factor complex of the foliation is written in the Künneth formula, and denotes its differential matrix. Its repetition-code instances are , whose matrix has rows and columns. The number of time coordinates is therefore .
The assembly in the source’s notation
The source’s spatial bound is , with defined in Section S13. Combined with enough rounds, the two component statements read
C1 gives , making the spatial prefactor in Eq. (29) equal to one. The formal development uses the indicator rather than the full Cheeger constant. It therefore verifies the expansion-at-least-one regime, without claiming the source’s bound when . The -type spatial theorem and temporal identity are proved separately. The assembled arithmetic statement takes these two component facts as hypotheses; it does not build a common circuit model.
The one-round protocol
We prove Eq. (15) by matching lower and upper bounds. Write the one-round data, readout and check-result errors as , , , and set . The zero-syndrome condition requires , and a logical readout error requires . Since the fault blocks are disjoint, the total weight is . Subadditivity gives , so every candidate has weight at least . Conversely, choose , and . This fault has zero syndrome , readout and weight exactly . Minimizing over admissible proves the identity.
The counting lemma, step by step
The coordinate argument below expands the three steps of Theorem 2. Let be a physical -type operator in the deformed -check kernel but outside the deformed -check row space. Let and be its supports on vertex and edge qubits, and let be its support outside the auxiliary graph.
Step one: cut–cycle duality. Since commutes with the cycle checks, meets every cycle evenly. Cut–cycle duality gives for some vertex set . Replacing by its complement leaves the cut unchanged, so choose .
Step two: cleaning. Multiply by the Gauss laws indexed by . Each vertex in is flipped once. An edge is flipped once if it leaves , and zero or twice otherwise. Thus the product has vertex support and edge support , as in Eq. (10). The edge support cancels , leaving on vertices and outside the graph. Multiplication by checks preserves membership in the check kernel and non-membership in the stabilizer row space.
Step three: counting. With no edge support, the cleaned operator commutes with the original checks. The lifted original checks lie in the deformed -check row space. Hence nontriviality in the deformed code implies nontriviality of the cleaned operator in the original code. Its weight is at least , giving the first inequality of Eq. (11). The set identity gives the second. C1 and the choice of the smaller side give , yielding the third. The final expression counts the disjoint vertex, edge and outside supports of and equals its weight. The construction hypotheses therefore imply both the smaller-side choice and the logicality of the cleaned operator.
Axiom audit
The proof assistant prints the axiom dependencies of every declaration in the audit region. Of the 1,031 audited declarations, 1,009 use exactly the standard base , 17 use a proper subset and 5 use none. No audited declaration uses reflection or compiler evaluation, and the development contains no unproved step.
Audit procedure
At the end of the root module, the proof assistant prints every declaration in the audit region together with the axioms it uses. The audit script checks that each declaration belongs to the build closure, lists every unaudited declaration for manual review and compares the four class counts with the values reported above. A mismatch fails the build-time gate, and a stale log is marked as unmeasured. The 17 declarations in the proper-subset class rest on propext alone, on Quot.sound alone, or on propext together with Quot.sound.
S18 Reproduction
Readout and circuit bounds. The scripts in
research/prxq-strengtheningcheck the formulas in the first proof section. The Julia scriptverify_exact_distances.jlsupplies the finite dynamic programs;gate_signature_check.pyindependently checks the saved CNOT schedules by backward Pauli propagation. The scriptcircuit_schedule_bound.pyverifies every eligible constructive witness on those schedules, on two serial schedules and on 128 additional interleavings. It also checks all 120 local orderings of a five-interaction example. These finite checks accompany the direct proofs; they establish no optimum over all circuits.
Build.
lake build, run in the development directory of the archived snapshot named in the paper’s data-availability statement, fetches every dependency from its pinned revision, so no machine-local path is configured. One of those dependencies is the QECCertificates package, which ships the modules named throughout this supplement and is pinned like the rest. On a machine that has not built mathlib before,lake exe cache getis run first. The build ends with the audit lines summarized in § 1.29 of this supplement.
Audit. The classification is read off those lines and then checked against the build log. A declaration whose list is not a subset of the three standard axioms, or one that mentions a reflection axiom, fails the counting gate, which compares the transcribed numbers with what the build printed.
Numbers. Every instance parameter and all three families are recomputed by the kernel during the build: the instance parameters by a
by decideevaluation over finite data, the three families by general theorems; every point of the data figure is a kernel assertion, and the second implementation below recomputes all of them independently. The instance table covers seven code families and sixteen parameter sets. Each parameter set has its check matrices written out, and both its dimension and its exact distance are settled byby decide.
Enumerations. Several computations are Julia scripts in that snapshot, run from its code directory as
julia --project=<code-directory> <script>. They are the enumerations behind the data figure; the classification of the expansion condition over every measured logical of support at most six and every connected auxiliary graph on its support, on the two smallest members of the toric family; and the condition-cost census. Each carries assertions on the values this paper quotes from it, and the figure’s script asserts every value it shares with a kernel-checked distance. The classification covers 107,428 pairs on the code and 1,388,136 on the one; the support-size cap excludes no logical operator on the first code, where none is heavier than six, and restricts the search to supports of size at most six on the second. Each deformed check is completed by a minimum-weight edge set satisfying the source’s parity condition. Minimum weight is a choice of this numerical implementation, not an additional requirement of the source’s definition. On both codes every instance meeting the condition keeps the code’s distance. The -side reading is recorded in the same snapshot, and no instance on either code carries an -side logical below the code distance.
A control model. The data files also carry a further fault model, over the same detector set with the criterion requiring a strict majority of wrong readouts replaced by a flip of the last round’s readout. Its distances at are 2, 2, 2, 2, where the strict-majority model gives 2, 3, 3, 3: a final-round data fault and its canceling check-result fault suffice at every round count. This numerical control is not among the twelve kernel-certified points drawn in the figure. Its regression tests distinguish a last-round flip from flipping every round and explicitly check the two-round ties.
Cross-checks. The independent probes used as further cross-checks are two Julia scripts for the two foliation distances, over 202 and 3564 small instances respectively, with no counterexample to the closed form each tests. The dual one was run beside two competing closed forms, and , with the length of the repetition factor, and refutes each of them, on 2286 and 1524 instances. The census carries its own checker beside it. A third probe, in the snapshot’s own tools directory, tests the Künneth identity of the foliated construction for general factor differentials over 136 random pairs of chain complexes, with no counterexample to the formula, and uses the zero-differential case as a control. The remaining probes in that directory are cross-checks, not sources of quoted numbers.
The gauging step. The step itself is carried inside the kernel. The development builds the Gauss laws, pairing edges and cycle checks from the data and checks them entrywise against the matrices of the modules listed in Table S3. It states two facts as theorems: the measured operator’s promotion to a check,
bb24L_mem_rowSpace, and the dimension drop,bb18_gauged_drop. The numerical prototype is the independent second path of the step.
References
- [6]S. Bravyi, A. W. Cross, J. M. Gambetta, D. Maslov, P. Rall, and T. J. Yoder, High-threshold and low-overhead fault-tolerant quantum memory, Nature 627, 778 (2024).DOI
- [14]Supplemental material, see Supplemental Material at [URL will be inserted by publisher] for the module map, the conventions the numbers depend on, the axiom audit, and the commands that reproduce every number quoted here.. (n.d.). Supplemental material, see Supplemental Material at [URL will be inserted by publisher] for the module map, the conventions the numbers depend on, the axiom audit, and the commands that reproduce every number quoted here..
- [15]S. An and F. Yang, The cost of each side condition in a gauged logical measurement (2026), version 0.3, formal development and numerical data.DOI
- [16]S. An, QECCertificates: checkable distance certificates for quantum error correction (2026).DOI
- [17]G. Lee, Gauging the spacetime code (2026), arXiv:2606.05664.arXiv
- [18]A. Cowtan, Z. He, D. J. Williamson, and T. J. Yoder, Fast and fault-tolerant logical measurements: auxiliary hypergraphs and transversal surgery (2025), arXiv:2510.14895.arXiv
- [19]D. Bacon, Operator quantum error-correcting subsystems for self-correcting quantum memories, Phys. Rev. A 73, 012340 (2006).DOI
- [20]P. Aliferis and A. W. Cross, Subsystem fault tolerance with the Bacon-Shor code, Phys. Rev. Lett. 98, 220502 (2007).pubmed.ncbi.nlm.nih.gov/17677825
- [21]E. Dennis, A. Kitaev, A. Landahl, and J. Preskill, Topological quantum memory, J. Math. Phys. 43, 4452 (2002).DOI
- [22]Bravyi, S., & Hastings, M. B. (2014). Homological product codes. Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), 273–282.
- [23]Ehatamm, M., Lee, Y., Wu, X., & Tao, R. (2026). End-to-end formalization of quantum error correction. https://github.com/VerifiedQC/Lean-QECgithub.com/VerifiedQC/Lean-QEC
- [24]Jain, S. (2025). QECLean: Formalized quantum error correction. GitHub Repository.
- [25]T. Hillmann, G. Dauphinais, I. Tzitrin, and M. Vasmer, Single-shot and measurement-based quantum error correction via fault complexes, Phys. Rev. A 112, L040401 (2025).DOI
- [26]A. C. Yuan, A. Cowtan, Z. He, T.-C. Lin, and D. J. Williamson, Parsimonious quantum low-density parity-check code surgery (2026), arXiv:2603.05082.arxiv.org/abs/2603.05082
- [27]A. Cowtan, Z. He, D. J. Williamson, and T. J. Yoder, Parallel logical measurements via quantum code surgery, PRX Quantum 7, 020325 (2026).DOI
- [28]E. Swaroop, T. Jochym-O’Connor, and T. J. Yoder, Universal adapters between quantum low-density parity check codes, PRX Quantum 7, 010324 (2026).DOI
- [29]D. J. Williamson, Fast magic state preparation by gauging higher-form transversal gates in parallel (2026), arXiv:2601.22939.arxiv.org/abs/2601.22939
- [30]N. Delfosse and A. Paetznick, Spacetime codes of Clifford circuits (2023), arXiv:2304.05943.arxiv.org/abs/2304.05943
- [31]S. B. Bravyi and A. Y. Kitaev, Quantum codes on a lattice with boundary (1998), arXiv:quant-ph/9811052.DOI
- [32]A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland, Surface codes: Towards practical large-scale quantum computation, Phys. Rev. A 86, 032324 (2012).DOI
- [33]A. Bolt, G. Duclos-Cianci, D. Poulin, and T. M. Stace, Foliated quantum error-correcting codes, Phys. Rev. Lett. 117, 070501 (2016).DOI
- [34]Y. Xu, Y. Wang, and Z.-W. Liu, A framework for low-overhead quantum fault tolerance via spacetime lifting (2026), arXiv:2606.06365.arxiv.org/abs/2606.06365
- [35]B. Hetényi, B. J. Brown, and D. J. Williamson, Constant-depth magic state cultivation with Clifford measurements by gauging, Phys. Rev. Lett. 137, 140601 (2026).DOI
- [36]Evra, S., Kaufman, T., & Zémor, G. (2024). Decodable quantum LDPC codes beyond the $\sqrt{n}$ distance barrier using high-dimensional expanders. SIAM J. Comput., 53, FOCS20–276.
- [37]T. Kaufman and I. Oppenheim, High order random walks: Beyond spectral gap, Combinatorica 40, 245 (2020).arxiv.org/abs/1707.02799
- [38]A. Lubotzky, High dimensional expanders, in Proceedings of the International Congress of Mathematicians (ICM 2018) (World Scientific, 2019) pp. 705–730.arxiv.org/abs/1712.02526
- [39]Y. Dikstein and I. Dinur, Coboundary and cosystolic expansion without dependence on dimension or degree, in Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2024), LIPICS, Vol. 317 (Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024) pp. 62:1–62:24.arxiv.org/abs/2304.01608
- [40]A. Vardy, The intractability of computing the minimum distance of a code, IEEE Trans. Inf. Theory 43, 1757 (1997).DOI
- [41]S. Wu, D. Zhong, T. A. Brun, and D. A. Lidar, Universal weakly fault-tolerant quantum computation via code switching in the [[8, 3, 2]] code, Phys. Rev. Research 8, 033380 (2026).DOI
- [42]A. W. Cross, Z. He, P. J. Rall, and T. J. Yoder, Improved QLDP code surgery: logical measurements and bridging codes (2024), arXiv:2407.18393.arxiv.org/abs/2407.18393
- [43]B. Ide, M. G. Gowda, P. J. Nadkarni, and G. Dauphinais, Fault-tolerant logical measurements via homological measurement, Phys. Rev. X 15, 021088 (2025).DOI
- [44]L. Berent, L. Z. Cohen, and A. O. Quintavalle, Lifted surgery: Fast processing with qldpc codes (2026), arXiv:2609.11723.arxiv.org/abs/2609.11723