MerLean-example

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

Definition 1416 CSS Code
#

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}. \]
Definition 1417 X-Check Weight

The weight of the \(i\)-th \(X\)-type check of a CSS code \(C\) is \(|\mathrm{xCheckSupport}(i)|\).

Definition 1418 Z-Check Weight

The weight of the \(j\)-th \(Z\)-type check of a CSS code \(C\) is \(|\mathrm{zCheckSupport}(j)|\).

Theorem 1419 X-Check Weights are Positive

For every \(i \in \mathrm{Fin}(n_X)\), the \(X\)-check weight satisfies \(0 {\lt} \mathrm{xCheckWeight}(i)\).

Proof

This follows directly from the fact that \(\mathrm{xCheckSupport}(i)\) is nonempty, so its cardinality is positive.

Theorem 1420 Z-Check Weights are Positive

For every \(j \in \mathrm{Fin}(n_Z)\), the \(Z\)-check weight satisfies \(0 {\lt} \mathrm{zCheckWeight}(j)\).

Proof

This follows directly from the fact that \(\mathrm{zCheckSupport}(j)\) is nonempty, so its cardinality is positive.

44.2 Initialization Hypergraph

Definition 1421 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)\).

Theorem 1422 Initialization Hypergraph Vertex Count

The initialization hypergraph has \(|\mathrm{Fin}(n)| = n\) vertices.

Proof

This holds by the cardinality of finite types: \(|\mathrm{Fin}(n)| = n\).

Theorem 1423 Initialization Hypergraph Edge Count

The initialization hypergraph has \(|\mathrm{Fin}(n_Z)| = n_Z\) hyperedges.

Proof

This holds by the cardinality of finite types: \(|\mathrm{Fin}(n_Z)| = n_Z\).

44.3 X-Checks in Kernel of \(H_Z\)

Definition 1424 X-Check Vector

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

\[ \mathbf{x}_i(v) = \begin{cases} 1 & \text{if } v \in \mathrm{xCheckSupport}(i), \\ 0 & \text{otherwise.} \end{cases} \]

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:

\[ \mathbf{x}_i \in \ker (H_Z). \]

Equivalently, for all \(j \in \mathrm{Fin}(n_Z)\):

\[ (H_Z \mathbf{x}_i)_j = \sum _{v \in \mathrm{zCheckSupport}(j)} \mathbf{x}_i(v) = |\mathrm{xCheckSupport}(i) \cap \mathrm{zCheckSupport}(j)| \pmod{2} = 0. \]
Proof

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}\).

Theorem 1426 X-Checks Measurable via Gauging

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.

Proof

This follows directly from the core theorem xCheck_in_kernel.

Theorem 1427 Kernel Closure Under Addition

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.

Proof

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.

Theorem 1428 Zero Vector in Kernel

The zero vector \(\mathbf{0} \in (\mathbb {Z}/2\mathbb {Z})^n\) is in the operator kernel of the initialization hypergraph.

Proof

This follows from the general fact that zero is in the kernel of any hypergraph (Hypergraph.zero_mem_kernel).

44.4 Dummy Vertex Structure

Definition 1429 CSS Initialization Vertex

The CSS initialization vertex type for a CSS code \(C\) is the disjoint union of physical qubits and dummy vertices:

\[ \mathrm{CSSInitVertex}(C) = \mathrm{Fin}(n) \sqcup \mathrm{Fin}(n_X), \]

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.

Definition 1430 Is Dummy Vertex

A predicate on initialization vertices that returns \(\mathrm{true}\) for dummy vertices and \(\mathrm{false}\) for qubit vertices.

Theorem 1431 CSS Initialization Vertex Cardinality

The total number of CSS initialization vertices is \(n + n_X\):

\[ |\mathrm{CSSInitVertex}(C)| = n + n_X. \]
Proof

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.

Theorem 1432 Dummy Vertex Count

There are exactly \(n_X\) dummy vertices:

\[ |\{ v \in \mathrm{CSSInitVertex}(C) \mid v.\mathrm{isDummy} = \mathrm{true}\} | = n_X. \]
Proof

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):

\[ \mathrm{newQubitCount}(\mathrm{initHypergraph}(C)) = n_Z. \]
Proof

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):

\[ \mathrm{newCheckCount}(\mathrm{initHypergraph}(C)) = n. \]
Proof

By simplification using the definitions of \(\mathrm{newCheckCount}\) and \(|\mathrm{Fin}(n)| = n\).

Theorem 1435 Gauss Law Product

The sum of all Gauss law vertex supports equals the all-ones vector, representing \(L = \prod _v X_v\):

\[ \sum _{v \in \mathrm{Fin}(n)} \mathrm{gaussLawVertexSupport}(v) = \mathbf{1}. \]
Proof

This follows from the general hypergraph result gaussLaw_vertex_support_sum_allOnes.

44.6 Steane-Style Measurement via Gauging

Definition 1436 Steane Vertex

The Steane vertex type for \(n\) qubits is the disjoint union of a data block and an ancilla block:

\[ \mathrm{SteaneVertex}(n) = \mathrm{Fin}(n) \sqcup \mathrm{Fin}(n), \]

where \(\mathrm{data}(i)\) represents qubit \(i\) in the data block and \(\mathrm{ancilla}(i)\) represents qubit \(i\) in the ancilla block.

Theorem 1437 Steane Vertex Cardinality

The total number of Steane vertices is \(2n\):

\[ |\mathrm{SteaneVertex}(n)| = 2n. \]
Proof

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.

Definition 1438 Pairwise XX Support

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:

\[ \mathrm{pairwiseXXSupport}(i)(v) = \begin{cases} 1 & \text{if } v = \mathrm{data}(i) \text{ or } v = \mathrm{ancilla}(i), \\ 0 & \text{otherwise.} \end{cases} \]

This represents the \(X_i^{\mathrm{data}} \otimes X_i^{\mathrm{ancilla}}\) operator acting on matching qubit pairs.

Theorem 1439 Pairwise XX Weight is 2

For \(n {\gt} 0\) and any \(i \in \mathrm{Fin}(n)\), the pairwise \(XX\) operator has weight 2:

\[ |\{ v \in \mathrm{SteaneVertex}(n) \mid \mathrm{pairwiseXXSupport}(i)(v) = 1\} | = 2. \]
Proof

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\).

Theorem 1440 Pairwise XX Operators Commute

All pairwise \(XX\) operators commute with each other. For any \(i, j \in \mathrm{Fin}(n)\):

\[ \langle \mathrm{pairwiseXXSupport}(i), 0 \, |\, \mathrm{pairwiseXXSupport}(j), 0 \rangle _{\mathrm{symp}} = 0. \]
Proof

By simplification using the definition of the symplectic inner product with zero \(Z\)-components.

44.7 Steane Gauging Hypergraph

Definition 1441 Steane 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)\} \).

Theorem 1442 Steane Hypergraph Edge Cardinality

Each hyperedge of the Steane hypergraph has exactly 2 vertices.

Proof

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.

Theorem 1443 Steane Hypergraph is Graph-Like

The Steane hypergraph is graph-like (all hyperedges have size exactly 2).

Proof

Let \(h\) be an arbitrary hyperedge. This follows directly from steaneHypergraph_edge_card.

Theorem 1444 All-Ones in Steane Kernel

The all-ones vector \(\mathbf{1}\) on all Steane vertices is in the operator kernel (since each edge has even cardinality).

Proof

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

Definition 1445 Steane Gauging Step

The Steane gauging steps are the three phases of Steane-style measurement via gauging:

  1. State preparation: Initialize ancilla code block via CSS gauging.

  2. Entangling measurement: Pairwise \(XX\) gauging between data and ancilla blocks.

  3. Readout: \(Z\) measurement on ancilla qubits (ungauging).

Theorem 1446 Steane Step Count

There are exactly 3 steps in the Steane gauging procedure:

\[ |\mathrm{SteaneGaugingStep}| = 3. \]
Proof

This is verified by computation (the type has exactly three constructors).

Definition 1447 Readout Support

The readout support function assigns \(1 \in \mathbb {Z}/2\mathbb {Z}\) to ancilla vertices and \(0\) to data vertices:

\[ \mathrm{readoutSupport}(n)(v) = \begin{cases} 0 & \text{if } v = \mathrm{data}(i), \\ 1 & \text{if } v = \mathrm{ancilla}(i). \end{cases} \]

This represents the fact that the readout step measures \(Z\) on ancilla qubits only.

Theorem 1448 Readout Weight

For \(n {\gt} 0\), the number of qubits measured in readout is \(n\) (all ancilla qubits):

\[ |\{ v \in \mathrm{SteaneVertex}(n) \mid \mathrm{readoutSupport}(n)(v) = 1\} | = n. \]
Proof

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

Theorem 1449 CSS Initialization is Gauging

CSS initialization is a special case of hypergraph gauging: for every \(i \in \mathrm{Fin}(n_X)\),

\[ \mathbf{x}_i \in \ker (H_Z). \]
Proof

This follows directly from xCheck_in_kernel.

Theorem 1450 Measurable Group Contains X-Check Combinations

The measurable group for CSS initialization contains all pairwise sums of \(X\)-checks: for all \(i, j \in \mathrm{Fin}(n_X)\),

\[ \mathbf{x}_i + \mathbf{x}_j \in \ker (H_Z). \]
Proof

This follows directly from xCheck_sum_in_kernel.

Theorem 1451 Steane Hypergraph is 2-Local

The Steane gauging hypergraph is \(2\)-local (i.e., every hyperedge has at most 2 vertices).

Proof

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.

Theorem 1452 Pairwise XX in Steane Kernel

For each \(i \in \mathrm{Fin}(n)\), the pairwise \(XX\) support vector lies in the operator kernel of the Steane hypergraph:

\[ \mathrm{pairwiseXXSupport}(i) \in \ker (\mathrm{steaneHypergraph}(n)). \]
Proof

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\).

Theorem 1453 Sum of Pairwise XX is All-Ones

The sum of all pairwise \(XX\) operator support vectors equals the all-ones vector:

\[ \sum _{i \in \mathrm{Fin}(n)} \mathrm{pairwiseXXSupport}(i) = \mathbf{1}. \]

This represents the fact that the product of all \(XX\) operators gives the logical operator \(L = \prod _v X_v\).

Proof

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.