Skip to content

Commit 2180122

Browse files
author
Release Manager
committed
gh-37354: Allow submodule construction of a free module over a ring This fails ```sage sage: R.<x,y> = QQ[] sage: S = R.quotient([x*y]) sage: M = FreeModule(S, 2) sage: M.zero_submodule() ... TypeError: ambient (=Ambient free module of rank 2 over Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y)) must be ambient or a quotient ``` We fix this by removing unnecessary restriction on modules over rings. <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #37354 Reported by: Kwankyu Lee Reviewer(s): Travis Scrimshaw
2 parents 686f7e9 + 300c3a3 commit 2180122

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/sage/modules/submodule.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# ****************************************************************************
3636

3737
from sage.modules.free_module import (
38-
FreeModule_ambient_domain,
38+
FreeModule_ambient,
3939
Module_free_ambient,
4040
basis_seq,
4141
)
@@ -98,8 +98,19 @@ def __init__(self, ambient, gens, check=True, already_echelonized=False):
9898
sage: N = M.submodule([vector([x - y, z]), vector([y * z, x * z])])
9999
sage: N.is_submodule(M)
100100
True
101+
102+
::
103+
104+
sage: R.<x,y> = QQ[]
105+
sage: S = R.quotient([x*y])
106+
sage: M = FreeModule(S, 2)
107+
sage: M.zero_submodule()
108+
Submodule of Ambient free module of rank 2 over Quotient of Multivariate Polynomial Ring in x, y
109+
over Rational Field by the ideal (x*y)
110+
Generated by the rows of the matrix:
111+
[]
101112
"""
102-
if not isinstance(ambient, (FreeModule_ambient_domain, QuotientModule_free_ambient)):
113+
if not isinstance(ambient, (FreeModule_ambient, QuotientModule_free_ambient)):
103114
raise TypeError("ambient (=%s) must be ambient or a quotient" % ambient)
104115
R = ambient.base_ring()
105116
degree = ambient.degree()

0 commit comments

Comments
 (0)