Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Strassen.Next

Native Strassen transition to the next child #

The actual return stage first accumulates the current child's real product, then constructs both next operands and pushes the complete next frame. Original inputs, earlier frames and the new partial output survive by composing the real footprints of those operations.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_stage_next {w p k A B a b out scratch frames frame : ℕ} (phase : Fin 6) (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)) (hout : ∀ (s : Fin 4), ∀ j < 4 ^ k * p, x.mem (out + ↑s * (4 ^ k * p) + j) = WordRAM.Signed.encode (MatrixMultiplication.Strassen.partialValue p k (↑phase) u v s j)) (hprod : ∀ j < 4 ^ k * p, x.mem (scratch + 2 * (4 ^ k * p) + j) = WordRAM.Signed.encode (MatrixMultiplication.Strassen.childProduct p k u v ⟨↑phase, ⋯⟩ j)) (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) (stage ⟨↑phase + 1, ⋯⟩) x y (receiveBudget ⟨↑phase, ⋯⟩ (4 ^ k * p) + 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 + 1, ⋯⟩ j)) ∧ (∀ j < 4 ^ k * p, y.mem (scratch + 4 ^ k * p + j) = WordRAM.Signed.encode (MatrixMultiplication.Strassen.rightOperand p k v ⟨↑phase + 1, ⋯⟩ j)) ∧ (∀ (s : Fin 4), ∀ j < 4 ^ k * p, y.mem (out + ↑s * (4 ^ k * p) + j) = WordRAM.Signed.encode (MatrixMultiplication.Strassen.partialValue p k (↑phase + 1) u v s j)) ∧ y.mem (frame + 6) = ↑phase + 2 ∧ ∀ (d : ℕ), d < out ∨ out + 4 ^ (k + 1) * p ≤ d → d < scratch ∨ scratch + 2 * (4 ^ k * p) ≤ d → d < frame + 6 ∨ frame + 14 ≤ d → y.mem d = x.mem d

Each of the first six actual return stages advances the output partial sum and computes the next real recursive child. The seventh child returns through a separate final-pop case.