Documentation

CslibFrontier.Algorithms.WordRAM.MatrixMultiplication.Schonhage.Product.Input

Original matrix and coordinate inputs for queried products #

Main definitions #

The raw-input program performs actual doubling before calling the signed producer. In particular, raw 0/1 entries become canonical signed 0/2 words. This input definition neither supplies encodings nor performs that target conversion on the caller's behalf.

Ordinary source words. In raw mode only nonnegative source values are represented; the native matrix-copy loop performs the subsequent signed-encoding conversion.

Actual doubling converts every nonnegative raw entry into its canonical signed word. In particular, the raw unsigned zero/one producer convention becomes signed zero/two.

Both original matrices in their ordinary row-major input order.

Actual initialized input, using exactly the existing router's raw coordinate convention.

Every original scalar, matrix entry and coordinate lies within the snapshot prefix.

theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.QueriedProduct.input_query_word {m N : ℕ} (bits : Bool) (L : ℕ) (X : Matrix (Fin N) (Fin (MatrixMultiplication.Schonhage.D m)) ℤ) (Y : Matrix (Fin (MatrixMultiplication.Schonhage.D m)) (Fin N) ℤ) (qs : List (Fin N × Fin N)) (i : Fin qs.length) (s : Fin 2) :
(WordRAM.State.init (input bits L X Y qs)).data.mem (queryInputBase m N + 2 * ↑i + ↑s) = if s = 0 then ↑(qs.get i).1 else ↑(qs.get i).2

The complete initialized input retains the router's raw coordinate values; the matrices only shift their original address. No query code or tile is supplied in these words.

Both original row-major matrix blocks contain precisely their supplied entry words, before any copying, sign conversion or encoding takes place.

theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.QueriedProduct.entryWord_fits {w L A : ℕ} (hw : 0 < w) (bits : Bool) (z : ℤ) (hz : |z| ≤ ↑A) (hmag : magnitudeBound L A < 2 ^ (w - 1)) :
WordRAM.Fits (w + 2) (entryWord bits z)

The original magnitude envelope covers both canonical signed and raw unsigned words. Raw-word fit does not itself assert nonnegativity of the represented source entries; that extra semantic premise is used by the actual conversion proof.

theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.QueriedProduct.input_fits {w L m N A : ℕ} (hw : 0 < w) (hm : m ≤ L) (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)) (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) (hmag : magnitudeBound L A < 2 ^ (w - 1)) (hfit : WordRAM.Fits (w + 2) (wordBudget L m N qs.length)) :
WordRAM.InputFits (w + 2) (input bits L X Y qs)

Every actual initialized word fits from original dimensions and entry magnitudes. No intermediate machine-state fit certificate is supplied.

Original raw matrix words are bounded by the original absolute-entry bound, at every flat position. This supplies the actual conversion loop without an intermediate fit premise.