Rank certificates: finrank (certificateRowSpace H) = #(rows in the row-reduction output) #
The rate/rank accounting had one gap: the row-reduction preprocessing was not formalized. A trusted row reduction is available, and this module plugs it in as a rank certificate: reduce the parity-check matrix and count the rows to obtain its rank, a step that is checkable inside the kernel.
Mechanism #
The output of rowReduce is a set of mutually reduced pivot rows (IsReduced). Turning it
into a rank needs two things:
- The pivot rows are linearly independent: evaluating at the pivot column of each row,
(R1) gives 1 and (R2) gives 0, so a linear combination
∑ cᵢ rᵢtakes the valuecⱼat the pivot column ofrⱼ; hence∑ cᵢ rᵢ = 0 → cⱼ = 0. - The rows are pairwise distinct (otherwise the
Fin D.lengthindexing is not injective and item 1 fails). This module proves that the output ofrowReducesatisfies the strongerNodupPiv(the pivot columns are pairwise distinct): at the pivot column of a newly inserted row every existing row is 0 while the new row is 1, so the new row cannot coincide with any existing row.
Together the two give finrank (spanL (rowList (rowReduce L))) = (rowReduce L).length, and
spanL_rowReduce then transfers the statement to the original list of rows.
Main results #
NodupPiv: the structural invariant that the pivot columns are pairwise distinct (kept throughoutrowReduce).linearIndependent_rowList_of_isReduced: a mutually reduced list of rows is linearly independent.finrank_spanL_eq_length_rowReduce: the rank equals the number of rows of the reduction output.Matrix.rank_eq_length_rowReduce: the interface toMatrix.rankof Mathlib.
The invariant that the pivot columns are pairwise distinct #
The pivot columns of D are pairwise distinct. This is a structural invariant of the
output of rowReduce, and the premise for "the number of rows equals the rank" (otherwise
the Fin D.length indexing is not injective).
Equations
- QECCertificates.NodupPiv D = (List.map (fun (x : QECCertificates.PivRow n) => x.2) D).Nodup
Instances For
Linear independence of the pivot rows #
A mutually reduced list of rows is linearly independent: evaluating at the pivot column of each row separates the coefficients.
Main theorems #
Rank certificate (main theorem): the dimension of the space spanned by the list of rows equals the number of rows of the row-reduction output.
The list of pivot rows produced by the reduction is itself the certificate: the kernel only
has to count the rows and check IsReduced to verify the rank independently, with no need
to trust any external script.
Matrix.rank of Mathlib is the dimension of the row space.
Rank certificate in matrix form: reduce the rows of the parity-check matrix and count them to obtain its rank.
Matrix.rank is the entry point through which the LeanQEC side of the distance reduction
reads a rank; this theorem lets the row reduction verified in this package take over that
reading directly.
A nonzero kernel vector when the rank is not full (the bridge on the threshold side) #
Full rank fails $\Longrightarrow$ a nonzero kernel vector: when $M.\mathrm{rank}<n$ we have $\ker M\ne0$.
The construction is explicit: after row reduction there are fewer than $n$ pivot columns,
hence a free column $j$, and kerVec takes the value 1 on that column
(exists_light_mem_kerL); it is orthogonal to every row of $M$, so multiplying by $M$ on
the left gives zero.
This is the bridge on the threshold side: every factor of $k=k_1k_2+k_1^\top k_2^\top$ is a $\dim\ker$, whereas what "the kernel is nontrivial" requires is the existence of a nonzero kernel vector, not a dimension. The companion paper argued this conversion only arithmetically; this theorem puts it into the kernel.