Open
Description
Steps To Reproduce
From this sage-devel thread:
sage: R.<x, y> = QQ[]
sage: F = FreeModule(R, 1)
sage: G = F.submodule([F([0])])
sage: vec = F([1])
sage: vec in G
True
Expected Behavior
The answer should be False
, since the 0-submodule does not contain any nonzero vectors.
Actual Behavior
The answer is True
. The behaviour is the same when QQ
is replaced with ZZ
, GF(p)
, CC
, etc., but we do get the correct result (False
) if R.<x, y>
is replaced with R.<x>
.
Additional Information
Partial diagnosis. Essentially, the __contains__
method of G
executes the following code:
try:
return G(vec) == vec
For R.<x,y>
, we have:
sage: G(vec) == vec
True
So the containment test returns the incorrect answerTrue
. For R.<x>
, the expression G(vec)
raises TypeError: element [1] is not in free module
, as it should, because vec
is not in G
. So the basic problem seems to be unexpected behaviour of the element constructor of G
in the case of multivariable polynomial rings.
Environment
- OS: not relevant.
- Sage Version: 10.6 and others.
Checklist
- I have searched the existing issues for a bug report that matches the one I want to file, without success.
- I have read the documentation and troubleshoot guide