NLA-lib Explorer

NLAlib.ShiftedQR.regularizeTrials_terminates

Library · theorem

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

The trials of Regularize terminate on any matrix: on a scalar machine with exact comparisons, index literals and exact natural literals up to n + 1, from any matrix of order n + 1 at A, any 2k shift words at S, any threshold word at Thr and any words at G and Fl, k \le n, with live views, room for the scratch T, SR, Ds, Rg, the scratch apart from the inputs, T from SR, Ds and Rg, SR from Ds, G, Fl apart from each other, from the scratch and from the matrix, and the matrix, G and Fl apart from S and Thr, NLAlib.ShiftedQR.regularizeTrials leaves the matrix, G and Fl stored.

NLAlib.ShiftedQR.regularizeTrials_terminates {O Q : Type} [Ops.Has Ops.ScalarOp O]
  [Ops.Has Ops.IndexOp 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) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {k : ℕ} (hk : k ≤ n)
  {a s thr t sr ds rg g f : ℕ × ℕ} {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {xs : List ℝ}
  {tv gv fv : ℝ} (hl : m.Live [a, s, thr, t, sr, ds, rg, a, g, f]) (hA : HoldsMatrix a H m.store)
  (hs : m.store.readBlock s.1 s.2 (2 * k) = some xs) (hthr : m.store.get thr.1 thr.2 = some tv)
  (hg : m.store.get g.1 g.2 = some gv) (hf : m.store.get f.1 f.2 = some fv)
  (hrt : t.2 + 2 * ((n + 1) * (n + 1)) ≤ m.store.len t.1) (hrsr : sr.2 + 2 * k ≤ m.store.len sr.1)
  (hrds : ds.2 + 2 * k ≤ m.store.len ds.1) (hrrg : rg.2 + 5 ≤ m.store.len rg.1)
  (hW :
    (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock sr.1 sr.2 (2 * k) ⊔
            Ops.Store.inBlock ds.1 ds.2 (2 * k) ⊔
          Ops.Store.inBlock rg.1 rg.2 5).Disj
      (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock s.1 s.2 (2 * k) ⊔
        Ops.Store.inBlock thr.1 thr.2 1))
  (hts :
    Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock sr.1 sr.2 (2 * k)))
  (htd :
    Ops.Fp.Disj (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))))
      (Ops.Store.inBlock ds.1 ds.2 (2 * k)))
  (hsd : Ops.Fp.Disj (Ops.Store.inBlock sr.1 sr.2 (2 * k)) (Ops.Store.inBlock ds.1 ds.2 (2 * k)))
  (hrg :
    Ops.Fp.Disj (Ops.Store.inBlock rg.1 rg.2 5)
      (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1)))))
  (hGF :
    (Ops.Store.inBlock g.1 g.2 1 ⊔ Ops.Store.inBlock f.1 f.2 1).Disj
      (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock sr.1 sr.2 (2 * k) ⊔
            Ops.Store.inBlock ds.1 ds.2 (2 * k) ⊔
          Ops.Store.inBlock rg.1 rg.2 5 ⊔
        Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1)))))
  (hgf : Ops.Fp.Disj (Ops.Store.inBlock g.1 g.2 1) (Ops.Store.inBlock f.1 f.2 1))
  (hAS :
    (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock g.1 g.2 1 ⊔
          Ops.Store.inBlock f.1 f.2 1).Disj
      (Ops.Store.inBlock s.1 s.2 (2 * k) ⊔ Ops.Store.inBlock thr.1 thr.2 1))
  {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]) (hlgb : ∀ b ∈ [a, s, thr, t, sr, ds, rg, g, f], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.regularizeTrials
    (Ops.Env.frame [n + 1, k, w, LL.length] [a, s, thr, t, sr, ds, rg, a, g, f, lg])
    (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock g.1 g.2 1 ⊔
          Ops.Store.inBlock f.1 f.2 1 ⊔
        (Ops.Store.inBlock t.1 t.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock sr.1 sr.2 (2 * k) ⊔
            Ops.Store.inBlock ds.1 ds.2 (2 * k) ⊔
          Ops.Store.inBlock rg.1 rg.2 5) ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      (∃ H', HoldsMatrix a H' m'.store) ∧
        (∃ x, m'.store.get g.1 g.2 = some x) ∧
          ∃ 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.