NLA-lib Explorer

NLAlib.SpectralBisection.nodeBranch_writes

Library · theorem

The three explicit dispatch loops execute exactly the selected child or split and store its entire mathematical outcome. Every premise is a primitive contract or a condition on actual readable inputs, writable outputs and their spatial separation. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.nodeBranch_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.MatrixOp Op] {M : Ops.Machine K} (dec : K → ℝ)
  (mm : MatMulMap (K × K)) (qr : QRMap (K × K)) {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I)
  (hL : Ops.IsIndexLit M I) (hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I)
  (hQR : Ops.IsMatrixQR (Ops.EntryCodec.pair K) (fun {m n} ↦ qr) I) {τ : Ops.Tape K} {μ : Ops.Mem K}
  {n d lo k kp : ℕ} {sg pp pm ma ua qa ea sz kd ks c t : ℕ × ℕ} (S : ℕ → ℕ → K × K)
  (Pp Pm A : Matrix (Fin k) (Fin k) (K × K)) (R : K) (hk : 0 < k) (hkp : kp ≤ k)
  (hslot : lo + k ≤ n) (hl : μ.Live [sg, pp, pm, ma, qa, sz, kd, ks, c, t])
  (hread :
    μ.readBlocks (SpectralBisection.splitInputs n d lo sg pp pm ma c t)
        (SpectralBisection.splitInputLengths n k) =
      some
        [(Ops.EntryCodec.pair K).packMatrix n (2 * n) S, (Ops.EntryCodec.pair K).packFinMatrix Pp,
          (Ops.EntryCodec.pair K).packFinMatrix Pm, (Ops.EntryCodec.pair K).packFinMatrix A,
          [M.lit 2], [M.sqrtHalf], [M.div R (M.lit 2)], [M.neg (M.div R (M.lit 2))]]) :
  have step :=
    SpectralBisection.branchOutcome M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) lo R S A Pp Pm kp hkp;
  μ.Room (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd ks step)
      (SpectralBisection.stepOutputLengths step) →
    Ops.Fp.Apart (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd ks step)
        (SpectralBisection.stepOutputLengths step) →
      (Ops.Fp.blocks (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd ks step)
              (SpectralBisection.stepOutputLengths step)).Disj
          (Ops.Fp.blocks (SpectralBisection.splitInputs n d lo sg pp pm ma c t)
            (SpectralBisection.splitInputLengths n k)) →
        Ops.Writes Ops.Mode.total I τ SpectralBisection.nodeBranch
          (Ops.Env.frame [n, d, lo, k, kp] [sg, pp, pm, ma, qa, sz, kd, ks, c, t])
          (Ops.Fp.blocks (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd ks step)
            (SpectralBisection.stepOutputLengths step))
          (fun μ' ↦
            μ'.pos = μ.pos ∧ SpectralBisection.StoresStep M R n d lo ma ua qa ea sz kd ks step μ')
          μ

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.NodeOutput.