@@ -77,7 +77,7 @@ parent_type(T::DataType) = throw(MethodError(parent_type, (T,)))
7777@doc raw """
7878 base_ring(a)
7979
80- Return base ring $R$ of given element or parent $a$.
80+ Return the internal base ring of the given element or parent $a$.
8181
8282# Examples
8383```jldoctest
@@ -101,7 +101,7 @@ base_ring(x::NCRingElement) = base_ring(parent(x))
101101@doc raw """
102102 base_ring_type(a)
103103
104- Return the type of the base ring of the given element, element type, parent or parent type $a$.
104+ Return the type of the internal base ring of the given element, element type, parent or parent type $a$.
105105
106106# Examples
107107```jldoctest
@@ -133,9 +133,52 @@ base_ring_type(x::Type{<:ModuleElem}) = base_ring_type(parent_type(x))
133133base_ring_type (x:: Type{<:Ideal} ) = base_ring_type (parent_type (x))
134134base_ring_type (T:: DataType ) = throw (MethodError (base_ring_type, (T,)))
135135
136- # generic coefficient_ring method
136+ @doc raw """
137+ coefficient_ring(a)
138+
139+ Return the coefficient ring of the given element or parent $a$.
140+
141+ # Examples
142+ ```jldoctest
143+ julia> R, x = polynomial_ring(QQ, :x)
144+ (Univariate polynomial ring in x over rationals, x)
145+
146+ julia> coefficient_ring(x^2+1) == QQ
147+ true
148+
149+ julia> S, (z,w) = universal_polynomial_ring(QQ, [:z,:w])
150+ (Universal Polynomial Ring over Rationals, AbstractAlgebra.Generic.UnivPoly{Rational{BigInt}}[z, w])
151+
152+ julia> coefficient_ring(S) == QQ
153+ true
154+ ```
155+ """
156+ function coefficient_ring end
137157coefficient_ring (x:: NCRingElement ) = coefficient_ring (parent (x))
138158
159+ @doc raw """
160+ coefficient_ring_type(a)
161+
162+ Return the type of the coefficient ring of the given element, element type, parent or parent type $a$.
163+
164+ # Examples
165+ ```jldoctest
166+ julia> R, x = polynomial_ring(ZZ, :x)
167+ (Univariate polynomial ring in x over integers, x)
168+
169+ julia> coefficient_ring_type(R) == typeof(coefficient_ring(R))
170+ true
171+
172+ julia> coefficient_ring_type(zero(R)) == typeof(coefficient_ring(zero(R)))
173+ true
174+
175+ julia> coefficient_ring_type(typeof(R)) == typeof(coefficient_ring(R))
176+ true
177+
178+ julia> coefficient_ring_type(typeof(zero(R))) == typeof(coefficient_ring(zero(R)))
179+ true
180+ ```
181+ """
139182coefficient_ring_type (x) = coefficient_ring_type (typeof (x))
140183coefficient_ring_type (x:: Type{<:NCRingElement} ) = coefficient_ring_type (parent_type (x))
141184coefficient_ring_type (x:: Type{<:ModuleElem} ) = coefficient_ring_type (parent_type (x))
0 commit comments