Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Strassen.QuarterUpdate

Native Strassen output-quarter update #

The in-place coefficient loop updates one real output quarter. The other three quarters, the returned child product, original inputs and older frames survive through its exact footprint. This is an internal execution lemma for the controller induction.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_accumulate_quarters {w p k a b out scratch frames frame A B : ℕ} (t : Fin 4) (subtract : Bool) (x : WordRAM.Data 64) (u : Fin 4 → ℕ → ℤ) (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 : ∀ (s : Fin 4), ∀ j < 4 ^ k * p, (u s j).natAbs ≤ A) (hv : ∀ j < 4 ^ k * p, (v j).natAbs ≤ B) (hout : ∀ (s : Fin 4), ∀ j < 4 ^ k * p, x.mem (out + ↑s * (4 ^ k * p) + j) = WordRAM.Signed.encode (u s j)) (hprod : ∀ j < 4 ^ k * p, x.mem (scratch + 2 * (4 ^ k * p) + j) = WordRAM.Signed.encode (v j)) (hmag : GenericRAM.Signed.Fits w ↑(A + B)) (haddr : WordRAM.Fits (w + 2) (addressBound frames frame (k + 1))) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) (accumulate (↑t) subtract) x y (26 * (4 ^ k * p) + 10) ∧ NodeHeader p (k + 1) a b out scratch frames frame y ∧ ChildBuffers p k scratch y ∧ (∀ (s : Fin 4), ∀ j < 4 ^ k * p, y.mem (out + ↑s * (4 ^ k * p) + j) = WordRAM.Signed.encode (if s = t then if subtract = true then u s j - v j else u s j + v j else u s j)) ∧ ∀ (d : ℕ), d < out + ↑t * (4 ^ k * p) ∨ out + ↑t * (4 ^ k * p) + 4 ^ k * p ≤ d → y.mem d = x.mem d

One actual accumulation updates its selected quarter and preserves all other quarters. Header and child-buffer facts are derived from the actual register frame theorem.