D-1.7 Coefficient Extraction

- Reference: TFHE Deep Dive - Part IV - Programmable Bootstrapping [10]

In TFHE, coefficient extraction is a process of extracting a coefficient of a polynomial that is encrypted as GLWE ciphertext. The extracted coefficient is in the form of LWE ciphertext (§B-2).

Note that in the GLWE cryptosystem, plaintext M is encoded as a polynomial, where each coefficient encodes the plaintext value m0,m1,,mn1.

Suppose we have a GLWE ciphertext setup as the following:
M = j=0n1mjXj Rn,q

S = (S0 = j=0n1s0,jXj,S1 = j=0n1s1,jXj,  ,Sk1 = j=0n1sk1,jXj)

𝖦𝖫𝖶𝖤S,σ(ΔM) = (A0 = j=0n1a0,jXj,A1 = j=0n1a1,jXj,  ,Ak1 = j=0n1ak1,jXj,B = j=0n1bjXj)

B = i=0k1AiSi + ΔM + E

E = i=0n1eiXi

Note that:

ΔM + E = B i=0k1AiSi

= (Δm0 + Δm1X +    + Δmn1Xn1) + (e0 + e1X +    + en1Xn1)

= (Δm0 + e0) + (Δm1 + e1)X +    + (Δmn1 + en1)Xn1

Another way to write the formula is:

B i=0k1AiSi

= (b0 + b1X +    + bn1Xn1)

(a0,0 + a0,1X +    + a0,n1Xn1)(s0,0 + s0,1X +    + s0,n1Xn1)

(a1,0 + a1,1X +    + a1,n1Xn1)(s1,0 + s1,1X +    + s1,n1Xn1)

  

(ak1,0 + ak1,1X +    + ak1,n1Xn1)(sk1,0 + sk1,1X +    + sk1,n1Xn1)

= (b0 ( i=0k1 j=00(ai,0jsi,j) i=0k1 j=1n1(ai,njsi,j)))

+ (b1 ( i=0k1 j=01(ai,1jsi,j) i=0k1 j=2n1(ai,n+1jsi,j))) X

+ (b2 ( i=0k1 j=02(ai,2jsi,j) i=0k1 j=3n1(ai,n+2jsi,j))) X2

  

+ (bn1 ( i=0k1 j=0n1(ai,n1jsi,j) i=0k1 j=nn1(ai,n+(n1)jsi,j))) Xn1

# Grouping the terms by same exponents

= h=0n1 (bh ( i=0k1 j=0h(ai,hjsi,j) i=0k1 j=h+1n1(ai,n+hjsi,j))) Xh

= h=0n1Ch Xh, where Ch = bh ( i=0k1 j=0h(ai,hjsi,j) i=0k1 j=h+1n1(ai,n+hjsi,j))

In the above (n 1)-degree polynomial, notice that each Xh term’s coefficient, Ch, can be expressed as an LWE ciphertext 𝖼𝗍h as follows:

S = (s0,0,s0,1,  ,s0,n1,s1,0,s1,1,  ,s1,n1,  ,sk1,n1) = (s0,s1,  ,s𝑛𝑘1) q𝑛𝑘

Ch = (a0,a1,  ,a𝑛𝑘1,bh) q𝑛𝑘+1

, where ani+j = { ai,hj (if 0 j h) ai,n+hj (if h + 1 j n 1) ,bh is directly obtained from the polynomial B

Note that bh i=0𝑛𝑘1siai = Δmh + eh. This means that Ch can be replaced by its encrypted version, 𝖫𝖶𝖤s,σ(Δmh), an LWE ciphertext 𝖼𝗍h encrypting the h-th coefficient of M. Therefore, we just extracted 𝖫𝖶𝖤s,σ(Δmh) from 𝖦𝖫𝖶𝖤S,σ(ΔM). This operation is called coefficient extraction, which does not add any noise because it simply extracts an LWE ciphertext by reordering the polynomial of the GLWE ciphertext.

Once we have 𝖫𝖶𝖤s,σ(Δmh), we can key-switch it from s s (§D-1.5).

Summary D-1.7 GLWE Ciphertext’s Coefficient Extraction

Given the following GLWE ciphertext:

M = j=0n1mjXj Rn,p

S = (S0 = j=0n1s0,jXj,S1 = j=0n1s1,jXj,  ,Sk1 = j=0n1sk1,jXj)

𝖦𝖫𝖶𝖤S,σ(ΔM) = (A0 = j=0n1a0,jXj,A1 = j=0n1a1,jXj,  ,Ak1 = j=0n1ak1,jXj,B = j=0n1bjXj)

B = i=0k1AiSi + ΔM + E mod q, E = i=0n1eiXi

𝖫𝖶𝖤s,σ(Δmh) is an LWE ciphertext that encrypts ΔM’s h-th coefficient (i.e., Δmh). 𝖫𝖶𝖤s,σ(Δmh) can be extracted from 𝖦𝖫𝖶𝖤S,σ(ΔM) as follows:

s = (s0,0,s0,1,  ,s0,n1,s1,0,s1,1,  ,s1,n1,  ,sk1,n1) = (s0,s1,  ,s𝑛𝑘1) q𝑛𝑘

𝖫𝖶𝖤s,σ(Δmh) = (a0,a1,  ,a𝑛𝑘1,bh) q𝑛𝑘+1

, where ani+j = { ai,hj (if 0 j h) ai,n+hj (if h + 1 j n 1) ,bh is obtained from the polynomial B

Once we have 𝖫𝖶𝖤s,σ(Δmh), key-switch it from s s (§D-1.5).