Ticket #11599: trac_11599_remaining_fixes.patch

File trac_11599_remaining_fixes.patch, 15.9 KB (added by vbraun, 10 years ago)

Initial patch

  • doc/en/reference/schemes.rst

    # HG changeset patch
    # User Volker Braun <vbraun@stp.dias.ie>
    # 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 b  
    1616   sage/schemes/generic/ambient_space
    1717   sage/schemes/generic/affine_space
    1818   sage/schemes/generic/projective_space
    19    sage/schemes/generic/toric_variety   
    20    sage/schemes/generic/fano_toric_variety   
     19   sage/schemes/generic/toric_variety
     20   sage/schemes/generic/fano_toric_variety
    2121   sage/schemes/generic/toric_variety_library
    2222   sage/schemes/generic/toric_divisor
    2323   sage/schemes/generic/toric_chow_group
    2424   sage/schemes/generic/toric_ideal
    25    sage/schemes/generic/toric_morphism
    2625   sage/schemes/generic/algebraic_scheme
    2726   sage/schemes/generic/hypersurface
    2827
  • sage/schemes/generic/algebraic_scheme.py

    diff --git a/sage/schemes/generic/algebraic_scheme.py b/sage/schemes/generic/algebraic_scheme.py
    a b  
    521521        """
    522522        return "Subscheme of %s"%self.__A
    523523
     524    def _homset(self, *args, **kwds):
     525        """
     526        Construct the Hom-set
     527
     528        INPUT:
     529
     530        Same as :class:`sage.schemes.generic.homset.SchemeHomset_generic`.
     531
     532        OUTPUT:
     533
     534        The Hom-set of the ambient space.
     535
     536        EXAMPLES::
     537       
     538            sage: P1.<x,y> = toric_varieties.P1()
     539            sage: type(P1.Hom(P1))
     540            <class 'sage.schemes.generic.toric_homset.SchemeHomset_toric_variety_with_category'>
     541            sage: X = P1.subscheme(x-y)
     542            sage: type(X.Hom(X))
     543            <class 'sage.schemes.generic.toric_homset.SchemeHomset_toric_variety_with_category'>
     544        """
     545        return self.__A._homset(*args, **kwds)
     546
    524547    def _point_homset(self, *args, **kwds):
    525548        return self.__A._point_homset(*args, **kwds)
    526549
     
    20682091        INPUT:
    20692092
    20702093        - same as for
    2071           :class:`~sage.schemes.generic.morphism.SchemeMorphism_polynomial_toric_variety`.
     2094          :class:`~sage.schemes.generic.toric_morphism.SchemeMorphism_polynomial_toric_variety`.
    20722095
    20732096        OUPUT:
    20742097
    2075         - :class:`~sage.schemes.generic.morphism.SchemeMorphism_polynomial_toric_variety`.
     2098        - :class:`~sage.schemes.generic.toric_morphism.SchemeMorphism_polynomial_toric_variety`.
    20762099
    20772100        TESTS::
    20782101
     
    20822105            Defining z0, z1, z2, z3
    20832106            sage: P1 = P1xP1.subscheme(z0-z2)
    20842107            sage: H = P1.Hom(P1xP1)
     2108            sage: H([z0,z1,z0,z3])
     2109            Scheme morphism:
     2110              From: Closed subscheme of 2-d toric variety
     2111              covered by 4 affine patches defined by:
     2112              z0 - z2
     2113              To:   2-d toric variety covered by 4 affine patches
     2114              Defn: Defined on coordinates by sending [z0 : z1 : z2 : z3] to
     2115                    [z2 : z1 : z2 : z3]
     2116
    20852117            sage: P1._morphism(H, [z0,z1,z0,z3])
    20862118            Scheme morphism:
    20872119              From: Closed subscheme of 2-d toric variety
     
    20942126        from sage.schemes.generic.toric_morphism import SchemeMorphism_polynomial_toric_variety
    20952127        return SchemeMorphism_polynomial_toric_variety(*args, **kwds)
    20962128
     2129    def fan(self):
     2130        """
     2131        Return the fan of the ambient space.
     2132
     2133        OUTPUT:
     2134
     2135        A fan.
     2136
     2137        EXAMPLES::
     2138       
     2139            sage: P2.<x,y,z> = toric_varieties.P(2)
     2140            sage: E = P2.subscheme([x^2+y^2+z^2])
     2141            sage: E.fan()
     2142            Rational polyhedral fan in 2-d lattice N
     2143        """
     2144        return self.ambient_space().fan()
     2145
    20972146    def affine_patch(self, i):
    20982147        r"""
    20992148        Return the ``i``-th affine patch of ``self`` as an affine
  • sage/schemes/generic/scheme.py

    diff --git a/sage/schemes/generic/scheme.py b/sage/schemes/generic/scheme.py
    a b  
    2222#*****************************************************************************
    2323
    2424
    25 from sage.misc.all import cached_method
    2625from sage.structure.parent import Parent
    2726from sage.misc.all import cached_method
    2827from sage.rings.all import (IntegerRing, is_CommutativeRing,
  • sage/schemes/generic/toric_homset.py

    diff --git a/sage/schemes/generic/toric_homset.py b/sage/schemes/generic/toric_homset.py
    a b  
    1515    You should not create the Hom-sets manually. Instead, use the
    1616    :meth:`~sage.structure.parent.Hom` method that is inherited by all
    1717    schemes.
     18
     19AUTHORS:
     20
     21- Volker Braun (2012-02-18): Initial version
     22
     23EXAMPLES:
     24
     25Here is a simple example, the projection of
     26`\mathbb{P}^1\times\mathbb{P}^1\to \mathbb{P}^1` ::
     27
     28    sage: P1xP1 = toric_varieties.P1xP1()
     29    sage: P1 = toric_varieties.P1()
     30    sage: hom_set = P1xP1.Hom(P1);  hom_set
     31    Set of morphisms
     32      From: 2-d CPR-Fano toric variety covered by 4 affine patches
     33      To:   1-d CPR-Fano toric variety covered by 2 affine patches
     34
     35In terms of the fan, we can define this morphism by the projection
     36onto the first coordinate. The Hom-set can construct the morphism from
     37the projection matrix alone::
     38
     39    sage: hom_set(matrix([[1],[0]]))
     40    Scheme morphism:
     41      From: 2-d CPR-Fano toric variety covered by 4 affine patches
     42      To:   1-d CPR-Fano toric variety covered by 2 affine patches
     43      Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
     44            to Rational polyhedral fan in 1-d lattice N.
     45    sage: _.as_polynomial_map()
     46    Scheme morphism:
     47      From: 2-d CPR-Fano toric variety covered by 4 affine patches
     48      To:   1-d CPR-Fano toric variety covered by 2 affine patches
     49      Defn: Defined on coordinates by sending [s : t : x : y] to
     50            [s : t]
     51
     52In the case of toric algebraic schemes (defined by polynomials in
     53toric varieties), this module defines the underlying morphism of the
     54ambient toric varieties::
     55
     56    sage: P1xP1.inject_variables()
     57    Defining s, t, x, y
     58    sage: S = P1xP1.subscheme([s*x-t*y])
     59    sage: type(S.Hom(S))
     60    <class 'sage.schemes.generic.toric_homset.SchemeHomset_toric_variety_with_category'>
    1861"""
    1962
     63
     64
     65#*****************************************************************************
     66#       Copyright (C) 2010 Volker Braun <vbraun.name@gmail.com>
     67#       Copyright (C) 2010 Andrey Novoseltsev <novoselt@gmail.com>
     68#
     69#  Distributed under the terms of the GNU General Public License (GPL)
     70#  as published by the Free Software Foundation; either version 2 of
     71#  the License, or (at your option) any later version.
     72#                  http://www.gnu.org/licenses/
     73#*****************************************************************************
     74
     75
    2076from sage.rings.all import ZZ, is_RingHomomorphism
    2177from sage.matrix.matrix import is_Matrix
    2278from sage.matrix.matrix_space import MatrixSpace
     
    3591        sage: P1 = toric_varieties.P1()
    3692        sage: hom_set = P1xP1.Hom(P1);  hom_set
    3793        Set of morphisms
    38          From: 2-d CPR-Fano toric variety covered by 4 affine patches
    39          To:   1-d CPR-Fano toric variety covered by 2 affine patches
     94          From: 2-d CPR-Fano toric variety covered by 4 affine patches
     95          To:   1-d CPR-Fano toric variety covered by 2 affine patches
    4096        sage: type(hom_set)
    4197        <class 'sage.schemes.generic.toric_homset.SchemeHomset_toric_variety_with_category'>
    4298
     
    44100        Scheme morphism:
    45101          From: 2-d CPR-Fano toric variety covered by 4 affine patches
    46102          To:   1-d CPR-Fano toric variety covered by 2 affine patches
    47           Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     103          Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    48104                to Rational polyhedral fan in 1-d lattice N.
    49105    """
    50106
    51107    def __init__(self, X, Y, category=None, check=True, base=ZZ):
     108        """
     109        The Python constructor.
     110
     111        INPUT:
     112
     113        The same as for any homset, see
     114        :mod:`~sage.categories.homset`.
     115
     116        EXAMPLES::
     117
     118            sage: P1xP1 = toric_varieties.P1xP1()
     119            sage: P1 = toric_varieties.P1()
     120            sage: hom_set = P1xP1.Hom(P1);  hom_set
     121            Set of morphisms
     122              From: 2-d CPR-Fano toric variety covered by 4 affine patches
     123              To:   1-d CPR-Fano toric variety covered by 2 affine patches
     124           
     125        An integral matrix defines a fan morphism, since we think of
     126        the matrix as a linear map on the toric lattice. This is why
     127        we need to ``register_conversion`` in the constructor
     128        below. The result is::
     129
     130            sage: hom_set(matrix([[1],[0]]))
     131            Scheme morphism:
     132              From: 2-d CPR-Fano toric variety covered by 4 affine patches
     133              To:   1-d CPR-Fano toric variety covered by 2 affine patches
     134              Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
     135                    to Rational polyhedral fan in 1-d lattice N.
     136        """
    52137        SchemeHomset_generic.__init__(self, X, Y, category=category, check=check, base=base)
    53138        self.register_conversion(MatrixSpace(ZZ, X.fan().dim(), Y.fan().dim()))
    54139
     
    76161
    77162            sage: dP8.<t,x0,x1,x2> = toric_varieties.dP8()
    78163            sage: P2.<y0,y1,y2> = toric_varieties.P2()
    79             sage: Hom = dP8.Hom(P2)
     164            sage: hom_set = dP8.Hom(P2)
    80165
    81166            sage: fm = FanMorphism(identity_matrix(2), dP8.fan(), P2.fan())
    82             sage: Hom(fm)
     167            sage: hom_set(fm)     # calls hom_set._element_constructor_()
    83168            Scheme morphism:
    84169              From: 2-d CPR-Fano toric variety covered by 4 affine patches
    85170              To:   2-d CPR-Fano toric variety covered by 3 affine patches
    86               Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     171              Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    87172                    to Rational polyhedral fan in 2-d lattice N.
    88173
    89174        A matrix will automatically be converted to a fan morphism::
    90175
    91             sage: Hom(identity_matrix(2))
     176            sage: hom_set(identity_matrix(2))
    92177            Scheme morphism:
    93178              From: 2-d CPR-Fano toric variety covered by 4 affine patches
    94179              To:   2-d CPR-Fano toric variety covered by 3 affine patches
    95               Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     180              Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    96181                    to Rational polyhedral fan in 2-d lattice N.
    97182
    98183        Alternatively, one can use homogeneous polynomials to define morphisms::
     
    101186            Defining y0, y1, y2
    102187            sage: dP8.inject_variables()
    103188            Defining t, x0, x1, x2
    104             sage: Hom([x0,x1,x2])
     189            sage: hom_set([x0,x1,x2])
    105190            Scheme morphism:
    106191              From: 2-d CPR-Fano toric variety covered by 4 affine patches
    107192              To:   2-d CPR-Fano toric variety covered by 3 affine patches
     
    118203              Defn: y0 |--> x0
    119204                    y1 |--> x1
    120205                    y2 |--> x2
    121             sage: Hom(ring_hom)
     206            sage: hom_set(ring_hom)
    122207            Scheme morphism:
    123208              From: 2-d CPR-Fano toric variety covered by 4 affine patches
    124209              To:   2-d CPR-Fano toric variety covered by 3 affine patches
  • sage/schemes/generic/toric_morphism.py

    diff --git a/sage/schemes/generic/toric_morphism.py b/sage/schemes/generic/toric_morphism.py
    a b  
    105105    Scheme morphism:
    106106      From: 1-d CPR-Fano toric variety covered by 2 affine patches
    107107      To:   2-d CPR-Fano toric variety covered by 3 affine patches
    108       Defn: Defined by sending the Rational polyhedral fan in 1-d lattice N
     108      Defn: Defined by sending Rational polyhedral fan in 1-d lattice N
    109109            to Rational polyhedral fan in 2-d lattice N.
    110110
    111111The fan morphism map is equivalent to the following polynomial map::
     
    374374        Scheme morphism:
    375375          From: 2-d CPR-Fano toric variety covered by 4 affine patches
    376376          To:   2-d CPR-Fano toric variety covered by 3 affine patches
    377           Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     377          Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    378378                to Rational polyhedral fan in 2-d lattice N.
    379379        sage: type(f)
    380380        <class 'sage.schemes.generic.toric_morphism.SchemeMorphism_fan_toric_variety'>
     
    389389        Scheme morphism:
    390390          From: 2-d CPR-Fano toric variety covered by 4 affine patches
    391391          To:   1-d CPR-Fano toric variety covered by 2 affine patches
    392           Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     392          Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    393393               to Rational polyhedral fan in 1-d lattice N.
    394394           
    395395        sage: P1xP1.hom(fm, P1)
    396396        Scheme morphism:
    397397          From: 2-d CPR-Fano toric variety covered by 4 affine patches
    398398          To:   1-d CPR-Fano toric variety covered by 2 affine patches
    399           Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     399          Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    400400                to Rational polyhedral fan in 1-d lattice N.
    401401    """
    402402
     
    415415            Scheme morphism:
    416416              From: 2-d CPR-Fano toric variety covered by 4 affine patches
    417417              To:   1-d CPR-Fano toric variety covered by 2 affine patches
    418               Defn: Defined by sending the Rational polyhedral fan in 2-d lattice N
     418              Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
    419419                    to Rational polyhedral fan in 1-d lattice N.
    420420        """
    421421        SchemeMorphism.__init__(self, parent)
     
    439439            sage: P1 = toric_varieties.P1()
    440440            sage: f = P1xP1.hom(matrix([[1],[0]]), P1)
    441441            sage: f._repr_defn()
    442             'Defined by sending the Rational polyhedral fan in 2-d lattice N to Rational polyhedral fan in 1-d lattice N.'
     442            'Defined by sending Rational polyhedral fan in 2-d lattice N to Rational polyhedral fan in 1-d lattice N.'
    443443        """
    444         s  = 'Defined by sending the '
     444        s  = 'Defined by sending '
    445445        s += str(self.domain().fan())
    446446        s += ' to '
    447447        s += str(self.codomain().fan())
  • sage/schemes/generic/toric_variety.py

    diff --git a/sage/schemes/generic/toric_variety.py b/sage/schemes/generic/toric_variety.py
    a b  
    729729             To:   1-d CPR-Fano toric variety covered by 2 affine patches
    730730            sage: type(hom_set)
    731731            <class 'sage.schemes.generic.toric_homset.SchemeHomset_toric_variety_with_category'>
    732         """
     732
     733        This is also the Hom-set for algebraic subschemes of toric varieties::
     734     
     735            sage: P1xP1.inject_variables()
     736            Defining s, t, x, y
     737            sage: P1 = P1xP1.subscheme(s-t)
     738            sage: hom_set = P1xP1.Hom(P1)
     739            sage: hom_set([s,s,x,y])
     740            Scheme morphism:
     741              From: 2-d CPR-Fano toric variety covered by 4 affine patches
     742              To:   Closed subscheme of 2-d CPR-Fano toric variety covered by 4 affine patches defined by:
     743              s - t
     744              Defn: Defined on coordinates by sending [s : t : x : y] to
     745                    [s : s : x : y]
     746 
     747            sage: hom_set = P1.Hom(P1)
     748            sage: hom_set([s,s,x,y])
     749            Scheme endomorphism of Closed subscheme of 2-d CPR-Fano toric
     750            variety covered by 4 affine patches defined by:
     751              s - t
     752              Defn: Defined on coordinates by sending [s : t : x : y] to
     753                    [t : t : x : y]
     754         """
    733755        from sage.schemes.generic.toric_homset import SchemeHomset_toric_variety
    734756        return SchemeHomset_toric_variety(*args, **kwds)
    735757