NLAlib.Ops.RunsFromW.alloc
Library · theorem
Scratch buffer: the body runs with the new buffer on top, which is then popped; the workspace is that of the body above the buffer.
NLAlib.Ops.RunsFromW.alloc {Op Tst K : Type} {I : Ops.Interp Op Tst K} {W : Op → List ℕ → ℕ}
{τ : Ops.Tape K} {ρ : Ops.Env} {st : Ops.St Op Tst K} {p : ℕ}
{Q : Ops.Count Op Tst → Ops.Mem K → Prop} {format : Ops.StorageFormat} {len : Ops.IExp}
{body : Ops.Stmt Op Tst} {n : ℕ} (hn : Ops.IExp.eval ρ.idx len = some n)
(h :
Ops.RunsFromW I W τ body (ρ.pushBuf (List.length st.mem.store))
{ mem := { store := st.mem.store.push n, pos := st.mem.pos }, cost := st.cost,
cur := st.cur + format.bytes * n, peak := max st.peak (st.cur + format.bytes * n) }
p fun c m' ↦ Q c { store := m'.store.pop, pos := m'.pos }) :
Ops.RunsFromW I W τ (Ops.Stmt.allocAs format len body) ρ st (format.bytes * n + p) QImport NLAlib.Ops.Counted.