NLA-lib Explorer

NLAlib.TriangularSolve.writes_substLoop

Library · theorem

Standard rounding

The loop of a substitution in the order σ: for r < n, row r is accumulated in place at the cell σ r of x, from the coefficients T_{rj}, j < r, and the entries already computed, and divided by T_{rr} \ne 0. The coefficients are read in cells off x and off the scratch w. The block written is a trace of forward substitution in the order σ.

NLAlib.TriangularSolve.writes_substLoop {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  {M : Ops.Machine K} {I : Ops.Interp Op Tst K} (hI : Ops.IsScalar M I) {u : ℝ} {dec : K → ℝ}
  (hM : Ops.StdModel u dec M) {τ : Ops.Tape K} {ρ : Ops.Env} {m : Ops.Mem K}
  {bound inner : Ops.IExp} {n : ℕ} (hn : Ops.IExp.eval ρ.idx bound = some n)
  (hinner : ∀ r < n, Ops.IExp.eval (ρ.pushIdx r).idx inner = some r) {a b c d t : Ops.Operand}
  {σ : ℕ → ℕ} (hσ : ∀ r < n, σ r < n) (hinj : ∀ r < n, ∀ l < n, σ r = σ l → r = l) {x w : ℕ × ℕ}
  {p : ℕ → ℕ → ℕ × ℕ} {e : ℕ → ℕ × ℕ} {T : ℕ → ℕ → K} {xs : List K}
  (ha : ∀ r < n, ∀ j < r, Ops.Operand.eval ((ρ.pushIdx r).pushIdx j) a = some (p r j))
  (hb : ∀ r < n, ∀ j < r, Ops.Operand.eval ((ρ.pushIdx r).pushIdx j) b = some (x.1, x.2 + σ j))
  (hc : ∀ r < n, Ops.Operand.eval (ρ.pushIdx r) c = some (x.1, x.2 + σ r))
  (hd : ∀ r < n, Ops.Operand.eval (ρ.pushIdx r) d = some (e r))
  (ht : ∀ r < n, ∀ j < r, Ops.Operand.eval ((ρ.pushIdx r).pushIdx j) t = some w)
  (hT : ∀ r < n, ∀ j < r, m.store.get (p r j).1 (p r j).2 = some (T r j))
  (hD : ∀ r < n, m.store.get (e r).1 (e r).2 = some (T r r))
  (hpx : ∀ r < n, ∀ j < r, (p r j).1 ≠ x.1) (hex : ∀ r < n, (e r).1 ≠ x.1)
  (hpw : ∀ r < n, ∀ j < r, (p r j).1 ≠ w.1) (hew : ∀ r < n, (e r).1 ≠ w.1) (hxw : x.1 ≠ w.1)
  (hw : w.2 < m.store.len w.1) (hxs : m.store.readBlock x.1 x.2 n = some xs)
  (hne : ∀ r < n, dec (T r r) ≠ 0) :
  Ops.Writes Ops.Mode.total I τ
    (Ops.Stmt.loop bound
      ((Ops.Stmt.loop inner
            ((Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.mul) [] [a, b] [t]).seq
              (Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.sub) [] [c, t] [c]))).seq
        (Ops.Stmt.call (Ops.Has.inj Ops.ScalarOp.div) [] [c, d] [c])))
    ρ (Ops.Store.inBlock x.1 x.2 n ⊔ Ops.Store.inBlock w.1 w.2 1)
    (fun m' ↦
      m'.pos = m.pos ∧
        ∃ ys,
          m'.store.readBlock x.1 x.2 n = some ys ∧
            Computation.IsSubstTrace (fun x ↦ Computation.RelErr u) (fun r j ↦ dec (T r j))
              (fun r ↦ dec (Ops.vec xs (σ r))) n fun r ↦ dec (Ops.vec ys (σ r)))
    m

Full source on GitHub

Import NLAlib.Matrix.Factorizations.TriangularSolve.Substitution.