diff --git a/src/Ideal.jl b/src/Ideal.jl index e2f7f60a97..74bf1e68a5 100644 --- a/src/Ideal.jl +++ b/src/Ideal.jl @@ -1,9 +1,25 @@ ############################################################################### # -# Ideal constructor +# Generic functionality for ideals # ############################################################################### +############################################################################### +# +# Type and parent functions +# +############################################################################### + +# fundamental interface +@doc raw""" + ideal_type(R) + ideal_type(::Type{T}) where T + +Return the type of ideals over the given ring `R`, respectively over rings of type `T`. +""" +ideal_type(x) = ideal_type(typeof(x)) +ideal_type(T::DataType) = throw(MethodError(ideal_type, (T,))) + # We assume that the function # ideal(R::T, xs::Vector{U}) # with U === elem_type(T) is implemented by anyone implementing ideals @@ -41,7 +57,3 @@ end iszero(I::Ideal) = all(iszero, gens(I)) base_ring_type(::Type{<:IdealSet{T}}) where T <: RingElement = parent_type(T) - -# fundamental interface, to be documented -ideal_type(x) = ideal_type(typeof(x)) -ideal_type(T::DataType) = throw(MethodError(ideal_type, (T,))) diff --git a/src/generic/imports.jl b/src/generic/imports.jl index 93f4bd09ee..f4a31d801e 100644 --- a/src/generic/imports.jl +++ b/src/generic/imports.jl @@ -141,6 +141,7 @@ import ..AbstractAlgebra: gen import ..AbstractAlgebra: gens import ..AbstractAlgebra: get_cached! import ..AbstractAlgebra: hom +import ..AbstractAlgebra: ideal_type import ..AbstractAlgebra: identity_matrix import ..AbstractAlgebra: image import ..AbstractAlgebra: image_fn