Modular inner products of unsigned word arrays #
Inputs are the complete first array followed by the complete second array, each in consecutive least-significant-first word blocks. Products run in parallel, then a balanced carry-save tree and one carry-lookahead addition compute the sum. The theorem applies to arbitrary raw words.
Main definitions #
Cslib.Circuits.Boolean.Modular.innerProduct: the complete modular inner-product circuit.
Main results #
Cslib.Circuits.Boolean.Modular.val_eval_innerProduct: exact modular inner-product semantics.Cslib.Circuits.Boolean.Modular.depth_innerProduct_le: logarithmic depth in count and width.
References #
This is the selected-row arithmetic used by Gentry, Sahai and Waters, Sections 3.1 and 3.4, with the modular multiplier and carry-save bounds proved in companion files.
theorem Cslib.Circuits.Boolean.Modular.val_eval_innerProduct {k w : ℕ} (a b : BitString (k * w)) :
↑((BitString.equivFin w) ((innerProduct k w).eval interpretation (Fin.append a b))) = (∑ j : Fin k, ↑((BitString.equivFin w) (a.block j)) * ↑((BitString.equivFin w) (b.block j))) % 2 ^ w
Exact inner-product value, including empty arrays and zero-width words.