NLA-lib Explorer

NLAlib.SpectralBisection.downLevelBody_kernelWeight_sum_le_of_exec

Library · theorem

Actual preparation and scan add exactly the same partition-sensitive upper bound as the scan alone. Scalar arithmetic and samples retain their independent full canonical charges.

NLAlib.SpectralBisection.downLevelBody_kernelWeight_sum_le_of_exec {K : Type} [Inhabited K]
  (M : Ops.Machine K) (dec : K → ℝ) (mm : MatMulMap (K × K)) (qr : QRMap (K × K))
  {I : Ops.Interp Ops.DenseOp (Ops.CmpTst ⊕ Ops.IdxTst) 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)
  (hSample : Ops.IsSample I) {τ : Ops.Tape K} {μ : Ops.Mem K} {n L fuel d : ℕ}
  {par lv su sg ma ua qa ea sz kd kp c t : ℕ × ℕ} (ks : ℕ → ℕ)
  (A : (lo : ℕ) → Matrix (Fin (ks lo)) (Fin (ks lo)) (K × K)) (R0 eps0 beta R eps : K)
  (hslot : ∀ lo < n, lo + ks lo ≤ n) (hexact : Ops.IsExactNatLit dec M (max n 4))
  (hsizes : ∀ lo < n, μ.store.get sz.1 (sz.2 + n * d + lo) = some (M.lit ↑(ks lo)))
  (hmat :
    ∀ lo < n,
      0 < ks lo →
        μ.store.readBlock ma.1 (ma.2 + 2 * (n * n) * d + 2 * n * lo) (2 * (ks lo * ks lo)) =
          some ((Ops.EntryCodec.pair K).packFinMatrix (A lo)))
  (hpar : μ.store.readBlock par.1 par.2 3 = some [R0, eps0, beta])
  (hlv : μ.store.readBlock lv.1 (lv.2 + 2 * d) 2 = some [R, eps])
  (hc :
    μ.store.readBlock c.1 c.2 5 =
      some [M.lit 1, M.lit 2, M.div (M.lit 1) (M.lit 2), M.neg (M.lit 1), M.sqrtHalf])
  (hG : SpectralBisection.DownLevelGeometry n d ks par lv su sg ma ua qa ea sz kd kp c t μ.store)
  (T : ℕ → ℕ) (W : Ops.DenseOp → List ℕ → ℕ) {a b : Ops.St Ops.DenseOp (Ops.CmpTst ⊕ Ops.IdxTst) K}
  (hmem : a.mem = μ)
  (hr :
    Ops.evalCounted I W τ (SpectralBisection.downLevelBody SpectralBisection.node)
        (Ops.Env.frame [n, L, fuel, d] [par, lv, su, sg, ma, ua, qa, ea, sz, kd, kp, c, t]) a =
      some b) :
  (Ops.Dense.kernelWeight T) b.cost ≤
    (Ops.Dense.kernelWeight T) a.cost + ∑ lo ∈ Finset.range n, (2 * fuel + 9) * T (ks lo)

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.DownLevelWork.