This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Large-Plaintext Functional Bootstrapping in FHE with Small Bootstrapping Keys

Dengfa Liu, Hongbo Li AMSS, UCAS, Chinese Academy of Sciences, Beijing 100080, China.
E-mail: [email protected], [email protected]
Manuscript received April 19, 2021; revised August 16, 2021.
Abstract

Functional bootstrapping is a core technique in Fully Homomorphic Encryption (FHE). For large plaintext, to evaluate a general function homomorphically over a ciphertext, in the FHEW/TFHE approach, since the function in look-up table form is encoded in the coefficients of a test polynomial, the degree of the polynomial must be high enough to hold the entire table. This increases the bootstrapping time complexity and memory cost, as the size of bootstrapping keys and keyswitching keys need to be large accordingly.

In this paper, we propose to encode the look-up table of any function in a polynomial vector, whose coefficients can hold more data. The corresponding representation of the additive group q{\mathbb{Z}}_{q} used in the RGSW-based bootstrapping is the group of monic monomial permutation matrices, which integrates the permutation matrix representation used by Alperin-Sheriff and Peikert in 2014, and the monic monomial representation used in the FHEW/TFHE scheme. We make comprehensive investigation of the new representation, and propose a new bootstrapping algorithm based on it. The new algorithm has the prominent benefit of small bootstrapping key size and small key-switching key size, which leads to polynomial factor improvement in key size, in addition to constant factor improvement in run-time cost.

Index Terms:
Fully Homomorphic Encryption, Functional Bootstrapping, FHEW/TFHE, Monic Monomial Permutation Matrix, Test-Coefficient Look-up Property.

I Introduction

Fully homomorphic encryption (FHE) schemes allow to perform arbitrary computation on ciphertexts without resorting to decryption. After over a decade, FHE schemes have been well developed, and have been applied to various privacy-preserving tasks, such as private database query [1], private information retrieval [2, 3], private decision tree evaluation [4], etc.

In FHE schemes, ciphertexts must be bootstrapped periodically in order to run on them arbitrary circuits of arbitrary depth. Originally the term referred to refreshing a ciphertext that has a large error so that after the refreshment, the error decreases to a small bound [5]. Later on it was extended to “functional bootstrapping”, which refers to evaluating an arbitrary function that is represented by a look-up table. Bootstrapping is the most important part of FHE schemes.

All bootstrapping schemes are based on Gentry’s idea of running the decryption circuit homomorphically in a new FHE environment. [5]. Take as an example the most popular FHE scheme BFV, whose ciphertexts are of either LWE or its ring variant RLWE format. The decryption of an LWE ciphertext consists of two steps: the first step is to compute the phase of the ciphertext homomorphically, where the phase is Δm+eq\Delta m+e\in{\mathbb{Z}}_{q}, with mtm\in{\mathbb{Z}}_{t} being the plaintext, ee being the error, and |e|<Δ/2|e|<\Delta/2 where Δ=q/t\Delta=\lfloor q/t\rfloor. The second step is to remove ee from the plaintext in the encrypted phase. The first step is generally easy, while the second step is difficult.

The trick lies in how to represent the additive group q{\mathbb{Z}}_{q} in the plaintext space, so that when the group acts on a vector or polynomial (called test vector or polynomial) that encodes the look-up table of the function to be evaluated, the group element corresponding to phase Δm+e\Delta m+e results in a vector or polynomial with f(m)f(m) as its first entry, which can then be extracted homomorphically to get a ciphertext encrypting f(m)f(m).

In 2014, Alperin-Sheriff and Peikert [6] proposed a bootstrapping scheme which we call “AP14”. They use permutation matrices to represent group q{\mathbb{Z}}_{q}, where every u[0,q)u\in[0,q) is represented by a q×qq\times q matrix

𝑷u:=(𝑰u×u𝑰(qu)×(qu)),\boldsymbol{P}_{u}:=\left(\begin{array}[]{cc}&\boldsymbol{I}_{u\times u}\\ \boldsymbol{I}_{(q-u)\times(q-u)}\\ \end{array}\right), (I.1)

so that the addition of integers agrees with the multiplication of matrices. By encrypting 𝑷u\boldsymbol{P}_{u} in a GSW-ciphertext [7], the homomorphic phase computation is realized by successive GSW ciphertext multiplications, and the error is small in the resulting ciphertext that encrypts the phase of the input ciphertext, due to the fact that in 𝑷u\boldsymbol{P}_{u}, every row and column respectively contain one and only one nonzero entry, and the entry is 1.

For any function ff defined on t{\mathbb{Z}}_{t}, if extending ff to a function ff^{\prime} on q{\mathbb{Z}}_{q} such that f(Δm+e)=f(m)f^{\prime}(\Delta m+e)=f(m) for all mtm\in{\mathbb{Z}}_{t} and |e|<Δ/2|e|<\Delta/2, then for test vector 𝐭𝐞𝐬𝐭f=[f(0)f(1)f(q1)]{\bf test}_{f}=[f^{\prime}(0)\ \ f^{\prime}(1)\ \ \ldots f^{\prime}(q-1)], it is easy to verify that

𝐭𝐞𝐬𝐭f×𝑷Δm+e=[f(Δm+e)f(Δm+e+1)f(Δm+e1)].\begin{array}[]{ll}&{\bf test}_{f}\times\boldsymbol{P}_{\Delta m+e}\\ =&[f^{\prime}(\Delta m+e)\ \ f^{\prime}(\Delta m+e+1)\ \ \ldots\ \ f^{\prime}(\Delta m+e-1)].\end{array} (I.2)

So f(m)=f(Δm+e)f(m)=f^{\prime}(\Delta m+e) is the first entry of the resulting plaintext vector. (I.2) is called the test-coefficient look-up property of the AP14 scheme.

In 2015, Ducas and Micciancio [8] proposed another bootstrapping scheme called “FHEW”. In this scheme, first qq is switched to 2N2N where NN is a power of 2, then every u[0,2N)u\in[0,2N) is represented by a monic monomial xux^{u}, so that the addition of integers agrees with the multiplication of monic monomials. By encrypting every xux^{u} in an RGSW-ciphertext where the polynomial ring is [x]/(xN+1){\mathbb{Z}}[x]/(x^{N}+1), the homomorphic phase computation is realized by successive RGSW ciphertext multiplications, and the error is small in the resulting ciphertext that encrypts the phase of the input ciphertext.

For any function ff defined on t{\mathbb{Z}}_{t}, if ff can be extended to a nega-cyclic function ff^{\prime} on 2N{\mathbb{Z}}_{2N}, such that f(x+N)=f(x)f^{\prime}(x+N)=-f^{\prime}(x) for all x2Nx\in{\mathbb{Z}}_{2N}, and f(Δm+e)=f(m)f^{\prime}(\Delta m+e)=f(m) for all mtm\in{\mathbb{Z}}_{t} and |e|<Δ/2|e|<\Delta/2, where Δ=2N/t\Delta=\lfloor 2N/t\rfloor, then for test polynomial testf=i=0,,N1f(i)xi{\rm test}_{f}=\sum_{i=0,\ldots,N-1}f^{\prime}(i)x^{-i}, it is easy to verify that

testf×xΔm+e=f(Δm+e)+f(Δm+e+1)x1++f(Δm+e1)x(N1).\begin{array}[]{lll}{\rm test}_{f}\times x^{\Delta m+e}&=&f^{\prime}(\Delta m+e)+f^{\prime}(\Delta m+e+1)x^{-1}\\ &&\hfill+\ldots+f^{\prime}(\Delta m+e-1)x^{-(N-1)}.\end{array} (I.3)

So f(m)=f(Δm+e)f(m)=f^{\prime}(\Delta m+e) is the first entry, a.k.a. the constant term, of the resulting plaintext polynomial. (I.3) is called the test-coefficient look-up property of the FHEW scheme.

Since FHEW scheme adopts RGSW ciphertext format in homomorphic phase computation, FFT can be used to accelerate the computing. As a result, bootstrapping a ciphertext encrypting a single-bit plaintext by FHEW scheme costs less than 1 second. Later on, another scheme called TFHE was proposed by Chillotti et al. in 2016 [9] to optimize homomorphic phase computation in FHEW, which improves the run-time cost to less than 0.1 second. In 2021, both schemes were extended to make functional bootstrapping for arbitrary functions in 2021 [10, 11].

The last few years have witnessed fast developments of bootstrapping algorithms. To name a few, in [12], a scheme was proposed to evaluate several functions on the same ciphertext simultaneously by one bootstrapping. In [10, 13], to bootstrap ciphertexts encrypting long plaintext, a strategy of block-wise bootstrapping from the tail up was proposed; the strategy can be used for functional bootstrapping where the function is either the identity function f(x)=xf(x)=x, or the sign function. In [14, 15], FHEW/TFHE was extended to bootstrap a ciphertext encrypting several plaintexts in SIMD mode.

We notice that for large-plaintext bootstrapping, block-wise bootstrapping works only for some special functions. For a general function, the look-up table representation of the function demands big polynomial degree in RLWE/RGSW ciphertexts. The bigger the polynomial degree, the slower the computation, and the bigger the memory cost due to bootstrapping keys and key-switching keys.

A natural idea is to resort to a polynomial vector instead of only a polynomial to encode the look-up table of a general function ff. For example, let NN be the maximal value of ring dimension for efficient computing of RLWE/RGSW ciphertext multiplication. For an LWEn,q{\rm LWE}_{n,q} ciphertext whose plaintext modulus tt is big, the ciphertext modulus qq must be large, say q>2Nq>2N. Let

r=q/(2N),q=2Nrq.r=\lceil q/(2N)\rceil,\ \ \ q^{\prime}=2Nr\geq q. (I.4)

After modulus switch from qq to qq^{\prime}, and extending ff to a function defined on q{\mathbb{Z}}_{q^{\prime}} such that f(Δm+e)=f(m)f^{\prime}(\Delta m+e)=f(m) for all mtm\in{\mathbb{Z}}_{t} and |e|<Δ/2|e|<\Delta/2, where Δ=q/t\Delta=\lfloor q^{\prime}/t\rfloor, then ff can be encoded to the following rr-dimensional polynomial vector:

(f(0)+f(1)x++f(N1)xN1f(N)+f(N+1)x++f(2N1)xN1f((r1)N)+f((r1)N+1)x++f(rN1)xN1)\begin{pmatrix}\scriptstyle f^{\prime}(0)+f^{\prime}(1)x+\cdots+f^{\prime}(N-1)x^{N-1}\\ \scriptstyle f^{\prime}(N)+f^{\prime}(N+1)x+\cdots+f^{\prime}(2N-1)x^{N-1}\\ \vdots\\ \scriptstyle f^{\prime}((r-1)N)+f^{\prime}((r-1)N+1)x+\cdots+f^{\prime}(rN-1)x^{N-1}\end{pmatrix} (I.5)

Now that testf{\rm test}_{f} in (I.3) is replaced by test vector (I.5), the representation space of q{\mathbb{Z}}_{q^{\prime}} must be replaced by a group of matrices, where in each matrix, every row and column respectively contains one and only one nonzero entry, and the entry is a monic monomial. Such matrices are called monic monomial permutation matrices in this paper. A subgroup GG of the monic monomial permutation matrices is to be constructed, so that GG is isomorphic to q{\mathbb{Z}}_{q^{\prime}}, and the action of GG on (I.5) by matrix-vector multiplication has the property that for any Δm+eq\Delta m+e\in{\mathbb{Z}}_{q^{\prime}}, its counterpart gΔm+eGg_{\Delta m+e}\in G when acting on (I.5), changes the vector into one whose first entry has its constant term as f(Δm+e)=f(m)f^{\prime}(\Delta m+e)=f(m). The last property is the test-coefficient look-up property, and is the counterpart of (I.2) and (I.3).

The above analysis outlines the main idea of our work. This paper proposes to use monic monomial permutation matrices to represent the additive group q{\mathbb{Z}}_{q^{\prime}}, finds among all its cyclic subgroups those that has the test-coefficient look-up property, and designs a new scheme of FHEW/TFHE style, called BootMMPM, for general functional bootstrapping of LWE ciphertexts encrypting large plaintext.

The new scheme BootMMPM has the feature that the size of bootstrapping keys and the size of key-switching keys are both irrelevant to rr. This is significant for saving memory cost. Indeed, in recent years there have been several papers dedicated to reducing the size of bootstrapping keys. Yongwoo Lee et al. [16] proposed a modification of FHEW scheme by making phase accumulation with ring automorphisms, which requires much fewer bootstrapping keys on the server. In [17, 18], bootstrapping keys are packed into small number of transfer keys by the client, and then reconstructed by the server upon receival. It reduced the key size on the client’s side. Such method can be applied to TFHE scheme and the new scheme BootMMPM to further reduce the key size both on the client’s side and on the server’s side.

Compared with the TFHE scheme, the new scheme BootMMPM also has slight improvement in run time. The following table shows that for r=poly(n)r={\rm poly}(n), the time improvement of BootMMPM is a constant factor, while the key-size improvement is a polynomial factor.

Schemes TFHE BootMMPM
phase accumulation time complexity 12(nlBNr)log(Nr)12(nl_{B}Nr)\log(Nr) 12(nlBNr)logN12(nl_{B}Nr)\log N
bootstrapping key size 8(nlBNlogQ)r8(nl_{B}N\log Q)r 8(nlBNlogQ)8(nl_{B}N\log Q)
key-switching key size (n+1)NBKSlKS(n+1)NB_{\rm KS}l_{\rm KS} (logQ)r(\log Q)r (n+1)NBKSlKS(n+1)NB_{\rm KS}l_{\rm KS} (logQ)(\log Q)

This paper reports the following work:

  1. 1.

    Classification of all monic monomial permutation matrices under similar transformations. It turns out that any r×rr\times r monic monomial permutation matrix is similar to a block diagonal matrix, where each block in the diagonal is of the form

    [xu0xu1xu2xuk1],\begin{bmatrix}&&&&x^{u_{0}}\\ x^{u_{1}}&&&&\\ &x^{u_{2}}&&&\\ &&\ddots&&\\ &&&x^{u_{k-1}}&\end{bmatrix}, (I.6)

    where k1k\geq 1, and if k=1k=1, then (I.6) is just xu0x^{u_{0}}.

  2. 2.

    Computation of the order of any monic monomial permutation matrix. Only cyclic subgroups of order 2Nr2Nr in the group MMPMr{\rm MMPM}_{r} of r×rr\times r monic monomial permutation matrices are useful in bootstrapping.

  3. 3.

    Classification of cyclic subgroups of MMPMr{\rm MMPM}_{r} by their number of orbits when acting on the following set of monic monomial indicator vectors:

    MMIVr:={xi𝐞j|i=0,,2N1,j=1,,r},{\rm MMIV}_{r}:=\{x^{i}\mathbf{e}_{j}\,\big{|}\,i=0,\ldots,2N-1,\ j=1,\ldots,r\}, (I.7)

    where 𝐞j\mathbf{e}_{j} is the rr-dimensional vector whose jj-entry is 11 while all other entries are 0. Only cyclic subgroups of order 2Nr2Nr and 1 orbit have test-coefficient look-up property.

  4. 4.

    construction of test polynomial vector for any cyclic subgroup of order 2Nr2Nr and 1 orbit.

  5. 5.

    A new algorithm BootMMPM for functional bootstrapping based on the cyclic subgroup of order 2Nr2Nr and 1 orbit that is generated by [x𝑰(r1)×(r1)]\begin{bmatrix}&x\\ \boldsymbol{I}_{(r-1)\times(r-1)}\end{bmatrix}.

  6. 6.

    Implementation of BootMMPM on PALISADE library[19], and experiments of bootstrapping with the identity function f(x)=xf(x)=x on ciphertexts where the plaintext size ranges from 5 bits to 15 bits.

