TorchLean API

NN.Proofs.RuntimeApprox.NF.Ops.Sum

NF Sum Reduction Bounds #

Forward-error bounds for rounded sum reductions. The accumulator carries both the runtime value and a proof budget, so every addition contributes the incoming element error plus one rounding term.

One fold step for sumSpec that tracks an explicit forward error budget.

State is (accR, epsAcc) where accR is the runtime accumulator and epsAcc bounds the absolute error |toSpec accR - accS| for the corresponding spec accumulator accS. Each step adds:

  • the incoming per-element budget epsElem;
  • one rounding-ULP term for the addition.
Instances For

    Fold sumStep over a tensor via foldlSpec.

    This is the shared helper behind sumBound and approxTensor_sum_spec: it simultaneously computes the runtime sum (in .1) and the accumulated error bound (in .2).

    Instances For

      Forward absolute-error bound for sumSpec.

      sum_bound epsElem tR is the .2 component of sumFoldState started at 0, assuming each element is approximated within epsElem. This corresponds to naive sequential summation with a rounding term added at each step (cf. standard floating-point summation analyses).

      Instances For

        Forward approximation bound for sumSpec over an arbitrary tensor shape.

        If xR approximates xS elementwise within eps, then the scalar sums sum_spec xR and sum_spec xS differ by at most sum_bound eps xR.