Skip to content

Commit 34e1af7

Browse files
ooinaruhughfpnowelllgoettgens
authored
experimental: Gröbner Walk (#3821)
Co-authored-by: Ortfs <[email protected]> Co-authored-by: Lars Göttgens <[email protected]>
1 parent a23499c commit 34e1af7

35 files changed

+1669
-2
lines changed

docs/oscar_references.bib

+90
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,30 @@ @Article{AG10
3737
eprint = {0810.1148}
3838
}
3939

40+
@InProceedings{AGK96,
41+
author = {Amrhein, Beatrice and Gloor, Oliver and Küchlin, Wolfgang},
42+
title = {Walking faster},
43+
booktitle = {Design and Implementation of Symbolic Computation Systems},
44+
series = {DISCO 1996},
45+
address = {Heidelberg, Germany},
46+
publisher = {Springer Berlin, Heidelberg},
47+
pages = {150--161},
48+
year = {1996},
49+
doi = {10.1007/3-540-61697-7_14},
50+
location = {Karlsruhe, Germany}
51+
}
52+
53+
@Article{AGK97,
54+
author = {Amrhein, Beatrice and Gloor, Oliver and Küchlin, Wolfgang},
55+
title = {On the walk},
56+
journal = {Theoretical Computer Science},
57+
volume = {187},
58+
number = {1},
59+
pages = {179--202},
60+
year = {1997},
61+
doi = {10.1016/s0304-3975(97)00064-9}
62+
}
63+
4064
@Article{AHK18,
4165
author = {Adiprasito, Karim and Huh, June and Katz, Eric},
4266
title = {Hodge theory for combinatorial geometries},
@@ -453,6 +477,27 @@ @Article{CHM98
453477
doi = {10.1112/S1461157000000115}
454478
}
455479

480+
@Article{CKM97,
481+
author = {Collart, S. and Kalkbrener, M. and Mall, D.},
482+
title = {Converting Bases with the Gröbner Walk},
483+
journal = {Journal of Symbolic Computation},
484+
volume = {24},
485+
number = {3},
486+
pages = {465--469},
487+
year = {1997},
488+
doi = {10.1006/jsco.1996.0145}
489+
}
490+
491+
@Book{CLO05,
492+
author = {Cox, David A. and Little, John and O'Shea, Donal},
493+
title = {Using Algebraic Geometry},
494+
series = {Graduate Texts in Mathematics},
495+
volume = {185},
496+
publisher = {Springer-Verlag},
497+
year = {2005},
498+
doi = {10.1007/b138611}
499+
}
500+
456501
@Book{CLS11,
457502
author = {Cox, David A. and Little, John B. and Schenck, Henry K.},
458503
title = {Toric varieties},
@@ -910,6 +955,17 @@ @Article{FGLM93
910955
doi = {10.1006/jsco.1993.1051}
911956
}
912957

958+
@Article{FJLT07,
959+
author = {Fukuda, K. and Jensen, A. N. and Lauritzen, N. and Thomas, R.},
960+
title = {The generic Gröbner walk},
961+
journal = {Journal of Symbolic Computation},
962+
volume = {42},
963+
number = {3},
964+
pages = {298--312},
965+
year = {2007},
966+
doi = {10.1016/j.jsc.2006.09.004}
967+
}
968+
913969
@Article{FJR17,
914970
author = {Fan, Huijun and Jarvis, Tyler and Ruan, Yongbin},
915971
title = {A mathematical theory of the gauged linear sigma model},
@@ -923,6 +979,18 @@ @Article{FJR17
923979
doi = {10.2140/gt.2018.22.235}
924980
}
925981

982+
@Article{FJT07,
983+
author = {Fukuda, Komei and Jensen, Anders N. and Thomas, Rekha R.},
984+
title = {Computing Groebner Fans},
985+
journal = {Math. Comp.},
986+
fjournal = {Mathematics of Computation},
987+
volume = {76},
988+
number = {260},
989+
pages = {2189--2213},
990+
year = {2007},
991+
doi = {10.1090/S0025-5718-07-01986-2}
992+
}
993+
926994
@InProceedings{FLINT,
927995
bibkey = {FLINT},
928996
author = {W. B. Hart},
@@ -2171,6 +2239,28 @@ @Article{Tay87
21712239
primaryclass = {math.GR}
21722240
}
21732241

2242+
@Article{Tra00,
2243+
author = {Tran, Quoc-Nam},
2244+
title = {A Fast Algorithm for Gröbner Basis Conversion and its Applications},
2245+
journal = {Journal of Symbolic Computation},
2246+
volume = {30},
2247+
number = {4},
2248+
pages = {451--467},
2249+
year = {2000},
2250+
doi = {10.1006/jsco.1999.0416}
2251+
}
2252+
2253+
@Article{Tra04,
2254+
author = {Tran, Quoc-Nam},
2255+
title = {Efficient Groebner walk conversion for implicitization of geometric objects},
2256+
journal = {Computer Aided Geometric Design},
2257+
volume = {21},
2258+
number = {9},
2259+
pages = {837--857},
2260+
year = {2004},
2261+
doi = {10.1016/j.cagd.2004.07.001}
2262+
}
2263+
21742264
@Misc{VE22,
21752265
author = {Vaughan-Lee, Michael and Eick, Bettina},
21762266
title = {SglPPow, Database of groups of prime-power order for some prime-powers, Version 2.3},

experimental/GroebnerWalk/README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Gröbner walk
2+
3+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.11065978.svg)](https://doi.org/10.5281/zenodo.11065978)
4+
5+
`GroebnerWalk` provides implementations of Gröbner walk algorithms
6+
for computing Gröbner bases over fields on top of Oscar.jl.
7+
8+
## Usage
9+
10+
This module provides the function `groebner_walk` as interface to the algorithms.
11+
The following example demonstrates the usage. First, we define the ideal Oscar.jl.
12+
```julia
13+
using Oscar
14+
15+
R, (x,y) = QQ[:x, :y] # define ring ...
16+
I = ideal([y^4+ x^3-x^2+x,x^4]) # ... and ideal
17+
```
18+
Then, we can pass the ideal to `groebner_walk` to calculate the Gröbner basis.
19+
20+
By default, `groebner_walk` starts with a Gröbner basis with respect to the default ordering on `R`
21+
and converts this into a Gröbner basis with respect to the lexicographic ordering on `R`.
22+
This is what the following code block accomplishes.
23+
```julia
24+
using Oscar
25+
26+
groebner_walk(I) # compute the Groebner basis
27+
```
28+
If one wants to specify `target` and `start` orderings explicitly, above function call needs to be written as follows.
29+
```julia
30+
groebner_walk(I, lex(R), default_ordering(R)) # compute the Groebner basis
31+
```
32+
33+
Additionally, there are certain special ideals provided that are used for benchmarking
34+
of this module.
35+
36+
## Status
37+
At the moment, the standard walk by Collart, Kalkbrener and Mall (1997) and the generic walk by Fukuda et al. (2007) are implemented.
38+
39+
## Contacts
40+
The library is maintained by Kamillo Ferry (kafe (at) kafe (dot) dev) and Francesco Nowell (francesconowell (at) gmail (dot) com).
41+
42+
## Acknowledgement
43+
The current implementation is based on an implementation by Jordi Welp. We thank him for
44+
laying the groundwork for this package.
45+
46+
## References
47+
- Collart, S., M. Kalkbrener, and D. Mall. ‘Converting Bases with the Gröbner Walk’. Journal of Symbolic Computation 24, no. 3–4 (September 1997): 465–69. https://doi.org/10.1006/jsco.1996.0145.
48+
- Fukuda, K., A. N. Jensen, N. Lauritzen, and R. Thomas. ‘The Generic Gröbner Walk’. Journal of Symbolic Computation 42, no. 3 (1 March 2007): 298–312. https://doi.org/10.1016/j.jsc.2006.09.004.
49+
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Oscar
2+
3+
function agk4(k::Field)
4+
R, (x,y,z,u,v) = polynomial_ring(k, ["x","y","z","u","v"])
5+
6+
o1 = weight_ordering([1,1,1,0,0], degrevlex(R))
7+
o2 = weight_ordering([0,0,0,1,1], degrevlex(R))
8+
9+
F = [
10+
u + u^2 - 2*v - 2*u^2*v + 2*u*v^2 - x,
11+
-6*u + 2*v + v^2 - 5*v^3 + 2*u*v^2 - 4*u^2*v^2 - y,
12+
-2 + 2*u^2 + 6*v - 3*u^2*v^2 - z
13+
]
14+
15+
return ideal(F), o2, o1
16+
end
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using Oscar
2+
3+
include("cyclic.jl")
4+
include("katsura.jl")
5+
include("agk.jl")
6+
include("tran3.3.jl")
7+
8+
function benchmark(
9+
io,
10+
name::String,
11+
I::Ideal,
12+
target::MonomialOrdering,
13+
start::MonomialOrdering
14+
)
15+
print(io, name, ","); flush(io)
16+
t = @elapsed groebner_walk($I, $target, $start; algorithm=:standard)
17+
print(io, t, ","); flush(io)
18+
t = @elapsed groebner_walk($I, $target, $start; algorithm=:generic)
19+
print(io, t, ","); flush(io)
20+
t = @elapsed groebner_walk($I, $target, $start; algorithm=:perturbed)
21+
print(io, t, ","); flush(io)
22+
t = @elapsed groebner_basis($I; ordering=$target)
23+
println(io, t); flush(io)
24+
end
25+
26+
function print_header(io)
27+
print(io, "name,standard_walk,generic_walk,perturbed_walk,buchberger\n")
28+
end
29+
30+
p = 11863279
31+
Fp = GF(p)
32+
open("results.csv", "a") do io
33+
R, (x, y) = QQ[:x, :y]
34+
I = ideal([y^4 + x^3 - x^2 + x, x^4])
35+
benchmark(io, "simple", I, lex(R), default_ordering(R))
36+
37+
benchmark(io, "cyclic5-QQ", cyclic5(QQ)...)
38+
benchmark(io, "cyclic5-Fp", cyclic5(Fp)...)
39+
40+
benchmark(io, "cyclic6-QQ", cyclic6(QQ)...)
41+
benchmark(io, "cyclic6-Fp", cyclic6(Fp)...)
42+
43+
I = katsura(6)
44+
R = base_ring(I)
45+
benchmark(io, "katsura6-QQ", I, lex(R), default_ordering(R))
46+
47+
Ip = map(gens(I)) do f
48+
change_coefficient_ring(Fp, f)
49+
end |> ideal
50+
Rp = base_ring(Ip)
51+
benchmark(io, "katsura6-Fp", Ip, lex(Rp), default_ordering(Rp))
52+
53+
benchmark(io, "cyclic7-QQ", cyclic7(QQ)...)
54+
benchmark(io, "cyclic7-Fp", cyclic7(Fp)...)
55+
56+
benchmark(io, "agk4-QQ", agk4(QQ)...)
57+
benchmark(io, "agk4-Fp", agk4(Fp)...)
58+
59+
benchmark(io, "tran3.3-QQ", tran33(QQ)...)
60+
benchmark(io, "tran3.3-Fp", tran33(Fp)...)
61+
62+
benchmark(io, "newellp1-QQ", Oscar.newell_patch_with_orderings(QQ)...)
63+
benchmark(io, "newellp1-Fp", Oscar.newell_patch_with_orderings(Fp)...)
64+
end
65+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
using Oscar
2+
3+
function cyclic5(k::Field=QQ)
4+
R, (a,b,c,d,x) = k[:a,:b,:c,:d,:x]
5+
F = [
6+
a + b + c + d + x,
7+
a*b + b*c + c*d + d*x + x*a,
8+
a*b*c + b*c*d + c*d*x + d*x*a + x*a*b,
9+
a*b*c*d + b*c*d*x + c*d*x*a + d*x*a*b + x*a*b*c,
10+
a*b*c*d*x - 1
11+
]
12+
13+
return ideal(F), lex(R), default_ordering(R)
14+
end
15+
16+
function cyclic6(k::Field=QQ)
17+
R, (z0,z1,z2,z3,z4,z5) = k[:z0,:z1,:z2,:z3,:z4,:z5]
18+
F = [
19+
z0 + z1 + z2 + z3 + z4 + z5,
20+
z0*z1 + z1*z2 + z2*z3 + z3*z4 + z4*z5 + z5*z0,
21+
z0*z1*z2 + z1*z2*z3 + z2*z3*z4 + z3*z4*z5 + z4*z5*z0 + z5*z0*z1,
22+
z0*z1*z2*z3 + z1*z2*z3*z4 + z2*z3*z4*z5 + z3*z4*z5*z0 + z4*z5*z0*z1
23+
+ z5*z0*z1*z2,
24+
z0*z1*z2*z3*z4 + z1*z2*z3*z4*z5 + z2*z3*z4*z5*z0 + z3*z4*z5*z0*z1
25+
+ z4*z5*z0*z1*z2 + z5*z0*z1*z2*z3,
26+
z0*z1*z2*z3*z4*z5 - 1
27+
]
28+
29+
return ideal(F), lex(R), default_ordering(R)
30+
end
31+
32+
function cyclic7(k::Field=QQ)
33+
R, (z0, z1, z2, z3, z4, z5, z6) = QQ[:z0, :z1, :z2, :z3, :z4, :z5, :z6]
34+
F = [
35+
z0 + z1 + z2 + z3 + z4 + z5 + z6,
36+
z0 * z1 + z1 * z2 + z2 * z3 + z3 * z4 + z4 * z5 + z5 * z6 + z6 * z0,
37+
z0 * z1 * z2 + z1 * z2 * z3 + z2 * z3 * z4 + z3 * z4 * z5 + z4 * z5 * z6 + z5 * z6 * z0 + z6 * z0 * z1,
38+
z0 * z1 * z2 * z3 + z1 * z2 * z3 * z4 + z2 * z3 * z4 * z5 + z3 * z4 * z5 * z6 + z4 * z5 * z6 * z0
39+
+ z5 * z6 * z0 * z1 + z6 * z0 * z1 * z2,
40+
z0 * z1 * z2 * z3 * z4 + z1 * z2 * z3 * z4 * z5 + z2 * z3 * z4 * z5 * z6 + z3 * z4 * z5 * z6 * z0
41+
+ z4 * z5 * z6 * z0 * z1 + z5 * z6 * z0 * z1 * z2 + z6 * z0 * z1 * z2 * z3,
42+
z0 * z1 * z2 * z3 * z4 * z5 + z1 * z2 * z3 * z4 * z5 * z6 + z2 * z3 * z4 * z5 * z6 * z0 + z3 * z4 * z5 * z6 * z0 * z1
43+
+ z4 * z5 * z6 * z0 * z1 * z2 + z5 * z6 * z0 * z1 * z2 * z3 + z6 * z0 * z1 * z2 * z3 * z4,
44+
z0 * z1 * z2 * z3 * z4 * z5 * z6 - 1
45+
]
46+
47+
return ideal(F), lex(R), default_ordering(R)
48+
end
49+
50+
function cyclic8(k::Field=QQ)
51+
R, (z0, z1, z2, z3, z4, z5, z6, z7) = k[:z0, :z1, :z2, :z3, :z4, :z5, :z6, :z7]
52+
53+
F = [
54+
z0 + z1 + z2 + z3 + z4 + z5 + z6 + z7,
55+
56+
z0*z1 + z1*z2 + z2*z3 + z3*z4 + z4*z5 + z5*z6 + z6*z7 + z7*z0,
57+
58+
z0*z1*z2 + z1*z2*z3 + z2*z3*z4 + z3*z4*z5 + z4*z5*z6 + z5*z6*z7
59+
+ z6*z7*z0 + z7*z0*z1,
60+
61+
z0*z1*z2*z3 + z1*z2*z3*z4 + z2*z3*z4*z5 + z3*z4*z5*z6 + z4*z5*z6*z7
62+
+ z5*z6*z7*z0 + z6*z7*z0*z1 + z7*z0*z1*z2,
63+
64+
z0*z1*z2*z3*z4 + z1*z2*z3*z4*z5 + z2*z3*z4*z5*z6 + z3*z4*z5*z6*z7
65+
+ z4*z5*z6*z7*z0 + z5*z6*z7*z0*z1 + z6*z7*z0*z1*z2 + z7*z0*z1*z2*z3,
66+
67+
z0*z1*z2*z3*z4*z5 + z1*z2*z3*z4*z5*z6 + z2*z3*z4*z5*z6*z7 + z3*z4*z5*z6*z7*z0
68+
+ z4*z5*z6*z7*z0*z1 + z5*z6*z7*z0*z1*z2 + z6*z7*z0*z1*z2*z3 + z7*z0*z1*z2*z3*z4,
69+
70+
z0*z1*z2*z3*z4*z5*z6 + z1*z2*z3*z4*z5*z6*z7 + z2*z3*z4*z5*z6*z7*z0
71+
+ z3*z4*z5*z6*z7*z0*z1 + z4*z5*z6*z7*z0*z1*z2 + z5*z6*z7*z0*z1*z2*z3
72+
+ z6*z7*z0*z1*z2*z3*z4 + z7*z0*z1*z2*z3*z4*z5,
73+
74+
z0*z1*z2*z3*z4*z5*z6*z7 - 1
75+
]
76+
77+
return ideal(F), lex(R), default_ordering(R)
78+
end
79+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Oscar
2+
3+
function tran33(k::Field)
4+
R, (x,y,z) = k[:x,:y,:z]
5+
6+
F = [16 + 3*x^3+16*x^2*z+14*x^2*y^3, 6+y^3*z+17*x^2*z^2+7*x*y^2*z^2+13*x^3*z^2]
7+
8+
return ideal(F), lex(R), default_ordering(R)
9+
end
10+
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
"Gröbner walk" => [
3+
"introduction.md",
4+
"special-ideals.md"
5+
]
6+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
```@meta
2+
CurrentModule = Oscar
3+
```
4+
5+
# Usage
6+
7+
The Gröbner walk is an approach to reduce the computational complexity of Gröbner basis computations as proposed by [AGK97](@cite).
8+
These incarnations of the Gröbner walk refer to a family of algorithms that perform a reverse local search on the cones of the Gröbner fan.
9+
Then, a Gröbner basis is calculated for each encountered cone while reusing the generators obtained from the previous cone.
10+
11+
The implemented algorithms may be accessed using the following function.
12+
13+
```@docs
14+
groebner_walk(
15+
I::MPolyIdeal,
16+
target::MonomialOrdering = lex(base_ring(I)),
17+
start::MonomialOrdering = default_ordering(base_ring(I));
18+
perturbation_degree = ngens(base_ring(I)),
19+
algorithm::Symbol = :standard
20+
)
21+
```
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```@meta
2+
CurrentModule = Oscar
3+
```
4+
5+
# Special ideals used for benchmarking
6+
7+
We bundle a couple of special ideals useful for benchmarking of the Gröbner walk.
8+
9+
```@docs
10+
newell_patch(k::Union{QQField, QQBarFieldElem}, n::Int=1)
11+
newell_patch(k::Field, n::Int=1)
12+
```
13+
14+
```@docs
15+
newell_patch_with_orderings(k::Field, n::Int=1)
16+
```

0 commit comments

Comments
 (0)