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

Forbid installing new implications to representations using InstallTrueMethod #3006

Merged

Conversation

ThomasBreuer
Copy link
Contributor

@ThomasBreuer ThomasBreuer commented Nov 15, 2018

(This pull request addresses a comment in issue #2818.)

Filters of type representation are intended to describe
the internal data of an object.
Thus a logical implication to such a filter makes sense only
if the implying filters are also representations.

As had be noticed by @fingolfin,
there was a now forbidden hidden implication in the library,
from IsHandledByNiceBasis to IsAttributeStoringRep.
Logically, one wants this rather the other way round,
that is, the mechanism relies on stored data and thus should be restricted
to situations where IsAttributeStoringRep is present.
I have now changed this setup accordingly, that is,
IsAttributeStoringRep is no longer implied by IsHandledByNiceBasis.
As a consequence, one Objectify call in the library had to be changed
such that IsAttributeStoringRep gets explicitly set.

(The same might happen also in packages.)

@fingolfin fingolfin added topic: library release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Nov 15, 2018
@fingolfin
Copy link
Member

fingolfin commented Nov 15, 2018

Very nice, thank you!

This fails in testpackages -- not a surprise, we already know of several packages affected by this:

As such, we'll have to wait till all packages are updated before merging this.

@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11 milestone Nov 29, 2018
@olexandr-konovalov olexandr-konovalov added the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Nov 29, 2018
Copy link
Member

@olexandr-konovalov olexandr-konovalov left a comment

Choose a reason for hiding this comment

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

I have added this PR to the list of PR blocked by packages (#2984) and added a "Do not merge label" until we will have package updates in place. At the moment, with this PR it is not even possible to load all packages because of an errors (a link to the Jenkins test available only from St Andrews is https://gap-ci.cs.st-andrews.ac.uk/view/Pull%20requests/job/GAP-pull-request-quicktest/48/).

fingolfin added a commit to gap-packages/hecke that referenced this pull request Jan 3, 2019
... to correctly model their meaning, instead of (ab)using InstallTrueMethod
to do so.

Motivated by gap-system/gap#3006
@fingolfin fingolfin modified the milestones: GAP 4.12.0, GAP 4.13.0 Feb 23, 2021
@fingolfin fingolfin force-pushed the TB_add_check_to_InstallTrueMethod branch 2 times, most recently from 2bce2a7 to 1693496 Compare December 31, 2021 00:55
@fingolfin fingolfin closed this Jun 30, 2022
@fingolfin fingolfin reopened this Jun 30, 2022
@fingolfin fingolfin modified the milestones: GAP 4.13.0, GAP 4.12.0 Jul 15, 2022
@fingolfin fingolfin closed this Aug 16, 2022
@fingolfin fingolfin reopened this Aug 16, 2022
@fingolfin fingolfin removed this from the GAP 4.12.0 milestone Aug 16, 2022
@ThomasBreuer
Copy link
Contributor Author

@zickgraf Sorry.

I am just not sure how we should proceed.

If we regard your idea as useful that attribute storing for certain objects can be forced via an implication of filters that define these objects then the current pull request makes no sense in the current form.
If we still think that concluding IsAttributeStoringRep or other representations from some combination of filters (as mentioned in the initial comment) is a bad idea then some check as proposed in the pull request should be made.

At the moment it is not clear to me what exactly we want to achieve.

@zickgraf
Copy link
Contributor

Some thoughts:

Maybe it makes sense to distinguish between "definitional implications" (i.e. what we currently do in CAP) and "acquired implications" (i.e. additional implications triggered via InstallTrueMethod). I think the former kind makes sense whereas the latter does not. Implementing the relaxation proposed above would respect this, i.e. allow the former but prevent the latter. And the problem which triggered this PR (#2818) falls into the later case, i.e. trigger an error, if I understand things correctly. So the PR would still achieve what it was supposed to.

@fingolfin
Copy link
Member

@ThomasBreuer and me discussed this on Gather. I support the idea of using the logic that an implication "A => B" where B implies a rep is OK when the same rep is already part of "A". He'll work on implementing something in this vein.

@ThomasBreuer ThomasBreuer force-pushed the TB_add_check_to_InstallTrueMethod branch 2 times, most recently from ef5ea4d to d870125 Compare December 20, 2022 17:13
Filters of type representation are intended to describe
the internal data of an object.
Thus a logical implication to such a filter makes sense only
if the implying filters are also representations.

As had be noticed by @fingolfin,
there was a now forbidden hidden implication in the library,
from `IsHandledByNiceBasis` to `IsAttributeStoringRep`.
Logically, one wants this rather the other way round,
that is, the mechanism relies on stored data and thus should be *restricted*
to situations where `IsAttributeStoringRep` is present.
I have now changed this setup accordingly, that is,
`IsAttributeStoringRep` is no longer implied by `IsHandledByNiceBasis`.
As a consequence, one `Objectify` call in the library had to be changed
such that `IsAttributeStoringRep` gets explicitly set.

(The same might happen also in packages.)
allow implications to representations that are already implied
@ThomasBreuer ThomasBreuer force-pushed the TB_add_check_to_InstallTrueMethod branch from 2fb42e3 to 45a91e4 Compare December 20, 2022 19:08
@ThomasBreuer
Copy link
Contributor Author

@zickgraf I have updated the pull request according to our discussion. Could you check whether CAP does no longer have problems with it?

@zickgraf
Copy link
Contributor

@ThomasBreuer The tests of CAP, LinearAlgebraForCAP etc. now pass with the latest commit, thanks!

One question out of curiosity: This PR (both the original and the updated version) allows installing implications of formerly unrelated representations:

gap> DeclareRepresentation( "test1", IsComponentObjectRep );
gap> DeclareRepresentation( "test2", IsComponentObjectRep );
gap> InstallTrueMethod( test2, test1 );

The documentation says

The representations to which an object belongs should form a chain and either two representations are disjoint or one is contained in the other.

Thus, I cannot see a setting where InstallTrueMethod could be used for installing new implications to representations at all, except some weird cases where one wants to declare a representation without knowing its parent yet. So maybe this PR can even be strengthened to disallow any new implications to representations? I tried this by commenting the if condition right before the error

            if not ( INFO_FILTERS[j] = FNUM_REP_KERN or
                     INFO_FILTERS[j] = FNUM_REP ) then

and the only immediate issue I found was the call to InstallTrueMethod in DeclareRepresentationKernel, which can easily be avoided by using InstallTrueMethodNewFilter as in DeclareRepresentation (I'm not sure if this has other implications).

@ThomasBreuer
Copy link
Contributor Author

@zickgraf You are right. Implications between representations should be handled in the declarations of the representations, not via InstallTrueMethod. I am going to update the pull request accordingly (although this new aspect is not covered by the title of the pull request).

Implications between representations should be handled in the declarations
of the representations, not via `InstallTrueMethod`.
@zickgraf
Copy link
Contributor

zickgraf commented Jan 9, 2023

I am going to update the pull request accordingly

Just checked it out and it seems to work perfectly :-)

although this new aspect is not covered by the title of the pull request

I think the title is misleading anyway after all the changes made. I suggest something like the following:

Forbid installing new implications to representations using InstallTrueMethod

@ThomasBreuer ThomasBreuer changed the title forbid implications from non-representations to representations Forbid installing new implications to representations using InstallTrueMethod Jan 9, 2023
@ThomasBreuer
Copy link
Contributor Author

ThomasBreuer commented Jan 9, 2023

@zickgraf Thanks for the confirmation. I have changed the title. Now the only problem is one CI test failure concerning a problem with testexpect, see issue #5309 for details.
This problem seems to be independent of the changes proposed here, thus I think that this pull request could be merged if there would be an approving review.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me!

@fingolfin fingolfin merged commit 3d191bd into gap-system:master Jan 12, 2023
@ThomasBreuer ThomasBreuer deleted the TB_add_check_to_InstallTrueMethod branch January 12, 2023 15:45
ThomasBreuer added a commit to ThomasBreuer/gap that referenced this pull request Jan 16, 2023
Since pull request gap-system#3006 go merged, the statement about the
implication installed by `InstallHandlingByNiceBasis` was not
correct.

This change addresses issue gap-system#5322.
fingolfin pushed a commit that referenced this pull request Jan 18, 2023
Since pull request #3006 go merged, the statement about the
implication installed by `InstallHandlingByNiceBasis` was not
correct.

This change addresses issue #5322.
ThomasBreuer added a commit to ThomasBreuer/gap that referenced this pull request Jan 19, 2023
- Let the filters created by `DeclareHandlingByNiceBasis` imply
  `IsFreeLeftModule`.
  This was the case before the changes from gap-system#3006, and this change fixes
  the problem described in gap-system#5322, as I had sketched in the discussion of gap-system#5325.
- Document this change (following gap-system#5325).
- Increase the rank of `IsHandledByNiceBasis` by 2.
  Then we get back to the rank before the changes from gap-system#3006.
  This way, the `\in` method with second argument in
  `IsFreeLeftModule and IsHandledByNiceBasis` is again ranked higher than
  the one with second argument `IsFreeLeftModule and IsFiniteDimensional`.
  The bug described in issue gap-system#5334 which has been found because of the
  reordering of these two methods (due to gap-system#3006)
  gets fixed via pull request gap-system#5335,
  now we can return to the better method ordering.
  (I do not like uprankings, but I have no better idea to solve this problem.)
fingolfin pushed a commit that referenced this pull request Jan 19, 2023
- Let the filters created by `DeclareHandlingByNiceBasis` imply
  `IsFreeLeftModule`.
  This was the case before the changes from #3006, and this change fixes
  the problem described in #5322, as I had sketched in the discussion of #5325.
- Document this change (following #5325).
- Increase the rank of `IsHandledByNiceBasis` by 2.
  Then we get back to the rank before the changes from #3006.
  This way, the `\in` method with second argument in
  `IsFreeLeftModule and IsHandledByNiceBasis` is again ranked higher than
  the one with second argument `IsFreeLeftModule and IsFiniteDimensional`.
  The bug described in issue #5334 which has been found because of the
  reordering of these two methods (due to #3006)
  gets fixed via pull request #5335,
  now we can return to the better method ordering.
  (I do not like uprankings, but I have no better idea to solve this problem.)
@fingolfin fingolfin added release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants