-
-
Notifications
You must be signed in to change notification settings - Fork 559
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
Fix AttributeError in PowerSeriesRing for division #39713
base: develop
Are you sure you want to change the base?
Conversation
Note that the failure is recent. It used to work just fine. One should first find what change broke the example and then investigate how that breakage can be mitigated. Certainly, any division operation should get a chance to run through the coercion framework, so implementing a fresh It may well be possible that power series rings were previously not properly cooperating in the coercion framework and that the breakage is due to an attempt to fix this, which ended up having some flaws that need further attention. In older versions we find:
I didn't check if that is also what is actually done, but it shows that the coercion framework is perfectly capable of figuring out what operation to do. |
Thanks for the feedback! I realize |
Possibly useful piece of info, in 10.5.beta6 we still had
so it used to work by just inheriting from the normal place. The first place to look for breakage is into why that inheritance doesn't happen anymore. In fact, with git-blame the problem is quickly identified: |
Hi @nbruin, thanks for the pointer! Here’s what I found and did:
def _pseudo_fraction_field(self):
return LaurentSeriesRing(self.base_ring(), self._names[0]) Is this the right approach? Could you provide feedback on it? |
A few points:
Main takeaway: this bug is indicative of a more systemic issue and it's probably better to deal with it on a higher level. Otherwise, the responsibilities for where |
Yes, this method "_pseudo_fraction_field", whatever it does, should have a default implementation in the category of commutative rings. This is an oversight of my changes. The ultimate goal is to get rid of all the historical classes like |
@fchapoton OK, so it sounds this ticket should be repurposed to: make sure all functionality of |
@vidipsingh You should probably read https://doc.sagemath.org/html/en/reference/categories/sage/categories/primer.html since that's definitely going to be relevant. I suspect that the previous implementation:
should probably go in |
It is not reasonable to move several methods at once. Already just moving one method leads to bad surprises and more work than expected. This ticket should just be for moving "_pseudo_fraction_field". |
OK, that's useful. I guess an interesting experiment could be to see how much breaks when Looking at where Note that the breakage observed here was not detected by doctests, so this is probably machinery that has very poor test coverage. |
Thank you @nbruin and @fchapoton for your valuable feedback.
Is this approach acceptable for now, or should it incorporate |
With the investigations done on this ticket I think it's become clear that You mention you plan to propose at The change should probably look something like this: develop...nbruin:sage:_pseudo_fraction_field-on-Rings.Commutative |
This PR resolves a bug where attempting to divide a power series element, like
x/(1-z)
, inPowerSeriesRing_over_field_with_category
would result in an AttributeError due to the missing_pseudo_fraction_field
attribute. The fix ensures that operations involving division within power series rings work as expected, similar to multiplication.Fixes: #39684
📝 Checklist
⌛ Dependencies