From 6dac5b0922c289ad18f209a30c4bb54c060fc6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 13 Sep 2025 20:58:27 +0200 Subject: [PATCH 1/2] various details in algebras, categories --- src/sage/algebras/lie_algebras/quotient.py | 3 --- src/sage/categories/coxeter_groups.py | 8 ++++---- src/sage/categories/crystals.py | 2 +- .../finite_dimensional_lie_algebras_with_basis.py | 10 +++++----- src/sage/categories/finite_lattice_posets.py | 1 - src/sage/categories/highest_weight_crystals.py | 4 ++-- src/sage/categories/ore_modules.py | 3 --- src/sage/categories/pushout.py | 2 +- src/sage/categories/rings.py | 2 -- src/sage/categories/supercrystals.py | 10 ++++------ 10 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/sage/algebras/lie_algebras/quotient.py b/src/sage/algebras/lie_algebras/quotient.py index 4fec104335d..d75017aa6dd 100644 --- a/src/sage/algebras/lie_algebras/quotient.py +++ b/src/sage/algebras/lie_algebras/quotient.py @@ -21,7 +21,6 @@ from sage.categories.homset import Hom from sage.categories.lie_algebras import LieAlgebras from sage.categories.morphism import SetMorphism -from sage.structure.element import Element from sage.structure.indexed_generators import standardize_names_index_set @@ -218,7 +217,6 @@ def __classcall_private__(cls, ambient, I, names=None, index_set=None, # extract an index set from a complementary basis to the ideal I_supp = [X.leading_support() for X in I.leading_monomials()] - inv = ambient.basis().inverse_family() IA = I.ambient() B = ambient.basis() if index_set_mapping is None: @@ -264,7 +262,6 @@ def __init__(self, L, I, names, index_set, index_set_mapping, category=None): sage: TestSuite(K).run() """ B = L.basis() - IA = I.ambient() self._index_set_mapping = dict(index_set_mapping) sm = L.module().submodule_with_basis([I.reduce(B[k]).to_vector() for k in self._index_set_mapping.values()]) diff --git a/src/sage/categories/coxeter_groups.py b/src/sage/categories/coxeter_groups.py index 87a03739c09..3390b02b6d5 100644 --- a/src/sage/categories/coxeter_groups.py +++ b/src/sage/categories/coxeter_groups.py @@ -1924,10 +1924,10 @@ def reduced_word_graph(self): P = self.parent() edges = [] - for i, x in enumerate(R): - x = tuple(x) - for y in R[i:]: - y = tuple(y) + for i, _x in enumerate(R): + x = tuple(_x) + for _y in R[i:]: + y = tuple(_y) # Check that the reduced expressions differ by only # a single braid move j = 0 diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index 8d55a5b352e..690a9a557a9 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -1248,7 +1248,7 @@ def direct_sum(self, X): __add__ = direct_sum @abstract_method(optional=True) - def connected_components_generators(self): + def connected_components_generators(self) -> tuple: """ Return a tuple of generators for each of the connected components of ``self``. diff --git a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py index fc2447130c3..67f762baeb0 100644 --- a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py @@ -1075,7 +1075,7 @@ def ideal(self, *gens, **kwds): [x, y] """ from sage.algebras.lie_algebras.subalgebra import LieSubalgebra_finite_dimensional_with_basis - from sage.structure.element import parent, Element + from sage.structure.element import Element if len(gens) == 1 and not isinstance(gens[0], Element): gens = gens[0] category = kwds.pop('category', None) @@ -2720,17 +2720,17 @@ def reduce(self, X): P = X.parent() X = self.ambient()(X) # make sure it is in the ambient space for Y in self.basis(): - Y = self.lift(Y) - k, c = Y.leading_item(key=self._order) + lY = self.lift(Y) + k, c = lY.leading_item(key=self._order) if not X[k]: # scalar will be 0 continue if is_field: - X -= (X[k] / c) * Y + X -= (X[k] / c) * lY else: try: q, _ = X[k].quo_rem(c) - X -= q * Y + X -= q * lY except AttributeError: break diff --git a/src/sage/categories/finite_lattice_posets.py b/src/sage/categories/finite_lattice_posets.py index 771bf0483cb..f09fba148cc 100644 --- a/src/sage/categories/finite_lattice_posets.py +++ b/src/sage/categories/finite_lattice_posets.py @@ -10,7 +10,6 @@ # ***************************************************************************** from sage.categories.category_with_axiom import CategoryWithAxiom -from sage.misc.cachefunc import cached_method class FiniteLatticePosets(CategoryWithAxiom): diff --git a/src/sage/categories/highest_weight_crystals.py b/src/sage/categories/highest_weight_crystals.py index db7600755bb..3c3ec0c1b13 100644 --- a/src/sage/categories/highest_weight_crystals.py +++ b/src/sage/categories/highest_weight_crystals.py @@ -112,7 +112,7 @@ def additional_structure(self): class ParentMethods: @cached_method - def highest_weight_vectors(self): + def highest_weight_vectors(self) -> tuple: r""" Return the highest weight vectors of ``self``. @@ -672,7 +672,7 @@ class ParentMethods: Implement operations on tensor products of crystals. """ @cached_method - def highest_weight_vectors(self): + def highest_weight_vectors(self) -> tuple: r""" Return the highest weight vectors of ``self``. diff --git a/src/sage/categories/ore_modules.py b/src/sage/categories/ore_modules.py index b4720a56269..17607a77606 100644 --- a/src/sage/categories/ore_modules.py +++ b/src/sage/categories/ore_modules.py @@ -1,8 +1,5 @@ -from sage.misc.lazy_attribute import lazy_attribute - from sage.categories.modules import Modules from sage.categories.category_types import Category_over_base_ring -from sage.categories.homsets import Homsets from sage.rings.polynomial.ore_polynomial_ring import OrePolynomialRing diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index a8458de23fb..9207b767997 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -1955,7 +1955,7 @@ def _apply_functor(self, R): return FreeModule(R, self.n, sparse=self.is_sparse, inner_product_matrix=self.inner_product_matrix, with_basis=self.with_basis, basis_keys=self.basis_keys) return FreeModule(R, self.n, sparse=self.is_sparse, inner_product_matrix=self.inner_product_matrix, - with_basis=self.with_basis, basis_keys=self.basis_keys, name=name, latex_name=latex_name) + with_basis=self.with_basis, basis_keys=self.basis_keys, name=name, latex_name=latex_name) def _apply_functor_to_morphism(self, f): """ diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index 28872b12b26..69f0e4a18d8 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -20,8 +20,6 @@ from sage.misc.prandom import randint from sage.categories.category_with_axiom import CategoryWithAxiom from sage.categories.rngs import Rngs -from sage.structure.element import Element -from sage.structure.parent import Parent class Rings(CategoryWithAxiom): diff --git a/src/sage/categories/supercrystals.py b/src/sage/categories/supercrystals.py index 59fbf9241df..47045713c80 100644 --- a/src/sage/categories/supercrystals.py +++ b/src/sage/categories/supercrystals.py @@ -146,7 +146,7 @@ def genuine_highest_weight_vectors(self): connected_components_generators = genuine_highest_weight_vectors - def connected_components(self): + def connected_components(self) -> list: r""" Return the connected components of ``self`` as subcrystals. @@ -174,8 +174,6 @@ def connected_components(self): CCs = [] for mg in self.connected_components_generators(): - if not isinstance(mg, tuple): - mg = (mg,) subcrystal = self.subcrystal(generators=mg, index_set=index_set, cartan_type=cartan_type, @@ -184,7 +182,7 @@ def connected_components(self): return CCs - def genuine_lowest_weight_vectors(self): + def genuine_lowest_weight_vectors(self) -> tuple: r""" Return the tuple of genuine lowest weight elements of ``self``. @@ -205,7 +203,7 @@ def genuine_lowest_weight_vectors(self): return tuple([x[1] for x in self._genuine_highest_lowest_weight_vectors()]) @cached_method - def _genuine_highest_lowest_weight_vectors(self): + def _genuine_highest_lowest_weight_vectors(self) -> tuple: r""" Return the genuine lowest and highest weight elements of ``self``. @@ -267,7 +265,7 @@ def character(self): return A.sum(A(x.weight()) for x in self) @cached_method - def highest_weight_vectors(self): + def highest_weight_vectors(self) -> tuple: """ Return the highest weight vectors of ``self``. From 47848b4964b28fbcf1a599ea38243e99383cb260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 14 Sep 2025 08:48:32 +0200 Subject: [PATCH 2/2] adjustment in supercrystals --- src/sage/categories/supercrystals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/categories/supercrystals.py b/src/sage/categories/supercrystals.py index 47045713c80..3961f4bb0c8 100644 --- a/src/sage/categories/supercrystals.py +++ b/src/sage/categories/supercrystals.py @@ -174,7 +174,7 @@ def connected_components(self) -> list: CCs = [] for mg in self.connected_components_generators(): - subcrystal = self.subcrystal(generators=mg, + subcrystal = self.subcrystal(generators=(mg,), index_set=index_set, cartan_type=cartan_type, category=category)