NLA-lib Explorer

NLAlib.SpectralBisection.nodeBody_writes

Library · theorem

A nonleaf node executes totally and stores exactly the existing mathematical step on its actual inputs. All bounded split cases have sufficient separated output capacity. No scratch initialization, numerical-accuracy or successful-run premise is assumed. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.nodeBody_writes {K Op Tst : Type} [Inhabited K] [Ops.Has Ops.ScalarOp Op]
  [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.MatrixOp Op] [Ops.Has Ops.CmpTst Tst]
  [Ops.Has Ops.IdxTst Tst] (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)
  (hC : Ops.IsCmp dec 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) (hQ : Ops.IsToNat dec I)
  {τ : Ops.Tape K} {μ : Ops.Mem K} {n L fuel d lo k : ℕ}
  {par lv su sg ma ua qa ea sz kd ks c t sp w b tm pp pm : ℕ × ℕ} (R0 beta R eps U : K)
  (S : ℕ → ℕ → K × K) (A : Matrix (Fin k) (Fin k) (K × K)) (hk : 2 ≤ k) (hslot : lo + k ≤ n)
  (hactive : ¬dec R ≤ dec (M.mul eps R0)) (hexact : Ops.IsExactNatLit dec M (max k 4))
  (hl : μ.Live [par, lv, su, sg, ma, qa, sz, kd, ks, c, t, sp, w, b, tm, pp, pm])
  (hread :
    μ.readBlocks (SpectralBisection.nodeInputs n d lo par lv su sg ma c)
        (SpectralBisection.nodeInputLengths n k) =
      some (SpectralBisection.nodeInputWords M n R0 beta R eps U S A))
  (hsroom : μ.Room [t, sp, w, b, tm, pp, pm] (SpectralBisection.nodeScratchLengths k))
  (hsap : Ops.Fp.Apart [t, sp, w, b, tm, pp, pm] (SpectralBisection.nodeScratchLengths k))
  (hsprotect :
    (Ops.Fp.blocks [t, sp, w, b, tm, pp, pm] (SpectralBisection.nodeScratchLengths k)).Disj
      (Ops.Fp.blocks (SpectralBisection.nodeInputs n d lo par lv su sg ma c)
        (SpectralBisection.nodeInputLengths n k)))
  (houtputs :
    ∀ r ≤ k,
      μ.Room (SpectralBisection.branchOutputs n d lo k r ma qa sz kd ks)
          (SpectralBisection.branchLengths k r) ∧
        Ops.Fp.Apart (SpectralBisection.branchOutputs n d lo k r ma qa sz kd ks)
            (SpectralBisection.branchLengths k r) ∧
          (Ops.Fp.blocks (SpectralBisection.branchOutputs n d lo k r ma qa sz kd ks)
                (SpectralBisection.branchLengths k r)).Disj
            (Ops.Fp.blocks (SpectralBisection.nodeInputs n d lo par lv su sg ma c)
                (SpectralBisection.nodeInputLengths n k) ⊔
              Ops.Fp.blocks [t, sp, w, b, tm, pp, pm] (SpectralBisection.nodeScratchLengths k))) :
  have F :=
    M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) M.mul fun z ↦ M.normalWords z.1 z.2;
  have step :=
    eighStep F n fuel R0 beta A R eps (L + d) (SpectralBisection.storedNodeSample n lo U S);
  Ops.Writes Ops.Mode.total I τ SpectralBisection.nodeBody
    (Ops.Env.frame [n, L, fuel, d, lo, k]
      [par, lv, su, sg, ma, qa, sz, kd, ks, c, t, sp, w, b, tm, pp, pm])
    (Ops.Fp.blocks (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd ks step)
        (SpectralBisection.stepOutputLengths step) ⊔
      Ops.Fp.blocks [t, sp, w, b, tm, pp, pm] (SpectralBisection.nodeScratchLengths k))
    (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.NodeTotal.