NLA-lib Explorer

NLAlib.Ops.writes_fill

Library · theorem

The loop that fills a vector: round i writes v i in the cell o + i of b and moves the position from pos i to pos (i + 1); it may read the entries already written and everything off the block.

NLAlib.Ops.writes_fill {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) (v : ℕ → K) (pos : ℕ → ℕ) (hpos : m.pos = pos 0)
  (hstep :
    ∀ i < N,
      ∀ (m' : Ops.Mem K),
        Ops.Store.EqOff (Ops.Store.inBlock b o i) 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)
                (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)
    (fun m' ↦ m'.store.HoldsVec b o N v ∧ m'.pos = pos N) m

Full source on GitHub

Import NLAlib.Ops.Logic.Loop.