Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.CountPrime.ExecReady

Complete actual counter tail from original signed arrays #

Only the register metadata has been established by setup. Every residue, table, coefficient matrix and product is constructed by real code here. The final scan returns the existing modular count. The original arrays and all caller memory outside the explicit workspace are preserved, including when the workspace starts dirty.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.CountPrime.exec_ready {w n p k scratch a b c A : ℕ} (x : WordRAM.Data 128) (u v z : ℕ → ℤ) (hp : 0 < p) (hn : n ≤ 2 ^ k) (ready : CounterRegisters n p k scratch a b c x) (ha : a + n * n ≤ scratch) (hb : b + n * n ≤ scratch) (hc : c + n * n ≤ scratch) (hu : ∀ i < n * n, (u i).natAbs ≤ A) (hv : ∀ i < n * n, (v i).natAbs ≤ A) (hz : ∀ i < n * n, (z i).natAbs ≤ A) (hinU : ∀ i < n * n, x.mem (a + i) = WordRAM.Signed.encode (u i)) (hinV : ∀ i < n * n, x.mem (b + i) = WordRAM.Signed.encode (v i)) (hinZ : ∀ i < n * n, x.mem (c + i) = WordRAM.Signed.encode (z i)) (hmag : GenericRAM.Signed.Fits w ↑(magnitudeBudget p k A)) (hw : WordRAM.Fits (w + 2) (addressBudget n p k scratch a b c)) :
∃ (y : WordRAM.Data 128), WordRAM.ExecWithin (w + 2) (residueArrays.seq (coefficientMatrices.seq (product.seq count))) x y (readyCost n p k) ∧ CounterRegisters n p k scratch a b c y ∧ y.regs Reg.result = ExactTriangle.countZeroMod (fun (α β : Fin n) => u (↑α * n + ↑β)) (fun (α β : Fin n) => v (↑α * n + ↑β)) (fun (α β : Fin n) => z (↑α * n + ↑β)) p ∧ ∀ (d : ℕ), d < scratch ∨ memoryEnd n p k scratch ≤ d → y.mem d = x.mem d

Compose the actual residue/matrix/seven-product/extraction pipeline. This internal theorem consumes setup's computed register meaning, not any intermediate table, matrix or run oracle.