Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Residue Field bug #38766

Open
2 tasks done
SamSchiavone opened this issue Oct 4, 2024 · 0 comments
Open
2 tasks done

Residue Field bug #38766

SamSchiavone opened this issue Oct 4, 2024 · 0 comments
Labels

Comments

@SamSchiavone
Copy link

SamSchiavone commented Oct 4, 2024

Steps To Reproduce

Running on SageMathCell

K.<z> = NumberField(x^4 - 18*x^2 + 9)
OK = K.ring_of_integers()
P = OK.ideal(3)
assert P.is_prime()
OK.residue_field(P, 'zbar')

OK.quo(P, 'zbar') seems to work.

Expected Behavior

Return the residue field of the prime ideal.

Actual Behavior

/tmp/ipykernel_1789266/327118284.py:3: DeprecationWarning: In the future, constructing an ideal of the ring of integers of a number field will use an implementation compatible with ideals of other (non-maximal) orders, rather than returning an integral fractional ideal of its containing number field. Use .fractional_ideal(), together with an .is_integral() check if desired, to avoid your code breaking with future changes to Sage.
See https://github.com/sagemath/sage/issues/34806 for details.
  P = OK.ideal(Integer(3))

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [1], line 7
      4 assert P.is_prime()
      5 #OK.residue_field(P, 'zbar')
      6 #OK.quo(P, 'zbar')
----> 7 P.residue_field()

File /home/sc_serv/sage/src/sage/rings/number_field/number_field_ideal.py:3265, in NumberFieldFractionalIdeal.residue_field(self, names)
   3263 if not self.is_prime():
   3264     raise ValueError("The ideal must be prime")
-> 3265 return self.number_field().residue_field(self, names=names)

File /home/sc_serv/sage/src/sage/rings/number_field/number_field.py:6979, in NumberField_generic.residue_field(self, prime, names, check)
   6977     raise ValueError("%s is not a prime ideal" % prime)
   6978 from sage.rings.finite_rings.residue_field import ResidueField
-> 6979 return ResidueField(prime, names=names, check=False)

File /home/sc_serv/sage/src/sage/structure/factory.pyx:373, in sage.structure.factory.UniqueFactory.__call__()
    371     key, kwds = self.create_key_and_extra_args(*args, **kwds)
    372     version = self.get_version(sage_version)
--> 373     return self.get_object(version, key, kwds)
    374 
    375 cpdef get_object(self, version, key, extra_args) noexcept:

File /home/sc_serv/sage/src/sage/structure/factory.pyx:417, in sage.structure.factory.UniqueFactory.get_object()
    415 except KeyError:
    416     pass
--> 417 obj = self.create_object(version, key, **extra_args)
    418 self._cache[version, cache_key] = obj
    419 try:

File /home/sc_serv/sage/src/sage/rings/finite_rings/residue_field.pyx:434, in sage.rings.finite_rings.residue_field.ResidueFieldFactory.create_object()
    432     M = matrix(k, n+1, n, LL)
    433 else:
--> 434     M = matrix(k, n+1, n, [to_vs(x**i).list() for i in range(n+1)])
    435 
    436 W = M.transpose().echelon_form()

File /home/sc_serv/sage/src/sage/matrix/constructor.pyx:648, in sage.matrix.constructor.matrix()
    646 """
    647 immutable = kwds.pop('immutable', False)
--> 648 M = MatrixArgs(*args, **kwds).matrix()
    649 if immutable:
    650     M.set_immutable()

File /home/sc_serv/sage/src/sage/matrix/args.pyx:690, in sage.matrix.args.MatrixArgs.matrix()
    688             break
    689 else:
--> 690     M = self.space(self, coerce=convert)
    691 
    692 # Also store the matrix to support multiple calls of matrix()

File /home/sc_serv/sage/src/sage/structure/parent.pyx:903, in sage.structure.parent.Parent.__call__()
    901         return mor._call_(x)
    902     else:
--> 903         return mor._call_with_args(x, args, kwds)
    904 
    905 raise TypeError(_LazyString("No conversion defined from %s to %s", (R, self), {}))

File /home/sc_serv/sage/src/sage/structure/coerce_maps.pyx:182, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args()
    180     print(type(C), C)
    181     print(type(C._element_constructor), C._element_constructor)
--> 182 raise
    183 
    184 

File /home/sc_serv/sage/src/sage/structure/coerce_maps.pyx:172, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args()
    170         return C._element_constructor(x)
    171     else:
--> 172         return C._element_constructor(x, **kwds)
    173 else:
    174     if len(kwds) == 0:

File /home/sc_serv/sage/src/sage/matrix/matrix_space.py:963, in MatrixSpace._element_constructor_(self, entries, **kwds)
    845 def _element_constructor_(self, entries, **kwds):
    846     """
    847     Construct an element of ``self`` from ``entries``.
    848 
   (...)
    961         False
    962     """
--> 963     return self.element_class(self, entries, **kwds)

File /home/sc_serv/sage/src/sage/matrix/matrix_modn_dense_template.pxi:528, in sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template.__init__()
    526 p = R.characteristic()
    527 
--> 528 for t in it:
    529     se = <SparseEntry>t
    530     x = se.entry

File /home/sc_serv/sage/src/sage/matrix/args.pyx:542, in iter()
    540 for j in range(self.ncols):
    541     sig_check()
--> 542     x = next(row)
    543     if convert and self.need_to_convert(x):
    544         x = self.base(x)

File /home/sc_serv/sage/src/sage/misc/misc_c.pyx:727, in sage.misc.misc_c.sized_iter.__next__()
    725     raise ValueError(f"sequence too short (expected length {self.size}, got {self.index})")
    726 self.index += 1
--> 727 self.check()
    728 return x
    729 

File /home/sc_serv/sage/src/sage/misc/misc_c.pyx:717, in sage.misc.misc_c.sized_iter.check()
    715         pass
    716     else:
--> 717         raise ValueError(f"sequence too long (expected length {self.size}, got more)")
    718 
    719 def __next__(self):

ValueError: sequence too long (expected length 2, got more)

Additional Information

Maybe this is because the defining polynomial of the number field is reducible mod 2.

Environment

Running on SageMathCell on the web. Also locally, on Sage 10.4

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant