NLA-lib Explorer

NLAlib.ShiftedQR.regularizeWithScratchWith_pwrites

Library · theorem

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

Standard rounding

Regularize with a small-eigenvalue routine and scratch as a probabilistic block: NLAlib.ShiftedQR.regularizeWithScratchWith from the context NLAlib.ShiftedQR.RegularizeCtx with the routine's words stored below the scratch, apart from the shifts, ends in NLAlib.ShiftedQR.RegularizeOutcome except with probability at most \varphi_{\mathrm{se}} + \varphi/2: the routine (NLAlib.ShiftedQR.RandomSmallEigContractAt on orders at most k and norms at most \Sigma) fails with probability at most \varphi_{\mathrm{se}}, the k perturbations with probability at most \varphi/2, the rest is deterministic. Shared by the trees of NLAlib.ShiftedQR.shqrSmallEigRoutine, on their scratch.

NLAlib.ShiftedQR.regularizeWithScratchWith_pwrites {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 ℝ} {u : ℝ} (hI : I.IsMeasurable) {win : O → List ℕ → ℕ}
  (hloc : ∀ (o : O), I.TapeLocal o (win o)) (hS : Ops.IsScalar M I) (hM : Ops.StdModel u id M)
  (hu1 : u ≤ 1) (hL : Ops.IsIndexLit M I) {n : ℕ} (hNat : Ops.IsExactNatLit id M (n + 1))
  (hC : Ops.IsCmp id I) {law : ℕ → Measure ℝ} {s₀ : ℕ} {β φse : ℝ} (hβ0 : 0 ≤ β) (hφse : 0 ≤ φse)
  (hD : ShiftedQR.IsPolarDiskSampler s₀ I) (hU : law s₀ = ℙ.restrict (Set.Icc 0 1)) {k L : ℕ}
  (hk0 : 0 < k) (hk : k ≤ n) {a rd c thr s f : ℕ × ℕ}
  (hv : ShiftedQR.RegularizeViews L n k a rd c thr s f) {H V : Matrix (Fin (n + 1)) (Fin (n + 1)) ℂ}
  {e : Fin (n + 1) → ℂ} {B S ω R φ tv : ℝ} (hH : IsUpperHessenberg H) (hV : IsUnit V)
  (hHV : H * V = V * diagonal e) (hκ : pseudoConditionNumber V ≤ B) (hBk : B ^ (2 / ↑k) ≤ 2)
  (hω : 0 < ω) (hψ : ω ≤ hessenbergPotential k H) (hSH : specNorm H ≤ S)
  (hgap : ∀ (i j : Fin (n + 1)), i ≠ j → 2 * ω ^ 2 / S ≤ ‖e i - e j‖) (hR : 0 < R) (hφ : 0 < φ)
  (hφ1 : φ ≤ 1) (hβ : β + R + 2 * u * (S + β + R) ≤ ω ^ 2 / (20 * 101 * S))
  (hdη : 4 * u * (S + β + R) ≤ R * √(φ / (2 * ↑k))) (hnu : (↑n + 1) * u ≤ 1 / 2500)
  (huo :
    30000 * ↑k * (↑(n + 1) * √↑(n + 1) * u) * ((2 + 2 * 1.1) * S) ^ k ≤
      (1.01 * 0.998 ^ (-(↑k)⁻¹) * (2 * B ^ 4) ^ (2 * ↑k)⁻¹ * ω) ^ k)
  (huo1 : 100000 * ↑(n + 1 + k) ^ 2 * u ≤ 1)
  (hxu : 300 * (↑n + 1) ^ 2 * u ≤ (16 * B)⁻¹ * (R * √(φ / (2 * ↑k)) / 2 / ((2 + 2 * 1.1) * S)) ^ k)
  (hbound :
    (66 + 2 * 1.1) * B * S * ((2 + 2 * 1.1) * S / (R * √(φ / (2 * ↑k)) / 2)) ^ k * √(↑n + 1) *
        (300 * (↑n + 1) ^ 2 * u) ≤
      ω / 2)
  (hthrω : (1 + u) ^ 2 * ω ^ 2 ≤ tv) {nq T : ℕ} {qs : List ℝ} {SE : Ops.Stmt O Q}
  (hSE : ShiftedQR.RandomSmallEigContractAt law β φse k nq T S qs SE I) {qw : ℕ × ℕ}
  (hqL : qw.1 < L)
  (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))} (hj : LL.length + k ≤ ns)
  (hw : k * n ≤ w) (hlgL : lg.1 < L) (hlgv : ∀ b ∈ [a, rd, c, thr, qw, s, f], b.1 ≠ lg.1) :
  Ops.PWrites law 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 ↦
      ShiftedQR.RegularizeCtx L k H R
          (0.999 * (1.01 * 0.998 ^ (-(↑k)⁻¹) * (2 * B ^ 4) ^ (2 * ↑k)⁻¹) ^ k) tv a rd c thr s f m ∧
        m.store.readBlock qw.1 qw.2 qs.length = some qs ∧ HoldsSlottedLog lg ns w LL [] m.store)
    (ShiftedQR.RegularizeOutcome k H e u (1.01 * 0.998 ^ (-(↑k)⁻¹) * (2 * B ^ 4) ^ (2 * ↑k)⁻¹)
      (R * √(φ / (2 * ↑k)) / 2) tv ((1 + 1.1) * specNorm H * ((1 + 300 * (↑n + 1) ^ 2 * u) ^ k - 1))
      a s f lg ns w LL)
    (φse + φ / 2)

Full source on GitHub

Import NLAlib.Eigensolvers.ShiftedQR.RoundedRegularize.