Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Strassen.Prepare

Real Strassen operand production and child entry #

Both operand arrays are actually copied or arithmetically formed, then the native push writes the child's entire frame. Child readiness and its canonical input words are derived from these executions. No form, layout, multiplication, run or time certificate is supplied to the program. This internal stage preserves the parent output and older frames through the explicit footprint stated below.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_prepare {w p k A B a b out scratch frames frame a₁ a₂ b₁ b₂ : ℕ} (phase : Fin 7) (asign bsign : ℤ) (x : WordRAM.Data 64) (u v : ℕ → ℤ) (hx : NodeHeader p (k + 1) a b out scratch frames frame x) (hc : ChildBuffers p k scratch x) (hl : NodeLayout p (k + 1) a b out scratch frames frame) (ha₁ : a₁ < 4) (ha₂ : a₂ < 4) (hb₁ : b₁ < 4) (hb₂ : b₂ < 4) (hu : ∀ i < 4 ^ (k + 1) * p, (u i).natAbs ≤ A) (hv : ∀ i < 4 ^ (k + 1) * p, (v i).natAbs ≤ B) (hleft : ∀ i < 4 ^ (k + 1) * p, x.mem (a + i) = WordRAM.Signed.encode (u i)) (hright : ∀ i < 4 ^ (k + 1) * p, x.mem (b + i) = WordRAM.Signed.encode (v i)) (hmag : GenericRAM.Signed.Fits w ↑(magnitudeBound p A B (k + 1))) (haddr : WordRAM.Fits (w + 2) (addressBound frames frame (k + 1))) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) (prepare (↑phase + 1) a₁ a₂ asign b₁ b₂ bsign) x y (52 * (4 ^ k * p) + 50) ∧ NodeReady p k scratch (scratch + 4 ^ k * p) (scratch + 2 * (4 ^ k * p)) (scratch + 3 * (4 ^ k * p)) frames (frame + 7) y ∧ (∀ j < 4 ^ k * p, y.mem (scratch + j) = WordRAM.Signed.encode (if asign = 0 then u (a₁ * (4 ^ k * p) + j) else if asign < 0 then u (a₁ * (4 ^ k * p) + j) - u (a₂ * (4 ^ k * p) + j) else u (a₁ * (4 ^ k * p) + j) + u (a₂ * (4 ^ k * p) + j))) ∧ (∀ j < 4 ^ k * p, y.mem (scratch + 4 ^ k * p + j) = WordRAM.Signed.encode (if bsign = 0 then v (b₁ * (4 ^ k * p) + j) else if bsign < 0 then v (b₁ * (4 ^ k * p) + j) - v (b₂ * (4 ^ k * p) + j) else v (b₁ * (4 ^ k * p) + j) + v (b₂ * (4 ^ k * p) + j))) ∧ y.mem (frame + 6) = ↑phase + 1 ∧ ∀ (q : ℕ), q < scratch ∨ scratch + 2 * (4 ^ k * p) ≤ q → q < frame + 6 ∨ frame + 14 ≤ q → y.mem q = x.mem q

Produce two actual operand forms and a complete child frame. Every form, argument, pointer, store and push instruction is charged, including single-quadrant copies.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_prepareChild {w p k A B a b out scratch frames frame : ℕ} (phase : Fin 7) (x : WordRAM.Data 64) (u v : ℕ → ℤ) (hx : NodeHeader p (k + 1) a b out scratch frames frame x) (hc : ChildBuffers p k scratch x) (hl : NodeLayout p (k + 1) a b out scratch frames frame) (hu : ∀ i < 4 ^ (k + 1) * p, (u i).natAbs ≤ A) (hv : ∀ i < 4 ^ (k + 1) * p, (v i).natAbs ≤ B) (hleft : ∀ i < 4 ^ (k + 1) * p, x.mem (a + i) = WordRAM.Signed.encode (u i)) (hright : ∀ i < 4 ^ (k + 1) * p, x.mem (b + i) = WordRAM.Signed.encode (v i)) (hmag : GenericRAM.Signed.Fits w ↑(magnitudeBound p A B (k + 1))) (haddr : WordRAM.Fits (w + 2) (addressBound frames frame (k + 1))) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) (prepareChild phase) x y (52 * (4 ^ k * p) + 50) ∧ NodeReady p k scratch (scratch + 4 ^ k * p) (scratch + 2 * (4 ^ k * p)) (scratch + 3 * (4 ^ k * p)) frames (frame + 7) y ∧ (∀ j < 4 ^ k * p, y.mem (scratch + j) = WordRAM.Signed.encode (MatrixMultiplication.Strassen.leftOperand p k u phase j)) ∧ (∀ j < 4 ^ k * p, y.mem (scratch + 4 ^ k * p + j) = WordRAM.Signed.encode (MatrixMultiplication.Strassen.rightOperand p k v phase j)) ∧ y.mem (frame + 6) = ↑phase + 1 ∧ ∀ (q : ℕ), q < scratch ∨ scratch + 2 * (4 ^ k * p) ≤ q → q < frame + 6 ∨ frame + 14 ≤ q → y.mem q = x.mem q

Each static child dispatch produces exactly the operand pair of the existing finite Strassen recurrence. Its readiness and input meanings follow from the two real form loops and frame push; no precomputed operand array is assumed.