Rank, row-span, and nullspace correspondence theorems for hex-matrix-mathlib.
This module converts the executable Hex.Matrix row-reduction data into
Mathlib's function-based matrix model, then states theorems relating
computed rank, span membership, and nullspace bases to Mathlib's
noncomputable linear-algebra definitions.
The executable row combination Hex.Matrix.vecMul c M (the linear
combination of the rows of M with coefficients c) transports under
vectorEquiv to Mathlib's Fintype.linearCombination over the rows of
matrixEquiv M. This identifies the computed row span with Mathlib's span.
Soundness of the executable spanCoeffs: when echelon-form data certifies
v as a row combination with coefficients c, the Mathlib image of v is the
corresponding linearCombination of the rows of M. Witnesses span membership
with explicit coefficients.
The executable span-membership test spanContains is correct: it returns
true exactly when the Mathlib image of v lies in the R-span of the rows of
M. The decision procedure agrees with Mathlib's Submodule.span.
Every row of the computed echelon form lies in the row span of the original
matrix M: row reduction does not enlarge the span. One inclusion of the
"echelon rows span the same subspace as M" equivalence.
Converse direction: any vector in the row span of M is realised as an
executable row combination of the echelon rows. Together with
rowReduce_echelon_row_mem_span this shows row reduction preserves the row span.
Each computed nullspace basis vector lies in the kernel of M (viewed as
Mathlib's linear map mulVecLin): the executable nullspace really annihilates
M.
The computed nullspace basis spans exactly the kernel of M: the span of
the executable basis vectors equals Mathlib's LinearMap.ker (mulVecLin M).
This is the completeness counterpart to nullspace_mem_ker.
The rank computed by row reduction agrees with Mathlib's Matrix.rank.
Proven by rank-nullity: the m - D.rank independent nullspace basis vectors pin
the kernel dimension, and the complement is the matrix rank.