File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -426,19 +426,18 @@ end
426426iszero (x:: MPolyRingElem{T} ) where T <: RingElement = length (x) == 0
427427
428428function is_unit (f:: T ) where {T <: MPolyRingElem }
429- # for constant polynomials we delegate to the coefficient ring:
430- is_constant (f) && return is_unit (constant_coefficient (f))
431- # Here deg(f) > 0; over an integral domain, non-constant polynomials are never units:
432- is_domain_type (T) && return false
433429 # A polynomial over a commutative ring is a unit iff its
434430 # constant term is a unit and all other coefficients are nilpotent:
435431 # see e.g. <https://kconrad.math.uconn.edu/blurbs/ringtheory/polynomial-properties.pdf> for a proof.
432+ ! is_unit (constant_coefficient (f)) && return false
433+ # for constant polynomials we are done now
434+ is_constant (f) && return true
435+ # over a domain, non-constant polynomials are never units
436+ is_domain_type (T) && return false
437+ # remains to check the non-constant non-zero terms have nilpotent coefficients
436438 for (c, expv) in zip (coefficients (f), exponent_vectors (f))
437- if is_zero (expv)
438- is_unit (c) || return false
439- else
440- is_nilpotent (c) || return false
441- end
439+ is_zero (expv) && continue # skip constant term
440+ is_nilpotent (c) || return false
442441 end
443442 return true
444443end
You can’t perform that action at this time.
0 commit comments