Opened 12 months ago
Closed 10 months ago
#29723 closed enhancement (fixed)
inverses of ring homomorphisms
Reported by:  ghmwageringel  Owned by:  

Priority:  major  Milestone:  sage9.2 
Component:  commutative algebra  Keywords:  
Cc:  rburing, nbruin, dimpase, yzh  Merged in:  
Authors:  Markus Wageringel  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  ab60c40 (Commits, GitHub, GitLab)  Commit:  ab60c40550b9aacc101d1bbb39b4f22d5e9dfee7 
Dependencies:  #9792  Stopgaps: 
Description (last modified by )
Ticket #9792 implements inverse_image
and is_injective
for polynomial ring homomorphisms. Based on that, this ticket implements the methods
inverse
is_invertible
is_surjective
This works for morphisms of polynomial rings, quotient rings, number fields and Galois fields. Several classes of ring homomorphisms are covered.
Example:
sage: R.<x,y,z> = QQ[] sage: sigma = R.hom([x  2*y*(z*x+y^2)  z*(z*x+y^2)^2, y + z*(z*x+y^2), z], R) sage: tau = sigma.inverse(); tau Ring endomorphism of Multivariate Polynomial Ring in x, y, z over Rational Field Defn: x > y^4*z  2*x*y^2*z^2  x^2*z^3 + 2*y^3 + 2*x*y*z + x y > y^2*z  x*z^2 + y z > z sage: (tau * sigma).is_identity() True
See #9792 for more details.
Change History (15)
comment:1 Changed 11 months ago by
 Branch set to u/ghmwageringel/29723
 Commit set to 13e89803a6fc071d70c3aabe718f28bad74928f4
 Dependencies set to #9792
 Description modified (diff)
 Status changed from new to needs_review
comment:2 Changed 11 months ago by
Is there a particular reason why you raise a ZeroDivisionError
if the inverse doesn't exist? I feel like it would be better as a ValueError
(or maybe a TypeError
).
comment:3 followup: ↓ 4 Changed 11 months ago by
Mainly for consistency with morphisms between vector spaces:
sage: f = (QQ^2).hom([[1,1], [1,1]], QQ^2) sage: f.inverse() ... ZeroDivisionError: matrix morphism not invertible
Morphisms can be composed using the multiplication operator, so with respect to that operation, a ZeroDivisionError
sort of makes sense. Another option would be to raise an ArithmeticError
. I do not have a strong opinion about this matter, though.
This reminds me that we should probably add an alias __invert__
for ring homomorphisms as well, so that the syntax ~f
can be used.
comment:4 in reply to: ↑ 3 Changed 11 months ago by
Replying to ghmwageringel:
Mainly for consistency with morphisms between vector spaces:
sage: f = (QQ^2).hom([[1,1], [1,1]], QQ^2) sage: f.inverse() ... ZeroDivisionError: matrix morphism not invertibleMorphisms can be composed using the multiplication operator, so with respect to that operation, a
ZeroDivisionError
sort of makes sense. Another option would be to raise anArithmeticError
. I do not have a strong opinion about this matter, though.
I see, and I agree that it sort of makes sense. Then let us keep it as a ZeroDivisionError
.
This reminds me that we should probably add an alias
__invert__
for ring homomorphisms as well, so that the syntax~f
can be used.
Please do so. Once that is done, this will be a positive review.
comment:5 Changed 11 months ago by
 Commit changed from 13e89803a6fc071d70c3aabe718f28bad74928f4 to 85d94d28f8dd7f082cec9a749c47fc8d5a7151aa
comment:6 Changed 11 months ago by
Thank you. I have rebased the branch and implemented __invert__
 not as an alias though, as it would not work well with inheritance.
comment:7 Changed 11 months ago by
Thanks. Looks good overall, but the patchbot reports some failures:
sage t long src/sage/rings/polynomial/skew_polynomial_ring.py # 1 doctest failed sage t long src/sage/rings/polynomial/skew_polynomial_element.pyx # 3 doctests failed
Once fixed, you can set a positive review.
comment:8 Changed 11 months ago by
 Commit changed from 85d94d28f8dd7f082cec9a749c47fc8d5a7151aa to 081f79da91d52366e29d580a75a2cb451f62757c
Branch pushed to git repo; I updated commit sha1. New commits:
081f79d  29723: fix doctests of skew polynomials

comment:9 Changed 11 months ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:10 Changed 11 months ago by
 Status changed from positive_review to needs_work
Merge conflict
comment:11 Changed 11 months ago by
 Commit changed from 081f79da91d52366e29d580a75a2cb451f62757c to ab60c40550b9aacc101d1bbb39b4f22d5e9dfee7
comment:12 Changed 11 months ago by
 Status changed from needs_work to needs_review
I have resolved the conflict. Let us see what the bot says.
comment:13 Changed 11 months ago by
 Cc yzh added
comment:15 Changed 10 months ago by
 Branch changed from u/ghmwageringel/29723 to ab60c40550b9aacc101d1bbb39b4f22d5e9dfee7
 Resolution set to fixed
 Status changed from positive_review to closed
It turns out to be more convenient to implement
inverse_image
first, so this branch is now based on #9792 (kernel and inverse_image of (polynomial) ring homomorphisms).I would appreciate if someone could give these tickets a review.
New commits:
9792: ring homomorphism: inverse_image, kernel, is_injective
29723: ring homomorphism: inverse, is_invertible, is_surjective