Beispiel #1
0
    def __init__(self, cartan_type, shapes):
        """
        Construct the crystal of all tableaux of the given shapes.

        INPUT:

        - ``cartan_type`` -- (data coercible into) a Cartan type
        - ``shapes``      -- a list (or iterable) of shapes
        - ``shape``       -- a shape

        Shapes themselves are lists (or iterable) of integers.

        EXAMPLES::

            sage: T = crystals.Tableaux(['A',3], shape = [2,2])
            sage: TestSuite(T).run()
        """
        #        super(CrystalOfTableaux, self).__init__(category = FiniteEnumeratedSets())
        Parent.__init__(self, category=ClassicalCrystals())
        self.letters = CrystalOfLetters(cartan_type)
        self.shapes = shapes
        self.module_generators = tuple(
            self.module_generator(la) for la in shapes)
        self.rename("The crystal of tableaux of type %s and shape(s) %s" %
                    (cartan_type, list(list(shape) for shape in shapes)))
Beispiel #2
0
    def __init__(self, ct, La):
        r"""
        EXAMPLES::

            sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights()
            sage: M = crystals.NakajimaMonomials(['A',2], La[1]+La[2])
            sage: TestSuite(M).run()

            sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights()
            sage: M = crystals.NakajimaMonomials(['C',2,1], La[0])
            sage: TestSuite(M).run(max_runs=100)
        """
        if ct.is_finite():
            cat = ClassicalCrystals()
        else:
            cat = (RegularCrystals(), HighestWeightCrystals(),
                   InfiniteEnumeratedSets())
        InfinityCrystalOfNakajimaMonomials.__init__(
            self, ct, cat, CrystalOfNakajimaMonomialsElement)
        self._cartan_type = ct
        self.hw = La
        gen = {}
        for j in range(len(La.support())):
            gen[(La.support()[j], 0)] = La.coefficients()[j]
        self.module_generators = (self.element_class(self, gen), )
Beispiel #3
0
    def __init__(self, ct, element_class, case):
        """
        EXAMPLES::

            sage: E = CrystalOfSpinsMinus(['D',4])
            sage: TestSuite(E).run()
        """
        self._cartan_type = CartanType(ct)
        if case == "spins":
            self.rename("The crystal of spins for type %s"%ct)
        elif case == "plus":
            self.rename("The plus crystal of spins for type %s"%ct)
        else:
            self.rename("The minus crystal of spins for type %s"%ct)

        self.Element = element_class
#        super(GenericCrystalOfSpins, self).__init__(category = FiniteEnumeratedSets())
        Parent.__init__(self, category = ClassicalCrystals())

        if case == "minus":
            generator = [1]*(ct[1]-1)
            generator.append(-1)
        else:
            generator = [1]*ct[1]
        self.module_generators = [self(generator)]
        self._list = list(self)
#        self._digraph = ClassicalCrystal.digraph(self)
        self._digraph = super(GenericCrystalOfSpins, self).digraph()
        self._digraph_closure = self.digraph().transitive_closure()
Beispiel #4
0
    def __init__(self, dominant_weight):
        """
        EXAMPLES::

            sage: C=CartanType(['E',6])
            sage: La=C.root_system().weight_lattice().fundamental_weights()
            sage: T = HighestWeightCrystal(2*La[2])
            sage: T.cartan_type()
            ['E', 6]
            sage: T.module_generators
            [[[[2, -1], [1]], [[2, -1], [1]]]]
            sage: T.cardinality()
            2430
            sage: T = HighestWeightCrystal(La[2])
            sage: T.cardinality()
            78
        """
        self._cartan_type = dominant_weight.parent().cartan_type()
        self._highest_weight = dominant_weight
        assert dominant_weight.is_dominant()
        self.rename(
            "Finite dimensional highest weight crystal of type %s and highest weight %s"
            % (self._cartan_type, dominant_weight))
        Parent.__init__(self, category=ClassicalCrystals())
        self.module_generators = [self.module_generator()]
Beispiel #5
0
    def __init__(self, wt, WLR):
        r"""
        Initialize ``self``.

        EXAMPLES::

            sage: La = RootSystem(['A', 2]).weight_lattice().fundamental_weights()
            sage: RC = crystals.RiggedConfigurations(La[1] + La[2])
            sage: TestSuite(RC).run()

            sage: La = RootSystem(['A', 2, 1]).weight_lattice().fundamental_weights()
            sage: RC = crystals.RiggedConfigurations(La[0])
            sage: TestSuite(RC).run() # long time
        """
        self._cartan_type = WLR.cartan_type()
        self._wt = wt
        self._rc_index = self._cartan_type.index_set()
        self._rc_index_inverse = {i: ii for ii, i in enumerate(self._rc_index)}
        # We store the Cartan matrix for the vacancy number calculations for speed
        self._cartan_matrix = self._cartan_type.cartan_matrix()
        if self._cartan_type.is_finite():
            category = ClassicalCrystals()
        else:
            category = (RegularCrystals(), HighestWeightCrystals(),
                        InfiniteEnumeratedSets())
        Parent.__init__(self, category=category)
        n = self._cartan_type.rank()  #== len(self._cartan_type.index_set())
        self.module_generators = (self.element_class(
            self, partition_list=[[] for i in range(n)]), )
