The real box product followed by candidate verification #
A physical descriptor, its query span and its raw matrix pair suffice for the complete box
backend and original-weight verifier. The physical ordinal and logical chunk/piece index are
independent. This boundary requires no all-record producer Output and permits dirty scratch;
the standalone producer-output specialization is in BoxRecordWitness.Exec.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.BoxRecordWitness.exec_at_record {w U m n g p i : ℕ} (values : ℕ → ℤ) (AB BC AC : ℕ → ℕ → ℤ) (x : WordRAM.Data 400) (hD : 16 ≤ MatrixMultiplication.Schonhage.D m) (hN : MatrixMultiplication.Schonhage.D m ^ 18 ≤ n) (hheaderD : x.mem 1 = MatrixMultiplication.Schonhage.D m) (hheaderG : x.mem 2 = g) (hheaderN : x.mem 3 = n) (idx : ExactTriangle.InstanceIndex p) (hi : x.regs (RecordWitness.productBank RecordProduct.Reg.ordinal) = i) (hview :
have heap := x.regs (RecordWitness.productBank 42);
have base :=
x.regs (RecordWitness.productBank (RecordProduct.producerBank Instances.output)) + i * (6 + 2 * (n * MatrixMultiplication.Schonhage.D m));
have q := RecordProduct.recordQueries n (MatrixMultiplication.Schonhage.D m) p idx;
have Q := RecordProduct.recordQueryCount n (MatrixMultiplication.Schonhage.D m) p values idx;
5 + 3 * (n * n) ≤ heap ∧ base + 6 ≤ heap ∧ q + 2 * Q ≤ heap ∧ idx.piece * ExactTriangle.pieceSize (MatrixMultiplication.Schonhage.D m) g ≤ n ∧ (∀ (j : Fin 6),
x.mem (base + ↑j) = ![↑idx.residue, idx.piece, q, Q, base + 6, base + 6 + n * MatrixMultiplication.Schonhage.D m] j) ∧ ∀ j < Q, x.mem (q + 2 * j) < n ∧ x.mem (q + 2 * j + 1) < n) (hspan :
x.regs (RecordWitness.productBank 39) + i * (6 + 2 * (n * MatrixMultiplication.Schonhage.D m)) + 6 + 2 * (n * MatrixMultiplication.Schonhage.D m) ≤ x.regs (RecordWitness.productBank 42)) (hleft :
have base := x.regs (RecordWitness.productBank 39) + i * (6 + 2 * (n * MatrixMultiplication.Schonhage.D m));
{ base := base + 6, length := n * MatrixMultiplication.Schonhage.D m }.Realizes x.mem
fun (j : Fin { base := base + 6, length := n * MatrixMultiplication.Schonhage.D m }.length) =>
WriteMatrices.entry false
(RecordProduct.matrixArgs n (MatrixMultiplication.Schonhage.D m) g p (↑idx.residue) idx.piece)
(fun (q : ℕ) => (values (2 * (n * n) + q) % ↑p).toNat) ↑j) (hright :
have base := x.regs (RecordWitness.productBank 39) + i * (6 + 2 * (n * MatrixMultiplication.Schonhage.D m));
{ base := base + 6 + n * MatrixMultiplication.Schonhage.D m,
length := n * MatrixMultiplication.Schonhage.D m }.Realizes
x.mem
fun
(j :
Fin
{ base := base + 6 + n * MatrixMultiplication.Schonhage.D m,
length := n * MatrixMultiplication.Schonhage.D m }.length) =>
WriteMatrices.entry true
(RecordProduct.matrixArgs n (MatrixMultiplication.Schonhage.D m) g p (↑idx.residue) idx.piece)
(fun (q : ℕ) => (values (n * n + q) % ↑p).toNat) ↑j) (hmem :
∀ a < n,
∀ b < n,
x.mem (5 + (a * n + b)) = WordRAM.Signed.encode (AB a b) ∧ x.mem (5 + n * n + (a * n + b)) = WordRAM.Signed.encode (BC a b) ∧ x.mem (5 + n * n + n * n + (a * n + b)) = WordRAM.Signed.encode (AC a b)) (hmag : ∀ a < n, ∀ b < n, (AB a b).natAbs ≤ U ∧ (BC a b).natAbs ≤ U ∧ (AC a b).natAbs ≤ U) (hU : GenericRAM.Signed.Fits w ↑(2 * U)) (hfit :
WordRAM.Fits (w + 2)
(RecordWitness.witnessWindow n (MatrixMultiplication.Schonhage.D m) g (x.regs (RecordWitness.productBank 42))
(RecordProduct.recordQueryCount n (MatrixMultiplication.Schonhage.D m) p values idx)
(MatrixMultiplication.Schonhage.QueriedProduct.outputBase (21 * m) m n
(RecordProduct.recordQueryCount n (MatrixMultiplication.Schonhage.D m) p values idx)))) :
Execute the complete box backend and original-weight verifier at an arbitrary physical record ordinal. Only this descriptor and matrix pair are required; the logical index still identifies the original chunk, piece and ordered query occurrences. Scratch may be dirty.