Homomorphic comparison algorithm

references:

  1. [PS73] Paterson M S, Stockmeyer L J. On the number of nonscalar multiplications necessary to evaluate polynomials[J]. SIAM Journal on Computing, 1973, 2(1): 60-66.
  2. [KLLW16] Kim M, Lee H T, Ling S, et al. On the efficiency of FHE-based private queries[J]. IEEE Transactions on Dependable and Secure Computing, 2016, 15(2): 357-363.
  3. [IZ21] Iliashenko I, Zucca V. Faster homomorphic comparison operations for BGV and BFV[J]. Proceedings on Privacy Enhancing Technologies, 2021, 2021(3): 246-264.

Fast polynomial evaluation algorithm

for nnn- length polynomialP ( x ) P(x)P ( x ) , if you want to calculatennFunction value P ( ξ i ) P(\xi^i)on n unit rootsP ( xi ), then using FFT/NTT can achieveO ( n log ⁡ n ) O(n\log n)O ( nlogThe complexity of n ) , the amortized cost is O ( log ⁡ n ) O(\log n)O(logn ) . But if we consider a single arbitrary pointxxx evaluatesP ( x ) P(x)P ( x ) , how to calculate it quickly? "Fast" here meansfewer "non-scalar multiplications". The cost of scalar multiplication is similar to that of addition. From now on we will assume that "multiplication" refers to non-scalar multiplication.

Horner rule ∑ i = 0 n a i x i = ( ⋯ ( ( a n x + a n − 1 ) x + a n − 2 ) ⋯   ) x + a 0 \sum_{i=0}^na_ix^i = (\cdots((a_nx+a_{n-1})x+a_{n-2})\cdots)x+a_0 i=0naixi=(((anx+an1)x+an2))x+a0, a total of nn is neededn times multiplication.

[PS73] proposed that only O ( n ) O(\sqrt n)O(n ) times multiplication polynomial single-point evaluation algorithm. First of all, it can be proved that the lower bound of complexity of polynomial evaluation isO ( n ) O(\sqrt n)O(n )

Insert image description here

Then [PS73] proposed three polynomial evaluation algorithms in sequence.

Algorithm A

Theorem: Degree nnAny polynomial of n exists usingn / 2 + O ( log ⁡ n ) n/2+O(\log n)n/2+O(logEvaluation algorithm for n ) multiplications.

For convenience, we assume n = 2 m − 1 n=2^m-1n=2m1 (Polynomial length2 m 2^m2m ), while the polynomial is leading,

  1. First precompute x 2 , x 4 , x 8 , ⋯ , x 2 m − 1 x^2,x^4,x^8,\cdots,x^{2^{m-1}}x2,x4,x8,,x2m 1 , costlog ⁡ n \log nlogn times multiplication

  2. Given a certain 2 p − 1 2p-12pThe leading polynomial of degree 1 can be written in the following form:
       x 2 p − 1 + a 2 p − 2 x 2 p − 2 + ⋯ + a 1 x + a 0 = ( xp + c ) ( xp − 1 + a 2 p − 2 xp − 2 + ⋯ + ap + 1 x + ap ) + ( xp − 1 + bp − 2 xp − 2 + ⋯ + b 1 x + b 0 ) \begin{aligned} &\,\, x ^{2p-1}+a_{2p-2}x^{2p-2}+\cdots+a_1x+a_0\\ =&\,\, (x^p+c)(x^{p-1} +a_{2p-2}x^{p-2}+\cdots+a_{p+1}x+a_p)\\ +&\,\, (x^{p-1}+b_{p-2 }x^{p-2}+\cdots+b_1x+b_0) \end{aligned}=+x2p1+a2p2x2p2++a1x+a0(xp+c)(xp1+a2p2xp2++ap+1x+ap)(xp1+bp2xp2++b1x+b0)

    where c = ap − 1 − 1 c=a_{p-1}-1c=ap11 b j = a j − c a p + j b_j=a_j-ca_{p+j} bj=ajcap+jis a constant, and xpx^pxp has been precomputed

  3. So we put 2 p − 1 2p-12pThe leading polynomial of degree 1 is decomposed into two p − 1 p-1pThe first polynomial of degree 1 continuesto be evaluated recursively. The recursive formula for multiplicative complexity isN ( 2 p − 1 ) = 2 N ( p − 1 ) + 1 N(2p-1)=2N(p-1)+1N(2p1)=2N ( p _1)+1 , initial valueN (1) = 0 N(1)=0N(1)=0 , soN ( n ) = ( n + 1 ) / 2 − 1 ≈ n / 2 N(n)=(n+1)/2-1 \approx n/2N(n)=(n+1)/21n/2

For any nn , we willnnn binary decomposition, so the polynomial can be split into a number of lengths2 i 2^i2For the slicesof i , after executing the evaluation algorithm respectively, multiply byx 2 , x 4 , x 8 , ⋯ , x 2 ⌊ log ⁡ n ⌋ x^2,x^4,x^8,\cdots,x^ {2^{\lfloor\log n\rfloor}}x2,x4,x8,,x2logn ⌋Assemble . This costs extralog ⁡ n \log nlogn times multiplication.

Algorithm B

Theorem: Degree nnAny polynomial of n exists using2 n 2\sqrt{n}2n Evaluation algorithm for submultiplications.

We assume n = km − 1 n=km-1n=km1 (Polynomial lengthkm kmkm),

  1. First precompute x 2 , x 3 , ⋯ , xkx^2,x^3,\cdots,x^kx2,x3,,xk , costkkk multiplications

  2. Using the generalized version of Horner's rule , write the polynomial in the following form:
       akm − 1 xkm − 1 + akm − 2 xkm − 2 + ⋯ + a 1 x + a 0 = ( ⋯ ( ( akm − 1 xk − 1 + ⋯ + ak ( m − 1 ) ) xk + ( ak ( m − 1 ) − 1 xk − 1 + ⋯ + ak ( m − 2 ) ) ) xk + ⋯ ) xk + ( ak − 1 xk − 1 + ⋯ + a 1 x + a 0 ) \begin{aligned} &\,\, a_{km-1}x^{km-1}+a_{km-2}x^{km-2}+\cdots+a_1x+a_0\\ =&\,\, \Bigg(\cdots\Big((a_{km-1}x^{k-1}+\cdots+a_{k(m-1)})x^k\\ &\, \, +(a_{k(m-1)-1}x^{k-1}+\cdots+a_{k(m-2)})\Big)x^k + \cdots\Bigg)x^ k\\ &\,\, +(a_{k-1}x^{k-1}+\cdots+a_1x+a_0) \end{aligned}=akm1xkm1+akm2xkm2++a1x+a0(((akm1xk1++ak(m1))xk+(ak(m1)1xk1++ak(m2)))xk+)xk+(ak1xk1++a1x+a0)

    Because x 2 , ⋯ . xk − 1 , xkx^2,\cdots.x^{k-1},x^kx2,.xk1,xk are all precomputed, so the multiplication cost ismmm

  3. The total complexity is k + m k+mk+m , selectk = nk=\sqrt{n}k=n time optimization

Algorithm C

Theorem: Degree nnAny polynomial of n exists using2 n + O ( log ⁡ n ) \sqrt{2n}+O(\log n)2 n +O(logEvaluation algorithm for n ) multiplications.

We assume n = k ⋅ ( 2 m − 1 ) n=k\cdot (2^m-1)n=k(2m1 ) , while the polynomial is leading,

  1. Precompute x 2 , x 3 , ⋯ , xkx^2,x^3,\cdots,x^kx2,x3,,xk , costkkk multiplications

  2. Precompute x 2 k , x 4 k , x 8 k , ⋯ , xk ⋅ 2 m − 1 x^{2k},x^{4k},x^{8k},\cdots,x^{k\cdot2^ {m-1}}x2k , _x4k , _x8k , _,xk2m 1 , spendmmm times multiplication

  3. Given a certain k ( 2 p − 1 ) k(2p-1)k(2p1 ) degree first polynomial, write it in the following form:
       xk ( 2 p − 1 ) + ak ( 2 p − 1 ) − 1 xk ( 2 p − 1 ) − 1 + ⋯ + a 1 x + a 0 = ( xk ( p − 1 ) + ak ( 2 p − 1 ) − 1 xk ( 2 p − 1 ) − 1 + ⋯ + ak ( p − 1 ) ) xkp + ( ak ( p − 1 ) − 1 xkp − 1 + ⋯ + a 1 x + a 0 ) \begin{aligned} &\,\, x^{k(2p-1)}+a_{k(2p-1)-1}x^{k(2p-1 )-1}+\cdots+a_1x+a_0\\ =&\,\, (x^{k(p-1)}+a_{k(2p-1)-1}x^{k(2p-1 )-1}+\cdots+a_{k(p-1)})x^{kp}\\ +&\,\, (a_{k(p-1)-1}x^{kp-1} +\cdots+a_1x+a_0) \end{aligned}=+xk(2p1)+ak(2p1)1xk(2p1)1++a1x+a0(xk(p1)+ak(2p1)1xk(2p1)1++ak(p1))xkp(ak(p1)1xkp1++a1x+a0)

    Abbreviated as p ( x ) = q ( x ) ⋅ xkp + r ( x ) p(x)=q(x)\cdot x^{kp}+r(x)p(x)=q(x)xkp+r ( x ) , whereq ( x ) q(x)q ( ​​x ) isthe degree k ( p − 1 ) k(p-1)k(p1 ) The leading polynomial,r ( x ) r(x)r ( x ) is of degree at mostkp − 1 kp-1kpPolynomial of 1 , where xkpx^{kp}xk p has been precalculated

  4. Then calculate the division with remainder (note that this is different from xxThe value of x is irrelevant and can be pre-calculated)r ( x ) − xk ( p − 1 ) = c ( x ) ⋅ q ( x ) + s ( x ) r(x)-x^{k(p-1) } = c(x) \cdot q(x)+s(x)r(x)xk(p1)=c(x)q(x)+s ( x ) , wherec ( x ) c(x)The degree of c ( x ) is at mostk − 1 k-1k1 s ( x ) s(x) The degree of s ( x ) is at mostk ( p − 1 ) − 1 k(p-1)-1k(p1)1 , then it is written as
    p ( x ) = ( xkp + c ( x ) ) ⋅ q ( x ) + ( xk ( p − 1 ) + s ( x ) ) p(x) = (x^{kp}+ c(x)) \cdot q(x) + (x^{k(p-1)}+s(x))p(x)=(xkp+c(x))q(x)+(xk(p1)+s(x))

    Among them, xk ( p − 1 ) + s ( x ) x^{k(p-1)}+s(x)xk(p1)+s ( x ) is alsodegree k ( p − 1 ) k(p-1)k(p1 ) The leading polynomial of

  5. For the above two k ( p − 1 ) k(p-1)k(p1 ) Recursive evaluation ofpolynomials of degree 1.The recursive formula of multiplicative complexity isN ( k ( 2 p − 1 ) ) = 2 N ( k ( p − 1 ) ) + 1 N(k(2p-1))=2N( k(p-1))+1N ( k ( 2p _1))=2 N ( k ( p1))+1 , initial valueN (k) = 0 N(k)=0N(k)=0 , thereforeN ( n ) = ( n / k + 1 ) / 2 − 1 ≈ n / 2 k N(n)=(n/k+1)/2-1\approx n/2kN(n)=(n/k+1)/21n /2 k , selectk = n / 2 k=\sqrt{n/2}k=n/2 time optimization

For any nn , similar to Algorithm A for sharding, requiring additionallog ⁡ 2 n \log \sqrt{2n}log2 n times multiplication.

Comparison algorithm based on interpolation

Comparison functions over finite fields

Generally, we use Boolean comparison circuits:
EQ ( a , b ) : = ∏ i = 1 l ( ai ⊕ bi ⊕ 1 ) LT ( a , b ) : = ∑ i = 1 l ( ai ⊕ 1 ) ⋅ bi ∏ j = i + 1 l ( aj ⊕ bj ⊕ 1 ) \begin{aligned} EQ(a,b) &:= \prod_{i=1}^l (a_i \oplus b_i \oplus 1)\\ LT(a ,b) &:= \sum_{i=1}^l(a_i\oplus 1)\cdot b_i\prod_{j=i+1}^l (a_j \oplus b_j \oplus 1)\\ \end{aligned }EQ(a,b)LT(a,b):=i=1l(aibi1):=i=1l(ai1)bij=i+1l(ajbj1)

[IZ21] proposed GF ( q ) , q = pd GF(q),q=p^dGF(q),q=pComparator circuit on d . LetS ⊆ GF ( q ) S \subseteq GF(q)SGF ( q ) is a subset of prime fields, in which the value range of polynomial coefficients is[ B ] = { 0 , 1 , ⋯ , B } [B]=\{0,1,\cdots,B\}[B]={ 0,1,,B}。再令 S ′ = { 0 , 1 , ⋯   , B l − 1 } , l ≤ d S'=\{0,1,\cdots,B^{l}-1\}, l\le d S={ 0,1,,Bl1},ld is the value range of the integer, we write the integer asBBB 进制形式 a = a l ⋯ a 2 a 1 a=a_l\cdots a_2a_1 a=ala2a1, in which ai ∈ [ B ] a_i \in [B]ai[ B ] is an integer. We define the following bijection:
ι : S ′ → S ∑ i = 1 lai B i − 1 ↦ ∑ i = 1 laixi − 1 \begin{aligned} \iota: S' &\to S\\ \sum_{i= 1}^{l} a_i B^{i-1} &\mapsto \sum_{i=1}^{l} a_i x^{i-1} \end{aligned}i:Si=1laiBi1Si=1laixi1

According to this mapping, we can get from a , b ∈ S ′ a,b \in S'a,bSThe total order relationship of ′ inducesι ( a ) , ι ( b ) ∈ S ⊆ GF ( q ) \iota(a),\iota(b) \in S \subseteq GF(q)i ( a ) ,i ( b )SThe total ordering relationship of GF ( q ) . That is:based on the size relationship of integers, the size relationship of finite field elements is induced.

Given any two finite field elements X , Y ∈ SX,Y \in SX,YS , their size relationship constitutes afunction LTS (X, Y) LT_S(X,Y)LTS(X,Y ) . According tothe finite field interpolation theorem, for any multi-variable function, there is a unique multi-variablepolynomial, making the two have the same functionality.

Insert image description here

The above χ : α ↦ α q − 1 \chi: \alpha \mapsto \alpha^{q-1}h:aaq 1 isan indicator function. The order of the multiplicative cyclic group isq − 1 q-1q1 , thereforeχ ( α ) = 1 ⟺ α ≠ 0 \chi(\alpha)=1 \iff \alpha \neq 0x ( a )=1a=0 . In fact, the equality circuit on the finite field is
EQS ( X , Y ) : = 1 − χ ( X − Y ) EQ_S(X, Y) := 1-\chi(XY)EQS(X,Y):=1x ( XY)

According to lexicographic order, the integer can be further represented as " SSS base", thereby realizingany large integer. Write the integer asa = al ⋯ a 2 a 1 a=a_l\cdots a_2a_1a=ala2a1, in which ai ∈ S a_i \in SaiS 是有限域元素。那么,
E Q S l ( a , b ) : = ∏ i = 1 l E Q S ( a i , b i ) L T S l ( a , b ) : = ∑ i = 1 l L T S ( a i , b i ) ∏ j = i + 1 l E Q S ( a j , b j ) \begin{aligned} EQ_{S^l}(a,b) &:= \prod_{i=1}^l EQ_S(a_i,b_i)\\ LT_{S^l}(a,b) &:= \sum_{i=1}^l LT_S(a_i,b_i) \prod_{j=i+1}^l EQ_S(a_j,b_j)\\ \end{aligned} EQSl(a,b)LTSl(a,b):=i=1lEQS(ai,bi):=i=1lLTS(ai,bi)j=i+1lEQS(aj,bj)

Next, let's take a look at how to implement the basic comparison function LTS (X, Y) LT_S(X,Y)LTS(X,Y ) . For simplicity, we consider the prime domainS ⊆ GF ( p ) S\subseteq GF(p)SComparison function on GF ( p ) . For extended domainGF ( pd ) GF(p^d)GF(pd ), is a similar idea.

Two-variable polynomial interpolation

We let S = { 0 , 1 , ⋯ , p − 1 } S = \{0,1,\cdots,p-1\}S={ 0,1,,p1 } , then according to the total order relationship between integers, the followingdouble variable function:

Insert image description here

According to the interpolation theorem, we can get a double variable polynomial :
P ( X , Y ) : = ∑ a = 0 p − 2 EQS ( X , a ) ∑ b = a + 1 p − 1 EQS ( Y , b ) P (X,Y) := \sum_{a=0}^{p-2} EQ_S(X,a) \sum_{b=a+1}^{p-1} EQ_S(Y,b)P(X,Y):=a=0p2EQS(X,a)b=a+1p1EQS(Y,b)

[IZ21] Point out that the above polynomial can be reduced to the following form, and its total degree is ppp

Insert image description here

主要的计算开销是 ∑ i j a i j X i Y j = ∑ i ( ∑ j a i j X i ) Y j \sum_{ij} a_{ij} X^i Y^j = \sum_{i} \left(\sum_j a_{ij} X^i\right) Y^j ijaijXiYj=i(jaijXi)Yj , only requiresO ( p ) O(p)O ( p ) multiplications, the multiplication depth isO ( log ⁡ p ) O(\log p)O(logp)

Single variable polynomial interpolation

We let S = { 0 , 1 , ⋯ , ( p − 1 ) / 2 } S=\{0,1,\cdots,(p-1)/2\}S={ 0,1,,(p1 ) /2 } , and divide the finite field into two parts
GF ( p ) + = S , GF ( p ) − = { − ( p − 1 ) / 2 , ⋯ , − 2 , − 1 } GF(p) ^+=S,\,\, GF(p)^-=\{-(p-1)/2,\cdots,-2,-1\}GF(p)+=S,GF(p)={ (p1)/2,,2,1}

According to the size relationship between integers, the function X < Y ⟺ Z : = ( X − Y ) ∈ GF ( p ) − X<Y \iff Z:=(XY) \in GF(p)^-X<YZ:=(XY)GF(p)

According to the interpolation theorem, we can get a single variable polynomial :
Q ( X , Y ) : = ∑ a = − ( p − 1 ) / 2 − 1 EQ s ( Z , a ) Q(X,Y) := \ sum_{a=-(p-1)/2}^{-1} EQ_s(Z,a)Q(X,Y):=a=(p1)/21EQs(Z,a)

[IZ21] pointed out that the above polynomial can be reduced to the following form,

Insert image description here

Attention ∑ ici ( X − Y ) i \sum_{i}c_i(XY)^iici(XY)The powers of i are all odd numbers, so it can be written as Z g ( Z 2 ) Zg(Z^2)Zg(Z2 )form, whereg ( x ) g(x)g ( x ) is the degree( p − 3 ) / 2 (p-3)/2(p3 ) Single variable polynomial of /2 . According to Horber's rule, we usethe Paterson-Stockmeyer algorithmto calculate polynomial evaluation, which only requiresO ( p / 2 ) O(\sqrt{p/2})O(p/2 ) is the number of multiplications.

However, it should be noted that the single variable interpolation S = { 0 , 1 , ⋯ , ( p − 1 ) / 2 } S=\{0,1,\cdots,(p-1)/2\}S={ 0,1,,(p1 ) /2 } than double variable interpolationS = { 0 , 1 , ⋯ , p − 1 } S=\{0,1,\cdots,p-1\}S={ 0,1,,pThe range of 1 } is half smaller, so forlll bitSSS base number, indicating that the range is reduced to1 / 2 l 1/2^l1/2l , had to extendlll l ⋅ log ⁡ p log ⁡ p − 1 \dfrac{l\cdot\log p}{\log p-1} logp1llogpto ensure the same representation range.

other apps

实现最大值、最小值,
min ⁡ ( X , Y ) = X ⋅ L T ( X , Y ) + Y ⋅ ( 1 − L T ( X , Y ) ) = Y + ( X − Y ) ⋅ L T ( X , Y ) = Y + Z ⋅ Q ( X , Y ) = p + 1 2 ( X + Y ) + g ′ ( Z 2 ) , max ⁡ ( X , Y ) = Y ⋅ L T ( X , Y ) + X ⋅ ( 1 − L T ( X , Y ) ) = X + ( Y − X ) ⋅ L T ( X , Y ) = X − Z ⋅ Q ( X , Y ) = p + 1 2 ( X + Y ) − g ′ ( Z 2 ) \begin{aligned} \min(X,Y) &= X \cdot LT(X,Y) + Y \cdot (1-LT(X,Y))\\ &= Y + (X-Y) \cdot LT(X,Y)\\ &= Y + Z \cdot Q(X,Y)\\ &= \dfrac{p+1}{2}(X+Y) + g'(Z^2), \\ \max(X,Y) &= Y \cdot LT(X,Y) + X \cdot (1-LT(X,Y))\\ &= X + (Y-X) \cdot LT(X,Y)\\ &= X - Z \cdot Q(X,Y)\\ &= \dfrac{p+1}{2}(X+Y) - g'(Z^2)\\ \end{aligned} min(X,Y)max(X,Y)=XLT(X,Y)+Y(1LT(X,Y))=Y+(XY)LT(X,Y)=Y+ZQ(X,Y)=2p+1(X+Y)+g(Z2),=YLT(X,Y)+X(1LT(X,Y))=X+(YX)LT(X,Y)=XZQ(X,Y)=2p+1(X+Y)g(Z2)

where g ′ ( x ) g'(x)g (x)is the degree( p − 1 ) / 2 (p-1)/2(p1 ) /2 single variable polynomial, using [PS73] only requiresO ( p / 2 ) O(\sqrt{p/2})O(p/2 ) times multiplication.

Implement the ReLU function,
R e LU ( X ) : = max ⁡ ( X , 0 ) = p + 1 2 X − g ′ ( +1}{2}X - g'(X^2)\\R e LU ( X ):=max(X,0)=2p+1Xg(X2)

Depth-optimal equality circuit in finite fields

[KLLW16] took advantage of the fact that the Frobenius map in the extended domain does not require multiplication operations in the homomorphism , and implemented a multiplication depth-optimized discriminant circuit in the extended domain.

As mentioned above, let χ : α ↦ α pl − 1 \chi: \alpha \mapsto \alpha^{p^l-1}h:aapl1is an indicator function, then the finite fieldGF (pl) GF(p^l)GF(pThe equality circuit on l )
is: EQ ( X , Y ) : = 1 − χ ( X − Y ) EQ(X, Y) := 1-\chi(XY)EQ(X,Y):=1x ( XY)

Then use binary tree multiplication directly, the depth is ⌈ l ⋅ log ⁡ p ⌉ \lceil l \cdot \log p \rceilllogp . For the extended domain GF ( 2 l ) GF(2^l)of the binary domainGF(2l ), **depth islll , **This is too high.

However, we calculate me ∈ GF ( pl ) m^e \in GF(p^l)meGF(pl ), possible,
me = m ∑ i = 0 neipi = ∏ i = 0 n ( mpi ) eim^e = m^{\sum_{i=0}^n e_ip^i} = \prod_{ i=0}^n (m^{p^i})^{e_i}me=mi=0neipi=i=0n(mpi)ei

where mpim^{p^i}mpi is the extended domainGF (pl) / GF (p) GF(p^l)/GF(p)GF(pFrobenius maps on l )/GF(p)GF ( pl ) GF(p^l)for FHE ciphertextGF(pl )上的GF ( p ) GF(p)GF ( p ) - domain automorphismσ ( x ) : = xp \sigma(x):=x^pσ ( x ):=xp ,index
σ ( ct ) = ( σ ( a ) , σ ( a ) σ ( s ) + Δ ⋅ mp + σ ( e ) ) ∈ ( GF ( pd ) ) 2 \sigma(ct) = (\sigma( a), \sigma(a)\sigma(s)+\Delta \cdot m^p+\sigma(e)) \in \left(GF(p^d)\right)^2σ(ct)=( σ ( a ) ) ,σ ( a ) σ ( s )+Dmp+s ( e ))(GF(pd))2

Then switch the secret key back to s ∈ GF (pl) s \in GF(p^l)sGF(pl )is the private key. The above process is depth-free (no homomorphic multiplication is required), so eachmpim^{p^i}mpThe multiplication depth of i is zero. Therefore, the abovemem^emIn the calculation of e, only∑ i = 0 nei \sum_{i=0}^n e_ii=0neiThe continuous product of terms, the multiplication depth is ⌈ log ⁡ ∑ i = 0 nei ⌉ \lceil \log \sum_{i=0}^n e_i \rceillogi=0nei

For χ ( X − Y ) \chi(XY) in the discriminant circuitx ( XY ) ,Let
= pl − 1 = ( p − 1 ) pl − 1 + ⋯ + ( p − 1 ) p + ( p − 1 ) = ( p − 1 ) ( pl − 1 + ⋯ + p + ) \begin{aligned} with &= p^l-1\\ &= (p-1)p^{l-1}+\cdots+(p-1)p+(p-1)\\ &= (p -1)(p^{l-1}+\cdots+p+1) \end{aligned}e=pl1=(p1)pl1++(p1)p+(p1)=(p1)(pl1++p+1)

Therefore, calculate Z first : = ( X − Y ) p − 1 Z:=(XY)^{p-1}Z:=(XY)p1,再计算 Z p i , i = 1 , ⋯   , l − 1 Z^{p^i},i=1,\cdots,l-1 Zpi,i=1,,l1 , then calculationχ ( X − Y ) = ∏ i = 0 l − 1 Z pi \chi(XY) = \prod_{i=0}^{l-1} Z^{p^i}x ( XY)=i=0l1Zpi , the depth is⌈ log ⁡ ( p − 1 ) ⌉ + ⌈ log ⁡ l ⌉ \lceil \log(p-1) \rceil + \lceil \log l \rceillog(p1)⌉+logl . For the extended domain GF ( 2 l ) GF(2^l)of the binary domainGF(2l ),the depth is only⌈ log ⁡ l ⌉ \lceil \log l \rceillogl

Of course, for { 0 , 1 } l \{0,1\}^l{ 0,1}l data, Boolean circuit respectively inGF (2) GF(2)GF ( 2 ) is equal to the upper judgment, and then the Boolean result is multiplied. Its depth is also⌈ log ⁡ l ⌉ \lceil \log l \rceillogl . However, in some applications (not just equality circuits), using Boolean circuits is not appropriate.

Guess you like

Origin blog.csdn.net/weixin_44885334/article/details/132512500