oscar-system / Oscar.jl

A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
https://www.oscar-system.org
Other
345 stars 126 forks source link

Normal form fails for ideals in GF(2)(t)[x,y] #3665

Closed simonbrandhorst closed 6 months ago

simonbrandhorst commented 6 months ago

Describe the bug Normal form throws an error

To Reproduce

julia> k = GF(2)
Prime field of characteristic 2

julia> kt,t = polynomial_ring(k,:t)
(Univariate polynomial ring in t over GF(2), t)

julia> Ft = fraction_field(kt)
Fraction field
  of univariate polynomial ring in t over GF(2)

julia> P,(x,y) = polynomial_ring(Ft,[:x,:y])
(Multivariate polynomial ring in 2 variables over fraction field, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}}[x, y])

julia> I = ideal(P,[x,y])
Ideal generated by
  x
  y

julia> rational_point_coordinates(I)
ERROR: MethodError: no method matching degree(::AbstractAlgebra.Generic.FracField{FqPolyRingElem})

Closest candidates are:
  degree(::Type{Vector{Int64}}, ::MPolyDecRingElem)
   @ Oscar ~/.julia/dev/Oscar/src/Rings/mpoly-graded.jl:941
  degree(::Type{Vector{Int64}}, ::MPolyQuoRingElem{<:MPolyDecRingElem}; check)
   @ Oscar ~/.julia/dev/Oscar/src/Rings/MPolyQuo.jl:1390
  degree(::Type{Vector{Int64}}, ::Oscar.MPolyLocRingElem{<:Ring, <:RingElem, <:MPolyDecRing}; check)
   @ Oscar ~/.julia/dev/Oscar/src/Rings/mpoly-localizations.jl:2807
  ...

Stacktrace:
  [1] _convert_to_msolve(F::Vector{AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}}})
    @ AlgebraicSolving ~/.julia/packages/AlgebraicSolving/mMBHd/src/interfaces/nemo.jl:21
  [2] _core_normal_form(F::Vector{…}, I::AlgebraicSolving.Ideal{…}; nr_thrds::Int64, info_level::Int64)
    @ AlgebraicSolving ~/.julia/packages/AlgebraicSolving/mMBHd/src/algorithms/normal-forms.jl:141
  [3] _core_normal_form
    @ ~/.julia/packages/AlgebraicSolving/mMBHd/src/algorithms/normal-forms.jl:102 [inlined]
  [4] #normal_form#7
    @ ~/.julia/packages/AlgebraicSolving/mMBHd/src/algorithms/normal-forms.jl:99 [inlined]
  [5] normal_form
    @ ~/.julia/packages/AlgebraicSolving/mMBHd/src/algorithms/normal-forms.jl:93 [inlined]
  [6] _normal_form_f4(A::Vector{AbstractAlgebra.Generic.MPoly{…}}, J::MPolyIdeal{AbstractAlgebra.Generic.MPoly{…}})
    @ Oscar ~/.julia/dev/Oscar/src/Rings/groebner.jl:1116
  [7] normal_form(A::Vector{…}, J::MPolyIdeal{…}; ordering::MonomialOrdering{…})
    @ Oscar ~/.julia/dev/Oscar/src/Rings/groebner.jl:1064
  [8] normal_form
    @ ~/.julia/dev/Oscar/src/Rings/groebner.jl:1061 [inlined]
  [9] normal_form(f::AbstractAlgebra.Generic.MPoly{…}, J::MPolyIdeal{…}; ordering::MonomialOrdering{…})
    @ Oscar ~/.julia/dev/Oscar/src/Rings/groebner.jl:1056
 [10] normal_form(f::AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{…}}, J::MPolyIdeal{AbstractAlgebra.Generic.MPoly{…}})
    @ Oscar ~/.julia/dev/Oscar/src/Rings/groebner.jl:1055
 [11] #7484
    @ ./none:0 [inlined]
 [12] iterate
    @ ./generator.jl:47 [inlined]
 [13] collect(itr::Base.Generator{Vector{AbstractAlgebra.Generic.MPoly{…}}, Oscar.var"#7484#7486"{MPolyIdeal{…}}})
    @ Base ./array.jl:834
 [14] rational_point_coordinates(I::MPolyIdeal{AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}}})
    @ Oscar ~/.julia/dev/Oscar/experimental/Schemes/SpaceGerms.jl:344
 [15] top-level scope
    @ REPL[1107]:1
Some type information was truncated. Use `show(err)` to see complete types.

Expected behavior Should compute a normal form

System (please complete the following information): Please paste the output of Oscar.versioninfo(full=true) below. If this does not work, please paste the output of Julia's versioninfo() and your Oscar version.

julia> Oscar.versioninfo(full=true)
OSCAR version 1.1.0-DEV - #sb/elliptic_surface_tests, fbf2b2e87b -- 2024-04-30 17:03:38 +0200
  combining:
    AbstractAlgebra.jl   v0.40.9
    GAP.jl               v0.10.3
    Hecke.jl             v0.30.10 - #master, 80487317d2 -- 2024-04-23 22:14:48 +0200
    Nemo.jl              v0.43.3
    Polymake.jl          v0.11.15
    Singular.jl          v0.22.6
  building on:
    Antic_jll               v0.201.500+0
    Arb_jll                 v200.2300.0+0
    Calcium_jll             v0.401.100+0
    FLINT_jll               v200.900.9+0
    GAP_jll                 v400.1200.200+9
    Singular_jll            v403.216.1602+0
    libpolymake_julia_jll   v0.11.4+0
    libsingular_julia_jll   v0.44.2+0
    polymake_jll            v400.1100.1+0
See `]st -m` for a full list of dependencies.

Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 20 × 13th Gen Intel(R) Core(TM) i7-1370P
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 15 default, 0 interactive, 1 GC (on 20 virtual cores)
Environment:
  JULIA_NUM_GC_THREADS = 1
  JULIA_NUM_THREADS = 15
Official https://julialang.org/ release

...

@ederc @afkafkafk13

simonbrandhorst commented 6 months ago

Should this really convert to MSolve?

ederc commented 6 months ago

No, there seems to be a check missing. I will have a look.

wdecker commented 6 months ago

degree refers to the degree of a homogeneous polynomial in a gradedd ring, returned as an element of the grading group. There is, however, always total_degree.

julia> k = GF(2) Prime field of characteristic 2

julia> kt,t = polynomial_ring(k,:t) (Univariate polynomial ring in t over GF(2), t)

julia> Ft = fraction_field(kt) Fraction field of univariate polynomial ring in t over GF(2)

julia> P,(x,y) = polynomial_ring(Ft,[:x,:y]) (Multivariate polynomial ring in 2 variables over fraction field, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}}[x, y])

julia> degree(x^2) ERROR: MethodError: no method matching degree(::AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}})

Closest candidates are: degree(::AbstractAlgebra.Generic.MPoly{T}, ::Int64) where T<:RingElement @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/wVuNz/src/generic/MPoly.jl:806 degree(::MPolyRingElem{T}, ::Int64) where T<:RingElement @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/wVuNz/src/MPoly.jl:372 degree(::MPolyRingElem{T}, ::MPolyRingElem{T}) where T<:RingElement @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/wVuNz/src/MPoly.jl:394 ...

Stacktrace: [1] top-level scope @ REPL[45]:1

julia> total_degree(x^2) 2

julia> P,(x,y) = graded_polynomial_ring(Ft,[:x,:y]) (Graded multivariate polynomial ring in 2 variables over fraction field, MPolyDecRingElem{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.FracFieldElem{FqPolyRingElem}}}[x, y])

julia> degree(x^2) [2]