Docsity

Smith Normal Form and Discrete Logarithm Problem, Slides of Linear Algebra

Toggle sidebar
bg1
6.11. THE SMITH NORMAL FORM 235
6.11 The Smith Normal Form
Over a field K, for any matrix A∈Km×n, there exists invertible matrices U∈
GLm(K) and V∈GLn(K) such that UAV is of the form
Ir0
0 0!∈Km×nwith r= rank A.
It classifies matrices up to rank and size, and is sometimes called rank canonical
form.
If one replaces the field Kby a ring R, one can naturally ask what kind of
equivalence relation one obtains when allowing multiplication by invertible matrices
from both sides. It turns out that in the case of principal ideal domains, one obtains
diagonal matrices as in the field case. But the diagonal entries are not just 1’s and
0’s, but are ring elements d1, . . . , dmin{n,m}with d1|d2| ··· | dmin{n,m}, which are
determined by Aup to units in R. This can be seen as the natural extension of the
field case, where “up to unit”, every field element is either 0 or 1, and 1 |1, 1 |0
and 0 |0.
This normal form for R=Zwas first described by Henry J. S. Smith [Smi61].
While it is not very complicated to find an algorithm for computing the so-called
Smith Normal Form, it is challenging to compute it efficiently. In this section, we
rely on another algorithm by A. Storjohann which is rather simple to implement
and which yields good results. The algorithm was first described in [Sto96a].
Let us begin by officially defining the Smith Normal Form. We will define it for
integers assume that all entries are non-negative to make it unique; in general rings,
one can define it analogously by enforcing LU(di) = 1.
Definition 6.11.1. Let A= (aij)ij ∈Zm×n. We say that Ais in Smith Normal
Form if aij = 0 for i6=j, if a11 |a22 | ··· | akk with k= min{n, m}, and if aii ≥0
for all i.
Theorem 6.11.2 (Smith [Smi61]).For every A∈Zm×nthere exist U∈GLm(Z)
and V∈GLn(Z)such that UAV is in Smith Normal Form. Moreover, if U0∈
GLm(Z)and V0∈GLn(Z)such that U0AV 0is also in Smith Normal Form, then
UAV =U0AV 0.
A (constructive) proof of the existence can be found in [Fon11, Satz 2.11.12]. In
fact, this construction works over any principal ideal domain. In the next chapter
we will see how the Smith Normal Form can be used to describe the structure of a
finite abelian group (also compare [Fon11, Abschnitt 2.11]).
Here, we want to cite the following result by Storjohann:
Theorem 6.11.3 (Storjohann; Theorem 10 of [Sto96a]).There exists a determinis-
tic algorithm which, given A∈Zn×m, computes the rank of Atogether with a Smith
normal form in ˜
O(nmr3log3kAk∞)basic b-operations.
We abstain from describing the algorithm in pseudo-code, but instead present a
Python implementation. It relies on a implementation of Algorithm 6.15 and the
HNF Algorithm 6.19 of the previous section, which we assume are provided in the
module hnf.py as follows:
1def Algorithm_6_15(R, a, bi, N):
2"" " I m pl e me n ts A lg o ri t hm 6 .1 5 . We are g iv en :
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21

Partial preview of the text

Download Smith Normal Form and Discrete Logarithm Problem and more Slides Linear Algebra in PDF only on Docsity!

6.11. THE SMITH NORMAL FORM 235

6.11 The Smith Normal Form

Over a field K , for any matrix A ∈ Km × n , there exists invertible matrices U ∈ GL m ( K ) and V ∈ GL n ( K ) such that U AV is of the form ( Ir 0 0 0

) ∈ Km × n^ with r = rank A.

It classifies matrices up to rank and size, and is sometimes called rank canonical form. If one replaces the field K by a ring R , one can naturally ask what kind of equivalence relation one obtains when allowing multiplication by invertible matrices from both sides. It turns out that in the case of principal ideal domains, one obtains diagonal matrices as in the field case. But the diagonal entries are not just 1’s and 0’s, but are ring elements d 1 ,... , d min{ n,m } with d 1 | d 2 | · · · | d min{ n,m }, which are determined by A up to units in R. This can be seen as the natural extension of the field case, where “up to unit”, every field element is either 0 or 1, and 1 | 1, 1 | 0 and 0 | 0. This normal form for R = Z was first described by Henry J. S. Smith [Smi61]. While it is not very complicated to find an algorithm for computing the so-called Smith Normal Form , it is challenging to compute it efficiently. In this section, we rely on another algorithm by A. Storjohann which is rather simple to implement and which yields good results. The algorithm was first described in [Sto96a]. Let us begin by officially defining the Smith Normal Form. We will define it for integers assume that all entries are non-negative to make it unique; in general rings, one can define it analogously by enforcing LU( di ) = 1.

Definition 6.11.1. Let A = ( aij ) ij ∈ Z m × n. We say that A is in Smith Normal Form if aij = 0 for i 6 = j, if a 11 | a 22 | · · · | akk with k = min{ n, m } , and if aii ≥ 0 for all i.

Theorem 6.11.2 (Smith [Smi61]). For every A ∈ Z m × n^ there exist U ∈ GL m (Z) and V ∈ GL n (Z) such that U AV is in Smith Normal Form. Moreover, if U ′^ ∈ GL m (Z) and V ′^ ∈ GL n (Z) such that U ′ AV ′^ is also in Smith Normal Form, then U AV = U ′ AV ′.

