NLA-lib Explorer

NLAlib.ShiftedQR.roundedDecoupleLoopWith_terminates

Library · theorem

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

The decoupling loop 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, with parameter words ps of length 10 + 2\lvert\mathrm{net}\rvert whose words from offset 10 are the net NLAlib.ShiftedQR.excNet ε (the layout of NLAlib.ShiftedQR.roundedDecoupleParams), from the operands of the loop NLAlib.ShiftedQR.DecoupleLoopCtx and any matrix at w, NLAlib.ShiftedQR.roundedDecoupleLoopWith with a routine that terminates on orders at most k with the word count 12 and the words qs (none, or the last 12 parameter words) writes only the matrix, the flag and its registers and leaves the matrix and the flag stored.

NLAlib.ShiftedQR.roundedDecoupleLoopWith_terminates {O Q : Type} [Ops.Has Ops.ScalarOp O]
  [Ops.Has Ops.IndexOp 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) {s₀ : ℕ} (hD : ShiftedQR.IsPolarDiskSampler s₀ I) {τ : Ops.Tape ℝ}
  {μ : Ops.Mem ℝ} {k q F L T : ℕ} (hkq : k = 2 ^ q) (hkn : k ≤ n) {ε : ℝ} {w p f : ℕ × ℕ}
  {ps qs : List ℝ} {SE : Ops.Stmt O Q} (hSE : ShiftedQR.TerminatingSmallEigAt k 12 T qs SE I)
  (hq12 : qs = [] ∨ qs.length = 12)
  (hlen : ps.length = 10 + 2 * (ShiftedQR.excNet ε).length + qs.length)
  (hnet : List.drop 10 ps = List.flatMap (fun z ↦ [z.re, z.im]) (ShiftedQR.excNet ε) ++ qs)
  (hctx : ShiftedQR.DecoupleLoopCtx n L w p f ps μ) {H : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ}
  (hW : HoldsMatrix w H μ.store) {ns ws : ℕ} {lg : ℕ × ℕ}
  (hlog : HoldsSlottedLog lg ns ws [] [] μ.store)
  (hj : F * (k + 1 + (ShiftedQR.excNet ε).length) ≤ ns) (hw : k * n ≤ ws) (hlgl : μ.Live [lg])
  (hlgL : lg.1 < L) (hlgv : ∀ b ∈ [w, p, f], b.1 ≠ lg.1) :
  Ops.Writes Ops.Mode.total I τ (ShiftedQR.roundedDecoupleLoopWith SE)
    (Ops.Env.frame [n + 1, k, ps.length, F, T, q, (ShiftedQR.excNet ε).length, ws]
      [w, p, (L, 0), w, f, lg])
    (Ops.Store.inBlock w.1 w.2 (2 * ((n + 1) * (n + 1))) ⊔ Ops.Store.inBlock f.1 f.2 1 ⊔
        Ops.Store.inBlock L 0 5 ⊔
      Ops.Store.inBlock lg.1 lg.2 (ns * (1 + 5 * ws)))
    (fun μ' ↦
      (∃ x, μ'.store.get f.1 f.2 = some x) ∧
        ∃ H',
          HoldsMatrix w H' μ'.store ∧
            ∃ Ls P',
              Ls.length ≤ ns ∧
                (∀ x ∈ slotEntries ws Ls ++ P', x.1 + 1 < n + 1) ∧
                  HoldsSlottedLog lg ns ws Ls P' μ'.store)
    μ

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedDecoupleTermination.