Jean-Charles Faugère
F 4 algorithm F 5 algorithm
Hagenberg, Austria
September 03 – 06, 2013
F 4
F 4
The F 4 algorithm
Definition
A critical pair of pf i , f j q is a member of
T ˆ T ˆ Krx 1 , . . . , x n s ˆ T ˆ Krx 1 , . . . , x n s, Pairpf i , f j q : “ plcm ij , t i , f i , t j , f j q
such that
lcmpPairpf i , f j qq “ lcm ij “ LTpt i f i q “ LTpt j f j q “ lcmpf i , f j q
Definition
We define the degree of the critical pair p i,j “ Pairpf i , f j q, degpp i,j q, to be degplcm i,j q. We define the following operators:
Leftpp i,j q : “ t i ¨ f i and Rightpp i,j q : “ t j ¨ f j
4
Input:
$ &
%
F is a finite subset of Krx 1 , . . . , x n s S el is a function List pPairsq Ñ List pPairsq
such that S el plq ‰ H if l ‰ H Output: a finite subset of Krx 1 , . . . , x n s.
G :“ F , F ˜ 0 ` :“ F , d :“ 0 and P :“ Pairpf, gq | pf , gq P G 2 with f ‰ g ( while P ‰ H do
d : “ d ` 1 P d : “ S elpPq P : “ PzP d
L d : “ LeftpP d q Y RightpP d q F ˜ d ` : “R EDUCTION pL d , Gq for h P F ˜ d ` do
P : “ P Y tPairph, gq | g P Gu G : “ G Y thu
return G
a subset of Krx 1 , . . . , x n s, to the reduction of a subset of Krx 1 , . . . , x n s modulo another subset of Krx 1 , . . . , x n s:
Algorithm R EDUCTION
Input: L, G finite subsets of Krx 1 , . . . , x n s
Output: a finite subset of K rx 1 , . . . , x n s (could be empty).
F : “S YMBOLIC P REPROCESSING pL, Gq F r : “ Gaussian reduction of F wrt ă F ˜ ` : “ !
f P F ˜ | LTpf q R LTpF q )
// the “useful” part of F r
return F ˜ `
Algorithm S YMBOLIC P REPROCESSING
Input: L, G finite subsets of K rx 1 , . . . , x n s Output: a finite subset of Krx 1 , . . . , x n s F : “ L
Done :“ LTpF q
while TpF q ‰ Done do
choose m an element of TpF qzDone Done :“ Done Y tmu
if m top reducible modulo G then
exists g P G and m 1 P T such that m “ m 1 ¨ LTpgq F :“ F Y tm 1 ¨ gu
return F
The S YMBOLIC P REPROCESSING function is very efficient: its
complexity is proportional to the size of the output (if #G is smaller
than the final size of T pF q) [parallel implementation].
For all polynomials p P L d ,we have p GY ÝÑ F ˜ ` 0
Theorem
The F 4 algorithm computes a Gröbner basis of G in Krx 1 , . . . , x n s such that F Ď G and Id pGq “ Id pF q.
Proof.
. . .
Remark
If # S elplq “ 1 for all l ‰ H then the F 4 algorithm reduces to the Buch-
berger algorithm. In this case the function S el is the equivalent of the
selection strategy for the Buchberger algorithm.
Selection function
Algorithm Selection
Input: P a list of critical pairs Output: a list of critical pairs.
d : “ min tdegplcmppqq | p P Pu P d : “ tp P P | degplcmppqq “ d u return P d
We call this strategy the normal strategy for F 4 .
Hence, if the input polynomials are homogeneous, we obtain in degree
d , a d Gröbner basis; S el selects, in the next step, all the critical pairs
which are needed to compute the Gröbner basis in degree d ` 1.
Optimizations
including Buchberger Criteria (or F 5 criterion).
reuse all the rows in the reduced matrices.
Algorithm Buchberger Criteria - Implementation pG new , P new q : “U PDATE pG old , P old , hq
Input:
$ &
%
a finite subset G old of K rx 1 , . . . , x n s
a finite subset P old of critical pairs in Krx 1 , . . . , x n s 0 ‰ h P Krx 1 , . . . , x n s
Output: a finite subset in K rx 1 , . . . , x n s an updated
list of critical pairs.
4
Input:
"
F Ă Krx 1 , . . . , x n s
S el a function ListpPairsq Ñ ListpPairsq Output: a finite subset of Krx 1 , . . . , x n s.
G : “ H andP : “ H and d : “ 0 while F ‰ H do
f : “ firstpF q ; F : “ F ztf u pG, Pq : “U PDATE pG, P, fq while P ‰ H do
d : “ d ` 1
P d : “ S elpPq; P : “ PzP d
L d : “ LeftpP d q Y RightpP d q
p F ˜ d ` , F d q : “R EDUCTION pL d , G, pF i q d“1,...,pd´1q q for h P F ˜ d ` do
P : “ P Y tPairph, g q | g P Gu
pG, Pq : “U PDATE pG, P, hq
return G
F4: step by step
Example (Cyclic 4)
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “
tp1, f 3 q, pb, f 4 qu.
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q, pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 u T pF 1 q “ t ab , ad , b 2 , bc, bd , cd u
ab is already done.
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q , pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 u T pF 1 q “ t ab , ad , b 2 , bc, bd , cd u
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q, pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 u T pF 1 q “ t ab , ad , b 2 , bc, bd , cd u
ad is top reducible by f 4 P G !
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q , pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 , df 4 u T pF 1 q “ t ab , ad , b 2 , bc, bd , cd , d 2 u
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q, pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 , df 4 u T pF 1 q “ t ab , ad , b 2 , bc, bd , cd , d 2 u
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q, pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 , df 4 u T pF 1 q “ t ab , ad , b 2 , bc, bd , cd , d 2 u
b 2 is not reducible by G
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q, pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, Hq:
F 1 “ tf 3 , b f 4 , df 4 u T pF 1 q “ t ab , ad , b 2 , bc , bd , cd , d 2 u
Monomial ordering is DRL and the normal strategy F “
„ f 1 “ abcd ´ 1, f 2 “ abc ` abd ` acd ` bcd , f 3 “ ab ` bc ` ad ` cd , f 4 “ a ` b ` c ` d
At the beginning G “ tf 4 u and P 1 “ tPairpf 3 , f 4 qu such that L 1 “ tp1, f 3 q, pb, f 4 qu.
S YMBOLIC P REPROCESSING pL 1 , G, H ) returns
F 1 “ rf 3 , bf 4 , df 4 s.
Matrix representation of F 1 “ rf 3 , bf 4 , df 4 s is:
A 1 “ MpF 1 q “
ab b 2 bc ad bd cd d 2
df 4 1 1 1 1
f 3 1 1 1 1
bf 4 1 1 1 1
Gaussian reduction of A 1 is:
A Ă 1 “
ab b 2 bc ad bd cd d 2
df 4 1 1 1 1
f 3 1 1 ´1 ´1
bf 4 1 2 1
A Ă 1 “
ab b 2 bc ad bd cd d 2
df 4 1 1 1 1
f 3 1 1 ´1 ´1
bf 4 1 2 1
F ˜ 1 “
»
– f 5 “ ad ` bd ` cd ` d 2 , f 6 “ ab ` bc ´ bd ´ d 2 ,
f 7 “ b 2 ` 2 bd ` d 2
fi
fl
F ˜ 1 “ rf 5 “ ad ` bd ` cd ` d 2 , f 6 “ ab ` bc ´ bd ´ d 2 , f 7 “ b 2 ` 2 bd ` d 2 s
and since ab, ad P LTpF 1 q we have F ˜ 1 ` “ rf 7 s
and now G “ tf 4 , f 7 u.
For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu
hence L 2 “ tp1, f 2 q , pbc , f 4 qu and F “ tF 1 u.
L 2 “ tp1, f 2 q, pbc, f 4 qu et F “ tF 1 u.
In S YMBOLIC P REPROCESSING we can try to simplify the products 1 ¨ f 2
and bc ¨ f 4 using the previous computations:
For instance LTpbc f 4 q “ abc “ LTpc f 6 q and so instead of bc ¨ f 4 we can
consider c ¨ f 6 .
For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu hence L 2 “ tp1, f 2 q, pbc , f 4 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ tf 2 , c f 6 u T pF 2 q “ t abc , bc 2 , abd , acd , bcd , cd 2 u
For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu hence L 2 “ tp1, f 2 q, pbc , f 4 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ tf 2 , cf 6 u T pF 2 q “ t abc , bc 2 , abd , acd , bcd , cd 2 u
F ˜ 1 “ rf 5 “ ad ` bd `cd `d 2 , f 6 “ ab `bc ´bd ´ d 2 , f 7 “ b 2 ` 2 bd `d 2 s For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu
hence L 2 “ tp1, f 2 q , pbc , f 4 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ tf 2 , cf 6 u T pF 2 q “ t abc , bc 2 , abd , acd , bcd , cd 2 u
abd is reducible by bd f 4 and also by b f 5 !
F ˜ 1 “ rf 5 “ ad ` bd `cd `d 2 , f 6 “ ab `bc ´bd ´ d 2 , f 7 “ b 2 ` 2 bd `d 2 s For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu
hence L 2 “ tp1, f 2 q , pbc , f 4 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ tf 2 , cf 6 u T pF 2 q “ t abc , bc 2 , abd , acd , bcd , cd 2 u abd is reducible by bd f 4 and also by b f 5 !
We describe now S IMPLIFY :
Goal
replace any product m ¨ f by a product pu t q ¨ f 1 where pt, f 1 q is a
previously computed row and u t divides the monomial m
Optimizations
In the first version of the algorithm: some rows of the matrix are never used (the rows in the matrix F ˜ d zF d ` ).
New version of the algorithm: we keep these rows m ¨ f P RowspF q ÝÑ m 1 ¨ f 1 with m ě m 1
m ¨ f P RowspF q ÝÑ x k ¨ f 1
S IMPLIFY tries to replace the product m ¨ f by a product pu t q ¨ f where pt, f 1 q is an already computed row in the gaussian reduction and u t divides the monomial m; if we found such a better product then we call recursively the function S IMPLIFY :
Algorithm S IMPLIFY
Input:
$ &
%
t P T a monomial
f P Krx 1 , . . . , x n s a polynomial
F “ pF k q k“1,...,pd´1q , where F k Ă Krx 1 , . . . , x n s Output: a product m 1 ¨ f 1 equivalent to t ¨ f
for u P list of divisors of t do
if Dj (1 ď j ă d ) such that pu ¨ f q P F j then F ˜ j is the Gaussian reduction of F j wrt ă
there exists a unique p P F ˜ j such that LTppq “ LTpu ¨ f q if u ‰ t then
return S IMPLIFY p u t , p, F q else
return 1 ¨ p
return t ¨ f
Input:
$ &
%
L, G finite subsets of Krx 1 , . . . , x n s F “ pF k q k“1,...,pd´1q , where F k
a finite subset of Krx 1 , . . . , x n s Output: a finite subset of Krx 1 , . . . , x n s F : “ L
Done : “ LTpF q
while T pF q ‰ Done do
choose m an element of T pF qzDone Done : “ Done Y tmu
if m top reducible modulo G then
exists g P G and m 1 P T such that m “ m 1 ¨ LTpgq F : “ F Y tS IMPLIFY pm 1 , g, F qu
return F
In practice ...
Remark
In practice the result of Simplify is to return in 95% x i ¨ p where x i is a variable
(and most often the product x n ¨ p ).
In some sense, these is somewhat similar to the FGLM algorithm where
we use the multiplication matrices to compute normal forms.
F ˜ 1 “ rf 5 “ ad ` bd `cd `d 2 , f 6 “ ab `bc ´bd ´ d 2 , f 7 “ b 2 ` 2 bd `d 2 s For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu
hence L 2 “ tp1, f 2 q, pc, f 6 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ tf 2 , cf 6 u T pF 2 q “ t abc , bc 2 , abd , acd , bcd , cd 2 u abd is reducible by bd f 4 :
S IMPLIFY : replace bd f 4 by b f 5 , so that abd is reducible by b f 5 !
For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu hence L 2 “ tp1, f 2 q, pbc , f 4 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ tf 2 , cf 6 , b f 5 u T pF 2 q “ t abc , bc 2 , abd , acd , bcd , cd 2 , b 2 d , bd 2 u
And so on . . .
For the next step we have to consider P 2 “ tPairpf 2 , f 4 qu hence L 2 “ tp1, f 2 q, pbc , f 4 qu and F “ tF 1 u.
S YMBOLIC P REPROCESSING
F 2 “ rcf 5 , df 7 , bf 5 , f 2 , cf 6 s
A 2 “ MpF 2 q “
»
— —
— — –
0 0 0 0 1 1 1 0 1 0 0 0 0 0 1 0 0 0 2 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 ´1 0 0 ´1 0 0
fi
ffi ffi
ffi ffi
fl
Apply Gaussian reduction:
A ˜ 2 “ MpF Č 2 q “
»
— —
— — –
1 1 1 1
1 2 1
1 1 ´1 ´1
1 ´1 ´1 1 ´1 1
1 1 ´1 ´1
fi
ffi ffi
ffi ffi
fl
A ˜ 2 “ MpF Č 2 q “
»
— —
— — –
1 1 1 1
1 2 1
1 1 ´1 ´1
1 ´1 ´1 1 ´1 1
1 1 ´1 ´1
fi ffi ffi ffi ffi fl
F ˜ 2 “ rf 9 “ acd ` bcd ` c 2 d ` cd 2 , f 10 “ b 2 d ` 2 bd 2 ` d 3 ,
f 11 “ abd ` bcd ´ bd 2 ´ d 3 ,
f 12 “ abc ´ bcd ´ c 2 d ` bd 2 ´ cd 2 ` d 3 , f 13 “ bc 2 ` c 2 d ´ bd 2 ´ d 3 s and
G “ tf 4 , f 7 , f 13 u.
For the next step we have
L 3 “ tp1, f 1 q, pbcd , f 4 q, pc 2 , f 7 q, pb, f 13 qu and we recursively call Simplify:
S IMPLIFY pbcd , f 4 q “ S IMPLIFY pcd , f 6 q “ S IMPLIFY pd , f 12 q “ pd , f 12 q.
For the next step we have
L 3 “ tp1, f 1 q, pbcd , f 4 q, pc 2 , f 7 q, pb, f 13 qu
F 3 “ rf 1 , df 12 , c 2 f 7 , bf 13 s.
After few steps in S YMBOLIC P REPROCESSING we found that
F 3 “ rf 1 , df 12 , c 2 f 7 , bf 13 , df 13 , df 10 s
For the next step we have
L 3 “ tp1, f 1 q, pbcd , f 4 q, pc 2 , f 7 q, pb, f 13 qu
F 3 “ rf 1 , df 12 , c 2 f 7 , bf 13 s.
S YMBOLIC P REPROCESSING
F 3 “ rf 1 , df 12 , c 2 f 7 , bf 13 , df 13 , df 10 s
Doing some computations we found that the rank of MpF 3 q is only 5.
This means that there is a useless reduction to zero !
For the next step we have
L 3 “ tp1, f 1 q, pbcd , f 4 q, pc 2 , f 7 q, pb, f 13 qu
F 3 “ rf 1 , df 12 , c 2 f 7 , bf 13 s.
S YMBOLIC P REPROCESSING
F 3 “ rf 1 , df 12 , c 2 f 7 , bf 13 , df 13 , df 10 s
F ˜ 3 “
»
— —
— — –
f 15 “ c 2 b 2 ´ c 2 d 2 ` 2 bd 3 ` 2 d 4 , f 16 “ abcd ´ 1,
f 17 “ ´bcd 2 ´ c 2 d 2 ` bd 3 ´ cd 3 ` d 4 ` 1, f 18 “ c 2 bd ` c 2 d 2 ´ bd 3 ´ d 4 ,
f 19 “ b 2 d 2 ` 2 bd 3 ` d 4
fi
ffi ffi
ffi ffi
fl
Linear Algebra
To compute the Gaussian Elimination is the most costly (CPU/Memory):
Compress the storage of the matrices
More involved way to store the matrices Œ memory request:
a matrix of dimension 5 ¨ 10 4 ˆ 5 ¨ 10 4 with 10% non zero elements if 1 byte is needed per coefficient
ñ 25 ¨ 10 7 bytes « 238 MB to store the full matrix !
Shape of the generated matrices
Katsura 7 in F 65521 : 694 ˆ 738 matrix of density 8%
m
1m
2m
3m
4m
5m
6m
7m
8m
9f
f f f f f
1 2 3 4 56
0
0 0 0 0
0 0 0 0 0
0
0 0 0 0 0 0 0
0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 1
1 1 1
1 1 4
3 4
5
6
3
2
1
2
Shape of the generated matrices
Katsura 7 in F 65521 : 694 ˆ 738 matrix of density 8 %
m
1m
2m
3m
4m
5m
6m
7m
8m
9f
f f f f f
1 2 3 4 56