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

let the category setup handle the ideals #38821

Merged
merged 8 commits into from
Nov 3, 2024

Conversation

fchapoton
Copy link
Contributor

@fchapoton fchapoton commented Oct 17, 2024

This is removing the ideal methods in the old Ring and Field classes, moving them to the category setup.

Also removing one custom ideal method in multiple polynomial rings.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

Copy link

github-actions bot commented Oct 17, 2024

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

@fchapoton
Copy link
Contributor Author

note : the removal of "ideal" in multi-polynomial requires a careful check, as it may have hidden side-effects

@fchapoton
Copy link
Contributor Author

At first sight, it seems to be ok thanks to the _ideal_class_ method in src/sage/rings/polynomial/multi_polynomial_ring_base.pyx

Co-authored-by: Martin Rubey <axiomize@yahoo.de>
# note: we set g = gcd(g, g) to "canonicalize" the generator:
# make polynomials monic, etc.
g = g.gcd(g)
except (AttributeError, NotImplementedError, IndexError):
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to have a test for this line, in particular because IndexError was added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so far, I was not able to find a ring that pass through that case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://en.wikipedia.org/wiki/Euclidean_domain has $\mathbb R[x,y]/(x^2+y^2+1)$, but sage does not recognise it as principal ideal domain (or does $\mathbb Q$ vs $\mathbb R$ make a difference?):

sage: R.<x,y> = PolynomialRing(QQ)
sage: Q = R.quotient(x^2+y^2+1)
sage: Q in PrincipalIdealDomains()
False

Also, if I made no mistake, $\mathbb Q(\sqrt{19})$ would constitute an example of a principal ideal domain which is not Euclidean, but sage does not know it (or do I misunderstand the code?):

sage: R.<x> = QQ[]
sage: K.<a> = QQ.extension(x^2 + 19); K
Number Field in a with defining polynomial x^2 + 19
sage: K
Number Field in a with defining polynomial x^2 + 19
sage: K in PrincipalIdealDomains()
True
sage: K in EuclideanDomains()
True

(Disclaimer: I know nothing about this kind of math)

So, I guess it's best to leave it in.

Copy link
Contributor Author

@fchapoton fchapoton Oct 29, 2024

Choose a reason for hiding this comment

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

One can declare the category a posteriori

Q._refine_category_(PrincipalIdealDomains())

but then creating the ideal follows a specific code-path for quotient rings.

For the second part, I guess you mean the ring of integers rather than the number field. I tried, and there is also a specific code-path for ideals there.

@mantepse
Copy link
Collaborator

I played a little with the patch and it looks good to me. I found a bug, but that's present in develop, too:

sage: I.<x> = InfinitePolynomialRing(QQ)
sage: II = I.ideal( [x[0]^3,x[1]^3+x[0]^2, x[1]^2] )
sage: x[0]^2 in II
False
sage: I.<x0, x1> = PolynomialRing(QQ)
sage: II = I.ideal( [x0^3,x1^3+x0^2, x1^2] )
sage: x0^2 in II
True

@fchapoton fchapoton mentioned this pull request Oct 29, 2024
5 tasks
Copy link
Collaborator

@mantepse mantepse left a comment

Choose a reason for hiding this comment

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

LGTM

@fchapoton
Copy link
Contributor Author

thanks ! So positive review ?

@mantepse
Copy link
Collaborator

sorry, forgot

vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 2, 2024
    
as another step towards using `Parent` everywhere

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

Dependencies:

sagemath#38821
    
URL: sagemath#38881
Reported by: Frédéric Chapoton
Reviewer(s): Martin Rubey
@vbraun vbraun merged commit 44d924b into sagemath:develop Nov 3, 2024
22 of 28 checks passed
@fchapoton fchapoton deleted the ideal_to_cat branch November 4, 2024 07:01
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.

3 participants