NLA-lib Explorer

NLAlib.Ops.Reference.instrumented_allocAs

Library · theorem

Scoped allocation agrees with the source allocation and release states, including peak.

NLAlib.Ops.Reference.instrumented_allocAs {Op Tst K : Type} (I : Ops.Interp Op Tst K)
  (R : Ops.ResourceModel Op Tst) (τ : Ops.Tape K) (fmt : Ops.StorageFormat) (len : Ops.IExp)
  (body : Ops.Stmt Op Tst) (ρ : Ops.Env) (a : Ops.Reference.State Op Tst K) (ha : a.cur ≤ a.peak)
  {n : ℕ} (hn : Ops.IExp.eval ρ.idx len = some n) :
  Ops.Reference.instrumented I R τ (Ops.Stmt.allocAs fmt len body) ρ a =
    Option.map (Ops.Reference.released fmt n a.cur)
      (Ops.Reference.instrumented I R τ body (ρ.pushBuf (List.length a.mem.store))
        (Ops.Reference.allocated fmt n (Ops.Reference.charge (Ops.Reference.index len) a)))

Full source on GitHub

Import NLAlib.Ops.Reference.Accounting.