NLA-lib Explorer

NLAlib.ShiftedQR.shIteration_terminates

Library · theorem

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

One iteration terminates on any matrix: on a scalar machine with exact comparisons, index literals, index conversion and exact natural literals up to n + 1, a SmallEig kernel meeting NLAlib.ShiftedQR.IsRandomSmallEig and an exact polar sampler, for k = 2^q \le n, from any matrix of order n + 1 at a, any words at rd, c, thr, wg, wr, ww, wp, the net words of NLAlib.ShiftedQR.excNet ε at g and room for the flag, the matrix and the flag apart from each other and from the inputs, NLAlib.ShiftedQR.shIteration (Regularize, then Sh) writes only the matrix and the flag and leaves both stored, on every tape.

NLAlib.ShiftedQR.shIteration_terminates {O Q : Type} [Ops.Has Ops.ScalarOp O]
  [Ops.Has Ops.IndexOp O] [Ops.Has ShiftedQR.EigenvalueKernelOp O]
  [Ops.Has ShiftedQR.DiskSampleOp 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)
  {law : ℕ → Measure ℝ} {s₀ : ℕ} {β φse : ℝ} (hSE : ShiftedQR.IsRandomSmallEig law s₀ β φse I)
  (hD : ShiftedQR.IsPolarDiskSampler s₀ I) {τ : Ops.Tape ℝ} {m : Ops.Mem ℝ} {k q : ℕ}
  (hkq : k = 2 ^ q) (hkn : k ≤ n) {ε : ℝ} {a rd c thr wg wr ww wp g f : ℕ × ℕ}
  (haf :
    Ops.Fp.Disj (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1)))) (Ops.Store.inBlock f.1 f.2 1))
  (hio :
    (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock f.1 f.2 1).Disj
      (Ops.Store.inBlock rd.1 rd.2 1 ⊔ Ops.Store.inBlock c.1 c.2 1 ⊔
                  Ops.Store.inBlock thr.1 thr.2 1 ⊔
                Ops.Store.inBlock wg.1 wg.2 1 ⊔
              Ops.Store.inBlock wr.1 wr.2 1 ⊔
            Ops.Store.inBlock ww.1 ww.2 1 ⊔
          Ops.Store.inBlock wp.1 wp.2 1 ⊔
        Ops.Store.inBlock g.1 g.2 (2 * (ShiftedQR.excNet ε).length)))
  {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ} {R cv tv cg cr cw cp : ℝ}
  (hl : m.Live [a, rd, c, thr, wg, wr, ww, wp, g, f]) (hA : HoldsMatrix a H m.store)
  (hrd : m.store.get rd.1 rd.2 = some R) (hc : m.store.get c.1 c.2 = some cv)
  (hthr : m.store.get thr.1 thr.2 = some tv) (hwg : m.store.get wg.1 wg.2 = some cg)
  (hwr : m.store.get wr.1 wr.2 = some cr) (hww : m.store.get ww.1 ww.2 = some cw)
  (hwp : m.store.get wp.1 wp.2 = some cp)
  (hg :
    m.store.readBlock g.1 g.2 (2 * (ShiftedQR.excNet ε).length) =
      some (List.flatMap (fun z ↦ [z.re, z.im]) (ShiftedQR.excNet ε)))
  (hrf : f.2 < m.store.len f.1) {ns w : ℕ} {lg : ℕ × ℕ} {LL : List (Option (List GivensEntry))}
  (hlog : HoldsSlottedLog lg ns w LL [] m.store)
  (hj : LL.length + (k + 1 + (ShiftedQR.excNet ε).length) ≤ ns) (hw : k * n ≤ w)
  (hlgl : m.Live [lg]) (hlgv : ∀ b ∈ [a, rd, c, thr, wg, wr, ww, wp, g, f], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ ShiftedQR.shIteration
    (Ops.Env.frame [n + 1, q, k, (ShiftedQR.excNet ε).length, w, LL.length]
      [a, rd, c, thr, wg, wr, ww, wp, g, a, f, lg])
    (Ops.Store.inBlock a.1 a.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock f.1 f.2 1 ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * w)))
    (fun m' ↦
      (∃ H', HoldsMatrix a H' m'.store) ∧
        ∃ x,
          m'.store.get f.1 f.2 = some x ∧
            ∃ Ls P',
              Ls.length ≤ k + 1 + (ShiftedQR.excNet ε).length ∧
                (∀ x ∈ slotEntries w Ls ++ P', x.1 + 1 < n + 1) ∧
                  HoldsSlottedLog lg ns w (LL ++ Ls) P' m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedDecoupleTermination.