Algorithm Search⌘K

Proofs: Quasi-polynomial discrete logarithm algorithm

These are the human proofs of Quasi-polynomial discrete logarithm algorithm, at full length.

Correctness of the quasi-polynomial discrete logarithm algorithm (toy version) full

This proof shows: correctness, termination.

We prove the version of the main pseudocode. Let qq be an odd prime power, h0,h1∈Fq2[X]h_0, h_1 \in \mathbb{F}_{q^2}[X] with gcd⁡(h0,h1)=1\gcd(h_0, h_1) = 1 and h1=ch∏β(X+β)fβh_1 = c_h \prod_\beta (X + \beta)^{f_\beta} a product of linear factors, and II a monic irreducible factor of degree k≥2k \ge 2 of h1Xq−h0h_1 X^q - h_0. Let K=Fq2[X]/(I)K = \mathbb{F}_{q^2}[X]/(I), a field with Q=q2kQ = q^{2k} elements, and G=K∗G = K^*, cyclic of order N=Q−1N = Q - 1. Let g∈Gg \in G have order rr and let h∈Gh \in G. Let γ\gamma be the generator of line L3 and L(z)∈Z/NZL(z) \in \mathbb{Z}/N\mathbb{Z} the logarithm of z∈Gz \in G to base γ\gamma. Let ℓ=∏ρe\ell = \prod \rho^e over the prime powers ρe∥N\rho^e \parallel N with ρ∣r\rho \mid r; then r∣ℓ∣Nr \mid \ell \mid N. For termination we treat the exponents mm of lines L9 and L13 as independent and uniform in [0,N−1][0, N - 1].

Lemma 1 (membership and the trivial target). Line L1 returns NONE exactly when h∉⟨g⟩h \notin \langle g \rangle, and line L2 is correct.

Proof. GG is cyclic, so its only subgroup of order rr is {z:zr=1}\{z : z^r = 1\}, which is ⟨g⟩\langle g \rangle. If h=1h = 1, then x=0x = 0. □\square

From now on h=gx∗h = g^{x^*} with 0≤x∗<r0 \le x^* < r, unique because gg has order rr, and h≠1h \ne 1, so r≥2r \ge 2.

Lemma 2 (the systematic congruence). Let a,b,c,d∈Fq2a, b, c, d \in \mathbb{F}_{q^2} with ad−bc≠0ad - bc \ne 0, Y=aX+bY = aX + b and Z=cX+dZ = cX + d. Then ZZ and every Y−αZY - \alpha Z with α∈Fq\alpha \in \mathbb{F}_q are nonzero polynomials of degree at most 11, a polynomial of degree 00 among them is a nonzero constant, and in KK

h1⋅Z∏α∈Fq(Y−αZ)=Rm,Rm=(aqh0+bqh1)Z−Y(cqh0+dqh1),h_1 \cdot Z \prod_{\alpha \in \mathbb{F}_q} (Y - \alpha Z) = R_m, \qquad R_m = (a^q h_0 + b^q h_1) Z - Y (c^q h_0 + d^q h_1),

where both sides are nonzero.

Proof. In any commutative ring of characteristic pp containing Fq\mathbb{F}_q, Tq−T=∏α∈Fq(T−α)T^q - T = \prod_{\alpha \in \mathbb{F}_q} (T - \alpha) holds in Fq[T]\mathbb{F}_q[T], since both sides are monic of degree qq and vanish at the qq elements of Fq\mathbb{F}_q. Homogenizing gives YqZ−YZq=Z∏α(Y−αZ)Y^q Z - Y Z^q = Z \prod_\alpha (Y - \alpha Z) in Fq[Y,Z]\mathbb{F}_q[Y, Z]: for Z=1Z = 1 this is the identity above, both sides are homogeneous of degree q+1q + 1, and both have the coefficient 00 at Yq+1Y^{q+1}. Substitute Y=aX+bY = aX + b and Z=cX+dZ = cX + d. Since the characteristic divides qq, (aX+b)q=aqXq+bq(aX + b)^q = a^q X^q + b^q, and in KK we have h1Xq=h0h_1 X^q = h_0 because II divides h1Xq−h0h_1 X^q - h_0. So h1Yq=aqh0+bqh1h_1 Y^q = a^q h_0 + b^q h_1 and h1Zq=cqh0+dqh1h_1 Z^q = c^q h_0 + d^q h_1 in KK, and multiplying the identity by h1h_1 gives the congruence. If Y−αZ=0Y - \alpha Z = 0 as a polynomial, then (a,b)=α(c,d)(a, b) = \alpha (c, d) and ad−bc=0ad - bc = 0; if Z=0Z = 0, then c=d=0c = d = 0. Both are excluded, so all factors are nonzero, and a factor of degree 00 is a nonzero constant. A nonzero polynomial of degree at most 1<k1 < k is a nonzero element of KK. Also h1≠0h_1 \ne 0 in KK: otherwise I∣h1I \mid h_1, then I∣h0=h1Xq−(h1Xq−h0)I \mid h_0 = h_1 X^q - (h_1 X^q - h_0), against gcd⁡(h0,h1)=1\gcd(h_0, h_1) = 1. So the left side is a product of nonzero elements of the field KK, and it is nonzero; hence so is RmR_m. □\square

The matrices of line L5 have ad−bc≠0ad - bc \ne 0: for (1,b,0,δ)(1, b, 0, \delta) with δ≠0\delta \ne 0 the determinant is δ\delta, and for (1,s+t,i,si+tiq)(1, s + t, i, s i + t i^q) with t≠0t \ne 0 and i∉Fqi \notin \mathbb{F}_q it is t(iq−i)≠0t (i^q - i) \ne 0.

Lemma 3 (relations). Every row (e;v)(e ; v) of RR satisfies ∑βeβL(X+β)≡v(modℓ)\sum_\beta e_\beta L(X + \beta) \equiv v \pmod{\ell}. For every key QQ of EE with E[Q]=(e;v)E[Q] = (e ; v), QQ is a nonzero element of KK and L(Q)≡∑βeβL(X+β)−v(modℓ)L(Q) \equiv \sum_\beta e_\beta L(X + \beta) - v \pmod{\ell}.

Proof. The constants: ω=γN/(q2−1)\omega = \gamma^{N/(q^2-1)} has order q2−1q^2 - 1 and lies in Fq2∗\mathbb{F}_{q^2}^*, the only subgroup of GG of that order, so it generates Fq2∗\mathbb{F}_{q^2}^* and L(ωj)=jN/(q2−1)L(\omega^j) = j N / (q^2 - 1); the table of the implementation holds these values modulo ℓ\ell. Write each factor ff of degree 11 in Lemma 2 as f=u(X+w/u)f = u (X + w/u) with u≠0u \ne 0, so L(f)=L(u)+L(X+w/u)L(f) = L(u) + L(X + w/u), and each constant factor ww has L(w)L(w). Taking LL of the congruence of Lemma 2 gives, modulo NN,

L(ch)+∑βfβL(X+β)+∑fL(f)=L(Rm).L(c_h) + \sum_\beta f_\beta L(X + \beta) + \sum_{f} L(f) = L(R_m).

For a row of line L7, Rm=c0∏(X+β)eβR_m = c_0 \prod (X + \beta)^{e_\beta} as polynomials, so L(Rm)=L(c0)+∑eβL(X+β)L(R_m) = L(c_0) + \sum e_\beta L(X + \beta). Moving the constants to the right gives the row of line L7, which holds modulo NN and so modulo ℓ\ell. For line L8, Rm=c0 Q∏(X+β)eβR_m = c_0 \, Q \prod (X + \beta)^{e_\beta} with QQ monic, irreducible and of degree 22. Since Rm≠0R_m \ne 0 in KK, its factor QQ is nonzero in KK, and L(Rm)=L(c0)+L(Q)+∑eβL(X+β)L(R_m) = L(c_0) + L(Q) + \sum e_\beta L(X + \beta). With (e;v)(e ; v) built as in line L7 from the other factors, this reads L(Q)=∑eβL(X+β)−vL(Q) = \sum e_\beta L(X + \beta) - v. A row of line L10 comes from γm=c∏(X+β)aβ\gamma^m = c \prod (X + \beta)^{a_\beta}, so m=L(c)+∑aβL(X+β)m = L(c) + \sum a_\beta L(X + \beta). □\square

Lemma 4 (SOLVE). Let M=ρeM = \rho^e with ρ\rho prime and M∣NM \mid N. If SOLVE(R,ρ,M)(R, \rho, M) returns a vector λ\lambda, then λβ≡L(X+β)(modM)\lambda_\beta \equiv L(X + \beta) \pmod{M} for every β\beta.

