Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Strassen.Exec

Complete native cyclic-coefficient Strassen execution #

The actual fixed program computes its root power/size and frame address, initializes the dirty root frame, executes all seven-product recursion through the explicit native stack, and exits the real controller loop. Callers supply ordinary pointers and canonical signed coefficient arrays with numerical separation and fits. No layout, multiplication, execution or time certificate is an algorithm argument. The result agrees with the existing finite Strassen recursion, whose separate correctness theorem identifies cyclic-ring matrix product.

This caller-safe kernel does not yet compose CountPrime matrix preparation, coefficient extraction, initialized original-weight input, or its final original-input width envelope.

theorem Cslib.Algorithms.WordRAM.Strassen.exec {w p k A B a b out scratch : ℕ} (x : WordRAM.Data 64) (u v : ℕ → ℤ) (hp : 0 < p) (hpr : x.regs Reg.modulus = p) (hkr : x.regs Reg.depth = k) (har : x.regs Reg.inputA = a) (hbr : x.regs Reg.inputB = b) (hor : x.regs Reg.output = out) (hsr : x.regs Reg.scratch = scratch) (ha : a + 4 ^ k * p ≤ scratch) (hb : b + 4 ^ k * p ≤ scratch) (ho : out + 4 ^ k * p ≤ scratch) (hdisjA : a + 4 ^ k * p ≤ out ∨ out + 4 ^ k * p ≤ a) (hdisjB : b + 4 ^ k * p ≤ out ∨ out + 4 ^ k * p ≤ b) (hu : ∀ i < 4 ^ k * p, (u i).natAbs ≤ A) (hv : ∀ i < 4 ^ k * p, (v i).natAbs ≤ B) (hleft : ∀ i < 4 ^ k * p, x.mem (a + i) = WordRAM.Signed.encode (u i)) (hright : ∀ i < 4 ^ k * p, x.mem (b + i) = WordRAM.Signed.encode (v i)) (hmag : GenericRAM.Signed.Fits w ↑(magnitudeBound p A B k)) (haddr : WordRAM.Fits (w + 2) (addressBound (scratch + 4 ^ k * p) (scratch + 4 ^ k * p) k)) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) program x y (traceBudget p k + 4 * k + 32) ∧ NodeResult p k out scratch (scratch + 4 ^ k * p) (scratch + 4 ^ k * p) u v x y

Execute the complete native Strassen program from its actual runtime arguments. Output and recursive workspace may be dirty. The bound includes setup and loop exit, while a final flat halt, when appended by a caller, costs one additional instruction.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_budget_le (p k : ℕ) :
traceBudget p k + 4 * k + 32 ≤ (42 * p * p + 240 * p + 178) * 7 ^ k + 4 * k + 32

The proved native instruction count is polynomial in the cyclic coefficient length and grows as seven to the matrix depth. This bound concerns the actual execution in exec.