NLA-lib Explorer

NLAlib.SpectralBisection.downNode_writes

Library · theorem

Every active slot returns the existing mathematical step, including both leaf cases and all nonleaf outcomes. Writable geometry and operation contracts replace success-only premises. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.downNode_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 kp c t : ℕ × ℕ} (R0 beta R eps U : K) (S : ℕ → ℕ → K × K)
  (A : Matrix (Fin k) (Fin k) (K × K)) (hk : 0 < k) (hslot : lo + k ≤ n)
  (hexact : Ops.IsExactNatLit dec M (max k 4))
  (hl : μ.Live [par, lv, su, sg, ma, ua, qa, ea, sz, kd, kp, c, t])
  (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))
  (ht : t.2 + 5 ≤ μ.store.len t.1)
  (hprotect :
    Ops.Fp.Disj (Ops.Store.inBlock t.1 (t.2 + 4) 1)
      (Ops.Fp.blocks (SpectralBisection.nodeInputs n d lo par lv su sg ma c)
        (SpectralBisection.nodeInputLengths n k)))
  (hleaf :
    μ.Room
        [(ua.1, ua.2 + 2 * (n * n) * d + 2 * n * lo), (ea.1, ea.2 + n * d + lo),
          (kd.1, kd.2 + n * d + lo)]
        [2 * (k * k), k, 1] ∧
      Ops.Fp.Apart
          [(ua.1, ua.2 + 2 * (n * n) * d + 2 * n * lo), (ea.1, ea.2 + n * d + lo),
            (kd.1, kd.2 + n * d + lo)]
          [2 * (k * k), k, 1] ∧
        (Ops.Fp.blocks
              [(ua.1, ua.2 + 2 * (n * n) * d + 2 * n * lo), (ea.1, ea.2 + n * d + lo),
                (kd.1, kd.2 + n * d + lo)]
              [2 * (k * k), k, 1]).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 kp)
          (SpectralBisection.branchLengths k r) ∧
        Ops.Fp.Apart (SpectralBisection.branchOutputs n d lo k r ma qa sz kd kp)
            (SpectralBisection.branchLengths k r) ∧
          (Ops.Fp.blocks (SpectralBisection.branchOutputs n d lo k r ma qa sz kd kp)
                (SpectralBisection.branchLengths k r)).Disj
            (Ops.Fp.blocks (SpectralBisection.nodeInputs n d lo par lv su sg ma c)
              (SpectralBisection.nodeInputLengths n k))) :
  have N :=
    M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) M.mul fun z ↦ M.normalWords z.1 z.2;
  have outcome :=
    eighStep N n fuel R0 beta A R eps (L + d) (SpectralBisection.storedNodeSample n lo U S);
  Ops.Writes Ops.Mode.total I τ (SpectralBisection.downNode SpectralBisection.node)
    (Ops.Env.frame [n, L, fuel, d, lo, k] [par, lv, su, sg, ma, ua, qa, ea, sz, kd, kp, c, t])
    (Ops.Fp.blocks (SpectralBisection.stepOutputs n d lo ma ua qa ea sz kd kp outcome)
        (SpectralBisection.stepOutputLengths outcome) ⊔
      Ops.Store.inBlock t.1 (t.2 + 4) 1)
    (fun μ' ↦
      μ'.pos = μ.pos ∧ SpectralBisection.StoresStep M R n d lo ma ua qa ea sz kd kp outcome μ')
    μ

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.DownNode.