NLA-lib Explorer

NLAlib.Ops.RoundedScalarBlas.nrm2_meets_stdModel

Library · theorem

Standard rounding

The rounded scalar-lowered norm is two-sided accurate: under the standard model at \boldsymbol{u} with (n + 2)\boldsymbol{u} \le 1/2, the stored \mathbf{x} of the sequential norm of n real words \mathbf{x}_0, \dots, \mathbf{x}_{n-1} satisfies (1 - (n + 2)\boldsymbol{u})\sqrt{\sum_i x_i^2} \le x \le (1 + (n + 2)\boldsymbol{u}) \sqrt{\sum_i x_i^2}: the n squares and the n sequential additions of nonnegative terms ([Higham2002, §3.1]) and the rounded square root. In particular \mathbf{x} = 0 exactly when every word is 0.

NLAlib.Ops.RoundedScalarBlas.nrm2_meets_stdModel {Tst Op : Type} [Ops.Has Ops.ScalarOp Op]
  {M : Ops.Machine ℝ} {u : ℝ} {I : Ops.Interp Op Tst ℝ} (hS : Ops.IsScalar M I)
  (hM : Ops.StdModel u id M) :
  Ops.RoundedScalarBlas.nrm2.Meets I
    {
      pre := fun d _ω X ↦
        match d, X with
        | [n], [xs] => (↑n + 2) * u ≤ 1 / 2
        | x, x_1 => False,
      post := fun d _ω X Y ↦
        match d, X, Y with
        | [n], [xs], [[v]] =>
          (1 - (↑n + 2) * u) * √(∑ i ∈ Finset.range n, Ops.vec xs i ^ 2) ≤ v ∧
            v ≤ (1 + (↑n + 2) * u) * √(∑ i ∈ Finset.range n, Ops.vec xs i ^ 2)
        | x, x_1, x_2 => False }

Full source on GitHub

Import NLAlib.Ops.Profiles.RoundedScalarBlas.