NLA-lib Explorer

NLAlib.ShiftedQR.shPrefix_terminates

Library · theorem

This statement changed in the recorded rename: 2026-11-schur.

The start of Sh terminates on any matrix: from the context NLAlib.ShiftedQR.ShCtx (any matrix, shifts and words) and a log with no pending entries and room for a slot, apart from the views and the scratch, k = 2^q \le n, on a scalar machine with exact comparisons, index literals, index conversion and exact natural literals up to n + 1, the potential, Find and the comptau test (NLAlib.ShiftedQR.shPrefix) keep the context and leave the pair Z, the words Rt, P0, P1 and the step T stored, and the test step's entries (planes below n) pending in the log.

NLAlib.ShiftedQR.shPrefix_terminates {O Q : Type} [Ops.Has Ops.ScalarOp O] [Ops.Has Ops.IndexOp O]
  [Ops.Has Ops.CmpTst Q] [Ops.Has Ops.IdxTst Q] {n : ℕ} {M : Ops.Machine ℝ} {I : Ops.Interp O Q ℝ}
  (hS : Ops.IsScalar M I) (hL : Ops.IsIndexLit M I) (hNat : Ops.IsExactNatLit id M (n + 1))
  (hC : Ops.IsCmp id I) (hQ : Ops.IsToNat id I) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {L k q : ℕ}
  (hkq : k = 2 ^ q) (hkn : k ≤ n) {ε : ℝ} {a s wg wr ww wp g thr f : ℕ × ℕ}
  (hv : ShiftedQR.ShViews L n k ε a s wg wr ww wp g thr f)
  {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {ss : List ℂ} {cg cr cw cp tv : ℝ}
  (hctx : ShiftedQR.ShCtx L k ε H ss cg cr cw cp tv a s wg wr ww wp g thr f m) {ns w : ℕ}
  {lg : ℕ × ℕ} {LL : List (Option (List GivensEntry))}
  (hlog : HoldsSlottedLog lg ns w LL [] m.store) (hj : LL.length + 1 ≤ ns) (hw : k * n ≤ w)
  (hlgL : lg.1 < L) (hlgv : ∀ b ∈ [a, s, wg, wr, ww, wp, g, thr, f], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.shPrefix
    (Ops.Env.frame [n + 1, q, k, w, LL.length]
      [a, s, wg, (L, 0), (L + 1, 0), (L + 3, 0), (L + 4, 0), (L + 5, 0), (L + 6, 0), lg])
    (Ops.Store.inBlock (L + 1) 0 1 ⊔ Ops.Store.inBlock L 0 2 ⊔
        (Ops.Store.inBlock (L + 5) 0 (2 * ((n + 1) * (n + 1))) ⊔
              Ops.Store.inBlock (L + 6) 0 (2 * k) ⊔
            Ops.Store.inBlock (L + 3) 0 1 ⊔
          Ops.Store.inBlock (L + 4) 0 1) ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      ShiftedQR.ShCtx L k ε H ss cg cr cw cp tv a s wg wr ww wp g thr f m' ∧
        (∃ z, m'.store.readBlock L 0 2 = some [z.re, z.im]) ∧
          (∃ x, m'.store.get (L + 1) 0 = some x) ∧
            (∃ x, m'.store.get (L + 3) 0 = some x) ∧
              (∃ x, m'.store.get (L + 4) 0 = some x) ∧
                ∃ H',
                  HoldsMatrix (L + 5, 0) H' m'.store ∧
                    ∃ P, (∀ x ∈ P, x.1 + 1 < n + 1) ∧ HoldsSlottedLog lg ns w LL P m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedShTermination.