NLAlib.SpectralBisection.split_writes
Library · theorem
The split returns both actual computed bases, their shifted compressions, and the machine words for both sizes, kind four and the split size. Explicit interior, slot, readable-input, output-capacity and spatial-disjointness assumptions suffice for total execution. A fragment of NLAlib.SpectralBisection.bisectionRoutine.
NLAlib.SpectralBisection.split_writes {K Su Sg Op Tst : Type} [Inhabited K]
[Ops.Has Ops.ScalarOp Op] [Ops.Has Ops.IndexOp Op] [Ops.Has Ops.MatrixOp Op] {M : Ops.Machine K}
(dec : K → ℝ) (mm : MatMulMap (K × K)) (qr : QRMap (K × K)) (unif : K → Su → K)
(normal : Sg → K × K) {I : Ops.Interp Op Tst K} (hS : Ops.IsScalar M I) (hL : Ops.IsIndexLit M 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) {τ : Ops.Tape K} {μ : Ops.Mem K}
{n d lo k kp : ℕ} {sg pp pm ma qa sz kd ks c t : ℕ × ℕ} (S : ℕ → ℕ → K × K)
(Pp Pm A : Matrix (Fin k) (Fin k) (K × K)) (two scale sigmaP sigmaM : K)
(hInterior : 0 < kp ∧ kp < k) (hslot : lo + k ≤ n)
(hl : μ.Live [sg, pp, pm, ma, qa, sz, kd, ks, c, t])
(hread :
μ.readBlocks (SpectralBisection.splitInputs n d lo sg pp pm ma c t)
(SpectralBisection.splitInputLengths n k) =
some
[(Ops.EntryCodec.pair K).packMatrix n (2 * n) S, (Ops.EntryCodec.pair K).packFinMatrix Pp,
(Ops.EntryCodec.pair K).packFinMatrix Pm, (Ops.EntryCodec.pair K).packFinMatrix A, [two],
[scale], [sigmaP], [sigmaM]])
(hroom :
μ.Room (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
(SpectralBisection.splitOutputLengths k kp))
(hap :
Ops.Fp.Apart (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
(SpectralBisection.splitOutputLengths k kp))
(hprotect :
(Ops.Fp.blocks (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
(SpectralBisection.splitOutputLengths k kp)).Disj
(Ops.Fp.blocks (SpectralBisection.splitInputs n d lo sg pp pm ma c t)
(SpectralBisection.splitInputLengths n k))) :
have Qp :=
(qr (mm Pp (SpectralBisection.sampledGaussian M k lo 0 S scale))).1.submatrix id (Fin.castLE ⋯);
have Qm :=
(qr (mm Pm (SpectralBisection.sampledGaussian M k lo 1 S scale))).1.submatrix id (Fin.castLE ⋯);
have F := M.toFloatMachine dec (fun {l m n} ↦ mm) (fun {m n} ↦ qr) unif normal;
have Ap := F.hermShift (F.hermAvg (mm (mm (F.conjTransposeMat Qp) A) Qp) two) sigmaP;
have Am := F.hermShift (F.hermAvg (mm (mm (F.conjTransposeMat Qm) A) Qm) two) sigmaM;
Ops.Writes Ops.Mode.total I τ SpectralBisection.split
(Ops.Env.frame [n, d, lo, k, kp] [sg, pp, pm, ma, qa, sz, kd, ks, c, t])
(Ops.Fp.blocks (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
(SpectralBisection.splitOutputLengths k kp))
(fun μ' ↦
μ'.pos = μ.pos ∧
μ'.readBlocks (SpectralBisection.splitOutputs n d lo k kp ma qa sz kd ks)
(SpectralBisection.splitOutputLengths k kp) =
some
[(Ops.EntryCodec.pair K).packFinMatrix Qp, (Ops.EntryCodec.pair K).packFinMatrix Qm,
(Ops.EntryCodec.pair K).packFinMatrix Ap, (Ops.EntryCodec.pair K).packFinMatrix Am,
[M.lit ↑kp], [M.lit ↑(k - kp)], [M.lit 4], [M.lit ↑kp]])
μImport NLAlib.Eigensolvers.SpectralBisection.Split.