NLA-lib Explorer

NLAlib.SpectralBisection.initializeArenas_writes

Library · theorem

Actual initialization returns the constant block, size slots, root matrix and root parameter pair, in execution order. It writes no cells outside these regions and preserves the random tape position. The input matrix is copied as stored, with no numerical assumptions. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.initializeArenas_writes {K Op Tst : Type} [Inhabited K]
  [Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.IndexOp Op] {M : Ops.Machine K} {I : Ops.Interp Op Tst K}
  (hS : Ops.IsScalar M I) (hIndex : Ops.IsIndexLit M I) {τ : Ops.Tape K} {n L : ℕ}
  {a par c ma sz lv : ℕ × ℕ} {m : Ops.Mem K} (xs : List K) (R eps : K)
  (hl : m.Live [a, par, c, ma, sz, lv])
  (hOut : Ops.Fp.Apart [c, sz, ma, lv] [5, n * (L + 2) + 1, 2 * (n * n), 2])
  (hIn :
    (Ops.Fp.blocks [c, sz, ma, lv] [5, n * (L + 2) + 1, 2 * (n * n), 2]).Disj
      (Ops.Fp.blocks [a, par] [2 * (n * n), 2]))
  (hA : m.store.readBlock a.1 a.2 (2 * (n * n)) = some xs)
  (hPar : m.store.readBlock par.1 par.2 2 = some [R, eps]) (hc : c.2 + 5 ≤ m.store.len c.1)
  (hma : ma.2 + 2 * (n * n) ≤ m.store.len ma.1) (hsz : sz.2 + (n * (L + 2) + 1) ≤ m.store.len sz.1)
  (hlv : lv.2 + 2 ≤ m.store.len lv.1) :
  Ops.Writes Ops.Mode.total I τ SpectralBisection.initializeArenas
    (Ops.Env.frame [n, L] [a, par, c, ma, sz, lv])
    (Ops.Fp.blocks [c, sz, ma, lv] [5, n * (L + 2) + 1, 2 * (n * n), 2])
    (fun μ ↦
      μ.pos = m.pos ∧
        μ.readBlocks [c, sz, ma, lv] [5, n * (L + 2) + 1, 2 * (n * n), 2] =
          some
            [[M.lit 1, M.lit 2, M.div (M.lit 1) (M.lit 2), M.neg (M.lit 1),
                M.sqrt (M.div (M.lit 1) (M.lit 2))],
              List.map (fun i ↦ if i = 0 then M.lit ↑n else M.lit 0) (List.range (n * (L + 2) + 1)),
              xs, [R, eps]])
    m

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.Initialization.