NF Linear Algebra #
Forward-error bounds for the noncomputable rounded-real NF model.
This extends NN.Proofs.RuntimeApprox.NF.Ops with bounds for the core
sum-of-products patterns that appear in linear layers and matrix multiplication.
The development separates scalar fold bounds for dot products from the tensor-level wrappers that
turn those fold bounds into approxTensor theorems and graph nodes.
Each dot product rounds multiplication and addition separately in increasing index order.
These results do not establish a native GEMM or fused multiply-add error bound.
PyTorch correspondence / citations #
This is the proof analogue of linear algebra building blocks used throughout PyTorch models:
matrix-vector/matrix-matrix multiplication (torch.matmul) and linear layers
(torch.nn.functional.linear).
https://pytorch.org/docs/stable/generated/torch.matmul.html
https://pytorch.org/docs/stable/generated/torch.nn.functional.linear.html
Inserting a singleton axis is a reindexing operation and adds no numerical error.
Swapping any pair of adjacent axes preserves the approximation error budget.
One fold step for building a dot-product and tracking a forward error bound.
This is used to bound the error of foldl (fun acc k => acc + aR k * bR k) compared to the
corresponding spec (real) dot-product.
Instances For
Accumulated error budget for a sequential dot product over List.finRange n.
The initial zero contributes a conservative half ULP, followed by separate multiplication
and addition budgets at each index.
Instances For
Per-output bound tensor for matVecMulSpec.
Entry i is a dot-product bound for row i of A dotted with v, using dotBound.
Instances For
Forward approximation bound for matrix-vector multiplication.
In words: if A and v are each approximated by runtime AR/vR within epsA/epsV,
then matVecMulSpec AS vS is approximated by matVecMulSpec AR vR, with error bounded by
linfNorm (matVecMulBoundTensor epsA epsV AR vR).
Per-entry bound tensor for matMulSpec.
Entry (i,j) is a dot-product bound for row i of A dotted with column j of B, using
dotBound.
Instances For
Forward approximation bound for matrix-matrix multiplication.
In words: if A and B are approximated by runtime matrices AR/BR within epsA/epsB,
then matMulSpec AS BS is approximated by matMulSpec AR BR, with error bounded by
linfNorm (matMulBoundTensor epsA epsB AR BR).
FwdNode for matrix transpose.
This lifts approxTensor_swapAdjacentAxes at depth zero into the FwdGraph interface so
transposes can be used inside larger verified graphs.
Instances For
FwdNode for matrix-vector multiplication.
The bound is computed by matVecMulBoundTensor and then reduced to a scalar budget via
linfNorm.
Instances For
FwdNode for matrix-matrix multiplication.
The bound is computed by matMulBoundTensor and then reduced to a scalar budget via linfNorm.