NLAlib.Ops.writes_allocs_readBlocks
Library · theorem
A scratch-allocation chain returns a whole tuple of actual output blocks, preserving position and releasing every scratch buffer. Output handles belong to the caller; the body may modify only the declared output regions and fresh scratch.
NLAlib.Ops.writes_allocs_readBlocks {K Op Tst : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K}
{τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K} {lens : List Ops.IExp} {body : Ops.Stmt Op Tst}
{ns : List ℕ} {zs : List (ℕ × ℕ)} {ls : List ℕ} {ys : List (List K)}
(hn : Ops.IExp.evalList ρ.idx lens = some ns) (hz : m.Live zs)
(h :
∀ (s₁ : Ops.Store K),
List.length s₁ = List.length m.store + ns.length →
(∀ (i : ℕ) (hi : i < ns.length), s₁.len (List.length m.store + i) = ns[i]) →
Ops.Store.Below (List.length m.store) m.store s₁ →
Ops.Writes md I τ body
{ idx := ρ.idx,
buf := ρ.buf ++ List.map (fun x ↦ List.length m.store + x) (List.range ns.length) }
(Ops.Fp.blocks zs ls ⊔ Ops.Fp.above (List.length m.store))
(fun m' ↦ m'.pos = m.pos ∧ m'.readBlocks zs ls = some ys)
{ store := s₁, pos := m.pos }) :
Ops.Writes md I τ (Ops.Stmt.allocs lens body) ρ (Ops.Fp.blocks zs ls)
(fun m' ↦ m'.pos = m.pos ∧ m'.readBlocks zs ls = some ys) mImport NLAlib.Ops.Logic.Allocation.