NLAlib.SpectralBisection.downwardPass_writes
Library · theorem
The actual counted downward traversal produces all level inputs and all node records. Its spatial premises protect earlier records, earlier input levels and future size zeros; the fresh-scratch premise concerns only storage shape and capacities. A fragment of NLAlib.SpectralBisection.bisectionRoutine.
NLAlib.SpectralBisection.downwardPass_writes {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))
(hGeometry :
∀ d ≤ L,
∀ (ν : Ops.Mem K),
List.length ν.store = List.length μ.store →
(∀ (b : ℕ), ν.store.len b = μ.store.len b) →
∀ (s : Ops.Store K),
List.length s = List.length ν.store + 1 →
s.len (List.length ν.store) = 5 →
Ops.Store.Below (List.length ν.store) ν.store s →
SpectralBisection.DownLevelGeometry n d
(fun lo ↦
((fun d lo ↦
SpectralBisection.nodeAtSlot
(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 } d lo)
d lo).k)
par lv su sg ma ua qa ea sz kd kp c (List.length ν.store, 0) s)
(hRead :
∀ d ≤ L,
((fun d ↦ SpectralBisection.downLevelOutputFp n d lv su sg ma ua qa ea sz kd kp) d).Disj
(Ops.Store.inBlock par.1 par.2 3 ⊔ Ops.Store.inBlock c.1 c.2 5))
(hLevels :
∀ d ≤ L,
∀ e ≤ d,
((fun d ↦ SpectralBisection.downLevelOutputFp n d lv su sg ma ua qa ea sz kd kp) d).Disj
(SpectralBisection.levelInputFp n e ma sz lv))
(hFuture :
∀ d ≤ L,
∀ (e : ℕ),
d + 2 ≤ e →
e ≤ L + 1 →
((fun d ↦ SpectralBisection.downLevelOutputFp n d lv su sg ma ua qa ea sz kd kp) d).Disj
(Ops.Store.inBlock sz.1 (sz.2 + n * e) n))
(hRecords :
∀ d ≤ L,
∀ e < d,
∀ (a : List Bool) (lo : ℕ) (x : EighNode K),
a.length = e →
eighLoc
(SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n base τ)
n fuel R0 beta 0 0 { k := n, A := A, R := R0, ε := eps0, ℓ := L } a =
some (lo, x) →
0 < x.k →
((fun d ↦ SpectralBisection.downLevelOutputFp n d lv su sg ma ua qa ea sz kd kp)
d).Disj
(Ops.Fp.blocks
(SpectralBisection.stepOutputs n e lo ma ua qa ea sz kd kp
(eighStep
(SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n
base τ)
n fuel R0 beta x.A x.R x.ε x.ℓ (eighTapeSample n e lo)))
(SpectralBisection.stepOutputLengths
(eighStep
(SpectralBisection.tapeMachine M dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) n
base τ)
n fuel R0 beta x.A x.R x.ε x.ℓ (eighTapeSample n e lo))))) :
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 ν)
μImport NLAlib.Eigensolvers.SpectralBisection.DownwardPass.