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

Bugfix and test for IsIntegralRing #3976

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

olexandr-konovalov
Copy link
Member

@olexandr-konovalov olexandr-konovalov commented Apr 22, 2020

Two bugfixes and test for IsIntegralRing

The first one fixes an off-by-one error causing missing the case when zero appears in the diagonal in the multiplication table.

The second one removes true method for IsEuclideanRing which was added in commit 0f9c104 and caused IsIntegralRing wrongly return true e.g. for Integers mod 6,
as reported in #3975.

Closes #3975.

@olexandr-konovalov olexandr-konovalov added backport-to-4.11 do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Apr 22, 2020
@coveralls
Copy link

coveralls commented Apr 22, 2020

Coverage Status

Coverage increased (+0.005%) to 84.336% when pulling e8501d7 on alex-konovalov:fix-IsIntegralRing into 86c4135 on gap-system:master.

@olexandr-konovalov olexandr-konovalov removed the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Apr 22, 2020
lib/ring.gd Outdated
@@ -623,8 +623,6 @@ InstallSubsetMaintenance( IsIntegralRing,

InstallTrueMethod( IsIntegralRing,
IsRing and IsMagmaWithInversesIfNonzero and IsNonTrivial );
InstallTrueMethod( IsIntegralRing,
IsUniqueFactorizationRing and IsNonTrivial );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But according to the documentation for IsUniqueFactorizationRing, this is correct! If we make this change, we also ought to change the documentation.

But I think the true cause is elsewhere. As I commented on #3975, the commit which introduced this regression is 0f9c104 and it adds another implication which might be the root cause:

InstallTrueMethod(IsEuclideanRing, IsZmodnZObjNonprimeCollection and
    IsWholeFamily and IsRing);

Indeed, I overlooked that the documentation for IsEuclideanRing says:

A ring R is called a Euclidean ring if it is an integral ring

Oops. So that implication is the culprit.

That said, I think it is unfortunate that we define euclidean rings as being integral. So right now I think the quick fix would be to remove the implication I added, but the better fix would be to change the documentation and implications for IsEuclideanRing.

I now have a meeting but can look at this later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, no, quick fix does not work: just removing the implication causes this:

Error, required filters [ "IsListOrCollection", "IsCollection", "IsFinite", "HasIsFinite", "IsWholeFamily", "HasIsWholeFamily", 
  "IsDuplicateFree", "HasIsDuplicateFree", "IsExtAElement", "CategoryCollections(IsExtAElement)", 
  "CategoryCollections(IsNearAdditiveElement)", "CategoryCollections(IsNearAdditiveElementWithZero)", 
  "CategoryCollections(IsNearAdditiveElementWithInverse)", "CategoryCollections(IsAdditiveElement)", 
  "IsExtLElement", "CategoryCollections(IsExtLElement)", "IsExtRElement", "CategoryCollections(IsExtRElement)", 
  "CategoryCollections(IsMultiplicativeElement)", "CategoryCollections(IsMultiplicativeElementWithOne)", 
  "CategoryCollections(IsMultiplicativeElementWithInverse)", "CategoryCollections(IsAssociativeElement)", 
  "CategoryCollections(IsAdditivelyCommutativeElement)", "CategoryCollections(IsCommutativeElement)", 
  "IsGeneralizedDomain", "IsMagma", "IsAssociative", "HasIsAssociative", "IsCommutative", "HasIsCommutative", 
  "IsGeneratorsOfSemigroup", "HasIsGeneratorsOfSemigroup", "IsNearAdditiveMagma", "IsNearAdditiveMagmaWithZero", 
  "IsNearAdditiveGroup", "IsAdditivelyCommutative", "HasIsAdditivelyCommutative", "IsLDistributive", 
  "HasIsLDistributive", "IsRDistributive", "HasIsRDistributive", "CategoryCollections(IsZmodnZObjNonprime)" ]
for 1st argument do not match a declaration of EuclideanDegree called from
<<compiled GAP code>> from GAPROOT/lib/oper1.g:338 in function InstallMethod called from

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, IsIntegralRing is what is usually called integral domain (but domain has a technical meaning in GAP). I thus do not see the problem with Euclidean rings being defined to be integral, respectively why should Z/6Z be Euclidean?

Copy link
Member

@fingolfin fingolfin Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @fieker explained below, I'd turn the question around: I see no reason why one should restrict "euclidean rings" to be integral, this is arbitrary.

Alexander Konovalov added 2 commits April 22, 2020 18:56
This fixes an off-by-one error causing missing the case
when zero appears in the diagonal in the multiplication table.

Closes gap-system#3975.
It was added in commit 0f9c104 and
caused IsIntegralRing wrongly return 'true' e.g. for Integers mod 6,
as reported in gap-system#3975.
@fieker
Copy link
Contributor

fieker commented Apr 23, 2020 via email

@hulpke
Copy link
Contributor

hulpke commented Apr 23, 2020

@fieker Thanks. I think the problematic implication (and definition implying integral) comes from the textbook definition of Euclidean Domain.

I suggest we change the definition of IsEuclideanRing and remove these implications, but to avoid confusion also introduce IsEuclideanDomain or IsEuclideanIntegralRing (and ,if we have one of them, also a distinction between PID and PIR) and then can have the implication for the domain case. There might be similar "Domain" assumptions lurking in EuclideanRing routines or implications.

@wilfwilson wilfwilson added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them topic: library labels Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong result in IsIntegralRing
6 participants