Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IsIntegralRing to return false for rings that are euclidean but not integral by changing IsUniqueFactorizationRing and IsEuclideanRing to not imply IsIntegralRing anymore #5817

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions lib/ring.gd
Original file line number Diff line number Diff line change
Expand Up @@ -491,29 +491,15 @@ DeclareOperation( "ClosureRing", [ IsRing, IsObject ] );
## <Filt Name="IsUniqueFactorizationRing" Arg='R' Type='Category'/>
##
## <Description>
## A ring <A>R</A> is called a <E>unique factorization ring</E> if it is an
## integral ring (see&nbsp;<Ref Prop="IsIntegralRing"/>),
## and every nonzero element has a unique factorization into
## A ring <A>R</A> is called a <E>unique factorization ring</E> if
## every nonzero element has a unique factorization into
## irreducible elements,
## i.e., a unique representation as product of irreducibles
## (see <Ref Oper="IsIrreducibleRingElement"/>).
## Unique in this context means unique up to permutations of the factors and
## up to multiplication of the factors by units
## (see&nbsp;<Ref Attr="Units"/>).
## <P/>
## Mathematically, a field should therefore also be a unique factorization
## ring, since every nonzero element is a unit.
## In &GAP;, however,
## at least at present fields do not lie in the filter
## <Ref Filt="IsUniqueFactorizationRing"/>,
## since operations such as <Ref Oper="Factors"/>,
## <Ref Func="Gcd" Label="for (a ring and) several elements"/>,
## <Ref Oper="StandardAssociate"/> and so on do
## not apply to fields (the results would be trivial, and not
## especially useful) and methods which require their arguments to
## lie in <Ref Filt="IsUniqueFactorizationRing"/> expect these operations
## to work.
## <P/>
## (Note that we cannot install a subset maintained method for this filter
## since the factorization of an element needs not exist in a subring.
## As an example, consider the subring <M>4 &NN; + 1</M> of the ring
Expand Down Expand Up @@ -545,7 +531,7 @@ DeclareCategory( "IsUniqueFactorizationRing", IsRing );
## <Filt Name="IsEuclideanRing" Arg='R' Type='Category'/>
##
## <Description>
## A ring <M>R</M> is called a Euclidean ring if it is an integral ring and
## A ring <M>R</M> is called a Euclidean ring if it is a non-trivial commutative ring and
## there exists a function <M>\delta</M>, called the Euclidean degree, from
## <M>R-\{0_R\}</M> into a well-ordered set (such as the nonnegative integers),
## such that for every pair <M>r \in R</M> and <M>s \in R-\{0_R\}</M> there
Expand Down Expand Up @@ -624,7 +610,7 @@ InstallSubsetMaintenance( IsIntegralRing,
InstallTrueMethod( IsIntegralRing,
IsRing and IsMagmaWithInversesIfNonzero and IsNonTrivial );
InstallTrueMethod( IsIntegralRing,
IsUniqueFactorizationRing and IsNonTrivial );
IsRing and IsCyclotomicCollection and IsNonTrivial );


#############################################################################
Expand Down
2 changes: 1 addition & 1 deletion lib/ring.gi
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ InstallMethod( IsIntegralRing,
zero := Zero( R );
for i in [1..Length(elms)] do
if elms[i] = zero then continue; fi;
for k in [i+1..Length(elms)] do
for k in [i..Length(elms)] do
if elms[k] = zero then continue; fi;
if elms[i] * elms[k] = zero then
return false;
Expand Down
34 changes: 34 additions & 0 deletions tst/testinstall/ring.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
gap> START_TEST("ring.tst");

#####################################################################
#
# Tests for IsIntegralRing
#
# Trivial ring
gap> IsIntegralRing( SmallRing(1,1) );
false

# Non-commutative ring
gap> IsIntegralRing( SmallRing(4,7) );
false

# Zero divisors on the diagonal
gap> IsIntegralRing( SmallRing(4,3) );
false

# Zero divisors not on the diagonal
gap> IsIntegralRing( Integers mod 6 );
false

# Integral rings
gap> IsIntegralRing( GF(5) );
true
gap> IsIntegralRing( Integers );
true
gap> IsIntegralRing( Rationals );
true
gap> IsIntegralRing( CF(4) );
true

#
gap> STOP_TEST( "ring.tst" );
Loading