Documentation

CslibFrontier.Crypto.Computational.SIS.ModulusSwitch

Rounded modulus switching for Module-LWE ciphertext phases #

The existing ciphertext type is converted coefficientwise using ZMod.modulusSwitch. Its canonical centered lifts may be replaced by arbitrary integer representatives. An explicit carry polynomial accounts for wraparound at the source modulus. The switched phase has an integer representative differing from the rationally scaled original phase by at most half of one plus the full coefficient ℓ₁ norm of the integer secret.

This is original supporting nearest-integer algebra. It is not the parity-preserving switching variant: half-integer ties round toward positive infinity. No Boolean decoding preservation, security reduction, sampling law, or native runtime bound is claimed.

Main definitions #

Main results #

Convert both components of a Module-LWE ciphertext by canonical nearest-integer scaling.

theorem Cslib.Crypto.exists_moduleLWEModulusSwitch_phase_of_lifts {k n q p : ℕ} (hq : 0 < q) (hp : 0 < p) (ct : ModuleLWECiphertext k n q) (u s : Fin k → Fin n → ℤ) (v e w : Fin n → ℤ) (hu : (fun (j : Fin k) (i : Fin n) => ↑(u j i)) = ct.1) (hv : (fun (i : Fin n) => ↑(v i)) = ct.2) (hphase : v - innerPoly u s = fun (i : Fin n) => e i + ↑q * w i) :
∃ (e' : Fin n → ℤ), (((moduleLWEModulusSwitch p ct).2 - innerPoly (moduleLWEModulusSwitch p ct).1 fun (j : Fin k) (i : Fin n) => ↑(s j i)) = fun (i : Fin n) => ↑(e' i)) ∧ (∀ (i : Fin n), |↑(e' i) - ↑p / ↑q * ↑(e i)| ≤ (1 + ∑ j : Fin k, ∑ l : Fin n, |↑(s j l)|) / 2) ∧ ∀ (i : Fin n), |↑(e' i)| ≤ ↑p / ↑q * |↑(e i)| + (1 + ∑ j : Fin k, ∑ l : Fin n, |↑(s j l)|) / 2

A switched phase has an integer representative close to the scaled original phase.

The secret at both moduli is the cast of the same integer vector s. The carry equation is an integer equation, not an assumption about rounded values or the desired error bound. Both moduli are positive; no relative-size, primality or nontriviality assumption is needed.

theorem Cslib.Crypto.exists_moduleLWEModulusSwitch_phase_of_intCast {k n q p : ℕ} (hq : 0 < q) (hp : 0 < p) (ct : ModuleLWECiphertext k n q) (s : Fin k → Fin n → ℤ) (e : Fin n → ℤ) (he : (fun (i : Fin n) => ↑(e i)) = ct.2 - innerPoly ct.1 fun (j : Fin k) (l : Fin n) => ↑(s j l)) :
∃ (e' : Fin n → ℤ), (((moduleLWEModulusSwitch p ct).2 - innerPoly (moduleLWEModulusSwitch p ct).1 fun (j : Fin k) (i : Fin n) => ↑(s j i)) = fun (i : Fin n) => ↑(e' i)) ∧ (∀ (i : Fin n), |↑(e' i) - ↑p / ↑q * ↑(e i)| ≤ (1 + ∑ j : Fin k, ∑ l : Fin n, |↑(s j l)|) / 2) ∧ ∀ (i : Fin n), |↑(e' i)| ≤ ↑p / ↑q * |↑(e i)| + (1 + ∑ j : Fin k, ∑ l : Fin n, |↑(s j l)|) / 2

The phase bound for any supplied integer representative of the original phase. Carries are constructed from the modular phase identity, including representatives outside the centered interval. This lets plaintext/error decompositions reuse the same rounding bound.

theorem Cslib.Crypto.exists_moduleLWEModulusSwitch_phase {k n q p : ℕ} (hq : 0 < q) (hp : 0 < p) (ct : ModuleLWECiphertext k n q) (s : Fin k → Fin n → ℤ) :
∃ (e' : Fin n → ℤ), (((moduleLWEModulusSwitch p ct).2 - innerPoly (moduleLWEModulusSwitch p ct).1 fun (j : Fin k) (i : Fin n) => ↑(s j i)) = fun (i : Fin n) => ↑(e' i)) ∧ (∀ (i : Fin n), |↑(e' i) - ↑p / ↑q * ↑((ct.2 - innerPoly ct.1 fun (j : Fin k) (l : Fin n) => ↑(s j l)) i).valMinAbs| ≤ (1 + ∑ j : Fin k, ∑ l : Fin n, |↑(s j l)|) / 2) ∧ ∀ (i : Fin n), |↑(e' i)| ≤ ↑p / ↑q * |↑((ct.2 - innerPoly ct.1 fun (j : Fin k) (l : Fin n) => ↑(s j l)) i).valMinAbs| + (1 + ∑ j : Fin k, ∑ l : Fin n, |↑(s j l)|) / 2

The actual switched ciphertext phase is close to the scaled canonical original phase. Integer carries exist automatically; no no-wrap assumption is needed. The secret at the new modulus is obtained from the same integer secret s, not by rounding the secret.