44 Rem 21: CSS Code Initialization as Gauging
This chapter formalizes the observation that standard CSS code initialization can be implemented via the hypergraph gauging framework. A CSS code is typically initialized by preparing \(|0\rangle ^{\otimes n}\) and measuring all \(X\)-type checks. This process can be reformulated as: (1) starting with a trivial code having one dummy vertex per \(X\)-type check, (2) performing a generalized gauging measurement using the hypergraph corresponding to the \(Z\)-type checks, and (3) ungauging by measuring \(Z\) on all qubits. Furthermore, Steane-style measurement of a stabilizer group can be implemented by combining state preparation gauging with pairwise \(XX\) gauging between data and ancilla code blocks.
44.1 CSS Code Structure
A CSS code (Calderbank–Shor–Steane code) is a structure consisting of:
A positive integer \(n\) (the number of physical qubits), with \(n {\gt} 0\).
A number \(n_X\) of \(X\)-type check generators and \(n_Z\) of \(Z\)-type check generators.
For each \(i \in \mathrm{Fin}(n_X)\), a nonempty support set \(\mathrm{xCheckSupport}(i) \subseteq \mathrm{Fin}(n)\) indicating the qubits on which \(X\) acts.
For each \(j \in \mathrm{Fin}(n_Z)\), a nonempty support set \(\mathrm{zCheckSupport}(j) \subseteq \mathrm{Fin}(n)\) indicating the qubits on which \(Z\) acts.
The CSS orthogonality condition: for all \(i \in \mathrm{Fin}(n_X)\) and \(j \in \mathrm{Fin}(n_Z)\),
\[ |\mathrm{xCheckSupport}(i) \cap \mathrm{zCheckSupport}(j)| \equiv 0 \pmod{2}. \]
The weight of the \(i\)-th \(X\)-type check of a CSS code \(C\) is \(|\mathrm{xCheckSupport}(i)|\).
The weight of the \(j\)-th \(Z\)-type check of a CSS code \(C\) is \(|\mathrm{zCheckSupport}(j)|\).
For every \(i \in \mathrm{Fin}(n_X)\), the \(X\)-check weight satisfies \(0 {\lt} \mathrm{xCheckWeight}(i)\).
This follows directly from the fact that \(\mathrm{xCheckSupport}(i)\) is nonempty, so its cardinality is positive.
For every \(j \in \mathrm{Fin}(n_Z)\), the \(Z\)-check weight satisfies \(0 {\lt} \mathrm{zCheckWeight}(j)\).
This follows directly from the fact that \(\mathrm{zCheckSupport}(j)\) is nonempty, so its cardinality is positive.
44.2 Initialization Hypergraph
The initialization hypergraph of a CSS code \(C\) is the hypergraph with vertex set \(\mathrm{Fin}(n)\) (physical qubits) and hyperedge set \(\mathrm{Fin}(n_Z)\) (one hyperedge per \(Z\)-type check), where the incidence function maps each \(Z\)-check index \(j\) to the support \(\mathrm{zCheckSupport}(j)\).
The initialization hypergraph has \(|\mathrm{Fin}(n)| = n\) vertices.
This holds by the cardinality of finite types: \(|\mathrm{Fin}(n)| = n\).
The initialization hypergraph has \(|\mathrm{Fin}(n_Z)| = n_Z\) hyperedges.
This holds by the cardinality of finite types: \(|\mathrm{Fin}(n_Z)| = n_Z\).
44.3 X-Checks in Kernel of \(H_Z\)
The \(i\)-th \(X\)-check vector of a CSS code \(C\) is the binary vector \(\mathbf{x}_i \in (\mathbb {Z}/2\mathbb {Z})^n\) defined by
For every \(X\)-check index \(i \in \mathrm{Fin}(n_X)\), the \(X\)-check vector \(\mathbf{x}_i\) lies in the operator kernel of the initialization hypergraph:
Equivalently, for all \(j \in \mathrm{Fin}(n_Z)\):
We rewrite the kernel membership condition using the characterization that \(\mathbf{x}_i \in \ker (H_Z)\) if and only if for all \(j\), \(\sum _{v \in \mathrm{zCheckSupport}(j)} \mathbf{x}_i(v) = 0\) in \(\mathbb {Z}/2\mathbb {Z}\). Let \(j\) be arbitrary. We unfold the definition of the initialization hypergraph. For each \(v \in \mathrm{zCheckSupport}(j)\), we have \(\mathbf{x}_i(v) = 1\) if \(v \in \mathrm{xCheckSupport}(i)\) and \(0\) otherwise. We rewrite the sum by splitting it into elements in \(\mathrm{xCheckSupport}(i) \cap \mathrm{zCheckSupport}(j)\) (contributing \(1\) each) and elements outside the intersection (contributing \(0\) each). After simplification using \(\sum _{v \in S} 1 = |S|\) and \(\sum _{v \in S} 0 = 0\), we observe that the filter equals the intersection \(\mathrm{xCheckSupport}(i) \cap \mathrm{zCheckSupport}(j)\), rewriting using commutativity. The result then follows from the CSS orthogonality condition \(|\mathrm{xCheckSupport}(i) \cap \mathrm{zCheckSupport}(j)| \equiv 0 \pmod{2}\), which implies the cardinality is even and hence zero in \(\mathbb {Z}/2\mathbb {Z}\).
For every \(X\)-check index \(i\), the vector \(\mathbf{x}_i\) is in the operator kernel of the initialization hypergraph, making the \(X\)-check measurable via the hypergraph gauging procedure.
This follows directly from the core theorem xCheck_in_kernel.
For any two \(X\)-check indices \(i, j \in \mathrm{Fin}(n_X)\), the sum (XOR) \(\mathbf{x}_i + \mathbf{x}_j\) is also in the operator kernel of the initialization hypergraph.
Since the operator kernel is a submodule (in particular closed under addition), this follows by applying the submodule addition closure to the facts \(\mathbf{x}_i \in \ker (H_Z)\) and \(\mathbf{x}_j \in \ker (H_Z)\) established by xCheck_in_kernel.
The zero vector \(\mathbf{0} \in (\mathbb {Z}/2\mathbb {Z})^n\) is in the operator kernel of the initialization hypergraph.
This follows from the general fact that zero is in the kernel of any hypergraph (Hypergraph.zero_mem_kernel).
44.4 Dummy Vertex Structure
The CSS initialization vertex type for a CSS code \(C\) is the disjoint union of physical qubits and dummy vertices:
where:
\(\mathrm{qubit}(i)\) for \(i \in \mathrm{Fin}(n)\) represents physical qubit \(i\),
\(\mathrm{dummy}(j)\) for \(j \in \mathrm{Fin}(n_X)\) represents the dummy vertex for the \(j\)-th \(X\)-check.
A predicate on initialization vertices that returns \(\mathrm{true}\) for dummy vertices and \(\mathrm{false}\) for qubit vertices.
The total number of CSS initialization vertices is \(n + n_X\):
We establish an equivalence between \(\mathrm{CSSInitVertex}(C)\) and \(\mathrm{Fin}(n) \oplus \mathrm{Fin}(n_X)\) by mapping \(\mathrm{qubit}(i) \mapsto \mathrm{inl}(i)\) and \(\mathrm{dummy}(j) \mapsto \mathrm{inr}(j)\), with the obvious inverse. Both left and right inverses hold by case analysis. Using the cardinality of a sum type (\(|\mathrm{Fin}(n) \oplus \mathrm{Fin}(n_X)| = |\mathrm{Fin}(n)| + |\mathrm{Fin}(n_X)| = n + n_X\)), the result follows.
There are exactly \(n_X\) dummy vertices:
We show that the filter \(\{ v \mid v.\mathrm{isDummy} = \mathrm{true}\} \) equals the image of \(\mathrm{dummy} : \mathrm{Fin}(n_X) \to \mathrm{CSSInitVertex}(C)\). By extensionality on \(v\): in the forward direction, if \(v.\mathrm{isDummy} = \mathrm{true}\), then \(v\) must be of the form \(\mathrm{dummy}(i)\) (since \(\mathrm{qubit}\) vertices return false); in the reverse direction, \(\mathrm{dummy}(i).\mathrm{isDummy} = \mathrm{true}\) by definition. We then rewrite using the image characterization, and since \(\mathrm{dummy}\) is injective, the cardinality of the image equals \(|\mathrm{Fin}(n_X)| = n_X\).
44.5 Gauging Procedure for Initialization
The gauging procedure for CSS initialization introduces \(n_Z\) new qubits (one per hyperedge, i.e., one per \(Z\)-check):
By simplification using the definitions of \(\mathrm{newQubitCount}\) and \(|\mathrm{Fin}(n_Z)| = n_Z\).
The gauging procedure introduces \(n\) new checks (one Gauss law operator \(A_v\) per qubit vertex):
By simplification using the definitions of \(\mathrm{newCheckCount}\) and \(|\mathrm{Fin}(n)| = n\).
The sum of all Gauss law vertex supports equals the all-ones vector, representing \(L = \prod _v X_v\):
This follows from the general hypergraph result gaussLaw_vertex_support_sum_allOnes.
44.6 Steane-Style Measurement via Gauging
The Steane vertex type for \(n\) qubits is the disjoint union of a data block and an ancilla block:
where \(\mathrm{data}(i)\) represents qubit \(i\) in the data block and \(\mathrm{ancilla}(i)\) represents qubit \(i\) in the ancilla block.
The total number of Steane vertices is \(2n\):
We establish an equivalence between \(\mathrm{SteaneVertex}(n)\) and \(\mathrm{Fin}(n) \oplus \mathrm{Fin}(n)\) by mapping \(\mathrm{data}(i) \mapsto \mathrm{inl}(i)\) and \(\mathrm{ancilla}(i) \mapsto \mathrm{inr}(i)\), with the obvious inverse. Both directions hold by case analysis. Using \(|\mathrm{Fin}(n) \oplus \mathrm{Fin}(n)| = n + n\), the result \(2n\) follows by integer arithmetic.
The pairwise \(XX\) operator support for qubit index \(i \in \mathrm{Fin}(n)\) is the function \(\mathrm{SteaneVertex}(n) \to \mathbb {Z}/2\mathbb {Z}\) given by:
This represents the \(X_i^{\mathrm{data}} \otimes X_i^{\mathrm{ancilla}}\) operator acting on matching qubit pairs.
For \(n {\gt} 0\) and any \(i \in \mathrm{Fin}(n)\), the pairwise \(XX\) operator has weight 2:
We show that \(\{ v \mid \mathrm{pairwiseXXSupport}(i)(v) = 1\} = \{ \mathrm{data}(i), \mathrm{ancilla}(i)\} \). By extensionality: in the forward direction, if \(v\) is a data vertex \(\mathrm{data}(j)\) with value 1, then the if-then-else forces \(j = i\), so \(v = \mathrm{data}(i)\); similarly for ancilla vertices. In the reverse direction, \(\mathrm{data}(i)\) and \(\mathrm{ancilla}(i)\) evaluate to 1 by definition. Since \(\mathrm{data}(i) \neq \mathrm{ancilla}(i)\) (by the injectivity of constructors), the set \(\{ \mathrm{data}(i), \mathrm{ancilla}(i)\} \) has cardinality \(1 + 1 = 2\).
All pairwise \(XX\) operators commute with each other. For any \(i, j \in \mathrm{Fin}(n)\):
By simplification using the definition of the symplectic inner product with zero \(Z\)-components.
44.7 Steane Gauging Hypergraph
The Steane gauging hypergraph for \(n\) qubits is the hypergraph with vertex set \(\mathrm{SteaneVertex}(n)\) and hyperedge set \(\mathrm{Fin}(n)\), where each hyperedge \(i\) consists of the pair \(\{ \mathrm{data}(i), \mathrm{ancilla}(i)\} \).
Each hyperedge of the Steane hypergraph has exactly 2 vertices.
By unfolding the definition, each hyperedge is \(\{ \mathrm{data}(i), \mathrm{ancilla}(i)\} \). Since \(\mathrm{data}(i) \neq \mathrm{ancilla}(i)\) (by the constructor disjointness), the pair has cardinality 2.
The Steane hypergraph is graph-like (all hyperedges have size exactly 2).
Let \(h\) be an arbitrary hyperedge. This follows directly from steaneHypergraph_edge_card.
The all-ones vector \(\mathbf{1}\) on all Steane vertices is in the operator kernel (since each edge has even cardinality).
This follows from the general result that for graph-like hypergraphs the logical (all-ones) vector is in the kernel (Hypergraph.graphLike_logical_in_kernel), applied to the fact that the Steane hypergraph is graph-like.
44.8 Three-Step Steane Procedure
The Steane gauging steps are the three phases of Steane-style measurement via gauging:
State preparation: Initialize ancilla code block via CSS gauging.
Entangling measurement: Pairwise \(XX\) gauging between data and ancilla blocks.
Readout: \(Z\) measurement on ancilla qubits (ungauging).
There are exactly 3 steps in the Steane gauging procedure:
This is verified by computation (the type has exactly three constructors).
The readout support function assigns \(1 \in \mathbb {Z}/2\mathbb {Z}\) to ancilla vertices and \(0\) to data vertices:
This represents the fact that the readout step measures \(Z\) on ancilla qubits only.
For \(n {\gt} 0\), the number of qubits measured in readout is \(n\) (all ancilla qubits):
We show that \(\{ v \mid \mathrm{readoutSupport}(n)(v) = 1\} \) equals the image of \(\mathrm{ancilla} : \mathrm{Fin}(n) \to \mathrm{SteaneVertex}(n)\). By extensionality: in the forward direction, if \(v\) is a data vertex, then \(\mathrm{readoutSupport}\) returns 0, contradicting the hypothesis; if \(v = \mathrm{ancilla}(i)\), then \(v\) is in the image. In the reverse direction, \(\mathrm{readoutSupport}(\mathrm{ancilla}(i)) = 1\) by definition. We then rewrite using the image characterization, and since \(\mathrm{ancilla}\) is injective, the cardinality equals \(|\mathrm{Fin}(n)| = n\).
44.9 Unification Under Gauging Framework
CSS initialization is a special case of hypergraph gauging: for every \(i \in \mathrm{Fin}(n_X)\),
This follows directly from xCheck_in_kernel.
The measurable group for CSS initialization contains all pairwise sums of \(X\)-checks: for all \(i, j \in \mathrm{Fin}(n_X)\),
This follows directly from xCheck_sum_in_kernel.
The Steane gauging hypergraph is \(2\)-local (i.e., every hyperedge has at most 2 vertices).
Let \(h\) be an arbitrary hyperedge. By steaneHypergraph_edge_card, the cardinality of each hyperedge is exactly 2, so \(|h| \leq 2\) holds by the fact that equality implies the inequality.
For each \(i \in \mathrm{Fin}(n)\), the pairwise \(XX\) support vector lies in the operator kernel of the Steane hypergraph:
We rewrite the kernel membership condition. Let \(j\) be an arbitrary hyperedge index. We unfold the Steane hypergraph definition, obtaining that the hyperedge \(j\) consists of \(\{ \mathrm{data}(j), \mathrm{ancilla}(j)\} \). We compute the sum over this pair: \(\mathrm{pairwiseXXSupport}(i)(\mathrm{data}(j)) + \mathrm{pairwiseXXSupport}(i)(\mathrm{ancilla}(j))\). We consider two cases. If \(i = j\), then both values are 1, and \(1 + 1 = 0\) in \(\mathbb {Z}/2\mathbb {Z}\). If \(i \neq j\), then both values are 0 (since \(j \neq i\)), and \(0 + 0 = 0\).
The sum of all pairwise \(XX\) operator support vectors equals the all-ones vector:
This represents the fact that the product of all \(XX\) operators gives the logical operator \(L = \prod _v X_v\).
By extensionality, it suffices to show equality for an arbitrary vertex \(v\). We apply the pointwise sum. We case-split on whether \(v\) is a data or ancilla vertex. If \(v = \mathrm{data}(j)\), we use the fact that \(\sum _i \mathrm{pairwiseXXSupport}(i)(\mathrm{data}(j))\) has exactly one nonzero summand (when \(i = j\), contributing 1), and all other summands are 0 (since \(j \neq i\) implies the value is 0). The result follows from \(\texttt{Finset.sum\_ eq\_ single}\) applied to index \(j\). The case \(v = \mathrm{ancilla}(j)\) is handled identically.