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

Allow evaluation of morphisms of schemes on points over different rings #32209

Closed
pjbruin opened this issue Jul 16, 2021 · 9 comments
Closed

Comments

@pjbruin
Copy link
Contributor

pjbruin commented Jul 16, 2021

In SageMath 9.3, consider the following setting:

sage: S.<x,y> = AffineSpace(ZZ, 2)
sage: T.<u,v> = AffineSpace(ZZ, 2)
sage: h = T.hom([u + v, u * v], S); h
Scheme morphism:
  From: Affine Space of dimension 2 over Integer Ring
  To:   Affine Space of dimension 2 over Integer Ring
  Defn: Defined on coordinates by sending (u, v) to
        (u + v, u*v)

The morphism h cannot be evaluated on points over F4:

sage: F.<a> = GF(4)
sage: P = T(F)(1, a)
sage: h(P)
Traceback (most recent call last):
...
TypeError: not in prime subfield
sage: h.change_ring(F)(P)
Traceback (most recent call last):
...
TypeError: (1, a) fails to convert into the map's domain Affine Space of dimension 2 over Finite Field in a of size 2^2,but a `pushforward` method is not properly implemented

There is no error when the coordinates are in the prime field, but the coordinates of the resulting point are in Z instead of F4:

sage: Q = T(F)(1, 0)
sage: Q.domain()
Spectrum of Finite Field in a of size 2^2
sage: h(Q)
(1, 0)
sage: h(Q).domain()
Spectrum of Integer Ring

Component: algebraic geometry

Author: Peter Bruin

Branch/Commit: d0c30c0

Reviewer: Lorenz Panny

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

@pjbruin pjbruin added this to the sage-9.4 milestone Jul 16, 2021
@pjbruin
Copy link
Contributor Author

pjbruin commented Jul 16, 2021

Author: Peter Bruin

@pjbruin pjbruin changed the title Allow evaluation of morphisms of affine schemes on points over different rings Allow evaluation of morphisms of schemes on points over different rings Jul 16, 2021
@pjbruin
Copy link
Contributor Author

pjbruin commented Jul 17, 2021

Branch: u/pbruin/32209-scheme_morphisms

@pjbruin
Copy link
Contributor Author

pjbruin commented Jul 17, 2021

Commit: 608f2f4

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 9, 2021
@yyyyx4
Copy link
Member

yyyyx4 commented Aug 31, 2021

comment:4

With the patch, a morphism of affine schemes now happily returns values at points which clearly do not lie in its domain:

sage: S.<x,y> = AffineSpace(ZZ, 2)
sage: T.<u,v> = AffineSpace(ZZ, 2)
sage: C = Curve(x**2+y**2-1)
sage: f = C.hom([x,y],T)
sage: P = S([123,456])
sage: f.domain().defining_polynomial()(*P)
223064
sage: f(P)
(123, 456)

The following change should fix this according to my very limited testing. It is inspired by the projective case (which did already seem to detect points outside the domain).

--- b/src/sage/schemes/affine/affine_morphism.py
+++ b/src/sage/schemes/affine/affine_morphism.py
@@ -262,7 +262,7 @@ class SchemeMorphism_polynomial_affine_space(SchemeMorphism_polynomial):
         """
         from sage.schemes.affine.affine_point import SchemeMorphism_point_affine
         if check:
-            if not isinstance(x, SchemeMorphism_point_affine):
+            if not isinstance(x, SchemeMorphism_point_affine) or self.domain() != x.codomain():
                 try:
                     x = self.domain()(x)
                 except (TypeError, NotImplementedError):

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 3, 2022

Changed commit from 608f2f4 to d0c30c0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 3, 2022

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

d0c30c0Trac 32209: additional check

@pjbruin
Copy link
Contributor Author

pjbruin commented Feb 3, 2022

comment:7

Thanks for noticing! This looks like a good fix to me.

@yyyyx4
Copy link
Member

yyyyx4 commented Feb 4, 2022

Reviewer: Lorenz Panny

@vbraun
Copy link
Member

vbraun commented Feb 12, 2022

Changed branch from u/pbruin/32209-scheme_morphisms to d0c30c0

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