Skip to content

Conversion problems when calling _groebner_basis_array from Oscar #138

@ederc

Description

@ederc

When running the following code an empty GB is computed:

using Oscar
R, (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) = polynomial_ring(QQ, [:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n,:o,:p,:q,:r,:s])
I = ideal(R,[-a*c*k+a*i*k+b*e*i-e*i*k+l,
              -b*d*k-b*f*j+b*j*k+m,
              -a*e*k-b*e*i+e*i*k+n,
              b*f*j-b*f*k+o,
              -a*i*k-b*e*i+e*i*k+p,
              b*f*j-b*j*k+q,
              b*e*i-e*i*k+r,
              -b*f*j+s
              ])
groebner_basis_f4(I,eliminate=11)

This works for AlgebraicSolving v0.10.4, but no longer for current main:

ERROR: MethodError: no method matching Union{Vector{Int32}, Vector{BigInt}}(::Vector{Any})
The type `Union{Vector{Int32}, Vector{BigInt}}` exists, but no method is defined for this combination of argument types when trying to construct it.
Stacktrace:
  [1] convert(::Type{Union{Vector{Int32}, Vector{BigInt}}}, a::Vector{Any})
    @ Base ./array.jl:614
  [2] cvt1
    @ ./essentials.jl:612 [inlined]
  [3] ntuple
    @ ./ntuple.jl:52 [inlined]
  [4] convert(::Type{Tuple{Vector{Int32}, Union{Vector{Int32}, Vector{BigInt}}, Vector{Int32}}}, x::Tuple{Vector{Int32}, Vector{Any}, Vector{Int32}})
    @ Base ./essentials.jl:614
  [5] _core_groebner_basis_array(lens::Vector{…}, cfs::Vector{…}, exps::Vector{…}, field_char::Int64; initial_hts::Int64, nr_thrds::Int64, max_nr_pairs::Int64, la_option::Int64, eliminate::Int64, complete_reduction::Bool, truncate_lifting::Int64, info_level::Int64)
    @ AlgebraicSolving ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:231
  [6] (::AlgebraicSolving.var"#12#13"{Int64, Int64, Int64, Int64, Bool, Int64, Int64, Vector{Int32}, Vector{BigInt}, Vector{Int32}, Int64})()
    @ AlgebraicSolving ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:283
  [7] _core_groebner_basis(I::AlgebraicSolving.Ideal{…}; initial_hts::Int64, nr_thrds::Int64, max_nr_pairs::Int64, la_option::Int64, eliminate::Int64, intersect::Bool, complete_reduction::Bool, normalize::Bool, truncate_lifting::Int64, worker_pool::Nothing, info_level::Int64)
    @ AlgebraicSolving ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:291
  [8] _core_groebner_basis
    @ ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:234 [inlined]
  [9] #4
    @ ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:132 [inlined]
 [10] get!(default::AlgebraicSolving.var"#4#5"{Int64, Int64, Int64, Int64, Int64, Bool, Bool, Bool, Int64, Nothing, Int64, AlgebraicSolving.Ideal{…}}, h::Dict{Int64, Vector{…}}, key::Int64)
    @ Base ./dict.jl:458
 [11] #groebner_basis#2
    @ ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:131 [inlined]
 [12] groebner_basis
    @ ~/repos/julia-depot/dev/AlgebraicSolving/src/algorithms/groebner-bases.jl:117 [inlined]
 [13] groebner_basis_f4(I::MPolyIdeal{…}; initial_hts::Int64, nr_thrds::Int64, max_nr_pairs::Int64, la_option::Int64, eliminate::Int64, complete_reduction::Bool, normalize::Bool, truncate_lifting::Int64, info_level::Int64)
    @ Oscar ~/repos/julia-depot/dev/Oscar/src/Rings/groebner/f4.jl:78
 [14] top-level scope
    @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.

The problem seems to be that having jl_ld = 0 jl_cf is set to Any[] and not BigInt[]. Setting jl_cf correspondingly solves the problem and the code returns

groebner_basis_f4(I,eliminate=11)
Gröbner basis with elements
  1: 0
with respect to the ordering
  degrevlex([l, m, n, o, p, q, r, s])

Maybe @wegank could have a look since corresponding change in behaviour was introduced by one of his PRs, so he might know best how to handle this problem.

Note that running the above example in pure AlgebraicSolving (i.e. defining the ring and ideal there, calling groebner_basis(I, eliminate=11)) works and jl_cf is of type BigInt[].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions