Ticket #12875: trac_12875-category-fix_abvar_homspace-nt.patch

File trac_12875-category-fix_abvar_homspace-nt.patch, 4.7 KB (added by nthiery, 8 years ago)
  • sage/modular/abvar/abvar.py

    # HG changeset patch
    # User Nicolas M. Thiery <nthiery@users.sf.net>
    # Date 1335432132 -7200
    # Node ID 6f3208b6c947ac98e66aaed92649dfe82e368583
    # Parent  323b129ff1429fb00df8a064f1e60ec59efba50c
    #12875: Fix the homset category initialization for ModularAbelianVariety's homspaces
    
    Before the patch, the following was wrong (probably introduced by #9138):
    {{{
        sage: End(J0(37)).homset_category()
        Join of Category of hom sets in Category of sets and Category of rings
    }}}
    
    After the patch:
    {{{
        sage: End(J0(37)).homset_category()
        Category of modular abelian varieties over Rational Field
    }}}
    
    In both cases, we have, as desired:
    {{{
        sage: End(J0(37)).category()
        Join of Category of hom sets in Category of sets and Category of rings
    }}}
    
    By the way, this removes a direct call to _Hom_, using Hom instead.
    
    diff --git a/sage/modular/abvar/abvar.py b/sage/modular/abvar/abvar.py
    a b class ModularAbelianVariety_abstract(Par 
    590590       
    591591            sage: J0(37)._Hom_(J1(37))
    592592            Space of homomorphisms from Abelian variety J0(37) of dimension 2 to Abelian variety J1(37) of dimension 40
     593            sage: J0(37)._Hom_(J1(37)).homset_category()
     594            Category of modular abelian varieties over Rational Field
    593595        """
    594596        if cat is None:
    595597            K = self.base_field(); L = B.base_field()
  • sage/modular/abvar/homspace.py

    diff --git a/sage/modular/abvar/homspace.py b/sage/modular/abvar/homspace.py
    a b import sage.rings.integer_ring 
    183183import sage.rings.all
    184184
    185185from sage.rings.ring import Ring
     186from sage.categories.category import Category
    186187from sage.categories.rings import Rings
    187188from sage.matrix.matrix_space import MatrixSpace
    188189from sage.matrix.constructor import Matrix, identity_matrix
    class EndomorphismSubring(Homspace, Ring 
    700701            Endomorphism ring of Abelian variety J0(23) of dimension 2
    701702            sage: sage.modular.abvar.homspace.EndomorphismSubring(J0(25))
    702703            Endomorphism ring of Abelian variety J0(25) of dimension 0
    703             sage: type(J0(11).endomorphism_ring())
     704            sage: E = J0(11).endomorphism_ring()
     705            sage: type(E)
    704706            <class 'sage.modular.abvar.homspace.EndomorphismSubring_with_category'>
     707            sage: E.category()
     708            Join of Category of hom sets in Category of sets and Category of rings
     709            sage: E.homset_category()
     710            Category of modular abelian varieties over Rational Field
     711            sage: TestSuite(E).run(skip=["_test_elements"])
    705712
    706713        TESTS:
    707714
    class EndomorphismSubring(Homspace, Ring 
    716723        self._A = A
    717724
    718725        # Initialise self with the correct category.
     726        # TODO: a category should be able to specify the appropriate
     727        # category for its endomorphism sets
    719728        # We need to initialise it as a ring first
    720         cat = A.category()
    721         cat = cat.join([cat.hom_category(),Rings()])
    722         Ring.__init__(self, A.base_ring(), category=cat)
    723         Homspace.__init__(self, A, A, cat=cat)
     729        homset_cat = A.category()
     730        cat = Category.join([homset_cat.hom_category(),Rings()])
     731        Ring.__init__(self, A.base_ring())
     732        Homspace.__init__(self, A, A, cat=homset_cat)
     733        self._refine_category_(Rings())
    724734        if gens is None:
    725735            self._gens = None
    726736        else:
  • sage/modular/abvar/morphism.py

    diff --git a/sage/modular/abvar/morphism.py b/sage/modular/abvar/morphism.py
    a b class Morphism(Morphism_abstract, sage.m 
    654654        B = sub.lattice().basis()
    655655        ims = sum([ (L(b)*self.matrix()).list() for b in B], [])
    656656        MS = matrix_space.MatrixSpace(self.base_ring(), len(B), self.codomain().rank())
    657         H = sub.Hom(self.codomain(), self.category())
     657        H = sub.Hom(self.codomain(), self.category_for())
    658658        return H(MS(ims))
    659659
    660660class DegeneracyMap(Morphism):
    class HeckeOperator(Morphism): 
    736736            sage: J = J0(37)
    737737            sage: T2 = J.hecke_operator(2); T2
    738738            Hecke operator T_2 on Abelian variety J0(37) of dimension 2
     739            sage: T2.parent()
     740            Endomorphism ring of Abelian variety J0(37) of dimension 2
    739741        """
    740742        n = ZZ(n)
    741743        if n <= 0:
    class HeckeOperator(Morphism): 
    744746            raise TypeError, "abvar must be a modular abelian variety"
    745747        self.__abvar = abvar
    746748        self.__n = n
    747         sage.modules.matrix_morphism.MatrixMorphism_abstract.__init__(self, abvar._Hom_(abvar))
     749        sage.modules.matrix_morphism.MatrixMorphism_abstract.__init__(self, abvar.Hom(abvar))
    748750
    749751    def _repr_(self):
    750752        """