A (constructive) proof of the existence can be found in [Fon11, Satz 2.11.12]. In fact, this construction works over any principal ideal domain. In the next chapter we will see how the Smith Normal Form can be used to describe the structure of a finite abelian group (also compare [Fon11, Abschnitt 2.11]). Here, we want to cite the following result by Storjohann:

Theorem 6.11.3 (Storjohann; Theorem 10 of [Sto96a]). There exists a determinis- tic algorithm which, given A ∈ Z n × m, computes the rank of A together with a Smith normal form in O ˜( nmr^3 log^3 ‖ A ‖∞) basic b-operations.

We abstain from describing the algorithm in pseudo-code, but instead present a Python implementation. It relies on a implementation of Algorithm 6.15 and the HNF Algorithm 6.19 of the previous section, which we assume are provided in the module hnf.py as follows:

1 def Algorithm_6_15 (R , a , bi , N ) : 2 """ Implements Algorithm 6.15. We are given :

236 CHAPTER 6. LINEAR ALGEBRA

3 R : an rings. Integers () object ; 4 a : integer ; 5 bi : list of integers ; 6 N : positive integer ( > 1). 7 Returns ci , list of integers , such that 8 gcd (a , bi [0] , ... , bi [n -1] , N ) 9 = gcd ( a + \ sum { i =0}ˆ{ n -1} ci [ i ] * bi [ i ] , N ). """_ 10 ... 11 12 def HNF ( A ) : 13 """ Computes the Hermite Normal Form of A together with a 14 transformation matrix U such that U * A is the returned 15 Hermite Normal Form. Returns U , U *A , and the rank 16 profile of A. """ 17 ...

The Smith Normal Form computation has two subroutines, one for Phase A and one for Phase B. Transformation matrices are computed on the fly.

Phase A We begin with Smith_Theorem5(). As input, it takes an upper triangular matrix A = ( aij ) ij ∈ Z n × m^ together with an index i (called col) such that:

  • the first i − 1 columns of A are in Smith Normal Form;
  • the first i columns of A have rank i , i.e. ajj 6 = 0 for 1 ≤ j ≤ i ;
  • the elements akj , 1 ≤ k < i , i < j ≤ m are in the range [0 , akk ).

This function modifies the matrix such that the conditions hold for i + 1 (except possibly ai +1 ,i +1 6 = 0). Assume that A has the following form:

A =

   

a 11 t 1 ∗ · · · ∗

.. .

ai − 1 ,i − 1 ti − 1

0 aii ∗ · · · ∗

   ^.

In the first step (Lemma 6), the matrix will be modified such that gcd( ajj , tj ) = gcd( ajj , tj ,... , ti − 1 , aii ). After that, we will iteratively apply Lemma 7, which in the first step will ensure that a 11 divides all ajj , 1 ≤ j ≤ i and tj , 1 ≤ j < i. Afterwards, Lemma 7 is applied to the ( n − 1) × ( m − 1) submatrix starting at (2 , 2). Eventually, it will be made sure that aii > 0 and that the elements in row i are reduced modulo aii.

Listing 6.1: Smith Normal Form Computation 1/ 1 import matrix 2 import rings 3 import hnf 4 5 def Smith_Theorem5 (A , U , V , col ) : 6 n = A. rows () 7 m = A. cols () 8 R = A. coefficientRing () 9 # Lemma 6:

238 CHAPTER 6. LINEAR ALGEBRA

65 for jj in xrange ( n ) : 66 U [i , jj ] = -U [i , jj ] 67 # Reduce col - th row modulo A [ col , col ] 68 for j in xrange ( col + 1 , m ) : 69 d , r = divmod ( A [ col , j ] , A [ col , col ]) 70 if d != 0: 71 # Subtract d times the col - th column 72 # from the j - th column 73 A [ col , j ] = r 74 for k in xrange ( m ) : 75 V [k , j ] = V [k , j ] - d * V [k , col ] 76 # Return result 77 return A , U , V

Phase B The next function is Smith_Theorem8(), which operates on the subma- trix A ′^ starting at ( i, i ) of A , where i is the given index (called row). It is assumed that the first r - row columns of A ′^ are already in Smith Normal Form. It transforms A ′^ such that the first row of A ′^ has its only non-zero entry in position 1, and that the submatrix of A ′^ starting at (2 , 2) satisfies the requirements for Smith_Theorem8(). The resulting matrix A ′^ might have non-zero entries in the first column. Thus, re- peatedly applying this function to the submatrices of A starting at ( i, i ), 1 ≤ i ≤ r , will yield a matrix

( A ˜ 0 0 0

) where A ˜ is lower triangular and invertible.

Listing 6.2: Smith Normal Form Computation 2/ 78 def Smith_Theorem8 (A , U , V , row , r ) : 79 n = A. rows () 80 m = A. cols () 81 R = A. coefficientRing () 82 83 for j in xrange (r , m ) : 84 if A [ row , j ] != 0: 85 s1 , s , t = R. extendedGCD ( A [ row , row ] , A [ row , j ]) 86 ss = -A [ row , j ] / s 87 tt = A [ row , row ] / s 88 # Transform columns row and j by a 2 x2 matrix 89 A [ row , row ] = s 90 A [ row , j ] = 0 91 for i in xrange ( row + 1 , n ) : 92 A [i , row ] , A [i , j ] = s * A [i , row ] + t * A [i , j ] , 93 ss * A [i , row ] + tt * A [i , j ] 94 for i in xrange ( m ) : 95 V [i , row ] , V [i , j ] = s * V [i , row ] + t * V [i , j ] , 96 ss * V [i , row ] + tt * V [i , j ] 97 # Reduce column row 98 for i in xrange ( row + 1 , n ) : 99 d , r = divmod ( A [i , row ] , A [ row , row ]) 100 if d != 0: 101 for jj in xrange ( m ) : 102 A [i , jj ] = A [i , jj ] - d * A [ row , jj ] 103 for jj in xrange ( n ) : 104 U [i , jj ] = U [i , jj ] - d * U [ row , jj ] 105 # Reduce column row 106 for i in xrange ( row + 1 , n ) :

6.11. THE SMITH NORMAL FORM 239

107 d , r = divmod ( A [i , row ] , A [ row , row ]) 108 if d != 0: 109 for jj in xrange ( m ) : 110 A [i , jj ] = A [i , jj ] - d * A [ row , jj ] 111 for jj in xrange ( n ) : 112 U [i , jj ] = U [i , jj ] - d * U [ row , jj ] 113 114 return A , U , V

Main Part Finally, we present the main part of the algorithm. It first computes a Hermite Normal Form of the matrix, rearranges the columns such that the upper left r × r submatrix is invertible, and then uses the two functions Smith_Theorem5() and Smith_Theorem8() to transform the HNF into the Smith Normal Form:

Listing 6.3: Smith Normal Form Computation 3/

115 def Smith ( A ) : 116 """ Computes matrix U and V such that U * A * V is in Smith 117 Normal Form. Returns U , V and the list of non - zero 118 diagonal entries of the Smith Normal Form. """ 119 # Read out info 120 n = A. rows () 121 m = A. cols () 122 R = A. coefficientRing () 123 # Transform to Hermite Normal Form. A will now be in HNF 124 # and we can modify it without changing the original A. 125 U , A , rp = hnf. HNF ( A ) 126 r = len ( rp ) 127 # Create V 128 V = matrix. createIdentityMatrix (R , m ) 129 # Transform A via V so that the left r x r block of A is 130 # invertible 131 for i in xrange ( r ) : 132 if rp [ i ] > i : 133 A. swap_cols (i , rp [ i ]) 134 V. swap_cols (i , rp [ i ]) 135 # Phase One 136 for i in xrange ( r ) : 137 A , U , V = Smith_Theorem5 (A , U , V , i ) 138 # Search where something not equal to 1 begins 139 beg = 0 140 while beg < r and A [ beg , beg ] == 1: 141 beg += 1 142 # Phase Two 143 if beg < r and r < m : 144 for i in xrange ( beg , r ) : 145 A , U , V = Smith_Theorem8 (A , U , V , i , r ) 146 # Run transposed Phase One 147 AA = A. submatrix ( beg , beg , r - beg , r - beg ). transpose () 148 UU = matrix. createIdentityMatrix (R , r - beg ) 149 VV = matrix. createIdentityMatrix (R , r - beg ) 150 for i in xrange ( r - beg ) : 151 AA , UU , VV = Smith_Theorem5 ( AA , UU , VV , i ) 152 # Insert AA 153 AA = AA. transpose ()

6.11. THE SMITH NORMAL FORM 241

The next three applications yield

A 4 =

    

    

A 5 =

    

    

and A 6 =

     

     

Now A 6 is of the form

( Ik 0 0 0 L 0 0 0 0

) , where k = 2 yields an 2 × 2 identity matrix and

L =

  

  

is invertible and lower triangular. We now apply the operations from Phase A to LT^. In the first step, namely calling Smith_Theorem5() with i = 1, yields

LT 1 =

  

   ,

whose first row is now reduced modulo 2. Applying Smith_Theorem5() with i = 2, i = 3 and finally i = 4 yields

LT 2 =

  

   , LT 3 =

  

   and^ LT 4 =

  

  .

Plugging L 4 back into A 6 yields

A 7 =

    

    

242 CHAPTER 6. LINEAR ALGEBRA

with diagonal entries (1 , 1 , 1 , 1 , 4 , 24). The transformation matrices U ∈ GL 6 (Z) and V ∈ GL 9 (Z) with U AV = A 7 computed by the algorithm are

U =

    

    

and

V =

        

        

244 CHAPTER 7. FINITE GROUPS

The main idea of Sutherland’s algorithm is to first remove all “small” prime factors from ord( g ); by replacing g by g ′^ := gp k for a large enough k (namely such that k log p ≥ log ord( g )), one makes sure that ord( g ′) is not divisible by p. This is first done for a very large number of small primes, and then the remainder of the possible values of ord( g ) are excluded using a baby-step giant-step type algorithm. We will not describe the algorithm here any further, but refer to [Sut07] for a detailed description. Terr’s order computation algorithm is based on the following fact:

Lemma 7.1.1. For every natural number n > 0 , there exists unique natural num- bers a, b ∈ N such that a > 0 and 0 ≤ b < a and n = 12 a ( a + 1) − b = ∑ a i =1 i^ −^ b.

Proof. First note that if a = 1 and b = 0, then

∑ a i =1 i^ −^ b^ = 1. Therefore, assume that n > 1. This is clear since

∑ a i =1 i^ −^

∑ a − 1 ∑ a − 1^ i =1^ i^ =^ a , whence every number^ n^ with i =1 i^ ≤^ n <^

∑ a i =1 i^ can be written as^

∑ a − 1 i =1 i^ + ˆ b^ with 0^ <^ ˆ b^ ≤^ a. Set^ b^ :=^ a^ −^ ˆ b ; then 0 ≤ b < a and n =

∑ a i =1 i^ −^ b^ =^ 1 2 a ( a^ + 1)^ −^ b. The idea is now to search for ord( g ) in ( 12 a ( a − 1) ,^12 a ( a + 1)] for a = 1 , 2 , 3 ,.... For this, we compute g^0 , g^1 , g^2 ,... , ga −^1 and compare these to ga ( a +1) /^2. Using that ga ( a +1) /^2 = gb^ with 0 ≤ b < a is equivalent to ga ( a +1) /^2 − b^ = 1 G and thus to ord( g ) |

( (^1) 2 a ( a^ + 1)^ −^ b

) , we can find ord( g ) in case a is minimal under this condition. This is visualized in the following picture. When testing whether ga ( a +1) /^2 is contained in g^0 ,... , ga −^1 , the following areas are searched for (multiples of) ord( g ):

ord(=1 g ) ord(=2 g ) ord(=3 g ) ord(=4 g ) ord(=5 g ) ord(=6 g ) ord(=7 g ) ord(=8 g ) ord(=9 g ) ord(=10 g )

a = 1 a = 2 a = 3 a = 4

Note that our description of the algorithm is the one in [BS05, Section 2].

Input: g ∈ G Output: ord( g )

  1. Set baby 1 := g and giant 1 := g ;
  2. Set L 1 = {(1 G, 0)} and i = 1;
  3. Repeat:

(a) If ( gianti, j ) ∈ Li for some j , return 12 i ( i + 1) − j ; (b) Set Li +1 = Li ∪ {( babyi, i )}. (c) Compute babyi +1 := babyi · g ; (d) Compute gianti +1 := gianti · babyi +1; (e) Set i := i + 1;

Algorithm 7.1: Order Computation

Theorem 7.1.2. Algorithm 7.1 is correct and needs less than 2

√ ord( g ) group op- erations without any inversion. In case lookup and insertion in a set of size n can be done in f ( n ) operations, where f is increasing and sublinear, the total time for lookups is O (

√ ord( g ) f (

√ ord( g ))).

7.2. THE DISCRETE LOGARITHM PROBLEM 245

If we use a balanced binary search tree (compare Section 4.2.2), lookup and insertion can be done in f ∈ O (log n ) operations. In case we use Python’s dict data structure, which is based on hash tables, accessing and insertion are essentially (amortized) constant time, i.e. f ∈ O (1).

Proof. First, note that babyi = gi^ and gianti = gi ( i +1) /^2 : for i = 1 this is clear, and the equality for arbitrary i follows by induction since babyi +1 = babyi · g = gi · g = gi + and gianti +1 = gianti · babyi +1 = gi ( i +1) /^2 · gi +1^ = gi ( i +1) / 2+( i +1)^ = g ( i +1)( i +2) /^2. This implies that Li = {( gj^ , j ) | 0 ≤ j < i }. Therefore, ( gianti, j ) is found in Li if and only if gi ( i +1) /^2 − j^ = 1 G for 0 ≤ j < i. Since we return at the first occurrence, i is minimal, whence ord( g ) = i ( i + 1) / 2 − j. This shows that the algorithm is correct. Concerning the running time, note that in every loop iteration, two group op- erations are done. Therefore, if ( gianti, j ) ∈ Li is found, 2( i − 1) group oper- ations were performed up to that point, and

∑ i k =1 O ( f^ ( k ))^ ⊆^ O ( if^ ( i )) opera- tions for the lookup. Now if ord( g ) = i ( i + 1) / 2 − j with 0 ≤ j < i , then i^2 − i < 2 ord( g ) ≤ i^2 + i. This is equivalent to i <

√ ord( g ) + 1 / 4 + 1 / 2 ≤ i + 1,

whence i <

√ ord( g ) + 1 / 4 + 1 / 2 ≤

√ ord( g ) +

√ 5 − 1 2 as^ x^^7 →^

√ x + 1 / 4 + 1 / 2 −

x

is decreasing and

√ 1 + 1 / 4 + 1 / 2 −

√ 5 − 1

Therefore, the total number of group operations 2( i − 1) satisfies 2( i − 1) < 2(

√ ord( g ) +

√ 5 − 3 2 )^ <^^2

√ ord( g ), and the time needed for the table lookups is O ( if ( i )) ⊆ O (

√ ord( g ) f (

√ ord( g ))) = O (

√ ord( g ) f (

√ ord( g ))).

7.2 The Discrete Logarithm Problem

The Discrete Logarithm Problem (DLP) states that given two group elements g, h with h ∈ 〈 g 〉, find some n ≥ 0 with gn^ = h. (Sometimes this definition is also extended to test whether h ∈ 〈 g 〉.) It was shown by Victor Shoup [Sho97] that there cannot be an algorithm which solves the DLP in o (

√ ord( g )) group operations in case ord( g ) is prime for a generic group G. On the other hand, in case ord( g ) is not prime (and its factorization is known), one can reduce the DLP to several smaller DLPs using the Pohlig-Hellman method [PH78]. Two algorithms which can solve the DLP in O (

√ ord( g )) operations – which is thus optimal for prime ord( g ) – are Pollard’s % algorithm and Shanks’ Baby-Step Giant-Step algorithm. Let us first sketch Shanks’ algorithm. It works by covering 〈 g 〉 by translates of the baby set { g − ih | 0 ≤ i < b }, where b ≈

√ ord( g ). For this, one computes the giant steps gbj^ , 0 ≤ j < B where B ≈

√ ord( g ) such that bB ≥ ord( g ), and tests whether gbj^ lies in the baby set. If it does, then gbj^ = g − ih , whence gbj + i^ = h. The following picture visualizes this search for gbj^ = hg − i^ with b = 3:

h = g^0 h = g^1 h = g^2 h = g^3 h = g^4 h = g^5 h = g^6 h = g^7 h = g^8 h = g^9 h = g^10 h = g^11

j = 0 j = 1 j = 2 j = 3

Now let us reformulate Terr’s modification of Shanks’ algorithm to the DLP setting. For that, note that instead of gi ( i +1) /^2 − j^ = 1 G with 0 ≤ j < i , we want to

7.3. COMPUTING THE STRUCTURE OF A FINITE ABELIAN GROUP 247

7.3.1 Structure of a Generated Subgroup

Assume that G is abelian and that we are given g 1 ,... , gn. We first want to inves- tigate how to compute the structure of the subgroup 〈 g 1 ,... , gn 〉 of G. For that, we consider the homomorphism

ϕ : Z n^ → G, ( e 1 ,... , en ) 7 →

∏^ n

i =

g ie i.

(For this being a homomorphism, we need that 〈 g 1 ,... , gn 〉 is abelian.) We have that the image of ϕ is precisely 〈 g 1 ,... , gn 〉, and if Λ := ker ϕ , then by the Homomorphism Theorem, Z n/ Λ ∼= 〈 g 1 ,... , gn 〉. Note that Λ is a free Z-module, whence there exists a Z-basis v 1 ,... , vk of Λ: thus, every λ ∈ Λ can be written in a unique way as λ = ∑ k i =1 λivi^ with^ λi^ ∈^ Z. As Z n/ Λ ∼= 〈 g 1 ,... , gn 〉 is finite, it must be that k = n. (Note that Λ is also called a sublattice of Z n^ of full rank .) Write v 1 ,... , vn into the columns of the matrix A ∈ Z n × n. Then Λ = { Aw | w ∈ Z n }. If we now have two matrices U, V ∈ GL n (Z) such that

U AV =

  

d 1 0

... 0 dn

  

with integers d 1 | d 2 | · · · | dn – that is, if U AV is in Smith Normal Form –, then

Λ = { U −^1 U AV V −^1 w | w ∈ Z n } =

{ U −^1

( (^) d 1 0

... 0 dn

) w

∣∣ ∣∣ w ∈ Z n

} .

This shows that if U −^1 = ( w 1 ,... , wn ) with wi ∈ Z n ×^1 , then diwi , 1 ≤ i ≤ n is another basis of Λ and

Z n/ Λ ∼=

∏^ n i =

Z /di Z_._

In particular, the group element (0 ,... , 0 , 1 , 0 ,... , 0) ∈

∏ n i =1 Z /di Z^ with the 1 in the i -th position corresponds to ϕ ( wi ) ∈ 〈 g 1 ,... , gn 〉. Therefore, we obtain both the structure of 〈 g 1 ,... , gn 〉 as well as a nice “basis” of this subgroup. In the following, we want to describe an algorithm by Arthur Schmidt and Jo- hannes Buchmann [Sch02, BS05] which computes such a matrix A ; combining it with Section 6.11, we obtain an algorithm which thus computes the structure of 〈 g 1 ,... , gn 〉. This algorithm is based on Terr’s order computation method. Note that there also exist other algorithms, for example the one by Edlyn Teske based on Pollard’s % [Tes98], and another one in case | G | is known and smooth, which uses the idea of the Pohlig-Hellman method [Tes99]. This can also be combined with another algorithm by A. Sutherland to compute the structure of abelian p -groups [Sut11]. The basic idea by Schmidt and Buchmann is to compute directly a (modified) Hermite Normal Form of A. Note that the columns of the Hermite Normal Form have a special interpretation in this setting:

Lemma 7.3.1. Let A = ( aij ) ij ∈ Z n^ be such that ( an − j,n − i ) ij is in Hermite Normal Form. (In particular, A is upper triangular.) Then ker ϕ = A if and only if the following conditions are satisfied:

248 CHAPTER 7. FINITE GROUPS

(i) rank A = n (or equivalently det A > 0 );

(ii) aii = ord( gi + 〈 g 1 ,... , gi − 1 〉) in 〈 g 1 ,... , gi 〉 / 〈 g 1 ,... , gi − 1 〉 ⊆ G/ 〈 g 1 ,... , gi − 1 〉 ;

(iii) g ia ii = ∏ i − 1 j =1 g

− aji j.

Remark 7.3.2. Note that in case all conditions of the lemma are satisfied except that ( an − j,n − i ) ij is not completely in Hermite Normal Form in the sense that the entries above the diagonal elements might not be reduced modulo the diagonal elements, one can easily transform the matrix to satisfy also this condition. Namely, for i = n − 1 , n − 2 ,... , 1 , one uses the relation ga i ii =

∏ i − 1 j =1 g

− aji j to reduce the coefficients aik, i < k ≤ n modulo aii. This might change the coeffi- cients ajk, 1 ≤ j < i < k ≤ n, but these will be reduced later for the corresponding values of i.

This lemma shows that we essentially can compute orders in quotients of G to obtain the structure of G. Unfortunately, we cannot directly apply Algorithm 7.1. The main problem is how to uniquely represent elements in these quotients. The algorithm by Schmidt and Buchmann avoids this by extending Terr’s baby- step giant-step search for ord( gi +〈 g 1 ,... , gi − 1 〉) with a classical baby-step giant-step search in H = 〈 g 1 ,... , gi − 1 〉. More precisely, the set H is split up into two sets H 1 and H 2 with | H 1 | , | H 2 | ≈ | H | such that every element h ∈ H can be written as h 1 h 2 with hi ∈ Hi. Then instead of looking for giante in babySete , we look for h 2 · giante in

⋃ h 1 ∈ H 1 ( h^1 ·^ babySete ), where^ h^2 ranges over all elements of^ H^2.^ Therefore, we do ≈ | H | lookups per iteration instead of one lookup, and extend the size of the lookup table by a factor of ≈ | H |. By noting that

⋃ h 1 ∈ H 1 ( h^1 ·^ babySete +1) can be obtained from ⋃ h 1 ∈ H 1 ( h^1 ·^ babySete ) in^ ≈ | H |^ operations, we see that the running time to compute ord( gi + 〈 g 1 ,... , gi − 1 〉) is approximately

√ ord( gi + 〈 g 1 ,... , gi − 1 〉) ·

√ | H |.

The exact algorithm is described and analyzed in the following proposition:

Proposition 7.3.3. Let k > 1_. Assume that we already computed aij for_ 1 ≤ j < k and 1 ≤ i ≤ j. Let m ∈ { 1 ,... , k − 1 }. Let I 1 , I 2 such that I 1 ∪ I 2 ∪ { m } = { 1 ,... , k − 1 } is a disjoint union. Define

H 1 =

{( ∏

i ∈ I 1

g i − xi,

∑

i ∈ I 1

xiei

) ∣∣ ∣∣ 0 ≤ xi < aii for i ∈ I 1

} ,

H 2 =

{( ∏

i ∈ I 2

g ix i,

∑

i ∈ I 2

xiei

) ∣∣ ∣∣ 0 ≤ xi < aii for i ∈ I 2

} ,

H = 〈 g 1 ,... , gk − 1 〉

=

{ (^) ∏

i ∈{ 1 ,...,k − 1 }

g ixi

∣∣ ∣∣ 0 ≤ xi < aii for i ∈ { 1 ,... , k − 1 }

}

and the two quantities

s =

⌈ √ | H | | H 1 |

⌉

⌈√ amm

∏ ∏^ i ∈ I^2 aii i ∈ I 1 aii

⌉ and t =

⌈ √ | H | | H 2 |

⌉

⌈√ amm

∏ ∏^ i ∈ I^1 aii i ∈ I 2 aii

⌉ .

250 CHAPTER 7. FINITE GROUPS

g 10 g^12 g^01 g^22 g^01 g^32 g^01 g^42 g^01 g^52 g^01 g^62 g^01 g 27 g^01 g^82 g^01 g^92 g^01 g^102

g 11 g^12 g^11 g^22 g^11 g^32 g^11 g^42 g^11 g^52 g^11 g^62 g^11 g 27 g^11 g^82 g^11 g^92 g^11 g^102

g 12 g^12 g^21 g^22 g^21 g^32 g^21 g^42 g^21 g^52 g^21 g^62 g^21 g 27 g^21 g^82 g^21 g^92 g^21 g^102

g 13 g^12 g^31 g^22 g^31 g^32 g^31 g^42 g^31 g^52 g^31 g^62 g^31 g 27 g^31 g^82 g^31 g^92 g^31 g^102

g 14 g^12 g^41 g^22 g^41 g^32 g^41 g^42 g^41 g^52 g^41 g^62 g^41 g 27 g^41 g^82 g^41 g^92 g^41 g^102

g 15 g^12 g^51 g^22 g^51 g^32 g^51 g^42 g^51 g^52 g^51 g^62 g^51 g 27 g^51 g^82 g^51 g^92 g^51 g^102

g 16 g^12 g^61 g^22 g^61 g^32 g^61 g^42 g^61 g^52 g^61 g^62 g^61 g 27 g^61 g^82 g^61 g^92 g^61 g^102

g 17 g^12 g^71 g^22 g^71 g^32 g^71 g^42 g^71 g^52 g^71 g^62 g^71 g 27 g^71 g^82 g^71 g^92 g^71 g^102

g 18 g^12 g^81 g^22 g^81 g^32 g^81 g^42 g^81 g^52 g^81 g^62 g^81 g 27 g^81 g^82 g^81 g^92 g^81 g^102

e = 1 e = 2 e = 3 e = 4

giantElt 1

giantElt 2

giantElt 3

Proof of Proposition 7.3.3. We show several claims to prove this result.

  1. Claim: For every h ∈ H , there exist ( hi, vi ) ∈ Hi , 1 ≤ i ≤ 2 and q ∈ { 0 ,... , t − 1 } and r ∈ { 0 ,... , s − 1 } such that h = h − 1 1 h 2 gqsm + r.

Let h =

∑ k − 1 i =1 g

xi i with 0^ ≤^ xi^ < bii. Set^ hi^ =^

∏ j ∈ Ii g

− xj j ,^ vi^ =^

∑ j ∈ Ii e

xj j for i = 1 , 2. Then h = h − 1 1 h 2 g mxm. Now write xm = qs + r with q, r ∈ N such that 0 ≤ r < s ; we have to show that q < t. If this would not be the case, then

xm ≥ ts ≥

√ amm

∏ ∏^ i ∈ I^2 aii i ∈ I 1 aii

√ amm

∏ ∏^ i ∈ I^1 aii i ∈ I 2 aii

= amm,

contradicting xm < amm. Therefore, the claim is true.

  1. Claim: We have

babye = gek,

giante = g

1 2 e ( e +1) k and babySete =

{ ( h 1 g − mr gkx , v + rem − xek )

∣∣ ∣∣^ ( h^1 , v )^ ∈^ H^1 , 0 ≤ r < s, 0 ≤ x < e

} .

The claims about babye and giante follow as in the proof of Theorem 7.1.2. The claim on babySete follows from babySete =

⋃ e − 1 x =0{( hg x k , v^ −^ xek )^ |^ ( h, v )^ ∈ auxBabySet }.

  1. Let H ˜ = 〈 g 1 ,... , gk 〉; then H/H ˜ is cyclic, generated by gk + H , and its order equals the sought akk. Let π 1 : H ˜ → H/H ˜ be the canonical map and π 2 :

7.3. COMPUTING THE STRUCTURE OF A FINITE ABELIAN GROUP 251

Z k^ → Z, ( x 1 ,... , xk ) 7 → xk the k -th projection. Let π : H ˜ × Z k^ → H/H ˜ × Z, ( h, v ) 7 → ( π 1 ( h ) , π 2 ( v )) be the product map. Claim: Then

π 1 ( babye ) = π 1 ( gk ) e,

π 1 ( giante ) = π 1 ( gk )

1 2 e ( e +1)^ and

π ( babySete ) =

{ ( π 1 ( gk ) x, − x )

∣∣ ∣ 0 ≤ x < e

} .

Moreover, there exist ( g, v ) ∈ giantSet and w ∈ Z k^ with ( g · giante, w ) ∈ babySete if and only if there exists some ˜ w ∈ Z with ( π 1 ( giante ) , w ˜) ∈ π ( babySete ). If this is the case, ˜ w = π 2 ( w ).

The claims on babye and giante are clear since π 1 is a homomorphism. For the claim on babySete , note that π 1 ( h ) = H for every h ∈ H ; therefore, π 1 ( h 1 g − mr gxk ) = π 1 ( h 1 g − mr ) π 1 ( gk ) x^ = π 1 ( gk ) x. Moreover, π 2 ( v + rem − xek ) = x. Now assume that ( g, v ) ∈ giantSet and w ∈ Z k^ with ( g · giante, w ) ∈ babySete. By the definition of giantSet , g ∈ H , whence π 1 ( g · giante ) = π 1 ( giante ). Therefore, by definition

( π 1 ( giante ) , π 2 ( w )) = π (( g · giante, w )) ∈ π ( babySete ).

For the other implication, assume that ( π 1 ( giante ) , w ˜) ∈ π ( babySete ) for some w ˜ ∈ Z. This shows that π 1 ( gk ) e ( e +1) /^2 = π 1 ( gk )−^ w ˜^ for some − w ˜ ∈ { 0 ,... , e − 1 }; in particular, π 1 ( gke ( e +1) / 2+ ˜ w ) = H , whence g − k e ( e +1) /^2 −^ w ˜∈ H. By Claim 1, we can write g − k e ( e +1) /^2 −^ w ˜ = h − 1 1 h 2 gqsm + r with ( h 1 , v 1 ) ∈ H 1 , ( h 2 , v 2 ) ∈ H 2 , 0 ≤ q < t and 0 ≤ r < s. Now ( h 1 gm − r gk −^ w ˜ , v 1 + rem + ˜ wek ) ∈ babySete and ( h 2 gmqs , v 2 + qsem ) ∈ giantSet , and

h 2 gqsm · giante = h 2 gqsm g ke ( e +1) /^2 ︸ ︷︷ ︸ = h 1 h − 2 1 g − mqs − rg − k^ w ˜

= h 1 g − mr gk −^ w ˜

is the first component of an element of babySete. Finally, π 2 ( v 1 + rem + ˜ wek ) = w ˜.

  1. Claim: The loop terminates, and when it does, v + w + 12 e ( e + 1) ek is the correct k -th column of A , except possibly that the condition amk ≥ amm is violated (which is no problem by Remark 7.3.2). Moreover, up termination, e <

√ akk + 1 / 4 + 1 / 2 ≤ e + 1. In particular, e ≤

akk +

√ 5 − 1

Claim 3 shows that all arguments from the proof of Theorem 7.1.2 apply to this algorithm as well. Therefore, it is clear that the algorithm terminates, that ord( gk + H ) = akk and that the bounds on e hold. We are left to show that g kakk =

∏ k − 1 j =1 g

− ajk j and 0^ ≤^ ajk^ < ajj^ for^ j^^6 =^ m. Now if ( g · g ke ( e +1) /^2 , w ) ∈ babySete with ( g, v ) ∈ giantSet , then g = ∏ i ∈ I 2 g

xi i · gqsm and v =

∑ i ∈ I 2 xiei^ +^ qsem^ with 0^ ≤^ xi^ < aii ,^ i^ ∈^ I^2 and 0^ ≤^ q < t , and g · ge k ( e +1) /^2 = ∏ i ∈ I 1 g

− xi i · g

− r m g

xk k ,^ w^ =^

∑ i ∈ I 1 xiei^ + rem^ − xkek^ with 0^ ≤^ xi^ < aii , i ∈ I 1 and 0 ≤ xk < e and 0 ≤ r < s.

7.3. COMPUTING THE STRUCTURE OF A FINITE ABELIAN GROUP 253

Lemma 7.3.4. Let b 11 ,... , bk − 1 ,k − 1 ∈ N > 0 for k > 1_. Then there exist_ { m } , I 1 , I 2 ⊆ { 1 ,... , k − 1 } such that the union I 1 ∪ I 2 ∪ { m } = { 1 ,... , k − 1 } is disjoint with

∏

i ∈ I 1

bii,

∏

i ∈ I 2

bii ≤

√√ √√ k ∏−^1

i =

bii.

