NLA-lib Explorer

NLAlib.SpectralBisection.upNode_writes_shift

Library · theorem

A one-child node returns its child basis and the actual scalar-shifted eigenvalues after reading the declared stored kind. All source reads, capacities and spatial assumptions are explicit; the selected implementation's correctness is discharged by its checked theorem. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.upNode_writes_shift {K 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 → ℝ} {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) (hQ : Ops.IsToNat dec I)
  {τ : Ops.Tape K} {m : Ops.Mem K} {n d lo k : ℕ} {ua qa ea kd kp t : ℕ × ℕ} (side : Bool)
  (U : Matrix (Fin k) (Fin k) (K × K)) (values : List K) (s w : K)
  (hl : m.Live [ua, qa, ea, kd, kp, t]) (hkind : m.store.get kd.1 (kd.2 + n * d + lo) = some w)
  (hdec : dec w = ↑(if side = true then 2 else 3))
  (hU :
    m.store.readBlock ua.1 (ua.2 + 2 * (n * n) * (d + 1) + 2 * n * lo) (2 * (k * k)) =
      some ((Ops.EntryCodec.pair K).packFinMatrix U))
  (hE : m.store.readBlock ea.1 (ea.2 + n * (d + 1) + lo) k = some values)
  (hs : m.store.get t.1 (t.2 + if side = true then 0 else 1) = some s)
  (hu : ua.2 + 2 * (n * n) * d + 2 * n * lo + 2 * (k * k) ≤ m.store.len ua.1)
  (he : ea.2 + n * d + lo + k ≤ m.store.len ea.1)
  (hap :
    Ops.Fp.Apart
      [(ua.1, ua.2 + 2 * (n * n) * d + 2 * n * lo), (ea.1, ea.2 + n * d + lo),
        (ua.1, ua.2 + 2 * (n * n) * (d + 1) + 2 * n * lo), (ea.1, ea.2 + n * (d + 1) + lo),
        (t.1, t.2 + if side = true then 0 else 1)]
      [2 * (k * k), k, 2 * (k * k), k, 1]) :
  Ops.Writes Ops.Mode.total I τ SpectralBisection.upNode
    (Ops.Env.frame [n, d, lo, k] [ua, qa, ea, kd, kp, t])
    (Ops.Fp.blocks [(ua.1, ua.2 + 2 * (n * n) * d + 2 * n * lo), (ea.1, ea.2 + n * d + lo)]
      [2 * (k * k), k])
    (fun m' ↦
      m'.pos = m.pos ∧
        m'.readBlocks [(ua.1, ua.2 + 2 * (n * n) * d + 2 * n * lo), (ea.1, ea.2 + n * d + lo)]
            [2 * (k * k), k] =
          some [(Ops.EntryCodec.pair K).packFinMatrix U, List.map (fun v ↦ M.add v s) values])
    m

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.UpDispatch.