NLA-lib Explorer

NLAlib.Ops.Routine.Domain.checked_post

Library · theorem

What a counted certificate states, for the admitted inputs: the run of the fixed program from the buffers of the slots succeeds, its work is at most work, its resident memory is at most the payload of the slots plus the static scratch of the tree, and the reported operands hold blocks satisfying the postcondition of the routine at the blocks of the inputs.

NLAlib.Ops.Routine.Domain.checked_post {K Op Tst : Type} {r b : ℕ} {R : Ops.Routine Op Tst}
  (D : R.Domain K r b) {M : Ops.AccessModel Op Tst D.problem}
  {Sp : (d : Fin r → ℕ) → D.In d → Ops.Routine.Spec K} {work : (Fin r → ℕ) → ℕ}
  (A :
    Ops.Algorithm M
      (R.specification (fun d X ↦ Sp d (↑X).1) M.resources (fun d X ↦ D.blocks d (↑X).1) D.bytes
        work))
  (d : Fin r → ℕ) (hd : D.valid d) (x : D.In d) (hx : D.accepts d x) (I : Ops.Interp Op Tst K)
  (hI : M.contracts d (D.input d x hx) I) (τ : Ops.Tape K) :
  ∃ st,
    Ops.Reference.Execution A.program I M.resources D.formats τ d (D.memory d x) st ∧
      M.resources.work st.cost ≤ work d ∧
        D.bytes d + st.peak ≤ D.bytes d + Ops.staticPeak M.resources (R.close r b) d ∧
          ∃ ys,
            st.mem.readBlocks (R.outArgs (Ops.slots b)) (R.outLens (List.ofFn d)) = some ys ∧
              (Sp d x).post (List.ofFn d) τ (D.blocks d x) ys

Full source on GitHub

Import NLAlib.Ops.RoutineProblem.