Checks and bounds¶
CliNR implements each chunk \(C_k\) of the circuit by gate teleportation.
It prepares the resource state \((I \otimes C_k)|\Phi^+\rangle^{\otimes n}\) apart from the data, measures r of its stabilizers, the checks, and teleports the data through it only if every check passes.
We explain why a check catches a fault, what the two families of checks guarantee, and how those guarantees combine into the bounds that clinr.bounds.plog_bound() and clinr.bounds.overhead_bound() compute.
We follow the paper’s Lemma 1 and Theorem 1 (Delfosse and Tham, arXiv:2407.06583), and close by saying where our bounds part from them; the bounds for CZNR are treated in CZNR, for circuits of CZ gates.
What a check detects¶
The resource state has \(2n\) qubits, and its stabilizer group \(S\) has \(2^{2n}\) elements, generated by the propagated Bell stabilizers \(X_i \otimes C_k X_i C_k^\dagger\) and \(Z_i \otimes C_k Z_i C_k^\dagger\). A fault leaves some Pauli error \(E\) on the resource. Measuring a check \(g \in S\) flips its outcome exactly when \(E\) anticommutes with \(g\).
For a fixed \(E\), the map that sends \(g\) to \(0\) if \(g\) commutes with \(E\) and to \(1\) otherwise is a homomorphism from \(S\) to \(\mathbb{F}_2\). If \(E\) commutes with all of \(S\), then \(E\) lies in \(S\) up to a phase, because \(S\) is a maximal commuting group, and \(E\) leaves the resource unchanged. Otherwise \(E\) damages the resource, the homomorphism is onto, and its kernel has index 2. Thus exactly half of \(S\) anticommutes with a damaging error, and no fault damages the state while commuting with every stabilizer. Which elements of \(S\) to measure is then a choice, and the package offers two.
The two families of checks¶
clinr.checks.draw_checks() draws the r checks of a chunk independently, with replacement, from one of two families.
Uniform over the group. A check is a uniformly random element of \(S\), the identity included, as in the paper. Exactly half of \(S\) commutes with a damaging \(E\), so one draw misses with probability \(q = 1/2\). The price is weight: an element of \(S\) acts on up to \(2n\) qubits, and a weight-\(w\) check costs \(w\) two-qubit gates.
Restricted.
The family of the paper’s Sec. V (clinr.checks.restricted_family()) keeps, for each Bell pair \(i\), the triple of propagated \(XX\), \(ZZ\) and their product, the propagated \(YY\): \(3n\) elements, each of weight 1 on the bare half and at most \(n\) on the other, so of weight at most \(n + 1\).
Commutation with \(E\) is a homomorphism, so on a triple it takes the values \((a, b, a \oplus b)\), which contain either no 1 or exactly two.
The \(2n\) pair stabilizers generate \(S\), so a damaging \(E\) anticommutes with at least one of them, and its triple then contains exactly two anticommuting elements.
One draw from the \(3n\) therefore misses with probability at most
and enumerating every Pauli on \(2n\) qubits shows the bound is attained at \(n = 1, 2, 3\). At \(n = 1\) the family is the whole group without the identity, with a miss of \(1/3\); beyond, the restricted miss approaches 1 while the uniform one stays at \(1/2\). The paper runs its numerics with this family, while Theorem 1 covers uniform checks only.
With the miss of one check in hand, we can bound the logical error rate.
The bound on the logical error rate¶
Split the operations of a chunk into three regions: the resource (preparing the Bell pairs and applying \(C_k\)), the checks, and the teleportation that moves the data through the resource after the last check. The resource and the checks together form the protected region, of \(m\) operations. For a region with \(n_1\) single-qubit gates, \(n_2\) two-qubit gates, \(n_m\) measurements and \(n_p\) preparations, the probability that some operation in it faults is
An accepted shot of the chunk ends in a logical error only if a resource fault escapes all r checks, a check fault escapes the later checks, or the teleportation faults.
A resource fault leaves an error fixed before the checks are measured, which all r draws miss with probability at most \(q^r\).
A fault in the \(j\)-th check gadget leaves an error that depends on that gadget’s check, but the later checks are drawn independently of it, so they all miss it with probability at most \(q^{r-j}\); summing over the gadgets gives the escape factor
The shot is accepted at least whenever no operation in the protected region faults. So, conditioned on acceptance,
with \(g_{\mathrm{check}}\) the fault probability of one check gadget at the family’s worst-case weight.
clinr.bounds.plog_bound() returns the sum of \(p_k\) over the chunks: a logical error in the output needs one in some chunk.
At \(t = 1\) this is the paper’s Lemma 1, Eq. (B1); clinr.accounting counts each region’s operations from the circuit as built.
Without checks every attempt is accepted, so there is nothing to condition on. At \(r = 0\) the bound is instead the probability that some operation in the resource or the teleportation faults, which is below the expression above at \(r = 0\).
The bound on the gate overhead¶
The protocol measures all r checks of an attempt before deciding (see 1. Run every check of an attempt before deciding), so every attempt at chunk \(k\) costs its \(m_k\) operations, and the number of attempts is geometric with mean \(1/a_k\), where \(a_k\) is the acceptance probability.
The teleportation, \(4n\) operations, follows the last check and is paid once.
By Wald’s identity the expected number of operations per gate is
and clinr.bounds.overhead_bound() replaces each \(a_k\) by its lower bound \(1 - g_{\mathrm{protected}}\), with every check at worst-case weight.
clinr.estimators.gate_overhead() evaluates the same expression with the acceptance and check weights measured.
Without checks \(a_k = 1\), and the bound is exact.
How these bounds differ from Theorem 1¶
Theorem 1 states the two bounds for one error rate \(p\) and \(t\) chunks of \(s_0 = \lceil s/t \rceil\) gates each. Ours differ from them as follows, and Differences from the paper collects these with the package’s other departures from the paper:
Four rates, one per kind of operation, where the paper uses one.
Exact chunk sizes: each chunk is charged its own gates, where the paper charges every chunk \(s_0\).
\(4n\) for the teleportation, where the paper’s \(5n\) includes \(n\) Pauli gates applying the correction; we track the correction as a Pauli frame instead (2. Deliver the output up to a Pauli frame).
The preparation convention: by default \(|+\rangle\) is a reset and a Hadamard, two operations where the paper counts one; with
native_plus=Truethe counts match the paper’s.No conditioning without checks: at \(r = 0\) every attempt is accepted, so our bound on the logical error rate does not divide by a probability of acceptance and our overhead bound is exact, where Theorem 1 keeps the factor \((1 - p)^{-m_0}\) in both.
The restricted family is bounded too, with the per-draw miss above, where Theorem 1 covers uniform checks only.
Under the paper’s own conventions (one rate, native_plus=True, uniform checks), our bounds never exceed Theorem 1’s, which the test suite checks over random circuits and parameters.
Theorem 1 takes at most \(s\) chunks, since any beyond the \(s\)-th would be empty. This implementation allows more (3. Allow more chunks than gates), and our overhead bound charges each empty chunk its preparation, checks and teleportation.