NLA-lib Explorer

NLAlib.SpectralBisection.storesLevel_succ_of_downFrame

Library · theorem

Exact scan writes preserve unoccupied size words and establish the complete next level. The scratch footprint may include the parameter update and the two sampled batches.

NLAlib.SpectralBisection.storesLevel_succ_of_downFrame {K : Type} [Inhabited K] (M : Ops.Machine K)
  (dec : K → ℝ) (mm : MatMulMap (K × K)) (qr : QRMap (K × K)) (n base : ℕ) (τ : Ops.Tape K)
  (fuel : ℕ) (R0 eps beta : K) (ell : ℕ) (A : Matrix (Fin n) (Fin n) (K × K)) (d : ℕ)
  (ma ua qa ea sz kd kp lv : ℕ × ℕ) (scratch : Ops.Fp) (before after : Ops.Mem K)
  (hRecords :
    SpectralBisection.StoresRecords M
      (SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ) n fuel R0
      beta { k := n, A := A, R := R0, ε := eps, ℓ := ell } d ma ua qa ea sz kd kp after)
  (hZero : ∀ j < n, before.store.get sz.1 (sz.2 + n * (d + 1) + j) = some (M.lit 0))
  (hParams :
    after.store.readBlock lv.1 (lv.2 + 2 * (d + 1)) 2 =
      some
        [(eighLevelParams
              (SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ) R0
              eps ell (d + 1)).1,
          (eighLevelParams
              (SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ) R0
              eps ell (d + 1)).2])
  (hAP :
    Ops.Fp.Apart (List.ofFn (SpectralBisection.downArenaOrigins n d ma ua qa ea sz kd kp))
      (List.ofFn fun i ↦ SpectralBisection.downArenaStride n i * n))
  (hScratch : scratch.Disj (Ops.Store.inBlock sz.1 (sz.2 + n * (d + 1)) n)) :
  have F := SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ;
  have x := fun lo ↦
    SpectralBisection.nodeAtSlot F n fuel R0 beta { k := n, A := A, R := R0, ε := eps, ℓ := ell } d
      lo;
  have p := eighLevelParams F R0 eps ell d;
  Ops.Store.EqOff
      (Ops.Fp.loopPrefix
          (fun lo ↦
            SpectralBisection.activeStepFp n d lo ma ua qa ea sz kd kp
              (eighStep
                (M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) M.mul fun z ↦
                  M.normalWords z.1 z.2)
                n fuel R0 beta (x lo).A p.1 p.2 (ell + d)
                (SpectralBisection.storedNodeSample n lo
                  (Ops.vec (SpectralBisection.levelUniformWords n base τ d) lo)
                  (SpectralBisection.levelGaussianMatrix n base τ d))))
          n ⊔
        scratch)
      before.store after.store →
    SpectralBisection.StoresLevel M F n fuel R0 beta { k := n, A := A, R := R0, ε := eps, ℓ := ell }
      (d + 1) ma sz lv after

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.DownLevelRecords.