From 06d4ef8e9f5504cc2192f6139159d975c518a1d3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 24 May 2024 21:30:50 -0700 Subject: [PATCH] sage.categories: Update # needs, use block tags --- src/sage/categories/action.pyx | 4 +- src/sage/categories/algebra_functor.py | 26 +- src/sage/categories/algebras_with_basis.py | 75 +++-- src/sage/categories/bialgebras.py | 6 +- src/sage/categories/bialgebras_with_basis.py | 40 +-- src/sage/categories/category.py | 2 +- src/sage/categories/coalgebras.py | 36 +-- src/sage/categories/coalgebras_with_basis.py | 7 +- ...eflection_or_generalized_coxeter_groups.py | 261 +++++++++--------- src/sage/categories/coxeter_groups.py | 2 +- src/sage/categories/crystals.py | 2 +- ...ite_dimensional_lie_algebras_with_basis.py | 2 +- .../finite_complex_reflection_groups.py | 55 ++-- .../finite_dimensional_algebras_with_basis.py | 40 +-- .../finite_dimensional_modules_with_basis.py | 18 +- ...ensional_semisimple_algebras_with_basis.py | 19 +- src/sage/categories/finite_monoids.py | 20 +- .../categories/finite_permutation_groups.py | 32 ++- src/sage/categories/finite_posets.py | 167 +++++++---- src/sage/categories/hecke_modules.py | 2 +- .../categories/hopf_algebras_with_basis.py | 2 +- src/sage/categories/lie_algebras.py | 115 ++++---- .../categories/lie_algebras_with_basis.py | 2 +- src/sage/categories/magmas.py | 12 +- src/sage/categories/magmatic_algebras.py | 4 +- src/sage/categories/modules.py | 6 +- src/sage/categories/modules_with_basis.py | 2 +- src/sage/categories/monoids.py | 2 +- src/sage/categories/primer.py | 44 +-- src/sage/categories/regular_crystals.py | 8 +- src/sage/categories/rings.py | 2 +- src/sage/categories/semigroups.py | 8 +- src/sage/categories/semisimple_algebras.py | 6 +- src/sage/categories/sets_cat.py | 16 +- src/sage/categories/unital_algebras.py | 1 + src/sage/categories/with_realizations.py | 16 +- 36 files changed, 561 insertions(+), 501 deletions(-) diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 8f2f2beb96f..3ca50234275 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -435,7 +435,7 @@ cdef class PrecomposedAction(Action): We demonstrate that an example discussed on :issue:`14711` did not become a problem:: - sage: # needs sage.modular + sage: # needs sage.libs.flint sage.modular sage: E = ModularSymbols(11).2 sage: s = E.modular_symbol_rep() sage: del E,s @@ -487,7 +487,7 @@ cdef class PrecomposedAction(Action): Check that this action can be pickled (:issue:`29031`):: - sage: # needs sage.modular + sage: # needs sage.libs.flint sage.modular sage: E = ModularSymbols(11).2 sage: v = E.manin_symbol_rep() sage: c,x = v[0] diff --git a/src/sage/categories/algebra_functor.py b/src/sage/categories/algebra_functor.py index 051374fa43c..46c8436de54 100644 --- a/src/sage/categories/algebra_functor.py +++ b/src/sage/categories/algebra_functor.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.groups +# sage.doctest: needs sage.groups sage.modules r""" Group algebras and beyond: the Algebra functorial construction @@ -205,7 +205,7 @@ divide the characteristic of the base field, the algebra is semisimple:: - sage: SymmetricGroup(5).algebra(QQ) in Algebras(QQ).Semisimple() + sage: SymmetricGroup(5).algebra(QQ) in Algebras(QQ).Semisimple() # needs sage.combinat True sage: CyclicPermutationGroup(10).algebra(FiniteField(7)) in Algebras.Semisimple True @@ -225,6 +225,7 @@ since there is a natural map from the integers to the rationals, there is a natural map from `\ZZ[D_2]` to `\QQ[S_4]`:: + sage: # needs sage.combinat sage: A = DihedralGroup(2).algebra(ZZ) sage: B = SymmetricGroup(4).algebra(QQ) sage: a = A.an_element(); a @@ -308,12 +309,12 @@ Properties of group algebras:: - sage: SU(2, GF(4, 'a')).algebra(IntegerModRing(12)).category() + sage: SU(2, GF(4, 'a')).algebra(IntegerModRing(12)).category() # needs sage.rings.finite_rings Category of finite group algebras over Ring of integers modulo 12 - sage: SymmetricGroup(2).algebra(QQ).is_commutative() + sage: SymmetricGroup(2).algebra(QQ).is_commutative() # needs sage.combinat True - sage: SymmetricGroup(3).algebra(QQ).is_commutative() + sage: SymmetricGroup(3).algebra(QQ).is_commutative() # needs sage.combinat False sage: G = DihedralGroup(4) @@ -364,7 +365,7 @@ sage: G = SymmetricGroup(5) sage: x,y = G.gens() - sage: A = G.algebra(QQ) + sage: A = G.algebra(QQ) # needs sage.combinat sage: A( A(x) ) (1,2,3,4,5) @@ -379,6 +380,7 @@ Coercion from the base ring takes precedences over coercion from the group:: + sage: # needs sage.rings.number_field sage: G = GL(2,7) sage: OG = GroupAlgebra(G, ZZ[AA(5).sqrt()]) sage: OG(2) @@ -387,7 +389,6 @@ sage: OG(G(2)) [2 0] [0 2] - sage: OG(FormalSum([ (1, G(2)), (2, RR(0.77)) ]) ) Traceback (most recent call last): ... @@ -411,7 +412,7 @@ morphism:: sage: G = SymmetricGroup(3) - sage: A = G.algebra(ZZ) + sage: A = G.algebra(ZZ) # needs sage.combinat sage: h = GF(5).coerce_map_from(ZZ) sage: functor = A.construction()[0]; functor @@ -420,7 +421,7 @@ sage: hh Generic morphism: From: Symmetric group algebra of order 3 over Integer Ring - To: Symmetric group algebra of order 3 over Finite Field of size 5 + To: Symmetric group algebra of order 3 over Finite Field of size 5 sage: a = 2 * A.an_element(); a 2*() + 2*(2,3) + 6*(1,2,3) + 4*(1,3,2) @@ -561,7 +562,7 @@ def __init__(self, group): EXAMPLES:: sage: from sage.categories.algebra_functor import GroupAlgebraFunctor - sage: GroupAlgebra(SU(2, GF(4, 'a')), IntegerModRing(12)).category() + sage: GroupAlgebra(SU(2, GF(4, 'a')), IntegerModRing(12)).category() # needs sage.rings.finite_rings Category of finite group algebras over Ring of integers modulo 12 """ self.__group = group @@ -617,6 +618,7 @@ def _apply_functor_to_morphism(self, f): EXAMPLES:: + sage: # needs sage.combinat sage: G = SymmetricGroup(3) sage: A = GroupAlgebra(G, ZZ) sage: h = GF(5).coerce_map_from(ZZ) @@ -624,7 +626,6 @@ def _apply_functor_to_morphism(self, f): Generic morphism: From: Symmetric group algebra of order 3 over Integer Ring To: Symmetric group algebra of order 3 over Finite Field of size 5 - sage: a = 2 * A.an_element(); a 2*() + 2*(2,3) + 6*(1,2,3) + 4*(1,3,2) sage: hh(a) @@ -673,7 +674,7 @@ def _repr_object_names(self): """ EXAMPLES:: - sage: Semigroups().Algebras(QQ) # indirect doctest + sage: Semigroups().Algebras(QQ) # indirect doctest Category of semigroup algebras over Rational Field """ return "{} algebras over {}".format(self.base_category()._repr_object_names()[:-1], @@ -726,6 +727,7 @@ def coproduct_on_basis(self, g): EXAMPLES:: + sage: # needs sage.combinat sage: PF = NonDecreasingParkingFunctions(4) sage: A = PF.algebra(ZZ); A Algebra of Non-decreasing parking functions of size 4 over Integer Ring diff --git a/src/sage/categories/algebras_with_basis.py b/src/sage/categories/algebras_with_basis.py index 0d1f72eb17c..d7334357f15 100644 --- a/src/sage/categories/algebras_with_basis.py +++ b/src/sage/categories/algebras_with_basis.py @@ -33,37 +33,32 @@ class AlgebrasWithBasis(CategoryWithAxiom_over_base_ring): We construct a typical parent in this category, and do some computations with it:: - sage: A = C.example(); A # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: A = C.example(); A An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field - - sage: A.category() # needs sage.combinat sage.modules + sage: A.category() Category of algebras with basis over Rational Field - - sage: A.one_basis() # needs sage.combinat sage.modules + sage: A.one_basis() word: - sage: A.one() # needs sage.combinat sage.modules + sage: A.one() B[word: ] - - sage: A.base_ring() # needs sage.combinat sage.modules + sage: A.base_ring() Rational Field - sage: A.basis().keys() # needs sage.combinat sage.modules + sage: A.basis().keys() Finite words over {'a', 'b', 'c'} - - sage: (a,b,c) = A.algebra_generators() # needs sage.combinat sage.modules - sage: a^3, b^2 # needs sage.combinat sage.modules + sage: (a,b,c) = A.algebra_generators() + sage: a^3, b^2 (B[word: aaa], B[word: bb]) - sage: a * c * b # needs sage.combinat sage.modules + sage: a * c * b B[word: acb] - - sage: A.product # needs sage.combinat sage.modules + sage: A.product - sage: A.product(a * b, b) # needs sage.combinat sage.modules + sage: A.product(a * b, b) B[word: abb] - - sage: TestSuite(A).run(verbose=True) # needs sage.combinat sage.modules + sage: TestSuite(A).run(verbose=True) running ._test_additive_associativity() . . . pass running ._test_an_element() . . . pass running ._test_associativity() . . . pass @@ -93,9 +88,9 @@ class AlgebrasWithBasis(CategoryWithAxiom_over_base_ring): running ._test_prod() . . . pass running ._test_some_elements() . . . pass running ._test_zero() . . . pass - sage: A.__class__ # needs sage.combinat sage.modules + sage: A.__class__ - sage: A.element_class # needs sage.combinat sage.modules + sage: A.element_class Please see the source code of `A` (with ``A??``) for how to @@ -150,9 +145,10 @@ def hochschild_complex(self, M): sage: A = algebras.DifferentialWeyl(R) # needs sage.modules sage: H = A.hochschild_complex(A) # needs sage.modules - sage: SGA = SymmetricGroupAlgebra(QQ, 3) # needs sage.combinat sage.modules - sage: T = SGA.trivial_representation() # needs sage.combinat sage.modules - sage: H = SGA.hochschild_complex(T) # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules + sage: SGA = SymmetricGroupAlgebra(QQ, 3) + sage: T = SGA.trivial_representation() + sage: H = SGA.hochschild_complex(T) """ from sage.homology.hochschild_complex import HochschildComplex return HochschildComplex(self, M) @@ -243,19 +239,19 @@ def one_from_cartesian_product_of_one_basis(self): EXAMPLES:: - sage: A = AlgebrasWithBasis(QQ).example(); A # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: A = AlgebrasWithBasis(QQ).example(); A An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field - sage: A.one_basis() # needs sage.combinat sage.modules + sage: A.one_basis() word: - - sage: B = cartesian_product((A, A, A)) # needs sage.combinat sage.modules - sage: B.one_from_cartesian_product_of_one_basis() # needs sage.combinat sage.modules + sage: B = cartesian_product((A, A, A)) + sage: B.one_from_cartesian_product_of_one_basis() B[(0, word: )] + B[(1, word: )] + B[(2, word: )] - sage: B.one() # needs sage.combinat sage.modules + sage: B.one() B[(0, word: )] + B[(1, word: )] + B[(2, word: )] - sage: cartesian_product([SymmetricGroupAlgebra(QQ, 3), # needs sage.combinat sage.modules + sage: cartesian_product([SymmetricGroupAlgebra(QQ, 3), # needs sage.combinat sage.groups sage.modules ....: SymmetricGroupAlgebra(QQ, 4)]).one() B[(0, [1, 2, 3])] + B[(1, [1, 2, 3, 4])] """ @@ -347,23 +343,22 @@ def product_on_basis(self, t1, t2): EXAMPLES:: - sage: A = AlgebrasWithBasis(QQ).example(); A # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.modules + sage: A = AlgebrasWithBasis(QQ).example(); A An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field - sage: (a,b,c) = A.algebra_generators() # needs sage.combinat sage.modules - - sage: x = tensor((a, b, c)); x # needs sage.combinat sage.modules + sage: (a,b,c) = A.algebra_generators() + sage: x = tensor((a, b, c)); x B[word: a] # B[word: b] # B[word: c] - sage: y = tensor((c, b, a)); y # needs sage.combinat sage.modules + sage: y = tensor((c, b, a)); y B[word: c] # B[word: b] # B[word: a] - sage: x * y # needs sage.combinat sage.modules + sage: x * y B[word: ac] # B[word: bb] # B[word: ca] - - sage: x = tensor(((a + 2*b), c)); x # needs sage.combinat sage.modules + sage: x = tensor(((a + 2*b), c)); x B[word: a] # B[word: c] + 2*B[word: b] # B[word: c] - sage: y = tensor((c, a)) + 1; y # needs sage.combinat sage.modules + sage: y = tensor((c, a)) + 1; y B[word: ] # B[word: ] + B[word: c] # B[word: a] - sage: x * y # needs sage.combinat sage.modules + sage: x * y B[word: a] # B[word: c] + B[word: ac] # B[word: ca] + 2*B[word: b] # B[word: c] + 2*B[word: bc] # B[word: ca] diff --git a/src/sage/categories/bialgebras.py b/src/sage/categories/bialgebras.py index b927766568b..d1f1dbcea06 100644 --- a/src/sage/categories/bialgebras.py +++ b/src/sage/categories/bialgebras.py @@ -71,7 +71,7 @@ def is_primitive(self): sage: # needs sage.modules sage: s = SymmetricFunctions(QQ).schur() - sage: s([5]).is_primitive() + sage: s([5]).is_primitive() # needs lrcalc_python False sage: p = SymmetricFunctions(QQ).powersum() sage: p([5]).is_primitive() @@ -87,9 +87,9 @@ def is_grouplike(self): EXAMPLES:: sage: s = SymmetricFunctions(QQ).schur() # needs sage.modules - sage: s([5]).is_grouplike() # needs sage.modules + sage: s([5]).is_grouplike() # needs lrcalc_python sage.modules False - sage: s([]).is_grouplike() # needs sage.modules + sage: s([]).is_grouplike() # needs lrcalc_python sage.modules True """ return self.coproduct() == self.tensor(self) diff --git a/src/sage/categories/bialgebras_with_basis.py b/src/sage/categories/bialgebras_with_basis.py index ced37464419..ed178e59b04 100644 --- a/src/sage/categories/bialgebras_with_basis.py +++ b/src/sage/categories/bialgebras_with_basis.py @@ -109,9 +109,10 @@ def convolution_product(self, *maps): symmetric functions in non-commuting variables. This is the composition of the counit with the unit:: - sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() # needs sage.combinat sage.modules - sage: T = m.convolution_product() # needs sage.combinat sage.modules - sage: [T(m(lam)) # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.graphs sage.modules + sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() + sage: T = m.convolution_product() + sage: [T(m(lam)) ....: for lam in SetPartitions(0).list() + SetPartitions(2).list()] [m{}, 0, 0] @@ -119,8 +120,8 @@ def convolution_product(self, *maps): the identity on the Hopf algebra of symmetric functions in non-commuting variables:: - sage: T = m.convolution_product(Proj2, Id) # needs sage.combinat sage.modules - sage: [T(m(lam)) for lam in SetPartitions(3)] # needs sage.combinat sage.modules + sage: T = m.convolution_product(Proj2, Id) # needs sage.combinat sage.graphs sage.modules + sage: [T(m(lam)) for lam in SetPartitions(3)] # needs sage.combinat sage.graphs sage.modules [0, m{{1, 2}, {3}} + m{{1, 2, 3}}, m{{1, 2}, {3}} + m{{1, 2, 3}}, @@ -130,7 +131,7 @@ def convolution_product(self, *maps): Compute the convolution product of the antipode with itself and the identity map on group algebra of the symmetric group:: - sage: # needs sage.combinat sage.groups + sage: # needs sage.combinat sage.groups sage.modules sage: G = SymmetricGroup(3) sage: QG = GroupAlgebra(G, QQ) sage: x = QG.sum_of_terms( @@ -193,15 +194,15 @@ def convolution_power_of_id(self, n): :: sage: S = NonCommutativeSymmetricFunctions(QQ).S() # needs sage.combinat sage.modules - sage: S[4].convolution_power_of_id(5) # needs sage.combinat sage.modules + sage: S[4].convolution_power_of_id(5) # needs sage.combinat sage.modules 5*S[1, 1, 1, 1] + 10*S[1, 1, 2] + 10*S[1, 2, 1] + 10*S[1, 3] + 10*S[2, 1, 1] + 10*S[2, 2] + 10*S[3, 1] + 5*S[4] :: - sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() # needs sage.combinat sage.modules - sage: m[[1,3],[2]].convolution_power_of_id(-2) # needs sage.combinat sage.modules + sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() # needs sage.combinat sage.graphs sage.modules + sage: m[[1,3],[2]].convolution_power_of_id(-2) # needs sage.combinat sage.graphs sage.modules 3*m{{1}, {2, 3}} + 3*m{{1, 2}, {3}} + 6*m{{1, 2, 3}} - 2*m{{1, 3}, {2}} """ if n < 0: @@ -264,20 +265,21 @@ def convolution_product(self, *maps): We compute convolution products of the identity and antipode maps on Schur functions:: + sage: # needs sage.combinat sage.modules sage: Id = lambda x: x sage: Antipode = lambda x: x.antipode() - sage: s = SymmetricFunctions(QQ).schur() # needs sage.combinat sage.modules - sage: s[3].convolution_product(Id, Id) # needs sage.combinat sage.modules + sage: s = SymmetricFunctions(QQ).schur() + sage: s[3].convolution_product(Id, Id) # needs lrcalc_python 2*s[2, 1] + 4*s[3] - sage: s[3,2].convolution_product(Id) == s[3,2] # needs sage.combinat sage.modules + sage: s[3,2].convolution_product(Id) == s[3,2] True The method accepts multiple arguments, or a single argument consisting of a list of maps:: - sage: s[3,2].convolution_product(Id, Id) # needs sage.combinat sage.modules + sage: s[3,2].convolution_product(Id, Id) # needs lrcalc_python sage.combinat sage.modules 2*s[2, 1, 1, 1] + 6*s[2, 2, 1] + 6*s[3, 1, 1] + 12*s[3, 2] + 6*s[4, 1] + 2*s[5] - sage: s[3,2].convolution_product([Id, Id]) # needs sage.combinat sage.modules + sage: s[3,2].convolution_product([Id, Id]) # needs lrcalc_python sage.combinat sage.modules 2*s[2, 1, 1, 1] + 6*s[2, 2, 1] + 6*s[3, 1, 1] + 12*s[3, 2] + 6*s[4, 1] + 2*s[5] We test the defining property of the antipode morphism; namely, @@ -285,7 +287,7 @@ def convolution_product(self, *maps): convolution algebra whose identity element is the composition of the counit and unit:: - sage: (s[3,2].convolution_product() # needs sage.combinat sage.modules + sage: (s[3,2].convolution_product() # needs lrcalc_python sage.combinat sage.modules ....: == s[3,2].convolution_product(Antipode, Id) ....: == s[3,2].convolution_product(Id, Antipode)) True @@ -300,7 +302,7 @@ def convolution_product(self, *maps): :: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: G = SymmetricGroup(3) sage: QG = GroupAlgebra(G, QQ) sage: x = QG.sum_of_terms([(p, p.length()) @@ -341,7 +343,7 @@ def convolution_product(self, *maps): :: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.graphs sage.modules sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() sage: m[[1,3],[2]].convolution_product([Antipode, Antipode]) 3*m{{1}, {2, 3}} + 3*m{{1, 2}, {3}} + 6*m{{1, 2, 3}} - 2*m{{1, 3}, {2}} @@ -352,7 +354,7 @@ def convolution_product(self, *maps): :: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: QS = SymmetricGroupAlgebra(QQ, 5) sage: x = QS.sum_of_terms(zip(Permutations(5)[3:6], [1,2,3])); x [1, 2, 4, 5, 3] + 2*[1, 2, 5, 3, 4] + 3*[1, 2, 5, 4, 3] @@ -363,7 +365,7 @@ def convolution_product(self, *maps): :: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: G = SymmetricGroup(3) sage: QG = GroupAlgebra(G, QQ) sage: x = QG.sum_of_terms([(p, p.length()) diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index ce316e50138..5d43dd50610 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -2642,7 +2642,7 @@ def category_graph(categories=None): sage: G.plot() # needs sage.graphs sage.plot Graphics object consisting of 20 graphics primitives - sage: sage.categories.category.category_graph().plot() # needs sage.graphs sage.plot + sage: sage.categories.category.category_graph().plot() # needs sage.graphs sage.groups sage.plot Graphics object consisting of ... graphics primitives """ from sage import graphs diff --git a/src/sage/categories/coalgebras.py b/src/sage/categories/coalgebras.py index 07b18882d49..3339dcb001d 100644 --- a/src/sage/categories/coalgebras.py +++ b/src/sage/categories/coalgebras.py @@ -67,10 +67,11 @@ def counit(self, x): EXAMPLES:: - sage: # needs sage.modules + sage: # needs sage.groups sage.modules sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: - the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field + the group algebra of the Dihedral group of order 6 as a permutation group + over Rational Field sage: [a,b] = A.algebra_generators() sage: a, A.counit(a) (B[(1,2,3)], 1) @@ -92,10 +93,11 @@ def coproduct(self, x): EXAMPLES:: - sage: # needs sage.modules + sage: # needs sage.groups sage.modules sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: - the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field + the group algebra of the Dihedral group of order 6 as a permutation group + over Rational Field sage: [a,b] = A.algebra_generators() sage: a, A.coproduct(a) (B[(1,2,3)], B[(1,2,3)] # B[(1,2,3)]) @@ -111,10 +113,11 @@ def coproduct(self): EXAMPLES:: - sage: # needs sage.modules + sage: # needs sage.groups sage.modules sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: - the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field + the group algebra of the Dihedral group of order 6 as a permutation group + over Rational Field sage: [a,b] = A.algebra_generators() sage: a, a.coproduct() (B[(1,2,3)], B[(1,2,3)] # B[(1,2,3)]) @@ -129,10 +132,11 @@ def counit(self): EXAMPLES:: - sage: # needs sage.modules + sage: # needs sage.groups sage.modules sage: A = HopfAlgebrasWithBasis(QQ).example(); A An example of Hopf algebra with basis: - the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field + the group algebra of the Dihedral group of order 6 as a permutation group + over Rational Field sage: [a,b] = A.algebra_generators() sage: a, a.counit() (B[(1,2,3)], 1) @@ -357,7 +361,7 @@ def coproduct_by_coercion(self, x): NotImplemented sage: m.coproduct == m.coproduct_by_coercion True - sage: f.coproduct() + sage: f.coproduct() # needs lrcalc_python m[] # m[2, 1] + m[1] # m[2] + m[2] # m[1] + m[2, 1] # m[] :: @@ -384,16 +388,16 @@ def counit_by_coercion(self, x): EXAMPLES:: - sage: sp = SymmetricFunctions(QQ).sp() # needs sage.modules - sage: sp.an_element() # needs sage.modules + sage: # needs lrcalc_python sage.modules + sage: sp = SymmetricFunctions(QQ).sp() + sage: sp.an_element() 2*sp[] + 2*sp[1] + 3*sp[2] - sage: sp.counit(sp.an_element()) # needs sage.modules + sage: sp.counit(sp.an_element()) 2 - - sage: o = SymmetricFunctions(QQ).o() # needs sage.modules - sage: o.an_element() # needs sage.modules + sage: o = SymmetricFunctions(QQ).o() + sage: o.an_element() 2*o[] + 2*o[1] + 3*o[2] - sage: o.counit(o.an_element()) # needs sage.modules + sage: o.counit(o.an_element()) -1 """ R = self.realization_of().a_realization() diff --git a/src/sage/categories/coalgebras_with_basis.py b/src/sage/categories/coalgebras_with_basis.py index 1a3ecfe8302..41cf784efb1 100644 --- a/src/sage/categories/coalgebras_with_basis.py +++ b/src/sage/categories/coalgebras_with_basis.py @@ -193,14 +193,15 @@ def coproduct_iterated(self, n=1): :: - sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() # needs sage.combinat sage.modules - sage: m[[1,3],[2]].coproduct_iterated(2) # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.graphs sage.modules + sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() + sage: m[[1,3],[2]].coproduct_iterated(2) m{} # m{} # m{{1, 3}, {2}} + m{} # m{{1}} # m{{1, 2}} + m{} # m{{1, 2}} # m{{1}} + m{} # m{{1, 3}, {2}} # m{} + m{{1}} # m{} # m{{1, 2}} + m{{1}} # m{{1, 2}} # m{} + m{{1, 2}} # m{} # m{{1}} + m{{1, 2}} # m{{1}} # m{} + m{{1, 3}, {2}} # m{} # m{} - sage: m[[]].coproduct_iterated(3), m[[1,3],[2]].coproduct_iterated(0) # needs sage.combinat sage.modules + sage: m[[]].coproduct_iterated(3), m[[1,3],[2]].coproduct_iterated(0) (m{} # m{} # m{} # m{}, m{{1, 3}, {2}}) """ if n < 0: diff --git a/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py b/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py index ca2f1e09235..0371f643026 100644 --- a/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py +++ b/src/sage/categories/complex_reflection_or_generalized_coxeter_groups.py @@ -159,14 +159,16 @@ def index_set(self): sage: W.index_set() (1, 2) - sage: W = ColoredPermutations(1, 4) - sage: W.index_set() + sage: W = ColoredPermutations(1, 4) # needs sage.combinat + sage: W.index_set() # needs sage.combinat (1, 2, 3) - sage: W = ReflectionGroup((1,1,4), index_set=[1,3,'asdf']) # optional - gap3 - sage: W.index_set() # optional - gap3 + + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,4), index_set=[1,3,'asdf']) + sage: W.index_set() (1, 3, 'asdf') - sage: W = ReflectionGroup((1,1,4), index_set=('a','b','c')) # optional - gap3 - sage: W.index_set() # optional - gap3 + sage: W = ReflectionGroup((1,1,4), index_set=('a','b','c')) + sage: W.index_set() ('a', 'b', 'c') """ # return self.simple_reflections().keys() @@ -186,8 +188,7 @@ def simple_reflection(self, i): EXAMPLES:: - sage: W = CoxeterGroups().example() - sage: W + sage: W = CoxeterGroups().example(); W The symmetric group on {0, ..., 3} sage: W.simple_reflection(1) (0, 2, 1, 3) @@ -195,8 +196,8 @@ def simple_reflection(self, i): sage: s[1] (0, 2, 1, 3) - sage: W = ReflectionGroup((1,1,4), index_set=[1,3,'asdf']) # optional - gap3 - sage: for i in W.index_set(): # optional - gap3 + sage: W = ReflectionGroup((1,1,4), index_set=[1,3,'asdf']) # optional - gap3 + sage: for i in W.index_set(): # optional - gap3 ....: print('%s %s'%(i, W.simple_reflection(i))) 1 (1,7)(2,4)(5,6)(8,10)(11,12) 3 (1,4)(2,8)(3,5)(7,10)(9,11) @@ -223,8 +224,7 @@ def simple_reflections(self): sage: W = SymmetricGroup(4); W Symmetric group of order 4! as a permutation group - sage: s = W.simple_reflections() - sage: s + sage: s = W.simple_reflections(); s Finite family {1: (1,2), 2: (2,3), 3: (3,4)} sage: s[1] (1,2) @@ -236,12 +236,12 @@ def simple_reflections(self): Here are the simple reflections for a colored symmetric group and a reflection group:: - sage: W = ColoredPermutations(1,3) - sage: W.simple_reflections() + sage: W = ColoredPermutations(1,3) # needs sage.combinat + sage: W.simple_reflections() # needs sage.combinat Finite family {1: [[0, 0, 0], [2, 1, 3]], 2: [[0, 0, 0], [1, 3, 2]]} - sage: W = ReflectionGroup((1,1,3), index_set=['a','b']) # optional - gap3 - sage: W.simple_reflections() # optional - gap3 + sage: W = ReflectionGroup((1,1,3), index_set=['a','b']) # optional - gap3 + sage: W.simple_reflections() # optional - gap3 Finite family {'a': (1,4)(2,3)(5,6), 'b': (1,3)(2,5)(4,6)} This default implementation uses :meth:`.index_set` and @@ -256,6 +256,7 @@ def number_of_simple_reflections(self): EXAMPLES:: + sage: # needs sage.combinat sage: W = ColoredPermutations(1,3) sage: W.number_of_simple_reflections() 2 @@ -265,8 +266,9 @@ def number_of_simple_reflections(self): sage: W = ColoredPermutations(4,3) sage: W.number_of_simple_reflections() 3 - sage: W = ReflectionGroup((4,2,3)) # optional - gap3 - sage: W.number_of_simple_reflections() # optional - gap3 + + sage: W = ReflectionGroup((4,2,3)) # optional - gap3 + sage: W.number_of_simple_reflections() # optional - gap3 4 """ return len(self.index_set()) @@ -294,8 +296,8 @@ def group_generators(self): sage: SymmetricGroup(5).group_generators() Finite family {1: (1,2), 2: (2,3), 3: (3,4), 4: (4,5)} - sage: W = ColoredPermutations(3,2) - sage: W.group_generators() + sage: W = ColoredPermutations(3,2) # needs sage.combinat + sage: W.group_generators() # needs sage.combinat Finite family {1: [[0, 0], [2, 1]], 2: [[0, 1], @@ -304,8 +306,8 @@ def group_generators(self): The simple reflections are also semigroup generators, even for an infinite group:: - sage: W = WeylGroup(["A",2,1]) - sage: W.semigroup_generators() + sage: W = WeylGroup(["A",2,1]) # needs sage.rings.number_field + sage: W.semigroup_generators() # needs sage.rings.number_field Finite family {0: [-1 1 1] [ 0 1 0] [ 0 0 1], @@ -326,16 +328,19 @@ def simple_reflection_orders(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: W = WeylGroup(['B',3]) sage: W.simple_reflection_orders() [2, 2, 2] sage: W = CoxeterGroup(['C',4]) sage: W.simple_reflection_orders() [2, 2, 2, 2] + sage: SymmetricGroup(5).simple_reflection_orders() [2, 2, 2, 2] - sage: C = ColoredPermutations(4, 3) - sage: C.simple_reflection_orders() + + sage: C = ColoredPermutations(4, 3) # needs sage.combinat + sage: C.simple_reflection_orders() # needs sage.combinat [2, 2, 4] """ one = self.one() @@ -366,6 +371,7 @@ def _an_element_(self): For a complex reflection group:: + sage: # needs sage.combinat sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups sage: W = ComplexReflectionGroups().example(); W 5-colored permutations of size 3 @@ -384,8 +390,8 @@ def some_elements(self): EXAMPLES:: - sage: W = WeylGroup(['A',3]) - sage: W.some_elements() + sage: W = WeylGroup(['A',3]) # needs sage.rings.number_field + sage: W.some_elements() # needs sage.rings.number_field [ [0 1 0 0] [1 0 0 0] [1 0 0 0] [1 0 0 0] [0 0 0 1] [1 0 0 0] [0 0 1 0] [0 1 0 0] [0 1 0 0] [1 0 0 0] @@ -393,8 +399,8 @@ def some_elements(self): [0 0 0 1], [0 0 0 1], [0 0 1 0], [0 0 0 1], [0 0 1 0] ] - sage: W = ColoredPermutations(1,4) - sage: W.some_elements() + sage: W = ColoredPermutations(1,4) # needs sage.combinat + sage: W.some_elements() # needs sage.combinat [[[0, 0, 0, 0], [2, 1, 3, 4]], [[0, 0, 0, 0], [1, 3, 2, 4]], [[0, 0, 0, 0], [1, 2, 4, 3]], @@ -470,32 +476,31 @@ def reflections(self): EXAMPLES:: - sage: W = ReflectionGroup((1,1,3)) # optional - gap3 - sage: reflections = W.reflections() # optional - gap3 - sage: for index in sorted(reflections.keys()): # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,3)) + sage: reflections = W.reflections() + sage: for index in sorted(reflections.keys()): ....: print('%s %s'%(index, reflections[index])) 1 (1,4)(2,3)(5,6) 2 (1,3)(2,5)(4,6) 3 (1,5)(2,4)(3,6) - - sage: W = ReflectionGroup((1,1,3),reflection_index_set=['a','b','c']) # optional - gap3 - sage: reflections = W.reflections() # optional - gap3 - sage: for index in sorted(reflections.keys()): # optional - gap3 + sage: W = ReflectionGroup((1,1,3), + ....: reflection_index_set=['a','b','c']) + sage: reflections = W.reflections() + sage: for index in sorted(reflections.keys()): ....: print('%s %s'%(index, reflections[index])) a (1,4)(2,3)(5,6) b (1,3)(2,5)(4,6) c (1,5)(2,4)(3,6) - - sage: W = ReflectionGroup((3,1,1)) # optional - gap3 - sage: reflections = W.reflections() # optional - gap3 - sage: for index in sorted(reflections.keys()): # optional - gap3 + sage: W = ReflectionGroup((3,1,1)) + sage: reflections = W.reflections() + sage: for index in sorted(reflections.keys()): ....: print('%s %s'%(index, reflections[index])) 1 (1,2,3) 2 (1,3,2) - - sage: W = ReflectionGroup((1,1,3), (3,1,2)) # optional - gap3 - sage: reflections = W.reflections() # optional - gap3 - sage: for index in sorted(reflections.keys()): # optional - gap3 + sage: W = ReflectionGroup((1,1,3), (3,1,2)) + sage: reflections = W.reflections() + sage: for index in sorted(reflections.keys()): ....: print('%s %s'%(index, reflections[index])) 1 (1,6)(2,5)(7,8) 2 (1,5)(2,7)(6,8) @@ -541,7 +546,8 @@ def hyperplane_index_set(self): sage: W = ReflectionGroup((1,1,4), hyperplane_index_set=[1,3,'asdf',7,9,11]) sage: W.hyperplane_index_set() (1, 3, 'asdf', 7, 9, 11) - sage: W = ReflectionGroup((1,1,4), hyperplane_index_set=('a','b','c','d','e','f')) + sage: W = ReflectionGroup((1,1,4), + ....: hyperplane_index_set=('a','b','c','d','e','f')) sage: W.hyperplane_index_set() ('a', 'b', 'c', 'd', 'e', 'f') """ @@ -562,8 +568,10 @@ def distinguished_reflection(self, i): EXAMPLES:: - sage: W = ReflectionGroup((1,1,4), hyperplane_index_set=('a','b','c','d','e','f')) # optional - gap3 - sage: for i in W.hyperplane_index_set(): # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,4), + ....: hyperplane_index_set=('a','b','c','d','e','f')) + sage: for i in W.hyperplane_index_set(): ....: print('%s %s'%(i, W.distinguished_reflection(i))) a (1,7)(2,4)(5,6)(8,10)(11,12) b (1,4)(2,8)(3,5)(7,10)(9,11) @@ -595,31 +603,29 @@ def distinguished_reflections(self): EXAMPLES:: - sage: W = ReflectionGroup((1,1,3)) # optional - gap3 - sage: distinguished_reflections = W.distinguished_reflections() # optional - gap3 - sage: for index in sorted(distinguished_reflections.keys()): # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,3)) + sage: distinguished_reflections = W.distinguished_reflections() + sage: for index in sorted(distinguished_reflections.keys()): ....: print('%s %s'%(index, distinguished_reflections[index])) 1 (1,4)(2,3)(5,6) 2 (1,3)(2,5)(4,6) 3 (1,5)(2,4)(3,6) - - sage: W = ReflectionGroup((1,1,3),hyperplane_index_set=['a','b','c']) # optional - gap3 - sage: distinguished_reflections = W.distinguished_reflections() # optional - gap3 - sage: for index in sorted(distinguished_reflections.keys()): # optional - gap3 + sage: W = ReflectionGroup((1,1,3), hyperplane_index_set=['a','b','c']) + sage: distinguished_reflections = W.distinguished_reflections() + sage: for index in sorted(distinguished_reflections.keys()): ....: print('%s %s'%(index, distinguished_reflections[index])) a (1,4)(2,3)(5,6) b (1,3)(2,5)(4,6) c (1,5)(2,4)(3,6) - - sage: W = ReflectionGroup((3,1,1)) # optional - gap3 - sage: distinguished_reflections = W.distinguished_reflections() # optional - gap3 - sage: for index in sorted(distinguished_reflections.keys()): # optional - gap3 + sage: W = ReflectionGroup((3,1,1)) + sage: distinguished_reflections = W.distinguished_reflections() + sage: for index in sorted(distinguished_reflections.keys()): ....: print('%s %s'%(index, distinguished_reflections[index])) 1 (1,2,3) - - sage: W = ReflectionGroup((1,1,3), (3,1,2)) # optional - gap3 - sage: distinguished_reflections = W.distinguished_reflections() # optional - gap3 - sage: for index in sorted(distinguished_reflections.keys()): # optional - gap3 + sage: W = ReflectionGroup((1,1,3), (3,1,2)) + sage: distinguished_reflections = W.distinguished_reflections() + sage: for index in sorted(distinguished_reflections.keys()): ....: print('%s %s'%(index, distinguished_reflections[index])) 1 (1,6)(2,5)(7,8) 2 (1,5)(2,7)(6,8) @@ -674,8 +680,7 @@ def from_reduced_word(self, word, word_type='simple'): EXAMPLES:: - sage: W = CoxeterGroups().example() - sage: W + sage: W = CoxeterGroups().example(); W The symmetric group on {0, ..., 3} sage: s = W.simple_reflections() sage: W.from_reduced_word([0,2,0,1]) @@ -688,42 +693,41 @@ def from_reduced_word(self, word, word_type='simple'): We now experiment with the different values for ``word_type`` for the colored symmetric group:: + sage: # needs sage.combinat sage: W = ColoredPermutations(1,4) sage: W.from_reduced_word([1,2,1,2,1,2]) [[0, 0, 0, 0], [1, 2, 3, 4]] - sage: W.from_reduced_word([1, 2, 3]).reduced_word() [1, 2, 3] + sage: # needs sage.rings.number_field sage: W = WeylGroup("A3", prefix='s') sage: AS = W.domain() - sage: r1 = AS.roots()[4] - sage: r1 + sage: r1 = AS.roots()[4]; r1 (0, 1, 0, -1) - sage: r2 = AS.roots()[5] - sage: r2 + sage: r2 = AS.roots()[5]; r2 (0, 0, 1, -1) sage: W.from_reduced_word([r1, r2], word_type='all') s3*s2 - sage: W = WeylGroup("G2", prefix='s') - sage: W.from_reduced_word(W.domain().positive_roots(), word_type='all') + sage: W = WeylGroup("G2", prefix='s') # needs sage.rings.number_field + sage: W.from_reduced_word(W.domain().positive_roots(), # needs sage.rings.number_field + ....: word_type='all') s1*s2 - sage: W = ReflectionGroup((1,1,4)) # optional - gap3 - sage: W.from_reduced_word([1,2,3], word_type='all').reduced_word() # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,4)) + sage: W.from_reduced_word([1,2,3], word_type='all').reduced_word() [1, 2, 3] - - sage: W.from_reduced_word([1,2,3], word_type='all').reduced_word_in_reflections() # optional - gap3 + sage: W.from_reduced_word([1,2,3], word_type='all').reduced_word_in_reflections() [1, 2, 3] - - sage: W.from_reduced_word([1,2,3]).reduced_word_in_reflections() # optional - gap3 + sage: W.from_reduced_word([1,2,3]).reduced_word_in_reflections() [1, 2, 3] TESTS:: - sage: W = WeylGroup(['E',6]) - sage: W.from_reduced_word([2,3,4,2]) + sage: W = WeylGroup(['E',6]) # needs sage.rings.number_field + sage: W.from_reduced_word([2,3,4,2]) # needs sage.rings.number_field [ 0 1 0 0 0 0 0 0] [ 0 0 -1 0 0 0 0 0] [-1 0 0 0 0 0 0 0] @@ -749,6 +753,7 @@ def irreducible_component_index_sets(self): EXAMPLES:: + sage: # needs sage.graphs sage: W = ReflectionGroup([1,1,3], [3,1,3], 4); W # optional - gap3 Reducible complex reflection group of rank 7 and type A2 x G(3,1,3) x ST4 sage: sorted(W.irreducible_component_index_sets()) # optional - gap3 @@ -778,6 +783,7 @@ def irreducible_components(self): EXAMPLES:: + sage: # needs sage.graphs sage: W = ReflectionGroup([1,1,3], [3,1,3], 4) # optional - gap3 sage: W.irreducible_components() # optional - gap3 [Irreducible real reflection group of rank 2 and type A2, @@ -792,12 +798,11 @@ def number_of_irreducible_components(self): EXAMPLES:: + sage: # needs sage.graphs sage: SymmetricGroup(3).number_of_irreducible_components() 1 - - sage: ColoredPermutations(1,3).number_of_irreducible_components() + sage: ColoredPermutations(1,3).number_of_irreducible_components() # needs sage.combinat 1 - sage: ReflectionGroup((1,1,3),(2,1,3)).number_of_irreducible_components() # optional - gap3 2 @@ -814,11 +819,11 @@ def is_irreducible(self): EXAMPLES:: - sage: W = ColoredPermutations(1,3); W + sage: # needs sage.graphs + sage: W = ColoredPermutations(1,3); W # needs sage.combinat 1-colored permutations of size 3 - sage: W.is_irreducible() + sage: W.is_irreducible() # needs sage.combinat True - sage: W = ReflectionGroup((1,1,3),(2,1,3)); W # optional - gap3 Reducible real reflection group of rank 5 and type A2 x B3 sage: W.is_irreducible() # optional - gap3 @@ -832,11 +837,11 @@ def is_reducible(self): EXAMPLES:: - sage: W = ColoredPermutations(1,3); W + sage: # needs sage.graphs + sage: W = ColoredPermutations(1,3); W # needs sage.combinat 1-colored permutations of size 3 - sage: W.is_reducible() + sage: W.is_reducible() # needs sage.combinat False - sage: W = ReflectionGroup((1,1,3), (2,1,3)); W # optional - gap3 Reducible real reflection group of rank 5 and type A2 x B3 sage: W.is_reducible() # optional - gap3 @@ -868,6 +873,7 @@ def apply_simple_reflection_left(self, i): EXAMPLES:: + sage: # needs sage.combinat sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups sage: W = ComplexReflectionGroups().example() sage: w = W.an_element(); w @@ -881,7 +887,7 @@ def apply_simple_reflection_left(self, i): TESTS:: - sage: w.apply_simple_reflection_left.__module__ + sage: w.apply_simple_reflection_left.__module__ # needs sage.combinat 'sage.categories.complex_reflection_or_generalized_coxeter_groups' """ s = self.parent().simple_reflections() @@ -908,6 +914,7 @@ def apply_simple_reflection_right(self, i): sage: w.apply_simple_reflection_right(2) (1, 2, 0, 3) + sage: # needs sage.combinat sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups sage: W = ComplexReflectionGroups().example() sage: w = W.an_element(); w @@ -945,18 +952,17 @@ def apply_simple_reflection(self, i, side='right'): sage: W = CoxeterGroups().example() sage: w = W.an_element(); w (1, 2, 3, 0) - sage: w.apply_simple_reflection(0, side = "left") + sage: w.apply_simple_reflection(0, side="left") (0, 2, 3, 1) - sage: w.apply_simple_reflection(1, side = "left") + sage: w.apply_simple_reflection(1, side="left") (2, 1, 3, 0) - sage: w.apply_simple_reflection(2, side = "left") + sage: w.apply_simple_reflection(2, side="left") (1, 3, 2, 0) - - sage: w.apply_simple_reflection(0, side = "right") + sage: w.apply_simple_reflection(0, side="right") (2, 1, 3, 0) - sage: w.apply_simple_reflection(1, side = "right") + sage: w.apply_simple_reflection(1, side="right") (1, 3, 2, 0) - sage: w.apply_simple_reflection(2, side = "right") + sage: w.apply_simple_reflection(2, side="right") (1, 2, 0, 3) By default, ``side`` is ``"right"``:: @@ -966,6 +972,7 @@ def apply_simple_reflection(self, i, side='right'): Some tests with a complex reflection group:: + sage: # needs sage.combinat sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups sage: W = ComplexReflectionGroups().example(); W 5-colored permutations of size 3 @@ -977,7 +984,6 @@ def apply_simple_reflection(self, i, side='right'): [[1, 0, 0], [3, 2, 1]] sage: w.apply_simple_reflection(3, side="left") [[1, 0, 1], [3, 1, 2]] - sage: w.apply_simple_reflection(1, side="right") [[1, 0, 0], [3, 2, 1]] sage: w.apply_simple_reflection(2, side="right") @@ -987,7 +993,7 @@ def apply_simple_reflection(self, i, side='right'): TESTS:: - sage: w.apply_simple_reflection_right.__module__ + sage: w.apply_simple_reflection_right.__module__ # needs sage.combinat 'sage.categories.complex_reflection_or_generalized_coxeter_groups' """ if side == 'right': @@ -1067,24 +1073,21 @@ def apply_reflections(self, word, side='right', word_type='all'): sage: w.apply_reflections([0,1], side='left', word_type='simple') (0, 1, 3, 2) - + sage: # needs sage.rings.number_field sage: W = WeylGroup("A3", prefix='s') sage: w = W.an_element(); w s1*s2*s3 sage: AS = W.domain() - sage: r1 = AS.roots()[4] - sage: r1 + sage: r1 = AS.roots()[4]; r1 (0, 1, 0, -1) - sage: r2 = AS.roots()[5] - sage: r2 + sage: r2 = AS.roots()[5]; r2 (0, 0, 1, -1) sage: w.apply_reflections([r1, r2], word_type='all') s1 - sage: # optional - gap3 sage: W = ReflectionGroup((1,1,3)) - sage: W.one().apply_reflections([1], word_type='distinguished') + sage: W.one().apply_reflections([1], word_type='distinguished') (1,4)(2,3)(5,6) sage: W.one().apply_reflections([2], word_type='distinguished') (1,3)(2,5)(4,6) @@ -1093,9 +1096,10 @@ def apply_reflections(self, word, side='right', word_type='all'): sage: W.one().apply_reflections([2,1], word_type='distinguished') (1,2,6)(3,4,5) - sage: W = ReflectionGroup((1,1,3), hyperplane_index_set=['A','B','C']); W # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,3), hyperplane_index_set=['A','B','C']); W Irreducible real reflection group of rank 2 and type A2 - sage: W.one().apply_reflections(['A'], word_type='distinguished') # optional - gap3 + sage: W.one().apply_reflections(['A'], word_type='distinguished') (1,4)(2,3)(5,6) """ if word_type == 'simple': @@ -1151,6 +1155,7 @@ def __invert__(self): EXAMPLES:: + sage: # needs sage.rings.number_field sage: W = WeylGroup(['B',7]) sage: w = W.an_element() sage: u = w.inverse() # indirect doctest @@ -1175,9 +1180,9 @@ def apply_conjugation_by_simple_reflection(self, i): EXAMPLES:: - sage: W = WeylGroup(['A',3]) - sage: w = W.from_reduced_word([3,1,2,1]) - sage: w.apply_conjugation_by_simple_reflection(1).reduced_word() + sage: W = WeylGroup(['A',3]) # needs sage.rings.number_field + sage: w = W.from_reduced_word([3,1,2,1]) # needs sage.rings.number_field + sage: w.apply_conjugation_by_simple_reflection(1).reduced_word() # needs sage.rings.number_field [3, 2] """ return self.apply_simple_reflection(i).apply_simple_reflection(i, side='left') @@ -1192,20 +1197,18 @@ def reflection_length(self): EXAMPLES:: - sage: W = ReflectionGroup((1,1,2)) # optional - gap3 - sage: sorted([t.reflection_length() for t in W]) # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,2)) + sage: sorted([t.reflection_length() for t in W]) [0, 1] - - sage: W = ReflectionGroup((2,1,2)) # optional - gap3 - sage: sorted([t.reflection_length() for t in W]) # optional - gap3 + sage: W = ReflectionGroup((2,1,2)) + sage: sorted([t.reflection_length() for t in W]) [0, 1, 1, 1, 1, 2, 2, 2] - - sage: W = ReflectionGroup((3,1,2)) # optional - gap3 - sage: sorted([t.reflection_length() for t in W]) # optional - gap3 + sage: W = ReflectionGroup((3,1,2)) + sage: sorted([t.reflection_length() for t in W]) [0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] - - sage: W = ReflectionGroup((2,2,2)) # optional - gap3 - sage: sorted([t.reflection_length() for t in W]) # optional - gap3 + sage: W = ReflectionGroup((2,2,2)) + sage: sorted([t.reflection_length() for t in W]) [0, 1, 1, 2] """ @@ -1215,16 +1218,16 @@ def is_reflection(self): EXAMPLES:: - sage: W = ReflectionGroup((1,1,4)) # optional - gap3 - sage: [t.is_reflection() for t in W.reflections()] # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,4)) + sage: [t.is_reflection() for t in W.reflections()] [True, True, True, True, True, True] - sage: len([t for t in W.reflections() if t.is_reflection()]) # optional - gap3 + sage: len([t for t in W.reflections() if t.is_reflection()]) 6 - - sage: W = ReflectionGroup((2,1,3)) # optional - gap3 - sage: [t.is_reflection() for t in W.reflections()] # optional - gap3 + sage: W = ReflectionGroup((2,1,3)) + sage: [t.is_reflection() for t in W.reflections()] [True, True, True, True, True, True, True, True, True] - sage: len([t for t in W.reflections() if t.is_reflection()]) # optional - gap3 + sage: len([t for t in W.reflections() if t.is_reflection()]) 9 """ return self.reflection_length() == 1 @@ -1238,8 +1241,8 @@ def irreducible_components(self): EXAMPLES:: - sage: W = ColoredPermutations(4, 3) - sage: W.irreducible_components() + sage: W = ColoredPermutations(4, 3) # needs sage.combinat + sage: W.irreducible_components() # needs sage.combinat [4-colored permutations of size 3] """ return [self] diff --git a/src/sage/categories/coxeter_groups.py b/src/sage/categories/coxeter_groups.py index 7bbb286778d..a5f2a701b4d 100644 --- a/src/sage/categories/coxeter_groups.py +++ b/src/sage/categories/coxeter_groups.py @@ -2911,7 +2911,7 @@ def is_coxeter_sortable(self, c, sorting_word=None): Number of `c`-sortable elements in `A_3` (Catalan number):: - sage: len([w for w in W if w.is_coxeter_sortable(c)]) + sage: len([w for w in W if w.is_coxeter_sortable(c)]) # needs sage.rings.number_field 14 TESTS:: diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index 5bf8f46d201..298c323e8aa 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -1985,7 +1985,7 @@ def __call__(self, x, *args, **kwds): sage: H = Hom(T, B) sage: b = B.module_generators[0] sage: psi = H((None, b, b, None), generators=T.highest_weight_vectors()) - sage: psi(None) + sage: psi(None) # needs sage.symbolic sage: [psi(v) for v in T.highest_weight_vectors()] [None, [[1, 1], [2]], [[1, 1], [2]], None] """ diff --git a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py index 452cf12aa1e..e43a73638c0 100644 --- a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py @@ -449,7 +449,7 @@ def lift(self): sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() sage: a, b, c = L.lie_algebra_generators() sage: elt = 2*a + 2*b + 3*c - sage: elt.lift() # needs sage.combinat + sage: elt.lift() # needs sage.combinat sage.libs.singular 2*b0 + 2*b1 + 3*b2 """ UEA = self.parent().universal_enveloping_algebra() diff --git a/src/sage/categories/finite_complex_reflection_groups.py b/src/sage/categories/finite_complex_reflection_groups.py index 2fdc9912f89..3346d75339d 100644 --- a/src/sage/categories/finite_complex_reflection_groups.py +++ b/src/sage/categories/finite_complex_reflection_groups.py @@ -200,7 +200,7 @@ def _test_degrees(self, **options): sage: W._test_degrees() # optional - gap3 sage: W = SymmetricGroup(5) # needs sage.groups - sage: W._test_degrees() # needs sage.groups + sage: W._test_degrees() # needs sage.groups sage.rings.number_field We now break the implementation of W.degrees and check that this is caught:: @@ -219,7 +219,7 @@ def _test_degrees(self, **options): We restore W to its normal state:: sage: del W.degrees # needs sage.groups - sage: W._test_degrees() # needs sage.groups + sage: W._test_degrees() # needs sage.groups sage.rings.number_field See the documentation for :class:`TestSuite` for more information. """ @@ -255,7 +255,7 @@ def _test_codegrees(self, **options): sage: W._test_codegrees() # optional - gap3 sage: W = SymmetricGroup(5) # needs sage.groups - sage: W._test_codegrees() # needs sage.groups + sage: W._test_codegrees() # needs sage.groups sage.rings.number_field We now break the implementation of W.degrees and check that this is caught:: @@ -274,7 +274,7 @@ def _test_codegrees(self, **options): We restore W to its normal state:: sage: del W.codegrees # needs sage.groups - sage: W._test_codegrees() # needs sage.groups + sage: W._test_codegrees() # needs sage.groups sage.rings.number_field See the documentation for :class:`TestSuite` for more information. """ @@ -321,8 +321,10 @@ def number_of_reflection_hyperplanes(self): sage: W = ColoredPermutations(4,3) sage: W.number_of_reflection_hyperplanes() 15 - sage: W = ReflectionGroup((4,2,3)) # optional - gap3 - sage: W.number_of_reflection_hyperplanes() # optional - gap3 + + sage: # optional - gap3, needs sage.combinat + sage: W = ReflectionGroup((4,2,3)) + sage: W.number_of_reflection_hyperplanes() 15 """ from sage.rings.integer_ring import ZZ @@ -343,7 +345,7 @@ def number_of_reflections(self): EXAMPLES:: - sage: [SymmetricGroup(i).number_of_reflections() # needs sage.groups + sage: [SymmetricGroup(i).number_of_reflections() # needs sage.groups sage.rings.number_field ....: for i in range(int(8))] [0, 0, 1, 3, 6, 10, 15, 21] @@ -487,7 +489,7 @@ def is_real(self): True sage: W = ColoredPermutations(4,3) # needs sage.combinat - sage: W.is_real() # needs sage.combinat sage.groups + sage: W.is_real() # needs sage.combinat sage.graphs False .. TODO:: @@ -547,6 +549,7 @@ def milnor_fiber_poset(self): EXAMPLES:: + sage: # needs sage.combinat sage: W = ColoredPermutations(3, 2) sage: P = W.milnor_fiber_poset() sage: P @@ -845,17 +848,15 @@ def absolute_order_ideal(self, gens=None, EXAMPLES:: - sage: W = ReflectionGroup((1,1,3)) # optional - gap3 - - sage: sorted(w.reduced_word() # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,3)) + sage: sorted(w.reduced_word() ....: for w in W.absolute_order_ideal()) [[], [1], [1, 2], [1, 2, 1], [2]] - - sage: sorted(w.reduced_word() # optional - gap3 + sage: sorted(w.reduced_word() ....: for w in W.absolute_order_ideal(W.from_reduced_word([2,1]))) [[], [1], [1, 2, 1], [2], [2, 1]] - - sage: sorted(w.reduced_word() # optional - gap3 + sage: sorted(w.reduced_word() ....: for w in W.absolute_order_ideal(W.from_reduced_word([2]))) [[], [2]] @@ -931,7 +932,7 @@ def noncrossing_partition_lattice(self, c=None, L=None, EXAMPLES:: - sage: W = SymmetricGroup(4) # needs sage.combinat sage.groups + sage: W = SymmetricGroup(4) # needs sage.groups sage: W.noncrossing_partition_lattice() # needs sage.combinat sage.groups Finite lattice containing 14 elements @@ -939,19 +940,17 @@ def noncrossing_partition_lattice(self, c=None, L=None, sage: W.noncrossing_partition_lattice() # needs sage.combinat sage.groups Finite lattice containing 8 elements - sage: W = ReflectionGroup((1,1,3)) # optional - gap3 - - sage: sorted(w.reduced_word() # optional - gap3 + sage: # optional - gap3 + sage: W = ReflectionGroup((1,1,3)) + sage: sorted(w.reduced_word() ....: for w in W.noncrossing_partition_lattice()) [[], [1], [1, 2], [1, 2, 1], [2]] - - sage: c21 = W.from_reduced_word([2,1]) # optional - gap3 - sage: sorted(w.reduced_word() # optional - gap3 + sage: c21 = W.from_reduced_word([2,1]) + sage: sorted(w.reduced_word() ....: for w in W.noncrossing_partition_lattice(c21)) [[], [1], [1, 2, 1], [2], [2, 1]] - - sage: c2 = W.from_reduced_word([2]) # optional - gap3 - sage: sorted(w.reduced_word() # optional - gap3 + sage: c2 = W.from_reduced_word([2]) + sage: sorted(w.reduced_word() ....: for w in W.noncrossing_partition_lattice(c2)) [[], [2]] """ @@ -1197,9 +1196,9 @@ def milnor_fiber_complex(self): EXAMPLES:: - sage: W = ColoredPermutations(3, 2) - sage: C = W.milnor_fiber_complex() - sage: C.homology() + sage: W = ColoredPermutations(3, 2) # needs sage.combinat + sage: C = W.milnor_fiber_complex() # needs sage.combinat + sage: C.homology() # needs sage.combinat {0: 0, 1: Z x Z x Z x Z} sage: W = ReflectionGroup(5) # optional - gap3 diff --git a/src/sage/categories/finite_dimensional_algebras_with_basis.py b/src/sage/categories/finite_dimensional_algebras_with_basis.py index e1df9318ec3..b4194929a50 100644 --- a/src/sage/categories/finite_dimensional_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_algebras_with_basis.py @@ -134,7 +134,7 @@ def radical_basis(self): ....: return self.basis()[self.base_ring().one()] ....: def product_on_basis(self, w1, w2): ....: return self.from_vector(vector(w1*w2)) - sage: AnAlgebra(GF(3)).radical_basis() + sage: AnAlgebra(GF(3)).radical_basis() # needs sage.libs.pari (B[1] + 2*B[xbar^2], B[xbar] + 2*B[xbar^2]) sage: AnAlgebra(GF(16,'a')).radical_basis() # needs sage.rings.finite_rings (B[1] + B[xbar],) @@ -299,7 +299,7 @@ def semisimple_quotient(self): descent algebra of the symmetric group is of dimension the number of partitions of `n`:: - sage: [ DescentAlgebra(QQ,n).B().semisimple_quotient().dimension() # needs sage.combinat sage.modules + sage: [ DescentAlgebra(QQ,n).B().semisimple_quotient().dimension() # needs sage.combinat sage.groups sage.modules ....: for n in range(6) ] [1, 1, 2, 3, 5, 7] sage: [Partitions(n).cardinality() for n in range(10)] # needs sage.combinat @@ -661,8 +661,8 @@ def cartan_invariants_matrix(self): in characteristic zero, the Cartan invariants matrix is the identity:: - sage: A3 = SymmetricGroup(3).algebra(QQ) # needs sage.groups sage.modules - sage: A3.cartan_invariants_matrix() # needs sage.groups sage.modules + sage: A3 = SymmetricGroup(3).algebra(QQ) # needs sage.combinat sage.groups sage.modules + sage: A3.cartan_invariants_matrix() # needs sage.combinat sage.groups sage.modules [1 0 0] [0 1 0] [0 0 1] @@ -810,9 +810,10 @@ def peirce_summand(self, ei, ej): corresponding to the unique simple module of dimension `2` of the symmetric group `S_4`:: - sage: A4 = SymmetricGroup(4).algebra(QQ) # needs sage.groups - sage: e = A4.central_orthogonal_idempotents()[2] # needs sage.groups sage.rings.number_field - sage: A4.peirce_summand(e, e) # needs sage.groups sage.rings.number_field + sage: # needs sage.combinat sage.groups sage.rings.number_field + sage: A4 = SymmetricGroup(4).algebra(QQ) + sage: e = A4.central_orthogonal_idempotents()[2] + sage: A4.peirce_summand(e, e) Free module generated by {0, 1, 2, 3} over Rational Field TESTS: @@ -820,12 +821,12 @@ def peirce_summand(self, ei, ej): We check each idempotent belong to its own Peirce summand (see :issue:`24687`):: - sage: # needs sage.groups + sage: # needs sage.combinat sage.groups sage.rings.number_field sage: from sage.monoids.hecke_monoid import HeckeMonoid sage: M = HeckeMonoid(SymmetricGroup(4)) sage: A = M.algebra(QQ) - sage: Idms = A.orthogonal_idempotents_central_mod_radical() # needs sage.rings.number_field - sage: all(A.peirce_summand(e, e).retract(e) # needs sage.rings.number_field + sage: Idms = A.orthogonal_idempotents_central_mod_radical() + sage: all(A.peirce_summand(e, e).retract(e) ....: in A.peirce_summand(e, e) for e in Idms) True """ @@ -963,11 +964,11 @@ def is_identity_decomposition_into_orthogonal_idempotents(self, l): With the algebra of the `0`-Hecke monoid:: - sage: # needs sage.combinat sage.groups sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage.rings.number_field sage: from sage.monoids.hecke_monoid import HeckeMonoid sage: A = HeckeMonoid(SymmetricGroup(4)).algebra(QQ) - sage: idempotents = A.orthogonal_idempotents_central_mod_radical() # needs sage.rings.number_field - sage: A.is_identity_decomposition_into_orthogonal_idempotents(idempotents) # needs sage.rings.number_field + sage: idempotents = A.orthogonal_idempotents_central_mod_radical() + sage: A.is_identity_decomposition_into_orthogonal_idempotents(idempotents) True Here are some more counterexamples: @@ -1179,9 +1180,10 @@ def __invert__(self): An algebra that does not define ``one_basis()``:: - sage: I = DescentAlgebra(QQ, 3).I() # needs sage.combinat sage.modules - sage: a = 3 * I.one() # needs sage.combinat sage.modules - sage: ~a == 1/3 * I.one() # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules + sage: I = DescentAlgebra(QQ, 3).I() + sage: a = 3 * I.one() + sage: ~a == 1/3 * I.one() True """ alg = self.parent() @@ -1269,8 +1271,8 @@ def _test_cellular(self, **options): EXAMPLES:: - sage: S = SymmetricGroupAlgebra(QQ, 3) # needs sage.combinat sage.modules - sage: S._test_cellular() # needs sage.combinat sage.modules + sage: S = SymmetricGroupAlgebra(QQ, 3) # needs sage.combinat sage.groups sage.modules + sage: S._test_cellular() # needs sage.combinat sage.groups sage.modules """ tester = self._tester(**options) cell_basis = self.cellular_basis() @@ -1331,7 +1333,7 @@ def _to_cellular_element(self, i): EXAMPLES:: - sage: S = SymmetricGroupAlgebra(QQ, 3) # needs sage.groups sage.modules + sage: S = SymmetricGroupAlgebra(QQ, 3) # needs sage.groups sage.modules sage: S._to_cellular_element # no implementation currently uses this # needs sage.groups sage.modules NotImplemented """ diff --git a/src/sage/categories/finite_dimensional_modules_with_basis.py b/src/sage/categories/finite_dimensional_modules_with_basis.py index 58916af2aaf..f297867a9db 100644 --- a/src/sage/categories/finite_dimensional_modules_with_basis.py +++ b/src/sage/categories/finite_dimensional_modules_with_basis.py @@ -124,8 +124,8 @@ def annihilator(self, S, action=operator.mul, side='right', category=None): sage: Ax = F.annihilator([x]); Ax .rename("Ax") sage: Ay = F.annihilator([y]); Ay .rename("Ay") sage: Axy = F.annihilator([x,y]); Axy.rename("Axy") - sage: P = Poset(([A, Ax, Ay, Axy], attrcall("is_submodule"))) # needs sage.combinat sage.graphs - sage: sorted(P.cover_relations(), key=str) # needs sage.combinat sage.graphs + sage: P = Poset(([A, Ax, Ay, Axy], attrcall("is_submodule"))) # needs sage.graphs + sage: sorted(P.cover_relations(), key=str) # needs sage.graphs [[Ax, A], [Axy, Ax], [Axy, Ay], [Ay, A]] """ return self.submodule(self.annihilator_basis(S, action, side), @@ -423,7 +423,7 @@ def invariant_module(self, S, action=operator.mul, action_on_basis=None, We build the invariant module of the permutation representation of the symmetric group:: - sage: # needs sage.groups sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: G = SymmetricGroup(3); G.rename('S3') sage: M = FreeModule(ZZ, [1,2,3], prefix='M'); M.rename('M') sage: action = lambda g, x: M.term(g(x)) @@ -498,7 +498,7 @@ def twisted_invariant_module(self, G, chi, EXAMPLES:: - sage: # needs sage.groups sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: M = CombinatorialFreeModule(QQ, [1,2,3]) sage: G = SymmetricGroup(3) sage: def action(g,x): return(M.term(g(x))) # permute coordinates @@ -805,16 +805,16 @@ def __invert__(self): We check that this function complains if the morphism is not invertible:: - sage: phi = X.module_morphism(on_basis={1: y[3] + y[4], 2: y[3] + y[4]}.__getitem__, # needs sage.modules + sage: # needs sage.modules + sage: phi = X.module_morphism(on_basis={1: y[3] + y[4], 2: y[3] + y[4]}.__getitem__, ....: codomain=Y, category=category) - sage: ~phi # needs sage.modules + sage: ~phi Traceback (most recent call last): ... RuntimeError: morphism is not invertible - - sage: phi = X.module_morphism(on_basis={1: y[3] + y[4], 2: y[3] + 5*y[4]}.__getitem__, # needs sage.modules + sage: phi = X.module_morphism(on_basis={1: y[3] + y[4], 2: y[3] + 5*y[4]}.__getitem__, ....: codomain=Y, category=category) - sage: ~phi # needs sage.modules + sage: ~phi Traceback (most recent call last): ... RuntimeError: morphism is not invertible diff --git a/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py b/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py index da4b297ddde..a5061131960 100644 --- a/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py @@ -50,13 +50,13 @@ def radical_basis(self, **keywords): EXAMPLES:: - sage: A = SymmetricGroup(4).algebra(QQ) # needs sage.groups sage.modules - sage: A.radical_basis() # needs sage.groups sage.modules + sage: A = SymmetricGroup(4).algebra(QQ) # needs sage.combinat sage.groups sage.modules + sage: A.radical_basis() # needs sage.combinat sage.groups sage.modules () TESTS:: - sage: A.radical_basis.__module__ # needs sage.groups sage.modules + sage: A.radical_basis.__module__ # needs sage.combinat sage.groups sage.modules 'sage.categories.finite_dimensional_semisimple_algebras_with_basis' """ return () @@ -96,7 +96,7 @@ def central_orthogonal_idempotents(self): For the semisimple quotient of a quiver algebra, we recover the vertices of the quiver:: - sage: # needs sage.graphs sage.modules + sage: # needs sage.graphs sage.modules sage.rings.number_field sage: A = FiniteDimensionalAlgebrasWithBasis(QQ).example(); A An example of a finite dimensional algebra with basis: the path algebra of the Kronecker quiver (containing @@ -160,8 +160,8 @@ def _orthogonal_decomposition(self, generators=None): center of the algebra of the symmetric group `S_4`:: - sage: Z4 = SymmetricGroup(4).algebra(QQ).center() # needs sage.groups sage.modules - sage: Z4._orthogonal_decomposition() # needs sage.groups sage.modules + sage: Z4 = SymmetricGroup(4).algebra(QQ).center() # needs sage.combinat sage.groups sage.modules + sage: Z4._orthogonal_decomposition() # needs sage.combinat sage.groups sage.modules (B[0] + B[1] + B[2] + B[3] + B[4], B[0] + 1/3*B[1] - 1/3*B[2] - 1/3*B[4], B[0] + B[2] - 1/2*B[3], @@ -222,7 +222,7 @@ def central_orthogonal_idempotents(self): EXAMPLES:: - sage: # needs sage.groups sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: A4 = SymmetricGroup(4).algebra(QQ) sage: Z4 = A4.center() sage: idempotents = Z4.central_orthogonal_idempotents() @@ -237,7 +237,7 @@ def central_orthogonal_idempotents(self): recognize among them the sum and alternating sum of all permutations:: - sage: [e.lift() for e in idempotents] # needs sage.groups sage.modules + sage: [e.lift() for e in idempotents] # needs sage.combinat sage.groups sage.modules [1/24*() + 1/24*(3,4) + 1/24*(2,3) + 1/24*(2,3,4) + 1/24*(2,4,3) + 1/24*(2,4) + 1/24*(1,2) + 1/24*(1,2)(3,4) + 1/24*(1,2,3) + 1/24*(1,2,3,4) + 1/24*(1,2,4,3) + 1/24*(1,2,4) + 1/24*(1,3,2) @@ -255,7 +255,8 @@ def central_orthogonal_idempotents(self): We check that they indeed form a decomposition of the identity of `Z_4` into orthogonal idempotents:: - sage: Z4.is_identity_decomposition_into_orthogonal_idempotents(idempotents) # needs sage.groups sage.modules + sage: # needs sage.combinat sage.groups sage.modules + sage: Z4.is_identity_decomposition_into_orthogonal_idempotents(idempotents) True """ return tuple([(e.leading_coefficient()/(e*e).leading_coefficient())*e diff --git a/src/sage/categories/finite_monoids.py b/src/sage/categories/finite_monoids.py index b446dc925cb..4115e753809 100644 --- a/src/sage/categories/finite_monoids.py +++ b/src/sage/categories/finite_monoids.py @@ -73,8 +73,8 @@ def nerve(self): 2 is infinite-dimensional real projective space. :: sage: Sigma2 = groups.permutation.Cyclic(2) # needs sage.groups - sage: BSigma2 = Sigma2.nerve() # needs sage.groups - sage: BSigma2.cohomology(4, base_ring=GF(2)) # needs sage.groups sage.modules + sage: BSigma2 = Sigma2.nerve() # needs sage.graphs sage.groups + sage: BSigma2.cohomology(4, base_ring=GF(2)) # needs sage.graphs sage.groups sage.modules Vector space of dimension 1 over Finite Field of size 2 The `k`-simplices of the nerve are named after the chains @@ -83,15 +83,15 @@ def nerve(self): element) and ``(1,2)`` in Sage. So the 1-cells and 2-cells in `B\Sigma_2` are:: - sage: BSigma2.n_cells(1) # needs sage.groups + sage: BSigma2.n_cells(1) # needs sage.graphs sage.groups [(1,2)] - sage: BSigma2.n_cells(2) # needs sage.groups + sage: BSigma2.n_cells(2) # needs sage.graphs sage.groups [(1,2) * (1,2)] Another construction of the group, with different names for its elements:: - sage: # needs sage.groups + sage: # needs sage.groups sage.rings.number_field sage: C2 = groups.misc.MultiplicativeAbelian([2]) sage: BC2 = C2.nerve() sage: BC2.n_cells(0) @@ -105,8 +105,8 @@ def nerve(self): first nonvanishing homology group in dimension `p`:: sage: Sigma3 = groups.permutation.Symmetric(3) # needs sage.groups - sage: BSigma3 = Sigma3.nerve() # needs sage.groups - sage: BSigma3.homology(range(4), base_ring=GF(3)) # needs sage.groups + sage: BSigma3 = Sigma3.nerve() # needs sage.graphs sage.groups + sage: BSigma3.homology(range(4), base_ring=GF(3)) # needs sage.graphs sage.groups {0: Vector space of dimension 0 over Finite Field of size 3, 1: Vector space of dimension 0 over Finite Field of size 3, 2: Vector space of dimension 0 over Finite Field of size 3, @@ -116,7 +116,7 @@ def nerve(self): `B\Sigma_2` for relatively large values of `n`, while for `B\Sigma_3`, the complexes get large pretty quickly:: - sage: # needs sage.groups + sage: # needs sage.graphs sage.groups sage: Sigma2.nerve().n_skeleton(14) Simplicial set with 15 non-degenerate simplices sage: BSigma3 = Sigma3.nerve() @@ -130,7 +130,7 @@ def nerve(self): on `p` letters, and its first homology group appears earlier:: - sage: # needs sage.groups + sage: # needs sage.graphs sage.groups sage.rings.number_field sage: C3 = groups.misc.MultiplicativeAbelian([3]) sage: list(C3) [1, f, f^2] @@ -192,7 +192,7 @@ def rhodes_radical_congruence(self, base_ring=None): By Maschke's theorem, every group algebra over `\QQ` is semisimple hence the Rhodes radical of a group must be trivial:: - sage: SymmetricGroup(3).rhodes_radical_congruence() # needs sage.groups sage.modules + sage: SymmetricGroup(3).rhodes_radical_congruence() # needs sage.combinat sage.groups sage.modules [] sage: DihedralGroup(10).rhodes_radical_congruence() # needs sage.groups sage.modules [] diff --git a/src/sage/categories/finite_permutation_groups.py b/src/sage/categories/finite_permutation_groups.py index a8c008ac170..56e711ce3ff 100644 --- a/src/sage/categories/finite_permutation_groups.py +++ b/src/sage/categories/finite_permutation_groups.py @@ -130,14 +130,14 @@ def cycle_index(self, parent=None): of length 2, 8 cycles of length 3, and 6 cycles of length 4:: sage: S4 = SymmetricGroup(4) - sage: P = S4.cycle_index() - sage: 24 * P + sage: P = S4.cycle_index() # needs sage.combinat + sage: 24 * P # needs sage.combinat p[1, 1, 1, 1] + 6*p[2, 1, 1] + 3*p[2, 2] + 8*p[3, 1] + 6*p[4] If `l = (l_1,\dots,l_k)` is a partition, ``|G| P[l]`` is the number of elements of `G` with cycles of length `(p_1,\dots,p_k)`:: - sage: 24 * P[ Partition([3,1]) ] + sage: 24 * P[ Partition([3,1]) ] # needs sage.combinat 8 The cycle index plays an important role in the enumeration of @@ -146,7 +146,7 @@ def cycle_index(self, parent=None): encoded as a symmetric function, expressed in the powersum basis:: - sage: P.parent() + sage: P.parent() # needs sage.combinat Symmetric Functions over Rational Field in the powersum basis This symmetric function can have some nice properties; for @@ -154,7 +154,7 @@ def cycle_index(self, parent=None): symmetric function `h_n`:: sage: S = SymmetricFunctions(QQ); h = S.h() - sage: h( P ) + sage: h( P ) # needs sage.combinat h[4] .. TODO:: @@ -165,10 +165,10 @@ def cycle_index(self, parent=None): Here are the cycle indices of some permutation groups:: - sage: 6 * CyclicPermutationGroup(6).cycle_index() + sage: 6 * CyclicPermutationGroup(6).cycle_index() # needs sage.combinat p[1, 1, 1, 1, 1, 1] + p[2, 2, 2] + 2*p[3, 3] + 2*p[6] - sage: 60 * AlternatingGroup(5).cycle_index() + sage: 60 * AlternatingGroup(5).cycle_index() # needs sage.combinat p[1, 1, 1, 1, 1] + 15*p[2, 2, 1] + 20*p[3, 1, 1] + 24*p[5] sage: for G in TransitiveGroups(5): # long time @@ -183,13 +183,14 @@ def cycle_index(self, parent=None): (see :issue:`22765`):: sage: G = PermutationGroup([['b','c','a']], domain=['a','b','c']) - sage: G.cycle_index() + sage: G.cycle_index() # needs sage.combinat 1/3*p[1, 1, 1] + 2/3*p[3] One may specify another parent for the result:: + sage: # needs sage.combinat sage: F = CombinatorialFreeModule(QQ, Partitions()) - sage: P = CyclicPermutationGroup(6).cycle_index(parent = F) + sage: P = CyclicPermutationGroup(6).cycle_index(parent=F) sage: 6 * P B[[1, 1, 1, 1, 1, 1]] + B[[2, 2, 2]] + 2*B[[3, 3]] + 2*B[[6]] sage: P.parent() is F @@ -214,11 +215,11 @@ def cycle_index(self, parent=None): sage: P = PermutationGroup([]); P Permutation Group with generators [()] - sage: P.cycle_index() + sage: P.cycle_index() # needs sage.combinat p[1] sage: P = PermutationGroup([[(1)]]); P Permutation Group with generators [()] - sage: P.cycle_index() + sage: P.cycle_index() # needs sage.combinat p[1] """ from sage.categories.modules import Modules @@ -259,6 +260,7 @@ def profile_series(self, variable='z'): EXAMPLES:: + sage: # needs sage.combinat sage: C8 = CyclicPermutationGroup(8) sage: C8.profile_series() z^8 + z^7 + 4*z^6 + 7*z^5 + 10*z^4 + 7*z^3 + 4*z^2 + z + 1 @@ -270,8 +272,8 @@ def profile_series(self, variable='z'): Univariate Polynomial Ring in z over Rational Field sage: D8.profile_series(variable='y') y^8 + y^7 + 4*y^6 + 5*y^5 + 8*y^4 + 5*y^3 + 4*y^2 + y + 1 - sage: u = var('u') # needs sage.symbolic - sage: D8.profile_series(u).parent() # needs sage.symbolic + sage: u = var('u') + sage: D8.profile_series(u).parent() Symbolic Ring """ from sage.rings.integer_ring import ZZ @@ -311,9 +313,9 @@ def profile(self, n, using_polya=True): EXAMPLES:: sage: C6 = CyclicPermutationGroup(6) - sage: C6.profile(2) + sage: C6.profile(2) # needs sage.combinat 3 - sage: C6.profile(3) + sage: C6.profile(3) # needs sage.combinat 4 sage: D8 = DihedralGroup(8) sage: D8.profile(4, using_polya=False) diff --git a/src/sage/categories/finite_posets.py b/src/sage/categories/finite_posets.py index 68317bbb4c3..669ee9336ef 100644 --- a/src/sage/categories/finite_posets.py +++ b/src/sage/categories/finite_posets.py @@ -62,11 +62,11 @@ def is_lattice(self): EXAMPLES:: sage: P = Poset([[1, 3, 2], [4], [4, 5, 6], [6], [7], [7], [7], []]) - sage: P.is_lattice() + sage: P.is_lattice() # needs sage.modules True sage: P = Poset([[1, 2], [3], [3], []]) - sage: P.is_lattice() + sage: P.is_lattice() # needs sage.modules True sage: P = Poset({0: [2, 3], 1: [2, 3]}) @@ -75,7 +75,7 @@ def is_lattice(self): sage: P = Poset({1: [2, 3, 4], 2: [5, 6], 3: [5, 7], 4: [6, 7], 5: [8, 9], ....: 6: [8, 10], 7: [9, 10], 8: [11], 9: [11], 10: [11]}) - sage: P.is_lattice() + sage: P.is_lattice() # needs sage.modules False TESTS:: @@ -150,7 +150,8 @@ def is_poset_isomorphism(self, f, codomain): function `f: B \to D, b \mapsto \prod_{x\in b} x`:: sage: D = Poset((divisors(30), attrcall("divides"))) - sage: B = Poset(([frozenset(s) for s in Subsets([2,3,5])], attrcall("issubset"))) + sage: B = Poset(([frozenset(s) for s in Subsets([2,3,5])], + ....: attrcall("issubset"))) sage: def f(b): return D(prod(b)) sage: B.is_poset_isomorphism(f, D) True @@ -165,14 +166,16 @@ def is_poset_isomorphism(self, f, codomain): A non surjective case:: - sage: B = Poset(([frozenset(s) for s in Subsets([2,3])], attrcall("issubset"))) + sage: B = Poset(([frozenset(s) for s in Subsets([2,3])], + ....: attrcall("issubset"))) sage: def f(b): return D(prod(b)) sage: B.is_poset_isomorphism(f, D) False A non injective case:: - sage: B = Poset(([frozenset(s) for s in Subsets([2,3,5,6])], attrcall("issubset"))) + sage: B = Poset(([frozenset(s) for s in Subsets([2,3,5,6])], + ....: attrcall("issubset"))) sage: def f(b): return D(gcd(prod(b), 30)) sage: B.is_poset_isomorphism(f, D) False @@ -219,7 +222,8 @@ def is_poset_morphism(self, f, codomain): is a morphism of posets:: sage: D = Poset((divisors(30), attrcall("divides"))) - sage: B = Poset(([frozenset(s) for s in Subsets([2,3,5,6])], attrcall("issubset"))) + sage: B = Poset(([frozenset(s) for s in Subsets([2,3,5,6])], + ....: attrcall("issubset"))) sage: def f(b): return D(gcd(prod(b), 30)) sage: B.is_poset_morphism(f, D) True @@ -453,7 +457,8 @@ def rowmotion(self, order_ideal): EXAMPLES:: - sage: P = Poset( {1: [2, 3], 2: [], 3: [], 4: [8], 5: [], 6: [5], 7: [1, 4], 8: []} ) + sage: P = Poset( {1: [2, 3], 2: [], 3: [], 4: [8], + ....: 5: [], 6: [5], 7: [1, 4], 8: []} ) sage: I = Set({2, 6, 1, 7}) sage: P.rowmotion(I) {1, 3, 4, 5, 6, 7} @@ -632,7 +637,8 @@ def birational_free_labelling(self, linear_extension=None, sage: P = Poset({1: [2, 3]}) sage: l = P.birational_free_labelling(); l - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b over Rational Field, {...}, a, b) @@ -640,31 +646,39 @@ def birational_free_labelling(self, linear_extension=None, [(1, x1), (2, x2), (3, x3)] sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2]); l - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b over Rational Field, {...}, a, b) sage: sorted(l[1].items()) [(1, x1), (2, x3), (3, x2)] - sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], reduced=True, addvars="spam, eggs"); l - (Fraction Field of Multivariate Polynomial Ring in x1, x2, x3, spam, eggs over Rational Field, + sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], + ....: reduced=True, addvars="spam, eggs"); l + (Fraction Field of Multivariate Polynomial Ring + in x1, x2, x3, spam, eggs over Rational Field, {...}, 1, 1) sage: sorted(l[1].items()) [(1, x1), (2, x3), (3, x2)] - sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], prefix="wut", reduced=True, addvars="spam, eggs"); l - (Fraction Field of Multivariate Polynomial Ring in wut1, wut2, wut3, spam, eggs over Rational Field, + sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], + ....: prefix="wut", reduced=True, + ....: addvars="spam, eggs"); l + (Fraction Field of Multivariate Polynomial Ring + in wut1, wut2, wut3, spam, eggs over Rational Field, {...}, 1, 1) sage: sorted(l[1].items()) [(1, wut1), (2, wut3), (3, wut2)] - sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], reduced=False, addvars="spam, eggs"); l - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b, spam, eggs over Rational Field, + sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], + ....: reduced=False, addvars="spam, eggs"); l + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b, spam, eggs over Rational Field, {...}, a, b) @@ -675,8 +689,10 @@ def birational_free_labelling(self, linear_extension=None, Illustrating labelling with a function:: - sage: P = posets.ChainPoset(2).product(posets.ChainPoset(2)) - sage: l = P.birational_free_labelling(labels=lambda e : 'x_' + str(e[0]) + str(e[1])) + sage: P = posets.ChainPoset(2).product(posets.ChainPoset(2)) # needs sage.modules + sage: def x_label(e): + ....: return 'x_' + str(e[0]) + str(e[1]) + sage: l = P.birational_free_labelling(labels=x_label) sage: sorted(l[1].items()) [((0, 0), x_00), ((0, 1), x_01), ((1, 0), x_10), ((1, 1), x_11)] sage: l[2] @@ -684,8 +700,9 @@ def birational_free_labelling(self, linear_extension=None, The same, but with ``min_label`` and ``max_label`` provided:: - sage: P = posets.ChainPoset(2).product(posets.ChainPoset(2)) - sage: l = P.birational_free_labelling(labels=lambda e : 'x_' + str(e[0]) + str(e[1]), min_label="lambda", max_label="mu") + sage: P = posets.ChainPoset(2).product(posets.ChainPoset(2)) # needs sage.modules + sage: l = P.birational_free_labelling(labels=x_label, + ....: min_label="lambda", max_label="mu") sage: sorted(l[1].items()) [((0, 0), x_00), ((0, 1), x_01), ((1, 0), x_10), ((1, 1), x_11)] sage: l[2] @@ -708,8 +725,11 @@ def birational_free_labelling(self, linear_extension=None, Illustrating the warning about facade:: sage: P = Poset({1: [2, 3]}, facade=False) - sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], reduced=False, addvars="spam, eggs"); l - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b, spam, eggs over Rational Field, + sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], + ....: reduced=False, + ....: addvars="spam, eggs"); l + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b, spam, eggs over Rational Field, {...}, a, b) @@ -722,17 +742,21 @@ def birational_free_labelling(self, linear_extension=None, Another poset:: + sage: # needs sage.modules sage: P = posets.SSTPoset([2,1]) sage: lext = sorted(P) - sage: l = P.birational_free_labelling(linear_extension=lext, addvars="ohai") - sage: l - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, x4, x5, x6, x7, x8, b, ohai over Rational Field, + sage: l = P.birational_free_labelling(linear_extension=lext, + ....: addvars="ohai"); l + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, x4, x5, x6, x7, x8, b, ohai over Rational Field, {...}, a, b) sage: sorted(l[1].items()) - [([[1, 1], [2]], x1), ([[1, 1], [3]], x2), ([[1, 2], [2]], x3), ([[1, 2], [3]], x4), - ([[1, 3], [2]], x5), ([[1, 3], [3]], x6), ([[2, 2], [3]], x7), ([[2, 3], [3]], x8)] + [([[1, 1], [2]], x1), ([[1, 1], [3]], x2), + ([[1, 2], [2]], x3), ([[1, 2], [3]], x4), + ([[1, 3], [2]], x5), ([[1, 3], [3]], x6), + ([[2, 2], [3]], x7), ([[2, 3], [3]], x8)] See :meth:`birational_rowmotion`, :meth:`birational_toggle` and :meth:`birational_toggles` for more substantial examples of what @@ -743,8 +767,8 @@ def birational_free_labelling(self, linear_extension=None, The ``linear_extension`` keyword does not have to be given an actual linear extension:: - sage: P = posets.ChainPoset(2).product(posets.ChainPoset(3)) - sage: P + sage: # needs sage.modules + sage: P = posets.ChainPoset(2).product(posets.ChainPoset(3)); P Finite lattice containing 6 elements sage: lex = [(1,0),(0,0),(1,1),(0,1),(1,2),(0,2)] sage: l = P.birational_free_labelling(linear_extension=lex, @@ -764,6 +788,7 @@ def birational_free_labelling(self, linear_extension=None, For comparison, the standard linear extension:: + sage: # needs sage.modules sage: l = P.birational_free_labelling(prefix="u", reduced=True); l (Fraction Field of Multivariate Polynomial Ring in u1, u2, u3, u4, u5, u6 over Rational Field, {...}, @@ -781,6 +806,7 @@ def birational_free_labelling(self, linear_extension=None, linear extension, just call the ``linear_extension`` method on the poset:: + sage: # needs sage.modules sage: lex = [(0,0),(0,1),(1,0),(1,1),(0,2),(1,2)] sage: l = P.birational_free_labelling(linear_extension=P.linear_extension(lex), ....: prefix="u", reduced=True) @@ -931,7 +957,8 @@ def birational_toggle(self, v, labelling): sage: V = Poset({1: [2, 3]}) sage: s = V.birational_free_labelling(); s - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b over Rational Field, {...}, a, b) @@ -941,7 +968,8 @@ def birational_toggle(self, v, labelling): The image of `s` under the `1`-toggle `T_1` is:: sage: s1 = V.birational_toggle(1, s); s1 - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b over Rational Field, {...}, a, b) @@ -951,7 +979,8 @@ def birational_toggle(self, v, labelling): Now let us apply the `2`-toggle `T_2` (to the old ``s``):: sage: s2 = V.birational_toggle(2, s); s2 - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b over Rational Field, {...}, a, b) @@ -962,7 +991,8 @@ def birational_toggle(self, v, labelling): under `T_1`:: sage: s12 = V.birational_toggle(2, s1); s12 - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, b over Rational Field, {...}, a, b) @@ -1021,7 +1051,8 @@ def birational_toggle(self, v, labelling): sage: P = posets.SymmetricGroupWeakOrderPoset(3) sage: sorted(list(P)) ['123', '132', '213', '231', '312', '321'] - sage: t = (TT, {'123': TT(4), '132': TT(2), '213': TT(3), '231': TT(1), '321': TT(1), '312': TT(2)}, TT(7), TT(1)) + sage: t = (TT, {'123': TT(4), '132': TT(2), '213': TT(3), + ....: '231': TT(1), '321': TT(1), '312': TT(2)}, TT(7), TT(1)) sage: t1 = P.birational_toggle('123', t); t1 (Tropical semiring over Rational Field, {...}, 7, 1) sage: sorted(t1[1].items()) @@ -1060,7 +1091,8 @@ def birational_toggle(self, v, labelling): ....: for v in P ) True sage: t4 = P.birational_toggle(P('z'), t); t4 - (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, x4, b over Rational Field, + (Fraction Field of Multivariate Polynomial Ring + in a, x1, x2, x3, x4, b over Rational Field, {...}, a, b) @@ -1146,7 +1178,8 @@ def birational_toggles(self, vs, labelling): sage: sorted(list(P)) ['123', '132', '213', '231', '312', '321'] sage: TT = TropicalSemiring(ZZ) - sage: t = (TT, {'123': TT(4), '132': TT(2), '213': TT(3), '231': TT(1), '321': TT(1), '312': TT(2)}, TT(7), TT(1)) + sage: t = (TT, {'123': TT(4), '132': TT(2), '213': TT(3), + ....: '231': TT(1), '321': TT(1), '312': TT(2)}, TT(7), TT(1)) sage: tA = P.birational_toggles(['123', '231', '312'], t); tA (Tropical semiring over Integer Ring, {...}, 7, 1) sage: sorted(tA[1].items()) @@ -1166,10 +1199,13 @@ def birational_toggles(self, vs, labelling): 1, 1) sage: sorted(t1[1].items()) - [(1, (x^2 + x)/(x^2 + x + 1)), (2, (x^3 + x^2)/(x^2 + x + 1)), (3, x^4/(x^2 + x + 1)), (4, 1)] + [(1, (x^2 + x)/(x^2 + x + 1)), + (2, (x^3 + x^2)/(x^2 + x + 1)), + (3, x^4/(x^2 + x + 1)), (4, 1)] sage: t2 = P.birational_toggles(reversed(range(1, 5)), t) sage: sorted(t2[1].items()) - [(1, 1/x^2), (2, (x^2 + x + 1)/x^4), (3, (x^2 + x + 1)/(x^3 + x^2)), (4, (x^2 + x + 1)/x^3)] + [(1, 1/x^2), (2, (x^2 + x + 1)/x^4), (3, (x^2 + x + 1)/(x^3 + x^2)), + (4, (x^2 + x + 1)/x^3)] Facade set to ``False`` works:: @@ -1241,11 +1277,11 @@ def birational_rowmotion(self, labelling): ....: for i in range(k): ....: t = P.birational_rowmotion(t) ....: return t == t0 - sage: test_rectangle_periodicity(2, 2, 4) + sage: test_rectangle_periodicity(2, 2, 4) # needs sage.modules True - sage: test_rectangle_periodicity(2, 2, 2) + sage: test_rectangle_periodicity(2, 2, 2) # needs sage.modules False - sage: test_rectangle_periodicity(2, 3, 5) # long time + sage: test_rectangle_periodicity(2, 3, 5) # long time # needs sage.modules True While computations with the birational free labelling quickly @@ -1262,7 +1298,7 @@ def birational_rowmotion(self, labelling): ....: for i in range(k): ....: t = P.birational_rowmotion(t) ....: return t == t0 - sage: test_rectangle_periodicity_tropical(7, 6, 13) + sage: test_rectangle_periodicity_tropical(7, 6, 13) # needs sage.modules True Tropicalization is also what relates birational rowmotion to @@ -1285,7 +1321,7 @@ def birational_rowmotion(self, labelling): ....: # send order ideal `I` to a `T`-labelling of `P`. ....: dct = {v: TT(v in I) for v in P} ....: return (TT, dct, TT(1), TT(0)) - sage: all(indicator_labelling(P.rowmotion(I)) + sage: all(indicator_labelling(P.rowmotion(I)) # needs sage.modules ....: == P.birational_rowmotion(indicator_labelling(I)) ....: for I in P.order_ideals_lattice(facade=True)) True @@ -1345,6 +1381,7 @@ def panyushev_orbits(self, element_constructor=set): EXAMPLES:: + sage: # needs sage.modules sage: P = Poset( ( [1,2,3], [ [1,3], [2,3] ] ) ) sage: orb = P.panyushev_orbits() sage: sorted(sorted(o) for o in orb) @@ -1405,6 +1442,7 @@ def rowmotion_orbits(self, element_constructor=set): EXAMPLES:: + sage: # needs sage.modules sage: P = Poset( {1: [2, 3], 2: [], 3: [], 4: [2]} ) sage: sorted(len(o) for o in P.rowmotion_orbits()) [3, 5] @@ -1431,6 +1469,7 @@ def rowmotion_orbits_plots(self): EXAMPLES:: + sage: # needs sage.modules sage.plot sage: P = Poset( {1: [2, 3], 2: [], 3: [], 4: [2]} ) sage: P.rowmotion_orbits_plots() Graphics Array of size 2 x 5 @@ -1485,10 +1524,10 @@ def toggling_orbits(self, vs, element_constructor=set): EXAMPLES:: sage: P = Poset( {1: [2, 4], 2: [], 3: [4], 4: []} ) - sage: sorted(len(o) for o in P.toggling_orbits([1, 2])) + sage: sorted(len(o) for o in P.toggling_orbits([1, 2])) # needs sage.modules [2, 3, 3] sage: P = Poset( {1: [3], 2: [1, 4], 3: [], 4: [3]} ) - sage: sorted(len(o) for o in P.toggling_orbits((1, 2, 4, 3))) + sage: sorted(len(o) for o in P.toggling_orbits((1, 2, 4, 3))) # needs sage.modules [3, 3] """ # TODO: implement a generic function taking a set and @@ -1517,6 +1556,7 @@ def toggling_orbits_plots(self, vs): EXAMPLES:: + sage: # needs sage.modules sage.plot sage: P = Poset( {1: [2, 3], 2: [], 3: [], 4: [2]} ) sage: P.toggling_orbits_plots([1,2,3,4]) Graphics Array of size 2 x 5 @@ -1788,13 +1828,17 @@ def toggling_orbit_iter(self, vs, oideal, element_constructor=set, stop=True, ch [{1, 2}, set(), {1, 2, 3}] sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]))) [{1, 2}, {1, 2, 3}, set()] - sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]), element_constructor=list)) + sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]), + ....: element_constructor=list)) [[1, 2], [1, 2, 3], []] - sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]), element_constructor=frozenset)) + sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]), + ....: element_constructor=frozenset)) [frozenset({1, 2}), frozenset({1, 2, 3}), frozenset()] - sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]), element_constructor=tuple)) + sage: list(P.toggling_orbit_iter([3, 2, 1], set([1, 2]), + ....: element_constructor=tuple)) [(1, 2), (1, 2, 3), ()] - sage: list(P.toggling_orbit_iter([3, 2, 1], [2, 1], element_constructor=tuple)) + sage: list(P.toggling_orbit_iter([3, 2, 1], [2, 1], + ....: element_constructor=tuple)) [(1, 2), (1, 2, 3), ()] sage: P = Poset( {} ) @@ -1862,6 +1906,7 @@ def order_ideals_lattice(self, as_ideals=True, facade=None): EXAMPLES:: + sage: # needs sage.modules sage: P = posets.PentagonPoset() sage: P.cover_relations() [[0, 1], [0, 2], [1, 4], [2, 3], [3, 4]] @@ -1872,24 +1917,25 @@ def order_ideals_lattice(self, as_ideals=True, facade=None): As a lattice on antichains:: - sage: J2 = P.order_ideals_lattice(False); J2 + sage: J2 = P.order_ideals_lattice(False); J2 # needs sage.modules Finite lattice containing 8 elements - sage: sorted(J2) + sage: sorted(J2) # needs sage.modules [(), (0,), (1,), (1, 2), (1, 3), (2,), (3,), (4,)] TESTS:: - sage: J = posets.DiamondPoset(4, facade = True).order_ideals_lattice(); J + sage: # needs sage.modules + sage: J = posets.DiamondPoset(4, facade=True).order_ideals_lattice(); J Finite lattice containing 6 elements sage: sorted(sorted(e) for e in J) [[], [0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 2]] sage: sorted(sorted(sorted(e) for e in c) for c in J.cover_relations()) [[[], [0]], [[0], [0, 1]], [[0], [0, 2]], [[0, 1], [0, 1, 2]], [[0, 1, 2], [0, 1, 2, 3]], [[0, 1, 2], [0, 2]]] - sage: P = Poset({1:[2]}) - sage: J_facade = P.order_ideals_lattice() - sage: J_nonfacade = P.order_ideals_lattice(facade=False) - sage: type(J_facade[0]) == type(J_nonfacade[0]) + sage: P = Poset({1: [2]}) + sage: J_facade = P.order_ideals_lattice() # needs sage.modules + sage: J_nonfacade = P.order_ideals_lattice(facade=False) # needs sage.modules + sage: type(J_facade[0]) == type(J_nonfacade[0]) # needs sage.modules False """ from sage.combinat.posets.lattices import LatticePoset @@ -1921,9 +1967,9 @@ def antichains(self): EXAMPLES:: - sage: A = posets.PentagonPoset().antichains(); A + sage: A = posets.PentagonPoset().antichains(); A # needs sage.modules Set of antichains of Finite lattice containing 5 elements - sage: list(A) + sage: list(A) # needs sage.modules [[], [0], [1], [1, 2], [1, 3], [2], [3], [4]] """ @@ -1943,8 +1989,9 @@ def directed_subsets(self, direction): sage: P = Poset((divisors(12), attrcall("divides")), facade=True) sage: A = P.directed_subsets('up') - sage: sorted(list(A)) - [[], [1, 2, 4, 3, 6, 12], [2, 4, 3, 6, 12], [2, 4, 6, 12], [3, 6, 12], [4, 3, 6, 12], [4, 6, 12], [4, 12], [6, 12], [12]] + sage: sorted(list(A)) # needs sage.modules + [[], [1, 2, 4, 3, 6, 12], [2, 4, 3, 6, 12], [2, 4, 6, 12], [3, 6, 12], + [4, 3, 6, 12], [4, 6, 12], [4, 12], [6, 12], [12]] TESTS:: diff --git a/src/sage/categories/hecke_modules.py b/src/sage/categories/hecke_modules.py index 6a575fd17d6..f76e233f4a1 100644 --- a/src/sage/categories/hecke_modules.py +++ b/src/sage/categories/hecke_modules.py @@ -121,7 +121,7 @@ def _Hom_(self, Y, category): EXAMPLES:: - sage: # needs sage.modular + sage: # needs sage.libs.pari sage.modular sage: M = ModularForms(Gamma0(7), 4) sage: H = M._Hom_(M, category=HeckeModules(QQ)); H Set of Morphisms diff --git a/src/sage/categories/hopf_algebras_with_basis.py b/src/sage/categories/hopf_algebras_with_basis.py index d56adc36eb1..034ea2f8186 100644 --- a/src/sage/categories/hopf_algebras_with_basis.py +++ b/src/sage/categories/hopf_algebras_with_basis.py @@ -253,7 +253,7 @@ def _test_antipode(self, **options): :: sage: s = SymmetricFunctions(QQ).schur() # needs sage.combinat sage.modules - sage: s._test_antipode() # needs sage.combinat sage.modules + sage: s._test_antipode() # needs lrcalc_python sage.combinat sage.modules """ tester = self._tester(**options) diff --git a/src/sage/categories/lie_algebras.py b/src/sage/categories/lie_algebras.py index d0958f12d89..de5a4a70a1d 100644 --- a/src/sage/categories/lie_algebras.py +++ b/src/sage/categories/lie_algebras.py @@ -45,24 +45,21 @@ class LieAlgebras(Category_over_base_ring): We construct a typical parent in this category, and do some computations with it:: - sage: A = C.example(); A # needs sage.groups sage.modules + sage: # needs sage.combinat sage.groups sage.modules + sage: A = C.example(); A An example of a Lie algebra: the Lie algebra from the associative algebra Symmetric group algebra of order 3 over Rational Field generated by ([2, 1, 3], [2, 3, 1]) - - sage: A.category() # needs sage.groups sage.modules + sage: A.category() Category of Lie algebras over Rational Field - - sage: A.base_ring() # needs sage.groups sage.modules + sage: A.base_ring() Rational Field - - sage: a, b = A.lie_algebra_generators() # needs sage.groups sage.modules - sage: a.bracket(b) # needs sage.groups sage.modules + sage: a, b = A.lie_algebra_generators() + sage: a.bracket(b) -[1, 3, 2] + [3, 2, 1] - sage: b.bracket(2*a + b) # needs sage.groups sage.modules + sage: b.bracket(2*a + b) 2*[1, 3, 2] - 2*[3, 2, 1] - - sage: A.bracket(a, b) # needs sage.groups sage.modules + sage: A.bracket(a, b) -[1, 3, 2] + [3, 2, 1] Please see the source code of `A` (with ``A??``) for how to @@ -72,7 +69,7 @@ class LieAlgebras(Category_over_base_ring): sage: C = LieAlgebras(QQ) sage: TestSuite(C).run() - sage: TestSuite(C.example()).run() # needs sage.combinat sage.modules + sage: TestSuite(C.example()).run() # needs sage.combinat sage.groups sage.modules .. TODO:: @@ -151,7 +148,7 @@ def example(self, gens=None): EXAMPLES:: - sage: LieAlgebras(QQ).example() # needs sage.groups sage.modules + sage: LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules An example of a Lie algebra: the Lie algebra from the associative algebra Symmetric group algebra of order 3 over Rational Field generated by ([2, 1, 3], [2, 3, 1]) @@ -257,7 +254,7 @@ def bracket(self, lhs, rhs): EXAMPLES:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: L = LieAlgebras(QQ).example() sage: x, y = L.lie_algebra_generators() sage: L.bracket(x, x + y) @@ -302,14 +299,14 @@ def universal_enveloping_algebra(self): EXAMPLES:: sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() # needs sage.modules - sage: L.universal_enveloping_algebra() # needs sage.combinat sage.modules + sage: L.universal_enveloping_algebra() # needs sage.combinat sage.libs.singular sage.modules Noncommutative Multivariate Polynomial Ring in b0, b1, b2 over Rational Field, nc-relations: {} :: sage: L = LieAlgebra(QQ, 3, 'x', abelian=True) # needs sage.combinat sage.modules - sage: L.universal_enveloping_algebra() # needs sage.combinat sage.modules + sage: L.universal_enveloping_algebra() # needs sage.combinat sage.libs.singular sage.modules Multivariate Polynomial Ring in x0, x1, x2 over Rational Field .. SEEALSO:: @@ -335,14 +332,14 @@ def _construct_UEA(self): EXAMPLES:: sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() # needs sage.modules - sage: L._construct_UEA() # needs sage.combinat sage.modules + sage: L._construct_UEA() # needs sage.combinat sage.libs.singular sage.modules Noncommutative Multivariate Polynomial Ring in b0, b1, b2 over Rational Field, nc-relations: {} :: sage: L = LieAlgebra(QQ, 3, 'x', abelian=True) # needs sage.combinat sage.modules - sage: L.universal_enveloping_algebra() # indirect doctest # needs sage.combinat sage.modules + sage: L.universal_enveloping_algebra() # indirect doctest # needs sage.combinat sage.libs.singular sage.modules Multivariate Polynomial Ring in x0, x1, x2 over Rational Field """ @@ -453,7 +450,7 @@ def lift(self): EXAMPLES:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.libs.singular sage.modules sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() sage: a, b, c = L.lie_algebra_generators() sage: lifted = L.lift(2*a + b - c); lifted @@ -482,9 +479,10 @@ def subalgebra(self, gens, names=None, index_set=None, category=None): :: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: x,y = L.lie_algebra_generators() # needs sage.combinat sage.modules - sage: L.subalgebra([x + y]) # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules + sage: L = LieAlgebras(QQ).example() + sage: x,y = L.lie_algebra_generators() + sage: L.subalgebra([x + y]) Traceback (most recent call last): ... NotImplementedError: subalgebras not yet implemented: see #17416 @@ -510,9 +508,10 @@ def ideal(self, *gens, **kwds): :: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: x, y = L.lie_algebra_generators() # needs sage.combinat sage.modules - sage: L.ideal([x + y]) # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules + sage: L = LieAlgebras(QQ).example() + sage: x, y = L.lie_algebra_generators() + sage: L.ideal([x + y]) Traceback (most recent call last): ... NotImplementedError: ideals not yet implemented: see #16824 @@ -532,8 +531,8 @@ def is_ideal(self, A): EXAMPLES:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: L.is_ideal(L) # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: L.is_ideal(L) # needs sage.combinat sage.groups sage.modules True """ if A == self: @@ -565,8 +564,8 @@ def is_abelian(self): EXAMPLES:: sage: # needs sage.combinat sage.modules - sage: L = LieAlgebras(QQ).example() - sage: L.is_abelian() + sage: L = LieAlgebras(QQ).example() # needs sage.groups + sage: L.is_abelian() # needs sage.groups False sage: R = QQ['x,y'] sage: L = LieAlgebras(QQ).example(R.gens()) @@ -596,14 +595,14 @@ def is_commutative(self): EXAMPLES:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: L.is_commutative() # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: L.is_commutative() # needs sage.combinat sage.groups sage.modules False :: sage: L. = LieAlgebra(QQ, 1) # not implemented # needs sage.combinat sage.modules - sage: L.is_commutative() # not implemented # needs sage.combinat sage.modules + sage: L.is_commutative() # not implemented # needs sage.combinat sage.modules True """ return self.is_abelian() @@ -788,15 +787,15 @@ def _test_jacobi_identity(self, **options): By default, this method runs the tests only on the elements returned by ``self.some_elements()``:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: L._test_jacobi_identity() # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: L._test_jacobi_identity() # needs sage.combinat sage.groups sage.modules However, the elements tested can be customized with the ``elements`` keyword argument:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: x,y = L.lie_algebra_generators() # needs sage.combinat sage.modules - sage: L._test_jacobi_identity(elements=[x + y, x, 2*y, x.bracket(y)]) # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: x,y = L.lie_algebra_generators() # needs sage.combinat sage.groups sage.modules + sage: L._test_jacobi_identity(elements=[x + y, x, 2*y, x.bracket(y)]) # needs sage.combinat sage.groups sage.modules See the documentation for :class:`TestSuite` for more information. """ @@ -827,15 +826,15 @@ def _test_antisymmetry(self, **options): By default, this method runs the tests only on the elements returned by ``self.some_elements()``:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: L._test_antisymmetry() # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: L._test_antisymmetry() # needs sage.combinat sage.groups sage.modules However, the elements tested can be customized with the ``elements`` keyword argument:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: x,y = L.lie_algebra_generators() # needs sage.combinat sage.modules - sage: L._test_antisymmetry(elements=[x + y, x, 2*y, x.bracket(y)]) # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: x,y = L.lie_algebra_generators() # needs sage.combinat sage.groups sage.modules + sage: L._test_antisymmetry(elements=[x + y, x, 2*y, x.bracket(y)]) # needs sage.combinat sage.groups sage.modules See the documentation for :class:`TestSuite` for more information. """ @@ -856,18 +855,18 @@ def _test_distributivity(self, **options): TESTS:: - sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.modules - sage: L._test_distributivity() # needs sage.combinat sage.modules + sage: L = LieAlgebras(QQ).example() # needs sage.combinat sage.groups sage.modules + sage: L._test_distributivity() # needs sage.combinat sage.groups sage.modules EXAMPLES: By default, this method runs the tests only on the elements returned by ``self.some_elements()``:: - sage: L = LieAlgebra(QQ, 3, 'x,y,z', representation="polynomial") # needs sage.combinat sage.modules - sage: L.some_elements() # needs sage.combinat sage.modules + sage: L = LieAlgebra(QQ, 3, 'x,y,z', representation="polynomial") # needs sage.combinat sage.modules + sage: L.some_elements() # needs sage.combinat sage.modules [x + y + z] - sage: L._test_distributivity() # needs sage.combinat sage.modules + sage: L._test_distributivity() # needs sage.combinat sage.modules However, the elements tested can be customized with the ``elements`` keyword argument:: @@ -900,7 +899,7 @@ def bracket(self, rhs): EXAMPLES:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: L = LieAlgebras(QQ).example() sage: x,y = L.lie_algebra_generators() sage: x.bracket(y) @@ -920,7 +919,7 @@ def _bracket_(self, y): EXAMPLES:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: L = LieAlgebras(QQ).example() sage: x,y = L.lie_algebra_generators() sage: x._bracket_(y) @@ -958,7 +957,7 @@ def lift(self): EXAMPLES:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.libs.singularsage.modules sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() sage: a, b, c = L.lie_algebra_generators() sage: elt = 3*a + b - c @@ -997,16 +996,16 @@ def exp(self, lie_group=None): EXAMPLES:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.modules sage.symbolic sage: L. = LieAlgebra(QQ, 2, step=2) - sage: g = (X + Y + Z).exp(); g # needs sage.symbolic + sage: g = (X + Y + Z).exp(); g exp(X + Y + Z) - sage: h = X.exp(); h # needs sage.symbolic + sage: h = X.exp(); h exp(X) - sage: g.parent() # needs sage.symbolic + sage: g.parent() Lie group G of Free Nilpotent Lie algebra on 3 generators (X, Y, Z) over Rational Field - sage: g.parent() is h.parent() # needs sage.symbolic + sage: g.parent() is h.parent() True The Lie group can be specified explicitly:: @@ -1037,12 +1036,12 @@ def __init__(self, domain, codomain): EXAMPLES:: sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() # needs sage.modules - sage: f = L.lift # needs sage.combinat sage.modules + sage: f = L.lift # needs sage.combinat sage.libs.singular sage.modules We skip the category test since this is currently not an element of a homspace:: - sage: TestSuite(f).run(skip="_test_category") # needs sage.combinat sage.modules + sage: TestSuite(f).run(skip="_test_category") # needs sage.combinat sage.libs.singular sage.modules """ Morphism.__init__(self, Hom(domain, codomain)) @@ -1054,7 +1053,7 @@ def _call_(self, x): sage: L = LieAlgebras(QQ).FiniteDimensional().WithBasis().example() # needs sage.modules sage: a, b, c = L.lie_algebra_generators() # needs sage.modules - sage: L.lift(3*a + b - c) # needs sage.combinat sage.modules + sage: L.lift(3*a + b - c) # needs sage.combinat sage.libs.singular sage.modules 3*b0 + b1 - b2 """ return x.lift() diff --git a/src/sage/categories/lie_algebras_with_basis.py b/src/sage/categories/lie_algebras_with_basis.py index 67570b611b3..255c47347ef 100644 --- a/src/sage/categories/lie_algebras_with_basis.py +++ b/src/sage/categories/lie_algebras_with_basis.py @@ -225,7 +225,7 @@ def lift(self): EXAMPLES:: - sage: # needs sage.groups + sage: # needs sage.combinat sage.groups sage: S = SymmetricGroup(3).algebra(QQ) sage: L = LieAlgebra(associative=S) sage: x = L.gen(3) diff --git a/src/sage/categories/magmas.py b/src/sage/categories/magmas.py index 247603d3d31..1dbe4fbee89 100644 --- a/src/sage/categories/magmas.py +++ b/src/sage/categories/magmas.py @@ -383,11 +383,11 @@ def is_field(self, proof=True): EXAMPLES:: - sage: SymmetricGroup(1).algebra(QQ).is_field() # needs sage.groups + sage: SymmetricGroup(1).algebra(QQ).is_field() # needs sage.combinat sage.groups True - sage: SymmetricGroup(1).algebra(ZZ).is_field() # needs sage.groups + sage: SymmetricGroup(1).algebra(ZZ).is_field() # needs sage.combinat sage.groups False - sage: SymmetricGroup(2).algebra(QQ).is_field() # needs sage.groups + sage: SymmetricGroup(2).algebra(QQ).is_field() # needs sage.combinat sage.groups False """ if not self.base_ring().is_field(proof): @@ -1141,9 +1141,9 @@ def product(self, x, y): Here is a more elaborate example involving a sub algebra:: - sage: Z = SymmetricGroup(5).algebra(QQ).center() # needs sage.groups - sage: B = Z.basis() # needs sage.groups - sage: B[3] * B[2] # needs sage.groups + sage: Z = SymmetricGroup(5).algebra(QQ).center() # needs sage.combinat sage.groups + sage: B = Z.basis() # needs sage.combinat sage.groups + sage: B[3] * B[2] # needs sage.combinat sage.groups 4*B[2] + 6*B[3] + 5*B[6] """ assert x in self diff --git a/src/sage/categories/magmatic_algebras.py b/src/sage/categories/magmatic_algebras.py index 763f5aab764..a8e8dcf24df 100644 --- a/src/sage/categories/magmatic_algebras.py +++ b/src/sage/categories/magmatic_algebras.py @@ -136,8 +136,8 @@ def algebra_generators(self): EXAMPLES:: - sage: D4 = DescentAlgebra(QQ, 4).B() # needs sage.combinat sage.modules - sage: D4.algebra_generators() # needs sage.combinat sage.modules + sage: D4 = DescentAlgebra(QQ, 4).B() # needs sage.combinat sage.groups sage.modules + sage: D4.algebra_generators() # needs sage.combinat sage.groups sage.modules Lazy family (...)_{i in Compositions of 4} sage: R. = ZZ[] diff --git a/src/sage/categories/modules.py b/src/sage/categories/modules.py index 952ca09fbde..b4025019173 100644 --- a/src/sage/categories/modules.py +++ b/src/sage/categories/modules.py @@ -222,7 +222,7 @@ def base_ring(self): sage: C2.base_ring.__module__ 'sage.categories.modules' - sage: # needs sage.combinat sage.modules + sage: # needs sage.combinat sage.groups sage.modules sage: C3 = DescentAlgebra(QQ,3).B().category() sage: C3.base_ring.__module__ 'sage.categories.modules' @@ -998,7 +998,9 @@ def tensor_factors(self): TESTS:: sage: Cat = ModulesWithBasis(ZZ).FiniteDimensional().TensorProducts() - sage: M = CombinatorialFreeModule(ZZ, ((1, 1), (1, 2), (2, 1), (2, 2)), category=Cat) # needs sage.modules + sage: M = CombinatorialFreeModule(ZZ, # needs sage.modules + ....: ((1, 1), (1, 2), (2, 1), (2, 2)), + ....: category=Cat) sage: M.construction() # needs sage.modules doctest:warning... DeprecationWarning: implementations of Modules().TensorProducts() now must define the method tensor_factors diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index a93925e5a6f..5a209d77039 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -167,7 +167,7 @@ def _call_(self, x): If ``x`` itself is not a module with basis, but there is a canonical one associated to it, the latter is returned:: - sage: CQ(AbelianVariety(Gamma0(37))) # indirect doctest # needs sage.modular sage.modules + sage: CQ(AbelianVariety(Gamma0(37))) # indirect doctest # needs sage.libs.flint sage.modular sage.modules Vector space of dimension 4 over Rational Field """ try: diff --git a/src/sage/categories/monoids.py b/src/sage/categories/monoids.py index 7d763bb59b7..e23fb9ebabe 100644 --- a/src/sage/categories/monoids.py +++ b/src/sage/categories/monoids.py @@ -635,7 +635,7 @@ def monoid_generators(self): EXAMPLES:: - sage: # needs sage.groups + sage: # needs sage.combinat sage.groups sage: M = Monoids.free([1, 2, 3]) sage: N = Monoids.free(['a', 'b']) sage: C = cartesian_product([M, N]) diff --git a/src/sage/categories/primer.py b/src/sage/categories/primer.py index aa47130b205..b919018dba4 100644 --- a/src/sage/categories/primer.py +++ b/src/sage/categories/primer.py @@ -78,7 +78,7 @@ sage: Permutations(5).cardinality() 120 - sage: GL(2,2).cardinality() # needs sage.modules + sage: GL(2,2).cardinality() # needs sage.libs.gap sage.modules 6 sage: A = random_matrix(ZZ, 6, 3, x=7) # needs sage.modules @@ -192,7 +192,7 @@ Those can be viewed graphically:: sage: g = Groups().category_graph() # needs sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.modules + sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.modules sage.plot sage: view(g) # not tested # needs sage.graphs sage.modules sage.plot In case ``dot2tex`` is not available, you can use instead:: @@ -201,8 +201,8 @@ Here is an overview of all categories in Sage:: - sage: g = sage.categories.category.category_graph() # needs sage.graphs sage.modules - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.modules + sage: g = sage.categories.category.category_graph() # needs sage.graphs sage.groups sage.modules + sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.modules sage.plot sage: view(g) # not tested # needs sage.graphs sage.modules sage.plot Wrap-up: generic algorithms in Sage are organized in a hierarchy of @@ -497,7 +497,7 @@ class implements: The full hierarchy is best viewed graphically:: sage: g = class_graph(m.__class__) # needs sage.combinat sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.combinat sage.graphs + sage: g.set_latex_options(format="dot2tex") # needs sage.combinat sage.graphs sage.plot sage: view(g) # not tested # needs sage.combinat sage.graphs sage.plot Parallel hierarchy of classes for parents @@ -550,11 +550,11 @@ class implements: categories and parallel to that we had seen for the elements. This is best viewed graphically:: - sage: # needs sage.graphs sage.modules + sage: # needs sage.combinat sage.graphs sage.modules sage.plot sage: g = class_graph(m.__class__) sage: g.relabel(lambda x: x.replace("_",r"\_")) sage: g.set_latex_options(format="dot2tex") - sage: view(g) # not tested # needs sage.plot + sage: view(g) # not tested .. NOTE:: @@ -1028,17 +1028,17 @@ class SubcategoryMethods: example, permutation groups are by default in the category of finite permutation groups (no surprise):: - sage: P = PermutationGroup([[(1,2,3)]]); P # needs sage.combinat sage.groups + sage: P = PermutationGroup([[(1,2,3)]]); P # needs sage.groups Permutation Group with generators [(1,2,3)] - sage: P.category() # needs sage.combinat + sage: P.category() # needs sage.groups Category of finite enumerated permutation groups In this case, the group is commutative, so we can specify this:: - sage: P = PermutationGroup([[(1,2,3)]], # needs sage.combinat sage.groups + sage: P = PermutationGroup([[(1,2,3)]], # needs sage.groups ....: category=PermutationGroups().Finite().Commutative()); P Permutation Group with generators [(1,2,3)] - sage: P.category() # needs sage.combinat + sage: P.category() # needs sage.groups Category of finite enumerated commutative permutation groups This feature can even be used, typically in experimental code, to add @@ -1053,8 +1053,8 @@ class SubcategoryMethods: ....: class ElementMethods: ....: def bar(self): print("bar") - sage: # needs sage.combinat - sage: P = PermutationGroup([[(1,2,3)]], category=Foos()) # needs sage.groups + sage: # needs sage.groups + sage: P = PermutationGroup([[(1,2,3)]], category=Foos()) sage: P.foo() foo sage: p = P.an_element() @@ -1065,7 +1065,7 @@ class SubcategoryMethods: forgetful functors; for example the above group could be constructed as a plain set with:: - sage: P = PermutationGroup([[(1,2,3)]], category=Sets()) # not implemented, needs sage.combinat + sage: P = PermutationGroup([[(1,2,3)]], category=Sets()) # not implemented, needs sage.groups At this stage though, this is still to be explored for robustness and practicality. For now, most parents that accept a category argument @@ -1114,8 +1114,8 @@ class SubcategoryMethods: Cartesian product `A \times B \times B`:: sage: A = AlgebrasWithBasis(QQ).example(); A.rename("A") # needs sage.combinat sage.modules - sage: B = HopfAlgebrasWithBasis(QQ).example(); B.rename("B") # needs sage.combinat sage.modules - sage: C = cartesian_product([A, B, B]); C # needs sage.combinat sage.modules + sage: B = HopfAlgebrasWithBasis(QQ).example(); B.rename("B") # needs sage.groups sage.modules + sage: C = cartesian_product([A, B, B]); C # needs sage.combinat sage.groups sage.modules A (+) B (+) B In which category should this new parent be? Since `A` and `B` are @@ -1124,14 +1124,14 @@ class SubcategoryMethods: are monoids, `A \times B \times B` is naturally endowed with a monoid structure for pointwise multiplication:: - sage: C in Monoids() # needs sage.combinat sage.modules + sage: C in Monoids() # needs sage.combinat sage.groups sage.modules True the unit being the Cartesian product of the units of the operands:: - sage: C.one() # needs sage.combinat sage.modules + sage: C.one() # needs sage.combinat sage.groups sage.modules B[(0, word: )] + B[(1, ())] + B[(2, ())] - sage: cartesian_product([A.one(), B.one(), B.one()]) # needs sage.combinat sage.modules + sage: cartesian_product([A.one(), B.one(), B.one()]) # needs sage.combinat sage.groups sage.modules B[(0, word: )] + B[(1, ())] + B[(2, ())] The pointwise product can be implemented generically for all magmas @@ -1139,7 +1139,7 @@ class SubcategoryMethods: constructed as Cartesian products. It's thus implemented in the :class:`Magmas` category:: - sage: C.product.__module__ # needs sage.combinat sage.modules + sage: C.product.__module__ # needs sage.combinat sage.groups sage.modules 'sage.categories.magmas' More specifically, keeping on using nested classes to structure the @@ -1171,7 +1171,7 @@ class naming and introspection. Sage currently works around the Let us now look at the categories of ``C``:: - sage: C.categories() # needs sage.combinat sage.modules + sage: C.categories() # needs sage.combinat sage.groups sage.modules [Category of finite dimensional Cartesian products of algebras with basis over Rational Field, ... Category of Cartesian products of algebras over Rational Field, ... Category of Cartesian products of semigroups, Category of semigroups, ... @@ -1404,7 +1404,7 @@ class naming and introspection. Sage currently works around the or for more advanced categories:: sage: g = HopfAlgebras(QQ).WithBasis().Graded().Connected().category_graph() # needs sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs + sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.plot sage: view(g) # not tested # needs sage.graphs sage.plot Difference between axioms and regressive covariant functorial constructions diff --git a/src/sage/categories/regular_crystals.py b/src/sage/categories/regular_crystals.py index 5a0ac6291b5..46c148061a3 100644 --- a/src/sage/categories/regular_crystals.py +++ b/src/sage/categories/regular_crystals.py @@ -185,16 +185,17 @@ def demazure_operator(self, element, reduced_word): EXAMPLES:: sage: T = crystals.Tableaux(['A',2], shape=[2,1]) - sage: C = CombinatorialFreeModule(QQ, T) + sage: C = CombinatorialFreeModule(QQ, T) # needs sage.modules sage: t = T.highest_weight_vector() - sage: b = 2*C(t) - sage: T.demazure_operator(b,[1,2,1]) + sage: b = 2*C(t) # needs sage.modules + sage: T.demazure_operator(b,[1,2,1]) # needs sage.modules 2*B[[[1, 1], [2]]] + 2*B[[[1, 2], [2]]] + 2*B[[[1, 3], [2]]] + 2*B[[[1, 1], [3]]] + 2*B[[[1, 2], [3]]] + 2*B[[[1, 3], [3]]] + 2*B[[[2, 2], [3]]] + 2*B[[[2, 3], [3]]] The Demazure operator is idempotent:: + sage: # needs sage.modules sage: T = crystals.Tableaux("A1", shape=[4]) sage: C = CombinatorialFreeModule(QQ, T) sage: b = C(T.module_generators[0]); b @@ -204,7 +205,6 @@ def demazure_operator(self, element, reduced_word): + B[[[1, 2, 2, 2]]] + B[[[2, 2, 2, 2]]] sage: e == T.demazure_operator(e,[1]) True - sage: all(T.demazure_operator(T.demazure_operator(C(t),[1]),[1]) ....: == T.demazure_operator(C(t),[1]) for t in T) True diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index 02e81ff1f63..e0900b59abe 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -1110,7 +1110,7 @@ def __getitem__(self, arg): sage: k. = GF(5^3) # needs sage.rings.finite_rings sage: Frob = k.frobenius_endomorphism() # needs sage.rings.finite_rings - sage: k['x', Frob] # needs sage.rings.finite_rings + sage: k['x', Frob] # needs sage.modules sage.rings.finite_rings Ore Polynomial Ring in x over Finite Field in t of size 5^3 twisted by t |--> t^5 diff --git a/src/sage/categories/semigroups.py b/src/sage/categories/semigroups.py index 7c894a03112..1cafffccfeb 100644 --- a/src/sage/categories/semigroups.py +++ b/src/sage/categories/semigroups.py @@ -423,7 +423,7 @@ def subsemigroup(self, generators, one=None, category=None): ValueError: For a monoid which is just a subsemigroup, the unit should be specified - sage: # needs sage.groups + sage: # needs sage.combinat sage.groups sage: M = R.subsemigroup([R(5)], one=R(10), ....: category=Semigroups().Finite().Subobjects() & Groups()); M A subsemigroup of (Ring of integers modulo 15) with 1 generators @@ -912,12 +912,12 @@ def gens(self) -> tuple: EXAMPLES:: - sage: a, b = SL2Z.algebra(ZZ).gens(); a, b # needs sage.groups sage.modules + sage: a, b = SL2Z.algebra(ZZ).gens(); a, b # needs sage.groups sage.modular sage.modules ([ 0 -1] [ 1 0], [1 1] [0 1]) - sage: 2*a + b # needs sage.groups sage.modules + sage: 2*a + b # needs sage.groups sage.modular sage.modules 2*[ 0 -1] [ 1 0] + @@ -932,7 +932,7 @@ def ngens(self): EXAMPLES:: - sage: SL2Z.algebra(ZZ).ngens() # needs sage.groups sage.modules + sage: SL2Z.algebra(ZZ).ngens() # needs sage.groups sage.modular sage.modules 2 sage: DihedralGroup(4).algebra(RR).ngens() # needs sage.groups sage.modules 2 diff --git a/src/sage/categories/semisimple_algebras.py b/src/sage/categories/semisimple_algebras.py index 453b854b7e7..bac894e5b0a 100644 --- a/src/sage/categories/semisimple_algebras.py +++ b/src/sage/categories/semisimple_algebras.py @@ -97,13 +97,13 @@ def radical_basis(self, **keywords): EXAMPLES:: - sage: A = SymmetricGroup(4).algebra(QQ) # needs sage.groups - sage: A.radical_basis() # needs sage.groups + sage: A = SymmetricGroup(4).algebra(QQ) # needs sage.combinat sage.groups + sage: A.radical_basis() # needs sage.combinat sage.groups () TESTS:: - sage: A.radical_basis.__module__ # needs sage.groups + sage: A.radical_basis.__module__ # needs sage.combinat sage.groups 'sage.categories.finite_dimensional_semisimple_algebras_with_basis' """ return () diff --git a/src/sage/categories/sets_cat.py b/src/sage/categories/sets_cat.py index 0a523f00903..959d5def524 100644 --- a/src/sage/categories/sets_cat.py +++ b/src/sage/categories/sets_cat.py @@ -977,10 +977,10 @@ def _element_constructor_(self): - sage: B = SymmetricGroup(3).algebra(ZZ) # needs sage.groups sage.modules - sage: B.element_class # needs sage.groups sage.modules + sage: B = SymmetricGroup(3).algebra(ZZ) # needs sage.combinat sage.groups sage.modules + sage: B.element_class # needs sage.combinat sage.groups sage.modules <...SymmetricGroupAlgebra_n_with_category.element_class'> - sage: B._element_constructor_ # needs sage.groups sage.modules + sage: B._element_constructor_ # needs sage.combinat sage.groups sage.modules """ @@ -2676,7 +2676,7 @@ def construction(self): This also works for structures such as monoid algebras (see :issue:`27937`):: - sage: A = FreeAbelianMonoid('x,y').algebra(QQ) # needs sage.groups sage.modules + sage: A = FreeAbelianMonoid('x,y').algebra(QQ) # needs sage.combinat sage.modules sage: F, arg = A.construction(); F, arg # needs sage.groups sage.modules (The algebra functorial construction, Free abelian monoid on 2 generators (x, y)) @@ -2872,7 +2872,7 @@ def inject_shorthands(self, shorthands=None, verbose=True): request for all shorthands to be defined, including less common ones:: - sage: S.inject_shorthands("all") # needs sage.combinat sage.modules + sage: S.inject_shorthands("all") # needs lrcalc_python sage.combinat sage.modules Defining e as shorthand for Symmetric Functions over Integer Ring in the elementary basis Defining f as shorthand for @@ -3040,9 +3040,9 @@ def _an_element_(self): Check that we are consistent no matter which basis is created first:: - sage: M = posets.BooleanLattice(4).moebius_algebra(QQ) # needs sage.combinat sage.graphs sage.modules - sage: I = M.I() # needs sage.combinat sage.graphs sage.modules - sage: M._an_element_() # needs sage.combinat sage.graphs sage.modules + sage: M = posets.BooleanLattice(4).moebius_algebra(QQ) # needs sage.graphs sage.modules + sage: I = M.I() # needs sage.graphs sage.modules + sage: M._an_element_() # needs sage.graphs sage.modules 2*E[0] + 2*E[1] + 3*E[2] """ return self.a_realization().an_element() diff --git a/src/sage/categories/unital_algebras.py b/src/sage/categories/unital_algebras.py index 0f4fa24600d..1ebfcbc4072 100644 --- a/src/sage/categories/unital_algebras.py +++ b/src/sage/categories/unital_algebras.py @@ -409,6 +409,7 @@ def one(self): EXAMPLES:: + sage: # needs sage.graphs sage.modules sage: S2 = simplicial_complexes.Sphere(2) sage: H = S2.cohomology_ring(QQ) sage: C = cartesian_product([H, H]) diff --git a/src/sage/categories/with_realizations.py b/src/sage/categories/with_realizations.py index eaabcdaf04a..43b77195672 100644 --- a/src/sage/categories/with_realizations.py +++ b/src/sage/categories/with_realizations.py @@ -90,7 +90,7 @@ def WithRealizations(self): to `B'` is implemented by a canonical coercion between `P_B` and `P_{B'}`:: - sage: # needs sage.combinat sage.modules + sage: # needs sage.modules sage: F = A.F(); In = A.In(); Out = A.Out() sage: i = In.an_element(); i In[{}] + 2*In[{1}] + 3*In[{2}] + In[{1, 2}] @@ -103,7 +103,7 @@ def WithRealizations(self): allowing for mixed arithmetic:: - sage: (1 + Out.from_set(1)) * In.from_set(2,3) # needs sage.combinat sage.modules + sage: (1 + Out.from_set(1)) * In.from_set(2,3) # needs sage.modules Out[{}] + 2*Out[{1}] + 2*Out[{2}] + 2*Out[{3}] + 2*Out[{1, 2}] + 2*Out[{1, 3}] + 4*Out[{2, 3}] + 4*Out[{1, 2, 3}] @@ -117,7 +117,7 @@ def WithRealizations(self): Instead of manually defining the shorthands ``F``, ``In``, and ``Out``, as above one can just do:: - sage: A.inject_shorthands() # needs sage.combinat sage.modules + sage: A.inject_shorthands() # needs sage.modules Defining F as shorthand for The subset algebra of {1, 2, 3} over Rational Field in the Fundamental basis Defining In as shorthand for @@ -159,9 +159,9 @@ def WithRealizations(self): However we can create a polynomial with mixed coefficients, and compute with it:: - sage: p = P([1, In[{1}], Out[{2}] ]); p # needs sage.combinat sage.modules + sage: p = P([1, In[{1}], Out[{2}] ]); p # needs sage.modules Out[{2}]*x^2 + In[{1}]*x + F[{}] - sage: p^2 # needs sage.combinat sage.modules + sage: p^2 # needs sage.modules Out[{2}]*x^4 + (-8*In[{}] + 4*In[{1}] + 8*In[{2}] + 4*In[{3}] - 4*In[{1, 2}] - 2*In[{1, 3}] - 4*In[{2, 3}] + 2*In[{1, 2, 3}])*x^3 @@ -176,7 +176,7 @@ def WithRealizations(self): One can easily coerce all coefficient to a given basis with:: - sage: p.map_coefficients(In) # needs sage.combinat sage.modules + sage: p.map_coefficients(In) # needs sage.modules (-4*In[{}] + 2*In[{1}] + 4*In[{2}] + 2*In[{3}] - 2*In[{1, 2}] - In[{1, 3}] - 2*In[{2, 3}] + In[{1, 2, 3}])*x^2 + In[{1}]*x + In[{}] @@ -184,7 +184,7 @@ def WithRealizations(self): Alas, the natural notation for constructing such polynomials does not yet work:: - sage: In[{1}] * x # needs sage.combinat sage.modules + sage: In[{1}] * x # needs sage.modules Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for *: @@ -302,7 +302,7 @@ def _repr_(self): EXAMPLES:: - sage: C = GradedHopfAlgebrasWithBasis(QQ).WithRealizations(); C #indirect doctest + sage: C = GradedHopfAlgebrasWithBasis(QQ).WithRealizations(); C # indirect doctest Category of graded Hopf algebras with basis over Rational Field with realizations """ s = repr(self.base_category())