Binary gadgets for GSW encryption #
Residues modulo 2 ^ w decompose into exactly w bits, ordered from least to most significant.
The expanded coordinate type is ι × Fin w: the original coordinate comes first. Recomposition
accepts arbitrary modular entries, while decomposition and flattening return Boolean matrices.
The same bitMatrix lift interprets these bits in the modular computation and in integer noise
witnesses.
These are the row operations from
Gentry, Sahai and Waters, Sections 2.3 and 3.1.
The paper uses ⌊log₂ q⌋ + 1 digits for a general modulus q. For q = 2 ^ w, its last digit is
redundant; this module uses the minimal w digits. Width zero is allowed: its residue ring is
ZMod 1, and its expanded coordinate type is empty.
Main definitions #
bitDecomp,bitCompose,powersOfTwo: the binary row operations.bitMatrix: interpret a Boolean matrix in a type with natural-number casts.decomposeMatrix,recomposeMatrix,flattenMatrix: apply the row operations to matrices.
Main results #
recomposeMatrix_decomposeMatrix: recomposition recovers every modular matrix.decomposeMatrix_mulVec: decomposition preserves multiplication by the expanded secret.flattenMatrix_mulVec: flattening preserves that multiplication on arbitrary modular inputs.recomposeMatrix_flattenMatrix: flattening preserves recomposition.recomposeMatrix_sub,recomposeMatrix_mul: row recomposition commutes with subtraction and left matrix multiplication, as used by serialized NAND.
References #
- [C. Gentry, A. Sahai and B. Waters, Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based, Sections 2.3 and 3.1] [GSW13]
Flattening preserves multiplication by the expanded secret on every modular input.