NLA-lib Explorer

NLAlib.Ops.Reference.instrumented_bindIdx

Library · theorem

A bounded index query charges the conversion and enters its body at the returned index.

NLAlib.Ops.Reference.instrumented_bindIdx {Op Tst K : Type} (I : Ops.Interp Op Tst K)
  (R : Ops.ResourceModel Op Tst) (τ : Ops.Tape K) (q : Tst) (ins : List Ops.Operand)
  (bound : Ops.IExp) (body : Ops.Stmt Op Tst) (ρ : Ops.Env) (a : Ops.Reference.State Op Tst K)
  (ha : a.cur ≤ a.peak) {xs : List (ℕ × ℕ)} {n v : ℕ} (hx : Ops.Operand.evalList ρ ins = some xs)
  (hn : Ops.IExp.eval ρ.idx bound = some n) (hq : I.index q xs a.mem = some v) (hv : v ≤ n) :
  Ops.Reference.instrumented I R τ (Ops.Stmt.bindIdx q ins bound body) ρ a =
    Ops.Reference.instrumented I R τ body (ρ.pushIdx v)
      (Ops.Reference.charge
        (Ops.Reference.operands ins + Ops.Reference.index bound +
            Ops.Reference.core Ops.Bookkeeping.bindIdx +
          Ops.Count.test q [])
        a)

Full source on GitHub

Import NLAlib.Ops.Reference.Accounting.