NLA-lib Explorer

NLAlib.SpectralBisection.downwardPass_writes_of_arenas

Library · theorem

The eleven allocated arena capacities and separation imply total correctness of the complete downward traversal. Every local node and fresh-scratch obligation is derived from this layout; no per-level execution or geometry callback is assumed. A fragment of NLAlib.SpectralBisection.bisectionRoutine.

NLAlib.SpectralBisection.downwardPass_writes_of_arenas {K Op Tst : Type} [Inhabited K]
  [Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.SampleOp 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}
  {τ : Ops.Tape K} {μ : Ops.Mem K} {n L fuel base : ℕ} {par lv su sg ma ua qa ea sz kd kp c : ℕ × ℕ}
  (R0 eps0 beta : K) (A : Matrix (Fin n) (Fin n) (K × 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) (hexact : Ops.IsExactNatLit dec M (max n 4))
  (hl : μ.Live [par, lv, su, sg, ma, ua, qa, ea, sz, kd, kp, c]) (hPos : μ.pos = base)
  (hLevel :
    SpectralBisection.StoresLevel M
      (SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ) n fuel R0
      beta { k := n, A := A, R := R0, ε := eps0, ℓ := L } 0 ma sz lv μ)
  (hpar : μ.store.readBlock par.1 par.2 3 = some [R0, eps0, beta])
  (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])
  (hZero :
    ∀ (e : ℕ), 1 ≤ e → e ≤ L + 1 → ∀ lo < n, μ.store.get sz.1 (sz.2 + n * e + lo) = some (M.lit 0))
  (hRoom :
    μ.Room (SpectralBisection.arenaOperands c ma ua qa ea sz kd kp lv su sg)
      (SpectralBisection.arenaLengths n L))
  (hAP :
    Ops.Fp.Apart (SpectralBisection.arenaOperands c ma ua qa ea sz kd kp lv su sg)
      (SpectralBisection.arenaLengths n L))
  (hPar :
    Ops.Fp.Disj (Ops.Store.inBlock par.1 par.2 3)
      (Ops.Fp.blocks (SpectralBisection.arenaOperands c ma ua qa ea sz kd kp lv su sg)
        (SpectralBisection.arenaLengths n L))) :
  Ops.Writes Ops.Mode.total I τ (SpectralBisection.downwardPass SpectralBisection.node)
    (Ops.Env.frame [n, L, fuel] [par, lv, su, sg, ma, ua, qa, ea, sz, kd, kp, c])
    (Ops.Fp.loopPrefix
      (fun d ↦ SpectralBisection.downLevelOutputFp n d lv su sg ma ua qa ea sz kd kp) (L + 1))
    (fun ν ↦
      ν.pos = base + (L + 1) * SpectralBisection.levelSampleSize n ∧
        ν.store.readBlock par.1 par.2 3 = some [R0, eps0, beta] ∧
          ν.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] ∧
            (∀ e ≤ L + 1,
                SpectralBisection.StoresLevel M
                  (SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ)
                  n fuel R0 beta { k := n, A := A, R := R0, ε := eps0, ℓ := L } e ma sz lv ν) ∧
              ∀ e ≤ L,
                SpectralBisection.StoresRecords M
                  (SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ)
                  n fuel R0 beta { k := n, A := A, R := R0, ε := eps0, ℓ := L } e ma ua qa ea sz kd
                  kp ν)
    μ

Full source on GitHub

Import NLAlib.Eigensolvers.SpectralBisection.DownwardArena.