NLA-lib Explorer

NLAlib.ShiftedQR.regularizeWithScratchWith_terminates

Library · theorem

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

Regularize with a small-eigenvalue routine and scratch terminates on any matrix: with the views NLAlib.ShiftedQR.RegularizeViews and the context NLAlib.ShiftedQR.RegularizeCtx (any matrix of order n + 1, any words), k \le n, a routine that terminates on orders at most k (NLAlib.ShiftedQR.TerminatingSmallEigAt) with its words stored below the scratch, apart from the shifts, and an exact polar sampler, on a scalar machine with exact comparisons, index literals and exact natural literals up to n + 1, NLAlib.ShiftedQR.regularizeWithScratchWith writes only the log and the matrix, the k output pairs, the flag and the scratch above L, and leaves the matrix, the pairs and the flag stored.

NLAlib.ShiftedQR.regularizeWithScratchWith_terminates {O Q : Type} [Ops.Has Ops.ScalarOp O]
  [Ops.Has Ops.IndexOp O] [Ops.Has ShiftedQR.DiskSampleOp O] [Ops.Has Ops.CmpTst Q]
  {M : Ops.Machine ℝ} {I : Ops.Interp O Q ℝ} (hS : Ops.IsScalar M I) (hL : Ops.IsIndexLit M I)
  {n : ℕ} (hNat : Ops.IsExactNatLit id M (n + 1)) (hC : Ops.IsCmp id I) {s₀ : ℕ}
  (hD : ShiftedQR.IsPolarDiskSampler s₀ I) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {k L : ℕ} (hk : k ≤ n)
  {a rd c thr s f : ℕ × ℕ} (hv : ShiftedQR.RegularizeViews L n k a rd c thr s f)
  {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {R cw tv : ℝ}
  (hctx : ShiftedQR.RegularizeCtx L k H R cw tv a rd c thr s f m) {nq T : ℕ} {qs : List ℝ}
  {SE : Ops.Stmt O Q} (hSE : ShiftedQR.TerminatingSmallEigAt k nq T qs SE I) {qw : ℕ × ℕ}
  (hqL : qw.1 < L) (hq : m.store.readBlock qw.1 qw.2 qs.length = some qs)
  (hqw : Ops.Fp.Disj (Ops.Store.inBlock s.1 s.2 (2 * k)) (Ops.Store.inBlock qw.1 qw.2 qs.length))
  {ns w : ℕ} {lg : ℕ × ℕ} {LL : List (Option (List GivensEntry))}
  (hlog : HoldsSlottedLog lg ns w LL [] m.store) (hj : LL.length + k ≤ ns) (hw : k * n ≤ w)
  (hlgl : m.Live [lg]) (hlgL : lg.1 < L) (hlgv : ∀ b ∈ [a, rd, c, thr, qw, s, f], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ (ShiftedQR.regularizeWithScratchWith SE)
    (Ops.Env.frame [n + 1, k, nq, T, w, LL.length]
      [a, rd, c, thr, qw, (L, 0), (L + 1, 0), (L + 2, 0), (L + 3, 0), (L + 4, 0), (L + 5, 0),
        (L + 6, 0), a, s, f, lg])
    (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock s.1 s.2 (2 * k) ⊔
          Ops.Store.inBlock f.1 f.2 1 ⊔
        Ops.Fp.above L ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      (∃ H', HoldsMatrix a H' m'.store) ∧
        (∃ ys, m'.store.readBlock s.1 s.2 (2 * k) = some ys) ∧
          ∃ x,
            m'.store.get f.1 f.2 = some x ∧
              ∃ Ls,
                Ls.length = k ∧
                  (∀ x ∈ slotEntries w Ls, x.1 + 1 < n + 1) ∧
                    HoldsSlottedLog lg ns w (LL ++ Ls) [] m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedRegularizeTermination.