Documentation

CslibFrontier.Crypto.Computational.SIS.Native

Native coefficient arithmetic for the existing Module-SIS ring #

Polynomials of ℤ_q[X] / (X^n + 1) in coefficient form Fin n → ZMod q are represented natively by the list of their canonical residues (polyResidues), and vectors of polynomials by lists of such lists (polyVecResidues). The total list operations negacyclicMulResidues, addResidues and negacyclicInnerResidues are identified with negacyclicMul, polynomial addition and innerPoly, including degree zero and positive composite coefficient moduli, and have plain polynomial-time certificates with a unary degree and a binary modulus. This is original supporting representation algebra; it supplies neither a new encryption algorithm nor a security claim.

Main definitions #

Main results #

theorem Cslib.Crypto.negacyclicMulResidues_ofFn {n q : ℕ} (hq : 0 < q) (a b : Fin n → ZMod q) :
negacyclicMulResidues n q (List.ofFn fun (i : Fin n) => (a i).val) (List.ofFn fun (i : Fin n) => (b i).val) = List.ofFn fun (i : Fin n) => (negacyclicMul a b i).val

The native list product returns precisely the canonical coefficients of the existing negacyclic multiplication. Positive composite moduli and modulus one are allowed.

def Cslib.Crypto.polyResidues {n m : ℕ} (f : Fin n → ZMod m) :

The canonical residues f₀.val, …, f_{n-1}.val of a polynomial in coefficient form.

def Cslib.Crypto.polyVecResidues {k n m : ℕ} (v : Fin k → Fin n → ZMod m) :

The residue lists of the polynomials of a vector, in order.

@[reducible, inline]

The words of residue lists of polynomial vectors: the framed list of the framed residue lists of the polynomials, each residue in binary.

Coefficientwise addition modulo q of two residue lists, truncated to the shorter one.

Coefficientwise subtraction modulo q of two residue lists, truncated to the shorter one.

The inner product ∑ⱼ aⱼ · rⱼ in ℤ_q[X] / (X^n + 1) of two vectors of residue lists, with n output coefficients. Products are taken over the shorter vector.

Native addition computes polynomial addition.

Native subtraction computes polynomial subtraction.

The native inner product computes innerPoly.

theorem Turing.MultiTapeTM.ComputableInPolyTime.addResidues {α : Type} {input : α ↪ List Bool} {q : α → ℕ} {a b : α → List ℕ} (hq : ComputableInPolyTime q input encNat) (ha : ComputableInPolyTime a input (encList encNat)) (hb : ComputableInPolyTime b input (encList encNat)) :
ComputableInPolyTime (fun (x : α) => Cslib.Crypto.addResidues (q x) (a x) (b x)) input (encList encNat)

Coefficientwise addition of computed residue lists modulo a computed binary modulus.

theorem Turing.MultiTapeTM.ComputableInPolyTime.subResidues {α : Type} {input : α ↪ List Bool} {q : α → ℕ} {a b : α → List ℕ} (hq : ComputableInPolyTime q input encNat) (ha : ComputableInPolyTime a input (encList encNat)) (hb : ComputableInPolyTime b input (encList encNat)) :
ComputableInPolyTime (fun (x : α) => Cslib.Crypto.subResidues (q x) (a x) (b x)) input (encList encNat)

Coefficientwise subtraction of computed residue lists modulo a computed binary modulus.

The native inner product with a computed unary degree and binary modulus.