Skip to content

Commit 0b0b447

Browse files
author
Release Manager
committed
gh-41096: Fix bug with creation of extensions of function fields When creating a function field extension, it is never checked that the polynomial defining the extension is defined over that function field. Hence, when calling `base_ring` one gets a bug because the base ring of the polynomial ring is returned, and not the function field which we used to create the extension. Fixes #41095. When working on this, I remarked that the `extension` method of `RationalFunctionField` was just a copy paste (even for doctests) of the one of `FunctionField`, which is its parent. So I also removed it. But I can put it back if someone explains me why this can sometimes be useful to do so. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [X] I have linked a relevant issue or discussion. - [X] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: #41096 Reported by: Rubén Muñoz--Bertrand Reviewer(s): Chenxin Zhong, Rubén Muñoz--Bertrand
2 parents 33950d6 + 74deb42 commit 0b0b447

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

src/sage/rings/function_field/function_field.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,22 @@ def extension(self, f, names=None):
467467
468468
sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1)) # needs sage.rings.function_field
469469
Function field in y defined by t*y^3 + 1/t*y + t^3/(t + 1)
470+
471+
TESTS:
472+
473+
Verify that :issue:`41095` has been resolved::
474+
475+
sage: K.<x> = FunctionField(GF(2))
476+
sage: R.<t> = PolynomialRing(K)
477+
sage: L.<y> = K.extension(t^2 + t*x)
478+
sage: M.<z> = L.extension(t^3 + x)
479+
sage: M.base_ring() is K
480+
False
481+
sage: M.base_ring() is L
482+
True
470483
"""
471484
from . import constructor
472-
return constructor.FunctionFieldExtension(f, names)
485+
return constructor.FunctionFieldExtension(f.change_ring(self), names)
473486

474487
def order_with_basis(self, basis, check: bool = True):
475488
"""

src/sage/rings/function_field/function_field_rational.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -430,38 +430,6 @@ def _factor_univariate_polynomial(self, f, proof=None):
430430
from sage.structure.factorization import Factorization
431431
return Factorization(w, unit=unit)
432432

433-
def extension(self, f, names=None):
434-
"""
435-
Create an extension `L = K[y]/(f(y))` of the rational function field.
436-
437-
INPUT:
438-
439-
- ``f`` -- univariate polynomial over self
440-
441-
- ``names`` -- string or length-1 tuple
442-
443-
OUTPUT: a function field
444-
445-
EXAMPLES::
446-
447-
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
448-
sage: K.extension(y^5 - x^3 - 3*x + x*y) # needs sage.rings.function_field
449-
Function field in y defined by y^5 + x*y - x^3 - 3*x
450-
451-
A nonintegral defining polynomial::
452-
453-
sage: K.<t> = FunctionField(QQ); R.<y> = K[]
454-
sage: K.extension(y^3 + (1/t)*y + t^3/(t+1)) # needs sage.rings.function_field
455-
Function field in y defined by y^3 + 1/t*y + t^3/(t + 1)
456-
457-
The defining polynomial need not be monic or integral::
458-
459-
sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1)) # needs sage.rings.function_field
460-
Function field in y defined by t*y^3 + 1/t*y + t^3/(t + 1)
461-
"""
462-
from . import constructor
463-
return constructor.FunctionFieldExtension(f, names)
464-
465433
@cached_method
466434
def polynomial_ring(self, var='x'):
467435
"""

0 commit comments

Comments
 (0)