Moreover, for such choices of m, I 1 , I 2 , computing H 1 , H 2 , auxBabySet and giantSet can be done in less than 4

√ | H | group operations.

Proof. First, fill I 1 and I 2 with random elements such that

I 1 ∩ I 2 = ∅ and

∏

i ∈ I 1

bii,

∏

i ∈ I 2

bii ≤

√√ √√ k ∏−^1

i =

bii

are true, and will be wrong if any more element is added if any such element is available. We claim that | I 1 | + | I 2 | ≥ k − 2. In case it equals k − 1, one can take m as any element of I 1 or I 2 and remove that element from there; in case it equals k − 2, we take m as the unique missing element. Assume that there are two distinct elements m 1 , m 2 ∈ { 1 ,... , k − 1 } \ ( I 1 ∪ I 2 ). Assume that bm 1 m 1 ≤ bm 2 m 2 , and assume that

∏ i ∈ I 1 bii^ ≤^

∏ i ∈ I 2 bii. We claim that

then bm 1 m 1 ·

∏ i ∈ I 1 bii^ ≤

√∏ k − 1 i =1 bii.^ Otherwise, we would have^ bm 1 m 1 ·^

∏ √^ i ∈ I^1 bii^ > ∏ k − 1 i =1 bii , and therefore also^ bm 2 m 2 ·^

∏ i ∈ I 2 bii^ >

√∏ k − 1 i =1 bii. This yields

k ∏− 1

i =

bii ≥ bm 1 m 1 ·

∏

i ∈ I 1

bii · bm 2 m 2 ·

∏

i ∈ I 2

bii >

√√ √√ k ∏−^1

i =

bii

2

k ∏− 1

i =

bii,

a contradiction. Now assume that I 1 and I 2 and m are chosen as specified. From the proof of Proposition 7.3.3 (Claim 5) we see that | auxBabySet | , | giantSet | < 2

√ | H |. Now note that the group elements appearing in H 1 and H 2 are also group elements appearing in auxBabySet and giantSet , respectively. Therefore, using a grid (see below), one can compute all four sets in (| auxBabySet | − 1) + (| giantSet | − 1) group operations.

The following picture shows how such a grid can be used to compute g 1 igj 2 for 0 ≤ i < 6, 0 ≤ j < 3 in 6 · 3 − 1 group operations:

g^01 g^02 g^11 g 20 g^21 g^02 g^31 g^02 g^41 g 20 g 15 g^02

g^01 g^12 g^11 g 21 g^21 g^12 g^31 g^12 g^41 g 21 g 15 g^12

g^01 g^22 g^11 g 22 g^21 g^22 g^31 g^22 g^41 g 22 g 15 g^22

Note that g^01 g 20 = eG is the neutral element of G ; therefore, no computation has to be done for this element. Each other element can be obtained by one group operation, which is indicated by an arrow. The arrows to the right multiply with g 1 , and the arrows up multiply with g 2. The following corollary describes how to combine the above steps into one algo- rithm and determines the number of operations needed for computing the structure of the subgroup 〈 g 1 ,... , gn 〉:

254 CHAPTER 7. FINITE GROUPS

Corollary 7.3.5 (A. Schmidt, J. Buchmann [BS05]). There exists an algorithm which computes the structure of the subgroup G ˆ := 〈 g 1 ,... , gn 〉 in

O

( n

√ | G ˆ|

)

group operations and

O

( n

√ | G ˆ| · log | G ˆ|

)

operations for lookup. The algorithm stores

O

(√ | G ˆ|

)

group elements and integer vectors from Z n^ with entries of size O (log | G |) in mem- ory. The post-processing step can be done in O ˜( n^5 log^3 | G ˆ|) basic b-operations.

Proof. First note that | G ˆ| =

∏ n i =1 aii. To compute^ a^11 , we use Algorithm 7.1. By Theorem 7.1.2, this requires less than 2

a 11 group operations, and the number of operations for lookup and insertion are in O (

a 11 f (

a 11 )). By Proposition 7.3.3 and Lemma 7.3.4, a • k can be computed in O

(√∏ k i =1 aii

)

group operations and O

(√∏ k i =1 aii^ ·^ f

(√∏ k i =1 aii

)) operations for lookup. Using balanced binary trees yields f ( x ) ∈ O (log x ), which combined with the rest yields the claim.

Note that the algorithm can be sped up by re-using the lookup tables H 1 , H 2 , auxBabySet and giantSet whenever possible. This is described in more detail in [BS05, Algorithm 2].

7.3.2 Generating the Whole Group

In case we are given g 1 ,... , gn with G = 〈 g 1 ,... , gn 〉, we can use the algorithms from the previous section to compute the structure of G. But what if the following situation appears: we do not have generators for G , but instead a sampling method which samples (essentially) uniformly at random an element from G. One can modify the algorithms that we can iteratively add new generators. We now want to discuss two questions:

  • How many generators do we have to expect?
  • When do we know that we are done?

When are we done? Let us first consider the second question. Assume that we already have 〈 g 1 ,... , gn 〉, and that we sample a new element gn +1. Now the probability that gn +1 ∈ 〈 g 1 ,... , gn 〉 is

| G | |〈 g 1 ,... , gn 〉|

by Lagrange in case 〈 g 1 ,... , gn 〉 $ G , and 1 in case 〈 g 1 ,... , gn 〉 = G. Thus, if we sample several elements and all turn out to be already in the subgroup generated by the previous elements, we are done with a certain probability (namely at least 1 − 2 − k , if we sampled k elements which do all belong to the previous subgroup).