NLA-lib Explorer

NLAlib.SpectralBisection.upNode_writes_splitResult

Library · theorem

A stored split returns its two projected child bases and shifted eigenvalues in the pure recursion's finite sum order. Actual metadata decoding, child reads, parent capacities and the common arena separation invariant suffice for total execution. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.upNode_writes_splitResult {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)
  (mm : MatMulMap (K × K)) (hMM : Ops.IsMatrixMul (Ops.EntryCodec.pair K) (fun {l m n} ↦ mm) I)
  {τ : Ops.Tape K} {m : Ops.Mem K} {n d lo k r : ℕ} {R sigma : K} {hr : r ≤ k}
  {ma ua qa ea sz kd kp t : ℕ × ℕ} {Qp : Matrix (Fin k) (Fin r) (K × K)}
  {Qm : Matrix (Fin k) (Fin (k - r)) (K × K)} {Ap : Matrix (Fin r) (Fin r) (K × K)}
  {Am : Matrix (Fin (k - r)) (Fin (k - r)) (K × K)}
  (cp : Matrix (Fin r) (Fin r) (K × K) × (Fin r → K))
  (cm : Matrix (Fin (k - r)) (Fin (k - r)) (K × K) × (Fin (k - r) → K))
  (hStep :
    SpectralBisection.StoresStep M R n d lo ma ua qa ea sz kd kp
      (EighStep.split r hr Qp Qm Ap Am sigma) m)
  (hChildP : SpectralBisection.StoresResult n (d + 1) lo ua ea cp m.store)
  (hChildM : SpectralBisection.StoresResult n (d + 1) (lo + r) ua ea cm m.store)
  (hLit : Ops.IsExactNatLit dec M (max n 4)) (hk : k ≤ n) (hl : m.Live [ua, qa, ea, kd, kp, t])
  (ht : m.store.get t.1 t.2 = some (M.div R (M.lit 2)))
  (hroom :
    m.Room (SpectralBisection.resultOperands n d lo ua ea) (SpectralBisection.resultLengths k))
  (hap :
    Ops.Fp.Apart (SpectralBisection.upNodeRegions n d lo ua qa ea kd kp t)
      (SpectralBisection.upNodeRegionLengths n k)) :
  have index := (finCongr ⋯).trans finSumFinEquiv.symm;
  Ops.Writes Ops.Mode.total I τ SpectralBisection.upNode
    (Ops.Env.frame [n, d, lo, k] [ua, qa, ea, kd, kp, t])
    (Ops.Fp.blocks (SpectralBisection.resultOperands n d lo ua ea)
      (SpectralBisection.resultLengths k))
    (fun m' ↦
      m'.pos = m.pos ∧
        SpectralBisection.StoresResult n d lo ua ea
          (((mm Qp cp.1).fromCols (mm Qm cm.1)).submatrix id ⇑index, fun i ↦
            ((fun j ↦ M.add (cp.2 j) sigma) ⊕ᵥ fun j ↦ M.sub (cm.2 j) sigma) (index i))
          m'.store)
    m

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.UpNodeSplit.