NLA-lib Explorer

NLAlib.Ops.Examples.VectorSum.vadd_checked

Library · theorem

What the certificate states, with no reference to routines or contracts. Let M be a scalar machine. 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 n blank cells succeeds, its work is at most 14 n + 2 instructions, its resident memory is at most the payload of the three buffers plus the static scratch of the tree, and the third buffer holds the vector of the machine sums M.add (x i) (y i). Every pair of vectors is admitted (NLAlib.Ops.Inputs.covers).

NLAlib.Ops.Examples.VectorSum.vadd_checked (M : Ops.Machine ℝ) (d : Fin 1 → ℕ) (x y : Fin (d 0) → ℝ)
  (I : Ops.Interp Ops.ScalarOp Ops.CmpTst ℝ)
  (hI :
    (Ops.Examples.VectorSum.vaddModel M).contracts d
      (Ops.Examples.VectorSum.vaddDomain.input d (x, y) trivial) I)
  (τ : Ops.Tape ℝ) :
  ∃ st,
    Ops.Reference.Execution Ops.Examples.VectorSum.vaddProgram I
        (Ops.Examples.VectorSum.vaddModel M).resources Ops.Examples.VectorSum.vaddDomain.formats τ d
        (Ops.Examples.VectorSum.vaddDomain.memory d (x, y)) st ∧
      (Ops.Examples.VectorSum.vaddModel M).resources.work st.cost ≤ 14 * d 0 + 2 ∧
        Ops.Examples.VectorSum.vaddDomain.bytes d + st.peak ≤
            Ops.Examples.VectorSum.vaddDomain.bytes d +
              Ops.staticPeak (Ops.Examples.VectorSum.vaddModel M).resources
                Ops.Examples.VectorSum.vaddProgram d ∧
          st.mem.Holds (Ops.Codec.vector (d 0)) 2 fun i ↦ M.add (x i) (y i)

Full source on GitHub

Import NLAlib.Ops.Examples.VectorSum.