-
-
Notifications
You must be signed in to change notification settings - Fork 568
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
When a parent is equipped with an embedding, consider coercions that don't go through the embedding #14982
Comments
comment:1
Apparently, the problem is more general stems from the policy of In the special case of this ticket, a workaround would be to revert part of a3c5958 so that the
(I didn't check whether this breaks anything else.) But the same issue potentially affects anything constructed over a base ring with
and at worst the construction itself fails (well, I'm assuming it's the same issue as above, but I didn't check in detail):
|
Changed keywords from none to embedding |
Author: Marc Mezzarobba |
Branch: u/mmezzarobba/coerce_embeddings |
comment:3
Here's an attempt to fix the problem with a small change to the coercion discovery algorithm. It does break a few things, but I'd argue it only does so by exposing weaknesses in existing code. The other patches in the series fix (or, in one case, work around) these weaknesses. See the commit messages for details. What do the experts say? |
comment:5
Replying to @mezzarobba:
I couldn't tell, unless you give me a pointer to the new workfow. What do I need to do, when not a patch but a brunch (aaahm, branch...) is given? |
comment:6
Replying to @simon-king-jena:
For example, when I look at the "commits" link, I see that there are three commits, and only one of them seems to refer to this ticket. So, what do I do with the other commits, review-wise? I see that there is a discussion on sage-git on the question what exactly is to be reviewed. Would I only review the last commit (since its commit message refers to this ticket)? Would I review all three commits (but then I would potentially also review dependencies that are reviewed elsewhere!)? |
comment:7
Replying to @simon-king-jena:
If you already have a git-based installation of sage (i.e. you once did something like Otherwise, hmm, I guess it is easier to set up a git-based installation than to try to do the review with Mercurial... See If the branch was based off an old version of sage, I guess you might also want to check that it merges cleanly, but here it is already a descendant of the last beta.
All three commits need review, and none of them is part of any other ticket. I am not sure if/where the ticket number should go in the commit logs (perhaps it would make more sense to put it in the message associated to the merge commit?). The last commit of the branch is also the one that fixes the issue the ticket is about, so I put it here, but I can rewrite history to add it to the two other commits if you want. |
comment:8
Replying to @mezzarobba:
I have. But at least on one of my machines I get several doctest errors with the latest git version.
I did store my ssh keys on trac. But "having a remote" sounds like I need to inform git about the existence of the trac server.
I hope the meaning and how-to of "fetch" and "checkout" will be clear to me from the git-developer-guide.
I saw this (or an old version) before, which made me register my ssh keys, for example.
No idea about this. From the discussion on sage-git, it seems to me that the git branches can be totally orthogonal to what one used to do with patches. A branch may span over different tickets, and it is totally unclear from the commits themselves which of them belong to a ticket and which of them belong to a dependency. That's bad for reviewing. In the old model, one would talk about a list of patches attached to the ticket, which makes it crystal clear what ticket a patch belongs to. |
comment:9
Replying to @mezzarobba:
It fails totally, it seems. Namely, in my git install of sage (which I kept up to date by
|
comment:10
Replying to @simon-king-jena:
Sorry, I always use git directly and didn't realize that de developer guide presented the custom devel scripts first. |
comment:11
(It looks like you got most of this sorted out, based on you posts on sage-git. I'm replying anyway just in case; please feel free to ask for more detail!) Replying to @simon-king-jena:
Yes. These are rather minor issues that are handled elsewhere.
Yes:
(With this setup,
If you want to prepare a reviewer patch, you will need to:
A git branch is just a pointer to a commit (and thus implicitly to everything that precedes it history-wise). So in some sense it every branch spans the whole history of sage, but otherwise a branch cannot really span several tickets. (There are several other kinds of "pointers to commits" in git. Branches are pointers to commit that move up automatically when new commits are added "on" them.)
I agree, and that's why I started this thread... |
Commit: |
New commits:
|
comment:13
Is this branch compatible with #15303? |
comment:14
Replying to @simon-king-jena:
The issues do look related, but otherwise I have no idea: I stopped working on it weeks before the discussion on #15303 started, and I haven't have time to read that thread yet. I hope to be able to work on this some time next week. |
comment:15
Replying to @mezzarobba:
I have tested that #15303 does not fix the bug from your ticket description. What I meant was: Are there merge conflicts? |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
comment:17
Replying to @simon-king-jena:
Sorry for the late reply. There were a few conflicts indeed. I did the merge, and the tests still pass, except that I'm getting a timeout with For instance:
but then:
|
comment:18
Replying to @mezzarobba:
It looks like the crashes happen in |
comment:19
Replying to @mezzarobba:
I tried again with a clean build, and I am unable to reproduce the crashes. I guess it was only a compilation problem... |
comment:52
Replying to @mezzarobba:
Here is an example:
But I guess that it should work because there always is a canonical morphism
So do not worry about this example. The version with
Actually, this last example with infinite recursion is related to coercions... so potentially there is something to dig further.
Nope. Completely unrelated. Actually, it is related in the sense that the was appearing in Vincent |
comment:53
Haha
see #18275 |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:55
Vincent, do your comments count as a review? (If so, you may want to check that I didn't do anything wrong with my last rebase.) Or are there still things to be checked/addressed? |
comment:56
Hello, I am not sure I am the best person to do the complete review. But...
Versus new version:
whereas for Vincent |
comment:58
Replying to @videlec:
Yes, I think it is, because I wanted to illustrate that the way coercions are discovered in the presence of an embedding makes it difficult to work with structures that have the “embedded” parent as a base ring, even if the parent into which it is embedded plays no role in the construction. But I wrote this comment more than 1½ years ago, so I'm not sure I remember correctly!
Sorry, I'm not sure I understand the question. Let me try to answer it anyway: the goal of these patches is to make the coercion discovery algorithm consider paths that don't start with the embedding. These paths may or may not be selected depending on each particular case.
Are these lines a copy-paste error, or did you observe a speed regression with some coercions? (On my machine, applying the morphism returned by |
comment:59
Replying to @mezzarobba:
Oops sorry. Yes, I observed a tiny regression speed of roughly 4% (120 µs vs 115 µs). Not very significant and that's the reason why I erased half of it. |
comment:60
Salut Marc, I am quite confused by the following
But elements of
So why the discovery does not choose this direct conversion map instead of going through the real lazy field? (note: this method Vincent |
comment:61
Salut Vincent, Replying to @videlec:
I think the reason is that As far as I understand, this is the intended behavior from the point of view of the coercion discovery algorithm— |
comment:62
Final remark: I understand what you are doing with the newly defined method
Could you be more precise in the documentation and precise why is it here? Vincent |
Reviewer: Vincent Delecroix |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:64
Thanks again for your comments! Replying to @videlec:
Is it better now? |
comment:65
Yep. Good for me! |
comment:66
Replying to @videlec:
Thanks a lot! |
Changed branch from u/mmezzarobba/14982-coerce_embeddings to |
Parent.discover_coerce_map_from
used to always give priority to coercions that start with applying an embedding over those provided by_coerce_map_from_
. This leads to coercion failures such as the following:This patch series modifies the coercion discovery algorithm to fix the issue, and fixes or works around a few weaknesses in existing code exposed by the change. See the individual commit messages for details.
CC: @robertwb @simon-king-jena @jpflori
Component: coercion
Keywords: embedding
Author: Marc Mezzarobba, Vincent Delecroix
Branch/Commit:
a0ac11b
Reviewer: Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/14982
The text was updated successfully, but these errors were encountered: