Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.CountPrime.ResidueArray

Real counter residue-array calls #

Four charged argument copies invoke the existing signed-remainder loop. Every resulting residue is an unsigned key; canonical signed decoding is performed inside the actual callee. The original high-bank metadata and all memory outside the destination are preserved.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.CountPrime.exec_residues {w n p a b : ℕ} (src dst : Fin 128) (x : WordRAM.Data 128) (hsrc : 64 ≤ ↑src) (hdst : 64 ≤ ↑dst) (values : ℕ → ℤ) (hp : 0 < p) (hc : x.regs Reg.cells = n * n) (ha : x.regs src = a) (hb : x.regs dst = b) (hm : x.regs Reg.encodedModulus = WordRAM.Signed.encode ↑p) (hmod : GenericRAM.Signed.Fits w ↑p) (hv : ∀ i < n * n, GenericRAM.Signed.Fits w (values i)) (haf : WordRAM.Fits (w + 2) (a + n * n)) (hbf : WordRAM.Fits (w + 2) (b + n * n)) (hdisjoint : a + n * n ≤ b) (hinput : ∀ i < n * n, x.mem (a + i) = WordRAM.Signed.encode (values i)) :
∃ (y : WordRAM.Data 128), WordRAM.ExecWithin (w + 2) (residues src dst) x y (23 * (n * n) + 8) ∧ (∀ i < n * n, y.mem (b + i) = (values i % ↑p).toNat) ∧ (∀ (d : ℕ), d < b ∨ b + n * n ≤ d → y.mem d = x.mem d) ∧ ∀ (j : Fin 128), 16 ≤ ↑j → y.regs j = x.regs j

Complete actual residue call for a matrix, with source and destination parameters in the protected metadata bank. No residue array is supplied to the algorithm.