NLA-lib Explorer

NLAlib.Ops.writes_fill_scratch

Library · theorem

Fill a vector while reusing a fixed workspace footprint disjoint from the vector. Previously written entries survive every round's workspace updates.

NLAlib.Ops.writes_fill_scratch {Op Tst K : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K}
  {τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K} {n : Ops.IExp} {body : Ops.Stmt Op Tst} {N b o : ℕ}
  (hn : Ops.IExp.eval ρ.idx n = some N) (scratch : Ops.Fp)
  (hdis : scratch.Disj (Ops.Store.inBlock b o N)) (v : ℕ → K) (pos : ℕ → ℕ) (hpos : m.pos = pos 0)
  (hstep :
    ∀ i < N,
      ∀ (m' : Ops.Mem K),
        Ops.Store.EqOff (Ops.Store.inBlock b o i ⊔ scratch) m.store m'.store →
          m'.store.HoldsVec b o i v →
            m'.pos = pos i →
              Ops.Writes md I τ body (ρ.pushIdx i) (Ops.Store.inBlock b (o + i) 1 ⊔ scratch)
                (fun m'' ↦ m''.store.get b (o + i) = some (v i) ∧ m''.pos = pos (i + 1)) m') :
  Ops.Writes md I τ (Ops.Stmt.loop n body) ρ (Ops.Store.inBlock b o N ⊔ scratch)
    (fun m' ↦ m'.store.HoldsVec b o N v ∧ m'.pos = pos N) m

Full source on GitHub

Import NLAlib.Ops.Logic.Loop.