Skip to content

Commit

Permalink
Fixes multivariate division (#3396)
Browse files Browse the repository at this point in the history
* uses new divrem from Singular, fits Singular's reduce

* adds test case from issue #3105

* bump Singular to v0.22.4 for divrem2

* fixes doctests
  • Loading branch information
ederc authored Feb 27, 2024
1 parent 52a2a88 commit 2cc5013
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Preferences = "1"
Random = "1.6"
RandomExtensions = "0.4.3"
Serialization = "1.6"
Singular = "0.22.3"
Singular = "0.22.4"
TOPCOM_jll = "0.17.8"
UUIDs = "1.6"
cohomCalg_jll = "0.32.0"
Expand Down
17 changes: 6 additions & 11 deletions src/Rings/groebner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,8 @@ julia> U
[ 0 y + 1]
julia> Q
[x^3 - x*y^2*z^2 + x*y + y^2*z^2 0 y*z^2 + z^2]
[ -3*y^2*z^2 - y*z x*y + x 0]
[ x^3 - x*y^2*z^2 + x*y + y^2*z^2 0 y*z^2 + z^2]
[x*y*z^2 + y^3*z - 3*y^2*z^2 - y*z -x^2*y*z - x^2*z + x*y + x 0]
julia> H
2-element Vector{QQMPolyRingElem}:
Expand Down Expand Up @@ -798,7 +798,7 @@ julia> reduce_with_quotients_and_unit(f, F)
([1], [x*y 10*x+1], x^4 + 10*x^3 + 1)
julia> unit, M, res = reduce_with_quotients_and_unit(f, F, ordering=lex(R))
([1], [0 y^2], y^6 + 10*y^4 + 1)
([1], [x*y 0], x*y^4 + 10*y^4 + 1)
julia> M * F + [res] == unit * [f]
true
Expand Down Expand Up @@ -855,7 +855,7 @@ julia> reduce_with_quotients_and_unit(f, F)
([1], [x*y 10*x+1], x^4 + 10*x^3 + 1)
julia> unit, M, res = reduce_with_quotients_and_unit(f, F, ordering=lex(R))
([1], [0 y^2], y^6 + 10*y^4 + 1)
([1], [x*y 0], x*y^4 + 10*y^4 + 1)
julia> M * F + [res] == unit * [f]
true
Expand All @@ -881,11 +881,6 @@ Return a `Vector` which contains, for each element `g` of `G`, quotients and a r
!!! note
The returned remainders are fully reduced if `complete_reduction` is set to `true` and `ordering` is global.
!!! note
The reduction strategy behind the `reduce` function and the reduction strategy behind the functions
`reduce_with_quotients` and `reduce_with_quotients_and_unit` differ. As a consequence, the computed
remainders may differ.
# Examples
```jldoctest
Expand All @@ -898,7 +893,7 @@ julia> g = x^3*y+x^5+x^2*y^2*z^2+z^6;
julia> Q, h = reduce_with_quotients(g, [f1,f2, f3], ordering = lex(R));
julia> h
-z^9 + z^7 + z^6 + z^4
x^5 - x^3 + y^6 + z^6
julia> g == Q[1]*f1+Q[2]*f2+Q[3]*f3+h
true
Expand Down Expand Up @@ -929,7 +924,7 @@ function _reduce_with_quotients_and_unit(I::IdealGens, J::IdealGens, ordering::M
@assert base_ring(J) == base_ring(I)
sI = singular_generators(I, ordering)
sJ = singular_generators(J, ordering)
res = Singular.divrem(sI, sJ, complete_reduction=complete_reduction)
res = Singular.divrem2(sI, sJ, complete_reduction=complete_reduction)
return matrix(base_ring(I), res[3]), matrix(base_ring(I), res[1]), [J.gens.Ox(x) for x = gens(res[2])]
end

Expand Down
7 changes: 7 additions & 0 deletions test/Rings/groebner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
@test q * F + [r] != [f]
u, q, r = reduce_with_quotients_and_unit(f, F, ordering=neglex(R))
@test q * F + [r] == u * [f]
# Issue 3105
R, (x,y,z) = QQ[:x, :y, :z]
f = x^3 - x^2*y - x^2*z + x
f1 = x^2*y - z
f2 = x*y - 1
_,r = reduce_with_quotients(f, [f1, f2], ordering = deglex(R))
@test r == x^3-x^2*z
I = ideal(R,[y^2 - x, x^3 - 2*y^2])
@test is_groebner_basis(I.gens, ordering=degrevlex(R)) == true
@test is_groebner_basis(I.gens, ordering=lex(R)) == false
Expand Down

0 comments on commit 2cc5013

Please sign in to comment.