Ejemplo n.º 1
0
    def construction(self):
        """
        EXAMPLES::
        
            sage: R.<x> = PolynomialRing(ZZ,'x')
            sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
            sage: R.quotient_ring(I).construction()
            (QuotientFunctor, Univariate Polynomial Ring in x over Integer Ring)

        TESTS::
        
            sage: F, R = Integers(5).construction()
            sage: F(R)
            Ring of integers modulo 5
            sage: F, R = GF(5).construction()
            sage: F(R)
            Finite Field of size 5
        """
        from sage.categories.pushout import QuotientFunctor
        # Is there a better generic way to distinguish between things like Z/pZ as a field and Z/pZ as a ring?
        from sage.rings.field import Field
        try:
            names = self.variable_names()
        except ValueError:
            try:
                names = self.cover_ring().variable_names()
            except ValueError:
                names = None
        return QuotientFunctor(self.__I,
                               names=names,
                               as_field=isinstance(self, Field)), self.__R
Ejemplo n.º 2
0
    def construction(self):
        """
        Returns the functorial construction of ``self``.

        EXAMPLES::

            sage: R.<x> = PolynomialRing(ZZ,'x')
            sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
            sage: R.quotient_ring(I).construction()
            (QuotientFunctor, Univariate Polynomial Ring in x over Integer Ring)
            sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace')
            sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F
            sage: Q = F.quo(I)
            sage: Q.construction()
            (QuotientFunctor, Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field)

        TESTS::

            sage: F, R = Integers(5).construction()
            sage: F(R)
            Ring of integers modulo 5
            sage: F, R = GF(5).construction()
            sage: F(R)
            Finite Field of size 5
        """
        from sage.categories.pushout import QuotientFunctor
        # Is there a better generic way to distinguish between things like Z/pZ as a field and Z/pZ as a ring?
        from sage.rings.ring import Field
        try:
            names = self.variable_names()
        except ValueError:
            try:
                names = self.cover_ring().variable_names()
            except ValueError:
                names = None
        if self in CommutativeRings():
            return QuotientFunctor(self.__I,
                                   names=names,
                                   domain=CommutativeRings(),
                                   codomain=CommutativeRings(),
                                   as_field=isinstance(self, Field)), self.__R
        else:
            return QuotientFunctor(self.__I,
                                   names=names,
                                   as_field=isinstance(self, Field)), self.__R