Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.CyclicConvolution.Exec

Complete native multiplication of cyclic coefficient arrays #

Both real input blocks are disjoint from the output in either order; they may coincide with each other. Output cells may initially contain arbitrary dirty words. The program computes every coefficient and preserves every memory cell outside the output. All fits use original input magnitudes and explicit one-past-end addresses, not intermediate sum certificates.

theorem Cslib.Algorithms.WordRAM.CyclicConvolution.exec {w p A B : ℕ} (x : WordRAM.Data 32) (u v : ℕ → ℤ) (hlen : x.regs Reg.length = p) (hbound : GenericRAM.Signed.Fits w ↑(magnitudeBound p A B)) (hu : ∀ i < p, (u i).natAbs ≤ A) (hv : ∀ i < p, (v i).natAbs ≤ B) (hA : ∀ i < p, x.mem (x.regs Reg.inputA + i) = WordRAM.Signed.encode (u i)) (hB : ∀ i < p, x.mem (x.regs Reg.inputB + i) = WordRAM.Signed.encode (v i)) (h2p : WordRAM.Fits (w + 2) (2 * p)) (ha : WordRAM.Fits (w + 2) (x.regs Reg.inputA + p)) (hb : WordRAM.Fits (w + 2) (x.regs Reg.inputB + p)) (hout : WordRAM.Fits (w + 2) (x.regs Reg.output + p)) (hdisjA : x.regs Reg.inputA + p ≤ x.regs Reg.output ∨ x.regs Reg.output + p ≤ x.regs Reg.inputA) (hdisjB : x.regs Reg.inputB + p ≤ x.regs Reg.output ∨ x.regs Reg.output + p ≤ x.regs Reg.inputB) :
∃ (y : WordRAM.Data 32), WordRAM.ExecWithin (w + 2) program x y (42 * p * p + 9 * p + 4) ∧ (∀ r < p, y.mem (x.regs Reg.output + r) = WordRAM.Signed.encode (CyclicIntRing.convolution p u v r)) ∧ (∀ (a : ℕ), a < x.regs Reg.output ∨ x.regs Reg.output + p ≤ a → y.mem a = x.mem a) ∧ ∀ (i : Fin 32), 9 ≤ ↑i ∧ ↑i ≤ 12 ∨ 19 ≤ ↑i → y.regs i = x.regs i

Multiply two actual signed coefficient arrays in quadratic native time. Both source blocks and all memory outside the output are preserved; no zeroed scratch is required. The bound excludes the final halt.