Actual threshold-aware patch of a prepared record's original input #
The existing record preparer copies original zero/one matrices and coordinates.
Sixteen actual instructions replace its level and length words and append m/9.
No copied matrix/coordinate position changes. All producer/selection registers and
all memory outside the new local original-input span are preserved.
@[reducible, inline]
Scratch slot holding the new level multiplier.
@[reducible, inline]
Scratch slot holding the threshold divisor.
Rewrite the actual level and length headers, and store the ordinary threshold.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordBoxProduct.exec_patchInput {W b m I : ℕ} (x : WordRAM.Data 320) (hb : x.regs RecordProduct.Reg.base = b) (hm : x.mem (b + 2) = m) (hlen : x.mem b = I - 1) (hI : 5 ≤ I) (hfit : WordRAM.Fits W (b + I + 21 * m + 32)) :
∃ (y : WordRAM.Data 320),
WordRAM.ExecWithin W patchInput x y 16 ∧ y.mem = Function.update (Function.update (Function.update x.mem (b + 1) (21 * m)) b I) (b + I) (m / 9) ∧ y.regs RecordProduct.Reg.base = b ∧ ∀ (j : Fin 320), ↑j < 65 → y.regs j = x.regs j
The patch executes sixteen instructions and writes exactly three original words.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.RecordBoxProduct.patch_input_readback {b m n : ℕ} (X : Matrix (Fin n) (Fin (MatrixMultiplication.Schonhage.D m)) ℤ) (Y : Matrix (Fin (MatrixMultiplication.Schonhage.D m)) (Fin n) ℤ) (qs : List (Fin n × Fin n)) (x : WordRAM.Data 320) (hin :
∀ a < MatrixMultiplication.Schonhage.QueriedProduct.inputEnd m n qs.length,
x.mem (b + a) = (WordRAM.State.init (MatrixMultiplication.Schonhage.QueriedProduct.input true (19 * m) X Y qs)).data.mem a) (a : ℕ) (ha : a < MatrixMultiplication.Schonhage.QueriedProduct.inputEnd m n qs.length + 1) :
Function.update
(Function.update (Function.update x.mem (b + 1) (21 * m)) b
(MatrixMultiplication.Schonhage.QueriedProduct.inputEnd m n qs.length))
(b + MatrixMultiplication.Schonhage.QueriedProduct.inputEnd m n qs.length) (m / 9) (b + a) = (WordRAM.State.init (MatrixMultiplication.Schonhage.BoxProduct.input true (21 * m) (m / 9) X Y qs)).data.mem a
Patched memory realizes the complete new input, including the appended threshold.