Exact reconstruction of the finite factorizations (Cholesky and QR) #
Exact algebraic reconstruction for the Cholesky and classical Gram–Schmidt specification
recurrences in NN.Spec.Core.Tensor.Factorizations. Both use finite column folds; these theorems
do not assert floating-point error bounds or correctness of Cholesky's materialized runtime
override. Positive pivots are proof hypotheses, not a runtime success check.
Main results #
isCholesky_of_pos: for a symmetricA : Fin n → Fin n → ℝwhose executable Cholesky pivots are all positive (0 < choleskyFn A j j), the factorL = choleskyFn AsatisfiesSpec.Factorization.IsCholesky: lower-triangular andA = L · Lᵀ.choleskySpec_reconstructionis the tensor-level corollary.qr_mul_eq: forA : Fin m → Fin n → ℝwhose executable Gram–SchmidtR-pivots are positive (0 < Rmat A j j), the factorsQandRsatisfyA = Q · R, withRupper-triangular (Rmat_upper_triangular).qrSpec_reconstructionis the tensor-level corollary.
Method #
Each executable factor is built by a List.foldl that snocs one column per index. The core
technical device is getD_foldl_snoc_read, a general lemma reading the j-th element of such a
fold as the step function applied to the length-j prefix. From it,
prefix_eq_map/qsPrefix_eq_map identify the prefix with the first j columns of the final
factor, and take_map_sum_eq turns the code's List.foldl sums into masked Finset partial sums.
The QR fold threads a GSState that snocs onto both the Q-list and the R-list at once;
gs_proj_qs and gs_fold_split/rTail_getD recover the single-list read lemmas for each
projection (the step depends only on the Q-history). The positive-pivot hypotheses discharge the
√-radicand and divisor side conditions.
Scope #
This file proves A = L · Lᵀ and A = Q · R purely algebraically. The remaining QR property,
orthonormality of the Q factor, Qᵀ Q = 1, is proved in the companion file
NN.Proofs.Tensor.Basic.FactorizationsOrthonormal by bridging the executable Gram–Schmidt to
Mathlib's gramSchmidt, completing the full Spec.Factorization.IsQR predicate (isQR_of_pos).
List/Finset bridges #
Cholesky: the column-building step #
choleskyColsFn is a left fold that snocs one column per index. cholStep names the function it
appends, so that the read lemmas above can be specialized to it.
The prefix of Cholesky columns is exactly the first j columns of the final factor L,
each presented as the function r ↦ L r k.
List/Finset partial-sum bridges #
Every element of a finRange prefix has index below the cut.
Every element of a finRange tail has index at least the cut.
The Cholesky cross-sum equals the masked partial dot product of rows i and j of L.
The Cholesky diagonal sum-of-squares equals the masked partial squared norm of row j
of L.
Closed-form entries of the executable Cholesky factor #
The diagonal entry of L in closed form: L[j,j] = √(A[j,j] − Σ_{k<j} L[j,k]²).
The below-diagonal entry of L in closed form:
L[i,j] = (A[i,j] − Σ_{k<j} L[i,k]·L[j,k]) / L[j,j] for i > j.
Reconstruction A = L · Lᵀ #
Closed-form entries and positive pivots give reconstruction on and below the diagonal. Symmetry then gives the remaining entries.
Per-entry reconstruction for the lower part (j ≤ i): the (i, j) entry of L · Lᵀ is
A i j.
For a symmetric A whose specification Cholesky pivots are all
positive (0 < L[j,j]), the factor L = choleskyFn A is a
Cholesky factor: lower-triangular with A = L · Lᵀ.
For a symmetric tensor A whose choleskySpec pivots
are positive, every entry of A is reconstructed by L · Lᵀ:
A[i,j] = Σ_k L[i,k] · L[j,k], with L = choleskySpec A.
QR (classical Gram–Schmidt): exact reconstruction A = Q · R #
gramSchmidtFn threads a GSState that snocs a column onto both the Q-list and the R-list at
each index. The appended values depend only on the Q-history (st.qs), never on the
R-history, so the Q-list is itself a single-list snoc-fold (gs_proj_qs) and the R-list is
the Q-prefix-indexed tail rTail.
The R column at column index j, as a function of the row index k (so the value is the
matrix entry R[k, j]). With R indexed row-then-column, the nonzero part is on and above the
diagonal: rₖⱼ for k < j (strictly above the diagonal), rⱼⱼ for k = j, and 0 for k > j
(strictly below the diagonal).
Instances For
Semantics of the Context > test over ℝ.
Entries of the executable Q and R factors #
Exact reconstruction A = Q · R #
For a tensor A whose qrSpec R-pivots are positive,
every entry of A is reconstructed by Q · R:
A[i,j] = Σ_k Q[i,k]·R[k,j], with Q = qrQSpec A, R = qrRSpec A.