Beispiel #6
0
    def __init__(self, w, n, x=None):
        r"""
        EXAMPLES::

            sage: B = crystals.AffineFactorization([[3,2],[2]],4,x=0,k=3)
            Traceback (most recent call last):
            ...
            ValueError: x cannot be in reduced word of s0*s3*s2

            sage: B = crystals.AffineFactorization([[3,2],[2]],4,k=3)
            sage: B.x
            1
            sage: B.w
            s0*s3*s2
            sage: B.k
            3
            sage: B.n
            4

        TESTS::

            sage: W = WeylGroup(['A',3,1], prefix='s')
            sage: w = W.from_reduced_word([2,3,2,1])
            sage: B = crystals.AffineFactorization(w,3)
            sage: TestSuite(B).run()
        """
        Parent.__init__(self, category=ClassicalCrystals())
        self.n = n
        self.k = w.parent().n - 1
        self.w = w
        cartan_type = CartanType(['A', n - 1])
        self._cartan_type = cartan_type
        from sage.combinat.sf.sf import SymmetricFunctions
        from sage.rings.rational_field import QQ
        Sym = SymmetricFunctions(QQ)
        s = Sym.schur()
        support = s(w.stanley_symmetric_function()).support()
        support = [[0] * (n - len(mu)) +
                   [mu[len(mu) - i - 1] for i in range(len(mu))]
                   for mu in support]
        generators = [
            tuple(p) for mu in support
            for p in affine_factorizations(w, n, mu)
        ]
        #generators = [tuple(p) for p in affine_factorizations(w, n)]
        self.module_generators = [self(t) for t in generators]
        if x is None:
            if generators:
                x = min(
                    set(range(self.k + 1)).difference(
                        set(sum([i.reduced_word() for i in generators[0]],
                                []))))
            else:
                x = 0
        if x in set(w.reduced_word()):
            raise ValueError("x cannot be in reduced word of {}".format(w))
        self.x = x
Beispiel #7
0
    def __init__(self, n=3):
        """
        EXAMPLES::

            sage: C = sage.categories.examples.crystals.HighestWeightCrystalOfTypeA(n=4)
            sage: C == Crystals().example(n=4)
            True
        """
        Parent.__init__(self, category=ClassicalCrystals())
        self.n = n
        self._cartan_type = CartanType(['A', n])
        self.module_generators = [self(1)]
Beispiel #8
0
    def __init__(self, starting_weight):
        """
        EXAMPLES::

            sage: C = crystals.LSPaths(['A',2,1],[-1,0,1]); C
            The crystal of LS paths of type ['A', 2, 1] and weight -Lambda[0] + Lambda[2]
            sage: C.R
            Root system of type ['A', 2, 1]
            sage: C.weight
            -Lambda[0] + Lambda[2]
            sage: C.weight.parent()
            Extended weight space over the Rational Field of the Root system of type ['A', 2, 1]
            sage: C.module_generators
            [(-Lambda[0] + Lambda[2],)]

        TESTS::

            sage: C = crystals.LSPaths(['A',2,1], [-1,0,1])
            sage: TestSuite(C).run() # long time
            sage: C = crystals.LSPaths(['E',6], [1,0,0,0,0,0])
            sage: TestSuite(C).run()
        """
        cartan_type = starting_weight.parent().cartan_type()
        self.R = RootSystem(cartan_type)
        self.weight = starting_weight
        if not self.weight.parent().base_ring().has_coerce_map_from(QQ):
            raise ValueError(
                "Please use the weight space, rather than weight lattice for your weights"
            )
        self._cartan_type = cartan_type
        self._name = "The crystal of LS paths of type %s and weight %s" % (
            cartan_type, starting_weight)
        if cartan_type.is_affine():
            if all(i >= 0 for i in starting_weight.coefficients()):
                Parent.__init__(self,
                                category=(RegularCrystals(),
                                          HighestWeightCrystals(),
                                          InfiniteEnumeratedSets()))
            elif starting_weight.parent().is_extended():
                Parent.__init__(self,
                                category=(RegularCrystals(),
                                          InfiniteEnumeratedSets()))
            else:
                Parent.__init__(self,
                                category=(RegularCrystals(), FiniteCrystals()))
        else:
            Parent.__init__(self, category=ClassicalCrystals())

        if starting_weight == starting_weight.parent().zero():
            initial_element = self(tuple([]))
        else:
            initial_element = self(tuple([starting_weight]))
        self.module_generators = [initial_element]
    def __init__(self, cartan_type):
        r"""
        Initialize ``self``.

        EXAMPLES::

            sage: B = crystals.elementary.Component("D4")
            sage: TestSuite(B).run()
        """
        Parent.__init__(self, category=ClassicalCrystals())
        self._cartan_type = cartan_type
        self.module_generators = (self.element_class(self), )
Beispiel #10
0
    def __init__(self):
        """
        EXAMPLES::

            sage: C = sage.categories.examples.crystals.NaiveCrystal()
            sage: C == Crystals().example(choice='naive')
            True
        """
        Parent.__init__(self, category = ClassicalCrystals())
        self.n = 2
        self._cartan_type = CartanType(['A',2])
        self.G = DiGraph(5)
        self.G.add_edges([ [0,1,1], [1,2,1], [2,3,1], [3,5,1],  [0,4,2], [4,5,2] ])
        self.module_generators = [ self(0) ]
Beispiel #11
0
    def __init__(self, w, factors, excess):
        """
        Initialize a crystal for ``self`` given reduced word ``w`` in the symmetric group,
        number of factors ``factors`` and``excess`` extra letters.

        EXAMPLES::

            sage: S = SymmetricGroup(3+1)
            sage: w = S.from_reduced_word([1, 3, 2])
            sage: B = crystals.FullyCommutativeStableGrothendieck(w, 3, 2)
            sage: B.w
            (1, 3, 2)
            sage: B.factors
            3
            sage: B.excess
            2
            sage: B.H
            0-Hecke monoid of the Symmetric group of order 4! as a permutation group

        The reduced word ``w`` should be fully commutative, that is, its
        associated permutation should avoid the pattern 321::

            sage: S = SymmetricGroup(3+1)
            sage: w = S.from_reduced_word([1, 2, 1])
            sage: B = crystals.FullyCommutativeStableGrothendieck(w, 4, 2)
            Traceback (most recent call last):
            ...
            ValueError: w should be fully commutative

        TESTS::

            sage: S = SymmetricGroup(3+1)
            sage: w = S.from_reduced_word([2, 3, 1])
            sage: B = crystals.FullyCommutativeStableGrothendieck(w, 4, 2)
            sage: TestSuite(B).run()
        """
        # Check if w is fully commutative
        word = w.reduced_word()
        p = permutation.from_reduced_word(word)
        if p.has_pattern([3, 2, 1]):
            raise ValueError("w should be fully commutative")

        Parent.__init__(self, category=ClassicalCrystals())
        self.w = tuple(word)
        self.factors = factors
        self.H = w.parent()
        self.max_value = len(self.H.gens())
        self.excess = excess
        self._cartan_type = CartanType(['A', self.factors - 1])
    def __init__(self, ct, La, c):
        r"""
        EXAMPLES::

            sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights()
            sage: M = crystals.NakajimaMonomials(['A',2], La[1]+La[2])
            sage: TestSuite(M).run()

            sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights()
            sage: M = crystals.NakajimaMonomials(['C',2,1], La[0])
            sage: TestSuite(M).run(max_runs=100)
        """
        if ct.is_finite():
            cat = ClassicalCrystals()
        else:
            cat = (RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets())
        InfinityCrystalOfNakajimaMonomials.__init__(self, ct, c, cat)
        self._cartan_type = ct
        self.hw = La
        gen = {(i,0): c for i,c in La}
        self.module_generators = (self.element_class(self, gen, {}),)
Beispiel #13
0
    def __init__(self, cartan_type, highest_weight):
        """
        EXAMPLES::

            sage: C = ClassicalCrystalOfAlcovePaths(['A',3],[1,0,0])
            sage: C.list()
            [[], [0], [0, 1], [0, 1, 2]]
            sage: TestSuite(C).run()
        """
        Parent.__init__(self, category=ClassicalCrystals())
        self._cartan_type = CartanType(cartan_type)
        self._name = "The crystal of alcove paths for type %s" % cartan_type
        self.chain_cache = {}
        self.endweight_cache = {}

        self.R = RootSystem(cartan_type)
        alpha = self.R.root_space().simple_roots()
        Lambda = self.R.weight_space().basis()

        self.positive_roots = sorted(self.R.root_space().positive_roots())

        self.weight = Lambda[Integer(1)] - Lambda[Integer(1)]
        offset = self.R.index_set()[Integer(0)]
        for j in self.R.index_set():
            self.weight = self.weight + highest_weight[j - offset] * Lambda[j]

        self.initial_element = self([])

        self.initial_element.chain = self.get_initial_chain(self.weight)
        rho = (Integer(1) / Integer(2)) * sum(self.positive_roots)
        self.initial_element.endweight = rho

        self.chain_cache[str([])] = self.initial_element.chain
        self.endweight_cache[str([])] = self.initial_element.endweight

        self.module_generators = [self.initial_element]

        self._list = super(ClassicalCrystalOfAlcovePaths, self).list()
        self._digraph = super(ClassicalCrystalOfAlcovePaths, self).digraph()
        self._digraph_closure = self.digraph().transitive_closure()
