Opened 2 years ago
Closed 2 years ago
#23203 closed defect (fixed)
A polynomial ring contains its basering
Reported by:  saraedum  Owned by:  

Priority:  minor  Milestone:  sage8.0 
Component:  commutative algebra  Keywords:  sd86.5, sd87 
Cc:  jpflori  Merged in:  
Authors:  Julian Rüth  Reviewers:  Claire Tomesch 
Report Upstream:  N/A  Work issues:  
Branch:  5f99cf9 (Commits)  Commit:  5f99cf980c01783faecf31b1009ee39adea36c69 
Dependencies:  #23204  Stopgaps: 
Description (last modified by )
Currently, this fails
sage: R.<x> = ZZ[] sage: S.<y> = R[] sage: R.is_subring(S) NotImplementedError
Change History (27)
comment:1 Changed 2 years ago by
 Description modified (diff)
comment:2 Changed 2 years ago by
 Dependencies set to #23204
comment:3 Changed 2 years ago by
 Branch set to u/saraedum/a_polynomial_ring_contains_its_basering
comment:4 Changed 2 years ago by
 Commit set to 17b83742312cb70f1021a1949be204f89d0b5d94
 Status changed from new to needs_review
comment:5 Changed 2 years ago by
(needs review: the is_subring
does not work without #23204.)
comment:6 Changed 2 years ago by
comment:7 Changed 2 years ago by
 Cc jpflori added
comment:8 Changed 2 years ago by
While it is a degenerate case, a polynomial ring could be isomorphic to its base ring:
sage: PolynomialRing(ZZ, []) Multivariate Polynomial Ring in no variables over Integer Ring
comment:9 Changed 2 years ago by
 Keywords sd87 added
comment:10 Changed 2 years ago by
 Commit changed from 17b83742312cb70f1021a1949be204f89d0b5d94 to a9d8b4f440bc74a02bd564e055f287cac25d899b
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
4b17dd8  Fixing doctest errors from the change to natural_map in ring homsets

80cd0ff  Merge branch 'develop' into t/23204/remove_ringhomomorphism_coercion

5c7d1b9  Merge branch 'develop' of git://trac.sagemath.org/sage into t/23204/remove_ringhomomorphism_coercion

2043ff3  Fixing doctest errors

d7eb179  Remove RingHomomorphism_coercion

dbd5b0d  fix morphism printing in doctests

f606020  Fixed some doctests

db5cee6  implement zero() for ring homsets

a42ebcf  implement __nonzero__ when there is no zero element

a9d8b4f  Merge branch 't/23204/remove_ringhomomorphism_coercion' into t/23203/a_polynomial_ring_contains_its_basering

comment:11 Changed 2 years ago by
 Commit changed from a9d8b4f440bc74a02bd564e055f287cac25d899b to 5f99cf980c01783faecf31b1009ee39adea36c69
Branch pushed to git repo; I updated commit sha1. New commits:
5f99cf9  Merge branch 'develop' into t/23203/a_polynomial_ring_contains_its_basering

comment:12 Changed 2 years ago by
 Reviewers set to cmt
comment:13 Changed 2 years ago by
Full names in reviewer field please :)
comment:14 Changed 2 years ago by
 Reviewers cmt deleted
comment:15 Changed 2 years ago by
 Reviewers set to Claire Tomesch
comment:16 followup: ↓ 17 Changed 2 years ago by
After fetching and merging #23204 into my local branch for this ticket, I built sage. I then ran ./sage coverage <files>
for all the files listed in the diff for this ticket, and compared that to the results of running the same command for the latest build of develop (8.0 rc2). The same number of missing doctests occurred in each build for each file, and although the total number of doctests for src/sage/rings/morphism.pyx
and src/sage/rings/polynomial/polynomial_element.pyx
changed between the develop build and this build, this was to be expected given the number of methods deleted (__nonzero__
and is_zero
) and the number of trivial methods added (is_injective
and (is_surjective
), respectively. So, it appears that functionally the doctest coverage remained the same.
I am still within the (lengthly) process of running ./sage tp 8 long src/
now. It has produced some errors, which I will attempt to replicate before posting about them. Running all of the doctests may have been a mistake... I will also retry a more limited set of doctests shortly as well.
comment:17 in reply to: ↑ 16 Changed 2 years ago by
I just updated #23204 to fix typos in two of the doctest. If you are getting a two failures, you might try checking out the updated ticket.
Replying to cmt:
After fetching and merging #23204 into my local branch for this ticket, I built sage. I then ran
./sage coverage <files>
for all the files listed in the diff for this ticket, and compared that to the results of running the same command for the latest build of develop (8.0 rc2). The same number of missing doctests occurred in each build for each file, and although the total number of doctests forsrc/sage/rings/morphism.pyx
andsrc/sage/rings/polynomial/polynomial_element.pyx
changed between the develop build and this build, this was to be expected given the number of methods deleted (__nonzero__
andis_zero
) and the number of trivial methods added (is_injective
and (is_surjective
), respectively. So, it appears that functionally the doctest coverage remained the same.I am still within the (lengthly) process of running
./sage tp 8 long src/
now. It has produced some errors, which I will attempt to replicate before posting about them. Running all of the doctests may have been a mistake... I will also retry a more limited set of doctests shortly as well.
comment:18 Changed 2 years ago by
Okay, something in my configuration had gotten messed up, so I started over entirely. I just pulled the latest version of this branch (5f99cf980c
), which has the content of #23204 already merged in, merged in the latest develop branch (74b03027bc
), and rebuilt. I then ran the following limited set of doctests and got these results:
bash3.2$ ./sage tp 8 long src/sage/structure/ src/sage/categories/ src/sage/rings/ src/sage/modular/ src/sage/schemes/ too few successful tests, not using stored timings Running doctests with ID 20170721163334b8fb451a. Git branch: t/23203/a_polynomial_ring_contains_its_basering Using optional=ccache,mpir,python2,sage Sorting sources by runtime so that slower doctests are run first.... Doctesting 883 files using 8 threads. ... sage t long src/sage/schemes/curves/projective_curve.py ********************************************************************** File "src/sage/schemes/curves/projective_curve.py", line 1304, in sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model Failed example: D = C.ordinary_model(); D # long time (2 seconds) Exception raised: Traceback (most recent call last): File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model[8]>", line 1, in <module> D = C.ordinary_model(); D # long time (2 seconds) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/schemes/curves/projective_curve.py", line 1393, in ordinary_model emb = extension(C.singular_subscheme()) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/schemes/curves/projective_curve.py", line 1373, in extension pts = self.change_ring(F.embeddings(QQbar)[0]).rational_points() File "/Sage/sage/local/lib/python2.7/sitepackages/sage/schemes/generic/algebraic_scheme.py", line 1846, in change_ring I = [f.change_ring(R) for f in self.defining_polynomials()] File "sage/rings/polynomial/multi_polynomial.pyx", line 873, in sage.rings.polynomial.multi_polynomial.MPolynomial.change_ring (build/cythonized/sage/rings/polynomial/multi_polynomial.c:13133) return self.parent().change_ring(R)(self) File "sage/rings/polynomial/multi_polynomial_ring_generic.pyx", line 985, in sage.rings.polynomial.multi_polynomial_ring_generic.MPolynomialRing_generic.change_ring (build/cythonized/sage/rings/polynomial/multi_polynomial_ring_generic.c:15237) return PolynomialRing(base_ring, self.ngens(), names, order=order) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/rings/polynomial/polynomial_ring_constructor.py", line 438, in PolynomialRing raise TypeError('base_ring must be a ring') TypeError: base_ring must be a ring ********************************************************************** File "src/sage/schemes/curves/projective_curve.py", line 1321, in sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model Failed example: all([D.codomain().is_ordinary_singularity(Q) for Q in D.codomain().singular_points()]) # long time Exception raised: Traceback (most recent call last): File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model[9]>", line 1, in <module> all([D.codomain().is_ordinary_singularity(Q) for Q in D.codomain().singular_points()]) # long time NameError: name 'D' is not defined ********************************************************************** File "src/sage/schemes/curves/projective_curve.py", line 1329, in sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model Failed example: C.ordinary_model() # long time (5 seconds) Exception raised: Traceback (most recent call last): File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model[13]>", line 1, in <module> C.ordinary_model() # long time (5 seconds) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/schemes/curves/projective_curve.py", line 1393, in ordinary_model emb = extension(C.singular_subscheme()) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/schemes/curves/projective_curve.py", line 1373, in extension pts = self.change_ring(F.embeddings(QQbar)[0]).rational_points() File "/Sage/sage/local/lib/python2.7/sitepackages/sage/schemes/generic/algebraic_scheme.py", line 1846, in change_ring I = [f.change_ring(R) for f in self.defining_polynomials()] File "sage/rings/polynomial/multi_polynomial.pyx", line 873, in sage.rings.polynomial.multi_polynomial.MPolynomial.change_ring (build/cythonized/sage/rings/polynomial/multi_polynomial.c:13133) return self.parent().change_ring(R)(self) File "sage/rings/polynomial/multi_polynomial_ring_generic.pyx", line 985, in sage.rings.polynomial.multi_polynomial_ring_generic.MPolynomialRing_generic.change_ring (build/cythonized/sage/rings/polynomial/multi_polynomial_ring_generic.c:15237) return PolynomialRing(base_ring, self.ngens(), names, order=order) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/rings/polynomial/polynomial_ring_constructor.py", line 438, in PolynomialRing raise TypeError('base_ring must be a ring') TypeError: base_ring must be a ring ********************************************************************** 1 item had failures: 3 of 15 in sage.schemes.curves.projective_curve.ProjectivePlaneCurve.ordinary_model [328 tests, 3 failures, 65.69 s] ...  sage t long src/sage/schemes/curves/projective_curve.py # 3 doctests failed  Total time for all tests: 1958.8 seconds cpu time: 6272.7 seconds cumulative wall time: 15257.4 seconds
I also ran the same tests on the latest develop build (74b03027bc
) and they passed, so it seems like there is still something to fix here.
Since I think someone with fresh eyes should take a look at this ticket the next time it comes up for review, I am taking my name out of the reviewer field.
comment:19 Changed 2 years ago by
 Reviewers Claire Tomesch deleted
 Status changed from needs_review to needs_work
comment:20 Changed 2 years ago by
cmt: Thanks for pointing this out. This is a problem in #23204. I'll fix it there.
comment:21 Changed 2 years ago by
Fixed in #23204.
comment:22 Changed 2 years ago by
 Reviewers set to Claire Tomesch
 Status changed from needs_work to needs_review
comment:23 Changed 2 years ago by
Claire: We usually do not remove people from the Reviewers field, i.e., it is just a list of everybody that had a look at the ticket.
comment:24 Changed 2 years ago by
Julian: Thanks, and my apologies! I didn't realize that was the convention.
comment:25 Changed 2 years ago by
I just merged the latest version of #23204 (382e2d1807
) into the latest version of this ticket (5f99cf980c
), rebuilt, and reran the same limited set of tests (./sage tp 8 long src/sage/structure/ src/sage/categories/ src/sage/rings/ src/sage/modular/ src/sage/schemes/
) which all passed!
I am now running all doctests.
comment:26 Changed 2 years ago by
 Status changed from needs_review to positive_review
I just ran all tests in src/sage
and produced only the following weird failed tests:
$ ./sage tp 8 long src/sage/ too few successful tests, not using stored timings Running doctests with ID 201707221222478f9951fd. Git branch: t/23203/a_polynomial_ring_contains_its_basering Using optional=ccache,mpir,python2,sage Sorting sources by runtime so that slower doctests are run first.... Doctesting 2969 files using 8 threads. ... sage t long src/sage/tests/cmdline.py ********************************************************************** File "src/sage/tests/cmdline.py", line 814, in sage.tests.cmdline.test_executable Failed example: test_executable(["sage", "rst2sws", input, output]) Expected: ('', '', 0) Got: ('', 'Traceback (most recent call last):\n File "/Sage/sage/src/bin/sagerst2sws", line 131, in <module>\n from sagenb.notebook.notebook import Notebook\n File "/Sage/sage/local/lib/python2.7/sitepackages/sagenb/notebook/notebook.py", line 46, in <module>\n from . import js # javascript\n File "/Sage/sage/local/lib/python2.7/sitepackages/sagenb/notebook/js.py", line 34, in <module>\n from .compress.JavaScriptCompressor import JavaScriptCompressor\nImportError: No module named JavaScriptCompressor\n', 1) ********************************************************************** File "src/sage/tests/cmdline.py", line 817, in sage.tests.cmdline.test_executable Failed example: f = tarfile.open(output, 'r') Exception raised: Traceback (most recent call last): File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.tests.cmdline.test_executable[242]>", line 1, in <module> f = tarfile.open(output, 'r') File "/Sage/sage/local/lib/python2.7/tarfile.py", line 1680, in open raise ReadError("file could not be opened successfully") ReadError: file could not be opened successfully ********************************************************************** File "src/sage/tests/cmdline.py", line 818, in sage.tests.cmdline.test_executable Failed example: print(f.extractfile('sage_worksheet/worksheet.html').read()) Exception raised: Traceback (most recent call last): File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.tests.cmdline.test_executable[243]>", line 1, in <module> print(f.extractfile('sage_worksheet/worksheet.html').read()) AttributeError: 'file' object has no attribute 'extractfile' ********************************************************************** File "src/sage/tests/cmdline.py", line 832, in sage.tests.cmdline.test_executable Failed example: print(f.extractfile('sage_worksheet/worksheet.txt').read()) Exception raised: Traceback (most recent call last): File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/Sage/sage/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.tests.cmdline.test_executable[244]>", line 1, in <module> print(f.extractfile('sage_worksheet/worksheet.txt').read()) AttributeError: 'file' object has no attribute 'extractfile' ********************************************************************** 1 item had failures: 4 of 246 in sage.tests.cmdline.test_executable [245 tests, 4 failures, 155.43 s]  sage t long src/sage/tests/cmdline.py # 4 doctests failed 
However! When I run these same doctests on my latest build of the develop branch (74b03027bc
), the exact same tests also fail.
Therefore, I'm going to positively review this ticket  if others think this is a problem they are welcome to revert the status as they see fit.
comment:27 Changed 2 years ago by
 Branch changed from u/saraedum/a_polynomial_ring_contains_its_basering to 5f99cf980c01783faecf31b1009ee39adea36c69
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
A polynomial ring contains its basering