NLA-lib Explorer

NLAlib.Ops.Examples.Routines.sum2_checked

Library · theorem

Standard rounding

What the certificate states, with no reference to routines or contracts. Let M be a scalar machine satisfying the standard model of arithmetic at unit roundoff u \ge 0. For every length n = d 0, every pair of real vectors \mathbf{x}, y, every interpretation I of the scalar operations of the model, and every tape, the counted run of the fixed program from the two vectors and two blank cells succeeds, its work is at most 24 n + 63 instructions, its resident memory is at most the payload of the four buffers plus the static scratch of the tree, and the third buffer holds a value \mathbf{v} with \lvert \mathbf{v} - (\textstyle\sum_i \mathbf{x}_i + \sum_i y_i) \rvert \le \bigl((1 + u)(1 + u)^{n - 1} - 1\bigr) \bigl(\textstyle\sum_i \lvert \mathbf{x}_i \rvert + \sum_i \lvert y_i \rvert\bigr). Every pair of vectors is admitted (NLAlib.Ops.Inputs.covers).

NLAlib.Ops.Examples.Routines.sum2_checked (M : Ops.Machine ℝ) (u : ℝ) (hM : Ops.StdModel u id M)
  (hu : 0 ≤ u) (d : Fin 1 → ℕ) (x y : Fin (d 0) → ℝ) (I : Ops.Interp Ops.ScalarOp Ops.CmpTst ℝ)
  (hI :
    (Ops.Examples.Routines.sum2Model M).contracts d
      (Ops.Examples.Routines.sum2Domain.input d (x, y) trivial) I)
  (τ : Ops.Tape ℝ) :
  ∃ st,
    Ops.Reference.Execution Ops.Examples.Routines.sum2Program I
        (Ops.Examples.Routines.sum2Model M).resources Ops.Examples.Routines.sum2Domain.formats τ d
        (Ops.Examples.Routines.sum2Domain.memory d (x, y)) st ∧
      (Ops.Examples.Routines.sum2Model M).resources.work st.cost ≤ 24 * d 0 + 63 ∧
        Ops.Examples.Routines.sum2Domain.bytes d + st.peak ≤
            Ops.Examples.Routines.sum2Domain.bytes d +
              Ops.staticPeak (Ops.Examples.Routines.sum2Model M).resources
                Ops.Examples.Routines.sum2Program d ∧
          ∃ v,
            st.mem.Holds Ops.Codec.scalar 2 v ∧
              |v - (∑ i, x i + ∑ i, y i)| ≤
                ((1 + u) * (1 + u) ^ (d 0 - 1) - 1) * (∑ i, |x i| + ∑ i, |y i|)

Full source on GitHub

Import NLAlib.Ops.Examples.RoutineCertification.