# Set of homomorphisms between two schemes¶

For schemes $$X$$ and $$Y$$, this module implements the set of morphisms $$Hom(X,Y)$$. This is done by SchemeHomset_generic.

As a special case, the Hom-sets can also represent the points of a scheme. Recall that the $$K$$-rational points of a scheme $$X$$ over $$k$$ can be identified with the set of morphisms $$Spec(K) \to X$$. In Sage the rational points are implemented by such scheme morphisms. This is done by SchemeHomset_points and its subclasses.

Note

You should not create the Hom-sets manually. Instead, use the Hom() method that is inherited by all schemes.

AUTHORS:

• William Stein (2006): initial version.
• Volker Braun (2011-08-11): significant improvement and refactoring.
• Ben Hutz (June 2012): added support for projective ring
class sage.schemes.generic.homset.SchemeHomsetFactory

Factory for Hom-sets of schemes.

EXAMPLES:

sage: A2 = AffineSpace(QQ,2)
sage: A3 = AffineSpace(QQ,3)
sage: Hom = A3.Hom(A2)


The Hom-sets are unique:

sage: Hom is copy(Hom)
True
sage: Hom is A3.Hom(A2)
True
True


Here is a tricky point. The Hom-sets are not identical if domains/codomains are isomorphic but not identiacal:

sage: A3_iso = AffineSpace(QQ,3)
sage: [ A3_iso is A3, A3_iso == A3 ]
[False, True]
sage: Hom_iso = A3_iso.Hom(A2)
sage: Hom_iso is Hom
False
sage: Hom_iso == Hom
True


TESTS:

sage: Hom.base()
Integer Ring
sage: Hom.base_ring()
Integer Ring

create_key_and_extra_args(X, Y, category=None, base=Integer Ring, check=True)

Create a key that uniquely determines the Hom-set.

INPUT:

• X – a scheme. The domain of the morphisms.
• Y – a scheme. The codomain of the morphisms.
• category – a category for the Hom-sets (default: schemes over given base).
• base – a scheme or a ring. The base scheme of domain and codomain schemes. If a ring is specified, the spectrum of that ring will be used as base scheme.
• check – boolean (default: True).

EXAMPLES:

sage: A2 = AffineSpace(QQ,2)
sage: A3 = AffineSpace(QQ,3)
sage: A3.Hom(A2)    # indirect doctest
Set of morphisms
From: Affine Space of dimension 3 over Rational Field
To:   Affine Space of dimension 2 over Rational Field
sage: from sage.schemes.generic.homset import SchemeHomsetFactory
sage: SHOMfactory = SchemeHomsetFactory('test')
sage: key, extra = SHOMfactory.create_key_and_extra_args(A3,A2,check=False)
sage: key
(..., ..., Category of schemes over Integer Ring)
sage: extra
{'Y': Affine Space of dimension 2 over Rational Field,
'X': Affine Space of dimension 3 over Rational Field,
'base_ring': Integer Ring, 'check': False}

create_object(version, key, **extra_args)

Create a SchemeHomset_generic.

INPUT:

• version – object version. Currently not used.
• key – a key created by create_key_and_extra_args().
• extra_args – a dictionary of extra keyword arguments.

EXAMPLES:

sage: A2 = AffineSpace(QQ,2)
sage: A3 = AffineSpace(QQ,3)
sage: A3.Hom(A2) is A3.Hom(A2)   # indirect doctest
True
sage: from sage.schemes.generic.homset import SchemeHomsetFactory
sage: SHOMfactory = SchemeHomsetFactory('test')
sage: SHOMfactory.create_object(0, [id(A3),id(A2),A3.category()], check=True,
...                             X=A3, Y=A2, base_ring=QQ)
Set of morphisms
From: Affine Space of dimension 3 over Rational Field
To:   Affine Space of dimension 2 over Rational Field

class sage.schemes.generic.homset.SchemeHomset_generic(X, Y, category=None, check=True, base=None)

