Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/categories/finite_crystals.py
4079 views
1
r"""
2
Finite Crystals
3
"""
4
#*****************************************************************************
5
# Copyright (C) 2010 Anne Schilling <anne at math.ucdavis.edu>
6
#
7
# Distributed under the terms of the GNU General Public License (GPL)
8
# http://www.gnu.org/licenses/
9
#******************************************************************************
10
11
from sage.misc.cachefunc import cached_method
12
from sage.categories.category import Category
13
from sage.categories.crystals import Crystals
14
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
15
16
class FiniteCrystals(Category):
17
"""
18
The category of finite crystals.
19
20
EXAMPLES::
21
22
sage: C = FiniteCrystals()
23
sage: C
24
Category of finite crystals
25
sage: C.super_categories()
26
[Category of crystals, Category of finite enumerated sets]
27
sage: C.example()
28
Highest weight crystal of type A_3 of highest weight omega_1
29
30
TESTS::
31
32
sage: TestSuite(C).run()
33
sage: B = FiniteCrystals().example()
34
sage: TestSuite(B).run(verbose = True)
35
running ._test_an_element() . . . pass
36
running ._test_category() . . . pass
37
running ._test_elements() . . .
38
Running the test suite of self.an_element()
39
running ._test_category() . . . pass
40
running ._test_eq() . . . pass
41
running ._test_not_implemented_methods() . . . pass
42
running ._test_pickling() . . . pass
43
running ._test_stembridge_local_axioms() . . . pass
44
pass
45
running ._test_elements_eq() . . . pass
46
running ._test_enumerated_set_contains() . . . pass
47
running ._test_enumerated_set_iter_cardinality() . . . pass
48
running ._test_enumerated_set_iter_list() . . . pass
49
running ._test_eq() . . . pass
50
running ._test_fast_iter() . . . pass
51
running ._test_not_implemented_methods() . . . pass
52
running ._test_pickling() . . . pass
53
running ._test_some_elements() . . . pass
54
running ._test_stembridge_local_axioms() . . . pass
55
"""
56
57
@cached_method
58
def super_categories(self):
59
r"""
60
EXAMPLES::
61
62
sage: FiniteCrystals().super_categories()
63
[Category of crystals, Category of finite enumerated sets]
64
"""
65
return [Crystals(), FiniteEnumeratedSets()]
66
67
def example(self, n = 3):
68
"""
69
Returns an example of highest weight crystals, as per
70
:meth:`Category.example`.
71
72
EXAMPLES::
73
74
sage: B = FiniteCrystals().example(); B
75
Highest weight crystal of type A_3 of highest weight omega_1
76
"""
77
from sage.categories.crystals import Crystals
78
return Crystals().example(n)
79
80
81
class ParentMethods:
82
83
def _test_stembridge_local_axioms(self, index_set=None, verbose=False, complete=False, **options):
84
r"""
85
This implements tests for the Stembridge local characterization on the finite crystal ``self``.
86
The current implementation only uses the rules for simply-laced types. Crystals
87
of other types should still pass the test, but expansion of this test to
88
non-simply laced type would be desirable.
89
90
One can specify an index set smaller than the full index set of the crystal,
91
using the option ``index_set``.
92
93
Running with ``verbose=True`` will print each node for which a local axiom
94
test applies.
95
96
Running with ``complete=True`` will continue to run the test past the first
97
failure of the local axioms. This is probably only useful in conjunction
98
with the verbose option, to see all places where the local axioms fail.
99
100
EXAMPLES::
101
102
sage: T = CrystalOfTableaux(['A',3], shape=[2,1])
103
sage: T._test_stembridge_local_axioms()
104
True
105
sage: T._test_stembridge_local_axioms(verbose=True)
106
True
107
sage: T._test_stembridge_local_axioms(index_set=[1,3])
108
True
109
110
sage: B=Crystals().example(choice='naive')
111
sage: B._test_stembridge_local_axioms()
112
Traceback (most recent call last):
113
...
114
AssertionError: None
115
"""
116
tester = self._tester(**options)
117
goodness=True
118
119
for x in self:
120
goodness=x._test_stembridge_local_axioms(index_set, verbose)
121
if goodness==False and not complete:
122
tester.fail()
123
tester.assertTrue(goodness)
124
return goodness
125
126
127
def list(self):
128
"""
129
Returns a list of the elements of ``self`` obtained by
130
repeatedly applying the `f_i` operators to the module
131
generators of ``self``.
132
133
EXAMPLES::
134
135
sage: C = FiniteCrystals().example(5)
136
sage: l = C._list_brute_force()
137
sage: l.sort(); l
138
[1, 2, 3, 4, 5, 6]
139
"""
140
# Should use transitiveIdeal
141
# should be transformed to __iter__ instead of list
142
# To be moved in a super category CombinatorialModule
143
result = set(self.module_generators)
144
todo = result.copy()
145
while len(todo) > 0:
146
x = todo.pop()
147
for i in self.index_set():
148
y = x.f(i)
149
if y == None or y in result:
150
continue
151
todo.add(y)
152
result.add(y)
153
return list(result)
154
155
_list_brute_force = list
156
157
158