Beispiel #14
0
    def __init__(self, dominant_weight):
        """
        EXAMPLES::

            sage: C = CartanType(['E',6])
            sage: La = C.root_system().weight_lattice().fundamental_weights()
            sage: T = crystals.HighestWeight(2*La[2])
            sage: T.cartan_type()
            ['E', 6]
            sage: T.module_generators
            [[[(2, -1), (1,)], [(2, -1), (1,)]]]
            sage: T.cardinality()
            2430
            sage: T = crystals.HighestWeight(La[2])
            sage: T.cardinality()
            78
        """
        self._cartan_type = dominant_weight.parent().cartan_type()
        self._highest_weight = dominant_weight
        assert dominant_weight.is_dominant()
        self.rename()
        Parent.__init__(self, category = ClassicalCrystals())
        self.module_generators = [self.module_generator()]
Beispiel #15
0
    def __init__(self, ct, element_class, case):
        """
        EXAMPLES::

            sage: E = crystals.SpinsMinus(['D',4])
            sage: TestSuite(E).run()
        """
        self._cartan_type = CartanType(ct)
        if case == "spins":
            self.rename("The crystal of spins for type %s" % ct)
        elif case == "plus":
            self.rename("The plus crystal of spins for type %s" % ct)
        else:
            self.rename("The minus crystal of spins for type %s" % ct)

        self.Element = element_class
        Parent.__init__(self, category=ClassicalCrystals())

        if case == "minus":
            generator = [1] * (ct[1] - 1)
            generator.append(-1)
        else:
            generator = [1] * ct[1]
        self.module_generators = (self.element_class(self, tuple(generator)), )
Beispiel #16
0
    def __init__(self, ct, shape, format):
        """
        EXAMPLES::

            sage: C = crystals.FastRankTwo(['A',2],shape=[4,1]); C
            The fast crystal for A2 with shape [4,1]
            sage: TestSuite(C).run()
        """
        Parent.__init__(self, category = ClassicalCrystals())
#        super(FastCrystal, self).__init__(category = FiniteEnumeratedSets())
        self._cartan_type = ct
        if ct[1] != 2:
            raise NotImplementedError

        l1 = shape[0]
        l2 = shape[1]

        # For safety, delpat and gampat should be immutable

        self.delpat = []
        self.gampat = []

        if ct[0] == 'A':
            self._type_a_init(l1, l2)
        elif ct[0] == 'B' or ct[0] == 'C':
            self._type_bc_init(l1, l2)
        else:
            raise NotImplementedError

        self.format = format
        self.size = len(self.delpat)
        self._rootoperators = []
        self.shape = shape

        for i in range(self.size):
            target = [x for x in self.delpat[i]]

            target[0] = target[0]-1
            e1 = None if target not in self.delpat else self.delpat.index(target)
            target[0] = target[0]+1+1
            f1 = None if target not in self.delpat else self.delpat.index(target)

            target = [x for x in self.gampat[i]]
            target[0] = target[0]-1
            e2 = None if target not in self.gampat else self.gampat.index(target)
            target[0] = target[0]+1+1
            f2 = None if target not in self.gampat else self.gampat.index(target)

            self._rootoperators.append([e1,f1,e2,f2])

        if int(2*l1)%2 == 0:
            l1_str = "%d"%l1
            l2_str = "%d"%l2
        else:
            assert self._cartan_type[0] == 'B' and int(2*l2)%2 == 1
            l1_str = "%d/2"%int(2*l1)
            l2_str = "%d/2"%int(2*l2)
        self.rename("The fast crystal for %s2 with shape [%s,%s]"%(ct[0],l1_str,l2_str))
        self.module_generators = [self(0)]
#        self._list = ClassicalCrystal.list(self)
        self._list = super(FastCrystal, self).list()
#        self._digraph = ClassicalCrystal.digraph(self)
        self._digraph = super(FastCrystal, self).digraph()
        self._digraph_closure = self.digraph().transitive_closure()