The content is arranged as follows. In Section 2, some terminology, notations, and basics of FHEW/TFHE functional bootstrapping are introduced. In Section 3, theoretical investigation of the monic monomial permutation matrix group is done. In Section 4, the new algorithm BootMMPM is proposed and analyzed. In Section 5, experimental results on BootMMPM are reported.

II Notations and Basics of FHEW/TFHE Functional Bootstrapping

We first present some notations and terminology:

(1) For any integer n>0n>0, denote by [n][n] the set {0,1,,n1}\{0,1,\cdots,n-1\}.

(2) Given a polynomial a=a0+a1x++aN1xN1a=a_{0}+a_{1}x+\cdots+a_{N-1}x^{N-1}, denote by a=(a0,a1,,aN1)\overrightarrow{a}=(a_{0},a_{1},\cdots,a_{N-1}) its coefficient vector.

(3) Given a matrix 𝑨\boldsymbol{A}, denote by 𝑨(i,j)\boldsymbol{A}(i,j) its (i,j)(i,j)-th entry.

(4) If gg is an element of group GG, denote by g\left\langle g\right\rangle the cyclic subgroup generated by gg.

(5) That a random variable xx\in\mathbb{Z} has zero-centered subgaussian distribution with variance proxy Var(x)=σQ{\rm Var}(x)=\sigma\ll Q, refers to the property that there exists a constant C>0C>0, such that for all u>0u>0, Prob(|x|>u)Ceσu2{\rm Prob}(|x|>u)\leq Ce^{-\sigma u^{2}}. In particular, if xx is Gaussian with variance σ\sigma, then it is subgaussian with variance proxy σ\sigma.

The heuristic bound of subgaussian random variable xx is HVar(x)H\sqrt{{\rm Var}(x)}, where constant H=O(1)H=O(1) is determined by the failure probability of the bound.

(6) Let n,Nn,N be both powers of 2, where n<Nn<N. Let qq<Qq\leq q^{\prime}<Q be three positive integers, where qq^{\prime} is even. For any M{n,N}M\in\{n,N\} and p{q,q,Q}p\in\{q,q^{\prime},Q\}, set

M:=[x]/(xM+1),M,p:=p[x]/(xM+1).{\mathcal{R}}_{M}:=\mathbb{Z}[x]/(x^{M}+1),\ \ \ {\mathcal{R}}_{M,p}:=\mathbb{Z}_{p}[x]/(x^{M}+1). (II.1)

(7) Let tt be an even positive integer. A function f:ttf:{\mathbb{Z}}_{t}\longrightarrow\mathbb{Z}_{t^{\prime}} is said to be nega-cyclic, if for any k[t/2]k\in[t/2], f(k+t/2modt)=f(k)modtf(k+t/2\ {\rm mod}\ t)=-f(k)\mod t^{\prime}.

Let 2N>t2N>t, and let f:2Ntf^{\prime}:{\mathbb{Z}}_{2N}\longrightarrow\mathbb{Z}_{t^{\prime}} be a nega-cyclic function such that for all mtm\in{\mathbb{Z}}_{t}, all e2Ne\in{\mathbb{Z}}_{2N} satisfying 2|e|<2N/t2|e|<\lfloor 2N/t\rfloor,

f(m2N/t+e)=f(m).f^{\prime}(m\lfloor 2N/t\rfloor+e)=f(m). (II.2)

Then ff^{\prime} is called a nega-cyclic extension of ff from t{\mathbb{Z}}_{t} to 2N{\mathbb{Z}}_{2N}.

(8) An LWEn,q{\rm LWE}_{n,q} ciphertext of BFV format, with modulus qq, dimension nn, and secret 𝒔qn\boldsymbol{s}\in{\mathbb{Z}}_{q}^{n}, is of the form (𝒂,b)(\boldsymbol{a},b), where 𝒂qn\boldsymbol{a}\in{\mathbb{Z}}_{q}^{n}, bqb\in{\mathbb{Z}}_{q}, and the phase

phase(𝒂,b):=b𝒂𝒔=mq/t+emodq,{\rm phase}(\boldsymbol{a},b):=b-\boldsymbol{a}\cdot\boldsymbol{s}=m\lfloor q/t\rfloor+e\ {\rm mod}\ q, (II.3)

such that mtm\in{\mathbb{Z}}_{t} is the plaintext, and eqe\in{\mathbb{Z}}_{q} is the error. The ciphertext is decryptable if and only if 2|e|<q/t2|e|<\lfloor q/t\rfloor.

Given a message mtm\in{\mathbb{Z}}_{t}, the trivial encryption of mm in LWEn,q{\rm LWE}_{n,q} is the ciphertext (0n,mq/t)modq(0^{n},m\lfloor q/t\rfloor){\rm mod}\ q. It is independent of secret 𝒔\boldsymbol{s}.

(9) Given an LWEn,q{\rm LWE}_{n,q} ciphertext (𝒂,b)(\boldsymbol{a},b), the modulus switch from qq to qq^{\prime} outputs an LWEn,q{\rm LWE}_{n,q^{\prime}} ciphertext (𝒂,b)(\boldsymbol{a}^{\prime},b^{\prime}) that encrypts the same plaintext as the input ciphertext:

(𝒂,b)=(𝒂q/q,bq/q).(\boldsymbol{a}^{\prime},b^{\prime})=(\lfloor\boldsymbol{a}q^{\prime}/q\rceil,\lfloor bq^{\prime}/q\rceil). (II.4)

(10) Let B>1B>1 be an integer. The BB-digit decomposition (or gadget decomposition) of an integer x[0,q)x\in[0,q) generates an integer sequence of length lB:=logBql_{B}:=\lceil\log_{B}q\rceil: x0,x1,,xlBx_{0},x_{1},\ldots,x_{l_{B}}, where each xi[B]x_{i}\in[B], and x=i[lB]xiBix=\sum_{i\in[l_{B}]}x_{i}B^{i}.

The BB-digit decomposition operation on q{\mathbb{Z}}_{q} is denoted by 𝒈B1\boldsymbol{g}_{B}^{-1}. Integer BB is called the digit decomposition base.

(11) Given an LWEn,q{\rm LWE}_{n,q} ciphertext (𝒂,b)(\boldsymbol{a},b) with secret 𝒔qn\boldsymbol{s}\in{\mathbb{Z}}_{q}^{n}, the key switch from 𝒔\boldsymbol{s} to 𝒛qN\boldsymbol{z}\in{\mathbb{Z}}_{q}^{N} outputs an LWEN,q{\rm LWE}_{N,q} ciphertext (𝒂z,bz)(\boldsymbol{a}_{z},b_{z}) encrypting the same plaintext as the input ciphertext but under secret 𝒛\boldsymbol{z}.

Key switch requires not only all the components of 𝒔=(s1,,sn)\boldsymbol{s}=(s_{1},\ldots,s_{n}) to be encrypted with 𝒛\boldsymbol{z} beforehand, but also the multiples of the components of the form siBKSjks_{i}B_{KS}^{j}k, where (i) i{1,,n}i\in\{1,\ldots,n\}, (ii) BKSB_{\rm KS} is the digit decomposition base, (iii) j[lKS]j\in[l_{\rm KS}] where lKS=logBKSql_{\rm KS}=\lceil\log_{B_{\rm KS}}q\rceil, (iv) k[BKS]k\in[B_{\rm KS}]. Let ct(i,j,k)\texttt{ct}(i,j,k) be an LWEN,q{\rm LWE}_{N,q} ciphertext encrypting siBKSjkmodqs_{i}B_{KS}^{j}k\ {\rm mod}\ q with secret 𝒛\boldsymbol{z}. These ciphertexts are called the key-switching keys; they cannot be decrypted correctly with 𝒛\boldsymbol{z}.

Let 𝒂=(a1,,an)\boldsymbol{a}=(a_{1},\ldots,a_{n}), and for each aia_{i} taken as an integer in [0,q)[0,q), let 𝒈BKS1(ai)=(ai,j)j[lKS]\boldsymbol{g}^{-1}_{B_{KS}}(a_{i})=(a_{i,j})_{j\in[l_{\rm KS}]} be its BKSB_{KS}-digit decomposition. Then

(𝒂z,bz)=(0N,b)i{1,,n},j[lKS]ct(i,j,ai,j)modq.(\boldsymbol{a}_{z},b_{z})=(0^{N},b)-\sum\limits_{i\in\{1,\ldots,n\},j\in[l_{\rm KS}]}\hskip-14.22636pt\texttt{ct}(i,j,a_{i,j})\ \ \,{\rm mod}\ q. (II.5)

(12) An RLWEn,q{\rm RLWE}_{n,q} ciphertext of BFV format, with modulus qq, ring dimension nn that is a power of 2, and secret key sn,qs\in{\cal R}_{n,q}, is of the form (a,b)(a,b), where a,bn,qa,b\in{\cal R}_{n,q}, and the phase

phase(a,b):=bas=mq/t+emodq,{\rm phase}(a,b):=b-as=m\lfloor q/t\rfloor+e\ {\rm mod}\ q, (II.6)

such that mn,tm\in{\cal R}_{n,t} is the plaintext, and en,qe\in{\cal R}_{n,q} is the error.

The ciphertext is decryptable if and only if 2e<q/t.2\|e\|_{\infty}<\lfloor q/t\rfloor. Given a message mn,tm\in{\cal R}_{n,t}, the trivial encryption of mm in RLWEn,q{\rm RLWE}_{n,q} is the ciphertext (0,mq/t)(0,m\lfloor q/t\rfloor). It is independent of secret ss.

(13) Given an RLWEn,q{\rm RLWE}_{n,q} ciphertext (a,b)(a,b) (where a=i[n]aixia=\sum_{i\in[n]}a_{i}x^{i}, b=j[n]bjxjb=\sum_{j\in[n]}b_{j}x^{j}) encrypting a message m=k[n]mkxkm=\sum_{k\in[n]}m_{k}x^{k} with secret key s=l[n]slxls=\sum_{l\in[n]}s_{l}x^{l}, the constant-term extraction outputs an LWEn,q{\rm LWE}_{n,q} ciphertext (a′′,b′′)(a^{\prime\prime},b^{\prime\prime}) encrypting the constant term m0tm_{0}\in{\mathbb{Z}}_{t} with secret key s=(s0,s1,,sn1,1)qn\overrightarrow{s}=(s_{0},s_{1},\ldots,s_{n-1},1)\in{\mathbb{Z}}_{q}^{n}:

(a′′,b′′)=(a(x1),b0)=(a0,an1,,a2,a1,b0).(a^{\prime\prime},b^{\prime\prime})=(\overrightarrow{a(x^{-1})},b_{0})=(a_{0},-a_{n-1},\ldots,-a_{2},-a_{1},b_{0}). (II.7)

(14) An RGSWn,q{\rm RGSW}_{n,q} ciphertext with modulus qq, ring dimension nn that is a power of 2, secret key sn,qs\in{\cal R}_{n,q}, and digit decomposition base BB, is an 2lB×22l_{B}\times 2 matrix CC with entries in n,q{\cal R}_{n,q}, where lB=logBql_{B}=\lceil\log_{B}q\rceil, such that the phase

phase(C):=C(1s)=m(𝒈Bs𝒈B)+𝒆modq,{\rm phase}(C):=C\left(\begin{array}[]{c}1\\ -s\end{array}\right)=m\left(\begin{array}[]{c}\boldsymbol{g}_{B}\\ -s\boldsymbol{g}_{B}\end{array}\right)+\boldsymbol{e}\ {\rm mod}\ q, (II.8)

with 𝒈B=[B0B1BlB1]T2lB\boldsymbol{g}_{B}=[B^{0}\ B^{1}\ \cdots\ B^{l_{B}-1}]^{T}\in{\mathbb{Z}}^{2l_{B}}, mn,tm\in{\cal R}_{n,t} being the plaintext, and 𝒆n,q2lB\boldsymbol{e}\in{\cal R}_{n,q}^{2l_{B}} being the error.

The ciphertext is decryptable if and only if 2𝒆<q/t.2\|\boldsymbol{e}\|_{\infty}<\lfloor q/t\rfloor. Given a message mn,tm\in{\cal R}_{n,t}, the trivial encryption of mm in RGSWn,q{\rm RGSW}_{n,q} is the ciphertext m(𝒈B𝒈B)m\left(\begin{array}[]{cc}\boldsymbol{g}_{B}\\ &\boldsymbol{g}_{B}\end{array}\right). It is independent of secret ss.

The multiplication of an RLWEn,q{\rm RLWE}_{n,q} ciphertext (a,b)(a,b) with an RGSWn,q{\rm RGSW}_{n,q} ciphertext CC under the same secret, is

(𝒈B1(a,b))Cmodqn,q2,\left(\boldsymbol{g}_{B}^{-1}(a,b)\right)C\ {\rm mod}\ q\ \ \ \in{\cal R}_{n,q}^{2}, (II.9)

where the BB-digit decomposition operator 𝒈B1\boldsymbol{g}_{B}^{-1} acts on a,ba,b separately, so that 𝒈B1(a,b)n,B2lB\boldsymbol{g}_{B}^{-1}(a,b)\in{\cal R}_{n,B}^{2l_{B}}. (II.9) is an RLWEn,q{\rm RLWE}_{n,q} ciphertext encrypting the product of the plaintexts in the two ciphertexts respectively. Similarly, the multiplication between two RGSWn,q{\rm RGSW}_{n,q} ciphertexts C1,C2C_{1},C_{2}, is (𝒈B1(C1))C2\left(\boldsymbol{g}_{B}^{-1}(C_{1})\right)C_{2}.

(15) The CMux (controlled multiple executions) operator controlled by ternary variable d{1,0,1}d\in\{1,0,-1\} and three operations E1,E0,E1E_{1},E_{0},E_{-1}, outputs operation EdE_{d}. Set

d+:=max(d,0),d:=max(d,0).d_{+}:=\max(d,0),\ \ \ \,d_{-}:=\max(-d,0). (II.10)

Then the CMux operator can be denoted by CMux(d+,d;E1,E0,E1){\rm CMux}(d+,d-;E_{1},E_{0},E_{-1}), whose expression is

