Ticket #7457: trac_7457.patch

File trac_7457.patch, 9.2 KB (added by AlexGhitza, 13 years ago)
  • sage/rings/polynomial/infinite_polynomial_ring.py

    # HG changeset patch
    # User Alexandru Ghitza <aghitza@alum.mit.edu>
    # Date 1258201015 -39600
    # Node ID ea85928b75aaf287aae21ab7d7a6aa1fa51e1ead
    # Parent  5db805d3bdafb3f79835cff2af6a333f749b500c
    trac 7457: improvements to quotient_ring.py
    
    diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/polynomial/infinite_polynomial_ring.py
    a b  
    534534        """
    535535        return self._base.characteristic()
    536536
     537    def is_field(self):
     538        """
     539        Return ``False``, since polynomial rings in infinitely many
     540        variables are never fields.
     541
     542        EXAMPLES::
     543
     544            sage: R.<x, y> = InfinitePolynomialRing(QQ)
     545            sage: R.is_field()
     546            False
     547        """
     548        return False
     549
     550    def is_integral_domain(self):
     551        """
     552        Return ``True``, since polynomial rings in infinitely many
     553        variables over a field are always integral domains.
     554
     555        EXAMPLES::
     556
     557            sage: R.<x, y> = InfinitePolynomialRing(QQ)
     558            sage: R.is_integral_domain()
     559            True
     560        """
     561        return True
     562
     563    def is_noetherian(self):
     564        """
     565        Return ``False``, since polynomial rings in infinitely many
     566        variables are never Noetherian.
     567
     568        EXAMPLES::
     569
     570            sage: R.<x> = InfinitePolynomialRing(QQ)
     571            sage: R.is_noetherian()
     572            False
     573        """
     574        return False
     575
     576    def krull_dimension(self):
     577        """
     578        Return ``Infinity``, since polynomial rings in infinitely many
     579        variables have infinite Krull dimension.
     580
     581        EXAMPLES::
     582
     583            sage: R.<x, y> = InfinitePolynomialRing(QQ)
     584            sage: R.krull_dimension()
     585            +Infinity
     586        """
     587        from sage.rings.all import Infinity
     588        return Infinity
     589
     590    def order(self):
     591        """
     592        Return ``Infinity``, since polynomial rings have infinitely
     593        many elements.
     594
     595        EXAMPLES::
     596           
     597            sage: R.<x> = InfinitePolynomialRing(GF(2))
     598            sage: R.order()
     599            +Infinity
     600        """
     601        from sage.rings.all import Infinity
     602        return Infinity
     603       
     604
    537605class InfinitePolynomialGen(SageObject):
    538606    """
    539607    This class provides the object which is responsible for returning
  • sage/rings/polynomial/polynomial_quotient_ring.py

    diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/polynomial/polynomial_quotient_ring.py
    a b  
    544544        """
    545545        return self.__ring
    546546
     547    cover_ring = polynomial_ring
     548
    547549    def random_element(self):
    548550        """
    549551        Return a random element of this quotient ring.
  • sage/rings/quotient_ring.py

    diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/quotient_ring.py
    a b  
    3535
    3636def QuotientRing(R, I, names=None):
    3737    r"""
    38     Creates a quotient ring of the ring R by the ideal I. Variables are
    39     labeled by names. (If the quotient ring is a quotient of a
    40     polynomial ring.). If names isn't given, 'bar' will be appended to
    41     the variable names in R.
     38    Creates a quotient ring of the ring `R` by the ideal `I`. Variables are
     39    labeled by ``names``. (If the quotient ring is a quotient of a
     40    polynomial ring.). If ``names`` isn't given, 'bar' will be appended to
     41    the variable names in `R`.
    4242   
    4343    INPUTS:
    4444
     
    4848
    4949    - ``names`` - a list of
    5050      strings to be used as names for the variables in the quotient ring
    51       R/I
     51      `R/I`
    5252   
    53     OUTPUTS: R/I - the quotient ring R mod the ideal I
     53    OUTPUTS: `R/I` - the quotient ring `R` mod the ideal `I`
    5454   
    5555    EXAMPLES:
    5656
     
    107107        modulus x^2 + 1
    108108   
    109109    By Noether's homomorphism theorems, the quotient of a quotient ring
    110     in R is just the quotient of R by the sum of the ideals. In this
    111     example, we end up modding out the ideal (x) from the ring
    112     QQ[x,y]::
     110    of `R` is just the quotient of `R` by the sum of the ideals. In this
     111    example, we end up modding out the ideal `(x)` from the ring
     112    `\QQ[x,y]`::
    113113   
    114114        sage: R.<x,y> = PolynomialRing(QQ,2)
    115115        sage: S.<a,b> = QuotientRing(R,R.ideal(1 + y^2))
     
    155155
    156156def is_QuotientRing(x):
    157157    """
    158     Tests whether or not x inherits from QuotientRing_generic.
     158    Tests whether or not ``x`` inherits from :class:`QuotientRing_generic`.
    159159   
    160160    EXAMPLES::
    161161   
     
    207207    """
    208208    def __init__(self, R, I, names):
    209209        """
    210         Create the quotient ring of R by the ideal I.
     210        Create the quotient ring of `R` by the ideal `I`.
    211211       
    212212        INPUT:
    213213       
     
    404404       
    405405    def is_field(self, proof = True):
    406406        r"""
    407         Returns True if the quotient ring is a field. Checks to see if the
     407        Returns ``True`` if the quotient ring is a field. Checks to see if the
    408408        defining ideal is maximal.
    409409       
    410410        TESTS:
     
    428428
    429429    def is_integral_domain(self, proof = True):
    430430        r"""
    431         If this function returns True then self is definitely an integral
    432         domain. If it returns False, then either self is definitely not an
     431        If this function returns ``True`` then self is definitely an integral
     432        domain. If it returns ``False``, then either self is definitely not an
    433433        integral domain or this function was unable to determine whether or
    434434        not self is an integral domain.
    435435       
     
    460460            except NotImplementedError:
    461461                return False
    462462
     463    def is_noetherian(self):
     464        r"""
     465        Return ``True`` if this ring is Noetherian. 
     466
     467        EXAMPLES::
     468
     469            sage: R = QuotientRing(ZZ, 102*ZZ)
     470            sage: R.is_noetherian()
     471            True
     472
     473            sage: R = QuotientRing(QQ[x], x^2+1)
     474            sage: R.is_noetherian()
     475            True
     476
     477        If the cover ring of ``self`` is not Noetherian, we currently
     478        have no way of testing whether ``self`` is Noetherian, so we
     479        raise an error::
     480
     481            sage: R.<x> = InfinitePolynomialRing(QQ)
     482            sage: R.is_noetherian()
     483            False
     484            sage: I = R.ideal([x[1]^2, x[2]])
     485            sage: S = R.quotient(I)
     486            sage: S.is_noetherian()
     487            Traceback (most recent call last):
     488            ...
     489            NotImplementedError
     490        """
     491        # Naive test: if this is the quotient of a Noetherian ring,
     492        # then it is Noetherian.  Otherwise we give up.
     493        if self.cover_ring().is_noetherian():
     494            return True
     495
     496        raise NotImplementedError
     497
     498
    463499    def cover_ring(self):
    464500        r"""
    465501        Returns the cover ring of the quotient ring: that is, the original
    466         ring R from which we modded out an ideal, I.
    467        
    468         TODO: PolynomialQuotientRings_field objects don't have a
    469         ``cover_ring`` function.
     502        ring `R` from which we modded out an ideal, `I`.
    470503       
    471504        EXAMPLES::
    472505       
     
    478511       
    479512            sage: Q = QuotientRing(QQ[x], x^2 + 1)
    480513            sage: Q.cover_ring()
    481             Traceback (most recent call last):
    482             ...
    483             AttributeError: 'PolynomialQuotientRing_field' object has no attribute 'cover_ring'
     514            Univariate Polynomial Ring in x over Rational Field
    484515        """
    485516        return self.__R
    486517
     
    538569
    539570    def _coerce_impl(self, x):
    540571        """
    541         Return the coercion of x into this quotient ring.
     572        Return the coercion of `x` into this quotient ring.
    542573       
    543574        The rings that coerce into the quotient ring canonically, are:
    544575       
     
    627658
    628659    def gen(self, i=0):
    629660        r"""
    630         Returns the ith generator for this quotient ring.
     661        Returns the `i`-th generator for this quotient ring.
    631662       
    632663        EXAMPLES::
    633664       
     
    660691        Returns the Singular quotient ring of self if the base ring is
    661692        coercible to Singular.
    662693       
    663         If a valid singular representation is found it is used otherwise a
     694        If a valid Singular representation is found it is used otherwise a
    664695        new 'qring' is created.
    665696       
    666697        INPUT:
     
    699730    def _singular_init_(self,singular=singular_default):
    700731        """
    701732        Returns a newly created Singular quotient ring matching self if the
    702         base ring is coecable to Singular.
     733        base ring is coercible to Singular.
    703734       
    704735        See self._singular_
    705736       
     
    725756        INPUT:
    726757       
    727758       
    728         -  ``magma`` - a magma instance
     759        -  ``magma`` - a Magma instance
    729760       
    730761       
    731762        EXAMPLE::
  • sage/rings/ring.pyx

    diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/ring.pyx
    a b  
    684684            return False
    685685       
    686686        if proof:
    687             return NotImplementedError
     687            raise NotImplementedError
    688688        else:
    689689            return False
    690690