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

minor tweaks in Ore polynomials #39232

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/sage/rings/polynomial/ore_function_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
# https://www.gnu.org/licenses/
# ***************************************************************************

from sage.structure.richcmp import richcmp, op_EQ, op_NE
from sage.misc.cachefunc import cached_method
from sage.misc.latex import latex

from sage.categories.homset import Hom
from sage.categories.map import Map
from sage.categories.morphism import Morphism
from sage.categories.homset import Hom
from sage.misc.cachefunc import cached_method
from sage.misc.latex import latex
from sage.structure.element import AlgebraElement
from sage.structure.richcmp import op_EQ, op_NE, richcmp


class OreFunction(AlgebraElement):
Expand Down
65 changes: 32 additions & 33 deletions src/sage/rings/polynomial/ore_function_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@
sage: g^(-1) * f
(d - 1/t)^(-1) * (d + (t^2 - 1)/t)

TESTS:

The Ore function field is commutative if the twisting morphism is the
identity and the twisting derivation vanishes. ::

sage: # needs sage.rings.finite_rings
sage: k.<a> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: S.<x> = k['x', Frob]
sage: K = S.fraction_field()
sage: K.is_commutative()
False
sage: T.<y> = k['y', Frob^3]
sage: L = T.fraction_field()
sage: L.is_commutative()
True

AUTHOR:

- Xavier Caruso (2020-05)
Expand All @@ -144,21 +161,21 @@
# https://www.gnu.org/licenses/
# ***************************************************************************

import sage

from sage.structure.richcmp import op_EQ
from sage.structure.category_object import normalize_names
from sage.structure.unique_representation import UniqueRepresentation
from sage.structure.parent import Parent
from sage.categories.algebras import Algebras
from sage.categories.commutative_rings import CommutativeRings
from sage.categories.fields import Fields

from sage.rings.morphism import RingHomomorphism
from sage.categories.homset import Hom
from sage.categories.map import Section

from sage.rings.morphism import RingHomomorphism
from sage.rings.polynomial.ore_function_element import (
OreFunction_with_large_center,
OreFunctionBaseringInjection,
)
from sage.rings.polynomial.ore_polynomial_ring import OrePolynomialRing
from sage.rings.polynomial.ore_function_element import OreFunctionBaseringInjection
from sage.structure.category_object import normalize_names
from sage.structure.parent import Parent
from sage.structure.richcmp import op_EQ
from sage.structure.unique_representation import UniqueRepresentation

WORKING_CENTER_MAX_TRIES = 1000

Expand Down Expand Up @@ -200,7 +217,10 @@
self._simplification = False
self._ring = ring
base = ring.base_ring()
category = Algebras(base).or_subcategory(category)
if ring in CommutativeRings():
category = Algebras(base).Commutative().or_subcategory(category)

Check warning on line 221 in src/sage/rings/polynomial/ore_function_field.py

View check run for this annotation

Codecov / codecov/patch

src/sage/rings/polynomial/ore_function_field.py#L221

Added line #L221 was not covered by tests
else:
category = Algebras(base).or_subcategory(category)
Parent.__init__(self, base=base, names=ring.variable_name(),
normalize=True, category=category)

Expand Down Expand Up @@ -614,27 +634,6 @@
denominator = self._ring.random_element(degdenom, True, *args, **kwds)
return self(numerator, denominator)

def is_commutative(self) -> bool:
fchapoton marked this conversation as resolved.
Show resolved Hide resolved
r"""
Return ``True`` if this Ore function field is commutative, i.e. if the
twisting morphism is the identity and the twisting derivation vanishes.

EXAMPLES::

sage: # needs sage.rings.finite_rings
sage: k.<a> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: S.<x> = k['x', Frob]
sage: K = S.fraction_field()
sage: K.is_commutative()
False
sage: T.<y> = k['y', Frob^3]
sage: L = T.fraction_field()
sage: L.is_commutative()
True
"""
return self._ring.is_commutative()

def is_field(self, proof=False) -> bool:
r"""
Return always ``True`` since Ore function field are (skew) fields.
Expand Down Expand Up @@ -892,7 +891,7 @@
sage: TestSuite(K).run()
"""
if self.Element is None:
self.Element = sage.rings.polynomial.ore_function_element.OreFunction_with_large_center
self.Element = OreFunction_with_large_center
OreFunctionField.__init__(self, ring, category)
self._center = {}
self._center_variable_name = 'z'
Expand Down
84 changes: 39 additions & 45 deletions src/sage/rings/polynomial/ore_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@
which constructs a general dense univariate Ore polynomial ring over a
commutative base with equipped with an endomorphism and/or a derivation.

TESTS:

The Ore polynomial ring is commutative if the twisting morphism is the
identity and the twisting derivation vanishes. ::

sage: # needs sage.rings.finite_rings
sage: k.<a> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: S.<x> = k['x', Frob]
sage: S.is_commutative()
False
sage: T.<y> = k['y', Frob^3]
sage: T.is_commutative()
True

sage: R.<t> = GF(5)[]
sage: der = R.derivation()
sage: A.<d> = R['d', der]
sage: A.is_commutative()
False
sage: B.<b> = R['b', 5*der]
sage: B.is_commutative()
True

AUTHOR:

- Xavier Caruso (2020-04)
Expand All @@ -21,25 +45,21 @@
# https://www.gnu.org/licenses/
# ***************************************************************************

from sage.misc.prandom import randint
from sage.categories.algebras import Algebras
from sage.categories.commutative_rings import CommutativeRings
from sage.categories.morphism import Morphism
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_import import lazy_import
from sage.misc.prandom import randint
from sage.rings.infinity import Infinity
from sage.rings.integer import Integer
from sage.rings.polynomial.ore_polynomial_element import OrePolynomialBaseringInjection
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.ring import _Fields
from sage.structure.category_object import normalize_names
from sage.structure.element import Element
from sage.structure.parent import Parent

from sage.structure.unique_representation import UniqueRepresentation
from sage.rings.integer import Integer
from sage.structure.element import Element

from sage.categories.commutative_rings import CommutativeRings
from sage.categories.algebras import Algebras
from sage.rings.ring import _Fields

from sage.categories.morphism import Morphism

from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.polynomial.ore_polynomial_element import OrePolynomialBaseringInjection

lazy_import('sage.rings.derivation', 'RingDerivation')

Expand Down Expand Up @@ -421,7 +441,11 @@
self._morphism = morphism
self._derivation = derivation
self._fraction_field = None
category = Algebras(base_ring).or_subcategory(category)
if morphism is None and derivation is None:
cat = Algebras(base_ring).Commutative()

Check warning on line 445 in src/sage/rings/polynomial/ore_polynomial_ring.py

View check run for this annotation

Codecov / codecov/patch

src/sage/rings/polynomial/ore_polynomial_ring.py#L445

Added line #L445 was not covered by tests
else:
cat = Algebras(base_ring)
category = cat.or_subcategory(category)
Parent.__init__(self, base_ring, names=name,
normalize=True, category=category)

Expand Down Expand Up @@ -506,7 +530,7 @@
pass
if isinstance(a, str):
try:
from sage.misc.parser import Parser, LookupNameMaker
from sage.misc.parser import LookupNameMaker, Parser

Check warning on line 533 in src/sage/rings/polynomial/ore_polynomial_ring.py

View check run for this annotation

Codecov / codecov/patch

src/sage/rings/polynomial/ore_polynomial_ring.py#L533

Added line #L533 was not covered by tests
R = self.base_ring()
p = Parser(Integer, R, LookupNameMaker({self.variable_name(): self.gen()}, R))
return self(p.parse(a))
Expand Down Expand Up @@ -1095,36 +1119,6 @@
if irred.is_irreducible():
return irred

def is_commutative(self) -> bool:
fchapoton marked this conversation as resolved.
Show resolved Hide resolved
r"""
Return ``True`` if this Ore polynomial ring is commutative.

This holds if the twisting morphism is the identity and the
twisting derivation vanishes.

EXAMPLES::

sage: # needs sage.rings.finite_rings
sage: k.<a> = GF(5^3)
sage: Frob = k.frobenius_endomorphism()
sage: S.<x> = k['x', Frob]
sage: S.is_commutative()
False
sage: T.<y> = k['y', Frob^3]
sage: T.is_commutative()
True

sage: R.<t> = GF(5)[]
sage: der = R.derivation()
sage: A.<d> = R['d', der]
sage: A.is_commutative()
False
sage: B.<b> = R['b', 5*der]
sage: B.is_commutative()
True
"""
return self._morphism is None and self._derivation is None

def is_field(self, proof=False) -> bool:
r"""
Return always ``False`` since Ore polynomial rings are never fields.
Expand Down
Loading