The base class for Hom-sets of schemes.

INPUT:

• X – a scheme. The domain of the Hom-set.
• Y – a scheme. The codomain of the Hom-set.
• category – a category (optional). The category of the Hom-set.
• check – boolean (optional, default=True). Whether to check the defining data for consistency.

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_generic
sage: A2 = AffineSpace(QQ,2)
sage: Hom = SchemeHomset_generic(A2, A2); Hom
Set of morphisms
From: Affine Space of dimension 2 over Rational Field
To:   Affine Space of dimension 2 over Rational Field
sage: Hom.category()
Category of hom sets in Category of Schemes

Element

alias of SchemeMorphism

natural_map()

Return a natural map in the Hom space.

OUTPUT:

A SchemeMorphism if there is a natural map from domain to codomain. Otherwise, a NotImplementedError is raised.

EXAMPLES:

sage: A = AffineSpace(4, QQ)
sage: A.structure_morphism()   # indirect doctest
Scheme morphism:
From: Affine Space of dimension 4 over Rational Field
To:   Spectrum of Rational Field
Defn: Structure map

class sage.schemes.generic.homset.SchemeHomset_points(X, Y, category=None, check=True, base=Integer Ring)

Set of rational points of the scheme.

Recall that the $$K$$-rational points of a scheme $$X$$ over $$k$$ can be identified with the set of morphisms $$Spec(K) o X$$. In Sage, the rational points are implemented by such scheme morphisms.

INPUT:

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_points
sage: SchemeHomset_points(Spec(QQ), AffineSpace(ZZ,2))
Set of rational points of Affine Space of dimension 2 over Rational Field

extended_codomain()

Return the codomain with extended base, if necessary.

OUTPUT:

The codomain scheme, with its base ring extended to the codomain. That is, the codomain is of the form $$Spec(R)$$ and the base ring of the domain is extended to $$R$$.

EXAMPLES:

sage: P2 = ProjectiveSpace(QQ,2)
sage: K.<a> = NumberField(x^2 + x - (3^3-3))
sage: K_points = P2(K);  K_points
Set of rational points of Projective Space of dimension 2
over Number Field in a with defining polynomial x^2 + x - 24

sage: K_points.codomain()
Projective Space of dimension 2 over Rational Field

sage: K_points.extended_codomain()
Projective Space of dimension 2 over Number Field in a with
defining polynomial x^2 + x - 24

value_ring()

Return $$R$$ for a point Hom-set $$X(Spec(R))$$.

OUTPUT:

A commutative ring.

EXAMPLES:

sage: P2 = ProjectiveSpace(ZZ,2)
sage: P2(QQ).value_ring()
Rational Field

class sage.schemes.generic.homset.SchemeHomset_points_abelian_variety_field(X, Y, category=None, check=True, base=Integer Ring)

Set of rational points of an abelian variety.

INPUT:

TESTS:

The bug reported at trac #1785 is fixed:

sage: K.<a> = NumberField(x^2 + x - (3^3-3))
sage: E = EllipticCurve('37a')
sage: X = E(K)
sage: X
Abelian group of points on Elliptic Curve defined by
y^2 + y = x^3 + (-1)*x over Number Field in a with
defining polynomial x^2 + x - 24
sage: P = X([3,a])
sage: P
(3 : a : 1)
sage: P in E
False
sage: P in E.base_extend(K)
True
sage: P in X.codomain()
False
sage: P in X.extended_codomain()
True

base_extend(R)

Extend the base ring.

This is currently not implemented except for the trivial case R==ZZ.

INPUT:

• R – a ring.

EXAMPLES:

sage: E = EllipticCurve('37a')
sage: Hom = E.point_homset();  Hom
Abelian group of points on Elliptic Curve defined
by y^2 + y = x^3 - x over Rational Field
sage: Hom.base_ring()
Integer Ring
sage: Hom.base_extend(QQ)
Traceback (most recent call last):
...
NotImplementedError: Abelian variety point sets are not
implemented as modules over rings other than ZZ.

