D-2.11 Noise Bootstrapping

- Reference 1: Bootstrapping for BGV and BFV Revisited [14]

- Reference 2: Bootstrapping for HELib [15]

- Reference 3: A Note on Lower Digits Extraction Polynomial for Bootstrapping [16]

- Reference 4: Fully Homomorphic Encryption for Cyclotomic Prime Moduli [17]

In BFV, continuous ciphertext-to-ciphertext multiplication increases the noise in a multiplicative manner, and once the noise overflows the message bits, then the message gets corrupted. Bootstrapping is a process of resetting the grown noise.

D-2.11.1 High-level Idea

In this subsection, we will assume the plaintext modulus t = p, a prime number. Although t can be generalized as t = pr where r 𝕀 and r 1 (Summary D-2.3 in §D-2.3), we will explain BFV’s bootstrapping assuming t = p for simplicity, and then generalize t as t = pr in the end.

The core idea of the BFV bootstrapping is to homomorphically evaluate a special polynomial G𝜀(x), a digit extraction polynomial modulo p𝜀 (for some positive integer 𝜀), where the input to G𝜀(x) is a noisy plaintext value modulo p𝜀 and the output is a noise-free plaintext value modulo p𝜀, where the noise located at the least significant digits in a base-p (prime) representation gets zeroed out. For example, G𝜀(3p3 + 4p2 + 6p + 2) = 3p3 + 4p2 + 6p mod p𝜀. Given the noise resides in the least significant 𝜀 1 digits in base-p representation, we can homomorphically recursively evaluate G𝜀(x) total 𝜀 1 times in a row, which zeros out the least significant (base-p) 𝜀 1 digits of input x. To homomorphically evaluate the noisy plaintext through G𝜀(x) mod p𝜀, we need to first switch the plaintext modulus from t to p𝜀, where q p𝜀 > p = t. The larger 𝜀 is, the more likely that the noise gets successfully zeroed out, but instead the computation overhead becomes larger. If 𝜀 is small, the computation gets faster, but the digit-wise distance between the noise and the plaintext gets smaller, potentially corrupting the plaintext during bootstrapping, because removing the most significant noise digit may remove the least significant plaintext digit as well. Therefore, 𝜀 should be chosen carefully.

The technical details of the BFV bootstrapping procedure are as follows. Suppose we have an RLWE ciphertext (A,B) = 𝖱𝖫𝖶𝖤S,σ(ΔM) mod q, where A S + B = ΔM + E, Δ = q t and t = p (i.e., the plaintext modulus is a prime).

1.
Modulus Switch (q p𝜀): Scale down the ciphertext modulus from (A,B) mod q to (p𝜀 q A, p𝜀 q B) = (A,B) mod p𝜀, where p𝜀 q. The purpose of this modulus switch is to change the plaintext modulus to p𝜀, which is required to use the digit extraction polynomial G𝜀(x) (because we need to represent the input to G𝜀(x) as a base-p number in order to interpret it as a mod p𝜀 value). Notice that 𝖱𝖫𝖶𝖤S,σ1(𝖼𝗍 = (A,B)) = p𝜀1M + E, where E p𝜀 q E + (q p p𝜀 q p𝜀1) M # the modulus switch error of E E plus the modulus switch error of the plaintext’s scaling factor q t p𝜀1

2.
Homomorphic Decryption: Suppose we have the bootstrapping key 𝖱𝖫𝖾𝗏S,σβ,l(S) mod q, which is the secret key S encrypted by S (itself) modulo q. Using this encrypted secret key, we homomorphically decrypt (A,B) as follows:

A𝖱𝖫𝖶𝖤S,σ(ΔS) + B # where 𝖱𝖫𝖶𝖤S,σ(ΔS) is a modulo-q ciphertext that encrypts a modulo-p𝜀 plaintext S whose scaling factor Δ = q p𝜀

= 𝖱𝖫𝖶𝖤S,σ(Δ(AS)) + Bmod q

= 𝖱𝖫𝖶𝖤S,σ(Δ(AS + B)) mod q

= 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + E+ Kp𝜀)) mod q # K is some integer polynomials to represent the coefficient values that wrap around p𝜀

Let’s see how we derived the above relation. Suppose we compute AS + Bmod p𝜀, whose output will be p𝜀1M + E. Now, instead of using the plaintext secret key S, we use an encrypted secret key 𝖱𝖫𝖶𝖤S,σ(ΔS), where S is a plaintext modulo p𝜀, its scaling factor Δ = q p𝜀, and the ciphertext encrypting S is in modulo q. Then, the result of homomorphically computing A𝖱𝖫𝖶𝖤S,σ(ΔS) + B will be an encryption of p𝜀1M + E+ Kp𝜀, where Kp𝜀 stands for the wrapping-around coefficient values of the multiples of p𝜀.

Notice that we did not reduce Kp𝜀 by modulo p𝜀 during homomorphic decryption (without modulo-q reduction), because such a homomorphic modulo reduction is not directly doable. Instead, we will handle Kp𝜀 in the later digit extraction step.

For simplicity, we will denote Z = p𝜀1M + Emod p𝜀.

3.
CoeffToSlot: Move the (encrypted) polynomial Z’s coefficients z0,zi,,zn1 to the input vector slots of an RLWE ciphertext. This is done by computing:

𝖱𝖫𝖶𝖤S,σ(Z) n1 W~ IRn

, where n1 W~ IRn is the batch encoding matrix that converts input vector slot values into polynomial coefficients (Summary D-2.9.3 in §D-2.9.3).

4.
Digit Extraction: We design a polynomial G𝜀(x) (a digit extraction polynomial) zeros out the least significant base-p digit(s) by recursively evaluating the polynomial. Using each zi (i.e., the i-th coefficient of Z) as an input, we recursively evaluate G𝜀(zi) total 𝜀 1 times consecutively, which effectively zeros out the least significant 𝜀 1 digits of the base-p representation of zi (i.e., noise value), and keeps only the most significant base-p digit of x (i.e., plaintext value). Throughout the digit extraction, the value stored at the input vector slots of the ciphertext gets updated from p𝜀1M + E+ Kp𝜀 to p𝜀1M + Kp𝜀.

5.
SlotToCoeff: Homomorphically move each input vector slot’s value back to the (encrypted) polynomial coefficient position. This is done by homomorphically multiplying the decoding matrix W~ to the ciphertext (Summary D-2.9.3 in §D-2.9.3).

6.
Scaling Factor Re-interpretation: At this point, we have the ciphertext 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + Kp𝜀)) mod q, where the plaintext modulus is p𝜀 and the plaintext scaling factor Δ = q p𝜀. Without doing any actual additional computation, we can view this ciphertext as 𝖱𝖫𝖶𝖤S,σ(q pM)) = modq, which is an encryption of plaintext modulus p whose scaling factor Δ = q p. This is because:

𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + Kp𝜀)) = 𝖱𝖫𝖶𝖤S,σ( q p𝜀 (p𝜀1M + Kp𝜀))

= 𝖱𝖫𝖶𝖤S,σ (q pM + Kq)

= 𝖱𝖫𝖶𝖤S,σ (q pM )

In other words, we can view the ciphertext 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + Kp𝜀)) mod q whose plaintext modulus is p𝜀 and scaling factor Δ = q p𝜀 as another ciphertext 𝖱𝖫𝖶𝖤S,σ(ΔM) mod q whose plaintext modulus is p and scaling factor Δ = q p.

Notice that the final ciphertext 𝖱𝖫𝖶𝖤S,σ(ΔM)’s scaling factor stays the same as before the bootstrapping, while the original noises E and E have been eliminated. On the other hand, the homomorphic operation of CoeffToSlot, digit extraction, and SlotToCoeff must have accumulated additional noises, but their size is fixed and smaller than E and E.

Next, we will explain each step more in detail.

D-2.11.2 Modulus Switch

The first step of the BFV bootstrapping is to do a modulus switch from q to some prime power modulus p𝜀 where p𝜀 q. Before the bootstrapping, suppose the encrypted plaintext with noise is ΔM + E mod q. Then, after the modulus switch from q p𝜀, the plaintext would scale down to p𝜀1M + Emod p𝜀, where E roughly contains p𝜀 q E plus the modulus switching noise of the plaintext’s scaling factor Δ p𝜀1. The goal of the BFV bootstrapping is to zero out this noise E.

D-2.11.3 Homomorphic Decryption

Let’s denote the modulus-switched noisy plaintext as Z = p𝜀1M + Emod p𝜀. We further denote polynomial Z’s each degree term’s coefficient zi as base-p number as follows:

zi = zi,𝜀1p𝜀1 + zi,𝜀2p𝜀2 + + zi,1p + zi,0 mod p𝜀

Then, zi mod p𝜀 is a base-p number comprising 𝜀 digits: {zi,𝜀1,zi,𝜀2,,zi,0}

We assume that the highest base-p digit index for the noise is 𝜀 2, which is equivalent to the noise budget, and the pure plaintext portion solely resides at the base-p digit index 𝜀 1 (i.e., the most significant base-p digit in modulo p𝜀). Given this assumption, we extract the noise-free plaintext by computing the following:

zi p𝜀1 mod p = zi,𝜀1 # where the noise is assumed to be smaller than p𝜀1 2

The above formula is equivalent to shifting the base-p number zi by 𝜀 1 digits to the right (and rounding the decimal value). However, remember that we don’t have direct access to polynomial Z = p𝜀1M + Emod p𝜀 unless we have the secret key S to decrypt the ciphertext storing the plaintext. Instead, we can only derive Z as an encrypted form. Specifically, we can homomorphically decrypt the modulus-switched ciphertext (A,B) by using the encrypted secret key 𝖱𝖫𝖶𝖤S,σ(ΔS) as a bootstrapping key. For this ciphertext 𝖱𝖫𝖶𝖤S,σ(ΔS), the plaintext modulus is p𝜀, the plaintext scaling factor is Δ = q p𝜀, and the ciphertext modulus is q. With this encrypted secret key S, we homomorphically decrypt the encrypted Z as follows:

(p𝜀 q A, p𝜀 q B) = (A,B) mod p𝜀

A𝖱𝖫𝖶𝖤S,σ(ΔS) + Bmod q

= 𝖱𝖫𝖶𝖤S,σ(Δ(AS)) + Bmod q

= 𝖱𝖫𝖶𝖤S,σ(Δ(AS + B)) mod q

= 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + E+ Kp𝜀)) mod q # K is some integer polynomials to represent the coefficient values that wrap around modulo p𝜀 as multiples of p𝜀

= 𝖱𝖫𝖶𝖤S,σ(ΔZ) mod q

During this homomorphic decryption, we did not reduce the plaintext result by modulo p𝜀, because the homomorphic decryption is a ciphertext-to-plaintext multiplication and addition done in the ciphertext modulus q (not p𝜀) by using A and B as plaintexts (with the plaintext modulus pe) and 𝖱𝖫𝖶𝖤S,σ(ΔS) as a ciphertext (with the ciphertext modulus q). This is why the wrapping term Kp𝜀 is preserved in the plaintext after the homomorphic decryption– we will handle this term at the later stage of bootstrapping. Also, notice that the computation of A𝖱𝖫𝖶𝖤S,σ(ΔS) would not generate much noise. This is because A is a plaintext modulo p𝜀, and thus the new noise generated by ciphertext-to-plaintext multiplication is AEs (where Es is the encryption noise of 𝖱𝖫𝖶𝖤S,σ(ΔS)). Since the ciphertext modulus q p𝜀, q AEs.

Once we have derived 𝖱𝖫𝖶𝖤S,σ(ΔZ), our next step is to remove the noise in the lower 𝜀 1 digits (in terms of base-p representation) of each zi for 0 i n 1. This is equivalent to transforming noisy 𝖱𝖫𝖶𝖤S,σ(ΔZ) = 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + E+ Kp𝜀)) into noise-free 𝖱𝖫𝖶𝖤S,σ(ΔM)) where Δ = q p. BFV’s solution to do this is to design a p-degree polynomial function which computes the same logical result as zi p𝜀1 mod p. We will later explain how to design this polynomial by using the digit extraction polynomial G𝜀(x) (§D-2.11.5).

However, in order to homomorphically evaluate this polynomial at each coefficient zi given the ciphertext 𝖱𝖫𝖶𝖤S,σ(ΔZ), we need to move polynomial Z’s each coefficient zi to the input vector slots of an RLWE ciphertext. This is because BFV supports homomorphic batched (+,⋅) operations based on input vector slots of ciphertexts as operands. Therefore, we need to evaluate the noise-removing polynomial G𝜀(x) based on the values stored in the input vector slots of a ciphertext.

In the next sub-section, we will explain the CoeffToSlot procedure, a process of moving polynomial coefficients into input vector slots of a ciphertext homomorphically.

D-2.11.4 CoeffToSlot and SlotToCoeff

The goal of the CoeffToSlot step is to homomorphically move polynomial Z’s coefficients zi to input vector slots.

In Summary D-2.9.3 (in §D-2.9.3), we learned that the encoding formula for converting a vector of input slots v into a vector of polynomial coefficients m is: m = n1 W~ InR v, where W~ is a basis of the n-dimensional vector space crafted as follows:

W~ = [ 1 1 1 1 1 1 (ωJ(n 2 1)) (ωJ(n 2 2)) (ωJ(0)) (ωJ(n 2 1)) (ωJ(n 2 2)) (ωJ(0)) (ωJ(n 2 1))2 (ωJ(n 2 2))2 (ωJ(0))2 (ωJ(n 2 1))2 (ωJ(n 2 2))2 (ωJ(0))2 (ωJ(n 2 1))n1 (ωJ(n 2 2))n1 (ωJ(0))n1 (ωJ(n 2 1))n1 (ωJ(n 2 2))n1 (ωJ(0))n1 ]

# where the rotation helper function J(h) = 5h mod 2n

Therefore, given the input ciphertext 𝖼𝗍 = 𝖱𝖫𝖶𝖤S,σ(ΔZ) mod q, we can understand its input vector slots as storing some values such that multiplying n1 W~ InR to each of them turns them into a coefficient zi of polynomial Z. This implies that if we homomorphically multiply n1 W~ InR to the input vector slots of 𝖱𝖫𝖶𝖤S,σ(ΔZ), then the resulting ciphertext’s n-dimensional input vector slots will contain the n coefficients of Z, which is equivalent to moving the coefficients of Z to the input vector slots. Therefore, the CoeffToSlot step is equivalent to homomorphically computing n1 W~ InR 𝖱𝖫𝖶𝖤S,σ(ΔZ). We can homomorphically compute matrix-vector multiplication by using the technique explained in §D-2.10.

After the CoeffToSlot step, we can homomorphically eliminate the noise in the lower 𝜀 1 base-p digits of each zi by homomorphically evaluating the noise-removing polynomial (to be explained in the next subsection).

After we get noise-free coefficients of Z, we need to move them back from the input vector slots to their original coefficient positions. This step is called SlotToCoeff, which is an exact inverse procedure of CoeffToSlot. We also learned in Summary D-2.9.3 (in §D-2.9.3) that the inverse matrix of n1 W~ InR is W~, where:

W~ = [ 1 (ωJ(0)) (ωJ(0))2 (ωJ(0))n1 1 (ωJ(1)) (ωJ(1))2 (ωJ(1))n1 1 (ωJ(2)) (ωJ(2))2 (ωJ(2))n1 1 (ωJ(n 2 1)) (ωJ(n 2 1))2 (ωJ(n 2 1))n1 1 (ωJ(0)) (ωJ(0))2 (ωJ(0))n1 1 (ωJ(1)) (ωJ(1))2 (ωJ(1))n1 1 (ωJ(2)) (ωJ(2))2 (ωJ(2))n1 1 (ωJ(n 2 1)) (ωJ(n 2 1))2 (ωJ(n 2 1))n1 ]

Therefore, the SlotToCoeff step is equivalent to homomorphically multiplying W~ to the output of the noise-eliminating polynomial evaluation.

In the next subsection, we will learn how to design the core algorithm of BFV, the noise elimination polynomial, based on the digit extraction polynomial G𝜀(x).

D-2.11.5 Digit Extraction

Remember we defined polynomial Z as the scaled noisy plaintext: Z = p𝜀1M + E+ Kp𝜀 = p𝜀1M + Emod p𝜀, and each zi is the i-th coefficient of Z (where 0 i n 1). The goal of the digit extraction step is to homomorphically zero out the lower (base-p) 𝜀 1 digits of each zi, where the noise resides.

First, we always think of zi as a base-p number (since this is a modulo-p𝜀 value) as follows:

zi = zi,𝜀1p𝜀1 + zi,𝜀2p𝜀2 + + zi,2p2 + zi,1p + zi,0 mod p𝜀

Next, we define a new notation that denotes zi in a different way as follows:

zi = d0 + ( j=𝜀𝜀1dpj)

, where d0 p, and d 𝕀, and 𝜀 is zi’s least significant base-p digit index whose value is non-zero after digit index 0. Therefore, each zi p𝜀 is mapped to a unique set of (d0,d,𝜀).

Next, we define a lifting polynomial F𝜀 in terms of zi and its associated (d0,d,𝜀) as follows:

F𝜀(zi) d0 mod p𝜀+1

Verbally speaking, F𝜀(zi) processes zi in such a way that it keeps zi,0 (i.e., zi’s value at the base-p digit index 0) the same as before, then finds the next least significant base-p digit whose value is non-zero (whose digit index is denoted as 𝜀) and zeros it, during which the subsequent higher significant base-p digits may get updated to any arbitrary values (i.e., the function doesn’t care about those values whose base-p digit index is higher than 𝜀 because they fall outside the modulo p𝜀+1 range).

We will show an example of how zi is updated if it is evaluated by the F𝜀 function recursively total 𝜀 1 times in a row as follows:

F𝜀1F3 F2 F1 𝜀1 times(zi)

