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𝜀, shifted to the right by 1 base-p digit. Here, where the noise located at the least significant digits in a base-p (prime) representation is zeroed out and shifted right. For example, G𝜀(3p3 + 4p2 + 6p + 2) = 3p2 + 4p1 + 6 mod p𝜀. Given that the noise resides in the least significant 𝜀 1 digits in base-p representation, we can homomorphically and recursively evaluate G𝜀(x) total 𝜀 1 times in a row, which zeroes out and removes 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 it is that the noise gets successfully zeroed out; however, the computation overhead becomes larger. If 𝜀 is small, the computation gets faster, but the digit-wise distance between the noise and the plaintext decreases, potentially corrupting the plaintext during bootstrapping, because removing the most significant noise digit may also remove the least significant plaintext digit. 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,σ(S) mod q, which is the secret key S encrypted by S (itself) modulo q with the plaintext scaling factor Δ. 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) (i.e., a digit extraction polynomial) that zeros out the least significant base-p digit(s) modulo p𝜀. The digit extraction procedure recursively applies G2 G3 G𝜀1 G𝜀(x) to the input x to eliminate the least significant (base-p) 𝜀 2 digits of input x and shifts them to the right. Regarding the input x, we assume the noise resides in the least significant (base-p) 𝜀 2 digits, and the message m resides in the higher base-p digits modulo p𝜀. Therefore, digit extraction has the effect of zeroing out and deleting (i.e., shifting to the right) the least significant 𝜀 1 digits of the base-p representation of p𝜀1m + e. This digit extraction is performed homomorphically. Throughout the digit extraction, the scaled plaintext message with noise stored at the input vector slots of the ciphertext gets updated from p𝜀1M + E+ Kp𝜀 to M + Kp. During digit extraction, we also use a special method called scaling factor re-interpretation, which conceptually increases the scaling factor Δ = q p𝜀 over each round of digit extraction to q p𝜀 1, q p𝜀 2,, q p, which equivalently has the conceptual effect of dividing the scaled message and noise stored in the plaintext slots by p (i.e., shift to the right by 1 base-p digit) as follows:

Input: q p𝜀 (p𝜀1M + E+ Kp𝜀)

Round 1: q p𝜀1 (p𝜀2M + E p + Kp𝜀1)

Round 2: q p𝜀2 (p𝜀3M + E p2 + Kp𝜀2)

Round 𝜀 1: q p (M + 𝐾𝑝)

Importantly, the scaling factor re-interpretation does not require any actual computation; we only change the way of interpreting the ciphertext. We will cover this in more detail. later.

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). The final output of this step is = 𝖱𝖫𝖶𝖤S,σ (q pM + Eb), where Eb is a new small noise term generated during the homomorphic operation of CoeffToSlot, digit extraction, and SlotToCoeff. The size of Eb is fixed and smaller than E and E.

Next, we will explain each step in more 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 (base-p) 𝜀 1 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 that 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 and delete (i.e., shift to the right) the lower (base-p) 𝜀 1 digits of each zi, where the noise resides.

First, we always think of zi as a base-p representation (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 + dp𝜀

, 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 be updated to 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 a total of 𝜀 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 do not 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 obtain the universal guaranty 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𝜀(zi) = zi p p = (zi (F𝜀1 F𝜀2 F𝜀3 F3 F2 F1 𝜀1 times(zi)) |p1|q

, where p denotes division by p and rounding down to the nearest multiple of p. Verbally speaking, G𝜀,v(zi) is equivalent to zeroing out the least significant base-p digit of zi and then shifting to the right by 1 base-p digit. The shifting is done by inverse p multiplication (i.e., |p1|q). Notice that the last base-p digit of zi (F𝜀1 F𝜀2 F𝜀3 F1(zi)) is 0, which is exactly divisible by p. Thus, multiplying by the inverse p has the effect of exact division (i.e., shifting the whole base-p representation by 1 digit to the right). The reason why the inverse p is in modulo q is that we are currently under the BFV ciphertext relation: 𝖢𝗈𝖾𝖿𝖿𝖳𝗈𝖲𝗅𝗈𝗍((A,B)) = (Acs,Bcs) mod q, whose plaintext slots store the coefficients of Δ(p𝜀1M + E+ K1p𝜀) mod q. Upon homomorphically computing (zi (F𝜀1 F𝜀2 F𝜀3 F3 F2 F1) as part of the 1st round of digit extraction, the ciphertext is updated to (Ag1,Bg1) mod q, whose plaintext slots store the coefficients of Δ(p𝜀1M + Ep + K1p𝜀) mod q, where Ep is equivalent to rounding E down to the nearest multiple of p. At this point (i.e., just before inverse-p multiplication in the first round), the ciphertext holds the following relation:

Ag1S + Bg1 = Δ(p𝜀1M + Ep + K1p𝜀) + Eg1mod q

, where Eg1 is the combined noise of the SlotToCoeff step and the first part of the 1st round of digit extraction. We could consider multiplying |p1|q to both sides of the relation to scale down p𝜀1M, Ep, and K1p𝜀 by p. However, this causes a noise explosion problem, because this scaling will be also applied to the Eg1 term, and |p1|qEg1 is a huge value. To selectively apply the inverse-p multiplication only to those terms of interest, we use the scaling factor re-interpretation technique.

Scaling Factor Re-interpretation: Although we previously explained that G𝜀 involves the multiplication by |p1|q, technically, we skip this multiplication and instead conceptually re-interpret the scaling factor Δ as q p𝜀 q p𝜀 1 q p𝜀 2 , q p across 𝜀 1 rounds of digit extraction. During this re-interpretation, each step’s p being decreased in the denominator of the scaling factor is conceptually placed back into the bracket. Applying the re-interpretation of the scaling factor, the digit extraction procedure (without explicit multiplication by |p1|q at each round) is performed as follows:

Input: q p𝜀 (p𝜀1M + E+ Kp𝜀) mod q

1st Round: G𝜀(zi)==⇒effect q p𝜀1 (p𝜀2M + E p + K1p𝜀1) mod q

2nd Round: G𝜀1 G𝜀(zi)==⇒effect q p𝜀2 (p𝜀3M + E p2 + K2p𝜀2) mod q

3rd Round: G𝜀2 G𝜀1 G𝜀(zi)==⇒effect q p𝜀3 (p𝜀4M + E p3 + K3p𝜀3) mod q

𝜀 1-th Round: G2 G𝜀(zi)==⇒effect q p (M + K𝜀1p) mod q

Note that the scaling factor re-interpretation does not involve any actual computation, but only changes our way of interpreting the scaling factor. Notice that at the end of the final round, the plaintext scaling factor becomes q p, which is the desired plaintext scaling factor for standard BFV ciphertexts. Therefore, the scaling factor re-interpretation has three benefits: (1) we skip explicit multiplication by |p1|q at each round; (2) we prevent noise explosion; (3) at the end of all rounds, the plaintext scaling factor becomes the desired value for standard BFV ciphertexts, gracefully completing the bootstrapping procedure.

Meanwhile, there are two important points to be aware of. First, each i-th round of scaling factor re-interpretation creates a small drift error in the scaling factor due to the difference 𝜖i = p1 q p𝜀i q p𝜀i+1, where 0 𝜖i < p. Therefore, an additional drift error Eire is created at each i-th round, which is small enough to be bounded by:

Eire 𝜖i (p𝜀i1M + E pi + Kip𝜀i) < p𝜀1M + E p + Kip𝜀+1 q p𝜀

Second, at each i-th round of digit extraction, the plaintext operands used for ciphertext-to-plaintext homomorphic operations should encode their values with the specific scaling factor interpreted at that round: Δi = q p𝜀i+1.

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

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

1.
Claim: zip zi,0 mod p

Proof. It’s true that zi zi,0 mod p. Fermat’s Little Theorem states ap a mod p for all a p and prime p. Therefore, zi zi,0 zi,0p zp mod p. □

2.
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 mod p𝜀+1 all terms where j < p are 0 mod p𝜀+1

3.
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 . In this case, 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 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. □

4.
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 c0 + c1p + c2p2 + + c𝜀p𝜀 mod p𝜀+1

will be the following:

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

, since step 2’s claim implies that 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

5.
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𝜀

Next, we derive the following:

fj(zi,0) pj fj(zi) pj mod p𝜀+1 (where j 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,0) 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 applying fj(zi,0) pj fj(zi) pj mod p𝜀+1

zi,0 mod p𝜀+1

6.
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𝜀(zi) that calls F𝜀(x) a total of v 1 times.

D-2.11.6 Summary

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

Summary D-2.11.6 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 the 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𝜀(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𝜀(zi) (zi F𝜀1 F𝜀2 F𝜀3F1 𝜀1 times(zi)) |p1|q mod p𝜀

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

G𝜀r2 G𝜀r3 G𝜀1 G𝜀(zi)

= mi + kip

, provided E’s each coefficient is smaller than p𝜀r 2 . At this point, each input vector slot contains the noise-removed coefficient mi + ki𝜀r1p.

Scaling Factor Re-interpretation: At each i-th round of digit extraction, we do not explicitly multiply |p1|q to perform division by p, but instead conceptually borrow this term from the denominator of the plaintext scaling factor Δ, conceptually updating the scaling factor to q p𝜀i+r1. This implies that at i-th round of digit extraction, the plaintext operations used for ciphertext-to-plaintext homomorphic operations should encode their values by using the scaling factor q p𝜀i+r1. At the end of digit extraction, the plaintext scaling factor becomes Δ = Δ = q pr.

5.
SlotToCoeff: Homomorphically move each input vector slot’s value mi + ki𝜀r1p𝜀 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,σ(Δ (M + K𝜀r1p) + Eb)) = 𝖱𝖫𝖶𝖤S,σ(Δ (M + Enew2)) mod q, where Eb is the new noise generated during bootstrapping (step 3 5).

The purpose of Homomorphic Decryption: Its purpose is to temporarily adjust the scaling factor of the ciphertext to preserve the correctness of bootstrapping. Before homomorphic decryption, the ciphertext encrypts p𝜀rM, a message with the scaling factor p𝜀r. After homomorphic decryption, the ciphertext encrypts Δp𝜀rM, the message p𝜀rM with the scaling factor Δ = q p𝜀. This specific adjustment is needed for the scaling factor re-interpretation during each round of digit extraction to conceptually divide by p (i.e., multiply by |p1|q) and eventually adjust the scaling factor back to q pr as the original form for standard BFV ciphertexts.