Hi,
I am reading this paper to learn how BFV’s (and BGV’s) bootstrapping works. But I don’t understand how the digit extraction works. In the paper’s section:
5.3 Digit-Extraction for Plaintext Space Modulo p^r
The key algorithm of digit extraction is as follows:
![image|690x55](upload://fmCMIMOVLHjoB9trSfBUcmtiRgp.png
However, I don’t follow the correctness of this algorithm. Specifically, I break down my question into 3.
Q1. In Line 5 of the above algorithm, is it correct that F_e(w_{j, k}) extracts the LSD (least significant digit) of base-p representation of w_{j, k}? If yes, then I suppose Line 5’s w_{j, k + 1} \leftarrow F_e(w_{j, k}) specifically means:
w_{j, k + 1} \leftarrow F_e(w_{j, k}) \bmod p
Is this correct?
Q2. If Q1 is yes, then I don’t understand how Line 5 works over iterations. For example, in the 1st outer for-loop iteration (k = 0), at Line 5 we store w_{0, 1} \leftarrow F_e(w_{0, 0}), which is the LSD of base-p representation of the initial input z. However, in the 2nd outer for-loop iteration (k = 1), at Line 5 we store w_{0, 2} \leftarrow F_e(w_{0, 1}), where F_e(w_{0, 1}) does not make sense if F_e(w_{0, 1}) returns the LSD of base-p representation of w_{0, 1} (which is the LSD of base-p representation of the initial input z).
Q3. Does Line 6 remove y's LSD in base-p representation and then shift the digit by 1 position to the right? In other words, if y was originally c_0 + c_1p + c_2p^2 + \cdots, then does Line 6 update y as c_1 + c_2p + c_3p^2 + \cdots?
Q4. I wonder why we have to use 2 for-loops instead of 1 for-loop. I think the following algorithm could work:
\text{INPUT: } (z, e)
\text{for } k = 0 \text{ to } e - 1:
\text{ } \text{ }\text{ } y \leftarrow F_e(z) \bmod p
\text{ } \text{ }\text{ } z \leftarrow \dfrac{z - y}{p}
\text{return } z
The above algorithm shifts the original input z by e digits to the right in base-p representation. Why can’t we use the above algorithm for BFV’s digit extraction? (In my above suggestion, I set e’ = 0, but I believe this still guarantees correctness of Lemma 5.3 in the paper because the binomial expansion’s correctness still holds even if e’ = 0, and therefore this also guarantees correctness of Lemma Corollary 5.4 and 5.5).