LAProof.accuracy_proofs.sum_acc
Floating-Point Summation Accuracy Theorems
Error Factors
Main Results
- bSUM: Shows that the computed floating-point sum can be expressed as
the exact sum of a slightly perturbed input list. Each input element is
perturbed by a relative factor bounded by
\(g(n-1)\), where \(n\) is the list length.
- Fsum_backward_error: The ordinal-indexed analogue of bSUM, expressing
the same backward error bound for functions indexed by finite ordinals.
- fSUM: Bounds the absolute forward error of the computed sum by
\(g(n) \cdot \sum |x_i|\), where
\(n\) is the list length.
- Fsum_forward_error: The ordinal-indexed analogue of fSUM.
- sum_forward_error_permute: Shows that the forward error bound is stable under permutation of the input list, so the bound holds regardless of the order in which elements are summed.
Dependencies
- preamble, common: basic setup and shared definitions
- sum_model: the floating-point summation model sumF and sumR
- float_acc_lems: elementary floating-point accuracy lemmas
From LAProof.accuracy_proofs Require Import
preamble
common
sum_model
float_acc_lems.
Require LAProof.accuracy_proofs.mv_mathcomp.
Require Import Permutation.
Section WithNan.
Context {NAN : FPCore.Nans} {t : type}.
Notation g := (@g t).
Notation D := (@default_rel t).
Notation neg_zero := (@common.neg_zero t).
Backward Error: List Version
Theorem bSUM :
∀ (x : list (ftype t))
(Hfin : Binary.is_finite (sumF x)),
∃ (x' : list R),
size x' = size x ∧
FT2R (sumF x) = sumR x' ∧
(∀ n,
(n < size x')%nat →
∃ delta,
nth 0 x' n = FT2R (nth neg_zero x n) × (1 + delta) ∧
Rabs delta ≤ g (size x' - 1)).
Backward Error: Indexed Version
Theorem Fsum_backward_error :
∀ [n] (x : 'I_n → ftype t)
(Hfin : Binary.is_finite (mv_mathcomp.F.sum x)),
∃ (x' : 'I_n → R),
FT2R (mv_mathcomp.F.sum x) = \sum_i x' i ∧
(∀ i : 'I_n,
∃ delta,
x' i = FT2R (x i) × (1 + delta) ∧
Rabs delta ≤ g (n - 1)).
Forward Error: List Version
Theorem fSUM :
∀ (x : list (ftype t))
(Hfin : Binary.is_finite (sumF x)),
Rabs (sumR (map FT2R x) - FT2R (sumF x)) ≤
g (size x) × sumR (map Rabs (map FT2R x)).
Forward Error: Indexed Version
Lemma Fsum_forward_error :
∀ [n] (x : 'I_n → ftype t)
(Hfin : Binary.is_finite (mv_mathcomp.F.sum x)),
Rabs (\sum_i (FT2R (x i)) - FT2R (mv_mathcomp.F.sum x)) ≤
g n × (\sum_i (Rabs (FT2R (x i)))).
Forward Error Under Permutation
Lemma sum_forward_error_permute' :
∀ (x x0 : list (ftype t))
(Hfin : Binary.is_finite (sumF x))
(Hfin0 : Binary.is_finite (sumF x0))
(Hper : Permutation x x0),
Rabs ((sumR (map FT2R x0)) - FT2R (sumF x0)) ≤
g (size x) × (sumR (map Rabs (map FT2R x0))).
sum_forward_error_permute shows that the forward error bound for the
computed sum is invariant under permutation of the input. If two lists
are permutations of each other, the absolute forward error for either
computed sum is bounded by
\(g(n) \cdot \sum |x_i|\)
using the shared element set and length \(n\).