NLAlib.Ops.writes_fillEntries₂
Library · theorem
Two loops fill a matrix one whole fixed-width entry at a time. The step supplies the component words of its current entry and the next tape position. The frame of all earlier entries is available for input reads; maintaining the output matrix invariant is automatic.
NLAlib.Ops.writes_fillEntries₂ {Op Tst K E : Type} {md : Ops.Mode} {I : Ops.Interp Op Tst K}
{τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K} {n₁ n₂ : Ops.IExp} {body : Ops.Stmt Op Tst}
(C : Ops.EntryCodec K E) (L : Ops.MatLayout) (hL : L.Valid)
(hn₁ : Ops.IExp.eval ρ.idx n₁ = some L.cols)
(hn₂ : ∀ (j : ℕ), Ops.IExp.eval (ρ.pushIdx j).idx n₂ = some L.rows) (A : ℕ → ℕ → E) (pos : ℕ → ℕ)
(hpos : m.pos = pos 0)
(hstep :
∀ j < L.cols,
∀ i < L.rows,
∀ (m' : Ops.Mem K),
Ops.Store.EqOff ((C.wordLayout L).upto j (C.width * i)) m.store m'.store →
m'.pos = pos (j * L.rows + i) →
Ops.Writes md I τ body ((ρ.pushIdx j).pushIdx i)
(Ops.Store.inBlock L.buf (L.off + C.width * (j * L.ld + i)) C.width)
(fun m'' ↦
(∀ (z : Fin C.width),
m''.store.get L.buf (L.off + C.width * (j * L.ld + i) + ↑z) =
some (C.words (A i j) z)) ∧
m''.pos = pos (j * L.rows + i + 1))
m') :
Ops.Writes md I τ (Ops.Stmt.loop n₁ (Ops.Stmt.loop n₂ body)) ρ (C.wordLayout L).fp
(fun m' ↦ m'.store.HoldsEntries C L A ∧ m'.pos = pos (L.cols * L.rows)) mImport NLAlib.Ops.Logic.EntryFill.