Expand description
Welcome the the concrete-npe documentation!
§Description
This library makes it possible to estimate the noise propagation after homomorphic operations. It makes it possible to obtain characteristics of the output distribution of the noise, that we call dispersion, which regroups the variance and expectation. This is particularly useful to track the noise growth during the homomorphic evaluation of a circuit. The explanations and the proofs of these formula can be found in the appendices of the article Improved Programmable Bootstrapping with Larger Precision and Efficient Arithmetic Circuits for TFHE by Ilaria Chillotti, Damien Ligier, Jean-Baptiste Orfila and Samuel Tap.
§Quick Example
The following piece of code shows how to obtain the variance $\sigma_{add}$ of the noise after a simulated homomorphic addition between two ciphertexts which have variances $\sigma_{ct_1}$ and $\sigma_{ct_2}$, respectively.
§Example:
use concrete_core::prelude::{DispersionParameter, Variance};
use concrete_npe::estimate_addition_noise;
//We suppose that the two ciphertexts have the same variance.
let var1 = Variance(2_f64.powf(-25.));
let var2 = Variance(2_f64.powf(-25.));
//We call the npe to estimate characteristics of the noise after an addition
//between these two variances.
//Here, we assume that ciphertexts are encoded over 64 bits.
let var_out = estimate_addition_noise::<_, _>(var1, var2, 64);
println!("Expect Variance (2^24) = {}", 2_f64.powi(-24));
println!("Output Variance {}", var_out.get_variance());
assert!((2_f64.powi(-24) - var_out.get_variance()).abs() < 0.0001);Traits§
- KeyDispersion
- This trait contains functions related to the dispersion of secret key coefficients, and operations related to the secret keys (e.g., products of secret keys).
Functions§
- estimate_
addition_ noise - Computes the dispersion of an addition of two uncorrelated ciphertexts.
- estimate_
bit_ extraction_ noise - Computes the dispersions of ciphertexts encrypting the bits after bit extraction, the dispersion of the ciphertext of the most significant bit extracted is first and of the least significant bit last.
- estimate_
circuit_ bootstrapping_ binary_ noise - Computes the dispersion of a circuit bootstrapping for a binary message and a binary secret
key, each ciphertext output is the result of a PBS followed by a private functional
keyswitch where the private function is “multiplication by x” where
xis one component of a GLWE secret key, hence a polynomial with binary coefficients, or is the identity function. - estimate_
cmux_ noise_ with_ binary_ ggsw - Computes the dispersion of a CMUX controlled with a GGSW encrypting binary keys.
- estimate_
external_ product_ noise_ with_ binary_ ggsw - Computes the dispersion of an external product (between and RLWE and a GGSW) encrypting a binary keys (i.e., as in TFHE PBS).
- estimate_
integer_ plaintext_ multiplication_ noise - Computes the dispersion of a multiplication of a ciphertext by a scalar.
- estimate_
keyswitch_ noise_ lwe_ to_ glwe_ with_ constant_ terms - Computes the dispersion of the constant terms of a GLWE after an LWE to GLWE keyswitch.
- estimate_
keyswitch_ noise_ lwe_ to_ glwe_ with_ non_ constant_ terms - Computes the dispersion of the non-constant GLWE terms after an LWE to GLWE keyswitch.
- estimate_
modulus_ switching_ noise_ with_ binary_ key - Computes the dispersion of a modulus switching of an LWE encrypted with binary keys.
- estimate_
msb_ noise_ rlwe - Computes the dispersion of the bits greater than $q$ after a modulus switching.
- estimate_
multiplication_ noise - Computes the dispersion of a GLWE multiplication between two GLWEs (i.e., a tensor product followed by a relinearization).
- estimate_
number_ of_ noise_ bits - Computes the number of bits affected by the noise with a dispersion describing a normal distribution.
- estimate_
pbs_ noise - Computes the dispersion of a PBS a la TFHE (i.e., the GGSW encrypts a binary keys, and the initial noise for the RLWE is equal to zero).
- estimate_
polynomial_ plaintext_ multiplication_ noise - Computes the dispersion of a multiplication between an RLWE ciphertext and a scalar polynomial.
- estimate_
private_ functional_ keyswitch_ noise_ lwe_ to_ glwe_ with_ constant_ terms - Computes the dispersion of the constant terms of a GLWE after an LWE to GLWE private functional keyswitch.
- estimate_
relinearization_ noise - Computes the dispersion of a GLWE after relinearization.
- estimate_
several_ additions_ noise - Computes the dispersion of an addition of several uncorrelated ciphertexts.
- estimate_
tensor_ product_ noise - Computes the dispersion of a tensor product between two independent GLWEs given a set of parameters.
- estimate_
vertical_ packing_ noise - Compute the dispersion after a vertical packing. The output ciphertext is the result of n sequential CMUX operations where n is the number of GGSW ciphertexts given. During a PBS the final blind rotation also performs n sequential CMUX operations so we can use the same noise estimation formula.
- estimate_
weighted_ sum_ noise - Computes the dispersion of a multisum between uncorrelated ciphertexts and scalar weights $w_i$ i.e., $\sigma_{out}^2 = \sum_i w_i^2 * \sigma_i^2$.
- estimate_
wop_ pbs_ noise - Compute the dispersion after a WoP-PBS.