E0+(E1E0)d++(E1E0)d={E1,if d=1,E0,if d=0,E1,if d=1.E_{0}+(E_{1}-E_{0})d_{+}+(E_{-1}-E_{0})d_{-}=\left\{\begin{array}[]{ll}E_{1},&\hbox{if }d=1,\\ E_{0},&\hbox{if }d=0,\\ E_{-1},&\hbox{if }d=-1.\end{array}\right. (II.11)
Definition 1

Given an LWEn,q{\rm LWE}_{n,q} ciphertext encrypting message mtm\in{\mathbb{Z}}_{t}, and a nega-cyclic function f:ttf:{\mathbb{Z}}_{t}\longrightarrow{\mathbb{Z}}_{t^{\prime}}, the functional bootstrapping is a procedure of generating a decryptable LWEn,q{\rm LWE}_{n,q} ciphertext encrypting message f(m)tf(m)\in{\mathbb{Z}}_{t^{\prime}} with the same secret key as the input.

Gentry’s bootstrapping idea is to execute the decryption circuit homomorphically. As the decryption needs to use the secret key 𝒔\boldsymbol{s}, it must be provided beforehand and in a ciphertext form. The first step of decryption is to compute the phase of the input LWE ciphertext ct0=(𝒂,b)\texttt{ct}_{0}=(\boldsymbol{a},b), which is essentially the inner product between vectors 𝒂,𝒔\boldsymbol{a},\boldsymbol{s}. Now that 𝒔\boldsymbol{s} is encrypted, the inner product is between a plaintext vector and a ciphertext vector. This can be done similar to the key switch procedure.

For example, for 𝒂=(a1,,an)\boldsymbol{a}=(a_{1},\ldots,a_{n}), let 𝒈B1(ai)=(ai,j)j[lB]\boldsymbol{g}^{-1}_{B}(a_{i})=(a_{i,j})_{j\in[l_{B}]} be the BB-digit decomposition of aia_{i}, where lB=logBql_{B}=\lceil\log_{B}q\rceil; if zN,Qz\in{\cal R}_{N,Q} is the new secret key, then as in (II.5), for 𝒔=(si)i=1,,n\boldsymbol{s}=(s_{i})_{i=1,\ldots,n}, let each ai,jBjsimodQa_{i,j}B^{j}s_{i}\,{\rm mod}\ Q be encrypted to an RGSWN,Q{\rm RGSW}_{N,Q} ciphertext ct(i,j,ai,j)\texttt{ct}(i,j,a_{i,j}) with secret key 𝒛\boldsymbol{z}, then

ct2=b(𝒈B𝒈B)i{1,,n},j[lKS]ct(i,j,ai,j)modQ\texttt{ct}_{2}=b\left(\begin{array}[]{cc}\boldsymbol{g}_{B}\\ &\boldsymbol{g}_{B}\end{array}\right)-\sum\limits_{i\in\{1,\ldots,n\},j\in[l_{\rm KS}]}\hskip-14.22636pt\texttt{ct}(i,j,a_{i,j})\ \ \,{\rm mod}\ Q (II.12)

is an RGSWN,Q{\rm RGSW}_{N,Q} ciphertext encrypting phase(𝒂,b)modq{\rm phase}(\boldsymbol{a},b)\ {\rm mod}\ q. The procedure of computing the additions in (II.12) homomorphically is called phase accumulation. The ciphertexts ct(i,j,ai,j)\texttt{ct}(i,j,a_{i,j}) are called FHEW bootstrapping keys.

The second step of decryption is to remove the error in the phase by rounding, and execute the “modulo-qq” operation. In bootstrapping, both need to be done homomorphically. To get rid of the error part of phase(𝒂,b)modq{\rm phase}(\boldsymbol{a},b)\,{\rm mod}\ q, the FHEW scheme uses the monomial representation of q{\mathbb{Z}}_{q}: for a power-of-2 integer N>qN>q, first the input ciphertext is changed into an LWEn,2N{\rm LWE}_{n,2N} ciphertext ct1\texttt{ct}_{1} by modulus switch, then each ai,jBjsimod 2Na_{i,j}B^{j}s_{i}\,{\rm mod}\ 2N is represented as a monic monomial xai,jBjsix^{a_{i,j}B^{j}s_{i}} before being encrypted in an RGSWN,Q{\rm RGSW}_{N,Q} ciphertext.

In the plaintext, the additions in phase accumulation (II.12) are done in the exponent space of a monomial; in the ciphertext, the additions are done by RGSW ciphertext multiplications. Since RGSW ciphertexts have the unique property that the error in the product of two RGSW ciphertexts is additive in the error of the second ciphertext, ciphertext ct2\texttt{ct}_{2} has small error growth. After phase accumulation, the plaintext becomes

xphase(ct1)=xm2N/t+e=xm2N/txe,x^{{\rm phase}(\texttt{ct}_{1})}=x^{m\lfloor 2N/t\rfloor+e^{\prime}}=x^{m\lfloor 2N/t\rfloor}x^{e^{\prime}}, (II.13)

where the error ee^{\prime} satisfies 2|e|<2N/t2|e^{\prime}|<\lfloor 2N/t\rfloor.

For a nega-cyclic function f:ttf:{\mathbb{Z}}_{t}\longrightarrow{\mathbb{Z}}_{t^{\prime}}, let f:2Ntf^{\prime}:{\mathbb{Z}}_{2N}\longrightarrow{\mathbb{Z}}_{t^{\prime}} be a nega-cyclic extension of ff, so that for all u=i2N/t+emod 2Nu=i\lfloor 2N/t\rfloor+e\ {\rm mod}\ 2N, where iti\in{\mathbb{Z}}_{t}, and e2Ne\in{\mathbb{Z}}_{2N} satisfies 2|e|<2N/t2|e|<\lfloor 2N/t\rfloor,

f(u)=2|e|<2N/ti[t],e2N,f(i)xi2N/teN,t.f^{\prime}(u)=\sum_{\stackrel{{\scriptstyle\scriptscriptstyle i\in[t],e\in{\mathbb{Z}}_{2N},}}{{\scriptscriptstyle 2|e|<\lfloor 2N/t\rfloor}}}f(i)x^{-i\lfloor 2N/t\rfloor-e}\in{\cal R}_{N,t^{\prime}}. (II.14)

The right side of (II.14) is a polynomial in N,t{\cal R}_{N,t^{\prime}}, called the test polynomial of ff.

In FHEW scheme, the trivial RLWEN,Q{\rm RLWE}_{N,Q}-encryption of test polynomial (II.14) is multiplied with RLWEN,Q{\rm RLWE}_{N,Q} ciphertext ct2\texttt{ct}_{2}, the result is an RLWEN,Q{\rm RLWE}_{N,Q} ciphertext ct3\texttt{ct}_{3} encrypting plaintext f(u)xm2N/txeN,tf^{\prime}(u)x^{m\lfloor 2N/t\rfloor}x^{e^{\prime}}\in{\cal R}_{N,t^{\prime}}.

The constant term of the plaintext in ct3\texttt{ct}_{3} is exactly f(m)f(m). Then constant-term extraction is used to obtain from ct3\texttt{ct}_{3} an LWEN,Q{\rm LWE}_{N,Q} ciphertext ct4\texttt{ct}_{4} encrypting f(m)f(m) with secret key z\overrightarrow{z}, according to (II.7).

After this, the key switch procedure is used to change the secret key to 𝒔qn\boldsymbol{s}\in{\mathbb{Z}}_{q}^{n}, resulting in an LWEn,Q{\rm LWE}_{n,Q} ciphertext ct5\texttt{ct}_{5}. Finally, the modulus switch from QQ to qq changes ct5\texttt{ct}_{5} to an LWEn,q{\rm LWE}_{n,q} ciphertext ct6\texttt{ct}_{6}, which is the output. This is the whole procedure of the FHEW scheme.

The TFHE scheme improves upon the FHEW scheme by merging the generation of ct2\texttt{ct}_{2} and ct3\texttt{ct}_{3} it starts from the trivial RLWEN,Q{\rm RLWE}_{N,Q}-encryption of test polynomial (II.14), and consecutively multiplies it from the right side with an RGSWN,Q{\rm RGSW}_{N,Q} ciphertext each encrypting a term of (II.12). Then ct3\texttt{ct}_{3} is generated without generating ct2\texttt{ct}_{2}. This trick replaces the product of two matrices to the product between a matrix and a vector.

A typical setting is where 𝒔\boldsymbol{s} is ternary, namely, 𝒔=(si)i=1,,n\boldsymbol{s}=(s_{i})_{i=1,\ldots,n} where each si{1,0,1}s_{i}\in\{1,0,-1\}. In this setting, the plaintext xaisix^{-a_{i}s_{i}} that corresponds to the term aisi-a_{i}s_{i} in phase(𝒂,b)=bi=1,,naisi{\rm phase}(\boldsymbol{a},b)=b-\sum_{i=1,\ldots,n}a_{i}s_{i}, has three possibilities: xai,1,xaix^{-a_{i}},1,x^{a_{i}}, if si=1,0,1s_{i}=1,0,-1, respectively. In terms of the CMux operator and its expression (II.11), for si+=max(si,0)s_{i+}=\max(s_{i},0) and si=max(si,0)s_{i-}=\max(-s_{i},0),

xaisi=CMux(si+,si;xai,1,xai)=1+(xai1)si++(xai1)si.\begin{array}[]{lll}x^{-a_{i}s_{i}}&=&{\rm CMux}(s_{i+},s_{i-};x^{-a_{i}},1,x^{a_{i}})\\ &=&1+(x^{-a_{i}}-1)s_{i+}+(x^{a_{i}}-1)s_{i-}.\end{array} (II.15)

In (II.15), if both si+,sis_{i+},s_{i-} are encrypted as RGSWN,Q{\rm RGSW}_{N,Q} ciphertexts, and 1 is trivially encrypted, then the right side becomes the sum of three RGSWN,Q{\rm RGSW}_{N,Q} ciphertexts; it replaces the product j[lKS]ct(i,j,ai,j)\prod_{j\in[l_{\rm KS}]}\texttt{ct}(i,j,a_{i,j}) in FHEW phase accumulation (II.12). The RGSWN,Q{\rm RGSW}_{N,Q} ciphertexts encrypting the si+,sis_{i+},s_{i-} are called TFHE bootstrapping keys when the secret is ternary.

In summary, the procedure of TFHE functional bootstrapping for LWE ciphertext with ternary secret is as follows:

Input:

  1. 1.

    LWEn,q{\rm LWE}_{n,q} ciphertext ct0\texttt{ct}_{0} to be bootstrapped, whose plaintext modulus is tt, whose plaintext is mtm\in{\mathbb{Z}}_{t} and whose secret is 𝒔=(si)i=1,,n\boldsymbol{s}=(s_{i})_{i=1,\ldots,n};

  2. 2.

    TFHE bootstrapping keys encrypting si+,sis_{i+},s_{i-} for i{1,,n}i\in\{1,\ldots,n\}, which are RGSWN,Q{\rm RGSW}_{N,Q} ciphertexts whose secret is z=i[N]zixiN,Qz=\sum_{i\in[N]}z_{i}x^{i}\in{\cal R}_{N,Q};

  3. 3.

    test polynomial of the form (II.14) in N,t{\cal R}_{N,t^{\prime}} , which encodes the nega-cyclic function f:ttf:{\mathbb{Z}}_{t}\longrightarrow{\mathbb{Z}}_{t^{\prime}};

  4. 4.

    key-switching keys, which are RLWEn,Q{\rm RLWE}_{n,Q} ciphertexts encrypting ziBKSjkmodQz_{i}B_{\rm KS}^{j}k\ {\rm mod}\ Q with secret 𝒔\boldsymbol{s} for all i[N]i\in[N], j[logBKSQ]j\in[\lceil\log_{B_{\rm KS}}Q\rceil], k[BKS]k\in[B_{\rm KS}], where BKSB_{\rm KS} is the digit decomposition base for key switch.

Output: LWEn,q{\rm LWE}_{n,q} ciphertext ct5\texttt{ct}_{5} encrypting f(m)tf(m)\in{\mathbb{Z}}_{t^{\prime}}.

Step 1. Modulus switch from qq to q=2Nq^{\prime}=2N. The result is an LWEn,q{\rm LWE}_{n,q^{\prime}} ciphertext ct1:=(a1,,an,b)\texttt{ct}_{1}:=(a_{1},\ldots,a_{n},b) with secret 𝒔\boldsymbol{s}.

Step 2. Phase accumulation (or blind rotation). It starts from the product ct2\texttt{ct}_{2} of the trivial RLWEN,Q{\rm RLWE}_{N,Q} encryption of the test polynomial and the trivial RGSWN,Q{\rm RGSW}_{N,Q} encryption of bqb\in{\mathbb{Z}}_{q}, for every i=1,,ni=1,\ldots,n, updates ct2\texttt{ct}_{2} by multiplying it from the right side with an RGSWN,Q{\rm RGSW}_{N,Q} ciphertext encrypting CMux(si+,si;xai,1,xai){\rm CMux}(s_{i+},s_{i-};x^{-a_{i}},1,x^{a_{i}}). The result, still denoted by ct2\texttt{ct}_{2}, is an RLWEN,Q{\rm RLWE}_{N,Q} ciphertext with secret zz.

Step 3. Constant-term extraction (also called sample extract) of ct2\texttt{ct}_{2}. The result is an LWEN,Q{\rm LWE}_{N,Q} ciphertext ct3\texttt{ct}_{3} encrypting f(m)f(m) with secret z\overrightarrow{z}.

Step 4. Key switch from z\overrightarrow{z} to 𝒔\boldsymbol{s}. The result is an LWEn,Q{\rm LWE}_{n,Q} ciphertext ct4\texttt{ct}_{4}.

Step 5. Modulus switch from QQ to qq. The result is an LWEn,q{\rm LWE}_{n,q} ciphertext ct5\texttt{ct}_{5}.

III Monomial Matrix Representation of Additive Cyclic Group

The order of an element gg in a group, denoted by order(g){\rm order}(g), is the smallest positive integer mm such that gm=1g^{m}=1, where 1 is the identity element.

When a group GG acts on a set SS, the action is said to be transitive, if for all x,ySx,y\in S, there exists a gGg\in G such that gx=ygx=y. The action is said to be regular or faithful, if for any gGg\in G, gx=xgx=x for all xSx\in S if and only if g=1g=1.

An 𝔽\mathbb{F}-representation of a group GG is a homomorphism from GG to some GL𝔽(𝒱)GL_{\mathbb{F}}({\mathcal{V}}), where 𝒱{\mathcal{V}} is a finite-dimensional 𝔽\mathbb{F}-vector space. Two representations 𝚽i:GGL𝔽(𝒱i)\boldsymbol{\Phi}_{i}:G\longrightarrow GL_{\mathbb{F}}({\mathcal{V}}_{i}) for i=1,2i=1,2, are said to be equivalent, if there is an 𝔽\mathbb{F}-linear isomorphism 𝑻:𝒱1𝒱2\boldsymbol{T}:{\mathcal{V}}_{1}\rightarrow{\mathcal{V}}_{2}, such that for all gGg\in G, 𝚽2(g)=𝑻𝚽1(g)𝑻1\boldsymbol{\Phi}_{2}(g)=\boldsymbol{T}\boldsymbol{\Phi}_{1}(g)\boldsymbol{T}^{-1}.

Now fix the field 𝔽\mathbb{F} as the following one, where NN is a power of 2:

𝔽=(x)/(xN+1).{\mathbb{F}}=\mathbb{Q}(x)/(x^{N}+1). (III.1)

For any r>0r>0, an element of GL(𝔽r)GL({\mathbb{F}}^{r}) is called a monic monomial permutation matrix if in the matrix, every row and every column respectively contains one and only one nonzero entry, and the entry is a monic monomial. All r×rr\times r monic monomial permutation matrices form a finite subgroup MMPMr{\rm MMPM}_{r} of GL(𝔽r)GL({\mathbb{F}}^{r}). It is easy to see that any r×rr\times r monic monomial permutation matrix 𝑨\boldsymbol{A} is of the form

𝑨=(xuiδi,ϕ(j))i,j[r],\boldsymbol{A}=(x^{u_{i}}\delta_{i,\phi(j)})_{i,j\in[r]}, (III.2)

where ui[2N]u_{i}\in[2N], δ\delta is the Kronecker symbol, and ϕSr\phi\in S_{r} is a permutation acting on [r][r].

Consider the additive cyclic group q{\mathbb{Z}}_{q^{\prime}}, where q=2Nrq^{\prime}=2Nr. The identity element is 0, and the generator is 1. Let 𝚽:qMMPMr\boldsymbol{\Phi}:\mathbb{Z}_{q^{\prime}}\longrightarrow{\rm MMPM}_{r} be a representation of group q\mathbb{Z}_{q^{\prime}}. Then 𝚽(q)\boldsymbol{\Phi}(\mathbb{Z}_{q^{\prime}}) is a subgroup generated by matrix 𝚽(1)\boldsymbol{\Phi}(1).

Lemma 1

Matrix 𝚽(1)\boldsymbol{\Phi}(1) is similar to diag(𝐀1,𝐁){\rm diag}(\boldsymbol{A}_{1},\boldsymbol{B}), where if setting k=1k=1, then 𝐀kMMPMrk\boldsymbol{A}_{k}\in{\rm MMPM}_{r_{k}} with 1rkr1\leq r_{k}\leq r, 𝐁MMPMrrk\boldsymbol{B}\in{\rm MMPM}_{r-r_{k}}, such that

𝑨k=[xuk,0xuk,1xuk,2xuk,rk1],\boldsymbol{A}_{k}=\begin{bmatrix}&&&&x^{u_{k,0}}\\ x^{u_{k,1}}&&&&\\ &x^{u_{k,2}}&&&\\ &&\ddots&&\\ &&&x^{u_{k,r_{k}-1}}&\end{bmatrix}, (III.3)

with each uk,i[2N]u_{k,i}\in[2N].

Proof:

Let r1r_{1} be the smallest among all the positive integers mm satisfying ϕm(0)=0\phi^{m}(0)=0. Then 1r1r1\leq r_{1}\leq r, and {ϕi(0),i[r1]}\{\phi^{i}(0),\ i\in[r_{1}]\} is the orbit of 0 under the action of ϕ\phi, which contains r1r_{1} different elements. Choose an arbitrary bijection ψ:[r]\[r1][r]\{ϕi(0),i[r1]}\psi:[r]\backslash[r_{1}]\longrightarrow[r]\backslash\{\phi^{i}(0),\ i\in[r_{1}]\}. Construct the following element ψSr\psi^{\prime}\in S_{r}: for all t[r]t\in[r],

ψ(t)={ϕt(0), if t[r1],ψ(t), else.\psi^{\prime}(t)=\left\{\begin{array}[]{ll}\phi^{t}(0),&\hbox{ if }t\in[r_{1}],\\ \psi(t),&\hbox{ else.}\end{array}\right. (III.4)

Set matrix 𝑻=(δi,ψ(j))i,j[r]\boldsymbol{T}=\big{(}\delta_{i,\psi^{\prime}(j)}\big{)}_{i,j\in[r]}. Then 𝑻1=(δψ(i),j)i,j[r]\boldsymbol{T}^{-1}=\big{(}\delta_{\psi^{\prime}(i),j})_{i,j\in[r]}. For all i,j[r]i,j\in[r], the (i,j)(i,j)-entry of matrix 𝑻1𝚽(1)𝑻\boldsymbol{T}^{-1}\boldsymbol{\Phi}(1)\boldsymbol{T} is

k,l[r]δψ(i),k(xukδk,ϕ(l))δl,ψ(j)=xuψ(i)δψ(i),ϕψ(j)=xuψ(i)δi,ψ1ϕψ(j).\begin{array}[]{lll}\displaystyle\sum\limits_{k,l\in[r]}\delta_{\psi^{\prime}(i),k}(x^{u_{k}}\delta_{k,\phi(l)})\delta_{l,\psi^{\prime}(j)}&=&x^{u_{\psi^{\prime}(i)}}\delta_{\psi^{\prime}(i),\phi\psi^{\prime}(j)}\\ &=&x^{u_{\psi^{\prime}(i)}}\delta_{i,{\psi^{\prime}}^{-1}\phi\psi^{\prime}(j)}.\end{array} (III.5)

Set ϕ=ψ1ϕψ\phi^{\prime}={\psi^{\prime}}^{-1}\phi\psi^{\prime}, set ui=uψ(i)u^{\prime}_{i}=u_{\psi^{\prime}(i)}, and set u1,i=uiu_{1,i}=u^{\prime}_{i} if i[r1]i\in[r_{1}].

For any j[r]j\in[r], if j[r1]j\in[r_{1}], then ϕ(j)=ϕj(0)\phi^{\prime}(j)=\phi^{j}(0) by (III.4), so δi,ϕ(j)=1\delta_{i,\phi^{\prime}(j)}=1 if and only if i=ϕ(j)=ψ1ϕj+1(0)=j+1modr1[r1]i=\phi^{\prime}(j)={\psi^{\prime}}^{-1}\phi^{j+1}(0)=j+1\ {\rm mod}\ r_{1}\in[r_{1}]. If j[r]\[r1]j\in[r]\backslash[r_{1}], then ϕψ(j)=ϕψ(j){ϕk(0),k[r1]}\phi\psi^{\prime}(j)=\phi\psi(j)\notin\{\phi^{k}(0),\ k\in[r_{1}]\}, so ϕ(j)=ψ1ϕψ(j)[r1]\phi^{\prime}(j)={\psi^{\prime}}^{-1}\phi\psi^{\prime}(j)\notin[r_{1}]. In particular, [r]\[r1][r]\backslash[r_{1}] is invariant under ϕ\phi^{\prime}.

So matrix 𝑻1𝚽(1)𝑻\boldsymbol{T}^{-1}\boldsymbol{\Phi}(1)\boldsymbol{T} is block-diagonal, the first block in the diagonal is 𝑨1\boldsymbol{A}_{1}, and the second block is 𝑩=(xui+r1δi+r1,ϕ(j+r1))i,j[rr1]\boldsymbol{B}=\left(x^{u^{\prime}_{i+r_{1}}}\delta_{i+r_{1},\phi^{\prime}(j+r_{1})}\right)_{i,j\in[r-r_{1}]}. ∎

Lemma 2

Matrix 𝚽(1)\boldsymbol{\Phi}(1) is similar to diag(𝐀1,𝐀2,,𝐀h){\rm diag}(\boldsymbol{A}_{1},\boldsymbol{A}_{2},\ldots,\boldsymbol{A}_{h}), where h1h\geq 1, and for every 1kh1\leq k\leq h, 𝐀kMMPMrk\boldsymbol{A}_{k}\in{\rm MMPM}_{r_{k}}, where each rk1r_{k}\geq 1, k=1hrk=r\sum_{k=1}^{h}r_{k}=r, and each 𝐀k\boldsymbol{A}_{k} is of the form (III.3).

Proof:

Induction on rr. When r=1r=1, then h=1h=1, and the conclusion follows Lemma 1. Assuming the conclusion holds for all r<lr<l, when r=lr=l, by Lemma 1 and applying the induction hypothesis to matrix 𝑩\boldsymbol{B}, we get the conclusion. ∎

Lemma 3

Let matrix 𝐀=(xuiδτ(i),j)i,j[r]\boldsymbol{A}=(x^{u_{i}}\delta_{\tau(i),j})_{i,j\in[r]}, where τ(i)=i1modr\tau(i)=i-1\mod r for all i[r]i\in[r], then for all l1l\geq 1,

𝑨l=(xt[l]uτt(i)δτl(i),j)i,j[r].\boldsymbol{A}^{l}=\left(x^{\sum_{t\in[l]}u_{\tau^{t}(i)}}\delta_{\tau^{l}(i),j}\right)_{i,j\in[r]}. (III.6)
Proof:

When l=1l=1, the conclusion is trivial. Assume that the conclusion holds for all lkl\leq k. When l=k+1l=k+1,

𝑨k+1(i,j)=v[r]𝑨k(i,v)𝑨(v,j)=v[r]xt[k]uτt(i)δτk(i),vxuvδτ(v),j=xt[k+1]uτt(i)δτk+1(i),j.\begin{array}[]{lll}\boldsymbol{A}^{k+1}(i,j)&=&\displaystyle\sum\limits_{v\in[r]}\boldsymbol{A}^{k}(i,v)\,\boldsymbol{A}(v,j)\\ &=&\displaystyle\sum\limits_{v\in[r]}x^{\sum_{t\in[k]}u_{\tau^{t}(i)}}\delta_{\tau^{k}(i),v}x^{u_{v}}\delta_{\tau(v),j}\\[5.69054pt] &=&x^{\sum_{t\in[k+1]}u_{\tau^{t}(i)}}\delta_{\tau^{k+1}(i),j}.\end{array} (III.7)

Lemma 4

For the matrix 𝐀\boldsymbol{A} in Lemma 3,

order(𝑨)=r×order(xi[r]ui).{\rm order}(\boldsymbol{A})=r\times{\rm order}(x^{\sum_{i\in[r]}u_{i}}). (III.8)

As a corollary, for the matrix 𝚽(1)\boldsymbol{\Phi}(1) in Lemma 2, order(𝚽(1))=LCM(ord(𝐀i),i=1..h){\rm order}(\boldsymbol{\Phi}(1))={\rm LCM}({\rm ord}(\boldsymbol{A}_{i}),i=1..h).

Proof:

By induction, it is easy to prove that τj(i)=ijmodr\tau^{j}(i)=i-j\mod r for all i,j[r]i,j\in[r]. So {τt(i)|t[r]}={0,1,,r1}\{\tau^{t}(i)|t\in[r]\}=\{0,1,\cdots,r-1\}. As a consequence, xt[r]uτt(i)=xt[r]utx^{\sum_{t\in[r]}u_{\tau^{t}(i)}}=x^{\sum_{t\in[r]}u_{t}} is independent of ii.

By (III.6) and τr=1\tau^{r}=1,

𝑨r=xi[r]ui𝑰r×r,\boldsymbol{A}^{r}=x^{\sum_{i\in[r]}u_{i}}\boldsymbol{I}_{r\times r}, (III.9)

where 𝑰r×r\boldsymbol{I}_{r\times r} is the identity matrix. So 𝑨r×order(xi[r]ui)=𝑰r×r.\boldsymbol{A}^{r\times{\rm order}(x^{\sum_{i\in[r]}u_{i}})}=\boldsymbol{I}_{r\times r}. We prove that m=r×order(xi[r]ui)m=r\times{\rm order}(x^{\sum_{i\in[r]}u_{i}}) is the smallest among all the positive integers ll such that 𝑨l=𝑰r×r\boldsymbol{A}^{l}=\boldsymbol{I}_{r\times r}.

Suppose there exists a number 1c<m1\leq c<m such that 𝑨c=𝑰r×r\boldsymbol{A}^{c}=\boldsymbol{I}_{r\times r}. Then c=ar+bc=ar+b for some a<order(xi[r]ui)a<{\rm order}(x^{\sum_{i\in[r]}u_{i}}) and b[r]b\in[r]. By (III.9),

𝑨c=(𝑨r)a𝑨b=xai[r]ui𝑨b.\boldsymbol{A}^{c}=(\boldsymbol{A}^{r})^{a}\boldsymbol{A}^{b}=x^{a\sum_{i\in[r]}u_{i}}\boldsymbol{A}^{b}. (III.10)

If b0b\neq 0, then τb1\tau^{b}\neq 1, and by (III.6), 𝑨b\boldsymbol{A}^{b} is not a diagonal matrix, so 𝑨c𝑰r×r\boldsymbol{A}^{c}\neq\boldsymbol{I}_{r\times r} in (III.10). If b=0b=0, then since a<order(xi[r]ui)a<{\rm order}(x^{\sum_{i\in[r]}u_{i}}), (xi[r]ui)a1\left(x^{\sum_{i\in[r]}u_{i}}\right)^{a}\neq 1, again 𝑨c𝑰r×r\boldsymbol{A}^{c}\neq\boldsymbol{I}_{r\times r} in (III.10). ∎

Example 1

Let

𝚽(1)=[x𝑰(r1)×(r1)].\boldsymbol{\Phi}(1)=\begin{bmatrix}&x\\ \boldsymbol{I}_{(r-1)\times(r-1)}&\end{bmatrix}. (III.11)

Then order(𝚽(1))=r×order(x)=2Nr=q{\rm order}(\boldsymbol{\Phi}(1))=r\times{\rm order}(x)=2Nr=q^{\prime}. When r=1r=1, (III.11) is just the monic monomial representation used in FHEW/TFHE. When setting x=1x=1, (III.11) is the the permutation matrix representation used in AP14.

For any c=ar+bc=ar+b, where a[2N],b[r]a\in[2N],b\in[r],

𝚽(c)=[0xa+1𝑰b×bxa𝑰(rb)×(rb)0].\boldsymbol{\Phi}(c)=\begin{bmatrix}0&x^{a+1}\boldsymbol{I}_{b\times b}\\ x^{a}\boldsymbol{I}_{(r-b)\times(r-b)}&0\\ \end{bmatrix}. (III.12)

In particular, 𝚽(r)=x𝐈r×r.\boldsymbol{\Phi}(r)=x\boldsymbol{I}_{r\times r}. For any 𝐯=(vi)i[r]𝔽r\boldsymbol{v}=(v_{i})_{i\in[r]}\in{\mathbb{F}}^{r},

𝚽(c)𝒗=(xa+1vb,xa+1vb+1,,xa+1vr1,xav0,xav1,,xavb1),\begin{array}[]{lll}\boldsymbol{\Phi}(c)\boldsymbol{v}&=&(x^{a+1}v_{b},x^{a+1}v_{b+1},\ldots,x^{a+1}v_{r-1},\\ &&\hfill x^{a}v_{0},x^{a}v_{1},\ldots,x^{a}v_{b-1}),\end{array} (III.13)

which equals the Hadamard product between vectors (xa+1,xa+1,,xa+1rb,xa,xa,,xab)(\underbrace{x^{a+1},x^{a+1},\ldots,x^{a+1}}_{r-b},\underbrace{x^{a},x^{a},\ldots,x^{a}}_{b}) and (vb,vb+1(v_{b},v_{b+1}, ,vr1,v0,v1,,vb1)\ldots,v_{r-1},v_{0},v_{1},\ldots,v_{b-1}).

Let 𝐞1,,𝐞r\mathbf{e}_{1},\ldots,\mathbf{e}_{r} be the canonical basis of 𝔽r{\mathbb{F}}^{r}, namely, the ii-th entry of 𝐞i\mathbf{e}_{i} is 1, while all other entries are 0. Set

MMIVr:={xi𝐞j|i[2N],j[r]}.{\rm MMIV}_{r}:=\{x^{i}\mathbf{e}_{j}\,\big{|}\,i\in[2N],j\in[r]\}. (III.14)

For any 𝑨=(xuiδi,ϕ(j))i,j[r]MMPMr\boldsymbol{A}=\left(x^{u_{i}}\delta_{i,\phi(j)}\right)_{i,j\in[r]}\in{\rm MMPM}_{r},

𝑨(xk𝐞l)=(xuiδi,ϕ(j))i,j[r](xkδl,m)m[r]=(xui+kδi,ϕ(l))i[r]=xuϕ(l)+k𝐞ϕ(l).\begin{array}[]{lll}\boldsymbol{A}(x^{k}\mathbf{e}_{l})&=&\left(x^{u_{i}}\delta_{i,\phi(j)}\right)_{i,j\in[r]}\left(x^{k}\delta_{l,m}\right)_{m\in[r]}\\ &=&\left(x^{u_{i}+k}\delta_{i,\phi(l)}\right)_{i\in[r]}\\ &=&x^{u_{\phi(l)}+k}\mathbf{e}_{\phi(l)}.\end{array} (III.15)

So MMIVr{\rm MMIV}_{r} is closed under the action of MMPMr{\rm MMPM}_{r}.

Lemma 5

Let 𝚽(1)\boldsymbol{\Phi}(1) take the form in Lemma 2, namely, 𝚽(1)=diag(𝐀1,𝐀2,,𝐀h)\boldsymbol{\Phi}(1)={\rm diag}(\boldsymbol{A}_{1},\boldsymbol{A}_{2},\ldots,\boldsymbol{A}_{h}), where for 1kh1\leq k\leq h, 𝐀kMMPMrk\boldsymbol{A}_{k}\in{\rm MMPM}_{r_{k}} with k=1hrk=r\sum_{k=1}^{h}r_{k}=r, such that 𝐀k(i,j)=xuk,iδj,i1modr\boldsymbol{A}_{k}(i,j)=x^{u_{k,i}}\delta_{j,i-1\ {\rm mod}\ r} for all i,j[rk]i,j\in[r_{k}]. Then the action of group 𝚽(2Nr)\boldsymbol{\Phi}({\mathbb{Z}}_{2Nr}) on set MMIVr{\rm MMIV}_{r} is regular, and the number of orbits is

i=1h2Nriorder(𝑨i).\sum\limits_{i=1}^{h}\frac{2Nr_{i}}{{\rm order}(\boldsymbol{A}_{i})}. (III.16)
Proof:

Since MMIVr{\rm MMIV}_{r} contains the basis {𝒆j|j[r]}\{\boldsymbol{e}_{j}\,|\,j\in[r]\} of 𝔽r{\mathbb{F}}^{r}, any linear transformation of 𝔽r{\mathbb{F}}^{r} leaving each element of MMIVr{\rm MMIV}_{r} invariant must be the identity transformation. So the action of 𝚽(2Nr)\boldsymbol{\Phi}({\mathbb{Z}}_{2Nr}) on MMIVr{\rm MMIV}_{r} is regular. Below we prove (III.16) by induction.

Set

𝑨=diag(𝑨1,𝑰r2×r2,,𝑰rh×rh).\boldsymbol{A}={\rm diag}(\boldsymbol{A}_{1},\boldsymbol{I}_{r_{2}\times r_{2}},\ldots,\boldsymbol{I}_{r_{h}\times r_{h}}). (III.17)

Then 𝑨\boldsymbol{A} generates a subgroup 𝑨\langle\boldsymbol{A}\rangle of MP(𝔽r)MP({\mathbb{F}}^{r}). We prove that the number of orbits in 𝒳\cal X under the action of 𝑨\langle\boldsymbol{A}\rangle is 2Nr1/order(𝑨1)2Nr_{1}/{\rm order}(\boldsymbol{A}_{1}).

By (III.8),

order(𝑨1)=r1×order(xv0), where v0=t[r1]u1,t.{\rm order}(\boldsymbol{A}_{1})=r_{1}\times{\rm order}(x^{v_{0}}),\hbox{ where }v_{0}=\sum_{t\in[r_{1}]}u_{1,t}. (III.18)

Now that xx generates a cyclic group x\langle x\rangle of order 2N2N, and xv0x^{v_{0}} generates a subgroup xv0\langle x^{v_{0}}\rangle of order order(xv0)=order(𝑨1)/r1{\rm order}(x^{v_{0}})={\rm order}(\boldsymbol{A}_{1})/r_{1}, there are

c:=2N/order(xv0)=2Nr1/order(𝑨1)c:=2N/{\rm order}(x^{v_{0}})=2Nr_{1}/{\rm order}(\boldsymbol{A}_{1}) (III.19)

cosets of xv0\langle x^{v_{0}}\rangle in x\langle x\rangle. Select one element from each coset respectively, and let them be xv0,xv1,,xvc1x^{v_{0}},x^{v_{1}},\ldots,x^{v_{c-1}}.

We claim (1) under the action of subgroup 𝑨\langle\boldsymbol{A}\rangle, for any i,j[c]i,j\in[c] such that iji\neq j, the orbits of xvi𝒆0x^{v_{i}}\boldsymbol{e}_{0} and xvj𝒆0x^{v_{j}}\boldsymbol{e}_{0} do not overlap. Suppose the converse is true, namely there exists d[order(𝑨)]d\in[{\rm order}(\boldsymbol{A})] such that 𝑨dxvi𝒆0=xvj𝒆0\boldsymbol{A}^{d}x^{v_{i}}\boldsymbol{e}_{0}=x^{v_{j}}\boldsymbol{e}_{0}. As r1|order(𝑨)r_{1}|{\rm order}(\boldsymbol{A}), let d=ar1+bd=ar_{1}+b, where b[r1]b\in[r_{1}]. By (III.9), 𝑨r1=xv0𝑰r×r\boldsymbol{A}^{r_{1}}=x^{v_{0}}\boldsymbol{I}_{r\times r}, so

𝑨dxvi𝒆0=𝑨b(𝑨r1)axvi𝒆0=xav0+vi𝑨b𝒆0=xvj𝒆0.\boldsymbol{A}^{d}x^{v_{i}}\boldsymbol{e}_{0}=\boldsymbol{A}^{b}(\boldsymbol{A}^{r_{1}})^{a}x^{v_{i}}\boldsymbol{e}_{0}=x^{av_{0}+v_{i}}\boldsymbol{A}^{b}\boldsymbol{e}_{0}=x^{v_{j}}\boldsymbol{e}_{0}. (III.20)

If b0b\neq 0, by (III.6), 𝑨b\boldsymbol{A}^{b} does not preserve the 1-space spanned by 𝒆0\boldsymbol{e}_{0}, and the last equality in (III.20) is false. So b=0b=0, and xav0xvi=xvjx^{av_{0}}x^{v_{i}}=x^{v_{j}}. This indicates that xvi,xvjx^{v_{i}},x^{v_{j}} are in the same coset of xv0\langle x^{v_{0}}\rangle in x\langle x\rangle, contradiction. This proves claim (1).

We claim (2) for any i[c]i\in[c], the number of elements in the orbit of xvi𝒆0𝒳x^{v_{i}}\boldsymbol{e}_{0}\in{\cal X} under 𝑨\boldsymbol{A} is at least order(𝑨){\rm order}(\boldsymbol{A}). To prove the claim we only need to show that for any s,t[order(𝑨)]s,t\in[{\rm order}(\boldsymbol{A})] such that sts\neq t, 𝑨sxvi𝒆0𝑨txvi𝒆0\boldsymbol{A}^{s}x^{v_{i}}\boldsymbol{e}_{0}\neq\boldsymbol{A}^{t}x^{v_{i}}\boldsymbol{e}_{0}.

Suppose the converse is true. Without loss of generality, assume s>ts>t. Then 0<st<order(𝑨)0<s-t<{\rm order}(\boldsymbol{A}), and 𝑨st𝒆0=𝒆0\boldsymbol{A}^{s-t}\boldsymbol{e}_{0}=\boldsymbol{e}_{0}. On the other hand, by (III.6), 𝑨st\boldsymbol{A}^{s-t} does not preserve the 1-space spanned by 𝒆0\boldsymbol{e}_{0}, contradiction. This proves claim (2).

Set

MMIVr1:={xi𝐞j|i[2N],j[r1]}.{\rm MMIV}_{r_{1}}:=\{x^{i}\mathbf{e}_{j}\,\big{|}\,i\in[2N],j\in[r_{1}]\}. (III.21)

Obviously every element of MMIVr\MMIVr1{\rm MMIV}_{r}\backslash{\rm MMIV}_{r_{1}} is fixed by 𝑨\boldsymbol{A}, and the set MMIVr1{\rm MMIV}_{r_{1}} is invariant under 𝑨\boldsymbol{A}.

We claim (3) MMIVr1{\rm MMIV}_{r_{1}} is the union of the orbits of {xvi𝒆0,i[c]}\{x^{v_{i}}\boldsymbol{e}_{0},i\in[c]\} under the action of 𝑨\langle\boldsymbol{A}\rangle. Denote by orbit(xvi𝒆0){\rm orbit}(x^{v_{i}}\boldsymbol{e}_{0}) the orbit of xvi𝒆0x^{v_{i}}\boldsymbol{e}_{0} under 𝑨\boldsymbol{A}, and for any set SS, denote by #S\#S the number of elements in the set. By claims (1), (2), and using (III.19), we get

2Nr1=#MMIVr1i[c]#orbit(xvi𝒆0)i[c]order(𝑨)=2Nr1.\begin{array}[]{lll}2Nr_{1}=\#{\rm MMIV}_{r_{1}}&\geq&\displaystyle\sum_{i\in[c]}\#{\rm orbit}(x^{v_{i}}\boldsymbol{e}_{0})\\ &\geq&\displaystyle\sum_{i\in[c]}{\rm order}(\boldsymbol{A})=2Nr_{1}.\end{array} (III.22)

So MMIVr1=i[c]orbit(xvi𝒆0){\rm MMIV}_{r_{1}}=\cup_{i\in[c]}{\rm orbit}(x^{v_{i}}\boldsymbol{e}_{0}). This proves claim (3). As a corollary, #orbit(xvi𝒆0)=order(𝑨)\#{\rm orbit}(x^{v_{i}}\boldsymbol{e}_{0})={\rm order}(\boldsymbol{A}) for all i[c]i\in[c], and the number of orbits in MMIVr{\rm MMIV}_{r} under the action of 𝑨\langle\boldsymbol{A}\rangle is cc.

When 𝑨\boldsymbol{A} takes the general form diag(𝑨1,𝑨2,,𝑨h){\rm diag}(\boldsymbol{A}_{1},\boldsymbol{A}_{2},\ldots,\boldsymbol{A}_{h}), by induction, the conclusion (III.16) can be easily proved. ∎

Theorem 1

For any group representation 𝚽:2NrMMPMr\boldsymbol{\Phi}:{\mathbb{Z}}_{2Nr}\longrightarrow{\rm MMPM}_{r}, the action of 𝚽(2Nr)\boldsymbol{\Phi}({\mathbb{Z}}_{2Nr}) on MMIVr{\rm MMIV}_{r} is transitive if and only if 𝚽(1)\boldsymbol{\Phi}(1) is similar to

[xu0xu1xu2xur1],\begin{bmatrix}&&&&x^{u_{0}}\\ x^{u_{1}}&&&&\\ &x^{u_{2}}&&&\\ &&\ddots&&\\ &&&x^{u_{r-1}}&\end{bmatrix}, (III.23)

where order(xi[r]ui)=2N{\rm order}(x^{\sum_{i\in[r]}u_{i}})=2N.

Proof:

By (III.16) and the fact that order(𝑨i)|2Nri{\rm order}(\boldsymbol{A}_{i})|2Nr_{i} for all 1ih1\leq i\leq h, in order for the number of orbits to be 1, it is both sufficient and necessary that h=1h=1 and 2Nr1=order(𝑨1)2Nr_{1}={\rm order}(\boldsymbol{A}_{1}). When h=1h=1, by (III.8), the latter condition can be written as 2Nr=order(𝚽(1))=r×order(xi[r]ui)2Nr={\rm order}(\boldsymbol{\Phi}(1))=r\times{\rm order}(x^{\sum_{i\in[r]}u_{i}}). ∎

Only cyclic subgroups of order 2Nr2Nr and transitive on MMIVr{\rm MMIV}_{r} can have test-coefficient look-up property, because for any test polynomial vector 𝒗𝔽r\boldsymbol{v}\in{\mathbb{F}}^{r}, for any monomial λixi\lambda_{i}x^{i} in the jj-th entry of 𝒗\boldsymbol{v}, only in such a subgroup can there be one and only one element that changes the monomial to λix0=λi\lambda_{i}x^{0}=\lambda_{i}, i.e., the constant term, in the first entry of the resulting vector in 𝔽r{\mathbb{F}}^{r}. In the following, we consider the design of test polynomial vectors encoding nega-cyclic functions.

Lemma 6

Let 𝚽:2NrMMPMr\boldsymbol{\Phi}:{\mathbb{Z}}_{2Nr}\longrightarrow{\rm MMPM}_{r} be a group representation taking the form of (III.23), where order(xi[r]ui)=2N{\rm order}(x^{\sum_{i\in[r]}u_{i}})=2N. Then 𝚽(Nr)=𝐈r×r,\boldsymbol{\Phi}(Nr)=-\boldsymbol{I}_{r\times r}, and for any k[2Nr]k\in[2Nr], the elements in set

{𝚽(k+i)𝐞0|i[Nr]}MMIVr\{\boldsymbol{\Phi}(k+i)\mathbf{e}_{0}\,\big{|}\,i\in[Nr]\}\subset{\rm MMIV}_{r} (III.24)

are \mathbb{Q}-linearly independent vectors.

Proof:

The first conclusion is direct from (III.9) and order(xi[r]ui)=2N{\rm order}(x^{\sum_{i\in[r]}u_{i}})=2N. For the second conclusion, for any 1lNr1\leq l\leq Nr, set

𝒴l:={𝚽(k+i)𝐞0,i[l]}.{\cal Y}_{l}:=\{\boldsymbol{\Phi}(k+i)\mathbf{e}_{0},\ i\in[l]\}. (III.25)

We prove that every 𝒴l{\cal Y}_{l} is a \mathbb{Q}-linearly independent set of vectors.

When l=1l=1, 𝒴l={𝚽(k)𝐞0}{\cal Y}_{l}=\{\boldsymbol{\Phi}(k)\mathbf{e}_{0}\} is \mathbb{Q}-linearly independent. Assume that for all lh<Nrl\leq h<Nr, 𝒴h{\cal Y}_{h} is \mathbb{Q}-linearly independent. For l=h+1l=h+1, if 𝒴h+1{\cal Y}_{h+1} is not \mathbb{Q}-linearly independent, then 𝚽(k+h)𝐞0=i[h]vi𝚽(k+i)𝐞0\boldsymbol{\Phi}(k+h)\mathbf{e}_{0}=\sum_{i\in[h]}v_{i}\boldsymbol{\Phi}(k+i)\mathbf{e}_{0} for some viv_{i}\in{\mathbb{Q}}.

In MMIVr{\rm MMIV}_{r}, it must be that 𝚽(k+h)𝐞0=𝚽(k+i)𝐞0\boldsymbol{\Phi}(k+h)\mathbf{e}_{0}=-\boldsymbol{\Phi}(k+i)\mathbf{e}_{0} for some i[h]i\in[h], namely, 𝚽(hi)𝐞0=𝐞0\boldsymbol{\Phi}(h-i)\mathbf{e}_{0}=-\mathbf{e}_{0} for some 0<hi<Nr0<h-i<Nr. By (III.6), hi=mrh-i=mr for some 0<m<N0<m<N. By (III.9), xmi[r]ui=1x^{m\sum_{i\in[r]}u_{i}}=-1. So x2mi[r]ui=1x^{2m\sum_{i\in[r]}u_{i}}=1, contradicting with order(xi[r]ui)=2N{\rm order}(x^{\sum_{i\in[r]}u_{i}})=2N. ∎

Let (v0,v1,,v2Nr1)T(v_{0},v_{1},\ldots,v_{2Nr-1})^{T} be any vector in 2Nr{\mathbb{Z}}_{2Nr}. For any k[2Nr]k\in[2Nr], set

𝒗k:=i[Nr]vi𝚽(ki)𝒆0𝔽r.\boldsymbol{v}_{k}:=\sum_{i\in[Nr]}v_{i}\boldsymbol{\Phi}(k-i)\boldsymbol{e}_{0}\in{\mathbb{F}}^{r}. (III.26)

By Lemma 6, {𝚽(ki)𝒆0|i[Nr]}\{\boldsymbol{\Phi}(k-i)\boldsymbol{e}_{0}\,\big{|}\,i\in[Nr]\} is \mathbb{Q}-linearly independent. It is easy to see that for any k[2Nr]k\in[2Nr], 𝒗k+Nrmod 2Nr=𝒗k\boldsymbol{v}_{k+Nr\ {\rm mod}\ 2Nr}=-\boldsymbol{v}_{k}, and for any l[2Nr]l\in[2Nr], 𝚽(l)𝒗k=𝒗k+lmod 2Nr\boldsymbol{\Phi}(l)\boldsymbol{v}_{k}=\boldsymbol{v}_{k+l\ {\rm mod}\ 2Nr}.

The following lemma indicates that 𝒗0\boldsymbol{v}_{0} can serve as the test polynomial vector.

Lemma 7 (Test-coefficient look-up property)

For the group representation 𝚽:2NrMMPMr\boldsymbol{\Phi}:{\mathbb{Z}}_{2Nr}\longrightarrow{\rm MMPM}_{r} in Lemma 6, and for 𝐯0\boldsymbol{v}_{0} defined in (III.26) where k=0k=0, if vNr+l=vlv_{Nr+l}=-v_{l} for all l[Nr]l\in[Nr], then for any i[2Nr]i\in[2Nr], 𝚽(i)\boldsymbol{\Phi}(i) changes the term vi𝚽(i)𝐞0v_{i}\boldsymbol{\Phi}(-i)\boldsymbol{e}_{0} of 𝐯0\boldsymbol{v}_{0} into the term vi𝐞0v_{i}\boldsymbol{e}_{0} of 𝐯i\boldsymbol{v}_{i}.

Proof:

No matter if i[Nr]i\in[Nr] or not, it is always true that vi𝚽(i)𝒆0v_{i}\boldsymbol{\Phi}(-i)\boldsymbol{e}_{0} is a term of 𝒗0\boldsymbol{v}_{0}, and

𝚽(i)(vi𝚽(i)𝒆0)=vi𝒆0=vi𝚽(ii)𝒆0\boldsymbol{\Phi}(i)(v_{i}\boldsymbol{\Phi}(-i)\boldsymbol{e}_{0})=v_{i}\boldsymbol{e}_{0}=v_{i}\boldsymbol{\Phi}(i-i)\boldsymbol{e}_{0} (III.27)

is a term of 𝒗i\boldsymbol{v}_{i}, i.e., the constant-term in the first entry of 𝒗i\boldsymbol{v}_{i}. ∎

Example 2

For 𝚽\boldsymbol{\Phi} taking the form of Lemma 6, let i=ar+b[2Nr]-i=ar+b\in[2Nr], where a[N],b[r]a\in[N],b\in[r]. By (III.6), the (b,0)(b,0)-entry of matrix 𝚽(b)\boldsymbol{\Phi}(b) is xt[b]ubtx^{\sum_{t\in[b]}u_{b-t}}, while all other entries in the first column of 𝚽(b)\boldsymbol{\Phi}(b) are zero, namely, 𝚽(b)𝐞0=xt[b]ubt𝐞b\boldsymbol{\Phi}(b)\mathbf{e}_{0}=x^{\sum_{t\in[b]}u_{b-t}}\mathbf{e}_{b}. By (III.9), 𝚽(r)=xt[r]ut𝐈r×r\boldsymbol{\Phi}(r)=x^{\sum_{t\in[r]}u_{t}}\boldsymbol{I}_{r\times r}. So

𝚽(i)𝐞0=𝚽(r)a𝚽(b)𝐞0=xat[r]ut+t[b]ubt𝐞b,\boldsymbol{\Phi}(-i)\mathbf{e}_{0}=\boldsymbol{\Phi}(r)^{a}\boldsymbol{\Phi}(b)\mathbf{e}_{0}=x^{a\sum_{t\in[r]}u_{t}+\sum_{t\in[b]}u_{b-t}}\mathbf{e}_{b}, (III.28)

and

𝒗0=i[Nr]vi𝚽(i)𝐞0=a[N],b[r]v(ar+b)xat[r]ut+t[b]ubt𝐞b.\begin{split}\boldsymbol{v}_{0}&=\sum\limits_{i\in[Nr]}v_{i}\boldsymbol{\Phi}(-i)\mathbf{e}_{0}\\ &=\sum\limits_{a\in[N],b\in[r]}v_{-(ar+b)}x^{a\sum_{t\in[r]}u_{t}+\sum_{t\in[b]}u_{b-t}}\mathbf{e}_{b}.\end{split} (III.29)

In particular, if 𝚽\boldsymbol{\Phi} takes the form (III.11), then for any nega-cyclic function f:2Nrf:{\mathbb{Z}}_{2Nr}\longrightarrow{\mathbb{Q}}, set vi=f(i)v_{i}=f(i) for all i[2Nr]i\in[2Nr]. Then vNr+k=vkv_{Nr+k}=-v_{k} for all k[Nr]k\in[Nr]. The test polynomial vector 𝐯test=𝐯0\boldsymbol{v}_{\rm test}=\boldsymbol{v}_{0} is

b[r],a[N]f((ar+b))xa𝐞b=(f(0)+f(r)x++f(cr)xc++f((N1)r)xN1f(1)+f(1r)x++f(1cr)xc++f(1(N1)r)xN1f(d)+f(dr)x++f(dcr)xc++f(d(N1)r)xN1f(1r)+f(12r)x++f(1(c+1)r)xc++f(1Nr)xN1).\hskip-19.91684pt\begin{array}[]{ll}&\displaystyle\sum\limits_{b\in[r],\,a\in[N]}f(-(ar+b))x^{a}\mathbf{e}_{b}\\ =&\displaystyle\hskip-5.69046pt\begin{pmatrix}\scriptstyle f(0)+f(-r)x+\cdots+f(-cr)x^{c}+\cdots+f(-(N-1)r)x^{N-1}\\ \scriptstyle f(-1)+f(-1-r)x+\cdots+f(-1-cr)x^{c}+\cdots+f(-1-(N-1)r)x^{N-1}\\ \vdots\\ \scriptstyle f(-d)+f(-d-r)x+\cdots+f(-d-cr)x^{c}+\cdots+f(-d-(N-1)r)x^{N-1}\\ \vdots\\ \scriptstyle f(1-r)+f(1-2r)x+\cdots+f(1-(c+1)r)x^{c}+\cdots+f(1-Nr)x^{N-1}\\ \end{pmatrix}.\end{array} (III.30)

For any m=dcr[2Nr]m=-d-cr\in[2Nr], where c[2N],d[r]c\in[2N],d\in[r], 𝚽(m)𝐯test\boldsymbol{\Phi}(m)\boldsymbol{v}_{\rm test} equals

b[r],a[N]f((ar+b))xac𝐞bd=(f(m)+f(mr)x++f(m(N1)r)xN1f(m1)+f(mr1)x++f(m(N1)r1)xN1f(mr+1)+f(m2r+1)x++f(mNr+1)xN1).\hskip-8.5359pt\begin{array}[]{ll}&\displaystyle\sum\limits_{b\in[r],\,a\in[N]}f(-(ar+b))x^{a-c}\mathbf{e}_{b-d}\\ =&\displaystyle\hskip-5.69046pt\begin{pmatrix}\scriptstyle f(m)+f(m-r)x+\cdots+f(m-(N-1)r)x^{N-1}\\ \scriptstyle f(m-1)+f(m-r-1)x+\cdots+f(m-(N-1)r-1)x^{N-1}\\ \vdots\\ \scriptstyle f(m-r+1)+f(m-2r+1)x+\cdots+f(m-Nr+1)x^{N-1}\\ \end{pmatrix}.\end{array} (III.31)

It is easy to see that for any m=crd[q]m=-cr-d\in[q^{\prime}], 𝚽(m)\boldsymbol{\Phi}(m) changes the term f(m)𝚽(m)𝐞0=f(m)xc𝐞df(m)\boldsymbol{\Phi}(-m)\mathbf{e}_{0}=f(m)x^{c}\mathbf{e}_{d} of 𝐯0\boldsymbol{v}_{0},i.e., the (c+1)(c+1)-st term in the (d+1)(d+1)-st row of test polynomial vector 𝐯0\boldsymbol{v}_{0}, into the term f(m)𝐞0f(m)\boldsymbol{e}_{0} of 𝐯m\boldsymbol{v}_{m}, i.e., the constant term in the first row of the resulting polynomial vector. This is the test-coefficient look-up property demanded in bootstrapping.

IV New Functional Bootstrapping Scheme

From now on, we always set 𝚽(1)\boldsymbol{\Phi}(1) to be of the form (III.11). By Theorem 1, this choice does not lose generality.

Given a plaintext vector 𝒎tr\boldsymbol{m}\in{\cal R}_{t}^{r}, its RLWE encryption is done component-wise, resulting in a vector of RLWE ciphertexts, called an rr-dimensional RLWE vector encrypting 𝒎\boldsymbol{m}. The space of rr-dimensional RLWEN,Q{\rm RLWE}_{N,Q} vectors is denoted by RLWEN,Qr{\rm RLWE}_{N,Q}^{r}. Any rr-dimensional RLWEN,Q{\rm RLWE}_{N,Q} vector is a matrix in Matr×2(𝒩,𝒬){\rm Mat}_{r\times 2}({\cal R_{N,Q}}).

According to (III.13), for any c2Nrc\in{\mathbb{Z}}_{2Nr}, for any any rr-dimensional RLWEN,Q{\rm RLWE}_{N,Q} vector 𝒗\boldsymbol{v} encrypting a plaintext vector 𝒎\boldsymbol{m}, the usual matrix product of r×rr\times r plaintext matrix 𝚽(c)\boldsymbol{\Phi}(c) with r×2r\times 2 matrix 𝒗\boldsymbol{v}, results in an RLWEN,Q{\rm RLWE}_{N,Q} vector (r×2r\times 2 matrix) encrypting plaintext vector 𝚽(c)𝒎\boldsymbol{\Phi}(c)\boldsymbol{m}. This defines the multiplication between plaintext matrix 𝚽(c)\boldsymbol{\Phi}(c) and RLWE vector 𝒗\boldsymbol{v}.

Let 𝒔=(si)i=1..n3n\boldsymbol{s}=(s_{i})_{i=1..n}\in{\mathbb{Z}}_{3}^{n}, and let si+=max(si,0)s_{i+}=\max(s_{i},0) and si=max(si,0)s_{i-}=\max(-s_{i},0). If the si+,sis_{i+},s_{i-} are each encrypted as an RGSW ciphertext, then the ciphertext multiplication between RLWE vector 𝒗\boldsymbol{v} and the RGSW ciphertext encrypting si+s_{i+} (or sis_{i-}) is done component-wise between each component of the RLWE vector and the the RGSW ciphertext. The result is an RLWE vector encrypting si+𝒎s_{i+}\boldsymbol{m} (or si𝒎s_{i-}\boldsymbol{m}). This defines the multiplication between an RLWE vector and an RGSW ciphertext.

By (II.11), for any 𝒎𝔽r\boldsymbol{m}\in{\mathbb{F}}^{r},

CMux(si+,si;𝚽(ai),𝑰r×r,𝚽(ai))𝒎=𝒎+(𝚽(ai)𝒎𝒎)si++(𝚽(ai)𝒎𝒎)si.\begin{array}[]{ll}&{\rm CMux}(s_{i+},s_{i-};\boldsymbol{\Phi}(-a_{i}),\boldsymbol{I}_{r\times r},\boldsymbol{\Phi}(a_{i}))\ \boldsymbol{m}\\ =&\boldsymbol{m}+(\boldsymbol{\Phi}(-a_{i})\boldsymbol{m}-\boldsymbol{m})s_{i+}+(\boldsymbol{\Phi}(a_{i})\boldsymbol{m}-\boldsymbol{m})s_{i-}.\end{array} (IV.1)

The expression can be evaluated homomorphically if 𝒎,si+,si\boldsymbol{m},s_{i+},s_{i-} are encrypted as RLWE vector, RGSW ciphertext, RGSW ciphertext respectively, and the multiplications are between an RLWE vector and an RGSW ciphertext.

We are ready to extend the classical TFHE scheme to a new scheme “BootMMPM” based on the monic monomial permutation matrix representation 𝚽\boldsymbol{\Phi} of 2Nr{\mathbb{Z}}_{2Nr} where 𝚽(1)\boldsymbol{\Phi}(1) takes the form (III.11), as follows:

Algorithm 1 BootMMPM(ct,f)\texttt{BootMMPM}(\texttt{ct},f), where ct is an LWEn,q{\rm LWE}_{n,q} ciphertext with ternary secret, f:ttf:{\mathbb{Z}}_{t}\longrightarrow{\mathbb{Z}}_{t^{\prime}} is nega-cyclic.
0:  
  • ctLWEn,q(m,𝒔)\texttt{ct}\in{\rm LWE}_{n,q}(m,\boldsymbol{s}) with secret 𝒔=(sk)k=1..n{1,0,1}n\boldsymbol{s}=(s_{k})_{k=1..n}\in\{1,0,-1\}^{n}, plaintext mtm\in{\mathbb{Z}}_{t};

  • test polynomial vector 𝒗testt\boldsymbol{v}_{\rm test}\in{\mathbb{Z}}_{t^{\prime}} whose coefficients encode a nega-cyclic extension f:2Nrtf^{\prime}:{\mathbb{Z}}_{2Nr}\longrightarrow{\mathbb{Z}}_{t^{\prime}} of ff;

  • bootstrapping keys: for all k=1,,nk=1,\ldots,n, ctk+,ctk\texttt{ct}_{k+},\texttt{ct}_{k-} are RGSWN,Q{\rm RGSW}_{N,Q} ciphertexts encrypting sk+,sks_{k+},s_{k-} respectively with secret zN,Qz\in{\cal R}_{N,Q}, the gadget base is BB, and lB=logBQl_{B}=\lceil\log_{B}Q\rceil;

  • key-switching keys from LWEN,Q{\rm LWE}_{N,Q} ciphertexts with secret z\overrightarrow{z} to LWEn,Q{\rm LWE}_{n,Q} ciphertexts with secret 𝒔\boldsymbol{s}, the gadget base is BKSB_{\rm KS}, and lKS=logBKSQl_{\rm KS}=\lceil\log_{B_{\rm KS}}Q\rceil.

0:  ctLWEn,q(f(m),𝒔)\texttt{ct}\in{\rm LWE}_{n,q}(f(m),\boldsymbol{s}).
1:  [Modulus switch] ct=(a1,a2,,an,b)2Nrn+1ModulusSwitchq2Nr(ct)\texttt{ct}=(a_{1},a_{2},\ldots,a_{n},b)\in{\mathbb{Z}}_{2Nr}^{n+1}\leftarrow{\rm ModulusSwitch}_{q\rightarrow 2Nr}(\texttt{ct}).
2:  [Phase accumulation] ACC𝚽(b)(0,𝒗test×Q/t)ACC\leftarrow\boldsymbol{\Phi}(b)(0,\boldsymbol{v}_{\rm test}\times\lfloor Q/t^{\prime}\rfloor)
3:  for k=1k=1 to nn do
4:       ACCCMux(ctk+,ctk;𝚽(ak),𝑰r×r,𝚽(ak))ACC\leftarrow{\rm CMux}(\texttt{ct}_{k+},\texttt{ct}_{k-};\boldsymbol{\Phi}(-a_{k}),\boldsymbol{I}_{r\times r},\boldsymbol{\Phi}(a_{k}))×ACC\times ACC
5:  end for
6:  [Constant-term extraction] ct\texttt{ct}\leftarrow SampleExtract (1st entry of vector ACCACC)
7:  [Key switch] ctKeySwitchz𝒔(ct)\texttt{ct}\leftarrow{\rm KeySwitch}_{\overrightarrow{z}\rightarrow\boldsymbol{s}}(\texttt{ct})
8:  [Modulus switch] ctModulusSwitchQq(ct)\texttt{ct}\leftarrow{\rm ModulusSwitch}_{Q\rightarrow q}(\texttt{ct})

The algorithm would be correct if we could control the error bound in the output ciphertext, and in particular, if the error growth in the homomorphic CMux operation is slow. In the product of a plaintext matrix 𝚽(c)\boldsymbol{\Phi}(c) and an RLWE vector 𝒗\boldsymbol{v}, the error bound is the same with that of 𝒗\boldsymbol{v}, due to the Hadamard product nature of this product.

The BB-digit decomposition of an RLWE vector is done component-wise. Recall that when an RLWE ciphertext takes the form of a 2-dimensional row vector, after digit decomposition, it becomes an 2lB2l_{B}-dimensional row vector. So an rr-dimensional RLWEN,Q{\rm RLWE}_{N,Q} vector as a matrix of size r×2r\times 2, after digit decomposition, becomes a matrix of size r×2lBr\times 2l_{B}.

Recall that an RGSW ciphertext is a matrix in Mat2lB×2(N,Q){\rm Mat}_{2l_{B}\times 2}({\cal R}_{N,Q}). The multiplication of an RLWE vector 𝒗\boldsymbol{v} with an RGSW ciphertext 𝑪\boldsymbol{C} encrypting an element of {1,0}\{1,0\} is done component-wise, resulting in a new RLWE vector 𝒗=(𝒈B1(𝒗))𝑪\boldsymbol{v}^{\prime}=\left(\boldsymbol{g}_{B}^{-1}(\boldsymbol{v})\right)\boldsymbol{C}, where 𝒈B1\boldsymbol{g}_{B}^{-1} is the BB-digit decomposition operation.

Let the error vectors in 𝒗,𝒗,𝑪\boldsymbol{v},\boldsymbol{v}^{\prime},\boldsymbol{C} be 𝒆N,Qr\boldsymbol{e}\in{\cal R}_{N,Q}^{r}, 𝒆N,Qr\boldsymbol{e}^{\prime}\in{\cal R}_{N,Q}^{r}, 𝒆CN,Q2lB\boldsymbol{e}_{C}\in{\cal R}_{N,Q}^{2l_{B}} respectively, then as in the case of r=1r=1, we have

𝒆=(𝒈B1(𝒗))𝒆C+𝒆.\boldsymbol{e}^{\prime}=(\boldsymbol{g}_{B}^{-1}(\boldsymbol{v}))\boldsymbol{e}_{C}+\boldsymbol{e}. (IV.2)

By Corollary 3.15 of [9], if 𝒆,𝒆C\boldsymbol{e},\boldsymbol{e}_{C} are subgaussian with variance proxy β,σ\beta,\sigma respectively, then 𝒆\boldsymbol{e}^{\prime} is subgaussian with variance proxy

2NlBB2σ2+β2.2Nl_{B}B^{2}\sigma^{2}+\beta^{2}. (IV.3)
Lemma 8

Let d{1,0,1}d\in\{1,0,-1\}, and let d+,dd_{+},d_{-} be defined as in (II.10). Let 𝐜1,𝐜0,𝐜1\boldsymbol{c}_{1},\boldsymbol{c}_{0},\boldsymbol{c}_{-1} be three RLWEN,Q{\rm RLWE}_{N,Q} vectors where the errors are all subgaussian with variance proxy β2\beta^{2}, and let s+,ss_{+},s_{-} be RGSWN,Q{\rm RGSW}_{N,Q} ciphertexts encrypting d+,dd_{+},d_{-} respectively, where the errors are independent subgaussian with variance proxy σ2\sigma^{2}. If the errors in 𝐜1,𝐜0,𝐜1\boldsymbol{c}_{1},\boldsymbol{c}_{0},\boldsymbol{c}_{-1} are independent of the errors in d+,dd_{+},d_{-}, then the homomorphic evaluation result of CMux(d+,d;𝐜1,𝐜0,𝐜1){\rm CMux}(d_{+},d_{-};\boldsymbol{c}_{1},\boldsymbol{c}_{0},\boldsymbol{c}_{-1}) has a subgaussian error vector 𝐞CMuxN,Qr\boldsymbol{e}_{\rm CMux}\in{\cal R}_{N,Q}^{r} with variance proxy

β2+4NlBB2σ2.\beta^{2}+4Nl_{B}B^{2}\sigma^{2}. (IV.4)
Proof:

Let the error vectors in d+,d,𝒄1,𝒄0,𝒄1d_{+},d_{-},\boldsymbol{c}_{1},\boldsymbol{c}_{0},\boldsymbol{c}_{-1} be 𝒆+,𝒆,𝒆1,𝒆0,𝒆1\boldsymbol{e}_{+},\boldsymbol{e}_{-},\boldsymbol{e}_{1},\boldsymbol{e}_{0},\boldsymbol{e}_{-1} respectively, where the first two are in N,Q2lB{\cal R}_{N,Q}^{2l_{B}}, the latter three are in N,Qr{\cal R}_{N,Q}^{r}. For a subgaussian random variable vv, we use Var(v){\rm Var}(v) to denote its variance proxy.

By (II.11) and (IV.2),

𝒆CMux=𝒆0+(𝒈1(𝒄1𝒄0))𝒆++(𝒆1𝒆0)s++(𝒈1(𝒄1𝒄0))𝒆+(𝒆1𝒆0)s.\begin{split}\boldsymbol{e}_{\rm CMux}=\boldsymbol{e}_{0}+\left(\boldsymbol{g}^{-1}(\boldsymbol{c}_{1}-\boldsymbol{c}_{0})\right)\boldsymbol{e}_{+}+(\boldsymbol{e}_{1}-\boldsymbol{e}_{0})s_{+}\\ +\left(\boldsymbol{g}^{-1}(\boldsymbol{c}_{-1}-\boldsymbol{c}_{0})\right)\boldsymbol{e}_{-}+(\boldsymbol{e}_{-1}-\boldsymbol{e}_{0})s_{-}.\end{split} (IV.5)

Since 𝒆0+(𝒆1𝒆0)s++(𝒆1𝒆0)s{𝒆0,𝒆1,𝒆1},\boldsymbol{e}_{0}+(\boldsymbol{e}_{1}-\boldsymbol{e}_{0})s_{+}+(\boldsymbol{e}_{-1}-\boldsymbol{e}_{0})s_{-}\in\{\boldsymbol{e}_{0},\boldsymbol{e}_{1},\boldsymbol{e}_{-1}\}, we have Var(𝒆0+(𝒆1𝒆0)s++(𝒆1𝒆0)s)=β2{\rm Var}(\boldsymbol{e}_{0}+(\boldsymbol{e}_{1}-\boldsymbol{e}_{0})s_{+}+(\boldsymbol{e}_{-1}-\boldsymbol{e}_{0})s_{-})=\beta^{2}.

By the error independence assumption and (IV.3), we get

Var(𝒆CMux)=Var(𝒆0+(𝒆1𝒆0)s++(𝒆1𝒆0)s)+Var(𝒈1(𝒄1𝒄0)𝒆+)+Var(𝒈1(𝒄1𝒄0)𝒆)=β2+4NlBB2σ2.\begin{array}[]{lll}{\rm Var}(\boldsymbol{e}_{\rm CMux})&=&{\rm Var}(\boldsymbol{e}_{0}+(\boldsymbol{e}_{1}-\boldsymbol{e}_{0})s_{+}+(\boldsymbol{e}_{-1}-\boldsymbol{e}_{0})s_{-})\\ &&\hfill+{\rm Var}(\boldsymbol{g}^{-1}(\boldsymbol{c}_{1}-\boldsymbol{c}_{0})\boldsymbol{e}_{+})\phantom{m}\\ &&\hfill+{\rm Var}(\boldsymbol{g}^{-1}(\boldsymbol{c}_{-1}-\boldsymbol{c}_{0})\boldsymbol{e}_{-})\\ &=&\beta^{2}+4Nl_{B}B^{2}\sigma^{2}.\end{array} (IV.6)

Theorem 2

In the input of Algorithm 1, let σ2,σKS2\sigma^{2},\sigma^{2}_{\rm KS} be respectively the variance proxies of the bootstrapping keys and key-switching keys. Then for any input LWEn,q{\rm LWE}_{n,q} ciphertext encrypting a message mm, as long as after modulus switch from qq to 2Nr2Nr, the ciphertext is correctly decryptable, Algorithm 1 outputs an LWEn,q{\rm LWE}_{n,q} ciphertext encrypting message f(m)f(m) with a subgaussian error of variance proxy

4nNlBB2(q/Q)2σ2+NlKS(q/Q)2σKS2+(𝒔22+1)/12.4nNl_{B}B^{2}(q/Q)^{2}\sigma^{2}+Nl_{\rm KS}(q/Q)^{2}\sigma_{\rm KS}^{2}+(\|\boldsymbol{s}\|_{2}^{2}+1)/12. (IV.7)
Proof:

In computing ACCACC, the initial value 𝚽(b)(0,𝒗test×Q/t)\boldsymbol{\Phi}(b)(0,\boldsymbol{v}_{\rm test}\times\lfloor Q/t^{\prime}\rfloor) is error-free. By Lemma IV.4, every round of the for-loop increases the variance proxy of the subgaussian error by 4NlBB2σ24Nl_{B}B^{2}\sigma^{2}. So after the phase accumulation loop, the error has variance proxy 4nNlBB2σ24nNl_{B}B^{2}\sigma^{2}.

The constant-term extraction of the first row of ACCACC changes the RLWE ciphertext with secret zz into an LWE ciphertext with secret z\overrightarrow{z}, but does not change the the variance proxy of the error.

In the key switch procedure, by Lemma 6 of [8], for any LWEN,Q{\rm LWE}_{N,Q} ciphertext with subgaussian error of variance proxy β2\beta^{2}, the procedure generates an LWEn,Q{\rm LWE}_{n,Q} ciphertext with subgaussian error of variance proxy β2+NlKSσKS2\beta^{2}+Nl_{\rm KS}\sigma_{\rm KS}^{2}.

In the modulus switch procedure in the last step of the algorithm, by [8], for any LWEn,Q{\rm LWE}_{n,Q} ciphertext with subgaussian error of variance proxy β2\beta^{2}, the modulus switch from QQ to qq based on non-randomized rounding function \lfloor\cdot\rceil, generates an LWEn,q{\rm LWE}_{n,q} ciphertext with subgaussian error of variance proxy

(q/Q)2β2+(𝒔22+1)/12,(q/Q)^{2}\beta^{2}+(\|\boldsymbol{s}\|_{2}^{2}+1)/12, (IV.8)

where 𝒔2\|\boldsymbol{s}\|_{2} is the L2L_{2}-norm of the secret 𝒔\boldsymbol{s}, and 1/12=(0.5(0.5))2/121/12=(0.5-(-0.5))^{2}/12 is the variance of the uniform distribution on [1/2,1/2)[-1/2,1/2). So the modulus switch modifies the variance proxy of the subgaussian error by first scaling it with (q/Q)2(q/Q)^{2}, then adding a term of rounding error (𝒔22+1)/12(\|\boldsymbol{s}\|_{2}^{2}+1)/12. ∎

For general functional bootstrapping where the evaluation function f:ttf:{\mathbb{Z}}_{t}\longrightarrow{\mathbb{Z}}_{t^{\prime}} is not nega-cyclic, the routine procedure used in FHEW/TFHE [12, 10] is to take the input plaintext mm as an integer in [0,t)[0,t), take the plaintext modulus as 2t2t, and take ff as a cyclic function defined on 2t{\mathbb{Z}}_{2t}, namely, f(x+t)=f(t)f(x+t)=f(t) for all x[t,t)x\in[-t,t). The plaintext encrypted in the input ciphertext, now being in 2t{\mathbb{Z}}_{2t}, has an extra bit as the new MSB or sign bit, whose value is unknown.

On the other hand, the original plaintext m[0,t)m\in[0,t) is positive, so the new MSB must be removed before functional bootstrapping based on ff. To extract the new MSB, one bootstrapping based on nega-cyclic function

mp(x):={t/2,if x[t/2,t/2),t/2,if x[t,t)\[t/2,t/2){\rm mp}(x):=\left\{\begin{array}[]{ll}-t/2,&\hbox{if }x\in[-t/2,t/2),\\ t/2,&\hbox{if }x\in[-t,t)\backslash[-t/2,t/2)\end{array}\right. (IV.9)

is sufficient, because for any x[t,t)x\in[-t,t),

sign(x)×t=mp(x)+t/2.{\rm sign}(x)\times t={\rm mp}(x)+t/2. (IV.10)

After being extracted, the MSB is subtracted from the input plaintext, so that after this modification, the plaintext is always in [0,t)[0,t). Then another bootstrapping based on the trivial nega-cyclic extension of ff from [0,t)[0,t) to [t,t)[-t,t) suffices.

V Complexity and experiments

In BootMMPM, the most important factor is the dimension rr of the test polynomial vector. By (I.4), rq/(2N)r\geq q/(2N), and rr should be as small as possible.

On the other hand, the choice of rr should guarantee that the ciphertext after modulus switch from qq to q=2Nrq^{\prime}=2Nr is decryptable. Let the error of the input ciphertext be subgaussian with variance proxy β2\beta^{2}. By (IV.8), the modulus switch from qq to qq^{\prime} changes the variance proxy to

σ2:=(2Nr/q)2β2+(𝒔22+1)/12.\sigma^{2}:=(2Nr/q)^{2}\beta^{2}+(\|\boldsymbol{s}\|_{2}^{2}+1)/12. (V.1)

For the ciphertext after modulus switch to be decryptable, it is sufficient that the heuristic bound of the error Hσ<2Nr/(2t)H\sigma<2Nr/(2t), where H=O(1)H=O(1) is a constant determined by the decryption failure probability. By (V.1), the inequality becomes

N2r2>𝒔22+112/(1H2t24β2q2).N^{2}r^{2}>\frac{\|\boldsymbol{s}\|_{2}^{2}+1}{12}\Big{/}\left(\frac{1}{H^{2}t^{2}}-\frac{4\beta^{2}}{q^{2}}\right). (V.2)

When

N=O~(n),𝒔22=O~(n),β=O~(nde),r=O~(ndr),q=O~(ndq),t=O~(ndt),\begin{array}[]{lll}N=\tilde{O}(n),&\|\boldsymbol{s}\|_{2}^{2}=\tilde{O}(n),&\beta=\tilde{O}(n^{d_{e}}),\\ r=\tilde{O}(n^{d_{r}}),&q=\tilde{O}(n^{d_{q}}),&t=\tilde{O}(n^{d_{t}}),\end{array} (V.3)

where the did_{i} are positive real numbers, dqdt+ded_{q}\geq d_{t}+d_{e} and de1/2d_{e}\geq 1/2, then (V.2) requires drdtd_{r}\geq d_{t}. On the other hand, rq/(2N)r\geq q/(2N) requires drdq1dt+de1d_{r}\geq d_{q}-1\geq d_{t}+d_{e}-1. So

drmax(dt,dq1).d_{r}\geq\max(d_{t},d_{q}-1). (V.4)

The efficiency factors of Algorithm BootMMPM on the server’s side include memory cost and run-time cost. The former is heavily influenced by the size of bootstrapping keys and key-switching keys, while the latter mainly depends on the time complexity of the phase accumulation loop.

(1) Bootstrapping key size.

There are 2n2n bootstrapping keys, and each key is an RGSW ciphertext that is a matrix in Mat2lB×2(N,Q){\rm Mat}_{2l_{B}\times 2}({\cal R}_{N,Q}). Every element of N,Q{\cal R}_{N,Q} is a polynomial of degree <N<N with coefficient in Q{\mathbb{Z}}_{Q}, so it has NlogQN\log Q bits. Overall, in BootMMPM the total number of bits in the bootstrapping keys is 8nlBNlogQ8nl_{B}N\log Q.

In contrast, directly using TFHE to make functional bootstrapping requires rr to be a power of 2, and the ring to be Nr,Q{\cal R}_{Nr,Q}. The bootstrapping keys in TFHE have (8nlBNlogQ)r(8nl_{B}N\log Q)r bits. In the setting of (V.3), this size is polynomially bigger than that in BootMMPM.

(2) key-switching key size.

The key-switching keys are the LWEn,Q(vziBKSj){\rm LWE}_{n,Q}(vz_{i}B_{\rm KS}^{j}) for all v[BKS],i[N],j[lKS]v\in[B_{\rm KS}],i\in[N],j\in[l_{\rm KS}]. So in BootMMPM, the total number of bits in the key-switching keys is NBKSlKS(n+1)logQNB_{\rm KS}l_{\rm KS}(n+1)\log Q bits.

In contrast, in TFHE the ring is Nr,Q{\cal R}_{Nr,Q}, so the key-switching keys in TFHE have (NBKSlKS(n+1)logQ)r(NB_{\rm KS}l_{\rm KS}(n+1)\log Q)r bits. In the setting of (V.3), this size is polynomially bigger than that in BootMMPM..

(3) Phase-accumulation time complexity.

The phase accumulation procedure consists of nn CMux operations. In BootMMPM, each CMux requires 2 multiplications between an RLWE vector and an RGSW ciphertext, or equivalently, 2r2r multiplications between an RLWE ciphertext and an RGSW ciphertext.

The multiplication between an RLWE ciphertext and an RGSW ciphertext is the usual matrix product between a matrix in Mat2×2lB(N,Q){\rm Mat}_{2\times 2l_{B}}({\cal R}_{N,Q}) and a matrix in Mat2lB×2lB(N,Q){\rm Mat}_{2l_{B}\times 2l_{B}}({\cal R}_{N,Q}). It contains 4lB4l_{B} polynomial multiplications in N,Q{\cal R}_{N,Q}. By FFT, each polynomial multiplication requires at most (3/2)NlogN(3/2)N\log N integer multiplications in Q{\mathbb{Z}}_{Q}. So the multiplication between an RLWE ciphertext and an RGSW ciphertext has integer multiplication complexity 6lBNlogN6l_{B}N\log N. Overall, the phase accumulation procedure in BootMMPM has integer multiplication complexity 12nlBNrlogN12nl_{B}Nr\log N.

In contrast, in TFHE, each CMux requires 2 multiplications between RLWE ciphertext and RGSW ciphertext, where the polynomial ring is Nr,Q{\cal R}_{Nr,Q}. So the phase accumulation procedure in TFHE has integer multiplication complexity 12nlBNrlog(Nr)12nl_{B}Nr\log(Nr). In the setting of (V.3), this complexity is drd_{r} times larger than that of Algorithm BootMMPM.

Experiments:

We implement BootMMPM on Palisade platform[19] and run it on two different hardware platforms. We use the identity function f(x)=xtf(x)=x\in\mathbb{Z}_{t} for bootstrapping test. This function is not nega-cyclic, so two rounds of bootstrapping are required, with the first extracting the MSB homomorphically. The first bootstrapping can be replaced by the homomorphic sign computing algorithm in [10] to improve efficiency. For the purpose of making comparison with TFHE scheme, we adopt the same algorithm in both rounds of bootstrapping, namely, either both are TFHE, or both are BootMMPM.

Platform 1. IBM-Compatible PC with Intel(R) Core(TM) i7-10700 CPU @ 2.90 GHz and 16.0 GB RAM. Software: PALISADE v1.11.9 with compiler g++ 11.3.0. Plaintext size: logt=5,6,,11\log t=5,6,\ldots,11 respectively. Following the parameter setting in [10], we choose

logn=9,logQ=54,logB=15,BKS=25.\log n=9,\ \ \,\log Q=54,\ \ \,\log B=15,\ \ \,B_{\rm KS}=25. (V.5)
TABLE I: Experiments on Platform 1 (PC), with run-time and size of BootKeys (bootstrapping keys) and size of KSKeys (key-switching keys)
logt\log t logq\log q logN\log N logr\log r average time (s) BootKeys +KSKeys
TFHE 5 12 11 0.6969 256 MB +2.35 GB
6 13 12 3.6953 512 MB +4.70 GB
7 14 13 10.092 1 GB +9.39 GB
Boot- MMPM 5 12 11 0 0.7375 256 MB +2.35 GB
6 13 1 1.3625
7 14 2 2.6376
8 15 3 5.2578
9 16 4 10.203
10 17 5 20.261
11 18 6 41.795

In Table 1, the TFHE bootstrapping program stops running when the plaintext size reaches 8 bits, with nothing coming out; on the other hand, the BootMMPM program still runs when the plaintext size reaches 11 bits, and finishes in 42 seconds with correct result. When the plaintext has 7 bits, running TFHE costs over 10 seconds, while running BootMMPM costs less than 3 seconds; the latter is faster by about 3 times. For each plaintext size, 10 plaintexts of the specific size are randomly generated, and the algorithms run on the ciphertexts encrypting them separately to get the average run-time.

As to the key size, it can be reduced on the client’s side using packing techniques [17, 18], for both TFHE and BootMMPM, with the same scale. In the experiments, these improvements are not implemented for sharper comparison.

Platform 2. HP Workstation with Intel(R) Xeon(R) Gold 6258R CPU @ 2.70 GHz and 1.00 TB RAM. Software: PALISADE v1.11.8 with compiler g++ 11.3.0. Plaintext size: logt=5,6,,15\log t=5,6,\ldots,15 respectively. Following [20], we increase logn\log n to 1010.

Although the security level of BootMMPM under the above setting is lower than that of TFHE when r>1r>1, the increase of security level in TFHE is passively driven by the need of larger exponent space, so that the whole look-up table can be encoded.

TABLE II: Experiments on Platform 2 (workstation)
logt\log t logq\log q logN\log N logr\log r average time (s) BootKeys +KSKeys
TFHE 5 12 11 1.7382 512 MB +4.69 GB
6 13 12 3.5343 1 GB +9.38 GB
7 14 13 7.2890 2 MB +18.8 GB
8 15 14 14.894 4 GB +37.5 GB
9 16 15 30.678 8 GB +75.1 GB
10 17 16 61.116 16 GB +150 GB
11 18 17 123.47 32 GB +300 GB
Boot- MMPM 5 12 11 0 1.7687 512 MB +4.69 GB
6 13 1 3.3859
7 14 2 6.4064
8 15 3 12.402
9 16 4 24.379
10 17 5 49.792
11 18 6 96.132
12 19 7 202.56
13 20 8 413.22
14 21 9 834.60
15 22 10 1676.3

In Table 2, both programs run correctly for plaintext size up to 11 bits, and BootMMPM is slightly faster. For example, when the plaintext size is 11 bits, TFHE costs more than 120 seconds, while BootMMPM costs less than 100 seconds.

On both platforms, BootMMPM remains constant bootstrapping key size 512 MB and key-switching key size 4.69 GB, while TFHE requires the bootstrapping key size to grow from 512 MB to 32 GB, and the key-switching key size to grow from 4.69 GB to 300 GB.

VI Conclusion

For general functional bootstrapping of ciphertexts encrypting long plaintext, this paper proposes to encode the look-up table of the function by a polynomial vector, instead of only a polynomial in FHEW/TFHE. This motivates a thorough investigation of the group of monic monomial permutation matrices and its cyclic subgroups, based on which a new algorithm for general functional bootstrapping is proposed. The algorithm features in small bootstrapping and key-switching key size, which benefits communication cost and memory cost in bootstrapping.

On the other hand, the new algorithm provides only slight improvement in time cost. One may consider using a multivariate polynomial instead of a polynomial vector to encode the look-up table of a general function. This idea may lead to significant speed-up, just as in the case of parallel FHEW/TFHE bootstrapping [14, 15]. New explorations are expected to make improvement on time cost in this direction.

Acknowledgments

This research was supported partially by China National Key Research and Development Project Grant No. 2020YFA0712300.

References

  • [1] B. H. M. Tan, H. T. Lee, H. Wang, S. Ren, and K. M. M. Aung, “Efficient private comparison queries over encrypted databases using fully homomorphic encryption with finite fields,” IEEE Transactions on Dependable and Secure Computing, vol. 18, no. 6, pp. 2861–2874, 2020.
  • [2] X. Yi, M. G. Kaosar, R. Paulet, and E. Bertino, “Single-database private information retrieval from fully homomorphic encryption,” IEEE Transactions on Knowledge and Data Engineering, vol. 25, no. 5, pp. 1125–1134, 2012.
  • [3] S. Angel, H. Chen, K. Laine, and S. Setty, “Pir with compressed queries and amortized query processing,” in 2018 IEEE symposium on security and privacy (SP).   IEEE, 2018, pp. 962–979.
  • [4] K. Cong, D. Das, J. Park, and H. V. Pereira, “Sortinghat: Efficient private decision tree evaluation via homomorphic encryption and transciphering,” in Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security, 2022, pp. 563–577.
  • [5] C. Gentry, “Fully homomorphic encryption using ideal lattices,” in Proceedings of the forty-first annual ACM symposium on Theory of computing, 2009, pp. 169–178.
  • [6] J. Alperin-Sheriff and C. Peikert, “Faster bootstrapping with polynomial error,” in Annual Cryptology Conference.   Springer, 2014, pp. 297–314.
  • [7] R. Hiromasa, M. Abe, and T. Okamoto, “Packing messages and optimizing bootstrapping in gsw-fhe,” IEICE TRANSACTIONS on Fundamentals of Electronics, Communications and Computer Sciences, vol. 99, no. 1, pp. 73–82, 2016.
  • [8] L. Ducas and D. Micciancio, “Fhew: bootstrapping homomorphic encryption in less than a second,” in Annual international conference on the theory and applications of cryptographic techniques.   Springer, 2015, pp. 617–640.
  • [9] I. Chillotti, N. Gama, M. Georgieva, and M. Izabachene, “Faster fully homomorphic encryption: Bootstrapping in less than 0.1 seconds,” in international conference on the theory and application of cryptology and information security.   Springer, 2016, pp. 3–33.
  • [10] Z. Liu, D. Micciancio, and Y. Polyakov, “Large-precision homomorphic sign evaluation using fhew/tfhe bootstrapping,” Cryptology ePrint Archive, 2021.
  • [11] I. Chillotti, D. Ligier, J.-B. Orfila, and S. Tap, “Improved programmable bootstrapping with larger precision and efficient arithmetic circuits for tfhe,” in Advances in Cryptology–ASIACRYPT 2021: 27th International Conference on the Theory and Application of Cryptology and Information Security, Singapore, December 6–10, 2021, Proceedings, Part III 27.   Springer, 2021, pp. 670–699.
  • [12] I. Chillotti, N. Gama, M. Georgieva, and M. Izabachène, “Tfhe: fast fully homomorphic encryption over the torus,” Journal of Cryptology, vol. 33, no. 1, pp. 34–91, 2020.
  • [13] Z. Yang, X. Xie, H. Shen, S. Chen, and J. Zhou, “Tota: Fully homomorphic encryption with smaller parameters and stronger security,” Cryptology ePrint Archive, 2021.
  • [14] F.-H. Liu and H. Wang, “Batch bootstrapping i: a new framework for simd bootstrapping in polynomial modulus,” in Annual International Conference on the Theory and Applications of Cryptographic Techniques.   Springer, 2023, pp. 321–352.
  • [15] Liu, Feng-Hao and Wang, Han, “Batch bootstrapping ii: bootstrapping in polynomial modulus only requires o~(1) fhe multiplications in amortization,” in Annual International Conference on the Theory and Applications of Cryptographic Techniques.   Springer, 2023, pp. 353–384.
  • [16] Y. Lee, D. Micciancio, A. Kim, R. Choi, M. Deryabin, J. Eom, and D. Yoo, “Efficient fhew bootstrapping with small evaluation keys, and applications to threshold homomorphic encryption,” in Annual International Conference on the Theory and Applications of Cryptographic Techniques.   Springer, 2023, pp. 227–256.
  • [17] A. Kim, M. Deryabin, J. Eom, R. Choi, Y. Lee, W. Ghang, and D. Yoo, “General bootstrapping approach for rlwe-based homomorphic encryption,” Cryptology ePrint Archive, 2021.
  • [18] A. Kim, Y. Lee, M. Deryabin, J. Eom, and R. Choi, “Lfhe: Fully homomorphic encryption with bootstrapping key size less than a megabyte,” Cryptology ePrint Archive, 2023.
  • [19] “Palisade lattice cryptography library,” https://palisade-crypto.org/, 2022.
  • [20] M. Albrecht, M. Chase, H. Chen, J. Ding, S. Goldwasser, S. Gorbunov, S. Halevi, J. Hoffstein, K. Laine, K. Lauter et al., “Homomorphic encryption standard,” Protecting privacy through homomorphic encryption, pp. 31–62, 2021.
Dengfa Liu received Bachelor of Science degree from Fujian Normal University in 2019. He is currently pursuing a PhD at AMSS, Chinese Academy of Sciences. His research interest is Algorithm Design in Privacy Computation.
Hongbo Li is Kwan Chao-Chi Chair Professor and Director of the Institute of Systems Science, AMSS, Chinese Academy of Sciences. He received BS, MS, PhD from the Department of Mathematics at Beijing University in 1988, 1991, 1994, respectively. His research interests include Automated Reasoning, Symbolic Computation, Geometric Algebra, Quantum Computing, Privacy Computation, etc. He is Director of the Computer Mathematics Committee of Chinese Mathematics Society.