diff --git a/docs/src/constructors.md b/docs/src/constructors.md index c1adbdaa85..519433cdf1 100644 --- a/docs/src/constructors.md +++ b/docs/src/constructors.md @@ -74,7 +74,7 @@ AbstractAlgebra.jl and explain what mathematical domains they represent. | $S = K((x))$ (to precision $n$) | `S, x = laurent_series_field(K, n, :x)` | | $S = R((x, y))$ (to precision $n$) | `S, (x, y) = laurent_polynomial_ring(R, n, [:x, :y])` | | Puiseux series ring to precision $n$ | `S, x = puiseux_series_ring(R, n, :x)` | -| Puiseux series field to precision $n$| `S, x = puiseux_series_field(R, n, :x)` | +| Puiseux series field to precision $n$| `S, x = puiseux_series_field(K, n, :x)` | | $S = K(x)(y)/(f)$ | `S, y = function_field(f, :y)` with $f\in K(x)[t]$ | | $S = \mathrm{Frac}_R$ | `S = fraction_field(R)` | | $S = R/(f)$ | `S, = residue_ring(R, f)` | diff --git a/src/LaurentPoly.jl b/src/LaurentPoly.jl index 77fdacee41..c484c69f13 100644 --- a/src/LaurentPoly.jl +++ b/src/LaurentPoly.jl @@ -39,5 +39,7 @@ julia> rand(R, -3:3, -9:9) -3*x^2 - 8*x + 4 + 3*x^-1 - 6*x^-2 + 9*x^-3 ``` """ -laurent_polynomial_ring(R::Ring, s::VarName; cached::Bool = true) = - Generic.laurent_polynomial_ring(R, Symbol(s); cached) +function laurent_polynomial_ring(R::Ring, s::VarName; cached::Bool = true) + @req !is_trivial(R) "Zero rings are currently not supported as coefficient ring." + return Generic.laurent_polynomial_ring(R, Symbol(s); cached) +end diff --git a/src/LaurentSeries.jl b/src/LaurentSeries.jl index aa29993974..5eb2e4e5ff 100644 --- a/src/LaurentSeries.jl +++ b/src/LaurentSeries.jl @@ -24,8 +24,10 @@ object `S` will be cached so that supplying the same base ring, string and precision in future will return the same parent object and generator. If caching of the parent object is not required, `cached` can be set to `false`. """ -laurent_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true) = - Generic.laurent_series_ring(R, prec, Symbol(s); cached) +function laurent_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true) + @req !is_trivial(R) "Zero rings are currently not supported as coefficient ring." + return Generic.laurent_series_ring(R, prec, Symbol(s); cached) +end @doc raw""" laurent_series_field(R::Field, prec::Int, s::VarName; cached::Bool=true) diff --git a/src/PuiseuxSeries.jl b/src/PuiseuxSeries.jl index dc90f295a8..d7add8d73d 100644 --- a/src/PuiseuxSeries.jl +++ b/src/PuiseuxSeries.jl @@ -24,8 +24,11 @@ object `S` will be cached so that supplying the same base ring, string and precision in future will return the same parent object and generator. If caching of the parent object is not required, `cached` can be set to `false`. """ -puiseux_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true) = - Generic.PuiseuxSeriesRing(R, prec, Symbol(s); cached) +function puiseux_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true) + @req !is_trivial(R) "Zero rings are currently not supported as coefficient ring." + return Generic.PuiseuxSeriesRing(R, prec, Symbol(s); cached) +end -puiseux_series_field(R::Field, prec::Int, s::VarName; cached::Bool=true) = - Generic.PuiseuxSeriesField(R, prec, Symbol(s); cached) +function puiseux_series_field(R::Field, prec::Int, s::VarName; cached::Bool=true) + return Generic.PuiseuxSeriesField(R, prec, Symbol(s); cached) +end diff --git a/src/generic/LaurentMPoly.jl b/src/generic/LaurentMPoly.jl index 2c00ddc846..150606a6c2 100644 --- a/src/generic/LaurentMPoly.jl +++ b/src/generic/LaurentMPoly.jl @@ -635,6 +635,7 @@ end ############################################################################### function laurent_polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool = true) + @req !is_trivial(R) "Zero rings are currently not supported as coefficient ring." P, x = AbstractAlgebra.polynomial_ring(R, s, cached = cached) R = LaurentMPolyWrapRing(P, cached) R, map(p -> LaurentMPolyWrap(R, p), x) diff --git a/src/generic/LaurentPoly.jl b/src/generic/LaurentPoly.jl index f50c7d858d..7c94fc57bc 100644 --- a/src/generic/LaurentPoly.jl +++ b/src/generic/LaurentPoly.jl @@ -508,6 +508,7 @@ end ############################################################################### function laurent_polynomial_ring(R::AbstractAlgebra.Ring, s::Symbol; cached::Bool = true) + @req !is_trivial(R) "Zero rings are currently not supported as coefficient ring." P, x = AbstractAlgebra.polynomial_ring(R, s, cached = cached) R = LaurentPolyWrapRing(P, cached) R, LaurentPolyWrap(R, x)