NLAlib.Ops.wp_loop_fill
Library · theorem
The loop that fills a block cell by cell: round i writes the value v i in the cell o + i of the buffer b and moves the position from pos i to pos (i + 1); it may read the cells already written and everything outside the block.
NLAlib.Ops.wp_loop_fill {Op Tst K : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K} {τ : Ops.Tape K}
{ρ : Ops.Env} {Q : Ops.Mem K → Prop} {n : Ops.IExp} {body : Ops.Stmt Op Tst} {N b o : ℕ}
{S : Ops.Store K} (v : ℕ → K) (pos : ℕ → ℕ) (hn : Ops.IExp.eval ρ.idx n = some N)
(hstep :
∀ i < N,
∀ (s' : Ops.Store K),
Ops.Store.EqOff (Ops.Store.inBlock b o i) S s' →
s'.readBlock b o i = some (List.map v (List.range i)) →
Ops.Wp md I τ body (ρ.pushIdx i)
(fun x ↦ x = { store := s'.upd b (o + i) (v i), pos := pos (i + 1) })
{ store := s', pos := pos i })
(hlen : o + N ≤ S.len b)
(hQ :
∀ (s' : Ops.Store K),
Ops.Store.EqOff (Ops.Store.inBlock b o N) S s' →
s'.readBlock b o N = some (List.map v (List.range N)) → Q { store := s', pos := pos N }) :
Ops.Wp md I τ (Ops.Stmt.loop n body) ρ Q { store := S, pos := pos 0 }Import NLAlib.Ops.Window.