NLA-lib Explorer

NLAlib.SpectralBisection.upLevel_writes

Library · theorem

One actual upward level returns every mathematically assembled node result. The stored radius and literal two determine its shifts through the scalar machine. All remaining hypotheses concern actual node/child reads, decoded size bounds, output capacity and spatial separation. Scratch is freshly allocated and removed, and the tape position is unchanged. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.upLevel_writes {K Su Sg Op Tst : Type} [Inhabited K]
  [Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.MatrixOp Op] [Ops.Has Ops.IdxTst Tst] {M : Ops.Machine K}
  {dec : K → ℝ} (mm : MatMulMap (K × K)) (qr : QRMap (K × K)) (unif : K → Su → K)
  (normal : Sg → K × K) {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) (hQ : Ops.IsToNat dec I)
  (hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I) {τ : Ops.Tape K}
  {m : Ops.Mem K} {n d : ℕ} {R : K} {ma lv ua qa ea sz kd kp c : ℕ × ℕ} (ks : ℕ → ℕ) (ws : ℕ → K)
  (steps : (lo : ℕ) → EighStep K (ks lo))
  (children :
    (lo : ℕ) →
      (b : Bool) →
        Matrix (Fin ((steps lo).childSize b)) (Fin ((steps lo).childSize b)) (K × K) ×
          (Fin ((steps lo).childSize b) → K))
  (hl : m.Live [lv, ua, qa, ea, sz, kd, kp, c, ma]) (hR : m.store.get lv.1 (lv.2 + 2 * d) = some R)
  (hTwo : m.store.get c.1 (c.2 + 1) = some (M.lit 2))
  (hSizes : m.store.HoldsVec sz.1 (sz.2 + n * d) n ws) (hDecode : ∀ lo < n, dec (ws lo) = ↑(ks lo))
  (hBound : ∀ lo < n, ks lo ≤ n - lo)
  (hSteps :
    ∀ lo < n, 0 < ks lo → SpectralBisection.StoresStep M R n d lo ma ua qa ea sz kd kp (steps lo) m)
  (hChildren :
    ∀ lo < n,
      0 < ks lo →
        ∀ (b : Bool),
          (steps lo).HasChild b →
            SpectralBisection.StoresResult n (d + 1) ((steps lo).childSlot lo b) ua ea
              (children lo b) m.store)
  (hLit : Ops.IsExactNatLit dec M (max n 4))
  (hRoom :
    ∀ lo < n,
      m.Room (SpectralBisection.resultOperands n d lo ua ea)
        (SpectralBisection.resultLengths (ks lo)))
  (hApart :
    ∀ lo < n,
      Ops.Fp.Apart (SpectralBisection.upNodeRegions n d lo ua qa ea kd kp (List.length m.store, 0))
        (SpectralBisection.upNodeRegionLengths n (ks lo)))
  (hDisj :
    ∀ lo < n,
      ∀ j < n,
        lo ≠ j →
          (Ops.Fp.blocks (SpectralBisection.resultOperands n d lo ua ea)
                (SpectralBisection.resultLengths (ks lo))).Disj
            (Ops.Fp.blocks (SpectralBisection.resultOperands n d j ua ea)
              (SpectralBisection.resultLengths (ks j))))
  (hSizesProtect :
    (SpectralBisection.resultLevelFootprint n d ks ua ea).Disj
      (Ops.Store.inBlock sz.1 (sz.2 + n * d) n))
  (hForward :
    ∀ (j lo : ℕ),
      j < lo →
        lo < n →
          0 < ks lo →
            (Ops.Fp.blocks (SpectralBisection.resultOperands n d j ua ea)
                  (SpectralBisection.resultLengths (ks j))).Disj
              (Ops.Fp.blocks (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd kp (steps lo))
                (SpectralBisection.stepOutputLengths (steps lo))))
  (hChildProtect :
    ∀ lo < n,
      ∀ (b : Bool),
        (steps lo).HasChild b →
          (SpectralBisection.resultLevelFootprint n d ks ua ea).Disj
            (Ops.Fp.blocks
              (SpectralBisection.resultOperands n (d + 1) ((steps lo).childSlot lo b) ua ea)
              (SpectralBisection.resultLengths ((steps lo).childSize b)))) :
  Ops.Writes Ops.Mode.total I τ SpectralBisection.upLevel
    (Ops.Env.frame [n, d] [lv, ua, qa, ea, sz, kd, kp, c])
    (SpectralBisection.resultLevelFootprint n d ks ua ea)
    (fun m' ↦
      m'.pos = m.pos ∧
        ∀ lo < n,
          SpectralBisection.StoresResult n d lo ua ea
            (EighStep.assemble
              (M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) unif normal) (steps lo)
              (children lo))
            m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.UpLevel.