Singular.jl: polynomial ring over a polynomial ring

Hi
I’m attempting to use a library in Julia (grobcov.lib), which expects an ideal of polynomials over a polynomial ring, for example QQ["a", "b"]["x", "y"]. My problem is how to construct such a ring in Singular. I’ve tried:

julia> R, (a, b) = polynomial_ring(QQ, ["a", "b"])
(Singular polynomial ring (QQ),(a,b),(dp(2),C), spoly{n_Q}[a, b])

julia> S, (x, y) = polynomial_ring(R, ["x", "y"])
(Singular polynomial ring (Coeffs(23)),(x,y),(dp(2),C), spoly{Singular.n_RingElem{spoly{n_Q}}}[x, y])

However, this gives problems, when I try to construct polynomials in this ring:

julia> a*x
ERROR: Unable to coerce polynomial
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] (::PolyRing{Singular.n_RingElem{spoly{n_Q}}})(p::spoly{n_Q})
   @ Singular ~/.julia/packages/Singular/N0xXX/src/poly/poly.jl:1562
 [3] try_promote
   @ ~/.julia/packages/AbstractAlgebra/KwfqS/src/NCRings.jl:43 [inlined]
 [4] promote(x::spoly{n_Q}, y::spoly{Singular.n_RingElem{spoly{n_Q}}})
   @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/KwfqS/src/NCRings.jl:50
 [5] *(x::spoly{n_Q}, y::spoly{Singular.n_RingElem{spoly{n_Q}}})
   @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/KwfqS/src/NCRings.jl:76
 [6] top-level scope
   @ REPL[31]:1

Similar error occur if I try to use a MPolyBuildCtx. Note, that I need the resulting ring to be a Singular polynomial ring, since I need to pass it to a Singular Library function, which only accepts Singular rings (see https://oscar-system.github.io/Singular.jl/stable/caller/).

Does anyone know how to get around this problem? Thanks in advance.
Bests, Andreas

I don’t think that it is possible what you want to do (which can be considered a bug in Singular.jl). But the good news is that I think you actually don’t need to do this. Here is the grobcov.lib example from https://www.singular.uni-kl.de/Manual/4-0-2/sing_957.htm#SEC1032 in Singular.jl:

julia> R, (a0, a1, a2, a3, a4) = FunctionField(QQ, ["a0", "a1", "a2", "a3", "a4"]);

julia> S, (x1, x2, x3) = polynomial_ring(R, ["x1", "x2", "x3"], ordering = :degrevlex);

julia> F = Ideal(S, [x1^4+(4*a3)*x1^3+(6*a2)*x1^2+(4*a1)*x1+(a0),
       x1^3+(3*a3)*x1^2+(3*a2)*x1+(a1),
       x2^4+(4*a3)*x2^3+(6*a2)*x2^2+(4*a1)*x2+(a0),
       x2^2+(2*a3)*x2+(a2),
       x3^4+(4*a3)*x3^3+(6*a2)*x3^2+(4*a1)*x3+(a0),
       x3+(a3)]);

julia> Singular.LibGrobcov.grobcov(F)
2-element Vector{Vector{Any}}:
 [Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (1), Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (1), Vector{Any}[[Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (0), sideal{spoly{n_transExt}}[Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (-a3^2 + a2, -a3^3 + a1, -a3^4 + a0)]]]]
 [Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (x3, x2^2, x1^3), Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (x3 + a3, x2^2 + 2*a3*x2 + a3^2, x1^3 + 3*a3*x1^2 + 3*a3^2*x1 + a3^3), Vector{Any}[[Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (-a3^2 + a2, -a3^3 + a1, -a3^4 + a0), sideal{spoly{n_transExt}}[Singular ideal over Singular polynomial ring (0,a0,a1,a2,a3,a4),(x1,x2,x3),(dp(3),C) with generators (1)]]]]

The important piece of information is that the ring r = (0,a0, ...), (x1, ...), ... means that you want to do everything over a transcendental extension, which in Singular.jl lingo means function field.

Now that is fantastic! Thank you