Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Strassen.Form

Uniform execution of actual Strassen operand forms #

The zero-sign branch executes the proved native copying loop; the other branches execute the proved signed array arithmetic loop. This internal helper derives its execution from those real programs. No form values, run or cost certificate is supplied by the caller.

theorem Cslib.Algorithms.WordRAM.Strassen.exec_form {w q t₁ t₂ A : ℕ} (base dst : Fin 64) (sign : ℤ) (x : WordRAM.Data 64) (u : ℕ → ℤ) (hb : 32 ≤ ↑base) (hd : 32 ≤ ↑dst) (hbt : base ≠ Reg.temporary) (hdt : dst ≠ Reg.temporary) (hq : x.regs Reg.quarter = q) (ht₁ : t₁ < 4) (ht₂ : t₂ < 4) (hbound : GenericRAM.Signed.Fits w ↑(A + A)) (hu : ∀ j < 4 * q, (u j).natAbs ≤ A) (hinput : ∀ j < 4 * q, x.mem (x.regs base + j) = WordRAM.Signed.encode (u j)) (hw : WordRAM.Fits (w + 2) (x.regs base + 4 * q + x.regs dst + q + 8)) (hsep : x.regs base + 4 * q ≤ x.regs dst ∨ x.regs dst + q ≤ x.regs base) :
∃ (y : WordRAM.Data 64), WordRAM.ExecWithin (w + 2) (form base dst t₁ t₂ sign) x y (26 * q + 12) ∧ (∀ j < q, y.mem (x.regs dst + j) = WordRAM.Signed.encode (if sign = 0 then u (t₁ * q + j) else if sign < 0 then u (t₁ * q + j) - u (t₂ * q + j) else u (t₁ * q + j) + u (t₂ * q + j))) ∧ (∀ (a : ℕ), a < x.regs dst ∨ x.regs dst + q ≤ a → y.mem a = x.mem a) ∧ ∀ (i : Fin 64), 32 ≤ ↑i → i ≠ Reg.temporary → y.regs i = x.regs i

The actual form code has one uniform bound for copying, addition and subtraction.