MerLean-example

14 Def 5: Gauging Measurement Algorithm

The gauging measurement procedure measures a logical operator \(L = \prod _{v \in V} X_v\) by introducing auxiliary edge qubits, measuring Gauss’s law operators \(A_v\) and edge qubits \(Z_e\), and applying byproduct corrections. We formalize the classical data and processing of the algorithm: measurement outcomes \((\varepsilon _v, \omega _e)\), the sign \(\sigma = \sum _v \varepsilon _v\) (in \(\mathbb {Z}/2\mathbb {Z}\)), the byproduct correction rule based on walk parities, and the commutativity of all measured operators.

We use \(\mathbb {Z}/2\mathbb {Z}\) for measurement outcomes: \(0 \leftrightarrow +1\), \(1 \leftrightarrow -1\). Products of \(\pm 1\) values correspond to sums in \(\mathbb {Z}/2\mathbb {Z}\).

Definition 246 Gauging Input
#

The input data for the gauging measurement procedure consists of:

  • A connected graph \(G = (V, E)\) with \(V\) the support of the logical operator \(L = \prod _{v \in V} X_v\).

  • A distinguished base vertex \(v_0 \in V\) for byproduct correction.

  • A proof that \(G\) is connected.

Definition 247 Gauging Outcomes
#

The measurement outcomes from the gauging procedure. We use \(\mathbb {Z}/2\mathbb {Z}\) to represent \(\pm 1\) outcomes (\(0 \leftrightarrow +1\), \(1 \leftrightarrow -1\)):

  • \(\varepsilon _v \in \mathbb {Z}/2\mathbb {Z}\): the outcome of measuring Gauss’s law operator \(A_v\) for each \(v \in V\).

  • \(\omega _e \in \mathbb {Z}/2\mathbb {Z}\): the outcome of measuring \(Z_e\) for each \(e \in E\).

Definition 248 Measurement Sign
#

The measurement sign \(\sigma = \sum _{v \in V} \varepsilon _v \in \mathbb {Z}/2\mathbb {Z}\), encoding the product of all Gauss’s law outcomes. This is the measurement result of the logical operator \(L = \prod _{v \in V} X_v\): \(\sigma = 0\) means the \(+1\) eigenvalue, \(\sigma = 1\) means \(-1\).

Definition 249 Walk Parity
#

Given edge measurement outcomes \(\omega \) and a walk \(w\) in \(G\) from \(u\) to \(v\), the walk parity is the \(\mathbb {Z}/2\mathbb {Z}\)-sum of \(\omega (e)\) over all edges \(e\) traversed by the walk:

\[ \operatorname {walkParity}(\omega , w) = \sum _{d \in w.\mathrm{darts}} \omega (d.\mathrm{edge}). \]
Lemma 250 Walk Parity of Nil

The walk parity of the trivial (nil) walk at any vertex \(v\) is \(0\).

Proof

By simplification using the definition of walk parity and the fact that the nil walk has no darts, the sum is empty and equals \(0\).

Lemma 251 Walk Parity of Cons

For an adjacency \(h : G.\mathrm{Adj}(u, v)\) and a walk \(p\) from \(v\) to \(w\), the walk parity of the extended walk \(\operatorname {cons}(h, p)\) satisfies:

\[ \operatorname {walkParity}(\omega , \operatorname {cons}(h, p)) = \omega (\{ u, v\} ) + \operatorname {walkParity}(\omega , p). \]
Proof

By simplification using the definition of walk parity and the fact that \(\operatorname {darts}(\operatorname {cons}(h, p))\) prepends the dart for edge \(\{ u,v\} \) to \(\operatorname {darts}(p)\), the map and sum decompose as the first term plus the remaining sum.

Theorem 252 Walk Parity is Additive Under Concatenation

For walks \(p : u \to v\) and \(q : v \to w\), the walk parity is additive:

\[ \operatorname {walkParity}(\omega , p \cdot q) = \operatorname {walkParity}(\omega , p) + \operatorname {walkParity}(\omega , q). \]
Proof

We proceed by induction on \(p\).

Base case (\(p = \mathrm{nil}\)): The concatenation \(\mathrm{nil} \cdot q = q\), and \(\operatorname {walkParity}(\omega , \mathrm{nil}) = 0\), so the result follows by simplification.

Inductive step (\(p = \operatorname {cons}(h, p')\)): We have \(\operatorname {cons}(h, p') \cdot q = \operatorname {cons}(h, p' \cdot q)\). Rewriting using the cons formula twice and the inductive hypothesis, we get

\[ \omega (\{ u,v\} ) + (\operatorname {walkParity}(\omega , p') + \operatorname {walkParity}(\omega , q)) = (\omega (\{ u,v\} ) + \operatorname {walkParity}(\omega , p')) + \operatorname {walkParity}(\omega , q), \]

which follows by ring arithmetic.

Theorem 253 Walk Parity is Invariant Under Reversal

For any walk \(p : u \to v\), reversing the walk does not change its parity:

\[ \operatorname {walkParity}(\omega , p^{\mathrm{rev}}) = \operatorname {walkParity}(\omega , p). \]
Proof

We proceed by induction on \(p\).

Base case (\(p = \mathrm{nil}\)): Both sides are \(0\) by simplification.

Inductive step (\(p = \operatorname {cons}(h, p')\) where \(h : G.\mathrm{Adj}(a, b)\) and \(p' : b \to c\)): The reverse is \(\operatorname {reverse}(\operatorname {cons}(h, p')) = \operatorname {reverse}(p') \cdot \operatorname {cons}(\bar{h}, \mathrm{nil})\). Rewriting using the append formula, the cons formula, the nil formula, and the inductive hypothesis, we obtain

\[ \operatorname {walkParity}(\omega , p'^{\mathrm{rev}}) + \omega (\{ b,a\} ) + 0 = \omega (\{ a,b\} ) + \operatorname {walkParity}(\omega , p'). \]

Since \(\{ b,a\} = \{ a,b\} \) as \(\operatorname {Sym2}\) elements (by \(\operatorname {Sym2.eq\_ swap}\)), the terms match and the result follows by ring arithmetic.

Lemma 254 Walk Parity of Single Edge

For a single-edge walk along adjacency \(h : G.\mathrm{Adj}(u, v)\),

\[ \operatorname {walkParity}(\omega , \operatorname {cons}(h, \mathrm{nil})) = \omega (\{ u, v\} ). \]
Proof

Rewriting using the cons formula and the nil formula, the result reduces to \(\omega (\{ u,v\} ) + 0 = \omega (\{ u,v\} )\), which holds by \(\operatorname {add\_ zero}\).

Theorem 255 Walk Parity Difference Equals Closed Walk Parity

For two walks \(p, q : u \to v\), the sum of their parities equals the parity of the closed walk \(p \cdot q^{\mathrm{rev}}\):

\[ \operatorname {walkParity}(\omega , p) + \operatorname {walkParity}(\omega , q) = \operatorname {walkParity}(\omega , p \cdot q^{\mathrm{rev}}). \]
Proof

Rewriting the right-hand side using the append additivity formula and the reversal invariance, this is immediate.

Theorem 256 Walk Parity is Well-Defined

If all closed walks have zero parity, i.e., \(\operatorname {walkParity}(\omega , c) = 0\) for every closed walk \(c : v \to v\), then for any two walks \(p, q : u \to v\),

\[ \operatorname {walkParity}(\omega , p) = \operatorname {walkParity}(\omega , q). \]
Proof

Let \(h\) be the hypothesis applied to the closed walk \(p \cdot q^{\mathrm{rev}}\) at vertex \(u\). Rewriting \(h\) using the append additivity and reversal invariance, we obtain \(\operatorname {walkParity}(\omega , p) + \operatorname {walkParity}(\omega , q) = 0\). Since we work in \(\mathbb {Z}/2\mathbb {Z}\), the characteristic-two property (\(a + b = 0 \Rightarrow a = b\)) gives the result.

Definition 257 Byproduct Correction at a Vertex

The byproduct correction at vertex \(v\), given a specific walk \(\gamma \) from \(v_0\) to \(v\), is defined as the walk parity:

\[ c(v) = \operatorname {walkParity}(\omega , \gamma ) \in \mathbb {Z}/2\mathbb {Z}. \]

Here \(c(v) = 1\) means “apply \(X_v\)” (corresponding to \(\prod _{e \in \gamma } \omega _e = -1\) in \(\pm 1\) notation).

Lemma 258 Byproduct Correction at Base Vertex

The byproduct correction at the base vertex \(v_0\) using the trivial walk is \(0\):

\[ c(v_0) = 0. \]
Proof

By simplification using the definition of byproduct correction, this reduces to the walk parity of the nil walk, which is \(0\).

Theorem 259 Byproduct Correction is Well-Defined

If all closed walks have zero parity, then the byproduct correction at vertex \(v\) is independent of the choice of walk from \(v_0\) to \(v\): for any two walks \(\gamma _1, \gamma _2 : v_0 \to v\),

\[ c_{\gamma _1}(v) = c_{\gamma _2}(v). \]
Proof

This follows directly from the well-definedness of walk parity (Theorem 256) applied to \(\gamma _1\) and \(\gamma _2\).

Definition 260 Byproduct Correction Operator

The byproduct correction Pauli operator for a given walk assignment: for each vertex \(v\), apply \(X_v\) if and only if \(c(v) = 1\). Formally, this is the Pauli operator with

\[ \mathrm{xVec}(v) = c(v), \qquad \mathrm{zVec} = 0. \]
Lemma 261 Byproduct Correction Operator is Pure X-Type

The byproduct correction operator has no \(Z\)-component:

\[ (\operatorname {byproductCorrectionOp}).\mathrm{zVec} = 0. \]
Proof

This holds by definition (reflexivity), since the \(\mathrm{zVec}\) field is defined to be \(0\).

Theorem 262 Byproduct Correction Operator is Self-Inverse

The byproduct correction operator is self-inverse:

\[ \operatorname {byproductCorrectionOp} \cdot \operatorname {byproductCorrectionOp} = \mathbf{1}. \]
Proof

By extensionality, it suffices to show equality for both the \(x\)-vector and \(z\)-vector components for each vertex \(v\).

  • For the \(x\)-vector: by simplification using the multiplication formula and the identity \(x\)-vector, this reduces to \(c(v) + c(v) = 0\), which holds by the characteristic-two property \(a + a = 0\) in \(\mathbb {Z}/2\mathbb {Z}\).

  • For the \(z\)-vector: by simplification using the multiplication formula and the fact that \(\mathrm{zVec} = 0\) by definition, this reduces to \(0 + 0 = 0\).

Definition 263 Gauging Result

The classical output of the gauging measurement algorithm, consisting of:

  • The measurement sign \(\sigma \in \mathbb {Z}/2\mathbb {Z}\): \(0 \leftrightarrow +1\) eigenvalue of \(L\), \(1 \leftrightarrow -1\) eigenvalue.

  • The byproduct correction vector \(c : V \to \mathbb {Z}/2\mathbb {Z}\), where \(c(v) = 1\) means apply \(X_v\).

Definition 264 Gauging Algorithm

The gauging measurement algorithm: given input data, measurement outcomes, and a choice of walks from \(v_0\) to each vertex, computes the classical output:

  • \(\operatorname {sign} = \sum _{v \in V} \varepsilon _v\) (the sum of all Gauss outcomes in \(\mathbb {Z}/2\mathbb {Z}\)).

  • \(\operatorname {correction}(v) = \operatorname {walkParity}(\gamma _v, \omega )\) (the parity of edge outcomes along the walk from \(v_0\) to \(v\)).

Theorem 265 Gauging Algorithm Correction is Independent of Walk Choice

If all closed walks have zero parity, then two different walk choices produce the same correction vector:

\[ (\operatorname {gaugingAlgorithm}(\mathrm{input}, \mathrm{outcomes}, \mathrm{walks}_1)).\mathrm{correction} = (\operatorname {gaugingAlgorithm}(\mathrm{input}, \mathrm{outcomes}, \mathrm{walks}_2)).\mathrm{correction}. \]
Proof

By extensionality, it suffices to show equality at each vertex \(v\). This follows directly from the well-definedness of the byproduct correction (Theorem 259) applied to \(\mathrm{walks}_1(v)\) and \(\mathrm{walks}_2(v)\).

Definition 266 Sign is Plus
#

The proposition that \(\sigma = 0 \pmod{2}\), meaning the \(+1\) eigenvalue of \(L\) was measured.

Definition 267 Sign is Minus
#

The proposition that \(\sigma = 1 \pmod{2}\), meaning the \(-1\) eigenvalue of \(L\) was measured.

Theorem 268 Sign Dichotomy

The measurement sign is always \(0\) or \(1\) in \(\mathbb {Z}/2\mathbb {Z}\):

\[ \operatorname {signIsPlus}(\mathrm{outcomes}) \lor \operatorname {signIsMinus}(\mathrm{outcomes}). \]
Proof

This follows from the fact that every element of \(\mathbb {Z}/2\mathbb {Z}\) is either \(0\) or \(1\), which is verified by case analysis (\(\operatorname {fin\_ cases}\)) and simplification.

Definition 269 Gauss’s Law Operator Measured

The Gauss’s law operator measured at vertex \(v\) in step 3 of the gauging procedure:

\[ A_v = X_v \prod _{e \ni v} X_e \]

on the extended qubit system \(V \oplus E\). This is the abbreviation for \(\operatorname {gaussLawOp}(G, v)\).

Definition 270 Edge Z Operator Measured

The edge \(Z\) operator measured at edge \(e\) in step 4 of the gauging procedure:

\[ Z_e \text{ on } V \oplus E, \]

defined as \(\operatorname {pauliZ}(\operatorname {inr}(e))\).

Theorem 271 Gauss’s Law Measurements Commute

All Gauss’s law operators commute: for any vertices \(v, w \in V\),

\[ [A_v, A_w] = 0. \]

They can be measured in any order in step 3.

Proof

This follows directly from the commutativity of Gauss’s law operators (Theorem 117).

Theorem 272 Edge Z Measurements Commute

All edge \(Z\) operators commute: for any edges \(e_1, e_2 \in E\),

\[ [Z_{e_1}, Z_{e_2}] = 0. \]

They can be measured in any order in step 4.

Proof

By simplification using the definitions of edge \(Z\) operators, Pauli commutation, and the symplectic inner product, the goal reduces to showing a Finset sum equals zero. For each qubit \(q\), the summand involves \(\operatorname {pauliZ}\) which has zero \(x\)-vector, so each term is \(0 \cdot z + x \cdot 0 = 0\). The sum of zeros is zero.

Theorem 273 Gauss’s Law Product Gives Logical Operator

The product of all Gauss’s law operators equals the logical operator \(L = \prod _{v \in V} X_v\):

\[ \prod _{v \in V} A_v = L. \]

This is why \(\sigma = \sum _v \varepsilon _v\) gives the measurement result of \(L\).

Proof

This follows directly from the Gauss’s law product theorem (Theorem 128).

Lemma 274 Edge Z Operator is Pure Z-Type

The edge \(Z\) operator \(Z_e\) has no \(X\)-support:

\[ (Z_e).\mathrm{xVec} = 0. \]
Proof

By simplification using the definitions of the edge \(Z\) operator and \(\operatorname {pauliZ}\), the \(x\)-vector is identically zero.

Lemma 275 Gauss’s Law Operator is Pure X-Type

The Gauss’s law operator \(A_v\) has no \(Z\)-support:

\[ (A_v).\mathrm{zVec} = 0. \]
Proof

By simplification using the definition of the Gauss’s law operator measured, the \(z\)-vector is identically zero.

Theorem 276 Gauss’s Law Operator is Self-Inverse

Each Gauss’s law operator is self-inverse:

\[ A_v \cdot A_v = \mathbf{1}. \]
Proof

This follows directly from the fact that every Pauli operator is self-inverse (\(P \cdot P = \mathbf{1}\)).

Theorem 277 Edge Z Operator is Self-Inverse

Each edge \(Z\) operator is self-inverse:

\[ Z_e \cdot Z_e = \mathbf{1}. \]
Proof

This follows directly from the fact that every Pauli operator is self-inverse (\(P \cdot P = \mathbf{1}\)).

I’ll start by reading the Lean file to understand its contents.Now I have a thorough understanding of the file. Let me produce the complete LaTeX translation.