# 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
# Parent  5db805d3bdafb3f79835cff2af6a333f749b500c
trac 7457: improvements to quotient_ring.py

diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/polynomial/infinite_polynomial_ring.py```
 a """ return self._base.characteristic() def is_field(self): """ Return ``False``, since polynomial rings in infinitely many variables are never fields. EXAMPLES:: sage: R. = InfinitePolynomialRing(QQ) sage: R.is_field() False """ return False def is_integral_domain(self): """ Return ``True``, since polynomial rings in infinitely many variables over a field are always integral domains. EXAMPLES:: sage: R. = InfinitePolynomialRing(QQ) sage: R.is_integral_domain() True """ return True def is_noetherian(self): """ Return ``False``, since polynomial rings in infinitely many variables are never Noetherian. EXAMPLES:: sage: R. = InfinitePolynomialRing(QQ) sage: R.is_noetherian() False """ return False def krull_dimension(self): """ Return ``Infinity``, since polynomial rings in infinitely many variables have infinite Krull dimension. EXAMPLES:: sage: R. = InfinitePolynomialRing(QQ) sage: R.krull_dimension() +Infinity """ from sage.rings.all import Infinity return Infinity def order(self): """ Return ``Infinity``, since polynomial rings have infinitely many elements. EXAMPLES:: sage: R. = InfinitePolynomialRing(GF(2)) sage: R.order() +Infinity """ from sage.rings.all import Infinity return Infinity class InfinitePolynomialGen(SageObject): """ 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 """ return self.__ring cover_ring = polynomial_ring def random_element(self): """ Return a random element of this quotient ring.
• ## sage/rings/quotient_ring.py

`diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/quotient_ring.py`
 a def QuotientRing(R, I, names=None): r""" Creates a quotient ring of the ring R by the ideal I. Variables are labeled by names. (If the quotient ring is a quotient of a polynomial ring.). If names isn't given, 'bar' will be appended to the variable names in R. Creates a quotient ring of the ring `R` by the ideal `I`. Variables are labeled by ``names``. (If the quotient ring is a quotient of a polynomial ring.). If ``names`` isn't given, 'bar' will be appended to the variable names in `R`. INPUTS: - ``names`` - a list of strings to be used as names for the variables in the quotient ring R/I `R/I` OUTPUTS: R/I - the quotient ring R mod the ideal I OUTPUTS: `R/I` - the quotient ring `R` mod the ideal `I` EXAMPLES: modulus x^2 + 1 By Noether's homomorphism theorems, the quotient of a quotient ring in R is just the quotient of R by the sum of the ideals. In this example, we end up modding out the ideal (x) from the ring QQ[x,y]:: of `R` is just the quotient of `R` by the sum of the ideals. In this example, we end up modding out the ideal `(x)` from the ring `\QQ[x,y]`:: sage: R. = PolynomialRing(QQ,2) sage: S. = QuotientRing(R,R.ideal(1 + y^2)) def is_QuotientRing(x): """ Tests whether or not x inherits from QuotientRing_generic. Tests whether or not ``x`` inherits from :class:`QuotientRing_generic`. EXAMPLES:: """ def __init__(self, R, I, names): """ Create the quotient ring of R by the ideal I. Create the quotient ring of `R` by the ideal `I`. INPUT: def is_field(self, proof = True): r""" Returns True if the quotient ring is a field. Checks to see if the Returns ``True`` if the quotient ring is a field. Checks to see if the defining ideal is maximal. TESTS: def is_integral_domain(self, proof = True): r""" If this function returns True then self is definitely an integral domain. If it returns False, then either self is definitely not an If this function returns ``True`` then self is definitely an integral domain. If it returns ``False``, then either self is definitely not an integral domain or this function was unable to determine whether or not self is an integral domain. except NotImplementedError: return False def is_noetherian(self): r""" Return ``True`` if this ring is Noetherian. EXAMPLES:: sage: R = QuotientRing(ZZ, 102*ZZ) sage: R.is_noetherian() True sage: R = QuotientRing(QQ[x], x^2+1) sage: R.is_noetherian() True If the cover ring of ``self`` is not Noetherian, we currently have no way of testing whether ``self`` is Noetherian, so we raise an error:: sage: R. = InfinitePolynomialRing(QQ) sage: R.is_noetherian() False sage: I = R.ideal([x^2, x]) sage: S = R.quotient(I) sage: S.is_noetherian() Traceback (most recent call last): ... NotImplementedError """ # Naive test: if this is the quotient of a Noetherian ring, # then it is Noetherian.  Otherwise we give up. if self.cover_ring().is_noetherian(): return True raise NotImplementedError def cover_ring(self): r""" Returns the cover ring of the quotient ring: that is, the original ring R from which we modded out an ideal, I. TODO: PolynomialQuotientRings_field objects don't have a ``cover_ring`` function. ring `R` from which we modded out an ideal, `I`. EXAMPLES:: sage: Q = QuotientRing(QQ[x], x^2 + 1) sage: Q.cover_ring() Traceback (most recent call last): ... AttributeError: 'PolynomialQuotientRing_field' object has no attribute 'cover_ring' Univariate Polynomial Ring in x over Rational Field """ return self.__R def _coerce_impl(self, x): """ Return the coercion of x into this quotient ring. Return the coercion of `x` into this quotient ring. The rings that coerce into the quotient ring canonically, are: def gen(self, i=0): r""" Returns the ith generator for this quotient ring. Returns the `i`-th generator for this quotient ring. EXAMPLES:: Returns the Singular quotient ring of self if the base ring is coercible to Singular. If a valid singular representation is found it is used otherwise a If a valid Singular representation is found it is used otherwise a new 'qring' is created. INPUT: def _singular_init_(self,singular=singular_default): """ Returns a newly created Singular quotient ring matching self if the base ring is coecable to Singular. base ring is coercible to Singular. See self._singular_ INPUT: -  ``magma`` - a magma instance -  ``magma`` - a Magma instance EXAMPLE::
• ## sage/rings/ring.pyx

`diff -r 5db805d3bdaf -r ea85928b75aa sage/rings/ring.pyx`
 a return False if proof: return NotImplementedError raise NotImplementedError else: return False