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

kernel and inverse_image of (polynomial) ring homomorphisms #9792

Closed
vbraun opened this issue Aug 24, 2010 · 18 comments
Closed

kernel and inverse_image of (polynomial) ring homomorphisms #9792

vbraun opened this issue Aug 24, 2010 · 18 comments

Comments

@vbraun
Copy link
Member

vbraun commented Aug 24, 2010

For polynomial ring homomorphisms, this ticket implements the methods

  • inverse_image (of both ideals and individual elements)
  • kernel
  • is_injective
  • _graph_ideal

(This also works for homomorphisms of polynomial quotient rings, number fields and Galois fields.)


The implementation is based on the following:

Given a homomorphism f: K[x] -> K[y] of (multivariate) polynomial rings that respects the K-algebra structure, we can find preimages of y by computing normal forms modulo the graph ideal (x-f(x)) in K[y,x] with respect to an elimination order. More generally, this works for morphisms of quotient rings K[x]/I -> K[y]/J, which allows to handle many types of ring homomorphisms in Sage.

References: e.g. [BW1993] Propositions 6.44, 7.71; or Decker-Schreyer, Proposition 2.5.12 and Exercise 2.5.13.

See also #29723 (inverses of ring homomorphisms) and related posts on the mailing list and at Ask-Sagemath.


Example:

sage: R.<s,t> = PolynomialRing(QQ)
sage: S.<x,y,z,w> = PolynomialRing(QQ)
sage: f = S.hom([s^4, s^3*t, s*t^3, t^4],R)
sage: f.inverse_image(R.ideal(0))
Ideal (y*z - x*w, z^3 - y*w^2, x*z^2 - y^2*w, y^3 - x^2*z) of Multivariate Polynomial Ring in x, y, z, w over Rational Field
sage: f.inverse_image(s^3*t^4*(s+t))
x*w + y*w

Note that the inverse image of ideals (but not of elements) could also be computed using Singular as follows:

sage: singular.eval('''
....:         ring R=0,(s,t),dp;
....:         ring S=0,(x,y,z,w),dp;
....:         setring R;
....:         map f=S,ideal(s^4,s^3*t,s*t^3,t^4);
....:         setring S;
....:         ideal ker=kernel(R,f)
....:       ''');
sage: singular.get('ker')
'yz-xw,\nz3-yw2,\nxz2-y2w,\ny3-x2z'
sage: print(_)
yz-xw,
z3-yw2,
xz2-y2w,
y3-x2z

CC: @dimpase

Component: algebra

Author: Markus Wageringel

Branch/Commit: fd6dee6

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/9792

@vbraun

This comment has been minimized.

@mwageringel

This comment has been minimized.

@mwageringel
Copy link

Branch: u/gh-mwageringel/9792

@mwageringel
Copy link

New commits:

ad0dc039792: ring homomorphism: inverse_image, kernel, is_injective

@mwageringel
Copy link

Commit: ad0dc03

@mwageringel
Copy link

Author: Markus Wageringel

@mwageringel mwageringel changed the title kernel and inverse_image of (polynomial) ring maps kernel and inverse_image of (polynomial) ring homomorphisms Jun 1, 2020
@mwageringel mwageringel added this to the sage-9.2 milestone Jun 1, 2020
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2020

Changed commit from ad0dc03 to 0484b3b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

0484b3b9792: fix a detail

@tscrim
Copy link
Collaborator

tscrim commented Jun 2, 2020

comment:5

In RingHomomorphism_cover._inverse_image_element, you forgot the EXAMPLES:: (and indentation).

Should we also implement a (lib)singular version of the kernel for ideals? Or did you do this already and saw that it was slower?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2020

Changed commit from 0484b3b to fd6dee6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2020

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

fd6dee69792: fix some details

@mwageringel
Copy link

comment:7

Replying to @tscrim:

Should we also implement a (lib)singular version of the kernel for ideals? Or did you do this already and saw that it was slower?

It would probably be good to wrap the Singular functions kernel and preimage, yes. I have not compared it in terms of speed yet, mainly because I thought that I needed to implement the graph ideal in Sage anyway in order to compute inverses of elements. However, I have just noticed that the Singular function algebra_containment can be used for that, which I had overlooked before. I will try to figure out how to call it from Sage and then report back.

Possibly this means that this branch can be refactored such that it only wraps Singular functions, instead of constructing the graph ideal in Sage, unless we want to keep it for more control over the Gröbner basis computations.

Here is Singular code for the example from the description:

> LIB "algebra.lib";
> ring S = 0, (s,t), dp;
> ideal A = ideal(s^4, s^3*t, s*t^3, t^4);
> poly p = s^3*t^4*(s+t);
> list L = algebra_containment(p, A, 1);
> L[1];
1
> def T = L[2]; setring T; check;
y(1)*y(4)+y(2)*y(4)

@tscrim
Copy link
Collaborator

tscrim commented Jun 3, 2020

comment:8

Replying to @mwageringel:

Replying to @tscrim:

Should we also implement a (lib)singular version of the kernel for ideals? Or did you do this already and saw that it was slower?

It would probably be good to wrap the Singular functions kernel and preimage, yes. I have not compared it in terms of speed yet, mainly because I thought that I needed to implement the graph ideal in Sage anyway in order to compute inverses of elements. However, I have just noticed that the Singular function algebra_containment can be used for that, which I had overlooked before. I will try to figure out how to call it from Sage and then report back.

Possibly this means that this branch can be refactored such that it only wraps Singular functions, instead of constructing the graph ideal in Sage, unless we want to keep it for more control over the Gröbner basis computations.

We will probably want to have both so we can have it for both generic polynomials (over more exotic base fields (integral domains?)) and specialized code for those implemented using Singular (and less back-and-forth between Singular and Sage).

@mwageringel
Copy link

comment:10

Implementing this via the libsingular interface is a lot more complicated than I anticipated. It is not currently possible to use Sage's singular_function with the Singular type qring, and quotient rings in Sage are not even backed by qrings in Singular. This means it is not currently possible to use the Singular function algebra_containment with quotient rings via libsingular, but only with polynomial rings.

The implementation of algebra_containment is essentially the same as on this branch. The main difference is that algebra_containment uses the Singular function std for Gröbner basis computations whereas Sage uses the general purpose function groebner, which does some preprocessing and then calls a suitable implementation. As such, the computation times can be quite different. The Singular version is often a bit faster, but when computing preimages of many elements, the caching in the Sage version seems to be more effective.

The implementation of the Singular function preimage is a bit less transparent to me, so it might be more interesting to wrap this. In this case, by switching to the ambient ring, one can work around the problem that the qring type is not supported. However, I still did not manage to call preimage via libsingular, as it requires the ideals passed as arguments to have names, which our ideals apparently do not have.

The other option is to use the Singular pexpect interface to wrap preimage and algebra_containment. Though, as the current branch is functional, I would prefer to not implement that on this ticket here, so I am setting this back to needs_review.

@tscrim
Copy link
Collaborator

tscrim commented Jun 13, 2020

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Jun 13, 2020

comment:11

That is too bad. Thank you for trying. I agree that we should get this into Sage now, and we can revisit using libsingular later.

@mwageringel
Copy link

comment:12

Thank you.

@vbraun
Copy link
Member Author

vbraun commented Jun 22, 2020

Changed branch from u/gh-mwageringel/9792 to fd6dee6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants