NLA-lib Explorer

NLAlib.Ops.writes_fill₂

Library · theorem

The two loops that fill a matrix by columns in the layout L: round (j, i) writes the entry A i j in its cell and moves the position from pos (j * rows + i) to the next. The 2-D form of writes_fill (the fill of a Gaussian test matrix from the tape).

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₁ n₂ : Ops.IExp} {body : Ops.Stmt Op Tst} (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 : ℕ → ℕ → K) (pos : ℕ → ℕ)
  (hpos : m.pos = pos 0)
  (hstep :
    ∀ j < L.cols,
      ∀ i < L.rows,
        ∀ (m' : Ops.Mem K),
          Ops.Store.EqOff (L.upto j i) m.store m'.store →
            m'.store.HoldsMatUpto L A j i →
              m'.pos = pos (j * L.rows + i) →
                Ops.Writes md I τ body ((ρ.pushIdx j).pushIdx i)
                  (Ops.Store.inBlock L.buf (L.cell i j) 1)
                  (fun m'' ↦
                    m''.store.get L.buf (L.cell i j) = some (A i j) ∧
                      m''.pos = pos (j * L.rows + i + 1))
                  m') :
  Ops.Writes md I τ (Ops.Stmt.loop n₁ (Ops.Stmt.loop n₂ body)) ρ L.fp
    (fun m' ↦ m'.store.HoldsMat L A ∧ m'.pos = pos (L.cols * L.rows)) m

Full source on GitHub

Import NLAlib.Ops.Logic.Loop.