NLA-lib Explorer

NLAlib.Ops.prodLoop_wp

Library · theorem

The product loop fills the block t from offset zero with the rounded products and writes nothing else. Shared by the trees of NLAlib.Ops.dotSum, NLAlib.Ops.nrm2Sum.

NLAlib.Ops.prodLoop_wp {K Op Tst : Type} [Ops.Has Ops.ScalarOp Op] {M : Ops.Machine K}
  {I : Ops.Interp Op Tst K} (hI : Ops.IsScalar M I) {md : Ops.Mode} {τ : Ops.Tape K} {ρ : Ops.Env}
  {n : Ops.IExp} {x y t : Ops.Operand} {N bx by' bt ox oy : ℕ} {S : Ops.Store K} {p : ℕ}
  {a b : ℕ → K} (hn : Ops.IExp.eval ρ.idx n = some N)
  (hx : ∀ (k : ℕ), Ops.Operand.eval (ρ.pushIdx k) x = some (bx, ox + k))
  (hy : ∀ (k : ℕ), Ops.Operand.eval (ρ.pushIdx k) y = some (by', oy + k))
  (ht : ∀ (k : ℕ), Ops.Operand.eval (ρ.pushIdx k) t = some (bt, k)) (hxt : bx ≠ bt) (hyt : by' ≠ bt)
  (hlen : N ≤ S.len bt) (ha : ∀ k < N, S.get bx (ox + k) = some (a k))
  (hb : ∀ k < N, S.get by' (oy + k) = some (b k)) {Q : Ops.Mem K → Prop}
  (hQ :
    ∀ (s' : Ops.Store K),
      Ops.Store.EqOff (Ops.Store.inBuf bt) S s' →
        s'.readBlock bt 0 N = some (List.map (fun k ↦ M.mul (a k) (b k)) (List.range N)) →
          Q { store := s', pos := p }) :
  Ops.Wp md I τ (Ops.prodLoop n x y t) ρ Q { store := S, pos := p }

Full source on GitHub

Import NLAlib.Ops.Blas.Dot.