NLA-lib Explorer

NLAlib.Krylov.CG.residualCache_wp

Library · theorem

The actual scalar-lowered CG cache kernel is total under ordinary storage conditions. Only input values enter the range condition. The result includes the exact update, its mixed error and the small-residual consequence of a computed zero; no successful run is assumed. A step in the proof of NLAlib.Krylov.CG.residualCache_wp_float64, NLAlib.Krylov.CG.residualCache_wp_binaryQuantized, NLAlib.Krylov.CG.residualCache_wp_fixedPoint.

NLAlib.Krylov.CG.residualCache_wp {K : Type} [Inhabited K] {Op Tst : Type} [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.Blas1Op Op] [Ops.Apart Ops.Blas1Op Ops.ScalarOp Op] {M : Ops.Machine K} {dec : K → ℝ}
  {u eta B : ℝ} {safe : ℝ → Prop} {I : Ops.Interp Op Tst K} (hI : Ops.IsScalar M I)
  (hM : Ops.MixedModel u eta dec M safe) (hzero : dec (M.lit 0) = 0) {τ : Ops.Tape K} {n : ℕ}
  {r z : ℕ × ℕ} {m : Ops.Mem K} {rs : List K} (hl : m.Live [r, z])
  (hr : m.store.readBlock r.1 r.2 n = some rs) (hz : z.2 < m.store.len z.1)
  (hSafe : ∀ (a : ℝ), |a| ≤ B → safe a)
  (hRange :
    (1 + u) ^ (2 * n) * ‖WithLp.toLp 2 (Ops.decv dec n rs)‖ ^ 2 +
        ↑n * (1 + u) ^ (2 * n) * (2 + u) * eta ≤
      B) :
  Ops.Wp Ops.Mode.total I τ (Ops.Stmt.link Ops.Blas.sumSeqTable Ops.dotSum)
    (Ops.Env.frame [n] [r, r, z])
    (fun out ↦
      ∃ cache,
        out = m.upd z cache ∧
          out.store.get z.1 z.2 = some cache ∧
            Computation.AbsRelErr ((1 + u) ^ (2 * n) - 1) (↑n * (1 + u) ^ (2 * n) * (2 + u) * eta)
                (‖WithLp.toLp 2 (Ops.decv dec n rs)‖ ^ 2) (dec cache) ∧
              ((1 + u) ^ (2 * n) < 2 →
                dec cache = 0 →
                  ‖WithLp.toLp 2 (Ops.decv dec n rs)‖ ^ 2 ≤
                    ↑n * (1 + u) ^ (2 * n) * (2 + u) * eta / (2 - (1 + u) ^ (2 * n))))
    m

Full source on GitHub

Import NLAlib.Krylov.CG.ResidualCache.