# HG changeset patch
# User Volker Braun
# Date 1329691392 28800
# Node ID 26e5ba57a4fcab4ed9adbd392c0ad66c1a108154
# Parent e7de36bc238097cde068ff033d5c3791cdfe134b
Trac #11599: Toric morphisms
Fixes for various issues that the reviewer brought up
diff --git a/doc/en/reference/schemes.rst b/doc/en/reference/schemes.rst
--- a/doc/en/reference/schemes.rst
+++ b/doc/en/reference/schemes.rst
@@ -16,13 +16,12 @@
sage/schemes/generic/ambient_space
sage/schemes/generic/affine_space
sage/schemes/generic/projective_space
- sage/schemes/generic/toric_variety
- sage/schemes/generic/fano_toric_variety
+ sage/schemes/generic/toric_variety
+ sage/schemes/generic/fano_toric_variety
sage/schemes/generic/toric_variety_library
sage/schemes/generic/toric_divisor
sage/schemes/generic/toric_chow_group
sage/schemes/generic/toric_ideal
- sage/schemes/generic/toric_morphism
sage/schemes/generic/algebraic_scheme
sage/schemes/generic/hypersurface
diff --git a/sage/schemes/generic/algebraic_scheme.py b/sage/schemes/generic/algebraic_scheme.py
--- a/sage/schemes/generic/algebraic_scheme.py
+++ b/sage/schemes/generic/algebraic_scheme.py
@@ -521,6 +521,29 @@
"""
return "Subscheme of %s"%self.__A
+ def _homset(self, *args, **kwds):
+ """
+ Construct the Hom-set
+
+ INPUT:
+
+ Same as :class:`sage.schemes.generic.homset.SchemeHomset_generic`.
+
+ OUTPUT:
+
+ The Hom-set of the ambient space.
+
+ EXAMPLES::
+
+ sage: P1. = toric_varieties.P1()
+ sage: type(P1.Hom(P1))
+
+ sage: X = P1.subscheme(x-y)
+ sage: type(X.Hom(X))
+
+ """
+ return self.__A._homset(*args, **kwds)
+
def _point_homset(self, *args, **kwds):
return self.__A._point_homset(*args, **kwds)
@@ -2068,11 +2091,11 @@
INPUT:
- same as for
- :class:`~sage.schemes.generic.morphism.SchemeMorphism_polynomial_toric_variety`.
+ :class:`~sage.schemes.generic.toric_morphism.SchemeMorphism_polynomial_toric_variety`.
OUPUT:
- - :class:`~sage.schemes.generic.morphism.SchemeMorphism_polynomial_toric_variety`.
+ - :class:`~sage.schemes.generic.toric_morphism.SchemeMorphism_polynomial_toric_variety`.
TESTS::
@@ -2082,6 +2105,15 @@
Defining z0, z1, z2, z3
sage: P1 = P1xP1.subscheme(z0-z2)
sage: H = P1.Hom(P1xP1)
+ sage: H([z0,z1,z0,z3])
+ Scheme morphism:
+ From: Closed subscheme of 2-d toric variety
+ covered by 4 affine patches defined by:
+ z0 - z2
+ To: 2-d toric variety covered by 4 affine patches
+ Defn: Defined on coordinates by sending [z0 : z1 : z2 : z3] to
+ [z2 : z1 : z2 : z3]
+
sage: P1._morphism(H, [z0,z1,z0,z3])
Scheme morphism:
From: Closed subscheme of 2-d toric variety
@@ -2094,6 +2126,23 @@
from sage.schemes.generic.toric_morphism import SchemeMorphism_polynomial_toric_variety
return SchemeMorphism_polynomial_toric_variety(*args, **kwds)
+ def fan(self):
+ """
+ Return the fan of the ambient space.
+
+ OUTPUT:
+
+ A fan.
+
+ EXAMPLES::
+
+ sage: P2. = toric_varieties.P(2)
+ sage: E = P2.subscheme([x^2+y^2+z^2])
+ sage: E.fan()
+ Rational polyhedral fan in 2-d lattice N
+ """
+ return self.ambient_space().fan()
+
def affine_patch(self, i):
r"""
Return the ``i``-th affine patch of ``self`` as an affine
diff --git a/sage/schemes/generic/scheme.py b/sage/schemes/generic/scheme.py
--- a/sage/schemes/generic/scheme.py
+++ b/sage/schemes/generic/scheme.py
@@ -22,7 +22,6 @@
#*****************************************************************************
-from sage.misc.all import cached_method
from sage.structure.parent import Parent
from sage.misc.all import cached_method
from sage.rings.all import (IntegerRing, is_CommutativeRing,
diff --git a/sage/schemes/generic/toric_homset.py b/sage/schemes/generic/toric_homset.py
--- a/sage/schemes/generic/toric_homset.py
+++ b/sage/schemes/generic/toric_homset.py
@@ -15,8 +15,64 @@
You should not create the Hom-sets manually. Instead, use the
:meth:`~sage.structure.parent.Hom` method that is inherited by all
schemes.
+
+AUTHORS:
+
+- Volker Braun (2012-02-18): Initial version
+
+EXAMPLES:
+
+Here is a simple example, the projection of
+`\mathbb{P}^1\times\mathbb{P}^1\to \mathbb{P}^1` ::
+
+ sage: P1xP1 = toric_varieties.P1xP1()
+ sage: P1 = toric_varieties.P1()
+ sage: hom_set = P1xP1.Hom(P1); hom_set
+ Set of morphisms
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: 1-d CPR-Fano toric variety covered by 2 affine patches
+
+In terms of the fan, we can define this morphism by the projection
+onto the first coordinate. The Hom-set can construct the morphism from
+the projection matrix alone::
+
+ sage: hom_set(matrix([[1],[0]]))
+ Scheme morphism:
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: 1-d CPR-Fano toric variety covered by 2 affine patches
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
+ to Rational polyhedral fan in 1-d lattice N.
+ sage: _.as_polynomial_map()
+ Scheme morphism:
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: 1-d CPR-Fano toric variety covered by 2 affine patches
+ Defn: Defined on coordinates by sending [s : t : x : y] to
+ [s : t]
+
+In the case of toric algebraic schemes (defined by polynomials in
+toric varieties), this module defines the underlying morphism of the
+ambient toric varieties::
+
+ sage: P1xP1.inject_variables()
+ Defining s, t, x, y
+ sage: S = P1xP1.subscheme([s*x-t*y])
+ sage: type(S.Hom(S))
+
"""
+
+
+#*****************************************************************************
+# Copyright (C) 2010 Volker Braun
+# Copyright (C) 2010 Andrey Novoseltsev
+#
+# Distributed under the terms of the GNU General Public License (GPL)
+# as published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+# http://www.gnu.org/licenses/
+#*****************************************************************************
+
+
from sage.rings.all import ZZ, is_RingHomomorphism
from sage.matrix.matrix import is_Matrix
from sage.matrix.matrix_space import MatrixSpace
@@ -35,8 +91,8 @@
sage: P1 = toric_varieties.P1()
sage: hom_set = P1xP1.Hom(P1); hom_set
Set of morphisms
- From: 2-d CPR-Fano toric variety covered by 4 affine patches
- To: 1-d CPR-Fano toric variety covered by 2 affine patches
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: 1-d CPR-Fano toric variety covered by 2 affine patches
sage: type(hom_set)
@@ -44,11 +100,40 @@
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 1-d lattice N.
"""
def __init__(self, X, Y, category=None, check=True, base=ZZ):
+ """
+ The Python constructor.
+
+ INPUT:
+
+ The same as for any homset, see
+ :mod:`~sage.categories.homset`.
+
+ EXAMPLES::
+
+ sage: P1xP1 = toric_varieties.P1xP1()
+ sage: P1 = toric_varieties.P1()
+ sage: hom_set = P1xP1.Hom(P1); hom_set
+ Set of morphisms
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: 1-d CPR-Fano toric variety covered by 2 affine patches
+
+ An integral matrix defines a fan morphism, since we think of
+ the matrix as a linear map on the toric lattice. This is why
+ we need to ``register_conversion`` in the constructor
+ below. The result is::
+
+ sage: hom_set(matrix([[1],[0]]))
+ Scheme morphism:
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: 1-d CPR-Fano toric variety covered by 2 affine patches
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
+ to Rational polyhedral fan in 1-d lattice N.
+ """
SchemeHomset_generic.__init__(self, X, Y, category=category, check=check, base=base)
self.register_conversion(MatrixSpace(ZZ, X.fan().dim(), Y.fan().dim()))
@@ -76,23 +161,23 @@
sage: dP8. = toric_varieties.dP8()
sage: P2. = toric_varieties.P2()
- sage: Hom = dP8.Hom(P2)
+ sage: hom_set = dP8.Hom(P2)
sage: fm = FanMorphism(identity_matrix(2), dP8.fan(), P2.fan())
- sage: Hom(fm)
+ sage: hom_set(fm) # calls hom_set._element_constructor_()
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 2-d CPR-Fano toric variety covered by 3 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 2-d lattice N.
A matrix will automatically be converted to a fan morphism::
- sage: Hom(identity_matrix(2))
+ sage: hom_set(identity_matrix(2))
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 2-d CPR-Fano toric variety covered by 3 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 2-d lattice N.
Alternatively, one can use homogeneous polynomials to define morphisms::
@@ -101,7 +186,7 @@
Defining y0, y1, y2
sage: dP8.inject_variables()
Defining t, x0, x1, x2
- sage: Hom([x0,x1,x2])
+ sage: hom_set([x0,x1,x2])
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 2-d CPR-Fano toric variety covered by 3 affine patches
@@ -118,7 +203,7 @@
Defn: y0 |--> x0
y1 |--> x1
y2 |--> x2
- sage: Hom(ring_hom)
+ sage: hom_set(ring_hom)
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 2-d CPR-Fano toric variety covered by 3 affine patches
diff --git a/sage/schemes/generic/toric_morphism.py b/sage/schemes/generic/toric_morphism.py
--- a/sage/schemes/generic/toric_morphism.py
+++ b/sage/schemes/generic/toric_morphism.py
@@ -105,7 +105,7 @@
Scheme morphism:
From: 1-d CPR-Fano toric variety covered by 2 affine patches
To: 2-d CPR-Fano toric variety covered by 3 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 1-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 1-d lattice N
to Rational polyhedral fan in 2-d lattice N.
The fan morphism map is equivalent to the following polynomial map::
@@ -374,7 +374,7 @@
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 2-d CPR-Fano toric variety covered by 3 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 2-d lattice N.
sage: type(f)
@@ -389,14 +389,14 @@
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 1-d lattice N.
sage: P1xP1.hom(fm, P1)
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 1-d lattice N.
"""
@@ -415,7 +415,7 @@
Scheme morphism:
From: 2-d CPR-Fano toric variety covered by 4 affine patches
To: 1-d CPR-Fano toric variety covered by 2 affine patches
- Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
+ Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
to Rational polyhedral fan in 1-d lattice N.
"""
SchemeMorphism.__init__(self, parent)
@@ -439,9 +439,9 @@
sage: P1 = toric_varieties.P1()
sage: f = P1xP1.hom(matrix([[1],[0]]), P1)
sage: f._repr_defn()
- 'Defined by sending the Rational polyhedral fan in 2-d lattice N to Rational polyhedral fan in 1-d lattice N.'
+ 'Defined by sending Rational polyhedral fan in 2-d lattice N to Rational polyhedral fan in 1-d lattice N.'
"""
- s = 'Defined by sending the '
+ s = 'Defined by sending '
s += str(self.domain().fan())
s += ' to '
s += str(self.codomain().fan())
diff --git a/sage/schemes/generic/toric_variety.py b/sage/schemes/generic/toric_variety.py
--- a/sage/schemes/generic/toric_variety.py
+++ b/sage/schemes/generic/toric_variety.py
@@ -729,7 +729,29 @@
To: 1-d CPR-Fano toric variety covered by 2 affine patches
sage: type(hom_set)
- """
+
+ This is also the Hom-set for algebraic subschemes of toric varieties::
+
+ sage: P1xP1.inject_variables()
+ Defining s, t, x, y
+ sage: P1 = P1xP1.subscheme(s-t)
+ sage: hom_set = P1xP1.Hom(P1)
+ sage: hom_set([s,s,x,y])
+ Scheme morphism:
+ From: 2-d CPR-Fano toric variety covered by 4 affine patches
+ To: Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by:
+ s - t
+ Defn: Defined on coordinates by sending [s : t : x : y] to
+ [s : s : x : y]
+
+ sage: hom_set = P1.Hom(P1)
+ sage: hom_set([s,s,x,y])
+ Scheme endomorphism of Closed subscheme of 2-d CPR-Fano toric
+ variety covered by 4 affine patches defined by:
+ s - t
+ Defn: Defined on coordinates by sending [s : t : x : y] to
+ [t : t : x : y]
+ """
from sage.schemes.generic.toric_homset import SchemeHomset_toric_variety
return SchemeHomset_toric_variety(*args, **kwds)