Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.CountPrime.Access

Charged native modular-counter matrix accesses #

The Morton block reads two actual words from the previously computed spread table. The residue block computes the actual row-major address, transposing BC when requested. These are internal stage contracts; the composed counter supplies the table through its proved construction and the residues through the existing native signed-remainder loop.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.CountPrime.exec_morton {w k : ℕ} (x : WordRAM.Data 128) (h2 : x.regs Reg.two = 2) (hr : x.regs Reg.row < 2 ^ k) (hc : x.regs Reg.column < 2 ^ k) (htable : ∀ j < 2 ^ k, x.mem (x.regs Reg.spread + j) = Nat.Morton.spread j) (hw : WordRAM.Fits w (x.regs Reg.spread + 4 ^ k + 2 ^ k)) :

Six actual instructions read the table and compute the Morton index. The input row and column and the original table pointer are preserved.

Four actual instructions perform an admitted original-matrix residue read. The transpose is fixed code selection, while both coordinates and the pointer are runtime data.