the lll algorithm
play

The LLL Algorithm Phong Nguy n http://www.di.ens.fr/~pnguyen May - PowerPoint PPT Presentation

The LLL Algorithm Phong Nguy n http://www.di.ens.fr/~pnguyen May 2010, Luminy 1982 L. Lovsz A. Lenstra H. Lenstra 3 What is LLL or L ? The LLL Algorithm A popular algorithm presented in a legendary article published in 1982:


  1. Algorithmic Problems There are two parameters: The size of basis coefficients The lattice dimension Two cases Fixed dimension, the size of coeffs increases. The dimension increases, and the size of coeffs is polynomial in the dimension.

  2. Lattices and Complexity Since 1996, lattices are very trendy in complexity: classical and quantum. Depending on the approximation factor with respect to the dimension: 1 NP-hardness O(1) non NP-hardness (NP ∩ co-NP) √ n worst-case/average-case reduction O(n logn) polynomial-time algorithms 2 O(n log log n/logn) ∞

  3. The Shortest Vector Problem (SVP) Input: a basis of a d-dim lattice L Output: nonzero v ∈ L minimizing ||v||. The minimal norm is ||L||. 2 0 0 0 0 0 2 0 0 0 0 0 2 0 0 O 0 0 0 2 0 1 1 1 1 1

  4. The Algorithm of [Lenstra-Lenstra- Lovász1982]: LLL or L ³ Given an integer lattice L of dim d, LLL finds in polynomial time a basis whose first vector satisfies: � b 1 � ≤ 2 ( d − 1 ) / 2 � L � � b 1 � ≤ 2 ( d − 1 ) / 4 vol ( L ) 1 / d � � The constant 2 can be replaced by 4/3+ ε .fand the running time becomes polynomial in 1/ ε . This is reminiscent of Hermite’ s inequality: γ d ≤ ( 4 / 3 ) ( d − 1 ) / 2 = ( γ 2 ) d − 1

  5. The Magic of LLL One of the main reasons behind the popularity of LLL is that it performs “much better” than what the worst- case bounds suggest, especially in low dimension. This is another example of worst-case vs. “average-case”.

  6. LLL: Theory vs Practice The approx factors (4/3+ ε ) (d-1)/ 4 and (4/3+ ε ) (d-1)/2 are tight in the worst case: but this is only for worst-case bases of certain lattices. Experimentally, 4/3+ ε ≈ 1.33 can be replaced by a smaller constant ≈ 1.08, for any lattice, by randomizing the input basis. But there is no good explanation for this phenomenon, and no known formula for the experimental constant ≈ 1.08.

  7. To summarize LLL performs better in practice than predicted by theory, but not that much better: the approximation factors remain exponential on the average and in the worst-case, except with smaller constants. Still no good explanation.

  8. Illustration 65536 LLL bound theoretical worst-case bound 16384 4096 1024 Hermite Factor 256 64 16 4 experimental value 1 0.25 0 20 40 60 80 100 120 140 160 dimension Log(Hermite Factor)

  9. Other unexplained phenomenon In small dimension, LLL behaves as a randomized exact SVP algorithm! 100 LLL 90 80 70 60 success rate 50 40 30 20 10 0 0 5 10 15 20 25 30 35 40 45 50 dimension

  10. The Power of LLL LLL not only finds a “short” lattice vector, it finds a “short” lattice basis.

  11. One Notion of Reduction: The Orthogonality Defect If (b 1 ,...,b n ) is a basis of L, then Hadamard’ s inequality says that: d � ∏ vol ( L ) ≤ � b i � i = 1 Reciprocally, we may wish for a basis such that d � ∏ � b i � ≤ vol ( L ) · constant i = 1

  12. Triangularization from Gram-Schmidt

  13. Gram-Schmidt From d linearly independent vectors, GS constructs d orthogonal vectors: the i-th vector is projected over the orthogonal complement of the first i-1 vectors. � 1 = � b ⋆ b 1 i − 1 � i = � µ i , j � b ⋆ b ⋆ ∑ b i − j j = 1 � b i , � b ⋆ where µ i , j = � j � � b ⋆ j � 2 �

  14. Gram-Schmidt and Volume For each k, ||b* k || is the distance of b k to the subspace spanned by b 1 ,...,b (k-1) . If b 1 ,...,b d is a basis of L, then: vol(L) = ||b* 1 || x ||b* 2 || x ... x ||b* d ||

  15. Computing Gram-Schmidt If b 1 ,...,b d ∈ Z n , then b* 1 , b* 2 ,...,b* d ∈ Q n . They can be computed in polynomial time from the recursive formula. Note: The denominator of each b* i divides (||b* 1 || x ||b* 2 || x ... x ||b* i ||) 2 =vol(b 1 ,...,b i ) 2 The denominator of each μ i,j divides (||b* 1 || x ||b* 2 || x ... x ||b* j ||) 2 =vol(b 1 ,...,b j ) 2

  16. Gram-Schmidt = Triangularization If we take an appropriate orthonormal basis, the matrix of the lattice basis becomes triangular.   � b ∗ � 1 � 0 0 0 ... � � b ∗ b ∗ µ 2 , 1 � 1 � � 2 � 0 0 ...     � � � ... b ∗ b ∗ b ∗ µ 3 , 1 � 1 � µ 3 , 2 � 2 �� 3 � 0     . . ... ... ... . . . .     � � � � b ∗ b ∗ b ∗ b ∗ µ d , 1 � 1 � µ d , 2 � 2 � ... µ d , d − 1 � d − 1 �� d �

  17. Why Gram-Schmidt? d � b ⋆ ∏ vol ( L ) = � i � i = 1 If the Gram-Schmidt do not decrease � b 1 = � too fast, then won’ t be too far b ⋆ 1 from the d-th root of the volume. Neither from the first minimum because: � b ⋆ λ 1 ( L ) ≥ min i � i �

  18. Two dimensions ( 1773 )

  19. Low Dimension If dim ≤ 4, there exist bases reaching all the minima. Can we find them? Yes and as fast as Euclid! Dim 2: Lagrange-Gauss, analysis by [Lagarias1980]. Dim 3: [Vallée1986-Semaev2001]. Dim 4: [N-Stehlé2004]

  20. Reduction operations To improve a basis, we may : Swap two vectors. Slide: subtract to a vector a linear combination of the others. That’ s exactly what Euclid’ s algorithm does.

  21. Lagrange’s Algorithm Input: a basis [u,v] of L Output: a basis of L whose first vector is a shortest vector. Assume that ||u|| ≥ ||v|| Can we shorten u by subtracting a multiple of v?

  22. The right slide Finding the best multiple amounts to finding a closest vector in the lattice spanned by v! The optimal choice is qv where q is the closest integer to < u,v > /||v|| ² u O v

  23. Lagrange’s Algorithm Repeat Compute r := qv where q is the closest integer to < u,v > /||v|| ² . u := u-r Swap(u,v) Until ||u|| ≤ ||v|| Output [u,v]

  24. Lagrange’s reduction A basis [u,v] is L-reduced iff ||u|| ≤ ||v|| |< u,v >| /||v|| ² ≤ 1/2 Such bases exist since Lagrange’ s algorithm clearly outputs L-reduced bases.

  25. The 2-dimensional Case O 2 � 2 ≤ 4 / 3 � � b ∗ 1 � 2 / � b ∗ γ 2 = ( 4 / 3 ) 1 / 2 | µ 2 , 1 | ≤ 1 / 2 �

  26. Exercises Show that if a basis [u,v] of L is Lagrange-reduced then: ||u|| = λ 1 (L) Show that Lagrange’ s algorithm is polynomial time, and even quadratic (in the maximal bit-length of the coefficients) like Euclid’ s algorithm. Hint: consider < u,v > .

  27. 1982 1773 1850 The n - dimensional case: From L to LLL

  28. Bounding Hermite’s Constant and Approximate SVP Algorithms

  29. Bounding Hermite’s Constant Early method to find Hermite’ s constant: Find good upper bounds on Hermite’ s constant. Show that the upper bound is also a lower bound, by exhibiting an appropriate lattice. This works up to dim 4.

  30. Approximation Algorithms for SVP All related to historical methods to upper bound Hermite’ s constant. [LLL82] corresponds to [Hermite1850]’ s inequality. γ d ≤ ( 4 / 3 ) ( d − 1 ) / 2 = γ d − 1 2 [Schnorr87, GHKN06, GamaN08] correspond to [Mordell1944]’ s inequality. γ d ≤ γ ( d − 1 ) / ( k − 1 ) k

  31. The Algorithm of [Lenstra-Lenstra- Lovász1982]: LLL or L ³ Given an integer lattice L of dim d, LLL finds in polynomial time a basis whose first vector satisfies: � � b 1 � ≤ 2 ( d − 1 ) / 2 � L � b 1 � ≤ 2 ( d − 1 ) / 4 vol ( L ) 1 / d � � It is often noted that the constant 2 can be replaced by 4/3+ ε . This is reminiscent of Hermite’ s inequality: γ d ≤ ( 4 / 3 ) ( d − 1 ) / 2 = ( γ 2 ) d − 1

  32. The 2-dimensional Case By proving that , we also γ 2 ≤ ( 4 / 3 ) 1 / 2 described an algorithm to find the shortest vector in dimension 2. This algorithm is Lagrange’ s algorithm, also known as Gauss’ algorithm.

  33. Hermite’s Inequality γ d ≤ ( 4 / 3 ) ( d − 1 ) / 2 Hermite proved as a generalization of the 2-dim case by induction over d. Easy proof by induction: consider a shortest lattice vector, and project the lattice orthogonally...

  34. Hermite’s Reduction Hermite proved the existence of bases such that: � i � 2 b ⋆ � i + 1 � 2 ≤ 4 | µ i , j | ≤ 1 and � 3 b ⋆ 2 � Such bases approximate SVP to an exp factor: ( 4 / 3 ) 1 / 4 � d − 1 � γ d ≤ ( 4 / 3 ) ( d − 1 ) / 2 � vol ( L ) 1 / d � b 1 � ≤ ( 4 / 3 ) 1 / 2 � d − 1 � � � b i � ≤ λ i ( L )

  35. Computing Hermite reduction Hermite proved the existence of : � i � 2 | µ i , j | ≤ 1 b ⋆ � i + 1 � 2 ≤ 4 and 2 � 3 b ⋆ � By relaxing the 4/3, [LLL1982] obtained a provably polynomial-time algorithm.

  36. The Algorithm of [Lenstra-Lenstra- Lovász1982] : LLL ou L ³ Given an integer lattice of dim d, LLL finds a basis almost H-reduced in polynomial time O(d 6 B 3 ) where B is the maximal size of the norms of initial vectors. The running time is really cubic in B, because GS is computed exactly, which already costs O(d 5 B 2 ).

  37. Note on the LLL bound In the worst case, we are limited by Hermite’ s constant in dimension 2, hence the 4/3 constant in the approximation factor. In practice however, the 4/3 seems to be replaced by a smaller constant, whose value can be observed empirically [N-St2006]. Roughly, (4/3) 1/ 4 is replaced by 1.02

  38. LLL LLL tries to reduce all the 2x2 lattices.   a 1 , 1 0 0 ... a 2 , 1 a 2 , 2 0 ... ... 0   . ...   . a 3 , 1 a 3 , 2 a 3 , 3 0 .   a 4 , 1 a 4 , 2 a 4 , 3 a 4 , 4 ...     .   . .   a d , 1 a d , 2 ... a d , d − 1 a d , d

  39. Lenstra-Lenstra-Lovász i − 1 � b i , � b ⋆ where µ i , j = � j � � i = � µ i , j � b ⋆ b ⋆ ∑ b i − j � b ⋆ j � 2 � j = 1 A basis is LLL-reduced if and only if | µ i , j | ≤ 1 it is size-reduced 2 Lovasz’ conditions are satisfied i − 1 � 2 ≤ � � � � i − 1 � 2 b ⋆ b ⋆ b ⋆ 0 . 99 � i + µ i , i − 1 i − 1 � 2 ≤ 4 � � i � 2 b ⋆ b ⋆ Hence, roughly: � 3 �

  40. Description of the LLL Algorithm While the basis is not LLL-reduced Size-reduce the basis If Lovasz’ condition does not hold for some pair (i-1,i): just swap b i-1 and b i .

  41. Size-reduction For i = 2 to d For j = i-1 downto 1 Size-reduce b i with respect to b j : make | μ i,j | ≤ 1/2 by b i := b i -round( μ i,j )b j Update all μ i,j’ for j’ ≤ j. The translation does not affect the previous μ i’,j’ where i’ < i, or i’=i and j’>j.

  42. Why LLL is polynomial d Consider the quantity � b ∗ i � 2 ( d − i + 1 ) ∏ P = � i = 1 If the b i ’ s have integral coordinates, then P is a positive integer. Size-reduction does not modify P. But each swap of LLL makes P decrease by a factor <= 1- ε This implies that the number of swaps is polynomially bounded.

  43. Recap of LLL The LLL algorithm finds in polynomial time a basis such that: � i � 2 b ⋆ � i + 1 � 2 ≤ 4 | µ i , j | ≤ 1 and + ε � 3 b ⋆ 2 � Such bases approximate SVP to an exp factor: ( 4 / 3 + ε ) 1 / 4 � d − 1 � � vol ( L ) 1 / d � b 1 � ≤ γ d ≤ ( 4 / 3 ) ( d − 1 ) / 2 ( 4 / 3 + ε ) 1 / 2 � d − 1 � � � b i � ≤ λ i ( L )

  44. Implementing LLL We described a simple version of LLL, which is not optimized for implementation, for several reasons: The use of rational arithmetic. Size-reduction of a whole basis.

  45. Simple Optimizations It is better to keep a counter k, which varies during the execution, and such that b 1 ,...,b (k-1) are always LLL- reduced. Initially, k=2. At the end, k=d+1. We only need to size-reduce b k and test Lovász’ condition.

  46. Other Optimizations We may rewrite LLL using only integer arithmetic, because we know good denominators for all the rational numbers. More tricky, but more efficient: we may replace rational arithmetic by floating-point arithmetic of suitable precision.

  47. 1982 Beyond LLL

  48. Improving LLL Decreasing the running time: Faster LLLs. Improving the output quality: stronger LLLs. Solving SVP exactly Approximate SVP in polynomial time to within better factors

  49. Faster LLL LLL runs in poly time O(d 6 log 3 B) without fast integer arithmetic. Improving “d”: [Schönhage84,Schnorr88]. But LLL generalizes Euclid’ s gcd algorithm, which is quadratic, not cubic. [N-Stehlé2005] found the first quadratic variant of LLL: O(d 5 log 2 B) without fast arithmetic. Is it possible to achieve quasi-linear time?

Recommend


More recommend