diff --git a/Project.toml b/Project.toml index 9595c2e..6a3f6c1 100644 --- a/Project.toml +++ b/Project.toml @@ -17,7 +17,7 @@ msolve_jll = "6d01cc9a-e8f6-580e-8c54-544227e08205" [compat] LoopVectorization = "0.12" -Nemo = "0.35.1, 0.36, 0.37, 0.38, 0.39, 0.40, 0.41, 0.42" +Nemo = "0.43" StaticArrays = "1" julia = "1.6" LinearAlgebra = "1.6" diff --git a/docs/src/types.md b/docs/src/types.md index 80fcd90..3012bfc 100644 --- a/docs/src/types.md +++ b/docs/src/types.md @@ -27,7 +27,7 @@ ring structures: ```@repl using AlgebraicSolving -R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"], ordering=:degrevlex) +R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"], internal_ordering=:degrevlex) ``` The above example defines a multivariate polynomial ring in three variables `x`, `y`, and `z` over the rationals using the dgree reverse lexicographical ordering @@ -36,7 +36,7 @@ over finite fields: ```@repl using AlgebraicSolving -R, (x,y,z) = polynomial_ring(GF(101), ["x", "y", "z"], ordering=:degrevlex) +R, (x,y,z) = polynomial_ring(GF(101), ["x", "y", "z"], internal_ordering=:degrevlex) ``` ## Ideals @@ -47,7 +47,7 @@ effective: ```@repl using AlgebraicSolving -R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"], ordering=:degrevlex) +R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"], internal_ordering=:degrevlex) I = Ideal([x+y+1, y*z^2-13*y^2]) ``` diff --git a/src/algorithms/groebner-bases.jl b/src/algorithms/groebner-bases.jl index 3d2f495..2ae213d 100644 --- a/src/algorithms/groebner-bases.jl +++ b/src/algorithms/groebner-bases.jl @@ -26,7 +26,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg ```jldoctest julia> using AlgebraicSolving -julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex) +julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], internal_ordering=:degrevlex) (Multivariate polynomial ring in 3 variables over GF(101), FqMPolyRingElem[x, y, z]) julia> I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y]) @@ -80,7 +80,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg ```jldoctest julia> using AlgebraicSolving -julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex) +julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], internal_ordering=:degrevlex) (Multivariate polynomial ring in 3 variables over GF(101), FqMPolyRingElem[x, y, z]) julia> I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y]) diff --git a/src/examples/katsura.jl b/src/examples/katsura.jl index 07b6d0a..4ad1fac 100644 --- a/src/examples/katsura.jl +++ b/src/examples/katsura.jl @@ -30,9 +30,9 @@ QQMPolyRingElem[x1 + 2*x2 + 2*x3 - 1, x1^2 + 2*x2^2 + 2*x3^2 - x1, 2*x1*x2 + 2*x """ function katsura(log_solutions::Int, characteristic::Int=0) if characteristic == 0 - R, _ = polynomial_ring(QQ, log_solutions + 1, ordering=:degrevlex) + R, _ = polynomial_ring(QQ, log_solutions + 1, internal_ordering=:degrevlex) elseif is_probable_prime(characteristic) - R, _ = polynomial_ring(GF(characteristic), log_solutions + 1, ordering=:degrevlex) + R, _ = polynomial_ring(GF(characteristic), log_solutions + 1, internal_ordering=:degrevlex) else error("We only support finite fields or QQ as ground fields.") end diff --git a/src/siggb/siggb.jl b/src/siggb/siggb.jl index b598352..17a67a2 100644 --- a/src/siggb/siggb.jl +++ b/src/siggb/siggb.jl @@ -229,7 +229,7 @@ end function _homogenize(F::Vector{P}) where {P <: MPolyRingElem} R = parent(first(F)) S, vars = polynomial_ring(base_ring(R), ["x$i" for i in 1:nvars(R)+1], - ordering = :degrevlex) + internal_ordering = :degrevlex) res = typeof(first(F))[] for f in F ctx = MPolyBuildCtx(S) diff --git a/test/algorithms/groebner-bases.jl b/test/algorithms/groebner-bases.jl index f26122f..b147715 100644 --- a/test/algorithms/groebner-bases.jl +++ b/test/algorithms/groebner-bases.jl @@ -1,9 +1,9 @@ @testset "Algorithms -> Gröbner bases" begin - R, (x,y,z) = polynomial_ring(QQ,["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(QQ,["x","y","z"], internal_ordering=:degrevlex) F = [x^2+1-3, x*y-z, x*z^2-3*y^2] #= not a finite field =# @test_throws ErrorException groebner_basis(Ideal(F)) - R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], internal_ordering=:degrevlex) I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y]) G = groebner_basis(I) H = MPolyRingElem[ @@ -32,11 +32,11 @@ end @testset "Algorithms -> Sig Gröbner bases" begin - R, (x,y,z) = polynomial_ring(QQ,["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(QQ,["x","y","z"], internal_ordering=:degrevlex) F = [x^2+1-3, x*y-z, x*z^2-3*y^2] #= not a finite field =# @test_throws ErrorException sig_groebner_basis(F) - R, (x,y,z) = polynomial_ring(GF(17),["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(GF(17),["x","y","z"], internal_ordering=:degrevlex) F = [x^2+1-3, x*y-z, x*z^2-3*y^2] #= not homogeneous =# @test_throws ErrorException sig_groebner_basis(F) @@ -47,7 +47,7 @@ end @test AlgebraicSolving._is_gb(sgb) #= GB test 2 =# - R, (x,y,z,w) = polynomial_ring(GF(65521),["x","y","z","w"], ordering=:degrevlex) + R, (x,y,z,w) = polynomial_ring(GF(65521),["x","y","z","w"], internal_ordering=:degrevlex) F = cyclic(R).gens Fhom = AlgebraicSolving._homogenize(F) sgb = sig_groebner_basis(Fhom) @@ -60,7 +60,7 @@ end @test AlgebraicSolving._is_gb(sgb) #= GB test 4 (pivot setting bug) =# - R, (x1, x2, x3, x4) = polynomial_ring(GF(65521), ["x1", "x2", "x3", "x4"], ordering=:degrevlex) + R, (x1, x2, x3, x4) = polynomial_ring(GF(65521), ["x1", "x2", "x3", "x4"], internal_ordering=:degrevlex) F = [11523*x1^4 + 30378*x1^3*x2 + 30154*x1^2*x2^2 + 10157*x1*x2^3 - 28136*x2^4 - 4771*x1^3*x3 - 21056*x1^2*x2*x3 + 15696*x1*x2^2*x3 - 16144*x2^3*x3 - 1553*x1^2*x3^2 - 30379*x1*x2*x3^2 - 12735*x2^2*x3^2 + 18058*x1*x3^3 + 24670*x2*x3^3 - 16379*x3^4 + 24196*x1^3*x4 - 19411*x1^2*x2*x4 + 17610*x1*x2^2*x4 - 5715*x2^3*x4 - 21186*x1^2*x3*x4 - 22865*x1*x2*x3*x4 - 1939*x2^2*x3*x4 - 5685*x1*x3^2*x4 + 8508*x2*x3^2*x4 + 21819*x3^3*x4 - 24868*x1^2*x4^2 - 18233*x1*x2*x4^2 - 14116*x2^2*x4^2 + 28291*x1*x3*x4^2 - 9068*x2*x3*x4^2 - 15138*x3^2*x4^2 + 8921*x1*x4^3 - 18808*x2*x4^3 - 3005*x3*x4^3 + 7368*x4^4, 31703*x1^4 + 23616*x1^3*x2 + 20696*x1^2*x2^2 - 7125*x1*x2^3 + 15334*x2^4 + 26619*x1^3*x3 + 2173*x1^2*x2*x3 - 31312*x1*x2^2*x3 - 31386*x2^3*x3 - 25244*x1^2*x3^2 - 28729*x1*x2*x3^2 + 27244*x2^2*x3^2 - 24892*x1*x3^3 + 2046*x2*x3^3 + 2516*x3^4 - 18588*x1^3*x4 + 9980*x1^2*x2*x4 - 10104*x1*x2^2*x4 + 21688*x2^3*x4 - 1315*x1^2*x3*x4 - 17824*x1*x2*x3*x4 + 14919*x2^2*x3*x4 - 568*x1*x3^2*x4 - 22509*x2*x3^2*x4 + 18494*x3^3*x4 + 25947*x1^2*x4^2 - 28652*x1*x2*x4^2 - 25547*x2^2*x4^2 + 1637*x1*x3*x4^2 - 20130*x2*x3*x4^2 + 19739*x3^2*x4^2 + 3742*x1*x4^3 + 25425*x2*x4^3 + 6342*x3*x4^3 - 3004*x4^4, 2857*x1^4 + 8898*x1^3*x2 + 16959*x1^2*x2^2 - 28026*x1*x2^3 - 25631*x2^4 + 11030*x1^3*x3 + 29101*x1^2*x2*x3 + 30359*x1*x2^2*x3 + 27330*x2^3*x3 + 19126*x1^2*x3^2 - 26603*x1*x2*x3^2 + 2510*x2^2*x3^2 + 7575*x1*x3^3 - 25033*x2*x3^3 - 21024*x3^4 + 30501*x1^3*x4 + 23834*x1^2*x2*x4 - 1858*x1*x2^2*x4 - 10862*x2^3*x4 + 30320*x1^2*x3*x4 + 19705*x1*x2*x3*x4 + 28359*x2^2*x3*x4 + 17590*x1*x3^2*x4 + 11929*x2*x3^2*x4 + 22830*x3^3*x4 + 13501*x1^2*x4^2 - 24860*x1*x2*x4^2 + 12598*x2^2*x4^2 - 9409*x1*x3*x4^2 - 2827*x2*x3*x4^2 - 8608*x3^2*x4^2 + 30938*x1*x4^3 - 12892*x2*x4^3 + 9165*x3*x4^3 - 5202*x4^4, diff --git a/test/algorithms/solvers.jl b/test/algorithms/solvers.jl index ed113e4..f89498e 100644 --- a/test/algorithms/solvers.jl +++ b/test/algorithms/solvers.jl @@ -1,5 +1,5 @@ @testset "Algorithms -> Solvers" begin - R, (x1,x2,x3,x4) = polynomial_ring(QQ,["x1","x2","x3","x4"], ordering=:degrevlex) + R, (x1,x2,x3,x4) = polynomial_ring(QQ,["x1","x2","x3","x4"], internal_ordering=:degrevlex) I = Ideal([x1 + 2*x2 + 2*x3 + 2*x4 - 1, x1^2 + 2*x2^2 + 2*x3^2 + 2*x4^2 - x1, 2*x1*x2 + 2*x2*x3 + 2*x3*x4 - x2, diff --git a/test/interfaces/nemo.jl b/test/interfaces/nemo.jl index d3ffdcc..0295efc 100644 --- a/test/interfaces/nemo.jl +++ b/test/interfaces/nemo.jl @@ -1,14 +1,14 @@ @testset "Interfaces -> Nemo" begin - R, (x,y,z) = polynomial_ring(QQ,["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(QQ,["x","y","z"], internal_ordering=:degrevlex) F = [x^2+1-3, x*y-z, x*z^2-3*y^2] cmp = (Int32[2, 2, 2], BigInt[1, 1, -2, 1, 1, 1, -1, 1, 1, 1, -3, 1], Int32[2, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0]) @test AlgebraicSolving._convert_to_msolve(F) == cmp for _GF in [GF, AlgebraicSolving.Nemo.Native.GF] - R, (x,y,z) = polynomial_ring(_GF(2147483659),["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(_GF(2147483659),["x","y","z"], internal_ordering=:degrevlex) F = [x^2+1-3, x*y-z, x*z^2-3*y^2] # prime is bigger than 2^31, should throw an error @test_throws ErrorException AlgebraicSolving._convert_to_msolve(F) - R, (x,y,z) = polynomial_ring(_GF(101),["x","y","z"], ordering=:degrevlex) + R, (x,y,z) = polynomial_ring(_GF(101),["x","y","z"], internal_ordering=:degrevlex) F = [x^2+1-3, x*y-z, x*z^2-3*y^2] res = AlgebraicSolving._convert_to_msolve(F) @test AlgebraicSolving._convert_finite_field_array_to_abstract_algebra(Int32(3), res..., R) == F