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

Delete _check_rank_two method for Drinfeld modules #38199

Merged
merged 4 commits into from
Jul 24, 2024

Conversation

kryzar
Copy link
Contributor

@kryzar kryzar commented Jun 11, 2024

This method does nothing if the Drinfeld module has rank two, and raises an exception otherwise. It was introduced in the first version of the implementation, when some methods were only available for the rank two case (e.g. frobenius_trace, frobenius_norm, etc). A grep reveals that the method is never called, which makes it useless. Therefore, I propose to remove it.

Copy link

github-actions bot commented Jun 11, 2024

Documentation preview for this PR (built with commit 7de3be5; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Member

@DavidAyotte DavidAyotte left a comment

Choose a reason for hiding this comment

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

I agree about this change, however you cannot remove it right away. It should first go through the deprecation process of SageMath (see the developer's manual, especially the "Any other case"). This means that the method should display a deprecation message and this message should be there for at least a whole year after the first stable release where the deprecation was implemented.

This is mainly because the method is still accessible by the user (even if it's not visible in the manual):

sage: A = GF(5)['T']; K.<T> = Frac(A)
sage: phi = DrinfeldModule(A, [K.gen(), 1])
sage: phi._check_rank_two()
Traceback (most recent call last):
...
NotImplementedError: rank must be 2

Since there is no way of knowing if a silly user has already used it, we need to warn them that the method will be removed. In the deprecation message, you can suggest an alternative.

@kryzar
Copy link
Contributor Author

kryzar commented Jun 12, 2024

I agree about this change, however you cannot remove it right away. It should first go through the deprecation process of SageMath (see the developer's manual, especially the "Any other case"). This means that the method should display a deprecation message and this message should be there for at least a whole year after the first stable release where the deprecation was implemented.

This is mainly because the method is still accessible by the user (even if it's not visible in the manual):

sage: A = GF(5)['T']; K.<T> = Frac(A)
sage: phi = DrinfeldModule(A, [K.gen(), 1])
sage: phi._check_rank_two()
Traceback (most recent call last):
...
NotImplementedError: rank must be 2

Since there is no way of knowing if a silly user has already used it, we need to warn them that the method will be removed. In the deprecation message, you can suggest an alternative.

Right, thanks. But does that also apply to methods whose name starts with an underscore?

@DavidAyotte
Copy link
Member

Right, thanks. But does that also apply to methods whose name starts with an underscore?

I have no idea, but I think it's safer (mais plus chiant) to let it go through the deprecation process.

@grhkm21
Copy link
Contributor

grhkm21 commented Jun 13, 2024

Nope, underscore methods are meant for development and don't need to go through deprecation process, see this comment

@DavidAyotte
Copy link
Member

Nope, underscore methods are meant for development and don't need to go through deprecation process, see this comment

hmm I'm not entirely convinced by this since you are just cherry-picking a GitHub comment and I still think it is safer to deprecate any change to a method (internal or not), but I don't have much difficulty in believing that no one ever used the _check_rank_two method.

@kryzar
Copy link
Contributor Author

kryzar commented Jun 13, 2024

OK. I did not find anything more official. I think that a dev. should be allowed to remove any private or semi-private callable without any deprecation, but I agree with David that the development guide is ambiguous. We can put a deprecation warning and bring that issue to some other members of the community (in a separate issue, and not on this PR!), as to have a more official stance, and put it in the manual.

Note also that the dev. guide that the number of the deprecation refers to a PR:

Each deprecation warning contains the number of the GitHub PR that defines it. We use 666 in the examples below. For each entry, consult the function’s documentation for more information on its behaviour and optional arguments.

while in reality it refers to an issue:

sage: Fq = GF(2)
sage: K.<z> = Fq.extension(2)
sage: A.<T> = Fq[]
sage: phi = DrinfeldModule(A, [z, 0, 1])
sage: phi._check_rank_two()
<ipython-input-5-5cc38fb8d306>:1: DeprecationWarning: This semi-private method should not be used. It will be removed.
See https://github.com/sagemath/sage/issues/38199 for details.
  phi._check_rank_two()
sage:

This can be fixed, but is probably tedious (lots of things to replace in $SAGE_INSTALL/src/sage/misc/superseded.py, which I don't have the time to do now or anytime soon).

@kryzar
Copy link
Contributor Author

kryzar commented Jun 13, 2024

Opened #38211.

@xcaruso
Copy link
Contributor

xcaruso commented Jun 25, 2024

After the discussion of issue #38211, I think that you can remove safely the method without any deprecation.

Copy link
Member

@DavidAyotte DavidAyotte left a comment

Choose a reason for hiding this comment

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

LGTM

@kryzar
Copy link
Contributor Author

kryzar commented Jun 27, 2024

(It seems that the failing doctests are not related to Drinfeld modules: https://github.com/sagemath/sage/actions/runs/9669672715/job/26676699605?pr=38199#step:10:9571)

@vbraun vbraun merged commit 1b436ab into sagemath:develop Jul 24, 2024
20 of 22 checks passed
@kryzar kryzar deleted the check_rank_two branch July 24, 2024 21:28
@mkoeppe mkoeppe added this to the sage-10.5 milestone Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants