Leading Gram block and pivot square (gramTake, pivotSq)
DefinitiongramTakeFor vectors in , is the Gram matrix of the first vectors, and the pivot is the squared orthogonal distance of from the span of the previous vectors.
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
import Mathlib.Data.Real.Basic
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.LinearAlgebra.Matrix.Notation
/-!
# Filtered descent — Gram–Schmidt pivots (paper (32)–(42))
The Gram–Schmidt pivot decomposition of the ordered Cauchy–Binet identity.
For an ordered `r`-tuple of vectors, `p_j^2 = det G_j / det G_{j-1}` is the
squared distance of the `j`-th vector to the span of the previous ones
(paper (32)–(33)), and `|det S| = ∏_j p_j` (paper (36)–(42)).
-/
namespace FilteredDescent
/-- Gram matrix of the leading `k`-subfamily of `s` (embedded as `k × k`). -/
noncomputable def gramTake {r d : ℕ} (s : Fin r → (Fin d → ℝ)) (k : ℕ)
(hk : k ≤ r) : Matrix (Fin k) (Fin k) ℝ :=
Matrix.of (fun i j =>
∑ a, s ⟨i.val, lt_of_lt_of_le i.isLt hk⟩ a * s ⟨j.val, lt_of_lt_of_le j.isLt hk⟩ a)
/-- Gram–Schmidt pivot (paper (32)–(33)):
`p_j^2 = det G_{j+1} / det G_j`, the squared distance of `s_j` to the span of
the previous vectors. Positivity of the Gram determinants is a hypothesis
of the pivot dichotomy theorem, not of this definition. -/
noncomputable def pivotSq {r d : ℕ} (s : Fin r → (Fin d → ℝ)) (j : Fin r) : ℝ :=
(gramTake s (j.val + 1) (Nat.succ_le_of_lt j.isLt)).det /
(gramTake s j.val (le_of_lt j.isLt)).det
end FilteredDescent
Read-back
What the Lean code literally says, in plain math · muse-spark
I have read both the auditor instructions and the Lean file. I have not consulted any other material. Here are the blind read-backs.
Read-back: FilteredDescent.gramTake
For any natural numbers and (both implicit), any ordered -tuple of vectors in (each vector given as a function ), any natural number , and any proof that , gramTake produces a real matrix whose -entry, for , is the sum
i.e. the ordinary Euclidean dot product of the -th and -th vectors among the first vectors of (the indices are coerced into using , so only the leading -subfamily is ever referenced). In other words it is the Gram matrix of the first vectors of . Edge cases included silently by the quantifiers: is allowed and yields the empty matrix; is allowed; if every entry is an empty sum, hence . The definition is marked noncomputable and carries no hypotheses beyond — in particular nothing is assumed about linear independence or about any determinant.
Read-back: FilteredDescent.pivotSq
For any natural numbers and (implicit), any ordered -tuple of vectors in , and any index , pivotSq returns the real number
where denotes the Gram matrix of the first vectors of as computed by gramTake — so the numerator is the determinant of the Gram matrix of and the denominator is the determinant of the Gram matrix of (with the empty matrix, whose determinant is ; hence for the value is ). The two proof arguments supplied to gramTake (that and ) are mere evidence for the requirement and do not affect the value. Crucially, the code imposes no non-vanishing or positivity hypothesis on either determinant: since division on the reals is total in Lean, if the result is by the convention, and the value may in principle be zero (or, formally, anything the determinant ratio yields) — the file's own doc comment notes that positivity of these Gram determinants is left as a hypothesis of a separate theorem, not of this definition.