Complete original-array adaptation and actual word accumulation #
All three real copy calls operate only on original squares. Their sum and memory effects are composed without a clean destination, a supplied list of words or a layout certificate. The implementation interfaces here retain numerical fits; the complete caller derives them from original input bounds and the computed virtual-window threshold.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.CallableFixedPrime.matrixWordSum_eq_rawTotal {n ab bc ac : ℕ} (mem : ℕ → ℕ) (values : List ℤ) (vab : ∀ q < n * n, mem (ab + q) = WordRAM.Signed.encode (values.getD q 0)) (vbc : ∀ q < n * n, mem (bc + q) = WordRAM.Signed.encode (values.getD (n * n + q) 0)) (vac : ∀ q < n * n, mem (ac + q) = WordRAM.Signed.encode (values.getD (2 * (n * n) + q) 0)) :
Original canonical source words identify the actual native sum with the original list sum used by source-width admission. No additional matrix traversal is performed.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.CallableFixedPrime.exec_adapt {W : ℕ} (x : WordRAM.Data 640) (hab : x.regs Reg.ab + x.regs Reg.n * x.regs Reg.n ≤ x.regs Reg.base) (hbc : x.regs Reg.bc + x.regs Reg.n * x.regs Reg.n ≤ x.regs Reg.base) (hac : x.regs Reg.ac + x.regs Reg.n * x.regs Reg.n ≤ x.regs Reg.base) (hfit :
WordRAM.Fits W
(x.regs Reg.base + 4 * (x.regs Reg.n * x.regs Reg.n) + matrixWordSum x.mem (x.regs Reg.n) (x.regs Reg.ab) (x.regs Reg.bc) (x.regs Reg.ac) + 1024)) :
∃ (y : WordRAM.Data 640),
WordRAM.ExecWithin W adapt x y (24 * (x.regs Reg.n * x.regs Reg.n) + 38) ∧ y.mem = copyMemory x.mem (x.regs Reg.base) (x.regs Reg.n) (x.regs Reg.dimension) (x.regs Reg.groups) (x.regs Reg.prime)
(x.regs Reg.ab) (x.regs Reg.bc) (x.regs Reg.ac) ∧ y.regs Reg.total = matrixWordSum x.mem (x.regs Reg.n) (x.regs Reg.ab) (x.regs Reg.bc) (x.regs Reg.ac) ∧ ∀ (j : Fin 640), ↑j < 608 → y.regs j = x.regs j
Actual stores/copies and their complete linear charge. The three sources may alias each other, but precede workspace. Only original source/end/sum quantities occur in the fits.