NLA-lib Explorer

NLAlib.Sign.loop_writes

Library · theorem

From an actual initialized matrix/cache/flag representation, the capped loop terminates with the existing mathematical capped Newton–Schulz result. It requires only functional scalar/multiplication contracts, exact comparison queries, distinct zero/one decodings and workspace capacities. No numerical convergence or successful-execution premise is assumed. A fragment of NLAlib.Sign.signRoutine.

NLAlib.Sign.loop_writes {K Op Tst Su Sg : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.MatrixOp Op] [Ops.Has Ops.CmpTst Tst] {M : Ops.Machine K} {dec : K → ℝ}
  {mm : MatMulMap (K × K)} {qr : QRMap (K × K)} {unif : K → Su → K} {normal : Sg → K × K}
  {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) (hC : Ops.IsCmp dec I)
  (hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I) {τ : Ops.Tape K} {n cap : ℕ}
  (A : Matrix (Fin n) (Fin n) (K × K)) (η : K) {x w v t : ℕ × ℕ} {m : Ops.Mem K}
  (hState :
    Sign.LoopState (M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) unif normal) x w t η A
      m.store)
  (h01 : dec (M.lit 0) ≠ dec (M.lit 1)) (hl : m.Live [x, w, v, t])
  (hAP : Ops.Fp.Apart [x, w, v, t] [2 * (n * n), 2 * (n * n), 2 * (n * n), 5])
  (hx : x.2 + 2 * (n * n) ≤ m.store.len x.1) (hw : w.2 + 2 * (n * n) ≤ m.store.len w.1)
  (hv : v.2 + 2 * (n * n) ≤ m.store.len v.1) (ht : t.2 + 5 ≤ m.store.len t.1) :
  Ops.Writes Ops.Mode.total I τ (Sign.loop (Ops.Has.inj Ops.MatrixOp.mul))
    (Ops.Env.frame [n, cap] [x, w, v, t, x, w, v, t]) (Sign.loopFootprint n x w v t)
    (fun μ ↦
      Sign.LoopState (M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) unif normal) x w t η
          (newtonSchulzLoop (M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) unif normal) η
            cap A)
          μ.store ∧
        μ.pos = m.pos)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.Sign.Loop.