Complete native routed products using one shared box geometry #
exec_fromSnapshot executes one shared suffix for contiguous and physically gathered inputs:
routing, shared encodings, geometry, retained values, sparse query batches and occurrence
reconstruction. It restores every original snapshot word and the threshold, retaining the
outside-memory frame. exec establishes its premises from ordinary original words.
theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.BoxProduct.exec_fromSnapshot {w L m t N A : ℕ} (hw : 0 < w) (hm : m ≤ L) (ht : t ≤ m) (bits : Bool) (X : Matrix (Fin N) (Fin (MatrixMultiplication.Schonhage.D m)) ℤ) (Y : Matrix (Fin (MatrixMultiplication.Schonhage.D m)) (Fin N) ℤ) (qs : List (Fin N × Fin N)) (original : ℕ → ℕ) (x : WordRAM.Data 160) (hsource :
∀ (a : ℕ),
0 < a →
a < QueriedProduct.inputEnd m N qs.length →
original a = (WordRAM.State.init (QueriedProduct.input bits L X Y qs)).data.mem a) (xp : QueriedProduct.Parameters L m N qs.length x) (xt : x.regs Reg.threshold = t) (hheader : ∀ (a : ℕ), 0 < a → a < 5 → x.mem a = (WordRAM.State.init (QueriedProduct.input bits L X Y qs)).data.mem a) (hsnapshot :
∀ a < QueriedProduct.inputEnd m N qs.length, x.mem (QueriedProduct.snapshotBase L m N qs.length + a) = original a) (hX : ∀ (i : Fin N) (k : Fin (MatrixMultiplication.Schonhage.D m)), |X i k| ≤ ↑A) (hY : ∀ (k : Fin (MatrixMultiplication.Schonhage.D m)) (j : Fin N), |Y k j| ≤ ↑A) (hbits :
bits = true →
(∀ (i : Fin N) (k : Fin (MatrixMultiplication.Schonhage.D m)), 0 ≤ X i k) ∧ ∀ (k : Fin (MatrixMultiplication.Schonhage.D m)) (j : Fin N), 0 ≤ Y k j) (hmag : magnitudeBound L A < 2 ^ (w - 1)) (hfit : WordRAM.Fits (w + 2) (wordBudget L m t N qs.length)) :
∃ (y : WordRAM.Data 160),
WordRAM.ExecWithin (w + 2) (programFromSnapshot bits) x y (snapshotTimeBound L m t qs) ∧ QueriedProduct.Parameters L m N qs.length y ∧ y.regs Reg.threshold = t ∧ (∀ (i : Fin qs.length),
y.mem (QueriedProduct.outputBase L m N qs.length + ↑i) = WordRAM.Signed.encode ((X * Y) (qs.get i).1 (qs.get i).2)) ∧ (∀ a < QueriedProduct.inputEnd m N qs.length, y.mem a = original a) ∧ y.mem (QueriedProduct.inputEnd m N qs.length) = t ∧ ∀ (a : ℕ), memoryEnd L m t N qs.length ≤ a → y.mem a = x.mem a
Execute the unchanged product back end from an actually gathered snapshot.
theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.BoxProduct.exec {w L m t N A : ℕ} (hw : 0 < w) (hm : m ≤ L) (ht : t ≤ m) (bits : Bool) (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 160) (hinput :
∀ (a : ℕ),
0 < a →
a < QueriedProduct.inputEnd m N qs.length →
x.mem a = (WordRAM.State.init (QueriedProduct.input bits L X Y qs)).data.mem a) (hthreshold : x.mem (QueriedProduct.inputEnd m N qs.length) = t) (hX : ∀ (i : Fin N) (k : Fin (MatrixMultiplication.Schonhage.D m)), |X i k| ≤ ↑A) (hY : ∀ (k : Fin (MatrixMultiplication.Schonhage.D m)) (j : Fin N), |Y k j| ≤ ↑A) (hbits :
bits = true →
(∀ (i : Fin N) (k : Fin (MatrixMultiplication.Schonhage.D m)), 0 ≤ X i k) ∧ ∀ (k : Fin (MatrixMultiplication.Schonhage.D m)) (j : Fin N), 0 ≤ Y k j) (hmag : magnitudeBound L A < 2 ^ (w - 1)) (hfit : WordRAM.Fits (w + 2) (wordBudget L m t N qs.length)) :
∃ (y : WordRAM.Data 160),
WordRAM.ExecWithin (w + 2) (program bits) x y (timeBound L m t qs) ∧ QueriedProduct.Parameters L m N qs.length y ∧ y.regs Reg.threshold = t ∧ (∀ (i : Fin qs.length),
y.mem (QueriedProduct.outputBase L m N qs.length + ↑i) = WordRAM.Signed.encode ((X * Y) (qs.get i).1 (qs.get i).2)) ∧ ∀ (a : ℕ),
¬(QueriedProduct.inputEnd m N qs.length + 1 ≤ a ∧ a < memoryEnd L m t N qs.length) → y.mem a = x.mem a
One fixed native program computes exact original-order signed matrix products from only original words. Neither routing, encoding, box geometry, execution nor time is supplied.