Adèles and idèles

211 views
Skip to first unread message

Mathe Hertogh

unread,
Aug 13, 2021, 6:07:25 AM8/13/21
to sage-devel
Hello everyone,

As a master's mathematics student I (allmost) finished my thesis, for which I implemented adèles and idèles in SageMath. I have written the code with the aim of including it into SageMath. It is well documented, following the SageMath guidelines, and personally I think the package fits well into SageMath.

The package can be found at GitHub: https://github.com/mathehertogh/adeles.
You can find all information on it there (as well as the thesis which it is based on).
Installing should be easy (if not: let me know!). I invite anyone interested to do this and discover the functionality by reading the documentation and experiment with the code in SageMath.

The README file and documentation index explain the four parts the package consists of:
Part 1 - Implementation of adèles and idèles
Part 2 - Profinite functions and graphs
Part 3 - Adèlic matrix factorization
Part 4 - Hilbert class field computations

I would suggest to include Part 1 into SageMath. Moreover I think Part 2 would be nice to include into SageMath as well. Parts 3 and 4 are very specialized and probably do not belong into the SageMath standard library (but if you disagree: let me know).

My main two questions for you are:
1. Do you agree on adding Part 1 to SageMath? (assuming the code is good)
2. Do you think adding Part 2 is a good idea? (assuming  the code is good)

Given at least one affirmative answer, the code should be uploaded to trac and reviewed. As it is quite some code, my plan would be to create a separate trac-ticket for each file of Part(s) 1 and/or 2. So one file would be reviewed per trac-ticket. Do you think this is a good idea?

This would require (I think) trac-tickets that depend on each other. I see a "dependencies" field when creating a new trac-ticket, so I guess this is possible. Any advice, tips or references on this would be appreciated. Also any suggestions regarding the inclusion of my code into SageMath in general would be much appreciated: this is my first contribution.

I am very interested in what you all have to say about this project and the questions asked above.

Kind regards,
Mathé Hertogh

Nils Bruin

unread,
Aug 14, 2021, 2:46:13 PM8/14/21
to sage-devel
Dear Mathé,

Congratulations on almost finishing your thesis. I trust it will just take a short stretch of time until you succeed in fully finishing your thesis (code from an unfinished thesis would be a bit of a red flag).  I'll give a bit of a general view of what the pros and cons of including code in sagemath are.

Useful new contributions to computer algebra packages come in many forms. I think two main categories are:
 A) Algorithmic contributions -- an implementation of some non-trivial algorithm (or suite of them) that allow certain computations that would be hard to do without them.
 B) Infrastructure/interface contributions - parts of the system that allow convenient and easy access to algorithms, or sometimes allow for expressing computations in a way that is closer to mathematics than what "raw" access to algorithms would allow.

For A), a valuable contribution could be a new algorithm, or an implementation of an existing algorithm. The value can come from the implementation being much faster/more efficient than other existing implementations or simply from an implementation now being available from sagemath where it first wasn't. Packaging and interfacing with existing libraries can fall in this category too, It helps if there are some "killer applications": things that a lot of people agree on that are valuable to compute, that can be done with the new contribution.

For B) I would think of things like implementing a new ring type, or for instance scheme morphisms (the underlying algorithm for most of the questions there is a groebner basis algorithm), where a lot of the value can come from being able to represent the morphism and the system checking that the data is consistent. Here too, the value comes from providing infrastructure that actually gets used. So relevance for some "killer application" comes in handy here too. There's a meta-level to B: infrastructure for implementing such systems (that's where sage's coercion framework and category framework come in)

For A) you can already make a useful contribution by providing "raw" access to the algorithm: an API that allows you to pass in the parameters exactly as the implementation requires it. The icing on the cake is then a small wrapper/translation layer that allows the input to be specified in flexible forms that are convenient to the user. Generally you want both: the convenience layer costs overhead, so it's good if there's an  option to strip it out.

I would generally not recommend B) to a novice contributor. It's where "good design" is of utmost importance and where compatibility with other design decisions in sage (themselves not necessarily optimal) is important. Design that combines room for growth as well as the room for fast code paths is also important. These are particularly things where experience of a non-mathematical nature is invaluable.