1st Recursion: F1(zi) = ci,𝜀1p𝜀1 + ci,𝜀2p𝜀2 + + ci,2p2 + 0p + zi,0 mod p𝜀 # F1(zi) zi,0 mod p2

2nd Recursion: F2 F1(zi) = ci,𝜀1p𝜀1 + ci,𝜀2p𝜀2 + + 0p2 + 0p + zi,0 mod p𝜀 # F1 F2(zi) zi,0 mod p3

3rd Recursion: F3 F2 F1(zi) = ci,𝜀1p𝜀1 + ci,𝜀2p𝜀2 + + 0p3 + 0p2 + 0p + zi,0 mod p𝜀 # F3 F2 F1(zi) zi,0 mod p4

(𝜀 1)-th Recursion: F𝜀1 F3 F2 F1 𝜀1 times(zi) = 0p𝜀1 + 0p𝜀2 + + 0p2 + 0p + zi,0 mod p𝜀 # F𝜀1F3 F2 F1(zi) zi,0 mod p𝜀

In the above recursive computation, notice that the order of using function F𝜀 is specifically F1 F2 F3 F𝜀1. We choose this specific order because we assume that for the initial input zi, we don’t know its associated 𝜀 value (i.e., the least significant base-p digit index whose value is non-zero after digit index 0). If we choose the order F1 F2 F3 F𝜀1, then regardless of the value of zi, we get the universal guarantee that the final output will be zi,0 mod p𝜀 (i.e., the value of the base-p digit index 0).

Now, we define the digit extraction function G𝜀,v(zi) as follows:

G𝜀,v(zi) = zi (F𝜀1 F𝜀2 F𝜀3 F𝜀v v times(zi) mod p𝜀

Notice that G𝜀,v(zi) is equivalent to zeroing out the least significant base-p digit of zi. Let’s see what happens if we recursively evaluate G𝜀,v at zi for v = 𝜀 1,𝜀 2,,1 (total 𝜀 1 times):

1st Recursion: G𝜀,𝜀1(zi) = zi,𝜀1p𝜀1 + zi,𝜀2p𝜀2 + + zi,2p2 + zi,1p + 0 mod p𝜀

2nd Recursion: G𝜀,𝜀2 G𝜀,𝜀1(zi) = zi,𝜀1p𝜀1 + zi,𝜀2p𝜀2 + + zi,2p2 + 0p + 0 mod p𝜀

3rd Recursion: G𝜀,𝜀3 G𝜀,𝜀2 G𝜀,𝜀1(zi) = zi,𝜀1p𝜀1 + zi,𝜀2p𝜀2 + + 0p2 + 0p + 0 mod p𝜀

𝜀 1-th Recursion: G𝜀,1 G𝜀,𝜀2 G𝜀,𝜀1(zi) = zi,𝜀1p𝜀1 + 0p𝜀2 + + 0p + 0 mod p𝜀

As shown above, recursively evaluating G𝜀,v at zi for v = 𝜀 1,𝜀 2,,1 (total 𝜀 1 times) is equivalent to zeroing out the least significant (base-p) 𝜀 1 digits modulo p𝜀.

By recursively applying the digit extraction function G𝜀,v as above, we can zero out the noise stored at the least significant (base-p) 𝜀 1 digit indices.

Now, our final remaining task is to design the actual lifting polynomial F𝜀(zi) that implements G𝜀,v.

Designing F𝜀(zi): We will derive F𝜀(zi) based on the following steps.

1.
Let’s define zi = zi,0 + j=𝜀𝜀1zi,jpj = zi,0 + kp𝜀

, where zi,0 [0,p 1], 𝜀 is the least significant base-p digit’s index of zi which has a non-zero value, and k = p𝜀 j=𝜀𝜀1zi,jpj [0,p𝜀𝜀 1].

Basically, zi can be any number in p𝜀 whose base-p representation has 0s between the base-p digit index greater than 0 and smaller than 𝜀.

2.
Claim: zip zi,0 mod p

Proof. Fermat’s Little Theorem states ap1 1 mod p for all a p and prime p. Therefore, zi zi,0p mod p. □

3.
Claim: zip zi,0p mod p𝜀+1

Proof.

(zi,0 + kp𝜀 )p mod p𝜀+1 = j=0p(p j) zi,0j (kp𝜀 )pj mod p𝜀+1 # binomial expansion formula

= zi,0p

4.
Claim: Given p and 𝜀 are fixed, there exists 𝜀+ 1 polynomials f0,f1,f2,,f𝜀 (where each polynomial is at most p 1 degrees) such that any zi (i.e., any number whose base-p representation has 0s between the base-p digit index greater than 0 and smaller than 𝜀) can be expressed as the following formula:

zip j=0𝜀 fj(zi,0) pj mod p𝜀+1

Proof.

zip mod p𝜀+1 can be expressed as a base-p number as follows:

zip mod p𝜀+1 = c0 + c1p + c2p2 + + c𝜀p𝜀

Based on step 3’s claim (zip zi,0p mod p𝜀+1 ), we know that the value of zip mod p𝜀+1 depends only on zi,0 (given p and 𝜀 are fixed). Therefore, we can imagine that there exists some function f(zi,0) whose input is zi,0 [0,p 1] and the output is zip [0,p𝜀+1 1]. Alternatively, we can imagine that there exist 𝜀+ 1 different functions f0,f1,,f𝜀 such that each fj is a polynomial whose input is zi,0 [0,p 1] and the output is ci [0,p 1], and zip j=0𝜀 fj(zi,0) pj mod p𝜀+1 . The input and output domain of each polynomial fj is [0,p 1]. Therefore, we can design each fj as a (p 1)-degree polynomial and derive each fj based on polynomial interpolation (§A-15) by using (p 1) coordinate values.

Note that whenever we increase 𝜀 to 𝜀+ 1, we add a new polynomial f𝜀+1. However, the previous polynomials f0,f1,,f𝜀 stay the same as before, because increasing 𝜀 by 1 only adds a new base-p constant c𝜀+1 for the highest base-p digit, while keeping the lower-digit constants c0,c1,,c𝜀 the same as before. Therefore, the polynomials f0,f1,,f𝜀, each of which computes c0,c1,,c𝜀, also stay the same as before. □

5.
Claim: The formula in step 4’s claim can be further concretized as follows:

zip zi,0 + j=1𝜀 fj(zi,0) pj mod p𝜀+1

Proof.

According to step 2’s claim (zip zi,0 mod p), we know that the following base-p representation of zip:

zip mod p𝜀+1 = c0 + c1p + c2p2 + + c𝜀1p𝜀

will be the following:

zip mod p𝜀+1 = zi,0 + c1p + c2p2 + + c𝜀1p𝜀

, since the least significant base-p digit of zip in the base-p representation is always zi,0. Thus, the formula in step 4’s claim:

zip = j=0𝜀 fj(zi,0) pj mod p𝜀+1

can be further concretized as follows:

zip = zi,0 + j=1𝜀 fj(zi,0) pj mod p𝜀+1

6.
Claim: zip j=1𝜀 fj(zi) pj zi,0 mod p𝜀+1

Proof. Remember that in step 1, we defined zi as: zi = zi,0 + j=𝜀𝜀1zi,jpj. Therefore, zi mod p𝜀 = zi,0. This implies that for each polynomial fj, the following is true:

fj(zi,0) fj(zi) mod p𝜀

We can further derive the following:

fj(zi,0) pj fj(zi) pj mod p𝜀+1 (where i 1)

The above is true because:

fj(zi,0) fj(zi) mod p𝜀

fj(zi,0) = fj(zi) + q p𝜀 (for some integer q)

fj(zi,0) pj = fj(zi) pj + q p𝜀 pj # multiplying pj to both sides

fj(zi,0) pj = fj(zi) pj + q pj1 p𝜀+1 # fj(zi,0) pj and fj(zi) pj differ by some multiple of p𝜀+1

Therefore, fj(zi,0) pj fj(zi) pj mod p𝜀+1 .

Now, given step 5’s claim (zip zi,0 + j=1𝜀 fj(zi) pj mod p𝜀+1 ), we can derive the following:

zip j=1𝜀 fj(zi) pj mod p𝜀+1

(zi,0 + j=1𝜀 fj(zi,0) pj) j=1𝜀 fj(zi) pj mod p𝜀+1 # applying step 5’s claim

(zi,0 + j=1𝜀 fj(zi) pj) j=1𝜀 fj(zi) pj mod p𝜀+1 # since fj(zi,0) pj = fj(zi) pj mod p𝜀+1

zi,0 mod p𝜀+1

7.
Finally, we define the lifting polynomial F𝜀(zi) as follows:

F𝜀(zi) = zip j=1𝜀 fj(zi) pj

F𝜀(zi) zi,0 mod p𝜀+1

The above relation implies that F𝜀(x) mod p𝜀+1 is equivalent to the least significant base-p digit of x (according to step 6’s claim). Therefore, if we plug in zi into F𝜀(x) and regard 𝜀 = 1, then the output is some number whose least significant base-p digit is zi,0 mod p2 and the 2nd least significant base-p digit is 0 mod p2. As we recursively apply the output back to F𝜀(x) and increment 𝜀 by 1, we iteratively zero out the 2nd least significant base-p digit, the 3rd least significant base-p digit, and so on. We repeat this process for 𝜀 1 times to zero out the upper 𝜀 1 base-p digits, keeping only the least significant digit as it is (i.e., zi,0). Therefore, F𝜀(x) is a valid lifting polynomial that can be iteratively used to extract the least significant digit of zi mod p𝜀.

We use F𝜀(x) as the internal helper function within the digit extraction function G𝜀,v(zi) that calls F𝜀(x) a total v 1 times.

D-2.11.6 Scaling Factor Re-interpretation

Remember that homomorphically decrypting (A,B) outputs an encryption of p𝜀1M + E+ Kp𝜀, whose entire value is bigger than p𝜀. The final result of homomorphic digit extraction is equivalent to zeroing out the least significant (base-p) 𝜀 1 digits of the input value p𝜀1M + E+ Kp𝜀. Therefore, at the end of digit extraction, we get a ciphertext that encrypts p𝜀1M + Kp𝜀, where Kp𝜀 is a polynomial with coefficients which are some multiples of p to account for the wrapping values of p𝜀.

Therefore, the output of the digit extraction and SlotToCoeff steps is the ciphertext 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + Kp𝜀)) mod q, where the plaintext modulus is p𝜀 and the plaintext scaling factor Δ = q p𝜀 ( as we derived in §D-2.11.3). However, our desired outcome of the BFV bootstrapping is a noise-removed ciphertext whose plaintext modulus is p and the plaintext scaling factor is Δ = q p. Without doing any actual additional computation, we can view the above ciphertext 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + Kp𝜀)) mod q as an encryption of plaintext modulo p whose scaling factor is Δ = q p. This is because:

𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀1M + Kp𝜀)) = 𝖱𝖫𝖶𝖤S,σ ( q p𝜀 (p𝜀1M + Kp𝜀))

= 𝖱𝖫𝖶𝖤S,σ (q pM + Kq)

= 𝖱𝖫𝖶𝖤S,σ (q pM ) mod q

Therefore, we can view the above ciphertext as 𝖱𝖫𝖶𝖤S,σ(ΔM) mod q whose plaintext modulus is p and scaling factor Δ = q p, because the underlying ciphertext’s structure of these two viewpoints is identical. This leads to the corollary that evaluating the digit extraction function (§D-2.11.5) at zi recursively total 𝜀 1 times is logically equivalent to the noise elimination and plaintext modulus switch (p𝜀 p) as follows:

G𝜀,1 G𝜀,𝜀2 G𝜀,𝜀1(zi) = zi p𝜀1 mod p

We can optionally design a more precise rounding-based function by modifying zi to zi + p𝜀1 2 as follows:

G𝜀,1 G𝜀,𝜀2 G𝜀,𝜀1 (zi + p𝜀1 2 ) = zi p𝜀1 mod p

Generalization of t = pr: We have explained the BFV bootstrapping with the assumption that the plaintext modulus t = p is a prime number. However, we can generalize t as t = pr where r can be any positive integer. The benefit of choosing t = pr with a small p instead of t = p with a big p is the efficient noise management of the digit extraction process. As digit extraction requires many ciphertext-to-plaintext multiplications with p,p2,,p𝜀1, using a small p generates a smaller noise during the homomorphic operations.

D-2.11.7 Summary

We summarize the BFV bootstrapping procedure (with the generalization of t = pr) as follows.

Summary D-2.11.7 BFV Bootstrapping

Suppose we have an RLWE ciphertext (A,B) = 𝖱𝖫𝖶𝖤S,σ(ΔM + E) mod q, where Δ = q t and t = pr (i.e., the plaintext modulus is a power of some prime), r 𝕀, and r 1.

1.
Modulus Switch (from q p𝜀): Scale down the ciphertext from (A,B) to (p𝜀 q A, p𝜀 q B) = (A,B) # where p𝜀 q

AS + B = p𝜀rM + Emod p𝜀 # where E p𝜀 q E + (q p p𝜀 q p𝜀r) M, which is a modulus switch noise plus a rounding noise caused by treating Δ = q pr q pr.

2.
Homomorphic Decryption: With the bootstrapping key 𝖱𝖫𝖶𝖤S,σ(ΔS) mod q, homomorphically decrypt (A,B) mod p𝜀 as follows:

A𝖱𝖫𝖶𝖤S,σ(ΔS) + B = 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀rM + E+ Kp𝜀)) mod q # where Δ = q p𝜀

Now, we denote the modulus-switched noisy plaintext polynomial as Z = p𝜀rM + E+ Kp𝜀.

3.
CoeffToSlot: Move the (encrypted) polynomial Z’s coefficients z0,zi,,zn1 to the input vector slots. This is done by computing:

𝖱𝖫𝖶𝖤S,σ(ΔZ) n1 W~ IRn

= 𝖱𝖫𝖶𝖤S,σ(ΔZ1)

, where n1 W~ IRn is the batch encoding matrix (Summary D-2.9.3 in §D-2.9.3).

4.
Digit Extraction: We design a polynomial G𝜀,v(zi) (a digit extraction polynomial) as follows:

zi = d0 + ( j=𝜀𝜀rdpj) # where d0 pr, and 𝜀 is zi’s least significant base-p digit index whose value is non-zero after digit index after digit index r 1

F𝜀(zi) d0 mod p𝜀+1 # a (p 1)-degree polynomial recursively used to finally extract the value d0 mod p𝜀

G𝜀,v(zi) zi F𝜀1 F𝜀2 F𝜀3F1 𝜀1 times(zi) mod p𝜀

We homomorphically evaluate the digit extraction polynomial G𝜀,v for v = {𝜀 r 1,𝜀 r 2,,1} recursively total 𝜀 r 1 times at each coefficient zi of Z stored at input vector slots, which zeros out the least significant (base-p) 𝜀 r 1 digits of zi as follows:

G𝜀,1 G𝜀,2 G𝜀,𝜀r2 G𝜀,𝜀rr(zi) mod p𝜀

= p𝜀rmi + kip𝜀

, provided E’s each coefficient 𝜀i < p𝜀r 2 . At this point, each input vector slot contains the noise-removed coefficient p𝜀rmi + kip𝜀.

5.
SlotToCoeff: Homomorphically move each input vector slot’s value p𝜀rmi + kip𝜀 back to the (encrypted) polynomial coefficient positions. This is done by multiplying W~ to the output ciphertext of the digit extraction step, where W~ is the decoding matrix (Summary D-2.9.3 in §D-2.9.3). The output of this computation is 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀rM + Kp𝜀)) mod q, where Δ = q p𝜀 and the plaintext modulus is p𝜀.

6.
Scaling Factor Re-interpretation:

The output of the previous step is 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀rM + Kp𝜀)) mod q, where Δ = q p𝜀, which is a modulo-q ciphertext encrypting a modulo-p𝜀 plaintext with the scaling factor q p𝜀. Without any additional computation, we can theoretically view this ciphertext as a modulo-q ciphertext encrypting a modulo-p plaintext with the scaling factor q p. This is because:

𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀rM + Kp𝜀)) = 𝖱𝖫𝖶𝖤S,σ ( q p𝜀 (p𝜀rM + Kp𝜀))

= 𝖱𝖫𝖶𝖤S,σ (q pM + Kq)

= 𝖱𝖫𝖶𝖤S,σ (q pM ) mod q

For these two viewpoints, their underlying ciphertext structure is identical. Therefore, the digit extraction function (§D-2.11.5) at zi recursively total 𝜀 r times is logically equivalent to the noise elimination and plaintext modulus switch (p𝜀 p) as follows:

G𝜀,1 G𝜀,𝜀r2 G𝜀,𝜀r1(zi) = zi p𝜀r mod p

A more precise rounding-based logic can be designed by modifying zi to zi + p𝜀r 2 as follows:

G𝜀,1 G𝜀,𝜀r2 G𝜀,𝜀r1 (zi + p𝜀r1 2 ) = zi p𝜀r mod p

Necessity of Homomorphic Decryption: Suppose that we performed the BFV bootstrapping without homomorphic decryption. Then, the input to the digit extraction step would be p𝜀rM + Kp𝜀, not p𝜀rM + E+ Kp𝜀. This is because the ciphertext (A,B) encrypts 𝖱𝖫𝖶𝖤S,σ(ΔM), where Δ = p𝜀r. Therefore, applying the CoeffToSlot transformation to 𝖱𝖫𝖶𝖤S,σ(ΔM) will store the coefficients of M mod p𝜀, not the coefficients of ΔM + E = p𝜀rM + Emod p𝜀. In order to preserve the noise E as well, we homomorphically decrypt 𝖱𝖫𝖶𝖤S,σ(ΔM) by using an encrypted secret key 𝖱𝖫𝖶𝖤S,σ(ΔS) to make it 𝖱𝖫𝖶𝖤S,σ(Δ(p𝜀rM + E+ Kp𝜀)).