- I discovered something interesting.
In boolean.cpp, if i change the codes from auto ct1 = cc.Encrypt(sk, 1); auto ct2 = cc.Encrypt(sk, 1); to auto ct1 = cc.Encrypt(sk, 1, SMALL_DIM, 2); auto ct2 = cc.Encrypt(sk, 1, SMALL_DIM, 2); , the decryption result would be wrong. So I want to confirm, is OpenFHE’s Gatebootstrapping specifically designed for plaintext modulus = 4?
- I found that i can open WITH_NOISE_DEBUG, and it will ouput the noise analysis. Based on the decryption formula, if |error| >\Delta/2, the decryption will fail.
- So I need to compare the output
error * mod.ConvertToDouble() / static_cast<double>(p) with mod.ConvertToDouble() / (2*static_cast<double>(p)) right?
- If
output >= q/2p, it indicates that noise has overflowed; otherwise, it means that noise under the limits and the TFHE workflow is functioning normally. Can I assume that?
#if defined(WITH_NOISE_DEBUG)
double error =
(static_cast<double>(p) * (r.ConvertToDouble() - mod.ConvertToDouble() / (p * 2))) / mod.ConvertToDouble() -
static_cast<double>(*result);
std::cerr << error * mod.ConvertToDouble() / static_cast<double>(p) << std::endl;
#endif
The gate bootstrapping function used by boolean.cpp indeed uses the plaintext modulus of 4, as explained in Section 3.2 of ePrint 2020/086, and also in the original FHEW paper ePrint 2014/816. This is because of the negacyclic requirement for the lookup evaluation function f. There are also other bootstrapping functions in binfhe (which support other plaintext moduli and more general programmable/functional bootstrapping). The more general flavor is described in ePrint 2021/1337.