The defining guarantee of the construction: distinct rational Gram-Schmidt basis rows are mutually orthogonal (their dot product is zero).
25.3.ย Key correctness theorems
The defining guarantee is orthogonality: distinct basis rows have zero
dot product. The statement is given over both the rational and the
integer input (the latter taken in Rat).
Hex.GramSchmidt.Rat.basis_orthogonal {n m : โ} (b : Hex.Matrix โ n m) (i j : โ) (hi : i < n) (hj : j < n) (hij : i โ j) : ((Hex.GramSchmidt.Rat.basis b).row โจi, hiโฉ).dotProduct ((Hex.GramSchmidt.Rat.basis b).row โจj, hjโฉ) = 0Hex.GramSchmidt.Rat.basis_orthogonal {n m : โ} (b : Hex.Matrix โ n m) (i j : โ) (hi : i < n) (hj : j < n) (hij : i โ j) : ((Hex.GramSchmidt.Rat.basis b).row โจi, hiโฉ).dotProduct ((Hex.GramSchmidt.Rat.basis b).row โจj, hjโฉ) = 0
Hex.GramSchmidt.Int.basis_orthogonal {n m : โ} (b : Hex.Matrix โค n m) (i j : โ) (hi : i < n) (hj : j < n) (hij : i โ j) : ((Hex.GramSchmidt.Int.basis b).row โจi, hiโฉ).dotProduct ((Hex.GramSchmidt.Int.basis b).row โจj, hjโฉ) = 0Hex.GramSchmidt.Int.basis_orthogonal {n m : โ} (b : Hex.Matrix โค n m) (i j : โ) (hi : i < n) (hj : j < n) (hij : i โ j) : ((Hex.GramSchmidt.Int.basis b).row โจi, hiโฉ).dotProduct ((Hex.GramSchmidt.Int.basis b).row โจj, hjโฉ) = 0
Distinct Gram-Schmidt basis rows of an integer matrix (taken in Rat) are
mutually orthogonal.
The basis and coefficient matrices together factor the input. Each
input row equals its orthogonalized basis row plus the
coefficient-weighted combination of the earlier basis rows: the
triangular factorization b = coeffs ยท basis, stated row by row.
Hex.GramSchmidt.Rat.basis_decomposition {n m : โ} (b : Hex.Matrix โ n m) (i : โ) (hi : i < n) : b.row โจi, hiโฉ = (Hex.GramSchmidt.Rat.basis b).row โจi, hiโฉ + Hex.GramSchmidt.prefixCombination (Hex.GramSchmidt.Rat.coeffs b) (Hex.GramSchmidt.Rat.basis b) i hiHex.GramSchmidt.Rat.basis_decomposition {n m : โ} (b : Hex.Matrix โ n m) (i : โ) (hi : i < n) : b.row โจi, hiโฉ = (Hex.GramSchmidt.Rat.basis b).row โจi, hiโฉ + Hex.GramSchmidt.prefixCombination (Hex.GramSchmidt.Rat.coeffs b) (Hex.GramSchmidt.Rat.basis b) i hi
The triangular factorization b = coeffs ยท basis, stated row by row: each
rational input row equals its orthogonalized basis row plus the
coefficient-weighted combination of the earlier basis rows.
Hex.GramSchmidt.Int.basis_decomposition {n m : โ} (b : Hex.Matrix โค n m) (i : โ) (hi : i < n) : Vector.map (fun x => โx) (b.row โจi, hiโฉ) = (Hex.GramSchmidt.Int.basis b).row โจi, hiโฉ + Hex.GramSchmidt.prefixCombination (Hex.GramSchmidt.Int.coeffs b) (Hex.GramSchmidt.Int.basis b) i hiHex.GramSchmidt.Int.basis_decomposition {n m : โ} (b : Hex.Matrix โค n m) (i : โ) (hi : i < n) : Vector.map (fun x => โx) (b.row โจi, hiโฉ) = (Hex.GramSchmidt.Int.basis b).row โจi, hiโฉ + Hex.GramSchmidt.prefixCombination (Hex.GramSchmidt.Int.coeffs b) (Hex.GramSchmidt.Int.basis b) i hi
The triangular factorization for an integer matrix: each input row, cast
into Rat, equals its orthogonalized basis row plus the coefficient-weighted
combination of the earlier basis rows.
The coefficient matrix is lower-unitriangular, and its strictly lower entries are exactly the projection coefficients of the input row onto the earlier basis row.
Hex.GramSchmidt.Rat.coeffs_diag {n m : โ} (b : Hex.Matrix โ n m) (i : โ) (hi : i < n) : Hex.GramSchmidt.entry (Hex.GramSchmidt.Rat.coeffs b) โจi, hiโฉ โจi, hiโฉ = 1Hex.GramSchmidt.Rat.coeffs_diag {n m : โ} (b : Hex.Matrix โ n m) (i : โ) (hi : i < n) : Hex.GramSchmidt.entry (Hex.GramSchmidt.Rat.coeffs b) โจi, hiโฉ โจi, hiโฉ = 1
The rational coefficient matrix has unit diagonal: each input row enters its
own decomposition with weight 1.
Hex.GramSchmidt.Rat.coeffs_upper {n m : โ} (b : Hex.Matrix โ n m) (i j : โ) (hi : i < n) (hj : j < n) (hij : i < j) : Hex.GramSchmidt.entry (Hex.GramSchmidt.Rat.coeffs b) โจi, hiโฉ โจj, hjโฉ = 0Hex.GramSchmidt.Rat.coeffs_upper {n m : โ} (b : Hex.Matrix โ n m) (i j : โ) (hi : i < n) (hj : j < n) (hij : i < j) : Hex.GramSchmidt.entry (Hex.GramSchmidt.Rat.coeffs b) โจi, hiโฉ โจj, hjโฉ = 0
The rational coefficient matrix is lower triangular: entries strictly above the diagonal vanish, since a row only combines basis rows with smaller index.
Hex.GramSchmidt.Rat.coeffs_lower_projection {n m : โ} (b : Hex.Matrix โ n m) {i j : Fin n} (hji : โj < โi) : Hex.GramSchmidt.entry (Hex.GramSchmidt.Rat.coeffs b) i j = if ((Hex.GramSchmidt.Rat.basis b).row j).dotProduct ((Hex.GramSchmidt.Rat.basis b).row j) = 0 then 0 else (b.row i).dotProduct ((Hex.GramSchmidt.Rat.basis b).row j) / ((Hex.GramSchmidt.Rat.basis b).row j).dotProduct ((Hex.GramSchmidt.Rat.basis b).row j)Hex.GramSchmidt.Rat.coeffs_lower_projection {n m : โ} (b : Hex.Matrix โ n m) {i j : Fin n} (hji : โj < โi) : Hex.GramSchmidt.entry (Hex.GramSchmidt.Rat.coeffs b) i j = if ((Hex.GramSchmidt.Rat.basis b).row j).dotProduct ((Hex.GramSchmidt.Rat.basis b).row j) = 0 then 0 else (b.row i).dotProduct ((Hex.GramSchmidt.Rat.basis b).row j) / ((Hex.GramSchmidt.Rat.basis b).row j).dotProduct ((Hex.GramSchmidt.Rat.basis b).row j)
Strictly lower-triangular coefficient entries are the rational projection coefficient of the input row onto the earlier generated basis row.