class sage.schemes.generic.homset.SchemeHomset_points_affine(X, Y, category=None, check=True, base=Integer Ring)

Set of rational points of an affine variety.

INPUT:

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_points_affine
sage: SchemeHomset_points_affine(Spec(QQ), AffineSpace(ZZ,2))
Set of rational points of Affine Space of dimension 2 over Rational Field

points(B=0)

Return some or all rational points of an affine scheme.

INPUT:

• B – integer (optional, default: 0). The bound for the height of the coordinates.

OUTPUT:

• If the base ring is a finite field: all points of the scheme, given by coordinate tuples.
• If the base ring is $$\QQ$$ or $$\ZZ$$: the subset of points whose coordinates have height B or less.

EXAMPLES: The bug reported at #11526 is fixed:

sage: A2 = AffineSpace(ZZ,2)
sage: F = GF(3)
sage: A2(F).points()
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]

sage: R = ZZ
sage: A.<x,y> = R[]
sage: I = A.ideal(x^2-y^2-1)
sage: V = AffineSpace(R,2)
sage: X = V.subscheme(I)
sage: M = X(R)
sage: M.points(1)
[(-1, 0), (1, 0)]

class sage.schemes.generic.homset.SchemeHomset_points_projective_field(X, Y, category=None, check=True, base=Integer Ring)

Set of rational points of a projective variety over a field.

INPUT:

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_points_projective_field
sage: SchemeHomset_points_projective_field(Spec(QQ), ProjectiveSpace(QQ,2))
Set of rational points of Projective Space of dimension 2 over Rational Field

points(B=0)

Return some or all rational points of a projective scheme.

INPUT:

• $$B$$ – integer (optional, default=0). The bound for the coordinates.

OUTPUT:

A list of points. Over a finite field, all points are returned. Over an infinite field, all points satisfying the bound are returned.

EXAMPLES:

sage: P1 = ProjectiveSpace(GF(2),1)
sage: F.<a> = GF(4,'a')
sage: P1(F).points()
[(0 : 1), (1 : 0), (1 : 1), (a : 1), (a + 1 : 1)]

class sage.schemes.generic.homset.SchemeHomset_points_projective_ring(X, Y, category=None, check=True, base=Integer Ring)

Set of rational points of a projective variety over a commutative ring.

INPUT:

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_points_projective_ring
sage: SchemeHomset_points_projective_ring(Spec(ZZ), ProjectiveSpace(ZZ,2))
Set of rational points of Projective Space of dimension 2 over Integer Ring

points(B=0)

Return some or all rational points of a projective scheme.

INPUT:

• $$B$$ – integer (optional, default=0). The bound for the coordinates.

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_points_projective_ring
sage: H = SchemeHomset_points_projective_ring(Spec(ZZ), ProjectiveSpace(ZZ,2))
sage: H.points(3)
[(0 : 0 : 1), (0 : 1 : -3), (0 : 1 : -2), (0 : 1 : -1), (0 : 1 : 0), (0
: 1 : 1), (0 : 1 : 2), (0 : 1 : 3), (0 : 2 : -3), (0 : 2 : -1), (0 : 2 :
1), (0 : 2 : 3), (0 : 3 : -2), (0 : 3 : -1), (0 : 3 : 1), (0 : 3 : 2),
(1 : -3 : -3), (1 : -3 : -2), (1 : -3 : -1), (1 : -3 : 0), (1 : -3 : 1),
(1 : -3 : 2), (1 : -3 : 3), (1 : -2 : -3), (1 : -2 : -2), (1 : -2 : -1),
(1 : -2 : 0), (1 : -2 : 1), (1 : -2 : 2), (1 : -2 : 3), (1 : -1 : -3),
(1 : -1 : -2), (1 : -1 : -1), (1 : -1 : 0), (1 : -1 : 1), (1 : -1 : 2),
(1 : -1 : 3), (1 : 0 : -3), (1 : 0 : -2), (1 : 0 : -1), (1 : 0 : 0), (1
: 0 : 1), (1 : 0 : 2), (1 : 0 : 3), (1 : 1 : -3), (1 : 1 : -2), (1 : 1 :
-1), (1 : 1 : 0), (1 : 1 : 1), (1 : 1 : 2), (1 : 1 : 3), (1 : 2 : -3),
(1 : 2 : -2), (1 : 2 : -1), (1 : 2 : 0), (1 : 2 : 1), (1 : 2 : 2), (1 :
2 : 3), (1 : 3 : -3), (1 : 3 : -2), (1 : 3 : -1), (1 : 3 : 0), (1 : 3 :
1), (1 : 3 : 2), (1 : 3 : 3), (2 : -3 : -3), (2 : -3 : -2), (2 : -3 :
-1), (2 : -3 : 0), (2 : -3 : 1), (2 : -3 : 2), (2 : -3 : 3), (2 : -2 :
-3), (2 : -2 : -1), (2 : -2 : 1), (2 : -2 : 3), (2 : -1 : -3), (2 : -1 :
-2), (2 : -1 : -1), (2 : -1 : 0), (2 : -1 : 1), (2 : -1 : 2), (2 : -1 :
3), (2 : 0 : -3), (2 : 0 : -1), (2 : 0 : 1), (2 : 0 : 3), (2 : 1 : -3),
(2 : 1 : -2), (2 : 1 : -1), (2 : 1 : 0), (2 : 1 : 1), (2 : 1 : 2), (2 :
1 : 3), (2 : 2 : -3), (2 : 2 : -1), (2 : 2 : 1), (2 : 2 : 3), (2 : 3 :
-3), (2 : 3 : -2), (2 : 3 : -1), (2 : 3 : 0), (2 : 3 : 1), (2 : 3 : 2),
(2 : 3 : 3), (3 : -3 : -2), (3 : -3 : -1), (3 : -3 : 1), (3 : -3 : 2),
(3 : -2 : -3), (3 : -2 : -2), (3 : -2 : -1), (3 : -2 : 0), (3 : -2 : 1),
(3 : -2 : 2), (3 : -2 : 3), (3 : -1 : -3), (3 : -1 : -2), (3 : -1 : -1),
(3 : -1 : 0), (3 : -1 : 1), (3 : -1 : 2), (3 : -1 : 3), (3 : 0 : -2), (3
: 0 : -1), (3 : 0 : 1), (3 : 0 : 2), (3 : 1 : -3), (3 : 1 : -2), (3 : 1
: -1), (3 : 1 : 0), (3 : 1 : 1), (3 : 1 : 2), (3 : 1 : 3), (3 : 2 : -3),
(3 : 2 : -2), (3 : 2 : -1), (3 : 2 : 0), (3 : 2 : 1), (3 : 2 : 2), (3 :
2 : 3), (3 : 3 : -2), (3 : 3 : -1), (3 : 3 : 1), (3 : 3 : 2)]

class sage.schemes.generic.homset.SchemeHomset_points_spec(X, Y, category=None, check=True, base=None)

Set of rational points of an affine variety.

INPUT:

EXAMPLES:

sage: from sage.schemes.generic.homset import SchemeHomset_points_spec
sage: SchemeHomset_points_spec(Spec(QQ), Spec(QQ))
Set of rational points of Spectrum of Rational Field

sage.schemes.generic.homset.is_SchemeHomset(H)

Test whether H is a scheme Hom-set.

EXAMPLES:

sage: f = Spec(QQ).identity_morphism();  f
Scheme endomorphism of Spectrum of Rational Field
Defn: Identity map
sage: from sage.schemes.generic.homset import is_SchemeHomset
sage: is_SchemeHomset(f)
False
sage: is_SchemeHomset(f.parent())
True
sage: is_SchemeHomset('a string')
False


#### Previous topic

Hypersurfaces in affine and projective space

Scheme morphism