NLA-lib Explorer

NLAlib.Ops.writes_loop_mul_cell

Library · theorem

An in-place scaling loop: the loop of N rounds whose round t multiplies the cell o + t of the buffer \mathbf{b} by a cell y outside the block, in place, stores in each cell of the block the machine product of its old word with the word of y; it writes only the block and keeps the tape position.

NLAlib.Ops.writes_loop_mul_cell {Op Tst K : Type} [Ops.Has Ops.ScalarOp Op] {M : Ops.Machine K}
  {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) {τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K}
  {n : Ops.IExp} {N b o : ℕ} {y : ℕ × ℕ} {X Y : Ops.Operand} {r : K}
  (hn : Ops.IExp.eval ρ.idx n = some N)
  (hX : ∀ t < N, Ops.Operand.evalList (ρ.pushIdx t) [X, Y] = some [(b, o + t), y])
  (hX' : ∀ t < N, Ops.Operand.evalList (ρ.pushIdx t) [X] = some [(b, o + t)])
  (hl : m.Live [(b, o), y]) (hv : ∀ t < N, ∃ w, m.store.get b (o + t) = some w)
  (hy : m.store.get y.1 y.2 = some r) (hyb : ¬Ops.Store.inBlock b o N y.1 y.2) :
  Ops.Writes Ops.Mode.total I τ
    (Ops.Stmt.loop n (Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.mul) [] [X, Y] [X])) ρ
    (Ops.Store.inBlock b o N)
    (fun m' ↦
      m'.pos = m.pos ∧
        ∀ t < N,
          ∀ (w : K), m.store.get b (o + t) = some w → m'.store.get b (o + t) = some (M.mul w r))
    m

Full source on GitHub

Import NLAlib.Ops.Logic.ScalarLoop.