Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.RecordBoxProduct.Patch

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.