Documentation

CslibFrontier.Crypto.Computational.SIS.Module

Module-SIS #

This module states the short integer solution problem over the negacyclic polynomial ring R_q = ℤ_q[X] / (X^n + 1) ([Lyu12], [DKL+18]). The unstructured short integer solution problem is in CslibFrontier.Crypto.Computational.SIS.Basic, and Module-LWE over the same ring is in CslibFrontier.Crypto.Computational.LWE.Module. Elements of R_q are represented by their coefficient vectors Fin n → ZMod q, multiplied by negacyclicMul a b = rotMatrix a *ᵥ b; these operations and the ring Negacyclic R n are in CslibFrontier.Foundations.Algebra.Negacyclic.

A d × k module matrix A : Matrix (Fin d) (Fin k) (Fin n → ZMod q) defines the linear map moduleSISMap A z i = ∑ j, negacyclicMul (A i j) (z j) (RingSIS is the rank-1 case). Replacing each polynomial entry A i j by its n × n block rotMatrix (A i j) gives an unstructured (d * n) × (k * n) matrix expandModuleMatrix A over ZMod q that preserves the linear relation (expandModuleMatrix_mulVec), non-zeroness and the ℓ_∞ norm bound under coefficient flattening flattenPolyVec. Consequently, ModuleSIS.IsSolution is equivalent to SIS.IsSolution on expandModuleMatrix A (isSolution_expandModuleMatrix_iff). moduleSISExperiment draws a uniform module matrix and tests the solver's answer as sisExperiment does, and ModuleSIS M asserts that every PPT solver has negligible advantage for the parameter family M. Solver machines read a module matrix through its expansion (ModuleSIS.encodeMatrix). This module proves no relation between ModuleSIS and SIS, whose experiment draws a uniform unstructured matrix.

Main definitions #

Main results #

References #

Module-SIS, Ring-SIS and Structured-to-Unstructured Expansion #

def Cslib.Crypto.moduleSISMap {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (z : Fin k → Fin n → ZMod q) :
Fin d → Fin n → ZMod q

The Module-SIS linear map A · z over ℤ_q[X] / (X^n + 1): the i-th output polynomial is ∑ j : Fin k, negacyclicMul (A i j) (z j).

def Cslib.Crypto.ringSISMap {k n q : ℕ} (a z : Fin k → Fin n → ZMod q) :
Fin n → ZMod q

The Ring-SIS linear map ∑ j : Fin k, negacyclicMul (a j) (z j) over ℤ_q[X] / (X^n + 1) (the rank d = 1 specialization of moduleSISMap).

@[simp]
theorem Cslib.Crypto.moduleSISMap_one_apply {k n q : ℕ} (a z : Fin k → Fin n → ZMod q) :
moduleSISMap (Matrix.of fun (x : Fin 1) (j : Fin k) => a j) z 0 = ringSISMap a z

moduleSISMap on a 1 × k row matrix agrees with ringSISMap.

@[simp]
theorem Cslib.Crypto.moduleSISMap_zero {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) :

moduleSISMap is linear in z: it maps zero to zero.

theorem Cslib.Crypto.moduleSISMap_add {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (y z : Fin k → Fin n → ZMod q) :

moduleSISMap distributes over addition of module vectors.

The coefficient-level Module-SIS map is the matrix-vector product A *ᵥ z over Negacyclic (ZMod q) n.

theorem Cslib.Crypto.moduleSISMap_eq_zero_iff {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (z : Fin k → Fin n → ZMod q) :

A coefficient-level Module-SIS zero equation is the zero equation of A *ᵥ z over Negacyclic (ZMod q) n.

Parameter family for Module-SIS over ℤ_q[X] / (X^n + 1) ([Lyu12], [DKL+18]).

  • n : ℕ → ℕ

    Degree n of the quotient polynomial X^n + 1.

  • d : ℕ → ℕ

    Module rank d (number of rows over R_q).

  • k : ℕ → ℕ

    Number of module columns k (number of ring elements in a solution vector).

  • q : ℕ → ℕ

    Modulus q at each security parameter.

  • β : ℕ → ℕ

    Infinity-norm bound β on polynomial coefficients.

  • hq (security : ℕ) : NeZero (self.q security)

    Every modulus is nonzero.

Parameter family for Ring-SIS over ℤ_q[X] / (X^n + 1) (rank d = 1).

  • n : ℕ → ℕ

    Degree n of the quotient polynomial X^n + 1.

  • k : ℕ → ℕ

    Number of ring elements k in a solution vector.

  • q : ℕ → ℕ

    Modulus q at each security parameter.

  • β : ℕ → ℕ

    Infinity-norm bound β on polynomial coefficients.

  • hq (security : ℕ) : NeZero (self.q security)

    Every modulus is nonzero.

def Cslib.Crypto.flattenPolyVec {k n : ℕ} {α : Type u_1} (z : Fin k → Fin n → α) :
Fin (k * n) → α

Flatten a module vector z : Fin k → Fin n → α of k degree-< n polynomials into a flat vector Fin (k * n) → α via finProdFinEquiv.

def Cslib.Crypto.unflattenPolyVec {k n : ℕ} {α : Type u_1} (v : Fin (k * n) → α) :
Fin k → Fin n → α

Unflatten a vector v : Fin (k * n) → α into a module vector Fin k → Fin n → α via finProdFinEquiv.

@[simp]
theorem Cslib.Crypto.unflattenPolyVec_flattenPolyVec {k n : ℕ} {α : Type u_1} (z : Fin k → Fin n → α) :
@[simp]
theorem Cslib.Crypto.flattenPolyVec_unflattenPolyVec {k n : ℕ} {α : Type u_1} (v : Fin (k * n) → α) :
@[simp]
theorem Cslib.Crypto.flattenPolyVec_apply {k n : ℕ} {α : Type u_1} (z : Fin k → Fin n → α) (j : Fin k) (s : Fin n) :
@[simp]
theorem Cslib.Crypto.flattenPolyVec_zero {k n : ℕ} {α : Type u_1} [Zero α] :
@[simp]
theorem Cslib.Crypto.flattenPolyVec_add {k n : ℕ} {α : Type u_1} [Add α] (y z : Fin k → Fin n → α) :
@[simp]
theorem Cslib.Crypto.flattenPolyVec_eq_zero_iff {k n : ℕ} {α : Type u_1} [Zero α] (z : Fin k → Fin n → α) :

Flattening preserves equality with zero.

theorem Cslib.Crypto.flattenPolyVec_ne_zero_iff {k n : ℕ} {α : Type u_1} [Zero α] (z : Fin k → Fin n → α) :

Flattening preserves non-zeroness.

theorem Cslib.Crypto.intCast_comp_flattenPolyVec {k n q : ℕ} (z : Fin k → Fin n → ℤ) :
Int.cast ∘ flattenPolyVec z = flattenPolyVec fun (j : Fin k) (s : Fin n) => ↑(z j s)

Flattening commutes with coordinatewise casting Int.cast.

def Cslib.Crypto.expandModuleMatrix {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) :
Matrix (Fin (d * n)) (Fin (k * n)) (ZMod q)

Expand a d × k module matrix A over ℤ_q[X] / (X^n + 1) into a (d * n) × (k * n) scalar matrix over ℤ_q by replacing each polynomial entry A i j with its n × n negacyclic multiplication block rotMatrix (A i j).

@[simp]
theorem Cslib.Crypto.expandModuleMatrix_apply {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (i : Fin d) (r : Fin n) (j : Fin k) (s : Fin n) :

A module matrix is determined by its expansion: column 0 of the block rotMatrix (A i j) is the coefficient vector of A i j.

theorem Cslib.Crypto.expandModuleMatrix_mulVec {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (z : Fin k → Fin n → ZMod q) :

Structured-to-unstructured multiplication identity: multiplying expandModuleMatrix A by flattenPolyVec z equals flattening moduleSISMap A z.

@[simp]
theorem Cslib.Crypto.expandModuleMatrix_mulVec_eq_zero_iff {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (z : Fin k → Fin n → ZMod q) :

expandModuleMatrix A *ᵥ flattenPolyVec z = 0 if and only if moduleSISMap A z = 0.

def Cslib.Crypto.ModuleSIS.IsSolution {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (β : ℕ) (z : Fin k → Fin n → ℤ) :

An integer polynomial vector z : Fin k → Fin n → ℤ is a short solution for a module matrix A with bound β when z ≠ 0, every coefficient lies in [-β, β], and moduleSISMap A (fun j s => (z j s : ZMod q)) = 0.

Instances For
    @[instance_reducible]
    instance Cslib.Crypto.ModuleSIS.instDecidableIsSolution {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (β : ℕ) (z : Fin k → Fin n → ℤ) :
    def Cslib.Crypto.ModuleSIS.inInfNormBound {k n q : ℕ} (β : ℕ) (z : Fin k → Fin n → ZMod q) :

    A residue polynomial vector z : Fin k → Fin n → ZMod q satisfies the ℓ_∞ norm bound β when every coefficient's centered representative has absolute value at most β.

    Instances For
      @[instance_reducible]
      instance Cslib.Crypto.ModuleSIS.instDecidableInInfNormBound {k n q : ℕ} (β : ℕ) (z : Fin k → Fin n → ZMod q) :
      def Cslib.Crypto.ModuleSIS.IsResidueSolution {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (β : ℕ) (z : Fin k → Fin n → ZMod q) :

      Residue-level Module-SIS solution predicate: z ≠ 0, inInfNormBound β z, and moduleSISMap A z = 0.

      Instances For
        @[instance_reducible]
        instance Cslib.Crypto.ModuleSIS.instDecidableIsResidueSolution {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (β : ℕ) (z : Fin k → Fin n → ZMod q) :
        @[simp]
        theorem Cslib.Crypto.ModuleSIS.forall_abs_flattenPolyVec_le_iff {k n β : ℕ} (z : Fin k → Fin n → ℤ) :
        (∀ (c : Fin (k * n)), |flattenPolyVec z c| ≤ ↑β) ↔ ∀ (j : Fin k) (s : Fin n), |z j s| ≤ ↑β

        Flattening preserves the ℓ_∞ bound on integer polynomial vectors.

        @[simp]

        Flattening preserves inInfNormBound on residue polynomial vectors.

        theorem Cslib.Crypto.ModuleSIS.isSolution_expandModuleMatrix_iff {d k n q β : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) (z : Fin k → Fin n → ℤ) :

        Equivalence of Module-SIS and unstructured SIS on expandModuleMatrix: an integer polynomial vector z is a ModuleSIS.IsSolution for A if and only if flattenPolyVec z is an SIS.IsSolution for expandModuleMatrix A.

        Equivalence of residue-level Module-SIS and unstructured SIS on expandModuleMatrix: flattenPolyVec z is a SIS.IsResidueSolution for expandModuleMatrix A if and only if z is a ModuleSIS.IsResidueSolution for A.

        def Cslib.Crypto.ModuleSIS.encodeMatrix {d k n q : ℕ} (A : Matrix (Fin d) (Fin k) (Fin n → ZMod q)) :

        Encode a module matrix A over ℤ_q[X] / (X^n + 1) by encoding its expanded block matrix expandModuleMatrix A.

        Module matrices of fixed shape are determined by their encodings when q ≠ 0.

        def Cslib.Crypto.ModuleSIS.encodeVec {k n : ℕ} (z : Fin k → Fin n → ℤ) :

        Encode an integer polynomial vector z : Fin k → Fin n → ℤ by encoding flattenPolyVec z.

        Integer polynomial vectors of fixed shape are determined by their encodings.

        The fixed-instance experiment #

        noncomputable def Cslib.Crypto.moduleSISExperiment (q : ℕ) [NeZero q] {d k n : ℕ} (β : ℕ) (S : Matrix (Fin d) (Fin k) (Fin n → ZMod q) → ProbComp (Fin k → Fin n → ℤ)) :

        The Module-SIS experiment over ℤ_q[X] / (X^n + 1) with a d × k module matrix and bound β ([Lyu12], [DKL+18]): the challenger draws a uniform module matrix A; the solver wins when it returns a short solution for A.

        noncomputable def Cslib.Crypto.moduleSISAdvantage (q : ℕ) [NeZero q] {d k n : ℕ} (β : ℕ) (S : Matrix (Fin d) (Fin k) (Fin n → ZMod q) → ProbComp (Fin k → Fin n → ℤ)) :

        The Module-SIS advantage of S: its success probability in moduleSISExperiment.

        Parameter families #

        The input of a Module-SIS solver for the family M: the security parameter and a module matrix of the shape, degree and modulus that M assigns to it.

        The words a machine reads for a Module-SIS input: the security parameter and the encoded module matrix.

        A Module-SIS input is determined by its words.

        The encoding of a Module-SIS input: the framed unary security parameter followed by the encoded module matrix (encInput_apply).

        @[reducible, inline]

        A Module-SIS solver for the family M: given the security parameter κ and a module matrix of the shape, degree and modulus of M at κ, it returns an integer polynomial vector. Solver.IsPPT states its efficiency on encodings.

        A Module-SIS solver is PPT when one uniform strict PPT machine reads encInput and writes the encoding of the solver's answer.

        The Module-SIS hardness hypothesis for a parameter family M: every PPT solver has negligible advantage in moduleSISExperiment at the parameters M assigns to each security parameter. This is a hypothesis against classical adversaries, not a theorem of hardness.

        Source. This is M-SIS_{q,m,β} of [LS15], Definition 3.5, p. 12 (ePrint version 2012/090): given a₁, …, a_m ∈ R_q^d drawn independently and uniformly, here the k columns of A, find z ∈ R^m with ∑ aᵢ zᵢ = 0 mod q and 0 < ‖z‖ ≤ β. [DKL+18], Section 4.1, p. 249, states it over R_q = ℤ_q[X]/(X^n + 1) (Section 2.1, p. 242) with the ℓ_∞ norm, as MSIS_{m,k,γ}. This definition differs from these as follows.

        • The bound β is on the ℓ_∞ norm of the coefficients, as in Ducas et al. Langlois and Stehlé work over the ring of integers R of a cyclotomic field with the Euclidean norm of the canonical embedding (Section 2.1).
        • The matrix is uniform, as in Langlois and Stehlé; Ducas et al. take it in Hermite normal form [I | A] with A uniform. The two forms are equivalent up to the probability that a uniform square block over R_q is invertible, which is close to 1 for Ducas et al.'s q but not for every q (for example q = 2).
        • The ring is ℤ_q[X]/(X^n + 1) for any n and q, where Ducas et al. fix n = 256 and q = 8380417; for n not a power of two, X^n + 1 is not cyclotomic, so the ring is outside Langlois and Stehlé's setting too. The solvers are uniform classical strict PPT programs, and their success probability must be negligible in κ.
        @[reducible, inline]

        The Ring-SIS hardness hypothesis is ModuleSIS at module rank 1. This is the ring version of ℓ₂-SIS that [Lyu12], Section 7, pp. 21–22 (ePrint full version 2011/537), uses, with uniform a₁, …, a_γ ∈ ℤ_q[x]/⟨xⁿ + 1⟩ for n a power of two, and R-SIS_{q,m,β} of [LS15], Definition 3.3, p. 12. It differs from them as ModuleSIS does: the ℓ_∞ norm of the coefficients in place of the Euclidean norm, any n and q, and uniform classical strict PPT solvers.