From what you describe, it sounds like your contribution has an important B) component to it: interface for ring of adeles. One way of implementing those is by doing all computations in complete local fields, and then the "adele ring" is mainly a tool for administrating those computations. Are you doing something different (it looks like you might, if you're actually providing Zhat as a projective limit on its own)? Any significant algorithmic components there? Part 3 sounds like it, possibly.

One thing I'd be worried about for the B) design of adelic rings is their close link to, in the geometric case, function fields and the computation of their Picard groups (and in the number field case too) It doesn't need to be there in the first iteration, but it's worth paying attention to the design so that no big roadblocks are created.

Finally, what are your "killer applications"?

An option other than immediate incorporation into sage would be to first let it live for a while as a separate repository. You'll be more nimble in redesigning the interface if it's necessary. Then, with more maturity and proven audience interest, incorporation in sage is an easy decision to make. It also establishes a consistency record on your side, so that more regular sagemath contributors aren't worried that this is a commit-and-run, where someone checks in a piece of code with just the right amount of work to get it past review and then isn't around anymore to fix the little things that slipped through review.

While it might seem that incorporation into sage is a good way of protecting the package from withering away in its own little repository, I think that doesn't actually help too much: discoverability in sage is only there if people know to look for it, and if it doesn't get used, incorporation into sage only adds to the maintenance burden. For you getting credit for the work: sure "code accepted into SageMath" is an OK CV-item, but a separate repo may actually provide better visibility of the code.


Mathe Hertogh

unread,
Aug 18, 2021, 12:10:00 PM8/18/21
to sage-...@googlegroups.com
Dear Nils and others,

I would put my contribution in category B: creating infrastructure for computing with adèles and idèles. 

Currently completions of number fields at finite primes are not yet implemented in sagemath and hence the bundling of such computations into an adèle ring is not possible at this point. My design is different, as you noted: I implement rings of profinite integers as projective limits of rings of integers. And based on that implementation I implemented the finite adèle ring. 
As for the idèles: there I do compute at different completions of a number field explicitly. For this I implemented the unit groups of such completions at finite primes seperately.
Indeed Part 3 is an algorithmic contribution.

As for the link to function fields and their Picard groups: I did nog take this into consideration during the design. So I would not know how easy it would to extend my code to such circumstances. 

As for the killer applications: the motivating application of these rings/groups was the computation of Part 4. Outside of that, I do not know of any applications that would benefit from this code. But as this is the first implementation of adèles/idèles in a computer algebra package (as for as I know), this is not supprising I guess.
You could view the following as an “application” as well though: letting students learning about adèles and idèles for the first time by letting them compute with them in practice using sage, just like some undergraduate courses use sage to teach about groups.

You make a valid point about leaving the repository on its own for a while. If this is how you think about it and there are no other poeple with (different) opinions, then I will let go of the plan to include the code into sagemath for now. 
But I know of at least one person that is currently trying out the code, and maybe there are also others that are still checking it out. If they have something to say about the package, I would love to hear!

Kind regards,
Mathé

--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/15ALIvGHqYs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/67b380ee-aa2e-492f-b740-495fc91abe6dn%40googlegroups.com.

TB

unread,
Aug 19, 2021, 5:06:05 PM8/19/21
to sage-...@googlegroups.com
Dear Mathé,

From a quick skim of https://github.com/mathehertogh/adeles it looks very impressive. I do not know if it is better to incorporate the code into Sage or leave it as a stand-alone package, but in case the code does live in its own repository, I would make two suggestions:

1. Upload the package into PyPI, so users can install it with a command like:
$ sage --pip install package-name
and developers will still use `git clone` for the latest development version. This should make it easier for users to try out the code.
The Sage Sample Package [1] have the basic structure for Sage packages, but in a recent thread [2] it was noted that some of the packaging advice there is somewhat outdated. Your code is only (or mostly?) in Python, so consulting the Python Packaging User Guide [3] can be more useful.

2. Have the compiled HTML docs hosted somewhere (e.g. Read the Docs, GitHub Pages, personal website, etc.). Your repository seems to have extensive docs, and similar to the first point, it would make it easier for users to see what this package provides. This should also make the docs easier to find for a search engine.

Regards,
Tomer

You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAPxwVi_J-aT%3DDZUb%3D%2BzO_LXZ3KyCnCLXuVCD5OD%2BFWi_g1eanQ%40mail.gmail.com.


Mathe Hertogh

unread,
Aug 20, 2021, 10:16:13 AM8/20/21
to sage-...@googlegroups.com
Dear Tomer,

Thank you for the tips and advice. I will definitely (try to) do both!

Regards,
Mathé

Travis Scrimshaw

unread,
Aug 26, 2021, 9:26:12 PM8/26/21
to sage-devel
One additional point about including it into Sage (as a sort of counterpoint to Nils' point about discoverability). If it is included, then it will be documented within Sage, which means it will be very likely to appear at the top of Google searches for "SageMath adéles" and we do not (currently) have some clear list of other pip installable packages that can be used in Sage. The current thing to do is to have it as an optional Sage package that takes the best of both worlds: clearly linked with Sage but being a separate package (which can remain pip installable).

I believe also sage_sample is a bit out of date on our packaging practices (this was mentioned on another thread recently).

Best,
Travis

Matthias Koeppe

unread,
Aug 26, 2021, 10:07:23 PM8/26/21
to sage-devel
I took a quick look at the packaging metadata of your package. It all looks great, but in setup.cfg you will want to make a change to the "install_requires", which currently say "sage >= 9.2". As of Sage 9.4, there is no longer a distribution package called "sage". Instead we have "sagemath-standard".

Like other have said, the way to advertise your package to Sage users is to add it as an optional "pip" package to Sage. We have done this with several user packages in the recent past, see https://trac.sagemath.org/ticket/31164
These packages then appear in the package index at https://doc.sagemath.org/html/en/reference/spkg/index.html

Peter Bruin

unread,
Sep 10, 2021, 8:45:15 AM9/10/21
to sage-devel
Dear Mathé,

From what I've seen, this is very high quality code, and in my opinion Part 1 is certainly useful enough to be included into SageMath.  As other people have already mentioned, there are two possibilities:
1) try to get the code for adèles and idèles into SageMath itself;
2) continue maintaining it as an individual package and make it as easy as possible to install (which probably means via pip).

The thing that makes it slightly harder to decide which is better is the current effort to "modularise" the SageMath library, see <https://trac.sagemath.org/ticket/29705>.  The goal is to break the library up into several (pip-installable) packages, but to keep the existing SageMath source tree.  On the one hand, this is no obstacle to including the package (at least for Part 1) in the main SageMath source; on the other hand, if SageMath will become piecewise pip-installable in the future, then presumably people will also become more used to install packages (like yours) via pip.  I guess it is up to you, as the author, to choose whether to go for 1) or 2).

Best wishes,

Peter
Op vrijdag 13 augustus 2021 om 12:07:25 UTC+2 schreef m.c.h...@gmail.com:

Vincent Delecroix

unread,
Sep 11, 2021, 7:29:07 AM9/11/21
to sage-...@googlegroups.com
And also, list it on the page

https://wiki.sagemath.org/SageMathExternalPackages
>>>>> <https://groups.google.com/d/msgid/sage-devel/67b380ee-aa2e-492f-b740-495fc91abe6dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sage-devel" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to sage-devel+...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/sage-devel/CAPxwVi_J-aT%3DDZUb%3D%2BzO_LXZ3KyCnCLXuVCD5OD%2BFWi_g1eanQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/sage-devel/CAPxwVi_J-aT%3DDZUb%3D%2BzO_LXZ3KyCnCLXuVCD5OD%2BFWi_g1eanQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "sage-devel" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/sage-devel/15ALIvGHqYs/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> sage-devel+...@googlegroups.com.
>>>>
>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/sage-devel/8807e325-2414-537f-cbf6-d0a44b7bd95c%40gmail.com
>>>> <https://groups.google.com/d/msgid/sage-devel/8807e325-2414-537f-cbf6-d0a44b7bd95c%40gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>

Mathe Hertogh

unread,
Sep 15, 2021, 4:51:13 AM9/15/21
to sage-devel
Hi all,

Let me give an update on the adèles/idèles project. The project viewed as my Master's thesis project at Leiden University is completely finished: the thesis is final and it (together with the software package) has been given a high grade.

As far as I know the software package is also finished now. In the last few weeks some poeple rose some questions which sometimes lead to small changes in the code. For example those given by Justin Walker and Matthias : thank you guys! If you have any questions/suggestions/bug reports: I am still open to all of those! Please send me an email or start an issue on the GithHub repository.

The package is now pip-installable using "sage -pip install adeles" (as suggested by Tomer and others; thank you!).

The documentation is hosted online using GitHub Pages; it can be viewed at https://mathehertogh.github.io/adeles (also suggested by Tomer).

The package is listed on https://wiki.sagemath.org/SageMathExternalPackages, thanks to Vincent.

@Peter: thank you for the praising words, I really appreciate it.

At this point I think I would like to make my package an optional SageMath package. I still have to figure out how to do this precisely. I think I will follow packaging developer guide. I will also take a look at Trac #31164 as suggested by Matthias. If you have more tips, let me know! But I think I'll manage.

If the package where to be used frequently, it may be nice to really add it to SageMath in the future. But I will leave that for now (unless people have other opinions).

Regards,
Mathé Hertogh




Op zaterdag 11 september 2021 om 13:29:07 UTC+2 schreef vdelecroix:

Mathe Hertogh

unread,
Sep 15, 2021, 4:51:32 AM9/15/21
to sage-devel
Hi all,

Let me give an update on the adèles/idèles project. The project viewed as my Master's thesis project at Leiden University is completely finished: the thesis is final and it (together with the software package) has been given a high grade.

As far as I know the software package is also finished now. In the last few weeks some poeple rose some questions which sometimes lead to small changes in the code. For example those given by Justin Walker and Matthias : thank you guys! If you have any questions/suggestions/bug reports: I am still open to all of those! Please send me an email or start an issue on the GithHub repository.

The package is now pip-installable using "sage -pip install adeles" (as suggested by Tomer and others; thank you!).

The documentation is hosted online using GitHub Pages; it can be viewed at https://mathehertogh.github.io/adeles (also suggested by Tomer).

The package is listed on https://wiki.sagemath.org/SageMathExternalPackages, thanks to Vincent.

@Peter: thank you for the praising words, I really appreciate it.

At this point I think I would like to make my package an optional SageMath package. I still have to figure out how to do this precisely. I think I will follow packaging developer guide. I will also take a look at Trac #31164 as suggested by Matthias. If you have more tips, let me know! But I think I'll manage.

If the package where to be used frequently, it may be nice to really add it to SageMath in the future. But I will leave that for now (unless people have other opinions).

Regards,
Mathé Hertogh




Op zaterdag 11 september 2021 om 13:29:07 UTC+2 schreef vdelecroix:
And also, list it on the page
Reply all
Reply to author
Forward
0 new messages