Proof. By Lemma 3 the true vector modulo MM satisfies every row, because M∣ℓM \mid \ell. Lines L18 and L19 swap two rows, multiply a row by a unit modulo MM (an entry not divisible by ρ\rho is coprime to MM), or subtract a multiple of one row from another. Each operation is invertible, so the solution set modulo MM does not change, and the true vector stays a solution. After column jj is processed, row jj has 11 in column jj and every other row has 00 there, and later steps keep this. At the end row jj reads λj≡\lambda_j \equiv its right side, so the returned value is the true one. □\square

Lemma 5 (scale). After line L11, λβ≡L(X+β)(modℓ)\lambda_\beta \equiv L(X + \beta) \pmod{\ell} for every β\beta.

Proof. Line L11 is passed only when every SOLVE succeeded, so Lemma 4 applies to every ρe∥ℓ\rho^e \parallel \ell. The moduli are pairwise coprime, and the Chinese remainder theorem gives a unique residue modulo ℓ\ell with these reductions. □\square

Lemma 6 (individual logarithms). For y∈{g,h}y \in \{g, h\}, the value of line L15 is L(y) mod ℓL(y) \bmod \ell.

Proof. Line L14 is passed only when z=yγm mod Iz = y \gamma^m \bmod I equals c∏(X+β)dβ∏Qiuic \prod (X + \beta)^{d_\beta} \prod Q_i^{u_i} as a polynomial and every QiQ_i is a key of EE. Then, modulo NN, L(y)+m=L(c)+∑dβL(X+β)+∑uiL(Qi)L(y) + m = L(c) + \sum d_\beta L(X + \beta) + \sum u_i L(Q_i). Reducing modulo ℓ\ell, and replacing L(X+β)L(X + \beta) by λβ\lambda_\beta (Lemma 5) and L(Qi)L(Q_i) by ei⋅λ−kie_i \cdot \lambda - k_i (Lemmas 3 and 5), gives line L15. □\square

Lemma 7 (conversion). With c=ℓ/rc = \ell / r, the residue L(g) mod ℓL(g) \bmod \ell is cuc u for an integer uu coprime to rr, the residue L(h) mod ℓL(h) \bmod \ell is divisible by cc, and (L(h)/c) u−1≡x∗(modr)(L(h)/c) \, u^{-1} \equiv x^* \pmod r.

Proof. Since gg has order rr and γ\gamma has order NN, gcd⁡(L(g),N)=N/r\gcd(L(g), N) = N / r. For each prime ρ∣r\rho \mid r with ρa∥r\rho^a \parallel r and ρe∥N\rho^e \parallel N, the ρ\rho-adic valuation of L(g)L(g), taken in [0,N−1][0, N - 1], is exactly e−ae - a, which is the valuation of cc at ρ\rho, and cc has no other prime factors. Reducing modulo ℓ\ell does not change a valuation below ee, so L(g) mod ℓ=cuL(g) \bmod \ell = c u with uu coprime to rr. Next, h=gx∗h = g^{x^*} gives L(h)≡x∗cu(modℓ)L(h) \equiv x^* c u \pmod{\ell}, so L(h)/c≡x∗u(modr)L(h)/c \equiv x^* u \pmod r, and multiplying by u−1u^{-1} gives x∗x^*. □\square

Correctness. By Lemmas 6 and 7, line L17 returns x∗x^*. With Lemma 1, the algorithm returns x∗x^* if h∈⟨g⟩h \in \langle g \rangle and NONE otherwise.

Termination. Lines L5 to L8 run over a finite list. In the loop of lines L9 to L11, for each β\beta the draw m=L(X+β)m = L(X + \beta), which has probability 1/N1/N in each trial, gives z=X+βz = X + \beta and the row with 11 in column β\beta, 00 elsewhere, and right side mm. With probability 11 every column eventually has such a unit row. Once these rows are present, every SOLVE succeeds: the unit row of column jj has 00 in every earlier column, so it is never chosen as a pivot for an earlier column and the clearing steps never change it, since they change only rows with a nonzero entry in the pivot column; a swap at column j′<jj' < j moves it only to a position at least j′j', so it is still available at column jj, where its entry 11 is a unit pivot. The implementation tries SOLVE each time the number of rows reaches a threshold that grows by a fixed amount after each failure, and rows keep being added, so it tries SOLVE infinitely often and the first try after all unit rows are present succeeds. In the loop of lines L13 and L14, the draw m=(N−L(y)) mod Nm = (N - L(y)) \bmod N gives z=1z = 1, which splits with no QiQ_i, so each loop ends with probability 11. Hence the algorithm stops with probability 11. ■\blacksquare

Back to Quasi-polynomial discrete logarithm algorithm