Prefix coefficient vector for integer row combinations #
Transport of prefixSpan_castIntMatrix through
basis_span: the cast integer row combination also lies in the prefix span of
the first k.val + 1 Gram-Schmidt basis rows.
Package the prefix-span witness together with the recovered top
Gram-Schmidt coordinate for a lattice row combination whose integer
coefficients vanish above k.
The coefficient matrix reconstructs the cast integer input rows from the
Gram-Schmidt basis rows: coeffs b * basis b collapses to the cast input
castIntMatrix b.
Integer row combinations reconstruct through the Gram-Schmidt basis after first combining the Gram-Schmidt coefficient rows.
Casting commutes with the squared norm: the rational squared norm of an
integer vector mapped into ℚ equals its integer squared norm cast to ℚ. This
transfers norm facts proved over ℤ into the rational Gram-Schmidt setting. As
a simp rule it pushes the cast outward, putting the rational squared norm in
the normal form ((normSq v : Int) : Rat).
Every nonzero lattice vector is at least as long as some basis row: there is
an index i with normSq ((basis b).row i) ≤ normSq v (compared in ℚ). This
lower-bounds an arbitrary lattice vector by an explicit basis quantity, the
starting point for relating short lattice vectors to the input basis.
Strengthening of normSq_latticeVec_ge_min_basis_normSq that exposes the
highest nonzero coefficient index k of a nonzero lattice vector together with
the integer coefficients that witness it, the fact that those coefficients
vanish above k, and the matching basis-row length bound ‖b*_k‖² ≤ ‖v‖².
This is the survivor-span entry point: the vanishing-above-k data localizes
v to the prefix b_0 … b_k, and the length bound feeds a Gram-Schmidt cut
test on the top index k.
Dot-product symmetry support #
The Cramer determinant matrix for the scaled Gram-Schmidt coefficient
(i, j) (with j < i) is the bordered minor of gramMatrix b at level j
with the border row index taken to be j and the border column index taken
to be i. This is the definitional equation between
GramSchmidt.scaledCoeffMatrix and the bordered-minor machinery in
HexBareiss.Bareiss.
Non-singular top-level composite: when the no-pivot Bareiss pass over the
full Gram matrix has not recorded a singular step before reaching column j,
the executable scaled-coefficient array entry below the diagonal at (i, j)
matches the trailing entry of the no-pivot Bareiss-style loop on the
corresponding Cramer determinant matrix scaledCoeffMatrix b i j hji. This
composes scaledCoeffArrayLoop_lower_matches_target_column (from #4103),
noPivotLoop_full_eq_borderedMinor_at_trailing (from #4028), and the
symmetry/transpose equation noPivotLoop_scaledCoeffMatrix_eq.
Mathlib-free non-singular Schur ≡ Bareiss correspondence at a single
column. When the no-pivot Bareiss pass over the full Gram matrix reaches
column q without recording a singular step, the diagonal slot and every
below-column entry of the integral Schur kernel match the corresponding
noPivotLoop/Bareiss matrix at fuel q.
Proved by strong induction on q. The base case q = 0 reduces to the
column-zero boundary of the Schur kernel together with noPivotLoop at
zero fuel returning the initial Gram state. The step case q' + 1 rewrites
the Schur recurrence rows[c][q' + 1] = rows[q'][q'] · gram[c][q' + 1] - schurSigma rows c (q' + 1) and discharges the σ-chain via
schurSigma_foldl_eq at p_out = q' + 1, fed with the
σ-fold correspondence assembled from the strong inductive hypothesis.
Singular cascade at the Schur kernel. If the no-pivot Bareiss pass over
the full Gram matrix records an early singular step at column s < j, every
Schur-kernel entry in the column-j, weak-lower triangle (j ≤ i) vanishes.
The row-s column is cleared by combining the non-singular Schur≡Bareiss
correspondence at fuel s
(getArrayEntry_scaledCoeffRowsSchur_eq_noPivotLoop_of_nonsing) with the
column-zero structural lemma at the singular step
(principalSubmatrix_gram_zero_pivot_column_zero). Strong
induction on j' ∈ (s, j] then propagates the zeros via the Schur recurrence
rows[i'][j'] = rows[j'-1][j'-1] · gram[i'][j'] - schurSigma i' j'. The
diagonal factor rows[j'-1][j'-1] is zero by the row-s lemma when
j' = s + 1 and by the cascade IH otherwise. The σ-fold collapses to zero
by sub-induction on the iteration count: the killing iteration p = s
makes all three relevant Schur entries zero (rows[s][s] = 0 and
rows[c][s] = 0 for c ≥ s + 1), so the σ-body exactDiv of zero by the
prev-pivot returns zero; subsequent iterations preserve zero via the outer
IH at columns (s, j'). The proof does not transitively cite
getArrayEntry_scaledCoeffRowsSchur_eq (the residual gap at line 6463).
The per-row Schur scaled-coefficient kernel and the column-major Bareiss
array path produce identical integer values at every cell. Both arrays
contain the leading Gram determinant d_{j+1} on the diagonal and
d_{j+1} · μ_{i,j} below the diagonal, with zeros above; the recurrences
differ only in evaluation order. This equivalence is the bridge from the
Schur implementation to the existing invariant infrastructure proven about
scaledCoeffRows.
Closure routes the in-bounds j ≤ i, j ≠ 0 case through Sub-D
(getArrayEntry_scaledCoeffRowsSchur_eq_noPivotLoop_of_nonsing) and Sub-C′
(getArrayEntry_scaledCoeffRowsSchur_eq_zero_of_singularStep_lt); the
out-of-bounds branch (n ≤ i) follows from both arrays having size n,
so the row entry is default on both sides.
The packed Gram determinant vector agrees entrywise with gramDet: under a
step witness, its k-th component is the determinant of the leading k × k Gram
minor for every k ≤ n. This identifies the executable gramDetVec array pass
with its specification gramDet.
Nat-level diagonal synchronization for the public scaled-coefficient matrix. This is the Mathlib-free diagonal fact exposed by the shared array pass; the stronger Int-valued diagonal statement additionally needs a nonnegativity proof for the Bareiss/Gram determinant slot.
Signed diagonal information for the public scaled-coefficient matrix. The diagonal slot is either the zero tail recorded after an earlier singular no-pivot step, or the Bareiss determinant of the corresponding leading Gram prefix.
Int-valued diagonal identity for the scaled Gram-Schmidt coefficients: once
the (i, i) slot is known nonnegative, it equals the Gram determinant
gramDet b (i + 1). The toNat form (scaledCoeffs_diag_toNat) is
unconditional; the signed Int form needs the determinant slot to be
nonnegative.
Singular dual of scaledCoeffRows_lower_eq_noPivotLoop_scaledCoeffMatrix.
When the no-pivot Bareiss pass over the full Gram matrix records an early
singular step before reaching column j, the integral scaled Gram-Schmidt
coefficient below the diagonal at (i, j) is zero. The array loop halts at
the recorded singular column and the target column is never written.
Non-singular companion of scaledCoeffs_eq_zero_of_singularStep_lt: when the
no-pivot Bareiss pass over the full Gram matrix reaches column j without
recording a singular step, the integral scaled Gram-Schmidt coefficient below
the diagonal at (i, j) matches the trailing entry of the no-pivot Bareiss-style
loop on the corresponding Cramer minor scaledCoeffMatrix b i j hji.
Swapping the adjacent rows km1 and k of the basis transposes the
scaled-coefficient Cramer minor for that pivot pair:
scaledCoeffMatrix (rowSwap b km1 k) k km1 = (scaledCoeffMatrix b k km1)ᵀ. This
is the matrix identity behind an LLL adjacent row swap, relating the coefficient
minor before and after the exchange.
Coefficient bordered minor and multilinearity entry equation #
The coeffBM matrix shares its first k columns with borderedMinor G k hk i j
(those columns do not depend on j) and replaces the last column with the
indicator vector picking out row index a. The multilinearity entry equation
expands Matrix.det (borderedMinor G k hk i j) as a sum over a of
Matrix.det (coeffBM G k hk i a) * G[a][j], applying det_colReplace_sum_finRange
to the indicator expansion of the last column.
The k-th Gram determinant for a rational input matrix.
This remains Mathlib-free API: it is the direct Hex determinant definition used by rational Gram-Schmidt callers, not a theorem identifying an executable Hex output with a Leibniz determinant.
Equations
- Hex.GramSchmidt.Rat.gramDet b k hk = (Hex.GramSchmidt.leadingGramMatrixRat b k hk).det