NLA-lib Explorer

NLAlib.ShiftedQR.trialStep_terminates

Library · theorem

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

The computation of one trial terminates 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 shift pair at S and any threshold word at Thr, k \le n, NLAlib.ShiftedQR.trialStep writes only the log and its four outputs and leaves the step stored at T and the scan flag stored in Rg. The views are live and have room; the four outputs are apart from the three inputs, the step T from SR, Ds and Rg, and SR from Ds.

NLAlib.ShiftedQR.trialStep_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 sp thr t sr ds rg : ℕ × ℕ}
  {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {r : ℂ} {tv : ℝ}
  (hl : m.Live [a, sp, thr, t, sr, ds, rg]) (hA : HoldsMatrix a H m.store)
  (hs : m.store.readBlock sp.1 sp.2 2 = some [r.re, r.im])
  (hthr : m.store.get thr.1 thr.2 = some tv) (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 sp.1 sp.2 2 ⊔
        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)))))
  {ns w : ℕ} {lg : ℕ × ℕ} {LL : List (Option (List GivensEntry))}
  (hlog : HoldsSlottedLog lg ns w LL [] m.store) (hj : LL.length < ns) (hw : k * n ≤ w)
  (hlgl : m.Live [lg]) (hlgb : ∀ b ∈ [a, sp, thr, t, sr, ds, rg], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.trialStep
    (Ops.Env.frame [n + 1, k, w, LL.length] [a, sp, thr, t, sr, ds, rg, lg])
    (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 t H' m'.store) ∧
        ∃ x,
          m'.store.get rg.1 (rg.2 + 3) = some x ∧
            ∃ es,
              es.length = k * n ∧
                (∀ x ∈ es, x.1 + 1 < n + 1) ∧ HoldsSlottedLog lg ns w LL es m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedRegularizeTermination.