GF(2) vector algebra primitives (coding-theory layer) #
This module is the linear-algebra basis of the coding-theory layer: it collects the
parity-check matrices, stabilizers and logical operators of a quantum error-correcting
code into the GF(2) vector space Vec n = Fin n → ZMod 2, and supplies the primitives
that row reduction and kernel-basis extraction are built from.
Alignment with LeanQEC: the row-space object is LeanQEC's Matrix.certificateRowSpace, reused
directly (it is defined as Submodule.span (Set.range M)); this module's spanL is the
equivalent formulation on the row-list side, and the bridge lemma
Matrix.rowSpace_eq_spanL_ofFn connects the two. The row-space theorems already
available in LeanQEC therefore apply directly to the row lists of this package.
Main definitions #
Vec n: a GF(2) vector of lengthn(a bit string).spanL L: the subspace spanned by a list of rows, that is, the row space.addSmul v r c: addsc • rtov. Over GF(2), takingc = v iandr i = 1clears thei-th coordinate.
Main results #
addSmul_apply: the componentwise formula(v + c • r) i = v i + c * r i.addSmul_cancel: in characteristic 2,(v + c • r) + c • r = v; row operations are invertible.spanL_map_addSmul_append: applying that operation to a whole list of rows and then appending the new row leaves the row space unchanged.Matrix.rowSpace_eq_spanL_ofFn: the bridge to the LeanQEC row-space representation.
A GF(2) vector of length n. Under the symplectic representation a single Pauli
operator of a quantum error-correcting code is a pair of such vectors.
Equations
- QECCertificates.Vec n = (Fin n → ZMod 2)
Instances For
Generic utilities, shared by the modules that assemble matrices from literals #
The three definitions e, zeroRows and add_eq_zero_iff_eq live here rather than in
any particular code family: they are general-purpose tools, needed by every module
that assembles a parity-check matrix from literals or that uses the characteristic-2
cancellation law, so the instance-level modules do not each carry a copy of their own.
The zero-row matrix: a classical code takes it as the row-space argument of
minWeightKernelOutsideRowSpace (giving certificateRowSpace = ⊥), so that set reduces to the
nonzero vectors in the kernel.
Equations
- QECCertificates.zeroRows n i = i.elim0
Instances For
The support: the positions of the nonzero components.
Equations
- QECCertificates.support v = {i : Fin n | v i ≠ 0}
Instances For
The weight used for the code distance: the size of the support, agreeing with
hammingNorm of mathlib and LeanQEC.
Over GF(2), nonzero means 1.
Row space #
The subspace spanned by a list of rows, that is, the row space. The generating set is
the set of elements of the list, which can be exchanged for the Set.range formulation
(see spanL_ofFn_eq_span_range).
Equations
- QECCertificates.spanL L = Submodule.span (ZMod 2) {x : QECCertificates.Vec n | x ∈ L}
Instances For
If v + w lies in the row space of A, then appending w and appending v span
the same row space. (The row produced by elimination differs from the original one by a
vector that is already in the row space, so the row space is unchanged.)
Bridge to LeanQEC: Matrix.certificateRowSpace M (that is, Submodule.span (Set.range M))
equals the spanL of the row list of M. The row-space theorems of LeanQEC therefore
apply directly to the row lists of this package.
Elementary row operations #
Adds c • r to v. Over GF(2), taking c = v i and r i = 1 clears exactly the
i-th coordinate of v.
Equations
- QECCertificates.addSmul v r c = v + c • r
Instances For
A whole-list row operation preserves the row space #
Preservation of the row space (whole-list version): replacing every row r of a
list A by r + f r • w and then appending w at the end gives the same row space as
appending w to A.
This is the correctness skeleton of row reduction: elimination performs only the one operation of adding the new row to an old row with a coefficient, which does not change the spanned subspace and hence does not change the code.